diff --git a/generated-src/ambush.cpp b/generated-src/ambush.cpp index 9f7ec7a..397e035 100644 --- a/generated-src/ambush.cpp +++ b/generated-src/ambush.cpp @@ -87,7 +87,7 @@ void Ambush::StartChallenge() targetRoomType = 0; } else { - targetRoomType = (GHIDRA_CAST((doorStopOwner)))->Entity_Player::GetTrinketMultiplier(0x7c); + targetRoomType = Entity_Player::GetTrinketMultiplier(doorStopOwner,0x7c); } doorOffset = 0x724; doorSlot = 0; @@ -231,7 +231,7 @@ LAB_00833972: local_68 = GHIDRA_CAST(local_58[-1]); local_8c.x = (float)(GHIDRA_INT(local_68) % room->_gridWidth) * 40.0 + 40.0; local_8c.y = (float)(GHIDRA_INT(local_68) / room->_gridWidth) * 40.0 + 120.0; - (GHIDRA_CAST((room)))->Room::FindFreeTilePosition(&local_74,&local_8c,0.0); + Room::FindFreeTilePosition(room,&local_74,&local_8c,0.0); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x14)))); if (*puVar6 - 10 < 0x3de) { if (uVar3 == 0) { @@ -279,7 +279,7 @@ LAB_00833972: &g_vectorZero,GHIDRA_CAST(0x0),GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_58) + 6))), uVar3); if (local_68->_type == 1000) { - local_68->Update(); + (**(code **)(*GHIDRA_CAST(local_68) + 0xc))(); } local_68->_spawnGridIndex = puVar6[-1]; local_54 = g_game; @@ -305,7 +305,7 @@ LAB_00833b32: if (uVar3 < GHIDRA_UINT((GHIDRA_INT(pvVar5) - GHIDRA_INT(playerSlot) >> 2))) { playerSlot = playerSlot + uVar3; } - (GHIDRA_CAST((GHIDRA_CAST(*playerSlot))))->Entity_Player::spawn_locusts(); + Entity_Player::spawn_locusts(GHIDRA_CAST(*playerSlot)); uVar3 = uVar3 + 1; playerManager = &g_game->_playerManager; } while (uVar3 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - @@ -329,7 +329,7 @@ LAB_00833b32: } local_54 = GHIDRA_CAST(&local_54->_roomConfig); local_90 = 0; - local_74.y = (float)(GHIDRA_CAST((room)))->Room::GetRoomShape(); + local_74.y = (float)Room::GetRoomShape(room); uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x14)))); if (uVar3 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); @@ -403,7 +403,7 @@ LAB_008337d3: uVar4 = uVar4 << ((uint8_t)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1c)))) & 0x1f) ^ uVar4; uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST(&this[1]._isActive) & 0x1f) ^ uVar4; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x14)))) = uVar4; - (GHIDRA_CAST((room)))->Room::TransformEntry(&entry,uVar3,uVar4); + Room::TransformEntry(room,&entry,uVar3,uVar4); if (&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(entry))[-1])) + 0x40f))) < GHIDRA_CAST(0x3e7)) { entryType = GHIDRA_CAST(entry); if (GHIDRA_CAST(entry) == GHIDRA_CAST(0x3e7)) { @@ -502,7 +502,7 @@ void Ambush::SpawnBossrushWave() if (uVar3 < GHIDRA_UINT((GHIDRA_INT(pvVar5) - GHIDRA_INT(playerSlot) >> 2))) { playerSlot = playerSlot + uVar3; } - (GHIDRA_CAST((GHIDRA_CAST(*playerSlot))))->Entity_Player::spawn_locusts(); + Entity_Player::spawn_locusts(GHIDRA_CAST(*playerSlot)); uVar3 = uVar3 + 1; playerManager = &g_game->_playerManager; } while (uVar3 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - @@ -582,7 +582,7 @@ void Ambush::Update() tempEffect[1] = 0; local_c = 0; tempEffect[0] = iVar1; - (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::RemoveEffect(tempEffect,1); + TemporaryEffects::RemoveEffect(&player->_temporaryeffects,tempEffect,1); } playerIndex = playerIndex + 1; } while (playerIndex < @@ -618,7 +618,7 @@ void Ambush::Update() GHIDRA_INT((g_manager->_musicManager)._entries._begin)) / 0x60) { (g_manager->_musicManager)._queuedMusicID = 0x25; } - (GHIDRA_CAST((g_game->_room)))->Room::SpawnClearAward(); + Room::SpawnClearAward(g_game->_room); PlayerManager::trigger_room_clear(&g_game->_playerManager); if (iVar1 == 0x11) { PlayerManager::trigger_room_clear(&g_game->_playerManager); diff --git a/generated-src/beast_arena.cpp b/generated-src/beast_arena.cpp index f15d07e..ae7627c 100644 --- a/generated-src/beast_arena.cpp +++ b/generated-src/beast_arena.cpp @@ -229,7 +229,7 @@ void BeastArena::update() entityType = this_00->_type; if (entityType == 1) { LAB_0083a185: - (GHIDRA_CAST((this_00)))->Entity::PlayerCollideWithGrid(0); + Entity::PlayerCollideWithGrid(this_00,0); } else { if (entityType != 3) { diff --git a/generated-src/boss_overlay.cpp b/generated-src/boss_overlay.cpp index 7965a8a..678afc2 100644 --- a/generated-src/boss_overlay.cpp +++ b/generated-src/boss_overlay.cpp @@ -45,7 +45,7 @@ void BossOverlay::update() game = g_game; (manager->_sfxManager)._volumeModifierStep = 0.005; Game::StartRoomTransition(game,-10,-1,1,GHIDRA_CAST(0x0),-1); - (GHIDRA_CAST((&g_game->_roomTransition)))->RoomTransition::Update(); + RoomTransition::Update(&g_game->_roomTransition); return; } if ((in_ECX[0xf] != 0) && ((char)in_ECX[0x13] != '\0')) { diff --git a/generated-src/boss_pool.cpp b/generated-src/boss_pool.cpp deleted file mode 100644 index 91adcdd..0000000 --- a/generated-src/boss_pool.cpp +++ /dev/null @@ -1,779 +0,0 @@ -#include "classes.h" - -// 004218e0 -void BossPool::init(uint32_t seed) -{ - uint32_t *pickedEntry; - code *pcVar2; - uint32_t uVar3; - uint32_t uVar4; - uint32_t lastEntryTail; - uint32_t uVar6; - uint32_t uVar7; - uint32_t uVar8; - uint32_t uVar9; - uint8_t isFillValue; - int wordOffset; - uint32_t uVar10; - uint32_t uVar11; - uint32_t swapIndex; - uint32_t uVar12; - uint32_t *poolRng; - int poolsLeft; - int lastEntryOffset; - int *local_9dc; - MTRNG mtRng [832]; - uint32_t local_18; - uint32_t local_c; - uint8_t auStack_8 [4]; - int blacklistBits; - uint32_t *lastEntry; - uint32_t lastEntryTail; - uint32_t *pickedEntry; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - poolRng = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x28)))); - local_9dc = GHIDRA_CAST(0x25); - do { - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar10 = seed >> 3 ^ seed; - poolRng[1] = 2; - poolRng[2] = 0x15; - uVar10 = uVar10 << 0xd ^ uVar10; - seed = uVar10 >> 7 ^ uVar10; - *poolRng = seed; - poolRng[3] = 9; - poolRng = poolRng + 0xf; - local_9dc = GHIDRA_CAST((GHIDRA_INT(local_9dc) + -1)); - } while (local_9dc != GHIDRA_CAST(0x0)); - vector_bool_resize(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8ac))),0x68,7); - vector_bool_resize(this + 1,0x68,isFillValue); - uVar10 = 0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8b8)))) != 0) { - do { - wordOffset = (uVar10 >> 5) * 4; - swapIndex = uVar10 & 0x1f; - blacklistBits = *GHIDRA_CAST((this + 1)); - uVar11 = *GHIDRA_CAST((blacklistBits + wordOffset)) & ~(1 << swapIndex); - *GHIDRA_CAST((blacklistBits + wordOffset)) = uVar11; - uVar12 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8ac)))) + wordOffset)); - if ((uVar11 & 1 << (sbyte)swapIndex) == 0) { - uVar12 = uVar12 & ~(1 << swapIndex); - } - else { - uVar12 = uVar12 | 1 << swapIndex; - } - uVar10 = uVar10 + 1; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8ac)))) + wordOffset)) = uVar12; - } while (uVar10 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8b8))))); - } - load_xml("bosspools.xml",0); - ModManager::LoadModBossPools(); - local_9dc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18)))); - poolsLeft = 0x25; - do { - if (*local_9dc != local_9dc[1]) { - local_18 = 0x271; - (GHIDRA_CAST((mtRng)))->MTRNG::Init(local_9dc[4]); - uVar10 = (local_9dc[1] - *local_9dc) / 0x14; - uVar12 = uVar10 - 1; - if (0 < GHIDRA_INT(uVar12)) { - lastEntryOffset = uVar12 * 0x14; - do { - uVar11 = (GHIDRA_CAST((mtRng)))->MTRNG::Next(); - swapIndex = 0; - if (uVar10 != 0) { - swapIndex = uVar11 % uVar10; - } - if (uVar12 != swapIndex) { - blacklistBits = *local_9dc; - pickedEntry = GHIDRA_CAST((blacklistBits + swapIndex * 0x14)); - uVar3 = pickedEntry[1]; - uVar4 = pickedEntry[2]; - lastEntryTail = pickedEntry[3]; - pickedEntry = GHIDRA_CAST((blacklistBits + swapIndex * 0x14)); - lastEntryTail = *GHIDRA_CAST((lastEntryOffset + 0x10 + blacklistBits)); - lastEntry = GHIDRA_CAST((lastEntryOffset + blacklistBits)); - uVar6 = *lastEntry; - uVar7 = lastEntry[1]; - uVar8 = lastEntry[2]; - uVar9 = lastEntry[3]; - lastEntry = GHIDRA_CAST((lastEntryOffset + blacklistBits)); - *lastEntry = *pickedEntry; - lastEntry[1] = uVar3; - lastEntry[2] = uVar4; - lastEntry[3] = lastEntryTail; - *GHIDRA_CAST((lastEntryOffset + 0x10 + blacklistBits)) = pickedEntry[4]; - *pickedEntry = uVar6; - pickedEntry[1] = uVar7; - pickedEntry[2] = uVar8; - pickedEntry[3] = uVar9; - pickedEntry[4] = lastEntryTail; - } - uVar12 = uVar12 - 1; - lastEntryOffset = lastEntryOffset + -0x14; - uVar10 = uVar10 - 1; - } while (0 < GHIDRA_INT(uVar12)); - } - } - local_9dc = local_9dc + 0xf; - poolsLeft = poolsLeft + -1; - } while (poolsLeft != 0); - return; -} - -// 00421bf0 -void BossPool::load_xml(uint8_t *param_1, int param_2) -{ - uint8_t bVar1; - uint8_t *****pppppbVar2; - int *file; - int iVar3; - void *pvVar4; - uint8_t ****ppppbVar5; - uint32_t uVar6; - uint8_t *******pppppppbVar7; - uint8_t ****bossAttrNameCursor; - uint8_t *pbVar8; - uint32_t length; - char *keyCursor; - uint32_t *poolAttr; - uint8_t *poolAttrValue; - bool bVar9; - double dVar10; - uint8_t auStack_100cc [8]; - void *pvStack_100c4; - int iStack_100c0; - uint8_t *xmlText; - int poolNode; - uint8_t ****attrName; - uint8_t auStack_100b0 [4]; - uint8_t ******ppppppbStack_100ac; - char *stageKeyName; - uint8_t *******pppppppbStack_100a4; - uint8_t bStack_1009d; - uint8_t *****bossId; - uint8_t *****bossWeight; - uint8_t *****bossInitialWeight; - uint8_t *****pppppbStack_10090; - uint8_t *****bossRoom; - uint8_t xmlDoc [48]; - uint8_t xmlPool [65564]; - uint8_t *******stageName [4]; - uint32_t stageNameSize; - uint32_t stageNameCapacity; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint8_t ******local_14; - uint8_t ******bossesEnd; - Manager *manager; - - puStack_20 = GHIDRA_CAST((stageName + 0xe)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00af1814; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((stageName + 0xb)); - ExceptionList = &local_1c; - if (param_2 == 0) { - pppppppbVar7 = GHIDRA_CAST((stageName + 0xe)); - if (*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c7f6f0) { - _Init_thread_header(&DAT_00c7f6f0,local_24); - pppppppbVar7 = GHIDRA_CAST(puStack_20); - if (DAT_00c7f6f0 == -1) { - local_14 = GHIDRA_CAST(0x0); - DAT_00c7f6f4 = operator_new(0x2c); - *(void **)DAT_00c7f6f4 = DAT_00c7f6f4; - *(void **)(GHIDRA_CAST(DAT_00c7f6f4) + 4) = DAT_00c7f6f4; - *(void **)(GHIDRA_CAST(DAT_00c7f6f4) + 8) = DAT_00c7f6f4; - *GHIDRA_CAST((GHIDRA_CAST(DAT_00c7f6f4) + 0xc)) = 0x101; - _atexit(FUN_00b153a0); - local_14 = GHIDRA_CAST(0xffffffff); - _Init_thread_footer(&DAT_00c7f6f0); - pppppppbVar7 = GHIDRA_CAST(puStack_20); - } - } - puStack_20 = GHIDRA_CAST(pppppppbVar7); - if (DAT_00c7f6f8 == 0) { - stageKeyName = "basement"; - pppppppbStack_100a4 = GHIDRA_CAST(0x1); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "cellar"; - pppppppbStack_100a4 = GHIDRA_CAST(0x2); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "caves"; - pppppppbStack_100a4 = GHIDRA_CAST(0x4); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "catacombs"; - pppppppbStack_100a4 = GHIDRA_CAST(0x5); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "depths"; - pppppppbStack_100a4 = GHIDRA_CAST(0x7); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "necropolis"; - pppppppbStack_100a4 = GHIDRA_CAST(0x8); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "womb"; - pppppppbStack_100a4 = GHIDRA_CAST(0xa); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "utero"; - pppppppbStack_100a4 = GHIDRA_CAST(0xb); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "sheol"; - pppppppbStack_100a4 = GHIDRA_CAST(0xe); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "cathedral"; - pppppppbStack_100a4 = GHIDRA_CAST(0xf); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "dark room"; - pppppppbStack_100a4 = GHIDRA_CAST(0x10); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "chest"; - pppppppbStack_100a4 = GHIDRA_CAST(0x11); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "burning basement"; - pppppppbStack_100a4 = GHIDRA_CAST(0x3); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "flooded caves"; - pppppppbStack_100a4 = GHIDRA_CAST(0x6); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "dank depths"; - pppppppbStack_100a4 = GHIDRA_CAST(0x9); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "scarred womb"; - pppppppbStack_100a4 = GHIDRA_CAST(0xc); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "blue womb"; - pppppppbStack_100a4 = GHIDRA_CAST(0xd); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "void"; - pppppppbStack_100a4 = GHIDRA_CAST(0x1a); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "downpour"; - pppppppbStack_100a4 = GHIDRA_CAST(0x1b); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "mines"; - pppppppbStack_100a4 = GHIDRA_CAST(0x1d); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "mausoleum"; - pppppppbStack_100a4 = GHIDRA_CAST(0x1f); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "corpse"; - pppppppbStack_100a4 = GHIDRA_CAST(0x21); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "dross"; - pppppppbStack_100a4 = GHIDRA_CAST(0x1c); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "ashpit"; - pppppppbStack_100a4 = GHIDRA_CAST(0x1e); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "gehenna"; - pppppppbStack_100a4 = GHIDRA_CAST(0x20); - FUN_00423500(auStack_100b0,&stageKeyName); - stageKeyName = "mortis"; - pppppppbStack_100a4 = GHIDRA_CAST(0x22); - FUN_00423500(auStack_100b0,&stageKeyName); - } - file = (GHIDRA_CAST((&PTR_vftable_00c37a10)))->FileSystem::Open(param_1,GHIDRA_CAST(0x0)); - if (file != GHIDRA_CAST(0x0)) { - iVar3 = (**(code **)(*file + 4))(); - xmlText = operator_new_tracked(iVar3 + 1); - (**(code **)(*file + 0x14))(xmlText,1,iVar3); - xmlText[iVar3] = 0; - (**(code **)*file)(1); - FUN_00413b90(); - local_14 = GHIDRA_CAST(0x1); - iVar3 = 0x4220d8; - pbVar8 = xmlText; - (GHIDRA_CAST((xmlDoc)))->rapidxml::xml_document::parse(xmlText); - pvVar4 = (GHIDRA_CAST((xmlDoc)))->xml_node::first_node(GHIDRA_CAST("bosspools"),iVar3,(uint8_t)pbVar8); - if (pvVar4 != (void *)0x0) { - for (poolNode = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x18)); poolNode != 0; - poolNode = *GHIDRA_CAST((poolNode + 0x2c))) { - stageNameSize = 0; - stageNameCapacity = 0xf; - stageName[0] = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))) = (undefined3)(GHIDRA_UINT(local_14) >> 8); - local_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),2)); - poolAttr = *GHIDRA_CAST((poolNode + 0x20)); - ppppppbStack_100ac = GHIDRA_CAST(0x0); - if (poolAttr != GHIDRA_CAST(0x0)) { - do { - pbVar8 = s_name; - attrName = GHIDRA_CAST(&g_xmlNullStr); - if (GHIDRA_CAST(*poolAttr) != GHIDRA_CAST(0x0)) { - attrName = GHIDRA_CAST(*poolAttr); - } - poolAttrValue = &g_xmlNullStr; - if (GHIDRA_CAST(poolAttr[1]) != GHIDRA_CAST(0x0)) { - poolAttrValue = GHIDRA_CAST(poolAttr[1]); - } - ppppbVar5 = attrName; - do { - bStack_1009d = *GHIDRA_CAST(ppppbVar5); - bVar9 = bStack_1009d < *pbVar8; - if (bStack_1009d != *pbVar8) { -LAB_004221a2: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_004221a7; - } - if (bStack_1009d == 0) break; - bStack_1009d = *GHIDRA_CAST((GHIDRA_CAST(ppppbVar5) + 1)); - bVar9 = bStack_1009d < pbVar8[1]; - if (bStack_1009d != pbVar8[1]) goto LAB_004221a2; - ppppbVar5 = GHIDRA_CAST((GHIDRA_INT(ppppbVar5) + 2)); - pbVar8 = pbVar8 + 2; - } while (bStack_1009d != 0); - uVar6 = 0; -LAB_004221a7: - if (uVar6 == 0) { - pbVar8 = poolAttrValue; - do { - bVar1 = *pbVar8; - pbVar8 = pbVar8 + 1; - } while (bVar1 != 0); - (GHIDRA_CAST((GHIDRA_CAST(stageName))))->msvc::string::assign(poolAttrValue, - GHIDRA_INT(pbVar8) - GHIDRA_INT((poolAttrValue + 1))); - } - else { - keyCursor = "doubletrouble"; - ppppbVar5 = attrName; - do { - bVar1 = *GHIDRA_CAST(ppppbVar5); - bVar9 = bVar1 < (uint8_t)*keyCursor; - if (bVar1 != *keyCursor) { -LAB_004221f0: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_004221f5; - } - if (bVar1 == 0) break; - bVar1 = *GHIDRA_CAST((GHIDRA_CAST(ppppbVar5) + 1)); - bVar9 = bVar1 < (uint8_t)keyCursor[1]; - if (bVar1 != keyCursor[1]) goto LAB_004221f0; - ppppbVar5 = GHIDRA_CAST((GHIDRA_INT(ppppbVar5) + 2)); - keyCursor = keyCursor + 2; - } while (bVar1 != 0); - uVar6 = 0; -LAB_004221f5: - if (uVar6 == 0) { - ppppppbStack_100ac = GHIDRA_CAST(atoi(GHIDRA_CAST(poolAttrValue))); - } - } - } while ((poolAttr[4] != 0) && - (poolAttr = GHIDRA_CAST(poolAttr[6]), poolAttr != GHIDRA_CAST(0x0))); - } - uVar6 = stageNameCapacity; - FUN_00423530(auStack_100cc,stageName); - pvVar4 = pvStack_100c4; - if (*GHIDRA_CAST((GHIDRA_CAST(pvStack_100c4) + 0xd)) == '\0') { - pbVar8 = GHIDRA_CAST((GHIDRA_INT(pvStack_100c4) + 0x10)); - if (0xf < *GHIDRA_CAST((GHIDRA_CAST(pvStack_100c4) + 0x24))) { - pbVar8 = *GHIDRA_CAST(pbVar8); - } - pppppppbVar7 = GHIDRA_CAST(stageName); - if (0xf < uVar6) { - pppppppbVar7 = stageName[0]; - } - iVar3 = string_compare(GHIDRA_CAST(pppppppbVar7),stageNameSize,pbVar8, - *GHIDRA_CAST((GHIDRA_CAST(pvStack_100c4) + 0x20))); - if ((iVar3 < 0) || (pvVar4 == DAT_00c7f6f4)) goto LAB_004224fe; - pppppppbStack_100a4 = - (uint8_t *******) - (iStack_100c0 + - (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x28)) * 0x10 - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x28))) * 4); - if (GHIDRA_CAST(pppppppbStack_100a4) != stageName) { - pppppppbVar7 = GHIDRA_CAST(stageName); - if (0xf < uVar6) { - pppppppbVar7 = stageName[0]; - } - (GHIDRA_CAST((GHIDRA_CAST(pppppppbStack_100a4))))->msvc::string::assign(GHIDRA_CAST(pppppppbVar7),length); - } - pppppppbStack_100a4[0xe] = ppppppbStack_100ac; - pppppppbStack_100a4[7] = pppppppbStack_100a4[6]; - pppppppbStack_100a4[9] = GHIDRA_CAST(0x0); - ppppppbStack_100ac = *GHIDRA_CAST((poolNode + 0x18)); - if (ppppppbStack_100ac != GHIDRA_CAST(0x0)) { - do { - pppppbVar2 = ppppppbStack_100ac[8]; - bossId = GHIDRA_CAST(0x0); - bossRoom = GHIDRA_CAST(0x0); - for (; pppppbVar2 != GHIDRA_CAST(0x0); pppppbVar2 = GHIDRA_CAST(pppppbVar2[6])) { - pbVar8 = s_id; - attrName = GHIDRA_CAST(&g_xmlNullStr); - if (*pppppbVar2 != GHIDRA_CAST(0x0)) { - attrName = *pppppbVar2; - } - ppppbVar5 = GHIDRA_CAST(&g_xmlNullStr); - if (pppppbVar2[1] != GHIDRA_CAST(0x0)) { - ppppbVar5 = pppppbVar2[1]; - } - bossAttrNameCursor = attrName; - do { - bStack_1009d = *GHIDRA_CAST(bossAttrNameCursor); - bVar9 = bStack_1009d < *pbVar8; - if (bStack_1009d != *pbVar8) { -LAB_00422368: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_0042236d; - } - if (bStack_1009d == 0) break; - bStack_1009d = *GHIDRA_CAST((GHIDRA_CAST(bossAttrNameCursor) + 1)); - bVar9 = bStack_1009d < pbVar8[1]; - if (bStack_1009d != pbVar8[1]) goto LAB_00422368; - bossAttrNameCursor = GHIDRA_CAST((GHIDRA_INT(bossAttrNameCursor) + 2)); - pbVar8 = pbVar8 + 2; - } while (bStack_1009d != 0); - uVar6 = 0; -LAB_0042236d: - if (uVar6 == 0) { - bossId = GHIDRA_CAST(atoi(GHIDRA_CAST(ppppbVar5))); - } - else { - keyCursor = "weight"; - bossAttrNameCursor = attrName; - do { - bStack_1009d = *GHIDRA_CAST(bossAttrNameCursor); - bVar9 = bStack_1009d < (uint8_t)*keyCursor; - if (bStack_1009d != *keyCursor) { -LAB_004223d2: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_004223d7; - } - if (bStack_1009d == 0) break; - bStack_1009d = *GHIDRA_CAST((GHIDRA_CAST(bossAttrNameCursor) + 1)); - bVar9 = bStack_1009d < (uint8_t)keyCursor[1]; - if (bStack_1009d != keyCursor[1]) goto LAB_004223d2; - bossAttrNameCursor = GHIDRA_CAST((GHIDRA_INT(bossAttrNameCursor) + 2)); - keyCursor = keyCursor + 2; - } while (bStack_1009d != 0); - uVar6 = 0; -LAB_004223d7: - if (uVar6 == 0) { - dVar10 = atof(GHIDRA_CAST(ppppbVar5)); - bossWeight = GHIDRA_CAST((float)dVar10); - } - else { - pbVar8 = &DAT_00b1c17c; - bossAttrNameCursor = attrName; - do { - bVar1 = *GHIDRA_CAST(bossAttrNameCursor); - bVar9 = bVar1 < *pbVar8; - if (bVar1 != *pbVar8) { -LAB_00422410: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_00422415; - } - if (bVar1 == 0) break; - bVar1 = *GHIDRA_CAST((GHIDRA_CAST(bossAttrNameCursor) + 1)); - bVar9 = bVar1 < pbVar8[1]; - if (bVar1 != pbVar8[1]) goto LAB_00422410; - bossAttrNameCursor = GHIDRA_CAST((GHIDRA_INT(bossAttrNameCursor) + 2)); - pbVar8 = pbVar8 + 2; - } while (bVar1 != 0); - uVar6 = 0; -LAB_00422415: - if (uVar6 == 0) { - bossRoom = GHIDRA_CAST(atoi(GHIDRA_CAST(ppppbVar5))); - } - } - } - if (pppppbVar2[4] == GHIDRA_CAST(0x0)) break; - } - pppppbVar2 = bossId; - manager = g_manager; - if ((GHIDRA_INT(bossId) < 0) || - ((GHIDRA_INT((g_manager->_entityConfig)._bosses._end) - - GHIDRA_INT((g_manager->_entityConfig)._bosses._begin)) / 100 <= GHIDRA_INT(bossId))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("BossID out of bounds\n")); - } - pppppppbVar7 = pppppppbStack_100a4; - bossInitialWeight = bossWeight; - pppppbStack_10090 = - *(uint8_t ******) - (GHIDRA_INT((manager->_entityConfig)._bosses._begin) + GHIDRA_INT(pppppbVar2) * 100 + 0x54); - bossesEnd = pppppppbStack_100a4[7]; - if (bossesEnd == pppppppbStack_100a4[8]) { - msvc::vector<20byte>::_Emplace_reallocate(bossesEnd,&bossId); - } - else { - *bossesEnd = bossId; - bossesEnd[1] = bossWeight; - bossesEnd[2] = bossWeight; - bossesEnd[3] = pppppbStack_10090; - bossesEnd[4] = bossRoom; - pppppppbStack_100a4[7] = pppppppbStack_100a4[7] + 5; - } - pppppppbVar7[9] = GHIDRA_CAST(((float)bossInitialWeight + (float)pppppppbVar7[9])); - ppppppbStack_100ac = GHIDRA_CAST(ppppppbStack_100ac[0xb]); - } while (ppppppbStack_100ac != GHIDRA_CAST(0x0)); - ppppppbStack_100ac = GHIDRA_CAST(0x0); - } - } - else { -LAB_004224fe: - KAGE_LogMessage(4,GHIDRA_CAST("Boss pool: Unknown stage \'%s\'\n")); - } - local_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1)); - if (0xf < stageNameCapacity) { - uVar6 = stageNameCapacity + 1; - pppppppbVar7 = stageName[0]; - if (0xfff < uVar6) { - pppppppbVar7 = GHIDRA_CAST(stageName[0][-1]); - uVar6 = stageNameCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(stageName[0]) + (-4 - GHIDRA_INT(pppppppbVar7))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppppbVar7,uVar6); - } - } - } - local_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),3)); - tracked_alloc(1,xmlText,0); - local_14 = GHIDRA_CAST(0x4); - (GHIDRA_CAST((xmlPool)))->xml_memory_pool::clear(); - } - } - ExceptionList = local_1c; - return; -} - -// 00422830 -int BossPool::GetBossId(int leveltype, int levelvariant, RNG *rng) -{ - code *pcVar1; - bool bVar2; - char cVar3; - uint8_t bVar4; - uint32_t uVar5; - uint32_t uVar6; - uint32_t uVar7; - uint32_t conquestRoll; - uint32_t specialRoll; - uint32_t stateFlagBossRoll; - int iVar8; - int *bossEntry; - uint32_t *poolEntry; - int iVar9; - int extraout_EDX; - int *extraout_EDX_00; - int bossId; - Manager *manager; - RNG *poolRng; - int rngShift2; - int rngShift3; - uint8_t *stagePool; - - manager = g_manager; - uVar5 = RoomConfig::GetStageID(leveltype,levelvariant,-1); - stagePool = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x0))) + uVar5 * 0x3c; - poolRng = GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x28))) + uVar5 * 0x3c)); - if (g_game->_challenge == 0x20) { - return 0x1e; - } - if ((g_game->_dailyChallenge)._specialDailyId == 0xd) { - switch(leveltype) { - case 1: - return 0x3c; - case 2: - return 0x2b; - case 3: - return 0x32; - case 4: - return 0x17; - case 5: - return 0x33; - case 7: - return 0xf; - } - } - if ((extraout_EDX == 4) || (extraout_EDX == 5)) { - switch(leveltype) { - case 6: - return 0x59; - case 8: - return 0x58; - case 10: - case 0xb: - return 0x28; - case 0xc: - goto switchD_00422915_caseD_c; - } - } - else { - switch(leveltype) { - case 6: - return 6; - case 8: - if (((manager->_persistentGameData)._achievements[0x22] == 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x8)))) != 2 || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) { - return 8; - } - return 0x19; - case 10: - iVar8 = 0x18; - if (extraout_EDX == 1) { - iVar8 = 0x27; - } - return iVar8; - case 0xb: - iVar8 = 0x36; - if (extraout_EDX == 1) { - iVar8 = 0x28; - } - return iVar8; - case 0xc: -switchD_00422915_caseD_c: - return 0x46; - } - } - uVar6 = (GHIDRA_CAST((poolRng)))->RNG::Next(); - uVar7 = (GHIDRA_CAST((poolRng)))->RNG::Next(); - conquestRoll = (GHIDRA_CAST((poolRng)))->RNG::Next(); - specialRoll = (GHIDRA_CAST((poolRng)))->RNG::Next(); - stateFlagBossRoll = (GHIDRA_CAST((poolRng)))->RNG::Next(); - (GHIDRA_CAST((poolRng)))->RNG::Next(); - (GHIDRA_CAST((poolRng)))->RNG::Next(); - uVar5 = poolRng->_seed; - iVar8 = poolRng->_shift1; - rngShift2 = poolRng->_shift2; - rngShift3 = poolRng->_shift3; - if (((uVar6 & 1) == 0) && - (((manager->_persistentGameData)._achievements[0x42] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - bVar2 = true; - } - else { - bVar2 = false; - } - if ((uVar7 % 10 == 0) && - ((((manager->_persistentGameData)._achievements[5] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) && - (((((leveltype == 1 || (leveltype == 3)) || (leveltype == 5)) || (leveltype == 7)) && - ((levelvariant != 4 && (levelvariant != 5)))))))) { - if ((conquestRoll == (conquestRoll / 10) * 10) && (cVar3 = FUN_00421720(0x16), cVar3 == '\0')) { - **GHIDRA_CAST((this + 1)) = **GHIDRA_CAST((this + 1)) | 0x400000; - return 0x16; - } - switch(leveltype) { - case 1: - cVar3 = FUN_00421720(9); - if (cVar3 == '\0') { - **GHIDRA_CAST((this + 1)) = **GHIDRA_CAST((this + 1)) | 0x200; - return 9; - } - break; - case 3: - cVar3 = FUN_00421720(10); - if (cVar3 == '\0') { - **GHIDRA_CAST((this + 1)) = **GHIDRA_CAST((this + 1)) | 0x400; - return 10; - } - break; - case 5: - cVar3 = FUN_00421720(0xb); - if (cVar3 == '\0') { - **GHIDRA_CAST((this + 1)) = **GHIDRA_CAST((this + 1)) | 0x800; - return 0xb; - } - break; - case 7: - cVar3 = FUN_00421720(0xc); - if (cVar3 == '\0') { - **GHIDRA_CAST((this + 1)) = **GHIDRA_CAST((this + 1)) | 0x1000; - if (bVar2) { - *GHIDRA_CAST((*GHIDRA_CAST((this + 1)) + 4)) = *GHIDRA_CAST((*GHIDRA_CAST((this + 1)) + 4)) | 0x40; - } - iVar8 = 0xc; - if (bVar2) { - iVar8 = 0x26; - } - return iVar8; - } - } - } - iVar9 = *GHIDRA_CAST((stagePool + 0x38)); - if (iVar9 != 0) { - if (g_game->_challenge == 0x22) { - uVar6 = 1; - } - else if ((leveltype == 3) || (leveltype == 4)) { - uVar6 = 0x32; - } - else if (leveltype == 5) { - uVar6 = 0x19; - } - else { - if (leveltype != 7) goto LAB_00422c80; - uVar6 = 0x28; - } - if (specialRoll % uVar6 == 0) { -LAB_00422e07: - return -iVar9; - } - } -LAB_00422c80: - if ((((stateFlagBossRoll == (stateFlagBossRoll / 10) * 10) && (levelvariant != 4)) && - (levelvariant != 5)) && - ((bVar4 = Game::GetStateFlag(g_game,6), bVar4 != 0 && - (cVar3 = FUN_00421720(0x17), cVar3 == '\0')))) { - **GHIDRA_CAST((this + 1)) = **GHIDRA_CAST((this + 1)) | 0x800000; - return 0x17; - } - leveltype = 0; - do { - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - iVar8 = (*pcVar1)(); - return iVar8; - } - uVar5 = uVar5 >> ((uint8_t)iVar8 & 0x1f) ^ uVar5; - uVar5 = uVar5 << ((uint8_t)rngShift2 & 0x1f) ^ uVar5; - uVar5 = uVar5 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar5; - bossEntry = GHIDRA_CAST(FUN_00422620(stagePool)); - if (bossEntry == GHIDRA_CAST(0x0)) { - poolEntry = *GHIDRA_CAST((stagePool + 0x18)); - if (poolEntry != *GHIDRA_CAST((stagePool + 0x1c))) { - do { - uVar6 = *poolEntry >> 5; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8ac)))) + uVar6 * 4)) = - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8ac)))) + uVar6 * 4)) & ~(1 << (*poolEntry & 0x1f)); - uVar6 = *poolEntry; - uVar7 = uVar6 >> 5; - poolEntry = poolEntry + 5; - *GHIDRA_CAST((*GHIDRA_CAST((this + 1)) + uVar7 * 4)) = - *GHIDRA_CAST((*GHIDRA_CAST((this + 1)) + uVar7 * 4)) & ~(1 << (uVar6 & 0x1f)); - } while (poolEntry != *GHIDRA_CAST((stagePool + 0x1c))); - } - } - else { - bossId = *bossEntry; - if (((bossId != 0x4a) || (g_game->_challenge != 0x24)) && - ((bossEntry[3] < 0 || - (bVar4 = PersistentGameData::Unlocked(&g_manager->_persistentGameData,bossEntry[3]), - bossEntry = extraout_EDX_00, bVar4 != 0)))) { - iVar9 = bossEntry[4]; - if (iVar9 == 0) { - return bossId; - } - goto LAB_00422e07; - } - } - leveltype = leveltype + 1; - if (9 < leveltype) { - KAGE_LogMessage(4,GHIDRA_CAST("Failed to pick a boss room variant, defaulting to Monstro\n")); - return 1; - } - } while( true ); -} diff --git a/generated-src/camera.cpp b/generated-src/camera.cpp deleted file mode 100644 index 7781521..0000000 --- a/generated-src/camera.cpp +++ /dev/null @@ -1,1569 +0,0 @@ -#include "classes.h" - -// 0091e980 -void Camera::UpdateUltrasmooth(uint32_t *param_2, int *param_3) -{ - uint8_t bVar1; - code *pcVar2; - uint8_t *puVar3; - char cVar4; - uint32_t securityCookie; - uint8_t *match; - uint32_t extraout_ECX; - uint32_t extraout_ECX_00; - uint32_t extraout_ECX_01; - uint32_t uVar5; - uint32_t extraout_ECX_02; - uint32_t securityCookie; - uint32_t *message; - int *profanityNode; - uint8_t *haystack; - uint32_t uVar7; - uint8_t **stream; - uint8_t local_3c [8]; - int foundNode; - uint64_t local_30; - Camera *self; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - Manager *manager; - Camera *self2; - - message = param_2; - puStack_20 = local_3c + 0x38; - puStack_18 = &LAB_00b0a4c8; - local_1c = ExceptionList; - securityCookie = __security_cookie ^ GHIDRA_UINT((local_3c + 0x2c)); - ExceptionList = &local_1c; - local_14 = 0; - self = this; - puVar3 = local_3c + 0x38; - if ((g_manager->_optionsConfig)._onlineChatEnabled != 0) { - local_30 = *GHIDRA_CAST(param_2); - FUN_00731ee0(local_3c,&local_30); - self2 = self; - if (*GHIDRA_CAST((foundNode + 0xd)) == '\0') { - if ((*GHIDRA_CAST((foundNode + 0x14)) <= message[1]) && - (((*GHIDRA_CAST((foundNode + 0x14)) < message[1] || (*GHIDRA_CAST((foundNode + 0x10)) <= *message)) - && (puVar3 = puStack_20, foundNode != *GHIDRA_CAST((this[10]._focusPositionBuffer + 8)))))) - goto LAB_0091ec0a; - } - local_24 = **GHIDRA_CAST(self->_aimOffsetBuffer); - if (GHIDRA_CAST(local_24) != *GHIDRA_CAST(self->_aimOffsetBuffer)) { - uVar7 = 0x80000000; - do { - if (*GHIDRA_CAST((local_24 + 0x3c)) < *GHIDRA_CAST((*GHIDRA_CAST((local_24 + 0x18)) + 0x5f8))) { - *GHIDRA_CAST((local_24 + 0x38)) = *GHIDRA_CAST(self2[10]._shakeOffsetBuffer) ^ uVar7; - } - *GHIDRA_CAST((local_24 + 0x3c)) = *GHIDRA_CAST((local_24 + 0x3c)) + 1; - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_24); - } while (local_24 != *GHIDRA_CAST(self2->_aimOffsetBuffer)); - message = param_2; - } - if (message[3] != 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("This function should only be called on consolidated messages")); - message = param_2; - } - if (message[3] != 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("This function should only be called on consolidated messages")); - } - stream = KAGE::Filesys::BufferedStream::vftable; - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - local_30 = 0; - memory_stream_read(&stream,&local_30,8,1); - local_24 = 0; - if ((code *)stream[5] == memory_stream_read) { - memory_stream_read(&stream,&local_24,2,1); - } - else { - (*(code *)stream[5])(&local_24); - } - uVar7 = local_24 & 0xffff; - memory_stream_read(&stream,&DAT_00c93050,1,uVar7); - manager = g_manager; - if (0x7ff < uVar7) { - FUN_00aef86f(); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - (&DAT_00c93050)[uVar7] = 0; - securityCookie = extraout_ECX; - if ((manager->_optionsConfig)._onlineFilterEnabled != 0) { - profanity_list_load(); - profanityNode = GHIDRA_CAST(*DAT_00c7986c); - securityCookie = extraout_ECX_00; - if (profanityNode != DAT_00c7986c) { - do { - haystack = &DAT_00c93050; - match = stristr(&DAT_00c93050,GHIDRA_CAST((profanityNode + 2))); - securityCookie = extraout_ECX_01; - while (match != GHIDRA_CAST(0x0)) { - bVar1 = *GHIDRA_CAST((profanityNode + 10)); - uVar7 = GHIDRA_UINT(bVar1); - if (match == &DAT_00c93050) { - uVar5 = GHIDRA_UINT(CONCAT11((&DAT_00c93050)[uVar7],bVar1)); -LAB_0091ebb0: - cVar4 = (char)(uVar5 >> 8); - if ((cVar4 == ' ') || (cVar4 == '\0')) { - strncpy(GHIDRA_CAST(match),"********************************",uVar7); - uVar5 = GHIDRA_UINT(*GHIDRA_CAST((profanityNode + 10))); - } - } - else { - uVar5 = GHIDRA_UINT(CONCAT11(match[uVar7],bVar1)); - if (match[-1] == 0x20) goto LAB_0091ebb0; - } - haystack = haystack + (uVar5 & 0xff); - match = stristr(haystack,GHIDRA_CAST((profanityNode + 2))); - securityCookie = extraout_ECX_02; - } - profanityNode = GHIDRA_CAST(*profanityNode); - } while (profanityNode != DAT_00c7986c); - } - } - OnlineChat::add_message(securityCookie,(uint32_t)local_30,(*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))),*param_2,param_2[1]); - FUN_00a58200(); - puVar3 = puStack_20; - } -LAB_0091ec0a: - puStack_20 = puVar3; - local_14 = 2; - if (((param_3 != GHIDRA_CAST(0x0)) && - (cVar4 = (**(code **)(*param_3 + 0xc))(securityCookie), cVar4 != '\0')) && - (g_multiplayerRelease != (void *)0x0)) { - (*g_multiplayerRelease)(¶m_2); - } - ExceptionList = local_1c; - return; -} - -// 009428d0 -void Camera::constructor(Room *room) -{ - void *pvVar1; - Vector position; - Vector position_00; - Vector *resultPos; - int iVar2; - int writeSlot; - float fVar3; - Vector scratchPos; - Camera *local_3c; - Vector local_38; - Vector local_30; - Vector softClampOut; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - Room *currentRoom; - uint32_t enterDoor; - Game *game; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0b454; - local_1c = ExceptionList; - ExceptionList = &local_1c; - local_3c = this; - CircularBuffer::constructor(0x3c); - local_14 = 0; - CircularBuffer::constructor(0x5a); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - CircularBuffer::constructor(300); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - CircularBuffer::constructor(0xf); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 3; - CircularBuffer::constructor(4); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 4; - CircularBuffer::constructor(0x78); - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),5); - (this->_playersCenter).y = 0.0; - (this->_playersCenter).x = 0.0; - (this->_position).y = 0.0; - (this->_position).x = 0.0; - (this->_screenAnchor).y = 0.0; - (this->_screenAnchor).x = 0.0; - (this->_unk7c).y = 0.0; - (this->_unk7c).x = 0.0; - (this->_unk84).y = 0.0; - (this->_unk84).x = 0.0; - this->_room = room; - fVar3 = g_vectorOne.y * 0.5; - (this->_screenAnchor).x = g_vectorOne.x * 0.5; - (this->_screenAnchor).y = fVar3; - position.y = g_vectorZero.y; - position.x = g_vectorZero.x; - resultPos = ClampedToRoom(this,&scratchPos,position); - (this->_position).x = resultPos->x; - (this->_position).y = resultPos->y; - (this->_unk7c).x = g_vectorZero.x; - (this->_unk7c).y = g_vectorZero.y; - (this->_unk84).x = g_vectorZero.x; - (this->_unk84).y = g_vectorZero.y; - fVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - while (GHIDRA_INT(fVar3) < 0x3c) { - softClampOut.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); - if (fVar3 == softClampOut.y) { - if (GHIDRA_INT(fVar3) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - softClampOut.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); - fVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - } - iVar2 = (*GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); - fVar3 = (float)(GHIDRA_INT(fVar3) + -1); - *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) = iVar2; - *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = fVar3; - } - else { - iVar2 = *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)); - } - writeSlot = (GHIDRA_INT(fVar3) + iVar2) % GHIDRA_INT(softClampOut.y); - iVar2 = *GHIDRA_CAST(this->_aimOffsetBuffer); - *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; - *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) + 1; - fVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - } - if (*GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) < 0x5a) { - local_30.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - do { - softClampOut.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); - if (local_30.y == softClampOut.y) { - if (GHIDRA_INT(local_30.y) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - softClampOut.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); - local_30.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - } - iVar2 = (*GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); - local_30.y = (float)(GHIDRA_INT(local_30.y) + -1); - *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) = iVar2; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = local_30.y; - } - else { - iVar2 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)); - } - writeSlot = (GHIDRA_INT(local_30.y) + iVar2) % GHIDRA_INT(softClampOut.y); - iVar2 = *GHIDRA_CAST(this->_velocityOffsetBuffer); - *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; - *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) + 1; - local_30.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - } while (*GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) < 0x5a); - } - if (*GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) < 300) { - local_30.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - do { - softClampOut.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); - if (local_30.y == softClampOut.y) { - if (GHIDRA_INT(local_30.y) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - softClampOut.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); - local_30.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - } - iVar2 = (*GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); - local_30.y = (float)(GHIDRA_INT(local_30.y) + -1); - *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) = iVar2; - *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = local_30.y; - } - else { - iVar2 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)); - } - writeSlot = (GHIDRA_INT(local_30.y) + iVar2) % GHIDRA_INT(softClampOut.y); - iVar2 = *GHIDRA_CAST(this->_enemyOffsetBuffer); - *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; - *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) + 1; - local_30.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - } while (*GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) < 300); - } - if (*GHIDRA_CAST((this->_playerSpreadBuffer + 8)) < 0xf) { - local_30.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - do { - softClampOut.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); - if (local_30.y == softClampOut.y) { - if (GHIDRA_INT(local_30.y) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - softClampOut.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); - local_30.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - } - iVar2 = (*GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); - local_30.y = (float)(GHIDRA_INT(local_30.y) + -1); - *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) = iVar2; - *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = local_30.y; - } - else { - iVar2 = *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)); - } - writeSlot = (GHIDRA_INT(local_30.y) + iVar2) % GHIDRA_INT(softClampOut.y); - iVar2 = *GHIDRA_CAST(this->_playerSpreadBuffer); - *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; - *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) + 1; - local_30.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - } while (*GHIDRA_CAST((this->_playerSpreadBuffer + 8)) < 0xf); - } - if (*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) < 4) { - fVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - do { - softClampOut.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - if (fVar3 == softClampOut.y) { - if (GHIDRA_INT(fVar3) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - softClampOut.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - fVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - } - iVar2 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); - fVar3 = (float)(GHIDRA_INT(fVar3) + -1); - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = iVar2; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = fVar3; - } - else { - iVar2 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); - } - writeSlot = (iVar2 + GHIDRA_INT(fVar3)) % GHIDRA_INT(softClampOut.y); - iVar2 = *GHIDRA_CAST(this->_shakeOffsetBuffer); - *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; - *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; - fVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - } while (GHIDRA_INT(fVar3) < 4); - } - if (*GHIDRA_CAST((this->_focusPositionBuffer + 8)) < 0x78) { - fVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - do { - local_30.y = -g_vectorOne.x; - softClampOut.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - local_38.y = -g_vectorOne.y; - if (fVar3 == softClampOut.y) { - if (GHIDRA_INT(fVar3) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - softClampOut.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - fVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - } - iVar2 = (*GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); - fVar3 = (float)(GHIDRA_INT(fVar3) + -1); - *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) = iVar2; - *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = fVar3; - } - else { - iVar2 = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); - } - writeSlot = (GHIDRA_INT(fVar3) + iVar2) % GHIDRA_INT(softClampOut.y); - iVar2 = *GHIDRA_CAST(this->_focusPositionBuffer); - *GHIDRA_CAST((iVar2 + writeSlot * 8)) = local_30.y; - *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = local_38.y; - *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = *GHIDRA_CAST((this->_focusPositionBuffer + 8)) + 1; - fVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - } while (GHIDRA_INT(fVar3) < 0x78); - } - game = g_game; - this->_shouldOverride = 0; - this->_followLerp = 0.1; - enterDoor = game->_enterDoor; - if (enterDoor != 0xffffffff) { - currentRoom = this->_room; - if (enterDoor < 8) { - local_38.x = (float)(currentRoom->_doorGridPositions[enterDoor] % currentRoom->_gridWidth) * - 40.0 + 40.0; - local_38.y = (float)(currentRoom->_doorGridPositions[enterDoor] / currentRoom->_gridWidth) * - 40.0 + 120.0; - } - else { - local_38.x = g_vectorZero.x; - local_38.y = g_vectorZero.y; - } - Room::GetClampedPositionImpl(currentRoom,&local_30,&local_38,20.0,20.0,20.0,20.0); - local_38.x = local_30.x; - local_38.y = local_30.y; - position_00.y = local_30.y; - position_00.x = local_30.x; - resultPos = ClampedToRoom(this,&local_38,position_00); - (this->_position).x = resultPos->x; - (this->_position).y = resultPos->y; - } - resultPos = Level::GetEnterPosition(GHIDRA_CAST(g_game),&local_30); - if ((resultPos->x != g_vectorZero.x) || (resultPos->y != g_vectorZero.y)) { - resultPos = Level::GetEnterPosition(GHIDRA_CAST(g_game),&scratchPos); - resultPos = ClampedToRoom(this,&local_38,*resultPos); - resultPos = soft_clamp_position(this,&softClampOut,resultPos->x,resultPos->y); - (this->_position).x = resultPos->x; - (this->_position).y = resultPos->y; - } - pvVar1 = this->_room; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1204)) = (this->_position).x; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1208)) = (this->_position).y; - ExceptionList = local_1c; - return; -} - -// 00942f20 -Vector * Camera::get_enemy_focus_offset(Vector *outOffset) -{ - Vector *pVVar1; - char cVar2; - uint32_t uVar3; - uint32_t entityCount; - int entityData; - float fVar4; - float zeroY; - Vector *totalWeight; - Vector playersCenter; - float local_30; - uint32_t i; - float local_28; - float dy; - float dx; - int local_1c; - uint32_t local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity *enemy; - - pVVar1 = outOffset; - zeroY = g_vectorZero.y; - fVar4 = g_vectorZero.x; - puStack_c = &LAB_00b0b48d; - local_10 = ExceptionList; - uVar3 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - totalWeight = GHIDRA_CAST(0x0); - entityData = *GHIDRA_CAST((GHIDRA_CAST(this->_room) + 0x125c)); - entityCount = *GHIDRA_CAST((GHIDRA_CAST(this->_room) + 0x1264)); - outOffset->x = g_vectorZero.x; - outOffset->y = zeroY; - outOffset = GHIDRA_CAST(0x0); - local_8 = 0; - i = 0; - if (entityCount != 0) { - local_1c = entityData; - local_18 = entityCount; - do { - enemy = *GHIDRA_CAST((entityData + i * 4)); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (enemy->_type != 1)) { - if (enemy->_type - 10U < 0x3de) goto LAB_00942fe8; - } - else { -LAB_00942fe8: - cVar2 = enemy->CanShutDoors(uVar3); - if ((cVar2 != '\0') && (enemy->_visible != 0)) { - dx = (enemy->_pos).x; - dy = (enemy->_pos).y; - players_center_position(&g_game->_playerManager,&playersCenter,1); - dx = dx - playersCenter.x; - dy = dy - playersCenter.y; - fVar4 = sqrtf(dx * dx + dy * dy); - if (fVar4 < 550.0) { - local_30 = (fVar4 - 550.0) / -550.0; - cVar2 = enemy->IsBoss(); - if (cVar2 == '\0') { - local_28 = 1.0; - } - else { - local_28 = 0.6; - } - if (((enemy->_type == 0x112) || (enemy->_type == 0x197)) && (enemy->_variant == 0)) { - (GHIDRA_CAST((enemy)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - } - outOffset = GHIDRA_CAST((local_28 + (float)outOffset)); - pVVar1->x = dx * local_30 * 0.4 + pVVar1->x; - pVVar1->y = dy * local_30 * 0.4 + pVVar1->y; - } - } - entityCount = local_18; - entityData = local_1c; - totalWeight = outOffset; - } - i = i + 1; - } while (i < entityCount); - fVar4 = g_vectorZero.x; - zeroY = g_vectorZero.y; - } - if ((float)totalWeight == 0.0) { - pVVar1->y = zeroY; - } - else { - fVar4 = (1.0 / (float)totalWeight) * pVVar1->x; - pVVar1->y = (1.0 / (float)totalWeight) * pVVar1->y; - } - pVVar1->x = fVar4; - ExceptionList = local_10; - return pVVar1; -} - -// 009432f0 -void Camera::get_clamp_bounds(Vector *outMax, Vector *outMin) -{ - void *pvVar1; - float fVar2; - float maxX; - float fVar3; - float minX; - float marginY; - float screenOffsetX; - float marginX; - float screenOffsetY; - int *roomConfig; - - pvVar1 = this->_room; - marginX = g_vectorOne.x * 80.0; - marginY = g_vectorOne.y * 80.0; - fVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x11fc)); - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1200)); - roomConfig = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)) + 0x10)); - screenOffsetX = fVar3; - screenOffsetY = fVar2; - if (((roomConfig != GHIDRA_CAST(0x0)) && (roomConfig[2] == 0x10)) && (*roomConfig == 0x23)) { - marginX = g_vectorZero.x; - marginY = g_vectorZero.y; - screenOffsetX = g_vectorZero.x; - screenOffsetY = g_vectorZero.y; - } - minX = -fVar3 - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x14)) - -20.0) - marginX) * 0.65 - screenOffsetX); - fVar3 = -fVar2 - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x18)) - 60.0) - marginY) * 0.65 - screenOffsetY); - maxX = (g_screenWidth - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x11fc))) - - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1c)) - -20.0) + marginX) * 0.65 + screenOffsetX); - fVar2 = (g_screenHeight - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1200))) - - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x20)) - 60.0) + marginY) * 0.65 + screenOffsetY); - if (minX < maxX) { - maxX = (minX + maxX) * 0.5; - minX = maxX; - } - if (fVar3 < fVar2) { - fVar2 = (fVar3 + fVar2) * 0.5; - fVar3 = fVar2; - } - outMax->x = maxX; - outMax->y = fVar2; - outMin->x = minX; - outMin->y = fVar3; - return; -} - -// 00943490 -Vector * Camera::ClampedToRoom(Vector *outPosition, Vector position) -{ - Vector *pVVar1; - int extraout_EDX; - float clampedY; - float clampedX; - Vector maxBounds; - Vector minBounds; - Vector target; - int *roomConfig; - - minBounds.y = 0.0; - minBounds.x = 0.0; - maxBounds.y = 0.0; - maxBounds.x = 0.0; - get_clamp_bounds(this,&minBounds,&maxBounds); - target.x = g_screenWidth * *GHIDRA_CAST((extraout_EDX + 0x74)) - - ((g_screenWidth - 338.0) * 0.5 + (position.x - 60.0) * 0.65); - target.y = g_screenHeight * *GHIDRA_CAST((extraout_EDX + 0x78)) - - ((g_screenHeight - 182.0) * 0.5 + (position.y - 140.0) * 0.65); - if ((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((extraout_EDX + 0x68)) + 4)) + 0x44)) >> 0xf & 1) != 0) { - outPosition->x = target.x; - outPosition->y = target.y; - return outPosition; - } - pVVar1 = ⌖ - if (maxBounds.x <= target.x) { - pVVar1 = &maxBounds; - } - clampedX = pVVar1->x; - if (clampedX <= minBounds.x) { - clampedX = minBounds.x; - } - pVVar1 = ⌖ - if (maxBounds.y <= target.y) { - pVVar1 = &maxBounds; - } - clampedY = pVVar1->y; - if (clampedY <= minBounds.y) { - clampedY = minBounds.y; - } - roomConfig = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)); - if ((((roomConfig != GHIDRA_CAST(0x0)) && (roomConfig[2] == 0x10)) && (*roomConfig == 0x23)) && - ((*GHIDRA_CAST((extraout_EDX + 0x8c)) != '\0' && (0 < *GHIDRA_CAST((extraout_EDX + 0x58)))))) { - clampedX = target.x; - } - outPosition->x = clampedX; - outPosition->y = clampedY; - return outPosition; -} - -// 00943610 -Vector * Camera::soft_clamp_position(Vector *outPosition, float x, float y) -{ - float fVar1; - Vector maxX; - Vector minX; - - minX.y = 0.0; - minX.x = 0.0; - maxX.y = 0.0; - maxX.x = 0.0; - get_clamp_bounds(this,&minX,&maxX); - if (x <= minX.x) { - fVar1 = minX.x; - } - else { - fVar1 = maxX.x; - if (x < maxX.x) { - if (minX.x == maxX.x) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - fVar1 = (x - minX.x) / (maxX.x - minX.x); - fVar1 = (maxX.x - minX.x) * - (((fVar1 * 6.0 * fVar1 * fVar1 - fVar1 * 15.0 * fVar1) + fVar1 * 14.0) - 6.0) * - -(fVar1 * fVar1) + minX.x; - } - } - if (y <= minX.y) { - maxX.y = minX.y; - } - else if (y < maxX.y) { - if (minX.y == maxX.y) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - outPosition->x = fVar1; - fVar1 = (y - minX.y) / (maxX.y - minX.y); - outPosition->y = - (maxX.y - minX.y) * - (((fVar1 * 4.0 * fVar1 * fVar1 - fVar1 * 10.0 * fVar1) + fVar1 * 10.0) - 5.0) * - -(fVar1 * fVar1) + minX.y; - return outPosition; - } - outPosition->x = fVar1; - outPosition->y = maxX.y; - return outPosition; -} - -// 009437e0 -void Camera::DoUpdate(uint8_t unk) -{ - int cameraStyle; - - cameraStyle = (g_manager->_optionsConfig)._cameraStyle; - if ((cameraStyle == 1) || (cameraStyle != 2)) { - update_focus_position(this,unk); - this->_shouldOverride = 0; - } - else { - update_follow(this); - if (unk != 0) { - this->_shouldOverride = 0; - return; - } - } - return; -} - -// 009439d0 -void Camera::update_focus_position(uint8_t isSkipFocusBuffer) -{ - float *pfVar1; - Vector position; - uint64_t qVar2; - uint8_t isLudovico; - Entity_Player *local_EAX_76; - int iVar3; - int *playerSlot; - Vector *pVVar4; - void *pvVar5; - uint32_t *puVar6; - int iVar7; - int bufferHead; - uint64_t *allocCounter; - uint32_t uVar8; - Game *game; - PlayerManager *playerManager; - float fVar9; - float fVar10; - uint8_t auVar11 [12]; - uint32_t *focusCopy; - int focusCopyCapacity; - float focusCopyCount; - int focusCopyHead; - Vector playersCenter; - uint8_t local_54 [8]; - Vector local_4c; - Vector local_44; - Vector enemyOffsetX; - Camera *local_34; - Vector spreadOffsetX; - float local_28; - float local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - int enemyBufferData; - uint8_t *shakeBuffer; - - puStack_20 = local_54 + 0x50; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0b4e6; - local_1c = ExceptionList; - ExceptionList = &local_1c; - local_34 = this; - local_EAX_76 = PlayerManager::get_first_local_main_player(&g_game->_playerManager); - if (local_EAX_76 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(8,GHIDRA_CAST("No main player detected when trying to update camera \n")); - ExceptionList = local_1c; - return; - } - players_center_position(&g_game->_playerManager,&playersCenter,1); - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 1) { - spreadOffsetX.y = 35.0; - } - else { - spreadOffsetX.y = 0.0; - } - local_24 = spreadOffsetX.y * (local_EAX_76->_aimDirection).x; - local_28 = spreadOffsetX.y * (local_EAX_76->_aimDirection).y; - local_4c.y = (float)(GHIDRA_CAST((local_EAX_76)))->Entity_Player::GetFocusEntity(); - if (GHIDRA_CAST(local_4c.y) != GHIDRA_CAST(0x0)) { - local_44.y = (((GHIDRA_CAST(local_4c.y))->_pos).y - (local_EAX_76->_pos).y) * 0.2; - enemyOffsetX.y = (((GHIDRA_CAST(local_4c.y))->_pos).x - (local_EAX_76->_pos).x) * 0.2; - fVar9 = sqrtf(local_44.y * local_44.y + enemyOffsetX.y * enemyOffsetX.y); - if ((spreadOffsetX.y < fVar9) && - (fVar9 = sqrtf(local_24 * local_24 + local_28 * local_28), 0.0 < fVar9)) { - local_28 = (spreadOffsetX.y / fVar9) * local_28; - local_24 = (spreadOffsetX.y / fVar9) * local_24; - } - if (((*GHIDRA_CAST((GHIDRA_CAST((local_EAX_76)) + 0x13f4))) == '\0') || - (isLudovico = (GHIDRA_CAST((local_EAX_76)))->Entity_Player::HasCollectible(0x149,0), isLudovico != 0)) { - local_24 = enemyOffsetX.y; - local_28 = local_44.y; - } - else { - iVar3 = __RTDynamicCast(local_4c.y,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Knife::RTTI_Type_Descriptor,0); - if ((iVar3 != 0) && (*GHIDRA_CAST((iVar3 + 0x464)) != '\0')) { - local_24 = enemyOffsetX.y + spreadOffsetX.y * (local_EAX_76->_lastDirection).x; - local_28 = local_44.y + spreadOffsetX.y * (local_EAX_76->_lastDirection).y; - } - } - } - if ((local_EAX_76->_itemState == 0x31) || - (((((*GHIDRA_CAST((GHIDRA_CAST((local_EAX_76)) + 0x13f2))) != '\0' && - (isLudovico = (GHIDRA_CAST((local_EAX_76)))->Entity_Player::HasCollectible(0x149,0), isLudovico == 0)) && - (local_EAX_76->_isPlayingExtraAnimation == 0)) && - (local_EAX_76->_isPlayingItemAnimation == 0)))) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_54),7,-1,-1,0,0); - local_14 = 0; - if (GHIDRA_CAST(local_4c.y) != GHIDRA_CAST(0x0)) { - uVar8 = 0; - do { - iVar3 = __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_54)) + 0x4))) + uVar8 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor,0); - if ((((iVar3 != 0) && ((*GHIDRA_CAST((iVar3 + 0x2c)) == 1 || (*GHIDRA_CAST((iVar3 + 0x2c)) == 3)))) && - (*GHIDRA_CAST((iVar3 + 0x34)) == 1)) && (*GHIDRA_CAST((iVar3 + 0x38)) == 0)) { - local_24 = spreadOffsetX.y * (local_EAX_76->_lastDirection).x; - local_28 = spreadOffsetX.y * (local_EAX_76->_lastDirection).y; - } - uVar8 = uVar8 + 1; - } while (uVar8 < GHIDRA_UINT(local_4c.y)); - this = local_34; - } - local_14 = 0xffffffff; - if (local_54[0] == '\0') { - local_14 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_54)) + 0x4))),0); - local_14 = 0xffffffff; - } - } - spreadOffsetX.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); - fVar9 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - if (fVar9 == spreadOffsetX.y) { - if (GHIDRA_INT(fVar9) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - spreadOffsetX.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); - fVar9 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - } - iVar3 = (*GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(spreadOffsetX.y); - fVar9 = (float)(GHIDRA_INT(fVar9) + -1); - *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) = iVar3; - *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = fVar9; - } - else { - iVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)); - } - iVar7 = (iVar3 + GHIDRA_INT(fVar9)) % GHIDRA_INT(spreadOffsetX.y); - iVar3 = *GHIDRA_CAST(this->_aimOffsetBuffer); - *GHIDRA_CAST((iVar3 + iVar7 * 8)) = local_24; - *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_28; - game = g_game; - *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) + 1; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((game->_playerManager)._playerList._begin) - >> 2 == 1) { - fVar9 = 4.5; - } - else { - fVar9 = 0.0; - } - iVar3 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - iVar7 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); - local_4c.y = (local_EAX_76->_velocity).x * fVar9; - local_44.y = (local_EAX_76->_velocity).y * fVar9; - if (iVar3 == iVar7) { - if (iVar3 < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar7 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); - iVar3 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - } - bufferHead = (*GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) + 1) % iVar7; - iVar3 = iVar3 + -1; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) = bufferHead; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = iVar3; - } - else { - bufferHead = *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)); - } - iVar7 = (bufferHead + iVar3) % iVar7; - iVar3 = *GHIDRA_CAST(this->_velocityOffsetBuffer); - *GHIDRA_CAST((iVar3 + iVar7 * 8)) = local_4c.y; - *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_44.y; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) + 1; - local_44.y = (float)get_enemy_focus_offset(this,&enemyOffsetX); - iVar3 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - iVar7 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); - if (iVar3 == iVar7) { - if (iVar3 < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar7 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); - iVar3 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - } - bufferHead = (*GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) + 1) % iVar7; - iVar3 = iVar3 + -1; - *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) = bufferHead; - *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = iVar3; - } - else { - bufferHead = *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)); - } - enemyBufferData = *GHIDRA_CAST(this->_enemyOffsetBuffer); - iVar7 = (bufferHead + iVar3) % iVar7; - *GHIDRA_CAST((enemyBufferData + iVar7 * 8)) = *GHIDRA_CAST(local_44.y); - *GHIDRA_CAST((enemyBufferData + 4 + iVar7 * 8)) = *GHIDRA_CAST((GHIDRA_CAST(local_44.y) + 4)); - *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) + 1; - spreadOffsetX.y = g_vectorZero.x; - local_28 = g_vectorZero.y; - players_center_position(&g_game->_playerManager,&local_4c,1); - playerManager = &g_game->_playerManager; - local_24 = 0.0; - local_44.y = 0.0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 - != 0) { - game = g_game; - do { - pvVar5 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar5) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar5 = (playerManager->_playerList)._end; - game = g_game; - } - playerSlot = (playerManager->_playerList)._begin; - if (GHIDRA_UINT(local_44.y) < GHIDRA_UINT((GHIDRA_INT(pvVar5) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + GHIDRA_INT(local_44.y); - } - iVar3 = *playerSlot; - if (*GHIDRA_CAST((iVar3 + 0x2c)) == 1) { - local_24 = (float)(GHIDRA_INT(local_24) + 1); - local_28 = (*GHIDRA_CAST((iVar3 + 0x340)) - local_4c.y) * 0.25 + local_28; - spreadOffsetX.y = spreadOffsetX.y + (*GHIDRA_CAST((iVar3 + 0x33c)) - local_4c.x) * 0.25; - } - playerManager = &game->_playerManager; - local_44.y = (float)(GHIDRA_INT(local_44.y) + 1); - } while (GHIDRA_UINT(local_44.y) < - GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - this = local_34; - if (0 < GHIDRA_INT(local_24)) { - local_28 = (1.0 / (float)GHIDRA_INT(local_24)) * local_28; - spreadOffsetX.y = (1.0 / (float)GHIDRA_INT(local_24)) * spreadOffsetX.y; - } - } - local_24 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); - iVar3 = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - if ((float)iVar3 == local_24) { - if (iVar3 < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - local_24 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); - iVar3 = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - } - iVar7 = (*GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) + 1) % GHIDRA_INT(local_24); - iVar3 = iVar3 + -1; - *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) = iVar7; - *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = iVar3; - } - else { - iVar7 = *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)); - } - iVar7 = (iVar7 + iVar3) % GHIDRA_INT(local_24); - iVar3 = *GHIDRA_CAST(this->_playerSpreadBuffer); - *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_28; - *GHIDRA_CAST((iVar3 + iVar7 * 8)) = spreadOffsetX.y; - *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) + 1; - if (isSkipFocusBuffer == 0) { - if (this->_shouldOverride == 0) { - local_4c.y = -g_vectorOne.x; - spreadOffsetX.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - local_44.y = -g_vectorOne.y; - fVar9 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - if (fVar9 == spreadOffsetX.y) { - if (GHIDRA_INT(fVar9) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - spreadOffsetX.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - fVar9 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - } - iVar3 = (*GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + 1) % GHIDRA_INT(spreadOffsetX.y); - fVar9 = (float)(GHIDRA_INT(fVar9) + -1); - *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) = iVar3; - *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = fVar9; - } - else { - iVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); - } - iVar7 = (iVar3 + GHIDRA_INT(fVar9)) % GHIDRA_INT(spreadOffsetX.y); - iVar3 = *GHIDRA_CAST(this->_focusPositionBuffer); - *GHIDRA_CAST((iVar3 + iVar7 * 8)) = local_4c.y; - *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_44.y; - *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = *GHIDRA_CAST((this->_focusPositionBuffer + 8)) + 1; - this->_shouldOverride = 1; - } - } - else if (this->_shouldOverride == 0) { - ring_buffer_push(this->_focusPositionBuffer, - (Vector *) - (*GHIDRA_CAST(this->_focusPositionBuffer) + - ((*GHIDRA_CAST((this->_focusPositionBuffer + 8)) + - *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + -1) % - *GHIDRA_CAST((this->_focusPositionBuffer + 4))) * 8)); - } - vector_ring_buffer_weighted_average(&local_4c,this,0.75); - vector_ring_buffer_weighted_average(&local_44,this->_velocityOffsetBuffer,0.85); - vector_ring_buffer_weighted_average(&enemyOffsetX,this->_enemyOffsetBuffer,0.75); - vector_ring_buffer_weighted_average(&spreadOffsetX,this->_playerSpreadBuffer,0.5); - fVar10 = playersCenter.y + local_4c.y; - fVar9 = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - local_4c.y = spreadOffsetX.x + enemyOffsetX.x + local_44.x + playersCenter.x + local_4c.x; - enemyOffsetX.y = spreadOffsetX.y + enemyOffsetX.y + local_44.y + fVar10; - local_44.y = fVar9; - spreadOffsetX.y = - (float)operator_new_tracked - (-GHIDRA_UINT((GHIDRA_INT(((uint64_t)GHIDRA_UINT(fVar9) * 8 >> 0x20)) != 0)) | - GHIDRA_UINT(((uint64_t)GHIDRA_UINT(fVar9) * 8))); - puVar6 = GHIDRA_CAST(spreadOffsetX.y); - if (GHIDRA_CAST(spreadOffsetX.y) == GHIDRA_CAST(0x0)) { - spreadOffsetX.y = 0.0; - } - else { - for (; fVar9 != 0.0; fVar9 = (float)(GHIDRA_INT(fVar9) - 1)) { - puVar6[1] = 0; - *puVar6 = 0; - puVar6 = puVar6 + 2; - } - } - focusCopyCapacity = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - focusCopyCount = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - focusCopyHead = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); - focusCopy = GHIDRA_CAST(spreadOffsetX.y); - local_44.y = focusCopyCount; - local_28 = (float)focusCopyHead; - local_24 = (float)focusCopyCapacity; - memcpy((void *)spreadOffsetX.y,*(void **)this->_focusPositionBuffer,focusCopyCapacity * 8); - iVar3 = 0; - local_14 = 3; - if (0 < GHIDRA_INT(local_44.y)) { - do { - pfVar1 = GHIDRA_CAST((GHIDRA_INT(spreadOffsetX.y) + ((GHIDRA_INT(local_28) + iVar3) % GHIDRA_INT(local_24)) * 2 * 4)); - if ((*pfVar1 == -g_vectorOne.x) && (pfVar1[1] == -g_vectorOne.y)) { - *pfVar1 = local_4c.y; - pfVar1[1] = enemyOffsetX.y; - } - iVar3 = iVar3 + 1; - } while (iVar3 < GHIDRA_INT(local_44.y)); - this = local_34; - } - vector_ring_buffer_weighted_average(&local_4c,&focusCopy,0.5); - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (GHIDRA_CAST(spreadOffsetX.y) != GHIDRA_CAST(0x0)) { - uVar8 = *GHIDRA_CAST((GHIDRA_CAST(spreadOffsetX.y) + -4)); - qVar2 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar8; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar8)); - free(GHIDRA_CAST((GHIDRA_INT(spreadOffsetX.y) + -4))); - } - local_14 = 0xffffffff; - fVar9 = g_screenHeight - 182.0; - fVar10 = g_screenHeight * (this->_screenAnchor).y; - (this->_position).x = - g_screenWidth * (this->_screenAnchor).x - - ((g_screenWidth - 338.0) * 0.5 + (local_4c.x - 60.0) * 0.65); - (this->_position).y = fVar10 - (fVar9 * 0.5 + (local_4c.y - 140.0) * 0.65); - pVVar4 = soft_clamp_position(this,&local_4c,(this->_position).x,(this->_position).y); - shakeBuffer = this->_shakeOffsetBuffer; - (this->_position).x = pVVar4->x; - (this->_position).y = pVVar4->y; - if (g_game->_screenShakeTimer < 1) { - spreadOffsetX.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - puVar6 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - if (puVar6 == GHIDRA_CAST(spreadOffsetX.y)) { - if (GHIDRA_INT(puVar6) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - spreadOffsetX.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - puVar6 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - } - iVar3 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(spreadOffsetX.y); - puVar6 = GHIDRA_CAST((GHIDRA_INT(puVar6) + -1)); - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = iVar3; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = puVar6; - } - else { - iVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); - } - iVar7 = (iVar3 + GHIDRA_INT(puVar6)) % GHIDRA_INT(spreadOffsetX.y); - iVar3 = *GHIDRA_CAST(shakeBuffer); - *GHIDRA_CAST((iVar3 + iVar7 * 8)) = g_vectorZero.x; - *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; - } - else { - if (g_game->_frameCount % 3 == 0) { - uVar8 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_4c.y = fVar9 + fVar9; - local_44.x = cos(local_4c.y); - local_44.x = local_44.x * 10.0; - fVar9 = sin(local_4c.y); - local_44.y = fVar9 * 10.0; - pVVar4 = &local_44; - } - else { - iVar3 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + -1) % - *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - enemyOffsetX.y = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar3 * 8)); - local_34 = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar3 * 8 + 4)); - uVar8 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_4c.y = fVar9 + fVar9; - local_44.y = cos(local_4c.y); - fVar9 = sin(local_4c.y); - pVVar4 = &local_4c; - local_4c.y = (fVar9 + fVar9) - (float)local_34; - local_4c.x = (local_44.y + local_44.y) - enemyOffsetX.y; - } - ring_buffer_push(shakeBuffer,pVVar4); - pfVar1 = GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + - ((*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + -1 + - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc))) % - *GHIDRA_CAST((this->_shakeOffsetBuffer + 4))) * 8)); - fVar9 = ((float)g_game->_screenShakeTimer - 0.0) / 11.0; - if (fVar9 <= 0.0) { - fVar9 = 0.0; - } - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - pfVar1[1] = fVar9 * pfVar1[1]; - *pfVar1 = fVar9 * *pfVar1; - } - vector_ring_buffer_weighted_average(&local_4c,shakeBuffer,0.9); - game = g_game; - iVar3 = 0x744; - (g_game->_screenShakeOffset).x = local_4c.x; - (game->_screenShakeOffset).y = local_4c.y; - fVar9 = 0.0; - do { - local_4c.y = (float)(GHIDRA_INT(fVar9) + 1); - if (GHIDRA_UINT(local_4c.y) < 9) { - pvVar5 = this->_room; - if (*GHIDRA_CAST((iVar3 + -0x20 + GHIDRA_INT(pvVar5))) != 0) { - if (GHIDRA_UINT(fVar9) < 8) { - local_44.y = (float)(*GHIDRA_CAST((iVar3 + GHIDRA_INT(pvVar5))) / *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xc))) * 40.0 + - 120.0; - local_44.x = (float)(*GHIDRA_CAST((iVar3 + GHIDRA_INT(pvVar5))) % *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xc))) * 40.0 + - 40.0; - } - else { - local_44.y = g_vectorZero.y; - local_44.x = g_vectorZero.x; - } - fVar9 = sqrtf((local_44.y - playersCenter.y) * (local_44.y - playersCenter.y) + - (local_44.x - playersCenter.x) * (local_44.x - playersCenter.x)); - if (fVar9 < 30.0) { - auVar11 = ZEXT812(0x3f800000); - fVar9 = (fVar9 - 30.0) / -20.0; - if (fVar9 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))) = fVar9; - } - local_4c.y = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))); - position.y = local_44.y; - position.x = local_44.x; - ClampedToRoom(this,&local_44,position); - fVar9 = (3.0 - (local_4c.y + local_4c.y)) * local_4c.y * local_4c.y; - (this->_position).x = (local_44.x - (this->_position).x) * fVar9 + (this->_position).x; - (this->_position).y = (local_44.y - (this->_position).y) * fVar9 + (this->_position).y; - goto LAB_00944696; - } - } - } - fVar9 = local_4c.y; - iVar3 = iVar3 + 4; - if (7 < GHIDRA_INT(fVar9)) { -LAB_00944696: - pvVar5 = this->_room; - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1204)) = (this->_position).x; - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1208)) = (this->_position).y; - (this->_playersCenter).x = playersCenter.x; - (this->_playersCenter).y = playersCenter.y; - ExceptionList = local_1c; - return; - } - } while( true ); -} - -// 009446e0 -void Camera::update_follow() -{ - Vector position; - uint32_t rngResult; - Vector *pVVar1; - int iVar2; - int iVar3; - int iVar4; - bool bVar5; - bool bVar6; - float fVar7; - float fVar8; - Vector local_24; - Vector local_1c; - Vector local_14; - float shakeCos; - float shakeAngle; - Game *game; - float *newestShake; - void *room; - uint8_t *shakeBuffer; - - players_center_position(&g_game->_playerManager,&local_24,1); - if ((this->_shouldOverride != 0) && (0 < *GHIDRA_CAST((this->_focusPositionBuffer + 8)))) { - iVar2 = (*GHIDRA_CAST((this->_focusPositionBuffer + 8)) + -1 + - *GHIDRA_CAST((this->_focusPositionBuffer + 0xc))) % *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - local_24.x = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + iVar2 * 8)); - local_24.y = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + iVar2 * 8 + 4)); - } - shakeBuffer = this->_shakeOffsetBuffer; - if (g_game->_screenShakeTimer < 1) { - iVar2 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - iVar4 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - if (iVar2 == iVar4) { - if (iVar2 < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar4 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - iVar2 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - } - iVar3 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % iVar4; - iVar2 = iVar2 + -1; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = iVar3; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = iVar2; - } - else { - iVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); - } - iVar4 = (iVar2 + iVar3) % iVar4; - iVar2 = *GHIDRA_CAST(shakeBuffer); - *GHIDRA_CAST((iVar2 + iVar4 * 8)) = g_vectorZero.x; - *GHIDRA_CAST((iVar2 + 4 + iVar4 * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; - } - else { - if (g_game->_frameCount % 3 == 0) { - rngResult = Random(); - shakeAngle = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 3.14; - shakeAngle = shakeAngle + shakeAngle; - local_1c.x = cos(shakeAngle); - local_1c.x = local_1c.x * 10.0; - local_1c.y = sin(shakeAngle); - local_1c.y = local_1c.y * 10.0; - pVVar1 = &local_1c; - } - else { - iVar2 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + -1) % - *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - local_14.y = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar2 * 8)); - local_1c.y = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar2 * 8 + 4)); - rngResult = Random(); - shakeAngle = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 3.14; - shakeAngle = shakeAngle + shakeAngle; - shakeCos = cos(shakeAngle); - fVar7 = sin(shakeAngle); - pVVar1 = &local_14; - local_14.x = (shakeCos + shakeCos) - local_14.y; - local_14.y = (fVar7 + fVar7) - local_1c.y; - } - ring_buffer_push(shakeBuffer,pVVar1); - newestShake = GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + - ((*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + -1 + - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc))) % - *GHIDRA_CAST((this->_shakeOffsetBuffer + 4))) * 8)); - fVar7 = ((float)g_game->_screenShakeTimer - 0.0) / 11.0; - if (fVar7 <= 0.0) { - fVar7 = 0.0; - } - if (1.0 <= fVar7) { - fVar7 = 1.0; - } - newestShake[1] = fVar7 * newestShake[1]; - *newestShake = fVar7 * *newestShake; - } - vector_ring_buffer_weighted_average(&local_1c,shakeBuffer,0.9); - game = g_game; - (g_game->_screenShakeOffset).x = local_1c.x; - (game->_screenShakeOffset).y = local_1c.y; - position.y = local_24.y; - position.x = local_24.x; - ClampedToRoom(this,&local_24,position); - fVar7 = (this->_position).x; - local_24.y = local_24.y - (this->_position).y; - local_24.x = local_24.x - fVar7; - fVar8 = local_24.y * local_24.y + local_24.x * local_24.x; - if (fVar8 <= 676.0) { - if (338.0 <= fVar8) goto LAB_009449f3; - local_1c.y = this->_followLerp - 0.01; - local_14.y = 0.1; - bVar6 = local_1c.y == 0.1; - bVar5 = local_1c.y < 0.1; - } - else { - local_1c.y = this->_followLerp + 0.01; - local_14.y = 0.5; - bVar6 = local_1c.y == 0.5; - bVar5 = 0.5 < local_1c.y; - } - pVVar1 = &local_1c; - if (bVar5 || bVar6) { - pVVar1 = &local_14; - } - this->_followLerp = pVVar1->y; -LAB_009449f3: - fVar8 = this->_followLerp; - room = this->_room; - fVar7 = fVar8 * local_24.x + fVar7; - (this->_position).x = fVar7; - (this->_position).y = fVar8 * local_24.y + (this->_position).y; - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1204)) = fVar7; - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1208)) = (this->_position).y; - return; -} - -// 00944a40 -uint8_t Camera::IsPosVisible(Vector *Pos) -{ - int *playerSlot; - void *pvVar1; - int lastFocusIdx; - PlayerManager *playerManager; - uint32_t playerIdx; - float fVar2; - float clampedX; - float fVar3; - float fVar4; - float focusY; - float maxCameraX; - float maxCameraY; - float posY; - - if (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) { - fVar3 = -(this->_position).x * 1.5384616 - - ((g_screenWidth - 338.0) * 0.5 + (g_vectorZero.x - 60.0) * 0.65) / 0.65; - fVar2 = -(this->_position).y * 1.5384616 - - ((g_screenHeight - 182.0) * 0.5 + (g_vectorZero.y - 140.0) * 0.65) / 0.65; - if ((((fVar3 < Pos->x) && (Pos->x < g_screenWidth * 1.5384616 + fVar3)) && (fVar2 < Pos->y)) && - (Pos->y < g_screenHeight * 1.5384616 + fVar2)) { - return 1; - } - } - else { - playerIdx = 0; - playerManager = &g_game->_playerManager; - pvVar1 = g_game->_room; - fVar2 = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x14)) - 80.0) + 369.23077; - fVar3 = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x18)) - 80.0) + 207.6923; - maxCameraX = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1c)) + 80.0) - 369.23077; - maxCameraY = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x20)) + 80.0) - 207.6923; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - pvVar1 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar1) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar1 = (playerManager->_playerList)._end; - } - playerSlot = (playerManager->_playerList)._begin; - if (playerIdx < GHIDRA_UINT((GHIDRA_INT(pvVar1) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + playerIdx; - } - fVar4 = *GHIDRA_CAST((*playerSlot + 0x33c)); - focusY = *GHIDRA_CAST((*playerSlot + 0x340)); - if ((this->_shouldOverride != 0) && (0 < *GHIDRA_CAST((this->_focusPositionBuffer + 8)))) { - lastFocusIdx = (*GHIDRA_CAST((this->_focusPositionBuffer + 8)) + -1 + - *GHIDRA_CAST((this->_focusPositionBuffer + 0xc))) % - *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - fVar4 = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + lastFocusIdx * 8)); - focusY = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + lastFocusIdx * 8 + 4)); - } - if (fVar4 <= fVar2) { - fVar4 = fVar2; - } - if (focusY <= fVar3) { - focusY = fVar3; - } - if (maxCameraX <= fVar4) { - fVar4 = maxCameraX; - } - posY = Pos->y; - if (maxCameraY <= focusY) { - focusY = maxCameraY; - } - clampedX = Pos->x; - if (Pos->x <= fVar4 - 369.23077) { - clampedX = fVar4 - 369.23077; - } - if (fVar4 + 369.23077 <= clampedX) { - clampedX = fVar4 + 369.23077; - } - fVar4 = posY; - if (posY <= focusY - 207.6923) { - fVar4 = focusY - 207.6923; - } - if (focusY + 207.6923 <= fVar4) { - fVar4 = focusY + 207.6923; - } - if ((clampedX == Pos->x) && (fVar4 == posY)) { - return 1; - } - playerIdx = playerIdx + 1; - playerManager = &g_game->_playerManager; - } while (playerIdx < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - return 0; -} - -// 00944d10 -void Camera::SetFocusPosition(Vector *pos) -{ - if (this->_shouldOverride == 0) { - ring_buffer_push(this->_focusPositionBuffer,pos); - this->_shouldOverride = 1; - } - return; -} - -// 00944d40 -void Camera::SnapToPosition(Vector *pos) -{ - int ringStart; - int iVar1; - int ringStart; - Vector local_20; - float local_18; - int entriesLeft; - void *room; - - entriesLeft = 0x3c; - ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - do { - iVar1 = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); - if (ringStart == iVar1) { - if (ringStart < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar1 = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); - ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - } - ringStart = (*GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) + 1) % iVar1; - ringStart = ringStart + -1; - *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) = ringStart; - *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = ringStart; - } - else { - ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)); - } - iVar1 = (ringStart + ringStart) % iVar1; - ringStart = *GHIDRA_CAST(this->_aimOffsetBuffer); - *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; - *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) + 1; - entriesLeft = entriesLeft + -1; - ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); - } while (entriesLeft != 0); - ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - entriesLeft = 0x5a; - do { - iVar1 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); - if (ringStart == iVar1) { - if (ringStart < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar1 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); - ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - } - ringStart = (*GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) + 1) % iVar1; - ringStart = ringStart + -1; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) = ringStart; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = ringStart; - } - else { - ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)); - } - iVar1 = (ringStart + ringStart) % iVar1; - ringStart = *GHIDRA_CAST(this->_velocityOffsetBuffer); - *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; - *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) + 1; - entriesLeft = entriesLeft + -1; - ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); - } while (entriesLeft != 0); - ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - entriesLeft = 300; - do { - iVar1 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); - if (ringStart == iVar1) { - if (ringStart < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar1 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); - ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - } - ringStart = (*GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) + 1) % iVar1; - ringStart = ringStart + -1; - *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) = ringStart; - *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = ringStart; - } - else { - ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)); - } - iVar1 = (ringStart + ringStart) % iVar1; - ringStart = *GHIDRA_CAST(this->_enemyOffsetBuffer); - *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; - *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) + 1; - entriesLeft = entriesLeft + -1; - ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); - } while (entriesLeft != 0); - ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - entriesLeft = 0xf; - do { - iVar1 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); - if (ringStart == iVar1) { - if (ringStart < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar1 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); - ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - } - ringStart = (*GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) + 1) % iVar1; - ringStart = ringStart + -1; - *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) = ringStart; - *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = ringStart; - } - else { - ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)); - } - iVar1 = (ringStart + ringStart) % iVar1; - ringStart = *GHIDRA_CAST(this->_playerSpreadBuffer); - *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; - *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) + 1; - entriesLeft = entriesLeft + -1; - ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); - } while (entriesLeft != 0); - ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - entriesLeft = 4; - do { - iVar1 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - if (ringStart == iVar1) { - if (ringStart < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar1 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); - ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - } - ringStart = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % iVar1; - ringStart = ringStart + -1; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = ringStart; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = ringStart; - } - else { - ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); - } - iVar1 = (ringStart + ringStart) % iVar1; - ringStart = *GHIDRA_CAST(this->_shakeOffsetBuffer); - *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; - *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; - *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; - entriesLeft = entriesLeft + -1; - ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); - } while (entriesLeft != 0); - ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - entriesLeft = 0x78; - do { - local_18 = -g_vectorOne.x; - iVar1 = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - local_20.y = -g_vectorOne.y; - if (ringStart == iVar1) { - if (ringStart < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); - iVar1 = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); - ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - } - ringStart = (*GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + 1) % iVar1; - ringStart = ringStart + -1; - *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) = ringStart; - *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = ringStart; - } - else { - ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); - } - iVar1 = (ringStart + ringStart) % iVar1; - ringStart = *GHIDRA_CAST(this->_focusPositionBuffer); - *GHIDRA_CAST((ringStart + iVar1 * 8)) = local_18; - *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = local_20.y; - *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = *GHIDRA_CAST((this->_focusPositionBuffer + 8)) + 1; - entriesLeft = entriesLeft + -1; - ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); - } while (entriesLeft != 0); - this->_shouldOverride = 0; - ClampedToRoom(this,&local_20,*pos); - room = this->_room; - (this->_position).x = local_20.x; - (this->_position).y = local_20.y; - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1204)) = (this->_position).x; - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1208)) = (this->_position).y; - return; -} diff --git a/generated-src/cell_space.cpp b/generated-src/cell_space.cpp deleted file mode 100644 index 0747c99..0000000 --- a/generated-src/cell_space.cpp +++ /dev/null @@ -1,334 +0,0 @@ -#include "classes.h" - -// 0041bb50 -void CellSpace::insert(Entity *entity) -{ - float fVar1; - int cellY; - int minCellX; - int maxCellX; - int cellY; - int maxCellY; - float fVar3; - float cosAngle; - float fVar4; - float fVar5; - float fVar6; - float fVar7; - int cellX; - - fVar3 = (entity->_sizeMulti).x; - cosAngle = (entity->_sizeMulti).y; - fVar4 = (entity->_pos).x; - fVar1 = (entity->_pos).y; - fVar6 = fVar3 * entity->_size; - fVar5 = cosAngle * entity->_size; - if (((fVar3 != g_vectorOne.x) || (cosAngle != g_vectorOne.y)) && - (fVar3 = (entity->_sprite)._rotation, fVar3 != 0.0)) { - fVar3 = fVar3 * 0.017453292; - cosAngle = cos(fVar3); - fVar3 = sin(fVar3); - fVar7 = fVar5 * fVar3; - fVar5 = ABS(fVar5 * cosAngle) + ABS(fVar6 * fVar3); - fVar6 = ABS(fVar7) + ABS(fVar6 * cosAngle); - } - cosAngle = fVar4 - fVar6; - fVar6 = fVar6 + fVar4; - fVar3 = fVar1 - fVar5; - fVar5 = fVar5 + fVar1; - if ((fVar6 <= cosAngle) || (fVar5 <= fVar3)) { - KAGE_LogMessage(0x10,(uint8_t *) - "Entity Teleport Detected! Type: %d, Variant: %d, Subtype: %d; Pos: %f, %f; Size: %f, %f\n" - ); - } - fVar4 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); - cellY = GHIDRA_INT((fVar3 / fVar4)); - maxCellY = GHIDRA_INT((fVar5 / fVar4)); - if (((maxCellY < cellY) || (cellY + 1 <= cellY)) || (maxCellY + 1 <= maxCellY)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("CellSpace::insert: y1 > y2\n")); - fVar4 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); - } - minCellX = GHIDRA_INT((cosAngle / fVar4)); - maxCellX = GHIDRA_INT((fVar6 / fVar4)); - if (((maxCellX < minCellX) || (minCellX + 1 <= minCellX)) || (maxCellX + 1 <= maxCellX)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("CellSpace::insert: x1 > x2\n")); - } - for (; cellX = minCellX, cellY <= maxCellY; cellY = cellY + 1) { - for (; cellX <= maxCellX; cellX = cellX + 1) { - cellY = *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) * cellY + cellX; - if ((-1 < cellY) && (cellY < (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x18))) / 0xa4) - ) { - cellY = cellY * 0xa4 + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x18)); - if (*GHIDRA_CAST((cellY + 0xa0)) < 0x28) { - *GHIDRA_CAST((cellY + *GHIDRA_CAST((cellY + 0xa0)) * 4)) = entity; - *GHIDRA_CAST((cellY + 0xa0)) = *GHIDRA_CAST((cellY + 0xa0)) + 1; - } - } - } - } - return; -} - -// 0041bdf0 -void CellSpace::collide_entity(Entity *entity) -{ - int iVar1; - Entity *this_00; - int iVar2; - uint32_t pairWord; - int iVar3; - uint32_t pairIndex; - float radiusY; - float cellSize; - float radiusX; - float right; - float bottom; - int row; - uint32_t slot; - int column; - int highIndex; - int ownIndex; - int pairStride; - float posX; - float posY; - - if (entity->_entityCollisionClass != 0) { - posX = (entity->_pos).x; - radiusX = entity->_size * (entity->_sizeMulti).x; - iVar1 = *GHIDRA_CAST(this); - radiusY = entity->_size * (entity->_sizeMulti).y; - cellSize = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); - right = radiusX + posX; - pairStride = *GHIDRA_CAST((iVar1 + 0xd4)); - posY = (entity->_pos).y; - bottom = radiusY + posY; - row = GHIDRA_INT(((posY - radiusY) / cellSize)); - if (row <= GHIDRA_INT((bottom / cellSize))) { - do { - column = GHIDRA_INT(((posX - radiusX) / cellSize)); - if (column <= GHIDRA_INT((right / cellSize))) { - do { - iVar3 = column + *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) * row; - if ((-1 < iVar3) && - (iVar3 < (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x18))) / 0xa4)) { - slot = 0; - iVar3 = iVar3 * 0xa4 + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x18)); - if (*GHIDRA_CAST((iVar3 + 0xa0)) != 0) { - do { - this_00 = *GHIDRA_CAST((iVar3 + slot * 4)); - ownIndex = entity->_collisionIndex; - iVar2 = this_00->_collisionIndex; - highIndex = iVar2; - if (iVar2 < ownIndex) { - highIndex = ownIndex; - } - if (ownIndex < iVar2) { - iVar2 = ownIndex; - } - pairIndex = highIndex * pairStride + iVar2; - if ((this_00 != entity) && (GHIDRA_INT(pairIndex) < *GHIDRA_CAST((iVar1 + 0xd0)))) { - pairWord = pairIndex >> 5; - if ((*GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 0xc4)) + pairWord * 4)) & - 1 << (sbyte)(pairIndex & 0x1f)) == 0) { - if (((((this_00->_sizeMulti).x == g_vectorOne.x) && - ((this_00->_sizeMulti).y == g_vectorOne.y)) && - ((entity->_sizeMulti).x == g_vectorOne.x)) && - ((entity->_sizeMulti).y == g_vectorOne.y)) { - (GHIDRA_CAST((this_00)))->Entity::push_apart_circle(entity); - } - else { - (GHIDRA_CAST((this_00)))->Entity::push_apart_capsule(entity); - } - _DAT_00c71650 = _DAT_00c71650 + 1; - *GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 0xc4)) + pairWord * 4)) = - *GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 0xc4)) + pairWord * 4)) | - 1 << (pairIndex & 0x1f); - } - } - slot = slot + 1; - } while (slot < *GHIDRA_CAST((iVar3 + 0xa0))); - } - } - cellSize = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); - column = column + 1; - } while (column <= GHIDRA_INT((right / cellSize))); - } - row = row + 1; - } while (row <= GHIDRA_INT((bottom / cellSize))); - } - } - return; -} - -// 0041c070 -void CellSpace::collide(void *entityB) -{ - void *entityA = this; - int iVar1; - int owner; - int pairStride; - uint32_t pairIndex; - uint32_t otherSlot; - uint32_t *entitySlot; - uint32_t slot; - uint32_t cellIndex; - int cellOffset; - uint32_t *cellEntityCount; - Entity *entityA; - Entity *entityB; - int maxIndex; - int owner; - uint32_t pairBits; - int pairStride; - - owner = *GHIDRA_CAST((GHIDRA_CAST(entityA) + 0x1c)); - if ((owner - *GHIDRA_CAST((GHIDRA_CAST(entityA) + 0x18))) / 0xa4 != - (*GHIDRA_CAST((GHIDRA_CAST(entityB) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(entityB) + 0x18))) / 0xa4) { - KAGE_LogMessage(0x10,GHIDRA_CAST("CellSpace::collide - cell counts don\'t match!\n")); - owner = *GHIDRA_CAST((GHIDRA_CAST(entityA) + 0x1c)); - } - owner = *GHIDRA_CAST(entityA); - pairStride = *GHIDRA_CAST((GHIDRA_CAST(entityA) + 0x18)); - cellIndex = 0; - pairStride = *GHIDRA_CAST((owner + 0xd4)); - iVar1 = owner - pairStride >> 0x1f; - if ((owner - pairStride) / 0xa4 + iVar1 != iVar1) { - cellOffset = 0; - do { - entitySlot = GHIDRA_CAST((cellOffset + pairStride)); - slot = 0; - owner = *GHIDRA_CAST((GHIDRA_CAST(entityB) + 0x18)) + cellOffset; - cellEntityCount = entitySlot + 0x28; - if (*cellEntityCount != 0) { - do { - otherSlot = 0; - if (*GHIDRA_CAST((owner + 0xa0)) != 0) { - do { - entityA = GHIDRA_CAST(*entitySlot); - entityB = *GHIDRA_CAST((owner + otherSlot * 4)); - pairStride = entityA->_collisionIndex; - iVar1 = entityB->_collisionIndex; - maxIndex = pairStride; - if (pairStride < iVar1) { - maxIndex = iVar1; - } - if (iVar1 < pairStride) { - pairStride = iVar1; - } - pairIndex = maxIndex * pairStride + pairStride; - if ((entityA != entityB) && (GHIDRA_INT(pairIndex) < *GHIDRA_CAST((owner + 0xd0)))) { - pairBits = *GHIDRA_CAST((*GHIDRA_CAST((owner + 0xc4)) + (pairIndex >> 5) * 4)); - if ((pairBits & 1 << (sbyte)(pairIndex & 0x1f)) == 0) { - *GHIDRA_CAST((*GHIDRA_CAST((owner + 0xc4)) + (pairIndex >> 5) * 4)) = - pairBits | 1 << (pairIndex & 0x1f); - if (((((entityA->_sizeMulti).x == g_vectorOne.x) && - ((entityA->_sizeMulti).y == g_vectorOne.y)) && - ((entityB->_sizeMulti).x == g_vectorOne.x)) && - ((entityB->_sizeMulti).y == g_vectorOne.y)) { - (GHIDRA_CAST((entityA)))->Entity::push_apart_circle(entityB); - } - else { - (GHIDRA_CAST((entityA)))->Entity::push_apart_capsule(entityB); - } - _DAT_00c71650 = _DAT_00c71650 + 1; - } - } - otherSlot = otherSlot + 1; - } while (otherSlot < *GHIDRA_CAST((owner + 0xa0))); - } - slot = slot + 1; - entitySlot = entitySlot + 1; - } while (slot < *cellEntityCount); - } - cellIndex = cellIndex + 1; - cellOffset = cellOffset + 0xa4; - pairStride = *GHIDRA_CAST((GHIDRA_CAST(entityA) + 0x18)); - } while (cellIndex < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(entityA) + 0x1c)) - pairStride) / 0xa4))); - } - return; -} - -// 0041c2a0 -void CellSpace::collide_self() -{ - void *first = this; - uint32_t *puVar1; - Entity *other; - int owner; - uint32_t uVar3; - uint32_t j; - int iVar4; - bool bVar5; - uint32_t *firstSlot; - int cellOffset; - uint32_t i; - uint32_t cellIndex; - Entity *first; - int highIndex; - int owner; - int pairStride; - uint32_t pairWord; - - cellIndex = 0; - owner = *GHIDRA_CAST(first); - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(first) + 0x18)); - highIndex = *GHIDRA_CAST((GHIDRA_CAST(first) + 0x1c)) - iVar4; - pairStride = *GHIDRA_CAST((owner + 0xd4)); - owner = highIndex >> 0x1f; - if (highIndex / 0xa4 + owner != owner) { - cellOffset = 0; - do { - uVar3 = *GHIDRA_CAST((cellOffset + 0xa0 + iVar4)); - puVar1 = GHIDRA_CAST((cellOffset + iVar4)); - if (uVar3 != 0) { - i = 1; - firstSlot = puVar1; - do { - j = i; - if (i < uVar3) { - do { - other = GHIDRA_CAST(puVar1[j]); - first = GHIDRA_CAST(*firstSlot); - iVar4 = other->_collisionIndex; - owner = first->_collisionIndex; - highIndex = owner; - if (owner < iVar4) { - highIndex = iVar4; - } - if (iVar4 < owner) { - owner = iVar4; - } - uVar3 = highIndex * pairStride + owner; - if ((first != other) && (GHIDRA_INT(uVar3) < *GHIDRA_CAST((owner + 0xd0)))) { - pairWord = *GHIDRA_CAST((*GHIDRA_CAST((owner + 0xc4)) + (uVar3 >> 5) * 4)); - if ((pairWord & 1 << (sbyte)(uVar3 & 0x1f)) == 0) { - *GHIDRA_CAST((*GHIDRA_CAST((owner + 0xc4)) + (uVar3 >> 5) * 4)) = - pairWord | 1 << (uVar3 & 0x1f); - if (((((first->_sizeMulti).x == g_vectorOne.x) && - ((first->_sizeMulti).y == g_vectorOne.y)) && - ((other->_sizeMulti).x == g_vectorOne.x)) && - ((other->_sizeMulti).y == g_vectorOne.y)) { - (GHIDRA_CAST((first)))->Entity::push_apart_circle(other); - } - else { - (GHIDRA_CAST((first)))->Entity::push_apart_capsule(other); - } - _DAT_00c71650 = _DAT_00c71650 + 1; - } - } - j = j + 1; - uVar3 = puVar1[0x28]; - } while (j < uVar3); - } - firstSlot = firstSlot + 1; - bVar5 = i < uVar3; - i = i + 1; - } while (bVar5); - } - cellOffset = cellOffset + 0xa4; - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(first) + 0x18)); - cellIndex = cellIndex + 1; - } while (cellIndex < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(first) + 0x1c)) - iVar4) / 0xa4))); - } - return; -} diff --git a/generated-src/classes.h b/generated-src/classes.h index 2887a06..eb505df 100644 --- a/generated-src/classes.h +++ b/generated-src/classes.h @@ -143,9 +143,13 @@ struct BossId; struct BossOverlay; struct BossOverlayEntry; struct BossPool; +struct BossPoolState; +struct BossPool_Entry; +struct BossPool_Pool; struct BufferedStream; struct CLIENT_ID; struct Camera; +struct CameraBounds; struct Capsule; struct Card; struct CellSpace; @@ -176,6 +180,7 @@ struct Cutscene; struct CutsceneEntry; struct CutscenePart; struct DailyChallenge; +struct DamageEvent; struct DamageInfo; struct Data; struct DateTime; @@ -308,6 +313,7 @@ struct History; struct HistoryHUD; struct HistoryHUDItem; struct HistoryHUDPlayer; +struct HistoryItem; struct HomingLaser; struct IconResource; struct ImageBase; @@ -348,6 +354,7 @@ struct KAGE_ReferenceCount_ImageBase; struct KColor; struct KerningPair; struct KeyConfigs; +struct LRoomAreaDesc; struct LRoomTileDesc; struct LayerAnimation; struct LayerData; @@ -364,7 +371,6 @@ struct LobbySettings; struct LocustConfig; struct LocustEffect; struct LootList; -struct LuaBridgeRef; struct LuaEngine; struct LuaItemUse; struct LuaMod; @@ -456,6 +462,7 @@ struct PlayerHUDTrinket; struct PlayerManager; struct PlayerProceduralItems; struct PngWriter; +struct PocketItem; struct PocketItemConfig; struct Point; struct PoolItem; @@ -508,6 +515,7 @@ struct RoomScore; struct RoomSet; struct RoomSpawn; struct RoomTransition; +struct RoomTransitionRequest; struct SFXManager; struct SaveDataManager; struct ScoreRecord; @@ -520,6 +528,7 @@ struct SharedPtrPair; struct ShockwaveParams; struct SimpleString; struct Size; +struct SmeltedTrinket; struct SoundEffect; struct SoundEffects; struct SoundInstance; @@ -528,6 +537,7 @@ struct SoundPlay; struct SoundSample; struct SourceQuad; struct Spawn; +struct SpawnFlags; struct SpecialSeed; struct Sprite; struct SpriteDraw; @@ -552,9 +562,11 @@ struct Thread; struct TrinketPoolItem; struct TypeDescriptor; struct UmbilicalBabyData; +struct UpdateTally; struct UserProfile; struct VariantRange; struct Vector; +struct VectorRing; struct VentricleRazorPortal; struct VideoPlayer; struct Weapon; @@ -836,812 +848,7 @@ typedef void * _onexit_t; typedef int errno_t; typedef size_t rsize_t; -struct EntityPtr { - static uint32_t Ref(); // 0040c3a0 - void Set(Entity *entity); // 004cf1d0 - static void SetReference(EntityPtr *ptr, Entity *entity); // 006b5b50 - void SetReference(Entity *entity); // 00872050 - EntityPtr * clear(); // 00a0fe80 - - GHIDRA_POINTER_LIKE(EntityPtr) -}; - - -struct RNG { - static void Shuffle(RNG *rng, int *begin, int *end); // 005cc070 - void game_constructor(uint32_t seed, uint32_t shiftidx); // 007e8f90 - void SetSeed(uint32_t Seed, uint32_t ShiftIdx); // 007e8fe0 - uint32_t RandomInt(uint32_t max); // 007e9020 - float RandomFloat(); // 007e9080 - uint32_t Next(); // 007e90f0 - - uint32_t _seed; - uint32_t _shift1; - uint32_t _shift2; - uint32_t _shift3; -}; -LAYOUT32(offsetof(RNG, _seed) == 0x0); -LAYOUT32(offsetof(RNG, _shift1) == 0x4); -LAYOUT32(offsetof(RNG, _shift2) == 0x8); -LAYOUT32(offsetof(RNG, _shift3) == 0xc); - -struct Vector { - static Vector * operator_mul(Vector *outResult, float *scalar, Vector *vector); // 004171d0 - static Vector * ToCardinal(Vector *outResult, Vector *vec); // 0067f170 - static Vector * mul_065(Vector *outResult, Vector *source); // 0067f2b0 - Vector * operator_assign(Vector *other); // 007dd3b0 - static uint8_t * __tostring(); // 0085e630 - Vector(float x, float y); // 00a0fe90 - float Length(); // 00a0fea0 - float LengthSquared(); // 00a0fed0 - float Distance(Vector *other); // 00a0ff30 - float DistanceSquared(Vector *other); // 00a0ff90 - void Normalize(); // 00a0ffc0 - Vector * Normalized(Vector *outResult); // 00a10030 - void Resize(float length); // 00a100b0 - Vector * Resized(Vector *outVec, float length); // 00a10100 - float Dot(Vector *other); // 00a10180 - float Cross(Vector *other); // 00a101a0 - void Lerp(Vector *target, float t, uint8_t isClamped); // 00a10210 - void Rotate(float angleDegrees); // 00a10270 - Vector * Rotated(Vector *outVec, float angleDegrees); // 00a102e0 - static Vector * FromAngle(Vector *outVec, float angleDegrees); // 00a10350 - float GetAngleDegrees(); // 00a10390 - void Clamp(float minX, float minY, float maxX, float maxY); // 00a103c0 - Vector * Clamped(Vector *outResult, float minX, float minY, float maxX, float maxY); // 00a103f0 - Vector * __add(Vector *outVec, Vector *other); // 00a10420 - Vector * operator_add_assign(Vector *other); // 00a10450 - Vector * __sub(Vector *outResult, Vector *other); // 00a10480 - Vector * operator__(Vector *other); // 00a104b0 - Vector * __mul(Vector *outResult, float *scalar); // 00a104e0 - Vector * Mul(Vector *outResult, Vector *other); // 00a10510 - Vector * operator_mul_assign(float *scalar); // 00a10540 - Vector * __div(Vector *outResult, float *divisor); // 00a105a0 - Vector * __div_assign(float *divisor); // 00a105d0 - uint8_t operator_eq(Vector *other); // 00a10600 - uint8_t operator_ne(Vector *other); // 00a10630 - Vector * __unm(Vector *outResult); // 00a10660 - Vector() = default; - - float x; - float y; -}; -LAYOUT32(offsetof(Vector, x) == 0x0); -LAYOUT32(offsetof(Vector, y) == 0x4); - -struct ColorMod { - float _tint[4]; - float _colorize[4]; - float _offset[3]; -}; -LAYOUT32(offsetof(ColorMod, _tint) == 0x0); -LAYOUT32(offsetof(ColorMod, _colorize) == 0x10); -LAYOUT32(offsetof(ColorMod, _offset) == 0x20); -LAYOUT32(sizeof(ColorMod) == 0x2c); - -struct std_vector { - void * _begin; - void * _end; - void * _capacity; -}; -LAYOUT32(offsetof(std_vector, _begin) == 0x0); -LAYOUT32(offsetof(std_vector, _end) == 0x4); -LAYOUT32(offsetof(std_vector, _capacity) == 0x8); -LAYOUT32(sizeof(std_vector) == 0xc); - -struct EntityRef { - void constructor(Entity *entity); // 00431310 - EntityRef(); // 00435c70 - EntityRef * operator_(EntityRef *other); // 00499960 - uint32_t IsFriendly(); // 004a2910 - uint8_t IsCharmed(); // 004bc670 - - int _type; - uint32_t _variant; - int _spawnerType; - uint32_t _spawnerVariant; - Vector _position; - Vector _velocity; - uint32_t _flags; - Entity* _entity; -}; -LAYOUT32(offsetof(EntityRef, _type) == 0x0); -LAYOUT32(offsetof(EntityRef, _variant) == 0x4); -LAYOUT32(offsetof(EntityRef, _spawnerType) == 0x8); -LAYOUT32(offsetof(EntityRef, _spawnerVariant) == 0xc); -LAYOUT32(offsetof(EntityRef, _position) == 0x10); -LAYOUT32(offsetof(EntityRef, _velocity) == 0x18); -LAYOUT32(offsetof(EntityRef, _flags) == 0x20); -LAYOUT32(offsetof(EntityRef, _entity) == 0x24); - -struct std_multiset { - void * _head; - uint32_t _size; -}; -LAYOUT32(offsetof(std_multiset, _head) == 0x0); -LAYOUT32(offsetof(std_multiset, _size) == 0x4); -LAYOUT32(sizeof(std_multiset) == 0x8); - -struct Entity { - virtual ~Entity(); // 006a8820 slot 0 - virtual void Init(int type, int variant, int subType, uint32_t initSeed); // 006a93a0 slot 1 - virtual void PreUpdate(); // 006ae7d0 slot 2 - virtual void Update(); // 006ae820 slot 3 - virtual void Interpolate(); // 006b0eb0 slot 4 - virtual void Render(Vector *offset); // 006b10f0 slot 5 - virtual uint8_t RenderShadowLayer(Vector *offset); // 006b2000 slot 6 - virtual void PostRender(); // 006b1260 slot 7 - virtual uint8_t TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown); // 006ace60 slot 8 - virtual void Kill(EntityRef *source); // 006ac920 slot 9 - virtual void Remove(); // 006acb00 slot 10 - virtual void guard_check_icall(); // 0040c200 slot 11 ::guard_check_icall - virtual void vfunc_12(); // 0040c200 slot 12 ::guard_check_icall - virtual int GetRenderZ(); // 006b1000 slot 13 - virtual uint8_t CanOverwrite(); // 006b10d0 slot 14 - virtual void SetColor(ColorMod *color, int duration, int priority, uint8_t isFadeout, uint8_t isShare); // 006b2fa0 slot 15 - virtual void SetCollisionDamage(float param_2); // 005ccbe0 slot 16 - virtual void ClearReferences(); // 006acb60 slot 17 - virtual uint8_t CanShutDoors(); // 005ccc00 slot 18 - virtual uint8_t IsBoss(); // 005ccc00 slot 19 - virtual uint8_t IsValidTarget(Entity *target); // 006a8ee0 slot 20 - virtual uint8_t TryThrow(); // 005ccc10 slot 21 - virtual Vector * GetForwardVector(Vector *outForward); // 006b63b0 slot 22 - virtual void HandleCollision(); // 00af05d3 slot 23 - virtual void ResetColor(); // 006ac6e0 slot 24 - virtual void LoadEntityConfig(); // 006a98b0 slot 25 - virtual void vfunc_26(); // 00b1d830 slot 26 - uint8_t IsType(int type, int variant, int subType); // 00417220 - int Type(); // 00417260 - int Variant(); // 00417270 - int SubType(); // 00417280 - Vector * Position(Vector *outPos); // 00417290 - Vector * Velocity(Vector *outVelocity); // 004172d0 - void SetPositionOffset(Vector *offset); // 004172f0 - Vector * PositionOffset(); // 00417310 - Vector * SpriteScale(); // 00417320 - long double SpriteRotation(); // 00417330 - float MaxHitPoints(); // 00417360 - long double HitPoints(); // 00417370 - int EntityCollisionClass(); // 00417380 - uint8_t is_player(); // 004173b0 - bool is_bomb(); // 004173c0 - void AddEntityFlags(uint64_t flags); // 004173e0 - void ClearEntityFlags(uint64_t flags); // 00417400 - uint64_t GetEntityFlags(); // 00417420 - uint8_t HasEntityFlags(uint64_t flags); // 00417430 - uint8_t Exists(); // 00417460 - uint8_t IsDead(); // 00417470 - uint8_t Visible(); // 00417480 - uint32_t SpawnerEntity(); // 004174a0 - RNG * GetDropRNG(); // 004174b0 - void SetPosition(Vector *pos); // 004288f0 - void SetVelocity(Vector *velocity); // 00428910 - uint8_t IsFamiliar(); // 0042a250 - uint32_t Parent(); // 0042a260 - void SetSpriteScale(Vector *scale); // 0042d9b0 - int SpawnerType(); // 00431430 - int SpawnerVariant(); // 00431440 - void AddVelocity(Vector *velocity, uint8_t isIgnoreSpeedMultiplier); // 00431450 - void AddVelocity_divided(Vector *velocity, uint8_t isIgnoreSpeedMultiplier); // 004314b0 - long double Mass(); // 00431520 - uint8_t IsTear(); // 00431530 - uint8_t IsProjectile(); // 00431540 - bool is_pickup(); // 00431550 - uint32_t Child(); // 00431560 - static void get_friction(); // 00435ce0 - long double DepthOffset(); // 00435d10 - void SetField380(float value); // 00435d20 - void SetTargetPosition(Vector position); // 00435d60 - bool is_slot(); // 00435da0 - int GetHitPointsLost(); // 00435db0 - ANM2 * GetSprite(); // 00435dd0 - Entity * to_npc_or_coop_player(); // 00435e00 - Entity_Tear * ToTear(); // 00435e40 - void SetVisibleFlag(uint8_t isVisible); // 00436220 - int GridCollisionClass(); // 00440eb0 - void Die(); // 00444c60 - uint8_t IsFriendly(); // 004567b0 - Entity_Player * ToPlayer(); // 00499da0 - Vector * SpriteOffset(); // 0049cb50 - Vector * TargetPosition(); // 004aad30 - uint32_t Target(); // 004b7080 - ColorMod * SplatColor(); // 004e47a0 - ColorMod * GetColor(); // 00505b60 - int InitSeed(); // 00505b70 - int SortingLayer(); // 00592250 - void MultiplyFriction(float param_2); // 005a6ff0 - long double CollisionDamage(); // 005b1570 - uint8_t IsInvincible(); // 005b1580 - int DropSeed(); // 005b1590 - void AddFlagsLow(uint32_t param_2); // 005cd460 - Entity * AddFear(int param_2, int param_3, int param_4); // 0060af70 - void convert_shot_for_enemy_owner(Entity *shot); // 0064bb70 - static uint8_t CollidesWithGrid(); // 00665a80 - void GetRootParent(); // 0067a720 - void constructor(); // 006a8290 - void destructor(); // 006a8850 - Entity * GetLastParent(); // 006a8990 - Entity * GetLastChild(); // 006a89b0 - Entity * GetLastSpawner(); // 006a89d0 - Entity * GetStatusEffectTarget(); // 006a89f0 - void CopyStatusEffects(); // 006a8a20 - uint8_t HasCommonParentWithEntity(Entity *other); // 006a8c00 - uint8_t is_same_segmented_body(Entity *other); // 006a8c60 - uint8_t DoesEntityShareStatus(); // 006a8db0 - uint8_t is_valid_boss_enemy(int unused); // 006a8f20 - uint8_t CanDevolve(); // 006a8f80 - uint8_t IsDescendantOf(Entity *ancestor); // 006a8fa0 - Entity * GetPlayerAncestor(); // 006a9140 - void SetParent(Entity *parent); // 006a92a0 - void SetChild(Entity *child); // 006a92e0 - void SetTarget(Entity *target); // 006a9320 - void SetSpawnerEntity(Entity *spawner); // 006a9360 - void * GetCollisionCapsule(void *outCapsule, Vector *offset); // 006a9ba0 - int FrameCount(); // 006a9c10 - bool HasFullHealth(); // 006a9c30 - void AddHealth(float amount); // 006a9c50 - void CollideWithGrid(uint8_t isSimulated); // 006a9c90 - uint8_t is_grid_collision_at(Vector *position); // 006ab240 - void PlayerCollideWithGrid(uint8_t isSimulated); // 006ab440 - void SetSize(float size, Vector sizeMulti, int numGridCollisionPoints); // 006ac2a0 - uint8_t IsEnemy(); // 006ac530 - uint8_t IsVulnerableEnemy(Entity *source); // 006ac560 - uint8_t IsFlying(); // 006ac6c0 - uint8_t IsFrame(int frequency, int offset); // 006ac710 - int GetIntervalTicks(float interval, float offset); // 006ac760 - int CountRelatedEntities(int type, int variant, int unused, void *outEntities); // 006ac7e0 - int get_velocity_direction(); // 006ac8d0 - uint8_t IsDamageSourceFriendly(EntityRef *source); // 006acd10 - bool HasMortalDamage(); // 006ad340 - int apply_second_hand_duration(int duration, EntityRef *source); // 006ad350 - void AddFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown); // 006ad3c0 - void AddPoison(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown); // 006ad500 - void AddSlowing(EntityRef *ref, int duration, float amount, ColorMod color, uint8_t ignoreBossStatusCooldown); // 006ad750 - void AddCharmed(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t addEnemyKillScore); // 006ad870 - void AddConfusion(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown); // 006add70 - void AddMidasFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown); // 006adf40 - void AddFear(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown); // 006ae0a0 - void AddBurn(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown); // 006ae280 - void AddBleeding(EntityRef *ref, int duration, uint8_t unused); // 006ae420 - void RemoveStatusEffects(); // 006ae630 - float IsCollisionIgnored(Entity *other); // 006b2210 - void push_apart_capsule(Entity *other); // 006b25b0 - uint8_t push_apart_circle(Entity *other); // 006b2940 - void collide_with_entity(); // 006b2ee0 - static uint8_t ForceCollide(Entity *boom, Entity *collider, uint8_t low); // 006b2f50 - void BloodExplode(); // 006b45c0 - uint8_t IsActiveEnemy(uint8_t includeDead); // 006b5b90 - void AddShrink(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t unk); // 006b5c10 - void * GetData(void *outRef); // 006b5e60 - void * GetDebugShape(uint8_t isUnknown); // 006b5f10 - uint32_t GetHitListIndex(); // 006b62b0 - Entity_Effect * MakeGroundPoof(Vector *position, ColorMod *color, float size); // 006b6550 - Entity_Effect * MakeGroundPoofAtSelf(ColorMod *color, float size); // 006b66a0 - Entity_Effect * MakeBloodPoof(Vector *position, ColorMod *color, float scale); // 006b66c0 - Entity_Effect * MakeBloodPoofAtPos(ColorMod *color, float scale); // 006b6810 - Vector * GetNullOffset(Vector *outOffset, uint8_t *nullLayerName); // 006b6af0 - Capsule * GetNullCapsule(Capsule *outCapsule, uint8_t *nullLayerName); // 006b6c20 - int * get_water_splash_variant(int *outSplash); // 006b6ed0 - void AddMagnetized(EntityRef *ref, int duration, uint8_t unused); // 006b7280 - void AddBaited(EntityRef *ref, int duration, uint8_t unused); // 006b7560 - void AddWeakness(EntityRef *ref, int duration); // 006b77d0 - void AddBrimstoneMark(EntityRef *ref, int duration); // 006b78d0 - void AddIce(EntityRef *ref, int duration); // 006b79d0 - Entity_NPC * GiveMinecart(Vector *position, Vector *velocity); // 006b7be0 - uint8_t IsPlayerInRadius(Vector *position, float radius, int unused1, int unused2); // 006b9740 - uint8_t IsHostileTo(Entity *other); // 006d7d60 - uint8_t is_valid_target(); // 006d8990 - int SpawnGridIndex(); // 006ef400 - static void RemoveWithPoof(Entity *entity, int unusedArg); // 007079c0 - static void DestroyRockGridAt(Vector *position, GridEntityDesc *desc, Entity *source, int backdropType); // 0070c000 - int RenderZOffset(); // 007536f0 - int GetBossID(); // 007e9130 - uint8_t FlipX(); // 0085dca0 - void SetSpriteFrame(std_string *animName, int frame); // 0085dcb0 - void SetSpriteOverlayFrame(std_string *anim, int frame); // 0085dd00 - Vector * SizeMulti(Vector *outResult); // 0085dd40 - static uint32_t IsVulnerableEnemy_lua(void *param_1); // 0085e680 - static void ReleaseLuaRef(Entity *entity); // 00866060 - static long double Size(int param_1); // 00871f90 - void KillWithSource(); // 008c5cf2 - - uint8_t _pad_0x4[0x4]; - std_vector _damageEvents; - float _pendingDamage; - uint64_t _pendingDamageFlags; - unsigned int _index; - unsigned int _collisionIndex; - unsigned int _type; - unsigned int _variant; - unsigned int _subtype; - unsigned int _spawnerType; - unsigned int _spawnerVariant; - uint8_t _pad_0x3c[0xc]; - uint8_t _sprite[0x94]; // ANM2 - Vector _spriteOffset; - Vector _spriteScale; - uint8_t _pad_0xec[0x5c]; - bool _isFlipX; - uint8_t _pad_0x149[0x13]; - float _shadowSize; - Vector _shadowOffset; - uint8_t _flags[0x8]; // unsigned long long - bool _valid; - bool _visible; - bool _exists; - bool _dead; - bool _isKillOnTouch; - bool _isInterpolating; - bool _isInitFlag176; - bool _removedByFactory; - std_vector _collisionPoints; - int _entityGridCollisionClass; - int _entityCollisionClass; - bool _collidesWithEntity; - uint8_t _pad_0x18d[0x3]; - bool _collidesWithGrid; - uint8_t _pad_0x191[0x3]; - Vector _gridCollisionVelocity; - Vector _gridCollisionNormal; - Vector _renderPosition; - std_vector _colorParams; - ColorMod _color; - ColorMod _splatColor; - int _fireDamageCountdown; - int _damageCountdown; - int _freezeCountdown; - int _poisonCountdown; - int _slowingCountdown; - int _charmedCountdown; - int _confusionCountdown; - int _midasFreezeCountdown; - int _fearCountdown; - int _burnCountdown; - int _bossStatusEffectCooldown; - int _shrinkCountdown; - EntityRef _charmSource; - EntityRef _entityRef2; - EntityRef _entityRef3; - EntityRef _entityRef4; - int _poisonDamageTimer; - int _burnDamageTimer; - int _bleedingCountdown; - float _bleedDamageAccumulator; - int _magnetizedCountdown; - int _baitedCountdown; - int _knockbackCountdown; - int _weaknessCountdown; - int _iceCountdown; - int _brimstoneMarkCountdown; - Vector _knockbackDirection; - uint8_t _iceFrozenEffect[0x4]; // EntityPtr - Vector _pausePosition; - int _pauseTimer; - float _poisonTickDamage; - float _burnTickDamage; - int _spawnFrame; - int _spawnGridIndex; - EntityConfig_Entity* _config; - Vector _targetPosition; - Vector _pos; - Vector _preInterpolatePos; - Vector _posOffset; - int _renderZOffset; - float _renderDepthOffset; - int _sortingLayer; - Vector _velocity; - float _baseFriction; - float _friction; - float _size; - Vector _sizeMulti; - float _mass; - float _health; - float _maxHitPoints; - float _collisionDamage; - Vector _prevPosition; - Vector _prevVelocity; - float _speedMultiplier; - float _prevUpdateTime; - float _updateTime; - uint8_t _pad_0x3a8[0x4]; - float _slowingAmount; - bool _isInvicible; - uint8_t _pad_0x3b1[0x3]; - float _shrinkStatus1; - float _shrinkStatus2; - uint8_t _parent[0x4]; // EntityPtr - uint8_t _child[0x4]; // EntityPtr - uint8_t _target[0x4]; // EntityPtr - uint8_t _spawnerEntity[0x4]; // EntityPtr - std_multiset _entityPtrReferrers; - uint8_t _minecart[0x4]; // EntityPtr - uint8_t _hitEffect[0x4]; // EntityPtr - RNG _dropRNG; - uint32_t _initSeed; - int _holdCountdown; - Vector _holdPosition; - int _pitfallState; - int _pitfallTimer; - float _scoreMultiplier; - LuaBridgeRef* _luaBridgeRef; - uint8_t _pad_0x40c[0x4]; -}; -LAYOUT32(offsetof(Entity, _damageEvents) == 0x8); -LAYOUT32(offsetof(Entity, _pendingDamage) == 0x14); -LAYOUT32(offsetof(Entity, _pendingDamageFlags) == 0x18); -LAYOUT32(offsetof(Entity, _index) == 0x20); -LAYOUT32(offsetof(Entity, _collisionIndex) == 0x24); -LAYOUT32(offsetof(Entity, _type) == 0x28); -LAYOUT32(offsetof(Entity, _variant) == 0x2c); -LAYOUT32(offsetof(Entity, _subtype) == 0x30); -LAYOUT32(offsetof(Entity, _spawnerType) == 0x34); -LAYOUT32(offsetof(Entity, _spawnerVariant) == 0x38); -LAYOUT32(offsetof(Entity, _sprite) == 0x48); -LAYOUT32(offsetof(Entity, _spriteOffset) == 0xdc); -LAYOUT32(offsetof(Entity, _spriteScale) == 0xe4); -LAYOUT32(offsetof(Entity, _isFlipX) == 0x148); -LAYOUT32(offsetof(Entity, _shadowSize) == 0x15c); -LAYOUT32(offsetof(Entity, _shadowOffset) == 0x160); -LAYOUT32(offsetof(Entity, _flags) == 0x168); -LAYOUT32(offsetof(Entity, _valid) == 0x170); -LAYOUT32(offsetof(Entity, _visible) == 0x171); -LAYOUT32(offsetof(Entity, _exists) == 0x172); -LAYOUT32(offsetof(Entity, _dead) == 0x173); -LAYOUT32(offsetof(Entity, _isKillOnTouch) == 0x174); -LAYOUT32(offsetof(Entity, _isInterpolating) == 0x175); -LAYOUT32(offsetof(Entity, _isInitFlag176) == 0x176); -LAYOUT32(offsetof(Entity, _removedByFactory) == 0x177); -LAYOUT32(offsetof(Entity, _collisionPoints) == 0x178); -LAYOUT32(offsetof(Entity, _entityGridCollisionClass) == 0x184); -LAYOUT32(offsetof(Entity, _entityCollisionClass) == 0x188); -LAYOUT32(offsetof(Entity, _collidesWithEntity) == 0x18c); -LAYOUT32(offsetof(Entity, _collidesWithGrid) == 0x190); -LAYOUT32(offsetof(Entity, _gridCollisionVelocity) == 0x194); -LAYOUT32(offsetof(Entity, _gridCollisionNormal) == 0x19c); -LAYOUT32(offsetof(Entity, _renderPosition) == 0x1a4); -LAYOUT32(offsetof(Entity, _colorParams) == 0x1ac); -LAYOUT32(offsetof(Entity, _color) == 0x1b8); -LAYOUT32(offsetof(Entity, _splatColor) == 0x1e4); -LAYOUT32(offsetof(Entity, _fireDamageCountdown) == 0x210); -LAYOUT32(offsetof(Entity, _damageCountdown) == 0x214); -LAYOUT32(offsetof(Entity, _freezeCountdown) == 0x218); -LAYOUT32(offsetof(Entity, _poisonCountdown) == 0x21c); -LAYOUT32(offsetof(Entity, _slowingCountdown) == 0x220); -LAYOUT32(offsetof(Entity, _charmedCountdown) == 0x224); -LAYOUT32(offsetof(Entity, _confusionCountdown) == 0x228); -LAYOUT32(offsetof(Entity, _midasFreezeCountdown) == 0x22c); -LAYOUT32(offsetof(Entity, _fearCountdown) == 0x230); -LAYOUT32(offsetof(Entity, _burnCountdown) == 0x234); -LAYOUT32(offsetof(Entity, _bossStatusEffectCooldown) == 0x238); -LAYOUT32(offsetof(Entity, _shrinkCountdown) == 0x23c); -LAYOUT32(offsetof(Entity, _charmSource) == 0x240); -LAYOUT32(offsetof(Entity, _entityRef2) == 0x268); -LAYOUT32(offsetof(Entity, _entityRef3) == 0x290); -LAYOUT32(offsetof(Entity, _entityRef4) == 0x2b8); -LAYOUT32(offsetof(Entity, _poisonDamageTimer) == 0x2e0); -LAYOUT32(offsetof(Entity, _burnDamageTimer) == 0x2e4); -LAYOUT32(offsetof(Entity, _bleedingCountdown) == 0x2e8); -LAYOUT32(offsetof(Entity, _bleedDamageAccumulator) == 0x2ec); -LAYOUT32(offsetof(Entity, _magnetizedCountdown) == 0x2f0); -LAYOUT32(offsetof(Entity, _baitedCountdown) == 0x2f4); -LAYOUT32(offsetof(Entity, _knockbackCountdown) == 0x2f8); -LAYOUT32(offsetof(Entity, _weaknessCountdown) == 0x2fc); -LAYOUT32(offsetof(Entity, _iceCountdown) == 0x300); -LAYOUT32(offsetof(Entity, _brimstoneMarkCountdown) == 0x304); -LAYOUT32(offsetof(Entity, _knockbackDirection) == 0x308); -LAYOUT32(offsetof(Entity, _iceFrozenEffect) == 0x310); -LAYOUT32(offsetof(Entity, _pausePosition) == 0x314); -LAYOUT32(offsetof(Entity, _pauseTimer) == 0x31c); -LAYOUT32(offsetof(Entity, _poisonTickDamage) == 0x320); -LAYOUT32(offsetof(Entity, _burnTickDamage) == 0x324); -LAYOUT32(offsetof(Entity, _spawnFrame) == 0x328); -LAYOUT32(offsetof(Entity, _spawnGridIndex) == 0x32c); -LAYOUT32(offsetof(Entity, _config) == 0x330); -LAYOUT32(offsetof(Entity, _targetPosition) == 0x334); -LAYOUT32(offsetof(Entity, _pos) == 0x33c); -LAYOUT32(offsetof(Entity, _preInterpolatePos) == 0x344); -LAYOUT32(offsetof(Entity, _posOffset) == 0x34c); -LAYOUT32(offsetof(Entity, _renderZOffset) == 0x354); -LAYOUT32(offsetof(Entity, _renderDepthOffset) == 0x358); -LAYOUT32(offsetof(Entity, _sortingLayer) == 0x35c); -LAYOUT32(offsetof(Entity, _velocity) == 0x360); -LAYOUT32(offsetof(Entity, _baseFriction) == 0x368); -LAYOUT32(offsetof(Entity, _friction) == 0x36c); -LAYOUT32(offsetof(Entity, _size) == 0x370); -LAYOUT32(offsetof(Entity, _sizeMulti) == 0x374); -LAYOUT32(offsetof(Entity, _mass) == 0x37c); -LAYOUT32(offsetof(Entity, _health) == 0x380); -LAYOUT32(offsetof(Entity, _maxHitPoints) == 0x384); -LAYOUT32(offsetof(Entity, _collisionDamage) == 0x388); -LAYOUT32(offsetof(Entity, _prevPosition) == 0x38c); -LAYOUT32(offsetof(Entity, _prevVelocity) == 0x394); -LAYOUT32(offsetof(Entity, _speedMultiplier) == 0x39c); -LAYOUT32(offsetof(Entity, _prevUpdateTime) == 0x3a0); -LAYOUT32(offsetof(Entity, _updateTime) == 0x3a4); -LAYOUT32(offsetof(Entity, _slowingAmount) == 0x3ac); -LAYOUT32(offsetof(Entity, _isInvicible) == 0x3b0); -LAYOUT32(offsetof(Entity, _shrinkStatus1) == 0x3b4); -LAYOUT32(offsetof(Entity, _shrinkStatus2) == 0x3b8); -LAYOUT32(offsetof(Entity, _parent) == 0x3bc); -LAYOUT32(offsetof(Entity, _child) == 0x3c0); -LAYOUT32(offsetof(Entity, _target) == 0x3c4); -LAYOUT32(offsetof(Entity, _spawnerEntity) == 0x3c8); -LAYOUT32(offsetof(Entity, _entityPtrReferrers) == 0x3cc); -LAYOUT32(offsetof(Entity, _minecart) == 0x3d4); -LAYOUT32(offsetof(Entity, _hitEffect) == 0x3d8); -LAYOUT32(offsetof(Entity, _dropRNG) == 0x3dc); -LAYOUT32(offsetof(Entity, _initSeed) == 0x3ec); -LAYOUT32(offsetof(Entity, _holdCountdown) == 0x3f0); -LAYOUT32(offsetof(Entity, _holdPosition) == 0x3f4); -LAYOUT32(offsetof(Entity, _pitfallState) == 0x3fc); -LAYOUT32(offsetof(Entity, _pitfallTimer) == 0x400); -LAYOUT32(offsetof(Entity, _scoreMultiplier) == 0x404); -LAYOUT32(offsetof(Entity, _luaBridgeRef) == 0x408); -LAYOUT32(sizeof(Entity) == 0x410); - -struct NPCAI_Pathfinder { - void ResetMovementTarget(); // 007e6fa0 - uint8_t HasPathToPos(Vector *position, uint8_t isIgnorePoop); // 007e7070 - void SimulatePlayerMovement(float *param_2); // 007e8010 - - Entity* _entity; - Vector _movementTarget; - Vector _moveDirection; - int _direction; - uint8_t _pad_0x18[0x8]; - int _gridIndex; - uint8_t _pad_0x24[0x4]; - int _moveCountdown; - uint8_t _pad_0x2c[0x700]; - bool _hasDirectPath; - uint8_t _pad_0x72d[0x3]; - Vector _gridPathTarget; - bool _canCrushRocks; - uint8_t _pad_0x739[0x3]; - int _evadeMovementCountdown; - uint8_t _pad_0x740[0x4]; - float _evadeDistance; -}; -LAYOUT32(offsetof(NPCAI_Pathfinder, _entity) == 0x0); -LAYOUT32(offsetof(NPCAI_Pathfinder, _movementTarget) == 0x4); -LAYOUT32(offsetof(NPCAI_Pathfinder, _moveDirection) == 0xc); -LAYOUT32(offsetof(NPCAI_Pathfinder, _direction) == 0x14); -LAYOUT32(offsetof(NPCAI_Pathfinder, _gridIndex) == 0x20); -LAYOUT32(offsetof(NPCAI_Pathfinder, _moveCountdown) == 0x28); -LAYOUT32(offsetof(NPCAI_Pathfinder, _hasDirectPath) == 0x72c); -LAYOUT32(offsetof(NPCAI_Pathfinder, _gridPathTarget) == 0x730); -LAYOUT32(offsetof(NPCAI_Pathfinder, _canCrushRocks) == 0x738); -LAYOUT32(offsetof(NPCAI_Pathfinder, _evadeMovementCountdown) == 0x73c); -LAYOUT32(offsetof(NPCAI_Pathfinder, _evadeDistance) == 0x744); - -struct Entity_Familiar : Entity { - struct ExtraData; - virtual ~Entity_Familiar(); // 0060d3d0 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 0060de70 slot 1 - void Update() override; // 0061da10 slot 3 - void Interpolate() override; // 00624a80 slot 4 - void Render(Vector *offset) override; // 00624e10 slot 5 - uint8_t RenderShadowLayer(Vector *offset) override; // 00624dd0 slot 6 - uint8_t TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) override; // 0062cdc0 slot 8 - void Kill(EntityRef *source) override; // 00610540 slot 9 - void Remove() override; // 00610470 slot 10 - void guard_check_icall() override; // 00651890 slot 11 - void vfunc_12() override; // 006518c0 slot 12 ::FUN_006518c0 - void ClearReferences() override; // 006121d0 slot 17 - uint8_t CanShutDoors() override; // 0060dab0 slot 18 - uint8_t TryThrow() override; // 0063c0a0 slot 21 - void HandleCollision() override; // 006261f0 slot 23 - void ai_umbilical_baby(uint8_t isInterpolated); // 00431be0 - static void set_extra_data(void *extraDataPtr, void *extraData); // 004357e0 - void * Player(); // 004361f0 - void WispInit(); // 00436330 - uint32_t wisp_kill(); // 00436fd0 - Entity_Tear * fire_wisp_projectile(Vector velocity); // 004386f0 - uint32_t wisp_take_damage(float *param_2, uint32_t *param_3, int *param_4); // 0043a5e0 - void ai_wisp(); // 0043aa90 - void ai_mr_me_wisp(); // 0043db20 - void ai_mega_blast_wisp(); // 0043e4a0 - static int GetRandomWisp(RNG *rng); // 0043eb10 - int Coins(); // 00505cf0 - void ai_buddy_inbox(); // 005ae490 - int Hearts(); // 0060d0e0 - int Keys(); // 0060d100 - KColor * GetPlayerSlot(KColor *outColor, Entity_Player *player); // 0060d180 - void Constructor(); // 0060d200 - uint8_t CanBeDamagedByEnemy(); // 0060d8c0 - uint8_t CanBlockProjectiles(); // 0060d8e0 - float apply_tear_modifiers(); // 0060dc40 - void set_locust_config_index(int param_2); // 0060ddd0 - Entity * get_orbit_parent(); // 00612330 - int RecalculateOrbitOffset(int layer, uint8_t isAdd); // 00612440 - void AddToOrbit(int orbitLayer); // 006127b0 - void RemoveFromOrbit(); // 00612820 - static Vector * GetOrbitDistance(Vector *outDistance, int layer); // 00612850 - uint8_t is_detached_from_follow(); // 00612890 - int GetFollowerPriority(); // 00612970 - uint8_t IsLilithBirthrightIncubus(); // 00612af0 - Entity * get_incubus_umbilical_whip(); // 00612b50 - void FollowParent(); // 00612bb0 - void FollowPosition(Vector *position); // 00613910 - Vector * GetOrbitPosition(Vector *outPosition, Vector *offset); // 006139b0 - Entity_Laser * fire_robo_baby_laser(Vector *direction); // 00613c20 - void PlayFloatAnim(int direction); // 00613df0 - void AddToDelayed(); // 00613fe0 - void RemoveFromDelayed(); // 006141e0 - void PlayChargeAnim(int direction); // 006142e0 - void PlayShootAnim(int direction); // 00614500 - void Shoot(); // 00614b10 - void ai_blue_fly(); // 00615d80 - void ai_walker(); // 00616db0 - void ai_charger(); // 006174c0 - void ai_auto_shooter(); // 00619270 - void ai_blue_babys_only_friend(); // 0061a240 - void ai_pickup_sack(); // 0061a4e0 - void ai_flying_bird(); // 0061b8c0 - void ai_daddy_longlegs(); // 0061bd50 - void ai_orbital_variant_50(); // 0061c150 - void ai_key_full(); // 0061d6b0 - uint8_t CanPlayerFire(); // 0062a8f0 - void AddCoins(int count); // 0062a930 - void AddHearts(int param_2); // 0062aaa0 - void TriggerRoomClear(); // 0062aab0 - void level_start(); // 0062b360 - void room_enter(); // 0062bb70 - void farting_baby_fart(); // 0062c8d0 - void mongo_baby_pick_next_mimic(); // 0062d290 - void RemoveFromFollowers(); // 0062d7e0 - void AddToFollowers(); // 0062db20 - void set_player(Entity_Player *player); // 0062e020 - void ai_samsons_chains(); // 0062e120 - void update_weapon(uint8_t isInterpolated); // 0062e620 - void ai_lil_gurdy(); // 0062ee30 - void AddKeys(int param_2); // 00630440 - void store_backup(void *backup); // 00630450 - void MoveDelayed(int numFrames); // 00631050 - void MoveDiagonally(float speed); // 006312f0 - void move_to_parent_offset(); // 00631850 - void delirium_morph(); // 00631b20 - void init_lil_harbinger_sprite(); // 006322f0 - void render_charge_indicator(Vector *renderPos); // 006324d0 - void ai_lil_monstro(); // 00632820 - void ai_variant_111(); // 00632d90 - void update_angry_fly(); // 00633500 - uint8_t TryFireTear(Entity_Tear *tear); // 00634000 - uint8_t apply_baby_bender(Entity_Tear *tear); // 006341a0 - Vector * UpdateFollowPosition(Vector *outOffset); // 00634260 - void reset_follow_target(); // 006348d0 - void ResolveOrbitConflict(); // 00634a40 - void ai_lil_spewer(); // 00634b10 - void ai_lil_harbingers(); // 006378c0 - Entity_Laser * FireBrimstone(Vector *AimDirection, uint8_t Unk); // 00638c10 - static Entity * ThrowDip(int subType, Vector *position, Entity *spawner); // 00639000 - Entity_Tear * FireProjectile(Vector *AimDirection, uint8_t Unk); // 00639750 - Entity_Laser * sprinkler_shoot_laser(float angle, float distance); // 0063aef0 - void update_idle_anim_by_size(); // 0063b340 - void RemoveFromPlayer(uint8_t UnusedRemoveFamiliar); // 0063b8b0 - void ai_minisaac(); // 0063c1c0 - void minisaac_fire(); // 0063ce20 - static void minisaac_find_target(); // 0063dd60 - void ai_blood_oath(); // 0063f9f0 - void paschal_candle_sync_effects(); // 006402f0 - void ai_boiled_baby(); // 00640ca0 - void zhl_misfit_006414c0(); // 006414c0 - void ai_bird_cage(); // 006424d0 - void ai_bot_fly(); // 006431d0 - void ai_stitches(); // 006437a0 - Entity * aim_reflected_projectile(); // 006444d0 - void ai_shadow_intruder_damocles(uint8_t isInterpolating); // 00644e80 - void * get_item_config_entry(); // 006470c0 - uint8_t abyss_locust_eat(); // 00647170 - uint8_t break_grid_ahead(); // 0064a2d0 - void load_config_graphics(); // 0064a830 - void render_abyss_locust_sprite(ANM2 *param_2, float *param_3); // 0064b6c0 - void siren_charm(Entity *siren, Entity_Player *player); // 0064b920 - void RemoveFromPlayer(); // 0064bab0 - void UpdateDirtColor(uint8_t Immediate); // 0064ca30 - void update_star_of_bethlehem_speed(uint8_t isForce); // 0064d1d0 - void ai_blood_clot(uint8_t isPostMove); // 0064e0c0 - void predict_player_movement(); // 00650220 - static uint8_t multidimensional_baby_copy_knife(Entity_Knife *knife, Entity *unused); // 009615e0 - - Entity_Player* _player; - Entity_Player* _sirenOriginalPlayer; - uint8_t _pad_0x418[0x1e0]; - int _moveDelayNum; - NPCAI_Pathfinder _pathfinder; - uint8_t _pad_0xd44[0x8]; - int _fireCooldown; - int _headFrameDelay; - int _moveDirection; - int _shootDirection; - int _lastDirection; - float _orbitAngleOffset; - Vector _orbitDistance; - float _orbitSpeed; - int _orbitLayer; - bool _isFollower; - bool _isDelayed; - bool _isNotCountedAsFollower; - bool _isSubtype55555; - bool _isHourglassRewound; - uint8_t _pad_0xd79[0x3]; - int _coins; - int _hearts; - int _keys; - int _state; - int _roomClearCount; - Vector _formationOffset; - Vector _formationTargetOffset; - float _formationAngle; - uint8_t _formationMode; - uint8_t _pad_0xda5[0x3]; - int _counter; - std_vector _hitList; - int _appearTimer; - int _chargeLevel; - uint8_t _linkedEntity[0x4]; // EntityPtr - Weapon* _weapon; - bool _isLilDelirium; - uint8_t _pad_0xdc9[0x3]; - uint8_t _chargeBarSprite[0x114]; // ANM2 - void* _extraData; - uint8_t _pad_0xee4[0x4]; - ItemConfig_Item* _item; - uint8_t _sirenHelper[0x4]; // EntityPtr - int _sirenCharmFrames; - ColorMod _dirtColor; - int _wispCollectibleType; - uint8_t _pad_0xf24[0x24]; -}; -LAYOUT32(offsetof(Entity_Familiar, _player) == 0x410); -LAYOUT32(offsetof(Entity_Familiar, _sirenOriginalPlayer) == 0x414); -LAYOUT32(offsetof(Entity_Familiar, _moveDelayNum) == 0x5f8); -LAYOUT32(offsetof(Entity_Familiar, _pathfinder) == 0x5fc); -LAYOUT32(offsetof(Entity_Familiar, _fireCooldown) == 0xd4c); -LAYOUT32(offsetof(Entity_Familiar, _headFrameDelay) == 0xd50); -LAYOUT32(offsetof(Entity_Familiar, _moveDirection) == 0xd54); -LAYOUT32(offsetof(Entity_Familiar, _shootDirection) == 0xd58); -LAYOUT32(offsetof(Entity_Familiar, _lastDirection) == 0xd5c); -LAYOUT32(offsetof(Entity_Familiar, _orbitAngleOffset) == 0xd60); -LAYOUT32(offsetof(Entity_Familiar, _orbitDistance) == 0xd64); -LAYOUT32(offsetof(Entity_Familiar, _orbitSpeed) == 0xd6c); -LAYOUT32(offsetof(Entity_Familiar, _orbitLayer) == 0xd70); -LAYOUT32(offsetof(Entity_Familiar, _isFollower) == 0xd74); -LAYOUT32(offsetof(Entity_Familiar, _isDelayed) == 0xd75); -LAYOUT32(offsetof(Entity_Familiar, _isNotCountedAsFollower) == 0xd76); -LAYOUT32(offsetof(Entity_Familiar, _isSubtype55555) == 0xd77); -LAYOUT32(offsetof(Entity_Familiar, _isHourglassRewound) == 0xd78); -LAYOUT32(offsetof(Entity_Familiar, _coins) == 0xd7c); -LAYOUT32(offsetof(Entity_Familiar, _hearts) == 0xd80); -LAYOUT32(offsetof(Entity_Familiar, _keys) == 0xd84); -LAYOUT32(offsetof(Entity_Familiar, _state) == 0xd88); -LAYOUT32(offsetof(Entity_Familiar, _roomClearCount) == 0xd8c); -LAYOUT32(offsetof(Entity_Familiar, _formationOffset) == 0xd90); -LAYOUT32(offsetof(Entity_Familiar, _formationTargetOffset) == 0xd98); -LAYOUT32(offsetof(Entity_Familiar, _formationAngle) == 0xda0); -LAYOUT32(offsetof(Entity_Familiar, _formationMode) == 0xda4); -LAYOUT32(offsetof(Entity_Familiar, _counter) == 0xda8); -LAYOUT32(offsetof(Entity_Familiar, _hitList) == 0xdac); -LAYOUT32(offsetof(Entity_Familiar, _appearTimer) == 0xdb8); -LAYOUT32(offsetof(Entity_Familiar, _chargeLevel) == 0xdbc); -LAYOUT32(offsetof(Entity_Familiar, _linkedEntity) == 0xdc0); -LAYOUT32(offsetof(Entity_Familiar, _weapon) == 0xdc4); -LAYOUT32(offsetof(Entity_Familiar, _isLilDelirium) == 0xdc8); -LAYOUT32(offsetof(Entity_Familiar, _chargeBarSprite) == 0xdcc); -LAYOUT32(offsetof(Entity_Familiar, _extraData) == 0xee0); -LAYOUT32(offsetof(Entity_Familiar, _item) == 0xee8); -LAYOUT32(offsetof(Entity_Familiar, _sirenHelper) == 0xeec); -LAYOUT32(offsetof(Entity_Familiar, _sirenCharmFrames) == 0xef0); -LAYOUT32(offsetof(Entity_Familiar, _dirtColor) == 0xef4); -LAYOUT32(offsetof(Entity_Familiar, _wispCollectibleType) == 0xf20); -LAYOUT32(sizeof(Entity_Familiar) == 0xf48); - -struct Entity_Familiar::ExtraData { - virtual ~ExtraData(); // 00431710 slot 0 msvc::_Facet_base::_scalar_deleting_destructor_ -}; -LAYOUT32(sizeof(Entity_Familiar::ExtraData) == 0x4); - -struct AbyssLocustData : Entity_Familiar::ExtraData { +struct AbyssLocustData { virtual ~AbyssLocustData(); // 0060d5e0 slot 0 ::FUN_0060d5e0 uint8_t _pad_0x4[0x54]; @@ -1667,30 +874,21 @@ LAYOUT32(offsetof(AchievementOverlay_Entry, _id) == 0x0); LAYOUT32(offsetof(AchievementOverlay_Entry, _name) == 0x4); LAYOUT32(offsetof(AchievementOverlay_Entry, _gfx) == 0x1c); -struct ActiveItemDesc { - int _item; - int _unk; - int _charge; - int _batteryCharge; - int _subCharge; - int _timeRechargeCooldown; - int _partialCharge; - int _varData; -}; -LAYOUT32(offsetof(ActiveItemDesc, _item) == 0x0); -LAYOUT32(offsetof(ActiveItemDesc, _unk) == 0x4); -LAYOUT32(offsetof(ActiveItemDesc, _charge) == 0x8); -LAYOUT32(offsetof(ActiveItemDesc, _batteryCharge) == 0xc); -LAYOUT32(offsetof(ActiveItemDesc, _subCharge) == 0x10); -LAYOUT32(offsetof(ActiveItemDesc, _timeRechargeCooldown) == 0x14); -LAYOUT32(offsetof(ActiveItemDesc, _partialCharge) == 0x18); -LAYOUT32(offsetof(ActiveItemDesc, _varData) == 0x1c); - struct AfterbirthPersistentGameData { uint8_t check_header(void *stream); // 0041d670 }; +struct std_vector { + void * _begin; + void * _end; + void * _capacity; +}; +LAYOUT32(offsetof(std_vector, _begin) == 0x0); +LAYOUT32(offsetof(std_vector, _end) == 0x4); +LAYOUT32(offsetof(std_vector, _capacity) == 0x8); +LAYOUT32(sizeof(std_vector) == 0xc); + struct Ambush { void shuffle_waves(); // 008332e0 void StartChallenge(); // 00833420 @@ -1711,94 +909,10 @@ LAYOUT32(offsetof(Ambush, _maxWaves) == 0x18); LAYOUT32(offsetof(Ambush, _isActive) == 0x20); LAYOUT32(offsetof(Ambush, _currentWave) == 0x24); -struct std_set { - void * _head; - uint32_t _size; -}; -LAYOUT32(offsetof(std_set, _head) == 0x0); -LAYOUT32(offsetof(std_set, _size) == 0x4); -LAYOUT32(sizeof(std_set) == 0x8); - -struct RoomDescriptor { - uint8_t Clear(); // 00436010 - uint32_t PressurePlatesTriggered(); // 00456560 - uint32_t HasWater(); // 00505c30 - uint32_t SacrificeDone(); // 005cd640 - RoomConfig_Room * constructor(); // 006ef590 - void destructor(); // 006ef9c0 - uint32_t ChallengeDone(); // 0070c550 - uint32_t SurpriseMiniboss(); // 00738180 - RoomDescriptor * operator_assign(RoomDescriptor *other); // 007387d0 - RoomDescriptor * copy_constructor(RoomDescriptor *other); // 00749040 - RoomDescriptor * move_constructor(RoomDescriptor *other); // 00752e80 - uint32_t NoReward(); // 007e9190 - RoomDescriptor * Init(uint32_t seed); // 009adaf0 - - int32_t GridIndex; - int32_t SafeGridIndex; - int32_t ListIndex; - int32_t Dimension; - RoomConfig_Room* Data; - RoomConfig_Room* OverrideData; - int32_t AllowedDoors; - int _doors[8]; - int32_t DisplayFlags; - int32_t VisitedCount; - int32_t Flags; - int16_t TotalMoneySpent; - int16_t ClearCount; - int32_t GreedSubType; - int16_t PoopCount; - int16_t TKeeperCoinSpawns; - int32_t PitsCount; - int32_t DecorationSeed; - int32_t SpawnSeed; - int32_t AwardSeed; - uint32_t BossDeathSeed; - std_vector SavedGridEntities; - std_vector SavedEntities; - std_set RestrictedGridIndexes; - std_vector SavedEffects; - uint8_t _pad_0x94[0x18]; - int16_t ShopItemIdx; - int16_t ShopItemDiscountIdx; - int32_t DeliriumDistance; - int32_t Group; -}; -LAYOUT32(offsetof(RoomDescriptor, GridIndex) == 0x0); -LAYOUT32(offsetof(RoomDescriptor, SafeGridIndex) == 0x4); -LAYOUT32(offsetof(RoomDescriptor, ListIndex) == 0x8); -LAYOUT32(offsetof(RoomDescriptor, Dimension) == 0xc); -LAYOUT32(offsetof(RoomDescriptor, Data) == 0x10); -LAYOUT32(offsetof(RoomDescriptor, OverrideData) == 0x14); -LAYOUT32(offsetof(RoomDescriptor, AllowedDoors) == 0x18); -LAYOUT32(offsetof(RoomDescriptor, _doors) == 0x1c); -LAYOUT32(offsetof(RoomDescriptor, DisplayFlags) == 0x3c); -LAYOUT32(offsetof(RoomDescriptor, VisitedCount) == 0x40); -LAYOUT32(offsetof(RoomDescriptor, Flags) == 0x44); -LAYOUT32(offsetof(RoomDescriptor, TotalMoneySpent) == 0x48); -LAYOUT32(offsetof(RoomDescriptor, ClearCount) == 0x4a); -LAYOUT32(offsetof(RoomDescriptor, GreedSubType) == 0x4c); -LAYOUT32(offsetof(RoomDescriptor, PoopCount) == 0x50); -LAYOUT32(offsetof(RoomDescriptor, TKeeperCoinSpawns) == 0x52); -LAYOUT32(offsetof(RoomDescriptor, PitsCount) == 0x54); -LAYOUT32(offsetof(RoomDescriptor, DecorationSeed) == 0x58); -LAYOUT32(offsetof(RoomDescriptor, SpawnSeed) == 0x5c); -LAYOUT32(offsetof(RoomDescriptor, AwardSeed) == 0x60); -LAYOUT32(offsetof(RoomDescriptor, BossDeathSeed) == 0x64); -LAYOUT32(offsetof(RoomDescriptor, SavedGridEntities) == 0x68); -LAYOUT32(offsetof(RoomDescriptor, SavedEntities) == 0x74); -LAYOUT32(offsetof(RoomDescriptor, RestrictedGridIndexes) == 0x80); -LAYOUT32(offsetof(RoomDescriptor, SavedEffects) == 0x88); -LAYOUT32(offsetof(RoomDescriptor, ShopItemIdx) == 0xac); -LAYOUT32(offsetof(RoomDescriptor, ShopItemDiscountIdx) == 0xae); -LAYOUT32(offsetof(RoomDescriptor, DeliriumDistance) == 0xb0); -LAYOUT32(offsetof(RoomDescriptor, Group) == 0xb4); - struct BackwardsStageDesc { - RoomDescriptor _bossRooms[2]; + uint8_t _bossRooms[0x170]; // RoomDescriptor[2] uint8_t _bossRoomConfigs[0x18]; // GameStateRoomConfig[2] - RoomDescriptor _treasureRooms[2]; + uint8_t _treasureRooms[0x170]; // RoomDescriptor[2] uint8_t _treasureRoomConfigs[0x18]; // GameStateRoomConfig[2] uint32_t _bossRoomsCount; uint32_t _treasureRoomsCount; @@ -1872,28 +986,6 @@ struct BossOverlay { }; LAYOUT32(offsetof(BossOverlay, _state) == 0x0); -struct std_vector_bool { - void * _begin; - void * _end; - void * _capacity; - uint32_t _size; -}; -LAYOUT32(offsetof(std_vector_bool, _begin) == 0x0); -LAYOUT32(offsetof(std_vector_bool, _end) == 0x4); -LAYOUT32(offsetof(std_vector_bool, _capacity) == 0x8); -LAYOUT32(offsetof(std_vector_bool, _size) == 0xc); -LAYOUT32(sizeof(std_vector_bool) == 0x10); - -struct BossPool { - void init(uint32_t seed); // 004218e0 - static void load_xml(uint8_t *param_1, int param_2); // 00421bf0 - int GetBossId(int leveltype, int levelvariant, RNG *rng); // 00422830 - - uint8_t _pad_0x0[0x8ac]; - uint8_t _removedBosses[0x4]; // std_vector_bool -}; -LAYOUT32(offsetof(BossPool, _removedBosses) == 0x8ac); - struct BufferedStream { }; @@ -1907,52 +999,6 @@ LAYOUT32(offsetof(CLIENT_ID, UniqueProcess) == 0x0); LAYOUT32(offsetof(CLIENT_ID, UniqueThread) == 0x4); LAYOUT32(sizeof(CLIENT_ID) == 0x8); -struct Camera { - void UpdateUltrasmooth(uint32_t *param_2, int *param_3); // 0091e980 - void constructor(Room *room); // 009428d0 - Vector * get_enemy_focus_offset(Vector *outOffset); // 00942f20 - void get_clamp_bounds(Vector *outMax, Vector *outMin); // 009432f0 - Vector * ClampedToRoom(Vector *outPosition, Vector position); // 00943490 - Vector * soft_clamp_position(Vector *outPosition, float x, float y); // 00943610 - void DoUpdate(uint8_t unk); // 009437e0 - void update_focus_position(uint8_t isSkipFocusBuffer); // 009439d0 - void update_follow(); // 009446e0 - uint8_t IsPosVisible(Vector *Pos); // 00944a40 - void SetFocusPosition(Vector *pos); // 00944d10 - void SnapToPosition(Vector *pos); // 00944d40 - void Update(uint8_t isSnap); // 00993a70 - - uint8_t _aimOffsetBuffer[16]; - uint8_t _velocityOffsetBuffer[16]; - uint8_t _enemyOffsetBuffer[16]; - uint8_t _playerSpreadBuffer[16]; - uint8_t _shakeOffsetBuffer[16]; - uint8_t _focusPositionBuffer[16]; - Vector _playersCenter; - Room* _room; - Vector _position; - Vector _screenAnchor; - Vector _unk7c; - Vector _unk84; - bool _shouldOverride; - uint8_t _pad_0x8d[0x3]; - float _followLerp; -}; -LAYOUT32(offsetof(Camera, _aimOffsetBuffer) == 0x0); -LAYOUT32(offsetof(Camera, _velocityOffsetBuffer) == 0x10); -LAYOUT32(offsetof(Camera, _enemyOffsetBuffer) == 0x20); -LAYOUT32(offsetof(Camera, _playerSpreadBuffer) == 0x30); -LAYOUT32(offsetof(Camera, _shakeOffsetBuffer) == 0x40); -LAYOUT32(offsetof(Camera, _focusPositionBuffer) == 0x50); -LAYOUT32(offsetof(Camera, _playersCenter) == 0x60); -LAYOUT32(offsetof(Camera, _room) == 0x68); -LAYOUT32(offsetof(Camera, _position) == 0x6c); -LAYOUT32(offsetof(Camera, _screenAnchor) == 0x74); -LAYOUT32(offsetof(Camera, _unk7c) == 0x7c); -LAYOUT32(offsetof(Camera, _unk84) == 0x84); -LAYOUT32(offsetof(Camera, _shouldOverride) == 0x8c); -LAYOUT32(offsetof(Camera, _followLerp) == 0x90); - struct Capsule { void constructor(Vector *position, Vector *multiplier, float rotation, float size); // 00945190 void constructor2(Vector *Position, Vector *TargetPosition, float size); // 009452e0 @@ -1968,14 +1014,6 @@ struct Card { }; -struct CellSpace { - void insert(Entity *entity); // 0041bb50 - void collide_entity(Entity *entity); // 0041bdf0 - void collide(void *entityB); // 0041c070 - void collide_self(); // 0041c2a0 -}; - - struct ChallengeParams { ChallengeParams(); // 00424310 static void operator_assign_move(char *param_1); // 009584b0 @@ -2018,6 +1056,16 @@ LAYOUT32(offsetof(Color, _colorize) == 0x10); LAYOUT32(offsetof(Color, _offset) == 0x20); LAYOUT32(sizeof(Color) == 0x2c); +struct ColorMod { + float _tint[4]; + float _colorize[4]; + float _offset[3]; +}; +LAYOUT32(offsetof(ColorMod, _tint) == 0x0); +LAYOUT32(offsetof(ColorMod, _colorize) == 0x10); +LAYOUT32(offsetof(ColorMod, _offset) == 0x20); +LAYOUT32(sizeof(ColorMod) == 0x2c); + struct ColorModState { void move_toward(float *target, float *step); // 006ef410 @@ -2035,21 +1083,6 @@ LAYOUT32(offsetof(ColorModState, _amount) == 0xc); LAYOUT32(offsetof(ColorModState, _brightness) == 0x10); LAYOUT32(offsetof(ColorModState, _contrast) == 0x14); -struct ColorParams { - int _priority; - uint8_t _pad_0x4[0x2c]; - int _duration1; - int _duration2; - uint8_t _fadeout; - uint8_t _shared; -}; -LAYOUT32(offsetof(ColorParams, _priority) == 0x0); -LAYOUT32(offsetof(ColorParams, _duration1) == 0x30); -LAYOUT32(offsetof(ColorParams, _duration2) == 0x34); -LAYOUT32(offsetof(ColorParams, _fadeout) == 0x38); -LAYOUT32(offsetof(ColorParams, _shared) == 0x39); -LAYOUT32(sizeof(ColorParams) == 0x3a); - struct ColorQuad { ColorQuad(KColor *color); // 00a10c00 ColorQuad() = default; @@ -2077,40 +1110,6 @@ struct ConstLobby { }; -struct ConsumableData { - int coins; - int keys; - int bombs; - uint8_t goldkey; - uint8_t goldbomb; - uint8_t _pad_0xe[0x2]; - int soulcharges; - int gigabombs; - int poopmana; - int bloodcharges; -}; -LAYOUT32(offsetof(ConsumableData, coins) == 0x0); -LAYOUT32(offsetof(ConsumableData, keys) == 0x4); -LAYOUT32(offsetof(ConsumableData, bombs) == 0x8); -LAYOUT32(offsetof(ConsumableData, goldkey) == 0xc); -LAYOUT32(offsetof(ConsumableData, goldbomb) == 0xd); -LAYOUT32(offsetof(ConsumableData, soulcharges) == 0x10); -LAYOUT32(offsetof(ConsumableData, gigabombs) == 0x14); -LAYOUT32(offsetof(ConsumableData, poopmana) == 0x18); -LAYOUT32(offsetof(ConsumableData, bloodcharges) == 0x1c); -LAYOUT32(sizeof(ConsumableData) == 0x20); - -struct CostumeSpriteDesc { - uint8_t _pad_0x0[0x114]; - ItemConfig_Item* _item; - int _priority; - uint8_t _pad_0x11c[0x10]; - int _playerType; -}; -LAYOUT32(offsetof(CostumeSpriteDesc, _item) == 0x114); -LAYOUT32(offsetof(CostumeSpriteDesc, _priority) == 0x118); -LAYOUT32(offsetof(CostumeSpriteDesc, _playerType) == 0x12c); - struct DailyChallenge { void Init(uint32_t dailyDate); // 00426a50 @@ -2276,6 +1275,50 @@ struct DebugRenderer { }; +struct Vector { + static Vector * operator_mul(Vector *outResult, float *scalar, Vector *vector); // 004171d0 + static Vector * ToCardinal(Vector *outResult, Vector *vec); // 0067f170 + static Vector * mul_065(Vector *outResult, Vector *source); // 0067f2b0 + Vector * operator_assign(Vector *other); // 007dd3b0 + static uint8_t * __tostring(); // 0085e630 + Vector(float x, float y); // 00a0fe90 + float Length(); // 00a0fea0 + float LengthSquared(); // 00a0fed0 + float Distance(Vector *other); // 00a0ff30 + float DistanceSquared(Vector *other); // 00a0ff90 + void Normalize(); // 00a0ffc0 + Vector * Normalized(Vector *outResult); // 00a10030 + void Resize(float length); // 00a100b0 + Vector * Resized(Vector *outVec, float length); // 00a10100 + float Dot(Vector *other); // 00a10180 + float Cross(Vector *other); // 00a101a0 + void Lerp(Vector *target, float t, uint8_t isClamped); // 00a10210 + void Rotate(float angleDegrees); // 00a10270 + Vector * Rotated(Vector *outVec, float angleDegrees); // 00a102e0 + static Vector * FromAngle(Vector *outVec, float angleDegrees); // 00a10350 + float GetAngleDegrees(); // 00a10390 + void Clamp(float minX, float minY, float maxX, float maxY); // 00a103c0 + Vector * Clamped(Vector *outResult, float minX, float minY, float maxX, float maxY); // 00a103f0 + Vector * __add(Vector *outVec, Vector *other); // 00a10420 + Vector * operator_add_assign(Vector *other); // 00a10450 + Vector * __sub(Vector *outResult, Vector *other); // 00a10480 + Vector * operator__(Vector *other); // 00a104b0 + Vector * __mul(Vector *outResult, float *scalar); // 00a104e0 + Vector * Mul(Vector *outResult, Vector *other); // 00a10510 + Vector * operator_mul_assign(float *scalar); // 00a10540 + Vector * __div(Vector *outResult, float *divisor); // 00a105a0 + Vector * __div_assign(float *divisor); // 00a105d0 + uint8_t operator_eq(Vector *other); // 00a10600 + uint8_t operator_ne(Vector *other); // 00a10630 + Vector * __unm(Vector *outResult); // 00a10660 + Vector() = default; + + float x; + float y; +}; +LAYOUT32(offsetof(Vector, x) == 0x0); +LAYOUT32(offsetof(Vector, y) == 0x4); + struct DestinationQuad { Vector _topLeft; Vector _topRight; @@ -2288,77 +1331,12 @@ LAYOUT32(offsetof(DestinationQuad, _bottomLeft) == 0x10); LAYOUT32(offsetof(DestinationQuad, _bottomRight) == 0x18); LAYOUT32(sizeof(DestinationQuad) == 0x20); -struct EntityDesc { - uint32_t _type; - uint32_t _variant; - uint32_t _subtype; - int _championId; - float _health; - float _maxHealth; - bool _playerControlled; -}; -LAYOUT32(offsetof(EntityDesc, _type) == 0x0); -LAYOUT32(offsetof(EntityDesc, _variant) == 0x4); -LAYOUT32(offsetof(EntityDesc, _subtype) == 0x8); -LAYOUT32(offsetof(EntityDesc, _championId) == 0xc); -LAYOUT32(offsetof(EntityDesc, _health) == 0x10); -LAYOUT32(offsetof(EntityDesc, _maxHealth) == 0x14); -LAYOUT32(offsetof(EntityDesc, _playerControlled) == 0x18); - struct EntityFactory { Entity * Create(uint32_t type, uint8_t force); // 006f0090 void constructor(); // 006f2a10 }; -struct EntityList_EL { - void constructor(EntityList_EL *source); // 00417510 - void push_back(Entity *entity); // 00417630 - void remove(Entity *entity); // 00417670 - - uint8_t _pad_0x0[0x4]; - Entity** _data; - uint32_t _capacity; - uint32_t _size; -}; -LAYOUT32(offsetof(EntityList_EL, _data) == 0x4); -LAYOUT32(offsetof(EntityList_EL, _capacity) == 0x8); -LAYOUT32(offsetof(EntityList_EL, _size) == 0xc); - -struct EntityList { - void sublist_init(EntityList_EL *parent, int capacity); // 00417540 - int Size(); // 004176f0 - void Reset(); // 00418230 - void AddEntity(Entity *entity); // 00418500 - void Update(uint8_t isTransition); // 004186c0 - void sort_by_render_z(); // 00419750 - void render_up_to(uint32_t maxDepth, Vector *offset); // 004199d0 - void rebuild_sublists(); // 00419e70 - void AddPersistentEntity(Entity *entity); // 0041b4f0 - void invalidate_type_cache(int type, int variant, int subType); // 0041b570 - int CountEntities(Entity *spawner, int type, int variant, int subType); // 0041b7b0 - uint8_t HitListContains(Entity *entity); // 00431640 - EntityList_EL * assign(EntityList_EL *dest, EntityList_EL *source); // 006b8320 - Entity * Get(uint32_t index); // 0085e0c0 - - uint8_t _pad_0x0[0x20]; - EntityList_EL _mainEL; - EntityList_EL _persistentEL; - EntityList_EL _updateEL; - EntityList_EL _renderEL; - uint8_t _pad_0x60[0x30]; - EntityList_EL _wispEL; - uint32_t _renderCursor; - int _renderMode; -}; -LAYOUT32(offsetof(EntityList, _mainEL) == 0x20); -LAYOUT32(offsetof(EntityList, _persistentEL) == 0x30); -LAYOUT32(offsetof(EntityList, _updateEL) == 0x40); -LAYOUT32(offsetof(EntityList, _renderEL) == 0x50); -LAYOUT32(offsetof(EntityList, _wispEL) == 0x90); -LAYOUT32(offsetof(EntityList, _renderCursor) == 0xa0); -LAYOUT32(offsetof(EntityList, _renderMode) == 0xa4); - struct EntityList_Query { ~EntityList_Query(); // 004175b0 }; @@ -2386,2250 +1364,6 @@ struct EntitySpawner { }; -struct Entity_Bomb : Entity { - virtual ~Entity_Bomb(); // 006a1f30 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 006a2050 slot 1 - void Update() override; // 006a24d0 slot 3 - void Render(Vector *offset) override; // 006a5a60 slot 5 - void HandleCollision() override; // 006a5f00 slot 23 - uint8_t IsFetus(); // 004316a0 - void SetExplosionCountdown(int countdown); // 00452c40 - BitSet128 * Flags(BitSet128 *outResult); // 005cd560 - long double RadiusMultiplier(); // 0060cdc0 - uint8_t IsRocket(); // 006a2030 - void update_sparks(); // 006a6f10 - - int _explosionCountdown1; - uint8_t _pad_0x414[0x4]; - float _explosionDamage; - float _fallSpeed; - float _fallAcceleration; - int _bounceCount; - float _rocketAngle; - float _rocketSpeed; - short _collisionCooldown; - short _parentCollisionCooldown; - float _scale; - BitSet128 _tearFlags; - uint8_t _pad_0x444[0x4]; - bool _isFetus; - uint8_t _pad_0x449[0x3]; - float _radiusMultiplier; - uint8_t _stickyTarget[0x4]; // EntityPtr - int _bombIndex; - int _updateDelay; - int _scatterTimer; - bool _prismTouched; - bool _isSkipNextUpdate; - bool _hasCostumes; - bool _loadCostumes; - uint8_t _bombCostumesSprites[0x564]; // ANM2[5] - std_vector _hitList; - uint8_t _pad_0x9d4[0x4]; -}; -LAYOUT32(offsetof(Entity_Bomb, _explosionCountdown1) == 0x410); -LAYOUT32(offsetof(Entity_Bomb, _explosionDamage) == 0x418); -LAYOUT32(offsetof(Entity_Bomb, _fallSpeed) == 0x41c); -LAYOUT32(offsetof(Entity_Bomb, _fallAcceleration) == 0x420); -LAYOUT32(offsetof(Entity_Bomb, _bounceCount) == 0x424); -LAYOUT32(offsetof(Entity_Bomb, _rocketAngle) == 0x428); -LAYOUT32(offsetof(Entity_Bomb, _rocketSpeed) == 0x42c); -LAYOUT32(offsetof(Entity_Bomb, _collisionCooldown) == 0x430); -LAYOUT32(offsetof(Entity_Bomb, _parentCollisionCooldown) == 0x432); -LAYOUT32(offsetof(Entity_Bomb, _scale) == 0x434); -LAYOUT32(offsetof(Entity_Bomb, _tearFlags) == 0x438); -LAYOUT32(offsetof(Entity_Bomb, _isFetus) == 0x448); -LAYOUT32(offsetof(Entity_Bomb, _radiusMultiplier) == 0x44c); -LAYOUT32(offsetof(Entity_Bomb, _stickyTarget) == 0x450); -LAYOUT32(offsetof(Entity_Bomb, _bombIndex) == 0x454); -LAYOUT32(offsetof(Entity_Bomb, _updateDelay) == 0x458); -LAYOUT32(offsetof(Entity_Bomb, _scatterTimer) == 0x45c); -LAYOUT32(offsetof(Entity_Bomb, _prismTouched) == 0x460); -LAYOUT32(offsetof(Entity_Bomb, _isSkipNextUpdate) == 0x461); -LAYOUT32(offsetof(Entity_Bomb, _hasCostumes) == 0x462); -LAYOUT32(offsetof(Entity_Bomb, _loadCostumes) == 0x463); -LAYOUT32(offsetof(Entity_Bomb, _bombCostumesSprites) == 0x464); -LAYOUT32(offsetof(Entity_Bomb, _hitList) == 0x9c8); -LAYOUT32(sizeof(Entity_Bomb) == 0x9d8); - -struct Entity_Dummy : Entity { - virtual ~Entity_Dummy(); // 006a7ee0 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 006a7f20 slot 1 - void Update() override; // 006a7f30 slot 3 - void Render(Vector *offset) override; // 006a7f80 slot 5 - void HandleCollision() override; // 006a80c0 slot 23 GridEntity::Hurt -}; -LAYOUT32(sizeof(Entity_Dummy) == 0x410); - -struct Entity_Effect : Entity { - struct ExtraData; - struct ExtraDataRef; - virtual ~Entity_Effect(); // 005cd9f0 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 005cdb20 slot 1 - void Update() override; // 005d4380 slot 3 - void Interpolate() override; // 005d2520 slot 4 - void Render(Vector *offset) override; // 00607620 slot 5 - void Remove() override; // 005d2420 slot 10 - void guard_check_icall() override; // 0060c370 slot 11 - void ClearReferences() override; // 0060abb0 slot 17 - uint8_t CanShutDoors() override; // 0060c400 slot 18 - void HandleCollision() override; // 005ccc20 slot 23 - void render_player_target(Vector *offset, int segmentMode); // 00435290 - void set_state(int state); // 00435e60 - void SetTimeout(int timeout); // 00435e90 - void set_rotation(float rotation); // 00435eb0 - void SetRadii(float minRadius, float maxRadius); // 00435ef0 - void FollowParent(Entity *parent); // 004564b0 - long double Scale(); // 004d7770 - long double Rotation(); // 005784c0 - static bool rift_attract_filter(int param_1, int param_2); // 005cd950 - void constructor(); // 005cd960 - void update_mr_me(); // 005d2a70 - void update_wave_chain(); // 005d4010 - static void moonlight_timer_callback(int param_1); // 006073f0 - static uint8_t IsPlayerCreep(int variant); // 0060ac20 - static Entity_Effect * CreateTimer(void *fn, uint32_t delay, uint32_t times, uint8_t isPersistent); // 0060af00 - void update_variant178_shooter(uint8_t isPositionOnly); // 0060b0d0 - static Entity_Effect * CreateLootPreview(void *lootlist, Vector *pos, Entity *owner, Entity_Effect *effect); // 0060b7a0 - void setup_loot_preview(void *lootQueue); // 0060bae0 - void SetDamageSource(int param_2); // 0060ce20 - - float _height; - float _fallingSpeed; - float _fallingAcceleration; - uint8_t _pad_0x41c[0x4]; - BitSet128 _varData; - uint8_t _pad_0x42c[0x24]; - int _state; - float _minRadius; - float _maxRadius; - int _timeout; - int _lifespan; - bool _isFollowing; - uint8_t _pad_0x465[0x3]; - Vector _parentOffset; - int _damageSource; - float _rotation; - float _scale; - uint8_t _pad_0x47c[0x2c]; - std_vector _hitList; - uint8_t _pad_0x4b4[0xc]; -}; -LAYOUT32(offsetof(Entity_Effect, _height) == 0x410); -LAYOUT32(offsetof(Entity_Effect, _fallingSpeed) == 0x414); -LAYOUT32(offsetof(Entity_Effect, _fallingAcceleration) == 0x418); -LAYOUT32(offsetof(Entity_Effect, _varData) == 0x420); -LAYOUT32(offsetof(Entity_Effect, _state) == 0x450); -LAYOUT32(offsetof(Entity_Effect, _minRadius) == 0x454); -LAYOUT32(offsetof(Entity_Effect, _maxRadius) == 0x458); -LAYOUT32(offsetof(Entity_Effect, _timeout) == 0x45c); -LAYOUT32(offsetof(Entity_Effect, _lifespan) == 0x460); -LAYOUT32(offsetof(Entity_Effect, _isFollowing) == 0x464); -LAYOUT32(offsetof(Entity_Effect, _parentOffset) == 0x468); -LAYOUT32(offsetof(Entity_Effect, _damageSource) == 0x470); -LAYOUT32(offsetof(Entity_Effect, _rotation) == 0x474); -LAYOUT32(offsetof(Entity_Effect, _scale) == 0x478); -LAYOUT32(offsetof(Entity_Effect, _hitList) == 0x4a8); -LAYOUT32(sizeof(Entity_Effect) == 0x4c0); - -struct Entity_Effect::ExtraData { - virtual ~ExtraData(); // 005cd530 slot 0 msvc::_Facet_base::_scalar_deleting_destructor_ -}; -LAYOUT32(sizeof(Entity_Effect::ExtraData) == 0x4); - -struct Entity_Effect::ExtraDataRef { - void Set(void *extraData); // 0060c620 -}; - - -struct HomingLaser { - HomingLaser * operator_assign(HomingLaser *other); // 0085e000 - HomingLaser(); // 0099c290 - void build_bezier_path(int homingType, Entity *source); // 0099c790 - void compute_axis_bezier_handles(); // 0099dca0 - void compute_bezier_handles(float tension); // 0099e160 - void CalculateSamples(float param_2); // 0099e360 - void apply_sine_offset(float amplitude, float phase); // 0099ec00 - void build_curl_path(float radius); // 0099fa60 - static void build_wiggle_bezier(); // 0099fed0 - uint8_t clip_samples_to_grid(Vector *pos, int gridCollisionClass); // 009a0520 - void truncate_samples_at_player(); // 009a0740 - void truncate_samples_at_obstacle(Vector *positionOffset); // 009a0c50 - void remove_collinear_samples(float tolerance); // 009a0de0 - void apply_sample_wiggle(float amplitude, float phase); // 009a0fa0 - static uint32_t find_targets(float *param_1, float *param_2, int param_3, uint32_t param_4, Entity *param_5); // 009a12b0 - uint8_t truncate_samples(float maxLength); // 009a1520 - - uint8_t _pad_0x0[0x1c]; - std_vector _samples; - std_vector _nonOptimizedSamples; - uint8_t _pad_0x34[0x10]; - float _totalLength; - uint8_t _bezier[0x4]; // std_vector -}; -LAYOUT32(offsetof(HomingLaser, _samples) == 0x1c); -LAYOUT32(offsetof(HomingLaser, _nonOptimizedSamples) == 0x28); -LAYOUT32(offsetof(HomingLaser, _totalLength) == 0x44); -LAYOUT32(offsetof(HomingLaser, _bezier) == 0x48); - -struct Entity_Knife : Entity { - virtual ~Entity_Knife(); // 00960b50 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 00960c10 slot 1 - void Update() override; // 00961b00 slot 3 - void Interpolate() override; // 00967db0 slot 4 - void Render(Vector *offset) override; // 00965d30 slot 5 - int GetRenderZ() override; // 009665e0 slot 13 - void ClearReferences() override; // 009611d0 slot 17 - void HandleCollision() override; // 009666f0 slot 23 - long double Rotation(); // 004d7790 - long double GetKnifeVelocity(); // 004d77a0 - uint8_t IsFlying(); // 0060cf10 - void SetPathFollowSpeed(float param_2); // 0060cfb0 - BitSet128 * TearFlags(BitSet128 *outFlags); // 0085de90 - long double GetKnifeDistance(); // 0085deb0 - long double RotationOffset(); // 0085dec0 - int GetBaseVariant(); // 00960a20 - void Constructor(); // 00960a70 - void * GetHitEntities(); // 009612e0 - void InitHomingPath(Vector direction, Entity *source, float pathOffset); // 00961320 - void copy_parent_state(Entity_Knife *source); // 009614d0 - uint32_t spawn_child_knife(); // 00961870 - Entity_Player * GetPlayer(); // 00966650 - Entity * GetRootParent(); // 009666c0 - void Shoot(float charge, float range); // 00966ef0 - void UpdateHomingPath(); // 00967180 - void update_target(float *outAngle); // 00967650 - void apply_wiggle(float *param_2); // 00967a70 - void screen_wrap(); // 00967d20 - void Reset(); // 00967fc0 - void SetAttackAnimation(); // 009680d0 - void SpinAttack(short remainingSpins, int startFrame); // 00968430 - uint8_t drain_notched_axe(int charge); // 00968660 - void UpdateSwingHits(); // 009688d0 - - BitSet128 _tearFlags; - uint8_t _pad_0x41c[0x4]; - BitSet128 _usedTearFlags; - uint8_t _pad_0x42c[0x4]; - float _scale; - float _knifeDepthOffset; - float _rotation; - float _rotationOffset; - float _displayRotation; - float _knifeDistance; - float _knifeVelocity; - Vector _anchorPosition; - Vector _initPosition; - float _maxDistance; - float _charge; - bool _isFlying; - bool _isSwinging; - uint8_t _pad_0x466[0x1]; - bool _isPrimaryClub; - HomingLaser _homingLaser; - uint8_t _pad_0x4b4[0x8]; - int _pathSegment; - float _pathProgress; - float _pathOffset; - float _pathFollowSpeed; - float _height; - float _fallingSpeed; - float _basePosOffsetY; - std_vector _hitList; - bool _isDeadEyeHit; - bool _prismApplied; - bool _multidimensionalApplied; - bool _isUsingParentHitList; - uint8_t _pad_0x4e8[0x2]; - bool _isSpinAttack; - uint8_t _pad_0x4eb[0x35]; -}; -LAYOUT32(offsetof(Entity_Knife, _tearFlags) == 0x410); -LAYOUT32(offsetof(Entity_Knife, _usedTearFlags) == 0x420); -LAYOUT32(offsetof(Entity_Knife, _scale) == 0x430); -LAYOUT32(offsetof(Entity_Knife, _knifeDepthOffset) == 0x434); -LAYOUT32(offsetof(Entity_Knife, _rotation) == 0x438); -LAYOUT32(offsetof(Entity_Knife, _rotationOffset) == 0x43c); -LAYOUT32(offsetof(Entity_Knife, _displayRotation) == 0x440); -LAYOUT32(offsetof(Entity_Knife, _knifeDistance) == 0x444); -LAYOUT32(offsetof(Entity_Knife, _knifeVelocity) == 0x448); -LAYOUT32(offsetof(Entity_Knife, _anchorPosition) == 0x44c); -LAYOUT32(offsetof(Entity_Knife, _initPosition) == 0x454); -LAYOUT32(offsetof(Entity_Knife, _maxDistance) == 0x45c); -LAYOUT32(offsetof(Entity_Knife, _charge) == 0x460); -LAYOUT32(offsetof(Entity_Knife, _isFlying) == 0x464); -LAYOUT32(offsetof(Entity_Knife, _isSwinging) == 0x465); -LAYOUT32(offsetof(Entity_Knife, _isPrimaryClub) == 0x467); -LAYOUT32(offsetof(Entity_Knife, _homingLaser) == 0x468); -LAYOUT32(offsetof(Entity_Knife, _pathSegment) == 0x4bc); -LAYOUT32(offsetof(Entity_Knife, _pathProgress) == 0x4c0); -LAYOUT32(offsetof(Entity_Knife, _pathOffset) == 0x4c4); -LAYOUT32(offsetof(Entity_Knife, _pathFollowSpeed) == 0x4c8); -LAYOUT32(offsetof(Entity_Knife, _height) == 0x4cc); -LAYOUT32(offsetof(Entity_Knife, _fallingSpeed) == 0x4d0); -LAYOUT32(offsetof(Entity_Knife, _basePosOffsetY) == 0x4d4); -LAYOUT32(offsetof(Entity_Knife, _hitList) == 0x4d8); -LAYOUT32(offsetof(Entity_Knife, _isDeadEyeHit) == 0x4e4); -LAYOUT32(offsetof(Entity_Knife, _prismApplied) == 0x4e5); -LAYOUT32(offsetof(Entity_Knife, _multidimensionalApplied) == 0x4e6); -LAYOUT32(offsetof(Entity_Knife, _isUsingParentHitList) == 0x4e7); -LAYOUT32(offsetof(Entity_Knife, _isSpinAttack) == 0x4ea); -LAYOUT32(sizeof(Entity_Knife) == 0x520); - -struct Entity_Laser : Entity { - virtual ~Entity_Laser(); // 0096ccf0 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 0096f590 slot 1 - void Update() override; // 00977cc0 slot 3 - void Interpolate() override; // 0097e6f0 slot 4 - void Render(Vector *offset) override; // 009785d0 slot 5 - uint8_t RenderShadowLayer(Vector *offset) override; // 0097ca90 slot 6 - void PostRender() override; // 0097eb50 slot 7 - void Remove() override; // 0097ea30 slot 10 - int GetRenderZ() override; // 0096ced0 slot 13 - uint8_t CanOverwrite() override; // 0097e7a0 slot 14 - void ClearReferences() override; // 0097e800 slot 17 - void HandleCollision() override; // 005ccc20 slot 23 Entity_Effect::HandleCollision - void SetTimeout(int param_2); // 00435f20 - void SetMaxDistance(float maxDistance); // 00435f30 - uint8_t IsCircleLaser(); // 00435f50 - void SetHomingType(int param_2); // 00456850 - void set_disable_init_sound(uint8_t param_2); // 004aaed0 - void SetOneHit(uint8_t param_2); // 005cd580 - void SetMultidimensionalTouched(uint8_t param_2); // 005cd590 - long double Radius(); // 0060cea0 - void SetBlackHpDropChance(float param_2); // 0060ceb0 - Vector * GetEndPoint(); // 007e9230 - bool IsSampleLaser(); // 007e9240 - void Constructor(); // 0096cb60 - static void destructor(); // 0096cd20 - uint8_t is_thick_variant(); // 0096ce30 - uint8_t CanDamageEntity(Entity *entity); // 0096cf80 - void impact_tear_flag_effects(Vector *position, Vector *direction); // 0096d3f0 - ColorMod * get_tear_spawn_color(ColorMod *outColor); // 0096ee00 - void copy_from_parent(Entity_Laser *parent, uint8_t isCopySpawnData); // 0096f070 - void RotateToAngle(float angle, float speed); // 0096f470 - void ClearLaserSamples(); // 0096f4e0 - void PlayInitSound(); // 0096f880 - Vector * calc_end_point(Vector *outEndPoint, Vector *start, Vector *direction); // 0096fc70 - void update_first_frame(); // 009704a0 - void find_nearest_grid_hit(int unusedFlag, Vector *offset); // 00970cb0 - uint8_t damage_grid_entity(int gridIndex, int unused, Vector *direction); // 00971590 - void update_line_hits(); // 00971810 - void update_endpoint_and_hits(); // 009737b0 - void refresh_tear_params(); // 00973a50 - void update_laser(); // 00973c60 - void UpdateHits(); // 0097baa0 - void * GetSamples(); // 0097e3b0 - void damage_entity(Entity *param_2); // 0097e3c0 - void * GetNonOptimizedSamples(); // 0097e6e0 - void spawn_impact_effect(int unused); // 0097f820 - void ResetSpriteScale(); // 0097fc10 - void set_scale(float scale); // 0097fe50 - void update_sample_points(char param_2); // 0097fe60 - static void update_wiggle_path(void *samples, float amplitude, float phase); // 0099efc0 - - Vector _parentOffset; - float _startAngleDegrees; - float _angleDegrees; - float _lastAngleDegrees; - uint8_t _pad_0x424[0x4]; - BitSet128 _tearFlags; - uint8_t _pad_0x434[0x4]; - BitSet128 _activeTearFlags; - uint8_t _pad_0x444[0x4]; - BitSet128 _heldTearFlags; - uint8_t _pad_0x454[0x4]; - int _timeout; - bool _isFirstUpdate; - bool _sampleLaser; - bool _shrink; - uint8_t _pad_0x45f[0x1]; - float _laserLength; - HomingLaser _homingLaser; - uint8_t _pad_0x4b0[0x8]; - float _curveStrength; - float _radius; - bool _isActiveRotating; - uint8_t _pad_0x4c1[0x3]; - uint32_t _rotationDelay; - float _rotationDegrees; - float _rotationSpd; - float _maxDistance; - uint32_t _homingType; - Vector _endPoint; - float _scale; - bool _disableFollowParent; - uint8_t _pad_0x4e5[0x3]; - Entity* _bounceLaser; - uint8_t _childLaser[0x8]; // EntityPtr - float _blackHpDropChance; - uint8_t _multidimensionalLasers[0x8]; // EntityPtr[2] - bool _multidimensionalTouched; - uint8_t _pad_0x501[0x3]; - uint8_t _prismLasers[0x10]; // EntityPtr[4] - bool _prismTouched; - bool _oneHit; - bool _isGridHit; - uint8_t _pad_0x517[0x1]; - bool _disableInitSound; - uint8_t _pad_0x519[0x3]; - float _damageMultiplier; - std_vector _hitList; - uint8_t _parentLaser[0x4]; // EntityPtr - uint8_t _subLasers[0x8]; // EntityPtr[2] - uint8_t _continuumLaser[0x4]; // EntityPtr - uint8_t _tearWaitEffect[0x4]; // EntityPtr - int _waitFrames; - float _impactDistance; - Vector _impactPosition; - Vector _impactDirection; - float _subLaserDistance; - float _subLaserAngle; - int _chainedLasers; - uint8_t _pad_0x564[0x4]; -}; -LAYOUT32(offsetof(Entity_Laser, _parentOffset) == 0x410); -LAYOUT32(offsetof(Entity_Laser, _startAngleDegrees) == 0x418); -LAYOUT32(offsetof(Entity_Laser, _angleDegrees) == 0x41c); -LAYOUT32(offsetof(Entity_Laser, _lastAngleDegrees) == 0x420); -LAYOUT32(offsetof(Entity_Laser, _tearFlags) == 0x428); -LAYOUT32(offsetof(Entity_Laser, _activeTearFlags) == 0x438); -LAYOUT32(offsetof(Entity_Laser, _heldTearFlags) == 0x448); -LAYOUT32(offsetof(Entity_Laser, _timeout) == 0x458); -LAYOUT32(offsetof(Entity_Laser, _isFirstUpdate) == 0x45c); -LAYOUT32(offsetof(Entity_Laser, _sampleLaser) == 0x45d); -LAYOUT32(offsetof(Entity_Laser, _shrink) == 0x45e); -LAYOUT32(offsetof(Entity_Laser, _laserLength) == 0x460); -LAYOUT32(offsetof(Entity_Laser, _homingLaser) == 0x464); -LAYOUT32(offsetof(Entity_Laser, _curveStrength) == 0x4b8); -LAYOUT32(offsetof(Entity_Laser, _radius) == 0x4bc); -LAYOUT32(offsetof(Entity_Laser, _isActiveRotating) == 0x4c0); -LAYOUT32(offsetof(Entity_Laser, _rotationDelay) == 0x4c4); -LAYOUT32(offsetof(Entity_Laser, _rotationDegrees) == 0x4c8); -LAYOUT32(offsetof(Entity_Laser, _rotationSpd) == 0x4cc); -LAYOUT32(offsetof(Entity_Laser, _maxDistance) == 0x4d0); -LAYOUT32(offsetof(Entity_Laser, _homingType) == 0x4d4); -LAYOUT32(offsetof(Entity_Laser, _endPoint) == 0x4d8); -LAYOUT32(offsetof(Entity_Laser, _scale) == 0x4e0); -LAYOUT32(offsetof(Entity_Laser, _disableFollowParent) == 0x4e4); -LAYOUT32(offsetof(Entity_Laser, _bounceLaser) == 0x4e8); -LAYOUT32(offsetof(Entity_Laser, _childLaser) == 0x4ec); -LAYOUT32(offsetof(Entity_Laser, _blackHpDropChance) == 0x4f4); -LAYOUT32(offsetof(Entity_Laser, _multidimensionalLasers) == 0x4f8); -LAYOUT32(offsetof(Entity_Laser, _multidimensionalTouched) == 0x500); -LAYOUT32(offsetof(Entity_Laser, _prismLasers) == 0x504); -LAYOUT32(offsetof(Entity_Laser, _prismTouched) == 0x514); -LAYOUT32(offsetof(Entity_Laser, _oneHit) == 0x515); -LAYOUT32(offsetof(Entity_Laser, _isGridHit) == 0x516); -LAYOUT32(offsetof(Entity_Laser, _disableInitSound) == 0x518); -LAYOUT32(offsetof(Entity_Laser, _damageMultiplier) == 0x51c); -LAYOUT32(offsetof(Entity_Laser, _hitList) == 0x520); -LAYOUT32(offsetof(Entity_Laser, _parentLaser) == 0x52c); -LAYOUT32(offsetof(Entity_Laser, _subLasers) == 0x530); -LAYOUT32(offsetof(Entity_Laser, _continuumLaser) == 0x538); -LAYOUT32(offsetof(Entity_Laser, _tearWaitEffect) == 0x53c); -LAYOUT32(offsetof(Entity_Laser, _waitFrames) == 0x540); -LAYOUT32(offsetof(Entity_Laser, _impactDistance) == 0x544); -LAYOUT32(offsetof(Entity_Laser, _impactPosition) == 0x548); -LAYOUT32(offsetof(Entity_Laser, _impactDirection) == 0x550); -LAYOUT32(offsetof(Entity_Laser, _subLaserDistance) == 0x558); -LAYOUT32(offsetof(Entity_Laser, _subLaserAngle) == 0x55c); -LAYOUT32(offsetof(Entity_Laser, _chainedLasers) == 0x560); -LAYOUT32(sizeof(Entity_Laser) == 0x568); - -struct std_deque { - void * _proxy; - void * _map; - uint32_t _mapSize; - uint32_t _offset; - uint32_t _size; -}; -LAYOUT32(offsetof(std_deque, _proxy) == 0x0); -LAYOUT32(offsetof(std_deque, _map) == 0x4); -LAYOUT32(offsetof(std_deque, _mapSize) == 0x8); -LAYOUT32(offsetof(std_deque, _offset) == 0xc); -LAYOUT32(offsetof(std_deque, _size) == 0x10); -LAYOUT32(sizeof(std_deque) == 0x14); - -struct Entity_NPC : Entity { - virtual ~Entity_NPC(); // 006b88e0 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 006b8b20 slot 1 - void PreUpdate() override; // 006c4ac0 slot 2 - void Update() override; // 006c4b30 slot 3 - void Interpolate() override; // 006d2b50 slot 4 - void Render(Vector *offset) override; // 006d2e50 slot 5 - uint8_t RenderShadowLayer(Vector *offset) override; // 006d4840 slot 6 - uint8_t TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) override; // 006d60a0 slot 8 - void Kill(EntityRef *source) override; // 006be6f0 slot 9 - void Remove() override; // 006b8f00 slot 10 - void ClearReferences() override; // 006b8f30 slot 17 - uint8_t CanShutDoors() override; // 006b8450 slot 18 - uint8_t IsBoss() override; // 006b8470 slot 19 - uint8_t TryThrow() override; // 006d9440 slot 21 - Vector * GetForwardVector(Vector *outForward) override; // 006d48a0 slot 22 - void HandleCollision() override; // 006cd410 slot 23 - void ResetColor() override; // 006c1100 slot 24 - void LoadEntityConfig() override; // 006bb790 slot 25 - Entity_NPC * ParentNPC(); // 00447770 - long double Scale(); // 004567a0 - Entity_NPC * ChildNPC(); // 004567e0 - void Hornfel_UpdateAI(); // 004b92e0 - void Hornfel_UpdateFrame(); // 004bb0e0 - void update_physics(); // 004cde30 - void apply_velocity(char param_2); // 004ce120 - void update_move_direction_anim(); // 004ce6d0 - void SetMinecartPosVel(Vector *pos, Vector *vel); // 004cf030 - void MinecartUpdateChild(Entity *child); // 004cf120 - void UpdateCordChain(uint8_t isHalfScale); // 004e8fa0 - void render_overlay(Vector *offset, uint8_t isShadow); // 004e9b10 - static int FindTargetPit(Vector *pos1, Vector *pos2, uint32_t pitIndex); // 00548f30 - static Entity_NPC * ThrowStrider(Vector *pos, Entity *spanwer, Vector *targetPos); // 0055cef0 - void render_v1_layer_frames(); // 00565680 - void RenderSegmentLink(Vector *offset, uint8_t isShadow); // 0059bed0 - void CreateBling(); // 0059e390 - void CreateGoldParticles(uint32_t count); // 0059e4c0 - void set_entity_ptr_f54(Entity *entity); // 0060d140 - int GetChampionColorIdx(); // 006a8230 - void ResetPathFinderTarget(); // 006a8240 - void hold_set(int countdown, Vector *position); // 006b5e20 - Entity_Effect * MakeSplat(float size); // 006b64d0 - Entity_Effect * MakeBloodCloud(Vector *pos, ColorMod *color); // 006b6830 - uint8_t IsChampion(); // 006b8480 - void Constructor(); // 006b8590 - uint8_t TryForceTarget(Entity *Target, int Duration); // 006b9910 - float compute_speed_multiplier(); // 006b99e0 - void load_graphics(uint8_t param_2); // 006baf40 - void KillUnique(); // 006be760 - Entity * GetPlayerTarget(); // 006be840 - Vector * CalcTargetPosition(Vector *outPos, float distanceLimit); // 006bec40 - void UpdateDirtColor(uint8_t immediate); // 006c04b0 - static uint8_t Redirect(int *entityType, int *variant); // 006c07e0 - void Morph(int EntityType, int Variant, int SubType, int Championid); // 006c0f30 - void * shopkeeper_get_loot(void *outLoot, uint8_t isShouldAdvance); // 006c1ac0 - static Entity_NPC * ThrowSpider(Vector *position, Entity *spawner, Vector targetPos, uint8_t isBig, float yOffset); // 006c2750 - void update_frozen(); // 006ca930 - void fire_projectile_from_params(Entity_Projectile *projectile); // 006cb2a0 - void SetBossColorIdx(int bossColorIdx, int unused); // 006d0300 - void MakeChampion(uint32_t seed, int championColor, uint8_t isInit); // 006d03e0 - void SetRef_bec(Entity *entity); // 006d0c20 - static void * QueryNPCsType(void *outList, int type, int variant); // 006d0c60 - static EntityList * QueryNPCsGroup(EntityList *outList, int groupIdx); // 006d0dd0 - void * fireplace_get_loot(void *outLoot, uint8_t isShouldAdvance); // 006d1580 - uint8_t CanBeDamagedFromVelocity(Vector velocity); // 006d4a00 - uint8_t CanReroll(); // 006d4db0 - void PlayDeathEffects(); // 006d4e00 - void trigger_kill_item_effects(); // 006d5400 - void SetScale(float scale); // 006d6610 - void PlaySound(int id, float volume, int framedelay, uint8_t loop, float pitch); // 006d6ba0 - int GetAliveEnemyCount(); // 006d6c20 - uint32_t on_player_damaged(); // 006d6d20 - void room_enter(); // 006d6d80 - void spawn_damage_numbers(); // 006d7010 - void update_damage_history(); // 006d7230 - void update_blood_guide_gibs(float *nullFrame); // 006d7520 - void ClearDequeRefs(); // 006d81c0 - uint8_t IsControllerActionPressed(int action); // 006d8260 - uint8_t IsControllerActionTriggered(int buttonAction); // 006d8290 - Vector * GetControllerInput(Vector *outInput, float deadzone); // 006d82d0 - Vector * GetControllerMovementInput(Vector *outInput, float deadzone); // 006d85a0 - void TransferControl(Entity_NPC *target); // 006d88b0 - void SpawnControlTarget(int inputMode, float rotation); // 006d8b20 - void ClearChild(); // 006d8cf0 - Vector * GetAimTargetPosition(Vector *outPosition); // 006d8d30 - uint8_t is_controller_input_idle(); // 006d8d80 - void UpdateChargeBar(float start, float end, float value, uint8_t isHideWhenFull); // 006d8e40 - void UpdateControllerMovement(uint8_t isForceUpdate); // 006d9050 - void UpdateChildEffectPosition(uint8_t isPredictMovement); // 006d90e0 - uint8_t split(float damage, EntityRef *source, uint8_t isPlaySound); // 006d97e0 - void UpdatePickupGhosts(); // 006da530 - int GetBossColorIdx(); // 007e92b0 - void SetAimAngle(float angle); // 0096ce90 - static void render_debug(float *param_1, int param_2); // 009a8b90 - - int _stateFrame; - NPCAI_Pathfinder _pathfinder; - uint8_t _pad_0xb5c[0x8]; - int _state; - int _savedState; - int _aiCounter; - int _appearFrames; - int _aiCallPhase; - bool _collisionIsLow; - uint8_t _pad_0xb79[0x3]; - Entity* _collisionEntity; - int _collisionResult; - int _decoyTargetTimer; - std_vector _killDamageEvents; - float _killDamage; - uint64_t _killDamageFlags; - int _projectileCooldown; - int _projectileDelay; - int _championTimer; - float _championSpeed; - Vector _v1; - Vector _v2; - int _i1; - int _i2; - uint32_t _deliriumBossType; - uint32_t _deliriumBossVariant; - uint16_t _deliriumTransformationTimer; - uint8_t _deliriumRemainingAttacks; - uint8_t _deliriumState; - uint8_t _pad_0xbd4[0x4]; - uint32_t _deliriumAttackID; - uint8_t _deliriumAttackAngle; - uint8_t _pad_0xbdd[0x3]; - uint32_t _deliriumCycleID; - uint32_t _deliriumCycleIDHigh; - Entity* _deliriumEntity; - uint8_t _entityRef[0x4]; // EntityPtr - std_deque _entityDeque; - std_deque _vectorDeque1; - std_deque _vectorDeque2; - Vector _confusionTargetPos; - float _aiFloat; - float _scale; - bool _canShutDoors; - bool _isBoss; - bool _isUnreachableOnce; - uint8_t _pad_0xc3f[0x1]; - float _shieldStrength; - int _shieldFrames; - uint8_t _pad_0xc48[0x14]; - float _totalDamageTaken; - bool _isBestiaryEncountered; - uint8_t _pad_0xc61[0x2]; - bool _isChampion; - int _championColorIdx; - int _flickerTimer; - int _flickerState; - float _flickerAlpha; - uint16_t _championRegenTimer; - short _championRegenCount; - int _bosscoloridx; - int _groupIdx; - ColorMod _floorColor; - ColorMod _dirtColor; - uint8_t _statusEffectSprite[0x114]; // ANM2 - uint8_t _chargeBarSprite[0x114]; // ANM2 - std_vector _hitList; - std_vector _secondaryHitList; - uint32_t _aiCallFlags; - int32_t _controllerID; - Vector _controllerMovement; - void* _aimTargetEffect; - uint8_t _pad_0xf2c[0x4]; - Vector _forwardVector; - uint8_t _forcedTarget[0x4]; // EntityPtr - int _forcedTargetTimer; - Entity_Player* _sirenPlayerEntity; - float _hitPointsMulti; - float _scaleMulti; - int _lastGridIndex; - Entity_Effect* _pickupGhostsEntity; - uint8_t _pad_0xf54[0xc]; -}; -LAYOUT32(offsetof(Entity_NPC, _stateFrame) == 0x410); -LAYOUT32(offsetof(Entity_NPC, _pathfinder) == 0x414); -LAYOUT32(offsetof(Entity_NPC, _state) == 0xb64); -LAYOUT32(offsetof(Entity_NPC, _savedState) == 0xb68); -LAYOUT32(offsetof(Entity_NPC, _aiCounter) == 0xb6c); -LAYOUT32(offsetof(Entity_NPC, _appearFrames) == 0xb70); -LAYOUT32(offsetof(Entity_NPC, _aiCallPhase) == 0xb74); -LAYOUT32(offsetof(Entity_NPC, _collisionIsLow) == 0xb78); -LAYOUT32(offsetof(Entity_NPC, _collisionEntity) == 0xb7c); -LAYOUT32(offsetof(Entity_NPC, _collisionResult) == 0xb80); -LAYOUT32(offsetof(Entity_NPC, _decoyTargetTimer) == 0xb84); -LAYOUT32(offsetof(Entity_NPC, _killDamageEvents) == 0xb88); -LAYOUT32(offsetof(Entity_NPC, _killDamage) == 0xb94); -LAYOUT32(offsetof(Entity_NPC, _killDamageFlags) == 0xb98); -LAYOUT32(offsetof(Entity_NPC, _projectileCooldown) == 0xba0); -LAYOUT32(offsetof(Entity_NPC, _projectileDelay) == 0xba4); -LAYOUT32(offsetof(Entity_NPC, _championTimer) == 0xba8); -LAYOUT32(offsetof(Entity_NPC, _championSpeed) == 0xbac); -LAYOUT32(offsetof(Entity_NPC, _v1) == 0xbb0); -LAYOUT32(offsetof(Entity_NPC, _v2) == 0xbb8); -LAYOUT32(offsetof(Entity_NPC, _i1) == 0xbc0); -LAYOUT32(offsetof(Entity_NPC, _i2) == 0xbc4); -LAYOUT32(offsetof(Entity_NPC, _deliriumBossType) == 0xbc8); -LAYOUT32(offsetof(Entity_NPC, _deliriumBossVariant) == 0xbcc); -LAYOUT32(offsetof(Entity_NPC, _deliriumTransformationTimer) == 0xbd0); -LAYOUT32(offsetof(Entity_NPC, _deliriumRemainingAttacks) == 0xbd2); -LAYOUT32(offsetof(Entity_NPC, _deliriumState) == 0xbd3); -LAYOUT32(offsetof(Entity_NPC, _deliriumAttackID) == 0xbd8); -LAYOUT32(offsetof(Entity_NPC, _deliriumAttackAngle) == 0xbdc); -LAYOUT32(offsetof(Entity_NPC, _deliriumCycleID) == 0xbe0); -LAYOUT32(offsetof(Entity_NPC, _deliriumCycleIDHigh) == 0xbe4); -LAYOUT32(offsetof(Entity_NPC, _deliriumEntity) == 0xbe8); -LAYOUT32(offsetof(Entity_NPC, _entityRef) == 0xbec); -LAYOUT32(offsetof(Entity_NPC, _entityDeque) == 0xbf0); -LAYOUT32(offsetof(Entity_NPC, _vectorDeque1) == 0xc04); -LAYOUT32(offsetof(Entity_NPC, _vectorDeque2) == 0xc18); -LAYOUT32(offsetof(Entity_NPC, _confusionTargetPos) == 0xc2c); -LAYOUT32(offsetof(Entity_NPC, _aiFloat) == 0xc34); -LAYOUT32(offsetof(Entity_NPC, _scale) == 0xc38); -LAYOUT32(offsetof(Entity_NPC, _canShutDoors) == 0xc3c); -LAYOUT32(offsetof(Entity_NPC, _isBoss) == 0xc3d); -LAYOUT32(offsetof(Entity_NPC, _isUnreachableOnce) == 0xc3e); -LAYOUT32(offsetof(Entity_NPC, _shieldStrength) == 0xc40); -LAYOUT32(offsetof(Entity_NPC, _shieldFrames) == 0xc44); -LAYOUT32(offsetof(Entity_NPC, _totalDamageTaken) == 0xc5c); -LAYOUT32(offsetof(Entity_NPC, _isBestiaryEncountered) == 0xc60); -LAYOUT32(offsetof(Entity_NPC, _isChampion) == 0xc63); -LAYOUT32(offsetof(Entity_NPC, _championColorIdx) == 0xc64); -LAYOUT32(offsetof(Entity_NPC, _flickerTimer) == 0xc68); -LAYOUT32(offsetof(Entity_NPC, _flickerState) == 0xc6c); -LAYOUT32(offsetof(Entity_NPC, _flickerAlpha) == 0xc70); -LAYOUT32(offsetof(Entity_NPC, _championRegenTimer) == 0xc74); -LAYOUT32(offsetof(Entity_NPC, _championRegenCount) == 0xc76); -LAYOUT32(offsetof(Entity_NPC, _bosscoloridx) == 0xc78); -LAYOUT32(offsetof(Entity_NPC, _groupIdx) == 0xc7c); -LAYOUT32(offsetof(Entity_NPC, _floorColor) == 0xc80); -LAYOUT32(offsetof(Entity_NPC, _dirtColor) == 0xcac); -LAYOUT32(offsetof(Entity_NPC, _statusEffectSprite) == 0xcd8); -LAYOUT32(offsetof(Entity_NPC, _chargeBarSprite) == 0xdec); -LAYOUT32(offsetof(Entity_NPC, _hitList) == 0xf00); -LAYOUT32(offsetof(Entity_NPC, _secondaryHitList) == 0xf0c); -LAYOUT32(offsetof(Entity_NPC, _aiCallFlags) == 0xf18); -LAYOUT32(offsetof(Entity_NPC, _controllerID) == 0xf1c); -LAYOUT32(offsetof(Entity_NPC, _controllerMovement) == 0xf20); -LAYOUT32(offsetof(Entity_NPC, _aimTargetEffect) == 0xf28); -LAYOUT32(offsetof(Entity_NPC, _forwardVector) == 0xf30); -LAYOUT32(offsetof(Entity_NPC, _forcedTarget) == 0xf38); -LAYOUT32(offsetof(Entity_NPC, _forcedTargetTimer) == 0xf3c); -LAYOUT32(offsetof(Entity_NPC, _sirenPlayerEntity) == 0xf40); -LAYOUT32(offsetof(Entity_NPC, _hitPointsMulti) == 0xf44); -LAYOUT32(offsetof(Entity_NPC, _scaleMulti) == 0xf48); -LAYOUT32(offsetof(Entity_NPC, _lastGridIndex) == 0xf4c); -LAYOUT32(offsetof(Entity_NPC, _pickupGhostsEntity) == 0xf50); -LAYOUT32(sizeof(Entity_NPC) == 0xf60); - -struct Entity_Pickup : Entity { - virtual ~Entity_Pickup(); // 006e0130 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 006e02f0 slot 1 - void Update() override; // 006e3940 slot 3 - void Interpolate() override; // 006e38d0 slot 4 - void Render(Vector *offset) override; // 006e69b0 slot 5 - uint8_t TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) override; // 006edda0 slot 8 - void Remove() override; // 006ee110 slot 10 - void ClearReferences() override; // 006ee130 slot 17 - uint8_t TryThrow() override; // 006e3800 slot 21 - void HandleCollision() override; // 006e8ae0 slot 23 - int Price(); // 00431740 - void GetLootList(Vector *renderOffset); // 005832c0 - bool IsShopItem(); // 005b1930 - int Timeout(); // 005b1940 - int OptionsPickupIndex(); // 005b1980 - static Vector * GetRandomPickupVelocity(Vector *buffer, Vector *position, RNG *rng, uint32_t ePickupVelType); // 005b19b0 - void Constructor(); // 006e0010 - uint8_t TryFlip(Entity_Player *unusedPlayer, uint32_t unusedSeed); // 006e1640 - void UpdateLootPreview(); // 006e17c0 - void SetAlternatePedestal(int pedestalType); // 006e1a80 - int GetAlternatePedestal(); // 006e1d70 - void SetForceBlind(uint8_t setBlind); // 006e1e60 - void UpdateSprite(uint8_t isIgnoreBlind); // 006e21f0 - void update_price_sprite(int price); // 006e2570 - void AppearFast(); // 006e3020 - uint8_t TryOpenChest(Entity_Player *player); // 006e6e40 - void PlayDropSound(); // 006e7be0 - void PlayPickupSound(); // 006e7dc0 - int GetCoinValue(); // 006e8380 - uint32_t can_player_buy(Entity_Player *param_2); // 006e83a0 - void CollectTrinket(Entity_Player *param_2, uint32_t param_3); // 006e84d0 - uint8_t empty_pedestal(); // 006ed580 - void update_magnet_attraction(); // 006ed690 - void update_cycle_collectible(uint8_t isForce); // 006edfa0 - uint8_t CanReroll(); // 006ee200 - static uint8_t CanRerollVariant(int variant, int subType); // 006ee240 - static uint8_t IsChest(int variant); // 006ee340 - uint8_t CanBePickedUp(uint8_t ignorePrice); // 006ee390 - uint8_t CanJeraDuplicate(); // 006ee3f0 - static void RemoveOtherOptions(); // 006ee750 - void MakeShopItem(int shopId); // 006eea30 - int AssignOptionsIndex(); // 006eed30 - int Charge(); // 007e9390 - uint8_t AutoUpdatePrice(); // 007e93a0 - uint8_t Touched(); // 007e93b0 - int ShopItemId(); // 007e93c0 - static void RestoreState(Room *room, Entity_Pickup *entity, void *saveState); // 007ef420 - int Wait(); // 0085e440 - - uint8_t _priceANM2[0x114]; // ANM2 - int _charge; - int _optionsPickupIndex; - bool _isTouched; - uint8_t _pad_0x52d[0x1]; - bool _isForceBlind; - bool _isPayToPlay; - int _itemPoolType; - int _price; - bool _isAutoUpdatePrice; - uint8_t _pad_0x539[0x3]; - int _shopItemId; - int _timeout; - int _wait; - int _chestReCloseTimer; - int _collisionCooldown; - int _gridRepositionState; - int _dropDelay; - ColorMod _colorMod; - uint32_t _state; - int _coopDuplicateIndex; - uint8_t _unkEntityRef[0x4]; // EntityPtr - Entity_Effect* _pickupGhost; - Entity_Pickup* _megaChestCollectible[2]; - int _varData; - unsigned int _cycleCollectibleList[8]; - unsigned int _cycleCollectibleCount; - int _invisibleFrames; - uint8_t _flipSaveState[0x8]; // KAGE_SmartPointer_EntitySaveState - uint8_t _altPedestalANM2[0x120]; // ANM2 -}; -LAYOUT32(offsetof(Entity_Pickup, _priceANM2) == 0x410); -LAYOUT32(offsetof(Entity_Pickup, _charge) == 0x524); -LAYOUT32(offsetof(Entity_Pickup, _optionsPickupIndex) == 0x528); -LAYOUT32(offsetof(Entity_Pickup, _isTouched) == 0x52c); -LAYOUT32(offsetof(Entity_Pickup, _isForceBlind) == 0x52e); -LAYOUT32(offsetof(Entity_Pickup, _isPayToPlay) == 0x52f); -LAYOUT32(offsetof(Entity_Pickup, _itemPoolType) == 0x530); -LAYOUT32(offsetof(Entity_Pickup, _price) == 0x534); -LAYOUT32(offsetof(Entity_Pickup, _isAutoUpdatePrice) == 0x538); -LAYOUT32(offsetof(Entity_Pickup, _shopItemId) == 0x53c); -LAYOUT32(offsetof(Entity_Pickup, _timeout) == 0x540); -LAYOUT32(offsetof(Entity_Pickup, _wait) == 0x544); -LAYOUT32(offsetof(Entity_Pickup, _chestReCloseTimer) == 0x548); -LAYOUT32(offsetof(Entity_Pickup, _collisionCooldown) == 0x54c); -LAYOUT32(offsetof(Entity_Pickup, _gridRepositionState) == 0x550); -LAYOUT32(offsetof(Entity_Pickup, _dropDelay) == 0x554); -LAYOUT32(offsetof(Entity_Pickup, _colorMod) == 0x558); -LAYOUT32(offsetof(Entity_Pickup, _state) == 0x584); -LAYOUT32(offsetof(Entity_Pickup, _coopDuplicateIndex) == 0x588); -LAYOUT32(offsetof(Entity_Pickup, _unkEntityRef) == 0x58c); -LAYOUT32(offsetof(Entity_Pickup, _pickupGhost) == 0x590); -LAYOUT32(offsetof(Entity_Pickup, _megaChestCollectible) == 0x594); -LAYOUT32(offsetof(Entity_Pickup, _varData) == 0x59c); -LAYOUT32(offsetof(Entity_Pickup, _cycleCollectibleList) == 0x5a0); -LAYOUT32(offsetof(Entity_Pickup, _cycleCollectibleCount) == 0x5c0); -LAYOUT32(offsetof(Entity_Pickup, _invisibleFrames) == 0x5c4); -LAYOUT32(offsetof(Entity_Pickup, _flipSaveState) == 0x5c8); -LAYOUT32(offsetof(Entity_Pickup, _altPedestalANM2) == 0x5d0); -LAYOUT32(sizeof(Entity_Pickup) == 0x6f0); - -struct History { - void AddHistoryItem(void *historyItem); // 00721a70 - uint8_t RemoveHistoryItemByIndex(int index); // 00721c00 - void merge(void *other); // 00721c80 - void remove_index_refs(int index); // 007220a0 - - std_vector _historyItems; - bool _isLocked; - uint8_t _pad_0xd[0x3]; - Entity_Player* _player; -}; -LAYOUT32(offsetof(History, _historyItems) == 0x0); -LAYOUT32(offsetof(History, _isLocked) == 0xc); -LAYOUT32(offsetof(History, _player) == 0x10); - -struct GameStatePlayer { - ~GameStatePlayer(); // 00754d90 - void read_player_key(void *stream); // 009c86e0 - void Init(); // 009cf050 - static uint8_t read_coplayer(short *block, void *stream); // 009cff40 - void write_coplayer(void *stream); // 009d0100 - static void read_block_538(uint32_t *block, void *stream); // 009d02c0 - static void write_block_538(short *block, void *stream); // 009d0440 - uint8_t read(void *reader); // 009d05d0 - static uint32_t read_part3(); // 009d2656 -}; - - -struct QueueItemData { - static uint8_t Touched(); // 007538f0 - - ItemConfig_Item* _item; - int _charge; - uint8_t _flags; -}; -LAYOUT32(offsetof(QueueItemData, _item) == 0x0); -LAYOUT32(offsetof(QueueItemData, _charge) == 0x4); -LAYOUT32(offsetof(QueueItemData, _flags) == 0x8); - -struct PlayerCostumeMap { - int _index; - int _layerID; - int _priority; - bool _isBodyLayer; -}; -LAYOUT32(offsetof(PlayerCostumeMap, _index) == 0x0); -LAYOUT32(offsetof(PlayerCostumeMap, _layerID) == 0x4); -LAYOUT32(offsetof(PlayerCostumeMap, _priority) == 0x8); -LAYOUT32(offsetof(PlayerCostumeMap, _isBodyLayer) == 0xc); - -struct std_map { - void * _head; - uint32_t _size; -}; -LAYOUT32(offsetof(std_map, _head) == 0x0); -LAYOUT32(offsetof(std_map, _size) == 0x4); -LAYOUT32(sizeof(std_map) == 0x8); - -struct TemporaryEffects { - void * GetEffectsList(); // 007537a0 - void AddEffect(void *Effect, uint8_t addcostume, int count); // 00930220 - void AddCollectibleEffect(int coltype, uint8_t addcostume, int count); // 009302e0 - void AddTrinketEffect(int trinkettype, uint8_t addcostume, int count); // 00930330 - void AddNullEffect(int nulleffectid, uint8_t addcostume, int count); // 00930390 - void RemoveEffect(void *effect, int count); // 009303f0 - void RemoveCollectibleEffect(int coltype, int count); // 009304a0 - void RemoveTrinketEffect(int trinkettype, int count); // 009304f0 - void RemoveNullEffect(int nulleffectid, int count); // 00930550 - static uint8_t has_item_effect(TemporaryEffects *effects, ItemConfig_Item *item); // 009305c0 - uint8_t HasCollectibleEffect(int coltype); // 009305f0 - uint8_t HasTrinketEffect(int trinkettype); // 00930640 - uint8_t HasNullEffect(int nulleffectid); // 00930680 - void ClearEffects(uint8_t isClearPersistent); // 009306c0 - void Update(); // 00930820 - void * GetCollectibleEffect(int coltype); // 00930980 - void * GetTrinketEffect(int trinkettype); // 009309c0 - void * GetNullEffect(int nulleffectid); // 00930a30 - int GetCollectibleEffectNum(int coltype); // 00930a70 - int GetTrinketEffectNum(int trinkettype); // 00930aa0 - int GetNullEffectNum(int nulleffectid); // 00930ae0 - - unsigned int _cacheFlags; - std_vector _effects; - bool _shouldEvaluateCache; - bool _disabled; - uint8_t _pad_0x12[0x2]; - Entity_Player* _player; -}; -LAYOUT32(offsetof(TemporaryEffects, _cacheFlags) == 0x0); -LAYOUT32(offsetof(TemporaryEffects, _effects) == 0x4); -LAYOUT32(offsetof(TemporaryEffects, _shouldEvaluateCache) == 0x10); -LAYOUT32(offsetof(TemporaryEffects, _disabled) == 0x11); -LAYOUT32(offsetof(TemporaryEffects, _player) == 0x14); - -struct UserProfile { - void find_or_create(); // 00a23ae0 -}; - - -struct PlayerProceduralItems { - Entity_Player* _player; - uint8_t _itemIds[0x4]; // std_set -}; -LAYOUT32(offsetof(PlayerProceduralItems, _player) == 0x0); -LAYOUT32(offsetof(PlayerProceduralItems, _itemIds) == 0x4); - -struct Entity_Player : Entity { - virtual ~Entity_Player(); // 00754d60 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 00755470 slot 1 - void Update() override; // 00782af0 slot 3 - void Render(Vector *offset) override; // 0078ca00 slot 5 - uint8_t RenderShadowLayer(Vector *offset) override; // 0078dc20 slot 6 - uint8_t TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) override; // 007729d0 slot 8 - void ClearReferences() override; // 00757a40 slot 17 - uint8_t CanShutDoors() override; // 00757ab0 slot 18 - uint8_t IsValidTarget(Entity *target) override; // 00757a60 slot 20 - uint8_t TryThrow() override; // 007d2930 slot 21 - void HandleCollision() override; // 0078e1f0 slot 23 - void ResetColor() override; // 007579c0 slot 24 - Entity_Player * GetMainTwin(); // 00417800 - uint32_t GetOtherTwin(); // 00417820 - int ControllerIndex(); // 00423950 - int GetPlayerType(); // 004253b0 - int GetHearts(); // 00428b10 - int GetBatteryCharge(int slot); // 0042a2f0 - int GetMaxHearts(); // 0042a310 - uint8_t IsCoopGhost(); // 0042a320 - int GetFireDirection(); // 004316d0 - Vector * GetAimDirection(); // 004316e0 - int GetNumBlueFlies(); // 004316f0 - void AddCacheFlags(int flags); // 00436160 - int GetHeadDirection(); // 00436170 - uint8_t AreOpposingShootDirectionsPressed(); // 00436180 - long double GetTearPoisonDamage(); // 004361a0 - int GetItemState(); // 004361b0 - TemporaryEffects * GetEffects(); // 004361c0 - void SetMinDamageCooldown(int cooldown); // 004361d0 - int GetNumCoins(); // 00499dd0 - int GetMovementDirection(); // 004e4860 - int GetActiveItem(int slot); // 00505c80 - uint8_t AreControlsEnabled(); // 00505cc0 - bool IsItemQueueEmpty(); // 0056ff90 - void StopExtraAnimation(); // 0058e230 - int GetBoneHearts(); // 005b1700 - int GetRottenHearts(); // 005b1710 - int GetSoulHearts(); // 005b1740 - int GetBlackHearts(); // 005b1750 - int GetNumKeys(); // 005b1760 - int GetGoldenHearts(); // 005b1770 - uint8_t HasWeaponType(int weaponType); // 005b1780 - RNG * GetCollectibleRNG(int id); // 005b17c0 - void moms_bracelet_grab(); // 005b1a20 - void UseRedKey(); // 005b2360 - void use_card_hagalaz(RNG *rng); // 005b23f0 - int reroll_collectibles_on_damage(RNG *rng, uint8_t isIncludeActives); // 005c88a0 - static Entity_Familiar * AddItemWisp(uint32_t param_1, Vector *param_2, char param_3); // 005c96f0 - void trigger_book_of_belial_passive(int activeId, int charges); // 005c9930 - void TriggerBookOfVirtues(int collectibleId, int charge); // 005ca470 - void console_spawn(int *spawnSpec, uint8_t isAddWisp); // 005caa70 - void update_mini_mush_costume(); // 005cb480 - Vector * GetLastDirection(); // 005cd740 - EntityDesc * FriendBallEnemy(); // 005cd7d0 - int GetNumBlueSpiders(); // 0060d050 - int GetDamageCooldown(); // 0060d080 - void ResetDamageCooldown(); // 0060d090 - Vector * SpriteScale(Vector *outScale); // 0060d0a0 - int GetBrokenHearts(); // 0065cf20 - int GetNumBombs(); // 0065cf30 - uint8_t HasGoldenKey(); // 0065cf40 - uint8_t HasGoldenBomb(); // 0065cf50 - uint8_t IsP2Appearing(); // 0065cf60 - RNG * GetTrinketRNG(int id); // 0065cf80 - int GetTractorBeam(); // 00665c10 - ColorMod * get_laser_color_copy(ColorMod *outColor); // 00665c20 - uint32_t get_grid_collision_at(Vector *position); // 006b5fd0 - uint8_t ControlsEnabled(); // 006b84a0 - uint8_t HasFullHearts(); // 006dacd0 - int GetJarHearts(); // 006dad10 - int GetSoulCharge(); // 006dad20 - int GetBloodCharge(); // 006dad30 - Vector * GetVelocityBeforeUpdate(); // 006dad60 - int GetEternalHearts(); // 006dad70 - void set_last_damage(uint64_t damageFlags, EntityRef *source); // 006dad80 - int GetBabySkin(); // 006dae00 - int GetSubPlayer(); // 006dae10 - void SetSoulCharge(int param_2); // 006f0020 - void SetBloodCharge(int param_2); // 006f0030 - void * GetPocketItem(int SlotID); // 00753900 - Vector * TearsOffset(); // 00753930 - void EnableWeaponType(int param_2, uint8_t param_3); // 00753980 - void QueueExtraAnimation(uint8_t *animName); // 007539c0 - uint8_t CanShoot(); // 007539f0 - RNG * GetPillRNG(int pillEffect); // 00753a00 - RNG * GetCardRNG(int cardId); // 00753a60 - uint32_t IsSubPlayer(); // 00753ac0 - int GetPoopMana(); // 00753c20 - uint8_t HasCurseMistEffect(); // 00753c30 - void constructor(); // 00753da0 - void release_weapons_and_effects(uint8_t isRemoveEntities); // 00757ac0 - uint32_t InvalidateCoPlayerItems(); // 007584b0 - void cycle_spectate_target(); // 007585b0 - void trigger_max_hearts_removed(int removed); // 00758850 - void AddMaxHearts(int amount, uint8_t ignoreKeeper); // 007588a0 - void AddHearts(int hearts, uint8_t unk, uint8_t unk2); // 00758a70 - void AddEternalHearts(int amount); // 00758c20 - void AddSoulHearts(int amount, uint8_t unk); // 00758d00 - void AddBlackHearts(int amount); // 00758f90 - void RemoveBlackHeart(int soulHeartIndex); // 007591e0 - uint8_t IsBlackHeart(int heart); // 00759220 - void UpdateBlackHeartMask(); // 007592a0 - void AddJarHearts(int amount); // 00759390 - void AddCoins(int amount); // 00759400 - void AddBombs(int amount); // 00759500 - void AddKeys(int amount); // 007595b0 - void AddGoldenKey(); // 00759620 - void RemoveGoldenKey(); // 00759660 - void SyncConsumables(Entity_Player *target, uint32_t mask); // 007596a0 - void ConsumableCountChanged(int bitflags); // 007597e0 - void restore_curse_mist_backup(int *backup); // 00759950 - Entity * AddBlueFlies(int amount, Vector *pos, Entity *target); // 007599d0 - void RemoveBlueFly(); // 00759b80 - void AddLeprosy(); // 00759b90 - Entity * AddBoneOrbital(Vector *Position); // 00759bc0 - Entity * AddSwarmFlyOrbital(Vector *position); // 00759bf0 - uint8_t TryUseKey(); // 00759e20 - void UpdateCostumes(); // 0075bf00 - void AddCostume(ItemConfig_Item *collectibleID, uint8_t itemStateOnly); // 0075d1d0 - void AddNullCostume(int costumeid); // 0075d800 - void RemoveCostume(ItemConfig_Item *Item); // 0075d850 - uint8_t IsNullItemCostumeVisible(int nullItemID, int playerSpriteLayerID); // 0075d980 - void ClearCostumes(); // 0075dfe0 - void ClearQueueItem(); // 0075e190 - uint8_t FlushQueueItem(); // 0075e1d0 - void IncrementPlayerFormCounter(int ePlayerForm, int num); // 0075e320 - void AddPlayerFormCostume(int playerForm); // 0075e9a0 - void SetItemState(int collectibleId); // 0075ea20 - void render_charge_bars(Vector *renderPos); // 0075ea40 - int GetCollectibleCount(); // 0075eff0 - void EvaluateItems(); // 00763570 - void RespawnFamiliars(); // 00770600 - static void GetNPCTarget(); // 00770610 - uint8_t HasCollectible(int type, uint8_t ignoreModifiers); // 007706e0 - int GetCollectibleNum(int collectibleID, uint8_t OnlyCountTrueItems); // 00770ca0 - uint8_t VoidHasCollectible(int id); // 007711a0 - uint8_t IsInnateCollectible(int collectibleId, int unused); // 00771200 - void apply_innate_collectibles(); // 00771410 - uint8_t HasTrinket(uint32_t type, uint8_t ignoreModifiers); // 00771550 - uint8_t HasGoldenTrinket(uint32_t TrinketID); // 00771620 - uint8_t TryHoldTrinket(int trinketId); // 007716f0 - int GetMaxTrinkets(); // 007717c0 - Entity_Pickup * DropTrinket(Vector *DropPos, uint8_t ReplaceTick); // 00771800 - void AddTrinket(int type, uint8_t firsttime); // 00771d30 - uint8_t TryRemoveTrinket(uint32_t id); // 00771f60 - uint8_t TryRemoveSmeltedTrinket(uint32_t id); // 00772260 - uint8_t replace_trinket(int unused0, int unused1, int unused2); // 00772530 - void SetFullHearts(); // 007791f0 - Entity * GetFocusEntity(); // 00779320 - Vector * GetMovementJoystick(Vector *outJoystick); // 00779360 - Vector * GetShootingJoystick(Vector *outJoystick); // 00779620 - void GetBodyMoveDirection(Vector *buffer); // 00779900 - int GetWeaponModifiers(); // 00779a20 - void update_body_animations(); // 00779b40 - void update_shooting(); // 0077b020 - BitSet128 * GetBombFlags(BitSet128 *outFlags, uint8_t isRollChances); // 00780560 - static uint32_t GetBombVariant(); // 00780eb0 - float check_bomb_tearflags(BitSet128 tearFlags); // 00780ec0 - void update_bomb_input(); // 00780f40 - void GetFlyingOffset(Vector *outOffset); // 00782630 - void trigger_fire_item_effects(Vector *direction, uint8_t isShotFired); // 007826d0 - uint8_t * GetDeathAnimName(); // 007828f0 - Entity * GetActiveWeaponEntity(); // 00782a40 - uint32_t CanTurnHead(); // 00782a60 - float FireDelay(); // 00782a70 - uint8_t IsHeadless(); // 0078b350 - void RenderGlow(Vector *position); // 0078dc60 - void RenderBody(Vector *position); // 0078dde0 - void RenderHead(Vector *position); // 0078dff0 - void RenderTop(Vector *param_2); // 0078e190 - void RemoveCollectibleByHistoryIndex(int index, uint8_t RemovedBool); // 0078fec0 - void TriggerCollectibleRemoved(int collectibleID); // 0078ff90 - void ClearTemporaryEffects(); // 007907a0 - int GetTotalActiveCharge(int slot); // 007910f0 - int GetActiveItemSlot(int id); // 007911c0 - int GetCollectibleMaxCharge(int collectibleId, int varData, int unused); // 007911f0 - int GetActiveMaxCharge(int slot); // 00791320 - void SetActiveCharge(int charge, int slot); // 00791420 - void SetActiveVarData(int vardata, int slot); // 00791510 - void ControlActiveItem(int slot); // 00791a40 - uint8_t HasTimedItem(); // 00793940 - void update_effects(); // 00794e50 - void update_ladder(); // 0079f3c0 - void trigger_npc_death(Entity *npc); // 007a0080 - Entity_Bomb * FireBomb(Vector *pos, Vector *vel, Entity *source); // 007a0970 - uint8_t TriggerDeath(uint8_t checkOnly); // 007a1090 - void Revive(); // 007a2220 - void ReviveFromTrinket(uint32_t trinketId, int unused); // 007a3430 - static void remove_twin(); // 007a37c0 - void AddPocketItem(int id, uint32_t pocketItemType); // 007a3af0 - void AddCard(int card); // 007a3c10 - void AddPill(int pillColor); // 007a3c30 - int GetCard(int slot); // 007a3c50 - int GetPill(int slot); // 007a3c80 - void SetCard(int slot, int card); // 007a3cb0 - void SetPill(int slot, int pillColor); // 007a3cf0 - void pocket_use_input(); // 007a3d30 - static void pockets_rotate(); // 007a42b0 - void SwapActiveItems(); // 007a4760 - void RemovePocketItem(int slot); // 007a4850 - void DropPocketItem(int slot, Vector *pos); // 007a48f0 - void spawn_low_health_blood_splat(); // 007a49e0 - void level_start(uint8_t isForced); // 007a4ba0 - void ShootCandle(Vector *direction); // 007a6300 - int GetTrinket(uint32_t slot); // 007a6430 - void SetControllerIndex(int index, uint8_t isIncludePlayerOwned); // 007a6450 - void room_exit(uint8_t isKeepHolyMantle); // 007a6680 - void room_enter(); // 007a6c50 - void TriggerNewRoom_TemporaryEffects(); // 007a8350 - void TriggerRoomClear(); // 007a8fd0 - uint8_t HasPlayerForm(int playerForm); // 007aa7c0 - uint8_t CanAddCollectible(int collectibleId); // 007aa800 - uint8_t IsExtraAnimationFinished(); // 007ab110 - void AnimatePickup(ANM2 *param_2, uint8_t param_3, uint8_t *param_4); // 007ab130 - void AnimateTrinket(int trinketId, uint8_t *animName, uint8_t *spriteAnimName); // 007ab550 - void AnimateCard(int cardId, uint8_t *animName); // 007ab6b0 - void AnimatePill(int pillColor, uint8_t *animName); // 007abb00 - void AnimateTrapdoor(); // 007abc00 - static void AnimateLightTravel(); // 007abc10 - void AnimatePitfallIn(uint8_t isIgnoreEffect); // 007abc20 - void AnimatePitfallOut(); // 007abc90 - void AnimateAppear(); // 007abcb0 - void AnimateTeleport(uint8_t isUp); // 007abcc0 - void AnimateHappy(); // 007abd30 - void AnimateSad(); // 007abd90 - void AddPrettyFly(); // 007abdf0 - void PlayExtraAnimation(uint8_t *animName); // 007abe20 - void active_used_post(int slot, uint8_t unk, int chargeBeforeUse); // 007abf80 - void DischargeActiveItem(uint32_t slot, uint8_t unk); // 007ac7e0 - void TryRemoveTrinketCostume(int trinketId); // 007ad3a0 - static void TryRemoveNullCostume(int param_1); // 007ad400 - uint32_t GetMaxPocketItems(); // 007ad440 - void stop_costume_item_anims(); // 007ad4e0 - void ClearCollectibleAnim(int collectible); // 007ad5a0 - uint8_t IsCollectibleAnimFinished(int collectible, std_string *animName); // 007ad680 - void TriggerTrinketAdded(uint32_t trinketID, uint8_t firstTimePickingUp); // 007ad860 - void TriggerTrinketRemoved(uint32_t trinketID); // 007adb30 - void RestoreGameState(GameStatePlayer *saveState); // 007ae4b0 - uint8_t try_trigger_astral_projection(); // 007afc20 - void spawn_dark_esau(void *gameStatePlayer); // 007b0070 - void DonateLuck(int luck); // 007b2200 - void UseCard(int cardType, uint32_t useFlag); // 007b2230 - void update_footprints(); // 007b8cb0 - void SetFootprintColor(KColor color, uint8_t unk); // 007b98c0 - uint8_t is_footstep_triggered(int foot); // 007b9940 - void update_pitfall(); // 007b9b50 - void TryDecreaseGlowingHourglassUses(int unk1, uint8_t unk2); // 007b9e10 - uint8_t GetMouseAimTarget(Vector *outTarget, uint8_t isSkipNetCursor); // 007b9f60 - void update_baby_skin_effects(); // 007ba2b0 - void coop_baby_death_effect(); // 007bb5e0 - void InitPostLevelInitStats(); // 007bc740 - void update_player_skin(); // 007bebb0 - void InitBabySkin(); // 007bf040 - Entity_Laser * FireDelayedBrimstone(float angle, Entity *parent); // 007bf1a0 - uint8_t CanPickupItem(); // 007bf3d0 - uint8_t IsHoldingItem(); // 007bf490 - uint8_t IsHeldItemVisible(); // 007bf5c0 - void AddBlueSpider(Vector *position); // 007bf5f0 - Entity_Familiar * ThrowBlueSpider(Vector *position, Vector *target); // 007bf640 - void RemoveBlueSpider(); // 007bf660 - int GetExtraLives(); // 007bf670 - uint32_t GetGlitchBabySubType(); // 007c2e90 - uint8_t HasInvincibility(uint64_t damageFlags, EntityRef *source); // 007c3100 - uint8_t IsInvisible(); // 007c32c0 - uint8_t HasPoisonImmunity(); // 007c3320 - uint8_t CanCrushRocks(); // 007c3380 - uint8_t CanPickRedHearts(); // 007c3410 - uint8_t CanPickSoulHearts(); // 007c3460 - uint8_t CanPickBlackHearts(); // 007c3550 - void RemoveSkinCostume(); // 007c3620 - void ResetItemState(); // 007c36b0 - void SetShootingCooldown(int cooldown); // 007c37f0 - uint8_t NeedsCharge(int slot); // 007c3810 - uint8_t FullCharge(int slot, uint8_t isForce, uint8_t isOvercharge); // 007c38c0 - void add_random_stat_up(RNG *rng); // 007c3980 - void preload_item_sounds(); // 007c3a60 - uint8_t CanUsePill(int pillEffect); // 007c40e0 - void UsePill(int pillEffect, int pillColor, uint32_t useFlags); // 007c4180 - void AddDeadEyeCharge(); // 007c78b0 - void ClearDeadEyeCharge(); // 007c78e0 - int GetZodiacEffect(); // 007c7960 - static void update_purity_glow(Entity_Player *player); // 007c7c60 - void trigger_immaculate_conception(uint8_t isCambion); // 007c7d70 - static void AddImmaculateConceptionCounter(int param_1); // 007c8050 - void dash_impact(); // 007c8240 - void spawn_locusts(); // 007c8830 - Entity_Laser * SpawnMawOfVoid(int timeout); // 007c8dc0 - void AddGoldenBomb(); // 007c8f80 - void RemoveGoldenBomb(); // 007c8fc0 - void AddDollarBillEffect(); // 007c9000 - int GetCambionPregnancyLevel(); // 007c90b0 - Entity * ShootRedCandle(Vector *dir); // 007c9130 - Entity * ShootBlueCandle(Vector *dir); // 007c9350 - void DoZitEffect(Vector *direction); // 007c9590 - static void apply_victory_lap_penalty(uint32_t param_1); // 007c97f0 - float get_voice_pitch(); // 007c9ad0 - void AddJarFlies(int amount); // 007c9bb0 - uint8_t IsPosInSpotLight(Vector *position); // 007c9c00 - void AddGoldenHearts(int amount, uint8_t retBool); // 007c9d10 - uint8_t CanPickGoldenHearts(); // 007c9e30 - void UpdateHeartDependentEffects(); // 007c9ea0 - void BreakGoldenHearts(int count); // 007ca2d0 - void ClampGoldenHearts(uint8_t isSkipBreak); // 007ca7c0 - void AddBoneHearts(int amount); // 007ca840 - uint8_t CanPickBoneHearts(); // 007caa00 - uint8_t IsBoneHeart(int heart); // 007caaa0 - uint8_t TryPreventDeath(); // 007caad0 - void update_bone_hearts(); // 007cabc0 - void ClampHeartsToLimit(int heartType, int amount); // 007cacb0 - int GetHeartLimit(uint8_t isKeeperBypass); // 007cae60 - int GetHealthType(); // 007cafe0 - int GetEffectiveMaxHearts(); // 007cb060 - void apply_coop_baby_spawn_bonus(); // 007cb090 - uint8_t IsFullSpriteRendering(); // 007cb580 - int GetTrinketMultiplier(uint32_t type); // 007cb6e0 - void UpdateCanShoot(); // 007cba30 - uint8_t WillPlayerRevive(); // 007cbb60 - float GetGreedDonationBreakChance(); // 007cbb70 - float GetGreedDonationJamChance(PersistentGameData *data); // 007cbb90 - void hallowed_ground_add(int count); // 007cbc60 - static void resolve_tainted_soul(); // 007cbcb0 - void init_forgotten_twin(); // 007cbcd0 - Entity * spawn_forgotten_body(); // 007cbef0 - uint8_t SwapForgottenForm(uint8_t isForce, uint8_t isNoEffects); // 007cc200 - Entity_Player * GetMainPlayer(); // 007ce270 - uint8_t CanRerollCollectible(int id, uint8_t unk); // 007ce2a0 - int GetGreedsGulletHearts(); // 007ce390 - void update_greeds_gullet(); // 007ce420 - void ChangePlayerType(int playerType, uint8_t unk); // 007ce6e0 - void RemoveCollectible(int param_2); // 007cf610 - uint8_t IsLocalPlayer(); // 007cf8c0 - void GetGlyphOfBalanceDrop(int *variant, int *subtype); // 007d12c0 - void GetEnterPosition(Vector *buffer); // 007d1620 - Entity_Familiar * AddMinisaac(Vector *position, uint8_t isPlayAnim); // 007d1860 - static uint32_t play_hurt_effects(); // 007d1c10 - Entity_Player * InitTwin(int playerType); // 007d2000 - uint8_t TryHoldEntity(Entity *entity); // 007d2170 - Entity * ThrowHeldEntity(Vector *Velocity); // 007d2470 - void AddFriendlyDip(int subtype, Vector *position); // 007d2a00 - void ThrowFriendlyDip(int subtype, Vector *position, Vector *target); // 007d2a20 - void AddBrokenHearts(int amount); // 007d2a40 - void AddSoulCharge(int count); // 007d2ad0 - int GetEffectiveSoulCharge(); // 007d2b50 - void apply_soul_charge_to_actives(int oldSoulCharge); // 007d2b70 - void AddBloodCharge(int amount); // 007d2d40 - int GetEffectiveBloodCharge(); // 007d2dd0 - void blood_charge_changed(int oldBloodCharge); // 007d2df0 - void AddRottenHearts(int amount, uint8_t unk); // 007d2fc0 - bool CanPickRottenHearts(); // 007d3180 - void UpdateBookOfVirtues(uint8_t addedBookOfVirtues); // 007d3200 - void trigger_vampire_charm_kill(); // 007d3350 - void AddUrnSouls(uint32_t amount); // 007d3480 - void AddGigaBombs(int amount); // 007d34f0 - uint8_t try_end_astral_projection(); // 007d35b0 - void fire_saturnus_tears(); // 007d3e40 - int GetMaxInventorySize(); // 007d4150 - uint8_t CanAddCollectibleToInventory(int id); // 007d4170 - void SetPocketActiveItem(int collectible, int slot, uint8_t keepInPools); // 007d41d0 - static void get_salvation_scale(); // 007d4340 - void update_suplex(); // 007d4390 - static uint32_t bag_of_crafting_collect(Entity_Pickup *param_1); // 007d5170 - static int GetMaxPoopMana(); // 007d65c0 - void AddPoopMana(int amount); // 007d65e0 - void poop_spell_roll(); // 007d6670 - void UsePoopSpell(uint32_t param_2); // 007d7290 - void RecomputeWispCollectibles(Entity_Familiar *wisp); // 007d7740 - void trigger_cracked_orb(Vector *effectPos); // 007d7c30 - uint32_t AddItemCard(uint32_t itemID); // 007d8240 - void spawn_lil_clot_familiars(); // 007d83f0 - void creep_contact_add(int flags, int count); // 007d8740 - uint8_t spawn_ghost_corpse(); // 007d87a0 - void AddCurseMistEffect(); // 007d8980 - void RemoveCurseMistEffect(); // 007d8d20 - void AttachMinecart(Entity_NPC *minecart); // 007d9180 - void add_samson_berserk_charge(int amount); // 007d9200 - void RevivePlayerGhost(); // 007d93b0 - void MorphToCoopGhost(); // 007d96f0 - void reset_body_sprite(); // 007d9b70 - static uint32_t * CalculateBagOfCraftingOutput(uint32_t *output, uint8_t *bagContent, uint8_t unused); // 007d9d00 - void SpawnClot(Vector *pos, uint8_t unk); // 007da810 - uint8_t TryForgottenThrow(Vector *dir); // 007dac80 - void ResetPlayer(); // 007daed0 - void remove_wooden_cross_mantles(); // 007db160 - uint8_t HasInstantDeathCurse(); // 007db6b0 - uint8_t IsHologram(); // 007db700 - void TriggerEchoChamber(uint32_t pocketItemType, int cardOrPillColor); // 007db740 - int get_seeded_variant(); // 007db8d0 - uint8_t is_evil_charm_immune(EntityRef source); // 007dba30 - void add_random_drug_item_effect(); // 007dbba0 - void AddRandomMomItemEffect(); // 007dbc80 - void ModelingClay_roll(RNG *rng); // 007dbd70 - void twins_duplicate_familiars(int count); // 007dbeb0 - std_string * GetName(); // 007e9280 - long double GetSmoothBodyRotation(); // 007e92a0 - void TriggerRoomExit(); // 00832850 - int GetModelingClayEffect(); // 0083ab80 - int GetJarFlies(); // 00841ca0 - int GetActiveSubCharge(int slot); // 00841cb0 - int GetPoopSpell(int position); // 00841cd0 - uint8_t HasFullHeartsAndSoulHearts(); // 0085e200 - Vector * GetMovementVector(); // 0085e220 - Vector * GetRecentMovementVector(); // 0085e230 - int GetTearRangeModifier(); // 0085e240 - int ControlsCooldown(); // 0085e250 - void AddControlsCooldown(int param_2); // 0085e260 - EntityRef * GetLastDamageSource(); // 0085e270 - uint64_t GetLastDamageFlags(); // 0085e280 - int GetTotalDamageTaken(); // 0085e290 - int GetLastActionTriggers(); // 0085e2c0 - int GetBodyColor(); // 0085e2d0 - int GetHeadColor(); // 0085e2e0 - int GetNumGigaBombs(); // 0085e2f0 - void CheckPoopSpellQueue(Vector *param_2); // 0095ffb0 - static uint32_t restore_save_state_part2(); // 009d16ee - void AddTrinket(int param_2, char param_3); // 00a9f630 - - bool _isControlsEnabled; - uint8_t _pad_0x411[0x3]; - int _controlsCooldown; - int _fireBlockCooldown; - uint8_t _bodySprite[0x114]; // ANM2 - uint8_t _crownOfLightSprite[0x114]; // ANM2 - uint8_t _darkPrincesCrownSprite[0x114]; // ANM2 - uint8_t _chargeBarSprites[0x78c]; // ANM2[7] - uint8_t _bloodGushSprite[0x114]; // ANM2 - uint8_t _heldSprite[0x114]; // ANM2 - uint8_t _statusEffectSprite[0x114]; // ANM2 - std_vector _costumeSpriteDescs; - PlayerCostumeMap _playerCostumeMap[15]; - uint8_t _pad_0x12ef[0x31]; - std_string _headAnim; - int _blinkTime; - int _headDirectionTime; - int _maxHearts; - int _redHearts; - int _eternalHearts; - int _soulHearts; - int _blackHearts; - int _jarHearts; - int _jarFlies; - int _numKeys; - bool _hasGoldenKey; - bool _hasGoldenBomb; - uint8_t _pad_0x1362[0x2]; - int _numBombs; - int _numCoins; - int _numBlueFlies; - int _numBlueSpiders; - int _gnawedLeafTimer; - int _lastActionTriggers; - short _bloodLustCounter; - short _deadCatLives; - short _tonsilCounter; - short _tonsilCount; - short _numLeprosy; - uint8_t _pad_0x1386[0x2]; - int _metronomeCollectibleID; - int _bleedOutHealth; - int _threeDollarBillItem; - int _monkeyPawCounter; - bool _isPlayingExtraAnimation; - bool _isHurtPending; - bool _isPlayingItemAnimation; - uint8_t _pad_0x139b[0x1]; - std_string _queuedExtraAnimation; - uint8_t _holyMantleState; - uint8_t _pad_0x13b5[0x1]; - bool _isBrokenRemotePending; - uint8_t _pad_0x13b7[0x1]; - int _cursedPennyPending; - int _damageCooldown; - int _playerType; - std_string _name; - Weapon* _weapons[5]; - uint8_t _pad_0x13f0[0x1c]; - Entity_Effect* _markedTarget; - Entity* _heldEntity; - bool _isHeldEntityVisible; - uint8_t _pad_0x1415[0x3]; - int _heldEntityGridCollisionClass; - int _heldEntityCollisionClass; - uint8_t _pad_0x1420[0x10]; - int _tractorBeam; - uint8_t _pad_0x1434[0x10]; - uint8_t _breathOfLifeEffect[0x14]; // EntityPtr - Entity_Laser* _megaBlastLaser; - int _rUaWizardTimer; - float _maxfiredelay; - float _shotspeed; - uint8_t _pad_0x1468[0x4]; - int _firedTearCount; - float _damage; - float _tearheight; - float _tearfallspeed; - float _tearfallaccel; - float _tearrange; - uint8_t _pad_0x1484[0x4]; - BitSet128 _tearFlags; - uint8_t _pad_0x1494[0x4]; - ColorMod _tearColor; - ColorMod _laserColor; - Vector _playerSpriteScale; - Vector _bodyScale; - Vector _headScale; - TemporaryEffects _temporaryeffects; - int _speedModifier; - int _fireDelayModifier; - int _damageModifier; - int _tearRangeModifier; - int _shotSpeedModifier; - int _luckModifier; - int _donateLuck; - int _potatoPeelerCounter; - int _potatoPeelerBandageCounter; - short _greedsGulletHearts; - short _greedsGulletOverflow; - short _greedsGulletRedHearts; - bool _isUpdatingGreedsGullet; - uint8_t _pad_0x154b[0x1]; - float _edenSpeed; - float _edenFireDelay; - float _edenDamage; - float _edenTearRange; - float _edenShotSpeed; - float _edenLuck; - float _taurusSpeedBonus; - float _movespeed; - float _luck; - bool _canFly; - uint8_t _pad_0x1571[0x3]; - uint32_t _cacheFlags; - int8_t _tearDisplacement; - uint8_t _pad_0x1579[0x3]; - float _meleeDamage; - ActiveItemDesc _activeDesc[4]; - int _itemState; - int _itemStateCooldown; - uint32_t _vampireCharmKills; - uint8_t _pad_0x160c[0x4]; - int _bombPlaceDelay; - int _forgottenSwapFormCooldown; - int _controllerIndex; - int _playerIndex; - int _glowingHourglassIndex; - int _moveDirection; - int _headDirection; - int _fireDirection; - Vector _aimDirection; - bool _areOpposingShootDirectionsPressed; - uint8_t _pad_0x1639[0x3]; - Vector _lastDirection; - Vector _movementVector; - Vector _tearsOffset; - Vector _recentMovementVector; - int _slipperyTimer; - Vector _lastVelocity; - uint8_t _pad_0x1668[0x14]; - uint8_t _lastDamageSource[0x4]; // EntityRef - int _lastDamageSourceVariant; - int _lastDamageSpawnerType; - int _lastDamageSpawnerVariant; - uint8_t _pad_0x168c[0x1c]; - uint64_t _lastDamageFlags; - int _roomDamageTaken; - int _totalDamageTaken; - uint8_t _pad_0x16b8[0x8]; - uint32_t _trinketsID[2]; - std_vector _collectibleCounts; - std_vector _pillEffectUses; - uint8_t _pad_0x16e0[0x5c]; - std_vector _levelEffectItems; - std_vector _smeltedTrinkets; - std_vector _voidedCollectibles; - std_vector _voidedPassives; - int _extensionCordIndex; - std_vector _collectibleRNGs; - std_vector _trinketRNGs; - std_vector _pillRNGs; - std_vector _cardRNGs; - int _pocketSlots[8]; - uint32_t _actionHoldDrop; - QueueItemData _queuedItem; - uint8_t _pad_0x17cd[0xb]; - bool _isHeldItemVisible; - uint8_t _pad_0x17d9[0x3]; - int _playerForms[16]; - uint32_t _playerFormsRewarded; - uint8_t _pad_0x1820[0x4]; - bool _postLevelInitFinished; - bool _canShoot; - uint8_t _pad_0x1826[0x2]; - ColorMod _footprintColor1; - ColorMod _footprintColor2; - uint8_t _pad_0x1880[0x4]; - int _itemHoldCooldown; - int _ponyCharge; - int _planCKillCountdown; - short _brittleBonesUpgrades; - uint8_t _pad_0x1892[0x2]; - int _headColor; - int _bodyColor; - uint8_t _pad_0x189c[0x4]; - int _strengthMaxHearts; - int _epiphoraCharge; - uint8_t _pad_0x18a8[0x8]; - uint32_t _deadEyeCharges; - uint32_t _deadEyeMisses; - uint8_t _pad_0x18b8[0x4]; - uint32_t _mawOfTheVoidChargeTimer; - int _coopBabyBuffTimers[8]; - uint8_t _pad_0x18e0[0x8]; - uint32_t _imExcitedSpeedupCountdown; - uint8_t _pad_0x18ec[0x8]; - int _megaBlastDuration; - int _peeBurstCooldown; - int _maxPeeBurstCooldown; - int _bladderCharge; - int _maxBladderCharge; - bool _isUrethraBlocked; - uint8_t _pad_0x1909[0x3]; - int _nextUrethraBlockFrame; - EntityDesc _friendBallEnemy; - uint8_t _pad_0x1929[0x3]; - int _purityState; - int _immaculateConceptionState; - int _cambionConceptionState; - uint32_t _conceptionFamiliarFlags; - float _d8DamageModifier; - float _d8SpeedModifier; - float _d8RangeModifier; - float _d8FireDelayModifier; - int _goldenHearts; - uint8_t _pad_0x1950[0x194]; - float _bodyAngle; - int _flashCountdown; - int _babySkin; - uint8_t _pad_0x1af0[0x20]; - bool _hasBabyRoomShield; - uint8_t _pad_0x1b11[0x7]; - bool _isGlitchBaby; - uint8_t _pad_0x1b19[0x3]; - Vector _moveToTarget; - int _delayedSfxId; - float _delayedSfxVolume; - int _delayedSfxDelay; - int _delayedSfxFrameDelay; - uint8_t _pad_0x1b34[0x248]; - std_vector _movingBoxContents; - int _boneHearts; - int _boneHeartsMask; - int _hallowedGroundCountdown; - short _damageMultiplierStacks; - short _lastDamageMultiplierStacks; - int _subPlayer; - Entity_Familiar* _forgottenBody; - int _brokenHearts; - int _rottenHearts; - int _effectiveSoulCharge; - int _effectiveBloodCharge; - uint8_t _pad_0x1db0[0x20]; - uint32_t _urnSouls; - int _numGigaBombs; - uint8_t _pad_0x1dd8[0x4]; - std_vector _pendingWisps; - uint8_t _pad_0x1de8[0x4]; - History _history; - int _inventory[16]; - std_vector _contactHitList; - uint8_t _userProfile[0x8]; // UserProfile - std_deque _afterImageFrames; - uint8_t _twinPlayer[0x4]; // EntityPtr - Entity_Player* _backupPlayer; - float _heightVelocity; - int _redStewBonusDuration; - uint8_t _pad_0x1e78[0x8]; - uint8_t _salvationEffect[0xc]; // EntityPtr - int _marsUnk1; - int _marsCooldown; - int _marsUnk2; - bool _marsUnkBool; - uint8_t _pad_0x1e99[0x3]; - int _marsLastTapDirection; - int _marsTapFrames; - uint8_t _pad_0x1ea4[0x4]; - int _poisonDamageFrames; - uint8_t _astralProjectionBody[0x4]; // EntityPtr - float _rockBottomMoveSpeed; - float _rockBottomMaxFireDelay; - float _rockBottomDamage; - float _rockBottomTearRange; - float _rockBottomShotSpeed; - float _rockBottomLuck; - uint8_t _pad_0x1ec8[0x4]; - int _reverseEmpressMaxHearts; - int _reverseChariotMoveCooldown; - int _reverseSunBoneHearts; - uint8_t _pad_0x1ed8[0x4]; - uint32_t _revelationChargeTimer; - uint32_t _montezumaChargeTimer; - Entity* _montezumaLaser; - float _jupiterCharge; - uint8_t _holyMantleStacks; - uint8_t _pad_0x1eed[0x3]; - int _ductTapeMode; - uint32_t _maggyHealthDrainCooldown; - int _maggySwingCooldown; - float _jellyBellyBounceTimer; - uint8_t _pad_0x1f00[0x8]; - int _forgottenBodyRoomIdx; - Vector _forgottenBodyPos; - uint8_t _pad_0x1f14[0x4]; - std_deque _echoChamberItems; - int _suplexState; - int _suplexAimCountdown; - Vector _suplexTargetPos; - Vector _suplexLandPos; - char _bagOfCraftingContent[8]; - uint8_t _bagOfCraftingOutput[0x8]; // BagOfCraftingOutput - int _poopMana; - char _poopSpellQueue[6]; - uint8_t _pad_0x1f5e[0x1a]; - int _bagOfCraftingHoldFrames; - int _eveSumptoriumCharge; - std_map _itemWispsList; - float _forgottenBHeight; - float _forgottenBHeightVelocity; - uint8_t _pad_0x1f90[0x14]; - std_vector _itemCards; - std_map _roomTemporaryCollectibles; - int _modelingClayEffect; - int _keepersSackBonus; - uint8_t _darkEsau[0x4]; // EntityPtr - bool _isLevelStartPending; - uint8_t _pad_0x1fc5[0x3]; - PlayerProceduralItems _proceduralItems; - uint8_t _pad_0x1fd0[0x4]; - std_vector _extraCollectibleCounts; - std_vector _extraTrinketCounts; - uint8_t _pad_0x1fec[0x18]; - bool _darkArtsBlastPending; - uint8_t _pad_0x2005[0x3]; - float _darkArtsDamage; - Entity* _darkArtsLastSnare; - std_vector _darkArtsHitList; - uint8_t _shadowImage[8]; - int _grantedCollectibleCountdown; - uint32_t _grantedCollectibleFlags; - bool _hasCurseMistEffect; - uint8_t _pad_0x202d[0x3]; - ConsumableData _consumablesBackup; - std_vector _curseMistFamiliars; - int _curseMistRedHearts; - int _curseMistPocketSlots[8]; - uint32_t _curseMistTrinkets[2]; - Vector _minecartOffset; - uint8_t _wildCardItemType; - uint8_t _pad_0x2091[0x3]; - int _wildCardItem; - int _wildCardVarData; - int _samsonBerserkCharge; - float _ibsCharge; - uint8_t _pad_0x20a4[0x5]; - bool _isCoopGhost; - uint8_t _pad_0x20aa[0x2]; - int _ghostPocketSlots[8]; - uint32_t _ghostTrinkets[2]; - PlayerHUD* _playerHUD; - uint8_t _pad_0x20d8[0x4]; - std_vector _greedResetCollectibles; - bool _hasUnlistedRestoreState; - uint8_t _pad_0x20e9[0x3]; - uint8_t _unlistedRestoreState[0x5dc]; // GameStatePlayer - Entity_Player* _replacedPlayer; - uint8_t _pad_0x26cc[0x834]; -}; -LAYOUT32(offsetof(Entity_Player, _isControlsEnabled) == 0x410); -LAYOUT32(offsetof(Entity_Player, _controlsCooldown) == 0x414); -LAYOUT32(offsetof(Entity_Player, _fireBlockCooldown) == 0x418); -LAYOUT32(offsetof(Entity_Player, _bodySprite) == 0x41c); -LAYOUT32(offsetof(Entity_Player, _crownOfLightSprite) == 0x530); -LAYOUT32(offsetof(Entity_Player, _darkPrincesCrownSprite) == 0x644); -LAYOUT32(offsetof(Entity_Player, _chargeBarSprites) == 0x758); -LAYOUT32(offsetof(Entity_Player, _bloodGushSprite) == 0xee4); -LAYOUT32(offsetof(Entity_Player, _heldSprite) == 0xff8); -LAYOUT32(offsetof(Entity_Player, _statusEffectSprite) == 0x110c); -LAYOUT32(offsetof(Entity_Player, _costumeSpriteDescs) == 0x1220); -LAYOUT32(offsetof(Entity_Player, _playerCostumeMap) == 0x122c); -LAYOUT32(offsetof(Entity_Player, _headAnim) == 0x1320); -LAYOUT32(offsetof(Entity_Player, _blinkTime) == 0x1338); -LAYOUT32(offsetof(Entity_Player, _headDirectionTime) == 0x133c); -LAYOUT32(offsetof(Entity_Player, _maxHearts) == 0x1340); -LAYOUT32(offsetof(Entity_Player, _redHearts) == 0x1344); -LAYOUT32(offsetof(Entity_Player, _eternalHearts) == 0x1348); -LAYOUT32(offsetof(Entity_Player, _soulHearts) == 0x134c); -LAYOUT32(offsetof(Entity_Player, _blackHearts) == 0x1350); -LAYOUT32(offsetof(Entity_Player, _jarHearts) == 0x1354); -LAYOUT32(offsetof(Entity_Player, _jarFlies) == 0x1358); -LAYOUT32(offsetof(Entity_Player, _numKeys) == 0x135c); -LAYOUT32(offsetof(Entity_Player, _hasGoldenKey) == 0x1360); -LAYOUT32(offsetof(Entity_Player, _hasGoldenBomb) == 0x1361); -LAYOUT32(offsetof(Entity_Player, _numBombs) == 0x1364); -LAYOUT32(offsetof(Entity_Player, _numCoins) == 0x1368); -LAYOUT32(offsetof(Entity_Player, _numBlueFlies) == 0x136c); -LAYOUT32(offsetof(Entity_Player, _numBlueSpiders) == 0x1370); -LAYOUT32(offsetof(Entity_Player, _gnawedLeafTimer) == 0x1374); -LAYOUT32(offsetof(Entity_Player, _lastActionTriggers) == 0x1378); -LAYOUT32(offsetof(Entity_Player, _bloodLustCounter) == 0x137c); -LAYOUT32(offsetof(Entity_Player, _deadCatLives) == 0x137e); -LAYOUT32(offsetof(Entity_Player, _tonsilCounter) == 0x1380); -LAYOUT32(offsetof(Entity_Player, _tonsilCount) == 0x1382); -LAYOUT32(offsetof(Entity_Player, _numLeprosy) == 0x1384); -LAYOUT32(offsetof(Entity_Player, _metronomeCollectibleID) == 0x1388); -LAYOUT32(offsetof(Entity_Player, _bleedOutHealth) == 0x138c); -LAYOUT32(offsetof(Entity_Player, _threeDollarBillItem) == 0x1390); -LAYOUT32(offsetof(Entity_Player, _monkeyPawCounter) == 0x1394); -LAYOUT32(offsetof(Entity_Player, _isPlayingExtraAnimation) == 0x1398); -LAYOUT32(offsetof(Entity_Player, _isHurtPending) == 0x1399); -LAYOUT32(offsetof(Entity_Player, _isPlayingItemAnimation) == 0x139a); -LAYOUT32(offsetof(Entity_Player, _queuedExtraAnimation) == 0x139c); -LAYOUT32(offsetof(Entity_Player, _holyMantleState) == 0x13b4); -LAYOUT32(offsetof(Entity_Player, _isBrokenRemotePending) == 0x13b6); -LAYOUT32(offsetof(Entity_Player, _cursedPennyPending) == 0x13b8); -LAYOUT32(offsetof(Entity_Player, _damageCooldown) == 0x13bc); -LAYOUT32(offsetof(Entity_Player, _playerType) == 0x13c0); -LAYOUT32(offsetof(Entity_Player, _name) == 0x13c4); -LAYOUT32(offsetof(Entity_Player, _weapons) == 0x13dc); -LAYOUT32(offsetof(Entity_Player, _markedTarget) == 0x140c); -LAYOUT32(offsetof(Entity_Player, _heldEntity) == 0x1410); -LAYOUT32(offsetof(Entity_Player, _isHeldEntityVisible) == 0x1414); -LAYOUT32(offsetof(Entity_Player, _heldEntityGridCollisionClass) == 0x1418); -LAYOUT32(offsetof(Entity_Player, _heldEntityCollisionClass) == 0x141c); -LAYOUT32(offsetof(Entity_Player, _tractorBeam) == 0x1430); -LAYOUT32(offsetof(Entity_Player, _breathOfLifeEffect) == 0x1444); -LAYOUT32(offsetof(Entity_Player, _megaBlastLaser) == 0x1458); -LAYOUT32(offsetof(Entity_Player, _rUaWizardTimer) == 0x145c); -LAYOUT32(offsetof(Entity_Player, _maxfiredelay) == 0x1460); -LAYOUT32(offsetof(Entity_Player, _shotspeed) == 0x1464); -LAYOUT32(offsetof(Entity_Player, _firedTearCount) == 0x146c); -LAYOUT32(offsetof(Entity_Player, _damage) == 0x1470); -LAYOUT32(offsetof(Entity_Player, _tearheight) == 0x1474); -LAYOUT32(offsetof(Entity_Player, _tearfallspeed) == 0x1478); -LAYOUT32(offsetof(Entity_Player, _tearfallaccel) == 0x147c); -LAYOUT32(offsetof(Entity_Player, _tearrange) == 0x1480); -LAYOUT32(offsetof(Entity_Player, _tearFlags) == 0x1488); -LAYOUT32(offsetof(Entity_Player, _tearColor) == 0x1498); -LAYOUT32(offsetof(Entity_Player, _laserColor) == 0x14c4); -LAYOUT32(offsetof(Entity_Player, _playerSpriteScale) == 0x14f0); -LAYOUT32(offsetof(Entity_Player, _bodyScale) == 0x14f8); -LAYOUT32(offsetof(Entity_Player, _headScale) == 0x1500); -LAYOUT32(offsetof(Entity_Player, _temporaryeffects) == 0x1508); -LAYOUT32(offsetof(Entity_Player, _speedModifier) == 0x1520); -LAYOUT32(offsetof(Entity_Player, _fireDelayModifier) == 0x1524); -LAYOUT32(offsetof(Entity_Player, _damageModifier) == 0x1528); -LAYOUT32(offsetof(Entity_Player, _tearRangeModifier) == 0x152c); -LAYOUT32(offsetof(Entity_Player, _shotSpeedModifier) == 0x1530); -LAYOUT32(offsetof(Entity_Player, _luckModifier) == 0x1534); -LAYOUT32(offsetof(Entity_Player, _donateLuck) == 0x1538); -LAYOUT32(offsetof(Entity_Player, _potatoPeelerCounter) == 0x153c); -LAYOUT32(offsetof(Entity_Player, _potatoPeelerBandageCounter) == 0x1540); -LAYOUT32(offsetof(Entity_Player, _greedsGulletHearts) == 0x1544); -LAYOUT32(offsetof(Entity_Player, _greedsGulletOverflow) == 0x1546); -LAYOUT32(offsetof(Entity_Player, _greedsGulletRedHearts) == 0x1548); -LAYOUT32(offsetof(Entity_Player, _isUpdatingGreedsGullet) == 0x154a); -LAYOUT32(offsetof(Entity_Player, _edenSpeed) == 0x154c); -LAYOUT32(offsetof(Entity_Player, _edenFireDelay) == 0x1550); -LAYOUT32(offsetof(Entity_Player, _edenDamage) == 0x1554); -LAYOUT32(offsetof(Entity_Player, _edenTearRange) == 0x1558); -LAYOUT32(offsetof(Entity_Player, _edenShotSpeed) == 0x155c); -LAYOUT32(offsetof(Entity_Player, _edenLuck) == 0x1560); -LAYOUT32(offsetof(Entity_Player, _taurusSpeedBonus) == 0x1564); -LAYOUT32(offsetof(Entity_Player, _movespeed) == 0x1568); -LAYOUT32(offsetof(Entity_Player, _luck) == 0x156c); -LAYOUT32(offsetof(Entity_Player, _canFly) == 0x1570); -LAYOUT32(offsetof(Entity_Player, _cacheFlags) == 0x1574); -LAYOUT32(offsetof(Entity_Player, _tearDisplacement) == 0x1578); -LAYOUT32(offsetof(Entity_Player, _meleeDamage) == 0x157c); -LAYOUT32(offsetof(Entity_Player, _activeDesc) == 0x1580); -LAYOUT32(offsetof(Entity_Player, _itemState) == 0x1600); -LAYOUT32(offsetof(Entity_Player, _itemStateCooldown) == 0x1604); -LAYOUT32(offsetof(Entity_Player, _vampireCharmKills) == 0x1608); -LAYOUT32(offsetof(Entity_Player, _bombPlaceDelay) == 0x1610); -LAYOUT32(offsetof(Entity_Player, _forgottenSwapFormCooldown) == 0x1614); -LAYOUT32(offsetof(Entity_Player, _controllerIndex) == 0x1618); -LAYOUT32(offsetof(Entity_Player, _playerIndex) == 0x161c); -LAYOUT32(offsetof(Entity_Player, _glowingHourglassIndex) == 0x1620); -LAYOUT32(offsetof(Entity_Player, _moveDirection) == 0x1624); -LAYOUT32(offsetof(Entity_Player, _headDirection) == 0x1628); -LAYOUT32(offsetof(Entity_Player, _fireDirection) == 0x162c); -LAYOUT32(offsetof(Entity_Player, _aimDirection) == 0x1630); -LAYOUT32(offsetof(Entity_Player, _areOpposingShootDirectionsPressed) == 0x1638); -LAYOUT32(offsetof(Entity_Player, _lastDirection) == 0x163c); -LAYOUT32(offsetof(Entity_Player, _movementVector) == 0x1644); -LAYOUT32(offsetof(Entity_Player, _tearsOffset) == 0x164c); -LAYOUT32(offsetof(Entity_Player, _recentMovementVector) == 0x1654); -LAYOUT32(offsetof(Entity_Player, _slipperyTimer) == 0x165c); -LAYOUT32(offsetof(Entity_Player, _lastVelocity) == 0x1660); -LAYOUT32(offsetof(Entity_Player, _lastDamageSource) == 0x167c); -LAYOUT32(offsetof(Entity_Player, _lastDamageSourceVariant) == 0x1680); -LAYOUT32(offsetof(Entity_Player, _lastDamageSpawnerType) == 0x1684); -LAYOUT32(offsetof(Entity_Player, _lastDamageSpawnerVariant) == 0x1688); -LAYOUT32(offsetof(Entity_Player, _lastDamageFlags) == 0x16a8); -LAYOUT32(offsetof(Entity_Player, _roomDamageTaken) == 0x16b0); -LAYOUT32(offsetof(Entity_Player, _totalDamageTaken) == 0x16b4); -LAYOUT32(offsetof(Entity_Player, _trinketsID) == 0x16c0); -LAYOUT32(offsetof(Entity_Player, _collectibleCounts) == 0x16c8); -LAYOUT32(offsetof(Entity_Player, _pillEffectUses) == 0x16d4); -LAYOUT32(offsetof(Entity_Player, _levelEffectItems) == 0x173c); -LAYOUT32(offsetof(Entity_Player, _smeltedTrinkets) == 0x1748); -LAYOUT32(offsetof(Entity_Player, _voidedCollectibles) == 0x1754); -LAYOUT32(offsetof(Entity_Player, _voidedPassives) == 0x1760); -LAYOUT32(offsetof(Entity_Player, _extensionCordIndex) == 0x176c); -LAYOUT32(offsetof(Entity_Player, _collectibleRNGs) == 0x1770); -LAYOUT32(offsetof(Entity_Player, _trinketRNGs) == 0x177c); -LAYOUT32(offsetof(Entity_Player, _pillRNGs) == 0x1788); -LAYOUT32(offsetof(Entity_Player, _cardRNGs) == 0x1794); -LAYOUT32(offsetof(Entity_Player, _pocketSlots) == 0x17a0); -LAYOUT32(offsetof(Entity_Player, _actionHoldDrop) == 0x17c0); -LAYOUT32(offsetof(Entity_Player, _queuedItem) == 0x17c4); -LAYOUT32(offsetof(Entity_Player, _isHeldItemVisible) == 0x17d8); -LAYOUT32(offsetof(Entity_Player, _playerForms) == 0x17dc); -LAYOUT32(offsetof(Entity_Player, _playerFormsRewarded) == 0x181c); -LAYOUT32(offsetof(Entity_Player, _postLevelInitFinished) == 0x1824); -LAYOUT32(offsetof(Entity_Player, _canShoot) == 0x1825); -LAYOUT32(offsetof(Entity_Player, _footprintColor1) == 0x1828); -LAYOUT32(offsetof(Entity_Player, _footprintColor2) == 0x1854); -LAYOUT32(offsetof(Entity_Player, _itemHoldCooldown) == 0x1884); -LAYOUT32(offsetof(Entity_Player, _ponyCharge) == 0x1888); -LAYOUT32(offsetof(Entity_Player, _planCKillCountdown) == 0x188c); -LAYOUT32(offsetof(Entity_Player, _brittleBonesUpgrades) == 0x1890); -LAYOUT32(offsetof(Entity_Player, _headColor) == 0x1894); -LAYOUT32(offsetof(Entity_Player, _bodyColor) == 0x1898); -LAYOUT32(offsetof(Entity_Player, _strengthMaxHearts) == 0x18a0); -LAYOUT32(offsetof(Entity_Player, _epiphoraCharge) == 0x18a4); -LAYOUT32(offsetof(Entity_Player, _deadEyeCharges) == 0x18b0); -LAYOUT32(offsetof(Entity_Player, _deadEyeMisses) == 0x18b4); -LAYOUT32(offsetof(Entity_Player, _mawOfTheVoidChargeTimer) == 0x18bc); -LAYOUT32(offsetof(Entity_Player, _coopBabyBuffTimers) == 0x18c0); -LAYOUT32(offsetof(Entity_Player, _imExcitedSpeedupCountdown) == 0x18e8); -LAYOUT32(offsetof(Entity_Player, _megaBlastDuration) == 0x18f4); -LAYOUT32(offsetof(Entity_Player, _peeBurstCooldown) == 0x18f8); -LAYOUT32(offsetof(Entity_Player, _maxPeeBurstCooldown) == 0x18fc); -LAYOUT32(offsetof(Entity_Player, _bladderCharge) == 0x1900); -LAYOUT32(offsetof(Entity_Player, _maxBladderCharge) == 0x1904); -LAYOUT32(offsetof(Entity_Player, _isUrethraBlocked) == 0x1908); -LAYOUT32(offsetof(Entity_Player, _nextUrethraBlockFrame) == 0x190c); -LAYOUT32(offsetof(Entity_Player, _friendBallEnemy) == 0x1910); -LAYOUT32(offsetof(Entity_Player, _purityState) == 0x192c); -LAYOUT32(offsetof(Entity_Player, _immaculateConceptionState) == 0x1930); -LAYOUT32(offsetof(Entity_Player, _cambionConceptionState) == 0x1934); -LAYOUT32(offsetof(Entity_Player, _conceptionFamiliarFlags) == 0x1938); -LAYOUT32(offsetof(Entity_Player, _d8DamageModifier) == 0x193c); -LAYOUT32(offsetof(Entity_Player, _d8SpeedModifier) == 0x1940); -LAYOUT32(offsetof(Entity_Player, _d8RangeModifier) == 0x1944); -LAYOUT32(offsetof(Entity_Player, _d8FireDelayModifier) == 0x1948); -LAYOUT32(offsetof(Entity_Player, _goldenHearts) == 0x194c); -LAYOUT32(offsetof(Entity_Player, _bodyAngle) == 0x1ae4); -LAYOUT32(offsetof(Entity_Player, _flashCountdown) == 0x1ae8); -LAYOUT32(offsetof(Entity_Player, _babySkin) == 0x1aec); -LAYOUT32(offsetof(Entity_Player, _hasBabyRoomShield) == 0x1b10); -LAYOUT32(offsetof(Entity_Player, _isGlitchBaby) == 0x1b18); -LAYOUT32(offsetof(Entity_Player, _moveToTarget) == 0x1b1c); -LAYOUT32(offsetof(Entity_Player, _delayedSfxId) == 0x1b24); -LAYOUT32(offsetof(Entity_Player, _delayedSfxVolume) == 0x1b28); -LAYOUT32(offsetof(Entity_Player, _delayedSfxDelay) == 0x1b2c); -LAYOUT32(offsetof(Entity_Player, _delayedSfxFrameDelay) == 0x1b30); -LAYOUT32(offsetof(Entity_Player, _movingBoxContents) == 0x1d7c); -LAYOUT32(offsetof(Entity_Player, _boneHearts) == 0x1d88); -LAYOUT32(offsetof(Entity_Player, _boneHeartsMask) == 0x1d8c); -LAYOUT32(offsetof(Entity_Player, _hallowedGroundCountdown) == 0x1d90); -LAYOUT32(offsetof(Entity_Player, _damageMultiplierStacks) == 0x1d94); -LAYOUT32(offsetof(Entity_Player, _lastDamageMultiplierStacks) == 0x1d96); -LAYOUT32(offsetof(Entity_Player, _subPlayer) == 0x1d98); -LAYOUT32(offsetof(Entity_Player, _forgottenBody) == 0x1d9c); -LAYOUT32(offsetof(Entity_Player, _brokenHearts) == 0x1da0); -LAYOUT32(offsetof(Entity_Player, _rottenHearts) == 0x1da4); -LAYOUT32(offsetof(Entity_Player, _effectiveSoulCharge) == 0x1da8); -LAYOUT32(offsetof(Entity_Player, _effectiveBloodCharge) == 0x1dac); -LAYOUT32(offsetof(Entity_Player, _urnSouls) == 0x1dd0); -LAYOUT32(offsetof(Entity_Player, _numGigaBombs) == 0x1dd4); -LAYOUT32(offsetof(Entity_Player, _pendingWisps) == 0x1ddc); -LAYOUT32(offsetof(Entity_Player, _history) == 0x1dec); -LAYOUT32(offsetof(Entity_Player, _inventory) == 0x1e00); -LAYOUT32(offsetof(Entity_Player, _contactHitList) == 0x1e40); -LAYOUT32(offsetof(Entity_Player, _userProfile) == 0x1e4c); -LAYOUT32(offsetof(Entity_Player, _afterImageFrames) == 0x1e54); -LAYOUT32(offsetof(Entity_Player, _twinPlayer) == 0x1e68); -LAYOUT32(offsetof(Entity_Player, _backupPlayer) == 0x1e6c); -LAYOUT32(offsetof(Entity_Player, _heightVelocity) == 0x1e70); -LAYOUT32(offsetof(Entity_Player, _redStewBonusDuration) == 0x1e74); -LAYOUT32(offsetof(Entity_Player, _salvationEffect) == 0x1e80); -LAYOUT32(offsetof(Entity_Player, _marsUnk1) == 0x1e8c); -LAYOUT32(offsetof(Entity_Player, _marsCooldown) == 0x1e90); -LAYOUT32(offsetof(Entity_Player, _marsUnk2) == 0x1e94); -LAYOUT32(offsetof(Entity_Player, _marsUnkBool) == 0x1e98); -LAYOUT32(offsetof(Entity_Player, _marsLastTapDirection) == 0x1e9c); -LAYOUT32(offsetof(Entity_Player, _marsTapFrames) == 0x1ea0); -LAYOUT32(offsetof(Entity_Player, _poisonDamageFrames) == 0x1ea8); -LAYOUT32(offsetof(Entity_Player, _astralProjectionBody) == 0x1eac); -LAYOUT32(offsetof(Entity_Player, _rockBottomMoveSpeed) == 0x1eb0); -LAYOUT32(offsetof(Entity_Player, _rockBottomMaxFireDelay) == 0x1eb4); -LAYOUT32(offsetof(Entity_Player, _rockBottomDamage) == 0x1eb8); -LAYOUT32(offsetof(Entity_Player, _rockBottomTearRange) == 0x1ebc); -LAYOUT32(offsetof(Entity_Player, _rockBottomShotSpeed) == 0x1ec0); -LAYOUT32(offsetof(Entity_Player, _rockBottomLuck) == 0x1ec4); -LAYOUT32(offsetof(Entity_Player, _reverseEmpressMaxHearts) == 0x1ecc); -LAYOUT32(offsetof(Entity_Player, _reverseChariotMoveCooldown) == 0x1ed0); -LAYOUT32(offsetof(Entity_Player, _reverseSunBoneHearts) == 0x1ed4); -LAYOUT32(offsetof(Entity_Player, _revelationChargeTimer) == 0x1edc); -LAYOUT32(offsetof(Entity_Player, _montezumaChargeTimer) == 0x1ee0); -LAYOUT32(offsetof(Entity_Player, _montezumaLaser) == 0x1ee4); -LAYOUT32(offsetof(Entity_Player, _jupiterCharge) == 0x1ee8); -LAYOUT32(offsetof(Entity_Player, _holyMantleStacks) == 0x1eec); -LAYOUT32(offsetof(Entity_Player, _ductTapeMode) == 0x1ef0); -LAYOUT32(offsetof(Entity_Player, _maggyHealthDrainCooldown) == 0x1ef4); -LAYOUT32(offsetof(Entity_Player, _maggySwingCooldown) == 0x1ef8); -LAYOUT32(offsetof(Entity_Player, _jellyBellyBounceTimer) == 0x1efc); -LAYOUT32(offsetof(Entity_Player, _forgottenBodyRoomIdx) == 0x1f08); -LAYOUT32(offsetof(Entity_Player, _forgottenBodyPos) == 0x1f0c); -LAYOUT32(offsetof(Entity_Player, _echoChamberItems) == 0x1f18); -LAYOUT32(offsetof(Entity_Player, _suplexState) == 0x1f2c); -LAYOUT32(offsetof(Entity_Player, _suplexAimCountdown) == 0x1f30); -LAYOUT32(offsetof(Entity_Player, _suplexTargetPos) == 0x1f34); -LAYOUT32(offsetof(Entity_Player, _suplexLandPos) == 0x1f3c); -LAYOUT32(offsetof(Entity_Player, _bagOfCraftingContent) == 0x1f44); -LAYOUT32(offsetof(Entity_Player, _bagOfCraftingOutput) == 0x1f4c); -LAYOUT32(offsetof(Entity_Player, _poopMana) == 0x1f54); -LAYOUT32(offsetof(Entity_Player, _poopSpellQueue) == 0x1f58); -LAYOUT32(offsetof(Entity_Player, _bagOfCraftingHoldFrames) == 0x1f78); -LAYOUT32(offsetof(Entity_Player, _eveSumptoriumCharge) == 0x1f7c); -LAYOUT32(offsetof(Entity_Player, _itemWispsList) == 0x1f80); -LAYOUT32(offsetof(Entity_Player, _forgottenBHeight) == 0x1f88); -LAYOUT32(offsetof(Entity_Player, _forgottenBHeightVelocity) == 0x1f8c); -LAYOUT32(offsetof(Entity_Player, _itemCards) == 0x1fa4); -LAYOUT32(offsetof(Entity_Player, _roomTemporaryCollectibles) == 0x1fb0); -LAYOUT32(offsetof(Entity_Player, _modelingClayEffect) == 0x1fb8); -LAYOUT32(offsetof(Entity_Player, _keepersSackBonus) == 0x1fbc); -LAYOUT32(offsetof(Entity_Player, _darkEsau) == 0x1fc0); -LAYOUT32(offsetof(Entity_Player, _isLevelStartPending) == 0x1fc4); -LAYOUT32(offsetof(Entity_Player, _proceduralItems) == 0x1fc8); -LAYOUT32(offsetof(Entity_Player, _extraCollectibleCounts) == 0x1fd4); -LAYOUT32(offsetof(Entity_Player, _extraTrinketCounts) == 0x1fe0); -LAYOUT32(offsetof(Entity_Player, _darkArtsBlastPending) == 0x2004); -LAYOUT32(offsetof(Entity_Player, _darkArtsDamage) == 0x2008); -LAYOUT32(offsetof(Entity_Player, _darkArtsLastSnare) == 0x200c); -LAYOUT32(offsetof(Entity_Player, _darkArtsHitList) == 0x2010); -LAYOUT32(offsetof(Entity_Player, _shadowImage) == 0x201c); -LAYOUT32(offsetof(Entity_Player, _grantedCollectibleCountdown) == 0x2024); -LAYOUT32(offsetof(Entity_Player, _grantedCollectibleFlags) == 0x2028); -LAYOUT32(offsetof(Entity_Player, _hasCurseMistEffect) == 0x202c); -LAYOUT32(offsetof(Entity_Player, _consumablesBackup) == 0x2030); -LAYOUT32(offsetof(Entity_Player, _curseMistFamiliars) == 0x2050); -LAYOUT32(offsetof(Entity_Player, _curseMistRedHearts) == 0x205c); -LAYOUT32(offsetof(Entity_Player, _curseMistPocketSlots) == 0x2060); -LAYOUT32(offsetof(Entity_Player, _curseMistTrinkets) == 0x2080); -LAYOUT32(offsetof(Entity_Player, _minecartOffset) == 0x2088); -LAYOUT32(offsetof(Entity_Player, _wildCardItemType) == 0x2090); -LAYOUT32(offsetof(Entity_Player, _wildCardItem) == 0x2094); -LAYOUT32(offsetof(Entity_Player, _wildCardVarData) == 0x2098); -LAYOUT32(offsetof(Entity_Player, _samsonBerserkCharge) == 0x209c); -LAYOUT32(offsetof(Entity_Player, _ibsCharge) == 0x20a0); -LAYOUT32(offsetof(Entity_Player, _isCoopGhost) == 0x20a9); -LAYOUT32(offsetof(Entity_Player, _ghostPocketSlots) == 0x20ac); -LAYOUT32(offsetof(Entity_Player, _ghostTrinkets) == 0x20cc); -LAYOUT32(offsetof(Entity_Player, _playerHUD) == 0x20d4); -LAYOUT32(offsetof(Entity_Player, _greedResetCollectibles) == 0x20dc); -LAYOUT32(offsetof(Entity_Player, _hasUnlistedRestoreState) == 0x20e8); -LAYOUT32(offsetof(Entity_Player, _unlistedRestoreState) == 0x20ec); -LAYOUT32(offsetof(Entity_Player, _replacedPlayer) == 0x26c8); -LAYOUT32(sizeof(Entity_Player) == 0x2f00); - -struct Entity_Projectile : Entity { - virtual ~Entity_Projectile(); // 00652b50 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 00652b90 slot 1 - void Update() override; // 00653070 slot 3 - void Interpolate() override; // 0065c510 slot 4 - void Render(Vector *offset) override; // 0065cb60 slot 5 - uint8_t CanShutDoors() override; // 00652f60 slot 18 - void HandleCollision() override; // 0065b670 slot 23 - uint64_t ProjectileFlags(); // 00417830 - void set_falling_accel(float accel); // 00444c90 - void set_projectile_flags(uint64_t flags); // 00447740 - void AddHeight(float param_2); // 00456420 - void AddFallingSpeed(float param_2); // 00456450 - void AddFallingAccel(float param_2); // 00456470 - void AddProjectileFlags(uint64_t flags); // 00456490 - int ChangeTimeout(); // 004b70a0 - long double CurvingStrength(); // 004d3060 - int WiggleFrameOffset(); // 004d3070 - void Constructor(); // 00652b00 - void Reflect(Entity *unused, Vector *newVelocity); // 00652fa0 - void update_height_collision(); // 0065b500 - void SetHeight(float height); // 00675fc0 - void Deflect(Entity *newSpawner, Vector *velocity); // 0067a080 - void AddChangeFlags(uint64_t flags); // 006b82f0 - long double Acceleration(); // 0085e300 - uint64_t ChangeFlags(); // 0085e310 - void AddScale(float param_2); // 0085e320 - long double Damage(); // 0085e360 - - float _height; - float _fallingSpeed; - float _fallingAccel; - float _damage; - float _scale; - float _homingStrength; - float _curvingStrength; - float _acceleration; - float _orbitDistance; - uint8_t _pad_0x434[0x4]; - uint64_t _projectileFlags; - bool _isRenderedAtGround; - uint8_t _pad_0x441[0x3]; - int _animKey; - int _wiggleFrameOffset; - uint8_t _pad_0x44c[0x4]; - uint64_t _changeFlags; - float _changeVelocity; - int _changeTimeout; - uint8_t _pad_0x460[0x18]; -}; -LAYOUT32(offsetof(Entity_Projectile, _height) == 0x410); -LAYOUT32(offsetof(Entity_Projectile, _fallingSpeed) == 0x414); -LAYOUT32(offsetof(Entity_Projectile, _fallingAccel) == 0x418); -LAYOUT32(offsetof(Entity_Projectile, _damage) == 0x41c); -LAYOUT32(offsetof(Entity_Projectile, _scale) == 0x420); -LAYOUT32(offsetof(Entity_Projectile, _homingStrength) == 0x424); -LAYOUT32(offsetof(Entity_Projectile, _curvingStrength) == 0x428); -LAYOUT32(offsetof(Entity_Projectile, _acceleration) == 0x42c); -LAYOUT32(offsetof(Entity_Projectile, _orbitDistance) == 0x430); -LAYOUT32(offsetof(Entity_Projectile, _projectileFlags) == 0x438); -LAYOUT32(offsetof(Entity_Projectile, _isRenderedAtGround) == 0x440); -LAYOUT32(offsetof(Entity_Projectile, _animKey) == 0x444); -LAYOUT32(offsetof(Entity_Projectile, _wiggleFrameOffset) == 0x448); -LAYOUT32(offsetof(Entity_Projectile, _changeFlags) == 0x450); -LAYOUT32(offsetof(Entity_Projectile, _changeVelocity) == 0x458); -LAYOUT32(offsetof(Entity_Projectile, _changeTimeout) == 0x45c); -LAYOUT32(sizeof(Entity_Projectile) == 0x478); - -struct Entity_Slot : Entity { - virtual ~Entity_Slot(); // 0065d130 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 0065d200 slot 1 - void Update() override; // 0065d950 slot 3 - void Render(Vector *offset) override; // 00665370 slot 5 - uint8_t TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) override; // 00664560 slot 8 - void HandleCollision() override; // 006627e0 slot 23 - void spawn_break_drops(); // 00663aa0 - void SetPrizeType(int prizeType); // 00665500 - - uint8_t _pad_0x410[0x140]; -}; -LAYOUT32(sizeof(Entity_Slot) == 0x550); - -struct Entity_Tear : Entity { - virtual ~Entity_Tear(); // 00665ea0 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 006660a0 slot 1 - void Update() override; // 006670f0 slot 3 - void Interpolate() override; // 00679400 slot 4 - void Render(Vector *offset) override; // 006790c0 slot 5 - void SetCollisionDamage(float param_2) override; // 00675fa0 slot 16 - void ClearReferences() override; // 006666c0 slot 17 - void HandleCollision() override; // 00673660 slot 23 - BitSet128 * TearFlags(BitSet128 *outFlags); // 004177c0 - long double Height(); // 00431750 - long double FallingAcceleration(); // 00435e50 - long double FallingSpeed(); // 00456440 - int TearIndex(); // 004aade0 - long double Scale(); // 00557cd0 - long double BaseScale(); // 0060ccb0 - long double Rotation(); // 0060ccc0 - void SetKnockbackMultiplier(float param_2); // 0060ccd0 - void SetWaitFrames(int param_2); // 0060cd00 - Entity_Player * GetRootPlayer(); // 00665b00 - void Constructor(); // 00665cf0 - void apply_wiggle(float strength); // 006668c0 - void update_wiggle(); // 00666ba0 - void play_fire_sound(); // 00666d40 - float get_height_offset_y(float height); // 00676020 - void SetScale(float scale); // 00676120 - void SetTearFlags(BitSet128 flags); // 00676150 - void apply_death_flag_effects(Entity *target); // 00676be0 - void ResetSpriteScale(); // 00677780 - uint8_t is_not_familiar_spawned(); // 00678060 - void fire_split_projectiles(uint8_t isHalved); // 00678080 - void SetDeadEyeIntensity(float intensity); // 00679e80 - Entity_Tear * MakeMultidimensionalCopy(Entity *spawner); // 0067a190 - void ChangeVariant(int variant); // 0067a400 - int find_nearest_linkable_tear(); // 0067a770 - Entity_Tear * find_link_partner(); // 0067a8f0 - void apply_link_spring_forces(); // 0067aaf0 - static uint8_t try_make_bridges(float *param_1); // 0067d560 - void reroll_hit_entity(int unused); // 006b5320 - long double BaseDamage(); // 0085dd60 - void SetParentOffset(Vector *offset); // 0085dd70 - Vector * PosDisplacement(); // 0085dd90 - - float _height; - float _fallingSpeed; - float _fallingAccel; - float _homingFriction; - float _fScale; - float _baseScale; - BitSet128 _tearFlags; - uint8_t _pad_0x434[0x4]; - int _waitFrames; - Vector _continueVelocity; - std_vector _hitList; - int _tearIdx; - float _baseDamage; - float _rotation; - int _scaleAnimNum; - float _knockbackMultiplier; - float _deadEyeIntensity; - bool _multidimensionalTouched; - bool _prismTouched; - bool _isFireSoundPending; - uint8_t _pad_0x46b[0x1]; - short _popBounceCount; - uint8_t _pad_0x46e[0x2]; - int _hitCount; - uint32_t _deathFlags; - Entity* _stickTarget; - Vector _stickDiff; - int _stickTimer; - uint8_t _techZeroLaser[0x4]; // EntityPtr - uint8_t _techZeroTarget[0x4]; // EntityPtr - uint8_t _laserShotLaser[0x4]; // EntityPtr - uint8_t _linkPrev[0x4]; // EntityPtr - uint8_t _linkNext[0x4]; // EntityPtr - uint8_t _attachedEffect[0x10]; // EntityPtr - uint8_t _tearHaloANM2[0x114]; // ANM2 - uint8_t _tearEffectANM2[0x114]; // ANM2 - uint8_t _deadEyeANM2[0x114]; // ANM2 - bool _canTriggerStreakEnd; - bool _isHovering; - bool _isFireSoundMuted; - uint8_t _pad_0x7eb[0x1]; - Vector _posDisplacement; - Vector _parentOffset; - int _holdTimer; - Vector _holdOffset; - Vector _holdVelocity; - Vector _orbitVelocity; - float _orbitAngle; - float _orbitRadius; - float _tearRange; - uint8_t _pad_0x824[0x24]; -}; -LAYOUT32(offsetof(Entity_Tear, _height) == 0x410); -LAYOUT32(offsetof(Entity_Tear, _fallingSpeed) == 0x414); -LAYOUT32(offsetof(Entity_Tear, _fallingAccel) == 0x418); -LAYOUT32(offsetof(Entity_Tear, _homingFriction) == 0x41c); -LAYOUT32(offsetof(Entity_Tear, _fScale) == 0x420); -LAYOUT32(offsetof(Entity_Tear, _baseScale) == 0x424); -LAYOUT32(offsetof(Entity_Tear, _tearFlags) == 0x428); -LAYOUT32(offsetof(Entity_Tear, _waitFrames) == 0x438); -LAYOUT32(offsetof(Entity_Tear, _continueVelocity) == 0x43c); -LAYOUT32(offsetof(Entity_Tear, _hitList) == 0x444); -LAYOUT32(offsetof(Entity_Tear, _tearIdx) == 0x450); -LAYOUT32(offsetof(Entity_Tear, _baseDamage) == 0x454); -LAYOUT32(offsetof(Entity_Tear, _rotation) == 0x458); -LAYOUT32(offsetof(Entity_Tear, _scaleAnimNum) == 0x45c); -LAYOUT32(offsetof(Entity_Tear, _knockbackMultiplier) == 0x460); -LAYOUT32(offsetof(Entity_Tear, _deadEyeIntensity) == 0x464); -LAYOUT32(offsetof(Entity_Tear, _multidimensionalTouched) == 0x468); -LAYOUT32(offsetof(Entity_Tear, _prismTouched) == 0x469); -LAYOUT32(offsetof(Entity_Tear, _isFireSoundPending) == 0x46a); -LAYOUT32(offsetof(Entity_Tear, _popBounceCount) == 0x46c); -LAYOUT32(offsetof(Entity_Tear, _hitCount) == 0x470); -LAYOUT32(offsetof(Entity_Tear, _deathFlags) == 0x474); -LAYOUT32(offsetof(Entity_Tear, _stickTarget) == 0x478); -LAYOUT32(offsetof(Entity_Tear, _stickDiff) == 0x47c); -LAYOUT32(offsetof(Entity_Tear, _stickTimer) == 0x484); -LAYOUT32(offsetof(Entity_Tear, _techZeroLaser) == 0x488); -LAYOUT32(offsetof(Entity_Tear, _techZeroTarget) == 0x48c); -LAYOUT32(offsetof(Entity_Tear, _laserShotLaser) == 0x490); -LAYOUT32(offsetof(Entity_Tear, _linkPrev) == 0x494); -LAYOUT32(offsetof(Entity_Tear, _linkNext) == 0x498); -LAYOUT32(offsetof(Entity_Tear, _attachedEffect) == 0x49c); -LAYOUT32(offsetof(Entity_Tear, _tearHaloANM2) == 0x4ac); -LAYOUT32(offsetof(Entity_Tear, _tearEffectANM2) == 0x5c0); -LAYOUT32(offsetof(Entity_Tear, _deadEyeANM2) == 0x6d4); -LAYOUT32(offsetof(Entity_Tear, _canTriggerStreakEnd) == 0x7e8); -LAYOUT32(offsetof(Entity_Tear, _isHovering) == 0x7e9); -LAYOUT32(offsetof(Entity_Tear, _isFireSoundMuted) == 0x7ea); -LAYOUT32(offsetof(Entity_Tear, _posDisplacement) == 0x7ec); -LAYOUT32(offsetof(Entity_Tear, _parentOffset) == 0x7f4); -LAYOUT32(offsetof(Entity_Tear, _holdTimer) == 0x7fc); -LAYOUT32(offsetof(Entity_Tear, _holdOffset) == 0x800); -LAYOUT32(offsetof(Entity_Tear, _holdVelocity) == 0x808); -LAYOUT32(offsetof(Entity_Tear, _orbitVelocity) == 0x810); -LAYOUT32(offsetof(Entity_Tear, _orbitAngle) == 0x818); -LAYOUT32(offsetof(Entity_Tear, _orbitRadius) == 0x81c); -LAYOUT32(offsetof(Entity_Tear, _tearRange) == 0x820); -LAYOUT32(sizeof(Entity_Tear) == 0x848); - -struct Entity_Text : Entity { - virtual ~Entity_Text(); // 005ccc60 slot 0 - void Init(int type, int variant, int subType, uint32_t initSeed) override; // 005ccca0 slot 1 - void Update() override; // 005ccd80 slot 3 - void Interpolate() override; // 005cd2e0 slot 4 - void Render(Vector *offset) override; // 005ccfc0 slot 5 - void HandleCollision() override; // 005ccc20 slot 23 Entity_Effect::HandleCollision - - uint8_t _pad_0x410[0x120]; -}; -LAYOUT32(sizeof(Entity_Text) == 0x530); - struct FamiliarData { int _seed; int _variant; @@ -4734,6 +1468,18 @@ struct GameOver { LAYOUT32(offsetof(GameOver, _state) == 0x0); LAYOUT32(offsetof(GameOver, _isStopSoundsPending) == 0x11c); +struct std_vector_bool { + void * _begin; + void * _end; + void * _capacity; + uint32_t _size; +}; +LAYOUT32(offsetof(std_vector_bool, _begin) == 0x0); +LAYOUT32(offsetof(std_vector_bool, _end) == 0x4); +LAYOUT32(offsetof(std_vector_bool, _capacity) == 0x8); +LAYOUT32(offsetof(std_vector_bool, _size) == 0xc); +LAYOUT32(sizeof(std_vector_bool) == 0x10); + struct GameStateItemPool { std_vector _poolsItemWeights[31]; uint32_t _bibleUpgrades[31]; @@ -4764,6 +1510,19 @@ LAYOUT32(offsetof(GameStateItemPool, _pillEffects) == 0x228); LAYOUT32(offsetof(GameStateItemPool, _identifiedPillEffects) == 0x264); LAYOUT32(offsetof(GameStateItemPool, _remainingGenesisItems) == 0x274); +struct GameStatePlayer { + ~GameStatePlayer(); // 00754d90 + void read_player_key(void *stream); // 009c86e0 + void Init(); // 009cf050 + static uint8_t read_coplayer(short *block, void *stream); // 009cff40 + void write_coplayer(void *stream); // 009d0100 + static void read_block_538(uint32_t *block, void *stream); // 009d02c0 + static void write_block_538(short *block, void *stream); // 009d0440 + uint8_t read(void *reader); // 009d05d0 + static uint32_t read_part3(); // 009d2656 +}; + + struct Game_StateSlot { void * operator_assign(void *other); // 006f8a40 }; @@ -4818,6 +1577,24 @@ LAYOUT32(offsetof(GridEntityDesc, _varData) == 0x14); LAYOUT32(offsetof(GridEntityDesc, _initialized) == 0x18); LAYOUT32(offsetof(GridEntityDesc, _variableSeed) == 0x1c); +struct RNG { + static void Shuffle(RNG *rng, int *begin, int *end); // 005cc070 + void game_constructor(uint32_t seed, uint32_t shiftidx); // 007e8f90 + void SetSeed(uint32_t Seed, uint32_t ShiftIdx); // 007e8fe0 + uint32_t RandomInt(uint32_t max); // 007e9020 + float RandomFloat(); // 007e9080 + uint32_t Next(); // 007e90f0 + + uint32_t _seed; + uint32_t _shift1; + uint32_t _shift2; + uint32_t _shift3; +}; +LAYOUT32(offsetof(RNG, _seed) == 0x0); +LAYOUT32(offsetof(RNG, _shift1) == 0x4); +LAYOUT32(offsetof(RNG, _shift2) == 0x8); +LAYOUT32(offsetof(RNG, _shift3) == 0xc); + struct GridEntity { virtual ~GridEntity(); // 00709cb0 slot 0 virtual void guard_check_icall(); // 0040c200 slot 1 ::guard_check_icall @@ -5224,6 +2001,36 @@ struct HallucinationOverlay { }; +struct HomingLaser { + HomingLaser * operator_assign(HomingLaser *other); // 0085e000 + HomingLaser(); // 0099c290 + void build_bezier_path(int homingType, Entity *source); // 0099c790 + void compute_axis_bezier_handles(); // 0099dca0 + void compute_bezier_handles(float tension); // 0099e160 + void CalculateSamples(float param_2); // 0099e360 + void apply_sine_offset(float amplitude, float phase); // 0099ec00 + void build_curl_path(float radius); // 0099fa60 + static void build_wiggle_bezier(); // 0099fed0 + uint8_t clip_samples_to_grid(Vector *pos, int gridCollisionClass); // 009a0520 + void truncate_samples_at_player(); // 009a0740 + void truncate_samples_at_obstacle(Vector *positionOffset); // 009a0c50 + void remove_collinear_samples(float tolerance); // 009a0de0 + void apply_sample_wiggle(float amplitude, float phase); // 009a0fa0 + static uint32_t find_targets(float *param_1, float *param_2, int param_3, uint32_t param_4, Entity *param_5); // 009a12b0 + uint8_t truncate_samples(float maxLength); // 009a1520 + + uint8_t _pad_0x0[0x1c]; + std_vector _samples; + std_vector _nonOptimizedSamples; + uint8_t _pad_0x34[0x10]; + float _totalLength; + uint8_t _bezier[0x4]; // std_vector +}; +LAYOUT32(offsetof(HomingLaser, _samples) == 0x1c); +LAYOUT32(offsetof(HomingLaser, _nonOptimizedSamples) == 0x28); +LAYOUT32(offsetof(HomingLaser, _totalLength) == 0x44); +LAYOUT32(offsetof(HomingLaser, _bezier) == 0x48); + struct ImageBase { uint8_t set_size(uint32_t width, uint32_t height, int unused); // 00a12d50 }; @@ -5273,7 +2080,7 @@ struct Weapon { } -struct IsaacsBodyData : Entity_Familiar::ExtraData { +struct IsaacsBodyData { virtual ~IsaacsBodyData(); // 0060d530 slot 0 ::FUN_0060d530 uint8_t _pad_0x4[0x574]; @@ -7050,7 +3857,7 @@ struct Menu_OnlineMode { }; -struct MrMeData : Entity_Effect::ExtraData { +struct MrMeData { virtual ~MrMeData(); // 005cd8c0 slot 0 ::FUN_005cd8c0 uint8_t _pad_0x4[0x128]; @@ -7095,6 +3902,41 @@ struct Mutex::ScopeLock { }; +struct NPCAI_Pathfinder { + void ResetMovementTarget(); // 007e6fa0 + uint8_t HasPathToPos(Vector *position, uint8_t isIgnorePoop); // 007e7070 + void SimulatePlayerMovement(float *param_2); // 007e8010 + + Entity* _entity; + Vector _movementTarget; + Vector _moveDirection; + int _direction; + uint8_t _pad_0x18[0x8]; + int _gridIndex; + uint8_t _pad_0x24[0x4]; + int _moveCountdown; + uint8_t _pad_0x2c[0x700]; + bool _hasDirectPath; + uint8_t _pad_0x72d[0x3]; + Vector _gridPathTarget; + bool _canCrushRocks; + uint8_t _pad_0x739[0x3]; + int _evadeMovementCountdown; + uint8_t _pad_0x740[0x4]; + float _evadeDistance; +}; +LAYOUT32(offsetof(NPCAI_Pathfinder, _entity) == 0x0); +LAYOUT32(offsetof(NPCAI_Pathfinder, _movementTarget) == 0x4); +LAYOUT32(offsetof(NPCAI_Pathfinder, _moveDirection) == 0xc); +LAYOUT32(offsetof(NPCAI_Pathfinder, _direction) == 0x14); +LAYOUT32(offsetof(NPCAI_Pathfinder, _gridIndex) == 0x20); +LAYOUT32(offsetof(NPCAI_Pathfinder, _moveCountdown) == 0x28); +LAYOUT32(offsetof(NPCAI_Pathfinder, _hasDirectPath) == 0x72c); +LAYOUT32(offsetof(NPCAI_Pathfinder, _gridPathTarget) == 0x730); +LAYOUT32(offsetof(NPCAI_Pathfinder, _canCrushRocks) == 0x738); +LAYOUT32(offsetof(NPCAI_Pathfinder, _evadeMovementCountdown) == 0x73c); +LAYOUT32(offsetof(NPCAI_Pathfinder, _evadeDistance) == 0x744); + struct NetDesyncHandler { void Update(); // 008fd900 static void receive_messages(); // 008fed60 @@ -7321,7 +4163,7 @@ struct PersistentGameDataWriter { }; -struct PickupGhostData : Entity_Effect::ExtraData { +struct PickupGhostData { virtual ~PickupGhostData(); // 005d23a0 slot 0 ::FUN_005d23a0 uint8_t _pad_0x4[0x454]; @@ -7333,6 +4175,21 @@ struct PillEffect { }; +struct std_set { + void * _head; + uint32_t _size; +}; +LAYOUT32(offsetof(std_set, _head) == 0x0); +LAYOUT32(offsetof(std_set, _size) == 0x4); +LAYOUT32(sizeof(std_set) == 0x8); + +struct PlayerProceduralItems { + Entity_Player* _player; + uint8_t _itemIds[0x4]; // std_set +}; +LAYOUT32(offsetof(PlayerProceduralItems, _player) == 0x0); +LAYOUT32(offsetof(PlayerProceduralItems, _itemIds) == 0x4); + struct PngWriter { static void write_end(); // 009e8d40 void write_info(); // 009e8ee0 @@ -7479,356 +4336,6 @@ struct RichTextSpan { }; -struct Room { - int GetGridHeight(); // 0040c2e0 - Room * init_render_buffers(); // 00417930 - Vector * GetTopLeftPos(); // 00421800 - EntityList * GetEntities(); // 00428a50 - int GetRoomShape(); // 0042a270 - uint8_t SetGridPath(int gridIndex, int value); // 0042a290 - Vector * GetBottomRightPos(); // 0042cc70 - Vector * GetRenderScrollOffset(); // 0042d030 - GridEntity_Door * GetDoor(int slot); // 00436020 - uint32_t GetSpawnSeed(); // 00436050 - GridEntity * GetGridEntity(uint32_t idx); // 00436060 - uint8_t IsClear(); // 00436080 - Vector * GetClampedPosition(Vector *outPos, Vector *position, float margin); // 00436090 - int GetTintedRockIdx(); // 004360c0 - int GetBossID(); // 0043ef20 - int GetGridPath(int gridIndex); // 004565c0 - GridEntity * GetGridEntityFromPos(Vector *pos); // 00456620 - int GetGridSize(); // 004566a0 - int GetAliveEnemiesCount(); // 004566b0 - int GetAliveBossesCount(); // 004566d0 - void EmitBloodFromWalls(int duration, int count); // 004566f0 - bool HasSlowDown(); // 00456710 - void SetSlowDown(int duration); // 00456720 - uint32_t GetDecorationSeed(); // 004aae80 - void SetClear(uint8_t isClear); // 004aae90 - void SetSacrificeDone(uint8_t isDone); // 004aaeb0 - int GetBackdropType(); // 004cdd20 - uint8_t RaiseGridPathAtPos(Vector *pos, int pathValue); // 004cdd80 - uint8_t HasTriggerPressurePlates(); // 004d7780 - uint8_t HasWaterPits(); // 00505c40 - Vector * GetWaterCurrent(Vector *outResult); // 00505c50 - void StopRain(); // 005784d0 - uint8_t CanSpawnObstacleAtPos(Vector *position, uint8_t isForce); // 00589f90 - static int get_beast_arena(); // 00592270 - uint8_t IsDoorSlotAllowed(int slot); // 0059e250 - void InvalidatePickupVision(); // 005b16c0 - uint8_t IsSacrificeDone(); // 005cd650 - static uint8_t is_deaths_list_done(); // 005cd660 - static uint8_t has_exorcist(); // 005cd670 - Vector * ScreenWrapPosition(Vector *outPosition, Vector *position, float margin); // 00652ab0 - static uint8_t IsFirstVisit(); // 0065cef0 - uint8_t IsInitialized(); // 006b83d0 - Vector * GetRenderSurfaceTopLeft(); // 006b83e0 - uint8_t IsFirstEnemyDead(); // 006b83f0 - void SetFirstEnemyDead(uint8_t param_2); // 006b8400 - uint8_t has_room_config_flag(uint32_t mask); // 006b8410 - uint8_t IsAmbushDone(); // 0070c560 - long double GetLavaIntensity(); // 007120c0 - void SetRedHeartDamage(); // 007537c0 - static void SetCardAgainstHumanity(); // 007537d0 - int GetDeliriumDistance(); // 007537e0 - uint8_t GetRedHeartDamage(); // 007e91a0 - void SetFloorColor(float param_2, float param_3, float param_4, float param_5, float param_6, float param_7, float param_8, float param_9, uint64_t param_10, float param_11); // 007e91b0 - void SetWallColor(ColorMod color); // 007e91f0 - Room * constructor(); // 007e9400 - ~Room(); // 007e9ba0 - uint8_t is_type_16(); // 007ea190 - void TriggerEffectRemoved(ItemConfig_Item *item, int unused); // 007ea1a0 - void SetPauseTimer(int Duration); // 007ea260 - float time_scale_update(); // 007ea2d0 - float GetTimeScale(Vector *unusedPosition, Entity *entity); // 007ea3e0 - void PlayMusic(); // 007eb1b0 - uint8_t SpawnGridEntity(int GridIndex, uint32_t Type, uint32_t Variant, uint32_t Seed, int VarData); // 007ebca0 - uint8_t SpawnGridEntityDesc(int GridIndex, GridEntityDesc *Desc); // 007ebd50 - int GetSeededCollectible(uint32_t Seed, uint8_t NoDecrease); // 007ec080 - void TransformEntry(void *entry, uint32_t gridIndex, uint32_t seed); // 007ec100 - static uint8_t IsPersistentRoomEntity(int type, int variant, int subType); // 007ed2a0 - uint8_t SpawnEntry(uint32_t gridIndex, void *entry, uint32_t seed, Entity **outEntity, uint8_t isRespawn); // 007ed310 - uint8_t make_wall(int x, int y); // 007ee7e0 - void MakeDoor(int slot); // 007eea90 - int GetRoomConfigStage(); // 007eece0 - void on_leave(); // 007efa50 - void RestoreState(); // 007eff50 - void update_door_transitions(); // 007f01c0 - int GetGridCollisionAtPos(Vector pos); // 007f0780 - uint32_t GetGridCollision(int index); // 007f0800 - Vector * GetLaserTarget(Vector *outTarget, Vector *position, Vector *direction); // 007f0b40 - uint8_t CheckLine(Vector *pos1, Vector *pos2, int mode, int gridPathThreshold, uint8_t isIgnoreWalls, uint8_t isIgnoreCrushable, Vector *outPos); // 007f0df0 - void LoadBackdropGraphics(); // 007f1380 - void reload_backdrop(); // 007f2070 - void update_bounds(uint8_t isFromGridSize); // 007f2390 - void Init(RoomConfig_Room *config, RoomDescriptor *descriptor); // 007f2800 - Vector * GetDoorSlotPosition(Vector *outPosition, int doorSlot); // 007f79d0 - uint8_t TrySpawnSecretExit(uint8_t isAnimate, uint8_t isForce); // 007f7a40 - uint8_t TrySpawnSecretShop(uint8_t isForce); // 007f8190 - uint8_t TrySpawnDevilRoomDoor(uint8_t isAnimate, uint8_t isForce); // 007f83b0 - float GetDevilRoomChance(); // 007f92b0 - uint8_t TrySpawnBossRushDoor(uint8_t isIgnoreTime, uint8_t isForce); // 007f9960 - uint8_t TrySpawnMegaSatanRoomDoor(uint8_t isForce); // 007f9df0 - void clear_reward_position(Vector *position); // 007f9ee0 - void clear_grid_for_pickup(int *gridIndex); // 007fa0e0 - void remove_grid_entity_for_spawn(int *gridIndex); // 007fa360 - void SpawnClearAward(); // 007fb250 - void card_against_humanity_fill(); // 007fe220 - void TriggerBossDeath(Entity *entity); // 007fec00 - void update_ambient_sounds(); // 00800500 - void UpdateGreedWave(); // 00801ee0 - static void update_deaths_list(); // 008020d0 - void update_pressure_plates(); // 008024f0 - void update_door_targets(); // 00802670 - void Update(); // 00802980 - void TriggerClear(uint8_t playSound); // 008068f0 - void render_player_light(Entity_Player *player, Vector *offset); // 0080bd20 - void render_grid_entity_light(GridEntity *param_2, float *param_3); // 0080c810 - uint8_t pick_special_clear_award(int *outCollectible, uint32_t *outTrinket, RNG *rng); // 0080e320 - void render_lighting(); // 0080ea80 - void Render(); // 0080f200 - void render_debug_grid_values(Vector *offset); // 008128f0 - int GetGridPathFromPos(Vector *position); // 00812c10 - int GetGridIndex(Vector *pos); // 00812c90 - static Vector * GetCenterPos(Vector *outPos); // 00812d00 - int GetClampedGridIndex(Vector *position); // 00812de0 - int GetGridIndexByTile(int GridRow, int GridColumn); // 00812e60 - Vector * GetGridPosition(Vector *outPos, int gridIndex); // 00812f00 - uint8_t IsPositionInRoom(Vector *position, float margin); // 00813360 - uint8_t DamageGridWithSource(int gridIndex, int damage, EntityRef *source); // 00813b30 - uint8_t DamageGrid(int gridIndex, int damage); // 00813b60 - uint8_t DestroyGrid(int gridIdx, uint8_t isImmediate, uint8_t isDefuseBombRock); // 00813c40 - int GetFrameCount(); // 00813ce0 - static int greed_shop_slot_type(uint32_t seed); // 00813d00 - void init_shop_item_slots(); // 00813d90 - static int shop_ware_roll(uint32_t *param_1, uint32_t *param_2, int *param_3, uint32_t param_4); // 00814980 - int GetShopItemPrice(uint32_t variant, int subType, int shopItemId, Entity_Player *player); // 008151e0 - void TriggerRestock(int grid_idx, int shop_idx); // 00815800 - void ShopRestockPartial(); // 008158a0 - void ShopRestockFull(); // 00815ae0 - void ShopReshuffle(uint8_t isKeepCollectibleIdx, uint8_t isReselectSaleItem); // 00816000 - void RemoveDoor(int doorSlot); // 008167e0 - void SpawnGreedModeWave(uint8_t unusedBool); // 00816910 - void render_water(int pass); // 00817830 - static uint32_t IsAmbushActive(); // 0081e240 - float GetLightingAlpha(); // 0081e250 - Vector * FindFreeTilePosition(Vector *outPos, Vector *pos, float distanceThreshold); // 0081e520 - uint8_t TryMakeBridge(GridEntity *pit, GridEntity *rock); // 0081e6e0 - void RemoveGridEntity(int gridIndex, int pathTrail, uint8_t isKeepDecoration); // 0081e930 - void RemoveGridEntityImmediate(int GridIndex, int PathTrail, uint8_t KeepDecoration); // 0081e980 - Vector * GetRandomPosition(Vector *outPosition, float margin); // 0081e9d0 - int GetRandomTileIndex(uint32_t seed); // 0081ecc0 - uint32_t GetBrokenWatchState(); // 0081edd0 - void SetBrokenWatchState(int state); // 0081edf0 - void make_walls(); // 0081ee20 - void render_debug_grid_indices(Vector *renderOffset); // 0081f130 - uint8_t IsLShapedRoom(); // 0081f890 - void * GetLRoomAreaDesc(void *buffer); // 0081f8b0 - LRoomTileDesc * GetLRoomTileDesc(LRoomTileDesc *buffer); // 0081fb20 - void RespawnEnemies(); // 0081fd60 - uint8_t TrySpawnBlueWombDoor(uint8_t isFirstTime, uint8_t isIgnoreTime, uint8_t isForce); // 00820170 - uint8_t TrySpawnTheVoidDoor(uint8_t isForce); // 008204b0 - uint32_t GetBossVictoryJingle(); // 00820720 - bool HasWater(); // 008208c0 - uint8_t IsCurrentRoomLastBoss(); // 008208e0 - void MamaMegaExplosion(Vector *position, Entity_Player *player); // 00820910 - int GetDungeonRockIdx(); // 00820aa0 - void TurnGold(); // 00820ac0 - Vector * WorldToScreenPosition(Vector *outPosition, float x, float y); // 00820c00 - static void record_killed_npc(int param_1); // 00820d30 - void render_water(); // 00820fd0 - void render_water_shader(Vector *renderOffset); // 00821950 - uint8_t is_obstacle_path_valid(uint32_t startIndex, uint32_t goalIndex, uint32_t flags); // 00821fc0 - uint8_t CanSpawnObstacleAtPosition(int GridIndex, uint8_t Force); // 00822820 - void add_trigger_output_index(uint32_t group, int gridIndex); // 00822cf0 - void add_trigger_output_cell(int group, int x, int y); // 00822d20 - void hold_trigger_output_entities(); // 00822d60 - Entity * hold_entity_in_spawner(Entity *entity, int group); // 00822fd0 - void TriggerOutput(uint32_t outputGroupdIdx); // 00823080 - float * get_color_modifier(float *outColor); // 00823370 - KColor * GetFloorColorAt(KColor *outColor, Vector *position, float radius); // 00823590 - static uint8_t is_reachable_from_player(float *param_1, Entity_Player *param_2, char param_3); // 00823be0 - Vector * find_reachable_position(Vector *outPosition, Vector *position, int unused); // 00823d10 - static void attach_minecarts(); // 00823f50 - uint8_t HasLava(); // 008242d0 - void init_rain(); // 00824350 - void update_ambient_spawns(); // 00824800 - uint32_t update_ambient_effects(); // 00824a70 - void update_water_current(); // 00824ee0 - uint8_t CanPickupGridEntity(int GridIndex); // 00825730 - uint8_t spawn_grid_from_desc(uint32_t gridIndex, GridEntityDesc *outDesc, ANM2 *outSprite); // 008257a0 - Entity_Effect * PickupGridEntity(int GridIndex); // 00825c50 - void render_darkness_overlay(); // 00825de0 - void render_lava_pit_mask(); // 00826ae0 - void render_water_overlay(Vector *offset); // 00826f80 - void UpdateRedKey(); // 008271e0 - void open_red_room_doors(int doorSlot, RoomDescriptor *targetRoom); // 00827550 - Entity_Pickup * spawn_options_alternative(Entity_Pickup *pickup); // 008276e0 - uint8_t IsBeastDungeon(); // 008279a0 - static void get_lava_line_y(); // 008279c0 - uint8_t TrySpawnSpecialQuestDoor(); // 008279d0 - uint8_t IsMirrorWorld(); // 00827b70 - uint8_t HasCurseMist(); // 00827bb0 - uint8_t is_pre_ascent_mom_room(); // 00827bc0 - uint8_t spawn_sanguine_bond_spikes(uint8_t isRoomInit); // 00827bf0 - int GetSecondBossID(); // 0082eb80 - void SetAmbushDone(uint8_t isDone); // 008332c0 - void KeepDoorsClosed(); // 0085e0f0 - uint32_t GetAwardSeed(); // 0085e100 - int GetShopLevel(); // 0085e110 - int GetRenderMode(); // 0085e120 - float GetEnemyDamageInflicted(); // 0085e130 - static void Spawns(uint32_t *param_1, int param_2); // 00872020 - static uint32_t Doors(int param_1); // 00872040 - void render_pit_rails(float *param_2); // 009e31b0 - int GetBossThematicItem(int param_2); // 009e7dc0 - - uint8_t _pad_0x0[0x4]; - RoomDescriptor* _descriptor; - uint32_t _roomType; - uint32_t _gridWidth; - uint32_t _gridHeight; - Vector _topLeftPos; - Vector _bottomRightPos; - GridEntity* _gridEntities[448]; - GridEntity_Door* _doors[8]; - int _doorGridPositions[8]; - int _tintedRockIdx; - int _dungeonRockIdx; - int _gridPaths[448]; - uint8_t _pad_0xe6c[0x380]; - int _roomClearDelay; - int _enterFrame; - uint8_t _pad_0x11f4[0x4]; - Camera* _Camera; - Vector _renderSurfaceTopLeft; - Vector _renderScrollOffset; - bool _redHeartDamage; - uint8_t _pad_0x120d[0x3]; - uint32_t _brokenWatchState; - int _entityIndexCounter; - uint8_t _entityList[0xa4]; // EntityList - int _renderMode; - int32_t _aliveEnemyCount; - uint8_t _pad_0x12c4[0x4]; - int32_t _aliveBossCount; - uint8_t _pad_0x12cc[0x34c]; - uint8_t _fxLayers[0x598]; // FXLayers - uint32_t _bossId; - int _secondBossID; - uint8_t _pad_0x1bb8[0x10]; - uint8_t _backdrop[0x150]; // Backdrop - int _backdropType; - uint8_t _pad_0x1d1c[0x4dc4]; - Vector _floorScreenTopLeft; - Vector _floorScreenBottomRight; - uint8_t _pad_0x6af0[0x350]; - uint8_t _lightSprite[0x228]; // ANM2 - int _shopLevel; - int _shopRestockTimer; - std_deque _shopItemDeque; - uint8_t _pad_0x7084[0x1a5]; - bool _hasTriggerPressurePlates; - uint8_t _pad_0x722a[0x2]; - int _slowdownDuration; - uint8_t _pad_0x7230[0x4]; - uint8_t _pendingGridRemovals[8]; - int _greedWaveTimer; - float _waterAmount; - KColor _waterColor; - KColor _waterColorMultiplier; - KColor _waterLerpTargetColor; - KColor _waterLerpTargetColorMult; - int _waterLerpColorDuration; - int _waterLerpColorCountdown; - uint8_t _pad_0x729c[0x4]; - bool _isFirstEnemyDead; - bool _pacifist; - uint8_t _pad_0x72a2[0x2]; - ColorMod _floorColor; - ColorMod _wallColor; - uint8_t _pad_0x72fc[0xc]; - uint8_t _litGridIndices[8]; - TemporaryEffects _temporaryEffects; - uint8_t _outputGroupGridIndices[80]; - uint8_t _outputGroupCallbacks[120]; - uint8_t _pad_0x73f0[0x64]; - int _numRainSpawners; - float _rainIntensity; - bool _isRainStopped; - uint8_t _pad_0x745d[0x3]; - Vector _waterCurrent; - RailManager _railManager; - float _lavaIntensity; - uint8_t _redDoorOutlines[0x148]; // EntityPtr[8] - float _beastBlastForce; - uint8_t _pad_0x7890[0x4]; - bool _isPickupVisionInvalid; -}; -LAYOUT32(offsetof(Room, _descriptor) == 0x4); -LAYOUT32(offsetof(Room, _roomType) == 0x8); -LAYOUT32(offsetof(Room, _gridWidth) == 0xc); -LAYOUT32(offsetof(Room, _gridHeight) == 0x10); -LAYOUT32(offsetof(Room, _topLeftPos) == 0x14); -LAYOUT32(offsetof(Room, _bottomRightPos) == 0x1c); -LAYOUT32(offsetof(Room, _gridEntities) == 0x24); -LAYOUT32(offsetof(Room, _doors) == 0x724); -LAYOUT32(offsetof(Room, _doorGridPositions) == 0x744); -LAYOUT32(offsetof(Room, _tintedRockIdx) == 0x764); -LAYOUT32(offsetof(Room, _dungeonRockIdx) == 0x768); -LAYOUT32(offsetof(Room, _gridPaths) == 0x76c); -LAYOUT32(offsetof(Room, _roomClearDelay) == 0x11ec); -LAYOUT32(offsetof(Room, _enterFrame) == 0x11f0); -LAYOUT32(offsetof(Room, _Camera) == 0x11f8); -LAYOUT32(offsetof(Room, _renderSurfaceTopLeft) == 0x11fc); -LAYOUT32(offsetof(Room, _renderScrollOffset) == 0x1204); -LAYOUT32(offsetof(Room, _redHeartDamage) == 0x120c); -LAYOUT32(offsetof(Room, _brokenWatchState) == 0x1210); -LAYOUT32(offsetof(Room, _entityIndexCounter) == 0x1214); -LAYOUT32(offsetof(Room, _entityList) == 0x1218); -LAYOUT32(offsetof(Room, _renderMode) == 0x12bc); -LAYOUT32(offsetof(Room, _aliveEnemyCount) == 0x12c0); -LAYOUT32(offsetof(Room, _aliveBossCount) == 0x12c8); -LAYOUT32(offsetof(Room, _fxLayers) == 0x1618); -LAYOUT32(offsetof(Room, _bossId) == 0x1bb0); -LAYOUT32(offsetof(Room, _secondBossID) == 0x1bb4); -LAYOUT32(offsetof(Room, _backdrop) == 0x1bc8); -LAYOUT32(offsetof(Room, _backdropType) == 0x1d18); -LAYOUT32(offsetof(Room, _floorScreenTopLeft) == 0x6ae0); -LAYOUT32(offsetof(Room, _floorScreenBottomRight) == 0x6ae8); -LAYOUT32(offsetof(Room, _lightSprite) == 0x6e40); -LAYOUT32(offsetof(Room, _shopLevel) == 0x7068); -LAYOUT32(offsetof(Room, _shopRestockTimer) == 0x706c); -LAYOUT32(offsetof(Room, _shopItemDeque) == 0x7070); -LAYOUT32(offsetof(Room, _hasTriggerPressurePlates) == 0x7229); -LAYOUT32(offsetof(Room, _slowdownDuration) == 0x722c); -LAYOUT32(offsetof(Room, _pendingGridRemovals) == 0x7234); -LAYOUT32(offsetof(Room, _greedWaveTimer) == 0x723c); -LAYOUT32(offsetof(Room, _waterAmount) == 0x7240); -LAYOUT32(offsetof(Room, _waterColor) == 0x7244); -LAYOUT32(offsetof(Room, _waterColorMultiplier) == 0x7258); -LAYOUT32(offsetof(Room, _waterLerpTargetColor) == 0x726c); -LAYOUT32(offsetof(Room, _waterLerpTargetColorMult) == 0x7280); -LAYOUT32(offsetof(Room, _waterLerpColorDuration) == 0x7294); -LAYOUT32(offsetof(Room, _waterLerpColorCountdown) == 0x7298); -LAYOUT32(offsetof(Room, _isFirstEnemyDead) == 0x72a0); -LAYOUT32(offsetof(Room, _pacifist) == 0x72a1); -LAYOUT32(offsetof(Room, _floorColor) == 0x72a4); -LAYOUT32(offsetof(Room, _wallColor) == 0x72d0); -LAYOUT32(offsetof(Room, _litGridIndices) == 0x7308); -LAYOUT32(offsetof(Room, _temporaryEffects) == 0x7310); -LAYOUT32(offsetof(Room, _outputGroupGridIndices) == 0x7328); -LAYOUT32(offsetof(Room, _outputGroupCallbacks) == 0x7378); -LAYOUT32(offsetof(Room, _numRainSpawners) == 0x7454); -LAYOUT32(offsetof(Room, _rainIntensity) == 0x7458); -LAYOUT32(offsetof(Room, _isRainStopped) == 0x745c); -LAYOUT32(offsetof(Room, _waterCurrent) == 0x7460); -LAYOUT32(offsetof(Room, _railManager) == 0x7468); -LAYOUT32(offsetof(Room, _lavaIntensity) == 0x7740); -LAYOUT32(offsetof(Room, _redDoorOutlines) == 0x7744); -LAYOUT32(offsetof(Room, _beastBlastForce) == 0x788c); -LAYOUT32(offsetof(Room, _isPickupVisionInvalid) == 0x7894); - struct RoomConfigMode { void ctor(); // 00828b60 void Clear(); // 00828c00 @@ -7854,44 +4361,6 @@ struct RoomGridPath { }; -struct RoomTransition { - ~RoomTransition(); // 0082ebd0 - void StartBossIntro(uint32_t bossID1, uint32_t bossID2); // 0082f1c0 - void ChangeRoom(); // 00830950 - void Update(); // 008318a0 - float get_hud_alpha(); // 008327e0 - - int _mode; - int _frame; - int _duration; - uint8_t _pad_0xc[0x4]; - int _direction; - int _targetRoomIdx; - int _targetDimension; - int _animation; - uint8_t _pad_0x20[0x4]; - uint32_t _flags; - uint8_t _pad_0x28[0x10]; - uint8_t _versusScreenSprite[0x1ec]; // ANM2 - std_map _sprites; - Vector _slideOffset; - uint8_t _minecart[0x4]; // EntityPtr - int _bossIntroBossId; -}; -LAYOUT32(offsetof(RoomTransition, _mode) == 0x0); -LAYOUT32(offsetof(RoomTransition, _frame) == 0x4); -LAYOUT32(offsetof(RoomTransition, _duration) == 0x8); -LAYOUT32(offsetof(RoomTransition, _direction) == 0x10); -LAYOUT32(offsetof(RoomTransition, _targetRoomIdx) == 0x14); -LAYOUT32(offsetof(RoomTransition, _targetDimension) == 0x18); -LAYOUT32(offsetof(RoomTransition, _animation) == 0x1c); -LAYOUT32(offsetof(RoomTransition, _flags) == 0x24); -LAYOUT32(offsetof(RoomTransition, _versusScreenSprite) == 0x38); -LAYOUT32(offsetof(RoomTransition, _sprites) == 0x224); -LAYOUT32(offsetof(RoomTransition, _slideOffset) == 0x22c); -LAYOUT32(offsetof(RoomTransition, _minecart) == 0x234); -LAYOUT32(offsetof(RoomTransition, _bossIntroBossId) == 0x238); - struct SaveDataManager { void * open_file_read(uint8_t *fileName); // 00a24fd0 void * open_file_write(uint8_t *path, int mode); // 00a25090 @@ -8063,7 +4532,7 @@ LAYOUT32(offsetof(Sprite, _shadowLayerIndex) == 0x10c); LAYOUT32(offsetof(Sprite, _bitflags) == 0x110); LAYOUT32(sizeof(Sprite) == 0x114); -struct SpriteTrailData : Entity_Effect::ExtraData { +struct SpriteTrailData { virtual ~SpriteTrailData(); // 005d2370 slot 0 ::FUN_005d2370 uint8_t _pad_0x4[0x14]; @@ -8133,18 +4602,6 @@ LAYOUT32(offsetof(TearParams, _tearDamage) == 0x48); LAYOUT32(offsetof(TearParams, _tearScale) == 0x4c); LAYOUT32(offsetof(TearParams, _tearHeight) == 0x50); -struct TemporaryEffect { - TemporaryEffect(ItemConfig_Item *item); // 00435f80 - TemporaryEffect() = default; - - ItemConfig_Item* _item; - int _count; - int _cooldown; -}; -LAYOUT32(offsetof(TemporaryEffect, _item) == 0x0); -LAYOUT32(offsetof(TemporaryEffect, _count) == 0x4); -LAYOUT32(offsetof(TemporaryEffect, _cooldown) == 0x8); - struct TexturePtr { static void release(); // 0040c440 @@ -8168,7 +4625,7 @@ LAYOUT32(offsetof(TypeDescriptor, pVFTable) == 0x0); LAYOUT32(offsetof(TypeDescriptor, spare) == 0x4); LAYOUT32(sizeof(TypeDescriptor) == 0x8); -struct UmbilicalBabyData : Entity_Familiar::ExtraData { +struct UmbilicalBabyData { virtual ~UmbilicalBabyData(); // 00431790 slot 0 ::FUN_00431790 static uint32_t last_point(); // 00435590 @@ -8176,6 +4633,11 @@ struct UmbilicalBabyData : Entity_Familiar::ExtraData { }; LAYOUT32(sizeof(UmbilicalBabyData) == 0x158); +struct UserProfile { + void find_or_create(); // 00a23ae0 +}; + + struct VideoPlayer { void play(uint8_t *fileName, float volume); // 009f2ee0 void unload(); // 00a62880 @@ -9371,6 +5833,20 @@ struct vector { } +struct std_deque { + void * _proxy; + void * _map; + uint32_t _mapSize; + uint32_t _offset; + uint32_t _size; +}; +LAYOUT32(offsetof(std_deque, _proxy) == 0x0); +LAYOUT32(offsetof(std_deque, _map) == 0x4); +LAYOUT32(offsetof(std_deque, _mapSize) == 0x8); +LAYOUT32(offsetof(std_deque, _offset) == 0xc); +LAYOUT32(offsetof(std_deque, _size) == 0x10); +LAYOUT32(sizeof(std_deque) == 0x14); + struct std_list { void* _head; uint32_t _size; @@ -9379,6 +5855,22 @@ LAYOUT32(offsetof(std_list, _head) == 0x0); LAYOUT32(offsetof(std_list, _size) == 0x4); LAYOUT32(sizeof(std_list) == 0x8); +struct std_map { + void * _head; + uint32_t _size; +}; +LAYOUT32(offsetof(std_map, _head) == 0x0); +LAYOUT32(offsetof(std_map, _size) == 0x4); +LAYOUT32(sizeof(std_map) == 0x8); + +struct std_multiset { + void * _head; + uint32_t _size; +}; +LAYOUT32(offsetof(std_multiset, _head) == 0x0); +LAYOUT32(offsetof(std_multiset, _size) == 0x4); +LAYOUT32(sizeof(std_multiset) == 0x8); + struct tagBITMAPINFO { uint8_t bmiHeader[0x28]; // BITMAPINFOHEADER uint8_t bmiColors[0x4]; // RGBQUAD @@ -9957,10 +6449,7 @@ void FUN_00417dd0(); // 00417dd0 void FUN_00417df0(); // 00417df0 void FUN_00417e50(); // 00417e50 void render_entity_light_masks(float *param_1); // 00419b50 -int FUN_0041b690(int param_1, int param_2, int param_3); // 0041b690 int FUN_0041b770(int param_1); // 0041b770 -void FUN_0041b9f0(uint32_t param_1, float param_2); // 0041b9f0 -void FUN_0041baf0(); // 0041baf0 void FUN_0041c670(); // 0041c670 int FUN_0041c6f0(uint32_t param_1); // 0041c6f0 void FUN_0041c710(); // 0041c710 @@ -10006,15 +6495,10 @@ void FUN_00421400(); // 00421400 void FUN_004215a0(char *param_1); // 004215a0 void FUN_004215e0(uint32_t *param_1); // 004215e0 void FUN_00421620(uint8_t *param_1); // 00421620 -uint32_t FUN_00421720(uint32_t param_1); // 00421720 DailyChallenge * FUN_00421780(); // 00421780 RoomConfig * FUN_00421790(); // 00421790 void FUN_00421860(); // 00421860 void FUN_00421880(); // 00421880 -void FUN_00421b50(); // 00421b50 -uint32_t * FUN_00422620(int param_1); // 00422620 -void FUN_00422ea0(int param_1); // 00422ea0 -void FUN_00422f80(int param_1); // 00422f80 void vector_bool_resize(void *self, uint32_t newSize, uint8_t isFillValue); // 00423090 int string_compare(uint8_t *a, uint32_t lengthA, uint8_t *b, uint32_t lengthB); // 00423480 void FUN_00423500(uint32_t *param_1, uint32_t param_2); // 00423500 @@ -10602,7 +7086,6 @@ int level_get_room_neighbors(uint32_t roomIndex, uint32_t *outNeighbors); // 00 int star_of_bethlehem_get_target_room(); // 0064d370 void FUN_0064d570(uint32_t param_1); // 0064d570 int apply_forgotten_lullaby(void *self, int fireDelay); // 00651810 -void FUN_006518c0(); // 006518c0 int FUN_006518d0(uint32_t param_1); // 006518d0 void * set_iterator_post_increment(void *self, void *outIterator, int unused); // 006518f0 void FUN_00651910(); // 00651910 @@ -10687,7 +7170,6 @@ void shader_stack_push(int shaderIndex); // 00682280 void FUN_00682350(); // 00682350 float normalize_angle_degrees(float angle); // 00682740 float angle_difference(float from, float to); // 006827a0 -float LerpAngleDeg(float from, float to, float t); // 006828b0 void FUN_00682a20(); // 00682a20 float approach_angle(float current, float target, float maxStep); // 00682a50 void FUN_00683010(int param_1, int param_2, int param_3); // 00683010 @@ -10835,7 +7317,6 @@ void FUN_006a6940(); // 006a6940 std_string * resolve_resource_path(std_string *outPath, std_string *path, void *suffixes); // 006a69e0 void FUN_006a7ec0(); // 006a7ec0 void FUN_006a80d0(); // 006a80d0 -void FUN_006a8120(); // 006a8120 void FUN_006a8180(uint32_t param_1); // 006a8180 void FUN_006a8210(int param_1); // 006a8210 uint32_t FUN_006ae7a0(); // 006ae7a0 @@ -11021,7 +7502,6 @@ void FUN_00738150(uint32_t param_1); // 00738150 void FUN_00738160(uint32_t param_1); // 00738160 void FUN_00738190(char param_1); // 00738190 void FUN_00738260(); // 00738260 -void FUN_007382c0(); // 007382c0 uint32_t FUN_00738330(); // 00738330 Minimap * FUN_00738380(); // 00738380 void FUN_00738390(uint32_t param_1); // 00738390 @@ -11123,7 +7603,6 @@ uint32_t FUN_007826c0(); // 007826c0 void FUN_007829a0(); // 007829a0 void FUN_00782ab0(uint32_t param_1); // 00782ab0 void FUN_0078b330(uint32_t *param_1); // 0078b330 -void FUN_0078e130(Vector *param_1); // 0078e130 int FUN_007919c0(); // 007919c0 Entity_Player * FUN_007a0fe0(); // 007a0fe0 Entity_Player * FUN_007a1020(); // 007a1020 @@ -11158,11 +7637,9 @@ uint32_t FUN_007da7a0(uint32_t param_1); // 007da7a0 uint32_t FUN_007dac30(); // 007dac30 void FUN_007dad80(); // 007dad80 int FUN_007dafb0(); // 007dafb0 -void FUN_007daff0(); // 007daff0 void FUN_007db0a0(); // 007db0a0 uint32_t FUN_007db2d0(); // 007db2d0 int FUN_007db360(); // 007db360 -int is_achievement_79_unlocked(Entity_Player *player); // 007db860 uint32_t FUN_007dbe70(uint32_t *param_1); // 007dbe70 void FUN_007dc610(); // 007dc610 void FUN_007dc620(uint32_t *param_1); // 007dc620 @@ -11188,7 +7665,6 @@ void FUN_007dd1b0(int param_1, int param_2, int param_3); // 007dd1b0 void FUN_007dd240(int param_1, int param_2); // 007dd240 void FUN_007dd2d0(void *param_1, int param_2); // 007dd2d0 void FUN_007dd310(); // 007dd310 -int scale_for_hard_difficulty(int value); // 007dd380 uint8_t * FUN_007dd3a0(); // 007dd3a0 void FUN_007dd3d0(uint32_t param_1); // 007dd3d0 bool FUN_007dd460(); // 007dd460 @@ -11266,11 +7742,9 @@ void FUN_007e93d0(int param_1); // 007e93d0 void FUN_007ea0c0(); // 007ea0c0 void FUN_007ea5d0(); // 007ea5d0 void init_room_render_surfaces(); // 007ea630 -void FUN_007eb010(); // 007eb010 void FUN_007ebc40(); // 007ebc40 uint32_t FUN_007ed240(); // 007ed240 uint8_t entity_type_is_saved(int type, int variant, uint32_t subType, int spawnerType, uint8_t isRoomFlag); // 007eed10 -int room_shape_get_door_grid_index(int doorSlot, int width, int height, int shape); // 007f20e0 float get_angel_room_chance(); // 007f96f0 void FUN_007fa2a0(float *param_1); // 007fa2a0 void FUN_007fa7d0(); // 007fa7d0 @@ -11280,12 +7754,10 @@ uint32_t FUN_00813420(int param_1, int param_2); // 00813420 void pickup_roll_random_variant(void *papersOwner, int shopItemId, int *variant, uint32_t *subType, uint32_t seed); // 00814a50 uint32_t FUN_0081e220(); // 0081e220 void FUN_0081fae0(uint32_t *param_1); // 0081fae0 -uint32_t FUN_008206e0(); // 008206e0 uint32_t FUN_008207a0(); // 008207a0 void FUN_00821940(); // 00821940 void FUN_00823540(); // 00823540 int FUN_00823ec0(); // 00823ec0 -bool FUN_008242f0(); // 008242f0 uint32_t FUN_00827180(float *param_1); // 00827180 void FUN_00827f30(); // 00827f30 void FUN_00828010(uint32_t *param_1); // 00828010 @@ -11311,14 +7783,7 @@ void FUN_0082e290(int param_1, int param_2, int param_3); // 0082e290 void Catch_All_0082e7ec(); // 0082e7ec void FUN_0082ea50(uint32_t param_1, uint32_t *param_2, code *param_3); // 0082ea50 void FUN_0082eb20(uint32_t *param_1, code *param_2); // 0082eb20 -int FUN_0082eb90(); // 0082eb90 -void FUN_0082ebb0(); // 0082ebb0 -void FUN_0082ed00(); // 0082ed00 -bool FUN_0082ee30(); // 0082ee30 void FUN_00831780(int *param_1, uint8_t *param_2, uint8_t *param_3, uint8_t *param_4); // 00831780 -void FUN_00832fd0(); // 00832fd0 -int FUN_00833010(uint32_t *param_1); // 00833010 -void FUN_00833270(); // 00833270 void FUN_008332a0(char param_1); // 008332a0 uint64_t * FUN_00834c60(uint64_t *param_1, uint64_t *param_2); // 00834c60 void Catch_All_00834f6f(); // 00834f6f @@ -11364,9 +7829,7 @@ void FUN_0083bf90(uint32_t *param_1); // 0083bf90 void Catch_All_0083c241(); // 0083c241 uint32_t * FUN_0083c270(uint32_t *param_1, uint32_t *param_2, uint32_t *param_3); // 0083c270 void FUN_0083c320(int *param_1, int *param_2); // 0083c320 -void FUN_0083c400(); // 0083c400 void FUN_0083c480(); // 0083c480 -void FUN_0083c4c0(); // 0083c4c0 void item_pool_icons_render(void *iconLayer, Vector *position, KColor *color); // 0083d8c0 char * FUN_00840510(); // 00840510 std_string * int_to_string(std_string *outString, int value); // 00840540 @@ -11382,7 +7845,6 @@ void Catch_All_0084be32(); // 0084be32 uint32_t * FUN_0084be60(uint32_t *param_1, uint32_t *param_2, uint32_t *param_3); // 0084be60 void FUN_0084bef0(uint32_t *param_1, void *param_2); // 0084bef0 void FUN_0084bf20(); // 0084bf20 -uint32_t FUN_0084bf30(Entity_Player *param_1); // 0084bf30 uint8_t segment_intersect(float *outX, float *outY, float p1x, float p1y, float p2x, float p2y, float q1x, float q1y, float q2x, float q2y); // 0084d8b0 void FUN_0084db90(); // 0084db90 void FUN_00856280(void *param_1); // 00856280 @@ -13664,7 +10126,6 @@ void * FUN_0092ed30(void *param_1, void *param_2, void *param_3); // 0092ed30 void Catch_All_0092ef49(); // 0092ef49 void FUN_0092ef80(); // 0092ef80 void FUN_0092ef90(void *param_1); // 0092ef90 -uint32_t FUN_009301d0(); // 009301d0 int * FUN_00930a00(int param_1); // 00930a00 uint32_t FUN_00930b20(); // 00930b20 void FUN_00930ec0(); // 00930ec0 @@ -13677,9 +10138,6 @@ Vector * backdrop_detail_to_world_pos(Vector *outPosition, Vector *position); / uint32_t FUN_0093b530(); // 0093b530 void backdrop_wall_normal(Vector *outNormal, int isVertical, uint8_t isNegX, uint8_t isNegY); // 0093b580 void FUN_009426b0(uint32_t param_1, uint32_t param_2); // 009426b0 -Vector * vector_ring_buffer_weighted_average(Vector *outAverage, void *ring, float peakFraction); // 00943190 -void FUN_00943830(); // 00943830 -void ring_buffer_push(void *self, Vector *element); // 00945130 void FUN_00949b70(); // 00949b70 void FUN_00949bc0(uint32_t param_1); // 00949bc0 void FUN_0094e3b0(); // 0094e3b0 @@ -13763,7 +10221,6 @@ void level_generator_rooms_shuffle(int param_1, int param_2); // 009b1b20 void Catch_All_009b1d88(); // 009b1d88 int FUN_009b1dc0(int param_1, int param_2, int param_3); // 009b1dc0 int FUN_009b5800(); // 009b5800 -void FUN_009b5cb0(); // 009b5cb0 void FUN_009b9150(); // 009b9150 uint32_t FUN_009b9450(int param_1); // 009b9450 void FUN_009b9f60(Entity *param_1); // 009b9f60 @@ -14006,7 +10463,6 @@ void FUN_00a15550(); // 00a15550 uint32_t FUN_00a15570(); // 00a15570 int FUN_00a15590(); // 00a15590 void FUN_00a155f0(); // 00a155f0 -float assert_lerp_range(float value, float inMin, float inMax, float outMin, float outMax, uint8_t isClamped); // 00a15640 void FUN_00a156d0(); // 00a156d0 void FUN_00a156e0(uint8_t param_1); // 00a156e0 void FUN_00a15730(); // 00a15730 @@ -25674,7 +22130,6 @@ ItemConfig * GetItemConfig(); // 0042ca00 void SpawnLocust(Entity_Player *player, int collectibleType, Vector *pos); // 005b35c0 int Random(int Max); // 0067f010 Vector * GetAxisAlignedUnitVectorFromDir(Vector *outVector, int direction); // 0067f1d0 -Vector * GetRenderPosition(Vector *outPosition, Vector *source, uint8_t isScale); // 0067f310 Vector * GetRandomPickupVelocity(Vector *outVelocity, Vector *position, uint32_t pickupVelType, RNG *rng); // 006ee440 Vector * GetCollectibleSpawnPosition(Vector *outPosition, Vector *target); // 006eeaa0 GridEntity * CreateGridEntity(int type, uint32_t gridIndex); // 0070b2e0 @@ -25730,7 +22185,6 @@ Weapon * CreateWeapon(int weaponType, Entity *owner); // 009f9020 void DestoryWeapon(Weapon **weapon); // 009f9050 } namespace ItemInfo { -void reset(); // 0083d6e0 uint8_t is_collectible_seen(int param_1); // 0083d760 uint8_t is_pickup_known(int param_1); // 0083d7c0 void measure(uint32_t *param_1); // 00840250 diff --git a/generated-src/deathmatch_type_base.cpp b/generated-src/deathmatch_type_base.cpp index 721f45b..a946aca 100644 --- a/generated-src/deathmatch_type_base.cpp +++ b/generated-src/deathmatch_type_base.cpp @@ -121,11 +121,11 @@ uint8_t DeathmatchTypeBase::Init() camera = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f8)); lobbyMembersBytes = (g_manager->_optionsConfig)._cameraStyle; if ((lobbyMembersBytes == 1) || (lobbyMembersBytes != 2)) { - (GHIDRA_CAST((camera)))->Camera::update_focus_position(0); + Camera::update_focus_position(camera,0); camera->_shouldOverride = 0; } else { - (GHIDRA_CAST((camera)))->Camera::update_follow(); + Camera::update_follow(camera); } uVar5 = 1; HUD::mark_all_slots_dirty(&g_game->_hud,1,1); @@ -193,7 +193,7 @@ void DeathmatchTypeBase::Update() if (iVar5 % 0x1e == 0) { iVar5 = GHIDRA_INT(((uint64_t)((int64_t)iVar5 * 0x77777777) >> 0x20)) - iVar5; uVar2 = Random(); - tilePos = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&flyBombPos,0.0); + tilePos = Room::GetRandomPosition(g_game->_room,&flyBombPos,0.0); Game::SpawnEx(g_game,0x333,0,tilePos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar2,0); uVar2 = (iVar5 >> 4) - (iVar5 >> 0x1f) & 0x80000003; if (GHIDRA_INT(uVar2) < 0) { @@ -205,8 +205,8 @@ void DeathmatchTypeBase::Update() do { room = game->_room; local_20 = GHIDRA_CAST((GHIDRA_INT(&local_20[-1]._sprite._bitflags) + 3)); - tilePos = (GHIDRA_CAST((room)))->Room::GetRandomPosition(&randomTilePos,0.0); - tilePos = (GHIDRA_CAST((room)))->Room::FindFreeTilePosition(&freeTilePos,tilePos,0.0); + tilePos = Room::GetRandomPosition(room,&randomTilePos,0.0); + tilePos = Room::FindFreeTilePosition(room,&freeTilePos,tilePos,0.0); uVar2 = 0; playerManager = &g_game->_playerManager; fVar6 = tilePos->x; diff --git a/generated-src/entity.cpp b/generated-src/entity.cpp deleted file mode 100644 index 96578f3..0000000 --- a/generated-src/entity.cpp +++ /dev/null @@ -1,9057 +0,0 @@ -#include "classes.h" - -// 00417220 -uint8_t Entity::IsType(int type, int variant, int subType) -{ - if (((this->_type == type) && ((variant == -1 || (this->_variant == variant)))) && - ((subType == -1 || (this->_subtype == subType)))) { - return 1; - } - return 0; -} - -// 00417260 -int Entity::Type() -{ - return this->_type; -} - -// 00417270 -int Entity::Variant() -{ - return this->_variant; -} - -// 00417280 -int Entity::SubType() -{ - return this->_subtype; -} - -// 00417290 -Vector * Entity::Position(Vector *outPos) -{ - float posY; - - posY = (this->_pos).y; - outPos->x = (this->_pos).x; - outPos->y = posY; - return outPos; -} - -// 004172d0 -Vector * Entity::Velocity(Vector *outVelocity) -{ - float velocityY; - - velocityY = (this->_velocity).y; - outVelocity->x = (this->_velocity).x; - outVelocity->y = velocityY; - return outVelocity; -} - -// 004172f0 -void Entity::SetPositionOffset(Vector *offset) -{ - (this->_posOffset).x = offset->x; - (this->_posOffset).y = offset->y; - return; -} - -// 00417310 -Vector * Entity::PositionOffset() -{ - return &this->_posOffset; -} - -// 00417320 -Vector * Entity::SpriteScale() -{ - return &(this->_sprite)._scale; -} - -// 00417330 -long double Entity::SpriteRotation() -{ - return (long double)(this->_sprite)._rotation; -} - -// 00417360 -float Entity::MaxHitPoints() -{ - return this->_maxHitPoints; -} - -// 00417370 -long double Entity::HitPoints() -{ - return (long double)this->_health; -} - -// 00417380 -int Entity::EntityCollisionClass() -{ - return this->_entityCollisionClass; -} - -// 004173b0 -uint8_t Entity::is_player() -{ - return this->_type == 1; -} - -// 004173c0 -bool Entity::is_bomb() -{ - return this->_type == 4; -} - -// 004173e0 -void Entity::AddEntityFlags(uint64_t flags) -{ - uint32_t *flagsHigh; - - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | GHIDRA_UINT(flags); - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHigh = *flagsHigh | (*GHIDRA_CAST((GHIDRA_CAST(&(flags)) + 0x4))); - return; -} - -// 00417400 -void Entity::ClearEntityFlags(uint64_t flags) -{ - uint32_t *flagsHigh; - - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) & ~GHIDRA_UINT(flags); - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHigh = *flagsHigh & ~(*GHIDRA_CAST((GHIDRA_CAST(&(flags)) + 0x4))); - return; -} - -// 00417420 -uint64_t Entity::GetEntityFlags() -{ - return this->_flags; -} - -// 00417430 -uint8_t Entity::HasEntityFlags(uint64_t flags) -{ - if ((GHIDRA_UINT(flags) & GHIDRA_UINT(this->_flags)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(flags)) + 0x4)))) == 0) { - return 0; - } - return 1; -} - -// 00417460 -uint8_t Entity::Exists() -{ - return this->_exists; -} - -// 00417470 -uint8_t Entity::IsDead() -{ - return this->_dead; -} - -// 00417480 -uint8_t Entity::Visible() -{ - return this->_visible; -} - -// 004174a0 -uint32_t Entity::SpawnerEntity() -{ - return this->_spawnerEntity; -} - -// 004174b0 -RNG * Entity::GetDropRNG() -{ - return &this->_dropRNG; -} - -// 004288f0 -void Entity::SetPosition(Vector *pos) -{ - (this->_pos).x = pos->x; - (this->_pos).y = pos->y; - return; -} - -// 00428910 -void Entity::SetVelocity(Vector *velocity) -{ - (this->_velocity).x = velocity->x; - (this->_velocity).y = velocity->y; - return; -} - -// 0042a250 -uint8_t Entity::IsFamiliar() -{ - return this->_type == 3; -} - -// 0042a260 -uint32_t Entity::Parent() -{ - return this->_parent; -} - -// 0042d9b0 -void Entity::SetSpriteScale(Vector *scale) -{ - (this->_sprite)._scale.x = scale->x; - (this->_sprite)._scale.y = scale->y; - return; -} - -// 00431430 -int Entity::SpawnerType() -{ - return this->_spawnerType; -} - -// 00431440 -int Entity::SpawnerVariant() -{ - return this->_spawnerVariant; -} - -// 00431450 -void Entity::AddVelocity(Vector *velocity, uint8_t isIgnoreSpeedMultiplier) -{ - float multiplier; - float velocityY; - - if (isIgnoreSpeedMultiplier == 0) { - multiplier = this->_speedMultiplier; - } - else { - multiplier = 1.0; - } - velocityY = velocity->y; - (this->_velocity).x = multiplier * velocity->x + (this->_velocity).x; - (this->_velocity).y = velocityY * multiplier + (this->_velocity).y; - return; -} - -// 004314b0 -void Entity::AddVelocity_divided(Vector *velocity, uint8_t isIgnoreSpeedMultiplier) -{ - float fVar1; - float speedMultiplier; - float velocityY; - - fVar1 = this->_friction; - if (fVar1 != 0.0) { - if (isIgnoreSpeedMultiplier == 0) { - speedMultiplier = this->_speedMultiplier; - } - else { - speedMultiplier = 1.0; - } - velocityY = velocity->y; - (this->_velocity).x = (speedMultiplier * velocity->x) / fVar1 + (this->_velocity).x; - (this->_velocity).y = (velocityY * speedMultiplier) / fVar1 + (this->_velocity).y; - } - return; -} - -// 00431520 -long double Entity::Mass() -{ - return (long double)this->_mass; -} - -// 00431530 -uint8_t Entity::IsTear() -{ - return this->_type == 2; -} - -// 00431540 -uint8_t Entity::IsProjectile() -{ - return this->_type == 9; -} - -// 00431550 -bool Entity::is_pickup() -{ - return this->_type == 5; -} - -// 00431560 -uint32_t Entity::Child() -{ - return this->_child; -} - -// 00435ce0 -void Entity::get_friction() -{ - return; -} - -// 00435d10 -long double Entity::DepthOffset() -{ - return (long double)this->_renderDepthOffset; -} - -// 00435d20 -void Entity::SetField380(float value) -{ - this->_health = value; - return; -} - -// 00435d60 -void Entity::SetTargetPosition(Vector position) -{ - (this->_targetPosition).x = position.x; - (this->_targetPosition).y = position.y; - return; -} - -// 00435da0 -bool Entity::is_slot() -{ - return this->_type == 6; -} - -// 00435db0 -int Entity::GetHitPointsLost() -{ - return GHIDRA_INT(this->_updateTime) - GHIDRA_INT(this->_prevUpdateTime); -} - -// 00435dd0 -ANM2 * Entity::GetSprite() -{ - return &this->_sprite; -} - -// 00435e00 -Entity * Entity::to_npc_or_coop_player() -{ - if ((this == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (this->_type != 1)) && - (0x3dd < this->_type - 10U)))) { - return GHIDRA_CAST(0x0); - } - return this; -} - -// 00435e40 -Entity_Tear * Entity::ToTear() -{ - if ((this == GHIDRA_CAST(0x0)) || (this->_type != 2)) { - return GHIDRA_CAST(0x0); - } - return GHIDRA_CAST(this); -} - -// 00436220 -void Entity::SetVisibleFlag(uint8_t isVisible) -{ - if ((isVisible == 0) || ((this->_flags & 0x20000000) != 0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(this[3])) + 0xc))) = 0; - return; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(this[3])) + 0xc))) = 1; - return; -} - -// 00440eb0 -int Entity::GridCollisionClass() -{ - return this->_entityGridCollisionClass; -} - -// 00444c60 -void Entity::Die() -{ - this->_dead = 1; - return; -} - -// 004567b0 -uint8_t Entity::IsFriendly() -{ - if ((this->_flags & 0x20000000) == 0) { - return 0; - } - return 1; -} - -// 00499da0 -Entity_Player * Entity::ToPlayer() -{ - if ((this == GHIDRA_CAST(0x0)) || (this->_type != 1)) { - return GHIDRA_CAST(0x0); - } - return GHIDRA_CAST(this); -} - -// 0049cb50 -Vector * Entity::SpriteOffset() -{ - return &(this->_sprite)._offset; -} - -// 004aad30 -Vector * Entity::TargetPosition() -{ - return &this->_targetPosition; -} - -// 004b7080 -uint32_t Entity::Target() -{ - return this->_target; -} - -// 004e47a0 -ColorMod * Entity::SplatColor() -{ - return &this->_splatColor; -} - -// 00505b60 -ColorMod * Entity::GetColor() -{ - return &(this->_sprite)._color; -} - -// 00505b70 -int Entity::InitSeed() -{ - return this->_initSeed; -} - -// 00592250 -int Entity::SortingLayer() -{ - return this->_sortingLayer; -} - -// 005a6ff0 -void Entity::MultiplyFriction(float param_2) -{ - this->_friction = param_2 * this->_friction; - return; -} - -// 005b1570 -long double Entity::CollisionDamage() -{ - return (long double)this->_collisionDamage; -} - -// 005b1580 -uint8_t Entity::IsInvincible() -{ - return this->_isInvicible; -} - -// 005b1590 -int Entity::DropSeed() -{ - return (this->_dropRNG)._seed; -} - -// 005ccbe0 -void Entity::SetCollisionDamage(float param_2) -{ - this->_collisionDamage = param_2; - return; -} - -// 005ccc00 -uint8_t Entity::IsBoss() -{ - return 0; -} - -// 005ccc10 -uint8_t Entity::TryThrow() -{ - return 0; -} - -// 005cd460 -void Entity::AddFlagsLow(uint32_t param_2) -{ - float *flagsLow; - - flagsLow = (this->_sprite)._color._offset; - *flagsLow = (float)(GHIDRA_UINT(*flagsLow) | param_2); - return; -} - -// 0060af70 -Entity * Entity::AddFear(int param_2, int param_3, int param_4) -{ - uint32_t seed; - Entity *effect; - uint32_t *in_EDX; - float parentX; - float parentY; - uint8_t local_3c [2]; - uint8_t auStack_3a [2]; - uint32_t effectColor; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t local_28; - uint32_t uStack_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t local_18; - uint32_t local_14; - uint32_t local_10; - uint32_t local_c; - float parentX; - float parentY; - - local_c = __security_cookie ^ GHIDRA_UINT(local_3c); - seed = Random(); - effect = Game::SpawnEx(g_game,1000,0x79,GHIDRA_CAST(this),&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - local_18 = 0; - parentY = 0.0; - local_14 = 0; - local_28 = 0; - uStack_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - effectColor = *in_EDX; - uStack_34 = in_EDX[1]; - uStack_30 = in_EDX[2]; - uStack_2c = in_EDX[3]; - local_10 = 0; - effect->SetColor(&effectColor,0xffffffff,0xff); - parentX = parentY * g_vectorOne.x; - if (param_2 < 1) { - param_2 = -1; - } - parentY = parentY * g_vectorOne.y; - *GHIDRA_CAST((effect[1]._sprite._filename._buf + 4)) = param_2; - *GHIDRA_CAST((effect[1]._sprite._filename._buf + 8)) = param_2; - (effect->_sprite)._scale.x = parentX; - if (param_3 < 1) { - param_3 = 6; - } - (effect->_sprite)._scale.y = parentY; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(effect[1])) + 0x40)))) = param_3; - if (param_4 != 0) { - if (effect->_parent != 0) { - msvc::multiset::erase(local_3c + -0x14); - } - effect->_parent = param_4; - msvc::multiset::insert(&effect->_parent); - parentY = (effect->_pos).x; - parentX = (effect->_pos).y; - parentX = *GHIDRA_CAST((param_4 + 0x33c)); - parentY = *GHIDRA_CAST((param_4 + 0x340)); - effect[1]._sprite._filename._buf[0xc] = '\x01'; - effect[1]._sprite._filename._size = GHIDRA_UINT((parentY - parentX)); - effect[1]._sprite._filename._capacity = GHIDRA_UINT((parentX - parentY)); - } - return effect; -} - -// 0064bb70 -void Entity::convert_shot_for_enemy_owner(Entity *shot) -{ - uint8_t *pbVar1; - int iVar2; - Vector targetPos; - Entity *pEVar3; - uint32_t seed; - Entity *pEVar4; - Entity_NPC *pEVar5; - float fVar6; - uint32_t variant; - Vector local_20; - Vector local_18; - Vector local_10; - uint32_t flagsHigh; - float *shotOffsetY; - - if ((((this->_flags & 0x100) != 0) && - (pEVar4 = *GHIDRA_CAST((*GHIDRA_CAST((this + 1)) + 0x3c8)), pEVar4 != GHIDRA_CAST(0x0))) && - (((local_20.x = (float)&pEVar4->_type, 1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && - (*GHIDRA_CAST(local_20.x) == 1)) || (*GHIDRA_CAST(local_20.x) - 10U < 0x3de)))) { - iVar2 = shot->_type; - local_18.x = (float)this; - if (iVar2 == 2) { - seed = Random(); - local_20.x = (shot->_pos).x; - local_18.x = (shot->_velocity).x * 0.8; - local_20.y = (shot->_pos).y; - local_18.y = (shot->_velocity).y * 0.8; - pEVar4 = Game::SpawnEx(g_game,9,0,&local_20,&local_18,pEVar4,0,seed,0); - iVar2 = *GHIDRA_CAST(pEVar4); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar4[1])) + 0x8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(shot[1])) + 0x8)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar4[1])) + 0x4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(shot[1])) + 0x4)))); - *GHIDRA_CAST((pEVar4 + 1)) = *GHIDRA_CAST((shot + 1)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar4[1])) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(shot[1])) + 0x10)))); - (**(code **)(iVar2 + 0x3c))(&shot->_color,0xffffffff,0xff,0,1); - shot->Remove(); - return; - } - if (iVar2 == 3) { - if (shot->_variant == 0x2b) { - seed = Random(); - local_20.x = (shot->_velocity).x; - local_20.y = (shot->_velocity).y; - local_10.x = (shot->_pos).x; - local_10.y = (shot->_pos).y; - pEVar4 = Game::SpawnEx(g_game,0x12,0,&local_10,&local_20,pEVar4,0,seed,0); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&pEVar4->_flags) + 4)); - fVar6 = pEVar4->_maxHitPoints + pEVar4->_maxHitPoints; - *GHIDRA_CAST(&pEVar4->_flags) = GHIDRA_UINT(pEVar4->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar4->_flags) + 4)) = flagsHigh; - pEVar4->_maxHitPoints = fVar6; - pEVar4->_health = fVar6; - shot->Remove(); - if (*GHIDRA_CAST((GHIDRA_CAST(local_18.x) + 0x2c)) == 0x36) { - pbVar1 = &(GHIDRA_CAST((GHIDRA_INT(local_18.x) + 0xc30)))->_collidesWithGrid; - if (*GHIDRA_CAST(&(GHIDRA_CAST((GHIDRA_INT(local_18.x) + 0xc30)))->_collidesWithGrid) != 0) { - local_18.x = (float)pbVar1; - msvc::multiset::erase(&local_18); - } - *GHIDRA_CAST(pbVar1) = pEVar4; - msvc::multiset::insert(pbVar1); - } - return; - } - if (shot->_variant == 0x49) { - shotOffsetY = &(shot->_posOffset).y; - if ((*shotOffsetY <= 0.0 && *shotOffsetY != 0.0) || - (shotOffsetY = shot[3]._sprite._championColor._offset, - *shotOffsetY <= 0.0 && *shotOffsetY != 0.0)) { - local_20.y = (shot->_pos).y; - local_20.x = (shot->_pos).x; - targetPos.y = g_vectorZero.y; - targetPos.x = g_vectorZero.x; - pEVar5 = Entity_NPC::ThrowSpider(&local_20,pEVar4,targetPos,0,(this->_posOffset).y); - } - else { - seed = Random(); - local_10.x = (shot->_velocity).x; - local_10.y = (shot->_velocity).y; - local_18.x = (shot->_pos).x; - local_18.y = (shot->_pos).y; - pEVar5 = GHIDRA_CAST(Game)::SpawnEx(g_game,0x55,0,&local_18,&local_10,pEVar4,0,seed,0); - } - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)); - fVar6 = pEVar5->_maxHitPoints + pEVar5->_maxHitPoints; - *GHIDRA_CAST(&pEVar5->_flags) = GHIDRA_UINT(pEVar5->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)) = flagsHigh; - pEVar5->_maxHitPoints = fVar6; - pEVar5->_health = fVar6; - shot->Remove(); - return; - } - } - else if (iVar2 == 7) { - local_18.x = (float)&shot->_spawnerEntity; - pEVar3 = this; - if (shot->_spawnerEntity != 0) { - msvc::multiset::erase(&local_18); - pEVar3 = GHIDRA_CAST(local_18.x); - } - local_18.x = (float)pEVar3; - shot->_spawnerEntity = pEVar4; - msvc::multiset::insert(&shot->_spawnerEntity); - shot->_spawnerType = *GHIDRA_CAST(local_20.x); - shot->_spawnerVariant = pEVar4->_variant; - } - else if (iVar2 == 1000) { - if (((shot->_variant != 0x2e) || (iVar2 = this[3]._entityRef4._variant, iVar2 == 0)) || - (*GHIDRA_CAST((iVar2 + 0x3a4)) <= 30.0)) { - if (shot->_variant != 0x2c) { - return; - } - seed = Random(); - variant = 0x19; - } - else { - seed = Random(); - variant = 0x16; - } - local_10.x = (shot->_velocity).x; - local_10.y = (shot->_velocity).y; - local_18.x = (shot->_pos).x; - local_18.y = (shot->_pos).y; - pEVar4 = Game::SpawnEx(g_game,1000,variant,&local_18,&local_10,pEVar4,0,seed,0); - iVar2 = *GHIDRA_CAST(pEVar4); - (pEVar4->_sprite)._scale.x = (shot->_sprite)._scale.x; - (pEVar4->_sprite)._scale.y = (shot->_sprite)._scale.y; - (**(code **)(iVar2 + 0xc))(); - shot->Remove(); - return; - } - } - return; -} - -// 00665a80 -uint8_t Entity::CollidesWithGrid() -{ - int in_ECX; - - return *GHIDRA_CAST((in_ECX + 400)); -} - -// 0067a720 -void Entity::GetRootParent() -{ - Entity *nextSpawner; - Entity *spawner; - - nextSpawner = GHIDRA_CAST(this->_spawnerEntity); - while (spawner = nextSpawner, spawner != GHIDRA_CAST(0x0)) { - this = spawner; - nextSpawner = GHIDRA_CAST(spawner->_spawnerEntity); - } - if (this->_type == 1) { - return; - } - return; -} - -// 006a8290 -void Entity::constructor() -{ - void *referrerHead; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - puStack_c = &LAB_00afa397; - local_10 = ExceptionList; - ExceptionList = &local_10; - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity::vftable; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10)))) = 0; - local_8 = 0; - this->_type = 0; - this->_spawnerType = 0; - this->_spawnerVariant = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x3c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x40)))) = 0xffffffff; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x44)))) = 0xffffffff; - ANM2::constructor(&this->_sprite); - (this->_shadowOffset).y = 0.0; - (this->_shadowOffset).x = 0.0; - this->_valid = 0; - this->_exists = 0; - (this->_collisionPoints)._begin = (void *)0x0; - (this->_collisionPoints)._end = (void *)0x0; - (this->_collisionPoints)._capacity = (void *)0x0; - (this->_gridCollisionVelocity).y = 0.0; - (this->_gridCollisionVelocity).x = 0.0; - (this->_gridCollisionNormal).y = 0.0; - (this->_gridCollisionNormal).x = 0.0; - (this->_renderPosition).y = 0.0; - (this->_renderPosition).x = 0.0; - (this->_colorParams)._begin = (void *)0x0; - (this->_colorParams)._end = (void *)0x0; - (this->_colorParams)._capacity = (void *)0x0; - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); - (this->_color)._tint[0] = 1.0; - (this->_color)._tint[1] = 1.0; - (this->_color)._tint[2] = 1.0; - (this->_color)._tint[3] = 1.0; - (this->_color)._colorize[0] = 0.0; - (this->_color)._colorize[1] = 0.0; - (this->_color)._colorize[2] = 0.0; - (this->_color)._colorize[3] = 0.0; - (this->_color)._offset[0] = 0.0; - (this->_color)._offset[1] = 0.0; - (this->_color)._offset[2] = 0.0; - (this->_splatColor)._tint[0] = 1.0; - (this->_splatColor)._tint[1] = 1.0; - (this->_splatColor)._tint[2] = 1.0; - (this->_splatColor)._tint[3] = 1.0; - (this->_splatColor)._colorize[0] = 0.0; - (this->_splatColor)._colorize[1] = 0.0; - (this->_splatColor)._colorize[2] = 0.0; - (this->_splatColor)._colorize[3] = 0.0; - (this->_splatColor)._offset[0] = 0.0; - (this->_splatColor)._offset[1] = 0.0; - (this->_splatColor)._offset[2] = 0.0; - (this->_charmSource)._type = 0; - (this->_charmSource)._variant = 0; - (this->_charmSource)._spawnerType = 0; - (this->_charmSource)._spawnerVariant = 0; - (this->_charmSource)._position.x = g_vectorZero.x; - (this->_charmSource)._position.y = g_vectorZero.y; - (this->_charmSource)._velocity.x = g_vectorZero.x; - (this->_charmSource)._velocity.y = g_vectorZero.y; - (this->_charmSource)._flags = 0; - (this->_charmSource)._entity = (void *)0x0; - (this->_entityRef2)._type = 0; - (this->_entityRef2)._variant = 0; - (this->_entityRef2)._spawnerType = 0; - (this->_entityRef2)._spawnerVariant = 0; - (this->_entityRef2)._position.x = g_vectorZero.x; - (this->_entityRef2)._position.y = g_vectorZero.y; - (this->_entityRef2)._velocity.x = g_vectorZero.x; - (this->_entityRef2)._velocity.y = g_vectorZero.y; - (this->_entityRef2)._flags = 0; - (this->_entityRef2)._entity = (void *)0x0; - (this->_entityRef3)._type = 0; - (this->_entityRef3)._variant = 0; - (this->_entityRef3)._spawnerType = 0; - (this->_entityRef3)._spawnerVariant = 0; - (this->_entityRef3)._position.x = g_vectorZero.x; - (this->_entityRef3)._position.y = g_vectorZero.y; - (this->_entityRef3)._velocity.x = g_vectorZero.x; - (this->_entityRef3)._velocity.y = g_vectorZero.y; - (this->_entityRef3)._flags = 0; - (this->_entityRef3)._entity = (void *)0x0; - (this->_entityRef4)._type = 0; - (this->_entityRef4)._variant = 0; - (this->_entityRef4)._spawnerType = 0; - (this->_entityRef4)._spawnerVariant = 0; - (this->_entityRef4)._position.x = g_vectorZero.x; - (this->_entityRef4)._position.y = g_vectorZero.y; - (this->_entityRef4)._velocity.x = g_vectorZero.x; - (this->_entityRef4)._velocity.y = g_vectorZero.y; - (this->_entityRef4)._flags = 0; - (this->_entityRef4)._entity = (void *)0x0; - (this->_knockbackDirection).y = 0.0; - (this->_knockbackDirection).x = 0.0; - this->_iceFrozenEffect = 0; - (this->_pausePosition).y = 0.0; - (this->_pausePosition).x = 0.0; - (this->_targetPosition).y = 0.0; - (this->_targetPosition).x = 0.0; - (this->_pos).y = 0.0; - (this->_pos).x = 0.0; - (this->_preInterpolatePos).y = 0.0; - (this->_preInterpolatePos).x = 0.0; - (this->_posOffset).y = 0.0; - (this->_posOffset).x = 0.0; - (this->_velocity).y = 0.0; - (this->_velocity).x = 0.0; - (this->_sizeMulti).y = 0.0; - (this->_sizeMulti).x = 0.0; - (this->_prevPosition).y = 0.0; - (this->_prevPosition).x = 0.0; - (this->_prevVelocity).y = 0.0; - (this->_prevVelocity).x = 0.0; - this->_parent = 0; - this->_child = 0; - this->_target = 0; - this->_spawnerEntity = 0; - (this->_entityPtrReferrers)._head = (void *)0x0; - (this->_entityPtrReferrers)._size = 0; - referrerHead = operator_new(0x14); - *(void **)referrerHead = referrerHead; - *(void **)(GHIDRA_CAST(referrerHead) + 4) = referrerHead; - *(void **)(GHIDRA_CAST(referrerHead) + 8) = referrerHead; - *GHIDRA_CAST((GHIDRA_CAST(referrerHead) + 0xc)) = 0x101; - (this->_entityPtrReferrers)._head = referrerHead; - this->_minecart = 0; - this->_hitEffect = 0; - (this->_dropRNG)._shift1 = 5; - (this->_dropRNG)._shift2 = 9; - (this->_dropRNG)._shift3 = 7; - (this->_dropRNG)._seed = -0x55e8beb1; - (this->_holdPosition).y = 0.0; - (this->_holdPosition).x = 0.0; - this->_scoreMultiplier = 1.0; - this->_luaBridgeRef = (void *)0x0; - ExceptionList = local_10; - return; -} - -// 006a8850 -void Entity::destructor() -{ - std_multiset *referrers; - uint32_t uVar1; - int *erasedRef; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *entityRef; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afa3c0; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity::vftable; - if (this->_exists != 0) { - Remove(this); - } - entityRef = this->_luaBridgeRef; - if (entityRef != GHIDRA_CAST(0x0)) { - luaL_unref(*entityRef,0xfff0b9d8,entityRef[1],uVar1); - operator_delete(entityRef,8); - this->_luaBridgeRef = (void *)0x0; - } - entityRef = &this->_hitEffect; - if (*entityRef != 0) { - erasedRef = entityRef; - msvc::multiset::erase(&erasedRef); - *entityRef = 0; - } - entityRef = &this->_minecart; - if (*entityRef != 0) { - erasedRef = entityRef; - msvc::multiset::erase(&erasedRef); - *entityRef = 0; - } - referrers = &this->_entityPtrReferrers; - FID_conflict__Erase_tree_>_> - (referrers,(fuzzer_allocator_> *)referrers, - *(_Tree_node **)(GHIDRA_INT((this->_entityPtrReferrers)._head) + 4)); - operator_delete(referrers->_head,0x14); - vector_0x3c_tidy(); - msvc::vector::_Tidy(); - local_8 = 2; - ANM2::Reset(&this->_sprite); - AnimationState::~AnimationState(&(this->_sprite)._overlayAnimState); - AnimationState::~AnimationState(&(this->_sprite)._animState); - (GHIDRA_CAST(((this->_sprite)._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->msvc::string::_Tidy_deallocate(); - FUN_0041c7d0(); - ExceptionList = local_10; - return; -} - -// 006a8990 -Entity * Entity::GetLastParent() -{ - Entity *nextParent; - Entity *parent; - - nextParent = GHIDRA_CAST(this->_parent); - while (parent = nextParent, parent != GHIDRA_CAST(0x0)) { - this = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - return this; -} - -// 006a89b0 -Entity * Entity::GetLastChild() -{ - Entity *child; - Entity *nextChild; - - nextChild = GHIDRA_CAST(this->_child); - while (child = nextChild, child != GHIDRA_CAST(0x0)) { - this = child; - nextChild = GHIDRA_CAST(child->_child); - } - return this; -} - -// 006a89d0 -Entity * Entity::GetLastSpawner() -{ - Entity *nextSpawner; - Entity *spawner; - - nextSpawner = GHIDRA_CAST(this->_spawnerEntity); - while (spawner = nextSpawner, spawner != GHIDRA_CAST(0x0)) { - this = spawner; - nextSpawner = GHIDRA_CAST(spawner->_spawnerEntity); - } - return this; -} - -// 006a89f0 -Entity * Entity::GetStatusEffectTarget() -{ - uint8_t isSharingStatus; - Entity *extraout_EDX; - Entity *target; - Entity *next; - Entity *parent; - - isSharingStatus = DoesEntityShareStatus(this); - target = extraout_EDX; - if (isSharingStatus != 0) { - next = GHIDRA_CAST(extraout_EDX->_parent); - target = extraout_EDX; - while (parent = next, parent != GHIDRA_CAST(0x0)) { - target = parent; - next = GHIDRA_CAST(parent->_parent); - } - } - return target; -} - -// 006a8a20 -void Entity::CopyStatusEffects() -{ - uint8_t isSharingStatus; - char isBoss; - int *child; - uint32_t flagsHigh; - - isSharingStatus = DoesEntityShareStatus(this); - if (isSharingStatus != 0) { - for (child = GHIDRA_CAST(this->_child); child != GHIDRA_CAST(0x0); child = GHIDRA_CAST(child[0xf0])) { - child[0x86] = this->_freezeCountdown; - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - child[0x5a] = child[0x5a] & 0xdeffe01fU | GHIDRA_UINT(this->_flags) & 0x21001fe0; - child[0x5b] = child[0x5b] & 0xfea27fffU | flagsHigh & 0x15d8000; - child[0x87] = this->_poisonCountdown; - child[0x88] = this->_slowingCountdown; - child[0x89] = this->_charmedCountdown; - child[0x8a] = this->_confusionCountdown; - child[0x8b] = this->_midasFreezeCountdown; - child[0x8c] = this->_fearCountdown; - child[0x8d] = this->_burnCountdown; - child[0xba] = this->_bleedingCountdown; - child[0x8f] = this->_shrinkCountdown; - child[200] = GHIDRA_INT(this->_poisonTickDamage); - child[0xc9] = GHIDRA_INT(this->_burnTickDamage); - child[0xbc] = this->_magnetizedCountdown; - child[0xbd] = this->_baitedCountdown; - child[0xbe] = this->_knockbackCountdown; - child[0xc2] = GHIDRA_INT((this->_knockbackDirection).x); - child[0xc3] = GHIDRA_INT((this->_knockbackDirection).y); - child[0xc0] = this->_iceCountdown; - child[0xbf] = this->_weaknessCountdown; - child[0xc1] = this->_brimstoneMarkCountdown; - child[0xed] = GHIDRA_INT(this->_shrinkStatus1); - child[0xee] = GHIDRA_INT(this->_shrinkStatus2); - isBoss = this->IsBoss(); - if (((isBoss != '\0') || ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (this->_type == 1)))) && - ((isBoss = (**(code **)(*child + 0x4c))(), isBoss != '\0' || - ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (child[10] == 1)))))) { - child[0x8e] = this->_bossStatusEffectCooldown; - } - } - } - return; -} - -// 006a8c00 -uint8_t Entity::HasCommonParentWithEntity(Entity *other) -{ - Entity *pEVar1; - Entity *pEVar2; - Entity *otherRoot; - Entity *nextAncestor; - Entity *ancestor; - - if ((other != GHIDRA_CAST(0x0)) && (other->_type == 0xde)) { - return 0; - } - otherRoot = GHIDRA_CAST(0x0); - if (other != GHIDRA_CAST(0x0)) { - nextAncestor = GHIDRA_CAST(other->_parent); - otherRoot = other; - while (ancestor = nextAncestor, ancestor != GHIDRA_CAST(0x0)) { - otherRoot = ancestor; - nextAncestor = GHIDRA_CAST(ancestor->_parent); - } - } - pEVar2 = GHIDRA_CAST(this->_parent); - while (pEVar1 = pEVar2, pEVar1 != GHIDRA_CAST(0x0)) { - this = pEVar1; - pEVar2 = GHIDRA_CAST(pEVar1->_parent); - } - return otherRoot == this; -} - -// 006a8c60 -uint8_t Entity::is_same_segmented_body(Entity *other) -{ - Entity *ancestor; - Entity *nextParent; - int type; - - type = this->_type; - if (type < 0xd9) { - if (type != 0xd8) { - switch(type) { - case 0x13: - case 0x1c: - case 0x23: - case 0x3e: - case 0x59: - break; - default: - goto switchD_006a8c86_caseD_14; - } - } - } - else if (type < 0x38e) { - if ((type != 0x38d) && (type != 0xef)) { - if (type != 0xf4) { - return 0; - } - if (this->_variant != 2) { - return 0; - } - if (other == GHIDRA_CAST(0x0)) { - return 1; - } - if (other->_type == 0xde) { - return 0; - } - nextParent = GHIDRA_CAST(other->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - other = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - if (other == this) { - return 1; - } - return 0; - } - } - else if ((type != 0x390) && (type != 0x396)) { - return 0; - } - if (other == GHIDRA_CAST(0x0)) { - return 1; - } - if (other->_type != 0xde) { - nextParent = GHIDRA_CAST(other->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - other = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - if (other == this) { - return 1; - } - } -switchD_006a8c86_caseD_14: - return 0; -} - -// 006a8db0 -uint8_t Entity::DoesEntityShareStatus() -{ - int entityType; - - entityType = this->_type; - if (entityType < 0x38e) { - if (entityType != 0x38d) { - switch(entityType) { - case 0x13: - case 0x1c: - case 0x23: - case 0x3e: - case 0x4f: - case 0x59: - case 0x5c: - case 0x5d: - case 0x61: - case 0x62: - case 0xd8: - case 0xef: - break; - default: - return 0; - case 0xf4: - if (this->_variant != 2) { - return 0; - } - } - } - } - else if ((entityType != 0x390) && (entityType != 0x396)) { - return 0; - } - return 1; -} - -// 006a8ee0 -uint8_t Entity::IsValidTarget(Entity *target) -{ - uint8_t isSameBody; - - if (target != this) { - isSameBody = is_same_segmented_body(this,target); - if ((isSameBody == 0) && ((this->_type != 0xde || (target->_type != 0xde)))) { - return 1; - } - } - return 0; -} - -// 006a8f20 -uint8_t Entity::is_valid_boss_enemy(int unused) -{ - char isCanShutDoors; - - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_type == 1)) || - (this->_type - 10U < 0x3de)) { - isCanShutDoors = this->CanShutDoors(); - if (((isCanShutDoors != '\0') && (this->_type != 0x362)) && ((this->_flags & 0x20000000) == 0)) - { - return 1; - } - } - return 0; -} - -// 006a8f80 -uint8_t Entity::CanDevolve() -{ - void *config; - - config = this->_config; - if ((config == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(config) + 0xa4)) == *GHIDRA_CAST((GHIDRA_CAST(config) + 0xa8)))) { - return 0; - } - return 1; -} - -// 006a8fa0 -uint8_t Entity::IsDescendantOf(Entity *ancestor) -{ - Entity *pEVar1; - void *pvVar2; - uint8_t *visitedFlag; - uint8_t isDescendant; - uint8_t findResult [8]; - void *foundNode; - void *visitedSet; - uint32_t visitedCount; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity *current; - - pEVar1 = ancestor; - local_8 = 0xffffffff; - puStack_c = &LAB_00afa3ed; - local_10 = ExceptionList; - if (ancestor == GHIDRA_CAST(0x0)) { - return 0; - } - if (ancestor == this) { - return 1; - } - visitedSet = (void *)0x0; - visitedCount = 0; - ExceptionList = &local_10; - visitedSet = operator_new(0x18); - *(void **)visitedSet = visitedSet; - *(void **)(GHIDRA_CAST(visitedSet) + 4) = visitedSet; - *(void **)(GHIDRA_CAST(visitedSet) + 8) = visitedSet; - *GHIDRA_CAST((GHIDRA_CAST(visitedSet) + 0xc)) = 0x101; - local_8 = 0; - current = GHIDRA_CAST(this->_parent); - while (ancestor = current, current != GHIDRA_CAST(0x0)) { - if (current == pEVar1) goto LAB_006a9133; - _Find_lower_bound<>(findResult,&ancestor); - if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) <= current)) && (foundNode != visitedSet)) break; - visitedFlag = GHIDRA_CAST(_Entity)::GetAncestorField(&ancestor); - *visitedFlag = 1; - current = GHIDRA_CAST(ancestor->_parent); - } - pvVar2 = visitedSet; - FID_conflict__Erase_tree_>_> - (&visitedSet,(fuzzer_allocator_> *)&visitedSet, - *(_Tree_node **)(GHIDRA_INT(visitedSet) + 4)); - *(void **)(GHIDRA_CAST(pvVar2) + 4) = pvVar2; - *(void **)pvVar2 = pvVar2; - *(void **)(GHIDRA_CAST(pvVar2) + 8) = pvVar2; - current = GHIDRA_CAST(this->_spawnerEntity); - visitedCount = 0; - while (ancestor = current, current != GHIDRA_CAST(0x0)) { - if (current == pEVar1) goto LAB_006a9133; - _Find_lower_bound<>(findResult,&ancestor); - if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) <= current)) && (foundNode != visitedSet)) break; - visitedFlag = GHIDRA_CAST(_Entity)::GetAncestorField(&ancestor); - *visitedFlag = 1; - current = GHIDRA_CAST(ancestor->_spawnerEntity); - } - isDescendant = 0; -LAB_006a90ff: - FID_conflict__Erase_tree_>_> - (&visitedSet,(fuzzer_allocator_> *)&visitedSet, - *(_Tree_node **)(GHIDRA_INT(visitedSet) + 4)); - operator_delete(visitedSet,0x18); - ExceptionList = local_10; - return isDescendant; -LAB_006a9133: - isDescendant = 1; - goto LAB_006a90ff; -} - -// 006a9140 -Entity * Entity::GetPlayerAncestor() -{ - void *visitedHead; - uint8_t *visitedFlag; - Entity *ancestor; - uint8_t findResult [8]; - void *foundNode; - void *visited; - uint32_t visitedSize; - Entity *current; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afa41d; - local_10 = ExceptionList; - ExceptionList = &local_10; - visited = (void *)0x0; - visitedSize = 0; - visited = operator_new(0x18); - *(void **)visited = visited; - *(void **)(GHIDRA_CAST(visited) + 4) = visited; - *(void **)(GHIDRA_CAST(visited) + 8) = visited; - *GHIDRA_CAST((GHIDRA_CAST(visited) + 0xc)) = 0x101; - local_8 = 0; - current = this; - if (this != GHIDRA_CAST(0x0)) { - do { - ancestor = current; - if (current->_type == 1) goto LAB_006a926c; - _Find_lower_bound<>(findResult,¤t); - if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) <= ancestor)) && (foundNode != visited)) break; - visitedFlag = GHIDRA_CAST(_Entity)::GetAncestorField(¤t); - *visitedFlag = 1; - current = GHIDRA_CAST(current->_parent); - } while (current != GHIDRA_CAST(0x0)); - } - visitedHead = visited; - FID_conflict__Erase_tree_>_> - (&visited,(fuzzer_allocator_> *)&visited, - *(_Tree_node **)(GHIDRA_INT(visited) + 4)); - *(void **)(GHIDRA_CAST(visitedHead) + 4) = visitedHead; - *(void **)visitedHead = visitedHead; - *(void **)(GHIDRA_CAST(visitedHead) + 8) = visitedHead; - visitedSize = 0; - current = this; - if (this != GHIDRA_CAST(0x0)) { - do { - ancestor = current; - if (current->_type == 1) goto LAB_006a926c; - _Find_lower_bound<>(findResult,¤t); - if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) <= ancestor)) && (foundNode != visited)) break; - visitedFlag = GHIDRA_CAST(_Entity)::GetAncestorField(¤t); - *visitedFlag = 1; - current = GHIDRA_CAST(current->_spawnerEntity); - } while (current != GHIDRA_CAST(0x0)); - } - ancestor = GHIDRA_CAST(0x0); -LAB_006a926c: - FID_conflict__Erase_tree_>_> - (&visited,(fuzzer_allocator_> *)&visited, - *(_Tree_node **)(GHIDRA_INT(visited) + 4)); - operator_delete(visited,0x18); - ExceptionList = local_10; - return ancestor; -} - -// 006a92a0 -void Entity::SetParent(Entity *parent) -{ - Entity *local_8; - uint32_t *parentRef; - - parentRef = &this->_parent; - local_8 = this; - if (*parentRef != 0) { - local_8 = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_8); - } - *parentRef = parent; - if (parent != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(parentRef); - } - return; -} - -// 006a92e0 -void Entity::SetChild(Entity *child) -{ - Entity *local_8; - uint32_t *childRef; - - childRef = &this->_child; - local_8 = this; - if (*childRef != 0) { - local_8 = GHIDRA_CAST(childRef); - msvc::multiset::erase(&local_8); - } - *childRef = child; - if (child != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(childRef); - } - return; -} - -// 006a9320 -void Entity::SetTarget(Entity *target) -{ - Entity *local_8; - uint32_t *targetPtr; - - targetPtr = &this->_target; - local_8 = this; - if (*targetPtr != 0) { - local_8 = GHIDRA_CAST(targetPtr); - msvc::multiset::erase(&local_8); - } - *targetPtr = target; - if (target != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(targetPtr); - } - return; -} - -// 006a9360 -void Entity::SetSpawnerEntity(Entity *spawner) -{ - Entity *local_8; - uint32_t *spawnerPtr; - - spawnerPtr = &this->_spawnerEntity; - local_8 = this; - if (*spawnerPtr != 0) { - local_8 = GHIDRA_CAST(spawnerPtr); - msvc::multiset::erase(&local_8); - } - *spawnerPtr = spawner; - if (spawner != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(spawnerPtr); - } - return; -} - -// 006a93a0 -void Entity::Init(int type, int variant, int subType, uint32_t initSeed) -{ - float fVar1; - uint32_t noScoreFlag; - uint32_t defaultColor [8]; - uint32_t local_10; - uint32_t uStack_c; - uint32_t local_8; - float baseFriction; - uint32_t damageEventsBegin; - Game *game; - uint32_t *luaRef; - int vtable; - - this->_type = type; - this->_variant = variant; - this->_subtype = subType; - this->_initSeed = initSeed; - (this->_dropRNG)._seed = initSeed; - (this->_dropRNG)._shift1 = 4; - (this->_dropRNG)._shift2 = 3; - (this->_dropRNG)._shift3 = 0x11; - (this->_splatColor)._tint[0] = 1.0; - (this->_splatColor)._tint[1] = 1.0; - (this->_splatColor)._tint[2] = 1.0; - (this->_splatColor)._tint[3] = 1.0; - (this->_splatColor)._colorize[0] = 0.0; - (this->_splatColor)._colorize[1] = 0.0; - (this->_splatColor)._colorize[2] = 0.0; - (this->_splatColor)._colorize[3] = 0.0; - (this->_splatColor)._offset[0] = 0.0; - (this->_splatColor)._offset[1] = 0.0; - (this->_splatColor)._offset[2] = 0.0; - this->LoadEntityConfig(); - baseFriction = this->_baseFriction; - (this->_shadowOffset).x = g_vectorZero.x; - fVar1 = g_vectorZero.y; - this->_friction = baseFriction; - game = g_game; - (this->_shadowOffset).y = fVar1; - this->_pauseTimer = 0; - this->_index = 0; - this->_collisionIndex = 0; - this->_spawnFrame = game->_frameCount; - this->_health = this->_maxHitPoints; - this->_spawnGridIndex = -1; - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - this->_speedMultiplier = 1.0; - this->_prevUpdateTime = -1e-05; - this->_updateTime = 0.0; - (this->_posOffset).x = g_vectorZero.x; - (this->_posOffset).y = g_vectorZero.y; - this->_renderZOffset = 0; - this->_renderDepthOffset = 0.0; - this->_sortingLayer = 2; - this->_visible = 1; - this->_exists = 1; - this->_dead = 0; - this->_isKillOnTouch = 0; - this->_isInitFlag176 = 0; - this->_removedByFactory = 0; - this->_entityCollisionClass = 4; - this->_collidesWithEntity = 0; - this->_collidesWithGrid = 0; - (this->_gridCollisionNormal).x = g_vectorZero.x; - (this->_gridCollisionNormal).y = g_vectorZero.y; - (this->_gridCollisionVelocity).x = g_vectorZero.x; - (this->_gridCollisionVelocity).y = g_vectorZero.y; - local_10 = 0; - uStack_c = 0; - local_8 = 0; - if (&this->_color != GHIDRA_CAST(defaultColor)) { - (this->_color)._tint[0] = 1.0; - (this->_color)._tint[1] = 1.0; - (this->_color)._tint[2] = 1.0; - (this->_color)._tint[3] = 1.0; - (this->_color)._offset[0] = 0.0; - (this->_color)._offset[1] = 0.0; - (this->_color)._colorize[0] = 0.0; - (this->_color)._colorize[1] = 0.0; - (this->_color)._colorize[2] = 0.0; - (this->_color)._colorize[3] = 0.0; - (this->_color)._offset[2] = 0.0; - } - damageEventsBegin = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - luaRef = &this->_minecart; - this->_fireDamageCountdown = 0; - this->_damageCountdown = 0; - this->_freezeCountdown = 0; - this->_poisonCountdown = 0; - this->_poisonTickDamage = 2.0; - this->_burnTickDamage = 2.0; - this->_slowingCountdown = 0; - this->_slowingAmount = 0.9; - this->_charmedCountdown = 0; - this->_confusionCountdown = 0; - this->_midasFreezeCountdown = 0; - this->_fearCountdown = 0; - this->_burnCountdown = 0; - this->_shrinkCountdown = 0; - this->_bleedingCountdown = 0; - this->_bleedDamageAccumulator = 0.0; - this->_poisonDamageTimer = 0; - this->_burnDamageTimer = 0; - this->_magnetizedCountdown = 0; - this->_baitedCountdown = 0; - this->_knockbackCountdown = 0; - this->_iceCountdown = 0; - this->_weaknessCountdown = 0; - this->_brimstoneMarkCountdown = 0; - this->_iceFrozenEffect = 0; - this->_bossStatusEffectCooldown = 0; - *GHIDRA_CAST(&this->_flags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) = damageEventsBegin; - this->_pendingDamage = 0.0; - *GHIDRA_CAST(&this->_pendingDamageFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)) = 0; - this->_isInvicible = 0; - this->_isInterpolating = 0; - this->_holdCountdown = 0; - this->_shrinkStatus1 = 1.0; - this->_shrinkStatus2 = 1.0; - this->_parent = 0; - this->_child = 0; - this->_target = 0; - if (*luaRef != 0) { - type = GHIDRA_INT(luaRef); - msvc::multiset::erase(&type); - *luaRef = 0; - } - if (this->_hitEffect != 0) { - type = GHIDRA_INT(&this->_hitEffect); - msvc::multiset::erase(&type); - this->_hitEffect = 0; - } - (this->_prevPosition).x = (this->_pos).x; - (this->_prevPosition).y = (this->_pos).y; - (this->_prevVelocity).x = (this->_velocity).x; - (this->_prevVelocity).y = (this->_velocity).y; - vtable = *GHIDRA_CAST(this); - this->_pitfallState = 0; - this->_pitfallTimer = 0; - (this->_pausePosition).x = g_vectorZero.x; - (this->_pausePosition).y = g_vectorZero.y; - (**(code **)(vtable + 0x60))(); - this->_scoreMultiplier = 1.0; - if (this->_type == 0x110) { - noScoreFlag = GHIDRA_UINT(g_game->_gameStateFlags) & 0x4000000; - } - else { - if (this->_type != 0x10f) goto LAB_006a986e; - noScoreFlag = GHIDRA_UINT(g_game->_gameStateFlags) & 0x2000000; - } - if (noScoreFlag != 0) { - this->_scoreMultiplier = 0.0; - } -LAB_006a986e: - luaRef = this->_luaBridgeRef; - if (luaRef != GHIDRA_CAST(0x0)) { - luaL_unref(*luaRef,0xfff0b9d8,luaRef[1]); - operator_delete(luaRef,8); - this->_luaBridgeRef = (void *)0x0; - } - return; -} - -// 006a98b0 -void Entity::LoadEntityConfig() -{ - void *pvVar1; - uint8_t isMatch; - EntityConfig *entityConfig; - EntityConfig_Entity *pEVar2; - uint8_t *gridCollisionText; - int entityType; - int variant; - uint8_t *gridCollisionString; - float stageClamped; - float maxHp; - uint32_t gridCollisionCapacity; - uint32_t gridCollisionLength; - float stageHp; - - entityConfig = &g_manager->_entityConfig; - variant = this->_variant; - entityType = this->_type; - pEVar2 = EntityConfig::GetEntity(entityConfig,entityType,variant,this->_subtype); - if (pEVar2 != GHIDRA_CAST(0x0)) { - EntityConfig::PreloadResources(entityConfig,pEVar2); - variant = this->_variant; - entityType = this->_type; - } - pEVar2 = EntityConfig::GetEntity(&g_manager->_entityConfig,entityType,variant,this->_subtype); - this->_config = pEVar2; - if (pEVar2 == GHIDRA_CAST(0x0)) { - pvVar1 = (this->_collisionPoints)._begin; - this->_size = 1.0; - (this->_sizeMulti).x = g_vectorOne.x; - (this->_sizeMulti).y = g_vectorOne.y; - this->_shadowSize = 0.015625; - this->_collisionDamage = 0.0; - this->_maxHitPoints = 0.0; - this->_mass = 0.0; - (this->_collisionPoints)._end = pvVar1; - this->_entityGridCollisionClass = 3; - this->_baseFriction = 1.0; - KAGE_LogMessage(1,GHIDRA_CAST("config for entity %d.%d is missing\n")); - return; - } - this->_shadowSize = pEVar2->shadowSize; - this->_collisionDamage = pEVar2->collisionDamage; - this->_mass = pEVar2->mass; - stageHp = pEVar2->stageHP; - maxHp = pEVar2->baseHP; - if (0.001 < stageHp) { - stageClamped = (float)g_game->_stage; - if (10.0 <= stageClamped) { - stageClamped = 10.0; - } - if (g_game->_stage < 5) { - maxHp = stageClamped * 1.0 * stageHp + maxHp; - } - else { - maxHp = stageClamped * 0.8 * stageHp + maxHp; - } - } - this->_maxHitPoints = maxHp; - this->_size = 0.0; - (this->_sizeMulti).x = g_vectorZero.x; - (this->_sizeMulti).y = g_vectorZero.y; - SetSize(this,pEVar2->collisionRadius,pEVar2->collisionRadiusMulti,pEVar2->gridCollisionPoints); - pvVar1 = this->_config; - this->_baseFriction = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x4c)); - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc4)) == 0) { - this->_entityGridCollisionClass = - (-GHIDRA_UINT((GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT((this->_collisionPoints)._begin) >> 3 != - 0)) & 2) + 3; - return; - } - gridCollisionCapacity = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 200)); - gridCollisionString = GHIDRA_CAST((GHIDRA_INT(pvVar1) + 0xb4)); - gridCollisionLength = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc4)); - gridCollisionText = gridCollisionString; - if (0xf < gridCollisionCapacity) { - gridCollisionText = *GHIDRA_CAST(gridCollisionString); - } - isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST(&DAT_00b671d0),4); - if (isMatch != 0) { - this->_entityGridCollisionClass = 0; - return; - } - gridCollisionText = gridCollisionString; - if (0xf < gridCollisionCapacity) { - gridCollisionText = *GHIDRA_CAST(gridCollisionString); - } - isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST("walls"),5); - if (isMatch != 0) { - this->_entityGridCollisionClass = 3; - return; - } - gridCollisionText = gridCollisionString; - if (0xf < gridCollisionCapacity) { - gridCollisionText = *GHIDRA_CAST(gridCollisionString); - } - isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST("ground"),6); - if (isMatch != 0) { - this->_entityGridCollisionClass = 5; - return; - } - if (0xf < gridCollisionCapacity) { - gridCollisionString = *GHIDRA_CAST(gridCollisionString); - } - isMatch = str_eq(gridCollisionString,gridCollisionLength,GHIDRA_CAST("nopits"),6); - if (isMatch == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Invalid grid collision class for entity config %d.%d.%d")); - return; - } - this->_entityGridCollisionClass = 6; - return; -} - -// 006a9ba0 -void * Entity::GetCollisionCapsule(void *outCapsule, Vector *offset) -{ - Vector capsuleCenter; - - capsuleCenter.x = offset->x + (this->_pos).x; - capsuleCenter.y = (this->_pos).y + offset->y; - Capsule::constructor - (outCapsule,&capsuleCenter,&this->_sizeMulti,(this->_sprite)._rotation,this->_size); - return outCapsule; -} - -// 006a9c10 -int Entity::FrameCount() -{ - return g_game->_frameCount - this->_spawnFrame; -} - -// 006a9c30 -bool Entity::HasFullHealth() -{ - return this->_maxHitPoints <= this->_health; -} - -// 006a9c50 -void Entity::AddHealth(float amount) -{ - float *clampedHealth; - - amount = amount + this->_health; - clampedHealth = &amount; - if (this->_maxHitPoints <= amount) { - clampedHealth = &this->_maxHitPoints; - } - this->_health = *clampedHealth; - return; -} - -// 006a9c90 -void Entity::CollideWithGrid(uint8_t isSimulated) -{ - void *pvVar1; - uint8_t bVar2; - char isDestroyed; - int iVar3; - GridEntity *gridEntity; - uint32_t uVar4; - int neighborRow; - GridEntity *pit; - uint32_t uVar5; - int iVar6; - uint32_t uVar7; - uint8_t *signY; - uint8_t *sign; - float fVar8; - float fVar9; - float fVar10; - float fVar11; - float fVar12; - float fVar13; - uint8_t isNoPush; - float local_70; - float local_6c; - int gridCollisionClass; - GridEntity *cellGridEntity; - uint32_t pointIndex; - uint32_t local_48; - float local_44; - float normalY; - Vector local_38; - uint32_t hitSourceType; - uint32_t hitSourceVariant; - int hitSpawnerType; - int hitSpawnerVariant; - float hitPosX; - float hitPosY; - float hitVelX; - float hitVelY; - uint32_t hitFlags; - Entity *hitSourceEntity; - Vector *clampPos; - void *collisionPointsEnd; - Room *curRoom; - bool isWallCollision; - Vector *pos; - Room *room; - - if (isSimulated == 0) { - this->_collidesWithGrid = 0; - } - if (this->_minecart != 0) { - return; - } - gridCollisionClass = this->_entityGridCollisionClass; - if (gridCollisionClass == 0) { - return; - } - room = g_game->_room; - if (((this->_type == 9) && (gridCollisionClass == 4)) && (room->_roomType == 0x10)) { - gridCollisionClass = 6; - } - pos = &this->_pos; - Room::GetClampedPositionImpl(room,&local_38,pos,0.0,0.0,0.0,0.0); - normalY = g_vectorZero.y; - local_44 = g_vectorZero.x; - if (gridCollisionClass == 1) { - if (isSimulated != 0) { - pos->x = local_38.x; - return; - } - pos = &this->_pos; - if ((this->_pos).x == local_38.x) { - this->_collidesWithGrid = 0; - pos->x = local_38.x; - return; - } - this->_collidesWithGrid = 1; - (this->_gridCollisionVelocity).x = (this->_velocity).x; - (this->_gridCollisionVelocity).y = (this->_velocity).y; - if (pos->x <= local_38.x) { - sign = GHIDRA_CAST(0x3f800000); - } - else { - sign = &DAT_bf800000; - } - (this->_gridCollisionNormal).x = (float)sign; - (this->_gridCollisionNormal).y = 0.0; - pos->x = local_38.x; - return; - } - if (gridCollisionClass == 2) { - if (isSimulated == 0) { - fVar10 = (this->_pos).y; - if (fVar10 != local_38.y) { - this->_collidesWithGrid = 1; - (this->_gridCollisionVelocity).x = (this->_velocity).x; - (this->_gridCollisionVelocity).y = (this->_velocity).y; - if (fVar10 <= local_38.y) { - sign = GHIDRA_CAST(0x3f800000); - } - else { - sign = &DAT_bf800000; - } - (this->_gridCollisionNormal).x = 0.0; - (this->_gridCollisionNormal).y = (float)sign; - (this->_pos).y = local_38.y; - return; - } - this->_collidesWithGrid = 0; - } - (this->_pos).y = local_38.y; - return; - } - if (((gridCollisionClass == 3) || (gridCollisionClass == 5)) || - ((gridCollisionClass == 6 || (gridCollisionClass == 7)))) { - clampPos = &this->_pos; - if (isSimulated == 0) { - if ((clampPos->x == local_38.x) && ((this->_pos).y == local_38.y)) { - this->_collidesWithGrid = 0; - clampPos->x = local_38.x; - (this->_pos).y = local_38.y; - goto LAB_006a9f87; - } - this->_collidesWithGrid = 1; - (this->_gridCollisionVelocity).x = (this->_velocity).x; - (this->_gridCollisionVelocity).y = (this->_velocity).y; - if (clampPos->x != local_38.x) { - if (clampPos->x <= local_38.x) { - sign = &DAT_bf800000; - } - else { - sign = GHIDRA_CAST(0x3f800000); - } - local_44 = (float)sign + local_44; - } - fVar10 = (this->_pos).y; - if (fVar10 != local_38.y) { - if (fVar10 <= local_38.y) { - sign = &DAT_bf800000; - } - else { - sign = GHIDRA_CAST(0x3f800000); - } - normalY = (float)sign + normalY; - } - } - clampPos->x = local_38.x; - (this->_pos).y = local_38.y; - } -LAB_006a9f87: - if (gridCollisionClass == 4) { - if (isSimulated != 0) { - return; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1bb0)) == 0x37) || - (isNoPush = isSimulated, (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) >> 0xf & 1) != 0 - )) { - isNoPush = 1; - } - iVar3 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(this->_pos); - if ((iVar3 == 4) || (iVar3 == 5)) { - isWallCollision = true; - Room::GetClampedPositionImpl(g_game->_room,&local_38,&this->_pos,0.0,0.0,0.0,0.0); - bVar2 = (GHIDRA_CAST((&local_38)))->Vector::operator_ne(&this->_pos); - if (bVar2 != 0) { - if (isNoPush != 0) { - return; - } - if (0.0 <= (local_38.y - (this->_pos).y) * (this->_velocity).y + - (local_38.x - (this->_pos).x) * (this->_velocity).x) { - return; - } - } - } - else { - isWallCollision = false; - } - if ((iVar3 != 3) && (!isWallCollision)) { - if (this->_type != 2) { - return; - } - if (iVar3 != 2) { - return; - } - } - gridEntity = (GHIDRA_CAST((room)))->Room::GetGridEntityFromPos(&this->_pos); - if (gridEntity == GHIDRA_CAST(0x0)) { - return; - } - gridEntity = (GHIDRA_CAST((room)))->Room::GetGridEntityFromPos(&this->_pos); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) == 7) { - return; - } - this->_collidesWithGrid = 1; - (this->_gridCollisionVelocity).x = (this->_velocity).x; - (this->_gridCollisionVelocity).y = (this->_velocity).y; - return; - } - pvVar1 = (this->_collisionPoints)._begin; - collisionPointsEnd = (this->_collisionPoints)._end; - if (pvVar1 == collisionPointsEnd) { - return; - } - uVar5 = GHIDRA_INT(collisionPointsEnd) - GHIDRA_INT(pvVar1) >> 3; - local_6c = g_vectorZero.x; - local_38.x = g_vectorZero.x; - local_70 = g_vectorZero.y; - local_38.y = g_vectorZero.y; - if (gridCollisionClass == 5) { - if (uVar5 != 0) { - uVar7 = 0; - do { - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 8)); - fVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 8 + 4)); - iVar3 = GHIDRA_INT(((((this->_pos).y + fVar11) - 120.0) / 40.0 + 0.5)); - iVar6 = GHIDRA_INT((((fVar10 + (this->_pos).x) - 40.0) / 40.0 + 0.5)); - if ((((iVar6 < 0) || (room->_gridWidth <= iVar6)) || (iVar3 < 0)) || - (room->_gridHeight <= iVar3)) { - iVar6 = -1; - } - else { - iVar6 = iVar3 * room->_gridWidth + iVar6; - } - uVar4 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); - if (uVar4 != 0) { - local_6c = fVar10 + local_6c; - local_70 = local_70 + fVar11; - local_38.x = local_6c; - local_38.y = local_70; - } - uVar7 = uVar7 + 1; - } while (uVar7 < uVar5); - } - } - else if (gridCollisionClass == 7) { - if (uVar5 != 0) { - uVar7 = 0; - do { - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 8)); - fVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 8 + 4)); - iVar3 = GHIDRA_INT(((((this->_pos).y + fVar11) - 120.0) / 40.0 + 0.5)); - iVar6 = GHIDRA_INT((((fVar10 + (this->_pos).x) - 40.0) / 40.0 + 0.5)); - if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) || - ((iVar3 < 0 || (room->_gridHeight <= iVar3)))) { - iVar6 = -1; - } - else { - iVar6 = iVar3 * room->_gridWidth + iVar6; - } - uVar4 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); - if (uVar4 != 1) { - local_6c = fVar10 + local_6c; - local_70 = local_70 + fVar11; - local_38.x = local_6c; - local_38.y = local_70; - } - uVar7 = uVar7 + 1; - } while (uVar7 < uVar5); - } - } - else if (gridCollisionClass == 6) { - pointIndex = 0; - if (uVar5 != 0) { - do { - pvVar1 = (this->_collisionPoints)._begin; - iVar6 = GHIDRA_INT(((((this->_pos).x + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + pointIndex * 8))) - 40.0) / 40.0 + - 0.5)); - iVar3 = GHIDRA_INT((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + pointIndex * 8 + 4)) + (this->_pos).y) - 120.0) / - 40.0 + 0.5)); - if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) || - ((iVar3 < 0 || (room->_gridHeight <= iVar3)))) { - local_48 = (GHIDRA_CAST((room)))->Room::GetGridCollision(-1); - if (-1 < iVar6) goto LAB_006aa40c; -LAB_006aa43d: - cellGridEntity = GHIDRA_CAST(0x0); - } - else { - local_48 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar3 * room->_gridWidth + iVar6); -LAB_006aa40c: - if ((((room->_gridWidth <= iVar6) || (iVar3 < 0)) || (room->_gridHeight <= iVar3)) || - (uVar7 = iVar3 * room->_gridWidth + iVar6, 0x1bf < uVar7)) goto LAB_006aa43d; - cellGridEntity = room->_gridEntities[uVar7]; - } - if (((local_48 != 0) && (local_48 != 1)) && - ((cellGridEntity == GHIDRA_CAST(0x0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((cellGridEntity)) + 0x4)))) != 7)))) { - pvVar1 = (this->_collisionPoints)._begin; - local_6c = local_6c + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + pointIndex * 8)); - local_70 = local_70 + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + pointIndex * 8 + 4)); - local_38.x = local_6c; - local_38.y = local_70; - } - if (((isSimulated == 0) && (this->_type == 3)) && - (((((this->_variant == 0x4b && - (((local_48 == 3 || (local_48 == 2)) && (pvVar1 = g_game->_room, -1 < iVar6)))) && - (((iVar6 < *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)) && (-1 < iVar3)) && - (iVar3 < *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x10)))))) && - ((iVar6 = iVar3 * *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)) + iVar6, -1 < iVar6 && (iVar6 < 0x1c0)))) - && (gridEntity = room->_gridEntities[iVar6], gridEntity != GHIDRA_CAST(0x0))))) { - fVar10 = (this->_velocity).y; - fVar11 = (this->_velocity).x; - if ((25.0 < fVar11 * fVar11 + fVar10 * fVar10) && (gridEntity->_collisionClass == 3)) { - hitPosX = (this->_pos).x; - hitPosY = (this->_pos).y; - hitSpawnerType = this->_spawnerType; - hitSpawnerVariant = this->_spawnerVariant; - hitVelX = (this->_velocity).x; - hitVelY = (this->_velocity).y; - hitSourceType = 3; - hitSourceVariant = 0x4b; - local_48 = GHIDRA_UINT(((this->_flags & 0x100) != 0)); - if ((this->_flags & 0x20000000) == 0) { - uVar7 = 0; - } - else { - uVar7 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar4 = 0; - } - else { - uVar4 = 4; - } - hitFlags = uVar4 | uVar7 | local_48; - hitSourceEntity = this; - isDestroyed = gridEntity->Destroy(0,&hitSourceType); - if (isDestroyed != '\0') { - curRoom = g_game->_room; - iVar3 = curRoom->_gridWidth; - fVar9 = (float)(gridEntity->_gridIndex % iVar3) * 40.0 + 40.0; - fVar12 = (float)(gridEntity->_gridIndex / iVar3) * 40.0 + 120.0; - fVar10 = fVar9 - (this->_pos).x; - fVar11 = fVar12 - (this->_pos).y; - if (ABS(fVar10) <= ABS(fVar11)) { - sign = GHIDRA_CAST(0x0); - if (0.0 <= fVar11) { - signY = GHIDRA_CAST(0x3f800000); - } - else { - signY = &DAT_bf800000; - } - } - else { - signY = GHIDRA_CAST(0x0); - if (0.0 <= fVar10) { - sign = GHIDRA_CAST(0x3f800000); - } - else { - sign = &DAT_bf800000; - } - } - iVar6 = GHIDRA_INT(((((float)sign * 40.0 + fVar9) - 40.0) / 40.0 + 0.5)); - if ((((-1 < iVar6) && (iVar6 < iVar3)) && - (neighborRow = GHIDRA_INT(((((float)signY * 40.0 + fVar12) - 120.0) / 40.0 + 0.5)), - -1 < neighborRow)) && - ((neighborRow < curRoom->_gridHeight && - (iVar6 = neighborRow * iVar3 + iVar6, -1 < iVar6)))) { - if (iVar6 < 0x1c0) { - pit = room->_gridEntities[iVar6]; - } - else { - pit = GHIDRA_CAST(0x0); - } - (GHIDRA_CAST((curRoom)))->Room::TryMakeBridge(pit,gridEntity); - } - goto LAB_006aa782; - } - } - local_6c = g_vectorZero.x; - local_38.x = g_vectorZero.x; - local_70 = g_vectorZero.y; - local_38.y = g_vectorZero.y; - } -LAB_006aa782: - pointIndex = pointIndex + 1; - } while (pointIndex < uVar5); - } - } - else if (uVar5 != 0) { - uVar7 = 0; - do { - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 8)); - fVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 8 + 4)); - iVar6 = GHIDRA_INT(((((this->_pos).x + fVar10) - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT(((((this->_pos).y + fVar11) - 120.0) / 40.0 + 0.5)); - if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) || - ((iVar3 < 0 || (room->_gridHeight <= iVar3)))) { - iVar6 = -1; - } - else { - iVar6 = iVar3 * room->_gridWidth + iVar6; - } - uVar4 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); - if (((uVar4 == 4) || (uVar4 == 5)) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 0x10)) { - local_6c = fVar10 + local_6c; - local_70 = local_70 + fVar11; - local_38.x = local_6c; - local_38.y = local_70; - } - uVar7 = uVar7 + 1; - } while (uVar7 < uVar5); - } - if ((local_6c == g_vectorZero.x) && (local_70 == g_vectorZero.y)) { - if (isSimulated == 0) { - (this->_gridCollisionNormal).x = local_44; - (this->_gridCollisionNormal).y = normalY; - return; - } - return; - } - if ((this->_type != 2) || (0.001 <= local_70 * local_70 + local_6c * local_6c)) { - bVar2 = IsEnemy(this); - if ((bVar2 != 0) && - ((gridCollisionClass == 5 && (local_70 * local_70 + local_6c * local_6c < 0.001)))) { - pos = &this->_pos; - (GHIDRA_CAST((g_game->_room)))->Room::FindFreeTilePosition(&local_38,pos,40.0); - fVar10 = 20.0 - this->_size * (this->_sizeMulti).x; - if (local_38.x - pos->x <= 0.0) { - local_38.x = local_38.x + fVar10; - } - else { - local_38.x = local_38.x - fVar10; - } - fVar10 = 20.0 - this->_size * (this->_sizeMulti).y; - if (0.0 < local_38.y - (this->_pos).y) { - pos->x = local_38.x; - (this->_pos).y = local_38.y - fVar10; - return; - } - pos->x = local_38.x; - (this->_pos).y = local_38.y + fVar10; - return; - } - } - else { - iVar3 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&this->_pos); - fVar10 = this->_size; - fVar11 = (this->_sizeMulti).x; - fVar9 = fVar10 * fVar11; - fVar13 = (this->_pos).x - ((float)(iVar3 % room->_gridWidth) * 40.0 + 40.0); - fVar12 = (this->_pos).y - ((float)(iVar3 / room->_gridWidth) * 40.0 + 120.0); - if ((ABS(fVar13) + fVar9 < 20.0) || (ABS(fVar12) + fVar10 * (this->_sizeMulti).y < 20.0)) { - local_38.y = (this->_sizeMulti).y; - if (ABS(fVar11 * fVar13) <= ABS(local_38.y * fVar12)) { - local_38.x = 0.0; - local_38.y = local_38.y * fVar10; - if (0.0 < fVar12) { - local_38.y = local_38.y * -1.0; - } - } - else { - local_38.y = 0.0; - local_38.x = fVar9; - if (0.0 < fVar13) { - local_38.x = fVar9 * -1.0; - } - } - } - } - (GHIDRA_CAST((&local_38)))->Vector::Normalize(); - if (isSimulated == 0) { - (this->_gridCollisionNormal).x = local_38.x; - (this->_gridCollisionNormal).y = local_38.y; - } - fVar10 = (this->_velocity).y; - fVar11 = (this->_velocity).x; - fVar9 = -local_38.x * fVar11 - fVar10 * local_38.y; - if (0.0 <= fVar9) { - return; - } - if (isSimulated != 0) goto LAB_006aad6f; - (this->_gridCollisionVelocity).x = fVar11; - this->_collidesWithGrid = 1; - (this->_gridCollisionVelocity).y = fVar10; - iVar3 = this->_type; - fVar10 = fVar9 * 1.8 - 0.1; - if (iVar3 == 99) { - fVar11 = -fVar9 * 0.05; - if (1.2 <= fVar11) { - fVar11 = 1.2; - } - play_sound_with_fart_seed(0x1c,fVar11,2,0,1.0); - fVar10 = fVar10 * 1.4; - goto LAB_006aad37; - } - if ((iVar3 == 0xd9) || (iVar3 == 0xdc)) { -LAB_006aad2f: - fVar10 = fVar10 * 1.2; - } - else if (iVar3 == 0x393) { - if (this->_variant == 1) goto LAB_006aac90; - } - else if (iVar3 == 0x37d) { -LAB_006aac90: - uVar5 = Random(); - fVar11 = (this->_velocity).y; - fVar12 = (this->_velocity).x; - fVar13 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9; - bVar2 = 0; - iVar6 = 2; - fVar11 = sqrtf(fVar12 * fVar12 + fVar11 * fVar11); - iVar3 = 0x1e7; - if (this->_type == 0x37d) { - iVar3 = 0x245; - } - fVar11 = fVar11 * 0.05 + 0.2; - if (1.2 <= fVar11) { - fVar11 = 1.2; - } - play_sound_with_fart_seed(iVar3,fVar11,iVar6,bVar2,fVar13); - goto LAB_006aad2f; - } -LAB_006aad37: - (this->_velocity).x = fVar10 * (this->_gridCollisionNormal).x + (this->_velocity).x; - fVar10 = fVar10 * (this->_gridCollisionNormal).y + (this->_velocity).y; - (this->_velocity).y = fVar10; -LAB_006aad6f: - fVar11 = (this->_velocity).x; - fVar10 = sqrtf(fVar11 * fVar11 + fVar10 * fVar10); - if (0.0 < fVar10) { - fVar11 = local_38.y * (this->_sizeMulti).y; - fVar12 = local_38.x * (this->_sizeMulti).x; - fVar12 = sqrtf(fVar11 * fVar11 + fVar12 * fVar12); - fVar12 = fVar12 * this->_size; - fVar11 = (this->_pos).x; - local_70 = fVar10; - if (fVar10 <= 2.0) { - local_70 = 2.0; - } - local_70 = fVar12 - local_70; - local_6c = fVar12; - if (gridCollisionClass == 5) { - local_44 = 1.68156e-44; - do { - fVar13 = (local_6c - local_70) * 0.5 + local_70; - iVar6 = GHIDRA_INT((((fVar13 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT((((fVar13 * local_38.y + (this->_pos).y) - 120.0) / 40.0 + 0.5)); - if ((((iVar6 < 0) || (room->_gridWidth <= iVar6)) || (iVar3 < 0)) || - (room->_gridHeight <= iVar3)) { - iVar6 = -1; - } - else { - iVar6 = iVar3 * room->_gridWidth + iVar6; - } - uVar5 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); - if (uVar5 == 0) { - local_70 = fVar13; - } - else { - local_6c = fVar13; - } - local_44 = (float)(GHIDRA_INT(local_44) + -1); - } while (local_44 != 0.0); - } - else if (gridCollisionClass == 7) { - local_44 = 8.40779e-45; - do { - fVar13 = (local_6c - local_70) * 0.5 + local_70; - iVar6 = GHIDRA_INT((((fVar13 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT((((fVar13 * local_38.y + (this->_pos).y) - 120.0) / 40.0 + 0.5)); - if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) || - ((iVar3 < 0 || (room->_gridHeight <= iVar3)))) { - iVar6 = -1; - } - else { - iVar6 = iVar3 * room->_gridWidth + iVar6; - } - uVar5 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); - if (uVar5 == 1) { - local_70 = fVar13; - } - else { - local_6c = fVar13; - } - local_44 = (float)(GHIDRA_INT(local_44) + -1); - } while (local_44 != 0.0); - } - else { - fVar13 = (this->_pos).y; - if (gridCollisionClass == 6) { - local_44 = (float)gridCollisionClass; - do { - fVar8 = (local_6c - local_70) * 0.5 + local_70; - iVar6 = GHIDRA_INT((((fVar8 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT((((fVar8 * local_38.y + fVar13) - 120.0) / 40.0 + 0.5)); - if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) || - ((iVar3 < 0 || (room->_gridHeight <= iVar3)))) { - iVar6 = -1; - } - else { - iVar6 = iVar3 * room->_gridWidth + iVar6; - } - uVar5 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); - if ((uVar5 == 0) || (uVar5 == 1)) { - local_70 = fVar8; - } - else { - local_6c = fVar8; - } - local_44 = (float)(GHIDRA_INT(local_44) + -1); - } while (local_44 != 0.0); - } - else { - local_44 = 8.40779e-45; - do { - fVar8 = (local_6c - local_70) * 0.5 + local_70; - iVar6 = GHIDRA_INT((((fVar8 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT((((fVar8 * local_38.y + fVar13) - 120.0) / 40.0 + 0.5)); - if ((((iVar6 < 0) || (room->_gridWidth <= iVar6)) || (iVar3 < 0)) || - (room->_gridHeight <= iVar3)) { - iVar6 = -1; - } - else { - iVar6 = iVar3 * room->_gridWidth + iVar6; - } - uVar5 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); - if ((uVar5 == 4) || (uVar5 == 5)) { - local_6c = fVar8; - } - else { - local_70 = fVar8; - } - local_44 = (float)(GHIDRA_INT(local_44) + -1); - } while (local_44 != 0.0); - } - } - pos->x = local_38.x * (local_70 - fVar12) + pos->x; - (this->_pos).y = local_38.y * (local_70 - fVar12) + (this->_pos).y; - } - if (isSimulated == 0) { - fVar10 = 1.0 - (-fVar9 / fVar10) * 0.5; - (this->_velocity).y = fVar10 * (this->_velocity).y; - (this->_velocity).x = fVar10 * (this->_velocity).x; - } - return; -} - -// 006ab240 -uint8_t Entity::is_grid_collision_at(Vector *position) -{ - uint32_t gridCollision; - int gridY; - uint32_t pointCount; - int iVar1; - void *pvVar2; - uint32_t i; - float offsetY; - float hitSumX; - float hitSumY; - int gridCollisionClass; - float offsetX; - float offsetY; - float pointX; - float pointY; - void *pointsBegin; - float posX; - float posY; - Room *room; - - gridCollisionClass = this->_entityGridCollisionClass; - if (gridCollisionClass != 0) { - pointsBegin = (this->_collisionPoints)._begin; - pvVar2 = (this->_collisionPoints)._end; - if (pointsBegin != pvVar2) { - i = 0; - pointCount = GHIDRA_INT(pvVar2) - GHIDRA_INT(pointsBegin) >> 3; - room = g_game->_room; - hitSumX = g_vectorZero.x; - hitSumY = g_vectorZero.y; - offsetY = g_vectorZero.x; - if (pointCount != 0) { - posY = (this->_pos).y; - offsetX = position->x; - offsetY = position->y; - posX = (this->_pos).x; - do { - pointX = *GHIDRA_CAST((GHIDRA_CAST(pointsBegin) + i * 8)); - pointY = *GHIDRA_CAST((GHIDRA_CAST(pointsBegin) + i * 8 + 4)); - iVar1 = GHIDRA_INT((((pointX + offsetX + posX) - 40.0) / 40.0 + 0.5)); - if ((((-1 < iVar1) && (iVar1 < room->_gridWidth)) && - (gridY = GHIDRA_INT((((pointY + posY + offsetY) - 120.0) / 40.0 + 0.5)), -1 < gridY)) && - ((gridY < room->_gridHeight && (iVar1 = room->_gridWidth * gridY + iVar1, -1 < iVar1))) - ) { - if (iVar1 < 0x1c0) { - pvVar2 = room->_gridEntities[iVar1]; - } - else { - pvVar2 = (void *)0x0; - } - gridCollision = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar1); - offsetY = hitSumX; - if (gridCollisionClass == 3) { - if ((gridCollision == 4) || - (((gridCollision == 3 && (pvVar2 != (void *)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 4)) == 0x10)))) { -LAB_006ab3eb: - hitSumX = pointX + hitSumX; - hitSumY = pointY + hitSumY; - offsetY = hitSumX; - } - } - else if (((gridCollisionClass == 5) && (gridCollision != 0)) && (gridCollision != 5)) - goto LAB_006ab3eb; - } - i = i + 1; - } while (i < pointCount); - } - if ((offsetY != g_vectorZero.x) || (hitSumY != g_vectorZero.y)) { - return 1; - } - } - } - return 0; -} - -// 006ab440 -void Entity::PlayerCollideWithGrid(uint8_t isSimulated) -{ - Room *gridEntity; - uint8_t bVar1; - char isCollided; - Entity_Player *player; - uint32_t uVar2; - GridEntity *newRock; - uint32_t uVar3; - uint32_t uVar4; - int iVar5; - int iVar6; - int *piVar7; - int iVar8; - GridEntity_Door *gridEntity; - float bridgeDirX; - float fVar9; - float bridgeDirY; - float fVar10; - float fVar11; - float gridCenterY; - int doorCollideInfo; - int local_fc; - int local_f8; - int local_f4; - float local_f0; - float local_ec; - float local_e8; - float local_e4; - uint32_t local_e0; - Entity *local_dc; - int gridCollideInfo; - int local_d4; - int local_d0; - int local_cc; - float local_c8; - float local_c4; - float local_c0; - float local_bc; - uint32_t local_b8; - Entity *local_b4; - int webCollideInfo; - int local_ac; - int local_a8; - int local_a4; - float local_a0; - float local_9c; - float local_98; - float local_94; - uint32_t local_90; - Entity *local_8c; - int megaMushCollideInfo; - int local_84; - int local_80; - int local_7c; - float local_78; - float local_74; - float local_70; - float local_6c; - uint32_t local_68; - Entity *local_64; - Vector *posRef; - Vector local_5c; - Vector local_54; - Vector pointPos; - int pointIndex; - float freeDepth; - float blockedDepth; - uint32_t isCharmed; - float normalY; - float normalX; - void *prevExceptionList; - uint8_t *puStack_18; - uint32_t ehState; - void *collisionPoints; - Game *game; - uint32_t *oldGridEntity; - Vector *pos; - Room *temp_5fd03f2348; - - ehState = 0xffffffff; - puStack_18 = &LAB_00afa457; - prevExceptionList = ExceptionList; - ExceptionList = &prevExceptionList; - player = (Entity_Player *) - __RTDynamicCast(this,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0, - __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U); - if (player == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Called PlayerCollideWithGrid with Entity type != Entity_Player\n")) - ; - } - if (isSimulated == 0) { - this->_collidesWithGrid = 0; - } - game = g_game; - if (this->_entityGridCollisionClass == 0) { - ExceptionList = prevExceptionList; - return; - } - if ((this->_collisionPoints)._begin == (this->_collisionPoints)._end) { - ExceptionList = prevExceptionList; - return; - } - if (this->_minecart != 0) { - ExceptionList = prevExceptionList; - return; - } - posRef = &this->_pos; - gridEntity = g_game->_room; - Room::GetClampedPositionImpl(gridEntity,&local_54,posRef,0.0,0.0,0.0,0.0); - piVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game->_room)) + 0x4)))) + 0x10)); - if (((piVar7 == GHIDRA_CAST(0x0)) || (piVar7[2] != 0x10)) || (*piVar7 != 0x23)) { - pos = &this->_pos; - iVar6 = (GHIDRA_CAST((game->_room)))->Room::GetGridIndex(pos); - if ((iVar6 < 0) || - (uVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::get_grid_collision_at(pos), uVar2 == 4)) { - if (isSimulated == 0) { - if ((pos->x == local_54.x) && ((this->_pos).y == local_54.y)) { - bVar1 = 0; - } - else { - bVar1 = 1; - } - this->_collidesWithGrid = bVar1; - } - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 0x10) { - pos->x = local_54.x; - (this->_pos).y = local_54.y; - } - } - } - else { - fVar9 = this->_size; - pos = &this->_pos; - local_54.x = pos->x - 0.0; - local_54.y = (this->_pos).y - 20.0; - Room::GetClampedPositionImpl(gridEntity,&local_5c,&local_54,fVar9,fVar9,fVar9,fVar9); - local_5c.x = local_5c.x + 0.0; - local_5c.y = local_5c.y + 20.0; - if (isSimulated == 0) { - if ((pos->x == local_5c.x) && ((this->_pos).y == local_5c.y)) { - this->_collidesWithGrid = 0; - pos->x = local_5c.x; - (this->_pos).y = local_5c.y; - goto LAB_006ab679; - } - this->_collidesWithGrid = 1; - } - pos->x = local_5c.x; - (this->_pos).y = local_5c.y; - } -LAB_006ab679: - local_5c.y = (float)(GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT((this->_collisionPoints)._begin) >> - 3); - normalX = g_vectorZero.x; - normalY = g_vectorZero.y; - pointIndex = 0; - fVar9 = g_vectorZero.x; - fVar11 = g_vectorZero.y; - if (local_5c.y != 0.0) { - do { - collisionPoints = (this->_collisionPoints)._begin; - pointPos.x = (this->_pos).x + *GHIDRA_CAST((GHIDRA_CAST(collisionPoints) + pointIndex * 8)); - pointPos.y = *GHIDRA_CAST((GHIDRA_CAST(collisionPoints) + pointIndex * 8 + 4)) + (this->_pos).y; - iVar6 = GHIDRA_INT(((pointPos.x - 40.0) / 40.0 + 0.5)); - iVar5 = GHIDRA_INT(((pointPos.y - 120.0) / 40.0 + 0.5)); - if (-1 < iVar6) { - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - if (iVar6 < iVar8) { - if (-1 < iVar5) { - if (iVar5 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x10))) { - iVar6 = iVar8 * iVar5 + iVar6; - if (-1 < iVar6) { - if (iVar6 < 0x1c0) { - gridEntity = gridEntity->_gridEntities[iVar6]; - } - else { - gridEntity = GHIDRA_CAST(0x0); - } - uVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::get_grid_collision_at(&pointPos); - if (isSimulated != 0) goto LAB_006abf5a; - bVar1 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - if ((bVar1 != 0) && (gridEntity != GHIDRA_CAST(0x0))) { - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))); - if (((iVar5 == 3) || ((iVar5 == 0x18 || (iVar5 == 0xb)))) && (uVar2 != 0)) { - uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x14)))); - if (iVar6 < 0x1c0) { - oldGridEntity = gridEntity->_gridEntities[iVar6]; - if ((oldGridEntity != GHIDRA_CAST(0x0)) && (oldGridEntity[1] != 1)) { - gridEntity->_gridPaths[iVar6] = 900; - gridEntity->_gridEntities[iVar6] = (void *)0x0; - (**(code **)*oldGridEntity)(1); - } - if (gridEntity->_gridPaths[iVar6] < 0x385) { - newRock = operator_new(0x198); - ehState = 1; - local_54.y = (float)newRock; - if (newRock == GHIDRA_CAST(0x0)) { - newRock = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((newRock)))->GridEntity::GridEntity(); - *GHIDRA_CAST(newRock) = IsaacRepentancePlus::GridEntity_Rock::vftable; - *GHIDRA_CAST((newRock + 1)) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(newRock[1])) + 0x10)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(newRock[1])) + 0x14)))) = 0xf; - *GHIDRA_CAST((newRock + 1)) = 0; - newRock[1]._varData = 0; - newRock[1]._spawnFrame = 0; - newRock[1]._rng._seed = 0xf; - *GHIDRA_CAST(&newRock[1]._varData) = 0; - newRock[1]._rng._shift1 = 0; - newRock[1]._rng._shift2 = 0; - newRock[1]._rng._shift3 = 0; - } - ehState = 0xffffffff; - if (newRock != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((newRock)) + 0x4)))) = 2; - newRock->_gridIndex = iVar6; - if (gridEntity->_gridEntities[iVar6] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(gridEntity->_gridEntities[iVar6]))(1); - } - gridEntity->_gridEntities[iVar6] = newRock; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((newRock)) + 0x8)))) = 0; - newRock->_varData = 0; - (GHIDRA_CAST((newRock)))->GridEntity::Init(uVar2); - } - } - piVar7 = gridEntity->_gridEntities[iVar6]; - } - else { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - piVar7 = GHIDRA_CAST(0x0); - } - if (piVar7 != GHIDRA_CAST(0x0)) { - local_78 = (this->_pos).x; - local_74 = (this->_pos).y; - megaMushCollideInfo = this->_type; - local_84 = this->_variant; - local_80 = this->_spawnerType; - local_7c = this->_spawnerVariant; - local_70 = (this->_velocity).x; - local_6c = (this->_velocity).y; - isCharmed = GHIDRA_UINT(((this->_flags & 0x100) != 0)); - if ((this->_flags & 0x20000000) == 0) { - uVar2 = 0; - } - else { - uVar2 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar3 = 0; - } - else { - uVar3 = 4; - } - local_68 = uVar3 | uVar2 | isCharmed; - local_64 = this; - (**(code **)(*piVar7 + 0x14))(0,&megaMushCollideInfo); - } - } - else { - if ((iVar5 != 0x10) || (uVar2 != 4)) { - if (iVar5 == 10) { - local_a0 = (this->_pos).x; - local_9c = (this->_pos).y; - webCollideInfo = this->_type; - local_ac = this->_variant; - local_a8 = this->_spawnerType; - local_a4 = this->_spawnerVariant; - local_98 = (this->_velocity).x; - local_94 = (this->_velocity).y; - if ((this->_flags & 0x20000000) == 0) { - uVar3 = 0; - } - else { - uVar3 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar4 = 0; - } - else { - uVar4 = 4; - } - local_90 = uVar4 | uVar3 | GHIDRA_UINT(((this->_flags & 0x100) != 0)); - local_8c = this; - gridEntity->Destroy(0,&webCollideInfo); - } - goto LAB_006abb5a; - } - (GHIDRA_CAST((gridEntity)))->GridEntity_Door::TryBlowOpen(1,this); - } - goto LAB_006ab9e8; - } -LAB_006abb5a: - if ((uVar2 != 3) && (uVar2 != 2)) { - if (gridEntity == GHIDRA_CAST(0x0)) goto LAB_006abf5a; - goto LAB_006abbad; - } - bVar1 = (GHIDRA_CAST((player)))->Entity_Player::CanCrushRocks(); - if (bVar1 == 0) { - if (gridEntity == GHIDRA_CAST(0x0)) goto LAB_006abf5a; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) != 0xe) || - (bVar1 = TemporaryEffects::HasCollectibleEffect - (&player->_temporaryeffects,0x251), bVar1 == 0)) - goto LAB_006abbad; -LAB_006abcae: - if ((gridEntity->_collisionClass != 3) && (gridEntity->_collisionClass != 2)) { -LAB_006abbad: - if (((uVar2 == 4) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) == 0x10)) && - (player->_itemState == 0x93)) { - iVar5 = __RTDynamicCast(gridEntity,0, - &IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor - ,&IsaacRepentancePlus::GridEntity_Door:: - RTTI_Type_Descriptor,0); - if (((*GHIDRA_CAST((iVar5 + 0x15c)) == 7) || (*GHIDRA_CAST((iVar5 + 0x160)) == 7)) || - ((*GHIDRA_CAST((iVar5 + 0x15c)) == 8 || (*GHIDRA_CAST((iVar5 + 0x160)) == 8)))) { - local_f0 = (this->_pos).x; - local_ec = (this->_pos).y; - doorCollideInfo = this->_type; - local_fc = this->_variant; - local_f8 = this->_spawnerType; - local_f4 = this->_spawnerVariant; - local_e8 = (this->_velocity).x; - local_e4 = (this->_velocity).y; - if ((this->_flags & 0x20000000) == 0) { - uVar2 = 0; - } - else { - uVar2 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar3 = 0; - } - else { - uVar3 = 4; - } - local_e0 = uVar3 | uVar2 | GHIDRA_UINT(((this->_flags & 0x100) != 0)); - local_dc = this; - if ((iVar6 < 0x1c0) && - (piVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + iVar6 * 4 + 0x24)), - piVar7 != GHIDRA_CAST(0x0))) { - (**(code **)(*piVar7 + 0x14))(0,&doorCollideInfo); - } - goto LAB_006ab9e8; - } - } - goto LAB_006abf5a; - } - local_c8 = (this->_pos).x; - local_c4 = (this->_pos).y; - gridCollideInfo = this->_type; - local_d4 = this->_variant; - local_d0 = this->_spawnerType; - local_cc = this->_spawnerVariant; - local_c0 = (this->_velocity).x; - local_bc = (this->_velocity).y; - isCharmed = GHIDRA_UINT(((this->_flags & 0x100) != 0)); - if ((this->_flags & 0x20000000) == 0) { - uVar3 = 0; - } - else { - uVar3 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar4 = 0; - } - else { - uVar4 = 4; - } - local_b8 = uVar4 | uVar3 | isCharmed; - local_b4 = this; - isCollided = gridEntity->Destroy(0,&gridCollideInfo); - if (isCollided == '\0') goto LAB_006abbad; - temp_5fd03f2348 = g_game->_room; - iVar6 = temp_5fd03f2348->_gridWidth; - fVar10 = (float)(gridEntity->_gridIndex % iVar6) * 40.0 + 40.0; - gridCenterY = (float)(gridEntity->_gridIndex / iVar6) * 40.0 + 120.0; - fVar9 = fVar10 - (this->_pos).x; - fVar11 = gridCenterY - (this->_pos).y; - if (ABS(fVar9) <= ABS(fVar11)) { - bridgeDirX = 0.0; - if (0.0 <= fVar11) { - bridgeDirY = 1.0; - } - else { - bridgeDirY = (float)&DAT_bf800000; - } - } - else { - bridgeDirY = 0.0; - if (0.0 <= fVar9) { - bridgeDirX = 1.0; - } - else { - bridgeDirX = (float)&DAT_bf800000; - } - } - fVar9 = ((bridgeDirX * 40.0 + fVar10) - 40.0) / 40.0 + 0.5; - iVar8 = GHIDRA_INT(fVar9); - iVar5 = GHIDRA_INT((((bridgeDirY * 40.0 + gridCenterY) - 120.0) / 40.0 + 0.5)); - if ((((-1 < iVar8) && (iVar8 < iVar6)) && (-1 < iVar5)) && - ((iVar5 < temp_5fd03f2348->_gridHeight && - (iVar6 = iVar6 * iVar5 + GHIDRA_INT(fVar9), -1 < iVar6)))) { - if (iVar6 < 0x1c0) { - (GHIDRA_CAST((temp_5fd03f2348)))->Room::TryMakeBridge(gridEntity->_gridEntities[iVar6], - GHIDRA_CAST(gridEntity)); - } - else { - (GHIDRA_CAST((temp_5fd03f2348)))->Room::TryMakeBridge(GHIDRA_CAST(0x0),GHIDRA_CAST(gridEntity)); - } - goto LAB_006ab9e8; - } -LAB_006abfe6: - fVar9 = normalX; - fVar11 = normalY; - goto LAB_006aba00; - } - if (gridEntity != GHIDRA_CAST(0x0)) goto LAB_006abcae; -LAB_006abf5a: - if (this->_entityGridCollisionClass == 3) { - if (uVar2 == 4) goto LAB_006abf9a; - if (uVar2 == 3) { - if (gridEntity == GHIDRA_CAST(0x0)) goto LAB_006abfe6; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) == 0x10) goto LAB_006abf9a; - } - } - else if (((this->_entityGridCollisionClass == 5) && (uVar2 != 0)) && (uVar2 != 5)) { -LAB_006abf9a: - collisionPoints = (this->_collisionPoints)._begin; - normalX = normalX + *GHIDRA_CAST((GHIDRA_CAST(collisionPoints) + pointIndex * 8)); - normalY = normalY + *GHIDRA_CAST((GHIDRA_CAST(collisionPoints) + pointIndex * 8 + 4)); - } -LAB_006ab9e8: - fVar9 = normalX; - fVar11 = normalY; - } - } - } - } - } -LAB_006aba00: - pointIndex = pointIndex + 1; - } while (GHIDRA_UINT(pointIndex) < GHIDRA_UINT(local_5c.y)); - } - fVar9 = fVar9 * fVar9 + fVar11 * fVar11; - if (0.001 <= fVar9) { - fVar9 = sqrtf(fVar9); - if (0.0 < fVar9) { - normalX = normalX * (1.0 / fVar9); - normalY = normalY * (1.0 / fVar9); - } - if (isSimulated == 0) { - (this->_gridCollisionNormal).x = normalX; - (this->_gridCollisionNormal).y = normalY; - } - fVar9 = (this->_velocity).x; - fVar11 = (this->_velocity).y; - fVar10 = -normalX * fVar9 - normalY * fVar11; - if ((fVar10 < 0.0) && (isSimulated == 0)) { - this->_collidesWithGrid = 1; - (this->_gridCollisionVelocity).x = fVar9; - (this->_gridCollisionVelocity).y = fVar11; - fVar11 = fVar10 * 0.9 - 0.1; - fVar9 = (this->_gridCollisionNormal).x; - (this->_velocity).y = (this->_gridCollisionNormal).y * fVar11 + (this->_velocity).y; - (this->_velocity).x = fVar11 * fVar9 + (this->_velocity).x; - } - fVar9 = normalY * (this->_sizeMulti).y; - fVar11 = normalX * (this->_sizeMulti).x; - fVar10 = sqrtf(fVar9 * fVar9 + fVar11 * fVar11); - fVar10 = fVar10 * this->_size; - fVar9 = (this->_velocity).y; - fVar11 = (this->_velocity).x; - freeDepth = sqrtf(fVar11 * fVar11 + fVar9 * fVar9); - if (freeDepth <= 2.0) { - freeDepth = 2.0; - } - freeDepth = fVar10 - freeDepth; - blockedDepth = fVar10; - if (this->_entityGridCollisionClass == 5) { - iVar6 = 0xc; - do { - fVar9 = (blockedDepth - freeDepth) * 0.5 + freeDepth; - pointPos.x = normalX * fVar9 + (this->_pos).x; - pointPos.y = normalY * fVar9 + (this->_pos).y; - uVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::get_grid_collision_at(&pointPos); - if ((uVar2 == 0) || (uVar2 == 5)) { - freeDepth = fVar9; - } - else { - blockedDepth = fVar9; - } - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - } - else { - iVar6 = 6; - do { - fVar9 = (blockedDepth - freeDepth) * 0.5 + freeDepth; - pointPos.x = normalX * fVar9 + (this->_pos).x; - pointPos.y = normalY * fVar9 + (this->_pos).y; - uVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::get_grid_collision_at(&pointPos); - if (uVar2 == 4) { - blockedDepth = fVar9; - } - else { - freeDepth = fVar9; - } - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - } - posRef->x = normalX * (freeDepth - fVar10) + posRef->x; - posRef->y = normalY * (freeDepth - fVar10) + posRef->y; - } - else if (isSimulated == 0) { - (this->_gridCollisionNormal).x = g_vectorZero.x; - (this->_gridCollisionNormal).y = g_vectorZero.y; - } - ExceptionList = prevExceptionList; - return; -} - -// 006ac2a0 -void Entity::SetSize(float size, Vector sizeMulti, int numGridCollisionPoints) -{ - int oddPointIdx; - float pointX; - double dVar1; - double dVar2; - int evenPointIdx; - Vector point; - void **collisionPointsEnd; - float *pointSlot; - - if ((sizeMulti.x == -1.0) && (sizeMulti.y == -1.0)) { - sizeMulti.x = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x3c)); - sizeMulti.y = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x40)); - } - if (numGridCollisionPoints == -1) { - numGridCollisionPoints = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x48)); - } - if (((this->_size != size) || ((this->_sizeMulti).x != sizeMulti.x)) || - ((this->_sizeMulti).y != sizeMulti.y)) { - this->_size = size; - (this->_collisionPoints)._end = (this->_collisionPoints)._begin; - (this->_sizeMulti).x = sizeMulti.x; - (this->_sizeMulti).y = sizeMulti.y; - evenPointIdx = 0; - if (0 < numGridCollisionPoints) { - do { - dVar1 = (double)((((float)evenPointIdx + (float)evenPointIdx) * 3.1415927) / - (float)numGridCollisionPoints); - dVar2 = dVar1; - libm_sse2_cos_precise(); - pointX = (float)dVar2 * this->_size * (this->_sizeMulti).x; - point.x = pointX; - libm_sse2_sin_precise(); - pointSlot = (this->_collisionPoints)._end; - point.y = (float)dVar1 * this->_size * (this->_sizeMulti).y; - if (pointSlot == (this->_collisionPoints)._capacity) { - msvc::vector::_Emplace_reallocate(pointSlot,&point); - } - else { - *pointSlot = pointX; - pointSlot[1] = point.y; - collisionPointsEnd = &(this->_collisionPoints)._end; - *collisionPointsEnd = (void *)(GHIDRA_INT(*collisionPointsEnd) + 8); - } - evenPointIdx = evenPointIdx + 2; - } while (evenPointIdx < numGridCollisionPoints); - } - oddPointIdx = 1; - if (1 < numGridCollisionPoints) { - do { - dVar1 = (double)((((float)oddPointIdx + (float)oddPointIdx) * 3.1415927) / - (float)numGridCollisionPoints); - dVar2 = dVar1; - libm_sse2_cos_precise(); - pointX = (float)dVar2 * this->_size * (this->_sizeMulti).x; - point.x = pointX; - libm_sse2_sin_precise(); - pointSlot = (this->_collisionPoints)._end; - point.y = (float)dVar1 * this->_size * (this->_sizeMulti).y; - if (pointSlot == (this->_collisionPoints)._capacity) { - msvc::vector::_Emplace_reallocate(pointSlot,&point); - } - else { - *pointSlot = pointX; - pointSlot[1] = point.y; - collisionPointsEnd = &(this->_collisionPoints)._end; - *collisionPointsEnd = (void *)(GHIDRA_INT(*collisionPointsEnd) + 8); - } - oddPointIdx = oddPointIdx + 2; - } while (oddPointIdx < numGridCollisionPoints); - } - } - return; -} - -// 006ac530 -uint8_t Entity::IsEnemy() -{ - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (this->_type != 1)) { - return this->_type - 10U < 0x3de; - } - return 1; -} - -// 006ac560 -uint8_t Entity::IsVulnerableEnemy(Entity *source) -{ - uint8_t bVar1; - Entity *lastSpawner; - uint8_t extraout_DL; - int entityType; - - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - if (((source != GHIDRA_CAST(0x0)) && (source->_type == 1)) && - (bVar1 = IsDescendantOf(this,source), bVar1 != 0)) { - return 0; - } - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_type == 1)) { - entityType = 1; - goto LAB_006ac5c1; - } - } - entityType = this->_type; - if (0x3dd < entityType - 10U) { - return 0; - } -LAB_006ac5c1: - if ((((this->_entityCollisionClass == 1) || (this->_entityCollisionClass == 0)) || - ((this->_isInvicible != 0 || (this->_dead != 0)))) || - (((bVar1 = HasEntityFlags(this,0x10), bVar1 != 0 && (entityType != 0x322)) && - (entityType != 0x362)))) { - return 0; - } - if (source == GHIDRA_CAST(0x0)) { - return 1; - } - if ((this->_flags & 0x20000000) == 0) { - return 1; - } - lastSpawner = GetLastSpawner(source); - if ((((lastSpawner->_flags & 0x20000000) == 0) && (lastSpawner->_type != 1)) && - (lastSpawner->_type != 3)) { - return extraout_DL; - } - return 0; -} - -// 006ac6c0 -uint8_t Entity::IsFlying() -{ - int gridCollisionClass; - - gridCollisionClass = this->_entityGridCollisionClass; - if ((((gridCollisionClass == 0) || (gridCollisionClass == 3)) || (gridCollisionClass == 1)) || - (gridCollisionClass == 2)) { - return 1; - } - return 0; -} - -// 006ac6e0 -void Entity::ResetColor() -{ - float fVar1; - float fVar2; - float fVar3; - ColorMod *spriteColor; - - spriteColor = &(this->_sprite)._color; - if (spriteColor != &this->_color) { - fVar1 = (this->_color)._tint[1]; - fVar2 = (this->_color)._tint[2]; - fVar3 = (this->_color)._tint[3]; - spriteColor->_tint[0] = (this->_color)._tint[0]; - (this->_sprite)._color._tint[1] = fVar1; - (this->_sprite)._color._tint[2] = fVar2; - (this->_sprite)._color._tint[3] = fVar3; - fVar1 = (this->_color)._colorize[1]; - fVar2 = (this->_color)._colorize[2]; - fVar3 = (this->_color)._colorize[3]; - (this->_sprite)._color._colorize[0] = (this->_color)._colorize[0]; - (this->_sprite)._color._colorize[1] = fVar1; - (this->_sprite)._color._colorize[2] = fVar2; - (this->_sprite)._color._colorize[3] = fVar3; - *GHIDRA_CAST((this->_sprite)._color._offset) = *GHIDRA_CAST((this->_color)._offset); - (this->_sprite)._color._offset[2] = (this->_color)._offset[2]; - } - return; -} - -// 006ac710 -uint8_t Entity::IsFrame(int frequency, int offset) -{ - uint8_t isPaused; - Game *game; - - game = g_game; - if ((this->_flags & 0x4000) == 0) { - isPaused = Game::IsPaused(g_game); - if (isPaused == 0) { - return (game->_frameCount + offset) % frequency == 0; - } - } - return 0; -} - -// 006ac760 -int Entity::GetIntervalTicks(float interval, float offset) -{ - uint8_t isPaused; - - if ((this->_flags & 0x4000) == 0) { - isPaused = Game::IsPaused(g_game); - if (isPaused == 0) { - return GHIDRA_INT(((offset + this->_updateTime) / interval)) - - GHIDRA_INT(((offset + this->_prevUpdateTime) / interval)); - } - } - return 0; -} - -// 006ac7e0 -int Entity::CountRelatedEntities(int type, int variant, int unused, void *outEntities) -{ - uint8_t isDescendant; - uint64_t *allocatedBytes; - int count; - uint32_t *entitySlot; - uint8_t local_24 [12]; - int local_18; - Entity *self; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t allocSize; - uint64_t oldAllocated; - uint32_t *outEnd; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af69dd; - local_10 = ExceptionList; - ExceptionList = &local_10; - count = 0; - self = this; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_24),type,variant,-1,0 - ,0); - local_8 = 0; - variant = local_18; - if (local_18 != 0) { - entitySlot = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_24))) + 0x4))); - do { - isDescendant = IsDescendantOf(GHIDRA_CAST(*entitySlot),self); - if ((isDescendant != 0) && (count = count + 1, outEntities != (void *)0x0)) { - outEnd = *GHIDRA_CAST((GHIDRA_CAST(outEntities) + 4)); - if (outEnd == *GHIDRA_CAST((GHIDRA_CAST(outEntities) + 8))) { - msvc::vector::_Emplace_reallocate(outEnd,entitySlot); - } - else { - *outEnd = *entitySlot; - *GHIDRA_CAST((GHIDRA_CAST(outEntities) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(outEntities) + 4)) + 4; - } - } - entitySlot = entitySlot + 1; - variant = variant + -1; - } while (variant != 0); - } - if (local_24[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_24))) + 0x4))) != GHIDRA_CAST(0x0)) { - allocSize = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + -4)); - oldAllocated = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - allocSize; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < allocSize)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + -4))); - } - } - ExceptionList = local_10; - return count; -} - -// 006ac8d0 -int Entity::get_velocity_direction() -{ - int direction; - float vx; - float vy; - - vx = (this->_velocity).x; - vy = (this->_velocity).y; - if (ABS(vy) < ABS(vx)) { - direction = 2; - if (vx < 0.0) { - direction = 0; - } - return direction; - } - return GHIDRA_UINT((0.0 <= vy)) * 2 + 1; -} - -// 006ac920 -void Entity::Kill(EntityRef *source) -{ - int iVar1; - char cVar2; - uint8_t isItemHeld; - Entity_Player *killerPlayer; - ColorMod *Color; - Color explosionColor; - uint32_t local_c; - - local_c = __security_cookie ^ GHIDRA_UINT(&explosionColor); - if (this->_dead == 0) { - this->_dead = 1; - if (source->_entity != GHIDRA_CAST(0x0)) { - killerPlayer = GHIDRA_CAST(GetPlayerAncestor(source->_entity)); - if ((((((killerPlayer != GHIDRA_CAST(0x0)) && (iVar1 = this->_type, iVar1 != 0)) && - (iVar1 != 1)) && - (((iVar1 != 2 && (iVar1 != 3)) && ((iVar1 != 4 && ((iVar1 != 5 && (iVar1 != 6)))))))) && - (iVar1 != 7)) && ((iVar1 != 8 && (iVar1 != 9)))) { - if (iVar1 == 0x21) { - isItemHeld = (GHIDRA_CAST((killerPlayer)))->Entity_Player::HasCollectible(0x1a4,0); - if ((isItemHeld != 0) && - (((iVar1 = this->_variant, iVar1 == 0 || (iVar1 == 1)) || (iVar1 == 10)))) { - ::(GHIDRA_CAST((&explosionColor)))->Color::Color(); - Game::BombExplosionEffects - (g_game,&this->_pos,20.0,(BitSet128)ZEXT816(0),Color,GHIDRA_CAST(killerPlayer), - 1.0,1,4,0); - } - } - else if (iVar1 != 1000) { - Player_stats_add(&g_game->_onlinePlayerStats,0x11,killerPlayer,1.0); - cVar2 = this->IsBoss(); - if (cVar2 != '\0') { - Player_stats_add(&g_game->_onlinePlayerStats,0x14,killerPlayer,1.0); - if (killerPlayer->_isCoopGhost != 0) { - Player_stats_add(&g_game->_onlinePlayerStats,0x15,killerPlayer,1.0); - } - } - } - } - } - cVar2 = this->IsBoss(); - if ((cVar2 == '\0') && (this->_type != 3)) { - BloodExplode(this); - } - LuaEngine::PostEntityKill(this); - } - return; -} - -// 006acb00 -void Entity::Remove() -{ - uint32_t *luaBridgeRef; - - this->_exists = 0; - if (this->_dead == 0) { - this->_dead = 1; - } - ReleaseLuaRef(this); - luaBridgeRef = this->_luaBridgeRef; - if (luaBridgeRef != GHIDRA_CAST(0x0)) { - luaL_unref(*luaBridgeRef,0xfff0b9d8,luaBridgeRef[1]); - operator_delete(luaBridgeRef,8); - this->_luaBridgeRef = (void *)0x0; - } - return; -} - -// 006acb60 -void Entity::ClearReferences() -{ - std_multiset *referrers; - Entity *referrersHead; - Entity *local_8; - uint32_t *ptrSlot; - - local_8 = this; - if (this->_parent != 0) { - local_8 = GHIDRA_CAST(&this->_parent); - msvc::multiset::erase(&local_8); - } - this->_parent = 0; - if (this->_child != 0) { - local_8 = GHIDRA_CAST(&this->_child); - msvc::multiset::erase(&local_8); - } - this->_child = 0; - if (this->_target != 0) { - local_8 = GHIDRA_CAST(&this->_target); - msvc::multiset::erase(&local_8); - } - this->_target = 0; - if (this->_spawnerEntity != 0) { - local_8 = GHIDRA_CAST(&this->_spawnerEntity); - msvc::multiset::erase(&local_8); - } - this->_spawnerEntity = 0; - ptrSlot = &this->_minecart; - if (*ptrSlot != 0) { - local_8 = GHIDRA_CAST(ptrSlot); - msvc::multiset::erase(&local_8); - *ptrSlot = 0; - } - if (this->_hitEffect != 0) { - local_8 = GHIDRA_CAST(&this->_hitEffect); - msvc::multiset::erase(&local_8); - this->_hitEffect = 0; - } - ptrSlot = &this->_iceFrozenEffect; - if (GHIDRA_CAST(this->_iceFrozenEffect) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_iceFrozenEffect) + 0x28))(); - } - if (*ptrSlot != 0) { - local_8 = GHIDRA_CAST(ptrSlot); - msvc::multiset::erase(&local_8); - } - *ptrSlot = 0; - referrers = &this->_entityPtrReferrers; - referrersHead = referrers->_head; - local_8 = *GHIDRA_CAST(referrersHead); - if (local_8 != referrersHead) { - do { - **GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_8)) + 0x10)))) = 0; - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_8); - referrersHead = referrers->_head; - } while (local_8 != referrersHead); - } - FID_conflict__Erase_tree_>_> - (referrers,(fuzzer_allocator_> *)referrers, - *(_Tree_node **)&(*GHIDRA_CAST((GHIDRA_CAST((referrersHead)) + 0x4)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((referrersHead)) + 0x4)))) = referrersHead; - *GHIDRA_CAST(referrersHead) = referrersHead; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((referrersHead)) + 0x8)))) = referrersHead; - (this->_entityPtrReferrers)._size = 0; - if (this->_valid != 0) { - (this->_colorParams)._end = (this->_colorParams)._begin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - (this->_collisionPoints)._end = (this->_collisionPoints)._begin; - ANM2::Reset(&this->_sprite); - } - return; -} - -// 006acd10 -uint8_t Entity::IsDamageSourceFriendly(EntityRef *source) -{ - int iVar1; - bool bVar2; - uint8_t isDescendant; - void *charmer; - int deathmatchMode; - uint64_t flags; - bool isFriendly; - bool isPlayerSource; - - iVar1 = this->_type; - if (((iVar1 == 1) && (source->_type == 1)) && (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - return 1; - } - flags = this->_flags; - if ((((flags & 0x100) == 0) || (charmer = (this->_charmSource)._entity, charmer == (void *)0x0)) - || ((*GHIDRA_CAST((GHIDRA_CAST(charmer) + 0x28)) != 1 || (this->_charmedCountdown != 0)))) { - bVar2 = false; - } - else { - bVar2 = true; - } - if ((((flags & 0x20000000) != 0) || ((iVar1 == 3 && ((flags & 0x20000100) == 0)))) || - (isFriendly = false, bVar2)) { - isFriendly = true; - } - deathmatchMode = *GHIDRA_CAST(&g_game->_deathmatchManager); - if ((deathmatchMode < 2) || (iVar1 != 1)) { - bVar2 = iVar1 - 10U < 0x3de; - } - else { - bVar2 = true; - } - if (((((source->_spawnerType == 1) || (iVar1 = source->_type, iVar1 == 1)) || (iVar1 == 8)) || - ((source->_spawnerType == 3 || (iVar1 == 3)))) || - (((GHIDRA_UINT(source->_flags) >> 1 & 1) != 0 || - ((iVar1 == 1000 && - (isDescendant = Entity_Effect::IsPlayerCreep(source->_variant), isDescendant != 0)))))) { - isPlayerSource = true; - } - else { - isPlayerSource = false; - } - if (isFriendly) { - if ((1 < deathmatchMode) && - (isDescendant = IsDescendantOf(this,source->_entity), isDescendant == 0)) { - if (source->_entity == GHIDRA_CAST(0x0)) { - return 0; - } - isDescendant = IsDescendantOf(source->_entity,(this->_charmSource)._entity); - if (isDescendant == 0) { - return 0; - } - } - if ((bVar2) && (isPlayerSource)) { - return 1; - } - return 0; - } - return 0; -} - -// 006ace60 -uint8_t Entity::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) -{ - float fVar1; - uint8_t bVar2; - char cVar3; - Entity *spawner; - Entity *pEVar4; - float *overlayNull; - Entity_Player *pEVar5; - Entity_Player *pEVar6; - LuaEngine *this_00; - int iVar7; - uint32_t uVar8; - uint32_t *local_44; - float damageInfo [2]; - uint32_t damageFlagsLow; - uint32_t damageFlagsHigh; - EntityRef damageSource; - uint32_t *entityRefSlot; - Manager *manager; - uint32_t *pendingFlagsHigh; - float posOffsetY; - - if (this->_type == 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Entity TakeDamage should not be called for Entity Player!")); - } - uVar8 = GHIDRA_UINT(damageFlags) & 0x2000; - if (((damageFlags & 0x2000) == 0) && (bVar2 = IsDamageSourceFriendly(this,source), bVar2 != 0)) { - return 0; - } - if (damage <= 0.0) goto LAB_006ad14f; - bVar2 = IsVulnerableEnemy(this,GHIDRA_CAST(0x0)); - if (bVar2 == 0) { - if (this->_type != 0x3b6) goto LAB_006ad14f; -LAB_006acf1f: - if (this->_variant == 0) { - spawner = GHIDRA_CAST(this->_parent); - pEVar4 = spawner; -joined_r0x006acf5a: - if (pEVar4 != GHIDRA_CAST(0x0)) goto LAB_006acf96; - } - } - else { - iVar7 = this->_type; - if (iVar7 == 0x325) goto LAB_006ad14f; - if (iVar7 == 0x340) { - if ((((this->_variant == 1) && - (spawner = GHIDRA_CAST(this->_spawnerEntity), spawner != GHIDRA_CAST(0x0))) && - (spawner->_type == 0x389)) && - ((fVar1 = this[2]._preInterpolatePos.x, fVar1 == 2.24208e-44 || (fVar1 == 7.00649e-45)))) - goto LAB_006acf96; - } - else { - if (iVar7 == 0x3b6) goto LAB_006acf1f; - if (((iVar7 == 0x379) && (spawner = GHIDRA_CAST(this->_parent), spawner != GHIDRA_CAST(0x0))) && - (spawner->_type == 0x399)) { - if (GHIDRA_CAST(spawner->_child) != this) goto LAB_006acf96; - pEVar4 = GHIDRA_CAST(spawner->_entityCollisionClass); - goto joined_r0x006acf5a; - } - } - } - local_44 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x1))),1)); - if ((this->_flags & 0x20000000) == 0) { - local_44 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_44))) + 0x1))) << 8)); - } - spawner = find_nearest_enemy(&this->_pos,GHIDRA_CAST(&local_44),(uint8_t)local_44); - if (spawner == GHIDRA_CAST(0x0)) { -LAB_006ad14f: - if (((damageFlags & 2) != 0) && (0.0 < damage)) { - if (0 < this->_fireDamageCountdown) { - return 0; - } - this->_fireDamageCountdown = 10; - } - if ((damageFlags & 0x40) != 0) { - if (0 < this->_damageCountdown) { - return 0; - } - this->_damageCountdown = damageCountdown; - } - if ((((damageFlags & 0x2000) == 0) && - (cVar3 = this->IsBoss(), cVar3 != '\0')) && - (1 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)))) { - iVar7 = 0; - do { - pEVar5 = Game::GetPlayer(g_game,uVar8); - pEVar6 = GHIDRA_CAST(pEVar5->_twinPlayer); - if ((((pEVar6 == GHIDRA_CAST(0x0)) || (pEVar6->_playerIndex == -1)) || - ((pEVar5->_playerIndex <= pEVar6->_playerIndex || (pEVar5 == pEVar6)))) && - (pEVar5->_parent == 0)) { - iVar7 = iVar7 + 1; - } - uVar8 = uVar8 + 1; - } while (uVar8 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - if (1 < iVar7) { - damage = damage * 0.8; - } - } - this_00 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) & 0x400000)); - if (this_00 != GHIDRA_CAST(0x0)) { - damage = damage + damage; - } - if ((0.0 < this->_maxHitPoints) && - (bVar2 = LuaEngine::EntityTakeDamage(this_00,this,damage,damageFlags,source,damageCountdown), - bVar2 != 0)) { - (GHIDRA_CAST((damageInfo)))->DamageInfo::DamageInfo(); - damageInfo[0] = damage; - damageFlagsHigh = (*GHIDRA_CAST((GHIDRA_CAST(&(damageFlags)) + 0x4))); - damageFlagsLow = GHIDRA_UINT(damageFlags); - (GHIDRA_CAST((&damageSource)))->EntityRef::operator_(source); - FUN_006b7db0(damageInfo); - fVar1 = this->_pendingDamage; - *GHIDRA_CAST(&this->_pendingDamageFlags) = GHIDRA_UINT(this->_pendingDamageFlags) | GHIDRA_UINT(damageFlags); - pendingFlagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)); - *pendingFlagsHigh = *pendingFlagsHigh | (*GHIDRA_CAST((GHIDRA_CAST(&(damageFlags)) + 0x4))); - this->_pendingDamage = damage + fVar1; - if (source->_entity == GHIDRA_CAST(0x0)) { - pEVar6 = GHIDRA_CAST(0x0); - } - else { - pEVar6 = GHIDRA_CAST(GetPlayerAncestor(source->_entity)); - } - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_type == 1)) || - (this->_type - 10U < 0x3de)) && (pEVar6 != GHIDRA_CAST(0x0))) { - Player_stats_add(&g_game->_onlinePlayerStats,0xf,pEVar6,damage); - iVar7 = __ftoui3(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x16b8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x16b8)))) + iVar7; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x16bc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x16bc)))) + iVar7; - } - return 1; - } - return 0; - } -LAB_006acf96: - manager = g_manager; - local_44 = GHIDRA_CAST(0x1f5); - seed_fart_sound_override(GHIDRA_CAST(&local_44)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44),1.0,10,0,1.0,0.0); - if (GHIDRA_CAST(this->_hitEffect) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_hitEffect) + 0x28))(); - } - uVar8 = Random(); - pEVar4 = Game::SpawnEx(g_game,1000,0xa0,&this->_pos,&g_vectorZero,spawner,0,uVar8,0); - if (pEVar4->_parent != 0) { - local_44 = &pEVar4->_parent; - msvc::multiset::erase(&local_44); - } - pEVar4->_parent = spawner; - if (spawner != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&pEVar4->_parent); - } - entityRefSlot = &pEVar4->_target; - if (pEVar4->_target != 0) { - local_44 = entityRefSlot; - msvc::multiset::erase(&local_44); - } - *entityRefSlot = this; - msvc::multiset::insert(entityRefSlot); - pEVar4[1]._sprite._filename._size = 0; - pEVar4[1]._sprite._filename._capacity = 0xc1c00000; - if (((this->_sprite)._animState._animData != (void *)0x0) && - (overlayNull = AnimationState::GetNullFrame - (&(this->_sprite)._animState,GHIDRA_CAST("OverlayEffect")), - overlayNull != GHIDRA_CAST(0x0))) { - fVar1 = overlayNull[1]; - posOffsetY = (this->_posOffset).y; - (pEVar4->_posOffset).x = ((*overlayNull - 0.0) * 0.5) / 0.65 + (this->_posOffset).x; - (pEVar4->_posOffset).y = ((fVar1 - 4.0) * 0.5) / 0.65 + posOffsetY; - } - pEVar4->Update(); - entityRefSlot = &this->_hitEffect; - if (GHIDRA_CAST(this->_hitEffect) == pEVar4) { - return 0; - } - if (GHIDRA_CAST(this->_hitEffect) != GHIDRA_CAST(0x0)) { - local_44 = entityRefSlot; - msvc::multiset::erase(&local_44); - } - *entityRefSlot = pEVar4; - msvc::multiset::insert(entityRefSlot); - return 0; -} - -// 006ad340 -bool Entity::HasMortalDamage() -{ - return this->_health <= this->_pendingDamage; -} - -// 006ad350 -int Entity::apply_second_hand_duration(int duration, EntityRef *source) -{ - uint8_t isSecondHand; - int secondHandMultiplier; - Entity *rootSpawner; - Entity *spawner; - - if (((this->_type != 1) || (1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) && - (rootSpawner = source->_entity, rootSpawner != GHIDRA_CAST(0x0))) { - for (spawner = GHIDRA_CAST(rootSpawner->_spawnerEntity); spawner != GHIDRA_CAST(0x0); - spawner = GHIDRA_CAST(spawner->_spawnerEntity)) { - rootSpawner = spawner; - } - if ((rootSpawner->_type == 1) && - (isSecondHand = (GHIDRA_CAST((GHIDRA_CAST(rootSpawner))))->Entity_Player::HasTrinket(0x4e,0), - isSecondHand != 0)) { - secondHandMultiplier = (GHIDRA_CAST((GHIDRA_CAST(rootSpawner))))->Entity_Player::GetTrinketMultiplier(0x4e); - return secondHandMultiplier * duration * 2; - } - } - return duration; -} - -// 006ad3c0 -void Entity::AddFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) -{ - uint8_t bVar1; - char cVar2; - int newCountdown; - int extraout_EDX; - uint8_t auStack_3c [4]; - uint32_t freezeColor; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t local_28; - uint32_t uStack_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t local_18; - uint32_t local_14; - uint32_t local_10; - uint32_t local_c; - Entity *ancestor; - int currentCountdown; - uint32_t flagsLow; - Entity *nextParent; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_3c); - bVar1 = IsDamageSourceFriendly(this,ref); - if (bVar1 == 0) { - apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - if (((extraout_EDX != 0) && (flagsLow = GHIDRA_UINT(this->_flags), (flagsLow & 1) == 0)) && - ((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - currentCountdown = this->_freezeCountdown; - if (extraout_EDX < 1) { - newCountdown = currentCountdown; - if (currentCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 0x78; - if (currentCountdown + extraout_EDX < 0x78) { - newCountdown = currentCountdown + extraout_EDX; - } - } - this->_freezeCountdown = newCountdown; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - local_28 = 0; - uStack_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - *GHIDRA_CAST(&this->_flags) = flagsLow | 0x20; - freezeColor = 0x3e6147ae; - uStack_34 = 0x3e6147ae; - uStack_30 = 0x3e6147ae; - uStack_2c = 0x3f800000; - local_18 = 0x3e20a0a1; - local_14 = 0x3e20a0a1; - local_10 = 0x3e20a0a1; - this->SetColor(&freezeColor,newCountdown,0xff,0,1); - if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) { - this->_bossStatusEffectCooldown = 0xf0; - } - CopyStatusEffects(this); - } - } - return; -} - -// 006ad500 -void Entity::AddPoison(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown) -{ - uint8_t bVar1; - char cVar2; - int newCountdown; - int extraout_EDX; - ColorMod poisonColor; - uint32_t flags; - Entity *nextParent; - int oldCountdown; - Entity *parent; - void *sourceRoot; - void *spawner; - float tickDamage; - - bVar1 = IsDamageSourceFriendly(this,ref); - if (bVar1 != 0) { - return; - } - if (this->_type == 1) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::HasCollectible(0x278,0); - if (bVar1 != 0) { - return; - } - bVar1 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST(&this[5]._sprite._overlayRenderFirst),0x278); - if (bVar1 != 0) { - return; - } - } - apply_second_hand_duration(this,duration,ref); - if (damage <= 0.0) { - if ((this->_type != 1) && (sourceRoot = ref->_entity, sourceRoot != (void *)0x0)) { - for (spawner = *(void **)(GHIDRA_CAST(sourceRoot) + 0x3c8); spawner != (void *)0x0; - spawner = *(void **)(GHIDRA_CAST(spawner) + 0x3c8)) { - sourceRoot = spawner; - } - if (*GHIDRA_CAST((GHIDRA_CAST(sourceRoot) + 0x28)) == 1) { - damage = *GHIDRA_CAST((GHIDRA_CAST(sourceRoot) + 0x157c)); - goto LAB_006ad5b4; - } - } - damage = 2.0; - } -LAB_006ad5b4: - bVar1 = DoesEntityShareStatus(this); - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (parent = nextParent, parent != GHIDRA_CAST(0x0)) { - this = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - } - if (((extraout_EDX != 0) && (flags = GHIDRA_UINT(this->_flags), (flags & 1) == 0)) && - ((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - oldCountdown = this->_poisonCountdown; - if (extraout_EDX < 1) { - newCountdown = oldCountdown; - if (oldCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 0x78; - if (oldCountdown + extraout_EDX < 0x78) { - newCountdown = oldCountdown + extraout_EDX; - } - } - this->_poisonCountdown = newCountdown; - if ((flags & 0x40) == 0) { - this->_poisonDamageTimer = 0; - } - tickDamage = this->_poisonTickDamage; - if (tickDamage <= damage) { - tickDamage = damage; - } - poisonColor._tint[1] = 1.0; - poisonColor._tint[3] = 1.0; - this->_poisonTickDamage = tickDamage; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = flags | 0x40; - poisonColor._offset[0] = 0.0; - poisonColor._offset[2] = 0.0; - poisonColor._colorize[0] = 0.0; - poisonColor._colorize[1] = 0.0; - poisonColor._colorize[2] = 0.0; - poisonColor._colorize[3] = 0.0; - poisonColor._tint[0] = (200.0 - (float)newCountdown) / 200.0 - 0.1; - if (poisonColor._tint[0] <= 0.6) { - poisonColor._tint[0] = 0.6; - } - poisonColor._offset[1] = (float)GHIDRA_INT(((1.0 - poisonColor._tint[0]) * 90.0)) * 0.003921569; - poisonColor._tint[2] = poisonColor._tint[0]; - this->SetColor(&poisonColor,newCountdown,0xff,0,1); - if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) { - this->_bossStatusEffectCooldown = 0xf0; - } - CopyStatusEffects(this); - } - return; -} - -// 006ad750 -void Entity::AddSlowing(EntityRef *ref, int duration, float amount, ColorMod color, uint8_t ignoreBossStatusCooldown) -{ - uint8_t bVar1; - char isBoss; - int extraout_EDX; - uint32_t flagsHigh; - uint32_t flagsLow; - Entity *nextParent; - Entity *parent; - int vtable; - - bVar1 = IsDamageSourceFriendly(this,ref); - if (bVar1 == 0) { - apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (parent = nextParent, parent != GHIDRA_CAST(0x0)) { - this = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - } - if (extraout_EDX < 1) { - if (extraout_EDX < 0) { - flagsLow = GHIDRA_UINT(this->_flags); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if ((flagsLow & 1) == 0) { - this->_slowingCountdown = 2; - *GHIDRA_CAST(&this->_flags) = flagsLow | 0x80; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - } - } - } - else { - flagsLow = GHIDRA_UINT(this->_flags); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if (((flagsLow & 1) == 0) && - ((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - vtable = *GHIDRA_CAST(this); - this->_slowingCountdown = this->_slowingCountdown + extraout_EDX; - *GHIDRA_CAST(&this->_flags) = flagsLow | 0x80; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - (**(code **)(vtable + 0x3c))(&color,extraout_EDX,0xff,0,1); - if ((ignoreBossStatusCooldown == 0) && (isBoss = FUN_006ae7a0(), isBoss != '\0')) { - this->_bossStatusEffectCooldown = 0xf0; - } - } - } - this->_slowingAmount = amount; - CopyStatusEffects(this); - } - return; -} - -// 006ad870 -void Entity::AddCharmed(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t addEnemyKillScore) -{ - int iVar1; - uint8_t bVar2; - char cVar3; - uint32_t uVar4; - Entity_NPC *npc; - int unusedArg; - int extraout_ECX; - int extraout_EDX; - uint32_t *extraout_EDX_00; - uint32_t *entityIt; - void *sourceEntity; - int iVar5; - Game *game; - uint32_t uVar6; - Entity *statusOwner; - float sourcePosX; - float sourcePosY; - float sourceVelX; - float sourceVelY; - uint8_t auStack_54 [7]; - char isAlreadyCharmed; - uint32_t uStack_4c; - int sourceSpawnerVariant; - EntityRef *local_44; - Entity *local_40; - uint32_t uStack_3c; - uint32_t charmColor; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t local_28; - uint32_t uStack_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t local_18; - uint32_t local_14; - uint32_t local_10; - uint32_t local_c; - uint32_t flagsHigh; - Entity *nextParent; - Entity *parentIt; - int *typePtr; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_54); - local_44 = ref; - if ((this->_flags & 0x20000000) != 0) { - return; - } - local_40 = this; - apply_second_hand_duration(this,duration,ref); - bVar2 = DoesEntityShareStatus(this); - statusOwner = this; - if (bVar2 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - statusOwner = this; - while (parentIt = nextParent, parentIt != GHIDRA_CAST(0x0)) { - statusOwner = parentIt; - nextParent = GHIDRA_CAST(parentIt->_parent); - } - } - uVar6 = GHIDRA_UINT(statusOwner->_flags); - isAlreadyCharmed = (uVar6 & 0x20000100) != 0; - if (extraout_EDX < 1) { - if (extraout_EDX < 0) { - typePtr = &this->_type; - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*typePtr == 1)) || - (*typePtr - 10U < 0x3de)) && ((!(bool)isAlreadyCharmed && (addEnemyKillScore != 0)))) { - award_fly_kill_points(&g_game->_scoreSheet,this); - } - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)); - *GHIDRA_CAST(&statusOwner->_flags) = GHIDRA_UINT(statusOwner->_flags) | 0x20000100; - *GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)) = flagsHigh; - statusOwner->_charmedCountdown = 0; - cVar3 = this->IsBoss(); - if ((((cVar3 == '\0') && (bVar2 = IsActiveEnemy(this,0), bVar2 != 0)) && - ((*typePtr != 0x17 || ((this->_variant != 0 || (this->_subtype != 1)))))) && - (bVar2 = HasEntityFlags(this,0x1000000000000000), bVar2 == 0)) { - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::AddPersistentEntity(this); - } - game = g_game; - if (*GHIDRA_CAST(&g_game->_seedEffects) == '\0') { - bVar2 = Seeds::AchievementUnlocksDisallowed(&g_game->_seedEffects); - if (bVar2 == 0) { - bVar2 = Manager::IsGameplayInputActive(unusedArg); - if ((((bVar2 == 0) && (game->_isRerun == 0)) && - ((g_manager->_persistentGameData)._achievements[0x183] == 0)) && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (game == GHIDRA_CAST(0x0))) || - (((game->_dailyChallenge)._id == 0 && (game->_isDebug == 0)))))) { - uStack_4c = 0; - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1264)); - if (iVar5 != 0) { - iVar1 = *GHIDRA_CAST(&game->_deathmatchManager); - entityIt = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x125c)); - do { - nextParent = GHIDRA_CAST(*entityIt); - if ((((1 < iVar1) && (nextParent->_type == 1)) || (nextParent->_type - 10U < 0x3de)) - && ((nextParent->_flags & 0x20000000) != 0)) { - bVar2 = DoesEntityShareStatus(nextParent); - entityIt = extraout_EDX_00; - if ((bVar2 == 0) || (*GHIDRA_CAST((extraout_ECX + 0x3bc)) == 0)) { - uStack_4c = uStack_4c + 1; - } - } - this = local_40; - entityIt = entityIt + 1; - iVar5 = iVar5 + -1; - } while (iVar5 != 0); - game = g_game; - if (2 < uStack_4c) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x183); - game = g_game; - } - } - } - } - } - if (((1 < *GHIDRA_CAST(&game->_deathmatchManager)) && (statusOwner->_type == 1)) || - (statusOwner->_type - 10U < 0x3de)) { - statusOwner->ResetColor(); - } - } - } - else if (((uVar6 & 1) == 0) && - ((statusOwner->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - iVar5 = statusOwner->_charmedCountdown; - local_18 = 0x3e20a0a1; - if (iVar5 < extraout_EDX) { - iVar5 = extraout_EDX; - } - local_14 = 0x3e20a0a1; - statusOwner->_charmedCountdown = iVar5; - *GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)); - local_28 = 0; - uStack_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - *GHIDRA_CAST(&statusOwner->_flags) = uVar6 | 0x100; - charmColor = 0x3f800000; - uStack_34 = 0; - uStack_30 = 0x3f4ccccd; - uStack_2c = 0x3f800000; - local_10 = 0x3e20a0a1; - statusOwner->SetColor(&charmColor,iVar5,0xff,0,1); - if ((ignoreBossStatusCooldown == 0) && (cVar3 = FUN_006ae7a0(), cVar3 != '\0')) { - statusOwner->_bossStatusEffectCooldown = 0xf0; - } - } - sourceEntity = local_44->_entity; - if (sourceEntity == (void *)0x0) { - uStack_4c = 0; -LAB_006adc22: - local_44 = GHIDRA_CAST(0x0); - local_40 = GHIDRA_CAST(0x0); - sourceSpawnerVariant = 0; - sourcePosX = g_vectorZero.x; - sourcePosY = g_vectorZero.y; - sourceVelX = g_vectorZero.x; - sourceVelY = g_vectorZero.y; -LAB_006adc50: - uVar6 = 0; - if (sourceEntity != (void *)0x0) goto LAB_006adc56; - uVar6 = 0; -LAB_006adc72: - uStack_3c = 0; - if (sourceEntity != (void *)0x0) goto LAB_006adc7e; - } - else { - for (; *(void **)(GHIDRA_CAST(sourceEntity) + 0x3c8) != (void *)0x0; - sourceEntity = *(void **)(GHIDRA_CAST(sourceEntity) + 0x3c8)) { - } - uStack_4c = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x28)); - if (sourceEntity == (void *)0x0) goto LAB_006adc22; - local_44 = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x2c)); - sourcePosX = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x33c)); - sourcePosY = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x340)); - sourceVelX = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x360)); - sourceVelY = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x364)); - local_40 = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x34)); - sourceSpawnerVariant = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x38)); - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x168)) & 0x100) == 0) goto LAB_006adc50; - uVar6 = 1; -LAB_006adc56: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x168)) & 0x20000000) == 0) goto LAB_006adc72; - uStack_3c = 2; -LAB_006adc7e: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x16c)) & 0x400000) != 0) { - uVar4 = 4; - goto LAB_006adc99; - } - } - uVar4 = 0; -LAB_006adc99: - (this->_charmSource)._type = uStack_4c; - (this->_charmSource)._variant = GHIDRA_INT(local_44); - (this->_charmSource)._spawnerType = GHIDRA_INT(local_40); - (this->_charmSource)._spawnerVariant = sourceSpawnerVariant; - (this->_charmSource)._position.x = sourcePosX; - (this->_charmSource)._position.y = sourcePosY; - (this->_charmSource)._velocity.x = sourceVelX; - (this->_charmSource)._velocity.y = sourceVelY; - (this->_charmSource)._flags = uVar4 | uStack_3c | uVar6; - (this->_charmSource)._entity = sourceEntity; - CopyStatusEffects(statusOwner); - if (((statusOwner->_charmedCountdown != 0) && (isAlreadyCharmed == '\0')) && - ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (statusOwner->_type == 1)) || - (statusOwner->_type - 10U < 0x3de)) && - (npc = (Entity_NPC *) - __RTDynamicCast(statusOwner,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0), - npc != GHIDRA_CAST(0x0))))) { - (GHIDRA_CAST((npc)))->Entity_NPC::ResetPathFinderTarget(); - } - return; -} - -// 006add70 -void Entity::AddConfusion(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) -{ - uint8_t bVar1; - char cVar2; - int adjustedDuration; - uint32_t confusedFlagBefore; - Entity_NPC *npc; - int cappedCountdown; - uint32_t flagsLow; - int newCountdown; - ColorMod confusionColor; - Entity *ancestor; - uint32_t flagsHigh; - Entity *nextParent; - - bVar1 = IsDamageSourceFriendly(this,ref); - if ((bVar1 == 0) && - ((this->_type != 1 || - ((bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::HasCollectible(0x278,0), bVar1 == 0 && - (bVar1 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST(&this[5]._sprite._overlayRenderFirst),0x278), - bVar1 == 0)))))) { - adjustedDuration = apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - flagsLow = GHIDRA_UINT(this->_flags); - confusedFlagBefore = flagsLow & 0x200; - if (((adjustedDuration != 0) && ((flagsLow & 1) == 0)) && - ((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - newCountdown = this->_confusionCountdown; - if (adjustedDuration < 1) { - if (newCountdown < -adjustedDuration) { - newCountdown = -adjustedDuration; - } - } - else { - cappedCountdown = 0x78; - if (newCountdown + adjustedDuration < 0x78) { - cappedCountdown = newCountdown + adjustedDuration; - } - if (newCountdown < cappedCountdown) { - newCountdown = cappedCountdown; - } - flagsLow = GHIDRA_UINT(this->_flags); - } - this->_confusionCountdown = newCountdown; - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = flagsLow | 0x200; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - confusionColor._colorize[0] = 0.0; - confusionColor._colorize[1] = 0.0; - confusionColor._colorize[2] = 0.0; - confusionColor._colorize[3] = 0.0; - confusionColor._tint[0] = 0.5; - confusionColor._tint[1] = 0.5; - confusionColor._tint[2] = 0.5; - confusionColor._tint[3] = 1.0; - confusionColor._offset[0] = 0.15686275; - confusionColor._offset[1] = 0.15686275; - confusionColor._offset[2] = 0.15686275; - this->SetColor(&confusionColor,newCountdown,0xff,0,1); - if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) { - this->_bossStatusEffectCooldown = 0xf0; - } - } - CopyStatusEffects(this); - if ((((0 < this->_confusionCountdown) && (confusedFlagBefore == 0)) && - (bVar1 = IsEnemy(this), bVar1 != 0)) && - (npc = (Entity_NPC *) - __RTDynamicCast(this,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0), - npc != GHIDRA_CAST(0x0))) { - (GHIDRA_CAST((npc)))->Entity_NPC::ResetPathFinderTarget(); - } - } - return; -} - -// 006adf40 -void Entity::AddMidasFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) -{ - uint8_t bVar1; - char cVar2; - int freezeDuration; - ColorMod midasColor; - Entity *ancestor; - uint32_t flagsHigh; - Entity *nextParent; - - bVar1 = IsDamageSourceFriendly(this,ref); - if (bVar1 == 0) { - freezeDuration = apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - if (((0 < freezeDuration) && (this->_midasFreezeCountdown == 0)) && - ((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - if (this->_type == 0xf5) { - this->_variant = 1; - return; - } - bVar1 = HasEntityFlags(this,1); - if (bVar1 == 0) { - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x420; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - midasColor._colorize[0] = 0.0; - midasColor._colorize[1] = 0.0; - midasColor._colorize[2] = 0.0; - midasColor._colorize[3] = 0.0; - this->_midasFreezeCountdown = freezeDuration; - this->_freezeCountdown = freezeDuration; - midasColor._tint[0] = 1.5; - midasColor._tint[1] = 1.5; - midasColor._tint[2] = 0.3; - midasColor._tint[3] = 1.0; - midasColor._offset[0] = 0.15686275; - midasColor._offset[1] = 0.15686275; - midasColor._offset[2] = 0.15686275; - this->SetColor(&midasColor,freezeDuration,0xff,0,1); - if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) { - this->_bossStatusEffectCooldown = 0xf0; - } - } - } - CopyStatusEffects(this); - } - return; -} - -// 006ae0a0 -void Entity::AddFear(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) -{ - uint8_t bVar1; - char isBoss; - int iVar2; - uint32_t extraout_EAX; - Entity_NPC *npc; - int newFearCountdown; - uint8_t auStack_44 [7]; - uint8_t isHadFearFlags; - EntityRef *sourceRef; - Color fearColor; - uint32_t local_c; - Game *game; - Entity *nextParent; - int oldFearCountdown; - Entity *parent; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_44); - sourceRef = ref; - bVar1 = IsDamageSourceFriendly(this,ref); - if ((bVar1 == 0) && - ((this->_type != 1 || - ((bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::HasCollectible(0x278,0), bVar1 == 0 && - (bVar1 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST(&this[5]._sprite._overlayRenderFirst),0x278), - bVar1 == 0)))))) { - iVar2 = apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (parent = nextParent, parent != GHIDRA_CAST(0x0)) { - this = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - } - if (((iVar2 != 0) && ((this->_flags & 1) == 0)) && - ((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - isHadFearFlags = HasEntityFlags(this,0x1000800); - oldFearCountdown = this->_fearCountdown; - if (iVar2 < 1) { - newFearCountdown = oldFearCountdown; - if (oldFearCountdown < -iVar2) { - newFearCountdown = -iVar2; - } - } - else { - newFearCountdown = 0x78; - if (oldFearCountdown + iVar2 < 0x78) { - newFearCountdown = oldFearCountdown + iVar2; - } - } - this->_fearCountdown = newFearCountdown; - ::(GHIDRA_CAST((&fearColor)))->Color::Color(); - this->SetColor(extraout_EAX,newFearCountdown,0xff,0,1); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x800; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if ((((ignoreBossStatusCooldown == 0) && - (isBoss = FUN_006ae7a0(), game = g_game, isBoss != '\0')) && - (this->_bossStatusEffectCooldown = 0xf0, game->_challenge == 0x1e)) && - (sourceRef->_type == 1)) { - iVar2 = this->_bossStatusEffectCooldown; - if (sourceRef->_variant == 0) { - iVar2 = 0x5a; - } - this->_bossStatusEffectCooldown = iVar2; - } - CopyStatusEffects(this); - if (((0 < this->_fearCountdown) && (isHadFearFlags == 0)) && - ((bVar1 = IsEnemy(this), bVar1 != 0 && - (npc = (Entity_NPC *) - __RTDynamicCast(this,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0), - npc != GHIDRA_CAST(0x0))))) { - (GHIDRA_CAST((npc)))->Entity_NPC::ResetPathFinderTarget(); - } - } - } - return; -} - -// 006ae280 -void Entity::AddBurn(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown) -{ - uint32_t uVar1; - uint8_t bVar2; - char cVar3; - int newBurnCountdown; - int extraout_EDX; - float burnDamage; - int burnCountdown; - Entity *nextParent; - Entity *parent; - void *sourceEntity; - void *spawner; - uint32_t temp_5fab6eade2; - - bVar2 = IsDamageSourceFriendly(this,ref); - if (bVar2 != 0) { - return; - } - if (this->_type == 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::HasCollectible(0x278,0); - if (bVar2 != 0) { - return; - } - bVar2 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST(&this[5]._sprite._overlayRenderFirst),0x278); - if (bVar2 != 0) { - return; - } - } - apply_second_hand_duration(this,duration,ref); - if (damage <= 0.0) { - if ((this->_type != 1) && (sourceEntity = ref->_entity, sourceEntity != (void *)0x0)) { - for (spawner = *(void **)(GHIDRA_CAST(sourceEntity) + 0x3c8); spawner != (void *)0x0; - spawner = *(void **)(GHIDRA_CAST(spawner) + 0x3c8)) { - sourceEntity = spawner; - } - if (*GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x28)) == 1) { - damage = *GHIDRA_CAST((GHIDRA_CAST(sourceEntity) + 0x157c)); - goto LAB_006ae326; - } - } - damage = 2.0; - } -LAB_006ae326: - bVar2 = DoesEntityShareStatus(this); - if (bVar2 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (parent = nextParent, parent != GHIDRA_CAST(0x0)) { - this = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - } - if (((extraout_EDX != 0) && (uVar1 = GHIDRA_UINT(this->_flags), (uVar1 & 1) == 0)) && - ((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) { - burnCountdown = this->_burnCountdown; - if (extraout_EDX < 1) { - newBurnCountdown = burnCountdown; - if (burnCountdown < -extraout_EDX) { - newBurnCountdown = -extraout_EDX; - } - } - else { - newBurnCountdown = 0xa0; - if (burnCountdown + extraout_EDX < 0xa0) { - newBurnCountdown = burnCountdown + extraout_EDX; - } - } - this->_burnCountdown = newBurnCountdown; - if ((uVar1 & 0x1000) == 0) { - this->_burnDamageTimer = 0; - } - burnDamage = this->_burnTickDamage; - if (burnDamage <= damage) { - burnDamage = damage; - } - this->_burnTickDamage = burnDamage; - temp_5fab6eade2 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = uVar1 | 0x1000; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = temp_5fab6eade2; - if ((ignoreBossStatusCooldown == 0) && (cVar3 = FUN_006ae7a0(), cVar3 != '\0')) { - this->_bossStatusEffectCooldown = 0xf0; - } - CopyStatusEffects(this); - } - return; -} - -// 006ae420 -void Entity::AddBleeding(EntityRef *ref, int duration, uint8_t unused) -{ - uint8_t bVar1; - char cVar2; - uint32_t refFlagReflected; - int newCountdown; - int extraout_EDX; - Entity *statusOwner; - uint32_t local_38; - EntityRef sourceRef; - Entity *ancestor; - uint32_t *flagsHigh; - Entity *nextParent; - int oldCountdown; - - bVar1 = IsDamageSourceFriendly(this,ref); - if (bVar1 != 0) { - return; - } - apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - statusOwner = this; - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - statusOwner = this; - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - statusOwner = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - if (extraout_EDX == 0) { - return; - } - if ((statusOwner->_flags & 1) != 0) { - return; - } - if (0 < statusOwner->_bossStatusEffectCooldown) { - return; - } - oldCountdown = statusOwner->_bleedingCountdown; - if (extraout_EDX < 1) { - newCountdown = oldCountdown; - if (oldCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 0x78; - if (oldCountdown + extraout_EDX < 0x78) { - newCountdown = oldCountdown + extraout_EDX; - } - } - statusOwner->_bleedingCountdown = newCountdown; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)); - *flagsHigh = *flagsHigh | 4; - *GHIDRA_CAST(&statusOwner->_flags) = GHIDRA_INT(statusOwner->_flags); - sourceRef._entity = ref->_entity; - if (sourceRef._entity == (void *)0x0) { - sourceRef._type = 0; -LAB_006ae55a: - sourceRef._variant = 0; - sourceRef._spawnerType = 0; - sourceRef._spawnerVariant = 0; - sourceRef._position.x = g_vectorZero.x; - sourceRef._position.y = g_vectorZero.y; - sourceRef._velocity.x = g_vectorZero.x; - sourceRef._velocity.y = g_vectorZero.y; -LAB_006ae59a: - sourceRef._flags = 0; - if (sourceRef._entity != (void *)0x0) goto LAB_006ae5a0; - sourceRef._flags = 0; -LAB_006ae5bc: - local_38 = 0; - if (sourceRef._entity != (void *)0x0) goto LAB_006ae5c8; - } - else { - while (*(void **)(GHIDRA_CAST(sourceRef._entity) + 0x3c8) != (void *)0x0) { - sourceRef._entity = *(void **)(GHIDRA_CAST(sourceRef._entity) + 0x3c8); - } - sourceRef._type = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x28)); - if (sourceRef._entity == (void *)0x0) goto LAB_006ae55a; - sourceRef._variant = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x2c)); - sourceRef._position.x = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x33c)); - sourceRef._position.y = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x340)); - sourceRef._spawnerType = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x34)); - sourceRef._spawnerVariant = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x38)); - sourceRef._velocity.x = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x360)); - sourceRef._velocity.y = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x364)); - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006ae59a; - sourceRef._flags = 1; -LAB_006ae5a0: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006ae5bc; - local_38 = 2; -LAB_006ae5c8: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x16c)) & 0x400000) != 0) { - refFlagReflected = 4; - goto LAB_006ae5e3; - } - } - refFlagReflected = 0; -LAB_006ae5e3: - sourceRef._flags = refFlagReflected | local_38 | sourceRef._flags; - (GHIDRA_CAST((&this->_entityRef2)))->EntityRef::operator_(&sourceRef); - cVar2 = FUN_006ae7a0(); - if (cVar2 != '\0') { - statusOwner->_bossStatusEffectCooldown = 0xf0; - } - CopyStatusEffects(statusOwner); - return; -} - -// 006ae630 -void Entity::RemoveStatusEffects() -{ - uint32_t *flagsHigh; - uint64_t oldFlags; - - (this->_colorParams)._end = (this->_colorParams)._begin; - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xdeffe01f; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - this->_freezeCountdown = 0; - this->_poisonCountdown = 0; - this->_slowingCountdown = 0; - this->_charmedCountdown = 0; - this->_confusionCountdown = 0; - this->_midasFreezeCountdown = 0; - this->_fearCountdown = 0; - this->_burnCountdown = 0; - this->_shrinkCountdown = 0; - SetSize(this,*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)), - (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); - oldFlags = this->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHigh = *flagsHigh & 0xfea27ffb; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(oldFlags); - this->_shrinkStatus2 = 1.0; - this->_bleedingCountdown = 0; - this->_bleedDamageAccumulator = 0.0; - this->_magnetizedCountdown = 0; - this->_baitedCountdown = 0; - this->_knockbackCountdown = 0; - this->_iceCountdown = 0; - this->_weaknessCountdown = 0; - this->_brimstoneMarkCountdown = 0; - this->_poisonTickDamage = 2.0; - this->_burnTickDamage = 2.0; - this->ResetColor(); - CopyStatusEffects(this); - return; -} - -// 006ae7d0 -void Entity::PreUpdate() -{ - (this->_prevPosition).x = (this->_pos).x; - (this->_prevPosition).y = (this->_pos).y; - (this->_prevVelocity).x = (this->_velocity).x; - (this->_prevVelocity).y = (this->_velocity).y; - return; -} - -// 006ae820 -void Entity::Update() -{ - void **ppvVar1; - code *pcVar2; - int64_t lVar3; - int64_t lVar4; - BitSet128 flags; - uint8_t bVar5; - char cVar6; - Vector *velocityDir; - int iVar7; - ColorMod *color; - ColorMod *from; - EntityRef *sourceRef; - Entity_Tear *pEVar8; - int *piVar9; - Entity *tmpEntity; - uint32_t uVar10; - uint32_t uVar11; - int **ppiVar12; - uint32_t uVar13; - int iVar14; - uint32_t *hitFlashColor; - int unusedArg; - void *pvVar15; - code *extraout_EDX; - float *pfVar16; - void *nextColorParam; - uint32_t flagsLo; - PlayerManager *playerManager; - bool bVar17; - float fVar18; - float newVelocityX; - Entity_Tear *pEVar19; - float fVar20; - uint8_t *pushStrength; - float fVar21; - uint64_t uVar22; - double dVar23; - uint8_t auStack_328 [8]; - ItemPool *local_320; - uint8_t local_319; - float *local_318; - float *local_314; - float *local_310; - float *pfStack_30c; - Entity_Tear *local_308; - float *local_304; - uint32_t uStack_300; - Entity *pEStack_2fc; - Game *pGStack_2f8; - float *pfStack_2f4; - int *apiStack_2f0 [2]; - Entity *self; - Vector *local_2e4; - int *apiStack_2e0 [2]; - Vector VStack_2d8; - uint32_t uStack_2d0; - Vector local_2c8; - uint32_t spawnVariant; - void *pvStack_2bc; - float *pfStack_2b8; - int hitSoundId; - uint32_t newTearFlagsLo; - uint64_t uStack_2ac; - uint32_t uStack_2a4; - float fatalDamage; - float local_290; - float local_28c; - float local_288; - float local_284; - float local_280; - float local_27c; - float fStack_278; - float fStack_274; - float fStack_270; - uint32_t *targetSlot; - int triggerKeyType; - int triggerKeyVariant; - int anyVariantKey [2]; - Vector particleVelocity; - uint8_t auStack_250 [4]; - uint8_t auStack_24c [8]; - float fStack_244; - Color blendedColor; - Vector normalizedVelocity; - KColor debugTextColor; - uint8_t local_1f8 [60]; - EntityRef burnSourceRef; - EntityRef bleedSourceRef; - ColorMod lerpedColor; - Color defaultColor; - RNG cardRng; - uint32_t hitColor; - uint32_t uStack_ec; - uint32_t uStack_e8; - uint32_t uStack_e4; - uint32_t uStack_e0; - uint32_t uStack_dc; - uint32_t uStack_d8; - uint32_t uStack_d4; - uint32_t uStack_d0; - uint32_t uStack_cc; - uint32_t uStack_c8; - uint32_t hushBeastHitColor; - uint32_t uStack_c0; - uint32_t uStack_bc; - uint32_t uStack_b8; - uint32_t uStack_b4; - uint32_t uStack_b0; - uint32_t uStack_ac; - uint32_t uStack_a8; - uint32_t uStack_a4; - uint32_t uStack_a0; - uint32_t uStack_9c; - uint32_t poisonColor; - uint32_t uStack_94; - uint32_t uStack_90; - uint32_t uStack_8c; - uint32_t uStack_88; - uint32_t uStack_84; - uint32_t uStack_80; - uint32_t uStack_7c; - uint32_t uStack_78; - uint32_t uStack_74; - uint32_t uStack_70; - uint32_t burnColor; - uint32_t uStack_68; - uint32_t uStack_64; - uint32_t uStack_60; - uint32_t uStack_5c; - uint32_t uStack_58; - uint32_t uStack_54; - uint32_t uStack_50; - uint32_t uStack_4c; - uint32_t uStack_48; - uint32_t uStack_44; - ColorMod bleedFlashColor; - uint32_t local_14; - void *colorParamsEnd; - uint32_t *flagsHiPtr; - Game *game; - Manager *manager; - uint64_t oldFlags; - std_set *spawnTriggerTargets; - - local_14 = __security_cookie ^ GHIDRA_UINT(auStack_328); - local_320 = *GHIDRA_CAST(&this->_flags); - uVar13 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - self = this; - if ((GHIDRA_UINT(local_320) & 0x4000) == 0) { - this->_prevUpdateTime = this->_updateTime; - this->_updateTime = this->_speedMultiplier + this->_updateTime; - if (((((GHIDRA_UINT(local_320) & 0x20) == 0) && (this->_holdCountdown < 1)) || (this->_dead != 0)) && - ((uVar13 & 1) == 0)) { - local_310 = GHIDRA_CAST((this->_sprite)._playbackSpeed); - (this->_sprite)._playbackSpeed = (float)local_310 * this->_speedMultiplier; - if ((this->_sprite)._loaded != 0) { - AnimationState::Update(&(this->_sprite)._animState); - AnimationState::Update(&(this->_sprite)._overlayAnimState); - local_320 = *GHIDRA_CAST(&this->_flags); - uVar13 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - } - (this->_sprite)._playbackSpeed = (float)local_310; - } - } - if ((uVar13 & 0x8000) != 0) { - local_319 = this->_collidesWithGrid; - if (local_319 == 0) { - local_2e4 = GHIDRA_CAST((this->_velocity).x); - local_304 = GHIDRA_CAST((this->_velocity).y); - local_310 = GHIDRA_CAST(sqrtf((float)local_2e4 * (float)local_2e4 + - (float)local_304 * (float)local_304)); - fVar18 = (this->_knockbackDirection).x; - fVar20 = (this->_knockbackDirection).y; - fVar18 = sqrtf(fVar18 * fVar18 + fVar20 * fVar20); - if (((float)local_310 < fVar18) || - (0.0 <= (this->_knockbackDirection).x * (float)local_2e4 + - (this->_knockbackDirection).y * (float)local_304)) goto LAB_006ae9c3; - } - else { -LAB_006ae9c3: - local_310 = GHIDRA_CAST((this->_knockbackDirection).x); - fVar18 = (this->_knockbackDirection).y; - fVar18 = sqrtf((float)local_310 * (float)local_310 + fVar18 * fVar18); - if (2.0 <= fVar18) { - this->_friction = this->_baseFriction * 0.95; - if ((uVar13 & 0x20000) == 0) { - (this->_knockbackDirection).x = (float)local_310 * 0.95; - local_308 = GHIDRA_CAST(((this->_knockbackDirection).y * 0.95)); - (this->_knockbackDirection).y = (float)local_308; - bVar5 = this->_collidesWithGrid; - local_2c8.x = *GHIDRA_CAST(&this->_flags); - uVar13 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - } - else { - local_308 = GHIDRA_CAST((this->_knockbackDirection).y); - local_2c8.x = (float)local_320; - bVar5 = local_319; - } - if (bVar5 != 0) { - if ((uVar13 & 0x10000) != 0) { - velocityDir = (GHIDRA_CAST((&this->_velocity)))->Vector::Normalized(&normalizedVelocity); - fVar18 = (this->_knockbackDirection).x; - fVar20 = sqrtf((float)local_308 * (float)local_308 + fVar18 * fVar18); - fVar18 = velocityDir->y; - (this->_knockbackDirection).x = fVar20 * velocityDir->x * 0.8; - (this->_knockbackDirection).y = fVar20 * fVar18 * 0.8; - iVar7 = _get_index_plus_one_if_kind_4_5(); - fVar18 = (float)(iVar7 + -1) + (float)(iVar7 + -1) + 10.0; - sourceRef = (GHIDRA_CAST((GHIDRA_CAST(local_1f8))))->EntityRef::EntityRef(); - (*extraout_EDX)(fVar18,0,0,sourceRef,0x1e); - oldFlags = this->_flags; - flagsHiPtr = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHiPtr = *flagsHiPtr & 0xfffeffff; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(oldFlags); - } - this->_knockbackCountdown = this->_knockbackCountdown / 2; - } - (this->_velocity).x = (this->_knockbackDirection).x; - (this->_velocity).y = (this->_knockbackDirection).y; - goto LAB_006aeb95; - } - } - *GHIDRA_CAST(&this->_flags) = local_320; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar13 & 0xfffe7fff; - this->_knockbackCountdown = 0; - } -LAB_006aeb95: - fVar18 = this->_speedMultiplier; - fVar21 = 1.0; - fVar20 = this->_friction; - if (fVar18 != 1.0) { - fVar20 = fVar20 / ((fVar20 + fVar18) - fVar20 * fVar18); - } - local_2e4 = &this->_pos; - newVelocityX = fVar20 * (this->_velocity).x; - fVar20 = fVar20 * (this->_velocity).y; - (this->_velocity).x = newVelocityX; - (this->_velocity).y = fVar20; - fVar18 = this->_speedMultiplier; - (this->_pos).y = fVar18 * fVar20 + (this->_pos).y; - local_2e4->x = fVar18 * newVelocityX + local_2e4->x; - local_318 = *GHIDRA_CAST(&this->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - this->_friction = this->_baseFriction; - if ((GHIDRA_UINT(local_318) & 0x4000) == 0) { - pvVar15 = (this->_colorParams)._begin; - bVar17 = false; - if (pvVar15 != (this->_colorParams)._end) { - do { - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x34)) + -1; - *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x34)) = iVar7; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x38)) != '\0') { - bVar17 = true; - } - nextColorParam = (void *)(GHIDRA_INT(pvVar15) + 0x3c); - if (iVar7 == 0) { - FUN_004b6ec0(pvVar15); - bVar17 = true; - ppvVar1 = &(this->_colorParams)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + -0x3c); - nextColorParam = pvVar15; - } - colorParamsEnd = (this->_colorParams)._end; - pvVar15 = nextColorParam; - } while (nextColorParam != colorParamsEnd); - if (bVar17) { - pvVar15 = (this->_colorParams)._begin; - iVar14 = GHIDRA_INT(colorParamsEnd) - GHIDRA_INT(pvVar15); - iVar7 = iVar14 >> 0x1f; - iVar14 = iVar14 / 0x3c + iVar7; - if (iVar14 == iVar7) { - this->ResetColor(); - } - else { - color = GHIDRA_CAST((GHIDRA_INT(pvVar15) + 0x40)); - if (GHIDRA_UINT((iVar14 - iVar7)) < 2) { - color = &this->_color; - } - blendedColor._tint[0] = (GHIDRA_CAST((GHIDRA_INT(pvVar15) + 4)))->_tint[0]; - blendedColor._tint[1] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 8)); - blendedColor._tint[2] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0xc)); - blendedColor._tint[3] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x10)); - blendedColor._offset[2] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x2c)); - blendedColor._colorize[0] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x14)); - blendedColor._colorize[1] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x18)); - blendedColor._colorize[2] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x1c)); - blendedColor._colorize[3] = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x20)); - (*GHIDRA_CAST((GHIDRA_CAST(&(blendedColor._offset)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x24)); - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x38)) != '\0') { - color = ::Color::Lerp(&lerpedColor,GHIDRA_CAST((GHIDRA_INT(pvVar15) + 4)),color, - fVar21 - (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x34)) / - (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x30))); - ::(GHIDRA_CAST((&blendedColor)))->Color::operator_assign(color); - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&blendedColor)); - } - } - } - flagsLo = *GHIDRA_CAST(&this->_flags); - local_318 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - pfVar16 = local_318; - if (((flagsLo & 1) == 0) && - (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (this->_type == 1)) || - (this->_type - 10U < 0x3de)))) { - bVar5 = Game::IsInTimedSet(g_game,0x11); - if ((bVar5 != 0) || (bVar5 = Game::IsInTimedSet(g_game,0x15), bVar5 != 0)) { - flagsLo = flagsLo | 0x100; - this->_charmedCountdown = 2; - *GHIDRA_CAST(&this->_flags) = flagsLo; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = local_318; - } - local_310 = GHIDRA_CAST(flagsLo); - local_304 = local_318; - bVar5 = Game::IsInTimedSet(g_game,0x12); - if (bVar5 != 0) { - flagsLo = flagsLo | 0x200; - this->_confusionCountdown = 2; - local_318 = local_304; - *GHIDRA_CAST(&this->_flags) = flagsLo; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = local_304; - } - local_310 = GHIDRA_CAST(flagsLo); - local_304 = local_318; - bVar5 = Game::IsInTimedSet(g_game,0x13); - if ((bVar5 == 0) && (bVar5 = Game::IsInTimedSet(g_game,0x15), bVar5 == 0)) { - bVar5 = Game::IsInTimedSet(g_game,0x14); - pfVar16 = local_318; - if ((bVar5 == 0) || (((g_game->_frameCount - this->_spawnFrame) / 0x3c & 1U) != 0)) - goto LAB_006aeed2; - } - flagsLo = GHIDRA_UINT(local_310) | 0x800; - this->_fearCountdown = 2; - *GHIDRA_CAST(&this->_flags) = flagsLo; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = local_304; - pfVar16 = local_304; - } -LAB_006aeed2: - if (0 < this->_fireDamageCountdown) { - this->_fireDamageCountdown = this->_fireDamageCountdown + -1; - } - if (0 < this->_damageCountdown) { - this->_damageCountdown = this->_damageCountdown + -1; - } - if ((0 < this->_freezeCountdown) && - (iVar7 = this->_freezeCountdown + -1, this->_freezeCountdown = iVar7, iVar7 < 1)) { - flagsLo = flagsLo & 0xffffffdf; - *GHIDRA_CAST(&this->_flags) = flagsLo; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - if ((0 < this->_poisonCountdown) && - (iVar7 = this->_poisonCountdown + -1, this->_poisonCountdown = iVar7, iVar7 < 1)) { - flagsLo = flagsLo & 0xffffffbf; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - *GHIDRA_CAST(&this->_flags) = flagsLo; - this->_poisonTickDamage = 2.0; - } - if ((0 < this->_slowingCountdown) && - (iVar7 = this->_slowingCountdown + -1, this->_slowingCountdown = iVar7, iVar7 < 1)) { - flagsLo = flagsLo & 0xffffff7f; - *GHIDRA_CAST(&this->_flags) = flagsLo; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - local_314 = pfVar16; - if ((0 < this->_charmedCountdown) && - (iVar7 = this->_charmedCountdown + -1, this->_charmedCountdown = iVar7, iVar7 < 1)) { - iVar7 = this->_target; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - flagsLo = flagsLo & 0xfffffeff; - *GHIDRA_CAST(&this->_flags) = flagsLo; - if (iVar7 != 0) { - local_320 = GHIDRA_CAST(pfVar16); - targetSlot = &this->_target; - msvc::multiset::erase(&targetSlot); - flagsLo = *GHIDRA_CAST(&this->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - this->_target = 0; - } - } - if ((0 < this->_confusionCountdown) && - (iVar7 = this->_confusionCountdown + -1, this->_confusionCountdown = iVar7, iVar7 < 1)) { - flagsLo = flagsLo & 0xfffffdff; - *GHIDRA_CAST(&this->_flags) = flagsLo; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - if ((0 < this->_fearCountdown) && - (iVar7 = this->_fearCountdown + -1, this->_fearCountdown = iVar7, iVar7 < 1)) { - flagsLo = flagsLo & 0xfffff7ff; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - *GHIDRA_CAST(&this->_flags) = flagsLo; - } - fVar18 = this->_shrinkStatus1; - if (this->_shrinkStatus2 != fVar18) { - this->_shrinkStatus1 = (this->_shrinkStatus2 - fVar18) * 5.0 * 0.033333335 + fVar18; - } - local_320 = GHIDRA_CAST(pfVar16); - if ((0 < this->_shrinkCountdown) && - (iVar7 = this->_shrinkCountdown + -1, this->_shrinkCountdown = iVar7, iVar7 < 1)) { - FUN_006b5f40(); - flagsLo = *GHIDRA_CAST(&this->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - } - if (0 < this->_burnCountdown) { - iVar7 = this->_burnCountdown + -1; - this->_burnCountdown = iVar7; - if (iVar7 < 1) { - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - *GHIDRA_CAST(&this->_flags) = flagsLo & 0xffffefff; - this->_burnTickDamage = 2.0; - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80a98) && - (_Init_thread_header(&DAT_00c80a98), DAT_00c80a98 == -1)) { - _DAT_00c80ac0 = 0; - _DAT_00c80ab0 = 0; - uRam00c80ab4 = 0; - uRam00c80ab8 = 0; - uRam00c80abc = 0; - _DAT_00c80aa0 = 0x3f800000; - uRam00c80aa4 = 0x3f800000; - uRam00c80aa8 = 0x3f800000; - uRam00c80aac = 0x3f800000; - _DAT_00c80ac4 = 0; - _DAT_00c80ac8 = 0; - _DAT_00c80adc = 0; - uRam00c80ae0 = 0; - uRam00c80ae4 = 0; - uRam00c80ae8 = 0; - _DAT_00c80aec = 0x3e34b4b5; - _DAT_00c80acc = 0x3f800000; - uRam00c80ad0 = 0x3f800000; - uRam00c80ad4 = 0x3f4dcdcf; - uRam00c80ad8 = 0x3f800000; - _DAT_00c80af0 = 0; - _DAT_00c80af4 = 0; - _DAT_00c80b08 = 0; - uRam00c80b0c = 0; - uRam00c80b10 = 0; - uRam00c80b14 = 0; - _DAT_00c80b18 = 0x3eb4b4b5; - _DAT_00c80af8 = 0x3f800000; - uRam00c80afc = 0x3f800000; - uRam00c80b00 = 0x3f1b9b9c; - uRam00c80b04 = 0x3f800000; - _DAT_00c80b1c = 0; - _DAT_00c80b20 = 0; - _DAT_00c80b34 = 0; - uRam00c80b38 = 0; - uRam00c80b3c = 0; - uRam00c80b40 = 0; - _DAT_00c80b44 = 0x3e8c8c8d; - _DAT_00c80b24 = 0x3f800000; - uRam00c80b28 = 0x3f800000; - uRam00c80b2c = 0x3f4dcdcf; - uRam00c80b30 = 0x3f800000; - _DAT_00c80b48 = 0x3dc8c8ca; - _DAT_00c80b4c = 0; - _DAT_00c80b60 = 0; - uRam00c80b64 = 0; - uRam00c80b68 = 0; - uRam00c80b6c = 0; - _DAT_00c80b70 = 0x3e48c8ca; - _DAT_00c80b50 = 0x3f800000; - uRam00c80b54 = 0x3f800000; - uRam00c80b58 = 0x3f800000; - uRam00c80b5c = 0x3f800000; - _DAT_00c80b74 = 0x3e48c8ca; - _DAT_00c80b78 = 0; - _DAT_00c80b8c = 0; - uRam00c80b90 = 0; - uRam00c80b94 = 0; - uRam00c80b98 = 0; - _DAT_00c80b9c = 0x3dc8c8ca; - _DAT_00c80b7c = 0x3f800000; - uRam00c80b80 = 0x3f800000; - uRam00c80b84 = 0x3f800000; - uRam00c80b88 = 0x3f800000; - _DAT_00c80ba0 = 0x3dc8c8ca; - _DAT_00c80ba4 = 0; - _Init_thread_footer(&DAT_00c80a98); - } - (**(code **)(*GHIDRA_CAST(this) + 0x3c)) - (&DAT_00c80aa0 + ((g_game->_frameCount - this->_spawnFrame) % 6) * 0x2c,1,0xff,0,1); - flagsLo = *GHIDRA_CAST(&this->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - } - if ((this->_midasFreezeCountdown < 1) || - (iVar7 = this->_midasFreezeCountdown + -1, this->_midasFreezeCountdown = iVar7, 0 < iVar7)) { - pfStack_30c = GHIDRA_CAST(flagsLo); - } - else { - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - *GHIDRA_CAST(&this->_flags) = GHIDRA_CAST((flagsLo & 0xfffffbff)); - pfStack_30c = GHIDRA_CAST((flagsLo & 0xfffffbff)); - } - local_314 = GHIDRA_CAST(flagsLo); - if (0 < this->_bleedingCountdown) { - iVar7 = this->_bleedingCountdown + -1; - this->_bleedingCountdown = iVar7; - if (iVar7 < 1) { - *GHIDRA_CAST(&this->_flags) = pfStack_30c; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = GHIDRA_UINT(pfVar16) & 0xfffffffb; - this->_bleedDamageAccumulator = 0.0; - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80ba8) && - (_Init_thread_header(&DAT_00c80ba8), DAT_00c80ba8 == -1)) { - _DAT_00c80bd0 = 0; - _DAT_00c80bc0 = 0; - uRam00c80bc4 = 0; - uRam00c80bc8 = 0; - uRam00c80bcc = 0; - _DAT_00c80bb0 = 0x3f800000; - uRam00c80bb4 = 0x3f800000; - uRam00c80bb8 = 0x3f800000; - uRam00c80bbc = 0x3f800000; - _DAT_00c80bd4 = 0; - _DAT_00c80bd8 = 0; - _DAT_00c80bec = 0; - uRam00c80bf0 = 0; - uRam00c80bf4 = 0; - uRam00c80bf8 = 0; - _DAT_00c80bfc = 0x3e34b4b5; - _DAT_00c80bdc = 0x3f800000; - uRam00c80be0 = 0x3f3ebebf; - uRam00c80be4 = 0x3f3ebebf; - uRam00c80be8 = 0x3f800000; - _DAT_00c80c00 = 0; - _DAT_00c80c04 = 0; - _DAT_00c80c18 = 0; - uRam00c80c1c = 0; - uRam00c80c20 = 0; - uRam00c80c24 = 0; - _DAT_00c80c28 = 0x3eb4b4b5; - _DAT_00c80c08 = 0x3f800000; - uRam00c80c0c = 0x3ef0f0f2; - uRam00c80c10 = 0x3ef0f0f2; - uRam00c80c14 = 0x3f800000; - _DAT_00c80c2c = 0; - _DAT_00c80c30 = 0; - _DAT_00c80c44 = 0; - uRam00c80c48 = 0; - uRam00c80c4c = 0; - uRam00c80c50 = 0; - _DAT_00c80c54 = 0x3e20a0a1; - _DAT_00c80c34 = 0x3f5cdcde; - uRam00c80c38 = 0x3e70f0f2; - uRam00c80c3c = 0x3e70f0f2; - uRam00c80c40 = 0x3f800000; - _DAT_00c80c58 = 0; - _DAT_00c80c5c = 0; - _DAT_00c80c70 = 0; - uRam00c80c74 = 0; - uRam00c80c78 = 0; - uRam00c80c7c = 0; - _DAT_00c80c80 = 0; - _DAT_00c80c60 = 0x3f70f0f2; - uRam00c80c64 = 0x3f48c8ca; - uRam00c80c68 = 0x3f48c8ca; - uRam00c80c6c = 0x3f800000; - _DAT_00c80c84 = 0; - _DAT_00c80c88 = 0; - _DAT_00c80c9c = 0; - uRam00c80ca0 = 0; - uRam00c80ca4 = 0; - uRam00c80ca8 = 0; - _DAT_00c80cac = 0x3e8c8c8d; - _DAT_00c80c8c = 0x3f800000; - uRam00c80c90 = 0x3f4dcdcf; - uRam00c80c94 = 0x3f4dcdcf; - uRam00c80c98 = 0x3f800000; - _DAT_00c80cb0 = 0; - _DAT_00c80cb4 = 0; - _Init_thread_footer(&DAT_00c80ba8); - } - fVar18 = (this->_pos).y - (this->_prevPosition).y; - fVar20 = (this->_pos).x - (this->_prevPosition).x; - fVar18 = sqrtf(fVar18 * fVar18 + fVar20 * fVar20); - fVar18 = (fVar18 * 0.02) / this->_speedMultiplier; - if (fVar18 <= 0.0) { - fVar18 = 0.0; - } - if (1.0 <= fVar18) { - fVar18 = 1.0; - } - color = (ColorMod *) - (&DAT_00c80bb0 + (GHIDRA_UINT((g_game->_frameCount - this->_spawnFrame)) % 6) * 0x2c); - ::(GHIDRA_CAST((&defaultColor)))->Color::Color(); - color = ::Color::Lerp(&bleedFlashColor,from,color,fVar18); - this->SetColor(color,1,0xff,0,1); - pfStack_30c = *GHIDRA_CAST(&this->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - } - if ((0 < this->_magnetizedCountdown) && - (iVar7 = this->_magnetizedCountdown + -1, this->_magnetizedCountdown = iVar7, iVar7 < 1)) { - pfVar16 = GHIDRA_CAST((GHIDRA_UINT(pfVar16) & 0xfff7ffff)); - *GHIDRA_CAST(&this->_flags) = pfStack_30c; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - local_320 = GHIDRA_CAST(pfStack_30c); - if ((0 < this->_baitedCountdown) && - (iVar7 = this->_baitedCountdown + -1, this->_baitedCountdown = iVar7, iVar7 < 1)) { - pfVar16 = GHIDRA_CAST((GHIDRA_UINT(pfVar16) & 0xffefffff)); - *GHIDRA_CAST(&this->_flags) = pfStack_30c; - game = g_game; - fVar18 = 0.0; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - local_304 = game->_room; - if (local_304[0x499] != 0.0) { - do { - iVar7 = *GHIDRA_CAST((GHIDRA_INT(local_304[0x497]) + GHIDRA_INT(fVar18) * 4)); - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((iVar7 + 0x28)) == 1)) || - (*GHIDRA_CAST((iVar7 + 0x28)) - 10U < 0x3de)) { - local_310 = GHIDRA_CAST((iVar7 + 0x3c4)); - if ((*GHIDRA_CAST((iVar7 + 0x3c4)) == this) && - ((*GHIDRA_CAST((iVar7 + 0x168)) & 0x20000100) == 0)) { - if (*GHIDRA_CAST((iVar7 + 0x3c4)) != GHIDRA_CAST(0x0)) { - pvStack_2bc = (void *)(iVar7 + 0x3c4); - msvc::multiset::erase(&pvStack_2bc); - } - *local_310 = 0.0; - } - } - fVar18 = (float)(GHIDRA_INT(fVar18) + 1); - } while (GHIDRA_UINT(fVar18) < GHIDRA_UINT(local_304[0x499])); - local_320 = *GHIDRA_CAST(&this->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - } - } - if ((0 < this->_weaknessCountdown) && - (iVar7 = this->_weaknessCountdown + -1, this->_weaknessCountdown = iVar7, iVar7 < 1)) { - pfVar16 = GHIDRA_CAST((GHIDRA_UINT(pfVar16) & 0xffbfffff)); - *GHIDRA_CAST(&this->_flags) = local_320; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - local_2c8.x = (float)local_320; - if ((this->_iceFrozenEffect != 0) && ((GHIDRA_UINT(pfVar16) & 0x80000) == 0)) { - (**(code **)(*GHIDRA_CAST(this->_iceFrozenEffect) + 0x28))(); - local_320 = *GHIDRA_CAST(&this->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - } - if ((0 < this->_knockbackCountdown) && - (iVar7 = this->_knockbackCountdown + -1, this->_knockbackCountdown = iVar7, iVar7 < 1)) { - pfVar16 = GHIDRA_CAST((GHIDRA_UINT(pfVar16) & 0xfffe7fff)); - *GHIDRA_CAST(&this->_flags) = local_320; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - if ((0 < this->_iceCountdown) && - (iVar7 = this->_iceCountdown + -1, this->_iceCountdown = iVar7, iVar7 < 1)) { - pfVar16 = GHIDRA_CAST((GHIDRA_UINT(pfVar16) & 0xfffbffff)); - *GHIDRA_CAST(&this->_flags) = local_320; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - if ((0 < this->_brimstoneMarkCountdown) && - (iVar7 = this->_brimstoneMarkCountdown + -1, this->_brimstoneMarkCountdown = iVar7, iVar7 < 1 - )) { - pfVar16 = GHIDRA_CAST((GHIDRA_UINT(pfVar16) & 0xfeffffff)); - *GHIDRA_CAST(&this->_flags) = local_320; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = pfVar16; - } - if (0 < this->_bossStatusEffectCooldown) { - this->_bossStatusEffectCooldown = this->_bossStatusEffectCooldown + -1; - } - local_318 = GHIDRA_CAST(local_320); - local_314 = GHIDRA_CAST(local_320); - if (0 < this->_holdCountdown) { - this->_holdCountdown = this->_holdCountdown + -1; - } - } - if ((GHIDRA_UINT(local_318) & 0x4000) == 0) { - if (this->_isInvicible == 0) { - pfVar16 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - local_319 = 0; - local_284 = g_vectorZero.x; - local_280 = g_vectorZero.y; - local_27c = g_vectorZero.x; - fStack_278 = g_vectorZero.y; - fatalDamage = 0.0; - local_290 = fatalDamage; - local_28c = fatalDamage; - local_288 = fatalDamage; - fStack_274 = fatalDamage; - fStack_270 = fatalDamage; - if (pfVar16 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))) { - local_320 = GHIDRA_CAST((pfVar16 + 0xb)); - do { - if (0.0 < *pfVar16) { - if ((GHIDRA_UINT(g_game->_debugFlags) >> 6 & 1) != 0) { - (GHIDRA_CAST((&debugTextColor)))->KColor::SetFromARGB(0xff90ee90); - spawn_debug_damage_text(); - } - manager = g_manager; - local_2c8.y = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x20)); - if (((GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x24))) & 0x202) != 0) && - ((GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x24))) & 4) == 0)) { - hitSoundId = 0x2b; - seed_fart_sound_override(&hitSoundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(hitSoundId,1.0,2,0,1.0,0.0); - this = self; - } - fVar18 = (GHIDRA_CAST(this))->_health - *pfVar16; - (GHIDRA_CAST(this))->_health = fVar18; - if ((0.0 < fVar18) || ((GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x24))) & 1) != 0)) { - if (((GHIDRA_CAST(this))->_flags & 0x2000000) == 0) { - if (fVar18 < 0.0) { - (GHIDRA_CAST(this))->_health = 0.0; - } - if (((GHIDRA_CAST(this))->_type == 0x197) || - ((GHIDRA_CAST(this))->_type == 0x3b7)) { - uStack_a4 = 0x3ec8c8ca; - uStack_b4 = 0; - uStack_b0 = 0; - uStack_ac = 0; - uStack_a8 = 0; - uStack_a0 = 0; - hushBeastHitColor = 0x3f000000; - uStack_c0 = 0x3f000000; - uStack_bc = 0x3ea8f5c3; - uStack_b8 = 0x3f800000; - uStack_9c = 0; - iVar7 = (GHIDRA_INT((*pfVar16 + 0.5)) + 2) / 3; - iVar14 = 6; - if (iVar7 < 6) { - iVar14 = iVar7; - } - if (iVar14 < 1) { - iVar14 = 1; - } - hitFlashColor = &hushBeastHitColor; - } - else { - uStack_d0 = 0x3f48c8ca; - uStack_e0 = 0; - uStack_dc = 0; - uStack_d8 = 0; - uStack_d4 = 0; - uStack_cc = 0; - hitColor = 0x3f000000; - uStack_ec = 0x3f000000; - uStack_e8 = 0x3f000000; - uStack_e4 = 0x3f800000; - uStack_c8 = 0; - iVar7 = (GHIDRA_INT((*pfVar16 + 0.5)) + 2) / 3; - iVar14 = 6; - if (iVar7 < 6) { - iVar14 = iVar7; - } - if (iVar14 < 1) { - iVar14 = 1; - } - hitFlashColor = &hitColor; - } - this->SetColor(hitFlashColor,iVar14,0,0,0); - } - } - else { - fatalDamage = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x1c)); - local_290 = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x18)); - local_28c = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x14)); - local_288 = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -0x10)); - local_284 = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -0xc)); - local_280 = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -8)); - local_27c = *GHIDRA_CAST((GHIDRA_CAST(local_320) + -4)); - fStack_278 = *GHIDRA_CAST(local_320); - fStack_274 = *GHIDRA_CAST((GHIDRA_CAST(local_320) + 4)); - fStack_270 = *GHIDRA_CAST((GHIDRA_CAST(local_320) + 8)); - local_319 = 1; - } - } - pfVar16 = pfVar16 + 0xe; - local_320 = GHIDRA_CAST((GHIDRA_INT(local_320) + 0x38)); - } while (pfVar16 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0xc))))); - if (local_319 != 0) { - this->Kill(&fatalDamage); - } - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0xc)))) = - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x8)))); - (GHIDRA_CAST(this))->_pendingDamage = 0.0; - *GHIDRA_CAST(&(GHIDRA_CAST(this))->_pendingDamageFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_pendingDamageFlags) + 4)) = 0; - local_318 = *GHIDRA_CAST(&(GHIDRA_CAST(this))->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_flags) + 4)); - } - if ((GHIDRA_UINT(local_318) & 0x4000) == 0) { - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && ((GHIDRA_CAST(this))->_type == 1)) || - ((GHIDRA_CAST(this))->_type - 10U < 0x3de)) { - local_308 = GHIDRA_CAST(&DAT_00000014); - if (((GHIDRA_UINT(local_318) & 0x40) != 0) && - (iVar7 = (GHIDRA_CAST(this))->_poisonDamageTimer, - (GHIDRA_CAST(this))->_poisonDamageTimer = iVar7 + 1, iVar7 % 0x14 == 1)) { - uStack_78 = 0; - uStack_88 = 0; - uStack_84 = 0; - uStack_80 = 0; - uStack_7c = 0; - poisonColor = 0x3dcccccd; - uStack_94 = 0x3f000000; - uStack_90 = 0x3dcccccd; - uStack_8c = 0x3f800000; - uStack_74 = 0x3f000000; - uStack_70 = 0; - this->SetColor(&poisonColor,2,0xff,0,1); - sourceRef = (GHIDRA_CAST((GHIDRA_CAST((local_1f8 + 0x14)))))->EntityRef::EntityRef(); - (**(code **)(*GHIDRA_CAST(this) + 0x20)) - ((GHIDRA_CAST(this))->_poisonTickDamage,0x8000,0,sourceRef); - local_318 = *GHIDRA_CAST(&(GHIDRA_CAST(this))->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_flags) + 4)); - } - VStack_2d8.x = (float)local_318; - if ((GHIDRA_UINT(local_318) & 0x1000) != 0) { - iVar7 = (GHIDRA_CAST(this))->_burnDamageTimer; - (GHIDRA_CAST(this))->_burnDamageTimer = iVar7 + 1; - if (iVar7 % GHIDRA_INT(local_308) == 1) { - uStack_4c = 0x3f000000; - uStack_5c = 0; - uStack_58 = 0; - uStack_54 = 0; - uStack_50 = 0; - burnColor = 0x3f000000; - uStack_68 = 0x3e99999a; - uStack_64 = 0x3dcccccd; - uStack_60 = 0x3f800000; - uStack_48 = 0x3e99999a; - uStack_44 = 0; - this->SetColor(&burnColor,2,0xff,0,1); - sourceRef = (GHIDRA_CAST((&burnSourceRef)))->EntityRef::EntityRef(); - (**(code **)(*GHIDRA_CAST(this) + 0x20)) - ((GHIDRA_CAST(this))->_burnTickDamage,0x8000,0,sourceRef); - VStack_2d8.x = *GHIDRA_CAST(&(GHIDRA_CAST(this))->_flags); - pfVar16 = *GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_flags) + 4)); - } - } - if (((GHIDRA_UINT(pfVar16) & 4) != 0) && - (bVar5 = IsDescendantOf(this,((GHIDRA_CAST(this))->_entityRef2)._entity), bVar5 == 0)) { - fVar18 = ((GHIDRA_CAST(this))->_pos).y - ((GHIDRA_CAST(this))->_prevPosition).y; - fVar20 = ((GHIDRA_CAST(this))->_pos).x - ((GHIDRA_CAST(this))->_prevPosition).x; - fVar18 = sqrtf(fVar18 * fVar18 + fVar20 * fVar20); - game = g_game; - local_310 = GHIDRA_CAST((fVar18 * (GHIDRA_CAST(this))->_speedMultiplier * 0.02 + - (GHIDRA_CAST(this))->_bleedDamageAccumulator)); - (GHIDRA_CAST(this))->_bleedDamageAccumulator = (float)local_310; - iVar7 = game->_stageType; - if ((iVar7 == 4) || (iVar7 == 5)) { - iVar7 = g_game->_stage + 1; - } - else { - iVar7 = game->_stage; - } - local_304 = GHIDRA_CAST(((float)iVar7 * 0.3 + 2.8)); - pfStack_2f4 = local_310; - dVar23 = floor((double)(float)local_310); - local_308 = GHIDRA_CAST((float)dVar23); - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - pfVar16 = local_304; - } - else { - pfVar16 = GHIDRA_CAST(0x3f800000); - } - pEVar19 = local_308; - if (10.0 <= (float)local_308) { - pEVar19 = GHIDRA_CAST(0x41200000); - } - (GHIDRA_CAST(this))->_bleedDamageAccumulator = (float)pfStack_2f4 - (float)local_308; - fVar18 = (float)pEVar19 * (float)pfVar16; - if (0.0 < fVar18) { - sourceRef = (GHIDRA_CAST((&bleedSourceRef)))->EntityRef::EntityRef(); - this->TakeDamage(fVar18,0,0,sourceRef,0x1e); - local_310 = GHIDRA_CAST(0x0); - if (0.0 < (float)local_308) { - do { - VStack_2d8.x = ((((GHIDRA_CAST(this))->_prevPosition).x - - ((GHIDRA_CAST(this))->_pos).x) * (float)local_310) / - (float)local_308 + ((GHIDRA_CAST(this))->_pos).x; - VStack_2d8.y = ((((GHIDRA_CAST(this))->_prevPosition).y - - ((GHIDRA_CAST(this))->_pos).y) * (float)local_310) / - (float)local_308 + ((GHIDRA_CAST(this))->_pos).y; - pfStack_2f4 = GHIDRA_CAST(Random()); - pGStack_2f8 = g_game; - local_318 = GHIDRA_CAST(0x0); - spawnVariant = 0x2e; - local_314 = GHIDRA_CAST(0x3e8); - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&local_314),GHIDRA_CAST(&spawnVariant),&VStack_2d8,&g_vectorZero, - GHIDRA_CAST(0x0),GHIDRA_CAST(&local_318),GHIDRA_CAST(&pfStack_2f4)); - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_006b0194: - local_320 = GHIDRA_CAST(local_318); - } - else { - pfStack_30c = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - uVar13 = Random(); - pfVar16 = local_318; - uStack_2ac = 0x900000005; - pEStack_2fc = GHIDRA_CAST(&DAT_00000007); - uStack_2a4 = 7; - uStack_300 = uVar13; - if (local_314 != GHIDRA_CAST(&DAT_00000005)) goto LAB_006b0194; - if (spawnVariant < 0x12d) { - if (spawnVariant == 300) { - while ((local_320 = GHIDRA_CAST(local_318), local_318 == GHIDRA_CAST(0x0) || - (cVar6 = (**(code **)(GHIDRA_INT(*pfStack_30c) + 0x24))(local_318), - cVar6 != '\0'))) { - if (uStack_300 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uStack_300 = uStack_300 >> ((uint8_t)uStack_2ac & 0x1f) ^ uStack_300; - uStack_300 = uStack_300 << ((uint8_t)((uint64_t)uStack_2ac >> 0x20) & 0x1f) ^ - uStack_300; - uVar13 = uStack_300 >> ((uint8_t)pEStack_2fc & 0x1f) ^ uStack_300; - uStack_300 = uVar13; - iVar7 = ItemPool::GetCardEx(uVar13,0x19,10,10,1); - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._shift3 = 7; - cardRng._seed = uVar13; - local_318 = GHIDRA_CAST(lua_callback_run_get_card(&cardRng,iVar7,1,1,0)); - } - } - else { - if (spawnVariant == 0x46) { - uStack_2d0 = GHIDRA_UINT(local_318) >> 0xb; - do { - if (local_318 != GHIDRA_CAST(0x0)) { - pcVar2 = *(code **)(GHIDRA_INT(*pfStack_30c) + 0x28); - local_320 = GHIDRA_CAST(local_318); - iVar7 = ItemPool::GetPillEffect - (&g_game->_itemPool,GHIDRA_UINT(local_318),GHIDRA_CAST(0x0) - ); - cVar6 = (*pcVar2)(iVar7); - if (cVar6 == '\0') goto LAB_006b019c; - uVar13 = uStack_300; - } - local_320 = &g_game->_itemPool; - if (uVar13 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar13 = uVar13 >> ((uint8_t)uStack_2ac & 0x1f) ^ uVar13; - uVar13 = uVar13 << ((uint8_t)((uint64_t)uStack_2ac >> 0x20) & 0x1f) ^ uVar13; - uVar13 = uVar13 >> ((uint8_t)pEStack_2fc & 0x1f) ^ uVar13; - uStack_300 = uVar13; - uVar10 = ItemPool::GetPill(uVar13); - local_318 = GHIDRA_CAST((uVar10 | (uStack_2d0 & 1) << 0xb)); - } while( true ); - } - if (spawnVariant != 100) goto LAB_006b0194; - local_320 = GHIDRA_CAST(local_318); - if (local_318 == GHIDRA_CAST(0x19)) { -LAB_006affca: - bVar17 = false; - } - else { - pfStack_2b8 = local_318; - msvc::set::find_node(auStack_24c,&pfStack_2b8); - if (((*GHIDRA_CAST((GHIDRA_CAST(fStack_244) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(fStack_244) + 0x10)) <= GHIDRA_INT(pfVar16))) && - (fStack_244 != pfStack_30c[8])) goto LAB_006affca; - bVar17 = true; - } - if ((pfVar16 == GHIDRA_CAST(0x0)) || (bVar17)) { - local_320 = GHIDRA_CAST((**(code **)(GHIDRA_INT(*pfStack_30c) + 0x84))(0)); - local_318 = GHIDRA_CAST(local_320); - } - } - } - else { - if (spawnVariant != 0x15e) goto LAB_006b0194; - while ((local_320 = GHIDRA_CAST(local_318), local_318 == GHIDRA_CAST(0x0) || - (cVar6 = (**(code **)(GHIDRA_INT(*pfStack_30c) + 0x2c))(local_318), cVar6 != '\0') - )) { - local_318 = GHIDRA_CAST(ItemPool)::GetTrinket(&g_game->_itemPool,0); - } - } - } -LAB_006b019c: - pEStack_2fc = (GHIDRA_CAST((pGStack_2f8->_entityFactory)))->EntityFactory::Create(GHIDRA_UINT(local_314),0); - lVar3 = CONCAT44(pGStack_2f8,pfStack_2f4); - if (pEStack_2fc == GHIDRA_CAST(0x0)) { - tmpEntity = GHIDRA_CAST(0x0); - } - else { - uVar22 = GetTimeNs(); - tmpEntity = pEStack_2fc; - uVar10 = GHIDRA_UINT((uVar22 >> 0x20)); - lVar3 = (uVar22 & 0xffffffff) * 0x431bde82; - apiStack_2f0[0] = GHIDRA_CAST(((uint64_t)lVar3 >> 0x20)); - uVar22 = (uint64_t)uVar10 * 0xd7b634db + - ((uVar22 & 0xffffffff) * 0xd7b634db >> 0x20); - uVar11 = GHIDRA_UINT((uVar22 >> 0x20)); - lVar3 = lVar3 + (uVar22 & 0xffffffff); - uStack_2d0 = GHIDRA_UINT(lVar3); - uVar13 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - lVar3 = (uint64_t)uVar10 * 0x431bde82 + - (uint64_t)CONCAT14(CARRY4(uVar11,uVar13),uVar11 + uVar13); - uVar13 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - uStack_300 = GHIDRA_UINT(lVar3) >> 0x12 | uVar13 * 0x4000; - pfStack_30c = GHIDRA_CAST((uVar13 >> 0x12)); - hitFlashColor = &pEStack_2fc->_spawnerEntity; - pEStack_2fc->_spawnerType = 0; - pEStack_2fc->_spawnerVariant = 0; - if (*hitFlashColor != 0) { - apiStack_2e0[0] = hitFlashColor; - msvc::multiset::erase(apiStack_2e0); - } - iVar7 = *GHIDRA_CAST(tmpEntity); - *hitFlashColor = 0; - (tmpEntity->_pos).x = VStack_2d8.x; - (tmpEntity->_pos).y = VStack_2d8.y; - (tmpEntity->_velocity).x = g_vectorZero.x; - (tmpEntity->_velocity).y = g_vectorZero.y; - (**(code **)(iVar7 + 4))(local_314,spawnVariant,local_320,pfStack_2f4); - pvVar15 = pGStack_2f8->_room; - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x1214)) = iVar7 + 1; - tmpEntity->_index = iVar7; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar15) + 0x1218)))))->EntityList::AddEntity(tmpEntity); - bVar5 = Game::ShouldEraseEnemy(tmpEntity); - if (bVar5 != 0) { - RemoveWithPoof(tmpEntity,unusedArg); - } - if ((tmpEntity->_exists != 0) && - ((pGStack_2f8->_proceduralItemManager)._proceduralItems._begin != - (pGStack_2f8->_proceduralItemManager)._proceduralItems._end)) { - triggerKeyVariant = tmpEntity->_variant; - iVar7 = tmpEntity->_type; - spawnTriggerTargets = &(pGStack_2f8->_proceduralItemManager)._spawnTriggerTargets; - triggerKeyType = iVar7; - msvc::map::find(&local_304,&triggerKeyType); - if (local_304 == spawnTriggerTargets->_head) { - anyVariantKey[1] = 0xffffffff; - anyVariantKey[0] = iVar7; - piVar9 = GHIDRA_CAST(std)::map::find(auStack_250,anyVariantKey); - local_304 = GHIDRA_CAST(*piVar9); - if (local_304 == spawnTriggerTargets->_head) goto LAB_006b0415; - } - uVar13 = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - pvVar15 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar15) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,(uint8_t *) - "PlayerManager::GetPlayer() : There are no players! \n" - ); - pvVar15 = (playerManager->_playerList)._end; - } - piVar9 = (playerManager->_playerList)._begin; - if (uVar13 < GHIDRA_UINT((GHIDRA_INT(pvVar15) - GHIDRA_INT(piVar9) >> 2))) { - piVar9 = piVar9 + uVar13; - } - trigger_set_dispatch - ((void *)(*piVar9 + 0x1fc8),6,pEStack_2fc,&VStack_2d8,&g_vectorZero) - ; - uVar13 = uVar13 + 1; - playerManager = &g_game->_playerManager; - } while (uVar13 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } -LAB_006b0415: - uVar22 = GetTimeNs(); - uVar13 = GHIDRA_UINT((uVar22 >> 0x20)); - lVar4 = (uVar22 & 0xffffffff) * 0x431bde82; - uStack_2d0 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - lVar3 = (uint64_t)uVar13 * 0x431bde82; - uVar22 = (uint64_t)uVar13 * 0xd7b634db + - ((uVar22 & 0xffffffff) * 0xd7b634db >> 0x20); - uVar10 = GHIDRA_UINT((uVar22 >> 0x20)); - lVar4 = lVar4 + (uVar22 & 0xffffffff); - apiStack_2f0[0] = GHIDRA_CAST(lVar4); - uVar13 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - lVar4 = lVar3 + (uint64_t)CONCAT14(CARRY4(uVar10,uVar13),uVar10 + uVar13); - uVar11 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - uVar13 = GHIDRA_UINT(lVar4) >> 0x12 | uVar11 * 0x4000; - uVar10 = uVar13 - uStack_300; - bVar17 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar10); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar10; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + - (((uVar11 >> 0x12) - GHIDRA_INT(pfStack_30c)) - GHIDRA_UINT((uVar13 < uStack_300))) + - GHIDRA_UINT(bVar17); - tmpEntity = pEStack_2fc; - this = self; - } - pGStack_2f8 = GHIDRA_CAST(((uint64_t)lVar3 >> 0x20)); - pfStack_2f4 = GHIDRA_CAST(lVar3); - uVar13 = GetHitListIndex(this); - sorted_vector_insert_unique(&tmpEntity[1]._sprite._overlayAnimState,uVar13); - uVar13 = Random(); - iVar7 = *GHIDRA_CAST(tmpEntity); - fVar20 = (float)((double)GHIDRA_INT(uVar13) + __uint_to_double_fixup[-(GHIDRA_INT(uVar13) >> 0x1f)]) - * 2.3283064e-10 * 0.5 + 0.2; - fVar18 = fVar20 * g_vectorOne.x; - (tmpEntity->_sprite)._scale.y = fVar20 * g_vectorOne.y; - (tmpEntity->_sprite)._scale.x = fVar18; - (**(code **)(iVar7 + 0xc))(); - uVar13 = Random(); - tmpEntity = Game::SpawnEx(g_game,1000,7,&VStack_2d8,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar13,0); - tmpEntity->Update(); - uVar13 = Random(); - uVar10 = Random(); - uVar11 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - apiStack_2f0[0] = GHIDRA_CAST((fVar18 + fVar18)); - particleVelocity.x = cos((float)apiStack_2f0[0]); - particleVelocity.x = particleVelocity.x * 5.0; - fVar18 = sin((float)apiStack_2f0[0]); - particleVelocity.y = fVar18 * 0.5 * 5.0; - uVar11 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - apiStack_2f0[0] = GHIDRA_CAST((fVar18 + fVar18)); - fVar18 = cos((float)apiStack_2f0[0]); - local_2c8.x = fVar18 * 0.5 * self->_size + local_2e4->x; - fVar18 = sin((float)apiStack_2f0[0]); - this = self; - local_2c8.y = fVar18 * 0.5 * self->_size + local_2e4->y; - tmpEntity = Game::SpawnEx(g_game,1000,5,&local_2c8,&particleVelocity,self,uVar10 % 3, - uVar13,0); - tmpEntity->Update(); - local_310 = GHIDRA_CAST(((float)local_310 + 1.0)); - } while ((float)local_310 < (float)local_308); - } - } - } - } - fVar18 = 1.0; - if (((GHIDRA_CAST(this))->_dead == 0) && - (((GHIDRA_CAST(this))->_flags & 0x8000000000000) != 0)) { - bVar5 = DoesEntityShareStatus(this); - if ((bVar5 != 0) && - (pEVar19 = GHIDRA_CAST((GHIDRA_CAST(this))->_parent), - GHIDRA_CAST((GHIDRA_CAST(this))->_parent) != GHIDRA_CAST(0x0))) { - do { - pEVar8 = pEVar19; - pEVar19 = GHIDRA_CAST(pEVar8->_parent); - } while (pEVar19 != GHIDRA_CAST(0x0)); - if (pEVar8 != GHIDRA_CAST(this)) goto LAB_006b0a5d; - } - local_304 = GHIDRA_CAST(0x0); - pvStack_2bc = g_game->_room; - pGStack_2f8 = GHIDRA_CAST(fVar18); - if (*GHIDRA_CAST((GHIDRA_CAST(pvStack_2bc) + 0x1264)) != 0) { - do { - pEVar19 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvStack_2bc) + 0x125c)) + GHIDRA_INT(local_304) * 4)); - local_308 = pEVar19; - bVar5 = DoesEntityShareStatus(GHIDRA_CAST(pEVar19)); - if (bVar5 != 0) { - pEVar8 = GHIDRA_CAST(pEVar19->_parent); - local_308 = pEVar19; - if (GHIDRA_CAST(pEVar19->_parent) != GHIDRA_CAST(0x0)) { - do { - local_308 = pEVar8; - pEVar8 = GHIDRA_CAST(local_308->_parent); - } while (GHIDRA_CAST(local_308->_parent) != GHIDRA_CAST(0x0)); - this = self; - } - } - pEVar8 = GHIDRA_CAST(GetStatusEffectTarget(this)); - if ((((pEVar8 != local_308) && - ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || - (bVar5 = IsDescendantOf(GHIDRA_CAST(pEVar19), - ((GHIDRA_CAST(this))->_entityRef3)._entity), bVar5 == 0))) - ) && ((bVar5 = IsVulnerableEnemy(GHIDRA_CAST(pEVar19),GHIDRA_CAST(0x0)), bVar5 != 0 || - ((((iVar7 = pEVar19->_type, iVar7 == 9 || (iVar7 == 2)) || (iVar7 == 4)) || - (((iVar7 == 5 && ((pEVar19->_tearHaloANM2)._numNullLayers == 0)) && - ((bVar5 = Entity_Pickup::IsChest(pEVar19->_variant), bVar5 == 0 || - (pEVar19->_subtype != 0)))))))))) && (pEVar19 != GHIDRA_CAST(this))) { - fVar18 = (pEVar19->_pos).x; - fVar20 = ((GHIDRA_CAST(this))->_pos).x; - if (((fVar18 != fVar20) || ((pEVar19->_pos).y != ((GHIDRA_CAST(this))->_pos).y)) && - (pEVar19->_friction != 0.0)) { - local_308 = GHIDRA_CAST((fVar20 - fVar18)); - pEStack_2fc = GHIDRA_CAST((((GHIDRA_CAST(this))->_pos).y - (pEVar19->_pos).y)); - local_2e4 = (Vector *) - ((float)pEStack_2fc * (float)pEStack_2fc + - (float)local_308 * (float)local_308); - if ((float)local_2e4 < 65536.0) { - local_310 = GHIDRA_CAST(sqrtf((float)local_2e4)); - fVar18 = sqrtf((float)local_2e4); - tmpEntity = self; - if (0.0 < fVar18) { - local_308 = GHIDRA_CAST(((float)local_308 * (1.0 / fVar18))); - pEStack_2fc = GHIDRA_CAST(((float)pEStack_2fc * (1.0 / fVar18))); - } - pushStrength = &DAT_42000000; - iVar7 = pEVar19->_type; - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar7 == 1)) || - (iVar7 - 10U < 0x3de)) || ((iVar7 == 2 || (iVar7 == 4)))) { - pushStrength = GHIDRA_CAST(0x42a00000); - } - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar7 == 1)) || - ((iVar7 - 10U < 0x3de || (iVar7 == 4)))) && - ((float)local_310 < pEVar19->_size + (GHIDRA_CAST(this))->_size + 16.0)) { - pGStack_2f8 = GHIDRA_CAST(((float)pGStack_2f8 * 0.8)); - } - if (8.0 <= (float)local_310) { - fVar18 = 1.0 / (float)local_310; - } - else { - fVar18 = (float)local_310 * 0.015625; - } - if (iVar7 == 9) { - apiStack_2f0[0] = GHIDRA_CAST(0x3f000000); - fVar20 = (float)(g_game->_frameCount - pEVar19->_spawnFrame) / 30.0; - if (1.0 <= fVar20) { - fVar20 = 1.0; - } - fVar20 = fVar20 * fVar18; - pfVar16 = GHIDRA_CAST((((float)pushStrength * fVar20) / pEVar19->_friction)); - apiStack_2e0[0] = GHIDRA_CAST((1.0 - (fVar20 + fVar20))); - ppiVar12 = apiStack_2e0; - if ((float)apiStack_2e0[0] <= 0.5) { - ppiVar12 = apiStack_2f0; - } - piVar9 = *ppiVar12; - (pEVar19->_velocity).y = (float)piVar9 * (pEVar19->_velocity).y; - (pEVar19->_velocity).x = (float)piVar9 * (pEVar19->_velocity).x; - if ((0.3 < fVar20) && - (pEVar19->_fallingAccel <= 0.0 && pEVar19->_fallingAccel != 0.0)) { - pEVar19->_fallingAccel = 0.0; - } - if ((((pEVar19->_dead == 0) && - ((float)local_2e4 < - (GHIDRA_CAST(this))->_size * (GHIDRA_CAST(this))->_size)) && - (0xf < g_game->_frameCount - pEVar19->_spawnFrame)) && - (-50.0 < pEVar19->_height)) { - pEVar19->_dead = 1; - } - } - else { - local_314 = GHIDRA_CAST((((float)pushStrength * fVar18) / pEVar19->_friction)); - if (iVar7 == 2) { - apiStack_2f0[0] = GHIDRA_CAST(0x3f000000); - apiStack_2e0[0] = GHIDRA_CAST((1.0 - (fVar18 + fVar18))); - ppiVar12 = apiStack_2e0; - if ((float)apiStack_2e0[0] <= 0.5) { - ppiVar12 = apiStack_2f0; - } - fVar18 = (float)*ppiVar12 * (pEVar19->_velocity).y; - fVar20 = (float)*ppiVar12 * (pEVar19->_velocity).x; - (pEVar19->_velocity).y = fVar18; - (pEVar19->_velocity).x = fVar20; - local_320 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(g_tearFlagOrbit._l))) + 0x4))); - apiStack_2e0[0] = - GHIDRA_CAST((GHIDRA_UINT((pEVar19->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagOrbit._h))); - apiStack_2f0[0] = - GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(&(pEVar19->_tearFlags)._h) + 4)) & - (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagOrbit._h))) + 0x4))))); - pfStack_2b8 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._h)) + 0x4))); - uStack_2d0 = GHIDRA_UINT(g_tearFlagOrbit._l); - this = tmpEntity; - if ((((GHIDRA_UINT((pEVar19->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagOrbit._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(pEVar19->_tearFlags)._l) + 4)) & - (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagOrbit._l))) + 0x4)))) != 0) || - (apiStack_2e0[0] != GHIDRA_CAST(0x0) || apiStack_2f0[0] != GHIDRA_CAST(0x0))) && - (fVar18 * fVar18 + fVar20 * fVar20 < 1.0)) { - newTearFlagsLo = ~GHIDRA_UINT(g_tearFlagOrbit._l) & GHIDRA_UINT((pEVar19->_tearFlags)._l); - local_320 = (ItemPool *) - (~(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagOrbit._l))) + 0x4))) & - *GHIDRA_CAST((GHIDRA_INT(&(pEVar19->_tearFlags)._l) + 4))); - uVar13 = ~GHIDRA_UINT(g_tearFlagOrbit._h) & GHIDRA_UINT((pEVar19->_tearFlags)._h); - uStack_2ac = CONCAT44(uVar13,local_320); - uStack_2a4 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagOrbit._h))) + 0x4))) & - *GHIDRA_CAST((GHIDRA_INT(&(pEVar19->_tearFlags)._h) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = GHIDRA_CAST(local_320); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = newTearFlagsLo; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uVar13; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_2a4; - (GHIDRA_CAST((pEVar19)))->Entity_Tear::SetTearFlags(flags); - } - } - pfVar16 = local_314; - } - (pEVar19->_velocity).x = (float)local_308 * (float)pfVar16 + (pEVar19->_velocity).x; - (pEVar19->_velocity).y = - (float)pEStack_2fc * (float)pfVar16 + (pEVar19->_velocity).y; - } - } - } - local_304 = GHIDRA_CAST((GHIDRA_INT(local_304) + 1)); - } while (local_304 < *GHIDRA_CAST((GHIDRA_CAST(pvStack_2bc) + 0x1264))); - } - ((GHIDRA_CAST(this))->_velocity).y = - (float)pGStack_2f8 * ((GHIDRA_CAST(this))->_velocity).y; - ((GHIDRA_CAST(this))->_velocity).x = - (float)pGStack_2f8 * ((GHIDRA_CAST(this))->_velocity).x; - } - } -LAB_006b0a5d: - if (((((GHIDRA_CAST(this))->_flags & 0x4000) == 0) && - (0.0 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x7240)))) && - ((((g_manager->_optionsConfig)._enableWaterSurface != 0 && - (((get_water_splash_variant(this,GHIDRA_CAST(&local_2c8)), - (GHIDRA_CAST(this))->_entityCollisionClass != 0 && - ((GHIDRA_CAST(this))->_entityGridCollisionClass == 5)) || - ((GHIDRA_UINT(local_2c8.x) & 0x80) != 0)))) && - (fVar18 = ((GHIDRA_CAST(this))->_velocity).y, fVar20 = ((GHIDRA_CAST(this))->_velocity).x, - fVar18 = sqrtf(fVar20 * fVar20 + fVar18 * fVar18), 0.01 < fVar18)))) { - iVar7 = 1; - if (1 < GHIDRA_INT((20.0 / fVar18))) { - iVar7 = GHIDRA_INT((20.0 / fVar18)); - } - iVar7 = GetIntervalTicks(this,(float)iVar7,0.0); - if (iVar7 != 0) { - uVar13 = Random(); - Game::SpawnEx(g_game,1000,0x85,&(GHIDRA_CAST(this))->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar13,0); - } - } - if (10000.0 <= ABS(((GHIDRA_CAST(this))->_pos).x) + ABS(((GHIDRA_CAST(this))->_pos).y)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Invalid entity position detected: %.2f, %.2f (%d.%d.%d)\n")); - } - return; -} - -// 006b0eb0 -void Entity::Interpolate() -{ - Vector *position; - float velocityY; - Vector clampedPos; - uint32_t flagsLow; - Game *game; - float speedMultiplier; - int type; - float velocityX; - float velocityY; - - flagsLow = GHIDRA_UINT(this->_flags); - if ((flagsLow & 2) != 0) { - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = flagsLow & 0xfffffffd; - return; - } - type = this->_type; - position = &this->_pos; - (this->_preInterpolatePos).x = position->x; - (this->_preInterpolatePos).y = (this->_pos).y; - velocityY = this->_friction; - velocityY = (this->_velocity).y; - velocityX = (this->_velocity).x; - speedMultiplier = this->_speedMultiplier; - this->_isInterpolating = 1; - position->x = velocityY * velocityX * speedMultiplier * 0.5 + position->x; - (this->_pos).y = velocityY * velocityY * speedMultiplier * 0.5 + (this->_pos).y; - if (type == 1) { - PlayerCollideWithGrid(this,1); - game = g_game; - if (this->_variant == 1) { - velocityY = this->_size; - Room::GetClampedPositionImpl(g_game->_room,&clampedPos,position,velocityY,velocityY,velocityY,velocityY); - position->x = clampedPos.x; - (this->_pos).y = clampedPos.y; - velocityY = sin(((float)game->_frameCount + 0.5) * 0.2); - (this->_posOffset).y = velocityY + velocityY; - return; - } - } - else { - CollideWithGrid(this,1); - } - return; -} - -// 006b1000 -int Entity::GetRenderZ() -{ - int renderZ; - int clampedZ; - - if (this->_sortingLayer == 0) { - renderZ = this->_renderZOffset + 100 + (this->_index & 0x3ffU); - clampedZ = 4999; - if (renderZ < 4999) { - clampedZ = renderZ; - } - renderZ = 0; - if (0 < clampedZ) { - renderZ = clampedZ; - } - return renderZ; - } - if (this->_sortingLayer == 1) { - renderZ = this->_renderZOffset + 0x13ec + (this->_index & 0x3ffU); - clampedZ = 9999; - if (renderZ < 9999) { - clampedZ = renderZ; - } - renderZ = 5000; - if (5000 < clampedZ) { - renderZ = clampedZ; - } - return renderZ; - } - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - renderZ = (this->_index & 0x3ffU) + this->_renderZOffset + 0x272e; - clampedZ = 10000; - if (10000 < renderZ) { - clampedZ = renderZ; - } - return clampedZ; - } - renderZ = FUN_006a8120(); - renderZ = this->_renderZOffset + renderZ; - clampedZ = 10000; - if (10000 < renderZ) { - clampedZ = renderZ; - } - return clampedZ; -} - -// 006b10d0 -uint8_t Entity::CanOverwrite() -{ - if ((this->_flags & 0x200000) == 0) { - return 1; - } - return 0; -} - -// 006b10f0 -void Entity::Render(Vector *offset) -{ - float pixelScale; - double dVar1; - double dVar2; - float offsetY; - - if ((this->_exists != 0) && (this->_visible != 0)) { - pixelScale = g_displayPixelRatio * g_screenPointScale; - dVar1 = floor((double)(((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5)); - dVar2 = floor((double)(((((this->_pos).y + (this->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * pixelScale + 0.5)); - offsetY = offset->y; - (this->_renderPosition).x = (float)dVar1 / pixelScale + offset->x; - (this->_renderPosition).y = (float)dVar2 / pixelScale + offsetY; - ANM2::Render(&this->_sprite,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - } - return; -} - -// 006b1260 -void Entity::PostRender() -{ - void *pvVar1; - KColor *fromColor; - KColor *fromColor_00; - int unused; - uint32_t uVar2; - Game *game; - KColor *collisionColor; - float fVar3; - float fVar4; - float fVar5; - float fVar6; - float fVar7; - double dVar8; - double dVar9; - int segment; - int reverseSegment; - float local_e8; - Vector lineTo; - float screenX; - float local_d8; - Vector lineFrom; - float minorAxisX; - float local_c8; - float majorAxisX; - Vector local_c0; - float negMajorAxisX; - float negMajorAxisY; - float arcPointX; - Vector arcPointA; - Vector arcPointB; - KColor drawColor; - uint8_t renderQuad [44]; - float local_4c; - float local_38; - float local_24; - float local_10; - int halfSegmentCount; - int segmentCount; - - if (((g_game->_debugFlags & 1) != 0) && (this->_type != 7)) { - fVar3 = g_screenHeight - 182.0; - uVar2 = 0xffffa500; - fVar4 = g_displayPixelRatio * g_screenPointScale; - if (this->_type != 1000) { - uVar2 = 0xffff0000; - } - dVar8 = floor((double)((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * fVar4 - + 0.5)); - dVar9 = floor((double)((((this->_pos).y - 140.0) * 0.65 + fVar3 * 0.5) * fVar4 + 0.5)); - fVar7 = (float)dVar8 / fVar4 + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1204)); - fVar5 = (float)dVar9 / fVar4 + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1208)); - fVar3 = fVar5; - fVar4 = fVar7; - (GHIDRA_CAST((&drawColor)))->KColor::SetFromARGB(uVar2); - lineTo.x = fVar4 + 2.0; - lineTo.y = fVar3 + 0.0; - lineFrom.x = fVar4 - 2.0; - lineFrom.y = fVar3 - 0.0; - render_color_quad(&lineFrom,&lineTo,fromColor,fromColor,1.0); - (GHIDRA_CAST((&drawColor)))->KColor::SetFromARGB(uVar2); - lineTo.x = fVar7 + 0.0; - lineTo.y = fVar5 + 2.0; - lineFrom.y = fVar5 - 2.0; - lineFrom.x = fVar7 - 0.0; - render_color_quad(&lineFrom,&lineTo,fromColor_00,fromColor_00,1.0); - } - game = g_game; - if ((GHIDRA_UINT(g_game->_debugFlags) >> 0xc & 1) != 0) { - fVar3 = g_screenHeight - 182.0; - fVar4 = g_displayPixelRatio * g_screenPointScale; - dVar8 = floor((double)((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * fVar4 - + 0.5)); - dVar9 = floor((double)((((this->_pos).y - 140.0) * 0.65 + fVar3 * 0.5) * fVar4 + 0.5)); - fVar3 = (float)dVar8 / fVar4 + *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1204)); - fVar4 = (float)dVar9 / fVar4 + *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1208)); - if (this->_entityGridCollisionClass != 0) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80cb8) && - (_Init_thread_header(), DAT_00c80cb8 == -1)) { - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80cc0))))->KColor::SetFromARGB(0xff000000); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80cd4))))->KColor::SetFromARGB(0xff8b0000); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80ce8))))->KColor::SetFromARGB(0xff006400); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80cfc))))->KColor::SetFromARGB(0xffffff00); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80d10))))->KColor::SetFromARGB(0xffffa500); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80d24))))->KColor::SetFromARGB(0xffff0000); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80d38))))->KColor::SetFromARGB(0xff00ffff); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80d4c))))->KColor::SetFromARGB(0xffff00ff); - _Init_thread_footer(); - } - uVar2 = this->_entityGridCollisionClass; - if ((GHIDRA_INT(uVar2) < 1) || (7 < uVar2)) { - collisionColor = GHIDRA_CAST(&DAT_00c80cc0); - } - else { - collisionColor = GHIDRA_CAST((&DAT_00c80cc0 + uVar2 * 0x14)); - } - uVar2 = 0; - pvVar1 = (this->_collisionPoints)._begin; - if (GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT(pvVar1) >> 3 != 0) { - lineTo.x = 1.0; - lineTo.y = 1.0; - fVar5 = fVar3; - fVar7 = fVar4; - do { - lineFrom.x = fVar5 + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar2 * 8)) * 0.65; - lineFrom.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar2 * 8 + 4)) * 0.65 + fVar7; - render_quad_set_rect(renderQuad,&lineFrom,&lineTo,collisionColor); - if ((local_4c + local_38 + local_24 + local_10) * 0.25 != 0.0) { - shader_push(GHIDRA_CAST("KAGE_ColorShader")); - FUN_00a11080(); - pvVar1 = kage_graphics_flush((void *)0x0); - render_quad_draw(pvVar1,&drawColor,renderQuad,1,unused); - FUN_00a14200(); - fVar5 = fVar3; - fVar7 = fVar4; - } - uVar2 = uVar2 + 1; - pvVar1 = (this->_collisionPoints)._begin; - } while (uVar2 < GHIDRA_UINT((GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT(pvVar1) >> 3))); - } - game = g_game; - } - } - if ((GHIDRA_UINT(game->_debugFlags) >> 5 & 1) != 0) { - fVar3 = g_screenHeight - 182.0; - fVar4 = g_displayPixelRatio * g_screenPointScale; - dVar8 = floor((double)((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * fVar4 - + 0.5)); - screenX = (float)dVar8 / fVar4; - dVar8 = floor((double)((((this->_pos).y - 140.0) * 0.65 + fVar3 * 0.5) * fVar4 + 0.5)); - screenX = screenX + *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1204)); - fVar3 = (float)dVar8 / fVar4 + *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1208)); - if ((0.0 < this->_size) && (this->_entityCollisionClass != 0)) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80d60) && - (_Init_thread_header(), DAT_00c80d60 == -1)) { - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80d68))))->KColor::SetFromARGB(0xff000000); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80d7c))))->KColor::SetFromARGB(0xffffa500); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80d90))))->KColor::SetFromARGB(0xffffc0cb); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80da4))))->KColor::SetFromARGB(0xff00ff00); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c80db8))))->KColor::SetFromARGB(0xffff0000); - _Init_thread_footer(); - } - uVar2 = this->_entityCollisionClass; - if ((GHIDRA_INT(uVar2) < 1) || (4 < uVar2)) { - collisionColor = GHIDRA_CAST(&DAT_00c80d68); - } - else { - collisionColor = GHIDRA_CAST((&DAT_00c80d68 + uVar2 * 0x14)); - } - local_e8 = this->_size; - fVar4 = (this->_sizeMulti).x; - fVar5 = (local_e8 * 6.2831855) / 10.0; - if (fVar5 <= 2.0) { - fVar5 = 2.0; - } - if (12.0 <= fVar5) { - fVar5 = 12.0; - } - halfSegmentCount = GHIDRA_INT(fVar5) * 2; - if ((fVar4 == g_vectorOne.x) && ((this->_sizeMulti).y == g_vectorOne.y)) { - fVar4 = cos(0.0); - local_c0.x = fVar4 * this->_size * 0.65 + screenX; - fVar4 = sin(0.0); - segment = 1; - segmentCount = GHIDRA_INT(fVar5) << 2; - if (0 < segmentCount) { - local_c0.y = fVar4 * this->_size * 0.65 + fVar3; - do { - fVar5 = (((float)segment * 180.0) / (float)halfSegmentCount) * 0.017453292; - fVar4 = cos(fVar5); - fVar4 = fVar4 * this->_size * 0.65 + screenX; - lineTo.x = fVar4; - fVar5 = sin(fVar5); - fVar5 = fVar5 * this->_size * 0.65 + fVar3; - lineTo.y = fVar5; - render_color_quad(&local_c0,&lineTo,collisionColor,collisionColor,1.0); - segment = segment + 1; - local_c0.x = fVar4; - local_c0.y = fVar5; - } while (segment <= segmentCount); - return; - } - } - else { - local_d8 = (this->_sprite)._rotation; - fVar4 = fVar4 * local_e8; - local_e8 = local_e8 * (this->_sizeMulti).y; - fVar5 = fVar4; - if (fVar4 < local_e8) { - local_d8 = local_d8 + 90.0; - fVar5 = local_e8; - local_e8 = fVar4; - } - fVar4 = local_d8 * 0.017453292; - majorAxisX = cos(fVar4); - majorAxisX = majorAxisX * (fVar5 - local_e8); - fVar4 = sin(fVar4); - fVar4 = fVar4 * (fVar5 - local_e8); - local_d8 = (local_d8 + 90.0) * 0.017453292; - minorAxisX = cos(local_d8); - minorAxisX = minorAxisX * local_e8; - local_d8 = sin(local_d8); - local_d8 = local_d8 * local_e8; - lineTo.x = (-minorAxisX + majorAxisX) * 0.65 + screenX; - lineFrom.x = (-minorAxisX - majorAxisX) * 0.65 + screenX; - lineTo.y = (-local_d8 + fVar4) * 0.65 + fVar3; - lineFrom.y = (-local_d8 - fVar4) * 0.65 + fVar3; - render_color_quad(&lineFrom,&lineTo,collisionColor,collisionColor,1.0); - fVar5 = (minorAxisX + majorAxisX) * 0.65 + screenX; - fVar7 = (local_d8 + fVar4) * 0.65 + fVar3; - lineFrom.x = (minorAxisX - majorAxisX) * 0.65 + screenX; - lineFrom.y = (local_d8 - fVar4) * 0.65 + fVar3; - lineTo.x = fVar5; - lineTo.y = fVar7; - render_color_quad(&lineFrom,&lineTo,collisionColor,collisionColor,1.0); - negMajorAxisX = -majorAxisX; - negMajorAxisY = -fVar4; - segment = 1; - lineTo.x = (negMajorAxisX + minorAxisX) * 0.65 + screenX; - if (0 < halfSegmentCount) { - reverseSegment = -1; - lineTo.y = (negMajorAxisY + local_d8) * 0.65 + fVar3; - lineFrom.x = fVar5; - lineFrom.y = fVar7; - do { - fVar5 = (((float)reverseSegment * 180.0) / (float)halfSegmentCount) * 0.017453292; - local_c8 = cos(fVar5); - fVar5 = sin(fVar5); - fVar7 = local_c8 * local_d8; - fVar6 = local_c8 * minorAxisX; - local_c8 = (((float)segment * 180.0) / (float)halfSegmentCount) * 0.017453292; - local_c0.x = (fVar5 * minorAxisX + fVar7 + fVar4) * 0.65 + fVar3; - arcPointX = ((fVar6 - fVar5 * local_d8) + majorAxisX) * 0.65 + screenX; - arcPointA.x = arcPointX; - arcPointA.y = local_c0.x; - fVar5 = cos(local_c8); - fVar7 = sin(local_c8); - local_c8 = ((fVar5 * minorAxisX - fVar7 * local_d8) + negMajorAxisX) * 0.65 + screenX; - fVar5 = (fVar5 * local_d8 + fVar7 * minorAxisX + negMajorAxisY) * 0.65 + fVar3; - arcPointB.x = local_c8; - arcPointB.y = fVar5; - render_color_quad(&lineFrom,&arcPointA,collisionColor,collisionColor,1.0); - render_color_quad(&lineTo,&arcPointB,collisionColor,collisionColor,1.0); - lineFrom.x = arcPointX; - lineFrom.y = local_c0.x; - segment = segment + 1; - reverseSegment = reverseSegment + -1; - lineTo.x = local_c8; - lineTo.y = fVar5; - } while (segment <= halfSegmentCount); - } - } - } - } - return; -} - -// 006b2000 -uint8_t Entity::RenderShadowLayer(Vector *offset) -{ - uint8_t *layerName; - float fVar1; - float fVar2; - float fVar3; - LayerState *shadowLayer; - float *extraout_EAX; - double dVar4; - Vector renderPos; - float local_c4; - uint64_t local_c0; - float savedTint; - float fStack_b4; - float fStack_b0; - float fStack_ac; - float savedColorize; - float fStack_a4; - float fStack_a0; - float fStack_9c; - Color shadowColor; - uint32_t local_6c [26]; - ColorMod *spriteColor; - - local_c0 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x4))),g_displayPixelRatio * g_screenPointScale); - renderPos.x = ((((this->_shadowOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * g_displayPixelRatio * g_screenPointScale + 0.5; - dVar4 = floor((double)renderPos.x); - local_c4 = (float)dVar4 / (float)local_c0; - renderPos.x = ((((this->_pos).y + (this->_shadowOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * (float)local_c0 + 0.5; - dVar4 = floor((double)renderPos.x); - renderPos.x = local_c4 + offset->x; - renderPos.y = (float)dVar4 / (float)local_c0 + offset->y; - layerName = GHIDRA_CAST((this->_sprite)._shadowLayerIndex); - if (layerName == GHIDRA_CAST(0xffffffff)) { - return 0; - } - shadowLayer = ANM2::GetLayer(&this->_sprite,layerName); - spriteColor = &(this->_sprite)._color; - shadowLayer->_visible = 1; - savedTint = spriteColor->_tint[0]; - fStack_b4 = (this->_sprite)._color._tint[1]; - fStack_b0 = (this->_sprite)._color._tint[2]; - fStack_ac = (this->_sprite)._color._tint[3]; - local_c4 = (this->_sprite)._color._offset[2]; - savedColorize = (this->_sprite)._color._colorize[0]; - fStack_a4 = (this->_sprite)._color._colorize[1]; - fStack_a0 = (this->_sprite)._color._colorize[2]; - fStack_9c = (this->_sprite)._color._colorize[3]; - local_c0 = *GHIDRA_CAST((this->_sprite)._color._offset); - ::(GHIDRA_CAST((&shadowColor)))->Color::Color(); - if (spriteColor != GHIDRA_CAST(extraout_EAX)) { - fVar1 = extraout_EAX[1]; - fVar2 = extraout_EAX[2]; - fVar3 = extraout_EAX[3]; - spriteColor->_tint[0] = *extraout_EAX; - (this->_sprite)._color._tint[1] = fVar1; - (this->_sprite)._color._tint[2] = fVar2; - (this->_sprite)._color._tint[3] = fVar3; - fVar1 = extraout_EAX[5]; - fVar2 = extraout_EAX[6]; - fVar3 = extraout_EAX[7]; - (this->_sprite)._color._colorize[0] = extraout_EAX[4]; - (this->_sprite)._color._colorize[1] = fVar1; - (this->_sprite)._color._colorize[2] = fVar2; - (this->_sprite)._color._colorize[3] = fVar3; - *GHIDRA_CAST((this->_sprite)._color._offset) = *GHIDRA_CAST((extraout_EAX + 8)); - (this->_sprite)._color._offset[2] = extraout_EAX[10]; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RenderLayer((this->_sprite)._shadowLayerIndex,&renderPos, - &g_vectorZero,&g_vectorZero); - if (spriteColor != GHIDRA_CAST(local_6c)) { - spriteColor->_tint[0] = savedTint; - (this->_sprite)._color._tint[1] = fStack_b4; - (this->_sprite)._color._tint[2] = fStack_b0; - (this->_sprite)._color._tint[3] = fStack_ac; - (this->_sprite)._color._colorize[0] = savedColorize; - (this->_sprite)._color._colorize[1] = fStack_a4; - (this->_sprite)._color._colorize[2] = fStack_a0; - (this->_sprite)._color._colorize[3] = fStack_9c; - *GHIDRA_CAST((this->_sprite)._color._offset) = local_c0; - (this->_sprite)._color._offset[2] = local_c4; - } - shadowLayer->_visible = 0; - return 1; -} - -// 006b2210 -float Entity::IsCollisionIgnored(Entity *other) -{ - int iVar1; - uint8_t isOwned; - float mass; - - mass = this->_mass; - if (((this->_flags & 0x8000000000000) != 0) && - (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (other->_type == 1)) || - (other->_type - 10U < 0x3de)))) { - mass = mass * 10.0; - } - iVar1 = this->_type; - if (iVar1 == 1) { - if ((other->_type == 3) && (other->_variant == 0xef)) { - mass = mass * 10.0; - } - isOwned = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST(&this[5]._sprite._overlayRenderFirst),0x271); - if (isOwned != 0) { - mass = mass * 10.0; - } - } - if (((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar1 == 1)) || (iVar1 - 10U < 0x3de)) && - ((other->_type == 2 || (other->_type == 7)))) && - ((((iVar1 == 0x19 || - ((((iVar1 == 0x3e || (iVar1 == 0x29)) || (iVar1 == 0xfe)) || - ((iVar1 == 0x5b || (iVar1 == 0x17)))))) || (iVar1 == 0x124)) || - (((iVar1 == 0xf5 || (iVar1 == 0x37)) || (iVar1 == 0x11b)))))) { - mass = mass * 100.0; - } - if ((iVar1 == 1) && (other->_type == 9)) { - isOwned = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::HasCollectible(0x114,0); - if (isOwned == 0) { - isOwned = TemporaryEffects::HasNullEffect - (GHIDRA_CAST(&this[5]._sprite._overlayRenderFirst),0x3b); - if ((isOwned == 0) && (this[4]._health != 4.90454e-44)) { - return mass; - } - } - mass = mass * 20.0; - } - return mass; -} - -// 006b25b0 -void Entity::push_apart_capsule(Entity *other) -{ - float fVar1; - uint8_t bVar2; - Game *extraout_EDX; - Game *game; - Entity *otherEntity; - float otherShare; - float selfShare; - float fVar3; - float fVar4; - float otherShare; - float pushVelX; - float beastDamping; - Vector scratchVec; - Capsule otherCapsule [13]; - Capsule selfCapsule [14]; - - otherEntity = other; - if ((((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (this->_type != 2)) || (other->_type != 1)) && - (other->_type < this->_type)) { - otherEntity = this; - this = other; - } - scratchVec.x = (this->_pos).x + g_vectorZero.x; - scratchVec.y = (this->_pos).y + g_vectorZero.y; - Capsule::constructor - (selfCapsule,&scratchVec,&this->_sizeMulti,(this->_sprite)._rotation,this->_size); - scratchVec.x = (otherEntity->_pos).x + g_vectorZero.x; - scratchVec.y = (otherEntity->_pos).y + g_vectorZero.y; - Capsule::constructor - (otherCapsule,&scratchVec,&otherEntity->_sizeMulti,(otherEntity->_sprite)._rotation, - otherEntity->_size); - scratchVec.y = 0.0; - scratchVec.x = 0.0; - bVar2 = Capsule::Collide(selfCapsule,otherCapsule,&scratchVec); - if (bVar2 != 0) { - bVar2 = entity_collision_classes_match(this,otherEntity); - if (bVar2 == 0) { - otherShare = IsCollisionIgnored(this,otherEntity); - selfShare = IsCollisionIgnored(otherEntity,this); - otherShare = otherShare / (selfShare + otherShare); - selfShare = 1.0 - otherShare; - if ((scratchVec.x != g_vectorZero.x) || (scratchVec.y != g_vectorZero.y)) { - fVar1 = (this->_velocity).x; - otherShare = (otherEntity->_velocity).x - fVar1; - fVar3 = (otherEntity->_velocity).y - (this->_velocity).y; - fVar4 = sqrtf(fVar3 * fVar3 + otherShare * otherShare); - fVar3 = sqrtf(scratchVec.x * scratchVec.x + scratchVec.y * scratchVec.y); - beastDamping = 0.25; - pushVelX = (scratchVec.x / fVar3) * fVar4; - fVar4 = (scratchVec.y / fVar3) * fVar4; - game = g_game; - fVar3 = scratchVec.y; - otherShare = scratchVec.x; - if ((this->_flags & 0x40000000) == 0) { - bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsBeastDungeon(); - if ((bVar2 == 0) || (this->_type != 1)) { - (this->_pos).x = (this->_pos).x - otherShare * selfShare; - (this->_pos).y = (this->_pos).y - fVar3 * selfShare; - (this->_velocity).x = (this->_velocity).x - pushVelX * selfShare; - fVar1 = fVar4; - } - else { - (this->_velocity).x = fVar1 - pushVelX * beastDamping * selfShare; - fVar1 = fVar4 * beastDamping; - } - (this->_velocity).y = (this->_velocity).y - fVar1 * selfShare; - game = extraout_EDX; - } - if ((otherEntity->_flags & 0x40000000) == 0) { - bVar2 = (GHIDRA_CAST((game->_room)))->Room::IsBeastDungeon(); - if ((bVar2 == 0) || (otherEntity->_type != 1)) { - (otherEntity->_pos).x = otherShare * otherShare + (otherEntity->_pos).x; - (otherEntity->_pos).y = fVar3 * otherShare + (otherEntity->_pos).y; - } - else { - pushVelX = pushVelX * beastDamping; - fVar4 = fVar4 * beastDamping; - } - (otherEntity->_velocity).y = fVar4 * otherShare + (otherEntity->_velocity).y; - (otherEntity->_velocity).x = pushVelX * otherShare + (otherEntity->_velocity).x; - } - } - return; - } - } - return; -} - -// 006b2940 -uint8_t Entity::push_apart_circle(Entity *other) -{ - uint8_t bVar1; - Vector *relVelocityDir; - Vector *deltaDir; - uint32_t rngResult; - int unused; - Game *extraout_EDX; - Game *game; - Entity *first; - Entity *second; - float fVar2; - float fVar3; - float pushDirX; - float pushDirY; - float beastDamping; - Vector local_40; - Vector local_38; - Vector local_30; - float local_28; - Entity *local_24; - float local_20; - float local_1c; - float dy; - float dx; - - second = other; - local_24 = this; - if ((((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (this->_type != 2)) || (other->_type != 1)) && - (other->_type < this->_type)) { - second = this; - local_24 = other; - } - first = local_24; - local_40.y = (second->_pos).y - (local_24->_pos).y; - local_40.x = (second->_pos).x - (local_24->_pos).x; - local_1c = local_24->_size + second->_size; - fVar3 = local_40.y * local_40.y + local_40.x * local_40.x; - if (fVar3 < local_1c * local_1c) { - dy = local_40.y; - dx = local_40.x; - local_28 = sqrtf(fVar3); - bVar1 = entity_collision_classes_match(first,second); - if (bVar1 == 0) { - first->_collidesWithEntity = second->_type != 2; - second->_collidesWithEntity = first->_type != 2; - if (0.0001 <= local_28) { - local_38.y = (first->_velocity).y - (second->_velocity).y; - local_38.x = (first->_velocity).x - (second->_velocity).x; - local_30.y = local_38.x; - local_20 = local_38.y; - fVar3 = sqrtf(local_38.y * local_38.y + local_38.x * local_38.x); - if ((local_1c * 0.5 < fVar3) && (dy * local_20 + dx * local_30.y < 0.0)) { - relVelocityDir = (GHIDRA_CAST((&local_38)))->Vector::Normalized(&local_30); - deltaDir = (GHIDRA_CAST((&local_40)))->Vector::Normalized(&local_38); - fVar3 = relVelocityDir->y * deltaDir->y + relVelocityDir->x * deltaDir->x; - fVar2 = fVar3 * dy; - fVar3 = fVar3 * dx; - dy = fVar2 + fVar2 + dy; - dx = dx + fVar3 + fVar3; - local_28 = sqrtf(dy * dy + dx * dx); - first = local_24; - } - local_24 = GHIDRA_CAST(IsCollisionIgnored(first,second)); - fVar3 = IsCollisionIgnored(second,first); - local_24 = GHIDRA_CAST(((float)local_24 / (fVar3 + (float)local_24))); - local_1c = (local_1c - local_28) / local_28; - local_20 = 1.0 - (float)local_24; - if ((first->_type == 1) || ((first->_type == 3 && (first->_variant == 0x43)))) { - local_40.x = -dx * local_20 * local_1c; - local_40.y = -dy * local_20 * local_1c; - bVar1 = is_grid_collision_at(first,&local_40); - if (bVar1 != 0) { - local_24 = GHIDRA_CAST(0x3f800000); - local_20 = 0.0; - } - } - if (first->_type == 1) { - local_20 = local_20 * 0.5; - } - fVar3 = (second->_velocity).y - (first->_velocity).y; - fVar2 = (second->_velocity).x - (first->_velocity).x; - local_30.y = sqrtf(fVar3 * fVar3 + fVar2 * fVar2); - local_38.y = (dx / local_28) * local_30.y; - local_28 = (dy / local_28) * local_30.y; - if ((((first->_type == 0x393) && (first->_variant == 1)) && (second->_type == 0x393)) && - (second->_variant == 1)) { - rngResult = Random(); - fVar3 = local_30.y * 0.05 + 0.2; - if (1.2 <= fVar3) { - fVar3 = 1.2; - } - SoundEffects::PlayWithFartOverride2 - (0x1e7,unused,2,0, - (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.2 - + 0.9,fVar3); - } - beastDamping = 0.25; - game = g_game; - fVar3 = local_28; - fVar2 = local_38.y; - pushDirX = dx; - pushDirY = dy; - if ((first->_flags & 0x40000000) == 0) { - bVar1 = (GHIDRA_CAST((g_game->_room)))->Room::IsBeastDungeon(); - if ((bVar1 == 0) || (first->_type != 1)) { - (first->_pos).x = (first->_pos).x - pushDirX * local_20 * local_1c; - (first->_pos).y = (first->_pos).y - pushDirY * local_20 * local_1c; - beastDamping = 0.25; - (first->_velocity).x = (first->_velocity).x - fVar2 * local_20; - (first->_velocity).y = (first->_velocity).y - fVar3 * local_20; - game = extraout_EDX; - } - else { - (first->_velocity).x = (first->_velocity).x - fVar2 * beastDamping * local_20; - (first->_velocity).y = (first->_velocity).y - fVar3 * beastDamping * local_20; - game = extraout_EDX; - } - } - if ((second->_flags & 0x40000000) == 0) { - bVar1 = (GHIDRA_CAST((game->_room)))->Room::IsBeastDungeon(); - if ((bVar1 == 0) || (second->_type != 1)) { - (second->_pos).x = pushDirX * (float)local_24 * local_1c + (second->_pos).x; - (second->_pos).y = pushDirY * (float)local_24 * local_1c + (second->_pos).y; - } - else { - fVar2 = fVar2 * beastDamping; - fVar3 = fVar3 * beastDamping; - } - (second->_velocity).y = fVar3 * (float)local_24 + (second->_velocity).y; - (second->_velocity).x = fVar2 * (float)local_24 + (second->_velocity).x; - } - } - return 1; - } - } - return 0; -} - -// 006b2ee0 -void Entity::collide_with_entity() -{ - Entity *in_EDX; - - if (((((this->_sizeMulti).x == g_vectorOne.x) && ((this->_sizeMulti).y == g_vectorOne.y)) && - ((in_EDX->_sizeMulti).x == g_vectorOne.x)) && ((in_EDX->_sizeMulti).y == g_vectorOne.y)) { - push_apart_circle(this,in_EDX); - return; - } - push_apart_capsule(this,in_EDX); - return; -} - -// 006b2f50 -uint8_t Entity::ForceCollide(Entity *boom, Entity *collider, uint8_t low) -{ - uint8_t bVar1; - uint8_t isColliderCollided; - - g_forceCollideDepth = g_forceCollideDepth + 1; - if (low == 0) { - bVar1 = entity_collision_classes_match(boom,collider); - g_forceCollideDepth = g_forceCollideDepth + -1; - return bVar1; - } - bVar1 = boom->HandleCollision(collider,1); - isColliderCollided = collider->HandleCollision(boom,0); - g_forceCollideDepth = g_forceCollideDepth + -1; - return isColliderCollided | bVar1; -} - -// 006b2fa0 -void Entity::SetColor(ColorMod *color, int duration, int priority, uint8_t isFadeout, uint8_t isShare) -{ - float fVar1; - float fVar2; - float fVar3; - uint8_t isStatusShared; - uint32_t extraout_EDX; - int *insertPos; - undefined3 in_stack_00000011; - undefined3 in_stack_00000015; - uint8_t auStack_5c [4]; - float colorOffsetZ; - ColorMod *colorLocal; - std_vector *local_50; - float local_4c; - float fStack_48; - float fStack_44; - float fStack_40; - float local_3c; - float fStack_38; - float fStack_34; - float fStack_30; - float local_2c; - uint32_t uStack_28; - float local_24; - float local_20; - int local_1c; - uint32_t local_18; - uint8_t local_14; - uint8_t local_13; - uint32_t local_c; - uint64_t colorOffsetXY; - void **colorParamsEnd; - int *paramsEnd; - ColorMod *spriteColor; - void *topParams; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_5c); - colorLocal = color; - if (duration < 1) { - if (&this->_color != color) { - fVar1 = color->_tint[1]; - fVar2 = color->_tint[2]; - fVar3 = color->_tint[3]; - (this->_color)._tint[0] = color->_tint[0]; - (this->_color)._tint[1] = fVar1; - (this->_color)._tint[2] = fVar2; - (this->_color)._tint[3] = fVar3; - fVar1 = color->_colorize[1]; - fVar2 = color->_colorize[2]; - fVar3 = color->_colorize[3]; - (this->_color)._colorize[0] = color->_colorize[0]; - (this->_color)._colorize[1] = fVar1; - (this->_color)._colorize[2] = fVar2; - (this->_color)._colorize[3] = fVar3; - *GHIDRA_CAST((this->_color)._offset) = *GHIDRA_CAST(color->_offset); - (this->_color)._offset[2] = color->_offset[2]; - } - this->ResetColor(); - } - else { - colorOffsetZ = color->_offset[2]; - local_4c = color->_tint[0]; - fStack_48 = color->_tint[1]; - fStack_44 = color->_tint[2]; - fStack_40 = color->_tint[3]; - local_3c = color->_colorize[0]; - fStack_38 = color->_colorize[1]; - fStack_34 = color->_colorize[2]; - fStack_30 = color->_colorize[3]; - colorOffsetXY = *GHIDRA_CAST(color->_offset); - local_20 = (float)duration; - local_1c = duration; - insertPos = (this->_colorParams)._begin; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x0))) = CONCAT11(isShare,isFadeout); - paramsEnd = (this->_colorParams)._end; - local_50 = GHIDRA_CAST(priority); - local_2c = (float)colorOffsetXY; - uStack_28 = (uint32_t)((uint64_t)colorOffsetXY >> 0x20); - for (; (insertPos != paramsEnd && (*insertPos < priority)); insertPos = insertPos + 0xf) { - } - local_24 = colorOffsetZ; - if (paramsEnd == (this->_colorParams)._capacity) { - FUN_006b8160(insertPos,&local_50); - } - else if (insertPos == paramsEnd) { - *paramsEnd = priority; - *GHIDRA_CAST((paramsEnd + 9)) = colorOffsetXY; - paramsEnd[0xb] = GHIDRA_INT(colorOffsetZ); - paramsEnd[1] = GHIDRA_INT(local_4c); - paramsEnd[2] = GHIDRA_INT(fStack_48); - paramsEnd[3] = GHIDRA_INT(fStack_44); - paramsEnd[4] = GHIDRA_INT(fStack_40); - paramsEnd[5] = GHIDRA_INT(local_3c); - paramsEnd[6] = GHIDRA_INT(fStack_38); - paramsEnd[7] = GHIDRA_INT(fStack_34); - paramsEnd[8] = GHIDRA_INT(fStack_30); - *GHIDRA_CAST((paramsEnd + 0xe)) = isFadeout; - paramsEnd[0xc] = duration; - paramsEnd[0xd] = duration; - *GHIDRA_CAST((GHIDRA_CAST(paramsEnd) + 0x39)) = isShare; - colorParamsEnd = &(this->_colorParams)._end; - *colorParamsEnd = (void *)(GHIDRA_INT(*colorParamsEnd) + 0x3c); - } - else { - fStack_48 = color->_tint[0]; - fStack_44 = color->_tint[1]; - fStack_40 = color->_tint[2]; - local_3c = color->_tint[3]; - local_50 = &this->_colorParams; - local_4c = (float)priority; - local_20 = color->_offset[2]; - fStack_38 = color->_colorize[0]; - fStack_34 = color->_colorize[1]; - fStack_30 = color->_colorize[2]; - local_2c = color->_colorize[3]; - local_18 = duration; - local_14 = isFadeout; - uStack_28 = (uint32_t)*GHIDRA_CAST(color->_offset); - local_24 = (float)((uint64_t)*GHIDRA_CAST(color->_offset) >> 0x20); - local_13 = isShare; - FUN_004b7020(paramsEnd + -0xf); - colorParamsEnd = &(this->_colorParams)._end; - *colorParamsEnd = (void *)(GHIDRA_INT(*colorParamsEnd) + 0x3c); - FUN_004b6e40(extraout_EDX); - FUN_004b6fc0(&local_4c); - color = colorLocal; - } - topParams = (this->_colorParams)._begin; - spriteColor = &(this->_sprite)._color; - if (spriteColor != GHIDRA_CAST((GHIDRA_INT(topParams) + 4))) { - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 8)); - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0xc)); - fVar3 = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0x10)); - spriteColor->_tint[0] = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 4)); - (this->_sprite)._color._tint[1] = fVar1; - (this->_sprite)._color._tint[2] = fVar2; - (this->_sprite)._color._tint[3] = fVar3; - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0x18)); - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0x1c)); - fVar3 = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0x20)); - (this->_sprite)._color._colorize[0] = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0x14)); - (this->_sprite)._color._colorize[1] = fVar1; - (this->_sprite)._color._colorize[2] = fVar2; - (this->_sprite)._color._colorize[3] = fVar3; - *GHIDRA_CAST((this->_sprite)._color._offset) = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0x24)); - (this->_sprite)._color._offset[2] = *GHIDRA_CAST((GHIDRA_CAST(topParams) + 0x2c)); - } - } - isStatusShared = DoesEntityShareStatus(this); - if (((isStatusShared != 0) && (isShare != 0)) && (GHIDRA_CAST(this->_child) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_child) + 0x3c))(color,duration,priority,_isFadeout,_isShare); - } - return; -} - -// 006b45c0 -void Entity::BloodExplode() -{ - void *pvVar1; - ANM2 *pAVar2; - char cVar3; - uint8_t bVar4; - uint32_t uVar5; - Entity *pEVar6; - LayerState *layer; - uint32_t rngValue; - int iVar7; - Manager *manager; - int *unaff_EDI; - float fVar8; - float fVar9; - int iVar10; - uint8_t auStack_98 [4]; - int iStack_94; - Entity *pEStack_90; - Entity *pEStack_8c; - float fStack_88; - float gibSpeed; - Vector gibVelocity; - Vector VStack_78; - float dropVelX; - float dropVelY; - Vector dropVelocity; - KColor bloodColor; - KColor baseBloodColor; - ColorMod tmpColor; - uint32_t local_c; - code *setColorFn; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_98); - if ((this->_flags & 0x4000000000000) != 0) { - cVar3 = this->IsBoss(); - if ((cVar3 == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x2c)) == '\0')) { - uVar5 = Random(); - manager = g_manager; - iStack_94 = 0x1f0; - pEStack_90 = (Entity *) - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9); - seed_fart_sound_override(&iStack_94); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,(float)pEStack_90,0.0); - tmpColor._tint[0] = 0.8; - tmpColor._tint[1] = 0.8; - tmpColor._tint[2] = 0.8; - tmpColor._tint[3] = 1.0; - tmpColor._offset[0] = 0.3; - tmpColor._colorize[0] = 1.0; - tmpColor._colorize[1] = 1.0; - tmpColor._colorize[2] = 1.0; - tmpColor._colorize[3] = 0.5; - tmpColor._offset[1] = 0.5; - tmpColor._offset[2] = 0.8; - uVar5 = Random(); - pEStack_90 = (Entity *) - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10); - uVar5 = Random(); - Game::SpawnParticles - (g_game,&this->_pos,0x23,(uVar5 & 3) + 3,(float)pEStack_90 + (float)pEStack_90 + 3.0 - ,&tmpColor,100000.0,0); - return; - } - } - if ((this->_flags & 0x2000000000000) != 0) { - uVar5 = Random(); - manager = g_manager; - iStack_94 = 0x1f2; - pEStack_90 = (Entity *) - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9); - seed_fart_sound_override(&iStack_94); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,(float)pEStack_90,0.0); - manager = g_manager; - iStack_94 = 0x89; - seed_fart_sound_override(&iStack_94); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,1.0,0.0); - tmpColor._tint[0] = 0.8; - tmpColor._tint[1] = 0.8; - tmpColor._tint[2] = 0.8; - tmpColor._tint[3] = 1.0; - tmpColor._offset[0] = 0.3; - tmpColor._colorize[0] = 1.0; - tmpColor._colorize[1] = 1.0; - tmpColor._colorize[2] = 1.0; - tmpColor._colorize[3] = 0.5; - tmpColor._offset[1] = 0.5; - tmpColor._offset[2] = 0.8; - uVar5 = Random(); - Game::SpawnParticles - (g_game,&this->_pos,4,*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x5c)) + uVar5 % 3,5.0,&tmpColor, - 100000.0,0); - return; - } - iVar7 = this->_type; - if ((iVar7 == 0x33e) && (this->_variant == 10)) { - iStack_94 = 500; -LAB_006b4a8f: - manager = g_manager; - seed_fart_sound_override(&iStack_94); - fVar9 = 1.0; -LAB_006b4abc: - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,fVar9,2,0,1.0,0.0); - } - else { - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x60)); - if ((uVar5 >> 0xb & 1) != 0) { - iStack_94 = 0x1f8; - goto LAB_006b4a8f; - } - if ((0 < this->_freezeCountdown) || ((uVar5 & 0x180) != 0)) { - iStack_94 = 0x89; - goto LAB_006b4a8f; - } - bVar4 = IsEnemy(this); - manager = g_manager; - if ((bVar4 != 0) && (this[3]._spawnerType == 0xc)) { - iStack_94 = 0x1e; - goto LAB_006b4a8f; - } - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x60)); - if ((uVar5 >> 9 & 1) != 0) { - iStack_94 = 0xcf; - seed_fart_sound_override(&iStack_94); - fVar9 = 1.8; - goto LAB_006b4abc; - } - if ((uVar5 >> 10 & 1) != 0) { - iStack_94 = 0x1b; - goto LAB_006b4a8f; - } - if ((uVar5 >> 0xd & 1) != 0) { - iStack_94 = 0x8d; - goto LAB_006b4a8f; - } - if ((uVar5 >> 4 & 1) != 0) { - if (((((this->_dead == 0) || (*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x2c)) == '\0')) || - (iVar7 == 0x2e)) || - (((iVar7 == 0x2f || (iVar7 == 0x30)) || - ((iVar7 == 0x31 || ((iVar7 == 0x32 || (iVar7 == 0x33)))))))) || (iVar7 == 0x34)) { -LAB_006b4a23: - manager = g_manager; - iStack_94 = 0x1c; - seed_fart_sound_override(&iStack_94); - fVar9 = 1.25; - goto LAB_006b4abc; - } - iStack_94 = 0x8d; - goto LAB_006b4a8f; - } - bVar4 = HasEntityFlags(this,0x80000000000000); - pvVar1 = this->_config; - if (bVar4 == 0) { -LAB_006b4a5a: - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x5c)) < 1) goto LAB_006b4a6a; - fVar9 = 1.0; - } - else { - if (0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x5c))) { - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x60)) & 1) != 0) goto LAB_006b4a23; - goto LAB_006b4a5a; - } -LAB_006b4a6a: - fVar9 = 0.8; - } - play_sound_with_fart_seed(0x1e,fVar9,2,0,1.0); - } - manager = g_manager; - if ((this->_type == 0x3d) && (this->_variant == 5)) { - iStack_94 = 0x1ec; - seed_fart_sound_override(&iStack_94); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,1.0,0.0); - uVar5 = Random(); - pEVar6 = Game::SpawnEx(g_game,1000,0x79,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5,0); - tmpColor._offset[0] = 0.0; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - tmpColor._offset[1] = 0.0; - tmpColor._offset[2] = 0.0; - tmpColor._tint[0] = 1.0; - tmpColor._tint[1] = 1.0; - tmpColor._tint[2] = 0.0; - tmpColor._tint[3] = 1.0; - pEStack_90 = pEVar6; - pEVar6->SetColor(&tmpColor,0xffffffff,0xff,0,1); - fVar9 = g_vectorOne.x; - fVar8 = g_vectorOne.y * 0.75; - pAVar2 = &pEVar6[1]._sprite; - (pAVar2->_filename)._buf[4] = '\x03'; - (pAVar2->_filename)._buf[5] = '\0'; - (pAVar2->_filename)._buf[6] = '\0'; - (pAVar2->_filename)._buf[7] = '\0'; - pAVar2 = &pEVar6[1]._sprite; - (pAVar2->_filename)._buf[8] = '\x03'; - (pAVar2->_filename)._buf[9] = '\0'; - (pAVar2->_filename)._buf[10] = '\0'; - (pAVar2->_filename)._buf[0xb] = '\0'; - (pEVar6->_sprite)._scale.y = fVar8; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar6[1])) + 0x40)))) = 3; - (pEVar6->_sprite)._scale.x = fVar9 * 0.75; - (pEVar6->_posOffset).x = 0.0; - (pEVar6->_posOffset).y = -10.0; - if ((pEVar6->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(pEVar6->_sprite)._animState,1.0); - } - uVar5 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&pEStack_90->_sprite,GHIDRA_CAST(0x0)); - iVar7 = 1; - if ((uVar5 & 4) == 0) { - iVar7 = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = iVar7; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - } - iStack_94 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x5c)); - if (iStack_94 < 1) { - VStack_78.x = *GHIDRA_CAST(&this->_flags); - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); -LAB_006b4d1e: - pEStack_90 = GHIDRA_CAST((uVar5 & 0x800000)); - if (pEStack_90 == GHIDRA_CAST(0x0)) goto LAB_006b4cca; - iStack_94 = iStack_94 * 2; -LAB_006b4d45: - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x60)); - } - else { - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if ((uVar5 & 0x800) == 0) { - VStack_78.x = *GHIDRA_CAST(&this->_flags); - goto LAB_006b4d1e; - } - iVar7 = GHIDRA_INT((iStack_94 + (iStack_94 >> 0x1f & 3U))) >> 2; - iStack_94 = 1; - if (1 < iVar7) { - iStack_94 = iVar7; - } - if ((this->_flags & 0x80000000000000) != 0) goto LAB_006b4d45; -LAB_006b4cca: - gibVelocity.y = 0.0; - gibVelocity.x = 0.0; - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x60)); - iVar7 = iStack_94; - fVar9 = 1.0; - if ((uVar5 >> 0xd & 1) == 0) goto LAB_006b523c; - } - iVar7 = iStack_94; - gibVelocity.y = 0.0; - gibVelocity.x = 0.0; - if ((uVar5 >> 0xd & 1) == 0) { - gibSpeed = 2.0; - if (8 < iStack_94) { - iVar10 = 6; - goto LAB_006b4d65; - } - } - else { - gibSpeed = 4.0; - iVar10 = 0x18; -LAB_006b4d65: - Game::ShakeScreen(g_game,iVar10); - } - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - if (iVar10 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))) { - pEStack_8c = GHIDRA_CAST(((this->_pos).y - *GHIDRA_CAST((iVar10 + 0x24)))); - fStack_88 = (this->_pos).x - *GHIDRA_CAST((iVar10 + 0x20)); - fVar9 = sqrtf((float)pEStack_8c * (float)pEStack_8c + fStack_88 * fStack_88); - gibVelocity.x = fStack_88; - pEVar6 = pEStack_8c; - if (0.0 < fVar9) { - gibVelocity.x = fStack_88 * (1.0 / fVar9); - pEVar6 = GHIDRA_CAST(((float)pEStack_8c * (1.0 / fVar9))); - } - gibVelocity.x = gibVelocity.x * 16.0; - gibVelocity.y = (float)pEVar6 * 16.0; - } - if ((6 < iVar7) && ((*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x60)) & 1) != 0)) { - fStack_88 = (float)(iVar7 / 2); - if (fStack_88 == 0.0) { - uVar5 = 0; - } - else { - uVar5 = Random(); - uVar5 = uVar5 % GHIDRA_UINT(fStack_88); - } - fStack_88 = (float)(GHIDRA_INT(fStack_88) + uVar5); - baseBloodColor._unk = 0; - baseBloodColor._red = 0.61960787; - baseBloodColor._green = 0.043137256; - baseBloodColor._blue = 0.05882353; - baseBloodColor._alpha = 1.0; - ::Color::apply_to_kcolor(&bloodColor,&this->_splatColor,&baseBloodColor); - if (0 < GHIDRA_INT(fStack_88)) { - do { - uVar5 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - pEStack_8c = GHIDRA_CAST((fVar9 + fVar9)); - uVar5 = Random(); - pEStack_90 = (Entity *) - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 10.0); - dropVelX = cos((float)pEStack_8c); - dropVelX = dropVelX * (float)pEStack_90; - dropVelocity.x = dropVelX; - dropVelY = sin((float)pEStack_8c); - dropVelY = dropVelY * (float)pEStack_90; - dropVelocity.y = dropVelY; - uVar5 = Random(); - rngValue = Random(); - fVar9 = (float)((double)GHIDRA_INT(rngValue) + __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - pEStack_90 = GHIDRA_CAST((fVar9 + fVar9)); - rngValue = Random(); - pEStack_8c = (Entity *) - ((float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * 2.3283064e-10 * - 20.0); - fVar9 = cos((float)pEStack_90); - VStack_78.x = fVar9 * (float)pEStack_8c + (this->_pos).x; - fVar9 = sin((float)pEStack_90); - VStack_78.y = fVar9 * (float)pEStack_8c + (this->_pos).y; - pEVar6 = Game::SpawnEx(g_game,1000,0x3b,&VStack_78,&dropVelocity,this,0,uVar5,0); - pEStack_90 = GHIDRA_CAST(0x3f800000); - if (((pEVar6->_pos).y - (this->_pos).y) * -dropVelX + - ((pEVar6->_pos).x - (this->_pos).x) * dropVelY < 0.0) { - pEStack_90 = GHIDRA_CAST(&DAT_bf800000); - } - pEStack_8c = pEVar6; - uVar5 = Random(); - iVar7 = *GHIDRA_CAST(pEVar6); - *GHIDRA_CAST((pEVar6[1]._sprite._animDefaultName._buf + 4)) = - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 10.0 + 2.0) * (float)pEStack_90; - setColorFn = *(code **)(iVar7 + 0x3c); - uVar5 = Random(); - tmpColor._offset[0] = 0.0; - tmpColor._offset[1] = 0.0; - tmpColor._offset[2] = 0.0; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - tmpColor._tint[0] = bloodColor._red; - tmpColor._tint[1] = bloodColor._green; - tmpColor._tint[2] = bloodColor._blue; - tmpColor._tint[3] = - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 0.25 + 0.1) * bloodColor._alpha; - (*setColorFn)(&tmpColor,0xffffffff,0xff,0,1); - if ((*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x60)) >> 0xd & 1) == 0) { - uVar5 = Random(); - iVar7 = uVar5 % 0xf + 0xf; - unaff_EDI[0x117] = iVar7; - unaff_EDI[0x118] = iVar7; - } - else { - uVar5 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10; - fVar8 = fVar9 + fVar9 + 2.0; - fVar9 = fVar8 * g_vectorOne.x; - unaff_EDI[0x3a] = GHIDRA_INT((fVar8 * g_vectorOne.y)); - unaff_EDI[0x39] = GHIDRA_INT(fVar9); - uVar5 = Random(); - iVar7 = uVar5 % 0x1e + 0x14; - unaff_EDI[0x117] = iVar7; - unaff_EDI[0x118] = iVar7; - unaff_EDI[0xd8] = GHIDRA_INT(((float)unaff_EDI[0xd8] * 4.0)); - unaff_EDI[0xd9] = GHIDRA_INT(((float)unaff_EDI[0xd9] * 4.0)); - } - (**(code **)(*unaff_EDI + 0xc))(); - fStack_88 = (float)(GHIDRA_INT(fStack_88) + -1); - } while (fStack_88 != 0.0); - fStack_88 = 0.0; - iVar7 = iStack_94; - } - } - fVar9 = gibSpeed; -LAB_006b523c: - spawn_gibs(&this->_pos,iVar7,this->_size,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x60)),this, - &this->_splatColor,&gibVelocity,fVar9); - if (((this->_type != 4) && (this->_type != 5)) && ((this->_flags & 0x10000) == 0)) { - uVar5 = Random(); - pEVar6 = Game::SpawnEx(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5,0); - pEVar6->SetColor(&this->_splatColor,0xffffffff,0xff,0,1); - bVar4 = Game::IsInTimedSet(g_game,0x17); - if (bVar4 != 0) { - (pEVar6->_sprite)._scale.x = 2.0; - (pEVar6->_sprite)._scale.y = 2.0; - } - pEVar6->Update(); - } - return; -} - -// 006b5b90 -uint8_t Entity::IsActiveEnemy(uint8_t includeDead) -{ - bool isExcludedType; - int entityType; - - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (this->_type != 1)) { - entityType = this->_type; - if (0x3dd < entityType - 10U) { - return 0; - } - if (entityType == 0x21) { - return 0; - } - if (entityType == 0x11) { - return 0; - } - if (entityType == 0x124) { - return 0; - } - if (entityType == 0x375) { - isExcludedType = this->_variant == 10; - } - else { - if (entityType == 0x3c0) { - return 0; - } - if (entityType == 0x3c5) { - return 0; - } - isExcludedType = entityType == 0xf5; - } - if (isExcludedType) { - return 0; - } - } - if ((this->_dead == 0) || (includeDead != 0)) { - return 1; - } - return 0; -} - -// 006b5c10 -void Entity::AddShrink(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t unk) -{ - uint8_t bVar1; - char cVar2; - Entity_NPC *npc; - int newCountdown; - int extraout_EDX; - Entity *statusOwner; - Entity *ancestor; - uint32_t flagsHigh; - uint32_t flagsLow; - Entity *nextParent; - int oldCountdown; - uint64_t oldFlags; - - if (((unk != 0) || (bVar1 = IsDamageSourceFriendly(this,ref), bVar1 == 0)) && - (cVar2 = this->IsBoss(), cVar2 == '\0')) { - apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - statusOwner = this; - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - statusOwner = this; - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - statusOwner = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - oldFlags = statusOwner->_flags; - if ((unk != 0) || - (((extraout_EDX != 0 && ((oldFlags & 1) == 0)) && - ((statusOwner->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))))) { - oldCountdown = statusOwner->_shrinkCountdown; - if (extraout_EDX < 1) { - newCountdown = oldCountdown; - if (oldCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 0x96; - if (oldCountdown + extraout_EDX < 0x96) { - newCountdown = oldCountdown + extraout_EDX; - } - } - statusOwner->_shrinkCountdown = newCountdown; - flagsLow = GHIDRA_UINT(statusOwner->_flags); - if ((flagsLow & 0x1000000) == 0) { - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)); - *GHIDRA_CAST(&statusOwner->_flags) = flagsLow | 0x1000000; - *GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)) = flagsHigh; - statusOwner->_shrinkStatus2 = 0.333; - SetSize(this,*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)) * this->_shrinkStatus1, - (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); - } - if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) { - statusOwner->_bossStatusEffectCooldown = 0xf0; - } - CopyStatusEffects(statusOwner); - if ((((0 < statusOwner->_shrinkCountdown) && ((oldFlags & 0x1000800) == 0)) && - (bVar1 = IsEnemy(statusOwner), bVar1 != 0)) && - (npc = (Entity_NPC *) - __RTDynamicCast(statusOwner,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0), - npc != GHIDRA_CAST(0x0))) { - (GHIDRA_CAST((npc)))->Entity_NPC::ResetPathFinderTarget(); - } - } - } - return; -} - -// 006b5e60 -void * Entity::GetData(void *outRef) -{ - void *luaState; - uint32_t *luaRef; - uint32_t uVar1; - int refId; - - luaRef = this->_luaBridgeRef; - if (luaRef == GHIDRA_CAST(0x0)) { - luaRef = operator_new(8); - if (luaRef == GHIDRA_CAST(0x0)) { - luaRef = GHIDRA_CAST(0x0); - } - else { - uVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_luaEngine) + 0x18)); - lua_createtable(uVar1,0,0); - *luaRef = uVar1; - uVar1 = luaL_ref(uVar1,0xfff0b9d8); - luaRef[1] = uVar1; - } - this->_luaBridgeRef = luaRef; - } - refId = luaRef[1]; - luaState = (void *)*luaRef; - *(void **)outRef = luaState; - if (refId == -1) { - *GHIDRA_CAST((GHIDRA_CAST(outRef) + 4)) = 0xffffffff; - return outRef; - } - (GHIDRA_CAST((luaRef)))->LuaRef::push(luaState); - uVar1 = luaL_ref(*luaRef,0xfff0b9d8); - *GHIDRA_CAST((GHIDRA_CAST(outRef) + 4)) = uVar1; - return outRef; -} - -// 006b5f10 -void * Entity::GetDebugShape(uint8_t isUnknown) -{ - void *debugShape; - - debugShape = (GHIDRA_CAST((GHIDRA_CAST(&g_game->_debugRenderer))))->DebugRenderer::Get(this->_index,isUnknown); - return debugShape; -} - -// 006b62b0 -uint32_t Entity::GetHitListIndex() -{ - Entity *statusTarget; - int entityType; - - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_type == 1)) || - (entityType = this->_type, 0x3dd < entityType - 10U)) goto switchD_006b62ec_caseD_14; - if (entityType < 0xd9) { - if (entityType != 0xd8) { - switch(entityType) { - case 0x13: - case 0x1c: - case 0x23: - case 0x3e: - case 0x59: - break; - default: - goto switchD_006b62ec_caseD_14; - } - } - if ((entityType == 0x59) || (entityType == 0x13)) goto switchD_006b62ec_caseD_14; - if ((entityType != 0x1c) || (this->_variant != 2)) goto LAB_006b633c; - } - else { - if (entityType < 0x38e) { - if (((entityType != 0x38d) && (entityType != 0xef)) && - ((entityType != 0xf4 || (this->_variant != 2)))) goto switchD_006b62ec_caseD_14; - } - else if ((entityType != 0x390) && (entityType != 0x396)) goto switchD_006b62ec_caseD_14; -LAB_006b633c: - if ((entityType != 0x3e) || (this->_variant != 1)) goto LAB_006b6350; - } - if (this->_child != 0) { -switchD_006b62ec_caseD_14: - return this->_index; - } -LAB_006b6350: - statusTarget = GetStatusEffectTarget(this); - return statusTarget->_index; -} - -// 006b63b0 -Vector * Entity::GetForwardVector(Vector *outForward) -{ - float length; - float velocityX; - float velocityY; - - velocityY = (this->_velocity).y; - velocityX = (this->_velocity).x; - if (velocityX * velocityX + velocityY * velocityY <= 0.01) { - outForward->x = 0.0; - outForward->y = 1.0; - } - else { - velocityX = (this->_velocity).x; - outForward->y = (this->_velocity).y; - velocityY = outForward->y; - outForward->x = velocityX; - velocityX = outForward->x; - length = sqrtf(velocityY * velocityY + velocityX * velocityX); - if (0.0 < length) { - outForward->x = velocityX * (1.0 / length); - outForward->y = velocityY * (1.0 / length); - return outForward; - } - } - return outForward; -} - -// 006b6550 -Entity_Effect * Entity::MakeGroundPoof(Vector *position, ColorMod *color, float size) -{ - uint32_t rngResult; - Entity *firstPoof; - Entity *secondPoof; - int *unaff_EDI; - float fVar1; - Entity_Effect *pEVar2; - float fVar3; - uint8_t auStack_12 [14]; - int vtable; - - rngResult = Random(); - firstPoof = Game::SpawnEx(g_game,1000,0x10,position,&g_vectorZero,this,1,rngResult,0); - fVar3 = 1.4013e-45; - vtable = *GHIDRA_CAST(firstPoof); - (firstPoof->_sprite)._scale.x = size; - (firstPoof->_sprite)._scale.y = size; - pEVar2 = GHIDRA_CAST(color); - (**(code **)(vtable + 0x3c))(); - rngResult = Random(); - *GHIDRA_CAST((unaff_EDI + 0x52)) = ~(uint8_t)rngResult & 1; - (**(code **)(*unaff_EDI + 0xc))(); - rngResult = Random(); - secondPoof = Game::SpawnEx(g_game,1000,0x10,position,&g_vectorZero,this,2,rngResult,0); - fVar1 = 1.4013e-45; - vtable = *GHIDRA_CAST(secondPoof); - (secondPoof->_sprite)._scale.x = fVar3; - (secondPoof->_sprite)._scale.y = fVar3; - (**(code **)(vtable + 0x3c))(color,0xffffffff,0xff,0); - (secondPoof->_posOffset).x = 0.0; - (secondPoof->_posOffset).y = fVar1 * -40.0; - rngResult = Random(); - (secondPoof->_sprite)._flipX = ~(uint8_t)rngResult & 1; - secondPoof->Update(); - if (pEVar2->_child != 0) { - msvc::multiset::erase(auStack_12 + -0x22); - } - pEVar2->_child = secondPoof; - msvc::multiset::insert(&pEVar2->_child); - return pEVar2; -} - -// 006b66a0 -Entity_Effect * Entity::MakeGroundPoofAtSelf(ColorMod *color, float size) -{ - Entity_Effect *poof; - - poof = MakeGroundPoof(this,&this->_pos,color,size); - return poof; -} - -// 006b66c0 -Entity_Effect * Entity::MakeBloodPoof(Vector *position, ColorMod *color, float scale) -{ - uint32_t rngResult; - Entity *poof; - Entity *childPoof; - int *unaff_EDI; - float fVar1; - Entity_Effect *pEVar2; - float fVar3; - uint8_t auStack_12 [14]; - int vtable; - - rngResult = Random(); - poof = Game::SpawnEx(g_game,1000,0x10,position,&g_vectorZero,this,3,rngResult,0); - fVar3 = 1.4013e-45; - vtable = *GHIDRA_CAST(poof); - (poof->_sprite)._scale.x = scale; - (poof->_sprite)._scale.y = scale; - pEVar2 = GHIDRA_CAST(color); - (**(code **)(vtable + 0x3c))(); - rngResult = Random(); - *GHIDRA_CAST((unaff_EDI + 0x52)) = ~(uint8_t)rngResult & 1; - (**(code **)(*unaff_EDI + 0xc))(); - rngResult = Random(); - childPoof = Game::SpawnEx(g_game,1000,0x10,position,&g_vectorZero,this,4,rngResult,0); - fVar1 = 1.4013e-45; - vtable = *GHIDRA_CAST(childPoof); - (childPoof->_sprite)._scale.x = fVar3; - (childPoof->_sprite)._scale.y = fVar3; - (**(code **)(vtable + 0x3c))(color,0xffffffff,0xff,0); - (childPoof->_posOffset).x = 0.0; - (childPoof->_posOffset).y = fVar1 * -40.0; - rngResult = Random(); - (childPoof->_sprite)._flipX = ~(uint8_t)rngResult & 1; - childPoof->Update(); - if (pEVar2->_child != 0) { - msvc::multiset::erase(auStack_12 + -0x22); - } - pEVar2->_child = childPoof; - msvc::multiset::insert(&pEVar2->_child); - return pEVar2; -} - -// 006b6810 -Entity_Effect * Entity::MakeBloodPoofAtPos(ColorMod *color, float scale) -{ - Entity_Effect *pEVar1; - - pEVar1 = MakeBloodPoof(this,&this->_pos,color,scale); - return pEVar1; -} - -// 006b6af0 -Vector * Entity::GetNullOffset(Vector *outOffset, uint8_t *nullLayerName) -{ - float *nullFrame; - float fVar1; - float cosRotation; - float fVar2; - Vector offset; - - if ((this->_sprite)._animState._animData != (void *)0x0) { - nullFrame = AnimationState::GetNullFrame(&(this->_sprite)._animState,nullLayerName); - if ((nullFrame != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((nullFrame + 3)) != '\0')) { - offset.x = (*nullFrame / 0.65) * (this->_sprite)._scale.x; - offset.y = (nullFrame[1] / 0.65) * (this->_sprite)._scale.y; - if ((this->_sprite)._flipX != 0) { - offset.x = -offset.x; - } - if ((this->_sprite)._flipY != 0) { - offset.y = -offset.y; - } - fVar1 = (this->_sprite)._rotation; - if (fVar1 != 0.0) { - fVar1 = fVar1 * 0.017453292; - cosRotation = cos(fVar1); - fVar1 = sin(fVar1); - fVar2 = fVar1 * offset.y; - offset.y = cosRotation * offset.y + fVar1 * offset.x; - offset.x = cosRotation * offset.x - fVar2; - } - outOffset->x = offset.x; - outOffset->y = offset.y; - return outOffset; - } - } - fVar1 = g_vectorZero.y; - outOffset->x = g_vectorZero.x; - outOffset->y = fVar1; - return outOffset; -} - -// 006b6c20 -Capsule * Entity::GetNullCapsule(Capsule *outCapsule, uint8_t *nullLayerName) -{ - float *nullFrame; - float fVar1; - float rotatedYTerm; - float capsuleRotation; - float offsetX; - float offsetY; - Vector scratchVec; - Vector capsuleSize; - - if ((this->_sprite)._animState._animData != (void *)0x0) { - nullFrame = AnimationState::GetNullFrame(&(this->_sprite)._animState,nullLayerName); - if ((nullFrame != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((nullFrame + 3)) != '\0')) { - capsuleSize.x = (this->_sprite)._scale.x; - offsetX = (*nullFrame / 0.65) * capsuleSize.x; - capsuleSize.x = ((nullFrame[4] * 4.0) / 0.65) * capsuleSize.x; - capsuleSize.y = (this->_sprite)._scale.y; - capsuleRotation = nullFrame[0x11]; - offsetY = (nullFrame[1] / 0.65) * capsuleSize.y; - capsuleSize.y = ((nullFrame[5] * 4.0) / 0.65) * capsuleSize.y; - if ((this->_sprite)._flipX != 0) { - capsuleSize.x = -capsuleSize.x; - } - if ((this->_sprite)._flipY != 0) { - capsuleSize.y = -capsuleSize.y; - } - if (capsuleSize.x < 0.0) { - capsuleSize.x = -capsuleSize.x; - capsuleRotation = 180.0 - capsuleRotation; - offsetX = -offsetX; - } - if (capsuleSize.y < 0.0) { - capsuleSize.y = -capsuleSize.y; - offsetY = -offsetY; - capsuleRotation = -capsuleRotation; - } - fVar1 = (this->_sprite)._rotation; - if (fVar1 != 0.0) { - fVar1 = fVar1 * 0.017453292; - scratchVec.x = cos(fVar1); - fVar1 = sin(fVar1); - capsuleRotation = (this->_sprite)._rotation + capsuleRotation; - rotatedYTerm = offsetY * fVar1; - offsetY = offsetY * scratchVec.x + fVar1 * offsetX; - offsetX = scratchVec.x * offsetX - rotatedYTerm; - } - scratchVec.x = offsetX + (this->_pos).x; - scratchVec.y = offsetY + (this->_pos).y; - (GHIDRA_CAST((outCapsule)))->Capsule::constructor(&scratchVec,&capsuleSize,capsuleRotation,1.0); - return outCapsule; - } - } - (GHIDRA_CAST((outCapsule)))->Capsule::constructor(&this->_pos,&g_vectorZero,0.0,0.0); - return outCapsule; -} - -// 006b6ed0 -int * Entity::get_water_splash_variant(int *outSplash) -{ - int iVar1; - uint8_t bVar2; - bool isBelowThreshold; - bool isAtThreshold; - int entityType; - float offsetY; - - entityType = this->_type; - if (entityType == 1000) { - if (((this->_variant == 0x85) || (this->_variant == 0x86)) || (this->_variant == 0x8a)) - goto LAB_006b6fce; - if (this->_variant == 0x8e) { - if (this->_subtype == 0) { - *outSplash = 0x40; - outSplash[1] = 0; - return outSplash; - } - } - else { - if (this->_variant == 0x9e) goto LAB_006b70a1; - if (((this->_variant == 99) || (this->_variant == 0x1e)) || (this->_variant == 0x99)) - goto LAB_006b6fce; - } - iVar1 = this->_variant; - if (((iVar1 == 0xa8) || (iVar1 == 0x10)) || ((iVar1 == 0xa1 || (iVar1 == 0xbd)))) - goto LAB_006b6f7a; - } - else if (entityType == 7) goto LAB_006b704a; - if (this->_sortingLayer == 0) { -LAB_006b70a1: - *outSplash = 0x26; - outSplash[1] = 0; - return outSplash; - } - if (this->_sortingLayer == 1) { - *outSplash = 0x25; - outSplash[1] = 0; - return outSplash; - } - if (entityType == 5) { - if (this[1]._sprite._championColor._tint[2] != 0.0) { -LAB_006b6fce: - *outSplash = 0x40; - outSplash[1] = 0; - return outSplash; - } - } - else if ((((entityType == 1000) && (this->_variant == 0xf)) && (this->_spawnerType == 0x327)) && - (bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsMirrorWorld(), bVar2 == 0)) { - *outSplash = 0x1b; - outSplash[1] = -0x40000000; - return outSplash; - } - entityType = this->_type; - if (((entityType == 2) || (entityType == 9)) || (entityType == 1000)) { -LAB_006b704a: - outSplash[1] = 0x40000000; - *outSplash = 0x19; - return outSplash; - } - if (entityType == 3) { - if (this->_variant == 0x4f) goto LAB_006b704a; -LAB_006b7131: - if (entityType == 0x32f) { - offsetY = (this->_posOffset).y; - isAtThreshold = offsetY == 0.0; - isBelowThreshold = offsetY < 0.0; -LAB_006b7143: - if (!isBelowThreshold && !isAtThreshold) { - *outSplash = 0x24; - outSplash[1] = 0; - return outSplash; - } - } - else if (entityType == 0x3e) { - if (this->_variant == 3) { - offsetY = (this->_posOffset).y; - outSplash[1] = -0x40000000; - if (0.0 <= offsetY) { - *outSplash = 0x26; - return outSplash; - } - if (offsetY < -16.0) { - *outSplash = 0x19; - return outSplash; - } - *outSplash = 0x80; - return outSplash; - } - } - else if ((entityType == 1) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::HasCollectible(0x3e,0), bVar2 != 0)) { - *outSplash = 0x39; - outSplash[1] = -0x40000000; - return outSplash; - } - } - else { - if (((entityType == 0xf0) || (entityType == 0xf2)) || - ((entityType == 0xf1 || (entityType == 0x130)))) goto LAB_006b6f7a; - if (entityType == 0x21) { - if (this->_health <= 1.0) goto LAB_006b70a1; - } - else { - if (entityType == 0x32a) { - offsetY = (this->_posOffset).y; - isAtThreshold = offsetY == -3.0; - isBelowThreshold = offsetY < -3.0; - goto LAB_006b7143; - } - if (entityType == 0x32e) { - *outSplash = 0x99; - outSplash[1] = 0; - return outSplash; - } - if ((entityType == 0x366) || (entityType == 0x367)) { - *outSplash = 0x80; - outSplash[1] = 0; - return outSplash; - } - if (entityType != 0x331) goto LAB_006b7131; - if (this->_variant == 1) goto LAB_006b6f7a; - } - } - if (this->_type == 1) { - bVar2 = IsFlying(this); - if (bVar2 != 0) { -LAB_006b6f7a: - outSplash[1] = 0; - *outSplash = 0x19; - return outSplash; - } - } - else if ((((this->_type == 5) && (this->_variant == 100)) && - (this[1]._sprite._championColor._tint[2] == 0.0)) && - (((this->_sprite)._overlayAnimState._animData == (void *)0x0 || - (GHIDRA_INT((this->_sprite)._overlayAnimState._animFrame) != 0)))) { - outSplash[1] = -0x3f600000; - *outSplash = 0x19; - return outSplash; - } - outSplash[1] = -0x40000000; - *outSplash = 0x19; - return outSplash; -} - -// 006b7280 -void Entity::AddMagnetized(EntityRef *ref, int duration, uint8_t unused) -{ - uint32_t *puVar1; - uint64_t qVar2; - uint8_t bVar3; - char cVar4; - uint32_t uVar5; - Entity *statusEffect; - uint32_t uVar6; - int newCountdown; - int extraout_EDX; - Entity *statusOwner; - uint32_t *puStack_68; - EntityRef *savedRef; - EntityRef sourceRef; - ColorMod magnetColor; - uint32_t *effectParentSlot; - int oldCountdown; - Entity *parent; - - savedRef = ref; - bVar3 = IsDamageSourceFriendly(this,ref); - if (bVar3 != 0) { - return; - } - apply_second_hand_duration(this,duration,ref); - bVar3 = DoesEntityShareStatus(this); - statusOwner = this; - if (bVar3 != 0) { - statusEffect = GHIDRA_CAST(this->_parent); - statusOwner = this; - while (parent = statusEffect, parent != GHIDRA_CAST(0x0)) { - statusOwner = parent; - statusEffect = GHIDRA_CAST(parent->_parent); - } - } - if (extraout_EDX == 0) { - return; - } - if ((statusOwner->_flags & 1) != 0) { - return; - } - if (0 < statusOwner->_bossStatusEffectCooldown) { - return; - } - oldCountdown = statusOwner->_magnetizedCountdown; - if (extraout_EDX < 1) { - newCountdown = oldCountdown; - if (oldCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 300; - if (oldCountdown + extraout_EDX < 300) { - newCountdown = oldCountdown + extraout_EDX; - } - } - statusOwner->_magnetizedCountdown = newCountdown; - magnetColor._tint[0] = 0.6; - magnetColor._tint[1] = 0.6; - magnetColor._tint[2] = 0.6; - magnetColor._tint[3] = 1.0; - magnetColor._colorize[0] = 1.0; - magnetColor._colorize[1] = 1.0; - magnetColor._colorize[2] = 1.0; - magnetColor._colorize[3] = 0.9; - magnetColor._offset[0] = 0.0; - magnetColor._offset[1] = 0.0; - magnetColor._offset[2] = 0.0; - statusOwner->SetColor(&magnetColor,statusOwner->_magnetizedCountdown,0xff,0,1) - ; - qVar2 = statusOwner->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&statusOwner->_flags) + 4)); - *puVar1 = *puVar1 | 0x80000; - *GHIDRA_CAST(&statusOwner->_flags) = GHIDRA_INT(qVar2); - cVar4 = FUN_006ae7a0(); - if (cVar4 != '\0') { - statusOwner->_bossStatusEffectCooldown = 0xf0; - } - CopyStatusEffects(statusOwner); - if (statusOwner->_iceFrozenEffect == 0) { - uVar5 = Random(); - statusEffect = Game::SpawnEx(g_game,1000,0x39,&statusOwner->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar5,0); - statusOwner->_iceFrozenEffect = statusEffect; - effectParentSlot = &statusEffect->_parent; - if (statusEffect->_parent != 0) { - puStack_68 = effectParentSlot; - msvc::multiset::erase(&puStack_68); - } - *effectParentSlot = statusOwner; - msvc::multiset::insert(effectParentSlot); - ref = savedRef; - } - sourceRef._entity = ref->_entity; - if (sourceRef._entity == (void *)0x0) { - sourceRef._type = 0; -LAB_006b74a5: - sourceRef._variant = 0; - sourceRef._spawnerType = 0; - sourceRef._spawnerVariant = 0; - sourceRef._position.x = g_vectorZero.x; - sourceRef._position.y = g_vectorZero.y; - sourceRef._velocity.x = g_vectorZero.x; - sourceRef._velocity.y = g_vectorZero.y; -LAB_006b74e5: - sourceRef._flags = 0; - if (sourceRef._entity != (void *)0x0) goto LAB_006b74eb; - sourceRef._flags = 0; -LAB_006b7504: - uVar5 = 0; - if (sourceRef._entity != (void *)0x0) goto LAB_006b750a; - } - else { - while (*(void **)(GHIDRA_CAST(sourceRef._entity) + 0x3c8) != (void *)0x0) { - sourceRef._entity = *(void **)(GHIDRA_CAST(sourceRef._entity) + 0x3c8); - } - sourceRef._type = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x28)); - if (sourceRef._entity == (void *)0x0) goto LAB_006b74a5; - sourceRef._variant = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x2c)); - sourceRef._position.x = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x33c)); - sourceRef._position.y = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x340)); - sourceRef._spawnerType = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x34)); - sourceRef._spawnerVariant = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x38)); - sourceRef._velocity.x = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x360)); - sourceRef._velocity.y = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x364)); - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006b74e5; - sourceRef._flags = 1; -LAB_006b74eb: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006b7504; - uVar5 = 2; -LAB_006b750a: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x16c)) & 0x400000) != 0) { - uVar6 = 4; - goto LAB_006b7525; - } - } - uVar6 = 0; -LAB_006b7525: - sourceRef._flags = uVar6 | uVar5 | sourceRef._flags; - (GHIDRA_CAST((&this->_entityRef3)))->EntityRef::operator_(&sourceRef); - return; -} - -// 006b7560 -void Entity::AddBaited(EntityRef *ref, int duration, uint8_t unused) -{ - uint8_t bVar1; - char cVar2; - uint32_t uVar3; - int newCountdown; - int extraout_EDX; - uint32_t uVar4; - Entity *statusTarget; - uint8_t auStack_64 [4]; - EntityRef sourceRef; - uint32_t local_38; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t local_28; - uint32_t uStack_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t local_18; - uint32_t local_14; - uint32_t local_10; - uint32_t local_c; - int baitedCountdown; - uint32_t *flagsHigh; - Entity *nextParent; - uint64_t oldFlags; - Entity *parent; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_64); - bVar1 = IsDamageSourceFriendly(this,ref); - if (bVar1 != 0) { - return; - } - apply_second_hand_duration(this,duration,ref); - bVar1 = DoesEntityShareStatus(this); - statusTarget = this; - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (parent = nextParent, parent != GHIDRA_CAST(0x0)) { - statusTarget = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - } - if (extraout_EDX == 0) { - return; - } - if ((statusTarget->_flags & 1) != 0) { - return; - } - if (0 < statusTarget->_bossStatusEffectCooldown) { - return; - } - baitedCountdown = statusTarget->_baitedCountdown; - if (extraout_EDX < 1) { - newCountdown = baitedCountdown; - if (baitedCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 300; - if (baitedCountdown + extraout_EDX < 300) { - newCountdown = baitedCountdown + extraout_EDX; - } - } - statusTarget->_baitedCountdown = newCountdown; - local_38 = 0x3f333333; - uStack_34 = 0x3e0f5c29; - uStack_30 = 0x3dcccccd; - uStack_2c = 0x3f800000; - local_18 = 0x3e99999a; - local_28 = 0; - uStack_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - local_14 = 0; - local_10 = 0; - statusTarget->SetColor(&local_38,statusTarget->_baitedCountdown,0xff,0,1); - oldFlags = statusTarget->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&statusTarget->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x100000; - *GHIDRA_CAST(&statusTarget->_flags) = GHIDRA_INT(oldFlags); - cVar2 = FUN_006ae7a0(); - if (cVar2 != '\0') { - statusTarget->_bossStatusEffectCooldown = 0xf0; - } - CopyStatusEffects(statusTarget); - sourceRef._entity = ref->_entity; - if (sourceRef._entity == (void *)0x0) { - sourceRef._type = 0; -LAB_006b7715: - sourceRef._variant = 0; - sourceRef._spawnerType = 0; - sourceRef._spawnerVariant = 0; - sourceRef._position.x = g_vectorZero.x; - sourceRef._position.y = g_vectorZero.y; - sourceRef._velocity.x = g_vectorZero.x; - sourceRef._velocity.y = g_vectorZero.y; -LAB_006b7755: - sourceRef._flags = 0; - if (sourceRef._entity != (void *)0x0) goto LAB_006b775b; - sourceRef._flags = 0; -LAB_006b7774: - uVar4 = 0; - if (sourceRef._entity != (void *)0x0) goto LAB_006b777a; - } - else { - while (*(void **)(GHIDRA_CAST(sourceRef._entity) + 0x3c8) != (void *)0x0) { - sourceRef._entity = *(void **)(GHIDRA_CAST(sourceRef._entity) + 0x3c8); - } - sourceRef._type = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x28)); - if (sourceRef._entity == (void *)0x0) goto LAB_006b7715; - sourceRef._variant = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x2c)); - sourceRef._position.x = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x33c)); - sourceRef._position.y = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x340)); - sourceRef._spawnerType = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x34)); - sourceRef._spawnerVariant = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x38)); - sourceRef._velocity.x = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x360)); - sourceRef._velocity.y = *GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x364)); - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006b7755; - sourceRef._flags = 1; -LAB_006b775b: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006b7774; - uVar4 = 2; -LAB_006b777a: - if ((*GHIDRA_CAST((GHIDRA_CAST(sourceRef._entity) + 0x16c)) & 0x400000) != 0) { - uVar3 = 4; - goto LAB_006b7795; - } - } - uVar3 = 0; -LAB_006b7795: - sourceRef._flags = uVar3 | uVar4 | sourceRef._flags; - (GHIDRA_CAST((&this->_entityRef4)))->EntityRef::operator_(&sourceRef); - return; -} - -// 006b77d0 -void Entity::AddWeakness(EntityRef *ref, int duration) -{ - uint8_t bVar1; - int newCountdown; - int extraout_EDX; - ColorMod weaknessColor; - Entity *ancestor; - uint32_t *flagsHigh; - Entity *nextParent; - int oldCountdown; - uint64_t oldFlags; - - bVar1 = IsDamageSourceFriendly(this,ref); - if (bVar1 == 0) { - apply_second_hand_duration(this,-3,ref); - bVar1 = DoesEntityShareStatus(this); - if (bVar1 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - if (extraout_EDX != 0) { - oldCountdown = this->_weaknessCountdown; - if (extraout_EDX < 1) { - newCountdown = oldCountdown; - if (oldCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 300; - if (oldCountdown + extraout_EDX < 300) { - newCountdown = oldCountdown + extraout_EDX; - } - } - this->_weaknessCountdown = newCountdown; - weaknessColor._tint[0] = 1.0; - weaknessColor._tint[1] = 1.0; - weaknessColor._tint[2] = 1.0; - weaknessColor._tint[3] = 1.0; - weaknessColor._colorize[0] = 1.3; - weaknessColor._colorize[1] = 0.9; - weaknessColor._colorize[2] = 1.5; - weaknessColor._colorize[3] = 0.6; - weaknessColor._offset[0] = 0.0; - weaknessColor._offset[1] = 0.0; - weaknessColor._offset[2] = 0.0; - this->SetColor(&weaknessColor,this->_weaknessCountdown,0xff,0,1); - oldFlags = this->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x400000; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(oldFlags); - CopyStatusEffects(this); - } - } - return; -} - -// 006b78d0 -void Entity::AddBrimstoneMark(EntityRef *ref, int duration) -{ - uint32_t *puVar1; - uint64_t qVar2; - uint8_t bVar3; - int newCountdown; - int extraout_EDX; - uint32_t markColor; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t uStack_28; - uint32_t local_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t uStack_18; - uint32_t local_14; - uint32_t local_10; - uint32_t local_c; - uint32_t local_8; - Entity *ancestor; - int currentCountdown; - Entity *nextParent; - - local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - bVar3 = IsDamageSourceFriendly(this,ref); - if (bVar3 == 0) { - apply_second_hand_duration(this,duration,ref); - bVar3 = DoesEntityShareStatus(this); - if (bVar3 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - if (extraout_EDX != 0) { - currentCountdown = this->_brimstoneMarkCountdown; - if (extraout_EDX < 1) { - newCountdown = currentCountdown; - if (currentCountdown < -extraout_EDX) { - newCountdown = -extraout_EDX; - } - } - else { - newCountdown = 300; - if (currentCountdown + extraout_EDX < 300) { - newCountdown = currentCountdown + extraout_EDX; - } - } - this->_brimstoneMarkCountdown = newCountdown; - markColor = 0x3f800000; - uStack_30 = 0x3f800000; - uStack_2c = 0x3f800000; - uStack_28 = 0x3f800000; - local_24 = 0x3f800000; - uStack_20 = 0; - uStack_1c = 0; - uStack_18 = 0x3e4ccccd; - local_14 = 0; - local_10 = 0; - local_c = 0; - this->SetColor(&markColor,this->_brimstoneMarkCountdown,0xff,0,1); - qVar2 = this->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 | 0x1000000; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(qVar2); - CopyStatusEffects(this); - } - } - return; -} - -// 006b79d0 -void Entity::AddIce(EntityRef *ref, int duration) -{ - uint32_t *puVar1; - uint64_t qVar2; - uint8_t bVar3; - char cVar4; - int newIceCountdown; - int extraout_EDX; - Entity *ancestor; - Entity *nextParent; - int oldIceCountdown; - - bVar3 = IsDamageSourceFriendly(this,ref); - if ((bVar3 == 0) && (cVar4 = this->IsBoss(), cVar4 == '\0')) { - apply_second_hand_duration(this,duration,ref); - bVar3 = DoesEntityShareStatus(this); - if (bVar3 != 0) { - nextParent = GHIDRA_CAST(this->_parent); - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - this = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - oldIceCountdown = this->_iceCountdown; - if (extraout_EDX < 1) { - newIceCountdown = oldIceCountdown; - if (oldIceCountdown < -extraout_EDX) { - newIceCountdown = -extraout_EDX; - } - } - else { - newIceCountdown = 300; - if (oldIceCountdown + extraout_EDX < 300) { - newIceCountdown = oldIceCountdown + extraout_EDX; - } - } - this->_iceCountdown = newIceCountdown; - qVar2 = this->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 | 0x40000; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(qVar2); - CopyStatusEffects(this); - } - return; -} - -// 006b7be0 -Entity_NPC * Entity::GiveMinecart(Vector *position, Vector *velocity) -{ - uint32_t *puVar1; - Vector *pos; - uint32_t seed; - Entity_NPC *minecart; - Vector *minecartVelocity; - float velocityY; - - seed = Random(); - pos = position; - minecart = GHIDRA_CAST(Game)::Spawn(g_game,0x3c5,0,position,&g_vectorZero,GHIDRA_CAST(0x0),0,seed); - minecartVelocity = velocity; - (minecart->_v2).x = 1.0; - (GHIDRA_CAST((minecart)))->Entity_NPC::SetMinecartPosVel(pos,velocity); - minecart->Update(); - velocityY = minecartVelocity->y; - puVar1 = &this->_minecart; - (minecart->_targetPosition).x = minecartVelocity->x; - (minecart->_targetPosition).y = velocityY; - if (GHIDRA_CAST(*puVar1) != minecart) { - if (GHIDRA_CAST(*puVar1) != GHIDRA_CAST(0x0)) { - position = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&position); - } - *puVar1 = minecart; - msvc::multiset::insert(puVar1); - } - puVar1 = &minecart->_child; - if (minecart->_child != 0) { - position = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&position); - } - *puVar1 = this; - if (this != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(puVar1); - } - return minecart; -} - -// 006b9740 -uint8_t Entity::IsPlayerInRadius(Vector *position, float radius, int unused1, int unused2) -{ - int *playerSlot; - void *playerListEnd; - Game *game; - PlayerManager *playerManager; - uint64_t *allocatedBytes; - uint32_t uVar1; - float dx; - float dy; - float radiusSq; - uint8_t nearbyEntities [12]; - uint32_t uStack_20; - float queryRadius; - float savedRadiusSq; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int nearbyEntity; - uint64_t prevAllocatedBytes; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afa5b0; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (((this->_flags & 0x20000000) == 0) && (0.0 < radius)) { - uVar1 = 0; - playerManager = &g_game->_playerManager; - radiusSq = radius * radius; - game = g_game; - queryRadius = radius; - savedRadiusSq = radiusSq; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - playerListEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - game = g_game; - radiusSq = savedRadiusSq; - } - playerSlot = (playerManager->_playerList)._begin; - if (uVar1 < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + uVar1; - } - dy = position->y - *GHIDRA_CAST((*playerSlot + 0x340)); - dx = position->x - *GHIDRA_CAST((*playerSlot + 0x33c)); - if (dy * dy + dx * dx < radiusSq) { - ExceptionList = local_10; - return 1; - } - playerManager = &game->_playerManager; - uVar1 = uVar1 + 1; - } while (uVar1 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST(nearbyEntities),position, - queryRadius,1); - uVar1 = 0; - if (uStack_20 != 0) { - do { - nearbyEntity = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) + uVar1 * 4)); - if (((nearbyEntity != 0) && (*GHIDRA_CAST((nearbyEntity + 0x28)) == 3)) && - (*GHIDRA_CAST((nearbyEntity + 0x2c)) == 0x3e)) { - if (nearbyEntities[0] == '\0') { - local_8 = 0; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)nearbyEntities)) + 0x4))),0); - } - ExceptionList = local_10; - return 1; - } - uVar1 = uVar1 + 1; - } while (uVar1 < uStack_20); - } - if (nearbyEntities[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&((void *)nearbyEntities)) + 0x4))) != (void *)0x0) { - uVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar1; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar1)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) + -4)); - } - } - } - ExceptionList = local_10; - return 0; -} - -// 006d7d60 -uint8_t Entity::IsHostileTo(Entity *other) -{ - uint8_t isHostile; - uint64_t flags; - int otherType; - - flags = this->_flags; - if ((flags & 0x100) == 0) { - if ((flags & 0x20000000) == 0) { - isHostile = 1; - goto LAB_006d7da5; - } - } - else if ((flags & 0x20000000) == 0) { - return 1; - } - isHostile = 0; -LAB_006d7da5: - otherType = other->_type; - if ((((otherType == 1) || (otherType == 4)) || - ((otherType == 3 && ((other->_flags & 0x100) == 0)))) || ((other->_flags & 0x20000000) != 0)) - { - return isHostile; - } - return isHostile ^ 1; -} - -// 006d8990 -uint8_t Entity::is_valid_target() -{ - int iVar1; - Entity_NPC *pEVar2; - uint8_t bVar3; - int entityType; - Entity_NPC *ancestor; - Entity_NPC *extraout_EDX; - Entity_NPC *rootEntity; - bool isExcludedType; - - iVar1 = *GHIDRA_CAST(&g_game->_deathmatchManager); - if ((iVar1 < 2) || (this->_type != 1)) { - entityType = this->_type; - if (0x3dd < entityType - 10U) { - return 0; - } - if (entityType == 0x21) { - return 0; - } - if (entityType == 0x11) { - return 0; - } - if (entityType == 0x124) { - return 0; - } - if (entityType == 0x375) { - isExcludedType = this->_variant == 10; - } - else { - if (entityType == 0x3c0) { - return 0; - } - if (entityType == 0x3c5) { - return 0; - } - isExcludedType = entityType == 0xf5; - } - if (isExcludedType) { - return 0; - } - } - else { - entityType = 1; - } - if (this->_dead != 0) { - return 0; - } - if (entityType == 0xde) { -LAB_006d8ad0: - rootEntity = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_NPC::ParentNPC(); - } - else { - if (entityType == 0x119) { - ancestor = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_NPC::ParentNPC(); - if (ancestor == GHIDRA_CAST(0x0)) goto LAB_006d8add; - goto LAB_006d8ad0; - } - if (entityType == 0x364) { - rootEntity = GHIDRA_CAST(this->_parent); - ancestor = GHIDRA_CAST(this); - while (pEVar2 = rootEntity, pEVar2 != GHIDRA_CAST(0x0)) { - ancestor = pEVar2; - rootEntity = GHIDRA_CAST(pEVar2->_parent); - } - if (((iVar1 < 2) || (ancestor->_type != 1)) && (0x3dd < ancestor->_type - 10U)) { - ancestor = GHIDRA_CAST(0x0); - } - rootEntity = GHIDRA_CAST(this); - if (ancestor != GHIDRA_CAST(0x0)) { - rootEntity = ancestor; - } - } - else { - bVar3 = DoesEntityShareStatus(this); - rootEntity = extraout_EDX; - if (bVar3 != 0) { - ancestor = GHIDRA_CAST(this->_parent); - rootEntity = extraout_EDX; - while (pEVar2 = ancestor, pEVar2 != GHIDRA_CAST(0x0)) { - rootEntity = pEVar2; - ancestor = GHIDRA_CAST(pEVar2->_parent); - } - } - if ((rootEntity == GHIDRA_CAST(0x0)) || - (((iVar1 < 2 || (rootEntity->_type != 1)) && (0x3dd < rootEntity->_type - 10U)))) { - rootEntity = GHIDRA_CAST(0x0); - } - } - } - if (rootEntity != GHIDRA_CAST(this)) { - return 0; - } -LAB_006d8add: - if (((this->_dead == 0) && (this[3]._bleedDamageAccumulator == -NAN)) && - (bVar3 = HasEntityFlags(this,0x200000000000), bVar3 == 0)) { - return 1; - } - return 0; -} - -// 006ef400 -int Entity::SpawnGridIndex() -{ - return this->_spawnGridIndex; -} - -// 007079c0 -void Entity::RemoveWithPoof(Entity *entity, int unusedArg) -{ - char isBoss; - uint32_t seed; - Entity *pEVar1; - Vector poofPos; - ColorMod poofColor; - - if (entity->_type != 0x3b6) { - seed = Random(); - poofPos.x = (entity->_pos).x; - poofPos.y = (entity->_pos).y; - pEVar1 = Game::SpawnEx(g_game,1000,0xf,&poofPos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - poofColor._offset[0] = 0.2; - poofColor._tint[0] = 1.0; - poofColor._tint[1] = 0.6; - poofColor._tint[2] = 0.9; - poofColor._tint[3] = 1.0; - poofColor._offset[1] = 0.15; - poofColor._offset[2] = 0.18; - poofColor._colorize[0] = 0.0; - poofColor._colorize[1] = 0.0; - poofColor._colorize[2] = 0.0; - poofColor._colorize[3] = 0.0; - pEVar1->SetColor(&poofColor,0xffffffff,0xff,0,1); - pEVar1->Update(); - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (entity->_type == 1)) || - (entity->_type - 10U < 0x3de)) { - isBoss = entity->IsBoss(); - if (isBoss != '\0') { - (GHIDRA_CAST((g_game->_room)))->Room::TriggerBossDeath(entity); - } - } - entity->Remove(); - } - return; -} - -// 0070c000 -void Entity::DestroyRockGridAt(Vector *position, GridEntityDesc *desc, Entity *source, int backdropType) -{ - int poopVariant; - uint8_t isAnimSet; - ColorMod *Color; - ColorMod *Color_00; - uint32_t uVar1; - EntityRef *source_00; - Entity *pEVar2; - char *name; - uint8_t *anim; - uint32_t extraout_ECX; - Vector *pVVar3; - ANM2 *this; - uint32_t uVar4; - int GridEntityType; - float spreadFactor; - ANM2 sourceSprite; - EntityRef dropSource; - Vector rubblePos; - Vector rubbleVelocity; - Vector *positionLocal; - int rubbleLeft; - int gridTypeCopy; - float local_60; - Entity *local_5c; - float local_58; - int variantCopy; - GridEntityDesc *gridDesc; - float local_4c; - uint32_t local_48; - char isNormalRock; - Color local_40; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - float local_8; - - local_8 = -NAN; - puStack_c = &LAB_00afc780; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((&local_40)[1]._colorize); - GridEntityType = desc->_type; - poopVariant = desc->_variant; - positionLocal = position; - gridTypeCopy = GridEntityType; - variantCopy = poopVariant; - gridDesc = desc; - if (GridEntityType == 5) { - ExceptionList = &local_10; - ::(GHIDRA_CAST((&local_40)))->Color::Color(); - Game::BombExplosionEffects(g_game,position,60.0,(BitSet128)ZEXT816(0),Color,source,1.0,1,4,0); - ExceptionList = local_10; - return; - } - if (GridEntityType == 0xc) { - ExceptionList = &local_10; - ::(GHIDRA_CAST((&local_40)))->Color::Color(); - Game::BombExplosionEffects(g_game,position,60.0,(BitSet128)ZEXT816(0),Color_00,source,1.0,1,4,0) - ; - spawn_rock_particles(); - FUN_0071f4b0(gridDesc->_spawnSeed,extraout_ECX); - ExceptionList = local_10; - return; - } - if ((((GridEntityType == 2) || (GridEntityType == 4)) || (GridEntityType == 6)) || - (((GridEntityType == 0x16 || (GridEntityType == 0x1a)) || (GridEntityType == 0x1b)))) { - ExceptionList = &local_10; - GridEntity_Rock::PlayBreakSound(GridEntityType,backdropType); - isNormalRock = '\x01'; - if (variantCopy == 9000) { - local_48 = 0x10001; - isNormalRock = '\0'; - } - else { - if ((GridEntityType == 6) || (local_48 = 1, GridEntityType == 0x1a)) { - local_48 = 2; - } - GridEntity_Rock::RegisterRockDestroyed(GridEntityType); - } - rubbleLeft = 4; - do { - uVar4 = Random(); - local_58 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 360.0 * 0.017453292; - local_4c = sin(local_58); - local_60 = cos(local_58); - local_58 = local_60 * 12.0; - local_5c = GHIDRA_CAST((local_4c * 12.0)); - uVar4 = Random(); - spreadFactor = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10; - rubblePos.y = spreadFactor * (float)local_5c + position->y; - rubblePos.x = spreadFactor * local_58 + position->x; - uVar4 = Random(); - rubbleVelocity.x = local_60 * 5.0; - rubbleVelocity.y = local_4c * 5.0; - pEVar2 = Game::SpawnEx(g_game,1000,4,&rubblePos,&rubbleVelocity,GHIDRA_CAST(0x0),local_48,uVar4,0 - ); - local_5c = pEVar2; - if (isNormalRock != '\0') { - if (source != GHIDRA_CAST(0x0)) { - ANM2::ANM2(&sourceSprite,&source->_sprite); - Isaac::SwapANM2(&pEVar2->_sprite,&sourceSprite); - local_8 = 0.0; - ANM2::Reset(this); - AnimationState::~AnimationState(&sourceSprite._overlayAnimState); - AnimationState::~AnimationState(&sourceSprite._animState); - (GHIDRA_CAST((sourceSprite._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&sourceSprite))))->msvc::string::_Tidy_deallocate(); - local_8 = -NAN; - } - if ((GridEntityType == 6) || (name = "rubble", GridEntityType == 0x1a)) { - name = "rubble_alt"; - } - anim = ANM2::GetAnimationData(&pEVar2->_sprite,GHIDRA_CAST(name)); - if (anim != GHIDRA_CAST(0x0)) { - local_60 = *GHIDRA_CAST((anim + 0x30)); - if (local_60 == 0.0) { - local_4c = 0.0; - } - else { - uVar4 = Random(); - local_4c = (float)(uVar4 % GHIDRA_UINT(local_60)); - } - if (0xf < *GHIDRA_CAST((anim + 0x14))) { - anim = *GHIDRA_CAST(anim); - } - isAnimSet = ANM2::SetAnimation(&pEVar2->_sprite,anim,1); - if (((isAnimSet != 0) && ((pEVar2->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(pEVar2->_sprite)._animState,(float)GHIDRA_INT(local_4c)), - (pEVar2->_sprite)._animState._animData != (void *)0x0)) { - (pEVar2->_sprite)._animState._isPlaying = 0; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_5c[1])) + 0x40)))) = 1; - GridEntityType = gridTypeCopy; - } - rubbleLeft = rubbleLeft + -1; - position = positionLocal; - } while (rubbleLeft != 0); - if (isNormalRock == '\0') { - ExceptionList = local_10; - return; - } - GridEntity_Rock::SpawnDrops - (positionLocal,GridEntityType,variantCopy,gridDesc->_spawnSeed,1,backdropType,source); - ExceptionList = local_10; - return; - } - if (GridEntityType != 0xe) { - return; - } - if (source == GHIDRA_CAST(0x0)) { - local_40._tint[1] = 0.0; - local_40._tint[2] = 0.0; - local_40._tint[3] = 0.0; - local_40._colorize[0] = 0.0; - local_40._colorize[1] = g_vectorZero.x; - local_40._colorize[2] = g_vectorZero.y; - local_40._colorize[3] = g_vectorZero.x; - local_40._offset[0] = g_vectorZero.y; -LAB_0070c1f2: - uVar4 = 0; - if (source != GHIDRA_CAST(0x0)) goto LAB_0070c1f8; - uVar4 = 0; -LAB_0070c213: - local_48 = 0; - pVVar3 = position; - if (source != GHIDRA_CAST(0x0)) goto LAB_0070c21e; - } - else { - local_40._tint[1] = (float)source->_type; - local_40._colorize[1] = (source->_pos).x; - local_40._colorize[2] = (source->_pos).y; - local_40._tint[2] = (float)source->_variant; - local_40._tint[3] = (float)source->_spawnerType; - local_40._colorize[0] = (float)source->_spawnerVariant; - local_40._colorize[3] = (source->_velocity).x; - local_40._offset[0] = (source->_velocity).y; - if ((source->_flags & 0x100) == 0) goto LAB_0070c1f2; - uVar4 = 1; -LAB_0070c1f8: - if ((source->_flags & 0x20000000) == 0) goto LAB_0070c213; - local_48 = 2; -LAB_0070c21e: - pVVar3 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(&source->_flags) + 4)) & 0x400000)); - if (pVVar3 != GHIDRA_CAST(0x0)) { - uVar1 = 4; - goto LAB_0070c239; - } - } - uVar1 = 0; -LAB_0070c239: - local_40._offset[1] = (float)(uVar1 | local_48 | uVar4); - local_40._offset[2] = (float)source; - ExceptionList = &local_10; - spawn_poop_rewards(desc->_spawnSeed,desc->_state,1000,0,pVVar3,local_40._tint + 1,local_14); - GridEntity_Poop::destroy_effects(); - GridEntity_Poop::spawn_hit_gibs(position,poopVariant,4); - source_00 = (GHIDRA_CAST((&dropSource)))->EntityRef::EntityRef(); - GridEntity_Poop::spawn_drops - (position,poopVariant,gridDesc->_spawnSeed,gridDesc->_varData == 1,1,source_00); - ExceptionList = local_10; - return; -} - -// 007536f0 -int Entity::RenderZOffset() -{ - return this->_renderZOffset; -} - -// 007e9130 -int Entity::GetBossID() -{ - if (this->_config == (void *)0x0) { - return 0; - } - return *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x30)); -} - -// 0085dca0 -uint8_t Entity::FlipX() -{ - return (this->_sprite)._flipX; -} - -// 0085dcb0 -void Entity::SetSpriteFrame(std_string *animName, int frame) -{ - uint8_t isAnimationSet; - - if (0xf < animName->_capacity) { - animName = *GHIDRA_CAST(animName->_buf); - } - isAnimationSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(animName),1); - if ((isAnimationSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)frame); - if ((this->_sprite)._animState._animData != (void *)0x0) { - (this->_sprite)._animState._isPlaying = 0; - } - } - return; -} - -// 0085dd00 -void Entity::SetSpriteOverlayFrame(std_string *anim, int frame) -{ - uint8_t isAnimationSet; - - if (0xf < anim->_capacity) { - anim = *GHIDRA_CAST(anim->_buf); - } - isAnimationSet = ANM2::SetOverlayAnimation(&this->_sprite,GHIDRA_CAST(anim),1); - if ((isAnimationSet != 0) && ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_sprite)._overlayAnimState,(float)frame); - } - return; -} - -// 0085dd40 -Vector * Entity::SizeMulti(Vector *outResult) -{ - float sizeMultiY; - - sizeMultiY = (this->_sizeMulti).y; - outResult->x = (this->_sizeMulti).x; - outResult->y = sizeMultiY; - return outResult; -} - -// 0085e680 -uint32_t Entity::IsVulnerableEnemy_lua(void *param_1) -{ - uint8_t isVulnerable; - int sourceRef; - int luaType; - Entity *source; - void *sourceLuaRef; - int local_1c; - Entity *local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b03acd; - local_10 = ExceptionList; - ExceptionList = &local_10; - lua_pushvalue(param_1,2,__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U); - sourceLuaRef = param_1; - sourceRef = luaL_ref(param_1,0xfff0b9d8); - local_8 = 0; - local_1c = sourceRef; - if (sourceRef != -1) { - (GHIDRA_CAST((&sourceLuaRef)))->LuaRef::push(param_1); - luaType = lua_type(param_1,0xffffffff); - lua_settop(param_1,0xfffffffe); - if (luaType != 0) { - source = GHIDRA_CAST(luabridge)::LuaRef::cast(); - goto LAB_0085e70a; - } - } - source = GHIDRA_CAST(0x0); -LAB_0085e70a: - isVulnerable = IsVulnerableEnemy(local_18,source); - lua_pushboolean(param_1,isVulnerable); - luaL_unref(param_1,0xfff0b9d8,sourceRef); - ExceptionList = local_10; - return 1; -} - -// 00866060 -void Entity::ReleaseLuaRef(Entity *entity) -{ - uint32_t uStack_40; - uint32_t callbackLuaState; - uint32_t callbackId; - int entityType; - uint32_t entityRefState; - uint32_t entityRefId; - uint8_t *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - puStack_c = &LAB_00b04530; - local_10 = ExceptionList; - uStack_40 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - local_14 = GHIDRA_CAST(&uStack_40); - ExceptionList = &local_10; - callbackId = 0x43; - callbackLuaState = *GHIDRA_CAST((GHIDRA_CAST(g_luaEngine) + 0x10)); - entityType = entity->_type; - if ((*GHIDRA_CAST((*GHIDRA_CAST(g_luaEngine) + 8)) & 8) != 0) { - local_8 = 0; - lua_callback_run_entity(&callbackLuaState,&entityRefState,entityType,entity); - luaL_unref(entityRefState,0xfff0b9d8,entityRefId); - } - ExceptionList = local_10; - return; -} - -// 00871f90 -long double Entity::Size(int param_1) -{ - return (long double)*GHIDRA_CAST((param_1 + 0x370)); -} - -// 008c5cf2 -void Entity::KillWithSource() -{ - /* WARNING: Could not recover jumptable at 0x008c5cf4. Too many branches */ - /* WARNING: Treating indirect jump as call */ - this->Kill(); - return; -} diff --git a/generated-src/entity_bomb.cpp b/generated-src/entity_bomb.cpp deleted file mode 100644 index dd59d2d..0000000 --- a/generated-src/entity_bomb.cpp +++ /dev/null @@ -1,2512 +0,0 @@ -#include "classes.h" - -// 004316a0 -uint8_t Entity_Bomb::IsFetus() -{ - return this->_isFetus; -} - -// 00452c40 -void Entity_Bomb::SetExplosionCountdown(int countdown) -{ - this->_explosionCountdown1 = countdown; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x414)))) = countdown; - return; -} - -// 005cd560 -BitSet128 * Entity_Bomb::Flags(BitSet128 *outResult) -{ - uint32_t uVar1; - uint32_t uVar2; - uint64_t qVar3; - - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - qVar3 = (this->_tearFlags)._h; - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *GHIDRA_CAST(&outResult->_l) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&outResult->_l) + 4)) = uVar1; - *GHIDRA_CAST(&outResult->_h) = GHIDRA_INT(qVar3); - *GHIDRA_CAST((GHIDRA_INT(&outResult->_h) + 4)) = uVar2; - return outResult; -} - -// 0060cdc0 -long double Entity_Bomb::RadiusMultiplier() -{ - return (long double)this->_radiusMultiplier; -} - -// 006a2030 -uint8_t Entity_Bomb::IsRocket() -{ - if ((this->_variant == 0x13) || (this->_variant == 0x14)) { - return 1; - } - return 0; -} - -// 006a2050 -void Entity_Bomb::Init(int type, int variant, int subType, uint32_t initSeed) -{ - code *pcVar1; - uint8_t bVar2; - uint32_t uVar3; - uint8_t *curAnimName; - LayerState *pLVar4; - uint8_t *expectedAnimName; - std_string *a; - uint32_t size; - void *ptr; - bool isLess; - uint8_t *pbVar5; - uint8_t *layerIndex; - ColorMod floorTint; - KColor floorColor; - std_string layerName; - uint32_t flagsHi; - int variantLocal; - - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Init(type,variant,subType,initSeed); - variantLocal = this->_variant; - this->_explosionDamage = 100.0; - this->_explosionCountdown1 = 0x2d; - this->_updateDelay = 0; - this->_scatterTimer = 0; - if ((((variantLocal == 3) || (variantLocal == 4)) || (variantLocal == 8)) || - (variantLocal == 0x12)) { - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar3; - (this->_dropRNG)._seed = uVar3; - this->_explosionCountdown1 = this->_explosionCountdown1 + uVar3 % 0x1e; - } - variantLocal = this->_variant; - if (variantLocal == 0xf) { - this->_explosionCountdown1 = 0x5e; - this->_explosionDamage = 20.0; - } - else if ((variantLocal == 0x11) || (variantLocal == 0x14)) { - this->_explosionCountdown1 = 0x57; - this->_explosionDamage = 300.0; - } - this->_scale = 1.0; - this->_rocketSpeed = 0.0; - this->_fallAcceleration = 0.0; - this->_entityGridCollisionClass = 5; - this->_collisionCooldown = 4; - this->_parentCollisionCooldown = 4; - this->_isFetus = 0; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - this->_prismTouched = 0; - this->_bounceCount = 0; - this->_fallSpeed = 0.0; - this->_radiusMultiplier = 1.0; - this->_stickyTarget = 0; - if (this->_config != (void *)0x0) { - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); - } - (this->_hitList)._end = (this->_hitList)._begin; - variantLocal = this->_variant; - this->_hasCostumes = 0; - this->_loadCostumes = 0; - if (variantLocal == 2) { - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - curAnimName = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - curAnimName = *GHIDRA_CAST(pbVar5); - } - expectedAnimName = s_Idle; - do { - bVar2 = *curAnimName; - isLess = bVar2 < *expectedAnimName; - if (bVar2 != *expectedAnimName) { -LAB_006a2260: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_006a2265; - } - if (bVar2 == 0) break; - bVar2 = curAnimName[1]; - isLess = bVar2 < expectedAnimName[1]; - if (bVar2 != expectedAnimName[1]) goto LAB_006a2260; - curAnimName = curAnimName + 2; - expectedAnimName = expectedAnimName + 2; - } while (bVar2 != 0); - uVar3 = 0; -LAB_006a2265: - if ((uVar3 == 0) && ((pbVar5[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_006a2468; - } - pbVar5 = s_Idle; - } - else if (((variantLocal == 4) || (variantLocal == 3)) || - ((variantLocal == 8 || ((variantLocal == 0x11 || (variantLocal == 0x12)))))) { - if (this->_subtype == 1) { - bVar2 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("BombReturn"),1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - (GHIDRA_CAST((g_game->_room)))->Room::GetFloorColorAt(&floorColor,&this->_pos,this->_size); - floorTint._tint[0] = floorColor._red * 2.0; - floorTint._offset[0] = 0.0; - floorTint._offset[1] = 0.0; - floorTint._offset[2] = 0.0; - floorTint._tint[1] = floorColor._green * 2.0; - floorTint._tint[3] = 1.0; - layerIndex = GHIDRA_CAST(0x0); - floorTint._tint[2] = floorColor._blue * 2.0; - if ((this->_sprite)._layerCount != 0) { - do { - pLVar4 = ANM2::GetLayer(&this->_sprite,layerIndex); - if (pLVar4->_layerData == (void *)0x0) { - layerName._buf[0] = '\0'; - layerName._buf[1] = '\0'; - layerName._buf[2] = '\0'; - layerName._buf[3] = '\0'; - layerName._capacity = 0xf; - layerName._size = 0; - } - else { - (GHIDRA_CAST((layerName._buf)))->msvc::string::string((void *)(GHIDRA_INT(pLVar4->_layerData) + 8)); - } - uVar3 = layerName._capacity; - flagsHi = (*GHIDRA_CAST((GHIDRA_CAST(&(layerName._buf)) + 0x0))); - a = &layerName; - if (0xf < layerName._capacity) { - a = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(layerName._buf))) + 0x0))); - } - bVar2 = str_eq(GHIDRA_CAST(a),layerName._size,&DAT_00b1d57c,4); - if (0xf < uVar3) { - size = uVar3 + 1; - ptr = (void *)flagsHi; - if (0xfff < size) { - ptr = *(void **)(flagsHi + -4); - size = uVar3 + 0x24; - if (0x1f < (flagsHi - GHIDRA_INT(ptr)) - 4U) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,size); - } - if ((bVar2 != 0) && (&pLVar4->_color != &floorTint)) { - (pLVar4->_color)._tint[0] = floorTint._tint[0]; - (pLVar4->_color)._tint[1] = floorTint._tint[1]; - (pLVar4->_color)._tint[2] = floorTint._tint[2]; - (pLVar4->_color)._tint[3] = floorTint._tint[3]; - (pLVar4->_color)._colorize[0] = 0.0; - (pLVar4->_color)._colorize[1] = 0.0; - (pLVar4->_color)._colorize[2] = 0.0; - (pLVar4->_color)._colorize[3] = 0.0; - (pLVar4->_color)._offset[0] = floorTint._offset[0]; - (pLVar4->_color)._offset[1] = floorTint._offset[1]; - (pLVar4->_color)._offset[2] = floorTint._offset[2]; - } - layerIndex = layerIndex + 1; - } while (layerIndex < GHIDRA_CAST((this->_sprite)._layerCount)); - } - goto LAB_006a2468; - } - pbVar5 = GHIDRA_CAST("Appear"); - } - else { - pbVar5 = GHIDRA_CAST("Pulse"); - } - bVar2 = ANM2::SetAnimation(&this->_sprite,pbVar5,1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_006a2468: - this->_rocketAngle = 0.0; - this->_isSkipNextUpdate = 0; - if ((this->_variant == 0x13) || (this->_variant == 0x14)) { - flagsHi = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x4000000; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHi; - (this->_posOffset).y = -14.0; - } - FUN_00861ea0(this); - return; -} - -// 006a24d0 -void Entity_Bomb::Update() -{ - BitSet128 BVar1; - void *pvVar2; - uint8_t *puVar3; - uint8_t bVar4; - BitSet128 *pBVar5; - uint32_t uVar6; - Entity *spawned; - float *volumeScalePtr; - int iVar7; - BitSet128 *maskedFlags; - Vector *tmpVecPtr; - int *effect; - uint32_t rngResult; - RNG *trinketRng; - Entity_Player *pEVar8; - uint32_t extraout_EAX; - Entity_Bomb *trinketRng; - char extraout_DL; - char isBouncyReg; - int extraout_EDX; - int *extraout_EDX_00; - uint8_t *costumeLoaded; - float oldFallSpeed; - float fVar9; - uint8_t auVar10 [16]; - float fallSpeed; - uint8_t auVar11 [12]; - uint8_t auVar12 [16]; - float fVar13; - float fVar14; - float height; - float fVar15; - float minBounceSpeed; - uint32_t uVar16; - TypeDescriptor *pTVar17; - TypeDescriptor *pTVar18; - uint32_t uVar19; - BitSet128 local_110; - BitSet128 local_100; - Vector scratchVec; - uint8_t local_e8 [8]; - Vector local_e0; - Vector scratchVec2; - Entity_Bomb *bomb; - Vector local_cc; - float rocketAngle; - RNG local_c0; - Entity_Player *spawner; - Entity *local_ac; - char isBouncy; - float local_a4; - uint8_t local_a0 [8]; - Vector VStack_98; - float local_8c; - Entity_Player *local_88; - uint8_t *local_84; - Entity_Player *local_80; - Color smokeColor; - EntityRef sourceRef; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint32_t *entityFlagsHi; - uint64_t flagsHigh; - uint64_t flagsLow; - Game *game; - Manager *manager; - float *scalePtr; - int stickyTarget; - code *takeDamage; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00afa186; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - if (this->_isSkipNextUpdate != 0) { - this->_isSkipNextUpdate = 0; - return; - } - ExceptionList = &local_1c; - bomb = this; - puVar3 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - if (this->_loadCostumes != 0) { - update_sparks(this,local_24); - puVar3 = puStack_20; - } - puStack_20 = puVar3; - local_80 = GHIDRA_CAST(&this->_tearFlags); - pBVar5 = BitSet128::operator_and - (GHIDRA_CAST(&local_c0),GHIDRA_CAST(local_80),&g_tearFlagHydrobounce); - if ((GHIDRA_INT(pBVar5->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) == 0) && - (GHIDRA_INT(pBVar5->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) == 0)) { - isBouncy = '\0'; - } - else { - isBouncy = '\x01'; - } - rocketAngle = this->_rocketAngle; - if (g_game->_frameCount - this->_spawnFrame == 1) { - if (this->_spawnerType == 1) { - this->_bombIndex = DAT_00c7ec64; - DAT_00c7ec64 = DAT_00c7ec64 + 1; - } - if (isBouncy != '\0') { - this->_fallSpeed = -8.0; - (this->_posOffset).y = -3.0; - } - } - if (this->_dead != 0) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - if (0 < this->_updateDelay) { - this->_updateDelay = this->_updateDelay + -1; - ExceptionList = local_1c; - return; - } - if ((((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) || (this->_variant == 2)) { - this->Remove(); - ExceptionList = local_1c; - return; - } - ExceptionList = local_1c; - return; - } - if (this->_pitfallState != 0) { - this->_friction = this->_friction * 0.6; - if (0 < this->_explosionCountdown1) { - this->_explosionCountdown1 = this->_explosionCountdown1 + 1; - } - if ((((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) && - ((this->_pitfallState == 1 && (this->_pitfallState = 2, this->_parent == 0)))) { - this->Remove(); - } - } - fVar9 = -3.0; - if ((this->_flags & 0x20) != 0) { - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST(s_Idle),0); - if (this->_hasCostumes != 0) { - costumeLoaded = &this->_bombCostumesSprites[0]._loaded; - local_84 = &DAT_00000005; - do { - if (*costumeLoaded != 0) { - AnimationState::Update(GHIDRA_CAST((costumeLoaded + -0xd9))); - AnimationState::Update(GHIDRA_CAST((costumeLoaded + -0xb9))); - } - costumeLoaded = costumeLoaded + 0x114; - local_84 = local_84 + -1; - } while (local_84 != GHIDRA_CAST(0x0)); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - ExceptionList = local_1c; - return; - } - fVar13 = 0.0; - fVar14 = 1.0; - minBounceSpeed = 2.0; - fVar15 = 0.8; - if (((this->_visible != 0) && (this->_pitfallState == 0)) && - ((this->_dead == 0 && - ((height = (this->_posOffset).y, height < 0.0 || - (this->_fallSpeed <= 0.0 && this->_fallSpeed != 0.0)))))) { - oldFallSpeed = this->_fallSpeed; - height = oldFallSpeed + height; - (this->_posOffset).y = height; - bVar4 = IsRocket(this); - if (bVar4 == 0) { - if (isBouncy == '\0') { - fallSpeed = this->_fallAcceleration; - if (this->_fallAcceleration == fVar13) { - fallSpeed = fVar15; - } - } - else { - fallSpeed = 2.5; - } - } - else if (isBouncy == '\0') { - fallSpeed = this->_fallAcceleration; - } - else { - fallSpeed = 1.6; - } - fallSpeed = fallSpeed + oldFallSpeed; - this->_fallSpeed = fallSpeed; - isBouncyReg = isBouncy; - if (-26.0 <= height) { - if ((fVar9 <= height) && (this->_isFetus == 0)) { - bVar4 = IsRocket(trinketRng); - isBouncyReg = extraout_DL; - if (bVar4 == 0) { - this->_entityGridCollisionClass = 5; - goto LAB_006a2829; - } - } - this->_entityGridCollisionClass = 6; - } - else { - this->_entityGridCollisionClass = 3; - } -LAB_006a2829: - if (fVar13 <= height) { - if (((isBouncyReg == '\0') || (fallSpeed <= minBounceSpeed)) || (3 < this->_bounceCount)) { - (this->_posOffset).y = 0.0; - this->_fallSpeed = 0.0; - this->_collisionDamage = 0.0; - bVar4 = IsRocket(this); - if (bVar4 == 0) { - scalePtr = &this->_scale; - local_80 = GHIDRA_CAST(0x3f800000); - if (this->_variant == 0x12) { - stickyTarget = 0x1d2; - volumeScalePtr = GHIDRA_CAST(&local_80); - if (*scalePtr <= fVar14) { - volumeScalePtr = scalePtr; - } - fVar15 = *volumeScalePtr * fVar15; - } - else { - stickyTarget = 0x28; - volumeScalePtr = GHIDRA_CAST(&local_80); - if (*scalePtr <= fVar14) { - volumeScalePtr = scalePtr; - } - fVar15 = *volumeScalePtr; - } - SoundEffects::PlayWithFartOverride(stickyTarget,fVar15,2,0,1.0); - } - else { - this->_explosionCountdown1 = 0; - } - } - else { - this->_bounceCount = this->_bounceCount + 1; - (this->_posOffset).y = 0.0; - this->_fallSpeed = fallSpeed * -0.7; - uVar6 = Random(); - spawned = Game::Spawn(g_game,1000,0xe,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar6); - spawned->SetColor(&(bomb->_sprite)._color,0xffffffff,0xff,0,1); - spawned->Update(); - SoundEffects::PlayWithFartOverride(0x96,0.5,2,0,1.0); - BVar1._l = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_80)) + 0x0)))); - BVar1._h = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_80)) + 0x8)))); - tear_flags_area_apply(&this->_pos,GHIDRA_CAST(bomb),40.0,bomb->_explosionDamage * 0.25,BVar1); - this = bomb; - } - } - } - spawner = GHIDRA_CAST(this->_spawnerEntity); - if ((spawner != GHIDRA_CAST(0x0)) && (spawner->_type != 1)) { - spawner = GHIDRA_CAST(0x0); - } - pEVar8 = spawner; - stickyTarget = this->_variant; - if ((stickyTarget == 0x13) || (stickyTarget == 0x14)) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x200000000000000); - if (bVar4 == 0) { - stickyTarget = this->_variant; - goto LAB_006a2a0d; - } - (this->_sprite)._rotation = 0.0; - ANM2::Play(&this->_sprite,s_Idle,0); - this->_rocketSpeed = 0.0; - } - else { -LAB_006a2a0d: - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) { - bVar4 = AnimationState::IsLoopingAnimation(&(this->_sprite)._animState); - stickyTarget = extraout_EDX; - if (bVar4 == 0) goto LAB_006a2a4a; - } - if ((stickyTarget != 2) && (this->_pitfallState == 0)) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Pulse"),0); - } - } -LAB_006a2a4a: - bVar4 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("Pulse")); - if ((bVar4 != 0) && (bVar4 = IsRocket(this), bVar4 == 0)) { - if ((this->_isFetus == 0) && - (((this->_spawnerType == 1 && (pEVar8 != GHIDRA_CAST(0x0))) && - (bVar4 = (GHIDRA_CAST((pEVar8)))->Entity_Player::HasCollectible(0x89,0), bVar4 != 0)))) { - stickyTarget = ANM2::GetFrame(&this->_sprite); - if (0xe < stickyTarget) { - stickyTarget = 0; - goto LAB_006a2afe; - } - } - else { - local_80 = GHIDRA_CAST(0x0); - stickyTarget = AnimationState::GetAnimationLength(&(this->_sprite)._animState); - stickyTarget = (stickyTarget - *extraout_EDX_00) + -1; - if (stickyTarget < 0) { - stickyTarget = stickyTarget + (stickyTarget / 0xf) * -0xf + 0xf; - } - iVar7 = ANM2::GetFrame(&this->_sprite); - if (stickyTarget != iVar7) { -LAB_006a2afe: - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(stickyTarget); - } - } - } - pBVar5 = &this->_tearFlags; - fVar9 = 90.0; - uVar6 = 0x80000000; - fVar15 = 0.017453292; - if (this->_isFetus != 0) { - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagSpectral); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - this->_entityGridCollisionClass = 3; - } - bVar4 = IsRocket(this); - if (bVar4 == 0) { - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagWiggle); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - VStack_98.x = (this->_velocity).y; - VStack_98.y = (float)(GHIDRA_UINT((this->_velocity).x) ^ uVar6); - (GHIDRA_CAST((&VStack_98)))->Vector::Normalize(); - local_80 = (Entity_Player *) - sin((float)g_game->_frameCount * 0.7 + - (float)((double)this->_index + - __uint_to_double_fixup[-(this->_index >> 0x1f)])); - fVar9 = (this->_velocity).y; - fVar15 = (this->_velocity).x; - fVar9 = sqrtf(fVar15 * fVar15 + fVar9 * fVar9); - (this->_pos).x = VStack_98.x * fVar9 * (float)local_80 + (this->_pos).x; - (this->_pos).y = VStack_98.y * fVar9 * (float)local_80 + (this->_pos).y; - } - if (this->_collidesWithGrid != 0) { - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagExplosive); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - this->_explosionCountdown1 = 0; - } - } - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagTractorBeam); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (((bVar4 != 0) && (stickyTarget = this->_parent, stickyTarget != 0)) && - (*GHIDRA_CAST((stickyTarget + 0x28)) == 1)) { - local_84 = (uint8_t *) - __RTDynamicCast(stickyTarget,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor - ,&IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0); - stickyTarget = __RTDynamicCast(); - if (stickyTarget != 0) { - local_a4 = (this->_pos).x - *GHIDRA_CAST((local_84 + 0x33c)); - local_88 = GHIDRA_CAST(((this->_pos).y - *GHIDRA_CAST((local_84 + 0x340)))); - local_80 = GHIDRA_CAST((*GHIDRA_CAST((stickyTarget + 0x41c)) * 0.017453292)); - local_8c = sin((float)local_80); - fVar9 = cos((float)local_80); - fVar15 = fVar9 * local_a4 + local_8c * (float)local_88; - if (0.0 < fVar15) { - local_80 = (Entity_Player *) - (((fVar15 * fVar9 + *GHIDRA_CAST((local_84 + 0x33c))) - (this->_pos).x) * 0.01); - local_a4 = ((fVar15 * local_8c + *GHIDRA_CAST((local_84 + 0x340))) - (this->_pos).y) * 0.01; - VStack_98.x = (float)local_80; - VStack_98.y = local_a4; - fVar9 = (float)local_80 * (float)local_80 + local_a4 * local_a4; - if ((4.0 < fVar9) && (fVar9 = sqrtf(fVar9), 0.0 < fVar9)) { - VStack_98.x = (float)local_80 * (2.0 / fVar9); - VStack_98.y = (2.0 / fVar9) * local_a4; - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(&VStack_98,0); - } - } - } - fVar9 = 0.0; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (stickyTarget = this->_parent, stickyTarget != 0)) { - VStack_98.x = (this->_pos).x - (*GHIDRA_CAST((stickyTarget + 0x33c)) + fVar9); - VStack_98.y = (this->_pos).y - (*GHIDRA_CAST((stickyTarget + 0x340)) + 2.0); - tmpVecPtr = (GHIDRA_CAST((&VStack_98)))->Vector::Normalized(&local_cc); - fVar9 = tmpVecPtr->y; - (this->_velocity).x = (this->_velocity).x - tmpVecPtr->x * 0.6; - (this->_velocity).y = (this->_velocity).y - fVar9 * 0.6; - } - } - else { - local_ac = GHIDRA_CAST((this->_updateTime - 1.0)); - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagWiggle); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - local_80 = GHIDRA_CAST(((this->_rocketAngle + fVar9) * fVar15)); - local_88 = GHIDRA_CAST(sin((float)local_80)); - fVar9 = cos((float)local_80); - local_80 = GHIDRA_CAST((fVar9 * 6.0)); - local_88 = GHIDRA_CAST(((float)local_88 * 6.0)); - local_ac = GHIDRA_CAST(((float)local_ac * 0.8)); - fVar15 = sin((float)local_ac); - fVar9 = this->_speedMultiplier; - (this->_velocity).x = (float)local_80 * fVar15 * fVar9 + (this->_velocity).x; - (this->_velocity).y = (float)local_88 * fVar15 * fVar9 + (this->_velocity).y; - fVar9 = sin((float)local_ac - 0.5); - fVar15 = 0.017453292; - rocketAngle = fVar9 * 25.0 + this->_rocketAngle; - } - if (this->_fallAcceleration != 0.0) { - rocketAngle = rocketAngle * fVar15; - local_a4 = sin(rocketAngle); - fVar9 = (this->_velocity).y; - fVar15 = (this->_velocity).x; - local_80 = GHIDRA_CAST(sqrtf(fVar15 * fVar15 + fVar9 * fVar9)); - fVar9 = cos(rocketAngle); - rocketAngle = atan2f(this->_fallSpeed + local_a4 * (float)local_80, - fVar9 * (float)local_80 + 0.0); - rocketAngle = rocketAngle * 57.295776; - } - } - } - pBVar5 = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagBurn); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - if (this->_spawnerType == 1) { - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(&local_c0),&this->_pos, - this->_size,8); - local_14 = 0; - local_84 = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(local_c0._shift3) != GHIDRA_CAST(0x0)) { - do { - pEVar8 = *GHIDRA_CAST((local_c0._shift1 + GHIDRA_INT(local_84) * 4)); - local_80 = pEVar8; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar4 != 0) && - (fVar15 = (pEVar8->_pos).y - (this->_pos).y, fVar9 = (pEVar8->_pos).x - (this->_pos).x, - fVar13 = pEVar8->_size + this->_size, fVar15 * fVar15 + fVar9 * fVar9 < fVar13 * fVar13 - )) { - takeDamage = *(code **)(*GHIDRA_CAST(pEVar8) + 0x20); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(this)); - (*takeDamage)(0x41800000,2,0,&sourceRef,0x1e); - } - local_84 = local_84 + 1; - } while (local_84 < GHIDRA_UINT(local_c0._shift3)); - } - local_14 = 0xffffffff; - (GHIDRA_CAST((&local_c0)))->EntityList_Query::~EntityList_Query(); - } - else { - local_84 = GHIDRA_CAST(0x0); - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - local_80 = Game::GetPlayer(g_game,GHIDRA_UINT(local_84)); - if ((local_80 != GHIDRA_CAST(0x0)) && - (fVar15 = (local_80->_pos).y - (this->_pos).y, - fVar9 = (local_80->_pos).x - (this->_pos).x, - fVar13 = local_80->_size + this->_size + 1.5, - fVar15 * fVar15 + fVar9 * fVar9 < fVar13 * fVar13)) { - takeDamage = *(code **)(*GHIDRA_CAST(local_80) + 0x20); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(this)); - (*takeDamage)(0x3f800000,2,0,&sourceRef,0x1e); - } - local_84 = local_84 + 1; - } while (local_84 < - (uint8_t *) - (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)); - } - } - } - pBVar5 = &this->_tearFlags; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagOccult); - if ((((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) || - (local_88 = GHIDRA_CAST(this->_parent), local_88 == GHIDRA_CAST(0x0))) || - (local_88->_type != 1)) { -LAB_006a34c6: - fVar9 = 0.0; - } - else { - (GHIDRA_CAST((local_88)))->Entity_Player::GetShootingJoystick(&VStack_98); - (GHIDRA_CAST((local_88)))->Entity_Player::GetMouseAimTarget(&VStack_98,0); - pvVar2 = local_88->_markedTarget; - if (pvVar2 != (void *)0x0) { - fVar9 = (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x33c)) - (this->_pos).x) / 10.0; - fVar15 = (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x340)) - (this->_pos).y) / 10.0; - VStack_98.x = fVar9; - VStack_98.y = fVar15; - fVar9 = sqrtf(fVar9 * fVar9 + fVar15 * fVar15); - if (1.0 < fVar9) { - (GHIDRA_CAST((&VStack_98)))->Vector::Normalize(); - } - } - pEVar8 = local_88; - local_88 = GHIDRA_CAST((local_88->_shotspeed * 3.0)); - bVar4 = (GHIDRA_CAST((pEVar8)))->Entity_Player::HasCollectible(5,0); - if (bVar4 != 0) { - local_88 = GHIDRA_CAST(((float)local_88 * 0.5)); - } - auVar12 = ZEXT816(0); - if ((VStack_98.x != 0.0) || (VStack_98.y != 0.0)) { - (GHIDRA_CAST((&VStack_98)))->Vector::Normalize(); - (this->_velocity).x = VStack_98.x * (float)local_88 + (this->_velocity).x; - (this->_velocity).y = VStack_98.y * (float)local_88 + (this->_velocity).y; - this->_friction = 0.8; - goto LAB_006a34c6; - } - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - fVar9 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar12)) + 0x0))); - if (bVar4 == 0) { - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagHoming); - bVar4 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - fVar9 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar12)) + 0x0))); - if (bVar4 == 0) { - this->_friction = 0.8; - } - else { - this->_friction = 0.9; - } - } - else { - this->_friction = 1.0; - } - } - stickyTarget = this->_variant; - if ((stickyTarget == 0x13) || (stickyTarget == 0x14)) { - fVar15 = this->_rocketSpeed - fVar9; - local_a4 = fVar15 * 0.0625; - if (local_a4 <= fVar9) { - local_a4 = fVar9; - } - if (1.0 <= local_a4) { - local_a4 = 1.0; - } - fVar13 = local_a4 * 0.19; - if (stickyTarget != 0x14) { - fVar15 = fVar15 * 0.125; - if (fVar15 <= fVar9) { - fVar15 = fVar9; - } - if (1.0 <= fVar15) { - fVar15 = 1.0; - } - local_a4 = fVar15 + fVar15; - } - local_a4 = local_a4 + fVar9; - this->_friction = fVar13 + 0.8; - this->_rocketSpeed = this->_rocketSpeed + this->_speedMultiplier; - local_80 = GHIDRA_CAST((this->_rocketAngle * 0.017453292)); - local_84 = GHIDRA_CAST(sin((float)local_80)); - fVar9 = cos((float)local_80); - bVar4 = this->_collidesWithGrid; - fVar15 = fVar9 * local_a4 * this->_speedMultiplier + (this->_velocity).x; - fVar9 = (float)local_84 * local_a4 * this->_speedMultiplier + (this->_velocity).y; - (this->_velocity).x = fVar15; - (this->_velocity).y = fVar9; - if (bVar4 != 0) { - this->_explosionCountdown1 = 0; - fVar13 = this->_speedMultiplier; - (this->_pos).x = (this->_pos).x - fVar13 * fVar15; - (this->_pos).y = (this->_pos).y - fVar13 * fVar9; - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - if ((this->_variant == 0x13) || (this->_variant == 0x14)) { - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagBoomerang); - if (((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - (stickyTarget = this->_parent, stickyTarget != 0)) { - fVar9 = atan2f(*GHIDRA_CAST((stickyTarget + 0x340)) - (this->_pos).y, - *GHIDRA_CAST((stickyTarget + 0x33c)) - (this->_pos).x); - fVar9 = normalize_angle_degrees(fVar9 * 57.295776 - this->_rocketAngle); - fVar15 = (this->_rocketSpeed - 1.0) / 9.0; - auVar12 = ZEXT416(GHIDRA_UINT(fVar15)); - if (fVar15 <= 0.0) { - auVar12 = ZEXT816(0); - } - if (1.0 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar12)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar12)) + 0x0))) = 0x3f800000; - } - this->_rocketAngle = - ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar12)) + 0x0))) * 0.5 + 0.0) * fVar9 * this->_speedMultiplier + this->_rocketAngle; - } - pBVar5 = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagHoming); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - (GHIDRA_CAST((&local_c0)))->RNG::game_constructor(this->_initSeed,0xe); - fVar9 = (GHIDRA_CAST((&local_c0)))->RNG::RandomFloat(); - local_88 = GHIDRA_CAST(this->_rocketSpeed); - local_84 = GHIDRA_CAST((fVar9 * 6.0 + 3.0)); - local_80 = GHIDRA_CAST(((float)local_84 + 10.0)); - if ((float)local_84 == (float)local_80) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - fVar9 = ((float)local_88 - (float)local_84) / ((float)local_80 - (float)local_84); - if (fVar9 <= 0.0) { - fVar9 = 0.0; - } - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - local_88 = GHIDRA_CAST((fVar9 + 0.0)); - if ((this->_target == 0) || (*GHIDRA_CAST((this->_target + 0x173)) != '\0')) { - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(&local_c0), - &this->_pos,256.0,0xffffffff); - local_14 = 1; - local_ac = GHIDRA_CAST(0x0); - local_a4 = 1e+10; - local_80 = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(local_c0._shift3) != GHIDRA_CAST(0x0)) { - do { - spawned = *GHIDRA_CAST((local_c0._shift1 + GHIDRA_INT(local_80) * 4)); - bVar4 = (GHIDRA_CAST((spawned)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - if (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::IsDescendantOf(spawned); - if (bVar4 != 0) goto LAB_006a39af; - } - local_cc.y = (this->_pos).x; - local_8c = (spawned->_pos).x - local_cc.y; - VStack_98.y = (this->_pos).y; - local_84 = GHIDRA_CAST(((spawned->_pos).y - VStack_98.y)); - fVar9 = sqrtf((float)local_84 * (float)local_84 + local_8c * local_8c); - if (0.0 < fVar9) { - local_8c = (1.0 / fVar9) * local_8c; - local_84 = GHIDRA_CAST(((float)local_84 * (1.0 / fVar9))); - } - scratchVec.y = this->_rocketAngle * 0.017453292; - local_e0.y = sin(scratchVec.y); - fVar9 = cos(scratchVec.y); - local_e0.y = fVar9 * local_8c + local_e0.y * (float)local_84; - if (0.2 < local_e0.y) { - fVar9 = VStack_98.y - (spawned->_pos).y; - fVar15 = local_cc.y - (spawned->_pos).x; - fVar9 = sqrtf(fVar9 * fVar9 + fVar15 * fVar15); - fVar9 = fVar9 * (1.0 - local_e0.y); - if (fVar9 < local_a4) { - local_ac = spawned; - local_a4 = fVar9; - } - } - } -LAB_006a39af: - spawned = local_ac; - local_80 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_80)) + 0x1)))); - } while (local_80 < GHIDRA_UINT(local_c0._shift3)); - if (local_ac != GHIDRA_CAST(0x0)) { - if (this->_target != 0) { - VStack_98.y = (float)&this->_target; - msvc::multiset::erase(&VStack_98.y); - } - this->_target = spawned; - msvc::multiset::insert(&this->_target); - } - } - if ((char)local_c0._seed == '\0') { - local_14 = 2; - tracked_alloc(1,(void *)local_c0._shift1,0); - } - local_14 = 0xffffffff; - } - stickyTarget = this->_target; - if ((stickyTarget != 0) && (0.0 < (float)local_88)) { - fVar9 = atan2f(*GHIDRA_CAST((stickyTarget + 0x340)) - (this->_pos).y, - *GHIDRA_CAST((stickyTarget + 0x33c)) - (this->_pos).x); - fVar9 = normalize_angle_degrees(fVar9 * 57.295776 - this->_rocketAngle); - this->_rocketAngle = (float)local_88 * this->_speedMultiplier * fVar9 + this->_rocketAngle; - } - } - } - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x0))) = ZEXT812(0xbf800000); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0xc))) = 0; - local_ac = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x0))); - if (((this->_isFetus != 0) && (this->_parent != 0)) && - ((pBVar5 = BitSet128::operator_and(GHIDRA_CAST(&local_c0),&this->_tearFlags,&g_tearFlagOrbit), - GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0 || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)))) { - bVar4 = IsRocket(this); - if (bVar4 == 0) { - local_88 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(auVar10))) + 0x0))); - if ((this->_bombIndex & 1) == 0) { - local_88 = GHIDRA_CAST(0x3f800000); - } - local_8c = (this->_pos).y - *GHIDRA_CAST((this->_parent + 0x340)); - local_84 = GHIDRA_CAST(((this->_pos).x - *GHIDRA_CAST((this->_parent + 0x33c)))); - fVar9 = sqrtf(local_8c * local_8c + (float)local_84 * (float)local_84); - if (fVar9 == 0.0) { - fVar9 = 0.1; - } - local_84 = GHIDRA_CAST(((float)local_84 / fVar9)); - local_8c = local_8c / fVar9; - local_cc.y = (110.0 - fVar9) * 0.05; - fVar15 = (float)local_88 * local_8c; - local_88 = GHIDRA_CAST(((float)local_88 * -(float)local_84)); - fVar9 = (this->_velocity).x; - VStack_98.y = fVar15; - fVar15 = (this->_velocity).y; - local_e0.y = sqrtf(fVar9 * fVar9 + fVar15 * fVar15); - VStack_98.x = local_e0.y * VStack_98.y + local_cc.y * (float)local_84; - VStack_98.y = local_e0.y * (float)local_88 + local_cc.y * local_8c; - tmpVecPtr = (GHIDRA_CAST((&VStack_98)))->Vector::Normalized(&local_cc); - fVar9 = tmpVecPtr->y; - (this->_velocity).x = local_e0.y * tmpVecPtr->x; - (this->_velocity).y = local_e0.y * fVar9; - } - } - fVar9 = 5.0; - if (this->_spawnerType == 1) { - pBVar5 = BitSet128::operator_and(GHIDRA_CAST(&local_c0),&this->_tearFlags,&g_tearFlagHoming); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - if (this->_target == 0) { - VStack_98.x = (this->_velocity).x * fVar9 + (this->_pos).x; - VStack_98.y = (this->_velocity).y * fVar9 + (this->_pos).y; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_e8),&VStack_98, - 150.0,8); - local_14 = 3; - local_84 = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(local_e0.y) != GHIDRA_CAST(0x0)) { - do { - spawned = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_e8)) + 0x4))) + GHIDRA_INT(local_84) * 4)); - bVar4 = (GHIDRA_CAST((spawned)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (((bVar4 != 0) && - (((GHIDRA_CAST(this->_spawnerEntity) == GHIDRA_CAST(0x0) || - (bVar4 = Entity::IsDescendantOf - (GHIDRA_CAST(this->_spawnerEntity), - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_e8)) + 0x4))) + GHIDRA_INT(local_84) * 4))), bVar4 == 0) - ) && ((spawned->_flags & 0x20000010) == 0)))) && - ((uVar6 = Random(), (uVar6 & 1) != 0 && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(5,this->_index), bVar4 != 0)))) { - local_cc.y = (spawned->_pos).y; - local_cc.x = (spawned->_pos).x; - bVar4 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&this->_pos,&local_cc,1,0,0,0,GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - if (this->_target != 0) { - VStack_98.y = (float)&this->_target; - msvc::multiset::erase(&VStack_98.y); - } - this->_target = spawned; - msvc::multiset::insert(&this->_target); - } - } - local_84 = local_84 + 1; - } while (local_84 < GHIDRA_UINT(local_e0.y)); - } - local_14 = 0xffffffff; - if (local_e8[0] == '\0') { - local_14 = 4; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_e8)) + 0x4))),0); - local_14 = 0xffffffff; - } - } - else { - bVar4 = IsRocket(this); - if ((bVar4 == 0) && (uVar6 = Random(), (uVar6 & 1) == 0)) { - VStack_98.x = (this->_pos).x - *GHIDRA_CAST((this->_target + 0x33c)); - VStack_98.y = (this->_pos).y - *GHIDRA_CAST((this->_target + 0x340)); - tmpVecPtr = (GHIDRA_CAST((&VStack_98)))->Vector::Normalized(&local_cc); - fVar9 = tmpVecPtr->y; - (this->_velocity).x = (this->_velocity).x - tmpVecPtr->x * 1.33; - (this->_velocity).y = (this->_velocity).y - fVar9 * 1.33; - } - } - } - if ((this->_dead == 0) && - (((pBVar5 = BitSet128::operator_and - (GHIDRA_CAST(&local_c0),&this->_tearFlags,&g_tearFlagCreepTrail), - GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0 || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(7,0), bVar4 != 0)))) { - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - auVar11 = ZEXT812(0x40c00000); - fVar9 = (this->_explosionDamage - 30.0) / 3.0; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))) <= fVar9) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))) = fVar9; - } - local_80 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))); - } - else { - local_80 = GHIDRA_CAST(0x40a00000); - } - uVar6 = Random(); - uVar19 = 0; - pTVar18 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar17 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar16 = 0; - spawned = Game::Spawn(g_game,1000,0x2e,&this->_pos,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),0,uVar6); - effect = GHIDRA_CAST(__RTDynamicCast(spawned,uVar16,pTVar17,pTVar18,uVar19)); - uVar6 = Random(); - fVar15 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 0.6 + 0.3; - fVar9 = fVar15 * g_vectorOne.x; - effect[0x3a] = GHIDRA_INT((fVar15 * g_vectorOne.y)); - effect[0x39] = GHIDRA_INT(fVar9); - uVar16 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0,100,0); - (**(code **)(*effect + 0x3c))(uVar16,0xffffffff,0xff,0,1); - (**(code **)(*effect + 0x40))(local_80); - pEVar8 = GHIDRA_CAST(this->_spawnerEntity); - if (((pEVar8 != GHIDRA_CAST(0x0)) && (pEVar8->_type == 1)) && - (stickyTarget = (GHIDRA_CAST((pEVar8)))->Entity_Player::GetTrinketMultiplier(0x47), 1 < stickyTarget)) { - fVar9 = 1.5; - if (2 < stickyTarget) { - stickyTarget = effect[0x117]; - fVar9 = 2.0; - effect[0x117] = GHIDRA_INT(((float)stickyTarget * 1.5)); - effect[0x118] = GHIDRA_INT(((float)stickyTarget * 1.5)); - } - effect[0x3a] = GHIDRA_INT((fVar9 * (float)effect[0x3a])); - effect[0x39] = GHIDRA_INT((fVar9 * (float)effect[0x39])); - } - effect[0xd] = this->_spawnerType; - effect[0xe] = this->_spawnerVariant; - (**(code **)(*effect + 0xc))(); - } - } - if (((this->_variant != 0x13) && (this->_variant != 0x14)) && - ((0.0 <= (this->_posOffset).y || (this->_isFetus == 0)))) { - fVar15 = (this->_velocity).x * 0.95; - fVar9 = (this->_velocity).y * 0.95; - (this->_velocity).x = fVar15; - (this->_velocity).y = fVar9; - if (fVar15 * fVar15 + fVar9 * fVar9 < 1.0) { - (this->_velocity).x = fVar15 * 0.5; - (this->_velocity).y = (this->_velocity).y * 0.5; - } - } - pBVar5 = &this->_tearFlags; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagSticky); - if (((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - (stickyTarget = this->_stickyTarget, stickyTarget != 0)) { - *GHIDRA_CAST((stickyTarget + 0x360)) = *GHIDRA_CAST((stickyTarget + 0x360)) * 0.9; - *GHIDRA_CAST((stickyTarget + 0x364)) = *GHIDRA_CAST((stickyTarget + 0x364)) * 0.9; - } - if (this->_explosionCountdown1 < 1) { - local_80 = GHIDRA_CAST(&spawner->_temporaryeffects); -LAB_006a4412: - if (((this->_isFetus != 0) || (spawner == GHIDRA_CAST(0x0))) || - ((bVar4 = (GHIDRA_CAST((spawner)))->Entity_Player::HasCollectible(0x89,0), bVar4 == 0 || - ((bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_80))))->TemporaryEffects::HasCollectibleEffect(0x89), - bVar4 != 0 || (this->_spawnerType != 1)))))) { - BVar1 = *pBVar5; - if ((this->_variant == 0x11) || (_local_a0 = BVar1, this->_variant == 0x14)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a0)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(BVar1._l)) + 0x0))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a0)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(BVar1._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a0)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_a0)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGigaBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a0)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_a0)) + 0x0))) | GHIDRA_UINT(g_tearFlagGigaBomb._l); - VStack_98.x = (float)BVar1._h; - VStack_98.y = (*GHIDRA_CAST((GHIDRA_CAST(&(BVar1._h)) + 0x4))); - VStack_98.x = (float)(GHIDRA_UINT(VStack_98.x) | GHIDRA_UINT(g_tearFlagGigaBomb._h)); - VStack_98.y = (float)(GHIDRA_UINT(VStack_98.y) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGigaBomb._h)) + 0x4)))); - this->_updateDelay = 5; - } - uVar6 = 4; - if (this->_isFetus == 0) { - uVar6 = 0x40000004; - } - local_cc.y = (float)&this->_pos; - Game::BombExplosionEffects - (g_game,GHIDRA_CAST(local_cc.y),this->_explosionDamage,_local_a0, - &(this->_sprite)._color,GHIDRA_CAST(this),this->_radiusMultiplier,1,(uint64_t)uVar6,0 - ); - if (spawner == GHIDRA_CAST(0x0)) { - local_88 = GHIDRA_CAST(this->_variant); - } - else { - local_88 = GHIDRA_CAST(0x0); - } - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagScatterBomb); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - uVar6 = Random(); - local_84 = GHIDRA_CAST(((uVar6 & 1) + 4)); - do { - uVar6 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - fVar9 = fVar9 + fVar9; - VStack_98.y = fVar9; - local_80 = GHIDRA_CAST(cos(fVar9)); - local_a4 = sin(VStack_98.y); - uVar6 = Random(); - spawned = GHIDRA_CAST(this->_spawnerEntity); - rngResult = Random(); - scratchVec.x = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 7.0 + 3.0; - scratchVec.y = scratchVec.x * local_a4; - scratchVec.x = scratchVec.x * (float)local_80; - rngResult = Random(); - this = bomb; - uVar19 = 0; - pTVar18 = &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor; - pTVar17 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar16 = 0; - fVar9 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)] - ) * 2.3283064e-10 * 15.0; - scratchVec2.x = fVar9 * (float)local_80 + *GHIDRA_CAST(local_cc.y); - scratchVec2.y = fVar9 * local_a4 + (bomb->_pos).y; - spawned = Game::Spawn(g_game,bomb->_type,GHIDRA_UINT(local_88),&scratchVec2,&scratchVec,spawned,0 - ,uVar6); - spawned = GHIDRA_CAST(__RTDynamicCast(spawned,uVar16,pTVar17,pTVar18,uVar19)); - *GHIDRA_CAST(&spawned[1]._spawnerVariant) = this->_isFetus; - spawned->_spawnerType = this->_spawnerType; - spawned->_spawnerVariant = this->_spawnerVariant; - pBVar5 = (GHIDRA_CAST((&g_tearFlagScatterBomb)))->BitSet128::__bnot(GHIDRA_CAST(&local_c0)); - pBVar5 = BitSet128::operator_and(&local_100,&this->_tearFlags,pBVar5); - flagsLow = pBVar5->_l; - stickyTarget = *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)); - flagsHigh = pBVar5->_h; - iVar7 = *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)); - spawned[1]._sprite._filename._buf[0xb] = '\x01'; - spawned[1]._type = GHIDRA_INT(flagsLow); - spawned[1]._variant = stickyTarget; - spawned[1]._subtype = GHIDRA_INT(flagsHigh); - spawned[1]._spawnerType = iVar7; - spawned[1]._collisionIndex = GHIDRA_INT((this->_scale * 0.5)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x8)))) = this->_explosionDamage * 0.5; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x3c)))) = this->_radiusMultiplier * 0.65; - local_e0.y = (float)(GHIDRA_UINT(g_vectorOne.y) ^ 0x80000000); - local_e0.x = -g_vectorOne.x; - (GHIDRA_CAST((spawned)))->Entity::SetSize(spawned->_size * 0.5, - (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); - if ((spawned->_variant == 0x13) || (spawned->_variant == 0x14)) { - uVar6 = Random(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x10)))) = 0x3fa66666; - fVar9 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 10.0; - } - else { - uVar6 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 5.0; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0xc)))) = -3.0 - fVar9; - (spawned->_posOffset).x = 0.0; - (spawned->_posOffset).y = -3.0; - uVar6 = (GHIDRA_CAST((&spawned->_dropRNG)))->RNG::RandomInt(0xe); - *GHIDRA_CAST(&spawned->_flags) = GHIDRA_UINT(spawned->_flags) | 0x4000000; - entityFlagsHi = GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); - *entityFlagsHi = *entityFlagsHi | 0x400; - local_84 = GHIDRA_CAST((GHIDRA_INT(local_84) + -1)); - *GHIDRA_CAST((spawned + 1)) = uVar6 + 10; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x4)))) = uVar6 + 10; - } while (local_84 != GHIDRA_CAST(0x0)); - pBVar5 = &this->_tearFlags; - local_84 = GHIDRA_CAST(0x0); - } - pBVar5 = BitSet128::operator_and(&local_100,pBVar5,&g_tearFlagGhostBomb); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - if (0.75 < this->_scale) { - uVar6 = Random(); - manager = g_manager; - local_80 = GHIDRA_CAST(&DAT_0000002c); - VStack_98.y = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) - * 2.3283064e-10 * 0.4 + 2.0; - seed_fart_sound_override(GHIDRA_CAST(&local_80)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_80),0.7,2,0,VStack_98.y,0.0); - local_c0._seed = this->_initSeed; - local_c0._shift1 = 2; - local_c0._shift2 = 7; - local_c0._shift3 = 0x19; - uVar6 = (GHIDRA_CAST((&local_c0)))->RNG::Next(); - spawned = Game::Spawn(g_game,1000,0xba,&this->_pos,&g_vectorZero,GHIDRA_CAST(spawner),1,uVar6 - ); - uVar16 = 0x168; - if (this->_isFetus != 0) { - uVar16 = 0xb4; - } - fVar9 = spawned->_collisionDamage; - stickyTarget = *GHIDRA_CAST(spawned); - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 4)) = uVar16; - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 8)) = uVar16; - (**(code **)(stickyTarget + 0x40))(fVar9 * this->_scale); - VStack_98.x = -g_vectorOne.x; - VStack_98.y = -g_vectorOne.y; - (GHIDRA_CAST((spawned)))->Entity::SetSize(spawned->_size * this->_scale, - (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); - fVar9 = this->_scale; - } - else { - local_c0._seed = this->_initSeed; - local_c0._shift1 = 2; - local_c0._shift2 = 7; - local_c0._shift3 = 0x19; - uVar6 = (GHIDRA_CAST((&local_c0)))->RNG::Next(); - spawned = Game::Spawn(g_game,1000,0xbd,&this->_pos,&g_vectorZero,GHIDRA_CAST(spawner),1,uVar6 - ); - if ((spawned->_sprite)._animState._animData != (void *)0x0) { - AnimationState::AdvancePosition - (&(spawned->_sprite)._animState, - *GHIDRA_CAST((GHIDRA_INT((spawned->_sprite)._animState._animData) + 0x30)) + -1); - } - fVar9 = this->_scale + this->_scale; - } - stickyTarget = *GHIDRA_CAST(spawned); - fVar15 = fVar9 * g_vectorOne.y; - (spawned->_sprite)._scale.x = fVar9 * g_vectorOne.x; - (spawned->_sprite)._scale.y = fVar15; - (**(code **)(stickyTarget + 0xc))(); - } - this->_dead = 1; - if (this->_pitfallState == 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Explode"),0); - } - if (this->_isFetus == 0) { - pBVar5 = BitSet128::operator_and(&local_110,&this->_tearFlags,&g_tearFlagSticky); - pEVar8 = spawner; - if (((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) && - (stickyTarget = this->_stickyTarget, stickyTarget != 0)) { - *GHIDRA_CAST((stickyTarget + 0x168)) = *GHIDRA_CAST((stickyTarget + 0x168)) | 0x400000; - *GHIDRA_CAST((stickyTarget + 0x16c)) = *GHIDRA_CAST((stickyTarget + 0x16c)); - } - if (((this->_variant != 0xd) && (spawner != GHIDRA_CAST(0x0))) && - (bVar4 = (GHIDRA_CAST((spawner)))->Entity_Player::HasTrinket(0x49,0), bVar4 != 0)) { - trinketRng = (GHIDRA_CAST((pEVar8)))->Entity_Player::GetTrinketRNG(0x49); - stickyTarget = (GHIDRA_CAST((spawner)))->Entity_Player::GetTrinketMultiplier(0x49); - uVar6 = (GHIDRA_CAST((trinketRng)))->RNG::RandomInt(GHIDRA_UINT((10 / (int64_t)stickyTarget))); - if (uVar6 == 0) { - uVar6 = Random(); - Game::Spawn(g_game,5,0x28,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar6); - } - } - } - else { - pBVar5 = BitSet128::operator_and(&local_100,&this->_tearFlags,&g_tearFlagPersistent); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - uVar6 = Random(); - uVar19 = 0; - pTVar18 = &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor; - pTVar17 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar16 = 0; - spawned = Game::Spawn(g_game,4,this->_variant,&this->_pos,&this->_velocity, - GHIDRA_CAST(this->_spawnerEntity),0,uVar6); - stickyTarget = __RTDynamicCast(spawned,uVar16,pTVar17,pTVar18,uVar19); - *GHIDRA_CAST((stickyTarget + 0x34)) = this->_spawnerType; - *GHIDRA_CAST((stickyTarget + 0x38)) = this->_spawnerVariant; - *GHIDRA_CAST((stickyTarget + 0x448)) = 1; - pBVar5 = (GHIDRA_CAST((&g_tearFlagPersistent)))->BitSet128::__bnot(&local_100); - pBVar5 = BitSet128::operator_and(GHIDRA_CAST(&local_c0),&this->_tearFlags,pBVar5); - BVar1 = *pBVar5; - *GHIDRA_CAST((stickyTarget + 0x463)) = 1; - *GHIDRA_CAST((stickyTarget + 0x438)) = BVar1; - if ((*GHIDRA_CAST((stickyTarget + 0x2c)) == 0x13) || (*GHIDRA_CAST((stickyTarget + 0x2c)) == 0x14)) { - *GHIDRA_CAST((stickyTarget + 0x428)) = this->_rocketAngle; - uVar16 = 0x3c; - } - else { - uVar16 = 0x1e; - } - *GHIDRA_CAST((stickyTarget + 0x410)) = uVar16; - *GHIDRA_CAST((stickyTarget + 0x414)) = uVar16; - *GHIDRA_CAST((stickyTarget + 0x168)) = *GHIDRA_CAST((stickyTarget + 0x168)) | 0x4000000; - *GHIDRA_CAST((stickyTarget + 0x16c)) = *GHIDRA_CAST((stickyTarget + 0x16c)) | 0x400; - } - pBVar5 = BitSet128::operator_and(&local_100,&this->_tearFlags,&g_tearFlagSplit); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - local_84 = GHIDRA_CAST((this->_velocity).y); - local_8c = -(this->_velocity).x; - fVar9 = sqrtf((float)local_84 * (float)local_84 + local_8c * local_8c); - if (0.0 < fVar9) { - local_84 = GHIDRA_CAST(((float)local_84 * (1.0 / fVar9))); - local_8c = local_8c * (1.0 / fVar9); - } - do { - uVar6 = Random(); - uVar19 = 0; - pTVar18 = &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor; - scratchVec2.x = (float)local_ac * (float)local_84 * 5.0; - pTVar17 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar16 = 0; - scratchVec2.y = (float)local_ac * local_8c * 5.0; - VStack_98.x = this->_size * (float)local_84 * (float)local_ac + (this->_pos).x; - VStack_98.y = this->_size * local_8c * (float)local_ac + (this->_pos).y; - spawned = Game::Spawn(g_game,4,GHIDRA_UINT(local_88),&VStack_98,&scratchVec2, - GHIDRA_CAST(this->_spawnerEntity),0,uVar6); - stickyTarget = __RTDynamicCast(spawned,uVar16,pTVar17,pTVar18,uVar19); - *GHIDRA_CAST((stickyTarget + 0x34)) = this->_spawnerType; - *GHIDRA_CAST((stickyTarget + 0x38)) = this->_spawnerVariant; - *GHIDRA_CAST((stickyTarget + 0x448)) = 1; - pBVar5 = (GHIDRA_CAST((&g_tearFlagSplit)))->BitSet128::__bnot(&local_100); - pBVar5 = BitSet128::operator_and(GHIDRA_CAST(&local_c0),&this->_tearFlags,pBVar5); - flagsLow = pBVar5->_l; - uVar16 = *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)); - flagsHigh = pBVar5->_h; - uVar19 = *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)); - *GHIDRA_CAST((stickyTarget + 0x168)) = *GHIDRA_CAST((stickyTarget + 0x168)) | 0x4000000; - *GHIDRA_CAST((stickyTarget + 0x16c)) = *GHIDRA_CAST((stickyTarget + 0x16c)) | 0x400; - *GHIDRA_CAST((stickyTarget + 0x438)) = GHIDRA_INT(flagsLow); - *GHIDRA_CAST((stickyTarget + 0x43c)) = uVar16; - *GHIDRA_CAST((stickyTarget + 0x440)) = GHIDRA_INT(flagsHigh); - *GHIDRA_CAST((stickyTarget + 0x444)) = uVar19; - *GHIDRA_CAST((stickyTarget + 0x463)) = 1; - *GHIDRA_CAST((stickyTarget + 0x410)) = 0xf; - *GHIDRA_CAST((stickyTarget + 0x414)) = 0xf; - *GHIDRA_CAST((stickyTarget + 0x418)) = *GHIDRA_CAST((stickyTarget + 0x418)) * 0.4; - local_ac = GHIDRA_CAST(((float)local_ac + 2.0)); - } while ((float)local_ac <= 1.0); - } - pBVar5 = BitSet128::operator_and(&local_100,&this->_tearFlags,&g_tearFlagQuadsplit); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - uVar6 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - fVar9 = fVar9 + fVar9; - VStack_98.y = fVar9; - local_84 = GHIDRA_CAST(cos(fVar9)); - local_8c = sin(VStack_98.y); - local_cc.y = cos(1.5707964); - VStack_98.y = sin(1.5707964); - local_80 = GHIDRA_CAST(0x4); - do { - uVar6 = Random(); - scratchVec2.x = (float)local_84 * 6.5; - uVar19 = 0; - pTVar18 = &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor; - pTVar17 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - scratchVec2.y = local_8c * 6.5; - uVar16 = 0; - scratchVec.y = this->_size * local_8c + (this->_pos).y; - scratchVec.x = this->_size * (float)local_84 + (this->_pos).x; - spawned = Game::Spawn(g_game,this->_type,GHIDRA_UINT(local_88),&scratchVec,&scratchVec2, - GHIDRA_CAST(this->_spawnerEntity),0,uVar6); - spawned = GHIDRA_CAST(__RTDynamicCast(spawned,uVar16,pTVar17,pTVar18,uVar19)); - spawned->_spawnerType = this->_spawnerType; - spawned->_spawnerVariant = this->_spawnerVariant; - *GHIDRA_CAST(&spawned[1]._spawnerVariant) = 1; - pBVar5 = (GHIDRA_CAST((&g_tearFlagQuadsplit)))->BitSet128::__bnot(GHIDRA_CAST(&local_c0)); - pBVar5 = BitSet128::operator_and(&local_110,&this->_tearFlags,pBVar5); - flagsLow = pBVar5->_l; - stickyTarget = *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)); - flagsHigh = pBVar5->_h; - iVar7 = *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)); - spawned[1]._sprite._filename._buf[0xb] = '\x01'; - spawned[1]._type = GHIDRA_INT(flagsLow); - spawned[1]._variant = stickyTarget; - spawned[1]._subtype = GHIDRA_INT(flagsHigh); - spawned[1]._spawnerType = iVar7; - spawned[1]._collisionIndex = GHIDRA_INT((this->_scale * 0.5)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x8)))) * 0.35; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x3c)))) = this->_radiusMultiplier * 0.5; - local_e0.y = (float)(GHIDRA_UINT(g_vectorOne.y) ^ 0x80000000); - local_e0.x = -g_vectorOne.x; - (GHIDRA_CAST((spawned)))->Entity::SetSize(spawned->_size * 0.5, - (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1) - ; - *GHIDRA_CAST(&spawned->_flags) = GHIDRA_UINT(spawned->_flags) | 0x4000000; - entityFlagsHi = GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); - *entityFlagsHi = *entityFlagsHi | 0x400; - *GHIDRA_CAST((spawned + 1)) = 7; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x4)))) = 7; - local_80 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_80[-1])) + 0x2eff)))); - fVar9 = VStack_98.y * (float)local_84; - local_84 = GHIDRA_CAST((local_cc.y * (float)local_84 - VStack_98.y * local_8c)); - local_8c = local_cc.y * local_8c + fVar9; - } while (local_80 != GHIDRA_CAST(0x0)); - local_80 = GHIDRA_CAST(0x0); - } - } - if (this->_variant == 0x12) { - this->_dead = 0; - uVar6 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(0x1e); - this->_explosionCountdown1 = uVar6 + 0x3c; - bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Appear"),1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,8.0); - } - uVar6 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - tmpVecPtr = RandomVector(&local_e0,uVar6); - (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - stickyTarget = (this->_dropRNG)._seed; - fVar15 = (float)((double)stickyTarget + __uint_to_double_fixup[-(stickyTarget >> 0x1f)]) * - 2.3283062e-10 * 5.0 + 5.0; - fVar9 = tmpVecPtr->x; - (this->_velocity).y = fVar15 * tmpVecPtr->y; - (this->_velocity).x = fVar15 * fVar9; - this->_scatterTimer = 0x5a; - } - pEVar8 = spawner; - if ((((((this->_flags & 0x40000000000) == 0) && (spawner != GHIDRA_CAST(0x0))) && - (GHIDRA_CAST(this->_spawnerEntity) == spawner)) && - ((this->_isFetus == 0 && - (bVar4 = (GHIDRA_CAST((&spawner->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x89), - bVar4 != 0)))) && (bVar4 = (GHIDRA_CAST((pEVar8)))->Entity_Player::HasCollectible(0x248,0), bVar4 != 0)) { - Entity_Player::AddWisp(pEVar8,0x89,&this->_pos,0,0); - } - } - } - else { - if ((this->_spawnerType == 1) && (spawner != GHIDRA_CAST(0x0))) { - local_80 = GHIDRA_CAST(&spawner->_temporaryeffects); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_80))))->TemporaryEffects::HasCollectibleEffect(0x89); - if (bVar4 != 0) goto LAB_006a4412; - } - if (((this->_variant != 0x13) && (this->_variant != 0x14)) || - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x200000000000000), bVar4 == 0)) { - this->_explosionCountdown1 = this->_explosionCountdown1 + -1; - } - pBVar5 = BitSet128::operator_and(GHIDRA_CAST(&local_c0),pBVar5,&g_tearFlagAttractor); - if ((GHIDRA_INT(pBVar5->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar5->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) != 0)) { - Game::AttractEntities(g_game,&this->_pos,(void *)0x0,(void *)0x0,10.0,250.0); - } - bVar4 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x3f); - if (((bVar4 != 0) && (this->_explosionCountdown1 == 0)) && - (((stickyTarget = this->_variant, stickyTarget == 3 || - (((stickyTarget == 4 || (stickyTarget == 8)) || (stickyTarget == 0x12)))) || - (((stickyTarget == 0x11 && (this->_spawnerType != 1)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000000), bVar4 == 0)))))) { - this->Remove(); - SoundEffects::PlayWithFartOverride(900,1.0,2,0,1.0); - stickyTarget = this->_variant; - uVar6 = 1; - if (stickyTarget == 4) { - uVar6 = 2; - } - else if (stickyTarget == 0x12) { - uVar6 = 4; - } - else if (stickyTarget == 0x11) { - uVar6 = 7; - } - rngResult = Random(); - spawned = Game::Spawn(g_game,5,0x28,&this->_pos,&this->_velocity,GHIDRA_CAST(0x0),uVar6,rngResult - ); - pvVar2 = (spawned->_sprite)._animState._animData; - if (pvVar2 != (void *)0x0) { - AnimationState::SetFrameFloat - (&(spawned->_sprite)._animState,(float)(*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x30)) + -8)); - } - uVar6 = Random(); - Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar6); - ExceptionList = local_1c; - return; - } - } - if (this->_variant == 4) { - tmpVecPtr = &this->_pos; - pEVar8 = Game::GetNearestPlayer(g_game,tmpVecPtr); - VStack_98.y = (pEVar8->_pos).x; - local_cc.y = (pEVar8->_pos).y; - pEVar8 = Game::GetNearestPlayer(g_game,tmpVecPtr); - local_a4 = ((pEVar8->_velocity).y * 5.0 + local_cc.y) - (this->_pos).y; - local_80 = GHIDRA_CAST((((pEVar8->_velocity).x * 5.0 + VStack_98.y) - tmpVecPtr->x)); - fVar9 = local_a4 * local_a4 + (float)local_80 * (float)local_80; - if (fVar9 < 72900.0) { - fVar9 = sqrtf(fVar9); - if (fVar9 <= 0.0) { - pEVar8 = local_80; - fVar9 = local_a4; - } - else { - pEVar8 = GHIDRA_CAST(((float)local_80 * (1.0 / fVar9))); - fVar9 = local_a4 * (1.0 / fVar9); - } - (this->_velocity).x = (float)pEVar8 * 1.5 + (this->_velocity).x; - (this->_velocity).y = fVar9 * 1.5 + (this->_velocity).y; - } - game = g_game; - (this->_velocity).x = (this->_velocity).x * 0.8; - (this->_velocity).y = (this->_velocity).y * 0.8; - if (game->_frameCount - this->_spawnFrame < 0x14) { - this->_friction = this->_friction * 0.8; - } - } - if (0 < this->_collisionCooldown) { - this->_collisionCooldown = this->_collisionCooldown + -1; - } - if (0 < this->_parentCollisionCooldown) { - this->_parentCollisionCooldown = this->_parentCollisionCooldown + -1; - } - if (0 < this->_scatterTimer) { - this->_scatterTimer = this->_scatterTimer + -1; - } - game = g_game; - stickyTarget = g_game->_frameCount; - if ((0xf < stickyTarget - this->_spawnFrame) && (this->_entityCollisionClass == 1)) { - this->_entityCollisionClass = 4; - stickyTarget = game->_frameCount; - } - if ((this->_explosionCountdown1 < stickyTarget - this->_spawnFrame) && - (this->_entityCollisionClass == 0)) { - this->_entityCollisionClass = 4; - } - if (((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) && (this->_variant != 0x13)) && - (this->_variant != 0x14)) { - (this->_velocity).y = (this->_velocity).y + 0.9; - } - if (this->_variant == 0xf) { - if ((0.0 <= (this->_posOffset).y) && (0.0 <= this->_fallSpeed)) { - this->_friction = this->_friction * 0.8; - } - if ((this->_sprite)._animState._animData != (void *)0x0) { - bVar4 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,&DAT_00b670d0); - manager = g_manager; - if (bVar4 != 0) { - local_80 = GHIDRA_CAST(0xab); - seed_fart_sound_override(GHIDRA_CAST(&local_80)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_80),1.0,2,0,1.5,0.0); - } - } - } - stickyTarget = this->_stickyTarget; - if (stickyTarget == 0) { - if (this->_entityGridCollisionClass == 0) { - this->_entityGridCollisionClass = 5; - } - } - else { - fVar9 = *GHIDRA_CAST((stickyTarget + 0x364)); - (this->_velocity).x = *GHIDRA_CAST((stickyTarget + 0x360)); - (this->_velocity).y = fVar9; - fVar9 = *GHIDRA_CAST((stickyTarget + 0x340)); - fVar15 = (this->_targetPosition).y; - (this->_pos).x = *GHIDRA_CAST((stickyTarget + 0x33c)) + (this->_targetPosition).x; - (this->_pos).y = fVar9 + fVar15; - this->_entityCollisionClass = 0; - this->_entityGridCollisionClass = 0; - } - if (this->_visible == 0) { - this->_entityCollisionClass = 0; - this->_entityGridCollisionClass = 0; - this->_collisionCooldown = 4; - } - if (((this->_sprite)._animState._animData != (void *)0x0) && - (bVar4 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("DropSound")), - bVar4 != 0)) { - if (this->_variant == 0x11) { - (GHIDRA_CAST((&g_manager->_sfxManager)))->SoundEffects::Play(0x28,1.0,4,0,0.8,0.0); - Game::ShakeScreen(g_game,6); - } - else { - fVar9 = this->_scale; - if (this->_variant == 0x12) { - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - fVar9 = fVar9 * 0.8; - stickyTarget = 0x1d2; - } - else { - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - stickyTarget = 0x28; - } - (GHIDRA_CAST((&g_manager->_sfxManager)))->SoundEffects::Play(stickyTarget,fVar9,4,0,1.0,0.0); - } - } - if (this->_hasCostumes != 0) { - costumeLoaded = &this->_bombCostumesSprites[0]._loaded; - local_80 = GHIDRA_CAST(&DAT_00000005); - do { - if (*costumeLoaded != 0) { - AnimationState::Update(GHIDRA_CAST((costumeLoaded + -0xd9))); - AnimationState::Update(GHIDRA_CAST((costumeLoaded + -0xb9))); - } - costumeLoaded = costumeLoaded + 0x114; - local_80 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_80[-1])) + 0x2eff)))); - } while (local_80 != GHIDRA_CAST(0x0)); - } - if ((this->_variant == 0x13) || (this->_variant == 0x14)) { - fVar9 = rocketAngle; - if (360.0 < ABS(rocketAngle)) { - fVar9 = fmodf(rocketAngle,360.0); - } - if (fVar9 <= 180.0) { - if (fVar9 < -180.0) { - fVar9 = fVar9 + 360.0; - } - } - else { - fVar9 = fVar9 - 360.0; - } - if ((this->_flags & 0x200000000000000) == 0) { - if ((90.0 < fVar9) || (fVar9 < -90.0)) { - fVar9 = 180.0 - fVar9; - (this->_sprite)._flipX = 1; - } - else { - (this->_sprite)._flipX = 0; - } - } - else { - (this->_sprite)._flipX = 0; - fVar9 = 0.0; - } - (this->_sprite)._rotation = fVar9; - stickyTarget = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0); - if ((stickyTarget != 0) && (this->_visible != 0)) { - uVar6 = Random(); - scratchVec2.x = (this->_velocity).x * 0.14; - rocketAngle = rocketAngle * 0.017453292; - scratchVec2.y = (this->_velocity).y * 0.14; - fVar9 = cos(rocketAngle); - VStack_98.x = (this->_pos).x - fVar9 * 5.0 * this->_scale; - fVar9 = sin(rocketAngle); - VStack_98.y = (this->_pos).y - fVar9 * 5.0 * this->_scale; - spawned = Game::Spawn(g_game,1000,0x3b,&VStack_98,&scratchVec2,GHIDRA_CAST(0x0),0,uVar6); - (GHIDRA_CAST((&smokeColor)))->Color::Color(1.0,1.0,1.0,0.3); - spawned->SetColor(extraout_EAX,0xffffffff,0xff,0,1); - uVar6 = Random(); - *GHIDRA_CAST((spawned[1]._sprite._animDefaultName._buf + 4)) = - (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 10.0 + 2.0; - uVar6 = Random(); - stickyTarget = uVar6 % 0xf + 0xf; - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 4)) = stickyTarget; - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 8)) = stickyTarget; - fVar9 = this->_scale * 0.4; - fVar15 = fVar9 * g_vectorOne.y; - fVar9 = fVar9 * g_vectorOne.x; - spawned->_renderDepthOffset = -18.0; - (spawned->_sprite)._scale.y = fVar15; - (spawned->_sprite)._scale.x = fVar9; - (spawned->_posOffset).x = (this->_posOffset).x; - (spawned->_posOffset).y = (this->_posOffset).y; - } - } - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && - (stickyTarget = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 4))(), - stickyTarget == 3)) { - this->_entityCollisionClass = 0; - } - FUN_00861f80(this); - ExceptionList = local_1c; - return; -} - -// 006a5a60 -void Entity_Bomb::Render(Vector *offset) -{ - Vector *position; - float fVar1; - void *layerFrame; - ColorMod *costumeSpriteColor; - AnimationState *costumeAnimState; - AnimationState *pAVar2; - uint32_t costumeIndex; - float fVar3; - float fVar4; - float fVar5; - float cosRotation; - float fVar6; - double dVar7; - double dVar8; - float costumeOffsetY; - float costumeOffsetX; - Vector costumePos; - Color costumeColor; - float local_6c [26]; - float spriteRotation; - - if ((this->_exists != 0) && (this->_visible != 0)) { - if (this->_loadCostumes != 0) { - update_sparks(); - } - fVar6 = g_displayPixelRatio * g_screenPointScale; - dVar7 = floor((double)(((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * fVar6 + 0.5)); - dVar8 = floor((double)(((((this->_pos).y + (this->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * fVar6 + 0.5)); - position = &this->_renderPosition; - fVar1 = offset->y; - position->x = (float)dVar7 / fVar6 + offset->x; - (this->_renderPosition).y = (float)dVar8 / fVar6 + fVar1; - if (this->_hasCostumes != 0) { - layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0); - fVar1 = (this->_sprite)._scale.x; - fVar3 = (*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x10)) + (this->_sprite)._offset.x) * fVar1; - fVar6 = (this->_sprite)._scale.y; - fVar4 = ((this->_sprite)._offset.y + *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x14))) * fVar6; - spriteRotation = (this->_sprite)._rotation; - fVar5 = spriteRotation * 0.017453292; - cosRotation = cos(fVar5); - fVar5 = sin(fVar5); - costumeOffsetX = cosRotation * fVar3 - fVar5 * fVar4; - costumeOffsetY = cosRotation * fVar4 + fVar5 * fVar3; - if ((this->_sprite)._flipX != 0) { - costumeOffsetX = costumeOffsetX * -1.0; - } - if ((this->_sprite)._flipY != 0) { - costumeOffsetY = costumeOffsetY * -1.0; - } - fVar3 = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x5c)); - costumeColor._offset[2] = (this->_sprite)._color._offset[2]; - fVar4 = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x18)); - fVar5 = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x1c)); - costumeColor._tint[0] = (this->_sprite)._color._tint[0]; - costumeColor._tint[1] = (this->_sprite)._color._tint[1]; - costumeColor._tint[2] = (this->_sprite)._color._tint[2]; - costumeColor._tint[3] = (this->_sprite)._color._tint[3]; - costumeColor._colorize[0] = (this->_sprite)._color._colorize[0]; - costumeColor._colorize[1] = (this->_sprite)._color._colorize[1]; - costumeColor._colorize[2] = (this->_sprite)._color._colorize[2]; - costumeColor._colorize[3] = (this->_sprite)._color._colorize[3]; - costumeColor._offset[0] = (this->_sprite)._color._offset[0]; - costumeColor._offset[1] = (this->_sprite)._color._offset[1]; - (GHIDRA_CAST((&costumeColor)))->Color::__mul(GHIDRA_CAST((GHIDRA_INT(layerFrame) + 0x30))); - costumeIndex = 0; - do { - if ((this->_bombCostumesSprites[costumeIndex]._loaded != 0) && - (*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x2c)) != '\0')) { - this->_bombCostumesSprites[costumeIndex]._rotation = spriteRotation + fVar3; - costumeSpriteColor = &this->_bombCostumesSprites[costumeIndex]._color; - this->_bombCostumesSprites[costumeIndex]._scale.x = fVar1 * fVar4; - this->_bombCostumesSprites[costumeIndex]._scale.y = fVar6 * fVar5; - if (costumeSpriteColor != GHIDRA_CAST(local_6c)) { - *GHIDRA_CAST(costumeSpriteColor->_offset) = - CONCAT44(costumeColor._offset[1],costumeColor._offset[0]); - costumeSpriteColor->_tint[0] = costumeColor._tint[0]; - costumeSpriteColor->_tint[1] = costumeColor._tint[1]; - costumeSpriteColor->_tint[2] = costumeColor._tint[2]; - costumeSpriteColor->_tint[3] = costumeColor._tint[3]; - costumeSpriteColor->_offset[2] = costumeColor._offset[2]; - costumeSpriteColor->_colorize[0] = costumeColor._colorize[0]; - costumeSpriteColor->_colorize[1] = costumeColor._colorize[1]; - costumeSpriteColor->_colorize[2] = costumeColor._colorize[2]; - costumeSpriteColor->_colorize[3] = costumeColor._colorize[3]; - } - costumePos.x = costumeOffsetX + position->x; - costumePos.y = costumeOffsetY + (this->_renderPosition).y; - if (this->_bombCostumesSprites[costumeIndex]._loaded != 0) { - costumeAnimState = &this->_bombCostumesSprites[costumeIndex]._animState; - pAVar2 = &this->_bombCostumesSprites[costumeIndex]._overlayAnimState; - if (this->_bombCostumesSprites[costumeIndex]._overlayRenderFirst == 0) { - AnimationState::Render(costumeAnimState,&costumePos,&g_vectorZero,&g_vectorZero); - } - else { - AnimationState::Render(pAVar2,&costumePos,&g_vectorZero,&g_vectorZero); - pAVar2 = costumeAnimState; - } - AnimationState::Render(pAVar2,&costumePos,&g_vectorZero,&g_vectorZero); - } - } - if ((costumeIndex == 0) && ((this->_sprite)._loaded != 0)) { - if ((this->_sprite)._overlayRenderFirst == 0) { - AnimationState::Render(&(this->_sprite)._animState,position,&g_vectorZero,&g_vectorZero) - ; - pAVar2 = &(this->_sprite)._overlayAnimState; - } - else { - AnimationState::Render - (&(this->_sprite)._overlayAnimState,position,&g_vectorZero,&g_vectorZero); - pAVar2 = &(this->_sprite)._animState; - } - AnimationState::Render(pAVar2,position,&g_vectorZero,&g_vectorZero); - } - costumeIndex = costumeIndex + 1; - } while (costumeIndex < 5); - FUN_00862060(this,offset); - return; - } - ANM2::Render(&this->_sprite,position,&g_vectorZero,&g_vectorZero); - FUN_00862060(this,offset); - } - return; -} - -// 006a6f10 -void Entity_Bomb::update_sparks() -{ - int iVar1; - uint32_t uVar2; - uint8_t bVar3; - BitSet128 *pBVar4; - uint8_t ******ppppppbVar5; - uint32_t *appendResult; - uint8_t ******ppppppbVar6; - void *pvVar7; - BitSet128 *text; - std_string *psVar8; - LayerState *layer; - Entity_Bomb *pEVar9; - std_string *psVar10; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - int costumeListBytes; - Entity_Bomb *extraout_ECX; - Entity_Bomb *pEVar11; - uint32_t uVar12; - uint8_t *layerIdx; - ANM2 *costumeSprite; - int costumeListBytes; - BitSet128 *pBVar14; - float fVar15; - float scaleY; - BitSet128 maskAnd; - uint32_t costumeEntryIdx; - ANM2 *costumeIter; - BitSet128 *costumeEntry; - uint32_t *entryPathCapacity; - uint8_t local_1e0 [8]; - std_string *searchPathsEnd; - std_string *local_1d4; - Sprite *local_1cc; - uint32_t slot; - ANM2 *local_1c4; - float local_1c0; - std_string *local_1bc; - std_string *local_1b8; - uint32_t *local_1b4; - Entity_Bomb *bomb; - char isAnimPlaying; - void *nameWithSuffix; - uint32_t uStack_1a4; - uint32_t uStack_1a0; - uint32_t uStack_19c; - uint64_t nameWithSuffixSizeCapacity; - std_string tmpPath; - std_string joinedPath; - uint8_t ******savedAnimName [4]; - int savedAnimNameSize; - uint32_t savedAnimNameCapacity; - void *spritePath; - char acStack_144 [4]; - char acStack_140 [4]; - char acStack_13c [4]; - uint32_t spritePathSize; - uint32_t spritePathCapacity; - void *baseName [4]; - uint32_t baseNameSize; - uint32_t baseNameCapacity; - uint8_t ******srcCopy; - uint32_t uStack_114; - uint32_t uStack_110; - uint32_t uStack_10c; - uint32_t *srcCopySize; - uint32_t srcCopyCapacity; - uint8_t ******sizeSuffix [4]; - uint32_t sizeSuffixSize; - uint32_t sizeSuffixCapacity; - std_string tmpString; - std_string costumePaths [5]; - BitSet128 searchDirs; - int searchDir0Size; - uint8_t searchDir1 [16]; - int searchDir1Size; - uint32_t stackCookie; - uint8_t *puStack_20; - void *savedExceptionList; - uint8_t *puStack_18; - uint32_t ehState; - Manager *manager; - uint32_t *srcLength; - - puStack_20 = searchDir1 + 0x38; - ehState = 0xffffffff; - puStack_18 = &LAB_00afa2e9; - savedExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((searchDir1 + 0x2c)); - ExceptionList = &savedExceptionList; - costumeSprite = this->_bombCostumesSprites; - this->_hasCostumes = 0; - this->_loadCostumes = 0; - costumeListBytes = 5; - costumeIter = costumeSprite; - bomb = this; - do { - if (costumeSprite->_loaded != 0) { - ANM2::Reset(costumeSprite); - } - manager = g_manager; - costumeSprite = costumeSprite + 1; - costumeListBytes = costumeListBytes + -1; - } while (costumeListBytes != 0); - fVar15 = (float)bomb->_variant; - local_1c0 = fVar15; - msvc::set::find_node(local_1e0 + 4,&local_1c0); - pEVar9 = bomb; - if ((local_1d4->_buf[0xd] != '\0') || (psVar8 = local_1d4, GHIDRA_INT(fVar15) < GHIDRA_INT(local_1d4->_size))) { - psVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x2a514)))); - } - if ((psVar8 == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x2a514))))) || - (local_1cc = GHIDRA_CAST(&psVar8->_capacity), local_1cc == GHIDRA_CAST(0x0))) { - if ((fVar15 == 1.4013e-44) || - (((fVar15 == 8.40779e-45 || (fVar15 == 1.4013e-45)) || (fVar15 == 2.8026e-45)))) { - fVar15 = bomb->_scale / 1.5; - } - else { - fVar15 = bomb->_scale; - } - scaleY = fVar15 * g_vectorOne.y; - (bomb->_sprite)._scale.x = fVar15 * g_vectorOne.x; - (bomb->_sprite)._scale.y = scaleY; - ExceptionList = savedExceptionList; - return; - } - pvVar7 = (bomb->_sprite)._animState._animData; - if (pvVar7 == (void *)0x0) { - savedAnimNameCapacity = 0xf; - savedAnimNameSize = 0; - savedAnimName[0] = GHIDRA_CAST(0x0); - pvVar7 = (void *)0x0; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(savedAnimName))))->msvc::string::string(pvVar7); - pvVar7 = (pEVar9->_sprite)._animState._animData; - } - local_1c0 = (pEVar9->_sprite)._animState._animFrame; - if ((pvVar7 == (void *)0x0) || - (isAnimPlaying = '\x01', (pEVar9->_sprite)._animState._isPlaying == 0)) { - isAnimPlaying = '\0'; - } - sizeSuffixCapacity = 0xf; - fVar15 = pEVar9->_scale; - if (0.5 < fVar15) { - if (0.75 < fVar15) { - bVar3 = 0x32; - if (1.1 < fVar15) { - bVar3 = 0x33; - } - } - else { - bVar3 = 0x31; - } - sizeSuffix[0] = GHIDRA_CAST(GHIDRA_UINT(bVar3)); - } - else { - sizeSuffix[0] = GHIDRA_CAST(0x30); - } - local_1c4 = &pEVar9->_sprite; - (pEVar9->_sprite)._scale.x = g_vectorOne.x; - sizeSuffixSize = 1; - (pEVar9->_sprite)._scale.y = g_vectorOne.y; - spritePathSize = 0; - spritePathCapacity = 0xf; - spritePath = (void *)0x0; - ehState = 2; - _eh_vector_constructor_iterator_(costumePaths,0x18,5,FUN_0040c380,msvc::string::_Tidy_deallocate); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 3; - _eh_vector_constructor_iterator_(&searchDirs,0x18,2,FUN_0040c380,msvc::string::_Tidy_deallocate); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 4; - costumeEntryIdx = 0; - costumeListBytes = *GHIDRA_CAST((local_1cc->_filename)._buf); - costumeListBytes = *GHIDRA_CAST(((local_1cc->_filename)._buf + 4)) - costumeListBytes; - iVar1 = costumeListBytes >> 0x1f; - if (costumeListBytes / 0xe0 + iVar1 != iVar1) { - local_1bc = GHIDRA_CAST(&pEVar9->_tearFlags); - do { - pBVar14 = GHIDRA_CAST((costumeEntryIdx * 0xe0 + costumeListBytes)); - costumeEntry = pBVar14; - pBVar4 = BitSet128::operator_and(GHIDRA_CAST(local_1e0),GHIDRA_CAST(local_1bc),pBVar14); - if (((GHIDRA_INT(pBVar4->_l) == GHIDRA_INT(pBVar14->_l)) && - (*GHIDRA_CAST((GHIDRA_INT(&pBVar4->_l) + 4)) == *GHIDRA_CAST((GHIDRA_INT(&pBVar14->_l) + 4)))) && - ((GHIDRA_INT(pBVar4->_h) == GHIDRA_INT(pBVar14->_h) && - (((*GHIDRA_CAST((GHIDRA_INT(&pBVar4->_h) + 4)) == *GHIDRA_CAST((GHIDRA_INT(&pBVar14->_h) + 4)) && - (pBVar4 = BitSet128::operator_and(&maskAnd,GHIDRA_CAST(local_1bc),pBVar14 + 1), - GHIDRA_INT(pBVar4->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar4->_l) + 4)) == 0)) && - (GHIDRA_INT(pBVar4->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar4->_h) + 4)) == 0)))))) { - if (GHIDRA_INT(pBVar14[3]._l) != 0) { - local_1b8 = GHIDRA_CAST((pBVar14 + 2)); - srcLength = *GHIDRA_CAST(&pBVar14[3]._l); - if (0xf < *GHIDRA_CAST((GHIDRA_INT(&pBVar14[3]._l) + 4))) { - local_1b8 = *GHIDRA_CAST(local_1b8->_buf); - } - if (&DAT_0000000f < srcLength) { - uVar12 = GHIDRA_UINT(srcLength) | 0xf; - if (0x7fffffff < uVar12) { - uVar12 = 0x7fffffff; - } - srcCopy = msvc::_Allocate(uVar12 + 1); - memcpy(srcCopy,local_1b8,(size_t)(GHIDRA_INT(srcLength) + 1)); - } - else { - srcCopy = *GHIDRA_CAST(local_1b8->_buf); - uStack_114 = *GHIDRA_CAST((local_1b8->_buf + 4)); - uStack_110 = *GHIDRA_CAST((local_1b8->_buf + 8)); - uStack_10c = *GHIDRA_CAST((local_1b8->_buf + 0xc)); - uVar12 = 0xf; - } - ppppppbVar6 = srcCopy; - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 5; - local_1b4 = GHIDRA_CAST((GHIDRA_INT(srcLength) + -5)); - tmpString._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = (void *)0x0; - srcCopySize = srcLength; - srcCopyCapacity = uVar12; - if (srcLength < local_1b4) { -LAB_006a7eb2: - tmpString._capacity = 0xf; - tmpString._size = 0; - tmpString._buf[0] = '\0'; - tmpString._buf[1] = '\0'; - tmpString._buf[2] = '\0'; - tmpString._buf[3] = '\0'; - /* WARNING: Subroutine does not return */ - FUN_00499950(); - } - ppppppbVar5 = GHIDRA_CAST(&srcCopy); - if (0xf < uVar12) { - ppppppbVar5 = srcCopy; - } - tmpString._size = 5; - memmove(&tmpString,GHIDRA_CAST((GHIDRA_INT(local_1b4) + GHIDRA_INT(ppppppbVar5))),5); - tmpString._buf[5] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 6; - ppppppbVar5 = GHIDRA_CAST(&srcCopy); - if (0xf < uVar12) { - ppppppbVar5 = ppppppbVar6; - } - baseNameSize = 0; - baseNameCapacity = 0xf; - baseName[0] = (void *)0x0; - (GHIDRA_CAST((GHIDRA_CAST(baseName))))->msvc::string::assign(GHIDRA_CAST(ppppppbVar5),GHIDRA_UINT(local_1b4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 7; - ppppppbVar6 = GHIDRA_CAST(sizeSuffix); - if (0xf < sizeSuffixCapacity) { - ppppppbVar6 = sizeSuffix[0]; - } - appendResult = (GHIDRA_CAST((GHIDRA_CAST(baseName))))->msvc::string::append(GHIDRA_CAST(ppppppbVar6),sizeSuffixSize); - nameWithSuffix = (void *)*appendResult; - uStack_1a4 = appendResult[1]; - uStack_1a0 = appendResult[2]; - uStack_19c = appendResult[3]; - nameWithSuffixSizeCapacity = *GHIDRA_CAST((appendResult + 4)); - appendResult[4] = 0; - appendResult[5] = 0xf; - *GHIDRA_CAST(appendResult) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 8; - (GHIDRA_CAST((joinedPath._buf)))->msvc::string::concat_move(GHIDRA_INT(local_1c0),&nameWithSuffix,&tmpString); - if (0xf < spritePathCapacity) { - uVar12 = spritePathCapacity + 1; - pvVar7 = spritePath; - if (0xfff < uVar12) { - pvVar7 = *(void **)(GHIDRA_CAST(spritePath) + -4); - uVar12 = spritePathCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(spritePath) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - spritePath = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)joinedPath._buf)) + 0x0))); - acStack_144[0] = joinedPath._buf[4]; - acStack_144[1] = joinedPath._buf[5]; - acStack_144[2] = joinedPath._buf[6]; - acStack_144[3] = joinedPath._buf[7]; - acStack_140[0] = joinedPath._buf[8]; - acStack_140[1] = joinedPath._buf[9]; - acStack_140[2] = joinedPath._buf[10]; - acStack_140[3] = joinedPath._buf[0xb]; - acStack_13c[0] = joinedPath._buf[0xc]; - acStack_13c[1] = joinedPath._buf[0xd]; - acStack_13c[2] = joinedPath._buf[0xe]; - acStack_13c[3] = joinedPath._buf[0xf]; - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 7; - spritePathSize = joinedPath._size; - spritePathCapacity = joinedPath._capacity; - if (0xf < (*GHIDRA_CAST((GHIDRA_CAST(&(nameWithSuffixSizeCapacity)) + 0x4)))) { - uVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(nameWithSuffixSizeCapacity)) + 0x4))) + 1; - pvVar7 = nameWithSuffix; - if (0xfff < uVar12) { - pvVar7 = *(void **)(GHIDRA_CAST(nameWithSuffix) + -4); - uVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(nameWithSuffixSizeCapacity)) + 0x4))) + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(nameWithSuffix) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 6; - if (0xf < baseNameCapacity) { - uVar12 = baseNameCapacity + 1; - pvVar7 = baseName[0]; - if (0xfff < uVar12) { - pvVar7 = *(void **)(GHIDRA_INT(baseName[0]) + -4); - uVar12 = baseNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(baseName[0]) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 5; - baseNameSize = 0; - baseNameCapacity = 0xf; - baseName[0] = (void *)(GHIDRA_UINT(baseName[0]) & 0xffffff00); - if (0xf < tmpString._capacity) { - uVar12 = tmpString._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)tmpString._buf)) + 0x0))); - if (0xfff < uVar12) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + -4); - uVar12 = tmpString._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 4; - if (0xf < srcCopyCapacity) { - uVar12 = srcCopyCapacity + 1; - ppppppbVar6 = srcCopy; - if (0xfff < uVar12) { - ppppppbVar6 = GHIDRA_CAST(srcCopy[-1]); - uVar12 = srcCopyCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(srcCopy) + (-4 - GHIDRA_INT(ppppppbVar6))))) - goto LAB_006a7e25; - } - operator_delete(ppppppbVar6,uVar12); - } - pBVar14 = costumeEntry; - } - local_1b8 = costumePaths; - slot = 0; - entryPathCapacity = GHIDRA_CAST((GHIDRA_INT(&pBVar14[4]._h) + 4)); - do { - srcLength = GHIDRA_CAST(entryPathCapacity[-1]); - if (srcLength != GHIDRA_CAST(0x0)) { - local_1b4 = entryPathCapacity + -5; - if (0xf < *entryPathCapacity) { - local_1b4 = GHIDRA_CAST(*local_1b4); - } - if (&DAT_0000000f < srcLength) { - uVar12 = GHIDRA_UINT(srcLength) | 0xf; - if (0x7fffffff < uVar12) { - uVar12 = 0x7fffffff; - } - srcCopy = msvc::_Allocate(uVar12 + 1); - memcpy(srcCopy,local_1b4,(size_t)(GHIDRA_INT(srcLength) + 1)); - } - else { - srcCopy = GHIDRA_CAST(*local_1b4); - uStack_114 = local_1b4[1]; - uStack_110 = local_1b4[2]; - uStack_10c = local_1b4[3]; - uVar12 = 0xf; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 9; - tmpString._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = (void *)0x0; - srcCopySize = srcLength; - srcCopyCapacity = uVar12; - if (srcLength < GHIDRA_CAST((GHIDRA_INT(srcLength) + -5))) goto LAB_006a7eb2; - ppppppbVar6 = GHIDRA_CAST(&srcCopy); - if (0xf < uVar12) { - ppppppbVar6 = srcCopy; - } - tmpString._size = 5; - memmove(&tmpString,GHIDRA_CAST((GHIDRA_INT(srcLength) + -5 + GHIDRA_INT(ppppppbVar6))),5); - tmpString._buf[5] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 10; - baseNameSize = 0; - ppppppbVar6 = GHIDRA_CAST(&srcCopy); - if (0xf < uVar12) { - ppppppbVar6 = srcCopy; - } - baseNameCapacity = 0xf; - baseName[0] = (void *)0x0; - (GHIDRA_CAST((GHIDRA_CAST(baseName))))->msvc::string::assign(GHIDRA_CAST(ppppppbVar6),GHIDRA_UINT((GHIDRA_INT(srcLength) + -5))); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0xb; - ppppppbVar6 = GHIDRA_CAST(sizeSuffix); - if (0xf < sizeSuffixCapacity) { - ppppppbVar6 = sizeSuffix[0]; - } - pvVar7 = (GHIDRA_CAST((GHIDRA_CAST(baseName))))->msvc::string::append(GHIDRA_CAST(ppppppbVar6),sizeSuffixSize); - FUN_00417100(pvVar7); - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),0xc); - (GHIDRA_CAST((joinedPath._buf)))->msvc::string::concat_move(GHIDRA_INT(local_1c0),&tmpPath,&tmpString); - psVar8 = local_1b8; - if (local_1b8 != &joinedPath) { - (GHIDRA_CAST((local_1b8->_buf)))->msvc::string::_Tidy_deallocate(); - uVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&(joinedPath._buf)) + 0x0))); - (*GHIDRA_CAST((GHIDRA_CAST(&(joinedPath._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(joinedPath._buf)) + 0x0))) & 0xffffff00; - *GHIDRA_CAST(psVar8->_buf) = uVar2; - *GHIDRA_CAST((psVar8->_buf + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(joinedPath._buf)) + 0x4))); - *GHIDRA_CAST((psVar8->_buf + 8)) = (*GHIDRA_CAST((GHIDRA_CAST(&(joinedPath._buf)) + 0x8))); - *GHIDRA_CAST((psVar8->_buf + 0xc)) = (*GHIDRA_CAST((GHIDRA_CAST(&(joinedPath._buf)) + 0xc))); - psVar8->_size = joinedPath._size; - psVar8->_capacity = joinedPath._capacity; - joinedPath._size = 0; - joinedPath._capacity = 0xf; - } - (GHIDRA_CAST((joinedPath._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((tmpPath._buf)))->msvc::string::_Tidy_deallocate(); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 10; - if (0xf < baseNameCapacity) { - uVar12 = baseNameCapacity + 1; - pvVar7 = baseName[0]; - if (0xfff < uVar12) { - pvVar7 = *(void **)(GHIDRA_INT(baseName[0]) + -4); - uVar12 = baseNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(baseName[0]) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 9; - baseNameSize = 0; - baseNameCapacity = 0xf; - baseName[0] = (void *)(GHIDRA_UINT(baseName[0]) & 0xffffff00); - if (0xf < tmpString._capacity) { - uVar12 = tmpString._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)tmpString._buf)) + 0x0))); - if (0xfff < uVar12) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + -4); - uVar12 = tmpString._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 4; - if (0xf < srcCopyCapacity) { - uVar12 = srcCopyCapacity + 1; - ppppppbVar6 = srcCopy; - if (0xfff < uVar12) { - ppppppbVar6 = GHIDRA_CAST(srcCopy[-1]); - uVar12 = srcCopyCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(srcCopy) + (-4 - GHIDRA_INT(ppppppbVar6))))) - goto LAB_006a7e25; - } - operator_delete(ppppppbVar6,uVar12); - } - local_1b8 = psVar8; - } - slot = slot + 1; - entryPathCapacity = entryPathCapacity + 6; - local_1b8 = local_1b8 + 1; - } while (slot < 5); - pBVar14 = &searchDirs; - pBVar4 = costumeEntry + 0xb; - local_1b4 = GHIDRA_CAST(0x2); - do { - uVar12 = GHIDRA_UINT(pBVar4[1]._l); - if ((uVar12 != 0) && (pBVar14 != pBVar4)) { - text = pBVar4; - if (0xf < *GHIDRA_CAST((GHIDRA_INT(&pBVar4[1]._l) + 4))) { - text = *GHIDRA_CAST(&pBVar4->_l); - } - (GHIDRA_CAST((GHIDRA_CAST(pBVar14))))->msvc::string::assign(GHIDRA_CAST(text),uVar12); - } - pBVar4 = GHIDRA_CAST(&pBVar4[1]._h); - pBVar14 = GHIDRA_CAST(&pBVar14[1]._h); - local_1b4 = GHIDRA_CAST((GHIDRA_INT(local_1b4) + -1)); - } while (local_1b4 != GHIDRA_CAST(0x0)); - } - costumeEntryIdx = costumeEntryIdx + 1; - costumeListBytes = *GHIDRA_CAST((local_1cc->_filename)._buf); - } while (costumeEntryIdx < GHIDRA_UINT(((*GHIDRA_CAST(((local_1cc->_filename)._buf + 4)) - costumeListBytes) / 0xe0))); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1e0)) + 0x4))) = 0; - searchPathsEnd = GHIDRA_CAST(0x0); - local_1d4 = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0xd; - if (searchDir0Size == 0) { -LAB_006a794a: - psVar8 = local_1d4; - psVar10 = searchPathsEnd; - if (searchDir1Size != 0) { - if (searchPathsEnd == local_1d4) { - vector_string_emplace_reallocate(local_1e0 + 4,searchPathsEnd,searchDir1); - psVar8 = local_1d4; - } - else { - (GHIDRA_CAST((searchPathsEnd->_buf)))->msvc::string::string(searchDir1); - searchPathsEnd = psVar10 + 1; - } - } - } - else { - psVar8 = GHIDRA_CAST(0x0); - if (searchDir1Size != 0) { - psVar8 = GHIDRA_CAST(FUN_00694120(searchDir1)); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0xe; - vector_string_emplace_reallocate_move(local_1e0 + 4,GHIDRA_CAST(0x0),psVar8); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0xd; - (GHIDRA_CAST((tmpPath._buf)))->msvc::string::_Tidy_deallocate(); - goto LAB_006a794a; - } - } - psVar10 = searchPathsEnd; - if (searchDir0Size != 0) { - if (searchPathsEnd == psVar8) { - vector_string_emplace_reallocate(local_1e0 + 4,searchPathsEnd,&searchDirs); - } - else { - (GHIDRA_CAST((searchPathsEnd->_buf)))->msvc::string::string(&searchDirs); - searchPathsEnd = psVar10 + 1; - } - } - if (spritePathSize != 0) { - ANM2::Load(local_1c4,GHIDRA_CAST(&spritePath),0); - pEVar9 = bomb; - layerIdx = GHIDRA_CAST(0x0); - bVar3 = extraout_CL; - if ((bomb->_sprite)._layerCount != 0) { - do { - layer = ANM2::GetLayer(&pEVar9->_sprite,layerIdx); - if (layer->_layerData == (void *)0x0) { - tmpString._size = 0; - tmpString._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = (void *)0x0; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(&s_empty,0); - } - else { - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0xf; - resolve_resource_path(&tmpPath,&tmpString,local_1e0 + 4); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0x11; - if (0xf < tmpString._capacity) { - uVar12 = tmpString._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)tmpString._buf)) + 0x0))); - if (0xfff < uVar12) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + -4); - uVar12 = tmpString._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - (GHIDRA_CAST((GHIDRA_CAST(&pEVar9->_sprite))))->Sprite::ReplaceSpritesheet(GHIDRA_INT(layerIdx),&tmpPath); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0xd; - (GHIDRA_CAST((tmpPath._buf)))->msvc::string::_Tidy_deallocate(); - layerIdx = layerIdx + 1; - bVar3 = extraout_CL_00; - } while (layerIdx < GHIDRA_CAST((pEVar9->_sprite)._layerCount)); - } - ANM2::LoadGraphics(local_1c4,bVar3); - layer = ANM2::GetLayer(local_1c4,GHIDRA_CAST("sparks")); - if (layer != GHIDRA_CAST(0x0)) { - layer->_bitflags = layer->_bitflags | 1; - } - } - local_1bc = costumePaths; - local_1c4 = GHIDRA_CAST(0x0); - do { - psVar8 = local_1bc; - costumeSprite = costumeIter; - if (local_1bc->_size != 0) { - ANM2::Load(costumeIter,local_1bc,0); - layerIdx = GHIDRA_CAST(0x0); - pEVar9 = bomb; - pEVar11 = extraout_ECX; - if (bomb->_bombCostumesSprites[0]._layerCount != 0) { - do { - local_1cc = GHIDRA_CAST(pEVar9->_bombCostumesSprites); - layer = ANM2::GetLayer(GHIDRA_CAST(local_1cc),layerIdx); - if (layer->_layerData == (void *)0x0) { - tmpString._size = 0; - tmpString._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = (void *)0x0; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(&s_empty,0); - } - else { - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0x12; - resolve_resource_path(&tmpPath,&tmpString,local_1e0 + 4); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0x14; - if (0xf < tmpString._capacity) { - uVar12 = tmpString._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)tmpString._buf)) + 0x0))); - if (0xfff < uVar12) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + -4); - uVar12 = tmpString._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - (GHIDRA_CAST((local_1cc)))->Sprite::ReplaceSpritesheet(GHIDRA_INT(layerIdx),&tmpPath); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 0xd; - (GHIDRA_CAST((tmpPath._buf)))->msvc::string::_Tidy_deallocate(); - layerIdx = layerIdx + 1; - pEVar9 = GHIDRA_CAST(((&bomb->_sprite)[GHIDRA_INT((layerIdx + -1))]._color._offset + 1)); - } while (layerIdx < GHIDRA_CAST(pEVar9->_bombCostumesSprites[0]._layerCount)); - pEVar11 = bomb; - psVar8 = local_1bc; - } - costumeSprite = costumeIter; - ANM2::LoadGraphics(costumeIter,(uint8_t)pEVar11); - psVar10 = &costumeSprite->_animDefaultName; - if (0xf < (costumeSprite->_animDefaultName)._capacity) { - psVar10 = *GHIDRA_CAST(psVar10->_buf); - } - bVar3 = ANM2::SetAnimation(costumeSprite,GHIDRA_CAST(psVar10),1); - if (bVar3 != 0) { - AnimationState::Rewind(&costumeSprite->_animState); - (costumeSprite->_animState)._isPlaying = 1; - } - bomb->_hasCostumes = 1; - } - pEVar9 = bomb; - local_1c4 = GHIDRA_CAST(((local_1c4->_filename)._buf + 1)); - local_1bc = psVar8 + 1; - costumeIter = costumeSprite + 1; - } while (local_1c4 < GHIDRA_CAST(&DAT_00000005)); - if (savedAnimNameSize != 0) { - if (isAnimPlaying == '\0') { - ppppppbVar6 = GHIDRA_CAST(savedAnimName); - if (0xf < savedAnimNameCapacity) { - ppppppbVar6 = savedAnimName[0]; - } - bVar3 = ANM2::SetAnimation(&bomb->_sprite,GHIDRA_CAST(ppppppbVar6),1); - if (((bVar3 != 0) && ((pEVar9->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(pEVar9->_sprite)._animState,local_1c0), - (pEVar9->_sprite)._animState._animData != (void *)0x0)) { - (pEVar9->_sprite)._animState._isPlaying = 0; - } - } - else { - ppppppbVar6 = GHIDRA_CAST(savedAnimName); - if (0xf < savedAnimNameCapacity) { - ppppppbVar6 = savedAnimName[0]; - } - bVar3 = ANM2::SetAnimation(&bomb->_sprite,GHIDRA_CAST(ppppppbVar6),1); - if (bVar3 != 0) { - AnimationState::Rewind(&(pEVar9->_sprite)._animState); - (pEVar9->_sprite)._animState._isPlaying = 1; - } - if ((pEVar9->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(pEVar9->_sprite)._animState,local_1c0); - } - } - } - msvc::vector::_Tidy(); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 3; - _eh_vector_destructor_iterator_(&searchDirs,0x18,2,msvc::string::_Tidy_deallocate); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 2; - _eh_vector_destructor_iterator_(costumePaths,0x18,5,msvc::string::_Tidy_deallocate); - if (0xf < spritePathCapacity) { - uVar12 = spritePathCapacity + 1; - pvVar7 = spritePath; - if (0xfff < uVar12) { - pvVar7 = *(void **)(GHIDRA_CAST(spritePath) + -4); - uVar12 = spritePathCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(spritePath) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006a7e25; - } - operator_delete(pvVar7,uVar12); - } - spritePathSize = 0; - spritePathCapacity = 0xf; - spritePath = (void *)(GHIDRA_UINT(spritePath) & 0xffffff00); - if (0xf < sizeSuffixCapacity) { - uVar12 = sizeSuffixCapacity + 1; - ppppppbVar6 = sizeSuffix[0]; - if (0xfff < uVar12) { - ppppppbVar6 = GHIDRA_CAST(sizeSuffix[0][-1]); - uVar12 = sizeSuffixCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(sizeSuffix[0]) + (-4 - GHIDRA_INT(ppppppbVar6))))) goto LAB_006a7e25; - } - operator_delete(ppppppbVar6,uVar12); - } - if (0xf < savedAnimNameCapacity) { - uVar12 = savedAnimNameCapacity + 1; - ppppppbVar6 = savedAnimName[0]; - if (0xfff < uVar12) { - ppppppbVar6 = GHIDRA_CAST(savedAnimName[0][-1]); - uVar12 = savedAnimNameCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(savedAnimName[0]) + (-4 - GHIDRA_INT(ppppppbVar6))))) { -LAB_006a7e25: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ppppppbVar6,uVar12); - } - ExceptionList = savedExceptionList; - return; -} diff --git a/generated-src/entity_dummy.cpp b/generated-src/entity_dummy.cpp deleted file mode 100644 index db34b03..0000000 --- a/generated-src/entity_dummy.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "classes.h" - -// 006a7f30 -void Entity_Dummy::Update() -{ - Entity *in_ECX; - - (GHIDRA_CAST((in_ECX)))->Entity::Update(); - (in_ECX->_velocity).x = (in_ECX->_velocity).x * 0.965; - (in_ECX->_velocity).y = (in_ECX->_velocity).y * 0.965; - if (in_ECX->_dead == 0) { - return; - } - /* WARNING: Could not recover jumptable at 0x006a7f76. Too many branches */ - /* WARNING: Treating indirect jump as call */ - in_ECX->Remove(); - return; -} - -// 006a7f80 -void Entity_Dummy::Render(Vector *offset) -{ - Manager *pMVar1; - int iVar2; - KColor textColor; - uint32_t fontSettings; - uint32_t local_12c; - uint32_t local_128; - uint32_t local_124; - uint32_t local_120; - uint32_t local_11c; - uint32_t local_118; - uint8_t text [256]; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afa330; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((text + 0x110)); - ExceptionList = &local_10; - this->Entity::Render(offset); - sprintf_s(text,0x100,GHIDRA_CAST("e%d.%d")); - pMVar1 = g_manager; - iVar2 = Font::get_string_width_n(&g_manager->_font2_TeamMeatEx12,text,-1); - fontSettings = 0; - local_12c = 0xffff; - local_128 = 0; - local_124 = 0x3f800000; - local_120 = 0xffffffff; - local_11c = 0; - local_118 = 0; - local_8 = 0; - textColor._red = 1.0; - textColor._green = 1.0; - textColor._blue = 1.0; - textColor._alpha = 1.0; - textColor._unk = 0; - Font::DrawString(&pMVar1->_font2_TeamMeatEx12,text,&textColor,&fontSettings, - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x1a4)) - (float)iVar2 * 0.5, - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x1a8)) - 8.0); - ExceptionList = local_10; - return; -} diff --git a/generated-src/entity_effect.cpp b/generated-src/entity_effect.cpp deleted file mode 100644 index 8aac711..0000000 --- a/generated-src/entity_effect.cpp +++ /dev/null @@ -1,5454 +0,0 @@ -#include "classes.h" - -// 00435290 -void Entity_Effect::render_player_target(Vector *offset, int segmentMode) -{ - double dVar1; - double dVar2; - uint8_t isLocalPlayer; - int umbilicalData; - int lastIndex; - uint32_t i; - float fVar3; - double dVar4; - double dVar5; - float heightSign; - uint32_t endIndex; - Vector renderPos; - Color beamColor [2]; - float *point; - uint32_t pointCount; - int ringStart; - - umbilicalData = - __RTDynamicCast(this[3]._sprite._overlayAnimState._layerFrames,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, - &IsaacRepentancePlus::UmbilicalBabyData::RTTI_Type_Descriptor); - if (umbilicalData != 0) { - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12bc)) == 5) { - heightSign = (float)&DAT_bf800000; - (GHIDRA_CAST((beamColor)))->Color::Color(); - fVar3 = 0.5; - beamColor[0]._tint[3] = 0.5; - } - else { - fVar3 = 1.0; - heightSign = 1.0; - (GHIDRA_CAST((beamColor)))->Color::Color(); - } - if ((this->_height != 0.0) && (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1)))) { - isLocalPlayer = - NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST((GHIDRA_CAST(this->_height) + 0x1618))); - if (isLocalPlayer == 0) { - FUN_00925df0(); - beamColor[0]._tint[3] = fVar3 * beamColor[0]._tint[3]; - } - } - pointCount = *GHIDRA_CAST((umbilicalData + 0x14)); - i = 0; - endIndex = pointCount - 1; - if (segmentMode == 1) { - endIndex = pointCount >> 1; - } - else if (segmentMode == 2) { - i = pointCount >> 1; - } - if (i < endIndex) { - DAT_00c78ef0 = umbilicalData + 0x18; - DAT_00c78ef4 = 2; - (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c78ef8)) + 0x0))) = 0x100; - g_beamRendererPointsEnd = g_beamRendererPoints; - do { - ringStart = *GHIDRA_CAST((umbilicalData + 0x10)); - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(i) >> 0x1f)]; - lastIndex = *GHIDRA_CAST((umbilicalData + 0x14)) + -1; - fVar3 = g_displayPixelRatio * g_screenPointScale; - dVar2 = __uint_to_double_fixup[-(lastIndex >> 0x1f)]; - point = *(float **) - (*GHIDRA_CAST((umbilicalData + 8)) + - (*GHIDRA_CAST((umbilicalData + 0xc)) - 1U & ringStart + i) * 4); - dVar4 = floor((double)((((*point + 0.0) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * - fVar3 + 0.5)); - dVar5 = floor((double)((((heightSign * - *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((umbilicalData + 8)) + - (*GHIDRA_CAST((umbilicalData + 0xc)) - 1U & - ringStart + i) * 4)) + 8)) + point[1]) - 140.0) * - 0.65 + (g_screenHeight - 182.0) * 0.5) * fVar3 + 0.5)); - renderPos.x = (float)dVar4 / fVar3 + offset->x; - renderPos.y = (float)dVar5 / fVar3 + offset->y; - BeamRenderer::Add(&renderPos,GHIDRA_CAST(beamColor),1.0, - (float)((double)GHIDRA_INT(i) + dVar1) / (float)((double)lastIndex + dVar2)); - i = i + 1; - } while (i <= endIndex); - BeamRenderer::End(); - } - } - return; -} - -// 00435e60 -void Entity_Effect::set_state(int state) -{ - this->_state = state; - return; -} - -// 00435e90 -void Entity_Effect::SetTimeout(int timeout) -{ - this->_timeout = timeout; - this->_lifespan = timeout; - return; -} - -// 00435eb0 -void Entity_Effect::set_rotation(float rotation) -{ - this->_rotation = rotation; - return; -} - -// 00435ef0 -void Entity_Effect::SetRadii(float minRadius, float maxRadius) -{ - this->_minRadius = minRadius; - this->_maxRadius = maxRadius; - return; -} - -// 004564b0 -void Entity_Effect::FollowParent(Entity *parent) -{ - Entity_Effect *local_c [2]; - uint32_t *parentRef; - float parentX; - float parentY; - float posX; - float posY; - - parentRef = &this->_parent; - local_c[0] = this; - if (this->_parent != 0) { - local_c[0] = GHIDRA_CAST(parentRef); - msvc::multiset::erase(local_c); - } - *parentRef = parent; - if (parent != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(parentRef); - } - posX = (this->_pos).x; - posY = (this->_pos).y; - parentX = (parent->_pos).x; - parentY = (parent->_pos).y; - this->_isFollowing = 1; - (this->_parentOffset).x = posX - parentX; - (this->_parentOffset).y = posY - parentY; - return; -} - -// 004d7770 -long double Entity_Effect::Scale() -{ - return (long double)this->_scale; -} - -// 005784c0 -long double Entity_Effect::Rotation() -{ - return (long double)this->_rotation; -} - -// 005ccc20 -void Entity_Effect::HandleCollision() -{ - return 1; -} - -// 005cd950 -bool Entity_Effect::rift_attract_filter(int param_1, int param_2) -{ - return param_1 != param_2; -} - -// 005cd960 -void Entity_Effect::constructor() -{ - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Effect::vftable; - (this->_parentOffset).y = 0.0; - (this->_parentOffset).x = 0.0; - (this->_hitList)._begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x488)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x484)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x490)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x48c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4b4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4b8)))) = 0; - return; -} - -// 005cdb20 -void Entity_Effect::Init(int type, int variant, int subType, uint32_t initSeed) -{ - uint8_t bVar1; - char isDeathmatch; - uint8_t *pbVar2; - LayerState *layer; - Entity *tmpEntity; - int iVar3; - uint32_t uVar4; - int iVar5; - Entity_Player *player; - char *pcVar6; - std_string *psVar7; - ColorMod *color; - ColorMod *extraout_EAX; - Vector *vecResult; - void *extraout_EAX_00; - Room *pRVar8; - AnimationState *animState; - GridEntity *currentRoom; - uint32_t *clampedSubtype; - Game *game; - RoomDescriptor *currentRoomDesc; - RoomDescriptor *linkedRoomDesc; - Entity_Familiar *tmpEntity; - ColorMod *tmpColor; - Sprite *wispSprite; - Font *spriteColor; - uint32_t extraout_EAX_01; - void *extraout_EAX_02; - void *extraout_EAX_03; - void *extraout_EAX_04; - void *pvVar10; - void *extraout_EAX_05; - void *extraout_EAX_06; - void *extraout_EAX_07; - void *pvVar11; - void *extraout_EAX_08; - Entity_Effect *pEVar12; - ColorMod *other; - void *extraout_EAX_09; - uint32_t uVar13; - Color *colorTarget; - ColorMod *color_00; - ColorMod *color_01; - Vector *playerPos; - ColorMod *color_02; - uint32_t *listEntry; - uint8_t *puVar14; - RNG *seedRng; - void *extraout_EAX_10; - ColorMod *color_03; - uint32_t extraout_EAX_11; - EntityList *entityList; - int *piVar15; - RNG *rng; - ANM2 *sprite; - float fVar16; - float scale; - uint32_t uVar17; - uint32_t uVar18; - uint32_t uVar19; - uint8_t local_36c [40]; - uint8_t local_344 [20]; - uint8_t local_330 [20]; - uint8_t local_31c [20]; - uint8_t local_308 [20]; - uint8_t local_2f4 [4]; - uint8_t auStack_2f0 [12]; - Level *local_2e4; - Vector scratchVec; - KColor local_2d8; - char isReplaced; - Vector local_2c0; - LayerState *local_2b8; - Entity_Familiar *local_2b4; - Entity_Effect *effect; - Color scratchColor; - std_string minesLavaSheet; - std_string blueWombSheet; - std_string wombSheet; - std_string depthsSheet; - std_string cavesSheet; - std_string corpse2Sheet; - std_string corpseSheet; - std_string mausoleumSheet; - std_string minesLava2Sheet; - std_string minesSheet; - Color fadedColor; - Color faintColor; - Color orangeOffsetColor; - Color splatTint; - Color defaultColor; - std_string local_b4; - std_string sheetPath3; - std_string sheetPath2; - Color workColor; - std_string sheetPath; - uint8_t local_28 [8]; - uint64_t local_20; - int local_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - KColor *blendMode; - bool isOpened; - Manager *manager; - code *setColorFn; - Level *subSprite; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af61a2; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((local_28 + 0x24)); - ExceptionList = &local_10; - effect = this; - FUN_0060c800(0); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Init(type,variant,subType,initSeed); - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(1); - this->_maxHitPoints = 0.0; - if (this->_config != (void *)0x0) { - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),0); - pbVar2 = (GHIDRA_CAST(((this->_sprite)._animDefaultName._buf)))->msvc::string::c_str(); - ANM2::Play(&this->_sprite,pbVar2,0); - } - this->_state = 0; - this->_timeout = -1; - this->_lifespan = 1; - (this->_parentOffset).x = g_vectorZero.x; - (this->_parentOffset).y = g_vectorZero.y; - this->_rotation = 0.0; - this->_isFollowing = 0; - this->_scale = 1.0; - this->_minRadius = 0.0; - this->_maxRadius = 0.0; - this->_damageSource = 0; - *GHIDRA_CAST(&(this->_varData)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_varData)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._h) + 4)) = 0; - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - switch(this->_variant) { - case 7: - case 0x12: - case 0x16: - case 0x17: - case 0x18: - case 0x19: - case 0x1a: - case 0x20: - case 0x25: - case 0x2c: - case 0x2d: - case 0x2e: - case 0x35: - case 0x36: - case 0x38: - case 0x4d: - case 0x4e: - case 0x59: - case 0x5a: - case 0x5c: - case 0x5d: - case 0x5e: - case 100: - case 0xa9: - case 0xc3: - case 0xcc: - this->_visible = 0; - goto LAB_005cdc8a; - } - } - iVar3 = this->_variant; - if ((((((((iVar3 == 0x16) || (iVar3 == 0x17)) || (iVar3 == 0x18)) || - ((iVar3 == 0x19 || (iVar3 == 0x1a)))) || (iVar3 == 0x20)) || - (((iVar3 == 0x4e || (iVar3 == 0x25)) || - ((iVar3 == 0x2c || (((iVar3 == 0x2d || (iVar3 == 0x2e)) || (iVar3 == 0x36)))))))) || - ((iVar3 == 0x35 || (iVar3 == 0xcc)))) || - ((iVar3 == 0x38 || - (((iVar3 == 0x5a || (iVar3 == 0x5c)) || - ((iVar3 == 0x5d || (((iVar3 == 0x5e || (iVar3 == 0xc3)) || (iVar3 == 0xa9)))))))))) { - this->_sortingLayer = 0; - this->_renderZOffset = 2000; - if ((((iVar3 == 0x20) || (iVar3 == 0x25)) || (iVar3 == 0x4e)) || (iVar3 == 0x5a)) { - this->_lifespan = 0x122; - iVar3 = 0x122; - } - else { - iVar3 = 0x7d; - } - this->_timeout = iVar3; - game = g_game; - iVar3 = this->_variant; - this->_isInitFlag176 = 1; - if ((iVar3 == 0x16) && (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1d18)) == 10)) { - (GHIDRA_CAST((&scratchColor)))->Color::Reset(); - (GHIDRA_CAST((&scratchColor)))->Color::SetTint(0.5,0.5,0.5,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&(this->_sprite)._color))))->Color::operator_assign(GHIDRA_CAST(&scratchColor)); - iVar3 = this->_variant; - } - if (iVar3 == 0xa9) { - piVar15 = &(this->_sprite)._bitflags; - *piVar15 = *piVar15 | 0x20; - } - if (iVar3 == 0xc3) { - (GHIDRA_CAST((&orangeOffsetColor)))->Color::Reset(); - (GHIDRA_CAST((&orangeOffsetColor)))->Color::SetTint(0.0,0.0,0.0,1.0); - orangeOffsetColor._offset[0] = 0.6; - orangeOffsetColor._offset[1] = 0.4; - orangeOffsetColor._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(&(this->_sprite)._color))))->Color::operator_assign(GHIDRA_CAST(&orangeOffsetColor)); - iVar3 = this->_variant; - } - } - else { - if ((iVar3 != 7) && (iVar3 != 0x12)) { - if (iVar3 == 0x59) { - pvVar10 = (this->_sprite)._animState._animData; - if ((pvVar10 == (void *)0x0) || (uVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x30)), uVar4 == 0)) { - uVar13 = 0; - } - else { - uVar13 = Random(); - uVar13 = uVar13 % uVar4; - pvVar10 = (this->_sprite)._animState._animData; - } - if (pvVar10 != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(uVar13)); - } - (GHIDRA_CAST((&faintColor)))->Color::Reset(); - (GHIDRA_CAST((&faintColor)))->Color::SetTint(1.0,1.0,1.0,0.3); - faintColor._offset[0] = 0.0; - tmpColor = GHIDRA_CAST(&faintColor); - faintColor._offset[1] = 0.0; - faintColor._offset[2] = 0.0; - } - else { - if (iVar3 != 100) goto LAB_005ce02f; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Final"),0); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_blendMode[0] = 0; - layer->_blendMode[1] = 4; - layer->_blendMode[2] = 7; - layer->_blendMode[3] = 4; - layer->_blendMode[4] = 7; - (GHIDRA_CAST((&fadedColor)))->Color::Reset(); - (GHIDRA_CAST((&fadedColor)))->Color::SetTint(1.0,1.0,1.0,0.66); - fadedColor._offset[0] = 0.0; - tmpColor = GHIDRA_CAST(&fadedColor); - fadedColor._offset[1] = 0.0; - fadedColor._offset[2] = 0.0; - } - (GHIDRA_CAST((GHIDRA_CAST(&(this->_sprite)._color))))->Color::operator_assign(tmpColor); - } - iVar3 = this->_variant; - if ((iVar3 != 7) && (iVar3 != 0x12)) { - uVar17 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 8; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar17; - } - this->_sortingLayer = 0; - } -LAB_005ce02f: - if (((iVar3 == 1) || (iVar3 == 0x12)) && - ((tmpEntity = GHIDRA_CAST(this->_spawnerEntity), tmpEntity == GHIDRA_CAST(0x0) || - ((tmpEntity->_type != 1 && - (tmpEntity = (GHIDRA_CAST((tmpEntity)))->Entity::GetPlayerAncestor(), tmpEntity == GHIDRA_CAST(0x0))))))) { - iVar3 = PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,0x3f); - if (iVar3 == 2) { - scale = (this->_sprite)._scale.x * 0.75; - fVar16 = (this->_sprite)._scale.y * 0.75; - } - else { - if (iVar3 < 3) goto LAB_005ce0c2; - scale = (this->_sprite)._scale.x * 0.5; - fVar16 = (this->_sprite)._scale.y * 0.5; - } - (this->_sprite)._scale.y = fVar16; - (this->_sprite)._scale.x = scale; - } -LAB_005ce0c2: - iVar3 = this->_variant; - if (iVar3 == 0xe) { - this->_sortingLayer = 0; - uVar4 = Random(); - (this->_sprite)._flipX = (uint8_t)uVar4 & 1; - iVar3 = this->_variant; - } - iVar5 = 3; - if (iVar3 != 5) { - iVar5 = 0; - } - this->_entityGridCollisionClass = iVar5; - this->_entityCollisionClass = 0; - game = g_game; - if ((((iVar3 == 0xc) || (iVar3 == 0xd)) || (iVar3 == 0x4f)) || (iVar3 == 0x50)) { - uVar4 = Random(); - this->_rotation = ((float)(uVar4 & 3) + 0.0) * 90.0; - goto LAB_005d03c8; - } - if (iVar3 == 0x61) { - uVar4 = Random(); - this->_isInitFlag176 = 1; - this->_rotation = ((float)(uVar4 & 3) + 0.0) * 90.0; - uVar4 = Random(); - (this->_sprite)._flipX = ((uint8_t)uVar4 ^ 0xff) & 1; - goto LAB_005d03cf; - } - if (iVar3 == 1) { - uVar4 = Random(); - (this->_sprite)._flipX = ((uint8_t)uVar4 ^ 0xff) & 1; - goto LAB_005d03cf; - } - if ((((iVar3 == 4) || (iVar3 == 0x1b)) || - ((iVar3 == 0x23 || ((iVar3 == 0x55 || (iVar3 == 0x56)))))) || - ((iVar3 == 0x5f || ((iVar3 == 0x62 || (iVar3 == 0xa3)))))) { - this->_fallingAcceleration = 1.3; - uVar4 = Random(); - this->_height = -23.0; - (this->_posOffset).y = -23.0; - iVar3 = this->_variant; - this->_fallingSpeed = - -5.0 - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 10.0; - if ((iVar3 == 0x1b) || (iVar3 == 0xa3)) { - uVar4 = Random(); - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST((&PTR_DAT_00b63bc8)[uVar4 & 3]),0); - } - else if ((((iVar3 == 0x23) || (iVar3 == 0x55)) || (iVar3 == 0x56)) || - ((iVar3 == 0x5f || (iVar3 == 0x62)))) { - uVar4 = Random(); - uVar13 = Random(); - if ((uVar13 % 3 == 0) && (this->_variant != 0x55)) { - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST((&PTR_s_Gib01_00b63ba8)[uVar4 & 3]),0); - } - else { - ANM2::Play(&this->_sprite,GHIDRA_CAST((&PTR_s_Gib01_00b63ba8)[uVar4 & 3]),0); - } - } - goto LAB_005d03cf; - } - if (iVar3 == 0x3a) { - this->_fallingAcceleration = 1.3; - this->_height = -23.0; - uVar4 = Random(); - local_2b8 = (LayerState *) - ((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 360.0); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_rotation = (float)local_2b8; - uVar4 = Random(); - ANM2::Play(&this->_sprite,(&PTR_s_Gib01_00b63b94)[uVar4 % 5],0); - uVar4 = Random(); - this->_fallingSpeed = - 5.0 - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 30.0; - goto LAB_005d03cf; - } - if (iVar3 == 0x22) { - if (this->_subtype == 1) { - (GHIDRA_CAST((local_b4._buf)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/Effects/Effect_Fart_Red.png")); - local_8 = 0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&local_b4); - local_8 = 0xffffffff; - (GHIDRA_CAST((local_b4._buf)))->msvc::string::_Tidy_deallocate(); - ANM2::LoadGraphics(&this->_sprite,0); - } - uVar4 = Random(); - (this->_sprite)._flipX = ((uint8_t)uVar4 ^ 0xff) & 1; - manager = g_manager; - if ((GHIDRA_UINT(this->_subtype) < 10) && - ((this->_spawnerEntity == 0 || (*GHIDRA_CAST((this->_spawnerEntity + 0x28)) != 0x108)))) { - local_2b4 = GHIDRA_CAST(0x25); - seed_fart_sound_override(GHIDRA_CAST(&local_2b4)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_2b4),1.0,0x14,0,1.0,0.0); - } - this->_renderZOffset = 1000; - goto LAB_005d03cf; - } - if (iVar3 == 8) { - this->_renderDepthOffset = -40.0; - goto LAB_005d03cf; - } - if (((iVar3 == 10) || (iVar3 == 0x34)) || (iVar3 == 0x33)) { - iVar3 = this->_spawnerEntity; - this->_entityGridCollisionClass = 6; - if (((iVar3 != 0) && ((*GHIDRA_CAST((iVar3 + 0x28)) == 2 || (*GHIDRA_CAST((iVar3 + 0x28)) == 4)))) && - (*GHIDRA_CAST((iVar3 + 0x3c8)) != GHIDRA_CAST(0x0))) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSpawnerEntity(*GHIDRA_CAST((iVar3 + 0x3c8))); - } - pvVar10 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4b4))); - if (this->_variant != 10) { - this->_scale = 1.0; - this->_timeout = 300; - this->_lifespan = 300; - } - goto LAB_005d03dd; - } - if (iVar3 == 0x1f) { - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST("Falling"),0); - goto LAB_005d03cf; - } - if (iVar3 == 0x37) { - this->_state = 1; - this->_collisionDamage = 1.0; - player = PlayerManager::FirstTrinketOwner(&game->_playerManager,0x97); - if (player == GHIDRA_CAST(0x0)) { -LAB_005ce40c: - pcVar6 = "SummonWomb"; - } - else { - iVar3 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x97); - pcVar6 = "SummonWombDisabled"; - if (iVar3 < 2) goto LAB_005ce40c; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(pcVar6),0); - goto LAB_005d03cf; - } - if (variant == 0x15) { - this->_sortingLayer = 1; -LAB_005d0198: - if (this->_variant == 0x44) { - this->_sortingLayer = 0; - this->_renderZOffset = 5000; - uVar4 = Random(); - local_2c0.y = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 10000.0; - uVar4 = Random(); - (this->_targetPosition).x = - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 40.0; - (this->_targetPosition).y = local_2c0.y; - } - this->_mass = 1.0; - this->_entityCollisionClass = 4; -LAB_005d03c8: - this->_isInitFlag176 = 1; - goto LAB_005d03cf; - } - if (variant == 0x21) { - uVar4 = RoomConfig::GetStageID(g_game->_stage,g_game->_stageType,-1); - if (uVar4 == 0xf) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("White"),0); - } - goto LAB_005d0198; - } - if (variant == 0x44) goto LAB_005d0198; - if (variant == 2) { - if (this->_subtype - 1U < 5) { - ANM2::Play(&this->_sprite,(&PTR_s_Poof_Large_00b63b48)[this->_subtype],0); - } - goto LAB_005d03c8; - } - if (variant == 0xf) { - if (this->_subtype - 1U < 3) { - ANM2::Play(&this->_sprite,(&PTR_s_Poof2_00b63b3c)[this->_subtype],0); - } - this->_renderZOffset = 8000; - goto LAB_005d03cf; - } - if (variant == 0x10) { - iVar3 = this->_subtype; - if ((iVar3 == 1) || (iVar3 == 3)) { - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 0x10) { - this->_sortingLayer = 0; - } - ANM2::Play(&this->_sprite,&DAT_00b1d534,0); - } - else if (((iVar3 == 2) || (iVar3 == 4)) || (iVar3 == 5)) { - this->_renderZOffset = 8000; - ANM2::Play(&this->_sprite,&DAT_00b1d534,0); - } - else { - if (iVar3 == 0x42) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) = this->_initSeed; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x0))) = 1.4013e-45; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) = 1.54143e-44; - local_18 = 6; - local_8 = 1; - (GHIDRA_CAST((GHIDRA_CAST((local_28 + 4)))))->RNG::Next(); - ANM2::Play(&this->_sprite,(&PTR_s_Poof0_00b63b34)[(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_28))) + 0x4))) % 3],0); - local_8 = 0xffffffff; - } - else { - if (iVar3 != 0x43) goto LAB_005d03cf; - ANM2::Play(&this->_sprite,GHIDRA_CAST("PoofLarge"),0); - } - (this->_sprite)._flipX = ~(uint8_t)this->_initSeed & 1; - } - goto LAB_005d03cf; - } - if (variant == 0x39) { - pcVar6 = "Effect"; - if (this->_subtype != 0) { - pcVar6 = "Effect2"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(pcVar6),0); - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 0x10) { - this->_sortingLayer = 0; - } - goto LAB_005d03d7; - } - if (variant == 0x3b) { - pcVar6 = ANM2::GetAnimationData(&this->_sprite,GHIDRA_CAST("Clouds")); - if (pcVar6 != GHIDRA_CAST(0x0)) { - local_2b8 = *GHIDRA_CAST((pcVar6 + 0x30)); - if (local_2b8 == GHIDRA_CAST(0x0)) { - local_2b4 = GHIDRA_CAST(0x0); - } - else { - uVar4 = Random(); - local_2b4 = GHIDRA_CAST((uVar4 % GHIDRA_UINT(local_2b8))); - } - psVar7 = GHIDRA_CAST((GHIDRA_CAST((pcVar6)))->std)::string::c_str(); - ANM2::SetFrame(&this->_sprite,psVar7,GHIDRA_INT(local_2b4)); - uVar4 = Random(); - (this->_sprite)._flipX = ((uint8_t)uVar4 ^ 0xff) & 1; - uVar4 = Random(); - (this->_sprite)._rotation = - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 360.0 - 180.0; - (this->_sprite)._scale.x = 0.5; - (this->_sprite)._scale.y = 0.5; - this->_renderZOffset = 8000; - if (this->_subtype == 1) { - (GHIDRA_CAST((&workColor)))->Color::Reset(); - (GHIDRA_CAST((&workColor)))->Color::SetTint(1.0,1.0,1.0,1.0); - workColor._offset[0] = -0.5; - workColor._offset[1] = -0.5; - workColor._offset[2] = -0.5; - (GHIDRA_CAST((GHIDRA_CAST(&(this->_sprite)._color))))->Color::operator_assign(GHIDRA_CAST(&workColor)); - } - } - goto LAB_005d03cf; - } - if (iVar3 == 0x3c) { - this->_entityGridCollisionClass = 3; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Rotate"),0); - (this->_posOffset).x = 0.0; - manager = g_manager; - (this->_posOffset).y = -20.0; - local_2b8 = GHIDRA_CAST(0x345); - seed_fart_sound_override(GHIDRA_CAST(&local_2b8)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_2b8),1.0,2,1,1.0,0.0); - goto LAB_005d03cf; - } - if (iVar3 == 0x3d) { - this->_visible = 0; - this->_timeout = 0x14; - this->_minRadius = 20.0; - this->_maxRadius = 95.0; - goto LAB_005d03cf; - } - if (iVar3 == 0x43) { - this->_visible = 0; - this->_timeout = 0x32; - this->_minRadius = 45.0; - this->_maxRadius = 320.0; - goto LAB_005d03cf; - } - if (iVar3 != 0x3e) { - if (iVar3 == 0x29) { - iVar3 = g_game->_stage; - if (iVar3 < 7) { - if (((iVar3 == 5) || (iVar3 == 6)) && (g_game->_stageType == 2)) { - msvc::string::string_from_cstr - (sheetPath3._buf,GHIDRA_CAST("gfx/Effects/Effect_DankDroplets.png")); - local_8 = 0xe; - goto LAB_005ceb44; - } - } - else { - msvc::string::string_from_cstr - (sheetPath3._buf,GHIDRA_CAST("gfx/Effects/Effect_BloodDroplets.png")); - local_8 = 0xd; -LAB_005ceb44: - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath3); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath3._buf)))->msvc::string::_Tidy_deallocate(); - } - uVar4 = Random(); - this->_state = uVar4 % 3; - if (uVar4 % 3 == 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("LargeDrop"),0); - uVar4 = Random(); - scale = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.5; - fVar16 = scale * g_vectorOne.x; - (this->_sprite)._scale.y = scale * g_vectorOne.y; - (this->_sprite)._scale.x = fVar16; - } - else { - ANM2::Play(&this->_sprite,GHIDRA_CAST("SmallDrop"),0); - } - this->_height = -10.0; - uVar4 = Random(); - (this->_sprite)._flipX = ((uint8_t)uVar4 ^ 0xff) & 1; - goto LAB_005d03cf; - } - if (iVar3 != 0x41) { - if (iVar3 == 0x3f) { - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar1 = (GHIDRA_CAST((pRVar8)))->Room::is_type_16(); - if (bVar1 != 0) { -LAB_005cdc8a: - this->Remove(); - ExceptionList = local_10; - return; - } - iVar3 = this->_subtype; - if (iVar3 == 0) { - pcVar6 = "WormHori"; -LAB_005ceeab: - ANM2::Play(&this->_sprite,GHIDRA_CAST(pcVar6),0); - } - else { - if (iVar3 == 1) { - pcVar6 = "MaggotHori"; - goto LAB_005ceeab; - } - if (iVar3 == 2) { - pcVar6 = "LeechHori"; - goto LAB_005ceeab; - } - } - fVar16 = random_float(); - fVar16 = normalize_angle_degrees(fVar16 * 360.0); - this->_rotation = fVar16; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16); - this->_sortingLayer = 1; - this->_fallingAcceleration = 1.3; - fVar16 = random_float(); - this->_fallingSpeed = 5.0 - fVar16 * 30.0; - goto LAB_005d03cf; - } - if (iVar3 == 0x40) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("WalkHori"),0); - fVar16 = random_float(); - local_2b8 = GHIDRA_CAST(normalize_angle_degrees(fVar16 * 360.0)); - this->_rotation = (float)local_2b8; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_rotation = (float)local_2b8; - this->_height = 0.0; - } - else { - if (iVar3 != 0x45) { - if (iVar3 == 0x46) { - iVar3 = Isaac::Random(3); - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST("Droplets"),iVar3); - this->_fallingAcceleration = 1.3; - fVar16 = random_float(); - this->_shadowSize = 0.04; - this->_fallingSpeed = 1.0 - fVar16 * 15.0; - goto LAB_005d03d7; - } - if ((iVar3 == 0x47) || (iVar3 == 0x6e)) { - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_minFilterMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_magFilterMode = 1; - if (this->_variant == 0x6e) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("IdleQuick"),0); - } - } - else if (iVar3 == 0x7e) { - iVar3 = Isaac::Random(4); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation((float)((double)iVar3 + __uint_to_double_fixup[-(iVar3 >> 0x1f)]) * - 90.0); - iVar3 = Isaac::Random(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(iVar3 == 0); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_visible = 0; - if (this->_subtype == 1) { - SetTimeout(this,0x3c); - fVar16 = random_float(); - SoundEffects::PlayWithFartOverride2(0x22d,GHIDRA_INT(&this->_pos),2,0,fVar16 * 0.2 + 0.9,1.0) - ; - } - else { - SetTimeout(this,0x5a); - fVar16 = random_float(); - SoundEffects::PlayWithFartOverride2(0x110,GHIDRA_INT(&this->_pos),2,0,fVar16 * 0.3 + 2.7,0.6) - ; - } - } - else if ((iVar3 == 0x7f) || (iVar3 == 0xca)) { - this->_visible = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - if (this->_variant == 0xca) { - iVar3 = 0x365; -LAB_005cf680: - SoundEffects::PlayWithFartOverride(iVar3,1.0,2,0,1.0); - } - } - else if (iVar3 == 0x48) { - this->_visible = 0; - this->_timeout = 0xf0; - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero); - } - else if (iVar3 == 0x49) { - this->_visible = 0; - this->_timeout = 8; - } - else if (iVar3 == 0x4a) { - this->_sortingLayer = 0; - this->_entityGridCollisionClass = 3; - this->_entityCollisionClass = 1; - currentRoom = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - iVar3 = (GHIDRA_CAST((currentRoom)))->GridEntity::GetVariant(); - if (iVar3 == 0x13) { - msvc::string::string_from_cstr - (sheetPath2._buf,GHIDRA_CAST("gfx/Effects/IsaacCarpet_Barren.png")); - local_8 = 0xf; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath2); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath2._buf)))->msvc::string::_Tidy_deallocate(); - } - } - else if (iVar3 == 0x4b) { - this->_timeout = 0x32; - this->_fallingAcceleration = 1.3; - this->_fallingSpeed = 0.5; - ANM2::Play(&this->_sprite,&DAT_00b634bc,0); - } - else if (iVar3 == 0x4c) { - local_2e4 = GHIDRA_CAST(&DAT_00000005); - clampedSubtype = std_min_ptr(GHIDRA_CAST(&local_2e4),GHIDRA_CAST(&this->_subtype)); - ANM2::Play(&this->_sprite,(&PTR_DAT_00b63b70)[*clampedSubtype],0); -LAB_005cf2a4: - this->_sortingLayer = 0; - } - else if (iVar3 == 0x24) { - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((pRVar8)))->Room::GetBackdropType(); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_004aae70(); - iVar3 = FUN_005cd470(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST((iVar3 + 0x108))); - this->_sortingLayer = 1; - } - else if (iVar3 == 0x1d) { - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero); - this->_collisionDamage = 300.0; - } - else if (iVar3 == 0x13) { - this->_collisionDamage = 20.0; - } - else if (iVar3 == 0x51) { - this->_fallingSpeed = 0.0; - this->_height = -60.0; - (this->_posOffset).y = -60.0; - this->_entityGridCollisionClass = 6; - } - else if (iVar3 == 0x52) { - sprite = &this->_sprite; - local_2b4 = GHIDRA_CAST(sprite); - if (this->_subtype == 1) { - msvc::string::string_from_cstr - (sheetPath2._buf,GHIDRA_CAST("gfx/Effects/wombhole_orange.png")); - local_8 = 0x10; - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath2); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath2._buf)))->msvc::string::_Tidy_deallocate(); - } - this->_sortingLayer = 0; - this->_state = 0; - ANM2::Play(sprite,GHIDRA_CAST("Closed"),0); - Config::GetCollectibles(); - layer = GHIDRA_CAST(FUN_00436120(this->_subtype - 1U & 1)); - local_2b8 = layer; - local_2e4 = GHIDRA_CAST(Config)::GetCollectibles(); - pvVar10 = layer->_layerData; - game = GHIDRA_CAST(Config)::GetCollectibles(); - currentRoomDesc = Game::GetCurrentRoomDesc(game); - linkedRoomDesc = Level::GetRoomByIdx(local_2e4,GHIDRA_INT(pvVar10),-1); - if ((-1 < GHIDRA_INT(local_2b8->_layerData)) || - (isOpened = false, linkedRoomDesc == currentRoomDesc)) { - isOpened = true; - } - pcVar6 = "Opened"; - if (!isOpened) { - pcVar6 = "Closed"; - } - ANM2::Play(GHIDRA_CAST(local_2b4),GHIDRA_CAST(pcVar6),0); - Config::GetCollectibles(); - this = effect; - iVar3 = FUN_00436120(effect->_subtype); - if (*GHIDRA_CAST((iVar3 + 8)) != '\0') { - player = Game::GetPlayer(g_game,0); - tmpEntity = Entity_Player::AddWisp(player,0x18c,&this->_pos,0,1); - local_2b4 = tmpEntity; - if (tmpEntity != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetParent(GHIDRA_CAST(this)); - if (this->_subtype != 0) { - tmpColor = ColorParams::set_from_bytes - (GHIDRA_CAST(&workColor),400,0xfa,0x3c,0xff,0,0,0); - wispSprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_2b4))))->Entity)::GetSprite(); - layer = (GHIDRA_CAST((wispSprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(tmpColor); - tmpColor = ColorParams::set_from_bytes - (GHIDRA_CAST(&workColor),300,200,10,0xff,0,0,0); - wispSprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_2b4))))->Entity)::GetSprite(); - layer = (GHIDRA_CAST((wispSprite)))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - (GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(tmpColor); - tmpEntity = local_2b4; - } - FUN_0063c060(9); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar3 = (GHIDRA_CAST((pRVar8)))->Room::GetFrameCount(); - if (iVar3 < 2) { - (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::ClearEntityFlags(4); - } - tmpEntity->Update(); - } - } - } - else if (iVar3 == 0x57) { - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,blendMode); - fVar16 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomFloat(); - local_2c0.y = fVar16 * 0.5 + 0.5; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&scratchVec,&local_2c0.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - } - else if (iVar3 == 0x58) { - if (this->_subtype == 1) { - msvc::string::string_from_cstr - (sheetPath2._buf,GHIDRA_CAST("gfx/Effects/Effect_088_PurpleBall.png")); - local_8 = 0x11; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath2); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath2._buf)))->msvc::string::_Tidy_deallocate(); - } - uVar4 = Random(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::PlayRandom(uVar4); - iVar3 = Isaac::Random(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(iVar3 == 0); - this->_renderZOffset = -1000; - } - else { - if (iVar3 == 0x5b) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("JumpDown"),0); - iVar3 = 2; - goto LAB_005cf680; - } - if (iVar3 == 99) { - if (this->_subtype == 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - fVar16 = random_float(); - Font::SetLineHeightModifier(spriteColor,fVar16 * 0.15 + 0.05); - iVar3 = Isaac::Random(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(iVar3 == 0); - fVar16 = random_float(); - local_2c0.y = fVar16 * 0.2 + 0.5; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&scratchVec,&local_2c0.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - fVar16 = random_float(); - local_2c0.y = fVar16 * 2.0 + 1.0; - fVar16 = random_float(); - SoundEffects::PlayWithFartOverride(0x18e,fVar16 * 0.5 + 0.5,2,0,local_2c0.y); - } - else { - this->_fallingAcceleration = 0.5; - fVar16 = random_float(); - this->_height = -10.0; - this->_fallingSpeed = -1.0 - fVar16 * 2.0; - fVar16 = random_float(); - local_2c0.y = fVar16 * 0.5 + 0.5; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&scratchVec,&local_2c0.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - fVar16 = random_float(); - Font::SetLineHeightModifier(spriteColor,fVar16 * 0.3 + 0.1); - } - } - else if (iVar3 == 0x53) { - iVar3 = Game::Challenge(g_game); - if (iVar3 == 0x1e) { - msvc::string::string_from_cstr - (sheetPath._buf,GHIDRA_CAST("gfx/Effects/Effect_101_FireSword.png")); - local_8 = 0x12; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::_Tidy_deallocate(); - } - } - else if (iVar3 == 0x35) { - this->_timeout = 0x19; - } - else if (iVar3 == 0x68) { - uVar4 = this->_subtype; - if (uVar4 == 0) { - this->_visible = 0; - } - else if (uVar4 == 1) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Projectile"),0); - fVar16 = random_float(); - this->_height = -(fVar16 * 4.0 + 12.0); - local_2e4 = GHIDRA_CAST(random_float()); - local_2c0.y = random_float(); - random_float(); - setColorFn = *(code **)(*GHIDRA_CAST(this) + 0x3c); - (GHIDRA_CAST((&workColor)))->Color::Color(); - (*setColorFn)(extraout_EAX_01,0xffffffff,0xff,0,1); - } - else { - if (uVar4 == 2) { - bVar1 = 0; - pcVar6 = "Explode"; - } - else { - if (uVar4 < 3) goto LAB_005cf9dd; - bVar1 = 0; - iVar3 = Isaac::Random(4); - pcVar6 = (&PTR_s_Particle1_00b63b60)[iVar3]; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(pcVar6),bVar1); - } -LAB_005cf9dd: - if (this->_subtype != 1) { - fVar16 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16 * 360.0 - 180.0); - } - (GHIDRA_CAST((local_308)))->BlendMode::SetMode(2,0); - pvVar10 = extraout_EAX_02; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,pvVar10); - } - else if (iVar3 == 0x69) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("PoofStart"),0); - this->_renderZOffset = 1000; - } - else if (iVar3 == 0x6a) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - this->_renderZOffset = 1000; - (this->_posOffset).y = -20.0; - } - else if (iVar3 == 0x27) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - if (this->_subtype == 1) { - if (this->_spawnerType != 0) goto LAB_005cf2a4; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_minFilterMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_magFilterMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x2)); - layer->_minFilterMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x2)); - layer->_magFilterMode = 1; - (GHIDRA_CAST((local_308)))->BlendMode::SetMode(2,0); - pvVar10 = extraout_EAX_03; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,pvVar10); - (GHIDRA_CAST((local_308)))->BlendMode::SetMode(2,0); - pvVar10 = extraout_EAX_04; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x2)); - copy_20_bytes(layer->_blendMode,pvVar10); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x2)); - game = g_game; - layer->_visible = 0; - tmpEntity = Game::Spawn(game,this->_type,this->_variant,&this->_pos,&g_vectorZero, - GHIDRA_CAST(this),this->_subtype,this->_initSeed); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetChild(tmpEntity); - (GHIDRA_CAST((tmpEntity)))->Entity::SetParent(GHIDRA_CAST(this)); - this->_renderDepthOffset = 10.0; - } - } - else if (iVar3 == 0x7b) { - iVar3 = this->_subtype; - if (iVar3 == 3) { - pvVar10 = (void *)FUN_00a11590(0,2,0); - pbVar2 = GHIDRA_CAST(0x0); -LAB_005cfc0c: - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar2); - copy_20_bytes(layer->_blendMode,pvVar10); - } - else { - if (iVar3 == 4) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Entity::AddFlagsLow(0x20); - (GHIDRA_CAST((local_344)))->BlendMode::SetMode(2,0); - pbVar2 = GHIDRA_CAST(0x0); - pvVar10 = extraout_EAX_05; - goto LAB_005cfc0c; - } - if (iVar3 == 7) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Entity::AddFlagsLow(0x100); - (GHIDRA_CAST((local_330)))->BlendMode::SetMode(2,0); - pbVar2 = GHIDRA_CAST(0x0); - pvVar10 = extraout_EAX_06; - goto LAB_005cfc0c; - } - if (iVar3 == 9) { - (GHIDRA_CAST((local_b4._buf + 4)))->BlendMode::SetMode(2,0); - pbVar2 = GHIDRA_CAST(0x1); - pvVar10 = extraout_EAX_07; - goto LAB_005cfc0c; - } - } - this->_renderZOffset = -1000; - } - else if (iVar3 == 0x6b) { - if (this->_subtype == 0) { - (this->_posOffset).y = -32.0; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Throw"),0); - } - else { - ANM2::Play(&this->_sprite,s_Idle,0); - } - } - else { - if (iVar3 == 0x6c) { - local_2c0.y = (float)operator_new(300); - local_8 = 0x13; - if (GHIDRA_CAST(local_2c0.y) == GHIDRA_CAST(0x0)) { - pvVar11 = (void *)0x0; - } - else { - pvVar11 = (void *)FUN_005cd850(); - } - pvVar10 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4b4))); - local_8 = 0xffffffff; - ExtraDataRef::Set(pvVar10,pvVar11); - this->_state = 0; - goto LAB_005d03dd; - } - if (iVar3 == 0x6d) { -LAB_005d00d8: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - } - else if (iVar3 == 0x6f) { - ANM2::Play(&this->_sprite,&DAT_00b1d534,0); - } - else if (iVar3 == 0x70) { - (GHIDRA_CAST((local_b4._buf + 4)))->BlendMode::SetMode(2,0); - pvVar10 = extraout_EAX_08; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,pvVar10); - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - this->_state = -1; - } - else { - if (iVar3 == 0x71) goto LAB_005d00d8; - if (iVar3 == 0x73) { - ANM2::Play(&this->_sprite,s_Idle,0); - this->_renderZOffset = 10000; - this->_state = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - } - else if (iVar3 == 0x74) { - ANM2::Play(&this->_sprite,s_Idle,0); - this->_sortingLayer = 0; - this->_state = 0; - this->_damageSource = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar3 = (GHIDRA_CAST((pRVar8)))->Room::GetBackdropType(); - if (iVar3 == 0x10) { - msvc::string::string_from_cstr - (sheetPath._buf,GHIDRA_CAST("gfx/Effects/dirtpatch_darkroom.png")); - local_8 = 0x14; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::LoadGraphics(); - } - } - else if (iVar3 == 0x75) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c7fb40) && - (_Init_thread_header(&DAT_00c7fb40), DAT_00c7fb40 == -1)) { - local_8 = 0x15; - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x3d4ccccd,0x3df5c28f,0x3e4ccccd); - local_8 = 0xffffffff; - _Init_thread_footer(&DAT_00c7fb40); - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&DAT_00c7fb44)); - ANM2::Play(&this->_sprite,GHIDRA_CAST("LostDeath"),0); - this->_state = 0; - } - else if (iVar3 == 0x77) { - this->_visible = 0; - *GHIDRA_CAST(&(this->_varData)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._l) + 4)) = 1; - *GHIDRA_CAST(&(this->_varData)._h) = 1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - } - else if (iVar3 == 0x78) { - this->_visible = 0; - *GHIDRA_CAST(&(this->_varData)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._l) + 4)) = 0; - this->_state = -1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - } - else if (iVar3 == 0x31) { - if (GHIDRA_UINT(this->_subtype) < 6) { - ANM2::Play(&this->_sprite,(&PTR_s_Heart_00b63af4)[this->_subtype],0); - } - } - else if (iVar3 == 0x79) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - this->_scale = 0.0; - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST("Default"),0); - } - else if (iVar3 == 0x7c) { - bVar1 = 0; - iVar3 = Isaac::Random(3); - ANM2::Play(&this->_sprite,(&PTR_s_Bubble1_00b63ae4)[iVar3],bVar1); - iVar3 = Isaac::Random(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(iVar3 == 0); - } - else if (iVar3 == 0x7d) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("SmallHoleOpen"),0); - this->_state = 0; - this->_renderDepthOffset = -5.0; - local_2b8 = ANM2::GetLayer(&this->_sprite,&DAT_00b1d57c); - if (local_2b8 != GHIDRA_CAST(0x0)) { - uVar4 = Random(); - vecResult = &this->_pos; - pEVar12 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x7a,vecResult,&g_vectorZero,GHIDRA_CAST(effect), - 0,uVar4); - (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::SetParent(GHIDRA_CAST(effect)); - iVar3 = _ptr_deref_or_minus1(); - set_state(pEVar12,iVar3); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetChild(GHIDRA_CAST(pEVar12)); - layer = local_2b8; - game = g_game; - local_2b8->_visible = 0; - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - this = effect; - (GHIDRA_CAST((pRVar8)))->Room::GetFloorColorAt(&local_2d8,vecResult,effect->_size); - (GHIDRA_CAST((&defaultColor)))->Color::Color(local_2d8._red * 2.0,local_2d8._green * 2.0, - local_2d8._blue * 2.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(other); - } - } - else if (iVar3 == 0x67) { - (GHIDRA_CAST((local_b4._buf + 4)))->BlendMode::SetMode(2,0); - pvVar10 = extraout_EAX_09; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,pvVar10); - bVar1 = 0; - iVar3 = Isaac::Random(5); - ANM2::Play(&this->_sprite,(&PTR_s_Bling1_00b63ad0)[iVar3],bVar1); - } - else if (iVar3 == 0xcb) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Summon"),0); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((pRVar8)))->Room::SetClear(0); - } - } - } - } - goto LAB_005d03cf; - } - ANM2::Play(&this->_sprite,s_Idle,0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar3 = AnimationState::GetAnimationLength(animState); - iVar3 = Isaac::Random(iVar3); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(iVar3); - fVar16 = random_float(); - fVar16 = normalize_angle_degrees(fVar16 * 360.0); - this->_rotation = fVar16; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16); - fVar16 = random_float(); - fVar16 = fVar16 * -30.0 - 5.0; - (this->_posOffset).y = fVar16; - this->_height = fVar16; - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero); - } - goto LAB_005d03c8; - } - uVar4 = Game::GetStageID(g_game,0); - switch(uVar4) { - case 10: - case 0xb: - case 0xc: - case 0x1c: - case 0x1e: - case 0x21: - case 0x22: - ANM2::Play(&this->_sprite,GHIDRA_CAST("White"),0); - (GHIDRA_CAST((&workColor)))->Color::Reset(); - (GHIDRA_CAST((&workColor)))->Color::SetTint(1.0,0.8,0.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&(this->_sprite)._color))))->Color::operator_assign(GHIDRA_CAST(&workColor)); - (GHIDRA_CAST((&workColor)))->Color::Reset(); - (GHIDRA_CAST((&workColor)))->Color::SetTint(1.0,1.0,0.5,1.0); - tmpColor = GHIDRA_CAST(&workColor); - goto code_r0x005ceddb; - default: - ANM2::Play(&this->_sprite,&DAT_00b634c0,0); - break; - case 0x10: - case 0x1f: - ANM2::Play(&this->_sprite,&DAT_00b633c4,0); - (GHIDRA_CAST((&splatTint)))->Color::Reset(); - (GHIDRA_CAST((&splatTint)))->Color::SetTint(1.0,0.5,0.5,1.0); - if (&this->_splatColor != GHIDRA_CAST(&splatTint)) { - (this->_splatColor)._tint[0] = splatTint._tint[0]; - (this->_splatColor)._tint[1] = splatTint._tint[1]; - (this->_splatColor)._tint[2] = splatTint._tint[2]; - (this->_splatColor)._tint[3] = splatTint._tint[3]; - (this->_splatColor)._colorize[0] = splatTint._colorize[0]; - (this->_splatColor)._colorize[1] = splatTint._colorize[1]; - (this->_splatColor)._colorize[2] = splatTint._colorize[2]; - (this->_splatColor)._colorize[3] = splatTint._colorize[3]; - *GHIDRA_CAST((this->_splatColor)._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(splatTint._offset)) + 0x0))); - (this->_splatColor)._offset[2] = splatTint._offset[2]; - } - goto code_r0x005cede7; - case 0x20: - ANM2::Play(&this->_sprite,GHIDRA_CAST("White"),0); - (GHIDRA_CAST((&workColor)))->Color::Color(1.0,0.02,0.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color); - } - (GHIDRA_CAST((&workColor)))->Color::Color(); - tmpColor = extraout_EAX; -code_r0x005ceddb: - (GHIDRA_CAST((GHIDRA_CAST(&this->_splatColor))))->Color::operator_assign(tmpColor); -code_r0x005cede7: - fVar16 = random_float(); - (this->_posOffset).y = fVar16 * -50.0; - fVar16 = random_float(); - local_2b8 = GHIDRA_CAST((fVar16 * 0.5 + 0.5)); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_2c0,GHIDRA_CAST(&local_2b8)); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - (GHIDRA_CAST((local_36c)))->BlendMode::SetMode(2,0); - pvVar10 = extraout_EAX_00; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,pvVar10); - goto LAB_005d03cf; - } - uVar4 = Random(); - (this->_sprite)._flipX = ~(uint8_t)uVar4 & 1; - switch(*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1d18))) { - case 4: - case 5: - msvc::string::string_from_cstr - (cavesSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakCaves.png")); - local_8 = 2; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&cavesSheet); - local_8 = 0xffffffff; - (GHIDRA_CAST((cavesSheet._buf)))->msvc::string::_Tidy_deallocate(); - break; - case 7: - case 8: - case 9: - msvc::string::string_from_cstr - (depthsSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakDepths.png")); - local_8 = 3; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&depthsSheet); - local_8 = 0xffffffff; - (GHIDRA_CAST((depthsSheet._buf)))->msvc::string::_Tidy_deallocate(); - break; - case 10: - case 0xb: - case 0xc: - msvc::string::string_from_cstr - (wombSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakWomb.png")); - local_8 = 4; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&wombSheet); - psVar7 = &wombSheet; - goto LAB_005ceaae; - case 0xd: - msvc::string::string_from_cstr - (blueWombSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakBlueWomb.png")); - local_8 = 5; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&blueWombSheet); - psVar7 = &blueWombSheet; - goto LAB_005ceaae; - case 0x20: - if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) >> 5 & 1) == 0) { - msvc::string::string_from_cstr - (minesSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakMines.png")); - local_8 = 7; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&minesSheet); - local_8 = 0xffffffff; - (GHIDRA_CAST((minesSheet._buf)))->msvc::string::_Tidy_deallocate(); - } - else { - msvc::string::string_from_cstr - (minesLavaSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakMinesLava.png")); - local_8 = 6; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&minesLavaSheet); - local_8 = 0xffffffff; - (GHIDRA_CAST((minesLavaSheet._buf)))->msvc::string::_Tidy_deallocate(); - } - break; - case 0x21: - case 0x28: - case 0x29: - case 0x2a: - msvc::string::string_from_cstr - (mausoleumSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakMausoleum.png")); - local_8 = 9; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&mausoleumSheet); - local_8 = 0xffffffff; - (GHIDRA_CAST((mausoleumSheet._buf)))->msvc::string::_Tidy_deallocate(); - break; - case 0x22: - msvc::string::string_from_cstr - (corpseSheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakCorpse.png")); - local_8 = 10; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&corpseSheet); - psVar7 = &corpseSheet; - goto LAB_005ceaae; - case 0x2b: - msvc::string::string_from_cstr - (corpse2Sheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakCorpse2.png")); - local_8 = 0xb; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&corpse2Sheet); - psVar7 = &corpse2Sheet; - goto LAB_005ceaae; - case 0x2c: - msvc::string::string_from_cstr - (sheetPath3._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakWomb.png")); - local_8 = 0xc; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath3); - psVar7 = &sheetPath3; -LAB_005ceaae: - local_8 = 0xffffffff; - (GHIDRA_CAST((psVar7->_buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - ANM2::Play(&this->_sprite,(&PTR_s_WombBreak1_00b63b88)[GHIDRA_UINT((this->_dropRNG)._seed) % 3],0); - break; - case 0x2e: - msvc::string::string_from_cstr - (minesLava2Sheet._buf,GHIDRA_CAST("gfx/Effects/Effect_062_GroundBreakMinesLava.png")); - local_8 = 8; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&minesLava2Sheet); - local_8 = 0xffffffff; - (GHIDRA_CAST((minesLava2Sheet._buf)))->msvc::string::_Tidy_deallocate(); - } -LAB_005d03cf: -LAB_005d03d7: - pvVar10 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4b4))); -LAB_005d03dd: - game = g_game; - switch(this->_variant) { - case 0x15: - case 0x21: - case 0x40: - case 0x44: - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar3 = (GHIDRA_CAST((pRVar8)))->Room::GetBackdropType(); - if (iVar3 == 0x2d) { - (GHIDRA_CAST((&defaultColor)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color_00); - } - break; - case 0x20: - if (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0)) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::is_player(); - pEVar12 = effect; - if (bVar1 != 0) { - this->_scale = 1.3; - } - goto LAB_005d1317; - } - break; - case 0x80: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - ANM2::Play(&this->_sprite,s_Idle,0); - break; - case 0x82: - game = GHIDRA_CAST(Config)::GetCollectibles(); - uVar4 = Game::GetStageID(game,0); - if (uVar4 == 0x1c) { - msvc::string::string_from_cstr - (sheetPath._buf,GHIDRA_CAST("gfx/monsters/repentance/810.000_small_leech_dross.png")); - local_8 = 0x16; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::LoadGraphics(); - } - break; - case 0x84: - if ((this->_subtype == 1) || (this->_subtype == 2)) goto LAB_005d049c; - case 0x86: - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - break; - case 0x85: - this->_renderZOffset = -100; - sprite = &this->_sprite; - Level::GetCurrentRoom(GHIDRA_CAST(game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite)::Color(); - colorTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite)::Color(); - fVar16 = (GHIDRA_CAST((colorTarget)))->Color::A(); - pRVar8 = GHIDRA_CAST((fVar16 * 0.8)); - local_2c0.y = (float)pRVar8; -LAB_005d130c: - Font::SetLineHeightModifier(spriteColor,(float)pRVar8); - break; - case 0x87: - bVar1 = 0; - sprite = &this->_sprite; - iVar3 = Isaac::Random(4); - ANM2::Play(sprite,(&PTR_s_Drop01_00b63b24)[iVar3],bVar1); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar3 = (GHIDRA_CAST((pRVar8)))->Room::GetFrameCount(); - if (iVar3 == 0) { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar3 = AnimationState::GetAnimationLength(animState); - iVar3 = Isaac::Random(iVar3); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetFrame_1(iVar3); - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - break; - case 0x88: - case 0x96: - case 0xb1: - case 0xb7: - case 0xbb: - case 0xc0: - goto LAB_005d11c7; - case 0x89: - local_2b4 = GHIDRA_CAST(&this->_sprite); - ANM2::Play(GHIDRA_CAST(local_2b4),s_Open,0); - if (this->_subtype == 0) { - this->_sortingLayer = 1; -LAB_005d05aa: - tmpEntity = local_2b4; - } - else { - if (this->_subtype != 1) goto LAB_005d05aa; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - tmpEntity = local_2b4; - (GHIDRA_CAST((GHIDRA_CAST(local_2b4))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - } - game = GHIDRA_CAST(Config)::GetCollectibles(); - uVar4 = Game::GetStageID(game,0); - if (uVar4 == 0x1c) { - uVar4 = 0; - iVar3 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Sprite::GetLayerCount(); - if (iVar3 != 0) { - do { - msvc::string::string_from_cstr - (sheetPath._buf,GHIDRA_CAST("gfx/bosses/repentance/wormwood_wallbreak_dross.png")); - local_8 = 0x17; - (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Sprite::ReplaceSpritesheet(uVar4,&sheetPath); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::_Tidy_deallocate(); - uVar4 = uVar4 + 1; - uVar13 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Sprite::GetLayerCount(); - } while (uVar4 < uVar13); - } - (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Sprite::LoadGraphics(); - } - break; - case 0x8a: - this->_renderZOffset = -0x80000000; - goto LAB_005d0669; - case 0x8c: - case 0x9a: - case 0x9c: - goto LAB_005d0f6b; - case 0x8d: - sprite = &this->_sprite; - local_2e4 = GHIDRA_CAST(sprite); - if (this->_subtype == 1) { - tmpColor = GHIDRA_CAST((GHIDRA_CAST((0x3f800000)))->Color)::Color(0,0,0,0,0x3e4ccccd,0x3e4ccccd,0); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(tmpColor); - } - else { - tmpColor = GHIDRA_CAST((GHIDRA_CAST((0x3f800000)))->Color)::Color(0,0,0,0,0,0x3e4ccccd,0); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(tmpColor); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar1 = (GHIDRA_CAST((pRVar8)))->Room::IsBeastDungeon(); - if (bVar1 != 0) { - tmpColor = GHIDRA_CAST((GHIDRA_CAST((0x3f800000)))->Color)::Color(0,0,0,0,0,0x3e99999a,0); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(tmpColor); - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - Font::SetLineHeightModifier(GHIDRA_CAST(&layer->_color),0.5); - } - } - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite)::Color(); - Font::SetLineHeightModifier(spriteColor,0.0); - rng = &this->_dropRNG; - fVar16 = (GHIDRA_CAST((rng)))->RNG::RandomFloat(); - local_2c0.y = fVar16 * 0.4 + 1.0; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&scratchVec,&local_2c0.y); - subSprite = local_2e4; - (GHIDRA_CAST((GHIDRA_CAST(local_2e4))))->Sprite::SetScale(vecResult); - vecResult = (GHIDRA_CAST((GHIDRA_CAST((auStack_2f0 + 8)))))->Vector::Vector(0.0,-20.0); - (GHIDRA_CAST((GHIDRA_CAST(subSprite))))->Sprite::set_offset(vecResult); - uVar4 = (GHIDRA_CAST((rng)))->RNG::RandomInt(2); - (GHIDRA_CAST((GHIDRA_CAST(subSprite))))->Sprite::set_flip_x(uVar4 != 0); - ANM2::Play(GHIDRA_CAST(subSprite),s_Idle,0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar4 = AnimationState::GetAnimationLength(animState); - uVar4 = (GHIDRA_CAST((rng)))->RNG::RandomInt(uVar4); - (GHIDRA_CAST((GHIDRA_CAST(subSprite))))->Sprite::SetFrame_1(uVar4); - break; - case 0x8e: - if (this->_subtype == 1) { - this->_sortingLayer = 0; - (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(4); - sprintf_s(local_28 + 4,0x10,GHIDRA_CAST("Idle%d")); - ANM2::Play(&this->_sprite,local_28 + 4,0); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - colorTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((colorTarget)))->Color::SetOffset(0.3,0.3,0.3); - } - else { - this->_renderDepthOffset = -14.0; - Level::GetCurrentRoom(GHIDRA_CAST(game)); - FUN_00440ec0(); - iVar3 = FUN_005cd620(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST((iVar3 + 0x74))); - } - break; - case 0x8f: - case 0x94: - this->_visible = 0; - this->_timeout = 0x78; - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero); - break; - case 0x90: - sprite = &this->_sprite; - bVar1 = 0; - if (this->_subtype == 0) { - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(4); - ANM2::Play(sprite,(&PTR_DAT_00b63b14)[uVar4],bVar1); - game = g_game; - this->_entityGridCollisionClass = 3; - vecResult = &this->_pos; - player = Game::GetNearestPlayer(game,vecResult); - if (player != GHIDRA_CAST(0x0)) { - playerPos = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::Position(&scratchVec); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::set_flip_x(vecResult->x <= playerPos->x && playerPos->x != vecResult->x); - } - } - else { - ANM2::Play(sprite,GHIDRA_CAST("Explosion"),0); - this->_renderDepthOffset = 100.0; - if (this->_subtype == 2) { - tmpColor = (ColorMod *) - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x3f800000,0x3f800000,0x3f800000,0x3f800000,0,0,0); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(tmpColor); - } - else if (this->_subtype == 3) { - tmpColor = (ColorMod *) - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x3f400000,0x3f19999a,0x3f800000,0x3f800000,0,0,0); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(tmpColor); - } - } - break; - case 0x91: - this->_isInitFlag176 = 1; - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(uVar4 != 0); - break; - case 0x92: - this->_isInitFlag176 = 1; - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(uVar4 != 0); - this->_lifespan = 0x1e; - this->_timeout = 0x1e; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - if (this->_subtype == 0) { - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((pRVar8)))->Room::GetFloorColorAt(&local_2d8,&this->_pos,this->_size); - (GHIDRA_CAST((&defaultColor)))->Color::Color(local_2d8._red * 2.0,local_2d8._green * 2.0,local_2d8._blue * 2.0, - 1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color_02); - } - break; - case 0x97: - fVar16 = random_float(); - iVar3 = this->_subtype; - this->_rotation = fVar16 * 30.0 + 5.0; - if (iVar3 == 0xb) { - fVar16 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16 * 360.0); - this->_maxRadius = 100.0; - this->_scale = 1.0; - } - else if (iVar3 == 10) { - this->_maxRadius = 100.0; - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/effects/shockwave.png")); - local_8 = 0x18; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::_Tidy_deallocate(); - this->_scale = 1.0; - } - else { - if (iVar3 == 0) { - fVar16 = random_float(); - this->_maxRadius = fVar16 * 0.4 + 1.2; - } - else { - fVar16 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16 * 360.0); - this->_maxRadius = 20.0; - if (this->_spawnerType == 0x3b7) { - fVar16 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16 * 80.0 + 140.0); - this->_scale = 1.0; - break; - } - } - this->_scale = 1.0; - } - break; - case 0x98: - this->_visible = 0; - goto LAB_005d0f6b; - case 0x9b: - this->_sortingLayer = 0; - this->_renderZOffset = 2000; - this->_isInitFlag176 = 1; - this->_scale = 0.033; - break; - case 0x9d: - goto LAB_005d11e7; - case 0x9e: - ANM2::Play(&this->_sprite,s_Idle,0); - fVar16 = random_float(); - fVar16 = normalize_angle_degrees(fVar16 * 360.0); - this->_rotation = fVar16; - local_2c0.y = fVar16 + 180.0; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_rotation = local_2c0.y; - this->_height = 0.0; - this->_isInitFlag176 = 1; - break; - case 0x9f: - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&this->_pos); - fVar16 = random_float(); - fVar16 = normalize_angle_degrees(fVar16 * 360.0); - this->_rotation = fVar16; - ANM2::Play(&this->_sprite,s_Idle,0); - fVar16 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomFloat(); - local_2c0.y = fVar16 * 0.2 + 1.0; - vecResult = Vector::operator_mul(&scratchVec,&local_2c0.y,&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(uVar4 != 0); - local_2c0.y = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomFloat(); - set_PlaybackSpeed(&this->_sprite,local_2c0.y * 0.3 + 1.0); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar17 = (GHIDRA_CAST((pRVar8)))->Room::GetBackdropType(); - switch(uVar17) { - case 0x21: - case 0x26: - case 0x28: - case 0x29: - case 0x2a: - (GHIDRA_CAST((&defaultColor)))->Color::Color(0.96,0.9,1.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color_01); - } - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - fVar16 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomFloat(); - local_2c0.y = fVar16 * 0.3 + 0.3; - Font::SetLineHeightModifier(spriteColor,local_2c0.y); - this->_isInitFlag176 = 1; - break; - case 0xa1: - iVar3 = this->_subtype; - if (iVar3 == 0) { - uVar19 = 0x3f000000; - uVar18 = 0x3fe66666; - uVar17 = 0x40133333; -LAB_005d10c7: - tmpColor = GHIDRA_CAST((GHIDRA_CAST((0x3f800000)))->Color)::Color(uVar17,uVar18,uVar19,0x3f800000,0,0,0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(tmpColor); - } - else { - if (iVar3 == 1) { - uVar19 = 0x3ecccccd; - uVar18 = 0x3ecccccd; - uVar17 = 0x40000000; - goto LAB_005d10c7; - } - if (iVar3 == 2) { - uVar19 = 0x40000000; - uVar18 = 0x3f99999a; - uVar17 = 0x3f800000; - goto LAB_005d10c7; - } - if (iVar3 == 3) { - uVar19 = 0; - uVar18 = 0x3fe66666; - uVar17 = 0; - goto LAB_005d10c7; - } - } - this->_sortingLayer = 0; - this->_state = 0; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Opened"),0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar4 = AnimationState::GetAnimationLength(animState); - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(uVar4); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(uVar4); - break; - case 0xa2: - goto LAB_005d1bff; - case 0xa4: - this->_renderDepthOffset = 80.0; - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - Font::SetLineHeightModifier(spriteColor,0.6); - goto LAB_005d0669; - case 0xa5: - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,blendMode); - pEVar12 = effect; - if (this->_subtype == 1) { - this->_sortingLayer = 0; - } - else { - this->_renderDepthOffset = 4.0; - } - goto LAB_005d1317; - case 0xa6: - this->_renderZOffset = -0x80000000; - local_2c0.y = (float)operator_new(0x18); - local_8 = 0x19; - if (GHIDRA_CAST(local_2c0.y) == GHIDRA_CAST(0x0)) { - pvVar11 = (void *)0x0; - } - else { - pvVar11 = (void *)FUN_005d2270(); - } - local_8 = 0xffffffff; - ExtraDataRef::Set(pvVar10,pvVar11); - this->_minRadius = 0.1; - goto LAB_005d0669; - case 0xa7: - SetTimeout(this,1); - this->_maxRadius = 130.0; - this->_minRadius = 130.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x430)))) = 0x40600000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x434)))) = 0x3f800000; - FUN_00435bc0(0,0); - *GHIDRA_CAST(&(this->_varData)._l) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))); - *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._l) + 4)) = (float)local_20; - *GHIDRA_CAST(&(this->_varData)._h) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))); - *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._h) + 4)) = local_18; - goto LAB_005d11c7; - case 0xa8: - this->_sortingLayer = 0; - this->_renderZOffset = 2000; - goto LAB_005d11e7; - case 0xaa: - this->_sortingLayer = 0; - sprite = &this->_sprite; - ANM2::PlayOverlay(sprite,GHIDRA_CAST("Float"),0); - rng = &effect->_dropRNG; - animState = GHIDRA_CAST(FUN_0041e470()); - uVar4 = AnimationState::GetAnimationLength(animState); - uVar4 = (GHIDRA_CAST((rng)))->RNG::RandomInt(uVar4); - ANM2::SetOverlayFrame(sprite,uVar4); - ANM2::SetFrame(sprite,GHIDRA_CAST(s_Idle),0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar4 = AnimationState::GetAnimationLength(animState); - uVar4 = (GHIDRA_CAST((rng)))->RNG::RandomInt(uVar4); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetFrame_1(uVar4); - uVar4 = (GHIDRA_CAST((rng)))->RNG::RandomInt(2); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::set_flip_x(uVar4 != 0); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::AddEntityFlags(0x200000); - break; - case 0xab: - if (this->_subtype == 2) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Swirl"),0); - local_2c0.y = 3.0; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&scratchVec,&local_2c0.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - fVar16 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16 * 360.0); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - pRVar8 = GHIDRA_CAST(0x0); -LAB_005d130a: - goto LAB_005d130c; - } - if (this->_subtype == 1) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Trail"),0); - fVar16 = random_float(); - local_2c0.y = fVar16 * 0.5 + 0.5; - fVar16 = random_float(); - vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::Vector(fVar16 + 1.0,local_2c0.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - fVar16 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16 * 360.0); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Entity::AddFlagsLow(0x20); - ANM2::Play(&this->_sprite,GHIDRA_CAST("IdleClosed"),0); - this->_timeout = 0x2d; - } - break; - case 0xac: - if (this->_subtype == 2) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Swirl"),0); - local_2c0.y = 0.7; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&scratchVec,&local_2c0.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - fVar16 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar16 * 360.0); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - pRVar8 = GHIDRA_CAST(0x3f800000); - goto LAB_005d130a; - } - if (this->_subtype != 1) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Entity::AddFlagsLow(0x20); - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x2)); - copy_20_bytes(layer->_blendMode,blendMode); - ANM2::Play(&this->_sprite,s_Open,0); - this->_minRadius = 0.0; - break; - } - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST(&DAT_00b635b8),0); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_visible = 0; - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,blendMode); - (GHIDRA_CAST((local_28)))->BlendMode::SetMode(2,0); - blendMode = GHIDRA_CAST(local_28); - pbVar2 = GHIDRA_CAST(0x1); - goto LAB_005d0681; - case 0xad: - case 0xc9: - this->_renderDepthOffset = 10.0; - break; - case 0xae: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - ANM2::Play(&this->_sprite,s_Idle,0); - game = g_game; - this->_renderDepthOffset = -100.0; - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - iVar3 = (GHIDRA_CAST((pRVar8)))->Room::GetFrameCount(); - if (1 < iVar3) { - isReplaced = '\0'; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(auStack_2f0),1000,0xae,-1,0,0); - local_8 = 0x1a; - tmpEntity = GHIDRA_CAST(0x0); - local_2b4 = GHIDRA_CAST(0x0); - iVar3 = (GHIDRA_CAST((GHIDRA_CAST(auStack_2f0))))->EntityList::Size(); - if (iVar3 == 0) { -LAB_005d1763: - (GHIDRA_CAST((GHIDRA_CAST((local_28 + 4)))))->RNG::game_constructor(this->_initSeed,0x12); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),0x1b); - uVar4 = (GHIDRA_CAST((seedRng)))->RNG::Next(); - tmpEntity = Game::Spawn(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - tmpEntity->Update(); - guard_check_icall(); - } - else { - do { - piVar15 = GHIDRA_CAST(std)::vector::operator_index(tmpEntity); - if (*GHIDRA_CAST((*piVar15 + 0x450)) != 0) { - local_2c0.y = (float)Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - listEntry = GHIDRA_CAST(std)::vector::operator_index(tmpEntity); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(*listEntry))))->Entity::Position(&scratchVec); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar3 = (GHIDRA_CAST((pRVar8)))->Room::GetGridIndex(&effect->_pos); - iVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_2c0.y))))->Room::GetGridIndex(vecResult); - tmpEntity = local_2b4; - if (iVar5 == iVar3) { - listEntry = GHIDRA_CAST(std)::vector::operator_index(local_2b4); - (**(code **)(*GHIDRA_CAST(*listEntry) + 0x28))(); - isReplaced = '\x01'; - } - } - tmpEntity = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((tmpEntity)) + 0x1)))); - local_2b4 = tmpEntity; - puVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(auStack_2f0))))->EntityList)::Size(); - } while (tmpEntity < puVar14); - if (isReplaced == '\0') { - this = effect; - goto LAB_005d1763; - } - } - local_8 = 0xffffffff; - (GHIDRA_CAST((auStack_2f0)))->EntityList_Query::~EntityList_Query(); - } - break; - case 0xb2: - this->_timeout = -1; - this->_scale = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x2000200000); - break; - case 0xb3: - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,blendMode); - pEVar12 = effect; - fVar16 = (GHIDRA_CAST((&effect->_dropRNG)))->RNG::RandomFloat(); - local_2c0.y = fVar16 * 0.3 + 0.9; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&scratchVec,&local_2c0.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - fVar16 = (GHIDRA_CAST((&pEVar12->_dropRNG)))->RNG::RandomFloat(); - pEVar12->_scale = fVar16 * 0.08 + 0.06; - goto LAB_005d1317; - case 0xb4: - this->_renderDepthOffset = -100.0; - break; - case 0xb5: - this->_renderZOffset = 1000; -LAB_005d0669: - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - pbVar2 = GHIDRA_CAST(0x0); -LAB_005d0681: - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar2); - copy_20_bytes(layer->_blendMode,blendMode); - break; - case 0xb9: - (GHIDRA_CAST((local_b4._buf + 4)))->BlendMode::SetMode(2,0); - pvVar10 = extraout_EAX_10; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - copy_20_bytes(layer->_blendMode,pvVar10); - this->_renderDepthOffset = -10.0; - ANM2::Play(&this->_sprite,s_Idle,0); - break; - case 0xba: - if (this->_subtype == 1) { - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/Effects/spookier_ghost_white.png")); - local_8 = 0x1c; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&sheetPath); - local_8 = 0xffffffff; - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::_Tidy_deallocate(); - } - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - break; - case 0xbc: - this->_visible = 0; - this->_state = 0; - break; - case 0xbd: - if (this->_subtype != 0) goto LAB_005d11e7; - (GHIDRA_CAST((GHIDRA_CAST((local_28 + 4)))))->RNG::game_constructor(this->_initSeed,8); - local_8 = 0x1d; - uVar4 = (GHIDRA_CAST((GHIDRA_CAST((local_28 + 4)))))->RNG::RandomInt(4); - uVar13 = (GHIDRA_CAST((GHIDRA_CAST((local_28 + 4)))))->RNG::RandomInt(2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(uVar13 != 0); - sprite = &this->_sprite; - local_2b8 = GHIDRA_CAST(((float)GHIDRA_INT(uVar4) * 64.0)); - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - (layer->_cropOffset).y = (float)local_2b8; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - (layer->_cropOffset).y = (float)local_2b8; - pvVar10 = (void *)FUN_00a11590(0,2,0); - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - copy_20_bytes(layer->_blendMode,pvVar10); - ANM2::Play(sprite,GHIDRA_CAST("Appear"),0); - local_8 = 0xffffffff; - effect->_sortingLayer = 0; - guard_check_icall(); - break; - case 0xbe: - case 0xc6: - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,blendMode); - (GHIDRA_CAST((local_28)))->BlendMode::SetMode(2,0); - puVar14 = local_28; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - copy_20_bytes(layer->_blendMode,puVar14); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_visible = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_visible = 0; - vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::Vector(0.0,-20.0); - (GHIDRA_CAST((&this->_posOffset)))->Vector::operator_assign(vecResult); - break; - case 0xbf: - local_2c0.y = (float)operator_new(0x458); - local_8 = 0x1e; - if (GHIDRA_CAST(local_2c0.y) == GHIDRA_CAST(0x0)) { - pvVar11 = (void *)0x0; - } - else { - pvVar11 = (void *)FUN_005d2300(); - } - local_8 = 0xffffffff; - ExtraDataRef::Set(pvVar10,pvVar11); - pRVar8 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar1 = (GHIDRA_CAST((pRVar8)))->Room::is_type_16(); - pEVar12 = effect; - if (bVar1 == 0) { - this->_renderDepthOffset = 10.0; - } - else { - this->_renderZOffset = 10000; - } - goto LAB_005d1317; - case 0xc1: - this->_state = 0; - ANM2::Play(&this->_sprite,s_Idle,0); - if (this->_subtype == 0) { - this->_visible = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_visible = 0; - } - else { - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_visible = 0; - } - break; - case 0xc2: - this->_state = 0; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Shadow"),0); - goto LAB_005d1bff; - case 0xc5: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Flying"),0); - break; - case 199: - ANM2::Play(&this->_sprite,&DAT_00b602e8,0); - break; - case 200: -LAB_005d049c: - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Entity::AddFlagsLow(0x20); - } -LAB_005d1311: - pEVar12 = effect; -LAB_005d1317: - sprite = &pEVar12->_sprite; - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::LoadGraphics(); - iVar3 = effect->_variant; - if ((iVar3 == 0xbe) || (iVar3 == 0xc6)) { - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_minFilterMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_magFilterMode = 1; - iVar3 = effect->_variant; - } - if (iVar3 == 0x3b) { - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_minFilterMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_magFilterMode = 1; - iVar3 = effect->_variant; - } - if ((iVar3 == 0x1e) || (iVar3 == 0x99)) { - *GHIDRA_CAST((GHIDRA_INT(&(effect->_varData)._l) + 4)) = 0; - *GHIDRA_CAST(&(effect->_varData)._h) = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_wrapSMode = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_wrapTMode = 1; - if (effect->_variant == 0x99) { - colorTarget = &defaultColor; - } - else { - colorTarget = &scratchColor; - } - (GHIDRA_CAST((colorTarget)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::SetColor(color_03); - iVar3 = effect->_variant; - } - if (iVar3 == 0xa0) { - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_wrapSMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_wrapTMode = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_visible = 0; - effect->_renderDepthOffset = 4.0; - pEVar12 = effect; - } - else if (iVar3 == 0xaf) { - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::AddEntityFlags(0x200000); - ANM2::Play(sprite,s_Idle,0); - (GHIDRA_CAST((&local_2d8)))->BlendMode::SetMode(2,0); - blendMode = &local_2d8; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,blendMode); - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_visible = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_wrapSMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_wrapTMode = 0; - (GHIDRA_CAST((local_28)))->BlendMode::SetMode(2,0); - puVar14 = local_28; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - copy_20_bytes(layer->_blendMode,puVar14); - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_visible = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_wrapSMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_wrapTMode = 0; - (GHIDRA_CAST((local_2f4)))->BlendMode::SetMode(2,0); - puVar14 = local_2f4; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x2)); - copy_20_bytes(layer->_blendMode,puVar14); - pEVar12 = effect; - setColorFn = *(code **)(*GHIDRA_CAST(effect) + 0x3c); - (GHIDRA_CAST((&workColor)))->Color::Color(0.5,0.0,1.0,1.0); - (*setColorFn)(extraout_EAX_11,0xffffffff,0xff,0,1); - } - else { - if (iVar3 == 0xc1) { - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_wrapSMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x1)); - layer->_wrapTMode = 0; - } - else if (iVar3 == 0xc4) { - effect->_sortingLayer = 0; - (GHIDRA_CAST((local_31c)))->BlendMode::SetMode(2,0); - puVar14 = local_31c; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,puVar14); - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_minFilterMode = 1; - layer = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_magFilterMode = 1; - } - pEVar12 = effect; - } - Game::GetField26614(g_game); - isDeathmatch = DeathmatchManager::is_active(); - if (isDeathmatch != '\0') { - entityList = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar15 = GHIDRA_CAST((GHIDRA_CAST((entityList)))->EntityList)::Size(); - (**(code **)(*piVar15 + 0x44))(pEVar12); - } - FUN_00861330(pEVar12); - ExceptionList = local_10; - return; -LAB_005d1bff: - this->_sortingLayer = 0; - goto LAB_005d1311; -LAB_005d11e7: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - goto LAB_005d1311; -LAB_005d0f6b: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x200000); - goto LAB_005d1311; -LAB_005d11c7: - this->_visible = 0; - goto LAB_005d1311; -} - -// 005d2420 -void Entity_Effect::Remove() -{ - uint32_t *ptr; - uint32_t i; - Entity *entity; - uint32_t entityCount; - bool isLoopSoundShared; - bool isSecondLoopSoundShared; - - isLoopSoundShared = false; - isSecondLoopSoundShared = false; - i = 0; - entityCount = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1264)); - if (entityCount != 0) { - isSecondLoopSoundShared = false; - do { - entity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x125c)) + i * 4)); - if ((entity->_type == 1000) && (GHIDRA_CAST(entity) != this)) { - if (entity->_variant == 0x3c) { - isLoopSoundShared = true; - } - else if (entity->_variant == 0xa1) { - isSecondLoopSoundShared = true; - } - } - i = i + 1; - } while (i < entityCount); - if (isLoopSoundShared) goto LAB_005d24ab; - } - SFXManager::Stop(&g_manager->_sfxManager,0x345); -LAB_005d24ab: - if (!isSecondLoopSoundShared) { - SFXManager::Stop(&g_manager->_sfxManager,0x34e); - } - this->_exists = 0; - if (this->_dead == 0) { - this->_dead = 1; - } - Entity::ReleaseLuaRef(GHIDRA_CAST(this)); - ptr = this->_luaBridgeRef; - if (ptr != GHIDRA_CAST(0x0)) { - luaL_unref(*ptr,0xfff0b9d8,ptr[1]); - operator_delete(ptr,8); - this->_luaBridgeRef = (void *)0x0; - } - return; -} - -// 005d2520 -void Entity_Effect::Interpolate() -{ - Entity *this_00; - uint8_t isEnemy; - LayerState *layer; - float fVar1; - float fVar2; - Vector scratchVec; - int linkedEntity; - - if (this->_pauseTimer == 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Interpolate(); - if ((this->_isFollowing != 0) && (linkedEntity = this->_parent, linkedEntity != 0)) { - fVar1 = *GHIDRA_CAST((linkedEntity + 0x340)); - fVar2 = (this->_parentOffset).y; - (this->_pos).x = *GHIDRA_CAST((linkedEntity + 0x33c)) + (this->_parentOffset).x; - (this->_pos).y = fVar1 + fVar2; - (this->_posOffset).x = *GHIDRA_CAST((linkedEntity + 0x34c)); - (this->_posOffset).y = *GHIDRA_CAST((linkedEntity + 0x350)); - } - switch(this->_variant) { - case 4: - case 5: - case 0x1b: - case 0x23: - case 0x3a: - case 0x55: - case 0x56: - case 0x5f: - case 0x62: - case 0xa3: - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 0x10) { -LAB_005d2702: - (this->_posOffset).y = - this->_fallingSpeed * this->_speedMultiplier * 0.5 + (this->_posOffset).y; - return; - } - break; - case 0x1e: - case 0x99: - if (this->_subtype == 0) { - Room::GetClampedPositionImpl(g_game->_room,&scratchVec,&this->_pos,0.0,0.0,0.0,0.0); - (this->_pos).x = scratchVec.x; - (this->_pos).y = scratchVec.y; - } - this_00 = GHIDRA_CAST(this->_spawnerEntity); - if ((this_00 != GHIDRA_CAST(0x0)) && - (((this_00->_type == 1 || (isEnemy = (GHIDRA_CAST((this_00)))->Entity::IsEnemy(), isEnemy != 0)) && - (this->_lifespan == 0)))) { - scratchVec.x = (this_00->_pos).x - (this->_pos).x; - fVar1 = (this_00->_pos).y - (this->_pos).y; - fVar2 = atan2f(fVar1,scratchVec.x); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layer->_rotation = fVar2 * 57.295776; - fVar1 = sqrtf(fVar1 * fVar1 + scratchVec.x * scratchVec.x); - this->_scale = fVar1; - return; - } - break; - case 0x1f: - (this->_posOffset).y = (float)-this->_timeout * 100.0 - 50.0; - return; - case 0x51: - (this->_posOffset).y = this->_fallingSpeed * 0.5 * this->_speedMultiplier + this->_height; - return; - case 0x76: - if (0 < this->_state) goto LAB_005d2702; - break; - case 0x7b: - linkedEntity = this->_parent; - if ((linkedEntity != 0) && ((this->_subtype == 4 || (this->_subtype == 7)))) { - fVar1 = *GHIDRA_CAST((linkedEntity + 0x340)); - (this->_pos).x = *GHIDRA_CAST((linkedEntity + 0x33c)); - (this->_pos).y = fVar1; - fVar1 = *GHIDRA_CAST((linkedEntity + 0x364)); - (this->_velocity).x = *GHIDRA_CAST((linkedEntity + 0x360)); - (this->_velocity).y = fVar1; - (this->_posOffset).x = *GHIDRA_CAST((linkedEntity + 0x34c)); - (this->_posOffset).y = *GHIDRA_CAST((linkedEntity + 0x350)); - return; - } - break; - case 0xaf: - linkedEntity = this->_target; - if (linkedEntity != 0) { - fVar1 = *GHIDRA_CAST((linkedEntity + 0x340)); - (this->_pos).x = *GHIDRA_CAST((linkedEntity + 0x33c)); - (this->_pos).y = fVar1; - } - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - return; - case 0xb2: - update_variant178_shooter(this,1); - return; - case 0xb9: - linkedEntity = this->_parent; - if (linkedEntity != 0) { - fVar1 = *GHIDRA_CAST((linkedEntity + 0x340)); - (this->_pos).x = *GHIDRA_CAST((linkedEntity + 0x33c)); - (this->_pos).y = fVar1; - fVar1 = *GHIDRA_CAST((linkedEntity + 0x364)); - (this->_velocity).x = *GHIDRA_CAST((linkedEntity + 0x360)); - (this->_velocity).y = fVar1; - (this->_posOffset).x = *GHIDRA_CAST((linkedEntity + 0x34c)); - (this->_posOffset).y = *GHIDRA_CAST((linkedEntity + 0x350)); - (this->_sprite)._scale.x = *GHIDRA_CAST((linkedEntity + 0xe4)); - (this->_sprite)._scale.y = *GHIDRA_CAST((linkedEntity + 0xe8)); - } - } - } - return; -} - -// 005d2a70 -void Entity_Effect::update_mr_me() -{ - Vector *pos; - uint32_t savedParentX; - uint32_t savedParentY; - uint8_t curChar; - GridEntity *gridEntity; - Game *game; - Manager *manager; - char cVar7; - int mrMeData; - Entity_Player *pEVar9; - int *targetEffect; - GridEntity_Door *door; - int iVar12; - float *vecResult; - int iVar14; - uint8_t *animNameCursor; - uint32_t uVar16; - ItemConfig_Item *itemConfig; - uint32_t *gridPos; - Entity_Pickup *pickup; - ColorMod *explosionColor; - void *pvVar20; - int extraout_ECX; - char *literalCursor; - float *extraout_ECX_00; - EntityPtr EVar22; - bool isLess; - float fVar24; - float fVar25; - float fVar26; - float fVar27; - float fVar28; - uint8_t pickupSpriteCopy [220]; - float fStack_cc; - float bestDistSq; - float local_74; - float local_70; - float local_60; - EntityPtr local_5c; - float moveY; - float moveX; - float local_50; - float local_48; - float local_44; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af6230; - local_10 = ExceptionList; - ExceptionList = &local_10; - mrMeData = __RTDynamicCast(); - if (mrMeData == 0) { - ExceptionList = local_10; - return; - } - iVar14 = this->_state; - moveX = g_vectorZero.x; - moveY = g_vectorZero.y; - if (iVar14 == 0) { - if (this->_parent == (EntityPtr)0x0) goto LAB_005d3f7c; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Float"),0); - fVar26 = *GHIDRA_CAST((GHIDRA_CAST(this->_parent) + 0x340)) - (this->_pos).y; - fVar24 = *GHIDRA_CAST((GHIDRA_CAST(this->_parent) + 0x33c)) - (this->_pos).x; - bestDistSq = 0.0; - fVar28 = fVar26 * fVar26 + fVar24 * fVar24; - if (fVar28 <= 4900.0) { - (this->_velocity).x = (this->_velocity).x * 0.9; - (this->_velocity).y = (this->_velocity).y * 0.9; - } - else { - sqrtf(); - if (fVar28 <= 0.0) { - moveY = fVar26; - moveX = fVar24; - } - else { - moveY = (6.0 / fVar28) * fVar26; - moveX = fVar24 * (6.0 / fVar28); - } - } - if (((this->_target != (EntityPtr)0x0) && (this->_parent != (EntityPtr)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(this->_parent) + 0x28)) == 1)) { - pEVar9 = GHIDRA_CAST(__RTDynamicCast()); - targetEffect = GHIDRA_CAST(__RTDynamicCast()); - pvVar20 = pEVar9->_markedTarget; - if (pvVar20 == (void *)0x0) { - fVar24 = (pEVar9->_aimDirection).y * 20.0; - fVar28 = (pEVar9->_aimDirection).x * 20.0; - } - else { - fVar24 = *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x340)) - (float)targetEffect[0xd0]; - fVar28 = *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x33c)) - (float)targetEffect[0xcf]; - targetEffect[0xd5] = 100; - } - targetEffect[0xd8] = GHIDRA_INT(fVar28); - targetEffect[0xd9] = GHIDRA_INT(fVar24); - (**(code **)(*targetEffect + 0x3c))(); - fVar24 = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x340)); - (this->_targetPosition).x = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x33c)); - (this->_targetPosition).y = fVar24; - if ((*GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x172)) != '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x173)) == '\0')) { - *GHIDRA_CAST((mrMeData + 0x124)) = *GHIDRA_CAST((mrMeData + 0x124)) + 1; - goto LAB_005d3f7c; - } - Entity_Player::AnimateCollectible(pEVar9); - pEVar9->Update(); - game = g_game; - local_44 = -NAN; - fVar26 = 0.0; - local_48 = 0.0; - *GHIDRA_CAST((mrMeData + 4)) = 0; - *GHIDRA_CAST((mrMeData + 0x120)) = 0xffffffff; - fVar28 = g_vectorZero.y; - fVar24 = g_vectorZero.x; - *GHIDRA_CAST((mrMeData + 0x128)) = 0; - pvVar20 = game->_room; - local_50 = fVar24; - local_74 = fVar28; - local_5c = (EntityPtr)0x0; - if (0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0xc))) { - local_70 = 5.04467e-44; - do { - if (GHIDRA_UINT(local_5c) < 0x1c0) { - iVar14 = *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + GHIDRA_INT(local_70))); - if (iVar14 == 0) goto LAB_005d2e6b; - uVar16 = *GHIDRA_CAST((iVar14 + 0xc)); - fVar26 = local_48; - if (uVar16 == 2) goto LAB_005d2e6b; - iVar12 = *GHIDRA_CAST((iVar14 + 4)); - if (((iVar12 != 4) && (iVar12 != 0x16)) && ((iVar12 != 6 && (iVar12 != 0x1a)))) { - if (iVar12 == 0xc) { - if (uVar16 < 4) goto LAB_005d314d; - } - else if (iVar12 == 0x10) { - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - if (g_game->_currentRoomIdx != -0x14) { - door = GHIDRA_CAST(__RTDynamicCast()); - fVar24 = local_50; - fVar28 = local_74; - if ((((door->_doorFlags & 0x50U) == 0) && - ((((door->_doorFlags & 0x20U) == 0 || ((door->_desc)._variant != 4)) - && (iVar12 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(), iVar12 != 4))) - ) && ((door->_desc)._state != 2)) { - iVar14 = *GHIDRA_CAST((iVar14 + 0x24)); - local_48 = 2.8026e-45; - iVar12 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - vecResult = GHIDRA_CAST(Isaac)::GetAxisAlignedUnitVectorFromDir(); - local_44 = (float)local_5c; - local_50 = ((float)(iVar14 % iVar12) * 40.0 + 40.0) - *vecResult * 20.0; - local_74 = ((float)(iVar14 / iVar12) * 40.0 + 120.0) - vecResult[1] * 20.0; - fVar24 = local_50; - fVar28 = local_74; - if (((door->_currentRoomType == 7) || (door->_targetRoomType == 7)) || - ((door->_currentRoomType == 8 || - (fVar26 = local_48, door->_targetRoomType == 8)))) { - local_48 = 1.4013e-45; - fVar26 = (float)1; - } - } - } - } - } - else if (iVar12 == 0x14) { - if (uVar16 == 0) { - local_48 = 5.60519e-45; - fVar26 = 5.60519e-45; - fVar24 = (float)(*GHIDRA_CAST((iVar14 + 0x24)) % *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0xc))) * 40.0 + - 40.0; - fVar28 = (float)(*GHIDRA_CAST((iVar14 + 0x24)) / *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0xc))) * 40.0 + - 120.0; - local_74 = fVar28; - local_50 = fVar24; - local_44 = (float)local_5c; - goto LAB_005d2e6e; - } - } - goto LAB_005d2e6b; - } -LAB_005d314d: - fVar26 = 1.4013e-45; - local_48 = 1.4013e-45; - fVar24 = (float)(*GHIDRA_CAST((iVar14 + 0x24)) % *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0xc))) * 40.0 + 40.0; - fVar28 = (float)(*GHIDRA_CAST((iVar14 + 0x24)) / *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0xc))) * 40.0 + 120.0; - local_74 = fVar28; - local_50 = fVar24; - local_44 = (float)local_5c; - } - else { -LAB_005d2e6b: - } -LAB_005d2e6e: - EVar22 = this->_target; - if ((EVar22 != (EntityPtr)0x0) && - ((fVar25 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)) - fVar24, - fVar27 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)) - fVar28, - fVar25 = fVar27 * fVar27 + fVar25 * fVar25, *GHIDRA_CAST((mrMeData + 4)) == 0 || - (fVar25 < bestDistSq)))) { - *GHIDRA_CAST((mrMeData + 4)) = fVar26; - (this->_targetPosition).x = fVar24; - (this->_targetPosition).y = fVar28; - *GHIDRA_CAST((mrMeData + 0x120)) = local_44; - bestDistSq = fVar25; - } - local_5c = (EntityPtr)(GHIDRA_INT(local_5c) + 1); - local_70 = (float)(GHIDRA_INT(local_70) + 4); - pvVar20 = g_game->_room; - } while (GHIDRA_INT(local_5c) < *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0xc))); - } - local_50 = 0.0; - pvVar20 = g_game->_room; - local_44 = g_vectorZero.x; - local_48 = g_vectorZero.y; - local_5c = (EntityPtr)0x0; - local_60 = 0.0; - fVar24 = g_vectorZero.x; - fVar28 = g_vectorZero.y; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x1264)) != 0) { - do { - EVar22 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x125c)) + GHIDRA_INT(local_60) * 4)); - iVar14 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x28)); - if (iVar14 == 0x21) { - if ((*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x380)) <= 1.0) || (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x2c)) < 2)) - goto LAB_005d31b7; -LAB_005d2f78: - fVar24 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)); - fVar28 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)); - local_50 = 1.4013e-45; - local_5c = EVar22; - local_48 = fVar28; - local_44 = fVar24; - } - else { - if ((iVar14 == 0x11) || ((iVar14 == 0x124 && (1.0 < *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x380)))))) - goto LAB_005d2f78; -LAB_005d31b7: - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (iVar14 != 1)) { - if (iVar14 - 10U < 0x3de) goto LAB_005d31d8; -LAB_005d3260: - if (((*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x172)) == '\0') || (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x28)) != 5)) - || (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x171)) == '\0')) { - if (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x28)) == 6) { - if ((*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x7c)) != 0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x8c)) != '\0') - ) { - animNameCursor = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x7c)); - if (0xf < *GHIDRA_CAST((animNameCursor + 0x14))) { - animNameCursor = *GHIDRA_CAST(animNameCursor); - } - literalCursor = "Broken"; - do { - curChar = *animNameCursor; - isLess = curChar < (uint8_t)*literalCursor; - if (curChar != *literalCursor) { -LAB_005d3386: - uVar16 = -GHIDRA_UINT(isLess) | 1; - goto LAB_005d338b; - } - if (curChar == 0) break; - curChar = animNameCursor[1]; - isLess = curChar < (uint8_t)literalCursor[1]; - if (curChar != literalCursor[1]) goto LAB_005d3386; - animNameCursor = animNameCursor + 2; - literalCursor = literalCursor + 2; - } while (curChar != 0); - uVar16 = 0; -LAB_005d338b: - if (uVar16 == 0) goto LAB_005d3396; - } - goto LAB_005d2f78; - } - } - else { - iVar14 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x2c)); - if (iVar14 == 100) { - if (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x30)) == 0) goto LAB_005d32c7; -LAB_005d32e3: - iVar14 = PlayerManager::FirstCollectibleOwner(); - if (iVar14 != 0) { - *GHIDRA_CAST((mrMeData + 0x128)) = 1; - } - } - else if (((((iVar14 != 300) && (iVar14 != 0x46)) && (iVar14 != 0x15e)) && - ((iVar14 != 0x45 && (iVar14 != 0x14)))) && - (((iVar14 != 10 && ((iVar14 != 0x28 && (iVar14 != 0x1e)))) && - (iVar14 != 0x5a)))) { -LAB_005d32c7: - cVar7 = Entity_Pickup::IsChest(); - if ((cVar7 == '\0') || (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x30)) == 0)) goto LAB_005d3396; - if (extraout_ECX == 100) goto LAB_005d32e3; - } - fVar24 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)); - fVar28 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)); - local_50 = 5.60519e-45; - local_5c = EVar22; - local_48 = fVar28; - local_44 = fVar24; - } - } - else { -LAB_005d31d8: - if (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x188)) == 1) goto LAB_005d3260; - if (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x188)) == 0) goto LAB_005d3260; - if (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x3b0)) != '\0') goto LAB_005d3260; - if (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x173)) != '\0') goto LAB_005d3260; - cVar7 = (GHIDRA_CAST(()))->Entity::HasEntityFlags(); - if ((((cVar7 != '\0') && (iVar14 != 0x322)) && (iVar14 != 0x362)) || - (cVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(), cVar7 != '\0')) { - fVar24 = local_44; - fVar28 = local_48; - goto LAB_005d3260; - } - fVar24 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)); - fVar28 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)); - local_50 = 4.2039e-45; - local_5c = EVar22; - local_48 = fVar28; - local_44 = fVar24; - } - } -LAB_005d3396: - fVar26 = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x33c)) - fVar24; - fVar25 = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x340)) - fVar28; - fVar26 = fVar25 * fVar25 + fVar26 * fVar26; - if (*GHIDRA_CAST((mrMeData + 4)) == 0) { -LAB_005d33d8: - *GHIDRA_CAST((mrMeData + 4)) = local_50; - (this->_targetPosition).x = fVar24; - (this->_targetPosition).y = fVar28; - if (this->_child != (EntityPtr)0x0) { - msvc::multiset::erase(); - } - this->_child = local_5c; - if (local_5c != (EntityPtr)0x0) { - msvc::multiset::insert(); - } - *GHIDRA_CAST((mrMeData + 0x120)) = 0xffffffff; - fVar24 = local_44; - fVar28 = local_48; - bestDistSq = fVar26; - } - else if (fVar26 < bestDistSq) goto LAB_005d33d8; - local_60 = (float)(GHIDRA_INT(local_60) + 1); - } while (GHIDRA_UINT(local_60) < *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x1264))); - } - if (*GHIDRA_CAST((mrMeData + 4)) != 0) { - this->_state = 1; - *GHIDRA_CAST((mrMeData + 0x124)) = 0; - *GHIDRA_CAST((mrMeData + 0x124)) = *GHIDRA_CAST((mrMeData + 0x124)) + 1; - goto LAB_005d3f7c; - } - } - this->_state = 3; - *GHIDRA_CAST((mrMeData + 0x124)) = *GHIDRA_CAST((mrMeData + 0x124)) + 1; - goto LAB_005d3f7c; - } - if (iVar14 == 1) { - if (*GHIDRA_CAST((mrMeData + 0x128)) != '\0') { - uVar16 = 0; - pvVar20 = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x1264)) != 0) { - do { - if ((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x125c)) + uVar16 * 4)) + 0x28)) == 5) && - (iVar14 = __RTDynamicCast(), 1 < *GHIDRA_CAST((iVar14 + 0x5c0)))) { - this->_child = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x125c)) + uVar16 * 4)); - break; - } - uVar16 = uVar16 + 1; - } while (uVar16 < *GHIDRA_CAST((GHIDRA_CAST(pvVar20) + 0x1264))); - } - } - EVar22 = this->_child; - if (EVar22 == (EntityPtr)0x0) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x30))); - } - iVar14 = *GHIDRA_CAST((mrMeData + 4)); - if (iVar14 == 4) { - uVar16 = *GHIDRA_CAST((mrMeData + 0x120)); - if ((uVar16 != 0xffffffff) || - ((EVar22 != (EntityPtr)0x0 && - ((*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x2c)) != 100 || (itemConfig != GHIDRA_CAST(0x0))))))) { - local_60 = (this->_targetPosition).x; - local_70 = (this->_targetPosition).y; - if (EVar22 != (EntityPtr)0x0) { - local_60 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)); - local_70 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)); - } - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Resized(); - moveX = *vecResult; - moveY = vecResult[1]; - local_60 = (this->_pos).x - local_60; - local_70 = (this->_pos).y - local_70; - if (256.0 <= local_70 * local_70 + local_60 * local_60) { - if ((EVar22 == (EntityPtr)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x171)) != '\0')) - goto LAB_005d3f7c; - } - else if (GHIDRA_INT(uVar16) < 0) { - if (EVar22 != (EntityPtr)0x0) { - if (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x28)) != 5) goto LAB_005d3f7c; - pickup = GHIDRA_CAST(__RTDynamicCast()); - if (pickup->_price != 0) { - uVar16 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); - manager = g_manager; - if (uVar16 == 0) { - seed_fart_sound_override(); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(0xbb,1.0,2,0,1.0,0.0); - this->_state = 3; - } - else { - (GHIDRA_CAST(()))->Entity_Pickup::update_price_sprite(); - } - } - if (this->_state == 3) goto LAB_005d3f7c; - iVar14 = pickup->_variant; - if (((iVar14 == 0x3c) || (iVar14 == 0x35)) || (iVar14 == 0x37)) { - (GHIDRA_CAST((pickup)))->Entity_Pickup::TryOpenChest(GHIDRA_CAST(0x0)); - } - else if (iVar14 == 0x33) { - explosionColor = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - fStack_cc = 8.560782e-39; - Game::BombExplosionEffects - (g_game,&this->_pos,20.0,(BitSet128)ZEXT816(0),explosionColor, - GHIDRA_CAST(this->_parent),1.0,1,4,0); - } - else if ((iVar14 != 0x14) || (pickup->_subtype != 6)) { - if (*GHIDRA_CAST((mrMeData + 0x128)) != '\0') { - pickup->_cycleCollectibleCount = 0; - } - ANM2::ANM2(GHIDRA_CAST(pickupSpriteCopy),&pickup->_sprite); - ANM2::operator_assign(); - if (pickup->_variant == 100) { - ANM2::Play(GHIDRA_CAST((mrMeData + 8)),GHIDRA_CAST("ShopIdle"),1); - AnimationState::SetAnimationData(GHIDRA_CAST((mrMeData + 0x58))); - fVar24 = g_vectorOne.y * 0.8; - *GHIDRA_CAST((mrMeData + 0xa4)) = g_vectorOne.x * 0.8; - *GHIDRA_CAST((mrMeData + 0xa8)) = fVar24; - } - pickup->_visible = 0; - *GHIDRA_CAST((mrMeData + 0x11c)) = pickup->_entityCollisionClass; - pickup->_entityCollisionClass = 0; - this->_state = 2; - goto LAB_005d3f7c; - } - } - } - else if (((uVar16 < 0x1c0) && - (gridEntity = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar16 * 4 + 0x24)), - gridEntity != GHIDRA_CAST(0x0))) && - (((gridEntity->_desc)._type == 0x14 && - ((EVar22 = this->_parent, EVar22 != (EntityPtr)0x0 && - (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x28)) == 1)))))) { - iVar14 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x13bc)); - savedParentX = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)); - savedParentY = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)); - if (iVar14 < 1) { - iVar14 = 1; - } - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x13bc)) = iVar14; - gridPos = GHIDRA_CAST((GHIDRA_CAST((gridEntity)))->GridEntity)::Position(); - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)) = *gridPos; - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)) = gridPos[1]; - gridEntity->Update(); - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)) = savedParentX; - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)) = savedParentY; - } - } - } - else if (iVar14 == 2) { - fVar24 = (this->_targetPosition).x; - fVar28 = (this->_targetPosition).y; - moveX = fVar24 - (this->_pos).x; - moveY = fVar28 - (this->_pos).y; - fVar26 = moveY * moveY + moveX * moveX; - sqrtf(); - if (0.0 < fVar26) { - moveX = moveX * (8.0 / fVar26); - moveY = moveY * (8.0 / fVar26); - } - fVar24 = (this->_pos).x - fVar24; - fVar28 = (this->_pos).y - fVar28; - if (1600.0 <= fVar28 * fVar28 + fVar24 * fVar24) goto LAB_005d3f7c; - uVar16 = *GHIDRA_CAST((mrMeData + 0x120)); - if (((((((-1 < GHIDRA_INT(uVar16)) && (uVar16 < 0x1c0)) && - (iVar14 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar16 * 4 + 0x24)), iVar14 != 0)) && - ((*GHIDRA_CAST((iVar14 + 4)) == 0x10 && - (door = GHIDRA_CAST(__RTDynamicCast()), (door->_desc)._state != 2)))) && - (this->_parent != (EntityPtr)0x0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(this->_parent) + 0x28)) == 1 && (cVar7 = FUN_00710370(), cVar7 != '\0')))) - && (cVar7 = (GHIDRA_CAST((door)))->GridEntity_Door::TryUnlock(), cVar7 == '\0')) { - (GHIDRA_CAST(()))->GridEntity_Door::Open(); - } - } - else if (iVar14 == 1) { - fVar24 = (this->_targetPosition).x; - pos = &this->_pos; - fVar28 = (this->_targetPosition).y; - moveX = fVar24 - pos->x; - moveY = fVar28 - (this->_pos).y; - fVar26 = moveY * moveY + moveX * moveX; - sqrtf(); - if (0.0 < fVar26) { - moveX = moveX * (8.0 / fVar26); - moveY = moveY * (8.0 / fVar26); - } - fVar24 = pos->x - fVar24; - fVar28 = (this->_pos).y - fVar28; - if (400.0 <= fVar28 * fVar28 + fVar24 * fVar24) goto LAB_005d3f7c; - explosionColor = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - fStack_cc = 8.561981e-39; - Game::BombExplosionEffects - (g_game,pos,20.0,(BitSet128)ZEXT816(0),explosionColor,GHIDRA_CAST(this->_parent),1.0,1,4,0); - } - else { - if (iVar14 != 3) goto LAB_005d3f7c; - if ((EVar22 != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x173)) == '\0')) { - fVar24 = (this->_pos).x; - sqrtf(); - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Resized(); - moveX = *vecResult; - moveY = vecResult[1]; - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (600 < *GHIDRA_CAST((mrMeData + 0x124)))) { - this->_state = 3; - } - cVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(); - if ((cVar7 != '\0') && - (fVar28 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)), - fVar24 = fVar24 - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)), - fVar28 * fVar28 + fVar24 * fVar24 < this->_size * this->_size)) { - (**(code **)(*GHIDRA_CAST(EVar22) + 0x20))(); - (GHIDRA_CAST(()))->Color::Color(); - this->SetColor(); - } - goto LAB_005d3f7c; - } - } - } - else { - if (iVar14 == 3) { - Random(); - Game::SpawnEx(g_game); - this->Remove(); - goto LAB_005d3f7c; - } - if (iVar14 != 2) goto LAB_005d3f7c; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Carry"),0); - EVar22 = this->_parent; - if (((EVar22 != (EntityPtr)0x0) && (this->_child != (EntityPtr)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(this->_child) + 0x172)) != '\0')) { - fVar24 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)) - (this->_pos).x; - fVar26 = *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)) - (this->_pos).y; - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Resized(); - fVar25 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)); - moveX = *vecResult; - moveY = vecResult[1]; - fVar28 = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)); - if (1024.0 <= fVar25 * fVar25 + fVar28 * fVar28) goto LAB_005d3f7c; - Room::FindFreePickupSpawnPosition(); - EVar22 = this->_child; - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x33c)) = fVar24; - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x340)) = fVar26; - EVar22 = this->_child; - cVar7 = (GHIDRA_CAST(()))->Vector::operator_ne(); - if (cVar7 != '\0') { - *extraout_ECX_00 = fVar24; - extraout_ECX_00[1] = fVar26; - EVar22 = this->_child; - } - *GHIDRA_CAST((GHIDRA_CAST(EVar22) + 0x171)) = 1; - *GHIDRA_CAST((GHIDRA_CAST(this->_child) + 0x188)) = *GHIDRA_CAST((mrMeData + 0x11c)); - ANM2::Play(&this->_sprite,GHIDRA_CAST("Float"),0); - } - } - this->_state = 3; -LAB_005d3f7c: - if (*GHIDRA_CAST((mrMeData + 0x111)) != '\0') { - AnimationState::Update(); - AnimationState::Update(); - } - (this->_velocity).x = (this->_velocity).x * 0.9 + moveX * 0.1; - (this->_velocity).y = (this->_velocity).y * 0.9 + moveY * 0.1; - ExceptionList = local_10; - return; -} - -// 005d4010 -void Entity_Effect::update_wave_chain() -{ - float fVar1; - BitSet128 **clampedStep; - float fVar2; - float fVar3; - BitSet128 *local_14; - BitSet128 *local_10; - float spawnY; - int waveDelay; - int waveMode; - - waveDelay = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x438)))); - if (g_game->_frameCount - this->_spawnFrame == waveDelay) { - waveMode = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x440)))); - if (waveMode == 4) { - local_10 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x430)))) * 1.5)); - local_14 = GHIDRA_CAST(0x41a00000); - clampedStep = &local_14; - if ((float)local_10 <= 20.0) { - clampedStep = &local_10; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x430)))) = *clampedStep; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x434)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x434)))) + 0.1; - } - else if ((waveMode == 2) && (GHIDRA_INT((this->_varData)._h) == 1)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x434)))) = 0x3fe00000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x43c)))) = 0x3c; - } - else if (waveMode == 1) { - local_10 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x448)))) * 0.017453292)); - local_14 = GHIDRA_CAST(cos((float)local_10)); - fVar3 = sin((float)local_10); - fVar1 = *GHIDRA_CAST(&(this->_varData)._l); - fVar2 = *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._l) + 4)); - *GHIDRA_CAST(&(this->_varData)._l) = fVar1 * (float)local_14 - fVar2 * fVar3; - *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._l) + 4)) = fVar2 * (float)local_14 + fVar1 * fVar3; - } - fVar1 = *GHIDRA_CAST(&(this->_varData)._l); - local_14 = &this->_varData; - fVar2 = *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._l) + 4)); - fVar2 = sqrtf(fVar1 * fVar1 + fVar2 * fVar2); - fVar1 = *GHIDRA_CAST((GHIDRA_INT(&(this->_varData)._h) + 4)); - spawnY = *GHIDRA_CAST((GHIDRA_INT(&local_14->_l) + 4)); - if (fVar2 <= 0.0) { - fVar3 = *GHIDRA_CAST(&local_14->_l); - } - else { - fVar2 = fVar1 / fVar2; - fVar3 = *GHIDRA_CAST(&local_14->_l) * fVar2; - spawnY = spawnY * fVar2; - } - local_10 = GHIDRA_CAST((fVar3 + (this->_pos).x)); - spawnY = spawnY + (this->_pos).y; - FUN_006395e0(&local_10,local_14,GHIDRA_INT((this->_varData)._h),fVar1,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x430)))) - ,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x434)))),waveDelay,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x43c)))), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x444)))),*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x448))))); - } - return; -} - -// 006073f0 -void Entity_Effect::moonlight_timer_callback(int param_1) -{ - Entity_Player *this; - void *pvVar1; - int iVar2; - Manager *pMVar3; - uint8_t auStack_50 [4]; - int local_4c; - int aiStack_48 [3]; - uint32_t uStack_3c; - uint32_t local_38; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t local_28; - uint32_t uStack_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t local_18; - uint32_t local_14; - uint32_t local_10; - uint32_t local_c; - - pMVar3 = g_manager; - local_c = __security_cookie ^ GHIDRA_UINT(auStack_50); - this = *GHIDRA_CAST((param_1 + 0x3bc)); - if (((this != GHIDRA_CAST(0x0)) && (this->_type == 1)) && (this->_dead == 0)) { - local_4c = 0x84; - seed_fart_sound_override(&local_4c); - (GHIDRA_CAST((&pMVar3->_sfxManager)))->SoundEffects::Play(local_4c,1.0,2,0,1.0,0.0); - local_38 = 0x40000000; - uStack_34 = 0x40400000; - uStack_30 = 0x40800000; - uStack_2c = 0x3f800000; - local_18 = 0x3e4ccccd; - local_14 = 0x3e4ccccd; - local_10 = 0x3e4ccccd; - local_28 = 0; - uStack_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - this->SetColor(&local_38,3,0xffffffff,1,1); - pvVar1 = (g_manager->_itemConfig)._nullItems._begin; - if ((0x128 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU))) - && (iVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x128)), iVar2 != 0)) { - aiStack_48[2] = *GHIDRA_CAST((iVar2 + 0x78)); - aiStack_48[1] = 0; - uStack_3c = 0; - aiStack_48[0] = iVar2; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(aiStack_48,1,1); - } - Entity_Player::AnimateCollectible(this,0x24d,GHIDRA_CAST("UseItem"),GHIDRA_CAST("PlayerPickupSparkle")); - this->Entity_Player::AddSoulHearts(1,0); - } - return; -} - -// 00607620 -void Entity_Effect::Render(Vector *offset) -{ - Entity_Effect *player; - Entity *layerSprite; - uint8_t isLocalPlayerOwned; - LayerState *layer; - int trailDeque; - int iVar1; - ColorMod *to; - ColorMod *pCVar2; - Vector *renderPos; - ColorMod *to_00; - ColorMod *to_01; - Entity_Player *player; - AnimationState *overlayFrame; - Vector *pVVar3; - uint32_t uVar4; - ColorMod *tmpColor; - ColorMod *extraout_EAX; - ColorMod *color; - ColorMod *extraout_EAX_00; - ColorMod *color_00; - ColorMod *extraout_EAX_01; - float *pfVar5; - float curveY; - ANM2 *layerSprite; - Color *this_02; - float *extraout_ECX; - uint32_t *extraout_ECX_00; - int extraout_EDX; - int extraout_EDX_00; - void *pvVar6; - int *trail; - uint8_t auVar7 [12]; - uint8_t auVar8 [12]; - uint8_t auVar9 [12]; - float fVar10; - float fVar11; - float fVar12; - double dVar13; - uint8_t auStack_1f0 [20]; - float fStack_1dc; - uint8_t *layerName; - Vector local_1bc; - Vector local_1b4; - int *local_1ac; - int *local_1a8; - float local_1a4; - char isParentFrameVisible; - Vector local_19c; - float local_194; - float local_190; - float local_18c; - Vector *renderOffset; - Vector local_184; - float *local_17c; - Vector local_178; - float local_170; - uint32_t overlayLayer; - AnimationState *local_168; - Vector local_164; - float local_15c; - float *local_158; - float *local_154; - AnimationState overlayFrameCopy; - uint8_t local_124; - Color lerpColor; - ColorMod scratchColorMod; - Color scratchColor; - ColorMod beamColor; - Color parentColor; - float local_8; - Game *game; - uint32_t *trailPoint; - - local_8 = (float)(__security_cookie ^ GHIDRA_UINT(((&parentColor)[1]._tint + 1))); - renderOffset = offset; - if (this->_variant == 0x79) { - return; - } - local_1bc.y = (float)this; - if ((((this->_variant == 0x1e) && (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0))) && - (isLocalPlayerOwned = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::IsEnemy(), isLocalPlayerOwned != 0 - )) && (isLocalPlayerOwned = is_local_player_owned((void *)this->_spawnerEntity), - isLocalPlayerOwned == 0)) { - return; - } - if (this->_visible == 0) { - return; - } - local_17c = GHIDRA_CAST(((this->_posOffset).y + (this->_pos).y)); - local_1b4.y = (g_screenHeight - 182.0) * 0.5; - local_158 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_154 = GHIDRA_CAST((((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_158 + 0.5)); - dVar13 = floor((double)(float)local_154); - local_1ac = GHIDRA_CAST((float)dVar13); - local_154 = GHIDRA_CAST(((((float)local_17c - 140.0) * 0.65 + local_1b4.y) * (float)local_158 + 0.5)); - dVar13 = floor((double)(float)local_154); - local_154 = GHIDRA_CAST((float)dVar13); - fVar10 = offset->y; - pVVar3 = &this->_renderPosition; - pVVar3->x = (float)local_1ac / (float)local_158 + offset->x; - (this->_renderPosition).y = (float)local_154 / (float)local_158 + fVar10; - iVar1 = this->_variant; - if ((iVar1 == 0x7a) || (iVar1 == 0xb8)) { - local_154 = GHIDRA_CAST(this->_parent); - if (local_154 == GHIDRA_CAST(0x0)) goto LAB_0060ab8d; - layerSprite = GHIDRA_CAST((local_154 + 0x12)); - layer = ANM2::GetLayer(layerSprite,GHIDRA_CAST(this->_state)); - fVar10 = g_displayPixelRatio; - layer->_visible = 1; - local_17c = GHIDRA_CAST((fVar10 * g_screenPointScale)); - local_164.y = (((local_154[0xcf] + local_154[0xd3]) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_17c + 0.5; - dVar13 = floor((double)local_164.y); - local_178.y = (float)dVar13 / (float)local_17c; - local_164.y = (((local_154[0xd0] + local_154[0xd4]) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * (float)local_17c + 0.5; - dVar13 = floor((double)local_164.y); - local_164.x = local_178.y + renderOffset->x; - local_164.y = (float)dVar13 / (float)local_17c + renderOffset->y; - (GHIDRA_CAST((GHIDRA_CAST(layerSprite))))->Sprite::RenderLayer(this->_state,&local_164,&g_vectorZero,&g_vectorZero); - layerName = GHIDRA_CAST(this->_state); - goto LAB_0060ab84; - } - if (iVar1 == 0xc9) { - player = GHIDRA_CAST(this->_parent); - if ((player != GHIDRA_CAST(0x0)) && (player->_type == 3)) { - render_player_target(player,renderOffset,1); - } - goto LAB_0060ab8d; - } - if (iVar1 == 0xc4) { - if ((this->_parent != 0) && (this->_isFollowing != 0)) { - local_15c = g_displayPixelRatio * g_screenPointScale; - local_154 = GHIDRA_CAST((((g_screenWidth - 338.0) * 0.5 + - (*GHIDRA_CAST((this->_parent + 0x33c)) - 60.0) * 0.65) * local_15c + 0.5)); - dVar13 = floor((double)(float)local_154); - local_1b4.y = (float)dVar13 / local_15c; - local_154 = GHIDRA_CAST((((g_screenHeight - 182.0) * 0.5 + - (*GHIDRA_CAST((this->_parent + 0x340)) - 140.0) * 0.65) * local_15c + 0.5)); - dVar13 = floor((double)(float)local_154); - local_154 = GHIDRA_CAST((float)dVar13); - local_164.x = local_1b4.y + renderOffset->x; - local_164.y = (float)local_154 / local_15c + renderOffset->y; - ANM2::Render(&this->_sprite,&local_164,&g_vectorZero,&g_vectorZero); - goto LAB_0060ab8d; - } - } - else if (iVar1 == 0x27) { - if ((this->_subtype == 1) && (iVar1 = this->_parent, iVar1 != 0)) { - if (*GHIDRA_CAST((iVar1 + 200)) < 3) goto LAB_0060ab8d; - layer = ANM2::GetLayer(GHIDRA_CAST((iVar1 + 0x48)),GHIDRA_CAST(0x2)); - layer->_visible = 1; - (GHIDRA_CAST((GHIDRA_CAST((this->_parent + 0x48)))))->Sprite::RenderLayer(2,pVVar3,&g_vectorZero,&g_vectorZero); - layerSprite = GHIDRA_CAST((this->_parent + 0x48)); - layerName = GHIDRA_CAST(0x2); -LAB_0060ab84: - layer = ANM2::GetLayer(layerSprite,layerName); - layer->_visible = 0; - goto LAB_0060ab8d; - } - } - else { - if (iVar1 == 0x8b) { - uVar4 = this->_state; - if ((((GHIDRA_INT(uVar4) < 0) || (0x1bf < uVar4)) || - (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar4 * 4 + 0x24)), iVar1 == 0)) || - ((*GHIDRA_CAST((iVar1 + 4)) != 0x11 || (*GHIDRA_CAST((iVar1 + 0xc0)) < 2)))) goto LAB_0060ab8d; - layerSprite = GHIDRA_CAST((iVar1 + 0x40)); - layer = ANM2::GetLayer(layerSprite,GHIDRA_CAST(0x1)); - layer->_visible = 1; - (GHIDRA_CAST((GHIDRA_CAST(layerSprite))))->Sprite::RenderLayer(1,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - layerName = GHIDRA_CAST(0x1); - goto LAB_0060ab84; - } - if (iVar1 == 0xa6) { - fStack_1dc = 8.860197e-39; - local_190 = (float)__RTDynamicCast(); - if ((((this->_sprite)._loaded != 0) && (local_190 != 0.0)) && - (1 < *GHIDRA_CAST((GHIDRA_CAST(local_190) + 0x14)))) { - DAT_00c78ef0 = &this->_sprite; - DAT_00c78ef4 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c78ef8)) + 0x0))) = 0; - g_beamRendererPointsEnd = g_beamRendererPoints; - local_1ac = *GHIDRA_CAST((GHIDRA_CAST(local_190) + 4)); - local_170 = (float)(*GHIDRA_CAST((GHIDRA_CAST(local_190) + 0x14)) + -1 + *GHIDRA_CAST((GHIDRA_CAST(local_190) + 0x10))); - local_194 = 0.0; - local_158 = GHIDRA_CAST(g_vectorZero.x); - local_18c = g_vectorZero.y; - fVar10 = local_190; - trail = local_1ac; -LAB_00607b21: - do { - if (GHIDRA_INT(local_170) + 1U == *GHIDRA_CAST((GHIDRA_CAST(fVar10) + 0x10))) goto LAB_00607e4b; - if (0 < GHIDRA_INT(local_194)) { - if (trail == GHIDRA_CAST(0x0)) { - iVar1 = 0; - } - else { - iVar1 = *trail; - } - pfVar5 = *(float **) - (*GHIDRA_CAST((iVar1 + 4)) + (*GHIDRA_CAST((iVar1 + 8)) - 1U & GHIDRA_UINT(local_170)) * 4); - fVar11 = *pfVar5 - (float)local_158; - fVar12 = pfVar5[1] - local_18c; - fVar12 = sqrtf(fVar12 * fVar12 + fVar11 * fVar11); - if (trail == GHIDRA_CAST(0x0)) { - iVar1 = 0; - } - else { - iVar1 = *trail; - } - if (fVar12 < *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 4)) + - (*GHIDRA_CAST((iVar1 + 8)) - 1U & GHIDRA_UINT(local_170)) * 4)) + 0x34 - )) * 0.4) { - local_170 = (float)(GHIDRA_INT(local_170) - 1); - goto LAB_00607b21; - } - } - if (trail == GHIDRA_CAST(0x0)) { - iVar1 = 0; - } - else { - iVar1 = *trail; - } - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 4)) + (*GHIDRA_CAST((iVar1 + 8)) - 1U & GHIDRA_UINT(local_170)) * 4)); - beamColor._tint[0] = *GHIDRA_CAST((iVar1 + 8)); - beamColor._tint[1] = *GHIDRA_CAST((iVar1 + 0xc)); - beamColor._tint[2] = *GHIDRA_CAST((iVar1 + 0x10)); - beamColor._colorize[0] = *GHIDRA_CAST((iVar1 + 0x18)); - beamColor._colorize[1] = *GHIDRA_CAST((iVar1 + 0x1c)); - beamColor._colorize[2] = *GHIDRA_CAST((iVar1 + 0x20)); - beamColor._colorize[3] = *GHIDRA_CAST((iVar1 + 0x24)); - (*GHIDRA_CAST((GHIDRA_CAST(&(beamColor._offset)) + 0x0))) = *GHIDRA_CAST((iVar1 + 0x28)); - beamColor._offset[2] = *GHIDRA_CAST((iVar1 + 0x30)); - if (trail == GHIDRA_CAST(0x0)) { - trailDeque = 0; - } - else { - trailDeque = *trail; - } - beamColor._tint[3] = - *GHIDRA_CAST((iVar1 + 0x14)) * - *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((trailDeque + 4)) + - (*GHIDRA_CAST((trailDeque + 8)) - 1U & GHIDRA_UINT(local_170)) * 4)) + 0x3c)); - if (trail == GHIDRA_CAST(0x0)) { - iVar1 = 0; - } - else { - iVar1 = *trail; - } - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 4)) + (*GHIDRA_CAST((iVar1 + 8)) - 1U & GHIDRA_UINT(local_170)) * 4)); - if (trail == GHIDRA_CAST(0x0)) { - local_158 = *GHIDRA_CAST((_DAT_00000004 + (_DAT_00000008 - 1U & GHIDRA_UINT(local_170)) * 4)); - trailDeque = 0; - } - else { - local_158 = *(float **) - (*GHIDRA_CAST((*trail + 4)) + (*GHIDRA_CAST((*trail + 8)) - 1U & GHIDRA_UINT(local_170)) * 4); - trailDeque = *trail; - } - local_1b4.y = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((trailDeque + 4)) + - (*GHIDRA_CAST((trailDeque + 8)) - 1U & GHIDRA_UINT(local_170)) * 4)) + - 0x34)) * *GHIDRA_CAST((GHIDRA_CAST(local_158) + 0x3c)); - if (trail == GHIDRA_CAST(0x0)) { - trailDeque = 0; - } - else { - trailDeque = *trail; - } - local_158 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - pfVar5 = *(float **) - (*GHIDRA_CAST((trailDeque + 4)) + - (*GHIDRA_CAST((trailDeque + 8)) - 1U & GHIDRA_UINT(local_170)) * 4); - local_154 = GHIDRA_CAST((((g_screenWidth - 338.0) * 0.5 + (*pfVar5 - 60.0) * 0.65) * - (float)local_158 + 0.5)); - dVar13 = floor((double)(float)local_154); - local_17c = GHIDRA_CAST(((float)dVar13 / (float)local_158)); - local_154 = GHIDRA_CAST((((pfVar5[1] - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - (float)local_158 + 0.5)); - dVar13 = floor((double)(float)local_154); - local_154 = GHIDRA_CAST((float)dVar13); - local_164.x = (float)local_17c + renderOffset->x; - local_164.y = (float)local_154 / (float)local_158 + renderOffset->y; - BeamRenderer::Add(&local_164,&beamColor,local_1b4.y,*GHIDRA_CAST((iVar1 + 0x38))); - if (local_1ac == GHIDRA_CAST(0x0)) { - iVar1 = 0; - } - else { - iVar1 = *local_1ac; - } - trailPoint = *(uint32_t **) - (*GHIDRA_CAST((iVar1 + 4)) + (*GHIDRA_CAST((iVar1 + 8)) - 1U & GHIDRA_UINT(local_170)) * 4); - local_194 = (float)(GHIDRA_INT(local_194) + 1); - local_170 = (float)(GHIDRA_INT(local_170) - 1); - local_158 = GHIDRA_CAST(*trailPoint); - local_18c = (float)trailPoint[1]; - fVar10 = local_190; - trail = local_1ac; - } while( true ); - } - goto LAB_0060ab8d; - } - if (iVar1 == 0xaf) { - layerSprite = GHIDRA_CAST(this->_target); - if (layerSprite == GHIDRA_CAST(0x0)) { - local_1a8 = GHIDRA_CAST(((this->_posOffset).x + (this->_pos).x)); - local_1a4 = (this->_posOffset).y + (this->_pos).y; - } - else { - local_1a8 = GHIDRA_CAST(((layerSprite->_pos).x + (layerSprite->_posOffset).x)); - local_1a4 = (layerSprite->_pos).y + (layerSprite->_posOffset).y; - isLocalPlayerOwned = (GHIDRA_CAST((layerSprite)))->Entity::IsEnemy(); - if (isLocalPlayerOwned != 0) { - local_1a4 = local_1a4 - 12.0; - } - } - local_170 = 1.0; - if (0 < this->_timeout) { - fVar10 = (float)this->_timeout / 10.0; - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = local_170; - } - local_170 = (2.0 - (fVar10 + fVar10)) * fVar10 + fVar10; - } - local_15c = g_displayPixelRatio * g_screenPointScale; - local_178.y = ((float)local_1a8 - 60.0) * 0.65; - local_17c = GHIDRA_CAST(((local_1a4 - 140.0) * 0.65)); - local_154 = GHIDRA_CAST((((g_screenWidth - 338.0) * 0.5 + local_178.y) * local_15c + 0.5)); - dVar13 = floor((double)(float)local_154); - local_1b4.y = (float)dVar13 / local_15c; - local_154 = GHIDRA_CAST((((g_screenHeight - 182.0) * 0.5 + (float)local_17c) * local_15c + 0.5)); - dVar13 = floor((double)(float)local_154); - local_154 = GHIDRA_CAST((float)dVar13); - fVar10 = renderOffset->x; - (this->_renderPosition).y = (float)local_154 / local_15c + renderOffset->y; - pVVar3->x = local_1b4.y + fVar10; - fVar10 = local_170 * g_vectorOne.y; - (this->_sprite)._scale.x = local_170 * g_vectorOne.x; - (this->_sprite)._scale.y = fVar10; - ANM2::Render(&this->_sprite,pVVar3,&g_vectorZero,&g_vectorZero); - if (this->_parent != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&beamColor))))->Color::operator_assign(&(this->_sprite)._color); - local_18c = this->_updateTime / 15.0; - if (1.0 <= local_18c) { - local_18c = 1.0; - } - local_1bc.y = *GHIDRA_CAST((extraout_EDX + 0x340)) - 15.0; - local_194 = *GHIDRA_CAST((extraout_EDX + 0x33c)) + 0.0; - local_1a4 = local_1a4 - local_1bc.y; - local_1a8 = GHIDRA_CAST(((float)local_1a8 - local_194)); - local_164.y = sqrtf(local_1a4 * local_1a4 + (float)local_1a8 * (float)local_1a8); - if (80.0 <= local_164.y) { - fVar10 = 40.0 / local_164.y; - local_154 = GHIDRA_CAST((local_164.y - 40.0)); - local_158 = GHIDRA_CAST(0x42200000); - local_1ac = GHIDRA_CAST(((float)local_1a8 * fVar10 + local_194)); - local_1b4.y = local_1a4 * fVar10; - local_1a4 = local_1a4 * (1.0 - fVar10) + local_1bc.y; - local_1b4.y = local_1b4.y + local_1bc.y; - local_1a8 = GHIDRA_CAST(((float)local_1a8 * (1.0 - fVar10) + local_194)); - } - else { - local_1ac = GHIDRA_CAST(((float)local_1a8 * 0.5 + local_194)); - local_1b4.y = local_1a4 * 0.5 + local_1bc.y; - local_158 = GHIDRA_CAST((local_164.y * 0.5)); - local_1a8 = local_1ac; - local_1a4 = local_1b4.y; - local_154 = local_158; - } - fVar10 = local_194 - 60.0; - local_194 = (g_screenHeight - 182.0) * 0.5; - local_190 = (g_screenWidth - 338.0) * 0.5; - local_15c = g_displayPixelRatio * g_screenPointScale; - local_19c.y = (fVar10 * 0.65 + local_190) * local_15c + 0.5; - dVar13 = floor((double)local_19c.y); - local_184.y = (float)dVar13 / local_15c; - local_19c.y = ((local_1bc.y - 140.0) * 0.65 + local_194) * local_15c + 0.5; - dVar13 = floor((double)local_19c.y); - local_19c.y = (float)dVar13; - local_1bc.y = renderOffset->y + local_19c.y / local_15c; - local_1bc.x = renderOffset->x + local_184.y; - local_184.y = (((float)local_1ac - 60.0) * 0.65 + local_190) * local_15c + 0.5; - dVar13 = floor((double)local_184.y); - local_19c.y = (float)dVar13 / local_15c; - local_184.y = ((local_1b4.y - 140.0) * 0.65 + local_194) * local_15c + 0.5; - dVar13 = floor((double)local_184.y); - pVVar3 = renderOffset; - local_1b4.y = renderOffset->y + (float)dVar13 / local_15c; - local_1b4.x = renderOffset->x + local_19c.y; - local_184.y = (((float)local_1a8 - 60.0) * 0.65 + local_190) * local_15c + 0.5; - dVar13 = floor((double)local_184.y); - local_19c.y = (float)dVar13 / local_15c; - local_184.y = ((local_1a4 - 140.0) * 0.65 + local_194) * local_15c + 0.5; - dVar13 = floor((double)local_184.y); - local_184.y = (float)dVar13; - local_19c.x = pVVar3->x + local_19c.y; - local_178.y = (local_190 + local_178.y) * local_15c + 0.5; - local_19c.y = pVVar3->y + local_184.y / local_15c; - dVar13 = floor((double)local_178.y); - local_184.y = (float)dVar13 / local_15c; - local_178.y = (local_194 + (float)local_17c) * local_15c + 0.5; - dVar13 = floor((double)local_178.y); - iVar1 = 0; - local_178.x = pVVar3->x + local_184.y; - local_178.y = pVVar3->y + (float)dVar13 / local_15c; - local_18c = local_18c * 0.7; - do { - if (iVar1 == 0) { - local_190 = 4.0; - } - else { - local_190 = 7.0; - } - local_190 = local_190 * this->_updateTime; - DAT_00c78ef0 = &this->_sprite; - g_beamRendererPointsEnd = g_beamRendererPoints; - (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c78ef8)) + 0x0))) = 0; - beamColor._tint[3] = 0.0; - DAT_00c78ef4 = iVar1; - BeamRenderer::Add(&local_1bc,&beamColor,local_170,local_190 + 0.0); - beamColor._tint[3] = local_18c; - BeamRenderer::Add(&local_1b4,&beamColor,local_170,local_190 + (float)local_158); - if ((float)local_154 != (float)local_158) { - BeamRenderer::Add(&local_19c,&beamColor,local_170,local_190 + (float)local_154); - } - beamColor._tint[3] = 0.0; - BeamRenderer::Add(&local_178,&beamColor,local_170,local_190 + local_164.y); - BeamRenderer::End(); - iVar1 = iVar1 + 1; - } while (iVar1 < 2); - } - goto LAB_0060ab8d; - } - if (iVar1 == 0xc1) { - if (this->_subtype == 0) { - fVar12 = 0.0; - fVar10 = ((this->_updateTime + 6.0) - 10.0) / 50.0; - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - (GHIDRA_CAST((&scratchColor)))->Color::Color(); - pCVar2 = Color::Lerp(&beamColor,GHIDRA_CAST(&DAT_00c5c8f8),to,fVar10 + fVar12); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(pCVar2); - iVar1 = this->_target; - if (iVar1 == 0) { - local_164.x = (this->_pos).x + (this->_posOffset).x; - local_164.y = (this->_pos).y + (this->_posOffset).y; - } - else { - local_164.x = *GHIDRA_CAST((iVar1 + 0x33c)) + (this->_posOffset).x; - local_164.y = *GHIDRA_CAST((iVar1 + 0x340)) + (this->_posOffset).y; - } - renderPos = Isaac::GetRenderPosition(&local_178,&local_164,1); - fVar10 = renderOffset->x; - fVar12 = renderPos->x; - (this->_renderPosition).y = renderPos->y + renderOffset->y; - pVVar3->x = fVar10 + fVar12; - ANM2::Render(&this->_sprite,pVVar3,&g_vectorZero,&g_vectorZero); - } - else { - local_164.x = (this->_targetPosition).x; - local_17c = GHIDRA_CAST((this->_targetPosition).y); - local_164.y = (float)local_17c; - local_154 = GHIDRA_CAST(local_164.x); - (GHIDRA_CAST((&parentColor)))->Color::Color(); - fVar10 = 0.0; - if (this->_parent != 0) { - (GHIDRA_CAST((this_02)))->Color::operator_assign(GHIDRA_CAST((this->_parent + 0xf0))); - iVar1 = *GHIDRA_CAST((extraout_EDX_00 + 0x3c4)); - if (iVar1 == 0) { - local_178.x = *GHIDRA_CAST((extraout_EDX_00 + 0x33c)); - local_178.y = *GHIDRA_CAST((extraout_EDX_00 + 0x340)); - } - else { - local_184.x = (float)*GHIDRA_CAST((iVar1 + 0x33c)); - local_184.y = *GHIDRA_CAST((iVar1 + 0x340)); - } - pVVar3 = &local_178; - if (iVar1 != 0) { - pVVar3 = &local_184; - } - fVar12 = (*GHIDRA_CAST((extraout_EDX_00 + 0x3a4)) - fVar10) / 6.0; - if (fVar12 <= fVar10) { - fVar12 = fVar10; - } - if (1.0 <= fVar12) { - fVar12 = 1.0; - } - fVar12 = fVar12 + fVar10; - local_164.x = (pVVar3->x - (this->_pos).x) * fVar12 + (this->_pos).x; - local_17c = GHIDRA_CAST(((pVVar3->y - (this->_pos).y) * fVar12 + (this->_pos).y)); - (this->_posOffset).y = (*GHIDRA_CAST((extraout_EDX_00 + 0x350)) - fVar10) * fVar12 + fVar10; - local_164.y = (float)local_17c; - local_154 = GHIDRA_CAST(local_164.x); - } - isLocalPlayerOwned = (GHIDRA_CAST((&local_164)))->Vector::operator_ne(&this->_pos); - if (isLocalPlayerOwned != 0) { - pVVar3 = Isaac::GetRenderPosition(&local_164,&this->_pos,1); - local_170 = renderOffset->x; - local_1b4.y = local_170 + pVVar3->x; - local_15c = renderOffset->y; - local_1ac = GHIDRA_CAST((local_15c + pVVar3->y)); - local_164.x = (float)local_154 + (this->_posOffset).x; - local_164.y = (float)local_17c + (this->_posOffset).y; - pVVar3 = Isaac::GetRenderPosition(&local_178,&local_164,1); - local_184.y = local_15c + pVVar3->y; - local_184.x = local_170 + pVVar3->x; - local_15c = local_184.y - (float)local_1ac; - local_170 = local_184.x - local_1b4.y; - local_154 = GHIDRA_CAST(sqrtf(local_15c * local_15c + local_170 * local_170)); - DAT_00c78ef0 = &this->_sprite; - local_170 = local_170 / (float)local_154; - DAT_00c78ef4 = 1; - (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c78ef8)) + 0x0))) = 0; - g_beamRendererPointsEnd = g_beamRendererPoints; - local_15c = local_15c / (float)local_154; - local_158 = GHIDRA_CAST(0x0); - if (0.0 < (float)local_154) { - do { - fVar12 = 0.0; - local_164.y = (float)local_154 - (float)local_158; - fVar10 = (((this->_updateTime + 6.0) - local_164.y * 0.5) - 10.0) / 50.0; - if (fVar10 <= 0.0) { - fVar10 = fVar12; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - (GHIDRA_CAST((&lerpColor)))->Color::Color(); - pCVar2 = Color::Lerp(&scratchColorMod,GHIDRA_CAST(&DAT_00c5c8f8),to_00,fVar10 + fVar12) - ; - beamColor._offset[2] = parentColor._offset[2]; - beamColor._tint[0] = parentColor._tint[0]; - beamColor._tint[1] = parentColor._tint[1]; - beamColor._tint[2] = parentColor._tint[2]; - beamColor._tint[3] = parentColor._tint[3]; - beamColor._colorize[0] = parentColor._colorize[0]; - beamColor._colorize[1] = parentColor._colorize[1]; - beamColor._colorize[2] = parentColor._colorize[2]; - beamColor._colorize[3] = parentColor._colorize[3]; - beamColor._offset[0] = parentColor._offset[0]; - beamColor._offset[1] = parentColor._offset[1]; - (GHIDRA_CAST((GHIDRA_CAST(&beamColor))))->Color::__mul(pCVar2); - scratchColor._offset[2] = beamColor._offset[2]; - scratchColor._tint[0] = beamColor._tint[0]; - scratchColor._tint[1] = beamColor._tint[1]; - scratchColor._tint[2] = beamColor._tint[2]; - scratchColor._colorize[0] = beamColor._colorize[0]; - scratchColor._colorize[1] = beamColor._colorize[1]; - scratchColor._colorize[2] = beamColor._colorize[2]; - scratchColor._colorize[3] = beamColor._colorize[3]; - scratchColor._offset[0] = beamColor._offset[0]; - scratchColor._offset[1] = beamColor._offset[1]; - auVar7 = ZEXT812(0x3f800000); - if ((float)local_158 / 40.0 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar7)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar7)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar7)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar7)) + 0x0))) = (float)local_158 / 40.0; - } - scratchColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar7)) + 0x0))); - local_178.x = local_170 * (float)local_158 + local_1b4.y; - local_178.y = local_15c * (float)local_158 + (float)local_1ac; - BeamRenderer::Add(&local_178,GHIDRA_CAST(&scratchColor),1.0,local_164.y); - local_158 = GHIDRA_CAST(((float)local_158 + 10.0)); - } while ((float)local_158 < (float)local_154); - } - fVar12 = 0.0; - fVar10 = ((this->_updateTime + 6.0) - 10.0) / 50.0; - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - (GHIDRA_CAST((GHIDRA_CAST(&scratchColorMod))))->Color::Color(); - Color::Lerp(GHIDRA_CAST(&lerpColor),GHIDRA_CAST(&DAT_00c5c8f8),to_01,fVar10 + fVar12); - (GHIDRA_CAST((GHIDRA_CAST(auStack_1f0))))->Color::operator_assign(GHIDRA_CAST(&parentColor)); - FUN_004072e0(); - auVar8 = ZEXT812(0x3f800000); - if ((float)local_154 / 40.0 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x0))) = (float)local_154 / 40.0; - } - scratchColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x0))); - BeamRenderer::Add(&local_184,GHIDRA_CAST(&scratchColor),1.0,0.0); - BeamRenderer::End(); - } - } - goto LAB_0060ab8d; - } - if (iVar1 == 0xbd) { - if ((this->_subtype == 1) && (0 < this->_state)) { - local_170 = (this->_velocity).x; - local_15c = (this->_velocity).y; - fVar10 = sqrtf(local_170 * local_170 + local_15c * local_15c); - if ((7.0 < fVar10) && (0.0 < fVar10)) { - local_170 = (this->_velocity).x * (7.0 / fVar10); - local_15c = (this->_velocity).y * (7.0 / fVar10); - } - iVar1 = 5; - if (0.0 <= local_15c) { - pfVar5 = beamColor._tint + 1; - do { - pfVar5[1] = 0.0; - *pfVar5 = 0.0; - iVar1 = iVar1 + -1; - pfVar5 = pfVar5 + 2; - } while (iVar1 != 0); - pfVar5 = beamColor._tint + 1; - local_164.y = this->_updateTime * 0.6; - uVar4 = 4; - local_170 = -local_170; - local_15c = -local_15c; - do { - local_178.y = sqrtf((float)GHIDRA_INT(uVar4)); - local_178.y = local_178.y * 1.5; - fVar12 = sin(local_178.y + local_164.y); - fVar10 = local_1bc.y; - uVar4 = uVar4 - 1; - *pfVar5 = (local_170 * local_178.y + 0.0) * 0.65; - pfVar5[1] = (fVar12 + fVar12 + local_15c * local_178.y) * 0.65; - pfVar5 = pfVar5 + 2; - } while (uVar4 < 0x80000000); - local_158 = GHIDRA_CAST(0x0); - do { - pvVar6 = (void *)0x0; - if (((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animData != (void *)0x0) { - AnimationState::SetFrameFloat - (&(GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState,(float)GHIDRA_INT(local_158)); - pvVar6 = ((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animData; - } - local_164.x = beamColor._tint[GHIDRA_INT(local_158) * 2 + 1] + - (GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x1a4)))->x; - local_164.y = beamColor._tint[GHIDRA_INT(local_158) * 2 + 2] + - (GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x1a4)))->y; - if (((pvVar6 != (void *)0x0) && - (1 < *GHIDRA_CAST((GHIDRA_INT(((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animation) + 0x80)))) - && (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x3c)), -1 < iVar1)) { - fStack_1dc = 8.868798e-39; - AnimationLayer::RenderFrame - (GHIDRA_CAST((iVar1 * 0x10 + *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x18)))),&local_164, - *GHIDRA_CAST((GHIDRA_INT(((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._layerFrames) + - iVar1 * 4)),&g_vectorZero,&g_vectorZero, - ((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animation); - } - local_158 = GHIDRA_CAST((GHIDRA_INT(local_158) + 1)); - } while (GHIDRA_INT(local_158) < 5); - local_158 = GHIDRA_CAST(0x0); - do { - pvVar6 = (void *)0x0; - if (((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animData != (void *)0x0) { - AnimationState::SetFrameFloat - (&(GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState,(float)GHIDRA_INT(local_158)); - pvVar6 = ((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animData; - } - local_164.x = beamColor._tint[GHIDRA_INT(local_158) * 2 + 1] + - (GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x1a4)))->x; - local_164.y = beamColor._tint[GHIDRA_INT(local_158) * 2 + 2] + - (GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x1a4)))->y; - if (((pvVar6 != (void *)0x0) && - (0 < *GHIDRA_CAST((GHIDRA_INT(((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animation) + 0x80)))) - && (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x38)), -1 < iVar1)) { - fStack_1dc = 8.869034e-39; - AnimationLayer::RenderFrame - (GHIDRA_CAST((iVar1 * 0x10 + *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x18)))),&local_164, - *GHIDRA_CAST((GHIDRA_INT(((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._layerFrames) + - iVar1 * 4)),&g_vectorZero,&g_vectorZero, - ((GHIDRA_CAST((GHIDRA_INT(fVar10) + 0x48)))->_animState)._animation); - } - local_158 = GHIDRA_CAST((GHIDRA_INT(local_158) + 1)); - } while (GHIDRA_INT(local_158) < 5); - } - else { - pfVar5 = parentColor._tint + 1; - do { - pfVar5[1] = 0.0; - *pfVar5 = 0.0; - iVar1 = iVar1 + -1; - pfVar5 = pfVar5 + 2; - } while (iVar1 != 0); - iVar1 = 0; - local_164.y = this->_updateTime * 0.6; - local_170 = -local_170; - local_15c = -local_15c; - do { - local_178.y = sqrtf((float)iVar1); - local_178.y = local_178.y * 1.5; - fVar10 = sin(local_178.y + local_164.y); - parentColor._tint[iVar1 * 2 + 1] = (local_170 * local_178.y + 0.0) * 0.65; - parentColor._tint[iVar1 * 2 + 2] = (fVar10 + fVar10 + local_15c * local_178.y) * 0.65; - iVar1 = iVar1 + 1; - } while (iVar1 < 5); - local_158 = GHIDRA_CAST(0x0); - do { - if (local_158 == GHIDRA_CAST(0x0)) { - iVar1 = 5; - } - else { - iVar1 = 4 - GHIDRA_INT(local_158); - } - pvVar6 = (void *)0x0; - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)iVar1); - pvVar6 = (this->_sprite)._animState._animData; - } - local_164.x = parentColor._tint[GHIDRA_INT(local_158) * 2 + 1] + (this->_renderPosition).x; - local_164.y = parentColor._tint[GHIDRA_INT(local_158) * 2 + 2] + (this->_renderPosition).y; - if (((pvVar6 != (void *)0x0) && - (1 < *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)))) && - (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x3c)), -1 < iVar1)) { - fStack_1dc = 8.867977e-39; - AnimationLayer::RenderFrame - (GHIDRA_CAST((iVar1 * 0x10 + *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x18)))),&local_164, - *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._layerFrames) + iVar1 * 4)), - &g_vectorZero,&g_vectorZero,(this->_sprite)._animState._animation); - } - local_158 = GHIDRA_CAST((GHIDRA_INT(local_158) + 1)); - } while (GHIDRA_INT(local_158) < 5); - local_158 = GHIDRA_CAST(0x0); - do { - if (local_158 == GHIDRA_CAST(0x0)) { - iVar1 = 5; - } - else { - iVar1 = 4 - GHIDRA_INT(local_158); - } - pvVar6 = (void *)0x0; - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)iVar1); - pvVar6 = (this->_sprite)._animState._animData; - } - local_164.x = (this->_renderPosition).x + parentColor._tint[GHIDRA_INT(local_158) * 2 + 1]; - local_164.y = parentColor._tint[GHIDRA_INT(local_158) * 2 + 2] + (this->_renderPosition).y; - if (((pvVar6 != (void *)0x0) && - (0 < *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)))) && - (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x38)), -1 < iVar1)) { - fStack_1dc = 8.868238e-39; - AnimationLayer::RenderFrame - (GHIDRA_CAST((iVar1 * 0x10 + *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x18)))),&local_164, - *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._layerFrames) + iVar1 * 4)), - &g_vectorZero,&g_vectorZero,(this->_sprite)._animState._animation); - } - local_158 = GHIDRA_CAST((GHIDRA_INT(local_158) + 1)); - } while (GHIDRA_INT(local_158) < 5); - } - goto LAB_0060ab8d; - } - } - else { - if (iVar1 == 0xbf) { - fStack_1dc = 8.869122e-39; - local_190 = (float)__RTDynamicCast(); - if ((local_190 == 0.0) || (*GHIDRA_CAST((GHIDRA_CAST(local_190) + 0x454)) < 1)) goto LAB_0060ab8d; - iVar1 = this->_parent; - local_170 = g_vectorOne.x; - local_15c = g_vectorOne.y; - local_158 = GHIDRA_CAST(g_vectorZero.x); - local_18c = g_vectorZero.y; - if ((iVar1 == 0) || ((*GHIDRA_CAST((iVar1 + 0x151)) == '\0' || (*GHIDRA_CAST((iVar1 + 0x7c)) == 0)))) { - local_164.x = (this->_pos).x + (this->_posOffset).x; - local_164.y = (this->_pos).y + (this->_posOffset).y; - renderPos = Isaac::GetRenderPosition(&local_1b4,&local_164,1); - fVar10 = renderPos->y; - fVar12 = renderOffset->y; - pVVar3->x = renderPos->x + renderOffset->x; - (this->_renderPosition).y = fVar10 + fVar12; - } - else { - local_154 = AnimationState::GetLayerFrame(GHIDRA_CAST((iVar1 + 0x78)),0); - if ((local_154 == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST((local_154 + 0xb)) == '\0')) { - iVar1 = this->_parent; - isParentFrameVisible = '\0'; - local_170 = *GHIDRA_CAST((iVar1 + 0xe4)); - local_15c = *GHIDRA_CAST((iVar1 + 0xe8)); - if (local_154 != GHIDRA_CAST(0x0)) goto LAB_00609482; - } - else { - iVar1 = this->_parent; - isParentFrameVisible = '\x01'; - local_170 = *GHIDRA_CAST((iVar1 + 0xe4)); - local_15c = *GHIDRA_CAST((iVar1 + 0xe8)); -LAB_00609482: - if ((*GHIDRA_CAST((iVar1 + 0x28)) == 5) && (*GHIDRA_CAST((iVar1 + 0x2c)) == 0x45)) { - layer = ANM2::GetLayer(GHIDRA_CAST((iVar1 + 0x48)),GHIDRA_CAST(0x0)); - iVar1 = this->_parent; - local_158 = GHIDRA_CAST(((float)local_158 + (layer->_pos).x + local_154[4])); - local_18c = local_18c + (layer->_pos).y + local_154[5]; - } - layer = ANM2::GetLayer(GHIDRA_CAST((iVar1 + 0x48)),GHIDRA_CAST(0x0)); - iVar1 = this->_parent; - local_170 = local_170 * (layer->_size).x * local_154[6]; - local_15c = local_15c * (layer->_size).y * local_154[7]; - } - local_164.x = *GHIDRA_CAST((iVar1 + 0x33c)) + *GHIDRA_CAST((iVar1 + 0x34c)); - local_164.y = *GHIDRA_CAST((iVar1 + 0x340)) + *GHIDRA_CAST((iVar1 + 0x350)); - renderPos = Isaac::GetRenderPosition(&local_19c,&local_164,1); - fVar10 = renderPos->y; - fVar12 = renderOffset->y; - pVVar3->x = renderPos->x + renderOffset->x; - (this->_renderPosition).y = fVar10 + fVar12; - if (isParentFrameVisible == '\0') goto LAB_0060ab8d; - } - local_154 = GHIDRA_CAST(0x0); - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(local_190) + 0x454)); - if (0 < iVar1) { - local_17c = GHIDRA_CAST((&DAT_00c5c928 + (((iVar1 + -1) * iVar1) / 2) * 8)); - local_164.y = local_170 * 0.5; - local_178.y = local_15c * 0.5; - pfVar5 = GHIDRA_CAST((GHIDRA_INT(local_190) + 0xa4)); - do { - pfVar5[-3] = (float)local_158; - pfVar5[-2] = local_18c; - pfVar5[-1] = local_164.y; - *pfVar5 = local_178.y; - local_184.x = local_170 * *local_17c * 0.65 + pVVar3->x; - local_184.y = local_15c * local_17c[1] * 0.65 + (this->_renderPosition).y; - ANM2::Render(GHIDRA_CAST((pfVar5 + -0x28)),&local_184,&g_vectorZero,&g_vectorZero); - pfVar5 = pfVar5 + 0x45; - local_154 = GHIDRA_CAST((GHIDRA_INT(local_154) + 1)); - local_17c = local_17c + 2; - } while (GHIDRA_INT(local_154) < *GHIDRA_CAST((GHIDRA_CAST(local_190) + 0x454))); - } - goto LAB_0060ab8d; - } - if (iVar1 == 0x32) { - pfVar5 = GHIDRA_CAST(0x3f800000); - local_154 = GHIDRA_CAST(0x3f800000); - if (GHIDRA_CAST(this->_parent) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::GetLastParent(); - fStack_1dc = 8.870603e-39; - player = GHIDRA_CAST(__RTDynamicCast()); - if (player != GHIDRA_CAST(0x0)) { - isLocalPlayerOwned = (GHIDRA_CAST((player)))->Entity_Player::IsLocalPlayer(); - if (isLocalPlayerOwned == 0) { - FUN_00925df0(); - local_154 = pfVar5; - } - } - } - (GHIDRA_CAST((&scratchColor)))->Color::operator_assign(&(this->_sprite)._color); - game = g_game; - (this->_sprite)._color._tint[3] = (float)local_154 * (this->_sprite)._color._tint[3]; - if (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x12bc)) == 5) { - (this->_sprite)._flipY = (this->_sprite)._flipY == 0; - ANM2::Render(&this->_sprite,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - (this->_sprite)._flipY = (this->_sprite)._flipY == 0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&scratchColor)); - } - else { - ANM2::Render(&this->_sprite,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&scratchColor)); - } - goto LAB_0060ab8d; - } - } - } - ANM2::Render(&this->_sprite,pVVar3,&g_vectorZero,&g_vectorZero); - iVar1 = this->_variant; - if (((iVar1 == 0x1e) || (iVar1 == 0x99)) && - ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) { - overlayFrame = AnimationState::GetLayerFrame(&(this->_sprite)._overlayAnimState,1); - if (overlayFrame != GHIDRA_CAST(0x0)) { - AnimationState::copy_assign(&overlayFrameCopy,overlayFrame); - (GHIDRA_CAST((&overlayLayer)))->LayerAnimation::LayerAnimation(); - overlayFrameCopy._layerFrames = (void *)(this->_scale * 0.65); - local_168 = &overlayFrameCopy; - local_164.x = 1.4013e-45; - overlayLayer = 1; - local_164.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_164.y)) + 0x1))),1); - local_124 = 1; - fStack_1dc = 8.871164e-39; - AnimationLayer::RenderFrame - (GHIDRA_CAST(&overlayLayer),pVVar3,0,&g_vectorZero,&g_vectorZero,&this->_sprite - ); - } - } - else if (iVar1 == 0xa0) { - if (((this->_target != 0) && (this->_parent != 0)) && - (isLocalPlayerOwned = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), - isLocalPlayerOwned != 0)) { - fVar10 = (this->_posOffset).x; - fVar12 = (this->_posOffset).y; - local_184.y = *GHIDRA_CAST((this->_parent + 0x340)) + (this->_parentOffset).y; - local_184.x = *GHIDRA_CAST((this->_parent + 0x33c)) + (this->_parentOffset).x; - local_164.y = *GHIDRA_CAST((this->_target + 0x33c)) + fVar10; - local_154 = GHIDRA_CAST((fVar10 + *extraout_ECX)); - local_178.y = *GHIDRA_CAST((this->_target + 0x340)) + fVar12; - local_17c = GHIDRA_CAST((fVar12 + extraout_ECX[1])); - fVar10 = local_184.x - local_164.y; - fVar12 = local_184.y - local_178.y; - if (900.0 <= fVar12 * fVar12 + fVar10 * fVar10) { - local_19c.x = fVar10; - local_19c.y = fVar12; - pVVar3 = (GHIDRA_CAST((&local_19c)))->Vector::Resized(&local_1b4,30.0); - local_164.x = local_164.y + pVVar3->x; - local_164.y = local_178.y + pVVar3->y; - pVVar3 = Isaac::GetRenderPosition(&local_178,&local_164,1); - local_170 = renderOffset->x; - local_15c = renderOffset->y; - local_1bc.y = local_170 + pVVar3->x; - local_18c = local_15c + pVVar3->y; - local_164.x = local_184.x - (float)local_154; - local_164.y = local_184.y - (float)local_17c; - pVVar3 = (GHIDRA_CAST((&local_164)))->Vector::Resized(&local_178,30.0); - local_164.x = (float)local_154 + pVVar3->x; - local_164.y = (float)local_17c + pVVar3->y; - isLocalPlayerOwned = 1; - pVVar3 = Isaac::GetRenderPosition(&local_19c,&local_164,1); - local_194 = local_170 + pVVar3->x; - local_158 = GHIDRA_CAST((local_15c + pVVar3->y)); - pVVar3 = Isaac::GetRenderPosition(&local_164,&local_184,1); - local_170 = local_170 + pVVar3->x; - local_15c = local_15c + pVVar3->y; - local_154 = GHIDRA_CAST(0x3f800000); - uVar4 = Game::GetStageID(g_game,isLocalPlayerOwned); - if (uVar4 == 0x1e) { - local_154 = GHIDRA_CAST(0x3eb33333); - } - BeamRenderer::Begin(&this->_sprite,0,0,0); - local_164.y = 0.0; - local_1bc.y = local_1bc.y - local_170; - local_190 = 0.0; - local_194 = local_194 - local_170; - local_164.x = 0.0; - local_18c = local_18c - local_15c; - local_17c = GHIDRA_CAST(0x0); - local_158 = GHIDRA_CAST(((float)local_158 - local_15c)); - do { - fVar11 = (float)((double)GHIDRA_INT(local_17c) + - __uint_to_double_fixup[-(GHIDRA_INT(local_17c) >> 0x1f)]) / 10.0; - fVar10 = local_194 * fVar11 + local_170; - fVar12 = (float)local_158 * fVar11 + local_15c; - pfVar5 = GHIDRA_CAST((((local_1bc.y * fVar11 + local_170) - fVar10) * fVar11 + fVar10)); - curveY = ((local_18c * fVar11 + local_15c) - fVar12) * fVar11 + fVar12; - if (local_17c != GHIDRA_CAST(0x0)) { - fVar10 = curveY - local_164.y; - fVar12 = (float)pfVar5 - local_164.x; - local_164.x = (float)pfVar5; - local_164.y = curveY; - fVar10 = sqrtf(fVar10 * fVar10 + fVar12 * fVar12); - local_190 = fVar10 + local_190; - pfVar5 = GHIDRA_CAST(local_164.x); - curveY = local_164.y; - } - local_164.y = curveY; - local_164.x = (float)pfVar5; - (GHIDRA_CAST((&scratchColor)))->Color::Reset(); - scratchColor._tint[0] = 1.0; - scratchColor._tint[1] = 1.0; - scratchColor._tint[2] = 1.0; - scratchColor._tint[3] = (float)local_154; - BeamRenderer::Add(&local_164,GHIDRA_CAST(&scratchColor),0.9,local_190); - local_17c = GHIDRA_CAST((GHIDRA_INT(local_17c) + 1)); - } while (local_17c < &DAT_0000000b); - BeamRenderer::End(); - } - } - } - else if (iVar1 == 0x7e) { - if ((this->_subtype == 1) && - (isLocalPlayerOwned = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), - isLocalPlayerOwned != 0)) { - local_164.y = (float)this->_timeout; - if (this->_timeout < 6) { - fVar10 = (local_164.y - 0.0) / 5.0; - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - fVar10 = fVar10 * 0.8 + 0.2; - local_158 = GHIDRA_CAST((2.0 - fVar10)); - } - else { - local_178.y = (float)this->_lifespan; - if (local_178.y == 5.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - fVar10 = (local_164.y - 5.0) / (local_178.y - 5.0); - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - fVar10 = pow(1.0 - fVar10,0.5); - local_158 = GHIDRA_CAST(0x3f800000); - } - fVar12 = 1.0; - BeamRenderer::Begin(&this->_sprite,1,0,1); - (GHIDRA_CAST((GHIDRA_CAST(&scratchColorMod))))->Color::Color(fVar12,fVar12,fVar12,fVar10 * 0.5); - local_164.x = (this->_pos).x + (this->_posOffset).x; - local_164.y = (this->_pos).y + (this->_posOffset).y; - pVVar3 = Isaac::GetRenderPosition(&local_178,&local_164,1); - local_164.x = renderOffset->x + pVVar3->x; - local_164.y = pVVar3->y + renderOffset->y; - BeamRenderer::Add(&local_164,tmpColor,(float)local_158,0.0); - (GHIDRA_CAST((GHIDRA_CAST(&scratchColorMod))))->Color::Color(1.0,1.0,1.0,0.0); - local_164.x = (this->_pos).x + (this->_posOffset).x + (this->_targetPosition).x * 700.0; - local_164.y = (this->_posOffset).y + (this->_pos).y + (this->_targetPosition).y * 700.0; - pVVar3 = Isaac::GetRenderPosition(&local_178,&local_164,1); - fVar10 = 0.0; - pCVar2 = extraout_EAX; - pfVar5 = local_158; -LAB_0060a8db: - local_164.x = pVVar3->x + renderOffset->x; -LAB_0060a8e9: - local_164.y = pVVar3->y + renderOffset->y; - BeamRenderer::Add(&local_164,pCVar2,(float)pfVar5,fVar10); - BeamRenderer::End(); - } - } - else if (iVar1 == 0xac) { - if ((this->_subtype == 1) && - (isLocalPlayerOwned = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), - isLocalPlayerOwned != 0)) { - local_184.x = (float)*extraout_ECX_00; - local_18c = (float)extraout_ECX_00[1]; - local_184.y = local_18c; - local_158 = GHIDRA_CAST(local_184.x); - if ((g_manager->_framecount & 1) == 0) { - local_164.y = this->_rotation * this->_speedMultiplier * 0.5 * 0.017453292; - local_178.y = cos(local_164.y); - fVar10 = sin(local_164.y); - local_184.y = (float)local_158 * fVar10; - local_158 = GHIDRA_CAST(((float)local_158 * local_178.y - local_18c * fVar10)); - local_184.y = local_18c * local_178.y + local_184.y; - } - local_164.y = (float)this->_timeout; - local_18c = local_184.y; - local_184.x = (float)local_158; - if (this->_timeout < 6) { - fVar10 = (local_164.y - 0.0) / 5.0; - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - fVar10 = fVar10 * 0.8 + 0.2; - fVar11 = 2.0 - fVar10; - local_154 = GHIDRA_CAST((fVar10 * fVar10)); - } - else { - iVar1 = this->_lifespan; - local_178.y = (float)iVar1; - if (local_178.y == 5.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - iVar1 = this->_lifespan; - } - fVar10 = (local_164.y - 5.0) / (local_178.y - 5.0); - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - fVar10 = pow(1.0 - fVar10,0.5); - fVar11 = 1.0; - fVar12 = (float)(iVar1 - this->_timeout) / 15.0; - if (1.0 <= fVar12) { - fVar12 = 1.0; - } - local_154 = GHIDRA_CAST((fVar12 * fVar10 * fVar10)); - } - fVar10 = 1.0; - local_164.y = (this->_sprite)._scale.x; - local_17c = GHIDRA_CAST((local_164.y * fVar11)); - BeamRenderer::Begin(&this->_sprite,1,0,1); - (GHIDRA_CAST((GHIDRA_CAST(&scratchColorMod))))->Color::Color(fVar10,fVar10,fVar10,0.5); - local_178.x = (this->_posOffset).x + (this->_pos).x + (float)local_158; - local_178.y = (this->_posOffset).y + (this->_pos).y + local_18c; - pVVar3 = Isaac::GetRenderPosition(&local_19c,&local_178,1); - local_178.x = renderOffset->x + pVVar3->x; - local_178.y = pVVar3->y + renderOffset->y; - BeamRenderer::Add(&local_178,color,(float)local_17c,0.0); - (GHIDRA_CAST((GHIDRA_CAST(&scratchColorMod))))->Color::Color(1.0,1.0,1.0,0.0); - pVVar3 = (GHIDRA_CAST((&local_184)))->Vector::Resized(&local_178,((float)local_154 * 250.0 + 40.0) * local_164.y); - local_164.x = (this->_pos).x + (this->_posOffset).x + pVVar3->x; - local_164.y = (this->_posOffset).y + (this->_pos).y + pVVar3->y; - pVVar3 = Isaac::GetRenderPosition(&local_184,&local_164,1); - fVar10 = 0.0; - local_164.x = renderOffset->x + pVVar3->x; - pCVar2 = extraout_EAX_00; - pfVar5 = local_17c; - goto LAB_0060a8e9; - } - } - else if (iVar1 == 0xc6) { - local_178.x = (this->_targetPosition).x; - local_178.y = (this->_targetPosition).y; - local_158 = GHIDRA_CAST((this->_sprite)._scale.x); - pvVar6 = g_game->_room; - if (ABS(local_178.x) <= ABS(local_178.y)) { - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x20)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x18)); - } - else { - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x14)); - } - local_154 = GHIDRA_CAST((fVar10 * 0.8)); - ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - (GHIDRA_CAST((GHIDRA_CAST(auStack_1f0))))->Color::operator_assign(&(this->_sprite)._color); - FUN_004072e0(); - (GHIDRA_CAST((&scratchColor)))->Color::operator_assign(&beamColor); - scratchColor._tint[3] = 0.0; - BeamRenderer::Begin(&this->_sprite,1,0,1); - local_164.x = (this->_pos).x + (this->_posOffset).x; - local_164.y = (this->_posOffset).y + (this->_pos).y; - pVVar3 = Isaac::GetRenderPosition(&local_184,&local_164,1); - local_164.x = pVVar3->x + renderOffset->x; - local_164.y = pVVar3->y + renderOffset->y; - BeamRenderer::Add(&local_164,GHIDRA_CAST(&scratchColor),(float)local_158,1.0); - auVar9 = ZEXT812(0x42700000); - if ((float)local_154 * 0.5 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar9)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar9)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar9)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar9)) + 0x0))) = (float)local_154 * 0.5; - } - pVVar3 = (GHIDRA_CAST((&local_178)))->Vector::Resized(&local_184,(*GHIDRA_CAST((GHIDRA_CAST(&(auVar9)) + 0x0)))); - local_164.x = (this->_posOffset).x + (this->_pos).x + pVVar3->x; - local_164.y = (this->_posOffset).y + (this->_pos).y + pVVar3->y; - pVVar3 = Isaac::GetRenderPosition(&local_19c,&local_164,1); - local_164.x = pVVar3->x + renderOffset->x; - local_164.y = pVVar3->y + renderOffset->y; - BeamRenderer::Add(&local_164,&beamColor,(float)local_158,0.0); - pVVar3 = (GHIDRA_CAST((&local_178)))->Vector::Resized(&local_184,(float)local_154); - local_164.x = (this->_posOffset).x + (this->_pos).x + pVVar3->x; - local_164.y = (this->_posOffset).y + (this->_pos).y + pVVar3->y; - pVVar3 = Isaac::GetRenderPosition(&local_178,&local_164,1); - local_164.x = pVVar3->x + renderOffset->x; - local_164.y = pVVar3->y + renderOffset->y; - BeamRenderer::Add(&local_164,GHIDRA_CAST(&scratchColor),(float)local_158,1.0); - BeamRenderer::End(); - } - else if ((iVar1 == 0xbe) && (this->_state != 3)) { - fVar10 = (this->_targetPosition).x; - fVar12 = (this->_targetPosition).y; - pvVar6 = g_game->_room; - fVar11 = (this->_sprite)._color._tint[3]; - if (ABS(fVar10) <= ABS(fVar12)) { - local_154 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x20)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x18)))); - } - else { - local_154 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x14)))); - } - local_178.x = fVar10; - local_178.y = fVar12; - BeamRenderer::Begin(&this->_sprite,1,0,1); - (GHIDRA_CAST((GHIDRA_CAST(&scratchColorMod))))->Color::Color(1.0,1.0,1.0,fVar11); - local_164.x = (this->_posOffset).x + (this->_pos).x + fVar10; - local_164.y = (this->_pos).y + (this->_posOffset).y + fVar12; - pVVar3 = Isaac::GetRenderPosition(&local_184,&local_164,1); - local_164.x = renderOffset->x + pVVar3->x; - local_164.y = pVVar3->y + renderOffset->y; - BeamRenderer::Add(&local_164,color_00,1.0,0.0); - (GHIDRA_CAST((GHIDRA_CAST(&scratchColorMod))))->Color::Color(1.0,1.0,1.0,0.0); - pVVar3 = (GHIDRA_CAST((&local_178)))->Vector::Resized(&local_184,(float)local_154 * 0.8); - local_164.x = (this->_posOffset).x + (this->_pos).x + pVVar3->x; - local_164.y = (this->_pos).y + (this->_posOffset).y + pVVar3->y; - pVVar3 = Isaac::GetRenderPosition(&local_178,&local_164,1); - pfVar5 = GHIDRA_CAST(0x3f800000); - fVar10 = 1.0; - pCVar2 = extraout_EAX_01; - goto LAB_0060a8db; - } - if ((this->_variant == 0x6c) && (this->_state == 2)) { - fStack_1dc = 8.87695e-39; - local_164.y = (float)__RTDynamicCast(); - if ((this->_child != 0) && - (((GHIDRA_CAST(local_164.y) != GHIDRA_CAST(0x0) && (*GHIDRA_CAST((GHIDRA_CAST(local_164.y) + 0x111)) != '\0')) && - (pfVar5 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetNullFrame(GHIDRA_CAST("CarryPos")), - pfVar5 != GHIDRA_CAST(0x0))))) { - local_178.x = *pfVar5 + (this->_renderPosition).x; - local_178.y = (this->_renderPosition).y + pfVar5[1]; - ANM2::Render(GHIDRA_CAST((GHIDRA_INT(local_164.y) + 8)),&local_178,&g_vectorZero,&g_vectorZero); - } - } -LAB_0060ab8d: - FUN_008614f0(); - return; -LAB_00607e4b: - BeamRenderer::End(); - goto LAB_0060ab8d; -} - -// 0060abb0 -void Entity_Effect::ClearReferences() -{ - int variant; - Entity_Player *target; - - variant = this->_variant; - if (variant == 0xb3) { - target = GHIDRA_CAST(this->_target); - if ((target == GHIDRA_CAST(0x0)) || (target->_type != 1)) goto LAB_0060ac03; - (GHIDRA_CAST((target)))->Entity_Player::AddUrnSouls(1); - variant = this->_variant; - } - if (((variant == 0xc1) && (this->_subtype == 0)) && (this->_visible == 0)) { - SFXManager::Stop(&g_manager->_sfxManager,0x1f7); - } -LAB_0060ac03: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - ExtraDataRef::Set(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4b4))),(void *)0x0); - return; -} - -// 0060ac20 -uint8_t Entity_Effect::IsPlayerCreep(int variant) -{ - if (((((variant == 0x36) || (variant == 0x2d)) || (variant == 0x2e)) || - ((((variant == 0x2c || (variant == 0x25)) || - ((variant == 0x35 || ((variant == 0x20 || (variant == 0x4e)))))) || (variant == 0xcc)))) || - (((variant == 0x5c || (variant == 0x5a)) || (variant == 0x5d)))) { - return 1; - } - return 0; -} - -// 0060af00 -Entity_Effect * Entity_Effect::CreateTimer(void *fn, uint32_t delay, uint32_t times, uint8_t isPersistent) -{ - uint32_t seed; - Entity_Effect *timer; - uint64_t flags; - uint32_t *flagsHigh; - - seed = Random(); - timer = (Entity_Effect *) - Game::SpawnEx(g_game,1000,0x77,&g_vectorZero,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - *(void **)&(timer->_varData)._l = fn; - *GHIDRA_CAST((GHIDRA_INT(&(timer->_varData)._l) + 4)) = delay; - *GHIDRA_CAST(&(timer->_varData)._h) = times; - if (isPersistent != 0) { - flags = timer->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&timer->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x20; - *GHIDRA_CAST(&timer->_flags) = GHIDRA_INT(flags); - } - return timer; -} - -// 0060b0d0 -void Entity_Effect::update_variant178_shooter(uint8_t isPositionOnly) -{ - float fVar1; - uint8_t bVar2; - char *directionName; - int iVar3; - uint8_t *******pppppppbVar4; - uint8_t *pbVar5; - void *freeBlock; - uint8_t *pbVar6; - char *currentAnimName; - uint32_t uVar7; - uint8_t *pbVar8; - uint8_t *******pppppppbVar9; - bool bVar10; - float fVar11; - float fVar12; - float fVar13; - uint64_t uVar14; - float turnLerp; - uint8_t *fullAnimName; - void *local_84 [4]; - uint32_t local_74; - uint32_t local_70; - void *local_6c; - uint32_t local_5c; - uint32_t local_58; - void *local_54 [4]; - uint32_t local_44; - uint32_t local_40; - uint8_t *******joinedAnimName [5]; - uint32_t local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint8_t ******local_14; - - puStack_20 = GHIDRA_CAST((joinedAnimName + 0xe)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &DAT_00af6605; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((joinedAnimName + 0xb)); - iVar3 = this->_parent; - if (iVar3 == 0) { - if (isPositionOnly == 0) { - ExceptionList = &local_1c; - puStack_20 = GHIDRA_CAST((joinedAnimName + 0xe)); - this->Remove(local_24); - ExceptionList = local_1c; - return; - } - return; - } - fVar12 = 0.4; - turnLerp = 0.4; - ExceptionList = &local_1c; - pppppppbVar9 = GHIDRA_CAST((joinedAnimName + 0xe)); - if (isPositionOnly == 0) { - fVar1 = this->_speedMultiplier; - if (fVar1 != 1.0) { - fVar12 = 0.4 / ((fVar1 + 0.4) - fVar1 * 0.4); - } - fVar1 = (this->_sprite)._rotation; - fVar11 = this->_rotation; - fVar13 = fVar11 - fVar1; - pppppppbVar9 = GHIDRA_CAST((joinedAnimName + 0xe)); - if (360.0 < ABS(fVar13)) { - fVar13 = fmodf(fVar13,360.0); - pppppppbVar9 = GHIDRA_CAST(puStack_20); - } - puStack_20 = GHIDRA_CAST(pppppppbVar9); - if (fVar13 <= 180.0) { - if (fVar13 < -180.0) { - fVar13 = fVar13 + 360.0; - } - } - else { - fVar13 = fVar13 - 360.0; - } - fVar12 = approach_angle(fVar1,fVar11,ABS(fVar13 * fVar12)); - (this->_sprite)._rotation = fVar12; - pppppppbVar9 = GHIDRA_CAST(puStack_20); - } - puStack_20 = GHIDRA_CAST(pppppppbVar9); - fVar12 = this->_speedMultiplier; - if (fVar12 != 1.0) { - turnLerp = 0.4 / ((fVar12 + 0.4) - fVar12 * 0.4); - } - fVar12 = (this->_sprite)._rotation; - if (isPositionOnly != 0) { - fVar1 = this->_rotation; - fVar11 = fVar1 - fVar12; - if (360.0 < ABS(fVar11)) { - fVar11 = fmodf(fVar11,360.0); - } - if (fVar11 <= 180.0) { - if (fVar11 < -180.0) { - fVar11 = fVar11 + 360.0; - } - } - else { - fVar11 = fVar11 - 360.0; - } - fVar12 = approach_angle(fVar12,fVar1,ABS(fVar11 * turnLerp) * 0.5); - } - fVar13 = sin(fVar12 * 0.017453292); - fVar1 = *GHIDRA_CAST((iVar3 + 0x33c)); - fVar11 = *GHIDRA_CAST((iVar3 + 0x340)); - fVar12 = cos(fVar12 * 0.017453292); - (this->_pos).x = fVar1 + fVar12 * 18.0; - (this->_pos).y = fVar11 + fVar13 * 18.0; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - if (isPositionOnly != 0) { - ExceptionList = local_1c; - return; - } - iVar3 = this->_state; - if (iVar3 < 0) { - this->_state = iVar3 + 1; -switchD_0060b3c2_caseD_0: - pbVar8 = s_Idle; - } - else { - switch(iVar3) { - case 0: - goto switchD_0060b3c2_caseD_0; - case 1: - case 2: - pbVar8 = GHIDRA_CAST("ShootBegin"); - break; - case 3: - pbVar8 = GHIDRA_CAST("ShootLoop"); - break; - case 4: - pbVar8 = GHIDRA_CAST("ShootEnd"); - break; - default: - goto switchD_0060b3c2_default; - } - } - fVar12 = (this->_sprite)._rotation; - if (360.0 < ABS(fVar12)) { - fVar12 = fmodf(fVar12,360.0); - } - if (fVar12 <= 180.0) { - if (fVar12 < -180.0) { - fVar12 = fVar12 + 360.0; - } - } - else { - fVar12 = fVar12 - 360.0; - } - if ((fVar12 < 20.0) || (160.0 < fVar12)) { - if ((fVar12 < -160.0) || (-20.0 < fVar12)) { - if ((160.0 < fVar12) || (directionName = "Right", fVar12 < -160.0)) { - directionName = "Left"; - } - } - else { - directionName = "Up"; - } - } - else { - directionName = "Down"; - } - currentAnimName = (this->_sprite)._animState._animData; - if (currentAnimName != GHIDRA_CAST(0x0)) { - pbVar5 = pbVar8; - do { - bVar2 = *pbVar5; - pbVar5 = pbVar5 + 1; - } while (bVar2 != 0); - if (0xf < *GHIDRA_CAST((currentAnimName + 0x14))) { - currentAnimName = *GHIDRA_CAST(currentAnimName); - } - iVar3 = strncmp(GHIDRA_CAST(pbVar8),currentAnimName,GHIDRA_INT(pbVar5) - GHIDRA_INT((pbVar8 + 1))); - if (iVar3 == 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_54))))->msvc::string::string_from_cstr(pbVar8); - local_14 = GHIDRA_CAST(0x0); - FUN_0060c790(directionName); - local_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),2)); - if (0xf < local_40) { - uVar7 = local_40 + 1; - freeBlock = local_54[0]; - if (0xfff < uVar7) { - freeBlock = *(void **)(GHIDRA_INT(local_54[0]) + -4); - uVar7 = local_40 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_54[0]) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar7); - } - pppppppbVar9 = joinedAnimName[0]; - local_44 = 0; - local_40 = 0xf; - local_54[0] = (void *)(GHIDRA_UINT(local_54[0]) & 0xffffff00); - uVar14 = _string_holder_c_str(); - do { - pbVar5 = GHIDRA_CAST(((uint64_t)uVar14 >> 0x20)); - pbVar8 = GHIDRA_CAST(uVar14); - bVar2 = *pbVar5; - bVar10 = bVar2 < *pbVar8; - if (bVar2 != *pbVar8) { -LAB_0060b567: - uVar7 = -GHIDRA_UINT(bVar10) | 1; - goto LAB_0060b56c; - } - if (bVar2 == 0) break; - bVar2 = pbVar5[1]; - bVar10 = bVar2 < pbVar8[1]; - if (bVar2 != pbVar8[1]) goto LAB_0060b567; - uVar14 = CONCAT44(pbVar5 + 2,pbVar8 + 2); - } while (bVar2 != 0); - uVar7 = 0; -LAB_0060b56c: - if (uVar7 != 0) { - pppppppbVar4 = GHIDRA_CAST(joinedAnimName); - if (0xf < local_28) { - pppppppbVar4 = pppppppbVar9; - } - ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(pppppppbVar4),0); - pppppppbVar9 = joinedAnimName[0]; - } - local_14 = GHIDRA_CAST(0xffffffff); - if (0xf < local_28) { - uVar7 = local_28 + 1; - pppppppbVar4 = pppppppbVar9; - if (0xfff < uVar7) { - pppppppbVar4 = GHIDRA_CAST(pppppppbVar9[-1]); - uVar7 = local_28 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(pppppppbVar9) + (-4 - GHIDRA_INT(pppppppbVar4))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppppbVar4,uVar7); - } - goto switchD_0060b3c2_default; - } - } - (GHIDRA_CAST((GHIDRA_CAST(local_84))))->msvc::string::string_from_cstr(pbVar8); - local_14 = GHIDRA_CAST(0x3); - fullAnimName = GHIDRA_CAST(FUN_0060c790(directionName)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 4; - if (0xf < *GHIDRA_CAST((fullAnimName + 0x14))) { - fullAnimName = *GHIDRA_CAST(fullAnimName); - } - pbVar8 = (this->_sprite)._animState._animData; - if (pbVar8 == GHIDRA_CAST(0x0)) { -LAB_0060b64b: - bVar2 = ANM2::SetAnimation(&this->_sprite,fullAnimName,1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - pbVar5 = pbVar8; - pbVar6 = fullAnimName; - if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar8); - } - do { - bVar2 = *pbVar5; - bVar10 = bVar2 < *pbVar6; - if (bVar2 != *pbVar6) { -LAB_0060b632: - uVar7 = -GHIDRA_UINT(bVar10) | 1; - goto LAB_0060b637; - } - if (bVar2 == 0) break; - bVar2 = pbVar5[1]; - bVar10 = bVar2 < pbVar6[1]; - if (bVar2 != pbVar6[1]) goto LAB_0060b632; - pbVar5 = pbVar5 + 2; - pbVar6 = pbVar6 + 2; - } while (bVar2 != 0); - uVar7 = 0; -LAB_0060b637: - if ((uVar7 != 0) || ((pbVar8[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_0060b64b; - } - local_14 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),3)); - if (0xf < local_58) { - uVar7 = local_58 + 1; - freeBlock = local_6c; - if (0xfff < uVar7) { - freeBlock = *(void **)(GHIDRA_CAST(local_6c) + -4); - uVar7 = local_58 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_6c) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0060b6dc; - } - operator_delete(freeBlock,uVar7); - } - local_14 = GHIDRA_CAST(0xffffffff); - local_5c = 0; - local_58 = 0xf; - local_6c = (void *)(GHIDRA_UINT(local_6c) & 0xffffff00); - if (0xf < local_70) { - uVar7 = local_70 + 1; - freeBlock = local_84[0]; - if (0xfff < uVar7) { - freeBlock = *(void **)(GHIDRA_INT(local_84[0]) + -4); - uVar7 = local_70 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_84[0]) + (-4 - GHIDRA_INT(freeBlock))))) { -LAB_0060b6dc: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar7); - } - local_74 = 0; - local_70 = 0xf; - local_84[0] = (void *)(GHIDRA_UINT(local_84[0]) & 0xffffff00); -switchD_0060b3c2_default: - iVar3 = this->_state; - if (iVar3 == 1) { - if (((this->_sprite)._animState._animData != (void *)0x0) && - (bVar2 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("Shoot")), - bVar2 != 0)) { - this->_state = 2; - } - } - else if (iVar3 == 2) { - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - this->_state = 3; - } - } - else if ((iVar3 == 4) && - (((this->_sprite)._animState._animData == (void *)0x0 || - ((this->_sprite)._animState._isPlaying == 0)))) { - this->_state = 0; - } - ExceptionList = local_1c; - return; -} - -// 0060b7a0 -Entity_Effect * Entity_Effect::CreateLootPreview(void *lootlist, Vector *pos, Entity *owner, Entity_Effect *effect) -{ - uint32_t seed; - Entity_Effect *result; - uint32_t *local_c [2]; - float effectX; - float effectY; - float ownerX; - float ownerY; - uint32_t *parentRef; - - local_c[0] = lootlist; - if (((effect == GHIDRA_CAST(0x0)) || (effect->_type != 1000)) || (effect->_variant != 0xbf)) { - seed = Random(); - effect = (Entity_Effect *) - Game::SpawnEx(g_game,1000,0xbf,pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - } - (effect->_pos).x = pos->x; - (effect->_pos).y = pos->y; - setup_loot_preview(effect,lootlist); - if (owner != GHIDRA_CAST(0x0)) { - parentRef = &effect->_parent; - if (effect->_parent != 0) { - local_c[0] = parentRef; - msvc::multiset::erase(local_c); - } - *parentRef = owner; - msvc::multiset::insert(parentRef); - effectX = (effect->_pos).x; - effectY = (effect->_pos).y; - ownerX = (owner->_pos).x; - ownerY = (owner->_pos).y; - effect->_isFollowing = 1; - (effect->_parentOffset).x = effectX - ownerX; - (effect->_parentOffset).y = effectY - ownerY; - } - result = GHIDRA_CAST(0x0); - if (effect->_exists != 0) { - result = effect; - } - return result; -} - -// 0060bae0 -void Entity_Effect::setup_loot_preview(void *lootQueue) -{ - code *pcVar1; - uint64_t uVar2; - uint8_t isPicked; - EntityConfig_Entity *entityConfig; - LayerState *layer; - uint8_t *pbVar3; - uint32_t uVar4; - uint32_t preventedCurses; - ItemConfig_Item *item; - uint32_t uVar5; - std_string *stringPtr; - uint8_t unk; - uint8_t *ptr; - uint32_t *puVar6; - uint32_t *puVar7; - int iVar8; - int iVar9; - ANM2 *pAVar10; - uint32_t uVar11; - uint32_t uVar12; - ColorMod ghostColor; - uint8_t insertedIt [4]; - ANM2 *lootIt [2]; - uint32_t local_8c; - ANM2 *lootType; - uint32_t lootVariant; - uint64_t uStack_80; - uint32_t *local_78; - ANM2 *lootMap; - uint32_t lootMapSize; - int ghostData; - uint8_t *local_68; - uint32_t local_64; - ANM2 *local_60; - uint8_t *local_5c; - uint32_t *local_58; - std_string itemGfxPath; - uint8_t local_3c [8]; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t *local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - void *configTable; - Manager *manager; - ANM2 *sprite; - - puStack_20 = local_3c + 0x38; - local_14 = 0xffffffff; - puStack_18 = &LAB_00af6655; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_3c + 0x2c)); - ExceptionList = &local_1c; - ghostData = __RTDynamicCast(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4b4)))),0, - &IsaacRepentancePlus::Entity_Effect::ExtraData::RTTI_Type_Descriptor, - &IsaacRepentancePlus::PickupGhostData::RTTI_Type_Descriptor,0,local_24 - ); - if (ghostData == 0) { - this->Remove(); - } - else { - pAVar10 = GHIDRA_CAST((ghostData + 4)); - iVar8 = 4; - do { - if (pAVar10->_loaded != 0) { - ANM2::Reset(pAVar10); - } - iVar9 = ghostData; - pAVar10 = pAVar10 + 1; - iVar8 = iVar8 + -1; - } while (iVar8 != 0); - *GHIDRA_CAST((ghostData + 0x454)) = 0; - lootMap = GHIDRA_CAST(0x0); - lootMapSize = 0; - lootMap = operator_new(0x28); - *GHIDRA_CAST((lootMap->_filename)._buf) = lootMap; - *GHIDRA_CAST(((lootMap->_filename)._buf + 4)) = lootMap; - *GHIDRA_CAST(((lootMap->_filename)._buf + 8)) = lootMap; - (lootMap->_filename)._buf[0xc] = '\x01'; - (lootMap->_filename)._buf[0xd] = '\x01'; - local_14 = 0; - local_64 = 0; - if (*GHIDRA_CAST((GHIDRA_CAST(lootQueue) + 0x10)) != 0) { - do { - local_8c = *GHIDRA_CAST((GHIDRA_CAST(lootQueue) + 0xc)) + local_64; - puVar6 = *(uint32_t **) - (*GHIDRA_CAST((GHIDRA_CAST(lootQueue) + 4)) + (*GHIDRA_CAST((GHIDRA_CAST(lootQueue) + 8)) - 1U & local_8c) * 4 - ); - lootType = GHIDRA_CAST(*puVar6); - lootVariant = puVar6[1]; - uStack_80 = *GHIDRA_CAST((puVar6 + 2)); - local_78 = GHIDRA_CAST(puVar6[4]); - uVar5 = puVar6[2]; - uVar12 = puVar6[3]; - local_60 = lootType; - local_58 = local_78; - if (lootType == GHIDRA_CAST(&DAT_00000005)) { - isPicked = Pickup_PickVariant(puVar6[3],&lootVariant,GHIDRA_CAST(&uStack_80),0,0); - if (isPicked != 0) { - local_58 = local_78; - local_60 = lootType; - uVar5 = GHIDRA_UINT(uStack_80); - uVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x4))); - goto LAB_0060bc31; - } - } - else { -LAB_0060bc31: - uVar4 = lootVariant; - if (g_game->_challenge == 0x2b) { - if (lootVariant != 300) goto LAB_0060bcab; - uStack_80 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x4))),0x10); - uVar2 = uStack_80; - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x0))) = 0x10; - preventedCurses = 0x10; - uVar5 = GHIDRA_UINT(uStack_80); - uVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x4))); - uStack_80 = uVar2; - } - else if (lootVariant == 300) { - if (((GHIDRA_INT(GHIDRA_UINT(uStack_80)) < 0) || - (configTable = (g_manager->_itemConfig)._cards._begin, - GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT(configTable) >> 2 <= - GHIDRA_INT(GHIDRA_UINT(uStack_80)))) || - (iVar8 = *GHIDRA_CAST((GHIDRA_CAST(configTable) + GHIDRA_UINT(uStack_80) * 4)), iVar8 == 0)) { - preventedCurses = 2; - uStack_80 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x4))),2); - uVar2 = uStack_80; - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x0))) = 2; - uVar5 = GHIDRA_UINT(uStack_80); - uVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x4))); - uStack_80 = uVar2; - } - else { - preventedCurses = *GHIDRA_CAST((iVar8 + 0x54)); - uStack_80 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x4))),preventedCurses); - uVar5 = preventedCurses; - uVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_80)) + 0x4))); - } - } - else { -LAB_0060bcab: - preventedCurses = GHIDRA_UINT(uStack_80); - } - pAVar10 = local_60; - uVar11 = lootVariant; - lootType = local_60; - local_78 = local_58; - entityConfig = EntityConfig::GetEntity - (&g_manager->_entityConfig,GHIDRA_INT(local_60),lootVariant, - preventedCurses); - if (entityConfig != GHIDRA_CAST(0x0)) { - if (local_60 == GHIDRA_CAST(&DAT_00000005)) { - if (uVar4 < 0x29) { - if (uVar4 == 0x28) { - if (((preventedCurses == 4) || (preventedCurses == 6)) || (preventedCurses == 7)) - { -LAB_0060bd04: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0x1f4); - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0xa); - } - } - else if (uVar4 == 10) { - if (((preventedCurses == 4) || (preventedCurses == 7)) || (preventedCurses == 0xb) - ) goto LAB_0060bd04; - if ((((preventedCurses == 6) || (preventedCurses == 10)) || (preventedCurses == 3) - ) || (preventedCurses == 8)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0xc8); - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0xa); - } - } - else if (uVar4 == 0x14) { - if ((preventedCurses == 3) || (preventedCurses == 5)) goto LAB_0060bd04; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0xa); - if (preventedCurses == 2) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0xc8); - } - } - else { - if (uVar4 != 0x1e) goto LAB_0060bd7e; - if ((preventedCurses == 2) || (preventedCurses == 4)) goto LAB_0060bd04; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0xa); - } - } - else if (uVar4 == 100) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0x2710); - } - else if (uVar4 == 0x15e) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0x3e8); - } - else { -LAB_0060bd7e: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0x32); - } - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = GHIDRA_CAST(0x0); - } - local_28 = local_58; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x4))) = pAVar10; - uStack_34 = uVar11; - uStack_30 = uVar5; - uStack_2c = uVar12; - msvc::multimap::emplace(insertedIt,local_3c); - } - } - local_64 = local_64 + 1; - } while (local_64 < *GHIDRA_CAST((GHIDRA_CAST(lootQueue) + 0x10))); - iVar9 = ghostData; - } - pAVar10 = lootMap; - lootIt[0] = lootMap; - if (lootMap != *GHIDRA_CAST((lootMap->_filename)._buf)) { - while (iVar8 = *GHIDRA_CAST((iVar9 + 0x454)), iVar8 < 4) { - local_60 = lootIt[0]; - (GHIDRA_CAST((&local_60)))->msvc::_Tree_iterator::operator_decrement(); - local_68 = GHIDRA_CAST((local_60->_filename)._capacity); - local_64 = *GHIDRA_CAST((local_60->_animDefaultName)._buf); - local_58 = *GHIDRA_CAST(((local_60->_animDefaultName)._buf + 4)); - pbVar3 = *GHIDRA_CAST(((local_60->_animDefaultName)._buf + 8)); - entityConfig = EntityConfig::GetEntity - (&g_manager->_entityConfig,GHIDRA_INT(local_68),local_64,GHIDRA_INT(local_58)); - if (entityConfig != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((ghostData + 0x454)) = *GHIDRA_CAST((ghostData + 0x454)) + 1; - pAVar10 = GHIDRA_CAST((ghostData + 4 + iVar8 * 0x114)); - local_60 = pAVar10; - ANM2::Load(pAVar10,&entityConfig->anm2Path,0); - layer = ANM2::GetLayer(pAVar10,GHIDRA_CAST(0x0)); - (layer->_pos).x = 0.0; - (layer->_pos).y = -4.0; - if (local_68 == &DAT_00000005) { - if (local_64 == 0x15e) { - configTable = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT((GHIDRA_UINT(local_58) & 0x7fff)) < - GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(configTable) >> 2) { - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(configTable) + (GHIDRA_UINT(local_58) & 0x7fff) * 4)); - } - else { - iVar8 = 0; - } - local_64 = *GHIDRA_CAST((iVar8 + 0x48)); - local_58 = GHIDRA_CAST((iVar8 + 0x38)); - if (0xf < *GHIDRA_CAST((iVar8 + 0x4c))) { - local_58 = GHIDRA_CAST(*local_58); - } - if (local_64 < 0x10) { - local_5c = GHIDRA_CAST(*local_58); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x4))) = local_58[1]; - uStack_34 = local_58[2]; - uStack_30 = local_58[3]; - puVar6 = GHIDRA_CAST(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = local_5c; - } - else { - puVar6 = GHIDRA_CAST((local_64 | 0xf)); - if (GHIDRA_CAST(0x7fffffff) < puVar6) { - puVar6 = GHIDRA_CAST(0x7fffffff); - } - local_5c = msvc::_Allocate(GHIDRA_UINT((GHIDRA_INT(puVar6) + 1))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = local_5c; - memcpy(local_5c,local_58,local_64 + 1); - } - sprite = local_60; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - uStack_2c = local_64; - local_28 = puVar6; - if (0 < pAVar10->_layerCount) { - local_58 = pAVar10->_layerState; - local_8c = local_58[6]; - local_68 = GHIDRA_CAST((local_58 + 2)); - if (0xf < GHIDRA_UINT(local_58[7])) { - local_68 = *GHIDRA_CAST(local_68); - } - pbVar3 = local_3c; - if (&DAT_0000000f < puVar6) { - pbVar3 = local_5c; - } - isPicked = str_eq(pbVar3,local_64,local_68,local_8c); - pAVar10 = sprite; - if (isPicked == 0) { - if (local_58 + 2 == GHIDRA_CAST(local_3c)) { - puVar7 = local_58; - } - else { - pbVar3 = local_3c; - if (&DAT_0000000f < puVar6) { - pbVar3 = local_5c; - } - (GHIDRA_CAST((GHIDRA_CAST((local_58 + 2)))))->msvc::string::assign(pbVar3,local_64); - local_5c = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_3c))) + 0x0))); - puVar7 = sprite->_layerState; - puVar6 = local_28; - } - *GHIDRA_CAST((puVar7 + 0xc)) = 0; - } - } - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < puVar6) { - puVar7 = GHIDRA_CAST((GHIDRA_INT(puVar6) + 1)); - ptr = local_5c; - if (GHIDRA_CAST(0xfff) < puVar7) { - ptr = *GHIDRA_CAST((local_5c + -4)); - puVar7 = puVar6 + 9; - if (GHIDRA_CAST(0x1f) < local_5c + (-4 - GHIDRA_INT(ptr))) goto LAB_0060c2e6; - } -LAB_0060c216: - operator_delete(ptr,GHIDRA_UINT(puVar7)); - } - } - else if (local_64 == 100) { - layer = ANM2::GetLayer(pAVar10,GHIDRA_CAST(0x1)); - (layer->_pos).x = 0.0; - (layer->_pos).y = 4.0; - if (local_58 != GHIDRA_CAST(0x0)) { - uVar5 = g_game->_debugCurses; - uVar12 = g_game->_curses; - uVar4 = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - if ((~preventedCurses & (uVar4 | uVar5 | uVar12) & 0x40) == 0) { - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,GHIDRA_INT(local_58)); - (GHIDRA_CAST((itemGfxPath._buf)))->msvc::string::string(&item->gfxFilename); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 3; - if (g_game->_challenge == 0x20) { - uStack_80 = 0x150000000b; - local_8c = 0xd; - local_68 = GHIDRA_CAST(0x0); - while( true ) { - manager = g_manager; - if (pbVar3 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar5 = GHIDRA_UINT(pbVar3) >> ((uint8_t)uStack_80 & 0x1f) ^ GHIDRA_UINT(pbVar3); - uVar5 = uVar5 << ((uint8_t)((uint64_t)uStack_80 >> 0x20) & 0x1f) ^ uVar5; - local_5c = GHIDRA_CAST((uVar5 >> ((uint8_t)local_8c & 0x1f) ^ uVar5)); - iVar8 = GHIDRA_UINT(local_5c) % 0x2dc + 1; - if ((((iVar8 != 0) && - (iVar8 < GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2)) && - (iVar8 != 0xeb)) && - (((iVar8 != 0x2b && (iVar8 != 0x3d)) && - (item = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar8), - item != GHIDRA_CAST(0x0))))) break; - local_68 = local_68 + 1; - if (0xe < GHIDRA_INT(local_68)) goto LAB_0060c1d7; - pbVar3 = local_5c; - } - item = ItemConfig::GetCollectible(&manager->_itemConfig,iVar8); - stringPtr = &item->gfxFilename; - if (&itemGfxPath != stringPtr) { - if (0xf < (item->gfxFilename)._capacity) { - stringPtr = *GHIDRA_CAST(stringPtr->_buf); - } - (GHIDRA_CAST((itemGfxPath._buf)))->msvc::string::assign(GHIDRA_CAST(stringPtr), - (item->gfxFilename)._size); - } - } -LAB_0060c1d7: - pAVar10 = local_60; - (GHIDRA_CAST((GHIDRA_CAST(local_60))))->Sprite::ReplaceSpritesheet(1,&itemGfxPath); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < itemGfxPath._capacity) { - pbVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(itemGfxPath._buf))) + 0x0))); - puVar6 = GHIDRA_CAST(itemGfxPath._capacity); - goto LAB_0060c1f6; - } - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) = msvc::_Allocate(0x30); - pAVar10 = local_60; - uStack_2c = 0x27; - local_28 = GHIDRA_CAST(&DAT_0000002f); - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0)) = 'g'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 1)) = 'f'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 2)) = 'x'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 3)) = '/'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 4)) = 'I'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 5)) = 't'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 6)) = 'e'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 7)) = 'm'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 8)) = 's'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 9)) = '/'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 10)) = 'C'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0xb)) = 'o'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0xc)) = 'l'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0xd)) = 'l'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0xe)) = 'e'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0xf)) = 'c'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x10)) = 't'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x11)) = 'i'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x12)) = 'b'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x13)) = 'l'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x14)) = 'e'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x15)) = 's'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x16)) = '/'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x17)) = 'q'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x18)) = 'u'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x19)) = 'e'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x1a)) = 's'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x1b)) = 't'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x1c)) = 'i'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x1d)) = 'o'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x1e)) = 'n'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x1f)) = 'm'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x20)) = 'a'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x21)) = 'r'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x22)) = 'k'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x23)) = '.'; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x24)) = 0x70; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x25)) = 0x6e; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x26)) = 0x67; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c)) + 0x0))) + 0x27)) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - (GHIDRA_CAST((GHIDRA_CAST(local_60))))->Sprite::ReplaceSpritesheet(1,GHIDRA_CAST(local_3c)); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < local_28) { - pbVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_3c))) + 0x0))); - puVar6 = local_28; -LAB_0060c1f6: - puVar7 = GHIDRA_CAST((GHIDRA_INT(puVar6) + 1)); - ptr = pbVar3; - if (GHIDRA_CAST(0xfff) < puVar7) { - ptr = *GHIDRA_CAST((pbVar3 + -4)); - puVar7 = puVar6 + 9; - if (GHIDRA_CAST(0x1f) < pbVar3 + (-4 - GHIDRA_INT(ptr))) { -LAB_0060c2e6: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - goto LAB_0060c216; - } - } - } - } - } - layer = ANM2::GetLayer(pAVar10,GHIDRA_CAST("shadow")); - if (layer != GHIDRA_CAST(0x0)) { - layer->_visible = 0; - } - ANM2::LoadGraphics(pAVar10,unk); - stringPtr = &pAVar10->_animDefaultName; - if (0xf < (pAVar10->_animDefaultName)._capacity) { - stringPtr = *GHIDRA_CAST(stringPtr->_buf); - } - isPicked = ANM2::SetAnimation(pAVar10,GHIDRA_CAST(stringPtr),1); - if (((isPicked != 0) && ((pAVar10->_animState)._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&pAVar10->_animState,0.0), - (pAVar10->_animState)._animData != (void *)0x0)) { - (pAVar10->_animState)._isPlaying = 0; - } - ghostColor._offset[0] = 0.0; - ghostColor._offset[1] = 0.0; - ghostColor._offset[2] = 0.0; - if (&pAVar10->_color != &ghostColor) { - (pAVar10->_color)._colorize[0] = 0.0; - (pAVar10->_color)._colorize[1] = 0.0; - (pAVar10->_color)._colorize[2] = 0.0; - (pAVar10->_color)._colorize[3] = 0.0; - (pAVar10->_color)._offset[0] = 0.0; - (pAVar10->_color)._offset[1] = 0.0; - (pAVar10->_color)._tint[0] = 1.0; - (pAVar10->_color)._tint[1] = 1.0; - (pAVar10->_color)._tint[2] = 1.0; - (pAVar10->_color)._tint[3] = 0.75; - (pAVar10->_color)._offset[2] = 0.0; - } - pAVar10 = lootMap; - } - (GHIDRA_CAST((lootIt)))->msvc::_Tree_iterator::operator_decrement(); - if (lootIt[0] == *GHIDRA_CAST((pAVar10->_filename)._buf)) break; - iVar9 = ghostData; - } - } - if (*GHIDRA_CAST((ghostData + 0x454)) == 0) { - this->Remove(); - pAVar10 = lootMap; - } - FID_conflict__Erase_tree_>_> - (&lootMap,(fuzzer_allocator_> *)&lootMap, - *(_Tree_node **)((pAVar10->_filename)._buf + 4)); - operator_delete(lootMap,0x28); - } - ExceptionList = local_1c; - return; -} - -// 0060c370 -void Entity_Effect::guard_check_icall() -{ - uint8_t bVar1; - uint8_t *animNameCursor; - uint32_t cmpResult; - uint8_t *idleCursor; - bool isLess; - uint8_t *animData; - - if (this->_variant == 0xb9) { - this->_state = 0; - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - animNameCursor = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - animNameCursor = *GHIDRA_CAST(animData); - } - idleCursor = s_Idle; - do { - bVar1 = *animNameCursor; - isLess = bVar1 < *idleCursor; - if (bVar1 != *idleCursor) { -LAB_0060c3c0: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_0060c3c5; - } - if (bVar1 == 0) break; - bVar1 = animNameCursor[1]; - isLess = bVar1 < idleCursor[1]; - if (bVar1 != idleCursor[1]) goto LAB_0060c3c0; - animNameCursor = animNameCursor + 2; - idleCursor = idleCursor + 2; - } while (bVar1 != 0); - cmpResult = 0; -LAB_0060c3c5: - if (cmpResult == 0) { - if (animData[0x34] == 0) { - return; - } - if ((this->_sprite)._animState._isPlaying != 0) { - return; - } - } - } - bVar1 = ANM2::SetAnimation(&this->_sprite,s_Idle,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else if (this->_variant == 0x77) { - /* WARNING: Could not recover jumptable at 0x0060c3fb. Too many branches */ - /* WARNING: Treating indirect jump as call */ - this->Remove(); - return; - } - return; -} - -// 0060c400 -uint8_t Entity_Effect::CanShutDoors() -{ - return this->_variant == 0xcb; -} - -// 0060ce20 -void Entity_Effect::SetDamageSource(int param_2) -{ - this->_damageSource = param_2; - return; -} diff --git a/generated-src/entity_effect/extra_data_ref.cpp b/generated-src/entity_effect/extra_data_ref.cpp deleted file mode 100644 index ec5dd82..0000000 --- a/generated-src/entity_effect/extra_data_ref.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "classes.h" - -// 0060c620 -void Entity_Effect::ExtraDataRef::Set(void *extraData) -{ - void *refCount = this; - char isLastRef; - uint32_t uVar1; - ReferenceCountBase *refCount; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6694; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - refCount = operator_new(0x18); - local_8 = 0; - if (refCount == GHIDRA_CAST(0x0)) { - refCount = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((refCount)))->ReferenceCountBase::ReferenceCountBase(); - *GHIDRA_CAST(refCount) = - ReferenceCount::vftable; - *(void **)(refCount + 0x14) = extraData; - } - local_8 = 0xffffffff; - if (*GHIDRA_CAST((GHIDRA_CAST(refCount) + 4)) != GHIDRA_CAST(0x0)) { - isLastRef = (**(code **)(**GHIDRA_CAST((GHIDRA_CAST(refCount) + 4)) + 0xc))(uVar1); - if ((isLastRef != '\0') && (DAT_00c7e854 != (code *)0x0)) { - (*DAT_00c7e854)(refCount); - } - } - *GHIDRA_CAST((GHIDRA_CAST(refCount) + 4)) = refCount; - *(void **)refCount = extraData; - ExceptionList = local_10; - return; -} diff --git a/generated-src/entity_familiar.cpp b/generated-src/entity_familiar.cpp deleted file mode 100644 index 3c342d7..0000000 --- a/generated-src/entity_familiar.cpp +++ /dev/null @@ -1,27251 +0,0 @@ -#include "classes.h" - -// 00431be0 -void Entity_Familiar::ai_umbilical_baby(uint8_t isInterpolated) -{ - Entity_Familiar *sprite = this; - uint8_t *animName; - uint32_t *puVar1; - uint8_t bVar2; - char isDamaged; - uint32_t *puVar3; - uint32_t *listHead; - Entity *bloodEffect; - Weapon *newWeapon; - float *extraout_EAX; - Vector *pVVar4; - LayerState *layer; - LayerState *copyLayer; - float *pfVar5; - float **ppfVar6; - void *pvVar7; - Capsule *capsule; - int *piVar8; - BitSet128 *maskedFlags; - float *ropePointCount; - int cordSegment; - Entity *unused; - uint32_t uVar9; - uint32_t uVar10; - std_vector *psVar11; - Entity_Projectile *pEVar12; - float fVar13; - Entity_Familiar *baby; - float fVar14; - float fVar15; - uint8_t auVar16 [12]; - float fVar17; - float fVar18; - double dVar19; - undefined3 in_stack_00000005; - Capsule gridCapsule [13]; - Vector bombPush; - Vector bombOffset; - EntityRef local_20c; - Vector tearPushDir; - Vector reflectDir; - Vector bombPushDir; - EntityList_EL capsuleHits; - float ropeForce; - Vector projectileOffset; - Vector pickupPos; - Vector tearPos; - Vector projectilePos; - Vector bombPos; - float babyPosX; - Vector aimDirection; - uint8_t local_184 [8]; - uint32_t local_17c; - uint8_t local_178 [8]; - uint32_t local_170; - float midVelX; - Vector local_168; - float midPosX; - Vector local_15c; - Vector local_154; - float local_14c; - Vector local_148; - uint8_t shieldedMask [4]; - uint8_t local_13c [8]; - float local_134; - Vector local_12c; - Vector local_124; - Vector local_11c; - float *local_114; - float tearFlags0; - float tearFlags1; - Vector VStack_108; - float *local_fc; - Vector *local_f8; - Vector local_f4; - uint32_t *local_ec; - Entity_Familiar *local_e8; - int *local_e4; - std_vector *local_e0; - float local_dc; - Vector *local_d8; - Vector *local_d4; - float local_d0; - float *local_cc; - ANM2 *local_c8; - Vector *local_c4; - Entity_Projectile *local_c0; - uint8_t local_b9; - TearParams tearHitParams; - Capsule cordCapsule [5]; - std_string anm2Path; - uint32_t stackCookie; - uint8_t *puStack_20; - void *savedExceptionList; - uint8_t *puStack_18; - int ehState; - Manager *manager; - Entity_Player *player; - float *prevPoint; - ANM2 *sprite; - code *vfn; - - puStack_20 = &(*GHIDRA_CAST((GHIDRA_CAST(&(cordCapsule[0x19])) + 0x1))); - ehState = -1; - puStack_18 = &LAB_00af2166; - savedExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT(&(*GHIDRA_CAST((GHIDRA_CAST(&(cordCapsule[0x15])) + 0x1)))); - if (*GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x173)) != '\0') { - return; - } - ExceptionList = &savedExceptionList; - local_e8 = sprite; - puVar3 = (uint32_t *) - __RTDynamicCast(sprite->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, - &IsaacRepentancePlus::UmbilicalBabyData::RTTI_Type_Descriptor,0, - stackCookie); - local_ec = puVar3; - if (puVar3 == GHIDRA_CAST(0x0)) { - puVar3 = operator_new(0x158); - local_12c.y = (float)puVar3; - if (puVar3 == GHIDRA_CAST(0x0)) { - puVar3 = GHIDRA_CAST(0x0); - local_ec = GHIDRA_CAST(0x0); - } - else { - ehState = 1; - puVar1 = puVar3 + 1; - *puVar3 = IsaacRepentancePlus::UmbilicalBabyData::vftable; - *puVar1 = 0; - puVar3[2] = 0; - puVar3[3] = 0; - puVar3[4] = 0; - puVar3[5] = 0; - local_ec = puVar3; - listHead = operator_new(8); - listHead[1] = 0; - *puVar1 = listHead; - *listHead = puVar1; - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),2); - ANM2::constructor(GHIDRA_CAST((puVar3 + 6))); - puVar3[0x4c] = 0; - puVar3[0x4d] = 0; - puVar3[0x4e] = 0; - puVar3[0x4f] = 0; - puVar3[0x53] = 0; - puVar3[0x52] = 0; - sprite = local_e8; - } - ehState = -1; - set_extra_data(&sprite->_extraData,puVar3); - (GHIDRA_CAST((anm2Path._buf)))->msvc::string::string(&sprite->_sprite); - ehState = 3; - ANM2::Load(GHIDRA_CAST((puVar3 + 6)),&anm2Path,1); - ehState = -1; - if (0xf < anm2Path._capacity) { - uVar9 = anm2Path._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)anm2Path._buf)) + 0x0))); - if (0xfff < uVar9) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + -4); - uVar9 = anm2Path._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar7))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar7,uVar9); - } - bVar2 = ANM2::SetAnimation(GHIDRA_CAST((puVar3 + 6)),&DAT_00b1d20c,1); - if (((bVar2 != 0) && (puVar3[0x13] != 0)) && - (AnimationState::SetFrameFloat(GHIDRA_CAST((puVar3 + 0x12)),0.0), puVar3[0x13] != 0)) { - *GHIDRA_CAST((puVar3 + 0x17)) = 0; - } - Entity_Player::GetTearHitParams(sprite->_player,&tearHitParams,10,1.0,1,GHIDRA_CAST(sprite->_player)); - sprite->_collisionDamage = tearHitParams._tearDamage; - *GHIDRA_CAST((puVar3 + 0x50)) = 0; - puVar3[0x4c] = (uint32_t)tearHitParams._flags._l; - puVar3[0x4d] = (*GHIDRA_CAST((GHIDRA_CAST(&(tearHitParams._flags._l)) + 0x4))); - puVar3[0x4e] = (uint32_t)tearHitParams._flags._h; - puVar3[0x4f] = (*GHIDRA_CAST((GHIDRA_CAST(&(tearHitParams._flags._h)) + 0x4))); - msvc::deque<120byte>::resize(); - puVar3[0x51] = 0x40a00000; - puVar3[0x52] = g_vectorZero.x; - puVar3[0x53] = g_vectorZero.y; - } - if (sprite->_updateTime <= 3.0 && sprite->_updateTime != 3.0) { -LAB_00434e1f: - sprite->_visible = 0; - fVar14 = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)); - (sprite->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c)); - (sprite->_pos).y = fVar14; - ExceptionList = savedExceptionList; - return; - } - if (sprite->_visible == 0) { - if (isInterpolated != 0) goto LAB_00434e1f; - uVar9 = Random(); - local_154.x = (sprite->_targetPosition).x * 6.0; - local_154.y = (sprite->_targetPosition).y * 6.0; - bloodEffect = Game::Spawn(g_game,1000,2,&sprite->_pos,&local_154,GHIDRA_CAST(0x0),2,uVar9); - cordSegment = *GHIDRA_CAST(bloodEffect); - (bloodEffect->_posOffset).x = 0.0; - (bloodEffect->_posOffset).y = -15.0; - (**(code **)(cordSegment + 0xc))(); - sprite->_visible = 1; - local_dc = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x13e0)); -LAB_00431f23: - pvVar7 = sprite->_weapon; - if (local_dc == 0.0) { - if (pvVar7 != (void *)0x0) { - Isaac::DestoryWeapon(&sprite->_weapon); - } - } - else if ((pvVar7 == (void *)0x0) || - (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x30)) != *GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x30)))) { - Isaac::DestoryWeapon(&sprite->_weapon); - newWeapon = Isaac::CreateWeapon(*GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x30)),GHIDRA_CAST(sprite)); - sprite->_weapon = newWeapon; - } - } - else { - sprite->_visible = 1; - local_dc = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x13e0)); - if (isInterpolated == 0) goto LAB_00431f23; - } - player = sprite->_player; - local_f8 = GHIDRA_CAST(player->_fireDirection); - aimDirection.x = (player->_aimDirection).x; - aimDirection.y = (player->_aimDirection).y; - local_cc = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_cc)) + 0x1))),local_f8 != GHIDRA_CAST(0xffffffff))); - local_d0 = (player->_pos).x; - local_d8 = GHIDRA_CAST((player->_pos).y); - local_e0 = GHIDRA_CAST(aimDirection.x); - local_d4 = local_f8; - VStack_108.y = aimDirection.y; - (GHIDRA_CAST((player)))->Entity_Player::GetBodyMoveDirection(&local_f4); - local_d0 = local_d0 + *extraout_EAX * 6.0; - local_d8 = GHIDRA_CAST(((float)local_d8 + extraout_EAX[1] + extraout_EAX[1])); - bVar2 = CanPlayerFire(sprite); - if ((bVar2 != 0) && (sprite->_state != 2)) { - local_c0 = GHIDRA_CAST(0x0); - local_12c.y = 0.0; - local_c8 = GHIDRA_CAST(0x0); - local_12c.x = 0.0; - PickEnemyTarget(sprite,800.0,-GHIDRA_UINT((sprite->_target != 0)) & 8,0x13,&g_vectorZero,15.0); - if ((local_dc != 0.0) && (sprite->_weapon != (void *)0x0)) { - TryAimAtMarkedTarget(sprite,&aimDirection,GHIDRA_CAST(&local_d4),&local_12c); - local_c8 = GHIDRA_CAST(local_12c.x); - local_c0 = GHIDRA_CAST(local_12c.y); - if ((local_12c.x == g_vectorZero.x) && (local_12c.y == g_vectorZero.y)) { - local_c8 = GHIDRA_CAST((sprite->_pos).x); - local_c0 = GHIDRA_CAST((sprite->_pos).y); - } - } - if (sprite->_counter < 1) { - local_c4 = local_d4; - if ((local_d4 == GHIDRA_CAST(0xffffffff)) && - ((sprite->_headFrameDelay < 1 || - (local_c4 = GHIDRA_CAST(sprite->_shootDirection), local_c4 == GHIDRA_CAST(0xffffffff))))) { - local_c4 = GHIDRA_CAST(0x3); - } - if ((sprite->_weapon == GHIDRA_CAST(0x0)) || - (cordSegment = (**(code **)(*GHIDRA_CAST(sprite->_weapon) + 0x24))(), cordSegment == 0)) { - pVVar4 = local_c4; - } - else { - local_11c.x = *GHIDRA_CAST((cordSegment + 0x33c)) - (sprite->_pos).x; - local_11c.y = *GHIDRA_CAST((cordSegment + 0x340)) - (sprite->_pos).y; - pVVar4 = GHIDRA_CAST(vector_to_direction(&local_11c)); - } - sprite->_shootDirection = GHIDRA_INT(pVVar4); - fVar14 = atan2f(aimDirection.y,aimDirection.x); - puVar3[0x54] = fVar14 * 57.295776; - } - if ((local_dc != 0.0) && (pvVar7 = sprite->_weapon, pvVar7 != (void *)0x0)) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x28)) = local_c8; - *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x2c)) = local_c0; - *GHIDRA_CAST((GHIDRA_CAST(sprite->_weapon) + 0x10)) = *GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x10)); - *GHIDRA_CAST((GHIDRA_CAST(sprite->_weapon) + 0x34)) = *GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x34)); - (**(code **)(*GHIDRA_CAST(sprite->_weapon) + 8))(); - (**(code **)(*GHIDRA_CAST(sprite->_weapon) + 0xc))(&aimDirection,local_cc,_isInterpolated); - } - if (sprite->_fireCooldown == 0) { - if (sprite->_headFrameDelay < 9) { - PlayFloatAnim(sprite,sprite->_shootDirection); - } - else { - PlayShootAnim(sprite,sprite->_shootDirection); - } - } - if (isInterpolated == 0) { - if (0 < sprite->_counter) { - sprite->_counter = sprite->_counter + -1; - } - if (0 < sprite->_headFrameDelay) { - sprite->_headFrameDelay = sprite->_headFrameDelay + -1; - } - if (0 < sprite->_fireCooldown) { - sprite->_fireCooldown = sprite->_fireCooldown + -1; - } - } - } - local_cc = GHIDRA_CAST(((float)puVar3[0x55] * 0.017453292)); - local_d4 = GHIDRA_CAST(sin((float)local_cc)); - local_fc = GHIDRA_CAST(cos((float)local_cc)); - fVar14 = atan2f((float)local_d4,(float)local_fc); - fVar14 = fVar14 * 57.295776; - if (360.0 < ABS(fVar14)) { - fVar14 = fmodf(fVar14,360.0); - } - if (fVar14 <= 180.0) { - if (fVar14 < -180.0) { - fVar14 = fVar14 + 360.0; - } - } - else { - fVar14 = fVar14 - 360.0; - } - local_cc = GHIDRA_CAST((fVar14 / 45.0 + 0.5)); - dVar19 = floor((double)(float)local_cc); - local_cc = GHIDRA_CAST((GHIDRA_INT(dVar19) + 8U & 0x80000007)); - if (GHIDRA_INT(local_cc) < 0) { - local_cc = GHIDRA_CAST(((GHIDRA_UINT((GHIDRA_INT(local_cc) + -1)) | 0xfffffff8) + 1)); - } - animName = (&PTR_s_BodySide_00b1d240)[GHIDRA_INT(local_cc)]; - local_c8 = &sprite->_sprite; - (sprite->_sprite)._overlayRenderFirst = local_cc != GHIDRA_CAST(&DAT_00000006); - ANM2::PlayOverlay(local_c8,animName,0); - if (((local_cc == GHIDRA_CAST(0x0)) || (local_cc == GHIDRA_CAST(0x1))) || - (local_cc == GHIDRA_CAST(&DAT_00000007))) { - local_b9 = 1; - } - else { - local_b9 = 0; - } - local_b9 = (sprite->_sprite)._flipX ^ local_b9; - layer = ANM2::GetLayer(&sprite->_sprite,GHIDRA_CAST(0x1)); - layer->_flipX = local_b9; - local_114 = AnimationState::GetNullFrameById(&(sprite->_sprite)._overlayAnimState,0); - if (local_114 != GHIDRA_CAST(0x0)) { - local_cc = GHIDRA_CAST((*local_114 + 0.0 + (float)local_fc * 6.0)); - local_fc = GHIDRA_CAST(((local_114[1] - 8.0) + (float)local_d4 * 6.0)); - layer = ANM2::GetLayer(&sprite->_sprite,GHIDRA_CAST(0x0)); - (layer->_pos).x = (float)local_cc; - (layer->_pos).y = (float)local_fc; - if ((sprite->_sprite)._flipX != 0) { - layer = ANM2::GetLayer(local_c8,GHIDRA_CAST(0x0)); - local_cc = GHIDRA_CAST((GHIDRA_UINT((layer->_pos).x) ^ 0x80000000)); - layer = ANM2::GetLayer(local_c8,GHIDRA_CAST(0x0)); - (layer->_pos).x = (float)local_cc; - } - sprite = local_c8; - layer = ANM2::GetLayer(local_c8,GHIDRA_CAST(0x0)); - local_c0 = GHIDRA_CAST(0x0); - (layer->_size).x = local_114[4]; - (layer->_size).y = local_114[5]; - do { - layer = ANM2::GetLayer(sprite,GHIDRA_CAST(0x0)); - copyLayer = ANM2::GetLayer(sprite,*GHIDRA_CAST((GHIDRA_CAST(local_c0) + 0xb1d238))); - (copyLayer->_pos).x = (layer->_pos).x; - (copyLayer->_pos).y = (layer->_pos).y; - layer = ANM2::GetLayer(sprite,GHIDRA_CAST(0x0)); - copyLayer = ANM2::GetLayer(sprite,*GHIDRA_CAST((GHIDRA_CAST(local_c0) + 0xb1d238))); - (copyLayer->_size).x = (layer->_size).x; - (copyLayer->_size).y = (layer->_size).y; - local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 4)); - } while (local_c0 < &DAT_00000008); - sprite = local_e8; - puVar3 = local_ec; - } - if (sprite->_updateTime <= 10.0) { - local_d4 = &sprite->_targetPosition; - fVar14 = atan2f((sprite->_targetPosition).y,(sprite->_targetPosition).x); - puVar3[0x55] = fVar14 * 57.295776; - if (isInterpolated == 0) { - local_dc = sprite->_speedMultiplier + sprite->_updateTime; - pvVar7 = sprite->_player; - local_c0 = GHIDRA_CAST(((local_dc - 3.0) / 6.0)); - if (1.0 <= (float)local_c0) { - if ((float)local_c0 == 1.0) { - fVar14 = 1.2; - } - else { - VStack_108.y = (float)local_c0 - 1.0; - fVar14 = sin(VStack_108.y * 10.0); - fVar14 = (fVar14 * 0.02) / ((float)local_c0 * (float)local_c0 * VStack_108.y) + 1.0; - } - } - else { - fVar14 = cos((float)local_c0 * 3.1415927); - fVar14 = (1.0 - fVar14) * 0.6; - } - local_cc = GHIDRA_CAST((fVar14 * 180.0 * local_d4->y + *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x340)))); - local_e0 = GHIDRA_CAST((fVar14 * 180.0 * local_d4->x + *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x33c)))); - if (local_d4->x <= 0.0) { - VStack_108.y = 90.0; - } - else { - VStack_108.y = -90.0; - } - VStack_108.y = VStack_108.y * 0.017453292; - local_c8 = GHIDRA_CAST(cos(VStack_108.y)); - fVar14 = sin(VStack_108.y); - VStack_108.y = (float)local_c8 * local_d4->x; - local_c8 = GHIDRA_CAST(((float)local_c8 * local_d4->y + fVar14 * local_d4->x)); - VStack_108.y = VStack_108.y - fVar14 * local_d4->y; - if ((float)local_c0 == 0.0) { - fVar14 = 1.0; - } - else { - local_c0 = GHIDRA_CAST(((float)local_c0 * 10.0)); - fVar14 = sin((float)local_c0); - fVar14 = fVar14 / (float)local_c0; - } - fVar13 = (local_e8->_pos).y; - (local_e8->_velocity).x = - ((float)local_e0 + fVar14 * 20.0 * VStack_108.y) - (local_e8->_pos).x; - (local_e8->_velocity).y = ((float)local_cc + fVar14 * 20.0 * (float)local_c8) - fVar13; - sprite = local_e8; - } - else { - local_dc = sprite->_speedMultiplier * 0.5 + sprite->_updateTime; - } - local_e0 = (std_vector *) - ((sprite->_targetPosition).x * 233.99998 + *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c))); - local_cc = GHIDRA_CAST(((sprite->_targetPosition).y * 233.99998 + - *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)))); - local_c8 = GHIDRA_CAST(&local_11c); - if (isInterpolated == 0) { - local_11c.y = sprite->_speedMultiplier * (sprite->_velocity).y + (sprite->_pos).y; - local_11c.x = sprite->_speedMultiplier * (sprite->_velocity).x + (sprite->_pos).x; - } - else { - local_11c.y = sprite->_speedMultiplier * (sprite->_velocity).y * 0.5 + (sprite->_pos).y; - local_11c.x = sprite->_speedMultiplier * (sprite->_velocity).x * 0.5 + (sprite->_pos).x; - } - uVar10 = 1; - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4]) * 4)); - *ropePointCount = local_d0; - ropePointCount[1] = (float)local_d8; - ropePointCount[2] = -13.0; - uVar9 = puVar3[5]; - if (1 < uVar9) { - do { - dVar19 = (double)GHIDRA_INT(uVar10); - cordSegment = GHIDRA_INT(uVar10) >> 0x1f; - local_f4.y = (float)puVar3[4]; - uVar9 = GHIDRA_INT(local_f4.y) + uVar10; - uVar10 = uVar10 + 1; - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - local_c8 = GHIDRA_CAST(((float)(dVar19 + __uint_to_double_fixup[-cordSegment]) / - (float)((double)(puVar3[5] + -1) + - __uint_to_double_fixup[-(puVar3[5] + -1 >> 0x1f)]))); - fVar14 = 1.0 - (float)local_c8; - VStack_108.y = (fVar14 * -13.0 + (float)local_c8 * -15.0) * fVar14; - *ropePointCount = - (local_11c.x * (float)local_c8 + local_d0 * fVar14) * (float)local_c8 + - ((float)local_e0 * (float)local_c8 + local_d0 * fVar14) * fVar14; - ropePointCount[2] = - VStack_108.y + (fVar14 * -13.0 + (float)local_c8 * -20.0) * (float)local_c8; - ropePointCount[1] = - (local_11c.y * (float)local_c8 + (float)local_d8 * fVar14) * (float)local_c8 + - ((float)local_cc * (float)local_c8 + (float)local_d8 * fVar14) * fVar14; - uVar9 = puVar3[5]; - } while (uVar10 < uVar9); - sprite = local_e8; - } - local_d8 = GHIDRA_CAST(0x1); - if (1 < uVar9) { - uVar9 = puVar3[5]; - do { - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_d8)) * 4)); - local_f4.y = (float)puVar3[4]; - pfVar5 = *(float **) - (puVar3[2] + (GHIDRA_INT(local_f4.y) + (GHIDRA_INT(local_d8) - 1U) & puVar3[3] - 1) * 4); - VStack_108.y = *ropePointCount - *pfVar5; - local_e0 = GHIDRA_CAST((ropePointCount[1] - pfVar5[1])); - if ((VStack_108.y != g_vectorZero.x) || ((float)local_e0 != g_vectorZero.y)) { - local_d0 = cos(1.5707964); - fVar14 = sin(1.5707964); - local_c0 = GHIDRA_CAST((local_d0 * VStack_108.y - fVar14 * (float)local_e0)); - local_d0 = local_d0 * (float)local_e0 + fVar14 * VStack_108.y; - fVar14 = sqrtf((float)local_c0 * (float)local_c0 + local_d0 * local_d0); - if (0.0 < fVar14) { - local_d0 = local_d0 * (1.0 / fVar14); - local_c0 = GHIDRA_CAST(((float)local_c0 * (1.0 / fVar14))); - } - VStack_108.y = 15.0 - local_dc; - local_e0 = GHIDRA_CAST(0x0); - ropePointCount = &VStack_108.y; - if ((local_dc - 6.0) * VStack_108.y * 0.5 <= 0.0) { - ropePointCount = GHIDRA_CAST(&local_e0); - } - local_e0 = GHIDRA_CAST(0x0); - pfVar5 = &VStack_108.y; - if (VStack_108.y <= 0.0) { - pfVar5 = GHIDRA_CAST(&local_e0); - } - fVar14 = ((float)((double)GHIDRA_INT((uVar9 - GHIDRA_INT(local_d8))) + - __uint_to_double_fixup[-(GHIDRA_INT((uVar9 - GHIDRA_INT(local_d8))) >> 0x1f)]) * - (*ropePointCount + (float)*ropePointCount)) / - (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]); - local_c0 = GHIDRA_CAST(((float)local_c0 * fVar14)); - local_d0 = local_d0 * fVar14; - fVar14 = (float)((double)GHIDRA_INT(local_d8) + __uint_to_double_fixup[-(GHIDRA_INT(local_d8) >> 0x1f)]) - * (float)*pfVar5 * 0.4; - fVar14 = sin(((fVar14 + fVar14) * 3.1415927) / - (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)])); - local_f4.y = (float)puVar3[4]; - ropePointCount = - *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(local_f4.y) + GHIDRA_INT(local_d8)) * 4)); - ropePointCount[1] = fVar14 * local_d0 + ropePointCount[1]; - *ropePointCount = fVar14 * (float)local_c0 + *ropePointCount; - ropePointCount[2] = ropePointCount[2] + 0.0; - uVar9 = puVar3[5]; - } - local_d8 = GHIDRA_CAST((GHIDRA_INT(local_d8) + 1)); - } while (local_d8 < uVar9); - sprite = local_e8; - } - if (sprite->_updateTime <= 4.0) { - ExceptionList = savedExceptionList; - return; - } - player = sprite->_player; - local_d8 = &sprite->_pos; - local_154.x = (player->_pos).x; - local_154.y = (player->_pos).y; - babyPosX = local_d8->x; - local_12c.y = (sprite->_pos).y; - local_c8 = GHIDRA_CAST((sprite->_collisionDamage * 3.0)); - local_d0 = 16.0; - local_124.x = babyPosX; - local_124.y = local_12c.y; - local_114 = GHIDRA_CAST(local_154.x); - local_fc = GHIDRA_CAST(local_154.y); - if (((player->_playerType == 0x20) && - (bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x26b,0), bVar2 != 0)) && - (cordSegment = sprite->_child, cordSegment != 0)) { - local_d0 = 1.0; - do { - if (30.0 <= local_d0) break; - cordSegment = *GHIDRA_CAST((cordSegment + 0x3c0)); - VStack_108.y = local_d0 + 1.0; - local_e0 = GHIDRA_CAST(0x41f00000); - local_c8 = GHIDRA_CAST(((float)local_c8 + 3.0)); - ropePointCount = &VStack_108.y; - if (30.0 <= VStack_108.y) { - ropePointCount = GHIDRA_CAST(&local_e0); - } - local_d0 = *ropePointCount; - } while (cordSegment != 0); - local_d0 = local_d0 + 16.0; - } - bVar2 = (GHIDRA_CAST((sprite->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar2 != 0) { - local_d0 = local_d0 * 1.5; - } - (GHIDRA_CAST((cordCapsule)))->Capsule::constructor2(&local_154,&local_124,local_d0); - if ((GHIDRA_UINT(g_game->_debugFlags) >> 5 & 1) != 0) { - pvVar7 = (GHIDRA_CAST((GHIDRA_CAST(&g_game->_debugRenderer))))->DebugRenderer::Get(sprite->_index,1); - (GHIDRA_CAST((GHIDRA_CAST(&local_20c))))->Capsule::constructor2(&local_154,&local_124,local_d0); - push_shape_points(pvVar7,capsule); - } - local_c0 = g_game->_room; - local_d0 = 18.0; - local_124.y = 0.0; - local_124.x = 0.0; - VStack_108.x = 0.0; - VStack_108.y = 0.0; - (GHIDRA_CAST((cordCapsule)))->Capsule::get_bounding_box(&local_124,&VStack_108); - baby = local_e8; - fVar14 = (float)GHIDRA_INT(((local_124.x - 40.0) / 40.0 + 0.5)); - local_dc = 0.0; - if (0 < GHIDRA_INT(fVar14)) { - local_dc = fVar14; - } - piVar8 = GHIDRA_CAST(GHIDRA_INT(((local_124.y - 120.0) / 40.0 + 0.5))); - local_f8 = GHIDRA_CAST(GHIDRA_CAST(0x0)); - if (0 < GHIDRA_INT(piVar8)) { - local_f8 = GHIDRA_CAST(piVar8); - } - local_e0 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_c0)) + 0xc)))) + -1)); - psVar11 = GHIDRA_CAST(GHIDRA_INT(((VStack_108.x - 40.0) / 40.0 + 0.5))); - if (GHIDRA_INT(psVar11) < GHIDRA_INT(local_e0)) { - local_e0 = psVar11; - } - fVar14 = (float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_c0)) + 0x10)))) + -1); - fVar13 = (float)GHIDRA_INT(((VStack_108.y - 120.0) / 40.0 + 0.5)); - if (GHIDRA_INT(fVar13) < GHIDRA_INT(fVar14)) { - fVar14 = fVar13; - } - VStack_108.y = fVar14; - pEVar12 = local_c0; - if (GHIDRA_INT(local_dc) <= GHIDRA_INT(local_e0)) { - do { - local_e4 = GHIDRA_CAST(local_f8); - fVar13 = local_dc; - pVVar4 = local_f8; - if (GHIDRA_INT(local_f8) <= GHIDRA_INT(fVar14)) { - do { - if ((((GHIDRA_INT(fVar13) < 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar12)) + 0xc)))) <= GHIDRA_INT(fVar13))) || - (GHIDRA_INT(pVVar4) < 0)) || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar12)) + 0x10)))) <= GHIDRA_INT(pVVar4) || - (cordSegment = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar12)) + 0xc)))) * GHIDRA_INT(pVVar4) + GHIDRA_INT(fVar13), - cordSegment < 0)))) { - local_c4 = GHIDRA_CAST(0x0); - } - else { - local_c4 = *(Vector **) - (GHIDRA_INT((&(pEVar12->_sprite)._filename + -2)) + 0xc + cordSegment * 4); - } - if (local_c4 != GHIDRA_CAST(0x0)) { - cordSegment = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - local_124.x = (float)(GHIDRA_INT(local_c4[4].y) % cordSegment) * 40.0 + 40.0; - local_124.y = (float)(GHIDRA_INT(local_c4[4].y) / cordSegment) * 40.0 + 120.0; - local_e4 = GHIDRA_CAST(pVVar4); - (GHIDRA_CAST((gridCapsule)))->Capsule::constructor(&local_124,&g_vectorOne,0.0,20.0); - bVar2 = Capsule::Collide(gridCapsule,cordCapsule,GHIDRA_CAST(0x0)); - if (bVar2 != 0) { - vfn = *(code **)(GHIDRA_CAST(local_c4->x) + 0x10); - (GHIDRA_CAST((&local_20c)))->EntityRef::constructor(GHIDRA_CAST(baby)); - (*vfn)(1); - pVVar4 = GHIDRA_CAST(local_e4); - } - fVar13 = local_dc; - pEVar12 = local_c0; - } - pVVar4 = GHIDRA_CAST((GHIDRA_INT(pVVar4) + 1)); - fVar14 = VStack_108.y; - local_e4 = GHIDRA_CAST(pVVar4); - } while (GHIDRA_INT(pVVar4) <= GHIDRA_INT(VStack_108.y)); - } - local_dc = (float)(GHIDRA_INT(fVar13) + 1); - } while (GHIDRA_INT(local_dc) <= GHIDRA_INT(local_e0)); - } - local_124.y = (float)(local_ec + 0x4c); - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST(shieldedMask),GHIDRA_CAST(local_124.y),&g_tearFlagShielded) - ; - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (uVar9 = 0x1c, GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - uVar9 = 0x1e; - } - local_cc = GHIDRA_CAST(0x49742400); - local_11c.y = 0.0; - local_11c.x = 0.0; - local_b9 = '\0'; - EntityList::query_player_capsule_hits - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&capsuleHits,cordCapsule,uVar9); - ehState = 4; - local_c4 = GHIDRA_CAST(0x0); - if (capsuleHits._size != 0) { - do { - pEVar12 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(capsuleHits)) + 0x4))) + GHIDRA_INT(local_c4) * 4)); - local_c0 = pEVar12; - if ((pEVar12->_size == 0.0) || (pEVar12->_entityCollisionClass == 0)) goto LAB_004345ff; - bloodEffect = GHIDRA_CAST(local_e8->_child); - if (bloodEffect != GHIDRA_CAST(0x0)) { - do { - g_forceCollideDepth = g_forceCollideDepth + 1; - entity_collision_classes_match(bloodEffect,GHIDRA_CAST(pEVar12)); - g_forceCollideDepth = g_forceCollideDepth + -1; - bloodEffect = GHIDRA_CAST(bloodEffect->_child); - } while (bloodEffect != GHIDRA_CAST(0x0)); - } - baby = local_e8; - local_f8 = GHIDRA_CAST(&pEVar12->_type); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST(local_f8) != 1)) { - cordSegment = *GHIDRA_CAST(local_f8); - if (cordSegment - 10U < 0x3de) goto LAB_004344ed; -LAB_00434a9f: - if (cordSegment == 4) { - if ((((void *)pEVar12->_parent == local_e8->_player) && - ((char)pEVar12->_wiggleFrameOffset != '\0')) && - (ropePointCount = &(pEVar12->_posOffset).y, - !(0.0 < *ropePointCount || *ropePointCount == 0.0))) goto LAB_00434c47; - psVar11 = &local_e8->_hitList; - local_e0 = psVar11; - local_e4 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity)::GetHitListIndex(); - puVar1 = (baby->_hitList)._end; - puVar3 = psVar11->_begin; - VStack_108.y = (float)puVar1; - uVar9 = GHIDRA_INT(puVar1) - GHIDRA_INT(puVar3) >> 2; - if (0 < GHIDRA_INT(uVar9)) { - do { - uVar10 = uVar9 >> 1; - if (GHIDRA_CAST(puVar3[uVar10]) < local_e4) { - puVar3 = puVar3 + uVar10 + 1; - uVar10 = uVar9 + (-1 - uVar10); - } - uVar9 = uVar10; - } while (0 < GHIDRA_INT(uVar10)); - pEVar12 = local_c0; - } - if ((puVar3 == puVar1) || (GHIDRA_CAST(*puVar3) != local_e4)) { - FUN_00431620(); - bombPos.x = (pEVar12->_pos).x; - bombPos.y = (pEVar12->_pos).y; - pVVar4 = (GHIDRA_CAST((&bombPos)))->Vector::__sub(&bombOffset,&local_154); - (GHIDRA_CAST((pVVar4)))->Vector::Normalized(&bombPushDir); - bVar2 = 0; - pVVar4 = (GHIDRA_CAST((&bombPushDir)))->Vector::__mul(&bombPush,&local_d0); - (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::AddVelocity_divided(pVVar4,bVar2); - } - } - else if (cordSegment == 9) { - if (local_e8->_player != (void *)0x0) { - if (pEVar12->_dead != 0) goto LAB_00434c47; - if (-50.0 < pEVar12->_height) { - projectilePos.x = (pEVar12->_pos).x; - projectilePos.y = (pEVar12->_pos).y; - pVVar4 = (GHIDRA_CAST((&projectilePos)))->Vector::__sub(&projectileOffset,&local_154); - (GHIDRA_CAST((pVVar4)))->Vector::Normalized(&reflectDir); - pVVar4 = (GHIDRA_CAST((&reflectDir)))->Vector::__mul(GHIDRA_CAST((local_184 + 4)),&local_d0); - (GHIDRA_CAST((pEVar12)))->Entity_Projectile::Reflect(unused,pVVar4); - } - } - } - else { -LAB_00434c47: - if ((local_e8->_player == (void *)0x0) || (cordSegment != 2)) { - if (((cordSegment == 5) && - (((pEVar12->_variant != 100 && (pEVar12[1]._sprite._animData == (void *)0x0)) && - (pEVar12->_dead == 0)))) && - (((pEVar12->_entityCollisionClass != 0 && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::HasEntityFlags(0x4000000), bVar2 == 0)) && - (bVar2 = EntityList::HitListContains - (GHIDRA_CAST(&baby->_hitList),GHIDRA_CAST(pEVar12)), bVar2 == 0)) - )) { - FUN_00431620(); - pickupPos.x = (pEVar12->_pos).x; - pickupPos.y = (pEVar12->_pos).y; - pVVar4 = (GHIDRA_CAST((&pickupPos)))->Vector::__sub(&local_148,local_d8); - (GHIDRA_CAST((pVVar4)))->Vector::Normalized(&local_f4); - bVar2 = 0; - pVVar4 = (GHIDRA_CAST((&local_f4)))->Vector::__mul(GHIDRA_CAST((local_13c + 4)),&local_d0); - (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::AddVelocity_divided(pVVar4,bVar2); - } - } - else if ((void *)pEVar12->_parent == local_e8->_player) { - tearFlags0 = pEVar12->_curvingStrength; - tearFlags1 = pEVar12->_acceleration; - VStack_108.x = pEVar12->_orbitDistance; - VStack_108.y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar12)) + 0x434)))); - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST((GHIDRA_INT(&anm2Path) + 8)),GHIDRA_CAST(&tearFlags0), - &g_tearFlagLudovico); - bVar2 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if ((bVar2 != 0) && - (bVar2 = EntityList::HitListContains - (GHIDRA_CAST(&baby->_hitList),GHIDRA_CAST(pEVar12)), bVar2 == 0)) - { - FUN_00431620(); - tearPos.x = (pEVar12->_pos).x; - tearPos.y = (pEVar12->_pos).y; - pVVar4 = (GHIDRA_CAST((&tearPos)))->Vector::__sub(GHIDRA_CAST((local_178 + 4)),local_d8); - (GHIDRA_CAST((pVVar4)))->Vector::Normalized(&tearPushDir); - pVVar4 = (GHIDRA_CAST((&tearPushDir)))->Vector::__mul(&local_15c,&local_d0); - VStack_108.y = 1.25; - pVVar4 = (GHIDRA_CAST((pVVar4)))->Vector::__mul(&local_168,&VStack_108.y); - (pEVar12->_velocity).x = pVVar4->x; - (pEVar12->_velocity).y = pVVar4->y; - } - } - } - } - else { - cordSegment = 1; -LAB_004344ed: - if ((pEVar12->_flags & 0x20000000) != 0) goto LAB_00434a9f; - local_e4 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity)::GetHitListIndex(); - local_e0 = (baby->_hitList)._end; - puVar3 = (baby->_hitList)._begin; - uVar9 = GHIDRA_INT(local_e0) - GHIDRA_INT(puVar3) >> 2; - if (0 < GHIDRA_INT(uVar9)) { - do { - uVar10 = uVar9 >> 1; - puVar1 = puVar3 + uVar10; - if (GHIDRA_CAST(*puVar1) < local_e4) { - puVar3 = puVar1 + 1; - uVar10 = uVar9 + (-1 - uVar10); - puVar1 = puVar3; - } - VStack_108.y = (float)puVar1; - uVar9 = uVar10; - } while (0 < GHIDRA_INT(uVar10)); - baby = local_e8; - pEVar12 = local_c0; - } - if ((GHIDRA_CAST(puVar3) == local_e0) || (GHIDRA_CAST(*puVar3) != local_e4)) { - cordSegment = *GHIDRA_CAST(local_f8); - if ((cordSegment != 0xf5) && (cordSegment != 0x124)) { - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(&baby->_hitList,uVar9); - cordSegment = pEVar12->_type; - } - if (cordSegment == 0x21) { - if (pEVar12->_variant == 0xb) { -LAB_00434715: - if (pEVar12->_dead == 0) { - local_e4 = GHIDRA_CAST(((pEVar12->_pos).x - (float)local_114)); - local_f8 = GHIDRA_CAST(((pEVar12->_pos).y - (float)local_fc)); - fVar14 = sqrtf((float)local_e4 * (float)local_e4 + - (float)local_f8 * (float)local_f8); - piVar8 = local_e4; - pVVar4 = local_f8; - if (0.0 < fVar14) { - pVVar4 = GHIDRA_CAST(((float)local_f8 * (1.0 / fVar14))); - piVar8 = GHIDRA_CAST(((float)local_e4 * (1.0 / fVar14))); - } - if ((pEVar12->_flags & 0x4000000) == 0) { - fVar13 = 900.0 / (pEVar12->_mass + 50.0); - fVar14 = pEVar12->_friction; - if (fVar14 != 0.0) { - fVar15 = pEVar12->_speedMultiplier; - (pEVar12->_velocity).x = - (fVar13 * (float)piVar8 * fVar15) / fVar14 + (pEVar12->_velocity).x; - (pEVar12->_velocity).y = - (fVar13 * (float)pVVar4 * fVar15) / fVar14 + (pEVar12->_velocity).y; - } - } - VStack_108.x = 0.0; - VStack_108.y = 0.0; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar2 == 0) || - (((bVar2 = (GHIDRA_CAST((baby->_player)))->Entity_Player::HasPlayerForm(0), bVar2 == 0 && - ((bVar2 = (GHIDRA_CAST((baby->_player)))->Entity_Player::HasCollectible(0x97,0), bVar2 == 0 || - (uVar9 = Random(), uVar9 % 6 != 0)))) || - (0x1d < *GHIDRA_CAST((GHIDRA_CAST(baby->_player) + 0x136c)))))) { - local_c0 = GHIDRA_CAST(VStack_108.y); - local_dc = VStack_108.x; - } - else { - local_dc = 2.29589e-41; - local_c0 = GHIDRA_CAST(0x0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(baby))))->Entity::HasEntityFlags(0x400000000); - if (bVar2 != 0) { - local_dc = (float)(GHIDRA_UINT(local_dc) | 0x20000000); - } - vfn = *(code **)(*GHIDRA_CAST(pEVar12) + 0x20); - (GHIDRA_CAST((&local_20c)))->EntityRef::constructor(local_e8->_player); - isDamaged = (*vfn)(local_c8,local_dc,local_c0,&local_20c); - if (isDamaged == '\0') { -LAB_004349aa: - pVVar4 = local_d8; - } - else { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - manager = g_manager; - if (bVar2 == 0) goto LAB_004349aa; - local_e4 = GHIDRA_CAST(0x4d); - seed_fart_sound_override(GHIDRA_CAST(&local_e4)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_e4),1.0,10,0,1.5,0.0); - pVVar4 = local_d8; - Entity_Tear::ApplyTearFlagEffects - (GHIDRA_CAST(pEVar12),local_d8,*GHIDRA_CAST(local_124.y), - GHIDRA_CAST(local_e8),(float)local_c8); - } - if ((pEVar12->_pendingDamage < pEVar12->_health) && - (*GHIDRA_CAST((local_ec + 0x50)) == '\0')) { - *GHIDRA_CAST((local_ec + 0x50)) = 1; - } - fVar15 = babyPosX - (float)local_114; - fVar17 = local_12c.y - (float)local_fc; - fVar13 = ((pEVar12->_pos).y - (float)local_fc) * fVar17 + - ((pEVar12->_pos).x - (float)local_114) * fVar15; - fVar14 = fVar17 * fVar17 + fVar15 * fVar15; - fVar15 = (fVar15 * fVar13) / fVar14 + (float)local_114; - fVar17 = (fVar17 * fVar13) / fVar14 + (float)local_fc; - fVar14 = pVVar4->x - fVar15; - fVar13 = pVVar4->y - fVar17; - ropePointCount = GHIDRA_CAST((fVar13 * fVar13 + fVar14 * fVar14)); - if ((float)ropePointCount < (float)local_cc) { - local_11c.x = fVar15; - local_11c.y = fVar17; - local_cc = ropePointCount; - } - local_b9 = '\x01'; - } - } - else { - vfn = *(code **)(*GHIDRA_CAST(pEVar12) + 0x20); - (GHIDRA_CAST((&local_20c)))->EntityRef::constructor(GHIDRA_CAST(local_e8->_parent)); - (*vfn)(0x447a0000,0,0,&local_20c); - } - } - else if (cordSegment == 0x3c3) { - piVar8 = baby->_player; - g_forceCollideDepth = g_forceCollideDepth + 1; - (**(code **)(*piVar8 + 0x5c))(pEVar12); - pEVar12->HandleCollision(piVar8,0); - g_forceCollideDepth = g_forceCollideDepth + -1; - } - else if (cordSegment != 0x11) goto LAB_00434715; - } - } -LAB_004345ff: - local_c4 = GHIDRA_CAST((GHIDRA_INT(local_c4) + 1)); - } while (local_c4 < GHIDRA_UINT(capsuleHits._size)); - if ((local_b9 != '\0') && (*GHIDRA_CAST((GHIDRA_CAST(local_ec) + 0x141)) == '\0')) { - *GHIDRA_CAST((GHIDRA_CAST(local_ec) + 0x141)) = 1; - play_sound_with_fart_seed(0x1ef,1.0,2,0,1.0); - bVar2 = (GHIDRA_CAST((&local_11c)))->Vector::operator_ne(&g_vectorZero); - if (bVar2 != 0) { - uVar9 = Random(); - local_12c.y = 6.0; - pVVar4 = (GHIDRA_CAST((local_d4)))->Vector::__mul(GHIDRA_CAST((local_13c + 4)),&local_12c.y); - bloodEffect = Game::Spawn(g_game,1000,2,&local_11c,pVVar4,GHIDRA_CAST(0x0),2,uVar9); - cordSegment = *GHIDRA_CAST(bloodEffect); - (bloodEffect->_posOffset).x = 0.0; - (bloodEffect->_posOffset).y = -15.0; - (**(code **)(cordSegment + 0xc))(); - } - } - } - (GHIDRA_CAST((&capsuleHits)))->EntityList_Query::~EntityList_Query(); - ExceptionList = savedExceptionList; - return; - } - if (((0 < sprite->_state) && (sprite->_headFrameDelay < 1)) && (20.0 < sprite->_updateTime)) { - if (sprite->_state == 1) { - fVar14 = (sprite->_pos).y; - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)); - puVar3[0x52] = (sprite->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c)); - puVar3[0x53] = fVar14 - fVar13; - } - local_cc = GHIDRA_CAST((sprite->_speedMultiplier * 10.0)); - fVar14 = atan2f((float)puVar3[0x53],(float)puVar3[0x52]); - fVar14 = approach_angle((float)puVar3[0x55],fVar14 * 57.295776,(float)local_cc); - puVar3[0x55] = fVar14; - sprite->_state = 2; - if (isInterpolated == 0) { - local_c8 = GHIDRA_CAST(((float)puVar3[0x51] - sprite->_speedMultiplier)); - puVar3[0x51] = local_c8; - } - else { - local_c8 = GHIDRA_CAST(((float)puVar3[0x51] - sprite->_speedMultiplier * 0.5)); - } - local_fc = GHIDRA_CAST((((float)local_c8 - 0.0) / 5.0)); - if ((float)local_fc <= 0.0) { - local_fc = GHIDRA_CAST(0x0); - } - if (1.0 <= (float)local_fc) { - local_fc = GHIDRA_CAST(0x3f800000); - } - fVar14 = (float)local_fc + 0.0; - fVar14 = (1.0 - fVar14) * fVar14 + fVar14; - local_e4 = GHIDRA_CAST((fVar14 * (float)puVar3[0x53] + *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)))); - local_114 = GHIDRA_CAST((fVar14 * (GHIDRA_CAST((puVar3 + 0x52)))->x + - *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c)))); - pVVar4 = (GHIDRA_CAST((GHIDRA_CAST((puVar3 + 0x52)))))->Vector::Normalized(&local_f4); - local_cc = GHIDRA_CAST(cos(1.5707964)); - fVar15 = sin(1.5707964); - baby = local_e8; - fVar14 = pVVar4->x; - fVar13 = pVVar4->y; - fVar18 = 1.0; - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4]) * 4)); - ropePointCount[2] = -13.0; - fVar17 = fVar13 * (float)local_cc; - local_cc = GHIDRA_CAST((fVar14 * (float)local_cc - fVar13 * fVar15)); - *ropePointCount = local_d0; - local_ec = GHIDRA_CAST((fVar17 + fVar14 * fVar15)); - ropePointCount[1] = (float)local_d8; - local_c0 = (Entity_Projectile *) - Math::timescale_factor(1.0 - (float)local_fc * 0.8,local_e8->_speedMultiplier); - local_d4 = GHIDRA_CAST(0x1); - if (1 < GHIDRA_UINT(puVar3[5])) { - local_fc = GHIDRA_CAST(((5.0 - (float)local_c8) * 4.0)); - local_dc = fVar18 - (float)local_c0; - do { - local_d8 = (Vector *) - ((float)((double)GHIDRA_INT(local_d4) + __uint_to_double_fixup[-(GHIDRA_INT(local_d4) >> 0x1f)] - ) / - (float)((double)(puVar3[5] + -1) + - __uint_to_double_fixup[-(puVar3[5] + -1 >> 0x1f)])); - local_c4 = GHIDRA_CAST((fVar18 - (float)local_d8)); - local_f8 = (Vector *) - ((float)local_114 * (float)local_d8 + - *GHIDRA_CAST((GHIDRA_CAST(baby->_player) + 0x33c)) * (float)local_c4); - local_d0 = (float)local_e4 * (float)local_d8 + - *GHIDRA_CAST((GHIDRA_CAST(baby->_player) + 0x340)) * (float)local_c4; - fVar14 = sin(((float)local_d8 * (float)local_c8 + (float)local_d8 * (float)local_c8) * - 3.1415927); - ropePointCount = &local_d4->x; - local_d4 = GHIDRA_CAST((GHIDRA_INT(&local_d4->x) + 1)); - ropePointCount = - *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(ropePointCount) + puVar3[4]) * 4)); - fVar18 = 1.0; - *ropePointCount = - (fVar14 * (float)local_cc * (float)local_fc + (float)local_f8) * (float)local_c0 + - local_dc * *ropePointCount; - ropePointCount[1] = - (fVar14 * (float)local_ec * (float)local_fc + local_d0) * (float)local_c0 + - local_dc * ropePointCount[1]; - ropePointCount[2] = - ((float)local_d8 * -20.0 - (float)local_c4 * 15.0) * (float)local_c0 + - local_dc * ropePointCount[2]; - } while (local_d4 < GHIDRA_CAST(puVar3[5])); - } - (baby->_velocity).x = g_vectorZero.x; - (baby->_velocity).y = g_vectorZero.y; - ropePointCount = GHIDRA_CAST(UmbilicalBabyData)::last_point(); - (baby->_pos).x = *ropePointCount; - (baby->_pos).y = ropePointCount[1]; - if (!(0.0 < (float)puVar3[0x51] || (float)puVar3[0x51] == 0.0)) { - baby->Remove(); - ExceptionList = savedExceptionList; - return; - } - ExceptionList = savedExceptionList; - return; - } - cordSegment = puVar3[5]; - local_c4 = GHIDRA_CAST(sprite->_speedMultiplier); - local_c8 = GHIDRA_CAST(0x0); - local_ec = (uint32_t *) - (90.0 / (float)((double)cordSegment + __uint_to_double_fixup[-(cordSegment >> 0x1f)])); - ropePointCount = GHIDRA_CAST(0x0); - if (cordSegment != 0) { - do { - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[4] + GHIDRA_INT(local_c8) & puVar3[3] - 1) * 4)); - local_13c = *(uint8_t (*) [8])(ropePointCount + 3); - local_134 = ropePointCount[5]; - ropePointCount[6] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_13c)) + 0x0))); - ropePointCount[7] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_13c)) + 0x4))); - ropePointCount[8] = local_134; - cordSegment = puVar3[4]; - if (local_c8 < GHIDRA_CAST((puVar3[5] - 1))) { - local_d4 = *GHIDRA_CAST((puVar3[2] + (cordSegment + 1 + GHIDRA_INT(local_c8) & puVar3[3] - 1) * 4)); - cordSegment = puVar3[4]; - } - else { - local_d4 = &DAT_00c79c58; - } - if (local_c8 == GHIDRA_CAST(0x0)) { - pVVar4 = &DAT_00c79c58; - } - else { - pVVar4 = *GHIDRA_CAST((puVar3[2] + (cordSegment + -1 + GHIDRA_INT(local_c8) & puVar3[3] - 1) * 4)); - } - pfVar5 = umbilical_rope_force - (&local_14c,ropePointCount,ropePointCount + 3,&pVVar4->x,&local_d4->x, - (float)local_ec); - local_c8 = GHIDRA_CAST((GHIDRA_INT(local_c8) + 1)); - ropePointCount[0x12] = *pfVar5; - ropePointCount[0x13] = pfVar5[1]; - ropePointCount[0x14] = pfVar5[2]; - ropePointCount = GHIDRA_CAST(puVar3[5]); - } while (local_c8 < ropePointCount); - } - local_c0 = GHIDRA_CAST(0x0); - uVar9 = 0; - if (ropePointCount != GHIDRA_CAST(0x0)) { - do { - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[4] + GHIDRA_INT(local_c0) & puVar3[3] - 1) * 4)); - ropePointCount[9] = (float)local_c4 * ropePointCount[0x12] * 0.5 + ropePointCount[3]; - ropePointCount[10] = (float)local_c4 * ropePointCount[0x13] * 0.5 + ropePointCount[4]; - ropePointCount[0xb] = (float)local_c4 * ropePointCount[0x14] * 0.5 + ropePointCount[5]; - if (local_c0 < puVar3[5] - 1) { - pfVar5 = *GHIDRA_CAST((puVar3[2] + (GHIDRA_INT(local_c0) + 1U + puVar3[4] & puVar3[3] - 1) * 4)); - cordSegment = *GHIDRA_CAST((puVar3[2] + (puVar3[4] + GHIDRA_INT(local_c0) + 1U & puVar3[3] - 1) * 4)); - local_d4 = GHIDRA_CAST(local_13c); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x4))) = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x1c)) * 0.5 + pfVar5[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x0))) = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x18)) * 0.5 + *pfVar5; - local_134 = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x20)) * 0.5 + pfVar5[2]; - } - else { - local_d4 = GHIDRA_CAST(local_178); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x0))) = DAT_00c79c58.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x4))) = DAT_00c79c58.y; - local_170 = DAT_00c79c60; - } - if (local_c0 == GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x0))) = DAT_00c79c58.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x4))) = DAT_00c79c58.y; - pfVar5 = GHIDRA_CAST(local_184); - local_17c = DAT_00c79c60; - } - else { - uVar9 = GHIDRA_INT(local_c0) + puVar3[4] + -1; - prevPoint = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - cordSegment = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - local_148.x = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x1c)) * 0.5 + prevPoint[1]; - local_14c = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x18)) * 0.5 + *prevPoint; - pfVar5 = &local_14c; - local_148.y = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x20)) * 0.5 + prevPoint[2]; - } - local_168.x = (float)local_c4 * ropePointCount[0x13] * 0.5 + ropePointCount[4]; - midVelX = (float)local_c4 * ropePointCount[0x12] * 0.5 + ropePointCount[3]; - local_168.y = (float)local_c4 * ropePointCount[0x14] * 0.5 + ropePointCount[5]; - midPosX = (float)local_c4 * ropePointCount[6] * 0.5 + *ropePointCount; - local_15c.x = (float)local_c4 * ropePointCount[7] * 0.5 + ropePointCount[1]; - local_15c.y = (float)local_c4 * ropePointCount[8] * 0.5 + ropePointCount[2]; - local_cc = ropePointCount; - pfVar5 = umbilical_rope_force - (&ropeForce,&midPosX,&midVelX,pfVar5,&local_d4->x,(float)local_ec); - local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 1)); - ropePointCount[0x15] = *pfVar5; - ropePointCount[0x16] = pfVar5[1]; - ropePointCount[0x17] = pfVar5[2]; - uVar9 = puVar3[5]; - } while (local_c0 < uVar9); - } - local_c0 = GHIDRA_CAST(0x0); - uVar10 = 0; - if (uVar9 != 0) { - do { - pVVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0)) * 4)); - fVar14 = pVVar4[0xb].y; - fVar13 = pVVar4[2].y; - pVVar4[6].x = (float)local_c4 * pVVar4[10].y * 0.5 + pVVar4[1].y; - pVVar4[6].y = (float)local_c4 * pVVar4[0xb].x * 0.5 + pVVar4[2].x; - pVVar4[7].x = (float)local_c4 * fVar14 * 0.5 + fVar13; - if (local_c0 < puVar3[5] - 1) { - ropePointCount = - *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0) + 1U) * 4)); - cordSegment = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(local_c0) + 1U + puVar3[4]) * 4)); - local_c8 = GHIDRA_CAST(local_13c); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x4))) = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x28)) * 0.5 + ropePointCount[1] - ; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x0))) = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x24)) * 0.5 + *ropePointCount; - local_134 = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x2c)) * 0.5 + ropePointCount[2]; - } - else { - local_c8 = GHIDRA_CAST(local_178); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x0))) = DAT_00c79c58.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x4))) = DAT_00c79c58.y; - local_170 = DAT_00c79c60; - } - if (local_c0 == GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x0))) = DAT_00c79c58.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x4))) = DAT_00c79c58.y; - ropePointCount = GHIDRA_CAST(local_184); - local_17c = DAT_00c79c60; - } - else { - uVar9 = GHIDRA_INT(local_c0) + puVar3[4] + -1; - pfVar5 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - cordSegment = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - local_148.x = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x28)) * 0.5 + pfVar5[1]; - local_14c = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x24)) * 0.5 + *pfVar5; - ropePointCount = &local_14c; - local_148.y = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x2c)) * 0.5 + pfVar5[2]; - } - local_168.x = (float)local_c4 * pVVar4[0xb].x * 0.5 + pVVar4[2].x; - midVelX = (float)local_c4 * pVVar4[10].y * 0.5 + pVVar4[1].y; - local_168.y = (float)local_c4 * pVVar4[0xb].y * 0.5 + pVVar4[2].y; - midPosX = (float)local_c4 * pVVar4[4].y * 0.5 + pVVar4->x; - local_15c.x = (float)local_c4 * pVVar4[5].x * 0.5 + pVVar4->y; - local_15c.y = (float)local_c4 * pVVar4[5].y * 0.5 + pVVar4[1].x; - local_d4 = pVVar4; - ropePointCount = - umbilical_rope_force - (&ropeForce,&midPosX,&midVelX,ropePointCount,GHIDRA_CAST(local_c8),(float)local_ec) - ; - local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 1)); - pVVar4[0xc].x = *ropePointCount; - pVVar4[0xc].y = ropePointCount[1]; - pVVar4[0xd].x = ropePointCount[2]; - uVar10 = puVar3[5]; - } while (local_c0 < uVar10); - } - local_c0 = GHIDRA_CAST(0x0); - uVar9 = 0; - if (uVar10 != 0) { - do { - pVVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0)) * 4)); - fVar14 = pVVar4[0xd].x; - fVar13 = pVVar4[2].x; - fVar15 = pVVar4[2].y; - pVVar4[7].y = (float)local_c4 * pVVar4[0xc].x + pVVar4[1].y; - pVVar4[8].x = (float)local_c4 * pVVar4[0xc].y + fVar13; - pVVar4[8].y = (float)local_c4 * fVar14 + fVar15; - if (local_c0 < puVar3[5] - 1) { - ropePointCount = - *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0) + 1U) * 4)); - cordSegment = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(local_c0) + 1U + puVar3[4]) * 4)); - local_c8 = GHIDRA_CAST(local_13c); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x4))) = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x34)) + ropePointCount[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x0))) = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x30)) + *ropePointCount; - local_134 = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x38)) + ropePointCount[2]; - } - else { - local_c8 = GHIDRA_CAST(local_178); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x0))) = DAT_00c79c58.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x4))) = DAT_00c79c58.y; - local_170 = DAT_00c79c60; - } - if (local_c0 == GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x0))) = DAT_00c79c58.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x4))) = DAT_00c79c58.y; - ropePointCount = GHIDRA_CAST(local_184); - local_17c = DAT_00c79c60; - } - else { - uVar9 = GHIDRA_INT(local_c0) + puVar3[4] + -1; - pfVar5 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - cordSegment = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - local_148.x = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x34)) + pfVar5[1]; - local_14c = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x30)) + *pfVar5; - ropePointCount = &local_14c; - local_148.y = (float)local_c4 * *GHIDRA_CAST((cordSegment + 0x38)) + pfVar5[2]; - } - local_168.x = (float)local_c4 * pVVar4[0xc].y + pVVar4[2].x; - midVelX = (float)local_c4 * pVVar4[0xc].x + pVVar4[1].y; - local_168.y = (float)local_c4 * pVVar4[0xd].x + pVVar4[2].y; - midPosX = (float)local_c4 * pVVar4[6].x + pVVar4->x; - local_15c.x = (float)local_c4 * pVVar4[6].y + pVVar4->y; - local_15c.y = (float)local_c4 * pVVar4[7].x + pVVar4[1].x; - local_d4 = pVVar4; - ropePointCount = - umbilical_rope_force - (&ropeForce,&midPosX,&midVelX,ropePointCount,GHIDRA_CAST(local_c8),(float)local_ec) - ; - local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 1)); - pVVar4[0xd].y = *ropePointCount; - pVVar4[0xe].x = ropePointCount[1]; - pVVar4[0xe].y = ropePointCount[2]; - uVar9 = puVar3[5]; - } while (local_c0 < uVar9); - } - baby = local_e8; - uVar10 = 0; - if (uVar9 != 0) { - local_c4 = GHIDRA_CAST(((float)local_c4 / 6.0)); - do { - uVar9 = puVar3[4] + uVar10; - uVar10 = uVar10 + 1; - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar9) * 4)); - *ropePointCount = - (float)local_c4 * - (ropePointCount[9] + ropePointCount[9] + ropePointCount[6] + - ropePointCount[0xc] + ropePointCount[0xc] + ropePointCount[0xf]) + *ropePointCount; - ropePointCount[1] = - (float)local_c4 * - (ropePointCount[10] + ropePointCount[10] + ropePointCount[7] + - ropePointCount[0xd] + ropePointCount[0xd] + ropePointCount[0x10]) + ropePointCount[1]; - ropePointCount[2] = - (ropePointCount[0xb] + ropePointCount[0xb] + ropePointCount[8] + - ropePointCount[0xe] + ropePointCount[0xe] + ropePointCount[0x11]) * (float)local_c4 + - ropePointCount[2]; - ropePointCount[3] = - (float)local_c4 * - (ropePointCount[0x15] + ropePointCount[0x15] + ropePointCount[0x12] + - ropePointCount[0x18] + ropePointCount[0x18] + ropePointCount[0x1b]) + ropePointCount[3]; - ropePointCount[4] = - (float)local_c4 * - (ropePointCount[0x16] + ropePointCount[0x16] + ropePointCount[0x13] + - ropePointCount[0x19] + ropePointCount[0x19] + ropePointCount[0x1c]) + ropePointCount[4]; - ropePointCount[5] = - (ropePointCount[0x17] + ropePointCount[0x17] + ropePointCount[0x14] + - ropePointCount[0x1a] + ropePointCount[0x1a] + ropePointCount[0x1d]) * (float)local_c4 + - ropePointCount[5]; - } while (uVar10 < GHIDRA_UINT(puVar3[5])); - } - ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4]) * 4)); - *ropePointCount = local_d0; - ropePointCount[1] = (float)local_d8; - ropePointCount[2] = -13.0; - cordSegment = *GHIDRA_CAST((puVar3[2] + (puVar3[4] & puVar3[3] - 1) * 4)); - *GHIDRA_CAST((cordSegment + 0xc)) = 0; - *GHIDRA_CAST((cordSegment + 0x10)) = 0; - *GHIDRA_CAST((cordSegment + 0x14)) = 0; - if (isInterpolated == 0) { - local_e4 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_e8->_player) + 0x340)) - (local_e8->_pos).y)); - local_114 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_e8->_player) + 0x33c)) - (local_e8->_pos).x)); - fVar15 = sqrtf((float)local_114 * (float)local_114 + (float)local_e4 * (float)local_e4); - fVar13 = VStack_108.y; - fVar14 = baby->_speedMultiplier; - local_fc = GHIDRA_CAST(0x0); - local_cc = GHIDRA_CAST(((fVar15 - 160.0) * (1.0 / fVar15))); - auVar16 = ZEXT812(0x3f59999a); - ppfVar6 = &local_cc; - if ((float)local_cc <= 0.0) { - ppfVar6 = &local_fc; - } - ropePointCount = *ppfVar6; - if (fVar14 != 1.0) { - fVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar16)) + 0x0))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar16)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar16)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar16)) + 0x0))) = fVar15 / ((fVar14 + fVar15) - fVar14 * fVar15); - } - fVar15 = fVar14 * (float)ropePointCount * (float)local_114 * 0.2 + - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar16)) + 0x0))) * (baby->_velocity).x; - (baby->_velocity).x = fVar15; - (baby->_velocity).y = - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar16)) + 0x0))) * (baby->_velocity).y + - fVar14 * (float)ropePointCount * (float)local_e4 * 0.2; - if (local_f8 == GHIDRA_CAST(0xffffffff)) { - if (baby->_isNotCountedAsFollower != 0) goto LAB_00433767; - baby->_state = 1; - fVar14 = baby->_speedMultiplier; - fVar15 = fVar14 * fVar15; - } - else { - fVar14 = baby->_speedMultiplier; - (baby->_velocity).x = ((float)local_e0 + (float)local_e0) * fVar14 + fVar15; - (baby->_velocity).y = (VStack_108.y + VStack_108.y) * fVar14 + (baby->_velocity).y; - VStack_108.y = baby->_speedMultiplier * 10.0; - fVar14 = atan2f(fVar13,(float)local_e0); - fVar14 = approach_angle((float)puVar3[0x55],fVar14 * 57.295776,VStack_108.y); - puVar3[0x55] = fVar14; - fVar14 = baby->_speedMultiplier; - fVar15 = fVar14 * (baby->_velocity).x; - } - fVar14 = fVar14 * (baby->_velocity).y; - } - else { -LAB_00433767: - fVar14 = baby->_speedMultiplier * (baby->_velocity).y; - fVar15 = baby->_speedMultiplier * (baby->_velocity).x; - if (isInterpolated != 0) { - fVar13 = 0.5; - goto LAB_004336d9; - } - } - fVar13 = 1.0; -LAB_004336d9: - fVar15 = fVar13 * fVar15 + (baby->_pos).x; - fVar14 = fVar13 * fVar14 + (baby->_pos).y; - ropePointCount = GHIDRA_CAST(UmbilicalBabyData)::last_point(); - *ropePointCount = fVar15; - ropePointCount[1] = fVar14; - ropePointCount[2] = 0.0; - cordSegment = UmbilicalBabyData::last_point(); - *GHIDRA_CAST((cordSegment + 8)) = 0xc1a00000; - cordSegment = UmbilicalBabyData::last_point(); - *GHIDRA_CAST((cordSegment + 0xc)) = 0; - *GHIDRA_CAST((cordSegment + 0x10)) = 0; - *GHIDRA_CAST((cordSegment + 0x14)) = 0; - ExceptionList = savedExceptionList; - return; -} - -// 004357e0 -void Entity_Familiar::set_extra_data(void *extraDataPtr, void *extraData) -{ - char isLastRef; - uint32_t stackCookie; - ReferenceCountBase *extraDataRef; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af0d44; - local_10 = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - extraDataRef = operator_new(0x18); - local_8 = 0; - if (extraDataRef == GHIDRA_CAST(0x0)) { - extraDataRef = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((extraDataRef)))->ReferenceCountBase::ReferenceCountBase(); - *GHIDRA_CAST(extraDataRef) = - ReferenceCount::vftable; - *(void **)(extraDataRef + 0x14) = extraData; - } - local_8 = 0xffffffff; - if (*GHIDRA_CAST((GHIDRA_CAST(extraDataPtr) + 4)) != GHIDRA_CAST(0x0)) { - isLastRef = (**(code **)(**GHIDRA_CAST((GHIDRA_CAST(extraDataPtr) + 4)) + 0xc))(stackCookie); - if ((isLastRef != '\0') && (DAT_00c7e818 != (code *)0x0)) { - (*DAT_00c7e818)(extraDataPtr); - } - } - *GHIDRA_CAST((GHIDRA_CAST(extraDataPtr) + 4)) = extraDataRef; - *(void **)extraDataPtr = extraData; - ExceptionList = local_10; - return; -} - -// 004361f0 -void * Entity_Familiar::Player() -{ - return this->_player; -} - -// 00436330 -void Entity_Familiar::WispInit() -{ - float *node; - code *pcVar1; - uint8_t bVar2; - Vector *randomDir; - void *pvVar3; - LayerState *layer; - int *effectEntry; - KColor *rgbColor; - uint8_t rngShift2; - uint8_t rngShift3; - int collectibleId; - ANM2 *extraout_ECX; - ANM2 *this_00; - ColorMod *layerColor; - Game *game; - uint32_t uVar4; - uint32_t wispSubtype; - float fVar5; - float fVar6; - float fVar7; - float fVar8; - uint32_t local_a4; - uint32_t local_a0; - uint32_t local_9c; - uint32_t local_98; - float local_94; - KColor local_90; - Vector local_7c; - float i; - uint64_t local_6c; - int *wispsByAge; - uint32_t wispsByAgeSize; - float *local_58; - float *local_54; - ColorMod wispColor; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint32_t *playerFlagWord; - - local_14 = 0xffffffff; - puStack_18 = &LAB_00af219d; - local_1c = ExceptionList; - ExceptionList = &local_1c; - local_58 = GHIDRA_CAST(this->_subtype); - if (this->_variant == 0xed) { - bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x248,0); - if (bVar2 == 0) { - this->_wispCollectibleType = 0x2c8; - local_58 = GHIDRA_CAST(0x2c8); - } - else { - this->_wispCollectibleType = 0x10012; - local_58 = GHIDRA_CAST(0x10012); - } - } - if ((this->_variant == 0xce) && ((local_58 == GHIDRA_CAST(0x203) || (local_58 == GHIDRA_CAST(0x1ea))))) { - this->_wispCollectibleType = GHIDRA_INT(local_58); - local_58 = GHIDRA_CAST(GetRandomWisp(&this->_dropRNG)); - this->_subtype = GHIDRA_INT(local_58); - } - wispSubtype = GHIDRA_UINT(local_58); - if (local_58 < 0x1e5) { - if (local_58 == GHIDRA_CAST(0x1e4)) goto switchD_00436422_caseD_6f; - if (0x121 < local_58) { - switch(local_58) { - case GHIDRA_CAST(0x126): - case GHIDRA_CAST(0x152): - case GHIDRA_CAST(0x1a5): - goto switchD_00436422_caseD_6f; - case GHIDRA_CAST(0x1ab): - this->_entityCollisionClass = 0; - this->_entityGridCollisionClass = 3; - this->_isInvicible = 1; - this->_isNotCountedAsFollower = 1; - randomDir = MusicManager::RandomVector(&local_7c); - (this->_velocity).x = randomDir->x; - (this->_velocity).y = randomDir->y; - } - goto switchD_00436422_caseD_67; - } - if (local_58 == GHIDRA_CAST(0x121)) { -switchD_00436422_caseD_6f: - this->_isNotCountedAsFollower = 1; - goto switchD_004364c6_caseD_1e8; - } - switch(local_58) { - case GHIDRA_CAST(0x66): - if (this->_coins == 0) { - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(6); - this->_coins = uVar4 + 1; - } - break; - case GHIDRA_CAST(0x6f): - case GHIDRA_CAST(0xa4): - goto switchD_00436422_caseD_6f; - case GHIDRA_CAST(0x11a): - goto switchD_00436422_caseD_11a; - } - goto switchD_00436422_caseD_67; - } - switch(local_58) { - case GHIDRA_CAST(0x1e7): - this->_entityCollisionClass = 0; - this->_isInvicible = 1; - if (this->_target != 0) { - local_54 = GHIDRA_CAST(&this->_target); - msvc::multiset::erase(&local_54); - } - this->_target = 0; - break; - default: - goto switchD_004364c6_caseD_1e8; - case GHIDRA_CAST(0x1f8): - case GHIDRA_CAST(0x25c): - case GHIDRA_CAST(0x2c1): - case GHIDRA_CAST(0x2c5): - case GHIDRA_CAST(0x2d2): - case GHIDRA_CAST(0x2d9): - goto switchD_00436422_caseD_6f; - case GHIDRA_CAST(0x22d): - playerFlagWord = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1574)); - *playerFlagWord = *playerFlagWord | 0x400; - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1518)) = 1; - break; - case GHIDRA_CAST(0x261): - this->_isInvicible = 1; - break; - case GHIDRA_CAST(0x27b): - (this->_pos).y = (this->_pos).y + 1.0; -switchD_00436422_caseD_11a: - (this->_targetPosition).x = (this->_pos).x; - (this->_targetPosition).y = (this->_pos).y; - this->_isNotCountedAsFollower = 1; - wispsByAge = GHIDRA_CAST(0x0); - wispsByAgeSize = 0; - wispsByAge = operator_new(0x18); - *wispsByAge = GHIDRA_INT(wispsByAge); - wispsByAge[1] = GHIDRA_INT(wispsByAge); - wispsByAge[2] = GHIDRA_INT(wispsByAge); - *GHIDRA_CAST((wispsByAge + 3)) = 0x101; - local_14 = 0; - i = 0.0; - local_54 = g_game->_room; - game = g_game; - if (local_54[0x499] != 0.0) { - do { - fVar5 = *GHIDRA_CAST((GHIDRA_INT(local_54[0x497]) + GHIDRA_INT(i) * 4)); - if ((((fVar5 != 0.0) && (*GHIDRA_CAST((GHIDRA_CAST(fVar5) + 0x28)) == 3)) && - (*GHIDRA_CAST((GHIDRA_CAST(fVar5) + 0x2c)) == 0xce)) && - ((*(void **)(GHIDRA_CAST(fVar5) + 0x410) == this->_player && - (*GHIDRA_CAST((GHIDRA_CAST(fVar5) + 0x30)) == wispSubtype)))) { - local_7c.x = (float)(*GHIDRA_CAST((GHIDRA_CAST(fVar5) + 0x328)) - game->_frameCount); - local_7c.y = fVar5; - FUN_0043ed20(GHIDRA_INT(&local_6c) + 4,&local_7c); - game = g_game; - } - i = (float)(GHIDRA_INT(i) + 1); - } while (GHIDRA_UINT(i) < GHIDRA_UINT(local_54[0x499])); - } - if (5 < wispsByAgeSize) { - do { - local_a4 = 0; - local_a0 = 0; - local_9c = 0; - local_98 = 0; - local_94 = g_vectorZero.x; - local_90._red = g_vectorZero.y; - local_90._green = g_vectorZero.x; - local_90._blue = g_vectorZero.y; - local_90._alpha = 0.0; - local_90._unk = 0; - (**(code **)(**GHIDRA_CAST((*wispsByAge + 0x14)) + 0x24))(&local_a4); - node = GHIDRA_CAST(*wispsByAge); - local_54 = node; - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_54); - pvVar3 = std_tree_extract(&wispsByAge,node); - operator_delete(pvVar3,0x18); - } while (5 < wispsByAgeSize); - wispSubtype = GHIDRA_UINT(local_58); - } - local_14 = 0xffffffff; - FID_conflict__Erase_tree_>_> - (&wispsByAge,(fuzzer_allocator_> *)&wispsByAge, - (_Tree_node *)wispsByAge[1]); - operator_delete(wispsByAge,0x18); -switchD_004364c6_caseD_1e8: - if (wispSubtype == 0x2c8) { - uVar4 = this->_subtype; - if (uVar4 < 0xf7) { - if (uVar4 == 0xf6) { - Level::ApplyBlueMapEffect(GHIDRA_CAST(g_game)); - } - else { - if (uVar4 == 0x15) goto LAB_00436776; - if (uVar4 == 0x36) { - Level::ApplyMapEffect(GHIDRA_CAST(g_game)); - } - } - } - else if (uVar4 == 0x14d) { - Level::ApplyMapEffect(GHIDRA_CAST(g_game)); - Level::ApplyBlueMapEffect(GHIDRA_CAST(g_game)); -LAB_00436776: - Level::ApplyCompassEffect(GHIDRA_CAST(g_game),1); - } - } - } -switchD_00436422_caseD_67: - if (this->_variant == 0xed) { - collectibleId = this->_wispCollectibleType; - } - else if (this->_variant == 0xce) { - collectibleId = this->_subtype; - } - else { - collectibleId = 0x248; - } - local_58 = ItemConfig::get_wisp_config(collectibleId); - fVar5 = *local_58; - this->_maxHitPoints = fVar5; - this->_health = fVar5; - fVar5 = local_58[0x61]; - if (fVar5 != 0.0) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST((local_58 + 0x5d))); - } - this_00 = &this->_sprite; - if (local_58[0x5b] == 0.0) { - if (fVar5 == 0.0) goto LAB_0043680d; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(this_00))))->Sprite::ReplaceSpritesheet(1,GHIDRA_CAST((local_58 + 0x57))); - this_00 = extraout_ECX; - } - ANM2::LoadGraphics(&this->_sprite,(uint8_t)this_00); -LAB_0043680d: - local_54 = local_58 + 0x36; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - if (&layer->_color != GHIDRA_CAST(local_54)) { - fVar5 = local_54[1]; - fVar6 = local_54[2]; - fVar7 = local_54[3]; - (layer->_color)._tint[0] = *local_54; - (layer->_color)._tint[1] = fVar5; - (layer->_color)._tint[2] = fVar6; - (layer->_color)._tint[3] = fVar7; - fVar5 = local_54[5]; - fVar6 = local_54[6]; - fVar7 = local_54[7]; - (layer->_color)._colorize[0] = local_54[4]; - (layer->_color)._colorize[1] = fVar5; - (layer->_color)._colorize[2] = fVar6; - (layer->_color)._colorize[3] = fVar7; - *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((local_54 + 8)); - (layer->_color)._offset[2] = local_54[10]; - } - local_54 = local_58 + 0x2b; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - if (&layer->_color != GHIDRA_CAST(local_54)) { - fVar5 = local_54[1]; - fVar6 = local_54[2]; - fVar7 = local_54[3]; - (layer->_color)._tint[0] = *local_54; - (layer->_color)._tint[1] = fVar5; - (layer->_color)._tint[2] = fVar6; - (layer->_color)._tint[3] = fVar7; - fVar5 = local_54[5]; - fVar6 = local_54[6]; - fVar7 = local_54[7]; - (layer->_color)._colorize[0] = local_54[4]; - (layer->_color)._colorize[1] = fVar5; - (layer->_color)._colorize[2] = fVar6; - (layer->_color)._colorize[3] = fVar7; - *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((local_54 + 8)); - (layer->_color)._offset[2] = local_54[10]; - } - if (wispSubtype == 0x2bf) { - pvVar3 = this->_player; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1519)) == '\0') { - for (effectEntry = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x150c)); - effectEntry != *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1510)); effectEntry = effectEntry + 4) { - if ((*GHIDRA_CAST(*effectEntry) == 0) && ((GHIDRA_CAST(*effectEntry))[1] == 100)) { - this->_coins = 1; - wispColor._offset[0] = -2.0078433; - wispColor._offset[1] = -2.0078433; - wispColor._offset[2] = -2.0078433; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - if (&layer->_color != &wispColor) { - (layer->_color)._tint[0] = (float)0x40323232; - (layer->_color)._tint[1] = (float)0x40323232; - (layer->_color)._tint[2] = (float)0x40323232; - (layer->_color)._tint[3] = 1.0; - (layer->_color)._colorize[0] = 0.0; - (layer->_color)._colorize[1] = 0.0; - (layer->_color)._colorize[2] = 0.0; - (layer->_color)._colorize[3] = 0.0; - *GHIDRA_CAST((layer->_color)._offset) = - CONCAT44(wispColor._offset[1],wispColor._offset[0]); - (layer->_color)._offset[2] = wispColor._offset[2]; - } - wispColor._offset[0] = 0.0; - wispColor._offset[1] = 0.0; - wispColor._offset[2] = 0.0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layerColor = &layer->_color; - if (layerColor != &wispColor) { - fVar5 = 0.078431375; - fVar6 = 0.078431375; - fVar7 = 0.078431375; - fVar8 = 1.0; - goto LAB_00436ceb; - } - break; - } - } - } - } - else if (wispSubtype == 0x7b) { - uVar4 = this->_initSeed; - local_6c = 0xb00000009; - local_58 = GHIDRA_CAST(&DAT_00000013); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> 9 ^ uVar4; - uVar4 = uVar4 << 0xb ^ uVar4; - uVar4 = uVar4 >> 0x13 ^ uVar4; - local_54 = GHIDRA_CAST(((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - * 2.3283062e-10)); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> 9 ^ uVar4; - uVar4 = uVar4 << 0xb ^ uVar4; - uVar4 = uVar4 >> 0x13 ^ uVar4; - local_54 = GHIDRA_CAST(((((float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283062e-10 + - (float)local_54) - 1.0) * 0.2 + 0.8)); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> 9 ^ uVar4; - uVar4 = uVar4 << 0xb ^ uVar4; - uVar4 = uVar4 >> 0x13 ^ uVar4; - hsv_to_rgb(&local_90, - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10 * 360.0,(float)local_54,0.8,1.0); - wispColor._tint[0] = local_90._red * 2.0; - wispColor._offset[0] = 0.0; - wispColor._offset[1] = 0.0; - wispColor._tint[1] = local_90._green * 2.0; - wispColor._offset[2] = 0.0; - wispColor._tint[3] = 1.0; - wispColor._tint[2] = local_90._blue * 2.0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - if (&layer->_color != &wispColor) { - (layer->_color)._tint[0] = wispColor._tint[0]; - (layer->_color)._tint[1] = wispColor._tint[1]; - (layer->_color)._tint[2] = wispColor._tint[2]; - (layer->_color)._tint[3] = wispColor._tint[3]; - (layer->_color)._colorize[0] = 0.0; - (layer->_color)._colorize[1] = 0.0; - (layer->_color)._colorize[2] = 0.0; - (layer->_color)._colorize[3] = 0.0; - *GHIDRA_CAST((layer->_color)._offset) = CONCAT44(wispColor._offset[1],wispColor._offset[0]); - (layer->_color)._offset[2] = wispColor._offset[2]; - } - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - bVar2 = (uint8_t)local_6c; - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - rngShift2 = (uint8_t)((uint64_t)local_6c >> 0x20); - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - rngShift3 = (uint8_t)local_58; - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - local_54 = GHIDRA_CAST(((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - * 2.3283062e-10)); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - local_54 = GHIDRA_CAST(((((float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283062e-10 + - (float)local_54) - 1.0) * 0.2 + 0.8)); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - rgbColor = hsv_to_rgb(&local_90, - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)] - ) * 2.3283062e-10 * 360.0,(float)local_54,0.8,1.0); - wispColor._offset[0] = 0.0; - wispColor._offset[1] = 0.0; - wispColor._offset[2] = 0.0; - wispColor._tint[3] = 1.0; - wispColor._tint[0] = rgbColor->_red * 2.0; - wispColor._tint[1] = rgbColor->_green * 2.0; - wispColor._tint[2] = rgbColor->_blue * 2.0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layerColor = &layer->_color; - if (layerColor != &wispColor) { - fVar5 = wispColor._tint[0]; - fVar6 = wispColor._tint[1]; - fVar7 = wispColor._tint[2]; - fVar8 = wispColor._tint[3]; -LAB_00436ceb: - layerColor->_tint[0] = fVar5; - layerColor->_tint[1] = fVar6; - layerColor->_tint[2] = fVar7; - layerColor->_tint[3] = fVar8; - layerColor->_colorize[0] = 0.0; - layerColor->_colorize[1] = 0.0; - layerColor->_colorize[2] = 0.0; - layerColor->_colorize[3] = 0.0; - *GHIDRA_CAST(layerColor->_offset) = CONCAT44(wispColor._offset[1],wispColor._offset[0]); - layerColor->_offset[2] = wispColor._offset[2]; - } - } - if (this->_variant == 0xed) { - (GHIDRA_CAST((this->_player)))->Entity_Player::RecomputeWispCollectibles(this); - } - Game::UpdateVisibility(g_game); - ExceptionList = local_1c; - return; -} - -// 00436fd0 -uint32_t Entity_Familiar::wisp_kill() -{ - float fVar1; - void *pvVar2; - code *pcVar3; - Vector velocity; - Vector targetPos; - Entity *pEVar4; - ANM2 *pAVar5; - uint8_t bVar6; - uint32_t uVar7; - Vector *pVVar8; - ColorMod *Color; - ColorMod *color; - Entity_Laser *laser; - Entity_Tear *tear; - ColorMod *color_00; - Entity_Player *pEVar9; - uint32_t uVar10; - EntityRef *ref; - Entity *spawned; - LayerState *layer; - uint32_t uVar11; - Manager *manager; - Entity_Familiar *tear; - float fVar13; - float fVar14; - Entity_Familiar *spawned; - int iVar16; - uint8_t bVar17; - uint8_t isOnlyRunes; - Color layer0Color; - Color layer1Color; - Vector VStack_94; - void *wispConfig; - Vector VStack_88; - uint8_t auStack_80 [8]; - Vector VStack_78; - Vector VStack_6c; - uint32_t uStack_64; - uint8_t auStack_60 [8]; - float fStack_58; - float fStack_54; - float fStack_50; - float fStack_4c; - float fStack_48; - float fStack_44; - float fStack_40; - float fStack_3c; - float fStack_38; - uint8_t auStack_34 [12]; - uint8_t *queryCount; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t uStack_14; - RNG *dropRng; - uint32_t *itemListEnd; - int *queriedEnemy; - Room *room; - ColorMod *spawnedColor; - - puStack_20 = auStack_34 + 0x30; - uStack_14 = 0xffffffff; - puStack_18 = &LAB_00af21fd; - local_1c = ExceptionList; - uVar7 = __security_cookie ^ GHIDRA_UINT((auStack_34 + 0x24)); - ExceptionList = &local_1c; - if (this->_variant == 0xed) { - iVar16 = this->_wispCollectibleType; - } - else if (this->_variant == 0xce) { - iVar16 = this->_subtype; - } - else { - iVar16 = 0x248; - } - uStack_64 = this; - local_24 = uVar7; - wispConfig = ItemConfig::get_wisp_config(iVar16); - pEVar9 = GHIDRA_CAST(this->_subtype); - VStack_78.y = (float)pEVar9; - if (GHIDRA_CAST(0x11f) < pEVar9) { - if (pEVar9 < GHIDRA_CAST(0x222)) { - if (pEVar9 == GHIDRA_CAST(0x221)) { - VStack_78.y = (float)Random(); - VStack_88.y = (float)this->_player; - VStack_94.y = (float)Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0 - ,0); - uVar7 = (this->_dropRNG)._seed; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = (this->_dropRNG)._seed; - if (uVar7 == 0) { - pcVar3 = (code *)swi(3); - uVar10 = (*pcVar3)(); - return uVar10; - } - } - uVar7 = uVar7 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar7; - uVar11 = 0xe3; - uVar7 = uVar7 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar7; - (this->_dropRNG)._seed = uVar7; - if (uVar7 == (uVar7 / 3) * 3) { - uVar11 = 0x115; - } - spawned = Game::Spawn(g_game,uVar11,0,GHIDRA_CAST(VStack_94.y),&g_vectorZero, - GHIDRA_CAST(VStack_88.y),0,GHIDRA_UINT(VStack_78.y)); - if ((spawned == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (spawned->_type != 1)) && - (0x3dd < spawned->_type - 10U)))) { - spawned = GHIDRA_CAST(0x0); - } - bVar17 = 0; - bVar6 = 0; - iVar16 = -1; - ref = (GHIDRA_CAST((GHIDRA_CAST((auStack_60 + 4)))))->EntityRef::EntityRef(); - (GHIDRA_CAST((spawned)))->Entity::AddCharmed(ref,iVar16,bVar6,bVar17); - spawned->Update(); - (GHIDRA_CAST((spawned)))->Entity::SetVisibleFlag(0); - fVar13 = spawned->_maxHitPoints + spawned->_maxHitPoints; - VStack_6c.y = 3.71344e-43; - spawned->_maxHitPoints = fVar13; - spawned->_health = fVar13; - manager = g_manager; - seed_fart_sound_override(GHIDRA_CAST(&VStack_6c.y)); - tear = GHIDRA_CAST(VStack_6c.y); - goto code_r0x00437295; - } - switch(pEVar9) { - case GHIDRA_CAST(0x120): - VStack_78.y = (float)this->_player; - room = g_game->_room; - pVVar8 = MusicManager::RandomVector(GHIDRA_CAST((auStack_34 + 8))); - uVar7 = Random(); - fVar13 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 80.0 + 40.0; - VStack_88.y = fVar13 * pVVar8->y + (uStack_64->_pos).y; - VStack_88.x = fVar13 * pVVar8->x + (uStack_64->_pos).x; - pVVar8 = Room::FindFreePickupSpawnPosition(room,&VStack_94,&VStack_88,40.0,0,0,0); - this = uStack_64; - (GHIDRA_CAST((GHIDRA_CAST(VStack_78.y))))->Entity_Player::ThrowBlueSpider(&uStack_64->_pos,pVVar8); - break; - case GHIDRA_CAST(0x122): - VStack_78.y = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomFloat(); - if (VStack_78.y < 0.25) { - KAGE_LogMessage(1,GHIDRA_CAST("Spawn heart!")); - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); - spawned = Game::Spawn(g_game,5,10,pVVar8,&g_vectorZero,GHIDRA_CAST(this),2,uVar7); - spawned[1]._sprite._championColor._colorize[2] = 2.8026e-44; - } - break; - case GHIDRA_CAST(0x125): - spawned = GHIDRA_CAST(FUN_00436260()); - VStack_88.y = (float)spawned; - iVar16 = _get_index_plus_one_if_kind_4_5(); - VStack_6c.y = 0.0; - VStack_78.y = (float)(iVar16 + -1) * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((spawned)) + 0x8)))) + - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((spawned)) + 0x4)))); - do { - laser = Entity_Laser::ShootAngle - (1,&this->_pos,(float)GHIDRA_INT(VStack_6c.y) * 90.0,0x14,&this->_posOffset, - GHIDRA_CAST(this),0); - laser->_disableFollowParent = 1; - laser->SetCollisionDamage(VStack_78.y * *GHIDRA_CAST((GHIDRA_CAST(VStack_88.y) + 0x18))); - laser->_scale = 0.5; - (GHIDRA_CAST((laser)))->Entity_Laser::ResetSpriteScale(); - laser->Update(); - VStack_6c.y = (float)(GHIDRA_INT(VStack_6c.y) + 1); - } while (GHIDRA_INT(VStack_6c.y) < 4); - break; - case GHIDRA_CAST(0x127): - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(10); - if (uVar7 == 0) { - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - fVar13 = 0.0; -LAB_0043785e: - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,fVar13,0,0,0); - Game::Spawn(g_game,5,0x14,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - } - break; - case GHIDRA_CAST(0x15c): - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_80),3,-1,-1,1 - ,0); - uVar7 = 0; - uStack_14 = 2; - if (GHIDRA_CAST(VStack_78.y) != GHIDRA_CAST(0x0)) { - do { - if (*(void **)(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))) + uVar7 * 4)) + 0x410) == this->_player) { - farting_baby_fart(); - } - uVar7 = uVar7 + 1; - } while (uVar7 < GHIDRA_UINT(VStack_78.y)); - } - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); - Game::Spawn(g_game,5,0x46,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - uStack_14 = 0xffffffff; - (GHIDRA_CAST((auStack_80)))->EntityList_Query::~EntityList_Query(); - break; - case GHIDRA_CAST(0x15d): - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); - if (uVar7 == 0) { - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - fVar13 = 40.0; - goto LAB_0043785e; - } - break; - case GHIDRA_CAST(0x15f): - ::(GHIDRA_CAST((GHIDRA_CAST(auStack_60))))->Color::Color(); - pVVar8 = &this->_pos; - Game::Fart(g_game,pVVar8,160.0,this->_player,0.5,0,color_00); - Game::ButterBeanFart(g_game,pVVar8,200.0,this->_player,0,0); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),pVVar8, - 180.0,8); - uVar7 = 0; - uStack_14 = 0; - if (queryCount != GHIDRA_CAST(0x0)) { - do { - VStack_78.y = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar7 * 4)); - bVar6 = (GHIDRA_CAST((GHIDRA_CAST(VStack_78.y))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar6 != 0) { - (GHIDRA_CAST((GHIDRA_CAST((auStack_60 + 4)))))->EntityRef::constructor(this->_player); - (GHIDRA_CAST((GHIDRA_CAST(VStack_78.y))))->Entity::AddFreeze(GHIDRA_CAST((auStack_60 + 4)),-0x32,0); - } - uVar7 = uVar7 + 1; - } while (uVar7 < queryCount); - } - uStack_14 = 0xffffffff; - (GHIDRA_CAST((auStack_34)))->EntityList_Query::~EntityList_Query(); - break; - case GHIDRA_CAST(0x160): - if (DAT_00c7e83c == '\0') { - DAT_00c7e83c = 1; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),3,0xce, - 0x160,0,0); - uStack_14 = 1; - VStack_6c.y = 0.0; - if (queryCount != GHIDRA_CAST(0x0)) { - uVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))); - do { - queriedEnemy = *GHIDRA_CAST((uVar10 + GHIDRA_INT(VStack_6c.y) * 4)); - if (*GHIDRA_CAST((GHIDRA_CAST(queriedEnemy) + 0x173)) == '\0') { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_60)) + 0x4))) = 0.0; - fStack_58 = 0.0; - fStack_48 = g_vectorZero.y; - fStack_40 = g_vectorZero.y; - fStack_54 = 0.0; - fStack_50 = 0.0; - fStack_4c = g_vectorZero.x; - fStack_44 = g_vectorZero.x; - fStack_3c = 0.0; - fStack_38 = 0.0; - (**(code **)(*queriedEnemy + 0x24))(auStack_60 + 4); - } - VStack_6c.y = (float)&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(VStack_6c.y)))) + 0x1))); - } while (GHIDRA_UINT(VStack_6c.y) < queryCount); - this = uStack_64; - } - DAT_00c7e83c = '\0'; - uStack_14 = 0xffffffff; - (GHIDRA_CAST((auStack_34)))->EntityList_Query::~EntityList_Query(); - } - break; - case GHIDRA_CAST(0x17f): - Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&uStack_64) + 2)),0x17f,9,-1,0); - uVar7 = Random(); - uStack_64 = GHIDRA_CAST(0x0); - VStack_88.y = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 360.0 - 180.0; - do { - pEVar9 = this->_player; - VStack_6c.y = pEVar9->_shotspeed * 10.0; - VStack_78.y = ((float)uStack_64 + VStack_88.y) * 0.017453292; - VStack_94.x = cos(VStack_78.y); - VStack_94.x = VStack_94.x * VStack_6c.y; - fVar13 = sin(VStack_78.y); - VStack_94.y = fVar13 * VStack_6c.y; - velocity.y = VStack_94.y; - velocity.x = VStack_94.x; - tear = Entity_Player::FireTear(pEVar9,&this->_pos,velocity,6,GHIDRA_CAST(0x0),1.0); - fVar13 = (this->_pos).x; - (tear->_targetPosition).y = (this->_pos).y; - uStack_64 = GHIDRA_CAST(((float)uStack_64 + 60.0)); - (tear->_targetPosition).x = fVar13; - } while ((float)uStack_64 < 360.0); - break; - case GHIDRA_CAST(0x18c): - if (this->_parent != 0) { - iVar16 = *GHIDRA_CAST((this->_parent + 0x30)); - FUN_0074a280(iVar16,*GHIDRA_CAST((g_game->_ventricleRazorPortals + iVar16 * 0xc + 4)),0); - } - break; - case GHIDRA_CAST(0x1a5): - Game::CharmFart(&this->_pos,80.0,GHIDRA_CAST(this)); - break; - case GHIDRA_CAST(0x1b5): - Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&uStack_64) + 2)),0x1b5,9,-1,0); - pEVar9 = GHIDRA_CAST(this->_subtype); - goto code_r0x00437e10; - case GHIDRA_CAST(0x1de): - (GHIDRA_CAST((g_game->_room)))->Room::SetPauseTimer(0x5a); - break; - case GHIDRA_CAST(0x1df): - uVar7 = Random(); - if ((uVar7 & 3) == 0) { - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); - Game::Spawn(g_game,5,0x15e,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - } - break; - case GHIDRA_CAST(0x1e3): - uVar7 = Random(); - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); - Game::Spawn(g_game,4,0x12,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - break; - case GHIDRA_CAST(0x1e4): - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0x3d,&this->_pos,&g_vectorZero,this->_player,0,uVar7); - VStack_88.y = (float)this->_player; - if (spawned->_parent != 0) { - VStack_78.y = (float)&spawned->_parent; - msvc::multiset::erase(&VStack_78.y); - } - spawned->_parent = VStack_88.y; - if (GHIDRA_CAST(VStack_88.y) != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&spawned->_parent); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x44)))) = this->_size; - pEVar4 = spawned + 1; - (pEVar4->_sprite)._filename._buf[0] = '\0'; - (pEVar4->_sprite)._filename._buf[1] = '\0'; - (pEVar4->_sprite)._filename._buf[2] = -0x4c; - (pEVar4->_sprite)._filename._buf[3] = 'B'; - pAVar5 = &spawned[1]._sprite; - (pAVar5->_filename)._buf[4] = '\n'; - (pAVar5->_filename)._buf[5] = '\0'; - (pAVar5->_filename)._buf[6] = '\0'; - (pAVar5->_filename)._buf[7] = '\0'; - pAVar5 = &spawned[1]._sprite; - (pAVar5->_filename)._buf[8] = '\n'; - (pAVar5->_filename)._buf[9] = '\0'; - (pAVar5->_filename)._buf[10] = '\0'; - (pAVar5->_filename)._buf[0xb] = '\0'; - case GHIDRA_CAST(0x126): - Game::ButterBeanFart(g_game,&this->_pos,80.0,this->_player,1,1); - break; - case GHIDRA_CAST(0x1e5): - if (DAT_00c7e83d == '\0') { - DAT_00c7e83d = 1; - uVar11 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); - if (uVar11 == 0) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),3, - 0xce,-1,0,0); - uVar7 = 0; - uStack_14 = 3; - if (queryCount != GHIDRA_CAST(0x0)) { - do { - if (*GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar7 * 4)) + 0x173)) == '\0') { - pEVar9 = this->_player; - VStack_78.x = (pEVar9->_pos).x; - VStack_78.y = (pEVar9->_pos).y; - Entity_Player::AddWisp - (pEVar9,*GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar7 * 4)) + 0x30)), - &VStack_78,0,0); - } - uVar7 = uVar7 + 1; - } while (uVar7 < queryCount); - } - } - else { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),3, - 0xce,-1,0,0); - uStack_14 = 4; - if (queryCount != GHIDRA_CAST(0x0)) { - uVar11 = 0; - do { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_60)) + 0x4))) = 0.0; - fStack_58 = 0.0; - fStack_54 = 0.0; - fStack_48 = g_vectorZero.y; - fStack_40 = g_vectorZero.y; - fStack_50 = 0.0; - fStack_4c = g_vectorZero.x; - fStack_44 = g_vectorZero.x; - fStack_3c = 0.0; - fStack_38 = 0.0; - (**(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar11 * 4)) + 0x24)) - (auStack_60 + 4,uVar7); - uVar11 = uVar11 + 1; - } while (uVar11 < queryCount); - this = uStack_64; - } - } - uStack_14 = 0xffffffff; - (GHIDRA_CAST((auStack_34)))->EntityList_Query::~EntityList_Query(); - DAT_00c7e83d = '\0'; - } - break; - case GHIDRA_CAST(0x20b): - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); - Game::Spawn(g_game,5,0,pVVar8,&g_vectorZero,GHIDRA_CAST(this),4,uVar7); - } - } - else { - switch(pEVar9) { - case GHIDRA_CAST(0x10006): - case GHIDRA_CAST(0x10007): - case GHIDRA_CAST(0x10008): - case GHIDRA_CAST(0x10009): -code_r0x00437e10: - FUN_0043d7f0(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar9[-1])) + 0x2eff)))); - this->_health = this->_maxHitPoints; - ExceptionList = local_1c; - return 0; - } - } - goto LAB_004372a0; - } - if (pEVar9 == GHIDRA_CAST(0x11f)) { - (GHIDRA_CAST((this->_player)))->Entity_Player::trigger_cracked_orb(&this->_pos); - goto LAB_004372a0; - } - switch(pEVar9) { - case GHIDRA_CAST(0x23): - Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&uStack_64) + 2)),0x23,9,-1,0); - break; - case GHIDRA_CAST(0x25): - case GHIDRA_CAST(0x41): - dropRng = &this->_dropRNG; - VStack_94.y = (float)(GHIDRA_CAST((dropRng)))->RNG::Next(); - VStack_88.y = (float)this->_player; - uVar7 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - pVVar8 = RandomVector(GHIDRA_CAST((auStack_34 + 8)),uVar7); - fVar13 = (GHIDRA_CAST((dropRng)))->RNG::RandomFloat(); - this = uStack_64; - VStack_6c.x = fVar13 * 2.0 + 2.0; - VStack_6c.y = VStack_6c.x * pVVar8->y; - VStack_6c.x = VStack_6c.x * pVVar8->x; - uVar7 = 0; - if (GHIDRA_CAST(VStack_78.y) == GHIDRA_CAST(0x41)) { - uVar7 = 3; - } - spawned = Game::Spawn(g_game,4,uVar7,&uStack_64->_pos,&VStack_6c,GHIDRA_CAST(VStack_88.y),0, - GHIDRA_UINT(VStack_94.y)); - (GHIDRA_CAST((this->_player)))->Entity_Player::GetBombFlags(GHIDRA_CAST(auStack_80),0); - if (this->_subtype == 0x25) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); - VStack_78.x = (float)(GHIDRA_UINT(VStack_78.x) | GHIDRA_UINT(g_tearFlagHoming._h)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x0))) | GHIDRA_UINT(g_tearFlagHoming._l); - VStack_78.y = (float)(GHIDRA_UINT(VStack_78.y) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4)))); - } - spawned[1]._sprite._filename._buf[0xb] = '\x01'; - spawned[1]._type = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x0))); - spawned[1]._variant = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))); - spawned[1]._subtype = GHIDRA_INT(VStack_78.x); - spawned[1]._spawnerType = GHIDRA_INT(VStack_78.y); - if (this->_subtype == 0x25) { - spawned[1]._collisionIndex = 0x3f266666; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x3c)))) = 0x3f400000; - uVar7 = Random(); - (spawned->_posOffset).x = 0.0; - (spawned->_posOffset).y = -3.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0xc)))) = - -3.0 - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 5.0; - } - uVar10 = *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); - *GHIDRA_CAST(&spawned->_flags) = GHIDRA_UINT(spawned->_flags) | 0x4000000; - *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)) = uVar10; - spawned->Update(); - break; - case GHIDRA_CAST(0x28): - pvVar2 = this->_player; - uStack_64 = GHIDRA_CAST(((this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x33c)))); - VStack_6c.y = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x340)); - fVar13 = sqrtf((float)uStack_64 * (float)uStack_64 + VStack_6c.y * VStack_6c.y); - if (70.0 <= fVar13) { - spawned = uStack_64; - tear = GHIDRA_CAST(VStack_6c.y); - } - else { - spawned = GHIDRA_CAST(((float)uStack_64 * (70.0 / fVar13))); - tear = GHIDRA_CAST((VStack_6c.y * (70.0 / fVar13))); - } - ::(GHIDRA_CAST((GHIDRA_CAST(auStack_60))))->Color::Color(); - VStack_88.x = (float)spawned + *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x33c)); - VStack_88.y = (float)tear + *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x340)); - Game::BombExplosionEffects - (g_game,&VStack_88,30.0,(BitSet128)ZEXT816(0),Color,GHIDRA_CAST(this),0.75,1,4,0); - break; - case GHIDRA_CAST(0x42): - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) & 0xfffffffcU)) < 0x109) - { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x0))) = 0; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x108)); - } - queryCount = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x8))) = 0x5a; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)))))->TemporaryEffects::AddEffect(auStack_34,1,1); - manager = g_manager; - fVar13 = (GHIDRA_CAST((g_game->_room)))->Room::time_scale_update(); - (manager->_musicManager)._targetPitch = fVar13; - break; - case GHIDRA_CAST(0x4e): - TemporaryEffects::AddCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),0x20e,1,1); - uVar7 = Random(); - spawned = Game::Spawn(g_game,3,0x7a,&this->_pos,&g_vectorZero,this->_player,0,uVar7); - if ((spawned == GHIDRA_CAST(0x0)) || (spawned->_type != 3)) { - spawned = GHIDRA_CAST(0x0); - } - spawned->Update(); - (GHIDRA_CAST((this->_player)))->Entity_Player::EvaluateItems(); - manager = g_manager; - uStack_64 = GHIDRA_CAST(0x109); - seed_fart_sound_override(&uStack_64); - tear = uStack_64; -code_r0x00437295: - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(tear),1.0,2,0,1.0,0.0); - break; - case GHIDRA_CAST(0x55): - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - iVar16 = ItemPool::GetCardEx(uVar7,0x19,0,10,1); - isOnlyRunes = 0; - bVar17 = 0; - bVar6 = 1; - goto LAB_004372ff; - case GHIDRA_CAST(0x66): - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,0x46,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - if (this->_coins == 6) { - targetPos.y = g_vectorZero.y; - targetPos.x = g_vectorZero.x; - Entity_NPC::ThrowSpider(&this->_pos,GHIDRA_CAST(0x0),targetPos,0,-30.0); - } - break; - case GHIDRA_CAST(0x6f): - ::(GHIDRA_CAST((GHIDRA_CAST(auStack_60))))->Color::Color(); - Game::Fart(g_game,&this->_pos,85.0,GHIDRA_CAST(this),1.0,0,color); - Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,0,0); - break; - case GHIDRA_CAST(0x91): - spawned = (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(0x0)); - if (spawned != GHIDRA_CAST(0x0)) { - iVar16 = __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - *GHIDRA_CAST((iVar16 + 0xd88)) = 0xf; - pVVar8 = MusicManager::RandomVector(GHIDRA_CAST((auStack_34 + 8))); - uVar7 = Random(); - fVar14 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10; - fVar13 = pVVar8->y; - fVar1 = pVVar8->x; - *GHIDRA_CAST((iVar16 + 0x188)) = 0; - *GHIDRA_CAST((iVar16 + 0x364)) = fVar14 * fVar13 * 5.0; - *GHIDRA_CAST((iVar16 + 0x360)) = fVar14 * fVar1 * 5.0; - this = uStack_64; - } - break; - case GHIDRA_CAST(0x107): - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - iVar16 = ItemPool::GetCardEx(uVar7,0,1,0,1); - isOnlyRunes = 1; - bVar17 = 1; - bVar6 = 0; -LAB_004372ff: - queryCount = &DAT_00000007; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) = 5; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x8))) = 9; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x0))) = uVar7; - uVar7 = lua_callback_run_get_card(GHIDRA_CAST(auStack_34),iVar16,bVar6,bVar17,isOnlyRunes); - uVar11 = (GHIDRA_CAST((&uStack_64->_dropRNG)))->RNG::Next(); - pVVar8 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&uStack_64->_pos,40.0,0,0,0); - this = uStack_64; - Game::Spawn(g_game,5,300,pVVar8,&g_vectorZero,GHIDRA_CAST(uStack_64),uVar7,uVar11); - } -LAB_004372a0: - pEVar9 = GHIDRA_CAST(this->_wispCollectibleType); - if ((pEVar9 == GHIDRA_CAST(0x1ea)) || (pEVar9 == GHIDRA_CAST(0x203))) { - pvVar2 = this->_player; - itemListEnd = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de0)); - VStack_78.y = (float)pEVar9; - if (itemListEnd == *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de4))) { - msvc::vector::_Emplace_reallocate(itemListEnd,&VStack_78.y); - } - else { - *itemListEnd = GHIDRA_UINT(pEVar9); - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de0)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de0)) + 4; - } - } - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - (spawned->_posOffset).x = 0.0; - spawnedColor = &(spawned->_sprite)._color; - (spawned->_posOffset).y = -6.0; - if (0.0 < *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x110)) || *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x110)) == 0.0) { - if (spawnedColor != GHIDRA_CAST((GHIDRA_INT(wispConfig) + 0x104))) { - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x108)); - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x10c)); - fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x110)); - spawnedColor->_tint[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x104)); - (spawned->_sprite)._color._tint[1] = fVar13; - (spawned->_sprite)._color._tint[2] = fVar1; - (spawned->_sprite)._color._tint[3] = fVar14; - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x118)); - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x11c)); - fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x120)); - (spawned->_sprite)._color._colorize[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x114)); - (spawned->_sprite)._color._colorize[1] = fVar13; - (spawned->_sprite)._color._colorize[2] = fVar1; - (spawned->_sprite)._color._colorize[3] = fVar14; - *GHIDRA_CAST((spawned->_sprite)._color._offset) = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x124)); - layer1Color._offset[2] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 300)); - goto LAB_00438335; - } - } - else { - ::(GHIDRA_CAST((&layer1Color)))->Color::Color(); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layer1Color._colorize[0] = (layer->_color)._tint[0]; - layer1Color._colorize[1] = (layer->_color)._tint[1]; - layer1Color._colorize[2] = (layer->_color)._tint[2]; - layer1Color._colorize[3] = (layer->_color)._tint[3]; - if (spawnedColor != GHIDRA_CAST(&layer1Color)) { - spawnedColor->_tint[0] = layer1Color._tint[0]; - (spawned->_sprite)._color._tint[1] = layer1Color._tint[1]; - (spawned->_sprite)._color._tint[2] = layer1Color._tint[2]; - (spawned->_sprite)._color._tint[3] = layer1Color._tint[3]; - (spawned->_sprite)._color._colorize[0] = layer1Color._colorize[0]; - (spawned->_sprite)._color._colorize[1] = layer1Color._colorize[1]; - (spawned->_sprite)._color._colorize[2] = layer1Color._colorize[2]; - (spawned->_sprite)._color._colorize[3] = layer1Color._colorize[3]; - *GHIDRA_CAST((spawned->_sprite)._color._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(layer1Color._offset)) + 0x0))); -LAB_00438335: - (spawned->_sprite)._color._offset[2] = layer1Color._offset[2]; - } - } - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0xc,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); - (spawned->_posOffset).x = 0.0; - spawnedColor = &(spawned->_sprite)._color; - (spawned->_posOffset).y = -6.0; - if (0.0 < *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x13c)) || *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x13c)) == 0.0) { - if (spawnedColor == GHIDRA_CAST((GHIDRA_INT(wispConfig) + 0x130))) goto LAB_0043842f; - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x134)); - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x138)); - fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x13c)); - spawnedColor->_tint[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x130)); - (spawned->_sprite)._color._tint[1] = fVar13; - (spawned->_sprite)._color._tint[2] = fVar1; - (spawned->_sprite)._color._tint[3] = fVar14; - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x144)); - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x148)); - fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x14c)); - (spawned->_sprite)._color._colorize[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x140)); - (spawned->_sprite)._color._colorize[1] = fVar13; - (spawned->_sprite)._color._colorize[2] = fVar1; - (spawned->_sprite)._color._colorize[3] = fVar14; - *GHIDRA_CAST((spawned->_sprite)._color._offset) = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x150)); - layer0Color._offset[2] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x158)); - } - else { - ::(GHIDRA_CAST((&layer0Color)))->Color::Color(); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer0Color._colorize[0] = (layer->_color)._tint[0]; - layer0Color._colorize[1] = (layer->_color)._tint[1]; - layer0Color._colorize[2] = (layer->_color)._tint[2]; - layer0Color._colorize[3] = (layer->_color)._tint[3]; - if (spawnedColor == GHIDRA_CAST(&layer0Color)) goto LAB_0043842f; - spawnedColor->_tint[0] = layer0Color._tint[0]; - (spawned->_sprite)._color._tint[1] = layer0Color._tint[1]; - (spawned->_sprite)._color._tint[2] = layer0Color._tint[2]; - (spawned->_sprite)._color._tint[3] = layer0Color._tint[3]; - (spawned->_sprite)._color._colorize[0] = layer0Color._colorize[0]; - (spawned->_sprite)._color._colorize[1] = layer0Color._colorize[1]; - (spawned->_sprite)._color._colorize[2] = layer0Color._colorize[2]; - (spawned->_sprite)._color._colorize[3] = layer0Color._colorize[3]; - *GHIDRA_CAST((spawned->_sprite)._color._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(layer0Color._offset)) + 0x0))); - } - (spawned->_sprite)._color._offset[2] = layer0Color._offset[2]; -LAB_0043842f: - manager = g_manager; - wispConfig = (void *)0x105; - seed_fart_sound_override(GHIDRA_CAST(&wispConfig)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(wispConfig),1.0,2,0,1.0,0.0); - ExceptionList = local_1c; - return 1; -} - -// 004386f0 -Entity_Tear * Entity_Familiar::fire_wisp_projectile(Vector velocity) -{ - Entity_Familiar *dropRng = this; - uint32_t *puVar1; - code *pcVar2; - BitSet128 flags; - BitSet128 flags_00; - ANM2 *pAVar3; - uint8_t bVar4; - void *pvVar5; - Vector *vecResult; - Entity_Laser *laser; - int iVar6; - Entity_Tear *shot; - uint32_t uVar7; - int *effect; - Entity *blueFly; - BitSet128 *spectralFlags; - LayerState *layer; - uint32_t rngResult; - float *tearStats; - long double depthOffset; - float fVar8; - float fVar9; - float fVar10; - Entity_Familiar *pEVar11; - uint32_t uVar12; - TypeDescriptor *pTVar13; - TypeDescriptor *pTVar14; - uint32_t uVar15; - RNG local_e0; - Vector local_d0; - float fallingAccel; - Entity_Familiar *local_c4; - float tearScale; - float tearDamage; - Vector local_b8; - void *local_b0; - float local_ac; - int *local_a8; - uint32_t local_a4; - int *local_a0; - int *local_9c; - BitSet128 local_98; - float local_84; - uint32_t local_80; - float local_7c; - Vector scratchVec; - Entity *local_70; - Color tearColor; - ColorMod tmpColor; - float local_14; - RNG *dropRng; - - local_14 = (float)(__security_cookie ^ GHIDRA_UINT(((&tmpColor)[1]._tint + 1))); - if (dropRng->_variant == 0xed) { - iVar6 = dropRng->_wispCollectibleType; - } - else if (dropRng->_variant == 0xce) { - iVar6 = dropRng->_subtype; - } - else { - iVar6 = 0x248; - } - local_c4 = dropRng; - pvVar5 = ItemConfig::get_wisp_config(iVar6); - iVar6 = dropRng->_subtype; - local_b0 = pvVar5; - if (iVar6 == 0x10004) { - fire_robo_baby_laser(dropRng,&velocity); - return GHIDRA_CAST(0x0); - } - if (iVar6 == 0x1000d) { - local_84 = velocity.y; - scratchVec.y = velocity.y; - local_9c = GHIDRA_CAST(velocity.x); - scratchVec.x = velocity.x; - fVar8 = sqrtf(velocity.y * velocity.y + velocity.x * velocity.x); - if (0.0 < fVar8) { - local_9c = GHIDRA_CAST(((1.0 / fVar8) * (float)local_9c)); - local_84 = local_84 * (1.0 / fVar8); - scratchVec.x = (float)local_9c; - scratchVec.y = local_84; - } - bVar4 = 0; - vecResult = Vector::ToCardinal(&local_b8,&scratchVec); - laser = FireBrimstone(dropRng,vecResult,bVar4); - iVar6 = *GHIDRA_CAST(laser); - (laser->_posOffset).x = (float)local_9c * 7.0; - (laser->_posOffset).y = local_84 * 5.0 - 18.0; -LAB_00438842: - (**(code **)(iVar6 + 0xc))(); - dropRng->_headFrameDelay = 0x1e; - if (ABS(local_84) < ABS((float)local_9c)) { - iVar6 = 2; - if ((float)local_9c < 0.0) { - iVar6 = 0; - } - PlayShootAnim(dropRng,iVar6); - return GHIDRA_CAST(0x0); - } - PlayShootAnim(dropRng,GHIDRA_UINT((0.0 <= local_84)) * 2 + 1); - return GHIDRA_CAST(0x0); - } - if (iVar6 == 0x10011) { - local_84 = velocity.y; - scratchVec.y = velocity.y; - local_9c = GHIDRA_CAST(velocity.x); - scratchVec.x = velocity.x; - fVar8 = sqrtf(velocity.y * velocity.y + velocity.x * velocity.x); - if (0.0 < fVar8) { - local_9c = GHIDRA_CAST(((1.0 / fVar8) * (float)local_9c)); - local_84 = local_84 * (1.0 / fVar8); - scratchVec.x = (float)local_9c; - scratchVec.y = local_84; - } - bVar4 = 0; - vecResult = Vector::ToCardinal(&local_b8,&scratchVec); - laser = FireBrimstone(dropRng,vecResult,bVar4); - (**(code **)(*GHIDRA_CAST(laser) + 0x40)) - (*GHIDRA_CAST((GHIDRA_CAST(local_b0) + 4)) * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34))))); - (laser->_posOffset).x = (float)local_9c * 7.0; - (laser->_posOffset).y = local_84 * 5.0 - 18.0; - iVar6 = *GHIDRA_CAST(laser); - goto LAB_00438842; - } - if (iVar6 == 0x1000f) { - if (dropRng->_player->_numBlueFlies < 5) { - (GHIDRA_CAST((dropRng->_player)))->Entity_Player::AddBlueFlies(1,&dropRng->_pos,GHIDRA_CAST(0x0)); - return GHIDRA_CAST(0x0); - } - return GHIDRA_CAST(0x0); - } - if (iVar6 == 0x22c) { - (GHIDRA_CAST((&velocity)))->Vector::Normalized(&scratchVec); - bVar4 = 1; - vecResult = Vector::ToCardinal(&local_b8,&scratchVec); - shot = GHIDRA_CAST(FireBrimstone(dropRng,vecResult,bVar4)); - pAVar3 = &shot->_tearHaloANM2; - (pAVar3->_animDefaultName)._buf[0xc] = '\0'; - (pAVar3->_animDefaultName)._buf[0xd] = '\0'; - (pAVar3->_animDefaultName)._buf[0xe] = '4'; - (pAVar3->_animDefaultName)._buf[0xf] = 'C'; - (shot->_posOffset).x = scratchVec.x * 7.0; - (shot->_posOffset).y = scratchVec.y * 5.0 - 18.0; - pcVar2 = *(code **)(*GHIDRA_CAST(shot) + 0x40); - fVar8 = apply_tear_modifiers(local_c4); - (*pcVar2)(fVar8 * 3.5); - pEVar11 = local_c4; - apply_baby_bender(local_c4,shot); - (GHIDRA_CAST((GHIDRA_CAST(pEVar11))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(shot)); - shot->Update(); - depthOffset = (long double)copysignf(0x40a00000,shot->_renderDepthOffset); - shot->_renderDepthOffset = (float)depthOffset; - pEVar11->_headFrameDelay = 0x1e; - iVar6 = vector_to_direction(&scratchVec); - PlayShootAnim(pEVar11,iVar6); - return GHIDRA_CAST(0x0); - } - if (iVar6 == 0x121) { - Vector::ToCardinal(&scratchVec,&velocity); - uVar7 = Random(); - uVar15 = 0; - pTVar14 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - local_b8.x = scratchVec.x * 5.0 + velocity.x; - pTVar13 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - local_b8.y = scratchVec.y * 5.0 + velocity.y; - blueFly = Game::Spawn(g_game,1000,0x34,&dropRng->_pos,&local_b8,GHIDRA_CAST(dropRng),0,uVar7); - effect = GHIDRA_CAST(__RTDynamicCast(blueFly,uVar12,pTVar13,pTVar14,uVar15)); - (**(code **)(*effect + 0x40))(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * 10.0); - effect[0x11e] = 0x3f000000; - effect[0x117] = 0x96; - effect[0x118] = 0x96; - (**(code **)(*effect + 0xc))(); - return GHIDRA_CAST(0x0); - } - local_a8 = GHIDRA_CAST(0x0); - if (iVar6 == 0x280) { - uVar7 = Random(); - if (uVar7 % 7 == 0) { - Vector::ToCardinal(&scratchVec,&velocity); - uVar7 = Random(); - uVar15 = 0; - pTVar14 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - local_b8.x = scratchVec.x * 5.0 + velocity.x; - pTVar13 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - local_b8.y = scratchVec.y * 5.0 + velocity.y; - blueFly = Game::Spawn(g_game,1000,10,&dropRng->_pos,&local_b8,GHIDRA_CAST(dropRng),0,uVar7); - effect = GHIDRA_CAST(__RTDynamicCast(blueFly,uVar12,pTVar13,pTVar14,uVar15)); - (**(code **)(*effect + 0x40))(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * 10.0); - effect[0x11e] = 0x3f000000; - effect[0x117] = 0x5a; - effect[0x118] = 0x5a; - (**(code **)(*effect + 0xc))(); - return GHIDRA_CAST(0x0); - } - } - else if (iVar6 == 0x242) { - dropRng->_coins = dropRng->_coins + 1; - if ((dropRng->_coins & 1) == 0) { - uVar7 = Random(); - blueFly = Game::Spawn(g_game,1000,0x2e,&dropRng->_pos,&g_vectorZero,GHIDRA_CAST(dropRng),0,uVar7); - iVar6 = *GHIDRA_CAST(blueFly); - pAVar3 = &blueFly[1]._sprite; - (pAVar3->_filename)._buf[4] = 'Z'; - (pAVar3->_filename)._buf[5] = '\0'; - (pAVar3->_filename)._buf[6] = '\0'; - (pAVar3->_filename)._buf[7] = '\0'; - pAVar3 = &blueFly[1]._sprite; - (pAVar3->_filename)._buf[8] = 'Z'; - (pAVar3->_filename)._buf[9] = '\0'; - (pAVar3->_filename)._buf[10] = '\0'; - (pAVar3->_filename)._buf[0xb] = '\0'; - (**(code **)(iVar6 + 0x40))(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * 7.0); - blueFly->Update(); - tmpColor._tint[0] = 1.0; - tmpColor._tint[1] = 1.0; - tmpColor._tint[2] = 1.0; - tmpColor._tint[3] = 1.0; - tmpColor._offset[0] = 0.0; - tmpColor._colorize[0] = 6.0714; - tmpColor._colorize[1] = 5.7857; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 1.0; - tmpColor._offset[1] = 0.0; - tmpColor._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(&blueFly->_sprite))))->Sprite::SetColor(&tmpColor); - pvVar5 = local_b0; - } - } - else if (iVar6 == 0x27f) { - uVar7 = Random(); - if (uVar7 % 10 != 0) { - return GHIDRA_CAST(0x0); - } - puVar1 = &dropRng->_linkedEntity; - if (dropRng->_linkedEntity != 0) { - return GHIDRA_CAST(0x0); - } - blueFly = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::AddBlueFlies(1,&dropRng->_pos,GHIDRA_CAST(0x0)); - if (blueFly == GHIDRA_CAST(0x0)) { - return GHIDRA_CAST(0x0); - } - if (*puVar1 != 0) { - local_a0 = puVar1; - msvc::multiset::erase(&local_a0); - } - *puVar1 = blueFly; - msvc::multiset::insert(puVar1); - return GHIDRA_CAST(0x0); - } - local_ac = 0.8; - bVar4 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar4 == 0) { - local_84 = 1.0; - } - else { - local_84 = 2.0; - } - bVar4 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar4 != 0) { - local_ac = 1.0; - } - fallingAccel = 0.0; - (GHIDRA_CAST((&tearColor)))->Color::Color(); - iVar6 = _get_index_plus_one_if_kind_4_5(); - local_a0 = GHIDRA_CAST(((float)(iVar6 + -1) * *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 8)) + *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 4)) - )); - uVar7 = Random(); - tearStats = GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0x60)); - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xa8)) <= - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10) { - tearStats = GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0x18)); - } - tearDamage = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf30)))) * *tearStats * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * - (float)local_a0; - fVar8 = sqrtf(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf30))))); - fVar8 = fVar8 * tearStats[1] * local_ac; - tearScale = fVar8; - spectralFlags = - BitSet128::operator_or - (GHIDRA_CAST(&local_e0),&g_tearFlagSpectral,GHIDRA_CAST((tearStats + 0xe))); - local_a4 = GHIDRA_UINT(spectralFlags->_l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&spectralFlags->_l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(spectralFlags->_h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&spectralFlags->_h) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4; - local_80 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); - local_7c = (float)GHIDRA_UINT(local_98._h); - local_70 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_98._h))) + 0x4))); - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(GHIDRA_CAST((tearStats + 3))); - local_a0 = GHIDRA_CAST(tearStats[2]); - velocity.x = velocity.x * *GHIDRA_CAST((GHIDRA_CAST(local_b0) + 0xc)); - velocity.y = velocity.y * *GHIDRA_CAST((GHIDRA_CAST(local_b0) + 0xc)); - uVar7 = dropRng->_subtype; - local_b0 = (void *)velocity.x; - local_ac = velocity.y; - local_9c = local_a0; - if (uVar7 < 0x9f) { - if (uVar7 == 0x9e) { - scratchVec.x = velocity.x; - local_d0.y = sqrtf(velocity.y * velocity.y + velocity.x * velocity.x); - local_b0 = (void *)((float)local_b0 / local_d0.y); - local_70 = GHIDRA_CAST(0x0); - local_b8.y = (float)g_game->_room; - local_80 = 0; - local_ac = local_ac / local_d0.y; - local_7c = 0.0; - if (*GHIDRA_CAST((GHIDRA_CAST(local_b8.y) + 0x1264)) != 0) { - do { - blueFly = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_b8.y) + 0x125c)) + local_80 * 4)); - fVar8 = (blueFly->_pos).y - (dropRng->_pos).y; - fVar10 = (blueFly->_pos).x - (dropRng->_pos).x; - scratchVec.y = sqrtf(fVar8 * fVar8 + fVar10 * fVar10); - bVar4 = (GHIDRA_CAST((blueFly)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (((bVar4 != 0) && ((blueFly->_flags & 0x20000000) == 0)) && (blueFly->_dead == 0)) { - local_a0 = GHIDRA_CAST(((blueFly->_pos).x - (dropRng->_pos).x)); - local_c4 = GHIDRA_CAST(((blueFly->_pos).y - (dropRng->_pos).y)); - fVar8 = sqrtf((float)local_a0 * (float)local_a0 + (float)local_c4 * (float)local_c4); - pEVar11 = local_c4; - effect = local_a0; - if (0.0 < fVar8) { - pEVar11 = GHIDRA_CAST(((float)local_c4 * (1.0 / fVar8))); - effect = GHIDRA_CAST(((float)local_a0 * (1.0 / fVar8))); - } - fVar8 = (float)local_b0 * (float)effect + local_ac * (float)pEVar11; - if (0.8 <= fVar8) { - fVar10 = 800.0 - scratchVec.y; - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - fVar9 = 400.0 - blueFly->_health; - if (fVar9 <= 0.0) { - fVar9 = 0.0; - } - fVar9 = fVar8 * 2000.0 + 0.0 + fVar10 + fVar9; - if (local_7c < fVar9) { - local_7c = fVar9; - local_70 = blueFly; - } - } - } - blueFly = local_70; - local_80 = local_80 + 1; - } while (local_80 < *GHIDRA_CAST((GHIDRA_CAST(local_b8.y) + 0x1264))); - if (local_70 != GHIDRA_CAST(0x0)) { - fVar8 = (dropRng->_pos).y - (local_70->_pos).y; - fVar10 = (dropRng->_pos).x - (local_70->_pos).x; - fVar8 = sqrtf(fVar8 * fVar8 + fVar10 * fVar10); - scratchVec.y = (fVar8 * (blueFly->_velocity).y * 0.05 + (blueFly->_pos).y) - - (dropRng->_pos).y; - scratchVec.x = (fVar8 * (blueFly->_velocity).x * 0.05 + (blueFly->_pos).x) - - (dropRng->_pos).x; - vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::Resized(&local_b8,local_d0.y); - velocity.x = vecResult->x; - velocity.y = vecResult->y; - } - } - goto switchD_00438fa0_caseD_27; - } - switch(uVar7) { - case 0x26: - uVar7 = Random(); - local_a0 = GHIDRA_CAST((((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)] - ) * 2.3283064e-10 * 40.0 - 20.0) * 0.017453292)); - local_ac = cos((float)local_a0); - fVar8 = sin((float)local_a0); - fVar10 = fVar8 * velocity.x; - velocity.x = local_ac * velocity.x - fVar8 * velocity.y; - velocity.y = local_ac * velocity.y + fVar10; - break; - case 0x28: - uVar7 = Random(); - local_a8 = GHIDRA_CAST(((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) - * 2.3283064e-10 + 1.0 + 0.0)); - break; - case 0x2a: - fallingAccel = 0.6; - uVar7 = Random(); - local_a8 = GHIDRA_CAST((0.0 - ((float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 + 5.0))); - break; - case 0x2f: - if (((*GHIDRA_CAST((GHIDRA_CAST(dropRng->_player) + 0x1600)) == 0x2f) && - (iVar6 = *GHIDRA_CAST((GHIDRA_CAST(dropRng->_player) + 0x13dc)), iVar6 != 0)) && - ((*GHIDRA_CAST((iVar6 + 0x30)) == 6 && - ((iVar6 = *GHIDRA_CAST((iVar6 + 0x44)), iVar6 != 0 && - (0xf < g_game->_frameCount - *GHIDRA_CAST((iVar6 + 0x328)))))))) { - local_ac = *GHIDRA_CAST((iVar6 + 0x340)); - local_a0 = *GHIDRA_CAST((iVar6 + 0x33c)); - vecResult = MusicManager::RandomVector(&scratchVec); - uVar7 = Random(); - local_c4 = GHIDRA_CAST((dropRng->_pos).x); - fVar8 = (dropRng->_pos).y; - fallingAccel = 1.2; - fVar10 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10; - scratchVec.y = fVar10 * vecResult->y * 120.0 + local_ac; - local_b8.y = fVar10 * vecResult->x * 120.0 + (float)local_a0; - velocity.y = (scratchVec.y - fVar8) / 20.0; - velocity.x = (local_b8.y - (float)local_c4) / 20.0; - fVar10 = velocity.y * velocity.y + velocity.x * velocity.x; - local_d0.y = velocity.y; - local_b0 = (void *)velocity.y; - local_ac = fVar8; - local_a8 = GHIDRA_CAST(velocity.x); - local_a0 = GHIDRA_CAST(velocity.x); - if (225.0 < fVar10) { - fVar8 = sqrtf(fVar10); - local_a8 = local_a0; - local_b0 = (void *)local_d0.y; - if (0.0 < fVar8) { - local_b0 = (void *)((15.0 / fVar8) * local_d0.y); - local_a8 = GHIDRA_CAST(((15.0 / fVar8) * (float)local_a0)); - } - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagExplosive._l); - tearDamage = tearDamage * 4.0 + 8.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagExplosive._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._h)) + 0x4))); - tearScale = tearScale * 1.5; - velocity.x = (float)local_a8; - velocity.y = (float)local_b0; - local_70 = (Entity *) - sqrtf((local_ac - scratchVec.y) * (local_ac - scratchVec.y) + - ((float)local_c4 - local_b8.y) * ((float)local_c4 - local_b8.y)); - fVar8 = sqrtf((float)local_b0 * (float)local_b0 + (float)local_a8 * (float)local_a8); - local_70 = GHIDRA_CAST(((float)local_70 / fVar8)); - fVar8 = pow(0.9,(float)local_70); - fVar8 = (fVar8 - 1.0) * -9.491221; - if (fVar8 <= 0.01) { - fVar8 = 0.01; - } - local_a8 = GHIDRA_CAST(((18.0 - ((float)local_70 - fVar8) * 13.0) / fVar8)); - } - break; - case 0x38: - local_a8 = GHIDRA_CAST(0x3f19999a); - break; - case 0x4d: -switchD_00438fa0_caseD_4d: - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - scratchVec.y = (layer->_color)._tint[0] * 0.5; - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - local_b8.y = (layer->_color)._tint[1] * 0.5; - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - tmpColor._offset[2] = (layer->_color)._tint[2] * 0.5; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - tmpColor._tint[3] = 1.0; - tmpColor._tint[0] = scratchVec.y * 1.25; - tmpColor._tint[1] = local_b8.y * 1.25; - tmpColor._tint[2] = tmpColor._offset[2] * 1.25; - tmpColor._offset[0] = scratchVec.y * 0.25; - tmpColor._offset[1] = local_b8.y * 0.25; - tmpColor._offset[2] = tmpColor._offset[2] * 0.25; - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); - break; - case 0x66: - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - scratchVec.y = (layer->_color)._tint[0] * 0.5; - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - local_b8.y = (layer->_color)._tint[1] * 0.5; - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - tmpColor._offset[2] = (layer->_color)._tint[2] * 0.5; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - tmpColor._tint[3] = 1.0; - tmpColor._tint[0] = scratchVec.y * 1.25; - tmpColor._tint[1] = local_b8.y * 1.25; - tmpColor._tint[2] = tmpColor._offset[2] * 1.25; - tmpColor._offset[0] = scratchVec.y * 0.25; - tmpColor._offset[1] = local_b8.y * 0.25; - tmpColor._offset[2] = tmpColor._offset[2] * 0.25; - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); - uVar7 = Random(); - if ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 < 0.15) { - switch(dropRng->_coins) { - case 1: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagPoison._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagPoison._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4))); - break; - case 2: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagFreeze._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagFreeze._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._h)) + 0x4))); - break; - case 3: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagConfusion._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagConfusion._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._h)) + 0x4))); - break; - case 4: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagBurn._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagBurn._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._h)) + 0x4))); - break; - case 5: - dropRng = &dropRng->_dropRNG; - local_b8.y = (float)(GHIDRA_CAST((dropRng)))->RNG::Next(); - uVar7 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - vecResult = RandomVector(&local_d0,uVar7); - fVar8 = (GHIDRA_CAST((dropRng)))->RNG::RandomFloat(); - dropRng = local_c4; - scratchVec.x = fVar8 * 2.0 + 2.0; - scratchVec.y = scratchVec.x * vecResult->y; - scratchVec.x = scratchVec.x * vecResult->x; - blueFly = Game::Spawn(g_game,4,3,&local_c4->_pos,&scratchVec,GHIDRA_CAST(0x0),0, - GHIDRA_UINT(local_b8.y)); - blueFly->Update(); - } - } - break; - case 0x7b: - local_e0._seed = dropRng->_initSeed; - local_e0._shift3 = 9; - local_e0._shift1 = 2; - local_e0._shift2 = 0x15; - familiar_wisp_pick_tear_color(&local_e0,GHIDRA_CAST(&local_a0),&local_98); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = GHIDRA_UINT(local_98._l) | GHIDRA_UINT(g_tearFlagSpectral._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_98._h) | GHIDRA_UINT(g_tearFlagSpectral._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))); - scratchVec.y = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); - tearDamage = (scratchVec.y * 0.4 + 0.8) * tearDamage; - fVar8 = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); - fallingAccel = 0.0; - local_d0.y = fVar8 * 0.4 - 0.2; - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - scratchVec.y = (layer->_color)._tint[0] * 0.5; - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - local_b8.y = (layer->_color)._tint[1] * 0.5; - layer = ANM2::GetLayer(&dropRng->_sprite,GHIDRA_CAST(0x1)); - tmpColor._offset[2] = (layer->_color)._tint[2] * 0.5; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - tmpColor._tint[3] = 1.0; - tmpColor._tint[0] = scratchVec.y * 1.25; - tmpColor._tint[1] = local_b8.y * 1.25; - tmpColor._tint[2] = tmpColor._offset[2] * 1.25; - tmpColor._offset[0] = scratchVec.y * 0.25; - tmpColor._offset[1] = local_b8.y * 0.25; - tmpColor._offset[2] = tmpColor._offset[2] * 0.25; - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); - fVar8 = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); - local_9c = local_a0; - scratchVec.y = fVar8 * 0.6 + 0.7; - velocity.y = scratchVec.y * velocity.y; - velocity.x = scratchVec.y * velocity.x; - local_a8 = GHIDRA_CAST(local_d0.y); - } - goto switchD_00438fa0_caseD_27; - } - if (0x204 < uVar7) { - if (uVar7 == 0x246) { - pvVar5 = dropRng->_player; - iVar6 = TemporaryEffects::GetCollectibleEffectNum - (GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0x1508)),0x246); - scratchVec.y = (float)iVar6 * 0.75; - iVar6 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0x1508)))))->TemporaryEffects::GetNullEffectNum(0x47); - local_84 = (float)iVar6 * 0.3 + scratchVec.y + local_84; - fVar8 = sqrtf(local_84); - tearScale = fVar8 * 0.23 + local_84 * 0.01 + 0.55; - goto switchD_00438fa0_caseD_27; - } - if (uVar7 == 0x263) { - tearDamage = (float)dropRng->_keys * 0.5 * tearDamage; - tearScale = ((float)dropRng->_keys * 0.1 + 1.0) * fVar8; - goto switchD_00438fa0_caseD_27; - } - if (uVar7 != 0x1000e) goto switchD_00438fa0_caseD_27; -LAB_00439c27: - vecResult = MusicManager::RandomVector(&scratchVec); - uVar7 = Random(); - fVar8 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10; - fVar10 = fVar8 * vecResult->y; - fVar8 = fVar8 * vecResult->x; - velocity.y = fVar10 + fVar10 + velocity.y; - velocity.x = fVar8 + fVar8 + velocity.x; - uVar7 = Random(); - fallingAccel = 0.5; - fVar8 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.25; - velocity.y = fVar8 * velocity.y; - velocity.x = fVar8 * velocity.x; - uVar7 = Random(); - rngResult = Random(); - tearScale = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) - * 2.3283064e-10 * 0.05 + ((float)(uVar7 & 1) + 0.0) * 0.4 + 0.9) * tearScale; - uVar7 = Random(); - local_a8 = GHIDRA_CAST((0.0 - ((float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 - * 15.0 + 5.0))); - goto switchD_00438fa0_caseD_27; - } - if (uVar7 == 0x204) { - dropRng->_coins = dropRng->_coins + 1; - goto switchD_00438fa0_caseD_27; - } - switch(uVar7) { - case 0x12a: - goto switchD_00438fa0_caseD_4d; - default: - goto switchD_00438fa0_caseD_27; - case 0x144: - break; - case 0x145: - local_9c = GHIDRA_CAST(0x1); - goto LAB_00439c27; - case 0x196: - local_e0._seed = (dropRng->_dropRNG)._seed; - local_e0._shift1 = 2; - local_e0._shift2 = 7; - local_e0._shift3 = 7; - scratchVec.y = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); - tearDamage = (scratchVec.y * 2.0 - 1.0) + tearDamage; - goto switchD_00438fa0_caseD_27; - } - uVar7 = Random(); - switch(uVar7 % 9) { - case 1: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagBurn._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagBurn._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._h)) + 0x4))); - local_9c = GHIDRA_CAST(0x5); - break; - case 2: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagCharm._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagCharm._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._h)) + 0x4))); - tearColor._tint[0] = 1.0; - tearColor._tint[1] = 0.0; - tearColor._tint[2] = 1.0; - tearColor._tint[3] = 1.0; - tearColor._offset[0] = 0.19607845; - tearColor._offset[1] = 0.0; - tearColor._offset[2] = 0.0; - break; - case 3: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagConfusion._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagConfusion._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._h)) + 0x4))); - tearColor._tint[0] = 0.5; - tearColor._tint[1] = 0.5; - tearColor._tint[2] = 0.5; - tearColor._tint[3] = 1.0; - break; - case 4: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagFear._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFear._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagFear._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFear._h)) + 0x4))); - tearColor._tint[0] = 1.0; - tearColor._tint[1] = 1.0; - tearColor._tint[2] = 0.455; - tearColor._tint[3] = 1.0; - tearColor._offset[0] = 0.169; - tearColor._offset[1] = 0.145; - tearColor._offset[2] = 0.0; - break; - case 5: - tearColor._tint[0] = 1.25; - tearColor._tint[1] = 0.05; - tearColor._tint[2] = 0.15; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagFreeze._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagFreeze._h); - goto LAB_00439f99; - case 6: - tearColor._tint[0] = 0.4; - tearColor._tint[1] = 0.97; - tearColor._tint[2] = 0.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagPoison._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagPoison._h); -LAB_00439f99: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(local_98._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(local_98._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))); - tearColor._tint[3] = 1.0; - tearColor._offset[0] = 0.0; - tearColor._offset[1] = 0.0; - tearColor._offset[2] = 0.0; - break; - case 7: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagSlow._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagSlow._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4))); - tearColor._tint[0] = 2.0; - tearColor._tint[1] = 2.0; - tearColor._tint[2] = 2.0; - tearColor._tint[3] = 1.0; - tearColor._offset[0] = 0.19607845; - tearColor._offset[1] = 0.19607845; - tearColor._offset[2] = 0.19607845; - break; - case 8: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagShrink._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagShrink._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._h)) + 0x4))); - tearColor._colorize[0] = 0.3; - tearColor._colorize[1] = 0.4; - tearColor._colorize[2] = 1.0; - tearColor._colorize[3] = 1.5; - } -switchD_00438fa0_caseD_27: - local_70 = GHIDRA_CAST(g_vectorZero.x); - local_7c = g_vectorZero.y; - if (dropRng->_subtype == 0x15b) { - vecResult = (GHIDRA_CAST((&velocity)))->Vector::Normalized(&local_b8); - scratchVec.y = cos(1.5707964); - fVar8 = sin(1.5707964); - local_70 = GHIDRA_CAST(((vecResult->x * scratchVec.y - vecResult->y * fVar8) * 5.0)); - local_7c = (vecResult->y * scratchVec.y + vecResult->x * fVar8) * 5.0; - uVar7 = Random(); - scratchVec.x = (float)local_70 + (dropRng->_pos).x; - scratchVec.y = local_7c + (dropRng->_pos).y; - shot = (Entity_Tear *) - Game::Spawn(g_game,2,GHIDRA_UINT(local_9c),&scratchVec,&velocity,GHIDRA_CAST(dropRng),0,uVar7); - uVar7 = Random(); - shot->_fallingSpeed = - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 - * 0.2 + (float)local_a8; - shot->_fallingAccel = fallingAccel; - shot->SetCollisionDamage(tearDamage * local_84); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = GHIDRA_UINT(local_98._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = GHIDRA_UINT(local_98._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))); - (GHIDRA_CAST((shot)))->Entity_Tear::SetTearFlags(flags); - (GHIDRA_CAST((shot)))->Entity_Tear::SetScale(tearScale); - (GHIDRA_CAST((GHIDRA_CAST(shot))))->Entity::SetParent(GHIDRA_CAST(dropRng)); - shot->SetColor(&tearColor,0xffffffff,0xff,0,1); - uVar7 = Random(); - local_70 = GHIDRA_CAST(-(float)local_70); - local_7c = -local_7c; - shot->_tearIdx = uVar7 & 1; - bVar4 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasTrinket(0x7f,0); - if (bVar4 != 0) { - TryFireTear(dropRng,shot); - } - } - uVar7 = Random(); - scratchVec.x = (float)local_70 + (dropRng->_pos).x; - scratchVec.y = local_7c + (dropRng->_pos).y; - shot = (Entity_Tear *) - Game::Spawn(g_game,2,GHIDRA_UINT(local_9c),&scratchVec,&velocity,GHIDRA_CAST(dropRng),0,uVar7); - uVar7 = Random(); - shot->_fallingSpeed = - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * - 0.2 + (float)local_a8; - shot->_fallingAccel = fallingAccel; - shot->SetCollisionDamage(tearDamage * local_84); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x0))) = GHIDRA_UINT(local_98._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x0))) = GHIDRA_UINT(local_98._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))); - (GHIDRA_CAST((shot)))->Entity_Tear::SetTearFlags(flags_00); - (GHIDRA_CAST((shot)))->Entity_Tear::SetScale(tearScale); - (GHIDRA_CAST((GHIDRA_CAST(shot))))->Entity::SetParent(GHIDRA_CAST(dropRng)); - shot->SetColor(&tearColor,0xffffffff,0xff,0,1); - uVar7 = Random(); - shot->_tearIdx = uVar7 & 1; - bVar4 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasTrinket(0x7f,0); - if (bVar4 != 0) { - TryFireTear(dropRng,shot); - } - return shot; -} - -// 0043a5e0 -uint32_t Entity_Familiar::wisp_take_damage(float *param_2, uint32_t *param_3, int *param_4) -{ - uint8_t bVar1; - char cVar2; - Entity *fearTarget; - uint32_t uVar3; - uint32_t uVar4; - Entity_Effect *spawnedEffect; - EntityRef *pEVar5; - int unusedArg; - bool bVar6; - Entity_Familiar *local_3c; - Entity *local_38; - EntityRef selfRef; - Manager *manager; - uint32_t *parentSlot; - void *room; - int sourceType; - int wispItem; - - local_3c = this; - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - return 0; - } - sourceType = *param_4; - if (((sourceType == 1) || (sourceType == 3)) && ((*param_3 & 0x1000000) != 0)) { - return 0; - } - if (this->_variant != 0xce) { - return 1; - } - wispItem = this->_subtype; - if (wispItem < 0xa1) { - if (wispItem == 0xa0) { - if (0x3dd < sourceType - 10U) { - return 1; - } - uVar4 = Random(); - spawnedEffect = - (Entity_Effect *) - Game::SpawnEx(g_game,1000,0x13,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4,0); - local_38 = this->_player; - parentSlot = &spawnedEffect->_parent; - local_3c = GHIDRA_CAST(spawnedEffect); - if (spawnedEffect->_parent != 0) { - local_3c = GHIDRA_CAST(parentSlot); - msvc::multiset::erase(&local_3c); - } - *parentSlot = local_38; - if (local_38 != (void *)0x0) { - msvc::multiset::insert(parentSlot); - } - spawnedEffect->SetCollisionDamage(0x41400000); - local_3c = GHIDRA_CAST((GHIDRA_UINT(g_vectorOne.x) ^ 0x80000000)); - local_38 = GHIDRA_CAST(-g_vectorOne.y); - (GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity::SetSize(80.0, - (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); - spawnedEffect->_subtype = 1; - return 1; - } - switch(wispItem) { - case 0x28: - if ((*param_3 & 4) != 0) { - return 0; - } - if ((GHIDRA_CAST(param_4[9]) != GHIDRA_CAST(0x0)) && - (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(param_4[9]))))->Entity::IsEnemy(), bVar1 != 0)) { - *param_2 = *param_2 * 3.0; - } - break; - case 0x3a: - if (sourceType < 10) { - return 0; - } - bVar6 = sourceType == 1000; - goto LAB_0043a7f7; - case 0x5d: - if (((this->_target == 0) && ((sourceType < 10 || (sourceType == 1000)))) && - (GHIDRA_CAST(param_4[9]) != GHIDRA_CAST(0x0))) { - fearTarget = (GHIDRA_CAST((GHIDRA_CAST(param_4[9]))))->Entity::GetLastSpawner(); - bVar1 = (GHIDRA_CAST((fearTarget)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - selfRef._type = this->_type; - selfRef._spawnerType = this->_spawnerType; - selfRef._position.x = (this->_pos).x; - selfRef._position.y = (this->_pos).y; - selfRef._spawnerVariant = this->_spawnerVariant; - selfRef._variant = this->_variant; - selfRef._velocity.x = (this->_velocity).x; - selfRef._velocity.y = (this->_velocity).y; - if ((this->_flags & 0x20000000) == 0) { - uVar4 = 0; - } - else { - uVar4 = 2; - } - local_3c = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) & 0x400000)); - if (local_3c == GHIDRA_CAST(0x0)) { - uVar3 = 0; - } - else { - uVar3 = 4; - } - selfRef._flags = uVar3 | uVar4 | GHIDRA_UINT(((this->_flags & 0x100) != 0)); - selfRef._entity = this; - (GHIDRA_CAST((fearTarget)))->Entity::AddFear(&selfRef,2,0); - bVar1 = (GHIDRA_CAST((fearTarget)))->Entity::HasEntityFlags(0x800); - if (bVar1 != 0) { - if (this->_target != 0) { - local_3c = GHIDRA_CAST(&this->_target); - msvc::multiset::erase(&local_3c); - } - this->_target = fearTarget; - if (fearTarget != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&this->_target); - } - this->_counter = 0x96; - return 1; - } - } - } - break; - case 0x7f: - goto switchD_0043a658_caseD_7f; - } - } - else { - if (wispItem == 0x27e) { - if (GHIDRA_CAST(param_4[9]) == GHIDRA_CAST(0x0)) { - return 0; - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(param_4[9]))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar1 == 0) { - return 0; - } - cVar2 = (**(code **)(*GHIDRA_CAST(param_4[9]) + 0x4c))(); - if ((cVar2 != '\0') && (*GHIDRA_CAST((param_4[9] + 0x14)) < *GHIDRA_CAST((param_4[9] + 0x380)))) { - return 0; - } - bVar6 = false; - Game::AddErasedEnemy(GHIDRA_CAST(param_4[9])); - uVar4 = 0; - room = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { - do { - local_38 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar4 * 4)); - bVar1 = Game::ShouldEraseEnemy(local_38); - if (bVar1 != 0) { - Entity::RemoveWithPoof(local_38,unusedArg); - bVar6 = true; - } - this = local_3c; - manager = g_manager; - uVar4 = uVar4 + 1; - } while (uVar4 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); - if (bVar6) { - local_3c = GHIDRA_CAST(0xed); - seed_fart_sound_override(GHIDRA_CAST(&local_3c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_3c),1.0,2,0,1.0,0.0); - } - } - pEVar5 = (GHIDRA_CAST((&selfRef)))->EntityRef::EntityRef(); - this->Kill(pEVar5); - return 0; - } - if (wispItem != 0x28a) { - if (wispItem == 0x2be) { - return 0; - } - return 1; - } - bVar6 = this->_state == 1; -LAB_0043a7f7: - if (bVar6) { -switchD_0043a658_caseD_7f: - return 0; - } - } - return 1; -} - -// 0043aa90 -void Entity_Familiar::ai_wisp() -{ - uint32_t *puVar1; - void *pvVar2; - Entity_Player *player; - GridEntity_Door *pickup; - code *pcVar3; - ANM2 *pAVar4; - char cVar5; - uint8_t bVar6; - uint32_t uVar7; - int *piVar8; - Entity *pEVar9; - LayerState *layer; - Entity_Laser *laser; - ColorMod *Color; - uint32_t extraout_EAX; - ColorMod *extraout_EAX_00; - ColorMod *extraout_EAX_01; - int cooldown; - float *extraout_EAX_02; - float *extraout_EAX_03; - Vector *orbitDistance; - Entity_Effect *splat; - EntityRef *killSource; - Entity_Tear *tear; - char *anim; - uint8_t *anim_00; - Vector *vec; - ColorMod *color; - code *extraout_EDX; - code *extraout_EDX_00; - code *extraout_EDX_01; - uint32_t pickupIndex; - int iVar10; - bool bVar11; - float fVar12; - float fVar13; - Room *pRVar14; - Entity *pEVar15; - float fVar16; - Entity_Familiar *source; - EntityRef parentDeadKillSource; - EntityRef timeoutKillSource; - EntityRef pickupCollideKillSource; - EntityRef chestOpenKillSource; - EntityRef lockUnlockKillSource; - EntityRef doorUnlockKillSource; - EntityRef noParentKillSource; - EntityRef nullEffectKillSource; - EntityRef gridDamageSource; - KColor secondaryHueColor; - EntityRef targetDamageSource; - EntityRef fearSource; - Color fadeColor; - Vector toEnemyDir; - Vector layerOrbitDistance; - Vector cardinalVelocity; - Vector toParentDir; - Vector lemonadeSplatOffset; - Vector spawnOrbitPos; - Vector lemonSplatOffset; - Vector leadTargetDir; - Vector ponyOrbitPos; - Vector chaseVelocity; - Vector returnVelocity; - RNG rng; - uint64_t uStack_2f0; - Vector whitePonyFireDirection; - KColor primaryHueColor; - EntityList_EL nearbyPickups; - EntityList_EL nuggetTargets [2]; - Vector spawnParentPos; - Vector toParent; - Vector rotatedVelocity; - Vector tearVelocity; - Vector tearPos; - EntityList_EL nearbyEnemies; - Vector leadTargetDelta; - Vector toTarget; - Vector toPlayer; - Vector toEnemy; - Vector enemyPos; - Vector ponyFireDirection; - Vector explosionPos; - Vector laserOffset; - Vector clampedOrbitPos; - uint8_t texture [4]; - int *textureRefBlock; - Vector orbitPos; - Vector parentPos; - Vector aimDirection; - int updateSteps; - Vector laserDirection; - Vector shotDirection; - Entity *local_1e0; - uint32_t *local_1dc; - float local_1d8; - Entity *local_1d4; - float local_1d0; - float local_1cc; - Vector *local_1c8; - float local_1c4; - Entity *local_1c0; - Entity *local_1bc; - char isFiring; - Room *local_1b4; - Color targetTintColor; - Color pillPrimaryColor; - Color pillSecondaryColor; - Color rainbowPrimaryColor; - Color explosionColor; - Color rainbowSecondaryColor; - ColorMod splatColor; - ColorMod lemonSplatColor; - ColorMod lemonadeSplatColor; - RNG seedRng; - uint32_t stackCookie; - void *prevExceptionList; - uint8_t *puStack_c; - float ehState; - Game *game; - Manager *manager; - Entity_Pickup *pickup; - ColorMod *pillLayerColor; - uint32_t swapValue; - - ehState = -NAN; - puStack_c = &LAB_00af2261; - prevExceptionList = ExceptionList; - uVar7 = __security_cookie ^ GHIDRA_UINT((&lemonadeSplatColor)[1]._offset); - ExceptionList = &prevExceptionList; - if (this->_variant == 0xed) { - iVar10 = this->_wispCollectibleType; - } - else if (this->_variant == 0xce) { - iVar10 = this->_subtype; - } - else { - iVar10 = 0x248; - } - local_1b4 = GHIDRA_CAST(this); - stackCookie = uVar7; - local_1c8 = ItemConfig::get_wisp_config(iVar10); - isFiring = *GHIDRA_CAST(&local_1c8[2].y); - updateSteps = GHIDRA_INT(this->_updateTime) - GHIDRA_INT(this->_prevUpdateTime); - if ((this->_variant == 0xce) && (this->_subtype == 0x28a)) { - iVar10 = this->_target; - if ((iVar10 == 0) || - (((*GHIDRA_CAST((iVar10 + 0x28)) != 3 || (*GHIDRA_CAST((iVar10 + 0xd88)) != 6)) || - (*GHIDRA_CAST((iVar10 + 0xd4c)) < 1)))) { - if (this->_state == 1) { - this->_state = 0; - this->_fireCooldown = 0; - this->_entityGridCollisionClass = 0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - piVar8 = LayerState::GetTexture(layer,texture); - ehState = 0.0; - anim_00 = s_Idle2; - if (*GHIDRA_CAST((*piVar8 + 0x10)) < 0x81) { - anim_00 = s_Idle; - } - ANM2::SetAnimation(&this->_sprite,anim_00,0); - ehState = 1.4013e-45; - if (((textureRefBlock != GHIDRA_CAST(0x0)) && - (cVar5 = (**(code **)(*textureRefBlock + 0xc))(uVar7), cVar5 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(texture); - } - ehState = -NAN; - } - goto LAB_0043ac23; - } - bVar11 = false; - if (this->_state == 0) { - this->_state = 1; - this->_fireCooldown = 0; - this->_entityGridCollisionClass = 3; - goto LAB_0043ac23; - } - } - else { -LAB_0043ac23: - bVar11 = this->_state == 0; - } - local_1e0 = GHIDRA_CAST(0x3f800000); - if (bVar11) { - if (this->_orbitLayer < 0) { - fVar12 = (this->_formationOffset).x; - if ((fVar12 != g_vectorZero.x) || ((this->_formationOffset).y != g_vectorZero.y)) { - (this->_pos).x = fVar12; - (this->_pos).y = (this->_formationOffset).y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - } - } - else { - pEVar9 = get_orbit_parent(this); - local_1bc = GHIDRA_CAST((pEVar9->_pos).x); - local_1cc = (pEVar9->_velocity).y; - local_1d0 = (pEVar9->_pos).y; - local_1c4 = (pEVar9->_velocity).x; - if (((this->_subtype == 0x2c5) || (this->_subtype == 0x25c)) && - ((pEVar15 = GHIDRA_CAST((this->_targetPosition).x), (float)pEVar15 != g_vectorZero.x || - ((this->_targetPosition).y != g_vectorZero.y)))) { - local_1d0 = (this->_targetPosition).y; - local_1c4 = g_vectorZero.x; - local_1cc = g_vectorZero.y; - local_1bc = pEVar15; - } - if ((pEVar9->_type == 3) && (pEVar9->_variant == 0xf0)) { - local_1c4 = local_1c4 * 0.5; - local_1cc = local_1cc * 0.5; - } - parentPos.x = (float)local_1bc; - parentPos.y = local_1d0; - GetOrbitPosition(this,&orbitPos,&parentPos); - if (this->_subtype == 0x25c) { - Room::GetClampedPositionImpl(g_game->_room,&clampedOrbitPos,&orbitPos,0.0,0.0,0.0,0.0); - local_1d4 = GHIDRA_CAST(clampedOrbitPos.x); - local_1d8 = clampedOrbitPos.y; - } - else { - local_1d8 = orbitPos.y; - local_1d4 = GHIDRA_CAST(orbitPos.x); - } - local_1d0 = local_1d0 - (this->_pos).y; - local_1bc = GHIDRA_CAST(((float)local_1bc - (this->_pos).x)); - local_1c0 = GHIDRA_CAST(sqrtf(local_1d0 * local_1d0 + (float)local_1bc * (float)local_1bc)); - local_1d0 = local_1d0 * 0.01; - local_1bc = GHIDRA_CAST(((float)local_1bc * 0.01)); - fVar12 = sqrtf(local_1d0 * local_1d0 + (float)local_1bc * (float)local_1bc); - if ((8.0 < fVar12) && (0.0 < fVar12)) { - local_1bc = GHIDRA_CAST(((float)local_1bc * (8.0 / fVar12))); - local_1d0 = local_1d0 * (8.0 / fVar12); - } - fVar12 = (this->_orbitDistance).y; - orbitDistance = &this->_orbitDistance; - if ((this->_orbitDistance).x <= fVar12 && fVar12 != (this->_orbitDistance).x) { - orbitDistance = GHIDRA_CAST(&(this->_orbitDistance).y); - } - pEVar15 = GHIDRA_CAST(((((float)local_1c0 - (orbitDistance->x + 10.0)) - 0.0) / 160.0)); - if ((float)pEVar15 <= 0.0) { - pEVar15 = GHIDRA_CAST(0x0); - } - if ((float)local_1e0 <= (float)pEVar15) { - pEVar15 = local_1e0; - } - fVar12 = (float)local_1e0 - ((float)pEVar15 + 0.0); - local_1c0 = GHIDRA_CAST(((float)local_1e0 - fVar12 * fVar12)); - fVar12 = ((float)local_1e0 - (float)local_1c0) + ((float)local_1e0 - (float)local_1c0); - local_1c4 = (local_1c4 * fVar12) / pEVar9->_friction; - local_1cc = (local_1cc * fVar12) / pEVar9->_friction; - local_1d4 = GHIDRA_CAST((((float)local_1d4 - ((this->_pos).x + local_1c4)) * 0.5)); - local_1d8 = (local_1d8 - ((this->_pos).y + local_1cc)) * 0.5; - fVar12 = sqrtf((float)local_1d4 * (float)local_1d4 + local_1d8 * local_1d8); - if ((fVar12 <= 5.0) || ((this->_flags & 0x20000000000) != 0)) { - pEVar9 = local_1d4; - fVar12 = local_1d8; - } - else { - pEVar9 = local_1d4; - fVar16 = local_1d8; - if (0.0 < fVar12) { - fVar16 = local_1d8 * ((float)local_1e0 / fVar12); - pEVar9 = GHIDRA_CAST(((float)local_1d4 * ((float)local_1e0 / fVar12))); - } - pEVar9 = GHIDRA_CAST(((float)pEVar9 * 4.0)); - fVar12 = fVar16 * 4.0; - } - fVar16 = (fVar12 + local_1cc) / this->_friction; - fVar12 = ((float)pEVar9 + local_1c4) / this->_friction; - (this->_velocity).y = ((local_1d0 + (this->_velocity).y) - fVar16) * (float)local_1c0 + fVar16 - ; - (this->_velocity).x = - (((float)local_1bc + (this->_velocity).x) - fVar12) * (float)local_1c0 + fVar12; - } - } - local_1c4 = (this->_health / this->_maxHitPoints) * 0.4 + 0.6; - if (this->_variant == 0xce) { - if (this->_subtype == 0x242) { - local_1c4 = local_1c4 * 1.5; - } - else if (this->_subtype == 0x263) { - local_1c4 = ((float)this->_keys * 0.05 + (float)local_1e0) * local_1c4; - } - } - local_1cc = sqrtf(local_1c4); - local_1c0 = GHIDRA_CAST((local_1cc * g_vectorOne.x)); - local_1cc = local_1cc * g_vectorOne.y; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (layer->_size).x = (float)local_1c0; - (layer->_size).y = local_1cc; - local_1c0 = GHIDRA_CAST((local_1c4 * g_vectorOne.x)); - local_1c4 = local_1c4 * g_vectorOne.y; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - (layer->_size).x = (float)local_1c0; - (layer->_size).y = local_1c4; - player = this->_player; - local_1d8 = g_vectorZero.x; - local_1bc = GHIDRA_CAST((player->_meleeDamage + player->_meleeDamage)); - local_1d4 = GHIDRA_CAST(g_vectorZero.y); - local_1cc = 0.0; - local_1c4 = 0.0; - this->_collisionDamage = (float)local_1bc; - local_1d0 = (float)GHIDRA_INT(local_1c8[2].x); - if (this->_variant != 0xce) goto LAB_0043cdfe; - uVar7 = this->_subtype; - if (uVar7 < 299) { - if (uVar7 == 0x12a) { - bVar6 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x12a); - if ((bVar6 != 0) || - (bVar6 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x4d), - bVar6 != 0)) { - fVar12 = -5.0; - goto code_r0x0043bfeb; - } - fVar12 = 0.0; -LAB_0043bfef: - this->_collisionDamage = fVar12; - bVar6 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x4d); - if ((bVar6 == 0) && - (bVar6 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x12a), - bVar6 == 0)) { - local_1c0 = GHIDRA_CAST(0x3e99999a); - local_1bc = GHIDRA_CAST(0x3f333333); - local_1b4 = GHIDRA_CAST((((float)(GHIDRA_UINT(((g_game->_frameCount - this->_spawnFrame) + - this->_initSeed)) % 0x3c) + 0.0) / 60.0)); - } - else { - local_1c0 = local_1e0; - local_1bc = local_1e0; - local_1b4 = GHIDRA_CAST((((float)(GHIDRA_UINT(((g_game->_frameCount - this->_spawnFrame) + - this->_initSeed)) % 0x1e) + 0.0) / 30.0)); - } - hsv_to_rgb(&primaryHueColor,(float)local_1b4 * 360.0,(float)local_1c0,(float)local_1bc,1.0); - ::(GHIDRA_CAST((&rainbowPrimaryColor)))->Color::Color(); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - if (&layer->_color != GHIDRA_CAST(extraout_EAX_02)) { - fVar12 = extraout_EAX_02[1]; - fVar16 = extraout_EAX_02[2]; - fVar13 = extraout_EAX_02[3]; - (layer->_color)._tint[0] = *extraout_EAX_02; - (layer->_color)._tint[1] = fVar12; - (layer->_color)._tint[2] = fVar16; - (layer->_color)._tint[3] = fVar13; - fVar12 = extraout_EAX_02[5]; - fVar16 = extraout_EAX_02[6]; - fVar13 = extraout_EAX_02[7]; - (layer->_color)._colorize[0] = extraout_EAX_02[4]; - (layer->_color)._colorize[1] = fVar12; - (layer->_color)._colorize[2] = fVar16; - (layer->_color)._colorize[3] = fVar13; - *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((extraout_EAX_02 + 8)); - (layer->_color)._offset[2] = extraout_EAX_02[10]; - } - fVar12 = (float)local_1b4 + 0.2; - if ((float)local_1e0 < fVar12) { - fVar12 = fVar12 - (float)local_1e0; - } - hsv_to_rgb(&secondaryHueColor,fVar12 * 360.0,(float)local_1c0,(float)local_1bc,1.0); - ::(GHIDRA_CAST((&rainbowSecondaryColor)))->Color::Color(); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - if (&layer->_color != GHIDRA_CAST(extraout_EAX_03)) { - fVar12 = extraout_EAX_03[1]; - fVar16 = extraout_EAX_03[2]; - fVar13 = extraout_EAX_03[3]; - (layer->_color)._tint[0] = *extraout_EAX_03; - (layer->_color)._tint[1] = fVar12; - (layer->_color)._tint[2] = fVar16; - (layer->_color)._tint[3] = fVar13; - fVar12 = extraout_EAX_03[5]; - fVar16 = extraout_EAX_03[6]; - fVar13 = extraout_EAX_03[7]; - (layer->_color)._colorize[0] = extraout_EAX_03[4]; - (layer->_color)._colorize[1] = fVar12; - (layer->_color)._colorize[2] = fVar16; - (layer->_color)._colorize[3] = fVar13; - *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((extraout_EAX_03 + 8)); - (layer->_color)._offset[2] = extraout_EAX_03[10]; - } - } - else { - switch(uVar7) { - case 0x28: - local_1c8 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x28); - if ((player->_dead == 0) && (local_1c8 != GHIDRA_CAST(0x0))) { - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) >> 2 < 0x29) { - iVar10 = 0; - } - else { - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xa0)); - } - if (local_1c8[1].x == (float)(*GHIDRA_CAST((iVar10 + 0x78)) + -1)) { - local_1b4 = GHIDRA_CAST(((this->_pos).x - (player->_pos).x)); - local_1bc = GHIDRA_CAST(((this->_pos).y - (player->_pos).y)); - fVar12 = sqrtf((float)local_1b4 * (float)local_1b4 + (float)local_1bc * (float)local_1bc - ); - if (70.0 <= fVar12) { - pRVar14 = local_1b4; - pEVar9 = local_1bc; - } - else { - pRVar14 = GHIDRA_CAST(((float)local_1b4 * (70.0 / fVar12))); - pEVar9 = GHIDRA_CAST(((float)local_1bc * (70.0 / fVar12))); - } - ::(GHIDRA_CAST((&explosionColor)))->Color::Color(); - explosionPos.x = (float)pRVar14 + (player->_pos).x; - explosionPos.y = (float)pEVar9 + (player->_pos).y; - Game::BombExplosionEffects - (g_game,&explosionPos,30.0,(BitSet128)ZEXT816(0),Color,GHIDRA_CAST(this),0.75,1,4 - ,0); - } - } - break; - case 0x2c: -LAB_0043c942: - switch(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24))))) { - case 0: - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = iVar10 + -1; - if (iVar10 < 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 1; - } - break; - case 1: - isFiring = '\0'; - this->_collisionDamage = 0.0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) <= 0.0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 3; - uVar7 = Random(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = uVar7 % 0x1e + 0x1e; - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) - 0.1; - } - break; - case 2: - if ((float)local_1e0 <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c))))) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 0; - uVar7 = Random(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = uVar7 % 0x1e + 0x3c; - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) + 0.1; - } - break; - case 3: - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))); - isFiring = '\0'; - this->_visible = 0; - this->_collisionDamage = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = iVar10 + -1; - if (iVar10 < 0) { - this->_visible = 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 2; - } - } - ::(GHIDRA_CAST((&fadeColor)))->Color::operator_assign(&(this->_sprite)._color); - fadeColor._tint[3] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color); - break; - case 0x2f: - if (((player->_itemState == 0x2f) && (pvVar2 = player->_weapons[0], pvVar2 != (void *)0x0)) - && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x30)) == 6 && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x44)) != 0 && - (0xf < g_game->_frameCount - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x44)) + 0x328)))))))) { - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - local_1d8 = 0.0; - local_1d4 = local_1e0; - } - break; - case 0x31: - if (((player->_itemState == 0x31) && (player->_itemStateCooldown == 0x1e)) && - (this->_counter < 1)) { - laserDirection.x = (player->_aimDirection).x; - laserDirection.y = (player->_aimDirection).y; - if ((laserDirection.x == g_vectorZero.x) && (laserDirection.y == g_vectorZero.y)) { - laserDirection.x = (this->_targetPosition).x; - laserDirection.y = (this->_targetPosition).y; - } - (GHIDRA_CAST((&laserDirection)))->Vector::Normalize(); - bVar6 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar6 == 0) { - local_1e0 = GHIDRA_CAST(0x40000000); - } - orbitDistance = &laserOffset; - bVar6 = 0; - iVar10 = 0xf; - laserOffset.x = 0.0; - laserOffset.y = -18.0; - source = this; - fVar12 = atan2f(laserDirection.y,laserDirection.x); - laser = Entity_Laser::ShootAngle - (3,&this->_pos,fVar12 * 57.295776,iVar10,orbitDistance,GHIDRA_CAST(source), - bVar6); - laser->SetCollisionDamage((float)local_1e0 * 3.5); - laser->_scale = (float)local_1e0 * 0.15 + 0.35; - (GHIDRA_CAST((laser)))->Entity_Laser::ResetSpriteScale(); - if (laserDirection.y <= -0.5) { - fVar12 = -50.0; - } - else { - fVar12 = 3000.0; - } - laser->_renderDepthOffset = fVar12; - laser->Update(); - this->_counter = 8; - } - break; - case 0x38: - bVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,0); - if (bVar6 != 0) { - uVar7 = Random(); - if (uVar7 % 6 == 0) { - uVar7 = Random(); - pEVar9 = Game::Spawn(g_game,1000,0x2e,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - fVar16 = g_vectorOne.x * 0.65; - fVar12 = g_vectorOne.y * 0.65; - pAVar4 = &pEVar9[1]._sprite; - (pAVar4->_filename)._buf[4] = 'Z'; - (pAVar4->_filename)._buf[5] = '\0'; - (pAVar4->_filename)._buf[6] = '\0'; - (pAVar4->_filename)._buf[7] = '\0'; - (pEVar9->_sprite)._scale.x = fVar16; - pAVar4 = &pEVar9[1]._sprite; - (pAVar4->_filename)._buf[8] = 'Z'; - (pAVar4->_filename)._buf[9] = '\0'; - (pAVar4->_filename)._buf[10] = '\0'; - (pAVar4->_filename)._buf[0xb] = '\0'; - (pEVar9->_sprite)._scale.y = fVar12; - pEVar9->SetCollisionDamage(0x40e00000); - pEVar9->Update(); - splatColor._tint[0] = 1.0; - splatColor._tint[1] = 1.0; - splatColor._tint[2] = 1.0; - splatColor._tint[3] = 1.0; - splatColor._offset[0] = 0.0; - splatColor._colorize[0] = 6.0714; - splatColor._colorize[1] = 5.7857; - splatColor._colorize[2] = 0.0; - splatColor._colorize[3] = 1.0; - splatColor._offset[1] = 0.0; - splatColor._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(&pEVar9->_sprite))))->Sprite::SetColor(&splatColor); - } - uVar7 = Random(); - if (uVar7 % 6 == 0) { - uVar7 = Random(); - splat = Entity_NPC::MakeSplat - (GHIDRA_CAST(this), - (float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 - * 0.5 + 0.2); - orbitDistance = MusicManager::RandomVector(&lemonSplatOffset); - lemonSplatColor._offset[0] = 0.7843138; - lemonSplatColor._offset[1] = 0.7843138; - lemonSplatColor._offset[2] = 0.0; - fVar12 = orbitDistance->y; - iVar10 = *GHIDRA_CAST(splat); - fVar16 = (this->_pos).y; - (splat->_pos).x = orbitDistance->x + orbitDistance->x + (this->_pos).x + 0.0; - lemonSplatColor._colorize[0] = 0.0; - lemonSplatColor._colorize[1] = 0.0; - lemonSplatColor._colorize[2] = 0.0; - lemonSplatColor._colorize[3] = 0.0; - (splat->_pos).y = fVar12 + fVar12 + fVar16 + 8.0; - lemonSplatColor._tint[0] = 0.0; - lemonSplatColor._tint[1] = 0.0; - lemonSplatColor._tint[2] = 0.0; - lemonSplatColor._tint[3] = 0.7; - (**(code **)(iVar10 + 0x3c))(&lemonSplatColor,0xffffffff,0xff,0,1); - } - } - break; - case 0x4d: - fVar12 = 8.0; -code_r0x0043bfeb: - fVar12 = (float)local_1bc + fVar12; - goto LAB_0043bfef; - case 0x5d: - puVar1 = &this->_target; - local_1c8 = GHIDRA_CAST(puVar1); - if (this->_target != 0) { - if ((this->_counter < 1) || (*GHIDRA_CAST((this->_target + 0x173)) != '\0')) { - msvc::multiset::erase(&local_1c8); - *puVar1 = 0; - } - else { - ::(GHIDRA_CAST((&targetTintColor)))->Color::Color(); - (*extraout_EDX)(extraout_EAX,2,0,0,1); - pEVar9 = GHIDRA_CAST(*puVar1); - (GHIDRA_CAST((&fearSource)))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((pEVar9)))->Entity::AddFear(&fearSource,-2,0); - uVar7 = Random(); - if ((uVar7 & 3) == 0) { - pcVar3 = *(code **)(*GHIDRA_CAST(local_1c8->x) + 0x20); - (GHIDRA_CAST((&targetDamageSource)))->EntityRef::constructor(GHIDRA_CAST(local_1b4)); - (*pcVar3)(0,0x4000000,0,&targetDamageSource,0x1e); - this = GHIDRA_CAST(local_1b4); - } - } - } - break; - case 0x66: - if (g_game->_frameCount == this->_spawnFrame) { - if ((0 < this->_coins) && (GHIDRA_UINT(this->_coins) < 7)) { - local_1c0 = GHIDRA_CAST(Seeds)::GetStartSeed(&g_game->_seedEffects); - if (local_1c0 != pERam00c7e838) { - uRam00c7e820 = 0; - uRam00c7e824 = 1; - uRam00c7e828 = 2; - uRam00c7e82c = 3; - local_1c8 = GHIDRA_CAST(&DAT_0000000f); - uRam00c7e830 = 4; - uRam00c7e834 = 5; - uStack_2f0 = 0x900000002; - local_1bc = GHIDRA_CAST(0x0); - pEVar9 = local_1c0; - do { - if (pEVar9 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar7 = GHIDRA_UINT(pEVar9) >> 2 ^ GHIDRA_UINT(pEVar9); - uVar7 = uVar7 << 9 ^ uVar7; - pEVar9 = GHIDRA_CAST((uVar7 >> 0xf ^ uVar7)); - if (6U - GHIDRA_INT(local_1bc) == 0) { - uVar7 = 0; - } - else { - uVar7 = GHIDRA_UINT(pEVar9) % (6U - GHIDRA_INT(local_1bc)); - } - swapValue = *GHIDRA_CAST((GHIDRA_INT(local_1bc) * 4 + 0xc7e820)); - iVar10 = GHIDRA_INT((&(local_1bc->_sprite)._filename + -3)) + uVar7; - *GHIDRA_CAST((GHIDRA_INT(local_1bc) * 4 + 0xc7e820)) = - *GHIDRA_CAST((iVar10 * 4 + 0xc7e820)); - local_1bc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_1bc)) + 0x1)))); - *GHIDRA_CAST((iVar10 * 4 + 0xc7e820)) = swapValue; - } while (local_1bc < &DAT_00000005); - this = GHIDRA_CAST(local_1b4); - pERam00c7e838 = local_1c0; - } - FUN_00a0f720(*GHIDRA_CAST(((GHIDRA_CAST(this))->_gridPaths[0x184] * 4 + 0xc7e81c)) * 0x14 + - 0xc33a98); - ::(GHIDRA_CAST((&pillPrimaryColor)))->Color::Color(); - pillLayerColor = extraout_EAX_00; - layer = ANM2::GetLayer(GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 9)),GHIDRA_CAST(0x0)); - ::(GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(pillLayerColor); - ::(GHIDRA_CAST((&pillSecondaryColor)))->Color::Color(); - pillLayerColor = extraout_EAX_01; - layer = ANM2::GetLayer(GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 9)),GHIDRA_CAST(0x1)); - ::(GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(pillLayerColor); - } - } - break; - case 0x7b: - seedRng._seed = this->_initSeed; - seedRng._shift1 = 1; - seedRng._shift2 = 0xb; - seedRng._shift3 = 0x10; - uVar7 = (GHIDRA_CAST((&seedRng)))->RNG::RandomInt(0xe); - local_1d0 = (float)(uVar7 + 0x10); - break; - case 0x82: - iVar10 = player->_fireDirection; - Isaac::GetAxisAlignedUnitVectorFromDir(&ponyFireDirection,iVar10); - cooldown = this->_fireCooldown; - if (0 < cooldown) { - cooldown = cooldown + -1; - this->_fireCooldown = cooldown; - } - if (((-1 < cooldown) && (this->_isInvicible != 0)) && - (orbitDistance = - GetOrbitPosition(this,&ponyOrbitPos,GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x33c))), - fVar12 = (this->_pos).x - orbitDistance->x, fVar16 = (this->_pos).y - orbitDistance->y, - fVar16 * fVar16 + fVar12 * fVar12 < 50.0)) { - this->_isInvicible = 0; - PlayFloatAnim(this,-1); - } - game = g_game; - cooldown = this->_fireCooldown; - if (cooldown < 0) { - if (((this->_collidesWithGrid != 0) || (cooldown < -1)) || - (bVar6 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&this->_pos,-100.0), bVar6 == 0)) { - this->_entityGridCollisionClass = 0; - pRVar14 = game->_room; - iVar10 = (GHIDRA_CAST((pRVar14)))->Room::GetGridIndex(GHIDRA_CAST((local_1b4->_gridEntities + 0xc6))); - (GHIDRA_CAST((&gridDamageSource)))->EntityRef::constructor(local_1b4->_gridEntities[0xfb]); - (GHIDRA_CAST((pRVar14)))->Room::DamageGridWithSource(iVar10,1,&gridDamageSource); - (GHIDRA_CAST((local_1b4->_gridEntities + 0xcf)))->x = - (GHIDRA_CAST((local_1b4->_gridEntities + 0xcf)))->x * 0.5; - local_1b4->_gridEntities[0xd0] = (void *)((float)local_1b4->_gridEntities[0xd0] * 0.5); - local_1b4->_gridPaths[0x178] = local_1b4->_gridPaths[0x178] + -1; - this = GHIDRA_CAST(local_1b4); - if (local_1b4->_gridPaths[0x178] < -10) { - local_1b4->_gridPaths[0x178] = 0x3c; - local_1b4->_gridPaths[0x187] = 0; - } - } - } - else { - (this->_sprite)._flipX = ponyFireDirection.x < 0.0; - if ((iVar10 != -1) && (cooldown < 1)) { - this->_state = 1; - this->_isInvicible = 1; - this->_fireCooldown = -1; - this->_entityGridCollisionClass = 4; - (this->_velocity).x = ponyFireDirection.x * 10.0; - (this->_velocity).y = ponyFireDirection.y * 10.0; - PlayShootAnim(this,-1); - } - } - iVar10 = 1; - if (*GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xe3)) != 0) { - (GHIDRA_CAST(this))->_gridEntities[0xd9] = - (void *)((float)(GHIDRA_CAST(this))->_gridEntities[0xd9] * 0.2); - } - goto LAB_0043ce03; - case 0xaf: - local_1b4 = g_game->_room; - local_1bc = GHIDRA_CAST((GHIDRA_CAST((local_1b4)))->Room)::GetGridIndex(&this->_pos); - if ((-1 < GHIDRA_INT(local_1bc)) && (GHIDRA_INT(local_1bc) < 0x1c0)) { - local_1c8 = GHIDRA_CAST((GHIDRA_CAST((local_1b4)))->Room)::GetGridCollision(GHIDRA_INT(local_1bc)); - pickup = local_1b4->_gridEntities[GHIDRA_INT(local_1bc)]; - if (pickup != GHIDRA_CAST(0x0)) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pickup)) + 0x4)))) == 0x10) { - if ((((local_1c8 == GHIDRA_CAST(&DAT_00000004)) && - (bVar6 = (GHIDRA_CAST((pickup)))->GridEntity_Door::IsLocked(), bVar6 != 0)) && - ((local_1b4->_gridEntities[GHIDRA_INT(local_1bc)]->_doorFlags & 1) == 0)) && - (bVar6 = GridEntity_Door::TryUnlock - (local_1b4->_gridEntities[GHIDRA_INT(local_1bc)],player,1), bVar6 != 0) - ) { - killSource = &doorUnlockKillSource; - goto LAB_0043bc25; - } - } - else if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pickup)) + 0x4)))) == 0xb) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pickup)) + 0xc)))) == 0)) { - (GHIDRA_CAST((GHIDRA_CAST(pickup))))->GridEntity_Lock::try_unlock(player,1); - killSource = &lockUnlockKillSource; -LAB_0043bc25: - killSource = (GHIDRA_CAST((killSource)))->EntityRef::EntityRef(); - (*extraout_EDX_00)(killSource); - } - } - } - if (this->_dead == 0) { - bVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); - if (bVar6 != 0) { - EntityList::QueryRadius(&local_1b4->_entityList,&nearbyPickups,&this->_pos,24.0,0x10); - ehState = 2.8026e-45; - pickupIndex = 0; - uVar7 = nearbyPickups._size; - if (nearbyPickups._size == 0) { -LAB_0043bd3e: - ehState = -NAN; - (GHIDRA_CAST((&nearbyPickups)))->EntityList_Query::~EntityList_Query(); - } - else { - do { - pickup = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyPickups)) + 0x4))) + pickupIndex * 4)); - if (pickup != GHIDRA_CAST(0x0)) { - if (pickup->_type == 5) { - iVar10 = pickup->_variant; - if (((iVar10 == 0x3c) || (iVar10 == 0x35)) || (iVar10 == 0x37)) { - bVar6 = (GHIDRA_CAST((pickup)))->Entity_Pickup::TryOpenChest(this->_player); - if (bVar6 != 0) { - killSource = &chestOpenKillSource; - goto LAB_0043bd2f; - } - uVar7 = nearbyPickups._size; - } - } - else if (((pickup->_type == 6) && (pickup->_variant == 7)) && - ((pvVar2 = (pickup->_sprite)._animState._animData, pvVar2 == (void *)0x0 - || ((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x34)) != '\0' || - ((pickup->_sprite)._animState._isPlaying == 0)))))) { - Entity::ForceCollide(this->_player,GHIDRA_CAST(pickup),1); - killSource = &pickupCollideKillSource; -LAB_0043bd2f: - killSource = (GHIDRA_CAST((killSource)))->EntityRef::EntityRef(); - (*extraout_EDX_01)(killSource); - goto LAB_0043bd3e; - } - } - pickupIndex = pickupIndex + 1; - } while (pickupIndex < uVar7); - ehState = -NAN; - (GHIDRA_CAST((&nearbyPickups)))->EntityList_Query::~EntityList_Query(); - } - } - } - break; - case 0xb5: - Isaac::GetAxisAlignedUnitVectorFromDir(&whitePonyFireDirection,player->_fireDirection); - (this->_sprite)._flipX = whitePonyFireDirection.x < 0.0; - break; - case 0x11a: -LAB_0043cc72: - this->_collisionDamage = (float)local_1bc * 0.5; - } - } - goto LAB_0043cdfe; - } - if (0x242 < uVar7) { - if (uVar7 < 0x2d3) { - if (uVar7 == 0x2d2) { - iVar10 = this->_parent; - if (iVar10 == 0) { - killSource = (GHIDRA_CAST((&noParentKillSource)))->EntityRef::EntityRef(); - this->Kill(killSource); - } - else { - toParent.x = *GHIDRA_CAST((iVar10 + 0x33c)) - (this->_pos).x; - toParent.y = *GHIDRA_CAST((iVar10 + 0x340)) - (this->_pos).y; - orbitDistance = (GHIDRA_CAST((&toParent)))->Vector::Normalized(&toParentDir); - local_1d8 = orbitDistance->x; - local_1d4 = GHIDRA_CAST(orbitDistance->y); - } - } - else { - switch(uVar7) { - case 0x263: - this->_collisionDamage = (float)this->_keys * 0.15 * (float)local_1bc; - break; - case 0x27b: - goto LAB_0043cc72; - case 0x2be: - this->_mass = 0.1; - this->_collisionDamage = (float)local_1bc * 0.25; - break; - case 0x2bf: - bVar6 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasNullEffect(100); - if (((bVar6 != 0) && (this->_coins == 0)) || - ((bVar6 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasNullEffect(100), bVar6 == 0 - && (this->_coins == 1)))) { - killSource = (GHIDRA_CAST((&nullEffectKillSource)))->EntityRef::EntityRef(); - this->Kill(killSource); - } - } - } - } - else { - if (uVar7 != 0x2d8) { - if (uVar7 == 0x1000e) { - uVar7 = Random(); - iVar10 = (uVar7 & 3) + 5; - } - else { - if (uVar7 != 0x10010) goto LAB_0043cdfe; - iVar10 = 4; - local_1cc = 90.0; - if ((this->_coins & 1U) == 0) { - local_1c4 = 45.0; - } - if ((float)this->_fireCooldown == local_1d0) { - this->_coins = this->_coins + 1; - } - } - goto LAB_0043ce03; - } - this->_isInvicible = g_game->_frameCount - this->_spawnFrame < 0x3c; - } - goto LAB_0043cdfe; - } - if (uVar7 == 0x242) { - bVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,0); - if (bVar6 != 0) { - uVar7 = Random(); - if (uVar7 % 6 == 0) { - uVar7 = Random(); - splat = Entity_NPC::MakeSplat - (GHIDRA_CAST(this), - (float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * - 0.5 + 0.2); - orbitDistance = MusicManager::RandomVector(&lemonadeSplatOffset); - lemonadeSplatColor._offset[0] = 0.7843138; - lemonadeSplatColor._offset[1] = 0.7843138; - lemonadeSplatColor._offset[2] = 0.0; - fVar12 = orbitDistance->y; - iVar10 = *GHIDRA_CAST(splat); - fVar16 = (this->_pos).y; - (splat->_pos).x = orbitDistance->x + orbitDistance->x + (this->_pos).x + 0.0; - lemonadeSplatColor._colorize[0] = 0.0; - lemonadeSplatColor._colorize[1] = 0.0; - lemonadeSplatColor._colorize[2] = 0.0; - lemonadeSplatColor._colorize[3] = 0.0; - (splat->_pos).y = fVar12 + fVar12 + fVar16 + 8.0; - lemonadeSplatColor._tint[0] = 0.0; - lemonadeSplatColor._tint[1] = 0.0; - lemonadeSplatColor._tint[2] = 0.0; - lemonadeSplatColor._tint[3] = 0.7; - (**(code **)(iVar10 + 0x3c))(&lemonadeSplatColor,0xffffffff,0xff,0,1); - } - } - goto LAB_0043cdfe; - } - switch(uVar7) { - case 0x143: - if (0x5a < g_game->_frameCount - this->_spawnFrame) { - killSource = (GHIDRA_CAST((&timeoutKillSource)))->EntityRef::EntityRef(); - this->Kill(killSource); - } - break; - case 0x145: - uVar7 = Random(); - iVar10 = (uVar7 & 1) + 2; - goto LAB_0043ce03; - case 0x18c: - iVar10 = this->_parent; - if (g_game->_frameCount == this->_spawnFrame) { - if (iVar10 != 0) { - spawnParentPos.x = *GHIDRA_CAST((iVar10 + 0x33c)); - spawnParentPos.y = *GHIDRA_CAST((iVar10 + 0x340)); - orbitDistance = GetOrbitPosition(this,&spawnOrbitPos,&spawnParentPos); - (this->_pos).x = orbitDistance->x; - (this->_pos).y = orbitDistance->y; - } - } - else if (iVar10 == 0) { - this->Remove(); - } - else if (*GHIDRA_CAST((iVar10 + 0x173)) != '\0') { - killSource = (GHIDRA_CAST((&parentDeadKillSource)))->EntityRef::EntityRef(); - this->Kill(killSource); - } - break; - case 0x196: - (GHIDRA_CAST((&rng)))->RNG::game_constructor((this->_dropRNG)._seed,0xd); - uVar7 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5); - local_1d0 = (float)(GHIDRA_INT(local_1d0) + -2 + uVar7); - break; - case 0x1a3: - goto LAB_0043c942; - case 0x1ab: - FamiliarHelper::wisp_mine_crafter_update(this); - break; - case 0x1b9: - ai_mega_blast_wisp(this); - break; - case 0x1e7: - pEVar9 = GHIDRA_CAST(this->_target); - local_1c8 = GHIDRA_CAST((*GHIDRA_CAST(&local_1c8[0x31].y) + 7)); - isFiring = '\0'; - if (pEVar9 == GHIDRA_CAST(0x0)) { - if (this->_orbitLayer < 0) { - this->_friction = 0.9; - orbitDistance = GetOrbitDistance(&layerOrbitDistance,GHIDRA_INT(local_1c8)); - local_1b4 = GHIDRA_CAST((this->_pos).x); - local_1bc = GHIDRA_CAST((this->_pos).y); - fVar12 = (float)local_1b4 - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - fVar16 = (float)local_1bc - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - fVar12 = sqrtf(fVar12 * fVar12 + fVar16 * fVar16); - if (orbitDistance->x <= fVar12) { - bVar6 = 0; - toPlayer.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (float)local_1b4; - toPlayer.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (float)local_1bc; - orbitDistance = (GHIDRA_CAST((&toPlayer)))->Vector::Resized(&returnVelocity,0.5); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(orbitDistance,bVar6); - } - else { - AddToOrbit(this,GHIDRA_INT(local_1c8)); - } - } - else { - this->_friction = 1.0; - } - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&nearbyEnemies,&this->_pos,100.0,8); - uVar7 = 0; - ehState = 5.60519e-45; - if (nearbyEnemies._size == 0) { -LAB_0043c7c6: - ehState = -NAN; - (GHIDRA_CAST((&nearbyEnemies)))->EntityList_Query::~EntityList_Query(); - } - else { - do { - bVar6 = Entity::IsVulnerableEnemy - (*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + uVar7 * 4)),GHIDRA_CAST(0x0)); - if (bVar6 != 0) { - local_1c8 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + uVar7 * 4)); - puVar1 = &this->_target; - if (this->_target != 0) { - local_1bc = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&local_1bc); - } - *puVar1 = local_1c8; - if (local_1c8 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(puVar1); - } - RemoveFromOrbit(this); - goto LAB_0043c7c6; - } - uVar7 = uVar7 + 1; - } while (uVar7 < GHIDRA_UINT(nearbyEnemies._size)); - ehState = -NAN; - (GHIDRA_CAST((&nearbyEnemies)))->EntityList_Query::~EntityList_Query(); - } - } - else { - this->_friction = 0.8; - toTarget.y = (pEVar9->_pos).y - (this->_pos).y; - toTarget.x = (pEVar9->_pos).x - (this->_pos).x; - local_1c8 = GHIDRA_CAST((toTarget.y * toTarget.y + toTarget.x * toTarget.x)); - if (10000.0 < (float)local_1c8) { - bVar6 = 0; - orbitDistance = (GHIDRA_CAST((&toTarget)))->Vector::Resized(&chaseVelocity,1.0); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(orbitDistance,bVar6); - pEVar9 = GHIDRA_CAST(this->_target); - } - fVar12 = sqrtf((float)local_1c8); - leadTargetDelta.y = - (fVar12 * 0.02 * (pEVar9->_velocity).y + (pEVar9->_pos).y) - (this->_pos).y; - leadTargetDelta.x = - (fVar12 * 0.02 * (pEVar9->_velocity).x + (pEVar9->_pos).x) - (this->_pos).x; - orbitDistance = (GHIDRA_CAST((&leadTargetDelta)))->Vector::Normalized(&leadTargetDir); - local_1d8 = orbitDistance->x; - local_1d4 = GHIDRA_CAST(orbitDistance->y); - if (this->_fireCooldown < 1) { - isFiring = '\x01'; - } - else { - this->_fireCooldown = this->_fireCooldown + -1; - } - bVar6 = (GHIDRA_CAST((pEVar9)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar6 == 0) { - if (this->_target != 0) { - local_1dc = &this->_target; - msvc::multiset::erase(&local_1dc); - } - this->_target = 0; - } - } - break; - case 0x1f8: - isFiring = '\0'; - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - local_1c8 = &this->_pos; - aimDirection.x = g_vectorZero.x; - aimDirection.y = g_vectorZero.y; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),nuggetTargets,local_1c8,150.0,8); - ehState = 4.2039e-45; - local_1c0 = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(nuggetTargets[0]._size) != GHIDRA_CAST(0x0)) { - pEVar9 = GHIDRA_CAST(0x0); - do { - pEVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nuggetTargets[0])) + 0x4))) + GHIDRA_INT(local_1c0) * 4)); - bVar6 = (GHIDRA_CAST((pEVar15)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar6 != 0) && ((pEVar15->_flags & 0x20000010) == 0)) { - enemyPos.y = (pEVar15->_pos).y; - enemyPos.x = (pEVar15->_pos).x; - bVar6 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(local_1c8,&enemyPos,3,900,0,0,GHIDRA_CAST(0x0)); - if (bVar6 != 0) { - pEVar9 = pEVar15; - } - } - this = GHIDRA_CAST(local_1b4); - local_1c0 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_1c0)) + 0x1)))); - } while (local_1c0 < GHIDRA_UINT(nuggetTargets[0]._size)); - local_1c0 = pEVar9; - if (pEVar9 != GHIDRA_CAST(0x0)) { - toEnemy.x = (pEVar9->_pos).x - (GHIDRA_CAST((local_1b4->_gridEntities + 0xc6)))->x; - toEnemy.y = (pEVar9->_pos).y - (float)local_1b4->_gridEntities[199]; - orbitDistance = (GHIDRA_CAST((&toEnemy)))->Vector::Normalized(&toEnemyDir); - aimDirection.x = orbitDistance->x; - aimDirection.y = orbitDistance->y; - } - } - bVar6 = (GHIDRA_CAST((&aimDirection)))->Vector::operator_ne(&g_vectorZero); - if ((bVar6 == 0) || ((float)GHIDRA_INT(local_1d0) <= 0.0)) { - if ((-1 < (GHIDRA_CAST(this))->_gridPaths[0x179]) && - (iVar10 = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1, - (GHIDRA_CAST(this))->_gridPaths[0x179] = iVar10, iVar10 < 0)) { - PlayFloatAnim(this,3); - } - ehState = -NAN; - (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); - } - else { - iVar10 = vector_to_direction(vec); - if ((GHIDRA_CAST(this))->_gridPaths[0x178] < 1) { - FireProjectile(this,&aimDirection,0); - (GHIDRA_CAST(this))->_gridPaths[0x178] = GHIDRA_INT(local_1d0); - (GHIDRA_CAST(this))->_gridPaths[0x179] = 0xc; - PlayShootAnim(this,iVar10); - (GHIDRA_CAST(this))->_gridPaths[0x179] = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; - ehState = -NAN; - (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); - } - else if ((GHIDRA_CAST(this))->_gridPaths[0x179] < 9) { - PlayFloatAnim(this,iVar10); - (GHIDRA_CAST(this))->_gridPaths[0x179] = 8; - ehState = -NAN; - (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); - } - else { - PlayShootAnim(this,iVar10); - (GHIDRA_CAST(this))->_gridPaths[0x179] = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; - ehState = -NAN; - (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); - } - } - break; - case 0x204: - local_1c4 = (float)this->_coins * 45.0 + 0.0; - break; - case 0x209: - iVar10 = 3; - local_1cc = 15.0; - local_1c4 = -15.0; - goto LAB_0043ce03; - case 0x20f: - ai_mr_me_wisp(this); - } -LAB_0043cdfe: - iVar10 = 1; -LAB_0043ce03: - bVar6 = (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities[0xfb])))->Entity_Player::HasCollectible(0xf7,0); - if (bVar6 != 0) { - (GHIDRA_CAST(this))->_gridEntities[0xd9] = - (void *)((float)(GHIDRA_CAST(this))->_gridEntities[0xd9] + - (float)(GHIDRA_CAST(this))->_gridEntities[0xd9]); - } - if (0 < (GHIDRA_CAST(this))->_gridPaths[399]) { - (GHIDRA_CAST(this))->_gridPaths[399] = (GHIDRA_CAST(this))->_gridPaths[399] + -1; - } - if ((GHIDRA_CAST(this))->_gridPaths[0x187] != 0) { - if ((GHIDRA_CAST(this))->_gridPaths[0x187] != 1) { - ExceptionList = prevExceptionList; - return; - } - if ((GHIDRA_CAST(this))->_gridEntities[2] != (void *)0xce) { - ExceptionList = prevExceptionList; - return; - } - if ((GHIDRA_CAST(this))->_gridEntities[3] != (void *)0x28a) { - ExceptionList = prevExceptionList; - return; - } - local_1dc = GHIDRA_CAST(cos(0.7853982)); - fVar16 = sin(0.7853982); - fVar12 = (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xcf)))->x; - rotatedVelocity.x = - fVar12 * (float)local_1dc - (float)(GHIDRA_CAST(this))->_gridEntities[0xd0] * fVar16; - rotatedVelocity.y = - fVar12 * fVar16 + (float)(GHIDRA_CAST(this))->_gridEntities[0xd0] * (float)local_1dc; - orbitDistance = Vector::ToCardinal(&cardinalVelocity,&rotatedVelocity); - local_1cc = cos(-0.7853982); - fVar13 = sin(-0.7853982); - fVar12 = orbitDistance->y; - fVar16 = orbitDistance->x; - local_1c4 = local_1cc * orbitDistance->x - fVar13 * orbitDistance->y; - (GHIDRA_CAST(this))->_gridEntities[0xd2] = (void *)0x3f7ae148; - local_1cc = local_1cc * fVar12 + fVar13 * fVar16; - if (0 < updateSteps) { - do { - (GHIDRA_CAST(this))->_gridPaths[0x178] = (GHIDRA_CAST(this))->_gridPaths[0x178] + 1; - manager = g_manager; - uVar7 = (GHIDRA_CAST(this))->_gridPaths[0x178] & 0x80000003; - bVar11 = uVar7 == 0; - if (GHIDRA_INT(uVar7) < 0) { - bVar11 = (uVar7 - 1 | 0xfffffffc) == 0xffffffff; - } - if (bVar11) { - local_1c0 = GHIDRA_CAST(0xb9); - seed_fart_sound_override(GHIDRA_CAST(&local_1c0)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c0),1.0,2,0,1.0,0.0); - uVar7 = Random(); - fVar12 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9; - local_1c0 = GHIDRA_CAST((-local_1c4 * 5.0 * fVar12)); - local_1b4 = GHIDRA_CAST((-local_1cc * 5.0 * fVar12)); - uVar7 = Random(); - local_1dc = (uint32_t *) - (((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) - * 2.3283064e-10 * 60.0 - 30.0) * 0.017453292); - local_1c8 = GHIDRA_CAST(cos((float)local_1dc)); - fVar12 = sin((float)local_1dc); - tearPos.x = (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xc6)))->x; - tearPos.y = (float)(GHIDRA_CAST(this))->_gridEntities[199]; - tearVelocity.x = (float)local_1c8 * (float)local_1c0 - fVar12 * (float)local_1b4; - tearVelocity.y = (float)local_1c8 * (float)local_1b4 + fVar12 * (float)local_1c0; - uVar7 = Random(); - local_1dc = (uint32_t *) - ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10); - uVar7 = Random(); - tear = (Entity_Tear *) - Game::Spawn(g_game,2,1,&tearPos,&tearVelocity,GHIDRA_CAST(this),0,uVar7); - tear->_fallingAccel = tear->_fallingAccel - 0.05; - uVar7 = Random(); - fVar12 = (float)(&DAT_00b64e34)[uVar7 & 1]; - if (fVar12 <= 0.01) { - fVar12 = 0.01; - } - tear->_baseScale = fVar12; - tear->_fScale = fVar12; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(tear->_height - 10.0); - tear->SetCollisionDamage((float)local_1dc + 3.0); - } - updateSteps = updateSteps + -1; - } while (updateSteps != 0); - updateSteps = 0; - } - anim = "SpecialDown"; - if (0.0 < local_1cc) { - anim = "SpecialUp"; - } - ANM2::Play(GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 9)),GHIDRA_CAST(anim),0); - pvVar2 = (GHIDRA_CAST(this))->_gridEntities[0xde]; - (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xcf)))->x = - local_1c4 * 0.4 * (float)pvVar2 + (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xcf)))->x; - (GHIDRA_CAST(this))->_gridEntities[0xd0] = - (void *)(local_1cc * 0.4 * (float)pvVar2 + (float)(GHIDRA_CAST(this))->_gridEntities[0xd0]); - ExceptionList = prevExceptionList; - return; - } - if (isFiring == '\0') { - ExceptionList = prevExceptionList; - return; - } - if (0 < (GHIDRA_CAST(this))->_gridPaths[0x178]) { - (GHIDRA_CAST(this))->_gridPaths[0x178] = (GHIDRA_CAST(this))->_gridPaths[0x178] + -1; - } - local_1b4 = *GHIDRA_CAST((GHIDRA_INT((GHIDRA_CAST(this))->_gridEntities[0xfb]) + 0x162c)); - if ((((local_1b4 == GHIDRA_CAST(0xffffffff)) && (local_1d8 == g_vectorZero.x)) && - ((float)local_1d4 == g_vectorZero.y)) || ((float)GHIDRA_INT(local_1d0) <= 0.0)) { - if ((GHIDRA_CAST(this))->_gridPaths[0x179] < 0) { - ExceptionList = prevExceptionList; - return; - } - iVar10 = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; - (GHIDRA_CAST(this))->_gridPaths[0x179] = iVar10; - if (iVar10 < 0) { - PlayFloatAnim(this,3); - ExceptionList = prevExceptionList; - return; - } - ExceptionList = prevExceptionList; - return; - } - Isaac::GetAxisAlignedUnitVectorFromDir(&shotDirection,GHIDRA_INT(local_1b4)); - TryAimAtMarkedTarget(this,&shotDirection,GHIDRA_CAST(&local_1b4),GHIDRA_CAST(0x0)); - if ((local_1d8 == g_vectorZero.x) && ((float)local_1d4 == g_vectorZero.y)) { - local_1d4 = GHIDRA_CAST(shotDirection.y); - local_1d8 = shotDirection.x; - } - local_1c4 = local_1c4 * 0.017453292; - local_1dc = GHIDRA_CAST(cos(local_1c4)); - fVar12 = sin(local_1c4); - shotDirection.x = (float)local_1dc * local_1d8 - (float)local_1d4 * fVar12; - shotDirection.y = local_1d8 * fVar12 + (float)local_1d4 * (float)local_1dc; - if ((GHIDRA_CAST(this))->_gridPaths[0x178] < 1) { - if (iVar10 != 0) { - local_1cc = local_1cc * 0.017453292; - local_1dc = GHIDRA_CAST(cos(local_1cc)); - local_1c8 = GHIDRA_CAST(sin(local_1cc)); - do { - FireProjectile(this,&shotDirection,0); - fVar12 = shotDirection.x * (float)local_1c8; - shotDirection.x = shotDirection.x * (float)local_1dc - shotDirection.y * (float)local_1c8; - shotDirection.y = shotDirection.y * (float)local_1dc + fVar12; - iVar10 = iVar10 + -1; - } while (iVar10 != 0); - } - (GHIDRA_CAST(this))->_gridPaths[0x178] = GHIDRA_INT(local_1d0); - (GHIDRA_CAST(this))->_gridPaths[0x179] = 0xc; - } - else if ((GHIDRA_CAST(this))->_gridPaths[0x179] < 9) { - PlayFloatAnim(this,GHIDRA_INT(local_1b4)); - (GHIDRA_CAST(this))->_gridPaths[0x179] = 8; - goto LAB_0043d0b0; - } - PlayShootAnim(this,GHIDRA_INT(local_1b4)); - (GHIDRA_CAST(this))->_gridPaths[0x179] = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; -LAB_0043d0b0: - if ((GHIDRA_CAST(this))->_gridEntities[3] == (void *)0x31) { - (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xc4)))->x = shotDirection.x; - (GHIDRA_CAST(this))->_gridEntities[0xc5] = (void *)shotDirection.y; - } - ExceptionList = prevExceptionList; - return; -} - -// 0043db20 -void Entity_Familiar::ai_mr_me_wisp() -{ - Vector *pos; - Entity_Pickup *this_00; - uint8_t bVar1; - uint32_t uVar2; - float fVar3; - int iVar4; - void *wispConfig; - uint8_t *orbitLevel; - EntityRef *killSource; - Entity_Player *nearestPlayer; - Entity *explosion; - int targetPickup; - int target; - uint8_t *orbitLevelLow; - void *pvVar5; - float dx; - EntityRef doorKillRef; - EntityRef killRef; - uint8_t pickups [12]; - uint32_t uStack_24; - float posY; - uint8_t *local_1c; - float local_18; - Entity_Familiar *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - GridEntity_Door *door; - Game *game; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af22cd; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((pickups + 0x2c)); - ExceptionList = &local_10; - iVar4 = this->_keys; - if (iVar4 == 0) { - local_14 = this; - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,this->_index); - game = g_game; - if (bVar1 == 0) { - ExceptionList = local_10; - return; - } - pvVar5 = g_game->_room; - if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 4)) + 0x44)) & 1) == 0) { - ExceptionList = local_10; - return; - } - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x764)); - if (((((-1 < iVar4) && (iVar4 < 0x1c0)) && - (target = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + iVar4 * 4 + 0x24)), target != 0)) && - ((*GHIDRA_CAST((target + 4)) == 4 || (*GHIDRA_CAST((target + 4)) == 0x16)))) && - (*GHIDRA_CAST((target + 0xc)) != 2)) { - this->_keys = 1; - this->_coins = iVar4; - target = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - (this->_targetPosition).x = (float)(iVar4 % target) * 40.0 + 40.0; - (this->_targetPosition).y = (float)(iVar4 / target) * 40.0 + 120.0; - } - if (this->_keys == 0) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST(pickups),5,0x3c,-1,0,0); - local_8 = 0; - local_18 = 0.0; - if (uStack_24 != 0) { - uVar2 = uStack_24; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)pickups)) + 0x4))); - do { - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + GHIDRA_INT(local_18) * 4)); - if (iVar4 != 0) { - if (*GHIDRA_CAST((iVar4 + 0x28)) == 5) { - if (*GHIDRA_CAST((iVar4 + 0x30)) != 0) { - if (this->_target != 0) { - local_1c = GHIDRA_CAST(&this->_target); - msvc::multiset::erase(&local_1c); - } - this->_target = iVar4; - msvc::multiset::insert(&this->_target); - this->_keys = 2; - fVar3 = *GHIDRA_CAST((iVar4 + 0x340)); - (this->_targetPosition).x = *GHIDRA_CAST((iVar4 + 0x33c)); - (this->_targetPosition).y = fVar3; - uVar2 = uStack_24; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)pickups)) + 0x4))); - } - } - } - local_18 = (float)(GHIDRA_INT(local_18) + 1); - } while (GHIDRA_UINT(local_18) < uVar2); - } - local_8 = 0xffffffff; - if (pickups[0] == '\0') { - local_8 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)pickups)) + 0x4))),0); - local_8 = 0xffffffff; - } - } - iVar4 = this->_keys; - if (iVar4 == 0) { - fVar3 = (float)(GHIDRA_INT(g_game->_room) + 0x724); - uVar2 = 0; - local_18 = fVar3; - do { - door = *GHIDRA_CAST((GHIDRA_CAST(fVar3) + uVar2 * 4)); - if (door != GHIDRA_CAST(0x0)) { - if (((door->_doorFlags & 0x50U) == 0) && - (((door->_doorFlags & 0x20U) == 0 || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x8)))) != 4)))) { - iVar4 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(); - game = g_game; - fVar3 = local_18; - if ((iVar4 != 4) && - ((iVar4 = *GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar2 * 4)), *GHIDRA_CAST((iVar4 + 0xc)) != 2 && - ((iVar4 = *GHIDRA_CAST((iVar4 + 0x160)), iVar4 == 7 || (iVar4 == 8)))))) { - this->_keys = 3; - this->_coins = uVar2; - iVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar2 * 4)) + 0x24)); - target = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - (this->_targetPosition).x = (float)(iVar4 % target) * 40.0 + 40.0; - (this->_targetPosition).y = (float)(iVar4 / target) * 40.0 + 120.0; - } - } - } - uVar2 = uVar2 + 1; - } while (uVar2 < 8); - iVar4 = this->_keys; - if (iVar4 == 0) { - fVar3 = (float)(GHIDRA_INT(g_game->_room) + 0x724); - uVar2 = 0; - local_18 = fVar3; - do { - door = *GHIDRA_CAST((GHIDRA_CAST(fVar3) + uVar2 * 4)); - if (door != GHIDRA_CAST(0x0)) { - if ((door->_doorFlags & 0x50U) == 0) { - if ((door->_doorFlags & 0x20U) != 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x8)))) == 4) goto LAB_0043df18; - } - iVar4 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(); - game = g_game; - fVar3 = local_18; - if (iVar4 != 4) { - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar2 * 4)); - if (*GHIDRA_CAST((iVar4 + 0xc)) != 2) { - if ((*GHIDRA_CAST((iVar4 + 0x160)) != 7) && (*GHIDRA_CAST((iVar4 + 0x160)) != 8)) { - this = local_14; - if (*GHIDRA_CAST((iVar4 + 0x394)) == g_game->_lastRoomIdx) { - local_1c = GHIDRA_CAST(g_manager->_netplayManager); - if (((local_1c != *GHIDRA_CAST((g_manager + 1))) && - (1 < GHIDRA_UINT((GHIDRA_INT(*GHIDRA_CAST((g_manager + 1))) - GHIDRA_INT(local_1c) >> 2)))) - && (*GHIDRA_CAST((iVar4 + 0x154)) < 0x1f)) goto LAB_0043df18; - } - local_14->_keys = 4; - local_14->_coins = uVar2; - iVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar2 * 4)) + 0x24)); - target = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - (local_14->_targetPosition).x = (float)(iVar4 % target) * 40.0 + 40.0; - (local_14->_targetPosition).y = (float)(iVar4 / target) * 40.0 + 120.0; - } - } - } - } - } -LAB_0043df18: - uVar2 = uVar2 + 1; - } while (uVar2 < 8); - iVar4 = this->_keys; - } - } - target = this->_orbitLayer; - if (iVar4 != 0) { - if (target < 0) { - ExceptionList = local_10; - return; - } - RecalculateOrbitOffset(this,target,0); - this->_orbitLayer = -1; - ExceptionList = local_10; - return; - } - if (-1 < target) { - this->_friction = 1.0; - ExceptionList = local_10; - return; - } - if (this->_variant == 0xed) { - iVar4 = this->_wispCollectibleType; - } - else if (this->_variant == 0xce) { - iVar4 = this->_subtype; - } - else { - iVar4 = 0x248; - } - wispConfig = ItemConfig::get_wisp_config(iVar4); - this->_friction = 0.7; - pvVar5 = this->_player; - local_1c = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x18c)) + 7)); - orbitLevelLow = local_1c; - if (GHIDRA_INT(local_1c) < 1) { - orbitLevelLow = GHIDRA_CAST(0x0); - } - orbitLevel = GHIDRA_CAST(0xa); - if (GHIDRA_INT(orbitLevelLow) < 10) { - orbitLevel = orbitLevelLow; - } - posY = (local_14->_pos).y; - local_18 = (local_14->_pos).x; - fVar3 = posY - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x340)); - dx = local_18 - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x33c)); - fVar3 = sqrtf(fVar3 * fVar3 + dx * dx); - if ((float)(&DAT_00c34130)[GHIDRA_INT(orbitLevel) * 5] <= fVar3) { - local_1c = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x340)) - posY)); - local_18 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x33c)) - local_18; - fVar3 = sqrtf((float)local_1c * (float)local_1c + local_18 * local_18); - if (0.0 < fVar3) { - local_1c = GHIDRA_CAST(((2.0 / fVar3) * (float)local_1c)); - local_18 = (2.0 / fVar3) * local_18; - } - fVar3 = local_14->_speedMultiplier; - (local_14->_velocity).y = (fVar3 * (float)local_1c) / 0.7 + (local_14->_velocity).y; - (local_14->_velocity).x = (fVar3 * local_18) / 0.7 + (local_14->_velocity).x; - ExceptionList = local_10; - return; - } - AddToOrbit(local_14,GHIDRA_INT(local_1c)); - ExceptionList = local_10; - return; - } - this_00 = GHIDRA_CAST(this->_target); - pos = &this->_pos; - this->_friction = 0.7; - local_18 = (this->_targetPosition).x; - fVar3 = (this->_targetPosition).y; - if (this_00 != GHIDRA_CAST(0x0)) { - local_18 = (this_00->_pos).x; - fVar3 = (this_00->_pos).y; - } - local_14 = GHIDRA_CAST((fVar3 - (this->_pos).y)); - local_18 = local_18 - pos->x; - fVar3 = local_18 * local_18 + (float)local_14 * (float)local_14; - if (fVar3 <= 225.0) { - if (iVar4 == 2) { - if (((this_00 != GHIDRA_CAST(0x0)) && (this_00->_type == 5)) && - ((this_00->_subtype != 0 && - (bVar1 = (GHIDRA_CAST((this_00)))->Entity_Pickup::TryOpenChest(GHIDRA_CAST(0x0)), bVar1 != 0)))) { -LAB_0043e26b: - killSource = &killRef; -LAB_0043e26e: - killSource = (GHIDRA_CAST((killSource)))->EntityRef::EntityRef(); - this->Kill(killSource,uVar2); - } - } - else if (iVar4 == 1) { - if (((GHIDRA_UINT(this->_coins) < 0x1c0) && - (iVar4 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x24)), iVar4 != 0)) && - (*GHIDRA_CAST((iVar4 + 0xc)) != 2)) { - nearestPlayer = Game::GetNearestPlayer(g_game,pos); - fVar3 = (this->_pos).y - (nearestPlayer->_pos).y; - dx = pos->x - (nearestPlayer->_pos).x; - fVar3 = sqrtf(fVar3 * fVar3 + dx * dx); - if (100.0 < fVar3) { - Game::BombDamage(g_game,pos,40.0,80.0,1,GHIDRA_CAST(this),g_tearFlagsNone,4,0); - uVar2 = Random(); - explosion = Game::Spawn(g_game,1000,1,pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar2); - explosion->Update(); - killSource = (GHIDRA_CAST((&killRef)))->EntityRef::EntityRef(); - this->Kill(killSource); - } - goto LAB_0043e200; - } - } - else if (iVar4 == 3) { - door = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x724)); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0xc)))) != 2) { - (GHIDRA_CAST((door)))->GridEntity_Door::TryBlowOpen(0,GHIDRA_CAST(0x0)); - goto LAB_0043e26b; - } - } - else { - if (iVar4 != 4) goto LAB_0043e200; - door = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x724)); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0xc)))) != 2) { - bVar1 = (GHIDRA_CAST((door)))->GridEntity_Door::TryUnlock(this->_player,1); - if (bVar1 == 0) { - (GHIDRA_CAST((door)))->GridEntity_Door::Open(); - } - killSource = &doorKillRef; - goto LAB_0043e26e; - } - } - this->_keys = 0; - iVar4 = 0; -LAB_0043e43e: - target = this->_target; - if (target != 0) { -LAB_0043e448: - if ((*GHIDRA_CAST((target + 0x172)) == '\0') || (*GHIDRA_CAST((target + 0x173)) != '\0')) - goto LAB_0043e460; - } - } - else { - fVar3 = sqrtf(fVar3); - if (0.0 < fVar3) { - local_18 = local_18 * (2.0 / fVar3); - local_14 = GHIDRA_CAST(((float)local_14 * (2.0 / fVar3))); - } - fVar3 = this->_speedMultiplier; - (this->_velocity).y = (fVar3 * (float)local_14) / 0.7 + (this->_velocity).y; - (this->_velocity).x = (fVar3 * local_18) / 0.7 + (this->_velocity).x; -LAB_0043e200: - iVar4 = this->_keys; - if (iVar4 != 1) { - if (iVar4 == 2) { - target = this->_target; - if (target != 0) { - targetPickup = 0; - if (*GHIDRA_CAST((target + 0x28)) == 5) { - targetPickup = target; - } - if (*GHIDRA_CAST((targetPickup + 0x30)) == 1) goto LAB_0043e448; - } - } - else if (((iVar4 != 4) && (iVar4 != 3)) || - (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x724)) + 0xc)) != 2)) - goto LAB_0043e43e; -LAB_0043e460: - this->_keys = 0; - goto LAB_0043e46a; - } - if (((0x1bf < GHIDRA_UINT(this->_coins)) || - (target = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x24)), target == 0)) || - (*GHIDRA_CAST((target + 0xc)) == 2)) { - this->_keys = 0; - iVar4 = 0; - } - } - if (iVar4 != 0) { - ExceptionList = local_10; - return; - } -LAB_0043e46a: - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - ExceptionList = local_10; - return; -} - -// 0043e4a0 -void Entity_Familiar::ai_mega_blast_wisp() -{ - uint8_t bVar1; - Entity_Laser *brimstone; - int iVar2; - int iVar3; - float fVar4; - uint32_t laserDepthOffset; - float awayDirY; - float awayDirX; - Vector local_18; - Vector local_10; - void *player; - - player = this->_player; - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x162c)); - fVar4 = sqrtf(*GHIDRA_CAST((GHIDRA_CAST(player) + 0x1630)) * *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1630)) + - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1634)) * *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1634))); - if ((fVar4 < 0.5) && (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1638)) == '\0')) { - iVar3 = -1; - } - Isaac::GetAxisAlignedUnitVectorFromDir(&local_10,this->_lastDirection); - bVar1 = TryAimAtMarkedTarget(this,&local_10,&this->_lastDirection,GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - if (this->_fireCooldown < 0) { - iVar3 = -1; - } - iVar2 = this->_linkedEntity; - if ((((iVar2 != 0) && (*GHIDRA_CAST((iVar2 + 0x28)) == 7)) && - (iVar2 = *GHIDRA_CAST((iVar2 + 0x30)), iVar2 != 1)) && ((iVar2 != 2 && (iVar2 != 3)))) { - fVar4 = atan2f(local_10.y,local_10.x); - (GHIDRA_CAST((GHIDRA_CAST(this->_linkedEntity))))->Entity_Laser::RotateToAngle(fVar4 * 57.295776,8.0); - } - } - player = this->_player; - if (((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x139a)) == '\0')) && - ((*GHIDRA_CAST(&g_game->_stageTransition) == 0 && - ((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x414)) < 1)))))) { - if (iVar3 == -1) { - if ((this->_fireCooldown < 0) && - (((local_10.x != g_vectorZero.x || (local_10.y != g_vectorZero.y)) && - (this->_linkedEntity == 0)))) { - brimstone = FireBrimstone(this,&local_10,1); - _DAT_00c5c554 = local_10.x * 7.0; - DAT_00c5c558 = local_10.y * 5.0 - 18.0; - iVar2 = *GHIDRA_CAST(brimstone); - (brimstone->_posOffset).x = _DAT_00c5c554; - (brimstone->_posOffset).y = DAT_00c5c558; - (**(code **)(iVar2 + 0xc))(); - this->_headFrameDelay = 0x1e; - iVar2 = vector_to_direction(&local_10); - PlayShootAnim(this,iVar2); - } - iVar2 = this->_headFrameDelay; - this->_fireCooldown = 0x1e; - } - else { - iVar2 = this->_headFrameDelay; - if (iVar2 < 9) { - this->_fireCooldown = this->_fireCooldown + -1; - } - this->_lastDirection = iVar3; - } - if (iVar2 < 9) { - if (iVar3 == -1) { - PlayFloatAnim(this,*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1628))); - } - else { - PlayChargeAnim(this,this->_lastDirection); - } - this->_headFrameDelay = 8; - } - else { - this->_headFrameDelay = iVar2 + -1; - } - } - awayDirY = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - awayDirX = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_18.x = awayDirX; - local_18.y = awayDirY; - fVar4 = sqrtf(awayDirY * awayDirY + awayDirX * awayDirX); - if (0.0 < fVar4) { - awayDirX = awayDirX * (1.0 / fVar4); - awayDirY = awayDirY * (1.0 / fVar4); - local_18.x = awayDirX; - local_18.y = awayDirY; - } - if ((0 < *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x18f4))) && (this->_linkedEntity == 0)) { - local_10.x = (float)FireBrimstone(this,&local_18,0); - awayDirX = local_18.x; - _DAT_00c5c554 = local_18.x * 7.0; - awayDirY = local_18.y; - DAT_00c5c558 = local_18.y * 5.0 - 18.0; - ((GHIDRA_CAST(local_10.x))->_posOffset).x = _DAT_00c5c554; - ((GHIDRA_CAST(local_10.x))->_posOffset).y = DAT_00c5c558; - (GHIDRA_CAST(local_10.x))->_timeout = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x18f4)); - (**(code **)(*GHIDRA_CAST(local_10.x) + 0xc))(); - if (this->_linkedEntity != 0) { - local_18.x = (float)&this->_linkedEntity; - msvc::multiset::erase(&local_18); - } - this->_linkedEntity = local_10.x; - msvc::multiset::insert(&this->_linkedEntity); - this->_headFrameDelay = 0x1e; - PlayShootAnim(this,iVar3); - } - iVar3 = this->_linkedEntity; - if (iVar3 != 0) { - fVar4 = atan2f(awayDirY,awayDirX); - *GHIDRA_CAST((iVar3 + 0x4c0)) = 1; - *GHIDRA_CAST((iVar3 + 0x4c4)) = 0; - local_18.x = ABS(fVar4 * 57.295776); - fVar4 = angle_difference(*GHIDRA_CAST((iVar3 + 0x41c)),fVar4 * 57.295776); - *GHIDRA_CAST((iVar3 + 0x4c8)) = fVar4; - if (fVar4 < 0.0) { - local_18.x = -local_18.x; - } - *GHIDRA_CAST((iVar3 + 0x4cc)) = local_18.x; - if (-0.5 <= awayDirY) { - laserDepthOffset = 0x453b8000; - } - else { - laserDepthOffset = 0xc1200000; - } - *GHIDRA_CAST((iVar3 + 0x358)) = laserDepthOffset; - _DAT_00c5c554 = awayDirX * 7.0; - DAT_00c5c558 = awayDirY * 5.0 - 18.0; - *GHIDRA_CAST((iVar3 + 0x34c)) = _DAT_00c5c554; - *GHIDRA_CAST((iVar3 + 0x350)) = DAT_00c5c558; - } - return; -} - -// 0043eb10 -int Entity_Familiar::GetRandomWisp(RNG *rng) -{ - code *pcVar1; - RNG *pRVar2; - void *pvVar3; - int wispItemId; - uint32_t nextSeed; - int *wispItemsEnd; - uint32_t uVar4; - int *wispItemsCapacityEnd; - int *taggedItemIt; - int taggedItemsEnd; - void *wispItems; - int *local_24; - int *local_20; - RNG *local_1c; - void *wispItemsBegin; - uint32_t itemsLeft; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af2305; - local_10 = ExceptionList; - ExceptionList = &local_10; - local_1c = rng; - pvVar3 = ItemConfig::GetTaggedItems(&g_manager->_itemConfig,0x4000000); - msvc::vector::copy_constructor(pvVar3); - wispItemsEnd = GHIDRA_CAST(0x0); - wispItemsBegin = (void *)0x0; - wispItemsCapacityEnd = GHIDRA_CAST(0x0); - wispItems = (void *)0x0; - local_24 = GHIDRA_CAST(0x0); - local_20 = GHIDRA_CAST(0x0); - local_8 = 1; - itemsLeft = taggedItemsEnd - GHIDRA_INT(taggedItemIt) >> 2; - if (itemsLeft != 0) { - if (0x3fffffff < itemsLeft) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - msvc::vector::_Reallocate(itemsLeft); - wispItemsEnd = local_24; - wispItemsCapacityEnd = local_20; - do { - if (0 < *GHIDRA_CAST((*GHIDRA_CAST((*taggedItemIt + 0xcc)) + 400))) { - if (wispItemsEnd == wispItemsCapacityEnd) { - msvc::vector::_Emplace_reallocate(wispItemsEnd,taggedItemIt); - wispItemsEnd = local_24; - wispItemsCapacityEnd = local_20; - } - else { - *wispItemsEnd = *taggedItemIt; - local_24 = wispItemsEnd + 1; - wispItemsEnd = local_24; - } - } - taggedItemIt = taggedItemIt + 1; - itemsLeft = itemsLeft - 1; - } while (itemsLeft != 0); - wispItemsBegin = wispItems; - itemsLeft = 0; - } - pRVar2 = local_1c; - uVar4 = GHIDRA_INT(wispItemsEnd) - GHIDRA_INT(wispItemsBegin) >> 2; - wispItems = wispItemsBegin; - if (uVar4 == 0) { - wispItemId = 0x248; - } - else { - nextSeed = local_1c->_seed; - if (nextSeed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - nextSeed = pRVar2->_seed; - if (nextSeed == 0) { - pcVar1 = (code *)swi(3); - wispItemId = (*pcVar1)(); - return wispItemId; - } - } - nextSeed = nextSeed >> ((uint8_t)pRVar2->_shift1 & 0x1f) ^ nextSeed; - nextSeed = nextSeed << ((uint8_t)pRVar2->_shift2 & 0x1f) ^ nextSeed; - nextSeed = nextSeed >> ((uint8_t)pRVar2->_shift3 & 0x1f) ^ nextSeed; - pRVar2->_seed = nextSeed; - wispItemId = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(wispItemsBegin) + (nextSeed % uVar4) * 4)) + 4)); - } - if (wispItemsBegin != (void *)0x0) { - uVar4 = GHIDRA_INT(wispItemsCapacityEnd) - GHIDRA_INT(wispItemsBegin) & 0xfffffffc; - pvVar3 = wispItemsBegin; - if (0xfff < uVar4) { - pvVar3 = *(void **)(GHIDRA_CAST(wispItemsBegin) + -4); - uVar4 = uVar4 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(wispItemsBegin) + (-4 - GHIDRA_INT(pvVar3))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar3,uVar4); - } - FID_conflict__Tidy(&taggedItemIt); - ExceptionList = local_10; - return wispItemId; -} - -// 00505cf0 -int Entity_Familiar::Coins() -{ - return this->_coins; -} - -// 005ae490 -void Entity_Familiar::ai_buddy_inbox() -{ - uint8_t bVar1; - char cVar2; - int backAnimOffset; - uint32_t uVar3; - uint8_t *pbVar4; - uint8_t unused; - uint8_t *pbVar5; - uint8_t *pbVar6; - char *pcVar7; - bool isLess; - float angle; - uint64_t uVar8; - Vector VStack_c0; - float savedFrame; - ProjectileParams projParams; - float securityCookie; - int headState; - - securityCookie = (float)(__security_cookie ^ GHIDRA_UINT(&(&projParams)[1].CircleAngle)); - switch(this->_subtype) { - case 0: - backAnimOffset = 0; - headState = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_pathfinder))) + 0x5c4)))); - if ((this->_velocity).y < 0.0) { - backAnimOffset = 4; - } - if (headState != 1) { - if (headState == 2) { - ANM2::Play(&this->_sprite, - *GHIDRA_CAST((GHIDRA_INT(&PTR_s_HeadFrontWiggleOpen_00b62994) + backAnimOffset)),0); - return; - } - ANM2::Play(&this->_sprite, - *GHIDRA_CAST((GHIDRA_INT(&PTR_s_HeadFrontWiggleClosed_00b6299c) + backAnimOffset)),0); - return; - } - VStack_c0.y = *GHIDRA_CAST((GHIDRA_INT(&PTR_s_HeadFrontWiggleTransition_00b6298c) + backAnimOffset)); - uVar8 = _string_holder_c_str(); - pbVar5 = GHIDRA_CAST(uVar8); - do { - pbVar6 = GHIDRA_CAST(((uint64_t)uVar8 >> 0x20)); - pbVar4 = GHIDRA_CAST(uVar8); - bVar1 = *pbVar4; - isLess = bVar1 < *pbVar6; - if (bVar1 != *pbVar6) { -LAB_005ae518: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_005ae51d; - } - if (bVar1 == 0) break; - bVar1 = pbVar4[1]; - isLess = bVar1 < pbVar6[1]; - if (bVar1 != pbVar6[1]) goto LAB_005ae518; - uVar8 = CONCAT44(pbVar6 + 2,pbVar4 + 2); - } while (bVar1 != 0); - uVar3 = 0; -LAB_005ae51d: - if (uVar3 == 0) { -LAB_005ae551: - pcVar7 = "HeadBackWiggleTransition"; - do { - bVar1 = *pbVar5; - isLess = bVar1 < (uint8_t)*pcVar7; - if (bVar1 != *pcVar7) { -LAB_005ae576: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_005ae57b; - } - if (bVar1 == 0) break; - bVar1 = pbVar5[1]; - isLess = bVar1 < (uint8_t)pcVar7[1]; - if (bVar1 != pcVar7[1]) goto LAB_005ae576; - pbVar5 = pbVar5 + 2; - pcVar7 = pcVar7 + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_005ae57b: - if (uVar3 == 0) goto LAB_005ae57f; - ANM2::Play(&this->_sprite,GHIDRA_CAST(VStack_c0.y),0); - } - else { - pcVar7 = "HeadFrontWiggleTransition"; - pbVar4 = pbVar5; - do { - bVar1 = *pbVar4; - isLess = bVar1 < (uint8_t)*pcVar7; - if (bVar1 != *pcVar7) { -LAB_005ae548: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_005ae54d; - } - if (bVar1 == 0) break; - bVar1 = pbVar4[1]; - isLess = bVar1 < (uint8_t)pcVar7[1]; - if (bVar1 != pcVar7[1]) goto LAB_005ae548; - pbVar4 = pbVar4 + 2; - pcVar7 = pcVar7 + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_005ae54d: - if (uVar3 != 0) goto LAB_005ae551; -LAB_005ae57f: - if ((this->_sprite)._animState._animData == (void *)0x0) { - savedFrame = (float)&DAT_bf800000; - } - else { - savedFrame = (this->_sprite)._animState._animFrame; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(VStack_c0.y),0); - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,savedFrame); - } - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - if (bVar1 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_NPC::PlaySound(0xe2,1.0,2,0,1.0); - (GHIDRA_CAST((&projParams)))->ProjectileParams::ProjectileParams(); - cVar2 = FUN_005ae1d0(); - if (cVar2 == '\0') { - uVar3 = Game::GetStageID(g_game,unused); - projParams.Variant = (uVar3 != 0x1c) + 3; - } - VStack_c0.x = 10.0; - VStack_c0.y = 0.0; - Entity_NPC::FireProjectiles(GHIDRA_CAST(this),&this->_pos,&VStack_c0,6,&projParams); - } - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_pathfinder))) + 0x5c4)))) = 2; - return; - } - break; - case 1: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Body1Wiggle"),0); - return; - case 2: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Body2Wiggle"),0); - return; - case 3: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Body3Wiggle"),0); - return; - case 4: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Body4Wiggle"),0); - return; - case 5: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Body5Wiggle"),0); - return; - case 6: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Body6Wiggle"),0); - headState = this->_parent; - angle = atan2f(((*GHIDRA_CAST((headState + 0x340)) + *GHIDRA_CAST((headState + 0x350))) - (this->_pos).y - ) - (this->_posOffset).y, - ((*GHIDRA_CAST((headState + 0x33c)) + *GHIDRA_CAST((headState + 0x34c))) - (this->_pos).x - ) - (this->_posOffset).x); - angle = normalize_angle_degrees(angle * 57.295776 - (this->_sprite)._rotation); - angle = normalize_angle_degrees(angle * 0.3 + (this->_sprite)._rotation); - (this->_sprite)._rotation = angle; - } - return; -} - -// 0060d0e0 -int Entity_Familiar::Hearts() -{ - return this->_hearts; -} - -// 0060d100 -int Entity_Familiar::Keys() -{ - return this->_keys; -} - -// 0060d180 -KColor * Entity_Familiar::GetPlayerSlot(KColor *outColor, Entity_Player *player) -{ - int playerColor; - std_string *psVar1; - - playerColor = 0; - psVar1 = &(this->_sprite)._animDefaultName; - do { - if (*GHIDRA_CAST(psVar1->_buf) == player->_controllerIndex) goto LAB_0060d1a3; - playerColor = playerColor + 1; - psVar1 = GHIDRA_CAST((psVar1->_buf + 4)); - } while (playerColor < 4); - playerColor = 5; -LAB_0060d1a3: - PlayerManager::GetPlayerColorValue(outColor,playerColor); - return outColor; -} - -// 0060d200 -void Entity_Familiar::Constructor() -{ - uint32_t *slotCursor; - void *setHead; - int remaining; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6753; - local_10 = ExceptionList; - ExceptionList = &local_10; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - local_8 = 0; - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Familiar::vftable; - remaining = 0x3c; - slotCursor = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x418)))); - do { - slotCursor[1] = 0; - *slotCursor = 0; - remaining = remaining + -1; - slotCursor = slotCursor + 2; - } while (remaining != 0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Init(GHIDRA_CAST(this)); - (this->_orbitDistance).y = 0.0; - (this->_orbitDistance).x = 0.0; - this->_isSubtype55555 = 0; - this->_isHourglassRewound = 0; - (this->_formationOffset).y = 0.0; - (this->_formationOffset).x = 0.0; - (this->_formationTargetOffset).y = 0.0; - (this->_formationTargetOffset).x = 0.0; - (this->_hitList)._begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 2; - ANM2::constructor(&this->_chargeBarSprite); - this->_extraData = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xee4)))) = 0; - this->_sirenHelper = 0; - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),5); - this->_sirenCharmFrames = 0; - (this->_dirtColor)._tint[0] = 1.0; - (this->_dirtColor)._tint[1] = 1.0; - (this->_dirtColor)._tint[2] = 1.0; - (this->_dirtColor)._tint[3] = 1.0; - (this->_dirtColor)._colorize[0] = 0.0; - (this->_dirtColor)._colorize[1] = 0.0; - (this->_dirtColor)._colorize[2] = 0.0; - (this->_dirtColor)._colorize[3] = 0.0; - (this->_dirtColor)._offset[0] = 0.0; - (this->_dirtColor)._offset[1] = 0.0; - (this->_dirtColor)._offset[2] = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf38)))) = 10; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf40)))) = 0; - setHead = operator_new(0x18); - *(void **)setHead = setHead; - *(void **)(GHIDRA_CAST(setHead) + 4) = setHead; - *(void **)(GHIDRA_CAST(setHead) + 8) = setHead; - *GHIDRA_CAST((GHIDRA_CAST(setHead) + 0xc)) = 0x101; - *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c))) = setHead; - ExceptionList = local_10; - return; -} - -// 0060d8c0 -uint8_t Entity_Familiar::CanBeDamagedByEnemy() -{ - int variant; - - variant = this->_variant; - if ((((variant == 0x3e) || (variant == 0x43)) || (variant == 0xd3)) || (variant == 100)) { - return 1; - } - return 0; -} - -// 0060d8e0 -uint8_t Entity_Familiar::CanBlockProjectiles() -{ - int iVar1; - uint8_t isHasTag; - void *pvVar2; - bool isBlocker; - BitSet128 itemTags; - - iVar1 = this->_variant; - if (iVar1 == 0x23) { - return 1; - } - if (iVar1 == 0x2c) { - return 1; - } - if (iVar1 == 0x2d) { - return 1; - } - if (iVar1 == 0x21) { - return 1; - } - if (iVar1 == 0x41) { - return 1; - } - if (iVar1 == 0x20) { - return 1; - } - if (iVar1 == 0x2a) { - return 1; - } - if (iVar1 == 0x11) { - return 1; - } - if (iVar1 == 0x33) { - return 1; - } - if (iVar1 == 0x4b) { - return 1; - } - if (iVar1 == 0x32) { - isBlocker = this->_subtype == 0; - } - else { - if (iVar1 == 0x44) { - return 1; - } - if (iVar1 == 0x43) { - return 1; - } - if (iVar1 == 0x53) { - return 1; - } - if (iVar1 == 0x5f) { - return 1; - } - if (iVar1 == 0x45) { - return 1; - } - if (iVar1 == 0x46) { - return 1; - } - if (iVar1 == 0x67) { - return 1; - } - if (iVar1 == 0x68) { -LAB_0060d954: - if (this->_fireCooldown < 0) { - return 1; - } - return 0; - } - if (iVar1 == 0x6b) { - isBlocker = this->_subtype == 1; - } - else { - if (iVar1 == 0x79) { - return 1; - } - if (iVar1 == 0x80) { - return 1; - } - if (iVar1 == 0x82) { - return 1; - } - if (iVar1 == 900) { - return 1; - } - if (iVar1 == 0x74) { - return 1; - } - if (iVar1 == 0x75) { - return 1; - } - if (iVar1 == 0xcf) { - return 1; - } - if (iVar1 == 0xe2) { - return 1; - } - if (iVar1 == 0xe4) { - return 1; - } - if (iVar1 == 0xee) { - return 1; - } - if (iVar1 == 0xe0) { - return 1; - } - if (iVar1 == 0xc9) { - return 1; - } - if (iVar1 == 0xd8) { - return 1; - } - if (iVar1 == 0xd9) { - return 1; - } - if (iVar1 == 0xce) { - if (this->_subtype == 0x2be) { - return 0; - } - return 1; - } - if (iVar1 == 0xed) { - return 1; - } - if (iVar1 == 0xe5) { - return 1; - } - if (iVar1 == 0xcc) { - return 1; - } - if (iVar1 == 0xd3) { - return 1; - } - if (iVar1 == 0xe7) { - pvVar2 = get_item_config_entry(this); - (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._l)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 8)) & GHIDRA_UINT(g_tearFlagShielded._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._h)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)) & GHIDRA_UINT(g_tearFlagShielded._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x14)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._h)) + 0x4))); - isHasTag = (GHIDRA_CAST((&itemTags)))->BitSet128::IsNonZero(); - if (isHasTag == 0) { - return 0; - } - return 1; - } - if (iVar1 == 0xe8) goto LAB_0060d954; - if (iVar1 == 0xea) { - return 1; - } - if (iVar1 == 0xef) { - return 1; - } - if (iVar1 == 100) { - return 1; - } - isBlocker = iVar1 == 0xf3; - } - } - if (isBlocker) { - return 1; - } - return 0; -} - -// 0060dab0 -uint8_t Entity_Familiar::CanShutDoors() -{ - if (((this->_variant == 0xf2) && (this->_coins != 0)) && (this->_visible != 0)) { - return 1; - } - return 0; -} - -// 0060dc40 -float Entity_Familiar::apply_tear_modifiers() -{ - uint8_t isOwned; - int trinketMultiplier; - int iVar1; - Entity_Player *player; - bool bVar2; - bool bVar3; - float multiplier; - uint32_t familiarFlags; - void *ownerPlayer; - void *twin; - - familiarFlags = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0xd8)); - iVar1 = this->_variant; - isOwned = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - if ((((isOwned == 0) || (this->_variant == 0x2b)) || (this->_variant == 0x49)) && - (((isOwned = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf8,0), isOwned == 0 && - (isOwned = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),0xf8), isOwned == 0)) - || (((familiarFlags & 1) == 0 && (((familiarFlags & 2) == 0 && (iVar1 != 0xe7)))))))) { - multiplier = 1.0; - } - else { - multiplier = 2.0; - } - player = this->_player; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) != 0x59)) { - iVar1 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x59); - bVar3 = false; - bVar2 = iVar1 == 0; -LAB_0060dd32: - if (bVar2 || bVar3 != iVar1 < 0) goto LAB_0060dd6f; - player = this->_player; - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef0))) == '\0') { - trinketMultiplier = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x59); - bVar3 = SBORROW4(trinketMultiplier,1); - iVar1 = trinketMultiplier + -1; - bVar2 = trinketMultiplier == 1; - goto LAB_0060dd32; - } - iVar1 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x59); - multiplier = (float)iVar1 * 0.25 + multiplier; -LAB_0060dd6f: - ownerPlayer = this->_player; - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(ownerPlayer) + 0x13c0)); - if (iVar1 == 0x24) { - multiplier = multiplier * 0.75; - } - if (((*GHIDRA_CAST((GHIDRA_CAST(ownerPlayer) + 0x172)) != '\0') && - ((((iVar1 == 0x1d || (iVar1 == 0x26)) && - (twin = *(void **)(GHIDRA_CAST(ownerPlayer) + 0x1e68), twin != (void *)0x0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(twin) + 0x161c)) != -1 && - (*GHIDRA_CAST((GHIDRA_CAST(twin) + 0x161c)) < *GHIDRA_CAST((GHIDRA_CAST(ownerPlayer) + 0x161c)))))))) && - (twin != ownerPlayer)) { - multiplier = multiplier * 0.25; - } - return multiplier; -} - -// 0060ddd0 -void Entity_Familiar::set_locust_config_index(int param_2) -{ - void *locustEntry; - int iVar1; - float locustScale; - - iVar1 = this->_variant; - if (iVar1 != 0xe7) { - KAGE_LogMessage(0x10,(uint8_t *) - "Trying to set locust config index on something that isn\'t a locust\n"); - iVar1 = this->_variant; - } - this->_coins = param_2; - if (iVar1 == 0xe7) { - iVar1 = this->_subtype; - } - else { - iVar1 = 0x19; - param_2 = 0; - } - locustEntry = ItemConfig::get_wisp_entry(iVar1,param_2); - anm2_apply_gfx_overrides - (GHIDRA_CAST((GHIDRA_INT(locustEntry) + 0x84)),GHIDRA_CAST((GHIDRA_INT(locustEntry) + 0x9c)), - &this->_sprite); - this->_size = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)) * *GHIDRA_CAST((GHIDRA_CAST(locustEntry) + 0x78)); - locustScale = *GHIDRA_CAST((GHIDRA_CAST(locustEntry) + 0x78)); - (this->_sprite)._scale.x = locustScale; - (this->_sprite)._scale.y = locustScale; - return; -} - -// 00610470 -void Entity_Familiar::Remove() -{ - void *player; - int *playerCounter; - int variant; - float zeroY; - - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Remove(); - if (-1 < this->_orbitLayer) { - RecalculateOrbitOffset(this,this->_orbitLayer,0); - this->_orbitLayer = -1; - } - RemoveFromFollowers(this); - RemoveFromDelayed(this); - if (this->_variant == 0x2b) { - if (this->_subtype == 0) { - playerCounter = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x136c)); - *playerCounter = *playerCounter + -1; - } - } - else if (this->_variant == 0x49) { - playerCounter = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1370)); - *playerCounter = *playerCounter + -1; - } - zeroY = g_vectorZero.y; - variant = this->_variant; - if (((variant == 0x44) || (variant == 0x4e)) || (variant == 0xf3)) { - player = this->_player; - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x164c)) = g_vectorZero.x; - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1650)) = zeroY; - } - ResolveOrbitConflict(this); - return; -} - -// 00610540 -void Entity_Familiar::Kill(EntityRef *source) -{ - code *pcVar1; - int64_t lVar2; - int64_t lVar3; - int64_t lVar4; - ANM2 *pAVar5; - char cVar6; - uint8_t bVar7; - ColorMod *color; - uint32_t uVar8; - Entity *tmpEntity; - Entity *orbitParent; - ColorMod *color_00; - ColorMod *color_01; - int orbitLayerClamped; - ColorMod *color_02; - int *piVar9; - Vector *posPtr; - uint32_t uVar10; - uint32_t uVar11; - LayerState *layer; - EntityRef *killSourcePtr; - int iVar12; - int unusedArg; - void *pvVar13; - uint64_t *allocatedBytes; - Sprite *player; - Sprite *this_01; - Entity_Familiar *pEVar14; - PlayerManager *playerManager; - uint32_t *ptrSlot; - bool bVar15; - float fVar16; - uint64_t uVar17; - uint64_t uVar18; - EntityRef killSource; - Vector freePickupPos; - uint8_t itemFindResult [8]; - int itemNode; - uint8_t anyVariantFind [4]; - EntityRef nullKillSource; - Vector spawnPos; - uint64_t rngShifts; - uint32_t rngShift3; - int triggerKeyType; - uint32_t triggerKeyAnyVariant; - int triggerKeyTypeVariant; - int triggerKeyVariant; - int *spawnerPtr; - uint32_t collectibleKey; - Vector pickupVelocity; - char wispMates [4]; - int wispMatesData; - uint8_t *wispMatesCapacity; - Entity_Familiar *wispMatesCount; - char itemWispMates [4]; - int itemWispMatesData; - uint8_t *itemWispMatesCapacity; - Entity_Familiar *itemWispMatesCount; - Vector local_198; - Vector local_190; - EntityList_EL itemWispQuery; - EntityList_EL wispQuery; - Vector pickupPos; - uint32_t pickupSeed; - int soundId; - Vector local_158; - Vector local_150; - void *local_148; - uint32_t pickupType; - uint32_t local_140; - uint32_t *local_13c; - Game *local_138; - Entity *local_134; - uint32_t pickupSubtype; - Entity_Familiar *local_12c; - uint32_t local_128; - Entity_Familiar *local_124; - uint64_t local_120; - Entity_Familiar *local_118; - char isUnicornWisp; - Color tearPoofColor; - Color poofColor; - Color particleColor; - Color particleColor2; - RNG cardRng; - ColorMod splatColor; - void *local_1c; - uint8_t *puStack_18; - float local_14; - Game *game; - Manager *manager; - uint64_t oldAllocated; - Entity_Familiar *otherFamiliar; - Entity_Player *player; - void **spiderCount; - - manager = g_manager; - local_14 = -NAN; - puStack_18 = &LAB_00af68e1; - local_1c = ExceptionList; - ExceptionList = &local_1c; - local_12c = this; - if (this->_dead == 0) { - iVar12 = this->_variant; - if (iVar12 == 0x80) { - (GHIDRA_CAST((&particleColor)))->Color::Color(); - uVar8 = Random(); - Game::SpawnParticles - (g_game,&this->_pos,0x23,8, - (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0,color,-12.0,0); - uVar8 = Random(); - manager = g_manager; - local_120 = CONCAT44(0xb5,(float)local_120); - local_124 = (Entity_Familiar *) - ((float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 1.0); - seed_fart_sound_override(GHIDRA_CAST((GHIDRA_INT(&local_120) + 4))); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))),0.5,2,0,(float)local_124,0.0); - } - else if ((iVar12 == 0xd8) || (iVar12 == 0xd9)) { - soundId = 0x1e; - seed_fart_sound_override(&soundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); - splatColor._tint[0] = 0.2; - splatColor._tint[1] = 0.2; - splatColor._tint[2] = 0.2; - splatColor._tint[3] = 1.0; - splatColor._offset[0] = 0.0; - splatColor._colorize[0] = 1.0; - splatColor._colorize[1] = 1.0; - splatColor._colorize[2] = 1.0; - splatColor._colorize[3] = 1.0; - splatColor._offset[1] = 0.0; - splatColor._offset[2] = 0.0; - uVar8 = Random(); - posPtr = &this->_pos; - local_198.y = (float)posPtr; - tmpEntity = Game::SpawnEx(g_game,1000,2,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar8,0); - tmpEntity->SetColor(&splatColor,0xffffffff,0xff,0,1); - uVar8 = Random(); - tmpEntity = Game::SpawnEx(g_game,1000,7,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8,0); - tmpEntity->SetColor(&splatColor,0xffffffff,0xff,0,1); - tmpEntity->Update(); - uVar8 = Random(); - for (local_124 = GHIDRA_CAST((uVar8 % 5 + 3)); local_124 != GHIDRA_CAST(0x0); - local_124 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_124[-1])) + 0xf47))))) { - uVar8 = Random(); - fVar16 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_134 = GHIDRA_CAST((fVar16 + fVar16)); - fVar16 = cos((float)local_134); - pickupPos.x = fVar16 * 0.5 * this->_size + (this->_pos).x; - fVar16 = sin((float)local_134); - pickupPos.y = fVar16 * 0.5 * this->_size + (this->_pos).y; - uVar8 = Random(); - fVar16 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))) = GHIDRA_CAST((fVar16 + fVar16)); - uVar8 = Random(); - local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))), - (float)((double)GHIDRA_INT(uVar8) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * - 4.0 + 2.0); - pickupVelocity.x = cos((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_120)) + 0x4)))); - pickupVelocity.x = pickupVelocity.x * (float)local_120; - local_150.y = pickupVelocity.x; - fVar16 = sin((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_120)) + 0x4)))); - pickupVelocity.y = fVar16 * (float)local_120; - local_13c = GHIDRA_CAST(pickupVelocity.y); - pickupSeed = Random(); - local_138 = g_game; - pickupSubtype = 0; - local_140 = 5; - pickupType = 1000; - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&pickupType),GHIDRA_CAST(&local_140),&pickupPos,&pickupVelocity,GHIDRA_CAST(0x0), - GHIDRA_CAST(&pickupSubtype),&pickupSeed); - uVar8 = local_140; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_00611aa8: - local_128 = pickupSubtype; - } - else { - local_118 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - uVar11 = Random(); - pEVar14 = local_118; - uVar10 = pickupSubtype; - rngShifts = 0x900000005; - local_120 = CONCAT44(uVar11,7); - rngShift3 = 7; - if (pickupType != 5) goto LAB_00611aa8; - if (uVar8 < 0x12d) { - if (uVar8 == 300) { - while ((local_128 = pickupSubtype, pickupSubtype == 0 || - (cVar6 = local_118->Kill(pickupSubtype), cVar6 != '\0') - )) { - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar11 = uVar11 >> ((uint8_t)rngShifts & 0x1f) ^ uVar11; - uVar11 = uVar11 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar11; - uVar11 = uVar11 >> ((uint8_t)local_120 & 0x1f) ^ uVar11; - iVar12 = ItemPool::GetCardEx(uVar11,0x19,10,10,1); - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._shift3 = 7; - cardRng._seed = uVar11; - pickupSubtype = lua_callback_run_get_card(&cardRng,iVar12,1,1,0); - } - } - else { - if (uVar8 == 0x46) { - local_134 = GHIDRA_CAST((pickupSubtype >> 0xb)); - do { - local_128 = pickupSubtype; - if (pickupSubtype != 0) { - pcVar1 = *(code **)(*GHIDRA_CAST(local_118) + 0x28); - iVar12 = ItemPool::GetPillEffect - (&g_game->_itemPool,pickupSubtype,GHIDRA_CAST(0x0)); - cVar6 = (*pcVar1)(iVar12); - if (cVar6 == '\0') goto LAB_00611ab4; - uVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_120))) + 0x4))); - } - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar11 = uVar11 >> ((uint8_t)rngShifts & 0x1f) ^ uVar11; - uVar11 = uVar11 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar11; - uVar11 = uVar11 >> ((uint8_t)local_120 & 0x1f) ^ uVar11; - local_120 = CONCAT44(uVar11,(float)local_120); - pickupSubtype = ItemPool::GetPill(uVar11); - pickupSubtype = pickupSubtype | (GHIDRA_UINT(local_134) & 1) << 0xb; - } while( true ); - } - if (uVar8 != 100) goto LAB_00611aa8; - local_128 = pickupSubtype; - if (pickupSubtype == 0x19) { -LAB_006118d4: - bVar15 = false; - } - else { - collectibleKey = pickupSubtype; - msvc::set::find_node(itemFindResult,&collectibleKey); - if (((*GHIDRA_CAST((itemNode + 0xd)) == '\0') && - (*GHIDRA_CAST((itemNode + 0x10)) <= GHIDRA_INT(uVar10))) && (itemNode != pEVar14->_index)) - goto LAB_006118d4; - bVar15 = true; - } - if ((uVar10 == 0) || (bVar15)) { - pickupSubtype = (**(code **)(*GHIDRA_CAST(pEVar14) + 0x84))(0); - local_128 = pickupSubtype; - } - } - } - else { - if (uVar8 != 0x15e) goto LAB_00611aa8; - while ((local_128 = pickupSubtype, pickupSubtype == 0 || - (cVar6 = local_118->guard_check_icall(pickupSubtype), cVar6 != '\0'))) - { - pickupSubtype = ItemPool::GetTrinket(&g_game->_itemPool,0); - } - } - } -LAB_00611ab4: - local_134 = (GHIDRA_CAST((local_138->_entityFactory)))->EntityFactory::Create(pickupType,0); - lVar2 = CONCAT44(local_138,local_158.y); - if (local_134 != GHIDRA_CAST(0x0)) { - uVar17 = GetTimeNs(); - tmpEntity = local_134; - lVar2 = (uVar17 & 0xffffffff) * 0x431bde82; - local_158.y = (float)((uint64_t)lVar2 >> 0x20); - lVar3 = (uVar17 >> 0x20) * 0xd7b634db; - local_118 = GHIDRA_CAST(((uint64_t)lVar3 >> 0x20)); - uVar18 = lVar3 + ((uVar17 & 0xffffffff) * 0xd7b634db >> 0x20); - uVar10 = GHIDRA_UINT((uVar18 >> 0x20)); - lVar2 = lVar2 + (uVar18 & 0xffffffff); - local_190.x = (float)lVar2; - uVar8 = GHIDRA_UINT(((uint64_t)lVar2 >> 0x20)); - lVar2 = (uVar17 >> 0x20) * 0x431bde82 + - (uint64_t)CONCAT14(CARRY4(uVar10,uVar8),uVar10 + uVar8); - local_134->_spawnerType = 0; - uVar8 = GHIDRA_UINT(((uint64_t)lVar2 >> 0x20)); - local_134->_spawnerVariant = 0; - ptrSlot = &local_134->_spawnerEntity; - local_120 = CONCAT44(uVar8 >> 0x12,GHIDRA_UINT(lVar2) >> 0x12 | uVar8 * 0x4000); - if (*ptrSlot != 0) { - spawnerPtr = ptrSlot; - msvc::multiset::erase(&spawnerPtr); - } - iVar12 = *GHIDRA_CAST(tmpEntity); - *ptrSlot = 0; - (tmpEntity->_pos).x = pickupPos.x; - (tmpEntity->_pos).y = pickupPos.y; - (tmpEntity->_velocity).x = local_150.y; - (tmpEntity->_velocity).y = (float)local_13c; - (**(code **)(iVar12 + 4))(pickupType,local_140,local_128,pickupSeed); - game = local_138; - pvVar13 = local_138->_room; - iVar12 = *GHIDRA_CAST((GHIDRA_CAST(pvVar13) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar13) + 0x1214)) = iVar12 + 1; - tmpEntity->_index = iVar12; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar13) + 0x1218)))))->EntityList::AddEntity(tmpEntity); - bVar7 = Game::ShouldEraseEnemy(tmpEntity); - if (bVar7 != 0) { - Entity::RemoveWithPoof(tmpEntity,unusedArg); - } - if ((tmpEntity->_exists != 0) && - ((game->_proceduralItemManager)._proceduralItems._begin != - (game->_proceduralItemManager)._proceduralItems._end)) { - triggerKeyTypeVariant = tmpEntity->_type; - triggerKeyVariant = tmpEntity->_variant; - msvc::map::find(&local_148,&triggerKeyTypeVariant); - if (local_148 == (game->_proceduralItemManager)._spawnTriggerTargets._head) { - triggerKeyType = tmpEntity->_type; - triggerKeyAnyVariant = 0xffffffff; - piVar9 = GHIDRA_CAST(std)::map::find(anyVariantFind,&triggerKeyType); - local_148 = (void *)*piVar9; - if (local_148 == (game->_proceduralItemManager)._spawnTriggerTargets._head) - goto LAB_00611d87; - } - playerManager = &g_game->_playerManager; - local_118 = GHIDRA_CAST(0x0); - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - pvVar13 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar13) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,(uint8_t *) - "PlayerManager::GetPlayer() : There are no players! \n"); - pvVar13 = (playerManager->_playerList)._end; - } - piVar9 = (playerManager->_playerList)._begin; - if (local_118 < GHIDRA_CAST((GHIDRA_INT(pvVar13) - GHIDRA_INT(piVar9) >> 2))) { - piVar9 = piVar9 + GHIDRA_INT(local_118); - } - trigger_set_dispatch - ((void *)(*piVar9 + 0x1fc8),6,tmpEntity,&pickupPos,&pickupVelocity); - playerManager = &g_game->_playerManager; - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - } while (local_118 < - (uint8_t *) - (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2)); - } - } -LAB_00611d87: - uVar18 = GetTimeNs(); - uVar8 = GHIDRA_UINT((uVar18 >> 0x20)); - lVar3 = (uVar18 & 0xffffffff) * 0x431bde82; - local_150.y = (float)((uint64_t)lVar3 >> 0x20); - lVar4 = (uint64_t)uVar8 * 0xd7b634db; - local_13c = GHIDRA_CAST(((uint64_t)lVar4 >> 0x20)); - lVar2 = (uint64_t)uVar8 * 0x431bde82; - uVar18 = lVar4 + ((uVar18 & 0xffffffff) * 0xd7b634db >> 0x20); - uVar10 = GHIDRA_UINT((uVar18 >> 0x20)); - lVar3 = lVar3 + (uVar18 & 0xffffffff); - local_190.x = (float)lVar3; - uVar8 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - lVar3 = lVar2 + (uint64_t)CONCAT14(CARRY4(uVar10,uVar8),uVar10 + uVar8); - uVar11 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - uVar8 = GHIDRA_UINT(lVar3) >> 0x12 | uVar11 * 0x4000; - uVar10 = uVar8 - GHIDRA_INT((float)local_120); - bVar15 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar10); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar10; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + - (((uVar11 >> 0x12) - (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4)))) - GHIDRA_UINT((uVar8 < GHIDRA_UINT((float)local_120)))) - + GHIDRA_UINT(bVar15); - } - tmpEntity = local_134; - local_138 = GHIDRA_CAST(((uint64_t)lVar2 >> 0x20)); - local_158.y = (float)lVar2; - local_134->SetColor(&splatColor,0xffffffff,0xff,0,1); - if (&tmpEntity->_splatColor != &splatColor) { - (tmpEntity->_splatColor)._tint[0] = splatColor._tint[0]; - (tmpEntity->_splatColor)._tint[1] = splatColor._tint[1]; - (tmpEntity->_splatColor)._tint[2] = splatColor._tint[2]; - (tmpEntity->_splatColor)._tint[3] = splatColor._tint[3]; - (tmpEntity->_splatColor)._colorize[0] = splatColor._colorize[0]; - (tmpEntity->_splatColor)._colorize[1] = splatColor._colorize[1]; - (tmpEntity->_splatColor)._colorize[2] = splatColor._colorize[2]; - (tmpEntity->_splatColor)._colorize[3] = splatColor._colorize[3]; - *GHIDRA_CAST((tmpEntity->_splatColor)._offset) = - CONCAT44(splatColor._offset[1],splatColor._offset[0]); - (tmpEntity->_splatColor)._offset[2] = splatColor._offset[2]; - } - tmpEntity->Update(); - this = local_12c; - } - if (this->_variant == 0xd8) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (layer->_size).x = g_vectorZero.x; - (layer->_size).y = g_vectorZero.y; - this->_state = 0x1c2; - this->_entityCollisionClass = 0; - this->_shadowSize = 0.0; - if (-1 < this->_orbitLayer) { - RecalculateOrbitOffset(this,this->_orbitLayer,0); - this->_orbitLayer = -1; - } - local_150.y = (float)this->_player; - local_124 = GHIDRA_CAST(0x2); - do { - uVar8 = Random(); - uVar10 = Random(); - fVar16 = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_13c = GHIDRA_CAST((fVar16 + fVar16)); - fVar16 = cos((float)local_13c); - spawnPos.x = fVar16 * 10.0 + (this->_pos).x; - fVar16 = sin((float)local_13c); - spawnPos.y = fVar16 * 10.0 + (this->_pos).y; - tmpEntity = Game::SpawnEx(g_game,3,0xd9,&spawnPos,&g_vectorZero,GHIDRA_CAST(local_150.y),0, - uVar8,0); - tmpEntity->Update(); - ptrSlot = &tmpEntity->_parent; - if (tmpEntity->_parent != 0) { - local_13c = ptrSlot; - msvc::multiset::erase(&local_13c); - } - *ptrSlot = this; - msvc::multiset::insert(ptrSlot); - local_124 = GHIDRA_CAST((GHIDRA_INT(local_124) + -1)); - } while (local_124 != GHIDRA_CAST(0x0)); - nullKillSource._type = 0; - nullKillSource._variant = 0; - nullKillSource._spawnerType = 0; - nullKillSource._spawnerVariant = 0; - nullKillSource._position.x = g_vectorZero.x; - nullKillSource._position.y = g_vectorZero.y; - nullKillSource._velocity.x = g_vectorZero.x; - nullKillSource._velocity.y = g_vectorZero.y; - nullKillSource._flags = 0; - nullKillSource._entity = (void *)0x0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Kill(&nullKillSource); - this->_dead = 0; - ExceptionList = local_1c; - return; - } - uVar8 = Random(); - fVar16 = local_198.y; - iVar12 = (uVar8 & 1) + 2; - if ((this->_flags & 0x100) == 0) { - do { - tmpEntity = this->_player; - spiderCount = &tmpEntity[4]._config; - *spiderCount = (void *)(GHIDRA_INT(*spiderCount) + 1); - spawn_blue_spider(&this->_pos,tmpEntity,&g_vectorZero); - iVar12 = iVar12 + -1; - } while (iVar12 != 0); - } - else { - do { - posPtr = Room::FindFreePickupSpawnPosition - (g_game->_room,&freePickupPos,GHIDRA_CAST(fVar16),40.0,0,0,0); - Entity_NPC::ThrowSpider(GHIDRA_CAST(fVar16),GHIDRA_CAST(0x0),*posPtr,0,-30.0); - iVar12 = iVar12 + -1; - } while (iVar12 != 0); - this = local_12c; - } - } - else if (iVar12 == 0xce) { - cVar6 = wisp_kill(this,__security_cookie ^ GHIDRA_UINT(((&splatColor)[1]._colorize + 1))); - if (cVar6 == '\0') { - ExceptionList = local_1c; - return; - } - local_140 = this->_orbitLayer; - if (-1 < GHIDRA_INT(local_140)) { - if (this->_isSubtype55555 == 0) { - if ((this->_type == 3) && - (((this->_variant == 0xce && (this->_subtype == 0x4d)) || - ((this->_variant == 0xce && (this->_subtype == 0x12a)))))) { - isUnicornWisp = '\x01'; - } - else { - isUnicornWisp = '\0'; - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&wispQuery,3,-1,-1,0,0); - iVar12 = wispQuery._size; - local_14 = 0.0; - buffer_init(wispMates,wispQuery._size + 1); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x0))) = 0.0; - pEVar14 = wispMatesCount; - if (iVar12 != 0) { - local_118 = wispMatesCount; - iVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(wispQuery)) + 0x4))); - uVar8 = wispQuery._size; - do { - otherFamiliar = *GHIDRA_CAST((iVar12 + GHIDRA_INT((float)local_120) * 4)); - if (otherFamiliar->_exists != 0) { - if (otherFamiliar != this) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))) = - (Entity_Familiar *) - __RTDynamicCast(otherFamiliar,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0 - ); - if (((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_orbitLayer == local_140) { - tmpEntity = get_orbit_parent(this); - orbitParent = get_orbit_parent((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4)))); - pEVar14 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))); - if (orbitParent == tmpEntity) { - if (((((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_type == 3) && (((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_variant == 0xce)) - && ((((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_subtype == 0x4d || - (((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_subtype == 0x12a)))) { - isUnicornWisp = '\x01'; - } - local_124 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - if (wispMatesCapacity < local_124) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - } - *GHIDRA_CAST((wispMatesData + GHIDRA_INT(local_118) * 4)) = pEVar14; - local_118 = local_124; - wispMatesCount = local_124; - pEVar14 = local_124; - } - else { - pEVar14 = local_118; - } - } - iVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(wispQuery)) + 0x4))); - uVar8 = wispQuery._size; - } - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x0))) = (float)(GHIDRA_INT((float)local_120) + 1); - } while (GHIDRA_UINT((float)local_120) < uVar8); - } - local_12c = GHIDRA_CAST(0x3f800000); - if (isUnicornWisp != '\0') { - local_12c = GHIDRA_CAST(0x40000000); - } - bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x117,0); - if (bVar7 != 0) { - local_12c = GHIDRA_CAST(0x3eaaaaab); - } - uVar8 = local_140; - if (GHIDRA_INT(local_140) < 1) { - uVar8 = 0; - } - uVar10 = 10; - if (GHIDRA_INT(uVar8) < 10) { - uVar10 = uVar8; - } - local_118 = GHIDRA_CAST(0x0); - local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))),uVar10 * 0x14); - if (pEVar14 != GHIDRA_CAST(0x0)) { - local_134 = (Entity *) - (float)((double)GHIDRA_INT(pEVar14) + - __uint_to_double_fixup[-(GHIDRA_INT(pEVar14) >> 0x1f)]); - local_138 = GHIDRA_CAST(0x40400000); - local_124 = GHIDRA_CAST(0x40c90fdb); - do { - local_148 = (void *)__RTDynamicCast(*(uint32_t *) - (wispMatesData + GHIDRA_INT(local_118) * 4),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor - ,&IsaacRepentancePlus::Entity_Familiar:: - RTTI_Type_Descriptor,0); - *GHIDRA_CAST((GHIDRA_CAST(local_148) + 0xd60)) = - ((float)GHIDRA_INT(local_118) * (float)local_124) / (float)local_134; - bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x70,0); - if (bVar7 == 0) { - fVar16 = *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); - } - else { - fVar16 = *GHIDRA_CAST((&DAT_00c3413c + GHIDRA_INT((float)local_120))) * - *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); - } - *GHIDRA_CAST((GHIDRA_CAST(local_148) + 0xd6c)) = fVar16 * (float)local_12c; - if (*GHIDRA_CAST((GHIDRA_CAST(local_148) + 0x2c)) == 0x3c) { - *GHIDRA_CAST((GHIDRA_CAST(local_148) + 0xd6c)) = fVar16 * (float)local_12c * (float)local_138; - } - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - } while (local_118 < pEVar14); - } - if (wispMates[0] == '\0') { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - if (wispMatesData != 0) { - uVar8 = *GHIDRA_CAST((wispMatesData + -4)); - oldAllocated = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); - free(GHIDRA_CAST((wispMatesData + -4))); - } - } - local_14 = -NAN; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(wispQuery)) + 0x0))) == '\0') { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(wispQuery)) + 0x4))) != 0) { - uVar8 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(wispQuery)) + 0x4))) + -4)); - oldAllocated = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(wispQuery)) + 0x4))) + -4))); - } - local_14 = -NAN; - } - } - this->_orbitLayer = -1; - } - } - else { - posPtr = &this->_pos; - if (iVar12 == 0xed) { - uVar8 = Random(); - tmpEntity = Game::SpawnEx(g_game,1000,0xf,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8,0); - (tmpEntity->_posOffset).x = 0.0; - (tmpEntity->_posOffset).y = -6.0; - local_12c = GHIDRA_CAST(0x3f800000); - (GHIDRA_CAST((&poofColor)))->Color::Color(1.4,0.7,1.6,1.0); - (GHIDRA_CAST((player)))->Sprite::SetColor(color_00); - uVar8 = Random(); - tmpEntity = Game::SpawnEx(g_game,1000,0xc,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); - (tmpEntity->_posOffset).x = 0.0; - (tmpEntity->_posOffset).y = -6.0; - (GHIDRA_CAST((&tearPoofColor)))->Color::Color(1.4,0.7,1.6,1.0); - (GHIDRA_CAST((this_01)))->Sprite::SetColor(color_01); - manager = g_manager; - local_128 = 0x105; - seed_fart_sound_override(GHIDRA_CAST(&local_128)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_128,1.0,2,0,1.0,0.0); - local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))),this->_orbitLayer); - if (-1 < this->_orbitLayer) { - if (this->_isSubtype55555 == 0) { - if ((this->_type == 3) && - (((this->_variant == 0xce && (this->_subtype == 0x4d)) || - ((this->_variant == 0xce && (this->_subtype == 0x12a)))))) { - isUnicornWisp = '\x01'; - } - else { - isUnicornWisp = '\0'; - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&itemWispQuery,3,-1,-1,0,0); - iVar12 = itemWispQuery._size; - local_14 = 5.60519e-45; - buffer_init(itemWispMates,itemWispQuery._size + 1); - uVar8 = 0; - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),5); - local_120 = local_120 & 0xffffffff; - pEVar14 = itemWispMatesCount; - if (iVar12 != 0) { - local_118 = itemWispMatesCount; - iVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(itemWispQuery)) + 0x4))); - uVar10 = itemWispQuery._size; - do { - otherFamiliar = *GHIDRA_CAST((iVar12 + uVar8 * 4)); - if (otherFamiliar->_exists != 0) { - if (otherFamiliar != this) { - local_124 = (Entity_Familiar *) - __RTDynamicCast(otherFamiliar,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar:: - RTTI_Type_Descriptor,0); - if ((float)local_124->_orbitLayer == (float)local_120) { - tmpEntity = get_orbit_parent(local_124); - orbitParent = get_orbit_parent(this); - pEVar14 = local_124; - if (tmpEntity == orbitParent) { - if (((local_124->_type == 3) && (local_124->_variant == 0xce)) && - ((local_124->_subtype == 0x4d || (local_124->_subtype == 0x12a)))) { - isUnicornWisp = '\x01'; - } - local_124 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - if (itemWispMatesCapacity < local_124) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - } - *GHIDRA_CAST((itemWispMatesData + GHIDRA_INT(local_118) * 4)) = pEVar14; - local_118 = local_124; - itemWispMatesCount = local_124; - pEVar14 = local_124; - } - else { - pEVar14 = local_118; - } - } - iVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(itemWispQuery)) + 0x4))); - uVar10 = itemWispQuery._size; - } - } - uVar8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))) + 1; - local_120 = CONCAT44(uVar8,(float)local_120); - } while (uVar8 < uVar10); - } - if (isUnicornWisp != '\0') { - local_12c = GHIDRA_CAST(0x40000000); - } - bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x117,0); - if (bVar7 != 0) { - local_12c = GHIDRA_CAST(0x3eaaaaab); - } - iVar12 = GHIDRA_INT((float)local_120); - if (GHIDRA_INT((float)local_120) < 1) { - iVar12 = 0; - } - orbitLayerClamped = 10; - if (iVar12 < 10) { - orbitLayerClamped = iVar12; - } - local_118 = GHIDRA_CAST(0x0); - local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))),orbitLayerClamped * 0x14); - if (pEVar14 != GHIDRA_CAST(0x0)) { - local_124 = (Entity_Familiar *) - (float)((double)GHIDRA_INT(pEVar14) + - __uint_to_double_fixup[-(GHIDRA_INT(pEVar14) >> 0x1f)]); - do { - local_134 = (Entity *) - __RTDynamicCast(*GHIDRA_CAST((itemWispMatesData + GHIDRA_INT(local_118) * 4)), - 0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar:: - RTTI_Type_Descriptor,0); - local_134[3]._sprite._championColor._colorize[1] = - ((float)GHIDRA_INT(local_118) * 6.2831855) / (float)local_124; - bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x70,0); - if (bVar7 == 0) { - fVar16 = *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); - } - else { - fVar16 = *GHIDRA_CAST((&DAT_00c3413c + GHIDRA_INT((float)local_120))) * - *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); - } - local_134[3]._sprite._championColor._offset[0] = fVar16 * (float)local_12c; - if (local_134->_variant == 0x3c) { - local_134[3]._sprite._championColor._offset[0] = fVar16 * (float)local_12c * 3.0; - } - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - } while (local_118 < pEVar14); - } - if (itemWispMates[0] == '\0') { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - if (itemWispMatesData != 0) { - uVar8 = *GHIDRA_CAST((itemWispMatesData + -4)); - oldAllocated = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); - free(GHIDRA_CAST((itemWispMatesData + -4))); - } - } - local_14 = -NAN; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(itemWispQuery)) + 0x0))) == '\0') { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(itemWispQuery)) + 0x4))) != 0) { - uVar8 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(itemWispQuery)) + 0x4))) + -4)); - oldAllocated = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(itemWispQuery)) + 0x4))) + -4))); - } - local_14 = -NAN; - } - } - this->_orbitLayer = -1; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sirenHelper))))->EntityPtr::Set(GHIDRA_CAST(0x0)); - } - else if (iVar12 == 0xe5) { - (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,posPtr,GHIDRA_CAST(this->_target)); - } - else if (iVar12 == 0xea) { - (GHIDRA_CAST((&particleColor2)))->Color::Color(); - uVar8 = Random(); - Game::SpawnParticles - (g_game,&this->_pos,0x23,8, - (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0,color_02,-12.0,0); - uVar8 = Random(); - SoundEffects::PlayWithFartOverride - (0xb5,0.5,2,0, - (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 1.0); - } - else if (iVar12 == 0xc9) { - if (this->_subtype != 0xc) { - uVar8 = Random(); - tmpEntity = Game::SpawnEx(g_game,1000,2,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); - piVar9 = GHIDRA_CAST(__RTDynamicCast(tmpEntity,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor, - 0)); - piVar9[0xd3] = 0; - piVar9[0xd4] = -0x3ee00000; - (**(code **)(*piVar9 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); - (**(code **)(*piVar9 + 0xc))(); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); - switch(this->_subtype) { - case 2: - case 0x14: - (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(0x0)); - break; - case 3: - uVar8 = Random(); - local_120 = CONCAT44((uVar8 & 1) + 2,(float)local_120); - do { - uVar8 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - uVar10 = Random(); - fVar16 = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_124 = GHIDRA_CAST((fVar16 + fVar16)); - local_198.x = cos((float)local_124); - local_198.x = local_198.x * 5.0; - fVar16 = sin((float)local_124); - local_198.y = fVar16 * 5.0; - Game::SpawnEx(g_game,5,0x14,&this->_pos,&local_198,GHIDRA_CAST(this),0,uVar8,0); - iVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))) + -1; - local_120 = CONCAT44(iVar12,(float)local_120); - } while (iVar12 != 0); - break; - case 4: - uVar8 = Random(); - iVar12 = (uVar8 & 3) + 2; - local_120 = CONCAT44(iVar12,(float)local_120); - while (iVar12 != 0) { - uVar8 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - uVar10 = Random(); - fVar16 = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_124 = GHIDRA_CAST((fVar16 + fVar16)); - local_150.x = cos((float)local_124); - local_150.x = local_150.x * 5.0; - fVar16 = sin((float)local_124); - local_150.y = fVar16 * 5.0; - Game::SpawnEx(g_game,5,10,&this->_pos,&local_150,GHIDRA_CAST(this),2,uVar8,0); - iVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))) + -1; - local_120 = CONCAT44(iVar12,(float)local_120); - } - break; - case 0xd: - uVar8 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x34,&this->_pos,&g_vectorZero,this->_player,0,uVar8); - tmpEntity->SetCollisionDamage(0x41000000); - iVar12 = *GHIDRA_CAST(tmpEntity); - pAVar5 = &tmpEntity[1]._sprite; - (pAVar5->_filename)._buf[4] = ','; - (pAVar5->_filename)._buf[5] = '\x01'; - (pAVar5->_filename)._buf[6] = '\0'; - (pAVar5->_filename)._buf[7] = '\0'; - pAVar5 = &tmpEntity[1]._sprite; - (pAVar5->_filename)._buf[8] = ','; - (pAVar5->_filename)._buf[9] = '\x01'; - (pAVar5->_filename)._buf[10] = '\0'; - (pAVar5->_filename)._buf[0xb] = '\0'; - (**(code **)(iVar12 + 0xc))(); - break; - case 0xe: - uVar8 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x8d,&this->_pos,&g_vectorZero,this->_player,0,uVar8); - iVar12 = *GHIDRA_CAST(tmpEntity); - pAVar5 = &tmpEntity[1]._sprite; - (pAVar5->_filename)._buf[4] = '\x0e'; - (pAVar5->_filename)._buf[5] = '\x01'; - (pAVar5->_filename)._buf[6] = '\0'; - (pAVar5->_filename)._buf[7] = '\0'; - pAVar5 = &tmpEntity[1]._sprite; - (pAVar5->_filename)._buf[8] = '\x0e'; - (pAVar5->_filename)._buf[9] = '\x01'; - (pAVar5->_filename)._buf[10] = '\0'; - (pAVar5->_filename)._buf[0xb] = '\0'; - (**(code **)(iVar12 + 0x40))(*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)) * 0.5); - tmpEntity->Update(); - } - } - else { - uVar8 = Random(); - tmpEntity = Game::SpawnEx(g_game,1000,2,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); - piVar9 = GHIDRA_CAST(__RTDynamicCast(tmpEntity,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0)) - ; - piVar9[0xd3] = 0; - piVar9[0xd4] = -0x3ee00000; - (**(code **)(*piVar9 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); - (**(code **)(*piVar9 + 0xc))(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); - if ((((this->_variant == 0xee) && (this->_player->_playerType == 0x1a)) && - (bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x26b,0), bVar7 != 0)) && - (this->_subtype == 0)) { - uVar8 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - posPtr = MusicManager::RandomVector(&local_190); - uVar10 = Random(); - this = local_12c; - local_158.x = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)] - ) * 2.3283064e-10 * 3.0 + 2.0; - local_158.y = local_158.x * posPtr->y; - local_158.x = local_158.x * posPtr->x; - tmpEntity = Game::Spawn(g_game,5,10,&local_12c->_pos,&local_158,GHIDRA_CAST(local_12c),2, - uVar8); - iVar12 = *GHIDRA_CAST(tmpEntity); - tmpEntity[1]._sprite._championColor._colorize[1] = 8.40779e-44; - (**(code **)(iVar12 + 0xc))(); - } - } - } - } - killSourcePtr = (GHIDRA_CAST((&killSource)))->EntityRef::EntityRef(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Kill(killSourcePtr); - this->Remove(); - iVar12 = this->_variant; - if (iVar12 == 0xed) { - if (this->_player == GHIDRA_CAST(0x0)) { - ExceptionList = local_1c; - return; - } - (GHIDRA_CAST((this->_player)))->Entity_Player::RecomputeWispCollectibles(GHIDRA_CAST(0x0)); - iVar12 = this->_variant; - } - if (((iVar12 == 0xee) && (player = this->_player, player != GHIDRA_CAST(0x0))) && - (player->_playerType == 0x1a)) { - (GHIDRA_CAST((player)))->Entity_Player::UpdateHeartDependentEffects(); - } - ExceptionList = local_1c; - return; -} - -// 006121d0 -void Entity_Familiar::ClearReferences() -{ - int variant; - void *pvVar1; - uint32_t size; - int local_14 [3]; - uint32_t *linkedEntityRef; - int gridIndex; - std_vector *hitList; - void *hitListBegin; - uint32_t *playerFlags; - - variant = this->_variant; - if (variant == 900) { - gridIndex = (this->_pathfinder)._gridIndex; - if (-1 < gridIndex) { - variant = 900; - if ((gridIndex < 0x1c0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + gridIndex * 4 + 0x76c)) < 0x3b7)) { - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + gridIndex * 4 + 0x76c)) = 900; - variant = this->_variant; - goto LAB_0061221c; - } - } -LAB_00612223: - if (variant != 0xed) goto LAB_00612253; - } - else { -LAB_0061221c: - if (variant != 0xce) goto LAB_00612223; - } - if (this->_subtype == 0x22d) { - playerFlags = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1574)); - *playerFlags = *playerFlags | 0x400; - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1518)) = 1; - variant = this->_variant; - } -LAB_00612253: - if ((variant == 0xf0) && (GHIDRA_CAST(this->_linkedEntity) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_linkedEntity) + 0x28))(); - } - if (this->_linkedEntity != 0) { - linkedEntityRef = &this->_linkedEntity; - msvc::multiset::erase(&linkedEntityRef); - } - this->_linkedEntity = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - hitList = &this->_hitList; - if (GHIDRA_CAST(local_14) != hitList) { - hitListBegin = hitList->_begin; - pvVar1 = (this->_hitList)._capacity; - hitList->_begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - if (hitListBegin != (void *)0x0) { - size = GHIDRA_INT(pvVar1) - GHIDRA_INT(hitListBegin) & 0xfffffffc; - pvVar1 = hitListBegin; - if (0xfff < size) { - pvVar1 = *(void **)(GHIDRA_CAST(hitListBegin) + -4); - size = size + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(hitListBegin) + (-4 - GHIDRA_INT(pvVar1))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar1,size); - } - } - set_extra_data(&this->_extraData,(void *)0x0); - if (this->_weapon != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_weapon) + 0x14))(); - if (this->_weapon != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_weapon))(1); - } - this->_weapon = (void *)0x0; - } - return; -} - -// 00612330 -Entity * Entity_Familiar::get_orbit_parent() -{ - uint8_t isHasItem; - Entity *orbitParent; - uint8_t queryResult [12]; - int iStack_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6910; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (((this->_variant != 0x2b) && (this->_variant != 0xce)) || - (orbitParent = GHIDRA_CAST(this->_parent), orbitParent == GHIDRA_CAST(0x0))) { - isHasItem = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x248,0); - if (isHasItem != 0) { - isHasItem = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x2d8,0); - if (isHasItem != 0) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(queryResult),3,0xf0, - -1,1,0); - if (iStack_14 != 0) { - orbitParent = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(queryResult))) + 0x4))); - if (queryResult[0] == '\0') { - local_8 = 0; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)queryResult)) + 0x4))),0); - } - ExceptionList = local_10; - return orbitParent; - } - if (queryResult[0] == '\0') { - local_8 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)queryResult)) + 0x4))),0); - } - } - } - orbitParent = this->_player; - } - ExceptionList = local_10; - return orbitParent; -} - -// 00612440 -int Entity_Familiar::RecalculateOrbitOffset(int layer, uint8_t isAdd) -{ - double dVar1; - uint8_t isHasCollectible; - uint32_t uVar2; - Entity_Familiar *familiar; - Entity *otherParent; - Entity *ownParent; - int iVar3; - uint64_t *heapBytes; - uint32_t prevCount; - uint32_t orbiterCount; - uint32_t uVar4; - float orbitDistance; - EntityList_EL familiarQuery; - char orbiterBuffer [4]; - int local_30; - uint32_t orbiterCapacity; - uint32_t orbiterSize; - uint32_t local_24; - int familiarData; - Entity_Familiar *local_1c; - int orbiters; - char isUnicornWisp; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint64_t prevBytes; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6945; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((orbiterBuffer + 0x30)); - if ((this->_isSubtype55555 != 0) || (layer < 0)) { - return 0; - } - if (((this->_type == 3) && (this->_variant == 0xce)) && - ((this->_subtype == 0x4d || (this->_subtype == 0x12a)))) { - isUnicornWisp = '\x01'; - } - else { - isUnicornWisp = '\0'; - } - ExceptionList = &local_10; - local_1c = this; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiarQuery,3,-1,-1,0,0); - iVar3 = familiarQuery._size; - local_8 = 0; - buffer_init(orbiterBuffer,familiarQuery._size + 1); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - local_24 = 0; - familiarData = (*GHIDRA_CAST((GHIDRA_CAST(&(familiarQuery)) + 0x4))); - orbiters = local_30; - orbiterCount = orbiterSize; - if (iVar3 != 0) { - uVar4 = familiarQuery._size; - prevCount = orbiterSize; - do { - familiar = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiarQuery)) + 0x4))) + local_24 * 4)); - orbiterCount = prevCount; - if (familiar->_exists != 0) { - if (familiar != this) { - familiar = (Entity_Familiar *) - __RTDynamicCast(familiar,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0, - uVar2); - if (familiar->_orbitLayer == layer) { - otherParent = get_orbit_parent(familiar); - ownParent = get_orbit_parent(local_1c); - if (otherParent == ownParent) { - if (((familiar->_type == 3) && (familiar->_variant == 0xce)) && - ((familiar->_subtype == 0x4d || (familiar->_subtype == 0x12a)))) { - isUnicornWisp = '\x01'; - } - orbiterCount = prevCount + 1; - if (orbiterCapacity < orbiterCount) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - } - *GHIDRA_CAST((orbiters + prevCount * 4)) = familiar; - orbiterSize = orbiterCount; - } - } - uVar4 = familiarQuery._size; - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarQuery)) + 0x4))) = familiarData; - this = local_1c; - } - } - local_24 = local_24 + 1; - prevCount = orbiterCount; - } while (local_24 < uVar4); - } - local_1c = GHIDRA_CAST(0x3f800000); - if (isUnicornWisp != '\0') { - local_1c = GHIDRA_CAST(0x40000000); - } - isHasCollectible = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x117,0); - if (isHasCollectible != 0) { - local_1c = GHIDRA_CAST(0x3eaaaaab); - } - if (isAdd != 0) { - uVar2 = orbiterCount + 1; - if (orbiterCapacity < uVar2) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - } - *GHIDRA_CAST((orbiters + orbiterCount * 4)) = this; - orbiterCount = uVar2; - orbiterSize = uVar2; - } - if (layer < 1) { - layer = 0; - } - uVar2 = 10; - if (GHIDRA_UINT(layer) < 10) { - uVar2 = layer; - } - uVar4 = 0; - iVar3 = uVar2 * 0x14; - if (orbiterCount != 0) { - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(orbiterCount) >> 0x1f)]; - do { - local_24 = __RTDynamicCast(*GHIDRA_CAST((orbiters + uVar4 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - *GHIDRA_CAST((local_24 + 0xd60)) = - ((float)GHIDRA_INT(uVar4) * 6.2831855) / (float)((double)GHIDRA_INT(orbiterCount) + dVar1); - isHasCollectible = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x70,0); - if (isHasCollectible == 0) { - orbitDistance = *GHIDRA_CAST((&DAT_00c34138 + iVar3)); - } - else { - orbitDistance = *GHIDRA_CAST((&DAT_00c3413c + iVar3)) * *GHIDRA_CAST((&DAT_00c34138 + iVar3)); - } - *GHIDRA_CAST((local_24 + 0xd6c)) = orbitDistance * (float)local_1c; - if (*GHIDRA_CAST((local_24 + 0x2c)) == 0x3c) { - *GHIDRA_CAST((local_24 + 0xd6c)) = orbitDistance * (float)local_1c * 3.0; - } - uVar4 = uVar4 + 1; - } while (uVar4 < orbiterCount); - } - if (orbiterBuffer[0] == '\0') { - heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - heapBytes = &g_allocatedBytesNoHeap; - } - if (orbiters != 0) { - uVar2 = *GHIDRA_CAST((orbiters + -4)); - prevBytes = *heapBytes; - *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar2)); - free((void *)(orbiters + -4)); - } - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiarQuery)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - heapBytes = &g_allocatedBytesNoHeap; - } - else { - heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (familiarData != 0) { - uVar2 = *GHIDRA_CAST((familiarData + -4)); - prevBytes = *heapBytes; - *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar2)); - free((void *)(familiarData + -4)); - } - } - ExceptionList = local_10; - return orbiterCount; -} - -// 006127b0 -void Entity_Familiar::AddToOrbit(int orbitLayer) -{ - int clampedLayer; - int nonNegativeLayer; - float orbitDistanceY; - - if (-1 < this->_orbitLayer) { - RecalculateOrbitOffset(this,this->_orbitLayer,0); - } - this->_orbitLayer = orbitLayer; - nonNegativeLayer = orbitLayer; - if (orbitLayer < 1) { - nonNegativeLayer = 0; - } - clampedLayer = 10; - if (nonNegativeLayer < 10) { - clampedLayer = nonNegativeLayer; - } - orbitDistanceY = (float)(&DAT_00c34134)[clampedLayer * 5]; - (this->_orbitDistance).x = (float)(&DAT_00c34130)[clampedLayer * 5]; - (this->_orbitDistance).y = orbitDistanceY; - RecalculateOrbitOffset(this,orbitLayer,1); - return; -} - -// 00612820 -void Entity_Familiar::RemoveFromOrbit() -{ - if (-1 < this->_orbitLayer) { - RecalculateOrbitOffset(this,this->_orbitLayer,0); - this->_orbitLayer = -1; - } - return; -} - -// 00612850 -Vector * Entity_Familiar::GetOrbitDistance(Vector *outDistance, int layer) -{ - int orbitLayer; - float orbitDistanceY; - - if (layer < 1) { - layer = 0; - } - orbitLayer = 10; - if (layer < 10) { - orbitLayer = layer; - } - orbitDistanceY = (float)(&DAT_00c34134)[orbitLayer * 5]; - outDistance->x = (float)(&DAT_00c34130)[orbitLayer * 5]; - outDistance->y = orbitDistanceY; - return outDistance; -} - -// 00612890 -uint8_t Entity_Familiar::is_detached_from_follow() -{ - int iVar1; - bool isDetached; - - if (this->_isFollower == 0) { - return 0; - } - iVar1 = this->_variant; - if (iVar1 == 3) { - isDetached = this->_fireCooldown == 0; - } - else if (iVar1 == 0x3b) { - isDetached = this->_fireCooldown == 0; - } - else if (iVar1 == 0x19) { - isDetached = this->_fireCooldown == 0; - } - else if (iVar1 == 0x5d) { - isDetached = this->_fireCooldown == 0; - } - else { - if (iVar1 == 100) { - if (this->_subtype == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf38))))) { - return 0; - } - return 1; - } - if (iVar1 == 0x68) { - isDetached = this->_fireCooldown == 0; - } - else { - if ((iVar1 == 0x7c) || (iVar1 == 0x81)) { - if (this->_visible == 0) { - return 0; - } - return 1; - } - if (iVar1 == 0x82) { - if (this->_fireCooldown < 0) { - return 0; - } - return 1; - } - if (iVar1 == 0xe8) { - isDetached = this->_fireCooldown == 0; - } - else if (iVar1 == 0xdf) { - isDetached = this->_fireCooldown == 0; - } - else { - if (iVar1 != 0xf2) { - return 1; - } - if (this->_visible == 0) { - return 0; - } - isDetached = this->_coins == 0; - } - } - } - if (isDetached) { - return 1; - } - return 0; -} - -// 00612970 -int Entity_Familiar::GetFollowerPriority() -{ - switch(this->_variant) { - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 9: - case 10: - case 0xb: - case 0xc: - case 0x19: - case 0x3b: - case 0x4c: - case 0x51: - case 0x5c: - case 0x5d: - case 0x61: - case 0x68: - case 0x77: - case 0x7d: - case 0xd1: - case 0xdc: - case 0xdf: - return 1; - default: - return 0; - case 0x33: - case 0x4a: - case 0x59: - case 0xe6: - return 2; - case 0x3d: - case 0x6c: - return 3; - case 0x50: - case 0xeb: - return 10; - case 100: - return 9; - case 0x6d: - return 9999; - case 0xe8: - return 5; - } -} - -// 00612af0 -uint8_t Entity_Familiar::IsLilithBirthrightIncubus() -{ - Entity_Player *this_00; - uint8_t isHasBirthright; - void *weapon; - - this_00 = this->_player; - weapon = this_00->_weapons[0]; - if (weapon == (void *)0x0) { - weapon = this_00->_weapons[1]; - } - if (this_00->_playerType == 0x20) { - isHasBirthright = (GHIDRA_CAST((this_00)))->Entity_Player::HasCollectible(0x26b,0); - if ((((isHasBirthright != 0) && (weapon != (void *)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(weapon) + 0x30)) == 0xf)) && - ((this->_isFollower != 0 && (this->_isNotCountedAsFollower == 0)))) { - return 1; - } - } - return 0; -} - -// 00612b50 -Entity * Entity_Familiar::get_incubus_umbilical_whip() -{ - uint8_t isBirthrightIncubus; - int weapon; - int *umbilicalWhip; - Entity *whipEntity; - - isBirthrightIncubus = IsLilithBirthrightIncubus(this); - if (isBirthrightIncubus != 0) { - weapon = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13dc)); - if (weapon == 0) { - weapon = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13e0)); - } - umbilicalWhip = - GHIDRA_CAST(__RTDynamicCast(weapon,0,&IsaacRepentancePlus::Weapon::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Weapon_UmbilicalWhip::RTTI_Type_Descriptor,0)); - if (((umbilicalWhip != GHIDRA_CAST(0x0)) && - (whipEntity = GHIDRA_CAST((**(code **)(*umbilicalWhip + 0x28))()), whipEntity != GHIDRA_CAST(0x0)) - ) && (whipEntity->_type == 3)) { - return whipEntity; - } - } - return GHIDRA_CAST(0x0); -} - -// 00612bb0 -void Entity_Familiar::FollowParent() -{ - uint8_t *puVar1; - code *pcVar2; - uint8_t bVar3; - char cVar4; - uint32_t uVar5; - Entity *umbilicalWhip; - Entity_Player *player; - int iVar6; - Vector *facingDir; - Entity_Familiar *parentFamiliar; - Entity_Familiar *extraout_ECX; - Entity_Familiar *parentFamiliar; - Entity_Familiar *extraout_ECX_00; - Entity_Familiar *this_01; - Entity_Familiar *extraout_ECX_01; - Entity_Familiar *this_02; - Entity_Familiar *extraout_ECX_02; - Entity_Familiar *this_03; - Entity_Familiar *extraout_ECX_03; - Entity_Familiar *this_04; - int extraout_ECX_04; - char extraout_DL; - char extraout_DL_00; - int iVar7; - int extraout_EDX; - float extraout_EDX_00; - float extraout_EDX_01; - float extraout_EDX_02; - float extraout_EDX_03; - uint32_t *childSlot; - Entity_NPC *player; - float fVar9; - float fVar10; - float fVar11; - Entity_NPC *local_48; - uint8_t query [8]; - Vector VStack_3c; - Entity_Familiar *local_34; - float local_30; - float local_2c; - float local_28; - char isOverrideParent; - char isLilithBirthright; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - Entity_NPC *chainNext; - void *playerRaw; - - puStack_20 = query + 0x40; - local_14 = 0xffffffff; - puStack_18 = &LAB_00af697d; - local_1c = ExceptionList; - uVar5 = __security_cookie ^ GHIDRA_UINT((query + 0x34)); - if (this->_isSubtype55555 != 0) { - (this->_pos).x = (this->_formationOffset).x; - (this->_pos).y = (this->_formationOffset).y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - return; - } - ExceptionList = &local_1c; - bVar3 = IsLilithBirthrightIncubus(this); - if (bVar3 != 0) { - umbilicalWhip = get_incubus_umbilical_whip(this); - player = this->_player; - local_34 = GHIDRA_CAST((player->_pos).x); - VStack_3c.y = (player->_pos).y; - if (umbilicalWhip != GHIDRA_CAST(0x0)) { - local_30 = (float)this->_initSeed; - iVar7 = 0; - VStack_3c.y = 9.80909e-45; - parentFamiliar = GHIDRA_CAST(this->_child); - if (parentFamiliar != GHIDRA_CAST(0x0)) { - do { - if (parentFamiliar->_type == 3) { - bVar3 = is_detached_from_follow(parentFamiliar); - parentFamiliar = extraout_ECX; - iVar7 = extraout_EDX; - if (bVar3 != 0) { - iVar7 = extraout_EDX + 1; - } - } - parentFamiliar = GHIDRA_CAST(parentFamiliar->_child); - } while (parentFamiliar != GHIDRA_CAST(0x0)); - player = this->_player; - } - local_2c = (float)iVar7 + 5.0; - bVar3 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar3 != 0) { - local_2c = local_2c * 1.5; - } - if (local_30 == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar5 = GHIDRA_UINT(local_30) >> 5 ^ GHIDRA_UINT(local_30); - uVar5 = uVar5 << 9 ^ uVar5; - VStack_3c.y = (float)(uVar5 >> (SUB41(VStack_3c.y,0) & 0x1f) ^ uVar5); - local_34 = GHIDRA_CAST(0xe); - if (VStack_3c.y == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar5 = GHIDRA_UINT(VStack_3c.y) >> 3 ^ GHIDRA_UINT(VStack_3c.y); - uVar5 = uVar5 << 1 ^ uVar5; - uVar5 = uVar5 >> 0xe ^ uVar5; - local_34 = GHIDRA_CAST((umbilicalWhip->_size * 0.3)); - VStack_3c.y = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283062e-10 * 3.14; - local_30 = (float)local_34 + local_2c; - VStack_3c.y = VStack_3c.y + VStack_3c.y; - local_2c = cos(VStack_3c.y); - local_2c = local_2c * local_30; - fVar9 = sin(VStack_3c.y); - local_30 = fVar9 * local_30; - iVar7 = this->_variant; - if (((iVar7 == 0xd5) || (iVar7 == 0xd6)) || (iVar7 == 0xdf)) { - local_2c = (float)local_34; - local_30 = 0.0; - } - local_28 = (umbilicalWhip->_pos).x; - local_48 = GHIDRA_CAST((umbilicalWhip->_pos).y); - iVar7 = __RTDynamicCast(umbilicalWhip[3]._entityRef3._flags,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor - ,&IsaacRepentancePlus::UmbilicalBabyData::RTTI_Type_Descriptor,0); - if (iVar7 == 0) { - VStack_3c.y = 0.0; - } - else { - VStack_3c.y = *GHIDRA_CAST((iVar7 + 0x154)); - } - VStack_3c.y = VStack_3c.y * 0.017453292; - local_34 = GHIDRA_CAST(cos(VStack_3c.y)); - fVar9 = sin(VStack_3c.y); - fVar10 = (float)local_34 * local_30; - local_34 = GHIDRA_CAST((((float)local_34 * local_2c - fVar9 * local_30) + local_28)); - VStack_3c.y = fVar9 * local_2c + fVar10 + (float)local_48; - if ((umbilicalWhip->_type == 3) && (this->_parent == 0)) { - childSlot = &umbilicalWhip->_child; - if (umbilicalWhip->_child != 0) { - local_48 = GHIDRA_CAST(childSlot); - msvc::multiset::erase(&local_48); - } - *childSlot = this; - msvc::multiset::insert(childSlot); - } - } - fVar9 = (this->_pos).y; - (this->_velocity).x = (float)local_34 - (this->_pos).x; - (this->_velocity).y = VStack_3c.y - fVar9; - ExceptionList = local_1c; - return; - } - player = this->_player; - if (((player != GHIDRA_CAST(0x0)) && - (local_48 = GHIDRA_CAST(player->_spawnerEntity), local_48 != GHIDRA_CAST(0x0))) && - ((local_48->_type == 0x388 && - ((local_48->_variant == 0 && - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::HasEntityFlags(0x400000), bVar3 != 0)))))) { - NpcHelper::siren_familiar_orbit(local_48,this); - goto LAB_006138df; - } - bVar3 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0xb3,0); - if (bVar3 != 0) { - predict_player_movement(this); - ExceptionList = local_1c; - return; - } - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x6d,0); - if (bVar3 != 0) { - move_to_parent_offset(this); - ExceptionList = local_1c; - return; - } - if (((this->_formationOffset).x != g_vectorZero.x) || - ((this->_formationOffset).y != g_vectorZero.y)) { - reset_follow_target(this,uVar5); - } - player = GHIDRA_CAST(this->_parent); - isOverrideParent = '\0'; - if ((g_game->_challenge == 0x1e) && (this->_variant == 0x3e)) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(query),3,0x43,-1,0,0); - if (VStack_3c.y != 0.0) { - isOverrideParent = '\x01'; - player = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(query))) + 0x4))); - } - (GHIDRA_CAST((query)))->EntityList_Query::~EntityList_Query(); - } - local_48 = player; - if ((this->_player->_playerType == 0xd) && - (bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x26b,0), bVar3 != 0)) { - isLilithBirthright = '\x01'; - cVar4 = FUN_00612ad0(); - if (cVar4 != '\0') { - parentFamiliar = GHIDRA_CAST(this->_parent); - fVar9 = 0.0; - local_34 = this->_player; - iVar7 = 0; - local_30 = 0.0; - for (; parentFamiliar != GHIDRA_CAST(0x0); - parentFamiliar = GHIDRA_CAST(parentFamiliar->_parent)) { - if (parentFamiliar->_type == 3) { - if (parentFamiliar->_variant == 0x6d) { - local_34 = parentFamiliar; - break; - } - bVar3 = is_detached_from_follow(parentFamiliar); - parentFamiliar = parentFamiliar; - fVar9 = extraout_EDX_00; - if (bVar3 != 0) { - iVar6 = GetFollowerPriority(parentFamiliar); - parentFamiliar = extraout_ECX_00; - fVar9 = extraout_EDX_01; - if ((0 < iVar6) && - (extraout_ECX_00->_isNotCountedAsFollower == SUB41(extraout_EDX_01,0))) { - iVar7 = iVar7 + 1; - } - } - } - } - parentFamiliar = GHIDRA_CAST(this->_child); - if (parentFamiliar != GHIDRA_CAST(0x0)) { - do { - if (parentFamiliar->_type == 3) { - bVar3 = is_detached_from_follow(parentFamiliar); - parentFamiliar = this_01; - fVar9 = extraout_EDX_02; - if (bVar3 != 0) { - iVar6 = GetFollowerPriority(this_01); - parentFamiliar = extraout_ECX_01; - fVar9 = extraout_EDX_03; - if ((0 < iVar6) && (extraout_ECX_01->_isNotCountedAsFollower == 0)) { - fVar9 = (float)(GHIDRA_INT(extraout_EDX_03) + 1); - } - } - } - parentFamiliar = GHIDRA_CAST(parentFamiliar->_child); - } while (parentFamiliar != GHIDRA_CAST(0x0)); - local_30 = fVar9; - } - playerRaw = this->_player; - local_48 = GHIDRA_CAST((iVar7 + GHIDRA_INT(fVar9))); - puVar1 = &(*GHIDRA_CAST((GHIDRA_CAST((local_48)) + 0x1))); - local_28 = *GHIDRA_CAST((GHIDRA_CAST(playerRaw) + 0x1630)); - local_2c = *GHIDRA_CAST((GHIDRA_CAST(playerRaw) + 0x1634)); - if ((local_28 == g_vectorZero.x) && (local_2c == g_vectorZero.y)) { - facingDir = Isaac::GetAxisAlignedUnitVectorFromDir - (&VStack_3c,*GHIDRA_CAST((GHIDRA_CAST(playerRaw) + 0x1628))); - local_28 = facingDir->x; - local_2c = facingDir->y; - fVar9 = local_30; - } - if (1 < GHIDRA_INT(puVar1)) { - fVar11 = (float)GHIDRA_INT(puVar1) * 5.0 + 15.0; - fVar10 = 179.0; - if (fVar11 <= 179.0) { - fVar10 = fVar11; - } - if ((GHIDRA_UINT(local_30) & 1) != 0) { - fVar10 = -fVar10; - } - local_30 = ((fVar10 * (float)GHIDRA_INT((puVar1 + (-1 - (GHIDRA_INT(fVar9) - (GHIDRA_INT(fVar9) >> 0x1f) & - 0xfffffffeU))))) / (float)GHIDRA_INT(local_48)) * - 0.017453292; - local_48 = GHIDRA_CAST(cos(local_30)); - fVar9 = sin(local_30); - fVar10 = fVar9 * local_28; - local_28 = (float)local_48 * local_28 - fVar9 * local_2c; - local_2c = (float)local_48 * local_2c + fVar10; - } - local_48 = GHIDRA_CAST((local_34->_pos).x); - VStack_3c.y = (local_34->_pos).y; - fVar9 = sqrtf(local_28 * local_28 + local_2c * local_2c); - if (0.0 < fVar9) { - fVar9 = (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x370)) + 20.0) / fVar9; - local_2c = fVar9 * local_2c; - local_28 = fVar9 * local_28; - } - fVar9 = (this->_pos).y; - (this->_velocity).x = (((float)local_48 + local_28) - (this->_pos).x) * 0.4; - (this->_velocity).y = ((VStack_3c.y + local_2c) - fVar9) * 0.4; - goto LAB_006138df; - } - } - else { - isLilithBirthright = '\0'; - } - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x94,0); - if ((bVar3 != 0) && (this->_variant != 0x6d)) { - local_34 = this->_player; - iVar7 = 0; - parentFamiliar = GHIDRA_CAST(this->_parent); - local_30 = 0.0; - for (; parentFamiliar != GHIDRA_CAST(0x0); - parentFamiliar = GHIDRA_CAST(parentFamiliar->_parent)) { - if (parentFamiliar->_type == 3) { - if (parentFamiliar->_variant == 0x6d) { - local_34 = parentFamiliar; - break; - } - bVar3 = is_detached_from_follow(parentFamiliar); - parentFamiliar = this_02; - if (bVar3 != 0) { - if (extraout_DL != '\0') { - iVar6 = GetFollowerPriority(this_02); - parentFamiliar = extraout_ECX_02; - if ((0 < iVar6) && (extraout_ECX_02->_isNotCountedAsFollower == 0)) goto LAB_00613385; - } - local_30 = (float)(GHIDRA_INT(local_30) + 1); - } - } -LAB_00613385: - } - parentFamiliar = GHIDRA_CAST(this->_child); - do { - if (parentFamiliar == GHIDRA_CAST(0x0)) { - local_48 = GHIDRA_CAST((GHIDRA_INT(local_30) + 1 + iVar7)); - this->_orbitSpeed = 3.5; - iVar6 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetTrinketMultiplier(0x94); - fVar9 = this->_orbitSpeed; - if (2 < iVar6) { - fVar9 = fVar9 * 1.5; - this->_orbitSpeed = fVar9; - } - iVar6 = g_game->_frameCount; - (this->_orbitDistance).x = 65.0; - (this->_orbitDistance).y = 60.0; - local_30 = (((float)iVar7 * 360.0) / (float)GHIDRA_INT(local_48) + (float)iVar6 * fVar9) - - this->_orbitAngleOffset; - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x59,0); - if (bVar3 != 0) { - (this->_orbitDistance).x = (this->_orbitDistance).x * 0.5; - (this->_orbitDistance).y = (this->_orbitDistance).y * 0.5; - } - local_30 = local_30 * 0.017453292; - fVar9 = cos(local_30); - parentFamiliar = local_34; - local_34 = (Entity_Familiar *) - ((fVar9 * (this->_orbitDistance).x + (local_34->_pos).x) - (this->_pos).x); - fVar9 = sin(local_30); - local_48 = (Entity_NPC *) - ((fVar9 * (this->_orbitDistance).y + (parentFamiliar->_pos).y) - (this->_pos).y); - fVar9 = sqrtf((float)local_48 * (float)local_48 + (float)local_34 * (float)local_34); - if (fVar9 <= 20.0) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - } - else { - fVar9 = ((fVar9 - 20.0) * 0.1) / fVar9; - fVar10 = fVar9 * (float)local_48; - fVar9 = fVar9 * (float)local_34; - if ((this->_flags & 0x20000000000) != 0) { - fVar9 = fVar9 * 5.0; - fVar10 = fVar10 * 5.0; - } - (this->_velocity).x = fVar9; - (this->_velocity).y = fVar10; - } - if (parentFamiliar->_type == 1) { - fVar9 = 1.5; - } - else { - fVar9 = 1.0; - } - fVar10 = (parentFamiliar->_velocity).x; - (this->_velocity).y = fVar9 * (parentFamiliar->_velocity).y + (this->_velocity).y; - (this->_velocity).x = fVar9 * fVar10 + (this->_velocity).x; - ExceptionList = local_1c; - return; - } - if (parentFamiliar->_type == 3) { - bVar3 = is_detached_from_follow(parentFamiliar); - parentFamiliar = this_03; - if (bVar3 != 0) { - if (extraout_DL_00 != '\0') { - iVar6 = GetFollowerPriority(this_03); - parentFamiliar = extraout_ECX_03; - if ((0 < iVar6) && (extraout_ECX_03->_isNotCountedAsFollower == 0)) goto LAB_006133c6; - } - iVar7 = iVar7 + 1; - } - } -LAB_006133c6: - parentFamiliar = GHIDRA_CAST(parentFamiliar->_child); - } while( true ); - } - (this->_orbitDistance).x = g_vectorZero.x; - (this->_orbitDistance).y = g_vectorZero.y; - if (isOverrideParent == '\0') { - for (; player != GHIDRA_CAST(0x0); player = GHIDRA_CAST(player->_parent)) { - parentFamiliar = - (Entity_Familiar *) - __RTDynamicCast(player,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - if (parentFamiliar == GHIDRA_CAST(0x0)) goto LAB_0061378a; - bVar3 = is_detached_from_follow(parentFamiliar); - if ((bVar3 != 0) || - (((isLilithBirthright != '\0' && (iVar7 = GetFollowerPriority(this_04), 0 < iVar7)) && - (*GHIDRA_CAST((extraout_ECX_04 + 0xd76)) == '\0')))) goto LAB_0061378a; - } -LAB_00613692: - if (this->_variant != 0x6d) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(query),3,0x6d,-1,1,0); - local_14 = 0; - local_30 = 0.0; - if (VStack_3c.y != 0.0) { -LAB_006136d5: - iVar7 = __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(query)) + 0x4))) + local_30 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - if (((*GHIDRA_CAST((iVar7 + 0x172)) == '\0') || (*(void **)(iVar7 + 0x410) != this->_player)) || - (*GHIDRA_CAST((iVar7 + 0x3bc)) != this->_parent)) goto LAB_00613716; - player = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(query)) + 0x4))) + local_30 * 4)); - for (chainNext = GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(query)) + 0x4))) + local_30 * 4)))->_child); - ((chainNext != GHIDRA_CAST(0x0) && (chainNext->_type == 3)) && - (chainNext->_variant == 0x6d)); chainNext = GHIDRA_CAST(chainNext->_child)) { - player = chainNext; - } - } -LAB_0061375a: - local_14 = 0xffffffff; - (GHIDRA_CAST((query)))->EntityList_Query::~EntityList_Query(); - if (player != GHIDRA_CAST(0x0)) goto LAB_0061378a; - } - local_30 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_28 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - } - else { - player = local_48; - if (local_48 == GHIDRA_CAST(0x0)) goto LAB_00613692; -LAB_0061378a: - local_30 = (player->_pos).x; - local_28 = (player->_pos).y; - } - local_2c = 20.0; - if (this->_variant == 100) { - local_2c = 10.0; - } - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x59,0); - if (bVar3 != 0) { - local_2c = 5.0; - } - VStack_3c.y = (this->_pos).y - local_28; - local_34 = GHIDRA_CAST(((this->_pos).x - local_30)); - fVar9 = sqrtf(VStack_3c.y * VStack_3c.y + (float)local_34 * (float)local_34); - if (fVar9 <= 0.0) { - parentFamiliar = local_34; - } - else { - VStack_3c.y = (local_2c / fVar9) * VStack_3c.y; - parentFamiliar = GHIDRA_CAST(((local_2c / fVar9) * (float)local_34)); - } - fVar10 = local_30 - (this->_pos).x; - local_48 = GHIDRA_CAST((local_30 + (float)parentFamiliar)); - fVar9 = local_28 - (this->_pos).y; - VStack_3c.y = local_28 + VStack_3c.y; - fVar9 = sqrtf(fVar9 * fVar9 + fVar10 * fVar10); - if (local_2c < fVar9) { - fVar10 = (this->_pos).y; - fVar9 = ((fVar9 - local_2c) / fVar9) * 0.2; - (this->_velocity).x = ((float)local_48 - (this->_pos).x) * fVar9; - (this->_velocity).y = (VStack_3c.y - fVar10) * fVar9; - } -LAB_006138df: - this->_friction = this->_friction * 0.8; - ExceptionList = local_1c; - return; -LAB_00613716: - local_30 = (float)(GHIDRA_INT(local_30) + 1); - if (GHIDRA_UINT(VStack_3c.y) <= GHIDRA_UINT(local_30)) goto LAB_0061375a; - goto LAB_006136d5; -} - -// 00613910 -void Entity_Familiar::FollowPosition(Vector *position) -{ - float posX; - float posY; - float targetX; - float targetY; - - if (this->_isSubtype55555 == 0) { - targetX = position->x; - targetY = position->y; - posX = (this->_pos).x; - posY = (this->_pos).y; - this->_friction = this->_friction * 0.8; - (this->_velocity).x = (targetX - posX) * 0.1; - (this->_velocity).y = (targetY - posY) * 0.1; - return; - } - (this->_pos).x = (this->_formationOffset).x; - (this->_pos).y = (this->_formationOffset).y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - return; -} - -// 006139b0 -Vector * Entity_Familiar::GetOrbitPosition(Vector *outPosition, Vector *offset) -{ - uint8_t bVar1; - Vector *followPos; - uint32_t framePhase; - LayerState *layer; - int clampedLayer; - int iVar2; - float fVar3; - float cosAngle; - Vector scratchVec; - float layerAngleOffset; - - if (this->_isSubtype55555 != 0) { - fVar3 = (this->_formationOffset).y; - outPosition->x = (this->_formationOffset).x; - outPosition->y = fVar3; - return outPosition; - } - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x6d,0); - if ((bVar1 != 0) && (this->_variant != 0x2b)) { - followPos = UpdateFollowPosition(this,&scratchVec); - outPosition->x = followPos->x + offset->x; - outPosition->y = followPos->y + offset->y; - return outPosition; - } - if (((this->_formationOffset).x != g_vectorZero.x) || - ((this->_formationOffset).y != g_vectorZero.y)) { - reset_follow_target(this); - } - framePhase = g_manager->_framecount & 0x80000001; - if (GHIDRA_INT(framePhase) < 0) { - framePhase = (framePhase - 1 | 0xfffffffe) + 1; - } - fVar3 = fmodf(this->_orbitAngleOffset - - ((float)GHIDRA_INT(framePhase) * 0.5 + (float)g_game->_frameCount) * this->_orbitSpeed * - 3.1415927 * 0.5,6.2831855); - iVar2 = this->_variant; - if (iVar2 == 0x23) { - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Rotation"),1); - if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,6.0), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } - scratchVec.x = (fVar3 * 180.0) / 3.1415927; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_rotation = scratchVec.x; - iVar2 = this->_variant; - } - if (iVar2 == 0x7e) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_rotation = (fVar3 * 180.0) / 3.1415927; - } - iVar2 = this->_orbitLayer; - if (iVar2 < 0) { - fVar3 = offset->y; - outPosition->x = offset->x; - outPosition->y = fVar3; - return outPosition; - } - if (iVar2 < 1) { - iVar2 = 0; - } - clampedLayer = 10; - if (iVar2 < 10) { - clampedLayer = iVar2; - } - layerAngleOffset = (float)(&DAT_00c34140)[clampedLayer * 5]; - cosAngle = cos(fVar3 + layerAngleOffset); - outPosition->x = cosAngle * (this->_orbitDistance).x + offset->x; - fVar3 = sin(fVar3 + layerAngleOffset); - outPosition->y = fVar3 * (this->_orbitDistance).y + offset->y; - return outPosition; -} - -// 00613c20 -Entity_Laser * Entity_Familiar::fire_robo_baby_laser(Vector *direction) -{ - uint8_t bVar1; - Entity_Tear *tear; - float fVar2; - float offsetY; - int timeout; - Vector *posOffset; - Entity_Familiar *source; - Vector laserOffset; - Color laserColor; - uint32_t local_c; - uint8_t auStack_8 [4]; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) != '\0') { - return GHIDRA_CAST(0x0); - } - fVar2 = direction->x; - laserOffset.y = -23.0; - laserOffset.x = (fVar2 + fVar2) - direction->y * 9.0; - offsetY = -8.0 - (fVar2 + fVar2); - if (this->_variant == 0xce) { - laserOffset.y = -18.0; - laserOffset.x = g_vectorZero.x; - offsetY = g_vectorZero.y; - } - laserOffset.y = laserOffset.y + offsetY; - bVar1 = 0; - laserOffset.x = laserOffset.x + 0.0; - posOffset = &laserOffset; - timeout = 3; - source = this; - fVar2 = atan2f(direction->y,fVar2); - tear = (Entity_Tear *) - Entity_Laser::ShootAngle - (2,&this->_pos,fVar2 * 57.295776,timeout,posOffset,GHIDRA_CAST(source),bVar1); - *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearHaloANM2)._overlayAnimState._currentlyTriggeredEvents) + 1)) = 1; - *GHIDRA_CAST(&(tear->_tearHaloANM2)._animState._layerFrames) = 1; - fVar2 = apply_tear_modifiers(this); - tear->SetCollisionDamage(fVar2 * 3.5); - if ((direction->y <= -0.5 && direction->y != -0.5) || - (direction->x <= -0.5 && direction->x != -0.5)) { - fVar2 = -10.0; - } - else { - fVar2 = 3000.0; - } - tear->_renderDepthOffset = fVar2; - (GHIDRA_CAST((&laserColor)))->Color::Color(); - if (this->_isLilDelirium != 0) { - laserColor._tint[0] = 0.2; - laserColor._tint[1] = 1.0; - laserColor._tint[2] = 0.0; - laserColor._tint[3] = 1.0; - laserColor._offset[2] = 0.0; - laserColor._colorize[0] = 0.0; - laserColor._colorize[1] = 0.0; - laserColor._colorize[2] = 0.0; - laserColor._colorize[3] = 0.0; - laserColor._offset[0] = 1.0; - laserColor._offset[1] = 1.0; - } - if (this->_player != GHIDRA_CAST(0x0)) { - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsHologram(); - if (bVar1 != 0) { - laserColor._tint[3] = 0.25; - } - } - tear->SetColor(&laserColor,0xffffffff,0xff,0,1); - tear->Update(); - apply_baby_bender(this,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - return GHIDRA_CAST(tear); -} - -// 00613df0 -void Entity_Familiar::PlayFloatAnim(int direction) -{ - char cVar1; - uint32_t uVar2; - LayerState *layer; - int *texture; - uint8_t *anim; - char *anim_00; - uint8_t textureRef [4]; - int *textureImage; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int variant; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af69ad; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((textureRef + 0x18)); - variant = this->_variant; - if (variant == 0x58) { - return; - } - if (variant == 0xce) { - ExceptionList = &local_10; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - texture = LayerState::GetTexture(layer,textureRef); - local_8 = 0; - anim = s_Idle2; - if (*GHIDRA_CAST((*texture + 0x10)) < 0x81) { - anim = s_Idle; - } - ANM2::SetAnimation(&this->_sprite,anim,0); - local_8 = 1; - if (textureImage == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - cVar1 = (**(code **)(*textureImage + 0xc))(uVar2); - if (cVar1 == '\0') { - ExceptionList = local_10; - return; - } - if (g_imageReleaseFn == (void *)0x0) { - ExceptionList = local_10; - return; - } - (*g_imageReleaseFn)(textureRef); - ExceptionList = local_10; - return; - } - if (variant == 0xed) { - ExceptionList = &local_10; - ANM2::SetAnimation(&this->_sprite,s_Idle,0); - ExceptionList = local_10; - return; - } - if (variant == 0xee) { - return; - } - ExceptionList = &local_10; - (this->_sprite)._flipX = 0; - if (variant == 0x4c) { - anim_00 = "Float"; - } - else if ((variant == 6) || (variant == 0x35)) { - switch(direction) { - case 0: - anim_00 = "FloatSide2"; - break; - case 1: -switchD_00613f56_caseD_1: - anim_00 = "FloatUp"; - break; - case 2: - goto switchD_00613f56_caseD_2; - case 3: -switchD_00613f56_caseD_3: - anim_00 = "FloatDown"; - break; - default: - goto switchD_00613f25_default; - } - } - else if ((variant == 0x6d) && (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) != -1)) { - switch(direction) { - case 0: - (this->_sprite)._flipX = 1; - case 2: - anim_00 = "StoppedSide"; - break; - case 1: - anim_00 = "StoppedUp"; - break; - case 3: - anim_00 = "StoppedDown"; - break; - default: - goto switchD_00613f25_default; - } - } - else { - switch(direction) { - case 0: - (this->_sprite)._flipX = 1; - break; - case 1: - goto switchD_00613f56_caseD_1; - case 2: - break; - case 3: - goto switchD_00613f56_caseD_3; - default: - goto switchD_00613f25_default; - } -switchD_00613f56_caseD_2: - anim_00 = "FloatSide"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(anim_00),0); -switchD_00613f25_default: - ExceptionList = local_10; - return; -} - -// 00613fe0 -void Entity_Familiar::AddToDelayed() -{ - int *piVar1; - int iVar2; - uint32_t uVar3; - Entity_Familiar *otherFamiliar; - int familiarData; - uint64_t *allocatedBytes; - uint32_t i; - uint32_t *parentSlot; - bool isSameOwner; - EntityList_EL familiars; - int *erasedSlot; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Game *game; - uint64_t prevAllocatedBytes; - void *tmpEntity; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af69dd; - local_10 = ExceptionList; - uVar3 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - if (this->_isSubtype55555 != 0) { - return; - } - ExceptionList = &local_10; - if ((this->_isDelayed != 0) && (tmpEntity = (void *)this->_parent, tmpEntity != (void *)0x0)) { - if (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x28)) == 3) { - familiarData = __RTDynamicCast(tmpEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0, - uVar3); - if ((familiarData == 0) || (*GHIDRA_CAST((familiarData + 0xd75)) == '\0')) goto LAB_00614095; - isSameOwner = this->_player == *(void **)(familiarData + 0x410); - } - else { - if (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x28)) != 1) goto LAB_00614095; - isSameOwner = tmpEntity == this->_player; - } - if (isSameOwner) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Tried to add familiar %d to delayed again!\n")); - ExceptionList = local_10; - return; - } - } -LAB_00614095: - game = g_game; - this->_isDelayed = 1; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&familiars,3,-1,-1,0,0); - i = 0; - local_8 = 0; - if (familiars._size != 0) { - familiarData = (*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))); - do { - iVar2 = *GHIDRA_CAST((familiarData + i * 4)); - if (((*GHIDRA_CAST((iVar2 + 0x28)) == 3) && (*GHIDRA_CAST((iVar2 + 0x172)) != '\0')) && - (*GHIDRA_CAST((iVar2 + 0x3c0)) == 0)) { - otherFamiliar = - (Entity_Familiar *) - __RTDynamicCast(iVar2,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0,uVar3); - if (((otherFamiliar != GHIDRA_CAST(0x0)) && (otherFamiliar->_isDelayed != 0)) && - ((this->_player == otherFamiliar->_player && (otherFamiliar != this)))) { - piVar1 = GHIDRA_CAST((iVar2 + 0x3c0)); - if (*GHIDRA_CAST((iVar2 + 0x3c0)) != 0) { - erasedSlot = piVar1; - msvc::multiset::erase(&erasedSlot); - } - *piVar1 = GHIDRA_INT(this); - msvc::multiset::insert(piVar1); - parentSlot = &this->_parent; - if (this->_parent != 0) { - erasedSlot = parentSlot; - msvc::multiset::erase(&erasedSlot); - } - *parentSlot = iVar2; - msvc::multiset::insert(parentSlot); - break; - } - familiarData = (*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))); - } - i = i + 1; - } while (i < GHIDRA_UINT(familiars._size)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) != 0) { - uVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar3; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar3)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4))); - } - } - ExceptionList = local_10; - return; -} - -// 006141e0 -void Entity_Familiar::RemoveFromDelayed() -{ - int iVar1; - int *parentChildSlot; - int *local_10; - int *local_c; - int *local_8; - uint32_t *childSlot; - uint32_t *parentSlot; - - if (this->_isDelayed != 0) { - iVar1 = this->_parent; - parentSlot = &this->_parent; - if (iVar1 != 0) { - parentChildSlot = GHIDRA_CAST((iVar1 + 0x3c0)); - local_c = GHIDRA_CAST(this->_child); - if (*GHIDRA_CAST((iVar1 + 0x3c0)) != 0) { - local_8 = parentChildSlot; - msvc::multiset::erase(&local_8); - } - *parentChildSlot = GHIDRA_INT(local_c); - if (local_c != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(parentChildSlot); - } - } - iVar1 = this->_child; - childSlot = &this->_child; - if (iVar1 != 0) { - local_8 = GHIDRA_CAST((iVar1 + 0x3bc)); - local_10 = GHIDRA_CAST(*parentSlot); - if (*GHIDRA_CAST((iVar1 + 0x3bc)) != 0) { - local_c = local_8; - msvc::multiset::erase(&local_c); - } - *local_8 = GHIDRA_INT(local_10); - if (local_10 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(local_8); - } - } - if (*parentSlot != 0) { - local_10 = parentSlot; - msvc::multiset::erase(&local_10); - } - *parentSlot = 0; - if (*childSlot != 0) { - local_10 = childSlot; - msvc::multiset::erase(&local_10); - } - *childSlot = 0; - } - this->_isDelayed = 0; - return; -} - -// 006142e0 -void Entity_Familiar::PlayChargeAnim(int direction) -{ - uint8_t bVar1; - int iVar2; - uint8_t *****animNameBuf; - uint32_t size; - int chargeFrame; - float chargeFrameFloat; - char *anim; - uint8_t auStack_44 [4]; - int *fireCooldown; - uint32_t chargeNamePos; - uint8_t *****local_38; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t local_28; - uint32_t uStack_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t local_18; - int frameMod5; - int local_10; - uint32_t local_c; - void *animData; - uint8_t *****animNameBuf; - Game *game; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_44); - fireCooldown = &this->_fireCooldown; - (this->_sprite)._flipX = 0; - animData = (this->_sprite)._animState._animData; - chargeFrameFloat = 1.0 - (float)*fireCooldown / 30.0; - if (animData == (void *)0x0) { - chargeFrameFloat = chargeFrameFloat * 0.0; - local_38 = GHIDRA_CAST(0x0); - uStack_24 = 0xf; - local_28 = 0; - } - else { - chargeFrameFloat = chargeFrameFloat * (float)*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x30)); - (GHIDRA_CAST((GHIDRA_CAST(&local_38))))->msvc::string::string(animData); - } - animNameBuf = local_38; - chargeFrame = GHIDRA_INT(chargeFrameFloat); - animNameBuf = GHIDRA_CAST(&local_38); - if (0xf < uStack_24) { - animNameBuf = local_38; - } - chargeNamePos = msvc::string::find(GHIDRA_CAST(animNameBuf),local_28,0,GHIDRA_CAST("Charge"),6); - if (0xf < uStack_24) { - size = uStack_24 + 1; - animNameBuf = animNameBuf; - if (0xfff < size) { - animNameBuf = GHIDRA_CAST(animNameBuf[-1]); - size = uStack_24 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(animNameBuf) + (-4 - GHIDRA_INT(animNameBuf))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(animNameBuf,size); - } - local_28 = 0; - uStack_24 = 0xf; - if (chargeNamePos == 0xffffffff) { - chargeFrame = 0; - } - local_38 = GHIDRA_CAST((GHIDRA_UINT(local_38) & 0xffffff00)); - switch(direction) { - case 0: - (this->_sprite)._flipX = 1; - case 2: - anim = "FloatChargeSide"; - break; - case 1: - anim = "FloatChargeUp"; - break; - case 3: - anim = "FloatChargeDown"; - break; - default: - goto switchD_006143f4_default; - } - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(anim),1); - if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)chargeFrame), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } -switchD_006143f4_default: - game = g_game; - animData = (this->_sprite)._animState._animData; - if (animData == (void *)0x0) { - iVar2 = 0; - } - else { - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x30)); - } - if (((iVar2 <= chargeFrame) && (*fireCooldown < 0)) && - (((this->_flags & 0x4000) == 0 && - ((bVar1 = Game::IsPaused(g_game), bVar1 == 0 && - (frameMod5 = game->_frameCount % 5, frameMod5 == 0)))))) { - local_18 = 0x3e48c8ca; - local_28 = 0; - uStack_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - local_38 = GHIDRA_CAST(0x3f800000); - uStack_34 = 0x3f000000; - uStack_30 = 0x3f000000; - uStack_2c = 0x3f800000; - local_10 = frameMod5; - this->SetColor(&local_38,2,0,1,1); - } - return; -} - -// 00614500 -void Entity_Familiar::PlayShootAnim(int direction) -{ - char cVar1; - uint8_t isAnimSet; - uint32_t uVar2; - LayerState *layer; - int *texture; - char *animName; - uint8_t textureRef [4]; - int *textureImage; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int variant; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af69ad; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((textureRef + 0x18)); - variant = this->_variant; - if (variant == 0xce) { - ExceptionList = &local_10; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - texture = LayerState::GetTexture(layer,textureRef); - local_8 = 0; - animName = "Shoot2"; - if (*GHIDRA_CAST((*texture + 0x10)) < 0x81) { - animName = "Shoot"; - } - ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(animName),0); - local_8 = 1; - if (textureImage == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - cVar1 = (**(code **)(*textureImage + 0xc))(uVar2); - if (cVar1 == '\0') { - ExceptionList = local_10; - return; - } - if (g_imageReleaseFn == (void *)0x0) { - ExceptionList = local_10; - return; - } - (*g_imageReleaseFn)(textureRef); - ExceptionList = local_10; - return; - } - if (variant == 0xed) { - ExceptionList = &local_10; - ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Shoot"),0); - ExceptionList = local_10; - return; - } - if (variant == 0xee) { - return; - } - ExceptionList = &local_10; - (this->_sprite)._flipX = 0; - if (variant == 0x4c) { - animName = "Shoot"; - } - else if ((variant == 6) || (variant == 0x35)) { - switch(direction) { - case 0: - animName = "FloatShootSide2"; - break; - case 1: - goto switchD_00614663_caseD_1; - case 2: - goto switchD_00614663_caseD_2; - case 3: - goto switchD_00614663_caseD_3; - default: - goto switchD_00614663_default; - } - } - else { - if (variant == 0x58) { - isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Level3Shoot"),1); - if (isAnimSet != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - if (direction == 0) { - (this->_sprite)._flipX = 1; - ExceptionList = local_10; - return; - } - ExceptionList = local_10; - return; - } - switch(direction) { - case 0: - (this->_sprite)._flipX = 1; - case 2: -switchD_00614663_caseD_2: - animName = "FloatShootSide"; - break; - case 1: -switchD_00614663_caseD_1: - animName = "FloatShootUp"; - break; - case 3: -switchD_00614663_caseD_3: - animName = "FloatShootDown"; - break; - default: - goto switchD_00614663_default; - } - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(animName),0); -switchD_00614663_default: - ExceptionList = local_10; - return; -} - -// 00614b10 -void Entity_Familiar::Shoot() -{ - uint8_t bVar1; - char isLastRef; - uint32_t uVar2; - Vector *AimDirection; - int iVar3; - LayerState *layer; - int *texturePtr; - Entity *pEVar4; - uint8_t *anim; - int iVar5; - float sinAngle; - Vector local_4c; - Vector aimDir; - Vector local_3c; - uint8_t texture [4]; - Entity *local_30; - float local_2c; - int fireDirection; - int fireDelay; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - char *floatAnim; - void *player; - - puStack_20 = texture + 0x30; - local_14 = 0xffffffff; - puStack_18 = &LAB_00af6a0d; - local_1c = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((texture + 0x24)); - if (this->_player->_dead != 0) { - return; - } - ExceptionList = &local_1c; - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x8d,0); - if ((bVar1 != 0) && (0 < this->_fireCooldown)) { - this->_fireCooldown = this->_fireCooldown + -1; - } - iVar5 = this->_variant; - fireDelay = 0x16; - if (iVar5 == 0x4a) { - fireDelay = 0xb; - } - if ((iVar5 == 1) || (iVar5 == 8)) { - fireDelay = 0x10; - } - if (iVar5 == 0x51) { - fireDelay = 0x2c; - } - if ((this->_flags & 0x100) != 0) { - fireDelay = GHIDRA_INT(((float)fireDelay * 1.4)); - } - local_2c = -NAN; - if (iVar5 == 0xf4) { - fireDelay = 0xb; - } - else if (iVar5 == 0x4a) { - local_2c = (float)this->_subtype; - } - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar5 == 0x36)) { - fireDelay = 0x21; - } - iVar3 = fireDelay; - player = this->_player; - fireDirection = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x162c)); - if (fireDirection == -1) { - if (((-1 < this->_headFrameDelay) && - (iVar3 = this->_headFrameDelay + -1, this->_headFrameDelay = iVar3, iVar3 < 0)) && - (iVar5 != 0x58)) { - if (iVar5 == 0xce) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - texturePtr = LayerState::GetTexture(layer,texture); - local_14 = 0; - anim = s_Idle2; - if (*GHIDRA_CAST((*texturePtr + 0x10)) < 0x81) { - anim = s_Idle; - } - ANM2::SetAnimation(&this->_sprite,anim,0); - local_14 = 1; - if (((local_30 != GHIDRA_CAST(0x0)) && - (isLastRef = local_30->Update(uVar2), isLastRef != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(texture); - ExceptionList = local_1c; - return; - } - } - else { - if (iVar5 == 0xed) { - ANM2::SetAnimation(&this->_sprite,s_Idle,0); - ExceptionList = local_1c; - return; - } - if (iVar5 != 0xee) { - (this->_sprite)._flipX = 0; - if (iVar5 == 0x4c) { - floatAnim = "Float"; - } - else if (((iVar5 == 6) || (iVar5 == 0x35)) || - ((iVar5 != 0x6d || (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) == -1)))) { - floatAnim = "FloatDown"; - } - else { - floatAnim = "StoppedDown"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(floatAnim),0); - } - } - } - ExceptionList = local_1c; - return; - } - local_4c.x = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x33c)) - (this->_pos).x; - local_4c.y = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x340)) - (this->_pos).y; - if ((iVar5 == 8) || (iVar5 == 0xf4)) { - if (ABS(local_4c.x) <= ABS(local_4c.y)) { - fireDirection = GHIDRA_UINT((0.0 <= local_4c.y)) * 2 + 1; - } - else { - fireDirection = 2; - if (local_4c.x < 0.0) { - fireDirection = 0; - } - } - } - Isaac::GetAxisAlignedUnitVectorFromDir(&aimDir,fireDirection); - bVar1 = TryAimAtMarkedTarget(this,&aimDir,&fireDirection,GHIDRA_CAST(0x0)); - local_30 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x1))),bVar1)); - (this->_sprite)._flipX = fireDirection == 0; - if (0 < this->_fireCooldown) goto LAB_00614e92; - iVar5 = this->_variant; - if (iVar5 == 0x61) { - iVar5 = 0; - do { - local_2c = (float)iVar5 * 90.0 * 0.017453292; - local_3c.y = cos(local_2c); - sinAngle = sin(local_2c); - local_4c.x = aimDir.x * local_3c.y - aimDir.y * sinAngle; - local_4c.y = aimDir.y * local_3c.y + aimDir.x * sinAngle; - FireProjectile(this,&local_4c,(uint8_t)local_30); - iVar5 = iVar5 + 1; - } while (iVar5 < 4); - iVar3 = fireDelay; -LAB_00614e78: - this->_fireCooldown = iVar3; - this->_headFrameDelay = 0x12; - } - else { - if ((iVar5 == 6) || (local_2c == 5.60519e-45)) { - fire_robo_baby_laser(this,&aimDir); - goto LAB_00614e78; - } - if ((iVar5 != 0x36) && (local_2c != 1.26117e-44)) { - if ((iVar5 == 8) || (iVar5 == 0xf4)) { - pEVar4 = local_30; - AimDirection = (GHIDRA_CAST((&local_4c)))->Vector::Normalized(&local_3c); - FireProjectile(this,AimDirection,(uint8_t)pEVar4); - } - else { - FireProjectile(this,&aimDir,bVar1); - } - goto LAB_00614e78; - } - if (this->_linkedEntity == 0) { - PickEnemyTarget(this,200.0,1,0,&g_vectorZero,15.0); - local_30 = (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(this->_target)); - if (this->_linkedEntity != 0) { - local_3c.y = (float)&this->_linkedEntity; - msvc::multiset::erase(&local_3c.y); - } - this->_linkedEntity = local_30; - pEVar4 = GHIDRA_CAST(0x0); - if (local_30 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&this->_linkedEntity); - pEVar4 = GHIDRA_CAST(this->_linkedEntity); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(pEVar4); - goto LAB_00614e78; - } - } - mongo_baby_pick_next_mimic(this); -LAB_00614e92: - if (this->_headFrameDelay < 9) { - PlayFloatAnim(this,fireDirection); - this->_headFrameDelay = 8; - ExceptionList = local_1c; - return; - } - PlayShootAnim(this,fireDirection); - this->_headFrameDelay = this->_headFrameDelay + -1; - ExceptionList = local_1c; - return; -} - -// 00615d80 -void Entity_Familiar::ai_blue_fly() -{ - uint32_t rngResult; - Entity *orbitParent; - Vector *orbitPosition; - float fVar1; - float fVar2; - Vector local_18; - Vector local_10; - uint32_t *parentRef; - int tmpEntity; - - if (0 < this->_state) { - tmpEntity = this->_state + -1; - this->_state = tmpEntity; - this->_entityCollisionClass = 0; - this->_friction = this->_friction * 0.96; - if (tmpEntity == 0) { - this->_entityCollisionClass = 4; - return; - } - return; - } - local_18.x = 200.0; - if (this->_subtype == 1) { - local_18.x = 400.0; - if ((*GHIDRA_CAST(g_game->_room) == '\0') || - (g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)) < 0x3c)) { - this->_target = 0; - tmpEntity = 0; - goto LAB_00615e6a; - } - } - rngResult = Random(); - if ((rngResult % 3 == 0) || (this->_subtype == 1)) { - PickEnemyTarget(this,local_18.x,0xd,0,&g_vectorZero,15.0); - } - tmpEntity = 4; -LAB_00615e6a: - parentRef = &this->_parent; - this->_entityCollisionClass = tmpEntity; - tmpEntity = *parentRef; - if ((tmpEntity != 0) && - ((*GHIDRA_CAST((tmpEntity + 0x173)) != '\0' || (*GHIDRA_CAST((tmpEntity + 0x188)) == 0)))) { - local_18.x = (float)parentRef; - msvc::multiset::erase(&local_18); - *parentRef = 0; - if (-1 < this->_orbitLayer) { - RecalculateOrbitOffset(this,this->_orbitLayer,0); - this->_orbitLayer = -1; - } - } - tmpEntity = this->_target; - if (tmpEntity == 0) { - if (this->_orbitLayer == -1) { - this->_orbitLayer = 1; - fVar1 = DAT_00c34148; - (this->_orbitDistance).x = DAT_00c34144; - (this->_orbitDistance).y = fVar1; - RecalculateOrbitOffset(this,1,1); - } - orbitParent = get_orbit_parent(this); - local_10.x = (orbitParent->_pos).x; - local_10.y = (orbitParent->_pos).y; - orbitPosition = GetOrbitPosition(this,&local_18,&local_10); - fVar1 = orbitPosition->x; - (this->_targetPosition).x = fVar1; - (this->_targetPosition).y = orbitPosition->y; - } - else { - fVar1 = *GHIDRA_CAST((tmpEntity + 0x33c)); - fVar2 = *GHIDRA_CAST((tmpEntity + 0x340)); - (this->_targetPosition).x = fVar1; - (this->_targetPosition).y = fVar2; - if (-1 < this->_orbitLayer) { - RecalculateOrbitOffset(this,this->_orbitLayer,0); - this->_orbitLayer = -1; - fVar1 = (this->_targetPosition).x; - } - } - local_10.x = (this->_targetPosition).y - (this->_pos).y; - local_18.x = fVar1 - (this->_pos).x; - fVar1 = sqrtf(local_10.x * local_10.x + local_18.x * local_18.x); - if (fVar1 < 0.1) { - fVar2 = 0.0; - } - else { - fVar2 = fVar1 * 0.15; - if (2.0 <= fVar2) { - fVar2 = 2.0; - } - fVar2 = fVar2 / fVar1; - } - (this->_velocity).x = local_18.x * fVar2 + (this->_velocity).x; - (this->_velocity).y = local_10.x * fVar2 + (this->_velocity).y; - this->_friction = this->_friction * 0.8; - return; -} - -// 00616db0 -void Entity_Familiar::ai_walker() -{ - int iVar1; - uint8_t bVar2; - int *piVar3; - uint32_t *puVar4; - Entity *bloodSplat; - uint8_t *animNameChar; - uint8_t *pbVar5; - uint8_t *animNameChar; - char *animName; - uint32_t uVar7; - bool bVar8; - float fVar9; - float deltaX; - float fVar10; - uint32_t uVar11; - TypeDescriptor *pTVar12; - TypeDescriptor *pTVar13; - uint32_t uVar14; - uint8_t sameVariantList [12]; - uint32_t uStack_2c; - Vector targetPos; - uint32_t targetIndex; - uint8_t *local_1c; - uint8_t *local_18; - bool isChasingTarget; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6a5d; - local_10 = ExceptionList; - ExceptionList = &local_10; - targetPos.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - targetPos.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - if (this->_variant == 0x38) { - iVar1 = this->_parent; - if (iVar1 == 0) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(sameVariantList), - this->_type,0x38,-1,0,0); - local_8 = 0; - uVar7 = 0; - if (uStack_2c != 0) { - do { - pbVar5 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(sameVariantList)) + 0x4))) + uVar7 * 4)); - if (((pbVar5[0x172] != 0) && (*GHIDRA_CAST((pbVar5 + 0x3bc)) != 0)) && - (*GHIDRA_CAST((pbVar5 + 0x3c0)) == 0)) { - local_1c = pbVar5; - if (this->_parent != 0) { - local_18 = GHIDRA_CAST(&this->_parent); - msvc::multiset::erase(&local_18); - } - this->_parent = local_1c; - if (local_1c != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&this->_parent); - } - local_18 = GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(sameVariantList)) + 0x4))) + uVar7 * 4)) + 0x3c0)); - if (*GHIDRA_CAST(local_18) != 0) { - local_1c = local_18; - msvc::multiset::erase(&local_1c); - } - *GHIDRA_CAST(local_18) = this; - msvc::multiset::insert(local_18); - iVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(sameVariantList)) + 0x4))) + uVar7 * 4)); - targetPos.x = *GHIDRA_CAST((iVar1 + 0x33c)); - targetPos.y = *GHIDRA_CAST((iVar1 + 0x340)); - break; - } - uVar7 = uVar7 + 1; - } while (uVar7 < uStack_2c); - } - if ((this->_parent == 0) && (this->_parent = this->_player, this->_player != (void *)0x0)) { - msvc::multiset::insert(&this->_parent); - } - if (sameVariantList[0] == '\0') { - local_8 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)sameVariantList)) + 0x4))),0); - } - } - else { - targetPos.x = *GHIDRA_CAST((iVar1 + 0x33c)); - targetPos.y = *GHIDRA_CAST((iVar1 + 0x340)); - } - } - local_8 = 0xffffffff; - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_target != 0)) { - local_1c = *GHIDRA_CAST((this->_target + 0x20)); - piVar3 = map_find_value(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c))),GHIDRA_UINT(&local_1c)); - if (0x1c1 < *piVar3) { - targetIndex = *GHIDRA_CAST((this->_target + 0x20)); - puVar4 = map_find_value(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c))),GHIDRA_UINT(&targetIndex)); - *puVar4 = 0xfffffc7c; - } - } - PickEnemyTarget(this,this->_collisionDamage * 15.0 + 65.0,8,0,&g_vectorZero,15.0); - iVar1 = this->_target; - isChasingTarget = false; - if (iVar1 == 0) { - fVar10 = 6400.0; - } - else { - targetPos.x = *GHIDRA_CAST((iVar1 + 0x33c)); - fVar10 = 0.0; - targetPos.y = *GHIDRA_CAST((iVar1 + 0x340)); - } - fVar9 = targetPos.y - (this->_pos).y; - deltaX = targetPos.x - (this->_pos).x; - if (fVar10 < fVar9 * fVar9 + deltaX * deltaX) { - iVar1 = this->_variant; - if ((iVar1 == 0x2f) || (iVar1 == 0x38)) { - fVar10 = 2.2; - } - else { - fVar10 = 1.8; - } - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar1 == 0x2f)) { - fVar10 = 2.0; - } - PathFinder::FindGridPath(GHIDRA_CAST(&this->_pathfinder),&targetPos,fVar10 * 0.83,0,1); - isChasingTarget = this->_target != 0; - } - if (((this->_variant == 0x2e) || (this->_variant == 0x2f)) && (uVar7 = Random(), (uVar7 & 3) == 0) - ) { - uVar7 = Random(); - uVar14 = 0; - pTVar13 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar12 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar11 = 0; - bloodSplat = Game::Spawn(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - piVar3 = GHIDRA_CAST(__RTDynamicCast(bloodSplat,uVar11,pTVar12,pTVar13,uVar14)); - uVar7 = Random(); - fVar10 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.3 + 0.1; - piVar3[0x39] = GHIDRA_INT(fVar10); - piVar3[0x3a] = GHIDRA_INT(fVar10); - (**(code **)(*piVar3 + 0xc))(); - } - local_1c = GHIDRA_CAST(this->_variant); - this->_friction = this->_friction * 0.85; - fVar10 = (this->_velocity).x; - fVar9 = (this->_velocity).y; - fVar10 = sqrtf(fVar10 * fVar10 + fVar9 * fVar9); - if (fVar10 < 2.0) { - if (local_1c == GHIDRA_CAST(0x38)) { - if ((this->_sprite)._animState._animData == (void *)0x0) { - ExceptionList = local_10; - return; - } - AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0); - ExceptionList = local_10; - return; - } - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - animNameChar = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - animNameChar = *GHIDRA_CAST(pbVar5); - } - animNameChar = s_Idle; - do { - bVar2 = *animNameChar; - bVar8 = bVar2 < *animNameChar; - if (bVar2 != *animNameChar) { -LAB_00617225: - uVar7 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_0061722a; - } - if (bVar2 == 0) break; - bVar2 = animNameChar[1]; - bVar8 = bVar2 < animNameChar[1]; - if (bVar2 != animNameChar[1]) goto LAB_00617225; - animNameChar = animNameChar + 2; - animNameChar = animNameChar + 2; - } while (bVar2 != 0); - uVar7 = 0; -LAB_0061722a: - if (uVar7 == 0) { - if (pbVar5[0x34] == 0) { - ExceptionList = local_10; - return; - } - if ((this->_sprite)._animState._isPlaying != 0) { - ExceptionList = local_10; - return; - } - } - } - pbVar5 = s_Idle; - goto LAB_0061748d; - } - fVar10 = (this->_velocity).y; - if (ABS(fVar10) < ABS((this->_velocity).x)) { - if (this->_variant == 0x38) { - animName = "Attack Hori"; - if (isChasingTarget == false) { - animName = "Move Hori"; - } - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar5); - } - animNameChar = GHIDRA_CAST(animName); - do { - bVar2 = *pbVar5; - bVar8 = bVar2 < *animNameChar; - if (bVar2 != *animNameChar) { -LAB_006172c4: - uVar7 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_006172c9; - } - if (bVar2 == 0) break; - bVar2 = pbVar5[1]; - bVar8 = bVar2 < animNameChar[1]; - if (bVar2 != animNameChar[1]) goto LAB_006172c4; - pbVar5 = pbVar5 + 2; - animNameChar = animNameChar + 2; - } while (bVar2 != 0); - uVar7 = 0; -LAB_006172c9: - if ((uVar7 == 0) && - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) == '\0' || - ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00617356; - } - local_18 = GHIDRA_CAST(animName); - } - else { - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar5); - } - animName = "WalkHori"; - do { - bVar2 = *pbVar5; - bVar8 = bVar2 < (uint8_t)*animName; - if (bVar2 != *animName) { -LAB_00617320: - uVar7 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_00617325; - } - if (bVar2 == 0) break; - bVar2 = pbVar5[1]; - bVar8 = bVar2 < (uint8_t)animName[1]; - if (bVar2 != animName[1]) goto LAB_00617320; - pbVar5 = pbVar5 + 2; - animName = animName + 2; - } while (bVar2 != 0); - uVar7 = 0; -LAB_00617325: - if ((uVar7 == 0) && - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) == '\0' || - ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00617356; - } - animName = "WalkHori"; - } - bVar2 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(animName),1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_00617356: - (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; - ExceptionList = local_10; - return; - } - pbVar5 = (this->_sprite)._animState._animData; - if (this->_variant != 0x38) { - if (pbVar5 != GHIDRA_CAST(0x0)) { - animNameChar = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - animNameChar = *GHIDRA_CAST(pbVar5); - } - animName = "WalkVert"; - do { - bVar2 = *animNameChar; - bVar8 = bVar2 < (uint8_t)*animName; - if (bVar2 != *animName) { -LAB_00617473: - uVar7 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_00617478; - } - if (bVar2 == 0) break; - bVar2 = animNameChar[1]; - bVar8 = bVar2 < (uint8_t)animName[1]; - if (bVar2 != animName[1]) goto LAB_00617473; - animNameChar = animNameChar + 2; - animName = animName + 2; - } while (bVar2 != 0); - uVar7 = 0; -LAB_00617478: - if (uVar7 == 0) { - if (pbVar5[0x34] == 0) { - ExceptionList = local_10; - return; - } - if ((this->_sprite)._animState._isPlaying != 0) { - ExceptionList = local_10; - return; - } - } - } - pbVar5 = GHIDRA_CAST("WalkVert"); - goto LAB_0061748d; - } - if (isChasingTarget == false) { - local_18 = GHIDRA_CAST(0xb605fc); - if (fVar10 <= 0.0) { - local_18 = GHIDRA_CAST(0xb60608); - } - if (pbVar5 != GHIDRA_CAST(0x0)) { - animNameChar = pbVar5; - animNameChar = local_18; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - animNameChar = *GHIDRA_CAST(pbVar5); - } - do { - bVar2 = *animNameChar; - bVar8 = bVar2 < *animNameChar; - if (bVar2 != *animNameChar) goto LAB_006173d2; - if (bVar2 == 0) goto LAB_006173ce; - bVar2 = animNameChar[1]; - bVar8 = bVar2 < animNameChar[1]; - if (bVar2 != animNameChar[1]) goto LAB_006173d2; - animNameChar = animNameChar + 2; - animNameChar = animNameChar + 2; - } while (bVar2 != 0); - uVar7 = 0; - goto LAB_006173d7; - } - } - else { - local_18 = GHIDRA_CAST(0xb60574); - if (fVar10 <= 0.0) { - local_18 = GHIDRA_CAST(0xb605b8); - } - if (pbVar5 != GHIDRA_CAST(0x0)) { - animNameChar = pbVar5; - animNameChar = local_18; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - animNameChar = *GHIDRA_CAST(pbVar5); - } - do { - bVar2 = *animNameChar; - bVar8 = bVar2 < *animNameChar; - if (bVar2 != *animNameChar) goto LAB_006173d2; - if (bVar2 == 0) break; - bVar2 = animNameChar[1]; - bVar8 = bVar2 < animNameChar[1]; - if (bVar2 != animNameChar[1]) goto LAB_006173d2; - animNameChar = animNameChar + 2; - animNameChar = animNameChar + 2; - } while (bVar2 != 0); -LAB_006173ce: - uVar7 = 0; -LAB_006173d7: - if (uVar7 == 0) { - if (pbVar5[0x34] == 0) { - ExceptionList = local_10; - return; - } - if ((this->_sprite)._animState._isPlaying != 0) { - ExceptionList = local_10; - return; - } - } - } - } - pbVar5 = local_18; -LAB_0061748d: - bVar2 = ANM2::SetAnimation(&this->_sprite,pbVar5,1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - ExceptionList = local_10; - return; -LAB_006173d2: - uVar7 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_006173d7; -} - -// 006174c0 -void Entity_Familiar::ai_charger() -{ - void *pvVar1; - uint8_t bVar2; - char isFiring; - Entity *umbilicalWhip; - Vector *pVVar3; - uint8_t *currentAnimName; - uint32_t uVar4; - uint32_t uVar5; - int iVar6; - Entity_Player *player; - RNG *collectibleRng; - float *chargeLevelPtr; - Vector *pVVar7; - float *collisionPoint; - float *extraout_ECX; - uint32_t *puVar8; - int iVar9; - bool bVar10; - float fVar11; - uint8_t in_XMM0 [16]; - float fVar12; - Entity_Familiar *pEVar13; - Entity_Familiar *pEVar14; - float velocityX; - EntityRef sourceRef; - uint8_t entityList [12]; - uint8_t *puStack_4c; - Vector scratchVec; - uint8_t local_40 [8]; - Vector local_38; - Entity_Familiar *local_30; - Vector local_2c; - uint32_t *local_24; - Entity_Familiar *local_20; - Vector local_1c; - char isNoOtherCharging; - uint8_t isLilithIncubus; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - char *animName; - GridEntity_Door *door; - Game *game; - Manager *manager; - int *queriedEntity; - Room *room; - RoomDescriptor *roomDesc; - ANM2 *sprite; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6aa9; - local_10 = ExceptionList; - ExceptionList = &local_10; - local_20 = this; - isLilithIncubus = IsLilithBirthrightIncubus(this); - if (this->_subtype != 0) { - this->_entityCollisionClass = 0; - if (((this->_variant == 0x19) && ((this->_sprite)._animState._animData != (void *)0x0)) && - ((this->_sprite)._animState._isPlaying != 0)) { - this->_friction = this->_friction * 0.3; - if (isLilithIncubus == 0) goto LAB_006189fb; - } - else { - this->_visible = 0; - } - FollowParent(this); -LAB_006189fb: - uVar4 = this->_subtype; - if (3 < uVar4) { - this->_subtype = 0; - iVar6 = 0x3c; - if (this->_variant != 0x3b) { - iVar6 = 0; - } - this->_fireCooldown = iVar6; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - ExceptionList = local_10; - return; - } - if (((this->_variant != 0xe8) && (uVar4 != 0)) && - (iVar6 = this->_state, this->_state = iVar6 + 1, 300 < iVar6)) { - if (uVar4 == 1) { - uVar4 = Random(); - Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - uVar4 = this->_subtype; - } - this->_subtype = uVar4 + 1; - } - ExceptionList = local_10; - return; - } - this->_visible = 1; - this->_state = 0; - local_24 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)); - Isaac::GetAxisAlignedUnitVectorFromDir(&local_1c,GHIDRA_INT(local_24)); - TryAimAtMarkedTarget(this,&local_1c,GHIDRA_CAST(&local_24),GHIDRA_CAST(0x0)); - if (this->_fireCooldown < 0) { - if (((isLilithIncubus != 0) && - (umbilicalWhip = get_incubus_umbilical_whip(this), umbilicalWhip != GHIDRA_CAST(0x0))) && - (fVar11 = umbilicalWhip[3]._sprite._championColor._tint[3], fVar11 != -NAN)) { - pVVar3 = Isaac::GetAxisAlignedUnitVectorFromDir(&scratchVec,GHIDRA_INT(fVar11)); - (this->_velocity).x = pVVar3->x; - (this->_velocity).y = pVVar3->y; - } - iVar6 = this->_variant; - if (iVar6 == 0x82) { - animName = "Throw"; - } - else { - if (iVar6 == 0xe8) { - local_30 = GHIDRA_CAST(0x0); - local_24 = GHIDRA_CAST(0x3); - uVar4 = (g_game->_stage + 1) * 100; - if (0x4b0 < GHIDRA_INT(uVar4)) { - uVar4 = 0x4b0; - } - local_2c.y = (float)(this->_coins / GHIDRA_INT((uVar4 >> 2))); - collisionPoint = GHIDRA_CAST(&local_30); - if (-1 < GHIDRA_INT(local_2c.y)) { - collisionPoint = &local_2c.y; - } - chargeLevelPtr = GHIDRA_CAST(&local_24); - if (GHIDRA_INT(*collisionPoint) < 4) { - chargeLevelPtr = collisionPoint; - } - fVar11 = *chargeLevelPtr; - ANM2::Play(&this->_sprite,(&PTR_s_Charge0_00b648f0)[GHIDRA_INT(fVar11)],0); - fVar11 = (float)GHIDRA_INT(fVar11); - this->SetCollisionDamage(fVar11 + fVar11 + 2.0); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(entityList), - &this->_pos,this->_size,0x10); - local_8 = 0; - local_30 = GHIDRA_CAST(0x0); - if (puStack_4c != GHIDRA_CAST(0x0)) { - iVar6 = g_forceCollideDepth; - do { - queriedEntity = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(entityList)) + 0x4))) + GHIDRA_INT(local_30) * 4)); - if (((queriedEntity != GHIDRA_CAST(0x0)) && (queriedEntity[10] == 5)) && - ((((iVar9 = queriedEntity[0xb], iVar9 == 10 || - (((((iVar9 == 0x14 || (iVar9 == 0x5a)) || (iVar9 == 0x28)) || - ((iVar9 == 0x1e || (iVar9 == 0x46)))) || (iVar9 == 300)))) || - ((((iVar9 == 0x15e || (iVar9 == 0x45)) || (iVar9 == 0x29)) || (iVar9 == 0x2a)))) && - (queriedEntity[0x14d] == 0)))) { - g_forceCollideDepth = iVar6 + 1; - this->HandleCollision(queriedEntity,1); - (**(code **)(*queriedEntity + 0x5c))(this,0); - iVar6 = g_forceCollideDepth + -1; - g_forceCollideDepth = iVar6; - } - local_30 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x1)))); - } while (local_30 < puStack_4c); - } - local_8 = 0xffffffff; - if (entityList[0] == '\0') { - local_8 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)entityList)) + 0x4))),0); - local_8 = 0xffffffff; - } - goto LAB_006177c3; - } - fVar11 = (this->_velocity).x; - fVar12 = (this->_velocity).y; - if (ABS(fVar12) < ABS(fVar11)) { - if (((iVar6 == 3) || (iVar6 == 0x68)) || ((iVar6 == 0xdf && (this->_fireCooldown == -1)))) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("FloatShootSide"),0); - fVar11 = (this->_velocity).x; - } - (this->_sprite)._flipX = fVar11 < 0.0; - goto LAB_006177c3; - } - if (((iVar6 != 3) && (iVar6 != 0x68)) && ((iVar6 != 0xdf || (this->_fireCooldown != -1)))) - goto LAB_006177c3; - animName = "FloatShootUp"; - if (0.0 <= fVar12) { - animName = "FloatShootDown"; - } - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(animName),0); -LAB_006177c3: - if (this->_variant == 0x82) { - iVar6 = this->_target; - pEVar13 = GHIDRA_CAST(&this->_target); - pVVar3 = &this->_pos; - local_30 = pEVar13; - if (iVar6 == 0) { - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_40),pVVar3, - this->_size,0x10); - pEVar14 = local_30; - local_8 = 2; - local_24 = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(local_38.y) != GHIDRA_CAST(0x0)) { - do { - puVar8 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x4))) + GHIDRA_INT(local_24) * 4)); - local_1c.y = (float)puVar8; - if ((((puVar8 != GHIDRA_CAST(0x0)) && (puVar8[10] == 5)) && - (((((iVar6 = puVar8[0xb], iVar6 == 10 || - (((iVar6 == 0x14 || (iVar6 == 0x5a)) || (iVar6 == 0x28)))) || - (((iVar6 == 0x1e || (iVar6 == 0x46)) || (iVar6 == 300)))) || - ((iVar6 == 0x15e || (iVar6 == 0x45)))) || ((iVar6 == 0x29 || (iVar6 == 0x2a)))))) - && (puVar8[0x14d] == 0)) { - if ((iVar6 == 0x14) && (puVar8[0xc] == 6)) { - if ((puVar8[0x1f] != 0) && (*GHIDRA_CAST((puVar8 + 0x23)) != '\0')) { - currentAnimName = GHIDRA_CAST(puVar8[0x1f]); - if (0xf < *GHIDRA_CAST((currentAnimName + 0x14))) { - currentAnimName = *GHIDRA_CAST(currentAnimName); - } - animName = "Touched"; - do { - bVar2 = *currentAnimName; - bVar10 = bVar2 < (uint8_t)*animName; - if (bVar2 != *animName) { -LAB_00617920: - uVar4 = -GHIDRA_UINT(bVar10) | 1; - goto LAB_00617925; - } - if (bVar2 == 0) break; - bVar2 = currentAnimName[1]; - bVar10 = bVar2 < (uint8_t)animName[1]; - if (bVar2 != animName[1]) goto LAB_00617920; - currentAnimName = currentAnimName + 2; - animName = animName + 2; - } while (bVar2 != 0); - uVar4 = 0; -LAB_00617925: - if (uVar4 == 0) goto LAB_006179e0; - } - local_2c.y = (float)(puVar8 + 0x12); - currentAnimName = GHIDRA_CAST(puVar8[0x1f]); - if (currentAnimName == GHIDRA_CAST(0x0)) { -LAB_00617990: - bVar2 = ANM2::SetAnimation(GHIDRA_CAST((puVar8 + 0x12)),GHIDRA_CAST("Touched"),1); - fVar11 = local_2c.y; - if (bVar2 != 0) { - AnimationState::Rewind(GHIDRA_CAST((GHIDRA_INT(local_2c.y) + 0x30))); - *GHIDRA_CAST((GHIDRA_CAST(fVar11) + 0x44)) = 1; - puVar8 = GHIDRA_CAST(local_1c.y); - } - } - else { - if (0xf < *GHIDRA_CAST((currentAnimName + 0x14))) { - currentAnimName = *GHIDRA_CAST(currentAnimName); - } - animName = "Touched"; - do { - bVar2 = *currentAnimName; - bVar10 = bVar2 < (uint8_t)*animName; - if (bVar2 != *animName) { -LAB_00617970: - uVar4 = -GHIDRA_UINT(bVar10) | 1; - goto LAB_00617975; - } - if (bVar2 == 0) break; - bVar2 = currentAnimName[1]; - bVar10 = bVar2 < (uint8_t)animName[1]; - if (bVar2 != animName[1]) goto LAB_00617970; - currentAnimName = currentAnimName + 2; - animName = animName + 2; - } while (bVar2 != 0); - uVar4 = 0; -LAB_00617975: - if ((uVar4 != 0) || - ((*GHIDRA_CAST((puVar8[0x1f] + 0x34)) != '\0' && (*GHIDRA_CAST((puVar8 + 0x23)) == '\0')) - )) goto LAB_00617990; - } - puVar8[0x153] = 10; - } - else { - if (*GHIDRA_CAST(pEVar14) != 0) { - local_2c.y = (float)pEVar14; - msvc::multiset::erase(&local_2c.y); - } - *GHIDRA_CAST(pEVar14) = puVar8; - msvc::multiset::insert(pEVar14); - } - } -LAB_006179e0: - local_24 = GHIDRA_CAST((GHIDRA_INT(local_24) + 1)); - } while (local_24 < GHIDRA_UINT(local_38.y)); - pEVar13 = local_30; - this = local_20; - } - if (local_40[0] == '\0') { - local_8 = 3; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_40)) + 0x4))),0); - } - local_8 = 0xffffffff; - pVVar3 = &this->_pos; - } - else { - *GHIDRA_CAST((iVar6 + 0x33c)) = pVVar3->x; - *GHIDRA_CAST((iVar6 + 0x340)) = (this->_pos).y; - iVar6 = *GHIDRA_CAST(pEVar13); - *GHIDRA_CAST((iVar6 + 0x360)) = (this->_velocity).x; - *GHIDRA_CAST((iVar6 + 0x364)) = (this->_velocity).y; - *GHIDRA_CAST((*GHIDRA_CAST(pEVar13) + 0x184)) = 0; - } - if (this->_fireCooldown == -2) { - local_2c.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - pVVar3->y; - local_30 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - pVVar3->x)); - local_24 = GHIDRA_CAST((local_2c.y * local_2c.y + (float)local_30 * (float)local_30)); - if ((float)local_24 < 1600.0) { - uVar4 = *GHIDRA_CAST(pEVar13); - this->_fireCooldown = 0x1e; - if (uVar4 != 0) { - uVar5 = 3; - if (isLilithIncubus != 0) { - uVar5 = 0; - } - *GHIDRA_CAST((uVar4 + 0x184)) = uVar5; - if (*GHIDRA_CAST(pEVar13) != 0) { - local_20 = pEVar13; - msvc::multiset::erase(&local_20); - } - *GHIDRA_CAST(pEVar13) = 0; - } - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); - sprite = &this->_sprite; - if (iVar6 == 3) { - ANM2::Play(sprite,GHIDRA_CAST("FloatDown"),0); - } - else if (iVar6 == 1) { - ANM2::Play(sprite,GHIDRA_CAST("FloatUp"),0); - } - else { - ANM2::Play(sprite,GHIDRA_CAST("FloatSide"),0); - (this->_sprite)._flipX = iVar6 == 0; - } - } - fVar11 = sqrtf((float)local_24); - pEVar13 = local_30; - pEVar14 = GHIDRA_CAST(local_2c.y); - if (0.0 < fVar11) { - pEVar13 = GHIDRA_CAST(((float)local_30 * (1.0 / fVar11))); - pEVar14 = GHIDRA_CAST((local_2c.y * (1.0 / fVar11))); - } - (this->_velocity).x = (float)pEVar13 * 10.0; - (this->_velocity).y = (float)pEVar14 * 10.0; - this->_entityCollisionClass = 4; - } - else { - if ((((this->_collidesWithGrid != 0) || - (bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(pVVar3,-100.0), bVar2 == 0)) || - (*GHIDRA_CAST(pEVar13) != 0)) && (bVar2 = IsLilithBirthrightIncubus(this), bVar2 == 0)) { - this->_entityGridCollisionClass = 0; - (this->_velocity).x = (this->_velocity).x * 0.5; - (this->_velocity).y = (this->_velocity).y * 0.5; - this->_fireCooldown = -2; - } - this->_entityCollisionClass = 4; - } - } - else if (this->_variant == 0xdf) { - iVar6 = this->_fireCooldown; - if (iVar6 == -3) { - fVar11 = (this->_sprite)._color._tint[3] - 0.1; - if (fVar11 <= 0.0) { - fVar11 = 0.0; - } - (this->_sprite)._color._tint[3] = fVar11; - if (fVar11 <= 0.0) { - this->Remove(); - uVar4 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - player = Game::GetPlayer(g_game,uVar4); - if (player->_variant == 0) { - player->_cacheFlags = player->_cacheFlags | 0x200; - (player->_temporaryeffects)._shouldEvaluateCache = 1; - } - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - } - } - else if (iVar6 == -2) { - fVar11 = (this->_targetPosition).y; - fVar12 = (this->_pos).y; - (this->_velocity).x = (this->_targetPosition).x - (this->_pos).x; - (this->_velocity).y = fVar11 - fVar12; - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - this->_fireCooldown = 0x1e; - } - } - else if (iVar6 == -1) { - iVar6 = 0x194; - this->_entityCollisionClass = 3; - if (isLilithIncubus != 0) { - iVar6 = 0x360; - } - local_38.x = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + iVar6)); - local_38.y = *GHIDRA_CAST(((this->_sprite)._filename._buf + iVar6 + -0x44)); - local_30 = GHIDRA_CAST(local_38.y); - local_24 = GHIDRA_CAST(local_38.x); - if ((isLilithIncubus == 0) && - ((this->_collidesWithGrid == 0 || - (pVVar3 = (GHIDRA_CAST((&local_38)))->Vector::Normalized(&local_2c), - pVVar3->y * (this->_gridCollisionNormal).y + (this->_gridCollisionNormal).x * pVVar3->x - <= 0.45)))) { - local_30 = GHIDRA_CAST((this->_velocity).x); - local_2c.y = (this->_velocity).y; - fVar11 = sqrtf((float)local_30 * (float)local_30 + local_2c.y * local_2c.y); - if (17.0 <= fVar11) { - ExceptionList = local_10; - return; - } - if (0.0 < fVar11) { - (this->_velocity).x = (float)local_30 * (17.0 / fVar11); - (this->_velocity).y = local_2c.y * (17.0 / fVar11); - ExceptionList = local_10; - return; - } - ExceptionList = local_10; - return; - } - pEVar13 = local_20; - collisionPoint = (this->_collisionPoints)._begin; - local_38.y = (float)(GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT(collisionPoint) >> 3); - local_1c.y = 0.0; - if (GHIDRA_CAST(local_38.y) != GHIDRA_CAST(0x0)) { - pVVar7 = &this->_pos; - pVVar3 = &this->_pos; - local_2c.y = (float)g_game->_room; - do { - iVar9 = GHIDRA_INT(((((float)local_24 + pVVar3->x + *collisionPoint) - 40.0) / 40.0 + 0.5)); - iVar6 = GHIDRA_INT(((((float)local_30 + pVVar7->y + collisionPoint[1]) - 120.0) / 40.0 + 0.5)); - if (-1 < iVar9) { - if (((((iVar9 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_2c.y)))) + 0xc))))) && (-1 < iVar6)) - && (this = local_20, iVar6 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_2c.y)))) + 0x10)))) - )) && ((uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_2c.y)))) + 0xc)))) * iVar6 + - iVar9, uVar4 < 0x1c0 && - (door = *(GridEntity_Door **) - (((GHIDRA_CAST(local_2c.y))->_sprite)._filename._buf + - uVar4 * 4 + -0x24), door != GHIDRA_CAST(0x0))))) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) == 0x10)) { - this = pEVar13; - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x8)))) == 3) && - (iVar6 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(), iVar6 == 4)) && - (bVar2 = (GHIDRA_CAST((door)))->GridEntity_Door::TryBlowOpen(0,GHIDRA_CAST(pEVar13)), bVar2 != 0)) { - pEVar13->_entityGridCollisionClass = 0; - pEVar13->_fireCooldown = -3; - (pEVar13->_velocity).x = (float)local_24; - (pEVar13->_velocity).y = (float)local_30; - fVar11 = pEVar13->_speedMultiplier; - fVar12 = (pEVar13->_velocity).x; - (pEVar13->_pos).y = (float)local_30 * fVar11 + (pEVar13->_pos).y; - (pEVar13->_pos).x = fVar11 * fVar12 + (pEVar13->_pos).x; - bVar2 = (GHIDRA_CAST((pEVar13->_player)))->Entity_Player::HasCollectible(0x272,0); - if (bVar2 == 0) { - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x272, - GHIDRA_CAST(&g_game->_playerManager),0); - } - else { - player = pEVar13->_player; - } - if (player != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((player)))->Entity_Player::RemoveCollectible(0x272,0,0,1); - } - bVar2 = (GHIDRA_CAST((pEVar13->_player)))->Entity_Player::HasCollectible(0x273,0); - if (bVar2 == 0) { - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x273, - GHIDRA_CAST(&g_game->_playerManager),0); - } - else { - player = pEVar13->_player; - } - if (player != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((player)))->Entity_Player::RemoveCollectible(0x273,0,0,1); - } - goto LAB_00618228; - } - break; - } - } - local_1c.y = (float)(GHIDRA_INT(local_1c.y) + 1); - collisionPoint = collisionPoint + 2; - } while (GHIDRA_UINT(local_1c.y) < GHIDRA_UINT(local_38.y)); - } - bVar2 = IsLilithBirthrightIncubus(this); - if (bVar2 == 0) { - this->_entityCollisionClass = 0; - this->_entityGridCollisionClass = 0; - bVar2 = (GHIDRA_CAST((&this->_gridCollisionNormal)))->Vector::operator_eq(&g_vectorZero); - if (bVar2 == 0) { - if (ABS((float)local_30) < ABS((float)local_24)) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("HitSide"),0); - (this->_sprite)._flipX = (float)local_24 < 0.0; - } - else { - animName = "HitDown"; - if ((float)local_30 < 0.0) { - animName = "HitUp"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(animName),0); - } - manager = g_manager; - (this->_targetPosition).x = (this->_pos).x; - (this->_targetPosition).y = (this->_pos).y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - local_30 = GHIDRA_CAST(0xcd); - seed_fart_sound_override(GHIDRA_CAST(&local_30)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,2,0,1.0,0.0); - this->_fireCooldown = -2; - } - else { - this->_fireCooldown = 0x1e; - } - } - } - } - else { - if (((this->_collidesWithGrid != 0) || (this->_fireCooldown < -1)) || - (bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&this->_pos,-100.0), bVar2 == 0)) { - bVar2 = IsLilithBirthrightIncubus(this); - game = g_game; - if (bVar2 == 0) { - this->_entityGridCollisionClass = 0; - room = game->_room; - iVar6 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&local_20->_pos); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(local_20->_player); - (GHIDRA_CAST((room)))->Room::DamageGridWithSource(iVar6,1,&sourceRef); - (local_20->_velocity).x = (local_20->_velocity).x * 0.5; - (local_20->_velocity).y = (local_20->_velocity).y * 0.5; - local_20->_fireCooldown = local_20->_fireCooldown + -1; - this = local_20; - if (local_20->_fireCooldown < -10) { - local_20->_fireCooldown = 0x1e; - } - } - } - this->_entityCollisionClass = (this->_variant == 0x68) + 3; - } -LAB_00618228: - if (isLilithIncubus == 0) { - ExceptionList = local_10; - return; - } - FollowParent(this); - umbilicalWhip = get_incubus_umbilical_whip(this); - if (umbilicalWhip == GHIDRA_CAST(0x0)) { - this->_fireCooldown = 0x1e; - ExceptionList = local_10; - return; - } - ExceptionList = local_10; - return; - } - FollowParent(this); - iVar6 = this->_variant; - if (iVar6 == 0x82) { - fVar11 = (this->_velocity).y; - fVar12 = (this->_velocity).x; - if (4.0 < fVar12 * fVar12 + fVar11 * fVar11) { - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); - sprite = &this->_sprite; - if (iVar6 == 3) { - ANM2::Play(sprite,GHIDRA_CAST("FloatDown"),0); - } - else { - if (iVar6 != 1) { - ANM2::Play(sprite,GHIDRA_CAST("FloatSide"),0); - bVar10 = iVar6 == 0; - goto LAB_006185e8; - } - ANM2::Play(sprite,GHIDRA_CAST("FloatUp"),0); - } - } - } - else if (iVar6 == 0xe8) { - iVar6 = (g_game->_stage + 1) * 100; - if (0x4b0 < iVar6) { - iVar6 = 0x4b0; - } - if ((((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0) || - ((*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x188f8))) != '\0')) || - ((this->_coins < iVar6 || - (fVar11 = (this->_velocity).y, fVar12 = (this->_velocity).x, - 400.0 <= fVar12 * fVar12 + fVar11 * fVar11)))) { - pvVar1 = (this->_sprite)._animState._animData; - if (((pvVar1 == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x34)) != '\0')) || - ((this->_sprite)._animState._isPlaying == 0)) { - uVar4 = g_game->_stage * 200; - local_38.y = 0.0; - local_2c.y = 4.2039e-45; - if (0x4b0 < GHIDRA_INT(uVar4)) { - uVar4 = 0x4b0; - } - local_30 = GHIDRA_CAST((this->_coins / GHIDRA_INT((uVar4 >> 2)))); - collisionPoint = &local_38.y; - if (-1 < GHIDRA_INT(local_30)) { - collisionPoint = GHIDRA_CAST(&local_30); - } - chargeLevelPtr = &local_2c.y; - if (GHIDRA_INT(*collisionPoint) < 4) { - chargeLevelPtr = collisionPoint; - } - ANM2::Play(&this->_sprite,(&PTR_DAT_00b648e0)[GHIDRA_INT(*chargeLevelPtr)],0); - } - } - else { - iVar6 = g_game->_currentRoomIdx; - if ((((iVar6 != -0x14) && (iVar6 != -0x12)) && (iVar6 != -0xd)) && - (((iVar6 != -4 && (iVar6 != -6)) && (iVar6 != -0x13)))) { - ANM2::Play(&this->_sprite,s_Spawn,0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - if (bVar2 != 0) { - Room::FindFreePickupSpawnPosition(g_game->_room,&local_2c,&this->_pos,0.0,0,0,1); - manager = g_manager; - this->_coins = 0; - local_30 = GHIDRA_CAST(0x10c); - seed_fart_sound_override(GHIDRA_CAST(&local_30)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,2,0,1.0,0.0); - game = g_game; - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && - (_Init_thread_header(&g_invalidRoomDescriptorGuard), g_invalidRoomDescriptorGuard == -1 - )) { - local_8 = 4; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); - _atexit(FUN_00b15b30); - local_8 = 0xffffffff; - _Init_thread_footer(&g_invalidRoomDescriptorGuard); - } - roomDesc = &g_roomDescriptorDummy; - if (GHIDRA_UINT(game->_currentDimensionIdx) < 3) { - roomDesc = game->_roomList + 0x20e; - } - roomDesc->Flags = roomDesc->Flags | 0x20000; - collectibleRng = (GHIDRA_CAST((this->_player)))->Entity_Player::GetCollectibleRNG(0x2a9); - uVar4 = (GHIDRA_CAST((collectibleRng)))->RNG::Next(); - Game::Spawn(g_game,1000,0xa1,&local_2c,&g_vectorZero,GHIDRA_CAST(0x0),0x3d4,uVar4); - game = g_game; - this->_subtype = 1; - (*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x188f8))) = 1; - } - } - } - if ((this->_fireCooldown < 1) && - (bVar2 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), bVar2 != 0)) { - local_1c.x = *extraout_ECX; - local_1c.y = extraout_ECX[1]; - local_24 = GHIDRA_CAST(0x0); - } - } - else if (((iVar6 == 0xd5) || (iVar6 == 0xd6)) || (iVar6 == 0xdf)) { - ANM2::Play(&this->_sprite,s_Idle,0); - fVar11 = (this->_velocity).x; - FUN_0058e210(); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(in_XMM0)) + 0x0))) != 0.0) { - bVar10 = fVar11 < 0.0; -LAB_006185e8: - (this->_sprite)._flipX = bVar10; - } - } - else { - bVar2 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("Float")); - if (bVar2 == 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Float"),0); - } - } - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - if (isLilithIncubus != 0) { - this->_fireCooldown = 0; - } - if (((local_24 != GHIDRA_CAST(0xffffffff)) && (iVar6 = this->_variant, iVar6 != 0xd5)) && - (iVar6 != 0xd6)) { - if (iVar6 != 0x82) { - (this->_sprite)._flipX = local_24 == GHIDRA_CAST(0x0); - } - isNoOtherCharging = '\x01'; - if (iVar6 == 0x3b) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(entityList),3,0x3b,-1,1 - ,0); - uVar4 = 0; - local_8 = 5; - if (puStack_4c != GHIDRA_CAST(0x0)) { - do { - iVar6 = __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(entityList)) + 0x4))) + uVar4 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - if (((*GHIDRA_CAST((iVar6 + 0x172)) != '\0') && (*GHIDRA_CAST((iVar6 + 0xd4c)) < 0)) && - (*GHIDRA_CAST((iVar6 + 0x30)) == 0)) { - isNoOtherCharging = '\0'; - break; - } - uVar4 = uVar4 + 1; - } while (uVar4 < puStack_4c); - } - if (entityList[0] == '\0') { - local_8 = 6; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)entityList)) + 0x4))),0); - } - local_8 = 0xffffffff; - } - if (this->_variant == 0xe8) { - if (((this->_targetPosition).x == g_vectorZero.x) && - ((this->_targetPosition).y == g_vectorZero.y)) { - isFiring = '\0'; - } - else { - if (0 < this->_fireCooldown) goto LAB_00618988; - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - isFiring = '\x01'; - } - } - else { - isFiring = isNoOtherCharging; - } - if ((this->_fireCooldown < 1) && (isFiring != '\0')) { - iVar6 = this->_variant; - local_30 = GHIDRA_CAST(0x41200000); - if (iVar6 == 0x68) { - local_30 = GHIDRA_CAST(0x40400000); - } - else if (iVar6 == 0xdf) { - local_30 = GHIDRA_CAST(0x41880000); - } - this->_fireCooldown = -1; - if (isLilithIncubus == 0) { - if ((iVar6 == 0x82) || (iVar9 = 4, iVar6 == 0xdf)) { - iVar9 = 3; - } - } - else { - iVar9 = 0; - } - this->_entityGridCollisionClass = iVar9; - pVVar3 = &this->_velocity; - pvVar1 = this->_player; - velocityX = local_1c.x * (float)local_30; - pVVar3->x = velocityX; - (this->_velocity).y = local_1c.y * (float)local_30; - fVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x360)); - fVar12 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x364)); - if ((local_24 == GHIDRA_CAST(0x0)) || (local_24 == GHIDRA_CAST(0x2))) { - fVar11 = 0.0; - } - else { - fVar12 = 0.0; - } - if (this->_variant == 0x68) { - fVar12 = fVar12 * 0.2; - velocityX = fVar11 * 0.2 + fVar11 * 0.2 + velocityX; - pVVar3->x = velocityX; - } - else { - fVar12 = fVar12 * 0.6; - velocityX = fVar11 * 0.6 + fVar11 * 0.6 + velocityX; - pVVar3->x = velocityX; - } - fVar11 = fVar12 + fVar12 + local_1c.y * (float)local_30; - (this->_velocity).y = fVar11; - if (fVar11 * fVar11 + velocityX * velocityX < (float)local_30 * (float)local_30) { - pVVar7 = (GHIDRA_CAST((pVVar3)))->Vector::Normalized(&scratchVec); - fVar11 = pVVar7->y; - pVVar3->x = (float)local_30 * pVVar7->x; - (this->_velocity).y = (float)local_30 * fVar11; - } - iVar6 = this->_variant; - this->_friction = 1.0; - if (iVar6 == 0x82) { - if (this->_target != 0) { - local_38.y = (float)&this->_target; - msvc::multiset::erase(&local_38.y); - iVar6 = this->_variant; - } - this->_target = 0; - } - manager = g_manager; - if (iVar6 == 0x68) { - local_30 = GHIDRA_CAST(0x343); - seed_fart_sound_override(GHIDRA_CAST(&local_30)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,0x1c2,0,1.0,0.0); - iVar6 = this->_variant; - } - manager = g_manager; - if (iVar6 == 3) { - local_30 = GHIDRA_CAST(0x351); - seed_fart_sound_override(GHIDRA_CAST(&local_30)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,0x1c2,0,1.0,0.0); - } - } - } -LAB_00618988: - iVar6 = 0; - if (this->_variant == 0x82) { - iVar6 = 4; - } - this->_entityCollisionClass = iVar6; - ExceptionList = local_10; - return; -} - -// 00619270 -void Entity_Familiar::ai_auto_shooter() -{ - Vector *pVVar1; - uint64_t qVar2; - uint8_t bVar3; - char isLastRef; - int iVar4; - Entity_Tear *tear; - LayerState *layer; - int *texture; - uint64_t *allocCounter; - uint8_t *anim; - float fVar5; - Entity *pEVar6; - uint32_t uVar7; - TypeDescriptor *pTVar8; - TypeDescriptor *pTVar9; - char *anim_00; - uint32_t uVar10; - EntityList_EL enemyList; - Vector local_24; - Vector local_1c; - Entity *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t blockSize; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6b15; - local_10 = ExceptionList; - ExceptionList = &local_10; - FollowParent(this); - iVar4 = apply_forgotten_lullaby(this,10); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(iVar4,0); - if (bVar3 != 0) { - local_14 = GHIDRA_CAST(0x0); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&enemyList,&this->_pos,150.0,8); - local_8 = 0; - local_1c.y = 0.0; - if ((float)enemyList._size != 0.0) { - do { - pEVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(enemyList)) + 0x4))) + GHIDRA_INT(local_1c.y) * 4)); - bVar3 = (GHIDRA_CAST((pEVar6)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar3 != 0) && - (((GHIDRA_CAST(this->_spawnerEntity) == GHIDRA_CAST(0x0) || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::IsDescendantOf(pEVar6), bVar3 == 0)) && - ((pEVar6->_flags & 0x20000010) == 0)))) { - local_24.y = (pEVar6->_pos).y; - local_24.x = (pEVar6->_pos).x; - bVar3 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&this->_pos,&local_24,3,900,0,0,GHIDRA_CAST(0x0)); - if (bVar3 != 0) { - local_14 = pEVar6; - } - } - local_1c.y = (float)(GHIDRA_INT(local_1c.y) + 1); - } while (GHIDRA_UINT(local_1c.y) < GHIDRA_UINT(enemyList._size)); - if (local_14 != GHIDRA_CAST(0x0)) { - iVar4 = 0; - local_1c.y = (local_14->_pos).x - (this->_pos).x; - local_14 = GHIDRA_CAST(((local_14->_pos).y - (this->_pos).y)); - if (ABS(local_1c.y) <= ABS((float)local_14)) { - iVar4 = GHIDRA_UINT((0.0 < (float)local_14)) * 2 + 1; - } - else if (0.0 < local_1c.y) { - iVar4 = 2; - } - this->_headFrameDelay = 0xc; - PlayShootAnim(this,iVar4); - local_24.y = (float)Random(); - fVar5 = sqrtf(local_1c.y * local_1c.y + (float)local_14 * (float)local_14); - pEVar6 = local_14; - if (0.0 < fVar5) { - local_1c.y = local_1c.y * (1.0 / fVar5); - pEVar6 = GHIDRA_CAST(((float)local_14 * (1.0 / fVar5))); - } - local_1c.x = local_1c.y * 8.0; - local_1c.y = (float)pEVar6 * 8.0; - uVar10 = 0; - pTVar9 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; - pTVar8 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar7 = 0; - pEVar6 = Game::Spawn(g_game,2,1,&this->_pos,&local_1c,GHIDRA_CAST(this),0,GHIDRA_UINT(local_24.y)); - tear = GHIDRA_CAST(__RTDynamicCast(pEVar6,uVar7,pTVar8,pTVar9,uVar10)); - tear->_fallingSpeed = 1.2; - local_24.y = apply_tear_modifiers(this); - fVar5 = apply_tear_modifiers(this); - local_1c.y = fVar5 * 0.35 + 0.55; - tear->SetCollisionDamage(local_24.y * 3.0); - local_24.y = local_1c.y; - local_1c.y = 0.01; - pVVar1 = &local_24; - if (local_24.y <= 0.01) { - pVVar1 = &local_1c; - } - fVar5 = pVVar1->y; - tear->_baseScale = fVar5; - tear->_fScale = fVar5; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - TryFireTear(this,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - } - } - mongo_baby_pick_next_mimic(this); - local_8 = 0xffffffff; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(enemyList)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(enemyList)) + 0x4))) != 0) { - blockSize = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(enemyList)) + 0x4))) + -4)); - qVar2 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - blockSize; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < blockSize)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(enemyList)) + 0x4))) + -4)); - } - local_8 = 0xffffffff; - } - } - if (0 < this->_headFrameDelay) { - this->_headFrameDelay = this->_headFrameDelay + -1; - ExceptionList = local_10; - return; - } - iVar4 = this->_variant; - if (iVar4 != 0x58) { - if (iVar4 == 0xce) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - texture = LayerState::GetTexture(layer,&local_24); - local_8 = 2; - anim = s_Idle2; - if (*GHIDRA_CAST((*texture + 0x10)) < 0x81) { - anim = s_Idle; - } - ANM2::SetAnimation(&this->_sprite,anim,0); - local_8 = 3; - if (((GHIDRA_CAST(local_24.y) != GHIDRA_CAST(0x0)) && - (isLastRef = (**(code **)(*GHIDRA_CAST(local_24.y) + 0xc))(), isLastRef != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(&local_24); - ExceptionList = local_10; - return; - } - } - else { - if (iVar4 == 0xed) { - ANM2::SetAnimation(&this->_sprite,s_Idle,0); - ExceptionList = local_10; - return; - } - if (iVar4 != 0xee) { - (this->_sprite)._flipX = 0; - if (iVar4 == 0x4c) { - anim_00 = "Float"; - } - else if (((iVar4 == 6) || (iVar4 == 0x35)) || - ((iVar4 != 0x6d || (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) == -1)))) { - anim_00 = "FloatDown"; - } - else { - anim_00 = "StoppedDown"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(anim_00),0); - } - } - } - ExceptionList = local_10; - return; -} - -// 0061a240 -void Entity_Familiar::ai_blue_babys_only_friend() -{ - Vector *pVVar1; - float fVar2; - float fVar3; - float fVar4; - Vector local_18; - Vector local_10; - Game *game; - float velX; - - (GHIDRA_CAST((this->_player)))->Entity_Player::GetShootingJoystick(&local_10); - fVar2 = local_10.x; - if (this->_collidesWithGrid != 0) { - (this->_velocity).x = (this->_velocity).x * 0.88; - (this->_velocity).y = (this->_velocity).y * 0.88; - } - fVar4 = 0.0; - if (local_10.x == 0.0) { - if (local_10.y == 0.0) goto LAB_0061a315; -LAB_0061a2e5: - if (local_10.x != 0.0) goto LAB_0061a315; - fVar4 = (this->_velocity).y; - (this->_velocity).x = (this->_velocity).x * 0.5; - } - else { - if (local_10.y != 0.0) goto LAB_0061a2e5; - fVar4 = (this->_velocity).x; - (this->_velocity).y = (this->_velocity).y * 0.5; - } - fVar4 = ABS(fVar4); -LAB_0061a315: - game = g_game; - fVar3 = (this->_velocity).y; - velX = (this->_velocity).x; - local_18.x = 0.0; - local_10.x = -(fVar3 * local_10.y + velX * local_10.x) * 0.2; - pVVar1 = &local_10; - if (local_10.x <= 0.0) { - pVVar1 = &local_18; - } - fVar4 = (fVar4 * 0.3 * 0.1 + pVVar1->x + 3.0) * 0.8; - (this->_velocity).y = (fVar4 * local_10.y + fVar3) * 0.775; - (this->_velocity).x = (fVar4 * fVar2 + velX) * 0.775; - Room::GetClampedPositionImpl(game->_room,&local_18,&this->_pos,0.0,0.0,0.0,0.0); - local_10.x = local_18.x - (this->_pos).x; - local_18.x = local_18.y - (this->_pos).y; - if ((local_10.x != g_vectorZero.x) || (local_18.x != g_vectorZero.y)) { - fVar2 = sqrtf(local_18.x * local_18.x + local_10.x * local_10.x); - if (0.0 < fVar2) { - local_10.x = local_10.x * (1.0 / fVar2); - local_18.x = local_18.x * (1.0 / fVar2); - } - fVar2 = (this->_velocity).x; - fVar4 = this->_speedMultiplier; - fVar3 = -(local_18.x * (this->_velocity).y + fVar2 * local_10.x); - if (fVar3 <= 1.0) { - fVar3 = 1.0; - } - if (10.0 <= fVar3) { - fVar3 = 10.0; - } - (this->_velocity).x = local_10.x * fVar3 * fVar4 + fVar2; - (this->_velocity).y = local_18.x * fVar3 * fVar4 + (this->_velocity).y; - } - return; -} - -// 0061a4e0 -void Entity_Familiar::ai_pickup_sack() -{ - uint32_t *puVar1; - void **ppvVar2; - code *pcVar3; - Vector targetPos; - uint8_t bVar4; - Entity *pEVar5; - uint8_t *curAnimName; - uint32_t uVar6; - int *piVar7; - Entity *shot; - int spawnsLeft; - int iVar8; - uint32_t variantRoll; - uint8_t *curAnimNameChar; - char *targetAnimNameChar; - uint8_t *spawnAnimNameChar; - uint64_t *allocatedBytes; - RNG *dropRng; - bool bVar9; - float fVar10; - float fVar11; - int *dirY; - Vector dropPos; - Vector heartPos; - Vector cardPos; - Vector pillPos; - Vector pickupPos; - EntityList_EL familiars; - EntityList_EL nearbyPickups; - Vector dropMidpoint; - Vector heartMidpoint; - Vector cardMidpoint; - Vector pillMidpoint; - Vector spiderMidpoint; - Vector pickupMidpoint; - Vector local_30; - float local_28 [2]; - ItemPool *local_20; - float local_1c; - int *local_18; - int *local_14; - void *local_10; - uint8_t *puStack_c; - float local_8; - Game *game; - Manager *manager; - Entity_Familiar *otherFamiliar; - uint64_t prevAllocatedBytes; - int target; - - local_8 = -NAN; - puStack_c = &LAB_00af6b95; - local_10 = ExceptionList; - ExceptionList = &local_10; - target = this->_target; - puVar1 = &this->_target; - if ((target == 0) || (*GHIDRA_CAST((target + 0x173)) != '\0')) { - local_18 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_14 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - local_1c = 80.0; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,1,0); - local_8 = 0.0; - uVar6 = 0; - if (familiars._size != 0) { - do { - otherFamiliar = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + uVar6 * 4)); - if (otherFamiliar->_exists != 0) { - target = otherFamiliar->_variant; - if ((((target == 0x18) || (target == 0x40)) || (target == 0x5a)) || - ((target == 0x66 || (target == 0x58)))) { - if (otherFamiliar == this) break; - local_18 = GHIDRA_CAST((otherFamiliar->_pos).x); - local_14 = GHIDRA_CAST((otherFamiliar->_pos).y); - local_1c = 50.0; - } - else if (otherFamiliar == this) break; - } - uVar6 = uVar6 + 1; - } while (uVar6 < GHIDRA_UINT(familiars._size)); - } - local_28[0] = (this->_pos).y; - local_14 = GHIDRA_CAST(((float)local_14 - local_28[0])); - local_18 = GHIDRA_CAST(((float)local_18 - (this->_pos).x)); - local_28[0] = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - local_28[0]; - local_30.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; - local_20 = (ItemPool *) - sqrtf((float)local_14 * (float)local_14 + (float)local_18 * (float)local_18); - fVar11 = sqrtf(local_28[0] * local_28[0] + local_30.y * local_30.y); - if (80.0 <= fVar11) { - if (local_1c < (float)local_20) { - (this->_velocity).x = ((float)local_18 / (float)local_20) * 0.8 + (this->_velocity).x; - (this->_velocity).y = ((float)local_14 / (float)local_20) * 0.8 + (this->_velocity).y; - } - } - else if ((((5 < this->_coins) || (2 < this->_hearts)) || (this->_state < this->_keys)) && - (((this->_sprite)._animState._animData != (void *)0x0 && - ((this->_sprite)._animState._isPlaying != 0)))) { - curAnimName = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { - curAnimName = *GHIDRA_CAST(curAnimName); - } - targetAnimNameChar = "FloatDown"; - do { - bVar4 = *curAnimName; - bVar9 = bVar4 < (uint8_t)*targetAnimNameChar; - if (bVar4 != *targetAnimNameChar) { -LAB_0061a861: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_0061a866; - } - if (bVar4 == 0) break; - bVar4 = curAnimName[1]; - bVar9 = bVar4 < (uint8_t)targetAnimNameChar[1]; - if (bVar4 != targetAnimNameChar[1]) goto LAB_0061a861; - curAnimName = curAnimName + 2; - targetAnimNameChar = targetAnimNameChar + 2; - } while (bVar4 != 0); - uVar6 = 0; -LAB_0061a866: - if ((uVar6 == 0) && - (bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("PreSpawn"),1), bVar4 != 0)) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - local_8 = -NAN; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) != 0) { - uVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar6; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar6)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4))); - } - local_8 = -NAN; - } -LAB_0061a925: - this->_friction = this->_friction * 0.8; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(5,0); - if (bVar4 != 0) goto LAB_0061a950; - } - else { - local_18 = GHIDRA_CAST((*GHIDRA_CAST((target + 0x340)) - (this->_pos).y)); - local_14 = GHIDRA_CAST((*GHIDRA_CAST((target + 0x33c)) - (this->_pos).x)); - fVar11 = (float)local_18 * (float)local_18 + (float)local_14 * (float)local_14; - if (100.0 <= fVar11) { - fVar11 = sqrtf(fVar11); - piVar7 = local_14; - dirY = local_18; - if (0.0 < fVar11) { - dirY = GHIDRA_CAST(((float)local_18 * (1.0 / fVar11))); - piVar7 = GHIDRA_CAST(((float)local_14 * (1.0 / fVar11))); - } - (this->_velocity).x = (float)piVar7 * 1.1 + (this->_velocity).x; - (this->_velocity).y = (float)dirY * 1.1 + (this->_velocity).y; - goto LAB_0061a925; - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::collide_with_entity(__security_cookie ^ GHIDRA_UINT((local_28 + 9))); - pEVar5 = GHIDRA_CAST(*puVar1); - if (pEVar5->_dead == 0) { - if ((((pEVar5 != GHIDRA_CAST(0x0)) && (pEVar5->_type == 5)) && (pEVar5->_variant == 0x14)) && - (pEVar5->_subtype == 6)) { - uVar6 = (GHIDRA_CAST((pEVar5)))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(&this->_hitList,uVar6); - if (*puVar1 != 0) { - local_18 = puVar1; - msvc::multiset::erase(&local_18); - } - *puVar1 = 0; - } - goto LAB_0061a925; - } - if (pEVar5 != GHIDRA_CAST(0x0)) { - local_14 = puVar1; - msvc::multiset::erase(&local_14); - } - *puVar1 = 0; - this->_friction = this->_friction * 0.8; -LAB_0061a950: - if (this->_target == 0) { - local_1c = 40000.0; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&nearbyPickups,&this->_pos,200.0,0x10); - local_8 = 2.8026e-45; - local_14 = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(nearbyPickups._size) != GHIDRA_CAST(0x0)) { - do { - target = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyPickups)) + 0x4))) + GHIDRA_INT(local_14) * 4)); - if (*GHIDRA_CAST((target + 0x28)) == 5) { - pEVar5 = (Entity *) - __RTDynamicCast(target,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor,0); - target = this->_variant; - if (((((target == 0x18) || (target == 0x66)) && (pEVar5->_variant == 0x14)) || - (((((target == 0x40 || (target == 0x66)) && (pEVar5->_variant == 10)) && - ((((iVar8 = pEVar5->_subtype, iVar8 == 1 || (iVar8 == 2)) || (iVar8 == 5)) || - (iVar8 == 9)))) || - (((target == 0x5a || (target == 0x66)) && - ((pEVar5->_variant == 0x1e && (pEVar5->_subtype != 2)))))))) && - (((pEVar5->_dead == 0 && (pEVar5[1]._sprite._championColor._tint[2] == 0.0)) && - (((bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_hitList))))->EntityList::HitListContains(pEVar5), - bVar4 == 0 || ((pEVar5->_variant == 0x14 && (pEVar5->_subtype == 2)))) && - (fVar11 = (pEVar5->_pos).x - (this->_pos).x, - fVar10 = (pEVar5->_pos).y - (this->_pos).y, - local_30.y = fVar10 * fVar10 + fVar11 * fVar11, local_30.y < local_1c)))))) { - puVar1 = &this->_target; - if (this->_target != 0) { - local_20 = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&local_20); - } - *puVar1 = pEVar5; - msvc::multiset::insert(puVar1); - local_1c = local_30.y; - } - } - local_14 = GHIDRA_CAST((GHIDRA_INT(local_14) + 1)); - } while (local_14 < GHIDRA_UINT(nearbyPickups._size)); - } - local_8 = -NAN; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyPickups)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyPickups)) + 0x4))) != 0) { - uVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyPickups)) + 0x4))) + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar6; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar6)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyPickups)) + 0x4))) + -4)); - } - local_8 = -NAN; - } - } - } - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying != 0)) { -LAB_0061b7e0: - curAnimName = (this->_sprite)._animState._animData; - if ((curAnimName != GHIDRA_CAST(0x0)) && ((this->_sprite)._animState._isPlaying == 0)) { - curAnimNameChar = curAnimName; - if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { - curAnimNameChar = *GHIDRA_CAST(curAnimName); - } - spawnAnimNameChar = s_Spawn; - do { - bVar4 = *curAnimNameChar; - bVar9 = bVar4 < *spawnAnimNameChar; - if (bVar4 != *spawnAnimNameChar) { -LAB_0061b827: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_0061b82c; - } - if (bVar4 == 0) break; - bVar4 = curAnimNameChar[1]; - bVar9 = bVar4 < spawnAnimNameChar[1]; - if (bVar4 != spawnAnimNameChar[1]) goto LAB_0061b827; - curAnimNameChar = curAnimNameChar + 2; - spawnAnimNameChar = spawnAnimNameChar + 2; - } while (bVar4 != 0); - uVar6 = 0; -LAB_0061b82c: - if (uVar6 == 0) { - curAnimNameChar = curAnimName; - if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { - curAnimNameChar = *GHIDRA_CAST(curAnimName); - } - targetAnimNameChar = "FloatDown"; - do { - bVar4 = *curAnimNameChar; - bVar9 = bVar4 < (uint8_t)*targetAnimNameChar; - if (bVar4 != *targetAnimNameChar) { -LAB_0061b860: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_0061b865; - } - if (bVar4 == 0) break; - bVar4 = curAnimNameChar[1]; - bVar9 = bVar4 < (uint8_t)targetAnimNameChar[1]; - if (bVar4 != targetAnimNameChar[1]) goto LAB_0061b860; - curAnimNameChar = curAnimNameChar + 2; - targetAnimNameChar = targetAnimNameChar + 2; - } while (bVar4 != 0); - uVar6 = 0; -LAB_0061b865: - if (((uVar6 != 0) || (curAnimName[0x34] != 0)) && - (bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("FloatDown"),1), bVar4 != 0)) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - } - ExceptionList = local_10; - return; - } - curAnimName = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { - curAnimName = *GHIDRA_CAST(curAnimName); - } - targetAnimNameChar = "PreSpawn"; - do { - bVar4 = *curAnimName; - bVar9 = bVar4 < (uint8_t)*targetAnimNameChar; - if (bVar4 != *targetAnimNameChar) { -LAB_0061ab77: - uVar6 = -GHIDRA_UINT(bVar9) | 1; - goto LAB_0061ab7c; - } - if (bVar4 == 0) break; - bVar4 = curAnimName[1]; - bVar9 = bVar4 < (uint8_t)targetAnimNameChar[1]; - if (bVar4 != targetAnimNameChar[1]) goto LAB_0061ab77; - curAnimName = curAnimName + 2; - targetAnimNameChar = targetAnimNameChar + 2; - } while (bVar4 != 0); - uVar6 = 0; -LAB_0061ab7c: - if (uVar6 != 0) goto LAB_0061b7e0; - bVar4 = ANM2::SetAnimation(&this->_sprite,s_Spawn,1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - local_28[0] = 0.0; - target = this->_variant; - if (target == 0x66) { - if (this->_coins < 6) { - if (this->_hearts < 3) goto LAB_0061b57f; - goto LAB_0061b0d0; - } - } - else if (target != 0x18) { - if (target != 0x40) { - if (target != 0x5a) { - ExceptionList = local_10; - return; - } -LAB_0061b57f: - bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - uVar6 = (this->_dropRNG)._seed; - if (bVar4 == 0) { - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - (this->_dropRNG)._seed = uVar6; - iVar8 = this->_keys + -4; - target = 0; - if (0 < iVar8) { - target = iVar8; - } - uVar6 = uVar6 & 3; - } - else { - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - (this->_dropRNG)._seed = uVar6; - iVar8 = this->_keys + -3; - target = 0; - if (0 < iVar8) { - target = iVar8; - } - uVar6 = uVar6 % 3; - } - this->_state = uVar6 + 2; - this->_keys = target; - target = (this->_variant == 0x66) + 1; - while( true ) { - dropMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; - dropMidpoint.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5 + (this->_pos).y * 0.5; - Room::FindFreePickupSpawnPosition(g_game->_room,&dropPos,&dropMidpoint,0.0,0,0,0); - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - (this->_dropRNG)._seed = uVar6; - variantRoll = uVar6; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - variantRoll = (this->_dropRNG)._seed; - } - if (variantRoll == 0) break; - variantRoll = variantRoll >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ variantRoll; - variantRoll = variantRoll << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ variantRoll; - variantRoll = variantRoll >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ variantRoll; - (this->_dropRNG)._seed = variantRoll; - Game::Spawn(g_game,5,*GHIDRA_CAST((&DAT_00b62fd0 + (variantRoll % 3) * 4)),&dropPos,&g_vectorZero - ,GHIDRA_CAST(0x0),0,uVar6); - target = target + -1; - if (target == 0) { - ExceptionList = local_10; - return; - } - } - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } -LAB_0061b0d0: - this->_hearts = this->_hearts + -3; - dropRng = &this->_dropRNG; - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - if ((uVar6 % 10 == 0) && - (bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0), bVar4 == 0)) { - this->_hearts = this->_hearts + -1; - } - manager = g_manager; - local_28[0] = 1.19531e-42; - seed_fart_sound_override(GHIDRA_CAST(local_28)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_28[0]),1.0,2,0,1.0,0.0); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - local_20 = GHIDRA_CAST((uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f))); - uVar6 = GHIDRA_UINT(local_20) ^ uVar6; - dropRng->_seed = uVar6; - uVar6 = uVar6 % 5; - if (uVar6 != 0) { - if (uVar6 == 1) { - pillMidpoint.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5 + (this->_pos).x * 0.5; - pillMidpoint.y = (this->_pos).y * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5; - Room::FindFreePickupSpawnPosition(g_game->_room,&pillPos,&pillMidpoint,0.0,0,0,0); - uVar6 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Game::Spawn(g_game,5,0x46,&pillPos,&g_vectorZero,GHIDRA_CAST(this),0,uVar6); - ExceptionList = local_10; - return; - } - if (uVar6 == 2) { - cardMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; - cardMidpoint.y = (this->_pos).y * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5; - Room::FindFreePickupSpawnPosition(g_game->_room,&cardPos,&cardMidpoint,0.0,0,0,0); - uVar6 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Game::Spawn(g_game,5,300,&cardPos,&g_vectorZero,GHIDRA_CAST(this),0,uVar6); - ExceptionList = local_10; - return; - } - spawnsLeft = (this->_variant == 0x66) + 1; - local_20 = GHIDRA_CAST(spawnsLeft); - do { - heartMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; - heartMidpoint.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5 + (this->_pos).y * 0.5; - Room::FindFreePickupSpawnPosition(g_game->_room,&heartPos,&heartMidpoint,0.0,0,0,0); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - game = g_game; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - Game::Spawn(game,5,10,&heartPos,&g_vectorZero,GHIDRA_CAST(this),6,uVar6); - spawnsLeft = spawnsLeft + -1; - } while (spawnsLeft != 0); - ExceptionList = local_10; - return; - } - spiderMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; - spiderMidpoint.y = (this->_pos).y * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5; - Room::FindFreePickupSpawnPosition(g_game->_room,&local_30,&spiderMidpoint,0.0,0,0,0); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - if ((uVar6 & 1) == 0) { - pEVar5 = this->_player; - ppvVar2 = &pEVar5[4]._config; - *ppvVar2 = (void *)(GHIDRA_INT(*ppvVar2) + 1); - spawn_blue_spider(&local_30,pEVar5,&g_vectorZero); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(shot); - ExceptionList = local_10; - return; - } - targetPos.y = local_30.y; - targetPos.x = local_30.x; - Entity_NPC::ThrowSpider(&this->_pos,GHIDRA_CAST(this),targetPos,0,-30.0); - ExceptionList = local_10; - return; - } - bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar4 == 0) { - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - (this->_dropRNG)._seed = uVar6; - local_18 = GHIDRA_CAST(((uVar6 & 1) + 3)); - } - else { - local_18 = GHIDRA_CAST(0x3); - } - if ((this->_coins < 10) || (this->_subtype != 0)) { -LAB_0061acb1: - uVar6 = (this->_dropRNG)._seed; - dropRng = &this->_dropRNG; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - if (uVar6 != (uVar6 / 100) * 100) { - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - piVar7 = GHIDRA_CAST((uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6)); - dropRng->_seed = GHIDRA_INT(piVar7); - local_14 = piVar7; - if ((GHIDRA_UINT(piVar7) & 1) == 0) { - if (piVar7 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - piVar7 = GHIDRA_CAST(dropRng->_seed); - if (piVar7 == GHIDRA_CAST(0x0)) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = GHIDRA_UINT(piVar7) >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ GHIDRA_UINT(piVar7); - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - local_14 = GHIDRA_CAST((uVar6 % 3)); - piVar7 = local_14; - if (local_14 == GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x16,0); - if ((bVar4 == 0) || (uVar6 = Random(), uVar6 % 5 == 0)) { - piVar7 = local_14; - } - else { - uVar6 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(2); - piVar7 = GHIDRA_CAST((uVar6 + 1)); - } - } - if (piVar7 == GHIDRA_CAST(0x0)) { - fVar11 = 1.4013e-44; - } - else if (piVar7 == GHIDRA_CAST(0x1)) { - fVar11 = 4.2039e-44; - } - else if (piVar7 == GHIDRA_CAST(0x2)) { - fVar11 = 5.60519e-44; - } - else { - fVar11 = 0.0; - } - } - else { - if (piVar7 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - local_14 = GHIDRA_CAST(dropRng->_seed); - if (local_14 == GHIDRA_CAST(0x0)) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = GHIDRA_UINT(local_14) >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ GHIDRA_UINT(local_14); - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - if (uVar6 == (uVar6 / 3) * 3) { - fVar11 = 4.90454e-43; - } - else { - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - switch(uVar6 & 3) { - case 0: - fVar11 = 9.80909e-44; - break; - case 1: - fVar11 = 4.2039e-43; - break; - default: - fVar11 = 1.26117e-43; - } - } - } - goto LAB_0061af9a; - } - } - else { - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = (this->_dropRNG)._seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - (this->_dropRNG)._seed = uVar6; - if (uVar6 != (uVar6 / 3) * 3) goto LAB_0061acb1; - } - local_20 = &g_game->_itemPool; - local_30.y = 1.4013e-43; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = (this->_dropRNG)._seed; - } - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - (this->_dropRNG)._seed = uVar6; - local_28[0] = (float)ItemPool::GetCollectible(local_20,10,uVar6,0,0,0); - manager = g_manager; - local_18 = GHIDRA_CAST(0xa); - this->_subtype = 1; - local_1c = 3.75548e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_1c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c),1.0,2,0,1.0,0.0); - fVar11 = local_30.y; -LAB_0061af9a: - dropRng = &this->_dropRNG; - iVar8 = this->_coins - GHIDRA_INT(local_18); - target = 0; - if (0 < iVar8) { - target = iVar8; - } - this->_coins = target; - local_1c = (float)((this->_variant == 0x66) + 1); - do { - pickupMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; - pickupMidpoint.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5 + (this->_pos).y * 0.5; - Room::FindFreePickupSpawnPosition(g_game->_room,&pickupPos,&pickupMidpoint,0.0,0,0,0); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = dropRng->_seed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - game = g_game; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar6; - dropRng->_seed = uVar6; - Game::Spawn(game,5,GHIDRA_UINT(fVar11),&pickupPos,&g_vectorZero,GHIDRA_CAST(this),GHIDRA_UINT(local_28[0]),uVar6) - ; - local_1c = (float)(GHIDRA_INT(local_1c) + -1); - } while (local_1c != 0.0); - ExceptionList = local_10; - return; -} - -// 0061b8c0 -void Entity_Familiar::ai_flying_bird() -{ - uint8_t bVar1; - int *mapEntry; - uint8_t *curAnimName; - uint32_t uVar2; - char *animName; - uint8_t *idleAnimName; - bool isLess; - float fVar3; - float fVar4; - float acceleration; - float local_44 [2]; - float local_3c; - float friction; - Color color; - uint8_t *animData; - Manager *manager; - int target; - - acceleration = 1.0; - friction = 0.9; - if (this->_variant == 0xd2) { - PickEnemyTarget(this,360.0,0xd,4,&g_vectorZero,15.0); - acceleration = 0.8; - friction = 0.8; -LAB_0061b99b: - if (((this->_variant == 0x3f) && (1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) && - (this->_target != 0)) { - local_3c = *GHIDRA_CAST((this->_target + 0x20)); - mapEntry = GHIDRA_CAST(std)::map::try_emplace(local_44,&local_3c); - if (599 < *GHIDRA_CAST((*mapEntry + 0x14))) { - local_3c = *GHIDRA_CAST((this->_target + 0x20)); - mapEntry = GHIDRA_CAST(std)::map::try_emplace(local_44,&local_3c); - *GHIDRA_CAST((*mapEntry + 0x14)) = 0xfffffc7c; - } - } - } - else { - target = this->_target; - PickEnemyTarget(this,300.0,0xd,0,&g_vectorZero,15.0); - manager = g_manager; - if ((target != 0) || (this->_target == 0)) goto LAB_0061b99b; - if (this->_variant == 0x3f) { - local_44[0] = 1.20372e-42; - seed_fart_sound_override(GHIDRA_CAST(local_44)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44[0]),1.0,0x1c2,0,1.0,0.0); - goto LAB_0061b99b; - } - } - target = this->_target; - if (target == 0) { - local_44[0] = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; - local_3c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; - fVar4 = local_44[0] * local_44[0] + local_3c * local_3c; - if (6400.0 < fVar4) { - fVar4 = sqrtf(fVar4); - if (fVar4 <= 0.0) { - fVar4 = local_3c; - fVar3 = local_44[0]; - } - else { - fVar3 = local_44[0] * (1.0 / fVar4); - fVar4 = (1.0 / fVar4) * local_3c; - } - goto LAB_0061bb14; - } - } - else { - local_44[0] = *GHIDRA_CAST((target + 0x33c)) - (this->_pos).x; - local_3c = *GHIDRA_CAST((target + 0x340)) - (this->_pos).y; - fVar3 = sqrtf(local_44[0] * local_44[0] + local_3c * local_3c); - if (fVar3 <= 0.0) { - fVar4 = local_44[0]; - fVar3 = local_3c; - } - else { - fVar4 = local_44[0] * (1.0 / fVar3); - fVar3 = local_3c * (1.0 / fVar3); - } -LAB_0061bb14: - (this->_velocity).y = fVar3 * acceleration + (this->_velocity).y; - (this->_velocity).x = fVar4 * acceleration + (this->_velocity).x; - } - target = this->_variant; - if ((target == 0xe) || (target == 0xd2)) { - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - animName = "Flying"; - do { - bVar1 = *curAnimName; - isLess = bVar1 < (uint8_t)*animName; - if (bVar1 != *animName) { -LAB_0061bcd3: - uVar2 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0061bcd8; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - isLess = bVar1 < (uint8_t)animName[1]; - if (bVar1 != animName[1]) goto LAB_0061bcd3; - curAnimName = curAnimName + 2; - animName = animName + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_0061bcd8: - if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0061bd0b; - } - animName = "Flying"; - } - else if (target == 0xf) { - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - animName = "FlyingTransparent"; - do { - bVar1 = *curAnimName; - isLess = bVar1 < (uint8_t)*animName; - if (bVar1 != *animName) { -LAB_0061bb92: - uVar2 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0061bb97; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - isLess = bVar1 < (uint8_t)animName[1]; - if (bVar1 != animName[1]) goto LAB_0061bb92; - curAnimName = curAnimName + 2; - animName = animName + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_0061bb97: - if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0061bd0b; - } - animName = "FlyingTransparent"; - } - else { - if (target != 0x3c) { - if (target == 0x3f) { - animName = "FloatChase"; - if (this->_target == 0) { - animName = "Float"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(animName),0); - (GHIDRA_CAST((&color)))->Color::operator_assign(&(this->_sprite)._color); - if (this->_target == 0) { - fVar4 = 0.5; - } - else { - fVar4 = 1.0; - } - color._tint[3] = (fVar4 - color._tint[3]) * 0.15 + color._tint[3]; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&color)); - } - goto LAB_0061bd0b; - } - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - idleAnimName = s_Idle; - do { - bVar1 = *curAnimName; - isLess = bVar1 < *idleAnimName; - if (bVar1 != *idleAnimName) { -LAB_0061bbf7: - uVar2 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0061bbfc; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - isLess = bVar1 < idleAnimName[1]; - if (bVar1 != idleAnimName[1]) goto LAB_0061bbf7; - curAnimName = curAnimName + 2; - idleAnimName = idleAnimName + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_0061bbfc: - if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0061bd0b; - } - animName = GHIDRA_CAST(s_Idle); - } - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(animName),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_0061bd0b: - fVar4 = (this->_velocity).x; - fVar3 = (this->_velocity).y; - (this->_sprite)._flipX = 0.0 < fVar4; - (this->_velocity).x = fVar4 * friction; - (this->_velocity).y = friction * fVar3; - return; -} - -// 0061bd50 -void Entity_Familiar::ai_daddy_longlegs() -{ - uint8_t bVar1; - uint8_t *pbVar2; - uint32_t uVar3; - uint32_t rngResult; - char *anim; - uint8_t *pbVar4; - uint8_t *idleName; - bool bVar5; - float fVar6; - float fVar7; - float toTargetX; - float toTargetY; - float fVar8; - float chaseDirX; - double dVar9; - int target; - - if (this->_fireCooldown == 0) { - PickEnemyTarget(this,365.0,0xd,0,&g_vectorZero,15.0); - target = this->_target; - if (target != 0) { - toTargetX = *GHIDRA_CAST((target + 0x33c)) - (this->_pos).x; - toTargetY = *GHIDRA_CAST((target + 0x340)) - (this->_pos).y; - fVar7 = (this->_velocity).x; - chaseDirX = (*GHIDRA_CAST((target + 0x360)) * 5.0 - fVar7 * 5.0) + toTargetX; - fVar8 = (*GHIDRA_CAST((target + 0x364)) * 5.0 - (this->_velocity).y * 5.0) + toTargetY; - fVar6 = sqrtf(chaseDirX * chaseDirX + fVar8 * fVar8); - if (0.0 < fVar6) { - chaseDirX = chaseDirX * (1.0 / fVar6); - fVar8 = fVar8 * (1.0 / fVar6); - } - (this->_velocity).y = fVar8 + (this->_velocity).y; - (this->_velocity).x = fVar7 + chaseDirX; - if (((toTargetY * toTargetY + toTargetX * toTargetX < 900.0) && - ((this->_sprite)._animState._animData != (void *)0x0)) && - ((this->_sprite)._animState._isPlaying != 0)) { - pbVar2 = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { - pbVar2 = *GHIDRA_CAST(pbVar2); - } - pbVar4 = s_Idle; - do { - bVar1 = *pbVar2; - bVar5 = bVar1 < *pbVar4; - if (bVar1 != *pbVar4) { -LAB_0061bee3: - uVar3 = -GHIDRA_UINT(bVar5) | 1; - goto LAB_0061bee8; - } - if (bVar1 == 0) break; - bVar1 = pbVar2[1]; - bVar5 = bVar1 < pbVar4[1]; - if (bVar1 != pbVar4[1]) goto LAB_0061bee3; - pbVar2 = pbVar2 + 2; - pbVar4 = pbVar4 + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_0061bee8: - if (uVar3 == 0) { - rngResult = Random(); - anim = "StompArm"; - if ((rngResult & 1) == 0) { - anim = "StompLeg"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(anim),(uint8_t)uVar3); - uVar3 = Random(); - (this->_sprite)._flipX = ~(uint8_t)uVar3 & 1; - } - } - } - } - if ((this->_target == 0) || (this->_fireCooldown - 1U < 0x62)) { - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; - fVar6 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; - fVar8 = fVar7 * fVar7 + fVar6 * fVar6; - if (6400.0 < fVar8) { - fVar8 = sqrtf(fVar8); - if (0.0 < fVar8) { - fVar6 = fVar6 * (1.0 / fVar8); - fVar7 = fVar7 * (1.0 / fVar8); - } - (this->_velocity).x = fVar6 + (this->_velocity).x; - (this->_velocity).y = fVar7 + (this->_velocity).y; - } - } - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - pbVar2 = (this->_sprite)._animState._animData; - if (pbVar2 != GHIDRA_CAST(0x0)) { - pbVar4 = pbVar2; - if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { - pbVar4 = *GHIDRA_CAST(pbVar2); - } - idleName = s_Idle; - do { - bVar1 = *pbVar4; - bVar5 = bVar1 < *idleName; - if (bVar1 != *idleName) { -LAB_0061c020: - uVar3 = -GHIDRA_UINT(bVar5) | 1; - goto LAB_0061c025; - } - if (bVar1 == 0) break; - bVar1 = pbVar4[1]; - bVar5 = bVar1 < idleName[1]; - if (bVar1 != idleName[1]) goto LAB_0061c020; - pbVar4 = pbVar4 + 2; - idleName = idleName + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_0061c025: - if ((uVar3 == 0) && ((pbVar2[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0061c058; - } - bVar1 = ANM2::SetAnimation(&this->_sprite,s_Idle,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } -LAB_0061c058: - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - if ((this->_sprite)._animState._animData != (void *)0x0) { - dVar9 = floor((double)(this->_sprite)._animState._animFrame); - if ((9 < GHIDRA_INT(dVar9)) && (GHIDRA_INT(dVar9) < 0x20)) { - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || - (target = ANM2::GetFrame(&this->_sprite), target < 0x11)) { - target = 3; - } - else { - target = 0; - } - this->_entityCollisionClass = target; - fVar7 = (this->_velocity).x; - this->_fireCooldown = 100; - (this->_velocity).x = fVar7 * 0.5; - (this->_velocity).y = (this->_velocity).y * 0.5; - return; - } - } - fVar7 = (this->_velocity).x; - this->_entityCollisionClass = 0; - (this->_velocity).x = fVar7 * 0.9; - (this->_velocity).y = (this->_velocity).y * 0.9; - return; -} - -// 0061c150 -void Entity_Familiar::ai_orbital_variant_50() -{ - int *damageEntry; - Vector *orbitPos; - float fVar1; - float speedScale; - Vector local_18; - Vector local_10; - int target; - - if (this->_subtype == 1) { - PickEnemyTarget(this,200.0,0xd,0,&g_vectorZero,15.0); - } - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_target != 0)) { - local_18.x = *GHIDRA_CAST((this->_target + 0x20)); - damageEntry = GHIDRA_CAST(std)::map::try_emplace(&local_10,&local_18); - if (599 < *GHIDRA_CAST((*damageEntry + 0x14))) { - local_18.x = *GHIDRA_CAST((this->_target + 0x20)); - damageEntry = GHIDRA_CAST(std)::map::try_emplace(&local_10,&local_18); - *GHIDRA_CAST((*damageEntry + 0x14)) = 0xfffffb50; - } - } - target = this->_target; - if (target == 0) { - if (this->_orbitLayer == -1) { - this->_orbitLayer = 1; - fVar1 = DAT_00c34148; - (this->_orbitDistance).x = DAT_00c34144; - (this->_orbitDistance).y = fVar1; - RecalculateOrbitOffset(this,1,1); - } - local_10.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_10.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - orbitPos = GetOrbitPosition(this,&local_18,&local_10); - local_18.x = orbitPos->x; - (this->_targetPosition).x = local_18.x; - local_10.x = orbitPos->y; - (this->_targetPosition).y = local_10.x; - local_10.x = local_10.x - (this->_pos).y; - local_18.x = local_18.x - (this->_pos).x; - fVar1 = sqrtf(local_10.x * local_10.x + local_18.x * local_18.x); - if (fVar1 < 20.0) { - (this->_velocity).x = local_18.x * 0.9; - (this->_velocity).y = local_10.x * 0.9; - } - } - else { - local_10.x = *GHIDRA_CAST((target + 0x33c)); - fVar1 = *GHIDRA_CAST((target + 0x340)); - (this->_targetPosition).x = local_10.x; - (this->_targetPosition).y = fVar1; - if (this->_orbitLayer < 0) goto LAB_0061c32f; - RecalculateOrbitOffset(this,this->_orbitLayer,0); - this->_orbitLayer = -1; - } - local_10.x = (this->_targetPosition).x; -LAB_0061c32f: - local_18.x = (this->_targetPosition).y - (this->_pos).y; - local_10.x = local_10.x - (this->_pos).x; - fVar1 = sqrtf(local_18.x * local_18.x + local_10.x * local_10.x); - if (fVar1 < 0.1) { - speedScale = 0.0; - } - else { - speedScale = fVar1 * 0.15; - if (2.0 <= speedScale) { - speedScale = 2.0; - } - speedScale = speedScale / fVar1; - } - (this->_velocity).x = local_10.x * speedScale + (this->_velocity).x; - (this->_velocity).y = local_18.x * speedScale + (this->_velocity).y; - this->_friction = this->_friction * 0.8; - return; -} - -// 0061d6b0 -void Entity_Familiar::ai_key_full() -{ - uint32_t *puVar1; - GridEntity_Door *this_00; - int iVar2; - uint64_t qVar3; - uint8_t bVar4; - uint32_t uVar5; - LayerState *pLVar6; - uint8_t *pbVar7; - uint8_t *pbVar8; - Entity_Player *keyPieceOwner; - char *floatNameChar; - bool isLess; - float distY; - float local_18; - float doorTargetY; - Vector followTarget; - Game *game; - Manager *manager; - - if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) != 0) { - uVar5 = 0; - do { - this_00 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar5 * 4 + 0x724)); - if ((this_00 != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))) == 5)) { - if (this->_isFollower != 0) { - RemoveFromFollowers(this); - } - pbVar8 = (this->_sprite)._animState._animData; - if (pbVar8 == GHIDRA_CAST(0x0)) goto LAB_0061d7bc; - if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { - pbVar8 = *GHIDRA_CAST(pbVar8); - } - pbVar7 = s_Idle; - goto LAB_0061d784; - } - uVar5 = uVar5 + 1; - } while (uVar5 < 8); - } - if (this->_isFollower == 0) { - AddToFollowers(this); - } - pLVar6 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - pLVar6->_rotation = 0.0; - pbVar8 = (this->_sprite)._animState._animData; - if (pbVar8 != GHIDRA_CAST(0x0)) { - pbVar7 = pbVar8; - if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { - pbVar7 = *GHIDRA_CAST(pbVar8); - } - floatNameChar = "Float"; - do { - bVar4 = *pbVar7; - isLess = bVar4 < (uint8_t)*floatNameChar; - if (bVar4 != *floatNameChar) { -LAB_0061d9bd: - uVar5 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0061d9c2; - } - if (bVar4 == 0) break; - bVar4 = pbVar7[1]; - isLess = bVar4 < (uint8_t)floatNameChar[1]; - if (bVar4 != floatNameChar[1]) goto LAB_0061d9bd; - pbVar7 = pbVar7 + 2; - floatNameChar = floatNameChar + 2; - } while (bVar4 != 0); - uVar5 = 0; -LAB_0061d9c2: - if ((uVar5 == 0) && ((pbVar8[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0061d9f5; - } - bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Float"),1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_0061d9f5: - FollowParent(this); - return; - while( true ) { - bVar4 = pbVar8[1]; - isLess = bVar4 < pbVar7[1]; - if (bVar4 != pbVar7[1]) goto LAB_0061d7a4; - pbVar8 = pbVar8 + 2; - pbVar7 = pbVar7 + 2; - if (bVar4 == 0) break; -LAB_0061d784: - bVar4 = *pbVar8; - isLess = bVar4 < *pbVar7; - if (bVar4 != *pbVar7) { -LAB_0061d7a4: - uVar5 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0061d7a9; - } - if (bVar4 == 0) break; - } - uVar5 = 0; -LAB_0061d7a9: - if ((uVar5 != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && - ((this->_sprite)._animState._isPlaying == 0)))) { -LAB_0061d7bc: - bVar4 = ANM2::SetAnimation(&this->_sprite,s_Idle,1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - local_18 = ((float)(this_00->_gridIndex % iVar2) * 40.0 + 40.0) - 13.846154; - doorTargetY = ((float)(this_00->_gridIndex / iVar2) * 40.0 + 120.0) - 7.692308; - followTarget.x = local_18; - followTarget.y = doorTargetY; - FollowPosition(this,&followTarget); - pLVar6 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - manager = g_manager; - if (pLVar6->_rotation < 90.0) { - local_18 = pLVar6->_rotation + 2.0; - if (90.0 <= local_18) { - local_18 = 90.0; - } - pLVar6 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - pLVar6->_rotation = local_18; - return; - } - local_18 = (this->_pos).x - local_18; - distY = (this->_pos).y - doorTargetY; - if (9.0 <= distY * distY + local_18 * local_18) { - return; - } - local_18 = 2.85865e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_18)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18),1.0,2,0,1.0,0.0); - game = g_game; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))) != 4) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))) == 5) { - qVar3 = g_game->_gameStateFlags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)); - *puVar1 = *puVar1 | 0x20000; - *GHIDRA_CAST(&game->_gameStateFlags) = GHIDRA_INT(qVar3); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))) = 8; - (GHIDRA_CAST((this_00)))->GridEntity_Door::UpdateAnimation(); - } - (GHIDRA_CAST((this_00)))->GridEntity_Door::Open(); - this->Remove(); - keyPieceOwner = - PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xee,GHIDRA_CAST(&g_game->_playerManager),0); - if (keyPieceOwner != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((keyPieceOwner)))->Entity_Player::RemoveCollectible(0xee,0,0,1); - } - keyPieceOwner = - PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xef,GHIDRA_CAST(&g_game->_playerManager),0); - if (keyPieceOwner == GHIDRA_CAST(0x0)) { - return; - } - (GHIDRA_CAST((keyPieceOwner)))->Entity_Player::RemoveCollectible(0xef,0,0,1); - return; -} - -// 0061da10 -void Entity_Familiar::Update() -{ - ColorMod color; - BitSet128 flags; - uint8_t bVar1; - char cVar2; - void *pvVar3; - int *otherFamiliar; - uint32_t uVar4; - RNG *rng; - ColorMod *fartColor; - ItemOverlay *itemOverlay; - Entity_Effect *effect; - KColor *spriteColor; - Entity_Laser *techLaser; - TearParams *pTVar5; - BitSet128 *scratchFlags; - uint32_t uVar6; - Entity_Bomb *bomb; - LayerState *layer; - EntityRef *sourceRef; - SoundEffects *sfx; - Entity_Tear *tear; - Entity_Player *listSize; - AnimationState *animState; - Entity_Familiar *local_EAX_25497; - char *animName; - EntityList *entityList; - uint32_t *puVar7; - TemporaryEffects *playerEffects; - int iVar8; - Vector *scratchVec2; - Vector *scratchVec; - Room *room; - GridEntity *gridEntity; - Vector *pVVar9; - float *pfVar10; - Game *game; - Entity *followTarget; - int *piVar11; - uint8_t *nextIndex; - code *virtualFn; - Entity_Player *sourceRef; - bool isEveryFourthState; - long double floatResult; - Entity_Familiar *in_XMM0_Da; - float fallVelocity; - float fVar13; - uint64_t projectileFlags; - uint32_t in_stack_fffffd0c; - uint32_t in_stack_fffffd10; - uint32_t in_stack_fffffd14; - uint32_t in_stack_fffffd18; - uint32_t in_stack_fffffd1c; - uint32_t in_stack_fffffd20; - EntityList_EL *in_stack_fffffd24; - void *in_stack_fffffd28; - uint32_t uVar14; - uint32_t uVar15; - int green; - int blue; - uint8_t addEnemyKillScore; - float fVar16; - BitSet128 notLudovicoFlags; - BitSet128 bombFlags; - BitSet128 flagsWithoutLudovico; - BitSet128 sourceTearFlagsCopy; - BitSet128 sourceLudovicoBits; - BitSet128 sourceTearFlags; - BitSet128 local_258; - BitSet128 local_248; - Vector local_238; - Vector local_230; - Vector local_228; - Vector local_220; - Vector local_218; - Vector local_210; - BitSet128 local_208; - Vector local_1f0; - Vector local_1e8; - Vector local_1e0; - Vector local_1d8; - Vector local_1d0; - Vector local_1c8; - Vector local_1c0; - BitSet128 local_1b8; - uint8_t local_1a4 [16]; - Vector local_194; - Vector local_18c; - Vector local_184; - Vector local_17c; - Vector local_174; - Vector local_16c; - EntityList *local_164; - Vector local_160; - Vector local_158; - Vector local_150; - Vector local_148; - Vector local_140; - uint32_t local_134; - Vector local_130; - Vector local_128; - Entity_Familiar *local_120; - Entity_Familiar *local_11c; - Entity_Player *local_118; - Entity_Familiar *self; - TearParams local_110; - uint8_t local_a8 [12]; - uint8_t idleAnimName [12]; - BitSet128 local_90; - uint8_t local_78 [12]; - char *pcStack_6c; - uint8_t local_68 [8]; - Vector local_60; - uint8_t animNameBuf [4]; - Color local_54; - uint32_t local_24; - float *pfStack_20; - void *local_1c; - uint8_t *puStack_18; - float local_14; - Entity_Projectile *deflectedShot; - BitSet128 *flagsOperand; - uint8_t *gridIndexCounts; - ANM2 *sprite; - - pfStack_20 = (&local_54)[1]._offset + 1; - local_14 = -NAN; - puStack_18 = &LAB_00af6c90; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT(((&local_54)[1]._colorize + 2)); - ExceptionList = &local_1c; - self = this; - pfVar10 = (&local_54)[1]._offset + 1; - if (this->_variant != 900) { - fVar13 = 1.0; - pfVar10 = (&local_54)[1]._offset + 1; - if (this->_variant == 0xe7) { - in_stack_fffffd28 = this->_extraData; - in_stack_fffffd24 = GHIDRA_CAST(0x61da92); - __RTDynamicCast(); - pvVar3 = get_item_config_entry(this); - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x78)); - pfVar10 = pfStack_20; - if ((fVar13 == 1.0) && (piVar11 = this->_item, piVar11 != GHIDRA_CAST(0x0))) { - if ((*piVar11 == 2) && (piVar11[1] == 0xba)) { - bVar1 = 3; - } - else { - bVar1 = (uint8_t)piVar11[0x30]; - } - if (bVar1 < 5) { - fVar13 = *GHIDRA_CAST((GHIDRA_INT((&(g_manager->_itemConfig)._wispGfxRoot + 1)) + GHIDRA_UINT(bVar1) * 4)); - } - else { - fVar13 = 1.0; - } - } - } - pfStack_20 = pfVar10; - in_XMM0_Da = GHIDRA_CAST((fVar13 * g_vectorOne.x)); - (this->_sprite)._scale.y = fVar13 * g_vectorOne.y; - (this->_sprite)._scale.x = (float)in_XMM0_Da; - pfVar10 = pfStack_20; - } - pfStack_20 = pfVar10; - game = g_game; - if (g_game->_frameCount - this->_spawnFrame < 2) { - iVar8 = this->_variant; - if ((((iVar8 == 0x62) || (iVar8 == 99)) || (iVar8 == 0x65)) || - ((iVar8 == 0x83 || (iVar8 == 0x6a)))) { - in_XMM0_Da = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_pos).x = (float)in_XMM0_Da; - (this->_pos).y = fVar13; - } - if (this->_orbitLayer == 0) { - in_stack_fffffd24 = GHIDRA_CAST(local_68); - piVar11 = GHIDRA_CAST(0x0); - local_130.y = 0.0; - in_stack_fffffd28 = (void *)0x3; - in_stack_fffffd20 = 0x61dbab; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),in_stack_fffffd24,3,-1,-1,1,0); - local_14 = 0.0; - local_118 = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(local_60.y) != GHIDRA_CAST(0x0)) { - do { - in_stack_fffffd28 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x4))) + GHIDRA_INT(local_118) * 4); - in_stack_fffffd24 = GHIDRA_CAST(0x61dbd9); - otherFamiliar = GHIDRA_CAST(__RTDynamicCast()); - if (((otherFamiliar != GHIDRA_CAST(0x0)) && ((void *)otherFamiliar[0x104] == this->_player)) && - ((*GHIDRA_CAST((GHIDRA_CAST(otherFamiliar) + 0x172)) != '\0' && (otherFamiliar[0x35c] == 0)))) { - local_130.y = (float)(GHIDRA_INT(local_130.y) + 1); - if ((piVar11 == GHIDRA_CAST(0x0)) && (otherFamiliar[0xb] == 0x21)) { - piVar11 = otherFamiliar; - } - } - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - } while (local_118 < GHIDRA_UINT(local_60.y)); - if (3 < GHIDRA_INT(local_130.y)) { - if (this->_variant == 0x21) { - iVar8 = *GHIDRA_CAST(this); - } - else { - if (piVar11 == GHIDRA_CAST(0x0)) goto LAB_0061dc46; - iVar8 = *piVar11; - } - (**(code **)(iVar8 + 0x28))(); - } - } -LAB_0061dc46: - if (this->_exists == 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - if (local_68[0] == '\0') { - local_14 = 1.4013e-45; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_68)) + 0x4))),0); - ExceptionList = local_1c; - return; - } - ExceptionList = local_1c; - return; - } - if (local_68[0] == '\0') { - local_14 = 2.8026e-45; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_68)) + 0x4))),0); - } - local_14 = -NAN; - game = g_game; - } - } - if ((0 < this->_appearTimer) && ((this->_flags & 4) != 0)) { - iVar8 = this->_appearTimer + -1; - this->_appearTimer = iVar8; - if (iVar8 == 3) { - uVar4 = Random(); - followTarget = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - followTarget->Update(); - iVar8 = this->_appearTimer; - game = g_game; - } - this->_visible = iVar8 == 0; - if (((this->_variant == 0xce) || (this->_variant == 0xed)) && - (game->_frameCount == this->_spawnFrame)) { - ai_wisp(this); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - ExceptionList = local_1c; - return; - } - if (0 < this->_sirenCharmFrames) { - this->_sirenCharmFrames = this->_sirenCharmFrames + 1; - } - if (this->_isLilDelirium != 0) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(300,this->_index); - if (bVar1 != 0) { - delirium_morph(this); - } - game = g_game; - } - if (this->_state == 0) { - in_XMM0_Da = GHIDRA_CAST(this->_updateTime); - if ((float)in_XMM0_Da == 0.0) { - ResolveOrbitConflict(this); - game = g_game; - } - } - uVar4 = this->_variant; - if (900 < uVar4) goto switchD_0061ddf2_caseD_12; - if (uVar4 == 900) { - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - animName = "FlyingIdle"; - if (this->_entityGridCollisionClass != 3) { - animName = GHIDRA_CAST(s_Idle); - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(animName),0); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar1 = (GHIDRA_CAST((room)))->Room::is_type_16(); - if (bVar1 == 0) { - bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::UpdateGridIndex(); - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&this->_pos); - } - scratchVec = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(GHIDRA_CAST((local_78 + 8)),&this->_pos); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::GetGridIndex(); - (GHIDRA_CAST((room)))->Room::SetGridPath(iVar8,0x3b6); - } - else { - in_XMM0_Da = GHIDRA_CAST((this->_friction * 0.95)); - this->_friction = (float)in_XMM0_Da; - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_1a4),&this->_pos,30.0,2); - local_14 = 1.82169e-44; - sourceRef = GHIDRA_CAST(0x0); - local_118 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_1a4))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::HasEntityFlags(0x20000000); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); - (GHIDRA_CAST((this->_player)))->Entity::Position(&local_60); - FUN_00a0ff70(); - sourceRef = local_118; - local_148.y = (float)in_XMM0_Da; - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(GHIDRA_CAST(&local_1b8._h)); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_140,scratchVec); - local_150.y = (GHIDRA_CAST((&local_140)))->Vector::LengthSquared(); - in_XMM0_Da = GHIDRA_CAST(local_148.y); - if (local_150.y < local_148.y) { - local_EAX_25497 = GHIDRA_CAST(local_148.y); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Velocity(GHIDRA_CAST(&local_208._h)); - (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_16c); - (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_17c); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Velocity(&local_1f0); - local_160.y = (GHIDRA_CAST((scratchVec)))->Vector::Length(); - (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_130,&local_160.y); - FUN_00a10160(); - FUN_0060cc20(); - local_148.y = (float)local_EAX_25497 / 3.1415927; - local_150.y = 0.99; - puVar7 = GHIDRA_CAST(std)::min(); - local_11c = GHIDRA_CAST(*puVar7); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - followTarget = GHIDRA_CAST(*puVar7); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Velocity(GHIDRA_CAST(&local_258._h)); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(GHIDRA_CAST(&local_248._h),GHIDRA_CAST(&local_11c)); - in_XMM0_Da = GHIDRA_CAST((1.0 - (float)local_11c)); - local_128.y = (float)in_XMM0_Da; - pVVar9 = (GHIDRA_CAST((&local_130)))->Vector::__mul(&local_238,&local_128.y); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_230,pVVar9); - (GHIDRA_CAST((followTarget)))->Entity::SetVelocity(scratchVec); - sourceRef = local_118; - this = self; - } - } - sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); - local_118 = sourceRef; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_1a4))))->EntityList)::Size(); - } while (sourceRef < gridIndexCounts); - } - gridIndexCounts = local_1a4; - goto LAB_006241ee; - } - switch(uVar4) { - case 2: -switchD_0061ddf2_caseD_2: - ai_auto_shooter(this); - break; - case 3: - case 0x19: - case 0x3b: - case 0x68: - case 0x82: - case 0xd5: - case 0xd6: - case 0xdf: - case 0xe8: - ai_charger(this); - break; - case 8: - case 0xf4: - Level::GetCurrentRoom(); - FUN_0043eed0(); - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_150); - (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_148,&local_140); - if (this->_variant == 0xf4) { - scratchVec = RandomVector(&local_150,this->_initSeed); - (GHIDRA_CAST((GHIDRA_CAST(local_78))))->RNG::game_constructor(this->_initSeed,0x13); - local_14 = 4.2039e-45; - local_11c = GHIDRA_CAST((GHIDRA_CAST((rng)))->RNG)::RandomFloat(); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_160,GHIDRA_CAST(&local_11c)); - local_16c.y = 30.0; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_128,&local_16c.y); - (GHIDRA_CAST((&local_140)))->Vector::operator_add_assign(scratchVec); - local_14 = -NAN; - guard_check_icall(); - } - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__sub(&local_150,&local_148); - FollowPosition(this,scratchVec); - Shoot(this); - break; - case 0xd: - MoveDiagonally(this,1.0); - local_11c = GHIDRA_CAST(0x3f4ccccd); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_11c)); - Shoot(this); - break; - case 0xe: - case 0xf: - case 0x3f: - ai_flying_bird(this); - break; - case 0x10: - ai_daddy_longlegs(this); - break; - case 0x11: - case 0xcf: - MoveDiagonally(this,1.0); - ANM2::Play(&this->_sprite,GHIDRA_CAST("Float"),0); - break; - case 0x14: - case 0x15: - case 0x16: - case 0x17: - case 0x39: - case 0x52: - case 0x5b: - case 0x72: - FollowParent(this); - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,s_Spawn); - if (bVar1 != 0) { - if (this->_variant != 0x17) goto LAB_00623343; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Float"),0); - } - break; - case 0x18: - case 0x40: - case 0x5a: - case 0x66: - ai_pickup_sack(this); - break; - case 0x1c: - ai_key_full(this); - break; - case 0x2a: - local_EAX_25497 = GHIDRA_CAST((this->_subtype + 1)); - local_11c = local_EAX_25497; - local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); - if (1.0 <= local_128.y) { - animName = "Idle%u"; - } - else { - animName = "Float%u"; - } - sprintf_s(animNameBuf,0x32,GHIDRA_CAST(animName)); - ANM2::Play(&this->_sprite,animNameBuf,0); - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_140,scratchVec); - local_128.y = (GHIDRA_CAST((&local_140)))->Vector::LengthSquared(); - if (local_128.y <= 900.0) { - local_130.y = (float)((double)GHIDRA_INT(local_EAX_25497) + - __uint_to_double_fixup[-(GHIDRA_INT(local_EAX_25497) >> 0x1f)]); - } - else { - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_158); - local_130.y = (float)((double)GHIDRA_INT(local_11c) + - __uint_to_double_fixup[-(GHIDRA_INT(local_11c) >> 0x1f)]); - local_128.y = local_130.y + local_130.y + 15.0; - fVar13 = (GHIDRA_CAST((&local_140)))->Vector::Length(); - local_16c.y = local_128.y - fVar13; - local_120 = GHIDRA_CAST(0x3fb33333); - pfVar10 = GHIDRA_CAST(std)::min(); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_174,pfVar10); - local_164 = GHIDRA_CAST(0x3d8f5c29); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_184,GHIDRA_CAST(&local_164)); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(scratchVec); - } - local_128.y = local_130.y * 0.01 + 0.87; - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_mul_assign(&local_128.y); - game = g_game; - this->_mass = local_130.y * 3.0 + 3.0; - this->_collisionDamage = local_130.y + local_130.y + 3.0; - Level::GetCurrentRoom(GHIDRA_CAST(game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(local_78),3,this->_variant,-1,0,0); - local_14 = 8.40779e-45; - uVar4 = 0; - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - cVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Exists(); - if ((cVar2 != '\0') && - (piVar11 = GHIDRA_CAST(std)::vector::operator_index(), GHIDRA_CAST(*piVar11) != this - )) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(&local_158); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_17c,scratchVec); - local_128.y = 0.0; - fVar13 = (GHIDRA_CAST((&local_17c)))->Vector::Length(); - local_11c = GHIDRA_CAST((20.0 - fVar13)); - pfVar10 = GHIDRA_CAST(std)::max(); - (GHIDRA_CAST((&local_17c)))->Vector::Resize(*pfVar10 * 0.1); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(&local_17c); - } - uVar4 = uVar4 + 1; - uVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - } while (uVar4 < uVar6); - } -LAB_0061f2a8: - gridIndexCounts = local_78; - goto LAB_006241ee; - case 0x2b: - ai_blue_fly(this); - break; - case 0x2d: - case 0x46: - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - scratchVec = GetOrbitPosition(this,&local_174,scratchVec); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_184,&this->_pos); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - Shoot(this); - break; - case 0x2e: - case 0x2f: - case 0x38: - ai_walker(this); - break; - case 0x30: - FamiliarAI::bobs_brain(this); - break; - case 0x32: - ai_orbital_variant_50(this); - break; - case 0x33: - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&DAT_00b1d3b0); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,s_Idle,0); - Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&local_134) + 2)),0x23,1,-1,0); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(1,0,GHIDRA_CAST(0x0)); - } - goto LAB_0061f886; - case 0x34: - ANM2::Play(&this->_sprite,GHIDRA_CAST("FloatDown"),0); - FollowParent(this); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,0); - if (bVar1 != 0) { - uVar4 = Random(); - uVar6 = 0x2c; -LAB_0061f94f: - Game::Spawn(g_game,1000,uVar6,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - followTarget = GHIDRA_CAST(__RTDynamicCast()); - fVar13 = random_float(); - pfVar10 = &local_128.y; - scratchVec = &local_158; - local_128.y = fVar13 * 0.5 + 0.2; -LAB_0061dea4: - scratchVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(scratchVec,pfVar10); - (GHIDRA_CAST((followTarget)))->Entity::SetSpriteScale(scratchVec); - followTarget->Update(); - } - break; - case 0x35: - FamiliarAI::variant_53(this); - break; - case 0x37: - FollowParent(this); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0); - if (bVar1 != 0) { - fVar13 = random_float(); - local_128.y = fVar13 * 0.5 + 0.2; - uVar4 = Random(); - Game::Spawn(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - followTarget = GHIDRA_CAST(__RTDynamicCast()); - scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(local_128.y,local_128.y); - (GHIDRA_CAST((followTarget)))->Entity::SetSpriteScale(scratchVec); - followTarget->Update(); - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); - if ((bVar1 != 0) && (uVar4 = Isaac::Random(5), 1 < uVar4)) { - uVar4 = Random(); - uVar6 = 0x2e; - goto LAB_0061f94f; - } - break; - case 0x3a: - this->_entityGridCollisionClass = 3; - if (this->_subtype == 0) { - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - local_130.y = (layer->_size).x; - if (1.0 <= local_130.y) { - this->_entityCollisionClass = 3; - } - else { - local_130.y = local_130.y + 0.05; - if (1.0 <= local_130.y) { - local_130.y = 1.0; - } - scratchVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_158,&local_130.y); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(scratchVec); - } - this->_visible = 1; - MoveDiagonally(this,1.0); - } - else { - scratchVec = &g_vectorZero; - this->_entityCollisionClass = 0; - this->_visible = 0; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(scratchVec); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - if ((0 < this->_counter) && (iVar8 = this->_counter + -1, this->_counter = iVar8, iVar8 < 1)) - { - this->_subtype = 0; - if (this->_player != GHIDRA_CAST(0x0)) { - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); - } - } - } - break; - case 0x3d: - case 0x6c: - case 0xe6: - FollowParent(this); - ai_incubus_shot(); - break; - case 0x3e: - followTarget = this->_player; - iVar8 = Game::Challenge(); - if (iVar8 == 0x1e) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(local_78),3,0x43,-1,0,0); - local_14 = 1.12104e-44; - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - followTarget = GHIDRA_CAST(*puVar7); - } - local_14 = -NAN; - (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); - } - else { - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(); - if ((iVar8 == 0x23) && (iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetOtherTwin(), iVar8 != 0)) { - followTarget = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetOtherTwin(); - } - } - if (this->_state == 0) { - (GHIDRA_CAST((followTarget)))->Entity::Position(&local_148); - bVar1 = (GHIDRA_CAST((followTarget)))->Entity::is_player(); - if (bVar1 != 0) { - scratchVec = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); - local_128.y = 60.0; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_158,&local_128.y); - (GHIDRA_CAST((&local_148)))->Vector::operator__(scratchVec); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_16c.y = (float)&this->_pos; - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_16c.y))))->Vector::__sub(&local_174,&local_148); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Resized(&local_184,40.0); - scratchVec = (GHIDRA_CAST((&local_148)))->Vector::__add(&local_18c,scratchVec); - (GHIDRA_CAST((room)))->Room::GetClampedPosition(&local_150,scratchVec,6.0); - scratchVec = &this->_pos; - local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::Distance(&local_148); - if (40.0 < local_128.y) { - local_128.y = ((local_128.y - 40.0) / local_128.y) * 0.4; - pVVar9 = (GHIDRA_CAST((&local_150)))->Vector::__sub(&local_158,scratchVec); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_174,&local_128.y); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(pVVar9); - local_11c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - if (15.0 < (float)local_11c) { - (GHIDRA_CAST((&this->_velocity)))->Vector::Resize(15.0); - } - } - this->_friction = this->_friction * 0.8; - if ((this->_fireCooldown < 1) && - (bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty), bVar1 != 0)) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("FloatDown"),0); - } - local_130.y = (float)(GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); - (GHIDRA_CAST((GHIDRA_CAST(&local_160))))->EntityPtr::clear(); - bVar1 = TryAimAtMarkedTarget(this,&local_160,&this->_lastDirection,GHIDRA_CAST(0x0)); - if ((bVar1 != 0) && (0x1d < this->_fireCooldown)) { - local_130.y = -NAN; - } - bVar1 = CanPlayerFire(this); - if (bVar1 != 0) { - iVar8 = this->_fireCooldown; - if (GHIDRA_CAST(local_130.y) == GHIDRA_CAST(0xffffffff)) { - if (0 < iVar8) { - if (iVar8 < 0x1e) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("FloatDown"),0); - } - else { - ANM2::Play(&this->_sprite,GHIDRA_CAST("ChargeAttack"),1); - this->_fireCooldown = 0; - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - local_134 = GHIDRA_CAST(CONCAT13(bVar1,(undefined3)local_134)); - if (bVar1 == 0) { - local_118 = GHIDRA_CAST(0x42f00000); - } - else { - local_118 = GHIDRA_CAST(0x43340000); - } - Game::ButterBeanFart(g_game,scratchVec,(float)local_118,this->_player,0,0); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius - (entityList,GHIDRA_CAST(local_78),scratchVec,(float)local_118,8); - local_14 = 1.26117e-44; - local_120 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - local_EAX_25497 = GHIDRA_CAST(*puVar7); - local_11c = local_EAX_25497; - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - bVar1 = Entity::IsDescendantOf - (GHIDRA_CAST(local_EAX_25497),GHIDRA_CAST(this->_spawnerEntity)); - if (bVar1 == 0) { - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Mass(); - local_128.y = (float)floatResult; - if (0.0 < local_128.y) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::HasEntityFlags(0x4000000); - if (bVar1 == 0) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::HasEntityFlags(0x20000000); - if (bVar1 == 0) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Position(&local_158); - (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_140,&this->_pos); - local_118 = GHIDRA_CAST((GHIDRA_CAST((&local_140)))->Vector)::Length(); - (GHIDRA_CAST((&local_140)))->Vector::__div_assign(GHIDRA_CAST(&local_118)); - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Mass(); - sourceRef = GHIDRA_CAST((float)floatResult); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') { - local_130.y = (float)sourceRef; - FUN_00431260(); - } - local_130.y = (float)sourceRef; - FUN_00417340(); - local_118 = (Entity_Player *) - ((float)local_118 - ((float)sourceRef + this->_size)); - fVar13 = assert_lerp_range(local_130.y + (float)local_118,10.0,120.0, - 20.0,1.0,1); - FUN_00407140(); - local_128.y = 16.0; - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_174,&local_128.y); - (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(self)); - Entity::AddKnockback - (GHIDRA_CAST(local_11c),GHIDRA_CAST((local_a8 + 4)),scratchVec, - GHIDRA_INT(fVar13),1); - this = self; - } - } - } - } - } - nextIndex = &(*GHIDRA_CAST((GHIDRA_CAST((local_120)) + 0x1))); - local_120 = GHIDRA_CAST(nextIndex); - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); - } while (nextIndex < gridIndexCounts); - scratchVec = &this->_pos; - } - SoundEffects::PlayWithFartOverride(0x45,2.0,2,0,1.0); - SoundEffects::PlayWithFartOverride(0xb2,1.0,2,0,1.0); - uVar4 = Random(); - followTarget = Game::Spawn(g_game,1000,2,scratchVec,&g_vectorZero,GHIDRA_CAST(this), - ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') + 3,uVar4); - followTarget->Update(); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') { - local_118 = GHIDRA_CAST(0x3); - do { - MusicManager::RandomVector(&local_140); - uVar4 = Random(); - fVar13 = random_float(); - local_128.y = fVar13 * 4.0 + 8.0; - scratchVec = Vector::operator_mul(&local_158,&local_128.y,&local_140); - local_11c = GHIDRA_CAST(0x41200000); - pVVar9 = Vector::operator_mul(&local_174,GHIDRA_CAST(&local_11c),&local_140); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_16c.y))))->Vector::__add(&local_184,pVVar9); - this = self; - followTarget = Game::Spawn(g_game,1000,2,pVVar9,scratchVec,GHIDRA_CAST(self),3,uVar4) - ; - followTarget->Update(); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_118[-1])) + 0x2eff)))); - } while (local_118 != GHIDRA_CAST(0x0)); - scratchVec = &this->_pos; - local_118 = GHIDRA_CAST(0x0); - } - uVar4 = Random(); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0x2e,scratchVec,&g_vectorZero,GHIDRA_CAST(this),0,uVar4) - ; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { - local_128.y = 1.2; - } - else { - local_128.y = 3.0; - } - scratchVec = Vector::operator_mul(&local_158,&local_128.y,&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetSpriteScale(scratchVec); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x1c2); - effect->Update(); - local_118 = GHIDRA_CAST(0x0); - do { - Vector::FromAngle(&local_140, - (float)((double)GHIDRA_INT(local_118) + - __uint_to_double_fixup[-(GHIDRA_INT(local_118) >> 0x1f)]) * 360.0 - * 0.125); - uVar4 = Random(); - local_128.y = 12.0; - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_158,&local_128.y); - followTarget = Game::Spawn(g_game,2,1,&this->_pos,scratchVec,GHIDRA_CAST(this),0,uVar4) - ; - followTarget->SetCollisionDamage(); - followTarget->Update(); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - } while (local_118 < &DAT_00000008); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') { - local_118 = GHIDRA_CAST(0xa); - do { - MusicManager::RandomVector(&local_140); - local_128.y = 10.0; - (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(&local_128.y); - fVar13 = random_float(); - local_11c = GHIDRA_CAST((fVar13 * 0.2 + 0.7)); - (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_11c)); - uVar4 = Random(); - tear = (Entity_Tear *) - Game::Spawn(g_game,2,1,&this->_pos,&local_140,GHIDRA_CAST(this),0,uVar4); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel(0.8); - random_float(); - FUN_00444c70(); - iVar8 = Isaac::Random(2); - if (iVar8 == 0) { - fVar13 = random_float(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale(fVar13 * 0.05 + 0.9); - } - else { - fVar13 = random_float(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale(fVar13 * 0.05 + 1.3); - } - tear->SetCollisionDamage(); - tear->Update(); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_118[-1])) + 0x2eff)))); - } while (local_118 != GHIDRA_CAST(0x0)); - } - local_14 = -NAN; - (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); - scratchVec = &this->_pos; - } - this->_fireCooldown = 0; - } - } - else { - if ((iVar8 < 1) && (bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty), bVar1 == 0)) { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - bVar1 = AnimationState::IsLoopingAnimation(animState); - if (bVar1 == 0) goto LAB_00620a2e; - } - local_11c = GHIDRA_CAST((this->_fireCooldown + 1)); - local_128.y = 4.2039e-44; - piVar11 = GHIDRA_CAST(std)::min(); - iVar8 = *piVar11; - this->_fireCooldown = iVar8; - if (0x12 < iVar8) { - bVar1 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("FloatDown")); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("ChargeStart"),0); - goto LAB_00620a2e; - } - } - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("ChargeLoop"),0); - } - } - } -LAB_00620a2e: - cVar2 = (GHIDRA_CAST((this->_player)))->Entity::IsDead(); - if (cVar2 != '\0') { - this->_state = 1; - this->_visible = 0; - this->_shadowSize = 0.0; - this->_entityCollisionClass = 0; - uVar4 = Random(); - Game::Spawn(g_game,1000,2,scratchVec,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar4); - followTarget = GHIDRA_CAST(__RTDynamicCast()); - scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(0.0,-10.0); - (GHIDRA_CAST((followTarget)))->Entity::SetPositionOffset(scratchVec); - followTarget->SetColor(); - followTarget->Update(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); - } - } - else { - cVar2 = (GHIDRA_CAST((this->_player)))->Entity::IsDead(); - if (cVar2 == '\0') { - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - pVVar9 = (GHIDRA_CAST((&local_174)))->Vector::Vector(0.0,10.0); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_184,pVVar9); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); - uVar4 = Random(); - followTarget = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(self),0,uVar4) - ; - followTarget->Update(); - self->_state = 0; - self->_visible = 1; - self->_shadowSize = *GHIDRA_CAST((GHIDRA_CAST(self->_config) + 0x24)); - self->_entityCollisionClass = 4; - goto LAB_00624200; - } - } - break; - case 0x42: - FamiliarAI::variant_66(this); - break; - case 0x43: - FamiliarAI::punching_bag(this); - break; - case 0x44: - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - GetOrbitPosition(this,&local_148,scratchVec); - scratchVec = (GHIDRA_CAST((&local_148)))->Vector::__sub(&local_158,&this->_pos); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - playerEffects = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetEffects(); - bVar1 = (GHIDRA_CAST((playerEffects)))->TemporaryEffects::HasCollectibleEffect(0x2d9); - if (bVar1 == 0) { - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsFullSpriteRendering(); - this->_entityCollisionClass = 4; - this->_visible = bVar1 == 0; - pVVar9 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - scratchVec = &local_148; - goto LAB_0061ef12; - } - this->_visible = 0; - this->_entityCollisionClass = 0; - break; - case 0x47: - case 0x48: - ai_walker(this); - Shoot(this); - break; - case 0x49: - FamiliarAI::blue_spider(this); - break; - case 0x4a: - if ((this->_subtype == 1) || - ((bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x71,0), bVar1 != 0 && - (iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(), iVar8 == -1)))) - goto switchD_0061ddf2_caseD_2; - case 1: - case 4: - case 5: - case 6: - case 7: - case 9: - case 10: - case 0xb: - case 0xc: - case 0x36: - case 0x51: - case 0x5c: - case 0x61: - case 0xd1: - case 0xdc: - FollowParent(this); - Shoot(this); - break; - case 0x4b: - ai_samsons_chains(this); - break; - case 0x4c: - case 0x50: - FollowParent(this); - update_weapon(this,0); - break; - case 0x4d: - ai_blue_babys_only_friend(this); - break; - case 0x4e: - this->_friction = this->_friction * 0.8; - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - if (this->_state == 0) { - this->_state = 1; - } - pVVar9 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - scratchVec = &this->_pos; -LAB_0061ef12: - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_174,pVVar9); - local_140.x = scratchVec->x; - local_140.y = scratchVec->y; - FUN_007792f0(); - break; - case 0x4f: - FamiliarAI::lil_haunt(this,0); - break; - case 0x53: - uVar4 = 2; - Game::GetField26614(game); - cVar2 = DeathmatchManager::is_active(); - if (cVar2 != '\0') { - uVar4 = 6; - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,30.0,uVar4); - local_14 = 7.00649e-45; - sourceRef = GHIDRA_CAST(0x0); - local_130.y = 0.0; - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::HasEntityFlags(0x20000000); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsDescendantOf(GHIDRA_CAST(this->_spawnerEntity)); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(&local_160); - (GHIDRA_CAST((this->_player)))->Entity::Position(&local_220); - FUN_00a0ff70(); - sourceRef = GHIDRA_CAST(local_130.y); - local_11c = in_XMM0_Da; - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(&local_218); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_17c,scratchVec); - local_120 = GHIDRA_CAST((GHIDRA_CAST((&local_17c)))->Vector)::LengthSquared(); - in_XMM0_Da = local_11c; - if ((float)local_120 < (float)local_11c) { - local_EAX_25497 = local_11c; - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Velocity(&local_210); - (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_150); - (GHIDRA_CAST((&local_17c)))->Vector::Normalized(&local_148); - local_11c = GHIDRA_CAST(0x41700000); - (GHIDRA_CAST((&local_148)))->Vector::__mul(&local_140,GHIDRA_CAST(&local_11c)); - FUN_00a10160(); - FUN_0060cc20(); - local_11c = GHIDRA_CAST(((float)local_EAX_25497 / 3.1415927)); - local_16c.y = 0.99; - puVar7 = GHIDRA_CAST(std)::min(); - local_118 = GHIDRA_CAST(*puVar7); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - followTarget = GHIDRA_CAST(*puVar7); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Velocity(&local_228); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_1e0,GHIDRA_CAST(&local_118)); - local_164 = GHIDRA_CAST((1.0 - (float)local_118)); - pVVar9 = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_1e8,GHIDRA_CAST(&local_164)); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_1c0,pVVar9); - (GHIDRA_CAST((followTarget)))->Entity::SetVelocity(scratchVec); - sourceRef = GHIDRA_CAST(local_130.y); - if ((float)local_120 < 400.0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsProjectile(); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsTear(); - if (bVar1 == 0) goto LAB_0061ebc3; - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - deflectedShot = GHIDRA_CAST(*puVar7); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Velocity(&local_18c); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_184,GHIDRA_CAST(&local_118)); - local_128.y = 1.0 - (float)local_118; - pVVar9 = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_174,&local_128.y); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_158,pVVar9); - (GHIDRA_CAST((deflectedShot)))->Entity_Projectile::Deflect(GHIDRA_CAST(self),scratchVec); - } - else { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - deflectedShot = GHIDRA_CAST(*puVar7); - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Velocity(&local_1c8); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_1d0,GHIDRA_CAST(&local_118)); - local_134 = GHIDRA_CAST((1.0 - (float)local_118)); - pVVar9 = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_1d8,GHIDRA_CAST(&local_134)); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_194,pVVar9); - (GHIDRA_CAST((deflectedShot)))->Entity_Projectile::Reflect(GHIDRA_CAST(self),scratchVec); - } - sourceRef = GHIDRA_CAST(local_130.y); - } -LAB_0061ebc3: - in_XMM0_Da = local_120; - if ((float)local_120 < 64.0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Die(); - } - this = self; - } - } - } - sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); - local_130.y = (float)sourceRef; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); - } while (sourceRef < gridIndexCounts); - } - local_14 = -NAN; - (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); - case 0x1e: - case 0x1f: - case 0x20: - case 0x21: - case 0x23: - case 0x2c: - case 0x3c: - case 0x41: - case 0x45: - case 0x54: - case 0x75: - case 0x79: - case 0x7e: - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - pVVar9 = GetOrbitPosition(this,&local_174,scratchVec); - scratchVec = &this->_pos; -LAB_0061ec34: - scratchVec = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_184,scratchVec); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - break; - case 0x55: - FamiliarAI::lost_fly(this); - break; - case 0x56: - room = GHIDRA_CAST(Level)::GetCurrentRoom(); - bVar1 = (GHIDRA_CAST((room)))->Room::IsClear(); - if (bVar1 != 0) { - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - if (cVar2 == '\0') goto switchD_0061ddf2_caseD_70; - } - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if ((0 < iVar8) && - (((iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), iVar8 % 900 == 0 && - (iVar8 = Isaac::Random(2), iVar8 == 0)) || - (iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), iVar8 % 0x708 == 0)))) { - if (this->_coins < 2) { - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); - if (uVar4 == 2) goto LAB_0061e0cf; -LAB_0061e0e9: - if (uVar4 == 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::FindFreePickupSpawnPosition(room,&local_140,&this->_pos,0.0,0,0,0); - uVar4 = Random(); - Game::Spawn(g_game,5,0x5a,&local_140,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - ANM2::Play(&this->_sprite,s_Spawn,1); - iVar8 = 0x3f3; - } - else { - if (uVar4 != 1) { - if (uVar4 == 2) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_130.y = (float)(GHIDRA_CAST((room)))->Room::GetEntities(); - local_EAX_25497 = GHIDRA_CAST(0x0); - local_120 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - followTarget = GHIDRA_CAST(*puVar7); - (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((followTarget)))->Entity::AddFreeze(GHIDRA_CAST((local_a8 + 4)),-0x28,0); - local_EAX_25497 = local_120; - } - local_EAX_25497 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_EAX_25497)) + 0x1)))); - local_120 = local_EAX_25497; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->EntityList)::Size(); - } while (local_EAX_25497 < gridIndexCounts); - } - ANM2::Play(&this->_sprite,&DAT_00b63f60,1); - SoundEffects::PlayWithFartOverride(0x3f5,1.0,2,0,1.0); - } - else if (uVar4 != 2) goto LAB_0061e295; - goto switchD_0061ddf2_caseD_70; - } - Entity_Player::AddActiveCharge(this->_player,1,-1,0,0,0); - ANM2::Play(&this->_sprite,&DAT_00b63f60,1); - iVar8 = 0x3f4; - } - SoundEffects::PlayWithFartOverride(iVar8,1.0,2,0,1.0); - } - else { - uVar4 = 2; -LAB_0061e0cf: - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - if (cVar2 == '\0') goto LAB_0061e0e9; - } -LAB_0061e295: - this->_coins = this->_coins + 1; - } - case 0x70: -switchD_0061ddf2_caseD_70: - FollowParent(this); - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,s_Idle,0); - } - break; - case 0x57: - ai_lil_gurdy(this); - break; - case 0x58: - FamiliarAI::bumbo(this); - break; - case 0x59: - uVar4 = 10; - Game::GetField26614(game); - cVar2 = DeathmatchManager::is_active(); - if (cVar2 != '\0') { - uVar4 = 0xe; - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - uVar14 = 0x61e536; - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,150.0,uVar4); - local_14 = 5.60519e-45; - sourceRef = GHIDRA_CAST(0x0); - local_118 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - uVar15 = 0x61e56c; - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::HasEntityFlags(0x20000000); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Type(); - if (iVar8 == 9) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - uVar14 = 0; - in_stack_fffffd28 = (void *)*puVar7; - in_stack_fffffd24 = GHIDRA_CAST(0x61e61e); - local_118 = GHIDRA_CAST(__RTDynamicCast()); - if ((local_118 != GHIDRA_CAST(0x0)) && - (projectileFlags = - (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity_Projectile::ProjectileFlags(), - (projectileFlags & 0x1000000) == 0)) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::Velocity(&local_140); - local_11c = GHIDRA_CAST(0x3f000000); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_17c,GHIDRA_CAST(&local_11c)); - (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::SetVelocity(scratchVec); - (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity_Projectile::AddProjectileFlags(0x1000000); - } - } - else { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsTear(); - if (bVar1 != 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - uVar14 = 0; - in_stack_fffffd28 = (void *)*puVar7; - in_stack_fffffd24 = GHIDRA_CAST(0x61e6cb); - local_130.y = (float)__RTDynamicCast(); - if (GHIDRA_CAST(local_130.y) != GHIDRA_CAST(0x0)) { - scratchFlags = GHIDRA_CAST(FUN_00435bc0()); - flagsOperand = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Tear::TearFlags(&local_1b8); - scratchFlags = BitSet128::operator_and(&local_208,flagsOperand,scratchFlags); - bVar1 = (GHIDRA_CAST((scratchFlags)))->BitSet128::IsZero(); - fVar13 = local_130.y; - if ((bVar1 != 0) && - (bVar1 = Entity::IsDescendantOf - (GHIDRA_CAST(local_130.y),GHIDRA_CAST(this->_spawnerEntity)), - bVar1 == 0)) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Velocity(&local_150); - local_16c.y = 0.5; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_160,&local_16c.y); - (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::SetVelocity(scratchVec); - scratchFlags = GHIDRA_CAST(FUN_00435bc0()); - flagsOperand = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Tear::TearFlags(&local_258); - scratchFlags = BitSet128::operator_or(&local_248,flagsOperand,scratchFlags); - uVar14 = (uint32_t)scratchFlags->_l; - in_stack_fffffd28 = (void *)0x61e7b5; - (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Tear::SetTearFlags(*scratchFlags); - } - goto LAB_0061e7b5; - } - } - } - } - else { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - followTarget = GHIDRA_CAST(*puVar7); - fVar13 = 8.990418e-39; - (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - bVar1 = 0; - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x28,0x28,0x28); - color._tint[1] = (float)in_stack_fffffd10; - color._tint[0] = (float)in_stack_fffffd0c; - color._tint[2] = (float)in_stack_fffffd14; - color._tint[3] = (float)in_stack_fffffd18; - color._colorize[0] = (float)in_stack_fffffd1c; - color._colorize[1] = (float)in_stack_fffffd20; - color._colorize[2] = (float)in_stack_fffffd24; - color._colorize[3] = (float)in_stack_fffffd28; - color._offset[0] = (float)uVar14; - color._offset[1] = (float)uVar15; - color._offset[2] = fVar13; - (GHIDRA_CAST((followTarget)))->Entity::AddSlowing(GHIDRA_CAST((local_a8 + 4)),2,0.9,color,bVar1); -LAB_0061e7b5: - sourceRef = local_118; - } - } - sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); - local_118 = sourceRef; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); - } while (sourceRef < gridIndexCounts); - } - local_14 = -NAN; - (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); - case 0x1a: - case 0x1b: - case 0x28: - case 0x29: - case 0x67: - FollowParent(this); - break; - case 0x5d: - FamiliarAI::gb_bug(this); - break; - case 0x5e: - case 0x71: - FamiliarAI::spider_mod(this); - break; - case 0x5f: - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&DAT_00b1d3b0); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,s_Idle,0); - iVar8 = Isaac::Random(3); - if (iVar8 == 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_a8))))->Color::Color(); - Game::Fart(g_game,&this->_pos,85.0,GHIDRA_CAST(this),1.0,0,fartColor); - Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,0,0); - } - else if (iVar8 == 1) { - Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,1,0); - } - else if (iVar8 == 2) { - Game::CharmFart(&this->_pos,100.0,GHIDRA_CAST(this)); - } - } -LAB_0061f886: - FollowParent(this); - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - goto LAB_00624200; - case 0x60: - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(7,this->_index); - if (bVar1 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,150.0,8); - local_14 = 9.80909e-45; - sourceRef = GHIDRA_CAST(0x0); - local_118 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(GHIDRA_CAST(*puVar7)); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::HasEntityFlags(0x20000010); - if (bVar1 == 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - virtualFn = *(code **)(*GHIDRA_CAST(*puVar7) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(self)); - (*virtualFn)(); - sourceRef = local_118; - this = self; - } - } - } - sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); - local_118 = sourceRef; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); - } while (sourceRef < gridIndexCounts); - } - local_14 = -NAN; - (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); - } - uVar4 = 0; - iVar8 = Game::GetNumPlayers(g_game); - if (iVar8 != 0) { - do { - local_130.y = (float)Game::GetPlayer(g_game,uVar4); - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - if ((cVar2 == '\0') || - (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(GHIDRA_CAST(local_130.y)), bVar1 != 0)) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity::Position(&local_158); - local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); - if (local_128.y < 10000.0) { - FUN_0060d0c0(); - } - } - uVar4 = uVar4 + 1; - uVar6 = Game::GetNumPlayers(g_game); - } while (uVar4 < uVar6); - } - MoveDiagonally(this,1.0); - break; - case 0x62: - goto switchD_0061ddf2_caseD_62; - case 99: - ai_lil_monstro(this); - goto switchD_0061ddf2_caseD_62; - case 100: - if (GHIDRA_UINT(this->_subtype) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf38))))) { - FollowParent(this); - } - else { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered(&DAT_00b63f64); - if (bVar1 == 0) { - local_EAX_25497 = GHIDRA_CAST(&this->_pos); - } - else { - this->_shadowSize = 0.0; - SoundEffects::PlayWithFartOverride(0x35,1.0,2,0,1.0); - SoundEffects::PlayWithFartOverride(0x33,1.0,2,0,1.0); - playerEffects = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetEffects(); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddCollectibleEffect(0x1b4,1,1); - uVar4 = Random(); - local_11c = GHIDRA_CAST(&this->_pos); - followTarget = Game::Spawn(g_game,1000,0xd,GHIDRA_CAST(local_11c),&g_vectorZero,GHIDRA_CAST(this), - 0,uVar4); - virtualFn = *(code **)(*GHIDRA_CAST(followTarget) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*virtualFn)(); - followTarget->Update(); - uVar4 = Random(); - local_EAX_25497 = local_11c; - followTarget = Game::Spawn(g_game,1000,0x5a,GHIDRA_CAST(local_11c),&g_vectorZero,GHIDRA_CAST(0x0), - 0,uVar4); - followTarget->Update(); - this = self; - } - this->_friction = this->_friction * 0.5; - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,s_Idle,0); - this->_visible = 0; - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Vector::operator_assign(&g_vectorZero); - goto LAB_0061e4de; - } - } - break; - case 0x65: - MoveDelayed(this,0x14); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,this->_size,4); - local_14 = 1.4013e-44; - sourceRef = GHIDRA_CAST(0x0); - local_118 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - cVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsDead(); - if (cVar2 == '\0') { - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - if (cVar2 != '\0') { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - followTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity)::SpawnerEntity(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(followTarget); - if (bVar1 == 0) goto LAB_006213fc; - } - msvc::vector::operator_index(); - cVar2 = FUN_004d7760(); - if (cVar2 == '\0') { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsTear(); - if (bVar1 != 0) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - tear = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::ToTear(); - local_16c.y = (float)tear; - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Variant(); - if (iVar8 != 9) { - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Variant(); - if (iVar8 != 0x2d) { - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Variant(); - if (iVar8 != 0x28) { - flagsOperand = &g_tearFlagLudovico; - scratchFlags = (GHIDRA_CAST((tear)))->Entity_Tear::TearFlags(GHIDRA_CAST(local_68)); - scratchFlags = BitSet128::operator_and(&local_1b8,scratchFlags,flagsOperand); - bVar1 = (GHIDRA_CAST((scratchFlags)))->BitSet128::IsNonZero(); - if (bVar1 != 0) { - FUN_005cd750(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::GetIntervalTicks((float)in_XMM0_Da,0.0); - if (iVar8 == 0) goto LAB_006213f6; - } - cVar2 = FUN_0060cd60(); - if (cVar2 == '\0') { - FUN_0060cd70(); - iVar8 = FUN_0060cd10(); - local_134 = GHIDRA_CAST(CONCAT13(0 < iVar8,(undefined3)local_134)); - if (iVar8 < 1) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_158); - } - else { - pfVar10 = GHIDRA_CAST(FUN_0060cd40()); - local_140.y = pfVar10[1]; - scratchVec = &local_140; - local_140.x = *pfVar10; - } - local_17c.x = scratchVec->x; - local_17c.y = scratchVec->y; - local_128.y = 1.333; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { - scratchVec = (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_184,&local_128.y); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetVelocity(scratchVec); - } - else { - (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_174,&local_128.y); - FUN_0060cd20(); - } - floatResult = (long double)(GHIDRA_CAST((tear)))->Entity_Tear::Height(); - Entity_Projectile::SetHeight - (GHIDRA_CAST(tear),(float)(floatResult * (long double)1.5)); - scratchVec = (GHIDRA_CAST((&local_17c)))->Vector::Rotated(&local_18c,90.0); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_194); - (GHIDRA_CAST((&local_17c)))->Vector::operator_assign(scratchVec); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Position(&local_1d8); - local_11c = GHIDRA_CAST(0x40a00000); - pVVar9 = (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_1d0,GHIDRA_CAST(&local_11c)); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_1c8,pVVar9); - fVar13 = local_16c.y; - (GHIDRA_CAST((GHIDRA_CAST(local_16c.y))))->Entity::SetPosition(scratchVec); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Variant(); - if (((iVar8 != 0x23) && - (iVar8 = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Variant(), iVar8 != 0x25)) && - (iVar8 = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Variant(), iVar8 != 0x26)) { - (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity_Tear::ChangeVariant(0x15); - } - followTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity)::SpawnerEntity(); - tear = Entity_Tear::MakeMultidimensionalCopy - (GHIDRA_CAST(fVar13),followTarget); - followTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity)::Parent(); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetParent(followTarget); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_1c0); - local_130.y = 10.0; - pVVar9 = (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_1e8,&local_130.y); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_1e0,pVVar9); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetPosition(scratchVec); - tear->Update(); - this = self; - } - } - } - } -LAB_006213f6: - sourceRef = local_118; - } - } - else { - msvc::vector::operator_index(); - local_128.y = (float)FUN_0060cc90(); - cVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_128.y))))->Entity_Knife::IsFlying(); - if (cVar2 != '\0') { - multidimensional_baby_copy_knife(GHIDRA_CAST(local_128.y),GHIDRA_CAST(this)); - } - } - } -LAB_006213fc: - sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); - local_118 = sourceRef; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); - } while (sourceRef < gridIndexCounts); - } - PlayFloatAnim(this,3); - gridIndexCounts = local_78; -LAB_006241ee: - local_14 = -NAN; - (GHIDRA_CAST((gridIndexCounts)))->EntityList_Query::~EntityList_Query(); - break; - case 0x69: - FollowParent(this); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0); - if ((bVar1 != 0) && (iVar8 = Isaac::Random(5), iVar8 != 0)) { - uVar4 = Random(); - Game::Spawn(g_game,1000,0x36,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - followTarget = GHIDRA_CAST(__RTDynamicCast()); - fVar13 = random_float(); - pfVar10 = GHIDRA_CAST(&local_11c); - scratchVec = &local_140; - local_11c = GHIDRA_CAST((fVar13 * 0.5 + 0.2)); - goto LAB_0061dea4; - } - break; - case 0x6a: - if (this->_subtype != 0) { - if (this->_visible == 0) { -LAB_00620f26: - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - followTarget = this->_player; - if (GHIDRA_CAST(this->_parent) != GHIDRA_CAST(0x0)) { - followTarget = GHIDRA_CAST(this->_parent); - } - scratchVec = (GHIDRA_CAST((followTarget)))->Entity::Position(&local_158); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); - } - else { - this->_visible = 0; - iVar8 = Isaac::Random(2); - local_118 = GHIDRA_CAST((iVar8 + 3)); - if (0 < GHIDRA_INT(local_118)) { - do { - uVar4 = Random(); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - scratchVec = Room::FindFreePickupSpawnPosition(room,&local_158,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,0x17,0,scratchVec,&g_vectorZero,GHIDRA_CAST(this),1,uVar4); - followTarget = GHIDRA_CAST(__RTDynamicCast()); - addEnemyKillScore = 0; - bVar1 = 0; - iVar8 = -1; - sourceRef = (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::EntityRef(); - (GHIDRA_CAST((followTarget)))->Entity::AddCharmed(sourceRef,iVar8,bVar1,addEnemyKillScore); - (GHIDRA_CAST((followTarget)))->Entity::SetVisibleFlag(0); - followTarget->Update(); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_118[-1])) + 0x2eff)))); - } while (local_118 != GHIDRA_CAST(0x0)); - } - if (this->_visible == 0) goto LAB_00620f26; - } - this->_friction = this->_friction * 0.7; - break; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x4))) = "WalkDown"; - local_60.x = (float)&DAT_00b1e020; - local_60.y = 1.633423e-38; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x4))) = "FlyDown"; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x8))) = &DAT_00b1ddc0; - pcStack_6c = "FlyHori"; - bVar1 = (GHIDRA_CAST((this->_player)))->Entity::IsFlying(); - gridIndexCounts = local_78; - if (bVar1 == 0) { - gridIndexCounts = local_68; - } - local_130.y = (float)(gridIndexCounts + 4); - MoveDelayed(this,0x14); - local_120 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::get_velocity_direction(); - local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); - if (1.0 <= local_128.y) { - sprite = &this->_sprite; - if (local_120 == GHIDRA_CAST(0x3)) { - ANM2::Play(sprite,*GHIDRA_CAST(local_130.y),0); - } - else if (local_120 == GHIDRA_CAST(0x1)) { - ANM2::Play(sprite,*GHIDRA_CAST((GHIDRA_CAST(local_130.y) + 4)),0); - } - else { - ANM2::Play(sprite,*GHIDRA_CAST((GHIDRA_CAST(local_130.y) + 8)),0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(local_120 == GHIDRA_CAST(0x0)); - } - } - else { - local_130.y = *GHIDRA_CAST(local_130.y); - bVar1 = (GHIDRA_CAST((this->_player)))->Entity::IsFlying(); - if (bVar1 == 0) { - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST(local_130.y),0); - } - else { - ANM2::Play(&this->_sprite,GHIDRA_CAST(local_130.y),0); - } - } - bVar1 = ANM2::IsPlaying(&this->_sprite,&s_empty); - if (bVar1 != 0) { - fVar13 = (GHIDRA_CAST((&this->_velocity)))->Vector::Length(); - local_118 = GHIDRA_CAST((fVar13 * 0.5)); - fVar13 = 1.0; - if ((float)local_118 < 2.3) { - fVar13 = assert_lerp_range((float)local_118,1.0,2.3,0.5,1.0,1); - } - if (6.0 < (float)local_118) { - fVar13 = assert_lerp_range((float)local_118,6.0,10.0,1.0,2.0,1); - } - set_PlaybackSpeed(&this->_sprite,fVar13); - } - if (this->_variant == 0x6a) { - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(); - if (iVar8 == 0xc) { - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - blue = 0x24; - green = 0x1c; - iVar8 = 0xee; - } - else { - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - blue = 0xff; - green = 0xff; - iVar8 = 0xff; - } - (GHIDRA_CAST((spriteColor)))->KColor::FromRGBA255(iVar8,green,blue,0xff); - } - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - iVar8 = 0x29a; - if (cVar2 != '\0') { - iVar8 = 100; - } - if (iVar8 < this->_state) { - this->_subtype = 1; - } - goto LAB_00624200; - case 0x6b: - if (this->_subtype == 0) { - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Phase2"),0); - } - MoveDiagonally(this,1.3); - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); - if (iVar8 != -1) { - this->_subtype = 1; - ANM2::Play(&this->_sprite,GHIDRA_CAST("RevertToPhase1"),0); - this->_fireCooldown = 0x1e; - } - } - else if (this->_subtype == 1) { - sprite = &this->_sprite; - local_128.y = (float)sprite; - bVar1 = ANM2::IsFinishedImpl(sprite,&s_empty); - if (bVar1 != 0) { - ANM2::Play(sprite,s_Idle,0); - } - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); - if (iVar8 == -1) { - this->_subtype = 0; - ANM2::Play(sprite,GHIDRA_CAST("Phase2Start"),0); - } - game = g_game; - this->_friction = this->_friction * 0.85; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - scratchVec = (GHIDRA_CAST((room)))->Room::GetClampedPosition(&local_158,&this->_pos,this->_size); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); - iVar8 = this->_fireCooldown; - this->_fireCooldown = iVar8 + -1; - if (iVar8 < 1) { - this->_fireCooldown = 0x1e; - iVar8 = 0; - do { - scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(0.0,1.0); - bVar1 = 0; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_174,(float)iVar8 * 45.0); - FireProjectile(this,scratchVec,bVar1); - iVar8 = iVar8 + 1; - } while (iVar8 < 8); - ANM2::Play(GHIDRA_CAST(local_128.y),GHIDRA_CAST("RevertToPhase1"),0); - } - } - break; - case 0x6d: - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); - if (iVar8 == -1) { - FollowParent(this); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - } - else { - bVar1 = IsLilithBirthrightIncubus(this); - game = g_game; - if (bVar1 == 0) { - this->_friction = this->_friction * 0.7; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - scratchVec = (GHIDRA_CAST((room)))->Room::GetClampedPosition(&local_158,&this->_pos,0.0); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); - } - else { - FollowParent(this); - } - PickEnemyTarget(this,800.0,8,0x13,&g_vectorZero,15.0); - } - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); - local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); - if (local_128.y < 1.0) { - iVar8 = 3; - } - PlayFloatAnim(this,iVar8); - break; - case 0x6e: - pfVar10 = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); - local_150.x = *pfVar10; - local_150.y = pfVar10[1]; - bVar1 = (GHIDRA_CAST((&local_150)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 != 0) { - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetHeadDirection(); - scratchVec = Isaac::GetAxisAlignedUnitVectorFromDir(&local_158,iVar8); - (GHIDRA_CAST((&local_150)))->Vector::operator_assign(scratchVec); - bVar1 = (GHIDRA_CAST((&local_150)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 != 0) { - scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(0.0,1.0); - (GHIDRA_CAST((&local_150)))->Vector::operator_assign(scratchVec); - } - } - local_128.y = (GHIDRA_CAST((&local_150)))->Vector::GetAngleDegrees(); - fVar13 = LerpAngleDeg(this->_orbitAngleOffset,local_128.y,0.3); - this->_orbitAngleOffset = fVar13; - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - pVVar9 = Vector::FromAngle(&local_174,this->_orbitAngleOffset); - local_128.y = 50.0; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_184,&local_128.y); - (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_160,pVVar9); - scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__sub(&local_18c,&this->_pos); - local_128.y = 0.3; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_158,&local_128.y); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(scratchVec); - this->_friction = this->_friction * 0.7; - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_194); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_140,scratchVec); - fVar13 = (GHIDRA_CAST((&local_140)))->Vector::GetAngleDegrees(); - local_128.y = fVar13 - 90.0; - fVar13 = normalize_angle_degrees(local_128.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar13); - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Rotation(); - local_128.y = (float)floatResult; - local_134 = GHIDRA_CAST(CONCAT13(1.0 < local_128.y,(undefined3)local_134)); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_flipX = (*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))); - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - iVar8 = 3; - if (cVar2 != '\0') { - iVar8 = 0x3c; - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(iVar8,0); - if (bVar1 != 0) { - sourceRef = this->_player; - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_158); - techLaser = Entity_Player::FireTechLaser - (sourceRef,&this->_pos,2,scratchVec,0,1,GHIDRA_CAST(this),1.0); - scratchVec = (GHIDRA_CAST((&local_174)))->Vector::Vector(0.0,-10.0); - (GHIDRA_CAST((GHIDRA_CAST(techLaser))))->Entity::SetPositionOffset(scratchVec); - FUN_0044bf90(); - virtualFn = *(code **)(*GHIDRA_CAST(techLaser) + 0x40); - pTVar5 = Entity_Player::GetTearHitParams(self->_player,&local_110,3,1.0,1,GHIDRA_CAST(self)); - local_128.y = pTVar5->_tearDamage * 0.1; - apply_tear_modifiers(self); - (*virtualFn)(); - FUN_0044bfa0(); - FUN_00435bc0(); - FUN_00456830(); - FUN_0060cf00(); - set_field_0x37c(); - techLaser->Update(); - } - break; - case 0x6f: - ai_variant_111(this); - break; - case 0x73: - bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 != 0) { - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&this->_pos); - } - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - ANM2::Play(&this->_sprite,s_Fly,0); - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x1e,this->_index); - if (bVar1 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,150.0,8); - local_14 = 1.54143e-44; - sourceRef = GHIDRA_CAST(0x0); - local_130.y = 0.0; - local_120 = GHIDRA_CAST(0x471c4000); - local_118 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(this)); - if (bVar1 != 0) { - piVar11 = GHIDRA_CAST(std)::vector::operator_index(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SpawnerEntity(); - sourceRef = local_118; - if (*piVar11 != iVar8) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(&local_158); - local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); - if (local_128.y < (float)local_120) { - local_120 = GHIDRA_CAST(local_128.y); - pfVar10 = GHIDRA_CAST(std)::vector::operator_index(); - local_130.y = *pfVar10; - } - } - } - sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); - local_118 = sourceRef; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); - fVar13 = local_130.y; - } while (sourceRef < gridIndexCounts); - if (GHIDRA_CAST(local_130.y) != GHIDRA_CAST(0x0)) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Attack"),1); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_158); - fVar16 = (this->_pos).x; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(scratchVec->x <= fVar16 && fVar16 != scratchVec->x); - uVar4 = Random(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_158); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity::Velocity(&local_174); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_184,pVVar9); - pVVar9 = &self->_pos; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_18c,pVVar9); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Resized(&local_194,10.0); - this = self; - Game::Spawn(g_game,2,1,pVVar9,scratchVec,GHIDRA_CAST(self),0,uVar4); - tear = GHIDRA_CAST(__RTDynamicCast()); - local_128.y = apply_tear_modifiers(this); - fVar13 = apply_tear_modifiers(this); - local_11c = GHIDRA_CAST((fVar13 * 0.2 + 0.6)); - tear->SetCollisionDamage(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((float)local_11c); - FUN_00444c70(); - TryFireTear(this,tear); - tear->Update(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - } - } - local_14 = -NAN; - (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); - } - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - if ((cVar2 != '\0') && (this->_counter = this->_counter + 1, 0x2ed < this->_counter)) { - iVar8 = Player(this); - if (iVar8 != 0) { - sourceRef = GHIDRA_CAST(Player(this)); - playerEffects = GHIDRA_CAST((GHIDRA_CAST((sourceRef)))->Entity_Player)::GetEffects(); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x1f8,1); - } - virtualFn = *(code **)(*GHIDRA_CAST(this) + 0x24); - (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::EntityRef(); - (*virtualFn)(); - } - scratchVec = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(&local_158,&this->_pos); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - this->_friction = this->_friction * 0.8; - break; - case 0x74: - scratchVec = &this->_pos; - local_120 = GHIDRA_CAST(scratchVec); - pVVar9 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_140,pVVar9); - fVar13 = (GHIDRA_CAST((&local_140)))->Vector::GetAngleDegrees(); - local_128.y = fVar13 + 45.0; - fVar13 = normalize_angle_degrees(local_128.y); - local_134 = GHIDRA_CAST(GHIDRA_INT(((1.0 - (fVar13 + 180.0) / 360.0) * 8.0))); - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - local_164 = GHIDRA_CAST(apply_forgotten_lullaby(this,0xc)); - if (this->_fireCooldown < 1) { - local_130.y = 0.0; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),scratchVec,200.0,8); - local_14 = 1.68156e-44; - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 == 0) { -LAB_00621e31: - entityList = GHIDRA_CAST(&DAT_00000004); - } - else { - uVar4 = 0; - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - sourceRef = GHIDRA_CAST(*puVar7); - local_118 = sourceRef; - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(sourceRef))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar1 != 0) && - (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(sourceRef))))->Entity::HasEntityFlags(0x20000010), bVar1 == 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::Position(&local_158); - bVar1 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_120),scratchVec,3,900,0,0,GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::Position(&local_174); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_184,GHIDRA_CAST(local_120)); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_18c); - fVar13 = (GHIDRA_CAST((&local_140)))->Vector::GetAngleDegrees(); - pVVar9 = Vector::FromAngle(&local_194,fVar13 - 45.0); - local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::Dot(pVVar9); - if (0.9 < local_128.y) { - local_130.y = (float)local_118; - } - } - } - fVar13 = local_130.y; - uVar4 = uVar4 + 1; - uVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - this = self; - } while (uVar4 < uVar6); - if (GHIDRA_CAST(fVar13) == GHIDRA_CAST(0x0)) goto LAB_00621e31; - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_158); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_174,&this->_pos); - (GHIDRA_CAST((&local_140)))->Vector::operator_assign(scratchVec); - uVar4 = Random(); - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_158); - local_128.y = 10.0; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_174,&local_128.y); - Game::Spawn(g_game,2,1,&this->_pos,scratchVec,GHIDRA_CAST(this),0,uVar4); - tear = GHIDRA_CAST(__RTDynamicCast()); - FUN_00444c70(); - local_11c = GHIDRA_CAST(apply_tear_modifiers(this)); - fVar13 = apply_tear_modifiers(this); - local_16c.y = fVar13 * 0.35 + 0.7; - tear->SetCollisionDamage(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale(local_16c.y); - TryFireTear(this,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - entityList = local_164; - } - local_14 = -NAN; - this->_fireCooldown = GHIDRA_INT(entityList); - (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); - scratchVec = &this->_pos; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(GHIDRA_INT(local_134)); - pVVar9 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - pVVar9 = GetOrbitPosition(this,&local_174,pVVar9); - goto LAB_0061ec34; - case 0x76: - update_angry_fly(this); - break; - case 0x77: - ai_lil_spewer(this); - break; - case 0x78: - FamiliarAI::sprinkler(this); - break; - case 0x7a: - ai_lil_harbingers(this); - break; - case 0x7b: - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c7fc58) && - (_Init_thread_header(), DAT_00c7fc58 == -1)) { - (GHIDRA_CAST(()))->Color::Color(); - (GHIDRA_CAST(()))->Color::Color(); - (GHIDRA_CAST(()))->Color::Color(); - (GHIDRA_CAST(()))->Color::Color(); - _Init_thread_footer(); - } - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - scratchVec = GetOrbitPosition(this,&local_174,scratchVec); - local_128.y = (float)&this->_pos; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_184,GHIDRA_CAST(local_128.y)); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_164 = (GHIDRA_CAST((room)))->Room::GetEntities(); - sourceRef = GHIDRA_CAST(0x0); - local_130.y = 0.0; - iVar8 = (GHIDRA_CAST((local_164)))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - cVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::IsDead(); - if (cVar2 != '\0') goto LAB_006223ba; - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Type(); - if (iVar8 == 2) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(&local_158); - local_11c = GHIDRA_CAST((GHIDRA_CAST((scratchVec)))->Vector)::DistanceSquared(GHIDRA_CAST(local_128.y)); - fVar13 = 625.0; - if (625.0 <= (float)local_11c) goto LAB_006223d9; - msvc::vector::operator_index(); - local_120 = GHIDRA_CAST(__RTDynamicCast()); - cVar2 = FUN_0060cd80(); - if (cVar2 == '\0') { - Game::GetField26614(g_game); - cVar2 = DeathmatchManager::is_active(); - if (cVar2 != '\0') { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::IsDescendantOf(GHIDRA_CAST(this->_spawnerEntity)); - if (bVar1 == 0) goto LAB_006223ba; - } - flagsOperand = &g_tearFlagLudovico; - scratchFlags = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::TearFlags(&sourceTearFlags); - scratchFlags = BitSet128::operator_and(&sourceLudovicoBits,scratchFlags,flagsOperand); - bVar1 = (GHIDRA_CAST((scratchFlags)))->BitSet128::IsNonZero(); - local_EAX_25497 = local_120; - local_134 = GHIDRA_CAST(CONCAT13(bVar1,(undefined3)local_134)); - if (bVar1 == 0) { - local_120->Remove(); - } - else { - FUN_005cd750(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::GetIntervalTicks(fVar13,0.0); - if (iVar8 == 0) goto LAB_006223ba; - local_EAX_25497 = local_120; - } - local_118 = GHIDRA_CAST(0x0); - local_11c = GHIDRA_CAST(&DAT_00c7fc60); - do { - local_16c.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::InitSeed(); - local_160.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SubType(); - local_150.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SpawnerEntity(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Velocity(&local_174); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Position(&local_184); - uVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Variant(); - Game::Spawn(g_game,2,uVar4,pVVar9,scratchVec,GHIDRA_CAST(local_150.y),GHIDRA_UINT(local_160.y), - GHIDRA_UINT(local_16c.y)); - tear = GHIDRA_CAST(__RTDynamicCast()); - local_EAX_25497 = local_120; - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::Height(); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight((float)floatResult); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Tear::FallingSpeed(); - FUN_00444c70(); - floatResult = (long double)Entity_Tear::FallingAcceleration - (GHIDRA_CAST(local_EAX_25497)); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel((float)floatResult); - FUN_0060cca0(); - FUN_00676bd0(); - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Tear::BaseScale(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((float)floatResult); - scratchFlags = (GHIDRA_CAST((&g_tearFlagLudovico)))->BitSet128::__bnot(¬LudovicoFlags); - flagsOperand = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::TearFlags(&sourceTearFlagsCopy); - scratchFlags = BitSet128::operator_and - (&flagsWithoutLudovico,flagsOperand,scratchFlags); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*scratchFlags); - FUN_0060cd10(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetWaitFrames(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::TearIndex(); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Effect::set_state(iVar8); - virtualFn = *(code **)(*GHIDRA_CAST(tear) + 0x40); - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::CollisionDamage(); - fVar13 = (float)floatResult; - local_150.y = fVar13; - (*virtualFn)(); - local_EAX_25497 = local_120; - (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::Rotation(); - FUN_004aadb0(); - FUN_0060ccf0(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetKnockbackMultiplier(); - FUN_0060cd50(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetDeadEyeIntensity(fVar13); - FUN_0060cd60(); - FUN_0060cd70(); - FUN_0060cda0(); - FUN_0060cd90(); - followTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity)::Parent(); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetParent(followTarget); - followTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity)::SpawnerEntity(); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetSpawnerEntity(followTarget); - local_16c.y = (float)GHIDRA_INT(local_118); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_1c8); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_1c0,30.0 - local_16c.y * 20.0); - } - else { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_18c); - pVVar9 = Vector::FromAngle(&local_194,local_16c.y * 90.0); - local_148.y = 10.0; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1d8,&local_148.y); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_1d0,pVVar9); - } - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetVelocity(scratchVec); - local_EAX_25497 = local_11c; - tear->SetColor(); - tear->Update(); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - local_11c = GHIDRA_CAST(&local_EAX_25497->_variant); - local_EAX_25497 = local_120; - } while (GHIDRA_INT(local_11c) < 0xc7fd10); -LAB_006223ae: - this = self; - goto LAB_006223b4; - } - } - else { -LAB_006223d9: - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Type(); - if (iVar8 == 4) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Position(&local_1e8); - local_150.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); - if (625.0 <= local_150.y) goto LAB_00622693; - msvc::vector::operator_index(); - local_EAX_25497 = GHIDRA_CAST(__RTDynamicCast()); - local_120 = local_EAX_25497; - cVar2 = FUN_0060cdd0(); - if ((cVar2 == '\0') && - (cVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Bomb::IsFetus(), cVar2 != '\0')) { - local_EAX_25497->Remove(); - local_118 = GHIDRA_CAST(0x0); - local_134 = GHIDRA_CAST(&DAT_00c7fc60); - do { - local_150.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::InitSeed(); - local_160.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SubType(); - local_11c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity)::SpawnerEntity(); - local_16c.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Velocity(&local_1e0); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Position(&local_228); - uVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Variant(); - uVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Type(); - Game::Spawn(g_game,uVar6,uVar4,scratchVec,GHIDRA_CAST(local_16c.y),GHIDRA_CAST(local_11c), - GHIDRA_UINT(local_160.y),GHIDRA_UINT(local_150.y)); - bomb = GHIDRA_CAST(__RTDynamicCast()); - local_EAX_25497 = local_120; - (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Bomb::IsFetus(); - FUN_0060cdb0(); - (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity::AddEntityFlags(0x4000000); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::GridCollisionClass(); - FUN_0044bfa0(); - FUN_0060cde0(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Bomb::Flags(&bombFlags); - FUN_006a6910(); - floatResult = (long double)Entity_Tear::FallingAcceleration - (GHIDRA_CAST(local_EAX_25497)); - (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity_Projectile::set_falling_accel((float)floatResult); - iVar8 = Player(local_EAX_25497); - (GHIDRA_CAST((bomb)))->Entity_Bomb::SetExplosionCountdown(iVar8); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Bomb::RadiusMultiplier(); - FUN_00435e70(); - local_11c = GHIDRA_CAST((30.0 - (float)GHIDRA_INT(local_118) * 20.0)); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity::Velocity(&local_210); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_218,(float)local_11c); - (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity::SetVelocity(scratchVec); - FUN_0060cdf0(); - FUN_00456820(); - FUN_0060ce00(); - FUN_0060ce10(); - bomb->SetColor(); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - local_134 = GHIDRA_CAST((GHIDRA_INT(local_134) + 0x2c)); - } while (GHIDRA_INT(local_134) < 0xc7fd10); - goto LAB_006223ae; - } -LAB_006223b4: - sourceRef = GHIDRA_CAST(local_130.y); - } - else { -LAB_00622693: - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Type(); - if (iVar8 == 7) { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::SubType(); - if (iVar8 == 2) { - msvc::vector::operator_index(); - tear = GHIDRA_CAST(__RTDynamicCast()); - local_134 = tear; - cVar2 = FUN_0060cef0(); - if (cVar2 == '\0') { - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Laser::Radius(); - local_160.y = (float)(floatResult * (long double)0.5); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Position(&local_220); - local_150.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); - if (local_150.y <= local_160.y * local_160.y) { - local_118 = GHIDRA_CAST(0x0); -LAB_00622760: - local_150.y = (float)Random(); - local_160.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SubType(); - local_11c = this->_player; - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_140); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Position(GHIDRA_CAST((local_1a4 + 8))); - uVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::Variant(); - Game::Spawn(g_game,7,uVar4,pVVar9,scratchVec,GHIDRA_CAST(local_11c), - GHIDRA_UINT(local_160.y),GHIDRA_UINT(local_150.y)); - local_EAX_25497 = GHIDRA_CAST(__RTDynamicCast()); - local_120 = local_EAX_25497; - scratchVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity)::PositionOffset(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetPositionOffset(scratchVec); - (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity_Laser::Radius(); - FUN_0060ce80(); - this = self; - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetSpawnerEntity(self->_player); - FUN_00435f70(); - scratchFlags = (GHIDRA_CAST((local_134)))->Entity_Tear::TearFlags(&local_90); - fVar13 = *GHIDRA_CAST(&scratchFlags->_l); - FUN_00456830(); - FUN_0060ce70(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Laser::SetMaxDistance(fVar13); - FUN_0060ced0(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Laser::SetBlackHpDropChance(); - virtualFn = *(code **)(*GHIDRA_CAST(local_EAX_25497) + 0x40); - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::CollisionDamage(); - local_150.y = (float)floatResult; - (*virtualFn)(); - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::DepthOffset(); - local_EAX_25497 = local_120; - set_field_358(local_120,(float)floatResult); - (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::InitSeed(); - FUN_005b15a0(); - (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::GridCollisionClass(); - FUN_0044bfa0(); - FUN_0060ce60(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Laser::SetHomingType(); - (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::SpawnerType(); - FUN_004316b0(); - scratchVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity)::TargetPosition(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetTargetPosition(*scratchVec); - FUN_0060cee0(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Laser::SetMultidimensionalTouched(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetParent(this->_player); - FUN_00579760(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Laser::SetTimeout(); - FUN_0060ce30(); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity_Laser::SetOneHit(); - FUN_0060ce50(); - FUN_0060ce40(); - (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::Visible(); - FUN_0044bf90(); - if (local_118 == GHIDRA_CAST(0x0)) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Velocity(&local_230); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_238,-30.0); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetVelocity(scratchVec); - virtualFn = *(code **)(*GHIDRA_CAST(local_EAX_25497) + 0x3c); - (GHIDRA_CAST((&local_54)))->Color::Color(); -LAB_00622a96: - (*virtualFn)(); - local_EAX_25497 = local_120; -LAB_00622ab7: - FUN_005cd5a0(); - local_EAX_25497->Update(); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - if (3 < GHIDRA_INT(local_118)) goto LAB_00622b6f; - tear = local_134; - goto LAB_00622760; - } - if (local_118 == GHIDRA_CAST(0x1)) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Velocity(GHIDRA_CAST(&local_248._h)); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(GHIDRA_CAST(&local_258._h),-10.0); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetVelocity(scratchVec); -LAB_00622a6e: - virtualFn = *(code **)(*GHIDRA_CAST(local_EAX_25497) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - goto LAB_00622a96; - } - if (local_118 == GHIDRA_CAST(0x2)) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Velocity(&local_1f0); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(GHIDRA_CAST(&local_208._h),10.0); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetVelocity(scratchVec); - goto LAB_00622a6e; - } - if (local_118 != GHIDRA_CAST(0x3)) goto LAB_00622ab7; - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Velocity(GHIDRA_CAST(&local_1b8._h)) - ; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_60,30.0); - (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::SetVelocity(scratchVec); - virtualFn = *(code **)(*GHIDRA_CAST(local_EAX_25497) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*virtualFn)(); - local_EAX_25497 = local_120; - FUN_005cd5a0(); - local_EAX_25497->Update(); -LAB_00622b6f: - (**(code **)(*GHIDRA_CAST(local_134) + 0x28))(); - } - } - goto LAB_006223b4; - } - } - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(*puVar7))))->Entity::Type(); - if (iVar8 == 8) { - msvc::vector::operator_index(); - local_130.y = (float)FUN_0060cc90(); - cVar2 = FUN_0060cfd0(); - if ((cVar2 == '\0') && - (cVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Knife::IsFlying(), cVar2 != '\0')) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); - local_150.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); - if (local_150.y <= 625.0) { - (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Knife::spawn_child_knife(); - } - } - } - } - } -LAB_006223ba: - sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); - local_130.y = (float)sourceRef; - gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((local_164)))->EntityList)::Size(); - } while (sourceRef < gridIndexCounts); - } - break; - case 0x7c: - FamiliarAI::mystery_egg(this); - break; - case 0x7d: - FamiliarAI::lil_spewer(this); - break; - case 0x7f: - pfVar10 = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); - local_160.x = *pfVar10; - local_160.y = pfVar10[1]; - bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 != 0) { - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetHeadDirection(); - scratchVec = Isaac::GetAxisAlignedUnitVectorFromDir(GHIDRA_CAST((local_78 + 8)),iVar8); - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); - bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 != 0) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0,1.0); - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); - } - } - fVar16 = 120.0; - iVar8 = Game::GetFrameCount(g_game); - fVar13 = sinf_wrapper(((float)iVar8 / 30.0) * 3.1415927); - local_150.y = assert_lerp_range(fVar13,-1.0,1.0,20.0,fVar16,1); - local_148.y = (GHIDRA_CAST((&local_160)))->Vector::GetAngleDegrees(); - fVar13 = LerpAngleDeg(this->_orbitAngleOffset,local_148.y,0.4); - this->_orbitAngleOffset = fVar13; - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_60); - pVVar9 = Vector::FromAngle(GHIDRA_CAST((local_78 + 8)),this->_orbitAngleOffset); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(GHIDRA_CAST(&local_1b8._h),&local_150.y); - (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_140,pVVar9); - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__sub(GHIDRA_CAST(&local_208._h),&this->_pos); - local_148.y = 0.8; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(GHIDRA_CAST((local_78 + 8)),&local_148.y); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - this->_friction = this->_friction * 0.7; - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_1f0); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_128,scratchVec); - fVar13 = (GHIDRA_CAST((&local_128)))->Vector::GetAngleDegrees(); - local_148.y = fVar13 - 90.0; - local_148.y = normalize_angle_degrees(local_148.y); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_rotation = local_148.y; - floatResult = (long double)(GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Rotation(); - local_148.y = (float)floatResult; - local_134 = GHIDRA_CAST(CONCAT13(1.0 < local_148.y,(undefined3)local_134)); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - layer->_flipX = (*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(7,0); - if (bVar1 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar8 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&this->_pos); - if (-1 < iVar8) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - sourceRef = (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::EntityRef(); - (GHIDRA_CAST((room)))->Room::DamageGridWithSource(iVar8,1,sourceRef); - } - } - break; - case 0x80: - animState = GHIDRA_CAST(Config)::GetPillEffects(); - bVar1 = AnimationState::IsLoopingAnimation(animState); - if (bVar1 == 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::MultiplyFriction(); - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - sprintf_s(idleAnimName,0x20,GHIDRA_CAST("Idle%d")); - ANM2::Play(&this->_sprite,idleAnimName,0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar8 = AnimationState::GetAnimationLength(animState); - iVar8 = Isaac::Random(iVar8); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(iVar8); - } - } - else { - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - GetOrbitPosition(this,&local_150,scratchVec); - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Velocity(&local_158); - local_128.y = 2.0; - (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_148,&local_128.y); - scratchVec = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_158,&local_148); - scratchVec = (GHIDRA_CAST((&local_150)))->Vector::__sub(&local_174,scratchVec); - local_128.y = 0.5; - (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_140,&local_128.y); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (iVar8 < 0x28) { - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - fVar13 = Math::clamp((float)(iVar8 + -10) / 30.0,0.06,1.0); - local_118 = GHIDRA_CAST((1.0 / fVar13 + 4.0)); - } - else { - local_118 = GHIDRA_CAST(0x40a00000); - } - local_128.y = (GHIDRA_CAST((&local_140)))->Vector::Length(); - if ((float)local_118 < local_128.y) { - (GHIDRA_CAST((&local_140)))->Vector::Resize((float)local_118 - 1.0); - } - scratchVec = (GHIDRA_CAST((&local_148)))->Vector::__add(&local_158,&local_140); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__div(&local_174,&this->_friction); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - } - break; - case 0x81: - cVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Visible(); - if (cVar2 == '\0') { -LAB_0061e4de: - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - } - else { - bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 == 0) { - scratchVec = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(GHIDRA_CAST((local_78 + 8)),&this->_pos); - local_148.y = 0.5; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_60,&local_148.y); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered(s_Spawn); - if (bVar1 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_EAX_25497 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetGridIndex(&this->_pos); - local_148.y = (float)local_EAX_25497; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - gridEntity = (GHIDRA_CAST((room)))->Room::GetGridEntity(GHIDRA_UINT(local_EAX_25497)); - if (((gridEntity == GHIDRA_CAST(0x0)) || - (iVar8 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar8 == 1)) || - (iVar8 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar8 == 10)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar1 = (GHIDRA_CAST((room)))->Room::is_type_16(); - if (bVar1 == 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - (GHIDRA_CAST((room)))->Room::SpawnGridEntity(GHIDRA_INT(local_148.y),0xe,6,uVar4,0); - Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,0,0); - } - } - SoundEffects::PlayWithFartOverride(0x25,1.0,2,0,1.0); - } - bVar1 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar1 != 0) { - FUN_0044bf90(); - } - } - else { - FollowParent(this); - } - } - break; - case 0x83: - update_idle_anim_by_size(this); - MoveDelayed(this,5); - break; - case 200: - ai_boiled_baby(this); - break; - case 0xc9: - zhl_misfit_006414c0(this); - break; - case 0xca: - ai_shadow_intruder_damocles(this,0); - break; - case 0xcb: - ai_blood_oath(this); - break; - case 0xcc: - FamiliarAI::variant_204(this); - break; - case 0xce: - case 0xed: - ai_wisp(this); - break; - case 0xd0: - FollowParent(this); - sprite = &this->_sprite; - local_148.y = (float)sprite; - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (iVar8 == 0) { -LAB_00623343: - ANM2::Play(&this->_sprite,GHIDRA_CAST("FloatDown"),0); - } - else { - bVar1 = ANM2::IsPlaying(sprite,GHIDRA_CAST("FloatDown")); - if ((bVar1 == 0) && (bVar1 = ANM2::IsFinishedImpl(sprite,&s_empty), bVar1 == 0)) { - bVar1 = ANM2::IsPlaying(sprite,s_Spawn); - if ((bVar1 != 0) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::IsEventTriggered("Shoot"), bVar1 != 0) - ) { - SoundEffects::PlayWithFartOverride(0xb2,1.0,2,0,1.0); - iVar8 = Isaac::Random(3); - local_16c.y = (float)(iVar8 + 4); - fVar13 = apply_tear_modifiers(this); - local_11c = GHIDRA_CAST((fVar13 * 3.5)); - if (0 < GHIDRA_INT((iVar8 + 4))) { - do { - MusicManager::RandomVector(&local_140); - local_148.y = 10.0; - (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(&local_148.y); - fVar13 = random_float(); - local_150.y = fVar13 * 0.2 + 0.7; - (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(&local_150.y); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); - if (bVar1 == 0) { - FUN_00431270(); - (GHIDRA_CAST((GHIDRA_CAST(local_a8))))->Color::Color(); - if (this->_isLilDelirium != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_a8))))->Color::SetColorize(2.4,2.4,2.4,1.0); - } - uVar4 = Random(); - tear = (Entity_Tear *) - Game::Spawn(g_game,2,1,&this->_pos,&local_140,GHIDRA_CAST(this),0,uVar4); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel(0.8); - random_float(); - FUN_00444c70(); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x0))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x8))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = pcStack_6c; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); - tear->SetColor(); - iVar8 = Isaac::Random(2); - if (iVar8 == 0) { - fVar13 = random_float(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((fVar13 * 0.05 + 0.9) * 0.8); - } - else { - fVar13 = random_float(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((fVar13 * 0.05 + 1.3) * 0.8); - } - tear->SetCollisionDamage(); - TryFireTear(this,tear); - } - else { - uVar4 = Random(); - tear = (Entity_Tear *) - Game::Spawn(g_game,9,0,&this->_pos,&local_140,GHIDRA_CAST(this),0,uVar4); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel(0.8); - random_float(); - FUN_00444c70(); - iVar8 = Isaac::Random(2); - if (iVar8 == 0) { - random_float(); - } - else { - random_float(); - } - FUN_004508a0(); - } - tear->Update(); - local_16c.y = (float)&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_16c.y) + -0x848))))) + 0x847))); - } while (GHIDRA_CAST(local_16c.y) != GHIDRA_CAST(0x0)); - local_16c.y = 0.0; - } - } - } - else { - ANM2::Play(sprite,GHIDRA_CAST("FloatDown"),0); - iVar8 = apply_forgotten_lullaby(this,4); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(iVar8,0); - if (bVar1 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar8 = (GHIDRA_CAST((room)))->Room::GetAliveEnemiesCount(); - if (0 < iVar8) { - local_11c = GHIDRA_CAST(0x42a00000); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); - if (bVar1 != 0) { - local_11c = GHIDRA_CAST(0x43340000); - } - sourceRef = GHIDRA_CAST(0x0); - local_130.y = 0.0; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius - (entityList,GHIDRA_CAST(local_78),&this->_pos,(float)local_11c,8); - local_14 = 1.96182e-44; - local_118 = GHIDRA_CAST(0x0); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); - if (iVar8 != 0) { - do { - puVar7 = GHIDRA_CAST(std)::vector::operator_index(); - followTarget = GHIDRA_CAST(*puVar7); - if (followTarget != GHIDRA_CAST(0x0)) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); - if ((bVar1 == 0) || - ((bVar1 = (GHIDRA_CAST((followTarget)))->Entity::is_player(), bVar1 == 0 && - ((bVar1 = (GHIDRA_CAST((followTarget)))->Entity::IsFamiliar(), bVar1 == 0 || - (bVar1 = (GHIDRA_CAST((followTarget)))->Entity::HasEntityFlags(0x100), bVar1 != 0)))))) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); - if ((bVar1 == 0) && - (bVar1 = (GHIDRA_CAST((followTarget)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar1 != 0)) - { - local_130.y = (float)(GHIDRA_INT(local_130.y) + 1); - } - } - else { - local_130.y = (float)(GHIDRA_INT(local_130.y) + 1); - } - } - sourceRef = GHIDRA_CAST(local_130.y); - local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); - listSize = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); - } while (local_118 < listSize); - } - iVar8 = 5; - if (GHIDRA_INT(sourceRef) < 1) { - iVar8 = 0x14; - } - iVar8 = Isaac::Random(iVar8); - if (iVar8 != 0) goto LAB_0061f2a8; - ANM2::Play(GHIDRA_CAST(local_148.y),s_Spawn,1); - gridIndexCounts = local_78; - goto LAB_006241ee; - } - } - } - } - break; - case 0xd2: - ai_bird_cage(this); - break; - case 0xd3: - FamiliarAI::lost_soul(this); - break; - case 0xd4: - FamiliarAI::lil_dumpy(this); - break; - case 0xd8: - case 0xd9: - FamiliarAI::tinytoma(this); - break; - case 0xda: - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_78 + 8))); - scratchVec = GetOrbitPosition(this,&local_60,scratchVec); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(GHIDRA_CAST(&local_1b8._h),&this->_pos); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - ai_bot_fly(this); - break; - case 0xdd: - FUN_006401d0(); - break; - case 0xde: - ai_stitches(this); - break; - case 0xe0: - FUN_0063e180(); - break; - case 0xe1: - FUN_006403f0(); - break; - case 0xe2: - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_78 + 8))); - scratchVec = GetOrbitPosition(this,&local_60,scratchVec); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(GHIDRA_CAST(&local_1b8._h),&this->_pos); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000000000); - if (bVar1 == 0) { - ANM2::Play(&this->_sprite,s_Idle,0); - local_160.y = (float)(this->_chargeLevel + -1); - local_128.y = 0.0; - piVar11 = GHIDRA_CAST(std)::max(); - } - else { - ANM2::Play(&this->_sprite,&DAT_00b602e8,0); - local_148.y = (float)(this->_chargeLevel + 1); - local_150.y = 7.00649e-45; - piVar11 = GHIDRA_CAST(std)::min(); - } - this->_chargeLevel = *piVar11; - local_148.y = 1.0; - local_150.y = (float)this->_chargeLevel * 0.2; - puVar7 = GHIDRA_CAST(std)::min(); - local_11c = GHIDRA_CAST(*puVar7); - local_150.y = 0.3; - local_148.y = (float)this->_chargeLevel * 0.06; - pfVar10 = GHIDRA_CAST(std)::min(); - local_16c.y = *pfVar10 + 0.7; - sfx = MusicManager::SFXManager(); - bVar1 = SFXManager::IsPlaying(sfx,0x393); - if (bVar1 == 0) { - if (0 < this->_chargeLevel) { - SoundEffects::PlayWithFartOverride(0x393,(float)local_11c,0,1,local_16c.y); - } - } - else if (this->_chargeLevel < 1) { - sfx = MusicManager::SFXManager(); - SFXManager::Stop(sfx,0x393); - } - else { - sfx = MusicManager::SFXManager(); - SFXManager::AdjustVolume(sfx,0x393,(float)local_11c); - sfx = MusicManager::SFXManager(); - SFXManager::AdjustPitch(sfx,0x393,local_16c.y); - } - break; - case 0xe4: - ai_minisaac(this); - break; - case 0xe5: - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_78 + 8))); - GetOrbitPosition(this,&local_160,scratchVec); - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Velocity(&local_60); - local_148.y = 2.0; - (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_150,&local_148.y); - scratchVec = (GHIDRA_CAST((&this->_pos)))->Vector::__add(GHIDRA_CAST(&local_1b8._h),&local_150); - scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__sub(GHIDRA_CAST((local_78 + 8)),scratchVec); - local_148.y = 0.5; - (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_140,&local_148.y); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (iVar8 < 0x28) { - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - fVar13 = Math::clamp((float)(iVar8 + -10) / 30.0,0.06,1.0); - local_11c = GHIDRA_CAST((1.0 / fVar13 + 4.0)); - } - else { - local_11c = GHIDRA_CAST(0x40a00000); - } - local_148.y = (GHIDRA_CAST((&local_140)))->Vector::Length(); - if ((float)local_11c < local_148.y) { - (GHIDRA_CAST((&local_140)))->Vector::Resize((float)local_11c - 1.0); - } - scratchVec = (GHIDRA_CAST((&local_150)))->Vector::__add(GHIDRA_CAST((local_78 + 8)),&local_140); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__div(&local_60,&this->_friction); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - break; - case 0xe7: - FamiliarAI::apollyons_best_friend(this); - break; - case 0xe9: - FamiliarAI::worm_friend(this); - break; - case 0xea: - animState = GHIDRA_CAST(Config)::GetPillEffects(); - bVar1 = AnimationState::IsLoopingAnimation(animState); - if (bVar1 != 0) { - fVar13 = assert_lerp_range(this->_updateTime,0.0,15.0,1.0,0.8,1); - this->_friction = fVar13 * this->_friction; - } - break; - case 0xeb: - local_EAX_25497 = this->_player; - local_120 = local_EAX_25497; - update_weapon(this,0); - pfVar10 = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); - local_160.x = *pfVar10; - local_160.y = pfVar10[1]; - if ((((0 < this->_headFrameDelay) || (0 < this->_counter)) && - (bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero), bVar1 != 0)) && - (bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), bVar1 != 0)) { - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(&this->_targetPosition); - } - bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero); - if (bVar1 != 0) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0,1.0); - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); - } - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&local_160); - local_130.y = 0.4; - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x94,0); - local_134 = GHIDRA_CAST(CONCAT13(bVar1,(undefined3)local_134)); - if (bVar1 != 0) { - scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(26.0,26.0); - (GHIDRA_CAST((&this->_orbitDistance)))->Vector::operator_assign(scratchVec); - game = g_game; - this->_orbitSpeed = 3.5; - iVar8 = Game::GetFrameCount(game); - scratchVec = Vector::FromAngle(&local_60, - (float)iVar8 * this->_orbitSpeed - this->_orbitAngleOffset); - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); - local_130.y = 0.8; - } - scratchVec = (GHIDRA_CAST((&local_160)))->Vector::Rotated(GHIDRA_CAST((local_78 + 8)),-90.0); - local_148.y = 26.0; - scratchVec = Vector::operator_mul(&local_60,&local_148.y,scratchVec); - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar8 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (0x1e < iVar8) { - local_11c = this; - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Parent(); - if (iVar8 != 0) { - do { - followTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::Parent(); - bVar1 = (GHIDRA_CAST((followTarget)))->Entity::IsFamiliar(); - if (bVar1 == 0) break; - this = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::Parent(); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Parent(); - } while (iVar8 != 0); - local_11c = this; - } - scratchVec = GHIDRA_CAST(FUN_004172b0()); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_11c))))->Entity::Velocity(&local_60); - local_148.y = 1.0 - local_130.y; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(GHIDRA_CAST(&local_1b8._h),&local_148.y); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__div(GHIDRA_CAST(&local_208._h),&local_130.y); - (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_140,pVVar9); - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Position(&local_1f0); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_60,&local_160); - local_148.y = (GHIDRA_CAST((&local_140)))->Vector::DistanceSquared(scratchVec); - scratchVec = (GHIDRA_CAST((pVVar9)))->Vector::__sub(GHIDRA_CAST(&local_1b8._h),&local_160); - local_150.y = (GHIDRA_CAST((&local_140)))->Vector::DistanceSquared(scratchVec); - if (local_150.y < local_148.y) { - scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__unm(GHIDRA_CAST((local_78 + 8))); - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); - } - local_EAX_25497 = local_120; - this = self; - } - } - if (((GHIDRA_CAST(this->_parent) != GHIDRA_CAST(0x0)) && - (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::IsFamiliar(), bVar1 != 0)) && - (iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::Parent(), iVar8 != 0)) { - local_EAX_25497 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity)::Parent(); - } - if (this->_subtype == 1) { - scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__unm(GHIDRA_CAST((local_78 + 8))); - (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); - } - scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_EAX_25497))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); - (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_128,&local_160); - scratchVec = (GHIDRA_CAST((&local_128)))->Vector::__sub(&local_60,&this->_pos); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(GHIDRA_CAST((local_78 + 8)),&local_130.y); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); - this->_friction = this->_friction * 0.8; - break; - case 0xec: - FamiliarAI::star_of_bethlehem(this); - break; - case 0xee: - ai_blood_clot(this,0); - break; - case 0xef: - FamiliarAI::cube_baby(this); - break; - case 0xf0: - ai_umbilical_baby(this,0); - break; - case 0xf1: - FamiliarAI::blood_puppy(this); - break; - case 0xf2: - FamiliarAI::vanishing_twin(this); - break; - case 0xf3: - if (this->_state < 1) { - fVar13 = (this->_targetPosition).x; - if ((0.0 <= fVar13) && - (pfVar10 = &(this->_targetPosition).y, 0.0 < *pfVar10 || *pfVar10 == 0.0)) - goto LAB_0061fc21; - fVar16 = (this->_targetPosition).y; - fallVelocity = this->_speedMultiplier * 1.2 + fVar16; - fVar13 = this->_speedMultiplier * fVar16 + fVar13; - (this->_targetPosition).x = fVar13; - (this->_targetPosition).y = fallVelocity; - if ((fallVelocity < 0.0) || (iVar8 = 5, fallVelocity < -26.0)) { - iVar8 = 3; - } - this->_entityGridCollisionClass = iVar8; - if (0.0 < fVar13) { - (this->_targetPosition).x = 0.0; - (this->_targetPosition).y = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x400000000000000); - iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(); - if ((iVar8 == 0x10) || (iVar8 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(), iVar8 == 0x23)) - { - play_sound_with_fart_seed(499,1.0,2,0,1.0); - play_sound_with_fart_seed(0x1d3,1.0,2,0,1.0); - } - else { - play_sound_with_fart_seed(0x48,1.0,2,0,1.0); - uVar4 = Random(); - followTarget = Game::Spawn(g_game,1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar4); - followTarget->Update(); - } - } - } - else { - if (this->_state == 1) { - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(0); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x400000000000000); - uVar4 = this->_state & 0x80000003; - isEveryFourthState = uVar4 == 0; - if (GHIDRA_INT(uVar4) < 0) { - isEveryFourthState = (uVar4 - 1 | 0xfffffffc) == 0xffffffff; - } - if (isEveryFourthState) { - virtualFn = *(code **)(*GHIDRA_CAST(this) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*virtualFn)(); - } - this->_entityGridCollisionClass = 0; - (GHIDRA_CAST((this->_player)))->Entity::Position(&local_140); - local_128.y = assert_lerp_range((float)this->_state,0.0,15.0,1.0,16.0,1); - this->_state = this->_state + 1; - scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__sub(&local_158,&this->_pos); - bVar1 = 0; - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Resized(&local_174,local_128.y); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity(scratchVec,bVar1); - iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0); - if (iVar8 != 0) { - uVar4 = Random(); - local_128.y = 0.5; - scratchVec = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&local_158,&local_128.y); - followTarget = Game::Spawn(g_game,1000,0x6f,&this->_pos,scratchVec,GHIDRA_CAST(this),0,uVar4); - scratchVec = (GHIDRA_CAST((&local_174)))->Vector::Vector(0.0,-8.0); - scratchVec = (GHIDRA_CAST((&this->_posOffset)))->Vector::__add(&local_184,scratchVec); - (GHIDRA_CAST((followTarget)))->Entity::SetPositionOffset(scratchVec); - set_field_358(followTarget,-5.0); - followTarget->Update(); - } -LAB_0061fc21: - this->_friction = this->_friction * 0.85; - } - local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); - if ((3.0 < local_128.y) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0), bVar1 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_NPC::MakeSplat(0.5); - } - followTarget = this->_player; - (this->_posOffset).y = (this->_targetPosition).x; - scratchVec = (GHIDRA_CAST((followTarget)))->Entity::Position(&local_158); - scratchVec = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_174,scratchVec); - local_140.x = scratchVec->x; - local_140.y = scratchVec->y; - FUN_007792f0(); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000000000); - if (bVar1 == 0) { - if (this->_state < 1) { - local_118 = GHIDRA_CAST(0x43c80000); - } - else { - local_118 = GHIDRA_CAST(0x44c80000); - } - scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); - local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); - if (local_128.y <= (float)local_118) { - Entity_Player::AnimateCollectible - (this->_player,0x2d9,GHIDRA_CAST("HideItem"),GHIDRA_CAST("PlayerPickupSparkle")); - play_sound_with_fart_seed(0xf9,1.0,2,0,1.0); - playerEffects = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetEffects(); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x2d9,-1); - this->Remove(); - } - } - } -switchD_0061ddf2_caseD_12: -LAB_00624200: - bVar1 = (GHIDRA_CAST((&self->_orbitDistance)))->Vector::operator_ne(&g_vectorZero); - if (bVar1 != 0) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::HasEntityFlags(0x20000000000); - if (bVar1 != 0) { - fVar13 = normalize_angle_degrees(self->_orbitAngleOffset - self->_orbitSpeed * 10.0); - self->_orbitAngleOffset = fVar13; - cVar2 = FUN_0060d120(); - if ((cVar2 != '\0') && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::IsFrame(4,0), bVar1 != 0)) { - virtualFn = *(code **)(*GHIDRA_CAST(self) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*virtualFn)(); - } - } - local_EAX_25497 = self; - if (self->_orbitLayer == 8) { - playerEffects = GHIDRA_CAST((GHIDRA_CAST((self->_player)))->Entity_Player)::GetEffects(); - bVar1 = (GHIDRA_CAST((playerEffects)))->TemporaryEffects::HasCollectibleEffect(0x4d); - if (bVar1 == 0) { - playerEffects = GHIDRA_CAST((GHIDRA_CAST((local_EAX_25497->_player)))->Entity_Player)::GetEffects(); - bVar1 = (GHIDRA_CAST((playerEffects)))->TemporaryEffects::HasCollectibleEffect(0x12a); - if (bVar1 == 0) goto LAB_0062434e; - } - fVar13 = normalize_angle_degrees - (local_EAX_25497->_orbitAngleOffset - local_EAX_25497->_orbitSpeed * 0.5); - local_EAX_25497->_orbitAngleOffset = fVar13; - } - } -LAB_0062434e: - FUN_00860f00(); - iVar8 = FUN_0060d6a0(); - if (iVar8 < 1) { - local_EAX_25497 = self; - } - else { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::IsFrame(iVar8,self->_index); - local_EAX_25497 = self; - if (bVar1 != 0) { - if ((self->_variant != 0x18) && (self->_variant != 0x66)) { - (GHIDRA_CAST((&self->_hitList)))->msvc::vector::clear(0); - } - } - } - fVar13 = apply_tear_modifiers(local_EAX_25497); - if (1.0 < fVar13) { - iVar8 = self->_variant; - if (iVar8 == 0xe7) { - scratchVec2 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(self))))->Entity)::SpriteScale(); - pVVar9 = &local_148; - local_148.y = 1.1; - scratchVec = GHIDRA_CAST((local_78 + 8)); - } - else { - if (((iVar8 == 900) || (iVar8 == 0x3e)) || (iVar8 == 0xd3)) goto LAB_0062442e; - scratchVec2 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(self))))->Entity)::SpriteScale(); - pVVar9 = &local_150; - local_150.y = 1.25; - scratchVec = &local_60; - } - scratchVec = (GHIDRA_CAST((scratchVec2)))->Vector::__mul(scratchVec,&pVVar9->y); - (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::SetSpriteScale(scratchVec); - } -LAB_0062442e: - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar1 = (GHIDRA_CAST((room)))->Room::is_type_16(); - if ((bVar1 != 0) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::IsFlying(), bVar1 == 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - scratchVec = &self->_pos; - gridEntity = (GHIDRA_CAST((room)))->Room::GetGridEntityFromPos(scratchVec); - if (((gridEntity != GHIDRA_CAST(0x0)) && - (iVar8 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar8 == 0x13)) || - ((self->_variant == 0x4b || (self->_variant == 900)))) { - fVar13 = (self->_velocity).y; - if (self->_variant == 900) { - (self->_velocity).y = fVar13 + 0.8; - } - else { - pVVar9 = &self->_velocity; - (self->_velocity).y = fVar13 * 0.5; - if (pVVar9->x <= 0.0) { - if (pVVar9->x < 0.0) { - local_148.y = (GHIDRA_CAST((pVVar9)))->Vector::Length(); - pVVar9->x = -local_148.y; - } - } - else { - fVar13 = (GHIDRA_CAST((pVVar9)))->Vector::Length(); - pVVar9->x = fVar13; - } - game = g_game; - (self->_velocity).y = 0.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0, - (self->_sizeMulti).y * self->_size + 0.5); - scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_60,pVVar9); - local_140.x = scratchVec->x; - local_140.y = scratchVec->y; - iVar8 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(*scratchVec); - if (iVar8 != 4) { - bVar1 = 0; - scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0,3.5); - (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::AddVelocity_divided(scratchVec,bVar1); - } - } - } - } - (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::Update(); - ANM2::Update(&self->_chargeBarSprite); - if (self->_dead != 0) { - self->Remove(); - } - gridIndexCounts = &(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf3c))); - if (GHIDRA_CAST(self->_target) != GHIDRA_CAST(0x0)) { - local_148.y = (float)(GHIDRA_CAST((GHIDRA_CAST(self->_target))))->PathFinder::GetGridIndex(); - piVar11 = map_find_value(gridIndexCounts,GHIDRA_UINT(&local_148.y)); - *piVar11 = *piVar11 + 1; - } - FUN_0042c770(); - msvc::iterator_copy(gridIndexCounts,&local_148.y); - cVar2 = FUN_0042c710(); - while (cVar2 != '\0') { - iVar8 = FUN_005cba30(); - if (*GHIDRA_CAST((iVar8 + 4)) < 0) { - iVar8 = FUN_005cba30(); - *GHIDRA_CAST((iVar8 + 4)) = *GHIDRA_CAST((iVar8 + 4)) + 1; - } - iVar8 = FUN_005cba30(); - if (*GHIDRA_CAST((iVar8 + 4)) == 0) { - pfVar10 = GHIDRA_CAST(FUN_00651db0()); - local_118 = GHIDRA_CAST(*pfVar10); - } - else { - set_iterator_post_increment(&local_118,&local_17c.y,0); - } - msvc::iterator_copy(gridIndexCounts,&local_148.y); - cVar2 = FUN_0042c710(); - } - ExceptionList = local_1c; - return; -switchD_0061ddf2_caseD_62: - MoveDelayed(this,0x14); - goto switchD_0061ddf2_caseD_12; -} - -// 00624a80 -void Entity_Familiar::Interpolate() -{ - float fVar1; - uint8_t isEffectActive; - float velocityX; - float baseFriction; - float baseFriction; - int orbitLayer; - void *player; - - switch(this->_variant) { - case 0x3d: - ai_incubus_shot(); - break; - case 0x50: - update_weapon(this,1); - break; - case 0xca: - ai_shadow_intruder_damocles(this,1); - break; - case 0xee: - fVar1 = this->_speedMultiplier; - baseFriction = this->_friction; - if (fVar1 != 1.0) { - baseFriction = baseFriction / ((baseFriction + fVar1) - baseFriction * fVar1); - } - baseFriction = this->_baseFriction; - velocityX = baseFriction * (this->_velocity).x; - baseFriction = baseFriction * (this->_velocity).y; - (this->_velocity).x = velocityX; - (this->_velocity).y = baseFriction; - fVar1 = this->_speedMultiplier; - this->_friction = baseFriction; - (this->_pos).x = fVar1 * velocityX + (this->_pos).x; - (this->_pos).y = fVar1 * baseFriction + (this->_pos).y; - ai_blood_clot(this,1); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::CollideWithGrid(1); - return; - case 0xf0: - ai_umbilical_baby(this,1); - } - fVar1 = this->_orbitAngleOffset; - orbitLayer = this->_orbitLayer; - if (-1 < orbitLayer) { - baseFriction = fVar1; - if ((this->_flags & 0x20000000000) != 0) { - baseFriction = fVar1 - this->_orbitSpeed * 5.0; - if (360.0 < ABS(baseFriction)) { - baseFriction = fmodf(baseFriction,360.0); - } - if (baseFriction <= 180.0) { - if (baseFriction < -180.0) { - baseFriction = baseFriction + 360.0; - } - } - else { - baseFriction = baseFriction - 360.0; - } - this->_orbitAngleOffset = baseFriction; - } - if (orbitLayer == 8) { - player = this->_player; - isEffectActive = - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(player) + 0x1508)))))->TemporaryEffects::HasCollectibleEffect(0x4d); - if ((isEffectActive != 0) || - (isEffectActive = - TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(player) + 0x1508)),0x12a), isEffectActive != 0)) { - baseFriction = baseFriction - this->_orbitSpeed * 0.25; - if (360.0 < ABS(baseFriction)) { - baseFriction = fmodf(baseFriction,360.0); - } - if (baseFriction <= 180.0) { - if (baseFriction < -180.0) { - baseFriction = baseFriction + 360.0; - } - } - else { - baseFriction = baseFriction - 360.0; - } - this->_orbitAngleOffset = baseFriction; - } - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Interpolate(); - if (this->_variant == 0xf3) { - (this->_posOffset).y = - (this->_targetPosition).y * 0.5 * this->_speedMultiplier + (this->_posOffset).y; - } - this->_orbitAngleOffset = fVar1; - return; -} - -// 00624dd0 -uint8_t Entity_Familiar::RenderShadowLayer(Vector *offset) -{ - uint8_t bVar1; - Entity *umbilicalWhip; - - bVar1 = IsLilithBirthrightIncubus(this); - if (bVar1 != 0) { - umbilicalWhip = get_incubus_umbilical_whip(this); - if ((umbilicalWhip == GHIDRA_CAST(0x0)) || (umbilicalWhip->_visible == 0)) { - return 0; - } - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::RenderShadowLayer(offset); - return bVar1; -} - -// 00624e10 -void Entity_Familiar::Render(Vector *offset) -{ - code *pcVar1; - float fVar2; - uint8_t bVar3; - Entity *umbilicalWhip; - uint32_t seed; - LayerState *layer; - void *pvVar4; - Game *game; - uint8_t *layerId; - float *layerColor; - int iVar5; - float fVar6; - float fVar7; - double flooredCoord; - uint8_t local_194 [44]; - ColorMod fadedColor; - int iconRenderParams; - uint32_t uStack_138; - uint32_t uStack_134; - uint32_t uStack_130; - uint32_t uStack_12c; - float savedColorizeR; - float savedColorizeG; - float savedColorizeB; - float savedColorizeA; - float savedTintR; - float savedTintG; - float savedTintB; - float savedTintA; - float savedOffsetXY [2]; - float savedOffsetZ; - float opacity; - Vector *renderOffset; - uint8_t savedPlayerFlag171; - float local_f0; - float local_ec; - Vector iconPosX; - float local_e0; - char isHologram; - int *local_d8; - float local_d4; - float local_d0; - Vector iconScaleX; - int savedPlayerColor2; - int iStack_c0; - int iStack_bc; - int iStack_b8; - int iStack_b4; - int iStack_b0; - int iStack_ac; - int iStack_a8; - uint64_t uStack_a4; - int iStack_9c; - float savedPlayerColor; - float fStack_94; - float fStack_90; - int iStack_8c; - float fStack_88; - float fStack_84; - float fStack_80; - float fStack_7c; - float afStack_78 [2]; - float fStack_70; - int fadedPlayerColor; - int iStack_68; - int iStack_64; - float fStack_60; - int iStack_5c; - int iStack_58; - int iStack_54; - int iStack_50; - uint64_t uStack_4c; - int iStack_44; - ColorMod tmpColor; - uint32_t stackCookie; - void *local_10; - uint8_t *puStack_c; - float local_8; - int *player; - Vector *renderPos; - ColorMod *spriteColor; - - local_8 = -NAN; - puStack_c = &LAB_00af6cd1; - local_10 = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((&tmpColor)[1]._colorize); - ExceptionList = &local_10; - renderOffset = offset; - bVar3 = IsLilithBirthrightIncubus(this); - if (bVar3 != 0) { - umbilicalWhip = get_incubus_umbilical_whip(this); - if (umbilicalWhip == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - if (umbilicalWhip->_visible == 0) { - ExceptionList = local_10; - return; - } - } - savedTintR = (this->_sprite)._color._tint[0]; - savedTintG = (this->_sprite)._color._tint[1]; - savedTintB = (this->_sprite)._color._tint[2]; - savedTintA = (this->_sprite)._color._tint[3]; - savedOffsetXY = *(float (*) [2])(this->_sprite)._color._offset; - savedOffsetZ = (this->_sprite)._color._offset[2]; - opacity = 1.0; - savedColorizeR = (this->_sprite)._color._colorize[0]; - savedColorizeG = (this->_sprite)._color._colorize[1]; - savedColorizeB = (this->_sprite)._color._colorize[2]; - savedColorizeA = (this->_sprite)._color._colorize[3]; - if (this->_player == (void *)0x0) { - game = g_game; - } - else { - if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && - (bVar3 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1618))), bVar3 == 0)) { - if ((g_game == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - opacity = (float)(g_manager->_optionsConfig)._onlinePlayerOpacity * 0.09 + 0.1; - } - else { - opacity = 1.0; - } - } - game = g_game; - spriteColor = &(this->_sprite)._color; - fadedColor._tint[3] = savedTintA * opacity; - offset = renderOffset; - fadedColor._tint[0] = savedTintR; - fadedColor._tint[1] = savedTintG; - fadedColor._tint[2] = savedTintB; - fadedColor._colorize[0] = savedColorizeR; - fadedColor._colorize[1] = savedColorizeG; - fadedColor._colorize[2] = savedColorizeB; - fadedColor._colorize[3] = savedColorizeA; - (*GHIDRA_CAST((GHIDRA_CAST(&(fadedColor._offset)) + 0x0))) = savedOffsetXY; - if (spriteColor != &fadedColor) { - *(float (*) [2])(this->_sprite)._color._offset = savedOffsetXY; - spriteColor->_tint[0] = savedTintR; - (this->_sprite)._color._tint[1] = savedTintG; - (this->_sprite)._color._tint[2] = savedTintB; - (this->_sprite)._color._tint[3] = fadedColor._tint[3]; - (this->_sprite)._color._offset[2] = savedOffsetZ; - (this->_sprite)._color._colorize[0] = savedColorizeR; - (this->_sprite)._color._colorize[1] = savedColorizeG; - (this->_sprite)._color._colorize[2] = savedColorizeB; - (this->_sprite)._color._colorize[3] = savedColorizeA; - } - } - local_d8 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x12bc)); - if (this->_player == GHIDRA_CAST(0x0)) { -LAB_00624ff9: - isHologram = '\0'; - } - else { - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsHologram(); - isHologram = '\x01'; - if (bVar3 == 0) goto LAB_00624ff9; - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c7fd10) && - (_Init_thread_header(), DAT_00c7fd10 == -1)) { - _DAT_00c5c97c = 0x300000004; - DAT_00c5c984 = 0x1b; - _atexit(GHIDRA_CAST<_func_4879 *>(&DAT_00b15590)); - local_8 = -NAN; - _Init_thread_footer(&DAT_00c7fd10); - } - if (isHologram != '\0') { - if ((DAT_00c5c978 == 0) && - (KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")), DAT_00c5c978 == 0)) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - seed = DAT_00c5c978 >> ((uint8_t)_DAT_00c5c97c & 0x1f) ^ DAT_00c5c978; - seed = seed << ((uint8_t)((uint64_t)_DAT_00c5c97c >> 0x20) & 0x1f) ^ seed; - tmpColor._offset[0] = 0.0; - tmpColor._offset[1] = 0.0; - DAT_00c5c978 = seed >> ((uint8_t)DAT_00c5c984 & 0x1f) ^ seed; - tmpColor._offset[2] = 0.0; - tmpColor._tint[0] = 1.0; - tmpColor._tint[1] = 1.0; - tmpColor._tint[2] = 1.0; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - tmpColor._tint[3] = - (float)((double)GHIDRA_INT(DAT_00c5c978) + __uint_to_double_fixup[-(GHIDRA_INT(DAT_00c5c978) >> 0x1f)]) * - 2.3283062e-10 * 0.15 + 0.05; - render_color_stack_push(&tmpColor); - } - if (this->_variant == 0x4b) { - pvVar4 = this->_player; - local_f0 = (g_screenHeight - 182.0) * 0.5; - local_d4 = (g_screenWidth - 338.0) * 0.5; - local_ec = g_displayPixelRatio * g_screenPointScale; - local_d0 = ((*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x33c)) - 60.0) * 0.65 + local_d4) * local_ec + 0.5; - flooredCoord = floor((double)local_d0); - local_d0 = (float)flooredCoord / local_ec; - local_e0 = ((*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x340)) - 140.0) * 0.65 + local_f0) * local_ec + 0.5; - flooredCoord = floor((double)local_e0); - local_e0 = (float)flooredCoord / local_ec; - local_d4 = (((this->_pos).x - 60.0) * 0.65 + local_d4) * local_ec + 0.5; - flooredCoord = floor((double)local_d4); - iconPosX.y = (float)flooredCoord / local_ec; - local_d4 = (((this->_pos).y - 140.0) * 0.65 + local_f0) * local_ec + 0.5; - flooredCoord = floor((double)local_d4); - local_d0 = local_d0 - iconPosX.y; - local_e0 = local_e0 - (float)flooredCoord / local_ec; - if (local_d8 == GHIDRA_CAST(&DAT_00000005)) { - local_e0 = local_e0 * -1.0; - } - layerId = GHIDRA_CAST(0x1); - do { - fVar7 = (float)((double)GHIDRA_INT(layerId) + __uint_to_double_fixup[-(GHIDRA_INT(layerId) >> 0x1f)]); - fVar6 = 1.0 - fVar7 * 0.125; - local_d4 = (this->_sprite)._scale.x; - iconPosX.y = (fVar7 * local_d0 * 0.125 + 0.0) / local_d4; - local_d4 = ((-5.0 - fVar6 * fVar6 * 7.0) + fVar7 * local_e0 * 0.125) / local_d4; - layer = ANM2::GetLayer(&this->_sprite,layerId); - layerId = layerId + 1; - (layer->_pos).x = iconPosX.y; - (layer->_pos).y = local_d4; - } while (layerId < &DAT_00000009); -LAB_0062578c: - offset = renderOffset; - } - else if (this->_variant == 0x4f) { - local_f0 = (g_screenHeight - 182.0) * 0.5; - iconScaleX.y = (g_screenWidth - 338.0) * 0.5; - local_e0 = g_displayPixelRatio * g_screenPointScale; - iconPosX.y = ((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - 60.0) * 0.65 + iconScaleX.y) * local_e0 - + 0.5; - flooredCoord = floor((double)iconPosX.y); - local_d0 = (float)flooredCoord / local_e0; - iconPosX.y = ((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - 140.0) * 0.65 + local_f0) * local_e0 + - 0.5; - flooredCoord = floor((double)iconPosX.y); - iconPosX.y = (float)flooredCoord; - local_ec = iconPosX.y / local_e0; - iconScaleX.y = (((this->_pos).x - 60.0) * 0.65 + iconScaleX.y) * local_e0 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - iconPosX.y = (float)flooredCoord / local_e0; - iconScaleX.y = (((this->_pos).y - 140.0) * 0.65 + local_f0) * local_e0 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - local_d0 = local_d0 - iconPosX.y; - local_ec = local_ec - (float)flooredCoord / local_e0; - if (local_d8 == GHIDRA_CAST(&DAT_00000005)) { - local_ec = local_ec * -1.0; - } - layerId = GHIDRA_CAST(0x1); - local_d8 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x14f4)) * -1.0)); - iconScaleX.y = -16.0 - (float)local_d8; - do { - fVar7 = (float)((double)GHIDRA_INT(layerId) + __uint_to_double_fixup[-(GHIDRA_INT(layerId) >> 0x1f)]); - fVar6 = 1.0 - fVar7 / 9.0; - local_d4 = (this->_sprite)._scale.x; - iconPosX.y = ((fVar7 * local_d0) / 9.0 + 0.0) / local_d4; - local_d4 = (iconScaleX.y * fVar6 * fVar6 + (float)local_d8 + (fVar7 * local_ec) / 9.0) / - local_d4; - layer = ANM2::GetLayer(&this->_sprite,layerId); - layerId = layerId + 1; - (layer->_pos).x = iconPosX.y; - (layer->_pos).y = local_d4; - } while (layerId < GHIDRA_CAST(0xa)); - goto LAB_0062578c; - } - switch(this->_variant) { - case 0x30: - local_d0 = (float)__RTDynamicCast(this->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData:: - RTTI_Type_Descriptor, - &IsaacRepentancePlus::IsaacsBodyData::RTTI_Type_Descriptor); - if (local_d0 != 0.0) { - local_d8 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - iconScaleX.y = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_d8 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - iconPosX.y = (float)flooredCoord / (float)local_d8; - iconScaleX.y = ((((this->_posOffset).y + (this->_pos).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * (float)local_d8 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - iconScaleX.y = (float)flooredCoord; - fVar7 = iconScaleX.y / (float)local_d8; - local_f0 = 5.60519e-45; - local_d8 = GHIDRA_CAST((GHIDRA_INT(local_d0) + 0x568)); - fVar6 = offset->y; - layerColor = GHIDRA_CAST((GHIDRA_INT(local_d0) + 0x1c0)); - (this->_renderPosition).x = iconPosX.y + offset->x; - (this->_renderPosition).y = fVar7 + fVar6; - do { - iVar5 = *local_d8; - if (-1 < iVar5) { - spriteColor = &(this->_sprite)._color; - if (GHIDRA_CAST(layerColor) != spriteColor) { - fVar6 = (this->_sprite)._color._tint[1]; - fVar7 = (this->_sprite)._color._tint[2]; - fVar2 = (this->_sprite)._color._tint[3]; - *layerColor = spriteColor->_tint[0]; - layerColor[1] = fVar6; - layerColor[2] = fVar7; - layerColor[3] = fVar2; - fVar6 = (this->_sprite)._color._colorize[1]; - fVar7 = (this->_sprite)._color._colorize[2]; - fVar2 = (this->_sprite)._color._colorize[3]; - layerColor[4] = (this->_sprite)._color._colorize[0]; - layerColor[5] = fVar6; - layerColor[6] = fVar7; - layerColor[7] = fVar2; - fVar6 = (this->_sprite)._color._offset[1]; - layerColor[8] = (this->_sprite)._color._offset[0]; - layerColor[9] = fVar6; - layerColor[10] = (this->_sprite)._color._offset[2]; - iVar5 = *local_d8; - } - (GHIDRA_CAST((GHIDRA_CAST((layerColor + -0x2a)))))->Sprite::RenderLayer(iVar5,&this->_renderPosition, - &g_vectorZero,&g_vectorZero); - } - local_d8 = local_d8 + 1; - layerColor = layerColor + 0x45; - local_f0 = (float)(GHIDRA_INT(local_f0) + -1); - } while (local_f0 != 0.0); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_d0) + 4)))))->Sprite::RenderLayer(0,&this->_renderPosition,&g_vectorZero, - &g_vectorZero); - break; - } - default: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); - break; - case 0x44: - if (this->_visible != 0) { - local_d8 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - iconScaleX.y = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_d8 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - iconPosX.y = (float)flooredCoord / (float)local_d8; - iconScaleX.y = ((((this->_posOffset).y + (this->_pos).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * (float)local_d8 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - iconScaleX.y = (float)flooredCoord; - fVar6 = offset->x; - renderPos = &this->_renderPosition; - (this->_renderPosition).y = iconScaleX.y / (float)local_d8 + offset->y; - renderPos->x = iconPosX.y + fVar6; - player = this->_player; - savedPlayerColor = (float)player[0x3c]; - fStack_94 = (float)player[0x3d]; - fStack_90 = (float)player[0x3e]; - iStack_8c = player[0x3f]; - fStack_88 = (float)player[0x40]; - fStack_84 = (float)player[0x41]; - fStack_80 = (float)player[0x42]; - fStack_7c = (float)player[0x43]; - afStack_78 = *(float (*) [2])(player + 0x44); - fStack_70 = (float)player[0x46]; - tmpColor._tint[3] = opacity; - tmpColor._tint[0] = savedPlayerColor; - tmpColor._tint[1] = fStack_94; - tmpColor._tint[2] = fStack_90; - tmpColor._colorize[0] = fStack_88; - tmpColor._colorize[1] = fStack_84; - tmpColor._colorize[2] = fStack_80; - tmpColor._colorize[3] = fStack_7c; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpColor._offset)) + 0x0))) = afStack_78; - tmpColor._offset[2] = fStack_70; - (**(code **)(*player + 0x3c))(&tmpColor,0xffffffff,0xff,0); - (GHIDRA_CAST((this->_player)))->Entity_Player::RenderGlow(renderPos); - FUN_0078e130(renderPos); - (GHIDRA_CAST((this->_player)))->Entity_Player::RenderHead(renderPos); - (**(code **)(*GHIDRA_CAST(this->_player) + 0x3c))(&savedPlayerColor,0xffffffff,0xff,0,1); - } - break; - case 0x4e: - case 0xf3: - local_d8 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - iconScaleX.y = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_d8 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - iconPosX.y = (float)flooredCoord / (float)local_d8; - iconScaleX.y = ((((this->_posOffset).y + (this->_pos).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * (float)local_d8 + 0.5; - flooredCoord = floor((double)iconScaleX.y); - iconScaleX.y = (float)flooredCoord; - fVar7 = iconPosX.y + offset->x; - fVar6 = offset->y; - renderPos = &this->_renderPosition; - renderPos->x = fVar7; - (this->_renderPosition).y = iconScaleX.y / (float)local_d8 + fVar6; - if (this->_variant == 0xf3) { - renderPos->x = fVar7 + 0.0; - (this->_renderPosition).y = (this->_renderPosition).y + 8.45; - } - player = this->_player; - savedPlayerColor2 = player[0x3c]; - iStack_c0 = player[0x3d]; - iStack_bc = player[0x3e]; - iStack_b8 = player[0x3f]; - savedPlayerFlag171 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x171)); - iStack_b4 = player[0x40]; - iStack_b0 = player[0x41]; - iStack_ac = player[0x42]; - iStack_a8 = player[0x43]; - uStack_a4 = *GHIDRA_CAST((player + 0x44)); - iStack_9c = player[0x46]; - fStack_60 = opacity; - fadedPlayerColor = savedPlayerColor2; - iStack_68 = iStack_c0; - iStack_64 = iStack_bc; - iStack_5c = iStack_b4; - iStack_58 = iStack_b0; - iStack_54 = iStack_ac; - iStack_50 = iStack_a8; - uStack_4c = uStack_a4; - iStack_44 = iStack_9c; - (**(code **)(*player + 0x3c))(&fadedPlayerColor,0xffffffff,0xff,0); - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x171)) = 1; - (GHIDRA_CAST((this->_player)))->Entity_Player::RenderGlow(renderPos); - FUN_0078e130(renderPos); - (GHIDRA_CAST((this->_player)))->Entity_Player::RenderHead(renderPos); - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x171)) = savedPlayerFlag171; - (**(code **)(*GHIDRA_CAST(this->_player) + 0x3c))(&savedPlayerColor2,0xffffffff,0xff,0,1); - break; - case 0xe7: - local_d0 = (float)__RTDynamicCast(this->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData:: - RTTI_Type_Descriptor, - &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor); - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x24)); - if (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x28))) { - do { - render_abyss_locust_sprite(this,iVar5,renderOffset); - iVar5 = iVar5 + 0x114; - } while (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x28))); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(renderOffset); - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x30)); - if (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x34))) { - do { - render_abyss_locust_sprite(this,iVar5,renderOffset); - iVar5 = iVar5 + 0x114; - } while (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x34))); - } - break; - case 0xed: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); - if (((this->_visible != 0) && - (pvVar4 = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0), - pvVar4 != (void *)0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x2c)) != '\0')) { - uStack_12c = 1; - if (((uint8_t)g_graphicsManager_flags & 4) == 0) { - uStack_138 = 6; - } - else { - uStack_138 = 1; - } - iconRenderParams = 0; - uStack_134 = 1; - uStack_130 = 1; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - tmpColor._tint[0] = 1.0; - tmpColor._tint[1] = 1.0; - iconScaleX.x = (layer->_size).x * *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x18)); - tmpColor._tint[2] = 1.0; - tmpColor._offset[0] = 0.6; - tmpColor._offset[1] = 0.4; - iconScaleX.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x1c)) * (layer->_size).y; - tmpColor._offset[2] = 0.8; - tmpColor._tint[3] = opacity; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - iconPosX.x = (this->_renderPosition).x + *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x10)); - iconPosX.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x14)) + (this->_renderPosition).y; - GameOver::render_collectible_icon - (&g_game->_gameOver,this->_subtype,&iconPosX,&tmpColor,&iconScaleX,&iconRenderParams - ); - } - break; - case 0xf0: - FUN_00435130(); - } - FUN_00860fe0(this,renderOffset); - render_charge_indicator(this,&this->_renderPosition); - if ((isHologram != '\0') && (g_colorStackSize = g_colorStackSize - 1, g_colorStackSize == 0)) { - DAT_00c78dbc = 0; - } - spriteColor = &(this->_sprite)._color; - if (spriteColor != GHIDRA_CAST(local_194)) { - spriteColor->_tint[0] = savedTintR; - (this->_sprite)._color._tint[1] = savedTintG; - (this->_sprite)._color._tint[2] = savedTintB; - (this->_sprite)._color._tint[3] = savedTintA; - (this->_sprite)._color._colorize[0] = savedColorizeR; - (this->_sprite)._color._colorize[1] = savedColorizeG; - (this->_sprite)._color._colorize[2] = savedColorizeB; - (this->_sprite)._color._colorize[3] = savedColorizeA; - *(float (*) [2])(this->_sprite)._color._offset = savedOffsetXY; - (this->_sprite)._color._offset[2] = savedOffsetZ; - } - ExceptionList = local_10; - return; -} - -// 0062a8f0 -uint8_t Entity_Familiar::CanPlayerFire() -{ - void *pvVar1; - - pvVar1 = this->_player; - if ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x139a)) == '\0')) && - (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x414)) < 1)))) { - return 1; - } - return 0; -} - -// 0062a930 -void Entity_Familiar::AddCoins(int count) -{ - int iVar1; - code *pcVar2; - uint8_t isHasBffs; - int coins; - uint32_t seed; - uint32_t roll; - - iVar1 = this->_variant; - coins = this->_coins + count; - this->_coins = coins; - if (iVar1 == 0xe8) { - if (0 < coins % 100) { - do { - coins = coins + 99; - } while (0 < coins % 100); - this->_coins = coins; - } - (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(0x0)); - return; - } - if ((((iVar1 != 0xf1) && (iVar1 == 0x58)) && (this->_state == 3)) && (0 < count)) { - do { - isHasBffs = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - seed = (this->_dropRNG)._seed; - if (isHasBffs == 0) { - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - seed = (this->_dropRNG)._seed; - if (seed == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - seed = seed >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ seed; - seed = seed << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ seed; - seed = seed >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ seed; - roll = seed % 5; - } - else { - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - seed = (this->_dropRNG)._seed; - if (seed == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - seed = seed >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ seed; - seed = seed << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ seed; - seed = seed >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ seed; - roll = seed & 3; - } - (this->_dropRNG)._seed = seed; - if (roll == 0) { - this->_counter = this->_counter + 1; - } - count = count + -1; - } while (count != 0); - } - return; -} - -// 0062aaa0 -void Entity_Familiar::AddHearts(int param_2) -{ - this->_hearts = this->_hearts + param_2; - return; -} - -// 0062aab0 -void Entity_Familiar::TriggerRoomClear() -{ - uint8_t bVar1; - Entity *shot; - Entity_Player *playerEntity; - Entity *shot_00; - int iVar3; - uint32_t uVar4; - uint32_t pickupSubType; - uint32_t pickupVariant; - float dropChance; - RNG spawnRng; - Vector spiderPos; - float local_10; - Vector local_c; - Manager *manager; - Entity *playerEntity; - void **spiderCounter; - - if (this->_exists == 0) { - return; - } - playerEntity = this->_player; - if (playerEntity == GHIDRA_CAST(0x0)) { - return; - } - if (playerEntity->_exists == 0) { - return; - } - this->_roomClearCount = this->_roomClearCount + 1; - pickupSubType = 0; - pickupVariant = 0; - local_c.y = 0.0; - bVar1 = (GHIDRA_CAST((playerEntity)))->Entity_Player::HasCollectible(0xf7,0); - switch(this->_variant) { - case 0x14: - if (bVar1 == 0) { - local_c.y = 0.35; - pickupVariant = 0x28; - } - else { - local_c.y = 0.42; - pickupVariant = 0x28; - } - break; - case 0x15: - if (bVar1 == 0) { - local_c.y = 0.5; - pickupVariant = 0x14; - } - else { - local_c.y = 0.57; - pickupVariant = 0x14; - } - break; - case 0x16: - if (bVar1 == 0) { - local_c.y = 0.35; - pickupVariant = 10; - pickupSubType = 2; - } - else { - local_c.y = 0.42; - pickupVariant = 10; - pickupSubType = 2; - } - break; - case 0x17: - if (bVar1 == 0) { - local_c.y = 0.125; - pickupVariant = 10; - pickupSubType = 3; - } - else { - local_c.y = 0.166; - pickupVariant = 10; - pickupSubType = 3; - } - break; - case 0x34: - iVar3 = 2; - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar1 != 0) { - iVar3 = 3; - } - do { - Room::FindFreePickupSpawnPosition(g_game->_room,&spiderPos,&this->_pos,0.0,0,0,0); - playerEntity = this->_player; - spiderCounter = &playerEntity[4]._config; - *spiderCounter = (void *)(GHIDRA_INT(*spiderCounter) + 1); - spawn_blue_spider(&spiderPos,playerEntity,&g_vectorZero); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(shot); - iVar3 = iVar3 + -1; - } while (iVar3 != 0); - pickupVariant = 0; - pickupSubType = 0; - break; - case 0x39: - if (bVar1 == 0) { - local_c.y = 0.18; - } - else { - local_c.y = 0.22; - } - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(4); - switch(uVar4) { - case 0: - pickupVariant = 10; - pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(6); - pickupSubType = pickupSubType + 1; - break; - case 1: - pickupVariant = 0x14; - pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(4); - pickupSubType = pickupSubType + 1; - break; - case 2: - pickupVariant = 0x1e; - pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); - pickupSubType = pickupSubType + 1; - break; - case 3: - pickupVariant = 0x28; - pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); - pickupSubType = pickupSubType + 1; - } - break; - case 0x52: - local_10 = 0.8; - local_c.y = 0.0; - if (bVar1 == 0) { - local_10 = 1.0; - } - dropChance = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomFloat(); - local_10 = dropChance * local_10; - dropChance = local_10; - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)) == 0x24) { - dropChance = local_10 * 0.75; - } - if (0.1 <= dropChance) { - if (0.35 <= dropChance) break; - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(7); - switch(uVar4) { - case 0: - pickupVariant = 10; - dropChance = 1.0; - break; - case 1: - pickupVariant = 0x14; - dropChance = 1.0; - break; - case 2: - pickupVariant = 0x1e; - dropChance = 1.0; - break; - case 3: - pickupVariant = 0x28; - dropChance = 1.0; - break; - case 4: - pickupVariant = 0x5a; - dropChance = 1.0; - break; - case 5: - pickupVariant = 300; - dropChance = 1.0; - break; - case 6: - pickupVariant = 0x46; - default: - dropChance = 1.0; - } - } - else { - pickupVariant = 0x15e; - dropChance = 1.0; - } - goto LAB_0062acdf; - case 0x58: - if (this->_state != 1) break; - local_10 = 1.12104e-43; - uVar4 = 100; - if (bVar1 != 0) { - uVar4 = 0x50; - } - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(uVar4); - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)) == 0x24) { - uVar4 = GHIDRA_INT((uVar4 << 2)) / 3; - } - dropChance = local_c.y; - if (GHIDRA_INT(uVar4) < 0x21) { - this->_counter = this->_counter + 1; - } - goto LAB_0062acdf; - case 0x5b: - if (bVar1 == 0) { - local_c.y = 0.125; - pickupVariant = 300; - } - else { - local_c.y = 0.166; - pickupVariant = 300; - } - break; - case 0x5e: - local_10 = 1.12104e-43; - uVar4 = 100; - if (bVar1 != 0) { - uVar4 = 0x50; - } - local_c.y = 0.0; - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(uVar4); - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)) == 0x24) { - uVar4 = GHIDRA_INT((uVar4 << 2)) / 3; - } - if (GHIDRA_INT(uVar4) < 10) { - uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); - if (uVar4 == 0) { - uVar4 = Random(); - Game::Spawn(g_game,5,0x5a,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - } - else { - playerEntity = this->_player; - spiderCounter = &playerEntity[4]._config; - *spiderCounter = (void *)(GHIDRA_INT(*spiderCounter) + 1); - spawn_blue_spider(&this->_pos,playerEntity,&g_vectorZero); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(shot_00); - } - } - break; - case 0x70: - if (bVar1 == 0) { - pickupVariant = 0x46; - dropChance = 0.125; - } - else { - pickupVariant = 0x46; - dropChance = 0.166; - } - goto LAB_0062acdf; - case 0x72: - if (bVar1 == 0) { - local_c.y = 0.125; - pickupVariant = 0x45; - } - else { - local_c.y = 0.166; - pickupVariant = 0x45; - } - } - dropChance = local_c.y; -LAB_0062acdf: - playerEntity = this->_player; - if (playerEntity->_playerType == 0x24) { - dropChance = dropChance * 0.75; - } - uVar4 = this->_roomClearCount & 0x800003ff; - if (GHIDRA_INT(uVar4) < 0) { - uVar4 = (uVar4 - 1 | 0xfffffc00) + 1; - } - if ((pickupVariant != 0) && (0.0 < dropChance)) { - if (dropChance < 1.0) { - if (GHIDRA_INT(((float)GHIDRA_INT((uVar4 + 1)) * dropChance)) <= GHIDRA_INT(((float)GHIDRA_INT(uVar4) * dropChance))) - goto LAB_0062ae77; - playerEntity = this->_player; - } - if (((pickupVariant != 10) || (bVar1 = (GHIDRA_CAST((playerEntity)))->Entity_Player::HasTrinket(0x16,0), bVar1 == 0)) || - (uVar4 = Random(), uVar4 % 5 == 0)) { - if (this->_variant == 0x5b) { - pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pickupSubType = ItemPool::GetCardEx(pickupSubType,0,-1,0,1); - } - Room::FindFreePickupSpawnPosition(g_game->_room,&local_c,&this->_pos,0.0,0,0,0); - spawnRng._seed = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - spawnRng._shift1 = 5; - spawnRng._shift2 = 0x11; - spawnRng._shift3 = 0xd; - uVar4 = (GHIDRA_CAST((&spawnRng)))->RNG::Next(); - Game::Spawn(g_game,5,pickupVariant,&local_c,&g_vectorZero,GHIDRA_CAST(this),pickupSubType,uVar4); - bVar1 = ANM2::SetAnimation(&this->_sprite,s_Spawn,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - manager = g_manager; - if (this->_variant == 0x16) { - local_10 = 3.06884e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_10)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10),1.0,2,0,1.0,0.0); - } - } - } -LAB_0062ae77: - manager = g_manager; - iVar3 = this->_variant; - if (iVar3 == 0x5d) { - if (this->_subtype != 0) { - this->_state = 1; - return; - } - } - else if (iVar3 == 0xdd) { - if (this->_hearts < 6) { - local_10 = 6.60012e-43; - this->_hearts = this->_hearts + 1; - seed_fart_sound_override(GHIDRA_CAST(&local_10)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10),1.0,2,0,1.0,0.0); - paschal_candle_sync_effects(this); - return; - } - } - else if (((iVar3 != 0xee) && (iVar3 == 0xce)) && - ((this->_dead == 0 && (1 < g_game->_frameCount - this->_spawnFrame)))) { - if (this->_wispCollectibleType == 0x1ea) { - iVar3 = GetRandomWisp(&this->_dropRNG); - FUN_0043d7f0(iVar3); - this->_health = this->_maxHitPoints; - } - else if (this->_wispCollectibleType == 0x203) { - this->_health = this->_maxHitPoints; - return; - } - } - return; -} - -// 0062b360 -void Entity_Familiar::level_start() -{ - void *pvVar1; - float fVar2; - uint8_t bVar3; - uint8_t *pbVar4; - uint32_t uVar5; - Vector *followPos; - uint8_t *pbVar6; - int extraout_ECX; - bool bVar7; - Vector local_18; - uint32_t local_10; - uint32_t local_c; - uint8_t *animData; - int roomEntity; - - if (this->_variant != 100) goto LAB_0062b462; - this->_subtype = 0; - this->_visible = 1; - this->_shadowSize = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x24)); - animData = (this->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_0062b3e6: - bVar3 = ANM2::SetAnimation(&this->_sprite,s_Idle,1); - if (bVar3 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - pbVar4 = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - pbVar4 = *GHIDRA_CAST(animData); - } - pbVar6 = s_Idle; - do { - bVar3 = *pbVar4; - bVar7 = bVar3 < *pbVar6; - if (bVar3 != *pbVar6) { -LAB_0062b3d0: - uVar5 = -GHIDRA_UINT(bVar7) | 1; - goto LAB_0062b3d5; - } - if (bVar3 == 0) break; - bVar3 = pbVar4[1]; - bVar7 = bVar3 < pbVar6[1]; - if (bVar3 != pbVar6[1]) goto LAB_0062b3d0; - pbVar4 = pbVar4 + 2; - pbVar6 = pbVar6 + 2; - } while (bVar3 != 0); - uVar5 = 0; -LAB_0062b3d5: - if ((uVar5 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_0062b3e6; - } - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x6d0 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU))) - && (fVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x6d0)), fVar2 != 0.0)) { - local_10 = *GHIDRA_CAST((GHIDRA_CAST(fVar2) + 0x78)); - local_18.y = 0.0; - local_c = 0; - local_18.x = fVar2; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveEffect(&local_18,1); - } -LAB_0062b462: - roomEntity = this->_variant; - if (roomEntity == 0x2a) { - this->_subtype = GHIDRA_UINT(this->_subtype) >> 1; - } - else if ((roomEntity == 0x77) || (roomEntity == 0x18)) { - this->_subtype = 0; - } - else if (roomEntity == 0xcb) { - if (g_game->_isStartingFromState == 0) { - this->_hearts = 0; - roomEntity = (GHIDRA_CAST((this->_player)))->Entity_Player::GetHealthType(); - if (GHIDRA_INT((2 - GHIDRA_UINT((roomEntity != 3)))) < *GHIDRA_CAST((extraout_ECX + 0x1344))) { - this->_state = 4; - fVar2 = *GHIDRA_CAST((extraout_ECX + 0x340)); - (this->_pos).x = *GHIDRA_CAST((extraout_ECX + 0x33c)); - (this->_pos).y = fVar2; - } - } - FUN_00640050(); - } - else if (roomEntity == 0xdd) { - paschal_candle_sync_effects(this); - } - else if (roomEntity == 0xd3) { - if (g_game->_isStartingFromState == 0) { - if (this->_state == 4) { - this->_visible = 1; - roomEntity = 1; - } - else { - roomEntity = 2; - } - this->_state = roomEntity; - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) + 0.0; - (this->_pos).y = fVar2 + 48.0; - return; - } - } - else if (roomEntity == 0xce) { - if (this->_subtype == 0x2be) { - this->Remove(); - } - else if ((this->_subtype == 0x7f) && (5 < g_game->_frameCount - this->_spawnFrame)) { - this->Remove(); - } - } - else if (roomEntity == 0xec) { - roomEntity = g_game->_currentRoomIdx; - if (roomEntity < 0) { - roomEntity = g_game->_startingRoomIdx; - } - this->_coins = -1; - (this->_formationTargetOffset).x = (float)(roomEntity % 0xd); - (this->_formationOffset).x = (float)(roomEntity % 0xd); - (this->_formationTargetOffset).y = (float)(roomEntity / 0xd); - (this->_formationOffset).y = (float)(roomEntity / 0xd); - } - else if (roomEntity == 0xf0) { - this->Remove(); - } - followPos = GetFollowTargetPosition(this,&local_18,0); - (this->_pos).x = followPos->x; - (this->_pos).y = followPos->y; - roomEntity = this->_variant; - if (roomEntity == 0xf1) { - uVar5 = 0; - pvVar1 = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1254)) == 0) { - return; - } - do { - roomEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x124c)) + uVar5 * 4)); - if ((*GHIDRA_CAST((roomEntity + 0x28)) == 0x322) && - (*GHIDRA_CAST((roomEntity + 0x3bc)) == this)) { - *GHIDRA_CAST((roomEntity + 0x33c)) = *GHIDRA_CAST((roomEntity + 0x33c)) + 0.0; - *GHIDRA_CAST((roomEntity + 0x340)) = *GHIDRA_CAST((roomEntity + 0x340)) + 80.0; - roomEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x124c)) + uVar5 * 4)); - if (roomEntity == this->_linkedEntity) { - fVar2 = *GHIDRA_CAST((roomEntity + 0x340)); - (this->_pos).x = *GHIDRA_CAST((roomEntity + 0x33c)); - (this->_pos).y = fVar2; - } - } - uVar5 = uVar5 + 1; - } while (uVar5 < *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1254))); - roomEntity = this->_variant; - } - if (roomEntity == 0xf2) { - this->_state = 0; - } - return; -} - -// 0062bb70 -void Entity_Familiar::room_enter() -{ - code *pcVar1; - uint8_t bVar2; - char isTargetable; - void *pvVar3; - Vector *outPosition; - Vector *tmpVec; - uint32_t uVar4; - uint32_t uVar5; - bool bVar6; - float fVar7; - Vector local_60; - Vector local_58; - Vector local_50; - Vector wispOrbitPos; - Vector itemWispOrbitPos; - Vector enterDirection; - Vector randomDirection [3]; - uint64_t local_14; - int child; - Game *game; - uint32_t playerPosY; - int segment; - uint32_t *segmentPos; - - game = g_game; - uVar5 = this->_variant; - if (900 < uVar5) goto switchD_0062bba7_caseD_4; - if (uVar5 == 900) { -switchD_0062bba7_caseD_49: - (this->_targetPosition).x = g_vectorZero.x; - fVar7 = g_vectorZero.y; -LAB_0062c604: - (this->_targetPosition).y = fVar7; - goto switchD_0062bba7_caseD_4; - } - switch(uVar5) { - case 3: - case 0x19: - case 0x5d: - case 0x68: - case 0x82: - case 0xdf: - case 0xe8: - this->_fireCooldown = 0xf; - break; - case 0x11: - case 0x2e: - case 0x2f: - case 0x47: - case 0x48: - case 0x60: - case 0xcf: - goto switchD_0062bba7_caseD_11; - case 0x32: - case 0x3a: - this->_subtype = 0; - this->_fireCooldown = 0; - goto switchD_0062bba7_caseD_11; - case 0x33: - case 0x5f: - case 0xe7: - this->_fireCooldown = 0; - break; - case 0x3b: - this->_fireCooldown = 0x3c; - break; - case 0x42: - case 0x43: - this->_subtype = 1; - (this->_pathfinder)._movementTarget.x = g_vectorZero.x; - (this->_pathfinder)._movementTarget.y = g_vectorZero.y; - (this->_pathfinder)._moveDirection.x = g_vectorZero.x; - (this->_pathfinder)._moveDirection.y = g_vectorZero.y; - pvVar3 = game->_room; - local_58.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1c)); - local_50.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x14)); - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x20)); - local_60.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x18)); - (this->_targetPosition).x = local_50.x; - (this->_targetPosition).y = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x18)); - uVar5 = Random(); - local_60.x = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * (fVar7 - local_60.x); - uVar5 = Random(); - (this->_targetPosition).x = - (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283064e-10 - * (local_58.x - local_50.x) + (this->_targetPosition).x; - (this->_targetPosition).y = local_60.x + (this->_targetPosition).y; - uVar5 = Random(); - this->_health = this->_maxHitPoints; - this->_counter = uVar5 % 0x3c + 0x46; - break; - case 0x49: - case 0x7a: - goto switchD_0062bba7_caseD_49; - case 0x53: - goto switchD_0062bba7_caseD_53; - case 0x55: - (this->_targetPosition).x = g_vectorZero.x; - fVar7 = g_vectorZero.y; - this->_moveDirection = 3; - goto LAB_0062c604; - case 0x56: - if (g_game->_isStartingFromState != 0) break; -switchD_0062bba7_caseD_53: - this->_coins = 0; - break; - case 0x5e: - case 0x71: - this->_subtype = 1; - (this->_pathfinder)._movementTarget.x = g_vectorZero.x; - (this->_pathfinder)._movementTarget.y = g_vectorZero.y; - (this->_pathfinder)._moveDirection.x = g_vectorZero.x; - (this->_pathfinder)._moveDirection.y = g_vectorZero.y; - tmpVec = (GHIDRA_CAST((game->_room)))->Room::GetRandomPosition(&local_60,0.0); - (this->_targetPosition).x = tmpVec->x; - (this->_targetPosition).y = tmpVec->y; - uVar5 = Random(); - this->_counter = uVar5 % 0x3c + 0x46; - break; - case 0x62: - case 99: - case 0x65: - case 0x6a: - case 0x83: - this->_moveDelayNum = -1; - goto switchD_0062bba7_caseD_11; - case 0x6f: - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - case 0xd4: - this->_state = 0; - break; - case 0x7c: - this->_state = 0; - if (this->_visible == 0) { - this->_roomClearCount = 0; - } - this->_visible = 1; - ANM2::Play(&this->_sprite,s_Idle,0); - break; - case 0x81: - this->_state = 0; - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - this->_visible = 1; - ANM2::Play(&this->_sprite,GHIDRA_CAST("FloatDown"),0); - break; - case 0xce: - if (this->_subtype == 0x20f) { - this->_keys = 0; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - if (this->_variant == 0xed) { - child = this->_wispCollectibleType; - } - else if (this->_variant == 0xce) { - child = this->_subtype; - } - else { - child = 0x248; - } - pvVar3 = ItemConfig::get_wisp_config(child); - if (this->_orbitLayer < 0) { - AddToOrbit(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x18c)) + 7); - } - } - else if (this->_subtype == 0x244) { - local_14 = 0x1500000001; - child = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)); - if ((child == 0) || (uVar5 = *GHIDRA_CAST((child + 0x5c)), uVar5 == 0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar5 = uVar5 >> 1 ^ uVar5; - uVar5 = uVar5 << 0x15 ^ uVar5; - uVar5 = (uVar5 >> 0x14 ^ uVar5) & 7; - if ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar5 * 4 + 0x724)) == 0) && - (bVar2 = Level::CanSpawnDoorOutline(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,uVar5), - bVar2 != 0)) { - Level::MakeRedRoomDoor(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,uVar5); - } - } - local_50.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_50.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - tmpVec = &local_50; - outPosition = &wispOrbitPos; - goto LAB_0062c09b; - case 0xd3: - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - (this->_pos).y = fVar7; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar2 != 0) { - this->_coins = 1; - ANM2::PlayOverlay(&this->_sprite,GHIDRA_CAST("Mantle"),0); - } - break; - case 0xe0: - this->Remove(); - break; - case 0xe1: - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - (this->_pos).y = fVar7; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - ANM2::Play(&this->_sprite,s_Fly,0); - this->_state = 3; - break; - case 0xec: - if (this->_visible == 0) { - update_star_of_bethlehem_speed(this,0); - } - break; - case 0xed: - local_58.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_58.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - tmpVec = &local_58; - outPosition = &itemWispOrbitPos; -LAB_0062c09b: - tmpVec = GetOrbitPosition(this,outPosition,tmpVec); - (this->_pos).x = tmpVec->x; - (this->_pos).y = tmpVec->y; - break; - case 0xee: - this->_damageCountdown = 0x14; - break; - case 0xef: - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - (this->_pos).y = fVar7; - if (game->_enterDoor < 0) { - tmpVec = MusicManager::RandomVector(randomDirection); - } - else { - uVar5 = game->_enterDoor + 2U & 0x80000003; - if (GHIDRA_INT(uVar5) < 0) { - uVar5 = (uVar5 - 1 | 0xfffffffc) + 1; - } - tmpVec = Isaac::GetAxisAlignedUnitVectorFromDir(&enterDirection,uVar5); - } - fVar7 = tmpVec->x; - (this->_pos).y = tmpVec->y * 15.0 + (this->_pos).y; - (this->_pos).x = fVar7 * 15.0 + (this->_pos).x; -switchD_0062bba7_caseD_11: - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - break; - case 0xf0: - child = __RTDynamicCast(this->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, - &IsaacRepentancePlus::UmbilicalBabyData::RTTI_Type_Descriptor,0); - if (child != 0) { - uVar5 = *GHIDRA_CAST((child + 0x14)); - uVar4 = 0; - if (uVar5 != 0) { - do { - local_50.x = (float)((double)GHIDRA_INT((uVar5 - 1)) + - __uint_to_double_fixup[-(GHIDRA_INT((uVar5 - 1)) >> 0x1f)]); - if (local_50.x == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - playerPosY = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - fVar7 = ((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - 0.0 - ) / (local_50.x - 0.0); - if (fVar7 <= 0.0) { - fVar7 = 0.0; - } - if (1.0 <= fVar7) { - fVar7 = 1.0; - } - segmentPos = *(uint32_t **) - (*GHIDRA_CAST((child + 8)) + - (*GHIDRA_CAST((child + 0x10)) + uVar4 & *GHIDRA_CAST((child + 0xc)) - 1U) * 4); - *segmentPos = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - segmentPos[1] = playerPosY; - segmentPos[2] = -15.0 - fVar7 * 5.0; - uVar5 = *GHIDRA_CAST((child + 0x10)) + uVar4; - uVar4 = uVar4 + 1; - segment = *GHIDRA_CAST((*GHIDRA_CAST((child + 8)) + (uVar5 & *GHIDRA_CAST((child + 0xc)) - 1U) * 4)); - *GHIDRA_CAST((segment + 0xc)) = (uint32_t)DAT_00c79c58; - *GHIDRA_CAST((segment + 0x10)) = (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c79c58)) + 0x4))); - *GHIDRA_CAST((segment + 0x14)) = DAT_00c79c60; - uVar5 = *GHIDRA_CAST((child + 0x14)); - } while (uVar4 < uVar5); - } - } - break; - case 0xf1: - uVar5 = 0; - pvVar3 = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1254)) != 0) { - do { - child = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar5 * 4)); - if ((*GHIDRA_CAST((child + 0x28)) == 0x322) && (*GHIDRA_CAST((child + 0x3bc)) == this)) { - if (child == this->_linkedEntity) { - *GHIDRA_CAST((child + 0x33c)) = (this->_pos).x; - fVar7 = (this->_pos).y; - } - else { - uVar4 = Random(); - local_50.x = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - local_50.x = local_50.x + local_50.x; - fVar7 = cos(local_50.x); - local_58.x = (this->_pos).y; - *GHIDRA_CAST((child + 0x33c)) = fVar7 + (this->_pos).x; - fVar7 = sin(local_50.x); - fVar7 = fVar7 + local_58.x; - } - *GHIDRA_CAST((child + 0x340)) = fVar7; - child = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar5 * 4)); - *GHIDRA_CAST((child + 0x360)) = g_vectorZero.x; - *GHIDRA_CAST((child + 0x364)) = g_vectorZero.y; - child = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar5 * 4)); - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((child + 0x28)) == 1)) || - (*GHIDRA_CAST((child + 0x28)) - 10U < 0x3de)) { - *GHIDRA_CAST((child + 0xb64)) = 0x10; - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar5 * 4)) + 0xc))(); - } - } - uVar5 = uVar5 + 1; - } while (uVar5 < *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1254))); - } - break; - case 0xf2: - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - this->_coins = 0; - this->_keys = 0; - pvVar3 = game->_room; - if (((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 8)) == 5) && - ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 4)) + 0x44)) & 1) == 0)) && - (uVar5 = 0, *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1264)) != 0)) { - do { - isTargetable = (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x125c)) + uVar5 * 4)) + 0x4c)) - (); - if (((isTargetable != '\0') && - (child = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x125c)) + uVar5 * 4)), - (*GHIDRA_CAST((child + 0x168)) & 0x20000000) == 0 && (*GHIDRA_CAST((child + 0x16c)) & 0x20) == 0)) - && (*GHIDRA_CAST((child + 0x3bc)) == 0)) { - child = *GHIDRA_CAST((child + 0x28)); - if (child < 0x197) { - if (child != 0x196) { - switch(child) { - case 0x2d: - case 0x4e: - case 0x54: - case 0x66: - case 0x111: - case 0x112: - case 0x113: - break; - default: -switchD_0062c43c_caseD_2e: - this->_coins = child; - this->_keys = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x125c)) + uVar5 * 4)) + 0x2c)); - goto switchD_0062bba7_caseD_4; - } - } - } - else if (child < 0x391) { - if (((child != 0x390) && (child != 0x197)) && (child != 0x19c)) { - bVar6 = child == 0x362; -LAB_0062c46e: - if (!bVar6) goto switchD_0062c43c_caseD_2e; - } - } - else if (child != 0x3b6) { - bVar6 = child == 0x3b7; - goto LAB_0062c46e; - } - } - uVar5 = uVar5 + 1; - } while (uVar5 < *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1264))); - } - } -switchD_0062bba7_caseD_4: - if (((this->_isNotCountedAsFollower != 0) && (g_game->_isStartingFromState == 0)) && - (this->_isHourglassRewound == 0)) { - this->Remove(); - } - this->_isHourglassRewound = 0; - return; -} - -// 0062c8d0 -void Entity_Familiar::farting_baby_fart() -{ - code *pcVar1; - uint8_t bVar2; - uint32_t uVar3; - uint8_t *curAnimChar; - Entity *pEVar4; - uint32_t uVar5; - uint8_t *cmpAnimChar; - void *room; - uint32_t uVar6; - bool bVar7; - uint32_t local_4c; - Entity *local_48; - Vector local_44; - int *enemy; - ColorMod local_38; - uint32_t local_c; - uint8_t *animData; - int entityType; - Manager *manager; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_4c); - if (this->_variant != 0x70) { - if (this->_variant == 0x7d) { - uVar6 = this->_state; - uVar5 = (this->_dropRNG)._seed; - do { - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar5 = (this->_dropRNG)._seed; - if (uVar5 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar5 = uVar5 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; - uVar5 = uVar5 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; - uVar5 = uVar5 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; - (this->_dropRNG)._seed = uVar5; - this->_state = uVar5 % 5; - } while (uVar5 % 5 == uVar6); - FUN_0063b240(); - uVar6 = Random(); - local_44.x = (this->_velocity).x + (this->_pos).x; - local_44.y = (this->_pos).y + (this->_velocity).y; - pEVar4 = Game::SpawnEx(g_game,1000,0xf,&local_44,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar6,0); - pEVar4->Update(); - manager = g_manager; - local_4c = 0x84; - seed_fart_sound_override(GHIDRA_CAST(&local_4c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_4c,1.0,2,0,1.0,0.0); - } - return; - } - uVar6 = 0; - room = g_game->_room; - local_44.x = (float)room; - if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { - do { - pEVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (pEVar4->_type != 1)) { - entityType = pEVar4->_type; - if ((entityType - 10U < 0x3de) && - (((entityType != 0x21 && (entityType != 0x11)) && (entityType != 0x124)))) { - if (entityType == 0x375) { - bVar7 = pEVar4->_variant == 10; - } - else { - if ((entityType == 0x3c0) || (entityType == 0x3c5)) goto LAB_0062cb69; - bVar7 = entityType == 0xf5; - } - if (!bVar7) goto LAB_0062c990; - } - } - else { -LAB_0062c990: - if ((pEVar4->_dead == 0) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(pEVar4), bVar2 == 0)) { - local_38._colorize[0] = (this->_pos).x; - local_38._colorize[1] = (this->_pos).y; - enemy = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); - local_38._colorize[2] = (this->_velocity).x; - local_48 = *GHIDRA_CAST((*enemy + 0x20)); - local_38._colorize[3] = (this->_velocity).y; - local_38._tint[0] = (float)this->_type; - local_38._tint[1] = (float)this->_variant; - local_38._tint[2] = (float)this->_spawnerType; - local_38._tint[3] = (float)this->_spawnerVariant; - local_4c = GHIDRA_UINT(((this->_flags & 0x100) != 0)); - if ((this->_flags & 0x20000000) == 0) { - uVar5 = 0; - } - else { - uVar5 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar3 = 0; - } - else { - uVar3 = 4; - } - local_38._offset[0] = (float)(uVar3 | uVar5 | local_4c); - local_38._offset[1] = (float)this; - (*(code *)local_48)(0x41200000,0,0,&local_38,0x1e); - local_38._colorize[0] = (this->_pos).x; - local_38._colorize[1] = (this->_pos).y; - local_48 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); - local_38._tint[0] = (float)this->_type; - local_38._tint[1] = (float)this->_variant; - local_38._tint[2] = (float)this->_spawnerType; - local_38._tint[3] = (float)this->_spawnerVariant; - local_38._colorize[2] = (this->_velocity).x; - local_38._colorize[3] = (this->_velocity).y; - if ((this->_flags & 0x20000000) == 0) { - uVar5 = 0; - } - else { - uVar5 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar3 = 0; - } - else { - uVar3 = 4; - } - local_38._offset[0] = (float)(uVar3 | uVar5 | GHIDRA_UINT(((this->_flags & 0x100) != 0))); - local_38._offset[1] = (float)this; - (GHIDRA_CAST((local_48)))->Entity::AddPoison(GHIDRA_CAST(&local_38),0x96,0.0,0); - room = (void *)local_44.x; - } - } -LAB_0062cb69: - uVar6 = uVar6 + 1; - } while (uVar6 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); - } - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - cmpAnimChar = s_Spawn; - do { - bVar2 = *curAnimChar; - bVar7 = bVar2 < *cmpAnimChar; - if (bVar2 != *cmpAnimChar) { -LAB_0062cbb0: - uVar6 = -GHIDRA_UINT(bVar7) | 1; - goto LAB_0062cbb5; - } - if (bVar2 == 0) break; - bVar2 = curAnimChar[1]; - bVar7 = bVar2 < cmpAnimChar[1]; - if (bVar2 != cmpAnimChar[1]) goto LAB_0062cbb0; - curAnimChar = curAnimChar + 2; - cmpAnimChar = cmpAnimChar + 2; - } while (bVar2 != 0); - uVar6 = 0; -LAB_0062cbb5: - if ((uVar6 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0062cbe8; - } - bVar2 = ANM2::SetAnimation(&this->_sprite,s_Spawn,1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_0062cbe8: - local_38._tint[0] = 1.0; - local_38._tint[1] = 1.0; - local_38._tint[2] = 1.0; - local_38._tint[3] = 1.0; - local_38._offset[0] = 0.0; - local_38._offset[1] = 0.0; - local_38._offset[2] = 0.0; - local_38._colorize[0] = 0.0; - local_38._colorize[1] = 1.0; - local_38._colorize[2] = 0.0; - local_38._colorize[3] = 1.0; - Game::start_poop_cloud_screen_effect(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1618)),&local_38); - local_38._tint[0] = 1.0; - local_38._tint[1] = 1.0; - local_38._tint[2] = 1.0; - local_38._tint[3] = 0.5; - local_38._offset[0] = 0.0; - local_38._colorize[0] = 0.6; - local_38._colorize[1] = 1.0; - local_38._colorize[2] = 0.3; - local_38._colorize[3] = 1.0; - local_38._offset[1] = 0.0; - local_38._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::MakeGroundPoof(&this->_pos,&local_38,1.0); - return; -} - -// 0062d290 -void Entity_Familiar::mongo_baby_pick_next_mimic() -{ - uint8_t isOwned; - int iVar1; - int tries; - int mimicIndex; - - if (this->_variant == 0x4a) { - mimicIndex = this->_subtype; - tries = 0; - this->_subtype = 0; - while( true ) { - iVar1 = GHIDRA_INT(((uint64_t)((int64_t)(mimicIndex + 1) * -0x2aaaaaab) >> 0x20)); - mimicIndex = mimicIndex + 1 + ((iVar1 >> 1) - (iVar1 >> 0x1f)) * 0xc; - isOwned = Entity_Player::HasCollectible - (this->_player,*GHIDRA_CAST((&DAT_00b648b0 + mimicIndex * 4)),0); - if (isOwned != 0) break; - tries = tries + 1; - if (0xb < tries) { - return; - } - } - this->_subtype = mimicIndex; - } - return; -} - -// 0062d7e0 -void Entity_Familiar::RemoveFromFollowers() -{ - int iVar1; - Entity_Familiar *childRef; - int *piVar3; - int *local_14; - int *local_10; - int *local_c; - Entity_Familiar *leadBaby; - uint32_t *childRef; - uint32_t *parentRef; - - if (this->_variant == 0xeb) { - childRef = GHIDRA_CAST(this->_parent); - parentRef = &this->_parent; - if (childRef != GHIDRA_CAST(0x0)) { - if (this->_subtype == 0) { - childRef = GHIDRA_CAST(this->_child); - leadBaby = this; - if ((childRef == GHIDRA_CAST(0x0)) || (childRef->_type != 3)) { - childRef = GHIDRA_CAST(0x0); - } - } - else { - leadBaby = GHIDRA_CAST(0x0); - if (childRef->_type == 3) { - leadBaby = childRef; - } - childRef = this; - } - if ((leadBaby == GHIDRA_CAST(0x0)) || (childRef == GHIDRA_CAST(0x0))) { - KAGE_LogMessage(4,GHIDRA_CAST("Attempting to remove unpaired twisted baby!\n")); - iVar1 = *parentRef; - if ((iVar1 != 0) && (*GHIDRA_CAST((iVar1 + 0x28)) == 3)) { - local_10 = GHIDRA_CAST(this->_child); - piVar3 = GHIDRA_CAST((iVar1 + 0x3c0)); - if (*piVar3 != 0) { - local_14 = piVar3; - msvc::multiset::erase(&local_14); - } - *piVar3 = GHIDRA_INT(local_10); - if (local_10 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(piVar3); - } - } - iVar1 = this->_child; - if (iVar1 != 0) { - piVar3 = GHIDRA_CAST((iVar1 + 0x3bc)); - local_10 = GHIDRA_CAST(*parentRef); - if (*GHIDRA_CAST((iVar1 + 0x3bc)) != 0) { - local_14 = piVar3; - msvc::multiset::erase(&local_14); - } - *piVar3 = GHIDRA_INT(local_10); - if (local_10 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(piVar3); - } - } - if (*parentRef != 0) { - local_14 = parentRef; - msvc::multiset::erase(&local_14); - } - *parentRef = 0; - } - else { - parentRef = &leadBaby->_parent; - iVar1 = *parentRef; - if ((iVar1 != 0) && (*GHIDRA_CAST((iVar1 + 0x28)) == 3)) { - local_10 = GHIDRA_CAST(childRef->_child); - piVar3 = GHIDRA_CAST((iVar1 + 0x3c0)); - if (*piVar3 != 0) { - local_c = piVar3; - msvc::multiset::erase(&local_c); - } - *piVar3 = GHIDRA_INT(local_10); - if (local_10 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(piVar3); - } - } - iVar1 = childRef->_child; - if (iVar1 != 0) { - local_c = GHIDRA_CAST((iVar1 + 0x3bc)); - local_14 = GHIDRA_CAST(*parentRef); - if (*GHIDRA_CAST((iVar1 + 0x3bc)) != 0) { - local_10 = local_c; - msvc::multiset::erase(&local_10); - } - *local_c = GHIDRA_INT(local_14); - if (local_14 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(local_c); - } - } - if (*parentRef != 0) { - local_14 = parentRef; - msvc::multiset::erase(&local_14); - } - *parentRef = 0; - parentRef = &leadBaby->_child; - if (*parentRef != 0) { - local_14 = parentRef; - msvc::multiset::erase(&local_14); - } - childRef = &childRef->_parent; - *parentRef = 0; - if (*childRef != 0) { - local_14 = childRef; - msvc::multiset::erase(&local_14); - } - *childRef = 0; - this = childRef; - } - parentRef = &this->_child; - if (*parentRef != 0) { - local_14 = parentRef; - msvc::multiset::erase(&local_14); - } - *parentRef = 0; - return; - } - } - if (this->_isFollower != 0) { - iVar1 = this->_parent; - parentRef = &this->_parent; - if (iVar1 != 0) { - piVar3 = GHIDRA_CAST((iVar1 + 0x3c0)); - local_10 = GHIDRA_CAST(this->_child); - if (*GHIDRA_CAST((iVar1 + 0x3c0)) != 0) { - local_14 = piVar3; - msvc::multiset::erase(&local_14); - } - *piVar3 = GHIDRA_INT(local_10); - if (local_10 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(piVar3); - } - } - iVar1 = this->_child; - childRef = &this->_child; - if (iVar1 != 0) { - local_10 = GHIDRA_CAST((iVar1 + 0x3bc)); - local_c = GHIDRA_CAST(*parentRef); - if (*GHIDRA_CAST((iVar1 + 0x3bc)) != 0) { - local_14 = local_10; - msvc::multiset::erase(&local_14); - } - *local_10 = GHIDRA_INT(local_c); - if (local_c != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(local_10); - } - } - if (*parentRef != 0) { - local_14 = parentRef; - msvc::multiset::erase(&local_14); - } - *parentRef = 0; - if (*childRef != 0) { - local_14 = childRef; - msvc::multiset::erase(&local_14); - } - *childRef = 0; - } - this->_isFollower = 0; - return; -} - -// 0062db20 -void Entity_Familiar::AddToFollowers() -{ - uint32_t *puVar1; - void *pvVar2; - Entity_Familiar *pEVar3; - uint8_t bVar4; - EntityConfig_Entity *entityConfig; - uint8_t *curAnimChar; - int otherPriority; - uint32_t uVar5; - std_string *expectedName; - int iVar6; - int *childField; - std_string *anim; - bool isLess; - uint32_t *puVar7; - uint8_t familiars [12]; - uint32_t uStack_1c; - int *local_18; - int *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint8_t *animData; - Entity_Familiar *chainEntity; - Manager *manager; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6d75; - local_10 = ExceptionList; - if (this->_isSubtype55555 != 0) { - return; - } - if (this->_variant != 0xeb) { - ExceptionList = &local_10; - if ((this->_isFollower != 0) && (pvVar2 = (void *)this->_parent, pvVar2 != (void *)0x0)) { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)) == 3) { - iVar6 = __RTDynamicCast(pvVar2,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0, - __security_cookie ^ GHIDRA_UINT((familiars + 0x24))); - if (((iVar6 != 0) && (*GHIDRA_CAST((iVar6 + 0xd74)) != '\0')) && - (this->_player == *(void **)(iVar6 + 0x410))) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Tried to add familiar %d to followers again!\n")); - ExceptionList = local_10; - return; - } - } - else if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x28)) == 1) && (pvVar2 == this->_player)) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Tried to add familiar %d to followers again!\n")); - ExceptionList = local_10; - return; - } - } - this->_isFollower = 1; - iVar6 = GetFollowerPriority(this); - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(familiars),3,-1,-1,0,0); - local_8 = 2; - uVar5 = 0; - if (uStack_1c != 0) { -LAB_0062de40: - chainEntity = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + uVar5 * 4)); - if (((chainEntity == GHIDRA_CAST(0x0)) || (chainEntity->_type != 3)) || - ((chainEntity == this || - ((chainEntity->_isFollower == 0 || (chainEntity->_player != this->_player)))))) - goto LAB_0062de6b; - for (pEVar3 = GHIDRA_CAST(chainEntity->_parent); - (pEVar3 != GHIDRA_CAST(0x0) && (pEVar3->_type == 3)); - pEVar3 = GHIDRA_CAST(pEVar3->_parent)) { - chainEntity = pEVar3; - } - otherPriority = GetFollowerPriority(chainEntity); - do { - if (otherPriority < iVar6) { - puVar1 = &this->_child; - if (this->_child != 0) { - local_14 = puVar1; - msvc::multiset::erase(&local_14); - } - *puVar1 = chainEntity; - if (chainEntity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(puVar1); - } - puVar1 = &this->_parent; - local_18 = GHIDRA_CAST(chainEntity->_parent); - puVar7 = &chainEntity->_parent; - if (this->_parent != 0) { - local_14 = puVar1; - msvc::multiset::erase(&local_14); - } - *puVar1 = local_18; - if (local_18 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(puVar1); - iVar6 = *puVar1; - if ((iVar6 != 0) && (*GHIDRA_CAST((iVar6 + 0x28)) == 3)) { - childField = GHIDRA_CAST((iVar6 + 0x3c0)); - if (*GHIDRA_CAST((iVar6 + 0x3c0)) != 0) { - local_18 = childField; - msvc::multiset::erase(&local_18); - } - *childField = GHIDRA_INT(this); - msvc::multiset::insert(childField); - } - } - if (*puVar7 != 0) { - local_18 = puVar7; - msvc::multiset::erase(&local_18); - } - *puVar7 = this; -LAB_0062df8a: - msvc::multiset::insert(puVar7); - break; - } - pEVar3 = GHIDRA_CAST(chainEntity->_child); - if (pEVar3 == GHIDRA_CAST(0x0)) { -LAB_0062dfde: - chainEntity->_child = this; - msvc::multiset::insert(&chainEntity->_child); - puVar7 = &this->_parent; - if (this->_parent != 0) { - local_14 = puVar7; - msvc::multiset::erase(&local_14); - } - *puVar7 = chainEntity; - goto LAB_0062df8a; - } - if (pEVar3->_type != 3) { - local_14 = &chainEntity->_child; - msvc::multiset::erase(&local_14); - goto LAB_0062dfde; - } - otherPriority = GetFollowerPriority(pEVar3); - chainEntity = pEVar3; - } while( true ); - } -LAB_0062df8f: - if (familiars[0] != '\0') { - ExceptionList = local_10; - return; - } - local_8 = 3; - goto LAB_0062dfa3; - } - puVar1 = &this->_parent; - if (this->_parent != 0) { - return; - } - ExceptionList = &local_10; - *puVar1 = this->_player; - if (this->_player != (void *)0x0) { - msvc::multiset::insert(puVar1); - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(familiars),3,0xeb,-1,0,0); - local_8 = 0; - uVar5 = 0; - if (uStack_1c != 0) { -LAB_0062dbc5: - chainEntity = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + uVar5 * 4)); - if ((((chainEntity == GHIDRA_CAST(0x0)) || (chainEntity->_type != 3)) || - (chainEntity == this)) || - ((chainEntity->_exists == 0 || (chainEntity->_player != this->_player)))) goto LAB_0062dbf4; - for (pEVar3 = GHIDRA_CAST(chainEntity->_child); pEVar3 != GHIDRA_CAST(0x0); - pEVar3 = GHIDRA_CAST(pEVar3->_child)) { - chainEntity = pEVar3; - } - if (chainEntity->_child != 0) { - local_14 = &chainEntity->_child; - msvc::multiset::erase(&local_14); - } - chainEntity->_child = this; - msvc::multiset::insert(&chainEntity->_child); - if (*puVar1 != 0) { - local_14 = puVar1; - msvc::multiset::erase(&local_14); - } - *puVar1 = chainEntity; - msvc::multiset::insert(puVar1); - iVar6 = 1 - chainEntity->_subtype; - goto LAB_0062dbfb; - } -LAB_0062dbf9: - iVar6 = 0; -LAB_0062dbfb: - manager = g_manager; - if (iVar6 != this->_subtype) { - this->_subtype = iVar6; - entityConfig = EntityConfig::GetEntity(&manager->_entityConfig,this->_type,this->_variant,iVar6) - ; - this->_config = entityConfig; - ANM2::Load(&this->_sprite,&entityConfig->anm2Path,1); - anim = &(this->_sprite)._animDefaultName; - if (0xf < (this->_sprite)._animDefaultName._capacity) { - anim = *GHIDRA_CAST(anim->_buf); - } - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - expectedName = anim; - do { - bVar4 = *curAnimChar; - isLess = bVar4 < (uint8_t)expectedName->_buf[0]; - if (bVar4 != expectedName->_buf[0]) { -LAB_0062dd02: - uVar5 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0062dd07; - } - if (bVar4 == 0) break; - bVar4 = curAnimChar[1]; - isLess = bVar4 < (uint8_t)expectedName->_buf[1]; - if (bVar4 != expectedName->_buf[1]) goto LAB_0062dd02; - curAnimChar = curAnimChar + 2; - expectedName = GHIDRA_CAST((expectedName->_buf + 2)); - } while (bVar4 != 0); - uVar5 = 0; -LAB_0062dd07: - if ((uVar5 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0062dd2f; - } - bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(anim),1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } -LAB_0062dd2f: - if (familiars[0] != '\0') { - ExceptionList = local_10; - return; - } - local_8 = 1; -LAB_0062dfa3: - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)familiars)) + 0x4))),0); - ExceptionList = local_10; - return; -LAB_0062de6b: - uVar5 = uVar5 + 1; - if (uStack_1c <= uVar5) goto LAB_0062df8f; - goto LAB_0062de40; -LAB_0062dbf4: - uVar5 = uVar5 + 1; - if (uStack_1c <= uVar5) goto LAB_0062dbf9; - goto LAB_0062dbc5; -} - -// 0062e020 -void Entity_Familiar::set_player(Entity_Player *player) -{ - short sVar1; - char isDelayed; - uint8_t isFollower; - bool isOrbiting; - - isFollower = this->_isFollower; - if (((isFollower == 0) && (-1 < this->_orbitLayer)) && (this->_exists != 0)) { - sVar1 = (uint16_t)this->_isDelayed << 8; - isOrbiting = true; - RecalculateOrbitOffset(this,this->_orbitLayer,0); -LAB_0062e072: - if (this->_variant != 0xeb) goto LAB_0062e088; - } - else { - sVar1 = CONCAT11(this->_isDelayed,isFollower); - isOrbiting = false; - if (isFollower == 0) goto LAB_0062e072; - isOrbiting = false; - } - RemoveFromFollowers(this); -LAB_0062e088: - isDelayed = (char)((uint16_t)sVar1 >> 8); - if (isDelayed != '\0') { - RemoveFromDelayed(this); - } - this->_player = player; - if (isOrbiting) { - RecalculateOrbitOffset(this,this->_orbitLayer,1); - } - if (((char)sVar1 != '\0') || (this->_variant == 0xeb)) { - AddToFollowers(this); - } - if (isDelayed != '\0') { - AddToDelayed(this); - } - return; -} - -// 0062e120 -void Entity_Familiar::ai_samsons_chains() -{ - float fVar1; - float fVar2; - uint64_t qVar3; - float *pfVar4; - int iVar5; - float *pfVar6; - int iVar7; - uint64_t *allocCounter; - uint32_t uVar8; - float fVar9; - float fVar10; - EntityList_EL chainList; - float local_40; - float local_3c; - float local_38; - float local_34; - float local_30; - float local_2c; - float toPlayerY; - float toPlayerX; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t uStack_14; - Game *game; - Entity_Familiar *otherChain; - Room *room; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - uStack_14 = 0xffffffff; - puStack_18 = &LAB_00af3a60; - local_1c = ExceptionList; - ExceptionList = &local_1c; - toPlayerX = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; - toPlayerY = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; - local_3c = toPlayerX * toPlayerX + toPlayerY * toPlayerY; - local_40 = sqrtf(local_3c); - game = g_game; - if (0.01 < local_40) { - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - fVar9 = toPlayerX; - if (0.0 < local_40) { - fVar9 = (1.0 / local_40) * toPlayerX; - } - local_30 = (local_40 - 70.0) * 0.1; - local_2c = 0.0; - local_34 = (local_40 - 100.0) * 1.6; - local_38 = 0.0; - pfVar6 = &local_30; - if (local_30 <= 0.0) { - pfVar6 = &local_2c; - } - pfVar4 = &local_34; - if (local_34 <= 0.0) { - pfVar4 = &local_38; - } - (this->_velocity).x = fVar9 * (*pfVar6 + *pfVar4) + (this->_velocity).x; - } - else { - fVar9 = toPlayerY; - fVar10 = toPlayerX; - if (0.0 < local_40) { - fVar9 = (1.0 / local_40) * toPlayerY; - fVar10 = (1.0 / local_40) * toPlayerX; - } - local_38 = (local_40 - 70.0) * 0.1; - local_34 = 0.0; - local_30 = (local_40 - 100.0) * 1.6; - local_2c = 0.0; - pfVar6 = &local_38; - if (local_38 <= 0.0) { - pfVar6 = &local_34; - } - fVar1 = *pfVar6; - pfVar6 = &local_30; - if (local_30 <= 0.0) { - pfVar6 = &local_2c; - } - fVar2 = *pfVar6; - (this->_velocity).x = fVar10 * (fVar1 + fVar2) + (this->_velocity).x; - (this->_velocity).y = fVar9 * (fVar1 + fVar2) + (this->_velocity).y; - } - } - iVar5 = this->_variant; - (this->_velocity).x = (this->_velocity).x * 0.8836; - (this->_velocity).y = (this->_velocity).y * 0.8836; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&chainList,3,iVar5,-1,0,0); - uVar8 = 0; - if (chainList._size != 0) { - do { - otherChain = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(chainList)) + 0x4))) + uVar8 * 4)); - if (otherChain != this) { - local_2c = (this->_pos).x - (otherChain->_pos).x; - local_30 = (this->_pos).y - (otherChain->_pos).y; - local_38 = 0.0; - fVar9 = sqrtf(local_2c * local_2c + local_30 * local_30); - local_34 = 20.0 - fVar9; - pfVar6 = &local_38; - if (0.0 <= 20.0 - fVar9) { - pfVar6 = &local_34; - } - if (fVar9 <= 0.0) { - fVar10 = local_30; - fVar9 = local_2c; - } - else { - fVar9 = (*pfVar6 * 0.1) / fVar9; - fVar10 = local_30 * fVar9; - fVar9 = local_2c * fVar9; - } - (this->_velocity).x = fVar9 + (this->_velocity).x; - (this->_velocity).y = fVar10 + (this->_velocity).y; - } - uVar8 = uVar8 + 1; - } while (uVar8 < GHIDRA_UINT(chainList._size)); - } - if (14400.0 < local_3c) { - if (local_40 <= 0.0) { - fVar9 = toPlayerX; - local_3c = toPlayerY; - } - else { - fVar9 = toPlayerX * (120.0 / local_40); - local_3c = toPlayerY * (120.0 / local_40); - } - local_40 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - fVar9; - local_3c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - local_3c; - room = g_game->_room; - iVar7 = GHIDRA_INT(((local_40 - 40.0) / 40.0 + 0.5)); - iVar5 = GHIDRA_INT(((local_3c - 120.0) / 40.0 + 0.5)); - if ((((iVar7 < 0) || (room->_gridWidth <= iVar7)) || (iVar5 < 0)) || - (room->_gridHeight <= iVar5)) { - iVar7 = -1; - } - else { - iVar7 = iVar5 * room->_gridWidth + iVar7; - } - uVar8 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar7); - if (uVar8 == 0) { - (this->_pos).x = local_40; - (this->_pos).y = local_3c; - (this->_velocity).x = g_vectorZero.x; - fVar9 = g_vectorZero.y; - } - else { - fVar9 = (this->_velocity).x; - local_38 = (this->_velocity).y; - local_40 = 5.0; - local_3c = sqrtf(fVar9 * fVar9 + local_38 * local_38); - pfVar6 = &local_40; - if (local_3c <= 5.0) { - pfVar6 = &local_3c; - } - fVar9 = *pfVar6; - if (local_3c <= 0.0) goto LAB_0062e5c3; - (this->_velocity).x = (fVar9 / local_3c) * (this->_velocity).x; - fVar9 = local_38 * (fVar9 / local_3c); - } - (this->_velocity).y = fVar9; - } -LAB_0062e5c3: - if ((*GHIDRA_CAST((GHIDRA_CAST(&(chainList)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(chainList)) + 0x4))) != 0) { - uVar8 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(chainList)) + 0x4))) + -4)); - qVar3 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar8; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar3) < uVar8)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(chainList)) + 0x4))) + -4))); - } - } - ExceptionList = local_1c; - return; -} - -// 0062e620 -void Entity_Familiar::update_weapon(uint8_t isInterpolated) -{ - void *pvVar1; - uint8_t isLullaby; - Weapon *newWeapon; - uint32_t rngResult; - int weaponTarget; - float shootDirection; - undefined3 in_stack_00000005; - float local_28; - Vector local_24; - uint8_t isShooting [4]; - Vector aimDirection; - Vector markedAim; - int *oldWeapon; - int playerWeapon; - - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) != '\0') { - return; - } - playerWeapon = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13e0)); - if (isInterpolated == 0) { - oldWeapon = this->_weapon; - if (playerWeapon == 0) { - if (oldWeapon != GHIDRA_CAST(0x0)) { - Isaac::DestoryWeapon(&this->_weapon); - } - } - else { - if (oldWeapon != GHIDRA_CAST(0x0)) { - if (oldWeapon[0xc] == *GHIDRA_CAST((playerWeapon + 0x30))) goto LAB_0062e6b0; - (**(code **)(*oldWeapon + 0x14))(); - if (this->_weapon != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_weapon))(1); - } - this->_weapon = (void *)0x0; - } - newWeapon = Isaac::CreateWeapon(*GHIDRA_CAST((playerWeapon + 0x30)),GHIDRA_CAST(this)); - this->_weapon = newWeapon; - } - } -LAB_0062e6b0: - pvVar1 = this->_player; - if ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x139a)) == '\0')) && - (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x414)) < 1)))) { - aimDirection.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1630)); - local_28 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x162c)); - aimDirection.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1634)); - isShooting[0] = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x162c)) != -1; - markedAim.y = 0.0; - markedAim.x = 0.0; - if ((playerWeapon != 0) && (this->_weapon != (void *)0x0)) { - TryAimAtMarkedTarget(this,&aimDirection,GHIDRA_CAST(&local_28),&markedAim); - } - shootDirection = local_28; - if (this->_variant == 0x4c) { - rngResult = Random(); - local_28 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - local_28 = local_28 + local_28; - local_24.x = cos(local_28); - aimDirection.y = sin(local_28); - aimDirection.x = local_24.x; - if (ABS(local_24.x) <= ABS(aimDirection.y)) { - shootDirection = (float)(GHIDRA_UINT((0.0 <= aimDirection.y)) * 2 + 1); - local_24.x = shootDirection; - } - else { - shootDirection = 2.8026e-45; - if (local_24.x < 0.0) { - shootDirection = 0.0; - } - } - } - if (this->_counter < 1) { - if ((shootDirection == -NAN) && - ((this->_headFrameDelay < 1 || - (shootDirection = (float)this->_shootDirection, shootDirection == -NAN)))) { - shootDirection = 4.2039e-45; - } - if ((this->_weapon != GHIDRA_CAST(0x0)) && - (weaponTarget = (**(code **)(*GHIDRA_CAST(this->_weapon) + 0x24))(), weaponTarget != 0)) { - local_24.x = *GHIDRA_CAST((weaponTarget + 0x33c)) - (this->_pos).x; - local_24.y = *GHIDRA_CAST((weaponTarget + 0x340)) - (this->_pos).y; - shootDirection = (float)vector_to_direction(&local_24); - } - this->_shootDirection = GHIDRA_INT(shootDirection); - } - if ((playerWeapon != 0) && (pvVar1 = this->_weapon, pvVar1 != (void *)0x0)) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x28)) = markedAim.x; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x2c)) = markedAim.y; - isLullaby = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x8d,0); - if (isLullaby == 0) { - *GHIDRA_CAST((GHIDRA_CAST(this->_weapon) + 0x10)) = *GHIDRA_CAST((playerWeapon + 0x10)); - } - else { - *GHIDRA_CAST((GHIDRA_CAST(this->_weapon) + 0x10)) = *GHIDRA_CAST((playerWeapon + 0x10)) * 0.5; - } - *GHIDRA_CAST((GHIDRA_CAST(this->_weapon) + 0x34)) = *GHIDRA_CAST((playerWeapon + 0x34)) | 0x40000000; - (**(code **)(*GHIDRA_CAST(this->_weapon) + 8))(_isInterpolated); - (**(code **)(*GHIDRA_CAST(this->_weapon) + 0xc))(isShooting,local_24.y,_isInterpolated); - } - if (isInterpolated == 0) { - if (this->_fireCooldown == 0) { - if (this->_headFrameDelay < 9) { - PlayFloatAnim(this,this->_shootDirection); - } - else { - PlayShootAnim(this,this->_shootDirection); - } - } - if (0 < this->_counter) { - this->_counter = this->_counter + -1; - } - if (0 < this->_headFrameDelay) { - this->_headFrameDelay = this->_headFrameDelay + -1; - } - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - isLullaby = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x8d,0); - if ((isLullaby != 0) && (0 < this->_fireCooldown)) { - this->_fireCooldown = this->_fireCooldown + -1; - } - } - } - return; -} - -// 0062ee30 -void Entity_Familiar::ai_lil_gurdy() -{ - Vector *coneDir; - void *pvVar1; - uint8_t bVar2; - uint32_t uVar3; - Vector *targetDir; - uint8_t *puVar4; - int chargeFrames; - float fVar5; - float fVar6; - float fVar7; - float fVar8; - float fVar9; - float fVar10; - char *anim; - EntityRef *source; - float local_44; - Vector local_40; - Vector local_38; - EntityRef damageSource; - Manager *manager; - int target; - - if (this->_state == 0) { - pvVar1 = this->_player; - this->_entityGridCollisionClass = 3; - target = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x162c)); - fVar5 = sqrtf(*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1630)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1630)) + - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1634)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1634))); - if ((fVar5 < 0.5) && (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1638)) == '\0')) { - target = -1; - } - Isaac::GetAxisAlignedUnitVectorFromDir(&local_38,this->_lastDirection); - bVar2 = TryAimAtMarkedTarget(this,&local_38,&this->_lastDirection,GHIDRA_CAST(0x0)); - if ((bVar2 != 0) && (0x59 < this->_fireCooldown)) { - target = -1; - } - pvVar1 = this->_player; - if ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x139a)) == '\0')) && - (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x414)) < 1)))) { - chargeFrames = this->_fireCooldown; - if (target == -1) { - if (chargeFrames < 1) { - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) goto LAB_0062f0b9; - anim = GHIDRA_CAST(s_Idle); - } - else { - this->_state = 1; - target = 0x5a; - if (chargeFrames < 0x5a) { - target = chargeFrames; - } - this->_entityGridCollisionClass = 6; - this->_fireCooldown = target; - fVar5 = ((float)target / 90.0) * 20.0 + 5.0; - fVar6 = local_38.x * fVar5 + (this->_velocity).x; - (this->_velocity).y = local_38.y * fVar5 + (this->_velocity).y; - (this->_velocity).x = fVar6; - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; - fVar10 = fVar10 + fVar10; - fVar7 = fVar7 + fVar7; - fVar9 = local_38.y * fVar7 + local_38.x * fVar10; - fVar5 = local_38.y * fVar9; - fVar9 = local_38.x * fVar9; - if (local_38.y * fVar5 + local_38.x * fVar9 < 0.0) { - fVar7 = fVar7 - fVar5; - fVar10 = fVar10 - fVar9; - } - anim = "Dashing"; - (this->_velocity).y = fVar7 + (this->_velocity).y; - (this->_velocity).x = fVar6 + fVar10; - local_38.x = fVar5; - } - } - else { - if (chargeFrames == 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("ChargeStart"),0); - chargeFrames = this->_fireCooldown; - } - this->_lastDirection = target; - this->_fireCooldown = chargeFrames + 1; - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) goto LAB_0062f0b9; - anim = "Charging"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(anim),0); - } -LAB_0062f0b9: - if (this->_state == 0) { - local_44 = this->_friction * 0.8; - this->_friction = local_44; - fVar5 = (this->_pos).x; - fVar9 = (this->_pos).y; - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - fVar8 = fVar5 - fVar7; - fVar6 = fVar9 - fVar10; - if (2500.0 < fVar6 * fVar6 + fVar8 * fVar8) { - local_38.x = (fVar7 - fVar5) * 0.05; - local_40.x = (fVar10 - fVar9) * 0.05; - fVar7 = sqrtf(local_40.x * local_40.x + local_38.x * local_38.x); - fVar5 = local_40.x; - fVar9 = local_38.x; - if ((1.0 < fVar7) && (0.0 < fVar7)) { - fVar5 = (1.0 / fVar7) * local_40.x; - fVar9 = (1.0 / fVar7) * local_38.x; - } - if (local_44 != 0.0) { - fVar7 = this->_speedMultiplier; - (this->_velocity).y = (fVar7 * fVar5) / local_44 + (this->_velocity).y; - (this->_velocity).x = (fVar7 * fVar9) / local_44 + (this->_velocity).x; - } - } - } - uVar3 = Random(); - if (uVar3 % 3 != 0) goto LAB_0062f7c8; - fVar5 = 10.0; - } - else { - if (this->_state != 1) goto LAB_0062f7c8; - if (this->_collidesWithGrid != 0) { - local_38.x = (this->_gridCollisionVelocity).x + (this->_pos).x; - local_40.x = (float)g_game->_room; - local_44 = (this->_gridCollisionVelocity).y; - local_38.y = local_44 + (this->_pos).y; - local_38.x = (float)(GHIDRA_CAST((GHIDRA_CAST(local_40.x))))->Room::GetGridIndex(&local_38); - if (GHIDRA_INT(local_38.x) < 0) { - fVar5 = local_44; - } - else { - damageSource._entity = this->_player; - if (damageSource._entity == (void *)0x0) { - damageSource._type = 0; - damageSource._variant = 0; - damageSource._spawnerType = 0; - damageSource._spawnerVariant = 0; - damageSource._position.x = g_vectorZero.x; - damageSource._position.y = g_vectorZero.y; - damageSource._velocity.x = g_vectorZero.x; - damageSource._velocity.y = g_vectorZero.y; -LAB_0062f341: - damageSource._flags = 0; - if (damageSource._entity != (void *)0x0) goto LAB_0062f347; - damageSource._flags = 0; -LAB_0062f363: - local_44 = 0.0; - if (damageSource._entity != (void *)0x0) goto LAB_0062f36f; -LAB_0062f388: - uVar3 = 0; - } - else { - damageSource._type = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x28)); - damageSource._variant = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x2c)); - damageSource._spawnerType = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x34)); - damageSource._spawnerVariant = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x38)); - damageSource._position.x = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x33c)); - damageSource._position.y = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x340)); - damageSource._velocity.x = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x360)); - damageSource._velocity.y = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x364)); - if ((*GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x168)) & 0x100) == 0) goto LAB_0062f341; - damageSource._flags = 1; -LAB_0062f347: - if ((*GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x168)) & 0x20000000) == 0) goto LAB_0062f363; - local_44 = 2.8026e-45; -LAB_0062f36f: - if ((*GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x16c)) & 0x400000) == 0) goto LAB_0062f388; - uVar3 = 4; - } - fVar5 = (this->_gridCollisionVelocity).y; - fVar9 = (this->_gridCollisionVelocity).x; - damageSource._flags = uVar3 | GHIDRA_UINT(local_44) | damageSource._flags; - source = &damageSource; - fVar5 = sqrtf(fVar9 * fVar9 + fVar5 * fVar5); - fVar5 = fVar5 / 10.0; - if (fVar5 <= 1.0) { - fVar5 = 1.0; - } - if (4.0 <= fVar5) { - fVar5 = 4.0; - } - (GHIDRA_CAST((GHIDRA_CAST(local_40.x))))->Room::DamageGridWithSource(GHIDRA_INT(local_38.x),GHIDRA_INT(fVar5),source); - fVar5 = (this->_gridCollisionVelocity).y; - } - fVar9 = (this->_gridCollisionVelocity).x; - if (64.0 < fVar5 * fVar5 + fVar9 * fVar9) { - (this->_hitList)._end = (this->_hitList)._begin; - fVar5 = (this->_gridCollisionVelocity).y; - } - fVar9 = (this->_gridCollisionVelocity).x; - local_44 = sqrtf(fVar9 * fVar9 + fVar5 * fVar5); - local_40.x = (this->_velocity).x; - coneDir = &this->_velocity; - local_38.x = (this->_velocity).y; - fVar5 = sqrtf(local_40.x * local_40.x + local_38.x * local_38.x); - if (fVar5 <= 0.0) { - fVar9 = local_40.x; - fVar5 = local_38.x; - } - else { - fVar9 = local_40.x * (1.0 / fVar5); - fVar5 = local_38.x * (1.0 / fVar5); - } - coneDir->x = fVar9; - (this->_velocity).y = fVar5; - if ((0.0 < local_44) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100), bVar2 == 0)) { - PickEnemyTarget(this,800.0,0,0xb,coneDir,15.0); - target = this->_target; - if (target != 0) { - local_38.x = *GHIDRA_CAST((target + 0x33c)) - (this->_pos).x; - local_38.y = *GHIDRA_CAST((target + 0x340)) - (this->_pos).y; - targetDir = (GHIDRA_CAST((&local_38)))->Vector::Normalized(&local_40); - coneDir->x = targetDir->x; - (this->_velocity).y = targetDir->y; - } - } - fVar9 = local_44 * (this->_velocity).y; - fVar5 = local_44 * coneDir->x; - (this->_velocity).y = fVar9; - coneDir->x = fVar5; - manager = g_manager; - fVar5 = -(fVar9 * (this->_gridCollisionNormal).y + fVar5 * (this->_gridCollisionNormal).x); - if (fVar5 <= 20.0) { - if (4.0 < fVar5) { - fVar5 = (fVar5 - 4.0) * 0.125; - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - SoundEffects::PlayWithFartOverride(0x48,fVar5 * 0.5 + 0.5,2,0,1.0); - } - } - else { - local_38.x = 3.92364e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38.x),0.8,2,0,1.0,0.0); - } - } - local_40.x = (this->_velocity).x; - fVar5 = (this->_velocity).y; - local_38.x = sqrtf(local_40.x * local_40.x + fVar5 * fVar5); - if (this->_fireCooldown < 1) { - local_44 = 0.98; - local_40.x = local_38.x * 0.02 + 0.8; - puVar4 = GHIDRA_CAST(&local_40); - if (0.98 <= local_40.x) { - puVar4 = GHIDRA_CAST(&local_44); - } - this->_friction = *GHIDRA_CAST(puVar4) * this->_friction; - } - else { - target = this->_fireCooldown + -3; - this->_fireCooldown = target; - if (0.0 < local_38.x) { - fVar5 = (float)target / 60.0; - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - fVar5 = fVar5 * (3.0 / local_38.x) + local_38.x; - if (40.0 <= fVar5) { - fVar5 = 40.0; - } - (this->_velocity).x = (fVar5 / local_38.x) * local_40.x; - (this->_velocity).y = (fVar5 / local_38.x) * (this->_velocity).y; - local_38.x = fVar5; - } - } - if (local_38.x < 1.0) { - this->_state = 0; - this->_fireCooldown = 0; - ANM2::Play(&this->_sprite,GHIDRA_CAST("DashStop"),0); - } - fVar5 = 10.0 / local_38.x; - if (fVar5 <= 2.0) { - fVar5 = 2.0; - } - if (10.0 <= fVar5) { - fVar5 = 10.0; - } - } - target = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(fVar5,0.0); - if (target != 0) { - uVar3 = Random(); - Entity_NPC::MakeSplat - (GHIDRA_CAST(this), - (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.2); - } -LAB_0062f7c8: - (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; - return; -} - -// 00630440 -void Entity_Familiar::AddKeys(int param_2) -{ - this->_keys = this->_keys + param_2; - return; -} - -// 00630450 -void Entity_Familiar::store_backup(void *backup) -{ - int iVar1; - uint32_t linkedHealth; - - *GHIDRA_CAST(backup) = this->_initSeed; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x2c)) = (this->_dropRNG)._seed; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 4)) = this->_variant; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 8)) = this->_subtype; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0xc)) = this->_coins; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x10)) = this->_hearts; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x14)) = this->_keys; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x18)) = this->_state; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x1c)) = this->_roomClearCount; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x20)) = (this->_formationTargetOffset).x; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x24)) = (this->_formationTargetOffset).y; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x28)) = this->_health; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x30)) = this->_isNotCountedAsFollower; - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x31)) = this->_isSubtype55555; - iVar1 = this->_variant; - if ((iVar1 == 0xce) || (iVar1 == 0xed)) { - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x1c)) = this->_orbitLayer; - iVar1 = this->_variant; - } - if (iVar1 == 0xf1) { - if (this->_linkedEntity == 0) { - linkedHealth = 0; - } - else { - linkedHealth = *GHIDRA_CAST((this->_linkedEntity + 0x380)); - } - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x28)) = linkedHealth; - iVar1 = this->_variant; - } - if (iVar1 == 0xec) { - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x28)) = this->_orbitSpeed; - iVar1 = this->_variant; - } - if (iVar1 == 0xe7) { - iVar1 = __RTDynamicCast(this->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, - &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0); - *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((iVar1 + 0x50))); - } - return; -} - -// 00631050 -void Entity_Familiar::MoveDelayed(int numFrames) -{ - float fVar1; - uint8_t isDuctTape; - uint32_t *historyEntry; - float *historySlot; - void *leader; - int remaining; - int historyIndex; - uint32_t leaderY; - float posY; - - if (this->_isSubtype55555 != 0) { - (this->_pos).x = (this->_formationOffset).x; - (this->_pos).y = (this->_formationOffset).y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - return; - } - isDuctTape = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x6d,0); - if (isDuctTape != 0) { - move_to_parent_offset(this); - return; - } - if (((this->_formationOffset).x == g_vectorZero.x) && - ((this->_formationOffset).y == g_vectorZero.y)) { - historyIndex = this->_moveDelayNum; - } - else { - reset_follow_target(this); - historyIndex = -1; - } - leader = this->_player; - if ((void *)this->_parent != (void *)0x0) { - leader = (void *)this->_parent; - } - if (historyIndex == -1) { - historyIndex = 0; - this->_moveDelayNum = 0; - if (3 < numFrames) { - remaining = (numFrames - 4U >> 2) + 1; - historyIndex = remaining * 4; - historyEntry = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424)))); - do { - leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); - historyEntry[-3] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); - historyEntry[-2] = leaderY; - leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); - historyEntry[-1] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); - *historyEntry = leaderY; - leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); - historyEntry[1] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); - historyEntry[2] = leaderY; - leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); - historyEntry[3] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); - historyEntry[4] = leaderY; - remaining = remaining + -1; - historyEntry = historyEntry + 8; - } while (remaining != 0); - } - if (historyIndex < numFrames) { - remaining = numFrames - historyIndex; - historySlot = &(GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y; - do { - leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); - *historySlot = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); - historySlot[1] = (float)leaderY; - remaining = remaining + -1; - historySlot = historySlot + 2; - } while (remaining != 0); - } - } - else { - historyIndex = (historyIndex + 1) % numFrames; - this->_moveDelayNum = historyIndex; - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); - (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); - (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 5].x = fVar1; - } - historyIndex = (this->_moveDelayNum + 1) % numFrames; - if (this->_variant == 0x83) { - fVar1 = (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 5].x; - posY = (this->_pos).y; - (this->_velocity).x = - ((GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y - (this->_pos).x) * 0.5; - (this->_velocity).y = (fVar1 - posY) * 0.5; - } - else { - fVar1 = (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 5].x; - (this->_velocity).x = - ((GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y - (this->_pos).x) * 0.1 + - (this->_velocity).x; - (this->_velocity).y = (fVar1 - (this->_pos).y) * 0.1 + (this->_velocity).y; - } - this->_friction = this->_friction * 0.7; - return; -} - -// 006312f0 -void Entity_Familiar::MoveDiagonally(float speed) -{ - Vector *position; - uint8_t bVar1; - uint32_t rngResult; - Entity *spawned; - int *effect; - float fVar2; - float fVar3; - float fVar4; - Vector local_10; - Game *game; - bool isFixedAngle; - int tls; - - if ((this->_variant == 0x4c) || (this->_variant == 0x3a)) { - isFixedAngle = true; - } - else { - isFixedAngle = false; - } - if (this->_isSubtype55555 != 0) { - (this->_pos).x = (this->_formationOffset).x; - (this->_pos).y = (this->_formationOffset).y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - return; - } - fVar2 = (this->_velocity).x; - if ((fVar2 == g_vectorZero.x) && ((this->_velocity).y == g_vectorZero.y)) { - rngResult = Random(); - local_10.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - local_10.x = local_10.x + local_10.x; - fVar2 = cos(local_10.x); - fVar3 = sin(local_10.x); - (this->_velocity).x = fVar2 * 10.0; - (this->_velocity).y = fVar3 * 10.0; - return; - } - tls = *GHIDRA_CAST(ThreadLocalStoragePointer); - (this->_velocity).x = fVar2 * 0.7; - (this->_velocity).y = (this->_velocity).y * 0.7; - if ((*GHIDRA_CAST((tls + 0xc)) < DAT_00c7fd14) && - (_Init_thread_header(&DAT_00c7fd14), DAT_00c7fd14 == -1)) { - DAT_00c7fd18 = sqrtf(2.0); - _Init_thread_footer(&DAT_00c7fd14); - } - local_10.x = 0.7853982; - if (!isFixedAngle) { - local_10.x = ((float)this->_fireCooldown * 3.1415927) / 180.0 + 0.7853982; - } - fVar4 = cos(local_10.x); - fVar3 = DAT_00c7fd18; - fVar2 = (this->_velocity).x; - if (fVar2 <= 0.0) { - fVar2 = fVar2 - DAT_00c7fd18 * fVar4 * speed; - } - else { - fVar2 = DAT_00c7fd18 * fVar4 * speed + fVar2; - } - (this->_velocity).x = fVar2; - fVar4 = sin(local_10.x); - game = g_game; - fVar2 = (this->_velocity).y; - if (fVar2 <= 0.0) { - fVar2 = fVar2 - fVar4 * fVar3 * speed; - } - else { - fVar2 = fVar4 * fVar3 * speed + fVar2; - } - position = &this->_pos; - (this->_velocity).y = fVar2; - Room::GetClampedPositionImpl(game->_room,&local_10,position,0.0,0.0,0.0,0.0); - if (position->x <= local_10.x) { - if (position->x < local_10.x) { - (this->_velocity).x = speed * 3.0 + (this->_velocity).x; - } - } - else { - (this->_velocity).x = (this->_velocity).x - speed * 3.0; - } - fVar2 = (this->_pos).y; - if (fVar2 <= local_10.y) { - if (fVar2 < local_10.y) { - (this->_velocity).y = speed * 3.0 + (this->_velocity).y; - } - } - else { - (this->_velocity).y = (this->_velocity).y - speed * 3.0; - } - rngResult = Random(); - if (((rngResult & 3) == 0) && ((this->_variant == 0x11 || (this->_variant == 0xcf)))) { - rngResult = Random(); - spawned = Game::SpawnEx(g_game,1000,7,position,&g_vectorZero,GHIDRA_CAST(0x0),0,rngResult,0); - effect = GHIDRA_CAST(__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0)); - rngResult = Random(); - fVar2 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.3 + 0.1; - effect[0x39] = GHIDRA_INT(fVar2); - effect[0x3a] = GHIDRA_INT(fVar2); - (**(code **)(*effect + 0xc))(); - } - game = g_game; - if ((((this->_variant == 0xcf) && ((this->_flags & 0x4000) == 0)) && - (bVar1 = Game::IsPaused(g_game), bVar1 == 0)) && - (((~(uint8_t)game->_frameCount & 1) != 0 && (rngResult = Random(), 1 < rngResult % 5)))) { - rngResult = Random(); - spawned = Game::SpawnEx(g_game,1000,0x2e,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,rngResult,0) - ; - effect = GHIDRA_CAST(__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0)); - rngResult = Random(); - fVar3 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.2; - fVar2 = fVar3 * g_vectorOne.x; - effect[0x3a] = GHIDRA_INT((fVar3 * g_vectorOne.y)); - effect[0x39] = GHIDRA_INT(fVar2); - (**(code **)(*effect + 0xc))(); - } - if (!isFixedAngle) { - if (((0.0 < (this->_velocity).x) && ((this->_targetPosition).x <= 0.0)) || - ((0.0 < (this->_velocity).y && ((this->_targetPosition).y <= 0.0)))) { - rngResult = Random(); - this->_fireCooldown = rngResult % 0x1f - 0xf; - } - (this->_targetPosition).x = (this->_velocity).x; - (this->_targetPosition).y = (this->_velocity).y; - } - return; -} - -// 00631850 -void Entity_Familiar::move_to_parent_offset() -{ - Vector *followOffset; - float fVar1; - float fVar2; - float fVar3; - Vector followOffsetResult; - void *player; - - if ((*GHIDRA_CAST(g_game->_room) != '\0') && - (g_game->_frameCount == *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)))) { - player = this->_player; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x33c)); - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x340)); - followOffset = UpdateFollowPosition(this,&followOffsetResult); - fVar3 = followOffset->y; - (this->_pos).x = fVar1 + followOffset->x; - (this->_pos).y = fVar2 + fVar3; - return; - } - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - followOffset = UpdateFollowPosition(this,&followOffsetResult); - fVar1 = (fVar1 + followOffset->x) - (this->_pos).x; - fVar2 = (fVar2 + followOffset->y) - (this->_pos).y; - (this->_velocity).x = fVar1; - fVar3 = fVar1 * fVar1 + fVar2 * fVar2; - (this->_velocity).y = fVar2; - if (10000.0 < fVar3) { - fVar3 = sqrtf(fVar3); - if (0.0 < fVar3) { - (this->_velocity).y = (100.0 / fVar3) * fVar2; - (this->_velocity).x = (100.0 / fVar3) * fVar1; - } - } - (this->_velocity).x = (this->_velocity).x * 0.8; - (this->_velocity).y = (this->_velocity).y * 0.8; - return; -} - -// 00631b20 -void Entity_Familiar::delirium_morph() -{ - char *pcVar1; - size_t _Size; - uint32_t uVar2; - uint64_t qVar3; - uint32_t uVar4; - uint32_t uVar5; - LayerState *layer; - std_string *extraout_EAX; - std_string *path; - uint8_t *resolvedPath; - Entity *poofEffect; - int iVar6; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint8_t unk; - void *pvVar7; - uint64_t *heapCounter; - code *pcVar8; - char *_Size_00; - uint32_t uVar9; - float fVar10; - uint32_t *local_70; - int oldSirenHelper; - uint32_t *local_68; - Entity_Familiar *local_64; - std_string *local_60; - uint32_t local_5c; - char *local_58; - ANM2 *local_54; - uint8_t *local_50; - code *local_4c; - uint8_t local_46; - uint8_t local_45; - void *redirectedPath [3]; - uint64_t local_38; - uint32_t local_30; - std_string sheetPath; - void *savedExceptionList; - uint8_t *puStack_c; - uint32_t ehState; - float oldPosY; - float oldVelocityX; - float oldVelocityY; - uint32_t *refSlot; - - ehState = 0xffffffff; - puStack_c = &LAB_00af6e7d; - savedExceptionList = ExceptionList; - ExceptionList = &savedExceptionList; - local_58 = GHIDRA_CAST(this->_variant); - uVar5 = this->_initSeed; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x0))) = '\x05'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x1))) = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x2))) = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x3))) = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x4))) = 3; - local_54 = GHIDRA_CAST(0x15); - local_50 = GHIDRA_CAST(0x0); - do { - local_64 = this; - if (local_58 != GHIDRA_CAST(this->_variant)) break; - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar8 = (code *)swi(3); - (*pcVar8)(); - return; - } - uVar5 = uVar5 >> 5 ^ uVar5; - uVar5 = uVar5 << 3 ^ uVar5; - uVar5 = uVar5 >> 0x15 ^ uVar5; - local_50 = GHIDRA_CAST((GHIDRA_INT(local_50) + 1)); - local_58 = *GHIDRA_CAST((&DAT_00b64820 + (uVar5 % 0x16) * 4)); - } while (local_50 < 10); - local_4c = this->_player; - fVar10 = (this->_pos).x; - local_5c = this->_child; - local_50 = GHIDRA_CAST(this->_parent); - iVar6 = this->_spawnerType; - oldPosY = (this->_pos).y; - local_60 = GHIDRA_CAST(this->_spawnerVariant); - oldVelocityX = (this->_velocity).x; - local_68 = this->_sirenOriginalPlayer; - oldVelocityY = (this->_velocity).y; - oldSirenHelper = this->_sirenHelper; - if (this->_weapon != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_weapon) + 0x14))(__security_cookie ^ GHIDRA_UINT(&(&sheetPath)[1]._size)); - if (this->_weapon != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_weapon))(1); - } - this->_weapon = (void *)0x0; - } - if (GHIDRA_CAST(this->_linkedEntity) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_linkedEntity) + 0x28))(); - } - local_46 = this->_isFollower; - local_45 = this->_isDelayed; - RecalculateOrbitOffset(this,this->_orbitLayer,0); - RemoveFromFollowers(this); - RemoveFromDelayed(this); - this->ClearReferences(); - if (this->_spawnerEntity != 0) { - local_70 = &this->_spawnerEntity; - msvc::multiset::erase(&local_70); - } - this->_spawnerEntity = local_4c; - if (local_4c != (code *)0x0) { - msvc::multiset::insert(&this->_spawnerEntity); - } - local_4c = *(code **)(*GHIDRA_CAST(this) + 4); - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar8 = (code *)swi(3); - (*pcVar8)(); - return; - } - uVar5 = uVar5 >> ((uint8_t)local_38 & 0x1f) ^ uVar5; - uVar5 = uVar5 << (SUB81(local_38,4) & 0x1f) ^ uVar5; - (*local_4c)(this->_type,local_58,0,uVar5 >> ((uint8_t)local_54 & 0x1f) ^ uVar5); - if (((this->_isFollower != 0) && (local_46 != 0)) || ((this->_isDelayed != 0 && (local_45 != 0)))) - { - RemoveFromFollowers(this); - RemoveFromDelayed(this); - refSlot = &this->_parent; - this->_isFollower = local_46; - this->_isDelayed = local_45; - if (*refSlot != 0) { - local_4c = (code *)refSlot; - msvc::multiset::erase(&local_4c); - } - *refSlot = local_50; - if (local_50 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(refSlot); - pcVar8 = (code *)(GHIDRA_INT(local_50) + 0x3c0); - if (*GHIDRA_CAST(pcVar8) != 0) { - local_4c = pcVar8; - msvc::multiset::erase(&local_4c); - } - *GHIDRA_CAST(pcVar8) = this; - msvc::multiset::insert(pcVar8); - } - refSlot = &this->_child; - if (this->_child != 0) { - local_4c = (code *)refSlot; - msvc::multiset::erase(&local_4c); - } - *refSlot = local_5c; - if (local_5c != 0) { - msvc::multiset::insert(refSlot); - pcVar8 = (code *)(local_5c + 0x3bc); - if (*GHIDRA_CAST(pcVar8) != 0) { - local_4c = pcVar8; - msvc::multiset::erase(&local_4c); - } - *GHIDRA_CAST(pcVar8) = this; - msvc::multiset::insert(pcVar8); - } - } - (this->_pos).x = fVar10; - (this->_pos).y = oldPosY; - (this->_velocity).x = oldVelocityX; - this->_spawnerType = iVar6; - this->_spawnerVariant = GHIDRA_INT(local_60); - (this->_velocity).y = oldVelocityY; - this->_appearTimer = 0; - local_45 = '\0'; - local_50 = GHIDRA_CAST(0x0); - if ((this->_sprite)._layerCount != 0) { - local_54 = &this->_sprite; - do { - layer = ANM2::GetLayer(local_54,local_50); - if (layer->_layerData == (void *)0x0) { - sheetPath._capacity = 0xf; - sheetPath._size = 0; - sheetPath._buf[0] = '\0'; - sheetPath._buf[1] = '\0'; - sheetPath._buf[2] = '\0'; - sheetPath._buf[3] = '\0'; - } - else { - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20)); - } - uVar5 = sheetPath._size; - ehState = 0; - local_5c = sheetPath._capacity; - if (sheetPath._size < 4) { - /* WARNING: Subroutine does not return */ - FUN_00499950(); - } - if (sheetPath._capacity - sheetPath._size < 0x12) { - if (0x7fffffff - sheetPath._size < 0x12) { - /* WARNING: Subroutine does not return */ - msvc::string::_Xlen(); - } - uVar9 = sheetPath._size + 0x12 | 0xf; - if (uVar9 < 0x80000000) { - if (0x7fffffff - (sheetPath._capacity >> 1) < sheetPath._capacity) { - uVar9 = 0x7fffffff; - } - else { - uVar2 = sheetPath._capacity + (sheetPath._capacity >> 1); - if (uVar9 < uVar2) { - uVar9 = uVar2; - } - } - } - else { - uVar9 = 0x7fffffff; - } - local_58 = msvc::_Allocate(uVar9 + 1); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))); - uVar2 = local_5c; - sheetPath._size = uVar5 + 0x12; - local_60 = GHIDRA_CAST((uVar5 - 3)); - sheetPath._capacity = uVar9; - if (local_5c < 0x10) { - *GHIDRA_CAST(local_58) = (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))); - local_58[4] = 'f'; - local_58[5] = 'a'; - local_58[6] = 'm'; - local_58[7] = 'i'; - local_58[8] = 'l'; - local_58[9] = 'i'; - local_58[10] = 'a'; - local_58[0xb] = 'r'; - local_58[0xc] = '/'; - local_58[0xd] = 'd'; - local_58[0xe] = 'e'; - local_58[0xf] = 'l'; - local_58[0x10] = 'i'; - local_58[0x11] = 'r'; - local_58[0x12] = 'i'; - local_58[0x13] = 'u'; - local_58[0x14] = 'm'; - local_58[0x15] = '/'; - memcpy(local_58 + 0x16,sheetPath._buf + 4,(size_t)local_60); - } - else { - *GHIDRA_CAST(local_58) = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(sheetPath._buf))) + 0x0))); - local_58[4] = 'f'; - local_58[5] = 'a'; - local_58[6] = 'm'; - local_58[7] = 'i'; - local_58[8] = 'l'; - local_58[9] = 'i'; - local_58[10] = 'a'; - local_58[0xb] = 'r'; - local_58[0xc] = '/'; - local_58[0xd] = 'd'; - local_58[0xe] = 'e'; - local_58[0xf] = 'l'; - local_58[0x10] = 'i'; - local_58[0x11] = 'r'; - local_58[0x12] = 'i'; - local_58[0x13] = 'u'; - local_58[0x14] = 'm'; - local_58[0x15] = '/'; - memcpy(local_58 + 0x16,(void *)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + 4),(size_t)local_60); - uVar5 = uVar2 + 1; - pvVar7 = (void *)uVar4; - if (0xfff < uVar5) { - pvVar7 = *(void **)(uVar4 + -4); - uVar5 = uVar2 + 0x24; - if (0x1f < (uVar4 - GHIDRA_INT(pvVar7)) - 4U) goto LAB_006321d1; - } - operator_delete(pvVar7,uVar5); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) = local_58; - } - else { - local_60 = &sheetPath; - if (0xf < sheetPath._capacity) { - local_60 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(sheetPath._buf))) + 0x0))); - } - pcVar1 = local_60->_buf + 4; - if (("/" < pcVar1) || (local_60->_buf + sheetPath._size < "familiar/delirium/")) { - _Size_00 = GHIDRA_CAST(0x12); - } - else if ("familiar/delirium/" < pcVar1) { - _Size_00 = local_60[-0x79802]._buf + 8; - } - else { - _Size_00 = GHIDRA_CAST(0x0); - } - _Size = sheetPath._size - 3; - sheetPath._size = sheetPath._size + 0x12; - memmove((void *)(GHIDRA_INT(&local_60->_capacity) + 2),pcVar1,_Size); - pcVar1 = local_60->_buf; - memcpy(pcVar1 + 4,"familiar/delirium/",(size_t)_Size_00); - memcpy(_Size_00 + GHIDRA_INT((pcVar1 + 4)),_Size_00 + 0xb6403e,0x12 - GHIDRA_INT(_Size_00)); - } - ModManager::TryRedirectPath - (GHIDRA_CAST(&g_manager->_modManager),GHIDRA_CAST(redirectedPath),&sheetPath); - if (&sheetPath != extraout_EAX) { - if (0xf < sheetPath._capacity) { - uVar5 = sheetPath._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)sheetPath._buf)) + 0x0))); - if (0xfff < uVar5) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + -4); - uVar5 = sheetPath._capacity + 0x24; - if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) - GHIDRA_INT(pvVar7)) - 4U) goto LAB_006321d1; - } - operator_delete(pvVar7,uVar5); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) = *GHIDRA_CAST(extraout_EAX->_buf); - (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x4))) = *GHIDRA_CAST((extraout_EAX->_buf + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x8))) = *GHIDRA_CAST((extraout_EAX->_buf + 8)); - (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0xc))) = *GHIDRA_CAST((extraout_EAX->_buf + 0xc)); - sheetPath._size = extraout_EAX->_size; - sheetPath._capacity = extraout_EAX->_capacity; - extraout_EAX->_size = 0; - extraout_EAX->_capacity = 0xf; - extraout_EAX->_buf[0] = '\0'; - } - if (0xf < local_30) { - uVar5 = local_30 + 1; - pvVar7 = redirectedPath[0]; - if (0xfff < uVar5) { - pvVar7 = *(void **)(GHIDRA_INT(redirectedPath[0]) + -4); - uVar5 = local_30 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedPath[0]) + (-4 - GHIDRA_INT(pvVar7))))) goto LAB_006321d1; - } - operator_delete(pvVar7,uVar5); - } - path = &sheetPath; - if (0xf < sheetPath._capacity) { - path = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(sheetPath._buf))) + 0x0))); - } - resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST(path)); - local_46 = resolvedPath != GHIDRA_CAST(0x0); - if (resolvedPath != GHIDRA_CAST(0x0)) { - if (g_mainHeap == (void *)0x0) { - heapCounter = &g_allocatedBytesNoHeap; - } - else { - heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar5 = *GHIDRA_CAST((resolvedPath + -4)); - qVar3 = *heapCounter; - *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar5; - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar3) < uVar5)); - free(resolvedPath + -4); - ehState = ehState & 0xffffff00; - } - resolvedPath = local_50; - unk = 0; - if (local_46 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_54))))->Sprite::ReplaceSpritesheet(GHIDRA_INT(local_50),&sheetPath); - local_45 = '\x01'; - unk = extraout_CL; - } - ehState = 0xffffffff; - if (0xf < sheetPath._capacity) { - uVar5 = sheetPath._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)sheetPath._buf)) + 0x0))); - if (0xfff < uVar5) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + -4); - uVar5 = sheetPath._capacity + 0x24; - if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) - GHIDRA_INT(pvVar7)) - 4U) { -LAB_006321d1: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar7,uVar5); - unk = extraout_CL_00; - } - this = local_64; - local_50 = resolvedPath + 1; - } while (local_50 < GHIDRA_CAST((local_64->_sprite)._layerCount)); - if (local_45 != '\0') { - ANM2::LoadGraphics(&local_64->_sprite,unk); - } - } - uVar5 = Random(); - poofEffect = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - fVar10 = g_vectorOne.y * 0.5; - iVar6 = *GHIDRA_CAST(poofEffect); - (poofEffect->_sprite)._scale.x = g_vectorOne.x * 0.5; - (poofEffect->_sprite)._scale.y = fVar10; - (**(code **)(iVar6 + 0xc))(); - iVar6 = this->_sirenHelper; - refSlot = &this->_sirenHelper; - if (iVar6 != oldSirenHelper) { - if (iVar6 != 0) { - local_64 = GHIDRA_CAST(refSlot); - msvc::multiset::erase(&local_64); - } - *refSlot = oldSirenHelper; - iVar6 = 0; - if (oldSirenHelper != 0) { - msvc::multiset::insert(refSlot); - iVar6 = *refSlot; - } - } - this->_sirenOriginalPlayer = local_68; - if (iVar6 != 0) { - refSlot = GHIDRA_CAST((iVar6 + 0x3c4)); - if (*GHIDRA_CAST((iVar6 + 0x3c4)) != 0) { - local_68 = refSlot; - msvc::multiset::erase(&local_68); - } - *refSlot = this; - msvc::multiset::insert(refSlot); - } - this->_isLilDelirium = 1; - ExceptionList = savedExceptionList; - return; -} - -// 006322f0 -void Entity_Familiar::init_lil_harbinger_sprite() -{ - uint8_t *pbVar1; - uint8_t bVar2; - uint32_t uVar3; - uint32_t uVar4; - uint8_t *pbVar5; - uint32_t extraout_ECX; - void *ptr; - uint32_t extraout_ECX_00; - char *wantedAnimName; - uint32_t layerId; - bool isLess; - std_string sheetPath; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6ebd; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(&sheetPath) + 0x28U; - ExceptionList = &local_10; - uVar3 = this->_subtype; - if (4 < uVar3) { - KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Wrong Harbinger subtype %u!\n")); - uVar3 = this->_subtype; - } - uVar3 = -GHIDRA_UINT((uVar3 != 0)) & uVar3; - uVar4 = 4; - if (uVar3 < 4) { - uVar4 = uVar3; - } - layerId = 0; - this->_subtype = uVar4; - if ((this->_sprite)._layerCount != 0) { - do { - sheetPath._size = 0; - sheetPath._capacity = 0xf; - uVar4 = -GHIDRA_UINT((this->_subtype != 0)) & this->_subtype; - (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) = (void *)0x0; - uVar3 = 4; - if (uVar4 < 4) { - uVar3 = uVar4; - } - pbVar1 = (&PTR_s_gfx_familiar_familiar_122_miniwa_00b64890)[uVar3]; - pbVar5 = pbVar1; - do { - bVar2 = *pbVar5; - pbVar5 = pbVar5 + 1; - } while (bVar2 != 0); - (GHIDRA_CAST((sheetPath._buf)))->msvc::string::assign(pbVar1,GHIDRA_INT(pbVar5) - GHIDRA_INT((pbVar1 + 1))); - local_8 = 0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(layerId,&sheetPath); - local_8 = 0xffffffff; - uVar3 = extraout_ECX; - if (0xf < sheetPath._capacity) { - uVar3 = sheetPath._capacity + 1; - ptr = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)sheetPath._buf)) + 0x0))); - if (0xfff < uVar3) { - ptr = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + -4); - uVar3 = sheetPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,uVar3); - uVar3 = extraout_ECX_00; - } - layerId = layerId + 1; - } while (layerId < GHIDRA_UINT((this->_sprite)._layerCount)); - } - ANM2::LoadGraphics(&this->_sprite,(uint8_t)uVar3); - pbVar1 = (this->_sprite)._animState._animData; - if (pbVar1 != GHIDRA_CAST(0x0)) { - pbVar5 = pbVar1; - if (0xf < *GHIDRA_CAST((pbVar1 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar1); - } - wantedAnimName = "FloatDown"; - do { - bVar2 = *pbVar5; - isLess = bVar2 < (uint8_t)*wantedAnimName; - if (bVar2 != *wantedAnimName) { -LAB_00632450: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00632455; - } - if (bVar2 == 0) break; - bVar2 = pbVar5[1]; - isLess = bVar2 < (uint8_t)wantedAnimName[1]; - if (bVar2 != wantedAnimName[1]) goto LAB_00632450; - pbVar5 = pbVar5 + 2; - wantedAnimName = wantedAnimName + 2; - } while (bVar2 != 0); - uVar3 = 0; -LAB_00632455: - if ((uVar3 == 0) && ((pbVar1[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_00632488; - } - bVar2 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("FloatDown"),1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_00632488: - uVar4 = -GHIDRA_UINT((this->_subtype != 0)) & this->_subtype; - uVar3 = 4; - if (uVar4 < 4) { - uVar3 = uVar4; - } - this->_collisionDamage = *GHIDRA_CAST((&DAT_00b64878 + uVar3 * 4)); - ExceptionList = local_10; - return; -} - -// 006324d0 -void Entity_Familiar::render_charge_indicator(Vector *renderPos) -{ - uint8_t bVar1; - int rootSpawner; - int iVar2; - long double weaponCharge; - float chargePercent; - char *anim; - Vector local_10; - void *chargeAnimData; - - if ((g_manager->_optionsConfig)._enableChargeBars == 0) { - return; - } - rootSpawner = this->_variant; - iVar2 = 0; - if (rootSpawner == 0x50) { - if (this->_weapon != GHIDRA_CAST(0x0)) { - weaponCharge = (long double)(**(code **)(*GHIDRA_CAST(this->_weapon) + 0x1c))(); - local_10.x = (float)weaponCharge; - if (0.0 < local_10.x) { - chargePercent = local_10.x * 100.0; - goto LAB_006326d0; - } - } -LAB_0063263a: - if ((this->_chargeBarSprite)._animState._animData != (void *)0x0) { - anim = "Disappear"; -LAB_00632650: - ANM2::Play(&this->_chargeBarSprite,GHIDRA_CAST(anim),0); - goto LAB_00632655; - } - } - else { - if (((rootSpawner != 0x3d) && (rootSpawner != 0x6c)) && (rootSpawner != 0xe6)) { - if (rootSpawner == 0x57) { - if (this->_state == 0) { - chargePercent = (float)this->_fireCooldown / 90.0; - goto LAB_006326b8; - } - } - else { - if (rootSpawner == 0x7d) { - rootSpawner = this->_fireCooldown; - if (rootSpawner < 0) { - chargePercent = 0.0; - } - else { - iVar2 = apply_forgotten_lullaby(this,0x1e); - chargePercent = (1.0 - (float)rootSpawner / (float)iVar2) * 100.0; - if (chargePercent <= 0.0) { - chargePercent = 0.0; - } - } - goto LAB_006326c8; - } - if (rootSpawner == 0x3e) { - chargePercent = (float)this->_fireCooldown / 30.0; - goto LAB_006326b8; - } - } - goto LAB_0063263a; - } - rootSpawner = this->_fireCooldown; - iVar2 = apply_forgotten_lullaby(this,0x1e); - local_10.x = 1.0 - (float)(rootSpawner + 1) / (float)iVar2; - rootSpawner = apply_forgotten_lullaby(this,0x1e); - if (this->_fireCooldown == rootSpawner) { - iVar2 = 0; - goto LAB_0063263a; - } - chargePercent = local_10.x; -LAB_006326b8: - chargePercent = chargePercent * 100.0; - if (chargePercent <= 0.0) { - chargePercent = 0.0; - } -LAB_006326c8: - if (100.0 <= chargePercent) { - chargePercent = 100.0; - } -LAB_006326d0: - iVar2 = GHIDRA_INT(chargePercent); - if (iVar2 == 0) goto LAB_0063263a; - if (iVar2 == 100) { - chargeAnimData = (this->_chargeBarSprite)._animState._animData; - if (chargeAnimData != (void *)0x0) { - if (*GHIDRA_CAST((GHIDRA_CAST(chargeAnimData) + 0x34)) == '\0') { - if ((this->_chargeBarSprite)._animState._isPlaying == 0) goto LAB_0063270c; - goto LAB_00632723; - } - goto LAB_00632655; - } -LAB_0063270c: - ANM2::Play(&this->_chargeBarSprite,GHIDRA_CAST("StartCharged"),0); - if ((this->_chargeBarSprite)._animState._animData != (void *)0x0) { -LAB_00632723: - if ((this->_chargeBarSprite)._animState._isPlaying != 0) goto LAB_00632655; - } - anim = "Charged"; - goto LAB_00632650; - } - bVar1 = ANM2::SetAnimation(&this->_chargeBarSprite,GHIDRA_CAST("Charging"),1); - if (((bVar1 != 0) && ((this->_chargeBarSprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_chargeBarSprite)._animState,(float)iVar2), - (this->_chargeBarSprite)._animState._animData != (void *)0x0)) { - (this->_chargeBarSprite)._animState._isPlaying = 0; - } -LAB_00632655: - if (((this->_chargeBarSprite)._animState._animData != (void *)0x0) && - ((this->_chargeBarSprite)._animState._isPlaying != 0)) goto LAB_00632689; - } - if (iVar2 < 1) { - return; - } - if (g_game->_frameCount - this->_spawnFrame < 7) { - return; - } -LAB_00632689: - rootSpawner = this->_spawnerEntity; - if (rootSpawner != 0) { - for (; *GHIDRA_CAST((rootSpawner + 0x3c8)) != 0; rootSpawner = *GHIDRA_CAST((rootSpawner + 0x3c8))) { - } - } - rootSpawner = __RTDynamicCast(rootSpawner,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0); - if (((rootSpawner == 0) || (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1)))) || - (bVar1 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST((rootSpawner + 0x1618))), bVar1 != 0)) { - local_10.x = renderPos->x + 12.0; - local_10.y = renderPos->y - 35.0; - ANM2::Render(&this->_chargeBarSprite,&local_10,&g_vectorZero,&g_vectorZero); - } - return; -} - -// 00632820 -void Entity_Familiar::ai_lil_monstro() -{ - code *pcVar1; - Entity_Player *tear; - uint64_t qVar2; - uint8_t bVar3; - int iVar4; - uint8_t *curAnimName; - Entity *spawned; - Entity_Tear *tear; - TearParams *pTVar5; - char *attackAnimName; - uint8_t *flyAnimName; - uint64_t *allocCounter; - uint32_t uVar6; - bool isLess; - float dirLength; - float fVar7; - float dirX; - uint32_t uVar8; - TypeDescriptor *pTVar9; - TypeDescriptor *pTVar10; - uint32_t uVar11; - EntityList_EL nearbyEnemies; - Entity_Familiar *self; - Vector local_90; - Vector local_88; - float local_80; - TearParams tearHitParams; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - float local_8; - uint8_t *animData; - void *curAnimData; - uint32_t *targetRef; - - local_8 = -NAN; - puStack_c = &LAB_00af6f00; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT(((&tearHitParams)[1]._tearColor._colorize + 3)); - ExceptionList = &local_10; - self = this; - iVar4 = apply_forgotten_lullaby(this,0x1e); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(iVar4,0); - if (bVar3 != 0) { - local_90.y = 0.0; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&nearbyEnemies,&this->_pos,150.0,8); - uVar6 = 0; - local_8 = 0.0; - if (nearbyEnemies._size != 0) { - do { - spawned = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + uVar6 * 4)); - bVar3 = (GHIDRA_CAST((spawned)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (((bVar3 != 0) && (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(spawned), bVar3 == 0)) - && ((spawned->_flags & 0x20000010) == 0)) { - local_88.y = (spawned->_pos).y; - local_88.x = (spawned->_pos).x; - bVar3 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&this->_pos,&local_88,3,0,0,0,GHIDRA_CAST(0x0)); - if (bVar3 != 0) { - local_90.y = (float)spawned; - } - } - uVar6 = uVar6 + 1; - } while (uVar6 < GHIDRA_UINT(nearbyEnemies._size)); - if (GHIDRA_CAST(local_90.y) != GHIDRA_CAST(0x0)) { - local_88.y = (GHIDRA_CAST((GHIDRA_INT(local_90.y) + 0x33c)))->x - (this->_pos).x; - local_80 = (GHIDRA_CAST((GHIDRA_INT(local_90.y) + 0x33c)))->y - (this->_pos).y; - this->_headFrameDelay = 0xc; - animData = (this->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_006329dd: - bVar3 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Attack"),1); - if (bVar3 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - attackAnimName = "Attack"; - do { - bVar3 = *curAnimName; - isLess = bVar3 < (uint8_t)*attackAnimName; - if (bVar3 != *attackAnimName) { -LAB_006329c7: - uVar6 = -GHIDRA_UINT(isLess) | 1; - goto LAB_006329cc; - } - if (bVar3 == 0) break; - bVar3 = curAnimName[1]; - isLess = bVar3 < (uint8_t)attackAnimName[1]; - if (bVar3 != attackAnimName[1]) goto LAB_006329c7; - curAnimName = curAnimName + 2; - attackAnimName = attackAnimName + 2; - } while (bVar3 != 0); - uVar6 = 0; -LAB_006329cc: - if ((uVar6 != 0) || - ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_006329dd; - } - (this->_sprite)._flipX = local_88.y < 0.0; - dirLength = sqrtf(local_80 * local_80 + local_88.y * local_88.y); - fVar7 = local_80; - dirX = local_88.y; - if (0.0 < dirLength) { - fVar7 = local_80 * (1.0 / dirLength); - dirX = local_88.y * (1.0 / dirLength); - } - targetRef = &this->_target; - (this->_targetPosition).x = dirX * 8.0; - (this->_targetPosition).y = fVar7 * 8.0; - if (*targetRef != 0) { - local_88.y = (float)targetRef; - msvc::multiset::erase(&local_88.y); - } - *targetRef = local_90.y; - msvc::multiset::insert(targetRef); - } - } - local_8 = -NAN; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) != 0) { - uVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + -4)); - qVar2 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar6; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar6)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + -4)); - } - local_8 = -NAN; - } - } - if (this->_headFrameDelay < 1) { - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - flyAnimName = s_Fly; - do { - bVar3 = *curAnimName; - isLess = bVar3 < *flyAnimName; - if (bVar3 != *flyAnimName) { -LAB_00632b48: - uVar6 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00632b4d; - } - if (bVar3 == 0) break; - bVar3 = curAnimName[1]; - isLess = bVar3 < flyAnimName[1]; - if (bVar3 != flyAnimName[1]) goto LAB_00632b48; - curAnimName = curAnimName + 2; - flyAnimName = flyAnimName + 2; - } while (bVar3 != 0); - uVar6 = 0; -LAB_00632b4d: - if ((uVar6 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_00632b80; - } - bVar3 = ANM2::SetAnimation(&this->_sprite,s_Fly,1); - if (bVar3 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - } - else { - this->_headFrameDelay = this->_headFrameDelay + -1; - } -LAB_00632b80: - if (((this->_sprite)._animState._animData != (void *)0x0) && - (bVar3 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("Shoot")), - bVar3 != 0)) { - local_90.x = (this->_targetPosition).x; - iVar4 = this->_target; - local_90.y = (this->_targetPosition).y; - if (iVar4 != 0) { - local_88.y = *GHIDRA_CAST((iVar4 + 0x33c)) - (this->_pos).x; - local_80 = *GHIDRA_CAST((iVar4 + 0x340)) - (this->_pos).y; - dirLength = sqrtf(local_88.y * local_88.y + local_80 * local_80); - targetRef = GHIDRA_CAST(local_88.y); - fVar7 = local_80; - if (0.0 < dirLength) { - targetRef = GHIDRA_CAST((local_88.y * (1.0 / dirLength))); - fVar7 = local_80 * (1.0 / dirLength); - } - local_90.x = (float)targetRef * 10.0; - local_90.y = fVar7 * 10.0; - } - uVar6 = Random(); - uVar11 = 0; - pTVar10 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; - pTVar9 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar8 = 0; - spawned = Game::Spawn(g_game,2,0,&this->_pos,&local_90,GHIDRA_CAST(this),0,uVar6); - tear = GHIDRA_CAST(__RTDynamicCast(spawned,uVar8,pTVar9,pTVar10,uVar11)); - tear->_fallingSpeed = 1.2; - local_88.y = apply_tear_modifiers(this); - fVar7 = apply_tear_modifiers(this); - local_80 = fVar7 * 0.2 + 0.7; - pcVar1 = *(code **)(*GHIDRA_CAST(tear) + 0x40); - tear = self->_player; - uVar6 = Random(); - pTVar5 = Entity_Player::GetTearHitParams - (tear,&tearHitParams,1,1.0,(uVar6 & 1) * 2 + -1,GHIDRA_CAST(0x0)); - (*pcVar1)(local_88.y * pTVar5->_tearDamage); - fVar7 = local_80; - if (local_80 <= 0.01) { - fVar7 = 0.01; - } - tear->_baseScale = fVar7; - tear->_fScale = fVar7; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - this = self; - TryFireTear(self,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - } - curAnimData = (this->_sprite)._animState._animData; - if ((curAnimData != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(curAnimData) + 0x34)) != '\0')) { - (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; - } - ExceptionList = local_10; - return; -} - -// 00632d90 -void Entity_Familiar::ai_variant_111() -{ - int iVar1; - Entity_Familiar *pEVar2; - uint8_t isBreakableRock; - RoomDescriptor *doorTargetRoom; - uint32_t rngResult; - int iVar3; - Vector *randomPos; - float *pfVar4; - int extraout_ECX; - int extraout_EDX; - void *freePtr; - float *pfVar5; - Game *game; - float *candidatesEnd; - uint32_t rngResult; - float fVar7; - float fVar8; - float *local_2c; - Vector scratchVec; - Entity_Familiar *local_1c; - void *local_18; - float *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Manager *manager; - GridEntity *rockGrid; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af5d8d; - local_10 = ExceptionList; - ExceptionList = &local_10; - if ((((this->_targetPosition).x != g_vectorZero.x) || - ((this->_targetPosition).y != g_vectorZero.y)) || (1 < this->_state)) goto LAB_00633192; - candidatesEnd = GHIDRA_CAST(0x0); - local_2c = GHIDRA_CAST(0x0); - local_8 = 0; - local_18 = (void *)0x0; - pfVar4 = GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x724)); - game = g_game; - local_1c = this; - local_14 = pfVar4; - do { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pfVar4) + GHIDRA_INT(local_18) * 4)); - if (iVar3 != 0) { - if (*GHIDRA_CAST((iVar3 + 0xc)) != 2) { - if (*GHIDRA_CAST((iVar3 + 0x160)) == 7) { -LAB_00632e6b: - doorTargetRoom = Level::GetRoomByIdx(GHIDRA_CAST(game),*GHIDRA_CAST((iVar3 + 0x394)),-1); - game = g_game; - pfVar4 = local_14; - if (doorTargetRoom->VisitedCount != 0) goto LAB_00632f15; - iVar3 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_14) + GHIDRA_INT(local_18) * 4)) + 0x24)); - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - scratchVec.x = (float)(iVar3 % iVar1) * 40.0 + 40.0; - scratchVec.y = (float)(iVar3 / iVar1) * 40.0 + 120.0; - if (candidatesEnd == GHIDRA_CAST(0x0)) { - msvc::vector::_Emplace_reallocate(0,&scratchVec); - game = g_game; - candidatesEnd = local_2c; - } - else { - *candidatesEnd = scratchVec.x; - candidatesEnd[1] = scratchVec.y; - local_2c = candidatesEnd + 2; - candidatesEnd = local_2c; - } - } - else if (*GHIDRA_CAST((iVar3 + 0x160)) == 8) goto LAB_00632e6b; - pfVar4 = local_14; - } - } -LAB_00632f15: - this = local_1c; - pfVar5 = GHIDRA_CAST(0x0); - fVar7 = 40.0; - fVar8 = 120.0; - local_18 = (void *)(GHIDRA_INT(local_18) + 1); - } while (local_18 < 8); - local_14 = pfVar5; - if (((((game->_levelStateFlags & 0x2000U) == 0) && - (iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x768)), -1 < iVar3)) && - ((iVar3 < 0x1c0 && - ((rockGrid = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + iVar3 * 4 + 0x24)), - rockGrid != GHIDRA_CAST(0x0) && - (isBreakableRock = (GHIDRA_CAST((rockGrid)))->GridEntity::IsBreakableRock(), isBreakableRock != 0)))))) && - (*GHIDRA_CAST((extraout_ECX + 0xc)) != 2)) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - scratchVec.x = (float)(extraout_EDX % iVar3) * fVar7 + fVar7; - scratchVec.y = (float)(extraout_EDX / iVar3) * fVar7 + fVar8; - if (candidatesEnd == local_14) { - msvc::vector::_Emplace_reallocate(candidatesEnd,&scratchVec); - local_14 = GHIDRA_CAST(0x0); - game = g_game; - candidatesEnd = local_2c; - } - else { - *candidatesEnd = scratchVec.x; - candidatesEnd[1] = scratchVec.y; - local_2c = candidatesEnd + 2; - candidatesEnd = local_2c; - } - } - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x764)); - if (-1 < iVar3) { - if (iVar3 < 0x1c0) { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + iVar3 * 4 + 0x24)); - if (iVar1 != 0) { - if (*GHIDRA_CAST((iVar1 + 4)) != 4) { - if (*GHIDRA_CAST((iVar1 + 4)) != 0x16) goto LAB_0063308e; - } - if (*GHIDRA_CAST((iVar1 + 0xc)) != 2) { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - scratchVec.x = (float)(iVar3 % iVar1) * 40.0 + 40.0; - scratchVec.y = (float)(iVar3 / iVar1) * 40.0 + 120.0; - this = local_1c; - if (candidatesEnd == local_14) { - msvc::vector::_Emplace_reallocate(candidatesEnd,&scratchVec); - local_14 = GHIDRA_CAST(0x0); - game = g_game; - candidatesEnd = local_2c; - } - else { - *candidatesEnd = scratchVec.x; - candidatesEnd[1] = scratchVec.y; - candidatesEnd = candidatesEnd + 2; - } - } - } - } - } -LAB_0063308e: - manager = g_manager; - rngResult = GHIDRA_INT(candidatesEnd) >> 3; - local_18 = (void *)0x0; - if (rngResult == 0) { - this->_state = 2; - randomPos = (GHIDRA_CAST((game->_room)))->Room::GetRandomPosition(&scratchVec,0.0); - (this->_targetPosition).x = randomPos->x; - (this->_targetPosition).y = randomPos->y; - } - else { - local_1c = GHIDRA_CAST(0x392); - seed_fart_sound_override(GHIDRA_CAST(&local_1c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c),1.0,2,0,1.0,0.0); - rngResult = Random(); - pfVar4 = GHIDRA_CAST((GHIDRA_INT(local_18) + (rngResult % rngResult) * 8)); - (this->_targetPosition).x = *pfVar4; - (this->_targetPosition).y = pfVar4[1]; - this->_state = GHIDRA_UINT((rngResult == 1)); - } - this->_fireCooldown = 0x96; - local_8 = 0xffffffff; - if (local_18 != (void *)0x0) { - rngResult = GHIDRA_INT(local_14) - GHIDRA_INT(local_18) & 0xfffffff8; - freePtr = local_18; - if (0xfff < rngResult) { - freePtr = *(void **)(GHIDRA_CAST(local_18) + -4); - rngResult = rngResult + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_18) + (-4 - GHIDRA_INT(freePtr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freePtr,rngResult); - } -LAB_00633192: - if (this->_state == 2) { - local_18 = (void *)(this->_velocity).x; - fVar7 = (this->_velocity).y; - local_14 = GHIDRA_CAST(((this->_targetPosition).x - (this->_pos).x)); - if (1.0 <= (float)local_18 * (float)local_18 + fVar7 * fVar7) { - local_1c = GHIDRA_CAST(((this->_targetPosition).y - (this->_pos).y)); - rngResult = Random(); - local_18 = (void *)((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)] - ) * 2.3283064e-10 * 0.2 + 0.1); - scratchVec.y = atan2f((float)local_1c,(float)local_14); - scratchVec.y = scratchVec.y * 57.295776; - fVar7 = atan2f((this->_velocity).y,(this->_velocity).x); - fVar7 = LerpAngleDeg(fVar7 * 57.295776,scratchVec.y,(float)local_18); - local_18 = (void *)(fVar7 * 0.017453292); - scratchVec.y = 0.5; - local_1c = (Entity_Familiar *) - sqrtf((float)local_1c * (float)local_1c + (float)local_14 * (float)local_14); - pfVar4 = &scratchVec.y; - if ((float)local_1c <= 0.5) { - pfVar4 = GHIDRA_CAST(&local_1c); - } - fVar7 = cos((float)local_18); - (this->_velocity).x = fVar7 * (float)*pfVar4 + (this->_velocity).x; - fVar7 = sin((float)local_18); - (this->_velocity).y = fVar7 * (float)*pfVar4 + (this->_velocity).y; - } - else { - local_1c = GHIDRA_CAST(((this->_targetPosition).y - (this->_pos).y)); - fVar7 = sqrtf((float)local_14 * (float)local_14 + (float)local_1c * (float)local_1c); - if (fVar7 <= 0.0) { - pEVar2 = local_1c; - pfVar4 = local_14; - } - else { - pEVar2 = GHIDRA_CAST(((0.5 / fVar7) * (float)local_1c)); - pfVar4 = GHIDRA_CAST(((float)local_14 * (0.5 / fVar7))); - } - (this->_velocity).y = (float)pEVar2 + (this->_velocity).y; - (this->_velocity).x = (float)local_18 + (float)pfVar4; - } - this->_friction = this->_friction * 0.8; - if ((0 < this->_fireCooldown) && - (iVar3 = this->_fireCooldown + -1, this->_fireCooldown = iVar3, iVar3 == 0)) { - randomPos = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&scratchVec,0.0); - (this->_targetPosition).x = randomPos->x; - (this->_targetPosition).y = randomPos->y; - rngResult = Random(); - this->_fireCooldown = (rngResult % 3 + 1) * 0x1e; - ExceptionList = local_10; - return; - } - } - else { - local_1c = GHIDRA_CAST(((this->_targetPosition).x - (this->_pos).x)); - local_18 = (void *)((this->_targetPosition).y - (this->_pos).y); - fVar7 = (float)local_18 * (float)local_18 + (float)local_1c * (float)local_1c; - if ((1.0 < fVar7) && (fVar7 = sqrtf(fVar7), 0.0 < fVar7)) { - local_18 = (void *)((float)local_18 * (1.0 / fVar7)); - local_1c = GHIDRA_CAST(((1.0 / fVar7) * (float)local_1c)); - } - (this->_velocity).x = (float)local_1c + (this->_velocity).x; - fVar7 = this->_friction; - (this->_velocity).y = (float)local_18 + (this->_velocity).y; - this->_friction = fVar7 * 0.8; - if ((0 < this->_fireCooldown) && - (iVar3 = this->_fireCooldown + -1, this->_fireCooldown = iVar3, iVar3 == 0)) { - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - } - } - ExceptionList = local_10; - return; -} - -// 00633500 -void Entity_Familiar::update_angry_fly() -{ - uint64_t qVar1; - uint8_t bVar2; - char cVar3; - Entity *this_00; - uint32_t rngResult; - uint32_t *puVar4; - int iVar5; - uint64_t *allocCounter; - int *targetSlot; - uint32_t uVar6; - void *ptr; - bool isExcluded; - float fVar7; - uint8_t entityList [4]; - void *pvStack_30; - uint32_t *puStack_2c; - uint32_t *puStack_28; - int *local_24; - Entity_Familiar *local_20; - void *newTarget; - void *room; - uint32_t *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - void *candidatesData; - int entityType; - Entity_Familiar *otherFly; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6f45; - local_10 = ExceptionList; - ExceptionList = &local_10; - this_00 = GHIDRA_CAST(this->_target); - targetSlot = &this->_target; - local_24 = targetSlot; - local_20 = this; - if (this_00 != GHIDRA_CAST(0x0)) { - if (this_00 == this->_player) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x1e,this->_index); - if (bVar2 != 0) goto LAB_0063357f; - this_00 = GHIDRA_CAST(*targetSlot); - } - bVar2 = (GHIDRA_CAST((this_00)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar2 != 0) || (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x96,this->_index), bVar2 == 0)) - goto LAB_00633702; - } -LAB_0063357f: - newTarget = this->_player; - pvStack_30 = (void *)0x0; - puStack_2c = GHIDRA_CAST(0x0); - puStack_28 = GHIDRA_CAST(0x0); - room = g_game->_room; - local_8 = 0; - msvc::vector::_Reallocate(0x20); - uVar6 = 0; - puVar4 = puStack_2c; - if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { - do { - iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); - local_14 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST((iVar5 + 0x28)) != 1)) { - entityType = *GHIDRA_CAST((iVar5 + 0x28)); - if ((entityType - 10U < 0x3de) && - (((entityType != 0x21 && (entityType != 0x11)) && (entityType != 0x124)))) { - if (entityType == 0x375) { - isExcluded = *GHIDRA_CAST((iVar5 + 0x2c)) == 10; - } - else { - if ((entityType == 0x3c0) || (entityType == 0x3c5)) goto LAB_00633662; - isExcluded = entityType == 0xf5; - } - if (!isExcluded) goto LAB_0063363b; - } - } - else { -LAB_0063363b: - if (*GHIDRA_CAST((iVar5 + 0x173)) == '\0') { - if (puVar4 == puStack_28) { - msvc::vector::_Emplace_reallocate(puVar4,local_14); - puVar4 = puStack_2c; - } - else { - *puVar4 = *local_14; - puStack_2c = puVar4 + 1; - puVar4 = puStack_2c; - } - } - } -LAB_00633662: - uVar6 = uVar6 + 1; - } while (uVar6 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); - } - candidatesData = pvStack_30; - uVar6 = GHIDRA_INT(puVar4) - GHIDRA_INT(pvStack_30) >> 2; - if (uVar6 != 0) { - rngResult = Random(); - newTarget = *(void **)(GHIDRA_CAST(candidatesData) + (rngResult % uVar6) * 4); - } - targetSlot = local_24; - if (*local_24 != 0) { - msvc::multiset::erase(&local_24); - } - *targetSlot = GHIDRA_INT(newTarget); - if (newTarget != (void *)0x0) { - msvc::multiset::insert(targetSlot); - } - local_8 = 0xffffffff; - if (candidatesData != (void *)0x0) { - uVar6 = (GHIDRA_INT(puStack_28) - GHIDRA_INT(candidatesData) >> 2) * 4; - ptr = candidatesData; - if (0xfff < uVar6) { - ptr = *(void **)(GHIDRA_CAST(candidatesData) + -4); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatesData) + (-4 - GHIDRA_INT(ptr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,uVar6); - } - this = local_20; -LAB_00633702: - if (*targetSlot == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Angry Fly - Got a null target!\n")); - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(entityList),this->_type, - this->_variant,-1,1,0); - local_8 = 1; - puVar4 = GHIDRA_CAST(0x0); - local_14 = GHIDRA_CAST(0x0); - iVar5 = 1; - if (puStack_28 != GHIDRA_CAST(0x0)) { - do { - otherFly = *GHIDRA_CAST((GHIDRA_CAST(pvStack_30) + GHIDRA_INT(puVar4) * 4)); - if (otherFly == this) { - local_14 = puVar4; - } - else if (otherFly->_target == *targetSlot) { - iVar5 = iVar5 + 1; - } - puVar4 = GHIDRA_CAST((GHIDRA_INT(puVar4) + 1)); - } while (puVar4 < puStack_28); - } - fVar7 = ((float)GHIDRA_INT(local_14) * 360.0) / (float)iVar5; - if (360.0 < ABS(fVar7)) { - fVar7 = fmodf(fVar7,360.0); - } - if (fVar7 <= 180.0) { - if (fVar7 < -180.0) { - fVar7 = fVar7 + 360.0; - } - } - else { - fVar7 = fVar7 - 360.0; - } - local_20 = GHIDRA_CAST(0x42820000); - local_14 = GHIDRA_CAST(fVar7); - cVar3 = (**(code **)(*GHIDRA_CAST(*targetSlot) + 0x4c))(); - if ((cVar3 != '\0') && (iVar5 = g_game->_frameCount % 0x96, iVar5 < 0x1e)) { - fVar7 = ABS((float)iVar5 / 30.0 - 0.5); - local_20 = GHIDRA_CAST(((fVar7 + fVar7) * 65.0)); - } - iVar5 = *targetSlot; - local_24 = GHIDRA_CAST((((float)g_game->_frameCount * 3.6 + (float)local_14) * 0.017453292)); - local_14 = GHIDRA_CAST(sin((float)local_24)); - fVar7 = cos((float)local_24); - local_14 = (uint32_t *) - ((((float)local_14 * (float)local_20 + *GHIDRA_CAST((iVar5 + 0x340))) - (this->_pos).y) * - 0.22); - local_24 = GHIDRA_CAST((((fVar7 * (float)local_20 + *GHIDRA_CAST((iVar5 + 0x33c))) - (this->_pos).x) * 0.22 - )); - (this->_velocity).y = (float)local_14; - (this->_velocity).x = (float)local_24; - fVar7 = (float)local_14 * (float)local_14 + (float)local_24 * (float)local_24; - if ((100.0 < fVar7) && (fVar7 = sqrtf(fVar7), 0.0 < fVar7)) { - (this->_velocity).x = (float)local_24 * (10.0 / fVar7); - (this->_velocity).y = (float)local_14 * (10.0 / fVar7); - } - if (entityList[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (pvStack_30 != (void *)0x0) { - uVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvStack_30) + -4)); - qVar1 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar6; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar6)); - free(GHIDRA_CAST((GHIDRA_INT(pvStack_30) + -4))); - } - } - ExceptionList = local_10; - return; -} - -// 00634000 -uint8_t Entity_Familiar::TryFireTear(Entity_Tear *tear) -{ - BitSet128 flags; - int lullabyMultiplier; - int iVar1; - bool bVar2; - bool bVar3; - float fVar4; - bool isFiring; - float tearHeight; - float fallingSpeed; - float tearRange; - BitSet128 tearFlags; - ColorMod tearColor; - Game *game; - Entity_Player *player; - - player = this->_player; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) != 0x7f)) { - iVar1 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x7f); - bVar3 = false; - bVar2 = iVar1 == 0; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef0))) != '\0') { - isFiring = true; - goto LAB_00634064; - } - lullabyMultiplier = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x7f); - bVar3 = SBORROW4(lullabyMultiplier,1); - iVar1 = lullabyMultiplier + -1; - bVar2 = lullabyMultiplier == 1; - } - bVar3 = bVar3 == iVar1 < 0; - isFiring = !bVar2 && bVar3; - if (bVar2 || !bVar3) { - return isFiring; - } -LAB_00634064: - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = (uint32_t)(tear->_tearFlags)._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = (uint32_t)(tear->_tearFlags)._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)); - tearColor._offset[2] = (tear->_sprite)._color._offset[2]; - tearColor._tint[0] = (tear->_sprite)._color._tint[0]; - tearColor._tint[1] = (tear->_sprite)._color._tint[1]; - tearColor._tint[2] = (tear->_sprite)._color._tint[2]; - tearColor._tint[3] = (tear->_sprite)._color._tint[3]; - tearColor._colorize[0] = (tear->_sprite)._color._colorize[0]; - tearColor._colorize[1] = (tear->_sprite)._color._colorize[1]; - tearColor._colorize[2] = (tear->_sprite)._color._colorize[2]; - tearColor._colorize[3] = (tear->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearColor._offset)) + 0x0))) = *GHIDRA_CAST((tear->_sprite)._color._offset); - tearHeight = tear->_height; - fallingSpeed = tear->_fallingSpeed; - tearRange = tear->_tearRange; - apply_baby_bender_tear_params(this,&tearFlags,&tearColor,&tearHeight,&fallingSpeed,&tearRange,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (uint32_t)tearFlags._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (uint32_t)tearFlags._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); - tear->SetColor(&tearColor,0xffffffff,0xff,0,1); - tear->_height = tearHeight; - fVar4 = (GHIDRA_CAST((tear)))->Entity_Tear::get_height_offset_y(tearHeight); - game = g_game; - (tear->_posOffset).y = fVar4; - if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && ((tear->_posOffset).y = -18.0, -5.1 < tearHeight)) - { - tear->_height = -5.1; - } - tear->_fallingSpeed = fallingSpeed; - tear->_tearRange = tearRange; - return isFiring; -} - -// 006341a0 -uint8_t Entity_Familiar::apply_baby_bender(Entity_Tear *tear) -{ - uint8_t isHasBabyBender; - BitSet128 tearFlags; - uint8_t unusedHeight [4]; - uint8_t unusedFallingSpeed [4]; - uint8_t unusedRange [4]; - ColorMod tearColor; - int tearVtable; - - isHasBabyBender = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x7f,0); - if (isHasBabyBender != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = (uint32_t)(tear->_tearFlags)._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = (uint32_t)(tear->_tearFlags)._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)); - tearColor._offset[2] = (tear->_sprite)._color._offset[2]; - tearColor._tint[0] = (tear->_sprite)._color._tint[0]; - tearColor._tint[1] = (tear->_sprite)._color._tint[1]; - tearColor._tint[2] = (tear->_sprite)._color._tint[2]; - tearColor._tint[3] = (tear->_sprite)._color._tint[3]; - tearColor._colorize[0] = (tear->_sprite)._color._colorize[0]; - tearColor._colorize[1] = (tear->_sprite)._color._colorize[1]; - tearColor._colorize[2] = (tear->_sprite)._color._colorize[2]; - tearColor._colorize[3] = (tear->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearColor._offset)) + 0x0))) = *GHIDRA_CAST((tear->_sprite)._color._offset); - apply_baby_bender_tear_params - (this,&tearFlags,&tearColor,unusedHeight,unusedFallingSpeed,unusedRange,1); - tearVtable = *GHIDRA_CAST(tear); - *GHIDRA_CAST(&(tear->_tearFlags)._l) = (uint32_t)tearFlags._l; - *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))); - *GHIDRA_CAST(&(tear->_tearFlags)._h) = (uint32_t)tearFlags._h; - *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))); - (**(code **)(tearVtable + 0x3c))(&tearColor,0xffffffff,0xff,0,1); - } - return isHasBabyBender; -} - -// 00634260 -Vector * Entity_Familiar::UpdateFollowPosition(Vector *outOffset) -{ - float fVar1; - void *pvVar2; - uint64_t qVar3; - char cVar4; - uint32_t uVar5; - uint32_t *puVar6; - int iVar7; - Entity_Familiar *otherFamiliar; - uint64_t *allocCounter; - uint32_t listIndex; - float fVar8; - uint8_t *sideSign; - float fVar9; - uint32_t *puVar10; - float fVar11; - EntityList_EL familiars; - int priority [2]; - uint32_t *prioritySetHead; - int prioritySetSize; - uint32_t *local_28; - float local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - int local_14; - uint8_t formationMode; - int listEntity; - - puStack_20 = GHIDRA_CAST((priority + 0xd)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00af6f85; - local_1c = ExceptionList; - uVar5 = __security_cookie ^ GHIDRA_UINT((priority + 10)); - ExceptionList = &local_1c; - cVar4 = FUN_00634920(uVar5); - if (cVar4 == '\0') { - pvVar2 = this->_player; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1ef0)) != GHIDRA_UINT(this->_formationMode)) { - (this->_formationTargetOffset).x = g_vectorZero.x; - (this->_formationTargetOffset).y = g_vectorZero.y; - } - if (((this->_formationTargetOffset).x == g_vectorZero.x) && - ((this->_formationTargetOffset).y == g_vectorZero.y)) { - this->_formationMode = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1ef0)); - prioritySetHead = GHIDRA_CAST(0x0); - prioritySetSize = 0; - puVar6 = operator_new(0x18); - *puVar6 = puVar6; - puVar6[1] = puVar6; - puVar6[2] = puVar6; - *GHIDRA_CAST((puVar6 + 3)) = 0x101; - local_14 = 0; - local_24 = 0.0; - prioritySetHead = puVar6; - if (this->_formationMode != 0) { - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,0,0) - ; - listIndex = 0; - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - if (familiars._size != 0) { - iVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))); - do { - listEntity = *GHIDRA_CAST((iVar7 + listIndex * 4)); - if ((*GHIDRA_CAST((listEntity + 0x173)) == '\0') && (*GHIDRA_CAST((listEntity + 0x172)) != '\0')) - { - cVar4 = FUN_00634920(uVar5); - if ((cVar4 == '\0') && (otherFamiliar->_player == this->_player)) { - priority[0] = GetFollowerPriority(otherFamiliar); - FUN_00652690(&local_28,priority); - } - iVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))); - } - listIndex = listIndex + 1; - } while (listIndex < GHIDRA_UINT(familiars._size)); - } - puVar6 = prioritySetHead; - local_28 = GHIDRA_CAST(*prioritySetHead); - while ((local_28 != puVar6 && (GHIDRA_CAST(local_28[5]) != this))) { - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_28); - local_24 = (float)(GHIDRA_INT(local_24) + 1); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) != 0) { - uVar5 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - qVar3 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar5; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar3) < uVar5)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4))); - puVar6 = prioritySetHead; - } - } - } - formationMode = this->_formationMode; - if (formationMode == 1) { - if ((GHIDRA_UINT(local_24) & 1) == 0) { - sideSign = GHIDRA_CAST(0x3f800000); - } - else { - sideSign = &DAT_bf800000; - } - (this->_formationTargetOffset).y = 0.0; - (this->_formationTargetOffset).x = (float)(GHIDRA_INT(local_24) / 2 + 1) * 32.0 * (float)sideSign; - } - else if (formationMode == 2) { - (this->_formationTargetOffset).x = 0.0; - (this->_formationTargetOffset).y = (float)&DAT_42000000; - fVar8 = local_24; - if (prioritySetSize != 2) { - fVar8 = (float)(GHIDRA_INT(local_24) - 1); - } - if (-1 < GHIDRA_INT(fVar8)) { - if ((GHIDRA_UINT(fVar8) & 1) == 0) { - sideSign = &DAT_bf800000; - } - else { - sideSign = GHIDRA_CAST(0x3f800000); - } - fVar8 = (float)(GHIDRA_INT(fVar8) / 2 + 1) * 24.0 * (float)sideSign + 0.0; - (this->_formationTargetOffset).x = fVar8; - (this->_formationTargetOffset).y = (this->_formationTargetOffset).y - ABS(fVar8); - } - } - else if (formationMode == 3) { - local_28 = (uint32_t *) - ((360.0 / (float)((double)prioritySetSize + - __uint_to_double_fixup[-(prioritySetSize >> 0x1f)])) * - (float)GHIDRA_INT(local_24) * 0.017453292); - local_24 = cos((float)local_28); - fVar8 = sin((float)local_28); - (this->_formationTargetOffset).x = local_24 * 0.0 - fVar8 * 54.0; - (this->_formationTargetOffset).y = fVar8 * 0.0 + local_24 * 54.0; - } - else { - fVar11 = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - fVar8 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_formationTargetOffset).x = fVar11; - (this->_formationTargetOffset).y = fVar8; - (this->_formationOffset).x = fVar11; - (this->_formationOffset).y = fVar8; - } - FID_conflict__Erase_tree_>_> - (&prioritySetHead, - (fuzzer_allocator_> *)&prioritySetHead, - (_Tree_node *)puVar6[1]); - operator_delete(prioritySetHead,0x18); - } - fVar8 = (this->_formationOffset).x; - fVar11 = (this->_formationTargetOffset).x; - if ((fVar8 != fVar11) || ((this->_formationOffset).y != (this->_formationTargetOffset).y)) { - fVar9 = (this->_formationOffset).y; - fVar1 = (this->_formationTargetOffset).y; - (this->_formationOffset).x = (fVar11 - fVar8) * 0.1 + fVar8; - (this->_formationOffset).y = (fVar1 - fVar9) * 0.1 + fVar9; - } - fVar9 = 0.0; - local_24 = 0.0; - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1630)); - fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1634)); - if (this->_formationMode != 0) { - if (0.1 < fVar8 * fVar8 + fVar11 * fVar11) { - fVar8 = atan2f(fVar11,fVar8); - fVar9 = fVar8 * 57.295776 - 90.0; - } - local_24 = fVar9; - } - puVar6 = GHIDRA_CAST(this->_formationAngle); - puVar10 = puVar6; - if ((float)puVar6 < 0.0) { - puVar10 = GHIDRA_CAST((GHIDRA_UINT(puVar6) ^ 0x80000000)); - } - if (360.0 < (float)puVar10) { - puVar6 = GHIDRA_CAST(fmodf((float)puVar6,360.0)); - } - if ((float)puVar6 <= 180.0) { - if ((float)puVar6 < -180.0) { - puVar6 = GHIDRA_CAST(((float)puVar6 + 360.0)); - } - } - else { - puVar6 = GHIDRA_CAST(((float)puVar6 - 360.0)); - } - fVar8 = local_24; - if (local_24 < 0.0) { - fVar8 = -local_24; - } - fVar11 = local_24; - local_28 = puVar6; - if (360.0 < fVar8) { - fVar11 = fmodf(local_24,360.0); - } - if (fVar11 <= 180.0) { - if (fVar11 < -180.0) { - fVar11 = fVar11 + 360.0; - } - } - else { - fVar11 = fVar11 - 360.0; - } - fVar8 = fVar11 - (float)local_28; - if (fVar8 < 0.0) { - fVar8 = -fVar8; - } - puVar6 = local_28; - if (180.0 < fVar8) { - if (fVar11 <= (float)local_28) { - fVar11 = fVar11 + 360.0; - } - else { - puVar6 = GHIDRA_CAST(((float)local_28 + 360.0)); - } - } - fVar11 = (fVar11 - (float)puVar6) * 0.1 + (float)puVar6; - fVar8 = fVar11; - if (fVar11 < 0.0) { - fVar8 = -fVar11; - } - if (360.0 < fVar8) { - fVar11 = fmodf(fVar11,360.0); - } - if (fVar11 <= 180.0) { - if (fVar11 < -180.0) { - fVar11 = fVar11 + 360.0; - } - } - else { - fVar11 = fVar11 - 360.0; - } - this->_formationAngle = fVar11; - local_24 = fVar11 * 0.017453292; - local_28 = GHIDRA_CAST(cos(local_24)); - fVar9 = sin(local_24); - fVar8 = (this->_formationOffset).x; - fVar11 = (this->_formationOffset).y; - outOffset->x = (float)local_28 * fVar8 - fVar9 * fVar11; - outOffset->y = (float)local_28 * fVar11 + fVar9 * fVar8; - } - else { - outOffset->x = g_vectorZero.x; - outOffset->y = g_vectorZero.y; - } - ExceptionList = local_1c; - return outOffset; -} - -// 006348d0 -void Entity_Familiar::reset_follow_target() -{ - (this->_formationTargetOffset).x = g_vectorZero.x; - (this->_formationTargetOffset).y = g_vectorZero.y; - (this->_formationOffset).x = (this->_formationTargetOffset).x; - (this->_formationOffset).y = (this->_formationTargetOffset).y; - this->_formationAngle = 0.0; - this->_formationMode = 0xff; - return; -} - -// 00634a40 -void Entity_Familiar::ResolveOrbitConflict() -{ - char cVar1; - uint32_t uVar2; - int extraout_ECX; - uint32_t familiarIndex; - uint32_t extraout_EDX; - uint8_t familiars [12]; - uint32_t uStack_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af3860; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((familiars + 0x1c)); - ExceptionList = &local_10; - if (this->_formationMode != 0) { - cVar1 = FUN_00634920(uVar2); - if (cVar1 == '\0') { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(familiars),3,-1,-1,0,0) - ; - familiarIndex = 0; - if (uStack_14 != 0) { - do { - if (*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + familiarIndex * 4)) != this) { - cVar1 = FUN_00634920(uVar2); - familiarIndex = extraout_EDX; - if ((cVar1 == '\0') && (*(void **)(extraout_ECX + 0x410) == this->_player)) { - *GHIDRA_CAST((extraout_ECX + 0xda4)) = 0xff; - } - } - familiarIndex = familiarIndex + 1; - } while (familiarIndex < uStack_14); - } - if (familiars[0] == '\0') { - local_8 = 0; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)familiars)) + 0x4))),0); - } - } - } - ExceptionList = local_10; - return; -} - -// 00634b10 -void Entity_Familiar::ai_lil_spewer() -{ - code *pcVar1; - BitSet128 flags; - uint8_t bVar2; - int iVar3; - Entity *spawned; - Entity_Tear *tear; - uint8_t rngShift2; - uint8_t rngShift3; - void *pvVar4; - void *extraout_ECX; - uint32_t babyIdx; - uint32_t uVar5; - uint32_t uVar6; - float fVar7; - uint32_t *puVar8; - float fVar9; - uint32_t uVar10; - TypeDescriptor *pTVar11; - TypeDescriptor *pTVar12; - uint32_t uVar13; - BitSet128 tearFlagsLo; - float tearModifier; - float baseDamage; - float baseFallingSpeed; - Vector fireDir; - Vector local_68; - uint32_t *local_60; - Vector local_5c; - RNG rng; - std_string *local_44; - uint32_t local_40; - std_vector *local_3c; - uint8_t isAimingAtMarked; - float tearColor; - float local_30; - float local_2c; - uint32_t local_28; - uint32_t local_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t uStack_18; - uint32_t local_14; - uint32_t local_10; - uint32_t local_c; - uint32_t local_8; - void *babiesBegin; - - local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - if (this->_subtype == 0) { - uVar6 = this->_initSeed ^ g_game->_dungeonPlacementSeed; - local_3c = &(g_manager->_entityConfig)._babies; - rng._shift1 = 1; - rng._shift2 = 0x15; - local_44 = GHIDRA_CAST(&DAT_00000014); - local_40 = 0; - do { - uVar5 = (GHIDRA_INT((g_manager->_entityConfig)._babies._end) - GHIDRA_INT(local_3c->_begin)) / 0x38; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> 1 ^ uVar6; - uVar6 = uVar6 << 0x15 ^ uVar6; - uVar6 = uVar6 >> 0x14 ^ uVar6; - babyIdx = 0; - if (uVar5 != 0) { - babyIdx = uVar6 % uVar5; - } - babiesBegin = local_3c->_begin; - local_5c.y = (float)(GHIDRA_INT(babiesBegin) + babyIdx * 0x38); - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_5c.y) + 0x34)); - pvVar4 = (void *)local_5c.y; - if ((GHIDRA_INT(uVar5) < 0) || - ((uVar5 < 0x282 && - (((uVar5 == 0 || ((g_manager->_persistentGameData)._achievements[uVar5] != 0)) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))))) - goto LAB_00634ca6; - local_40 = local_40 + 1; - } while (local_40 < 10); - local_40 = (GHIDRA_INT((g_manager->_entityConfig)._babies._end) - GHIDRA_INT(babiesBegin)) / 0x38 - 0x47; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> 1 ^ uVar6; - uVar6 = uVar6 << 0x15 ^ uVar6; - uVar5 = 0; - if (local_40 != 0) { - uVar5 = (uVar6 >> 0x14 ^ uVar6) % local_40; - } - pvVar4 = (void *)(GHIDRA_INT(babiesBegin) + (uVar5 + 0x47) * 0x38); -LAB_00634ca6: - uVar6 = 0; - if ((this->_sprite)._layerCount != 0) { - local_44 = GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x1c)); - do { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(uVar6,local_44); - uVar6 = uVar6 + 1; - pvVar4 = extraout_ECX; - } while (uVar6 < GHIDRA_UINT((this->_sprite)._layerCount)); - } - ANM2::LoadGraphics(&this->_sprite,(uint8_t)pvVar4); - this->_subtype = 1; - } - rng._seed = this->_initSeed ^ g_game->_dungeonPlacementSeed; - rng._shift1 = 1; - rng._shift2 = 0x1b; - rng._shift3 = 0x1b; - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) != '\0') { - return; - } - iVar3 = this->_fireCooldown; - if (0 < iVar3) { - iVar3 = iVar3 + -1; - this->_fireCooldown = iVar3; - } - uVar6 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)); - local_40 = uVar6; - if (uVar6 == 0xffffffff) { - if ((((-1 < this->_headFrameDelay) && - (iVar3 = this->_headFrameDelay + -1, this->_headFrameDelay = iVar3, iVar3 < 0)) && - (bVar2 = ANM2::SetAnimation(&this->_sprite,&DAT_00b1cddc,1), bVar2 != 0)) && - (((this->_sprite)._animState._animData != (void *)0x0 && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0), - (this->_sprite)._animState._animData != (void *)0x0)))) { - (this->_sprite)._animState._isPlaying = 0; - } - } - else { - if (iVar3 < 1) { - fVar7 = apply_tear_modifiers(this); - local_44 = GHIDRA_CAST(0x0); - local_60 = GHIDRA_CAST(((fVar7 * 0.25 + 0.75) * 0.8)); - tearFlagsLo._l = 0; - tearFlagsLo._h = 0; - familiar_wisp_pick_tear_color(&rng,GHIDRA_CAST(&local_44),&tearFlagsLo); - tearModifier = apply_tear_modifiers(this); - if (rng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - bVar2 = (uint8_t)rng._shift1; - uVar5 = GHIDRA_UINT(rng._seed) >> (bVar2 & 0x1f) ^ rng._seed; - rngShift2 = (uint8_t)rng._shift2; - uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; - rngShift3 = (uint8_t)rng._shift3; - uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; - baseDamage = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283062e-10 * 4.0 + 2.0; - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; - uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; - uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; - baseFallingSpeed = - (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283062e-10 * 0.4 - 0.2; - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; - uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; - uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; - local_3c = (std_vector *) - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283062e-10); - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; - uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; - uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; - local_5c.y = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283062e-10; - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; - local_14 = 0; - local_10 = 0; - uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; - local_c = 0; - local_68.y = (float)(uVar5 >> (rngShift3 & 0x1f) ^ uVar5); - local_28 = 0x3f800000; - local_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - uStack_18 = 0; - tearColor = (float)((double)GHIDRA_INT(local_68.y) + - __uint_to_double_fixup[-(GHIDRA_INT(local_68.y) >> 0x1f)]) * 2.3283062e-10; - local_30 = local_5c.y; - local_2c = (float)local_3c; - Isaac::GetAxisAlignedUnitVectorFromDir(&fireDir,uVar6); - isAimingAtMarked = TryAimAtMarkedTarget(this,&fireDir,GHIDRA_CAST(&local_40),GHIDRA_CAST(0x0)); - local_5c.y = fireDir.x * 10.0; - local_3c = GHIDRA_CAST((fireDir.y * 10.0)); - if (local_68.y == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = GHIDRA_UINT(local_68.y) >> ((uint8_t)rng._shift1 & 0x1f) ^ GHIDRA_UINT(local_68.y); - uVar6 = uVar6 << (rngShift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar6; - local_68.y = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283062e-10 * 0.6 + 0.7; - local_68.x = local_5c.y * local_68.y; - local_68.y = (float)local_3c * local_68.y; - if (isAimingAtMarked == 0) { - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; - fVar9 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; - local_68.x = fVar7 + fVar7 + local_68.x; - local_68.y = fVar9 + fVar9 + local_68.y; - } - uVar5 = Random(); - uVar13 = 0; - pTVar12 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; - local_5c.x = fireDir.x * 10.0 + (this->_pos).x; - pTVar11 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar10 = 0; - local_5c.y = fireDir.y * 10.0 + (this->_pos).y; - spawned = Game::Spawn(g_game,2,GHIDRA_UINT(local_44),&local_5c,&local_68,GHIDRA_CAST(this),0,uVar5); - tear = GHIDRA_CAST(__RTDynamicCast(spawned,uVar10,pTVar11,pTVar12,uVar13)); - uVar5 = Random(); - tear->_fallingAccel = 0.0; - tear->_fallingSpeed = - (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + baseFallingSpeed; - tear->SetCollisionDamage(baseDamage * tearModifier); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (uint32_t)tearFlagsLo._h; - flags._l = tearFlagsLo._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLo._h)) + 0x4))); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); - puVar8 = local_60; - if ((float)local_60 <= 0.01) { - puVar8 = GHIDRA_CAST(0x3c23d70a); - } - tear->_baseScale = (float)puVar8; - tear->_fScale = (float)puVar8; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - if (tear->_parent != 0) { - local_60 = &tear->_parent; - msvc::multiset::erase(&local_60); - } - tear->_parent = this; - msvc::multiset::insert(&tear->_parent); - tear->SetColor(&tearColor,0xffffffff,0xff,0,1); - uVar5 = Random(); - tear->_tearIdx = uVar5 & 1; - TryFireTear(this,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar6; - iVar3 = apply_forgotten_lullaby(this,(uVar6 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar6) % 0xc + 10) - ; - this->_fireCooldown = iVar3; - this->_headFrameDelay = 0x12; - } - else if (this->_headFrameDelay < 9) { - bVar2 = ANM2::SetAnimation(&this->_sprite,(&PTR_DAT_00b6297c)[uVar6],1); - if (((bVar2 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } - this->_headFrameDelay = 8; - goto LAB_0063535f; - } - bVar2 = ANM2::SetAnimation(&this->_sprite,(&PTR_DAT_00b6297c)[local_40],1); - if (((bVar2 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,2.0), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } - this->_headFrameDelay = this->_headFrameDelay + -1; - } -LAB_0063535f: - FollowParent(this); - return; -} - -// 006378c0 -void Entity_Familiar::ai_lil_harbingers() -{ - code *pcVar1; - float *pfVar2; - uint8_t bVar3; - uint32_t uVar4; - uint32_t uVar5; - Entity *pEVar6; - Vector *pVVar7; - Vector *randomPos; - uint8_t *pbVar8; - uint8_t *pbVar9; - int iVar10; - uint32_t subtypeIndex; - char *expectedName; - uint32_t *linkedEntitySlot; - bool bVar11; - float fVar12; - float fVar13; - uint32_t entityIndex; - int entityType; - Vector local_64; - Room *local_5c; - float local_58; - uint32_t entityCount; - Entity *local_50; - int fireDelayBySubtype [5]; - float maxSpeedBySubtype [5]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - float fStack_14; - Game *game; - - puStack_20 = GHIDRA_CAST((maxSpeedBySubtype + 0xd)); - fStack_14 = -NAN; - puStack_18 = &LAB_00af6ff0; - local_1c = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((maxSpeedBySubtype + 10)); - ExceptionList = &local_1c; - iVar10 = this->_state; - local_24 = uVar4; - pfVar2 = maxSpeedBySubtype + 0xd; - if (300 < iVar10) { - uVar5 = (this->_dropRNG)._seed; - pfVar2 = maxSpeedBySubtype + 0xd; - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar5 = (this->_dropRNG)._seed; - pfVar2 = GHIDRA_CAST(puStack_20); - if (uVar5 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - puStack_20 = GHIDRA_CAST(pfVar2); - uVar5 = uVar5 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; - uVar5 = uVar5 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; - uVar5 = uVar5 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; - (this->_dropRNG)._seed = uVar5; - this->_subtype = uVar5 % 5; - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - init_lil_harbinger_sprite(this,uVar4); - uVar4 = Random(); - pEVar6 = Game::SpawnEx(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4,0); - pEVar6->Update(); - this->_state = 0; - iVar10 = 0; - pfVar2 = GHIDRA_CAST(puStack_20); - } - puStack_20 = GHIDRA_CAST(pfVar2); - local_58 = (this->_targetPosition).x; - if ((local_58 == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y)) { - pVVar7 = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&local_64,this->_size); - (this->_targetPosition).x = pVVar7->x; - (this->_targetPosition).y = pVVar7->y; - iVar10 = this->_state; - local_58 = (this->_targetPosition).x; - } - this->_state = iVar10 + 1; - pVVar7 = &this->_pos; - local_50 = GHIDRA_CAST(((this->_targetPosition).y - (this->_pos).y)); - local_58 = local_58 - pVVar7->x; - fVar12 = sqrtf((float)local_50 * (float)local_50 + local_58 * local_58); - if (fVar12 <= 0.0) { - fVar13 = local_58; - pEVar6 = local_50; - } - else { - fVar13 = (2.0 / fVar12) * local_58; - pEVar6 = GHIDRA_CAST(((2.0 / fVar12) * (float)local_50)); - } - (this->_velocity).x = fVar13 + (this->_velocity).x; - (this->_velocity).y = (float)pEVar6 + (this->_velocity).y; - iVar10 = this->_subtype; - if ((iVar10 == 0) || (iVar10 == 3)) { - fVar13 = pVVar7->x - (this->_targetPosition).x; - fVar12 = (this->_pos).y - (this->_targetPosition).y; - if (fVar12 * fVar12 + fVar13 * fVar13 < 25.0) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - } - game = g_game; - if ((((this->_flags & 0x4000) == 0) && (bVar3 = Game::IsPaused(g_game), bVar3 == 0)) && - ((game->_frameCount + this->_index) % 3 == 0)) { - local_5c = game->_room; - local_58 = 0.0; - uVar4 = (local_5c->_entityList)._updateEL._size; - entityIndex = 0; - local_50 = GHIDRA_CAST(0x0); - entityCount = uVar4; - if (uVar4 != 0) { - local_64.y = *GHIDRA_CAST(&game->_deathmatchManager); - do { - pEVar6 = *(Entity **) - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((local_5c->_entityList)._updateEL)) + 0x4)))) + entityIndex * 4); - if ((GHIDRA_INT(local_64.y) < 2) || (pEVar6->_type != 1)) { - entityType = pEVar6->_type; - uVar4 = entityCount; - if (entityType - 10U < 0x3de) goto LAB_00637d3b; - } - else { - entityType = 1; -LAB_00637d3b: - if (((pEVar6->_entityCollisionClass != 1) && (pEVar6->_entityCollisionClass != 0)) && - ((pEVar6->_isInvicible == 0 && (pEVar6->_dead == 0)))) { - bVar3 = (GHIDRA_CAST((pEVar6)))->Entity::HasEntityFlags(0x10); - if (((bVar3 == 0) || (entityType == 0x322)) || (entityType == 0x362)) { - fVar12 = (pEVar6->_pos).x - (this->_pos).x; - fVar13 = (pEVar6->_pos).y - (this->_pos).y; - fVar12 = fVar13 * fVar13 + fVar12 * fVar12; - if (local_50 == GHIDRA_CAST(0x0)) { - local_58 = fVar12; - local_50 = pEVar6; - } - else if (fVar12 < local_58) { - local_58 = fVar12; - local_50 = pEVar6; - } - } - uVar4 = entityCount; - } - } - entityIndex = entityIndex + 1; - } while (entityIndex < uVar4); - } - if (local_50 == GHIDRA_CAST(0x0)) { - fVar13 = (this->_pos).x - (this->_targetPosition).x; - fVar12 = (this->_pos).y - (this->_targetPosition).y; - if (fVar12 * fVar12 + fVar13 * fVar13 < 25.0) { - pVVar7 = (GHIDRA_CAST((local_5c)))->Room::GetRandomPosition(&local_64,this->_size); - (this->_targetPosition).x = pVVar7->x; - (this->_targetPosition).y = pVVar7->y; - } - } - else { - fVar12 = (local_50->_pos).y; - (this->_targetPosition).x = (local_50->_pos).x; - (this->_targetPosition).y = fVar12; - } - } - } - else { - fVar12 = pVVar7->x - (this->_targetPosition).x; - fVar13 = (this->_pos).y - (this->_targetPosition).y; - if (fVar13 * fVar13 + fVar12 * fVar12 < 25.0) { - randomPos = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&local_64,this->_size); - (this->_targetPosition).x = randomPos->x; - (this->_targetPosition).y = randomPos->y; - iVar10 = this->_subtype; - } - if (iVar10 == 1) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xc,this->_index); - if ((bVar3 != 0) && ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0)) { - uVar4 = Random(); - pEVar6 = this->_player; - uVar5 = 0x35; - goto LAB_00637be3; - } - } - else if (((iVar10 == 2) && - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xc,this->_index), bVar3 != 0)) && - ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0)) { - uVar4 = Random(); - pEVar6 = this->_player; - uVar5 = 0x2d; -LAB_00637be3: - pEVar6 = Game::SpawnEx(g_game,1000,uVar5,pVVar7,&g_vectorZero,pEVar6,0,uVar4,0); - iVar10 = __RTDynamicCast(pEVar6,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); - *GHIDRA_CAST((iVar10 + 0x45c)) = 0x78; - *GHIDRA_CAST((iVar10 + 0x460)) = 0x78; - *GHIDRA_CAST((iVar10 + 0x470)) = 1; - } - } - uVar4 = this->_subtype; - maxSpeedBySubtype[4] = 2.0; - fireDelayBySubtype[4] = 0x3c; - maxSpeedBySubtype[0] = 2.5; - maxSpeedBySubtype[1] = 2.0; - maxSpeedBySubtype[2] = 2.0; - maxSpeedBySubtype[3] = 1.5; - fireDelayBySubtype[0] = 0x96; - fireDelayBySubtype[1] = 0x5a; - fireDelayBySubtype[2] = 0x5a; - fireDelayBySubtype[3] = 0x5a; - if (4 < uVar4) { - KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Wrong Harbinger subtype %u!\n")); - uVar4 = this->_subtype; - } - fVar12 = (this->_velocity).x; - local_64.y = (this->_velocity).y; - fVar12 = sqrtf(fVar12 * fVar12 + local_64.y * local_64.y); - subtypeIndex = -GHIDRA_UINT((uVar4 != 0)) & uVar4; - uVar5 = 4; - if (subtypeIndex < 4) { - uVar5 = subtypeIndex; - } - if (maxSpeedBySubtype[uVar5] <= fVar12 && fVar12 != maxSpeedBySubtype[uVar5]) { - uVar5 = 4; - if (subtypeIndex < 4) { - uVar5 = subtypeIndex; - } - if (0.0 < fVar12) { - fVar13 = maxSpeedBySubtype[uVar5]; - (this->_velocity).y = (fVar13 / fVar12) * local_64.y; - (this->_velocity).x = (fVar13 / fVar12) * (this->_velocity).x; - uVar4 = this->_subtype; - } - } - iVar10 = this->_fireCooldown + 1; - this->_fireCooldown = iVar10; - uVar4 = -GHIDRA_UINT((uVar4 != 0)) & uVar4; - uVar5 = 4; - if (uVar4 < 4) { - uVar5 = uVar4; - } - if ((fireDelayBySubtype[uVar5] <= iVar10) && (this->_linkedEntity == 0)) { - this->_fireCooldown = 0; - uVar4 = Random(); - local_5c = GHIDRA_CAST(Game)::SpawnEx(g_game,3,0x2b,&this->_pos,&g_vectorZero,this->_player, - this->_subtype + 1,uVar4,0); - if (this->_subtype == 4) { - uVar4 = Random(); - local_5c = GHIDRA_CAST(Game)::SpawnEx(g_game,3,0x2b,&this->_pos,&g_vectorZero,this->_player, - this->_subtype + 1,uVar4,0); - } - bVar3 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("PreSpawn"),1); - if (bVar3 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - linkedEntitySlot = &this->_linkedEntity; - if (*linkedEntitySlot != 0) { - local_64.y = (float)linkedEntitySlot; - msvc::multiset::erase(&local_64.y); - } - *linkedEntitySlot = local_5c; - pEVar6 = GHIDRA_CAST(0x0); - if (local_5c != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(linkedEntitySlot); - pEVar6 = GHIDRA_CAST(this->_linkedEntity); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(pEVar6); - } - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying == 0)) { - pbVar8 = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { - pbVar8 = *GHIDRA_CAST(pbVar8); - } - expectedName = "PreSpawn"; - do { - bVar3 = *pbVar8; - bVar11 = bVar3 < (uint8_t)*expectedName; - if (bVar3 != *expectedName) { -LAB_006380a0: - uVar4 = -GHIDRA_UINT(bVar11) | 1; - goto LAB_006380a5; - } - if (bVar3 == 0) break; - bVar3 = pbVar8[1]; - bVar11 = bVar3 < (uint8_t)expectedName[1]; - if (bVar3 != expectedName[1]) goto LAB_006380a0; - pbVar8 = pbVar8 + 2; - expectedName = expectedName + 2; - } while (bVar3 != 0); - uVar4 = 0; -LAB_006380a5: - if (uVar4 == 0) { - pbVar8 = (this->_sprite)._animState._animData; - if (pbVar8 != GHIDRA_CAST(0x0)) { - pbVar9 = pbVar8; - if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { - pbVar9 = *GHIDRA_CAST(pbVar8); - } - expectedName = "FloatDown"; - do { - bVar3 = *pbVar9; - bVar11 = bVar3 < (uint8_t)*expectedName; - if (bVar3 != *expectedName) { -LAB_006380e0: - uVar4 = -GHIDRA_UINT(bVar11) | 1; - goto LAB_006380e5; - } - if (bVar3 == 0) break; - bVar3 = pbVar9[1]; - bVar11 = bVar3 < (uint8_t)expectedName[1]; - if (bVar3 != expectedName[1]) goto LAB_006380e0; - pbVar9 = pbVar9 + 2; - expectedName = expectedName + 2; - } while (bVar3 != 0); - uVar4 = 0; -LAB_006380e5: - if ((uVar4 == 0) && ((pbVar8[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0063811c; - } - bVar3 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("FloatDown"),1); - if (bVar3 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - } -LAB_0063811c: - fVar12 = (this->_velocity).x; - if (0.0 < ABS(fVar12)) { - (this->_sprite)._flipX = fVar12 < 0.0; - } - ExceptionList = local_1c; - return; -} - -// 00638c10 -Entity_Laser * Entity_Familiar::FireBrimstone(Vector *AimDirection, uint8_t Unk) -{ - Entity_Tear *laser; - int direction; - float fVar1; - Vector local_4c; - Vector *aimDirection; - uint32_t deliriumColor; - uint32_t uStack_3c; - uint32_t uStack_38; - uint32_t uStack_34; - uint32_t local_30; - uint32_t uStack_2c; - uint32_t uStack_28; - uint32_t uStack_24; - uint32_t local_20; - uint32_t local_1c; - uint32_t local_18; - uint32_t local_14; - - local_14 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - aimDirection = AimDirection; - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) == '\0') { - fVar1 = AimDirection->x; - local_4c.x = fVar1 * 10.0; - local_4c.y = -19.0 - ABS(fVar1) * 4.0; - fVar1 = atan2f(AimDirection->y,fVar1); - laser = (Entity_Tear *) - Entity_Laser::ShootAngle(1,&this->_pos,fVar1 * 57.295776,8,&local_4c,GHIDRA_CAST(this),0); - fVar1 = apply_tear_modifiers(this); - laser->SetCollisionDamage(fVar1 * 3.0); - (laser->_tearHaloANM2)._animState._animData = (void *)0x3f000000; - (GHIDRA_CAST((GHIDRA_CAST(laser))))->Entity_Laser::ResetSpriteScale(); - if (-0.5 < aimDirection->y || aimDirection->y == -0.5) { - fVar1 = 3000.0; - } - else { - fVar1 = -10.0; - } - laser->_renderDepthOffset = fVar1; - if (Unk == 0) { - if (this->_isLilDelirium != 0) { - local_20 = 0x3f800000; - local_30 = 0; - uStack_2c = 0; - uStack_28 = 0; - uStack_24 = 0; - deliriumColor = 0x3e4ccccd; - uStack_3c = 0x3f800000; - uStack_38 = 0; - uStack_34 = 0x3f800000; - local_1c = 0x3f800000; - local_18 = 0; - laser->SetColor(&deliriumColor,0xffffffff,0xff,0,1); - } - apply_baby_bender(this,laser); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(laser)); - laser->Update(); - if (this->_linkedEntity != 0) { - local_4c.y = (float)&this->_linkedEntity; - msvc::multiset::erase(&local_4c.y); - } - this->_linkedEntity = laser; - msvc::multiset::insert(&this->_linkedEntity); - this->_headFrameDelay = 0x1e; - if (ABS(aimDirection->x) <= ABS(aimDirection->y)) { - direction = GHIDRA_UINT((0.0 <= aimDirection->y)) * 2 + 1; - } - else { - direction = 2; - if (aimDirection->x < 0.0) { - direction = 0; - } - } - PlayShootAnim(this,direction); - } - } - else { - laser = GHIDRA_CAST(0x0); - } - return GHIDRA_CAST(laser); -} - -// 00639000 -Entity * Entity_Familiar::ThrowDip(int subType, Vector *position, Entity *spawner) -{ - int *piVar1; - uint32_t uVar2; - Entity *pEVar3; - int playerColor; - float *colorSlot; - uint32_t uVar4; - uint64_t *heapBytes; - int *oldestDip; - float score; - float bestScore; - uint8_t local_7c [8]; - float local_74; - uint32_t dipCount; - Entity *savedSpawner; - int *local_64; - float local_60 [15]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - float local_14; - ColorMod *dipColor; - float dipListData; - uint32_t flagsHigh; - bool isUnderCap; - Entity *owner; - uint64_t prevBytes; - - puStack_20 = GHIDRA_CAST((local_60 + 0x17)); - puStack_18 = &LAB_00af702d; - local_1c = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((local_60 + 0x14)); - ExceptionList = &local_1c; - savedSpawner = spawner; - local_24 = uVar2; - while( true ) { - local_14 = -NAN; - oldestDip = GHIDRA_CAST(0x0); - bestScore = 1e+10; - local_64 = GHIDRA_CAST(0x0); - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST((local_7c + 4)),3,0xc9,-1 - ,0,0); - dipListData = local_74; - local_14 = 0.0; - uVar4 = 0; - if (dipCount == 0) break; - do { - piVar1 = *GHIDRA_CAST((GHIDRA_CAST(local_74) + uVar4 * 4)); - if ((((piVar1 != GHIDRA_CAST(0x0)) && (piVar1[10] == 3)) && (*GHIDRA_CAST((GHIDRA_CAST(piVar1) + 0x173)) == '\0') - ) && (GHIDRA_CAST(piVar1[0x104]) == savedSpawner)) { - local_60[0xc] = 10000.0; - local_60[0xd] = 10000.0; - local_60[0xe] = 10000.0; - local_60[0] = 0.0; - local_60[1] = 10000.0; - local_60[2] = -200.0; - local_60[3] = 20000.0; - local_60[4] = 20000.0; - local_60[5] = 10000.0; - local_60[6] = 20000.0; - local_60[7] = 0.0; - local_60[8] = 0.0; - local_60[9] = 0.0; - local_60[10] = 0.0; - local_60[0xb] = 0.0; - if (GHIDRA_UINT(piVar1[0xc]) < 0xf) { - score = local_60[piVar1[0xc]]; - } - else { - score = 0.0; - } - score = score - (float)(g_game->_frameCount - piVar1[0xca]); - if (score < bestScore) { - oldestDip = piVar1; - bestScore = score; - } - local_64 = GHIDRA_CAST((GHIDRA_INT(local_64) + 1)); - } - uVar4 = uVar4 + 1; - } while (uVar4 < dipCount); - isUnderCap = local_64 < GHIDRA_CAST(0x21); - local_64 = oldestDip; - if (isUnderCap) break; - if (oldestDip == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(4,(uint8_t *) - "Entity_Familiar::ThrowDip: couldn\'t find a candidate for removal, remaining: %d\n" - ); - goto joined_r0x0063923f; - } - local_60[5] = 0.0; - local_60[10] = g_vectorZero.y; - local_60[0xc] = g_vectorZero.y; - local_60[6] = 0.0; - local_60[7] = 0.0; - local_60[8] = 0.0; - local_60[9] = g_vectorZero.x; - local_60[0xb] = g_vectorZero.x; - local_60[0xd] = 0.0; - local_60[0xe] = 0.0; - (**(code **)(*oldestDip + 0x24))(local_60 + 5,uVar2); - local_14 = -NAN; - if (local_7c[4] == '\0') { - if (g_mainHeap == (void *)0x0) { - heapBytes = &g_allocatedBytesNoHeap; - } - else { - heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (dipListData != 0.0) { - uVar4 = *GHIDRA_CAST((GHIDRA_CAST(dipListData) + -4)); - prevBytes = *heapBytes; - *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar4)); - free((void *)(GHIDRA_INT(dipListData) + -4)); - } - } - } -joined_r0x0063923f: - if (local_7c[4] == '\0') { - local_14 = -NAN; - if (g_mainHeap == (void *)0x0) { - heapBytes = &g_allocatedBytesNoHeap; - } - else { - heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (dipListData != 0.0) { - uVar2 = *GHIDRA_CAST((GHIDRA_CAST(dipListData) + -4)); - prevBytes = *heapBytes; - *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar2)); - free((void *)(GHIDRA_INT(dipListData) + -4)); - } - } - local_14 = -NAN; - uVar2 = Random(); - owner = savedSpawner; - pEVar3 = Game::Spawn(g_game,3,0xc9,position,&g_vectorZero,savedSpawner, - -GHIDRA_UINT((4 < subType - 7U)) & subType,uVar2); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&pEVar3->_flags) + 4)); - *GHIDRA_CAST(&pEVar3->_flags) = GHIDRA_UINT(pEVar3->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar3->_flags) + 4)) = flagsHigh; - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (owner != GHIDRA_CAST(0x0))) && (owner->_type == 1) - ) { - playerColor = 0; - colorSlot = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0x60)))); - do { - if (*colorSlot == owner[5]._color._colorize[0]) goto LAB_006392f7; - playerColor = playerColor + 1; - colorSlot = colorSlot + 1; - } while (playerColor < 4); - playerColor = 5; -LAB_006392f7: - PlayerManager::GetPlayerColorValue(GHIDRA_CAST(local_7c),playerColor); - dipColor = &(pEVar3->_sprite)._color; - if (dipColor != GHIDRA_CAST((local_60 + 4))) { - (pEVar3->_sprite)._color._colorize[0] = 0.0; - (pEVar3->_sprite)._color._colorize[1] = 0.0; - (pEVar3->_sprite)._color._colorize[2] = 0.0; - (pEVar3->_sprite)._color._colorize[3] = 0.0; - dipColor->_tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x0))); - (pEVar3->_sprite)._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x4))); - (pEVar3->_sprite)._color._tint[2] = local_74; - (pEVar3->_sprite)._color._tint[3] = 1.0; - *GHIDRA_CAST((pEVar3->_sprite)._color._offset) = - CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x4))) * 0.25,(*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x0))) * 0.25); - (pEVar3->_sprite)._color._offset[2] = local_74 * 0.25; - } - } - ExceptionList = local_1c; - return pEVar3; -} - -// 00639750 -Entity_Tear * Entity_Familiar::FireProjectile(Vector *AimDirection, uint8_t Unk) -{ - Entity_Player *this_00; - BitSet128 flags; - BitSet128 flags_00; - BitSet128 flags_01; - Vector velocity_00; - uint8_t bVar1; - uint32_t rngResult; - int iVar2; - ColorMod *other; - Vector *pVVar3; - uint32_t uVar4; - Entity_Tear *tear; - float fVar5; - int extraout_ECX; - float fVar6; - uint32_t uVar7; - float fVar8; - uint8_t extraout_var [12]; - float afVar9 [4]; - float afVar10 [4]; - uint32_t *puVar11; - float fVar12; - float tearDamage; - float tearScale; - float local_140; - float fStack_13c; - float local_138; - float fStack_134; - float local_12c; - float local_128; - Vector *local_124; - float velocityY; - float velocityX; - float fallingSpeed; - Vector velocity; - uint32_t *local_10c; - Vector local_108; - float local_100; - float local_fc; - Vector local_f8; - Vector local_f0; - float local_e8; - float local_e4; - float local_dc; - ColorMod tmpColor; - Color tearColor; - TearParams hitParams; - uint32_t local_14; - - local_14 = __security_cookie ^ GHIDRA_UINT(&tearDamage); - fallingSpeed = 0.0; - velocityX = AimDirection->x * 10.0; - velocityY = AimDirection->y * 10.0; - velocity.x = velocityX; - velocity.y = velocityY; - if (Unk == 0) { - iVar2 = this->_variant; - if (iVar2 == 200) { - tearScale = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; - local_12c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; - tearScale = tearScale + tearScale; - local_12c = local_12c + local_12c; - local_124 = GHIDRA_CAST(AimDirection->x); - local_128 = AimDirection->y; - fVar8 = sqrtf((float)local_124 * (float)local_124 + local_128 * local_128); - if (0.0 < fVar8) { - local_124 = GHIDRA_CAST((AimDirection->x * (1.0 / fVar8))); - local_128 = AimDirection->y * (1.0 / fVar8); - } - local_10c = GHIDRA_CAST(AimDirection->x); - local_100 = AimDirection->y; - fVar8 = sqrtf((float)local_10c * (float)local_10c + local_100 * local_100); - if (fVar8 <= 0.0) { - puVar11 = local_10c; - fVar8 = local_100; - } - else { - puVar11 = GHIDRA_CAST((AimDirection->x * (1.0 / fVar8))); - fVar8 = AimDirection->y * (1.0 / fVar8); - } - fVar8 = fVar8 * local_12c + (float)puVar11 * tearScale; - fVar12 = local_128 * fVar8; - fVar8 = (float)local_124 * fVar8; - velocity.x = tearScale; - velocity.y = local_12c; - if (fVar12 * AimDirection->y + fVar8 * AimDirection->x < 0.0) { - velocity.x = tearScale - fVar8; - velocity.y = local_12c - fVar12; - } - velocity.x = velocityX + velocity.x; - velocity.y = velocityY + velocity.y; - } - else { - if ((iVar2 == 8) || (iVar2 == 0xf4)) { - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; - fVar12 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; - velocityX = velocityX - (fVar8 + fVar8); - velocityY = velocityY - (fVar12 + fVar12); - } - else { - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; - fVar12 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; - velocityX = velocityX + fVar8 + fVar8; - velocityY = velocityY + fVar12 + fVar12; - } - velocity.x = velocityX; - velocity.y = velocityY; - if ((velocityY * velocityY + velocityX * velocityX < 100.0) && (iVar2 != 0x6c)) { - pVVar3 = (GHIDRA_CAST((&velocity)))->Vector::Normalized(&local_108); - velocity.x = pVVar3->x * 10.0; - velocity.y = pVVar3->y * 10.0; - } - } - } - velocityY = velocity.y; - velocityX = velocity.x; - if ((this->_variant == 0xce) || (this->_variant == 0xed)) { - velocity_00.y = velocity.y; - velocity_00.x = velocity.x; - tear = fire_wisp_projectile(this,velocity_00); - return tear; - } - uVar7 = 0; - local_12c = 0.0; - local_140 = 0.0; - fStack_13c = 0.0; - local_138 = 0.0; - fStack_134 = 0.0; - local_124 = GHIDRA_CAST(apply_tear_modifiers(this)); - fVar8 = apply_tear_modifiers(this); - fVar12 = 0.8; - tearDamage = 3.5; - local_10c = GHIDRA_CAST(0x0); - afVar9[0] = (fVar8 * 0.25 + 0.75) * 0.8; - afVar9[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)extraout_var)) + 0x0))); - afVar9[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)extraout_var)) + 0x4))); - afVar9[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)extraout_var)) + 0x8))); - tearScale = afVar9[0]; - (GHIDRA_CAST((&tearColor)))->Color::Color(); - uVar4 = this->_variant; - if (uVar4 == 0x4a) { - local_100 = (float)this->_subtype; -LAB_00639ad8: - local_128 = 0.0; - if (local_100 == 1.12104e-44) goto LAB_00639ae3; - } - else { - local_100 = -NAN; - if (uVar4 != 0xb) goto LAB_00639ad8; -LAB_00639ae3: - rngResult = Random(); - afVar9 = (float [4])ZEXT416(GHIDRA_UINT(tearScale)); - fVar12 = 0.8; - uVar4 = this->_variant; - local_128 = (float)(rngResult % 10 + 1); - } - afVar10 = afVar9; - if (uVar4 == 0xc) { - local_140 = (float)g_tearFlagPiercing._l; - fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._l)) + 0x4))); - local_138 = (float)g_tearFlagPiercing._h; - fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._h)) + 0x4))); - if (this->_player != GHIDRA_CAST(0x0)) { - iVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetTrinketMultiplier(0x36); - afVar10 = afVar9; - if (1 < iVar2) { - tearDamage = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1470)); - if (2 < iVar2) { - (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = (double)tearDamage * 1.5; - afVar10[2] = 0.0; - afVar10[3] = 0.0; - tearDamage = (*GHIDRA_CAST((GHIDRA_CAST(&((float)afVar10)) + 0x0))); - } - } - } - goto LAB_0063a552; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(afVar9)) + 0x4))); - if (((uVar4 == 9) || (local_128 == 1.4013e-45)) || (local_100 == 8.40779e-45)) { - local_140 = (float)g_tearFlagSpectral._l; - fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))); - tearColor._tint[0] = _DAT_00babc50; - tearColor._tint[1] = _UNK_00babc54; - tearColor._tint[2] = _UNK_00babc58; - tearColor._tint[3] = _UNK_00babc5c; - local_138 = (float)g_tearFlagSpectral._h; - fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))); - afVar10 = _DAT_00babc50; - } - else { - fVar8 = afVar9[0]; - if (((uVar4 == 10) || (local_128 == 2.8026e-45)) || (local_100 == 9.80909e-45)) { - tearScale = fVar8 * 0.9; - uVar7 = 1; - local_12c = 1.4013e-45; - (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = ZEXT812(0x40800000); - afVar10[3] = 0.0; - tearDamage = afVar10[0]; - goto LAB_0063a552; - } - if ((local_128 == 4.2039e-45) || (local_100 == 1.12104e-44)) { - uVar7 = 1; - afVar10[0] = fVar8 * fVar12; - afVar10[1] = (float)afVar9[1]; - afVar10[2] = (float)afVar9[2]; - afVar10[3] = (float)afVar9[3]; - local_12c = 1.4013e-45; - fallingSpeed = 1.2; - tearDamage = 3.0; - tearScale = afVar10[0]; - goto LAB_0063a552; - } - if (((uVar4 == 6) || (local_128 == 5.60519e-45)) || (local_100 == 5.60519e-45)) { - afVar10[0] = fVar8 * 1.06; - uVar7 = 1; - local_12c = 1.4013e-45; - tearDamage = 5.0; - tearScale = afVar10[0]; - goto LAB_0063a552; - } - if (((uVar4 == 4) || (local_128 == 7.00649e-45)) || (local_100 == 2.8026e-45)) { - local_140 = (float)(GHIDRA_UINT(g_tearFlagSlow._l) | GHIDRA_UINT(g_tearFlagGish._l)); - fStack_13c = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGish._l)) + 0x4)))); - local_138 = (float)(GHIDRA_UINT(g_tearFlagSlow._h) | GHIDRA_UINT(g_tearFlagGish._h)); - fStack_134 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGish._h)) + 0x4)))); - tearColor._tint[0] = _DAT_00bac560; - tearColor._tint[1] = _UNK_00bac564; - tearColor._tint[2] = _UNK_00bac568; - tearColor._tint[3] = _UNK_00bac56c; - tearColor._offset[0] = -0.5882353; - tearColor._offset[1] = -0.5882353; - tearColor._offset[2] = -0.5882353; - afVar10 = _DAT_00bac560; - goto LAB_0063a552; - } - if (((uVar4 == 5) || (local_128 == 8.40779e-45)) || (local_100 == 4.2039e-45)) { - uVar7 = 0x15; - local_140 = (float)g_tearFlagHoming._l; - fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); - fallingSpeed = -3.0; - local_12c = 2.94273e-44; - local_138 = (float)g_tearFlagHoming._h; - fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); - goto LAB_0063a54a; - } - if ((uVar4 == 0xd) || (local_128 == 9.80909e-45)) { - local_140 = (float)(GHIDRA_UINT((float)g_tearFlagSpectral._l) | GHIDRA_UINT((float)g_tearFlagHoming._l)); - fStack_13c = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagSpectral._l))) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagHoming._l))) + 0x4)))); - local_138 = (float)(GHIDRA_UINT((float)g_tearFlagSpectral._h) | GHIDRA_UINT((float)g_tearFlagHoming._h)); - fStack_134 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagSpectral._h))) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagHoming._h))) + 0x4)))); - fallingSpeed = -3.0; - tearColor._tint[0] = _DAT_00babc50; - tearColor._tint[1] = _UNK_00babc54; - tearColor._tint[2] = _UNK_00babc58; - tearColor._tint[3] = _UNK_00babc5c; - afVar10 = _DAT_00babc50; - goto LAB_0063a552; - } - if (uVar4 == 0x2d) { - local_12c = 1.4013e-45; - uVar7 = 1; - goto LAB_0063a552; - } - if (((0x45 < uVar4) && (uVar4 < 0x49)) || (local_128 == 1.12104e-44)) { - uVar4 = Random(); - if ((uVar4 % 10 == 0) || (local_128 == 1.12104e-44)) { - local_140 = (float)g_tearFlagCharm._l; - fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._l)) + 0x4))); - local_138 = (float)g_tearFlagCharm._h; - fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._h)) + 0x4))); - } - tearColor._tint[0] = _DAT_00bac6e0; - tearColor._tint[1] = _UNK_00bac6e4; - tearColor._tint[2] = _UNK_00bac6e8; - tearColor._tint[3] = _UNK_00bac6ec; - tearColor._offset[0] = 0.19607845; - tearColor._offset[1] = 0.0; - tearColor._offset[2] = 0.0; - afVar10 = _DAT_00bac6e0; - if (this->_variant == 0x48) { - local_140 = (float)(GHIDRA_UINT(local_140) | GHIDRA_UINT(g_tearFlagHpDrop._l)); - fStack_13c = (float)(GHIDRA_UINT(fStack_13c) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._l)) + 0x4)))); - local_138 = (float)(GHIDRA_UINT(local_138) | GHIDRA_UINT(g_tearFlagHpDrop._h)); - fStack_134 = (float)(GHIDRA_UINT(fStack_134) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._h)) + 0x4)))); - } - goto LAB_0063a552; - } - if (((uVar4 == 7) || (local_100 == 7.00649e-45)) || (local_128 == 1.4013e-44)) { - tearColor._tint[0] = _DAT_00babfa0; - tearColor._tint[1] = _UNK_00babfa4; - tearColor._tint[2] = _UNK_00babfa8; - tearColor._tint[3] = _UNK_00babfac; - tearDamage = 6.0; - afVar10 = _DAT_00babfa0; - goto LAB_0063a552; - } - if (uVar4 == 0x6b) { - tearDamage = 6.0; - tmpColor._colorize = (float [4])ZEXT816(0); - local_12c = 8.40779e-45; - tmpColor._tint[0] = _DAT_00bac7b0; - tmpColor._tint[1] = _UNK_00bac7b4; - tmpColor._tint[2] = _UNK_00bac7b8; - tmpColor._tint[3] = _UNK_00bac7bc; - tmpColor._offset[0] = 0.0; - tmpColor._offset[1] = 0.2; - tmpColor._offset[2] = 0.4; - afVar10 = _DAT_00bac7b0; - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); - uVar7 = 6; - goto LAB_0063a552; - } - if ((uVar4 == 0x61) || (local_100 == 1.4013e-44)) { - tearColor._tint[0] = _DAT_00babfa0; - tearColor._tint[1] = _UNK_00babfa4; - tearColor._tint[2] = _UNK_00babfa8; - tearColor._tint[3] = _UNK_00babfac; - afVar10 = _DAT_00babfa0; - goto LAB_0063a552; - } - if (((uVar4 == 0x50) || (uVar4 == 0x51)) || (uVar4 == 0x4c)) { - this_00 = this->_player; - uVar4 = Random(); - Entity_Player::GetTearHitParams - (this_00,&hitParams,1,(float)local_124,(uVar4 & 1) * 2 + -1,GHIDRA_CAST(0x0)); - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&hitParams._tearColor); - local_fc = (float)(~(GHIDRA_UINT(g_tearFlagMulligan._h) | GHIDRA_UINT(g_tearFlagLudovico._h) | - GHIDRA_UINT(g_tearFlagHpDrop._h)) & GHIDRA_UINT(hitParams._flags._h)); - local_108.x = (float)(~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMulligan._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._l)) + 0x4)))) & (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams._flags._l)) + 0x4)))); - local_f8.x = (float)(~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMulligan._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._h)) + 0x4)))) & (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams._flags._h)) + 0x4)))); - fVar8 = (float)(~(GHIDRA_UINT(g_tearFlagMulligan._l) | GHIDRA_UINT(g_tearFlagLudovico._l) | - GHIDRA_UINT(g_tearFlagHpDrop._l)) & GHIDRA_UINT(hitParams._flags._l)); - tearDamage = hitParams._tearDamage; - local_140 = fVar8; - fStack_13c = local_108.x; - local_138 = local_fc; - fStack_134 = local_f8.x; - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x95,0); - if (bVar1 != 0) { - fStack_13c = (float)(GHIDRA_UINT(local_108.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._l)) + 0x4)))); - local_140 = (float)(GHIDRA_UINT(fVar8) | GHIDRA_UINT(g_tearFlagExplosive._l)); - local_138 = (float)(GHIDRA_UINT(local_fc) | GHIDRA_UINT(g_tearFlagExplosive._h)); - fStack_134 = (float)(GHIDRA_UINT(local_f8.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._h)) + 0x4)))); - } - tearScale = hitParams._tearScale; - fallingSpeed = -*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1478)); - local_10c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x147c)); - afVar10 = (float [4])ZEXT416(local_10c); - local_12c = (float)hitParams._tearVariant; - uVar7 = hitParams._tearVariant; - goto LAB_0063a552; - } - if ((uVar4 == 0x58) && (this->_state == 2)) { - uVar4 = Random(); - afVar10 = afVar9; - if (uVar4 % 10 == 0) { - local_140 = (float)g_tearFlagCoinDrop._l; - fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCoinDrop._l)) + 0x4))); - local_138 = (float)g_tearFlagCoinDrop._h; - fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCoinDrop._h)) + 0x4))); - goto LAB_0063a54a; - } - } - iVar2 = this->_variant; - if (iVar2 == 0x5c) { - fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); - local_140 = (float)g_tearFlagHoming._l; - fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); - local_138 = (float)g_tearFlagHoming._h; - (GHIDRA_CAST((GHIDRA_CAST(&tmpColor))))->Color::Color(); - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(other); - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - tearDamage = 10.0; - } - else { - tearDamage = 6.0; - } - tearScale = 1.1; - velocityX = velocityX * 0.75; - fallingSpeed = -0.75; - velocityY = velocityY * 0.75; - afVar10 = (float [4])ZEXT416(GHIDRA_UINT(velocityY)); - velocity.x = velocityX; - velocity.y = velocityY; - goto LAB_0063a552; - } - if (iVar2 == 0x4c) { - tearDamage = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)); - goto LAB_0063a552; - } - if (iVar2 == 0x6c) { - local_12c = 1.4013e-45; - pVVar3 = MusicManager::RandomVector(&local_108); - uVar4 = Random(); - fVar8 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10; - fVar12 = fVar8 * pVVar3->y; - fVar8 = fVar8 * pVVar3->x; - velocityX = fVar8 + fVar8 + velocityX; - velocityY = velocityY + fVar12 + fVar12; - velocity.x = velocityX; - velocity.y = velocityY; - uVar4 = Random(); - uVar7 = Random(); - local_10c = GHIDRA_CAST(0x3f000000); - tearScale = tearScale * - ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.05 + ((float)(uVar4 & 1) + 0.0) * 0.4 + 0.9); - uVar4 = Random(); - fallingSpeed = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 15.0 + 5.0; - afVar10 = (float [4])ZEXT416(GHIDRA_UINT(fallingSpeed)); - fallingSpeed = 0.0 - fallingSpeed; - uVar7 = 1; - goto LAB_0063a552; - } - if (iVar2 == 8) { - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)); - if ((iVar2 == 2) || (iVar2 == 0x17)) goto LAB_0063a061; -LAB_0063a140: - if (local_100 != 1.54143e-44) goto LAB_0063a552; - } - else { - if (iVar2 == 0xf4) { -LAB_0063a061: - local_12c = 1.4013e-45; - tearDamage = 7.5; - uVar7 = 1; - goto LAB_0063a552; - } - if (iVar2 == 200) { - tmpColor._tint[2] = 1.0; - tmpColor._tint[0] = 1.0; - tmpColor._tint[1] = 1.0; - tmpColor._tint[3] = 1.0; - tearDamage = 1.5; - tmpColor._colorize[0] = _DAT_00bac850; - tmpColor._colorize[1] = _UNK_00bac854; - tmpColor._colorize[2] = _UNK_00bac858; - tmpColor._colorize[3] = _UNK_00bac85c; - tmpColor._offset[0] = 0.4; - tmpColor._offset[1] = 0.4; - tmpColor._offset[2] = 0.38; - afVar10 = _DAT_00bac850; - (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); - goto LAB_0063a552; - } - if (iVar2 == 0xe1) { - fVar8 = 3.0; - tearDamage = 3.0; - Random(); - FUN_0067af30(); - fallingSpeed = 0.0; - tearScale = fVar8 * 1.25 * tearScale; - (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = ZEXT812(0xbccccccd); - afVar10[3] = 0.0; - local_10c = afVar10[0]; - goto LAB_0063a552; - } - if (iVar2 != 0xd1) goto LAB_0063a140; - } - uVar7 = 0x29; - tearScale = tearScale * 1.1; - afVar10 = (float [4])ZEXT416(GHIDRA_UINT(tearScale)); - local_dc = (float)g_tearFlagIce._l; - local_f8.x = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._l)) + 0x4))); - local_140 = (float)g_tearFlagIce._l; - fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._l)) + 0x4))); - local_12c = 5.74532e-44; - local_fc = (float)g_tearFlagIce._h; - local_108.x = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._h)) + 0x4))); - local_138 = (float)g_tearFlagIce._h; - fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._h)) + 0x4))); - uVar4 = Random(); - if (uVar4 % 10 != 0) goto LAB_0063a552; - local_140 = (float)(GHIDRA_UINT(local_dc) | GHIDRA_UINT(g_tearFlagFreeze._l)); - fStack_13c = (float)(GHIDRA_UINT(local_f8.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._l)) + 0x4)))); - local_138 = (float)(GHIDRA_UINT(local_fc) | GHIDRA_UINT(g_tearFlagFreeze._h)); - fStack_134 = (float)(GHIDRA_UINT(local_108.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._h)) + 0x4)))); - } -LAB_0063a54a: -LAB_0063a552: - if (this->_isLilDelirium != 0) { - if (uVar7 == 0) { - uVar7 = 1; - } - tearColor._colorize[0] = _DAT_00bac940; - tearColor._colorize[1] = _UNK_00bac944; - tearColor._colorize[2] = _UNK_00bac948; - tearColor._colorize[3] = _UNK_00bac94c; - afVar10 = _DAT_00bac940; - local_12c = (float)uVar7; - } - local_108.x = (float)(GHIDRA_UINT(fStack_134) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurstsplit._h)) + 0x4)))); - if ((((GHIDRA_UINT(local_140) & GHIDRA_UINT(g_tearFlagBurstsplit._l)) != 0 || - (GHIDRA_UINT(fStack_13c) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurstsplit._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT(local_138) & GHIDRA_UINT(g_tearFlagBurstsplit._h)) != 0 || - GHIDRA_CAST(local_108.x) != GHIDRA_CAST(0x0))) && - (bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xe9,0), bVar1 == 0)) { - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1474)); - fallingSpeed = ((fVar8 * 0.75) / *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1464))) * (23.75 / -fVar8); - (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = ZEXT812(0x3fa66666); - afVar10[3] = 0.0; - local_10c = afVar10[0]; - } - if (this->_player != GHIDRA_CAST(0x0)) { - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsHologram(); - if (bVar1 != 0) { - afVar10 = (float [4])ZEXT416(GHIDRA_UINT((tearColor._tint[3] * 0.25))); - tearColor._tint[3] = tearColor._tint[3] * 0.25; - } - if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && - (bVar1 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST((extraout_ECX + 0x1618))), bVar1 == 0)) { - FUN_00925df0(); - tearColor._tint[3] = afVar10[0] * tearColor._tint[3]; - } - } - if (((this->_variant == 10) || (local_128 == 1.26117e-44)) || (local_100 == 9.80909e-45)) { - local_128 = 2.8026e-45; - local_f0.x = velocityX - velocityY * 0.2; - local_f0.y = velocityX * 0.2 + velocityY; - local_e8 = velocityY * 0.2 + velocityX; - local_e4 = velocityY - velocityX * 0.2; - tearDamage = tearDamage * (float)local_124; - if (tearScale <= 0.01) { - tearScale = 0.01; - } - local_124 = &local_f0; - do { - pVVar3 = local_124; - uVar4 = Random(); - tear = (Entity_Tear *) - Game::SpawnEx(g_game,2,GHIDRA_UINT(local_12c),&this->_pos,pVVar3,GHIDRA_CAST(this),0,uVar4,0); - uVar4 = Random(); - tear->_fallingSpeed = - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + fallingSpeed; - tear->_fallingAccel = (float)local_10c; - tear->SetCollisionDamage(tearDamage); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x4))) = local_140; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x0))) = tearScale; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x0))) = fStack_13c; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x4))) = local_138; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_01); - tear->_baseScale = tearDamage; - tear->_fScale = tearDamage; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - tear->SetColor(tmpColor._offset + 2,0xffffffff,0xff,0,1); - if (tear->_parent != 0) { - local_108.x = (float)&tear->_parent; - msvc::multiset::erase(&local_108); - } - tear->_parent = this; - msvc::multiset::insert(&tear->_parent); - uVar4 = Random(); - tear->_tearIdx = uVar4 & 1; - TryFireTear(this,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - local_124 = local_124 + 1; - local_128 = (float)(GHIDRA_INT(local_128) + -1); - } while (local_128 != 0.0); - return tear; - } - tearDamage = tearDamage * (float)local_124; - if (tearScale <= 0.01) { - tearScale = 0.01; - } - if (this->_variant != 200) { - uVar4 = Random(); - tear = (Entity_Tear *) - Game::SpawnEx(g_game,2,uVar7,&this->_pos,&velocity,GHIDRA_CAST(this),0,uVar4,0); - uVar4 = Random(); - tear->_fallingSpeed = - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 - * 0.2 + fallingSpeed; - tear->_fallingAccel = (float)local_10c; - tear->SetCollisionDamage(tearDamage); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x4))) = local_140; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x0))) = tearScale; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x0))) = fStack_13c; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = local_138; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_00); - tear->_baseScale = tearDamage; - tear->_fScale = tearDamage; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - if (tear->_parent != 0) { - local_10c = &tear->_parent; - msvc::multiset::erase(&local_10c); - } - tear->_parent = this; - msvc::multiset::insert(&tear->_parent); - tear->SetColor(tmpColor._offset + 2,0xffffffff,0xff,0,1); - uVar4 = Random(); - tear->_tearIdx = uVar4 & 1; - TryFireTear(this,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - return tear; - } - local_124 = GHIDRA_CAST(0x0); - do { - local_128 = ((float)GHIDRA_INT(local_124) / 3.0) * 10.0 - 5.0; - local_108.x = (((float)GHIDRA_INT(local_124) / 3.0) * 180.0 - 90.0) * 0.017453292; - local_fc = cos(local_108.x); - fVar8 = sin(local_108.x); - local_128 = local_128 * 0.017453292; - local_f8.x = (AimDirection->x * local_fc - AimDirection->y * fVar8) * 10.0 + (this->_pos).x; - local_f8.y = (AimDirection->y * local_fc + AimDirection->x * fVar8) * 10.0 + (this->_pos).y; - local_108.x = cos(local_128); - fVar8 = sin(local_128); - velocity.x = velocityX * local_108.x - velocityY * fVar8; - velocity.y = velocityY * local_108.x + velocityX * fVar8; - uVar4 = Random(); - tear = (Entity_Tear *) - Game::SpawnEx(g_game,2,GHIDRA_UINT(local_12c),&local_f8,&velocity,GHIDRA_CAST(this),0,uVar4,0); - uVar4 = Random(); - tear->_fallingSpeed = - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 - * 0.2 + fallingSpeed; - tear->_fallingAccel = (float)local_10c; - tear->SetCollisionDamage(tearDamage); - uVar4 = Random(); - if (uVar4 % 10 == 0) { - fVar8 = tearScale; - fVar12 = local_140; - fVar6 = fStack_13c; - fVar5 = local_138; - } - else { - fVar8 = (float)(GHIDRA_UINT(tearScale) | GHIDRA_UINT(g_tearFlagSlow._l)); - fVar12 = (float)(GHIDRA_UINT(local_140) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4)))); - fVar6 = (float)(GHIDRA_UINT(fStack_13c) | GHIDRA_UINT(g_tearFlagSlow._h)); - fVar5 = (float)(GHIDRA_UINT(local_138) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4)))); - local_f8.y = fVar8; - local_f0.x = fVar12; - local_f0.y = fVar6; - local_e8 = fVar5; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = fVar12; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = fVar8; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = fVar6; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = fVar5; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); - tear->_baseScale = tearDamage; - tear->_fScale = tearDamage; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - tear->SetColor(tmpColor._offset + 2,0xffffffff,0xff,0,1); - if (tear->_parent != 0) { - local_108.x = (float)&tear->_parent; - msvc::multiset::erase(&local_108); - } - tear->_parent = this; - msvc::multiset::insert(&tear->_parent); - uVar4 = Random(); - tear->_tearIdx = uVar4 & 1; - TryFireTear(this,tear); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - local_124 = GHIDRA_CAST((GHIDRA_INT(local_124) + 1)); - } while (GHIDRA_INT(local_124) < 4); - return tear; -} - -// 0063aef0 -Entity_Laser * Entity_Familiar::sprinkler_shoot_laser(float angle, float distance) -{ - Entity_Player *this_00; - Entity_Laser *pEVar1; - uint32_t rngResult; - int iVar2; - float fVar3; - uint8_t auStack_90 [4]; - float distanceLocal; - float angleRad; - float local_84; - Vector laserOffset; - TearParams tearParams; - uint32_t local_c; - bool isSpectral; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_90); - angleRad = angle * 0.017453292; - distanceLocal = distance; - local_84 = angle; - fVar3 = cos(angleRad); - laserOffset.x = fVar3 * distanceLocal + 0.0; - fVar3 = sin(angleRad); - laserOffset.y = fVar3 * distanceLocal - 32.0; - pEVar1 = Entity_Laser::ShootAngle(2,&this->_pos,local_84,3,&laserOffset,GHIDRA_CAST(this),0); - pEVar1->_oneHit = 1; - this_00 = this->_player; - rngResult = Random(); - Entity_Player::GetTearHitParams(this_00,&tearParams,3,1.0,(rngResult & 1) * 2 + -1,GHIDRA_CAST(0x0)); - iVar2 = *GHIDRA_CAST(pEVar1); - *GHIDRA_CAST(&(pEVar1->_tearFlags)._l) = (uint32_t)tearParams._flags._l; - *GHIDRA_CAST((GHIDRA_INT(&(pEVar1->_tearFlags)._l) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearParams._flags._l)) + 0x4))); - *GHIDRA_CAST(&(pEVar1->_tearFlags)._h) = (uint32_t)tearParams._flags._h; - *GHIDRA_CAST((GHIDRA_INT(&(pEVar1->_tearFlags)._h) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearParams._flags._h)) + 0x4))); - (**(code **)(iVar2 + 0x3c))(&tearParams._tearColor,0xffffffff,0xff,0,1); - pEVar1->SetCollisionDamage((*GHIDRA_CAST((GHIDRA_CAST(&(tearParams)) + 0x34)))); - if (((GHIDRA_UINT(tearParams._tearColor._colorize[2]) & GHIDRA_UINT(g_tearFlagSpectral._l)) == 0 && - (GHIDRA_UINT(tearParams._tearColor._colorize[3]) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4)))) == 0) && - ((GHIDRA_UINT(tearParams._tearColor._offset[0]) & GHIDRA_UINT(g_tearFlagSpectral._h)) == 0 && - (GHIDRA_UINT(tearParams._tearColor._offset[1]) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4)))) == 0)) { - isSpectral = false; - } - else { - isSpectral = true; - } - pEVar1->_renderDepthOffset = 3000.0; - iVar2 = 3; - if (isSpectral) { - iVar2 = 6; - } - pEVar1->_entityGridCollisionClass = iVar2; - return pEVar1; -} - -// 0063b340 -void Entity_Familiar::update_idle_anim_by_size() -{ - uint8_t bVar1; - uint8_t *currentName; - uint32_t compareResult; - uint8_t *wantedName; - uint32_t sizeIdx; - bool isLess; - float scaledY; - float targetSize [2]; - uint8_t animName [32]; - uint32_t local_c; - uint8_t *animData; - float baseSize; - - local_c = __security_cookie ^ GHIDRA_UINT(targetSize); - targetSize[0] = - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x15c)) * *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0xe4)) * 100.0; - if (this->_orbitSpeed == targetSize[0]) { - return; - } - sizeIdx = 0; - do { - if (targetSize[0] < (float)(&DAT_00b644a0)[sizeIdx] * 1.5) break; - sizeIdx = sizeIdx + 1; - } while (sizeIdx < 4); - FUN_00652a30(animName,0x20,"Idle%d",sizeIdx); - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - currentName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - currentName = *GHIDRA_CAST(animData); - } - wantedName = animName; - do { - bVar1 = *currentName; - isLess = bVar1 < *wantedName; - if (bVar1 != *wantedName) { -LAB_0063b402: - compareResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_0063b407; - } - if (bVar1 == 0) break; - bVar1 = currentName[1]; - isLess = bVar1 < wantedName[1]; - if (bVar1 != wantedName[1]) goto LAB_0063b402; - currentName = currentName + 2; - wantedName = wantedName + 2; - } while (bVar1 != 0); - compareResult = 0; -LAB_0063b407: - if ((compareResult == 0) && - ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0063b43a; - } - bVar1 = ANM2::SetAnimation(&this->_sprite,animName,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_0063b43a: - baseSize = (float)(&DAT_00b644a0)[sizeIdx]; - scaledY = targetSize[0] * g_vectorOne.y; - (this->_sprite)._scale.x = (targetSize[0] * g_vectorOne.x) / baseSize; - (this->_sprite)._scale.y = scaledY / baseSize; - this->_orbitSpeed = targetSize[0]; - this->_size = targetSize[0]; - return; -} - -// 0063b8b0 -void Entity_Familiar::RemoveFromPlayer(uint8_t UnusedRemoveFamiliar) -{ - uint32_t *_Src; - short *psVar1; - void **ppvVar2; - void *pvVar3; - Entity_Player *this_00; - uint8_t bVar4; - ItemConfig_Item *item; - uint32_t uVar5; - uint32_t familiarFlagBit; - int *piVar6; - uint32_t *puVar7; - uint16_t newCount; - int removedCount; - int iVar8; - RNG local_38; - uint32_t collectibleId; - int removeIndex; - int removeCount; - char isEvaluateNeeded; - int local_18 [5]; - int currentCount; - uint32_t *levelItemsEnd; - Manager *manager; - - local_18[4] = __security_cookie ^ GHIDRA_UINT((local_18 + 5)); - this->Remove(); - manager = g_manager; - item = this->_item; - isEvaluateNeeded = '\0'; - switch(this->_variant) { - case 0x1c: - bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xef,0); - iVar8 = (bVar4 != 0) + 0xee; - goto LAB_0063b918; - case 0x41: - pvVar3 = this->_player; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar3) + 0x1508)))))->TemporaryEffects::HasNullEffect(0x6b); - if (bVar4 != 0) { - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar3) + 0x1508)))))->TemporaryEffects::RemoveNullEffect(0x6b,1); - goto LAB_0063bcad; - } - break; - case 0x66: - local_38._seed = this->_initSeed; - local_38._shift1 = 2; - local_38._shift2 = 0x15; - local_38._shift3 = 9; - local_18[1] = 0x90; - local_18[2] = 0x116; - local_18[3] = 0x184; - uVar5 = (GHIDRA_CAST((&local_38)))->RNG::RandomInt(3); - iVar8 = local_18[uVar5 + 1]; -LAB_0063b918: - item = ItemConfig::GetCollectible(&manager->_itemConfig,iVar8); - isEvaluateNeeded = '\x01'; - break; - case 0x67: - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1382)) + -1; - newCount = 0; - if (0 < iVar8) { - newCount = (short)iVar8; - } - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1382)) = newCount; - goto LAB_0063bcad; - case 0x71: - iVar8 = this->_player->_playerForms[0xc]; - if (iVar8 < 1) { - return; - } - (GHIDRA_CAST((this->_player)))->Entity_Player::IncrementPlayerFormCounter(0xc,-iVar8); - return; - case 0xf4: - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveNullEffect(0x6b,1); - goto LAB_0063bcad; - } - if (item != GHIDRA_CAST(0x0)) { - iVar8 = item->type; - if (((iVar8 == 1) || (iVar8 == 3)) || (iVar8 == 4)) { - uVar5 = item->id; - removeCount = 0; - collectibleId = uVar5; - bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x19d,0); - if ((bVar4 == 0) && (bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x19c,0), bVar4 == 0) - ) { -LAB_0063bb29: - if (uVar5 == 10) { - pvVar3 = (this->_player->_pillEffectUses)._begin; - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x28)); - if (iVar8 < 1) { - bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(10,0); - if (bVar4 == 0) { - iVar8 = 0; - } - else { - iVar8 = 1; - removeCount = 1; - piVar6 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x16d4)) + 0x28)); - *piVar6 = *piVar6 + 1; - } - goto LAB_0063bc53; - } - *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x28)) = iVar8 + -1; - } - else { -LAB_0063bbd4: - if (uVar5 != 0x20d) { - if (uVar5 == 0x49) { - iVar8 = this->_variant + -0x2b; - currentCount = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x153c)); - removedCount = currentCount; - if (iVar8 < currentCount) { - removedCount = iVar8; - } - iVar8 = iVar8 - removedCount; - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x153c)) = currentCount - removedCount; - removeCount = iVar8; - } - else { - familiarFlagBit = 0; - if (uVar5 != 0xcf) goto LAB_0063bad8; - iVar8 = this->_variant + -0x44; - currentCount = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1540)); - removedCount = currentCount; - if (iVar8 < currentCount) { - removedCount = iVar8; - } - iVar8 = iVar8 - removedCount; - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1540)) = currentCount - removedCount; - removeCount = iVar8; - } - goto LAB_0063bc53; - } - psVar1 = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1384)); - *psVar1 = *psVar1 + -1; - } - } - else { - if (GHIDRA_INT(uVar5) < 0x114) { - if (uVar5 == 0x113) { - familiarFlagBit = 0x10; - } - else { - switch(uVar5) { - case 0x62: - familiarFlagBit = 0x100; - break; - default: - goto LAB_0063bb29; - case 0x70: - familiarFlagBit = 0x40; - break; - case 0x71: - familiarFlagBit = 4; - break; - case 0xb2: - familiarFlagBit = 0x80; - break; - case 0x10e: - familiarFlagBit = 1; - } - } - } - else { - switch(uVar5) { - case 0x116: - familiarFlagBit = 2; - break; - default: - goto LAB_0063bbd4; - case 0x168: - familiarFlagBit = 8; - break; - case 0x16b: - familiarFlagBit = 0x200; - break; - case 0x186: - familiarFlagBit = 0x400; - break; - case 0x1a1: - familiarFlagBit = 0x20; - } - } -LAB_0063bad8: - iVar8 = 1; - removeCount = 1; - if (familiarFlagBit != 0) { - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1938)); - if ((familiarFlagBit & uVar5) != 0) { - iVar8 = 0; - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1938)) = uVar5 | familiarFlagBit; - removeCount = 0; - } - } -LAB_0063bc53: - removeIndex = 0; - if (0 < iVar8) { -LAB_0063bc60: - this_00 = this->_player; - if ((this_00->_temporaryeffects)._disabled == 0) { - for (piVar6 = (this_00->_temporaryeffects)._effects._begin; - piVar6 != (this_00->_temporaryeffects)._effects._end; piVar6 = piVar6 + 4) { - if (GHIDRA_CAST(*piVar6) == item) { - if ((item->type == 3) && (item->passiveCache == 0)) goto LAB_0063bdc5; - puVar7 = (this_00->_levelEffectItems)._begin; - levelItemsEnd = (this_00->_levelEffectItems)._end; - if (puVar7 != levelItemsEnd) goto LAB_0063bd00; - break; - } - } - } -LAB_0063bc8b: - (GHIDRA_CAST((this_00)))->Entity_Player::RemoveCollectible(collectibleId,0,0,1); - goto LAB_0063bc9b; - } - } - } - else if (iVar8 == 2) { - uVar5 = item->id; - bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(uVar5,0); - if (bVar4 != 0) { - (GHIDRA_CAST((this->_player)))->Entity_Player::TryRemoveTrinket(uVar5); - } - } - } -LAB_0063bca7: - if (isEvaluateNeeded == '\0') { - return; - } -LAB_0063bcad: - puVar7 = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1574)); - *puVar7 = *puVar7 | 0x200; - (GHIDRA_CAST((this->_player)))->Entity_Player::EvaluateItems(); - return; -LAB_0063bd00: - _Src = puVar7 + 1; - if (*puVar7 != collectibleId) { - puVar7 = _Src; - if (_Src == levelItemsEnd) goto LAB_0063bc8b; - goto LAB_0063bd00; - } - memmove(puVar7,_Src,GHIDRA_INT(levelItemsEnd) - GHIDRA_INT(_Src)); - ppvVar2 = &(this_00->_levelEffectItems)._end; - *ppvVar2 = (void *)(GHIDRA_INT(*ppvVar2) + -4); - uVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173c)) + removeIndex * 4)); - if (g_game == GHIDRA_CAST(0x0)) { - if (GHIDRA_INT(uVar5) < 0) goto LAB_0063bdc5; -LAB_0063bd84: - pvVar3 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar3) >> 2 <= GHIDRA_INT(uVar5)) - goto LAB_0063bdc5; - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + uVar5 * 4)); - } - else { - if (-1 < GHIDRA_INT(uVar5)) goto LAB_0063bd84; - if ((GHIDRA_INT(uVar5) < 0) && - (pvVar3 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar5) < GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar3) >> 2) - ) { - iVar8 = **GHIDRA_CAST((GHIDRA_CAST(pvVar3) + ~uVar5 * 4)); - } - else { - iVar8 = 0; - } - } - if (iVar8 != 0) { - local_18[2] = *GHIDRA_CAST((iVar8 + 0x78)); - local_18[1] = 0; - local_18[3] = 0; - local_18[0] = iVar8; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveEffect(local_18,1); - } -LAB_0063bdc5: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - local_38._shift3 = 0; - local_38._seed = GHIDRA_INT(item); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveEffect(&local_38,1); -LAB_0063bc9b: - removeIndex = removeIndex + 1; - if (removeCount <= removeIndex) goto LAB_0063bca7; - goto LAB_0063bc60; -} - -// 0063c1c0 -void Entity_Familiar::ai_minisaac() -{ - float targetY; - code *pcVar2; - int64_t lVar3; - int64_t lVar4; - Vector *position; - uint8_t bVar5; - char cVar6; - int iVar7; - char *anim; - uint32_t uVar8; - Entity *pEVar9; - int *piVar10; - int unusedArg; - void *pvVar11; - uint32_t uVar12; - uint32_t uVar13; - uint32_t uVar14; - PlayerManager *playerManager; - uint32_t uVar15; - bool bVar16; - float fVar17; - uint64_t timeNs; - uint64_t uVar18; - uint32_t local_e4; - uint32_t spawnSubType; - uint32_t finalSubType; - float local_d8; - uint32_t spawnType; - uint32_t local_d0; - uint32_t spawnVariant; - Game *spawnGame; - float local_c4; - uint32_t local_c0; - int landSound; - int landSound2; - int deathSound; - void *triggerNode; - float local_a8; - Vector particlePos; - uint32_t local_98; - int *erasedSpawnerSlot; - uint32_t subTypeKey; - Entity_Familiar *savedFamiliar; - Vector particleVelocity; - int triggerKeyType; - int triggerKeyVariant; - int anyVariantKeyType; - uint32_t anyVariantKeyVariant; - uint64_t rngShifts; - uint32_t rngShift3; - uint8_t anyVariantFind [4]; - uint8_t itemFindResult [8]; - int itemNode; - RNG cardRng; - char *dirAnims [12]; - Game *game; - Manager *manager; - std_set *spawnTriggerTargets; - uint32_t *spawnerSlot; - ANM2 *sprite; - float targetY; - - dirAnims[4] = "WalkLeft"; - dirAnims[5] = "WalkUp"; - dirAnims[6] = "WalkRight"; - dirAnims[7] = "WalkDown"; - dirAnims[0] = "FlyLeft"; - dirAnims[1] = "FlyUp"; - dirAnims[2] = "FlyRight"; - dirAnims[3] = "FlyDown"; - dirAnims[8] = "HeadLeft"; - dirAnims[9] = "HeadUp"; - dirAnims[10] = "HeadRight"; - dirAnims[0xb] = "HeadDown"; - if (this->_player != (void *)0x0) { - iVar7 = this->_entityGridCollisionClass; - if ((((iVar7 == 0) || (iVar7 == 3)) || (iVar7 == 1)) || (bVar16 = false, iVar7 == 2)) { - bVar16 = true; - } - iVar7 = this->_state; - savedFamiliar = this; - if (iVar7 == 0) { - fVar17 = (this->_targetPosition).x; - targetY = (this->_targetPosition).y; - fVar17 = sqrtf(fVar17 * fVar17 + targetY * targetY); - if (fVar17 <= 0.01) { - iVar7 = 3; - } - else { - targetY = (this->_targetPosition).x; - targetY = (this->_targetPosition).y; - if (ABS(targetY) <= ABS(targetY)) { - iVar7 = GHIDRA_UINT((0.0 <= targetY)) * 2 + 1; - } - else { - iVar7 = 2; - if (targetY < 0.0) { - iVar7 = 0; - } - } - } - sprite = &this->_sprite; - if (bVar16) { - ANM2::Play(sprite,GHIDRA_CAST(dirAnims[iVar7]),0); - if (fVar17 <= 0.5) { - fVar17 = 0.5; - } - if (1.0 <= fVar17) { - fVar17 = 1.0; - } - (this->_sprite)._playbackSpeed = fVar17; - fVar17 = -4.0; - } - else { - if (fVar17 <= 0.01) { - ANM2::SetFrame(sprite,GHIDRA_CAST("WalkDown"),0); - } - else { - ANM2::Play(sprite,GHIDRA_CAST(dirAnims[iVar7 + 4]),0); - if (fVar17 <= 0.5) { - fVar17 = 0.5; - } - if (1.0 <= fVar17) { - fVar17 = 1.0; - } - (this->_sprite)._playbackSpeed = fVar17; - } - fVar17 = 0.0; - } - (this->_posOffset).y = fVar17; - local_d0 = GHIDRA_UINT((6 < this->_fireCooldown)); - if (this->_shootDirection != -1) { - iVar7 = this->_shootDirection; - } - bVar5 = ANM2::SetOverlayAnimation(&this->_sprite,GHIDRA_CAST(dirAnims[iVar7 + 8]),1); - if ((bVar5 != 0) && ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_sprite)._overlayAnimState,(float)GHIDRA_INT(local_d0)); - } - FamiliarHelper::fly_head_pathfind_move(this); - minisaac_find_target(); - minisaac_fire(this); - game = g_game; - if ((((this->_flags & 0x4000) == 0) && (bVar5 = Game::IsPaused(g_game), bVar5 == 0)) && - ((game->_frameCount % 0xf == 0 && (1.0 < this->_health)))) { - this->_health = this->_health - 0.2; - } - } - else if (iVar7 == 1) { - if ((this->_sprite)._animState._animData != (void *)0x0) { - bVar5 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,s_Land); - manager = g_manager; - if (bVar5 != 0) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - landSound = 0x45; - seed_fart_sound_override(&landSound); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(landSound,0.8,2,0,1.0,0.0); - } - if (((this->_sprite)._animState._animData != (void *)0x0) && - (bVar5 = AnimationState::WasEventTriggered(&(this->_sprite)._animState,s_Land), - bVar5 != 0)) { - this->_friction = this->_friction * 0.5; - } - } - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - anim = "TransformFlying"; - if (!bVar16) { - anim = "Transform"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(anim),0); - this->_state = 2; - } - } - else if (iVar7 == 2) { - if ((this->_sprite)._animState._animData != (void *)0x0) { - bVar5 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,s_Land); - manager = g_manager; - if (bVar5 != 0) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - landSound2 = 0x45; - seed_fart_sound_override(&landSound2); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(landSound2,0.8,2,0,1.0,0.0); - } - } - this->_friction = this->_friction * 0.5; - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - this->_state = 0; - this->_entityCollisionClass = 4; - } - } - manager = g_manager; - if (this->_dead != 0) { - deathSound = 0x37; - seed_fart_sound_override(&deathSound); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(deathSound,0.8,2,0,1.8,0.0); - uVar8 = Random(); - position = &this->_pos; - pEVar9 = Game::SpawnEx(g_game,1000,2,position,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); - ANM2::Play(&pEVar9->_sprite,GHIDRA_CAST("Poof_Small"),0); - uVar8 = Random(); - for (local_d0 = (uVar8 & 1) + 1; local_d0 != 0; local_d0 = local_d0 + -1) { - uVar8 = Random(); - local_d8 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_d8 = local_d8 + local_d8; - fVar17 = cos(local_d8); - particlePos.x = fVar17 * this->_size * 0.5 + position->x; - fVar17 = sin(local_d8); - particlePos.y = fVar17 * this->_size * 0.5 + (this->_pos).y; - uVar8 = Random(); - fVar17 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - fVar17 = fVar17 + fVar17; - uVar8 = Random(); - targetY = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 1.0; - local_c4 = cos(fVar17); - local_c4 = local_c4 * targetY; - particleVelocity.x = local_c4; - local_a8 = sin(fVar17); - local_a8 = local_a8 * targetY; - particleVelocity.y = local_a8; - local_d8 = (float)Random(); - spawnGame = g_game; - spawnSubType = 0; - spawnVariant = 5; - spawnType = 1000; - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&spawnType),GHIDRA_CAST(&spawnVariant),&particlePos,&particleVelocity, - GHIDRA_CAST(0x0),GHIDRA_CAST(&spawnSubType),GHIDRA_CAST(&local_d8)); - uVar8 = spawnVariant; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_0063cadf: - finalSubType = spawnSubType; - } - else { - piVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - local_e4 = Random(); - uVar12 = spawnSubType; - rngShifts = 0x900000005; - rngShift3 = 7; - if (spawnType != 5) goto LAB_0063cadf; - if (uVar8 < 0x12d) { - if (uVar8 == 300) { - while ((finalSubType = spawnSubType, spawnSubType == 0 || - (cVar6 = (**(code **)(*piVar10 + 0x24))(spawnSubType), cVar6 != '\0'))) { - if (local_e4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - local_e4 = local_e4 >> ((uint8_t)rngShifts & 0x1f) ^ local_e4; - local_e4 = local_e4 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ local_e4; - local_e4 = local_e4 >> 7 ^ local_e4; - iVar7 = ItemPool::GetCardEx(local_e4,0x19,10,10,1); - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._shift3 = 7; - cardRng._seed = local_e4; - spawnSubType = lua_callback_run_get_card(&cardRng,iVar7,1,1,0); - } - } - else { - if (uVar8 == 0x46) { - local_c0 = spawnSubType >> 0xb; - do { - finalSubType = spawnSubType; - if (spawnSubType != 0) { - pcVar2 = *(code **)(*piVar10 + 0x28); - iVar7 = ItemPool::GetPillEffect - (&g_game->_itemPool,spawnSubType,GHIDRA_CAST(0x0)); - cVar6 = (*pcVar2)(iVar7); - if (cVar6 == '\0') goto LAB_0063cae7; - } - if (local_e4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - local_e4 = local_e4 >> ((uint8_t)rngShifts & 0x1f) ^ local_e4; - local_e4 = local_e4 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ local_e4; - local_e4 = local_e4 >> 7 ^ local_e4; - spawnSubType = ItemPool::GetPill(local_e4); - spawnSubType = spawnSubType | (local_c0 & 1) << 0xb; - } while( true ); - } - if (uVar8 != 100) goto LAB_0063cadf; - finalSubType = spawnSubType; - if (spawnSubType == 0x19) { -LAB_0063c921: - bVar16 = false; - } - else { - subTypeKey = spawnSubType; - msvc::set::find_node(itemFindResult,&subTypeKey); - if (((*GHIDRA_CAST((itemNode + 0xd)) == '\0') && - (*GHIDRA_CAST((itemNode + 0x10)) <= GHIDRA_INT(uVar12))) && (itemNode != piVar10[8])) - goto LAB_0063c921; - bVar16 = true; - } - if ((uVar12 == 0) || (bVar16)) { - spawnSubType = (**(code **)(*piVar10 + 0x84))(0); - finalSubType = spawnSubType; - } - } - } - else { - if (uVar8 != 0x15e) goto LAB_0063cadf; - while ((finalSubType = spawnSubType, spawnSubType == 0 || - (cVar6 = (**(code **)(*piVar10 + 0x2c))(spawnSubType), cVar6 != '\0'))) { - spawnSubType = ItemPool::GetTrinket(&g_game->_itemPool,0); - } - } - } -LAB_0063cae7: - pEVar9 = (GHIDRA_CAST((spawnGame->_entityFactory)))->EntityFactory::Create(spawnType,0); - lVar3 = CONCAT44(local_c0,local_98); - if (pEVar9 == GHIDRA_CAST(0x0)) { - pEVar9 = GHIDRA_CAST(0x0); - } - else { - timeNs = GetTimeNs(); - lVar3 = (timeNs & 0xffffffff) * 0x431bde82; - local_98 = (uint32_t)((uint64_t)lVar3 >> 0x20); - uVar18 = (timeNs >> 0x20) * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar12 = GHIDRA_UINT((uVar18 >> 0x20)); - lVar3 = lVar3 + (uVar18 & 0xffffffff); - local_c0 = GHIDRA_UINT(lVar3); - uVar8 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - lVar3 = (timeNs >> 0x20) * 0x431bde82 + - (uint64_t)CONCAT14(CARRY4(uVar12,uVar8),uVar12 + uVar8); - uVar8 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - uVar12 = GHIDRA_UINT(lVar3) >> 0x12 | uVar8 * 0x4000; - spawnerSlot = &pEVar9->_spawnerEntity; - pEVar9->_spawnerType = 0; - pEVar9->_spawnerVariant = 0; - if (*spawnerSlot != 0) { - erasedSpawnerSlot = spawnerSlot; - msvc::multiset::erase(&erasedSpawnerSlot); - } - iVar7 = *GHIDRA_CAST(pEVar9); - *spawnerSlot = 0; - (pEVar9->_pos).x = particlePos.x; - (pEVar9->_pos).y = particlePos.y; - (pEVar9->_velocity).x = local_c4; - (pEVar9->_velocity).y = local_a8; - (**(code **)(iVar7 + 4))(spawnType,spawnVariant,finalSubType,local_d8); - pvVar11 = spawnGame->_room; - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)) = iVar7 + 1; - pEVar9->_index = iVar7; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar11) + 0x1218)))))->EntityList::AddEntity(pEVar9); - bVar5 = Game::ShouldEraseEnemy(pEVar9); - if (bVar5 != 0) { - Entity::RemoveWithPoof(pEVar9,unusedArg); - } - if ((pEVar9->_exists != 0) && - ((spawnGame->_proceduralItemManager)._proceduralItems._begin != - (spawnGame->_proceduralItemManager)._proceduralItems._end)) { - triggerKeyVariant = pEVar9->_variant; - iVar7 = pEVar9->_type; - spawnTriggerTargets = &(spawnGame->_proceduralItemManager)._spawnTriggerTargets; - triggerKeyType = iVar7; - msvc::map::find(&triggerNode,&triggerKeyType); - if (triggerNode == spawnTriggerTargets->_head) { - anyVariantKeyVariant = 0xffffffff; - anyVariantKeyType = iVar7; - piVar10 = GHIDRA_CAST(std)::map::find(anyVariantFind,&anyVariantKeyType) - ; - triggerNode = (void *)*piVar10; - if (triggerNode == spawnTriggerTargets->_head) goto LAB_0063cd56; - } - uVar15 = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - pvVar11 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar11) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,(uint8_t *) - "PlayerManager::GetPlayer() : There are no players! \n"); - pvVar11 = (playerManager->_playerList)._end; - } - piVar10 = (playerManager->_playerList)._begin; - if (uVar15 < GHIDRA_UINT((GHIDRA_INT(pvVar11) - GHIDRA_INT(piVar10) >> 2))) { - piVar10 = piVar10 + uVar15; - } - trigger_set_dispatch - ((void *)(*piVar10 + 0x1fc8),6,pEVar9,&particlePos,&particleVelocity); - uVar15 = uVar15 + 1; - playerManager = &g_game->_playerManager; - } while (uVar15 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } -LAB_0063cd56: - uVar18 = GetTimeNs(); - local_d8 = (float)(uVar18 >> 0x20); - lVar4 = (uVar18 & 0xffffffff) * 0x431bde82; - local_c4 = (float)((uint64_t)lVar4 >> 0x20); - lVar3 = (uint64_t)GHIDRA_UINT(local_d8) * 0x431bde82; - uVar18 = (uint64_t)GHIDRA_UINT(local_d8) * 0xd7b634db + - ((uVar18 & 0xffffffff) * 0xd7b634db >> 0x20); - uVar13 = GHIDRA_UINT((uVar18 >> 0x20)); - lVar4 = lVar4 + (uVar18 & 0xffffffff); - local_a8 = (float)lVar4; - uVar15 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - lVar4 = lVar3 + (uint64_t)CONCAT14(CARRY4(uVar13,uVar15),uVar13 + uVar15); - uVar14 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - uVar15 = GHIDRA_UINT(lVar4) >> 0x12 | uVar14 * 0x4000; - uVar13 = uVar15 - uVar12; - bVar16 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar13); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar13; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + - (((uVar14 >> 0x12) - (uVar8 >> 0x12)) - GHIDRA_UINT((uVar15 < uVar12))) + GHIDRA_UINT(bVar16); - } - local_c0 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - local_98 = (uint32_t)lVar3; - pEVar9->Update(); - position = &savedFamiliar->_pos; - this = savedFamiliar; - } - } - } - return; -} - -// 0063ce20 -void Entity_Familiar::minisaac_fire() -{ - int iVar1; - uint32_t spawnSeed; - Entity *knifeEntity; - Entity_Knife *this_00; - Vector *pVVar2; - Entity_Tear *tear; - Manager *manager; - float fVar3; - float Volume; - float Pitch; - Vector local_34; - Vector local_2c; - float local_24; - Vector local_20; - Vector shootDir; - Vector normalizedDir; - uint32_t *parentRef; - - if ((-1 < this->_shootDirection) && (this->_fireCooldown < 1)) { - Isaac::GetAxisAlignedUnitVectorFromDir(&shootDir,this->_shootDirection); - if (this->_subtype == 99) { - iVar1 = _get_index_plus_one_if_kind_4_5(); - local_20.x = (float)iVar1 * 0.15 + 1.2; - fVar3 = apply_tear_modifiers(this); - local_24 = (fVar3 * 0.4 + 0.6) * local_20.x; - fVar3 = apply_tear_modifiers(this); - local_2c.x = (fVar3 * 0.25 + 0.75) * 0.7; - spawnSeed = Random(); - local_34.x = (this->_pos).x; - local_34.y = (this->_pos).y; - knifeEntity = Game::SpawnEx(g_game,8,1,&local_34,&g_vectorZero,GHIDRA_CAST(this),4,spawnSeed,0); - this_00 = (Entity_Knife *) - __RTDynamicCast(knifeEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Knife::RTTI_Type_Descriptor,0); - parentRef = &this_00->_parent; - if (this_00->_parent != 0) { - local_20.x = (float)parentRef; - msvc::multiset::erase(&local_20); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - (this_00->_targetPosition).x = 8.0; - (this_00->_targetPosition).y = 0.0; - pVVar2 = Vector::ToCardinal(&local_20,&shootDir); - fVar3 = atan2f(pVVar2->y,pVVar2->x); - (this_00->_posOffset).x = 0.0; - (this_00->_posOffset).y = -8.0; - this_00->_rotation = fVar3 * 57.295776; - this_00->SetCollisionDamage(local_24 + local_24); - fVar3 = local_34.y * g_vectorOne.x; - (this_00->_sprite)._scale.y = local_34.y * g_vectorOne.y; - (this_00->_sprite)._scale.x = fVar3; - (GHIDRA_CAST((this_00)))->Entity_Knife::SetAttackAnimation(); - this_00->Update(); - manager = g_manager; - this->_fireCooldown = 0x14; - seed_fart_sound_override(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x38))); - Pitch = 1.5; - Volume = 0.6; - fVar3 = 3.53127e-43; - } - else { - local_20.x = (this->_velocity).x * 0.5; - local_34.x = (this->_velocity).y * 0.5; - local_2c.x = shootDir.y; - local_24 = shootDir.x; - fVar3 = sqrtf(shootDir.y * shootDir.y + shootDir.x * shootDir.x); - if (fVar3 <= 0.0) { - fVar3 = local_2c.x; - } - else { - local_24 = shootDir.x * (1.0 / fVar3); - fVar3 = local_2c.x * (1.0 / fVar3); - } - local_24 = local_34.x * fVar3 + local_20.x * local_24; - fVar3 = local_20.x; - if (local_24 < 0.0) { - pVVar2 = (GHIDRA_CAST((&shootDir)))->Vector::Normalized(&normalizedDir); - fVar3 = local_20.x - local_24 * pVVar2->x; - local_34.x = local_34.x - local_24 * pVVar2->y; - } - local_2c.x = shootDir.x * 9.0 + fVar3; - local_2c.y = shootDir.y * 9.0 + local_34.x; - iVar1 = _get_index_plus_one_if_kind_4_5(); - local_20.x = (float)iVar1 * 0.15 + 1.2; - fVar3 = apply_tear_modifiers(this); - local_20.x = (fVar3 * 0.4 + 0.6) * local_20.x; - fVar3 = apply_tear_modifiers(this); - local_24 = (fVar3 * 0.25 + 0.75) * 0.5; - spawnSeed = Random(); - tear = (Entity_Tear *) - Game::SpawnEx(g_game,2,0,&this->_pos,&local_2c,GHIDRA_CAST(this),0,spawnSeed,0); - tear->SetCollisionDamage(local_20.x); - if (this->_entityGridCollisionClass == 5) { - fVar3 = -14.0; - } - else { - fVar3 = -18.0; - } - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(fVar3); - fVar3 = local_2c.y * tear->_baseScale; - if (fVar3 <= 0.01) { - fVar3 = 0.01; - } - tear->_baseScale = fVar3; - tear->_fScale = fVar3; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - TryFireTear(this,tear); - tear->Update(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - manager = g_manager; - this->_fireCooldown = 10; - local_24 = 2.14399e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_24)); - Pitch = 1.0; - Volume = 1.0; - fVar3 = local_24; - } - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(fVar3),Volume,2,0,Pitch,0.0); - } - if (0 < this->_fireCooldown) { - this->_fireCooldown = this->_fireCooldown + -1; - } - return; -} - -// 0063dd60 -void Entity_Familiar::minisaac_find_target() -{ - Entity_Player *ownerParent; - Entity_Familiar *familiar; - uint8_t bVar1; - uint32_t frameMod; - Entity *target; - Vector *sideOffset; - Entity_Familiar *in_ECX; - int candidateType; - bool isUpdateFrame; - float fVar2; - float dx; - Vector sideOffsetBuf; - Vector candidatePos; - int *local_28; - Entity_Familiar *local_24; - int *local_20; - float bestScore; - float score; - Entity *bestTarget; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - Game *game; - Entity_NPC *ownerParent; - uint32_t *targetSlot; - - game = g_game; - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af7060; - local_10 = ExceptionList; - ExceptionList = &local_10; - if ((in_ECX->_flags & 0x4000) == 0) { - local_24 = in_ECX; - bVar1 = Game::IsPaused(g_game); - if (bVar1 == 0) { - frameMod = game->_frameCount + in_ECX->_index & 0x80000003; - isUpdateFrame = frameMod == 0; - if (GHIDRA_INT(frameMod) < 0) { - isUpdateFrame = (frameMod - 1 | 0xfffffffc) == 0xffffffff; - } - if (isUpdateFrame) { - targetSlot = &in_ECX->_target; - target = GHIDRA_CAST(*targetSlot); - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(in_ECX->_player) + 0x340)) - (in_ECX->_pos).y; - dx = *GHIDRA_CAST((GHIDRA_CAST(in_ECX->_player) + 0x33c)) - (in_ECX->_pos).x; - fVar2 = sqrtf(fVar2 * fVar2 + dx * dx); - if (800.0 < fVar2) { - if (target != GHIDRA_CAST(0x0)) { - local_20 = targetSlot; - msvc::multiset::erase(&local_20); - } - *targetSlot = 0; - ExceptionList = local_10; - return; - } - if ((target != GHIDRA_CAST(0x0)) && - (bVar1 = (GHIDRA_CAST((target)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar1 != 0)) { - ExceptionList = local_10; - return; - } - if ((in_ECX->_flags & 0x100) == 0) { - local_20 = GHIDRA_CAST(0x0); - bestTarget = GHIDRA_CAST(0x0); - bestScore = 0.0; - local_28 = g_game->_room; - if (local_28[0x499] != 0) { - do { - target = *GHIDRA_CAST((local_28[0x497] + GHIDRA_INT(local_20) * 4)); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (target->_type != 1)) { - candidateType = target->_type; - if (candidateType - 10U < 0x3de) goto LAB_0063dfb5; - } - else { - candidateType = 1; -LAB_0063dfb5: - if ((((target->_entityCollisionClass != 1) && (target->_entityCollisionClass != 0)) - && (target->_isInvicible == 0)) && (target->_dead == 0)) { - bVar1 = (GHIDRA_CAST((target)))->Entity::HasEntityFlags(0x10); - familiar = local_24; - if ((((bVar1 == 0) || (candidateType == 0x322)) || (candidateType == 0x362)) && - ((bVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_24))))->Entity::IsDescendantOf(target), bVar1 == 0 && - ((target->_flags & 0x20000010) == 0)))) { - candidatePos.y = (target->_pos).y; - candidatePos.x = (target->_pos).x; - bVar1 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&familiar->_pos,&candidatePos,3,0,0,0, - GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - score = 0.0; - if (target == GHIDRA_CAST(*targetSlot)) { - score = 100.0; - } - fVar2 = (target->_pos).y - (familiar->_pos).y; - dx = (target->_pos).x - (familiar->_pos).x; - fVar2 = sqrtf(fVar2 * fVar2 + dx * dx); - fVar2 = 100.0 - fVar2; - if (fVar2 <= 0.0) { - fVar2 = 0.0; - } - score = fVar2 + score; - if ((bestScore < score) && - ((sideOffset = FamiliarHelper::fly_head_pick_side_offset - (familiar,&sideOffsetBuf,target), - sideOffset->x != g_vectorZero.x || (sideOffset->y != g_vectorZero.y)))) { - bestScore = score; - bestTarget = target; - } - } - } - } - } - local_20 = GHIDRA_CAST((GHIDRA_INT(local_20) + 1)); - } while (local_20 < GHIDRA_CAST(local_28[0x499])); - } - target = bestTarget; - if (*targetSlot != 0) { - local_28 = targetSlot; - msvc::multiset::erase(&local_28); - } - *targetSlot = target; - if (target == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - } - else { - ownerParent = GHIDRA_CAST(*targetSlot); - if (((ownerParent != GHIDRA_CAST(0x0)) && (ownerParent->_type == 1)) && - (bVar1 = (GHIDRA_CAST((ownerParent)))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)), bVar1 != 0)) { - if (*targetSlot != 0) { - local_20 = targetSlot; - msvc::multiset::erase(&local_20); - } - *targetSlot = 0; - } - if ((in_ECX->_flags & 0x4000) != 0) { - ExceptionList = local_10; - return; - } - if (*targetSlot != 0) { - ExceptionList = local_10; - return; - } - ownerParent = *GHIDRA_CAST((GHIDRA_CAST(in_ECX->_player) + 0x3bc)); - if (ownerParent == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(ownerParent))))->Entity::IsEnemy(); - if (bVar1 == 0) { - ExceptionList = local_10; - return; - } - target = (GHIDRA_CAST((ownerParent)))->Entity_NPC::GetPlayerTarget(); - fVar2 = (in_ECX->_pos).y - (target->_pos).y; - dx = (in_ECX->_pos).x - (target->_pos).x; - fVar2 = sqrtf(fVar2 * fVar2 + dx * dx); - if (300.0 < fVar2) { - ExceptionList = local_10; - return; - } - if (*targetSlot != 0) { - local_20 = targetSlot; - msvc::multiset::erase(&local_20); - } - *targetSlot = target; - } - msvc::multiset::insert(targetSlot); - } - } - } - ExceptionList = local_10; - return; -} - -// 0063f9f0 -void Entity_Familiar::ai_blood_oath() -{ - Entity_Familiar *animState = this; - uint8_t bVar1; - char isDamaged; - uint32_t uVar2; - uint32_t subType; - Entity *bloodParticle; - uint8_t *animName; - uint32_t uVar3; - int extraout_ECX; - uint8_t *stabAnimName; - int extraout_EDX; - int iVar4; - bool bVar5; - float fVar6; - code *pcStack_74; - Vector VStack_70; - float fStack_68; - Vector VStack_64; - Vector pickupVelocity; - EntityRef damageSource; - Vector local_2c; - uint8_t *local_24; - char *local_20; - Vector local_1c; - uint32_t uStack_14; - uint32_t uStack_10; - uint32_t local_c; - AnimationState *animState; - Manager *manager; - float playerY; - float posY; - - local_c = __security_cookie ^ GHIDRA_UINT(&pcStack_74); - local_2c.x = (float)s_Idle; - local_1c.x = 0.0; - local_1c.y = 0.0; - uStack_14 = 10; - uStack_10 = 4; - iVar4 = 0; - local_2c.y = (float)s_Idle2; - local_24 = &DAT_00b1d43c; - local_20 = "Idle4"; - fVar6 = (float)animState->_hearts / 23.0; - if (fVar6 <= 0.5) { - if (fVar6 <= 0.25) { - if (0.0 < fVar6) { - iVar4 = 1; - } - } - else { - iVar4 = 2; - } - } - else { - iVar4 = 3; - } - switch(animState->_state) { - case 0: - animState->_state = 3; - case 3: - ANM2::Play(&animState->_sprite,GHIDRA_CAST((&local_2c.x)[iVar4]),0); - fVar6 = (&local_1c.x)[iVar4]; - if ((fVar6 != 0.0) && (uVar3 = Random(), uVar3 % GHIDRA_UINT(fVar6) == 0)) { - uVar3 = Random(); - Entity_NPC::MakeSplat - (GHIDRA_CAST(animState), - (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.2); - } - break; - default: - goto LAB_0064001c; - case 4: - ANM2::Play(&animState->_sprite,&DAT_00b643e8,0); - animState = &(animState->_sprite)._animState; - fVar6 = animState->_friction; - playerY = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); - posY = (animState->_pos).y; - (animState->_velocity).x = (*GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)) - (animState->_pos).x) / fVar6; - (animState->_velocity).y = (playerY - posY) / fVar6; - if ((animState->_sprite)._animState._animData == (void *)0x0) { - return; - } - bVar1 = AnimationState::IsEventTriggered(animState,&DAT_00b1d3b0); - manager = g_manager; - if (bVar1 == 0) { - if ((animState->_sprite)._animState._animData == (void *)0x0) { - return; - } - bVar1 = AnimationState::IsEventTriggered(animState,&DAT_00b602f0); - if (bVar1 == 0) { - return; - } - animState->_state = 5; - return; - } - pcStack_74 = (code *)0x4d; - seed_fart_sound_override(GHIDRA_CAST(&pcStack_74)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(pcStack_74),1.0,2,0,1.0,0.0); - bVar1 = (GHIDRA_CAST((animState->_player)))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)); - if (bVar1 != 0) { - return; - } - iVar4 = (GHIDRA_CAST((animState->_player)))->Entity_Player::GetHealthType(); - VStack_70.x = 0.0; - if (extraout_EDX < 1) { - VStack_70.x = (float)(2 - GHIDRA_UINT((iVar4 != 3))); - } - fStack_68 = (float)(*GHIDRA_CAST((extraout_ECX + 0x1344)) - GHIDRA_INT(VStack_70.x)); - iVar4 = 0; - animState->_hearts = 0; - if (0 < GHIDRA_INT(fStack_68)) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x1344)) <= GHIDRA_INT(VStack_70.x)) break; - *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x13bc)) = 0; - damageSource._position.x = (animState->_pos).x; - damageSource._position.y = (animState->_pos).y; - damageSource._velocity.x = (animState->_velocity).x; - pcStack_74 = *(code **)(*GHIDRA_CAST(animState->_player) + 0x20); - damageSource._type = animState->_type; - damageSource._variant = animState->_variant; - damageSource._spawnerType = animState->_spawnerType; - damageSource._spawnerVariant = animState->_spawnerVariant; - damageSource._velocity.y = (animState->_velocity).y; - if ((animState->_flags & 0x20000000) == 0) { - uVar3 = 0; - } - else { - uVar3 = 2; - } - if ((animState->_flags & 0x40000000000000) == 0) { - uVar2 = 0; - } - else { - uVar2 = 4; - } - damageSource._flags = uVar2 | uVar3 | GHIDRA_UINT(((animState->_flags & 0x100) != 0)); - damageSource._entity = animState; - isDamaged = (*pcStack_74)(0x3f800000,0x2042821,0,&damageSource,0x1e); - if (isDamaged == '\0') break; - animState->_hearts = animState->_hearts + 1; - iVar4 = iVar4 + 1; - } while (iVar4 < GHIDRA_INT(fStack_68)); - } - if (0 < animState->_hearts) { - VStack_64.x = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)); - VStack_64.y = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); - Isaac::GetRandomPickupVelocity(&pickupVelocity,&VStack_64,0,GHIDRA_CAST(0x0)); - fStack_68 = pickupVelocity.x + pickupVelocity.x; - VStack_64.y = pickupVelocity.y + pickupVelocity.y; - VStack_64.x = fStack_68; - pickupVelocity.x = VStack_64.y; - uVar3 = Random(); - VStack_70.x = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)); - VStack_70.y = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); - Game::SpawnEx(g_game,1000,2,&VStack_70,&VStack_64,GHIDRA_CAST(0x0),3,uVar3,0); - uVar3 = Random(); - uVar2 = Random(); - iVar4 = 0; - VStack_64.x = (float)(uVar3 % 3 + 8 + uVar2 % 6); - if (VStack_64.x != 0.0) { - do { - uVar2 = Random(); - VStack_70.x = ((float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) - * 2.3283064e-10 * 20.0 - 10.0) * 0.017453292; - pcStack_74 = (code *)cos(VStack_70.x); - VStack_70.x = sin(VStack_70.x); - uVar2 = Random(); - local_1c.y = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10; - local_1c.x = (fStack_68 * (float)pcStack_74 - pickupVelocity.x * VStack_70.x) * local_1c.y - ; - local_1c.y = (fStack_68 * VStack_70.x + pickupVelocity.x * (float)pcStack_74) * local_1c.y - ; - local_2c.x = local_1c.x + *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)); - local_2c.y = local_1c.y + *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); - uVar2 = Random(); - subType = 99; - if (iVar4 < GHIDRA_INT((uVar3 % 3 + 2))) { - subType = 0; - } - bloodParticle = - Game::SpawnEx(g_game,1000,5,&local_2c,&local_1c,GHIDRA_CAST(0x0),subType,uVar2,0); - bloodParticle->Update(); - iVar4 = iVar4 + 1; - } while (iVar4 < GHIDRA_INT(VStack_64.x)); - } - bVar1 = (GHIDRA_CAST((animState->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar1 != 0) { - animState->_hearts = animState->_hearts + 4; - } - } - FUN_00640050(); - return; - case 5: - if (((animState->_sprite)._animState._animData != (void *)0x0) && - ((animState->_sprite)._animState._isPlaying == 0)) { - animName = (animState->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((animName + 0x14))) { - animName = *GHIDRA_CAST(animName); - } - stabAnimName = &DAT_00b643e8; - do { - bVar1 = *animName; - bVar5 = bVar1 < *stabAnimName; - if (bVar1 != *stabAnimName) { -LAB_00640002: - uVar3 = -GHIDRA_UINT(bVar5) | 1; - goto LAB_00640007; - } - if (bVar1 == 0) break; - bVar1 = animName[1]; - bVar5 = bVar1 < stabAnimName[1]; - if (bVar1 != stabAnimName[1]) goto LAB_00640002; - animName = animName + 2; - stabAnimName = stabAnimName + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_00640007: - if (uVar3 == 0) { - animState->_state = 3; - } - } - } - FollowParent(animState); -LAB_0064001c: - return; -} - -// 006402f0 -void Entity_Familiar::paschal_candle_sync_effects() -{ - Entity_Player *this_00; - int i; - int candleEffect [5]; - void *collectiblesBegin; - - collectiblesBegin = (g_manager->_itemConfig)._collectibles._begin; - this_00 = this->_player; - if ((0x8dc < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectiblesBegin) & - 0xfffffffcU))) && - (candleEffect[0] = *GHIDRA_CAST((GHIDRA_CAST(collectiblesBegin) + 0x8dc)), candleEffect[0] != 0)) { - candleEffect[2] = *GHIDRA_CAST((candleEffect[0] + 0x78)); - candleEffect[1] = 0; - candleEffect[3] = 0; - (GHIDRA_CAST((&this_00->_temporaryeffects)))->TemporaryEffects::RemoveEffect(candleEffect,-1); - this_00 = this->_player; - } - collectiblesBegin = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectiblesBegin) & 0xfffffffcU)) - < 0x8dd) { - candleEffect[0] = 0; - } - else { - candleEffect[0] = *GHIDRA_CAST((GHIDRA_CAST(collectiblesBegin) + 0x8dc)); - } - i = 1; - candleEffect[3] = 0; - candleEffect[1] = 1; - candleEffect[2] = 0; - if (1 < this->_hearts) { - do { - TemporaryEffects::AddEffect - (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),candleEffect,1,1); - i = i + 1; - } while (i < this->_hearts); - this_00 = this->_player; - } - (GHIDRA_CAST((this_00)))->Entity_Player::EvaluateItems(); - return; -} - -// 00640ca0 -void Entity_Familiar::ai_boiled_baby() -{ - int direction; - uint8_t bVar1; - int *piVar2; - int iVar3; - Vector *pVVar4; - uint32_t uVar5; - uint8_t *animNameChar; - uint8_t *wantedAnimChar; - char *shootAnimChar; - bool bVar6; - float fVar7; - float fVar8; - float fVar9; - float jumpProgress; - float *frictionPtr; - Vector local_2c; - Vector local_24; - Vector local_1c; - Room *room; - Vector local_10; - float friction; - void *player; - - room = g_game->_room; - player = this->_player; - if (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x1519)) == '\0') { - for (piVar2 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x150c)); piVar2 != *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1510)); - piVar2 = piVar2 + 4) { - if ((*GHIDRA_CAST(*piVar2) == 0) && ((GHIDRA_CAST(*piVar2))[1] == 0x37)) { - iVar3 = this->_state; - piVar2 = &this->_state; - if (iVar3 == 0) { - this->_visible = 1; - *piVar2 = 1; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - this->_coins = 0; - this->_keys = 1; - uVar5 = Random(); - this->_hearts = (uVar5 & 3) + 2; - iVar3 = *piVar2; - } - frictionPtr = &this->_friction; - *frictionPtr = this->_friction * 0.7; - local_24.x = (float)frictionPtr; - if (iVar3 == 0) goto LAB_00640d22; - if (iVar3 == 1) { - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) goto LAB_00641131; - animNameChar = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((animNameChar + 0x14))) { - animNameChar = *GHIDRA_CAST(animNameChar); - } - shootAnimChar = "Shoot"; - goto LAB_00641000; - } - if (((iVar3 != 2) || - (ANM2::Play(&this->_sprite,&DAT_00b1de1c,0), - (this->_sprite)._animState._animData == (void *)0x0)) || - ((this->_sprite)._animState._isPlaying != 0)) goto LAB_00640d9b; - animNameChar = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((animNameChar + 0x14))) { - animNameChar = *GHIDRA_CAST(animNameChar); - } - wantedAnimChar = &DAT_00b1de1c; - goto LAB_00640f80; - } - } - } - this->_state = 0; - this->_friction = this->_friction * 0.7; -LAB_00640d22: - frictionPtr = &this->_friction; - this->_visible = 0; - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - (this->_pos).y = fVar8; - if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) == '\0') { - iVar3 = this->_fireCooldown; - if (0 < iVar3) { - iVar3 = iVar3 + -1; - this->_fireCooldown = iVar3; - } - direction = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)); - if ((direction != -1) && (iVar3 < 1)) { - bVar1 = 0; - pVVar4 = Isaac::GetAxisAlignedUnitVectorFromDir(&local_10,direction); - FireProjectile(this,pVVar4,bVar1); - this->_fireCooldown = 0x2d; - } - } - goto LAB_00640d9b; - while( true ) { - bVar1 = animNameChar[1]; - bVar6 = bVar1 < (uint8_t)shootAnimChar[1]; - if (bVar1 != shootAnimChar[1]) goto LAB_00641020; - animNameChar = animNameChar + 2; - shootAnimChar = shootAnimChar + 2; - if (bVar1 == 0) break; -LAB_00641000: - bVar1 = *animNameChar; - bVar6 = bVar1 < (uint8_t)*shootAnimChar; - if (bVar1 != *shootAnimChar) { -LAB_00641020: - uVar5 = -GHIDRA_UINT(bVar6) | 1; - goto LAB_00641025; - } - if (bVar1 == 0) break; - } - uVar5 = 0; -LAB_00641025: - if (((uVar5 == 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - ((this->_sprite)._animState._isPlaying != 0)) { - bVar1 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("Shoot")); - frictionPtr = GHIDRA_CAST(local_24.x); - if (bVar1 != 0) { - iVar3 = this->_target; - if (iVar3 != 0) { - fVar8 = *GHIDRA_CAST((iVar3 + 0x33c)); - local_10.x = *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = (this->_pos).x - fVar8; - fVar7 = (this->_pos).y - local_10.x; - fVar7 = sqrtf(fVar7 * fVar7 + fVar9 * fVar9); - local_1c.x = (*GHIDRA_CAST((this->_target + 0x360)) * fVar7 * 0.075 + fVar8) - (this->_pos).x; - local_1c.y = (*GHIDRA_CAST((this->_target + 0x364)) * fVar7 * 0.075 + local_10.x) - - (this->_pos).y; - (GHIDRA_CAST((&local_1c)))->Vector::Normalized(&local_10); - FireProjectile(this,&local_10,1); - frictionPtr = GHIDRA_CAST(local_24.x); - } - } - } - else { -LAB_00641131: - ANM2::Play(&this->_sprite,s_Idle,0); - } - if ((this->_keys < 1) && (this->_target == 0)) { - PickEnemyTarget(this,1000.0,1,9,&g_vectorZero,15.0); - } - if ((((GHIDRA_CAST(this->_target) == GHIDRA_CAST(0x0)) || - ((bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar1 == 0 && - (*GHIDRA_CAST((this->_target + 0x28)) != 1)))) || (this->_hearts < 1)) || - (fVar8 = (this->_pos).y - *GHIDRA_CAST((this->_target + 0x340)), - fVar7 = (this->_pos).x - *GHIDRA_CAST((this->_target + 0x33c)), - fVar8 = sqrtf(fVar8 * fVar8 + fVar7 * fVar7), 180.0 <= fVar8)) { -LAB_0064122e: - bVar6 = false; - } - else { - local_10.x = *GHIDRA_CAST((this->_target + 0x33c)); - local_10.y = *GHIDRA_CAST((this->_target + 0x340)); - bVar1 = (GHIDRA_CAST((room)))->Room::CheckLine(&this->_pos,&local_10,3,999,0,0,GHIDRA_CAST(0x0)); - if (bVar1 == 0) goto LAB_0064122e; - bVar6 = true; - } - iVar3 = this->_keys; - if ((iVar3 < 1) && (bVar6)) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Shoot"),0); - this->_hearts = this->_hearts + -1; - this->_keys = 0xf; - this->_coins = 0x14; - } - else if (this->_coins < 1) { - PickEnemyTarget(this,1000.0,1,9,&g_vectorZero,15.0); - iVar3 = this->_target; - if (iVar3 == 0) { - fVar8 = 80.0; - local_24.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_2c.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - } - else { - fVar8 = (this->_pos).y - *GHIDRA_CAST((iVar3 + 0x340)); - fVar7 = (this->_pos).x - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar7 * fVar7); - local_10.x = *GHIDRA_CAST((iVar3 + 0x360)) * fVar8 * 0.08 + *GHIDRA_CAST((iVar3 + 0x33c)); - local_1c.x = *GHIDRA_CAST((iVar3 + 0x364)) * fVar8 * 0.08 + *GHIDRA_CAST((iVar3 + 0x340)); - local_24.x = local_10.x - (this->_pos).x; - local_24.y = local_1c.x - (this->_pos).y; - pVVar4 = (GHIDRA_CAST((&local_24)))->Vector::Normalized(&local_2c); - fVar8 = 10.0; - local_24.x = pVVar4->x * 60.0 + local_10.x; - local_2c.x = pVVar4->y * 60.0 + local_1c.x; - } - fVar9 = (this->_pos).x - local_24.x; - fVar7 = (this->_pos).y - local_2c.x; - local_1c.x = fVar8; - local_10.x = local_24.x; - local_10.y = local_2c.x; - fVar8 = sqrtf(fVar7 * fVar7 + fVar9 * fVar9); - if (180.0 < fVar8) { - local_24.x = local_24.x - (this->_pos).x; - local_24.y = local_2c.x - (this->_pos).y; - pVVar4 = (GHIDRA_CAST((&local_24)))->Vector::Normalized(&local_2c); - local_10.x = pVVar4->x * 180.0 + (this->_pos).x; - local_10.y = pVVar4->y * 180.0 + (this->_pos).y; - } - pVVar4 = Room::FindFreePickupSpawnPosition(room,&local_1c,&local_10,local_1c.x,1,0,0); - (this->_targetPosition).x = pVVar4->x; - (this->_targetPosition).y = pVVar4->y; - this->_orbitSpeed = 0.0; - *piVar2 = 2; - } - else { - if (0 < iVar3) { - this->_keys = iVar3 + -1; - } - this->_coins = this->_coins + -1; - } - goto LAB_00640d9b; - while( true ) { - bVar1 = animNameChar[1]; - bVar6 = bVar1 < wantedAnimChar[1]; - if (bVar1 != wantedAnimChar[1]) goto LAB_00640fa0; - animNameChar = animNameChar + 2; - wantedAnimChar = wantedAnimChar + 2; - if (bVar1 == 0) break; -LAB_00640f80: - bVar1 = *animNameChar; - bVar6 = bVar1 < *wantedAnimChar; - if (bVar1 != *wantedAnimChar) { -LAB_00640fa0: - uVar5 = -GHIDRA_UINT(bVar6) | 1; - goto LAB_00640fa5; - } - if (bVar1 == 0) break; - } - uVar5 = 0; -LAB_00640fa5: - if (uVar5 == 0) { - *piVar2 = 1; - this->_coins = 5; - uVar5 = Random(); - this->_hearts = (uVar5 & 3) + 2; - } -LAB_00640d9b: - iVar3 = this->_state; - if (((iVar3 != 0) && - (((this->_targetPosition).x != g_vectorZero.x || ((this->_targetPosition).y != g_vectorZero.y) - ))) && ((iVar3 == 1 || - (((iVar3 == 2 && ((this->_sprite)._animState._animData != (void *)0x0)) && - (bVar1 = AnimationState::WasEventTriggered(&(this->_sprite)._animState,s_Jump), - bVar1 != 0)))))) { - jumpProgress = this->_orbitSpeed + 0.02; - this->_orbitSpeed = jumpProgress; - fVar8 = (this->_pos).x; - fVar7 = (this->_pos).y; - fVar9 = (this->_targetPosition).y; - friction = *frictionPtr; - (this->_velocity).x = - ((((this->_targetPosition).x - fVar8) * jumpProgress + fVar8) - fVar8) / *frictionPtr; - (this->_velocity).y = (((fVar9 - fVar7) * jumpProgress + fVar7) - fVar7) / friction; - if (1.0 <= this->_orbitSpeed) { - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - } - } - return; -} - -// 006414c0 -void Entity_Familiar::zhl_misfit_006414c0() -{ - uint32_t *puVar1; - ANM2 *pAVar2; - uint8_t rainbowBlue; - float *damageEvent; - Entity_Player *player; - uint32_t uVar4; - uint8_t *pbVar5; - int iVar6; - uint32_t moveRoll; - Vector *randomDir; - Entity_Effect *splat; - Entity *spawnedEffect; - uint8_t *pbVar7; - uint8_t *expectedNameCh; - bool bVar8; - float fVar9; - int *piVar10; - int *local_4c; - Vector local_48; - float local_40; - int *local_3c; - Vector local_38; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t uStack_28; - uint32_t uStack_24; - float fStack_20; - float fStack_1c; - float fStack_18; - float fStack_14; - uint32_t uStack_10; - uint32_t uStack_c; - float *damageEventsEnd; - float dipX; - float dipY; - Game *game; - Manager *manager; - int oldHallowedCountdown; - float playerIdx; - uint8_t rainbowBlue; - - local_40 = 1.0; - this->_entityGridCollisionClass = 5; - this->_entityCollisionClass = 4; - if (0.0 < this->_pendingDamage) { - this->_pendingDamage = 0.0; - damageEventsEnd = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); - for (damageEvent = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); damageEvent != damageEventsEnd; - damageEvent = damageEvent + 0xe) { - playerIdx = *damageEvent; - if ((GHIDRA_UINT(damageEvent[2]) & 4) != 0) { - if (3.5 < playerIdx) { - playerIdx = 3.5; - } - *damageEvent = playerIdx; - } - this->_pendingDamage = playerIdx + this->_pendingDamage; - } - } - game = g_game; - switch(this->_subtype) { - case 1: - uVar4 = Random(); - if (uVar4 % 3 == 0) { - PickEnemyTarget(this,240.0,4,0,&g_vectorZero,15.0); - } - break; - case 3: - local_40 = 0.8; - break; - case 4: - if ((((this->_flags & 0x4000) == 0) && (rainbowBlue = Game::IsPaused(g_game), rainbowBlue == 0)) && - ((~(uint8_t)game->_frameCount & 1) != 0)) { - uVar4 = Random(); - uVar4 = uVar4 % 6; - rainbowBlue = (&DAT_00b64475)[uVar4 * 3]; - rainbowBlue = (&DAT_00b64476)[uVar4 * 3]; - (this->_splatColor)._offset[0] = (float)(uint8_t)(&DAT_00b64474)[uVar4 * 3] * 0.003921569; - (this->_splatColor)._offset[1] = (float)rainbowBlue * 0.003921569; - (this->_splatColor)._offset[2] = (float)rainbowBlue * 0.003921569; - } - break; - case 6: - if ((((this->_flags & 0x4000) == 0) && (rainbowBlue = Game::IsPaused(g_game), rainbowBlue == 0)) && - (game->_frameCount % 3 == 0)) { - local_48.x = 0.0; - playerIdx = 0.0; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - local_48.x = playerIdx; - player = Game::GetPlayer(g_game,GHIDRA_UINT(local_48.x)); - if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || - (rainbowBlue = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(GHIDRA_CAST(player)), rainbowBlue != 0)) && - (playerIdx = (this->_pos).y - (player->_pos).y, - fVar9 = (this->_pos).x - (player->_pos).x, - playerIdx = sqrtf(playerIdx * playerIdx + fVar9 * fVar9), - playerIdx < player->_size + 23.33)) { - oldHallowedCountdown = player->_hallowedGroundCountdown; - iVar6 = oldHallowedCountdown + 4; - if (4 < iVar6) { - iVar6 = 4; - } - player->_hallowedGroundCountdown = iVar6; - if (0 < oldHallowedCountdown != 0 < iVar6) { - player->_cacheFlags = player->_cacheFlags | 99; - (GHIDRA_CAST((player)))->Entity_Player::EvaluateItems(); - } - } - local_48.x = (float)(GHIDRA_INT(local_48.x) + 1); - playerIdx = local_48.x; - } while (GHIDRA_UINT(local_48.x) < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - } - puVar1 = &this->_child; - if (this->_child == 0) { - uVar4 = Random(); - local_48.x = (float)Game::SpawnEx(g_game,1000,0x70,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar4,0); - local_3c = &(GHIDRA_CAST(local_48.x))->_parent; - if ((GHIDRA_CAST(local_48.x))->_parent != 0) { - local_4c = local_3c; - msvc::multiset::erase(&local_4c); - } - *local_3c = GHIDRA_INT(this); - msvc::multiset::insert(local_3c); - playerIdx = (GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x33c)))->x; - fVar9 = (GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x33c)))->y; - dipX = (this->_pos).x; - dipY = (this->_pos).y; - iVar6 = *GHIDRA_CAST(local_48.x); - ((GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x410)))->_sprite)._filename._buf[0xc] = '\x01'; - ((GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x48)))->_offset).x = 0.0; - ((GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x410)))->_sprite)._filename._size = GHIDRA_UINT((playerIdx - dipX)); - ((GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x410)))->_sprite)._filename._capacity = GHIDRA_UINT((fVar9 - dipY)); - ((GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x48)))->_offset).y = -8.0; - playerIdx = g_vectorOne.y; - fVar9 = g_vectorOne.x * 0.33; - *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x354)) = 10000; - ((GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x48)))->_scale).x = fVar9; - ((GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x48)))->_scale).y = playerIdx * 0.33; - (**(code **)(iVar6 + 0xc))(); - if (*puVar1 != 0) { - local_3c = puVar1; - msvc::multiset::erase(&local_3c); - } - *puVar1 = local_48.x; - msvc::multiset::insert(puVar1); - } - } - if ((this->_subtype != 1) && (uVar4 = Random(), uVar4 % 10 == 0)) { - PickEnemyTarget(this,40.0,4,0,&g_vectorZero,15.0); - } - if (this->_target == 0) { - this->_headFrameDelay = 0; - } - iVar6 = this->_state; - if (iVar6 == 0) { - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 == GHIDRA_CAST(0x0)) { -LAB_00641d0e: - rainbowBlue = ANM2::SetAnimation(&this->_sprite,s_Idle,1); - if (rainbowBlue != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - pbVar7 = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar7 = *GHIDRA_CAST(pbVar5); - } - expectedNameCh = s_Idle; - do { - rainbowBlue = *pbVar7; - bVar8 = rainbowBlue < *expectedNameCh; - if (rainbowBlue != *expectedNameCh) { -LAB_00641cf0: - uVar4 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_00641cf5; - } - if (rainbowBlue == 0) break; - rainbowBlue = pbVar7[1]; - bVar8 = rainbowBlue < expectedNameCh[1]; - if (rainbowBlue != expectedNameCh[1]) goto LAB_00641cf0; - pbVar7 = pbVar7 + 2; - expectedNameCh = expectedNameCh + 2; - } while (rainbowBlue != 0); - uVar4 = 0; -LAB_00641cf5: - if ((uVar4 != 0) || ((pbVar5[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_00641d0e; - } - uVar4 = 10; - if (this->_subtype == 0xc) { - uVar4 = 0x14; - } - else if (this->_subtype == 0xd) { - uVar4 = 3; - } - moveRoll = Random(); - if ((moveRoll % uVar4 == 0) && (this->_visible != 0)) { - puVar1 = &this->_target; - if ((this->_subtype != 1) && - (((*puVar1 != 0 && (this->_headFrameDelay == 0)) && (uVar4 = Random(), (uVar4 & 3) == 0)))) - { - if (*puVar1 != 0) { - local_3c = puVar1; - msvc::multiset::erase(&local_3c); - } - *puVar1 = 0; - } - local_48.x = (float)*puVar1; - if ((void *)local_48.x == (void *)0x0) { - local_48.x = (float)this->_player; - } - playerIdx = local_48.x; - local_38.y = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x340)); - local_38.x = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x33c)); - rainbowBlue = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&this->_pos,&local_38,1,999,0,0,GHIDRA_CAST(0x0)); - if (rainbowBlue == 0) { - local_38.x = this->_friction; - local_3c = GHIDRA_CAST((this->_velocity).x); - local_4c = GHIDRA_CAST((this->_velocity).y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Reset(); - local_48.y = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x340)); - local_48.x = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x33c)); - PathFinder::FindGridPath(GHIDRA_CAST(&this->_pathfinder),&local_48,1.0,0,1); - playerIdx = (this->_velocity).x; - fVar9 = (this->_pos).y + (this->_velocity).y; - (this->_velocity).x = (float)local_3c; - (this->_velocity).y = (float)local_4c; - this->_friction = local_38.x; - piVar10 = GHIDRA_CAST((playerIdx + (this->_pos).x)); - } - else { - piVar10 = *GHIDRA_CAST((GHIDRA_CAST(playerIdx) + 0x33c)); - fVar9 = *GHIDRA_CAST((GHIDRA_CAST(playerIdx) + 0x340)); - local_4c = piVar10; - local_48.x = fVar9; - if ((void *)playerIdx == this->_player) { - randomDir = MusicManager::RandomVector(&local_38); - uVar4 = Random(); - playerIdx = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 80.0; - fVar9 = local_48.x + playerIdx * randomDir->y; - piVar10 = GHIDRA_CAST(((float)local_4c + playerIdx * randomDir->x)); - } - else if (this->_subtype == 1) { - local_40 = 2.0; - } - } - playerIdx = (this->_pos).x; - if ((playerIdx == (float)piVar10) && ((this->_pos).y == fVar9)) { - uVar4 = Random(); - local_38.x = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_38.x = local_38.x + local_38.x; - local_48.x = sin(local_38.x); - local_4c = GHIDRA_CAST(cos(local_38.x)); - } - else { - local_48.x = fVar9 - (this->_pos).y; - local_4c = GHIDRA_CAST(((float)piVar10 - playerIdx)); - playerIdx = sqrtf((float)local_4c * (float)local_4c + local_48.x * local_48.x); - if (0.0 < playerIdx) { - local_4c = GHIDRA_CAST(((float)local_4c * (1.0 / playerIdx))); - local_48.x = local_48.x * (1.0 / playerIdx); - } - } - uVar4 = Random(); - playerIdx = this->_friction; - fVar9 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 5.0 + 5.0; - (this->_velocity).y = (fVar9 * local_48.x * local_40) / playerIdx + (this->_velocity).y; - (this->_velocity).x = (fVar9 * (float)local_4c * local_40) / playerIdx + (this->_velocity).x; - this->_state = 1; - } - playerIdx = this->_friction * 0.8; -LAB_006420cf: - this->_friction = playerIdx; - } - else { - if (iVar6 == 1) { - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 == GHIDRA_CAST(0x0)) { -LAB_00641c4e: - rainbowBlue = ANM2::SetAnimation(&this->_sprite,&DAT_00b1d6fc,1); - if (rainbowBlue != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - pbVar7 = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar7 = *GHIDRA_CAST(pbVar5); - } - expectedNameCh = &DAT_00b1d6fc; - do { - rainbowBlue = *pbVar7; - bVar8 = rainbowBlue < *expectedNameCh; - if (rainbowBlue != *expectedNameCh) { -LAB_00641c30: - uVar4 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_00641c35; - } - if (rainbowBlue == 0) break; - rainbowBlue = pbVar7[1]; - bVar8 = rainbowBlue < expectedNameCh[1]; - if (rainbowBlue != expectedNameCh[1]) goto LAB_00641c30; - pbVar7 = pbVar7 + 2; - expectedNameCh = expectedNameCh + 2; - } while (rainbowBlue != 0); - uVar4 = 0; -LAB_00641c35: - if ((uVar4 != 0) || ((pbVar5[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_00641c4e; - } - playerIdx = (this->_velocity).y; - fVar9 = (this->_velocity).x; - if (fVar9 * fVar9 + playerIdx * playerIdx < 1.0) { - this->_state = 0; - } - playerIdx = this->_friction * 0.95; - goto LAB_006420cf; - } - if (iVar6 == 2) { - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 == GHIDRA_CAST(0x0)) { -LAB_00641976: - rainbowBlue = ANM2::SetAnimation(&this->_sprite,&DAT_00b1d6fc,1); - if (rainbowBlue != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar5); - } - pbVar7 = &DAT_00b1d6fc; - do { - rainbowBlue = *pbVar5; - bVar8 = rainbowBlue < *pbVar7; - if (rainbowBlue != *pbVar7) { -LAB_00641956: - uVar4 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_0064195b; - } - if (rainbowBlue == 0) break; - rainbowBlue = pbVar5[1]; - bVar8 = rainbowBlue < pbVar7[1]; - if (rainbowBlue != pbVar7[1]) goto LAB_00641956; - pbVar5 = pbVar5 + 2; - pbVar7 = pbVar7 + 2; - } while (rainbowBlue != 0); - uVar4 = 0; -LAB_0064195b: - if ((uVar4 != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && - ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00641976; - } - if (((this->_targetPosition).x == g_vectorZero.x) && - ((this->_targetPosition).y == g_vectorZero.y)) { - playerIdx = this->_orbitSpeed + 0.7; - this->_orbitSpeed = playerIdx; - fVar9 = playerIdx + (this->_posOffset).y; - (this->_posOffset).y = fVar9; - if (-26.0 <= fVar9) { - this->_entityGridCollisionClass = (fVar9 < -3.0) + 5; - } - else { - this->_entityGridCollisionClass = 3; - } - } - else { - this->_entityGridCollisionClass = 3; - this->_entityCollisionClass = 0; - (this->_velocity).x = (this->_orbitDistance).x; - (this->_velocity).y = (this->_orbitDistance).y; - playerIdx = this->_orbitSpeed + 0.7; - this->_orbitSpeed = playerIdx; - fVar9 = playerIdx + (this->_posOffset).y; - (this->_posOffset).y = fVar9; - } - if (-playerIdx < fVar9) { - if (((this->_targetPosition).x == g_vectorZero.x) && - ((this->_targetPosition).y == g_vectorZero.y)) { - local_38.x = (this->_pos).x; - local_38.y = (this->_pos).y; - iVar6 = (GHIDRA_CAST((g_game->_room)))->Room::GetGridCollisionAtPos(this->_pos); - if (iVar6 == 1) { - uVar4 = Random(); - Game::SpawnEx(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar4,0); - this->Remove(); - return; - } - if ((this->_target != 0) || - (PickEnemyTarget(this,80.0,1,0,&g_vectorZero,15.0), this->_target != 0)) { - this->_headFrameDelay = 1; - } - } - manager = g_manager; - (this->_posOffset).y = 0.0; - this->_orbitSpeed = 0.0; - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - this->_state = 0; - if (this->_subtype == 0xc) { - local_40 = 6.82432e-43; - } - else { - local_40 = 3.61535e-43; - } - seed_fart_sound_override(GHIDRA_CAST(&local_40)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_40),1.0,2,0,1.0,0.0); - } - } - } - uVar4 = Random(); - if ((uVar4 % 0x14 == 0) && (this->_subtype != 0xc)) { - uVar4 = Random(); - splat = Entity_NPC::MakeSplat - (GHIDRA_CAST(this), - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.2); - splat->SetColor(&this->_splatColor,0xffffffff,0xff,0,1); - } - game = g_game; - if (this->_dead == 0) { - iVar6 = this->_subtype; - if (iVar6 == 1) { - if (g_game->_frameCount - this->_spawnFrame < 0x1c2) { - fVar9 = this->_health + 0.03; - playerIdx = this->_maxHitPoints; - if (fVar9 <= playerIdx) { - playerIdx = fVar9; - } - this->_health = playerIdx; - } - else { - uStack_30 = 0; - uStack_2c = 0; - uStack_28 = 0; - uStack_24 = 0; - fStack_20 = g_vectorZero.x; - fStack_1c = g_vectorZero.y; - fStack_18 = g_vectorZero.x; - fStack_14 = g_vectorZero.y; - uStack_10 = 0; - uStack_c = 0; - this->Kill(&uStack_30); - } - } - else { - if (iVar6 == 5) { - if (((this->_flags & 0x4000) != 0) || (rainbowBlue = Game::IsPaused(g_game), rainbowBlue != 0)) - goto LAB_0064243e; - uVar4 = game->_frameCount + this->_index & 0x80000003; - bVar8 = uVar4 == 0; - if (GHIDRA_INT(uVar4) < 0) { - bVar8 = (uVar4 - 1 | 0xfffffffc) == 0xffffffff; - } - if ((!bVar8) || (uVar4 = Random(), (uVar4 & 1) != 0)) goto LAB_0064243e; - uVar4 = Random(); - spawnedEffect = - Game::SpawnEx(g_game,1000,0x2d,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4,0); - uVar4 = Random(); - playerIdx = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.4; - fVar9 = playerIdx * g_vectorOne.y; - playerIdx = playerIdx * g_vectorOne.x; - pAVar2 = &spawnedEffect[1]._sprite; - (pAVar2->_filename)._buf[4] = 'Z'; - (pAVar2->_filename)._buf[5] = '\0'; - (pAVar2->_filename)._buf[6] = '\0'; - (pAVar2->_filename)._buf[7] = '\0'; - (spawnedEffect->_sprite)._scale.y = fVar9; - pAVar2 = &spawnedEffect[1]._sprite; - (pAVar2->_filename)._buf[8] = 'Z'; - (pAVar2->_filename)._buf[9] = '\0'; - (pAVar2->_filename)._buf[10] = '\0'; - (pAVar2->_filename)._buf[0xb] = '\0'; - (spawnedEffect->_sprite)._scale.x = playerIdx; - } - else { - if (((iVar6 != 0xe) || ((this->_flags & 0x4000) != 0)) || - (rainbowBlue = Game::IsPaused(g_game), rainbowBlue != 0)) goto LAB_0064243e; - uVar4 = game->_frameCount + this->_index & 0x80000007; - bVar8 = uVar4 == 0; - if (GHIDRA_INT(uVar4) < 0) { - bVar8 = (uVar4 - 1 | 0xfffffff8) == 0xffffffff; - } - if ((!bVar8) || (uVar4 = Random(), uVar4 % 3 != 0)) goto LAB_0064243e; - uVar4 = Random(); - spawnedEffect = - Game::SpawnEx(g_game,1000,0x8d,&this->_pos,&g_vectorZero,this->_player,0,uVar4,0); - uVar4 = Random(); - playerIdx = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.5; - fVar9 = playerIdx * g_vectorOne.y; - playerIdx = playerIdx * g_vectorOne.x; - pAVar2 = &spawnedEffect[1]._sprite; - (pAVar2->_filename)._buf[4] = '<'; - (pAVar2->_filename)._buf[5] = '\0'; - (pAVar2->_filename)._buf[6] = '\0'; - (pAVar2->_filename)._buf[7] = '\0'; - (spawnedEffect->_sprite)._scale.y = fVar9; - pAVar2 = &spawnedEffect[1]._sprite; - (pAVar2->_filename)._buf[8] = '<'; - (pAVar2->_filename)._buf[9] = '\0'; - (pAVar2->_filename)._buf[10] = '\0'; - (pAVar2->_filename)._buf[0xb] = '\0'; - (spawnedEffect->_sprite)._scale.x = playerIdx; - spawnedEffect->SetCollisionDamage(*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)) * 0.5); - } - spawnedEffect->Update(); - } - } -LAB_0064243e: - if ((0.0 < this->_pendingDamage) && - (rainbowBlue = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0), rainbowBlue != 0)) { - this->_pendingDamage = 0.0; - damageEventsEnd = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); - for (damageEvent = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); damageEvent != damageEventsEnd; - damageEvent = damageEvent + 0xe) { - playerIdx = *damageEvent; - *damageEvent = playerIdx * 0.5; - this->_pendingDamage = playerIdx * 0.5 + this->_pendingDamage; - } - } - (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; - return; -} - -// 006424d0 -void Entity_Familiar::ai_bird_cage() -{ - uint8_t bVar1; - uint8_t *curAnimName; - uint32_t uVar2; - Vector *pVVar3; - Entity *tmpEntity; - char *expectedAnimName; - Entity **targetRef; - bool isLess; - float fVar4; - float fVar5; - float targetDy; - Entity *local_3c; - Vector local_38; - Vector local_30; - float enemyDistance; - int deathmatchMode; - Entity *local_20; - uint32_t *local_1c; - float local_18; - float awayDirY; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - uint8_t *animData; - Manager *manager; - uint32_t *parentRef; - int target; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af7060; - local_10 = ExceptionList; - ExceptionList = &local_10; - switch(this->_state) { - case 0: - PickEnemyTarget(this,10000.0,0,5,&g_vectorZero,15.0); - target = this->_target; - if (target != 0) { - fVar5 = *GHIDRA_CAST((target + 0x340)); - (this->_targetPosition).x = *GHIDRA_CAST((target + 0x33c)); - (this->_targetPosition).y = fVar5; - bVar1 = ANM2::SetAnimation(&this->_sprite,&DAT_00b1e0e4,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - this->_state = 1; - ExceptionList = local_10; - return; - } - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - expectedAnimName = "Flying"; - do { - bVar1 = *curAnimName; - isLess = bVar1 < (uint8_t)*expectedAnimName; - if (bVar1 != *expectedAnimName) { -LAB_006425d0: - uVar2 = -GHIDRA_UINT(isLess) | 1; - goto LAB_006425d5; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - isLess = bVar1 < (uint8_t)expectedAnimName[1]; - if (bVar1 != expectedAnimName[1]) goto LAB_006425d0; - curAnimName = curAnimName + 2; - expectedAnimName = expectedAnimName + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_006425d5: - if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_00642608; - } - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Flying"),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_00642608: - this->_state = 3; - ExceptionList = local_10; - return; - case 1: - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - animData = (this->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_00642686: - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("JumpDown"),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - expectedAnimName = "JumpDown"; - do { - bVar1 = *curAnimName; - isLess = bVar1 < (uint8_t)*expectedAnimName; - if (bVar1 != *expectedAnimName) { -LAB_00642670: - uVar2 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00642675; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - isLess = bVar1 < (uint8_t)expectedAnimName[1]; - if (bVar1 != expectedAnimName[1]) goto LAB_00642670; - curAnimName = curAnimName + 2; - expectedAnimName = expectedAnimName + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_00642675: - if ((uVar2 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_00642686; - } - this->_state = 2; - } - target = this->_target; - local_20 = GHIDRA_CAST(&this->_target); - if (target == 0) goto LAB_00642705; - if (*GHIDRA_CAST((target + 0x173)) == '\0') { - fVar5 = *GHIDRA_CAST((target + 0x340)); - (this->_targetPosition).x = *GHIDRA_CAST((target + 0x33c)); - (this->_targetPosition).y = fVar5; - goto LAB_00642705; - } - targetRef = &local_20; - break; - case 2: - pVVar3 = &this->_pos; - pVVar3->x = (this->_targetPosition).x; - (this->_pos).y = (this->_targetPosition).y; - if ((this->_sprite)._animState._animData == (void *)0x0) { -LAB_00642bca: - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Flying"),0); - this->_state = 3; - } - } - else { - bVar1 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,&DAT_00b1d3b0); - manager = g_manager; - if (bVar1 == 0) goto LAB_00642bca; - local_18 = 7.28675e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_18)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18),1.0,2,0,1.0,0.0); - Game::BombDamage(g_game,pVVar3,45.0,24.0,1,this->_player,(BitSet128)ZEXT816(0),4,0); - uVar2 = Random(); - local_3c = Game::SpawnEx(g_game,1000,0x48,pVVar3,&g_vectorZero,this->_player,0,uVar2,0); - parentRef = &local_3c->_parent; - if (local_3c->_parent != 0) { - local_20 = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_20); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - awayDirY = 0.0; - local_18 = 0.0; - local_20 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1264)); - if (local_20 != GHIDRA_CAST(0x0)) { - deathmatchMode = *GHIDRA_CAST(&g_game->_deathmatchManager); - local_1c = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x125c)); - do { - tmpEntity = GHIDRA_CAST(*local_1c); - local_38.y = (tmpEntity->_pos).y - (this->_pos).y; - local_30.y = (tmpEntity->_pos).x - (this->_pos).x; - enemyDistance = sqrtf(local_30.y * local_30.y + local_38.y * local_38.y); - if ((deathmatchMode < 2) || (tmpEntity->_type != 1)) { - target = tmpEntity->_type; - if (target - 10U < 0x3de) goto LAB_006428f9; - } - else { - target = 1; -LAB_006428f9: - if ((((((tmpEntity->_entityCollisionClass != 1) && - (tmpEntity->_entityCollisionClass != 0)) && (tmpEntity->_isInvicible == 0)) && - (tmpEntity->_dead == 0)) && - (((bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::HasEntityFlags(0x10), bVar1 == 0 || (target == 0x322)) - || (target == 0x362)))) && ((enemyDistance <= 256.0 && (0.0 < enemyDistance)))) { - local_18 = local_30.y / enemyDistance + local_18; - awayDirY = local_38.y / enemyDistance + awayDirY; - } - } - local_1c = local_1c + 1; - local_20 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_20[-1])) + 0x40f)))); - } while (local_20 != GHIDRA_CAST(0x0)); - local_20 = GHIDRA_CAST(0x0); - } - fVar4 = awayDirY; - fVar5 = local_18; - if (awayDirY * awayDirY + local_18 * local_18 < 0.001) { - pVVar3 = MusicManager::RandomVector(&local_38); - fVar5 = pVVar3->x; - fVar4 = pVVar3->y; - } - local_18 = atan2f(fVar4,fVar5); - local_18 = local_18 * 57.295776; - target = *GHIDRA_CAST(local_3c); - *GHIDRA_CAST((local_3c[1]._sprite._animDefaultName._buf + 4)) = local_18; - (**(code **)(target + 0xc))(); - bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (bVar1 != 0) { - local_20 = GHIDRA_CAST(0x3); - do { - local_18 = local_18 + 90.0; - uVar2 = Random(); - tmpEntity = Game::SpawnEx(g_game,1000,0x48,&this->_pos,&g_vectorZero,this->_player,0,uVar2 - ,0); - parentRef = &tmpEntity->_parent; - if (tmpEntity->_parent != 0) { - local_3c = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_3c); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - target = *GHIDRA_CAST(tmpEntity); - *GHIDRA_CAST((tmpEntity[1]._sprite._animDefaultName._buf + 4)) = local_18; - (**(code **)(target + 0xc))(); - local_20 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_20[-1])) + 0x40f)))); - } while (local_20 != GHIDRA_CAST(0x0)); - } - target = 4; - do { - uVar2 = Random(); - local_3c = (Entity *) - ((float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10 * 360.0 * 0.017453292); - local_20 = GHIDRA_CAST(cos((float)local_3c)); - local_1c = GHIDRA_CAST(sin((float)local_3c)); - uVar2 = Random(); - fVar5 = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10; - local_30.y = fVar5 * (float)local_1c * 12.0 + (this->_pos).y; - local_30.x = fVar5 * (float)local_20 * 12.0 + (this->_pos).x; - uVar2 = Random(); - local_38.x = (float)local_20 * 5.0; - local_38.y = (float)local_1c * 5.0; - tmpEntity = Game::SpawnEx(g_game,1000,4,&local_30,&local_38,GHIDRA_CAST(0x0),0,uVar2,0); - tmpEntity->Update(); - target = target + -1; - } while (target != 0); - Game::ShakeScreen(g_game,0xc); - } - target = this->_target; - local_3c = GHIDRA_CAST(&this->_target); - if (target == 0) goto LAB_00642705; - if (*GHIDRA_CAST((target + 0x173)) == '\0') { - fVar5 = *GHIDRA_CAST((target + 0x340)); - fVar4 = *GHIDRA_CAST((target + 0x33c)) - (this->_targetPosition).x; - targetDy = fVar5 - (this->_targetPosition).y; - if (targetDy * targetDy + fVar4 * fVar4 < 10000.0) { - (this->_targetPosition).x = *GHIDRA_CAST((target + 0x33c)); - (this->_targetPosition).y = fVar5; - } - goto LAB_00642705; - } - targetRef = &local_3c; - break; - case 3: - ai_flying_bird(this,__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U); - default: - ExceptionList = local_10; - return; - } - msvc::multiset::erase(targetRef); - this->_target = 0; -LAB_00642705: - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - ExceptionList = local_10; - return; -} - -// 006431d0 -void Entity_Familiar::ai_bot_fly() -{ - BitSet128 flags; - uint8_t bVar1; - uint8_t *pbVar2; - uint32_t uVar3; - Entity *projectile; - Entity_Tear *tear; - char *pcVar4; - uint8_t *pbVar5; - int *targetRef; - bool isLess; - float fVar6; - float fVar7; - float fVar8; - float fVar9; - uint32_t *puVar10; - float fVar11; - float local_3c; - uint32_t *local_34; - Vector local_30; - uint32_t uStack_28; - int *local_14 [4]; - int target; - float *targetPosX; - - pcVar4 = GHIDRA_CAST(this); - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) { - pbVar2 = (this->_sprite)._animState._animData; - if (pbVar2 == GHIDRA_CAST(0x0)) { - pbVar2 = &s_empty; - } - else if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { - pbVar2 = *GHIDRA_CAST(pbVar2); - } - pcVar4 = "Attack"; - do { - bVar1 = *pbVar2; - isLess = bVar1 < (uint8_t)*pcVar4; - if (bVar1 != *pcVar4) { -LAB_00643230: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00643235; - } - if (bVar1 == 0) break; - bVar1 = pbVar2[1]; - isLess = bVar1 < (*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)(GHIDRA_CAST(pcVar4)))) + 0x1))); - if (bVar1 != (*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(pcVar4)))) + 0x1)))) goto LAB_00643230; - pbVar2 = pbVar2 + 2; - pcVar4 = &(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(pcVar4)))) + 0x2))); - } while (bVar1 != 0); - uVar3 = 0; -LAB_00643235: - if (uVar3 == 0) { - target_threatening_projectile(this,128.0,GHIDRA_INT(pcVar4),1); - targetRef = &this->_target; - if (this->_target != 0) { - fVar6 = (this->_pos).x; - targetPosX = GHIDRA_CAST((this->_target + 0x33c)); - (this->_sprite)._flipX = *targetPosX <= fVar6 && fVar6 != *targetPosX; - } - if ((this->_sprite)._animState._animData == (void *)0x0) { - return; - } - local_14[0] = targetRef; - bVar1 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("Shoot")); - if (bVar1 == 0) { - return; - } - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (uVar3 = Random(), uVar3 % 3 != 0)) { - return; - } - target = *targetRef; - if (target == 0) { - if ((this->_sprite)._flipX == 0) { - fVar6 = 15.0; - } - else { - fVar6 = -15.0; - } - local_30.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; - local_30.x = local_30.x + local_30.x; - local_34 = GHIDRA_CAST((fVar8 + fVar8)); - local_3c = 0.0; - fVar8 = sqrtf(fVar6 * fVar6 + 0.0); - if (fVar8 <= 0.0) { - fVar9 = local_3c; - fVar11 = fVar6; - } - else { - fVar9 = (1.0 / fVar8) * 0.0; - fVar11 = (1.0 / fVar8) * fVar6; - } - fVar7 = 0.0; - local_3c = fVar6; - if (0.0 < fVar8) { - fVar7 = (1.0 / fVar8) * 0.0; - local_3c = (1.0 / fVar8) * fVar6; - } - fVar8 = (float)local_34 * fVar7 + local_30.x * local_3c; - fVar9 = fVar9 * fVar8; - fVar11 = fVar11 * fVar8; - puVar10 = local_34; - if (fVar11 * fVar6 + fVar9 * 0.0 < 0.0) { - local_30.x = local_30.x - fVar11; - puVar10 = GHIDRA_CAST(((float)local_34 - fVar9)); - } - local_30.y = (float)puVar10 + 0.0; - fVar6 = local_30.x + fVar6; - } - else { - fVar6 = (this->_pos).y - *GHIDRA_CAST((target + 0x340)); - fVar8 = (this->_pos).x - *GHIDRA_CAST((target + 0x33c)); - fVar6 = sqrtf(fVar6 * fVar6 + fVar8 * fVar8); - target = *targetRef; - fVar9 = (fVar6 * 0.05 * *GHIDRA_CAST((target + 0x364)) + *GHIDRA_CAST((target + 0x340))) - - (this->_pos).y; - fVar6 = (fVar6 * 0.05 * *GHIDRA_CAST((target + 0x360)) + *GHIDRA_CAST((target + 0x33c))) - - (this->_pos).x; - fVar8 = sqrtf(fVar9 * fVar9 + fVar6 * fVar6); - if (fVar8 <= 0.0) { - local_30.y = fVar9; - } - else { - fVar6 = fVar6 * (15.0 / fVar8); - local_30.y = fVar9 * (15.0 / fVar8); - } - } - local_30.x = fVar6; - if ((this->_flags & 0x100) == 0) { - uVar3 = Random(); - tear = (Entity_Tear *) - Game::SpawnEx(g_game,2,10,&this->_pos,&local_30,GHIDRA_CAST(this),0,uVar3,0); - tear->SetCollisionDamage(0x40400000); - local_30.x = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4)))); - uStack_28 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); - local_34 = (uint32_t *) - (GHIDRA_UINT(g_tearFlagShielded._l) | GHIDRA_UINT(g_tearFlagSpectral._l) | - GHIDRA_UINT(g_tearFlagHoming._l)); - local_30.y = (float)(GHIDRA_UINT(g_tearFlagShielded._h) | GHIDRA_UINT(g_tearFlagSpectral._h) | - GHIDRA_UINT(g_tearFlagHoming._h)); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = local_30.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = local_34; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = local_30.y; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_28; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); - tear->_baseScale = 0.8; - tear->_fScale = 0.8; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - tear->_fallingAccel = 0.2; - target = this->_target; - if (target != 0) { - if (tear->_target != 0) { - local_34 = &tear->_target; - msvc::multiset::erase(&local_34); - } - tear->_target = target; - msvc::multiset::insert(&tear->_target); - } - tear->Update(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); - targetRef = local_14[0]; - } - else { - uVar3 = Random(); - projectile = Game::SpawnEx(g_game,9,0,&this->_pos,&local_30,GHIDRA_CAST(this),0,uVar3,0); - target = *GHIDRA_CAST(projectile); - projectile[1]._type = 0x2000; - projectile[1]._variant = 0x1000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(projectile[1])) + 0x8)))) = 0x3f4ccccd; - (**(code **)(target + 0xc))(); - } - target = *targetRef; - if (target == 0) { - return; - } - *GHIDRA_CAST((target + 0x168)) = *GHIDRA_CAST((target + 0x168)) | 0x10; - *GHIDRA_CAST((target + 0x16c)) = *GHIDRA_CAST((target + 0x16c)); - if (*targetRef != 0) { - local_14[0] = targetRef; - msvc::multiset::erase(local_14); - } - *targetRef = 0; - return; - } - } - target_threatening_projectile(this,128.0,GHIDRA_INT(pcVar4),0); - pbVar2 = (this->_sprite)._animState._animData; - if (pbVar2 != GHIDRA_CAST(0x0)) { - if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { - pbVar2 = *GHIDRA_CAST(pbVar2); - } - pbVar5 = s_Fly; - do { - bVar1 = *pbVar2; - isLess = bVar1 < *pbVar5; - if (bVar1 != *pbVar5) { -LAB_006436f0: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_006436f5; - } - if (bVar1 == 0) break; - bVar1 = pbVar2[1]; - isLess = bVar1 < pbVar5[1]; - if (bVar1 != pbVar5[1]) goto LAB_006436f0; - pbVar2 = pbVar2 + 2; - pbVar5 = pbVar5 + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_006436f5: - if ((uVar3 == 0) && - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) == '\0' || - ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00643729; - } - bVar1 = ANM2::SetAnimation(&this->_sprite,s_Fly,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_00643729: - if (this->_target != 0) { - pbVar2 = (this->_sprite)._animState._animData; - if (pbVar2 != GHIDRA_CAST(0x0)) { - pbVar5 = pbVar2; - if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar2); - } - pcVar4 = "Attack"; - do { - bVar1 = *pbVar5; - isLess = bVar1 < (uint8_t)*pcVar4; - if (bVar1 != *pcVar4) { -LAB_00643768: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0064376d; - } - if (bVar1 == 0) break; - bVar1 = pbVar5[1]; - isLess = bVar1 < (uint8_t)pcVar4[1]; - if (bVar1 != pcVar4[1]) goto LAB_00643768; - pbVar5 = pbVar5 + 2; - pcVar4 = pcVar4 + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_0064376d: - if (uVar3 == 0) { - if (pbVar2[0x34] == 0) { - return; - } - if ((this->_sprite)._animState._isPlaying != 0) { - return; - } - } - } - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Attack"),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - return; -} - -// 006437a0 -void Entity_Familiar::ai_stitches() -{ - ANM2 other; - Vector velocity; - Entity *beamParentSlot; - uint8_t bVar2; - Entity *effect; - LayerState *layer; - uint8_t *curAnimChar; - uint32_t uVar3; - Game *game; - char *wantedAnimChar; - bool bVar4; - float fVar5; - float fVar6; - float fVar7; - float fVar8; - Entity_Familiar *pEVar9; - ANM2 aAStackY_8ca0 [128]; - uint8_t in_stack_fffffe74 [228]; - float in_stack_ffffff58; - float in_stack_ffffff5c; - float in_stack_ffffff60; - Vector *pVVar10; - uint32_t uVar11; - int iVar12; - int *local_70; - uint8_t isBffs; - float fStack_68; - Entity *pEStack_64; - float local_60; - Entity_Familiar *local_5c; - Vector local_58; - uint32_t uStack_50; - uint32_t uStack_4c; - code *pcStack_48; - float deltaX; - float distanceToPlayer; - float fStack_3c; - ColorMod CStack_38; - uint32_t local_c; - uint8_t *animData; - void *beamParent; - uint32_t *beamParentSlot; - int *entity; - Manager *manager; - Entity_Player *player; - Vector *pos; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_70); - this->_entityGridCollisionClass = 3; - local_5c = this; - switch(this->_state) { - case 0: - this->_spawnerType = 1; -LAB_0064423d: - this->_state = 3; - break; - case 1: - uVar3 = Random(); - iVar12 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar11)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar11)) + 0x1))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar11)) + 0x2))) = 0; - fVar8 = 0.0; - pVVar10 = &g_vectorZero; - pos = &this->_pos; - fVar7 = 2.10195e-44; - fVar5 = 1.4013e-42; - fVar6 = 9.203692e-39; - effect = Game::SpawnEx(g_game,1000,0xf,pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3,0); - ANM2::ANM2(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x18c)),&local_5c->_sprite); - other._championColor._colorize[0] = in_stack_ffffff58; - other._filename._buf[0] = in_stack_fffffe74[0]; - other._filename._buf[1] = in_stack_fffffe74[1]; - other._filename._buf[2] = in_stack_fffffe74[2]; - other._filename._buf[3] = in_stack_fffffe74[3]; - other._filename._buf[4] = in_stack_fffffe74[4]; - other._filename._buf[5] = in_stack_fffffe74[5]; - other._filename._buf[6] = in_stack_fffffe74[6]; - other._filename._buf[7] = in_stack_fffffe74[7]; - other._filename._buf[8] = in_stack_fffffe74[8]; - other._filename._buf[9] = in_stack_fffffe74[9]; - other._filename._buf[10] = in_stack_fffffe74[10]; - other._filename._buf[0xb] = in_stack_fffffe74[0xb]; - other._filename._buf[0xc] = in_stack_fffffe74[0xc]; - other._filename._buf[0xd] = in_stack_fffffe74[0xd]; - other._filename._buf[0xe] = in_stack_fffffe74[0xe]; - other._filename._buf[0xf] = in_stack_fffffe74[0xf]; - other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x10))); - other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x14))); - other._animDefaultName._buf[0] = in_stack_fffffe74[0x18]; - other._animDefaultName._buf[1] = in_stack_fffffe74[0x19]; - other._animDefaultName._buf[2] = in_stack_fffffe74[0x1a]; - other._animDefaultName._buf[3] = in_stack_fffffe74[0x1b]; - other._animDefaultName._buf[4] = in_stack_fffffe74[0x1c]; - other._animDefaultName._buf[5] = in_stack_fffffe74[0x1d]; - other._animDefaultName._buf[6] = in_stack_fffffe74[0x1e]; - other._animDefaultName._buf[7] = in_stack_fffffe74[0x1f]; - other._animDefaultName._buf[8] = in_stack_fffffe74[0x20]; - other._animDefaultName._buf[9] = in_stack_fffffe74[0x21]; - other._animDefaultName._buf[10] = in_stack_fffffe74[0x22]; - other._animDefaultName._buf[0xb] = in_stack_fffffe74[0x23]; - other._animDefaultName._buf[0xc] = in_stack_fffffe74[0x24]; - other._animDefaultName._buf[0xd] = in_stack_fffffe74[0x25]; - other._animDefaultName._buf[0xe] = in_stack_fffffe74[0x26]; - other._animDefaultName._buf[0xf] = in_stack_fffffe74[0x27]; - other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x28))); - other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x2c))); - other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x30))); - other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x34))); - other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x38))); - other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x3c))); - other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x40))); - other._animState._isPlaying = in_stack_fffffe74[0x44]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x45))); - other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x48))); - other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x4c))); - other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x50))); - other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x54))); - other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x58))); - other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x5c))); - other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x60))); - other._overlayAnimState._isPlaying = in_stack_fffffe74[100]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x65))); - other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x68))); - other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x6c))); - other._overlayRenderFirst = in_stack_fffffe74[0x70]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x71))); - other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x74))); - other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x78))); - other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x7c))); - other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x80))); - other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x84))); - other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x88))); - other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x8c))); - other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x90))); - other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x94))); - other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x98))); - other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x9c))); - other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xa0))); - other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xa4))); - other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xa8))); - other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xac))); - other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xb0))); - other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xb4))); - other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xb8))); - other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xbc))); - other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xc0))); - other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xc4))); - other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xc8))); - other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xcc))); - other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xd0))); - other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xd4))); - other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xd8))); - other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xdc))); - other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xe0))); - other._championColor._colorize[1] = in_stack_ffffff5c; - other._championColor._colorize[2] = in_stack_ffffff60; - other._championColor._colorize[3] = fVar6; - other._championColor._offset[0] = fVar5; - other._championColor._offset[1] = fVar7; - other._championColor._offset[2] = (float)pos; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x100))) = pVVar10; - other._playbackSpeed = fVar8; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = (char)uVar11; - other._loaded = SUB41(uVar11,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x10a))) = SUB42(uVar11,2); - other._shadowLayerIndex = uVar3; - other._bitflags = iVar12; - ANM2::operator_assign(&effect->_sprite,other); - ANM2::Play(&effect->_sprite,GHIDRA_CAST("TeleportUp"),0); - effect->Update(); - this = local_5c; - player = local_5c->_player; - pos = &local_5c->_pos; - local_70 = GHIDRA_CAST((player->_pos).x); - local_60 = (player->_pos).y; - Entity_Player::Teleport(player,pos,1,0); - manager = g_manager; - pos->x = (float)local_70; - (this->_pos).y = local_60; - beamParent = (manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((manager->_itemConfig)._collectibles._end) - GHIDRA_INT(beamParent) & 0xfffffffcU)) < - 0x9ed) { - local_58.x = 0.0; - } - else { - local_58.x = *GHIDRA_CAST((GHIDRA_CAST(beamParent) + 0x9ec)); - } - uStack_4c = 0; - uStack_50 = 0xc; - local_58.y = 1.4013e-45; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::AddEffect(&local_58,0,1); - fStack_68 = 30.0; - local_70 = GHIDRA_CAST((this->_player->_meleeDamage * 3.0 + 40.0)); - isBffs = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); - if (isBffs != 0) { - fStack_68 = 45.0; - } - uVar3 = Random(); - local_58.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_58.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - effect = Game::SpawnEx(g_game,1000,0xf,&local_58,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3,0); - effect->Update(); - uVar3 = Random(); - pVVar10 = pos; - effect = Game::SpawnEx(g_game,1000,0xf,pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3,0); - effect->Update(); - local_58.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_58.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - Game::DamageRadius(&local_58,GHIDRA_CAST(this),4,0,GHIDRA_INT(pVVar10),50.0,g_tearFlagsNone, - (float)local_70,fStack_68); - fVar6 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)); - if (isBffs != 0) { - fVar6 = fVar6 + fVar6 + 3.0; - } - Game::DamageRadius(pos,GHIDRA_CAST(this),4,0,GHIDRA_INT(pVVar10),50.0,g_tearFlagsNone,fVar6,fStack_68); - if (isBffs != 0) { - fStack_68 = 0.0; - do { - player = this->_player; - pEStack_64 = GHIDRA_CAST((player->_shotspeed * 10.0)); - local_70 = GHIDRA_CAST(((float)((double)GHIDRA_INT(fStack_68) + - __uint_to_double_fixup[-(GHIDRA_INT(fStack_68) >> 0x1f)]) * 360.0 * 0.125 - * 0.017453292)); - fVar6 = cos((float)local_70); - local_58.x = fVar6 * (float)pEStack_64; - local_58.y = sin((float)local_70); - local_58.y = local_58.y * (float)pEStack_64; - velocity.y = local_58.y; - velocity.x = local_58.x; - Entity_Player::FireTear(player,&this->_pos,velocity,0,GHIDRA_CAST(0x0),1.0); - fStack_68 = (float)(GHIDRA_INT(fStack_68) + 1); - } while (GHIDRA_UINT(fStack_68) < 8); - } - bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x3b,0); - if (bVar2 != 0) { - fVar6 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)); - fStack_3c = fVar6 + fVar6 + 3.0; - uVar3 = Random(); - pEStack_64 = Game::SpawnEx(g_game,1000,0xa6,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3,0 - ); - beamParent = this->_player; - beamParentSlot = &pEStack_64->_parent; - if (pEStack_64->_parent != 0) { - local_70 = beamParentSlot; - msvc::multiset::erase(); - } - *beamParentSlot = beamParent; - if (beamParent != (void *)0x0) { - msvc::multiset::insert(); - } - effect = pEStack_64; - CStack_38._offset[0] = 0.0; - CStack_38._colorize[0] = 0.0; - CStack_38._colorize[1] = 0.0; - CStack_38._colorize[2] = 0.0; - CStack_38._colorize[3] = 0.0; - CStack_38._offset[1] = 0.0; - CStack_38._offset[2] = 0.0; - CStack_38._tint[0] = 0.0; - CStack_38._tint[1] = 0.0; - CStack_38._tint[2] = 0.0; - CStack_38._tint[3] = 1.0; - (GHIDRA_CAST((GHIDRA_CAST(&pEStack_64->_sprite))))->Sprite::SetColor(&CStack_38); - uVar3 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&effect->_sprite,GHIDRA_CAST(0x0)); - iVar12 = 1; - if ((uVar3 & 4) == 0) { - iVar12 = 6; - } - layer->_blendMode[1] = iVar12; - layer->_blendMode[0] = 0; - layer->_blendMode[2] = 7; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 7; - fVar6 = g_vectorOne.y; - (effect->_sprite)._scale.x = g_vectorOne.x; - (effect->_sprite)._scale.y = fVar6; - iVar12 = *GHIDRA_CAST(effect); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(effect[1])) + 0x44)))) = 0x3da3d70a; - builtin_strncpy(effect[1]._sprite._filename._buf,"\n×£=",4); - (**(code **)(iVar12 + 0xc))(); - this = local_5c; - fVar6 = *GHIDRA_CAST((GHIDRA_CAST(local_5c->_player) + 0x340)); - iVar12 = *GHIDRA_CAST(effect); - (effect->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(local_5c->_player) + 0x33c)); - (effect->_pos).y = fVar6; - fVar6 = g_vectorOne.x; - fVar5 = g_vectorOne.y * 2.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(effect[1])) + 0x44)))) = 0x3d23d70a; - beamParentSlot = effect + 1; - (beamParentSlot->_sprite)._filename._buf[0] = '\n'; - (beamParentSlot->_sprite)._filename._buf[1] = -0x29; - (beamParentSlot->_sprite)._filename._buf[2] = '#'; - (beamParentSlot->_sprite)._filename._buf[3] = '='; - (effect->_sprite)._scale.y = fVar5; - (effect->_sprite)._scale.x = fVar6 * 2.0; - (**(code **)(iVar12 + 0xc))(); - fStack_68 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; - local_5c = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x)); - distanceToPlayer = sqrtf(fStack_68 * fStack_68 + (float)local_5c * (float)local_5c); - if (0.0 < distanceToPlayer) { - pEVar9 = GHIDRA_CAST(((float)local_5c / distanceToPlayer)); - local_70 = GHIDRA_CAST(0x0); - local_58.x = (float)g_game->_room; - fVar6 = fStack_68 / distanceToPlayer; - game = g_game; - fStack_68 = fVar6; - local_5c = pEVar9; - if (*GHIDRA_CAST((GHIDRA_CAST(local_58.x) + 0x1264)) != 0) { - do { - entity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_58.x) + 0x125c)) + GHIDRA_INT(local_70) * 4)); - if ((entity[0x62] != 0) && - ((((1 < *GHIDRA_CAST(&game->_deathmatchManager) && (entity[10] == 1)) || - (entity[10] - 10U < 0x3de)) && ((entity[0x5a] & 0x20000000U) == 0)))) { - pEStack_64 = GHIDRA_CAST(((float)entity[0xd0] - (this->_pos).y)); - deltaX = (float)entity[0xcf] - (this->_pos).x; - pcStack_48 = (code *)(fVar6 * (float)pEStack_64 + (float)pEVar9 * deltaX); - local_60 = cos(1.5707964); - fVar6 = sin(1.5707964); - if ((((fVar6 * (float)local_5c + local_60 * fStack_68) * (float)pEStack_64 + - (local_60 * (float)local_5c - fVar6 * fStack_68) * deltaX < - (float)entity[0xdc] + 25.0) && (0.0 <= (float)pcStack_48)) && - ((float)pcStack_48 <= distanceToPlayer)) { - CStack_38._offset[1] = (float)this->_player; - pcStack_48 = *(code **)(*entity + 0x20); - if ((void *)CStack_38._offset[1] == (void *)0x0) { - CStack_38._tint[0] = 0.0; - CStack_38._tint[1] = 0.0; - CStack_38._tint[2] = 0.0; - CStack_38._tint[3] = 0.0; - CStack_38._colorize[0] = g_vectorZero.x; - CStack_38._colorize[1] = g_vectorZero.y; - CStack_38._colorize[2] = g_vectorZero.x; - CStack_38._colorize[3] = g_vectorZero.y; -LAB_00643fa1: - pEStack_64 = GHIDRA_CAST(0x0); - if ((void *)CStack_38._offset[1] != (void *)0x0) goto LAB_00643fad; - pEStack_64 = GHIDRA_CAST(0x0); -LAB_00643fcf: - local_60 = 0.0; - if ((void *)CStack_38._offset[1] != (void *)0x0) goto LAB_00643fdb; -LAB_00643ff4: - uVar3 = 0; - } - else { - CStack_38._tint[0] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x28)); - CStack_38._tint[1] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x2c)); - CStack_38._tint[2] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x34)); - CStack_38._tint[3] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x38)); - CStack_38._colorize[0] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x33c)); - CStack_38._colorize[1] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x340)); - CStack_38._colorize[2] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x360)); - CStack_38._colorize[3] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x364)); - if ((*GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x168)) & 0x100) == 0) - goto LAB_00643fa1; - pEStack_64 = GHIDRA_CAST(0x1); -LAB_00643fad: - if ((*GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x168)) & 0x20000000) == 0) - goto LAB_00643fcf; - local_60 = 2.8026e-45; -LAB_00643fdb: - if ((*GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x16c)) & 0x400000) == 0) - goto LAB_00643ff4; - uVar3 = 4; - } - CStack_38._offset[0] = (float)(uVar3 | GHIDRA_UINT(local_60) | GHIDRA_UINT(pEStack_64)); - (*pcStack_48)(); - } - game = g_game; - pEVar9 = local_5c; - fVar6 = fStack_68; - } - local_70 = GHIDRA_CAST((GHIDRA_INT(local_70) + 1)); - } while (local_70 < *GHIDRA_CAST((GHIDRA_CAST(local_58.x) + 0x1264))); - } - } - uVar3 = Random(); - manager = g_manager; - local_70 = GHIDRA_CAST(0x1fa); - local_58.x = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 1.5; - seed_fart_sound_override(GHIDRA_CAST(&local_70)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_70),1.0,1,0,local_58.x,0.0); - Game::ShakeScreen(g_game,6); - } - iVar12 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13bc)); - if (iVar12 < 0x1e) { - iVar12 = 0x1e; - } - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13bc)) = iVar12; - beamParent = this->_player; - *GHIDRA_CAST((GHIDRA_CAST(beamParent) + 0x16c)) = *GHIDRA_CAST((GHIDRA_CAST(beamParent) + 0x16c)) | 0x10; - *GHIDRA_CAST((GHIDRA_CAST(beamParent) + 0x168)) = *GHIDRA_CAST((GHIDRA_CAST(beamParent) + 0x168)); - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - animData = (this->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_0064418e: - bVar2 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("TeleportDown"),1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - wantedAnimChar = "TeleportDown"; - do { - bVar2 = *curAnimChar; - bVar4 = bVar2 < (uint8_t)*wantedAnimChar; - if (bVar2 != *wantedAnimChar) { -LAB_00644170: - uVar3 = -GHIDRA_UINT(bVar4) | 1; - goto LAB_00644175; - } - if (bVar2 == 0) break; - bVar2 = curAnimChar[1]; - bVar4 = bVar2 < (uint8_t)wantedAnimChar[1]; - if (bVar2 != wantedAnimChar[1]) goto LAB_00644170; - curAnimChar = curAnimChar + 2; - wantedAnimChar = wantedAnimChar + 2; - } while (bVar2 != 0); - uVar3 = 0; -LAB_00644175: - if ((uVar3 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_0064418e; - } - this->_state = 2; - break; - case 2: - animData = (this->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_00644210: - bVar2 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("TeleportDown"),1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - wantedAnimChar = "TeleportDown"; - do { - bVar2 = *curAnimChar; - bVar4 = bVar2 < (uint8_t)*wantedAnimChar; - if (bVar2 != *wantedAnimChar) { -LAB_006441f2: - uVar3 = -GHIDRA_UINT(bVar4) | 1; - goto LAB_006441f7; - } - if (bVar2 == 0) break; - bVar2 = curAnimChar[1]; - bVar4 = bVar2 < (uint8_t)wantedAnimChar[1]; - if (bVar2 != wantedAnimChar[1]) goto LAB_006441f2; - curAnimChar = curAnimChar + 2; - wantedAnimChar = wantedAnimChar + 2; - } while (bVar2 != 0); - uVar3 = 0; -LAB_006441f7: - if ((uVar3 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_00644210; - } - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) goto LAB_0064423d; - break; - case 3: - ANM2::Play(&this->_sprite,s_Idle,0); - } - (GHIDRA_CAST((this->_player)))->Entity_Player::GetShootingJoystick(&local_58); - fVar6 = (this->_velocity).x; - if (this->_collidesWithGrid != 0) { - fVar6 = fVar6 * 0.88; - (this->_velocity).x = fVar6; - (this->_velocity).y = (this->_velocity).y * 0.88; - } - fVar5 = 0.0; - if ((local_58.x == 0.0) || (local_58.y != 0.0)) { - if ((local_58.y == 0.0) || (local_58.x != 0.0)) goto LAB_00644300; - fVar5 = (this->_velocity).y; - fVar6 = fVar6 * 0.5; - } - else { - (this->_velocity).y = (this->_velocity).y * 0.5; - fVar5 = fVar6; - } - fVar5 = ABS(fVar5); -LAB_00644300: - game = g_game; - fVar7 = (this->_velocity).y; - fVar8 = -(fVar7 * local_58.y + fVar6 * local_58.x) * 0.2; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - fVar5 = (fVar8 + fVar5 * 0.3 * 0.1 + 3.0) * 0.8; - (this->_velocity).y = (fVar5 * local_58.y + fVar7) * 0.775; - (this->_velocity).x = (fVar5 * local_58.x + fVar6) * 0.775; - Room::GetClampedPositionImpl(game->_room,&local_58,&this->_pos,0.0,0.0,0.0,0.0); - local_60 = local_58.x - (this->_pos).x; - local_70 = GHIDRA_CAST((local_58.y - (this->_pos).y)); - if ((local_60 != g_vectorZero.x) || ((float)local_70 != g_vectorZero.y)) { - fVar6 = sqrtf((float)local_70 * (float)local_70 + local_60 * local_60); - if (0.0 < fVar6) { - local_70 = GHIDRA_CAST(((float)local_70 * (1.0 / fVar6))); - local_60 = local_60 * (1.0 / fVar6); - } - fVar6 = (this->_velocity).x; - fVar5 = this->_speedMultiplier; - fVar7 = -((float)local_70 * (this->_velocity).y + fVar6 * local_60); - if (fVar7 <= 1.0) { - fVar7 = 1.0; - } - if (10.0 <= fVar7) { - fVar7 = 10.0; - } - (this->_velocity).x = local_60 * fVar7 * fVar5 + fVar6; - (this->_velocity).y = (float)local_70 * fVar7 * fVar5 + (this->_velocity).y; - } - return; -} - -// 006444d0 -Entity * Entity_Familiar::aim_reflected_projectile() -{ - Entity *tmpEntity; - uint32_t rngResult; - int enemyType; - Game *game; - uint32_t enemyIdx; - float fVar1; - float distance; - float velocityYSq; - float fVar2; - float toEnemyY; - float bestScore; - float directionY; - float directionX; - Entity *bestTarget; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - Entity_NPC *ownerNpc; - void *room; - - game = g_game; - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af70b0; - local_10 = ExceptionList; - ExceptionList = &local_10; - if ((((this->_flags & 0x100) != 0) && - (ownerNpc = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x3bc)), ownerNpc != GHIDRA_CAST(0x0))) && - (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (ownerNpc->_type == 1)) || - (ownerNpc->_type - 10U < 0x3de)))) { - tmpEntity = (GHIDRA_CAST((ownerNpc)))->Entity_NPC::GetPlayerTarget(); - ExceptionList = local_10; - return tmpEntity; - } - directionY = (this->_velocity).y; - directionX = (this->_velocity).x; - bestScore = 0.0; - velocityYSq = directionY * directionY; - bestTarget = GHIDRA_CAST(0x0); - fVar1 = sqrtf(directionX * directionX + velocityYSq); - if (0.0 < fVar1) { - directionX = directionX * (1.0 / fVar1); - directionY = directionY * (1.0 / fVar1); - } - room = game->_room; - fVar1 = (this->_velocity).x; - enemyIdx = 0; - tmpEntity = GHIDRA_CAST(0x0); - if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { - do { - tmpEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + enemyIdx * 4)); - if (((((1 < *GHIDRA_CAST(&game->_deathmatchManager)) && (enemyType = 1, tmpEntity->_type == 1)) || - (enemyType = tmpEntity->_type, enemyType - 10U < 0x3de)) && - ((tmpEntity->_entityCollisionClass != 1 && (tmpEntity->_entityCollisionClass != 0)))) && - (((tmpEntity->_isInvicible == 0 && (tmpEntity->_dead == 0)) && - ((((tmpEntity->_flags & 0x10) == 0 || (enemyType == 0x322)) || (enemyType == 0x362)))))) { - if (fVar1 * fVar1 + velocityYSq <= 1e-05) { - rngResult = Random(); - fVar2 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)] - ) * 2.3283064e-10; - game = g_game; - } - else { - fVar2 = (tmpEntity->_pos).x - (this->_pos).x; - toEnemyY = (tmpEntity->_pos).y - (this->_pos).y; - distance = sqrtf(fVar2 * fVar2 + toEnemyY * toEnemyY); - if (0.0 < distance) { - fVar2 = fVar2 * (1.0 / distance); - toEnemyY = toEnemyY * (1.0 / distance); - } - fVar2 = directionX * fVar2 + directionY * toEnemyY; - } - if (bestScore < fVar2) { - bestScore = fVar2; - bestTarget = tmpEntity; - } - } - enemyIdx = enemyIdx + 1; - tmpEntity = bestTarget; - } while (enemyIdx < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); - } - ExceptionList = local_10; - return tmpEntity; -} - -// 00644e80 -void Entity_Familiar::ai_shadow_intruder_damocles(uint8_t isInterpolating) -{ - code *pcVar1; - int64_t lVar2; - int64_t lVar3; - int64_t lVar4; - uint8_t bVar5; - char cVar6; - uint8_t *curAnimChar; - uint32_t uVar7; - uint32_t uVar8; - EntityRef *sourceRef; - uint32_t rngResult; - Entity *spawned; - int iVar9; - int *piVar10; - uint8_t *wantedAnimChar; - int unusedArg; - void *pvVar11; - code *extraout_EDX; - uint32_t particleIndex; - ANM2 *sprite; - PlayerManager *playerManager; - bool bVar12; - float fVar13; - uint64_t timeNs; - uint8_t *pbVar14; - uint8_t auStack_12c [4]; - uint32_t spawnSubType; - uint32_t finalSubType; - int *piStack_120; - Entity_Familiar *pEStack_11c; - Entity *pEStack_118; - int local_114; - int iStack_110; - uint32_t spawnType; - Entity_Familiar *savedFamiliar; - float fStack_104; - Game *pGStack_100; - Vector particlePos; - uint32_t uStack_f0; - int soundId; - float particleVelX; - float fStack_e0; - void *triggerNode; - uint32_t savedParticleIndex; - float burstX; - float burstY; - int *spawnerRefArg; - uint32_t uStack_c8; - uint32_t directSpawnCount; - int particleCount; - uint32_t itemKey; - Vector particleVelocity; - Vector playerPos; - Vector slowVelocity; - int typeKey; - int variantKey; - int wildcardKey [3]; - uint64_t rngShifts; - uint32_t rngShift3; - int damageSourceType; - int damageSourceVariant; - int damageSourceSpawnerType; - int damageSourceSpawnerVariant; - float damageSourcePosX; - float damageSourcePosY; - float damageSourceVelX; - float damageSourceVelY; - uint32_t damageSourceFlags; - EntityRef local_58; - RNG cardRng; - uint32_t local_c; - Game *game; - Manager *manager; - Entity_Familiar *spawnVariant; - uint32_t *spawnerSlot; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_12c); - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - (this->_pos).y = fVar13; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - if (isInterpolating != 0) { - return; - } - iVar9 = this->_state; - savedFamiliar = this; - if (iVar9 == 0) { - this->_state = 1; - this->_fireCooldown = 0; - ANM2::Play(&this->_sprite,s_Idle,0); - return; - } - if (iVar9 == 1) { - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - uVar7 = Random(); - fVar13 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10; - if (0.1 <= fVar13) { - if (0.5 <= fVar13) { - pbVar14 = s_Idle; - } - else { - pbVar14 = s_Idle2; - } - } - else { - pbVar14 = &DAT_00b1d43c; - } - bVar5 = ANM2::SetAnimation(&this->_sprite,pbVar14,1); - if (bVar5 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - game = g_game; - if ((this->_flags & 0x4000) != 0) { - return; - } - bVar5 = Game::IsPaused(g_game); - if (bVar5 != 0) { - return; - } - uVar7 = game->_frameCount & 0x80000003; - bVar12 = uVar7 == 0; - if (GHIDRA_INT(uVar7) < 0) { - bVar12 = (uVar7 - 1 | 0xfffffffc) == 0xffffffff; - } - if (bVar12) { - iVar9 = this->_subtype; - if (iVar9 < 1) { - return; - } - uVar7 = Random(); - manager = g_manager; - if (GHIDRA_INT((uVar7 % 10000)) < iVar9) { - local_114 = 0x1fd; - seed_fart_sound_override(&local_114); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_114,1.0,0,0,1.0,0.0); - this->_state = 2; - return; - } - return; - } - return; - } - if (iVar9 != 2) { - return; - } - pbVar14 = (this->_sprite)._animState._animData; - sprite = &this->_sprite; - if (pbVar14 != GHIDRA_CAST(0x0)) { - curAnimChar = pbVar14; - if (0xf < *GHIDRA_CAST((pbVar14 + 0x14))) { - curAnimChar = *GHIDRA_CAST(pbVar14); - } - wantedAnimChar = &DAT_00b1e7b0; - do { - bVar5 = *curAnimChar; - bVar12 = bVar5 < *wantedAnimChar; - if (bVar5 != *wantedAnimChar) { -LAB_00644f50: - uVar7 = -GHIDRA_UINT(bVar12) | 1; - goto LAB_00644f55; - } - if (bVar5 == 0) break; - bVar5 = curAnimChar[1]; - bVar12 = bVar5 < wantedAnimChar[1]; - if (bVar5 != wantedAnimChar[1]) goto LAB_00644f50; - curAnimChar = curAnimChar + 2; - wantedAnimChar = wantedAnimChar + 2; - } while (bVar5 != 0); - uVar7 = 0; -LAB_00644f55: - if ((uVar7 == 0) && ((pbVar14[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_00644f81; - } - bVar5 = ANM2::SetAnimation(sprite,&DAT_00b1e7b0,1); - if (bVar5 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_00644f81: - if ((this->_sprite)._animState._animData != (void *)0x0) { - bVar5 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,&DAT_00b1d3b0); - manager = g_manager; - if (bVar5 != 0) { - soundId = 0x4d; - seed_fart_sound_override(&soundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13bc)) = 0; - bVar5 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)); - if (bVar5 == 0) { - damageSourcePosX = (savedFamiliar->_pos).x; - damageSourcePosY = (savedFamiliar->_pos).y; - damageSourceType = savedFamiliar->_type; - damageSourceVelX = (savedFamiliar->_velocity).x; - damageSourceVariant = savedFamiliar->_variant; - damageSourceSpawnerType = savedFamiliar->_spawnerType; - damageSourceSpawnerVariant = savedFamiliar->_spawnerVariant; - damageSourceVelY = (savedFamiliar->_velocity).y; - if ((savedFamiliar->_flags & 0x20000000) == 0) { - uVar7 = 0; - } - else { - uVar7 = 2; - } - if ((savedFamiliar->_flags & 0x40000000000000) == 0) { - uVar8 = 0; - } - else { - uVar8 = 4; - } - damageSourceFlags = uVar8 | uVar7 | GHIDRA_UINT(((savedFamiliar->_flags & 0x100) != 0)); - local_58._type = GHIDRA_INT(savedFamiliar); - (**(code **)(*GHIDRA_CAST(this->_player) + 0x20))(0x3f800000,0x2002800,0,&damageSourceType,0x1e); - this = pEStack_11c; - sourceRef = (GHIDRA_CAST((&local_58)))->EntityRef::EntityRef(); - (*extraout_EDX)(sourceRef); - uVar7 = Random(); - playerPos.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - playerPos.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - Game::SpawnEx(g_game,1000,2,&playerPos,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar7,0); - local_114 = 3; - do { - uVar7 = Random(); - fVar13 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - piStack_120 = GHIDRA_CAST((fVar13 + fVar13)); - uVar7 = Random(); - pEStack_11c = (Entity_Familiar *) - ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) - * 2.3283064e-10 * 15.0 + 6.0); - burstX = cos((float)piStack_120); - burstX = burstX * (float)pEStack_11c; - burstY = sin((float)piStack_120); - burstY = burstY * (float)pEStack_11c; - uVar8 = Random(); - particleIndex = 0; - savedParticleIndex = 0; - uVar7 = (uVar8 & 1) + 1; - directSpawnCount = uVar7; - rngResult = Random(); - particleCount = (uVar8 & 1) + 5 + rngResult % 6; - if (particleCount != 0) { - do { - uVar8 = Random(); - pGStack_100 = GHIDRA_CAST((((float)((double)GHIDRA_INT(uVar8) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 10.0 - 5.0) * 0.017453292)); - fStack_104 = cos((float)pGStack_100); - pGStack_100 = GHIDRA_CAST(sin((float)pGStack_100)); - uVar8 = Random(); - fStack_e0 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)] - ) * 2.3283064e-10; - particleVelX = (burstX * fStack_104 - burstY * (float)pGStack_100) * fStack_e0; - fStack_e0 = (burstX * (float)pGStack_100 + burstY * fStack_104) * fStack_e0; - particlePos.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) + particleVelX; - particlePos.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) + fStack_e0; - particleVelocity.x = particleVelX; - particleVelocity.y = fStack_e0; - fVar13 = (float)Random(); - if (particleIndex < uVar7) { - slowVelocity.x = particleVelX * 0.2; - slowVelocity.y = fStack_e0 * 0.2; - spawned = Game::SpawnEx(g_game,1000,5,&particlePos,&slowVelocity,GHIDRA_CAST(0x0),0, - GHIDRA_UINT(fVar13),0); - spawned->Update(); - savedParticleIndex = particleIndex; - } - else { - pGStack_100 = g_game; - spawnSubType = 99; - pEStack_11c = GHIDRA_CAST(&DAT_00000005); - spawnType = 1000; - fStack_104 = fVar13; - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&spawnType),GHIDRA_CAST(&pEStack_11c),&particlePos,&particleVelocity, - GHIDRA_CAST(0x0),GHIDRA_CAST(&spawnSubType),GHIDRA_CAST(&fStack_104)); - spawnVariant = pEStack_11c; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_00645675: - finalSubType = spawnSubType; - } - else { - piVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - piStack_120 = piVar10; - uVar8 = Random(); - uVar7 = spawnSubType; - rngShifts = 0x900000005; - pEStack_118 = GHIDRA_CAST(&DAT_00000007); - rngShift3 = 7; - if (spawnType != 5) goto LAB_00645675; - if (spawnVariant < GHIDRA_CAST(0x12d)) { - if (spawnVariant == GHIDRA_CAST(0x12c)) { - while ((finalSubType = spawnSubType, spawnSubType == 0 || - (cVar6 = (**(code **)(*piVar10 + 0x24))(spawnSubType), cVar6 != '\0'))) - { - if (uVar8 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar8 = uVar8 >> ((uint8_t)rngShifts & 0x1f) ^ uVar8; - uVar8 = uVar8 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar8; - uVar8 = uVar8 >> ((uint8_t)pEStack_118 & 0x1f) ^ uVar8; - iVar9 = ItemPool::GetCardEx(uVar8,0x19,10,10,1); - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._shift3 = 7; - cardRng._seed = uVar8; - spawnSubType = lua_callback_run_get_card(&cardRng,iVar9,1,1,0); - } - } - else { - if (spawnVariant == GHIDRA_CAST(0x46)) { - uStack_f0 = spawnSubType >> 0xb; - do { - finalSubType = spawnSubType; - if (spawnSubType != 0) { - pcVar1 = *(code **)(*piVar10 + 0x28); - iVar9 = ItemPool::GetPillEffect - (&g_game->_itemPool,spawnSubType,GHIDRA_CAST(0x0)) - ; - cVar6 = (*pcVar1)(iVar9); - if (cVar6 == '\0') goto LAB_0064567d; - piVar10 = piStack_120; - } - if (uVar8 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar8 = uVar8 >> ((uint8_t)rngShifts & 0x1f) ^ uVar8; - uVar8 = uVar8 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar8; - uVar8 = uVar8 >> ((uint8_t)pEStack_118 & 0x1f) ^ uVar8; - spawnSubType = ItemPool::GetPill(uVar8); - spawnSubType = spawnSubType | (uStack_f0 & 1) << 0xb; - } while( true ); - } - if (spawnVariant != GHIDRA_CAST(0x64)) goto LAB_00645675; - finalSubType = spawnSubType; - if (spawnSubType == 0x19) { -LAB_006454c5: - bVar12 = false; - } - else { - itemKey = spawnSubType; - msvc::set::find_node(&local_58._spawnerType,&itemKey); - if (((*GHIDRA_CAST((GHIDRA_CAST(local_58._position.x) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(local_58._position.x) + 0x10)) <= GHIDRA_INT(uVar7))) && - (local_58._position.x != (float)piVar10[8])) goto LAB_006454c5; - bVar12 = true; - } - if ((uVar7 == 0) || (bVar12)) { - spawnSubType = (**(code **)(*piVar10 + 0x84))(0); - finalSubType = spawnSubType; - } - } - } - else { - if (spawnVariant != GHIDRA_CAST(0x15e)) goto LAB_00645675; - while ((finalSubType = spawnSubType, spawnSubType == 0 || - (cVar6 = (**(code **)(*piVar10 + 0x2c))(spawnSubType), cVar6 != '\0'))) { - spawnSubType = ItemPool::GetTrinket(&g_game->_itemPool,0); - } - } - } -LAB_0064567d: - pEStack_118 = (GHIDRA_CAST((pGStack_100->_entityFactory)))->EntityFactory::Create(spawnType,0); - if (pEStack_118 != GHIDRA_CAST(0x0)) { - timeNs = GetTimeNs(); - spawned = pEStack_118; - uStack_f0 = GHIDRA_UINT((timeNs >> 0x20)); - lVar2 = (timeNs & 0xffffffff) * 0x431bde82; - iStack_110 = GHIDRA_INT(((uint64_t)lVar2 >> 0x20)); - lVar3 = (uint64_t)uStack_f0 * 0xd7b634db + - ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar8 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - uVar7 = iStack_110 + GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar2),GHIDRA_UINT(lVar3))); - lVar2 = (uint64_t)uStack_f0 * 0x431bde82 + - (uint64_t)CONCAT14(CARRY4(uVar8,uVar7),uVar8 + uVar7); - uStack_c8 = GHIDRA_UINT(((uint64_t)lVar2 >> 0x20)); - spawnerSlot = &pEStack_118->_spawnerEntity; - piStack_120 = GHIDRA_CAST((GHIDRA_UINT(lVar2) >> 0x12 | uStack_c8 * 0x4000)); - uStack_c8 = uStack_c8 >> 0x12; - pEStack_118->_spawnerType = 0; - pEStack_118->_spawnerVariant = 0; - if (*spawnerSlot != 0) { - spawnerRefArg = spawnerSlot; - msvc::multiset::erase(&spawnerRefArg); - } - iVar9 = *GHIDRA_CAST(spawned); - *spawnerSlot = 0; - (spawned->_pos).x = particlePos.x; - (spawned->_pos).y = particlePos.y; - (spawned->_velocity).x = particleVelX; - (spawned->_velocity).y = fStack_e0; - (**(code **)(iVar9 + 4))(spawnType,pEStack_11c,finalSubType,fStack_104); - game = pGStack_100; - pvVar11 = pGStack_100->_room; - iVar9 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)) = iVar9 + 1; - spawned->_index = iVar9; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar11) + 0x1218)))))->EntityList::AddEntity(spawned); - bVar5 = Game::ShouldEraseEnemy(spawned); - if (bVar5 != 0) { - Entity::RemoveWithPoof(spawned,unusedArg); - } - if ((spawned->_exists != 0) && - ((game->_proceduralItemManager)._proceduralItems._begin != - (game->_proceduralItemManager)._proceduralItems._end)) { - variantKey = spawned->_variant; - iVar9 = spawned->_type; - typeKey = iVar9; - msvc::map::find(&triggerNode,&typeKey); - if (triggerNode == (game->_proceduralItemManager)._spawnTriggerTargets._head) { - wildcardKey[1] = 0xffffffff; - wildcardKey[0] = iVar9; - piVar10 = GHIDRA_CAST(std)::map::find - (&local_58._variant,wildcardKey); - triggerNode = (void *)*piVar10; - if (triggerNode == (game->_proceduralItemManager)._spawnTriggerTargets._head) - goto LAB_006458e9; - } - uVar7 = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - pvVar11 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar11) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,(uint8_t *) - "PlayerManager::GetPlayer() : There are no players! \n" - ); - pvVar11 = (playerManager->_playerList)._end; - } - piVar10 = (playerManager->_playerList)._begin; - if (uVar7 < GHIDRA_UINT((GHIDRA_INT(pvVar11) - GHIDRA_INT(piVar10) >> 2))) { - piVar10 = piVar10 + uVar7; - } - trigger_set_dispatch - ((void *)(*piVar10 + 0x1fc8),6,spawned,&particlePos, - &particleVelocity); - uVar7 = uVar7 + 1; - playerManager = &g_game->_playerManager; - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } -LAB_006458e9: - timeNs = GetTimeNs(); - uVar7 = GHIDRA_UINT((timeNs >> 0x20)); - lVar2 = (timeNs & 0xffffffff) * 0x431bde82; - uStack_f0 = GHIDRA_UINT(((uint64_t)lVar2 >> 0x20)); - lVar3 = (uint64_t)uVar7 * 0x431bde82; - iStack_110 = GHIDRA_INT(lVar3); - lVar4 = (uint64_t)uVar7 * 0xd7b634db + - ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - pGStack_100 = GHIDRA_CAST((lVar4 + lVar2)); - lVar3 = lVar3 + (uint64_t) - CONCAT14(CARRY4(GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)), - uStack_f0 + CARRY4(GHIDRA_UINT(lVar2),GHIDRA_UINT(lVar4))), - GHIDRA_INT(((uint64_t)(lVar4 + lVar2) >> 0x20))); - uVar8 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - piVar10 = GHIDRA_CAST((GHIDRA_UINT(lVar3) >> 0x12 | uVar8 * 0x4000)); - uVar7 = GHIDRA_INT(piVar10) - GHIDRA_INT(piStack_120); - bVar12 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar7); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar7; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + - (((uVar8 >> 0x12) - uStack_c8) - GHIDRA_UINT((piVar10 < piStack_120))) + - GHIDRA_UINT(bVar12); - } - spawned = pEStack_118; - pEStack_118->Update(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x4)))) = 0xc1000000; - uVar7 = directSpawnCount; - this = savedFamiliar; - } - particleIndex = savedParticleIndex + 1; - savedParticleIndex = particleIndex; - } while (GHIDRA_INT(particleIndex) < particleCount); - } - local_114 = local_114 + -1; - } while (local_114 != 0); - sprite = &this->_sprite; - local_114 = 0; - } - uVar7 = Random(); - spawned = Game::SpawnEx(g_game,1000,6,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7,0); - Isaac::SwapANM2(&spawned->_sprite,sprite); - iVar9 = *GHIDRA_CAST(spawned); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x40)))) = 1; - (**(code **)(iVar9 + 0xc))(); - (GHIDRA_CAST((this->_player)))->Entity_Player::RemoveCollectible(0x290,0,0,1); - this->Remove(); - return; - } - } - return; -} - -// 006470c0 -void * Entity_Familiar::get_item_config_entry() -{ - void *pvVar1; - - if (this->_variant == 0xe7) { - pvVar1 = ItemConfig::get_wisp_entry(this->_subtype,this->_coins); - return pvVar1; - } - pvVar1 = ItemConfig::get_wisp_entry(0x19,0); - return pvVar1; -} - -// 00647170 -uint8_t Entity_Familiar::abyss_locust_eat() -{ - uint32_t uVar1; - int locustData; - uint32_t *appendResult; - uint8_t bVar2; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint8_t extraout_CL_01; - uint8_t *cursor; - void *pvVar3; - void *spritesheetPath; - char acStack_60 [4]; - char acStack_5c [4]; - char acStack_58 [8]; - uint32_t uStack_50; - void *gfxRoot [4]; - uint32_t local_3c; - uint32_t local_38; - uint8_t fileName [32]; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af7125; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_UINT((fileName + 0x30)); - ExceptionList = &local_10; - local_14 = uVar1; - if (this->_variant != 0xe7) { - KAGE_LogMessage(0x10,GHIDRA_CAST("This should only be called on a locust\n")); - } - locustData = __RTDynamicCast(this->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData:: - RTTI_Type_Descriptor, - &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0,uVar1); - if (*GHIDRA_CAST((locustData + 0x50)) < 0x19) { - bVar2 = *GHIDRA_CAST((locustData + 0x50)) + 1; - *GHIDRA_CAST((locustData + 0x50)) = bVar2; - if (GHIDRA_UINT(bVar2) % 5 == 1) { - sprintf(fileName,GHIDRA_CAST("hungry_%d.png")); - (GHIDRA_CAST((GHIDRA_CAST(gfxRoot))))->msvc::string::string(&(g_manager->_itemConfig)._wispGfxRoot); - cursor = fileName; - local_8 = 0; - do { - bVar2 = *cursor; - cursor = cursor + 1; - } while (bVar2 != 0); - appendResult = (GHIDRA_CAST((GHIDRA_CAST(gfxRoot))))->msvc::string::append(fileName,GHIDRA_INT(cursor) - GHIDRA_INT((fileName + 1))) - ; - spritesheetPath = (void *)*appendResult; - acStack_60 = (char [4])appendResult[1]; - acStack_5c = (char [4])appendResult[2]; - (*GHIDRA_CAST((GHIDRA_CAST(&(acStack_58)) + 0x0))) = appendResult[3]; - unique0x0000a400 = *GHIDRA_CAST((appendResult + 4)); - appendResult[4] = 0; - appendResult[5] = 0xf; - *GHIDRA_CAST(appendResult) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST(&spritesheetPath)); - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - bVar2 = extraout_CL; - if (0xf < uStack_50) { - uVar1 = uStack_50 + 1; - pvVar3 = spritesheetPath; - if (0xfff < uVar1) { - pvVar3 = *(void **)(GHIDRA_CAST(spritesheetPath) + -4); - uVar1 = uStack_50 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(spritesheetPath) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_006472d2; - } - operator_delete(pvVar3,uVar1); - bVar2 = extraout_CL_00; - } - local_8 = -1; - if (0xf < local_38) { - uVar1 = local_38 + 1; - pvVar3 = gfxRoot[0]; - if (0xfff < uVar1) { - pvVar3 = *(void **)(GHIDRA_INT(gfxRoot[0]) + -4); - uVar1 = local_38 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(gfxRoot[0]) + (-4 - GHIDRA_INT(pvVar3))))) { -LAB_006472d2: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar3,uVar1); - bVar2 = extraout_CL_01; - } - local_3c = 0; - local_38 = 0xf; - gfxRoot[0] = (void *)(GHIDRA_UINT(gfxRoot[0]) & 0xffffff00); - ANM2::LoadGraphics(&this->_sprite,bVar2); - } - bVar2 = 1; - } - else { - bVar2 = 0; - } - ExceptionList = local_10; - return bVar2; -} - -// 0064a2d0 -uint8_t Entity_Familiar::break_grid_ahead() -{ - float fVar1; - char cVar2; - int gridY; - int gridY; - void *pvVar4; - uint32_t rngValue; - float fVar5; - Vector *gridPos; - int iVar6; - uint32_t uVar7; - float *tearEffectEntry; - uint32_t uVar8; - uint32_t tearFlags1; - uint32_t tearFlags3; - uint32_t rolledEffectMask; - uint32_t tearFlags2; - uint32_t tearFlags0; - Vector local_68; - Vector local_60; - Vector local_58; - uint32_t uStack_50; - uint32_t uStack_4c; - uint32_t uStack_48; - uint32_t uStack_44; - int sourceRef; - int iStack_34; - int iStack_30; - int iStack_2c; - float fStack_28; - float fStack_24; - float fStack_20; - float fStack_1c; - uint32_t uStack_18; - Entity_Familiar *pEStack_14; - GridEntity *gridEntity; - Room *room; - - fVar1 = (this->_velocity).y; - fVar5 = (this->_velocity).x; - local_58.x = (float)((10.0 < this->_collisionDamage) + 1); - local_60.x = (float)&this->_velocity; - iVar6 = GHIDRA_INT((((fVar5 + fVar5 + (this->_pos).x) - 40.0) / 40.0 + 0.5)); - if ((((iVar6 < 0) || (gridY = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)), gridY <= iVar6)) || - (gridY = GHIDRA_INT((((fVar1 + fVar1 + (this->_pos).y) - 120.0) / 40.0 + 0.5)), gridY < 0)) || - ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x10)) <= gridY || (iVar6 = gridY * gridY + iVar6, iVar6 < 0)))) - { - return 0; - } - local_68.x = (float)this; - gridY = __RTDynamicCast(this->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, - &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0); - if (gridY != 0) { - if (*GHIDRA_CAST((gridY + 0x3c)) == iVar6) { - return 0; - } - *GHIDRA_CAST((gridY + 0x3c)) = iVar6; - } - if (0x1bf < iVar6) { - return 0; - } - gridEntity = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + iVar6 * 4 + 0x24)); - if (gridEntity == GHIDRA_CAST(0x0)) { - return 0; - } - if (gridEntity->_collisionClass == 1) { - return 0; - } - if (gridEntity->_collisionClass == 0) { - return 0; - } - pvVar4 = get_item_config_entry(this); - uVar7 = 0; - rolledEffectMask = 0; - tearFlags0 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 8)); - tearFlags1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xc)); - tearFlags2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x10)); - tearFlags3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x14)); - tearEffectEntry = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x68)); - uStack_50 = tearFlags0; - uStack_4c = tearFlags1; - uStack_48 = tearFlags2; - uStack_44 = tearFlags3; - if (tearEffectEntry != *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x6c))) { - uVar8 = 1; - do { - if (((uVar7 & uVar8) == 0) && (0.0 < *tearEffectEntry)) { - rngValue = Random(); - uVar7 = rolledEffectMask; - if ((float)((double)GHIDRA_INT(rngValue) + __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10 < *tearEffectEntry) { - tearFlags0 = tearFlags0 | GHIDRA_UINT(tearEffectEntry[2]); - tearFlags1 = tearFlags1 | GHIDRA_UINT(tearEffectEntry[3]); - tearFlags2 = tearFlags2 | GHIDRA_UINT(tearEffectEntry[4]); - tearFlags3 = tearFlags3 | GHIDRA_UINT(tearEffectEntry[5]); - rolledEffectMask = rolledEffectMask | GHIDRA_UINT(tearEffectEntry[7]); - uVar7 = rolledEffectMask; - } - } - tearEffectEntry = tearEffectEntry + 0x1a; - uVar8 = uVar8 << 1 | GHIDRA_UINT((GHIDRA_INT(uVar8) < 0)); - } while (tearEffectEntry != *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x6c))); - } - cVar2 = gridEntity->CanTakeDamageFromTearEffects(); - fVar1 = local_68.x; - if (cVar2 != '\0') { - if (((tearFlags0 & GHIDRA_UINT(g_tearFlagAcid._l)) == 0 && (tearFlags1 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAcid._l)) + 0x4)))) == 0) - && ((tearFlags2 & GHIDRA_UINT(g_tearFlagAcid._h)) == 0 && - (tearFlags3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAcid._h)) + 0x4)))) == 0)) { - if (((tearFlags0 & GHIDRA_UINT(g_tearFlagRock._l)) == 0 && - (tearFlags1 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRock._l)) + 0x4)))) == 0) && - ((tearFlags2 & GHIDRA_UINT(g_tearFlagRock._h)) == 0 && (tearFlags3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRock._h)) + 0x4)))) == 0 - )) goto LAB_0064a73c; - } - fStack_28 = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x33c)))->x; - fStack_24 = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x33c)))->y; - fStack_20 = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x360)))->x; - sourceRef = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x28)); - iStack_34 = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x2c)); - iStack_30 = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x34)); - iStack_2c = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x38)); - fStack_1c = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x360)))->y; - if ((*GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x168)) & 0x20000000) == 0) { - uVar7 = 0; - } - else { - uVar7 = 2; - } - fVar5 = (float)(*GHIDRA_CAST((GHIDRA_INT((GHIDRA_INT(local_68.x) + 0x168)) + 4)) & 0x400000); - if (fVar5 == 0.0) { - uVar8 = 0; - } - else { - uVar8 = 4; - } - pEStack_14 = GHIDRA_CAST(local_68.x); - uStack_18 = uVar8 | uVar7 | GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x168)) & 0x100) != 0)); - local_68.x = fVar5; - cVar2 = gridEntity->Destroy(0,&sourceRef); - if (cVar2 != '\0') { - Vector::ToCardinal(&local_58,GHIDRA_CAST(local_60.x)); - if ((local_58.x == g_vectorZero.x) && (local_58.y == g_vectorZero.y)) { - return 1; - } - gridPos = (GHIDRA_CAST((gridEntity)))->GridEntity::Position(&local_68); - local_60.x = local_58.x * 40.0 + gridPos->x; - local_60.y = local_58.y * 40.0 + gridPos->y; - room = g_game->_room; - iVar6 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&local_60); - if (iVar6 < 0) { - return 1; - } - if (iVar6 < 0x1c0) { - (GHIDRA_CAST((room)))->Room::TryMakeBridge(room->_gridEntities[iVar6],gridEntity); - return 1; - } - (GHIDRA_CAST((room)))->Room::TryMakeBridge(GHIDRA_CAST(0x0),gridEntity); - return 1; - } - } -LAB_0064a73c: - fStack_28 = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x33c)))->x; - fStack_24 = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x33c)))->y; - local_68.x = *GHIDRA_CAST((*GHIDRA_CAST(gridEntity) + 0x10)); - sourceRef = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x28)); - iStack_34 = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x2c)); - iStack_30 = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x34)); - iStack_2c = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x38)); - fStack_20 = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x360)))->x; - fStack_1c = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x360)))->y; - if ((*GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x168)) & 0x20000000) == 0) { - uVar7 = 0; - } - else { - uVar7 = 2; - } - local_60.x = (float)(*GHIDRA_CAST((GHIDRA_INT((GHIDRA_INT(fVar1) + 0x168)) + 4)) & 0x400000); - if (local_60.x == 0.0) { - uVar8 = 0; - } - else { - uVar8 = 4; - } - pEStack_14 = GHIDRA_CAST(fVar1); - uStack_18 = uVar8 | uVar7 | GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x168)) & 0x100) != 0)); - (*(code *)local_68.x)(local_58.x,&sourceRef); - return 1; -} - -// 0064a830 -void Entity_Familiar::load_config_graphics() -{ - uint8_t bVar1; - uint32_t uVar2; - void *wispEntry; - uint8_t *pbVar3; - uint32_t animCompare; - int iVar4; - uint32_t *appendedPath; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint8_t extraout_CL_01; - int collectibleId; - std_string *animNameCursor; - void *freeBlock; - bool isLess; - std_string *defaultAnim; - void *sheetPath; - char acStack_70 [4]; - char acStack_6c [4]; - char acStack_68 [8]; - uint32_t sheetPathCapacity; - void *basePath [4]; - uint32_t basePathSize; - uint32_t basePathCapacity; - uint8_t sheetFileName [32]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - - puStack_20 = sheetFileName + 0x40; - local_14 = -1; - puStack_18 = &LAB_00af7285; - local_1c = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((sheetFileName + 0x34)); - ExceptionList = &local_1c; - if (this->_variant == 0xe7) { - iVar4 = this->_coins; - collectibleId = this->_subtype; - } - else { - collectibleId = 0x19; - iVar4 = 0; - } - local_24 = uVar2; - wispEntry = ItemConfig::get_wisp_entry(collectibleId,iVar4); - if (this->_config == (void *)0x0) goto LAB_0064aa74; - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); - defaultAnim = &(this->_sprite)._animDefaultName; - if (0xf < (this->_sprite)._animDefaultName._capacity) { - defaultAnim = *GHIDRA_CAST(defaultAnim->_buf); - } - pbVar3 = (this->_sprite)._animState._animData; - if (pbVar3 == GHIDRA_CAST(0x0)) { -LAB_0064a90e: - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(defaultAnim),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - if (0xf < *GHIDRA_CAST((pbVar3 + 0x14))) { - pbVar3 = *GHIDRA_CAST(pbVar3); - } - animNameCursor = defaultAnim; - do { - bVar1 = *pbVar3; - isLess = bVar1 < (uint8_t)animNameCursor->_buf[0]; - if (bVar1 != animNameCursor->_buf[0]) { -LAB_0064a8f6: - animCompare = -GHIDRA_UINT(isLess) | 1; - goto LAB_0064a8fb; - } - if (bVar1 == 0) break; - bVar1 = pbVar3[1]; - isLess = bVar1 < (uint8_t)animNameCursor->_buf[1]; - if (bVar1 != animNameCursor->_buf[1]) goto LAB_0064a8f6; - pbVar3 = pbVar3 + 2; - animNameCursor = GHIDRA_CAST((animNameCursor->_buf + 2)); - } while (bVar1 != 0); - animCompare = 0; -LAB_0064a8fb: - if ((animCompare != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && - ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_0064a90e; - } - iVar4 = __RTDynamicCast(this->_extraData,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, - &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0,uVar2); - if (((*GHIDRA_CAST((iVar4 + 0x18)) | *GHIDRA_CAST((GHIDRA_CAST(wispEntry) + 0x18))) & 0x40000) != 0) { - sprintf(sheetFileName,GHIDRA_CAST("hungry_%d.png")); - (GHIDRA_CAST((GHIDRA_CAST(basePath))))->msvc::string::string(&(g_manager->_itemConfig)._wispGfxRoot); - pbVar3 = sheetFileName; - local_14 = 0; - do { - bVar1 = *pbVar3; - pbVar3 = pbVar3 + 1; - } while (bVar1 != 0); - appendedPath = (GHIDRA_CAST((GHIDRA_CAST(basePath))))->msvc::string::append(sheetFileName, - GHIDRA_INT(pbVar3) - GHIDRA_INT((sheetFileName + 1))); - sheetPath = (void *)*appendedPath; - acStack_70 = (char [4])appendedPath[1]; - acStack_6c = (char [4])appendedPath[2]; - (*GHIDRA_CAST((GHIDRA_CAST(&(acStack_68)) + 0x0))) = appendedPath[3]; - unique0x0000a400 = *GHIDRA_CAST((appendedPath + 4)); - appendedPath[4] = 0; - appendedPath[5] = 0xf; - *GHIDRA_CAST(appendedPath) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST(&sheetPath)); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - bVar1 = extraout_CL; - if (0xf < sheetPathCapacity) { - uVar2 = sheetPathCapacity + 1; - freeBlock = sheetPath; - if (0xfff < uVar2) { - freeBlock = *(void **)(GHIDRA_CAST(sheetPath) + -4); - uVar2 = sheetPathCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(sheetPath) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0064aa4a; - } - operator_delete(freeBlock,uVar2); - bVar1 = extraout_CL_00; - } - local_14 = -1; - if (0xf < basePathCapacity) { - uVar2 = basePathCapacity + 1; - freeBlock = basePath[0]; - if (0xfff < uVar2) { - freeBlock = *(void **)(GHIDRA_INT(basePath[0]) + -4); - uVar2 = basePathCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(basePath[0]) + (-4 - GHIDRA_INT(freeBlock))))) { -LAB_0064aa4a: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar2); - bVar1 = extraout_CL_01; - } - basePathSize = 0; - basePathCapacity = 0xf; - basePath[0] = (void *)(GHIDRA_UINT(basePath[0]) & 0xffffff00); - ANM2::LoadGraphics(&this->_sprite,bVar1); - } -LAB_0064aa74: - anm2_apply_gfx_overrides - (GHIDRA_CAST((GHIDRA_INT(wispEntry) + 0x84)),GHIDRA_CAST((GHIDRA_INT(wispEntry) + 0x9c)), - &this->_sprite); - ExceptionList = local_1c; - return; -} - -// 0064b6c0 -void Entity_Familiar::render_abyss_locust_sprite(ANM2 *param_2, float *param_3) -{ - void *wispEntry; - int collectibleId; - int index; - float fVar1; - float fVar2; - double dVar3; - Vector screenPos [8]; - - if (param_2->_loaded != 0) { - fVar1 = (param_2->_color)._tint[3]; - if (this->_state == -1) { - fVar1 = fVar1 + 0.04; - fVar2 = 1.0; - if (fVar1 <= 1.0) { - fVar2 = fVar1; - } - } - else { - fVar1 = fVar1 - 0.04; - fVar2 = 0.0; - if (0.0 <= fVar1) { - fVar2 = fVar1; - } - if (fVar2 == 0.0) { - ANM2::Reset(param_2); - return; - } - } - (param_2->_color)._tint[3] = fVar2; - if (0.0 < fVar2) { - if (this->_variant == 0xe7) { - collectibleId = this->_subtype; - index = this->_coins; - } - else { - collectibleId = 0x19; - index = 0; - } - wispEntry = ItemConfig::get_wisp_entry(collectibleId,index); - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(wispEntry) + 0x78)) * 0.45; - fVar1 = (this->_sizeMulti).x; - (param_2->_scale).y = fVar2 * (this->_sizeMulti).y; - (param_2->_scale).x = fVar2 * fVar1; - if (param_2->_loaded != 0) { - AnimationState::Update(¶m_2->_animState); - AnimationState::Update(¶m_2->_overlayAnimState); - } - fVar1 = g_displayPixelRatio * g_screenPointScale; - dVar3 = floor((double)(((((this->_pos).x + 0.0) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5 - ) * fVar1 + 0.5)); - screenPos[0].x = (float)dVar3 / fVar1; - dVar3 = floor((double)(((((this->_pos).y - 25.0) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * fVar1 + 0.5)); - screenPos[0].x = screenPos[0].x + *param_3; - screenPos[0].y = (float)dVar3 / fVar1 + param_3[1]; - ANM2::Render(param_2,screenPos,&g_vectorZero,&g_vectorZero); - } - } - return; -} - -// 0064b920 -void Entity_Familiar::siren_charm(Entity *siren, Entity_Player *player) -{ - uint32_t uVar1; - uint32_t seed; - Entity *sirenHelper; - uint32_t *helperRef; - Entity_Familiar *local_c [2]; - int *collectibleCount; - - if (this->_sirenOriginalPlayer == (void *)0x0) { - this->_sirenOriginalPlayer = this->_player; - } - local_c[0] = this; - if (this->_player != player) { - set_player(this,player); - } - this->_fireCooldown = 0x2d; - if (this->_target != 0) { - local_c[0] = GHIDRA_CAST(&this->_target); - msvc::multiset::erase(local_c); - } - this->_target = 0; - seed = Random(); - sirenHelper = Game::SpawnEx(g_game,0x3c6,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - if (sirenHelper->_parent != 0) { - local_c[0] = GHIDRA_CAST(&sirenHelper->_parent); - msvc::multiset::erase(local_c); - } - sirenHelper->_parent = siren; - if (siren != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&sirenHelper->_parent); - } - if (sirenHelper->_target != 0) { - local_c[0] = GHIDRA_CAST(&sirenHelper->_target); - msvc::multiset::erase(local_c); - } - sirenHelper->_target = this; - msvc::multiset::insert(&sirenHelper->_target); - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&sirenHelper->_flags) + 4)); - *GHIDRA_CAST(&sirenHelper->_flags) = GHIDRA_UINT(sirenHelper->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&sirenHelper->_flags) + 4)) = uVar1; - sirenHelper->_health = sirenHelper->_maxHitPoints; - sirenHelper->Update(); - if (this->_variant == 0x41) { - collectibleCount = GHIDRA_CAST((GHIDRA_INT((player->_collectibleCounts)._begin) + 0x45c)); - *collectibleCount = *collectibleCount + 1; - } - else if (this->_variant == 0x20) { - collectibleCount = GHIDRA_CAST((GHIDRA_INT((player->_collectibleCounts)._begin) + 0x1c0)); - *collectibleCount = *collectibleCount + 1; - } - this->_sirenCharmFrames = 1; - helperRef = &this->_sirenHelper; - if (GHIDRA_CAST(*helperRef) != sirenHelper) { - if (GHIDRA_CAST(*helperRef) != GHIDRA_CAST(0x0)) { - local_c[0] = GHIDRA_CAST(helperRef); - msvc::multiset::erase(local_c); - } - *helperRef = sirenHelper; - msvc::multiset::insert(helperRef); - } - return; -} - -// 0064bab0 -void Entity_Familiar::RemoveFromPlayer() -{ - int *local_8; - int *familiarCounter; - void *player; - uint32_t *sirenHelperRef; - - if (this->_sirenOriginalPlayer != (void *)0x0) { - player = this->_player; - if (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x170)) == '\0') { - if (this->_variant == 0x41) { - familiarCounter = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x16c8)) + 0x45c)); - *familiarCounter = *familiarCounter + -1; - } - else if (this->_variant == 0x20) { - familiarCounter = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x16c8)) + 0x1c0)); - *familiarCounter = *familiarCounter + -1; - } - } - set_player(this,this->_sirenOriginalPlayer); - } - sirenHelperRef = &this->_sirenHelper; - this->_sirenCharmFrames = 0; - this->_sirenOriginalPlayer = (void *)0x0; - if (GHIDRA_CAST(this->_sirenHelper) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_sirenHelper) + 0x28))(); - if (*sirenHelperRef != 0) { - local_8 = sirenHelperRef; - msvc::multiset::erase(&local_8); - *sirenHelperRef = 0; - } - } - if (this->_variant == 0xdc) { - this->Remove(); - } - return; -} - -// 0064ca30 -void Entity_Familiar::UpdateDirtColor(uint8_t Immediate) -{ - float fVar1; - float fVar2; - float fVar3; - uint8_t bVar4; - LayerState *layer; - ColorMod *lerpedColor; - uint8_t *****pppppbVar5; - uint8_t *****pppppbVar6; - uint32_t uVar7; - ColorMod *layerColor; - uint32_t freeSize; - ColorMod lerpResult; - ANM2 *sprite; - Entity_Familiar *familiar; - ColorMod *dirtColor; - LayerState *currentLayer; - uint8_t *****layerNameBuf; - uint32_t local_64; - uint8_t *layerIndex; - char isDirtLayer; - uint32_t cleanupFlags; - uint8_t *****layerName [4]; - uint32_t layerNameSize; - uint32_t layerNameCapacity; - uint8_t *****layerNameCopy; - KColor local_38; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint8_t ****local_14; - - puStack_20 = GHIDRA_CAST((layerName + 0x14)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00af739e; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((layerName + 0x11)); - ExceptionList = &local_1c; - local_64 = 0; - cleanupFlags = 0; - familiar = this; - (GHIDRA_CAST((g_game->_room)))->Room::GetFloorColorAt(&local_38,&this->_pos,this->_size); - dirtColor = &this->_dirtColor; - (this->_dirtColor)._tint[3] = 1.0; - dirtColor->_tint[0] = local_38._red * 2.0; - (this->_dirtColor)._tint[1] = local_38._green * 2.0; - (this->_dirtColor)._tint[2] = local_38._blue * 2.0; - layerIndex = GHIDRA_CAST(0x0); - if ((this->_sprite)._layerCount == 0) { - ExceptionList = local_1c; - return; - } - sprite = &this->_sprite; - do { - layer = ANM2::GetLayer(sprite,layerIndex); - cleanupFlags = cleanupFlags | 4; - currentLayer = layer; - if (layer->_layerData == (void *)0x0) { - layerNameCapacity = 0xf; - layerNameSize = 0; - layerName[0] = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(layerName))))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); - } - local_14 = GHIDRA_CAST(0x0); - local_64 = cleanupFlags | 1; - pppppbVar6 = GHIDRA_CAST(layerName); - if (0xf < layerNameCapacity) { - pppppbVar6 = layerName[0]; - } - layerNameBuf = layerName[0]; - cleanupFlags = local_64; - bVar4 = str_eq(GHIDRA_CAST(pppppbVar6),layerNameSize,&DAT_00b64428,4); - if (bVar4 == 0) { - cleanupFlags = cleanupFlags | 8; - if (layer->_layerData == (void *)0x0) { - layerNameCopy = GHIDRA_CAST(0x0); - local_38._unk = 0xf; - local_38._alpha = 0.0; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&layerNameCopy))))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); - } - uVar7 = local_38._unk; - pppppbVar6 = layerNameCopy; - cleanupFlags = cleanupFlags | 2; - pppppbVar5 = GHIDRA_CAST(&layerNameCopy); - if (0xf < GHIDRA_UINT(local_38._unk)) { - pppppbVar5 = layerNameCopy; - } - bVar4 = str_eq(GHIDRA_CAST(pppppbVar5),GHIDRA_UINT(local_38._alpha),&DAT_00b1d57c,4); - if (bVar4 != 0) goto LAB_0064cbdf; - isDirtLayer = '\0'; - } - else { - pppppbVar6 = layerNameCopy; - uVar7 = local_38._unk; -LAB_0064cbdf: - isDirtLayer = '\x01'; - } - if (((cleanupFlags & 2) != 0) && (cleanupFlags = cleanupFlags & 0xfffffffd, 0xf < uVar7)) { - freeSize = uVar7 + 1; - pppppbVar5 = pppppbVar6; - if (0xfff < freeSize) { - pppppbVar5 = GHIDRA_CAST(pppppbVar6[-1]); - freeSize = uVar7 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(pppppbVar6) + (-4 - GHIDRA_INT(pppppbVar5))))) goto LAB_0064ccc7; - } - operator_delete(pppppbVar5,freeSize); - } - local_14 = GHIDRA_CAST(0xffffffff); - if (((cleanupFlags & 1) != 0) && - (cleanupFlags = cleanupFlags & 0xfffffffe, 0xf < layerNameCapacity)) { - uVar7 = layerNameCapacity + 1; - pppppbVar6 = layerNameBuf; - if (0xfff < uVar7) { - pppppbVar6 = GHIDRA_CAST(layerNameBuf[-1]); - uVar7 = layerNameCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(layerNameBuf) + (-4 - GHIDRA_INT(pppppbVar6))))) { -LAB_0064ccc7: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppbVar6,uVar7); - } - layer = currentLayer; - if (isDirtLayer != '\0') { - layerColor = ¤tLayer->_color; - lerpedColor = Color::Lerp(&lerpResult,layerColor,dirtColor,1.0); - if (layerColor != lerpedColor) { - fVar1 = lerpedColor->_tint[1]; - fVar2 = lerpedColor->_tint[2]; - fVar3 = lerpedColor->_tint[3]; - layerColor->_tint[0] = lerpedColor->_tint[0]; - (layer->_color)._tint[1] = fVar1; - (layer->_color)._tint[2] = fVar2; - (layer->_color)._tint[3] = fVar3; - fVar1 = lerpedColor->_colorize[1]; - fVar2 = lerpedColor->_colorize[2]; - fVar3 = lerpedColor->_colorize[3]; - (layer->_color)._colorize[0] = lerpedColor->_colorize[0]; - (layer->_color)._colorize[1] = fVar1; - (layer->_color)._colorize[2] = fVar2; - (layer->_color)._colorize[3] = fVar3; - fVar1 = lerpedColor->_offset[1]; - (layer->_color)._offset[0] = lerpedColor->_offset[0]; - (layer->_color)._offset[1] = fVar1; - (layer->_color)._offset[2] = lerpedColor->_offset[2]; - } - } - layerIndex = layerIndex + 1; - if (GHIDRA_CAST((familiar->_sprite)._layerCount) <= layerIndex) { - ExceptionList = local_1c; - return; - } - } while( true ); -} - -// 0064d1d0 -void Entity_Familiar::update_star_of_bethlehem_speed(uint8_t isForce) -{ - float fVar1; - float fVar2; - int fromRoomIdx; - short starPathLength; - short playerPathLength; - uint32_t toRoomIdx; - short roomDistances [194]; - uint32_t stackCookie; - - stackCookie = __security_cookie ^ GHIDRA_UINT((roomDistances + 0xc4)); - if ((isForce == 0) && - ((fVar1 = (this->_formationOffset).x, fVar1 != g_vectorZero.x || - ((this->_formationOffset).y != g_vectorZero.y)))) { - if (g_game->_currentDimensionIdx != 0) { -LAB_0064d32e: - this->_orbitAngleOffset = 0.25; - return; - } - fVar2 = (this->_formationOffset).y; - fromRoomIdx = g_game->_currentRoomIdx; - toRoomIdx = star_of_bethlehem_get_target_room(); - if (-1 < fromRoomIdx) { - starPathLength = - Level::compute_room_distances - (roomDistances,GHIDRA_INT((fVar2 + 0.5)) * 0xd + GHIDRA_INT((fVar1 + 0.5)),toRoomIdx, - GHIDRA_CAST(0x0)); - playerPathLength = - Level::compute_room_distances(roomDistances,fromRoomIdx,toRoomIdx,GHIDRA_CAST(0x0)); - if (starPathLength + 9 < GHIDRA_INT(playerPathLength)) goto LAB_0064d32e; - if (starPathLength < playerPathLength) { - this->_orbitAngleOffset = 0.5; - return; - } - if (playerPathLength + 9 < GHIDRA_INT(starPathLength)) { - this->_orbitAngleOffset = 8.0; - return; - } - if (playerPathLength < starPathLength) { - this->_orbitAngleOffset = 4.0; - return; - } - } - } - this->_orbitAngleOffset = 1.0; - return; -} - -// 0064e0c0 -void Entity_Familiar::ai_blood_clot(uint8_t isPostMove) -{ - int *piVar1; - char **ppcVar2; - uint8_t bVar3; - char isRottenHeartsPickable; - uint32_t uVar4; - uint32_t uVar5; - uint32_t rngResult; - Entity *pEVar6; - int *piVar7; - int gridCollisionClass; - LayerState *layer; - Vector *pVVar8; - Entity **ppEVar9; - void *nearbyPlayer; - Entity_Player *extraout_ECX; - Entity_Player *player; - void *nearbyEntity; - float fVar10; - float fVar11; - float fVar12; - float fVar13; - float distSq; - Entity *pEVar14; - float dx; - Entity *pEVar15; - undefined3 in_stack_00000005; - EntityRef sourceRef; - Vector local_8c; - float local_84; - uint8_t local_80 [12]; - Entity *local_74 [2]; - Entity *local_6c; - float local_68; - Entity_Familiar *selfFamiliar; - uint8_t local_60 [8]; - Vector local_58; - float local_50; - Entity *local_4c; - uint8_t isMoving; - Entity *local_44; - Entity *local_40; - Entity *local_3c; - Entity *local_38; - char *walkAnims [4]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - char *local_14; - ColorMod *effectColor; - Manager *manager; - int oldParent; - code *takeDamageFn; - - puStack_20 = GHIDRA_CAST((walkAnims + 0xc)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00af741d; - local_1c = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((walkAnims + 9)); - oldParent = this->_state; - walkAnims[0] = "WalkLeft"; - walkAnims[1] = "WalkUp"; - walkAnims[2] = "WalkRight"; - walkAnims[3] = "WalkDown"; - if (oldParent == 1) { - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) { - return; - } - if (isPostMove == 0) { - this->_entityCollisionClass = 3; - this->_state = 0; - return; - } - return; - } - ExceptionList = &local_1c; - selfFamiliar = this; - local_24 = uVar4; - if (oldParent < 2) { - ppcVar2 = walkAnims + 0xc; - if ((oldParent == -1000) && - ((ppcVar2 = walkAnims + 0xc, this->_player == (void *)0x0 || - (bVar3 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),0x2c9), - ppcVar2 = GHIDRA_CAST(puStack_20), bVar3 == 0)))) { - puStack_20 = GHIDRA_CAST(ppcVar2); - this->_state = 0; - ppcVar2 = GHIDRA_CAST(puStack_20); - } - puStack_20 = GHIDRA_CAST(ppcVar2); - player = this->_player; - local_40 = GHIDRA_CAST(g_vectorZero.x); - oldParent = player->_entityGridCollisionClass; - local_3c = GHIDRA_CAST(g_vectorZero.y); - if ((((oldParent == 0) || (oldParent == 3)) || (oldParent == 1)) || - (fVar10 = 7.00649e-45, oldParent == 2)) { - fVar10 = 4.2039e-45; - } - this->_entityGridCollisionClass = GHIDRA_INT(fVar10); - local_38 = GHIDRA_CAST(player->_movespeed); - local_4c = GHIDRA_CAST(0x3f800000); - local_50 = fVar10; - if ((player->_isControlsEnabled != 0) && (player->_controlsCooldown < 1)) { - pVVar8 = (GHIDRA_CAST((player)))->Entity_Player::GetMovementJoystick(&local_58); - local_40 = GHIDRA_CAST(pVVar8->x); - local_3c = GHIDRA_CAST(pVVar8->y); - if (((this->_flags & 0x8000) != 0) && (fVar10 == 7.00649e-45)) { - local_3c = GHIDRA_CAST(0x0); - } - fVar10 = sqrtf((float)local_3c * (float)local_3c + (float)local_40 * (float)local_40); - player = extraout_ECX; - if (((float)local_4c < fVar10) && (0.0 < fVar10)) { - local_40 = GHIDRA_CAST((((float)local_4c / fVar10) * (float)local_40)); - local_3c = GHIDRA_CAST(((float)local_3c * ((float)local_4c / fVar10))); - } - } - bVar3 = input_is_action_pressed - (0xb,GHIDRA_INT(this->_player[5]._color._colorize[0]),this->_player,GHIDRA_INT(player)); - if (bVar3 == 0) { - pEVar6 = local_3c; - } - else { - local_40 = GHIDRA_CAST(g_vectorZero.x); - pEVar6 = GHIDRA_CAST(g_vectorZero.y); - } - (this->_targetPosition).x = (float)local_40; - (this->_targetPosition).y = (float)pEVar6; - local_3c = GHIDRA_CAST(0x0); - local_44 = GHIDRA_CAST(0x0); - if (((float)local_40 != g_vectorZero.x) || ((float)pEVar6 != g_vectorZero.y)) { - local_44 = local_40; - local_3c = pEVar6; - } - this->_moveDirection = -1; - local_68 = (float)local_38 * 0.25 + 0.75; - local_40 = GHIDRA_CAST(((float)local_40 * local_68)); - local_68 = local_68 * (float)pEVar6; - if (ABS((float)local_40) <= ABS(local_68)) { - if (local_68 < 0.0) { - this->_moveDirection = 1; - goto LAB_0064eea4; - } - oldParent = this->_moveDirection; - if (0.0 < local_68) { - oldParent = 3; - } - } - else { - oldParent = 0; - if (0.0 <= (float)local_40) { - oldParent = 2; - } - } - this->_moveDirection = oldParent; -LAB_0064eea4: - uVar4 = GHIDRA_UINT(this->_flags); - local_58.x = (float)local_44; - local_58.y = (float)local_3c; - if ((((float)local_40 != 0.0) || (local_68 != 0.0)) && - (((uVar4 & 0x8000) == 0 || (local_50 != 7.00649e-45)))) { - local_74[0] = GHIDRA_CAST((this->_velocity).y); - local_8c.y = (this->_velocity).x; - fVar10 = local_68 * (float)local_74[0] + (float)local_40 * local_8c.y; - local_84 = (float)local_40 * fVar10; - local_6c = GHIDRA_CAST((fVar10 * local_68)); - fVar10 = sqrtf(0.8); - (this->_velocity).y = ((float)local_74[0] - (float)local_6c) * fVar10 + (float)local_6c; - (this->_velocity).x = (local_8c.y - local_84) * fVar10 + local_84; - uVar4 = GHIDRA_UINT(this->_flags); - } - local_6c = GHIDRA_CAST(0x0); - local_74[0] = (Entity *) - ((local_68 * (this->_velocity).y + (float)local_40 * (this->_velocity).x) * -0.2); - ppEVar9 = local_74; - if ((float)local_74[0] <= 0.0) { - ppEVar9 = &local_6c; - } - local_74[0] = GHIDRA_CAST((((float)*ppEVar9 / (float)local_38 + 3.0) * 0.4)); - fVar10 = sqrtf(0.775); - fVar12 = ((float)local_74[0] * 0.25 - (float)local_74[0]) * 0.0 + (float)local_74[0]; - fVar11 = local_68 * 0.5 * fVar12 + (this->_velocity).y; - (this->_velocity).x = ((float)local_40 * 0.5 * fVar12 + (this->_velocity).x) * fVar10; - if (((uVar4 & 0x8000) == 0) || (local_50 != 7.00649e-45)) { - fVar11 = fVar11 * fVar10; - } - else { - fVar11 = fVar11 + 0.225; - } - (this->_velocity).y = fVar11; - local_38 = _isPostMove; - if (isPostMove == 0) { - if (((float)local_44 != g_vectorZero.x) || - (isMoving = isPostMove, (float)local_3c != g_vectorZero.y)) { - isMoving = 1; - } - pEVar6 = local_44; - pEVar15 = local_3c; - fVar10 = g_vectorZero.y; - fVar11 = g_vectorZero.x; - if (this->_entityGridCollisionClass == 5) { - if (((float)local_44 == g_vectorZero.x) && ((float)local_3c == g_vectorZero.y)) { - local_40 = GHIDRA_CAST(s_Idle); - } - else { - oldParent = vector_to_direction(&local_58); - local_40 = GHIDRA_CAST(walkAnims[oldParent]); - pEVar15 = local_3c; - } - } - else { - local_40 = GHIDRA_CAST(0xb1d4d0); - } - fVar12 = 24.0; - uVar5 = -GHIDRA_UINT((this->_subtype != 0)) & this->_subtype; - uVar4 = 7; - if (uVar5 < 7) { - uVar4 = uVar5; - } - pEVar14 = *GHIDRA_CAST((&DAT_00c3423c + uVar4 * 100)); - local_3c = *GHIDRA_CAST((&DAT_00c34240 + uVar4 * 100)); - if (8 < this->_headFrameDelay) { - local_3c = GHIDRA_CAST(((float)local_3c + 24.0)); - } - local_74[0] = pEVar14; - bVar3 = CanPlayerFire(this); - if (((bVar3 == 0) || (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) == -1)) || - (this->_shootDirection == -1)) { - if (((float)pEVar6 == fVar11) && ((float)pEVar15 == fVar10)) { - fVar10 = 3.0; - } - else { - oldParent = vector_to_direction(&local_58); - fVar12 = 24.0; - fVar10 = (float)oldParent; - pEVar14 = local_74[0]; - } - local_50 = (72.0 - fVar10 * fVar12) + (float)pEVar14; - } - else { - local_50 = (72.0 - (float)this->_shootDirection * fVar12) + (float)pEVar14; - } - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (layer->_cropOffset).x = local_50; - (layer->_cropOffset).y = (float)local_3c; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - (layer->_cropOffset).x = local_50; - (layer->_cropOffset).y = (float)local_3c; - ANM2::Play(&this->_sprite,GHIDRA_CAST(local_40),0); - pEVar6 = local_4c; - if (((isMoving != 0) && - (local_74[0] = local_4c, (this->_sprite)._animState._animData != (void *)0x0)) && - ((this->_sprite)._animState._isPlaying != 0)) { - fVar10 = (this->_velocity).y; - fVar11 = (this->_velocity).x; - fVar10 = sqrtf(fVar11 * fVar11 + fVar10 * fVar10); - if (2.3 <= fVar10) { - pEVar15 = local_74[0]; - pEVar6 = local_74[0]; - } - else { - pEVar6 = GHIDRA_CAST(((fVar10 - (float)local_4c) / 1.3)); - if ((float)pEVar6 <= 0.0) { - pEVar6 = GHIDRA_CAST(0x0); - } - if ((float)local_4c <= (float)pEVar6) { - pEVar6 = local_4c; - } - pEVar15 = local_4c; - pEVar6 = GHIDRA_CAST(((float)pEVar6 * 0.5 + 0.5)); - } - if (6.0 < fVar10) { - pEVar6 = GHIDRA_CAST(((fVar10 - 6.0) * 0.25)); - if ((float)pEVar6 <= 0.0) { - pEVar6 = GHIDRA_CAST(0x0); - } - if ((float)pEVar15 <= (float)pEVar6) { - pEVar6 = pEVar15; - } - pEVar6 = GHIDRA_CAST(((float)pEVar6 + (float)pEVar15)); - } - } - (this->_sprite)._playbackSpeed = (float)pEVar6; - pVVar8 = &this->_pos; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_60),pVVar8,8.0, - 0x21); - fVar10 = 0.0; - fVar11 = 0.0; - fVar12 = 0.0; - local_3c = GHIDRA_CAST(0x0); - local_40 = GHIDRA_CAST(0x0); - if (local_58.y != 0.0) { - do { - nearbyEntity = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) + GHIDRA_INT(fVar10) * 4); - if ((nearbyEntity == (void *)0x0) || - (nearbyPlayer = nearbyEntity, *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x28)) != 1)) { - if (nearbyEntity == (void *)0x0) { - nearbyPlayer = (void *)0x0; - goto LAB_0064f6c1; - } - nearbyPlayer = (void *)0x0; - if (*GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x28)) != 3) goto LAB_0064f6c1; -LAB_0064f36a: - if ((nearbyEntity != (void *)0x0) && - ((*GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x2c)) == this->_variant && - (*(void **)(GHIDRA_CAST(nearbyEntity) + 0x410) == this->_player)))) { - dx = pVVar8->x - *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x33c)); - fVar13 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x340)); - goto LAB_0064f39d; - } - } - else { -LAB_0064f6c1: - nearbyEntity = (void *)0x0; - if ((nearbyPlayer == (void *)0x0) || (nearbyPlayer != this->_player)) goto LAB_0064f36a; - dx = pVVar8->x - *GHIDRA_CAST((GHIDRA_CAST(nearbyPlayer) + 0x33c)); - fVar13 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(nearbyPlayer) + 0x340)); -LAB_0064f39d: - if ((dx != g_vectorZero.x) || (fVar13 != g_vectorZero.y)) { - distSq = fVar13 * fVar13 + dx * dx; - fVar12 = fVar12 + (dx * 0.5) / distSq; - fVar11 = fVar11 + (fVar13 * 0.5) / distSq; - } - } - fVar10 = (float)(GHIDRA_INT(fVar10) + 1); - } while (GHIDRA_UINT(fVar10) < GHIDRA_UINT(local_58.y)); - local_40 = GHIDRA_CAST(fVar12); - local_3c = GHIDRA_CAST(fVar11); - } - fVar10 = sqrtf((float)local_3c * (float)local_3c + (float)local_40 * (float)local_40); - pEVar6 = local_3c; - pEVar15 = local_40; - if ((2.0 < fVar10) && (0.0 < fVar10)) { - pEVar6 = GHIDRA_CAST(((float)local_3c * (2.0 / fVar10))); - pEVar15 = GHIDRA_CAST(((float)local_40 * (2.0 / fVar10))); - } - fVar10 = this->_speedMultiplier; - (this->_velocity).y = fVar10 * (float)pEVar6 + (this->_velocity).y; - (this->_velocity).x = fVar10 * (float)pEVar15 + (this->_velocity).x; - if (local_60[0] == '\0') { - local_14 = GHIDRA_CAST(0x2); - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_60)) + 0x4))),0); - local_14 = GHIDRA_CAST(0xffffffff); - } - } - update_weapon(this,(uint8_t)local_38); - if ((this->_state + 999U < 999) && - (oldParent = this->_state + 1, this->_state = oldParent, -1 < oldParent)) { - this->_state = 2; - this->_visible = 0; - play_sound_with_fart_seed(0x1e,(float)local_4c,2,0,1.0); - uVar4 = Random(); - pEVar6 = Game::Spawn(g_game,1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar4); - pEVar6->SetColor(&selfFamiliar->_splatColor,0xffffffff,0xff,0,1); - oldParent = *GHIDRA_CAST(pEVar6); - (pEVar6->_sprite)._offset.x = 0.0; - (pEVar6->_sprite)._offset.y = -6.0; - pEVar6->_renderDepthOffset = 10.0; - (**(code **)(oldParent + 0xc))(); - selfFamiliar->_entityCollisionClass = 0; - selfFamiliar->_entityGridCollisionClass = 0; - local_58.x = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(selfFamiliar->_player) + 0x33c)); - local_58.y = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(selfFamiliar->_player) + 0x340)); - pVVar8 = (GHIDRA_CAST((&local_58)))->Vector::Resized(&local_8c,6.0); - uVar4 = Random(); - local_74[0] = (Entity *) - (((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 40.0 - 20.0) * 0.017453292); - local_6c = GHIDRA_CAST(cos((float)local_74[0])); - fVar12 = sin((float)local_74[0]); - fVar10 = pVVar8->x; - fVar11 = pVVar8->y; - (selfFamiliar->_velocity).x = fVar10 * (float)local_6c - fVar11 * fVar12; - (selfFamiliar->_velocity).y = fVar11 * (float)local_6c + fVar10 * fVar12; - (selfFamiliar->_hitList)._end = (selfFamiliar->_hitList)._begin; - this = selfFamiliar; - } - if ((char)local_38 == '\0') { - uVar4 = this->_subtype; - if (uVar4 == 7) { - pEVar6 = GHIDRA_CAST((this->_health / DAT_00c344f4)); - if ((float)pEVar6 <= 0.0) { - pEVar6 = GHIDRA_CAST(0x0); - } - if ((float)local_4c <= (float)pEVar6) { - pEVar6 = local_4c; - } - fVar11 = (float)pEVar6 * 0.39999998 + 0.6; - fVar10 = fVar11 * g_vectorOne.x; - (this->_sprite)._scale.y = fVar11 * g_vectorOne.y; - (this->_sprite)._scale.x = fVar10; - } - else { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,0); - if (bVar3 != 0) { - if (uVar4 == 0) { - uVar5 = 0; - } - else { - uVar5 = uVar4; - if (6 < uVar4) { - uVar5 = 7; - } - } - fVar10 = this->_health; - if ((float)(&DAT_00c34238)[uVar5 * 0x19] <= fVar10 && - fVar10 != (float)(&DAT_00c34238)[uVar5 * 0x19]) { - fVar10 = fVar10 - 0.2; - if (uVar4 == 0) { - uVar4 = 0; - } - else if (6 < uVar4) { - uVar4 = 7; - } - if (fVar10 <= (float)(&DAT_00c34238)[uVar4 * 0x19]) { - fVar10 = (float)(&DAT_00c34238)[uVar4 * 0x19]; - } - this->_health = fVar10; - } - } - nearbyEntity = this->_config; - fVar10 = this->_health; - fVar11 = *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x50)); - (this->_sprite)._color._colorize[0] = 1.0; - (this->_sprite)._color._colorize[1] = 1.0; - (this->_sprite)._color._colorize[2] = 1.0; - pEVar6 = GHIDRA_CAST(((fVar10 * fVar10) / (fVar11 * fVar11))); - if ((float)pEVar6 <= 0.0) { - pEVar6 = GHIDRA_CAST(0x0); - } - if ((float)local_4c <= (float)pEVar6) { - pEVar6 = local_4c; - } - (this->_sprite)._color._colorize[3] = 0.6 - (float)pEVar6 * 1.1; - pEVar6 = GHIDRA_CAST(sqrtf(fVar10 / *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x50)))); - if ((float)pEVar6 <= 0.0) { - pEVar6 = GHIDRA_CAST(0x0); - } - if ((float)local_4c <= (float)pEVar6) { - pEVar6 = local_4c; - } - fVar10 = (float)pEVar6 * 0.5 + 0.6; - fVar11 = fVar10 * g_vectorOne.x; - (this->_sprite)._scale.y = fVar10 * g_vectorOne.y; - (this->_sprite)._scale.x = fVar11; - } - } - ExceptionList = local_1c; - return; - } - if (isPostMove != 0) goto LAB_0064ea36; - puStack_20 = GHIDRA_CAST((walkAnims + 0xc)); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); - if (bVar3 != 0) { - uVar5 = Random(); - rngResult = Random(); - fVar10 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.25 + 0.25; - local_58.y = fVar10 * (this->_velocity).y; - local_58.x = fVar10 * (this->_velocity).x; - pEVar6 = Game::Spawn(g_game,1000,0x6f,&this->_pos,&local_58,GHIDRA_CAST(0x0),0,uVar5); - pEVar6->SetColor(&this->_splatColor,0xffffffff,0xff,0,1,uVar4); - local_44 = GHIDRA_CAST(g_vectorOne.x); - local_68 = g_vectorOne.y; - uVar4 = Random(); - fVar10 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.3 + 0.3; - (pEVar6->_sprite)._scale.y = fVar10 * local_68; - (pEVar6->_sprite)._scale.x = fVar10 * (float)local_44; - fVar10 = (this->_posOffset).y; - (pEVar6->_posOffset).x = (this->_posOffset).x + 0.0; - (pEVar6->_posOffset).y = fVar10 - 8.0; - } - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_80),&this->_pos,20.0, - 8); - local_14 = GHIDRA_CAST(0x0); - local_38 = GHIDRA_CAST(0x0); - if (local_74[0] != GHIDRA_CAST(0x0)) { - do { - pEVar6 = local_38; - bVar3 = Entity::IsVulnerableEnemy - (*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_80)) + 0x4))) + GHIDRA_INT(local_38) * 4)),GHIDRA_CAST(0x0)); - if ((bVar3 != 0) && - (pEVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_80)) + 0x4))) + GHIDRA_INT(pEVar6) * 4)), - (pEVar15->_flags & 0x20000000) == 0)) { - local_44 = GHIDRA_CAST(&this->_hitList); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(local_44))))->EntityList::HitListContains(pEVar15); - if (bVar3 == 0) { - uVar4 = (GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_80)) + 0x4))) + GHIDRA_INT(pEVar6) * 4)))))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(local_44,uVar4); - takeDamageFn = *(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_80)) + 0x4))) + GHIDRA_INT(pEVar6) * 4)) + 0x20); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(selfFamiliar)); - (*takeDamageFn)(*GHIDRA_CAST((GHIDRA_CAST(selfFamiliar->_player) + 0x157c)) * 3.0,0,0,&sourceRef,0x1e) - ; - pEVar6 = local_38; - this = selfFamiliar; - } - } - local_38 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x1)))); - } while (local_38 < local_74[0]); - } - oldParent = this->_state; - this->_state = oldParent + 1; - local_68 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - local_50 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - local_38 = GHIDRA_CAST((local_68 - (this->_pos).x)); - local_3c = GHIDRA_CAST((local_50 - (this->_pos).y)); - fVar10 = sqrtf((float)local_38 * (float)local_38 + (float)local_3c * (float)local_3c); - pEVar6 = local_38; - if (0.0 < fVar10) { - local_3c = GHIDRA_CAST(((float)local_3c * (1.0 / fVar10))); - pEVar6 = GHIDRA_CAST(((float)local_38 * (1.0 / fVar10))); - } - fVar10 = (float)(oldParent + -1); - local_3c = (Entity *) - ((float)local_3c * fVar10 * fVar10 * this->_speedMultiplier + (this->_velocity).y); - local_44 = (Entity *) - (fVar10 * (float)pEVar6 * fVar10 * this->_speedMultiplier + (this->_velocity).x); - (this->_velocity).y = (float)local_3c; - (this->_velocity).x = (float)local_44; - fVar10 = sqrtf((float)local_3c * (float)local_3c + (float)local_44 * (float)local_44); - pEVar6 = local_3c; - if ((20.0 < fVar10) && (0.0 < fVar10)) { - pEVar6 = GHIDRA_CAST(((float)local_3c * (20.0 / fVar10))); - (this->_velocity).x = (float)local_44 * (20.0 / fVar10); - (this->_velocity).y = (float)pEVar6; - } - fVar10 = (this->_velocity).x; - fVar10 = sqrtf(fVar10 * fVar10 + (float)pEVar6 * (float)pEVar6); - local_44 = GHIDRA_CAST((fVar10 + 2.0)); - fVar11 = (this->_pos).x - local_68; - local_38 = GHIDRA_CAST(0x41200000); - fVar10 = (this->_pos).y - local_50; - local_3c = local_44; - fVar10 = sqrtf(fVar10 * fVar10 + fVar11 * fVar11); - piVar1 = &this->_state; - ppEVar9 = &local_44; - if ((float)local_3c <= 10.0) { - ppEVar9 = &local_38; - } - if (fVar10 <= (float)*ppEVar9) { - local_44 = GHIDRA_CAST(0x59); - piVar7 = GHIDRA_CAST(&local_44); - if (0x58 < *piVar1) { - piVar7 = piVar1; - } - *piVar1 = *piVar7; - manager = g_manager; - switch(this->_subtype) { - case 0: - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::CanPickRedHearts(); - manager = g_manager; - if (bVar3 == 0) goto switchD_0064e588_default; - local_38 = GHIDRA_CAST(0xb9); - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((this->_player)))->Entity_Player::AddHearts(1,1,0); - this->Remove(); - break; - case 1: - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::CanPickSoulHearts(); - if (bVar3 == 0) goto switchD_0064e588_default; - uVar4 = this->_player->_soulHearts; - if (((uVar4 & 1) == 0) || - (bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsBlackHeart(uVar4), bVar3 != 0)) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_60),3, - this->_variant,-1,0,0); - fVar10 = 0.0; - if (local_58.y != 0.0) { - do { - oldParent = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) + GHIDRA_INT(fVar10) * 4)); - if (((oldParent != 0) && (*GHIDRA_CAST((oldParent + 0x28)) == 3)) && - ((*(void **)(oldParent + 0x410) == this->_player && (*GHIDRA_CAST((oldParent + 0x30)) == 2) - ))) goto LAB_0064e7f1; - fVar10 = (float)(GHIDRA_INT(fVar10) + 1); - } while (GHIDRA_UINT(fVar10) < GHIDRA_UINT(local_58.y)); - } - (GHIDRA_CAST((local_60)))->EntityList_Query::~EntityList_Query(); - } - manager = g_manager; - local_38 = GHIDRA_CAST(0x36); - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((this->_player)))->Entity_Player::AddSoulHearts(1,0); - this->Remove(); - break; - case 2: - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::CanPickBlackHearts(); - if (bVar3 == 0) goto switchD_0064e588_default; - uVar4 = this->_player->_soulHearts; - if (((uVar4 & 1) != 0) && - (bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsBlackHeart(uVar4), bVar3 == 0)) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_60),3, - this->_variant,-1,0,0); - fVar10 = 0.0; - if (local_58.y != 0.0) { - do { - oldParent = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) + GHIDRA_INT(fVar10) * 4)); - if ((((oldParent != 0) && (*GHIDRA_CAST((oldParent + 0x28)) == 3)) && - (*(void **)(oldParent + 0x410) == this->_player)) && - (*GHIDRA_CAST((oldParent + 0x30)) == 1)) goto LAB_0064e7f1; - fVar10 = (float)(GHIDRA_INT(fVar10) + 1); - } while (GHIDRA_UINT(fVar10) < GHIDRA_UINT(local_58.y)); - } - (GHIDRA_CAST((local_60)))->EntityList_Query::~EntityList_Query(); - } - manager = g_manager; - local_38 = GHIDRA_CAST(0x1d4); - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlackHearts(1); - this->Remove(); - break; - case 3: - local_38 = GHIDRA_CAST(0x10a); - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((this->_player)))->Entity_Player::AddEternalHearts(1); - this->Remove(); - break; - case 4: - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::CanPickGoldenHearts(); - manager = g_manager; - if (bVar3 == 0) goto switchD_0064e588_default; - local_38 = GHIDRA_CAST(0x1d1); - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((this->_player)))->Entity_Player::AddGoldenHearts(1,0); - this->Remove(); - break; - case 5: - bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::CanPickBoneHearts(); - manager = g_manager; - if (bVar3 == 0) goto switchD_0064e588_default; - local_38 = GHIDRA_CAST(0x1cd); - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((this->_player)))->Entity_Player::AddBoneHearts(1); - this->Remove(); - break; - case 6: - isRottenHeartsPickable = (GHIDRA_CAST((this->_player)))->Entity_Player::CanPickRottenHearts(); - manager = g_manager; - if (isRottenHeartsPickable == '\0') goto switchD_0064e588_default; - local_38 = GHIDRA_CAST(0x1f1); - seed_fart_sound_override(GHIDRA_CAST(&local_38)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((this->_player)))->Entity_Player::AddRottenHearts(2,0); - this->Remove(); - break; - default: -switchD_0064e588_default: - if (0x5c < this->_state) { - this->_state = -1000; - if (GHIDRA_CAST(this->_child) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_child) + 0x28))(); - } - this->_visible = 1; - oldParent = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x184)); - if ((((oldParent == 0) || (oldParent == 3)) || (oldParent == 1)) || - (gridCollisionClass = 5, oldParent == 2)) { - gridCollisionClass = 3; - } - this->_entityGridCollisionClass = gridCollisionClass; - this->_entityCollisionClass = 3; - (this->_velocity).x = (this->_velocity).x * 0.25; - (this->_velocity).y = (this->_velocity).y * 0.25; - } - } - } - if ((this->_child == 0) && (1 < this->_state)) { - uVar4 = Random(); - local_38 = Game::Spawn(g_game,1000,0xa6,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - uVar5 = -GHIDRA_UINT((this->_subtype != 0)) & this->_subtype; - uVar4 = 7; - if (uVar5 < 7) { - uVar4 = uVar5; - } - effectColor = &(local_38->_sprite)._color; - oldParent = uVar4 * 100; - if (effectColor != GHIDRA_CAST((&DAT_00c34270 + oldParent))) { - fVar10 = *GHIDRA_CAST((oldParent + 0xc34274)); - fVar11 = *GHIDRA_CAST((oldParent + 0xc34278)); - fVar12 = *GHIDRA_CAST((oldParent + 0xc3427c)); - effectColor->_tint[0] = *GHIDRA_CAST((&DAT_00c34270 + oldParent)); - (local_38->_sprite)._color._tint[1] = fVar10; - (local_38->_sprite)._color._tint[2] = fVar11; - (local_38->_sprite)._color._tint[3] = fVar12; - fVar10 = *GHIDRA_CAST((oldParent + 0xc34284)); - fVar11 = *GHIDRA_CAST((oldParent + 0xc34288)); - fVar12 = *GHIDRA_CAST((oldParent + 0xc3428c)); - (local_38->_sprite)._color._colorize[0] = *GHIDRA_CAST((&DAT_00c34280 + oldParent)); - (local_38->_sprite)._color._colorize[1] = fVar10; - (local_38->_sprite)._color._colorize[2] = fVar11; - (local_38->_sprite)._color._colorize[3] = fVar12; - *GHIDRA_CAST((local_38->_sprite)._color._offset) = *GHIDRA_CAST((&DAT_00c34290 + oldParent)) - ; - (local_38->_sprite)._color._offset[2] = *GHIDRA_CAST((&DAT_00c34298 + oldParent)); - } - fVar10 = g_vectorOne.y * 2.0; - (local_38->_sprite)._scale.x = g_vectorOne.x * 2.0; - (local_38->_sprite)._scale.y = fVar10; - uVar4 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&local_38->_sprite,GHIDRA_CAST(0x0)); - pEVar6 = local_38; - oldParent = 1; - if ((uVar4 & 4) == 0) { - oldParent = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = oldParent; - layer->_blendMode[2] = 7; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 7; - oldParent = local_38->_parent; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_38[1])) + 0x44)))) = 0x3e19999a; - pEVar15 = local_38 + 1; - (pEVar15->_sprite)._filename._buf[0] = -0x66; - (pEVar15->_sprite)._filename._buf[1] = -0x67; - (pEVar15->_sprite)._filename._buf[2] = '\x19'; - (pEVar15->_sprite)._filename._buf[3] = '>'; - if (oldParent != 0) { - local_44 = GHIDRA_CAST(&local_38->_parent); - msvc::multiset::erase(&local_44); - } - pEVar6->_parent = this; - msvc::multiset::insert(&pEVar6->_parent); - pEVar6->Update(); - if (this->_child != 0) { - local_44 = GHIDRA_CAST(&this->_child); - msvc::multiset::erase(&local_44); - } - this->_child = pEVar6; - msvc::multiset::insert(&this->_child); - } - if (local_80[0] == '\0') { - local_14 = GHIDRA_CAST(0x1); - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_80)) + 0x4))),0); - } -LAB_0064ea36: - if (this->_child == 0) { - ExceptionList = local_1c; - return; - } - *GHIDRA_CAST((this->_child + 0xfc)) = 0x3ecccccd; - fVar10 = (this->_posOffset).x; - fVar11 = (this->_pos).x; - oldParent = this->_child; - *GHIDRA_CAST((oldParent + 0x340)) = ((this->_posOffset).y + (this->_pos).y) - 8.0; - *GHIDRA_CAST((oldParent + 0x33c)) = fVar10 + fVar11 + 0.0; - ExceptionList = local_1c; - return; -LAB_0064e7f1: - (GHIDRA_CAST((local_60)))->EntityList_Query::~EntityList_Query(); - goto switchD_0064e588_default; -} - -// 00650220 -void Entity_Familiar::predict_player_movement() -{ - uint8_t isDropPressed; - Vector *movementJoystick; - Entity_Player *extraout_ECX; - Entity_Player *this_00; - uint32_t extraout_ECX_00; - Entity_Familiar *chainFamiliar; - float fVar1; - float distanceSq; - float fVar2; - float fVar3; - float local_20; - float local_1c; - Vector local_18; - Vector joystickBuf; - Game *game; - Entity_Familiar *nextParent; - Entity_Familiar *parent; - - local_20 = g_vectorZero.x; - local_1c = g_vectorZero.y; - this_00 = this->_player; - local_18.x = this_00->_movespeed; - if ((this_00->_isControlsEnabled != 0) && (this_00->_controlsCooldown < 1)) { - movementJoystick = (GHIDRA_CAST((this_00)))->Entity_Player::GetMovementJoystick(&joystickBuf); - local_1c = movementJoystick->y; - local_20 = movementJoystick->x; - fVar1 = sqrtf(local_1c * local_1c + local_20 * local_20); - this_00 = extraout_ECX; - if ((1.0 < fVar1) && (0.0 < fVar1)) { - local_1c = (1.0 / fVar1) * movementJoystick->y; - local_20 = (1.0 / fVar1) * movementJoystick->x; - } - } - isDropPressed = - input_is_action_pressed - (0xb,GHIDRA_INT(this->_player[5]._color._colorize[0]),this->_player,GHIDRA_INT(this_00)); - if (isDropPressed != 0) { - local_20 = g_vectorZero.x; - local_1c = g_vectorZero.y; - } - (GHIDRA_CAST((&this->_pathfinder)))->NPCAI_Pathfinder::SimulatePlayerMovement(&local_20,extraout_ECX_00); - nextParent = GHIDRA_CAST(this->_parent); - chainFamiliar = this; - while ((parent = nextParent, parent != GHIDRA_CAST(0x0) && (parent->_type == 3))) { - chainFamiliar = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - fVar1 = (this->_pos).x; - local_20 = 0.0; - local_18.x = 0.0; - do { - if (chainFamiliar->_type != 3) break; - fVar1 = (this->_pos).x; - fVar3 = fVar1 - (chainFamiliar->_pos).x; - fVar2 = (this->_pos).y - (chainFamiliar->_pos).y; - if ((fVar3 != g_vectorZero.x) || (fVar2 != g_vectorZero.y)) { - distanceSq = fVar2 * fVar2 + fVar3 * fVar3; - local_18.x = local_18.x + (fVar3 * 0.5) / distanceSq; - local_20 = local_20 + (fVar2 * 0.5) / distanceSq; - } - chainFamiliar = GHIDRA_CAST(chainFamiliar->_child); - } while (chainFamiliar != GHIDRA_CAST(0x0)); - fVar1 = fVar1 - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); - fVar2 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); - if ((fVar1 != g_vectorZero.x) || (fVar2 != g_vectorZero.y)) { - fVar3 = fVar1 * fVar1 + fVar2 * fVar2; - local_20 = (fVar2 * 0.5) / fVar3 + local_20; - local_18.x = local_18.x + (fVar1 * 0.5) / fVar3; - } - fVar3 = sqrtf(local_20 * local_20 + local_18.x * local_18.x); - game = g_game; - fVar1 = local_20; - fVar2 = local_18.x; - if ((2.0 < fVar3) && (0.0 < fVar3)) { - fVar1 = local_20 * (2.0 / fVar3); - fVar2 = local_18.x * (2.0 / fVar3); - } - fVar3 = this->_speedMultiplier; - (this->_velocity).x = fVar3 * fVar2 + (this->_velocity).x; - (this->_velocity).y = fVar3 * fVar1 + (this->_velocity).y; - Room::GetClampedPositionImpl(game->_room,&local_18,&this->_pos,0.0,0.0,0.0,0.0); - local_20 = local_18.x - (this->_pos).x; - local_18.x = local_18.y - (this->_pos).y; - if ((local_20 != g_vectorZero.x) || (local_18.x != g_vectorZero.y)) { - fVar1 = sqrtf(local_18.x * local_18.x + local_20 * local_20); - if (0.0 < fVar1) { - local_18.x = local_18.x * (1.0 / fVar1); - local_20 = local_20 * (1.0 / fVar1); - } - fVar1 = (this->_velocity).x; - fVar2 = this->_speedMultiplier; - fVar3 = -(local_18.x * (this->_velocity).y + fVar1 * local_20); - if (fVar3 <= 1.0) { - fVar3 = 1.0; - } - if (16.0 <= fVar3) { - fVar3 = 16.0; - } - (this->_velocity).x = local_20 * fVar3 * fVar2 + fVar1; - (this->_velocity).y = local_18.x * fVar3 * fVar2 + (this->_velocity).y; - } - return; -} - -// 00651890 -void Entity_Familiar::guard_check_icall() -{ - if ((this->_variant == 0xd3) && (this->_state == 2)) { - this->_state = 0; - this->Update(); - } - this->_isHourglassRewound = 1; - return; -} - -// 009615e0 -uint8_t Entity_Familiar::multidimensional_baby_copy_knife(Entity_Knife *knife, Entity *unused) -{ - Vector direction; - Entity *rootParent; - uint32_t rngResult; - Entity_Knife *copyKnife; - float sideOffset; - float sinAngle; - uint32_t i; - uint32_t *local_18; - float local_14; - uint32_t *local_10; - float homingDirY; - float knifeY; - double uintFixup; - - if ((((knife->_multidimensionalApplied != 0) || (knife->_visible == 0)) || - (knife->_knifeVelocity <= 0.0)) || ((knife->_subtype != 0 && (knife->_subtype != 1)))) { - return 0; - } - knife->_visible = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((knife)) + 0x514)))) = knife->_knifeDistance; - knife->_multidimensionalApplied = 1; - rootParent = (GHIDRA_CAST((knife)))->Entity_Knife::GetRootParent(); - rootParent[1]._spawnerVariant = GHIDRA_INT(((float)rootParent[1]._spawnerVariant + 5.0)); - i = 0; - do { - if (i == 0) { - sideOffset = 10.0; - } - else { - sideOffset = -10.0; - } - rngResult = Random(); - copyKnife = (Entity_Knife *) - Game::SpawnEx(g_game,8,knife->_variant,&knife->_pos,&g_vectorZero,GHIDRA_CAST(knife),0, - rngResult,1); - if (copyKnife == GHIDRA_CAST(0x0)) break; - if (copyKnife->_parent != 0) { - local_18 = ©Knife->_parent; - msvc::multiset::erase(&local_18); - } - copyKnife->_parent = knife; - msvc::multiset::insert(©Knife->_parent); - (GHIDRA_CAST((copyKnife)))->Entity_Knife::copy_parent_state(knife); - if (knife->_subtype == 1) { - local_18 = GHIDRA_CAST((knife->_rotation * 0.017453292)); - local_14 = cos((float)local_18); - sinAngle = sin((float)local_18); - knifeY = (knife->_pos).y; - (copyKnife->_pos).x = (local_14 * 0.0 - sinAngle * sideOffset) + (knife->_pos).x; - (copyKnife->_pos).y = local_14 * sideOffset + sinAngle * 0.0 + knifeY; - rngResult = Random(); - uintFixup = __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]; - local_14 = knife->_rotation * 0.017453292; - local_18 = GHIDRA_CAST(cos(local_14)); - homingDirY = sin(local_14); - local_10 = local_18; - direction.y = homingDirY; - direction.x = (float)local_18; - Entity_Knife::InitHomingPath - (copyKnife,direction,GHIDRA_CAST(knife), - (float)((double)GHIDRA_INT(rngResult) + uintFixup) * 2.3283064e-10 * 50.0 - 25.0); - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((copyKnife)) + 0x504)))) = knife->_knifeDistance; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((copyKnife)) + 0x50c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((copyKnife)) + 0x510)))) = sideOffset; - } - copyKnife->Update(); - i = i + 1; - } while (i < 2); - if (knife->_subtype == 1) { - knife->Remove(); - } - return 1; -} diff --git a/generated-src/entity_knife.cpp b/generated-src/entity_knife.cpp deleted file mode 100644 index da04207..0000000 --- a/generated-src/entity_knife.cpp +++ /dev/null @@ -1,4882 +0,0 @@ -#include "classes.h" - -// 004d7790 -long double Entity_Knife::Rotation() -{ - return (long double)this->_rotation; -} - -// 004d77a0 -long double Entity_Knife::GetKnifeVelocity() -{ - return (long double)this->_knifeVelocity; -} - -// 0060cf10 -uint8_t Entity_Knife::IsFlying() -{ - return this->_isFlying; -} - -// 0060cfb0 -void Entity_Knife::SetPathFollowSpeed(float param_2) -{ - this->_pathFollowSpeed = param_2; - return; -} - -// 0085de90 -BitSet128 * Entity_Knife::TearFlags(BitSet128 *outFlags) -{ - uint32_t uVar1; - uint32_t uVar2; - uint64_t qVar3; - - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - qVar3 = (this->_tearFlags)._h; - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)) = uVar1; - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_INT(qVar3); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)) = uVar2; - return outFlags; -} - -// 0085deb0 -long double Entity_Knife::GetKnifeDistance() -{ - return (long double)this->_knifeDistance; -} - -// 0085dec0 -long double Entity_Knife::RotationOffset() -{ - return (long double)this->_rotationOffset; -} - -// 00960a20 -int Entity_Knife::GetBaseVariant() -{ - switch(this->_variant) { - case 2: - case 3: - case 4: - case 8: - case 9: - return 1; - case 5: - return 0; - default: - return this->_variant; - case 0xb: - return 10; - } -} - -// 00960a70 -void Entity_Knife::Constructor() -{ - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Knife::vftable; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - *GHIDRA_CAST(&(this->_usedTearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_usedTearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_usedTearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_usedTearFlags)._h) + 4)) = 0; - (this->_anchorPosition).y = 0.0; - (this->_anchorPosition).x = 0.0; - (this->_initPosition).y = 0.0; - (this->_initPosition).x = 0.0; - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::HomingLaser(); - (this->_hitList)._begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x510)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x50c)))) = 0; - return; -} - -// 00960c10 -void Entity_Knife::Init(int type, int variant, int subType, uint32_t initSeed) -{ - double dVar1; - uint32_t uVar2; - float fVar3; - uint8_t bVar4; - ANM2 *extraout_EAX; - LayerState *layer; - uint8_t *curAnimName; - char *ptr; - int iVar5; - uint8_t *cmpName; - ANM2 *pAVar6; - uint32_t uVar7; - bool isLess; - ANM2 *local_34; - uint8_t isLayerVisible; - std_string anm2Path; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint8_t *animData; - uint8_t cmpChar; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0c8bf; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT(&(&anm2Path)[1]._size); - ExceptionList = &local_10; - if (DAT_00c72214 == GHIDRA_CAST(0x0)) { - local_34 = operator_new(0x114); - local_8 = 0; - if (local_34 == GHIDRA_CAST(0x0)) { - local_34 = GHIDRA_CAST(0x0); - } - else { - ANM2::constructor(local_34); - local_34 = extraout_EAX; - } - local_8 = 0xffffffff; - if (DAT_00c78da8 == DAT_00c78dac) { - FUN_004156c0(DAT_00c78da8,&local_34); - } - else { - *DAT_00c78da8 = local_34; - DAT_00c78da8 = DAT_00c78da8 + 1; - } - anm2Path._size = 0; - anm2Path._capacity = 0xf; - anm2Path._buf[0] = '\0'; - anm2Path._buf[1] = '\0'; - anm2Path._buf[2] = '\0'; - anm2Path._buf[3] = '\0'; - DAT_00c72214 = local_34; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20); - anm2Path._size = 0x1a; - anm2Path._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))),"gfx/DeadEyeTearEffect.anm2",0x1b); - local_8 = 1; - ANM2::Load(DAT_00c72214,&anm2Path,1); - local_8 = 0xffffffff; - if (0xf < anm2Path._capacity) { - uVar7 = anm2Path._capacity + 1; - ptr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))); - if (0xfff < uVar7) { - ptr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + -4)); - uVar7 = anm2Path._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,uVar7); - } - uVar7 = g_graphicsManager_flags; - anm2Path._size = 0; - anm2Path._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) & 0xffffff00; - layer = ANM2::GetLayer(DAT_00c72214,GHIDRA_CAST(0x0)); - pAVar6 = DAT_00c72214; - iVar5 = 1; - if ((uVar7 & 4) == 0) { - iVar5 = 6; - } - local_34 = DAT_00c72214; - layer->_blendMode[0] = 0; - layer->_blendMode[1] = iVar5; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - animData = (pAVar6->_animState)._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - cmpName = s_Idle; - do { - bVar4 = *curAnimName; - isLess = bVar4 < *cmpName; - if (bVar4 != *cmpName) { -LAB_00960df0: - uVar7 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00960df5; - } - if (bVar4 == 0) break; - bVar4 = curAnimName[1]; - isLess = bVar4 < cmpName[1]; - if (bVar4 != cmpName[1]) goto LAB_00960df0; - curAnimName = curAnimName + 2; - cmpName = cmpName + 2; - } while (bVar4 != 0); - uVar7 = 0; -LAB_00960df5: - if ((uVar7 == 0) && ((animData[0x34] == 0 || ((pAVar6->_animState)._isPlaying != 0)))) - goto LAB_00960e29; - } - bVar4 = ANM2::SetAnimation(pAVar6,s_Idle,1); - if (bVar4 != 0) { - AnimationState::Rewind(&pAVar6->_animState); - (pAVar6->_animState)._isPlaying = 1; - } - } -LAB_00960e29: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Init(type,variant,subType,initSeed); - if (this->_config != (void *)0x0) { - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); - local_34 = GHIDRA_CAST(&(this->_sprite)._animDefaultName); - if (0xf < (this->_sprite)._animDefaultName._capacity) { - local_34 = *GHIDRA_CAST((GHIDRA_CAST(local_34))->_buf); - } - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - pAVar6 = local_34; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - do { - bVar4 = *curAnimName; - cmpChar = (pAVar6->_filename)._buf[0]; - isLess = bVar4 < cmpChar; - if (bVar4 != cmpChar) { -LAB_00960ea0: - uVar7 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00960ea5; - } - if (bVar4 == 0) break; - bVar4 = curAnimName[1]; - cmpChar = (pAVar6->_filename)._buf[1]; - isLess = bVar4 < cmpChar; - if (bVar4 != cmpChar) goto LAB_00960ea0; - curAnimName = curAnimName + 2; - pAVar6 = GHIDRA_CAST(((pAVar6->_filename)._buf + 2)); - } while (bVar4 != 0); - uVar7 = 0; -LAB_00960ea5: - if ((uVar7 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_00960eda; - } - bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(local_34),1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } -LAB_00960eda: - this->_collisionDamage = 22.0; - this->_scale = 1.0; - this->_rotation = 0.0; - this->_displayRotation = 0.0; - this->_knifeDepthOffset = 0.0; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - this->_rotationOffset = 0.0; - this->_entityGridCollisionClass = 0; - this->_knifeDistance = 0.0; - this->_knifeVelocity = 0.0; - this->_maxDistance = 100.0; - this->_charge = 0.0; - this->_isFlying = 0; - (this->_anchorPosition).x = g_vectorZero.x; - (this->_anchorPosition).y = g_vectorZero.y; - (this->_initPosition).x = (this->_pos).x; - (this->_initPosition).y = (this->_pos).y; - this->_prismApplied = 0; - this->_multidimensionalApplied = 0; - this->_isUsingParentHitList = 0; - this->_pathSegment = 0; - uVar7 = Random(); - this->_pathProgress = -100.0; - this->_pathFollowSpeed = 0.1; - this->_height = 0.0; - this->_fallingSpeed = 0.0; - this->_isDeadEyeHit = 0; - *GHIDRA_CAST(&this->_isSwinging) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4e8)))) = 0; - this->_isSpinAttack = 0; - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504)))) = &DAT_bf800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ec)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x508)))) = 0; - this->_pathOffset = (float)((double)GHIDRA_INT(uVar7) + dVar1) * 2.3283064e-10 * 50.0 - 25.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x50c)))) = g_vectorZero.x; - fVar3 = g_vectorZero.y; - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x4000000; - this->_isPrimaryClub = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x518)))) = 0; - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x510)))) = fVar3; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar2; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x514)))) = &DAT_bf800000; - (this->_hitList)._end = (this->_hitList)._begin; - iVar5 = this->_variant; - switch(iVar5) { - case 5: - goto LAB_00961187; - default: - if (iVar5 != 1) { - if (iVar5 != 10) goto LAB_00961187; - goto code_r0x00961110; - } - case 2: - case 3: - case 4: - case 8: - case 9: - isLayerVisible = this->_subtype != 4; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_visible = isLayerVisible; - isLayerVisible = this->_subtype == 4; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - break; - case 0xb: -code_r0x00961110: - isLayerVisible = this->_subtype != 4; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_visible = isLayerVisible; - isLayerVisible = this->_subtype == 4; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layer->_visible = isLayerVisible; - isLayerVisible = this->_subtype == 4; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x2)); - } - layer->_visible = isLayerVisible; -LAB_00961187: - LuaEngine::PostKnifeInit(this); - ExceptionList = local_10; - return; -} - -// 009611d0 -void Entity_Knife::ClearReferences() -{ - uint8_t *puVar1; - Entity_Knife *erasedRef; - int parent; - uint8_t *secondRef; - - parent = this->_parent; - erasedRef = this; - if ((parent != 0) && (*GHIDRA_CAST((parent + 0x28)) == 2)) { - if ((*GHIDRA_CAST((parent + 0x49c)) == this) && - (*GHIDRA_CAST((parent + 0x49c)) != GHIDRA_CAST(0x0))) { - erasedRef = GHIDRA_CAST((parent + 0x49c)); - msvc::multiset::erase(&erasedRef); - *GHIDRA_CAST((parent + 0x49c)) = 0; - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - puVar1 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) + 0x28))(); - } - secondRef = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))) + 0x28))(); - } - if (*GHIDRA_CAST(puVar1) != 0) { - erasedRef = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&erasedRef); - } - *GHIDRA_CAST(puVar1) = 0; - if (*GHIDRA_CAST(secondRef) != 0) { - erasedRef = GHIDRA_CAST(secondRef); - msvc::multiset::erase(&erasedRef); - } - *GHIDRA_CAST(secondRef) = 0; - puVar1 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f4))); - if (*GHIDRA_CAST(puVar1) != 0) { - erasedRef = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&erasedRef); - } - secondRef = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8))); - *GHIDRA_CAST(puVar1) = 0; - if (*GHIDRA_CAST(secondRef) != 0) { - erasedRef = GHIDRA_CAST(secondRef); - msvc::multiset::erase(&erasedRef); - } - *GHIDRA_CAST(secondRef) = 0; - return; -} - -// 009612e0 -void * Entity_Knife::GetHitEntities() -{ - uint8_t isUsingParentHitList; - Entity_Knife *parent; - - isUsingParentHitList = this->_isUsingParentHitList; - while (((isUsingParentHitList != 0 && - (parent = GHIDRA_CAST(this->_parent), parent != GHIDRA_CAST(0x0))) && - (parent->_type == 8))) { - isUsingParentHitList = parent->_isUsingParentHitList; - this = parent; - } - return &this->_hitList; -} - -// 00961320 -void Entity_Knife::InitHomingPath(Vector direction, Entity *source, float pathOffset) -{ - uint32_t tearFlagsWord2; - uint32_t tearFlagsWord3; - Vector local_10; - - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x38)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x34)))); - (this->_homingLaser)._nonOptimizedSamples._end = (this->_homingLaser)._nonOptimizedSamples._begin; - (this->_homingLaser)._bezier._end = (this->_homingLaser)._bezier._begin; - this->_pathSegment = 0; - this->_pathOffset = pathOffset; - this->_pathProgress = -100.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x18)))) = 0x1e; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x40)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x14)))) = 0x43160000; - Entity_Laser::CalculateEndPoint(&local_10,&this->_pos,&direction,&g_vectorZero,GHIDRA_CAST(0x0),20.0) - ; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x4)))) = (this->_pos).x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x8)))) = (this->_pos).y; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0xc)))) = direction.x * 200.0 + local_10.x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x10)))) = direction.y * 200.0 + local_10.y; - tearFlagsWord3 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - local_10.x = (float)(tearFlagsWord3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._h)) + 0x4)))); - tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h); - if ((!((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagOrbit._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._l)) + 0x4)))) == 0)) || - (!((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagOrbit._h)) == 0 && local_10.x == 0.0))) { - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::build_curl_path(60.0); - tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h); - tearFlagsWord3 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - } - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagHoming._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4)))) == 0) && - ((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagHoming._h)) == 0 && - (tearFlagsWord3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4)))) == 0)) { - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::build_bezier_path(0,source); - return; - } - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::build_bezier_path(1,source); - return; -} - -// 009614d0 -void Entity_Knife::copy_parent_state(Entity_Knife *source) -{ - int iVar1; - float x; - uint64_t tearFlagsHigh; - uint32_t tearFlagsHighHigh; - uint32_t tearFlagsLowHigh; - - iVar1 = *GHIDRA_CAST(this); - (this->_posOffset).x = (source->_posOffset).x; - (this->_posOffset).y = (source->_posOffset).y; - (**(code **)(iVar1 + 0x3c))(&source->_color,0xffffffff,0xff,0,1); - tearFlagsLowHigh = *GHIDRA_CAST((GHIDRA_INT(&(source->_tearFlags)._l) + 4)); - tearFlagsHigh = (source->_tearFlags)._h; - tearFlagsHighHigh = *GHIDRA_CAST((GHIDRA_INT(&(source->_tearFlags)._h) + 4)); - iVar1 = *GHIDRA_CAST(this); - *GHIDRA_CAST(&(this->_tearFlags)._l) = GHIDRA_INT((source->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = tearFlagsLowHigh; - *GHIDRA_CAST(&(this->_tearFlags)._h) = GHIDRA_INT(tearFlagsHigh); - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = tearFlagsHighHigh; - (**(code **)(iVar1 + 0x40))(source->_collisionDamage); - x = source->_rotationOffset; - if (360.0 < ABS(x)) { - x = fmodf(x,360.0); - } - if (x <= 180.0) { - if (x < -180.0) { - x = x + 360.0; - } - } - else { - x = x - 360.0; - } - this->_rotationOffset = x; - (this->_sprite)._scale.x = (source->_sprite)._scale.x; - (this->_sprite)._scale.y = (source->_sprite)._scale.y; - this->_multidimensionalApplied = source->_multidimensionalApplied; - this->_prismApplied = source->_prismApplied; - return; -} - -// 00961870 -uint32_t Entity_Knife::spawn_child_knife() -{ - double dVar1; - Vector direction; - Entity *rootParent; - uint32_t rngResult; - Entity_Knife *childKnife; - float angle; - int iVar2; - uint8_t *local_24; - float local_20; - uint32_t *local_1c [6]; - - if ((((this->_prismApplied != 0) || (this->_visible == 0)) || (this->_knifeVelocity <= 0.0)) || - ((this->_subtype != 0 && (this->_subtype != 1)))) { - return 0; - } - this->_visible = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x514)))) = this->_knifeDistance; - this->_prismApplied = 1; - rootParent = GetRootParent(this); - local_24 = &DAT_00c5d2c8; - local_20 = 0.0; - rootParent[1]._spawnerVariant = GHIDRA_INT(((float)rootParent[1]._spawnerVariant + 2.0)); - do { - rngResult = Random(); - childKnife = (Entity_Knife *) - Game::SpawnEx(g_game,8,this->_variant,&this->_pos,&g_vectorZero,GHIDRA_CAST(this), - this->_subtype,rngResult,1); - if (childKnife == GHIDRA_CAST(0x0)) break; - if (childKnife->_parent != 0) { - local_1c[0] = &childKnife->_parent; - msvc::multiset::erase(local_1c); - } - childKnife->_parent = this; - msvc::multiset::insert(&childKnife->_parent); - copy_parent_state(childKnife,this); - iVar2 = 0xff; - childKnife->SetColor(local_24,0xffffffff,0xff,0,1); - angle = (float)((double)iVar2 + __uint_to_double_fixup[-(iVar2 >> 0x1f)]) * 20.0; - if (this->_subtype == 1) { - rngResult = Random(); - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]; - angle = ((this->_rotation - 30.0) + angle) * 0.017453292; - local_24 = GHIDRA_CAST(cos(angle)); - local_20 = sin(angle); - direction.y = local_20; - direction.x = (float)local_24; - InitHomingPath(childKnife,direction,GHIDRA_CAST(this), - (float)((double)GHIDRA_INT(rngResult) + dVar1) * 2.3283064e-10 * 50.0 - 25.0); - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((childKnife)) + 0x504)))) = this->_knifeDistance; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((childKnife)) + 0x508)))) = angle - 30.0; - } - childKnife->Update(); - local_20 = (float)(GHIDRA_INT(local_20) + 0x2c); - local_24 = local_24 + 0x2c; - } while (GHIDRA_UINT(local_20) < 0xb0); - if (this->_subtype == 1) { - this->Remove(); - } - return 1; -} - -// 00961b00 -void Entity_Knife::Update() -{ - void *pvVar1; - int iVar2; - uint32_t uVar3; - code *pcVar4; - uint32_t uVar5; - Vector direction; - BitSet128 flags; - BitSet128 flags_00; - BitSet128 flags_01; - Vector sizeMulti; - Vector direction_00; - ANM2 *pAVar6; - uint64_t qVar7; - uint8_t bVar8; - char cVar9; - uint32_t uVar10; - Entity_Player *ownerPlayer; - LayerState *layer; - BitSet128 *pBVar11; - uint8_t *pbVar12; - float *extraout_EAX; - Entity_Tear *spawnedTear; - BitSet128 *tearFlagsTmp; - Entity_Knife *rootParent; - RNG *spawnedTear; - RNG *spiralRng; - RNG *squareRng; - Vector *pVVar13; - Entity *tmpEntity; - Entity_Laser *techLaser; - ColorMod *color; - int fadeFrames; - float *pfVar14; - TearParams *pTVar15; - uint32_t *puVar16; - Vector *cardinalDir; - int extraout_EDX; - code *extraout_EDX_00; - int extraout_EDX_01; - uint8_t *puVar17; - Entity_NPC *laser; - bool bVar18; - float fVar19; - float fVar20; - void *pvVar21; - float fVar22; - void *pvVar23; - Room *pRVar24; - float fVar25; - float nextBezierB0; - float fVar26; - float bezierB2; - float bezierB3; - float nextBezierB3; - BitSet128 *b; - BitSet128 excludedMask; - BitSet128 continuumMask; - BitSet128 local_1d0; - BitSet128 local_1c0; - uint8_t local_1ac [12]; - float fadeAlpha; - BitSet128 flagsScratch; - uint8_t local_170 [16]; - Entity_Knife *knife; - Entity_Player *local_15c; - RNG local_158; - uint8_t wiggleSquareMask [8]; - Vector local_140; - Entity_Player *player; - Vector local_134; - float local_12c; - uint8_t spiralMask [8]; - Vector local_120; - Vector local_118; - uint8_t flagsAnd [8]; - Vector local_108; - uint8_t local_100 [12]; - Room *local_f4 [2]; - float local_ec; - Vector local_e8; - float local_e0; - char isSwingWeapon; - char isSword; - uint8_t local_d9; - TearParams tearHitParams; - uint8_t local_6c [44]; - void *local_40 [2]; - BitSet128 local_38; - uint32_t stackCookie; - uint8_t *puStack_20; - void *savedExceptionList; - uint8_t *puStack_18; - int ehState; - uint64_t colorOffsetXY; - uint8_t flagsByte0; - uint8_t flagsByte1; - uint16_t flagsHalf1; - Room *room; - short spinsLeft; - - puStack_20 = GHIDRA_CAST((local_40 + 0xf)); - ehState = -1; - puStack_18 = &LAB_00b0c913; - savedExceptionList = ExceptionList; - uVar10 = __security_cookie ^ GHIDRA_UINT((local_40 + 0xc)); - ExceptionList = &savedExceptionList; - if (this->_isInterpolating == 0) { - this->_friction = this->_friction * 0.7; - } - fadeFrames = this->_variant; - local_134.y = 5.60519e-45; - isSwingWeapon = '\0'; - isSword = '\0'; - switch(fadeFrames) { - case 2: - case 3: - case 4: - case 8: - case 9: -switchD_00961b98_caseD_2: - isSwingWeapon = '\x01'; - local_134.y = 1.4013e-44; - break; - case 5: - break; - default: - if (fadeFrames == 1) goto switchD_00961b98_caseD_2; - if (fadeFrames == 10) goto switchD_00961b98_caseD_b; - break; - case 0xb: -switchD_00961b98_caseD_b: - isSword = '\x01'; - local_134.y = 1.82169e-44; - } - knife = this; - stackCookie = uVar10; - player = GetPlayer(this); - fadeFrames = this->_parent; - if (fadeFrames == 0) { -LAB_009652a2: - fadeFrames = *GHIDRA_CAST(this); -LAB_009652a6: - (**(code **)(fadeFrames + 0x28))(); - } - else { - iVar2 = this->_subtype; - if (iVar2 == 0) { - local_12c = 30.0; - if (isSwingWeapon != '\0') { - local_12c = 4.0; - } - if (isSword != '\0') { - local_12c = 0.1; - } - if (((*GHIDRA_CAST((fadeFrames + 0x28)) == 2) && (isSwingWeapon == '\0')) && (isSword == '\0')) { - local_12c = *GHIDRA_CAST((fadeFrames + 0x420)) * 20.0; - } - if (extraout_EDX == 9) { - ownerPlayer = GetPlayer(this); - if ((ownerPlayer == GHIDRA_CAST(0x0)) || - (bVar8 = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::HasCollectible(0x3b,0), bVar8 == 0)) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (layer->_color)._offset[0] = 0.0; - (layer->_color)._offset[1] = 0.0; - (layer->_color)._offset[2] = 0.0; - } - else { - local_108.y = (float)g_game->_frameCount * 0.2; - fVar19 = sin(local_108.y + 0.5); - local_120.y = fVar19 * 0.17 + 0.17; - fVar19 = sin(local_108.y + 0.25); - local_e8.y = fVar19 * 0.1 + 0.1; - fVar19 = sin(local_108.y + 0.0); - local_108.y = fVar19 * 0.25 + 0.25; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (layer->_color)._offset[0] = local_120.y; - (layer->_color)._offset[1] = local_e8.y; - (layer->_color)._offset[2] = local_108.y; - } - } - tearFlagsTmp = &this->_tearFlags; - local_140.y = (float)tearFlagsTmp; - pBVar11 = BitSet128::operator_and(&local_1d0,tearFlagsTmp,&g_tearFlagLudovico); - if ((GHIDRA_INT(pBVar11->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar11->_l) + 4)) == 0) && - (GHIDRA_INT(pBVar11->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar11->_h) + 4)) == 0)) { - room = GHIDRA_CAST(GetRootParent(this)); - fadeFrames = this->_variant; - local_15c = room->_gridEntities[0xe6]; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) = room; - if ((fadeFrames != 9) && ((fadeFrames != 8 && (fadeFrames != 4)))) { - if (local_15c == GHIDRA_CAST(0x0)) goto LAB_00961f38; - if (local_15c->_type == 1) { - bVar8 = (GHIDRA_CAST((local_15c)))->Entity_Player::HasWeaponType(GHIDRA_INT(local_134.y)); - } - else { - if ((local_15c->_type != 3) || - ((((local_15c->_variant != 0x50 && (local_15c->_variant == 0xe7)) && - (fadeFrames = __RTDynamicCast(local_15c->_chargeBarSprites[6]._bitflags,0, - &IsaacRepentancePlus::Entity_Familiar::ExtraData:: - RTTI_Type_Descriptor,0,0), - local_134.y == 5.60519e-45)) && (*GHIDRA_CAST((fadeFrames + 0x4c)) != 0)))) - goto LAB_00961e18; - bVar8 = *GHIDRA_CAST((*GHIDRA_CAST(&local_15c->_isControlsEnabled) + 0x13f0 + GHIDRA_INT(local_134.y))); - } - if (bVar8 == 0) goto LAB_00961f38; - } -LAB_00961e18: - if (room != GHIDRA_CAST(this)) { - if (((isSwingWeapon != '\0') || (isSword != '\0')) && - (g_game->_frameCount - this->_spawnFrame < 2)) { - local_120.y = (float)&this->_sprite; - local_108.y = (float)ANM2::GetAnimation(GHIDRA_CAST((room->_gridEntities + 0x15)), - GHIDRA_CAST(local_40)); - ehState = 0; - if (0xf < GHIDRA_UINT(((GHIDRA_CAST(local_108.y))->_topLeftPos).x)) { - local_108.y = *GHIDRA_CAST(local_108.y); - } - pbVar12 = ((void **)(GHIDRA_INT(local_120.y) + 0x24))[4]; - if (pbVar12 == GHIDRA_CAST(0x0)) { -LAB_00961f64: - bVar8 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(local_108.y),1); - if (bVar8 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - room = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))); - } - } - else { - if (0xf < *GHIDRA_CAST((pbVar12 + 0x14))) { - pbVar12 = *GHIDRA_CAST(pbVar12); - } - pRVar24 = GHIDRA_CAST(local_108.y); - do { - bVar8 = *pbVar12; - bVar18 = bVar8 < *GHIDRA_CAST(pRVar24); - if (bVar8 != *GHIDRA_CAST(pRVar24)) { -LAB_00961f44: - uVar10 = -GHIDRA_UINT(bVar18) | 1; - goto LAB_00961f49; - } - if (bVar8 == 0) break; - bVar8 = pbVar12[1]; - bVar18 = bVar8 < (*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)pRVar24)) + 0x1))); - if (bVar8 != (*GHIDRA_CAST((GHIDRA_CAST((pRVar24)) + 0x1)))) goto LAB_00961f44; - pbVar12 = pbVar12 + 2; - pRVar24 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar24)) + 0x2)))); - } while (bVar8 != 0); - uVar10 = 0; -LAB_00961f49: - if ((uVar10 != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && - ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00961f64; - } - ehState = -1; - if (0xf < (*GHIDRA_CAST((GHIDRA_CAST(&(local_38._h)) + 0x4)))) { - uVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_38._h)) + 0x4))) + 1; - pvVar21 = local_40[0]; - if (0xfff < uVar10) { - pvVar21 = *(void **)(GHIDRA_INT(local_40[0]) + -4); - uVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_38._h)) + 0x4))) + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_40[0]) + (-4 - GHIDRA_INT(pvVar21))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar21,uVar10); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38._h)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_38._h)) + 0x4))) = 0xf; - local_40[0] = (void *)(GHIDRA_UINT(local_40[0]) & 0xffffff00); - } - this->_rotation = (float)room->_gridEntities[0x105]; - this->_displayRotation = - (this->_rotationOffset + (float)room->_gridEntities[0x107]) - - (float)room->_gridEntities[0x106]; - this->_charge = (float)room->_gridEntities[0x10f]; - if ((this->_isFlying == 0) && (*GHIDRA_CAST((room->_gridEntities + 0x110)) != '\0')) { - this->_height = (float)room->_gridEntities[0x12a]; - this->_fallingSpeed = (float)room->_gridEntities[299]; - this->_basePosOffsetY = (float)room->_gridEntities[300]; - UpdateHomingPath(this); - } - } - local_d9 = 0; - if (isSword != '\0') { - if ((((this->_sprite)._animState._animData == (void *)0x0) || - (bVar8 = AnimationState::IsEventTriggered - (&(this->_sprite)._animState,GHIDRA_CAST("SwingEnd")), bVar8 == 0)) || - (this->_isInterpolating != 0)) { - if (((room != GHIDRA_CAST(this)) && (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x4c6)) != '\0')) && - (this->_isSpinAttack == 0)) { - SpinAttack(this,*GHIDRA_CAST((room->_gridEntities + 0x133)),0); - local_d9 = 1; - } - } - else { - bVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000); - if ((bVar8 != 0) || (this->_isSpinAttack != 0)) { - local_120.y = this->_displayRotation * 0.017453292; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xffbfffff; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar3; - local_108.y = sin(local_120.y); - fVar19 = cos(local_120.y); - ownerPlayer = player; - local_120.y = fVar19 * 10.0; - local_108.y = local_108.y * 10.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = local_120.y; - local_f4[0] = GHIDRA_CAST(local_108.y); - if (player != GHIDRA_CAST(0x0)) { - Entity_Player::GetTearMovementInheritance - (player,&local_e8,GHIDRA_CAST((local_100 + 8)),0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = (local_120.y + *extraout_EAX) * ownerPlayer->_shotspeed; - local_f4[0] = GHIDRA_CAST(((local_108.y + extraout_EAX[1]) * ownerPlayer->_shotspeed)); - } - if (this->_isSpinAttack != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_100)) + 0x8))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_100)) + 0x8))); - local_f4[0] = GHIDRA_CAST(((float)local_f4[0] + (float)local_f4[0])); - } - fadeFrames = this->_variant; - uVar10 = Random(); - spawnedTear = (Entity_Tear *) - Game::Spawn(g_game,2,GHIDRA_UINT((fadeFrames == 0xb)) * 2 + 0x2f,&this->_pos, - GHIDRA_CAST((local_100 + 8)),GHIDRA_CAST(this->_spawnerEntity),0, - uVar10); - if (player != GHIDRA_CAST(0x0)) { - spawnedTear->_fallingAccel = player->_tearfallaccel; - uVar10 = Random(); - spawnedTear->_fallingSpeed = - (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * - 2.3283064e-10 * 0.2 - player->_tearfallspeed; - (GHIDRA_CAST((GHIDRA_CAST(spawnedTear))))->Entity_Projectile::SetHeight(player->_tearheight); - } - local_e8.y = (float)this->_spawnerEntity; - if (spawnedTear->_parent != 0) { - local_120.y = (float)&spawnedTear->_parent; - msvc::multiset::erase(&local_120.y); - } - spawnedTear->_parent = local_e8.y; - if (local_e8.y != 0.0) { - msvc::multiset::insert(&spawnedTear->_parent); - } - tearFlagsTmp = (GHIDRA_CAST((&g_tearFlagFetus)))->BitSet128::__bnot(GHIDRA_CAST(&local_158)); - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(local_100),&this->_tearFlags,tearFlagsTmp); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x1))) = (char)(tearFlagsTmp->_h >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags)) + 0x0))) = *GHIDRA_CAST(tearFlagsTmp); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x2))) = (short)(tearFlagsTmp->_h >> 0x10); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)); - (GHIDRA_CAST((spawnedTear)))->Entity_Tear::SetTearFlags(flags); - pcVar4 = *(code **)(*GHIDRA_CAST(spawnedTear) + 0x3c); - spawnedTear->_isFireSoundMuted = 1; - (*pcVar4)(&this->_color,0xffffffff,0xff,0,1); - if (this->_isSpinAttack == 0) { - fVar19 = this->_collisionDamage + 2.0; - } - else { - fVar19 = this->_collisionDamage * 4.0 + 4.0; - } - (**(code **)(*GHIDRA_CAST(spawnedTear) + 0x40))(fVar19); - local_120.y = (this->_sprite)._scale.x; - local_e8.y = 0.01; - pVVar13 = &local_120; - if (local_120.y <= 0.01) { - pVVar13 = &local_e8; - } - fVar19 = pVVar13->y; - spawnedTear->_baseScale = fVar19; - spawnedTear->_fScale = fVar19; - (GHIDRA_CAST((spawnedTear)))->Entity_Tear::ResetSpriteScale(); - (**(code **)(*GHIDRA_CAST(spawnedTear) + 0xc))(); - room = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))); - if ((this->_isSpinAttack != 0) && - (spinsLeft = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f0)))), 1 < spinsLeft)) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))) + 0x28))(); - spinsLeft = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f0)))); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f0)))) = spinsLeft + -1; - SpinAttack(this,spinsLeft + -1,2); - local_d9 = 1; - } - } - } - } - if (((*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x441)) != '\0') && - (*GHIDRA_CAST((room->_gridEntities + 0x110)) == '\0')) && (local_d9 == 0)) { - UpdateSwingHits(this); - local_d9 = 1; - } - if ((isSword != '\0') && (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x441)) == '\0')) { - if (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x442)) != '\0') { - local_108.y = this->_displayRotation * 0.017453292; - local_120.y = sin(local_108.y); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = cos(local_108.y); - bVar8 = 0; - local_f4[0] = GHIDRA_CAST(local_120.y); - fadeFrames = vector_to_direction(GHIDRA_CAST((local_100 + 8))); - if (*GHIDRA_CAST((room->_gridEntities + 0x131)) == '\0') { - pbVar12 = (&PTR_s_IdleLeft_00b61560)[fadeFrames]; - } - else { - pbVar12 = (&PTR_s_ChargedLeft_00b7cb28)[fadeFrames]; - } - ANM2::Play(&this->_sprite,pbVar12,bVar8); - } - if (local_d9 == 0) { - UpdateSwingHits(this); - } - } - if (*GHIDRA_CAST((room->_gridEntities + 0x110)) == '\0') { - if (room == GHIDRA_CAST(this)) { - if ((g_game->_frameCount - this->_spawnFrame < 2) || - (ABS(this->_displayRotation - this->_rotation) <= 0.1)) { - this->_displayRotation = this->_rotationOffset + this->_rotation; - } - else { - if ((player == GHIDRA_CAST(0x0)) || - (bVar8 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18d,0), bVar8 == 0)) { - fVar19 = 0.3; - } - else { - fVar19 = 1.0; - } - fVar19 = LerpAngleDeg(this->_displayRotation,this->_rotationOffset + this->_rotation, - fVar19); - this->_displayRotation = fVar19; - } - } - else { - this->_isFlying = 0; - } - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - if ((0.0 <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504))))) && (room != GHIDRA_CAST(this))) { - this->Remove(); - } - ownerPlayer = local_15c; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504)))) = &DAT_bf800000; - if (0.0 <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x514))))) { - this->_visible = 1; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x514)))) = &DAT_bf800000; - local_e8.y = (local_15c->_pos).x; - local_108.y = (local_15c->_pos).y; - local_f4[0] = GHIDRA_CAST((this->_displayRotation * 0.017453292)); - local_120.y = sin((float)local_f4[0]); - fVar19 = cos((float)local_f4[0]); - (this->_pos).x = local_e8.y + fVar19 * local_12c; - (this->_pos).y = local_108.y + local_120.y * local_12c; - fVar19 = (ownerPlayer->_pos).x; - (this->_anchorPosition).y = (ownerPlayer->_pos).y; - (this->_anchorPosition).x = fVar19; - local_120.y = (this->_pos).x; - local_12c = (this->_pos).y; - this->_basePosOffsetY = (this->_posOffset).y; - local_ec = atan2f((this->_pos).y - (ownerPlayer->_pos).y, - local_120.y - (ownerPlayer->_pos).x); - local_ec = local_ec * 57.295776; - } - else { - fVar19 = 0.8; - if (room == GHIDRA_CAST(this)) { - pRVar24 = GHIDRA_CAST(this->_speedMultiplier); - local_108.y = (float)pRVar24; - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagBigSpiral - ); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 == 0) { - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagSpiral) - ; - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - local_108.y = (float)pRVar24 * 0.75; - } - } - else { - local_108.y = (float)pRVar24 * 0.5; - } - fVar20 = LerpAngleDeg(this->_displayRotation,this->_rotationOffset + this->_rotation, - fVar19); - fVar19 = this->_knifeVelocity; - fVar22 = -2.0; - fVar26 = -5.0; - this->_displayRotation = fVar20; - fVar20 = local_108.y * fVar19 * 0.5 + this->_knifeDistance; - this->_knifeDistance = fVar20; - pRVar24 = GHIDRA_CAST(local_108.y); - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagOrbit); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - fVar22 = -0.5; - fVar26 = -0.75; - } - if (isSwingWeapon != '\0') { - fVar22 = fVar22 * 0.75; - fVar26 = fVar26 * 0.75; - } - if (this->_isInterpolating == 0) { - if (fVar19 <= 0.0) { - fVar22 = fVar26; - } - fVar22 = fVar22 * (float)pRVar24 + fVar19; - this->_knifeVelocity = fVar22; - if (((0.0 < fVar19) && (fVar22 <= 0.0)) && (isSwingWeapon != '\0')) { - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(0); - fVar20 = this->_knifeDistance; - } - } - if (0.0 <= fVar20) goto LAB_00962723; - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - this->_knifeDistance = 0.0; - this->_isFlying = 0; - this->_prismApplied = 0; - this->_multidimensionalApplied = 0; - (this->_posOffset).y = this->_basePosOffsetY; - if (isSwingWeapon != '\0') { - if (isSword == '\0') { - ANM2::Play(&this->_sprite,s_Idle,0); - } -LAB_009626f7: - if (GHIDRA_CAST(this->_parent) == player) { - SoundEffects::PlayWithFartOverride(0xf9,1.0,2,0,1.0); - } - goto LAB_00962723; - } - if (isSword != '\0') goto LAB_009626f7; - } - else { -LAB_00962723: - if (((isSwingWeapon != '\0') || (isSword != '\0')) && (room != GHIDRA_CAST(this))) { - if (this->_isFlying == 0) { - if (isSword == '\0') { - (this->_sprite)._rotation = 0.0; - ANM2::Play(&this->_sprite,&DAT_00b602e8,0); - fadeFrames = AnimationState::GetAnimationLength(&(this->_sprite)._animState); - fadeFrames = Isaac::Random(fadeFrames); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(fadeFrames); - room = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))); - } - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(0); - } - if ((0.0 < this->_knifeVelocity) && ((float)room->_gridEntities[0x109] <= 0.0)) { - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(0); - } - } - } - fVar19 = 0.0; - bVar8 = (GHIDRA_CAST((&this->_anchorPosition)))->Vector::operator_eq(&g_vectorZero); - pVVar13 = &this->_anchorPosition; - if (bVar8 != 0) { - fVar20 = (local_15c->_pos).y; - pVVar13->x = (local_15c->_pos).x; - (this->_anchorPosition).y = fVar20; - } - if (room == GHIDRA_CAST(this)) { - pvVar1 = (void *)this->_knifeDistance; - pvVar21 = (void *)this->_maxDistance; - pvVar23 = (void *)this->_charge; - } - else { - this->_isFlying = 1; - pvVar1 = room->_gridEntities[0x108]; - this->_knifeDistance = (float)pvVar1; - pvVar21 = room->_gridEntities[0x10e]; - this->_maxDistance = (float)pvVar21; - pvVar23 = room->_gridEntities[0x10f]; - this->_charge = (float)pvVar23; - this->_knifeVelocity = (float)room->_gridEntities[0x109]; - } - fVar20 = (float)pvVar1 / (float)pvVar21; - if ((float)pvVar1 / (float)pvVar21 <= fVar19) { - fVar20 = fVar19; - } - if (1.0 <= fVar20) { - fVar20 = 1.0; - } - fVar19 = 1.0 - (float)pvVar23 * fVar20 * 0.8; - local_e0 = ((local_15c->_pos).y - (this->_anchorPosition).y) * fVar19 + - (this->_anchorPosition).y; - local_108.y = fVar19 * ((local_15c->_pos).x - pVVar13->x) + pVVar13->x; - (this->_anchorPosition).y = local_e0; - pVVar13->x = local_108.y; - fVar19 = this->_displayRotation; - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagOrbit); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 == 0) { - local_120.y = fVar19 * 0.017453292; - local_118.y = sin(local_120.y); - local_e8.y = this->_knifeDistance + local_12c; - fVar19 = cos(local_120.y); - (this->_pos).x = fVar19 * local_e8.y + local_108.y; - (this->_pos).y = local_118.y * local_e8.y + local_e0; - } - else { - local_120.y = normalize_angle_degrees(this->_rotationOffset); - fVar19 = this->_knifeDistance * 3.1415927; - local_e8.y = ((fVar19 + fVar19) * (local_120.y * 0.002 + 1.0) + this->_displayRotation) - * 0.017453292; - local_118.y = sin(local_e8.y); - local_120.y = (1.0 - local_120.y * 0.02) * this->_knifeDistance * 0.25 + local_12c; - fVar19 = cos(local_e8.y); - (this->_pos).x = fVar19 * local_120.y + local_108.y; - (this->_pos).y = local_118.y * local_120.y + local_e0; - local_e8.y = this->_knifeDistance * 0.0002 * ABS(this->_knifeVelocity) + 1.0; - local_120.y = this->_knifeDistance * 0.0014 * ABS(this->_knifeVelocity) + 1.0; - pVVar13 = &local_120; - if (local_120.y <= local_e8.y) { - pVVar13 = &local_e8; - } - fVar19 = pVVar13->y; - local_f4[0] = GHIDRA_CAST((local_120.y / fVar19)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = local_e8.y / fVar19; - (*GHIDRA_CAST((GHIDRA_CAST(&(sizeMulti.y)) + 0x0))) = (char)local_f4[0]; - sizeMulti.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_100)) + 0x8))); - (*GHIDRA_CAST((GHIDRA_CAST(&(sizeMulti.y)) + 0x1))) = (char)(GHIDRA_UINT(local_f4[0]) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(sizeMulti.y)) + 0x2))) = (short)(GHIDRA_UINT(local_f4[0]) >> 0x10); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSize(fVar19 * *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)),sizeMulti, - -1); - } - fVar19 = atan2f((this->_pos).y - (local_15c->_pos).y,(this->_pos).x - (local_15c->_pos).x) - ; - fVar19 = fVar19 * 57.295776; - local_ec = fVar19; - local_e0 = fVar19; - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagOrbit); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - local_ec = fVar19 + 90.0; - local_e0 = local_ec; - } - fVar19 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504)))); - fVar20 = (this->_pos).y; - if (0.0 <= fVar19) { - if (this->_knifeDistance <= fVar19) { - if ((this->_knifeDistance < fVar19) && (room != GHIDRA_CAST(this))) { -LAB_00961f38: - this->Remove(); - ExceptionList = savedExceptionList; - return; - } - } - else { - local_108.y = (float)this; - while( true ) { - puVar16 = ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0x138]; - local_118.y = (float)puVar16; - if ((float)puVar16 < 0.0) break; - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagOrbit - ); - if ((GHIDRA_INT(tearFlagsTmp->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) && - (GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) == 0)) { - local_120.y = this->_displayRotation * 0.017453292; - local_134.y = sin(local_120.y); - } - else { - local_120.y = ((float)puVar16 * 3.1415927 * 0.5 + this->_displayRotation) * - 0.017453292; - local_134.y = sin(local_120.y); - local_118.y = local_118.y * 0.7; - } - local_118.y = local_118.y + local_12c; - fVar19 = cos(local_120.y); - local_134.y = local_134.y * local_118.y; - local_118.y = fVar19 * local_118.y + (this->_anchorPosition).x; - local_134.y = local_134.y + (this->_anchorPosition).y; - local_e0 = (this->_pos).x - local_118.y; - local_f4[0] = GHIDRA_CAST(((this->_pos).y - local_134.y)); - local_120.y = (float)((void **)(GHIDRA_INT(local_108.y) + 0x24))[0x139] * 0.017453292; - local_e8.y = cos(local_120.y); - fVar19 = sin(local_120.y); - local_118.y = local_118.y + (local_e8.y * local_e0 - fVar19 * (float)local_f4[0]); - local_134.y = local_134.y + local_e8.y * (float)local_f4[0] + fVar19 * local_e0; - (this->_pos).x = local_118.y; - (this->_pos).y = local_134.y; - local_ec = local_ec + (float)((void **)(GHIDRA_INT(local_108.y) + 0x24))[0x139]; - local_f4[0] = GHIDRA_CAST((local_ec * 0.017453292)); - local_e0 = local_ec; - local_120.y = cos((float)local_f4[0]); - fVar19 = sin((float)local_f4[0]); - pvVar21 = ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0x13a]; - pvVar23 = ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0x13b]; - fVar20 = (float)pvVar21 * fVar19 + (float)pvVar23 * local_120.y + local_134.y; - (this->_pos).y = fVar20; - (this->_pos).x = - local_118.y + ((float)pvVar21 * local_120.y - (float)pvVar23 * fVar19); - local_108.y = (float)((void **)(GHIDRA_INT(local_108.y) + 0x24))[0xe6]; - if ((GHIDRA_CAST(local_108.y) == GHIDRA_CAST(0x0)) || - ((GHIDRA_CAST(local_108.y))->_gridEntities[1] != &DAT_00000008)) break; - } - room = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))); - } - } - fVar19 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x514)))); - local_12c = fVar20; - if (((0.0 <= fVar19) && (this->_visible == 0)) && - (this->_knifeDistance <= fVar19 && fVar19 != this->_knifeDistance)) { - this->_visible = 1; - local_12c = (this->_pos).y; - } - local_120.y = (this->_pos).x; - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagContinuum); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - screen_wrap(this); - } - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagHoming); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - update_target(this,&local_e0); - local_ec = local_e0; - } - fVar19 = local_ec; - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagWiggle); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - apply_wiggle(this,&local_e0); - local_ec = local_e0; - fVar19 = local_e0; - } - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagBigSpiral); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 == 0) { - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagSpiral); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - rootParent = GHIDRA_CAST(GetRootParent(this)); - if (rootParent == this) { - local_108.y = 0.0; - } - else { - (GHIDRA_CAST((&local_158)))->RNG::game_constructor(this->_initSeed,0x23); - fVar19 = (GHIDRA_CAST((spiralRng)))->RNG::RandomFloat(); - local_108.y = fVar19 * 360.0; - fVar19 = local_ec; - } - local_f4[0] = GHIDRA_CAST((fVar19 * 0.017453292)); - local_118.y = sin((float)local_f4[0]); - local_e0 = cos((float)local_f4[0]); - local_134.y = this->_knifeDistance; - local_f4[0] = GHIDRA_CAST(((local_134.y * 3.0 + local_108.y) * 0.017453292)); - local_e8.y = cos((float)local_f4[0]); - fVar19 = sin((float)local_f4[0]); - fVar20 = local_134.y * 0.5; - if (fVar20 <= 0.0) { - fVar20 = 0.0; - } - if (50.0 <= fVar20) { - fVar20 = 50.0; - } - (this->_pos).y = - fVar20 * (fVar19 * local_e0 + local_e8.y * local_118.y) + (this->_pos).y; - (this->_pos).x = - fVar20 * (local_e8.y * local_e0 - fVar19 * local_118.y) + (this->_pos).x; - local_ec = this->_knifeDistance * 3.0 + 90.0 + local_108.y + local_ec; - } - } - else { - rootParent = GHIDRA_CAST(GetRootParent(this)); - if (rootParent == this) { - local_108.y = 0.0; - } - else { - (GHIDRA_CAST((&local_158)))->RNG::game_constructor(this->_initSeed,0x23); - fVar19 = (GHIDRA_CAST((spawnedTear)))->RNG::RandomFloat(); - local_108.y = fVar19 * 360.0; - fVar19 = local_ec; - } - local_f4[0] = GHIDRA_CAST((fVar19 * 0.017453292)); - local_118.y = sin((float)local_f4[0]); - local_e0 = cos((float)local_f4[0]); - local_134.y = this->_knifeDistance; - local_f4[0] = GHIDRA_CAST(((local_134.y + local_134.y + local_108.y) * 0.017453292)); - local_e8.y = cos((float)local_f4[0]); - fVar19 = sin((float)local_f4[0]); - fVar20 = local_134.y * 0.5; - if (fVar20 <= 0.0) { - fVar20 = 0.0; - } - if (180.0 <= fVar20) { - fVar20 = 180.0; - } - (this->_pos).y = - fVar20 * (fVar19 * local_e0 + local_e8.y * local_118.y) + (this->_pos).y; - (this->_pos).x = - fVar20 * (local_e8.y * local_e0 - fVar19 * local_118.y) + (this->_pos).x; - local_ec = this->_knifeDistance + this->_knifeDistance + 90.0 + local_108.y + local_ec; - } - pRVar24 = GHIDRA_CAST(0x0); - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagSquare); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - rootParent = GHIDRA_CAST(GetRootParent(this)); - if (rootParent != this) { - (GHIDRA_CAST((GHIDRA_CAST(local_100))))->RNG::game_constructor(this->_initSeed,0x23); - fVar19 = (GHIDRA_CAST((squareRng)))->RNG::RandomFloat(); - pRVar24 = GHIDRA_CAST((fVar19 * 120.0)); - } - local_f4[0] = GHIDRA_CAST((local_ec * 0.017453292)); - local_e8.y = (float)pRVar24; - local_118.y = sin((float)local_f4[0]); - local_e0 = cos((float)local_f4[0]); - local_f4[0] = GHIDRA_CAST(cos(1.5707964)); - fVar19 = sin(1.5707964); - local_134.y = fVar19 * local_e0 + (float)local_f4[0] * local_118.y; - local_108.y = (float)local_f4[0] * local_e0 - fVar19 * local_118.y; - fVar19 = fmodf(local_e8.y + this->_knifeDistance,120.0); - if (40.0 <= fVar19) { - if (60.0 <= fVar19) { - if (fVar19 < 100.0) { - fVar20 = ((fVar19 - 60.0) * 20.0) / 40.0; - fVar19 = fVar20 * local_e0 + local_108.y * 15.0; - fVar20 = fVar20 * local_118.y + local_134.y * 15.0; - goto LAB_0096357e; - } - fVar20 = ((120.0 - fVar19) * 20.0) / 20.0; - fVar19 = 15.0 - ((fVar19 - 100.0) * 30.0) / 20.0; - (this->_pos).y = fVar19 * local_134.y + fVar20 * local_118.y + (this->_pos).y; - (this->_pos).x = fVar19 * local_108.y + fVar20 * local_e0 + (this->_pos).x; - local_ec = local_ec - 90.0; - } - else { - fVar20 = ((60.0 - fVar19) * 20.0) / 20.0; - fVar19 = 15.0 - ((fVar19 - 40.0) * 30.0) / 20.0; - (this->_pos).x = (fVar20 * local_e0 - local_108.y * fVar19) + (this->_pos).x; - local_ec = local_ec + 90.0; - (this->_pos).y = (fVar20 * local_118.y - local_134.y * fVar19) + (this->_pos).y; - } - } - else { - fVar20 = (fVar19 * 20.0) / 40.0; - fVar19 = fVar20 * local_e0 - local_108.y * 15.0; - fVar20 = fVar20 * local_118.y - local_134.y * 15.0; -LAB_0096357e: - (this->_pos).x = fVar19 + (this->_pos).x; - (this->_pos).y = fVar20 + (this->_pos).y; - } - } - if ((room == GHIDRA_CAST(this)) && (player != GHIDRA_CAST(0x0))) { - bVar8 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x76,0); - if ((bVar8 != 0) && (this->_knifeVelocity <= 0.0 && this->_knifeVelocity != 0.0)) { - bVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); - if (bVar8 != 0) { - uVar10 = Random(); - local_108.y = *GHIDRA_CAST((this->_parent + 0x33c)); - local_e0 = *GHIDRA_CAST((this->_parent + 0x340)); - local_f4[0] = GHIDRA_CAST((this->_rotation * 0.017453292)); - local_e8.y = sin((float)local_f4[0]); - fVar19 = cos((float)local_f4[0]); - local_118.x = local_108.y + fVar19 * 30.0; - local_118.y = local_e0 + local_e8.y * 30.0; - room = GHIDRA_CAST(Game)::SpawnEx(g_game,8,0,&local_118,&g_vectorZero,GHIDRA_CAST(player),1, - uVar10,1); - local_108.y = (float)room; - if (room != GHIDRA_CAST(0x0)) { - fadeFrames = *GHIDRA_CAST(room); - (GHIDRA_CAST((room->_gridEntities + 0xca)))->x = 0.0; - room->_gridEntities[0xcb] = (void *)0xc1200000; - (**(code **)(fadeFrames + 0x40))(this->_collisionDamage * 0.4); - (**(code **)(*GHIDRA_CAST(room) + 0x3c))(&(this->_sprite)._color,0xffffffff,0xff,0,1); - HomingLaser::operator_assign - (GHIDRA_CAST((room->_gridEntities + 0x111)),&this->_homingLaser); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetParent(GHIDRA_CAST(this)); - pvVar21 = *(void **)(GHIDRA_INT(&(this->_tearFlags)._l) + 4); - pvVar23 = *(void **)&(this->_tearFlags)._h; - pvVar1 = *(void **)(GHIDRA_INT(&(this->_tearFlags)._h) + 4); - ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0xfb] = *(void **)&(this->_tearFlags)._l; - ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0xfc] = pvVar21; - ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0xfd] = pvVar23; - ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0xfe] = pvVar1; - uVar10 = Random(); - local_e0 = (float)((double)GHIDRA_INT(uVar10) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * 2.3283064e-10 - * 50.0 - 25.0; - local_f4[0] = GHIDRA_CAST((this->_rotation * 0.017453292)); - local_e8.y = sin((float)local_f4[0]); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = cos((float)local_f4[0]); - local_f4[0] = GHIDRA_CAST(local_e8.y); - direction.y = local_e8.y; - direction.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_100)) + 0x8))); - InitHomingPath(GHIDRA_CAST(local_108.y),direction,GHIDRA_CAST(this),local_e0); - (GHIDRA_CAST(((void **)(GHIDRA_INT(local_108.y) + 0x24) + 0x30)))->x = - (this->_sprite)._scale.x; - ((void **)(GHIDRA_INT(local_108.y) + 0x24))[0x31] = (void *)(this->_sprite)._scale.y; - (**(code **)(GHIDRA_INT(*GHIDRA_CAST(local_108.y)) + 0xc))(); - } - } - } - } - } - if (isSwingWeapon == '\0') { - if (isSword != '\0') goto LAB_00963b53; - fVar19 = normalize_angle_degrees(local_ec - 90.0); - (this->_sprite)._rotation = fVar19; - local_d9 = 0.0 < fVar19; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_flipX = local_d9; - } - else { - if (isSword == '\0') { - if (this->_isFlying != 0) goto LAB_00963c34; - } - else { -LAB_00963b53: - if (this->_isFlying != 0) { - fVar19 = normalize_angle_degrees(local_ec - 90.0); - (this->_sprite)._rotation = fVar19; - goto LAB_00963c34; - } - } - fVar19 = atan2f(local_12c - (local_15c->_pos).y,local_120.y - (local_15c->_pos).x); - fVar19 = normalize_angle_degrees(fVar19 * 57.295776 - 90.0); - (this->_sprite)._rotation = fVar19; - local_e8.y = (float)ANM2::GetLayerFrame(&this->_sprite,0); - if (GHIDRA_CAST(local_e8.y) != GHIDRA_CAST(0x0)) { - local_f4[0] = GHIDRA_CAST(((this->_sprite)._rotation * 0.017453292)); - local_120.y = cos((float)local_f4[0]); - fVar19 = sin((float)local_f4[0]); - this->_knifeDepthOffset = - local_120.y * *GHIDRA_CAST((GHIDRA_CAST(local_e8.y) + 4)) + fVar19 * *GHIDRA_CAST(local_e8.y); - } - } -LAB_00963c34: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x518)))) = local_ec; - if ((this->_isFlying != 0) && (this->_visible != 0)) { - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(flagsAnd),&this->_tearFlags, - &g_tearFlagMysteriousLiquidCreep); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if ((bVar8 != 0) && - ((bVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0), bVar8 != 0 && - (uVar10 = Random(), (uVar10 & 1) == 0)))) { - local_e8.x = (this->_pos).x; - local_e8.y = (this->_pos).y; - pVVar13 = Room::GetClampedPosition - (g_game->_room,GHIDRA_CAST((local_100 + 8)),&local_e8,15.0); - local_e8.x = pVVar13->x; - local_e8.y = pVVar13->y; - uVar10 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x35,&local_e8,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),0,uVar10); - fVar19 = (this->_sprite)._scale.x; - fVar20 = g_vectorOne.x * 0.4; - fadeFrames = *GHIDRA_CAST(tmpEntity); - fVar22 = g_vectorOne.y * 0.4; - pAVar6 = &tmpEntity[1]._sprite; - (pAVar6->_filename)._buf[4] = '\x1e'; - (pAVar6->_filename)._buf[5] = '\0'; - (pAVar6->_filename)._buf[6] = '\0'; - (pAVar6->_filename)._buf[7] = '\0'; - pAVar6 = &tmpEntity[1]._sprite; - (pAVar6->_filename)._buf[8] = '\x1e'; - (pAVar6->_filename)._buf[9] = '\0'; - (pAVar6->_filename)._buf[10] = '\0'; - (pAVar6->_filename)._buf[0xb] = '\0'; - (tmpEntity->_sprite)._scale.x = fVar19 * fVar20; - (tmpEntity->_sprite)._scale.y = fVar19 * fVar22; - (**(code **)(fadeFrames + 0xc))(); - } - } - if ((((((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))) != this) || (this->_variant == 8)) || - (this->_variant == 4)) && - ((*GHIDRA_CAST(((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24) + 0x110)) == '\0' && - (*GHIDRA_CAST((GHIDRA_INT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24)) + 0x442)) == '\0')))) && - (*GHIDRA_CAST((GHIDRA_INT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24)) + 0x441)) == '\0')) { - this->Remove(); - } - } - else if (*GHIDRA_CAST((this->_parent + 0x28)) == 1) { - ownerPlayer = (Entity_Player *) - __RTDynamicCast(this->_parent,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,0xdc,0); - bVar8 = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::HasWeaponType(GHIDRA_INT(local_134.y)); - if (bVar8 == 0) { - this->Remove(); - } - this->_isFlying = 0; - fVar19 = (this->_velocity).y; - fVar20 = (this->_velocity).x; - if (fVar20 * fVar20 + fVar19 * fVar19 <= 0.1) { - fVar19 = (this->_sprite)._rotation; - } - else { - fVar19 = atan2f(fVar19,fVar20); - fVar19 = LerpAngleDeg((this->_sprite)._rotation,fVar19 * 57.295776 - 90.0,0.24); - (this->_sprite)._rotation = fVar19; - } - local_d9 = 0.0 < fVar19; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_flipX = local_d9; - pBVar11 = BitSet128::operator_and(GHIDRA_CAST(&local_158),tearFlagsTmp,&g_tearFlagContinuum) - ; - bVar8 = (GHIDRA_CAST((pBVar11)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - screen_wrap(this); - } - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),tearFlagsTmp,&g_tearFlagHoming); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - room = GHIDRA_CAST(this->_target); - if (room == GHIDRA_CAST(0x0)) { - local_120.y = 22500.0; - local_108.y = (float)room; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(&local_158), - &this->_pos,150.0,8); - ehState = 1; - local_e8.y = 0.0; - if (GHIDRA_CAST(local_158._shift3) != GHIDRA_CAST(0x0)) { - do { - room = *GHIDRA_CAST((local_158._shift1 + GHIDRA_INT(local_e8.y) * 4)); - bVar8 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar8 != 0) { - fVar19 = (this->_pos).x - (GHIDRA_CAST((room->_gridEntities + 0xc6)))->x; - fVar20 = (this->_pos).y - (float)room->_gridEntities[199]; - pRVar24 = GHIDRA_CAST((fVar20 * fVar20 + fVar19 * fVar19)); - if ((room->_topLeftPos).x < (float)room->_gridEntities[0xd7]) { - if ((float)pRVar24 < local_120.y) { - local_120.y = (float)pRVar24; - local_108.y = (float)room; - } - } - } - local_e8.y = (float)(GHIDRA_INT(local_e8.y) + 1); - } while (GHIDRA_UINT(local_e8.y) < GHIDRA_UINT(local_158._shift3)); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(local_108.y)); - (GHIDRA_CAST((&local_158)))->EntityList_Query::~EntityList_Query(); - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = (this->_pos).x - (GHIDRA_CAST((room->_gridEntities + 0xc6)))->x; - local_f4[0] = GHIDRA_CAST(((this->_pos).y - (float)room->_gridEntities[199])); - pVVar13 = (GHIDRA_CAST((GHIDRA_CAST((local_100 + 8)))))->Vector::Normalized(&local_120); - fVar19 = pVVar13->y; - fadeFrames = this->_target; - (this->_velocity).x = (this->_velocity).x - pVVar13->x; - (this->_velocity).y = (this->_velocity).y - fVar19; - fVar19 = (this->_pos).y - *GHIDRA_CAST((fadeFrames + 0x340)); - fVar20 = (this->_pos).x - *GHIDRA_CAST((fadeFrames + 0x33c)); - if (22500.0 < fVar19 * fVar19 + fVar20 * fVar20) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - } - } - } - tearFlagsTmp = BitSet128::operator_and - (GHIDRA_CAST(&local_158),&this->_tearFlags,&g_tearFlagWiggle); - if ((GHIDRA_INT(tearFlagsTmp->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) || - (GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) != 0)) { - local_e8.x = (this->_velocity).y; - local_e8.y = (float)(GHIDRA_UINT((this->_velocity).x) ^ 0x80000000); - (GHIDRA_CAST((&local_e8)))->Vector::Normalize(); - fVar19 = (this->_velocity).y; - fVar20 = (this->_velocity).x; - fVar19 = sqrtf(fVar20 * fVar20 + fVar19 * fVar19); - local_f4[0] = GHIDRA_CAST((fVar19 * 0.5)); - local_120.y = 30.0; - pfVar14 = GHIDRA_CAST(local_f4); - if (30.0 <= (float)local_f4[0]) { - pfVar14 = &local_120.y; - } - fVar20 = sin((float)g_game->_frameCount * 0.4); - fVar19 = *pfVar14; - (this->_pos).x = local_e8.x * fVar20 * fVar19 + (this->_pos).x; - (this->_pos).y = local_e8.y * fVar20 * fVar19 + (this->_pos).y; - } - tearFlagsTmp = BitSet128::operator_and - (&continuumMask,&this->_tearFlags,&g_tearFlagContinuum); - if ((GHIDRA_INT(tearFlagsTmp->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) && - (GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) == 0)) { - pVVar13 = (GHIDRA_CAST((g_game->_room)))->Room::GetClampedPosition(&local_134,&this->_pos,0.0); - (this->_pos).x = pVVar13->x; - (this->_pos).y = pVVar13->y; - } - puVar16 = GHIDRA_CAST(0x0); - local_158._shift1 = 0; - local_118.y = 0.0; - local_158._shift2 = 0; - local_158._shift3 = 0; - ehState = 2; - local_108.y = (float)this->_child; - if (GHIDRA_CAST(local_108.y) != GHIDRA_CAST(0x0)) { - do { - if (GHIDRA_CAST(local_158._shift2) == puVar16) { - msvc::vector::_Emplace_reallocate((char)local_158._shift2,&local_108.y); - puVar16 = GHIDRA_CAST(local_158._shift3); - } - else { - *GHIDRA_CAST(local_158._shift2) = local_108.y; - local_158._shift2 = local_158._shift2 + 4; - } - local_108.y = (float)(GHIDRA_CAST(local_108.y))->_gridEntities[0xe7]; - } while (GHIDRA_CAST(local_108.y) != GHIDRA_CAST(0x0)); - local_108.y = 0.0; - local_118.y = (float)puVar16; - } - local_e0 = (float)g_game->_frameCount; - if (this->_isInterpolating != 0) { - local_e0 = local_e0 + 0.5; - } - fadeFrames = local_158._shift2 - local_158._shift1; - local_e8.y = 0.0; - puVar17 = GHIDRA_CAST((fadeFrames >> 2)); - if (puVar17 != GHIDRA_CAST(0x0)) { - local_12c = local_e0 * 6.0; - do { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) = *GHIDRA_CAST((local_158._shift1 + GHIDRA_INT(local_e8.y) * 4)); - (GHIDRA_CAST((((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))))->_gridEntities + 0xcf)))->x = (this->_velocity).x; - ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))))->_gridEntities[0xd0] = (void *)(this->_velocity).y; - local_108.y = this->_size * 5.0; - room = GHIDRA_CAST((((float)((double)GHIDRA_INT(local_e8.y) + - __uint_to_double_fixup[-(GHIDRA_INT(local_e8.y) >> 0x1f)]) * 360.0) / - (float)((double)GHIDRA_INT(puVar17) + - __uint_to_double_fixup[-(fadeFrames >> 0x1f)]) + local_12c)); - fVar19 = local_e0; - local_120.y = (float)room; - tearFlagsTmp = BitSet128::operator_and(&local_1c0,&this->_tearFlags,&g_tearFlagPulse); - if ((GHIDRA_INT(tearFlagsTmp->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) || - (GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) != 0)) { - fVar19 = sin(fVar19 * 0.3); - local_108.y = ((fVar19 + 1.0) * 0.5 * 0.5 + 1.0) * local_108.y; - room = GHIDRA_CAST(local_120.y); - } - local_f4[0] = GHIDRA_CAST(((float)room * 0.017453292)); - local_15c = GHIDRA_CAST(sin((float)local_f4[0])); - fVar20 = cos((float)local_f4[0]); - fVar19 = (this->_pos).y; - (GHIDRA_CAST(((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24) + 0xc6)))->x = - fVar20 * local_108.y + (this->_pos).x; - pvVar21 = (void *)(local_120.y - 90.0); - ((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24))[199] = - (void *)((float)local_15c * local_108.y + fVar19); - if (360.0 < ABS((float)pvVar21)) { - pvVar21 = (void *)fmodf((float)pvVar21,360.0); - } - if ((float)pvVar21 <= 180.0) { - if ((float)pvVar21 < -180.0) { - pvVar21 = (void *)((float)pvVar21 + 360.0); - } - } - else { - pvVar21 = (void *)((float)pvVar21 - 360.0); - } - fVar19 = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))); - ((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24))[0x32] = pvVar21; - (**(code **)(GHIDRA_CAST(fVar19) + 0x3c))(&(this->_sprite)._color,0xffffffff,0xff,0,1); - pvVar21 = *(void **)(GHIDRA_INT(&(this->_tearFlags)._l) + 4); - pvVar23 = *(void **)&(this->_tearFlags)._h; - pvVar1 = *(void **)(GHIDRA_INT(&(this->_tearFlags)._h) + 4); - fVar19 = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_170))) + 0xc))); - ((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24))[0xfb] = *(void **)&(this->_tearFlags)._l; - ((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24))[0xfc] = pvVar21; - ((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24))[0xfd] = pvVar23; - ((void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x24))[0xfe] = pvVar1; - (**(code **)(GHIDRA_CAST(fVar19) + 0x40))(this->_collisionDamage); - local_e8.y = (float)(GHIDRA_INT(local_e8.y) + 1); - } while (GHIDRA_UINT(local_e8.y) < puVar17); - } - ehState = -1; - if ((void *)local_158._shift1 != (void *)0x0) { - deallocate((void *)local_158._shift1,GHIDRA_INT(local_118.y) - local_158._shift1 >> 2); - } - } - if ((this->_isFlying != 0) && - ((tearFlagsTmp = BitSet128::operator_and - (&local_1c0,&this->_tearFlags,&g_tearFlagHydrobounce), - GHIDRA_INT(tearFlagsTmp->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0 || - (GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) != 0)))) { - fVar19 = this->_height; - room = GHIDRA_CAST(&this->_fallingSpeed); - if ((fVar19 < 0.0) || (*GHIDRA_CAST(room) <= 0.0 && *GHIDRA_CAST(room) != 0.0)) { - fVar20 = *GHIDRA_CAST(room); - local_120.y = (float)room; - fVar19 = fVar19 + fVar20; - this->_height = fVar19; - if (this->_knifeVelocity <= 0.0) { - local_f4[0] = GHIDRA_CAST((fVar19 * -0.1)); - pfVar14 = GHIDRA_CAST(local_f4); - if (fVar19 * -0.1 < fVar20) { - pfVar14 = &this->_fallingSpeed; - } - fVar20 = *pfVar14; - } - else { - fVar20 = fVar20 + 1.5; - } - this->_fallingSpeed = fVar20; - if (0.0 <= fVar19) { - this->_height = 0.0; - if ((this->_knifeVelocity <= 0.0) || (fVar20 <= 0.5)) { - fVar20 = 0.0; - } - else { - fVar20 = fVar20 * -0.8; - } - *GHIDRA_CAST(room) = fVar20; - uVar10 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0xe,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar10 - ); - fVar19 = g_vectorOne.y * 0.75; - pcVar4 = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (tmpEntity->_sprite)._scale.x = g_vectorOne.x * 0.75; - (tmpEntity->_sprite)._scale.y = fVar19; - (*pcVar4)(&(knife->_sprite)._color,0xffffffff,0xff,0,1); - tmpEntity->Update(); - SoundEffects::PlayWithFartOverride(0x96,0.5,2,0,1.0); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x1))) = (char)(GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_140.y) + 8))) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00)) + 0x0))) = *GHIDRA_CAST(local_140.y); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x2))) = (short)(GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_140.y) + 8))) >> 0x10); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_CAST(local_140.y) + 0xc)); - tear_flags_area_apply(&this->_pos,GHIDRA_CAST(knife),30.0,knife->_collisionDamage,flags_00) - ; - fVar19 = knife->_height; - room = GHIDRA_CAST(local_120.y); - this = knife; - } - } - (this->_posOffset).y = fVar19 + this->_basePosOffsetY; - if ((isSwingWeapon == '\0') && (isSword == '\0')) { - local_f4[0] = GHIDRA_CAST(this->_knifeVelocity); - local_140.y = atan2f(-*GHIDRA_CAST(room),(float)local_f4[0]); - fVar19 = sin((this->_sprite)._rotation * 0.017453292); - (this->_sprite)._rotation = local_140.y * 57.295776 * fVar19 + (this->_sprite)._rotation; - if ((float)local_f4[0] < 0.0) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - local_d9 = layer->_flipX == 0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_flipX = local_d9; - } - } - } - if (this->_isInterpolating == 0) { - if ((this->_isFlying == 0) || (this->_dead != 0)) { - fadeFrames = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))); - if (fadeFrames != 0) { - iVar2 = *GHIDRA_CAST((fadeFrames + 0x458)); - if (iVar2 < 9) { - (GHIDRA_CAST((GHIDRA_CAST(local_1ac))))->Color::operator_assign(GHIDRA_CAST((fadeFrames + 0xf0))); - fadeFrames = 8; - if (iVar2 < 8) { - fadeFrames = iVar2; - } - fadeAlpha = (float)fadeFrames * (this->_color)._tint[3] * 0.125; - (GHIDRA_CAST((GHIDRA_CAST((extraout_EDX_01 + 0x48)))))->Sprite::SetColor(GHIDRA_CAST(local_1ac)); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) + 0x4bc)) = - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) + 0x4bc)) + 4.0; - } - else { - *GHIDRA_CAST((fadeFrames + 0x458)) = 8; - } - } - } - else if ((player != GHIDRA_CAST(0x0)) && - (bVar8 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x44,0), bVar8 != 0)) { - laser = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))); - local_d9 = 0; - if (laser == GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = (player->_pos).x; - local_f4[0] = GHIDRA_CAST((player->_pos).y); - local_140.x = (player->_posOffset).x + 0.0; - local_140.y = (player->_posOffset).y - 8.0; - techLaser = Entity_Laser::ShootAngle - (2,GHIDRA_CAST((local_100 + 8)),0.0,-1,&local_140,GHIDRA_CAST(player),0) - ; - b = &g_tearFlagOrbit; - flagsByte0 = 0xe0; - flagsByte1 = 0x48; - flagsHalf1 = 0xc3; - pBVar11 = &g_tearFlagSpiral; - tearFlagsTmp = BitSet128::operator_or - (GHIDRA_CAST(wiggleSquareMask),&g_tearFlagWiggle, - &g_tearFlagSquare); - tearFlagsTmp = BitSet128::operator_or(GHIDRA_CAST(spiralMask),tearFlagsTmp,pBVar11); - tearFlagsTmp = BitSet128::operator_or - (GHIDRA_CAST(local_170),tearFlagsTmp, - (BitSet128 *) - CONCAT22(flagsHalf1,CONCAT11(flagsByte1,flagsByte0))); - tearFlagsTmp = BitSet128::operator_or(&excludedMask,tearFlagsTmp,b); - tearFlagsTmp = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::__bnot(&flagsScratch); - tearFlagsTmp = BitSet128::operator_and(&local_38,&this->_tearFlags,tearFlagsTmp); - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)); - qVar7 = tearFlagsTmp->_h; - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)); - *GHIDRA_CAST(&(techLaser->_tearFlags)._l) = GHIDRA_INT(tearFlagsTmp->_l); - *GHIDRA_CAST((GHIDRA_INT(&(techLaser->_tearFlags)._l) + 4)) = uVar3; - *GHIDRA_CAST(&(techLaser->_tearFlags)._h) = GHIDRA_INT(qVar7); - *GHIDRA_CAST((GHIDRA_INT(&(techLaser->_tearFlags)._h) + 4)) = uVar5; - color = (GHIDRA_CAST((player)))->Entity_Player::get_laser_color_copy(GHIDRA_CAST(local_6c)); - (*extraout_EDX_00)(color,0xffffffff,0xff,0,1); - techLaser->SetCollisionDamage(this->_charge * this->_collisionDamage); - techLaser->_mass = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))))))->EntityPtr::SetReference(GHIDRA_CAST(techLaser)); - laser = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))); - local_d9 = 1; - if (laser != GHIDRA_CAST(0x0)) goto LAB_0096499b; - } - else { -LAB_0096499b: - local_140.y = (this->_pos).x - (laser->_pos).x; - local_120.y = (this->_pos).y - (laser->_pos).y; - fVar19 = atan2f(local_120.y,local_140.y); - (GHIDRA_CAST((laser)))->Entity_NPC::SetAimAngle(fVar19 * 57.295776); - fadeFrames = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))); - fVar19 = sqrtf(local_140.y * local_140.y + local_120.y * local_120.y); - *GHIDRA_CAST((fadeFrames + 0x4d0)) = fVar19; - if (-0.5 <= local_120.y) { - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))) + 0x358)) = 0x453b8000; - } - else { - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))) + 0x358)) = 0xc1200000; - } - } - if (local_d9 != 0) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))) + 0xc))(); - } - } - if (((this->_isFlying == 0) || (this->_dead != 0)) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))) != GHIDRA_CAST(0x0))) { - fadeFrames = **GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x500)))); - goto LAB_009652a6; - } - } - } - else if (iVar2 == 1) { - local_108.y = -100.0; - puVar16 = GHIDRA_CAST(this->_pathSegment); - local_118.y = 0.0; - local_120.y = 1e+07; - if (puVar16 < (uint32_t *) - ((GHIDRA_INT((this->_homingLaser)._bezier._end) - - GHIDRA_INT((this->_homingLaser)._bezier._begin)) / 0x18 + -1)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) = GHIDRA_INT(puVar16) * 0x18; - do { - pvVar21 = (void *)((*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + GHIDRA_INT((this->_homingLaser)._bezier._begin)); - room = GHIDRA_CAST(bezier_closest_point) - (&this->_pos,pvVar21,(void *)(GHIDRA_INT(pvVar21) + 0x18),&local_140.y); - if ((float)room < local_120.y) { - if (puVar16 == GHIDRA_CAST(this->_pathSegment)) { - if (!(this->_pathProgress <= local_140.y && local_140.y != this->_pathProgress)) - goto LAB_00964bdf; - } - local_108.y = local_140.y; - local_120.y = (float)room; - local_118.y = (float)puVar16; - } -LAB_00964bdf: - puVar16 = GHIDRA_CAST((GHIDRA_INT(puVar16) + 1)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) + 0x18; - } while (puVar16 < (GHIDRA_INT((this->_homingLaser)._bezier._end) - - GHIDRA_INT((this->_homingLaser)._bezier._begin)) / 0x18 - 1U); - } - room = GHIDRA_CAST(&this->_tearFlags); - local_140.y = (float)room; - tearFlagsTmp = BitSet128::operator_and(&local_38,GHIDRA_CAST(room),&g_tearFlagHydrobounce); - if ((GHIDRA_INT(tearFlagsTmp->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) || - (GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) != 0)) { - if (g_game->_frameCount - this->_spawnFrame == 1) { - uVar10 = Random(); - this->_fallingSpeed = - -5.0 - (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) - * 2.3283064e-10 * 3.0; - } - fVar19 = this->_height; - if ((fVar19 < 0.0) || (this->_fallingSpeed <= 0.0 && this->_fallingSpeed != 0.0)) { - fVar20 = this->_fallingSpeed + 1.5; - fVar19 = fVar19 + this->_fallingSpeed; - this->_fallingSpeed = fVar20; - this->_height = fVar19; - if (0.0 <= fVar19) { - this->_height = 0.0; - if (fVar20 <= 0.5) { - fVar20 = 0.0; - } - else { - fVar20 = fVar20 * -0.8; - } - this->_fallingSpeed = fVar20; - uVar10 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0xe,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar10 - ); - fVar19 = g_vectorOne.y * 0.75; - pcVar4 = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (tmpEntity->_sprite)._scale.x = g_vectorOne.x * 0.75; - (tmpEntity->_sprite)._scale.y = fVar19; - (*pcVar4)(&(knife->_sprite)._color,0xffffffff,0xff,0,1); - tmpEntity->Update(); - SoundEffects::PlayWithFartOverride(0x96,0.5,2,0,1.0); - room = GHIDRA_CAST(local_140.y); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x1))) = (char)(GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_140.y) + 8))) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01)) + 0x0))) = *GHIDRA_CAST(local_140.y); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x2))) = (short)(GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_140.y) + 8))) >> 0x10); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_CAST(local_140.y) + 0xc)); - tear_flags_area_apply(&this->_pos,GHIDRA_CAST(knife),30.0,knife->_collisionDamage,flags_01) - ; - fVar19 = knife->_height; - this = knife; - } - } - (this->_posOffset).y = fVar19 + this->_basePosOffsetY; - } - if (local_108.y <= -99.0) { - this->Remove(); - } - else { - fVar19 = 1.0 - local_108.y; - pvVar21 = (this->_homingLaser)._bezier._begin; - fVar25 = fVar19 * fVar19 * fVar19; - fVar20 = fVar19 * fVar19 * 3.0 * local_108.y; - bezierB2 = fVar19 * 3.0 * local_108.y * local_108.y; - bezierB3 = local_108.y * local_108.y * local_108.y; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) = - bezierB2 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x24)) + - fVar25 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 4)) + - fVar20 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x14)) + - bezierB3 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x1c)); - fVar19 = local_108.y + this->_pathFollowSpeed; - fVar22 = 1.0 - fVar19; - nextBezierB0 = fVar22 * fVar22 * fVar22; - fVar26 = fVar22 * 3.0 * fVar19 * fVar19; - nextBezierB3 = fVar19 * fVar19 * fVar19; - fVar19 = fVar22 * fVar22 * 3.0 * fVar19; - local_e0 = nextBezierB3 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x1c)) + - nextBezierB0 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 4)) + - fVar19 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x14)) + - fVar26 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x24)); - local_f4[0] = GHIDRA_CAST((nextBezierB0 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18)) + - fVar19 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x10)) + - fVar26 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x20)) + - nextBezierB3 * - *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x18)))); - local_140.y = local_e0 - (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_170)) + 0xc))); - local_140.x = (float)local_f4[0] - - (bezierB2 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x20)) + - fVar20 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x10)) + - fVar25 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18)) + - bezierB3 * *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x18))); - (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_120); - bVar8 = 0; - local_140.x = (local_120.y * this->_pathOffset + (float)local_f4[0]) - (this->_pos).x; - local_140.y = (-local_120.x * this->_pathOffset + local_e0) - (this->_pos).y; - pVVar13 = (GHIDRA_CAST((&local_140)))->Vector::Resized(GHIDRA_CAST((local_100 + 8)),8.0); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(pVVar13,bVar8); - fVar19 = atan2f(this->_fallingSpeed + (this->_velocity).y,(this->_velocity).x + 0.0); - fVar19 = normalize_angle_degrees(fVar19 * 57.295776 - 90.0); - (this->_sprite)._rotation = fVar19; - local_d9 = 0.0 < fVar19; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_flipX = local_d9; - this->_pathSegment = GHIDRA_INT(local_118.y); - this->_pathProgress = local_108.y; - } - Room::GetClampedPositionImpl(g_game->_room,&local_140,&this->_pos,-200.0,-200.0,-200.0,-200.0) - ; - fVar19 = (this->_pos).y - local_140.y; - fVar20 = (this->_pos).x - local_140.x; - if (1.0 < fVar19 * fVar19 + fVar20 * fVar20) { - tearFlagsTmp = BitSet128::operator_and(&local_38,GHIDRA_CAST(room),&g_tearFlagContinuum); - if ((GHIDRA_INT(tearFlagsTmp->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) && - (GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) == 0)) { - this->Remove(); - } - else { - pVVar13 = (GHIDRA_CAST((g_game->_room)))->Room::ScreenWrapPosition(&local_140,&this->_pos,-200.0); - (this->_pos).x = pVVar13->x; - (this->_pos).y = pVVar13->y; - tearFlagsTmp = (GHIDRA_CAST((&g_tearFlagContinuum)))->BitSet128::__bnot(&local_38); - tearFlagsTmp = BitSet128::operator_and(&flagsScratch,GHIDRA_CAST(room),tearFlagsTmp); - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)); - qVar7 = tearFlagsTmp->_h; - fadeFrames = *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)); - *GHIDRA_CAST(room) = GHIDRA_INT(tearFlagsTmp->_l); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) = uVar3; - room->_roomType = GHIDRA_INT(qVar7); - room->_gridWidth = fadeFrames; - tearFlagsTmp = (GHIDRA_CAST((&g_tearFlagOrbit)))->BitSet128::__bnot(&local_38); - tearFlagsTmp = BitSet128::operator_and(&flagsScratch,GHIDRA_CAST(room),tearFlagsTmp); - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)); - qVar7 = tearFlagsTmp->_h; - iVar2 = *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)); - fadeFrames = this->_parent; - *GHIDRA_CAST(room) = GHIDRA_INT(tearFlagsTmp->_l); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) = uVar3; - room->_roomType = GHIDRA_INT(qVar7); - room->_gridWidth = iVar2; - tmpEntity = *GHIDRA_CAST((fadeFrames + 0x3bc)); - uVar10 = Random(); - local_140.y = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)] - ) * 2.3283064e-10 * 50.0 - 25.0; - pVVar13 = (GHIDRA_CAST((&this->_velocity)))->Vector::Normalized(&local_120); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = pVVar13->x; - local_f4[0] = GHIDRA_CAST(pVVar13->y); - (*GHIDRA_CAST((GHIDRA_CAST(&(direction_00.y)) + 0x1))) = (char)(GHIDRA_UINT(local_f4[0]) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(direction_00)) + 0x0))) = *GHIDRA_CAST(pVVar13); - (*GHIDRA_CAST((GHIDRA_CAST(&(direction_00.y)) + 0x2))) = (short)(GHIDRA_UINT(local_f4[0]) >> 0x10); - InitHomingPath(this,direction_00,tmpEntity,local_140.y); - } - } - if (300 < g_game->_frameCount - this->_spawnFrame) goto LAB_009652a2; - } - else if (iVar2 == 3) { - local_140.y = *GHIDRA_CAST((fadeFrames + 0x33c)); - local_f4[0] = *GHIDRA_CAST((fadeFrames + 0x340)); - local_108.x = local_140.y - (this->_pos).x; - local_120.y = (float)local_f4[0] - (this->_pos).y; - local_108.y = local_120.y; - local_e8.y = local_108.x; - if (900.0 < local_108.x * local_108.x + local_120.y * local_120.y) { - pVVar13 = (GHIDRA_CAST((&local_108)))->Vector::Resized(GHIDRA_CAST((local_170 + 8)),30.0); - fVar19 = pVVar13->y; - (this->_pos).x = local_140.y - pVVar13->x; - (this->_pos).y = (float)local_f4[0] - fVar19; - } - fVar19 = atan2f(local_120.y,local_e8.y); - fVar19 = normalize_angle_degrees(fVar19 * 57.295776 + 90.0); - (this->_sprite)._rotation = fVar19; - local_d9 = 0.0 < fVar19; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_flipX = local_d9; - this->_friction = this->_friction * 0.7; - } - else if (iVar2 == 4) { - if (this->_isSwinging != 0) { - UpdateSwingHits(this,uVar10); - fadeFrames = this->_parent; - if (fadeFrames == 0) goto LAB_009652a2; - } - fVar19 = 0.017453292; - local_f4[0] = *GHIDRA_CAST((fadeFrames + 0x33c)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) = *GHIDRA_CAST((fadeFrames + 0x340)); - tearFlagsTmp = BitSet128::operator_and(&local_38,&this->_tearFlags,&g_tearFlagWait); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsZero(); - if (((bVar8 == 0) && (4 < g_game->_frameCount - this->_spawnFrame)) || - (bVar8 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), bVar8 == 0)) { - tearFlagsTmp = BitSet128::operator_and(&local_38,&this->_tearFlags,&g_tearFlagWait); - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if (bVar8 != 0) { - fadeFrames = ANM2::GetFrame(&this->_sprite); - if (fadeFrames < 5) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - } - else { - local_140.y = this->_displayRotation * 0.017453292; - local_f4[0] = GHIDRA_CAST(sin(local_140.y)); - fVar19 = cos(local_140.y); - (this->_velocity).x = fVar19 * 16.0; - (this->_velocity).y = (float)local_f4[0] * 16.0; - } - } - } - else { - fadeFrames = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f4)))); - local_108.y = this->_rotation * fVar19; - room = GHIDRA_CAST(sin(local_108.y)); - if (fadeFrames == 0) { - local_140.y = (float)room; - fVar20 = cos(local_108.y); - fVar19 = (this->_targetPosition).x; - fVar20 = (((float)local_f4[0] + fVar20 * fVar19) - (this->_pos).x) / this->_friction; - fVar19 = (((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_170)) + 0xc))) + fVar19 * local_140.y) - (this->_pos).y) / - this->_friction; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_170)) + 0xc))) = room; - fVar20 = cos(local_108.y); - fVar19 = (this->_targetPosition).x; - fVar20 = (fVar20 * fVar19 + *GHIDRA_CAST((fadeFrames + 0x33c))) - (this->_pos).x; - fVar19 = ((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_170)) + 0xc))) * fVar19 + *GHIDRA_CAST((fadeFrames + 0x340))) - - (this->_pos).y; - } - (this->_velocity).x = fVar20; - (this->_velocity).y = fVar19; - this->_displayRotation = this->_rotation; - (this->_sprite)._rotation = this->_rotation - 90.0; - pfVar14 = ANM2::GetLayerFrame(&this->_sprite,0); - if (pfVar14 != GHIDRA_CAST(0x0)) { - local_140.y = (this->_sprite)._rotation * 0.017453292; - local_f4[0] = GHIDRA_CAST(cos(local_140.y)); - fVar19 = sin(local_140.y); - this->_knifeDepthOffset = (float)local_f4[0] * pfVar14[1] + fVar19 * *pfVar14; - } - } - if ((this->_isSwinging == 0) && - (this->Remove(), *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f4)))) != 0)) { - msvc::vector::assign(&this->_hitList); - } - } - } - local_d9 = this->_isInterpolating; - if ((local_d9 == 0) && (this->_multidimensionalApplied != 0)) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c94188) && - (_Init_thread_header(&DAT_00c94188), DAT_00c94188 == -1)) { - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c94190))))->Color::Color(-1.0,-1.0,-1.0,1.0,1.0,1.0); - fVar20 = -0.33; - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c941bc))))->Color::Color(-0.33,-0.33,-0.33,0.66,0.66,0.66); - fVar19 = 0.33; - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c941e8))))->Color::Color(0.33,0.33,0.33,0.33,0.33,0.33); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c94214))))->Color::Color(1.0,1.0,1.0,0.0,0.0,0.0); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c94240))))->Color::Color(fVar19,fVar19,fVar19,0.33,0.33,0.33); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c9426c))))->Color::Color(fVar20,fVar20,fVar20,0.66,0.66,0.66); - _Init_thread_footer(&DAT_00c94188); - } - colorOffsetXY = *GHIDRA_CAST((knife->_color)._offset); - color = (ColorMod *) - FUN_004072e0((knife->_color)._tint[0],(knife->_color)._tint[1],(knife->_color)._tint[2], - (knife->_color)._tint[3],(knife->_color)._colorize[0], - (knife->_color)._colorize[1],(knife->_color)._colorize[2], - (knife->_color)._colorize[3],GHIDRA_INT(colorOffsetXY), - (char)((uint64_t)colorOffsetXY >> 0x20),(knife->_color)._offset[2]); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color); - local_d9 = knife->_isInterpolating; - this = knife; - } - tearFlagsTmp = BitSet128::operator_and(&local_38,&this->_tearFlags,&g_tearFlagAttractor); - if (((GHIDRA_INT(tearFlagsTmp->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) || - (GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) != 0)) && (local_d9 == 0)) - { - if (this->_subtype == 4) { - fVar19 = 20.0; - } - else if (this->_isFlying == 0) { - fVar19 = 1.0; - } - else { - fVar19 = (this->_knifeDistance - 0.0) / 100.0; - if (fVar19 <= 0.0) { - fVar19 = 0.0; - } - if (1.0 <= fVar19) { - fVar19 = 1.0; - } - fVar19 = fVar19 * 29.0 + 1.0; - } - Game::AttractEntities(g_game,&this->_pos,(void *)0x0,(void *)0x0,fVar19,250.0); - } - if ((isSwingWeapon == '\0') && (isSword == '\0')) { -LAB_009658dd: - bVar8 = 3; -LAB_009658e1: - bVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(GHIDRA_UINT(bVar8),0); - if (bVar8 != 0) { - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(0); - } - } - else { - if (this->_isFlying != 0) { - this->_size = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)) * (this->_sprite)._scale.x; - } - if (isSwingWeapon == '\0') { - if (isSword == '\0') goto LAB_009658dd; - } - else if (this->_variant == 2) { - tearFlagsTmp = BitSet128::operator_and(&flagsScratch,&this->_tearFlags,&g_tearFlagWait); - if ((GHIDRA_INT(tearFlagsTmp->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) && - (GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) == 0)) { - bVar18 = false; - } - else { - bVar18 = true; - } - bVar8 = 5; - if (bVar18) { - bVar8 = 10; - } - goto LAB_009658e1; - } - } - FUN_00861970(this); - if (this->_isInterpolating != 0) { - ExceptionList = savedExceptionList; - return; - } - if ((((isSwingWeapon == '\0') && (isSword == '\0')) || (this->_isFlying != 0)) && - (this->_visible != 0)) { - room = g_game->_room; - local_140.y = (float)(GHIDRA_CAST((room)))->Room::GetGridIndex(&this->_pos); - if (-1 < GHIDRA_INT(local_140.y)) { - if (GHIDRA_INT(local_140.y) < 0x1c0) { - room = room->_gridEntities[GHIDRA_INT(local_140.y)]; - local_120.y = (float)room; - if (((room != GHIDRA_CAST(0x0)) && (room->_gridEntities[6] != (void *)0x1)) && - ((room->_gridEntities[6] != (void *)0x0 && (uVar10 = Random(), (uVar10 & 3) == 0)))) { - local_158._seed = GHIDRA_INT((this->_tearFlags)._l); - local_158._shift1 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - local_158._shift2 = *GHIDRA_CAST(&(this->_tearFlags)._h); - local_158._shift3 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - if (player != GHIDRA_CAST(0x0)) { - pTVar15 = Entity_Player::GetTearHitParams - (player,&tearHitParams,4,1.0,0,GHIDRA_CAST(this->_spawnerEntity)); - local_158._seed = local_158._seed | GHIDRA_UINT((pTVar15->_flags)._l); - local_158._shift1 = local_158._shift1 | *GHIDRA_CAST((GHIDRA_INT(&(pTVar15->_flags)._l) + 4)); - local_158._shift2 = local_158._shift2 | GHIDRA_UINT((pTVar15->_flags)._h); - local_158._shift3 = local_158._shift3 | *GHIDRA_CAST((GHIDRA_INT(&(pTVar15->_flags)._h) + 4)); - } - tearFlagsTmp = BitSet128::operator_or(&local_38,&g_tearFlagAcid,&g_tearFlagRock); - tearFlagsTmp = BitSet128::operator_and(&flagsScratch,GHIDRA_CAST(&local_158),tearFlagsTmp) - ; - bVar8 = (GHIDRA_CAST((tearFlagsTmp)))->BitSet128::IsNonZero(); - if ((bVar8 != 0) && (cVar9 = (**(code **)(GHIDRA_INT(*GHIDRA_CAST(room)) + 0x1c))(), cVar9 != '\0')) - { - pcVar4 = *(code **)(GHIDRA_INT(*GHIDRA_CAST(room)) + 0x14); - (GHIDRA_CAST((GHIDRA_CAST((local_6c + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - cVar9 = (*pcVar4)(0,local_6c + 4); - if (cVar9 != '\0') { - local_140.y = ((this->_sprite)._rotation + 90.0) * 0.017453292; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = cos(local_140.y); - local_f4[0] = GHIDRA_CAST(sin(local_140.y)); - Vector::ToCardinal(&local_140,GHIDRA_CAST((local_100 + 8))); - bVar8 = (GHIDRA_CAST((cardinalDir)))->Vector::operator_ne(&g_vectorZero); - fVar19 = local_120.y; - if (bVar8 != 0) { - pVVar13 = (GHIDRA_CAST((GHIDRA_CAST(local_120.y))))->GridEntity::Position(&local_e8); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_100)) + 0x8))) = local_140.x * 40.0 + pVVar13->x; - local_f4[0] = GHIDRA_CAST((local_140.y * 40.0 + pVVar13->y)); - local_120.y = (float)g_game->_room; - fadeFrames = (GHIDRA_CAST((GHIDRA_CAST(local_120.y))))->Room::GetGridIndex(GHIDRA_CAST((local_100 + 8))); - if (-1 < fadeFrames) { - if (fadeFrames < 0x1c0) { - (GHIDRA_CAST((GHIDRA_CAST(local_120.y))))->Room::TryMakeBridge(((void **)(GHIDRA_INT(local_120.y) + 0x24))[fadeFrames], - GHIDRA_CAST(fVar19)); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_120.y))))->Room::TryMakeBridge(GHIDRA_CAST(0x0),GHIDRA_CAST(fVar19)); - } - } - } - goto LAB_00965b8b; - } - } - } - } - room = g_game->_room; - (GHIDRA_CAST((GHIDRA_CAST((local_1ac + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((room)))->Room::DamageGridWithSource(GHIDRA_INT(local_140.y),1,GHIDRA_CAST((local_1ac + 4))); - } - } -LAB_00965b8b: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - ExceptionList = savedExceptionList; - return; -} - -// 00965d30 -void Entity_Knife::Render(Vector *offset) -{ - Entity_Player *player; - int iVar1; - Entity *rootParent; - Vector *position; - AnimationState *secondAnimState; - int deadEyeLevel; - float extraout_EDX; - float savedColorOffsetZ; - float savedColorizeR; - float savedColorizeG; - float savedColorizeB; - float savedColorizeA; - float savedTintR; - float savedTintG; - float savedTintB; - float savedTintA; - Vector savedColorOffset; - float fVar2; - float savedRotation; - double dVar3; - float local_e8; - float local_e4; - float *local_e0; - float local_dc; - float local_d8; - float local_d4; - float local_d0; - float rotationOffset; - float trailDistanceBase; - int trailIndex; - Vector trailRenderPos; - Vector local_b8; - float local_b0; - float fStack_ac; - float fStack_a8; - float fStack_a4; - float local_a0; - float fStack_9c; - float fStack_98; - float fStack_94; - ColorMod trailColor; - ColorMod savedColor; - ColorMod deadEyeColor; - uint32_t local_c; - Sprite *deadEyeSprite; - ColorMod *spriteColor; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_e8); - if (this->_visible != 0) { - player = GetPlayer(this); - if ((player == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) { - fVar2 = 0.5; - if ((((GHIDRA_UINT(g_tearFlagOrbit._l) & GHIDRA_UINT((this->_tearFlags)._l)) != 0 || - ((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._l)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4))) != 0) || - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagOrbit._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._h)) + 0x4)))) != 0)) && - ((this->_isFlying != 0 && (this->_subtype == 0)))) { - savedTintR = (this->_sprite)._color._tint[0]; - savedTintG = (this->_sprite)._color._tint[1]; - savedTintB = (this->_sprite)._color._tint[2]; - savedTintA = (this->_sprite)._color._tint[3]; - local_e0 = GHIDRA_CAST((this->_sprite)._color._offset[2]); - spriteColor = &(this->_sprite)._color; - savedColorizeR = (this->_sprite)._color._colorize[0]; - savedColorizeG = (this->_sprite)._color._colorize[1]; - savedColorizeB = (this->_sprite)._color._colorize[2]; - savedColorizeA = (this->_sprite)._color._colorize[3]; - savedColorOffset.x = (this->_sprite)._color._offset[0]; - savedColorOffset.y = (this->_sprite)._color._offset[1]; - savedRotation = (this->_sprite)._rotation; - local_e4 = savedRotation; - local_b8 = savedColorOffset; - local_b0 = savedTintR; - fStack_ac = savedTintG; - fStack_a8 = savedTintB; - fStack_a4 = savedTintA; - local_a0 = savedColorizeR; - fStack_9c = savedColorizeG; - fStack_98 = savedColorizeB; - fStack_94 = savedColorizeA; - savedColor._tint[0] = savedTintR; - savedColor._tint[1] = savedTintG; - savedColor._tint[2] = savedTintB; - savedColor._tint[3] = savedTintA; - iVar1 = GetBaseVariant(this); - if (iVar1 == 1) { - trailDistanceBase = 4.0; - } - else { - trailDistanceBase = 30.0; - } - rootParent = GetRootParent(this); - local_d0 = (float)rootParent->_parent; - savedColorOffsetZ = extraout_EDX; - if (local_d0 != 0.0) { - trailIndex = 1; - do { - trailColor._tint[3] = (0.6 - (float)trailIndex * 0.3) * savedColor._tint[3]; - fVar2 = this->_rotationOffset; - local_d4 = ABS(fVar2); - local_d8 = this->_knifeDistance - (float)(trailIndex + 1) * this->_knifeVelocity * 0.2; - rotationOffset = fVar2; - trailColor._tint[0] = savedTintR; - trailColor._tint[1] = savedTintG; - trailColor._tint[2] = savedTintB; - if (360.0 < local_d4) { - fVar2 = fmodf(fVar2,360.0); - } - if (fVar2 <= 180.0) { - if (fVar2 < -180.0) { - fVar2 = fVar2 + 360.0; - } - } - else { - fVar2 = fVar2 - 360.0; - } - local_dc = ((local_d8 * 3.1415927 + local_d8 * 3.1415927) * (fVar2 * 0.002 + 1.0) + - this->_displayRotation) * 0.017453292; - local_e8 = cos(local_dc); - local_dc = sin(local_dc); - fVar2 = rotationOffset; - if (360.0 < local_d4) { - fVar2 = fmodf(rotationOffset,360.0); - } - if (fVar2 <= 180.0) { - if (fVar2 < -180.0) { - fVar2 = fVar2 + 360.0; - } - } - else { - fVar2 = fVar2 - 360.0; - } - fVar2 = (1.0 - fVar2 * 0.02) * local_d8 * 0.25 + trailDistanceBase; - local_d4 = fVar2 * local_dc + (this->_anchorPosition).y; - local_e8 = fVar2 * local_e8 + (this->_anchorPosition).x; - fVar2 = atan2f(local_d4 - *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x340)), - local_e8 - *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x33c))); - if (spriteColor != &trailColor) { - spriteColor->_tint[0] = trailColor._tint[0]; - (this->_sprite)._color._tint[1] = trailColor._tint[1]; - (this->_sprite)._color._tint[2] = trailColor._tint[2]; - (this->_sprite)._color._tint[3] = trailColor._tint[3]; - (this->_sprite)._color._colorize[0] = local_a0; - (this->_sprite)._color._colorize[1] = fStack_9c; - (this->_sprite)._color._colorize[2] = fStack_98; - (this->_sprite)._color._colorize[3] = fStack_94; - (this->_sprite)._color._offset[0] = local_b8.x; - (this->_sprite)._color._offset[1] = local_b8.y; - (this->_sprite)._color._offset[2] = (float)local_e0; - } - local_d8 = g_displayPixelRatio; - (this->_sprite)._rotation = fVar2 * 57.295776; - local_d8 = local_d8 * g_screenPointScale; - local_e8 = (((local_e8 + (this->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_d8 + 0.5; - dVar3 = floor((double)local_e8); - local_dc = (float)dVar3 / local_d8; - local_e8 = (((local_d4 + (this->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * local_d8 + 0.5; - dVar3 = floor((double)local_e8); - local_e8 = (float)dVar3; - trailRenderPos.x = local_dc + offset->x; - trailRenderPos.y = local_e8 / local_d8 + offset->y; - if ((this->_sprite)._loaded != 0) { - if ((this->_sprite)._overlayRenderFirst == 0) { - AnimationState::Render - (&(this->_sprite)._animState,&trailRenderPos,&g_vectorZero,&g_vectorZero); - secondAnimState = &(this->_sprite)._overlayAnimState; - } - else { - AnimationState::Render - (&(this->_sprite)._overlayAnimState,&trailRenderPos,&g_vectorZero, - &g_vectorZero); - secondAnimState = &(this->_sprite)._animState; - } - AnimationState::Render(secondAnimState,&trailRenderPos,&g_vectorZero,&g_vectorZero); - } - trailIndex = trailIndex + -1; - savedTintR = local_b0; - savedTintG = fStack_ac; - savedTintB = fStack_a8; - } while (-1 < trailIndex); - fVar2 = 0.5; - savedColorOffsetZ = (float)local_e0; - savedRotation = local_e4; - savedColorOffset = local_b8; - savedTintA = fStack_a4; - savedColorizeR = local_a0; - savedColorizeG = fStack_9c; - savedColorizeB = fStack_98; - savedColorizeA = fStack_94; - } - if (spriteColor != &savedColor) { - (this->_sprite)._color._offset[0] = savedColorOffset.x; - (this->_sprite)._color._offset[1] = savedColorOffset.y; - spriteColor->_tint[0] = savedTintR; - (this->_sprite)._color._tint[1] = savedTintG; - (this->_sprite)._color._tint[2] = savedTintB; - (this->_sprite)._color._tint[3] = savedTintA; - (this->_sprite)._color._offset[2] = savedColorOffsetZ; - (this->_sprite)._color._colorize[0] = savedColorizeR; - (this->_sprite)._color._colorize[1] = savedColorizeG; - (this->_sprite)._color._colorize[2] = savedColorizeB; - (this->_sprite)._color._colorize[3] = savedColorizeA; - } - (this->_sprite)._rotation = savedRotation; - } - local_e0 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_e4 = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * fVar2) * (float)local_e0 + fVar2; - dVar3 = floor((double)local_e4); - local_d0 = (float)dVar3 / (float)local_e0; - local_e4 = ((((this->_pos).y + (this->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * (float)local_e0 + 0.5; - dVar3 = floor((double)local_e4); - local_e4 = (float)dVar3; - fVar2 = offset->y; - (this->_renderPosition).x = local_d0 + offset->x; - (this->_renderPosition).y = local_e4 / (float)local_e0 + fVar2; - ANM2::Render(&this->_sprite,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - iVar1 = GetBaseVariant(this); - if ((iVar1 == 1) && (this->_subtype != 4)) { - player = GetPlayer(this); - if ((player != GHIDRA_CAST(0x0)) && (iVar1 = player->_deadEyeCharges, 0 < iVar1)) { - local_e0 = ANM2::GetLayerFrame(&this->_sprite,0); - deadEyeSprite = DAT_00c72214; - deadEyeColor._tint[0] = 1.0; - deadEyeColor._tint[1] = 1.0; - deadEyeLevel = 8; - if (iVar1 < 8) { - deadEyeLevel = iVar1; - } - deadEyeColor._tint[2] = 1.0; - deadEyeColor._colorize[0] = 0.0; - deadEyeColor._colorize[1] = 0.0; - deadEyeColor._colorize[2] = 0.0; - deadEyeColor._colorize[3] = 0.0; - deadEyeColor._offset[0] = 0.0; - deadEyeColor._offset[1] = 0.0; - deadEyeColor._offset[2] = 0.0; - deadEyeColor._tint[3] = (float)deadEyeLevel * 0.125; - (GHIDRA_CAST((DAT_00c72214)))->Sprite::SetColor(&deadEyeColor); - if ((this->_isFlying == 0) && (local_e0 != GHIDRA_CAST(0x0))) { - local_e4 = (this->_sprite)._rotation * 0.017453292; - local_d0 = cos(local_e4); - local_d4 = sin(local_e4); - local_dc = (this->_sprite)._scale.x; - local_e8 = local_e0[1]; - local_e4 = *local_e0; - local_e0 = GHIDRA_CAST((this->_sprite)._scale.y); - fVar2 = atan2f(local_e8,local_e4); - position = &local_b8; - deadEyeSprite->_rotation = fVar2 * 57.295776 + (this->_sprite)._rotation; - fVar2 = (this->_sprite)._scale.y; - (deadEyeSprite->_scale).x = (this->_sprite)._scale.x * 0.9; - (deadEyeSprite->_scale).y = fVar2 * 0.5; - local_b8.y = (local_e8 * local_d0 + local_e4 * local_d4) * (float)local_e0 * 0.5 + - (this->_renderPosition).y; - local_b8.x = (local_e4 * local_d0 - local_e8 * local_d4) * local_dc * 0.5 + - (this->_renderPosition).x; - } - else { - deadEyeSprite->_rotation = 0.0; - (deadEyeSprite->_scale).x = (this->_sprite)._scale.x; - (deadEyeSprite->_scale).y = (this->_sprite)._scale.y; - position = &this->_renderPosition; - } - ANM2::Render(GHIDRA_CAST(deadEyeSprite),position,&g_vectorZero,&g_vectorZero); - } - } - FUN_00861a50(this,offset); - } - } - return; -} - -// 009665e0 -int Entity_Knife::GetRenderZ() -{ - int iVar1; - - floor((double)((this->_knifeDepthOffset + (this->_pos).y) * 100.0 + 10030.0 + 0.5)); - iVar1 = __ftoui3(); - return iVar1; -} - -// 00966650 -Entity_Player * Entity_Knife::GetPlayer() -{ - Entity_Player *owner; - int ownerType; - - owner = GHIDRA_CAST(this->_parent); - if ((owner != GHIDRA_CAST(0x0)) && - ((owner->_type != 8 || (owner = GHIDRA_CAST(owner->_parent), owner != GHIDRA_CAST(0x0)) - ))) { - ownerType = owner->_type; - if (ownerType == 1) { - return owner; - } - if (ownerType == 3) { - return *GHIDRA_CAST(&owner->_isControlsEnabled); - } - if (ownerType == 1000) { - owner = GHIDRA_CAST(owner->_parent); - if ((owner != GHIDRA_CAST(0x0)) && (owner->_type == 1)) { - return owner; - } - } - else if (((ownerType == 2) && - (owner = GHIDRA_CAST(owner->_spawnerEntity), owner != GHIDRA_CAST(0x0))) && - (owner->_type == 1)) { - return owner; - } - } - return GHIDRA_CAST(0x0); -} - -// 009666c0 -Entity * Entity_Knife::GetRootParent() -{ - Entity_Knife *nextParent; - Entity_Knife *parent; - - nextParent = GHIDRA_CAST(this->_parent); - while ((parent = nextParent, parent != GHIDRA_CAST(0x0) && (parent->_type == 8))) { - this = parent; - nextParent = GHIDRA_CAST(parent->_parent); - } - return GHIDRA_CAST(this); -} - -// 00966ef0 -void Entity_Knife::Shoot(float charge, float range) -{ - uint8_t bVar1; - uint8_t *curAnimChar; - uint32_t uVar2; - uint32_t startFrame; - void *curAnimData; - uint8_t *wantAnimChar; - bool bVar3; - double launchSpeed; - float gravity; - float savedGravity; - uint8_t *animData; - int variant; - - gravity = -2.0; - savedGravity = -2.0; - this->_maxDistance = charge * range; - uVar2 = GHIDRA_UINT((this->_tearFlags)._h); - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagOrbit._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._l)) + 0x4)))) != 0) || - ((uVar2 & GHIDRA_UINT(g_tearFlagOrbit._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._h)) + 0x4)))) != 0)) { - gravity = (float)&DAT_bf800000; - savedGravity = (float)&DAT_bf800000; - } - variant = this->_variant; - switch(variant) { - case 2: - case 3: - case 4: - case 8: - case 9: -switchD_00966f89_caseD_2: - gravity = gravity * 0.75; - savedGravity = gravity; - break; - case 5: - case 0xb: - break; - default: - if (variant == 1) goto switchD_00966f89_caseD_2; - } - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagHydrobounce._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._l)) + 0x4)))) != 0) || - ((uVar2 & GHIDRA_UINT(g_tearFlagHydrobounce._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._h)) + 0x4)))) != 0)) { - gravity = gravity * 0.75; - this->_height = 0.0; - this->_fallingSpeed = -10.0; - savedGravity = gravity; - } - launchSpeed = (double)ABS((charge * range) / (gravity * -0.5)); - if (launchSpeed < 0.0) { - libm_sse2_sqrt_precise(); - } - else { - launchSpeed = SQRT(launchSpeed); - } - this->_knifeDistance = 0.0; - this->_isFlying = 1; - this->_knifeVelocity = (float)launchSpeed * -savedGravity; - this->_charge = charge; - switch(variant) { - case 2: - case 3: - case 4: - case 8: - case 9: - break; - case 5: - case 0xb: - goto switchD_00967064_caseD_5; - default: - if (this->_variant != 1) goto switchD_00967064_caseD_5; - } - (this->_sprite)._rotation = 0.0; - this->_knifeDepthOffset = 0.0; - (this->_hitList)._end = (this->_hitList)._begin; - animData = (this->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_009670ee: - bVar1 = ANM2::SetAnimation(&this->_sprite,&DAT_00b602e8,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - wantAnimChar = &DAT_00b602e8; - do { - bVar1 = *curAnimChar; - bVar3 = bVar1 < *wantAnimChar; - if (bVar1 != *wantAnimChar) { -LAB_009670d0: - uVar2 = -GHIDRA_UINT(bVar3) | 1; - goto LAB_009670d5; - } - if (bVar1 == 0) break; - bVar1 = curAnimChar[1]; - bVar3 = bVar1 < wantAnimChar[1]; - if (bVar1 != wantAnimChar[1]) goto LAB_009670d0; - curAnimChar = curAnimChar + 2; - wantAnimChar = wantAnimChar + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_009670d5: - if ((uVar2 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_009670ee; - } - curAnimData = (this->_sprite)._animState._animData; - if ((curAnimData == (void *)0x0) || (uVar2 = *GHIDRA_CAST((GHIDRA_CAST(curAnimData) + 0x30)), uVar2 == 0)) { - startFrame = 0; - } - else { - startFrame = Random(); - startFrame = startFrame % uVar2; - curAnimData = (this->_sprite)._animState._animData; - } - if (curAnimData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(startFrame)); - } -switchD_00967064_caseD_5: - UpdateHomingPath(this); - return; -} - -// 00967180 -void Entity_Knife::UpdateHomingPath() -{ - double dVar1; - uint32_t uVar2; - uint32_t uVar3; - int iVar4; - Vector direction; - uint64_t qVar5; - uint8_t bVar6; - Entity_Player *player; - int iVar7; - uint32_t rngResult; - uint32_t seed; - Entity *spawned; - Entity_Knife *spawnedKnife; - int *laser; - char extraout_DL; - int unaff_EDI; - float fVar8; - float fVar9; - Entity_Knife *spawned; - uint8_t auVar11 [12]; - float fVar12; - uint8_t auStack_5e [2]; - Entity_Knife *local_5c; - int knifeCount; - Vector spawnPos; - ColorMod laserColor; - - *GHIDRA_CAST(&(this->_usedTearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_usedTearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_usedTearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_usedTearFlags)._h) + 4)) = 0; - player = GetPlayer(this); - if (player != GHIDRA_CAST(0x0)) { - iVar7 = GetBaseVariant(this); - if ((((iVar7 != 1) && (iVar7 = GetBaseVariant(this), iVar7 != 10)) && (extraout_DL != '\0')) && - ((bVar6 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xe5,0), bVar6 != 0 && (0.25 < this->_charge)) - )) { - rngResult = Random(); - knifeCount = GHIDRA_INT((((float)(rngResult % 3 + 3) + 0.0) * this->_charge)); - local_5c = this; - if (0 < knifeCount) { - do { - rngResult = Random(); - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]; - seed = Random(); - iVar7 = this->_parent; - fVar12 = *GHIDRA_CAST((iVar7 + 0x340)); - fVar8 = ((float)((double)GHIDRA_INT(rngResult) + dVar1) * 2.3283064e-10 * 360.0 - 180.0) * - 0.017453292; - fVar9 = cos(fVar8); - spawnPos.x = fVar9 * 30.0 + *GHIDRA_CAST((iVar7 + 0x33c)); - fVar8 = sin(fVar8); - spawnPos.y = fVar8 * 30.0 + fVar12; - spawned = Game::SpawnEx(g_game,8,0,&spawnPos,&g_vectorZero,GHIDRA_CAST(player),1,seed,0); - spawnedKnife = GHIDRA_CAST(__RTDynamicCast(spawned,0)); - iVar7 = *GHIDRA_CAST(spawnedKnife); - (spawnedKnife->_posOffset).x = 0.0; - (spawnedKnife->_posOffset).y = -10.0; - (**(code **)(iVar7 + 0x40))(); - fVar12 = 1.4013e-45; - spawnedKnife->SetColor(&(local_5c->_sprite)._color,0xffffffff,0xff); - (GHIDRA_CAST((&spawnedKnife->_homingLaser)))->HomingLaser::operator_assign(&local_5c->_homingLaser); - if (spawnedKnife->_parent != 0) { - msvc::multiset::erase(auStack_5e + -0xe); - } - spawnedKnife->_parent = local_5c; - msvc::multiset::insert(&spawnedKnife->_parent); - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&(local_5c->_tearFlags)._l) + 4)); - qVar5 = (local_5c->_tearFlags)._h; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&(local_5c->_tearFlags)._h) + 4)); - *GHIDRA_CAST(&(spawnedKnife->_tearFlags)._l) = GHIDRA_INT((local_5c->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&(spawnedKnife->_tearFlags)._l) + 4)) = uVar2; - *GHIDRA_CAST(&(spawnedKnife->_tearFlags)._h) = GHIDRA_INT(qVar5); - *GHIDRA_CAST((GHIDRA_INT(&(spawnedKnife->_tearFlags)._h) + 4)) = uVar3; - fVar8 = cos(fVar12); - spawned = GHIDRA_CAST(sin(fVar12)); - direction.y = (float)spawned; - direction.x = fVar8; - InitHomingPath(spawnedKnife,direction,GHIDRA_CAST(local_5c),0.0); - spawnedKnife->_pathFollowSpeed = 0.05; - spawnedKnife->Update(); - knifeCount = knifeCount + -1; - this = local_5c; - local_5c = spawned; - } while (knifeCount != 0); - } - } - bVar6 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18b,0); - if (bVar6 != 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) + 0x28))(); - } - rngResult = Random(); - spawned = Game::SpawnEx(g_game,7,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(player),3,rngResult,0); - laser = GHIDRA_CAST(__RTDynamicCast(spawned,0)); - laserColor._tint[0] = (player->_laserColor)._tint[0]; - laserColor._tint[1] = (player->_laserColor)._tint[1]; - laserColor._tint[2] = (player->_laserColor)._tint[2]; - laserColor._tint[3] = (player->_laserColor)._tint[3]; - laserColor._colorize[0] = (player->_laserColor)._colorize[0]; - laserColor._colorize[1] = (player->_laserColor)._colorize[1]; - laserColor._colorize[2] = (player->_laserColor)._colorize[2]; - laserColor._colorize[3] = (player->_laserColor)._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(laserColor._offset)) + 0x0))) = *GHIDRA_CAST((player->_laserColor)._offset); - laserColor._offset[2] = (player->_laserColor)._offset[2]; - (**(code **)(*laser + 0x3c))(&laserColor,0xffffffff); - laser[0xd3] = GHIDRA_INT((this->_posOffset).x); - laser[0xd4] = GHIDRA_INT((this->_posOffset).y); - if (laser[0xef] != 0) { - msvc::multiset::erase(auStack_5e + -0x12); - } - laser[0xef] = GHIDRA_INT(this); - msvc::multiset::insert(laser + 0xef); - laser[0xd6] = 0x453b8000; - iVar7 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - qVar5 = (this->_tearFlags)._h; - iVar4 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - laser[0x10a] = GHIDRA_INT((this->_tearFlags)._l); - laser[0x10b] = iVar7; - laser[0x10c] = GHIDRA_INT(qVar5); - laser[0x10d] = iVar4; - auVar11 = ZEXT812(0x3ea8f5c3); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))) < this->_charge) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))) = this->_charge; - } - (**(code **)(*laser + 0x40))((*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))) * this->_collisionDamage); - laser[0x116] = 600; - fVar12 = this->_charge; - if (fVar12 <= 0.0) { - fVar12 = 0.0; - } - if (1.0 <= fVar12) { - fVar12 = 1.0; - } - laser[0x12f] = GHIDRA_INT((fVar12 * 60.0 + 20.0)); - if (laser[0xf2] != 0) { - msvc::multiset::erase(auStack_5e + -0x16); - } - laser[0xf2] = unaff_EDI; - msvc::multiset::insert(laser + 0xf2); - (**(code **)(*laser + 0xc))(); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) != 0) { - msvc::multiset::erase(); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) = laser; - msvc::multiset::insert(); - } - } - return; -} - -// 00967650 -void Entity_Knife::update_target(float *outAngle) -{ - Entity *this_00; - uint8_t bVar1; - int targetEntity; - uint32_t entityIndex; - bool bVar2; - float fVar3; - float fVar4; - float fVar5; - uint32_t *puVar6; - float fVar7; - uint32_t *local_24; - float local_20; - float local_1c; - Entity *local_18; - char isVulnerable; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0c94d; - local_10 = ExceptionList; - ExceptionList = &local_10; - targetEntity = this->_target; - local_1c = 22500.0; - bVar2 = false; - if (targetEntity == 0) { - local_24 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x125c)); - local_20 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1264)); - entityIndex = 0; - local_8 = 0; - local_18 = GHIDRA_CAST(0x0); - if (local_20 != 0.0) { - do { - this_00 = GHIDRA_CAST(local_24[entityIndex]); - bVar1 = (GHIDRA_CAST((this_00)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(this)); - if ((bVar1 == 0) || (isVulnerable = '\x01', (this_00->_flags & 0x20000010) != 0)) { - isVulnerable = '\0'; - } - if ((((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (this_00->_type != 3)) || - (this_00->_variant != 0x43)) || - (bVar1 = (GHIDRA_CAST((this_00)))->Entity::IsDescendantOf(GHIDRA_CAST(this->_spawnerEntity)), bVar1 != 0)) { - bVar2 = false; - } - else { - bVar2 = true; - } - if (((isVulnerable != '\0') || (bVar2)) && - ((fVar3 = (this->_pos).x - (this_00->_pos).x, fVar5 = (this->_pos).y - (this_00->_pos).y, - fVar3 = fVar5 * fVar5 + fVar3 * fVar3, this_00->_pendingDamage < this_00->_health && - (fVar3 < local_1c)))) { - local_1c = fVar3; - local_18 = this_00; - } - entityIndex = entityIndex + 1; - } while (entityIndex < GHIDRA_UINT(local_20)); - if (this->_target != 0) { - local_24 = &this->_target; - msvc::multiset::erase(&local_24); - } - } - puVar6 = &this->_target; - *puVar6 = local_18; - bVar2 = local_18 == GHIDRA_CAST(0x0); - targetEntity = 0; - if (!bVar2) { - msvc::multiset::insert(puVar6); - targetEntity = *puVar6; - bVar2 = targetEntity == 0; - } - } - if (!bVar2) { - fVar3 = (this->_targetPosition).x; - if ((fVar3 == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y)) { - fVar4 = this->_knifeDistance / this->_maxDistance; - fVar3 = (this->_pos).y; - fVar5 = *GHIDRA_CAST((targetEntity + 0x33c)); - if (fVar4 <= 0.0) { - fVar4 = 0.0; - } - if (1.0 <= fVar4) { - fVar4 = 1.0; - } - fVar7 = (this->_pos).x; - (this->_targetPosition).y = (*GHIDRA_CAST((targetEntity + 0x340)) - fVar3) * (1.0 - fVar4) + fVar3 - ; - (this->_targetPosition).x = (fVar5 - fVar7) * (1.0 - fVar4) + fVar7; - } - else { - fVar5 = (this->_targetPosition).y; - fVar4 = *GHIDRA_CAST((targetEntity + 0x340)); - (this->_targetPosition).x = (*GHIDRA_CAST((targetEntity + 0x33c)) - fVar3) * 0.04 + fVar3; - (this->_targetPosition).y = (fVar4 - fVar5) * 0.04 + fVar5; - } - } - local_20 = (this->_targetPosition).x; - if (((local_20 != g_vectorZero.x) || ((this->_targetPosition).y != g_vectorZero.y)) && - (0.0 < this->_knifeDistance)) { - fVar3 = (this->_anchorPosition).x; - local_20 = local_20 - fVar3; - fVar5 = (this->_anchorPosition).y; - local_18 = GHIDRA_CAST(((this->_pos).x - fVar3)); - local_1c = (this->_pos).y - fVar5; - local_24 = GHIDRA_CAST(((this->_targetPosition).y - fVar5)); - fVar3 = sqrtf(local_20 * local_20 + (float)local_24 * (float)local_24); - if (0.0001 < fVar3) { - fVar4 = this->_maxDistance * 0.25; - fVar5 = local_20; - puVar6 = local_24; - if (fVar3 < fVar4) { - puVar6 = GHIDRA_CAST(((float)local_24 * (fVar4 / fVar3))); - fVar5 = local_20 * (fVar4 / fVar3); - fVar3 = fVar4; - } - fVar3 = this->_knifeDistance / fVar3; - local_18 = GHIDRA_CAST(((float)local_18 / fVar3)); - local_1c = local_1c / fVar3; - fVar7 = (1.0 - fVar3) * fVar3; - fVar4 = (this->_anchorPosition).y; - (this->_pos).x = (float)local_18 * fVar7 + (this->_anchorPosition).x + fVar5 * fVar3 * fVar3; - (this->_pos).y = local_1c * fVar7 + fVar4 + (float)puVar6 * fVar3 * fVar3; - fVar3 = atan2f((((float)puVar6 - local_1c) + ((float)puVar6 - local_1c)) * fVar3 + local_1c, - ((fVar5 - (float)local_18) + (fVar5 - (float)local_18)) * fVar3 + - (float)local_18); - *outAngle = fVar3 * 57.295776; - } - } - ExceptionList = local_10; - return; -} - -// 00967a70 -void Entity_Knife::apply_wiggle(float *param_2) -{ - code *pcVar1; - Vector *normalizedDir; - BitSet128 *maskedFlags; - Entity_Knife *rootKnife; - uint32_t rngState; - Entity_Knife *ancestor; - float fVar2; - float perpX; - double wiggleSlope; - float wigglePhase; - BitSet128 local_24; - float local_14; - Vector local_10; - float local_8; - int grandParent; - uint32_t *parentSlot; - - ancestor = GHIDRA_CAST(this->_parent); - if (ancestor == GHIDRA_CAST(0x0)) { - return; - } - local_14 = 0.0; - local_8 = 0.0; - fVar2 = 0.0; - if (ancestor->_type == 1) { - local_8 = (ancestor->_pos).x - (this->_pos).x; - local_10.y = (ancestor->_pos).y - (this->_pos).y; - fVar2 = sqrtf(local_8 * local_8 + local_10.y * local_10.y); - if (fVar2 <= 0.0) { - fVar2 = local_10.y; - goto LAB_00967b6b; - } - local_8 = local_8 * (1.0 / fVar2); - fVar2 = local_10.y * (1.0 / fVar2); - } - else { - if ((ancestor->_type != 8) || - (grandParent = ancestor->_parent, *GHIDRA_CAST((grandParent + 0x28)) != 1)) goto LAB_00967b6b; - local_10.x = *GHIDRA_CAST((grandParent + 0x33c)) - (this->_pos).x; - local_10.y = *GHIDRA_CAST((grandParent + 0x340)) - (this->_pos).y; - normalizedDir = (GHIDRA_CAST((&local_10)))->Vector::Normalized(GHIDRA_CAST(&local_24._h)); - local_8 = normalizedDir->x; - fVar2 = normalizedDir->y; - } -LAB_00967b6b: - wigglePhase = 0.0; - perpX = local_8; - maskedFlags = BitSet128::operator_and(&local_24,&this->_tearFlags,&g_tearFlagOrbit); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - perpX = -fVar2; - } - else { - local_8 = fVar2; - } - rootKnife = this; - do { - if (ancestor->_type != 8) break; - parentSlot = &ancestor->_parent; - rootKnife = ancestor; - ancestor = GHIDRA_CAST(*parentSlot); - } while (GHIDRA_CAST(*parentSlot) != GHIDRA_CAST(0x0)); - local_10.y = perpX; - if (rootKnife != this) { - rngState = this->_initSeed; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) = 0x900000005; - local_14 = 9.80909e-45; - if (rngState == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - rngState = rngState >> 5 ^ rngState; - rngState = rngState << 9 ^ rngState; - rngState = rngState >> 7 ^ rngState; - fVar2 = (float)((double)GHIDRA_INT(rngState) + __uint_to_double_fixup[-(GHIDRA_INT(rngState) >> 0x1f)]) * - 2.3283062e-10; - wigglePhase = (fVar2 + fVar2) * 3.1415927; - local_14 = wigglePhase; - } - fVar2 = sin(this->_knifeDistance / 20.0 + wigglePhase); - fVar2 = ((fVar2 * 30.0 * this->_knifeDistance) / this->_maxDistance) * this->_charge; - (this->_pos).x = local_10.y * fVar2 + (this->_pos).x; - (this->_pos).y = local_8 * fVar2 + (this->_pos).y; - fVar2 = cos(this->_knifeDistance / 20.0 + local_14); - wiggleSlope = (double)((((fVar2 / 20.0) * 30.0 * this->_knifeDistance) / this->_maxDistance) * - this->_charge); - libm_sse2_atan_precise(); - *param_2 = *param_2 - ((float)wiggleSlope * 180.0) / 3.1415927; - return; -} - -// 00967d20 -void Entity_Knife::screen_wrap() -{ - Vector *position; - uint32_t pass; - Vector wrappedPos; - Game *game; - - game = g_game; - pass = 0; - position = &this->_pos; - while ((Room::ScreenWrapPositionImpl(game->_room,&wrappedPos,position,-100.0,-100.0,-100.0,-100.0) - , wrappedPos.x != position->x || (wrappedPos.y != (this->_pos).y))) { - pass = pass + 1; - position->x = wrappedPos.x; - (this->_pos).y = wrappedPos.y; - if (3 < pass) { - return; - } - } - return; -} - -// 00967db0 -void Entity_Knife::Interpolate() -{ - Vector *resizedOffset; - LayerState *layer; - float y; - float parentX; - float x; - Vector toParent; - Vector resizedBuf; - float offsetY; - int parent; - float parentX; - - parent = this->_subtype; - if (parent == 0) { - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagLudovico._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4)))) == 0) && - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagLudovico._h)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4)))) == 0)) { - this->_isInterpolating = 1; - this->Update(); - (this->_preInterpolatePos).x = (this->_pos).x; - (this->_preInterpolatePos).y = (this->_pos).y; - return; - } - this->_isInterpolating = 1; - this->Update(); - } - else { - if ((parent != 1) && (parent != 4)) { - if (parent != 3) { - return; - } - parent = this->_parent; - if (parent == 0) { - return; - } - parentX = *GHIDRA_CAST((parent + 0x340)); - parentX = *GHIDRA_CAST((parent + 0x33c)); - y = parentX - (this->_pos).y; - x = parentX - (this->_pos).x; - toParent.x = x; - toParent.y = y; - if (900.0 < y * y + x * x) { - resizedOffset = (GHIDRA_CAST((&toParent)))->Vector::Resized(&resizedBuf,30.0); - offsetY = resizedOffset->y; - (this->_pos).x = parentX - resizedOffset->x; - (this->_pos).y = parentX - offsetY; - } - parentX = atan2f(y,x); - parentX = normalize_angle_degrees(parentX * 57.295776 + 90.0); - (this->_sprite)._rotation = parentX; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_flipX = 0.0 < parentX; - return; - } - this->_isInterpolating = 1; - } - (this->_preInterpolatePos).x = (this->_pos).x; - (this->_preInterpolatePos).y = (this->_pos).y; - parentX = this->_friction; - (this->_pos).x = parentX * (this->_velocity).x * 0.5 + (this->_pos).x; - (this->_pos).y = parentX * (this->_velocity).y * 0.5 + (this->_pos).y; - return; -} - -// 00967fc0 -void Entity_Knife::Reset() -{ - uint8_t *animNameCursor; - uint32_t cmpResult; - uint8_t *idleCursor; - bool isLess; - int *erasedRef; - uint8_t ch; - uint32_t *targetRef; - - (this->_targetPosition).x = g_vectorZero.x; - targetRef = &this->_target; - (this->_targetPosition).y = g_vectorZero.y; - if (*targetRef != 0) { - erasedRef = targetRef; - msvc::multiset::erase(&erasedRef); - } - *targetRef = 0; - this->_knifeDistance = 0.0; - this->_isFlying = 0; - this->_knifeVelocity = 0.0; - this->_prismApplied = 0; - this->_multidimensionalApplied = 0; - switch(this->_variant) { - default: - if (this->_variant != 1) { - return; - } - case 2: - case 3: - case 4: - case 8: - case 9: - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) { - animNameCursor = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((animNameCursor + 0x14))) { - animNameCursor = *GHIDRA_CAST(animNameCursor); - } - idleCursor = &DAT_00b602e8; - do { - ch = *animNameCursor; - isLess = ch < *idleCursor; - if (ch != *idleCursor) { -LAB_00968090: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_00968095; - } - if (ch == 0) break; - ch = animNameCursor[1]; - isLess = ch < idleCursor[1]; - if (ch != idleCursor[1]) goto LAB_00968090; - animNameCursor = animNameCursor + 2; - idleCursor = idleCursor + 2; - } while (ch != 0); - cmpResult = 0; -LAB_00968095: - if (cmpResult == 0) { - ANM2::Play(&this->_sprite,s_Idle,0); - } - } - case 5: - case 0xb: - return; - } -} - -// 009680d0 -void Entity_Knife::SetAttackAnimation() -{ - uint8_t isAnimSet; - char *animName; - uint8_t *****pppppbVar1; - uint32_t size; - float fVar2; - float fVar3; - float cosRot; - float sinRot; - uint8_t *****curAnim [4]; - uint32_t curAnimSize; - uint32_t curAnimCapacity; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint8_t ****local_14; - void *animData; - int parent; - - puStack_20 = GHIDRA_CAST((curAnim + 0xe)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00af85cd; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((curAnim + 0xb)); - ExceptionList = &local_1c; - if (g_game->_frameCount == this->_spawnFrame) { - this->_displayRotation = this->_rotation; - } - switch(this->_variant) { - case 2: - case 3: - case 4: - case 5: - case 8: - case 9: - break; - default: - if (this->_variant == 10) goto LAB_00968177; - break; - case 0xb: -LAB_00968177: - fVar2 = this->_displayRotation * 0.017453292; - fVar3 = cos(fVar2); - fVar2 = sin(fVar2); - if (ABS(fVar3) <= ABS(fVar2)) { - animName = "AttackDown"; - if (fVar2 < 0.0) { - animName = "AttackUp"; - } - } - else { - animName = "AttackRight"; - if (fVar3 < 0.0) { - animName = "AttackLeft"; - } - } - isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(animName),1); - if (isAnimSet != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - goto LAB_0096829f; - } - animData = (this->_sprite)._animState._animData; - if (animData == (void *)0x0) { - curAnimSize = 0; - curAnimCapacity = 0xf; - curAnim[0] = GHIDRA_CAST(0x0); - puStack_20 = GHIDRA_CAST((curAnim + 0xe)); - } - else { - puStack_20 = GHIDRA_CAST((curAnim + 0xe)); - (GHIDRA_CAST((GHIDRA_CAST(curAnim))))->msvc::string::string(animData); - } - local_14 = GHIDRA_CAST(0x0); - pppppbVar1 = GHIDRA_CAST(curAnim); - if (0xf < curAnimCapacity) { - pppppbVar1 = curAnim[0]; - } - isAnimSet = str_eq(GHIDRA_CAST(pppppbVar1),curAnimSize,GHIDRA_CAST("Swing"),5); - animName = "Swing2"; - if (isAnimSet == 0) { - animName = "Swing"; - } - isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(animName),1); - if (isAnimSet != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - if (0xf < curAnimCapacity) { - size = curAnimCapacity + 1; - pppppbVar1 = curAnim[0]; - if (0xfff < size) { - pppppbVar1 = GHIDRA_CAST(curAnim[0][-1]); - size = curAnimCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(curAnim[0]) + (-4 - GHIDRA_INT(pppppbVar1))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppbVar1,size); - } -LAB_0096829f: - parent = this->_parent; - if ((parent != 0) && ((*GHIDRA_CAST((parent + 0x28)) == 1 || (*GHIDRA_CAST((parent + 0x28)) == 3)))) { - fVar3 = this->_displayRotation * 0.017453292; - cosRot = cos(fVar3); - fVar2 = *GHIDRA_CAST((parent + 0x33c)); - sinRot = sin(fVar3); - fVar3 = *GHIDRA_CAST((parent + 0x340)); - (this->_pos).x = cosRot * 5.0 + fVar2; - (this->_pos).y = sinRot * 5.0 + fVar3; - fVar2 = *GHIDRA_CAST((parent + 0x340)); - (this->_anchorPosition).x = *GHIDRA_CAST((parent + 0x33c)); - (this->_anchorPosition).y = fVar2; - fVar2 = atan2f((this->_pos).y - *GHIDRA_CAST((parent + 0x340)), - (this->_pos).x - *GHIDRA_CAST((parent + 0x33c))); - fVar2 = fVar2 * 57.295776 - 90.0; - if (360.0 < ABS(fVar2)) { - fVar2 = fmodf(fVar2,360.0); - } - if (fVar2 <= 180.0) { - if (fVar2 < -180.0) { - fVar2 = fVar2 + 360.0; - } - } - else { - fVar2 = fVar2 - 360.0; - } - (this->_sprite)._rotation = fVar2; - } - this->_isDeadEyeHit = 0; - *GHIDRA_CAST(&this->_isSwinging) = 0x101; - this->_isSpinAttack = 0; - (this->_hitList)._end = (this->_hitList)._begin; - ExceptionList = local_1c; - return; -} - -// 00968430 -void Entity_Knife::SpinAttack(short remainingSpins, int startFrame) -{ - uint8_t isAnimSet; - char *anim; - uint32_t rngResult; - float sinAngle; - float local_10; - float local_c; - Manager *manager; - - if (g_game->_frameCount == this->_spawnFrame) { - this->_displayRotation = this->_rotation; - } - switch(this->_variant) { - case 2: - case 3: - case 4: - case 5: - case 8: - case 9: - goto switchD_0096846e_caseD_2; - default: - if (this->_variant == 10) goto switchD_0096846e_caseD_b; -switchD_0096846e_caseD_2: - KAGE_LogMessage(4,GHIDRA_CAST("Tried to use spin attack on an unsupported knife variant! (%d)\n")); - return; - case 0xb: -switchD_0096846e_caseD_b: - local_10 = this->_displayRotation * 0.017453292; - local_c = cos(local_10); - sinAngle = sin(local_10); - if (ABS(local_c) <= ABS(sinAngle)) { - anim = "SpinDown"; - if (sinAngle < 0.0) { - anim = "SpinUp"; - } - } - else { - anim = "SpinRight"; - if (local_c < 0.0) { - anim = "SpinLeft"; - } - } - isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(anim),1); - if (isAnimSet != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - if ((0 < startFrame) && ((this->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)startFrame); - } - local_c = 1.0 / ((this->_sprite)._scale.x * 0.5 + 0.5); - rngResult = Random(); - manager = g_manager; - if (local_c <= 0.5) { - local_c = 0.5; - } - local_10 = 7.53899e-43; - local_c = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9) * local_c; - seed_fart_sound_override(GHIDRA_CAST(&local_10)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10),1.0,2,0,local_c,0.0); - this->_isDeadEyeHit = 0; - *GHIDRA_CAST(&this->_isSwinging) = 1; - this->_isSpinAttack = 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ec)))) = 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f0)))) = remainingSpins; - (this->_hitList)._end = (this->_hitList)._begin; - UpdateSwingHits(this); - return; - } -} - -// 00968660 -uint8_t Entity_Knife::drain_notched_axe(int charge) -{ - Entity_Knife *player = this; - char cVar1; - Entity_Player *player; - uint32_t uVar2; - int iVar3; - ColorMod *color; - ColorMod *color_00; - float local_3c; - Color particleColor; - uint32_t local_c; - Manager *manager; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_3c); - player = GetPlayer(player); - if ((((player == GHIDRA_CAST(0x0)) || (iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x4f4)))), iVar3 == 0)) || - (*GHIDRA_CAST((iVar3 + 0x28)) != 8)) || (*GHIDRA_CAST((iVar3 + 0x171)) == '\0')) { - return 0; - } - cVar1 = FUN_00961ad0(); - if ((cVar1 != '\0') && (uVar2 = Random(), (uVar2 & 3) != 0)) { - return 0; - } - uVar2 = (GHIDRA_CAST((player)))->Entity_Player::GetActiveItemSlot(0x93); - if (-1 < GHIDRA_INT(uVar2)) { - Entity_Player::AddActiveCharge(player,-charge,uVar2,0,0,0); - iVar3 = (GHIDRA_CAST((player)))->Entity_Player::GetActiveItem(uVar2); - if (0 < iVar3) { - return 0; - } - (GHIDRA_CAST((player)))->Entity_Player::DischargeActiveItem(uVar2,0); - } - (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x93,-1); - manager = g_manager; - local_3c = 6.474e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_3c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_3c),1.0,2,0,1.0,0.0); - manager = g_manager; - local_3c = 1.93379e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_3c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_3c),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((&particleColor)))->Color::Color(); - uVar2 = Random(); - Game::SpawnParticles - (g_game,&player->_pos,0x1b,2, - (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10 * 4.0 + 3.0,color,100000.0,0); - (GHIDRA_CAST((&particleColor)))->Color::Color(); - uVar2 = Random(); - local_3c = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0; - uVar2 = Random(); - Game::SpawnParticles(g_game,&player->_pos,0x56,(uVar2 & 1) + 2,local_3c,color_00,100000.0,0); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x4f4)))); - if ((iVar3 != 0) && (*GHIDRA_CAST((iVar3 + 0x28)) == 8)) { - *GHIDRA_CAST((iVar3 + 0x171)) = 0; - } - return 1; -} - -// 009688d0 -void Entity_Knife::UpdateSwingHits() -{ - uint32_t *puVar1; - float *pfVar2; - Entity_Pickup *ownerPlayer; - BitSet128 flags; - uint8_t bVar3; - char cVar4; - BitSet128 *maskedFlags; - int iVar5; - EntityRef *nullCapsule; - int iVar6; - uint32_t uVar7; - GridEntity *gridEntity; - Capsule *entityCapsule; - EntityList *hitList; - void *pvVar8; - Vector *pushDelta; - Entity_Player *ownerPlayer; - int *piVar9; - std_string *curAnimName; - Entity *spawnedEntity; - Entity_Knife *pEVar10; - char *anim; - Entity *this_01; - ColorMod *laserColor; - int iVar11; - Room *room; - Entity *unused; - int extraout_EDX; - float fVar12; - float fVar13; - float fVar14; - uint8_t auVar15 [12]; - float bridgeDirX; - float bridgeDirY; - double dVar16; - uint32_t uVar17; - uint32_t uVar18; - Capsule gridCapsule [13]; - BitSet128 hitTearFlags; - uint8_t queryResults [12]; - uint32_t uStack_1a4; - Vector tipPos; - EntityRef extraCapsule; - uint8_t maskResult [8]; - Vector scratchVec; - Vector local_15c; - EntityRef tipCapsule; - float scaleY; - Vector local_128; - BitSet128 tearFlagsCopy; - float tipDistance; - float tipRadius; - float swingDistance; - Vector local_100; - Vector local_f8; - Vector local_f0; - float local_e8; - Vector *knockbackOrigin; - Vector local_e0; - uint32_t isHitAnything; - uint32_t local_d4; - Entity_Player *local_d0; - int baseVariant; - float damage; - float knockbackStrength; - Entity_Knife *local_c0; - GridEntity *local_bc; - uint64_t local_b8; - char isToolVariant; - uint64_t local_a8; - Room *local_9c; - float local_98; - void *local_94; - char isBurningAxe; - Entity_Knife *knife; - Entity_Player *player; - float local_84; - char local_7d; - uint32_t loopIndex; - uint32_t local_78; - uint32_t local_74; - uint32_t local_70; - uint32_t local_6c; - uint8_t local_68 [8]; - float local_60; - float local_5c; - uint32_t local_58; - uint32_t local_54; - uint8_t local_50 [4]; - EntityRef local_4c; - uint32_t stackCookie; - uint8_t *puStack_20; - void *savedExceptionList; - uint8_t *puStack_18; - uint32_t ehState; - TypeDescriptor *castDstType; - TypeDescriptor *castSrcType; - bool isHitFrame; - Manager *manager; - short swingIndex; - uint64_t tearFlagsHigh; - float temp_5fcb5ea734; - code *virtualFn; - - puStack_20 = local_50 + 0x4c; - ehState = 0xffffffff; - puStack_18 = &LAB_00b0c980; - savedExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((local_50 + 0x40)); - local_e8 = 0.0; - if (this->_isInterpolating != 0) { - return; - } - if (this->_dead != 0) { - return; - } - ExceptionList = &savedExceptionList; - knife = this; - ownerPlayer = GetPlayer(this); - local_d4 = 0; - uVar7 = this->_parent; - if (uVar7 != 0) { - if (*GHIDRA_CAST((uVar7 + 0x28)) == 8) { - uVar7 = *GHIDRA_CAST((uVar7 + 0x3bc)); - if (uVar7 == 0) goto LAB_00968980; - } - iVar5 = *GHIDRA_CAST((uVar7 + 0x28)); - if (((iVar5 == 1) || (iVar5 == 3)) || (iVar5 == 2)) { - local_d4 = uVar7; - } - } -LAB_00968980: - player = ownerPlayer; - baseVariant = GetBaseVariant(this); - fVar12 = this->_mass; - if (this->_variant == 2) { - tipDistance = 40.0; - tipRadius = 45.0; - knockbackStrength = fVar12 * 9.0; - } - else { - tipDistance = 28.0; - tipRadius = 30.0; - knockbackStrength = fVar12 * 18.0; - } - knockbackStrength = knockbackStrength / 3.0; - swingDistance = 4.0; - scaleY = (this->_sprite)._scale.y; - local_d0 = GHIDRA_CAST(((fVar12 * 4.0) / 3.0)); - local_94 = (GHIDRA_CAST((GHIDRA_CAST(&g_game->_debugRenderer))))->DebugRenderer::Get(this->_index,1); - if ((baseVariant == 10) && (this->_isSwinging == 0)) { - local_7d = '\x01'; - } - else { - local_7d = '\0'; - } - iVar5 = this->_variant; - if (((iVar5 == 4) || (iVar5 == 5)) || ((iVar5 == 9 || (iVar5 == 8)))) { - isToolVariant = '\x01'; - if (iVar5 == 4) { - knockbackStrength = 36.0; - isToolVariant = '\x01'; - } - } - else { - isToolVariant = '\0'; - } - if ((ownerPlayer != GHIDRA_CAST(0x0)) && (ownerPlayer->_playerType == 0x23)) { - local_d0 = GHIDRA_CAST(0x0); - } - if ((this->_subtype == 4) || (local_7d != '\0')) { - maskedFlags = BitSet128::operator_and(&hitTearFlags,&this->_tearFlags,&g_tearFlagWait); - if (((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) || - ((iVar5 = ANM2::GetFrame(&this->_sprite), iVar5 < 5 || - (0x1d < g_game->_frameCount - this->_spawnFrame)))) { -LAB_00968b38: - if ((this->_sprite)._animState._animData == (void *)0x0) goto LAB_00968b3e; - local_c0 = GHIDRA_CAST((this->_sprite)._animState._animFrame); - dVar16 = floor((double)(float)local_c0); - local_c0 = GHIDRA_CAST((float)dVar16); - local_a8 = CONCAT44(GHIDRA_INT(dVar16),GHIDRA_CAST(local_a8)); - if (5 < GHIDRA_INT(dVar16) - 2U) goto LAB_00968b48; - isHitFrame = true; - } - else { - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,4.0); - goto LAB_00968b38; - } -LAB_00968b3e: - local_a8 = CONCAT44(0xffffffff,GHIDRA_CAST(local_a8)); -LAB_00968b48: - isHitFrame = false; - } - if ((baseVariant == 10) || (isHitFrame)) { - if (this->_variant == 9) { - DAT_00c7ac6c = ownerPlayer; -LAB_00968b6e: - damage = 3.0; - } - else { - if (this->_variant != 2) goto LAB_00968b6e; - damage = 1.5; - } - damage = damage * this->_collisionDamage; - isHitAnything = isHitAnything & 0xffffff00; - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._l)) + 0x0))) = GHIDRA_UINT((this->_tearFlags)._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._h)) + 0x0))) = GHIDRA_UINT((this->_tearFlags)._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - if (ownerPlayer == GHIDRA_CAST(0x0)) { - local_f8.x = (this->_pos).x; - local_f8.y = (this->_pos).y; - } - else { - local_f8.x = (ownerPlayer->_pos).x; - local_f8.y = (ownerPlayer->_pos).y; - } - local_84 = this->_displayRotation * 0.017453292; - knockbackOrigin = &local_f8; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._l)) + 0x0))) = GHIDRA_UINT(hitTearFlags._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._h)) + 0x0))) = GHIDRA_UINT(hitTearFlags._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._h)) + 0x4))); - local_c0 = GHIDRA_CAST(&this->_pos); - local_100.y = sin(local_84); - fVar12 = cos(local_84); - tipPos.x = fVar12 * tipDistance * scaleY + (this->_pos).x; - local_f0.x = 1.0; - tipPos.y = local_100.y * tipDistance * scaleY + (this->_pos).y; - local_f0.y = 1.0; - (GHIDRA_CAST((GHIDRA_CAST(&tipCapsule))))->Capsule::constructor(&tipPos,&local_f0,0.0,scaleY * tipRadius); - (GHIDRA_CAST((GHIDRA_CAST(&extraCapsule))))->Capsule::constructor(&g_vectorZero,&g_vectorZero,0.0,0.0); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (this->_variant != 3)) { - if (this->_variant == 0xb) { - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._l)) + 0x0))) = GHIDRA_UINT(tearFlagsCopy._l) | GHIDRA_UINT(g_tearFlagShielded._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._h)) + 0x0))) = GHIDRA_UINT(tearFlagsCopy._h) | GHIDRA_UINT(g_tearFlagShielded._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._l)) + 0x0))) = GHIDRA_UINT(hitTearFlags._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._h)) + 0x0))) = GHIDRA_UINT(hitTearFlags._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._h)) + 0x4))); - } - } - else { - damage = this->_collisionDamage * 1.5; - } - if (baseVariant == 10) { - nullCapsule = (EntityRef *) - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetNullCapsule(GHIDRA_CAST((local_50 + 4)),&DAT_00b1d3b0) - ; - (GHIDRA_CAST((&tipCapsule)))->EntityRef::operator_(nullCapsule); - nullCapsule = (EntityRef *) - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetNullCapsule(GHIDRA_CAST((local_50 + 4)),&DAT_00b7cb20) - ; - (GHIDRA_CAST((&extraCapsule)))->EntityRef::operator_(nullCapsule); - damage = this->_collisionDamage; - if (local_7d == '\0') { - if (this->_isSpinAttack == 0) { - damage = damage * 3.0 + 3.5; - goto LAB_00968f51; - } - local_98 = 1.8; - damage = damage * 8.0 + 10.0; - } - else { - local_98 = 0.8; - } - tipCapsule._entity = - (void *)(((float)tipCapsule._flags + (float)tipCapsule._entity) * local_98 - - (float)tipCapsule._flags); - extraCapsule._entity = - (void *)(((float)extraCapsule._flags + (float)extraCapsule._entity) * local_98 - - (float)extraCapsule._flags); - tipCapsule._spawnerType = - GHIDRA_INT(((float)tipCapsule._type - (float)tipCapsule._entity * tipCapsule._velocity.x)); - tipCapsule._spawnerVariant = - GHIDRA_INT(((float)tipCapsule._variant - (float)tipCapsule._entity * tipCapsule._velocity.y)); - tipCapsule._position.x = - (float)tipCapsule._type + (float)tipCapsule._entity * tipCapsule._velocity.x; - tipCapsule._position.y = - (float)tipCapsule._variant + (float)tipCapsule._entity * tipCapsule._velocity.y; - extraCapsule._spawnerType = - GHIDRA_INT(((float)extraCapsule._type - - (float)extraCapsule._entity * extraCapsule._velocity.x)); - extraCapsule._spawnerVariant = - GHIDRA_INT(((float)extraCapsule._variant - - (float)extraCapsule._entity * extraCapsule._velocity.y)); - extraCapsule._position.x = - (float)extraCapsule._type + (float)extraCapsule._entity * extraCapsule._velocity.x; - extraCapsule._position.y = - (float)extraCapsule._variant + (float)extraCapsule._entity * extraCapsule._velocity.y; - } -LAB_00968f51: - pvVar8 = local_94; - if ((GHIDRA_UINT(g_game->_debugFlags) >> 5 & 1) != 0) { - if (0.0 < (float)tipCapsule._flags) { - push_shape_points(local_94,GHIDRA_CAST(&tipCapsule)); - } - if (0.0 < (float)extraCapsule._flags) { - push_shape_points(pvVar8,GHIDRA_CAST(&extraCapsule)); - } - } - if ((float)extraCapsule._flags <= 0.0) { - local_98 = (float)tipCapsule._flags + (float)tipCapsule._entity; - uVar7 = g_game->_debugFlags; - local_e0.x = (float)tipCapsule._type; - local_e0.y = (float)tipCapsule._variant; - } - else { - local_100.y = (float)extraCapsule._variant - (float)tipCapsule._variant; - local_84 = (float)extraCapsule._type - (float)tipCapsule._type; - fVar12 = sqrtf(local_100.y * local_100.y + local_84 * local_84); - local_e0.x = (float)tipCapsule._type; - local_e0.y = (float)tipCapsule._variant; - local_98 = (fVar12 + (float)tipCapsule._flags + (float)tipCapsule._entity + - (float)extraCapsule._flags + (float)extraCapsule._entity) * 0.5; - if (0.0 < fVar12) { - fVar13 = (local_98 - (float)tipCapsule._flags) - (float)tipCapsule._entity; - local_e0.y = (float)tipCapsule._variant + (fVar13 * local_100.y) / fVar12; - local_e0.x = (float)tipCapsule._type + (fVar13 * local_84) / fVar12; - } - uVar7 = g_game->_debugFlags; - } - if ((uVar7 >> 5 & 1) != 0) { - FUN_0042ede0(&local_e0); - } - local_f0.y = 0.0; - local_f0.x = 0.0; - room = g_game->_room; - local_9c = room; - iVar5 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&local_e0); - if (-1 < iVar5) { - local_94 = (void *)room->_gridWidth; - local_84 = local_98 / 40.0; - iVar6 = iVar5 / GHIDRA_INT(local_94); - iVar5 = iVar5 % GHIDRA_INT(local_94); - dVar16 = ceil((double)local_84); - iVar11 = GHIDRA_INT(dVar16); - uVar7 = iVar5 - iVar11; - loopIndex = 0; - if (0 < GHIDRA_INT(uVar7)) { - loopIndex = uVar7; - } - fVar13 = (float)(iVar6 - iVar11); - fVar12 = 0.0; - if (0 < GHIDRA_INT(fVar13)) { - fVar12 = fVar13; - } - pvVar8 = (void *)(iVar11 + iVar5); - if (GHIDRA_INT(pvVar8) < GHIDRA_INT(local_94)) { - local_94 = pvVar8; - } - fVar13 = (float)(iVar11 + iVar6); - fVar14 = (float)local_9c->_gridHeight; - if (GHIDRA_INT(fVar13) < local_9c->_gridHeight) { - fVar14 = fVar13; - } - local_100.y = fVar14; - local_84 = fVar12; - if (GHIDRA_INT(loopIndex) <= GHIDRA_INT(local_94)) { - room = local_9c; - do { - uVar7 = loopIndex; - local_128.y = fVar12; - if (GHIDRA_INT(fVar12) <= GHIDRA_INT(fVar14)) { - do { - if ((((GHIDRA_INT(uVar7) < 0) || (room->_gridWidth <= GHIDRA_INT(uVar7))) || - (GHIDRA_INT(local_128.y) < 0)) || - ((room->_gridHeight <= GHIDRA_INT(local_128.y) || - (iVar5 = room->_gridWidth * GHIDRA_INT(local_128.y) + uVar7, iVar5 < 0)))) { - gridEntity = GHIDRA_CAST(0x0); - } - else { - gridEntity = room->_gridEntities[iVar5]; - } - local_bc = gridEntity; - if (gridEntity != GHIDRA_CAST(0x0)) { - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - scratchVec.x = (float)(gridEntity->_gridIndex % iVar5) * 40.0 + 40.0; - scratchVec.y = (float)(gridEntity->_gridIndex / iVar5) * 40.0 + 120.0; - (GHIDRA_CAST((gridCapsule)))->Capsule::constructor(&scratchVec,&g_vectorOne,0.0,20.0); - bVar3 = Capsule::Collide(gridCapsule,GHIDRA_CAST(&tipCapsule),&local_f0); - if ((bVar3 != 0) || - ((0.0 < (float)extraCapsule._flags && - (bVar3 = Capsule::Collide(gridCapsule,GHIDRA_CAST(&extraCapsule),&local_f0), - bVar3 != 0)))) { - pEVar10 = knife; - if (knife->_variant == 9) { - if (0 < gridEntity->_collisionClass) { - virtualFn = *(code **)(*GHIDRA_CAST(gridEntity) + 0x14); - (GHIDRA_CAST((GHIDRA_CAST((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST(knife)); - cVar4 = (*virtualFn)(0,local_50 + 4); - if (cVar4 != '\0') { - local_15c.y = ((pEVar10->_sprite)._rotation + 90.0) * 0.017453292; - fVar12 = sin(local_15c.y); - local_b8 = CONCAT44(fVar12,(uint32_t)local_b8); - fVar12 = cos(local_15c.y); - if (ABS(fVar12) <= ABS((*GHIDRA_CAST((GHIDRA_CAST(&(local_b8)) + 0x4))))) { - bridgeDirX = 0.0; - if (0.0 <= (*GHIDRA_CAST((GHIDRA_CAST(&(local_b8)) + 0x4)))) { - bridgeDirY = 1.0; - } - else { - bridgeDirY = (float)&DAT_bf800000; - } - } - else { - bridgeDirY = 0.0; - if (0.0 <= fVar12) { - bridgeDirX = 1.0; - } - else { - bridgeDirX = (float)&DAT_bf800000; - } - } - if ((bridgeDirX != g_vectorZero.x) || (bridgeDirY != g_vectorZero.y)) { - room = g_game->_room; - fVar12 = (((float)(local_bc->_gridIndex % room->_gridWidth) * 40.0 + - 40.0 + bridgeDirX * 40.0) - 40.0) / 40.0 + 0.5; - iVar6 = GHIDRA_INT(fVar12); - iVar5 = GHIDRA_INT(((((float)(local_bc->_gridIndex / room->_gridWidth) * 40.0 - + 120.0 + bridgeDirY * 40.0) - 120.0) / 40.0 + 0.5)); - local_b8 = CONCAT44(iVar6,(uint32_t)local_b8); - if (((-1 < iVar6) && - (((iVar6 < room->_gridWidth && (-1 < iVar5)) && - (iVar5 < room->_gridHeight)))) && - (iVar5 = iVar5 * room->_gridWidth + GHIDRA_INT(fVar12), -1 < iVar5)) { - if (iVar5 < 0x1c0) { - gridEntity = room->_gridEntities[iVar5]; - } - else { - gridEntity = GHIDRA_CAST(0x0); - } - (GHIDRA_CAST((room)))->Room::TryMakeBridge(gridEntity,local_bc); - } - } - bVar3 = drain_notched_axe(pEVar10,1); - if (bVar3 != 0) { - if (pEVar10->_variant == 9) { - DAT_00c7ac6c = GHIDRA_CAST(0x0); - ExceptionList = savedExceptionList; - return; - } - ExceptionList = savedExceptionList; - return; - } - isHitAnything = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(isHitAnything)) + 0x1))),1); - } - } - } - else { - local_78 = 0; - local_74 = 0; - local_70 = 0; - local_6c = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x0))) = g_vectorZero.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x4))) = g_vectorZero.y; - local_60 = g_vectorZero.x; - local_5c = g_vectorZero.y; - local_58 = 0; - local_54 = 0; - cVar4 = gridEntity->Hurt(1,&local_78); - isHitAnything = isHitAnything & 0xff; - if (cVar4 != '\0') { - isHitAnything = 1; - } - } - } - room = local_9c; - uVar7 = loopIndex; - } - local_128.y = (float)(GHIDRA_INT(local_128.y) + 1); - } while (GHIDRA_INT(local_128.y) <= GHIDRA_INT(local_100.y)); - fVar14 = local_100.y; - fVar12 = local_84; - } - loopIndex = uVar7 + 1; - } while (GHIDRA_INT(loopIndex) <= GHIDRA_INT(local_94)); - } - this = knife; - } - uVar7 = 0x1d; - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST(maskResult),&tearFlagsCopy,&g_tearFlagShielded); - if (((((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) || - ((this->_variant == 4 || (this->_variant == 3)))) || - ((baseVariant == 10 && (this->_isSpinAttack != 0)))) && ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_a8))) + 0x4))) < 5)) { - uVar7 = 0x1f; - } - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(queryResults),&local_e0 - ,local_98,uVar7); - ehState = 0; - loopIndex = 0; - if (uStack_1a4 != 0) { - fVar12 = 0.0; - do { - ownerPlayer = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(queryResults)) + 0x4))) + loopIndex * 4)); - if ((ownerPlayer->_size != fVar12) && (ownerPlayer->_entityCollisionClass != 0)) { - if (fVar12 < (float)tipCapsule._entity) { - entityCapsule = - (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::GetCollisionCapsule(local_50 + 4,&g_vectorZero); - bVar3 = Capsule::Collide(entityCapsule,GHIDRA_CAST(&tipCapsule),&local_f0); - fVar12 = 0.0; - if ((bVar3 == 0) && (0.0 < (float)extraCapsule._flags)) { - entityCapsule = - (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::GetCollisionCapsule(local_50 + 4,&g_vectorZero); - bVar3 = Capsule::Collide(entityCapsule,GHIDRA_CAST(&extraCapsule),&local_f0); - fVar12 = 0.0; - if (bVar3 == 0) goto LAB_0096a6af; - } - } - piVar9 = &ownerPlayer->_type; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_00969714: - iVar5 = *piVar9; - local_a8 = CONCAT44(piVar9,GHIDRA_CAST(local_a8)); - if (iVar5 - 10U < 0x3de) { - if (iVar5 == 1) goto LAB_0096972f; - goto LAB_0096973b; - } -LAB_00969f92: - if (local_7d == '\0') { - if (iVar5 == 4) { - if (((GHIDRA_CAST(ownerPlayer->_parent) != player) || - (*GHIDRA_CAST(&(ownerPlayer->_priceANM2)._animState._layerFrames) == '\0')) || - (pfVar2 = &(ownerPlayer->_posOffset).y, fVar12 < *pfVar2 || fVar12 == *pfVar2)) { - hitList = GetHitEntities(this); - bVar3 = (GHIDRA_CAST((hitList)))->EntityList::HitListContains(GHIDRA_CAST(ownerPlayer)); - if (bVar3 == 0) { - pvVar8 = GetHitEntities(this); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(pvVar8,uVar7); - fVar12 = (ownerPlayer->_pos).x - knockbackOrigin->x; - local_84 = (ownerPlayer->_pos).y - knockbackOrigin->y; - local_a8 = CONCAT44(fVar12,GHIDRA_CAST(local_a8)); - fVar13 = sqrtf(fVar12 * fVar12 + local_84 * local_84); - fVar12 = 0.0; - if (fVar13 <= 0.0) { - fVar14 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))); - fVar13 = local_84; - } - else { - fVar14 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))) * (1.0 / fVar13); - fVar13 = (1.0 / fVar13) * local_84; - } - temp_5fcb5ea734 = ownerPlayer->_friction; - if (temp_5fcb5ea734 != 0.0) { - (ownerPlayer->_velocity).x = - (fVar14 * knockbackStrength) / temp_5fcb5ea734 + (ownerPlayer->_velocity).x - ; - (ownerPlayer->_velocity).y = - (fVar13 * knockbackStrength) / temp_5fcb5ea734 + (ownerPlayer->_velocity).y - ; - } - } - } - else { -LAB_0096a33e: - if ((player == GHIDRA_CAST(0x0)) || (iVar5 != 2)) { - if ((((iVar5 == 5) && (ownerPlayer->_variant != 100)) && - ((((ownerPlayer->_price == 0 || (this->_variant == 4)) && - (ownerPlayer->_dead == 0)) && - ((ownerPlayer->_entityCollisionClass != 0 && - ((ownerPlayer->_flags & 0x4000000) == 0)))))) && - ((local_d4 == 0 || (*GHIDRA_CAST((local_d4 + 0x28)) != 2)))) { - hitList = GetHitEntities(this); - bVar3 = (GHIDRA_CAST((hitList)))->EntityList::HitListContains(GHIDRA_CAST(ownerPlayer)); - if (bVar3 == 0) { - pvVar8 = GetHitEntities(this); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(pvVar8,uVar7); - fVar12 = (ownerPlayer->_pos).x - *GHIDRA_CAST(local_c0); - local_84 = (ownerPlayer->_pos).y - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_c0)) + 0x4)))); - local_a8 = CONCAT44(fVar12,GHIDRA_CAST(local_a8)); - fVar13 = sqrtf(fVar12 * fVar12 + local_84 * local_84); - fVar12 = 0.0; - if (fVar13 <= 0.0) { - fVar14 = local_84; - fVar13 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))); - } - else { - fVar14 = local_84 * (1.0 / fVar13); - fVar13 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))) * (1.0 / fVar13); - } - temp_5fcb5ea734 = ownerPlayer->_friction; - if (temp_5fcb5ea734 != 0.0) { - (ownerPlayer->_velocity).x = - (fVar13 * knockbackStrength) / temp_5fcb5ea734 + - (ownerPlayer->_velocity).x; - (ownerPlayer->_velocity).y = - (fVar14 * knockbackStrength) / temp_5fcb5ea734 + - (ownerPlayer->_velocity).y; - } - if (player != GHIDRA_CAST(0x0)) { - iVar5 = knife->_variant; - bVar3 = (GHIDRA_CAST((ownerPlayer)))->Entity_Pickup::CanBePickedUp(iVar5 == 4); - if ((bVar3 != 0) || - (bVar3 = Entity_Pickup::IsChest(ownerPlayer->_variant), bVar3 != 0)) { - ownerPlayer = player; - if ((iVar5 != 4) || - (cVar4 = Entity_Player::bag_of_crafting_collect(ownerPlayer), - cVar4 == '\0')) { - g_forceCollideDepth = g_forceCollideDepth + 1; - ownerPlayer->HandleCollision(ownerPlayer,1); - ownerPlayer->HandleCollision(ownerPlayer,0); - g_forceCollideDepth = g_forceCollideDepth + -1; - } - fVar12 = 0.0; - } - } - bVar3 = Entity_Pickup::IsChest(ownerPlayer->_variant); - if (bVar3 != 0) { - local_b8 = 0; - if (*GHIDRA_CAST((extraout_EDX + 0x2c)) == 9) { - local_84 = 2.3509887e-38; - } - else { - local_84 = 0.0; - } - local_a8 = local_a8 & 0xffffffff; - virtualFn = *(code **)(*GHIDRA_CAST(ownerPlayer) + 0x20); - EntityRef::constructor - (GHIDRA_CAST((local_50 + 4)), - *GHIDRA_CAST((extraout_EDX + 0x3bc))); - (*virtualFn)(damage,local_84,(*GHIDRA_CAST((GHIDRA_CAST(&(local_a8)) + 0x4))),local_50 + 4,0x1e); - goto LAB_0096a6a9; - } - } - } - } - else if (GHIDRA_CAST(ownerPlayer->_parent) == player) { - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._l)) + 0x0))) = *GHIDRA_CAST((ownerPlayer->_priceANM2)._animDefaultName._buf); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._l)) + 0x4))) = - *GHIDRA_CAST(((ownerPlayer->_priceANM2)._animDefaultName._buf + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._h)) + 0x0))) = - *GHIDRA_CAST(((ownerPlayer->_priceANM2)._animDefaultName._buf + 8)); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsCopy._h)) + 0x4))) = - *GHIDRA_CAST(((ownerPlayer->_priceANM2)._animDefaultName._buf + 0xc)); - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST(&local_60),&tearFlagsCopy, - &g_tearFlagLudovico); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - hitList = GetHitEntities(this); - bVar3 = (GHIDRA_CAST((hitList)))->EntityList::HitListContains(GHIDRA_CAST(ownerPlayer)); - if (bVar3 == 0) { - pvVar8 = GetHitEntities(this); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(pvVar8,uVar7); - fVar12 = (ownerPlayer->_pos).y - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_c0)) + 0x4)))); - local_84 = (ownerPlayer->_pos).x - *GHIDRA_CAST(local_c0); - local_a8 = CONCAT44(fVar12,GHIDRA_CAST(local_a8)); - fVar13 = sqrtf(fVar12 * fVar12 + local_84 * local_84); - fVar12 = 0.0; - if (fVar13 <= 0.0) { - fVar14 = local_84; - fVar13 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))); - } - else { - fVar14 = local_84 * (1.0 / fVar13); - fVar13 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))) * (1.0 / fVar13); - } - (ownerPlayer->_velocity).x = fVar14 * knockbackStrength * 1.25; - (ownerPlayer->_velocity).y = fVar13 * knockbackStrength * 1.25; - } - } - } - } - } - else if (iVar5 == 3) { - if (ownerPlayer->_variant == 0xef) { - hitList = GetHitEntities(this); - bVar3 = (GHIDRA_CAST((hitList)))->EntityList::HitListContains(GHIDRA_CAST(ownerPlayer)); - if (bVar3 == 0) { - pvVar8 = GetHitEntities(this); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(pvVar8,uVar7); - local_84 = (ownerPlayer->_pos).x - knockbackOrigin->x; - fVar12 = (ownerPlayer->_pos).y - knockbackOrigin->y; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a8)) + 0x4))) = GHIDRA_CAST(fVar12); - fVar13 = sqrtf(local_84 * local_84 + fVar12 * fVar12); - fVar12 = local_84; - if (0.0 < fVar13) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a8)) + 0x4))) = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))) * (1.0 / fVar13))); - fVar12 = local_84 * (1.0 / fVar13); - } - fVar14 = (ownerPlayer->_velocity).x * 0.25; - (ownerPlayer->_velocity).x = fVar14; - (ownerPlayer->_velocity).y = (ownerPlayer->_velocity).y * 0.25; - fVar13 = ownerPlayer->_friction; - if (fVar13 != 0.0) { - (ownerPlayer->_velocity).x = fVar14 + (fVar12 * knockbackStrength) / fVar13; - (ownerPlayer->_velocity).y = - ((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))) * knockbackStrength) / fVar13 + - (ownerPlayer->_velocity).y; - } - manager = g_manager; - local_a8 = CONCAT44(0x354,GHIDRA_CAST(local_a8)); - seed_fart_sound_override(GHIDRA_CAST((GHIDRA_INT(&local_a8) + 4))); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_a8))) + 0x4))),1.0,2,0,1.0,0.0); - goto LAB_0096a6a9; - } - } - } - else { - if (iVar5 != 9) goto LAB_0096a33e; - if (((player != GHIDRA_CAST(0x0)) && (ownerPlayer->_dead == 0)) && - (-50.0 < *GHIDRA_CAST((ownerPlayer->_priceANM2)._filename._buf))) { - local_84 = (ownerPlayer->_pos).y - knockbackOrigin->y; - fVar12 = (ownerPlayer->_pos).x - knockbackOrigin->x; - local_a8 = CONCAT44(fVar12,GHIDRA_CAST(local_a8)); - fVar13 = sqrtf(local_84 * local_84 + fVar12 * fVar12); - fVar12 = 0.0; - if (fVar13 <= 0.0) { - fVar14 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))); - fVar13 = local_84; - } - else { - fVar14 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_a8)) + 0x4))) * (1.0 / fVar13); - fVar13 = local_84 * (1.0 / fVar13); - } - if (this->_variant != 4) { - local_128.x = fVar14 * knockbackStrength; - local_128.y = fVar13 * knockbackStrength; - (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity_Projectile::Reflect(unused,&local_128); - goto LAB_0096a6a9; - } - (ownerPlayer->_priceANM2)._animDefaultName._size = 0; - (ownerPlayer->_priceANM2)._animDefaultName._capacity = 0; - ownerPlayer->_dead = 1; - } - } - } - } - else { - local_a8 = CONCAT44(piVar9,GHIDRA_CAST(local_a8)); - if (*piVar9 != 1) goto LAB_00969714; - iVar5 = 1; -LAB_0096972f: - if (ownerPlayer == GHIDRA_CAST(this->_spawnerEntity)) goto LAB_00969f92; -LAB_0096973b: - if ((ownerPlayer->_flags & 0x20000000) != 0) goto LAB_00969f92; - hitList = GetHitEntities(this); - bVar3 = (GHIDRA_CAST((hitList)))->EntityList::HitListContains(GHIDRA_CAST(ownerPlayer)); - if (bVar3 != 0) goto LAB_0096a6af; - iVar5 = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_a8))) + 0x4))); - if ((iVar5 != 0xf5) && (iVar5 != 0x124)) { - pvVar8 = GetHitEntities(this); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::GetHitListIndex(); - sorted_vector_insert_unique(pvVar8,uVar7); - iVar5 = ownerPlayer->_type; - this = knife; - } - ownerPlayer = player; - if (iVar5 == 0x21) { - if (ownerPlayer->_variant == 0xb) goto LAB_009699e7; - virtualFn = *(code **)(*GHIDRA_CAST(ownerPlayer) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST(knife->_parent)); - (*virtualFn)(0x447a0000,0,0,local_50 + 4,0x1e); - isHitAnything = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(isHitAnything)) + 0x1))),1); - } - else if (iVar5 == 0x3c3) { - g_forceCollideDepth = g_forceCollideDepth + 1; - player->HandleCollision(ownerPlayer,1); - ownerPlayer->HandleCollision(ownerPlayer,0); - g_forceCollideDepth = g_forceCollideDepth + -1; - } - else { - if (iVar5 == 0x390) { - if (ownerPlayer->_variant == 100) { - fVar12 = 0.0; - if ((0.0 < (ownerPlayer->_velocity).y) && - (fVar13 = (ownerPlayer->_pos).y, fVar13 < (this->_pos).y)) { - iVar5 = ownerPlayer->_parent; - *GHIDRA_CAST(&ownerPlayer[1]._priceANM2._overlayAnimState._isPlaying) = 0x10; - if (iVar5 == 0) { - pushDelta = &local_e0; - local_e0.x = (ownerPlayer->_pos).x - (this->_pos).x; - local_e0.y = fVar13 - (this->_pos).y; - } - else { - pushDelta = &scratchVec; - scratchVec.x = *GHIDRA_CAST((iVar5 + 0x33c)) - (this->_pos).x; - scratchVec.y = *GHIDRA_CAST((iVar5 + 0x340)) - (this->_pos).y; - } - local_94 = (void *)pushDelta->x; - local_98 = pushDelta->y; - fVar12 = sqrtf((float)local_94 * (float)local_94 + local_98 * local_98); - local_b8 = CONCAT44(fVar12,(uint32_t)local_b8); - if (fVar12 <= 0.0) { - fVar13 = local_98; - pvVar8 = local_94; - } - else { - fVar13 = local_98 * (18.0 / fVar12); - pvVar8 = (void *)((float)local_94 * (18.0 / fVar12)); - } - (ownerPlayer->_velocity).x = (float)pvVar8; - (ownerPlayer->_velocity).y = fVar13; - fVar12 = (ownerPlayer->_targetPosition).y; - fVar13 = (ownerPlayer->_targetPosition).x; - fVar13 = sqrtf(fVar13 * fVar13 + fVar12 * fVar12); - fVar12 = 0.0; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_b8)) + 0x4))) <= 0.0) { - pvVar8 = local_94; - fVar13 = local_98; - } - else { - fVar13 = (fVar13 + 0.1) / (*GHIDRA_CAST((GHIDRA_CAST(&(local_b8)) + 0x4))); - pvVar8 = (void *)((float)local_94 * fVar13); - fVar13 = local_98 * fVar13; - } - (ownerPlayer->_targetPosition).x = (float)pvVar8; - (ownerPlayer->_targetPosition).y = fVar13; - ownerPlayer->_mass = ownerPlayer->_mass + 1.0; - } - goto LAB_0096a6af; - } - } - else if (iVar5 == 0x11) goto LAB_0096a6a9; -LAB_009699e7: - if (ownerPlayer->_dead == 0) { - local_98 = (ownerPlayer->_pos).x - knockbackOrigin->x; - local_94 = (void *)((ownerPlayer->_pos).y - knockbackOrigin->y); - fVar12 = sqrtf(local_98 * local_98 + (float)local_94 * (float)local_94); - if (0.0 < fVar12) { - local_98 = (1.0 / fVar12) * local_98; - local_94 = (void *)((float)local_94 * (1.0 / fVar12)); - } - if (((this->_variant == 9) && - (ownerPlayer = GetPlayer(this), ownerPlayer != GHIDRA_CAST(0x0))) && - (bVar3 = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::HasCollectible(0x3b,0), bVar3 != 0)) { - isBurningAxe = '\x01'; - } - else { - isBurningAxe = '\0'; - } - if ((ownerPlayer->_flags & 0x4000000) == 0) { - fVar12 = ownerPlayer->_friction; - fVar13 = (knockbackStrength * 50.0) / (ownerPlayer->_mass + 50.0); - if (fVar12 != 0.0) { - fVar14 = ownerPlayer->_speedMultiplier; - (ownerPlayer->_velocity).y = - (fVar14 * (float)local_94 * fVar13) / fVar12 + (ownerPlayer->_velocity).y; - (ownerPlayer->_velocity).x = - (fVar14 * local_98 * fVar13) / fVar12 + (ownerPlayer->_velocity).x; - } - if (isBurningAxe != '\0') { - fVar12 = (ownerPlayer->_mass - 10.0) / 70.0; - if (fVar12 <= 0.0) { - fVar12 = 0.0; - } - if (1.0 <= fVar12) { - fVar12 = 1.0; - } - fVar12 = 20.0 - fVar12 * 19.0; - local_b8 = CONCAT44(fVar12,(uint32_t)local_b8); - dVar16 = floor((double)fVar12); - local_15c.x = local_98 * 16.0; - local_15c.y = (float)local_94 * 16.0; - local_b8 = CONCAT44((float)dVar16,(uint32_t)local_b8); - (GHIDRA_CAST((GHIDRA_CAST((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST(player)); - Entity::AddKnockback - (GHIDRA_CAST(ownerPlayer),GHIDRA_CAST((local_50 + 4)),&local_15c, - GHIDRA_INT(dVar16),1); - this = knife; - } - } - local_a8 = 0; - local_b8 = CONCAT44(GHIDRA_UINT((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) * 2 + 4, - (uint32_t)local_b8); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar3 == 0) || (player == GHIDRA_CAST(0x0))) { -LAB_00969c8e: - local_9c = (*GHIDRA_CAST((GHIDRA_CAST(&(local_a8)) + 0x4))); - local_bc = GHIDRA_CAST(local_a8); - } - else { - if ((player->_hasCurseMistEffect != 0) || - ((player->_isCoopGhost != 0 || (player->_playerForms[0] < 3)))) { - bVar3 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x97,0); - if (bVar3 != 0) { - uVar7 = Random(); - if (uVar7 % (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_b8))) + 0x4))) == 0) goto LAB_00969c7c; - } - goto LAB_00969c8e; - } -LAB_00969c7c: - if (0x1d < player->_numBlueFlies) goto LAB_00969c8e; - local_9c = GHIDRA_CAST(0x0); - local_bc = GHIDRA_CAST(0x4000); - } - if (this->_variant == 9) { - local_bc = GHIDRA_CAST((GHIDRA_UINT(local_bc) | 0x1000000)); - } - if ((this->_flags & 0x400000000) != 0) { - local_bc = GHIDRA_CAST((GHIDRA_UINT(local_bc) | 0x20000000)); - } - if (isBurningAxe != '\0') { - local_9c = GHIDRA_CAST((GHIDRA_UINT(local_9c) | 2)); - } - virtualFn = *(code **)(*GHIDRA_CAST(ownerPlayer) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST(knife->_parent)); - cVar4 = (*virtualFn)(damage,local_bc,local_9c,local_50 + 4,0x1e); - if (cVar4 == '\0') { - pEVar10 = knife; - } - else { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - manager = g_manager; - if (bVar3 == 0) { - pEVar10 = knife; - } - else { - local_a8 = CONCAT44(0x4d,GHIDRA_CAST(local_a8)); - seed_fart_sound_override(GHIDRA_CAST((GHIDRA_INT(&local_a8) + 4))); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_a8))) + 0x4))),1.0,10,0,1.5,0.0) - ; - pEVar10 = knife; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = GHIDRA_UINT(hitTearFlags._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = GHIDRA_UINT(hitTearFlags._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(hitTearFlags._h)) + 0x4))); - Entity_Tear::ApplyTearFlagEffects - (GHIDRA_CAST(ownerPlayer),&knife->_pos,flags,GHIDRA_CAST(knife),damage); - if (pEVar10->_variant == 3) { - iVar5 = player->_damageCooldown; - if (iVar5 < 1) { - *GHIDRA_CAST(&player->_flags) = GHIDRA_INT(player->_flags); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&player->_flags) + 4)); - *puVar1 = *puVar1 | 0x10; - pEVar10 = knife; - } - local_b8 = CONCAT44(0xf,(uint32_t)local_b8); - piVar9 = GHIDRA_CAST((GHIDRA_INT(&local_b8) + 4)); - if (0xe < iVar5) { - piVar9 = &player->_damageCooldown; - } - player->_damageCooldown = *piVar9; - } - if (isBurningAxe != '\0') { - (GHIDRA_CAST((GHIDRA_CAST((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST(player)); - (GHIDRA_CAST((GHIDRA_CAST(ownerPlayer))))->Entity::AddBurn(GHIDRA_CAST((local_50 + 4)),0x5a,0.0,0); - } - } - if ((pEVar10->_variant == 9) && - (bVar3 = drain_notched_axe(pEVar10,2), bVar3 != 0)) { - DAT_00c7ac6c = GHIDRA_CAST(0x0); - (GHIDRA_CAST((queryResults)))->EntityList_Query::~EntityList_Query(); - ExceptionList = savedExceptionList; - return; - } - local_100.x = (ownerPlayer->_pos).x; - local_100.y = (ownerPlayer->_pos).y; - apply_hit_effects(pEVar10,&tipPos,GHIDRA_CAST(ownerPlayer),&local_100,ownerPlayer->_size, - damage,CONCAT44(local_9c,local_bc),0); - } - if ((((ownerPlayer->_pendingDamage < ownerPlayer->_health) && - ((*GHIDRA_CAST((GHIDRA_CAST((pEVar10)) + 0x4e9))) == '\0')) && (pEVar10->_isFlying == 0)) && - (fVar12 = 0.0, local_d4 != 0)) { - fVar13 = *GHIDRA_CAST((local_d4 + 0x36c)); - if (fVar13 != 0.0) { - *GHIDRA_CAST((local_d4 + 0x360)) = - (-local_98 * (float)local_d0) / fVar13 + *GHIDRA_CAST((local_d4 + 0x360)); - *GHIDRA_CAST((local_d4 + 0x364)) = - (-(float)local_94 * (float)local_d0) / fVar13 + - *GHIDRA_CAST((local_d4 + 0x364)); - } - (*GHIDRA_CAST((GHIDRA_CAST((pEVar10)) + 0x4e9))) = 1; - if ((local_7d != '\0') && (*GHIDRA_CAST((local_d4 + 0x28)) != 2)) { - (*GHIDRA_CAST((GHIDRA_CAST((pEVar10)) + 0x466))) = 0; - isHitAnything = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(isHitAnything)) + 0x1))),1); - goto LAB_0096a6af; - } - } - fVar12 = 0.0; - isHitAnything = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(isHitAnything)) + 0x1))),1); - goto LAB_0096a6af; - } - } -LAB_0096a6a9: - fVar12 = 0.0; - } - } -LAB_0096a6af: - loopIndex = loopIndex + 1; - if (uStack_1a4 <= loopIndex) break; - this = knife; - } while( true ); - } - if (((char)isHitAnything == '\0') || (player == GHIDRA_CAST(0x0))) { - this = knife; - } - else { - bVar3 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x175,0); - this = knife; - if (bVar3 != 0) { - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((knife)) + 0x4f4)))); - if (iVar5 != 0) { - if (*GHIDRA_CAST((iVar5 + 0x4e4)) == '\0') { - (GHIDRA_CAST((player)))->Entity_Player::AddDeadEyeCharge(); - } - *GHIDRA_CAST((iVar5 + 0x4e4)) = 1; - } - } - } - ehState = 0xffffffff; - if (this->_variant == 9) { - DAT_00c7ac6c = GHIDRA_CAST(0x0); - } - if (queryResults[0] == '\0') { - ehState = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)queryResults)) + 0x4))),0); - ehState = 0xffffffff; - } - } - } - if (this->_subtype == 4) goto LAB_0096ae0c; - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ec))))) { - swingIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ee)))); - if ((GHIDRA_INT(swingIndex) & 1U) == 0) { - local_d0 = GHIDRA_CAST(this->_parent); - if ((local_d0 != GHIDRA_CAST(0x0)) && (local_d0->_type == 8)) { - local_d0 = GHIDRA_CAST(local_d0->_parent); - } - ownerPlayer = local_d0; - local_d4 = GHIDRA_INT(swingIndex) / 2 & 0xffffff01; - if (baseVariant == 1) { - curAnimName = ANM2::GetAnimation(GHIDRA_CAST(&(this->_sprite)._animState),GHIDRA_CAST(local_68)) - ; - local_e8 = 1.4013e-45; - puVar1 = &curAnimName->_size; - if (0xf < curAnimName->_capacity) { - curAnimName = *GHIDRA_CAST(curAnimName->_buf); - } - bVar3 = str_eq(GHIDRA_CAST(curAnimName),*puVar1,GHIDRA_CAST("Swing2"),6); - local_7d = '\x01'; - if (bVar3 == 0) goto LAB_0096a80d; - } - else { -LAB_0096a80d: - local_7d = '\0'; - } - if ((GHIDRA_UINT(local_e8) & 1) != 0) { - (GHIDRA_CAST((local_68)))->msvc::string::_Tidy_deallocate(); - } - if (local_7d != '\0') { - local_d4 = local_d4 ^ 1; - } - if (ownerPlayer != GHIDRA_CAST(0x0)) { - if (ownerPlayer->_type == 1) { - local_e8 = (ownerPlayer->_tearrange - 260.0) * 0.15; - if (local_e8 <= 0.0) { - local_e8 = 0.0; - } - local_e8 = local_e8 + 4.0; - swingDistance = local_e8; - } - else { - local_e8 = 4.0; - } - if (this->_variant == 3) { - auVar15 = ZEXT812(0x41a00000); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x0))) <= local_e8) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x0))) = local_e8; - } - swingDistance = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar15)) + 0x0))); - local_e8 = swingDistance; - } - local_b8 = CONCAT44((this->_sprite)._scale.x,(uint32_t)local_b8); - uVar7 = Random(); - scratchVec.x = (ownerPlayer->_pos).x; - scratchVec.y = (ownerPlayer->_pos).y; - uVar18 = 0; - castDstType = &IsaacRepentancePlus::Entity_Knife::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar17 = 0; - spawnedEntity = - Game::Spawn(g_game,8,this->_variant,&scratchVec,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),4,uVar7); - pEVar10 = (Entity_Knife *) - __RTDynamicCast(spawnedEntity,uVar17,castSrcType,castDstType,uVar18); - local_c0 = pEVar10; - if (pEVar10 == this) { - this->Remove(); - ExceptionList = savedExceptionList; - return; - } - (GHIDRA_CAST((GHIDRA_CAST(pEVar10))))->Entity::SetParent(GHIDRA_CAST(local_d0)); - swingIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ee)))); - (pEVar10->_targetPosition).y = 0.0; - if (swingIndex == 0) { - (pEVar10->_targetPosition).x = swingDistance; - pEVar10->_rotation = this->_rotation + this->_rotationOffset; - } - else { - (pEVar10->_targetPosition).x = (*GHIDRA_CAST((GHIDRA_CAST(&(local_b8)) + 0x4))) * 5.0 * (float)GHIDRA_INT(swingIndex) + local_e8; - uVar7 = Random(); - pEVar10->_rotation = - ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 30.0 - 15.0) + this->_rotation + this->_rotationOffset; - uVar7 = Random(); - SoundEffects::PlayWithFartOverride - (0xfc,1.0,1,0, - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9); - } - pEVar10->_mass = this->_mass; - (pEVar10->_posOffset).x = (this->_posOffset).x; - (pEVar10->_posOffset).y = (this->_posOffset).y; - pEVar10->SetColor(&(this->_sprite)._color,0xffffffff,0xff,0,1); - (pEVar10->_sprite)._scale.x = (this->_sprite)._scale.x; - (pEVar10->_sprite)._scale.y = (this->_sprite)._scale.y; - uVar17 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - tearFlagsHigh = (this->_tearFlags)._h; - uVar18 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - iVar5 = *GHIDRA_CAST(pEVar10); - *GHIDRA_CAST(&(pEVar10->_tearFlags)._l) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&(pEVar10->_tearFlags)._l) + 4)) = uVar17; - *GHIDRA_CAST(&(pEVar10->_tearFlags)._h) = GHIDRA_INT(tearFlagsHigh); - *GHIDRA_CAST((GHIDRA_INT(&(pEVar10->_tearFlags)._h) + 4)) = uVar18; - (**(code **)(iVar5 + 0x40))(this->_collisionDamage); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar10)) + 0x4f4)))))))->EntityPtr::SetReference(GHIDRA_CAST(this)); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))))))->EntityPtr::SetReference(GHIDRA_CAST(pEVar10)); - if (baseVariant == 1) { - anim = "Swing"; - if ((char)local_d4 == '\0') { - anim = "Swing2"; - } - ANM2::Play(&pEVar10->_sprite,GHIDRA_CAST(anim),1); - SetAttackAnimation(pEVar10); - } - else if (baseVariant == 10) { - if (this->_isFlying != 0) { - (pEVar10->_pos).x = (this->_pos).x; - (pEVar10->_pos).y = (this->_pos).y; - } - if (this->_isSpinAttack == 0) { - SetAttackAnimation(pEVar10); - } - else { - iVar5 = ANM2::GetFrame(&this->_sprite); - SpinAttack(pEVar10,1,iVar5); - } - (pEVar10->_sprite)._rotation = (this->_sprite)._rotation; - } - pEVar10->Update(); - if (player != GHIDRA_CAST(0x0)) { - bVar3 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x44,0); - if (bVar3 != 0) { - fVar12 = normalize_angle_degrees(this->_rotationOffset); - local_b8 = CONCAT44(((fVar12 * 60.0) / 180.0 + tipRadius + tipDistance) * scaleY, - (uint32_t)local_b8); - uVar7 = Random(); - ownerPlayer = player; - local_f8.x = (pEVar10->_pos).x; - local_f8.y = (pEVar10->_pos).y; - uVar18 = 0; - castDstType = &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar17 = 0; - spawnedEntity = Game::Spawn(g_game,7,2,&local_f8,&g_vectorZero,GHIDRA_CAST(player),3,uVar7) - ; - this_01 = GHIDRA_CAST(__RTDynamicCast(spawnedEntity,uVar17,castSrcType,castDstType,uVar18)) - ; - laserColor = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::get_laser_color_copy(GHIDRA_CAST(local_50)); - this_01->SetColor(laserColor,0xffffffff,0xff,0,1); - this = knife; - (this_01->_posOffset).x = (knife->_posOffset).x; - (this_01->_posOffset).y = (knife->_posOffset).y; - (GHIDRA_CAST((this_01)))->Entity::SetParent(GHIDRA_CAST(local_c0)); - iVar5 = *GHIDRA_CAST(this_01); - this_01->_renderDepthOffset = 3000.0; - uVar17 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - tearFlagsHigh = (this->_tearFlags)._h; - iVar6 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *GHIDRA_CAST(&this_01[1]._pendingDamageFlags) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&this_01[1]._pendingDamageFlags) + 4)) = uVar17; - this_01[1]._index = GHIDRA_INT(tearFlagsHigh); - this_01[1]._collisionIndex = iVar6; - (**(code **)(iVar5 + 0x40))(this->_collisionDamage); - *GHIDRA_CAST((GHIDRA_INT(this_01[1]._sprite._color._colorize) + 5)) = 1; - spawnedEntity = this_01 + 1; - (spawnedEntity->_sprite)._filename._buf[0] = '\x03'; - (spawnedEntity->_sprite)._filename._buf[1] = '\0'; - (spawnedEntity->_sprite)._filename._buf[2] = '\0'; - (spawnedEntity->_sprite)._filename._buf[3] = '\0'; - *GHIDRA_CAST(&this_01[1]._sprite._overlayAnimState._isPlaying) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_b8)) + 0x4))); - (GHIDRA_CAST((this_01)))->Entity::SetSpawnerEntity(GHIDRA_CAST(player)); - this_01->Update(); - pEVar10 = local_c0; - } - if (((player == local_d0) && (isToolVariant == '\0')) && - (bVar3 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x19a,0), bVar3 != 0)) { - iVar6 = 0xf - GHIDRA_INT(player->_luck); - iVar5 = 5; - if (5 < iVar6) { - iVar5 = iVar6; - } - iVar5 = Isaac::Random(iVar5); - if (iVar5 == 0) { - uVar7 = Random(); - fVar12 = pEVar10->_rotation * 0.017453292; - local_b8 = CONCAT44(fVar12,(uint32_t)local_b8); - local_f8.x = cos(fVar12); - local_f8.x = local_f8.x * 3.0; - local_f8.y = sin((*GHIDRA_CAST((GHIDRA_CAST(&(local_b8)) + 0x4)))); - this = knife; - local_f0.x = (pEVar10->_pos).x; - local_f8.y = local_f8.y * 3.0; - local_f0.y = (pEVar10->_pos).y; - spawnedEntity = - Game::Spawn(g_game,1000,0x54,&local_f0,&local_f8,GHIDRA_CAST(knife->_spawnerEntity), - 10,uVar7); - (GHIDRA_CAST((spawnedEntity)))->Entity::SetParent(GHIDRA_CAST(player)); - } - } - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ec)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ec)))) + -1; - swingIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ee)))); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4ee)))) = swingIndex + 1; - } - if ((((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) && - ((player != GHIDRA_CAST(0x0) && (this->_isPrimaryClub != 0)))) { - if (this->_isDeadEyeHit == 0) { - (GHIDRA_CAST((player)))->Entity_Player::ClearDeadEyeCharge(); - } - this->_isDeadEyeHit = 0; - } -LAB_0096ae0c: - if ((((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) || - ((baseVariant == 10 && - (((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x466))) != '\0' && - (bVar3 = AnimationState::WasEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("SwingEnd")), - bVar3 != 0)))))) { - this->_isSwinging = 0; - } - ExceptionList = savedExceptionList; - return; -} diff --git a/generated-src/entity_laser.cpp b/generated-src/entity_laser.cpp deleted file mode 100644 index 01b617c..0000000 --- a/generated-src/entity_laser.cpp +++ /dev/null @@ -1,9216 +0,0 @@ -#include "classes.h" - -// 00435f20 -void Entity_Laser::SetTimeout(int param_2) -{ - this->_timeout = param_2; - return; -} - -// 00435f30 -void Entity_Laser::SetMaxDistance(float maxDistance) -{ - this->_maxDistance = maxDistance; - return; -} - -// 00435f50 -uint8_t Entity_Laser::IsCircleLaser() -{ - int temp_5f9cc5adbd; - - temp_5f9cc5adbd = this->_subtype; - if (((temp_5f9cc5adbd == 1) || (temp_5f9cc5adbd == 2)) || (temp_5f9cc5adbd == 3)) { - return 1; - } - return 0; -} - -// 00456850 -void Entity_Laser::SetHomingType(int param_2) -{ - this->_homingType = param_2; - return; -} - -// 004aaed0 -void Entity_Laser::set_disable_init_sound(uint8_t param_2) -{ - this->_disableInitSound = param_2; - return; -} - -// 005cd580 -void Entity_Laser::SetOneHit(uint8_t param_2) -{ - this->_oneHit = param_2; - return; -} - -// 005cd590 -void Entity_Laser::SetMultidimensionalTouched(uint8_t param_2) -{ - this->_multidimensionalTouched = param_2; - return; -} - -// 0060cea0 -long double Entity_Laser::Radius() -{ - return (long double)this->_radius; -} - -// 0060ceb0 -void Entity_Laser::SetBlackHpDropChance(float param_2) -{ - this->_blackHpDropChance = param_2; - return; -} - -// 007e9230 -Vector * Entity_Laser::GetEndPoint() -{ - return &this->_endPoint; -} - -// 007e9240 -bool Entity_Laser::IsSampleLaser() -{ - return this->_sampleLaser != 0; -} - -// 0096cb60 -void Entity_Laser::Constructor() -{ - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0ca37; - local_10 = ExceptionList; - ExceptionList = &local_10; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - local_8 = 0; - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Laser::vftable; - (this->_parentOffset).y = 0.0; - (this->_parentOffset).x = 0.0; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - *GHIDRA_CAST(&(this->_activeTearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_activeTearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._h) + 4)) = 0; - *GHIDRA_CAST(&(this->_heldTearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_heldTearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._h) + 4)) = 0; - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::HomingLaser(); - (this->_endPoint).y = 0.0; - (this->_endPoint).x = 0.0; - (this->_hitList)._begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - this->_parentLaser = 0; - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); - _eh_vector_constructor_iterator_(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x530))),4,2,FUN_0042a020,FUN_00579700); - (this->_impactPosition).y = 0.0; - (this->_impactPosition).x = 0.0; - this->_continuumLaser = 0; - this->_tearWaitEffect = 0; - (this->_impactDirection).y = 0.0; - (this->_impactDirection).x = 0.0; - *GHIDRA_CAST(&this->_homingLaser) = this; - ExceptionList = local_10; - return; -} - -// 0096cd20 -void Entity_Laser::destructor() -{ - Entity *entityRef; - ColorMod *pCVar2; - Entity *in_ECX; - Entity *eraseKey; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - float *entityRef; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6770; - local_10 = ExceptionList; - ExceptionList = &local_10; - *GHIDRA_CAST(in_ECX) = IsaacRepentancePlus::Entity_Laser::vftable; - entityRef = in_ECX[1]._sprite._championColor._colorize; - eraseKey = in_ECX; - if (*entityRef != 0.0) { - eraseKey = GHIDRA_CAST(entityRef); - msvc::multiset::erase(&eraseKey); - *entityRef = 0.0; - } - entityRef = GHIDRA_CAST((in_ECX[1]._sprite._championColor._tint + 3)); - if (*GHIDRA_CAST(entityRef) != 0) { - eraseKey = entityRef; - msvc::multiset::erase(&eraseKey); - *GHIDRA_CAST(entityRef) = 0; - } - local_8 = 0xffffffff; - _eh_vector_destructor_iterator_(in_ECX[1]._sprite._championColor._tint + 1,4,2,FUN_00579700); - pCVar2 = &in_ECX[1]._sprite._championColor; - if (pCVar2->_tint[0] != 0.0) { - eraseKey = GHIDRA_CAST(pCVar2); - msvc::multiset::erase(&eraseKey); - pCVar2->_tint[0] = 0.0; - } - FID_conflict__Tidy(in_ECX[1]._sprite._color._offset); - FID_conflict__Tidy(&in_ECX[1]._sprite._overlayAnimState._animData); - msvc::vector::_Tidy(); - msvc::vector::_Tidy(); - msvc::vector::_Tidy(); - (GHIDRA_CAST((in_ECX)))->Entity::destructor(); - ExceptionList = local_10; - return; -} - -// 0096ce30 -uint8_t Entity_Laser::is_thick_variant() -{ - switch(this->_variant) { - case 1: - case 3: - case 6: - case 9: - case 0xb: - case 0xc: - case 0xd: - case 0xe: - case 0xf: - return 1; - default: - return 0; - } -} - -// 0096ced0 -int Entity_Laser::GetRenderZ() -{ - floor((double)((this->_renderDepthOffset + (this->_pos).y) * 100.0 + 10030.0 + 0.5)); - __ftoui3(); - return; -} - -// 0096cf80 -uint8_t Entity_Laser::CanDamageEntity(Entity *entity) -{ - Entity *pEVar1; - bool bVar2; - uint8_t bVar3; - char cVar4; - uint8_t isEnemy; - EntityList *hitList; - int parentType; - int entityType; - int familiarVariant; - bool isDamageableFamiliar; - - entityType = entity->_type; - if (entityType == 0x11) { - return 0; - } - pEVar1 = GHIDRA_CAST(this->_parent); - if (pEVar1 == GHIDRA_CAST(0x0)) { - parentType = 0; - } - else { - parentType = pEVar1->_type; - if ((pEVar1->_flags & 0x100) != 0) { - bVar2 = true; - goto LAB_0096cfc9; - } - } - bVar2 = false; -LAB_0096cfc9: - if ((entityType == 3) && - ((((familiarVariant = entity->_variant, familiarVariant == 0x3e || (familiarVariant == 0x43)) - || (familiarVariant == 0xd3)) || - ((familiarVariant == 100 || ((familiarVariant == 0xce && (entity->_subtype == 0x1ab)))))))) { - isDamageableFamiliar = true; - } - else { - isDamageableFamiliar = false; - } - if (((((entity != pEVar1) && (entity->_dead == 0)) && - ((entity->_entityCollisionClass != 0 && (0.0 < entity->_maxHitPoints)))) || - (isDamageableFamiliar)) && - ((((parentType == 1 && (1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) || (parentType != entityType) - ) || (bVar2)))) { - entityType = this->_parentLaser; - if (entityType == 0) { - hitList = GHIDRA_CAST(&this->_hitList); - } - else if (*GHIDRA_CAST((entityType + 0x52c)) == 0) { - hitList = GHIDRA_CAST((entityType + 0x520)); - } - else { - hitList = GHIDRA_CAST(FUN_0096ce70()); - } - bVar3 = (GHIDRA_CAST((hitList)))->EntityList::HitListContains(entity); - if (bVar3 == 0) { - cVar4 = FUN_0096cf40(); - if ((cVar4 == '\0') || ((parentType == 3 && (bVar2)))) { - bVar2 = false; - } - else { - bVar2 = true; - } - isEnemy = (GHIDRA_CAST((entity)))->Entity::IsEnemy(); - bVar3 = isEnemy; - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && ((isEnemy != 0 || (entity->_type == 1)))) { - bVar3 = 1; - } - if (bVar2) { - if ((bVar3 != 0) && (bVar3 = (GHIDRA_CAST((entity)))->Entity::HasEntityFlags(0x20000000), bVar3 == 0)) { - return 1; - } - if ((entity->_entityCollisionClass != 0) && - (((entityType = entity->_type, entityType == 0x21 || (entityType == 0x124)) || - (entityType == 0xf5)))) { - return 1; - } - } - else { - if (entity->_type == 1) { - return 1; - } - if (isEnemy != 0) { - return 1; - } - if (isDamageableFamiliar) { - return 1; - } - } - } - } - return 0; -} - -// 0096d3f0 -void Entity_Laser::impact_tear_flag_effects(Vector *position, Vector *direction) -{ - uint32_t *puVar1; - uint64_t *pqVar2; - code *pcVar3; - int64_t lVar4; - int64_t lVar5; - int64_t lVar6; - BitSet128 flags; - Game *pGVar7; - Game *pGVar8; - uint8_t bVar9; - char isRejected; - uint32_t *puVar10; - float seed; - uint32_t uVar11; - Entity_Tear *splitTear; - Entity *spawnedEntity; - int spawnerIter; - int unusedArg; - int unusedArg_00; - void *pvVar12; - uint32_t riftTimeout; - uint32_t uVar13; - PlayerManager *playerManager; - uint32_t uVar14; - bool bVar15; - float fVar16; - uint64_t timeNs; - float fVar17; - uint8_t auStack_188 [2]; - uint8_t auStack_186 [2]; - float fStack_184; - int *piStack_180; - Game *pGStack_17c; - Entity *pEStack_178; - Entity_Laser *local_174; - uint32_t uStack_170; - uint32_t effectVariant; - float fStack_168; - uint32_t uStack_164; - float fStack_160; - float fStack_15c; - uint32_t spawnGame [2]; - float fStack_150; - uint32_t uStack_14c; - Vector VStack_148; - uint32_t poisonEffectSeed; - float local_13c; - Game *pGStack_138; - Vector VStack_134; - uint32_t uStack_12c; - int *piStack_128; - Vector *impactPos; - uint32_t uStack_120; - void *pvStack_11c; - uint32_t uStack_118; - uint32_t uStack_114; - Vector VStack_110; - Vector VStack_108; - uint32_t splitFlagsLow; - uint32_t uStack_fc; - uint32_t uStack_f8; - uint32_t uStack_f4; - void *pvStack_f0; - int iStack_ec; - void *pvStack_e8; - uint32_t uStack_e4; - uint64_t uStack_dc; - uint32_t uStack_d4; - int iStack_d0; - Color CStack_cc; - float fStack_a0; - float fStack_9c; - uint64_t uStack_98; - uint8_t auStack_90 [4]; - ColorMod explosionColor; - float fStack_44; - ColorMod splitTearColor; - uint32_t local_14; - Manager *manager; - int *spawnerSlot; - - local_14 = __security_cookie ^ GHIDRA_UINT(auStack_188); - impactPos = position; - local_13c = 1.0; - spawnerIter = this->_spawnerEntity; - if (spawnerIter != 0) { - for (; *GHIDRA_CAST((spawnerIter + 0x3c8)) != 0; spawnerIter = *GHIDRA_CAST((spawnerIter + 0x3c8))) { - } - } - local_174 = this; - spawnerIter = __RTDynamicCast(spawnerIter,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0); - if (((spawnerIter != 0) && (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1)))) && - (bVar9 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST((spawnerIter + 0x1618))), bVar9 == 0)) { - if ((g_game == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - local_13c = (float)(g_manager->_optionsConfig)._onlinePlayerOpacity * 0.09 + 0.1; - } - else { - local_13c = 1.0; - } - } - pGVar7 = g_game; - uStack_164 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._h)) + 0x4))); - if ((((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagExplosive._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._l)) + 0x4)))) == 0) && - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagExplosive._h)) == 0 && uStack_164 == 0)) || - ((this->_isFirstUpdate == 0 && - (spawnerIter = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(4.0,0.0), spawnerIter == 0)))) - goto LAB_0096e506; - spawnerIter = this->_subtype; - if (((spawnerIter == 1) || (spawnerIter == 2)) || (spawnerIter == 3)) { - if (spawnerIter == 1) { - if (30.0 <= this->_updateTime) goto LAB_0096d590; - } - else if (5.0 <= this->_updateTime) goto LAB_0096d590; - } - else { -LAB_0096d590: - fVar16 = this->_scale; - if (1.0 <= fVar16) { - spawnerSlot = GHIDRA_CAST((fVar16 * 10.0 + 30.0)); - piStack_180 = GHIDRA_CAST(0x42700000); - if (60.0 <= (float)spawnerSlot) { - piStack_180 = spawnerSlot; - } - } - else { - piStack_180 = GHIDRA_CAST((fVar16 * 60.0)); - if ((float)piStack_180 <= 30.0) { - piStack_180 = GHIDRA_CAST(0x41f00000); - } - } - fStack_15c = (float)piStack_180 / 60.0; - VStack_134.x = direction->x * 10.0 + impactPos->x; - VStack_134.y = direction->y * 10.0 + impactPos->y; - Game::BombTearflagEffects - (pGVar7,&VStack_134,(float)piStack_180,this->_tearFlags,GHIDRA_CAST(this),1.0); - Game::BombDamage(g_game,&VStack_134,this->_collisionDamage + this->_collisionDamage + 10.0, - (float)piStack_180,1,GHIDRA_CAST(this),this->_tearFlags,4,0); - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagPoison._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagPoison._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4)))) != 0)) { - uStack_120 = Random(); - pGStack_138 = g_game; - spawnGame[0] = 0; - uStack_114 = 7; - uStack_118 = 1000; - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&uStack_118),GHIDRA_CAST(&uStack_114),&VStack_134,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_CAST(spawnGame),&uStack_120); - uVar11 = uStack_114; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_0096d990: - pEStack_178 = GHIDRA_CAST(spawnGame[0]); - } - else { - pGStack_17c = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - spawnerSlot = GHIDRA_CAST(Random()); - uVar13 = spawnGame[0]; - pGVar7 = pGStack_17c; - uStack_dc = 0x900000005; - spawnGame[1] = 7; - uStack_d4 = 7; - piStack_180 = spawnerSlot; - if (uStack_118 != 5) goto LAB_0096d990; - if (uVar11 < 0x12d) { - if (uVar11 == 300) { - while ((pEStack_178 = GHIDRA_CAST(spawnGame[0]), spawnGame[0] == 0 || - (isRejected = (**(code **)(pGStack_17c->_stage + 0x24))(spawnGame[0]), - isRejected != '\0'))) { - if (spawnerSlot == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar11 = GHIDRA_UINT(spawnerSlot) >> ((uint8_t)uStack_dc & 0x1f) ^ GHIDRA_UINT(spawnerSlot); - uVar11 = uVar11 << ((uint8_t)((uint64_t)uStack_dc >> 0x20) & 0x1f) ^ uVar11; - spawnerSlot = GHIDRA_CAST((uVar11 >> ((uint8_t)spawnGame[1] & 0x1f) ^ uVar11)); - spawnerIter = ItemPool::GetCardEx(GHIDRA_INT(spawnerSlot),0x19,10,10,1); - explosionColor._tint[1] = 7.00649e-45; - explosionColor._tint[2] = 1.26117e-44; - explosionColor._tint[3] = 9.80909e-45; - explosionColor._tint[0] = (float)spawnerSlot; - spawnGame[0] = lua_callback_run_get_card(GHIDRA_CAST(&explosionColor),spawnerIter,1,1,0); - } - } - else { - if (uVar11 == 0x46) { - uStack_12c = spawnGame[0] >> 0xb; - do { - pEStack_178 = GHIDRA_CAST(spawnGame[0]); - if (spawnGame[0] != 0) { - pcVar3 = *(code **)(pGStack_17c->_stage + 0x28); - spawnerIter = ItemPool::GetPillEffect - (&g_game->_itemPool,spawnGame[0],GHIDRA_CAST(0x0)); - isRejected = (*pcVar3)(spawnerIter); - if (isRejected == '\0') goto LAB_0096d998; - spawnerSlot = piStack_180; - } - if (spawnerSlot == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar11 = GHIDRA_UINT(spawnerSlot) >> ((uint8_t)uStack_dc & 0x1f) ^ GHIDRA_UINT(spawnerSlot); - uVar11 = uVar11 << ((uint8_t)((uint64_t)uStack_dc >> 0x20) & 0x1f) ^ uVar11; - spawnerSlot = GHIDRA_CAST((uVar11 >> ((uint8_t)spawnGame[1] & 0x1f) ^ uVar11)); - piStack_180 = spawnerSlot; - spawnGame[0] = ItemPool::GetPill(GHIDRA_UINT(spawnerSlot)); - spawnGame[0] = spawnGame[0] | (uStack_12c & 1) << 0xb; - } while( true ); - } - if (uVar11 != 100) goto LAB_0096d990; - pEStack_178 = GHIDRA_CAST(spawnGame[0]); - if (spawnGame[0] == 0x19) { -LAB_0096d7d2: - bVar15 = false; - } - else { - uStack_12c = spawnGame[0]; - msvc::set::find_node(&iStack_d0,&uStack_12c); - if (((*GHIDRA_CAST((GHIDRA_INT(CStack_cc._tint[1]) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_INT(CStack_cc._tint[1]) + 0x10)) <= GHIDRA_INT(uVar13))) && - (CStack_cc._tint[1] != (float)pGVar7->_roomList[0].Dimension)) goto LAB_0096d7d2; - bVar15 = true; - } - if ((uVar13 == 0) || (bVar15)) { - pEStack_178 = GHIDRA_CAST((**(code **)(pGVar7->_stage + 0x84))(0)); - spawnGame[0] = GHIDRA_UINT(pEStack_178); - } - } - } - else { - if (uVar11 != 0x15e) goto LAB_0096d990; - while ((pEStack_178 = GHIDRA_CAST(spawnGame[0]), spawnGame[0] == 0 || - (isRejected = (**(code **)(pGStack_17c->_stage + 0x2c))(spawnGame[0]), - isRejected != '\0'))) { - spawnGame[0] = ItemPool::GetTrinket(&g_game->_itemPool,0); - } - } - } -LAB_0096d998: - pGStack_17c = GHIDRA_CAST((GHIDRA_CAST((pGStack_138->_entityFactory)))->EntityFactory)::Create(uStack_118,0); - lVar4 = CONCAT44(piStack_180,fStack_150); - if (pGStack_17c != GHIDRA_CAST(0x0)) { - timeNs = GetTimeNs(); - pGVar7 = pGStack_17c; - piStack_180 = GHIDRA_CAST((timeNs >> 0x20)); - lVar4 = (timeNs & 0xffffffff) * 0x431bde82; - fStack_168 = (float)((uint64_t)lVar4 >> 0x20); - uStack_164 = GHIDRA_UINT((ZEXT48(piStack_180) * 0xd7b634db >> 0x20)); - timeNs = ZEXT48(piStack_180) * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar13 = GHIDRA_UINT((timeNs >> 0x20)); - lVar4 = lVar4 + (timeNs & 0xffffffff); - VStack_148.x = (float)lVar4; - uVar11 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - lVar4 = ZEXT48(piStack_180) * 0x431bde82 + - (uint64_t)CONCAT14(CARRY4(uVar13,uVar11),uVar13 + uVar11); - uVar11 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - spawnerSlot = pGStack_17c->_roomList[5]._doors; - _uStack_170 = CONCAT44(uVar11 >> 0x12,GHIDRA_UINT(lVar4) >> 0x12 | uVar11 * 0x4000); - spawnerIter = *spawnerSlot; - pGStack_17c->_roomList[0]._doors[1] = 0; - pGStack_17c->_roomList[0]._doors[2] = 0; - if (spawnerIter != 0) { - piStack_128 = spawnerSlot; - msvc::multiset::erase(&piStack_128); - } - spawnerIter = pGVar7->_stage; - *spawnerSlot = 0; - (GHIDRA_CAST(&pGVar7->_roomList[4].TotalMoneySpent))->x = VStack_134.x; - pGVar7->_roomList[4].GreedSubType = GHIDRA_INT(VStack_134.y); - (GHIDRA_CAST(&pGVar7->_roomList[4].SavedGridEntities._end))->x = g_vectorZero.x; - pGVar7->_roomList[4].SavedGridEntities._capacity = (void *)g_vectorZero.y; - (**(code **)(spawnerIter + 4))(uStack_118,uStack_114,pEStack_178,uStack_120); - pGVar8 = pGStack_138; - pvVar12 = pGStack_138->_room; - spawnerIter = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)) = spawnerIter + 1; - pGVar7->_roomList[0].Dimension = spawnerIter; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x1218)))))->EntityList::AddEntity(GHIDRA_CAST(pGVar7)); - bVar9 = Game::ShouldEraseEnemy(GHIDRA_CAST(pGVar7)); - if (bVar9 != 0) { - Entity::RemoveWithPoof(GHIDRA_CAST(pGVar7),unusedArg); - } - if (((*GHIDRA_CAST((GHIDRA_CAST(&(pGVar7->_roomList[1])) + 0xa6))) != '\0') && - ((pGVar8->_proceduralItemManager)._proceduralItems._begin != - (pGVar8->_proceduralItemManager)._proceduralItems._end)) { - iStack_ec = pGVar7->_roomList[0].AllowedDoors; - pvStack_f0 = pGVar7->_roomList[0].OverrideData; - msvc::map::find(&pvStack_11c,&pvStack_f0); - pvVar12 = (pGVar8->_proceduralItemManager)._spawnTriggerTargets._head; - if (pvStack_11c == pvVar12) { - pvStack_e8 = pvStack_f0; - uStack_e4 = 0xffffffff; - puVar10 = GHIDRA_CAST(std)::map::find(&VStack_110,&pvStack_e8); - pvStack_11c = (void *)*puVar10; - if (pvStack_11c == pvVar12) goto LAB_0096dc14; - } - uVar11 = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - pvVar12 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar12) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n") - ); - pvVar12 = (playerManager->_playerList)._end; - } - spawnerSlot = (playerManager->_playerList)._begin; - if (uVar11 < GHIDRA_UINT((GHIDRA_INT(pvVar12) - GHIDRA_INT(spawnerSlot) >> 2))) { - spawnerSlot = spawnerSlot + uVar11; - } - trigger_set_dispatch - ((void *)(*spawnerSlot + 0x1fc8),6,GHIDRA_CAST(pGStack_17c),&VStack_134, - &g_vectorZero); - uVar11 = uVar11 + 1; - playerManager = &g_game->_playerManager; - } while (uVar11 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } -LAB_0096dc14: - timeNs = GetTimeNs(); - uVar11 = GHIDRA_UINT((timeNs >> 0x20)); - lVar5 = (timeNs & 0xffffffff) * 0x431bde82; - fStack_168 = (float)((uint64_t)lVar5 >> 0x20); - lVar6 = (uint64_t)uVar11 * 0xd7b634db; - uStack_164 = GHIDRA_UINT(((uint64_t)lVar6 >> 0x20)); - lVar4 = (uint64_t)uVar11 * 0x431bde82; - timeNs = lVar6 + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar13 = GHIDRA_UINT((timeNs >> 0x20)); - lVar5 = lVar5 + (timeNs & 0xffffffff); - VStack_148.x = (float)lVar5; - uVar11 = GHIDRA_UINT(((uint64_t)lVar5 >> 0x20)); - lVar5 = lVar4 + (uint64_t)CONCAT14(CARRY4(uVar13,uVar11),uVar13 + uVar11); - uVar14 = GHIDRA_UINT(((uint64_t)lVar5 >> 0x20)); - uVar11 = GHIDRA_UINT(lVar5) >> 0x12 | uVar14 * 0x4000; - uVar13 = uVar11 - uStack_170; - bVar15 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar13); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar13; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + - (((uVar14 >> 0x12) - effectVariant) - GHIDRA_UINT((uVar11 < uStack_170))) + GHIDRA_UINT(bVar15); - } - piStack_180 = GHIDRA_CAST(((uint64_t)lVar4 >> 0x20)); - fStack_150 = (float)lVar4; - spawnerSlot = GHIDRA_CAST(__RTDynamicCast(pGStack_17c,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor - ,0)); - uVar11 = Random(); - uStack_98 = 0x3eaaaaab00000000; - auStack_90 = (uint8_t [4])0x0; - fVar16 = ((float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)]) * - 2.3283064e-10 + 1.0) * fStack_15c; - spawnerSlot[0x39] = GHIDRA_INT(fVar16); - spawnerSlot[0x3a] = GHIDRA_INT(fVar16); - CStack_cc._offset[1] = 0.0; - CStack_cc._offset[2] = 0.0; - fStack_a0 = 0.0; - fStack_9c = 0.0; - CStack_cc._colorize[1] = 0.02; - CStack_cc._colorize[2] = 0.9; - CStack_cc._colorize[3] = 0.02; - CStack_cc._offset[0] = 1.0; - (**(code **)(*spawnerSlot + 0x3c))(CStack_cc._colorize + 1,0xffffffff,0xff,0,1); - (**(code **)(*spawnerSlot + 0xc))(); - uStack_164 = Random(); - pGStack_17c = g_game; - fVar16 = 5.60519e-45; - uStack_14c = 2; - fStack_184 = 1.4013e-42; - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&fStack_184),GHIDRA_CAST(&uStack_14c),&VStack_148,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_CAST((auStack_188 + -4)),&uStack_164); - uVar11 = uStack_14c; - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - piStack_180 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - seed = (float)Random(); - spawnerSlot = piStack_180; - VStack_110.x = 7.00649e-45; - VStack_110.y = 1.26117e-44; - fStack_168 = 9.80909e-45; - VStack_108.x = 9.80909e-45; - if (fStack_184 == 7.00649e-45) { - if (uVar11 < 0x12d) { - if (uVar11 == 300) { - while ((fVar16 == 0.0 || - (isRejected = (**(code **)(*piStack_180 + 0x24))(fVar16), isRejected != '\0'))) - { - if (seed == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar11 = GHIDRA_UINT(seed) >> ((*GHIDRA_CAST((GHIDRA_CAST(&(VStack_110.x)) + 0x0))) & 0x1f) ^ GHIDRA_UINT(seed); - uVar11 = uVar11 << ((*GHIDRA_CAST((GHIDRA_CAST(&(VStack_110.y)) + 0x0))) & 0x1f) ^ uVar11; - seed = (float)(uVar11 >> (SUB41(fStack_168,0) & 0x1f) ^ uVar11); - spawnerIter = ItemPool::GetCardEx(GHIDRA_INT(seed),0x19,10,10,1); - explosionColor._tint[0] = 7.00649e-45; - explosionColor._tint[1] = 1.26117e-44; - explosionColor._tint[2] = 9.80909e-45; - auStack_90 = (uint8_t [4])seed; - fVar16 = (float)lua_callback_run_get_card(GHIDRA_CAST(auStack_90),spawnerIter,1,1,0); - } - } - else { - if (uVar11 == 0x46) { - fStack_160 = 0.0; - fVar17 = seed; - do { - if (fVar16 != 0.0) { - pcVar3 = *(code **)(*piStack_180 + 0x28); - spawnerIter = ItemPool::GetPillEffect - (&g_game->_itemPool,GHIDRA_UINT(fVar16),GHIDRA_CAST(0x0)); - seed = fVar17; - isRejected = (*pcVar3)(spawnerIter); - if (isRejected == '\0') goto LAB_0096e030; - } - if (seed == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar11 = GHIDRA_UINT(seed) >> ((*GHIDRA_CAST((GHIDRA_CAST(&(VStack_110.x)) + 0x0))) & 0x1f) ^ GHIDRA_UINT(seed); - uVar11 = uVar11 << ((*GHIDRA_CAST((GHIDRA_CAST(&(VStack_110.y)) + 0x0))) & 0x1f) ^ uVar11; - seed = (float)(uVar11 >> (SUB41(fStack_168,0) & 0x1f) ^ uVar11); - fVar17 = seed; - uVar11 = ItemPool::GetPill(GHIDRA_UINT(seed)); - fVar16 = (float)(uVar11 | (GHIDRA_UINT(fStack_160) & 1) << 0xb); - } while( true ); - } - if (uVar11 == 100) { - fStack_160 = fVar16; - msvc::set::find_node(GHIDRA_INT(&uStack_dc) + 4,&fStack_160); - if (((*GHIDRA_CAST((iStack_d0 + 0xd)) == '\0') && (*GHIDRA_CAST((iStack_d0 + 0x10)) < 5)) && - (iStack_d0 != spawnerSlot[8])) { - bVar15 = false; - } - else { - bVar15 = true; - } - if (bVar15) { - fVar16 = (float)(**(code **)(*spawnerSlot + 0x84))(0); - } - } - } - } - else if (uVar11 == 0x15e) { - while ((fVar16 == 0.0 || - (isRejected = (**(code **)(*piStack_180 + 0x2c))(fVar16), isRejected != '\0'))) { - fVar16 = (float)ItemPool::GetTrinket(&g_game->_itemPool,0); - } - } - } - } -LAB_0096e030: - pEStack_178 = (GHIDRA_CAST((pGStack_17c->_entityFactory)))->EntityFactory::Create(GHIDRA_UINT(fStack_184),0); - lVar4 = CONCAT44(poisonEffectSeed,local_13c); - if (pEStack_178 != GHIDRA_CAST(0x0)) { - timeNs = GetTimeNs(); - spawnedEntity = pEStack_178; - uVar13 = GHIDRA_UINT((timeNs >> 0x20)); - lVar4 = (timeNs & 0xffffffff) * 0x431bde82; - local_174 = GHIDRA_CAST(((uint64_t)lVar4 >> 0x20)); - lVar5 = (uint64_t)uVar13 * 0xd7b634db; - piStack_180 = GHIDRA_CAST(((uint64_t)lVar5 >> 0x20)); - timeNs = lVar5 + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar14 = GHIDRA_UINT((timeNs >> 0x20)); - lVar4 = lVar4 + (timeNs & 0xffffffff); - fStack_15c = (float)lVar4; - uVar11 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - lVar4 = (uint64_t)uVar13 * 0x431bde82 + - (uint64_t)CONCAT14(CARRY4(uVar14,uVar11),uVar14 + uVar11); - pEStack_178->_spawnerType = 0; - uVar11 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - pEStack_178->_spawnerVariant = 0; - fStack_168 = (float)(GHIDRA_UINT(lVar4) >> 0x12 | uVar11 * 0x4000); - uVar11 = uVar11 >> 0x12; - puVar1 = &pEStack_178->_spawnerEntity; - if (*puVar1 != 0) { - local_174 = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&local_174); - } - spawnerIter = *GHIDRA_CAST(spawnedEntity); - *puVar1 = 0; - (spawnedEntity->_pos).x = VStack_148.x; - (spawnedEntity->_pos).y = VStack_148.y; - (spawnedEntity->_velocity).x = g_vectorZero.x; - (spawnedEntity->_velocity).y = g_vectorZero.y; - (**(code **)(spawnerIter + 4))(fStack_184,uStack_14c,fVar16,uStack_164); - pGVar7 = pGStack_17c; - pvVar12 = pGStack_17c->_room; - spawnerIter = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)) = spawnerIter + 1; - spawnedEntity->_index = spawnerIter; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x1218)))))->EntityList::AddEntity(spawnedEntity); - bVar9 = Game::ShouldEraseEnemy(spawnedEntity); - if (bVar9 != 0) { - Entity::RemoveWithPoof(spawnedEntity,unusedArg_00); - } - if ((spawnedEntity->_exists != 0) && - ((pGVar7->_proceduralItemManager)._proceduralItems._begin != - (pGVar7->_proceduralItemManager)._proceduralItems._end)) { - uStack_118 = spawnedEntity->_variant; - pvStack_11c = (void *)spawnedEntity->_type; - msvc::map::find(&pGStack_17c,&pvStack_11c); - if (pGStack_17c == (pGVar7->_proceduralItemManager)._spawnTriggerTargets._head) { - fStack_15c = (float)spawnedEntity->_type; - spawnGame[0] = 0xffffffff; - spawnerSlot = GHIDRA_CAST(std)::map::find(auStack_188 + -8,&fStack_15c); - pGStack_17c = GHIDRA_CAST(*spawnerSlot); - if (pGStack_17c == (pGVar7->_proceduralItemManager)._spawnTriggerTargets._head) - goto LAB_0096e2b2; - } - playerManager = &g_game->_playerManager; - piStack_180 = GHIDRA_CAST(0x0); - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - pvVar12 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar12) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n") - ); - pvVar12 = (playerManager->_playerList)._end; - } - spawnerSlot = (playerManager->_playerList)._begin; - if (piStack_180 < GHIDRA_CAST((GHIDRA_INT(pvVar12) - GHIDRA_INT(spawnerSlot) >> 2))) { - spawnerSlot = spawnerSlot + GHIDRA_INT(piStack_180); - } - trigger_set_dispatch - ((void *)(*spawnerSlot + 0x1fc8),6,spawnedEntity,&VStack_148,&g_vectorZero); - playerManager = &g_game->_playerManager; - piStack_180 = GHIDRA_CAST((GHIDRA_INT(piStack_180) + 1)); - } while (piStack_180 < - GHIDRA_CAST((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } -LAB_0096e2b2: - timeNs = GetTimeNs(); - pGStack_17c = GHIDRA_CAST((timeNs >> 0x20)); - lVar5 = (timeNs & 0xffffffff) * 0x431bde82; - fStack_160 = (float)((uint64_t)lVar5 >> 0x20); - local_174 = GHIDRA_CAST((ZEXT48(pGStack_17c) * 0xd7b634db >> 0x20)); - lVar4 = ZEXT48(pGStack_17c) * 0x431bde82; - timeNs = ZEXT48(pGStack_17c) * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar14 = GHIDRA_UINT((timeNs >> 0x20)); - lVar5 = lVar5 + (timeNs & 0xffffffff); - fStack_15c = (float)lVar5; - uVar13 = GHIDRA_UINT(((uint64_t)lVar5 >> 0x20)); - lVar5 = lVar4 + (uint64_t)CONCAT14(CARRY4(uVar14,uVar13),uVar14 + uVar13); - uVar14 = GHIDRA_UINT(((uint64_t)lVar5 >> 0x20)); - fVar16 = (float)(GHIDRA_UINT(lVar5) >> 0x12 | uVar14 * 0x4000); - uVar13 = GHIDRA_INT(fVar16) - GHIDRA_INT(fStack_168); - bVar15 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar13); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar13; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + - (((uVar14 >> 0x12) - uVar11) - GHIDRA_UINT((GHIDRA_UINT(fVar16) < GHIDRA_UINT(fStack_168)))) + GHIDRA_UINT(bVar15); - } - spawnedEntity = pEStack_178; - poisonEffectSeed = (uint32_t)((uint64_t)lVar4 >> 0x20); - local_13c = (float)lVar4; - (GHIDRA_CAST((&CStack_cc)))->Color::Reset(); - CStack_cc._tint[0] = 0.02; - CStack_cc._tint[1] = 0.9; - CStack_cc._tint[2] = 0.02; - CStack_cc._tint[3] = fStack_150; - CStack_cc._offset[0] = 0.039215688; - CStack_cc._offset[1] = 0.3921569; - CStack_cc._offset[2] = 0.0; - spawnedEntity->SetColor(&CStack_cc,0xffffffff,0xff,0,1); - spawnerIter = *GHIDRA_CAST(spawnedEntity); - spawnedEntity->_renderDepthOffset = -5.0; - (spawnedEntity->_sprite)._scale.x = fStack_184; - (spawnedEntity->_sprite)._scale.y = fStack_184 * 0.4; - (**(code **)(spawnerIter + 0xc))(); - this = local_174; - } - uVar11 = Random(); - spawnedEntity = Game::SpawnEx(g_game,1000,1,&VStack_134,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar11,0); - spawnerSlot = GHIDRA_CAST(__RTDynamicCast(spawnedEntity,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0 - )); - if (fStack_15c != 1.0) { - spawnerSlot[0x3a] = GHIDRA_INT((fStack_15c * (float)spawnerSlot[0x3a])); - spawnerSlot[0x39] = GHIDRA_INT((fStack_15c * (float)spawnerSlot[0x39])); - } - explosionColor._offset[0] = (this->_sprite)._color._tint[0]; - explosionColor._offset[1] = (this->_sprite)._color._tint[1]; - explosionColor._offset[2] = (this->_sprite)._color._tint[2]; - fStack_44 = (this->_sprite)._color._offset[2]; - (**(code **)(*spawnerSlot + 0x3c))(explosionColor._offset,0xffffffff,0xff,0,1); - uVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._h)) + 0x4))); - uVar14 = ~GHIDRA_UINT(g_tearFlagExplosive._h); - uVar13 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._l)) + 0x4))); - *GHIDRA_CAST(&(this->_activeTearFlags)._l) = - GHIDRA_UINT((this->_activeTearFlags)._l) & ~GHIDRA_UINT(g_tearFlagExplosive._l); - puVar10 = GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._l) + 4)); - *puVar10 = *puVar10 & uVar13; - pqVar2 = &(this->_activeTearFlags)._h; - *GHIDRA_CAST(pqVar2) = GHIDRA_UINT(*pqVar2) & uVar14; - puVar10 = GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._h) + 4)); - *puVar10 = *puVar10 & ~uVar11; - } -LAB_0096e506: - local_174 = GHIDRA_CAST((GHIDRA_UINT(g_tearFlagSplit._h) | GHIDRA_UINT(g_tearFlagQuadsplit._h))); - uVar11 = GHIDRA_UINT((this->_tearFlags)._h); - fVar16 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - fStack_160 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._h)) + 0x4)))); - if ((!(((GHIDRA_UINT(g_tearFlagSplit._l) | GHIDRA_UINT((void *)g_tearFlagQuadsplit._l)) & - GHIDRA_UINT((this->_tearFlags)._l)) == 0 && - (((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagQuadsplit._l))) + 0x4)))) & - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4))) == 0)) || - (!((uVar11 & GHIDRA_UINT(local_174)) == 0 && (GHIDRA_UINT(fVar16) & GHIDRA_UINT(fStack_160)) == 0))) { - fStack_15c = fVar16; - if ((this->_isFirstUpdate == 0) && - (spawnerIter = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(4.0,0.0), spawnerIter == 0)) { - fVar16 = fStack_15c; - } - else { - Room::GetClampedPositionImpl(g_game->_room,&VStack_148,impactPos,1.0,1.0,1.0,1.0); - uVar11 = Random(); - fVar16 = (float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_174 = GHIDRA_CAST((fVar16 + fVar16)); - fStack_168 = cos((float)local_174); - fStack_168 = fStack_168 * 10.0; - VStack_110.x = fStack_168; - fStack_150 = sin((float)local_174); - splitFlagsLow = - ~(GHIDRA_UINT(g_tearFlagFetus._l) | GHIDRA_UINT(g_tearFlagLasershot._l) | - GHIDRA_UINT(g_tearFlagHydrobounce._l) | GHIDRA_UINT(g_tearFlagAbsorb._l) | GHIDRA_UINT(g_tearFlagBone._l) | - GHIDRA_UINT(g_tearFlagLudovico._l) | GHIDRA_UINT(g_tearFlagSplit._l) | - GHIDRA_UINT((void *)g_tearFlagQuadsplit._l)) & - (GHIDRA_UINT((this->_tearFlags)._l) | GHIDRA_UINT(g_tearFlagPiercing._l)); - fStack_150 = fStack_150 * 10.0; - uStack_fc = ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFetus._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLasershot._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAbsorb._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBone._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._l)) + 0x4))) - | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagQuadsplit._l))) + 0x4)))) & - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._l)) + 0x4)))); - uStack_f8 = ~(GHIDRA_UINT(g_tearFlagFetus._h) | GHIDRA_UINT(g_tearFlagLasershot._h) | - GHIDRA_UINT(g_tearFlagHydrobounce._h) | GHIDRA_UINT(g_tearFlagAbsorb._h) | - GHIDRA_UINT(g_tearFlagBone._h) | GHIDRA_UINT(g_tearFlagLudovico._h) | GHIDRA_UINT(g_tearFlagSplit._h) - | GHIDRA_UINT(g_tearFlagQuadsplit._h)) & - (GHIDRA_UINT((this->_tearFlags)._h) | GHIDRA_UINT(g_tearFlagPiercing._h)); - VStack_110.y = fStack_150; - uStack_f4 = ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFetus._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLasershot._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAbsorb._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBone._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._h)) + 0x4))) - | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._h)) + 0x4)))) & - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._h)) + 0x4)))); - get_tear_spawn_color(this,&splitTearColor); - uVar11 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - splitTearColor._tint[3] = splitTearColor._tint[3] * local_13c; - pvStack_11c = (void *)g_tearFlagQuadsplit._l; - piStack_128 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._l)) + 0x4))); - uStack_164 = GHIDRA_UINT(g_tearFlagSplit._h) | GHIDRA_UINT(g_tearFlagQuadsplit._h); - uStack_120 = GHIDRA_UINT(g_tearFlagQuadsplit._h); - fStack_160 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._h)) + 0x4)))); - uStack_14c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._h)) + 0x4))); - fStack_15c = (float)(uVar11 & ((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagQuadsplit._l))) + 0x4))))) - ; - uVar13 = GHIDRA_UINT((this->_tearFlags)._h); - if (((((GHIDRA_UINT((this->_tearFlags)._l) & - (GHIDRA_UINT(g_tearFlagSplit._l) | GHIDRA_UINT((void *)g_tearFlagQuadsplit._l))) == - (GHIDRA_UINT(g_tearFlagSplit._l) | GHIDRA_UINT((void *)g_tearFlagQuadsplit._l))) && - (fStack_15c == (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagQuadsplit._l))) + 0x4)))))) - && ((uVar13 & uStack_164) == uStack_164)) && - ((float)(*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & GHIDRA_UINT(fStack_160)) == fStack_160)) { - fVar16 = 60.0; - _uStack_170 = CONCAT44(effectVariant,6); -LAB_0096e8c5: - local_174 = GHIDRA_CAST((fVar16 * 0.017453292)); - fStack_160 = cos((float)local_174); - local_174 = GHIDRA_CAST(sin((float)local_174)); - do { - uVar11 = Random(); - VStack_108.x = VStack_148.x - direction->x * 4.0; - VStack_108.y = VStack_148.y - direction->y * 4.0; - splitTear = (Entity_Tear *) - Game::SpawnEx(g_game,2,0,&VStack_108,&VStack_110, - GHIDRA_CAST(this->_spawnerEntity),0,uVar11,0); - splitTear->_height = -11.875; - fVar16 = (GHIDRA_CAST((splitTear)))->Entity_Tear::get_height_offset_y(-11.875); - pGVar7 = g_game; - (splitTear->_posOffset).y = fVar16; - if (*GHIDRA_CAST((GHIDRA_CAST(pGVar7->_room) + 8)) == 0x10) { - (splitTear->_posOffset).y = -18.0; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = uStack_fc; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = splitFlagsLow; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uStack_f8; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_f4; - (GHIDRA_CAST((splitTear)))->Entity_Tear::SetTearFlags(flags); - splitTear->SetCollisionDamage(this->_collisionDamage * 0.5); - fVar16 = this->_scale * 0.6; - if (fVar16 <= 0.01) { - fVar16 = 0.01; - } - splitTear->_baseScale = fVar16; - splitTear->_fScale = fVar16; - (GHIDRA_CAST((splitTear)))->Entity_Tear::ResetSpriteScale(); - splitTear->SetColor(&fStack_44,0xffffffff,0xff,0,1); - splitTear->Update(); - spawnerIter = uStack_170 + -1; - _uStack_170 = CONCAT44(effectVariant,spawnerIter); - fVar16 = fStack_168 * (float)local_174; - fStack_168 = fStack_168 * fStack_160 - fStack_150 * (float)local_174; - fStack_150 = fStack_150 * fStack_160 + fVar16; - VStack_110.y = fStack_150; - VStack_110.x = fStack_168; - } while (spawnerIter != 0); - } - else { - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagSplit._l)) != 0 || - (uVar11 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._l)) + 0x4)))) != 0) || - ((uVar13 & GHIDRA_UINT(g_tearFlagSplit._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._h)) + 0x4)))) != 0)) { - fVar16 = 180.0; - _uStack_170 = CONCAT44(effectVariant,2); - goto LAB_0096e8c5; - } - _uStack_170 = CONCAT44(effectVariant,uVar11 & (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagQuadsplit._l))) + 0x4)))); - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT((void *)g_tearFlagQuadsplit._l)) != 0 || - (uVar11 & (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagQuadsplit._l))) + 0x4)))) != 0) || - ((uVar13 & GHIDRA_UINT(g_tearFlagQuadsplit._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._h)) + 0x4)))) != 0)) { - fVar16 = 90.0; - _uStack_170 = CONCAT44(effectVariant,4); - goto LAB_0096e8c5; - } - } - spawnerSlot = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._l)) + 0x4))); - pvVar12 = (void *)g_tearFlagQuadsplit._l; - uVar11 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagQuadsplit._h)) + 0x4))); - pqVar2 = &(this->_activeTearFlags)._h; - *GHIDRA_CAST(pqVar2) = GHIDRA_UINT(*pqVar2) & ~GHIDRA_UINT(g_tearFlagQuadsplit._h); - *GHIDRA_CAST(&(this->_activeTearFlags)._l) = GHIDRA_UINT((this->_activeTearFlags)._l) & ~GHIDRA_UINT(pvVar12); - puVar10 = GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._l) + 4)); - *puVar10 = *puVar10 & ~GHIDRA_UINT(spawnerSlot); - puVar10 = GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._h) + 4)); - *puVar10 = *puVar10 & uVar11; - uVar11 = GHIDRA_UINT((this->_tearFlags)._h); - fVar16 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - } - } - local_174 = GHIDRA_CAST((uVar11 & GHIDRA_UINT(g_tearFlagJacobs._h))); - fStack_160 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagJacobs._h)) + 0x4))) & GHIDRA_UINT(fVar16)); - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagJacobs._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagJacobs._l)) + 0x4)))) != 0) || - (local_174 != GHIDRA_CAST(0x0) || fStack_160 != 0.0)) { - if (this->_isFirstUpdate == 0) { - fStack_15c = fVar16; - spawnerIter = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0); - fVar16 = fStack_15c; - if (spawnerIter == 0) goto LAB_0096ec0c; - } - spawnedEntity = - spawn_chain_lightning - (impactPos,this->_tearFlags,GHIDRA_CAST(this->_spawnerEntity), - this->_collisionDamage * 0.5); - msvc::vector::assign(&this->_hitList); - CStack_cc._colorize[1] = (spawnedEntity->_sprite)._color._tint[0]; - CStack_cc._colorize[2] = (spawnedEntity->_sprite)._color._tint[1]; - CStack_cc._colorize[3] = (spawnedEntity->_sprite)._color._tint[2]; - CStack_cc._offset[1] = (spawnedEntity->_sprite)._color._colorize[0]; - CStack_cc._offset[2] = (spawnedEntity->_sprite)._color._colorize[1]; - fStack_a0 = (spawnedEntity->_sprite)._color._colorize[2]; - fStack_9c = (spawnedEntity->_sprite)._color._colorize[3]; - CStack_cc._offset[0] = (spawnedEntity->_sprite)._color._tint[3] * local_13c; - uStack_98 = *GHIDRA_CAST((spawnedEntity->_sprite)._color._offset); - auStack_90 = (uint8_t [4])(spawnedEntity->_sprite)._color._offset[2]; - spawnedEntity->SetColor(CStack_cc._colorize + 1,0xffffffff,0xff,0,1); - spawnedEntity->Update(); - uVar11 = GHIDRA_UINT((this->_tearFlags)._h); - fVar16 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - } -LAB_0096ec0c: - if ((((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagRift._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRift._l)) + 0x4)))) != 0) || - ((uVar11 & GHIDRA_UINT(g_tearFlagRift._h)) != 0 || (GHIDRA_UINT(fVar16) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRift._h)) + 0x4)))) != 0)) && - ((this->_isFirstUpdate != 0 || - (spawnerIter = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), spawnerIter != 0)))) { - pGVar7 = g_game; - bVar9 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(impactPos,-10.0); - if (bVar9 != 0) { - local_174 = GHIDRA_CAST((this->_collisionDamage * 0.5)); - Room::GetClampedPositionImpl(pGVar7->_room,&VStack_148,impactPos,0.0,0.0,0.0,0.0); - uVar11 = Random(); - spawnedEntity = - Game::SpawnEx(g_game,1000,0xb4,&VStack_148,&g_vectorZero,GHIDRA_CAST(this->_spawnerEntity),0 - ,uVar11,0); - fVar16 = this->_scale * g_vectorOne.x; - spawnerIter = *GHIDRA_CAST(spawnedEntity); - (spawnedEntity->_sprite)._scale.y = this->_scale * g_vectorOne.y; - (spawnedEntity->_sprite)._scale.x = fVar16; - (**(code **)(spawnerIter + 0x40))(local_174); - riftTimeout = 0x3c; - spawnerIter = *GHIDRA_CAST(spawnedEntity); - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - riftTimeout = 0x1e; - } - *GHIDRA_CAST((spawnedEntity[1]._sprite._filename._buf + 4)) = riftTimeout; - *GHIDRA_CAST((spawnedEntity[1]._sprite._filename._buf + 8)) = riftTimeout; - (**(code **)(spawnerIter + 0xc))(); - uVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRift._l)) + 0x4))); - uVar14 = ~GHIDRA_UINT(g_tearFlagRift._h); - uVar13 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRift._h)) + 0x4))); - *GHIDRA_CAST(&(this->_activeTearFlags)._l) = - GHIDRA_UINT((this->_activeTearFlags)._l) & ~GHIDRA_UINT(g_tearFlagRift._l); - pqVar2 = &(this->_activeTearFlags)._h; - *GHIDRA_CAST(pqVar2) = GHIDRA_UINT(*pqVar2) & uVar14; - puVar10 = GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._l) + 4)); - *puVar10 = *puVar10 & ~uVar11; - puVar10 = GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._h) + 4)); - *puVar10 = *puVar10 & uVar13; - manager = g_manager; - uStack_164 = 0x440; - seed_fart_sound_override(GHIDRA_CAST(&uStack_164)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(uStack_164,1.0,2,0,1.0,0.0); - } - } - return; -} - -// 0096ee00 -ColorMod * Entity_Laser::get_tear_spawn_color(ColorMod *outColor) -{ - ColorMod *color; - float *extraout_EAX; - float *extraout_EAX_00; - float alpha; - float luminance; - float red; - float green; - float blue; - KColor resultKColor; - Color laserColor; - KColor kcolorMultiplier; - ColorMod tintedColor; - float local_8; - float colorizeAmount; - int variant; - - local_8 = (float)(__security_cookie ^ GHIDRA_UINT(((&tintedColor)[1]._tint + 1))); - variant = this->_variant; - if ((variant == 3) || (variant == 10)) { - colorizeAmount = (this->_sprite)._color._colorize[3]; - red = (this->_sprite)._color._tint[0] * 0.85; - green = (this->_sprite)._color._tint[1] * 0.9; - blue = (this->_sprite)._color._tint[2]; - alpha = (this->_sprite)._color._tint[3]; - if (colorizeAmount != 0.0) { - luminance = red * 0.212671 + green * 0.71516 + blue * 0.072169; - red = red + (luminance * (this->_sprite)._color._colorize[0] - red) * colorizeAmount; - green = green + (luminance * (this->_sprite)._color._colorize[1] - green) * colorizeAmount; - blue = blue + (luminance * (this->_sprite)._color._colorize[2] - blue) * colorizeAmount; - } - red = red + (this->_sprite)._color._offset[0]; - green = green + (this->_sprite)._color._offset[1]; - blue = blue + (this->_sprite)._color._offset[2]; - } - else { - kcolorMultiplier._unk = 0; - color = &(this->_sprite)._color; - if (variant == 2) { - kcolorMultiplier._red = 1.0; - kcolorMultiplier._green = 0.0; - kcolorMultiplier._blue = 0.0; - kcolorMultiplier._alpha = 1.0; - Color::apply_to_kcolor(&resultKColor,color,&kcolorMultiplier); - red = *extraout_EAX; - green = extraout_EAX[1]; - blue = extraout_EAX[2]; - alpha = extraout_EAX[3]; - } - else { - laserColor._offset[2] = (this->_sprite)._color._offset[2]; - kcolorMultiplier._red = 0.85; - kcolorMultiplier._green = 0.9; - kcolorMultiplier._blue = 1.0; - kcolorMultiplier._alpha = 1.0; - tintedColor._colorize[0] = 0.0; - tintedColor._colorize[1] = 0.0; - tintedColor._colorize[2] = 0.0; - tintedColor._colorize[3] = 0.0; - tintedColor._tint[0] = 1.0; - tintedColor._tint[1] = 0.0; - tintedColor._tint[2] = 0.0; - tintedColor._tint[3] = 1.0; - tintedColor._offset[0] = 0.0; - tintedColor._offset[1] = 0.0; - laserColor._tint[0] = color->_tint[0]; - laserColor._tint[1] = (this->_sprite)._color._tint[1]; - laserColor._tint[2] = (this->_sprite)._color._tint[2]; - laserColor._tint[3] = (this->_sprite)._color._tint[3]; - tintedColor._offset[2] = 0.0; - laserColor._colorize[0] = (this->_sprite)._color._colorize[0]; - laserColor._colorize[1] = (this->_sprite)._color._colorize[1]; - laserColor._colorize[2] = (this->_sprite)._color._colorize[2]; - laserColor._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(laserColor._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - (GHIDRA_CAST((&laserColor)))->Color::__mul(&tintedColor); - tintedColor._offset[2] = laserColor._offset[2]; - tintedColor._tint[0] = laserColor._tint[0]; - tintedColor._tint[1] = laserColor._tint[1]; - tintedColor._tint[2] = laserColor._tint[2]; - tintedColor._tint[3] = laserColor._tint[3]; - tintedColor._colorize[0] = laserColor._colorize[0]; - tintedColor._colorize[1] = laserColor._colorize[1]; - tintedColor._colorize[2] = laserColor._colorize[2]; - tintedColor._colorize[3] = laserColor._colorize[3]; - tintedColor._offset[0] = laserColor._offset[0]; - tintedColor._offset[1] = laserColor._offset[1]; - Color::apply_to_kcolor(&resultKColor,&tintedColor,&kcolorMultiplier); - red = *extraout_EAX_00; - green = extraout_EAX_00[1]; - blue = extraout_EAX_00[2]; - alpha = extraout_EAX_00[3]; - } - } - outColor->_tint[0] = 1.0; - outColor->_tint[3] = alpha; - outColor->_tint[1] = 1.0; - outColor->_tint[2] = 1.0; - outColor->_colorize[3] = 1.0; - outColor->_colorize[0] = red * 0.5; - outColor->_colorize[1] = green * 0.5; - outColor->_colorize[2] = blue * 0.5; - outColor->_offset[0] = red * 0.5; - outColor->_offset[1] = green * 0.5; - outColor->_offset[2] = blue * 0.5; - return outColor; -} - -// 0096f070 -void Entity_Laser::copy_from_parent(Entity_Laser *parent, uint8_t isCopySpawnData) -{ - uint32_t tearFlagsWord1; - uint32_t tearFlagsWord3; - uint32_t tearFlagsWord2; - int *erasedRef; - int parentSpawner; - uint32_t *spawnerRef; - - if (*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c94298) { - _Init_thread_header(&DAT_00c94298); - if (DAT_00c94298 == -1) { - DAT_00c942a0 = ~(GHIDRA_UINT(g_tearFlagPop._l) | GHIDRA_UINT(g_tearFlagAbsorb._l) | GHIDRA_UINT(g_tearFlagSplit._l) - | GHIDRA_UINT(g_tearFlagTurnHorizontal._l)); - _DAT_00c942a4 = - ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPop._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAbsorb._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagTurnHorizontal._l)) + 0x4)))); - DAT_00c942a8 = ~(GHIDRA_UINT(g_tearFlagPop._h) | GHIDRA_UINT(g_tearFlagAbsorb._h) | GHIDRA_UINT(g_tearFlagSplit._h) - | GHIDRA_UINT(g_tearFlagTurnHorizontal._h)); - _DAT_00c942ac = - ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPop._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAbsorb._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSplit._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagTurnHorizontal._h)) + 0x4)))); - _Init_thread_footer(&DAT_00c94298); - } - } - if (isCopySpawnData != 0) { - spawnerRef = &this->_spawnerEntity; - (this->_dropRNG)._seed = (parent->_dropRNG)._seed; - (this->_dropRNG)._shift1 = 4; - (this->_dropRNG)._shift2 = 3; - (this->_dropRNG)._shift3 = 0x11; - this->_homingType = parent->_homingType; - this->_spawnerType = parent->_spawnerType; - this->_spawnerVariant = parent->_spawnerVariant; - parentSpawner = parent->_spawnerEntity; - if (*spawnerRef != 0) { - erasedRef = spawnerRef; - msvc::multiset::erase(&erasedRef); - } - *spawnerRef = parentSpawner; - if (parentSpawner != 0) { - msvc::multiset::insert(spawnerRef); - } - this->_oneHit = parent->_oneHit; - this->_multidimensionalTouched = parent->_multidimensionalTouched; - this->_prismTouched = parent->_prismTouched; - this->_scale = parent->_scale; - ResetSpriteScale(this); - this->_chainedLasers = parent->_chainedLasers; - } - this->SetColor(&(parent->_sprite)._color,0xffffffff,0xff,0,1); - tearFlagsWord1 = *GHIDRA_CAST((GHIDRA_INT(&(parent->_activeTearFlags)._l) + 4)) & _DAT_00c942a4; - tearFlagsWord2 = DAT_00c942a8 & GHIDRA_UINT((parent->_activeTearFlags)._h); - tearFlagsWord3 = *GHIDRA_CAST((GHIDRA_INT(&(parent->_activeTearFlags)._h) + 4)) & _DAT_00c942ac; - *GHIDRA_CAST(&(this->_tearFlags)._l) = DAT_00c942a0 & GHIDRA_UINT((parent->_activeTearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = tearFlagsWord1; - *GHIDRA_CAST(&(this->_tearFlags)._h) = tearFlagsWord2; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = tearFlagsWord3; - this->SetCollisionDamage(parent->_collisionDamage); - this->_blackHpDropChance = parent->_blackHpDropChance; - this->_maxDistance = parent->_maxDistance; - this->_visible = parent->_visible; - this->_renderDepthOffset = parent->_renderDepthOffset; - this->_entityGridCollisionClass = parent->_entityGridCollisionClass; - this->_entityCollisionClass = parent->_entityCollisionClass; - this->_mass = parent->_mass; - if ((isCopySpawnData != 0) || (this->_oneHit == 0)) { - this->_timeout = parent->_timeout; - this->_shrink = parent->_shrink; - } - return; -} - -// 0096f470 -void Entity_Laser::RotateToAngle(float angle, float speed) -{ - float angleDelta; - - this->_isActiveRotating = 1; - this->_rotationDelay = 0; - angleDelta = angle_difference(this->_angleDegrees,angle); - this->_rotationDegrees = angleDelta; - if (angleDelta < 0.0) { - speed = -speed; - } - this->_rotationSpd = speed; - return; -} - -// 0096f4e0 -void Entity_Laser::ClearLaserSamples() -{ - uint32_t uVar1; - uint32_t isRing; - uint32_t uVar2; - void *bezierBegin; - void *nonOptimizedSamplesBegin; - uint32_t samplesBegin; - int subtype; - - bezierBegin = (this->_homingLaser)._bezier._begin; - nonOptimizedSamplesBegin = (this->_homingLaser)._nonOptimizedSamples._begin; - samplesBegin = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x34)))); - (this->_homingLaser)._bezier._end = bezierBegin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) = samplesBegin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x38)))) = uVar1; - (this->_homingLaser)._nonOptimizedSamples._end = nonOptimizedSamplesBegin; - subtype = this->_subtype; - if (((subtype == 1) || (subtype == 2)) || (subtype == 3)) { - uVar2 = 0x42700000; - isRing = 1; - this->_entityGridCollisionClass = 0; - } - else { - uVar2 = 0x42f00000; - isRing = 0; - } - (this->_homingLaser)._bezier._end = bezierBegin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) = samplesBegin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x38)))) = uVar1; - (this->_homingLaser)._nonOptimizedSamples._end = nonOptimizedSamplesBegin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x18)))) = 0x32; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x40)))) = isRing; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x14)))) = uVar2; - if (this->_homingType == 1) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x14)))) = 0x43c80000; - } - return; -} - -// 0096f590 -void Entity_Laser::Init(int type, int variant, int subType, uint32_t initSeed) -{ - uint8_t bVar1; - uint8_t *pbVar2; - uint32_t uVar3; - std_string *psVar4; - bool bVar5; - std_string *defaultAnimName; - uint8_t *animData; - - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Init(type,variant,subType,initSeed); - if (this->_config != (void *)0x0) { - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); - defaultAnimName = &(this->_sprite)._animDefaultName; - if (0xf < (this->_sprite)._animDefaultName._capacity) { - defaultAnimName = *GHIDRA_CAST(defaultAnimName->_buf); - } - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - pbVar2 = animData; - psVar4 = defaultAnimName; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - pbVar2 = *GHIDRA_CAST(animData); - } - do { - bVar1 = *pbVar2; - bVar5 = bVar1 < (uint8_t)psVar4->_buf[0]; - if (bVar1 != psVar4->_buf[0]) { -LAB_0096f610: - uVar3 = -GHIDRA_UINT(bVar5) | 1; - goto LAB_0096f615; - } - if (bVar1 == 0) break; - bVar1 = pbVar2[1]; - bVar5 = bVar1 < (uint8_t)psVar4->_buf[1]; - if (bVar1 != psVar4->_buf[1]) goto LAB_0096f610; - pbVar2 = pbVar2 + 2; - psVar4 = GHIDRA_CAST((psVar4->_buf + 2)); - } while (bVar1 != 0); - uVar3 = 0; -LAB_0096f615: - if ((uVar3 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0096f648; - } - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(defaultAnimName),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } -LAB_0096f648: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x517)))) = 0; - this->_damageMultiplier = 1.0; - this->_waitFrames = 0; - (this->_parentOffset).x = g_vectorZero.x; - (this->_parentOffset).y = g_vectorZero.y; - this->_scale = 1.0; - this->_angleDegrees = 0.0; - this->_startAngleDegrees = 0.0; - this->_lastAngleDegrees = 0.0; - this->_renderDepthOffset = 0.0; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - *GHIDRA_CAST(&(this->_activeTearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_activeTearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._h) + 4)) = 0; - *GHIDRA_CAST(&(this->_heldTearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_heldTearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._h) + 4)) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))) = 0; - this->_timeout = 0; - this->_isFirstUpdate = 1; - this->_sampleLaser = 0xff; - this->_entityGridCollisionClass = 3; - this->_laserLength = 0.0; - this->_curveStrength = 0.0; - this->_shrink = 0; - this->_isActiveRotating = 0; - this->_homingType = 0; - this->_maxDistance = 0.0; - this->_radius = 80.0; - this->_disableFollowParent = 0; - this->_bounceLaser = (void *)0x0; - this->_multidimensionalTouched = 0; - this->_prismTouched = 0; - this->_oneHit = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f0)))) = 0; - this->_childLaser = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x508)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x50c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x510)))) = 0; - (this->_hitList)._end = (this->_hitList)._begin; - (this->_homingLaser)._bezier._end = (this->_homingLaser)._bezier._begin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x38)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x34)))); - (this->_homingLaser)._nonOptimizedSamples._end = (this->_homingLaser)._nonOptimizedSamples._begin; - this->_blackHpDropChance = 0.0; - this->_impactDistance = INFINITY; - this->_subLaserDistance = INFINITY; - this->_subLaserAngle = 0.0; - this->_chainedLasers = 0; - FUN_008615e0(this); - return; -} - -// 0096f880 -void Entity_Laser::PlayInitSound() -{ - int spawnerType; - uint32_t pitchRoll; - Manager *manager; - float volume; - Entity_Laser *local_8; - uint8_t isLoop; - int spawnerType; - - manager = g_manager; - if (this->_disableInitSound != 0) { - return; - } - if ((this->_parent != 0) && (*GHIDRA_CAST((this->_parent + 0x28)) == 7)) { - return; - } - if (this->_visible == 0) { - return; - } - switch(this->_variant) { - case 1: - case 8: - case 9: - if (this->_spawnerEntity == 0) goto switchD_0096f8c9_caseD_3; - local_8 = GHIDRA_CAST(this->_scale); - spawnerType = *GHIDRA_CAST((this->_spawnerEntity + 0x28)); - if (spawnerType < 0x3d) { - if (spawnerType == 0x3c) { - local_8 = GHIDRA_CAST(0x87); - } - else { - if ((spawnerType != 0x2b) && (spawnerType != 0x31)) goto LAB_0096f92b; - local_8 = GHIDRA_CAST(0x7); - } - break; - } - if (spawnerType == 0x54) { - local_8 = GHIDRA_CAST(0xd3); - break; - } - if (spawnerType != 0x193) { -LAB_0096f92b: - if (this->_subtype == 0) { - SoundEffects::PlayWithFartOverride(((float)local_8 < 0.75) + 5,1.0,2,0,1.0); - return; - } - if (this->_subtype == 2) { - SoundEffects::PlayWithFartOverride(((float)local_8 < 0.75) + 5,0.6,2,0,1.0); - SoundEffects::PlayWithFartOverride(GHIDRA_UINT((0.75 <= (float)local_8)) * 2 + 0x10f,1.0,2,0,1.0); - return; - } - return; - } - local_8 = GHIDRA_CAST(0x3cb); - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - isLoop = 1; - goto LAB_0096fc15; - case 2: - local_8 = GHIDRA_CAST(this->_scale); - pitchRoll = Random(); - if (this->_subtype == 2) { - spawnerType = 0x10f; - if ((float)local_8 < 0.75) { - spawnerType = 0x110; - volume = 0.85; - goto LAB_0096fb3b; - } - if (1.45 < (float)local_8) { - volume = 1.1; - spawnerType = 0x111; - goto LAB_0096fb3b; - } - } - else { - spawnerType = 0x85; - if ((float)local_8 < 0.75) { - volume = 0.5; - spawnerType = 0x86; - goto LAB_0096fb3b; - } - if (1.45 < (float)local_8) { - volume = 1.1; - spawnerType = 0x87; - goto LAB_0096fb3b; - } - } - volume = 1.0; -LAB_0096fb3b: - if (this->_spawnerEntity != 0) { - spawnerType = *GHIDRA_CAST((this->_spawnerEntity + 0x28)); - if ((spawnerType == 1) || (spawnerType == 3)) { - volume = volume * 0.9; - } - else if (spawnerType == 0xc9) { - volume = volume * 0.4; - } - } - SoundEffects::PlayWithFartOverride - (spawnerType,volume,1,0, - (float)((double)GHIDRA_INT(pitchRoll) + __uint_to_double_fixup[-(GHIDRA_INT(pitchRoll) >> 0x1f)]) * - 2.3283064e-10 * 0.3 + 0.85); - return; - case 3: -switchD_0096f8c9_caseD_3: - local_8 = GHIDRA_CAST(0x5); - break; - default: - goto switchD_0096f8c9_caseD_4; - case 5: - local_8 = GHIDRA_CAST(0x114); - break; - case 6: - case 0xf: - local_8 = GHIDRA_CAST(0x116); - break; - case 10: - local_8 = this; - pitchRoll = Random(); - SoundEffects::PlayWithFartOverride - (0x86,0.6,2,0, - (float)((double)GHIDRA_INT(pitchRoll) + __uint_to_double_fixup[-(GHIDRA_INT(pitchRoll) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9); - return; - case 0xb: - case 0xe: - if (this->_subtype == 2) { - local_8 = GHIDRA_CAST(0xa); - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),0.6,2,0,1.0,0.0); - local_8 = GHIDRA_CAST(0x111); - } - else { - if (this->_subtype == 1) { - return; - } - local_8 = GHIDRA_CAST(0xa); - } - break; - case 0xc: - local_8 = GHIDRA_CAST(0x24d); - } - manager = g_manager; - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - isLoop = 0; -LAB_0096fc15: - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),1.0,2,isLoop,1.0,0.0); -switchD_0096f8c9_caseD_4: - return; -} - -// 0096fc70 -Vector * Entity_Laser::calc_end_point(Vector *outEndPoint, Vector *start, Vector *direction) -{ - float margin; - uint32_t tearFlagsWord0; - uint32_t tearFlagsWord2; - - margin = 20.0; - tearFlagsWord0 = GHIDRA_UINT((this->_tearFlags)._l); - tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h); - if (((tearFlagsWord0 & GHIDRA_UINT(g_tearFlagContinuum._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagContinuum._l)) + 0x4)))) != 0) || - ((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagContinuum._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagContinuum._h)) + 0x4)))) != 0)) { - margin = 140.0; - } - if (((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) >> 0xf & 1) != 0) || - (this->_variant == 5)) { - if (((tearFlagsWord0 & GHIDRA_UINT(g_tearFlagOccult._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._l)) + 0x4)))) == 0) && - ((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagOccult._h)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._h)) + 0x4)))) == 0)) { - margin = INFINITY; - } - else { - margin = 100.0; - } - } - CalculateEndPoint(outEndPoint,start,direction,&this->_posOffset,GHIDRA_CAST(this->_parent),margin); - return outEndPoint; -} - -// 009704a0 -void Entity_Laser::update_first_frame() -{ - Entity_Laser *room = this; - uint8_t isCircleLaser; - int gridX; - uint32_t gridCollision; - Vector *pVVar1; - Vector *clampedOffset; - int unused; - Entity_Laser *this_00; - void *gridEntity; - float *endPointSrc; - uint32_t index; - float fVar2; - float fVar3; - float fVar4; - uint8_t auVar5 [12]; - float fVar6; - float fVar7; - float fVar8; - float fVar9; - float fVar10; - float rayT; - int cellX; - int gridY; - int cellY; - float rayX; - float rayY; - Vector local_30; - float hitX; - float hitY; - Vector local_20; - uint8_t local_18 [8]; - uint32_t local_10; - uint32_t local_c; - int parent; - Room *room; - int stepY; - - PlayInitSound(room); - fVar6 = room->_angleDegrees * 0.017453292; - if (room->_variant == 4) { - (room->_sprite)._rotation = room->_angleDegrees; - room->_laserLength = 300.0; - fVar2 = cos(fVar6); - fVar10 = (room->_pos).x; - fVar8 = (room->_posOffset).x; - fVar3 = sin(fVar6); - fVar6 = (room->_posOffset).y; - fVar9 = (room->_pos).y; - (room->_endPoint).x = fVar2 * 300.0 + fVar10 + fVar8; - (room->_endPoint).y = fVar3 * 300.0 + fVar6 + fVar9; - room->_sampleLaser = 0; - return; - } - local_30.x = cos(fVar6); - local_30.y = sin(fVar6); - if (ABS(local_30.x) < 0.0001) { - local_30.x = 0.0; - } - if (ABS(local_30.y) < 0.0001) { - local_30.y = 0.0; - } - (room->_sprite)._flipX = (uint8_t)(GHIDRA_UINT(room->_initSeed) >> 8) & 1; - ResetSpriteScale(room); - spawn_impact_effect(room,unused); - isCircleLaser = room->_sampleLaser; - if ((char)isCircleLaser < '\0') { - parent = room->_parent; - if (parent == 0) { -LAB_00970730: - isCircleLaser = 0; - } - else { - stepY = *GHIDRA_CAST((parent + 0x28)); - if (((stepY != 1) && (room->_spawnerType != 1)) && (stepY != 0x3e)) { - if (stepY == 1000) { - if (*GHIDRA_CAST((parent + 0x2c)) != 0xb2) goto LAB_009706c5; - } - else if (((stepY != 0x107) && (stepY != 0x10c)) && (stepY != 0x19a)) { - if (stepY == 0x104) { - if (*GHIDRA_CAST((parent + 0x30)) != 2) { -LAB_009706c5: - if ((room->_isActiveRotating == 0) && - (isCircleLaser = IsCircleLaser(room), isCircleLaser == 0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x0))) = GHIDRA_UINT((room->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagOccult._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x4))) = - *GHIDRA_CAST((GHIDRA_INT(&(room->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._l)) + 0x4))); - local_10 = GHIDRA_UINT((room->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagOccult._h); - local_c = *GHIDRA_CAST((GHIDRA_INT(&(room->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._h)) + 0x4))); - isCircleLaser = (GHIDRA_CAST((GHIDRA_CAST(local_18))))->BitSet128::IsNonZero(); - if (isCircleLaser == 0) goto LAB_00970730; - } - } - } - else { - if (stepY != 3) goto LAB_009706c5; - if ((*GHIDRA_CAST((parent + 0x2c)) != 0x50) && (*GHIDRA_CAST((parent + 0x2c)) != 0x78)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x0))) = GHIDRA_UINT((room->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagHoming._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x4))) = - *GHIDRA_CAST((GHIDRA_INT(&(room->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); - local_10 = GHIDRA_UINT((room->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagHoming._h); - local_c = *GHIDRA_CAST((GHIDRA_INT(&(room->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); - isCircleLaser = (GHIDRA_CAST((GHIDRA_CAST(local_18))))->BitSet128::IsNonZero(); - if (isCircleLaser == 0) goto LAB_009706c5; - } - } - } - } - if (room->_variant == 7) goto LAB_00970730; - isCircleLaser = 1; - } - room->_sampleLaser = isCircleLaser; - } - if (isCircleLaser != 0) { - ClearLaserSamples(room); - parent = room->_subtype; - if (((parent == 1) || (parent == 2)) || (room = this_00, parent == 3)) { - UpdateHits(this_00); - return; - } - goto LAB_00970ca5; - } - fVar10 = (room->_posOffset).x + (room->_pos).x; - fVar6 = (room->_posOffset).y + (room->_pos).y; - local_20.x = fVar10; - local_20.y = fVar6; - if (room->_entityGridCollisionClass == 6) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x0))) = local_30.x * 10000.0 + fVar10; - fVar9 = fVar10 - local_30.x * 4.0; - room = g_game->_room; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x4))) = local_30.y * 10000.0 + fVar6; - fVar8 = fVar6 - local_30.y * 4.0; - hitX = fVar9; - fVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_18)) + 0x0))) - fVar9; - fVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_18)) + 0x4))) - fVar8; - hitY = fVar8; - gridX = GHIDRA_INT(((fVar9 - 40.0) / 40.0 + 0.5)); - gridY = GHIDRA_INT(((fVar8 - 120.0) / 40.0 + 0.5)); - parent = GHIDRA_UINT((0.0 < fVar3)) * 2 + -1; - rayT = 0.0; - stepY = GHIDRA_UINT((0.0 < fVar2)) * 2 + -1; - if ((fVar3 != g_vectorZero.x) || (fVar7 = 0.0, fVar2 != g_vectorZero.y)) { - cellY = gridY * 0x28; - cellX = gridX * 0x28; - rayX = fVar9; - rayY = fVar8; - do { - hitX = rayX; - hitY = rayY; - if (((gridX < 0) || (room->_gridWidth <= gridX)) || - ((gridY < 0 || (room->_gridHeight <= gridY)))) { - gridCollision = (GHIDRA_CAST((room)))->Room::GetGridCollision(-1); -LAB_0097095e: - gridEntity = (void *)0x0; - } - else { - index = gridY * room->_gridWidth + gridX; - gridCollision = (GHIDRA_CAST((room)))->Room::GetGridCollision(index); - if (0x1bf < index) goto LAB_0097095e; - gridEntity = room->_gridEntities[index]; - } - if (((((gridCollision == 2) || (gridCollision == 3)) || (gridCollision == 4)) || - (gridCollision == 5)) && - ((fVar7 = rayT, gridEntity == (void *)0x0 || - ((*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)) != 0xf && (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)) != 0x10)))))) - break; - if (fVar3 == 0.0) { - fVar7 = INFINITY; - } - else { - fVar7 = ((float)(cellX + (parent * 5 + 10) * 4) - rayX) / fVar3; - } - if (fVar2 == 0.0) { - fVar4 = INFINITY; - } - else { - fVar4 = ((float)(cellY + (stepY * 5 + 0x1e) * 4) - rayY) / fVar2; - } - if (fVar4 <= fVar7) { - gridY = gridY + stepY; - cellY = cellY + stepY * 0x28; - } - else { - gridX = gridX + parent; - cellX = cellX + parent * 0x28; - fVar4 = fVar7; - } - rayT = fVar4 + rayT; - rayY = fVar2 * rayT + fVar8; - rayX = fVar3 * rayT + fVar9; - hitY = rayY; - hitX = rayX; - fVar7 = rayT; - } while (rayT < 1.0); - } - if (&room->_endPoint != GHIDRA_CAST(0x0)) { - endPointSrc = GHIDRA_CAST(local_18); - if (fVar7 < 1.0) { - endPointSrc = &hitX; - } - (room->_endPoint).x = *endPointSrc; - (room->_endPoint).y = endPointSrc[1]; - } - if (1.0 <= fVar7) { - pVVar1 = calc_end_point(room,GHIDRA_CAST(local_18),&local_20,&local_30); - fVar9 = (room->_posOffset).x + pVVar1->x; - fVar8 = (room->_posOffset).y + pVVar1->y; -LAB_00970af5: - (room->_endPoint).x = fVar9; - (room->_endPoint).y = fVar8; - } - } - else { - if (room->_entityGridCollisionClass == 3) { - pVVar1 = calc_end_point(room,GHIDRA_CAST(local_18),&local_20,&local_30); - fVar9 = (room->_posOffset).x + pVVar1->x; - fVar8 = (room->_posOffset).y + pVVar1->y; - goto LAB_00970af5; - } - (room->_endPoint).x = local_30.x * 1000.0 + fVar10; - (room->_endPoint).y = local_30.y * 1000.0 + fVar6; - } - pVVar1 = &room->_endPoint; - fVar8 = room->_maxDistance; - if (0.0 < fVar8) { - fVar9 = (room->_endPoint).y; - fVar2 = fVar10 - pVVar1->x; - fVar3 = fVar6 - fVar9; - if (fVar8 * fVar8 < fVar3 * fVar3 + fVar2 * fVar2) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x0))) = pVVar1->x - fVar10; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_18)) + 0x4))) = fVar9 - fVar6; - clampedOffset = (GHIDRA_CAST((GHIDRA_CAST(local_18))))->Vector::Resized(&local_20,fVar8); - fVar8 = clampedOffset->y; - pVVar1->x = fVar10 + clampedOffset->x; - (room->_endPoint).y = fVar6 + fVar8; - } - } - fVar10 = pVVar1->x - fVar10; - fVar6 = (room->_endPoint).y - fVar6; - fVar6 = sqrtf(fVar6 * fVar6 + fVar10 * fVar10); - room->_laserLength = fVar6; - if ((room->_variant == 6) || (room->_variant == 0xf)) { - if (room->_spawnerType == 0x19a) { - auVar5 = ZEXT812(0x42b00000); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar5)) + 0x0))) <= fVar6) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar5)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar5)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar5)) + 0x0))) = fVar6; - } - room->_laserLength = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar5)) + 0x0))); - } - else { - room->_laserLength = fVar6 + 100.0; - } - } - (room->_sprite)._rotation = room->_angleDegrees - 90.0; -LAB_00970ca5: - update_laser(room); - return; -} - -// 00970cb0 -void Entity_Laser::find_nearest_grid_hit(int unusedFlag, Vector *offset) -{ - uint8_t isInRoom; - BitSet128 *maskedFlags; - Room *extraout_ECX; - Room *extraout_ECX_00; - Room *extraout_ECX_01; - Room *extraout_ECX_02; - Room *extraout_ECX_03; - Room *pRVar1; - Room *extraout_ECX_04; - void *pvVar2; - int iVar3; - uint32_t uVar4; - Room *node; - float dirY; - float relY; - float relX; - float alongDistance; - float maxReach; - BitSet128 local_e0; - BitSet128 local_d0; - uint8_t local_bc [8]; - uint8_t local_b4 [8]; - int hitEntryLeft; - float local_a8; - float local_a4; - int hitEntryRight; - float local_9c; - float local_98; - Vector lastSamplePos; - uint32_t sampleCount; - float sideOffsetY; - float sideOffsetX; - float perpY; - Vector checkPos; - float lastInRoomDirY; - float lastInRoomDirX; - float lastInRoomY; - float lastInRoomX; - float lastInRoomDistance; - uint32_t sampleIndex; - float local_5c; - float prevSampleX; - Vector local_54; - float widthOffset; - float local_48; - float local_44; - Room *hitGridSet; - uint32_t local_3c; - float sampleY; - float sampleX; - float local_30; - float travelled; - float segmentDirX; - float segmentDirY; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - Game *game; - char isNil; - Room *nextNode; - int parent; - float *samples; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0ca6d; - local_1c = ExceptionList; - ExceptionList = &local_1c; - if (this->_sampleLaser != 0) { - hitGridSet = GHIDRA_CAST(0x0); - local_3c = 0; - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - hitGridSet = operator_new(0x1c); - *GHIDRA_CAST(hitGridSet) = hitGridSet; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((hitGridSet)) + 0x4)))) = hitGridSet; - hitGridSet->_roomType = GHIDRA_INT(hitGridSet); - *GHIDRA_CAST(&hitGridSet->_gridWidth) = 0x101; - local_14 = 0; - samples = (this->_homingLaser)._nonOptimizedSamples._begin; - uVar4 = GHIDRA_INT((this->_homingLaser)._nonOptimizedSamples._end) - GHIDRA_INT(samples) >> 3; - sampleCount = uVar4; - if (1 < uVar4) { - lastInRoomDirY = 0.0; - lastInRoomX = *samples + offset->x; - lastInRoomY = samples[1] + offset->y; - lastInRoomDirX = 0.0; - lastInRoomDistance = 0.0; - sampleIndex = 0; - travelled = 0.0; - prevSampleX = lastInRoomX; - local_30 = lastInRoomY; - do { - pvVar2 = (this->_homingLaser)._nonOptimizedSamples._begin; - if (sampleIndex < uVar4) { - sampleX = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8)) + offset->x; - sampleY = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8 + 4)) + offset->y; - if (sampleIndex < uVar4 - 1) { - segmentDirY = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8 + 0xc)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8 + 4)); - segmentDirX = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8 + 8)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8)); - } - else { - segmentDirY = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8 + 4)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8 + -4)); - segmentDirX = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + sampleIndex * 8 + -8)); - } - } - else { - segmentDirX = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -8)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -0x10)); - sampleX = (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -8)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -0x10))) + - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -8)) + offset->x; - sampleY = (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -4)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -0xc))) + - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -4)) + offset->y; - segmentDirY = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -4)) - - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar4 * 8 + -0xc)); - } - local_54.x = sampleX; - local_54.y = sampleY; - local_5c = sqrtf(segmentDirX * segmentDirX + segmentDirY * segmentDirY); - segmentDirY = segmentDirY / local_5c; - segmentDirX = segmentDirX / local_5c; - perpY = -segmentDirX; - isInRoom = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&local_54,0.0); - if (isInRoom != 0) { - lastInRoomDistance = travelled; - lastInRoomX = sampleX; - lastInRoomY = sampleY; - lastInRoomDirX = segmentDirX; - lastInRoomDirY = segmentDirY; - } - widthOffset = 0.0; - pRVar1 = extraout_ECX; - if (0.0 < this->_size) { - do { - game = g_game; - sideOffsetX = segmentDirY * widthOffset; - sideOffsetY = perpY * widthOffset; - checkPos.x = sampleX + sideOffsetX; - checkPos.y = sideOffsetY + sampleY; - local_48 = checkPos.x; - local_44 = checkPos.y; - isInRoom = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&checkPos,-8.0); - if (isInRoom == 0) { - maskedFlags = BitSet128::operator_and - (&local_d0,&this->_tearFlags,&g_tearFlagContinuum); - pRVar1 = GHIDRA_CAST((GHIDRA_UINT(maskedFlags->_l) | *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)))); - if ((pRVar1 != GHIDRA_CAST(0x0)) || - (pRVar1 = GHIDRA_CAST((GHIDRA_UINT(maskedFlags->_h) | *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)))), - pRVar1 != GHIDRA_CAST(0x0))) { -LAB_00971074: - if (travelled < this->_impactDistance) { - this->_impactDistance = travelled; - (this->_impactPosition).x = prevSampleX; - (this->_impactPosition).y = local_30; - (this->_impactDirection).x = segmentDirX; - (this->_impactDirection).y = segmentDirY; - } - } - } - else { - pRVar1 = game->_room; - iVar3 = GHIDRA_INT(((local_48 - 40.0) / 40.0 + 0.5)); - parent = GHIDRA_INT(((local_44 - 120.0) / 40.0 + 0.5)); - if (((-1 < iVar3) && - (((iVar3 < pRVar1->_gridWidth && (-1 < parent)) && (parent < pRVar1->_gridHeight)) - )) && (iVar3 = pRVar1->_gridWidth * parent + iVar3, -1 < iVar3)) { - uVar4 = (GHIDRA_CAST((pRVar1)))->Room::GetGridCollision(iVar3); - pRVar1 = extraout_ECX_00; - if ((uVar4 != 1) && (uVar4 != 0)) { - local_9c = segmentDirX; - local_98 = segmentDirY; - hitEntryRight = iVar3; - msvc::set::insert(local_b4,&hitEntryRight); - pRVar1 = extraout_ECX_01; - goto LAB_00971074; - } - } - } - game = g_game; - if (widthOffset != 0.0) { - checkPos.x = sampleX - sideOffsetX; - checkPos.y = sampleY - sideOffsetY; - local_48 = checkPos.y; - local_44 = checkPos.x; - isInRoom = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&checkPos,-8.0); - if (isInRoom == 0) { - maskedFlags = BitSet128::operator_and - (&local_e0,&this->_tearFlags,&g_tearFlagContinuum); - pRVar1 = GHIDRA_CAST((GHIDRA_UINT(maskedFlags->_l) | *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)))); - if ((pRVar1 != GHIDRA_CAST(0x0)) || - (pRVar1 = GHIDRA_CAST((GHIDRA_UINT(maskedFlags->_h) | *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)))), - pRVar1 != GHIDRA_CAST(0x0))) { -LAB_009711e5: - if (travelled < this->_impactDistance) { - this->_impactDistance = travelled; - (this->_impactPosition).x = local_44; - (this->_impactPosition).y = local_48; - (this->_impactDirection).x = segmentDirX; - (this->_impactDirection).y = segmentDirY; - } - } - } - else { - pRVar1 = game->_room; - iVar3 = GHIDRA_INT(((local_44 - 40.0) / 40.0 + 0.5)); - parent = GHIDRA_INT(((local_48 - 120.0) / 40.0 + 0.5)); - if (((-1 < iVar3) && - (((iVar3 < pRVar1->_gridWidth && (-1 < parent)) && - (parent < pRVar1->_gridHeight)))) && - (iVar3 = pRVar1->_gridWidth * parent + iVar3, -1 < iVar3)) { - uVar4 = (GHIDRA_CAST((pRVar1)))->Room::GetGridCollision(iVar3); - pRVar1 = extraout_ECX_02; - if ((uVar4 != 1) && (uVar4 != 0)) { - local_a8 = segmentDirX; - local_a4 = segmentDirY; - hitEntryLeft = iVar3; - msvc::set::insert(local_bc,&hitEntryLeft); - pRVar1 = extraout_ECX_03; - goto LAB_009711e5; - } - } - } - } - widthOffset = widthOffset + 20.0; - } while (widthOffset < this->_size); - uVar4 = sampleCount; - } - travelled = travelled + local_5c; - sampleIndex = sampleIndex + 1; - prevSampleX = sampleX; - lastSamplePos.x = sampleX; - local_30 = sampleY; - lastSamplePos.y = sampleY; - } while (sampleIndex <= uVar4); - node = *GHIDRA_CAST(hitGridSet); - if (node != hitGridSet) { - do { - damage_grid_entity(this,node->_gridHeight,GHIDRA_INT(pRVar1),&node->_topLeftPos); - pRVar1 = GHIDRA_CAST(node->_roomType); - if (*GHIDRA_CAST((GHIDRA_INT(&pRVar1->_gridWidth) + 1)) == '\0') { - isNil = *GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST(pRVar1))->_gridWidth) + 1)); - node = pRVar1; - pRVar1 = *GHIDRA_CAST(pRVar1); - while (isNil == '\0') { - isNil = *GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST(pRVar1))->_gridWidth) + 1)); - node = pRVar1; - pRVar1 = *GHIDRA_CAST(pRVar1); - } - } - else { - isNil = *GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((node)) + 0x4)))))->_gridWidth) + 1)); - nextNode = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((node)) + 0x4)))); - pRVar1 = node; - while ((node = nextNode, isNil == '\0' && (pRVar1 == GHIDRA_CAST(node->_roomType)))) { - isNil = *GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((node)) + 0x4)))))->_gridWidth) + 1)); - nextNode = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((node)) + 0x4)))); - pRVar1 = node; - } - pRVar1 = extraout_ECX_04; - } - } while (node != hitGridSet); - } - isInRoom = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&lastSamplePos,0.0); - if ((((isInRoom == 0) && (lastInRoomDistance < this->_impactDistance)) && - (parent = this->_subtype, parent != 1)) && ((parent != 2 && (parent != 3)))) { - (this->_impactDirection).x = lastInRoomDirX; - this->_impactDistance = lastInRoomDistance; - (this->_impactPosition).x = lastInRoomX; - (this->_impactPosition).y = lastInRoomY; - (this->_impactDirection).y = lastInRoomDirY; - } - } - FID_conflict__Erase_tree_>_> - (&hitGridSet,(fuzzer_allocator_> *)&hitGridSet, - *(_Tree_node **)&(*GHIDRA_CAST((GHIDRA_CAST((hitGridSet)) + 0x4)))); - operator_delete(hitGridSet,0x1c); - ExceptionList = local_1c; - return; - } - local_5c = this->_angleDegrees * 0.017453292; - local_54.x = cos(local_5c); - dirY = sin(local_5c); - parent = this->_parent; - if (parent != 0) { - iVar3 = *GHIDRA_CAST((parent + 0x28)); - if (iVar3 == 2) { - parent = *GHIDRA_CAST((parent + 0x34)); - } - else { - if (iVar3 != 1000) { - if ((iVar3 == 1) || (iVar3 == 3)) goto LAB_0097143e; - goto LAB_0097142d; - } - parent = *GHIDRA_CAST((parent + 0x34)); - } - if (parent == 1) goto LAB_0097143e; - } -LAB_0097142d: - if ((this->_spawnerType != 1) && (this->_spawnerType != 3)) { - ExceptionList = local_1c; - return; - } -LAB_0097143e: - uVar4 = 0; - pvVar2 = g_game->_room; - if (0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc))) { - local_30 = 5.04467e-44; - local_54.y = dirY; - do { - if ((uVar4 < 0x1c0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + GHIDRA_INT(local_30))) != 0)) { - relX = (((float)(GHIDRA_INT(uVar4) % *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc))) * 40.0 + 40.0) - (this->_pos).x) - + offset->x; - relY = (((float)(GHIDRA_INT(uVar4) / *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc))) * 40.0 + 120.0) - (this->_pos).y) - + offset->y; - if (0.0 < this->_maxDistance) { - maxReach = this->_size + this->_maxDistance; - } - else { - maxReach = INFINITY; - } - alongDistance = relY * dirY + relX * local_54.x; - if (((ABS(relY * local_54.x + relX * dirY) < this->_size + 15.0) && (0.0 < alongDistance)) - && (alongDistance <= maxReach)) { - damage_grid_entity(this,uVar4,GHIDRA_INT(offset),&local_54); - dirY = local_54.y; - } - } - uVar4 = uVar4 + 1; - local_30 = (float)(GHIDRA_INT(local_30) + 4); - pvVar2 = g_game->_room; - } while (GHIDRA_INT(uVar4) < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc))); - } - ExceptionList = local_1c; - return; -} - -// 00971590 -uint8_t Entity_Laser::damage_grid_entity(int gridIndex, int unused, Vector *direction) -{ - Entity_Laser *gridEntity = this; - Entity_Player *source; - uint8_t isBreakFlagSet; - char cVar1; - uint32_t rngResult; - TearParams *pTVar2; - BitSet128 *pBVar3; - Vector *gridPos; - int iVar4; - Entity_Player *room; - EntityRef laserRef; - uint8_t breakFlagMask [8]; - Vector bridgePos; - uint8_t matchedFlags [8]; - Vector cardinalDir; - uint8_t tearFlagsLow [8]; - Vector VStack_80; - TearParams tearParams; - uint32_t local_c; - uint8_t auStack_8 [4]; - GridEntity *gridEntity; - code *gridVfunc; - Room *room; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - if ((0x1bf < GHIDRA_UINT(gridIndex)) || - (gridEntity = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + gridIndex * 4 + 0x24)), - gridEntity == GHIDRA_CAST(0x0))) { - return 0; - } - if ((gridEntity->_collisionClass == 1) || (gridEntity->_collisionClass == 0)) goto LAB_009717bb; - rngResult = Random(); - if ((rngResult & 3) != 0) goto LAB_009717bb; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLow)) + 0x0))) = SUB84((gridEntity->_tearFlags)._l,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLow)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(gridEntity->_tearFlags)._l) + 4)); - VStack_80.x = *GHIDRA_CAST(&(gridEntity->_tearFlags)._h); - VStack_80.y = *GHIDRA_CAST((GHIDRA_INT(&(gridEntity->_tearFlags)._h) + 4)); - source = GHIDRA_CAST(gridEntity->_spawnerEntity); - if (source != GHIDRA_CAST(0x0)) { - if (source->_type == 1) { - room = source; - } - else if ((((source == GHIDRA_CAST(0x0)) || (source->_type != 3)) || - (source->_variant != 0x50)) || - (room = *GHIDRA_CAST(&source->_isControlsEnabled), - room == GHIDRA_CAST(0x0))) goto LAB_00971660; - pTVar2 = Entity_Player::GetTearHitParams(room,&tearParams,3,1.0,0,GHIDRA_CAST(source)); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLow)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLow)) + 0x0))) | GHIDRA_UINT((pTVar2->_flags)._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLow)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLow)) + 0x4))) | *GHIDRA_CAST((GHIDRA_INT(&(pTVar2->_flags)._l) + 4)); - VStack_80.x = (float)(GHIDRA_UINT(VStack_80.x) | GHIDRA_UINT((pTVar2->_flags)._h)); - VStack_80.y = (float)(GHIDRA_UINT(VStack_80.y) | *GHIDRA_CAST((GHIDRA_INT(&(pTVar2->_flags)._h) + 4))); - } -LAB_00971660: - pBVar3 = BitSet128::operator_or(GHIDRA_CAST(breakFlagMask),&g_tearFlagAcid,&g_tearFlagRock); - pBVar3 = BitSet128::operator_and(GHIDRA_CAST(matchedFlags),GHIDRA_CAST(tearFlagsLow),pBVar3); - isBreakFlagSet = (GHIDRA_CAST((pBVar3)))->BitSet128::IsNonZero(); - if (isBreakFlagSet != 0) { - cVar1 = gridEntity->CanTakeDamageFromTearEffects(); - if (cVar1 != '\0') { - gridVfunc = *(code **)(*GHIDRA_CAST(gridEntity) + 0x14); - (GHIDRA_CAST((&laserRef)))->EntityRef::constructor(GHIDRA_CAST(gridEntity)); - cVar1 = (*gridVfunc)(0,&laserRef); - if (cVar1 != '\0') { - Vector::ToCardinal(&cardinalDir,direction); - if ((cardinalDir.x != g_vectorZero.x) || (cardinalDir.y != g_vectorZero.y)) { - gridPos = (GHIDRA_CAST((gridEntity)))->GridEntity::Position(&VStack_80); - bridgePos.x = cardinalDir.x * 40.0 + gridPos->x; - bridgePos.y = cardinalDir.y * 40.0 + gridPos->y; - room = g_game->_room; - iVar4 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&bridgePos); - if (-1 < iVar4) { - if (iVar4 < 0x1c0) { - (GHIDRA_CAST((room)))->Room::TryMakeBridge(room->_gridEntities[iVar4],gridEntity); - return 1; - } - (GHIDRA_CAST((room)))->Room::TryMakeBridge(GHIDRA_CAST(0x0),gridEntity); - } - } - return 1; - } - } - } -LAB_009717bb: - gridVfunc = *(code **)(*GHIDRA_CAST(gridEntity) + 0x10); - (GHIDRA_CAST((&laserRef)))->EntityRef::constructor(GHIDRA_CAST(gridEntity)); - isBreakFlagSet = (*gridVfunc)(1,&laserRef); - return isBreakFlagSet; -} - -// 00971810 -void Entity_Laser::update_line_hits() -{ - float fVar1; - int iVar2; - BitSet128 flags; - uint8_t bVar3; - BitSet128 *maskedFlags; - uint32_t rngResult; - int *impactEffect; - void *pvVar4; - LayerState *layer; - uint32_t rngValue; - int extraout_ECX; - Entity_Tear *extraout_EDX; - float *extraout_EDX_00; - float *extraout_EDX_01; - Entity_Laser *extraout_EDX_02; - Entity_Laser *laserRef; - float *candidatesCursor; - float *candidateIt; - bool bVar5; - float in_XMM0_Da; - float fVar6; - Vector *pVVar7; - Vector *pVVar8; - Vector *in_XMM1_Da; - Entity_Tear *pEVar9; - Entity *pEVar10; - Entity_Tear *pEVar11; - float fVar12; - float fVar13; - BitSet128 *b; - BitSet128 *b_00; - uint32_t uVar14; - TypeDescriptor *pTVar15; - BitSet128 *b_01; - TypeDescriptor *pTVar16; - uint32_t uVar17; - BitSet128 *pBVar18; - BitSet128 *b_02; - BitSet128 keptFlagsMask; - BitSet128 stickyBoogerMask; - BitSet128 creepFlagTest; - BitSet128 shrinkFlagTest; - BitSet128 growFlagTest; - BitSet128 splitMask; - BitSet128 excludedFlagsMask; - BitSet128 splitHydroMask; - BitSet128 splitAbsorbMask; - BitSet128 splitBoneMask; - BitSet128 splitLudoMask; - BitSet128 sporeFlagTest; - BitSet128 boogerFlagTest; - BitSet128 fluidFlagTest; - BitSet128 stickyBoogerSporeMask; - BitSet128 knockbackFlagTest; - BitSet128 flagResult; - Vector candidatePosX; - Vector splashPos; - Vector splashVelocity; - Vector tearSpawnPos; - Vector clampedImpactPos; - Color scratchColor; - Vector local_104; - Vector local_fc; - Vector impactPos; - Vector scratchPoint; - Vector *local_e4; - float local_e0; - float local_dc; - float local_d8; - Entity *local_d4; - float *local_d0; - float *candidates; - float *candidatesEnd; - float *candidatesCapacity; - BitSet128 *tearFlags; - float local_bc; - float local_b8; - char isHitsProjectiles; - Entity_Tear *local_b0; - ColorMod *local_ac; - void *local_a8; - ColorMod *local_a4; - Entity *local_a0; - Vector *local_9c; - Entity_Tear *local_98; - Entity_Tear *local_94; - Entity_Tear *local_90; - Entity_Laser *laser; - Entity_Tear *local_88; - ColorMod splashColor; - Color scratchColor2; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - float local_14; - Entity *candidateEntity; - int laserParent; - float *samplePoint; - float targetFriction; - - puStack_20 = GHIDRA_CAST(((&scratchColor2)[1]._offset + 2)); - local_14 = -NAN; - puStack_18 = &LAB_00b0caa0; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT(((&scratchColor2)[1]._colorize + 3)); - ExceptionList = &local_1c; - laser = this; - if (this->_sampleLaser == 0) { - local_ac = GHIDRA_CAST((this->_angleDegrees * 0.017453292)); - local_9c = GHIDRA_CAST(cos((float)local_ac)); - local_90 = GHIDRA_CAST(sin((float)local_ac)); - local_a0 = GHIDRA_CAST(0x0); - local_a8 = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(local_a8) + 0x1264)) != 0) { - do { - pEVar10 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_a8) + 0x125c)) + GHIDRA_INT(local_a0) * 4)); - bVar3 = CanDamageEntity(this,pEVar10); - if (bVar3 != 0) { - fVar12 = (pEVar10->_pos).x - (this->_pos).x; - fVar6 = (pEVar10->_pos).y - (this->_pos).y; - fVar13 = pEVar10->_size + this->_size; - local_88 = GHIDRA_CAST(((float)local_90 * fVar6 + (float)local_9c * fVar12)); - local_ac = GHIDRA_CAST(ABS((float)local_90 * fVar12 - (float)local_9c * fVar6)); - if (this->_variant == 4) { - fVar13 = sqrtf(fVar6 * fVar6 + fVar12 * fVar12); - fVar13 = fVar13 * 0.1; - } - if ((float)local_ac < fVar13) { - if (0.0 < (float)local_88) { - if ((float)local_88 < ABS((this->_posOffset).y) + this->_laserLength) { - damage_entity(this,pEVar10); - pEVar9 = local_90; - pVVar7 = local_9c; - if ((pEVar10->_flags & 0x4000000) == 0) { - laserParent = pEVar10->_type; - if ((laserParent == 1) && (this->_spawnerEntity != 0)) { - if ((*GHIDRA_CAST((this->_spawnerEntity + 0x168)) & 0x20000000) != 0) - goto LAB_00973251; - laserParent = 1; - } -LAB_009736b9: - fVar13 = pEVar10->_mass; - fVar6 = 0.0; - pEVar11 = local_90; - pVVar8 = local_9c; - if (0.0 < fVar13) { - pVVar8 = GHIDRA_CAST(((float)local_9c / fVar13)); - pEVar11 = GHIDRA_CAST(((float)local_90 / fVar13)); - } - fVar13 = this->_mass * 1.8000001; - fVar12 = fVar13 * (float)pEVar11; - fVar13 = fVar13 * (float)pVVar8; - if ((laserParent == 1) || (laserParent == 3)) { - fVar13 = fVar13 * 0.2; - fVar12 = fVar12 * 0.2; - } - maskedFlags = BitSet128::operator_and - (&knockbackFlagTest,&this->_tearFlags,&g_tearFlagKnockback - ); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - fVar13 = fVar13 + fVar13; - fVar12 = fVar12 + fVar12; - } - targetFriction = pEVar10->_friction; - if (targetFriction != fVar6) { - fVar6 = pEVar10->_speedMultiplier; - (pEVar10->_velocity).x = - (fVar13 * fVar6) / targetFriction + (pEVar10->_velocity).x; - (pEVar10->_velocity).y = - (fVar12 * fVar6) / targetFriction + (pEVar10->_velocity).y; - } - } - else if (((pEVar10->_type == 4) && (this->_spawnerEntity != 0)) && - (laserParent = 4, *GHIDRA_CAST((this->_spawnerEntity + 0x28)) == 1)) - goto LAB_009736b9; -LAB_00973251: - bVar3 = is_thick_variant(this); - if (bVar3 != 0) { - fVar13 = (float)local_88 * (float)pVVar7; - local_88 = GHIDRA_CAST(((float)local_88 * (float)pEVar9 + (this->_pos).y)); - local_e0 = -(float)pVVar7; - local_d4 = GHIDRA_CAST((fVar13 + (this->_pos).x)); - fVar13 = this->_size; - local_bc = ((pEVar10->_pos).y - (float)local_88) * (float)pEVar9 + - ((pEVar10->_pos).x - (float)local_d4) * (float)pVVar7; - local_b8 = local_bc + pEVar10->_size; - local_bc = local_bc - pEVar10->_size; - if (local_bc <= -fVar13) { - local_bc = -fVar13; - } - if (fVar13 <= local_b8) { - local_b8 = fVar13; - } - if (local_bc + 2.0 < local_b8) { - pvVar4 = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - scratchColor._tint[0] = (this->_sprite)._color._tint[0]; - scratchColor._tint[1] = (this->_sprite)._color._tint[1]; - scratchColor._tint[2] = (this->_sprite)._color._tint[2]; - scratchColor._tint[3] = (this->_sprite)._color._tint[3]; - scratchColor._offset[2] = (this->_sprite)._color._offset[2]; - scratchColor._colorize[0] = (this->_sprite)._color._colorize[0]; - scratchColor._colorize[1] = (this->_sprite)._color._colorize[1]; - scratchColor._colorize[2] = (this->_sprite)._color._colorize[2]; - scratchColor._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(scratchColor._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - (GHIDRA_CAST((&scratchColor)))->Color::__mul(&layer->_color); - scratchColor2._tint[0] = scratchColor._tint[0]; - scratchColor2._tint[1] = scratchColor._tint[1]; - scratchColor2._tint[2] = scratchColor._tint[2]; - scratchColor2._tint[3] = scratchColor._tint[3]; - scratchColor2._offset[2] = scratchColor._offset[2]; - scratchColor2._colorize[0] = scratchColor._colorize[0]; - scratchColor2._colorize[1] = scratchColor._colorize[1]; - scratchColor2._colorize[2] = scratchColor._colorize[2]; - scratchColor2._colorize[3] = scratchColor._colorize[3]; - scratchColor2._offset[0] = scratchColor._offset[0]; - scratchColor2._offset[1] = scratchColor._offset[1]; - (GHIDRA_CAST((&scratchColor2)))->Color::__mul(GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x30))); - splashColor._offset[2] = scratchColor2._offset[2]; - splashColor._tint[0] = scratchColor2._tint[0]; - splashColor._tint[1] = scratchColor2._tint[1]; - splashColor._tint[2] = scratchColor2._tint[2]; - splashColor._tint[3] = scratchColor2._tint[3]; - splashColor._colorize[0] = scratchColor2._colorize[0]; - splashColor._colorize[1] = scratchColor2._colorize[1]; - splashColor._colorize[2] = scratchColor2._colorize[2]; - splashColor._colorize[3] = scratchColor2._colorize[3]; - splashColor._offset[0] = scratchColor2._offset[0]; - splashColor._offset[1] = scratchColor2._offset[1]; - local_d8 = (this->_posOffset).y; - rngResult = Random(); - fVar13 = (float)(rngResult & 3); - local_ac = GHIDRA_CAST(fVar13); - if (fVar13 != 0.0) { - local_b8 = local_b8 - local_bc; - local_a4 = GHIDRA_CAST(((float)local_9c * 3.0)); - local_dc = (float)local_90 * 3.0; - do { - rngResult = Random(); - rngValue = Random(); - local_d0 = GHIDRA_CAST(((float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)] - ) * 2.3283064e-10 * 6.0 + 4.0)); - rngValue = Random(); - fVar6 = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_ac = GHIDRA_CAST((fVar6 + fVar6)); - local_104.x = cos((float)local_ac); - local_104.x = local_104.x + (float)local_d0 * (float)local_9c; - local_104.y = sin((float)local_ac); - local_104.y = local_104.y + (float)local_d0 * (float)local_90; - rngValue = Random(); - local_ac = (ColorMod *) - (local_b8 * - (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10 + local_bc); - rngValue = Random(); - fVar6 = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10; - local_fc.x = (float)local_ac * (float)local_90 + (float)local_d4 + - (float)local_a4 * fVar6; - local_fc.y = (float)local_ac * local_e0 + (float)local_88 + local_dc * fVar6 - ; - pEVar10 = Game::Spawn(g_game,1000,99,&local_fc,&local_104,GHIDRA_CAST(0x0),1, - rngResult); - fVar6 = (pEVar10->_sprite)._scale.x; - fVar12 = (pEVar10->_sprite)._scale.y; - laserParent = *GHIDRA_CAST(pEVar10); - (pEVar10->_sprite)._scale.x = fVar6 + fVar6; - (pEVar10->_sprite)._scale.y = fVar12 + fVar12; - (**(code **)(laserParent + 0x3c))(&splashColor,0xffffffff,0xff,0,1); - (pEVar10->_posOffset).x = 0.0; - (pEVar10->_posOffset).y = local_d8; - pEVar10->Update(); - fVar13 = (float)(GHIDRA_INT(fVar13) - 1); - } while (fVar13 != 0.0); - this = laser; - } - } - } - } - } - } - } - local_a0 = GHIDRA_CAST((GHIDRA_INT(local_a0) + 1)); - } while (local_a0 < *GHIDRA_CAST((GHIDRA_CAST(local_a8) + 0x1264))); - } - } - else { - candidates = GHIDRA_CAST(0x0); - candidatesEnd = GHIDRA_CAST(0x0); - candidatesCapacity = GHIDRA_CAST(0x0); - local_14 = 0.0; - local_e4 = in_XMM1_Da; - puStack_20 = GHIDRA_CAST(((&scratchColor2)[1]._offset + 2)); - msvc::vector::_Reallocate(10); - tearFlags = &this->_tearFlags; - maskedFlags = BitSet128::operator_and(&flagResult,tearFlags,&g_tearFlagShielded); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (isHitsProjectiles = '\0', - GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - isHitsProjectiles = '\x01'; - } - local_b0 = GHIDRA_CAST(0x0); - local_a0 = g_game->_room; - candidatesCursor = candidatesEnd; - if (local_a0[4]._charmedCountdown != 0) { - do { - local_98 = *GHIDRA_CAST((local_a0[4]._poisonCountdown + GHIDRA_INT(local_b0) * 4)); - local_90 = local_98; - if (((local_98->_type == 1000) && - ((((laserParent = local_98->_variant, laserParent == 0x15 || (laserParent == 0x21)) || - (laserParent == 0x3f)) || ((laserParent == 0x40 || (laserParent == 0x9f)))))) || - (bVar3 = CanDamageEntity(this,GHIDRA_CAST(local_98)), bVar3 != 0)) { -joined_r0x00971bfa: - if (candidatesCursor == candidatesCapacity) { -LAB_0097195e: - msvc::vector::_Emplace_reallocate(candidatesCursor,&local_90); - local_98 = local_90; - candidatesCursor = candidatesEnd; - } - else { - *candidatesCursor = (float)local_98; - candidatesCursor = candidatesCursor + 1; - candidatesEnd = candidatesCursor; - } - } - else { - laserParent = local_98->_type; - if (laserParent == 4) { - laserParent = this->_parent; - if (laserParent == 0) { -LAB_00971b64: - if ((this->_spawnerType != 1) && (this->_spawnerType != 3)) { - laserParent = local_98->_type; - goto LAB_00971b90; - } - } - else { - iVar2 = *GHIDRA_CAST((laserParent + 0x28)); - if (iVar2 == 2) { - if (*GHIDRA_CAST((laserParent + 0x34)) == 1) goto LAB_00971b71; - goto LAB_00971b64; - } - if (iVar2 == 1000) { - if (*GHIDRA_CAST((laserParent + 0x34)) != 1) goto LAB_00971b64; - } - else if ((iVar2 != 1) && (iVar2 != 3)) goto LAB_00971b64; - } -LAB_00971b71: - if (candidatesCursor == candidatesCapacity) goto LAB_0097195e; - *candidatesCursor = (float)local_98; - candidatesCursor = candidatesCursor + 1; - candidatesEnd = candidatesCursor; - } - else { -LAB_00971b90: - if ((((isHitsProjectiles != '\0') && (laserParent == 9)) && - ((local_98->_waitFrames & 0x80000000U) == 0)) && - (((((laserParent = this->_subtype, laserParent == 1 || (laserParent == 2)) || - (laserParent == 3)) && (rngResult = Random(), rngResult % 0x32 == 0)) || - (rngResult = Random(), rngResult % 5 == 0)))) goto joined_r0x00971bfa; - } - } - maskedFlags = BitSet128::operator_and(&flagResult,&this->_tearFlags,&g_tearFlagAttractor); - if (((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - ((bVar3 = (GHIDRA_CAST((GHIDRA_CAST(local_98))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar3 != 0 || - (local_98->_type == 5)))) { - pEVar9 = local_98; - if ((local_98 == GHIDRA_CAST(0x0)) || (local_98->_type != 5)) { -LAB_009719f7: - local_bc = (float)((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))) >> 3) + -1); - local_b8 = 1e+06; - local_88 = GHIDRA_CAST(g_vectorZero.x); - local_94 = GHIDRA_CAST(g_vectorZero.y); - local_a8 = (void *)0x0; - if (local_bc != 0.0) { - scratchPoint.y = (pEVar9->_pos).y; - scratchPoint.x = (pEVar9->_pos).x; - local_9c = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))) + 8)); - do { - segment_project_point(&scratchPoint,local_9c + -1,local_9c,GHIDRA_CAST(&local_d0)); - fVar13 = 40000.0; - if ((40000.0 <= in_XMM0_Da) || (fVar13 = local_b8, local_b8 <= in_XMM0_Da)) { - } - else { - local_88 = (Entity_Tear *) - (((local_9c->x - *extraout_EDX_00) * (float)local_d0 + *extraout_EDX_00 - ) - (local_98->_pos).x); - local_94 = (Entity_Tear *) - (((local_9c->y - local_9c[-1].y) * (float)local_d0 + local_9c[-1].y) - - (local_98->_pos).y); - local_b8 = in_XMM0_Da; - } - in_XMM0_Da = fVar13; - if (((float)local_88 != g_vectorZero.x) || ((float)local_94 != g_vectorZero.y)) { - fVar13 = sqrtf((float)local_94 * (float)local_94 + - (float)local_88 * (float)local_88); - pEVar9 = local_88; - pEVar11 = local_94; - if (0.0 < fVar13) { - pEVar9 = GHIDRA_CAST(((float)local_88 * (1.0 / fVar13))); - pEVar11 = GHIDRA_CAST(((float)local_94 * (1.0 / fVar13))); - } - in_XMM0_Da = 0.0; - fVar6 = 10.0; - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (local_98->_type == 1)) || - ((9 < local_98->_type && (local_98->_type < 1000)))) { - fVar6 = 40.0; - } - if (10.0 <= fVar13) { - fVar12 = ((float)pEVar9 * fVar6) / fVar13; - fVar13 = ((float)pEVar11 * fVar6) / fVar13; - } - else { - fVar12 = (float)pEVar9 * fVar6 * (fVar13 / 100.0); - fVar13 = (float)pEVar11 * fVar6 * (fVar13 / 100.0); - } - fVar6 = local_98->_friction; - if (fVar6 != 0.0) { - in_XMM0_Da = local_98->_speedMultiplier; - (local_98->_velocity).y = - (fVar13 * in_XMM0_Da) / fVar6 + (local_98->_velocity).y; - (local_98->_velocity).x = - (fVar12 * in_XMM0_Da) / fVar6 + (local_98->_velocity).x; - } - break; - } - local_9c = local_9c + 1; - local_a8 = (void *)(GHIDRA_INT(local_a8) + 1); - } while (local_a8 < GHIDRA_UINT(local_bc)); - } - } - else if ((local_98->_tearHaloANM2)._numNullLayers == 0) { - bVar3 = Entity_Pickup::IsChest(local_98->_variant); - pEVar9 = extraout_EDX; - if ((bVar3 == 0) || (extraout_EDX->_subtype != 0)) goto LAB_009719f7; - } - } - local_b0 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_b0)) + 0x1)))); - } while (local_b0 < GHIDRA_CAST(local_a0[4]._charmedCountdown)); - } - local_d0 = candidates; - if (candidates != candidatesCursor) { - fVar13 = 0.0; - laserRef = laser; - candidateIt = candidates; - do { - local_88 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((laserRef->_homingLaser))) + 0x1c)))); - local_bc = (float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((laserRef->_homingLaser))) + 0x20)))) - GHIDRA_INT(local_88) >> 3); - local_9c = GHIDRA_CAST(0x0); - local_a4 = GHIDRA_CAST((GHIDRA_INT(local_bc) - 1)); - local_a8 = (void *)fVar13; - if (local_a4 != GHIDRA_CAST(0x0)) { - local_94 = GHIDRA_CAST(*candidateIt); - candidatePosX.x = (local_94->_pos).x; - candidatePosX.y = (local_94->_pos).y; - local_e0 = local_94->_size + laserRef->_size; - local_d0 = candidateIt; -LAB_00971e12: - scratchPoint.x = - *GHIDRA_CAST(((local_88->_sprite)._filename._buf + GHIDRA_INT(local_9c) * 8 + -0x40)); - pEVar9 = *GHIDRA_CAST(((local_88->_sprite)._filename._buf + GHIDRA_INT(local_9c) * 8 + -0x3c)) - ; - scratchPoint.y = (float)pEVar9; - local_98 = pEVar9; - local_90 = GHIDRA_CAST(scratchPoint.x); - bVar3 = IsCircleLaser(laserRef); - if (bVar3 == 0) { - if (local_9c == GHIDRA_CAST((GHIDRA_INT(local_bc) - 2U))) { - if (laser->_isGridHit == 0) { - pEVar9 = GHIDRA_CAST(0x0); - if (laser->_maxDistance <= 0.0) { - samplePoint = GHIDRA_CAST((GHIDRA_INT((&(local_88->_sprite)._filename + -3)) + - GHIDRA_INT(local_9c) * 8)); - local_a0 = GHIDRA_CAST(((float)local_98 - samplePoint[1])); - local_b0 = GHIDRA_CAST(((float)local_90 - *samplePoint)); - fVar13 = sqrtf((float)local_a0 * (float)local_a0 + - (float)local_b0 * (float)local_b0); - if (fVar13 <= 0.0) { - pEVar10 = local_a0; - scratchPoint.x = (float)local_b0; - } - else { - pEVar10 = GHIDRA_CAST(((40.0 / fVar13) * (float)local_a0)); - scratchPoint.x = (float)((40.0 / fVar13) * (float)local_b0); - } - scratchPoint.x = scratchPoint.x + (float)local_90; - pEVar9 = GHIDRA_CAST(((float)pEVar10 + (float)local_98)); - scratchPoint.y = (float)pEVar9; - local_98 = pEVar9; - local_90 = GHIDRA_CAST(scratchPoint.x); - } - } - } - } - segment_project_point - (&candidatePosX, - GHIDRA_CAST((GHIDRA_INT((&(local_88->_sprite)._filename + -3)) + GHIDRA_INT(local_9c) * 8)), - &scratchPoint,&local_b8); - local_b0 = pEVar9; - local_a0 = (Entity *) - sqrtf(((float)local_98 - extraout_EDX_01[1]) * - ((float)local_98 - extraout_EDX_01[1]) + - ((float)local_90 - *extraout_EDX_01) * - ((float)local_90 - *extraout_EDX_01)); - pEVar9 = local_b0; - if (local_9c == GHIDRA_CAST(0x0)) { - bVar3 = is_thick_variant(laser); - pEVar9 = local_b0; - if (bVar3 != 0) { - local_d8 = *GHIDRA_CAST((extraout_ECX + 0x41c)) * 0.017453292; - fVar13 = cos(local_d8); - local_dc = (local_94->_pos).x - (*GHIDRA_CAST(local_88) - fVar13 * 16.0); - fVar13 = sin(local_d8); - fVar13 = (local_94->_pos).y - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_88)) + 0x4)))) - fVar13 * 16.0); - pEVar11 = GHIDRA_CAST((fVar13 * fVar13 + local_dc * local_dc)); - pEVar9 = local_b0; - if ((float)pEVar11 < (float)local_b0) { - local_b8 = 0.0; - pEVar9 = pEVar11; - } - } - } - fVar13 = 0.0; - if (local_e0 * local_e0 <= (float)pEVar9) goto code_r0x0097207c; - if (local_94->_type == 9) { - local_94->_waitFrames = 0; - (local_94->_continueVelocity).x = 0.0; - local_94->_dead = 1; - goto LAB_00973070; - } - if (local_94->_type == 1000) { - local_94->_dead = 1; - goto LAB_00973070; - } - local_a4 = GHIDRA_CAST((local_94->_size * local_94->_size)); - fVar13 = sqrtf((float)pEVar9); - fVar13 = fVar13 - laser->_size; - fVar13 = fVar13 * fVar13; - if ((float)local_a4 <= fVar13) { - fVar13 = 0.0; - } - else { - fVar13 = sqrtf((float)local_a4 - fVar13); - } - samplePoint = GHIDRA_CAST((GHIDRA_INT((&(local_88->_sprite)._filename + -3)) + GHIDRA_INT(local_9c) * 8)); - pEVar10 = GHIDRA_CAST(((float)local_a0 * local_b8 + (float)local_a8)); - fVar6 = (float)local_a0 * local_b8 - fVar13; - local_90 = GHIDRA_CAST((((float)local_90 - *samplePoint) / (float)local_a0)); - fVar13 = (float)pEVar10 - fVar13; - local_98 = GHIDRA_CAST((((float)local_98 - samplePoint[1]) / (float)local_a0)); - pEVar9 = GHIDRA_CAST(((float)local_90 * fVar6 + *samplePoint)); - pEVar11 = GHIDRA_CAST(((float)local_98 * fVar6 + samplePoint[1])); - if (fVar13 < laser->_impactDistance) { - laser->_impactDistance = fVar13; - (laser->_impactPosition).x = (float)pEVar9; - (laser->_impactPosition).y = (float)pEVar11; - (laser->_impactDirection).x = (float)local_90; - (laser->_impactDirection).y = (float)local_98; - } - local_a0 = pEVar10; - local_94 = pEVar11; - local_88 = pEVar9; - maskedFlags = BitSet128::operator_and - (&creepFlagTest,tearFlags,&g_tearFlagMysteriousLiquidCreep); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - if (laser->_isFirstUpdate == 0) { - laserParent = (GHIDRA_CAST((GHIDRA_CAST(laser))))->Entity::GetIntervalTicks(4.0,0.0); - if (laserParent == 0) goto LAB_00972346; - pEVar9 = local_88; - pEVar11 = local_94; - } - impactPos.x = (float)pEVar9; - impactPos.y = (float)pEVar11; - Room::GetClampedPositionImpl - (g_game->_room,&clampedImpactPos,&impactPos,15.0,15.0,15.0,15.0); - impactPos.x = clampedImpactPos.x; - impactPos.y = clampedImpactPos.y; - rngResult = Random(); - uVar17 = 0; - pTVar16 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar15 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar14 = 0; - pEVar10 = Game::Spawn(g_game,1000,0x35,&impactPos,&g_vectorZero, - GHIDRA_CAST(laser->_spawnerEntity),0,rngResult); - impactEffect = GHIDRA_CAST(__RTDynamicCast(pEVar10,uVar14,pTVar15,pTVar16,uVar17)); - fVar13 = g_vectorOne.y * 0.4; - impactEffect[0x39] = GHIDRA_INT((g_vectorOne.x * 0.4)); - impactEffect[0x3a] = GHIDRA_INT(fVar13); - (**(code **)(*impactEffect + 0xc))(); - } -LAB_00972346: - fVar13 = *candidateIt; - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST((GHIDRA_CAST(fVar13) + 0x28)) != 1)) { - laserParent = *GHIDRA_CAST((GHIDRA_CAST(fVar13) + 0x28)); - if ((laserParent - 10U < 0x3de) && - (((laserParent != 0x21 && (laserParent != 0x11)) && (laserParent != 0x124)))) { - if (laserParent == 0x375) { - bVar5 = *GHIDRA_CAST((GHIDRA_CAST(fVar13) + 0x2c)) == 10; - } - else { - if ((laserParent == 0x3c0) || (laserParent == 0x3c5)) goto LAB_009726e0; - bVar5 = laserParent == 0xf5; - } - if (!bVar5) goto LAB_009723bd; - } - } - else { -LAB_009723bd: - if (*GHIDRA_CAST((GHIDRA_CAST(fVar13) + 0x173)) == '\0') { - pBVar18 = &g_tearFlagSpore; - maskedFlags = BitSet128::operator_or - (&stickyBoogerMask,&g_tearFlagSticky,&g_tearFlagBooger); - maskedFlags = BitSet128::operator_or(&stickyBoogerSporeMask,maskedFlags,pBVar18); - maskedFlags = BitSet128::operator_and(&fluidFlagTest,tearFlags,maskedFlags); - if (((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - ((laser->_isFirstUpdate != 0 || - (laserParent = (GHIDRA_CAST((GHIDRA_CAST(laser))))->Entity::GetIntervalTicks(4.0,0.0), laserParent != 0 - )))) { - local_94 = GHIDRA_CAST(((float)local_94 - *GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x340)))); - local_88 = GHIDRA_CAST(((float)local_88 - *GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x33c)))); - fVar13 = sqrtf((float)local_94 * (float)local_94 + (float)local_88 * (float)local_88 - ); - if ((*GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x370)) < fVar13) && (0.0 < fVar13)) { - fVar13 = *GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x370)) / fVar13; - local_88 = GHIDRA_CAST(((float)local_88 * fVar13)); - local_94 = GHIDRA_CAST(((float)local_94 * fVar13)); - } - maskedFlags = BitSet128::operator_and(&boogerFlagTest,tearFlags,&g_tearFlagBooger); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - maskedFlags = BitSet128::operator_and(&sporeFlagTest,tearFlags,&g_tearFlagSpore); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - local_a8 = (void *)0x13; - } - else { - local_a8 = (void *)0x30; - } - } - else { - local_a8 = (void *)0x1a; - } - b_02 = &g_tearFlagLasershot; - b_01 = &g_tearFlagHydrobounce; - b_00 = &g_tearFlagAbsorb; - b = &g_tearFlagBone; - pBVar18 = &g_tearFlagLudovico; - maskedFlags = BitSet128::operator_or - (&splitMask,&g_tearFlagQuadsplit,&g_tearFlagSplit); - maskedFlags = BitSet128::operator_or(&splitLudoMask,maskedFlags,pBVar18); - maskedFlags = BitSet128::operator_or(&splitBoneMask,maskedFlags,b); - maskedFlags = BitSet128::operator_or(&splitAbsorbMask,maskedFlags,b_00); - maskedFlags = BitSet128::operator_or(&splitHydroMask,maskedFlags,b_01); - maskedFlags = BitSet128::operator_or(&excludedFlagsMask,maskedFlags,b_02); - maskedFlags = (GHIDRA_CAST((maskedFlags)))->BitSet128::__bnot(&keptFlagsMask); - BitSet128::operator_and(&flagResult,tearFlags,maskedFlags); - rngResult = Random(); - tearSpawnPos.x = (float)local_88 + *GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x33c)); - tearSpawnPos.y = (float)local_94 + *GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x340)); - local_88 = (Entity_Tear *) - Game::Spawn(g_game,2,GHIDRA_UINT(local_a8),&tearSpawnPos,&g_vectorZero, - GHIDRA_CAST(laser->_spawnerEntity),0,rngResult); - local_88->Update(); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(flagResult._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (uint32_t)flagResult._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (uint32_t)flagResult._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(flagResult._h)) + 0x4))); - (GHIDRA_CAST((local_88)))->Entity_Tear::SetTearFlags(flags); - local_88->SetCollisionDamage(laser->_collisionDamage); - fVar13 = laser->_scale; - if (fVar13 <= 0.01) { - fVar13 = 0.01; - } - local_88->_baseScale = fVar13; - local_88->_fScale = fVar13; - (GHIDRA_CAST((local_88)))->Entity_Tear::ResetSpriteScale(); - local_a4 = GHIDRA_CAST(*candidateIt); - g_forceCollideDepth = g_forceCollideDepth + 1; - (**(code **)(GHIDRA_INT(*GHIDRA_CAST(local_88)) + 0x5c))(local_a4,1); - (**(code **)(*GHIDRA_CAST(local_a4) + 0x5c))(local_88,0); - g_forceCollideDepth = g_forceCollideDepth + -1; - } - } - } -LAB_009726e0: - local_a4 = GHIDRA_CAST(local_e4); - bVar3 = IsCircleLaser(laser); - if (bVar3 == 0) { - BitSet128::operator_and(&growFlagTest,tearFlags,&g_tearFlagGrow); - BitSet128::operator_and(&shrinkFlagTest,tearFlags,&g_tearFlagShrink); - } - damage_entity(laser,*candidateIt); - bVar3 = IsCircleLaser(laser); - if ((bVar3 == 0) || (laser->_subtype == 2)) { - pEVar10 = GHIDRA_CAST(*candidateIt); - if ((pEVar10->_flags & 0x4000000) != 0) { - if ((pEVar10->_type == 4) && (laser->_spawnerEntity != 0)) { - bVar5 = *GHIDRA_CAST((laser->_spawnerEntity + 0x28)) == 1; - goto LAB_00972846; - } - goto LAB_009729ca; - } - if ((pEVar10->_type == 1) && (laser->_spawnerEntity != 0)) { - bVar5 = (*GHIDRA_CAST((laser->_spawnerEntity + 0x168)) & 0x20000000) == 0; -LAB_00972846: - if (!bVar5) goto LAB_009729ca; - } - local_88 = local_90; - local_94 = local_98; - if (laser->_subtype == 2) { - local_88 = GHIDRA_CAST((laser->_velocity).x); - local_94 = GHIDRA_CAST((laser->_velocity).y); - fVar13 = sqrtf((float)local_88 * (float)local_88 + (float)local_94 * (float)local_94); - if (0.0 < fVar13) { - local_88 = GHIDRA_CAST(((float)local_88 * (1.0 / fVar13))); - local_94 = GHIDRA_CAST(((float)local_94 * (1.0 / fVar13))); - } - pEVar10 = GHIDRA_CAST(*candidateIt); - } - fVar6 = (GHIDRA_CAST((pEVar10)))->Entity::IsCollisionIgnored(GHIDRA_CAST(laser)); - fVar13 = 0.0; - pEVar11 = local_94; - pEVar9 = local_88; - if (0.0 < fVar6) { - pEVar9 = GHIDRA_CAST(((float)local_88 / fVar6)); - pEVar11 = GHIDRA_CAST(((float)local_94 / fVar6)); - } - fVar6 = laser->_mass * 1.8000001; - fVar12 = fVar6 * (float)pEVar11; - fVar6 = fVar6 * (float)pEVar9; - if ((*GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x28)) == 1) || - (*GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x28)) == 3)) { - fVar6 = fVar6 * 0.2; - fVar12 = fVar12 * 0.2; - } - maskedFlags = BitSet128::operator_and(&knockbackFlagTest,tearFlags,&g_tearFlagKnockback) - ; - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - fVar6 = fVar6 + fVar6; - fVar12 = fVar12 + fVar12; - } - candidateEntity = GHIDRA_CAST(*candidateIt); - targetFriction = candidateEntity->_friction; - if (targetFriction != fVar13) { - fVar1 = candidateEntity->_speedMultiplier; - (candidateEntity->_velocity).y = - (fVar1 * fVar12) / targetFriction + (candidateEntity->_velocity).y; - (candidateEntity->_velocity).x = - (fVar1 * fVar6) / targetFriction + (candidateEntity->_velocity).x; - } - } - else { -LAB_009729ca: - fVar13 = 0.0; - } - bVar3 = is_thick_variant(laser); - laserRef = extraout_EDX_02; - if (bVar3 != 0) { - laserParent = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((extraout_EDX_02->_homingLaser))) + 0x1c)))); - fVar6 = *candidateIt; - local_94 = GHIDRA_CAST(-(float)local_90); - pVVar7 = (Vector *) - ((*GHIDRA_CAST((laserParent + 0xc + GHIDRA_INT(local_9c) * 8)) - - *GHIDRA_CAST((laserParent + 4 + GHIDRA_INT(local_9c) * 8))) * local_b8 + - *GHIDRA_CAST((laserParent + 4 + GHIDRA_INT(local_9c) * 8))); - local_88 = (Entity_Tear *) - ((*GHIDRA_CAST((laserParent + 8 + GHIDRA_INT(local_9c) * 8)) - - *GHIDRA_CAST((laserParent + GHIDRA_INT(local_9c) * 8))) * local_b8 + - *GHIDRA_CAST((laserParent + GHIDRA_INT(local_9c) * 8))); - pEVar9 = GHIDRA_CAST(laser->_size); - fVar12 = (*GHIDRA_CAST((GHIDRA_CAST(fVar6) + 0x340)) - (float)pVVar7) * (float)local_94 + - (*GHIDRA_CAST((GHIDRA_CAST(fVar6) + 0x33c)) - (float)local_88) * (float)local_98; - local_a8 = (void *)(fVar12 - *GHIDRA_CAST((GHIDRA_CAST(fVar6) + 0x370))); - local_b0 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(fVar6) + 0x370)) + fVar12)); - if ((float)local_a8 <= -(float)pEVar9) { - local_a8 = (void *)-(float)pEVar9; - } - if ((float)pEVar9 <= (float)local_b0) { - local_b0 = pEVar9; - } - laserRef = laser; - local_9c = pVVar7; - if ((float)local_a8 + 2.0 < (float)local_b0) { - pvVar4 = AnimationState::GetLayerFrame(&(laser->_sprite)._animState,0); - local_a4 = GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x30)); - layer = ANM2::GetLayer(&laser->_sprite,GHIDRA_CAST(0x0)); - local_ac = &(laser->_sprite)._color; - scratchColor2._tint[0] = local_ac->_tint[0]; - scratchColor2._tint[1] = (laser->_sprite)._color._tint[1]; - scratchColor2._tint[2] = (laser->_sprite)._color._tint[2]; - scratchColor2._tint[3] = (laser->_sprite)._color._tint[3]; - scratchColor2._colorize[0] = (laser->_sprite)._color._colorize[0]; - scratchColor2._colorize[1] = (laser->_sprite)._color._colorize[1]; - scratchColor2._colorize[2] = (laser->_sprite)._color._colorize[2]; - scratchColor2._colorize[3] = (laser->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(scratchColor2._offset)) + 0x0))) = *GHIDRA_CAST((laser->_sprite)._color._offset); - scratchColor2._offset[2] = (laser->_sprite)._color._offset[2]; - (GHIDRA_CAST((&scratchColor2)))->Color::__mul(&layer->_color); - scratchColor._tint[0] = scratchColor2._tint[0]; - scratchColor._tint[1] = scratchColor2._tint[1]; - scratchColor._tint[2] = scratchColor2._tint[2]; - scratchColor._tint[3] = scratchColor2._tint[3]; - scratchColor._offset[2] = scratchColor2._offset[2]; - scratchColor._colorize[0] = scratchColor2._colorize[0]; - scratchColor._colorize[1] = scratchColor2._colorize[1]; - scratchColor._colorize[2] = scratchColor2._colorize[2]; - scratchColor._colorize[3] = scratchColor2._colorize[3]; - scratchColor._offset[0] = scratchColor2._offset[0]; - scratchColor._offset[1] = scratchColor2._offset[1]; - (GHIDRA_CAST((&scratchColor)))->Color::__mul(local_a4); - splashColor._offset[2] = scratchColor._offset[2]; - splashColor._tint[0] = scratchColor._tint[0]; - splashColor._tint[1] = scratchColor._tint[1]; - splashColor._tint[2] = scratchColor._tint[2]; - splashColor._tint[3] = scratchColor._tint[3]; - splashColor._colorize[0] = scratchColor._colorize[0]; - splashColor._colorize[1] = scratchColor._colorize[1]; - splashColor._colorize[2] = scratchColor._colorize[2]; - splashColor._colorize[3] = scratchColor._colorize[3]; - splashColor._offset[0] = scratchColor._offset[0]; - splashColor._offset[1] = scratchColor._offset[1]; - local_bc = (laser->_posOffset).y; - rngResult = Random(); - pVVar7 = GHIDRA_CAST((rngResult & 3)); - local_a4 = GHIDRA_CAST(pVVar7); - if (pVVar7 != GHIDRA_CAST(0x0)) { - local_e0 = (float)local_b0 - (float)local_a8; - local_dc = (float)local_90 * 3.0; - local_d8 = (float)local_98 * 3.0; - do { - local_d4 = GHIDRA_CAST(Random()); - rngResult = Random(); - local_a0 = (Entity *) - ((float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 6.0 + 4.0); - rngResult = Random(); - fVar13 = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 - * 3.14; - local_a4 = GHIDRA_CAST((fVar13 + fVar13)); - splashVelocity.x = cos((float)local_a4); - splashVelocity.x = splashVelocity.x + (float)local_a0 * (float)local_90; - splashVelocity.y = sin((float)local_a4); - splashVelocity.y = splashVelocity.y + (float)local_a0 * (float)local_98; - rngResult = Random(); - local_a4 = (ColorMod *) - (local_e0 * - (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 + (float)local_a8); - rngResult = Random(); - fVar13 = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 - ; - splashPos.y = (float)local_a4 * (float)local_94 + (float)local_9c + - fVar13 * local_d8; - splashPos.x = (float)local_a4 * (float)local_98 + (float)local_88 + - fVar13 * local_dc; - local_d4 = Game::Spawn(g_game,1000,99,&splashPos,&splashVelocity,GHIDRA_CAST(0x0),1, - GHIDRA_UINT(local_d4)); - fVar13 = (local_d4->_sprite)._scale.x; - fVar6 = (local_d4->_sprite)._scale.y; - laserParent = *GHIDRA_CAST(local_d4); - (local_d4->_sprite)._scale.x = fVar13 + fVar13; - (local_d4->_sprite)._scale.y = fVar6 + fVar6; - (**(code **)(laserParent + 0x3c))(&splashColor,0xffffffff,0xff,0,1); - (local_d4->_posOffset).x = 0.0; - (local_d4->_posOffset).y = local_bc; - local_d4->Update(); - pVVar7 = GHIDRA_CAST((GHIDRA_INT(&pVVar7[-1].y) + 3)); - } while (pVVar7 != GHIDRA_CAST(0x0)); - candidateIt = local_d0; - } - if ((*GHIDRA_CAST((GHIDRA_INT(*candidateIt) + 0x16c)) & 0x1000000) != 0) { - (GHIDRA_CAST((&scratchColor)))->Color::Reset(); - scratchColor._tint[0] = 2.0; - scratchColor._tint[1] = 1.0; - scratchColor._tint[2] = 1.0; - scratchColor._tint[3] = 1.0; - (GHIDRA_CAST((&scratchColor)))->Color::__mul(local_ac); - scratchColor2._offset[2] = scratchColor._offset[2]; - scratchColor2._tint[0] = scratchColor._tint[0]; - scratchColor2._tint[1] = scratchColor._tint[1]; - scratchColor2._tint[2] = scratchColor._tint[2]; - scratchColor2._tint[3] = scratchColor._tint[3]; - scratchColor2._colorize[0] = scratchColor._colorize[0]; - scratchColor2._colorize[1] = scratchColor._colorize[1]; - scratchColor2._colorize[2] = scratchColor._colorize[2]; - scratchColor2._colorize[3] = scratchColor._colorize[3]; - scratchColor2._offset[0] = scratchColor._offset[0]; - scratchColor2._offset[1] = scratchColor._offset[1]; - local_d4 = GHIDRA_CAST(Random()); - rngResult = Random(); - fVar13 = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10; - local_a0 = GHIDRA_CAST((fVar13 + fVar13 + 2.0)); - rngResult = Random(); - fVar13 = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 3.14; - local_ac = GHIDRA_CAST((fVar13 + fVar13)); - local_fc.x = cos((float)local_ac); - local_fc.x = local_fc.x + (float)local_a0 * (float)local_90; - local_fc.y = sin((float)local_ac); - local_fc.y = local_fc.y + (float)local_a0 * (float)local_98; - rngResult = Random(); - fVar13 = ((float)local_b0 - (float)local_a8) * - (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 + - (float)local_a8; - local_104.y = fVar13 * (float)local_94 + (float)local_9c; - local_104.x = fVar13 * (float)local_98 + (float)local_88; - local_a0 = Game::Spawn(g_game,1000,2,&local_104,&local_fc,GHIDRA_CAST(0x0),2, - GHIDRA_UINT(local_d4)); - local_a0->SetColor(&scratchColor2,0xffffffff,0xff,0,1); - (local_a0->_posOffset).x = 0.0; - (local_a0->_posOffset).y = local_bc; - rngResult = Random(); - laserParent = *GHIDRA_CAST(local_a0); - *GHIDRA_CAST((local_a0[1]._sprite._animDefaultName._buf + 4)) = - (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 360.0; - (**(code **)(laserParent + 0xc))(); - } -LAB_00973070: - fVar13 = 0.0; - laserRef = laser; - } - } - } -LAB_00973073: - candidateIt = candidateIt + 1; - local_d0 = candidateIt; - } while (candidateIt != candidatesCursor); - } - if (candidates != GHIDRA_CAST(0x0)) { - deallocate(candidates,GHIDRA_INT(candidatesCapacity) - GHIDRA_INT(candidates) >> 2); - } - } - ExceptionList = local_1c; - return; -code_r0x0097207c: - local_a8 = (void *)((float)local_a0 + (float)local_a8); - local_9c = GHIDRA_CAST((GHIDRA_INT(&local_9c->x) + 1)); - laserRef = laser; - if (local_a4 <= local_9c) goto LAB_00973073; - goto LAB_00971e12; -} - -// 009737b0 -void Entity_Laser::update_endpoint_and_hits() -{ - uint32_t maskedFlags1; - uint32_t maskedFlags3; - uint32_t uVar1; - int sampleCount; - int playerSpawner; - uint32_t maskedFlags0; - uint32_t maskedFlags2; - float fVar2; - float dirX; - float fVar3; - Vector local_10; - - this->_impactDistance = INFINITY; - playerSpawner = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - playerSpawner >> 3; - if (1 < uVar1) { - (this->_impactPosition).x = *GHIDRA_CAST((playerSpawner + -8 + uVar1 * 8)); - (this->_impactPosition).y = *GHIDRA_CAST((playerSpawner + -4 + uVar1 * 8)); - sampleCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - playerSpawner >> 3; - dirX = *GHIDRA_CAST((playerSpawner + -8 + sampleCount * 8)) - - *GHIDRA_CAST((playerSpawner + -0x10 + sampleCount * 8)); - fVar3 = *GHIDRA_CAST((playerSpawner + -4 + sampleCount * 8)) - - *GHIDRA_CAST((playerSpawner + -0xc + sampleCount * 8)); - fVar2 = sqrtf(dirX * dirX + fVar3 * fVar3); - if (0.0 < fVar2) { - dirX = dirX * (1.0 / fVar2); - fVar3 = fVar3 * (1.0 / fVar2); - } - (this->_impactDirection).x = dirX; - (this->_impactDirection).y = fVar3; - } - if ((this->_oneHit == 0) || (this->_isFirstUpdate != 0)) { - local_10.x = (this->_posOffset).x * 0.4; - local_10.y = (this->_posOffset).y * 0.4; - find_nearest_grid_hit(this,1,&local_10); - } - local_10.x = this->_collisionDamage; - playerSpawner = this->_spawnerEntity; - if ((playerSpawner != 0) && (*GHIDRA_CAST((playerSpawner + 0x28)) != 1)) { - playerSpawner = 0; - } - maskedFlags1 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._l)) + 0x4))); - maskedFlags0 = GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagShrink._l); - uVar1 = GHIDRA_UINT((this->_tearFlags)._h); - maskedFlags2 = uVar1 & GHIDRA_UINT(g_tearFlagShrink._h); - maskedFlags3 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._h)) + 0x4))); - if ((maskedFlags0 == 0 && maskedFlags1 == 0) && (maskedFlags2 == 0 && maskedFlags3 == 0)) { - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagGrow._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._l)) + 0x4)))) == 0) && - ((uVar1 & GHIDRA_UINT(g_tearFlagGrow._h)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._h)) + 0x4)))) == 0)) - goto LAB_00973a3a; - } - if ((this->_subtype == 1) || (this->_subtype == 2)) { - if (playerSpawner != 0) { - fVar2 = (this->_pos).y - *GHIDRA_CAST((playerSpawner + 0x340)); - fVar3 = (this->_pos).x - *GHIDRA_CAST((playerSpawner + 0x33c)); - sqrtf(fVar2 * fVar2 + fVar3 * fVar3); - } - if ((maskedFlags0 == 0 && maskedFlags1 == 0) && (maskedFlags2 == 0 && maskedFlags3 == 0)) { - update_line_hits(this); - return; - } - } -LAB_00973a3a: - update_line_hits(this); - return; -} - -// 00973a50 -void Entity_Laser::refresh_tear_params() -{ - uint32_t *puVar1; - uint64_t *pqVar2; - Entity_Player *source; - int iVar3; - uint32_t uVar4; - uint32_t uVar5; - uint32_t uVar6; - float damageScale; - uint8_t auStack_98 [4]; - Entity_Player *local_94; - TearParams hitParams; - uint32_t local_14; - Game *game; - uint64_t heldFlagsHigh; - uint64_t heldFlagsLow; - - local_14 = __security_cookie ^ GHIDRA_UINT(auStack_98); - if ((((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x517))) != '\0') && (this->_oneHit == 0)) && (this->_isInterpolating == 0)) { - if ((this->_isFirstUpdate == 0) && - (iVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), iVar3 == 0)) { - return; - } - source = GHIDRA_CAST(this->_spawnerEntity); - if (source != GHIDRA_CAST(0x0)) { - if (source->_type == 1) { - local_94 = source; - } - else { - if (source == GHIDRA_CAST(0x0)) { - return; - } - if (source->_type != 3) { - return; - } - iVar3 = source->_variant; - if (((iVar3 != 0x50) && (iVar3 != 0xeb)) && ((iVar3 != 0xf0 && (iVar3 != 0xee)))) { - return; - } - local_94 = *GHIDRA_CAST(&source->_isControlsEnabled); - if (local_94 == GHIDRA_CAST(0x0)) { - return; - } - } - uVar4 = Random(); - Entity_Player::GetTearHitParams - (local_94,&hitParams,3,this->_damageMultiplier,(uVar4 & 1) * 2 + -1,GHIDRA_CAST(source) - ); - uVar4 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWait._l)) + 0x4))); - uVar6 = ~GHIDRA_UINT(g_tearFlagWait._h); - uVar5 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWait._h)) + 0x4))); - iVar3 = this->_timeout; - *GHIDRA_CAST(&(this->_tearFlags)._l) = ~GHIDRA_UINT(g_tearFlagWait._l) & GHIDRA_UINT(hitParams._flags._l); - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = uVar4 & (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams._flags._l)) + 0x4))); - *GHIDRA_CAST(&(this->_tearFlags)._h) = uVar6 & GHIDRA_UINT(hitParams._flags._h); - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = uVar5 & (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams._flags._h)) + 0x4))); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._h)) + 0x4))); - if (iVar3 < 0) { - uVar6 = ~GHIDRA_UINT(g_tearFlagExplosive._h); - uVar5 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._l)) + 0x4))); - *GHIDRA_CAST(&(this->_tearFlags)._l) = - GHIDRA_UINT((this->_tearFlags)._l) & ~GHIDRA_UINT(g_tearFlagExplosive._l); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - *puVar1 = *puVar1 & uVar5; - pqVar2 = &(this->_tearFlags)._h; - *GHIDRA_CAST(pqVar2) = GHIDRA_UINT(*pqVar2) & uVar6; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *puVar1 = *puVar1 & ~uVar4; - } - heldFlagsHigh = (this->_heldTearFlags)._h; - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._h) + 4)); - heldFlagsLow = (this->_heldTearFlags)._l; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - *puVar1 = *puVar1 & ~*GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._l) + 4)); - game = g_game; - *GHIDRA_CAST(&(this->_tearFlags)._l) = GHIDRA_UINT((this->_tearFlags)._l) & ~GHIDRA_UINT(heldFlagsLow); - pqVar2 = &(this->_tearFlags)._h; - *GHIDRA_CAST(pqVar2) = GHIDRA_UINT(*pqVar2) & ~GHIDRA_UINT(heldFlagsHigh); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *puVar1 = *puVar1 & ~uVar4; - if ((*GHIDRA_CAST(&game->_deathmatchManager) < 2) || (this->_subtype != 2)) { - damageScale = 1.0; - } - else { - damageScale = 0.5; - } - this->_collisionDamage = hitParams._tearDamage * damageScale; - } - } - return; -} - -// 00973c60 -void Entity_Laser::update_laser() -{ - EntityPtr *this_00; - code *pcVar1; - uint8_t *puVar2; - uint32_t uVar3; - ANM2 other; - BitSet128 flags; - Vector pos; - uint64_t qVar4; - uint64_t qVar5; - uint8_t isFading; - uint8_t bVar6; - char cVar7; - int iVar8; - float *rotationStep; - void *pvVar9; - undefined3 extraout_var; - uint32_t pulseFrame; - Entity *pEVar10; - float *pfVar11; - Entity_Player *pEVar12; - BitSet128 *pBVar13; - Vector *pVVar14; - uint32_t uVar15; - int *piVar16; - ColorMod *other_00; - Entity_Laser *bounceLaser; - Vector *randomOffset; - Entity_Player *pEVar17; - Entity_Laser *spawnedLaser; - int extraout_ECX; - Color *this_01; - int extraout_ECX_00; - Vector *this_02; - int extraout_ECX_01; - ANM2 *this_03; - Entity_Player **scalar; - Vector *other_01; - int extraout_EDX; - int iVar18; - int sampleCount; - uint32_t *puVar19; - float fVar20; - Entity_Player *pEVar21; - uint8_t extraout_var_00 [12]; - uint8_t auVar22 [16]; - float fVar23; - uint8_t *puVar24; - Entity_Player *spawnedLaser; - uint8_t auVar26 [16]; - ANM2 aAStackY_8ecc [128]; - uint8_t in_stack_fffffc48 [228]; - float in_stack_fffffd2c; - float in_stack_fffffd30; - float in_stack_fffffd34; - float in_stack_fffffd38; - BitSet128 *pBVar27; - float fVar28; - BitSet128 *b; - uint32_t uVar29; - BitSet128 *b_00; - BitSet128 *b_01; - BitSet128 creepFlagTest; - BitSet128 inheritedFlags; - BitSet128 notOrbitBoomerangMask; - BitSet128 orbitBoomerangMask; - BitSet128 orbitMask; - BitSet128 popAbsorbMask; - Color prismColor3; - Color prismColor2; - Color prismColor1; - BitSet128 local_1b0; - BitSet128 local_1a0; - uint8_t local_190 [8]; - Vector local_188; - uint8_t local_180 [8]; - Vector local_178; - BitSet128 local_170; - uint8_t local_160 [16]; - Vector local_150; - uint8_t local_148 [8]; - Vector local_140; - uint8_t local_138 [8]; - Vector local_130; - uint8_t local_128 [8]; - Vector local_120; - Vector local_114; - Vector local_10c; - Vector local_104; - float local_fc; - uint8_t local_f8 [8]; - Vector local_f0; - char isSamplesRebuilt; - uint8_t local_e1; - uint8_t local_e0 [12]; - Entity_Player *local_d4 [2]; - Vector local_cc; - bool local_c1; - Vector local_c0; - char isRedirected; - Entity_Player *local_b4; - Color bounceLaserColor; - Color prismLaserColor; - uint8_t local_58 [20]; - float fStack_44; - float fStack_40; - float fStack_3c; - float local_38; - float local_34; - float local_30; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - Game *game; - Room *room; - - puStack_20 = local_58 + 0x54; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0cae8; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_58 + 0x48)); - ExceptionList = &local_1c; - local_150.y = (float)this; - refresh_tear_params(); - bVar6 = this->_isFirstUpdate; - if ((bVar6 != 0) || (this->_oneHit == 0)) { - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - qVar4 = (this->_tearFlags)._h; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *GHIDRA_CAST(&(this->_activeTearFlags)._l) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._l) + 4)) = uVar29; - *GHIDRA_CAST(&(this->_activeTearFlags)._h) = GHIDRA_INT(qVar4); - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._h) + 4)) = uVar3; - } - if ((((this->_variant == 7) || (this->_isInterpolating != 0)) || (this->_dead != 0)) || - ((bVar6 == 0 && (iVar8 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), iVar8 == 0)))) { - local_e1 = 0; - } - else { - local_e1 = 1; - if ((this->_parentLaser == 0) && (this->_oneHit == 0)) { - (this->_hitList)._end = (this->_hitList)._begin; - } - } - uVar15 = this->_parent; - if ((uVar15 != 0) && (this->_disableFollowParent == 0)) { - fVar20 = *GHIDRA_CAST((uVar15 + 0x33c)); - fVar23 = *GHIDRA_CAST((uVar15 + 0x340)); - if (*GHIDRA_CAST((uVar15 + 0x28)) == 1) { - fVar20 = fVar20 + (this->_parentOffset).x + *GHIDRA_CAST((uVar15 + 0x164c)); - fVar23 = fVar23 + (this->_parentOffset).y + *GHIDRA_CAST((uVar15 + 0x1650)); - } - else if (this->_spawnerType != 1) { - fVar20 = fVar20 + (this->_parentOffset).x; - fVar23 = fVar23 + (this->_parentOffset).y; - } - (this->_pos).y = fVar23; - (this->_pos).x = fVar20; - } - local_fc = (float)(uVar15 & 0xffffff00); - isSamplesRebuilt = '\0'; - isRedirected = '\0'; - local_104.y = (float)(GHIDRA_UINT(local_104.y) & 0xffffff00); - local_114.y = (float)(GHIDRA_UINT(local_114.y) & 0xffffff00); - if ((this->_isInterpolating == 0) && (this->_timeout != 0)) { - iVar8 = this->_variant; - if ((iVar8 == 6) || (iVar8 == 0xf)) { - iVar8 = 4; - } - else if (((iVar8 == 0xb) || (iVar8 == 0xe)) && (g_game->_frameCount - this->_spawnFrame == 1)) { - iVar8 = 10; - } - else { - if (iVar8 != 0xd) goto LAB_00973e19; - iVar8 = 10; - } - Game::ShakeScreen(g_game,iVar8); - } -LAB_00973e19: - if (this->_isActiveRotating != 0) { - if (this->_rotationDelay == 0) { - pEVar17 = GHIDRA_CAST(this->_rotationDegrees); - pfVar11 = &this->_rotationDegrees; - if (0.0 <= (float)pEVar17) { - if (0.0 < (float)pEVar17) { - local_c0.y = this->_rotationSpd * 0.5; - rotationStep = &local_c0.y; - if ((float)pEVar17 < local_c0.y) { - rotationStep = pfVar11; - } - local_b4 = GHIDRA_CAST(((float)pEVar17 - *rotationStep)); - fVar20 = *rotationStep + this->_angleDegrees; - this->_angleDegrees = fVar20; - *pfVar11 = (float)local_b4; - fVar20 = normalize_angle_degrees(fVar20 - 90.0); - (this->_sprite)._rotation = fVar20; - pEVar17 = local_b4; - } - if ((float)pEVar17 <= 0.0) { - this->_isActiveRotating = 0; - } - } - else { - if ((float)pEVar17 < 0.0) { - local_c0.y = this->_rotationSpd * 0.5; - rotationStep = &local_c0.y; - if (local_c0.y < (float)pEVar17) { - rotationStep = pfVar11; - } - local_b4 = GHIDRA_CAST(((float)pEVar17 - *rotationStep)); - fVar20 = *rotationStep + this->_angleDegrees; - this->_angleDegrees = fVar20; - *pfVar11 = (float)local_b4; - fVar20 = normalize_angle_degrees(fVar20 - 90.0); - (this->_sprite)._rotation = fVar20; - pEVar17 = local_b4; - } - if (0.0 <= (float)pEVar17) { - this->_isActiveRotating = 0; - } - } - } - else { - this->_rotationDelay = this->_rotationDelay + -1; - } - } - if (this->_sampleLaser == 0) { - this->_isGridHit = 0; - bVar6 = is_thick_variant(this); - if ((((bVar6 != 0) || (iVar8 = this->_variant, iVar8 == 2)) || - ((iVar8 == 10 || ((iVar8 == 5 || (iVar8 == 7)))))) || (iVar8 == 8)) { - (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_120,&this->_posOffset); - Vector::FromAngle(&local_f0,this->_angleDegrees); - if (this->_entityGridCollisionClass == 6) { - local_d4[0] = GHIDRA_CAST(0x40800000); - room = g_game->_room; - pVVar14 = Vector::operator_mul(GHIDRA_CAST(&local_1a0._h),GHIDRA_CAST(local_d4),&local_f0); - pVVar14 = (GHIDRA_CAST((&local_120)))->Vector::__sub(&local_140,pVVar14); - pVVar14 = (GHIDRA_CAST((room)))->Room::GetLaserTarget(&local_188,pVVar14,&local_f0); -LAB_0097663d: - local_b4 = GHIDRA_CAST(&this->_endPoint); - } - else { - local_b4 = GHIDRA_CAST(&this->_endPoint); - if (this->_entityGridCollisionClass != 3) { - local_d4[0] = GHIDRA_CAST(0x447a0000); - pVVar14 = (GHIDRA_CAST((&local_f0)))->Vector::__mul(GHIDRA_CAST(&local_1a0._h),GHIDRA_CAST(local_d4)); - pVVar14 = (GHIDRA_CAST((&local_120)))->Vector::__add(&local_140,pVVar14); - goto LAB_0097663d; - } - pVVar14 = calc_end_point(this,GHIDRA_CAST(&local_1a0._h),&this->_pos,&local_f0); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__add(&local_140,&this->_posOffset); - } - pEVar17 = GHIDRA_CAST(&this->_endPoint); - (GHIDRA_CAST(pEVar17))->x = pVVar14->x; - (this->_endPoint).y = pVVar14->y; - if (0.0 < this->_maxDistance) { - local_d4[0] = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar17))))->Vector)::DistanceSquared(&local_120); - if (this->_maxDistance * this->_maxDistance < (float)local_d4[0]) { - pVVar14 = (GHIDRA_CAST((&this->_endPoint)))->Vector::__sub(&local_178,&local_120); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::Resized(&local_cc,this->_maxDistance); - pVVar14 = (GHIDRA_CAST((&local_120)))->Vector::__add(GHIDRA_CAST((local_e0 + 8)),pVVar14); - (this->_endPoint).x = pVVar14->x; - (this->_endPoint).y = pVVar14->y; - pEVar17 = local_b4; - } - } - iVar8 = this->_variant; - if ((((iVar8 == 6) || (iVar8 == 0xf)) && (this->_spawnerType == 0x112)) || (iVar8 == 0xd)) { - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(pEVar17))))->Vector::__sub(&local_c0,&local_120); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::Resized(&local_114,100.0); - (GHIDRA_CAST((GHIDRA_CAST(pEVar17))))->Vector::operator_add_assign(pVVar14); - } - if ((this->_spawnerType != 1) && (this->_spawnerType != 3)) { - local_130.y = 0.0; - local_f0.y = 0.0; - local_f0.x = 0.0; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_160),1000,0xbc, - -1,0,0); - local_14 = 0; - local_c0.y = 0.0; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_160))) + 0xc))) == GHIDRA_CAST(0x0)) { -LAB_00976cc2: - if (this->_bounceLaser != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_bounceLaser) + 0x28))(); - } - } - else { - do { - pEVar17 = GHIDRA_CAST(FUN_004a2920()); - if (pEVar17 != GHIDRA_CAST(0x0)) { - Vector::FromAngle(&local_cc, - (float)(pEVar17->_bodySprite)._overlayAnimState._layerFrames); - pVVar14 = (GHIDRA_CAST((&this->_endPoint)))->Vector::__sub(GHIDRA_CAST(&local_1a0._h),&local_120); - if (local_cc.y * pVVar14->y + local_cc.x * pVVar14->x < 0.0) { - local_178.x = (pEVar17->_pos).x; - local_178.y = (pEVar17->_pos).y; - local_d4[0] = GHIDRA_CAST(0x41a00000); - pVVar14 = Vector::operator_mul(GHIDRA_CAST(&local_1b0._h),GHIDRA_CAST(local_d4),&local_cc); - (GHIDRA_CAST((&local_178)))->Vector::__add(&local_140,pVVar14); - pVVar14 = (GHIDRA_CAST((&local_cc)))->Vector::Rotated(GHIDRA_CAST(&local_170._h),90.0); - local_d4[0] = GHIDRA_CAST(pEVar17->_size); - (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_188,GHIDRA_CAST(local_d4)); - bVar6 = segment_intersect(&local_114.y,&local_10c.y,local_120.x,local_120.y, - (this->_endPoint).x,(this->_endPoint).y, - local_140.x - local_188.x,local_140.y - local_188.y, - local_188.x + local_140.x,local_188.y + local_140.y); - if (bVar6 != 0) { - (this->_endPoint).x = local_114.y; - (this->_endPoint).y = local_10c.y; - local_f0.x = local_cc.x; - local_f0.y = local_cc.y; - local_130.y = (float)pEVar17; - } - } - } - fVar20 = local_130.y; - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + 1); - } while (GHIDRA_UINT(local_c0.y) < (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_160))) + 0xc)))); - if (GHIDRA_CAST(local_130.y) == GHIDRA_CAST(0x0)) goto LAB_00976cc2; - (GHIDRA_CAST((GHIDRA_CAST(local_b4))))->Vector::__sub(&local_cc,&local_120); - local_d4[0] = GHIDRA_CAST(0x40000000); - pVVar14 = Vector::operator_mul(GHIDRA_CAST(&local_170._h),GHIDRA_CAST(local_d4),&local_f0); - local_d4[0] = GHIDRA_CAST((local_cc.y * local_f0.y + local_cc.x * local_f0.x)); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(GHIDRA_CAST(&local_1b0._h),GHIDRA_CAST(local_d4)); - (GHIDRA_CAST((&local_cc)))->Vector::__sub(&local_140,pVVar14); - local_c0.y = (GHIDRA_CAST((&local_140)))->Vector::GetAngleDegrees(); - (GHIDRA_CAST((&bounceLaserColor)))->Color::Color(); - if ((this->_variant != 5) && (this->_variant != 10)) { - other_00 = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - (GHIDRA_CAST((&bounceLaserColor)))->Color::operator_assign(other_00); - } - local_d4[0] = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(fVar20) + 0x3bc)))))->Entity::ToPlayer(); - if (this->_bounceLaser == (void *)0x0) { - pVVar14 = (GHIDRA_CAST((&this->_endPoint)))->Vector::__sub(GHIDRA_CAST(&local_170._h),&this->_posOffset); - spawnedLaser = ShootAngle(this->_variant,pVVar14,local_c0.y,this->_timeout, - &this->_posOffset,GHIDRA_CAST(local_d4[0]),1); - if (spawnedLaser == GHIDRA_CAST(0x0)) goto LAB_00976cb2; - pcVar1 = *(code **)(*GHIDRA_CAST(spawnedLaser) + 0x3c); - spawnedLaser->_disableFollowParent = 1; - spawnedLaser->_prismTouched = 1; - (*pcVar1)(); - spawnedLaser->SetCollisionDamage(); - spawnedLaser->_renderDepthOffset = this->_renderDepthOffset + 100.0; - spawnedLaser->_timeout = this->_timeout; - if ((this->_shrink == 0) && (this->_dead == 0)) { - bVar6 = 0; - } - else { - bVar6 = 1; - } - spawnedLaser->_shrink = bVar6; - spawnedLaser->Update(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bounceLaser))))->EntityPtr::SetReference(GHIDRA_CAST(spawnedLaser)); - isRedirected = '\x01'; - local_104.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_104.y)) + 0x1))),1); - } - else { - bounceLaser = GHIDRA_CAST(__RTDynamicCast()); - bounceLaser->SetColor(); - bounceLaser->SetCollisionDamage(); - bounceLaser->_renderDepthOffset = this->_renderDepthOffset + 100.0; - bounceLaser->_timeout = this->_timeout; - if ((this->_shrink == 0) && (this->_dead == 0)) { - bVar6 = 0; - } - else { - bVar6 = 1; - } - bounceLaser->_shrink = bVar6; - (GHIDRA_CAST((GHIDRA_CAST(bounceLaser))))->Entity_NPC::SetAimAngle(local_c0.y); - pVVar14 = (GHIDRA_CAST((&this->_endPoint)))->Vector::__sub(GHIDRA_CAST(&local_170._h),&this->_posOffset); - (bounceLaser->_pos).x = pVVar14->x; - (bounceLaser->_pos).y = pVVar14->y; -LAB_00976cb2: - isRedirected = '\x01'; - local_104.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_104.y)) + 0x1))),1); - } - } - local_14 = 0xffffffff; - (GHIDRA_CAST((local_160)))->EntityList_Query::~EntityList_Query(); - } - (GHIDRA_CAST((GHIDRA_CAST(local_b4))))->Vector::__sub(&local_140,&local_120); - fVar20 = (GHIDRA_CAST((&local_140)))->Vector::Length(); - this->_laserLength = fVar20; - update_sample_points(this); - local_fc = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_fc)) + 0x1))),isRedirected); - } - } - else { - if (((this->_homingType == 1) || (this->_oneHit != 0)) && (this->_isFirstUpdate == 0)) { - isSamplesRebuilt = '\0'; - } - else { - fVar20 = this->_angleDegrees; - isSamplesRebuilt = '\x01'; - this->_isGridHit = 0; - if (((fVar20 != this->_lastAngleDegrees) && (bVar6 = is_thick_variant(this), bVar6 == 0)) && - (this->_variant != 5)) { - (this->_homingLaser)._bezier._end = (this->_homingLaser)._bezier._begin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) = - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x38)))) = - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x34)))); - (this->_homingLaser)._nonOptimizedSamples._end = - (this->_homingLaser)._nonOptimizedSamples._begin; - fVar20 = this->_angleDegrees; - } - local_b4 = GHIDRA_CAST((fVar20 * 0.017453292)); - local_c0.y = sin((float)local_b4); - local_f0.x = cos((float)local_b4); - local_f0.y = local_c0.y; - local_10c.y = g_vectorZero.x; - local_104.y = g_vectorZero.y; - if ((1 < GHIDRA_UINT((this->_sprite)._layerCount)) && - (pvVar9 = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0), - pvVar9 != (void *)0x0)) { - fVar23 = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x14)) + *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xc)); - fVar20 = (this->_sprite)._scale.y; - local_104.y = local_c0.y * fVar23 * fVar20; - local_10c.y = fVar23 * local_f0.x * fVar20; - } - pEVar17 = GHIDRA_CAST(this->_spawnerEntity); - local_130.y = local_10c.y + (this->_pos).x; - local_cc.y = local_104.y + (this->_pos).y; - if ((pEVar17 == GHIDRA_CAST(0x0)) || (pEVar17->_type != 1)) { - pEVar17 = GHIDRA_CAST(0x0); - } - local_cc.x = local_130.y; - local_b4 = GHIDRA_CAST(local_cc.y); - pVVar14 = calc_end_point(this,&local_140,&local_cc,&local_f0); - fVar20 = pVVar14->x; - (this->_endPoint).x = fVar20; - fVar23 = pVVar14->y; - (this->_endPoint).y = fVar23; - fVar28 = this->_maxDistance; - if ((0.0 < fVar28) && - (fVar28 * fVar28 < - ((float)local_b4 - fVar23) * ((float)local_b4 - fVar23) + - (local_130.y - fVar20) * (local_130.y - fVar20))) { - local_cc.x = fVar20 - local_130.y; - local_cc.y = fVar23 - (float)local_b4; - pVVar14 = (GHIDRA_CAST((&local_cc)))->Vector::Resized(&local_140,fVar28); - fVar20 = pVVar14->y; - (this->_endPoint).x = local_130.y + pVVar14->x; - (this->_endPoint).y = (float)local_b4 + fVar20; - } - (this->_homingLaser)._bezier._end = (this->_homingLaser)._bezier._begin; - if (((this->_variant == 6) || (this->_variant == 0xf)) && (this->_spawnerType == 1)) { - if ((((this->_endPoint).y - (float)local_b4) - local_c0.y * 50.0) * local_104.y + - (((this->_endPoint).x - local_130.y) - local_f0.x * 50.0) * local_10c.y < 0.0) { - local_c0.y = local_130.y + local_10c.y; - local_d4[0] = GHIDRA_CAST(((float)local_b4 + local_104.y)); - fVar23 = sqrtf(local_104.y * local_104.y + local_10c.y * local_10c.y); - spawnedLaser = local_d4[0]; - if (fVar23 <= 0.0) { - fVar20 = local_c0.y + local_10c.y; - puVar24 = GHIDRA_CAST(local_104.y); - } - else { - fVar20 = local_c0.y + (0.1 / fVar23) * local_10c.y; - puVar24 = GHIDRA_CAST(((0.1 / fVar23) * local_104.y)); - } - goto LAB_009743d3; - } - } - else if (((this->_endPoint).y - (float)local_b4) * local_104.y + - ((this->_endPoint).x - local_130.y) * local_10c.y < 0.0) { - local_d4[0] = GHIDRA_CAST((local_130.y + local_10c.y)); - local_c0.y = (float)local_b4 + local_104.y; - fVar20 = sqrtf(local_104.y * local_104.y + local_10c.y * local_10c.y); - if (fVar20 <= 0.0) { - puVar2 = GHIDRA_CAST(local_10c.y); - puVar24 = GHIDRA_CAST(local_104.y); - } - else { - puVar2 = GHIDRA_CAST(((0.1 / fVar20) * local_10c.y)); - puVar24 = GHIDRA_CAST(((0.1 / fVar20) * local_104.y)); - } - fVar20 = (float)local_d4[0] + (float)puVar2; - spawnedLaser = GHIDRA_CAST(local_c0.y); -LAB_009743d3: - (this->_endPoint).y = (float)spawnedLaser + (float)puVar24; - (this->_endPoint).x = fVar20; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x4)))) = local_130.y; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x8)))) = local_b4; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0xc)))) = (this->_endPoint).x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x10)))) = (this->_endPoint).y; - pBVar13 = BitSet128::operator_and(GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagOrbit); - if ((GHIDRA_INT(pBVar13->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar13->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) != 0)) { - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::build_curl_path(60.0); - } - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagBoomerang); - if ((GHIDRA_INT(pBVar13->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar13->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) != 0)) { - HomingLaser::build_wiggle_bezier(); - pvVar9 = (this->_homingLaser)._bezier._end; - if ((this->_homingLaser)._bezier._begin != pvVar9) { - (this->_endPoint).x = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -0x18)); - (this->_endPoint).y = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -0x14)); - } - } - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagTurnHorizontal); - uVar15 = GHIDRA_UINT(pBVar13->_l) | *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)); - if ((uVar15 != 0) || - (uVar15 = GHIDRA_UINT(pBVar13->_h) | *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)), uVar15 != 0)) { - laser_sample_trace_entities(&this->_homingLaser,uVar15); - pvVar9 = (this->_homingLaser)._bezier._end; - if ((this->_homingLaser)._bezier._begin != pvVar9) { - (this->_endPoint).x = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -0x18)); - (this->_endPoint).y = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -0x14)); - } - } - pBVar13 = BitSet128::operator_and(GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagHoming); - if ((GHIDRA_INT(pBVar13->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) == 0) && - (GHIDRA_INT(pBVar13->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) == 0)) { - if (this->_homingType == 1) { - iVar8 = 4; - } - else { - iVar8 = 0; - if (this->_homingType == 2) { - iVar8 = 5; - } - } - } - else { - iVar8 = 1; - } - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::build_bezier_path(iVar8,GHIDRA_CAST(this->_parent)); - if ((this->_variant == 2) || (this->_variant == 10)) { - fVar20 = 0.7; - } - else if (this->_homingType == 2) { - fVar20 = 1.0; - } - else if (this->_maxDistance <= 0.0) { - fVar20 = 0.9; - } - else { - fVar20 = 0.63; - } - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::CalculateSamples(fVar20); - pBVar13 = BitSet128::operator_and(GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagSquare); - if ((((GHIDRA_INT(pBVar13->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar13->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) != 0)) && - (pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagOrbit), - GHIDRA_INT(pBVar13->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) == 0)) && - (GHIDRA_INT(pBVar13->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) == 0)) { - local_d4[0] = (Entity_Player *) - (float)((double)this->_index + __uint_to_double_fixup[-(this->_index >> 0x1f)] - ); - if (pEVar17 == GHIDRA_CAST(0x0)) { - fVar20 = 1.0; - } - else { - fVar20 = get_tear_trinket_multiplier(pEVar17,0x1e); - } - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::apply_sample_wiggle(fVar20,(float)local_d4[0]); - } - pBVar13 = BitSet128::operator_and(GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagWiggle); - if ((GHIDRA_INT(pBVar13->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar13->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) != 0)) { - local_d4[0] = (Entity_Player *) - (float)((double)this->_index + __uint_to_double_fixup[-(this->_index >> 0x1f)] - ); - if (pEVar17 == GHIDRA_CAST(0x0)) { - fVar20 = 1.0; - } - else { - fVar20 = get_tear_trinket_multiplier(pEVar17,10); - } - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::apply_sine_offset(fVar20,(float)local_d4[0]); - } - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagBigSpiral); - if ((GHIDRA_INT(pBVar13->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) == 0) && - (GHIDRA_INT(pBVar13->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) == 0)) { - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_160),&this->_tearFlags,&g_tearFlagSpiral); - if ((GHIDRA_INT(pBVar13->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar13->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) != 0)) { - local_d4[0] = (Entity_Player *) - (float)((double)this->_index + - __uint_to_double_fixup[-(this->_index >> 0x1f)]); - if (pEVar17 == GHIDRA_CAST(0x0)) { - fVar20 = 1.0; - } - else { - fVar20 = get_tear_trinket_multiplier(pEVar17,0x1a); - } - goto LAB_009747b1; - } - } - else { - local_d4[0] = (Entity_Player *) - (float)((double)this->_index + __uint_to_double_fixup[-(this->_index >> 0x1f)] - ); - if (pEVar17 == GHIDRA_CAST(0x0)) { - fVar20 = 3.0; - } - else { - fVar20 = get_tear_trinket_multiplier(pEVar17,0x2e); - fVar20 = fVar20 * 3.0; - } -LAB_009747b1: - update_wiggle_path(&this->_homingLaser,fVar20,(float)local_d4[0]); - } - pBVar13 = BitSet128::operator_or(&local_170,&g_tearFlagPop,&g_tearFlagAbsorb); - pBVar13 = BitSet128::operator_and(&local_1b0,&this->_tearFlags,pBVar13); - if ((GHIDRA_INT(pBVar13->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar13->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) != 0)) { - bVar6 = (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::truncate_samples(120.0); - local_fc = (float)CONCAT31(extraout_var,bVar6); - local_114.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_114.y)) + 0x1))),bVar6); - } - if (((this->_entityGridCollisionClass != 0) && - (pBVar13 = BitSet128::operator_and(&local_1a0,&this->_tearFlags,&g_tearFlagSpectral), - GHIDRA_INT(pBVar13->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)) == 0)) && - (GHIDRA_INT(pBVar13->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)) == 0)) { - local_f0.x = (this->_posOffset).x * 0.4; - local_f0.y = (this->_posOffset).y * 0.4; - bVar6 = HomingLaser::clip_samples_to_grid - (&this->_homingLaser,&local_f0,this->_entityGridCollisionClass); - local_fc = (float)(GHIDRA_UINT(local_fc) & 0xff); - this->_isGridHit = bVar6; - if (bVar6 != 0) { - local_fc = 0.0; - } - local_114.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_114.y)) + 0x1))),SUB41(local_fc,0)); - if (this->_homingType == 2) { - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::truncate_samples_at_obstacle(&this->_posOffset); - } - } - if ((g_game->_challenge == 0x1e) && - ((this->_parent == 0 || - ((iVar8 = *GHIDRA_CAST((this->_parent + 0x28)), iVar8 != 1 && (iVar8 != 3)))))) { - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::truncate_samples_at_player(); - } - if (((this->_spawnerType == 1) || - ((this->_spawnerType == 3 && (this->_spawnerVariant != 0x7b)))) && - (this->_multidimensionalTouched == 0)) { - local_120.y = 0.0; - local_120.x = 0.0; - piVar16 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))); - local_cc.y = 0.0; - local_cc.x = 0.0; - local_10c.y = (float)piVar16; - iVar8 = HomingLaser::find_targets(); - if (iVar8 == 0) { - local_c0.y = 2.8026e-45; - do { - if (GHIDRA_CAST(*piVar16) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*piVar16) + 0x28))(); - } - piVar16 = piVar16 + 1; - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + -1); - } while (local_c0.y != 0.0); - piVar16 = GHIDRA_CAST(this->_child); - iVar8 = 0; - if (piVar16 != GHIDRA_CAST(0x0)) { - if ((((this->_bounceLaser == (void *)0x0) || (piVar16[10] != 1000)) || - (piVar16[0xb] != 0x32)) || - ((piVar16[0xc] == 4 || ((this->_variant != 6 && (this->_variant != 0xf)))))) - goto LAB_00974ed9; - (**(code **)(*piVar16 + 0x28))(); - iVar8 = extraout_ECX; - } - spawn_impact_effect(this,iVar8); - } - else { - pEVar17 = GHIDRA_CAST((GHIDRA_UINT(local_cc.x) ^ 0x80000000)); - local_b4 = GHIDRA_CAST(local_cc.y); - local_130.y = (float)pEVar17; - if ((*piVar16 == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4fc)))) == 0)) { - local_c0.y = 2.8026e-45; - spawnedLaser = GHIDRA_CAST(local_cc.x); - pEVar12 = GHIDRA_CAST(local_cc.y); - pEVar21 = GHIDRA_CAST(local_cc.y); - local_104.y = (float)piVar16; - do { - if (*GHIDRA_CAST(local_104.y) == 0) { - local_f0.x = local_120.x + (float)pEVar21 * 5.0; - local_f0.y = local_120.y + (float)pEVar17 * 5.0; - fVar20 = atan2f((float)pEVar12,(float)spawnedLaser); - spawnedLaser = ShootAngle(this->_variant,&local_f0,fVar20 * 57.295776,this->_timeout - ,&this->_posOffset,GHIDRA_CAST(this->_parent),1); - if (spawnedLaser != GHIDRA_CAST(0x0)) { - spawnedLaser->_disableFollowParent = 1; - copy_from_parent(spawnedLaser,this,1); - pBVar13 = (GHIDRA_CAST((&g_tearFlagLaser)))->BitSet128::__bnot(GHIDRA_CAST(local_148)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0x0))) = *GHIDRA_CAST(&(this->_tearFlags)._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0x8))) = SUB84((this->_tearFlags)._h,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0xc))) = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_190),GHIDRA_CAST(local_160),pBVar13); - iVar8 = spawnedLaser->_parent; - qVar4 = pBVar13->_l; - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)); - qVar5 = pBVar13->_h; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)); - spawnedLaser->_multidimensionalTouched = 1; - *GHIDRA_CAST(&(spawnedLaser->_tearFlags)._l) = GHIDRA_INT(qVar4); - *GHIDRA_CAST((GHIDRA_INT(&(spawnedLaser->_tearFlags)._l) + 4)) = uVar29; - *GHIDRA_CAST(&(spawnedLaser->_tearFlags)._h) = GHIDRA_INT(qVar5); - *GHIDRA_CAST((GHIDRA_INT(&(spawnedLaser->_tearFlags)._h) + 4)) = uVar3; - if (iVar8 != 0) { - local_d4[0] = GHIDRA_CAST(&spawnedLaser->_parent); - msvc::multiset::erase(); - } - spawnedLaser->_parent = this; - msvc::multiset::insert(); - spawnedLaser->Update(); - if (*GHIDRA_CAST(local_104.y) != 0) { - local_d4[0] = GHIDRA_CAST(local_104.y); - msvc::multiset::erase(); - } - *GHIDRA_CAST(local_104.y) = spawnedLaser; - msvc::multiset::insert(); - } - pEVar21 = GHIDRA_CAST((GHIDRA_UINT(local_b4) ^ 0x80000000)); - pEVar17 = GHIDRA_CAST((GHIDRA_UINT(local_130.y) ^ 0x80000000)); - spawnedLaser = GHIDRA_CAST(local_cc.x); - pEVar12 = GHIDRA_CAST(local_cc.y); - local_130.y = (float)pEVar17; - local_b4 = pEVar21; - } - local_104.y = (float)&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_104.y)))) + 0x4))); - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + -1); - } while (local_c0.y != 0.0); - this->_chainedLasers = 0; - } - else { - fVar20 = atan2f(local_cc.y,local_cc.x); - local_104.y = 2.8026e-45; - local_d4[0] = GHIDRA_CAST((fVar20 * 57.295776)); - local_fc = (float)local_d4[0] - 90.0; - local_c0.y = (float)piVar16; - do { - spawnedLaser = *GHIDRA_CAST(local_c0.y); - if ((spawnedLaser == GHIDRA_CAST(0x0)) || (spawnedLaser->_type != 7)) { - spawnedLaser = GHIDRA_CAST(0x0); - } - copy_from_parent(spawnedLaser,this,0); - fVar23 = local_130.y * 5.0; - spawnedLaser->_lastAngleDegrees = spawnedLaser->_angleDegrees; - local_130.y = (float)(GHIDRA_UINT(local_130.y) ^ 0x80000000); - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + 4); - local_104.y = (float)(GHIDRA_INT(local_104.y) + -1); - spawnedLaser->_startAngleDegrees = (float)local_d4[0]; - spawnedLaser->_angleDegrees = (float)local_d4[0]; - (spawnedLaser->_sprite)._rotation = local_fc; - fVar20 = (float)local_b4 * 5.0; - local_b4 = GHIDRA_CAST((GHIDRA_UINT(local_b4) ^ 0x80000000)); - (spawnedLaser->_pos).x = local_120.x + fVar20; - (spawnedLaser->_pos).y = local_120.y + fVar23; - } while (local_104.y != 0.0); - local_104.y = 0.0; - } - piVar16 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))); - local_c0.y = 2.8026e-45; - do { - piVar16 = GHIDRA_CAST(*piVar16); - if ((piVar16 == GHIDRA_CAST(0x0)) || (piVar16[10] != 7)) { - piVar16 = GHIDRA_CAST(0x0); - } - if (piVar16 != GHIDRA_CAST(0x0)) { - uVar15 = g_game->_frameCount - this->_spawnFrame & 0x8000000f; - if (GHIDRA_INT(uVar15) < 0) { - uVar15 = (uVar15 - 1 | 0xfffffff0) + 1; - } - fStack_3c = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x0))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x4))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x8))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0xc))) = 1.0; - pulseFrame = 0x10 - uVar15; - if (GHIDRA_INT(uVar15) < 8) { - pulseFrame = uVar15; - } - fVar20 = (float)GHIDRA_INT(pulseFrame) * 0.125; - local_38 = fVar20 * 0.4 - 0.2; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x10))) = fVar20 + fVar20 + 0.3; - fStack_44 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_58)) + 0x10))); - fStack_40 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_58)) + 0x10))); - local_34 = local_38; - local_30 = local_38; - (**(code **)(*piVar16 + 0x3c))(); - if (GHIDRA_CAST(piVar16[0xf0]) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(piVar16[0xf0]) + 0x3c))(); - } - if (GHIDRA_CAST(piVar16[0x14f]) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(piVar16[0x14f]) + 0x3c))(); - } - } - piVar16 = GHIDRA_CAST((GHIDRA_INT(local_10c.y) + 4)); - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + -1); - local_10c.y = (float)piVar16; - } while (local_c0.y != 0.0); - isRedirected = '\x01'; - local_fc = 0.0; - local_114.y = (float)(GHIDRA_UINT(local_114.y) & 0xffffff00); - local_c0.y = 0.0; - } - } -LAB_00974ed9: - local_c1 = false; - if (((this->_spawnerType != 1) && (this->_spawnerType != 3)) || - (1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) { - local_f0.y = 0.0; - local_f0.x = 0.0; - local_cc.y = 0.0; - local_cc.x = 0.0; - pEVar17 = GHIDRA_CAST(HomingLaser)::find_targets(); - local_b4 = pEVar17; - if (pEVar17 == GHIDRA_CAST(0x0)) { - piVar16 = this->_bounceLaser; - if (((piVar16 != GHIDRA_CAST(0x0)) && (piVar16[0xef] != 0)) && - (*GHIDRA_CAST((piVar16[0xef] + 0x28)) == 1)) { - (**(code **)(*piVar16 + 0x28))(); - } - } - else { - local_d4[0] = (Entity_Player *) - ((float)(pEVar17->_bodySprite)._overlayAnimState._layerFrames * 0.017453292) - ; - local_c0.y = sin((float)local_d4[0]); - fVar20 = cos((float)local_d4[0]); - fVar23 = fVar20 * local_cc.x + local_c0.y * local_cc.y; - fVar20 = atan2f(local_cc.y - fVar23 * (local_c0.y + local_c0.y), - local_cc.x - fVar23 * (fVar20 + fVar20)); - spawnedLaser = GHIDRA_CAST((fVar20 * 57.295776)); - local_d4[0] = spawnedLaser; - (GHIDRA_CAST((&bounceLaserColor)))->Color::Color(); - iVar8 = this->_variant; - if ((iVar8 != 5) && (iVar8 != 10)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x0))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x4))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x8))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0xc))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x10))) = 5.0; - fStack_44 = 5.0; - fStack_40 = 4.0; - fStack_3c = 1.0; - local_38 = 0.0; - local_34 = 0.0; - local_30 = 0.0; - (GHIDRA_CAST((this_01)))->Color::operator_assign(GHIDRA_CAST(local_58)); - iVar8 = extraout_EDX; - } - pEVar10 = GHIDRA_CAST(pEVar17->_parent); - if ((pEVar10 == GHIDRA_CAST(0x0)) || (pEVar10->_type != 1)) { - pEVar10 = GHIDRA_CAST(0x0); - } - if (this->_bounceLaser == (void *)0x0) { - spawnedLaser = ShootAngle(iVar8,&local_f0,(float)spawnedLaser,this->_timeout, - &this->_posOffset,pEVar10,1); - if (spawnedLaser != GHIDRA_CAST(0x0)) { - pcVar1 = *(code **)(*GHIDRA_CAST(spawnedLaser) + 0x3c); - spawnedLaser->_disableFollowParent = 1; - spawnedLaser->_prismTouched = 1; - (*pcVar1)(); - spawnedLaser->SetCollisionDamage(); - spawnedLaser->_renderDepthOffset = this->_renderDepthOffset + 100.0; - spawnedLaser->_timeout = this->_timeout; - if ((this->_shrink == 0) && (this->_dead == 0)) { - bVar6 = 0; - } - else { - bVar6 = 1; - } - spawnedLaser->_shrink = bVar6; - spawnedLaser->Update(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bounceLaser))))->EntityPtr::SetReference(GHIDRA_CAST(spawnedLaser)); - } - } - else { - piVar16 = GHIDRA_CAST(__RTDynamicCast()); - (**(code **)(*piVar16 + 0x3c))(); - (**(code **)(*piVar16 + 0x40))(); - piVar16[0xd6] = GHIDRA_INT((this->_renderDepthOffset + 100.0)); - piVar16[0x116] = this->_timeout; - if ((this->_shrink == 0) && (this->_dead == 0)) { - isFading = 0; - } - else { - isFading = 1; - } - *GHIDRA_CAST((GHIDRA_CAST(piVar16) + 0x45e)) = isFading; - iVar8 = piVar16[0x107]; - piVar16[0x106] = GHIDRA_INT(local_d4[0]); - piVar16[0x107] = GHIDRA_INT(local_d4[0]); - piVar16[0x108] = iVar8; - piVar16[0x3b] = GHIDRA_INT(((float)local_d4[0] - 90.0)); - piVar16[0xcf] = GHIDRA_INT(local_f0.x); - piVar16[0xd0] = GHIDRA_INT(local_f0.y); - } - fVar20 = (float)(g_game->_frameCount - local_b4->_spawnFrame); - if (GHIDRA_INT(fVar20) < 0x96) { - fVar20 = (local_b4->_bodySprite)._animState._animFrame; - fVar23 = 4.2039e-44; - if (0x1e < GHIDRA_INT(fVar20)) { - fVar23 = fVar20; - } - (local_b4->_bodySprite)._animState._animFrame = fVar23; - *GHIDRA_CAST(&(local_b4->_bodySprite)._animState._isPlaying) = fVar23; - } - local_fc = (float)CONCAT31((int3)(GHIDRA_UINT(fVar20) >> 8),1); - isRedirected = '\x01'; - local_114.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_114.y)) + 0x1))),1); - local_c1 = true; - } - } - if (((this->_spawnerType == 1) || - ((this->_spawnerType == 3 && (this->_spawnerVariant != 0x65)))) && - (this->_prismTouched == 0)) { - local_f0.y = 0.0; - local_f0.x = 0.0; - local_cc.y = 0.0; - local_cc.x = 0.0; - piVar16 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504)))); - iVar8 = HomingLaser::find_targets(); - if (iVar8 == 0) { - local_c0.y = (float)&DAT_00000004; - do { - if (GHIDRA_CAST(*piVar16) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*piVar16) + 0x28))(); - } - piVar16 = piVar16 + 1; - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + -1); - } while (GHIDRA_CAST(local_c0.y) != GHIDRA_CAST(0x0)); - piVar16 = GHIDRA_CAST(this->_child); - iVar8 = 0; - if (piVar16 != GHIDRA_CAST(0x0)) { - if (((((this->_bounceLaser == (void *)0x0) || (piVar16[10] != 1000)) || - (piVar16[0xb] != 0x32)) || (piVar16[0xc] == 4)) || - ((this->_variant != 6 && (this->_variant != 0xf)))) goto LAB_00975711; - (**(code **)(*piVar16 + 0x28))(); - iVar8 = extraout_ECX_00; - } - spawn_impact_effect(this,iVar8); - } - else if (((*piVar16 == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x508)))) == 0)) || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x50c)))) == 0 || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x510)))) == 0)))) { - local_c0.y = 0.0; - do { - fVar20 = local_c0.y; - pEVar17 = GHIDRA_CAST((GHIDRA_INT((&this->_splatColor + 0x12)) + GHIDRA_INT(local_c0.y) * 4 + 8)); - local_b4 = pEVar17; - if (*GHIDRA_CAST((GHIDRA_CAST((&this->_splatColor + 0x12)) + GHIDRA_INT(local_c0.y) * 4 + 8)) == 0) { - fVar23 = atan2f(local_cc.y,local_cc.x); - fVar23 = fVar23 * 57.295776; - if (fVar20 == 0.0) { - fVar23 = fVar23 - 30.0; - } - else if (fVar20 == 1.4013e-45) { - fVar23 = fVar23 - 10.0; - } - else if (fVar20 == 2.8026e-45) { - fVar23 = fVar23 + 10.0; - } - else if (fVar20 == 4.2039e-45) { - fVar23 = fVar23 + 30.0; - } - spawnedLaser = ShootAngle(this->_variant,&local_f0,fVar23,this->_timeout, - &this->_posOffset,GHIDRA_CAST(this->_parent),1); - pEVar17 = GHIDRA_CAST(0x0); - if (spawnedLaser != GHIDRA_CAST(0x0)) { - spawnedLaser->_disableFollowParent = 1; - copy_from_parent(spawnedLaser,this,1); - spawnedLaser->_prismTouched = 1; - spawnedLaser->Update(); - if (*GHIDRA_CAST(local_b4) != 0) { - local_d4[0] = local_b4; - msvc::multiset::erase(); - } - *GHIDRA_CAST(local_b4) = spawnedLaser; - pEVar17 = GHIDRA_CAST(std)::multiset::insert(); - } - } - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + 1); - } while (GHIDRA_INT(local_c0.y) < 4); - local_fc = (float)(GHIDRA_UINT(pEVar17) & 0xffffff00); - this->_chainedLasers = 0; - isRedirected = '\x01'; - local_114.y = (float)(GHIDRA_UINT(local_114.y) & 0xffffff00); - } - else { - iVar8 = 0; - local_c0.y = 0.0; - fVar20 = atan2f(local_cc.y,local_cc.x); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(extraout_var_00)) + 0x0))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0))) = fVar20; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x8))) = (*GHIDRA_CAST((GHIDRA_CAST(&(extraout_var_00)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0xc))) = (*GHIDRA_CAST((GHIDRA_CAST(&(extraout_var_00)) + 0x8))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x0))) = GHIDRA_CAST((fVar20 * 57.295776)); - local_d4[0] = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x0))); - do { - fVar23 = 30.0; - local_b4 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x0))); - (GHIDRA_CAST((&prismLaserColor)))->Color::Color(); - fVar20 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x0))); - if (iVar8 == 0) { - local_b4 = GHIDRA_CAST((fVar20 - fVar23)); - } - else { - if (iVar8 == 1) { - local_b4 = GHIDRA_CAST((fVar20 - 10.0)); - (GHIDRA_CAST((&prismColor1)))->Color::Reset(); - fVar20 = 0.7843138; - prismLaserColor._tint[1] = 2.0; - prismLaserColor._tint[2] = 1.0; - prismColor1._offset[2] = 0.0; - prismLaserColor._offset[2] = 0.0; - prismLaserColor._colorize[0] = prismColor1._colorize[0]; - prismLaserColor._colorize[1] = prismColor1._colorize[1]; - prismLaserColor._colorize[2] = prismColor1._colorize[2]; - prismLaserColor._colorize[3] = prismColor1._colorize[3]; - fVar23 = 0.3921569; - } - else { - if (iVar8 == 2) { - local_b4 = GHIDRA_CAST((fVar20 + 10.0)); - (GHIDRA_CAST((&prismColor2)))->Color::Reset(); - fVar20 = 0.7843138; - prismColor2._offset[2] = 0.3921569; - prismLaserColor._offset[2] = 0.3921569; - prismLaserColor._tint[1] = 2.0; - prismLaserColor._tint[2] = 1.0; - prismLaserColor._colorize[0] = prismColor2._colorize[0]; - prismLaserColor._colorize[1] = prismColor2._colorize[1]; - prismLaserColor._colorize[2] = prismColor2._colorize[2]; - prismLaserColor._colorize[3] = prismColor2._colorize[3]; - } - else { - if (iVar8 != 3) goto LAB_0097548c; - local_b4 = GHIDRA_CAST((fVar20 + fVar23)); - (GHIDRA_CAST((&prismColor3)))->Color::Reset(); - fVar20 = 0.3921569; - prismColor3._offset[2] = 0.7843138; - prismLaserColor._offset[2] = 0.7843138; - prismLaserColor._tint[1] = 1.0; - prismLaserColor._tint[2] = 2.0; - prismLaserColor._colorize[0] = prismColor3._colorize[0]; - prismLaserColor._colorize[1] = prismColor3._colorize[1]; - prismLaserColor._colorize[2] = prismColor3._colorize[2]; - prismLaserColor._colorize[3] = prismColor3._colorize[3]; - } - fVar23 = -0.7843138; - } - prismLaserColor._tint[3] = 1.0; - prismLaserColor._tint[0] = 1.0; - prismLaserColor._offset[1] = fVar20; - prismLaserColor._offset[0] = fVar23; - } -LAB_0097548c: - spawnedLaser = GHIDRA_CAST(__RTDynamicCast()); - copy_from_parent(spawnedLaser,this,0); - spawnedLaser->SetColor(); - fVar20 = spawnedLaser->_angleDegrees; - auVar22 = ZEXT416(local_d4[0]); - spawnedLaser->_startAngleDegrees = (float)local_b4; - spawnedLaser->_angleDegrees = (float)local_b4; - spawnedLaser->_lastAngleDegrees = fVar20; - (spawnedLaser->_sprite)._rotation = (float)local_b4 - 90.0; - (spawnedLaser->_pos).x = local_f0.x; - (spawnedLaser->_pos).y = local_f0.y; - iVar8 = GHIDRA_INT(local_c0.y) + 1; - local_c0.y = (float)iVar8; - } while (iVar8 < 4); - local_fc = (float)(GHIDRA_UINT(fVar20) & 0xffffff00); - isRedirected = '\x01'; - local_114.y = (float)(GHIDRA_UINT(local_114.y) & 0xffffff00); - } - } -LAB_00975711: - pBVar13 = &this->_tearFlags; - pBVar27 = BitSet128::operator_and(GHIDRA_CAST(local_160),pBVar13,&g_tearFlagContinuum); - if ((((GHIDRA_INT(pBVar27->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar27->_l) + 4)) == 0) && - (GHIDRA_INT(pBVar27->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar27->_h) + 4)) == 0)) || - (isRedirected != '\0')) || (this->_isGridHit != 0)) { - if (GHIDRA_CAST(this->_continuumLaser) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_continuumLaser) + 0x28))(); - } - } - else { - pfVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - pvVar9 = ((GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x464)))->_bezier)._end; - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x464))))) + 0x20)))) - GHIDRA_INT(pfVar11) >> 3 - ; - local_cc.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -8)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -0x10)); - local_cc.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -4)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + -0xc)); - local_120.x = pfVar11[iVar8 * 2 + -2]; - local_120.y = pfVar11[iVar8 * 2 + -1]; - local_c0.y = sqrtf((pfVar11[1] - local_120.y) * (pfVar11[1] - local_120.y) + - (*pfVar11 - local_120.x) * (*pfVar11 - local_120.x)); - game = g_game; - local_d4[0] = GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x34c)); - local_f0.x = pfVar11[iVar8 * 2 + -2] + (GHIDRA_CAST(local_d4[0]))->x; - local_f0.y = pfVar11[iVar8 * 2 + -1] + (GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x34c)))->y; - Room::GetClampedPositionImpl(g_game->_room,&local_130,&local_f0,-131.0,-131.0,-131.0,-131.0) - ; - uVar15 = 0; - do { - Room::ScreenWrapPositionImpl(game->_room,&local_f0,&local_130,-130.0,-130.0,-130.0,-130.0) - ; - bVar6 = (GHIDRA_CAST((&local_f0)))->Vector::operator_eq(&local_130); - if (bVar6 != 0) break; - uVar15 = uVar15 + 1; - local_130.x = local_f0.x; - local_130.y = local_f0.y; - } while (uVar15 < 4); - (GHIDRA_CAST((&local_130)))->Vector::operator__(GHIDRA_CAST(local_d4[0])); - this = GHIDRA_CAST(local_150.y); - spawnedLaser = *GHIDRA_CAST((GHIDRA_CAST(local_150.y) + 0x538)); - bVar6 = (GHIDRA_CAST((this_02)))->Vector::operator_ne(&local_120); - if (bVar6 == 0) { - if (spawnedLaser != GHIDRA_CAST(0x0)) { - spawnedLaser->Remove(); - } - } - else if (spawnedLaser == GHIDRA_CAST(0x0)) { - local_d4[0] = GHIDRA_CAST((GHIDRA_CAST((&local_cc)))->Vector)::GetAngleDegrees(); - spawnedLaser = ShootAngle(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)),&local_130,(float)local_d4[0], - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x458)),GHIDRA_CAST((GHIDRA_INT(this) + 0x34c)), - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3bc)),1); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this) + 0x538)))))->EntityPtr::Set(GHIDRA_CAST(spawnedLaser)); - if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)) != 0) { - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)) + 0x518)) = 1; - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)) + 0x4e4)) = 1; - copy_from_parent(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)),this,1); - FUN_0096d120(); - if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x515)) == 0) { - spawnedLaser = this; - } - else { - spawnedLaser = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3bc)); - } - (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)))))->Entity::SetParent(GHIDRA_CAST(spawnedLaser)); - spawnedLaser = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)); - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x560)) = 0; - if (spawnedLaser != GHIDRA_CAST(0x0)) goto LAB_009759d5; - } - } - else { -LAB_009759d5: - copy_from_parent(spawnedLaser,this,0); - pBVar13 = (GHIDRA_CAST((&g_tearFlagContinuum)))->BitSet128::__bnot(GHIDRA_CAST(local_160)); - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)); - pBVar13 = BitSet128::operator_and(&local_170,GHIDRA_CAST((iVar8 + 0x428)),pBVar13); - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)); - qVar4 = pBVar13->_h; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)); - *GHIDRA_CAST((iVar8 + 0x428)) = GHIDRA_INT(pBVar13->_l); - *GHIDRA_CAST((iVar8 + 0x42c)) = uVar29; - *GHIDRA_CAST((iVar8 + 0x430)) = GHIDRA_INT(qVar4); - *GHIDRA_CAST((iVar8 + 0x434)) = uVar3; - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)); - *GHIDRA_CAST((iVar8 + 0x33c)) = local_130.x; - *GHIDRA_CAST((iVar8 + 0x340)) = local_130.y; - local_d4[0] = GHIDRA_CAST((GHIDRA_CAST((&local_cc)))->Vector)::GetAngleDegrees(); - (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)))))->Entity_NPC::SetAimAngle((float)local_d4[0]); - pfVar11 = GHIDRA_CAST((GHIDRA_INT(this) + 0x538)); - iVar8 = GHIDRA_INT(*pfVar11); - if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x4d0)) <= 0.0) { - pEVar17 = GHIDRA_CAST(0x0); - } - else { - local_d4[0] = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x4d0)) - local_c0.y)); - local_c0.y = 10.0; - pfVar11 = GHIDRA_CAST(local_d4); - if ((float)local_d4[0] <= 10.0) { - pfVar11 = &local_c0.y; - } - pEVar17 = GHIDRA_CAST(*pfVar11); - } - *GHIDRA_CAST((iVar8 + 0x4d0)) = pEVar17; - if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x515)) != 0) { - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)) + 0x540)) = 2; - pfVar11 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)); - *GHIDRA_CAST((GHIDRA_CAST(pfVar11) + 0x171)) = 0; - } - if ((char)(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)))[0x117] != '\0') { - pfVar11 = GHIDRA_CAST((**(code **)(**GHIDRA_CAST((GHIDRA_CAST(this) + 0x538)) + 0xc))()); - } - local_fc = (float)(GHIDRA_UINT(pfVar11) & 0xffffff00); - isRedirected = '\x01'; - local_114.y = (float)(GHIDRA_UINT(local_114.y) & 0xffffff00); - } - pBVar13 = GHIDRA_CAST((GHIDRA_INT(this) + 0x428)); - } - if (local_c1 == false) { - pBVar13 = BitSet128::operator_and(GHIDRA_CAST(local_160),pBVar13,&g_tearFlagBounce); - bVar6 = (GHIDRA_CAST((pBVar13)))->BitSet128::IsNonZero(); - if ((bVar6 == 0) || (isRedirected != '\0')) { - iVar8 = 0; - if (this->_bounceLaser != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_bounceLaser) + 0x28))(); - iVar8 = extraout_ECX_01; - } - spawn_impact_effect(this,iVar8); - } - else { - local_d4[0] = GHIDRA_CAST(0x3ecccccd); - (GHIDRA_CAST((&this->_posOffset)))->Vector::__mul(&local_140,GHIDRA_CAST(local_d4)); - local_c0.y = (float)__RTDynamicCast(); - pVVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - GHIDRA_INT(pVVar14) >> 3; - local_cc.x = pVVar14[iVar8 + -1].x; - local_cc.y = pVVar14[iVar8 + -1].y; - local_130.y = (GHIDRA_CAST((&local_cc)))->Vector::Distance(pVVar14); - iVar8 = 0; - local_120.x = g_vectorZero.x; - local_b4 = GHIDRA_CAST(&g_game->_room); - local_120.y = g_vectorZero.y; - local_d4[0] = GHIDRA_CAST(0x41a00000); - do { - pVVar14 = Vector::FromAngle(&local_188,(float)iVar8); - (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_10c,GHIDRA_CAST(local_d4)); - iVar18 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - sampleCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar18 >> 3; - local_f0.x = *GHIDRA_CAST((iVar18 + -8 + sampleCount * 8)); - local_f0.y = *GHIDRA_CAST((iVar18 + -4 + sampleCount * 8)); - pVVar14 = (GHIDRA_CAST((*GHIDRA_CAST(local_b4))))->Room::GetClampedPosition(&local_178,&local_f0,0.0); - local_f0.x = pVVar14->x; - local_f0.y = pVVar14->y; - pVVar14 = (GHIDRA_CAST((&local_f0)))->Vector::__add(GHIDRA_CAST(&local_1a0._h),&local_10c); - (GHIDRA_CAST((pVVar14)))->Vector::__add(&local_104,&local_140); - local_b4 = GHIDRA_CAST(&g_game->_room); - pos.y = local_104.y; - pos.x = local_104.x; - (GHIDRA_CAST((*GHIDRA_CAST(local_b4))))->Room::GetGridCollisionAtPos(pos); - cVar7 = FUN_0070be60(); - if (cVar7 != '\0') { - (GHIDRA_CAST((&local_120)))->Vector::operator_add_assign(&local_10c); - } - iVar8 = iVar8 + 6; - } while (iVar8 < 0x168); - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - iVar18 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar8 >> 3; - (GHIDRA_CAST((GHIDRA_CAST((iVar8 + (iVar18 + -1) * 8)))))->Vector::__sub(&local_f0, - GHIDRA_CAST((iVar8 + iVar18 * 8 + -0x10))); - (GHIDRA_CAST((&local_120)))->Vector::Normalize(); - pEVar17 = GHIDRA_CAST(local_c0.y); - iVar8 = this->_parent; - local_b4 = GHIDRA_CAST(0x40000000); - if (((iVar8 != 0) && (*GHIDRA_CAST((iVar8 + 0x28)) == 0x104)) && (*GHIDRA_CAST((iVar8 + 0x30)) == 2)) - { - local_d4[0] = GHIDRA_CAST((GHIDRA_CAST((&this->_pos)))->Vector)::Distance(&local_cc); - fVar23 = 250.0; - fVar20 = Math::clamp(0.0,250.0,(float)local_d4[0]); - local_b4 = GHIDRA_CAST((2.0 - (1.0 - fVar20 / fVar23))); - } - local_d4[0] = GHIDRA_CAST((local_f0.x * local_120.x + local_f0.y * local_120.y)); - pVVar14 = (GHIDRA_CAST((&local_120)))->Vector::__mul(GHIDRA_CAST(&local_1a0._h),GHIDRA_CAST(local_d4)); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_188,GHIDRA_CAST(&local_b4)); - (GHIDRA_CAST((&local_f0)))->Vector::__sub(&local_140,pVVar14); - local_b4 = GHIDRA_CAST((GHIDRA_CAST((&local_140)))->Vector)::GetAngleDegrees(); - if (pEVar17 == GHIDRA_CAST(0x0)) { - bVar6 = (GHIDRA_CAST((&local_120)))->Vector::operator_ne(&g_vectorZero); - if (bVar6 != 0) { - pEVar17 = (Entity_Player *) - ShootAngle(this->_variant,&local_cc,(float)local_b4,this->_timeout, - &this->_posOffset,GHIDRA_CAST(this->_parent),1); - local_c0.y = (float)pEVar17; - if (pEVar17 != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_bounceLaser))))->EntityPtr::SetReference(GHIDRA_CAST(pEVar17)); - *GHIDRA_CAST((pEVar17->_bodySprite)._color._offset) = 1; - *GHIDRA_CAST(((pEVar17->_bodySprite)._championColor._offset + 2)) = 1; - copy_from_parent(GHIDRA_CAST(pEVar17),this,1); - FUN_0096d120(); - if (this->_oneHit == 0) { - spawnedLaser = this; - } - else { - spawnedLaser = GHIDRA_CAST(this->_parent); - } - (GHIDRA_CAST((GHIDRA_CAST(pEVar17))))->Entity::SetParent(GHIDRA_CAST(spawnedLaser)); - this->_chainedLasers = 0; - goto LAB_00975f41; - } - } - } - else { -LAB_00975f41: - copy_from_parent(GHIDRA_CAST(pEVar17),this,0); - pBVar13 = (GHIDRA_CAST((&g_tearFlagBounce)))->BitSet128::__bnot(GHIDRA_CAST(local_160)); - pBVar13 = BitSet128::operator_and - (&local_170, - GHIDRA_CAST(((pEVar17->_bodySprite)._filename._buf + 0xc)),pBVar13) - ; - fVar20 = local_c0.y; - uVar15 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)); - qVar4 = pBVar13->_h; - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)); - *GHIDRA_CAST(((pEVar17->_bodySprite)._filename._buf + 0xc)) = GHIDRA_INT(pBVar13->_l); - (pEVar17->_bodySprite)._filename._size = uVar15; - (pEVar17->_bodySprite)._filename._capacity = GHIDRA_UINT(qVar4); - *GHIDRA_CAST((pEVar17->_bodySprite)._animDefaultName._buf) = uVar29; - (GHIDRA_CAST((GHIDRA_INT(local_c0.y) + 0x33c)))->x = local_cc.x; - (GHIDRA_CAST((GHIDRA_INT(local_c0.y) + 0x33c)))->y = local_cc.y; - (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->Entity_NPC::SetAimAngle((float)local_b4); - if (this->_maxDistance <= 0.0) { - pEVar17 = GHIDRA_CAST(0x0); - } - else { - local_d4[0] = GHIDRA_CAST((this->_maxDistance - local_130.y)); - local_c0.y = 10.0; - pfVar11 = GHIDRA_CAST(local_d4); - if ((float)local_d4[0] <= 10.0) { - pfVar11 = &local_c0.y; - } - pEVar17 = GHIDRA_CAST(*pfVar11); - } - ((GHIDRA_CAST((GHIDRA_INT(fVar20) + 0x41c)))->_color)._tint[3] = (float)pEVar17; - if (this->_oneHit != 0) { - ((GHIDRA_CAST((GHIDRA_INT(fVar20) + 0x530)))->_filename)._size = 2; - *GHIDRA_CAST((GHIDRA_CAST(fVar20) + 0x171)) = 0; - } - if (*GHIDRA_CAST(&((GHIDRA_CAST((GHIDRA_INT(fVar20) + 0x41c)))->_animState)._animFrame) != '\0') { - (**(code **)(*GHIDRA_CAST(fVar20) + 0xc))(); - } - } - } - } - if (this->_isGridHit == 0) { - local_fc = (float)(GHIDRA_UINT(local_fc) & 0xff); - if (0 < this->_chainedLasers) { - local_fc = 1.4013e-45; - } - local_114.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_114.y)) + 0x1))),SUB41(local_fc,0)); - } - else { - this->_chainedLasers = 0; - } - update_sample_points(this); - iVar8 = this->_child; - iVar18 = 0; - if (iVar8 != 0) { - local_f0.y = *GHIDRA_CAST((iVar8 + 0x340)); - room = g_game->_room; - local_f0.x = *GHIDRA_CAST((iVar8 + 0x33c)); - pVVar14 = (GHIDRA_CAST((&local_f0)))->Vector::__add(GHIDRA_CAST(&local_1a0._h),GHIDRA_CAST((iVar8 + 0x34c))); - local_f0.x = pVVar14->x; - local_f0.y = pVVar14->y; - iVar18 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(*pVVar14); - } - iVar8 = this->_variant; - if ((((((iVar8 == 1) || (iVar8 == 6)) || (iVar8 == 9)) || - (((iVar8 == 0xb || (iVar8 == 0xc)) || ((iVar8 == 0xe || (iVar8 == 0xf)))))) && - ((0.5 < (this->_sprite)._scale.x && (this->_spawnerType == 1)))) && - (((this->_maxDistance == 0.0 || ((iVar18 != 0 && (iVar18 != 1)))) && - ((this->_isInterpolating == 0 && (cVar7 = _has_flag_0x110(), cVar7 == '\0')))))) { - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - uVar15 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar8 >> 3; - if (1 < uVar15) { - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST((iVar8 + (uVar15 - 2) * 8)))))->Vector::__sub(&local_140, - GHIDRA_CAST((iVar8 + -8 + uVar15 * 8))); - local_d4[0] = GHIDRA_CAST((GHIDRA_CAST((pVVar14)))->Vector)::GetAngleDegrees(); - uVar15 = Random(); - local_d4[0] = (Entity_Player *) - normalize_angle_degrees - (((float)((double)GHIDRA_INT(uVar15) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) * - 2.3283064e-10 * 180.0 + (float)local_d4[0]) - 90.0); - local_c0.y = (float)Random(); - pVVar14 = Vector::FromAngle(&local_140,(float)local_d4[0]); - uVar15 = Random(); - local_d4[0] = (Entity_Player *) - ((float)((double)GHIDRA_INT(uVar15) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) * 2.3283064e-10 * - 10.0 + 1.0); - local_b4 = GHIDRA_CAST((GHIDRA_CAST((pVVar14)))->Vector)::__mul(&local_188,GHIDRA_CAST(local_d4)); - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))); - iVar18 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - pVVar14 = MusicManager::RandomVector(&local_178); - uVar15 = Random(); - local_d4[0] = (Entity_Player *) - ((float)((double)GHIDRA_INT(uVar15) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) * 2.3283064e-10 * - 20.0); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_f0,GHIDRA_CAST(local_d4)); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST((iVar18 + (iVar8 - iVar18 >> 3) * 8 + -8)))))->Vector::__add(&local_cc, - pVVar14); - iVar8 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar29)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar29)) + 0x1))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar29)) + 0x2))) = 0; - fVar28 = 9.80909e-44; - fVar23 = 1.4013e-42; - fVar20 = 1.3902761e-38; - pEVar17 = local_b4; - spawnedLaser = GHIDRA_CAST(local_c0.y); - pEVar12 = (Entity_Player *) - Game::Spawn(g_game,1000,0x46,pVVar14,GHIDRA_CAST(local_b4),GHIDRA_CAST(0x0),0, - GHIDRA_UINT(local_c0.y)); - this = GHIDRA_CAST(local_150.y); - local_d4[0] = pEVar12; - if (*GHIDRA_CAST((GHIDRA_CAST(local_150.y) + 0x3c0)) != 0) { - ANM2::ANM2(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x3b8)), - GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_150.y) + 0x3c0)) + 0x48))); - other._championColor._colorize[0] = in_stack_fffffd2c; - other._filename._buf[0] = in_stack_fffffc48[0]; - other._filename._buf[1] = in_stack_fffffc48[1]; - other._filename._buf[2] = in_stack_fffffc48[2]; - other._filename._buf[3] = in_stack_fffffc48[3]; - other._filename._buf[4] = in_stack_fffffc48[4]; - other._filename._buf[5] = in_stack_fffffc48[5]; - other._filename._buf[6] = in_stack_fffffc48[6]; - other._filename._buf[7] = in_stack_fffffc48[7]; - other._filename._buf[8] = in_stack_fffffc48[8]; - other._filename._buf[9] = in_stack_fffffc48[9]; - other._filename._buf[10] = in_stack_fffffc48[10]; - other._filename._buf[0xb] = in_stack_fffffc48[0xb]; - other._filename._buf[0xc] = in_stack_fffffc48[0xc]; - other._filename._buf[0xd] = in_stack_fffffc48[0xd]; - other._filename._buf[0xe] = in_stack_fffffc48[0xe]; - other._filename._buf[0xf] = in_stack_fffffc48[0xf]; - other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x10))); - other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x14))); - other._animDefaultName._buf[0] = in_stack_fffffc48[0x18]; - other._animDefaultName._buf[1] = in_stack_fffffc48[0x19]; - other._animDefaultName._buf[2] = in_stack_fffffc48[0x1a]; - other._animDefaultName._buf[3] = in_stack_fffffc48[0x1b]; - other._animDefaultName._buf[4] = in_stack_fffffc48[0x1c]; - other._animDefaultName._buf[5] = in_stack_fffffc48[0x1d]; - other._animDefaultName._buf[6] = in_stack_fffffc48[0x1e]; - other._animDefaultName._buf[7] = in_stack_fffffc48[0x1f]; - other._animDefaultName._buf[8] = in_stack_fffffc48[0x20]; - other._animDefaultName._buf[9] = in_stack_fffffc48[0x21]; - other._animDefaultName._buf[10] = in_stack_fffffc48[0x22]; - other._animDefaultName._buf[0xb] = in_stack_fffffc48[0x23]; - other._animDefaultName._buf[0xc] = in_stack_fffffc48[0x24]; - other._animDefaultName._buf[0xd] = in_stack_fffffc48[0x25]; - other._animDefaultName._buf[0xe] = in_stack_fffffc48[0x26]; - other._animDefaultName._buf[0xf] = in_stack_fffffc48[0x27]; - other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x28))); - other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x2c))); - other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x30))); - other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x34))); - other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x38))); - other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x3c))); - other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0x40))); - other._animState._isPlaying = in_stack_fffffc48[0x44]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x45))); - other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x48))); - other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x4c))); - other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x50))); - other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x54))); - other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x58))); - other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x5c))); - other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0x60))); - other._overlayAnimState._isPlaying = in_stack_fffffc48[100]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x65))); - other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x68))); - other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x6c))); - other._overlayRenderFirst = in_stack_fffffc48[0x70]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x71))); - other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x74))); - other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x78))); - other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x7c))); - other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x80))); - other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x84))); - other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x88))); - other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffc48)) + 0x8c))); - other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffc48)) + 0x90))); - other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0x94))); - other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0x98))); - other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0x9c))); - other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xa0))); - other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xa4))); - other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xa8))); - other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xac))); - other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xb0))); - other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xb4))); - other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xb8))); - other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xbc))); - other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xc0))); - other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xc4))); - other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xc8))); - other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xcc))); - other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xd0))); - other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xd4))); - other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xd8))); - other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xdc))); - other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffc48)) + 0xe0))); - other._championColor._colorize[1] = in_stack_fffffd30; - other._championColor._colorize[2] = in_stack_fffffd34; - other._championColor._colorize[3] = in_stack_fffffd38; - other._championColor._offset[0] = fVar20; - other._championColor._offset[1] = fVar23; - other._championColor._offset[2] = fVar28; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x100))) = pVVar14; - other._playbackSpeed = (float)pEVar17; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = (char)uVar29; - other._loaded = SUB41(uVar29,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x10a))) = SUB42(uVar29,2); - other._shadowLayerIndex = iVar8; - other._bitflags = GHIDRA_INT(spawnedLaser); - ANM2::operator_assign(&pEVar12->_sprite,other); - iVar8 = Isaac::Random(3); - ANM2::SetFrame(&pEVar12->_sprite,GHIDRA_CAST("Droplets"),iVar8); - } - (pEVar12->_posOffset).x = (GHIDRA_CAST((GHIDRA_INT(this) + 0x34c)))->x; - (pEVar12->_posOffset).y = (GHIDRA_CAST((GHIDRA_INT(this) + 0x34c)))->y; - pEVar12->SetColor(); - pEVar12->Update(); - } - } - } - if (this->_sampleLaser != 0) { - pBVar13 = BitSet128::operator_and - (&creepFlagTest,&this->_tearFlags,&g_tearFlagMysteriousLiquidCreep); - bVar6 = (GHIDRA_CAST((pBVar13)))->BitSet128::IsNonZero(); - if ((bVar6 != 0) && (bVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(5,this->_index), bVar6 != 0)) { - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))); - local_cc.x = *GHIDRA_CAST((iVar8 + -8)); - local_cc.y = *GHIDRA_CAST((iVar8 + -4)); - pVVar14 = (GHIDRA_CAST((g_game->_room)))->Room::GetClampedPosition(&local_140,&local_cc,15.0); - local_cc.x = pVVar14->x; - local_cc.y = pVVar14->y; - uVar15 = Random(); - Game::Spawn(g_game,1000,0x35,&local_cc,&g_vectorZero,GHIDRA_CAST(this->_spawnerEntity),0,uVar15 - ); - piVar16 = GHIDRA_CAST(__RTDynamicCast()); - local_d4[0] = GHIDRA_CAST(0x3ecccccd); - pVVar14 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_140,GHIDRA_CAST(local_d4)); - piVar16[0x39] = GHIDRA_INT(pVVar14->x); - piVar16[0x3a] = GHIDRA_INT(pVVar14->y); - (**(code **)(*piVar16 + 0xc))(); - } - } - } - iVar8 = this->_parent; - if ((((iVar8 != 0) && (*GHIDRA_CAST((iVar8 + 0x173)) != '\0')) && (*GHIDRA_CAST((iVar8 + 0x28)) != 1000)) && - ((this->_dead = 1, *GHIDRA_CAST((iVar8 + 0x28)) == this->_type && (*GHIDRA_CAST((iVar8 + 0x172)) == '\0')) - )) { - this->Remove(); - } - if ((this->_dead != 0) || (this->_shrink != 0)) { - iVar8 = this->_variant; - if (iVar8 == 2) { - bVar6 = AnimationState::IsLoopingAnimation(&(this->_sprite)._animState); - if (bVar6 != 0) { - ANM2::GetAnimation(this_03,GHIDRA_CAST(&fStack_44)); - local_14 = 1; - SimpleString::operator=(GHIDRA_CAST(&fStack_44),"Fade"); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Play(GHIDRA_CAST(&fStack_44),0); - if (this->_child != 0) { - ANM2::Play(GHIDRA_CAST((this->_child + 0x48)),&DAT_00b1c00c,0); - } - if ((this->_initSeed & 0x1000U) != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(1); - } - local_14 = 0xffffffff; - (GHIDRA_CAST((GHIDRA_CAST(&fStack_44))))->msvc::string::_Tidy_deallocate(); - } - bVar6 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar6 == 0) goto LAB_00976e53; - } - else if ((iVar8 != 10) && (iVar8 != 4)) { - fVar20 = (this->_sprite)._scale.x; - this->_timeout = this->_timeout + -1; - (this->_sprite)._scale.y = (this->_sprite)._scale.y; - (this->_sprite)._scale.x = fVar20 * 0.895; - if (-0x13 < this->_timeout) goto LAB_00976e53; - } - this->Remove(); - } -LAB_00976e53: - if (isSamplesRebuilt != '\0') { - (GHIDRA_CAST((&this->_homingLaser)))->HomingLaser::remove_collinear_samples(0.001); - } - if (local_e1 != 0) { - update_endpoint_and_hits(this); - } - if ((this->_sampleLaser == 0) || (this->_exists == 0)) goto LAB_00977beb; - if (isSamplesRebuilt != '\0') { - local_d4[0] = GHIDRA_CAST(this->_impactDistance); - cVar7 = FUN_007dd460(); - if (((cVar7 == '\0') && (this->_isGridHit == 0)) && - ((SUB41(local_fc,0) != '\0' || - ((this->_parent != 0 && (*GHIDRA_CAST((this->_parent + 0x28)) == 2)))))) { - local_c1 = false; - } - else { - local_c1 = true; - } - if (local_e1 != 0) { - if (local_c1 != false) { - impact_tear_flag_effects(this,&this->_impactPosition,&this->_impactDirection); - } - cVar7 = FUN_007dd460(); - if (((cVar7 != '\0') || (this->_isGridHit != 0)) || (this->_chainedLasers == 0)) { - pBVar13 = BitSet128::operator_or(&popAbsorbMask,&g_tearFlagPop,&g_tearFlagAbsorb); - pBVar13 = BitSet128::operator_and(GHIDRA_CAST(&fStack_40),&this->_activeTearFlags,pBVar13); - bVar6 = (GHIDRA_CAST((pBVar13)))->BitSet128::IsNonZero(); - if (((bVar6 != 0) && (isRedirected == '\0')) && (this->_isGridHit == 0)) { - iVar18 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - sampleCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x464))))) + 0x20)))) - iVar18 >> - 3; - iVar8 = sampleCount + -1; - local_140.x = *GHIDRA_CAST((iVar18 + iVar8 * 8)); - pVVar14 = GHIDRA_CAST((iVar18 + iVar8 * 8)); - local_140.y = pVVar14->y; - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__sub(GHIDRA_CAST(&local_170._h), - GHIDRA_CAST((iVar18 + -0x10 + sampleCount * 8))); - (GHIDRA_CAST((pVVar14)))->Vector::Normalized(&local_f0); - fVar20 = local_150.y; - local_d4[0] = GHIDRA_CAST(0x41a00000); - local_c0.y = *GHIDRA_CAST((GHIDRA_CAST(local_150.y) + 0x4e0)); - (GHIDRA_CAST((&local_f0)))->Vector::operator_mul_assign(GHIDRA_CAST(local_d4)); - bVar6 = is_thick_variant(GHIDRA_CAST(fVar20)); - if (bVar6 != 0) { - uVar15 = Random(); - local_c0.y = ((float)((double)GHIDRA_INT(uVar15) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) * 2.3283064e-10 * - 1.1 + 0.9) * local_c0.y; - uVar15 = Random(); - local_d4[0] = (Entity_Player *) - ((float)((double)GHIDRA_INT(uVar15) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) * 2.3283064e-10 * - 0.3 + 0.8); - (GHIDRA_CAST((&local_f0)))->Vector::operator_mul_assign(GHIDRA_CAST(local_d4)); - } - b_01 = &g_tearFlagLasershot; - b_00 = &g_tearFlagHydrobounce; - b = &g_tearFlagBone; - pBVar27 = &g_tearFlagLudovico; - pBVar13 = BitSet128::operator_or(&local_170,&g_tearFlagQuadsplit,&g_tearFlagSplit); - pBVar13 = BitSet128::operator_or(&local_1b0,pBVar13,pBVar27); - pBVar13 = BitSet128::operator_or(GHIDRA_CAST(local_190),pBVar13,b); - pBVar13 = BitSet128::operator_or(GHIDRA_CAST(local_180),pBVar13,b_00); - pBVar13 = BitSet128::operator_or(GHIDRA_CAST(local_128),pBVar13,b_01); - pBVar13 = (GHIDRA_CAST((pBVar13)))->BitSet128::__bnot(GHIDRA_CAST(local_e0)); - pBVar27 = BitSet128::operator_or - (GHIDRA_CAST(local_138),GHIDRA_CAST((GHIDRA_INT(fVar20) + 0x438)), - &g_tearFlagPiercing); - BitSet128::operator_and(GHIDRA_CAST(local_160),pBVar27,pBVar13); - pBVar13 = BitSet128::operator_and - (&local_170,GHIDRA_CAST((GHIDRA_INT(fVar20) + 0x438)),&g_tearFlagAbsorb); - local_e1 = (GHIDRA_CAST((pBVar13)))->BitSet128::IsNonZero(); - local_130.y = (float)Random(); - local_114.y = *GHIDRA_CAST((GHIDRA_CAST(fVar20) + 0x3c8)); - local_d4[0] = GHIDRA_CAST(0x3f333333); - pVVar14 = Vector::operator_mul(GHIDRA_CAST(&local_170._h),GHIDRA_CAST(local_d4),&local_f0); - pVVar14 = (GHIDRA_CAST((&local_140)))->Vector::__sub(GHIDRA_CAST(&local_1b0._h),pVVar14); - randomOffset = MusicManager::RandomVector(&local_188); - uVar15 = Random(); - local_d4[0] = (Entity_Player *) - ((float)((double)GHIDRA_INT(uVar15) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) * 2.3283064e-10); - randomOffset = (GHIDRA_CAST((randomOffset)))->Vector::__mul(&local_178,GHIDRA_CAST(local_d4)); - local_b4 = GHIDRA_CAST(0x0); - local_d4[0] = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_150.y) + 0x370)) - 6.0)); - scalar = local_d4; - if ((float)local_d4[0] <= 0.0) { - scalar = &local_b4; - } - randomOffset = (GHIDRA_CAST((randomOffset)))->Vector::__mul(&local_120,GHIDRA_CAST(scalar)); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__add(&local_10c,randomOffset); - uVar15 = 0x24; - if (local_e1 == 0) { - uVar15 = 0x21; - } - pEVar17 = (Entity_Player *) - Game::Spawn(g_game,2,uVar15,pVVar14,&local_f0,GHIDRA_CAST(local_114.y),0, - GHIDRA_UINT(local_130.y)); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0x0))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0x8))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_160)) + 0xc))); - local_b4 = pEVar17; - (GHIDRA_CAST((GHIDRA_CAST(pEVar17))))->Entity_Tear::SetTearFlags(flags); - this = GHIDRA_CAST(local_150.y); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar17) + 0x3c); - get_tear_spawn_color(GHIDRA_CAST(local_150.y),GHIDRA_CAST(&bounceLaserColor)); - (*pcVar1)(); - pEVar17 = local_b4; - local_b4->SetCollisionDamage(); - (GHIDRA_CAST((GHIDRA_CAST(pEVar17))))->Entity_Tear::SetScale(local_c0.y); - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&pEVar17->_flags) + 4)); - *GHIDRA_CAST(&pEVar17->_flags) = GHIDRA_UINT(pEVar17->_flags) | 0x80000; - *GHIDRA_CAST((GHIDRA_INT(&pEVar17->_flags) + 4)) = uVar29; - local_d4[0] = GHIDRA_CAST(FUN_0096ce70()); - pEVar17 = local_b4; - puVar19 = *GHIDRA_CAST(local_d4[0]); - if (puVar19 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_d4[0])) + 0x4))))) { - do { - sorted_vector_insert_unique(&(pEVar17->_bodySprite)._animDefaultName._size,*puVar19); - puVar19 = puVar19 + 1; - } while (puVar19 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_d4[0])) + 0x4))))); - this = GHIDRA_CAST(local_150.y); - } - } - } - } - if (local_c1 == false) { -LAB_0097777a: - piVar16 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x530)))); - local_c0.y = 2.8026e-45; - do { - if (GHIDRA_CAST(*piVar16) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*piVar16) + 0x28))(); - } - piVar16 = piVar16 + 1; - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + -1); - } while (local_c0.y != 0.0); - } - else { - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_160),&this->_activeTearFlags,&g_tearFlagSplit); - bVar6 = (GHIDRA_CAST((pBVar13)))->BitSet128::IsNonZero(); - if (bVar6 == 0) goto LAB_0097777a; - local_120.y = 0.0; - local_120.x = 0.0; - local_f0.y = 0.0; - local_f0.x = 0.0; - cVar7 = FUN_007dd460(); - if (cVar7 == '\0') { - this->_subLaserDistance = INFINITY; - get_segment_start_dir(this,&local_120,&local_f0,INFINITY); - local_b4 = GHIDRA_CAST((GHIDRA_CAST((&local_f0)))->Vector)::GetAngleDegrees(); -LAB_0097754c: - pEVar17 = local_b4; -LAB_00977554: - this->_subLaserAngle = (float)pEVar17; - pVVar14 = Vector::FromAngle(GHIDRA_CAST(&local_170._h),(float)pEVar17); - local_d4[0] = GHIDRA_CAST(0x3e800000); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(GHIDRA_CAST(&local_1b0._h),GHIDRA_CAST(local_d4)); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_188,&this->_size); - (GHIDRA_CAST((&local_120)))->Vector::operator__(pVVar14); - local_c0.y = 0.0; - do { - spawnedLaser = *(void **)(GHIDRA_CAST((&this->_splatColor + 0x13)) + (GHIDRA_INT(local_c0.y) + 2) * 4); - this_00 = GHIDRA_CAST((GHIDRA_INT((&this->_splatColor + 0x13)) + (GHIDRA_INT(local_c0.y) + 2) * 4)); - if (spawnedLaser == GHIDRA_CAST(0x0)) { - spawnedLaser = ShootAngle(this->_variant,&local_120,0.0,this->_timeout,&this->_posOffset - ,GHIDRA_CAST(this->_parent),1); - (GHIDRA_CAST((this_00)))->EntityPtr::Set(GHIDRA_CAST(spawnedLaser)); - if (*GHIDRA_CAST(this_00) != 0) { - *GHIDRA_CAST((*GHIDRA_CAST(this_00) + 0x518)) = 1; - *GHIDRA_CAST((*GHIDRA_CAST(this_00) + 0x4e4)) = 1; - copy_from_parent(*GHIDRA_CAST(this_00),this,1); - FUN_0096d120(); - if (this->_oneHit == 0) { - spawnedLaser = this; - } - else { - spawnedLaser = GHIDRA_CAST(this->_parent); - } - (GHIDRA_CAST((*GHIDRA_CAST(this_00))))->Entity::SetParent(GHIDRA_CAST(spawnedLaser)); - spawnedLaser = *GHIDRA_CAST(this_00); - spawnedLaser->_scale = this->_scale * 0.8; - ResetSpriteScale(spawnedLaser); - spawnedLaser = *GHIDRA_CAST(this_00); - if (spawnedLaser != GHIDRA_CAST(0x0)) goto LAB_00977677; - } - fVar20 = local_c0.y; - } - else { -LAB_00977677: - copy_from_parent(spawnedLaser,this,0); - pBVar13 = BitSet128::operator_or - (GHIDRA_CAST(local_148),&g_tearFlagContinuum,&g_tearFlagBounce); - pBVar13 = (GHIDRA_CAST((pBVar13)))->BitSet128::__bnot(GHIDRA_CAST(local_180)); - iVar8 = *GHIDRA_CAST(this_00); - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_f8),GHIDRA_CAST((iVar8 + 0x428)),pBVar13); - fVar20 = local_c0.y; - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)); - qVar4 = pBVar13->_h; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)); - *GHIDRA_CAST((iVar8 + 0x428)) = GHIDRA_INT(pBVar13->_l); - *GHIDRA_CAST((iVar8 + 0x42c)) = uVar29; - *GHIDRA_CAST((iVar8 + 0x430)) = GHIDRA_INT(qVar4); - *GHIDRA_CAST((iVar8 + 0x434)) = uVar3; - pvVar9 = *(void **)(GHIDRA_CAST((&this->_splatColor + 0x13)) + (GHIDRA_INT(local_c0.y) + 2) * 4); - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x33c)) = local_120.x; - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x340)) = local_120.y; - if (local_c0.y == 0.0) { - fVar23 = -90.0; - } - else { - fVar23 = 90.0; - } - Entity_NPC::SetAimAngle - (*(void **)(GHIDRA_CAST((&this->_splatColor + 0x13)) + (GHIDRA_INT(local_c0.y) + 2) * 4), - fVar23 + (float)local_b4); - if (this->_oneHit != 0) { - *(uint32_t *) - (GHIDRA_INT(*(void **)(GHIDRA_CAST((&this->_splatColor + 0x13)) + (GHIDRA_INT(fVar20) + 2) * 4)) + 0x540) = - 2; - *(uint8_t *) - (GHIDRA_INT(*(void **)(GHIDRA_CAST((&this->_splatColor + 0x13)) + (GHIDRA_INT(fVar20) + 2) * 4)) + 0x171) = - 0; - } - if ((char)*GHIDRA_CAST((GHIDRA_INT(*(void **)(GHIDRA_INT((&this->_splatColor + 0x13)) + - (GHIDRA_INT(fVar20) + 2) * 4)) + 0x45c)) != '\0') { - (**(code **)(*GHIDRA_CAST(*(void **)(GHIDRA_INT((&this->_splatColor + 0x13)) + - (GHIDRA_INT(fVar20) + 2) * 4)) + 0xc))(); - } - } - local_c0.y = (float)(GHIDRA_INT(fVar20) + 1); - } while (GHIDRA_UINT(local_c0.y) < 2); - goto LAB_009777b9; - } - cVar7 = FUN_007dd460(); - if (cVar7 == '\0') { - fVar20 = this->_impactDistance; - } - else { - fVar20 = Math::lerp(this->_subLaserDistance,this->_impactDistance,0.3,0); - } - local_c1 = cVar7 != '\0'; - this->_subLaserDistance = fVar20; - if (0.0 < fVar20) { - get_segment_start_dir(this,&local_120,&local_f0,fVar20); - local_b4 = GHIDRA_CAST((GHIDRA_CAST((&local_f0)))->Vector)::GetAngleDegrees(); - if (local_c1 == false) goto LAB_0097754c; - fVar20 = angle_difference(this->_subLaserAngle,(float)local_b4); - pEVar17 = GHIDRA_CAST(approach_angle(this->_subLaserAngle,(float)local_b4,fVar20 * 0.4)) - ; - goto LAB_00977554; - } - piVar16 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x530)))); - local_c0.y = 2.8026e-45; - do { - if (GHIDRA_CAST(*piVar16) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*piVar16) + 0x28))(); - } - piVar16 = piVar16 + 1; - local_c0.y = (float)(GHIDRA_INT(local_c0.y) + -1); - } while (local_c0.y != 0.0); - local_c0.y = 0.0; - } - this->_subLaserDistance = INFINITY; - } -LAB_009777b9: - if ((1 < g_game->_frameCount - this->_spawnFrame) && (0 < this->_chainedLasers)) { - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - uVar15 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar8 >> 3; - if (1 < uVar15) { - local_104.x = *GHIDRA_CAST((iVar8 + -8 + uVar15 * 8)); - local_104.y = *GHIDRA_CAST((iVar8 + -4 + uVar15 * 8)); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST((iVar8 + -8 + uVar15 * 8)))))->Vector::__sub(&local_140, - (Vector *) - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))) + uVar15 * 8 + -0x10)); - (GHIDRA_CAST((pVVar14)))->Vector::Normalized(&local_10c); - local_d4[0] = GHIDRA_CAST(0x42200000); - pVVar14 = (GHIDRA_CAST((&local_10c)))->Vector::__mul(&local_140,GHIDRA_CAST(local_d4)); - randomOffset = MusicManager::RandomVector(&local_178); - uVar15 = Random(); - local_d4[0] = (Entity_Player *) - ((float)((double)GHIDRA_INT(uVar15) + __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) * - 2.3283064e-10 * 39.0); - randomOffset = Vector::operator_mul(&local_c0,GHIDRA_CAST(local_d4),randomOffset); - (GHIDRA_CAST((pVVar14)))->Vector::__add(&local_f0,randomOffset); - this = GHIDRA_CAST(local_150.y); - pBVar13 = BitSet128::operator_and - (GHIDRA_CAST(local_148),GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x428)), - &g_tearFlagHoming); - bVar6 = (GHIDRA_CAST((pBVar13)))->BitSet128::IsNonZero(); - if (bVar6 != 0) { - local_c0.y = 1e+08; - local_130.y = (float)g_game->_room; - local_114.x = g_vectorZero.x; - local_114.y = g_vectorZero.y; - local_b4 = GHIDRA_CAST(0x0); - if ((GHIDRA_CAST(local_130.y))->_playerCostumeMap[3]._priority != 0) { - do { - pEVar10 = *(Entity **) - ((GHIDRA_CAST((GHIDRA_INT(local_130.y) + 0x122c)))[3]._index + - GHIDRA_INT(local_b4) * 4); - bVar6 = (GHIDRA_CAST((pEVar10)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (((bVar6 != 0) && (bVar6 = (GHIDRA_CAST((pEVar10)))->Entity::HasEntityFlags(0x20000010), bVar6 == 0)) - && (pEVar10 != *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3bc)))) { - local_140.x = (pEVar10->_pos).x; - local_140.y = (pEVar10->_pos).y; - (GHIDRA_CAST((&local_140)))->Vector::__sub(&local_150,&local_104); - if ((0.0 < local_10c.y * local_150.y + local_150.x * local_10c.x) && - (local_d4[0] = GHIDRA_CAST((GHIDRA_CAST((&local_150)))->Vector)::Length(), - (float)local_d4[0] < local_c0.y)) { - local_114.y = (pEVar10->_pos).y; - local_114.x = (pEVar10->_pos).x; - local_c0.y = (float)local_d4[0]; - } - } - local_b4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_b4)) + 0x1)))); - } while (local_b4 < - GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_130.y) + 0x122c)))[3]._priority)); - } - bVar6 = (GHIDRA_CAST((&local_114)))->Vector::operator_ne(&g_vectorZero); - if (bVar6 != 0) { - pVVar14 = (GHIDRA_CAST((&local_f0)))->Vector::__add(&local_140,other_01); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__sub(&local_178,&local_104); - fVar20 = (GHIDRA_CAST((&local_f0)))->Vector::Length(); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::Resized(GHIDRA_CAST((local_e0 + 8)),fVar20); - local_f0.x = pVVar14->x; - local_f0.y = pVVar14->y; - } - } - bVar6 = 1; - pEVar10 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3bc)); - pVVar14 = GHIDRA_CAST((GHIDRA_INT(this) + 0x34c)); - fVar23 = 4.2039e-45; - fVar20 = (GHIDRA_CAST((&local_f0)))->Vector::GetAngleDegrees(); - spawnedLaser = ShootAngle(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)),&local_104,fVar20,GHIDRA_INT(fVar23),pVVar14, - pEVar10,bVar6); - if (spawnedLaser != GHIDRA_CAST(0x0)) { - spawnedLaser->_disableFollowParent = 1; - copy_from_parent(spawnedLaser,this,1); - pBVar27 = &g_tearFlagBoomerang; - spawnedLaser->_disableInitSound = 1; - pBVar13 = BitSet128::operator_or(&orbitMask,&g_tearFlagOrbit,&g_tearFlagOrbitAdvanced); - pBVar13 = BitSet128::operator_or(&orbitBoomerangMask,pBVar13,pBVar27); - pBVar13 = (GHIDRA_CAST((pBVar13)))->BitSet128::__bnot(¬OrbitBoomerangMask); - pBVar13 = BitSet128::operator_and(&inheritedFlags,GHIDRA_CAST((GHIDRA_INT(this) + 0x438)),pBVar13); - qVar4 = pBVar13->_l; - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_l) + 4)); - qVar5 = pBVar13->_h; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&pBVar13->_h) + 4)); - spawnedLaser->_timeout = 3; - *GHIDRA_CAST(&(spawnedLaser->_tearFlags)._l) = GHIDRA_INT(qVar4); - *GHIDRA_CAST((GHIDRA_INT(&(spawnedLaser->_tearFlags)._l) + 4)) = uVar29; - *GHIDRA_CAST(&(spawnedLaser->_tearFlags)._h) = GHIDRA_INT(qVar5); - *GHIDRA_CAST((GHIDRA_INT(&(spawnedLaser->_tearFlags)._h) + 4)) = uVar3; - (GHIDRA_CAST((GHIDRA_CAST(spawnedLaser))))->Entity::SetParent(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x3bc))); - fVar20 = (GHIDRA_CAST((&local_f0)))->Vector::Length(); - spawnedLaser->_maxDistance = fVar20; - spawnedLaser->_chainedLasers = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x560)) + -1; - spawnedLaser->Update(); - SoundEffects::PlayWithFartOverride(0x86,(float)*GHIDRA_CAST((GHIDRA_CAST(this) + 0x560)) * 0.15,2,0,1.0); - } - } - this->_chainedLasers = 0; - } -LAB_00977beb: - if (((0 < this->_timeout) && (this->_isInterpolating == 0)) && - (iVar8 = this->_timeout + -1, this->_timeout = iVar8, iVar8 < 1)) { - if ((((this->_variant == 6) || (this->_variant == 0xf)) && (this->_shrink == 0)) && - (this->_dead == 0)) { - SoundEffects::PlayWithFartOverride(0x118,1.0,2,0,1.0); - } - bVar6 = is_thick_variant(this); - if (((bVar6 == 0) || (iVar8 = this->_variant, iVar8 == 0xd)) || - (((iVar8 == 6 || (iVar8 == 0xf)) && (this->_spawnerType != 1)))) { - this->_dead = 1; - } - else { - this->_shrink = 1; - this->_timeout = 0; - } - } - this->_lastAngleDegrees = this->_angleDegrees; - ExceptionList = local_1c; - return; -} - -// 00977cc0 -void Entity_Laser::Update() -{ - uint32_t *puVar1; - uint64_t *pqVar2; - uint32_t *puVar3; - uint32_t uVar4; - uint32_t uVar5; - Entity_Laser *pEVar6; - uint64_t qVar7; - uint8_t bVar8; - BitSet128 *maskedFlags; - BitSet128 *pBVar9; - int iVar10; - uint8_t *curAnimChar; - uint32_t uVar11; - Entity *tmpEntity; - char *freePtr; - std_string *defaultAnimChar; - uint32_t extraout_EDX; - bool isLess; - float scaleY; - Entity *local_4c; - Entity *local_48; - std_string *local_44; - uint8_t local_40 [24]; - uint8_t local_28 [8]; - float fStack_20; - float fStack_1c; - float fStack_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint8_t *animData; - Entity_Laser *chainLaser; - Manager *manager; - Entity_Laser *nextLaser; - int *spriteFlags; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0cb35; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((local_28 + 0x24)); - ExceptionList = &local_10; - pBVar9 = &this->_tearFlags; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST((local_28 + 4)),pBVar9,&g_tearFlagWait); - if ((((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - (iVar10 = this->_subtype, iVar10 != 1)) && - (((iVar10 != 2 && (iVar10 != 3)) && (0 < this->_timeout)))) { - maskedFlags = (GHIDRA_CAST((&g_tearFlagWait)))->BitSet128::__bnot(GHIDRA_CAST((local_28 + 4))); - local_44 = GHIDRA_CAST(this->_scale); - *GHIDRA_CAST(&pBVar9->_l) = GHIDRA_UINT(pBVar9->_l) & GHIDRA_UINT(maskedFlags->_l); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - *puVar1 = *puVar1 & *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)); - pqVar2 = &(this->_tearFlags)._h; - *GHIDRA_CAST(pqVar2) = GHIDRA_UINT(*pqVar2) & GHIDRA_UINT(maskedFlags->_h); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *puVar1 = *puVar1 & *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)); - *GHIDRA_CAST(&(this->_heldTearFlags)._l) = GHIDRA_UINT((this->_heldTearFlags)._l) | GHIDRA_UINT(g_tearFlagWait._l); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._l) + 4)); - *puVar1 = *puVar1 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWait._l)) + 0x4))); - pqVar2 = &(this->_heldTearFlags)._h; - *GHIDRA_CAST(pqVar2) = GHIDRA_UINT(*pqVar2) | GHIDRA_UINT(g_tearFlagWait._h); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._h) + 4)); - *puVar1 = *puVar1 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWait._h)) + 0x4))); - iVar10 = this->_variant; - if ((iVar10 == 0xb) || (iVar10 == 0xe)) { - local_44 = GHIDRA_CAST(((float)local_44 + (float)local_44)); - } - else if ((iVar10 == 6) || (iVar10 == 0xf)) { - local_44 = GHIDRA_CAST(((float)local_44 * 3.0)); - } - else if (iVar10 == 0xd) { - local_44 = GHIDRA_CAST(((float)local_44 * 5.0)); - } - bVar8 = is_thick_variant(this); - uVar11 = 0x47; - if (bVar8 == 0) { - uVar11 = 0x7e; - } - local_4c = Game::Spawn(g_game,1000,uVar11,&this->_pos,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),0,this->_initSeed); - tmpEntity = GHIDRA_CAST(this->_tearWaitEffect); - puVar3 = &this->_tearWaitEffect; - if (tmpEntity != local_4c) { - if (tmpEntity != GHIDRA_CAST(0x0)) { - local_48 = GHIDRA_CAST(puVar3); - msvc::multiset::erase(&local_48); - } - *puVar3 = local_4c; - tmpEntity = GHIDRA_CAST(0x0); - if (local_4c != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(puVar3); - tmpEntity = GHIDRA_CAST(this->_tearWaitEffect); - } - } - local_48 = GHIDRA_CAST(&tmpEntity->_child); - if (*GHIDRA_CAST(local_48) != 0) { - local_4c = local_48; - msvc::multiset::erase(&local_4c); - } - *GHIDRA_CAST(local_48) = this; - msvc::multiset::insert(local_48); - iVar10 = *puVar3; - *GHIDRA_CAST((iVar10 + 0x34c)) = (this->_posOffset).x; - *GHIDRA_CAST((iVar10 + 0x350)) = (this->_posOffset).y; - iVar10 = *puVar3; - scaleY = (float)local_44 * g_vectorOne.y; - *GHIDRA_CAST((iVar10 + 0xe4)) = (float)local_44 * g_vectorOne.x; - *GHIDRA_CAST((iVar10 + 0xe8)) = scaleY; - (**(code **)(*GHIDRA_CAST(*puVar3) + 0x3c))(&this->_color,0xffffffff,0xff,0,1); - (**(code **)(*GHIDRA_CAST(*puVar3) + 0x40))(this->_collisionDamage); - iVar10 = *puVar3; - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - qVar7 = (this->_tearFlags)._h; - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *GHIDRA_CAST((iVar10 + 0x420)) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((iVar10 + 0x424)) = uVar4; - *GHIDRA_CAST((iVar10 + 0x428)) = GHIDRA_INT(qVar7); - *GHIDRA_CAST((iVar10 + 0x42c)) = uVar5; - if ((this->_parent != 0) && (*GHIDRA_CAST((this->_parent + 0x28)) == 7)) { - *GHIDRA_CAST((*puVar3 + 0x171)) = 0; - } - (**(code **)(*GHIDRA_CAST(*puVar3) + 0xc))(); - local_48 = GHIDRA_CAST(*puVar3); - puVar3 = &this->_parent; - if (*puVar3 != 0) { - local_4c = GHIDRA_CAST(puVar3); - msvc::multiset::erase(&local_4c); - } - *puVar3 = local_48; - if (local_48 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(puVar3); - } - this->_waitFrames = 2; - this->_visible = 0; - this->_disableFollowParent = 1; - } - if (((this->_tearWaitEffect != 0) && (*GHIDRA_CAST((this->_tearWaitEffect + 0x450)) == 0)) && - (this->_waitFrames < 2)) { - this->_waitFrames = 2; - } - nextLaser = GHIDRA_CAST(this->_parentLaser); - pEVar6 = this; - while (chainLaser = nextLaser, chainLaser != GHIDRA_CAST(0x0)) { - pEVar6 = chainLaser; - nextLaser = GHIDRA_CAST(chainLaser->_parentLaser); - } - pBVar9 = BitSet128::operator_and - (GHIDRA_CAST((local_28 + 4)),&pEVar6->_tearFlags,&g_tearFlagRainbow); - if ((GHIDRA_INT(pBVar9->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar9->_l) + 4)) == 0) && - (GHIDRA_INT(pBVar9->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar9->_h) + 4)) == 0)) { - pBVar9 = BitSet128::operator_and - (GHIDRA_CAST((local_28 + 4)),&pEVar6->_tearFlags,&g_tearFlagContinuum); - if ((GHIDRA_INT(pBVar9->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar9->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar9->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar9->_h) + 4)) != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_40))))->Color::Color(); - uVar11 = extraout_EDX & 0x80000007; - if (GHIDRA_INT(uVar11) < 0) { - uVar11 = (uVar11 - 1 | 0xfffffff8) + 1; - } - switch(uVar11) { - case 0: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x10))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x0))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) = 1.0; - break; - case 1: - case 7: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x10))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = GHIDRA_CAST(0x3f200000); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x0))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) = 1.0; - break; - case 2: - case 6: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x10))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = GHIDRA_CAST(0x3fa00000); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x0))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) = 1.0; - break; - case 3: - case 5: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x10))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = GHIDRA_CAST(0x3ff00000); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x0))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) = 1.0; - break; - case 4: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x10))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = GHIDRA_CAST(0x40200000); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x0))) = 2.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) = 1.0; - } - goto LAB_00978138; - } - } - else { - hsv_to_rgb(GHIDRA_CAST(local_28),((float)(g_game->_frameCount % 0x1e) * 360.0) / 30.0,0.9,1.0,1.0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x10))) = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_28)) + 0x0))) * 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_28)) + 0x4))) * 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x0))) = fStack_20 * 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x0))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x4))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x8))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0xc))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) = 1.0; - fStack_20 = 0.0; - fStack_1c = 0.0; - fStack_18 = 0.0; -LAB_00978138: - this->SetColor(local_40,0xffffffff,0xff,0,1); - if (GHIDRA_CAST(this->_child) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_child) + 0x3c))(local_40,0xffffffff,0xff,0,1); - } - if (GHIDRA_CAST(this->_tearWaitEffect) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_tearWaitEffect) + 0x3c))(local_40,0xffffffff,0xff,0,1); - } - } - if (0 < this->_waitFrames) { - iVar10 = this->_waitFrames + -1; - this->_waitFrames = iVar10; - if (0 < iVar10) { - ExceptionList = local_10; - return; - } - this->_visible = 1; - } - if (this->_isFirstUpdate == 0) { - iVar10 = this->_subtype; - if (((iVar10 == 1) || (iVar10 == 2)) || (iVar10 == 3)) { - UpdateHits(this); - } - else { - update_laser(this); - } - if (((this->_variant == 1) && (this->_spawnerEntity != 0)) && - (*GHIDRA_CAST((this->_spawnerEntity + 0x28)) == 0x193)) { - if (this->_dead == 0) { - bVar8 = SFXManager::IsPlaying(&g_manager->_sfxManager,0x3cb); - manager = g_manager; - if (bVar8 == 0) { - local_44 = GHIDRA_CAST(0x3cb); - seed_fart_sound_override(GHIDRA_CAST(&local_44)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44),1.0,2,1,1.0,0.0); - } - } - else { - SFXManager::Stop(&g_manager->_sfxManager,0x3cb); - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - FUN_008616c0(this); - ExceptionList = local_10; - return; - } - iVar10 = this->_spawnerType; - if (iVar10 == 0x27) { - if (this->_parent == 0) goto LAB_009784c5; - if (*GHIDRA_CAST((this->_parent + 0x34)) != 0x109) { - update_first_frame(this); - this->_isFirstUpdate = 0; - ExceptionList = local_10; - return; - } - } - else { - if (iVar10 != 0x44) { - if ((iVar10 != 0x3b6) || (this->_variant != 1)) goto LAB_009784c5; - fStack_1c = 0.0; - fStack_18 = 2.10195e-44; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = msvc::_Allocate(0x20); - fStack_1c = 4.06377e-44; - fStack_18 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_40))) + 0x14))),"gfx/007.001_Static Laser.anm2",0x1e); - local_8 = 1; - ANM2::Load(&this->_sprite,GHIDRA_CAST((local_40 + 0x14)),1); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(fStack_18)) { - uVar11 = GHIDRA_INT(fStack_18) + 1; - freePtr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_40))) + 0x14))); - if (0xfff < uVar11) { - freePtr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) + -4)); - uVar11 = GHIDRA_INT(fStack_18) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) + (-4 - GHIDRA_INT(freePtr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freePtr,uVar11); - } - local_44 = &(this->_sprite)._animDefaultName; - if (0xf < (this->_sprite)._animDefaultName._capacity) { - local_44 = *GHIDRA_CAST(local_44->_buf); - } - animData = (this->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_009784a4: - bVar8 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(local_44),1); - if (bVar8 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimChar = animData; - defaultAnimChar = local_44; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - do { - bVar8 = *curAnimChar; - isLess = bVar8 < (uint8_t)defaultAnimChar->_buf[0]; - if (bVar8 != defaultAnimChar->_buf[0]) { -LAB_00978480: - uVar11 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00978485; - } - if (bVar8 == 0) break; - bVar8 = curAnimChar[1]; - isLess = bVar8 < (uint8_t)defaultAnimChar->_buf[1]; - if (bVar8 != defaultAnimChar->_buf[1]) goto LAB_00978480; - curAnimChar = curAnimChar + 2; - defaultAnimChar = GHIDRA_CAST((defaultAnimChar->_buf + 2)); - } while (bVar8 != 0); - uVar11 = 0; -LAB_00978485: - if ((uVar11 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0))) - ) goto LAB_009784a4; - } - spriteFlags = &(this->_sprite)._bitflags; - *spriteFlags = *spriteFlags | 0x20; - goto LAB_009784c5; - } - iVar10 = this->_parent; - if ((((iVar10 == 0) || (*GHIDRA_CAST((iVar10 + 0x28)) != 0x44)) || (*GHIDRA_CAST((iVar10 + 0x2c)) != 1)) || - (*GHIDRA_CAST((iVar10 + 0x30)) != 1)) goto LAB_009784c5; - } - fStack_1c = 0.0; - fStack_18 = 2.10195e-44; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) = msvc::_Allocate(0x20); - fStack_1c = 4.06377e-44; - fStack_18 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_40))) + 0x14))),"gfx/007.006_CageVisLaser.anm2",0x1e); - local_8 = 0; - ANM2::Load(&this->_sprite,GHIDRA_CAST((local_40 + 0x14)),1); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(fStack_18)) { - uVar11 = GHIDRA_INT(fStack_18) + 1; - freePtr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_40))) + 0x14))); - if (0xfff < uVar11) { - freePtr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) + -4)); - uVar11 = GHIDRA_INT(fStack_18) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x14))) + (-4 - GHIDRA_INT(freePtr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freePtr,uVar11); - } - local_44 = &(this->_sprite)._animDefaultName; - if (0xf < (this->_sprite)._animDefaultName._capacity) { - local_44 = *GHIDRA_CAST(local_44->_buf); - } - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimChar = animData; - defaultAnimChar = local_44; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - do { - bVar8 = *curAnimChar; - isLess = bVar8 < (uint8_t)defaultAnimChar->_buf[0]; - if (bVar8 != defaultAnimChar->_buf[0]) { -LAB_00978314: - uVar11 = -GHIDRA_UINT(isLess) | 1; - goto LAB_00978319; - } - if (bVar8 == 0) break; - bVar8 = curAnimChar[1]; - isLess = bVar8 < (uint8_t)defaultAnimChar->_buf[1]; - if (bVar8 != defaultAnimChar->_buf[1]) goto LAB_00978314; - curAnimChar = curAnimChar + 2; - defaultAnimChar = GHIDRA_CAST((defaultAnimChar->_buf + 2)); - } while (bVar8 != 0); - uVar11 = 0; -LAB_00978319: - if ((uVar11 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_009784c5; - } - bVar8 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(local_44),1); - if (bVar8 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - update_first_frame(this); - this->_isFirstUpdate = 0; - ExceptionList = local_10; - return; - } -LAB_009784c5: - update_first_frame(this); - this->_isFirstUpdate = 0; - ExceptionList = local_10; - return; -} - -// 009785d0 -void Entity_Laser::Render(Vector *offset) -{ - ANM2 *this_00; - uint8_t bVar1; - char cVar2; - Entity_Player *player; - LayerState *layer; - float *pfVar3; - AnimationState *layerFrame; - BitSet128 *maskedTearFlags; - float *pfVar4; - uint32_t uVar5; - uint32_t *texture; - Vector *renderPos; - int extraout_EAX; - int extraout_EAX_00; - int extraout_EAX_01; - int extraout_EAX_02; - KColor *color; - int extraout_ECX; - int extraout_ECX_00; - int extraout_ECX_01; - int iVar6; - KColor *fromColor; - KColor *fromColor_00; - KColor *fromColor_01; - KColor *fromColor_02; - KColor *fromColor_03; - KColor *fromColor_04; - float fVar7; - float fVar8; - float fVar9; - float fVar10; - float segmentCorner0Y; - double dVar11; - uint8_t auStack_338 [20]; - float fStack_324; - void *image; - ColorMod *other; - uint64_t uVar12; - uint64_t uVar13; - uint64_t uVar14; - uint8_t auStack_30a [2]; - uint8_t quad [112]; - BitSet128 tmpTearFlags; - ColorMod tmpColor; - float local_254; - float local_250; - void *local_24c; - float local_248; - uint32_t local_244; - float uv0X; - float uv0Y; - float uv1X; - float uv1Y; - float uv2X; - float uv2Y; - float uv3X; - float uv3Y; - uint8_t local_220; - KColor quadColor; - Color local_208; - float local_1dc; - float local_1d8; - KColor vertexColor; - Vector quadCorner1; - Vector quadCorner2; - Vector local_1b0; - float scaledOffsetY; - float alphaMultiplier; - float scaledOffsetX; - float local_19c; - int shaderMode; - float local_194; - float local_190; - float local_18c; - Vector local_188; - Vector local_180; - float *verticesBegin; - float *verticesEnd; - float *verticesCapacity; - float local_16c; - float local_168; - uint8_t *local_164; - Vector quadCorner3; - float local_158; - float local_154; - float local_150; - float local_14c; - Vector local_148; - float local_140; - float local_13c; - float *local_138; - float local_134; - float local_130; - int *local_12c; - float local_128; - AnimationState *local_124; - float local_120; - uint8_t segmentQuad [4]; - uint8_t firstLayerFrame [108]; - uint8_t frameCopy [24]; - float frameScaleX; - float frameScaleY; - float frameTintR; - float frameTintG; - float frameTintB; - float frameTintA; - float frameColorizeR; - float frameColorizeG; - float frameColorizeB; - float frameColorizeA; - float local_5c [2]; - float frameOffsetB; - ColorMod shaderColor; - uint32_t securityCookie; - void *local_10; - uint8_t *puStack_c; - float local_8; - float renderOffsetX; - char *warnMessage; - - local_8 = -NAN; - puStack_c = &LAB_00b0cb9c; - local_10 = ExceptionList; - securityCookie = __security_cookie ^ GHIDRA_UINT((&shaderColor)[1]._colorize); - if (this->_visible == 0) { - return; - } - if ((char)this->_sampleLaser < '\0') { - return; - } - if ((this->_sprite)._loaded == 0) { - return; - } - local_14c = (g_game->_screenShakeOffset).x; - local_150 = (g_game->_screenShakeOffset).y; - local_130 = (this->_posOffset).y + (this->_pos).y; - local_13c = (g_screenHeight - 182.0) * 0.5; - local_12c = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_120 = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_12c + 0.5; - ExceptionList = &local_10; - dVar11 = floor((double)local_120); - local_134 = (float)dVar11; - local_120 = ((local_130 - 140.0) * 0.65 + local_13c) * (float)local_12c + 0.5; - dVar11 = floor((double)local_120); - local_120 = (float)dVar11; - fVar8 = offset->y; - (this->_renderPosition).x = local_134 / (float)local_12c + offset->x; - (this->_renderPosition).y = local_120 / (float)local_12c + fVar8; - fVar8 = 1.0; - alphaMultiplier = 1.0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetLastParent(); - fStack_324 = 1.3915841e-38; - player = GHIDRA_CAST(__RTDynamicCast()); - if (player != GHIDRA_CAST(0x0)) { - bVar1 = (GHIDRA_CAST((player)))->Entity_Player::IsLocalPlayer(); - if (bVar1 == 0) { - FUN_00925df0(); - alphaMultiplier = fVar8; - } - } - this_00 = &this->_sprite; - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - pfVar3 = LayerState::GetTexture(layer,&local_1b0); - local_120 = *pfVar3; - local_8 = 0.0; - if (((GHIDRA_CAST(local_1b0.y) != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(*GHIDRA_CAST(local_1b0.y) + 0xc))(), cVar2 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(); - } - local_8 = -NAN; - if (local_120 == 0.0) { - warnMessage = "[warn] Laser::Render sprite sheet is not loaded\n"; - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Laser::Render sprite sheet is not loaded\n")); - shader_cache_find(GHIDRA_INT(warnMessage)); - ExceptionList = local_10; - return; - } - uVar5 = (this->_sprite)._layerCount; - shaderMode = (GHIDRA_UINT((this->_sprite)._bitflags) >> 5 & 1) * 2; - if (this->_sampleLaser == 0) { - if ((uVar5 < 2) || - (((bVar1 = is_thick_variant(this), bVar1 == 0 && (iVar6 = this->_variant, iVar6 != 2)) && - ((iVar6 != 5 && (iVar6 != 8)))))) { - iVar6 = this->_variant; - if (((iVar6 == 2) || (iVar6 == 10)) || (iVar6 == 7)) { - layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0); - if (layerFrame == GHIDRA_CAST(0x0)) goto LAB_0097ab0f; - AnimationState::copy_assign(GHIDRA_CAST(frameCopy),layerFrame); - local_208._offset[2] = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_208._offset[2])) + 0x1))),1); - local_208._colorize[3] = this->_laserLength * 0.65 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))); - local_208._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - local_208._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))); - local_208._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))); - local_208._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - if ((this->_sprite)._flipX != 0) { - local_208._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - local_208._colorize[2] = (float)((*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0)))); - } - local_208._offset[1] = local_208._colorize[3]; - local_208._offset[0] = local_208._colorize[0]; - local_134 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) * 0.5; - local_124 = GHIDRA_CAST((this->_angleDegrees * 0.017453292)); - local_208._tint[2] = local_208._colorize[2]; - local_154 = sin((float)local_124); - fVar8 = cos((float)local_124); - local_124 = GHIDRA_CAST((fVar8 * this->_laserLength)); - local_188.x = this->_laserLength * local_154; - local_188.y = -(float)local_124; - local_12c = GHIDRA_CAST(local_188.x); - (GHIDRA_CAST((&local_188)))->Vector::Normalize(); - (GHIDRA_CAST((&quadColor)))->KColor::SetFromARGB(0xffffffff); - local_13c = (this->_pos).x + (this->_posOffset).x; - local_140 = (this->_posOffset).y + (this->_pos).y; - local_12c = GHIDRA_CAST(((float)local_12c + local_140)); - local_180.y = (g_screenWidth - 338.0) * 0.5; - local_120 = (g_screenHeight - 182.0) * 0.5; - local_130 = g_displayPixelRatio * g_screenPointScale; - local_124 = (AnimationState *) - (((((float)local_124 + local_13c) - 60.0) * 0.65 + local_180.y) * local_130 + - 0.5); - dVar11 = floor((double)(float)local_124); - local_154 = (float)dVar11 / local_130; - local_124 = (AnimationState *) - ((((float)local_12c - 140.0) * 0.65 + local_120) * local_130 + 0.5); - dVar11 = floor((double)(float)local_124); - local_12c = GHIDRA_CAST((local_188.x * local_134)); - local_164 = GHIDRA_CAST((local_188.y * local_134)); - quadCorner3.x = (float)local_12c + local_154 + offset->x + local_14c; - quadCorner3.y = (float)local_164 + (float)dVar11 / local_130 + offset->y + local_150; - local_134 = -local_134; - quadCorner1.x = local_14c + offset->x + local_154 + local_188.x * local_134; - quadCorner1.y = local_150 + offset->y + (float)dVar11 / local_130 + local_188.y * local_134; - local_124 = GHIDRA_CAST((((local_13c - 60.0) * 0.65 + local_180.y) * local_130 + 0.5)); - dVar11 = floor((double)(float)local_124); - local_154 = (float)dVar11; - local_124 = GHIDRA_CAST((((local_140 - 140.0) * 0.65 + local_120) * local_130 + 0.5)); - dVar11 = floor((double)(float)local_124); - local_124 = GHIDRA_CAST((float)dVar11); - quadCorner2.x = local_14c + offset->x + local_154 / local_130 + (float)local_12c; - quadCorner2.y = local_150 + offset->y + (float)local_124 / local_130 + (float)local_164; - local_148.x = local_13c; - local_148.y = local_140; - renderPos = Isaac::GetRenderPosition(&local_1b0,&local_148,1); - local_148.x = local_14c + offset->x + local_188.x * local_134 + renderPos->x; - local_148.y = local_150 + offset->y + local_188.y * local_134 + renderPos->y; - fStack_324 = 1.393063e-38; - set_quad_corner_colors(quad,&local_148,&quadCorner2,&quadCorner1,&quadCorner3,&quadColor); - ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - fStack_324 = 1.3930686e-38; - FUN_00a13560(); - FUN_00682260(); - (GHIDRA_CAST((GHIDRA_CAST(auStack_338))))->Color::operator_assign(&(this->_sprite)._color); - FUN_004072e0(); - if (shaderMode == 2) { - uVar5 = g_game->_frameCount & 0x800000ff; - if (GHIDRA_INT(uVar5) < 0) { - uVar5 = (uVar5 - 1 | 0xffffff00) + 1; - } - shaderColor._colorize[3] = (float)GHIDRA_INT(uVar5) * 0.00390625; - } - vertexColor._red = shaderColor._tint[0]; - vertexColor._green = shaderColor._tint[1]; - vertexColor._blue = shaderColor._tint[2]; - vertexColor._alpha = shaderColor._tint[3] * alphaMultiplier; - vertexColor._unk = 0; - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - layer->_wrapSMode = 0; - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - layer->_wrapTMode = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar14)) + 0x0))) = 1.3930976e-38; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar14)) + 0x4))) = 0.0; - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - LayerState::GetTexture(layer,auStack_30a + -10); - apply_sprite_shader_params(&shaderColor,1,(void *)uVar14,SUB84(uVar14,4)); - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - texture = LayerState::GetTexture(layer,&local_148); - local_8 = 8.40779e-45; - goto LAB_0097b218; - } - (GHIDRA_CAST((GHIDRA_CAST(&tmpColor))))->Color::operator_assign(&(this->_sprite)._color); - (this->_sprite)._color._tint[3] = tmpColor._tint[3] * alphaMultiplier; - ANM2::Render(this_00,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - (this->_sprite)._color._tint[3] = tmpColor._tint[3]; - iVar6 = extraout_ECX_00; - } - else { - local_124 = GHIDRA_CAST((this->_sprite)._rotation); - if ((this->_sprite)._flipX != 0) { - (this->_sprite)._rotation = -(float)local_124; - } - (GHIDRA_CAST((GHIDRA_CAST(&tmpColor))))->Color::operator_assign(&(this->_sprite)._color); - (this->_sprite)._color._tint[3] = alphaMultiplier * (this->_sprite)._color._tint[3]; - (GHIDRA_CAST((GHIDRA_CAST(this_00))))->Sprite::RenderLayer(0,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - (GHIDRA_CAST((GHIDRA_CAST(this_00))))->Sprite::SetColor(&tmpColor); - (this->_sprite)._rotation = (float)local_124; - iVar6 = extraout_ECX; - if (15.0 < this->_laserLength) { - local_124 = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0); - layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,1); - if ((local_124 == GHIDRA_CAST(0x0)) || (layerFrame == GHIDRA_CAST(0x0))) { -LAB_0097ab0f: - warnMessage = "[warn] Laser::Render current frame is NULL\n"; - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Laser::Render current frame is NULL\n")); - shader_cache_find(GHIDRA_INT(warnMessage)); - ExceptionList = local_10; - return; - } - AnimationState::copy_assign(GHIDRA_CAST(firstLayerFrame),local_124); - AnimationState::copy_assign(GHIDRA_CAST(frameCopy),layerFrame); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - local_208._offset[2] = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_208._offset[2])) + 0x1))),1); - local_120 = frameScaleX * (layer->_size).x * (this->_sprite)._scale.x; - frameScaleY = frameScaleY * (layer->_size).y * (this->_sprite)._scale.y; - local_208._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))) + (this->_laserLength / frameScaleY) * 0.65; - local_208._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - local_208._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))); - local_208._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))); - local_208._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - if ((this->_sprite)._flipX != 0) { - local_208._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - local_208._colorize[2] = (float)((*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0)))); - } - local_208._offset[1] = local_208._colorize[3]; - local_208._offset[0] = local_208._colorize[0]; - local_130 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) * 0.5; - local_124 = GHIDRA_CAST((this->_angleDegrees * 0.017453292)); - local_208._tint[2] = local_208._colorize[2]; - frameScaleX = local_120; - local_154 = sin((float)local_124); - fVar8 = cos((float)local_124); - local_13c = (this->_sprite)._scale.y; - local_124 = (AnimationState *) - (((*GHIDRA_CAST((GHIDRA_CAST(&((float)firstLayerFrame)) + 0x14))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)firstLayerFrame)) + 0xc)))) * fVar8 * - local_13c); - local_13c = ((*GHIDRA_CAST((GHIDRA_CAST(&((float)firstLayerFrame)) + 0x14))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)firstLayerFrame)) + 0xc)))) * local_154 * - local_13c; - fVar7 = this->_laserLength - ((*GHIDRA_CAST((GHIDRA_CAST(&((float)firstLayerFrame)) + 0xc))) / 0.65) * 0.5; - local_1b0.x = fVar7 * local_154; - local_154 = fVar7 * fVar8; - local_1b0.y = -local_154; - local_12c = GHIDRA_CAST(local_1b0.x); - (GHIDRA_CAST((&local_1b0)))->Vector::Normalize(); - local_134 = local_14c + (float)local_124 + local_120 * -local_130 * local_1b0.x + offset->x; - local_140 = local_150 + local_13c + local_120 * -local_130 * local_1b0.y + offset->y; - local_150 = local_150 + local_13c + local_120 * local_130 * local_1b0.y + offset->y; - local_14c = local_14c + (float)local_124 + local_120 * local_130 * local_1b0.x + offset->x; - local_130 = local_130 * local_1b0.y; - (GHIDRA_CAST((&quadColor)))->KColor::SetFromARGB(0xffffffff); - local_180.y = (this->_posOffset).x + (this->_pos).x; - local_164 = GHIDRA_CAST(((this->_posOffset).y + (this->_pos).y)); - local_12c = GHIDRA_CAST(((float)local_12c + (float)local_164)); - local_120 = (g_screenHeight - 182.0) * 0.5; - local_13c = (g_screenWidth - 338.0) * 0.5; - local_130 = g_displayPixelRatio * g_screenPointScale; - local_124 = (AnimationState *) - ((((local_154 + local_180.y) - 60.0) * 0.65 + local_13c) * local_130 + 0.5); - dVar11 = floor((double)(float)local_124); - local_154 = (float)dVar11 / local_130; - local_124 = (AnimationState *) - ((((float)local_12c - 140.0) * 0.65 + local_120) * local_130 + 0.5); - dVar11 = floor((double)(float)local_124); - local_148.y = (float)dVar11 / local_130 + local_150; - local_148.x = local_154 + local_14c; - quadCorner3.x = local_154 + local_134; - quadCorner3.y = local_140 + (float)dVar11 / local_130; - local_124 = GHIDRA_CAST((((local_180.y - 60.0) * 0.65 + local_13c) * local_130 + 0.5)); - dVar11 = floor((double)(float)local_124); - local_154 = (float)dVar11 / local_130; - local_124 = (AnimationState *) - ((((float)local_164 - 140.0) * 0.65 + local_120) * local_130 + 0.5); - dVar11 = floor((double)(float)local_124); - local_124 = GHIDRA_CAST((float)dVar11); - quadCorner1.y = (float)local_124 / local_130 + local_150; - quadCorner1.x = local_154 + local_14c; - quadCorner2.x = local_154 + local_134; - quadCorner2.y = local_140 + (float)local_124 / local_130; - fStack_324 = 1.3928041e-38; - set_quad_corner_colors(quad,&quadCorner2,&quadCorner1,&quadCorner3,&local_148,&quadColor); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - g_graphicsManager_blendMode[0] = layer->_blendMode[0]; - g_graphicsManager_blendMode[1] = layer->_blendMode[1]; - g_graphicsManager_blendMode[2] = layer->_blendMode[2]; - g_graphicsManager_blendMode[3] = layer->_blendMode[3]; - g_graphicsManager_blendMode[4] = layer->_blendMode[4]; - FUN_00682260(); - (GHIDRA_CAST((GHIDRA_CAST(auStack_338))))->Color::operator_assign(&(this->_sprite)._color); - FUN_004072e0(); - if (shaderMode == 2) { - uVar5 = g_game->_frameCount & 0x800000ff; - if (GHIDRA_INT(uVar5) < 0) { - uVar5 = (uVar5 - 1 | 0xffffff00) + 1; - } - shaderColor._colorize[3] = (float)GHIDRA_INT(uVar5) * 0.00390625; - } - vertexColor._red = shaderColor._tint[0]; - vertexColor._green = shaderColor._tint[1]; - vertexColor._blue = shaderColor._tint[2]; - vertexColor._alpha = shaderColor._tint[3] * alphaMultiplier; - vertexColor._unk = 0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_wrapSMode = 0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_wrapTMode = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar13)) + 0x0))) = 1.3928444e-38; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar13)) + 0x4))) = 0.0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - LayerState::GetTexture(layer,auStack_30a + -10); - apply_sprite_shader_params(&shaderColor,1,(void *)uVar13,SUB84(uVar13,4)); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - texture = LayerState::GetTexture(layer,&local_148); - local_8 = 7.00649e-45; -LAB_0097b218: - (**(code **)(*GHIDRA_CAST(*texture) + 0x14))(); - local_8 = -NAN; - TexturePtr::release(); - iVar6 = extraout_ECX_01; - } - } - shader_cache_find(iVar6); - goto LAB_0097b24c; - } - local_164 = GHIDRA_CAST(GHIDRA_UINT((1 < uVar5))); - layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,GHIDRA_INT(local_164)); - if (layerFrame == GHIDRA_CAST(0x0)) { - warnMessage = "[warn] Laser::Render current laser frame is NULL\n"; - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Laser::Render current laser frame is NULL\n")); - shader_cache_find(GHIDRA_INT(warnMessage)); - ExceptionList = local_10; - return; - } - AnimationState::copy_assign(GHIDRA_CAST(frameCopy),layerFrame); - layer = ANM2::GetLayer(this_00,local_164); - verticesBegin = GHIDRA_CAST(0x0); - verticesEnd = GHIDRA_CAST(0x0); - verticesCapacity = GHIDRA_CAST(0x0); - local_130 = frameScaleX * (layer->_size).x * (this->_sprite)._scale.x; - local_8 = 1.4013e-45; - msvc::vector<8byte>::reserve(); - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - layer->_wrapSMode = 0; - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - layer->_wrapTMode = 0; - layer = ANM2::GetLayer(this_00,GHIDRA_CAST(0x0)); - LayerState::GetTexture(layer,&local_1b0); - local_8 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); - scaledOffsetX = (this->_posOffset).x * 0.65; - local_12c = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_19c = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) * 0.5; - scaledOffsetY = (this->_posOffset).y * 0.65; - local_13c = 0.0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - GHIDRA_INT(local_12c) >> 3 == 1) { - local_138 = verticesEnd; - } - else { - local_190 = -local_19c; - local_138 = verticesEnd; - do { - fVar8 = local_13c; - local_140 = *GHIDRA_CAST((GHIDRA_CAST(local_12c) + 8 + GHIDRA_INT(local_13c) * 8)) - - *GHIDRA_CAST((GHIDRA_CAST(local_12c) + GHIDRA_INT(local_13c) * 8)); - local_134 = *GHIDRA_CAST((GHIDRA_CAST(local_12c) + 0xc + GHIDRA_INT(local_13c) * 8)) - - *GHIDRA_CAST((GHIDRA_CAST(local_12c) + 4 + GHIDRA_INT(local_13c) * 8)); - verticesEnd = local_138; - fVar7 = sqrtf(local_134 * local_134 + local_140 * local_140); - local_134 = local_134 / fVar7; - local_140 = -(local_140 / fVar7); - pfVar3 = GHIDRA_CAST((GHIDRA_INT(local_12c) + GHIDRA_INT(fVar8) * 8)); - local_188.y = (*GHIDRA_CAST((GHIDRA_CAST(local_12c) + 4 + GHIDRA_INT(fVar8) * 8)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_12c = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_120 = ((*pfVar3 - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * (float)local_12c + 0.5 - ; - dVar11 = floor((double)local_120); - local_168 = (float)dVar11 / (float)local_12c; - local_120 = local_188.y * (float)local_12c + 0.5; - dVar11 = floor((double)local_120); - local_120 = (float)dVar11; - local_194 = local_130 * local_134 * local_19c; - local_18c = local_130 * local_140 * local_19c; - local_128 = local_168 + local_194; - local_124 = GHIDRA_CAST((local_18c + local_120 / (float)local_12c)); - if (local_138 == verticesCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *local_138 = local_128; - local_138[1] = (float)local_124; - verticesEnd = local_138 + 2; - } - iVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_188.y = (*GHIDRA_CAST((iVar6 + 4 + GHIDRA_INT(fVar8) * 8)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_12c = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_120 = ((*GHIDRA_CAST((iVar6 + GHIDRA_INT(fVar8) * 8)) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_12c + 0.5; - local_138 = verticesEnd; - dVar11 = floor((double)local_120); - local_168 = (float)dVar11 / (float)local_12c; - local_120 = local_188.y * (float)local_12c + 0.5; - dVar11 = floor((double)local_120); - local_120 = (float)dVar11; - local_188.y = local_130 * local_190 * local_134; - local_16c = local_130 * local_190 * local_140; - local_158 = local_168 + local_188.y; - local_154 = local_120 / (float)local_12c + local_16c; - if (local_138 == verticesCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *local_138 = local_158; - local_138[1] = local_154; - verticesEnd = local_138 + 2; - } - iVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_134 = (*GHIDRA_CAST((iVar6 + 0xc + GHIDRA_INT(fVar8) * 8)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_12c = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_120 = ((*GHIDRA_CAST((iVar6 + 8 + GHIDRA_INT(fVar8) * 8)) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_12c + 0.5; - local_138 = verticesEnd; - dVar11 = floor((double)local_120); - local_140 = (float)dVar11 / (float)local_12c; - local_120 = local_134 * (float)local_12c + 0.5; - dVar11 = floor((double)local_120); - local_120 = (float)dVar11; - local_180.y = local_18c + local_120 / (float)local_12c; - local_180.x = local_194 + local_140; - if (local_138 == verticesCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *local_138 = local_180.x; - local_138[1] = local_180.y; - verticesEnd = local_138 + 2; - } - iVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_134 = (*GHIDRA_CAST((iVar6 + 0xc + GHIDRA_INT(fVar8) * 8)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_12c = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_120 = ((*GHIDRA_CAST((iVar6 + 8 + GHIDRA_INT(fVar8) * 8)) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_12c + 0.5; - local_138 = verticesEnd; - dVar11 = floor((double)local_120); - local_140 = (float)dVar11 / (float)local_12c; - local_120 = local_134 * (float)local_12c + 0.5; - dVar11 = floor((double)local_120); - local_120 = (float)dVar11; - local_1d8 = local_16c + local_120 / (float)local_12c; - local_1dc = local_188.y + local_140; - if (local_138 == verticesCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *local_138 = local_1dc; - local_138[1] = local_1d8; - verticesEnd = local_138 + 2; - } - local_12c = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_13c = (float)(GHIDRA_INT(local_13c) + 1); - local_138 = verticesEnd; - } while (GHIDRA_UINT(local_13c) < (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - GHIDRA_INT(local_12c) >> 3) - 1U - ); - } - iVar6 = this->_subtype; - if (((iVar6 == 1) || (iVar6 == 2)) || (iVar6 == 3)) { - verticesEnd = local_138; - msvc::vector::erase(); - msvc::vector::_Insert_n(); - iVar6 = this->_subtype; - if (((iVar6 != 1) && (iVar6 != 2)) && (iVar6 != 3)) { - local_138 = verticesEnd; - goto LAB_00979179; - } - local_138 = verticesEnd; - local_190 = (float)(g_game->_frameCount - this->_spawnFrame) * 5.0 + 0.0; - } - else { -LAB_00979179: - local_190 = 0.0; - } - verticesEnd = local_138; - layer = ANM2::GetLayer(&this->_sprite,local_164); - g_graphicsManager_blendMode[0] = layer->_blendMode[0]; - g_graphicsManager_blendMode[1] = layer->_blendMode[1]; - g_graphicsManager_blendMode[2] = layer->_blendMode[2]; - g_graphicsManager_blendMode[3] = layer->_blendMode[3]; - g_graphicsManager_blendMode[4] = layer->_blendMode[4]; - FUN_00682260(); - pfVar3 = verticesBegin; - local_138 = GHIDRA_CAST((GHIDRA_INT(local_138) - GHIDRA_INT(verticesBegin))); - if ((GHIDRA_UINT(local_138) & 0x18) != 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Vertices size is not a multiple of 4.\n")); - } - local_138 = GHIDRA_CAST((GHIDRA_INT(local_138) >> 3)); - local_120 = 0.0; - if (local_138 != GHIDRA_CAST(0x0)) { - pfVar3 = pfVar3 + 0xb; - local_124 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))))); - do { - if (GHIDRA_UINT(local_120) < GHIDRA_UINT((GHIDRA_INT(local_138) + -4))) { - pfVar3[-7] = (pfVar3[-3] + pfVar3[-7]) * 0.5; - pfVar3[-6] = (pfVar3[-2] + pfVar3[-6]) * 0.5; - pfVar3[-5] = (pfVar3[-1] + pfVar3[-5]) * 0.5; - pfVar3[-4] = (pfVar3[-4] + *pfVar3) * 0.5; - } - if (local_120 == 0.0) { - local_19c = pfVar3[-0xb]; - } - else { - local_19c = pfVar3[-0xf]; - pfVar3[-0xb] = local_19c; - pfVar3[-10] = pfVar3[-0xe]; - pfVar3[-9] = pfVar3[-0xd]; - pfVar3[-8] = pfVar3[-0xc]; - } - local_16c = pfVar3[-9]; - local_164 = GHIDRA_CAST(pfVar3[-10]); - local_134 = pfVar3[-8]; - local_168 = pfVar3[-5]; - local_18c = pfVar3[-7]; - local_140 = pfVar3[-4]; - local_194 = pfVar3[-6]; - local_13c = (local_19c + local_16c) * 0.5; - local_130 = (local_168 + local_18c) * 0.5; - local_188.y = ((float)local_164 + local_134) * 0.5; - local_1d8 = (local_140 + local_194) * 0.5; - local_12c = GHIDRA_CAST(sqrtf((local_1d8 - local_188.y) * (local_1d8 - local_188.y) + - (local_130 - local_13c) * (local_130 - local_13c))); - maskedTearFlags = BitSet128::operator_and(&tmpTearFlags,&this->_tearFlags,&g_tearFlagGrow); - fVar8 = local_19c; - segmentCorner0Y = (float)local_164; - if (((!(GHIDRA_INT(maskedTearFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedTearFlags->_l) + 4)) == 0)) || - (!(GHIDRA_INT(maskedTearFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedTearFlags->_h) + 4)) == 0))) && - ((iVar6 = this->_subtype, iVar6 != 1 && ((iVar6 != 2 && (iVar6 != 3)))))) { - local_154 = 1.0; - local_180.y = local_190 / 1000.0; - pfVar4 = &local_180.y; - if (1.0 <= local_190 / 1000.0) { - pfVar4 = &local_154; - } - local_180.y = 1.0; - fVar7 = *pfVar4 * 1.5 + 1.0; - local_134 = fVar7 * (local_134 - local_188.y) + local_188.y; - local_16c = fVar7 * (local_16c - local_13c) + local_13c; - local_154 = ((float)local_12c + local_190) / 1000.0; - pfVar4 = &local_154; - if (1.0 <= local_154) { - pfVar4 = &local_180.y; - } - fVar8 = *pfVar4 * 1.5 + 1.0; - local_18c = fVar8 * (local_18c - local_130) + local_130; - local_194 = fVar8 * (local_194 - local_1d8) + local_1d8; - local_140 = fVar8 * (local_140 - local_1d8) + local_1d8; - local_168 = fVar8 * (local_168 - local_130) + local_130; - fVar8 = fVar7 * (local_19c - local_13c) + local_13c; - segmentCorner0Y = (float)(fVar7 * ((float)local_164 - local_188.y) + local_188.y); - } - fVar9 = 1.0; - fVar7 = local_18c; - fVar10 = local_16c; - maskedTearFlags = - BitSet128::operator_and(GHIDRA_CAST(&local_250),&this->_tearFlags,&g_tearFlagShrink); - if ((((GHIDRA_INT(maskedTearFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedTearFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedTearFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedTearFlags->_h) + 4)) == 0)) || - (iVar6 = this->_subtype, iVar6 == 1)) || ((iVar6 == 2 || (iVar6 == 3)))) { - fVar10 = local_194; - } - else { - local_180.y = 1.0; - local_154 = local_190 / 300.0; - pfVar4 = &local_154; - if (fVar9 <= local_190 / 300.0) { - pfVar4 = &local_180.y; - } - local_180.y = 1.0; - fVar7 = fVar9 - *pfVar4 * 0.5; - fVar8 = fVar7 * (fVar8 - local_13c) + local_13c; - local_134 = fVar7 * (local_134 - local_188.y) + local_188.y; - segmentCorner0Y = fVar7 * (segmentCorner0Y - local_188.y) + local_188.y; - local_16c = fVar7 * (fVar10 - local_13c) + local_13c; - local_154 = ((float)local_12c + local_190) / 300.0; - pfVar4 = &local_154; - if (fVar9 <= local_154) { - pfVar4 = &local_180.y; - } - fVar9 = fVar9 - *pfVar4 * 0.5; - fVar7 = fVar9 * (local_18c - local_130) + local_130; - local_168 = fVar9 * (local_168 - local_130) + local_130; - local_140 = fVar9 * (local_140 - local_1d8) + local_1d8; - fVar10 = fVar9 * (local_194 - local_1d8) + local_1d8; - } - uv2Y = (float)local_12c + local_190; - uv1Y = local_190; - uv0Y = local_190; - uv2X = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - uv3X = (float)local_124; - local_220 = 1; - if ((this->_sprite)._flipX != 0) { - uv2X = (float)local_124; - uv3X = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - } - uv0X = uv2X; - uv1X = uv3X; - uv3Y = uv2Y; - local_190 = uv2Y; - (GHIDRA_CAST((&quadColor)))->KColor::SetFromARGB(0xffffffff); - fVar9 = offset->y; - renderOffsetX = offset->x; - quadCorner2.y = local_150 + fVar9 + scaledOffsetY + fVar10; - quadCorner2.x = local_14c + renderOffsetX + scaledOffsetX + fVar7; - quadCorner1.y = local_150 + fVar9 + scaledOffsetY + local_140; - quadCorner1.x = local_14c + renderOffsetX + scaledOffsetX + local_168; - quadCorner3.x = local_14c + renderOffsetX + scaledOffsetX + fVar8; - quadCorner3.y = local_150 + fVar9 + scaledOffsetY + segmentCorner0Y; - local_148.y = local_150 + fVar9 + scaledOffsetY + local_134; - local_148.x = local_14c + renderOffsetX + scaledOffsetX + local_16c; - fStack_324 = 1.3922479e-38; - set_quad_corner_colors(segmentQuad,&local_148,&quadCorner3,&quadCorner1,&quadCorner2,color); - tmpColor._offset[2] = frameOffsetB; - tmpColor._tint[0] = frameTintR; - tmpColor._tint[1] = frameTintG; - tmpColor._tint[2] = frameTintB; - tmpColor._tint[3] = frameTintA; - tmpColor._colorize[0] = frameColorizeR; - tmpColor._colorize[1] = frameColorizeG; - tmpColor._colorize[2] = frameColorizeB; - tmpColor._colorize[3] = frameColorizeA; - tmpColor._offset[0] = local_5c[0]; - tmpColor._offset[1] = local_5c[1]; - local_208._tint[0] = (this->_sprite)._color._tint[0]; - local_208._tint[1] = (this->_sprite)._color._tint[1]; - local_208._tint[2] = (this->_sprite)._color._tint[2]; - local_208._tint[3] = (this->_sprite)._color._tint[3]; - local_208._offset[2] = (this->_sprite)._color._offset[2]; - other = &tmpColor; - local_208._colorize[0] = (this->_sprite)._color._colorize[0]; - local_208._colorize[1] = (this->_sprite)._color._colorize[1]; - local_208._colorize[2] = (this->_sprite)._color._colorize[2]; - local_208._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_208._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - image = (void *)0x979aab; - (GHIDRA_CAST((&local_208)))->Color::__mul(other); - shaderColor._offset[2] = local_208._offset[2]; - shaderColor._tint[0] = local_208._tint[0]; - shaderColor._tint[1] = local_208._tint[1]; - shaderColor._tint[2] = local_208._tint[2]; - shaderColor._tint[3] = local_208._tint[3]; - shaderColor._colorize[0] = local_208._colorize[0]; - shaderColor._colorize[1] = local_208._colorize[1]; - shaderColor._colorize[2] = local_208._colorize[2]; - shaderColor._colorize[3] = local_208._colorize[3]; - shaderColor._offset[0] = local_208._offset[0]; - shaderColor._offset[1] = local_208._offset[1]; - if (shaderMode == 2) { - uVar5 = g_game->_frameCount & 0x800000ff; - if (GHIDRA_INT(uVar5) < 0) { - uVar5 = (uVar5 - 1 | 0xffffff00) + 1; - } - shaderColor._colorize[3] = (float)GHIDRA_INT(uVar5) * 0.00390625; - } - vertexColor._red = local_208._tint[0]; - vertexColor._green = local_208._tint[1]; - vertexColor._blue = local_208._tint[2]; - vertexColor._alpha = local_208._tint[3] * alphaMultiplier; - vertexColor._unk = 0; - (GHIDRA_CAST((auStack_30a + -10)))->KAGE::SmartPointer::operator_assign(&local_1b0); - apply_sprite_shader_params(&shaderColor,1,image,other); - (**(code **)(*GHIDRA_CAST(local_1b0.x) + 0x14))(); - pfVar3 = pfVar3 + 8; - local_120 = (float)(GHIDRA_INT(local_120) + 4); - } while (GHIDRA_UINT(local_120) < local_138); - pfVar3 = verticesBegin; - } - if ((1 < GHIDRA_UINT((this->_sprite)._layerCount)) && (this->_subtype == 0)) { - layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0); - if (layerFrame == GHIDRA_CAST(0x0)) { - warnMessage = "[warn] Laser::Render current frame is NULL\n"; - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Laser::Render current frame is NULL\n")); - shader_cache_find(GHIDRA_INT(warnMessage)); - TexturePtr::release(); - if (pfVar3 == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - uVar5 = GHIDRA_INT(verticesCapacity) - GHIDRA_INT(pfVar3) & 0xfffffff8; - pfVar4 = pfVar3; - if (uVar5 < 0x1000) { -LAB_00979c35: - operator_delete(pfVar4,uVar5); - ExceptionList = local_10; - return; - } - pfVar4 = GHIDRA_CAST(pfVar3[-1]); - uVar5 = uVar5 + 0x23; - if (GHIDRA_UINT((GHIDRA_INT(pfVar3) + (-4 - GHIDRA_INT(pfVar4)))) < 0x20) goto LAB_00979c35; - goto LAB_0097a2b3; - } - AnimationState::copy_assign(GHIDRA_CAST(frameCopy),layerFrame); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - pfVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - frameScaleX = frameScaleX * (layer->_size).x * (this->_sprite)._scale.x; - frameScaleY = frameScaleY * (layer->_size).y * (this->_sprite)._scale.y; - local_148.y = pfVar4[1] - (this->_pos).y; - local_148.x = *pfVar4 - (this->_pos).x; - (GHIDRA_CAST((&local_148)))->Vector::Normalized(&local_180); - local_13c = -local_180.x; - fVar8 = 0.5; - local_130 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) * 0.5; - local_124 = GHIDRA_CAST(((this->_pos).x + local_180.x * (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x14))))); - local_12c = GHIDRA_CAST(((this->_pos).y + local_180.y * (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x14))))); - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f0))))) { - local_12c = GHIDRA_CAST(((float)local_12c - (this->_posOffset).y)); - } - local_208._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0xc))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))); - local_208._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - local_208._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))) + 0.01; - local_208._offset[2] = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_208._offset[2])) + 0x1))),1); - local_208._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))); - if ((this->_sprite)._flipX != 0) { - local_208._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - local_208._colorize[2] = (float)((*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8)))); - } - local_208._offset[1] = local_208._colorize[3]; - local_208._offset[0] = local_208._colorize[0]; - fVar7 = local_180.x; - local_208._tint[2] = local_208._colorize[2]; - local_208._colorize[1] = local_208._tint[3]; - (GHIDRA_CAST((&quadColor)))->KColor::SetFromARGB(0xffffffff); - local_148.y = local_180.y * 0.025 + local_150 + offset->y + scaledOffsetY + pfVar3[1]; - local_148.x = fVar7 * 0.025 + local_14c + offset->x + scaledOffsetX + *pfVar3; - quadCorner3.x = fVar7 * 0.025 + local_14c + offset->x + scaledOffsetX + pfVar3[2]; - local_120 = g_displayPixelRatio * g_screenPointScale; - quadCorner3.y = local_180.y * 0.025 + local_150 + offset->y + scaledOffsetY + pfVar3[3]; - local_124 = (AnimationState *) - (((g_screenWidth - 338.0) * fVar8 + ((float)local_124 - 60.0) * 0.65) * local_120 + - fVar8); - dVar11 = floor((double)(float)local_124); - local_154 = (float)dVar11 / local_120; - local_124 = (AnimationState *) - (((g_screenHeight - 182.0) * 0.5 + ((float)local_12c - 140.0) * 0.65) * local_120 + - 0.5); - dVar11 = floor((double)(float)local_124); - local_124 = GHIDRA_CAST((float)dVar11); - quadCorner1.x = - local_14c + offset->x + scaledOffsetX + local_130 * local_180.y * frameScaleX + local_154; - quadCorner1.y = - local_150 + - offset->y + - scaledOffsetY + local_13c * local_130 * frameScaleX + (float)local_124 / local_120; - quadCorner2.x = - local_14c + offset->x + scaledOffsetX + -local_130 * local_180.y * frameScaleX + local_154; - quadCorner2.y = - local_150 + - offset->y + - scaledOffsetY + -local_130 * local_13c * frameScaleX + (float)local_124 / local_120; - fStack_324 = 1.3925018e-38; - set_quad_corner_colors(quad,&quadCorner2,&quadCorner1,&quadCorner3,&local_148,&quadColor); - FUN_00682260(); - (GHIDRA_CAST((GHIDRA_CAST(auStack_338))))->Color::operator_assign(&(this->_sprite)._color); - FUN_004072e0(); - if (shaderMode == 2) { - uVar5 = g_game->_frameCount & 0x800000ff; - if (GHIDRA_INT(uVar5) < 0) { - uVar5 = (uVar5 - 1 | 0xffffff00) + 1; - } - shaderColor._colorize[3] = (float)GHIDRA_INT(uVar5) * 0.00390625; - } - local_254 = shaderColor._tint[0]; - local_250 = shaderColor._tint[1]; - local_24c = (void *)shaderColor._tint[2]; - local_248 = shaderColor._tint[3] * alphaMultiplier; - local_244 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar12)) + 0x0))) = 1.3925265e-38; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar12)) + 0x4))) = 0.0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - LayerState::GetTexture(layer,auStack_30a + -10); - apply_sprite_shader_params(&shaderColor,1,(void *)uVar12,SUB84(uVar12,4)); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - texture = LayerState::GetTexture(layer,&local_148); - local_8 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); - (**(code **)(*GHIDRA_CAST(*texture) + 0x14))(); - TexturePtr::release(); - } - local_8 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),4); - if (((GHIDRA_CAST(local_1b0.y) != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(*GHIDRA_CAST(local_1b0.y) + 0xc))(), cVar2 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(); - } - local_8 = -NAN; - if (pfVar3 != GHIDRA_CAST(0x0)) { - uVar5 = GHIDRA_INT(verticesCapacity) - GHIDRA_INT(pfVar3) & 0xfffffff8; - pfVar4 = pfVar3; - if (0xfff < uVar5) { - pfVar4 = GHIDRA_CAST(pfVar3[-1]); - uVar5 = uVar5 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pfVar3) + (-4 - GHIDRA_INT(pfVar4))))) { -LAB_0097a2b3: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pfVar4,uVar5); - } -LAB_0097b24c: - FUN_008617a0(); - if ((g_game->_debugFlags & 1) != 0) { - local_120 = g_displayPixelRatio * g_screenPointScale; - local_124 = (AnimationState *) - (((g_screenWidth - 338.0) * 0.5 + ((this->_pos).x - 60.0) * 0.65) * local_120 + 0.5) - ; - dVar11 = floor((double)(float)local_124); - local_12c = GHIDRA_CAST(((float)dVar11 / local_120)); - local_124 = (AnimationState *) - ((((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * local_120 + - 0.5); - dVar11 = floor((double)(float)local_124); - fVar8 = (float)dVar11 / local_120; - local_124 = GHIDRA_CAST(fVar8); - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffffa500); - local_148.x = (float)local_12c + 2.0; - local_148.y = fVar8 + 0.0; - quadCorner3.x = (float)local_12c - 2.0; - quadCorner3.y = fVar8 - 0.0; - fStack_324 = 1.3931744e-38; - render_color_quad(&quadCorner3,&local_148,fromColor,fromColor,1.0); - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffffa500); - local_148.x = (float)local_12c + 0.0; - local_148.y = (float)local_124 + 2.0; - quadCorner3.y = (float)local_124 - 2.0; - quadCorner3.x = (float)local_12c - 0.0; - fStack_324 = 1.3931924e-38; - render_color_quad(&quadCorner3,&local_148,fromColor_00,fromColor_00,1.0); - if (this->_sampleLaser != 0) { - pfVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_12c = GHIDRA_CAST(0x0); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - GHIDRA_INT(pfVar3) >> 3 != 0) { - do { - local_120 = g_displayPixelRatio * g_screenPointScale; - local_124 = (AnimationState *) - (((g_screenWidth - 338.0) * 0.5 + (pfVar3[GHIDRA_INT(local_12c) * 2] - 60.0) * 0.65) - * local_120 + 0.5); - dVar11 = floor((double)(float)local_124); - local_130 = (float)dVar11 / local_120; - local_124 = (AnimationState *) - (((pfVar3[GHIDRA_INT(local_12c) * 2 + 1] - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * local_120 + 0.5); - dVar11 = floor((double)(float)local_124); - fVar8 = (float)dVar11 / local_120; - local_124 = GHIDRA_CAST(fVar8); - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffffffff); - local_148.x = local_130 + 2.0; - local_148.y = fVar8 + 0.0; - quadCorner3.x = local_130 - 2.0; - quadCorner3.y = fVar8 - 0.0; - fStack_324 = 1.3932584e-38; - render_color_quad(&quadCorner3,&local_148,fromColor_01,fromColor_01,0.95); - if (extraout_EAX != 0) { - *GHIDRA_CAST((extraout_EAX + 8)) = *GHIDRA_CAST((extraout_EAX + 8)) - 1.0; - *GHIDRA_CAST((extraout_EAX + 0x24)) = *GHIDRA_CAST((extraout_EAX + 0x24)) - 1.0; - *GHIDRA_CAST((extraout_EAX + 0x40)) = *GHIDRA_CAST((extraout_EAX + 0x40)) - 1.0; - *GHIDRA_CAST((extraout_EAX + 0x5c)) = *GHIDRA_CAST((extraout_EAX + 0x5c)) - 1.0; - } - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffffffff); - quadCorner1.x = local_130 + 0.0; - quadCorner2.x = local_130 - 0.0; - quadCorner1.y = (float)local_124 + 2.0; - quadCorner2.y = (float)local_124 - 2.0; - fStack_324 = 1.3932854e-38; - render_color_quad(&quadCorner2,&quadCorner1,fromColor_02,fromColor_02,0.95); - if (extraout_EAX_00 != 0) { - *GHIDRA_CAST((extraout_EAX_00 + 8)) = *GHIDRA_CAST((extraout_EAX_00 + 8)) - 1.0; - *GHIDRA_CAST((extraout_EAX_00 + 0x24)) = *GHIDRA_CAST((extraout_EAX_00 + 0x24)) - 1.0; - *GHIDRA_CAST((extraout_EAX_00 + 0x40)) = *GHIDRA_CAST((extraout_EAX_00 + 0x40)) - 1.0; - *GHIDRA_CAST((extraout_EAX_00 + 0x5c)) = *GHIDRA_CAST((extraout_EAX_00 + 0x5c)) - 1.0; - } - pfVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_12c = GHIDRA_CAST((GHIDRA_INT(local_12c) + 1)); - } while (local_12c < GHIDRA_UINT((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - GHIDRA_INT(pfVar3) >> 3))); - } - local_154 = this->_angleDegrees * 0.017453292; - local_130 = g_displayPixelRatio * g_screenPointScale; - fVar8 = cos(local_154); - local_124 = (AnimationState *) - ((((*pfVar3 - fVar8 * 16.0) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * - local_130 + 0.5); - dVar11 = floor((double)(float)local_124); - local_124 = GHIDRA_CAST((float)dVar11); - local_120 = (float)local_124 / local_130; - fVar8 = sin(local_154); - local_124 = (AnimationState *) - ((((pfVar3[1] - fVar8 * 16.0) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - local_130 + 0.5); - dVar11 = floor((double)(float)local_124); - fVar8 = (float)dVar11 / local_130; - local_124 = GHIDRA_CAST(fVar8); - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffadff2f); - local_148.x = local_120 + 2.0; - local_148.y = fVar8 + 0.0; - quadCorner3.x = local_120 - 2.0; - quadCorner3.y = fVar8 - 0.0; - fStack_324 = 1.3933677e-38; - render_color_quad(&quadCorner3,&local_148,fromColor_03,fromColor_03,0.95); - if (extraout_EAX_01 != 0) { - *GHIDRA_CAST((extraout_EAX_01 + 8)) = *GHIDRA_CAST((extraout_EAX_01 + 8)) - 1.0; - *GHIDRA_CAST((extraout_EAX_01 + 0x24)) = *GHIDRA_CAST((extraout_EAX_01 + 0x24)) - 1.0; - *GHIDRA_CAST((extraout_EAX_01 + 0x40)) = *GHIDRA_CAST((extraout_EAX_01 + 0x40)) - 1.0; - *GHIDRA_CAST((extraout_EAX_01 + 0x5c)) = *GHIDRA_CAST((extraout_EAX_01 + 0x5c)) - 1.0; - } - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffadff2f); - local_148.x = local_120 + 0.0; - quadCorner3.x = local_120 - 0.0; - local_148.y = (float)local_124 + 2.0; - quadCorner3.y = (float)local_124 - 2.0; - fStack_324 = 1.3933951e-38; - render_color_quad(&quadCorner3,&local_148,fromColor_04,fromColor_04,0.95); - if (extraout_EAX_02 != 0) { - *GHIDRA_CAST((extraout_EAX_02 + 8)) = *GHIDRA_CAST((extraout_EAX_02 + 8)) - 1.0; - *GHIDRA_CAST((extraout_EAX_02 + 0x24)) = *GHIDRA_CAST((extraout_EAX_02 + 0x24)) - 1.0; - *GHIDRA_CAST((extraout_EAX_02 + 0x40)) = *GHIDRA_CAST((extraout_EAX_02 + 0x40)) - 1.0; - *GHIDRA_CAST((extraout_EAX_02 + 0x5c)) = *GHIDRA_CAST((extraout_EAX_02 + 0x5c)) - 1.0; - } - } - } - ExceptionList = local_10; - return; -} - -// 0097baa0 -void Entity_Laser::UpdateHits() -{ - HomingLaser *this_00; - Entity_Player *pEVar1; - uint32_t uVar2; - uint32_t uVar3; - uint64_t qVar4; - uint8_t bVar5; - short impactDistanceClass; - int iVar6; - BitSet128 *maskedFlags; - uint8_t *pbVar7; - uint32_t uVar8; - float *clampedValue; - uint8_t *wantedAnimChar; - uint8_t *puVar9; - void *animData; - uint64_t *pqVar10; - bool bVar11; - float fVar12; - float fVar13; - ColorMod fadeColor; - uint8_t local_98 [8]; - Vector local_90; - Entity_Laser *savedLaser; - float widthScale; - Vector local_80; - uint8_t local_78 [8]; - Vector local_70; - Entity_Player *ownerPlayer; - float local_60; - char isHitFrame; - float radius; - uint8_t *local_54; - uint8_t local_50 [24]; - uint8_t local_38 [20]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint32_t *flagWord; - Vector *pos; - ColorMod *spriteColor; - code *takeDamageFn; - int *timeout; - Vector *velocity; - - puStack_20 = local_38 + 0x34; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0cbe8; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_38 + 0x28)); - ExceptionList = &local_1c; - savedLaser = this; - refresh_tear_params(this,local_24); - bVar5 = this->_isFirstUpdate; - if ((bVar5 != 0) || (this->_oneHit == 0)) { - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - qVar4 = (this->_tearFlags)._h; - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *GHIDRA_CAST(&(this->_activeTearFlags)._l) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._l) + 4)) = uVar2; - *GHIDRA_CAST(&(this->_activeTearFlags)._h) = GHIDRA_INT(qVar4); - *GHIDRA_CAST((GHIDRA_INT(&(this->_activeTearFlags)._h) + 4)) = uVar3; - } - if ((((this->_dead == 0) && (this->_isInterpolating == 0)) && (this->_variant != 8)) && - ((bVar5 != 0 || (iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), iVar6 != 0)))) { - isHitFrame = '\x01'; - if (this->_parentLaser == 0) { - (this->_hitList)._end = (this->_hitList)._begin; - } - } - else { - isHitFrame = '\0'; - } - if ((this->_isInterpolating == 0) && (this->_subtype == 1)) { - this->_friction = this->_friction * 0.8; - } - (this->_homingLaser)._bezier._end = (this->_homingLaser)._bezier._begin; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x4)))) = (this->_pos).x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x8)))) = (this->_pos).y; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0xc)))) = g_vectorZero.x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x10)))) = g_vectorZero.y; - radius = this->_radius; - pEVar1 = GHIDRA_CAST(this->_parent); - local_60 = 1.0; - widthScale = 1.0; - if ((pEVar1 != GHIDRA_CAST(0x0)) && (pEVar1->_type == 3)) { - radius = radius * 0.75; - } - ownerPlayer = GHIDRA_CAST(this->_spawnerEntity); - if ((ownerPlayer != GHIDRA_CAST(0x0)) && (ownerPlayer->_type != 1)) { - ownerPlayer = GHIDRA_CAST(0x0); - } - fVar12 = radius; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(local_98),&this->_tearFlags,&g_tearFlagPulse); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - fVar12 = sin(this->_updateTime * 0.1); - fVar12 = fVar12 * 20.0 + radius; - radius = fVar12; - } - if ((this->_subtype == 3) && (pEVar1 == ownerPlayer)) { -LAB_0097bdfd: - if ((pEVar1 != GHIDRA_CAST(0x0)) && (pEVar1->_dead == 0)) goto LAB_0097c1af; - if (this->_dead == 0) { - this->_dead = 1; - this->_timeout = 0; - goto LAB_0097c1af; - } -LAB_0097c1bc: - if (this->_variant == 2) { - animData = (this->_sprite)._animState._animData; - if ((animData == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x34)) == '\0')) { - if ((this->_sprite)._animState._animData == (void *)0x0) { - puVar9 = &DAT_bf800000; - } - else { - puVar9 = GHIDRA_CAST((this->_sprite)._animState._animFrame); - } - widthScale = (float)puVar9 * 0.2 + local_60; - } - else { - ANM2::GetAnimation(GHIDRA_CAST(&(this->_sprite)._animState),GHIDRA_CAST((local_50 + 0x10))); - local_14 = 0; - (GHIDRA_CAST((local_50 + 0x10)))->msvc::string::append(&DAT_00b61844,4); - local_54 = local_50 + 0x10; - if (&DAT_0000000f < (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_38))) + 0xc)))) { - local_54 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_50))) + 0x10))); - } - pbVar7 = (this->_sprite)._animState._animData; - if (pbVar7 == GHIDRA_CAST(0x0)) { -LAB_0097c25f: - bVar5 = ANM2::SetAnimation(&this->_sprite,local_54,1); - if (bVar5 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - this = savedLaser; - } - } - else { - if (0xf < *GHIDRA_CAST((pbVar7 + 0x14))) { - pbVar7 = *GHIDRA_CAST(pbVar7); - } - wantedAnimChar = local_54; - do { - bVar5 = *pbVar7; - bVar11 = bVar5 < *wantedAnimChar; - if (bVar5 != *wantedAnimChar) { -LAB_0097c244: - uVar8 = -GHIDRA_UINT(bVar11) | 1; - goto LAB_0097c249; - } - if (bVar5 == 0) break; - bVar5 = pbVar7[1]; - bVar11 = bVar5 < wantedAnimChar[1]; - if (bVar5 != wantedAnimChar[1]) goto LAB_0097c244; - pbVar7 = pbVar7 + 2; - wantedAnimChar = wantedAnimChar + 2; - } while (bVar5 != 0); - uVar8 = 0; -LAB_0097c249: - if ((uVar8 != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && - ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_0097c25f; - } - local_14 = 0xffffffff; - if (&DAT_0000000f < (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_38))) + 0xc)))) { - puVar9 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0xc))) + 1)); - pbVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_50))) + 0x10))); - if (GHIDRA_CAST(0xfff) < puVar9) { - pbVar7 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x10))) + -4)); - puVar9 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0xc))) + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x10))) + (-4 - GHIDRA_INT(pbVar7))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pbVar7,GHIDRA_UINT(puVar9)); - } - animData = (this->_sprite)._animState._animData; - } - if ((animData != (void *)0x0) && ((this->_sprite)._animState._isPlaying != 0)) - goto LAB_0097c301; - } - this->Remove(); - } - else { - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(local_78),&this->_tearFlags,&g_tearFlagGrow); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - if (ownerPlayer == GHIDRA_CAST(0x0)) { - local_54 = GHIDRA_CAST(0x0); - } - else { - fVar12 = (this->_pos).y - (ownerPlayer->_pos).y; - fVar13 = (this->_pos).x - (ownerPlayer->_pos).x; - local_54 = GHIDRA_CAST(sqrtf(fVar12 * fVar12 + fVar13 * fVar13)); - } - local_80.y = 500.0; - clampedValue = &local_80.y; - if ((float)local_54 <= 500.0) { - clampedValue = GHIDRA_CAST(&local_54); - } - fVar12 = (*clampedValue * 50.0) / 500.0 + radius; - radius = fVar12; - } - fVar13 = 500.0; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(local_38),&this->_tearFlags,&g_tearFlagShrink) - ; - if ((!(GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0)) || - (!(GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0))) { - if (ownerPlayer == GHIDRA_CAST(0x0)) { - local_54 = GHIDRA_CAST(0x0); - } - else { - fVar12 = (this->_pos).y - (ownerPlayer->_pos).y; - fVar13 = (this->_pos).x - (ownerPlayer->_pos).x; - local_54 = GHIDRA_CAST(sqrtf(fVar12 * fVar12 + fVar13 * fVar13)); - fVar13 = 500.0; - } - local_80.y = 500.0; - clampedValue = &local_80.y; - if ((float)local_54 <= fVar13) { - clampedValue = GHIDRA_CAST(&local_54); - } - fVar12 = radius + (local_60 - *clampedValue / fVar13) * 50.0; - radius = fVar12; - } - if (this->_subtype != 2) { - radius = fVar12; - if (this->_subtype != 3) goto LAB_0097c3ac; - goto LAB_0097bdfd; - } - iVar6 = g_game->_frameCount - this->_spawnFrame; - if (iVar6 < 10) { - local_54 = GHIDRA_CAST((local_60 - (float)iVar6 / 10.0)); - fVar12 = sin((float)local_54 * 3.1415927); - local_80.y = 5.0; - local_54 = GHIDRA_CAST(((local_60 - - ((float)local_54 * (float)local_54 * (float)local_54 - - fVar12 * (float)local_54)) * radius)); - clampedValue = GHIDRA_CAST(&local_54); - if ((float)local_54 <= 5.0) { - clampedValue = &local_80.y; - } - pbVar7 = GHIDRA_CAST(*clampedValue); - if ((float)pbVar7 <= radius) { - radius = (float)pbVar7; - } - else { - widthScale = (float)pbVar7 / radius; - } - } - pos = &this->_pos; - Room::GetClampedPositionImpl(g_game->_room,&local_70,pos,radius,radius,radius,radius); - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(local_38),&this->_tearFlags,&g_tearFlagBounce) - ; - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST(local_38),&this->_tearFlags,&g_tearFlagContinuum); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - local_80.y = local_70.x - pos->x; - local_54 = GHIDRA_CAST((local_70.y - (this->_pos).y)); - fVar12 = sqrtf(local_80.y * local_80.y + (float)local_54 * (float)local_54); - if (0.0 < fVar12) { - local_80.y = local_80.y * (local_60 / fVar12); - local_54 = GHIDRA_CAST(((float)local_54 * (local_60 / fVar12))); - } - local_90.y = (this->_velocity).x; - local_70.y = (this->_velocity).y; - fVar12 = sqrtf(local_90.y * local_90.y + local_70.y * local_70.y); - if (fVar12 <= 0.0) { - fVar13 = local_90.y; - fVar12 = local_70.y; - } - else { - fVar13 = (this->_velocity).x * (local_60 / fVar12); - fVar12 = (this->_velocity).y * (local_60 / fVar12); - } - if ((local_80.y * fVar13 + (float)local_54 * fVar12 < -0.75) && (this->_timeout == 0)) { - this->_timeout = 5; - } - } - } - else { - velocity = &this->_velocity; - if (((local_70.x < pos->x) && (fVar12 = velocity->x, 0.0 < fVar12)) || - ((pos->x < local_70.x && (fVar12 = velocity->x, fVar12 < 0.0)))) { - pos->x = local_70.x; - velocity->x = fVar12 * -1.0; - maskedFlags = (GHIDRA_CAST((&g_tearFlagBounce)))->BitSet128::__bnot(GHIDRA_CAST(local_38)); - *GHIDRA_CAST(&(this->_tearFlags)._l) = GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(maskedFlags->_l); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - *flagWord = *flagWord & *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)); - pqVar10 = &(this->_tearFlags)._h; - *GHIDRA_CAST(pqVar10) = GHIDRA_UINT(*pqVar10) & GHIDRA_UINT(maskedFlags->_h); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *flagWord = *flagWord & *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)); - *GHIDRA_CAST(&(this->_heldTearFlags)._l) = - GHIDRA_UINT((this->_heldTearFlags)._l) | GHIDRA_UINT(g_tearFlagBounce._l); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._l) + 4)); - *flagWord = *flagWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._l)) + 0x4))); - pqVar10 = &(this->_heldTearFlags)._h; - *GHIDRA_CAST(pqVar10) = GHIDRA_UINT(*pqVar10) | GHIDRA_UINT(g_tearFlagBounce._h); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._h) + 4)); - *flagWord = *flagWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._h)) + 0x4))); - } - fVar12 = (this->_pos).y; - clampedValue = &(this->_velocity).y; - if (((local_70.y < fVar12) && (fVar13 = *clampedValue, 0.0 < fVar13)) || - ((fVar12 < local_70.y && (fVar13 = *clampedValue, fVar13 < 0.0)))) { - (this->_pos).y = local_70.y; - *clampedValue = fVar13 * -1.0; - maskedFlags = (GHIDRA_CAST((&g_tearFlagBounce)))->BitSet128::__bnot(GHIDRA_CAST(local_38)); - *GHIDRA_CAST(&(this->_tearFlags)._l) = GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(maskedFlags->_l); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - *flagWord = *flagWord & *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)); - pqVar10 = &(this->_tearFlags)._h; - *GHIDRA_CAST(pqVar10) = GHIDRA_UINT(*pqVar10) & GHIDRA_UINT(maskedFlags->_h); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *flagWord = *flagWord & *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)); - *GHIDRA_CAST(&(this->_heldTearFlags)._l) = - GHIDRA_UINT((this->_heldTearFlags)._l) | GHIDRA_UINT(g_tearFlagBounce._l); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._l) + 4)); - *flagWord = *flagWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._l)) + 0x4))); - pqVar10 = &(this->_heldTearFlags)._h; - *GHIDRA_CAST(pqVar10) = GHIDRA_UINT(*pqVar10) | GHIDRA_UINT(g_tearFlagBounce._h); - flagWord = GHIDRA_CAST((GHIDRA_INT(&(this->_heldTearFlags)._h) + 4)); - *flagWord = *flagWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._h)) + 0x4))); - } - } -LAB_0097c1af: - if (this->_dead != 0) goto LAB_0097c1bc; - } -LAB_0097c301: - iVar6 = this->_timeout; - timeout = &this->_timeout; - if ((0 < iVar6) && (this->_isInterpolating == 0)) { - if ((this->_variant != 2) && (this->_subtype == 2)) { - widthScale = (float)(5 - iVar6) * 0.2 + local_60; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(&this->_color); - iVar6 = *timeout; - local_70.y = 7.00649e-45; - clampedValue = &local_70.y; - if (iVar6 < 5) { - clampedValue = GHIDRA_CAST(timeout); - } - (this->_sprite)._color._tint[3] = - ((float)GHIDRA_INT(*clampedValue) * (this->_sprite)._color._tint[3]) / 5.0; - } - *timeout = iVar6 + -1; - if (iVar6 + -1 < 1) { - this->_dead = 1; - } - } -LAB_0097c3ac: - local_54 = GHIDRA_CAST(0x3e99999a); - if (this->_subtype == 3) { - iVar6 = this->_parent; - if ((iVar6 != 0) && (this->_disableFollowParent == 0)) { - fVar12 = *GHIDRA_CAST((iVar6 + 0x340)); - fVar13 = (this->_parentOffset).y; - (this->_pos).x = *GHIDRA_CAST((iVar6 + 0x33c)) + (this->_parentOffset).x; - (this->_pos).y = fVar12 + fVar13; - fVar12 = *GHIDRA_CAST((this->_parent + 0x364)); - (this->_velocity).x = *GHIDRA_CAST((this->_parent + 0x360)); - (this->_velocity).y = fVar12; - } - iVar6 = this->_variant; - if ((((iVar6 == 1) || (iVar6 == 9)) || (iVar6 == 0xb)) || (iVar6 == 0xe)) { - local_70.y = 2.8026e-44; - clampedValue = &local_70.y; - if (this->_timeout < 0x14) { - clampedValue = GHIDRA_CAST(&this->_timeout); - } - fadeColor._tint[0] = 1.0; - fadeColor._tint[1] = 1.0; - fadeColor._tint[2] = 1.0; - fadeColor._offset[0] = 0.0; - spriteColor = &(this->_sprite)._color; - fadeColor._offset[1] = 0.0; - fadeColor._offset[2] = 0.0; - fadeColor._tint[3] = (float)GHIDRA_INT(*clampedValue) / 20.0; - if (spriteColor != &fadeColor) { - (this->_sprite)._color._colorize[0] = 0.0; - (this->_sprite)._color._colorize[1] = 0.0; - (this->_sprite)._color._colorize[2] = 0.0; - (this->_sprite)._color._colorize[3] = 0.0; - spriteColor->_tint[0] = 1.0; - (this->_sprite)._color._tint[1] = 1.0; - (this->_sprite)._color._tint[2] = 1.0; - (this->_sprite)._color._tint[3] = fadeColor._tint[3]; - (this->_sprite)._color._offset[0] = 0.0; - (this->_sprite)._color._offset[1] = 0.0; - (this->_sprite)._color._offset[2] = 0.0; - } - } - } - else { - fVar12 = radius; - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST(local_38),&this->_tearFlags,&g_tearFlagContinuum); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - Room::GetClampedPositionImpl(g_game->_room,&local_70,&this->_pos,fVar12,fVar12,fVar12,fVar12); - (this->_pos).x = local_70.x; - (this->_pos).y = local_70.y; - } - else if (this->_isInterpolating == 0) { - local_70.y = (this->_pos).x; - pos = &this->_pos; - local_90.y = (this->_pos).y; - Room::ScreenWrapPositionImpl(g_game->_room,&local_80,pos,-200.0,-200.0,-200.0,-200.0); - pos->x = local_80.x; - (this->_pos).y = local_80.y; - if (((pos->x != local_70.y) || ((this->_pos).y != local_90.y)) && - ((local_54 = GHIDRA_CAST(local_60), this->_subtype == 2 && (this->_timeout == 0)))) { - this->_timeout = 0x2d; - } - } - } - if (((this->_variant == 2) || (this->_variant == 10)) && (iVar6 = this->_child, iVar6 != 0)) { - fVar12 = (this->_pos).x; - fVar13 = (this->_pos).y; - if (this->_isInterpolating == 0) { - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST(local_38),&this->_tearFlags,&g_tearFlagContinuum); - if (GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) { - if (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0) { - if (this->_subtype != 3) { - local_70.x = this->_friction * (this->_velocity).x + fVar12; - local_70.y = this->_friction * (this->_velocity).y + fVar13; - Room::GetClampedPositionImpl - (g_game->_room,&local_90,&local_70,radius,radius,radius,radius); - iVar6 = this->_child; - fVar13 = local_90.y; - fVar12 = local_90.x; - } - } - } - } - if (this->_subtype == 2) { - fVar13 = fVar13 - (this->_velocity).y; - fVar12 = fVar12 - (this->_velocity).x; - } - *GHIDRA_CAST((iVar6 + 0x33c)) = fVar12; - *GHIDRA_CAST((iVar6 + 0x340)) = fVar13; - (**(code **)(*GHIDRA_CAST(this->_child) + 0x3c))(&(this->_sprite)._color,0xffffffff,0xff,0,1); - iVar6 = this->_child; - *GHIDRA_CAST((iVar6 + 0x34c)) = (this->_posOffset).x; - *GHIDRA_CAST((iVar6 + 0x350)) = (this->_posOffset).y; - } - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(local_38),&this->_tearFlags,&g_tearFlagHoming); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - iVar6 = 0; - } - else { - iVar6 = 1; - } - this_00 = &this->_homingLaser; - HomingLaser::build_ring_bezier - (this_00,&this->_pos,iVar6,GHIDRA_CAST(this->_parent),radius * widthScale); - (GHIDRA_CAST((this_00)))->HomingLaser::CalculateSamples((float)local_54); - (GHIDRA_CAST((this_00)))->HomingLaser::remove_collinear_samples(0.001); - maskedFlags = BitSet128::operator_and(GHIDRA_CAST(local_38),&this->_tearFlags,&g_tearFlagWiggle); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - if ((this->_parent == 0) || (*GHIDRA_CAST((this->_parent + 0x28)) != 8)) { - if (ownerPlayer == GHIDRA_CAST(0x0)) { - fVar12 = local_60; - } - else { - fVar12 = get_tear_trinket_multiplier(ownerPlayer,10); - } - fVar13 = 0.0; - } - else { - local_70.y = (float)g_game->_frameCount * 1.6; - if (ownerPlayer != GHIDRA_CAST(0x0)) { - local_60 = get_tear_trinket_multiplier(ownerPlayer,10); - } - fVar12 = local_60; - fVar13 = local_70.y; - } - (GHIDRA_CAST((this_00)))->HomingLaser::apply_sine_offset(fVar12,fVar13); - } - this->_isGridHit = 0; - if (this->_entityGridCollisionClass != 0) { - local_70.x = (this->_posOffset).x * 0.8; - local_70.y = (this->_posOffset).y * 0.8; - bVar5 = (GHIDRA_CAST((this_00)))->HomingLaser::clip_samples_to_grid(&local_70,this->_entityGridCollisionClass); - this->_isGridHit = bVar5; - } - if (isHitFrame == '\0') { - if ((((this->_dead == 0) && (this->_isInterpolating == 0)) && (this->_variant == 8)) && - (iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(30.0,0.0), iVar6 != 0)) { - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_98),&this->_pos, - this->_radius,8); - local_14 = 1; - local_54 = GHIDRA_CAST(0x0); - if (local_90.y != 0.0) { - do { - pbVar7 = local_54; - bVar5 = Entity::IsVulnerableEnemy - (*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_98)) + 0x4))) + GHIDRA_INT(local_54) * 4)),GHIDRA_CAST(0x0)); - if (bVar5 != 0) { - bVar5 = Entity::IsDescendantOf - (GHIDRA_CAST(this),*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_98)) + 0x4))) + GHIDRA_INT(pbVar7) * 4))); - if (bVar5 == 0) { - takeDamageFn = *(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_98)) + 0x4))) + GHIDRA_INT(pbVar7) * 4)) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST(local_50))))->EntityRef::constructor(GHIDRA_CAST(savedLaser)); - (*takeDamageFn)(savedLaser->_collisionDamage,0,0,local_50,0x1e); - this = savedLaser; - pbVar7 = local_54; - } - } - local_54 = GHIDRA_CAST((GHIDRA_INT(pbVar7) + 1)); - } while (local_54 < GHIDRA_UINT(local_90.y)); - } - local_14 = 0xffffffff; - if (local_98[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - pqVar10 = &g_allocatedBytesNoHeap; - } - else { - pqVar10 = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_98)) + 0x4))) != 0) { - uVar8 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_98)) + 0x4))) + -4)); - qVar4 = *pqVar10; - *GHIDRA_CAST(pqVar10) = GHIDRA_UINT(*pqVar10) - uVar8; - *GHIDRA_CAST((GHIDRA_CAST(pqVar10) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(pqVar10) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar4) < uVar8)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(local_98)) + 0x4))) + -4)); - } - local_14 = 0xffffffff; - } - } - } - else { - update_endpoint_and_hits(this); - } - local_70.y = this->_impactDistance; - impactDistanceClass = fdclass(local_70.y); - if ((impactDistanceClass < 1) || (this->_isGridHit != 0)) { - bVar11 = true; - } - else { - bVar11 = false; - } - if ((isHitFrame != '\0') && (bVar11)) { - impact_tear_flag_effects(this,&this->_impactPosition,&this->_impactDirection); - } - ExceptionList = local_1c; - return; -} - -// 0097ca90 -uint8_t Entity_Laser::RenderShadowLayer(Vector *offset) -{ - int iVar1; - uint8_t *layerName; - uint8_t bVar2; - char isLastRef; - LayerState *layer; - int *sheetTexture; - AnimationState *layerFrame; - float *pfVar3; - uint8_t *shader; - BitSet128 *maskedFlags; - BitSet128 **clampedRatio; - uint32_t *layerTexture; - int spawnerRoot; - KColor *color; - uint32_t size; - float *pfVar4; - float fVar5; - float fVar6; - float fVar7; - float fVar8; - float shrinkScale; - float fVar9; - float segEndLeftY; - double dVar10; - Vector *bottomRight; - KColor *imageRefCount; - uint64_t uVar11; - uint8_t auStack_21e [2]; - uint8_t quad [112]; - BitSet128 shrinkFlagTest; - BitSet128 growFlagTest; - float uvTopLeftX; - float uvTopLeftY; - float uvTopRightX; - float uvTopRightY; - float uvBottomLeftX; - float uvBottomLeftY; - float uvBottomRightX; - float uvBottomRightY; - uint8_t local_164; - Vector quadCorner1; - Vector quadCorner2; - Vector quadCorner3; - int *shadowTexture; - int *shadowTextureRef; - KColor vertexColor; - ANM2 *laserSprite; - float shadowAlpha; - float endLeftX; - BitSet128 *local_120; - Vector local_11c; - float endRightX; - float local_110; - float startRightX; - BitSet128 *local_108; - Entity_Laser *local_104; - float local_100; - float offsetX; - Vector VStack_f8; - float local_f0; - float local_ec; - float local_e8; - float local_e4; - float segEndRightX; - float local_dc; - BitSet128 *local_d8; - float local_d4; - float *points; - float *pointsEnd; - float *pointsCapacity; - float local_c4; - float local_c0; - float local_bc; - float local_b8; - float local_b4; - float local_b0; - uint8_t frameCopy [24]; - float local_94; - ColorMod shaderColor; - uint32_t stackCookie; - void *local_10; - uint8_t *puStack_c; - float local_8; - - local_8 = -NAN; - puStack_c = &LAB_00b0cc46; - local_10 = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((&shaderColor)[1]._colorize); - if (this->_visible == 0) { - return 1; - } - if ((char)this->_sampleLaser < '\0') { - return 1; - } - fVar5 = 1.0; - spawnerRoot = this->_spawnerEntity; - shadowAlpha = 1.0; - if (spawnerRoot != 0) { - for (; *GHIDRA_CAST((spawnerRoot + 0x3c8)) != 0; spawnerRoot = *GHIDRA_CAST((spawnerRoot + 0x3c8))) { - } - } - ExceptionList = &local_10; - local_104 = this; - spawnerRoot = __RTDynamicCast(spawnerRoot,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor); - if (spawnerRoot != 0) { - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - bVar2 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST((spawnerRoot + 0x1618))); - if (bVar2 == 0) { - FUN_00925df0(); - shadowAlpha = fVar5; - } - } - } - if (this->_sampleLaser == 0) { - ExceptionList = local_10; - return 1; - } - laserSprite = &this->_sprite; - layer = ANM2::GetLayer(laserSprite,GHIDRA_CAST(0x0)); - sheetTexture = LayerState::GetTexture(layer,&local_dc); - spawnerRoot = *sheetTexture; - local_8 = 0.0; - if (((local_d8 != GHIDRA_CAST(0x0)) && - (isLastRef = (**(code **)(GHIDRA_CAST(local_d8->_l) + 0xc))(), isLastRef != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(); - } - local_8 = -NAN; - if (spawnerRoot == 0) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Laser::RenderShadowLayer sprite sheet is not loaded\n")); - ExceptionList = local_10; - return 1; - } - layerName = GHIDRA_CAST(GHIDRA_UINT((1 < GHIDRA_UINT((this->_sprite)._layerCount)))); - layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,GHIDRA_INT(layerName)); - if (layerFrame == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Laser::Render current laser frame is NULL\n")); - ExceptionList = local_10; - return 1; - } - AnimationState::copy_assign(GHIDRA_CAST(frameCopy),layerFrame); - layer = ANM2::GetLayer(&this->_sprite,layerName); - points = GHIDRA_CAST(0x0); - pointsEnd = GHIDRA_CAST(0x0); - pointsCapacity = GHIDRA_CAST(0x0); - local_c4 = local_94 * (this->_sprite)._scale.x * (layer->_size).x; - local_8 = 1.4013e-45; - msvc::vector<8byte>::reserve(); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_wrapSMode = 0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - layer->_wrapTMode = 0; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - LayerState::GetTexture(layer,&shadowTexture); - local_8 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); - local_b4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - offsetX = (this->_posOffset).x * 0.65; - local_100 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) * 0.5; - local_f0 = 0.0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - GHIDRA_INT(local_b4) >> 3 != 1) { - local_ec = -local_100; - do { - pfVar3 = pointsEnd; - VStack_f8.y = (float)(GHIDRA_INT(local_f0) * 8); - local_b8 = *GHIDRA_CAST((GHIDRA_CAST(local_b4) + 8 + GHIDRA_INT(local_f0) * 8)) - - *GHIDRA_CAST((GHIDRA_CAST(local_b4) + GHIDRA_INT(VStack_f8.y))); - local_bc = *GHIDRA_CAST((GHIDRA_CAST(local_b4) + 0xc + GHIDRA_INT(VStack_f8.y))) - - *GHIDRA_CAST((GHIDRA_CAST(local_b4) + 4 + GHIDRA_INT(VStack_f8.y))); - fVar5 = sqrtf(local_bc * local_bc + local_b8 * local_b8); - local_bc = local_bc / fVar5; - local_b8 = -(local_b8 / fVar5); - pfVar4 = GHIDRA_CAST((GHIDRA_INT(local_b4) + GHIDRA_INT(VStack_f8.y))); - local_c0 = (*GHIDRA_CAST((GHIDRA_CAST(local_b4) + 4 + GHIDRA_INT(VStack_f8.y))) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_b4 = g_displayPixelRatio * g_screenPointScale; - local_b0 = ((*pfVar4 - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_d4 = (float)dVar10 / local_b4; - local_b0 = local_c0 * local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_b0 = (float)dVar10; - local_e8 = local_bc * local_100 * local_c4; - local_e4 = local_b8 * local_100 * local_c4; - local_dc = local_e8 + local_d4; - local_d8 = GHIDRA_CAST((local_e4 + local_b0 / local_b4)); - if (pfVar3 == pointsCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *pfVar3 = local_dc; - pfVar3[1] = (float)local_d8; - pointsEnd = pfVar3 + 2; - } - pfVar4 = pointsEnd; - pfVar3 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))) + GHIDRA_INT(VStack_f8.y))); - local_c0 = (pfVar3[1] - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5; - local_b4 = g_displayPixelRatio * g_screenPointScale; - local_b0 = ((*pfVar3 - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_d4 = (float)dVar10 / local_b4; - local_b0 = local_c0 * local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_b0 = (float)dVar10; - local_bc = local_bc * local_ec * local_c4; - local_b8 = local_b8 * local_ec * local_c4; - startRightX = local_bc + local_d4; - local_108 = GHIDRA_CAST((local_b8 + local_b0 / local_b4)); - if (pfVar4 == pointsCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *pfVar4 = startRightX; - pfVar4[1] = (float)local_108; - pointsEnd = pfVar4 + 2; - } - pfVar4 = pointsEnd; - spawnerRoot = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_c0 = (*GHIDRA_CAST((GHIDRA_CAST(VStack_f8.y) + 0xc + spawnerRoot)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_b4 = g_displayPixelRatio * g_screenPointScale; - local_b0 = ((*GHIDRA_CAST((GHIDRA_CAST(VStack_f8.y) + 8 + spawnerRoot)) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_d4 = (float)dVar10 / local_b4; - local_b0 = local_c0 * local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_b0 = (float)dVar10; - local_120 = GHIDRA_CAST((local_e4 + local_b0 / local_b4)); - endLeftX = local_e8 + local_d4; - if (pfVar4 == pointsCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *pfVar4 = endLeftX; - pfVar4[1] = (float)local_120; - pointsEnd = pfVar4 + 2; - } - pfVar4 = pointsEnd; - iVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - spawnerRoot = GHIDRA_INT(VStack_f8.y) + 8; - VStack_f8.y = (*GHIDRA_CAST((GHIDRA_CAST(VStack_f8.y) + 0xc + iVar1)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_b4 = g_displayPixelRatio * g_screenPointScale; - local_b0 = ((*GHIDRA_CAST((spawnerRoot + iVar1)) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * - local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_c0 = (float)dVar10 / local_b4; - local_b0 = VStack_f8.y * local_b4 + 0.5; - dVar10 = floor((double)local_b0); - local_b0 = (float)dVar10; - local_110 = local_b8 + local_b0 / local_b4; - endRightX = local_bc + local_c0; - if (pfVar4 == pointsCapacity) { - msvc::vector::_Emplace_reallocate(); - } - else { - *pfVar4 = endRightX; - pfVar4[1] = local_110; - pointsEnd = pfVar4 + 2; - } - local_b4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - local_f0 = (float)(GHIDRA_INT(local_f0) + 1); - } while (GHIDRA_UINT(local_f0) < (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - GHIDRA_INT(local_b4) >> 3) - 1U); - } - spawnerRoot = this->_subtype; - if (((spawnerRoot == 1) || (spawnerRoot == 2)) || (spawnerRoot == 3)) { - msvc::vector::erase(&local_d8); - msvc::vector::_Insert_n(pointsEnd,points); - } - pfVar4 = pointsEnd; - local_ec = 0.0; - bVar2 = is_thick_variant(this); - if (((bVar2 != 0) || (this->_variant == 5)) || (this->_variant == 8)) { - shader = &g_shaders; - if ((DAT_00c7911c & 1) == 0) { - shader = g_currentShader; - } - fVar5 = (float)(GHIDRA_INT(pfVar4) - GHIDRA_INT(points) >> 3); - local_b0 = 0.0; - g_currentShader = shader; - if (fVar5 != 0.0) { - pfVar4 = points + 0xb; - do { - if (GHIDRA_UINT(local_b0) < GHIDRA_INT(fVar5) - 4U) { - pfVar4[-7] = (pfVar4[-3] + pfVar4[-7]) * 0.5; - pfVar4[-6] = (pfVar4[-2] + pfVar4[-6]) * 0.5; - pfVar4[-5] = (pfVar4[-1] + pfVar4[-5]) * 0.5; - pfVar4[-4] = (*pfVar4 + pfVar4[-4]) * 0.5; - } - if (local_b0 == 0.0) { - local_e4 = pfVar4[-10]; - } - else { - pfVar4[-0xb] = pfVar4[-0xf]; - local_e4 = pfVar4[-0xe]; - pfVar4[-10] = local_e4; - pfVar4[-9] = pfVar4[-0xd]; - pfVar4[-8] = pfVar4[-0xc]; - } - local_c4 = g_displayPixelRatio * g_screenPointScale; - local_b4 = (((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x20)) + 20.0) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * local_c4 + 0.5; - dVar10 = floor((double)local_b4); - local_b4 = (float)dVar10; - if ((local_e4 <= local_b4 / local_c4) && - (local_d4 = pfVar4[-8], local_d4 <= local_b4 / local_c4)) { - local_b8 = pfVar4[-0xb]; - local_bc = pfVar4[-9]; - local_100 = pfVar4[-6]; - segEndRightX = pfVar4[-5]; - local_c0 = pfVar4[-4]; - local_e8 = pfVar4[-7]; - local_c4 = (local_b8 + local_bc) * 0.5; - local_f0 = (local_e4 + local_d4) * 0.5; - VStack_f8.y = (segEndRightX + local_e8) * 0.5; - local_110 = (local_100 + local_c0) * 0.5; - local_b4 = sqrtf((local_110 - local_f0) * (local_110 - local_f0) + - (VStack_f8.y - local_c4) * (VStack_f8.y - local_c4)); - local_d8 = &local_104->_tearFlags; - maskedFlags = BitSet128::operator_and(&growFlagTest,local_d8,&g_tearFlagGrow); - if (((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) || - (((spawnerRoot = local_104->_subtype, spawnerRoot == 1 || (spawnerRoot == 2)) || - (spawnerRoot == 3)))) { - fVar9 = local_e4; - fVar6 = local_d4; - segEndLeftY = local_100; - fVar7 = local_c0; - } - else { - local_108 = GHIDRA_CAST(0x3f800000); - local_120 = GHIDRA_CAST((local_ec / 1000.0)); - clampedRatio = &local_120; - if (1.0 <= local_ec / 1000.0) { - clampedRatio = &local_108; - } - local_120 = GHIDRA_CAST(0x3f800000); - fVar6 = (float)*clampedRatio * 1.5 + 1.0; - local_b8 = fVar6 * (local_b8 - local_c4) + local_c4; - local_bc = fVar6 * (local_bc - local_c4) + local_c4; - local_108 = GHIDRA_CAST(((local_b4 + local_ec) / 1000.0)); - clampedRatio = &local_108; - if (1.0 <= (float)local_108) { - clampedRatio = &local_120; - } - fVar7 = (float)*clampedRatio * 1.5 + 1.0; - local_e8 = fVar7 * (local_e8 - VStack_f8.y) + VStack_f8.y; - segEndRightX = fVar7 * (segEndRightX - VStack_f8.y) + VStack_f8.y; - fVar9 = fVar6 * (local_e4 - local_f0) + local_f0; - fVar6 = fVar6 * (local_d4 - local_f0) + local_f0; - segEndLeftY = fVar7 * (local_100 - local_110) + local_110; - fVar7 = fVar7 * (local_c0 - local_110) + local_110; - } - fVar8 = local_e8; - maskedFlags = BitSet128::operator_and(&shrinkFlagTest,local_d8,&g_tearFlagShrink); - if (((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - ((spawnerRoot = local_104->_subtype, spawnerRoot != 1 && - ((spawnerRoot != 2 && (spawnerRoot != 3)))))) { - local_108 = GHIDRA_CAST(0x3f800000); - local_d8 = GHIDRA_CAST((local_ec / 300.0)); - clampedRatio = &local_d8; - if (1.0 <= local_ec / 300.0) { - clampedRatio = &local_108; - } - local_108 = GHIDRA_CAST(0x3f800000); - fVar8 = 1.0 - (float)*clampedRatio * 0.5; - local_b8 = fVar8 * (local_b8 - local_c4) + local_c4; - fVar9 = fVar8 * (fVar9 - local_f0) + local_f0; - local_bc = fVar8 * (local_bc - local_c4) + local_c4; - fVar6 = fVar8 * (fVar6 - local_f0) + local_f0; - local_d8 = GHIDRA_CAST(((local_b4 + local_ec) / 300.0)); - clampedRatio = &local_d8; - if (1.0 <= (float)local_d8) { - clampedRatio = &local_108; - } - shrinkScale = 1.0 - (float)*clampedRatio * 0.5; - fVar8 = shrinkScale * (local_e8 - VStack_f8.y) + VStack_f8.y; - segEndLeftY = shrinkScale * (segEndLeftY - local_110) + local_110; - segEndRightX = shrinkScale * (segEndRightX - VStack_f8.y) + VStack_f8.y; - fVar7 = shrinkScale * (fVar7 - local_110) + local_110; - } - uvBottomLeftY = local_b4 + local_ec; - uvTopRightX = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))); - uvBottomLeftX = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - uvTopLeftX = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - uvTopRightY = local_ec; - uvTopLeftY = local_ec; - local_164 = 1; - uvBottomRightX = uvTopRightX; - uvBottomRightY = uvBottomLeftY; - local_ec = uvBottomLeftY; - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffffffff); - local_11c.x = offset->x; - local_11c.y = offset->y; - quadCorner3.x = local_11c.x + offsetX + fVar8; - quadCorner3.y = local_11c.y + segEndLeftY + 0.0; - bottomRight = &quadCorner3; - quadCorner2.x = local_11c.x + offsetX + segEndRightX; - quadCorner2.y = local_11c.y + fVar7 + 0.0; - quadCorner1.x = local_11c.x + offsetX + local_b8; - quadCorner1.y = local_11c.y + fVar9 + 0.0; - local_11c.y = local_11c.y + fVar6 + 0.0; - local_11c.x = local_11c.x + offsetX + local_bc; - imageRefCount = color; - set_quad_corner_colors(quad,&local_11c,&quadCorner1,&quadCorner2,bottomRight,color); - shaderColor._tint[0] = 0.0; - shaderColor._colorize[0] = 0.0; - shaderColor._colorize[1] = 0.0; - shaderColor._colorize[2] = 0.0; - shaderColor._colorize[3] = 0.0; - shaderColor._tint[1] = 0.0; - shaderColor._tint[3] = shadowAlpha * 0.5; - shaderColor._tint[2] = 0.0; - shaderColor._offset[0] = 0.0; - shaderColor._offset[1] = 0.0; - shaderColor._offset[2] = 0.0; - (GHIDRA_CAST((auStack_21e + -10)))->KAGE::SmartPointer::operator_assign(&shadowTexture); - apply_sprite_shader_params(&shaderColor,1,bottomRight,imageRefCount); - vertexColor._unk = 0; - vertexColor._red = shaderColor._tint[0]; - vertexColor._green = shaderColor._tint[1]; - vertexColor._blue = shaderColor._tint[2]; - vertexColor._alpha = shaderColor._tint[3]; - (**(code **)(*shadowTexture + 0x14))(&uvTopLeftX); - } - pfVar4 = pfVar4 + 8; - local_b0 = (float)(GHIDRA_INT(local_b0) + 4); - } while (GHIDRA_UINT(local_b0) < GHIDRA_UINT(fVar5)); - this = local_104; - } - } - if (GHIDRA_UINT((this->_sprite)._layerCount) < 2) { -LAB_0097e2ff: - pfVar4 = points; - } - else { - switch(this->_variant) { - case 1: - case 3: - case 6: - case 9: - case 0xb: - case 0xc: - case 0xd: - case 0xe: - case 0xf: - if (this->_subtype != 0) goto LAB_0097e2ff; - layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0); - if (layerFrame == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Laser::Render current frame is NULL\n")); - TexturePtr::release(); - if (points == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return 1; - } - size = GHIDRA_INT(pointsCapacity) - GHIDRA_INT(points) & 0xfffffff8; - pfVar3 = points; - if (0xfff < size) { - pfVar3 = GHIDRA_CAST(points[-1]); - size = size + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(points) + (-4 - GHIDRA_INT(pfVar3))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - goto code_r0x0097e364; - } - AnimationState::copy_assign(GHIDRA_CAST(frameCopy),layerFrame); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - pfVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - uvTopLeftY = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))) + 0.01; - uvBottomLeftY = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0xc))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x4))); - local_c4 = local_94 * (layer->_size).x * (this->_sprite)._scale.x; - local_164 = 1; - uvTopRightX = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) + (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - uvBottomLeftX = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - uvTopLeftX = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x0))); - local_11c.x = *pfVar4 - (this->_pos).x; - local_11c.y = pfVar4[1] - (this->_pos).y; - uvTopRightY = uvTopLeftY; - uvBottomRightX = uvTopRightX; - uvBottomRightY = uvBottomLeftY; - (GHIDRA_CAST((&local_11c)))->Vector::Normalized(&VStack_f8); - local_104 = GHIDRA_CAST((GHIDRA_UINT(VStack_f8.x) ^ 0x80000000)); - local_108 = GHIDRA_CAST((VStack_f8.y * (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x14))))); - fVar9 = VStack_f8.x * (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x14))); - local_b4 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)frameCopy)) + 0x8))) * 0.5; - fVar5 = VStack_f8.y; - (GHIDRA_CAST((&vertexColor)))->KColor::SetFromARGB(0xffffffff); - pfVar4 = points; - local_11c.x = VStack_f8.x * 0.005 + offset->x + offsetX + *points; - local_11c.y = fVar5 * 0.005 + offset->y + points[1] + 0.0; - quadCorner1.x = VStack_f8.x * 0.005 + offset->x + offsetX + points[2]; - quadCorner1.y = fVar5 * 0.005 + offset->y + points[3] + 0.0; - local_b0 = g_displayPixelRatio * g_screenPointScale; - local_d8 = (BitSet128 *) - ((((fVar9 + (this->_pos).x) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * - local_b0 + 0.5); - dVar10 = floor((double)(float)local_d8); - local_120 = GHIDRA_CAST(((float)dVar10 / local_b0)); - local_d8 = (BitSet128 *) - (((((float)local_108 + (this->_pos).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * local_b0 + 0.5); - dVar10 = floor((double)(float)local_d8); - local_d8 = GHIDRA_CAST((float)dVar10); - quadCorner2.x = offset->x + offsetX + (float)local_120 + local_c4 * local_b4 * VStack_f8.y; - quadCorner2.y = - offset->y + (float)local_d8 / local_b0 + local_c4 * (float)local_104 * local_b4 + 0.0; - quadCorner3.x = offset->x + offsetX + (float)local_120 + local_c4 * -local_b4 * VStack_f8.y; - quadCorner3.y = - offset->y + (float)local_d8 / local_b0 + local_c4 * (float)local_104 * -local_b4 + 0.0; - set_quad_corner_colors(quad,&quadCorner3,&quadCorner2,&quadCorner1,&local_11c,&vertexColor); - FUN_00682260(); - shaderColor._colorize[0] = 0.0; - shaderColor._colorize[1] = 0.0; - shaderColor._colorize[2] = 0.0; - shaderColor._colorize[3] = 0.0; - shaderColor._tint[3] = shadowAlpha * 0.5; - shaderColor._tint[0] = 0.0; - shaderColor._tint[1] = 0.0; - shaderColor._tint[2] = 0.0; - shaderColor._offset[0] = 0.0; - shaderColor._offset[1] = 0.0; - shaderColor._offset[2] = 0.0; - uVar11 = 0x97e28d; - layer = ANM2::GetLayer(laserSprite,GHIDRA_CAST(0x0)); - LayerState::GetTexture(layer,auStack_21e + -10); - apply_sprite_shader_params(&shaderColor,1,(void *)uVar11,(void *)((uint64_t)uVar11 >> 0x20)); - layer = ANM2::GetLayer(laserSprite,GHIDRA_CAST(0x0)); - layerTexture = LayerState::GetTexture(layer,&local_11c); - local_8 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); - vertexColor._unk = 0; - vertexColor._red = shaderColor._tint[0]; - vertexColor._green = shaderColor._tint[1]; - vertexColor._blue = shaderColor._tint[2]; - vertexColor._alpha = shaderColor._tint[3]; - (**(code **)(*GHIDRA_CAST(*layerTexture) + 0x14))(&uvTopLeftX); - TexturePtr::release(); - break; - default: - goto LAB_0097e2ff; - } - } - local_8 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),4); - if (((shadowTextureRef != GHIDRA_CAST(0x0)) && - (isLastRef = (**(code **)(*shadowTextureRef + 0xc))(), isLastRef != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(); - } - if (pfVar4 == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return 1; - } - size = GHIDRA_INT(pointsCapacity) - GHIDRA_INT(pfVar4) & 0xfffffff8; - pfVar3 = pfVar4; - if (0xfff < size) { - pfVar3 = GHIDRA_CAST(pfVar4[-1]); - size = size + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pfVar4) + (-4 - GHIDRA_INT(pfVar3))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } -code_r0x0097e364: - operator_delete(pfVar3,size); - ExceptionList = local_10; - return 1; -} - -// 0097e3b0 -void * Entity_Laser::GetSamples() -{ - return &(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c))); -} - -// 0097e3c0 -void Entity_Laser::damage_entity(Entity *param_2) -{ - uint32_t *puVar1; - uint8_t bVar2; - std_vector *hitList; - uint32_t uVar3; - int *piVar4; - int iVar5; - BitSet128 *maskedFlags; - Entity_Laser *extraout_ECX; - Entity_Laser *unused; - code *takeDamageFn; - float in_XMM2_Da; - float fVar6; - uint32_t uVar7; - int unused2; - EntityRef sourceRef; - RNG local_38; - BitSet128 *tearFlags; - uint32_t damageFlagsLo; - uint32_t damageFlagsHi; - Entity_Laser *local_18; - float local_14; - uint32_t local_10; - uint32_t securityCookie; - uint8_t auStack_8 [4]; - uint64_t flags; - Manager *manager; - - securityCookie = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - local_14 = in_XMM2_Da; - if (this->_parentLaser == 0) { - hitList = &this->_hitList; - } - else { - hitList = GHIDRA_CAST(FUN_0096ce70()); - } - uVar3 = (GHIDRA_CAST((param_2)))->Entity::GetHitListIndex(); - unused2 = 0x97e405; - sorted_vector_insert_unique(hitList,uVar3); - iVar5 = param_2->_type; - if (iVar5 == 4) { - return; - } - local_18 = this; - if (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0)) { - local_18 = GHIDRA_CAST(this->_spawnerEntity); - } - if (iVar5 == 1) { - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - piVar4 = GHIDRA_CAST(__RTDynamicCast(param_2,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0)); - takeDamageFn = *(code **)(*piVar4 + 0x20); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(local_18)); - uVar3 = 8; - fVar6 = 1.0; - uVar7 = 0; - goto LAB_0097e6ba; - } - unused2 = 0x97e480; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(param_2); - unused = extraout_ECX; - if (bVar2 != 0) { - return; - } - } - else { - unused = local_18; - if ((iVar5 == 3) && - (((unused = GHIDRA_CAST(param_2->_variant), unused == GHIDRA_CAST(0x3e) || - ((g_game->_challenge == 0x1e && (unused == GHIDRA_CAST(&DAT_00000043))))) && - (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)))) { - iVar5 = __RTDynamicCast(param_2,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - takeDamageFn = *(code **)(**GHIDRA_CAST((iVar5 + 0x410)) + 0x20); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(local_18)); - uVar7 = 0; - uVar3 = 0x808; - fVar6 = 1.0; - goto LAB_0097e6ba; - } - } - damageFlagsLo = 8; - damageFlagsHi = 0; - tearFlags = &this->_tearFlags; - get_tear_flags_from_player - (GHIDRA_CAST(&damageFlagsLo),GHIDRA_INT(unused),this->_tearFlags,unused2,GHIDRA_CAST(this)); - Entity_Tear::ApplyTearFlagEffects(param_2,&this->_pos,this->_tearFlags,GHIDRA_CAST(this),local_14); - if (((param_2->_flags & 0x100000000000000) != 0) && - (bVar2 = is_thick_variant(this), manager = g_manager, bVar2 != 0)) { - local_10 = 0x4d; - seed_fart_sound_override(GHIDRA_CAST(&local_10)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_10,0.7,8,0,1.0,0.0); - flags = param_2->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(¶m_2->_flags) + 4)); - *puVar1 = *puVar1 | 0x800000; - *GHIDRA_CAST(¶m_2->_flags) = GHIDRA_INT(flags); - local_14 = local_14 + local_14 + 3.0; - } - if ((this->_blackHpDropChance <= 0.0) || (bVar2 = (GHIDRA_CAST((param_2)))->Entity::IsActiveEnemy(0), bVar2 == 0)) { -LAB_0097e656: - uVar3 = damageFlagsLo; - } - else { - local_38._seed = param_2->_initSeed; - local_38._shift1 = 1; - local_38._shift2 = 5; - local_38._shift3 = 0x13; - fVar6 = (GHIDRA_CAST((&local_38)))->RNG::RandomFloat(); - if (this->_blackHpDropChance <= fVar6) goto LAB_0097e656; - uVar3 = damageFlagsLo | 0x800000; - } - uVar7 = damageFlagsHi; - local_10 = damageFlagsHi; - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && - ((maskedFlags = BitSet128::operator_and(GHIDRA_CAST(&local_38),tearFlags,&g_tearFlagLasershot), - GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0 || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)))) { - local_10 = uVar7 | 8; - } - takeDamageFn = *(code **)(*GHIDRA_CAST(param_2) + 0x20); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(local_18)); - fVar6 = local_14; - uVar7 = local_10; -LAB_0097e6ba: - (*takeDamageFn)(fVar6,uVar3,uVar7,&sourceRef,0x1e); - return; -} - -// 0097e6e0 -void * Entity_Laser::GetNonOptimizedSamples() -{ - return &(this->_homingLaser)._nonOptimizedSamples; -} - -// 0097e6f0 -void Entity_Laser::Interpolate() -{ - float friction; - int subtype; - - if ((this->_waitFrames < 1) && (this->_isFirstUpdate == 0)) { - this->_isInterpolating = 1; - (this->_preInterpolatePos).x = (this->_pos).x; - (this->_preInterpolatePos).y = (this->_pos).y; - subtype = this->_subtype; - if ((subtype == 1) || (subtype == 2)) { - friction = this->_friction; - (this->_pos).x = friction * (this->_velocity).x * 0.5 + (this->_pos).x; - (this->_pos).y = friction * (this->_velocity).y * 0.5 + (this->_pos).y; - } - else if (subtype != 3) { - update_laser(this); - return; - } - UpdateHits(this); - } - return; -} - -// 0097e7a0 -uint8_t Entity_Laser::CanOverwrite() -{ - uint32_t uVar1; - - uVar1 = GHIDRA_UINT(this->_flags) & 0x200000; - if ((uVar1 == 0) && (this->_isFirstUpdate == 0)) { - return 1; - } - return uVar1; -} - -// 0097e800 -void Entity_Laser::ClearReferences() -{ - int remaining; - Entity_Laser *laserRef; - Entity_Laser *eraseRef; - uint32_t *parentLaserRef; - - eraseRef = this; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))); - remaining = 2; - do { - if ((this->_removedByFactory != 0) && (*GHIDRA_CAST(laserRef) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(laserRef) + 0x28))(); - (**(code **)(**GHIDRA_CAST(laserRef) + 0x44))(); - } - if (*GHIDRA_CAST(laserRef) != 0) { - eraseRef = laserRef; - msvc::multiset::erase(&eraseRef); - } - *GHIDRA_CAST(laserRef) = 0; - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((laserRef)) + 0x4)))); - remaining = remaining + -1; - } while (remaining != 0); - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504)))); - remaining = 4; - do { - if ((this->_removedByFactory != 0) && (*GHIDRA_CAST(laserRef) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(laserRef) + 0x28))(); - (**(code **)(**GHIDRA_CAST(laserRef) + 0x44))(); - } - if (*GHIDRA_CAST(laserRef) != 0) { - eraseRef = laserRef; - msvc::multiset::erase(&eraseRef); - } - *GHIDRA_CAST(laserRef) = 0; - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((laserRef)) + 0x4)))); - remaining = remaining + -1; - } while (remaining != 0); - if ((this->_removedByFactory != 0) && (this->_bounceLaser != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_bounceLaser) + 0x28))(); - (**(code **)(*GHIDRA_CAST(this->_bounceLaser) + 0x44))(); - } - if (this->_bounceLaser != (void *)0x0) { - eraseRef = GHIDRA_CAST(&this->_bounceLaser); - msvc::multiset::erase(&eraseRef); - } - this->_bounceLaser = (void *)0x0; - if ((this->_removedByFactory != 0) && (GHIDRA_CAST(this->_childLaser) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_childLaser) + 0x28))(); - (**(code **)(*GHIDRA_CAST(this->_childLaser) + 0x44))(); - } - if (this->_childLaser != 0) { - eraseRef = GHIDRA_CAST(&this->_childLaser); - msvc::multiset::erase(&eraseRef); - } - this->_childLaser = 0; - parentLaserRef = &this->_parentLaser; - if (*parentLaserRef != 0) { - eraseRef = GHIDRA_CAST(parentLaserRef); - msvc::multiset::erase(&eraseRef); - *parentLaserRef = 0; - } - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x530)))); - remaining = 2; - do { - if ((this->_removedByFactory != 0) && (*GHIDRA_CAST(laserRef) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(laserRef) + 0x28))(); - (**(code **)(**GHIDRA_CAST(laserRef) + 0x44))(); - } - if (*GHIDRA_CAST(laserRef) != 0) { - eraseRef = laserRef; - msvc::multiset::erase(&eraseRef); - *GHIDRA_CAST(laserRef) = 0; - } - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((laserRef)) + 0x4)))); - remaining = remaining + -1; - } while (remaining != 0); - if ((this->_removedByFactory != 0) && (GHIDRA_CAST(this->_continuumLaser) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_continuumLaser) + 0x28))(); - (**(code **)(*GHIDRA_CAST(this->_continuumLaser) + 0x44))(); - } - if (this->_continuumLaser != 0) { - eraseRef = GHIDRA_CAST(&this->_continuumLaser); - msvc::multiset::erase(&eraseRef); - this->_continuumLaser = 0; - } - if (this->_tearWaitEffect != 0) { - eraseRef = GHIDRA_CAST(&this->_tearWaitEffect); - msvc::multiset::erase(&eraseRef); - this->_tearWaitEffect = 0; - } - return; -} - -// 0097ea30 -void Entity_Laser::Remove() -{ - int *laserRef; - int remaining; - int *laser; - - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Remove(); - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4f8)))); - remaining = 2; - do { - laser = GHIDRA_CAST(*laserRef); - if ((laser != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(laser) + 0x172)) != '\0')) { - (**(code **)(*laser + 0x28))(); - } - laserRef = laserRef + 1; - remaining = remaining + -1; - } while (remaining != 0); - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x504)))); - remaining = 4; - do { - laser = GHIDRA_CAST(*laserRef); - if ((laser != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(laser) + 0x172)) != '\0')) { - (**(code **)(*laser + 0x28))(); - } - laserRef = laserRef + 1; - remaining = remaining + -1; - } while (remaining != 0); - if (this->_oneHit == 0) { - laserRef = this->_bounceLaser; - if ((laserRef != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(laserRef) + 0x172)) != '\0')) { - (**(code **)(*laserRef + 0x28))(); - } - laserRef = GHIDRA_CAST(this->_childLaser); - if ((laserRef != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(laserRef) + 0x172)) != '\0')) { - (**(code **)(*laserRef + 0x28))(); - } - laserRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x530)))); - remaining = 2; - do { - laser = GHIDRA_CAST(*laserRef); - if ((laser != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(laser) + 0x172)) != '\0')) { - (**(code **)(*laser + 0x28))(); - } - laserRef = laserRef + 1; - remaining = remaining + -1; - } while (remaining != 0); - laserRef = GHIDRA_CAST(this->_continuumLaser); - if ((laserRef != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(laserRef) + 0x172)) != '\0')) { - (**(code **)(*laserRef + 0x28))(); - } - } - laserRef = GHIDRA_CAST(this->_child); - if ((laserRef != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(laserRef) + 0x172)) != '\0')) { - (**(code **)(*laserRef + 0x28))(); - } - if ((this->_variant == 1) && (this->_spawnerType == 0x193)) { - SFXManager::Stop(&g_manager->_sfxManager,0x3cb); - } - return; -} - -// 0097eb50 -void Entity_Laser::PostRender() -{ - void *pvVar1; - int circleSegments; - KColor *fromColor; - int segment; - float fVar2; - float fVar3; - float fVar4; - float fVar5; - float fVar6; - float fVar7; - float fVar8; - float fVar9; - float fVar10; - float fVar11; - double dVar12; - double dVar13; - uint32_t sampleIndex; - float nextSampleX; - float nextSampleY; - Vector circlePrevPoint; - Vector leftEdgeEnd; - Vector leftEdgeStart; - Vector rightEdgeEnd; - Vector edgeStart; - Vector edgeEnd; - uint32_t collisionClass; - float *firstSample; - - if (((((GHIDRA_UINT(g_game->_debugFlags) >> 5 & 1) != 0) && (0.0 < this->_size)) && - (this->_entityCollisionClass != 0)) && (-1 < (char)this->_sampleLaser)) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c942b0) && - (_Init_thread_header(), DAT_00c942b0 == -1)) { - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c942b8))))->KColor::SetFromARGB(0xff000000); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c942cc))))->KColor::SetFromARGB(0xffffa500); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c942e0))))->KColor::SetFromARGB(0xffffc0cb); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c942f4))))->KColor::SetFromARGB(0xff00ff00); - (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c94308))))->KColor::SetFromARGB(0xffff0000); - _Init_thread_footer(); - } - collisionClass = this->_entityCollisionClass; - if ((GHIDRA_INT(collisionClass) < 1) || (4 < collisionClass)) { - fromColor = GHIDRA_CAST(&DAT_00c942b8); - } - else { - fromColor = GHIDRA_CAST((&DAT_00c942b8 + collisionClass * 0x14)); - } - if (this->_sampleLaser == 0) { - fVar2 = this->_angleDegrees * 0.017453292; - fVar3 = cos(fVar2); - fVar2 = sin(fVar2); - fVar6 = ABS((this->_posOffset).y) + this->_laserLength; - fVar10 = cos(1.5707964); - fVar5 = sin(1.5707964); - fVar8 = g_displayPixelRatio * g_screenPointScale; - fVar4 = (g_screenHeight - 182.0) * 0.5; - fVar7 = (g_screenWidth - 338.0) * 0.5; - fVar9 = (fVar10 * fVar3 - fVar5 * fVar2) * this->_size * 0.65; - fVar11 = (fVar5 * fVar3 + fVar10 * fVar2) * this->_size * 0.65; - dVar12 = floor((double)((((this->_pos).x - 60.0) * 0.65 + fVar7) * fVar8 + 0.5)); - dVar13 = floor((double)((((this->_pos).y - 140.0) * 0.65 + fVar4) * fVar8 + 0.5)); - pvVar1 = g_game->_room; - fVar10 = (float)dVar13 / fVar8 + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1208)); - fVar5 = (float)dVar12 / fVar8 + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1204)); - dVar12 = floor((double)((((fVar6 * fVar3 + (this->_pos).x) - 60.0) * 0.65 + fVar7) * fVar8 + - 0.5)); - dVar13 = floor((double)((((fVar6 * fVar2 + (this->_pos).y) - 140.0) * 0.65 + fVar4) * fVar8 + - 0.5)); - fVar2 = (float)dVar12 / fVar8 + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1204)); - edgeEnd.x = fVar2 - fVar9; - fVar3 = (float)dVar13 / fVar8 + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1208)); - edgeEnd.y = fVar3 - fVar11; - edgeStart.x = fVar5 - fVar9; - edgeStart.y = fVar10 - fVar11; - render_color_quad(&edgeStart,&edgeEnd,fromColor,fromColor,1.0); - edgeEnd.x = fVar2 + fVar9; - edgeStart.x = fVar9 + fVar5; - edgeEnd.y = fVar3 + fVar11; - edgeStart.y = fVar11 + fVar10; - render_color_quad(&edgeStart,&edgeEnd,fromColor,fromColor,1.0); - } - else { - sampleIndex = 0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))) >> 3 - != 1) { - fVar2 = cos(1.5707964); - fVar3 = sin(1.5707964); - circleSegments = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))); - do { - segment = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - fVar6 = *GHIDRA_CAST((segment + sampleIndex * 8)); - fVar10 = *GHIDRA_CAST((segment + 4 + sampleIndex * 8)); - nextSampleX = *GHIDRA_CAST((segment + 8 + sampleIndex * 8)); - nextSampleY = *GHIDRA_CAST((segment + 0xc + sampleIndex * 8)); - if (((((this->_subtype != 1) && (this->_subtype != 2)) && (this->_subtype != 3)) && - ((sampleIndex == (circleSegments - segment >> 3) - 2U && (this->_isGridHit == 0)))) && - (this->_maxDistance <= 0.0)) { - fVar5 = nextSampleY - fVar10; - fVar7 = nextSampleX - fVar6; - fVar4 = sqrtf(fVar5 * fVar5 + fVar7 * fVar7); - if (0.0 < fVar4) { - fVar5 = (40.0 / fVar4) * fVar5; - fVar7 = (40.0 / fVar4) * fVar7; - } - nextSampleX = nextSampleX + fVar7; - nextSampleY = nextSampleY + fVar5; - } - fVar4 = (g_screenHeight - 182.0) * 0.5; - fVar5 = (g_screenWidth - 338.0) * 0.5; - fVar7 = g_displayPixelRatio * g_screenPointScale; - dVar12 = floor((double)(((fVar6 - 60.0) * 0.65 + fVar5) * fVar7 + 0.5)); - dVar13 = floor((double)(((fVar10 - 140.0) * 0.65 + fVar4) * fVar7 + 0.5)); - fVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1204)); - fVar8 = fVar6 + (float)dVar12 / fVar7; - fVar10 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1208)); - fVar9 = fVar10 + (float)dVar13 / fVar7; - dVar12 = floor((double)(((nextSampleX - 60.0) * 0.65 + fVar5) * fVar7 + 0.5)); - dVar13 = floor((double)(((nextSampleY - 140.0) * 0.65 + fVar4) * fVar7 + 0.5)); - fVar6 = fVar6 + (float)dVar12 / fVar7; - fVar10 = fVar10 + (float)dVar13 / fVar7; - fVar4 = fVar6 - fVar8; - fVar7 = fVar10 - fVar9; - fVar5 = sqrtf(fVar4 * fVar4 + fVar7 * fVar7); - if (0.0 < fVar5) { - fVar7 = fVar7 * (1.0 / fVar5); - fVar4 = fVar4 * (1.0 / fVar5); - } - fVar11 = (fVar2 * fVar4 - fVar3 * fVar7) * this->_size * 0.65; - leftEdgeEnd.x = fVar6 - fVar11; - leftEdgeStart.x = fVar8 - fVar11; - fVar5 = (fVar3 * fVar4 + fVar2 * fVar7) * this->_size * 0.65; - leftEdgeEnd.y = fVar10 - fVar5; - leftEdgeStart.y = fVar9 - fVar5; - render_color_quad(&leftEdgeStart,&leftEdgeEnd,fromColor,fromColor,1.0); - rightEdgeEnd.x = fVar6 + fVar11; - rightEdgeEnd.y = fVar10 + fVar5; - edgeStart.y = fVar5 + fVar9; - edgeStart.x = fVar8 + fVar11; - render_color_quad(&edgeStart,&rightEdgeEnd,fromColor,fromColor,1.0); - if (sampleIndex == 0) { - switch(this->_variant) { - case 1: - case 3: - case 6: - case 9: - case 0xb: - case 0xc: - case 0xd: - case 0xe: - case 0xf: - fVar6 = this->_angleDegrees * 0.017453292; - firstSample = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - fVar5 = g_displayPixelRatio * g_screenPointScale; - fVar10 = cos(fVar6); - dVar12 = floor((double)((((*firstSample - fVar10 * 16.0) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * fVar5 + 0.5)); - fVar6 = sin(fVar6); - dVar13 = floor((double)((((firstSample[1] - fVar6 * 16.0) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * fVar5 + 0.5)); - fVar6 = (float)dVar12 / fVar5 + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1204)); - fVar5 = (float)dVar13 / fVar5 + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1208)); - fVar10 = cos(0.0); - circlePrevPoint.x = fVar10 * this->_size * 0.65 + fVar6; - fVar10 = sin(0.0); - fVar4 = (this->_size * 6.2831855) / 10.0; - circlePrevPoint.y = fVar10 * this->_size * 0.65 + fVar5; - if (fVar4 <= 2.0) { - fVar4 = 2.0; - } - if (12.0 <= fVar4) { - fVar4 = 12.0; - } - circleSegments = GHIDRA_INT(fVar4); - segment = 1; - if (0 < circleSegments * 4) { - do { - fVar4 = (((float)segment * 180.0) / (float)(circleSegments * 2)) * 0.017453292; - fVar10 = cos(fVar4); - fVar10 = fVar10 * this->_size * 0.65 + fVar6; - edgeEnd.x = fVar10; - fVar4 = sin(fVar4); - fVar4 = fVar4 * this->_size * 0.65 + fVar5; - edgeEnd.y = fVar4; - render_color_quad(&circlePrevPoint,&edgeEnd,fromColor,fromColor,1.0); - segment = segment + 1; - circlePrevPoint.x = fVar10; - circlePrevPoint.y = fVar4; - } while (segment <= circleSegments << 2); - } - } - } - circleSegments = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))); - sampleIndex = sampleIndex + 1; - } while (sampleIndex < (circleSegments - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))) >> 3) - 1U - ); - return; - } - } - } - return; -} - -// 0097f820 -void Entity_Laser::spawn_impact_effect(int unused) -{ - int variant; - int *piVar2; - void **ppvVar3; - uint8_t *puVar4; - uint8_t bVar5; - uint32_t seed; - Entity *spawned; - uint8_t *curAnimName; - char *ptr; - uint8_t *wantedAnim; - uint32_t uVar6; - int *piVar7; - bool bVar8; - uint32_t uVar9; - TypeDescriptor *pTVar10; - TypeDescriptor *pTVar11; - uint32_t uVar12; - uint8_t *defaultAnim; - int *local_44; - int *impactEffect; - std_string anm2Path; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - int variant; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00af85cd; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - if (this->_exists == 0) { - return; - } - variant = this->_variant; - uVar6 = 0xffffffff; - if ((variant == 2) && (this->_subtype != 4)) { - uVar6 = -GHIDRA_UINT((this->_subtype != 0)) & 5; - } - else { - switch(variant) { - case 1: - case 3: - case 6: - case 9: - case 0xb: - case 0xc: - case 0xd: - case 0xe: - case 0xf: - if ((this->_spawnerType != 0x112) && (this->_subtype == 0)) { - uVar6 = 1; - if (variant == 3) { - uVar6 = 2; - } - else { - variant = this->_parent; - if ((variant == 0) || - (((*GHIDRA_CAST((variant + 0x28)) != 0x27 || (*GHIDRA_CAST((variant + 0x34)) != 0x109)) && - ((*GHIDRA_CAST((variant + 0x28)) != 0x44 || - ((*GHIDRA_CAST((variant + 0x2c)) != 1 || (*GHIDRA_CAST((variant + 0x30)) != 1)))))))) { - if ((variant == 0xb) || (((variant == 6 || (variant == 0xe)) || (variant == 0xf)))) { - uVar6 = 6; - } - else if (variant == 0xc) { - uVar6 = 7; - } - } - else { - uVar6 = 3; - } - } - } - } - } - piVar7 = GHIDRA_CAST(this->_child); - ppvVar3 = &local_1c; - puVar4 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - if (piVar7 != GHIDRA_CAST(0x0)) { - if (piVar7[0xc] == uVar6) { - return; - } - ExceptionList = &local_1c; - (**(code **)(*piVar7 + 0x28))(local_24); - ppvVar3 = ExceptionList; - puVar4 = puStack_20; - if (this->_child != 0) { - ExceptionList = local_1c; - return; - } - } - puStack_20 = puVar4; - ExceptionList = ppvVar3; - if (GHIDRA_INT(uVar6) < 0) { - ExceptionList = local_1c; - return; - } - seed = Random(); - uVar12 = 0; - pTVar11 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar10 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar9 = 0; - spawned = Game::Spawn(g_game,1000,0x32,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),uVar6,seed); - impactEffect = GHIDRA_CAST(__RTDynamicCast(spawned,uVar9,pTVar10,pTVar11,uVar12)); - if (this->_child != 0) { - local_44 = &this->_child; - msvc::multiset::erase(&local_44); - } - this->_child = impactEffect; - if (impactEffect != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&this->_child); - } - piVar7 = impactEffect + 0xef; - if (impactEffect[0xef] != 0) { - local_44 = piVar7; - msvc::multiset::erase(&local_44); - } - *piVar7 = GHIDRA_INT(this); - msvc::multiset::insert(piVar7); - piVar7 = impactEffect; - if (uVar6 == 1) { - if (this->_spawnerType == 0x3b6) { - local_44 = impactEffect + 0x12; - anm2Path._size = 0; - anm2Path._capacity = 0xf; - anm2Path._buf[0] = '\0'; - anm2Path._buf[1] = '\0'; - anm2Path._buf[2] = '\0'; - anm2Path._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x30); - anm2Path._size = 0x28; - anm2Path._capacity = 0x2f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))),"gfx/1000.050_brimstoneimpact_static.anm2",0x29); - local_14 = 0; - ANM2::Load(GHIDRA_CAST((piVar7 + 0x12)),&anm2Path,1); - local_14 = 0xffffffff; - if (0xf < anm2Path._capacity) { - uVar6 = anm2Path._capacity + 1; - ptr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))); - if (0xfff < uVar6) { - ptr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + -4)); - uVar6 = anm2Path._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,uVar6); - } - defaultAnim = GHIDRA_CAST((piVar7 + 0x18)); - anm2Path._size = 0; - anm2Path._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) & 0xffffff00; - if (0xf < GHIDRA_UINT(piVar7[0x1d])) { - defaultAnim = *GHIDRA_CAST(defaultAnim); - } - curAnimName = GHIDRA_CAST(local_44[0xd]); - if (curAnimName == GHIDRA_CAST(0x0)) { -LAB_0097fb40: - bVar5 = ANM2::SetAnimation(GHIDRA_CAST((piVar7 + 0x12)),defaultAnim,1); - piVar2 = local_44; - if (bVar5 != 0) { - AnimationState::Rewind(GHIDRA_CAST((local_44 + 0xc))); - *GHIDRA_CAST((piVar2 + 0x11)) = 1; - piVar7 = impactEffect; - } - } - else { - if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { - curAnimName = *GHIDRA_CAST(curAnimName); - } - wantedAnim = defaultAnim; - do { - bVar5 = *curAnimName; - bVar8 = bVar5 < *wantedAnim; - if (bVar5 != *wantedAnim) { -LAB_0097fb20: - uVar6 = -GHIDRA_UINT(bVar8) | 1; - goto LAB_0097fb25; - } - if (bVar5 == 0) break; - bVar5 = curAnimName[1]; - bVar8 = bVar5 < wantedAnim[1]; - if (bVar5 != wantedAnim[1]) goto LAB_0097fb20; - curAnimName = curAnimName + 2; - wantedAnim = wantedAnim + 2; - } while (bVar5 != 0); - uVar6 = 0; -LAB_0097fb25: - if ((uVar6 != 0) || - ((*GHIDRA_CAST((piVar7[0x1f] + 0x34)) != '\0' && ((char)piVar7[0x23] == '\0')))) - goto LAB_0097fb40; - } - piVar7[0x56] = piVar7[0x56] | 0x20; - } - } - else if ((uVar6 == 0) || (uVar6 == 5)) { - if (this->_subtype == 3) { - impactEffect[0xd6] = -0x3f600000; - } - goto LAB_0097fba2; - } - piVar7[0xd6] = GHIDRA_INT((this->_renderDepthOffset + 5.0)); -LAB_0097fba2: - (**(code **)(*piVar7 + 0x3c))(&(this->_sprite)._color,0xffffffff,0xff,0,1); - *GHIDRA_CAST((GHIDRA_CAST(piVar7) + 0x171)) = this->_visible; - (**(code **)(*piVar7 + 0xc))(); - ExceptionList = local_1c; - return; -} - -// 0097fc10 -void Entity_Laser::ResetSpriteScale() -{ - float fVar1; - code *pcVar2; - uint8_t bVar3; - uint32_t uVar4; - uint8_t *pbVar5; - uint8_t *pbVar6; - uint8_t *pbVar7; - uint32_t frame; - int sizeIndex; - bool isLess; - float fVar8; - uint8_t animName [16]; - uint32_t local_8; - void *animData; - - local_8 = __security_cookie ^ GHIDRA_UINT((animName + 0x14)); - if (this->_variant != 2) { - fVar1 = this->_scale; - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)); - (this->_sprite)._scale.x = fVar1; - (this->_sprite)._scale.y = fVar1; - this->_size = fVar1 * fVar8; - return; - } - sizeIndex = 0; - uVar4 = 0; - do { - if (this->_scale < *GHIDRA_CAST((GHIDRA_INT(&DAT_00b7cd30) + uVar4))) break; - uVar4 = uVar4 + 4; - sizeIndex = sizeIndex + 1; - } while (uVar4 < 0xc); - this->_size = this->_scale * *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)); - sprintf(animName,GHIDRA_CAST("Laser%d")); - fVar1 = *GHIDRA_CAST((&UNK_00b7cd20 + sizeIndex * 4)); - fVar8 = this->_scale * g_vectorOne.y; - (this->_sprite)._scale.x = (this->_scale * g_vectorOne.x) / fVar1; - (this->_sprite)._scale.y = fVar8 / fVar1; - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) { - if (animName[0] == 0) { - return; - } - pbVar5 = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar5); - } - pbVar6 = animName; - do { - bVar3 = *pbVar5; - isLess = bVar3 < *pbVar6; - if (bVar3 != *pbVar6) { -LAB_0097fd00: - uVar4 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0097fd05; - } - if (bVar3 == 0) break; - bVar3 = pbVar5[1]; - isLess = bVar3 < pbVar6[1]; - if (bVar3 != pbVar6[1]) goto LAB_0097fd00; - pbVar5 = pbVar5 + 2; - pbVar6 = pbVar6 + 2; - } while (bVar3 != 0); - uVar4 = 0; -LAB_0097fd05: - if (uVar4 == 0) { - return; - } - } - pbVar5 = (this->_sprite)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - pbVar6 = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar6 = *GHIDRA_CAST(pbVar5); - } - pbVar7 = animName; - do { - bVar3 = *pbVar6; - isLess = bVar3 < *pbVar7; - if (bVar3 != *pbVar7) { -LAB_0097fd41: - uVar4 = -GHIDRA_UINT(isLess) | 1; - goto LAB_0097fd46; - } - if (bVar3 == 0) break; - bVar3 = pbVar6[1]; - isLess = bVar3 < pbVar7[1]; - if (bVar3 != pbVar7[1]) goto LAB_0097fd41; - pbVar6 = pbVar6 + 2; - pbVar7 = pbVar7 + 2; - } while (bVar3 != 0); - uVar4 = 0; -LAB_0097fd46: - if ((uVar4 == 0) && ((pbVar5[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) - goto LAB_0097fd78; - } - bVar3 = ANM2::SetAnimation(&this->_sprite,animName,1); - if (bVar3 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } -LAB_0097fd78: - animData = (this->_sprite)._animState._animData; - uVar4 = this->_initSeed; - if (animData == (void *)0x0) { - frame = 0; - } - else { - frame = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x30)); - } - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> 4 ^ uVar4; - uVar4 = uVar4 ^ uVar4 << 3; - if (frame == 0) { - frame = 0; - } - else { - frame = (uVar4 >> 0x1b ^ uVar4) % frame; - } - if (animData == (void *)0x0) { - return; - } - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(frame)); - return; -} - -// 0097fe50 -void Entity_Laser::set_scale(float scale) -{ - this->_scale = scale; - ResetSpriteScale(this); - return; -} - -// 0097fe60 -void Entity_Laser::update_sample_points(char param_2) -{ - float *pfVar1; - void *pvVar2; - uint8_t isEffectVisible; - uint32_t sampleCount; - int iVar3; - float fVar4; - float sinAngle; - float fVar5; - Vector VStack_2c; - float fStack_24; - Entity_Laser *colorSource; - int *impactEffect; - int samplesBegin; - - impactEffect = GHIDRA_CAST(this->_child); - if (impactEffect == GHIDRA_CAST(0x0)) { - return; - } - if (impactEffect[10] != 1000) { - return; - } - if ((this->_visible == 0) || (param_2 != '\0')) { - isEffectVisible = 0; - } - else { - isEffectVisible = 1; - } - *GHIDRA_CAST((GHIDRA_CAST(impactEffect) + 0x171)) = isEffectVisible; - fStack_24 = 1.4013e-45; - VStack_2c.y = 0.0; - VStack_2c.x = 3.57331e-43; - colorSource = this->_bounceLaser; - if (this->_bounceLaser == GHIDRA_CAST(0x0)) { - colorSource = this; - } - (**(code **)(*impactEffect + 0x3c))(&(colorSource->_sprite)._color,0xffffffff); - if (impactEffect[0xc] == 0) { - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - sampleCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar3 >> 3; - if (sampleCount < 2) { - fStack_24 = this->_angleDegrees * 0.017453292; - fVar4 = cos(fStack_24); - VStack_2c.x = fVar4 * this->_laserLength + (this->_pos).x; - sinAngle = sin(fStack_24); - fVar4 = this->_laserLength; - fVar5 = (this->_pos).y; - impactEffect[0xcf] = GHIDRA_INT(VStack_2c.x); - impactEffect[0xd0] = GHIDRA_INT((sinAngle * fVar4 + fVar5)); - impactEffect[0xd3] = GHIDRA_INT((this->_posOffset).x); - impactEffect[0xd4] = GHIDRA_INT((this->_posOffset).y); - fVar4 = this->_angleDegrees - 90.0; - goto LAB_0098039e; - } - impactEffect[0xcf] = *GHIDRA_CAST((iVar3 + -8 + sampleCount * 8)); - impactEffect[0xd0] = *GHIDRA_CAST((iVar3 + -4 + sampleCount * 8)); - impactEffect[0xd3] = GHIDRA_INT((this->_posOffset).x); - impactEffect[0xd4] = GHIDRA_INT((this->_posOffset).y); - samplesBegin = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar3 >> 3; - VStack_2c.x = *GHIDRA_CAST((samplesBegin + -0x10 + iVar3 * 8)) - - *GHIDRA_CAST((samplesBegin + -8 + iVar3 * 8)); - fStack_24 = *GHIDRA_CAST((samplesBegin + -0xc + iVar3 * 8)) - - *GHIDRA_CAST((samplesBegin + -4 + iVar3 * 8)); - fVar4 = sqrtf(fStack_24 * fStack_24 + VStack_2c.x * VStack_2c.x); - if (fVar4 <= 0.0) { - fVar5 = fStack_24; - fVar4 = VStack_2c.x; - } - else { - fVar5 = fStack_24 * (1.0 / fVar4); - fVar4 = VStack_2c.x * (1.0 / fVar4); - } - fVar4 = atan2f(fVar5,fVar4); - fVar4 = fVar4 * 57.295776 + 90.0; - } - else { - fVar4 = (this->_sprite)._scale.x; - fVar5 = (this->_sprite)._scale.y; - if (fVar4 <= 0.04) { - *GHIDRA_CAST((GHIDRA_CAST(impactEffect) + 0x171)) = 0; - } - else { - fVar4 = fVar4 * 0.75 + 0.25; - if ((this->_variant == 6) || (this->_variant == 0xf)) { - if (impactEffect[0xc] == 4) { - fVar5 = fVar4; - } - else { - fVar4 = fVar4 * 1.5; - } - } - *GHIDRA_CAST((GHIDRA_CAST(impactEffect) + 0x171)) = this->_visible; - impactEffect[0x39] = GHIDRA_INT(fVar4); - impactEffect[0x3a] = GHIDRA_INT(fVar5); - } - pvVar2 = this->_bounceLaser; - if ((pvVar2 != (void *)0x0) && - (fVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x340)), pfVar1 = &(this->_pos).y, - *pfVar1 <= fVar4 && fVar4 != *pfVar1)) { - impactEffect[0xcf] = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x33c)); - impactEffect[0xd0] = GHIDRA_INT(fVar4); - impactEffect[0xd3] = GHIDRA_INT((this->_posOffset).x); - impactEffect[0xd4] = GHIDRA_INT((this->_posOffset).y); - iVar3 = __RTDynamicCast(this->_bounceLaser,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor,0); - impactEffect[0xd6] = GHIDRA_INT((*GHIDRA_CAST((iVar3 + 0x358)) + 5.0)); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - sampleCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar3 >> 3; - if (sampleCount < 2) { - impactEffect[0x3b] = GHIDRA_INT((this->_angleDegrees + 90.0)); - return; - } - fStack_24 = *GHIDRA_CAST((iVar3 + -0x10 + sampleCount * 8)) - - *GHIDRA_CAST((iVar3 + -8 + sampleCount * 8)); - (GHIDRA_CAST((GHIDRA_CAST(&fStack_24))))->Vector::Normalized(&VStack_2c); - fVar4 = atan2f(VStack_2c.y,VStack_2c.x); - fVar4 = normalize_angle_degrees(fVar4 * 57.295776 - 90.0); - impactEffect[0x3b] = GHIDRA_INT(fVar4); - return; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - sampleCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar3 >> 3; - if (sampleCount < 2) { - fStack_24 = this->_angleDegrees * 0.017453292; - fVar4 = cos(fStack_24); - VStack_2c.x = fVar4 * this->_laserLength + (this->_pos).x; - sinAngle = sin(fStack_24); - fVar4 = this->_laserLength; - fVar5 = (this->_pos).y; - impactEffect[0xcf] = GHIDRA_INT(VStack_2c.x); - impactEffect[0xd0] = GHIDRA_INT((sinAngle * fVar4 + fVar5)); - impactEffect[0xd3] = GHIDRA_INT((this->_posOffset).x); - impactEffect[0xd4] = GHIDRA_INT((this->_posOffset).y); - fVar4 = this->_angleDegrees + 90.0; - goto LAB_0098039e; - } - impactEffect[0xcf] = *GHIDRA_CAST((iVar3 + -8 + sampleCount * 8)); - impactEffect[0xd0] = *GHIDRA_CAST((iVar3 + -4 + sampleCount * 8)); - impactEffect[0xd3] = GHIDRA_INT((this->_posOffset).x); - impactEffect[0xd4] = GHIDRA_INT((this->_posOffset).y); - samplesBegin = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x1c)))); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_homingLaser))) + 0x20)))) - iVar3 >> 3; - fStack_24 = *GHIDRA_CAST((samplesBegin + -0x10 + iVar3 * 8)) - - *GHIDRA_CAST((samplesBegin + -8 + iVar3 * 8)); - VStack_2c.x = *GHIDRA_CAST((samplesBegin + -0xc + iVar3 * 8)) - - *GHIDRA_CAST((samplesBegin + -4 + iVar3 * 8)); - fVar4 = sqrtf(fStack_24 * fStack_24 + VStack_2c.x * VStack_2c.x); - if (fVar4 <= 0.0) { - fVar5 = VStack_2c.x; - fVar4 = fStack_24; - } - else { - fVar5 = VStack_2c.x * (1.0 / fVar4); - fVar4 = fStack_24 * (1.0 / fVar4); - } - fVar4 = atan2f(fVar5,fVar4); - fVar4 = fVar4 * 57.295776 - 90.0; - } - if (360.0 < ABS(fVar4)) { - fVar4 = fmodf(fVar4,360.0); - } - if (fVar4 <= 180.0) { - if (fVar4 < -180.0) { - fVar4 = fVar4 + 360.0; - } - } - else { - fVar4 = fVar4 - 360.0; - } -LAB_0098039e: - impactEffect[0x3b] = GHIDRA_INT(fVar4); - impactEffect[0xd6] = - GHIDRA_INT(((this->_renderDepthOffset + 5.0 + (this->_pos).y) - (float)impactEffect[0xd0])); - return; -} - -// 0099efc0 -void Entity_Laser::update_wiggle_path(void *samples, float amplitude, float phase) -{ - int iVar1; - float *pfVar2; - uint32_t sampleIdx; - int sampleCount; - float pathLength; - float sinQuarter; - float fVar3; - float fVar4; - double falloff; - float wiggleAmplitude; - float fVar5; - float dirX; - float dirY; - double countFixup; - int frameCount; - float sampleY; - - if (*GHIDRA_CAST((GHIDRA_CAST(samples) + 0x40)) != 1) { - pathLength = *GHIDRA_CAST((GHIDRA_CAST(samples) + 0x10)) - *GHIDRA_CAST((GHIDRA_CAST(samples) + 8)); - fVar5 = *GHIDRA_CAST((GHIDRA_CAST(samples) + 0xc)) - *GHIDRA_CAST((GHIDRA_CAST(samples) + 4)); - pathLength = sqrtf(pathLength * pathLength + fVar5 * fVar5); - sampleIdx = 0; - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(samples) + 0x1c)); - sampleCount = *GHIDRA_CAST((GHIDRA_CAST(samples) + 0x20)) - iVar1 >> 3; - frameCount = g_game->_frameCount; - if (sampleCount != 1) { - fVar5 = cos(1.5707964); - sinQuarter = sin(1.5707964); - pfVar2 = GHIDRA_CAST((iVar1 + 4)); - countFixup = __uint_to_double_fixup[-(sampleCount + -2 >> 0x1f)]; - do { - dirX = pfVar2[1] - pfVar2[-1]; - sampleY = *pfVar2; - dirY = pfVar2[2] - sampleY; - fVar3 = sqrtf(dirX * dirX + dirY * dirY); - if (0.0 < fVar3) { - dirY = (1.0 / fVar3) * dirY; - dirX = dirX * (1.0 / fVar3); - } - fVar3 = 1.0; - if (sampleIdx < 0x14) { - fVar4 = (float)((double)GHIDRA_INT(sampleIdx) + __uint_to_double_fixup[-(GHIDRA_INT(sampleIdx) >> 0x1f)] - ); - fVar3 = fVar4 / 20.0; - } - else { - if (sampleCount - 0x16U < sampleIdx) { - iVar1 = (sampleCount - sampleIdx) + 1; - fVar3 = (float)((double)iVar1 + __uint_to_double_fixup[-(iVar1 >> 0x1f)]) / 22.0; - } - fVar4 = (float)((double)GHIDRA_INT(sampleIdx) + __uint_to_double_fixup[-(GHIDRA_INT(sampleIdx) >> 0x1f)] - ); - } - falloff = (double)(1.0 - fVar3); - libm_sse2_pow_precise(); - wiggleAmplitude = (1.0 - (float)falloff) * 30.0 * amplitude; - fVar3 = ((fVar4 / (float)((double)(sampleCount + -2) + countFixup)) * (pathLength / 200.0) * - 15.0) / amplitude - ((float)frameCount * 0.1 - phase); - fVar4 = sin(fVar3); - fVar3 = cos(fVar3); - sampleIdx = sampleIdx + 1; - pfVar2[-1] = fVar3 * (dirX * fVar5 - sinQuarter * dirY) * wiggleAmplitude + - fVar4 * dirX * wiggleAmplitude + pfVar2[-1]; - *pfVar2 = fVar3 * (dirX * sinQuarter + fVar5 * dirY) * wiggleAmplitude + - fVar4 * dirY * wiggleAmplitude + sampleY; - pfVar2 = pfVar2 + 2; - } while (sampleIdx < sampleCount - 1U); - } - } - return; -} diff --git a/generated-src/entity_list.cpp b/generated-src/entity_list.cpp deleted file mode 100644 index 7e95970..0000000 --- a/generated-src/entity_list.cpp +++ /dev/null @@ -1,1874 +0,0 @@ -#include "classes.h" - -// 00417540 -void EntityList::sublist_init(EntityList_EL *parent, int capacity) -{ - int startIdx; - uint32_t parentCapacity; - int parentData; - - *GHIDRA_CAST(this) = 1; - startIdx = parent->_size; - parentData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((parent)) + 0x4)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) = capacity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = parentData + startIdx * 4; - startIdx = parent->_size; - parentCapacity = parent->_capacity; - if (parentCapacity < GHIDRA_UINT((startIdx + capacity))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid sublist\n")); - startIdx = parent->_size; - parentCapacity = parent->_capacity; - } - if (parentCapacity < GHIDRA_UINT((startIdx + capacity))) { - startIdx = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((parent)) + 0x4)))); - } - parent->_size = startIdx + capacity; - return; -} - -// 004176f0 -int EntityList::Size() -{ - return *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); -} - -// 00418230 -void EntityList::Reset() -{ - int *piVar1; - int iVar2; - int wispIndex; - uint32_t i; - Manager *manager; - uint32_t movedEntity; - - iVar2 = 0; - i = 0; - (this->_updateEL)._size = 0; - (this->_renderEL)._size = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6c)))) = 0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) != 0) { - do { - piVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x24)))) + i * 4)); - if ((piVar1[0x5b] & 0x20U) == 0) { - (**(code **)(*piVar1 + 0x44))(); - *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x24)))) + i * 4)) + 0x170)) = 0; - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x24)))) + i * 4)) + 0x28))(); - } - else { - iVar2 = (this->_updateEL)._size; - if (GHIDRA_UINT((this->_updateEL)._capacity) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = (this->_updateEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + iVar2 * 4)) = piVar1; - piVar1 = &(this->_updateEL)._size; - *piVar1 = *piVar1 + 1; - iVar2 = (this->_renderEL)._size; - movedEntity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x24)))) + i * 4)); - if (GHIDRA_UINT((this->_renderEL)._capacity) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = (this->_renderEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + iVar2 * 4)) = movedEntity; - piVar1 = &(this->_renderEL)._size; - *piVar1 = *piVar1 + 1; - } - i = i + 1; - } while (i < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c))))); - iVar2 = (this->_updateEL)._size; - } - i = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) = 0; - (this->_wispEL)._size = 0; - if (iVar2 != 0) { - iVar2 = 0; - do { - movedEntity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x28)))) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))); - } - i = i + 1; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x24)))) + iVar2 * 4)) = movedEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) + 1; - iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))); - } while (i < GHIDRA_UINT((this->_updateEL)._size)); - } - i = 0; - if ((this->_persistentEL)._size != 0) { - do { - iVar2 = (this->_updateEL)._size; - movedEntity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_persistentEL))) + 0x4)))) + i * 4)); - if (GHIDRA_UINT((this->_updateEL)._capacity) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = (this->_updateEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + iVar2 * 4)) = movedEntity; - piVar1 = &(this->_updateEL)._size; - *piVar1 = *piVar1 + 1; - iVar2 = (this->_renderEL)._size; - movedEntity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_persistentEL))) + 0x4)))) + i * 4)); - if (GHIDRA_UINT((this->_renderEL)._capacity) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = (this->_renderEL)._size; - } - i = i + 1; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + iVar2 * 4)) = movedEntity; - piVar1 = &(this->_renderEL)._size; - *piVar1 = *piVar1 + 1; - } while (i < GHIDRA_UINT((this->_persistentEL)._size)); - } - i = 0; - if ((this->_updateEL)._size != 0) { - do { - iVar2 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if ((*GHIDRA_CAST((iVar2 + 0x28)) == 3) && (*GHIDRA_CAST((iVar2 + 0x2c)) == 0xce)) { - wispIndex = (this->_wispEL)._size; - if (GHIDRA_UINT((this->_wispEL)._capacity) < wispIndex + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - wispIndex = (this->_wispEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_wispEL))) + 0x4)))) + wispIndex * 4)) = iVar2; - piVar1 = &(this->_wispEL)._size; - *piVar1 = *piVar1 + 1; - } - i = i + 1; - } while (i < GHIDRA_UINT((this->_updateEL)._size)); - } - iVar2 = this[1]._persistentEL._capacity; - piVar1 = &this[1]._persistentEL._capacity; - this->_renderCursor = 0; - this->_renderMode = 0; - *GHIDRA_CAST((this + 1)) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0xc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x10)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x14)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x18)))) = 0; - (GHIDRA_CAST((piVar1)))->msvc::map::destroy_subtree(piVar1,*(void **)(iVar2 + 4)); - manager = g_manager; - *GHIDRA_CAST((iVar2 + 4)) = iVar2; - *GHIDRA_CAST(iVar2) = iVar2; - *GHIDRA_CAST((iVar2 + 8)) = iVar2; - this[1]._persistentEL._size = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8c)))) = 0; - *GHIDRA_CAST(&this[1]._updateEL) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(this[1]._updateEL)) + 0x4))) = 0; - this[1]._updateEL._capacity = -0x123458a; - if (((manager->_netplayManager != *GHIDRA_CAST((manager + 1))) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0xc)))) != 0)) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(manager[1])) + 0x8)))) < - *GHIDRA_CAST((GHIDRA_INT(&this[1]._renderEL) + (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0x8)))) & 0x1f) * 0x18)))) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0xc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0x8)))) = 0; - } - return; -} - -// 00418500 -void EntityList::AddEntity(Entity *entity) -{ - char cVar1; - uint32_t otherRenderDepth; - uint32_t newRenderDepth; - int iVar2; - Entity *shiftIndex; - Entity *insertIndex; - bool isIndexInvalid; - Entity *newEntity; - int *sizePtr; - uint32_t *slot; - - newEntity = entity; - if (entity->_valid == 0) { - iVar2 = entity->_type; - if (((iVar2 == 1) || (iVar2 == 3)) || ((iVar2 == 8 && (entity->_subtype == 0)))) { - iVar2 = (this->_persistentEL)._size; - if (GHIDRA_UINT((this->_persistentEL)._capacity) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = (this->_persistentEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_persistentEL))) + 0x4)))) + iVar2 * 4)) = entity; - sizePtr = &(this->_persistentEL)._size; - *sizePtr = *sizePtr + 1; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20)))))))->EntityList_EL::push_back(entity); - } - cVar1 = entity->CanShutDoors(); - if ((cVar1 != '\0') && (entity->_type != 0x362)) { - *GHIDRA_CAST((this + 1)) = *GHIDRA_CAST((this + 1)) + 1; - cVar1 = entity->IsBoss(); - if (cVar1 != '\0') { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x8)))) + 1; - } - } - entity->_valid = 1; - entity = GHIDRA_CAST(0x0); - insertIndex = GHIDRA_CAST(0x0); - if ((this->_renderEL)._size != 0) { - do { - otherRenderDepth = - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + GHIDRA_INT(entity) * 4)) + 0x34) - )(); - newRenderDepth = newEntity->GetRenderZ(); - insertIndex = entity; - if (newRenderDepth <= otherRenderDepth) break; - insertIndex = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((entity)) + 0x1)))); - entity = insertIndex; - } while (insertIndex < GHIDRA_CAST((this->_renderEL)._size)); - } - shiftIndex = GHIDRA_CAST((this->_renderEL)._size); - if (GHIDRA_CAST((this->_renderEL)._capacity) < &(*GHIDRA_CAST((GHIDRA_CAST((shiftIndex)) + 0x1)))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for insert\n")); - shiftIndex = GHIDRA_CAST((this->_renderEL)._size); - } - isIndexInvalid = false; - if (shiftIndex < insertIndex) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid index for insert\n")); - shiftIndex = GHIDRA_CAST((this->_renderEL)._size); - isIndexInvalid = shiftIndex < insertIndex; - } - if (!isIndexInvalid && shiftIndex != insertIndex) { - do { - slot = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + GHIDRA_INT(shiftIndex) * 4)); - shiftIndex = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(shiftIndex[-1])) + 0x40f)))); - *slot = slot[-1]; - } while (insertIndex < shiftIndex); - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + GHIDRA_INT(insertIndex) * 4)) = newEntity; - sizePtr = &(this->_renderEL)._size; - *sizePtr = *sizePtr + 1; - if ((newEntity->_type == 3) && (newEntity->_variant == 0xce)) { - iVar2 = (this->_wispEL)._size; - if (GHIDRA_UINT((this->_wispEL)._capacity) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = (this->_wispEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_wispEL))) + 0x4)))) + iVar2 * 4)) = newEntity; - sizePtr = &(this->_wispEL)._size; - *sizePtr = *sizePtr + 1; - } - } - else { - (GHIDRA_CAST((&this->_updateEL)))->EntityList_EL::remove(entity); - } - if ((newEntity->_flags & 8) == 0) { - iVar2 = (this->_updateEL)._size; - if (GHIDRA_UINT((this->_updateEL)._capacity) < iVar2 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar2 = (this->_updateEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + iVar2 * 4)) = newEntity; - sizePtr = &(this->_updateEL)._size; - *sizePtr = *sizePtr + 1; - } - invalidate_type_cache(this,newEntity->_type,newEntity->_variant,newEntity->_subtype); - return; -} - -// 004186c0 -void EntityList::Update(uint8_t isTransition) -{ - EntityList *pEVar1; - char cVar2; - uint8_t bVar3; - uint32_t uVar4; - uint32_t extraout_EAX; - EntityConfig_Entity *configEntry; - Entity *pEVar5; - Entity **ppEVar6; - float *bossMaxHpPtr; - uint32_t *puVar7; - Entity *pEVar8; - void *checksum; - void *player; - void *this_02; - void *this_03; - void *this_04; - void *this_05; - void *pvVar9; - Game *game; - int extraout_EDX; - int iVar10; - uint32_t uVar11; - PlayerManager *playerManager; - int *piVar12; - uint32_t uVar13; - EntityList *curList; - float prevPosX; - float prevPosY; - float prevVelocityX; - float prevVelocityY; - float bossHpFill; - float fVar14; - float posY; - float fVar15; - double dVar16; - Entity *recordIndex; - int recordType; - int recordVariant; - int recordSubType; - int recordDropSeed; - Entity *recordMtChecksum; - float recordPrevPosX; - float recordPrevPosY; - float recordPrevVelocityX; - float recordPrevVelocityY; - float recordPosX; - float recordPosY; - float recordVelocityX; - float recordVelocityY; - float checksumPosX; - float local_84; - uint32_t netplayEnd; - uint32_t *checksumRecord; - int activeEnemyCount; - float bossMaxHealth; - Vector local_70; - uint32_t local_64; - Entity *prevHealth; - Entity *local_5c; - uint32_t isListDirty; - int bossCount; - EntityList *entityList; - float local_4c; - Entity *local_48; - Entity *curEntity; - float local_40; - Entity *local_3c; - int *local_38; - float local_34; - void *renderTarget; - Entity *local_2c [2]; - bool isWallPass; - bool local_21; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - Entity *local_14; - EntityList_EL *checksum; - uint32_t flagsHigh; - bool isAnyFloorEntity; - bool isAnyWallEntity; - Manager *manager; - Entity *player; - uint8_t *storedBossMaxHp; - - manager = g_manager; - puStack_20 = GHIDRA_CAST((local_2c + 10)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00af1575; - local_1c = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((local_2c + 7)); - ExceptionList = &local_1c; - checksumRecord = GHIDRA_CAST(0x0); - local_64 = g_manager->_netplayManager; - netplayEnd = *GHIDRA_CAST((g_manager + 1)); - if (local_64 != netplayEnd) { - *GHIDRA_CAST(&this[1]._updateEL) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(this[1]._updateEL)) + 0x4))) = 0; - this[1]._updateEL._capacity = -0x123458a; - uVar13 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0xc)))); - uVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0x8)))); - if (uVar13 < 0x20) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0xc)))) = uVar13 + 1; - uVar11 = uVar11 + uVar13 & 0x1f; - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[6])) + 0x8)))) = uVar11 + 1 & 0x1f; - } - checksumRecord = GHIDRA_CAST((GHIDRA_INT(&this[1]._renderEL) + uVar11 * 0x18)); - checksumRecord[2] = checksumRecord[1]; - *checksumRecord = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(manager[1])) + 0x8)))); - } - iVar10 = this[1]._persistentEL._capacity; - piVar12 = &this[1]._persistentEL._capacity; - entityList = this; - (GHIDRA_CAST((piVar12)))->msvc::map::destroy_subtree(piVar12,*(void **)(iVar10 + 4)); - *GHIDRA_CAST((iVar10 + 4)) = iVar10; - isListDirty = extraout_EAX & 0xffffff00; - *GHIDRA_CAST(iVar10) = iVar10; - *GHIDRA_CAST((iVar10 + 8)) = iVar10; - this[1]._persistentEL._size = 0; - local_40 = 0.0; - activeEnemyCount = 0; - player = GHIDRA_CAST((entityList->_updateEL)._size); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((entityList)) + 0x8c)))) = 0; - bossCount = 0; - local_4c = 0.0; - bossMaxHealth = 0.0; - local_34 = 0.0; - local_38 = GHIDRA_CAST(0x0); - local_48 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((entityList->_updateEL))) + 0x4)))) + -4 + GHIDRA_INT(player) * 4)); - curList = entityList; - do { - piVar12 = local_38; - if (player == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EntityList: e_update is empty!\n")); - player = GHIDRA_CAST((curList->_updateEL)._size); - } - pEVar1 = entityList; - pEVar8 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_updateEL))) + 0x4)))) + GHIDRA_INT(piVar12) * 4)); - if (pEVar8->_exists != 0) { - local_3c = *GHIDRA_CAST((GHIDRA_INT(&pEVar8->_flags) + 4)); - curList = pEVar1; - if ((((pEVar8->_flags & 8) == 0) || ((pEVar8->_flags & 0x20000) != 0)) && - ((isTransition == 0 || - (local_3c = GHIDRA_CAST((GHIDRA_UINT(local_3c) & 0x1000)), local_3c != GHIDRA_CAST(0x0))))) { - pEVar8->PreUpdate(uVar4); - player = GHIDRA_CAST((pEVar1->_updateEL)._size); - } - } - local_38 = GHIDRA_CAST((GHIDRA_INT(local_38) + 1)); - curEntity = player; - } while ((pEVar8 != local_48) && (local_38 < player)); - local_3c = GHIDRA_CAST(0x0); - if (pEVar8 == local_48) { - } - do { - if (player == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EntityList: e_update is empty!\n")); - } - prevHealth = GHIDRA_CAST(0x0); - player = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_updateEL))) + 0x4)))) + GHIDRA_INT(local_3c) * 4)); - curEntity = player; - local_38 = &player->_type; - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*local_38 != 1)) { - if (*local_38 - 10U < 0x3de) { - if (*local_38 == 1) goto LAB_004188e4; - prevHealth = GHIDRA_CAST(player[3]._variant); - goto LAB_0041890f; - } - } - else { -LAB_004188e4: - iVar10 = player[5]._charmSource._flags; - prevHealth = GHIDRA_CAST((float)((double)iVar10 + __uint_to_double_fixup[-(iVar10 >> 0x1f)])); -LAB_0041890f: - } - if (player->_exists != 0) { - if ((((((player->_flags & 8) != 0) && ((player->_flags & 0x20000) == 0)) || - ((isTransition != 0 && ((player->_flags & 0x100000000000) == 0)))) || - (player->Update(), player->_exists != 0)) && (*local_38 != 0x362)) { - cVar2 = player->CanShutDoors(); - if (cVar2 != '\0') { - activeEnemyCount = activeEnemyCount + 1; - cVar2 = player->IsBoss(); - if (cVar2 != '\0') { - local_2c[0] = *GHIDRA_CAST((GHIDRA_INT(&player->_flags) + 4)); - uVar4 = GHIDRA_UINT(player->_flags); - if ((uVar4 & 0x100000) == 0) { - pEVar8 = GHIDRA_CAST((uVar4 & 0x80000000)); - if (pEVar8 == GHIDRA_CAST(0x0)) { - bossCount = bossCount + 1; - } - if ((0 < g_game->_frameCount - player->_spawnFrame) && (pEVar8 == GHIDRA_CAST(0x0))) { - local_5c = pEVar8; - local_2c[0] = GHIDRA_CAST(player->_health); - ppEVar6 = &local_5c; - if (0.0 <= player->_health) { - ppEVar6 = local_2c; - } - local_4c = local_4c + (float)*ppEVar6; - bossMaxHealth = player->_maxHitPoints + bossMaxHealth; - } - } - } - if ((((*local_38 == 1000) && (player->_variant == 0xcb)) && - (configEntry = EntityConfig::GetEntity - (&g_manager->_entityConfig, - *GHIDRA_CAST((player[1]._sprite._animDefaultName._buf + 0xc)), - player[1]._sprite._animDefaultName._size, - GHIDRA_INT(player[1]._sprite._animState._animFrame)), - configEntry != GHIDRA_CAST(0x0))) && (configEntry->isBoss != 0)) { - bossCount = bossCount + 1; - } - } - cVar2 = player->CanShutDoors(); - if ((cVar2 != '\0') || (*local_38 == 0x3c3)) { - local_2c[0] = *GHIDRA_CAST(&g_game->_deathmatchManager); - if ((GHIDRA_INT(*(Entity **))&g_game->_deathmatchManager < 2) || (*local_38 != 1)) { - iVar10 = *local_38; - if ((0x3dd < iVar10 - 10U) && (iVar10 != 0x3c3)) goto LAB_00418ba8; - } - else { - iVar10 = 1; - } - if ((player->_flags & 0x20000000) == 0) { - if (iVar10 == 0x3e) { - bVar3 = (GHIDRA_CAST((player)))->Entity::DoesEntityShareStatus(); - iVar10 = extraout_EDX; - if ((bVar3 != 0) && - (pEVar8 = GHIDRA_CAST(player->_parent), GHIDRA_CAST(player->_parent) != GHIDRA_CAST(0x0))) { - do { - pEVar5 = pEVar8; - pEVar8 = GHIDRA_CAST(pEVar5->_parent); - } while (pEVar8 != GHIDRA_CAST(0x0)); - if (pEVar5 != player) goto LAB_00418ba8; - } - } - local_5c = GHIDRA_CAST(0x0); - if ((GHIDRA_INT(local_2c[0]) < 2) || (iVar10 != 1)) { - if (iVar10 - 10U < 0x3de) { - if (iVar10 == 1) goto LAB_00418b25; - local_5c = GHIDRA_CAST(player[3]._variant); - } - } - else { -LAB_00418b25: - iVar10 = player[5]._charmSource._flags; - local_5c = (Entity *) - (float)((double)iVar10 + __uint_to_double_fixup[-(iVar10 >> 0x1f)]); - } - local_2c[0] = GHIDRA_CAST(player->_maxHitPoints); - ppEVar6 = &local_5c; - if (player->_maxHitPoints <= (float)local_5c) { - ppEVar6 = local_2c; - } - local_2c[0] = GHIDRA_CAST(((float)*ppEVar6 - (float)prevHealth)); - prevHealth = GHIDRA_CAST(0x0); - ppEVar6 = local_2c; - if ((float)local_2c[0] <= 0.0) { - ppEVar6 = &prevHealth; - } - local_34 = (float)*ppEVar6 + local_34; - } - } - } - } -LAB_00418ba8: - isListDirty = isListDirty & 0xff; - if (player->_exists == 0) { - isListDirty = 1; - } - if ((player->_flags & 0x10000000000000) != 0) { - local_40 = (float)(GHIDRA_UINT(local_40) | 1); - } - if (local_64 != netplayEnd) { - checksumPosX = (player->_pos).x; - local_84 = (player->_pos).y; - local_70 = player->_velocity; - local_2c[0] = local_3c; - Checksum::Update(&curList[1]._updateEL,GHIDRA_CAST(local_2c),4); - local_2c[0] = GHIDRA_CAST(*local_38); - Checksum::Update(checksum,GHIDRA_CAST(local_2c),4); - local_2c[0] = GHIDRA_CAST(player->_variant); - Checksum::Update(player,GHIDRA_CAST(local_2c),4); - local_2c[0] = GHIDRA_CAST(player->_subtype); - Checksum::Update(this_02,GHIDRA_CAST(local_2c),4); - local_2c[0] = GHIDRA_CAST((player->_dropRNG)._seed); - Checksum::Update(this_03,GHIDRA_CAST(local_2c),4); - Checksum::Update(this_04,GHIDRA_CAST(&checksumPosX),8); - Checksum::Update(this_05,GHIDRA_CAST(&local_70),8); - fVar15 = (player->_velocity).x; - bossHpFill = (player->_velocity).y; - fVar14 = (player->_pos).x; - posY = (player->_pos).y; - prevPosX = (player->_prevPosition).x; - prevPosY = (player->_prevPosition).y; - prevVelocityX = (player->_prevVelocity).x; - prevVelocityY = (player->_prevVelocity).y; - recordMtChecksum = GHIDRA_CAST(get_mt_state_checksum()); - recordDropSeed = (player->_dropRNG)._seed; - recordSubType = player->_subtype; - recordVariant = curEntity->_variant; - recordType = *local_38; - local_2c[0] = recordMtChecksum; - recordIndex = local_3c; - piVar12 = GHIDRA_CAST(checksumRecord[2]); - recordPrevPosX = prevPosX; - recordPrevPosY = prevPosY; - recordPrevVelocityX = prevVelocityX; - recordPrevVelocityY = prevVelocityY; - recordPosX = fVar14; - recordPosY = posY; - recordVelocityX = fVar15; - recordVelocityY = bossHpFill; - if (piVar12 == GHIDRA_CAST(checksumRecord[3])) { - FUN_0041ccf0(piVar12,&recordIndex); - } - else { - *piVar12 = GHIDRA_INT(local_3c); - piVar12[1] = recordType; - piVar12[2] = recordVariant; - piVar12[3] = recordSubType; - piVar12[4] = recordDropSeed; - piVar12[5] = GHIDRA_INT(recordMtChecksum); - piVar12[6] = GHIDRA_INT(prevPosX); - piVar12[7] = GHIDRA_INT(prevPosY); - piVar12[8] = GHIDRA_INT(prevVelocityX); - piVar12[9] = GHIDRA_INT(prevVelocityY); - piVar12[10] = GHIDRA_INT(fVar14); - piVar12[0xb] = GHIDRA_INT(posY); - piVar12[0xc] = GHIDRA_INT(fVar15); - piVar12[0xd] = GHIDRA_INT(bossHpFill); - checksumRecord[2] = checksumRecord[2] + 0x38; - } - player = curEntity; - curList = entityList; - } - local_3c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_3c)) + 0x1)))); - } while ((player != local_48) && - (player = GHIDRA_CAST((curList->_updateEL)._size), local_3c < player)); - uVar4 = 0; - if (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - - GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) >> 2 != 0) { - do { - (**(code **)(**GHIDRA_CAST((GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) + uVar4 * 4)) + 0xc) - )(); - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - - GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) >> 2))); - } - game = g_game; - if ((g_manager->_optionsConfig)._enableInterpolation == 0) { - playerManager = &g_game->_playerManager; - local_48 = GHIDRA_CAST(0x0); - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - pvVar9 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar9) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar9 = (playerManager->_playerList)._end; - } - puVar7 = (playerManager->_playerList)._begin; - if (local_48 < GHIDRA_CAST((GHIDRA_INT(pvVar9) - GHIDRA_INT(puVar7) >> 2))) { - puVar7 = puVar7 + GHIDRA_INT(local_48); - } - player = GHIDRA_CAST(*puVar7); - if ((isTransition == 0) || ((player->_flags & 0x100000000000) != 0)) { - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&player->_flags) + 4)); - *GHIDRA_CAST(&player->_flags) = GHIDRA_UINT(player->_flags) | 0x4000; - *GHIDRA_CAST((GHIDRA_INT(&player->_flags) + 4)) = flagsHigh; - player->Update(); - (GHIDRA_CAST((player)))->Entity::PlayerCollideWithGrid(0); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&player->_flags) + 4)); - *GHIDRA_CAST(&player->_flags) = GHIDRA_UINT(player->_flags) & 0xffffbfff; - *GHIDRA_CAST((GHIDRA_INT(&player->_flags) + 4)) = flagsHigh; - } - local_48 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_48)) + 0x1)))); - playerManager = &g_game->_playerManager; - } while (local_48 < - (uint8_t *) - (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2)); - } - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - - GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) >> 2 != 0) { - uVar4 = 0; - do { - piVar12 = *GHIDRA_CAST((GHIDRA_INT((game->_playerManager)._extraPlayers._begin) + uVar4 * 4)); - piVar12[0x5a] = piVar12[0x5a] | 0x4000; - piVar12[0x5b] = piVar12[0x5b]; - (**(code **)(*piVar12 + 0xc))(); - game = g_game; - uVar4 = uVar4 + 1; - piVar12[0x5a] = piVar12[0x5a] & 0xffffbfff; - piVar12[0x5b] = piVar12[0x5b]; - } while (uVar4 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._extraPlayers._end) - - GHIDRA_INT((game->_playerManager)._extraPlayers._begin) >> 2))); - curList = entityList; - } - } - storedBossMaxHp = &(*GHIDRA_CAST((GHIDRA_CAST(&(curList[1])) + 0x10))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(curList[1])) + 0x4)))) = *GHIDRA_CAST((curList + 1)) + activeEnemyCount; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(curList[1])) + 0x8)))); - *GHIDRA_CAST((curList + 1)) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(curList[1])) + 0xc)))) = iVar10 + bossCount; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(curList[1])) + 0x8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(curList[1])) + 0x18)))) = local_40; - if (bossCount < 1) { - *GHIDRA_CAST(storedBossMaxHp) = 0; - fVar15 = (game->_hud)._bossHPBarFill; - if (-1.0 < fVar15) { - (game->_hud)._bossHPBarDamageFlash = 8; - } - if ((fVar15 < -1.0) && (fVar15 != -1.0)) { - (game->_hud)._bossHPBarDamageFlash = -1; - (game->_hud)._bossHPBarHealFlash = 8; - } - (game->_hud)._bossHPBarFill = (float)&DAT_bf800000; - } - else { - bossMaxHpPtr = &bossMaxHealth; - if (bossMaxHealth < *GHIDRA_CAST(storedBossMaxHp) || bossMaxHealth == *GHIDRA_CAST(storedBossMaxHp)) { - bossMaxHpPtr = GHIDRA_CAST(storedBossMaxHp); - } - bossHpFill = local_4c / *bossMaxHpPtr; - *GHIDRA_CAST(storedBossMaxHp) = *bossMaxHpPtr; - fVar15 = (game->_hud)._bossHPBarFill; - if (bossHpFill < fVar15) { - (game->_hud)._bossHPBarDamageFlash = 8; - } - if ((fVar15 < bossHpFill) && (fVar15 != -1.0)) { - (game->_hud)._bossHPBarDamageFlash = -1; - (game->_hud)._bossHPBarHealFlash = 8; - } - (game->_hud)._bossHPBarFill = bossHpFill; - } - fVar15 = g_displayPixelRatio; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(curList[1])) + 0x14)))) = local_34; - local_34 = fVar15 * g_screenPointScale; - local_40 = (g_screenHeight - 182.0) * 0.5 - 52.0; - local_2c[0] = GHIDRA_CAST((local_34 * ((g_screenWidth - 338.0) * 0.5 - 52.0) + 0.5)); - dVar16 = floor((double)(float)local_2c[0]); - local_4c = (float)dVar16 / local_34; - local_2c[0] = GHIDRA_CAST((local_34 * local_40 + 0.5)); - dVar16 = floor((double)(float)local_2c[0]); - local_2c[0] = GHIDRA_CAST((float)dVar16); - local_40 = (float)local_2c[0] / local_34; - isAnyWallEntity = false; - isAnyFloorEntity = false; - local_21 = false; - isWallPass = false; - local_34 = 0.0; - if ((curList->_renderEL)._size != 0) { - piVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_renderEL))) + 0x4)))); - do { - iVar10 = *piVar12; - if (*GHIDRA_CAST((iVar10 + 0x172)) != '\0') { - local_70.y = *GHIDRA_CAST((iVar10 + 0x16c)); - if ((*GHIDRA_CAST((iVar10 + 0x168)) & 8) != 0) { - isAnyFloorEntity = true; - local_21 = true; - } - if ((*GHIDRA_CAST((iVar10 + 0x168)) & 0x2000) != 0) { - isAnyWallEntity = true; - isWallPass = true; - } - if (isAnyFloorEntity) { - if (isAnyWallEntity) goto LAB_0041915c; - } - } - piVar12 = piVar12 + 1; - local_34 = (float)(GHIDRA_INT(local_34) + 1); - } while (GHIDRA_UINT(local_34) < GHIDRA_UINT((curList->_renderEL)._size)); - isWallPass = isAnyWallEntity; - local_21 = isAnyFloorEntity; - if ((isAnyFloorEntity != false) || (isAnyWallEntity != false)) { -LAB_0041915c: - local_70.x = 0.0; - local_70.y = 0.0; - msvc::vector::resize(&local_70); - puVar7 = msvc::deque::back(); - if (GHIDRA_CAST((puVar7 + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((puVar7 + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *puVar7 = g_graphicsManager_renderTarget; - uVar4 = g_graphicsManager_flags & 0xfffffffd; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[2] = 7; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - g_graphicsManager_flags = uVar4; - if (local_21 != false) { - (GHIDRA_CAST((&renderTarget)))->shared_ptr::assign((void *)(GHIDRA_INT(g_game->_room) + 0x1bc8)); - local_14 = GHIDRA_CAST(0x0); - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(renderTarget,0); - local_14 = GHIDRA_CAST(0x1); - if (((local_2c[0] != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(*GHIDRA_CAST(local_2c[0]) + 0xc))(), cVar2 != '\0')) && - (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(); - } - local_14 = GHIDRA_CAST(0xffffffff); - local_34 = 0.0; - if ((curList->_renderEL)._size != 0) { - do { - piVar12 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_renderEL))) + 0x4)))) + GHIDRA_INT(local_34) * 4)); - if ((*GHIDRA_CAST((GHIDRA_CAST(piVar12) + 0x172)) != '\0') && ((piVar12[0x5a] & 8U) != 0)) { - local_70 = (Vector)(CONCAT44(local_40,local_4c) ^ 0x8000000080000000); - (**(code **)(*piVar12 + 0x14))(); - local_84 = (float)piVar12[0x5b]; - if (((piVar12[0x5a] & 0x2000U) == 0) && ((piVar12[0x5a] & 0x22000U) == 0)) { - (**(code **)(*piVar12 + 0x28))(); - isListDirty = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(isListDirty)) + 0x1))),1); - } - } - local_34 = (float)(GHIDRA_INT(local_34) + 1); - } while (GHIDRA_UINT(local_34) < GHIDRA_UINT((curList->_renderEL)._size)); - } - _glfw_context_reset(); - } - if (isWallPass != false) { - (GHIDRA_CAST((&renderTarget)))->shared_ptr::assign((void *)(GHIDRA_INT(g_game->_room) + 0x1bd0)); - local_14 = GHIDRA_CAST(0x2); - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(renderTarget,0); - local_14 = GHIDRA_CAST(0x3); - if (((local_2c[0] != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(*GHIDRA_CAST(local_2c[0]) + 0xc))(), cVar2 != '\0')) && - (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(); - } - local_14 = GHIDRA_CAST(0xffffffff); - local_34 = 0.0; - if ((curList->_renderEL)._size != 0) { - do { - piVar12 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_renderEL))) + 0x4)))) + GHIDRA_INT(local_34) * 4)); - if ((*GHIDRA_CAST((GHIDRA_CAST(piVar12) + 0x172)) != '\0') && ((piVar12[0x5a] & 0x2000U) != 0)) { - local_70 = (Vector)(CONCAT44(local_40,local_4c) ^ 0x8000000080000000); - (**(code **)(*piVar12 + 0x14))(); - if ((piVar12[0x5a] & 0x20000U) == 0) { - (**(code **)(*piVar12 + 0x28))(); - isListDirty = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(isListDirty)) + 0x1))),1); - } - } - local_34 = (float)(GHIDRA_INT(local_34) + 1); - } while (GHIDRA_UINT(local_34) < GHIDRA_UINT((curList->_renderEL)._size)); - } - _glfw_context_reset(); - } - if ((local_21 != false) || (isWallPass != false)) { - g_graphicsManager_flags = g_graphicsManager_flags | 2; - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - puVar7 = msvc::deque::back(); - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget((void *)*puVar7,*GHIDRA_CAST((puVar7 + 1))); - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } - } - } - } - if ((char)isListDirty != '\0') { - uVar4 = (curList->_updateEL)._size; - uVar13 = 0; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_updateEL))) + 0x4)))) + uVar13 * 4)) + 0x172)) == - '\0') { - if (uVar4 <= uVar13) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid index for remove\n")); - uVar4 = (curList->_updateEL)._size; - } - uVar11 = uVar13; - if (uVar13 < uVar4 - 1) { - do { - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_updateEL))) + 0x4)))); - *GHIDRA_CAST((iVar10 + uVar11 * 4)) = *GHIDRA_CAST((iVar10 + 4 + uVar11 * 4)); - uVar11 = uVar11 + 1; - uVar4 = (curList->_updateEL)._size; - } while (uVar11 < uVar4 - 1); - } - uVar4 = uVar4 - 1; - (curList->_updateEL)._size = uVar4; - } - else { - uVar13 = uVar13 + 1; - } - } while (uVar13 < uVar4); - } - uVar4 = (curList->_renderEL)._size; - uVar13 = 0; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_renderEL))) + 0x4)))) + uVar13 * 4)) + 0x172)) == - '\0') { - if (uVar4 <= uVar13) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid index for remove\n")); - uVar4 = (curList->_renderEL)._size; - } - uVar11 = uVar13; - if (uVar13 < uVar4 - 1) { - do { - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_renderEL))) + 0x4)))); - *GHIDRA_CAST((iVar10 + uVar11 * 4)) = *GHIDRA_CAST((iVar10 + 4 + uVar11 * 4)); - uVar11 = uVar11 + 1; - uVar4 = (curList->_renderEL)._size; - } while (uVar11 < uVar4 - 1); - } - uVar4 = uVar4 - 1; - (curList->_renderEL)._size = uVar4; - } - else { - uVar13 = uVar13 + 1; - } - } while (uVar13 < uVar4); - } - uVar4 = (curList->_wispEL)._size; - uVar13 = 0; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_wispEL))) + 0x4)))) + uVar13 * 4)) + 0x172)) == '\0') - { - if (uVar4 <= uVar13) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid index for remove\n")); - uVar4 = (curList->_wispEL)._size; - } - uVar11 = uVar13; - if (uVar13 < uVar4 - 1) { - do { - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_wispEL))) + 0x4)))); - *GHIDRA_CAST((iVar10 + uVar11 * 4)) = *GHIDRA_CAST((iVar10 + 4 + uVar11 * 4)); - uVar11 = uVar11 + 1; - uVar4 = (curList->_wispEL)._size; - } while (uVar11 < uVar4 - 1); - } - uVar4 = uVar4 - 1; - (curList->_wispEL)._size = uVar4; - } - else { - uVar13 = uVar13 + 1; - } - } while (uVar13 < uVar4); - } - uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x2c)))); - uVar13 = 0; - if (uVar4 != 0) { - do { - piVar12 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x24)))) + uVar13 * 4)); - if (*GHIDRA_CAST((GHIDRA_CAST(piVar12) + 0x172)) == '\0') { - (**(code **)(*piVar12 + 0x44))(); - *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x24)))) + uVar13 * 4)) + 0x170)) = 0; - uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x2c)))); - if (uVar4 <= uVar13) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid index for remove\n")); - uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x2c)))); - } - uVar11 = uVar13; - if (uVar13 < uVar4 - 1) { - do { - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x24)))) + uVar11 * 4)) = - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x24)))) + 4 + uVar11 * 4)); - uVar11 = uVar11 + 1; - uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x2c)))); - } while (uVar11 < uVar4 - 1); - } - uVar4 = uVar4 - 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((curList)) + 0x2c)))) = uVar4; - } - else { - uVar13 = uVar13 + 1; - } - } while (uVar13 < uVar4); - } - uVar4 = (curList->_persistentEL)._size; - uVar13 = 0; - if (uVar4 != 0) { - do { - piVar12 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_persistentEL))) + 0x4)))) + uVar13 * 4)); - if (*GHIDRA_CAST((GHIDRA_CAST(piVar12) + 0x172)) == '\0') { - local_21 = SUB41(piVar12[0x5c],0); - (**(code **)(*piVar12 + 0x44))(); - *(uint8_t *) - (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_persistentEL))) + 0x4)))) + uVar13 * 4)) + 0x170) = 0; - puVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_persistentEL))) + 0x4)))) + uVar13 * 4)); - if (((puVar7[10] == 1) && (local_21 != false)) && (puVar7 != GHIDRA_CAST(0x0))) { - (**(code **)*puVar7)(); - } - uVar4 = (curList->_persistentEL)._size; - if (uVar4 <= uVar13) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid index for remove\n")); - uVar4 = (curList->_persistentEL)._size; - } - uVar11 = uVar13; - if (uVar13 < uVar4 - 1) { - do { - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((curList->_persistentEL))) + 0x4)))); - *GHIDRA_CAST((iVar10 + uVar11 * 4)) = *GHIDRA_CAST((iVar10 + 4 + uVar11 * 4)); - uVar11 = uVar11 + 1; - uVar4 = (curList->_persistentEL)._size; - } while (uVar11 < uVar4 - 1); - } - uVar4 = uVar4 - 1; - (curList->_persistentEL)._size = uVar4; - } - else { - uVar13 = uVar13 + 1; - } - } while (uVar13 < uVar4); - } - } - if (isTransition == 0) { - rebuild_sublists(curList); - } - sort_by_render_z(curList); - if (local_64 != netplayEnd) { - local_64 = get_mt_state_checksum(); - checksum = &curList[1]._updateEL; - Checksum::Update(checksum,GHIDRA_CAST(&local_64),4); - if ((curList[1]._updateEL._size == 0) && (bVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(curList[1]._updateEL)) + 0x4))), bVar3 != 0)) { - if (bVar3 < 4) { - memset(&(*GHIDRA_CAST((GHIDRA_CAST((checksum)) + 0x0))) + bVar3,0,GHIDRA_UINT((uint8_t)(4 - bVar3))); - } - uVar4 = curList[1]._updateEL._capacity; - (*GHIDRA_CAST((GHIDRA_CAST(&(curList[1]._updateEL)) + 0x4))) = 0; - curList[1]._updateEL._capacity = (uVar4 >> 1) + uVar4 * -0x80000000 + *GHIDRA_CAST(checksum); - } - checksumRecord[5] = curList[1]._updateEL._capacity; - checksumRecord[4] = local_64; - } - ExceptionList = local_1c; - return; -} - -// 00419750 -void EntityList::sort_by_render_z() -{ - int iVar1; - uint32_t uVar2; - uint32_t lowRenderZ; - uint32_t swapTmp; - uint32_t *highKey; - int iVar3; - void *pvVar4; - uint32_t local_18; - uint32_t local_14; - uint32_t local_10; - int local_c; - uint32_t renderCount; - int64_t allocSize; - uint32_t *entitySlot; - int highOffset; - - if (DAT_00c7e810 == (void *)0x0) { - allocSize = (uint64_t)GHIDRA_UINT((this->_renderEL)._capacity) * 4; - DAT_00c7e810 = operator_new_tracked - (-GHIDRA_UINT((GHIDRA_INT(((uint64_t)allocSize >> 0x20)) != 0)) | GHIDRA_UINT(allocSize)); - } - iVar3 = 0; - local_10 = (this->_renderEL)._size + -1; - if (0 < GHIDRA_INT(local_10)) { - do { - uVar2 = (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + local_10 * 4)) + 0x34)) - (); - *GHIDRA_CAST((GHIDRA_CAST(DAT_00c7e810) + local_10 * 4)) = uVar2; - if (uVar2 < 10000) { - for (; iVar3 < GHIDRA_INT(local_10); iVar3 = iVar3 + 1) { - lowRenderZ = (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + iVar3 * 4)) + - 0x34))(); - if (9999 < lowRenderZ) { - highOffset = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))); - swapTmp = *GHIDRA_CAST((highOffset + iVar3 * 4)); - *GHIDRA_CAST((highOffset + iVar3 * 4)) = *GHIDRA_CAST((highOffset + local_10 * 4)); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + local_10 * 4)) = swapTmp; - pvVar4 = DAT_00c7e810; - *GHIDRA_CAST((GHIDRA_CAST(DAT_00c7e810) + iVar3 * 4)) = uVar2; - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_10 * 4)) = lowRenderZ; - break; - } - *GHIDRA_CAST((GHIDRA_CAST(DAT_00c7e810) + iVar3 * 4)) = lowRenderZ; - } - } - local_10 = local_10 + -1; - } while (iVar3 < GHIDRA_INT(local_10)); - } - swapTmp = (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + iVar3 * 4)) + 0x34))(); - pvVar4 = DAT_00c7e810; - *GHIDRA_CAST((GHIDRA_CAST(DAT_00c7e810) + iVar3 * 4)) = swapTmp; - iVar3 = 0; - renderCount = (this->_renderEL)._size; - local_c = local_10 + 1; - if (GHIDRA_INT((renderCount - 1)) <= GHIDRA_INT(local_10)) { - local_c = local_10; - } - if (0 < local_c) { - do { - highOffset = local_c * 4; - highKey = GHIDRA_CAST((highOffset + GHIDRA_INT(pvVar4))); - if (*highKey < 5000) { - for (; iVar3 < local_c; iVar3 = iVar3 + 1) { - if (4999 < *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + iVar3 * 4))) { - iVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))); - entitySlot = GHIDRA_CAST((iVar1 + iVar3 * 4)); - swapTmp = *entitySlot; - *entitySlot = *GHIDRA_CAST((iVar1 + highOffset)); - pvVar4 = DAT_00c7e810; - *GHIDRA_CAST((highOffset + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))))) = swapTmp; - uVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + iVar3 * 4)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + iVar3 * 4)) = *highKey; - *highKey = uVar2; - break; - } - } - } - local_c = local_c + -1; - } while (iVar3 < local_c); - renderCount = (this->_renderEL)._size; - } - iVar3 = (GHIDRA_UINT((this->_renderEL)._capacity) >> 4) + 1; - if ((g_game->_frameCount & 1) == 0) { - local_14 = 1; - local_18 = 0; - while (local_14 < renderCount) { - if (local_14 != 0) { - local_10 = local_14; - local_c = local_18; - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_10 * 4 + -4)) <= *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_10 * 4))) - break; - highOffset = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))); - iVar3 = iVar3 + -1; - entitySlot = GHIDRA_CAST((highOffset + local_10 * 4)); - swapTmp = *entitySlot; - *entitySlot = *GHIDRA_CAST((highOffset + local_c)); - pvVar4 = DAT_00c7e810; - *GHIDRA_CAST((local_c + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))))) = swapTmp; - swapTmp = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_10 * 4)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_10 * 4)) = - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_10 * 4 + -4)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_10 * 4 + -4)) = swapTmp; - local_10 = local_10 - 1; - local_c = local_c + -4; - } while (local_10 != 0); - } - local_14 = local_14 + 1; - local_18 = local_18 + 4; - if (iVar3 < 1) { - return; - } - } - } - else { - local_14 = renderCount - 1; - local_10 = local_14 * 4; - do { - local_10 = local_10 + -4; - if (local_14 == 0) { - return; - } - if (local_14 < renderCount) { - local_c = local_10; - local_18 = local_14; - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_18 * 4 + -4)) <= *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_18 * 4))) - break; - highOffset = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))); - iVar3 = iVar3 + -1; - entitySlot = GHIDRA_CAST((highOffset + local_18 * 4)); - swapTmp = *entitySlot; - *entitySlot = *GHIDRA_CAST((highOffset + local_c)); - pvVar4 = DAT_00c7e810; - *GHIDRA_CAST((local_c + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))))) = swapTmp; - swapTmp = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_18 * 4)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_18 * 4)) = - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_18 * 4 + -4)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + local_18 * 4 + -4)) = swapTmp; - local_18 = local_18 + 1; - local_c = local_c + 4; - } while (local_18 < renderCount); - } - local_14 = local_14 - 1; - } while (0 < iVar3); - } - return; -} - -// 004199d0 -void EntityList::render_up_to(uint32_t maxDepth, Vector *offset) -{ - Entity *this_00; - uint32_t uVar1; - bool isSkipRender; - float savedOffsetX; - Vector mirrorOffset; - int waterFlagsMode3 [2]; - uint32_t waterFlagsMode4 [2]; - uint8_t waterFlagsMode5 [12]; - int gridCollisionClass; - float mirrorOffsetX; - float savedOffsetX; - float savedOffsetY; - - uVar1 = this->_renderCursor; - if (uVar1 < GHIDRA_UINT((this->_renderEL)._size)) { - do { - this_00 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_renderEL))) + 0x4)))) + uVar1 * 4)); - uVar1 = this_00->GetRenderZ(); - if (maxDepth <= uVar1) { - return; - } - switch(this->_renderMode) { - case 2: - break; - case 3: - (GHIDRA_CAST((this_00)))->Entity::get_water_splash_variant(waterFlagsMode3); - isSkipRender = ((uint8_t)waterFlagsMode3[0] & 0x42) == 2; -LAB_00419a25: - if (!isSkipRender) goto switchD_00419a0a_default; - break; - case 4: - (GHIDRA_CAST((this_00)))->Entity::get_water_splash_variant(GHIDRA_CAST(waterFlagsMode4)); - if ((waterFlagsMode4[0] & 0x48) == 0) { - isSkipRender = (waterFlagsMode4[0] & 6) == 0; - goto LAB_00419a25; - } - break; - case 5: - (GHIDRA_CAST((this_00)))->Entity::get_water_splash_variant(GHIDRA_CAST(waterFlagsMode5)); - mirrorOffsetX = g_vectorZero.x; - if ((waterFlagsMode5[0] & 0x60) == 0) { - if ((this_00->_type == 1) && - ((((gridCollisionClass = this_00->_entityGridCollisionClass, gridCollisionClass == 0 || - (gridCollisionClass == 3)) || (gridCollisionClass == 1)) || - (gridCollisionClass == 2)))) { - savedOffsetX = g_vectorZero.y + 4.0; - } - else { - savedOffsetX = g_vectorZero.y - 0.0; - } - savedOffsetY = (this_00->_posOffset).y; - savedOffsetX = (this_00->_posOffset).x; - (this_00->_posOffset).x = savedOffsetX; - (this_00->_posOffset).y = -savedOffsetY; - mirrorOffset.x = mirrorOffsetX + offset->x; - mirrorOffset.y = savedOffsetX + offset->y; - DAT_00c7977d = 1; - this_00->Render(&mirrorOffset); - (this_00->_posOffset).x = savedOffsetX; - DAT_00c7977d = 0; - (this_00->_posOffset).y = savedOffsetY; - } - break; - default: -switchD_00419a0a_default: - this_00->Render(offset); - } - uVar1 = this->_renderCursor + 1; - this->_renderCursor = uVar1; - } while (uVar1 < GHIDRA_UINT((this->_renderEL)._size)); - } - return; -} - -// 00419e70 -void EntityList::rebuild_sublists() -{ - uint32_t uVar1; - float fVar2; - bool bVar3; - uint32_t uVar4; - uint32_t *playerSlot; - int iVar5; - void *pvVar6; - void *playerListEnd; - Entity *this_00; - Entity *this_01; - PlayerManager *playerManager; - uint32_t entityIndex; - uint32_t listIndex; - uint32_t local_14; - Game *game; - Entity *tmpEntity; - - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6c)))) = 0; - FUN_0041baf0(); - FUN_0041baf0(); - FUN_0041baf0(); - FUN_0041baf0(); - FUN_0041baf0(); - FUN_0041baf0(); - FUN_0041baf0(); - FUN_0041baf0(); - local_14 = 0; - bVar3 = false; - listIndex = 0; - if ((this->_updateEL)._size != 0) { - do { - tmpEntity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + listIndex * 4)); - tmpEntity->_collidesWithEntity = 0; - if (tmpEntity->_entityCollisionClass != 0) { - iVar5 = tmpEntity->_type; - if (iVar5 == 3) { - if (tmpEntity->_variant == 0xef) { - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))))))->CellSpace::insert(tmpEntity); - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c))); - } - else { - playerListEnd = *(void **)this; - } -LAB_0041a0aa: - (GHIDRA_CAST((playerListEnd)))->CellSpace::insert(tmpEntity); -LAB_0041a0b4: - tmpEntity->_collisionIndex = local_14; - iVar5 = tmpEntity->_type; - local_14 = local_14 + 1; - } - else { - if (iVar5 == 9) { - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))))->CellSpace::insert(tmpEntity); - if ((!bVar3) && ((tmpEntity[1]._variant & 0x1000U) != 0)) { - bVar3 = true; - } - if ((tmpEntity[1]._type & 0x80U) == 0) goto LAB_0041a0b4; - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x14))); - goto LAB_0041a0aa; - } - if ((iVar5 == 2) || (iVar5 == 8)) { - if ((!bVar3) && (iVar5 == 2)) { - if (((GHIDRA_UINT(tmpEntity[1]._pendingDamageFlags) & GHIDRA_UINT(g_tearFlagShielded._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&tmpEntity[1]._pendingDamageFlags) + 4)) & - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._l)) + 0x4)))) != 0) || - ((tmpEntity[1]._index & GHIDRA_UINT(g_tearFlagShielded._h)) != 0 || - (tmpEntity[1]._collisionIndex & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._h)) + 0x4)))) != 0)) { - bVar3 = true; - } - } - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4))); - goto LAB_0041a0aa; - } - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar5 == 1)) || (iVar5 - 10U < 0x3de)) - || (iVar5 == 4)) { - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))))))->CellSpace::insert(tmpEntity); - iVar5 = tmpEntity->_type; - if (((iVar5 == 0x196) || (iVar5 == 0x394)) || - ((iVar5 == 4 && ((tmpEntity->_variant == 0x13 || (tmpEntity->_variant == 0x14)))))) { - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18))))))->CellSpace::insert(tmpEntity); - iVar5 = tmpEntity->_type; - } - if ((((((tmpEntity->_flags & 0x20000000) != 0) || (iVar5 == 0xf5)) || (iVar5 == 0x3c3)) - || (((tmpEntity->_flags & 0x10000000000000) != 0 || (iVar5 == 0x322)))) || - (iVar5 == 0x362)) { - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c))); - goto LAB_0041a0aa; - } - goto LAB_0041a0b4; - } - if ((iVar5 == 5) || (iVar5 == 6)) { - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10))); - goto LAB_0041a0aa; - } - if (iVar5 == 1) goto LAB_0041a0b4; - } - if (iVar5 == 1000) { - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6c)))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x68)))) < iVar5 + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6c)))); - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x64)))) + iVar5 * 4)) = tmpEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6c)))) + 1; - } - } - listIndex = listIndex + 1; - } while (listIndex < GHIDRA_UINT((this->_updateEL)._size)); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x20)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1c)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x28)))) = 0; - uVar4 = FUN_0041ca00(local_14 * local_14,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1c)))),0); - uVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1c)))); - FUN_0041c910(uVar4); - FUN_0041c910(local_14 * local_14); - FUN_0041cb90(uVar1,0,uVar1,0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x2c)))) = local_14; - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - (GHIDRA_CAST((*(void **)this)))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - } - (GHIDRA_CAST((*(void **)this)))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); - (GHIDRA_CAST((*(void **)this)))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - playerManager = &g_game->_playerManager; - local_14 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 - != 0) { - do { - playerListEnd = *(void **)this; - pvVar6 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (playerManager->_playerList)._end; - } - playerSlot = (playerManager->_playerList)._begin; - if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + local_14; - } - (GHIDRA_CAST((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST(*playerSlot)); - playerManager = &g_game->_playerManager; - local_14 = local_14 + 1; - } while (local_14 < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))))))->CellSpace::collide_self(); - local_14 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - game = g_game; - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))); - pvVar6 = (g_game->_playerManager)._playerList._end; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (game->_playerManager)._playerList._end; - } - playerSlot = (game->_playerManager)._playerList._begin; - if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + local_14; - } - (GHIDRA_CAST((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST(*playerSlot)); - local_14 = local_14 + 1; - } while (local_14 < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - local_14 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - game = g_game; - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))); - pvVar6 = (g_game->_playerManager)._playerList._end; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (game->_playerManager)._playerList._end; - } - playerSlot = (game->_playerManager)._playerList._begin; - if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + local_14; - } - (GHIDRA_CAST((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST(*playerSlot)); - local_14 = local_14 + 1; - } while (local_14 < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - local_14 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - game = g_game; - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10))); - pvVar6 = (g_game->_playerManager)._playerList._end; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (game->_playerManager)._playerList._end; - } - playerSlot = (game->_playerManager)._playerList._begin; - if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + local_14; - } - (GHIDRA_CAST((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST(*playerSlot)); - local_14 = local_14 + 1; - } while (local_14 < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - playerManager = &g_game->_playerManager; - local_14 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - playerListEnd = *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4))); - pvVar6 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (playerManager->_playerList)._end; - } - playerSlot = (playerManager->_playerList)._begin; - if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + local_14; - } - (GHIDRA_CAST((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST(*playerSlot)); - playerManager = &g_game->_playerManager; - local_14 = local_14 + 1; - } while (local_14 < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10))))))->CellSpace::collide_self(); - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18)))); - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x14))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - if (bVar3) { - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - } - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); - (GHIDRA_CAST((*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - playerManager = &g_game->_playerManager; - local_14 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 - != 0) { - do { - playerListEnd = (playerManager->_playerList)._end; - playerSlot = (playerManager->_playerList)._begin; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - playerSlot = (playerManager->_playerList)._begin; - } - if (local_14 < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + local_14; - } - tmpEntity = GHIDRA_CAST(*playerSlot); - this_01 = GHIDRA_CAST(tmpEntity[7]._splatColor._colorize[1]); - if ((this_01 != GHIDRA_CAST(0x0)) && - (((fVar2 = this_01[5]._color._colorize[1], fVar2 == -NAN || - (GHIDRA_INT(tmpEntity[5]._color._colorize[1]) <= GHIDRA_INT(fVar2))) || (this_01 == tmpEntity)))) { - if ((g_game->_frameCount & 1) == 0) { - if (((((tmpEntity->_sizeMulti).x == g_vectorOne.x) && - ((tmpEntity->_sizeMulti).y == g_vectorOne.y)) && - ((this_01->_sizeMulti).x == g_vectorOne.x)) && - ((this_01->_sizeMulti).y == g_vectorOne.y)) { - (GHIDRA_CAST((tmpEntity)))->Entity::push_apart_circle(this_01); - } - else { - (GHIDRA_CAST((tmpEntity)))->Entity::push_apart_capsule(this_01); - } - if ((((this_01->_sizeMulti).x == g_vectorOne.x) && - ((this_01->_sizeMulti).y == g_vectorOne.y)) && - (((tmpEntity->_sizeMulti).x == g_vectorOne.x && - ((tmpEntity->_sizeMulti).y == g_vectorOne.y)))) { - (GHIDRA_CAST((this_01)))->Entity::push_apart_circle(tmpEntity); - } - else { - this_00 = this_01; - this_01 = tmpEntity; -LAB_0041a727: - (GHIDRA_CAST((this_00)))->Entity::push_apart_capsule(this_01); - } - } - else { - if ((((this_01->_sizeMulti).x == g_vectorOne.x) && - ((this_01->_sizeMulti).y == g_vectorOne.y)) && - (((tmpEntity->_sizeMulti).x == g_vectorOne.x && - ((tmpEntity->_sizeMulti).y == g_vectorOne.y)))) { - (GHIDRA_CAST((this_01)))->Entity::push_apart_circle(tmpEntity); - } - else { - (GHIDRA_CAST((this_01)))->Entity::push_apart_capsule(tmpEntity); - } - if ((((tmpEntity->_sizeMulti).x != g_vectorOne.x) || - ((tmpEntity->_sizeMulti).y != g_vectorOne.y)) || - (((this_01->_sizeMulti).x != g_vectorOne.x || - ((this_01->_sizeMulti).y != g_vectorOne.y)))) { - this_00 = tmpEntity; - goto LAB_0041a727; - } - (GHIDRA_CAST((tmpEntity)))->Entity::push_apart_circle(this_01); - } - } - playerManager = &g_game->_playerManager; - local_14 = local_14 + 1; - } while (local_14 < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - entityIndex = 0; - if ((this->_updateEL)._size != 0) { - do { - tmpEntity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + entityIndex * 4)); - if (tmpEntity->_type != 7) { - if (tmpEntity->_type == 1) { - (GHIDRA_CAST((tmpEntity)))->Entity::PlayerCollideWithGrid(0); - } - else { - (GHIDRA_CAST((tmpEntity)))->Entity::CollideWithGrid(0); - } - } - entityIndex = entityIndex + 1; - } while (entityIndex < GHIDRA_UINT((this->_updateEL)._size)); - } - return; -} - -// 0041b4f0 -void EntityList::AddPersistentEntity(Entity *entity) -{ - int *piVar1; - uint32_t i; - uint32_t size; - - if (GHIDRA_UINT((this->_persistentEL)._capacity) <= (this->_persistentEL)._size + 0x32U) { - KAGE_LogMessage(1,(uint8_t *) - "[warn] Can\'t add more persistent entities, persistent list is full!\n"); - return; - } - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20)))))))->EntityList_EL::remove(entity); - size = (this->_persistentEL)._size; - i = 0; - if (size != 0) { - piVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_persistentEL))) + 0x4)))); - do { - if (entity == GHIDRA_CAST(*piVar1)) { - return; - } - i = i + 1; - piVar1 = piVar1 + 1; - } while (i < size); - } - if (GHIDRA_UINT((this->_persistentEL)._capacity) < size + 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - size = (this->_persistentEL)._size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_persistentEL))) + 0x4)))) + size * 4)) = entity; - piVar1 = &(this->_persistentEL)._size; - *piVar1 = *piVar1 + 1; - return; -} - -// 0041b570 -void EntityList::invalidate_type_cache(int type, int variant, int subType) -{ - int iVar1; - uint8_t findResult [8]; - int foundNode; - int keyType; - int keyVariant; - int keySubType; - int *cacheHead; - - iVar1 = variant; - keySubType = subType; - cacheHead = &this[1]._persistentEL._capacity; - keyType = type; - keyVariant = variant; - FUN_0041d390(findResult,&keyType); - if (((*GHIDRA_CAST((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST((foundNode + 0x10)) <= type)) && - ((*GHIDRA_CAST((foundNode + 0x10)) < type || - ((*GHIDRA_CAST((foundNode + 0x14)) <= iVar1 && - ((*GHIDRA_CAST((foundNode + 0x14)) < iVar1 || (*GHIDRA_CAST((foundNode + 0x18)) <= subType)))))))) { - subType = *cacheHead; - if (foundNode != subType) { - FUN_0041cc60(&subType,foundNode); - goto LAB_0041b5d4; - } - } - else { -LAB_0041b5d4: - subType = *cacheHead; - } - iVar1 = subType; - keyVariant = variant; - keyType = type; - keySubType = 0xffffffff; - FUN_0041d390(findResult,&keyType); - if ((*GHIDRA_CAST((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST((foundNode + 0x10)) <= type)) { - if (type <= *GHIDRA_CAST((foundNode + 0x10))) { - if ((variant < *GHIDRA_CAST((foundNode + 0x14))) || - ((variant <= *GHIDRA_CAST((foundNode + 0x14)) && (*GHIDRA_CAST((foundNode + 0x18)) < 0x80000000)))) - goto LAB_0041b62c; - } - if (foundNode != iVar1) { - FUN_0041cc60(&variant,foundNode); - iVar1 = *cacheHead; - } - } - else { -LAB_0041b62c: - iVar1 = subType; - } - keyType = type; - keyVariant = 0xffffffff; - keySubType = 0xffffffff; - FUN_0041d390(findResult,&keyType); - if ((((*GHIDRA_CAST((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST((foundNode + 0x10)) <= type)) && - ((*GHIDRA_CAST((foundNode + 0x10)) < type || - ((0x7fffffff < *GHIDRA_CAST((foundNode + 0x14)) && - ((GHIDRA_INT(*GHIDRA_CAST((foundNode + 0x14))) < -1 || (0x7fffffff < *GHIDRA_CAST((foundNode + 0x18)))))))))) - && (foundNode != iVar1)) { - FUN_0041cc60(&variant,foundNode); - } - return; -} - -// 0041b7b0 -int EntityList::CountEntities(Entity *spawner, int type, int variant, int subType) -{ - int iVar1; - uint32_t i; - int newCount; - uint32_t entityCount; - uint32_t *slot; - Entity *entity; - - if (spawner == GHIDRA_CAST(0x0)) { - iVar1 = FUN_0041b690(type,variant,subType); - return iVar1; - } - iVar1 = 0; - entityCount = (this->_updateEL)._size; - if (variant < 0) { - if (subType < 0) { - if (type == 0) { - if (entityCount != 0) { - slot = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))); - do { - entity = GHIDRA_CAST(*slot); - slot = slot + 1; - newCount = iVar1 + 1; - if (GHIDRA_CAST(entity->_spawnerEntity) != spawner) { - newCount = iVar1; - } - entityCount = entityCount - 1; - iVar1 = newCount; - } while (entityCount != 0); - return newCount; - } - } - else { - i = 0; - if (entityCount != 0) { - do { - newCount = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if ((*GHIDRA_CAST((newCount + 0x28)) == type) && (*GHIDRA_CAST((newCount + 0x3c8)) == spawner)) - { - iVar1 = iVar1 + 1; - } - i = i + 1; - } while (i < entityCount); - return iVar1; - } - } - } - else { - i = 0; - if (type == 0) { - if (entityCount != 0) { - do { - newCount = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if ((*GHIDRA_CAST((newCount + 0x30)) == subType) && - (*GHIDRA_CAST((newCount + 0x3c8)) == spawner)) { - iVar1 = iVar1 + 1; - } - i = i + 1; - } while (i < entityCount); - return iVar1; - } - } - else if (entityCount != 0) { - do { - newCount = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if (((*GHIDRA_CAST((newCount + 0x28)) == type) && (*GHIDRA_CAST((newCount + 0x30)) == subType)) && - (*GHIDRA_CAST((newCount + 0x3c8)) == spawner)) { - iVar1 = iVar1 + 1; - } - i = i + 1; - } while (i < entityCount); - return iVar1; - } - } - } - else if (subType < 0) { - i = 0; - if (type == 0) { - if (entityCount != 0) { - do { - newCount = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if ((*GHIDRA_CAST((newCount + 0x2c)) == variant) && (*GHIDRA_CAST((newCount + 0x3c8)) == spawner)) - { - iVar1 = iVar1 + 1; - } - i = i + 1; - } while (i < entityCount); - return iVar1; - } - } - else if (entityCount != 0) { - do { - newCount = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if (((*GHIDRA_CAST((newCount + 0x28)) == type) && (*GHIDRA_CAST((newCount + 0x2c)) == variant)) && - (*GHIDRA_CAST((newCount + 0x3c8)) == spawner)) { - iVar1 = iVar1 + 1; - } - i = i + 1; - } while (i < entityCount); - return iVar1; - } - } - else if (type == 0) { - i = 0; - if (entityCount != 0) { - do { - newCount = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if (((*GHIDRA_CAST((newCount + 0x2c)) == variant) && (*GHIDRA_CAST((newCount + 0x30)) == subType)) && - (*GHIDRA_CAST((newCount + 0x3c8)) == spawner)) { - iVar1 = iVar1 + 1; - } - i = i + 1; - } while (i < entityCount); - return iVar1; - } - } - else { - i = 0; - if (entityCount != 0) { - do { - newCount = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_updateEL))) + 0x4)))) + i * 4)); - if ((((*GHIDRA_CAST((newCount + 0x28)) == type) && (*GHIDRA_CAST((newCount + 0x2c)) == variant)) && - (*GHIDRA_CAST((newCount + 0x30)) == subType)) && (*GHIDRA_CAST((newCount + 0x3c8)) == spawner)) - { - iVar1 = iVar1 + 1; - } - i = i + 1; - } while (i < entityCount); - } - } - return iVar1; -} - -// 00431640 -uint8_t EntityList::HitListContains(Entity *entity) -{ - uint32_t hitListIndex; - uint32_t uVar1; - uint32_t count; - uint32_t *lowerBound; - - hitListIndex = (GHIDRA_CAST((entity)))->Entity::GetHitListIndex(); - lowerBound = *GHIDRA_CAST(this); - uVar1 = GHIDRA_INT(*(uint32_t **))&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4))) - GHIDRA_INT(lowerBound) >> 2; - while (count = uVar1, 0 < GHIDRA_INT(count)) { - uVar1 = count >> 1; - if (lowerBound[uVar1] < hitListIndex) { - lowerBound = lowerBound + uVar1 + 1; - uVar1 = count + (-1 - uVar1); - } - } - if ((lowerBound == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4))))) || (*lowerBound != hitListIndex)) { - return 0; - } - return 1; -} - -// 006b8320 -EntityList_EL * EntityList::assign(EntityList_EL *dest, EntityList_EL *source) -{ - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t copyCount; - - puStack_c = &LAB_00afa49e; - local_10 = ExceptionList; - ExceptionList = &local_10; - local_8 = 0; - sublist_init(GHIDRA_CAST(dest),GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x80)))),source->_size); - local_8 = 0; - copyCount = source->_size; - if (GHIDRA_UINT(dest->_capacity) < copyCount) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for copy\n")); - copyCount = source->_size; - } - memcpy(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((dest)) + 0x4))),*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((source)) + 0x4))),copyCount << 2); - dest->_size = source->_size; - ExceptionList = local_10; - return dest; -} - -// 0085e0c0 -Entity * EntityList::Get(uint32_t index) -{ - uint32_t clampedIndex; - uint32_t clampedIndex; - - clampedIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) - 1; - clampedIndex = -GHIDRA_UINT((index != 0)) & index; - if (clampedIndex < clampedIndex) { - clampedIndex = clampedIndex; - } - return *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + clampedIndex * 4)); -} diff --git a/generated-src/entity_list_el.cpp b/generated-src/entity_list_el.cpp deleted file mode 100644 index 31de4d1..0000000 --- a/generated-src/entity_list_el.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "classes.h" - -// 00417510 -void EntityList_EL::constructor(EntityList_EL *source) -{ - *GHIDRA_CAST(this) = 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((source)) + 0x4)))); - this->_capacity = source->_capacity; - this->_size = source->_size; - return; -} - -// 00417630 -void EntityList_EL::push_back(Entity *entity) -{ - int count; - - count = this->_size; - if (GHIDRA_UINT(this->_capacity) < count + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - count = this->_size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + count * 4)) = entity; - this->_size = this->_size + 1; - return; -} - -// 00417670 -void EntityList_EL::remove(Entity *entity) -{ - uint32_t shiftIndex; - uint32_t size; - uint32_t uVar1; - uint32_t *slotPtr; - - uVar1 = 0; - size = this->_size; - if (size != 0) { - do { - if (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + uVar1 * 4)) == entity) { - while ((uVar1 < size && (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + uVar1 * 4)) == entity))) { - if (size <= uVar1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: invalid index for remove\n")); - size = this->_size; - } - shiftIndex = uVar1; - if (uVar1 < size - 1) { - do { - slotPtr = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + shiftIndex * 4)); - shiftIndex = shiftIndex + 1; - *slotPtr = slotPtr[1]; - size = this->_size; - } while (shiftIndex < size - 1); - } - size = size - 1; - this->_size = size; - } - } - else { - uVar1 = uVar1 + 1; - } - } while (uVar1 < size); - } - return; -} diff --git a/generated-src/entity_npc.cpp b/generated-src/entity_npc.cpp deleted file mode 100644 index f430eb2..0000000 --- a/generated-src/entity_npc.cpp +++ /dev/null @@ -1,12869 +0,0 @@ -#include "classes.h" - -// 00447770 -Entity_NPC * Entity_NPC::ParentNPC() -{ - int npcCast; - Entity_NPC *parent; - - parent = GHIDRA_CAST(0x0); - if (this->_parent != 0) { - npcCast = __RTDynamicCast(this->_parent,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - if (npcCast == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("m_Parent invalid downcast\n")); - } - parent = GHIDRA_CAST(this->_parent); - } - return parent; -} - -// 004567a0 -long double Entity_NPC::Scale() -{ - return (long double)this->_scale; -} - -// 004567e0 -Entity_NPC * Entity_NPC::ChildNPC() -{ - int castNpc; - Entity_NPC *child; - - child = GHIDRA_CAST(0x0); - if (this->_child != 0) { - castNpc = __RTDynamicCast(this->_child,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - if (castNpc == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("m_Child invalid downcast\n")); - } - child = GHIDRA_CAST(this->_child); - } - return child; -} - -// 004b92e0 -void Entity_NPC::Hornfel_UpdateAI() -{ - uint32_t *puVar1; - char cVar2; - uint8_t *puVar3; - uint8_t bVar4; - short timer; - uint32_t uVar5; - LayerState *layer; - Entity_NPC *newMinecart; - Entity_Projectile *projectile; - uint8_t *animName; - Entity_NPC **ppEVar6; - int iVar7; - Entity *tmpEntity; - Vector *vecPtr; - uint32_t uVar8; - char *pcVar9; - float *pfVar10; - Entity_NPC **maxPtr; - int *size; - Entity_NPC *tmpEntity; - Room *activeRoom; - bool bVar12; - float fVar13; - float fVar14; - float dirDot; - float deltaY; - float dot; - Vector randomPos; - float spreadScore; - Vector local_148; - Vector tmpVec; - float local_138; - float local_134; - Entity_NPC *local_130; - Entity_NPC *local_12c; - float local_128; - Vector launchTarget; - Entity_NPC *local_11c; - Room *room; - char isAtRailTarget; - Vector scratchVec; - Entity_NPC *local_108; - float local_104; - Entity_NPC *local_100; - Entity_NPC *local_fc; - ProjectileParams projectileParams; - uint8_t local_50 [24]; - float fStack_38; - float fStack_34; - Entity_NPC *local_30; - Entity_NPC *local_2c; - Entity_NPC *local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - float absDirY; - void *animData; - uint32_t flagsHigh; - - puStack_20 = local_50 + 0x4c; - local_14 = 0xffffffff; - puStack_18 = &LAB_00af349d; - local_1c = ExceptionList; - uVar5 = __security_cookie ^ GHIDRA_UINT((local_50 + 0x40)); - ExceptionList = &local_1c; - local_12c = GHIDRA_CAST(this->_minecart); - activeRoom = g_game->_room; - room = activeRoom; - local_100 = this; - local_24 = uVar5; - puVar3 = local_50 + 0x4c; - switch(this->_state) { - case 0: - puStack_20 = local_50 + 0x4c; - if (this->_variant == 0) { - puStack_20 = local_50 + 0x4c; - QueryNPCsType(&fStack_34,1000,0x98); - local_14 = 0; - if (local_28 == GHIDRA_CAST(0x0)) { - uVar8 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x98,&g_vectorZero,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8); - tmpEntity->Update(uVar5); - } - else { - tmpEntity = *GHIDRA_CAST(local_30); - } - if (this->_parent != 0) { - local_fc = GHIDRA_CAST(&this->_parent); - msvc::multiset::erase(&local_fc); - } - this->_parent = tmpEntity; - if (tmpEntity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&this->_parent); - } - local_14 = 0xffffffff; - (GHIDRA_CAST((&fStack_34)))->EntityList_Query::~EntityList_Query(); - } - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x3)); - layer->_visible = 0; - layer = ANM2::GetLayer(&this->_sprite,&DAT_00000004); - layer->_visible = 0; - this->_stateFrame = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 2)) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileDelay) + 2)) = 0; - *GHIDRA_CAST(&this->_projectileCooldown) = 0; - msvc::deque::resize(2); - uVar5 = (this->_entityDeque)._offset; - *(uint32_t *) - (*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + ((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4 - )) + (uVar5 & 3) * 4) = 0; - scratchVec.y = (float)(this->_entityDeque)._offset; - *(uint32_t *) - (*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - ((this->_entityDeque)._mapSize - 1 & GHIDRA_INT(scratchVec.y) + 1U >> 2) * 4)) + - (GHIDRA_INT(scratchVec.y) + 1U & 3) * 4) = 0; - if (this->_variant == 1) { - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x140011; - this->_state = 0x10; - this->_isInvicible = 1; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - puVar3 = puStack_20; - } - else { - local_12c = GHIDRA_CAST(this->_minecart); - if (local_12c == GHIDRA_CAST(0x0)) { - newMinecart = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GiveMinecart(&g_vectorZero,&g_vectorZero); - local_2c = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST(0xf); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) = msvc::_Allocate(0x30); - local_2c = GHIDRA_CAST(0x21); - local_28 = GHIDRA_CAST(&DAT_0000002f); - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_50))) + 0x14))),"gfx/965.001_hornfel minecart.anm2",0x22); - local_14 = 1; - ANM2::Load(&newMinecart->_sprite,GHIDRA_CAST((local_50 + 0x14)),1); - local_14 = 0xffffffff; - if (GHIDRA_CAST(&DAT_0000000f) < local_28) { - size = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_28)) + 0x1)))); - pcVar9 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_50))) + 0x14))); - if (GHIDRA_CAST(0xfff) < size) { - pcVar9 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + -4)); - size = &local_28->_collisionIndex; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pcVar9))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar9,GHIDRA_UINT(size)); - } - local_12c = GHIDRA_CAST(this->_minecart); - } - NpcHelper::hornfel_ride_minecart(this); - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 1)) = 0x1e1e; - puVar3 = puStack_20; - } - break; - case 3: - case 0xe: - animData = (this->_sprite)._animState._animData; - if (((animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) || - (puStack_20 = local_50 + 0x4c, *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x34)) != '\0')) { - puStack_20 = local_50 + 0x4c; - NpcHelper::hornfel_charge(this); - } - (local_12c->_v2).x = 1.2; - timer = (short)this->_projectileDelay; - puVar3 = puStack_20; - if ((0 < timer) && (timer = timer + -1, *GHIDRA_CAST(&this->_projectileDelay) = timer, timer < 1)) { - if (this->_state == 0xe) { - if (*GHIDRA_CAST((GHIDRA_INT(&this->_projectileDelay) + 3)) != '\0') { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Taunt"),0); - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 3)) = 0x96; - puVar3 = puStack_20; - } - } - else { - NpcHelper::hornfel_attack(this); - puVar3 = puStack_20; - } - } - break; - case 4: - absDirY = (this->_velocity).y; - fVar13 = (this->_velocity).x; - this->_friction = this->_friction * 0.8; - if (ABS(absDirY) < ABS(fVar13)) { - puStack_20 = local_50 + 0x4c; - ANM2::Play(&this->_sprite,GHIDRA_CAST("RunHori"),0); - bVar12 = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; - } - else { - animName = (this->_sprite)._animState._animData; - local_fc = GHIDRA_CAST(&DAT_00b5fdc8); - if (0.0 <= absDirY) { - local_fc = GHIDRA_CAST(0xb5fdd0); - } - if (animName == GHIDRA_CAST(0x0)) { -LAB_004ba3e5: - puStack_20 = local_50 + 0x4c; - bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(local_fc),1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - activeRoom = room; - } - } - else { - if (0xf < *GHIDRA_CAST((animName + 0x14))) { - animName = *GHIDRA_CAST(animName); - } - newMinecart = local_fc; - do { - bVar4 = *animName; - bVar12 = bVar4 < *GHIDRA_CAST(newMinecart); - if (bVar4 != *GHIDRA_CAST(newMinecart)) { -LAB_004ba3c4: - uVar5 = -GHIDRA_UINT(bVar12) | 1; - goto LAB_004ba3c9; - } - if (bVar4 == 0) break; - bVar4 = animName[1]; - bVar12 = bVar4 < (*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)newMinecart)) + 0x1))); - if (bVar4 != (*GHIDRA_CAST((GHIDRA_CAST((newMinecart)) + 0x1)))) goto LAB_004ba3c4; - animName = animName + 2; - newMinecart = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((newMinecart)) + 0x2)))); - } while (bVar4 != 0); - uVar5 = 0; -LAB_004ba3c9: - if ((uVar5 != 0) || - ((puStack_20 = local_50 + 0x4c, - *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && - (puStack_20 = local_50 + 0x4c, (this->_sprite)._animState._isPlaying == 0)))) - goto LAB_004ba3e5; - } - bVar12 = false; - } - (this->_sprite)._flipX = bVar12; - timer = (short)this->_projectileDelay; - if (0 < timer) { - *GHIDRA_CAST(&this->_projectileDelay) = - timer - ((short)GHIDRA_INT(this->_updateTime) - (short)GHIDRA_INT(this->_prevUpdateTime)); - } - if (GHIDRA_CAST(this->_entityRef) == GHIDRA_CAST(0x0)) { - local_104 = -NAN; - } - else { - local_104 = (float)NpcHelper::hornfel_next_rail_index(GHIDRA_CAST(this->_entityRef)); - } - absDirY = (float)(GHIDRA_CAST((activeRoom)))->Room::GetGridIndex(&this->_pos); - if ((absDirY == local_104) || - (bVar4 = (GHIDRA_CAST((activeRoom)))->Room::IsPositionInRoom(&this->_pos,0.0), bVar4 == 0)) { - isAtRailTarget = '\x01'; - } - else { - isAtRailTarget = '\0'; - if ((this->_entityRef != 0) && (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(10,0), bVar4 != 0)) { - bVar4 = 0; - vecPtr = (GHIDRA_CAST((room)))->Room::GetGridPosition(&tmpVec,GHIDRA_INT(local_104)); - bVar4 = (GHIDRA_CAST((&this->_pathfinder)))->NPCAI_Pathfinder::HasPathToPos(vecPtr,bVar4); - puVar1 = &this->_entityRef; - if (bVar4 == 0) { - if (*puVar1 != 0) { - local_100 = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&local_100); - } - *puVar1 = 0; - } - } - } - local_130 = GHIDRA_CAST(this->_entityRef); - if (local_130 == GHIDRA_CAST(0x0)) { - if ((short)this->_projectileDelay < 1) { - local_fc = GHIDRA_CAST(0x7149f2ca); - local_11c = g_game->_room; - local_108 = GHIDRA_CAST(0x0); - absDirY = 0.0; - local_104 = absDirY; - if (local_11c[1]._brimstoneMarkCountdown != 0) { - do { - fVar13 = *GHIDRA_CAST((local_11c[1]._weaknessCountdown + GHIDRA_INT(local_108) * 4)); - if (*GHIDRA_CAST((GHIDRA_CAST(fVar13) + 0x28)) == 0x3c7) { - dot = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(fVar13) + 0x340)); - absDirY = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(fVar13) + 0x33c)); - local_100 = GHIDRA_CAST((dot * dot + absDirY * absDirY)); - bVar4 = (GHIDRA_CAST((&this->_pathfinder)))->NPCAI_Pathfinder::HasPathToPos(&this->_pos,0); - if ((bVar4 == 0) || ((float)local_fc <= (float)local_100)) { - absDirY = local_104; - } - else { - local_fc = local_100; - absDirY = fVar13; - local_104 = fVar13; - } - } - local_108 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_108)) + 0x1)))); - } while (local_108 < GHIDRA_CAST(local_11c[1]._brimstoneMarkCountdown)); - if (absDirY != 0.0) { - if (this->_entityRef != 0) { - local_100 = GHIDRA_CAST(&this->_entityRef); - msvc::multiset::erase(&local_100); - absDirY = local_104; - } - this->_entityRef = absDirY; - msvc::multiset::insert(&this->_entityRef); - } - } - if (GHIDRA_CAST(this->_entityRef) != GHIDRA_CAST(0x0)) { - absDirY = (float)NpcHelper::hornfel_next_rail_index(GHIDRA_CAST(this->_entityRef)); - local_130 = GHIDRA_CAST(this->_entityRef); - goto LAB_004ba6b2; - } - } -LAB_004ba7a3: - tmpEntity = GetPlayerTarget(this); - absDirY = (this->_pos).x; - fVar13 = (tmpEntity->_pos).x; - deltaY = (this->_pos).y - (tmpEntity->_pos).y; - fVar14 = absDirY - fVar13; - dirDot = fVar14 * _DAT_00c5c678 + deltaY * _DAT_00c5c67c; - dot = 0.0; - if (0.0 < dirDot) { - dot = dirDot; - } - pfVar10 = &g_vectorZero.x; - if (0.0 < dirDot) { - pfVar10 = GHIDRA_CAST(&DAT_00c5c678); - } - dirDot = fVar14 * _DAT_00c5c680 + deltaY * _DAT_00c5c684; - if (dot < dirDot) { - pfVar10 = GHIDRA_CAST(&DAT_00c5c680); - dot = dirDot; - } - dirDot = fVar14 * DAT_00c5c688 + deltaY * DAT_00c5c68c; - if (dot < dirDot) { - pfVar10 = &DAT_00c5c688; - dot = dirDot; - } - fVar14 = DAT_00c5c694 * deltaY + fVar14 * DAT_00c5c690; - if (dot < fVar14) { - pfVar10 = &DAT_00c5c690; - dot = fVar14; - } - absDirY = atan2f((this->_pos).y - (dot * (GHIDRA_CAST(pfVar10))->y * 0.8 + (tmpEntity->_pos).y), - absDirY - (dot * (GHIDRA_CAST(pfVar10))->x * 0.8 + fVar13)); - local_11c = GHIDRA_CAST((absDirY * 57.295776)); - local_100 = GHIDRA_CAST(((this->_v1).x * 0.017453292)); - local_fc = GHIDRA_CAST(sin((float)local_100)); - local_100 = GHIDRA_CAST(cos((float)local_100)); - uVar5 = Random(); - fVar13 = approach_angle((this->_v1).x,(float)local_11c, - (float)((double)GHIDRA_INT(uVar5) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283064e-10 - * 3.0 + 0.5); - bVar4 = this->_collidesWithGrid; - absDirY = this->_speedMultiplier; - (this->_v1).x = fVar13; - (this->_velocity).x = (float)local_100 * 1.2 * absDirY + (this->_velocity).x; - (this->_velocity).y = (float)local_fc * 1.2 * absDirY + (this->_velocity).y; - if (bVar4 != 0) { - absDirY = (this->_gridCollisionNormal).y; - fVar13 = (this->_gridCollisionNormal).x; - dot = absDirY * (float)local_fc + fVar13 * (float)local_100; - absDirY = atan2f((float)local_fc - dot * (absDirY + absDirY), - (float)local_100 - dot * (fVar13 + fVar13)); - (this->_v1).x = absDirY * 57.295776; - } - activeRoom = room; - } - else { - absDirY = local_104; -LAB_004ba6b2: - activeRoom = room; - if (local_130 == GHIDRA_CAST(0x0)) goto LAB_004ba7a3; - (GHIDRA_CAST((room)))->Room::GetGridPosition(&scratchVec,GHIDRA_INT(absDirY)); - if (isAtRailTarget == '\0') { - this->_entityGridCollisionClass = 5; - PathFinder::FindGridPath(GHIDRA_CAST(&this->_pathfinder),&scratchVec,1.08,0,1); - } - else { - this->_entityGridCollisionClass = 0; - vecPtr = NpcHelper::hornfel_get_rail_direction(local_130,&tmpVec); - absDirY = this->_speedMultiplier; - fVar13 = vecPtr->y; - (this->_velocity).x = -vecPtr->x * absDirY + (this->_velocity).x; - (this->_velocity).y = -fVar13 * absDirY + (this->_velocity).y; - NpcHelper::hornfel_set_anim(local_130,5); - iVar7 = (GHIDRA_CAST((activeRoom)))->Room::GetGridIndex(&this->_pos); - if (iVar7 < 0) { - (GHIDRA_CAST((activeRoom)))->Room::TriggerBossDeath(GHIDRA_CAST(this)); - this->Remove(); - } - } - } - bVar4 = (GHIDRA_CAST((activeRoom)))->Room::IsPositionInRoom(&this->_pos,0.0); - if (bVar4 == 0) { - absDirY = (this->_pos).x; - fVar13 = (this->_pos).y; - local_11c = GHIDRA_CAST(((activeRoom->_topLeftPos).x - absDirY)); - local_100 = GHIDRA_CAST((absDirY - (activeRoom->_bottomRightPos).x)); - local_fc = GHIDRA_CAST(((activeRoom->_topLeftPos).y - fVar13)); - local_108 = GHIDRA_CAST((fVar13 - (activeRoom->_bottomRightPos).y)); - ppEVar6 = &local_100; - if ((float)local_100 <= (float)local_11c) { - ppEVar6 = &local_11c; - } - maxPtr = &local_fc; - if ((float)local_fc < (float)*ppEVar6 || (float)local_fc == (float)*ppEVar6) { - maxPtr = ppEVar6; - } - ppEVar6 = &local_108; - if ((float)local_108 < (float)*maxPtr || (float)local_108 == (float)*maxPtr) { - ppEVar6 = maxPtr; - } - absDirY = ((float)*ppEVar6 - 0.0) / 48.0; - if (absDirY <= 0.0) { - absDirY = 0.0; - } - if (1.0 <= absDirY) { - absDirY = 1.0; - } - (this->_sprite)._color._tint[3] = 1.0 - absDirY; - goto LAB_004baae3; - } - (this->_sprite)._color._tint[3] = 1.0; - puVar3 = puStack_20; - break; - case 6: - case 7: - this->_visible = 0; - this->_entityCollisionClass = 0; - puVar3 = local_50 + 0x4c; - if (this->_child == 0) { - timer = (short)this->_stateFrame; - if (timer == 0) { - puVar3 = local_50 + 0x4c; - if (*GHIDRA_CAST((GHIDRA_INT(&this->_stateFrame) + 2)) < 1) { - puStack_20 = local_50 + 0x4c; - NpcHelper::hornfel_minecart(this); - puVar3 = puStack_20; - } - } - else { - *GHIDRA_CAST(&this->_stateFrame) = timer + -1; - puVar3 = local_50 + 0x4c; - } - } - break; - case 8: - puStack_20 = local_50 + 0x4c; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Sound"); - if (bVar4 != 0) { - PlaySound(this,0xc9,1.0,2,0,1.0); - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - if (bVar4 != 0) { - PlaySound(this,0x19,1.0,2,0,1.0); - tmpEntity = GetPlayerTarget(this); - local_fc = GHIDRA_CAST((tmpEntity->_pos).x); - local_108 = GHIDRA_CAST((tmpEntity->_pos).y); - local_104 = (tmpEntity->_velocity).x; - local_128 = (tmpEntity->_velocity).y; - uVar5 = Random(); - absDirY = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 0.20000002 + 0.1; - local_104 = local_104 * absDirY; - local_128 = local_128 * absDirY; - absDirY = (this->_pos).y - (tmpEntity->_pos).y; - fVar13 = (this->_pos).x - (tmpEntity->_pos).x; - absDirY = sqrtf(absDirY * absDirY + fVar13 * fVar13); - launchTarget.y = (float)local_108 + absDirY * local_128; - launchTarget.x = absDirY * local_104 + (float)local_fc; - vecPtr = Room::FindFreePickupSpawnPosition(room,&scratchVec,&launchTarget,0.0,0,0,0); - absDirY = (float)(this->_entityDeque)._offset; - launchTarget.x = vecPtr->x; - launchTarget.y = vecPtr->y; - uVar5 = (this->_entityDeque)._mapSize; - if (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - ((this->_entityDeque)._mapSize - 1 & GHIDRA_UINT(absDirY) >> 2) * 4)) + - (GHIDRA_UINT(absDirY) & 3) * 4)) == 0) { - local_fc = GHIDRA_CAST((GHIDRA_INT(absDirY) + 1U >> 2)); - uVar8 = GHIDRA_INT(absDirY) + 1U & 3; - scratchVec.y = absDirY; - if (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + (uVar5 - 1 & GHIDRA_UINT(local_fc)) * 4)) + - uVar8 * 4)) != 0) { - NpcHelper::hornfel_launch_toward - (this,*(Entity **) - (*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - ((this->_entityDeque)._mapSize - 1 & GHIDRA_UINT(local_fc)) * 4)) + - uVar8 * 4),&launchTarget); - scratchVec.y = (float)(this->_entityDeque)._offset; - uVar5 = GHIDRA_INT(scratchVec.y) + 1; - goto LAB_004b9d9e; - } - } - else { - NpcHelper::hornfel_launch_toward - (this,*(Entity **) - (*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - (uVar5 - 1 & GHIDRA_UINT(absDirY) >> 2) * 4)) + (GHIDRA_UINT(absDirY) & 3) * 4), - &launchTarget); - uVar5 = (this->_entityDeque)._offset; -LAB_004b9d9e: - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - ((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4)); - newMinecart = GHIDRA_CAST((iVar7 + (uVar5 & 3) * 4)); - if (*GHIDRA_CAST((iVar7 + (uVar5 & 3) * 4)) != 0) { - local_fc = newMinecart; - msvc::multiset::erase(&local_fc); - } - *GHIDRA_CAST(newMinecart) = 0; - } - pcVar9 = GHIDRA_CAST((GHIDRA_INT(&this->_projectileDelay) + 2)); - *pcVar9 = *pcVar9 + '\x01'; - } - puVar3 = puStack_20; - if ((((((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) && - (this->_state = 3, *GHIDRA_CAST((GHIDRA_INT(&this->_projectileDelay) + 3)) != '\0')) && - ((*GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 3)) == '\0' && - (uVar5 = Random(), puVar3 = puStack_20, uVar5 % 10 == 0)))) && - (0.5 < this->_health / this->_maxHitPoints)) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Taunt"),0); - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 3)) = 0x96; - puVar3 = puStack_20; - } - break; - case 9: - puStack_20 = local_50 + 0x4c; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - puVar3 = puStack_20; - if (bVar4 != 0) { - PlaySound(this,0x19,1.0,2,0,1.0); - local_130 = GHIDRA_CAST(0x0); - local_30 = GHIDRA_CAST(0x0); - local_2c = GHIDRA_CAST(0x0); - local_108 = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST(0x0); - local_14 = 2; - local_fc = (Entity_NPC *) - ((0x87 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc))) - + 3); - do { - newMinecart = local_2c; - launchTarget.y = 0.0; - launchTarget.x = 0.0; - if (local_130 == local_2c) { - vecPtr = (GHIDRA_CAST((room)))->Room::GetRandomPosition(&randomPos,40.0); - launchTarget.x = vecPtr->x; - launchTarget.y = vecPtr->y; - } - else { - local_138 = -1e+30; - local_134 = 1.12104e-44; - do { - tmpEntity = local_130; - (GHIDRA_CAST((room)))->Room::GetRandomPosition(&scratchVec,40.0); - spreadScore = 0.0; - do { - local_104 = scratchVec.y - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((tmpEntity)) + 0x4)))); - local_128 = scratchVec.x - *GHIDRA_CAST(tmpEntity); - local_11c = GHIDRA_CAST(sqrtf(local_104 * local_104 + local_128 * local_128)); - local_148.y = ABS(local_104); - local_148.x = ABS(local_128); - local_128 = local_148.x; - local_104 = local_148.y; - absDirY = sqrtf(local_148.y * local_148.y + local_148.x * local_148.x); - if (absDirY <= 0.0) { - fVar13 = local_128; - absDirY = local_104; - } - else { - local_148.x = local_128 * (1.0 / absDirY); - local_148.y = local_104 * (1.0 / absDirY); - fVar13 = local_148.x; - absDirY = local_148.y; - } - vecPtr = GHIDRA_CAST(&local_148.y); - if (fVar13 <= absDirY) { - vecPtr = &local_148; - } - tmpEntity = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((tmpEntity)) + 0x8)))); - spreadScore = vecPtr->x * (float)local_11c + spreadScore; - } while (tmpEntity != newMinecart); - if (local_138 < spreadScore) { - launchTarget.x = scratchVec.x; - launchTarget.y = scratchVec.y; - local_138 = spreadScore; - } - local_134 = (float)(GHIDRA_INT(local_134) + -1); - } while (local_134 != 0.0); - local_134 = 0.0; - this = local_100; - } - vecPtr = Room::FindFreePickupSpawnPosition(room,&tmpVec,&launchTarget,64.0,0,0,0); - launchTarget.x = vecPtr->x; - local_134 = vecPtr->y; - launchTarget.y = local_134; - local_11c = GHIDRA_CAST(launchTarget.x); - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,4,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - NpcHelper::hornfel_launch_toward(this,tmpEntity,&launchTarget); - tmpEntity->_entityCollisionClass = 1; - if (local_2c == local_108) { - msvc::vector::_Emplace_reallocate(local_2c,&launchTarget); - local_108 = local_28; - local_130 = local_30; - } - else { - *GHIDRA_CAST(local_2c) = local_11c; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_2c)) + 0x4)))) = local_134; - local_2c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_2c)) + 0x8)))); - } - local_fc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_fc[-1])) + 0xf5f)))); - } while (local_fc != GHIDRA_CAST(0x0)); - local_14 = 0xffffffff; - *GHIDRA_CAST((GHIDRA_INT(&this->_stateFrame) + 2)) = 0x7d; - puVar3 = puStack_20; - if (local_130 != GHIDRA_CAST(0x0)) { - uVar5 = (GHIDRA_INT(local_108) - GHIDRA_INT(local_130) >> 3) * 8; - newMinecart = local_130; - if (0xfff < uVar5) { - newMinecart = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_130[-1])) + 0xf5c)))); - uVar5 = uVar5 + 0x23; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(local_130) + (-4 - GHIDRA_INT(newMinecart))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(newMinecart,uVar5); - puVar3 = puStack_20; - } - } - break; - case 10: - puStack_20 = local_50 + 0x4c; - NpcHelper::hornfel_charge(this); - local_fc = GHIDRA_CAST(0x41f00000); - local_108 = GHIDRA_CAST(((local_12c->_v2).x + 0.08)); - ppEVar6 = &local_fc; - if ((float)local_108 <= 30.0) { - ppEVar6 = &local_108; - } - (local_12c->_v2).x = (float)*ppEVar6; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,this->_index); - puVar3 = puStack_20; - if ((bVar4 != 0) && - (bVar4 = (GHIDRA_CAST((activeRoom)))->Room::IsPositionInRoom(&this->_pos,20.0), puVar3 = puStack_20, bVar4 != 0 - )) { - vecPtr = MusicManager::RandomVector(&launchTarget); - uVar5 = Random(); - absDirY = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10; - scratchVec.y = absDirY * vecPtr->y + (this->_pos).y; - scratchVec.x = absDirY * vecPtr->x + (this->_pos).x; - Room::FindFreePickupSpawnPosition(room,&local_148,&scratchVec,0.0,0,0,0); - uVar5 = Random(); - vecPtr = &local_148; - tmpEntity = Game::Spawn(g_game,4,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - NpcHelper::hornfel_launch_toward(this,tmpEntity,vecPtr); - puVar3 = puStack_20; - } - break; - case 0xb: - puStack_20 = local_50 + 0x4c; - ANM2::Play(&this->_sprite,GHIDRA_CAST("ChargeFinish"),0); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - if (bVar4 != 0) { - (GHIDRA_CAST((&projectileParams)))->ProjectileParams::ProjectileParams(); - (*GHIDRA_CAST((GHIDRA_CAST(&(projectileParams.BulletFlags)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(projectileParams.BulletFlags)) + 0x4))) | 8; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x8))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0xc))) = 1.0; - projectileParams.Scale = 2.0; - local_30 = GHIDRA_CAST(0x3f800000); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x10))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) = GHIDRA_CAST(0x0); - fStack_38 = 0.0; - fStack_34 = 0.0; - local_2c = GHIDRA_CAST(0x3e99999a); - local_28 = GHIDRA_CAST(0x0); - (GHIDRA_CAST((GHIDRA_CAST(&projectileParams.Color))))->Color::operator_assign(GHIDRA_CAST(local_50)); - tmpEntity = GetPlayerTarget(this); - local_108 = GHIDRA_CAST(((tmpEntity->_velocity).y * 0.1)); - local_fc = GHIDRA_CAST(((tmpEntity->_velocity).x * 0.1)); - fVar13 = (this->_pos).x - (tmpEntity->_pos).x; - absDirY = (this->_pos).y - (tmpEntity->_pos).y; - absDirY = sqrtf(absDirY * absDirY + fVar13 * fVar13); - scratchVec.x = (float)local_fc * absDirY + (tmpEntity->_pos).x; - scratchVec.y = (float)local_108 * absDirY + (tmpEntity->_pos).y; - projectile = FireBossProjectiles(this,1,&scratchVec,10.0,&projectileParams); - projectile->_scale = 2.0; - projectile->_fallingAccel = projectile->_fallingAccel - 0.6; - projectile->_fallingSpeed = projectile->_fallingSpeed * 0.7 - 3.0; - } - bVar4 = ANM2::WasEventTriggered(&this->_sprite,GHIDRA_CAST("Shoot")); - absDirY = (local_12c->_v2).x; - puVar3 = puStack_20; - if (bVar4 == 0) { - local_138 = absDirY - 0.75; - local_134 = 0.8; - pfVar10 = &local_134; - if (0.8 <= local_138) { - pfVar10 = &local_138; - } - (local_12c->_v2).x = *pfVar10; - } - else { - local_108 = GHIDRA_CAST((absDirY + 0.1)); - local_fc = GHIDRA_CAST(0x3f99999a); - ppEVar6 = &local_fc; - if ((float)local_108 <= 1.2) { - ppEVar6 = &local_108; - } - (local_12c->_v2).x = (float)*ppEVar6; - } - break; - case 0xc: - puStack_20 = local_50 + 0x4c; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Detonate"),0); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Sound"); - if (bVar4 != 0) { - PlaySound(this,0xfc,1.0,2,0,1.0); - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - puVar3 = puStack_20; - if (bVar4 != 0) { - PlaySound(this,0x1d5,1.0,2,0,1.0); - puVar3 = puStack_20; - } - break; - case 0xd: - this->_friction = this->_friction * 0.6; - if (((this->_sprite)._animState._animData == (void *)0x0) || - (puVar3 = local_50 + 0x4c, (this->_sprite)._animState._isPlaying == 0)) { - this->_state = 4; - *GHIDRA_CAST(&this->_projectileDelay) = 0x5a; - puStack_20 = local_50 + 0x4c; - tmpEntity = GetPlayerTarget(this); - absDirY = atan2f((this->_pos).y - (tmpEntity->_pos).y,(this->_pos).x - (tmpEntity->_pos).x); - (this->_v1).x = absDirY * 57.295776; - puVar3 = puStack_20; - } - break; - case 0x10: - ANM2::Play(&this->_sprite,GHIDRA_CAST("DecoyIdle"),0); - if (0.0 < this->_pendingDamage) { - if ((this->_pendingDamageFlags & 4) == 0) { - pfVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - if (pfVar10 == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))) { - absDirY = this->_health; - } - else { - do { - if (10.0 < *pfVar10) { - uVar5 = Random(); - if (uVar5 % 3 == 0) { - absDirY = 3.0; - } - else { -LAB_004b966e: - absDirY = 2.0; - } -LAB_004b9680: - absDirY = this->_health - absDirY; - this->_health = absDirY; - } - else { - if (0.0 < *pfVar10) { - uVar5 = Random(); - if (uVar5 % 3 == 0) goto LAB_004b966e; - absDirY = 1.0; - goto LAB_004b9680; - } - absDirY = this->_health; - } - pfVar10 = pfVar10 + 0xe; - } while (pfVar10 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))); - } - if (1.0 <= absDirY) { - if (absDirY < 1.5) { - this->_dead = 1; - } - } - else { - this->_health = 1.0; - this->_dead = 1; - } - } - else { - this->_health = 1.0; - this->_dead = 1; - } - } - goto LAB_004baae3; - } - puStack_20 = puVar3; -LAB_004baae3: - timer = *GHIDRA_CAST((GHIDRA_INT(&this->_stateFrame) + 2)); - if (0 < timer) { - *GHIDRA_CAST((GHIDRA_INT(&this->_stateFrame) + 2)) = timer + -1; - } - pfVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - if (pfVar10 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))) { - do { - tmpVec.y = pfVar10[3]; - if ((((((GHIDRA_UINT(pfVar10[2]) & 4) != 0) && (pfVar10[6] != 1.4013e-45)) && - (pfVar10[4] != 1.4013e-45)) || - (((GHIDRA_UINT(pfVar10[2]) & 8) != 0 && (pfVar10[4] == (float)this->_type)))) || - ((pfVar10[4] == 1.4013e-42 && ((pfVar10[5] == 2.05991e-43 && (pfVar10[6] != 1.4013e-45))))) - ) { - this->_pendingDamage = this->_pendingDamage - *pfVar10; - *pfVar10 = 0.0; - } - pfVar10 = pfVar10 + 0xe; - } while (pfVar10 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))); - } - if (this->_pendingDamage <= 0.0 && this->_pendingDamage != 0.0) { - this->_pendingDamage = 0.0; - } - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(3.0,0.0); - if (iVar7 != 0) { - cVar2 = (char)this->_projectileCooldown; - if (cVar2 != '\0') { - *GHIDRA_CAST(&this->_projectileCooldown) = cVar2 + -1; - } - cVar2 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 1)); - if (cVar2 != '\0') { - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 1)) = cVar2 + -1; - } - cVar2 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 2)); - if (cVar2 != '\0') { - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 2)) = cVar2 + -1; - } - cVar2 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 3)); - if (cVar2 != '\0') { - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileCooldown) + 3)) = cVar2 + -1; - } - } - if (this->_dead != 0) { - if (this->_variant == 1) { - uVar5 = Random(); - vecPtr = &this->_pos; - Game::Spawn(g_game,1000,1,vecPtr,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x12,vecPtr,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - tmpEntity->Update(); - Game::BombDamage(g_game,vecPtr,110.0,75.0,0,GHIDRA_CAST(0x0),(BitSet128)ZEXT816(0),0x1004,0); - iVar7 = 6; - do { - uVar5 = Random(); - absDirY = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_fc = GHIDRA_CAST((absDirY + absDirY)); - uVar5 = Random(); - local_108 = (Entity_NPC *) - ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * 15.0 + 5.0); - scratchVec.x = cos((float)local_fc); - scratchVec.x = scratchVec.x * (float)local_108; - scratchVec.y = sin((float)local_fc); - scratchVec.y = scratchVec.y * (float)local_108; - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,4,3,&this->_pos,&scratchVec,GHIDRA_CAST(this),0,uVar5); - tmpEntity->_entityCollisionClass = 1; - iVar7 = iVar7 + -1; - } while (iVar7 != 0); - } - else if ((local_12c != GHIDRA_CAST(0x0)) && (this->_visible != 0)) { - uVar5 = Random(); - Game::Spawn(g_game,1000,1,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - if (this->_state == 8) { - uVar5 = (this->_entityDeque)._offset; - if (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - ((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4)) + (uVar5 & 3) * 4 - )) != 0) { - vecPtr = MusicManager::RandomVector(&tmpVec); - uVar8 = Random(); - uVar5 = (this->_entityDeque)._offset; - absDirY = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 10.0; - scratchVec.y = absDirY * vecPtr->y + (this->_pos).y; - scratchVec.x = absDirY * vecPtr->x + (this->_pos).x; - NpcHelper::hornfel_launch_toward - (this,*(Entity **) - (*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - ((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4)) + - (uVar5 & 3) * 4),&scratchVec); - uVar5 = (this->_entityDeque)._offset; - uVar8 = uVar5 & 3; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - (uVar5 >> 2 & (this->_entityDeque)._mapSize - 1) * 4)); - newMinecart = GHIDRA_CAST((iVar7 + uVar8 * 4)); - if (*GHIDRA_CAST((iVar7 + uVar8 * 4)) != 0) { - local_100 = newMinecart; - msvc::multiset::erase(&local_100); - } - *GHIDRA_CAST(newMinecart) = 0; - } - tmpVec.y = (float)(this->_entityDeque)._offset; - if (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - (GHIDRA_INT(tmpVec.y) + 1U >> 2 & (this->_entityDeque)._mapSize - 1) * 4)) + - (GHIDRA_INT(tmpVec.y) + 1U & 3) * 4)) != 0) { - vecPtr = MusicManager::RandomVector(&tmpVec); - uVar8 = Random(); - uVar5 = (this->_entityDeque)._offset + 1; - absDirY = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 10.0; - scratchVec.y = absDirY * vecPtr->y + (this->_pos).y; - scratchVec.x = absDirY * vecPtr->x + (this->_pos).x; - NpcHelper::hornfel_launch_toward - (this,*(Entity **) - (*GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - (uVar5 >> 2 & (this->_entityDeque)._mapSize - 1) * 4)) + - (uVar5 & 3) * 4),&scratchVec); - uVar5 = (this->_entityDeque)._offset + 1; - uVar8 = uVar5 & 3; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_entityDeque)._map) + - (uVar5 >> 2 & (this->_entityDeque)._mapSize - 1) * 4)); - newMinecart = GHIDRA_CAST((iVar7 + uVar8 * 4)); - if (*GHIDRA_CAST((iVar7 + uVar8 * 4)) != 0) { - local_100 = newMinecart; - msvc::multiset::erase(&local_100); - } - *GHIDRA_CAST(newMinecart) = 0; - } - } - NpcHelper::minecart_break(local_12c); - this->_state = 0xd; - ANM2::Play(&this->_sprite,&DAT_00b1cdf8,0); - puVar1 = &this->_entityRef; - this->_entityGridCollisionClass = 5; - this->_dead = 0; - this->_health = 100.0; - if (*puVar1 != 0) { - local_100 = GHIDRA_CAST(puVar1); - msvc::multiset::erase(&local_100); - } - *puVar1 = 0; - this->_collisionDamage = 1.0; - (this->_sprite)._color._tint[3] = 1.0; - } - } - ExceptionList = local_1c; - return; -} - -// 004bb0e0 -void Entity_NPC::Hornfel_UpdateFrame() -{ - Entity_NPC *minecart; - int row; - int column; - int gridHeight; - int gridWidth; - Entity_NPC *minecart; - - minecart = GHIDRA_CAST(this->_minecart); - if ((this->_state == 10) && (GHIDRA_CAST(this->_entityRef) != GHIDRA_CAST(0x0))) { - NpcHelper::hornfel_set_anim(GHIDRA_CAST(this->_entityRef),10); - minecart = *GHIDRA_CAST((this->_entityRef + 0x3bc)); - if (minecart != GHIDRA_CAST(0x0)) { - NpcHelper::hornfel_set_anim(minecart,10); - } - } - if (minecart == GHIDRA_CAST(0x0)) { - return; - } - if (this->_visible == 0) { - if (minecart->_state == 0) { - NpcAI::ENTITY_MINECART(minecart); - } - minecart->_state = 3; - (minecart->_pos).x = (this->_targetPosition).x; - (minecart->_pos).y = (this->_targetPosition).y; - (minecart->_velocity).x = g_vectorZero.x; - (minecart->_velocity).y = g_vectorZero.y; - return; - } - gridWidth = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - gridHeight = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x10)); - column = GHIDRA_INT((((minecart->_pos).x - 40.0) / 40.0 + 0.5)); - row = GHIDRA_INT((((minecart->_pos).y - 120.0) / 40.0 + 0.5)); - if (column < 1) { -LAB_004bb1a5: - if (column < 0) goto LAB_004bb1bb; -LAB_004bb1a9: - if (gridWidth + -1 < column) goto LAB_004bb1bb; - } - else { - if (gridWidth + -1 <= column) goto LAB_004bb1a9; - if (0 < row) { - if (row < gridHeight + -1) { - return; - } - goto LAB_004bb1a5; - } - } - if ((-1 < row) && (row <= gridHeight + -1)) { - return; - } -LAB_004bb1bb: - NpcHelper::hornfel_ride_minecart(this); - return; -} - -// 004cde30 -void Entity_NPC::update_physics() -{ - float fVar1; - int *playerSlot; - void *pvVar2; - int iVar3; - Game *game; - int iVar4; - uint32_t uVar5; - PlayerManager *playerManager; - float savedFriction; - float savedPosY; - float savedVelX; - float savedVelY; - - iVar4 = this->_child; - if (iVar4 == 0) { - this->_holdCountdown = 0; - } - else { - this->_holdCountdown = *GHIDRA_CAST((iVar4 + 0x3f0)); - (this->_holdPosition).x = *GHIDRA_CAST((iVar4 + 0x3f4)); - (this->_holdPosition).y = *GHIDRA_CAST((iVar4 + 0x3f8)); - if (0 < this->_holdCountdown) goto LAB_004cde91; - } - apply_velocity(this,0); - update_move_direction_anim(this); -LAB_004cde91: - iVar4 = this->_child; - if (iVar4 != 0) { - *GHIDRA_CAST((iVar4 + 0x33c)) = (this->_pos).x; - *GHIDRA_CAST((iVar4 + 0x340)) = (this->_pos).y; - iVar4 = this->_child; - *GHIDRA_CAST((iVar4 + 0x360)) = (this->_velocity).x; - *GHIDRA_CAST((iVar4 + 0x364)) = (this->_velocity).y; - *GHIDRA_CAST((this->_child + 0x36c)) = this->_friction; - } - if (this->_variant == 10) { - uVar5 = 0; - playerManager = &g_game->_playerManager; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - pvVar2 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar2) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar2 = (playerManager->_playerList)._end; - game = g_game; - } - playerSlot = (playerManager->_playerList)._begin; - if (uVar5 < GHIDRA_UINT((GHIDRA_INT(pvVar2) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + uVar5; - } - iVar4 = *playerSlot; - if (*GHIDRA_CAST((iVar4 + 0x3d4)) == this) { - fVar1 = (this->_pos).y; - *GHIDRA_CAST((iVar4 + 0x33c)) = *GHIDRA_CAST((iVar4 + 0x2088)) + (this->_pos).x; - *GHIDRA_CAST((iVar4 + 0x340)) = *GHIDRA_CAST((iVar4 + 0x208c)) + fVar1; - *GHIDRA_CAST((iVar4 + 0x360)) = (this->_velocity).x; - *GHIDRA_CAST((iVar4 + 0x364)) = (this->_velocity).y; - *GHIDRA_CAST((iVar4 + 0x36c)) = this->_friction; - } - playerManager = &game->_playerManager; - uVar5 = uVar5 + 1; - } while (uVar5 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - pvVar2 = game->_room; - iVar4 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5)); - if ((((-1 < iVar4) && (iVar4 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)))) && - (iVar3 = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)), -1 < iVar3)) && - ((iVar3 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)) && - (uVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)) * iVar3 + iVar4, uVar5 < 0x1c0)))) { - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar5 * 4 + 0x76c)); - iVar3 = iVar4 % 1000; - if (iVar3 < 900) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar5 * 4 + 0x76c)) = (iVar4 - iVar3) + 900; - } - } - } - fVar1 = (this->_pos).x; - savedPosY = (this->_pos).y; - savedVelX = (this->_velocity).x; - savedVelY = (this->_velocity).y; - savedFriction = this->_friction; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - (this->_pos).x = fVar1; - (this->_pos).y = savedPosY; - (this->_velocity).x = savedVelX; - (this->_velocity).y = savedVelY; - this->_friction = savedFriction; - return; -} - -// 004ce120 -void Entity_NPC::apply_velocity(char param_2) -{ - Vector *pos; - uint8_t bVar1; - GridEntity_Door *this_00; - int gridY; - uint32_t gridIdx; - uint32_t railType; - int gridX; - RailManager *this_01; - Game *game; - float fVar2; - float fVar3; - float fVar4; - Vector railDir; - Vector railPoint; - Vector railTangent; - float local_24; - float remainingSpeed; - float local_1c; - void *local_18; - float dirY; - float dirX; - uint8_t isRailReversed [5]; - void *curRoom; - - dirY = this->_friction * (this->_velocity).y; - dirX = this->_friction * (this->_velocity).x; - local_18 = g_game->_room; - if (param_2 == '\0') { - fVar2 = this->_baseFriction; - (this->_velocity).x = dirX; - (this->_velocity).y = dirY; - this->_friction = fVar2; - } - fVar2 = sqrtf(dirX * dirX + dirY * dirY); - if ((this->_variant == 10) && (this->_state == 4)) { - fVar2 = fVar2 + 0.5; - } - fVar4 = 40.0; - if (fVar2 <= 40.0) { - fVar4 = fVar2; - } - local_1c = fVar4; - if ((0.0 < DAT_00c7e848) && (local_1c = DAT_00c7e848, fVar4 <= DAT_00c7e848)) { - local_1c = fVar4; - } - if (param_2 != '\0') { - local_1c = local_1c * 0.5; - } - railDir.x = dirX; - railDir.y = dirY; - remainingSpeed = local_1c; - fVar2 = sqrtf(dirX * dirX + dirY * dirY); - if (0.0 < fVar2) { - railDir.x = dirX * (1.0 / fVar2); - railDir.y = dirY * (1.0 / fVar2); - dirY = railDir.y; - dirX = railDir.x; - } - fVar2 = (this->_pos).x; - pos = &this->_pos; - railPoint.y = 0.0; - railPoint.x = 0.0; - railTangent.y = 0.0; - railTangent.x = 0.0; - gridX = GHIDRA_INT(((fVar2 - 40.0) / 40.0 + 0.5)); - if ((((-1 < gridX) && (gridX < *GHIDRA_CAST((GHIDRA_CAST(local_18) + 0xc)))) && - (gridY = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)), -1 < gridY)) && - (gridY < *GHIDRA_CAST((GHIDRA_CAST(local_18) + 0x10)))) { - gridIdx = *GHIDRA_CAST((GHIDRA_CAST(local_18) + 0xc)) * gridY + gridX; - if ((gridIdx < 0x1c0) && - (bVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + gridIdx + 0x746c)), bVar1 != 0xff)) { - this_01 = GHIDRA_CAST((GHIDRA_INT(local_18) + 0x7468)); - RailManager::get_closest_rail_point - (this_01,pos,&railDir,gridIdx,bVar1 & 0xf,&railPoint,&railTangent,&local_24, - &local_1c,isRailReversed); - game = g_game; - pos->x = railPoint.x; - (this->_pos).y = railPoint.y; - fVar2 = (railTangent.x * dirX + railTangent.y * dirY) * remainingSpeed; - remainingSpeed = fVar2; - if (0.0 < fVar2) { - do { - fVar4 = 3.0; - if (remainingSpeed <= 3.0) { - fVar4 = remainingSpeed; - } - remainingSpeed = remainingSpeed - fVar4; - fVar3 = dirX * fVar4 + pos->x; - fVar4 = dirY * fVar4 + (this->_pos).y; - pos->x = fVar3; - (this->_pos).y = fVar4; - gridX = GHIDRA_INT(((fVar3 - 40.0) / 40.0 + 0.5)); - if (gridX < 0) { -LAB_004ce466: - gridIdx = 0xffffffff; -LAB_004ce469: - railType = 0xffffffff; - } - else { - if (*GHIDRA_CAST((GHIDRA_CAST(local_18) + 0xc)) <= gridX) goto LAB_004ce466; - gridY = GHIDRA_INT(((fVar4 - 120.0) / 40.0 + 0.5)); - if ((gridY < 0) || (game = g_game, *GHIDRA_CAST((GHIDRA_CAST(local_18) + 0x10)) <= gridY)) - goto LAB_004ce466; - gridIdx = *GHIDRA_CAST((GHIDRA_CAST(local_18) + 0xc)) * gridY + gridX; - if (0x1bf < gridIdx) goto LAB_004ce469; - bVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + gridIdx + 0x746c)); - if (bVar1 == 0xff) { - railType = 0xffffffff; - } - else { - railType = bVar1 & 0xf; - } - } - if ((GHIDRA_INT(gridIdx) < 1) || (GHIDRA_INT(railType) < 0)) { - if (param_2 == '\0') { - this->_i2 = -1; - } - pos->x = dirX * remainingSpeed + pos->x; - (this->_pos).y = dirY * remainingSpeed + (this->_pos).y; - return; - } - if (param_2 == '\0') { - this->_i2 = gridIdx; - } - RailManager::get_closest_rail_point - (this_01,pos,&railDir,gridIdx,railType,&railPoint,&railTangent,&local_24, - &local_1c,isRailReversed); - if (isRailReversed[0] != 0) { - railTangent.x = railTangent.x * -1.0; - railTangent.y = railTangent.y * -1.0; - } - if ((railTangent.x == g_vectorZero.x) && (railTangent.y == g_vectorZero.y)) { - if (param_2 == '\0') { - this->_i2 = -1; - } - pos->x = dirX * remainingSpeed + pos->x; - goto LAB_004ce6ae; - } - pos->x = railPoint.x; - (this->_pos).y = railPoint.y; - railDir.x = railTangent.x; - railDir.y = railTangent.y; - dirY = railTangent.y; - dirX = railTangent.x; - if ((this->_variant == 10) && (this->_state == 4)) { - curRoom = game->_room; - gridX = GHIDRA_INT((((railTangent.x * 10.0 + pos->x) - 40.0) / 40.0 + 0.5)); - if (((-1 < gridX) && - ((((gridX < *GHIDRA_CAST((GHIDRA_CAST(curRoom) + 0xc)) && - (gridY = GHIDRA_INT((((railTangent.y * 10.0 + railPoint.y) - 120.0) / 40.0 + 0.5)), - -1 < gridY)) && (gridY < *GHIDRA_CAST((GHIDRA_CAST(curRoom) + 0x10)))) && - ((gridIdx = *GHIDRA_CAST((GHIDRA_CAST(curRoom) + 0xc)) * gridY + gridX, gridIdx < 0x1c0 && - (this_00 = *GHIDRA_CAST((GHIDRA_CAST(curRoom) + gridIdx * 4 + 0x24)), - this_00 != GHIDRA_CAST(0x0))))))) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x4)))) == 0x10)) - { - (GHIDRA_CAST((this_00)))->GridEntity_Door::Open(); - (GHIDRA_CAST((this_00)))->GridEntity_Door::TryBlowOpen(1,GHIDRA_CAST(0x0)); - (GHIDRA_CAST((this_00)))->GridEntity_Door::TryBlowOpen(1,GHIDRA_CAST(0x0)); - } - game = g_game; - } - } while (0.0 < remainingSpeed); - } - if (param_2 == '\0') { - (this->_velocity).x = dirX * fVar2; - (this->_v1).x = dirX * fVar2; - (this->_velocity).y = dirY * fVar2; - (this->_v1).y = dirY * fVar2; - return; - } - return; - } - } - pos->x = dirX * local_1c + fVar2; -LAB_004ce6ae: - (this->_pos).y = dirY * remainingSpeed + (this->_pos).y; - return; -} - -// 004ce6d0 -void Entity_NPC::update_move_direction_anim() -{ - uint8_t *anim; - uint8_t bVar1; - uint8_t *currentAnimChar; - uint32_t uVar2; - int directionDelta; - uint8_t *newAnimChar; - bool isLess; - float fVar3; - uint8_t *animData; - uint32_t currentDirection; - - fVar3 = (this->_velocity).x; - if (((fVar3 != g_vectorZero.x) || ((this->_velocity).y != g_vectorZero.y)) && - (this->_state != 0x10)) { - fVar3 = atan2f((this->_velocity).y,fVar3); - for (fVar3 = fVar3 * -57.295776; fVar3 < 0.0; fVar3 = fVar3 + 360.0) { - } - for (; 360.0 <= fVar3; fVar3 = fVar3 - 360.0) { - } - uVar2 = GHIDRA_INT(((fVar3 * 16.0) / 360.0 + 0.5)) & 0x80000007; - if (GHIDRA_INT(uVar2) < 0) { - uVar2 = (uVar2 - 1 | 0xfffffff8) + 1; - } - currentDirection = this->_i1; - if (currentDirection != uVar2) { - if (g_game->_frameCount - this->_spawnFrame < 2) { - this->_i1 = uVar2; - } - else { - directionDelta = uVar2 - currentDirection; - if (directionDelta < -4) { - directionDelta = directionDelta + (-directionDelta - 5U & 0xfffffff8) + 8; - } - if (3 < directionDelta) { - directionDelta = directionDelta + (directionDelta + 4U >> 3) * -8; - } - uVar2 = currentDirection + 7; - if (-1 < directionDelta) { - uVar2 = currentDirection + 1; - } - uVar2 = uVar2 & 0x80000007; - if (GHIDRA_INT(uVar2) < 0) { - uVar2 = (uVar2 - 1 | 0xfffffff8) + 1; - } - this->_i1 = uVar2; - } - } - } - anim = (&PTR_s_Move1_00b1ee78)[this->_i1]; - if (this->_state == 0x10) { - bVar1 = ANM2::SetAnimation(&this->_sprite,anim,1); - if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - return; - } - } - else { - animData = (this->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - currentAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - currentAnimChar = *GHIDRA_CAST(animData); - } - newAnimChar = anim; - do { - bVar1 = *currentAnimChar; - isLess = bVar1 < *newAnimChar; - if (bVar1 != *newAnimChar) { -LAB_004ce860: - uVar2 = -GHIDRA_UINT(isLess) | 1; - goto LAB_004ce865; - } - if (bVar1 == 0) break; - bVar1 = currentAnimChar[1]; - isLess = bVar1 < newAnimChar[1]; - if (bVar1 != newAnimChar[1]) goto LAB_004ce860; - currentAnimChar = currentAnimChar + 2; - newAnimChar = newAnimChar + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_004ce865: - if (uVar2 == 0) { - if (animData[0x34] == 0) { - return; - } - if ((this->_sprite)._animState._isPlaying != 0) { - return; - } - } - } - bVar1 = ANM2::SetAnimation(&this->_sprite,anim,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - return; -} - -// 004cf030 -void Entity_NPC::SetMinecartPosVel(Vector *pos, Vector *vel) -{ - int gridY; - int roomWidth; - int roomWidth; - - (this->_pos).x = pos->x; - (this->_pos).y = pos->y; - roomWidth = GHIDRA_INT(((pos->x - 40.0) / 40.0 + 0.5)); - if ((((roomWidth < 0) || (roomWidth = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)), roomWidth <= roomWidth)) || - (gridY = GHIDRA_INT(((pos->y - 120.0) / 40.0 + 0.5)), gridY < 0)) || - (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x10)) <= gridY)) { - roomWidth = -1; - } - else { - roomWidth = roomWidth * gridY + roomWidth; - } - this->_i2 = roomWidth; - (this->_velocity).x = vel->x; - (this->_velocity).y = vel->y; - (this->_v1).x = vel->x; - (this->_v1).y = vel->y; - this->_spawnGridIndex = roomWidth; - return; -} - -// 004cf120 -void Entity_NPC::MinecartUpdateChild(Entity *child) -{ - Entity_NPC *newChild; - int oldRef; - uint32_t *refSlot; - Entity_NPC *local_8; - Entity *newChild; - - oldRef = this->_child; - refSlot = &this->_child; - local_8 = this; - if (oldRef != 0) { - if (*GHIDRA_CAST((oldRef + 0x3d4)) != 0) { - local_8 = GHIDRA_CAST((oldRef + 0x3d4)); - msvc::multiset::erase(&local_8); - *GHIDRA_CAST((oldRef + 0x3d4)) = 0; - oldRef = *refSlot; - } - if (oldRef != 0) { - local_8 = GHIDRA_CAST(refSlot); - msvc::multiset::erase(&local_8); - } - } - newChild = child; - *refSlot = child; - if (child != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(refSlot); - } - newChild = GHIDRA_CAST(newChild->_minecart); - refSlot = &newChild->_minecart; - if (newChild != this) { - if (newChild != GHIDRA_CAST(0x0)) { - child = GHIDRA_CAST(refSlot); - msvc::multiset::erase(&child); - } - *refSlot = this; - msvc::multiset::insert(refSlot); - } - return; -} - -// 004e8fa0 -void Entity_NPC::UpdateCordChain(uint8_t isHalfScale) -{ - float fVar1; - float fVar2; - float fVar3; - float fVar4; - float fVar5; - float fVar6; - int iVar7; - int iVar8; - int iVar9; - int iVar10; - int iVar11; - uint32_t nextPointIdx; - uint32_t uVar12; - uint32_t nextPointIdx; - uint32_t uVar14; - int iVar15; - uint32_t uVar16; - uint32_t uVar17; - uint32_t uVar18; - uint32_t uVar19; - uint32_t uVar20; - uint32_t uVar21; - uint32_t uVar22; - float segmentLength; - float fVar23; - float fVar24; - float segmentLength; - float fVar26; - float fVar27; - float lerpInvT; - float lerpT; - float forceY; - float forceX; - float forceZ; - float stepScale; - uint32_t pointCount; - uint32_t pointIdx; - void *pointMap; - - if (isHalfScale == 0) { - stepScale = 1.0; - } - else { - stepScale = 0.5; - } - if (this->_type == 0x3b6) { - segmentLength = 16.0; - } - else if (this->_type == 0x361) { - segmentLength = this->_aiFloat; - } - else { - segmentLength = ((this->_v1).x + 1.0) * 10.0; - } - pointCount = (this->_vectorDeque1)._size; - if ((this->_vectorDeque2)._size < pointCount) { - msvc::deque::resize(pointCount); - pointCount = (this->_vectorDeque1)._size; - } - pointIdx = 0; - if (pointCount != 0) { - uVar17 = pointCount; - do { - uVar14 = (this->_vectorDeque1)._offset; - forceX = 0.0; - forceY = 0.0; - forceZ = 0.4; - if (pointIdx != 0) { - nextPointIdx = (pointIdx - 1) + uVar14; - uVar17 = pointIdx + 2 + uVar14; - uVar21 = uVar14 + pointIdx & 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar14 + pointIdx >> 1) * 4)); - uVar12 = uVar14 + (pointIdx - 3); - nextPointIdx = uVar12 & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4)); - fVar24 = *GHIDRA_CAST((iVar7 + 4 + uVar21 * 8)) - *GHIDRA_CAST((iVar15 + 4 + nextPointIdx * 8)); - fVar27 = *GHIDRA_CAST((iVar7 + uVar21 * 8)) - *GHIDRA_CAST((iVar15 + nextPointIdx * 8)); - uVar21 = uVar17 & 1; - uVar17 = uVar17 >> 1; - pointMap = (this->_vectorDeque1)._map; - uVar18 = nextPointIdx >> 1; - nextPointIdx = nextPointIdx & 1; - segmentLength = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + uVar21 * 8)) - - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) + - nextPointIdx * 8)); - fVar23 = sqrtf(fVar24 * fVar24 + fVar27 * fVar27 + segmentLength * segmentLength); - fVar26 = fVar23 - segmentLength; - uVar12 = pointIdx + uVar14 + 1; - uVar22 = uVar12 & 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4)); - uVar12 = pointIdx + (uVar14 - 2); - nextPointIdx = uVar12 & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4)); - pointMap = (this->_vectorDeque1)._map; - forceX = (0.0 - (fVar27 / fVar23) * fVar26 * 0.3) - - (*GHIDRA_CAST((iVar7 + uVar22 * 8)) - *GHIDRA_CAST((iVar15 + nextPointIdx * 8))) * 0.3; - forceY = (0.0 - (fVar24 / fVar23) * fVar26 * 0.3) - - (*GHIDRA_CAST((iVar7 + 4 + uVar22 * 8)) - *GHIDRA_CAST((iVar15 + 4 + nextPointIdx * 8))) * 0.3; - forceZ = (0.4 - (segmentLength / fVar23) * fVar26 * 0.3) - - (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + 4 + - uVar21 * 8)) - - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) + 4 + - nextPointIdx * 8))) * 0.3; - uVar17 = pointCount; - } - nextPointIdx = pointIdx + 3; - if (nextPointIdx < uVar17) { - uVar12 = pointIdx + 5 + uVar14; - uVar17 = pointIdx + 2 + uVar14; - uVar18 = uVar14 + pointIdx & 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar14 + pointIdx >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - nextPointIdx = uVar14 + pointIdx + 3; - uVar21 = nextPointIdx & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (nextPointIdx >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - fVar24 = *GHIDRA_CAST((iVar7 + uVar18 * 8)) - *GHIDRA_CAST((iVar15 + uVar21 * 8)); - fVar27 = *GHIDRA_CAST((iVar7 + 4 + uVar18 * 8)) - *GHIDRA_CAST((iVar15 + 4 + uVar21 * 8)); - uVar21 = uVar17 & 1; - uVar17 = uVar17 >> 1; - pointMap = (this->_vectorDeque1)._map; - uVar18 = uVar12 >> 1; - uVar12 = uVar12 & 1; - segmentLength = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + uVar21 * 8)) - - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) + - uVar12 * 8)); - fVar23 = sqrtf(fVar24 * fVar24 + fVar27 * fVar27 + segmentLength * segmentLength); - fVar26 = fVar23 - segmentLength; - nextPointIdx = pointIdx + uVar14 + 1; - uVar22 = nextPointIdx & 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & nextPointIdx >> 1) * 4)); - uVar14 = pointIdx + uVar14 + 4; - nextPointIdx = uVar14 & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar14 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - pointMap = (this->_vectorDeque1)._map; - forceX = (forceX - (fVar24 / fVar23) * fVar26 * 0.3) - - (*GHIDRA_CAST((iVar7 + uVar22 * 8)) - *GHIDRA_CAST((iVar15 + nextPointIdx * 8))) * 0.3; - forceY = (forceY - (fVar27 / fVar23) * fVar26 * 0.3) - - (*GHIDRA_CAST((iVar7 + 4 + uVar22 * 8)) - *GHIDRA_CAST((iVar15 + 4 + nextPointIdx * 8))) * 0.3; - forceZ = (forceZ - (segmentLength / fVar23) * fVar26 * 0.3) - - (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + 4 + - uVar21 * 8)) - - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(pointMap) + - ((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) + 4 + - uVar12 * 8))) * 0.3; - } - uVar14 = (this->_vectorDeque1)._offset; - uVar17 = uVar14 + pointIdx; - nextPointIdx = uVar17 & 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - uVar14 = uVar14 + pointIdx + 1; - uVar12 = uVar14 & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar14 >> 1) * 4)); - fVar23 = *GHIDRA_CAST((iVar15 + 4 + uVar12 * 8)); - fVar24 = *GHIDRA_CAST((iVar7 + 4 + nextPointIdx * 8)); - uVar17 = (this->_vectorDeque2)._offset + pointIdx; - uVar14 = uVar17 & 1; - iVar8 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar17 >> 1) * 4)); - *GHIDRA_CAST((iVar8 + uVar14 * 8)) = - stepScale * *GHIDRA_CAST((iVar15 + uVar12 * 8)) + *GHIDRA_CAST((iVar7 + nextPointIdx * 8)); - *GHIDRA_CAST((iVar8 + 4 + uVar14 * 8)) = stepScale * fVar23 + fVar24; - uVar17 = pointIdx + 1 + (this->_vectorDeque1)._offset; - uVar14 = uVar17 & 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17 >> 1) * 4)); - fVar23 = *GHIDRA_CAST((iVar7 + 4 + uVar14 * 8)); - uVar17 = pointIdx + 1 + (this->_vectorDeque2)._offset; - uVar12 = uVar17 & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - (uVar17 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4)); - *GHIDRA_CAST((iVar15 + uVar12 * 8)) = (forceX * stepScale + *GHIDRA_CAST((iVar7 + uVar14 * 8))) * 0.95 - ; - *GHIDRA_CAST((iVar15 + 4 + uVar12 * 8)) = (forceY * stepScale + fVar23) * 0.95; - uVar17 = pointIdx + 2 + (this->_vectorDeque1)._offset; - uVar12 = uVar17 & 1; - uVar14 = pointIdx + 2 + (this->_vectorDeque2)._offset; - uVar17 = uVar17 >> 1; - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar14 >> 1) * 4)) + (uVar14 & 1) * 8)) - = stepScale * - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + 4 + uVar12 * 8)) - + *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + uVar12 * 8)); - uVar17 = pointIdx + 2 + (this->_vectorDeque1)._offset; - uVar14 = pointIdx + 2 + (this->_vectorDeque2)._offset; - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - (uVar14 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4)) + 4 + - (uVar14 & 1) * 8)) = - (forceZ * stepScale + - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + 4 + - (uVar17 & 1) * 8))) * 0.95; - uVar17 = pointIdx + 2 + (this->_vectorDeque2)._offset; - uVar14 = uVar17 & 1; - uVar17 = uVar17 >> 1; - if (0.0 < *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar17) * 4)) + uVar14 * 8))) - { - *(uint32_t *) - (*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar17) * 4)) + uVar14 * 8) = 0; - uVar17 = pointIdx + 2 + (this->_vectorDeque2)._offset; - *(uint32_t *) - (*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - (uVar17 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4)) + 4 + (uVar17 & 1) * 8) = - 0; - uVar17 = pointIdx + 1 + (this->_vectorDeque2)._offset; - uVar14 = uVar17 & 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - (uVar17 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4)); - *GHIDRA_CAST((iVar7 + uVar14 * 8)) = *GHIDRA_CAST((iVar7 + uVar14 * 8)) * 0.85; - *GHIDRA_CAST((iVar7 + 4 + uVar14 * 8)) = *GHIDRA_CAST((iVar7 + 4 + uVar14 * 8)) * 0.85; - } - uVar17 = (this->_vectorDeque1)._offset; - pointCount = (this->_vectorDeque1)._size; - uVar14 = uVar17 + (pointCount - 3); - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - uVar12 = uVar14 & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar14 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - fVar23 = *GHIDRA_CAST((iVar15 + 4 + uVar12 * 8)) - *GHIDRA_CAST((iVar7 + 4 + (uVar17 & 1) * 8)); - fVar24 = *GHIDRA_CAST((iVar15 + uVar12 * 8)) - *GHIDRA_CAST((iVar7 + (uVar17 & 1) * 8)); - fVar23 = sqrtf(fVar23 * fVar23 + fVar24 * fVar24); - fVar23 = (fVar23 - 90.0) / 110.0; - if (fVar23 <= 0.0) { - fVar23 = 0.0; - } - if (1.0 <= fVar23) { - fVar23 = 1.0; - } - fVar23 = fVar23 + 0.0; - if (fVar23 <= 0.0) { - uVar17 = (this->_vectorDeque1)._size; - } - else { - uVar17 = (this->_vectorDeque1)._offset; - iVar15 = (this->_vectorDeque1)._size / 3 - 1; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - uVar14 = (this->_vectorDeque1)._size; - lerpT = ((float)(pointIdx / 3) + 0.0) / - (float)((double)iVar15 + __uint_to_double_fixup[-(iVar15 >> 0x1f)]); - lerpInvT = 1.0 - lerpT; - fVar24 = *GHIDRA_CAST((iVar7 + 4 + (uVar17 & 1) * 8)); - uVar12 = (uVar14 - 3) + uVar17; - uVar14 = (uVar17 - 1) + uVar14; - uVar21 = uVar12 & 1; - iVar15 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4)); - segmentLength = *GHIDRA_CAST((iVar15 + 4 + uVar21 * 8)); - uVar19 = pointIdx + 2 + uVar17; - uVar18 = uVar17 + pointIdx & 1; - iVar8 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar17 + pointIdx >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)); - nextPointIdx = uVar19 >> 1; - uVar19 = uVar19 & 1; - fVar26 = *GHIDRA_CAST((iVar8 + 4 + uVar18 * 8)); - uVar12 = pointIdx + 1 + uVar17; - uVar22 = uVar12 & 1; - iVar9 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4)); - fVar27 = *GHIDRA_CAST((iVar9 + 4 + uVar22 * 8)); - uVar12 = (this->_vectorDeque2)._offset; - uVar20 = pointIdx + 2 + uVar12; - uVar12 = pointIdx + 1 + uVar12; - uVar16 = uVar12 >> 1; - uVar12 = uVar12 & 1; - iVar10 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar16) * 4)); - fVar1 = *GHIDRA_CAST((iVar10 + 4 + uVar12 * 8)); - fVar2 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (uVar14 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + - (uVar14 & 1) * 8)); - fVar3 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & uVar17 + 2 >> 1) * 4)) + - (uVar17 + 2 & 1) * 8)); - fVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & nextPointIdx) * 4)) + uVar19 * 8)); - fVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & nextPointIdx) * 4)) + 4 + - uVar19 * 8)); - fVar6 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar20 >> 1) * 4)) + 4 + - (uVar20 & 1) * 8)); - iVar11 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar16) * 4)); - *GHIDRA_CAST((iVar11 + uVar12 * 8)) = - *GHIDRA_CAST((iVar10 + uVar12 * 8)) + - (((lerpInvT * *GHIDRA_CAST((iVar7 + (uVar17 & 1) * 8)) + - lerpT * *GHIDRA_CAST((iVar15 + uVar21 * 8))) - *GHIDRA_CAST((iVar8 + uVar18 * 8))) * 0.8 - - *GHIDRA_CAST((iVar9 + uVar22 * 8)) * 0.8) * fVar23 * stepScale; - *GHIDRA_CAST((iVar11 + 4 + uVar12 * 8)) = - fVar1 + (((lerpInvT * fVar24 + lerpT * segmentLength) - fVar26) * 0.8 - fVar27 * 0.8) * fVar23 - * stepScale; - uVar17 = pointIdx + 2 + (this->_vectorDeque2)._offset; - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar17 >> 1) * 4)) + 4 + - (uVar17 & 1) * 8)) = - (((lerpT * fVar2 + lerpInvT * fVar3) - fVar4) * 0.8 - fVar5 * 0.8) * fVar23 * stepScale - + fVar6; - uVar17 = (this->_vectorDeque1)._size; - pointCount = uVar17; - } - pointIdx = nextPointIdx; - } while (nextPointIdx < uVar17); - } - if (isHalfScale == 0) { - msvc::deque::assign(&this->_vectorDeque2); - } - return; -} - -// 004e9b10 -void Entity_NPC::render_overlay(Vector *offset, uint8_t isShadow) -{ - void *pvVar1; - Color *extraout_EAX; - Color *baseColor; - float *pfVar2; - ColorMod *color; - uint8_t extraout_DL; - uint8_t isShadowTint; - uint32_t dequeSlot; - uint32_t uVar3; - int layerId; - uint32_t i; - int iVar4; - float fVar5; - float dx; - double dVar6; - uint8_t auStack_134 [16]; - float local_124; - uint8_t isUseOverlay; - float totalLength; - float trailPointX; - float trailPointY; - float trailPointLength; - float local_10c; - float local_108; - float cordLength; - int beamLayerId; - float local_fc; - float pointX; - float baseOffset [2]; - float baseTintR; - float baseTintG; - float baseTintB; - float baseTintA; - float baseColorizeR; - float baseColorizeG; - float baseColorizeB; - float baseColorizeA; - Color tmpColor; - ColorMod headColor; - ColorMod cordColor; - uint32_t local_44; - float *pointsEnd; - - local_44 = __security_cookie ^ GHIDRA_UINT(auStack_134); - if ((this->_vectorDeque2)._size != 0) { - cordLength = 192.0; - layerId = 2; - iVar4 = this->_type; - beamLayerId = 2; - isUseOverlay = 1; - if (iVar4 == 0x3b6) { - if ((this->_sprite)._animState._animData == (void *)0x0) { - return; - } - pvVar1 = AnimationState::GetNullFrame(&(this->_sprite)._animState,GHIDRA_CAST("CordPos")); - if (pvVar1 == (void *)0x0) { - return; - } - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)) == '\0') { - return; - } - cordLength = 76.0; - } - else { - if (iVar4 == 0x361) { - layerId = 0; - isUseOverlay = 0; - } - else if (iVar4 == 0x343) { - layerId = 1; - } - beamLayerId = layerId; - } - if (layerId < (this->_sprite)._layerCount) { - totalLength = 0.0; - if (isShadow == 0) { - (GHIDRA_CAST((&tmpColor)))->Color::Color(); - baseColor = extraout_EAX; - isShadowTint = extraout_DL; - } - else { - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - baseColor = &tmpColor; - tmpColor._offset[0] = 0.0; - tmpColor._offset[1] = 0.0; - tmpColor._offset[2] = 0.0; - tmpColor._tint[0] = 0.0; - tmpColor._tint[1] = 0.0; - tmpColor._tint[2] = 0.0; - tmpColor._tint[3] = 1.0; - isShadowTint = isShadow; - } - baseTintR = baseColor->_tint[0]; - baseTintG = baseColor->_tint[1]; - baseTintB = baseColor->_tint[2]; - baseTintA = baseColor->_tint[3]; - cordColor._tint[0] = baseTintR; - cordColor._tint[1] = baseTintG; - cordColor._tint[2] = baseTintB; - cordColor._tint[3] = baseTintA; - baseColorizeR = baseColor->_colorize[0]; - baseColorizeG = baseColor->_colorize[1]; - baseColorizeB = baseColor->_colorize[2]; - baseColorizeA = baseColor->_colorize[3]; - cordColor._colorize[0] = baseColorizeR; - cordColor._colorize[1] = baseColorizeG; - cordColor._colorize[2] = baseColorizeB; - cordColor._colorize[3] = baseColorizeA; - baseOffset = *(float (*) [2])baseColor->_offset; - local_fc = baseColor->_offset[2]; - tmpColor._offset[0] = 0.0; - tmpColor._offset[1] = 0.0; - tmpColor._offset[2] = 0.0; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - if (isShadowTint == 0) { - tmpColor._tint[0] = 0.3; - tmpColor._tint[1] = 0.3; - tmpColor._tint[2] = 0.3; - } - else { - tmpColor._tint[0] = 0.0; - tmpColor._tint[1] = 0.0; - tmpColor._tint[2] = 0.0; - } - tmpColor._tint[3] = 1.0; - headColor._tint[3] = 1.0; - headColor._colorize[0] = 0.0; - headColor._colorize[1] = 0.0; - headColor._colorize[2] = 0.0; - headColor._colorize[3] = 0.0; - headColor._offset[2] = 0.0; - headColor._offset[0] = 0.0; - headColor._offset[1] = 0.0; - iVar4 = *GHIDRA_CAST(ThreadLocalStoragePointer); - headColor._tint[0] = tmpColor._tint[0]; - headColor._tint[1] = tmpColor._tint[1]; - headColor._tint[2] = tmpColor._tint[2]; - (*GHIDRA_CAST((GHIDRA_CAST(&(cordColor._offset)) + 0x0))) = baseOffset; - cordColor._offset[2] = local_fc; - if ((*GHIDRA_CAST((iVar4 + 0xc)) < DAT_00c7f758) && (_Init_thread_header(), DAT_00c7f758 == -1)) { - _atexit(GHIDRA_CAST<_func_4879 *>(&LAB_00b154f0)); - _Init_thread_footer(); - } - if ((*GHIDRA_CAST((iVar4 + 0xc)) < DAT_00c7f768) && (_Init_thread_header(), DAT_00c7f768 == -1)) { - _atexit(GHIDRA_CAST<_func_4879 *>(&LAB_00b15470)); - _Init_thread_footer(); - } - i = 0; - DAT_00c7f760 = DAT_00c7f75c; - g_npcTrailPointsEnd = DAT_00c7f76c; - if ((this->_vectorDeque2)._size != 0) { - do { - pfVar2 = DAT_00c7f760; - uVar3 = (this->_vectorDeque2)._offset + i; - dequeSlot = uVar3 & 1; - iVar4 = *GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar3 >> 1) * 4)); - trailPointX = *GHIDRA_CAST((iVar4 + dequeSlot * 8)); - trailPointY = *GHIDRA_CAST((iVar4 + 4 + dequeSlot * 8)); - local_10c = trailPointY; - if (isShadow == 0) { - uVar3 = (this->_vectorDeque2)._offset + 2 + i; - local_10c = trailPointY + - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque2)._map) + - ((this->_vectorDeque2)._mapSize - 1 & uVar3 >> 1) * 4)) + - (uVar3 & 1) * 8)); - } - local_108 = g_displayPixelRatio * g_screenPointScale; - local_124 = ((g_screenWidth - 338.0) * 0.5 + (trailPointX - 60.0) * 0.65) * local_108 + - 0.5; - dVar6 = floor((double)local_124); - pointX = (float)dVar6 / local_108; - local_124 = ((g_screenHeight - 182.0) * 0.5 + (local_10c - 140.0) * 0.65) * local_108 + - 0.5; - dVar6 = floor((double)local_124); - local_124 = (float)dVar6; - trailPointX = pointX + offset->x; - trailPointY = local_124 / local_108 + offset->y; - if (pfVar2 == DAT_00c7f764) { - msvc::vector::_Emplace_reallocate(pfVar2,&trailPointX); - } - else { - *pfVar2 = trailPointX; - DAT_00c7f760[1] = trailPointY; - DAT_00c7f760 = DAT_00c7f760 + 2; - } - i = i + 3; - } while (i < (this->_vectorDeque2)._size); - } - pvVar1 = g_npcTrailPointsEnd; - trailPointX = *DAT_00c7f75c; - trailPointY = DAT_00c7f75c[1]; - trailPointLength = 0.0; - if (g_npcTrailPointsEnd == DAT_00c7f774) { - msvc::vector<12byte>::_Emplace_reallocate(g_npcTrailPointsEnd,&trailPointX); - } - else { - *GHIDRA_CAST(g_npcTrailPointsEnd) = *GHIDRA_CAST(DAT_00c7f75c); - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 8)) = 0; - g_npcTrailPointsEnd = (void *)(GHIDRA_INT(g_npcTrailPointsEnd) + 0xc); - } - i = 1; - if (1 < (GHIDRA_INT(DAT_00c7f760) - GHIDRA_INT(DAT_00c7f75c) >> 3) - 1U) { - do { - pvVar1 = g_npcTrailPointsEnd; - pointX = DAT_00c7f75c[i * 2] * 0.4 + DAT_00c7f75c[i * 2 + -2] * 0.3 + - DAT_00c7f75c[i * 2 + 2] * 0.3; - dx = *GHIDRA_CAST((GHIDRA_CAST(g_npcTrailPointsEnd) + -0xc)) - pointX; - local_124 = DAT_00c7f75c[i * 2 + -1] * 0.3 + DAT_00c7f75c[i * 2 + 1] * 0.4 + - DAT_00c7f75c[i * 2 + 3] * 0.3; - fVar5 = *GHIDRA_CAST((GHIDRA_CAST(g_npcTrailPointsEnd) + -8)) - local_124; - fVar5 = sqrtf(fVar5 * fVar5 + dx * dx); - totalLength = totalLength + fVar5; - trailPointX = pointX; - trailPointY = local_124; - trailPointLength = totalLength; - if (pvVar1 == DAT_00c7f774) { - msvc::vector<12byte>::_Emplace_reallocate(pvVar1,&trailPointX); - } - else { - *GHIDRA_CAST(pvVar1) = CONCAT44(local_124,pointX); - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 8)) = totalLength; - g_npcTrailPointsEnd = (void *)(GHIDRA_INT(g_npcTrailPointsEnd) + 0xc); - } - i = i + 1; - } while (i < (GHIDRA_INT(DAT_00c7f760) - GHIDRA_INT(DAT_00c7f75c) >> 3) - 1U); - } - pvVar1 = g_npcTrailPointsEnd; - pointsEnd = DAT_00c7f760; - fVar5 = *GHIDRA_CAST((GHIDRA_CAST(g_npcTrailPointsEnd) + -8)) - DAT_00c7f760[-1]; - dx = *GHIDRA_CAST((GHIDRA_CAST(g_npcTrailPointsEnd) + -0xc)) - DAT_00c7f760[-2]; - fVar5 = sqrtf(fVar5 * fVar5 + dx * dx); - pfVar2 = pointsEnd + -2; - trailPointX = *pfVar2; - totalLength = fVar5 + totalLength; - trailPointY = pointsEnd[-1]; - trailPointLength = totalLength; - if (pvVar1 == DAT_00c7f774) { - msvc::vector<12byte>::_Emplace_reallocate(pvVar1,&trailPointX); - } - else { - *GHIDRA_CAST(pvVar1) = *GHIDRA_CAST(pfVar2); - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 8)) = totalLength; - g_npcTrailPointsEnd = (void *)(GHIDRA_INT(g_npcTrailPointsEnd) + 0xc); - } - local_10c = 1.0; - local_108 = -NAN; - fVar5 = cordLength; - if (this->_type == 0x376) { - if (0 < this->_projectileDelay) { - local_108 = (float)(this->_projectileDelay / 2); - } - } - else if (this->_type == 0x361) { - uVar3 = 0; - i = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x18)) + 8)); - if (i != 0) { - pfVar2 = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x18)) + 4 - )) + 0xc)); - do { - if (totalLength <= *pfVar2) { - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(uVar3)); - } - break; - } - uVar3 = uVar3 + 1; - pfVar2 = pfVar2 + 0x1b; - } while (uVar3 < i); - } - headColor._offset[2] = local_fc; - headColor._tint[0] = baseTintR; - headColor._tint[1] = baseTintG; - headColor._tint[2] = baseTintB; - headColor._tint[3] = baseTintA; - headColor._colorize[0] = baseColorizeR; - headColor._colorize[1] = baseColorizeG; - headColor._colorize[2] = baseColorizeB; - headColor._colorize[3] = baseColorizeA; - headColor._offset[0] = baseOffset[0]; - headColor._offset[1] = baseOffset[1]; - fVar5 = totalLength; - if (this->_target != 0) { - local_10c = 0.9; - fVar5 = totalLength; - } - } - DAT_00c78ef0 = &this->_sprite; - fVar5 = totalLength / fVar5; - i = 0; - DAT_00c78ef4 = beamLayerId; - (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c78ef8)) + 0x0))) = isUseOverlay; - g_beamRendererPointsEnd = g_beamRendererPoints; - (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c78ef8)) + 0x1))) = 1; - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - iVar4 = GHIDRA_INT(g_npcTrailPointsEnd) - GHIDRA_INT(DAT_00c7f76c) >> 0x1f; - if ((GHIDRA_INT(g_npcTrailPointsEnd) - GHIDRA_INT(DAT_00c7f76c)) / 0xc + iVar4 != iVar4) { - local_fc = fVar5 * local_10c; - iVar4 = 0; - do { - color = &headColor; - if (i != 0) { - color = &cordColor; - } - if ((float)i == local_108) { - fVar5 = 2.0; - } - else { - fVar5 = 1.0; - } - BeamRenderer::Add(GHIDRA_CAST((iVar4 + GHIDRA_INT(DAT_00c7f76c))),color,fVar5, - local_10c - - (1.0 - *GHIDRA_CAST((iVar4 + 8 + GHIDRA_INT(DAT_00c7f76c))) / totalLength) * - local_fc); - i = i + 1; - iVar4 = iVar4 + 0xc; - } while (i < GHIDRA_UINT(((GHIDRA_INT(g_npcTrailPointsEnd) - GHIDRA_INT(DAT_00c7f76c)) / 0xc))); - } - BeamRenderer::End(); - } - } - return; -} - -// 00548f30 -int Entity_NPC::FindTargetPit(Vector *pos1, Vector *pos2, uint32_t pitIndex) -{ - uint32_t uVar1; - int index; - int iVar2; - int gridWidth; - int row; - float pitX; - float pos2Distance; - float fVar3; - float fVar4; - float pitY; - uint32_t bestIndex; - uint32_t gridIndex; - float bestScore; - short *gridPath; - void **gridEntitySlot; - float score; - void *gridEntity; - Room *room; - - room = g_game->_room; - bestIndex = 0xffffffff; - bestScore = -1e+06; - gridWidth = room->_gridWidth; - gridIndex = 0; - if (gridWidth * room->_gridHeight < 1) { - return -1; - } - gridPath = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0xe6c)))); - gridEntitySlot = room->_gridEntities; - do { - if ((((gridIndex < 0x1c0) && (gridEntity = *gridEntitySlot, gridEntity != (void *)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)) == 7)) && - ((*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xc)) == 0 && (*gridPath == 0)))) { - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - pitX = (float)(*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x24)) % iVar2) * 40.0 + 40.0; - pitY = (float)(*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x24)) / iVar2) * 40.0 + 120.0; - fVar3 = pos2->x - pitX; - pos2Distance = pos2->y - pitY; - pos2Distance = sqrtf(pos2Distance * pos2Distance + fVar3 * fVar3); - fVar3 = pos1->y - pitY; - fVar4 = pos1->x - pitX; - score = sqrtf(fVar3 * fVar3 + fVar4 * fVar4); - score = 2000.0 - score; - if (-1 < GHIDRA_INT(pitIndex)) { - if (pos2Distance < 60.0) goto LAB_0054926c; - score = score - pos2Distance * 3.0; - if (pitIndex == gridIndex) { - score = score - 2000.0; - } - iVar2 = GHIDRA_INT((((pitX + 40.0) - 40.0) / 40.0 + 0.5)); - row = GHIDRA_INT((((pitY + 0.0) - 120.0) / 40.0 + 0.5)); - if (((iVar2 < 0) || (gridWidth <= iVar2)) || ((row < 0 || (room->_gridHeight <= row)))) { - gridWidth = room->_gridWidth; - iVar2 = -1; - } - else { - iVar2 = gridWidth * row + iVar2; - } - uVar1 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar2); - if (uVar1 == 1) { - iVar2 = GHIDRA_INT((((pitX - 40.0) - 40.0) / 40.0 + 0.5)); - if ((((iVar2 < 0) || (gridWidth <= iVar2)) || (row < 0)) || (room->_gridHeight <= row)) { - iVar2 = -1; - } - else { - iVar2 = iVar2 + row * gridWidth; - } - uVar1 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar2); - if (uVar1 == 1) { - iVar2 = GHIDRA_INT((((pitX + 0.0) - 40.0) / 40.0 + 0.5)); - row = GHIDRA_INT((((pitY + 40.0) - 120.0) / 40.0 + 0.5)); - if (((iVar2 < 0) || (gridWidth <= iVar2)) || ((row < 0 || (room->_gridHeight <= row)))) - { - index = -1; - } - else { - index = row * gridWidth + iVar2; - } - uVar1 = (GHIDRA_CAST((room)))->Room::GetGridCollision(index); - if (uVar1 == 1) { - if (((iVar2 < 0) || (gridWidth <= iVar2)) || ((row < 0 || (room->_gridHeight <= row))) - ) { - iVar2 = -1; - } - else { - iVar2 = iVar2 + row * gridWidth; - } - uVar1 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar2); - if (uVar1 == 1) { - score = score + 200.0; - } - } - } - } - uVar1 = Random(); - score = (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283064e-10 * 500.0 + score; - } - if (bestScore < score) { - bestIndex = gridIndex; - bestScore = score; - } - } -LAB_0054926c: - gridWidth = room->_gridWidth; - gridIndex = gridIndex + 1; - gridEntitySlot = gridEntitySlot + 1; - gridPath = gridPath + 1; - if (gridWidth * room->_gridHeight <= GHIDRA_INT(gridIndex)) { - return bestIndex; - } - } while( true ); -} - -// 0055cef0 -Entity_NPC * Entity_NPC::ThrowStrider(Vector *pos, Entity *spanwer, Vector *targetPos) -{ - uint32_t seed; - Entity_NPC *strider; - int iVar1; - int iVar2; - float fVar3; - float fVar4; - uint32_t flagsHigh; - Game *game; - void *room; - float striderY; - float targetY; - - seed = Random(); - strider = GHIDRA_CAST(Game)::SpawnEx(g_game,0x32e,0,pos,&g_vectorZero,spanwer,0,seed,0); - game = g_game; - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&strider->_flags) + 4)); - *GHIDRA_CAST(&strider->_flags) = GHIDRA_UINT(strider->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&strider->_flags) + 4)) = flagsHigh; - fVar3 = targetPos->x; - (strider->_targetPosition).x = fVar3; - targetY = targetPos->y; - (strider->_targetPosition).y = targetY; - room = game->_room; - iVar2 = GHIDRA_INT(((fVar3 - 40.0) / 40.0 + 0.5)); - if ((((-1 < iVar2) && (iVar2 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)))) && - (iVar1 = GHIDRA_INT(((targetY - 120.0) / 40.0 + 0.5)), -1 < iVar1)) && - (((iVar1 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x10)) && - (iVar2 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)) * iVar1 + iVar2, -1 < iVar2)) && (iVar2 < 0x1c0)))) { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(room) + iVar2 * 4 + 0x76c)); - if (iVar1 < 0x385) { - *GHIDRA_CAST((GHIDRA_CAST(room) + iVar2 * 4 + 0x76c)) = 900; - } - else if (iVar1 - 3000U < 0x385) { - *GHIDRA_CAST((GHIDRA_CAST(room) + iVar2 * 4 + 0x76c)) = 0xf3c; - } - } - (strider->_posOffset).y = -8.0; - (strider->_v1).x = -8.0; - fVar3 = (strider->_targetPosition).x; - targetY = (strider->_targetPosition).y; - fVar4 = (strider->_pos).x; - striderY = (strider->_pos).y; - strider->_state = 6; - strider->_entityGridCollisionClass = 3; - fVar4 = (fVar3 - fVar4) * 0.04; - strider->_entityCollisionClass = 0; - fVar3 = (targetY - striderY) * 0.04; - (strider->_v2).x = fVar4; - (strider->_velocity).x = fVar4; - (strider->_v2).y = fVar3; - (strider->_velocity).y = fVar3; - return strider; -} - -// 00565680 -void Entity_NPC::render_v1_layer_frames() -{ - float fVar1; - float fVar2; - LayerState *pLVar3; - LayerState *layer1; - uint32_t segment2Index; - int layerId; - ANM2 *sprite; - float fVar4; - float fVar5; - float layer2Height; - float layer1Height; - void *animData; - int renderMode; - float *segment1Y; - uint32_t segmentIndex; - - fVar5 = (this->_v1).x; - renderMode = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12bc)); - if (0.0 <= fVar5) { - animData = (this->_sprite)._animState._animData; - if (fVar5 <= 4.0) { - if ((animData == (void *)0x0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1 && - (KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")), - *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1)))) goto LAB_005657ec; - animData = (this->_sprite)._animState._animData; - layerId = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x38)); - if ((animData == (void *)0x0) || - ((layerId < 0 || (*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x1c)) <= layerId)))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("id out of bounds\n")); - } - fVar5 = 0.0; - } - else { - if ((animData == (void *)0x0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1 && - (KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")), - *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1)))) goto LAB_005657ec; - animData = (this->_sprite)._animState._animData; - layerId = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x38)); - if ((animData == (void *)0x0) || - ((layerId < 0 || (*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x1c)) <= layerId)))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("id out of bounds\n")); - } - fVar5 = 2.0; - } - } - else { - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1 && - (KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")), - *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1)))) goto LAB_005657ec; - animData = (this->_sprite)._animState._animData; - layerId = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x38)); - if ((animData == (void *)0x0) || ((layerId < 0 || (*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x1c)) <= layerId)))) - { - KAGE_LogMessage(0x10,GHIDRA_CAST("id out of bounds\n")); - } - fVar5 = 1.0; - } - *GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._layerFrames) + layerId * 4)) = 0; - AnimationState::AdvanceLayerPosition(&(this->_sprite)._animState,layerId,fVar5); -LAB_005657ec: - fVar5 = (this->_posOffset).y; - layer2Height = fVar5; - layer1Height = fVar5; - if (1 < (this->_vectorDeque1)._size) { - segmentIndex = (this->_vectorDeque1)._offset + 1; - fVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + 4 + - (segmentIndex & 1) * 8)); - fVar1 = (this->_v1).y; - pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x2)); - (pLVar3->_pos).x = 0.0; - (pLVar3->_pos).y = (fVar4 - fVar1) * 0.65; - layer1 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - (layer1->_pos).x = (pLVar3->_pos).x; - (layer1->_pos).y = (pLVar3->_pos).y; - segmentIndex = (this->_vectorDeque1)._offset + 1; - layer1Height = (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) - + 4 + (segmentIndex & 1) * 8)) + (this->_posOffset).y) - (this->_v1).y - ; - layer2Height = layer1Height; - if (2 < (this->_vectorDeque1)._size) { - segmentIndex = (this->_vectorDeque1)._offset + 2; - fVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + 4 + - (segmentIndex & 1) * 8)); - fVar1 = (this->_v1).y; - pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x2)); - (pLVar3->_pos).x = 0.0; - (pLVar3->_pos).y = (fVar4 - fVar1) * 0.65; - segment2Index = (this->_vectorDeque1)._offset; - segmentIndex = segment2Index + 1; - segment2Index = segment2Index + 2; - fVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & segment2Index >> 1) * 4)) + 4 - + (segment2Index & 1) * 8)); - segment1Y = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & segmentIndex >> 1) * 4)) + - 4 + (segmentIndex & 1) * 8)); - fVar1 = *segment1Y; - fVar2 = *segment1Y; - pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x2)); - pLVar3->_flipY = fVar2 <= fVar4 && fVar4 != fVar1; - segmentIndex = (this->_vectorDeque1)._offset + 2; - fVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & segmentIndex >> 1) * 4)) + - (segmentIndex & 1) * 8)); - pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x2)); - pLVar3->_flipX = 0.0 < fVar4; - segmentIndex = (this->_vectorDeque1)._offset + 2; - if (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - (segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + - (segmentIndex & 1) * 8)) <= 0.0) { - fVar4 = 3.0; - } - else { - fVar4 = -3.0; - } - pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x2)); - (pLVar3->_pos).x = fVar4; - segmentIndex = (this->_vectorDeque1)._offset + 2; - layer2Height = (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((this->_vectorDeque1)._map) + - ((this->_vectorDeque1)._mapSize - 1 & segmentIndex >> 1) * - 4)) + 4 + (segmentIndex & 1) * 8)) + (this->_posOffset).y) - - (this->_v1).y; - } - } - sprite = &this->_sprite; - pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST(0x0)); - if (renderMode == 5) { - fVar5 = (fVar5 - 2.0) / 78.0; - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - (pLVar3->_color)._tint[3] = 1.0 - fVar5; - pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST(0x1)); - fVar5 = (layer1Height - 2.0) / 78.0; - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - (pLVar3->_color)._tint[3] = 1.0 - fVar5; - pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST(0x2)); - fVar5 = (layer2Height - 2.0) / 78.0; - } - else { - fVar5 = (fVar5 - -2.0) / 18.0; - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - (pLVar3->_color)._tint[3] = 1.0 - fVar5; - pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST(0x1)); - fVar5 = (layer1Height - -2.0) / 18.0; - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - (pLVar3->_color)._tint[3] = 1.0 - fVar5; - pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST(0x2)); - fVar5 = (layer2Height - -2.0) / 18.0; - } - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - (pLVar3->_color)._tint[3] = 1.0 - fVar5; - return; -} - -// 0059bed0 -void Entity_NPC::RenderSegmentLink(Vector *offset, uint8_t isShadow) -{ - Color *extraout_EAX; - Color *baseColor; - float fVar1; - float stretch; - double dVar2; - uint8_t auStack_f4 [40]; - float local_cc; - float local_c8; - float local_c4; - float local_c0; - float local_bc; - Vector beamPoint; - float local_b0; - float local_ac; - float local_a8; - float local_a4; - float beamLength; - ColorMod linkColor; - Color tmpColor; - uint32_t local_44; - int child; - int childI2; - - local_44 = __security_cookie ^ GHIDRA_UINT(auStack_f4); - child = this->_child; - if ((child != 0) && - (((childI2 = *GHIDRA_CAST((child + 0xbc4)), childI2 != 0 || (this->_i2 != 0)) && - (1 < GHIDRA_UINT((this->_sprite)._layerCount))))) { - if (isShadow == 0) { - (GHIDRA_CAST((&tmpColor)))->Color::Color(); - baseColor = extraout_EAX; - } - else { - tmpColor._offset[0] = 0.0; - tmpColor._colorize[0] = 0.0; - tmpColor._colorize[1] = 0.0; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 0.0; - baseColor = &tmpColor; - tmpColor._offset[1] = 0.0; - tmpColor._offset[2] = 0.0; - tmpColor._tint[0] = 0.0; - tmpColor._tint[1] = 0.0; - tmpColor._tint[2] = 0.0; - tmpColor._tint[3] = 1.0; - } - linkColor._tint[0] = baseColor->_tint[0]; - linkColor._tint[1] = baseColor->_tint[1]; - linkColor._tint[2] = baseColor->_tint[2]; - linkColor._tint[3] = baseColor->_tint[3]; - linkColor._colorize[0] = baseColor->_colorize[0]; - linkColor._colorize[1] = baseColor->_colorize[1]; - linkColor._colorize[2] = baseColor->_colorize[2]; - linkColor._colorize[3] = baseColor->_colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(linkColor._offset)) + 0x0))) = *GHIDRA_CAST(baseColor->_offset); - local_c0 = g_displayPixelRatio * g_screenPointScale; - linkColor._offset[2] = baseColor->_offset[2]; - local_c8 = (g_screenWidth - 338.0) * 0.5; - local_b0 = (g_screenHeight - 182.0) * 0.5; - local_cc = (((this->_pos).x - 60.0) * 0.65 + local_c8) * local_c0 + 0.5; - dVar2 = floor((double)local_cc); - local_c4 = (float)dVar2 / local_c0; - local_cc = (((this->_pos).y - 140.0) * 0.65 + local_b0) * local_c0 + 0.5; - dVar2 = floor((double)local_cc); - local_a8 = (float)dVar2 / local_c0; - local_bc = offset->x; - local_cc = local_bc + local_c4; - local_c4 = offset->y; - local_c8 = ((*GHIDRA_CAST((child + 0x33c)) - 60.0) * 0.65 + local_c8) * local_c0 + 0.5; - dVar2 = floor((double)local_c8); - local_ac = (float)dVar2 / local_c0; - local_c8 = ((*GHIDRA_CAST((child + 0x340)) - 140.0) * 0.65 + local_b0) * local_c0 + 0.5; - dVar2 = floor((double)local_c8); - local_c8 = (float)dVar2; - fVar1 = local_c8 / local_c0; - local_c0 = (local_c4 + local_a8) - 6.0; - local_c4 = (local_c4 + fVar1) - 6.0; - if (this->_i2 == 0) { - local_c0 = local_c0 - 18.0; - } - if (childI2 == 0) { - local_c4 = local_c4 - 18.0; - } - local_bc = (local_bc + local_ac) - local_cc; - local_c4 = local_c4 - local_c0; - fVar1 = sqrtf(local_bc * local_bc + local_c4 * local_c4); - if (0.0 < fVar1) { - local_c4 = local_c4 * (1.0 / fVar1); - local_bc = local_bc * (1.0 / fVar1); - } - beamLength = fVar1 - 6.0; - if (6.0 <= beamLength) { - DAT_00c78ef0 = &this->_sprite; - g_beamRendererPointsEnd = g_beamRendererPoints; - stretch = (fVar1 - 20.0) / 70.0; - DAT_00c78ef4 = 1; - (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c78ef8)) + 0x0))) = 0x100; - fVar1 = (beamLength - 6.0) * 0.15; - local_ac = (beamLength - 6.0) * 0.5 + 6.0; - local_a4 = 30.0; - if (fVar1 <= 30.0) { - local_a4 = fVar1; - } - if (stretch <= 0.0) { - stretch = 0.0; - } - local_a8 = local_a4 + 6.0; - if (1.0 <= stretch) { - stretch = 1.0; - } - local_a4 = beamLength - local_a4; - local_c8 = 1.0 - stretch * 0.6; - local_b0 = 1.0 - (1.0 - local_c8) * (1.0 - local_c8); - beamPoint.x = local_bc * 6.0 + local_cc; - beamPoint.y = local_c4 * 6.0 + local_c0; - BeamRenderer::Add(&beamPoint,&linkColor,1.0,0.0); - beamPoint.x = local_bc * local_a8 + local_cc; - beamPoint.y = local_c4 * local_a8 + local_c0; - BeamRenderer::Add(&beamPoint,&linkColor,local_b0,0.33); - beamPoint.x = local_bc * local_ac + local_cc; - beamPoint.y = local_c4 * local_ac + local_c0; - BeamRenderer::Add(&beamPoint,&linkColor,local_c8,0.5); - beamPoint.x = local_bc * local_a4 + local_cc; - beamPoint.y = local_c4 * local_a4 + local_c0; - BeamRenderer::Add(&beamPoint,&linkColor,local_b0,0.66); - beamPoint.x = local_bc * beamLength + local_cc; - beamPoint.y = local_c4 * beamLength + local_c0; - BeamRenderer::Add(&beamPoint,&linkColor,1.0,1.0); - BeamRenderer::End(); - } - } - return; -} - -// 0059e390 -void Entity_NPC::CreateBling() -{ - uint32_t rngResult; - Entity *spawned; - Entity_Effect *bling; - uint32_t rngResult; - TypeDescriptor *pTVar2; - TypeDescriptor *pTVar3; - uint32_t uVar4; - uint8_t texelColor [12]; - float texelAlpha; - float offsetX; - float sampleY; - float offsetY; - - rngResult = Random(); - offsetY = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 - 1.0) * 187.5; - rngResult = Random(); - offsetX = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 - 0.5) * 125.0; - sampleY = offsetY; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetTexel(texelColor,offsetX,offsetY,g_vectorZero.x,g_vectorZero.y - ,0x3f666666,0xffffffff); - if (1.0 <= texelAlpha) { - rngResult = Random(); - uVar4 = 0; - pTVar3 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar2 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - rngResult = 0; - spawned = Game::Spawn(g_game,1000,0x67,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,rngResult); - bling = GHIDRA_CAST(__RTDynamicCast(spawned,rngResult,pTVar2,pTVar3,uVar4)); - (bling->_sprite)._offset.x = offsetX; - bling->_renderZOffset = 1000; - (bling->_sprite)._offset.y = offsetY; - } - return; -} - -// 0059e4c0 -void Entity_NPC::CreateGoldParticles(uint32_t count) -{ - uint32_t rngResult; - uint8_t texelColor [12]; - float texelAlpha; - Vector particlePos; - float sampleX; - float sampleY; - float offsetX; - float offsetY; - ColorMod particleColor; - uint32_t local_c; - uint8_t auStack_8 [4]; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - for (; count != 0; count = count - 1) { - rngResult = Random(); - offsetY = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 - 1.0) * 187.5; - rngResult = Random(); - sampleX = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 - 0.5) * 125.0; - sampleY = offsetY; - offsetX = sampleX; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetTexel(texelColor,sampleX,offsetY,g_vectorZero.x, - g_vectorZero.y,0x3f666666,0xffffffff); - if (1.0 <= texelAlpha) { - particleColor._tint[0] = 1.0; - particleColor._tint[1] = 1.0; - particleColor._tint[2] = 1.0; - particleColor._tint[3] = 1.0; - particleColor._offset[0] = 0.0; - particleColor._offset[1] = 0.0; - particleColor._colorize[0] = 0.0; - particleColor._colorize[1] = 0.0; - particleColor._colorize[2] = 0.0; - particleColor._colorize[3] = 0.0; - particlePos.x = offsetX + (this->_pos).x; - particleColor._offset[2] = 0.0; - particlePos.y = (this->_pos).y; - Game::SpawnParticles(g_game,&particlePos,0x5f,7,12.0,&particleColor,offsetY,0); - } - } - return; -} - -// 0060d140 -void Entity_NPC::set_entity_ptr_f54(Entity *entity) -{ - uint8_t *entityRef; - Entity *newEntity; - - newEntity = entity; - entityRef = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54))); - if (*GHIDRA_CAST(entityRef) != entity) { - if (*GHIDRA_CAST(entityRef) != GHIDRA_CAST(0x0)) { - entity = GHIDRA_CAST(entityRef); - msvc::multiset::erase(&entity); - } - *GHIDRA_CAST(entityRef) = newEntity; - if (newEntity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(entityRef); - } - } - return; -} - -// 006a8230 -int Entity_NPC::GetChampionColorIdx() -{ - return this->_championColorIdx; -} - -// 006a8240 -void Entity_NPC::ResetPathFinderTarget() -{ - (this->_pathfinder)._movementTarget.x = g_vectorZero.x; - (this->_pathfinder)._movementTarget.y = g_vectorZero.y; - (this->_pathfinder)._moveDirection.x = g_vectorZero.x; - (this->_pathfinder)._moveDirection.y = g_vectorZero.y; - return; -} - -// 006b5e20 -void Entity_NPC::hold_set(int countdown, Vector *position) -{ - int *longerCountdown; - - longerCountdown = &countdown; - if (countdown < this->_holdCountdown) { - longerCountdown = &this->_holdCountdown; - } - this->_holdCountdown = *longerCountdown; - (this->_holdPosition).x = position->x; - (this->_holdPosition).y = position->y; - return; -} - -// 006b64d0 -Entity_Effect * Entity_NPC::MakeSplat(float size) -{ - uint32_t seed; - Entity *spawned; - Entity_Effect *splat; - int vtable; - - seed = Random(); - spawned = Game::SpawnEx(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,seed,0); - splat = (Entity_Effect *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); - vtable = *GHIDRA_CAST(splat); - (splat->_sprite)._scale.x = size; - (splat->_sprite)._scale.y = size; - (**(code **)(vtable + 0xc))(); - return splat; -} - -// 006b6830 -Entity_Effect * Entity_NPC::MakeBloodCloud(Vector *pos, ColorMod *color) -{ - uint32_t rngResult; - Entity_Effect *cloud; - float in_XMM2_Da; - int vtable; - - rngResult = Random(); - cloud = (Entity_Effect *) - Game::Spawn(g_game,1000,0x10,pos,&g_vectorZero,GHIDRA_CAST(this),5,rngResult); - vtable = *GHIDRA_CAST(cloud); - (cloud->_sprite)._scale.x = in_XMM2_Da; - (cloud->_sprite)._scale.y = in_XMM2_Da; - (**(code **)(vtable + 0x3c))(color,0xffffffff,0xff,0,1); - rngResult = Random(); - (cloud->_sprite)._flipX = ~(uint8_t)rngResult & 1; - rngResult = Random(); - (cloud->_sprite)._flipY = ~(uint8_t)rngResult & 1; - cloud->Update(); - return cloud; -} - -// 006b8450 -uint8_t Entity_NPC::CanShutDoors() -{ - uint32_t in_EAX; - - if ((this->_canShutDoors == 0) || (in_EAX = GHIDRA_UINT(this->_flags) & 0x20000000, in_EAX != 0)) { - return in_EAX & 0xffffff00; - } - return 1; -} - -// 006b8470 -uint8_t Entity_NPC::IsBoss() -{ - return this->_isBoss; -} - -// 006b8480 -uint8_t Entity_NPC::IsChampion() -{ - return this->_isChampion; -} - -// 006b8590 -void Entity_NPC::Constructor() -{ - int *containerProxy; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - std_deque *deque; - uint8_t *extraDeque; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afa52f; - local_10 = ExceptionList; - ExceptionList = &local_10; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - local_8 = 0; - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_NPC::vftable; - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Init(GHIDRA_CAST(this)); - (this->_killDamageEvents)._begin = (void *)0x0; - (this->_killDamageEvents)._end = (void *)0x0; - (this->_killDamageEvents)._capacity = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 2; - deque = &this->_entityDeque; - (this->_v1).y = 0.0; - (this->_v1).x = 0.0; - (this->_v2).y = 0.0; - (this->_v2).x = 0.0; - this->_deliriumCycleID = 0; - this->_deliriumCycleIDHigh = 0; - deque->_proxy = (void *)0x0; - (this->_entityDeque)._map = (void *)0x0; - (this->_entityDeque)._mapSize = 0; - (this->_entityDeque)._offset = 0; - (this->_entityDeque)._size = 0; - containerProxy = operator_new(8); - containerProxy[1] = 0; - deque->_proxy = containerProxy; - *containerProxy = GHIDRA_INT(deque); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 3; - deque = &this->_vectorDeque1; - deque->_proxy = (void *)0x0; - (this->_vectorDeque1)._map = (void *)0x0; - (this->_vectorDeque1)._mapSize = 0; - (this->_vectorDeque1)._offset = 0; - (this->_vectorDeque1)._size = 0; - containerProxy = operator_new(8); - containerProxy[1] = 0; - deque->_proxy = containerProxy; - *containerProxy = GHIDRA_INT(deque); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 4; - deque = &this->_vectorDeque2; - deque->_proxy = (void *)0x0; - (this->_vectorDeque2)._map = (void *)0x0; - (this->_vectorDeque2)._mapSize = 0; - (this->_vectorDeque2)._offset = 0; - (this->_vectorDeque2)._size = 0; - containerProxy = operator_new(8); - containerProxy[1] = 0; - deque->_proxy = containerProxy; - *containerProxy = GHIDRA_INT(deque); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 5; - extraDeque = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc48))); - (this->_confusionTargetPos).y = 0.0; - (this->_confusionTargetPos).x = 0.0; - *GHIDRA_CAST(extraDeque) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc4c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc50)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc54)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc58)))) = 0; - containerProxy = operator_new(8); - containerProxy[1] = 0; - *GHIDRA_CAST(extraDeque) = containerProxy; - *containerProxy = GHIDRA_INT(extraDeque); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 6; - (this->_floorColor)._tint[0] = 1.0; - (this->_floorColor)._tint[1] = 1.0; - (this->_floorColor)._tint[2] = 1.0; - (this->_floorColor)._tint[3] = 1.0; - (this->_floorColor)._colorize[0] = 0.0; - (this->_floorColor)._colorize[1] = 0.0; - (this->_floorColor)._colorize[2] = 0.0; - (this->_floorColor)._colorize[3] = 0.0; - (this->_floorColor)._offset[0] = 0.0; - (this->_floorColor)._offset[1] = 0.0; - (this->_floorColor)._offset[2] = 0.0; - (this->_dirtColor)._tint[0] = 1.0; - (this->_dirtColor)._tint[1] = 1.0; - (this->_dirtColor)._tint[2] = 1.0; - (this->_dirtColor)._tint[3] = 1.0; - (this->_dirtColor)._colorize[0] = 0.0; - (this->_dirtColor)._colorize[1] = 0.0; - (this->_dirtColor)._colorize[2] = 0.0; - (this->_dirtColor)._colorize[3] = 0.0; - (this->_dirtColor)._offset[0] = 0.0; - (this->_dirtColor)._offset[1] = 0.0; - (this->_dirtColor)._offset[2] = 0.0; - ANM2::constructor(&this->_statusEffectSprite); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),7); - ANM2::constructor(&this->_chargeBarSprite); - (this->_hitList)._begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - (this->_secondaryHitList)._begin = (void *)0x0; - (this->_secondaryHitList)._end = (void *)0x0; - (this->_secondaryHitList)._capacity = (void *)0x0; - this->_pickupGhostsEntity = (void *)0x0; - (this->_controllerMovement).y = 0.0; - (this->_controllerMovement).x = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54)))) = 0; - (this->_forwardVector).y = 0.0; - (this->_forwardVector).x = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf5c))) = 0; - ExceptionList = local_10; - return; -} - -// 006b8b20 -void Entity_NPC::Init(int type, int variant, int subType, uint32_t initSeed) -{ - float fVar1; - uint32_t zeroColor [8]; - uint32_t local_14; - uint32_t uStack_10; - uint32_t local_c; - void **eraseRef; - uint8_t *field4Ref; - void **pickupGhostRef; - int *roomBossCount; - - this->_isChampion = 0; - pickupGhostRef = &this->_pickupGhostsEntity; - this->_championColorIdx = -1; - this->_flickerTimer = 0; - this->_flickerState = 0; - this->_flickerAlpha = 1.0; - this->_championSpeed = 1.0; - this->_bosscoloridx = -1; - this->_isUnreachableOnce = 0; - this->_scale = 1.0; - this->_shieldStrength = 0.0; - this->_shieldFrames = 0x78; - this->_deliriumBossType = 0; - this->_deliriumBossVariant = 0; - this->_deliriumTransformationTimer = 0; - this->_deliriumRemainingAttacks = 0; - this->_deliriumState = 0; - this->_deliriumEntity = (void *)0x0; - this->_isBestiaryEncountered = 0; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf5c))) = 0; - this->_aiCallFlags = 0; - this->_controllerID = -1; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c))) = 0; - (this->_controllerMovement).x = g_vectorZero.x; - (this->_controllerMovement).y = g_vectorZero.y; - this->_aimTargetEffect = (void *)0x0; - (this->_forwardVector).x = g_vectorZero.x; - (this->_forwardVector).y = g_vectorZero.y; - this->_forcedTarget = 0; - this->_forcedTargetTimer = 0; - this->_sirenPlayerEntity = (void *)0x0; - this->_hitPointsMulti = 1.0; - this->_scaleMulti = 1.0; - this->_lastGridIndex = -1; - if (*pickupGhostRef != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*pickupGhostRef) + 0x28))(); - if (*pickupGhostRef != (void *)0x0) { - eraseRef = pickupGhostRef; - msvc::multiset::erase(&eraseRef); - *pickupGhostRef = (void *)0x0; - } - } - field4Ref = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))) + 0x28))(); - if (*GHIDRA_CAST(field4Ref) != 0) { - eraseRef = (void **)field4Ref; - msvc::multiset::erase(&eraseRef); - *GHIDRA_CAST(field4Ref) = 0; - } - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54)))) != 0) { - eraseRef = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54))); - msvc::multiset::erase(&eraseRef); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54)))) = 0; - } - (this->_killDamageEvents)._end = (this->_killDamageEvents)._begin; - this->_killDamage = 0.0; - *GHIDRA_CAST(&this->_killDamageFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_killDamageFlags) + 4)) = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Init(type,variant,subType,initSeed); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 4; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - this->_state = 1; - this->_savedState = 0; - this->_aiCallPhase = 0; - this->_stateFrame = 0; - this->_aiCounter = 0; - this->_appearFrames = 0; - this->_decoyTargetTimer = 0; - this->_groupIdx = -1; - (this->_targetPosition).x = g_vectorZero.x; - (this->_targetPosition).y = g_vectorZero.y; - (this->_confusionTargetPos).x = g_vectorZero.x; - (this->_confusionTargetPos).y = g_vectorZero.y; - this->_aiFloat = 1.0; - (this->_v1).x = g_vectorZero.x; - (this->_v1).y = g_vectorZero.y; - (this->_v2).x = g_vectorZero.x; - (this->_v2).y = g_vectorZero.y; - this->_championRegenTimer = 0; - this->_championRegenCount = 0; - this->_holdCountdown = 0; - this->_i1 = 0; - this->_i2 = 0; - this->_entityRef = 0; - this->_projectileCooldown = 0; - this->_projectileDelay = -1; - this->_championTimer = 0; - (this->_holdPosition).x = g_vectorZero.x; - fVar1 = g_vectorZero.y; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc61)))) = 0; - local_14 = 0; - uStack_10 = 0; - local_c = 0; - (this->_holdPosition).y = fVar1; - if (&this->_floorColor != GHIDRA_CAST(zeroColor)) { - (this->_floorColor)._colorize[0] = 0.0; - (this->_floorColor)._colorize[1] = 0.0; - (this->_floorColor)._colorize[2] = 0.0; - (this->_floorColor)._colorize[3] = 0.0; - (this->_floorColor)._offset[0] = 0.0; - (this->_floorColor)._offset[1] = 0.0; - (this->_floorColor)._tint[0] = 0.0; - (this->_floorColor)._tint[1] = 0.0; - (this->_floorColor)._tint[2] = 0.0; - (this->_floorColor)._tint[3] = 0.0; - (this->_floorColor)._offset[2] = 0.0; - } - (this->_hitList)._end = (this->_hitList)._begin; - (this->_secondaryHitList)._end = (this->_secondaryHitList)._begin; - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Reset(); - if (this->_isBoss != 0) { - roomBossCount = GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7224)); - *roomBossCount = *roomBossCount + 1; - } - this->_totalDamageTaken = 0.0; - FUN_00860880(this); - return; -} - -// 006b8f00 -void Entity_NPC::Remove() -{ - if (((this->_type == 0x362) && (this->_variant == 0)) && (GHIDRA_CAST(this->_child) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_child) + 0x28))(); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Remove(); - return; -} - -// 006b8f30 -void Entity_NPC::ClearReferences() -{ - Entity_Familiar *childField; - uint64_t qVar2; - Entity_NPC *childNpc; - int iVar3; - void *pvVar4; - uint32_t uVar5; - uint64_t *allocatedBytes; - uint32_t *childParentField; - EntityList_EL familiars; - Entity_NPC *local_1c; - uint32_t *local_18; - uint32_t *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - void **aimTargetField; - uint32_t *childField; - float childHealth; - float childMaxHp; - uint32_t flagsHigh; - Game *game; - std_vector *hitList; - void *oldData; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af341d; - local_10 = ExceptionList; - ExceptionList = &local_10; - iVar3 = this->_type; - if (iVar3 == 0x3c6) { - childField = GHIDRA_CAST(this->_target); - if (((childField != GHIDRA_CAST(0x0)) && (childField->_type == 3)) && - ((childField->_flags & 0x100) != 0)) { - (GHIDRA_CAST((childField)))->Entity_Familiar::RemoveFromPlayer(); - iVar3 = this->_type; - goto LAB_006b8f98; - } - } - else { -LAB_006b8f98: - if (iVar3 == 0x38b) { - iVar3 = this->_child; - childField = &this->_child; - if (iVar3 != 0) { - childParentField = GHIDRA_CAST((iVar3 + 0x3bc)); - local_18 = GHIDRA_CAST(this->_parent); - if (*GHIDRA_CAST((iVar3 + 0x3bc)) != 0) { - local_14 = childParentField; - msvc::multiset::erase(&local_14); - } - *childParentField = local_18; - if (local_18 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(childParentField); - } - } - iVar3 = this->_parent; - childParentField = &this->_parent; - if (iVar3 != 0) { - local_14 = GHIDRA_CAST((iVar3 + 0x3c0)); - local_1c = GHIDRA_CAST(*childField); - if (*GHIDRA_CAST((iVar3 + 0x3c0)) != 0) { - local_18 = local_14; - msvc::multiset::erase(&local_18); - } - *local_14 = local_1c; - if (local_1c != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(local_14); - } - } - if ((*childParentField == 0) && (childNpc = ChildNPC(this), childNpc != GHIDRA_CAST(0x0))) { - local_1c = ChildNPC(this); - game = g_game; - childMaxHp = local_1c->_maxHitPoints; - childHealth = local_1c->_health; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_hud))) + 0x54ba)))) = (short)GHIDRA_INT(childMaxHp); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_hud))) + 0x54b8)))) = (short)GHIDRA_INT(((childMaxHp - childHealth) + 1.0)); - uVar5 = GHIDRA_UINT(local_1c->_flags); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&local_1c->_flags) + 4)); - *GHIDRA_CAST(&local_1c->_flags) = uVar5 & 0x7fffffff; - *GHIDRA_CAST((GHIDRA_INT(&local_1c->_flags) + 4)) = flagsHigh; - if (this->_subtype == 0) { - *GHIDRA_CAST((GHIDRA_INT(&local_1c->_flags) + 4)) = flagsHigh; - *GHIDRA_CAST(&local_1c->_flags) = uVar5 & 0x7fefffff; - } - (GHIDRA_CAST((GHIDRA_CAST(local_1c))))->Entity::SetVisibleFlag(1); - } - if (*childParentField != 0) { - local_1c = GHIDRA_CAST(childParentField); - msvc::multiset::erase(&local_1c); - } - *childParentField = 0; - if (*childField != 0) { - local_1c = GHIDRA_CAST(childField); - msvc::multiset::erase(&local_1c); - } - iVar3 = this->_type; - *childField = 0; - } - if ((iVar3 == 0x390) && ((this->_variant == 0 || (this->_variant == 10)))) { - SFXManager::Stop(&g_manager->_sfxManager,0x280); - SFXManager::Stop(&g_manager->_sfxManager,0x1b8); - } - } - if (this->_pickupGhostsEntity != (void *)0x0) { - local_1c = GHIDRA_CAST(&this->_pickupGhostsEntity); - msvc::multiset::erase(&local_1c); - this->_pickupGhostsEntity = (void *)0x0; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54)))) != 0) { - local_1c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54)))); - msvc::multiset::erase(&local_1c); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf54)))) = 0; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))) != 0) { - local_1c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))); - msvc::multiset::erase(&local_1c); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))) = 0; - } - if (this->_entityRef != 0) { - local_1c = GHIDRA_CAST(&this->_entityRef); - msvc::multiset::erase(&local_1c); - } - this->_entityRef = 0; - aimTargetField = &this->_aimTargetEffect; - if (*aimTargetField != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*aimTargetField) + 0x28))(); - } - if (*aimTargetField != (void *)0x0) { - local_1c = GHIDRA_CAST(aimTargetField); - msvc::multiset::erase(&local_1c); - } - *aimTargetField = (void *)0x0; - ClearDequeRefs(this); - if (this->_forcedTarget != 0) { - local_1c = GHIDRA_CAST(&this->_forcedTarget); - msvc::multiset::erase(&local_1c); - } - this->_forcedTarget = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - msvc::deque::_Tidy(); - msvc::deque::_Tidy(); - msvc::deque::_Tidy(); - ANM2::Reset(&this->_statusEffectSprite); - ANM2::Reset(&this->_chargeBarSprite); - hitList = &this->_hitList; - if (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4)))) != hitList) { - oldData = hitList->_begin; - pvVar4 = (this->_hitList)._capacity; - hitList->_begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - if (oldData != (void *)0x0) { - uVar5 = GHIDRA_INT(pvVar4) - GHIDRA_INT(oldData) & 0xfffffffc; - pvVar4 = oldData; - if (0xfff < uVar5) { - pvVar4 = *(void **)(GHIDRA_CAST(oldData) + -4); - uVar5 = uVar5 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(oldData) + (-4 - GHIDRA_INT(pvVar4))))) goto LAB_006b93e7; - } - operator_delete(pvVar4,uVar5); - } - } - hitList = &this->_secondaryHitList; - if (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4)))) != hitList) { - oldData = hitList->_begin; - pvVar4 = (this->_secondaryHitList)._capacity; - hitList->_begin = (void *)0x0; - (this->_secondaryHitList)._end = (void *)0x0; - (this->_secondaryHitList)._capacity = (void *)0x0; - if (oldData != (void *)0x0) { - uVar5 = GHIDRA_INT(pvVar4) - GHIDRA_INT(oldData) & 0xfffffffc; - pvVar4 = oldData; - if (0xfff < uVar5) { - pvVar4 = *(void **)(GHIDRA_CAST(oldData) + -4); - uVar5 = uVar5 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(oldData) + (-4 - GHIDRA_INT(pvVar4))))) { -LAB_006b93e7: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar4,uVar5); - } - } - if (this->_sirenPlayerEntity != (void *)0x0) { - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,0,0); - local_8 = 0; - uVar5 = 0; - if (familiars._size != 0) { - do { - childField = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + uVar5 * 4)); - if (((childField != GHIDRA_CAST(0x0)) && (childField->_type == 3)) && - (childField->_player == this->_sirenPlayerEntity)) { - (GHIDRA_CAST((childField)))->Entity_Familiar::RemoveFromPlayer(); - } - uVar5 = uVar5 + 1; - } while (uVar5 < GHIDRA_UINT(familiars._size)); - } - (**(code **)(*GHIDRA_CAST(this->_sirenPlayerEntity) + 0x44))(); - if (this->_sirenPlayerEntity != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_sirenPlayerEntity))(1); - this->_sirenPlayerEntity = (void *)0x0; - } - local_8 = 0xffffffff; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) != 0) { - uVar5 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - qVar2 = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar5; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar5)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - } - local_8 = 0xffffffff; - } - } - if ((this->_type == 0x387) && (this->_variant == 10)) { - SFXManager::Stop(&g_manager->_sfxManager,0x1f7); - } - ExceptionList = local_10; - return; -} - -// 006b9910 -uint8_t Entity_NPC::TryForceTarget(Entity *Target, int Duration) -{ - float newTargetDy; - float fVar1; - float fVar2; - float newTargetDx; - Entity_NPC *local_c [2]; - Entity *currentTarget; - uint32_t *forcedTargetRef; - - if (this->_forcedTargetTimer < 0) { - return 0; - } - currentTarget = GHIDRA_CAST(this->_forcedTarget); - forcedTargetRef = &this->_forcedTarget; - if (currentTarget == GHIDRA_CAST(0x0)) { - if (Target == GHIDRA_CAST(0x0)) goto LAB_006b99c8; - } - else { - if (currentTarget == Target) goto LAB_006b99c8; - fVar1 = (this->_pos).x; - fVar2 = (this->_pos).y; - newTargetDx = fVar1 - (Target->_pos).x; - fVar1 = fVar1 - (currentTarget->_pos).x; - newTargetDy = fVar2 - (Target->_pos).y; - fVar2 = fVar2 - (currentTarget->_pos).y; - if (fVar2 * fVar2 + fVar1 * fVar1 <= newTargetDy * newTargetDy + newTargetDx * newTargetDx) { - return 0; - } - } - local_c[0] = this; - if (currentTarget != GHIDRA_CAST(0x0)) { - local_c[0] = GHIDRA_CAST(forcedTargetRef); - msvc::multiset::erase(local_c); - } - *forcedTargetRef = Target; - if (Target != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(forcedTargetRef); - } -LAB_006b99c8: - this->_forcedTargetTimer = Duration; - return 1; -} - -// 006b99e0 -float Entity_NPC::compute_speed_multiplier() -{ - uint64_t qVar1; - char cVar2; - uint8_t isHasEffect; - TemporaryEffects *roomTempEffects; - void *pvVar3; - uint32_t uVar4; - float fVar5; - float local_10; - Game *game; - - local_10 = (GHIDRA_CAST((g_game->_room)))->Room::GetTimeScale(GHIDRA_CAST(this),GHIDRA_CAST(this)); - game = g_game; - qVar1 = this->_flags; - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if ((qVar1 & 0x20000000) == 0) { - roomTempEffects = GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)); - isHasEffect = (GHIDRA_CAST((roomTempEffects)))->TemporaryEffects::HasCollectibleEffect(0xe8); - if ((isHasEffect == 0) && - ((game->_challenge == 0x16 || (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1210)) != 1)))) { - pvVar3 = (GHIDRA_CAST((roomTempEffects)))->TemporaryEffects::GetCollectibleEffect(0x42); - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if (pvVar3 != (void *)0x0) { - fVar5 = ((float)*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 8)) - 0.0) / 30.0; - if (fVar5 <= 0.0) { - fVar5 = 0.0; - } - if (1.0 <= fVar5) { - fVar5 = 1.0; - } - local_10 = (1.0 - fVar5 * 0.5) * local_10; - } - } - else { - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - local_10 = local_10 * 0.5; - } - } - else if (0 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x722c))) { - local_10 = local_10 * 0.5; - } - if (((qVar1 & 0x80) != 0) && (this->_state != 0x12)) { - local_10 = local_10 * 0.5; - } - if ((uVar4 & 0x400000) != 0) { - local_10 = local_10 * 0.65; - } - cVar2 = this->IsBoss(); - if (((cVar2 == '\0') || ((this->_flags & 0x20000000) != 0)) || - (isHasEffect = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)),0x2b9), - isHasEffect == 0)) { - return local_10; - } - return local_10 * 0.75; -} - -// 006baf40 -void Entity_NPC::load_graphics(uint8_t param_2) -{ - uint32_t uVar1; - std_string **ppsVar2; - uint8_t isChampionColored; - std_string *psVar4; - void **bossColorPath; - LayerState *layer; - uint8_t *suffixEnd; - ANM2 *sprite; - std_string *psVar5; - uint8_t *size; - void *freeBlock; - ColorMod *championColor; - uint32_t uVar6; - char *pcVar7; - uint32_t uVar8; - float r; - float in_XMM2_Da; - float in_XMM3_Da; - uint32_t local_118 [8]; - uint32_t local_f8; - uint32_t uStack_f4; - uint32_t local_f0; - Color local_ec; - Entity_NPC *self; - Sprite *layerSprite; - std_string *local_b8; - uint32_t local_b4; - uint8_t *layerIndex; - LayerState *local_ac; - uint8_t *local_a8; - uint32_t local_a4; - char isDirtColorNeeded; - char isChampionSheetUsed; - uint8_t local_9d; - std_string resolvedSheetPath; - std_string championSuffix; - std_string sheetOverridePath; - std_string local_54; - std_string layerString; - uint32_t local_24; - std_string **ppsStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - int bossColorPathSize; - Game *game; - bool isChampionColored; - int *spriteBitflags; - - ppsStack_20 = GHIDRA_CAST((GHIDRA_INT(&layerString) + 0x38)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00afa79f; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(&layerString) + 0x2cU; - ExceptionList = &local_1c; - uVar8 = 0; - local_b4 = 0; - self = this; - ppsVar2 = GHIDRA_CAST((GHIDRA_INT(&layerString) + 0x38)); - if (param_2 != 0) { - if (this->_bosscoloridx < 0) { -LAB_006bafec: - psVar4 = GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)); - } - else { - local_a8 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x68)); - if ((*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x6c)) - GHIDRA_INT(local_a8)) / 0x7c <= this->_bosscoloridx) - goto LAB_006bafec; - bossColorPathSize = this->_bosscoloridx * 0x7c; - if (*GHIDRA_CAST((local_a8 + bossColorPathSize + 0x54)) == 0) goto LAB_006bafec; - psVar4 = GHIDRA_CAST((local_a8 + bossColorPathSize + 0x44)); - } - ANM2::Load(&this->_sprite,psVar4,0); - local_ac = GHIDRA_CAST(&(g_game->_seedEffects)._seedEffects); - local_a8 = GHIDRA_CAST(0x4f); - msvc::set::find_node(local_54._buf + 0xc,&local_a8); - ppsVar2 = ppsStack_20; - if ((((*GHIDRA_CAST((local_54._capacity + 0xd)) == '\0') && - (*GHIDRA_CAST((local_54._capacity + 0x10)) < 0x50)) && - (GHIDRA_CAST(local_54._capacity) != local_ac->_layerData)) && - ((this->_type == 0x66 && (this->_variant == 1)))) { - local_54._size = 0; - local_54._capacity = 0xf; - local_54._buf[0] = '\0'; - local_54._buf[1] = '\0'; - local_54._buf[2] = '\0'; - local_54._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_54._buf)) + 0x0))) = msvc::_Allocate(0x40); - local_54._size = 0x35; - local_54._capacity = 0x3f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_54._buf))) + 0x0))), - "gfx/promo/gfuel/102.001_g baby (true final boss).anm2",0x36); - local_14 = 0; - ANM2::Load(&this->_sprite,&local_54,1); - local_14 = 0xffffffff; - if (0xf < local_54._capacity) { - uVar6 = local_54._capacity + 1; - pcVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_54._buf))) + 0x0))); - if (0xfff < uVar6) { - pcVar7 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_54._buf)) + 0x0))) + -4)); - uVar6 = local_54._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar7))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar7,uVar6); - } - local_54._size = 0; - local_54._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_54._buf)) + 0x0))) & 0xffffff00; - ppsVar2 = ppsStack_20; - } - } - ppsStack_20 = ppsVar2; - game = g_game; - sheetOverridePath._size = 0; - sheetOverridePath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(sheetOverridePath._buf)) + 0x0))) = (void *)0x0; - local_14 = 1; - if (this->_bosscoloridx < 0) { -LAB_006bb1b0: - if (*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0xcd)) != '\0') { - uVar8 = Level::GetStageID(); - (GHIDRA_CAST((resolvedSheetPath._buf)))->msvc::string::string(game->_ventricleRazorPortals + uVar8 * 0xc4 + 0x5e4); - uVar8 = 4; - sheetOverridePath._buf[0] = resolvedSheetPath._buf[0]; - sheetOverridePath._buf[1] = resolvedSheetPath._buf[1]; - sheetOverridePath._buf[2] = resolvedSheetPath._buf[2]; - sheetOverridePath._buf[3] = resolvedSheetPath._buf[3]; - sheetOverridePath._buf[4] = resolvedSheetPath._buf[4]; - sheetOverridePath._buf[5] = resolvedSheetPath._buf[5]; - sheetOverridePath._buf[6] = resolvedSheetPath._buf[6]; - sheetOverridePath._buf[7] = resolvedSheetPath._buf[7]; - sheetOverridePath._buf[8] = resolvedSheetPath._buf[8]; - sheetOverridePath._buf[9] = resolvedSheetPath._buf[9]; - sheetOverridePath._buf[10] = resolvedSheetPath._buf[10]; - sheetOverridePath._buf[0xb] = resolvedSheetPath._buf[0xb]; - sheetOverridePath._buf[0xc] = resolvedSheetPath._buf[0xc]; - sheetOverridePath._buf[0xd] = resolvedSheetPath._buf[0xd]; - sheetOverridePath._buf[0xe] = resolvedSheetPath._buf[0xe]; - sheetOverridePath._buf[0xf] = resolvedSheetPath._buf[0xf]; - sheetOverridePath._size = resolvedSheetPath._size; - sheetOverridePath._capacity = resolvedSheetPath._capacity; - } - } - else { - local_a8 = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x68)); - if ((*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x6c)) - GHIDRA_INT(local_a8)) / 0x7c <= this->_bosscoloridx) - goto LAB_006bb1b0; - bossColorPath = (void **)(local_a8 + this->_bosscoloridx * 0x7c + 0x2c); - if (&sheetOverridePath != GHIDRA_CAST(bossColorPath)) { - bossColorPathSize = GHIDRA_INT((bossColorPath + 4)); - if (0xf < bossColorPath[5]) { - bossColorPath = *bossColorPath; - } - (GHIDRA_CAST((sheetOverridePath._buf)))->msvc::string::assign(GHIDRA_CAST(bossColorPath),*GHIDRA_CAST(bossColorPathSize)); - } - } - r = 0.0; - isChampionSheetUsed = '\0'; - isDirtColorNeeded = '\0'; - if ((this->_isChampion == 0) || (0x19 < GHIDRA_UINT(this->_championColorIdx))) { - local_a8 = GHIDRA_CAST(0x0); -LAB_006bb24b: - isChampionColored = false; - } - else { - bossColorPathSize = this->_championColorIdx * 0x40; - local_a8 = &DAT_00c354c0 + bossColorPathSize; - if (local_a8 == GHIDRA_CAST(0x0)) goto LAB_006bb24b; - if (*GHIDRA_CAST((&DAT_00c354cc + bossColorPathSize)) <= 0.0) goto LAB_006bb24b; - isChampionColored = true; - } - championSuffix._size = 0; - pcVar7 = "_champion"; - championSuffix._capacity = 0xf; - if (!isChampionColored) { - pcVar7 = GHIDRA_CAST(&s_empty); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(championSuffix._buf)) + 0x0))) = (void *)0x0; - local_ac = GHIDRA_CAST((pcVar7 + 1)); - suffixEnd = GHIDRA_CAST(pcVar7); - do { - isChampionColored = *suffixEnd; - suffixEnd = suffixEnd + 1; - } while (isChampionColored != 0); - (GHIDRA_CAST((championSuffix._buf)))->msvc::string::assign(GHIDRA_CAST(pcVar7),GHIDRA_INT(suffixEnd) - GHIDRA_INT(local_ac)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - layerIndex = GHIDRA_CAST(0x0); - if ((this->_sprite)._layerCount == 0) { -LAB_006bb675: - championColor = &(this->_sprite)._championColor; - local_f8 = 0; - uStack_f4 = 0; - local_f0 = 0; - if (championColor != GHIDRA_CAST(local_118)) { - local_ec._offset[2] = 0.0; - (this->_sprite)._championColor._colorize[0] = 0.0; - (this->_sprite)._championColor._colorize[1] = 0.0; - (this->_sprite)._championColor._colorize[2] = 0.0; - (this->_sprite)._championColor._colorize[3] = 0.0; - local_ec._offset[0] = 0.0; - local_ec._offset[1] = 0.0; - championColor->_tint[0] = 0.0; - (this->_sprite)._championColor._tint[1] = 0.0; - (this->_sprite)._championColor._tint[2] = 0.0; - (this->_sprite)._championColor._tint[3] = 0.0; -LAB_006bb6be: - *GHIDRA_CAST(championColor->_offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec._offset)) + 0x0))); - championColor->_offset[2] = local_ec._offset[2]; - } - } - else { - sprite = &this->_sprite; - layerSprite = GHIDRA_CAST(sprite); - do { - layer = ANM2::GetLayer(sprite,layerIndex); - local_ac = layer; - if (layer->_layerData == (void *)0x0) { - layerString._size = 0; - layerString._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(layerString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((layerString._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); - } - local_b4 = uVar8 | 9; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 3; - psVar4 = &layerString; - if (0xf < layerString._capacity) { - psVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(layerString._buf))) + 0x0))); - } - local_b8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(layerString._buf))) + 0x0))); - local_a4 = local_b4; - isChampionColored = str_eq(GHIDRA_CAST(psVar4),layerString._size,&DAT_00b64428,4); - if (isChampionColored == 0) { - if (layer->_layerData == (void *)0x0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_54._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_54._capacity = GHIDRA_UINT(&DAT_0000000f); - local_54._size = 0; - } - else { - (GHIDRA_CAST((local_54._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); - } - psVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_54._buf))) + 0x0))); - local_a4 = uVar8 | 0x1b; - psVar5 = &local_54; - if (&DAT_0000000f < local_54._capacity) { - psVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_54._buf))) + 0x0))); - } - isChampionColored = str_eq(GHIDRA_CAST(psVar5),local_54._size,&DAT_00b1d57c,4); - if (isChampionColored != 0) goto LAB_006bb394; - local_9d = 0; - } - else { - psVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_54._buf))) + 0x0))); -LAB_006bb394: - local_9d = 1; - } - if ((local_a4 & 2) != 0) { - local_a4 = local_a4 & 0xfffffffd; - if (&DAT_0000000f < local_54._capacity) { - size = GHIDRA_CAST((local_54._capacity + 1)); - psVar5 = psVar4; - if (GHIDRA_CAST(0xfff) < size) { - psVar5 = GHIDRA_CAST(psVar4[-1]._capacity); - size = GHIDRA_CAST((local_54._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(psVar4) + (-4 - GHIDRA_INT(psVar5))))) goto LAB_006bb75e; - } - operator_delete(psVar5,GHIDRA_UINT(size)); - } - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))) = 0; - if ((local_a4 & 1) != 0) { - local_a4 = local_a4 & 0xfffffffe; - if (0xf < layerString._capacity) { - uVar8 = layerString._capacity + 1; - psVar4 = local_b8; - if (0xfff < uVar8) { - psVar4 = GHIDRA_CAST(local_b8[-1]._capacity); - uVar8 = layerString._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(local_b8) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_006bb75e; - } - operator_delete(psVar4,uVar8); - } - } - layer = local_ac; - if (local_9d != 0) { - local_ac->_bitflags = local_ac->_bitflags | 1; - isDirtColorNeeded = '\x01'; - } - local_a4 = local_a4 | 0x20; - if (local_ac->_layerData == (void *)0x0) { - layerString._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(layerString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - layerString._size = 0; - } - else { - (GHIDRA_CAST((layerString._buf)))->msvc::string::string((void *)(GHIDRA_INT(local_ac->_layerData) + 8)); - } - uVar1 = (*GHIDRA_CAST((GHIDRA_CAST(&(layerString._buf)) + 0x0))); - psVar4 = &layerString; - if (0xf < layerString._capacity) { - psVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(layerString._buf))) + 0x0))); - } - local_9d = str_eq(GHIDRA_CAST(psVar4),layerString._size,GHIDRA_CAST("Hole2"),5); - if (0xf < layerString._capacity) { - uVar8 = layerString._capacity + 1; - psVar4 = GHIDRA_CAST(uVar1); - if (0xfff < uVar8) { - psVar4 = GHIDRA_CAST((GHIDRA_CAST((uVar1 + -0x18)))->_capacity); - uVar8 = layerString._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((uVar1 + (-4 - GHIDRA_INT(psVar4))))) goto LAB_006bb75e; - } - operator_delete(psVar4,uVar8); - } - if (local_9d != 0) { - layer->_bitflags = layer->_bitflags | 1; - } - uVar8 = local_a4 | 0x40; - local_9d = 0; - if (layer->_layerData == (void *)0x0) { - layerString._capacity = 0xf; - layerString._size = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(layerString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((layerString._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 4; - anm2_resolve_spritesheet_path - (&resolvedSheetPath,&layerString,&sheetOverridePath,&championSuffix,&local_9d); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 6; - if (0xf < layerString._capacity) { - uVar6 = layerString._capacity + 1; - psVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(layerString._buf))) + 0x0))); - if (0xfff < uVar6) { - psVar4 = GHIDRA_CAST((GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(layerString._buf)) + 0x0))) + -0x18)))->_capacity); - uVar6 = layerString._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(layerString._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar4))))) - goto LAB_006bb75e; - } - operator_delete(psVar4,uVar6); - } - (GHIDRA_CAST((layerSprite)))->Sprite::ReplaceSpritesheet(GHIDRA_INT(layerIndex),&resolvedSheetPath); - if (local_9d == 0) { - uVar6 = layer->_bitflags & 0xffffffef; - } - else { - isChampionSheetUsed = '\x01'; - uVar6 = layer->_bitflags | 0x10; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - layer->_bitflags = uVar6; - if (0xf < resolvedSheetPath._capacity) { - uVar6 = resolvedSheetPath._capacity + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)resolvedSheetPath._buf)) + 0x0))); - if (0xfff < uVar6) { - freeBlock = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(resolvedSheetPath._buf)) + 0x0))) + -4); - uVar6 = resolvedSheetPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(resolvedSheetPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) - goto LAB_006bb75e; - } - operator_delete(freeBlock,uVar6); - } - this = self; - layerIndex = layerIndex + 1; - sprite = &self->_sprite; - } while (layerIndex < GHIDRA_CAST((self->_sprite)._layerCount)); - if ((isChampionSheetUsed == '\0') || (local_a8 == GHIDRA_CAST(0x0))) goto LAB_006bb675; - (GHIDRA_CAST((&local_ec)))->Color::Color(r,in_XMM2_Da,in_XMM3_Da,(float)local_a8); - championColor = &(this->_sprite)._championColor; - if (championColor != GHIDRA_CAST(&local_ec)) { - championColor->_tint[0] = local_ec._tint[0]; - (this->_sprite)._championColor._tint[1] = local_ec._tint[1]; - (this->_sprite)._championColor._tint[2] = local_ec._tint[2]; - (this->_sprite)._championColor._tint[3] = local_ec._tint[3]; - (this->_sprite)._championColor._colorize[0] = local_ec._colorize[0]; - (this->_sprite)._championColor._colorize[1] = local_ec._colorize[1]; - (this->_sprite)._championColor._colorize[2] = local_ec._colorize[2]; - (this->_sprite)._championColor._colorize[3] = local_ec._colorize[3]; - goto LAB_006bb6be; - } - } - if ((this->_type == 0x3b6) || ((this->_type == 0x3c0 && (this->_variant == 4)))) { - spriteBitflags = &(this->_sprite)._bitflags; - *spriteBitflags = *spriteBitflags | 0x20; - } - else { - spriteBitflags = &(this->_sprite)._bitflags; - *spriteBitflags = *spriteBitflags & 0xffffffdf; - } - ANM2::LoadGraphics(&this->_sprite,(uint8_t)championColor); - if (isDirtColorNeeded != '\0') { - UpdateDirtColor(this,1); - } - if (0xf < championSuffix._capacity) { - uVar8 = championSuffix._capacity + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)championSuffix._buf)) + 0x0))); - if (0xfff < uVar8) { - freeBlock = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(championSuffix._buf)) + 0x0))) + -4); - uVar8 = championSuffix._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(championSuffix._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_006bb75e; - } - operator_delete(freeBlock,uVar8); - } - if (0xf < sheetOverridePath._capacity) { - uVar8 = sheetOverridePath._capacity + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)sheetOverridePath._buf)) + 0x0))); - if (0xfff < uVar8) { - freeBlock = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetOverridePath._buf)) + 0x0))) + -4); - uVar8 = sheetOverridePath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(sheetOverridePath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { -LAB_006bb75e: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar8); - } - ExceptionList = local_1c; - return; -} - -// 006bb790 -void Entity_NPC::LoadEntityConfig() -{ - void *pvVar1; - Room *playerManager; - uint8_t hasRoomConfigFlag; - std_string *anim; - Entity_Player *championBeltOwner; - int iVar2; - uint32_t uVar3; - PlayerManager *playerManager; - uint32_t uVar4; - Game *game; - RNG rng; - RNG local_ac; - float local_9c; - char local_95; - float championChance; - Color bossColor; - char local_64 [24]; - char local_4c [24]; - char local_34 [24]; - float bossColorScale; - float bossColorHealthMultiplier; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - float maxHitPoints; - float scaleX; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afa7e0; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((local_34 + 0x30)); - ExceptionList = &local_10; - rng._seed = this->_initSeed; - rng._shift1 = 1; - rng._shift2 = 5; - rng._shift3 = 0x10; - this->_isBoss = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::LoadEntityConfig(); - if (this->_config == (void *)0x0) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] No entity config for NPC %d.%d\n")); - ExceptionList = local_10; - return; - } - load_graphics(this,1); - anim = &(this->_sprite)._animDefaultName; - (this->_sprite)._scale.x = g_vectorOne.x; - (this->_sprite)._scale.y = g_vectorOne.y; - if (0xf < (this->_sprite)._animDefaultName._capacity) { - anim = *GHIDRA_CAST((this->_sprite)._animDefaultName._buf); - } - hasRoomConfigFlag = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(anim),1); - if (((hasRoomConfigFlag != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } - pvVar1 = this->_config; - championChance = 0.05; - this->_canShutDoors = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x58)); - this->_isBoss = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x2c)); - this->_shieldStrength = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xe0)); - playerManager = &g_game->_playerManager; - this->_shieldFrames = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xe4)); - championBeltOwner = - PlayerManager::FirstCollectibleOwner(playerManager,0xd0,GHIDRA_CAST(playerManager),1); - if (championBeltOwner != GHIDRA_CAST(0x0)) { - championChance = 0.2; - } - if (g_game->_stage == 0xc) { - championChance = 0.75; - } - hasRoomConfigFlag = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,5); - if (hasRoomConfigFlag != 0) { - iVar2 = PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,5); - championChance = (float)iVar2 * 3.0 * championChance; - } - game = g_game; - playerManager = g_game->_room; - local_95 = *GHIDRA_CAST(playerManager); - if (local_95 != '\0') { - championChance = championChance * 0.2; - } - local_9c = 1.82169e-44; - msvc::set::find_node(&local_ac._shift1,&local_9c); - if (((*GHIDRA_CAST((local_ac._shift3 + 0xd)) == '\0') && (*GHIDRA_CAST((local_ac._shift3 + 0x10)) < 0xe)) && - ((void *)local_ac._shift3 != (game->_seedEffects)._seedEffects)) { - championChance = 1.0; - } - pvVar1 = this->_config; - if (this->_isBoss == 0) { - if ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x34)) != '\0') && (this->_isChampion == 0)) && - (((local_95 == '\0' && - (hasRoomConfigFlag = (GHIDRA_CAST((playerManager)))->Room::has_room_config_flag(4), hasRoomConfigFlag == 0)) && - ((playerManager->_roomType != 5 || (this->_type != 0x379)))))) && - ((local_9c = (GHIDRA_CAST((&rng)))->RNG::RandomFloat(), local_9c < championChance || - ((g_game->_challenge == 0x22 || - ((0 < g_game->_victoryLap && (local_9c = (GHIDRA_CAST((&rng)))->RNG::RandomFloat(), local_9c < 0.25)))))))) { - this->_isChampion = 1; - } - } - else { - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x6c)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x68))) / 0x7c; - if ((this->_spawnerEntity != 0) && (*GHIDRA_CAST((this->_spawnerEntity + 0x28)) == 0x19b)) { - uVar4 = 0; - } - if (DAT_00c71670 == '\0') { - if (((0 < GHIDRA_INT(uVar4)) && (this->_subtype == 0)) && - (((g_manager->_persistentGameData)._achievements[3] != 0 || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))))) { - championChance = 0.1; - if (((g_manager->_persistentGameData)._achievements[0x21] != 0) || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))) { - championChance = 0.3; - } - if (game->_difficulty == 3) { - championChance = 0.6; - } - hasRoomConfigFlag = PlayerManager::AnyoneHasTrinket(&game->_playerManager,5); - if (hasRoomConfigFlag != 0) { - iVar2 = PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,5); - championChance = ((float)iVar2 + (float)iVar2) * championChance; - } - if ((g_game->_challenge == 0x22) || (0 < g_game->_victoryLap)) { - championChance = 1.0; - } - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)); - local_ac._seed = 0; - if (iVar2 != 0) { - local_ac._seed = *GHIDRA_CAST((iVar2 + 0x5c)); - } - local_ac._shift1 = 1; - local_ac._shift2 = 0xb; - local_ac._shift3 = 0x10; - local_9c = (GHIDRA_CAST((&local_ac)))->RNG::RandomFloat(); - if (local_9c < championChance) { - uVar3 = (GHIDRA_CAST((&local_ac)))->RNG::RandomInt(uVar4); - this->_subtype = uVar3 + 1; - } - game = g_game; - if (((*GHIDRA_CAST(this->_config) == 0x2d) && (this->_subtype == 2)) && - (g_game->_challenge == 0x1e)) { - this->_subtype = 0; - } - } - } - else { - uVar4 = 0; - DAT_00c71670 = '\0'; - } - if ((game->_stageType == 4) || (game->_stageType == 5)) { - if (*GHIDRA_CAST(this->_config) == 0x2d) { - this->_subtype = 3; - } - else if (*GHIDRA_CAST(this->_config) == 0x4e) { - this->_subtype = 1; - } - } - uVar3 = this->_subtype; - if ((uVar3 != 0) && (uVar3 <= uVar4)) { - Color::copy_constructor_ext - (&bossColor,(void *)(*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x68)) + uVar3 * 0x7c + -0x7c)); - local_8 = 0; - iVar2 = this->_subtype + -1; - this->_bosscoloridx = iVar2; - if ((iVar2 < 0) || (GHIDRA_INT(uVar4) <= iVar2)) { - KAGE_LogMessage(1,GHIDRA_CAST("Invalid boss color idx: %d\n")); - this->_bosscoloridx = -1; - } - else { - scaleX = (this->_sprite)._scale.x; - (this->_sprite)._scale.y = bossColorScale * (this->_sprite)._scale.y; - maxHitPoints = this->_maxHitPoints; - (this->_sprite)._scale.x = bossColorScale * scaleX; - this->_scale = bossColorScale; - this->_maxHitPoints = bossColorHealthMultiplier * maxHitPoints; - } - this->ResetColor(); - load_graphics(this,1); - ANM2::SetFrame(&this->_sprite,&(this->_sprite)._animDefaultName,0); - local_8 = 0xffffffff; - (GHIDRA_CAST((local_34)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((local_4c)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((local_64)))->msvc::string::_Tidy_deallocate(); - } - } - if (DAT_00c71670 == '\0') { - if (this->_isChampion != 0) { - iVar2 = this->_championColorIdx; - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - MakeChampion(this,uVar4,iVar2,1); - } - } - else { - this->_isChampion = 0; - DAT_00c71670 = '\0'; - } - ExceptionList = local_10; - return; -} - -// 006be760 -void Entity_NPC::KillUnique() -{ - EntityRef killSource; - - killSource._type = 0; - killSource._variant = 0; - killSource._spawnerType = 0; - killSource._spawnerVariant = 0; - killSource._position.x = g_vectorZero.x; - killSource._position.y = g_vectorZero.y; - killSource._velocity.x = g_vectorZero.x; - killSource._velocity.y = g_vectorZero.y; - killSource._flags = 0; - killSource._entity = (void *)0x0; - this->Kill(&killSource); - this->_state = 0x11; - this->_stateFrame = 0; - return; -} - -// 006be840 -Entity * Entity_NPC::GetPlayerTarget() -{ - uint32_t *puVar1; - int *piVar2; - uint8_t bVar3; - uint32_t uVar4; - uint32_t uVar5; - Entity_Player *player; - void *playerListEnd; - PlayerManager *playerManager; - Entity *candidatesBegin; - Entity *ptr; - uint32_t killSource; - uint32_t local_70; - uint32_t local_6c; - uint32_t local_68; - float local_64; - float local_60; - float local_5c; - float local_58; - uint32_t local_54; - uint32_t local_50; - RNG pickRng; - uint8_t sameTypeList [12]; - uint32_t uStack_30; - Entity *candidates; - Entity *candidatesEnd; - Entity *candidatesCapEnd; - int *local_20; - int *local_1c; - Entity *candidatesCap; - uint32_t playerIndex; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity *newTarget; - Entity_NPC *sibling; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afa865; - local_10 = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((sameTypeList + 0x38)); - if (this->_type != 0x35) { - ExceptionList = &local_10; - if ((((this->_flags & 0x100) != 0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x72a1)) == '\0')) && - ((bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,this->_index), bVar3 != 0 || - (this->_target == 0)))) { - newTarget = Game::GetNearestEnemy(&this->_pos,GHIDRA_CAST(this),5000.0,(void *)0x0); - puVar1 = &this->_target; - if (this->_target != 0) { - local_20 = puVar1; - msvc::multiset::erase(&local_20); - } - *puVar1 = newTarget; - if (newTarget != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(puVar1); - } - } - puVar1 = &this->_target; - if (GHIDRA_CAST(this->_target) != GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return GHIDRA_CAST(this->_target); - } - if ((this->_type == 0xd5) || (this->_decoyTargetTimer < 0)) { - bVar3 = 0; - } - else { - bVar3 = 1; - } - local_1c = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_1c)) + 0x1))),1)); - if ((this->_flags & 0x20000000) == 0) { - local_1c = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_1c))) + 0x1))) << 8)); - } - newTarget = Game::GetNearestTargetPlayer - (&this->_pos,GHIDRA_CAST(this),(uint8_t)local_1c,bVar3,(void *)0x0,5000.0); - if (newTarget == GHIDRA_CAST(0x0)) { - player = Game::GetPlayer(g_game,0); - ExceptionList = local_10; - return GHIDRA_CAST(player); - } - bVar3 = (GHIDRA_CAST((newTarget)))->Entity::IsEnemy(); - if (bVar3 == 0) { - ExceptionList = local_10; - return newTarget; - } - bVar3 = (GHIDRA_CAST((newTarget)))->Entity::HasEntityFlags(0x10000000000000); - if (bVar3 == 0) { - ExceptionList = local_10; - return newTarget; - } - if (*puVar1 != 0) { - local_20 = puVar1; - msvc::multiset::erase(&local_20); - } - *puVar1 = newTarget; - msvc::multiset::insert(puVar1); - ExceptionList = local_10; - return newTarget; - } - local_1c = &this->_target; - candidates = GHIDRA_CAST(this->_target); - if (candidates != GHIDRA_CAST(0x0)) { - return candidates; - } - newTarget = GHIDRA_CAST(0x0); - candidatesEnd = GHIDRA_CAST(0x0); - local_8 = 0; - ExceptionList = &local_10; - candidatesCapEnd = candidates; - candidatesCap = candidates; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(sameTypeList),0x35,-1,-1,0, - 0); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - playerManager = &g_game->_playerManager; - playerIndex = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 - == 0) { - candidatesBegin = GHIDRA_CAST(0x0); - } - else { - do { - playerListEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - } - local_20 = (playerManager->_playerList)._begin; - if (playerIndex < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(local_20) >> 2))) { - local_20 = local_20 + playerIndex; - } - local_20 = GHIDRA_CAST(*local_20); - if (this->_controllerID == -1) { - uVar5 = 0; - if (uStack_30 != 0) { - do { - sibling = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(sameTypeList)) + 0x4))) + uVar5 * 4)); - if ((sibling != this) && (GHIDRA_CAST(sibling->_target) == local_20)) goto LAB_006be971; - uVar5 = uVar5 + 1; - } while (uVar5 < uStack_30); - } -LAB_006be94c: - if (newTarget == candidatesCap) { - msvc::vector::_Emplace_reallocate(newTarget,&local_20); - candidatesCap = candidatesCapEnd; - newTarget = candidatesEnd; - } - else { - *GHIDRA_CAST(newTarget) = local_20; - candidatesEnd = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((newTarget)) + 0x4)))); - newTarget = candidatesEnd; - } - } - else if (local_20[0x586] == this->_controllerID) goto LAB_006be94c; -LAB_006be971: - candidatesBegin = candidates; - playerManager = &g_game->_playerManager; - playerIndex = playerIndex + 1; - } while (playerIndex < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - if (candidates != newTarget) { - pickRng._seed = this->_initSeed; - pickRng._shift1 = 2; - pickRng._shift2 = 7; - pickRng._shift3 = 7; - uVar4 = (GHIDRA_CAST((&pickRng)))->RNG::RandomInt(GHIDRA_INT(newTarget) - GHIDRA_INT(candidates) >> 2); - player = *GHIDRA_CAST((GHIDRA_INT((&(candidatesBegin->_sprite)._filename + -3)) + uVar4 * 4)); - goto LAB_006bea36; - } - } - killSource = 0; - local_70 = 0; - local_6c = 0; - local_68 = 0; - local_64 = g_vectorZero.x; - local_60 = g_vectorZero.y; - local_5c = g_vectorZero.x; - local_58 = g_vectorZero.y; - local_54 = 0; - local_50 = 0; - this->Kill(&killSource,uVar4); - player = Game::GetPlayer(g_game,0); -LAB_006bea36: - piVar2 = local_1c; - if (*local_1c != 0) { - local_20 = local_1c; - msvc::multiset::erase(&local_20); - } - *piVar2 = GHIDRA_INT(player); - if (player != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(piVar2); - } - newTarget = GHIDRA_CAST(*piVar2); - uVar4 = local_8 >> 8; - local_8 = local_8 & 0xffffff00; - if (sameTypeList[0] == '\0') { - local_8 = CONCAT31((int3)uVar4,2); - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)sameTypeList)) + 0x4))),0); - } - if (candidatesBegin == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return newTarget; - } - uVar4 = GHIDRA_INT(candidatesCap) - GHIDRA_INT(candidatesBegin) & 0xfffffffc; - ptr = candidatesBegin; - if (0xfff < uVar4) { - ptr = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(candidatesBegin[-1])) + 0x40c)))); - uVar4 = uVar4 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatesBegin) + (-4 - GHIDRA_INT(ptr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,uVar4); - ExceptionList = local_10; - return newTarget; -} - -// 006bec40 -Vector * Entity_NPC::CalcTargetPosition(Vector *outPos, float distanceLimit) -{ - int iVar1; - uint8_t bVar2; - uint32_t rngResult; - Entity *playerTarget; - Vector *randomDir; - Game *game; - float fVar3; - float fVar4; - float fVar5; - Vector local_20; - Vector local_18; - Vector local_10; - uint64_t flags; - Room *room; - - game = g_game; - local_10.y = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - flags = this->_flags; - if ((flags & 0x200) == 0) { - if ((flags & 0x1000800) != 0) { - iVar1 = this->_type; - if (iVar1 == 0x10) { - if (this->_variant == 2) { -LAB_006bee6f: - playerTarget = GetPlayerTarget(this); - fVar3 = (this->_pos).x; - local_20.x = (this->_pos).y; - local_18.x = (playerTarget->_pos).x - fVar3; - local_10.x = (playerTarget->_pos).y - local_20.x; - fVar4 = local_18.x; - if ((distanceLimit != 0.0) && - (fVar5 = local_10.x * local_10.x + local_18.x * local_18.x, fVar5 != 0.0)) { - fVar4 = sqrtf(fVar5); - if (fVar4 <= 0.0) { - fVar4 = local_18.x; - } - else { - local_10.x = local_10.x * (distanceLimit / fVar4); - fVar4 = local_18.x * (distanceLimit / fVar4); - } - } - game = g_game; - fVar5 = this->_size; - fVar3 = fVar3 - fVar4; - local_20.x = local_20.x - local_10.x; - local_10.x = fVar3; - local_10.y = local_20.x; - Room::GetClampedPositionImpl(g_game->_room,&local_18,&local_10,fVar5,fVar5,fVar5,fVar5); - if ((fVar3 == local_18.x) && (local_20.x == local_18.y)) { - (this->_confusionTargetPos).x = g_vectorZero.x; - (this->_confusionTargetPos).y = g_vectorZero.y; - outPos->x = local_18.x; - outPos->y = local_18.y; - return outPos; - } - bVar2 = (GHIDRA_CAST((&this->_confusionTargetPos)))->Vector::operator_eq(&g_vectorZero); - if (bVar2 == 0) { - rngResult = Random(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(rngResult % 0xf + 5,0); - if (bVar2 == 0) { - fVar3 = (this->_confusionTargetPos).y; - outPos->x = (this->_confusionTargetPos).x; - outPos->y = fVar3; - return outPos; - } - game = g_game; - } - local_10.x = this->_size; - room = game->_room; - randomDir = MusicManager::RandomVector(&local_20); - rngResult = Random(); - fVar3 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)] - ) * 2.3283064e-10 * 100.0; - local_18.x = (this->_pos).x - fVar3 * randomDir->x; - local_18.y = (this->_pos).y - fVar3 * randomDir->y; - Room::GetClampedPositionImpl - (room,&local_10,&local_18,local_10.x,local_10.x,local_10.x,local_10.x); - (this->_confusionTargetPos).x = local_10.x; - (this->_confusionTargetPos).y = local_10.y; - outPos->x = local_10.x; - outPos->y = local_10.y; - return outPos; - } - } - else if ((iVar1 != 0x16) && (iVar1 != 0xcd)) goto LAB_006bee6f; - } - playerTarget = GetPlayerTarget(this); - fVar3 = (playerTarget->_pos).x; - outPos->y = (playerTarget->_pos).y; - outPos->x = fVar3; - return outPos; - } - if (((this->_confusionTargetPos).x != g_vectorZero.x) || - ((this->_confusionTargetPos).y != g_vectorZero.y)) { - if ((flags & 0x4000) != 0) goto LAB_006bee09; - bVar2 = Game::IsPaused(g_game); - if ((bVar2 != 0) || (game->_frameCount % 0xf != 0)) goto LAB_006bee09; - } - local_18.x = this->_size; - room = game->_room; - rngResult = Random(); - local_20.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_20.x = local_20.x + local_20.x; - rngResult = Random(); - local_10.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10; - rngResult = Random(); - fVar3 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * local_10.x * 240.0; - fVar4 = cos(local_20.x); - local_10.x = fVar4 * fVar3 + (this->_pos).x; - fVar4 = sin(local_20.x); - local_10.y = fVar4 * fVar3 + (this->_pos).y; - Room::GetClampedPositionImpl(room,&local_18,&local_10,local_18.x,local_18.x,local_18.x,local_18.x) - ; - (this->_confusionTargetPos).x = local_18.x; - (this->_confusionTargetPos).y = local_18.y; -LAB_006bee09: - fVar3 = (this->_confusionTargetPos).x; - outPos->y = (this->_confusionTargetPos).y; - outPos->x = fVar3; - return outPos; -} - -// 006c04b0 -void Entity_NPC::UpdateDirtColor(uint8_t immediate) -{ - float fVar1; - float fVar2; - uint8_t bVar3; - LayerState *layer; - ColorMod *lerpedColor; - uint8_t *****pppppbVar4; - uint8_t *****pppppbVar5; - uint32_t uVar6; - ColorMod *layerColor; - uint32_t size; - float fVar7; - ColorMod lerpResult; - ANM2 *sprite; - LayerState *currentLayer; - uint8_t *****layerNameData; - uint32_t local_68; - Entity_NPC *npc; - uint8_t *layerIndex; - char isDirtLayer; - uint32_t stringDestructFlags; - uint8_t *****layerName [4]; - uint32_t layerNameSize; - uint32_t layerNameCapacity; - uint8_t *****layerNameCopy; - KColor local_38; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint8_t ****local_14; - - puStack_20 = GHIDRA_CAST((layerName + 0x14)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00afa8ae; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((layerName + 0x11)); - ExceptionList = &local_1c; - stringDestructFlags = 0; - local_68 = 0; - npc = this; - pppppbVar4 = GHIDRA_CAST((layerName + 0x14)); - if (immediate == 0) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,this->_index); - pppppbVar4 = GHIDRA_CAST(puStack_20); - if (bVar3 == 0) goto LAB_006c05af; - } - puStack_20 = GHIDRA_CAST(pppppbVar4); - if ((this->_isChampion == 0) || (this->_championColorIdx != 2)) { - (GHIDRA_CAST((g_game->_room)))->Room::GetFloorColorAt(&local_38,&this->_pos,this->_size); - (this->_dirtColor)._tint[0] = local_38._red * 2.0; - (this->_dirtColor)._tint[1] = local_38._green * 2.0; - (this->_dirtColor)._tint[2] = local_38._blue * 2.0; - } - else { - (this->_dirtColor)._tint[0] = 0.0; - (this->_dirtColor)._tint[1] = 0.9; - (this->_dirtColor)._tint[2] = 0.0; - } - (this->_dirtColor)._tint[3] = 1.0; -LAB_006c05af: - layerIndex = GHIDRA_CAST(0x0); - if ((this->_sprite)._layerCount == 0) { - ExceptionList = local_1c; - return; - } - sprite = &this->_sprite; - do { - layer = ANM2::GetLayer(sprite,layerIndex); - stringDestructFlags = stringDestructFlags | 4; - currentLayer = layer; - if (layer->_layerData == (void *)0x0) { - layerNameCapacity = 0xf; - layerNameSize = 0; - layerName[0] = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(layerName))))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); - } - local_14 = GHIDRA_CAST(0x0); - local_68 = stringDestructFlags | 1; - pppppbVar4 = GHIDRA_CAST(layerName); - if (0xf < layerNameCapacity) { - pppppbVar4 = layerName[0]; - } - layerNameData = layerName[0]; - stringDestructFlags = local_68; - bVar3 = str_eq(GHIDRA_CAST(pppppbVar4),layerNameSize,&DAT_00b64428,4); - if (bVar3 == 0) { - stringDestructFlags = stringDestructFlags | 8; - if (layer->_layerData == (void *)0x0) { - layerNameCopy = GHIDRA_CAST(0x0); - local_38._unk = 0xf; - local_38._alpha = 0.0; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&layerNameCopy))))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); - } - uVar6 = local_38._unk; - pppppbVar4 = layerNameCopy; - stringDestructFlags = stringDestructFlags | 2; - pppppbVar5 = GHIDRA_CAST(&layerNameCopy); - if (0xf < GHIDRA_UINT(local_38._unk)) { - pppppbVar5 = layerNameCopy; - } - bVar3 = str_eq(GHIDRA_CAST(pppppbVar5),GHIDRA_UINT(local_38._alpha),&DAT_00b1d57c,4); - if (bVar3 != 0) goto LAB_006c06a7; - isDirtLayer = '\0'; - } - else { - pppppbVar4 = layerNameCopy; - uVar6 = local_38._unk; -LAB_006c06a7: - isDirtLayer = '\x01'; - } - if (((stringDestructFlags & 2) != 0) && - (stringDestructFlags = stringDestructFlags & 0xfffffffd, 0xf < uVar6)) { - size = uVar6 + 1; - pppppbVar5 = pppppbVar4; - if (0xfff < size) { - pppppbVar5 = GHIDRA_CAST(pppppbVar4[-1]); - size = uVar6 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(pppppbVar4) + (-4 - GHIDRA_INT(pppppbVar5))))) goto LAB_006c07af; - } - operator_delete(pppppbVar5,size); - } - local_14 = GHIDRA_CAST(0xffffffff); - if (((stringDestructFlags & 1) != 0) && - (stringDestructFlags = stringDestructFlags & 0xfffffffe, 0xf < layerNameCapacity)) { - uVar6 = layerNameCapacity + 1; - pppppbVar4 = layerNameData; - if (0xfff < uVar6) { - pppppbVar4 = GHIDRA_CAST(layerNameData[-1]); - uVar6 = layerNameCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(layerNameData) + (-4 - GHIDRA_INT(pppppbVar4))))) { -LAB_006c07af: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppbVar4,uVar6); - } - layer = currentLayer; - if (isDirtLayer != '\0') { - if (immediate == 0) { - fVar7 = 0.1; - } - else { - fVar7 = 1.0; - } - layerColor = ¤tLayer->_color; - lerpedColor = Color::Lerp(&lerpResult,layerColor,&npc->_dirtColor,fVar7); - if (layerColor != lerpedColor) { - fVar7 = lerpedColor->_tint[1]; - fVar1 = lerpedColor->_tint[2]; - fVar2 = lerpedColor->_tint[3]; - layerColor->_tint[0] = lerpedColor->_tint[0]; - (layer->_color)._tint[1] = fVar7; - (layer->_color)._tint[2] = fVar1; - (layer->_color)._tint[3] = fVar2; - fVar7 = lerpedColor->_colorize[1]; - fVar1 = lerpedColor->_colorize[2]; - fVar2 = lerpedColor->_colorize[3]; - (layer->_color)._colorize[0] = lerpedColor->_colorize[0]; - (layer->_color)._colorize[1] = fVar7; - (layer->_color)._colorize[2] = fVar1; - (layer->_color)._colorize[3] = fVar2; - fVar7 = lerpedColor->_offset[1]; - (layer->_color)._offset[0] = lerpedColor->_offset[0]; - (layer->_color)._offset[1] = fVar7; - (layer->_color)._offset[2] = lerpedColor->_offset[2]; - } - } - layerIndex = layerIndex + 1; - if (GHIDRA_CAST((npc->_sprite)._layerCount) <= layerIndex) { - ExceptionList = local_1c; - return; - } - } while( true ); -} - -// 006c07e0 -uint8_t Entity_NPC::Redirect(int *entityType, int *variant) -{ - uint8_t isGreedMode; - int iVar1; - int redirectedType; - Game *game; - uint8_t local_14 [8]; - void *seedEffectNode; - uint32_t seedEffectId; - Manager *manager; - - manager = g_manager; - game = g_game; - if (((g_manager->_persistentGameData)._achievements[0x21] == 0) && - ((((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) && - ((*entityType == 0x3d && (*variant == 5)))))) { - *entityType = 0xd; - *variant = 0; - } - if (((manager->_persistentGameData)._achievements[0x15c] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x8)))) == 2 && (game != GHIDRA_CAST(0x0))) && - (((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))) goto LAB_006c0e23; - iVar1 = *entityType; - if (iVar1 == 0x12f) { - if ((game->_difficulty == 0) || (game->_difficulty == 2)) { - *entityType = 0x1d; - *variant = 1; - return 1; - } - *entityType = 0xfa; - *variant = 0; - return 1; - } - if (iVar1 == 300) { - *entityType = 0x1b; -LAB_006c08b1: - *variant = 0; - return 1; - } - if (iVar1 == 0x131) { - *entityType = 0x1d; - *variant = 0; - return 1; - } - if (iVar1 == 0xe7) goto LAB_006c08b1; - if (iVar1 == 0x12d) { - *entityType = 0x20; - *variant = 0; - return 1; - } - if (iVar1 == 0x12e) { - if ((game->_difficulty == 0) || (iVar1 = 0x101, game->_difficulty == 2)) { - iVar1 = 0xd0; - } - *entityType = iVar1; - *variant = 0; - return 1; - } - if (iVar1 == 0x130) { - if ((game->_difficulty == 0) || (iVar1 = 0xf2, game->_difficulty == 2)) { - iVar1 = 0xf0; - } - *entityType = iVar1; - *variant = 0; - return 1; - } - if (iVar1 != 0x132) { -LAB_006c0e23: - seedEffectId = 0x4f; - msvc::set::find_node(local_14,&seedEffectId); - if (((*GHIDRA_CAST((GHIDRA_CAST(seedEffectNode) + 0xd)) != '\0') || - (0x4f < *GHIDRA_CAST((GHIDRA_CAST(seedEffectNode) + 0x10)))) || - (seedEffectNode == (game->_seedEffects)._seedEffects)) { - return 0; - } - iVar1 = *entityType; - if (iVar1 != 0x1b) { - if (iVar1 == 0xcc) { - *entityType = 0xf7; - return 0; - } - if (iVar1 != 0x35b) { - if (iVar1 == 0xdd) { - *entityType = 0x3a; - return 0; - } - return 0; - } - *entityType = 0x19; - } - *variant = 1; - return 0; - } - isGreedMode = Game::IsGreedMode(game); - if (isGreedMode == 0) { - iVar1 = (GHIDRA_CAST((game->_room)))->Room::GetRoomConfigStage(); - switch(iVar1) { - case 0: - if ((g_game->_difficulty == 0) || (iVar1 = 0x5e, g_game->_difficulty == 2)) { - iVar1 = 0x55; - } - *entityType = iVar1; - *variant = 0; - return 1; - case 1: - case 3: - iVar1 = g_game->_difficulty; - goto LAB_006c0994; - case 2: - if ((g_game->_difficulty == 0) || (redirectedType = 0x5e, g_game->_difficulty == 2)) { - *entityType = 0x55; - *variant = 0; - return 1; - } - break; - case 4: - if ((g_game->_difficulty == 0) || (redirectedType = 0x17, g_game->_difficulty == 2)) { - *entityType = 0x15; - *variant = 0; - return 1; - } - break; - case 5: - if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) { - *entityType = 0x1a; - *variant = 0; - return 1; - } - *entityType = 0x1a; - *variant = 1; - return 1; - case 6: - if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) { - *entityType = 0x17; - *variant = 0; - return 1; - } - *entityType = 0x17; - *variant = 1; - return 1; - case 7: - if ((g_game->_difficulty == 0) || (redirectedType = 0xe3, g_game->_difficulty == 2)) { - *entityType = 0xd1; - *variant = 0; - return 1; - } - break; - case 8: - if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) { - *entityType = 0xe3; - *variant = 0; - return 1; - } - *entityType = 0x18; - *variant = 1; - return 1; - case 9: - if ((g_game->_difficulty == 0) || (redirectedType = 0x115, g_game->_difficulty == 2)) { - *entityType = 0x18; - *variant = 0; - return 1; - } - break; - case 10: - if ((g_game->_difficulty == 0) || (redirectedType = 0x3a, g_game->_difficulty == 2)) { - *entityType = 0xf; - *variant = 0; - return 1; - } - break; - case 0xb: - if ((g_game->_difficulty == 0) || (redirectedType = 0x27, g_game->_difficulty == 2)) { - *entityType = 0x3a; - *variant = 0; - return 1; - } - break; - case 0xc: - if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) { - *entityType = 0x27; - *variant = 0; - return 1; - } - *entityType = 0x27; - *variant = 1; - return 1; - case 0xd: - *entityType = 0x129; - *variant = 0; - return 1; - case 0xe: - if ((g_game->_difficulty == 0) || (redirectedType = 0xfc, g_game->_difficulty == 2)) { - *entityType = 0x57; - *variant = 0; - return 1; - } - break; - case 0xf: - if ((g_game->_difficulty == 0) || (iVar1 = 0x37, g_game->_difficulty == 2)) { - iVar1 = 0x1a; - } - *entityType = iVar1; - *variant = 2; - return 1; - case 0x10: - if ((g_game->_difficulty == 0) || (iVar1 = 0x32, g_game->_difficulty == 2)) { - iVar1 = 0x30; - } - *entityType = iVar1; - *variant = 1; - return 1; - case 0x11: - if ((g_game->_difficulty == 0) || (redirectedType = 0x19a, g_game->_difficulty == 2)) { - *entityType = 0x10b; - *variant = 0; - return 1; - } - break; - default: - game = g_game; - goto LAB_006c0e23; - case 0x1a: - *entityType = 0x19c; - *variant = 0; - return 1; - } - } - else { - switch(game->_stage) { - case 1: - iVar1 = game->_difficulty; - break; - case 2: - if ((game->_difficulty == 0) || (iVar1 = 0x17, game->_difficulty == 2)) { - iVar1 = 0x15; - } - *entityType = iVar1; - *variant = 0; - return 1; - case 3: - if ((game->_difficulty == 0) || (iVar1 = 0xe3, game->_difficulty == 2)) { - iVar1 = 0xd1; - } - *entityType = iVar1; - *variant = 0; - return 1; - case 4: - if ((game->_difficulty == 0) || (iVar1 = 0x3a, game->_difficulty == 2)) { - iVar1 = 0xf; - } - *entityType = iVar1; - *variant = 0; - return 1; - case 5: - if ((game->_difficulty == 0) || (iVar1 = 0xfc, game->_difficulty == 2)) { - iVar1 = 0x57; - } - *entityType = iVar1; - *variant = 0; - return 1; - case 6: - if ((game->_difficulty == 0) || (game->_difficulty == 2)) { - *entityType = 0x32; - *variant = 0; - return 1; - } - *entityType = 0x32; - *variant = 1; - return 1; - default: - *entityType = 299; - *variant = 0; - return 1; - } -LAB_006c0994: - if ((iVar1 == 0) || (redirectedType = 0x11c, iVar1 == 2)) { - redirectedType = 10; - } - } - *entityType = redirectedType; - *variant = 0; - return 1; -} - -// 006c0f30 -void Entity_NPC::Morph(int EntityType, int Variant, int SubType, int Championid) -{ - uint8_t isErased; - EntityConfig_Entity *config; - float *health; - uint32_t extraout_EAX; - int unusedArg; - float fVar2; - Color defaultColor; - uint32_t local_c; - float *health; - - local_c = __security_cookie ^ GHIDRA_UINT(&defaultColor); - if ((((EntityType == this->_type) && (Variant == this->_variant)) && (SubType == this->_subtype)) - && ((Championid < 0 || (Championid == this->_championColorIdx)))) { - return; - } - this->_type = EntityType; - this->_variant = Variant; - this->_subtype = SubType; - if (-1 < Championid) { - this->_championColorIdx = Championid; - this->_isChampion = 1; - } - config = EntityConfig::GetEntity(&g_manager->_entityConfig,EntityType,Variant,SubType); - if ((config != GHIDRA_CAST(0x0)) && (config->canBeChampion == 0)) { - this->_championColorIdx = -1; - this->_isChampion = 0; - } - this->_flickerTimer = 0; - this->_championRegenTimer = 0; - this->_flickerState = 0; - this->_flickerAlpha = 1.0; - this->_championSpeed = 1.0; - this->_championTimer = 0; - this->ResetColor(); - this->_scale = 1.0; - fVar2 = this->_shrinkStatus1 * g_vectorOne.y; - (this->_sprite)._scale.x = this->_shrinkStatus1 * g_vectorOne.x; - (this->_sprite)._scale.y = fVar2; - this->LoadEntityConfig(); - health = &this->_maxHitPoints; - fVar2 = this->_hitPointsMulti * *health; - health = &this->_health; - this->_totalDamageTaken = 0.0; - *health = fVar2; - if (*health <= fVar2 && fVar2 != *health) { - health = health; - } - *health = *health; - if ((this->_colorParams)._begin != (this->_colorParams)._end) { - (GHIDRA_CAST((&defaultColor)))->Color::Color(); - this->SetColor(extraout_EAX,1,0xfffffc18,0,1); - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Reset(); - PersistentGameData::TryAddBestiaryEncounter - (&g_manager->_persistentGameData,this->_type,this->_variant); - this->_isBestiaryEncountered = 1; - isErased = Game::ShouldEraseEnemy(GHIDRA_CAST(this)); - if (isErased != 0) { - Entity::RemoveWithPoof(GHIDRA_CAST(this),unusedArg); - } - return; -} - -// 006c1100 -void Entity_NPC::ResetColor() -{ - float fVar1; - float fVar2; - float fVar3; - LayerState *layer; - float *championColor; - char isChampionLayer; - ColorMod *spriteColor; - uint8_t *layerIdx; - uint8_t flashColor [44]; - uint32_t local_b4 [11]; - char local_85; - Color bossColor; - char local_58 [24]; - char local_40 [24]; - char local_28 [32]; - uint32_t local_8; - int bossColorIdx; - int bossColors; - - local_8 = __security_cookie ^ GHIDRA_UINT((local_28 + 0x24)); - if (this->_isChampion == 0) { - bossColorIdx = this->_bosscoloridx; - if (bossColorIdx < 0) { - spriteColor = &(this->_sprite)._color; - if (spriteColor != &this->_color) { - fVar1 = (this->_color)._tint[1]; - fVar2 = (this->_color)._tint[2]; - fVar3 = (this->_color)._tint[3]; - spriteColor->_tint[0] = (this->_color)._tint[0]; - (this->_sprite)._color._tint[1] = fVar1; - (this->_sprite)._color._tint[2] = fVar2; - (this->_sprite)._color._tint[3] = fVar3; - fVar1 = (this->_color)._colorize[1]; - fVar2 = (this->_color)._colorize[2]; - fVar3 = (this->_color)._colorize[3]; - (this->_sprite)._color._colorize[0] = (this->_color)._colorize[0]; - (this->_sprite)._color._colorize[1] = fVar1; - (this->_sprite)._color._colorize[2] = fVar2; - (this->_sprite)._color._colorize[3] = fVar3; - *GHIDRA_CAST((this->_sprite)._color._offset) = *GHIDRA_CAST((this->_color)._offset); - (this->_sprite)._color._offset[2] = (this->_color)._offset[2]; - } - } - else { - bossColors = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x68)); - if (bossColorIdx < (*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x6c)) - bossColors) / 0x7c) { - (GHIDRA_CAST((&bossColor)))->Color::copy_constructor_ext((void *)(bossColorIdx * 0x7c + bossColors)); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&bossColor)); - (GHIDRA_CAST((local_28)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((local_40)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((local_58)))->msvc::string::_Tidy_deallocate(); - } - } - } - else { - layerIdx = GHIDRA_CAST(0x0); - local_85 = '\0'; - isChampionLayer = '\0'; - if ((this->_sprite)._layerCount != 0) { - do { - layer = ANM2::GetLayer(&this->_sprite,layerIdx); - if ((layer->_bitflags & 0x10) != 0) { - isChampionLayer = '\x01'; - goto LAB_006c115c; - } - layerIdx = layerIdx + 1; - } while (layerIdx < GHIDRA_CAST((this->_sprite)._layerCount)); - isChampionLayer = local_85; - } -LAB_006c115c: - if (GHIDRA_UINT(this->_championColorIdx) < 0x1a) { - spriteColor = &(this->_sprite)._color; - if (isChampionLayer == '\0') { - championColor = GHIDRA_CAST(_Entity_NPC)::GetColorWithFlash(flashColor); - } - else { - championColor = GHIDRA_CAST((&DAT_00c354d4 + this->_championColorIdx * 0x40)); - } - if (spriteColor != GHIDRA_CAST(championColor)) { - fVar1 = championColor[1]; - fVar2 = championColor[2]; - fVar3 = championColor[3]; - spriteColor->_tint[0] = *championColor; - (this->_sprite)._color._tint[1] = fVar1; - (this->_sprite)._color._tint[2] = fVar2; - (this->_sprite)._color._tint[3] = fVar3; - fVar1 = championColor[5]; - fVar2 = championColor[6]; - fVar3 = championColor[7]; - (this->_sprite)._color._colorize[0] = championColor[4]; - (this->_sprite)._color._colorize[1] = fVar1; - (this->_sprite)._color._colorize[2] = fVar2; - (this->_sprite)._color._colorize[3] = fVar3; - *GHIDRA_CAST((this->_sprite)._color._offset) = *GHIDRA_CAST((championColor + 8)); - (this->_sprite)._color._offset[2] = championColor[10]; - } - } - } - if (((this->_flags & 0x20000000) != 0) && - (((this->_type != 0x17 || (this->_variant != 0)) || (this->_subtype != 1)))) { - spriteColor = &(this->_sprite)._color; - if (spriteColor != GHIDRA_CAST(local_b4)) { - spriteColor->_tint[0] = 0.8; - (this->_sprite)._color._tint[1] = 0.8; - (this->_sprite)._color._tint[2] = 0.8; - (this->_sprite)._color._tint[3] = 1.0; - (this->_sprite)._color._offset[0] = 0.1; - (this->_sprite)._color._offset[1] = 0.1; - (this->_sprite)._color._colorize[0] = 1.0; - (this->_sprite)._color._colorize[1] = 1.0; - (this->_sprite)._color._colorize[2] = 1.0; - (this->_sprite)._color._colorize[3] = -0.5; - (this->_sprite)._color._offset[2] = 0.1; - } - } - fVar3 = fRam00c34218; - fVar2 = fRam00c34214; - fVar1 = fRam00c34210; - if ((this->_type == 0x3c3) && - (spriteColor = &(this->_sprite)._color, spriteColor != GHIDRA_CAST(&DAT_00c3420c))) { - spriteColor->_tint[0] = _DAT_00c3420c; - (this->_sprite)._color._tint[1] = fVar1; - (this->_sprite)._color._tint[2] = fVar2; - (this->_sprite)._color._tint[3] = fVar3; - fVar3 = fRam00c34228; - fVar2 = fRam00c34224; - fVar1 = fRam00c34220; - (this->_sprite)._color._colorize[0] = _DAT_00c3421c; - (this->_sprite)._color._colorize[1] = fVar1; - (this->_sprite)._color._colorize[2] = fVar2; - (this->_sprite)._color._colorize[3] = fVar3; - *GHIDRA_CAST((this->_sprite)._color._offset) = DAT_00c3422c; - (this->_sprite)._color._offset[2] = DAT_00c34234; - } - return; -} - -// 006c1ac0 -void * Entity_NPC::shopkeeper_get_loot(void *outLoot, uint8_t isShouldAdvance) -{ - code *pcVar1; - uint8_t bVar2; - uint8_t isRemoved; - void *dequeMap; - void *block; - int triesLeft; - int iVar3; - uint32_t local_ESI_258; - RNG *rng; - int *ptr; - int *lootList; - void *lootMap; - int lootMapSize; - uint32_t lootOffset; - int lootCount; - uint32_t local_38; - RNG rngCopy; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - RNG *dropRng; - RNG *lootRng; - int lootSubtype; - uint32_t lootType; - uint32_t temp_3f540a64be; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00afa8ed; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - ExceptionList = &local_1c; - lootList = GHIDRA_CAST(0x0); - lootMap = (void *)0x0; - lootMapSize = 0; - lootOffset = 0; - lootCount = 0; - lootList = operator_new(8); - lootList[1] = 0; - *lootList = GHIDRA_INT(&lootList); - local_14 = 0; - if ((this->_flags & 0x40000000000) != 0) { - (GHIDRA_CAST((outLoot)))->LootList::LootList(&lootList); - if (lootCount != 0) { - do { - lootCount = lootCount + -1; - } while (lootCount != 0); - lootOffset = 0; - lootCount = 0; - } - dequeMap = lootMap; - iVar3 = lootMapSize; - if (lootMapSize != 0) { - do { - block = *(void **)(GHIDRA_CAST(dequeMap) + iVar3 * 4 + -4); - iVar3 = iVar3 + -1; - if (block != (void *)0x0) { - operator_delete(block,0x14); - dequeMap = lootMap; - } - } while (iVar3 != 0); - } - if (dequeMap != (void *)0x0) { - local_ESI_258 = lootMapSize * 4; - block = dequeMap; - if (0xfff < local_ESI_258) { - block = *(void **)(GHIDRA_CAST(dequeMap) + -4); - local_ESI_258 = local_ESI_258 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(dequeMap) + (-4 - GHIDRA_INT(block))))) goto LAB_006c2071; - } - operator_delete(block,local_ESI_258); - } - ptr = lootList; - goto LAB_006c2087; - } - lootRng = &this->_dropRNG; - rng = &rngCopy; - if (isShouldAdvance != 0) { - rng = lootRng; - } - rngCopy._seed = (this->_dropRNG)._seed; - rngCopy._shift1 = (this->_dropRNG)._shift1; - rngCopy._shift2 = (this->_dropRNG)._shift2; - rngCopy._shift3 = (this->_dropRNG)._shift3; - if ((this->_variant == 3) || (this->_variant == 4)) { - local_38 = rng->_seed; - if (local_38 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - local_38 = rng->_seed; - if (local_38 == 0) { - pcVar1 = (code *)swi(3); - dequeMap = (void *)(*pcVar1)(); - return dequeMap; - } - } - local_38 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38; - local_38 = local_38 ^ local_38 << ((uint8_t)rng->_shift2 & 0x1f); - local_38 = local_38 ^ local_38 >> ((uint8_t)rng->_shift3 & 0x1f); - rng->_seed = local_38; - if (((local_38 & 0x7f) == 0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 5)) { - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - lootSubtype = 0; - temp_3f540a64be = 0; - lootType = 0x32; - goto LAB_006c1ff3; - } - if (local_38 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - local_38 = rng->_seed; - if (local_38 == 0) { - pcVar1 = (code *)swi(3); - dequeMap = (void *)(*pcVar1)(); - return dequeMap; - } - } - local_38 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38; - local_38 = local_38 ^ local_38 << ((uint8_t)rng->_shift2 & 0x1f); - local_38 = local_38 ^ local_38 >> ((uint8_t)rng->_shift3 & 0x1f); - rng->_seed = local_38; - if ((local_38 & 0x1f) == 0) { - iVar3 = 3; -LAB_006c1ea1: - lootSubtype = 0; - triesLeft = iVar3; - do { - iVar3 = triesLeft + -1; - if (triesLeft < 1) { - if (lootSubtype == 0) goto LAB_006c1ffb; -LAB_006c1f71: - if (isShouldAdvance != 0) { - ItemPool::RemoveTrinket(&g_game->_itemPool,lootSubtype); - } - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - temp_3f540a64be = 0x15e; - goto LAB_006c1ff1; - } - if (local_38 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - local_38 = rng->_seed; - if (local_38 == 0) { - pcVar1 = (code *)swi(3); - dequeMap = (void *)(*pcVar1)(); - return dequeMap; - } - } - local_38 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38; - local_38 = local_38 << ((uint8_t)rng->_shift2 & 0x1f) ^ local_38; - local_38 = local_38 >> ((uint8_t)rng->_shift3 & 0x1f) ^ local_38; - rng->_seed = local_38; - switch(local_38 % 6) { - case 0: - lootSubtype = 1; - break; - case 1: - lootSubtype = 0x18; - break; - case 2: - lootSubtype = 0x31; - break; - case 3: - lootSubtype = 0x32; - break; - case 4: - lootSubtype = 0x33; - break; - case 5: - lootSubtype = 0x34; - } - dequeMap = (g_game->_itemPool)._trinketPoolItems._begin; - if ((*GHIDRA_CAST((GHIDRA_CAST(dequeMap) + lootSubtype * 8 + 4)) == '\0') || - (*GHIDRA_CAST((GHIDRA_CAST(dequeMap) + lootSubtype * 8 + 5)) == '\0')) goto LAB_006c1ea1; - if (lootSubtype != 0) goto LAB_006c1f71; - triesLeft = iVar3; - } while( true ); - } - if (local_38 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - local_38 = rng->_seed; - if (local_38 == 0) { - pcVar1 = (code *)swi(3); - dequeMap = (void *)(*pcVar1)(); - return dequeMap; - } - } - local_ESI_258 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38; - local_ESI_258 = local_ESI_258 ^ local_ESI_258 << ((uint8_t)rng->_shift2 & 0x1f); - local_ESI_258 = local_ESI_258 ^ local_ESI_258 >> ((uint8_t)rng->_shift3 & 0x1f); - rng->_seed = local_ESI_258; - if (local_ESI_258 != (local_ESI_258 / 3) * 3) { - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - lootSubtype = 2; -LAB_006c1fef: - temp_3f540a64be = 0x14; - goto LAB_006c1ff1; - } - } - else { - local_ESI_258 = rng->_seed; - if (local_ESI_258 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - local_ESI_258 = rng->_seed; - if (local_ESI_258 == 0) { - pcVar1 = (code *)swi(3); - dequeMap = (void *)(*pcVar1)(); - return dequeMap; - } - } - local_ESI_258 = local_ESI_258 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_ESI_258; - local_ESI_258 = local_ESI_258 ^ local_ESI_258 << ((uint8_t)rng->_shift2 & 0x1f); - local_ESI_258 = local_ESI_258 ^ local_ESI_258 >> ((uint8_t)rng->_shift3 & 0x1f); - rng->_seed = local_ESI_258; - if (local_ESI_258 % 100 == 0) { - local_38 = CONCAT31((int3)(GHIDRA_UINT(g_game) >> 8),isShouldAdvance) ^ 1; - bVar2 = ItemPool::RemoveCollectible(&g_game->_itemPool,0x40,1,(uint8_t)local_38); - if (bVar2 == 0) { - bVar2 = (uint8_t)local_38; - goto LAB_006c1cb2; - } - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - lootSubtype = 0x40; - temp_3f540a64be = 100; - } - else { - bVar2 = isShouldAdvance ^ 1; -LAB_006c1cb2: - local_38 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x1))),bVar2); - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::RandomInt(100); - bVar2 = (uint8_t)local_38; - if ((local_ESI_258 == 0) && - (isRemoved = ItemPool::RemoveCollectible(&g_game->_itemPool,0x1ad,1,bVar2), isRemoved != 0) - ) { - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - lootSubtype = 0x1ad; - temp_3f540a64be = 100; - } - else { - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::RandomInt(100); - if ((local_ESI_258 != 0) || - ((((g_manager->_persistentGameData)._achievements[0x16c] == 0 && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) || - (bVar2 = ItemPool::RemoveCollectible(&g_game->_itemPool,0x209,1,bVar2), bVar2 == 0)))) { - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::RandomInt(3); - if (local_ESI_258 != 1) { - if (local_ESI_258 == 2) { - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - msvc::deque::push_back(5,0x14,0,local_ESI_258,0); - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - lootSubtype = 0; - goto LAB_006c1fef; - } - goto LAB_006c1ffb; - } - lootRng = &this->_dropRNG; - dropRng = lootRng; - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - msvc::deque::push_back(0x55,0,0,local_ESI_258,dropRng); - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - lootSubtype = 0; - temp_3f540a64be = 0; - lootType = 0x55; - goto LAB_006c1ff3; - } - local_ESI_258 = (GHIDRA_CAST((rng)))->RNG::Next(); - lootSubtype = 0x209; - temp_3f540a64be = 100; - } - } -LAB_006c1ff1: - lootRng = GHIDRA_CAST(0x0); - lootType = 5; -LAB_006c1ff3: - msvc::deque::push_back(lootType,temp_3f540a64be,lootSubtype,local_ESI_258,lootRng); - } -LAB_006c1ffb: - (GHIDRA_CAST((outLoot)))->LootList::LootList(&lootList); - if (lootCount != 0) { - do { - lootCount = lootCount + -1; - } while (lootCount != 0); - lootOffset = 0; - lootCount = 0; - } - dequeMap = lootMap; - iVar3 = lootMapSize; - if (lootMapSize != 0) { - do { - block = *(void **)(GHIDRA_CAST(dequeMap) + iVar3 * 4 + -4); - iVar3 = iVar3 + -1; - if (block != (void *)0x0) { - operator_delete(block,0x14); - dequeMap = lootMap; - } - } while (iVar3 != 0); - } - if (dequeMap != (void *)0x0) { - local_ESI_258 = lootMapSize * 4; - block = dequeMap; - if (0xfff < local_ESI_258) { - block = *(void **)(GHIDRA_CAST(dequeMap) + -4); - local_ESI_258 = local_ESI_258 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(dequeMap) + (-4 - GHIDRA_INT(block))))) { -LAB_006c2071: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(block,local_ESI_258); - } - ptr = lootList; -LAB_006c2087: - lootMapSize = 0; - lootMap = (void *)0x0; - lootList = GHIDRA_CAST(0x0); - operator_delete(ptr,8); - ExceptionList = local_1c; - return outLoot; -} - -// 006c2750 -Entity_NPC * Entity_NPC::ThrowSpider(Vector *position, Entity *spawner, Vector targetPos, uint8_t isBig, float yOffset) -{ - Vector *freePos; - uint32_t uVar1; - Entity_NPC *spider; - uint32_t type; - Entity *spawned; - int gridY; - Game *currentGame; - int gridX; - float fVar2; - float fVar3; - Vector freePosBuffer; - Game *game; - void *room; - float spiderY; - - if ((targetPos.x == g_vectorZero.x) && (targetPos.y == g_vectorZero.y)) { - freePos = Room::FindFreePickupSpawnPosition(g_game->_room,&freePosBuffer,position,100.0,0,0,0); - targetPos.x = freePos->x; - targetPos.y = freePos->y; - } - game = g_game; - if (g_game->_challenge == 0x2c) { - uVar1 = Level::GetRoomStageType(GHIDRA_CAST(g_game),g_game->_currentRoomIdx); - } - else { - currentGame = g_game; - fVar2 = targetPos.x; - if (g_game->_currentDimensionIdx == 2) goto LAB_006c2838; - uVar1 = g_game->_stageType; - } - currentGame = g_game; - fVar2 = targetPos.x; - uVar1 = RoomConfig::GetStageID(game->_stage,uVar1,-1); - if (((uVar1 == 0x1b) || (uVar1 == 0x1c)) && (0.1 < *GHIDRA_CAST((GHIDRA_CAST(currentGame->_room) + 0x7240)))) - { - spider = ThrowStrider(position,spawner,&targetPos); - return spider; - } -LAB_006c2838: - room = currentGame->_room; - gridX = GHIDRA_INT(((fVar2 - 40.0) / 40.0 + 0.5)); - gridY = GHIDRA_INT(((targetPos.y - 120.0) / 40.0 + 0.5)); - if ((((-1 < gridX) && (gridX < *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)))) && - ((-1 < gridY && - ((gridY < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x10)) && - (uVar1 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)) * gridY + gridX, uVar1 < 0x1c0)))))) && - (*GHIDRA_CAST((GHIDRA_CAST(room) + uVar1 * 4 + 0x76c)) < 0x3b7)) { - *GHIDRA_CAST((GHIDRA_CAST(room) + uVar1 * 4 + 0x76c)) = 900; - } - uVar1 = Random(); - type = 0x55; - if (isBig != 0) { - type = 0x5e; - } - spawned = Game::SpawnEx(g_game,type,0,position,&g_vectorZero,spawner,0,uVar1,0); - spider = (Entity_NPC *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - spider->_state = 6; - (spider->_targetPosition).x = targetPos.x; - (spider->_targetPosition).y = targetPos.y; - fVar2 = (spider->_targetPosition).x; - fVar3 = (spider->_pos).x; - spiderY = (spider->_pos).y; - (spider->_v2).y = -8.0; - fVar3 = (fVar2 - fVar3) * 0.04; - spider->_entityCollisionClass = 0; - fVar2 = (targetPos.y - spiderY) * 0.04; - (spider->_velocity).x = fVar3; - (spider->_v1).x = fVar3; - (spider->_velocity).y = fVar2; - (spider->_v1).y = fVar2; - (spider->_posOffset).y = yOffset; - return spider; -} - -// 006c4ac0 -void Entity_NPC::PreUpdate() -{ - (this->_prevPosition).x = (this->_pos).x; - (this->_prevPosition).y = (this->_pos).y; - (this->_prevVelocity).x = (this->_velocity).x; - (this->_prevVelocity).y = (this->_velocity).y; - if (((this->_type == 0x340) && (this->_variant == 0)) && (this->_dead == 0)) { - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x7768)) = 1; - } - return; -} - -// 006c4b30 -void Entity_NPC::Update() -{ - code *pcVar1; - BitSet128 tearFlags; - uint8_t bVar2; - char cVar3; - uint32_t uVar4; - uint8_t *layerCount; - SoundEffects *sfx; - ColorMod *color; - ColorMod *extraout_EAX; - LayerState *firstLayer; - Sprite *pSVar5; - std_string *psVar6; - Entity *pEVar7; - void *pvVar8; - Entity_Effect *pEVar9; - Room *pRVar10; - GridEntity_Poop *poop; - uint32_t *entitySlot; - uint8_t *puVar11; - ColorMod *tmpColor; - Vector *tmpVec; - float *clampedValue; - ColorMod *to; - uint32_t extraout_EAX_00; - Sprite *sprite; - ANM2 *pAVar12; - ColorMod *to_00; - uint32_t extraout_EAX_01; - EntityList *entityList; - uint32_t extraout_EAX_02; - ColorMod *to_01; - Entity_Player *player; - uint32_t uVar13; - GridEntity *gridEntity; - PlayerManager *playerManager; - RNG *this_00; - RNG *sfx; - int *piVar14; - Vector *tmpVec2; - undefined3 extraout_var; - TemporaryEffects *tempEffects; - uint32_t extraout_EAX_03; - Color *spriteColor; - EntityRef *sourceRef; - PersistentGameData *entityList; - AnimationState *animState; - Camera *camera; - Entity_Projectile *projectile; - int iVar15; - int iVar16; - uint8_t *layer; - uint8_t *puVar17; - ANM2 *pAVar18; - long double fVar19; - float fVar20; - float fVar21; - uint8_t auVar22 [12]; - uint8_t auVar23 [16]; - uint8_t extraout_var_00 [12]; - uint8_t auVar24 [16]; - uint8_t auVar25 [16]; - uint8_t auVar26 [16]; - float fVar27; - float in_XMM3_Da; - uint32_t in_stack_fffffc50; - uint32_t in_stack_fffffc54; - uint32_t in_stack_fffffc58; - uint32_t in_stack_fffffc5c; - Entity_NPC *source; - uint32_t uVar28; - TypeDescriptor *pTVar29; - TypeDescriptor *pTVar30; - uint8_t damageSource; - ProjectileParams *pPVar31; - KColor *src; - uint32_t uVar32; - uint32_t uVar33; - Vector healTargetPos; - Vector healEffectPos; - Vector local_364; - Vector local_35c; - Vector local_354; - Vector local_34c; - Vector local_344; - Vector local_33c; - Vector local_334; - Vector local_32c; - float randomLength; - Vector local_320; - uint8_t local_318 [16]; - Vector local_308; - Vector local_300; - Vector local_2f8; - Vector local_2f0; - Vector local_2e8; - Vector local_2e0; - Entity *local_2d8; - uint8_t isDeadBefore; - Vector local_2d0; - Room *local_2c4; - Entity *local_2c0; - Entity_NPC *npc; - Vector local_2b8; - Entity *local_2b0; - Room *local_2ac; - uint8_t local_2a5; - Entity_Effect *local_2a4; - ANM2 *local_2a0; - Room *local_29c; - Vector local_298; - Entity *local_290; - Entity_Effect *local_28c; - Room *local_288; - uint8_t local_281; - Color local_254; - ProjectileParams projectileParams; - Color spriteColorCopy; - Color local_150; - Color local_124; - Color local_f8; - uint8_t local_cc [44]; - uint8_t local_a0 [60]; - char local_64 [4]; - uint8_t local_60 [8]; - float local_58; - Vector local_54; - uint8_t local_4c [20]; - KColor local_38; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - void **aimTargetSlot; - char *deathAnim; - uint64_t entityFlags; - uint32_t *flagsHighPtr; - Game *game; - bool isMyShadowCharger; - short regenTimer; - - puStack_20 = local_4c + 0x48; - local_14 = 0xffffffff; - puStack_18 = &LAB_00afaabc; - local_1c = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((local_4c + 0x3c)); - local_2a4 = GHIDRA_CAST(0x0); - local_28c = GHIDRA_CAST(0x0); - if (this->_exists == 0) { - return; - } - ExceptionList = &local_1c; - npc = this; - local_24 = uVar4; - fVar20 = compute_speed_multiplier(this); - this->_speedMultiplier = fVar20; - UpdateChildEffectPosition(this,0); - if (this->_controllerID == -1) { - aimTargetSlot = &this->_aimTargetEffect; - (this->_controllerMovement).x = g_vectorZero.x; - (this->_controllerMovement).y = g_vectorZero.y; - if (*aimTargetSlot != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*aimTargetSlot) + 0x28))(uVar4); - if (*aimTargetSlot != (void *)0x0) { - local_288 = GHIDRA_CAST(aimTargetSlot); - msvc::multiset::erase(&local_288); - } - *aimTargetSlot = (void *)0x0; - } - } - if ((this->_flags & 0x2000000000000) != 0) { - update_frozen(); - ExceptionList = local_1c; - return; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); - if ((((bVar2 != 0) && ((this->_flags & 0x20000000) == 0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsActiveEnemy(0), bVar2 != 0)) && - (bVar2 = TemporaryEffects::HasNullEffect - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)),0x40), bVar2 != 0)) { - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddWeakness(GHIDRA_CAST(local_4c),-3); - } - iVar16 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))); - if ((iVar16 != 0) && (*GHIDRA_CAST((iVar16 + 0x3c4)) == this)) { - *GHIDRA_CAST((iVar16 + 0x33c)) = (this->_pos).x; - *GHIDRA_CAST((iVar16 + 0x340)) = (this->_pos).y; - iVar16 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))); - *GHIDRA_CAST((iVar16 + 0x360)) = (this->_velocity).x; - *GHIDRA_CAST((iVar16 + 0x364)) = (this->_velocity).y; - } - if (((this->_type == 0x17) && (this->_variant == 0)) && (this->_subtype == 1)) { - isMyShadowCharger = true; - } - else { - isMyShadowCharger = false; - } - local_290 = GHIDRA_CAST(0x0); - if (this->_championColorIdx == 0x16) { - local_290 = GHIDRA_CAST(0xb6757c); -LAB_006c4d15: - iVar16 = 1; - } - else { - iVar16 = 0; - if (this->_championColorIdx == 0x17) { - local_290 = GHIDRA_CAST(0xb67584); - goto LAB_006c4d15; - } - } - entityFlags = this->_flags; - if (((entityFlags & 0x100) == 0) || (isMyShadowCharger)) { - if ((this->_flags & 0x100000000000000) != 0) { - local_290 = GHIDRA_CAST(0xb67638); - goto LAB_006c4f0d; - } - if ((this->_flags & 0x8000000000000) != 0) { - local_290 = GHIDRA_CAST(0xb67648); - goto LAB_006c4f0d; - } - if ((this->_flags & 0x10000000000000) != 0) { - local_290 = GHIDRA_CAST(&DAT_00b67654); - iVar16 = 0; - goto LAB_006c4f12; - } - if ((entityFlags & 0x200) != 0) { - local_290 = GHIDRA_CAST(0xb67610); - goto LAB_006c4f0d; - } - if ((entityFlags & 0x1000) != 0) { - local_290 = GHIDRA_CAST(0xb67618); - iVar16 = 0; - goto LAB_006c4f12; - } - if ((entityFlags & 0x40) != 0) { - local_290 = GHIDRA_CAST(0xb67620); - goto LAB_006c4f0d; - } - if ((entityFlags & 0x800) != 0) { - local_290 = GHIDRA_CAST(&DAT_00b67628); - goto LAB_006c4f0d; - } - if ((this->_flags & 0x400000000) != 0) { - local_290 = GHIDRA_CAST(0xb67690); - goto LAB_006c4f0d; - } - if (((entityFlags & 0x80) != 0) || - ((((bVar2 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)),0xe8), bVar2 != 0 || - (bVar2 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)),0x42), bVar2 != 0)) - || ((g_game->_challenge != 0x16 && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1210)) == 1)))) && - (((this->_flags & 0x20000001) == 0 || (this->_type == 0xd4)))))) { - local_290 = GHIDRA_CAST(&DAT_00b6769c); - goto LAB_006c4f0d; - } - if ((this->_flags & 0x40000000000000) != 0) { - local_290 = GHIDRA_CAST(0xb676a4); - goto LAB_006c4f0d; - } - if (this->_type == 0x3c6) { - local_290 = GHIDRA_CAST(0xb676b0); - goto LAB_006c4f0d; - } - if (local_290 != GHIDRA_CAST(0x0)) goto LAB_006c4f12; - if ((this->_statusEffectSprite)._animState._animData != (void *)0x0) { - (this->_statusEffectSprite)._animState._isPlaying = 0; - } - } - else { - local_290 = GHIDRA_CAST(0xb67630); -LAB_006c4f0d: - iVar16 = 1; -LAB_006c4f12: - if ((this->_statusEffectSprite)._loaded == 0) { - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/StatusEffects.anm2")); - local_14 = 0; - ANM2::Load(&this->_statusEffectSprite,GHIDRA_CAST((local_4c + 0x10)),1); - local_14 = 0xffffffff; - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::_Tidy_deallocate(); - } - bVar2 = ANM2::IsPlaying(&this->_statusEffectSprite,&s_empty); - if ((bVar2 != 0) && ((this->_statusEffectSprite)._loaded != 0)) { - AnimationState::Update(&(this->_statusEffectSprite)._animState); - AnimationState::Update(&(this->_statusEffectSprite)._overlayAnimState); - } - ANM2::Play(&this->_statusEffectSprite,GHIDRA_CAST(local_290),0); - (this->_statusEffectSprite)._bitflags = iVar16 << 0x1f; - } - iVar16 = this->_pauseTimer; - if ((iVar16 == 0) && ((this->_flags & 0x200000000000000) == 0)) { - isDeadBefore = this->_dead; - } - else { - if (((this->_pausePosition).x == g_vectorZero.x) && ((this->_pausePosition).y == g_vectorZero.y) - ) { - (this->_pausePosition).x = (this->_pos).x; - (this->_pausePosition).y = (this->_pos).y; - iVar16 = this->_pauseTimer; - } - if ((0 < iVar16) && (this->_pauseTimer = iVar16 + -1, 0 < iVar16 + -1)) { - (this->_pos).x = (this->_pausePosition).x; - (this->_pos).y = (this->_pausePosition).y; - } - (this->_velocity).x = (this->_velocity).x * 0.6; - (this->_velocity).y = (this->_velocity).y * 0.6; - local_281 = this->_dead; - spawn_damage_numbers(this); - update_damage_history(this); - if ((this->_aiCallFlags & 1) != 0) { - this->_aiCallPhase = 1; - Entity_NPC_UpdateAI_dispatch(this); - this->_aiCallPhase = 0; - } - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - local_288 = GHIDRA_CAST(this->_health); - if ((uVar4 & 1) == 0) { - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(this->_flags); - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar4 ^ 1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(this->_flags); - flagsHighPtr = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHighPtr = *flagsHighPtr ^ 1; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - } - local_288 = GHIDRA_CAST(((float)local_288 - this->_health)); - local_2ac = GHIDRA_CAST(0x0); - clampedValue = GHIDRA_CAST(std)::max(); - isDeadBefore = this->_dead; - this->_totalDamageTaken = *clampedValue + this->_totalDamageTaken; - if (local_281 == isDeadBefore) { - ExceptionList = local_1c; - return; - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(4); - iVar16 = this->_state; - if (bVar2 == 0) { - if (iVar16 != 1) goto LAB_006c58e9; - this->_state = this->_savedState; - } - else if (iVar16 == 1) { - iVar16 = this->_appearFrames; - if (iVar16 == 0) { - this->_state = 0; - if (this->_championColorIdx == 6) { - this->_isInvicible = 1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(1); - } - Entity_NPC_UpdateAI_dispatch(this); - if ((this->_championColorIdx == 0x11) || (this->_championColorIdx == 0x19)) { - uVar4 = Random(); - pEVar7 = Game::Spawn(g_game,0x60,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - (GHIDRA_CAST((pEVar7)))->Entity::SetParent(GHIDRA_CAST(this)); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(4); - if (bVar2 != 0) { - this->_visible = 0; - this->_savedState = this->_state; - this->_state = 1; - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - bVar2 = PlayerManager::AnyoneHasTrinket(playerManager,0x35); - if ((((bVar2 != 0) && (this->_type != 0x112)) && (this->_type != 0x113)) && - (60.0 < this->_health)) { - iVar15 = 0; - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - iVar16 = PlayerManager::GetTrinketMultiplier(playerManager,0x35); - if (0 < iVar16) { - do { - game = g_game; - iVar15 = iVar15 + 1; - this->_health = this->_health * 0.85; - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(game); - iVar16 = PlayerManager::GetTrinketMultiplier(playerManager,0x35); - } while (iVar15 < iVar16); - } - } - layer = GHIDRA_CAST(0x0); - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayerCount(); - if (iVar16 != 0) { - do { - local_288 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::GetLayer(layer); - psVar6 = GHIDRA_CAST(_get_name_string(local_64)); - local_14 = 1; - local_2a4 = GHIDRA_CAST((GHIDRA_UINT(local_28c) | 1)); - local_28c = local_2a4; - bVar2 = str_eq_cstr(psVar6,&DAT_00b64428); - if (bVar2 == 0) { - psVar6 = GHIDRA_CAST(_get_name_string(local_4c + 0x10)); - local_14 = 2; - local_2a4 = GHIDRA_CAST((GHIDRA_UINT(local_28c) | 2)); - local_28c = local_2a4; - bVar2 = str_eq_cstr(psVar6,&DAT_00b1d57c); - local_281 = 0; - if (bVar2 != 0) goto LAB_006c5358; - } - else { -LAB_006c5358: - local_281 = 1; - } - if ((GHIDRA_UINT(local_28c) & 2) != 0) { - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) & 0xfffffffd)); - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::_Tidy_deallocate(); - } - local_14 = 0xffffffff; - if ((GHIDRA_UINT(local_28c) & 1) != 0) { - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) & 0xfffffffe)); - (GHIDRA_CAST((local_64)))->msvc::string::_Tidy_deallocate(); - } - if (local_281 != 0) { - UpdateDirtColor(this,1); - break; - } - layer = layer + 1; - layerCount = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::GetLayerCount(); - } while (layer < layerCount); - } - cVar3 = this->IsBoss(); - if ((cVar3 != '\0') && (iVar16 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Parent(), iVar16 == 0)) { - Game::AddEncounteredBoss(g_game,this->_type,this->_variant); - } - } - else if (iVar16 == 1) { - uVar4 = 2; - if (this->_size < 13.0) { - uVar4 = 1; - } - if ((18.0 <= this->_size) || (30.0 < this->_shadowSize)) { - uVar4 = 3; - } - uVar13 = Random(); - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),uVar4,uVar13); - pRVar10 = GHIDRA_CAST(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33)); - local_288 = pRVar10; - (GHIDRA_CAST((GHIDRA_CAST(pRVar10))))->Entity::SetPositionOffset(&this->_posOffset); - set_field_358(pRVar10,(this->_posOffset).y + 1.0); - if ((this->_isChampion != 0) && (GHIDRA_UINT(this->_championColorIdx) < 0x1a)) { - pcVar1 = *(code **)(*GHIDRA_CAST(pRVar10) + 0x3c); - uVar28 = _Entity_NPC::GetColorWithFlash(local_a0); - (*pcVar1)(uVar28,0xffffffff,0xff,0,1); - } - iVar16 = 0x11e; - cVar3 = FUN_006b8490(); - if (cVar3 != '\0') { - iVar16 = 0x368; - } - sfx = MusicManager::SFXManager(); - SFXManager::Stop(sfx,iVar16); - PlaySound(this,iVar16,1.0,2,0,1.0); - iVar16 = this->_type; - if (iVar16 == 0x191) { - SoundEffects::PlayWithFartOverride(0x40,1.0,2,0,1.0); - PlaySound(this,0x1a3,1.0,2,0,1.0); - } - else if (iVar16 == 0x193) { - PlaySound(this,0x1a1,1.0,2,0,1.0); - } - else if ((iVar16 == 0x19b) && (this->_variant == 0)) { - PlaySound(this,0xe,2.0,2,0,1.0); - } - } - else if (iVar16 == 4) { - if (this->_type != 0x3e) { - this->_visible = 1; - } - pvVar8 = ANM2::GetAnimationData(&this->_sprite,GHIDRA_CAST("Appear")); - if (pvVar8 != (void *)0x0) { - if (this->_type != 0x10a) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RemoveOverlay(); - } - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),1); - } - } - else { - if (iVar16 < 0x14) { -LAB_006c56aa: - local_281 = 0; - } - else { - bVar2 = ANM2::IsFinishedImpl(&this->_sprite,GHIDRA_CAST("Appear")); - if ((bVar2 == 0) && - (pvVar8 = ANM2::GetAnimationData(&this->_sprite,GHIDRA_CAST("Appear")), pvVar8 != (void *)0x0) - ) { - (GHIDRA_CAST((local_64)))->msvc::string::string_from_cstr(GHIDRA_CAST("Appear")); - local_14 = 3; - local_2a4 = GHIDRA_CAST(&DAT_00000004); - pAVar18 = GHIDRA_CAST(Config)::GetPillEffects(); - ANM2::GetAnimation(pAVar18,GHIDRA_CAST((local_4c + 0x10))); - local_28c = GHIDRA_CAST(0xc); - cVar3 = FUN_0040c7c0(); - if (cVar3 == '\0') goto LAB_006c56aa; - } - local_281 = 1; - } - if ((GHIDRA_UINT(local_28c) & 8) != 0) { - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) & 0xfffffff7)); - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::_Tidy_deallocate(); - } - local_14 = 0xffffffff; - if ((GHIDRA_UINT(local_28c) & 4) != 0) { - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) & 0xfffffffb)); - (GHIDRA_CAST((local_64)))->msvc::string::_Tidy_deallocate(); - } - if (local_281 != 0) { - this->_state = this->_savedState; - this->_friction = this->_baseFriction; - } - } - iVar16 = this->_type; - if (iVar16 == 0x391) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - if (bVar2 == 0) { - iVar16 = this->_type; - goto LAB_006c5752; - } - PlaySound(this,0x1e3,1.0,2,0,1.0); - } - else { -LAB_006c5752: - if (((iVar16 == 0x390) && (this->_variant == 0x14)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"), bVar2 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_a0))))->Color::Color(); - Game::SpawnParticles(g_game,&this->_pos,4,5,6.0,color,100000.0,0x20000); - } - else { - iVar16 = this->_type; - if (iVar16 == 0x395) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered(s_Land); - if (bVar2 != 0) { - Game::ShakeScreen(g_game,8); - this->_entityCollisionClass = 4; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::MakeBloodPoofAtPos(&this->_splatColor,1.0); - tmpVec = (GHIDRA_CAST((&local_2e0)))->Vector::Vector(100.0,60.0); - in_XMM3_Da = 1.0; - spawn_rock_particles(&this->_pos,tmpVec); - play_sound_with_fart_seed(0x30,1.0,2,0,1.0); - goto LAB_006c58bd; - } - iVar16 = this->_type; - } - if (iVar16 == 0x194) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("HoleOpen"); - if (bVar2 != 0) { - SoundEffects::PlayWithFartOverride(0x3b3,1.0,2,0,1.0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("HoleExit"); - if (bVar2 != 0) { - SoundEffects::PlayWithFartOverride(0x3b4,1.0,2,0,1.0); - } - } - } - } -LAB_006c58bd: - if (this->_state == 1) { - this->_friction = this->_friction * 0.01; - } - this->_appearFrames = this->_appearFrames + 1; - } - else { -LAB_006c58e9: - if ((iVar16 != 0x12) && (iVar16 != 0x11)) goto LAB_006c68c7; - fVar20 = this->_friction * 0.01; - auVar23 = ZEXT416(GHIDRA_UINT(fVar20)); - this->_friction = fVar20; - if (this->_stateFrame == 0) { - if (iVar16 == 0x11) { - iVar16 = this->_type; - if ((((iVar16 == 0xd9) || (iVar16 == 0xdc)) || (iVar16 == 0xdf)) || - (((((iVar16 == 0x105 || (iVar16 == 0x192)) || - ((iVar16 == 0x366 || ((iVar16 == 0x367 || (iVar16 == 0x392)))))) || (iVar16 == 0x368)) - || ((iVar16 == 0xed && (this->_variant == 2)))))) { - pAVar18 = &this->_sprite; - local_2a0 = pAVar18; - pvVar8 = ANM2::GetAnimationData(pAVar18,GHIDRA_CAST("Flush")); - if (pvVar8 != (void *)0x0) { - ANM2::Play(pAVar18,GHIDRA_CAST("Flush"),0); - iVar16 = this->_state; - this->_renderZOffset = 5000; - goto LAB_006c59c4; - } - this->_state = 0x12; - goto LAB_006c59d3; - } - } - else { -LAB_006c59c4: - local_2a0 = &this->_sprite; - if (iVar16 == 0x12) { -LAB_006c59d3: - pAVar18 = &this->_sprite; - pvVar8 = ANM2::GetAnimationData(pAVar18,GHIDRA_CAST("Death")); - iVar16 = this->_type; - if (pvVar8 == (void *)0x0) { - if (iVar16 == 0x1c) { - iVar16 = this->_i1; - if (iVar16 == 0) { - deathAnim = "DeathHead"; -LAB_006c5b7b: - ANM2::Play(pAVar18,GHIDRA_CAST(deathAnim),0); - } - else { - if (iVar16 == 1) { - deathAnim = "DeathBody01"; - goto LAB_006c5b7b; - } - if (iVar16 == 2) { - deathAnim = "DeathBody02"; - goto LAB_006c5b7b; - } - } - iVar16 = ANM2::GetFrame(pAVar18); - if (iVar16 == 3) { - PlaySound(this,0x74,1.0,2,0,1.0); - } - } - else if ((iVar16 == 0x13) || (iVar16 == 0x396)) { - deathAnim = "DeathBody01"; - if (this->_parent == 0) { - deathAnim = "DeathHead"; - } - ANM2::Play(pAVar18,GHIDRA_CAST(deathAnim),0); - } - else if (iVar16 == 0x3e) { - if (this->_parent == 0) { - ANM2::Play(pAVar18,GHIDRA_CAST("DeathHead"),0); - } - else if (this->_child == 0) { - this->Remove(); - } - else { - ANM2::Play(pAVar18,GHIDRA_CAST("DeathBody01"),0); - } - } - else if (((iVar16 != 0x4a) && (iVar16 != 0x4b)) && (iVar16 != 0x4c)) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); - trigger_kill_item_effects(this); - } - } - else if (iVar16 == 0x19b) { - if (this->_variant == 1) { - local_288 = GHIDRA_CAST(ANM2)::GetLayer(pAVar18,&DAT_00b6767c); - if (local_288 == GHIDRA_CAST(0x0)) { - local_2a0 = pAVar18; - } - else { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar16 = _ptr_deref_or_minus1(); - pvVar8 = AnimationState::GetLayerFrame(animState,iVar16); - if ((pvVar8 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x2c)) != '\0')) { - ANM2::Play(local_2a0,GHIDRA_CAST("HandDeath"),0); - goto LAB_006c5c3e; - } - } - ANM2::Play(local_2a0,GHIDRA_CAST("SmallHoleClose"),0); - } - else if (this->_variant == 2) { - FUN_0044bf90(0); - } - else { - pAVar12 = GHIDRA_CAST(Config)::GetPillEffects(); - psVar6 = ANM2::GetAnimation(pAVar12,GHIDRA_CAST((local_4c + 0x10))); - local_14 = 4; - local_281 = str_ne(psVar6,GHIDRA_CAST("BigHoleClose")); - local_14 = 0xffffffff; - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::_Tidy_deallocate(); - if (local_281 != 0) { - ANM2::Play(pAVar18,GHIDRA_CAST("Death"),0); - } - } - } - else { - if (iVar16 == 0x195) { - local_29c = GHIDRA_CAST(ANM2)::GetLayer(pAVar18,s_Head); - if (local_29c != GHIDRA_CAST(0x0)) { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar16 = _ptr_deref_or_minus1(); - pvVar8 = AnimationState::GetLayerFrame(animState,iVar16); - if ((pvVar8 == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x2c)) == '\0')) { - bVar2 = 0; - } - else { - bVar2 = 1; - } - *GHIDRA_CAST((local_29c->_gridEntities + 0x14)) = bVar2; - pAVar18 = local_2a0; - } - } - ANM2::Play(pAVar18,GHIDRA_CAST("Death"),0); - } - } - } - } -LAB_006c5c3e: - iVar16 = this->_type; - iVar15 = this->_stateFrame + 1; - this->_stateFrame = iVar15; - if (iVar16 == 0x66) { - if ((this->_variant != 2) && (iVar15 == 0x11)) { - PlaySound(this,0x10a,2.0,2,0,1.0); - iVar16 = this->_type; - goto LAB_006c5c89; - } - } - else { -LAB_006c5c89: - if (iVar16 == 0x38c) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - if (bVar2 != 0) { - SoundEffects::PlayWithFartOverride(0x48,1.0,2,0,1.0); - } - bVar2 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if ((bVar2 != 0) && (this->_dead != 0)) { - (GHIDRA_CAST((&projectileParams)))->ProjectileParams::ProjectileParams(); - pPVar31 = &projectileParams; - projectileParams.FallingAccelModifier = projectileParams.FallingAccelModifier - 0.099; - auVar23 = ZEXT416(GHIDRA_UINT(projectileParams.FallingAccelModifier)); - uVar4 = 9; - tmpVec = (GHIDRA_CAST((&local_2e0)))->Vector::Vector(6.0,10.0); - FireProjectiles(this,&this->_pos,tmpVec,uVar4,pPVar31); - } - } - else if (iVar16 == 0x38b) { - NpcHelper::gideon_update_death(this); - } - else if (iVar16 == 900) { - FUN_0041e470(); - cVar3 = FUN_004073a0(); - if (cVar3 == '\0') { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RemoveOverlay(); - } - } - else if (iVar16 == 0x393) { - bVar2 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if ((bVar2 != 0) && (this->_dead != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_a0))))->Color::Color(); - damageSource = 0; - uVar33 = 0; - uVar28 = 4; - bVar2 = 1; - fVar20 = 1.5; - tmpColor = extraout_EAX; - source = this; - FUN_00435bc0(0,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = in_stack_fffffc54; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = in_stack_fffffc50; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = in_stack_fffffc58; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = in_stack_fffffc5c; - Game::BombExplosionEffects - (g_game,&this->_pos,80.0,tearFlags,tmpColor,GHIDRA_CAST(source),fVar20,bVar2, - CONCAT44(uVar33,uVar28),damageSource); - } - } - else if (iVar16 == 0x391) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); - if ((bVar2 != 0) && - (local_2a4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetNullFrame(GHIDRA_CAST("BloodGuide")), - local_2a4 != GHIDRA_CAST(0x0))) { - uVar4 = Random(); - Game::Spawn(g_game,1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar4); - piVar14 = GHIDRA_CAST(FUN_004a2920()); - FUN_004563c0(local_2a4); - (**(code **)(*piVar14 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); - SoundEffects::PlayWithFartOverride(0x1e,1.0,2,0,1.0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar16 = AnimationState::GetAnimationLength(animState); - iVar15 = ANM2::GetFrame(&this->_sprite); - if (iVar16 + -1 <= iVar15) { - SoundEffects::PlayWithFartOverride(0x105,1.0,2,0,1.0); - uVar4 = Random(); - Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - FUN_004563c0(local_2a4); - in_XMM3_Da = 0.0; - uVar32 = 0; - uVar33 = 3; - uVar28 = 3; - (GHIDRA_CAST((GHIDRA_CAST(local_60))))->KColor::KColor(1.0,0.6,0.0,1.0); - pEVar7 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_pos))))->Entity)::AddFear(uVar28,uVar33,uVar32); - tmpVec = GHIDRA_CAST(FUN_0067f2e0()); - (GHIDRA_CAST((pEVar7)))->Entity::SetPositionOffset(tmpVec); - sprite = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - (GHIDRA_CAST((sprite)))->Sprite::SetFrame_1(1); - (GHIDRA_CAST((&local_38)))->BlendMode::SetMode(2,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - src = &local_38; - firstLayer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(firstLayer->_blendMode,src); - } - } - } - else if (iVar16 == 0x390) { - if ((this->_variant == 10) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"), bVar2 != 0)) { - Game::ShakeScreen(g_game,0x14); - play_sound_with_fart_seed(0x1d,1.0,2,0,0.5); - } - } - else if ((iVar16 == 0x399) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Explosion"), bVar2 != 0)) - { - uVar4 = Random(); - pEVar7 = Game::Spawn(g_game,1000,0x90,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar4); - tmpVec = (GHIDRA_CAST((&local_2e0)))->Vector::Vector(0.0,-20.0); - (GHIDRA_CAST((pEVar7)))->Entity::SetPositionOffset(tmpVec); - sprite = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - fVar20 = random_float(); - (GHIDRA_CAST((sprite)))->Sprite::SetRotation(fVar20 * 360.0); - sprite = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - local_288 = GHIDRA_CAST(0x3fc00000); - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_2e0,GHIDRA_CAST(&local_288)); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(tmpVec); - pEVar7->SetCollisionDamage(0x42a00000); - pEVar7->Update(); - fVar20 = random_float(); - this = npc; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))) = fVar20 * 0.2 + 0.9; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x4))) = extraout_var_00; - play_sound_with_fart_seed(0x1dd,1.25,2,0,(*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0)))); - Game::ShakeScreen(g_game,0xe); - } - } - sprite = GHIDRA_CAST(&this->_sprite); - local_29c = (GHIDRA_CAST((sprite)))->Sprite::GetNullFrame(GHIDRA_CAST("BloodGuide")); - if (local_29c != GHIDRA_CAST(0x0)) { - update_blood_guide_gibs(this,GHIDRA_CAST(local_29c)); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x10000); - if (((bVar2 == 0) && - ((iVar16 = PlayerManager::GetGFuelCount(), 2 < iVar16 || - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsType(0x38c,-1,-1), bVar2 != 0 && - ((this->_initSeed & 0xfffffU) == 0xdedbb)))))) && - (((this->_initSeed & 1) == 0 || - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsType(0x38c,-1,-1), bVar2 != 0)))) { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar16 = AnimationState::NextEventTrigger(animState,GHIDRA_CAST("Explosion")); - _empty_check_0x34(); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))) + 10.0 <= (float)iVar16) { - fVar19 = (long double)(GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::PlaybackSpeed(); - local_288 = GHIDRA_CAST(((float)fVar19 * this->_speedMultiplier)); - auVar23 = ZEXT416(local_288); - _empty_check_0x34(); - if ((float)iVar16 < (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))) + (float)local_288 + 10.0) { - uVar4 = Random(); - pEVar7 = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0xb,uVar4); - pAVar18 = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - msvc::string::string_from_cstr - (local_4c + 0x10,GHIDRA_CAST("gfx/promo/gfuel/effects/explosion_delayed.anm2")); - local_14 = 5; - ANM2::Load(pAVar18,GHIDRA_CAST((local_4c + 0x10)),1); - local_14 = 0xffffffff; - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::_Tidy_deallocate(); - sprite = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - pSVar5 = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - psVar6 = GHIDRA_CAST((GHIDRA_CAST((pSVar5)))->Sprite)::GetDefaultAnimationName(); - (GHIDRA_CAST((sprite)))->Sprite::Play(psVar6,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - iVar16 = Isaac::Random(2); - (GHIDRA_CAST((sprite)))->Sprite::set_flip_x(iVar16 == 0); - sprite = GHIDRA_CAST((GHIDRA_CAST((pEVar7)))->Entity)::GetSprite(); - local_288 = GHIDRA_CAST(0x3fc00000); - tmpVec = Vector::operator_mul(&local_2e0,GHIDRA_CAST(&local_288),&g_vectorOne); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(tmpVec); - pEVar7->Update(); - this = npc; - (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::AddEntityFlags(0x10000); - } - } - sprite = GHIDRA_CAST(&this->_sprite); - } - bVar2 = (GHIDRA_CAST((sprite)))->Sprite::IsEventTriggered("Explosion"); - if (bVar2 != 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x10000); - if (bVar2 == 0) { - fVar20 = this->_size; - uVar4 = 2; - if (fVar20 < 13.0) { - uVar4 = 1; - } - if ((18.0 <= fVar20) || (30.0 < this->_shadowSize)) { - uVar4 = 3; - } - if ((40.0 <= fVar20) || (50.0 < this->_shadowSize)) { - uVar4 = 4; - } - iVar16 = PlayerManager::GetGFuelCount(); - if (iVar16 < 1) { - uVar13 = Random(); - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),uVar4,uVar13) - ; - piVar14 = GHIDRA_CAST(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33)); - FUN_004563c0(local_29c); - (**(code **)(*piVar14 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); - cVar3 = this->IsBoss(); - if (((cVar3 != '\0') && (cVar3 = FUN_00435880(4), cVar3 != '\0')) && - ((this->_type != 0x3e || (this->_parent == 0)))) { - uVar4 = Random(); - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,0x4d,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4 - ); - piVar14 = GHIDRA_CAST(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33)); - (**(code **)(*piVar14 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); - } - } - else { - spawn_gfuel_explosion(); - cVar3 = this->IsBoss(); - if (((cVar3 != '\0') && (cVar3 = FUN_00435880(4), cVar3 != '\0')) && - ((this->_type != 0x3e || (this->_parent == 0)))) { - spawn_gfuel_explosion(); - } - } - } - if (this->_type == 0x4e) { - (GHIDRA_CAST((&projectileParams)))->ProjectileParams::ProjectileParams(); - pPVar31 = &projectileParams; - uVar4 = 9; - (*GHIDRA_CAST((GHIDRA_CAST(&(projectileParams)) + 0x4))) = 0x40a00000; - projectileParams.Scale = 1.5; - projectileParams.FallingAccelModifier = -0.06; - projectileParams.FallingSpeedModifier = -2.0; - tmpVec = (GHIDRA_CAST((&local_2e0)))->Vector::Vector(5.0,14.0); - FireProjectiles(this,&this->_pos,tmpVec,uVar4,pPVar31); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsType(0x10d,1,-1); - if (bVar2 != 0) { - iVar16 = Isaac::Random(0xc); - local_2c4 = GHIDRA_CAST((iVar16 + 0xc)); - if (0 < GHIDRA_INT(local_2c4)) { - do { - tmpVec = MusicManager::RandomVector(&local_2e0); - fVar20 = random_float(); - local_288 = GHIDRA_CAST((fVar20 * 5.0)); - (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_298,GHIDRA_CAST(&local_288)); - local_2c0 = GHIDRA_CAST(Random()); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Position(&local_2e8); - tmpVec2 = MusicManager::RandomVector(&local_2d0); - fVar20 = random_float(); - local_2ac = GHIDRA_CAST((fVar20 * 20.0)); - tmpVec2 = (GHIDRA_CAST((tmpVec2)))->Vector::__mul(&local_300,GHIDRA_CAST(&local_2ac)); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__add(&local_2b8,tmpVec2); - this = npc; - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,0x3b,tmpVec,&local_298,GHIDRA_CAST(npc),0, - GHIDRA_UINT(local_2c0)); - local_2a4 = GHIDRA_CAST(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33)); - local_2b0 = GHIDRA_CAST(0x3f800000); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_2a4))))->Entity::Position(&local_2f0); - tmpVec2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Position(&local_308); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__sub(&local_320,tmpVec2); - tmpVec2 = (GHIDRA_CAST((&local_33c)))->Vector::Vector(local_298.y,-local_298.x); - local_2c0 = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Dot(tmpVec2); - pEVar9 = local_2a4; - if ((float)local_2c0 < 0.0) { - local_2b0 = GHIDRA_CAST(&DAT_bf800000); - } - FUN_004563c0(local_29c); - fVar20 = random_float(); - (GHIDRA_CAST((pEVar9)))->Entity_Effect::set_rotation((fVar20 * 10.0 + 2.0) * (float)local_2b0); - iVar16 = Isaac::Random(0xf); - (GHIDRA_CAST((pEVar9)))->Entity_Effect::SetTimeout(iVar16 + 0xf); - uVar32 = 0; - uVar33 = 0; - uVar28 = 0; - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar9) + 0x3c); - fVar20 = random_float(); - in_XMM3_Da = 1.0; - uVar28 = (GHIDRA_CAST((fVar20 * 0.5 + 0.2)))->Color::Color(uVar28,uVar33,uVar32); - (*pcVar1)(uVar28,0xffffffff,0xff,0,1); - local_2a4->Update(); - local_2c4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_2c4[-1])) + 0x7897)))); - } while (local_2c4 != GHIDRA_CAST(0x0)); - } - } - this->_shadowSize = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); - sprite = GHIDRA_CAST(&this->_sprite); - } - } - if (((this->_type == 0x197) && - (bVar2 = (GHIDRA_CAST((sprite)))->Sprite::IsEventTriggered(&DAT_00b6774c), bVar2 != 0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000000000000000), bVar2 == 0)) { - uVar4 = Random(); - pEVar7 = Game::Spawn(g_game,1000,100,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - if (pEVar7 != GHIDRA_CAST(0x0)) { - pEVar7->Update(); - } - Game::ShakeScreen(g_game,0x1e); - SoundEffects::PlayWithFartOverride(0x10a,1.0,2,0,1.0); - } - bVar2 = ANM2::IsFinishedImpl(GHIDRA_CAST(sprite),&s_empty); - if ((bVar2 != 0) && (this->_exists != 0)) { - trigger_kill_item_effects(this); - } - } -LAB_006c68c7: - if (((this->_state == 0x12) || (this->_state == 0x11)) || - (((cVar3 = FUN_006c4a90(), cVar3 != '\0' || (this->_state == 1)) && (this->_dead == 0)))) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20); - if (((bVar2 != 0) || (0 < this->_holdCountdown)) && - (this->_friction = this->_friction * 0.01, 0 < this->_holdCountdown)) { - bVar2 = (GHIDRA_CAST((&this->_holdPosition)))->Vector::operator_ne(&g_vectorZero); - if (bVar2 != 0) { - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(&this->_holdPosition); - } - } -LAB_006c87a7: - if (this->_dead == 0) goto LAB_006c87b4; - } - else { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); - if (bVar2 == 0) { - if (this->_decoyTargetTimer < 0xb5) { - if (this->_decoyTargetTimer < -0xb4) { - this->_decoyTargetTimer = 0; - } - } - else { - this->_decoyTargetTimer = -1; - } - pEVar7 = GetPlayerTarget(this); - iVar16 = (GHIDRA_CAST((pEVar7)))->Entity::Type(); - if ((iVar16 == 3) && (iVar16 = (GHIDRA_CAST((pEVar7)))->Entity::Variant(), iVar16 == 0x43)) { - this->_decoyTargetTimer = this->_decoyTargetTimer + 1; - } - else if (this->_decoyTargetTimer != 0) { - this->_decoyTargetTimer = this->_decoyTargetTimer + -1; - } - } - if ((this->_dead != 0) && (this->_state == 1)) { - this->_friction = this->_baseFriction; - this->_state = this->_savedState; - this->_visible = 1; - } - if (this->_championRegenTimer == 0) { - Entity_NPC_UpdateAI_dispatch(this); - } - local_2d8 = GHIDRA_CAST(&this->_sprite); - pvVar8 = (GHIDRA_CAST((GHIDRA_CAST(local_2d8))))->Sprite::GetNullFrame(GHIDRA_CAST("OverlayEffect")); - if ((pvVar8 == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0xc)) != '\0')) { - local_281 = 1; - } - else { - local_281 = 0; - } - if ((((this->_championColorIdx == 2) || (this->_championColorIdx == 0x19)) && (local_281 != 0)) - && ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(7,0), bVar2 != 0 && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000000), bVar2 == 0)))) { - uVar4 = Random(); - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,0x17,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - pEVar9 = GHIDRA_CAST(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33)); - (GHIDRA_CAST((pEVar9)))->Entity_Effect::SetTimeout(0x1e); - pEVar9->Update(); - } - if (this->_championColorIdx == 0x18) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((pRVar10)))->Room::is_type_16(); - if ((bVar2 == 0) && (local_281 != 0)) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0); - if (bVar2 != 0) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80e10) && - (_Init_thread_header(&DAT_00c80e10), DAT_00c80e10 == -1)) { - local_14 = 6; - in_XMM3_Da = 0.0; - (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0,0,0,0x3e828f5c,0x3e24dd2f,0x3e0c49ba); - local_14 = 0xffffffff; - _Init_thread_footer(&DAT_00c80e10); - } - fVar20 = random_float(); - pEVar9 = MakeSplat(this,fVar20 * 0.5 + 0.2); - pEVar9->SetColor(&DAT_00c80e14,0xffffffff,0xff,0,1); - } - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_2ac = pRVar10; - local_2c0 = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetGridIndex(&this->_pos); - if (local_2c0 != GHIDRA_CAST(this->_lastGridIndex)) { - iVar16 = Isaac::Random(4); - if ((iVar16 == 0) && (-1 < this->_lastGridIndex)) { - local_288 = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetGridEntity(this->_lastGridIndex); - uVar4 = (GHIDRA_CAST((pRVar10)))->Room::GetGridCollision(this->_lastGridIndex); - if (uVar4 == 0) { - if (local_288 != GHIDRA_CAST(0x0)) { - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(local_288))))->GridEntity::GetType(); - bVar2 = is_grid_type_floor_special(iVar16); - if (bVar2 != 0) goto LAB_006c6bee; - } - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar4 = Random(); - (GHIDRA_CAST((pRVar10)))->Room::SpawnGridEntity(this->_lastGridIndex,0xe,0,uVar4,0); - poop = GHIDRA_CAST((GHIDRA_CAST((local_2ac)))->Room)::GetGridEntity(this->_lastGridIndex); - if ((poop != GHIDRA_CAST(0x0)) && - (iVar16 = (GHIDRA_CAST((GHIDRA_CAST(poop))))->GridEntity::GetType(), iVar16 == 0xe)) { - (GHIDRA_CAST((poop)))->GridEntity_Poop::ReduceSpawnRate(); - FUN_006b8580(1); - FUN_006b8310(0); - } - } - } -LAB_006c6bee: - this->_lastGridIndex = GHIDRA_INT(local_2c0); - } - } - } - if (this->_championColorIdx == 6) { - this->_isInvicible = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(1); - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_2b0 = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetEntities(); - puVar17 = GHIDRA_CAST(0x0); - local_29c = GHIDRA_CAST(0x0); - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(local_2b0))))->EntityList::Size(); - if (iVar16 != 0) { - do { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(puVar17); - pEVar7 = GHIDRA_CAST(*entitySlot); - bVar2 = (GHIDRA_CAST((pEVar7)))->Entity::IsEnemy(); - if (((bVar2 != 0) && (cVar3 = pEVar7->CanShutDoors(), cVar3 != '\0')) && - ((iVar16 = __RTDynamicCast(pEVar7,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0), - *GHIDRA_CAST((iVar16 + 0xc63)) == '\0' || (*GHIDRA_CAST((iVar16 + 0xc64)) != 6)))) { - this->_isInvicible = 1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(1); - } - puVar17 = &(*GHIDRA_CAST((GHIDRA_CAST((local_29c)) + 0x1))); - local_29c = GHIDRA_CAST(puVar17); - puVar11 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_2b0))))->EntityList)::Size(); - } while (puVar17 < puVar11); - } - } - if ((this->_championColorIdx == 9) || (this->_type == 0xfc)) { - switch(this->_flickerState) { - case 0: - iVar16 = this->_flickerTimer; - this->_flickerTimer = iVar16 + -1; - if (iVar16 < 0) { - this->_flickerState = 1; - } - break; - case 1: - if (this->_flickerAlpha <= 0.0) { - this->_flickerState = 3; -LAB_006c6d40: - iVar16 = Isaac::Random(0x1e); - this->_flickerTimer = iVar16 + 0x3c; - } - else { - this->_flickerAlpha = this->_flickerAlpha - 0.05; - } - break; - case 2: - if (1.0 <= this->_flickerAlpha) { - this->_flickerState = 0; - goto LAB_006c6d40; - } - this->_flickerAlpha = this->_flickerAlpha + 0.05; - break; - case 3: - iVar16 = this->_flickerTimer; - this->_visible = 0; - this->_flickerTimer = iVar16 + -1; - if (iVar16 < 0) { - this->_visible = 1; - this->_flickerState = 2; - } - } - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((GHIDRA_CAST(local_a0))))->Color::operator_assign(tmpColor); - Font::SetLineHeightModifier(GHIDRA_CAST(local_a0),this->_flickerAlpha); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(local_a0)); - } - iVar16 = this->_championColorIdx; - if (iVar16 == 8) { - this->_entityGridCollisionClass = 3; - } - else if ((((iVar16 == 10) || (iVar16 == 0x19)) && - (this->_championTimer = this->_championTimer + -1, this->_championTimer < 1)) && - ((local_281 != 0 && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000000), bVar2 == 0)))) { - local_29c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - local_300.x = g_vectorZero.x; - local_300.y = g_vectorZero.y; - if (0.0 < (float)local_29c) { - tmpVec = (GHIDRA_CAST((&this->_velocity)))->Vector::__div(&local_2e0,GHIDRA_CAST(&local_29c)); - (GHIDRA_CAST((&local_300)))->Vector::operator_assign(tmpVec); - iVar16 = Isaac::Random(0x14); - this->_championTimer = iVar16 + 0x28; - (GHIDRA_CAST((&projectileParams)))->ProjectileParams::ProjectileParams(); - pPVar31 = &projectileParams; - projectileParams.FallingAccelModifier = 0.3; - uVar4 = 0; - projectileParams.FallingSpeedModifier = -5.0; - local_288 = GHIDRA_CAST(0x40a00000); - tmpVec = (GHIDRA_CAST((&local_300)))->Vector::__mul(&local_2e0,GHIDRA_CAST(&local_288)); - FireProjectiles(this,&this->_pos,tmpVec,uVar4,pPVar31); - PlaySound(this,0xb2,1.0,2,0,1.0); - } - } - if (((this->_championColorIdx == 0xb) || (this->_championColorIdx == 0x19)) && (local_281 != 0)) - { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_2c4 = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetEntities(); - puVar17 = GHIDRA_CAST(0x0); - local_2b0 = GHIDRA_CAST(0x0); - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(local_2c4))))->EntityList::Size(); - if (iVar16 != 0) { - do { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(puVar17); - pEVar7 = GHIDRA_CAST(*entitySlot); - iVar16 = (GHIDRA_CAST((pEVar7)))->Entity::Type(); - if ((iVar16 == 1) || (iVar16 = (GHIDRA_CAST((pEVar7)))->Entity::Type(), iVar16 == 2)) { - tmpVec = (GHIDRA_CAST((pEVar7)))->Entity::Position(&local_2e0); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_298,tmpVec); - (GHIDRA_CAST((&local_298)))->Vector::Normalize(); - local_2a4 = GHIDRA_CAST(0x3f666666); - iVar16 = (GHIDRA_CAST((pEVar7)))->Entity::Type(); - if (iVar16 == 1) { - local_2a4 = GHIDRA_CAST(0x3f4ccccd); - } - tmpVec = (GHIDRA_CAST((pEVar7)))->Entity::Position(&local_2e8); - tmpVec = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_2d0,tmpVec); - fVar20 = (GHIDRA_CAST((tmpVec)))->Vector::Length(); - local_2ac = GHIDRA_CAST(0x0); - local_288 = GHIDRA_CAST((((300.0 - fVar20) * (float)local_2a4) / 300.0)); - msvc::max(); - clampedValue = GHIDRA_CAST(std)::min(); - (GHIDRA_CAST((&local_298)))->Vector::operator_mul_assign(clampedValue); - (GHIDRA_CAST((pEVar7)))->Entity::AddVelocity_divided(&local_298,0); - } - puVar17 = &(*GHIDRA_CAST((GHIDRA_CAST((local_2b0)) + 0x1))); - local_2b0 = GHIDRA_CAST(puVar17); - puVar11 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_2c4))))->EntityList)::Size(); - } while (puVar17 < puVar11); - } - } - iVar16 = this->_championColorIdx; - if (iVar16 == 0xc) { - if (this->_dead == 0) { - if (this->_championRegenTimer != 0) goto LAB_006c7154; - } - else if (this->_championRegenTimer == 0) { - this->_championRegenCount = this->_championRegenCount + 1; - this->_championRegenTimer = 1; - this->_dead = 0; - this->_health = 10.0; - this->_isInvicible = 0; - this->_entityCollisionClass = 4; - if (this->_entityGridCollisionClass == 0) { - this->_entityGridCollisionClass = 3; - } - this->_aiCallFlags = this->_aiCallFlags << 0x10; - } - else { -LAB_006c7154: - this->_friction = this->_friction * 0.8; - pRVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::GetHitPointsLost(); - local_288 = pRVar10; - if (0 < GHIDRA_INT(pRVar10)) { - do { - this->_championRegenTimer = this->_championRegenTimer + 1; - regenTimer = this->_championRegenTimer; - if ((regenTimer < 6) || ((0x50 < regenTimer && (regenTimer < 0x56)))) { - fVar19 = (long double)Scale(this); - SetScale(this,(float)(fVar19 * (long double)0.5)); - if ((4 < this->_championRegenTimer) && - (GHIDRA_INT(this->_championRegenTimer) - GHIDRA_INT(local_288) < 5)) { - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/024.000_Globin.anm2")); - local_14 = 7; - ANM2::Load(&this->_sprite,GHIDRA_CAST((local_4c + 0x10)),1); - local_14 = 0xffffffff; - (GHIDRA_CAST((local_4c + 0x10)))->msvc::string::_Tidy_deallocate(); - ANM2::Play(&this->_sprite,GHIDRA_CAST("ReGenChamp"),1); -LAB_006c7308: - this->ResetColor(); - } - } - else if ((regenTimer < 10) || (0x55 < regenTimer)) { - fVar19 = (long double)Scale(this); - SetScale(this,(float)(fVar19 * (long double)2.0)); - if (0x59 < this->_championRegenTimer) { - load_graphics(this,1); - this->_state = 1; - this->_championRegenTimer = 0; - this->_friction = this->_baseFriction; - this->_aiCallFlags = GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_INT(&this->_aiCallFlags) + 2))); - iVar16 = this->_type; - if ((((iVar16 == 0x22) || (iVar16 == 0x56)) || (iVar16 == 0x36)) || - ((iVar16 == 0xf6 || (iVar16 == 0x1d)))) { - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero); - } - else if (iVar16 == 0x379) { - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x800000011); - this->_isInvicible = 0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Reset(); - goto LAB_006c7308; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Reset(); - goto LAB_006c7308; - } - } - pRVar10 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pRVar10[-1])) + 0x7897)))); - } while (pRVar10 != GHIDRA_CAST(0x0)); - } - } -LAB_006c8133: - pEVar7 = GHIDRA_CAST(&this->_sprite); - } - else { - if (iVar16 != 0xe) { - if ((iVar16 == 0xf) || (iVar16 == 0x10)) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - fVar20 = sinf_wrapper((float)iVar16 * 0.1); - local_2b0 = GHIDRA_CAST(Math)::clamp(0.0,1.0,fVar20 + 0.5); - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - fVar20 = sinf_wrapper((float)iVar16 * 0.3); - fVar20 = fVar20 + 0.5; - fVar27 = 1.0; - fVar21 = Math::clamp(0.0,1.0,fVar20); - iVar16 = this->_championColorIdx; - (GHIDRA_CAST((&local_f8)))->Color::Color(); - tmpColor = Color::Lerp(GHIDRA_CAST(&local_150),GHIDRA_CAST((&DAT_00c354d4 + iVar16 * 0x40)), - to_00,fVar21); - pEVar7 = GHIDRA_CAST(&this->_sprite); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Sprite::SetColor(tmpColor); - (GHIDRA_CAST((GHIDRA_CAST(local_cc))))->Color::Color(fVar27,fVar20,in_XMM3_Da, - (float)(&DAT_00c354c0 + this->_championColorIdx * 0x40)); - local_298.y = (GHIDRA_CAST((GHIDRA_CAST(local_cc))))->Color::B(); - fVar19 = (long double)Color::G(); - local_2b8.y = (float)fVar19; - local_2f0.y = (GHIDRA_CAST((GHIDRA_CAST(local_cc))))->Color::R(); - (GHIDRA_CAST((&local_254)))->Color::Color(local_2f0.y,local_2b8.y,local_298.y,1.0 - (float)local_2b0); - (GHIDRA_CAST((pEVar7)))->Entity::SetColor(extraout_EAX_01); - if ((this->_championColorIdx != 0x10) || (0.4 <= (float)local_2b0)) goto LAB_006c8136; - local_2b8.y = assert_lerp_range((float)local_2b0,0.2,0.4,1.0,0.0,1); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - tmpVec = &this->_pos; - local_2f0.y = (float)tmpVec; - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_318),tmpVec,100.0,4); - local_14 = 9; - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(local_318))))->EntityList::Size(); - if (iVar16 != 0) { - uVar4 = 0; - do { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(uVar4); - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::Type(); - if (iVar16 == 2) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(uVar4); - tmpVec2 = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::Position(&local_54); - (GHIDRA_CAST((tmpVec2)))->Vector::__sub(&local_2e8,tmpVec); - entitySlot = GHIDRA_CAST(std)::vector::operator_index(uVar4); - pEVar7 = GHIDRA_CAST(*entitySlot); - fVar20 = (GHIDRA_CAST((&local_2e8)))->Vector::LengthSquared(); - fVar20 = 1.0 - fVar20 / 10000.0; - local_298.y = fVar20; - tmpVec = (GHIDRA_CAST((&local_2e8)))->Vector::Resized(&local_2f8,(fVar20 + fVar20) * local_2b8.y); - (GHIDRA_CAST((pEVar7)))->Entity::AddVelocity_divided(tmpVec,0); - tmpVec = GHIDRA_CAST(local_2f0.y); - } - uVar4 = uVar4 + 1; - uVar13 = (GHIDRA_CAST((GHIDRA_CAST(local_318))))->EntityList::Size(); - } while (uVar4 < uVar13); - this = npc; - } - local_14 = 0xffffffff; - (GHIDRA_CAST((local_318)))->EntityList_Query::~EntityList_Query(); - } - else if (iVar16 == 0x14) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - fVar20 = sinf_wrapper((float)iVar16 * 0.1); - local_288 = GHIDRA_CAST(Math)::clamp(0.0,1.0,fVar20 + 0.5); - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - fVar20 = sinf_wrapper((float)iVar16 * 0.3); - fVar20 = fVar20 + 0.5; - fVar27 = 1.0; - fVar21 = Math::clamp(0.0,1.0,fVar20); - iVar16 = this->_championColorIdx; - (GHIDRA_CAST((&local_f8)))->Color::Color(); - tmpColor = Color::Lerp(GHIDRA_CAST(local_cc),GHIDRA_CAST((&DAT_00c354d4 + iVar16 * 0x40)),to - ,fVar21); - pEVar7 = GHIDRA_CAST(&this->_sprite); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Sprite::SetColor(tmpColor); - (GHIDRA_CAST((&local_150)))->Color::Color(fVar27,fVar20,in_XMM3_Da, - (float)(&DAT_00c354c0 + this->_championColorIdx * 0x40)); - local_2ac = GHIDRA_CAST((GHIDRA_CAST((&local_150)))->Color)::B(); - fVar19 = (long double)Color::G(); - local_2c0 = GHIDRA_CAST((float)fVar19); - local_2d8 = GHIDRA_CAST((GHIDRA_CAST((&local_150)))->Color)::R(); - (GHIDRA_CAST((&local_f8)))->Color::Color((float)local_2d8,(float)local_2c0,(float)local_2ac, - 1.0 - (float)local_288); - (GHIDRA_CAST((pEVar7)))->Entity::SetColor(extraout_EAX_00); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x1e,this->_index); - if (bVar2 == 0) goto LAB_006c8136; - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_290 = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetEntities(); - local_281 = 0; - pAVar18 = GHIDRA_CAST(0x0); - local_2a0 = GHIDRA_CAST(0x0); - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(local_290))))->EntityList::Size(); - if (iVar16 != 0) { - do { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::IsActiveEnemy(0); - if (bVar2 != 0) { - piVar14 = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - if (GHIDRA_CAST(*piVar14) != this) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - pEVar7 = GHIDRA_CAST(*entitySlot); - local_2a5 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000100); - bVar2 = (GHIDRA_CAST((pEVar7)))->Entity::HasEntityFlags(0x20000000); - pAVar18 = local_2a0; - if (bVar2 == local_2a5) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(local_2a0); - iVar16 = __RTDynamicCast(*entitySlot,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor, - 0); - if (*GHIDRA_CAST((iVar16 + 0xc64)) != 0x14) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - fVar19 = (long double)(GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::HitPoints(); - local_2ac = GHIDRA_CAST((float)fVar19); - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - local_288 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity)::MaxHitPoints(); - if ((float)local_2ac < (float)local_288) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::IsType(0x325,-1,-1); - if (bVar2 == 0) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - pEVar7 = GHIDRA_CAST(*entitySlot); - entitySlot = GHIDRA_CAST(std)::vector::operator_index(local_2a0); - fVar19 = (long double)(GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::HitPoints(); - local_2c0 = GHIDRA_CAST((float)(fVar19 + (long double)20.0)); - entitySlot = GHIDRA_CAST(std)::vector::operator_index(local_2a0); - local_2d8 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity)::MaxHitPoints(); - clampedValue = GHIDRA_CAST(std)::min(); - (GHIDRA_CAST((pEVar7)))->Entity::SetField380(*clampedValue); - uVar4 = Random(); - entitySlot = GHIDRA_CAST(std)::vector::operator_index(local_2a0); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::Position(&healEffectPos); - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,0x31,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),0 - ,uVar4); - __RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33); - pAVar18 = local_2a0; - entitySlot = GHIDRA_CAST(std)::vector::operator_index(local_2a0); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::Position(&healTargetPos); - local_2a4 = GHIDRA_CAST(&this->_pos); - (GHIDRA_CAST((tmpVec)))->Vector::__sub(&local_2e8,GHIDRA_CAST(local_2a4)); - local_288 = GHIDRA_CAST(0x3dcccccd); - (GHIDRA_CAST((&local_2e8)))->Vector::__mul(&local_2d0,GHIDRA_CAST(&local_288)); - local_288 = GHIDRA_CAST((GHIDRA_CAST((&local_2d0)))->Vector)::Length(); - if (4.0 < (float)local_288) { - (GHIDRA_CAST((&local_2d0)))->Vector::Resize(4.0); - } - local_2c4 = GHIDRA_CAST(0xc); - local_2ac = GHIDRA_CAST(&DAT_00000004); - fVar20 = (GHIDRA_CAST((&local_2e8)))->Vector::Length(); - pRVar10 = GHIDRA_CAST((fVar20 / 20.0)); - local_288 = pRVar10; - FUN_00407140(); - local_2b0 = GHIDRA_CAST(GHIDRA_INT((float)pRVar10)); - msvc::max(); - piVar14 = GHIDRA_CAST(std)::min(); - local_2b8.y = (float)*piVar14; - if (0 < GHIDRA_INT(local_2b8.y)) { - local_2c4 = GHIDRA_CAST(&this->_posOffset); - local_298.y = (float)GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_2b8.y)))) + 0x1)))); - local_2f0.y = (float)GHIDRA_CAST(0x0); - fVar20 = (float)GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_2b8.y)))) + 0x1)))); - do { - local_2f0.y = (float)(GHIDRA_INT(&(GHIDRA_CAST(local_2f0.y))->x) + 1); - local_2ac = GHIDRA_CAST(((float)GHIDRA_INT(local_2f0.y) / fVar20)); - local_288 = local_2ac; - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::Position(&local_344); - tmpVec = vector_lerp(&local_34c,GHIDRA_CAST(local_2a4),tmpVec,0, - (float)local_288); - tmpVec2 = MusicManager::RandomVector(&local_354); - randomLength = random_float(); - tmpVec2 = (GHIDRA_CAST((tmpVec2)))->Vector::__mul(&local_35c,&randomLength); - local_33c.y = 15.0; - tmpVec2 = (GHIDRA_CAST((tmpVec2)))->Vector::__mul(&local_364,&local_33c.y); - (GHIDRA_CAST((tmpVec)))->Vector::__add(&local_2e0,tmpVec2); - uVar4 = Random(); - fVar20 = random_float(); - local_320.y = fVar20 * 0.5 + 0.5; - tmpVec = (GHIDRA_CAST((&local_2d0)))->Vector::__mul(&local_32c,&local_320.y); - pEVar7 = Game::Spawn(g_game,1000,0x6f,&local_2e0,tmpVec,GHIDRA_CAST(0x0), - 0,uVar4); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar7) + 0x3c); - uVar28 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0,0,0,0x3e99999a,0,0); - (*pcVar1)(uVar28,0xffffffff,0xff,0,1); - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_334,GHIDRA_CAST(&local_2ac)); - fVar20 = random_float(); - local_308.y = fVar20 * 0.3 + 0.3; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(GHIDRA_CAST((local_318 + 8)),&local_308.y); - (GHIDRA_CAST((pEVar7)))->Entity::SetSpriteScale(tmpVec); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity)::GetSprite(); - iVar16 = (GHIDRA_CAST((sprite)))->Sprite::Scale(); - tmpVec = (GHIDRA_CAST((&local_2f8)))->Vector::Vector(0.0,*GHIDRA_CAST((iVar16 + 4)) * -16.0) - ; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_2c4))))->Vector::__add(&local_54,tmpVec); - (GHIDRA_CAST((pEVar7)))->Entity::SetPositionOffset(tmpVec); - pAVar18 = local_2a0; - fVar20 = local_298.y; - } while (GHIDRA_INT(local_2f0.y) < GHIDRA_INT(local_2b8.y)); - } - local_281 = 1; - entitySlot = GHIDRA_CAST(std)::vector::operator_index(pAVar18); - pcVar1 = *(code **)(*GHIDRA_CAST(*entitySlot) + 0x3c); - uVar28 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0,0,0,0x3f333333,0,0); - (*pcVar1)(uVar28,8,0xff,1,1); - pAVar18 = local_2a0; - this = npc; - } - } - } - } - } - } - pAVar18 = GHIDRA_CAST(((pAVar18->_filename)._buf + 1)); - local_2a0 = pAVar18; - pAVar12 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_290))))->EntityList)::Size(); - } while (pAVar18 < pAVar12); - if (local_281 != 0) { - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x3c); - uVar28 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0,0,0,0x3f333333,0,0); - (*pcVar1)(uVar28,8,0xff,1,1); - play_sound_with_fart_seed(0x9d,1.0,2,0,1.0); - } - } - } - else if (iVar16 == 0x16) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x1e,this->_index); - if (bVar2 != 0) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_2a0 = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetEntities(); - uVar4 = 0; - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(local_2a0))))->EntityList::Size(); - if (iVar16 != 0) { - do { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(uVar4); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*entitySlot))))->Entity::IsActiveEnemy(0); - if (bVar2 != 0) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(uVar4); - cVar3 = (**(code **)(*GHIDRA_CAST(*entitySlot) + 0x4c))(); - if ((cVar3 == '\0') && - (piVar14 = GHIDRA_CAST(std)::vector::operator_index(uVar4), - GHIDRA_CAST(*piVar14) != this)) { - entitySlot = GHIDRA_CAST(std)::vector::operator_index(uVar4); - piVar14 = GHIDRA_CAST(__RTDynamicCast(*entitySlot,0, - &IsaacRepentancePlus::Entity:: - RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC:: - RTTI_Type_Descriptor,0)); - if ((piVar14 != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(piVar14) + 0xc63)) == '\0')) { - *GHIDRA_CAST((GHIDRA_CAST(piVar14) + 0xc63)) = 1; - piVar14[0x319] = 1; - (**(code **)(*piVar14 + 0x60))(); - } - } - } - uVar4 = uVar4 + 1; - uVar13 = (GHIDRA_CAST((GHIDRA_CAST(local_2a0))))->EntityList::Size(); - } while (uVar4 < uVar13); - } - } - } - else if ((iVar16 == 0x15) && (0 < this->_championTimer)) { - this->_championTimer = this->_championTimer + -1; - } - goto LAB_006c8133; - } - Isaac::GetRenderPosition(&local_298,&this->_pos,1); - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetRenderSurfaceTopLeft(); - (GHIDRA_CAST((&local_298)))->Vector::operator__(tmpVec); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_004177e0(&local_2e8); - local_14 = 8; - piVar14 = GHIDRA_CAST(EntityPtr)::Ref(); - pcVar1 = *(code **)(*piVar14 + 0x2c); - uVar28 = __ftoui3(); - uVar28 = __ftoui3(uVar28); - (*pcVar1)(local_60,uVar28); - local_14 = 0xffffffff; - FUN_0041c710(); - pEVar7 = local_2d8; - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_2d8))))->Sprite)::Color(); - (GHIDRA_CAST((&spriteColorCopy)))->Color::operator_assign(tmpColor); - local_288 = GHIDRA_CAST((local_58 * 0.9)); - fVar19 = (long double)Color::BO(); - local_2ac = GHIDRA_CAST((float)fVar19); - local_2c0 = GHIDRA_CAST(Math)::lerp((float)local_2ac,(float)local_288,0.3,0); - local_288 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_60)) + 0x4))) * 0.9)); - local_2ac = GHIDRA_CAST((GHIDRA_CAST((&spriteColorCopy)))->Color)::GO(); - local_2d8 = GHIDRA_CAST(Math)::lerp((float)local_2ac,(float)local_288,0.3,0); - local_288 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_60)) + 0x0))) * 0.9)); - fVar19 = (long double)Color::RO(); - local_2ac = GHIDRA_CAST((float)fVar19); - fVar20 = Math::lerp((float)local_2ac,(float)local_288,0.3,0); - tmpColor = GHIDRA_CAST((GHIDRA_CAST((0x3f800000)))->Color)::Color(fVar20,local_2d8,local_2c0); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Sprite::SetColor(tmpColor); - this = npc; - } -LAB_006c8136: - if (this->_championColorIdx == 0x19) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - hsv_to_rgb(&local_38,((float)(iVar16 % 0x5a) * 360.0) / 90.0,1.0,1.0,1.0); - (GHIDRA_CAST((&local_124)))->Color::Color(local_38._red,local_38._green,local_38._blue,1.0); - (GHIDRA_CAST((pEVar7)))->Entity::SetColor(extraout_EAX_02); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000000); - if ((bVar2 != 0) && (this->_shrinkCountdown - 1U < 0x3b)) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - fVar20 = sinf_wrapper((float)iVar16 * 0.1); - Math::clamp(0.0,1.0,fVar20 + 0.5); - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - fVar20 = sinf_wrapper((float)iVar16 * 0.3); - fVar20 = Math::clamp(0.0,1.0,fVar20 + 0.5); - local_298.y = fVar20; - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x3c,0x3c,0x3c); - fVar20 = local_298.y; - (GHIDRA_CAST((&local_124)))->Color::Color(); - tmpColor = Color::Lerp(GHIDRA_CAST(&local_254),GHIDRA_CAST(local_a0),to_01,fVar20); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Sprite::SetColor(tmpColor); - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - cVar3 = FUN_006b8440(); - if (cVar3 != '\0') { - if ((((this->_dead == 0) && (this->_isBoss == 0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFlying(), bVar2 == 0)) && - (this->_entityGridCollisionClass != 6)) { - fVar20 = 1.4013e-45; - } - else { - fVar20 = 0.0; - } - fVar21 = 0.0; - if (this->_type != 0x376) { - fVar21 = fVar20; - } - local_298.y = fVar21; - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - if (GHIDRA_UINT((iVar16 + this->_index)) % 0x3c == 0) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - if ((900 < iVar16) && ((*GHIDRA_CAST((GHIDRA_CAST(&(local_298.y)) + 0x0))) != '\0')) { - gridEntity = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetVariant(); - if (iVar16 == 1) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((pRVar10)))->Room::IsClear(); - if (bVar2 == 0) { - Game::GetPlayerManager(g_game); - cVar3 = FUN_009be9c0(); - if (cVar3 == '\0') { - pRVar10 = GHIDRA_CAST(0x0); - local_29c = GHIDRA_CAST(0x0); - iVar16 = Game::GetNumPlayers(g_game); - if (iVar16 != 0) { - do { - player = Game::GetPlayer(g_game,GHIDRA_UINT(pRVar10)); - local_298.y = (float)player; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::IsFlying(); - if (bVar2 == 0) { - bVar2 = 1; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_298.y))))->Entity::Position(&local_54); - bVar2 = (GHIDRA_CAST((&this->_pathfinder)))->NPCAI_Pathfinder::HasPathToPos(tmpVec,bVar2); - if (bVar2 != 0) goto LAB_006c8453; - pRVar10 = local_29c; - } - pRVar10 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar10)) + 0x1)))); - local_29c = pRVar10; - puVar17 = GHIDRA_CAST(Game)::GetNumPlayers(g_game); - } while (pRVar10 < puVar17); - } - if (this->_isUnreachableOnce == 0) { - this->_isUnreachableOnce = 1; - } - else { - this->_canShutDoors = 0; - } - } - } - } - } - } - } -LAB_006c8453: - if (this->_dead != 0) { - if (this->_exists != 0) { - PlayDeathEffects(this); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400); - if (bVar2 != 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40000000000); - if (bVar2 == 0) { - local_2b8.y = (float)&this->_pos; - player = Game::GetNearestPlayerEx(GHIDRA_CAST(local_2b8.y),1,0,1); - if ((player == GHIDRA_CAST(0x0)) || - (iVar16 = (GHIDRA_CAST((player)))->Entity_Player::GetHealthType(), iVar16 != 3)) { - iVar16 = Isaac::Random(3); - local_2a4 = GHIDRA_CAST((iVar16 + 1)); - } - else { - local_2a4 = GHIDRA_CAST(Isaac)::Random(3); - } - if (0 < GHIDRA_INT(local_2a4)) { - do { - uVar4 = Random(); - tmpVec = MusicManager::RandomVector(&local_2f8); - fVar20 = random_float(); - local_298.y = fVar20 * 3.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(GHIDRA_CAST((local_318 + 8)),&local_298.y); - Game::Spawn(g_game,5,0x14,GHIDRA_CAST(local_2b8.y),tmpVec,GHIDRA_CAST(0x0),1,uVar4); - local_2a4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_2a4[-1])) + 0x4bf)))); - } while (local_2a4 != GHIDRA_CAST(0x0)); - local_2a4 = GHIDRA_CAST(0x0); - this = npc; - } - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40000); - if (bVar2 == 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Pickup::Update(); - uVar4 = 0; - iVar16 = Game::GetNumPlayers(g_game); - if (iVar16 != 0) { - do { - player = Game::GetPlayer(g_game,uVar4); - (GHIDRA_CAST((player)))->Entity_Player::trigger_npc_death(GHIDRA_CAST(this)); - uVar4 = uVar4 + 1; - uVar13 = Game::GetNumPlayers(g_game); - } while (uVar4 < uVar13); - } - } - FUN_006d5350(); - if ((this->_isBoss == 0) && (this->_type != 0x1c)) { - trigger_kill_item_effects(this); - } - else { - this->_state = 0x12; - this->_stateFrame = 0; - } - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((pRVar10)))->Room::is_type_16(); - if ((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFlying(), bVar2 == 0)) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - gridEntity = (GHIDRA_CAST((pRVar10)))->Room::GetGridEntityFromPos(&this->_pos); - if ((gridEntity != GHIDRA_CAST(0x0)) && - (iVar16 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar16 == 0x13)) { - (this->_velocity).y = (this->_velocity).y * 0.5; - fVar20 = (this->_velocity).x; - if (fVar20 <= 0.0) { - if (fVar20 < 0.0) { - fVar20 = (GHIDRA_CAST((&this->_velocity)))->Vector::Length(); - local_298.y = fVar20; - (this->_velocity).x = -fVar20; - } - } - else { - fVar20 = (GHIDRA_CAST((&this->_velocity)))->Vector::Length(); - (this->_velocity).x = fVar20; - } - game = g_game; - (this->_velocity).y = 0.0; - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - tmpVec = (GHIDRA_CAST((&local_2f8)))->Vector::Vector(0.0,(this->_sizeMulti).y * this->_size + 0.5); - tmpVec = (GHIDRA_CAST((&this->_pos)))->Vector::__add(GHIDRA_CAST((local_318 + 8)),tmpVec); - local_2d0.x = tmpVec->x; - local_2d0.y = tmpVec->y; - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetGridCollisionAtPos(*tmpVec); - if (iVar16 != 4) { - bVar2 = 0; - tmpVec = (GHIDRA_CAST((&local_334)))->Vector::Vector(0.0,3.5); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(tmpVec,bVar2); - } - } - } - } - goto LAB_006c87a7; - } -LAB_006c87b4: - if ((((this->_state != 0x12) && (this->_state != 0x11)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFriendly(), bVar2 == 0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar2 != 0)) { - local_2d8 = GHIDRA_CAST(0x4e6e6b28); - puVar17 = GHIDRA_CAST(0x0); - local_2b0 = GHIDRA_CAST(0x45c80000); - local_2c4 = GHIDRA_CAST(0x0); - local_288 = GHIDRA_CAST(0x0); - local_29c = GHIDRA_CAST(0x0); - local_2ac = GHIDRA_CAST(0x0); - local_2c0 = local_2d8; - iVar16 = Game::GetNumPlayers(g_game); - if (iVar16 != 0) { - do { - pRVar10 = GHIDRA_CAST(Game)::GetPlayer(g_game,GHIDRA_UINT(puVar17)); - FUN_0042a020(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pRVar10))))->Entity_Player::HasCollectible(0x14f,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_298.y)) + 0x0))) = bVar2; - FUN_006da770(&local_2e0,0); - FUN_006da710(local_298.y); - guard_check_icall(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pRVar10))))->Entity_Player::HasTrinket(0x44,0); - local_2b8.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_2b8.y)) + 0x1))),bVar2); - FUN_006da770(&local_2e8,1); - FUN_006da710(local_2b8.y); - guard_check_icall(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pRVar10))))->Entity_Player::HasCollectible(0x2b8,0); - local_2f0.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_2f0.y)) + 0x1))),bVar2); - FUN_006da770(&local_2d0,2); - FUN_006da710(local_2f0.y); - guard_check_icall(); - cVar3 = msvc::bitset<8>::any(); - if (cVar3 != '\0') { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pRVar10))))->Entity::Position(&local_32c); - local_290 = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::DistanceSquared(&this->_pos); - FUN_006da770(&local_300,0); - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) | 0x10)); - cVar3 = FUN_006da6f0(); - if ((cVar3 == '\0') || (local_281 = '\x01', (float)local_2b0 <= (float)local_290)) { - local_281 = '\0'; - } - if ((GHIDRA_UINT(local_28c) & 0x10) != 0) { - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) & 0xffffffef)); - guard_check_icall(); - } - if (local_281 != '\0') { - local_2c4 = pRVar10; - local_2b0 = local_290; - } - FUN_006da770(&local_308,1); - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) | 0x20)); - cVar3 = FUN_006da6f0(); - if ((cVar3 == '\0') || (local_281 = '\x01', (float)local_2d8 <= (float)local_290)) { - local_281 = '\0'; - } - if ((GHIDRA_UINT(local_28c) & 0x20) != 0) { - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) & 0xffffffdf)); - guard_check_icall(); - } - if (local_281 != '\0') { - local_2d8 = local_290; - local_288 = pRVar10; - } - FUN_006da770(&local_320,2); - local_14 = 10; - local_2a4 = GHIDRA_CAST((GHIDRA_UINT(local_28c) | 0x40)); - local_28c = local_2a4; - cVar3 = FUN_006da6f0(); - if ((cVar3 == '\0') || - (auVar23 = ZEXT416(local_2c0), (float)local_2c0 <= (float)local_290)) { -LAB_006c8ae8: - local_281 = 0; - } - else { - Entity_Player::get_salvation_scale(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))) * 70.0 + this->_size; - FUN_006daa90(); - local_281 = 1; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x0))) <= (double)(float)local_290) goto LAB_006c8ae8; - } - local_14 = 0xffffffff; - if ((GHIDRA_UINT(local_28c) & 0x40) != 0) { - local_28c = GHIDRA_CAST((GHIDRA_UINT(local_28c) & 0xffffffbf)); - guard_check_icall(); - } - if (local_281 != 0) { - local_2c0 = local_290; - local_29c = pRVar10; - } - } - puVar17 = &(*GHIDRA_CAST((GHIDRA_CAST((local_2ac)) + 0x1))); - local_2ac = GHIDRA_CAST(puVar17); - puVar11 = GHIDRA_CAST(Game)::GetNumPlayers(g_game); - } while (puVar17 < puVar11); - if ((local_2c4 != GHIDRA_CAST(0x0)) && (iVar16 = Isaac::Random(3), iVar16 == 0)) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_2c4))))->Entity::Position(&local_32c); - tmpVec = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_364,tmpVec); - fVar20 = sqrtf((float)local_2b0); - local_298.y = 80.0 - fVar20; - fVar20 = random_float(); - this = npc; - local_2b8.y = fVar20 * local_298.y * 0.1; - local_298.y = (GHIDRA_CAST((&npc->_velocity)))->Vector::Length(); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::Resized(&local_35c,local_298.y * local_2b8.y * 0.2 + 0.05); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(tmpVec); - } - pRVar10 = local_288; - if ((local_288 != GHIDRA_CAST(0x0)) && (iVar16 = Isaac::Random(3), iVar16 == 0)) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pRVar10))))->Entity::Position(&local_354); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__sub(&local_34c,&this->_pos); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::Resized(&local_344,0.5); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(tmpVec); - } - pRVar10 = local_29c; - if (local_29c != GHIDRA_CAST(0x0)) { - iVar16 = EntityPtr::Ref(); - if (iVar16 == 0) { - uVar4 = Random(); - pEVar7 = Game::Spawn(g_game,1000,0x13,&this->_pos,&g_vectorZero,GHIDRA_CAST(pRVar10),3, - uVar4); - (GHIDRA_CAST((pEVar7)))->Entity::SetTarget(GHIDRA_CAST(this)); - (GHIDRA_CAST((pEVar7)))->Entity::SetParent(GHIDRA_CAST(local_29c)); - pEVar7->SetCollisionDamage(0x40600000); - pEVar7->Update(); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf58)))))))->EntityPtr::Set(pEVar7); - } - iVar16 = EntityPtr::Ref(); - if (iVar16 != 0) { - pEVar9 = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((pEVar9)))->Entity_Effect::set_state(1); - } - } - } - } - } - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetFrameCount(); - if ((iVar16 == 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar2 != 0) - ) { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - local_2b8.y = (float)PlayerManager::FirstCollectibleOwner(playerManager,0x15e,GHIDRA_CAST(0x0),0); - if (GHIDRA_CAST(local_2b8.y) != GHIDRA_CAST(0x0)) { - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::constructor(GHIDRA_CAST(local_2b8.y)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddPoison(GHIDRA_CAST(local_4c),-0x28,0.0,0); - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - player = PlayerManager::FirstTrinketOwner(playerManager,0x87); - if (player != GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar25)) + 0x0))) = ZEXT812(0x3e4ccccd); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar25)) + 0xc))) = 0; - local_29c = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar25)) + 0x0))); - iVar16 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x87); - if (iVar16 == 2) { - auVar22 = ZEXT812(0x3ea8f5c3); -LAB_006c8df9: - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar25)) + 0xc))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar25)) + 0x0))) = auVar22; - local_29c = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x0))); - } - else if (iVar16 == 3) { - auVar22 = ZEXT812(0x3f000000); - goto LAB_006c8df9; - } - (GHIDRA_CAST((GHIDRA_CAST((local_60 + 4)))))->RNG::game_constructor(this->_initSeed,5); - local_14 = 0xb; - fVar20 = (GHIDRA_CAST((this_00)))->RNG::RandomFloat(); - local_298.y = fVar20; - FUN_00665c00(); - local_14 = 0xffffffff; - local_2a5 = local_298.y < (*GHIDRA_CAST((GHIDRA_CAST(&(auVar25)) + 0x0))) * 0.02 + (float)local_29c; - guard_check_icall(); - if (local_2a5 != 0) { - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::constructor(GHIDRA_CAST(player)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddBurn(GHIDRA_CAST(local_4c),-0x5a,0.0,0); - } - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - player = PlayerManager::FirstTrinketOwner(playerManager,0xbc); - if (player != GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0))) = ZEXT812(0x3e4ccccd); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0xc))) = 0; - local_29c = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0))); - iVar16 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0xbc); - if (iVar16 == 2) { - auVar22 = ZEXT812(0x3ea8f5c3); -LAB_006c8edb: - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0xc))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0))) = auVar22; - local_29c = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x0))); - } - else if (iVar16 == 3) { - auVar22 = ZEXT812(0x3f000000); - goto LAB_006c8edb; - } - (GHIDRA_CAST((GHIDRA_CAST((local_60 + 4)))))->RNG::game_constructor(this->_initSeed,5); - local_14 = 0xc; - fVar20 = (GHIDRA_CAST((sfx)))->RNG::RandomFloat(); - local_298.y = fVar20; - FUN_00665c00(); - local_14 = 0xffffffff; - local_2a5 = local_298.y < (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0))) * 0.02 + (float)local_29c; - guard_check_icall(); - fVar20 = local_2b8.y; - if (local_2a5 != 0) { - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::constructor(GHIDRA_CAST(local_2b8.y)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddFreeze(GHIDRA_CAST(local_4c),-0x5a,0); - ::(GHIDRA_CAST((GHIDRA_CAST((local_a0 + 0x2c)))))->EntityRef::constructor(GHIDRA_CAST(fVar20)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddIce(GHIDRA_CAST((local_a0 + 0x2c)),-0x5a); - } - } - } - pEVar7 = GetPlayerTarget(this); - player = (GHIDRA_CAST((pEVar7)))->Entity::ToPlayer(); - if ((player != GHIDRA_CAST(0x0)) && (bVar2 = (GHIDRA_CAST((player)))->Entity_Player::IsInvisible(), bVar2 != 0)) - { - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddConfusion(GHIDRA_CAST(local_4c),-2,0); - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - player = PlayerManager::FirstCollectibleOwner(playerManager,0x202,GHIDRA_CAST(0x0),0); - if (player != GHIDRA_CAST(0x0)) { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - fVar20 = PlayerManager::get_total_luck(playerManager); - local_2b8.y = 5.32493e-44; - local_298.y = (float)(0x37 - GHIDRA_INT(fVar20)); - piVar14 = GHIDRA_CAST(std)::max(); - iVar16 = *piVar14; - cVar3 = this->IsBoss(); - if (cVar3 == '\0') { - iVar16 = iVar16 * 2; - } - else { - iVar16 = iVar16 * 3; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (((bVar2 != 0) && (iVar16 = Isaac::Random(iVar16), iVar16 == 0)) && (this->_dead == 0)) { - pEVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetStatusEffectTarget(); - (GHIDRA_CAST((pEVar7)))->Entity::AddEntityFlags(0x20); - (GHIDRA_CAST((pEVar7)))->Entity::CopyStatusEffects(); - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsActiveEnemy(0); - if (((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20), bVar2 != 0)) && - ((this->_freezeCountdown < 1 && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x32,0), bVar2 != 0)))) - { - pEVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetStatusEffectTarget(); - (GHIDRA_CAST((pEVar7)))->Entity::ClearEntityFlags(0x20); - (GHIDRA_CAST((pEVar7)))->Entity::CopyStatusEffects(); - bVar2 = (GHIDRA_CAST((&this->_velocity)))->Vector::operator_ne(&g_vectorZero); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&local_2d0))))->EntityPtr::clear(); - iVar16 = FUN_0067f030(); - local_2d0.x = (float)((double)iVar16 + __uint_to_double_fixup[-(iVar16 >> 0x1f)]) * 14.0 - - 21.0; - iVar16 = FUN_0067f030(); - local_2d0.y = (float)((double)iVar16 + __uint_to_double_fixup[-(iVar16 >> 0x1f)]) * 14.0 - - 21.0; - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec = &this->_pos; - tmpVec2 = (GHIDRA_CAST((pRVar10)))->Room::GetClampedPosition(&local_54,tmpVec,0.0); - local_2a5 = (GHIDRA_CAST((tmpVec2)))->Vector::operator_eq(tmpVec); - (GHIDRA_CAST((tmpVec)))->Vector::operator_add_assign(&local_2d0); - if (local_2a5 != 0) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec2 = (GHIDRA_CAST((pRVar10)))->Room::GetClampedPosition(&local_54,tmpVec,0.0); - (GHIDRA_CAST((tmpVec)))->Vector::operator_assign(tmpVec2); - } - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x10); - if (bVar2 == 0) { - uVar4 = 0; - local_29c = GHIDRA_CAST(CONCAT31(extraout_var,bVar2)); - pvVar8 = (void *)Game::GetPlayerManager(g_game); - iVar16 = (GHIDRA_CAST((pvVar8)))->msvc::vector::size(); - if (iVar16 != 0) { - do { - player = Game::GetPlayer(g_game,uVar4); - tempEffects = GHIDRA_CAST((GHIDRA_CAST((player)))->Entity_Player)::GetEffects(); - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x5d); - local_29c = GHIDRA_CAST((GHIDRA_UINT(local_29c) & 0xff)); - if (bVar2 != 0) { - local_29c = GHIDRA_CAST(0x1); - } - uVar4 = uVar4 + 1; - pvVar8 = (void *)Game::GetPlayerManager(g_game); - uVar13 = (GHIDRA_CAST((pvVar8)))->msvc::vector::size(); - this = npc; - } while (uVar4 < uVar13); - if ((char)local_29c != '\0') { - pcVar1 = *(code **)(*GHIDRA_CAST(npc) + 0x3c); - (GHIDRA_CAST((&local_124)))->Color::Color(); - (*pcVar1)(extraout_EAX_03,2,0,0,1); - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddFear(GHIDRA_CAST(local_4c),-2,0); - } - } - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - tempEffects = GHIDRA_CAST(FUN_004360d0()); - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0xe8); - if (bVar2 == 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - tempEffects = GHIDRA_CAST(FUN_004360d0()); - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x42); - if (bVar2 != 0) goto LAB_006c930b; - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar4 = (GHIDRA_CAST((pRVar10)))->Room::GetBrokenWatchState(); - if (uVar4 == 1) goto LAB_006c930b; - } - else { -LAB_006c930b: - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000001); - if ((bVar2 == 0) || (this->_type == 0xd4)) { - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x3c); - uVar28 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0x28,0x28,0x28); - (*pcVar1)(uVar28,2,0xfa,0,1); - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x10000000000000); - if (bVar2 != 0) { - fVar20 = Math::timescale_factor(0.92,this->_speedMultiplier); - this->_friction = fVar20 * this->_friction; - } - if (this->_isChampion != 0) { - fVar20 = Math::timescale_factor - (1.0 - (1.0 - this->_championSpeed) * (1.0 - this->_friction), - this->_speedMultiplier); - local_298.y = fVar20; - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_mul_assign(&local_298.y); - } - sprite = GHIDRA_CAST(&this->_sprite); - local_298.y = (float)sprite; - bVar2 = (GHIDRA_CAST((sprite)))->Sprite::IsEventTriggered("poof02"); - if (bVar2 != 0) { - pvVar8 = (GHIDRA_CAST((sprite)))->Sprite::GetNullFrame(GHIDRA_CAST("poof02")); - uVar4 = Random(); - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,0x10,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - pEVar7 = GHIDRA_CAST(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33)); - FUN_004563c0(pvVar8); - tmpVec = (GHIDRA_CAST((&local_54)))->Vector::Vector(0.3,0.3); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar8) + 0x10)))))->Vector::Mul(&local_2f8,tmpVec); - (GHIDRA_CAST((pEVar7)))->Entity::SetSpriteScale(tmpVec); - set_field_358(pEVar7,10.0); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar7) + 0x3c); - uVar28 = (GHIDRA_CAST((0x3f000000)))->Color::Color(0,0,0); - (*pcVar1)(uVar28,0xffffffff,0xff,0,1); - sprite = GHIDRA_CAST(local_298.y); - this = npc; - } - spawn_damage_numbers(this); - update_damage_history(this); - if ((this->_aiCallFlags & 1) != 0) { - this->_aiCallPhase = 1; - Entity_NPC_UpdateAI_dispatch(this); - this->_aiCallPhase = 0; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000002000000000); - if (bVar2 != 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,0); - if ((bVar2 != 0) && (1.0 < this->_health)) { - local_298.y = this->_health - 0.25; - local_2b8.y = 1.0; - clampedValue = GHIDRA_CAST(std)::max(); - this->_health = *clampedValue; - } - fVar20 = Math::clamp(0.0,1.0,(this->_health * this->_health) / - (this->_maxHitPoints * this->_maxHitPoints)); - local_298.y = Math::lerp(0.6,1.0,fVar20,0); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((sprite)))->Sprite)::Color(); - (GHIDRA_CAST((spriteColor)))->Color::SetTint(local_298.y,local_298.y,local_298.y,1.0); - fVar20 = this->_health / this->_maxHitPoints; - FUN_00431260(); - fVar20 = Math::clamp(0.0,1.0,fVar20); - local_298.y = Math::lerp(0.6,1.1,fVar20,0); - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_54,&local_298.y); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(tmpVec); - local_29c = GHIDRA_CAST(0x0); - local_288 = GHIDRA_CAST(0x0); - local_298.x = 0.0; - local_298.y = 0.0; - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::EntityRef(); - msvc::iterator_copy(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))),&local_2a4); - uVar28 = FUN_00456190(&local_2b8.y); - cVar3 = FUN_0042c710(uVar28); - if (cVar3 == '\0') { - local_2a0 = GHIDRA_CAST(local_298.y); - local_290 = GHIDRA_CAST(local_298.x); - } - else { - local_2a0 = GHIDRA_CAST(local_298.y); - local_290 = GHIDRA_CAST(local_298.x); - do { - entitySlot = GHIDRA_CAST(EntityPtr)::Ref(); - pEVar7 = GHIDRA_CAST(entitySlot[2]); - if ((GHIDRA_UINT(pEVar7) & 0x282) == 0) { - if ((GHIDRA_UINT(pEVar7) & 0x286) != 0) { - local_2a0 = GHIDRA_CAST(entitySlot[3]); - local_29c = GHIDRA_CAST(0x40a00000); - local_290 = pEVar7; - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::operator_(GHIDRA_CAST((entitySlot + 4))); - break; - } - if ((float)local_288 < (float)*entitySlot) { - local_2a0 = GHIDRA_CAST(entitySlot[3]); - local_29c = GHIDRA_CAST(0x3f800000); - local_290 = pEVar7; - local_288 = GHIDRA_CAST(*entitySlot); - ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::operator_(GHIDRA_CAST((entitySlot + 4))); - } - } - FUN_00456170(&local_298.y,0); - uVar28 = FUN_00456190(&local_2b8.y); - cVar3 = FUN_0042c710(uVar28); - } while (cVar3 != '\0'); - sprite = GHIDRA_CAST(&this->_sprite); - } - FUN_00456400(); - if (0.0 < (float)local_29c) { - this->TakeDamage(local_29c,local_290,local_2a0,local_4c,0); - } - } - local_298.y = this->_health; - if (this->_type == 0x3c5) { - update_physics(this); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - } - local_2b8.y = 0.0; - local_298.y = (float)(local_298.y - this->_health); - clampedValue = GHIDRA_CAST(std)::max(); - pEVar9 = GHIDRA_CAST((*clampedValue + this->_totalDamageTaken)); - this->_totalDamageTaken = (float)pEVar9; - if ((this->_aiCallFlags & 8) != 0) { - this->_aiCallPhase = 4; - Entity_NPC_UpdateAI_dispatch(this); - this->_aiCallPhase = 0; - } - bVar2 = Game::IsInTimedSet(g_game,0xf); - if (bVar2 != 0) { - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x3c); - uVar28 = (GHIDRA_CAST((0)))->Color::Color(0,0,0); - (*pcVar1)(uVar28,0xffffffff,0xff,0,1); - tmpColor = GHIDRA_CAST((GHIDRA_CAST((0)))->Color)::Color(0,0,0); - sprite = GHIDRA_CAST(&this->_sprite); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(tmpColor); - this->_shadowSize = 0.0; - } - bVar2 = Game::IsInTimedSet(g_game,4); - if ((bVar2 != 0) || (bVar2 = Game::IsInTimedSet(g_game,6), bVar2 != 0)) { - local_298.y = (float)&this->_pos; - iVar16 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (iVar16 < 2) { - Isaac::GetRenderPosition(&local_2d0,GHIDRA_CAST(local_298.y),1); - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetRenderSurfaceTopLeft(); - (GHIDRA_CAST((&local_2d0)))->Vector::operator__(tmpVec); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_004177e0(&local_2e0); - local_14 = 0xd; - piVar14 = GHIDRA_CAST(EntityPtr)::Ref(); - pcVar1 = *(code **)(*piVar14 + 0x2c); - uVar28 = __ftoui3(); - uVar28 = __ftoui3(uVar28); - (*pcVar1)(&local_38,uVar28); - local_14 = 0xffffffff; - FUN_0041c710(); - this = npc; - tmpColor = &npc->_floorColor; - (GHIDRA_CAST((GHIDRA_CAST(tmpColor))))->KColor::FromRGBA255(0,0,0,0xff); - Font::SetLineHeightModifier(GHIDRA_CAST(tmpColor),0.7); - pEVar9 = GHIDRA_CAST((local_38._red * 0.9)); - (GHIDRA_CAST((GHIDRA_CAST(tmpColor))))->Color::SetOffset((float)pEVar9,local_38._green * 0.9,local_38._blue * 0.9); - sprite = GHIDRA_CAST(&this->_sprite); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(tmpColor); - } - iVar16 = Game::GetFrameCount(g_game); - if (GHIDRA_UINT((iVar16 + this->_index)) % 0x1e < 2) { - Isaac::GetRenderPosition(&local_2d0,&this->_pos,1); - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec = GHIDRA_CAST((GHIDRA_CAST((pRVar10)))->Room)::GetRenderSurfaceTopLeft(); - (GHIDRA_CAST((&local_2d0)))->Vector::operator__(tmpVec); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_004177e0(&local_2e0); - local_14 = 0xe; - piVar14 = GHIDRA_CAST(EntityPtr)::Ref(); - (**(code **)(*piVar14 + 0x2c))(&local_38,GHIDRA_INT(local_2d0.x),GHIDRA_INT(local_2d0.y)); - local_14 = 0xffffffff; - FUN_0041c710(); - local_298.y = (GHIDRA_CAST((GHIDRA_CAST(&this->_floorColor))))->Color::A(); - fVar20 = Math::lerp(local_298.y,0.7,0.3,0); - Font::SetLineHeightModifier(GHIDRA_CAST(&this->_floorColor),fVar20); - local_298.y = local_38._blue * 0.9; - fVar19 = (long double)Color::BO(); - local_2b8.y = (float)fVar19; - local_2f0.y = Math::lerp(local_2b8.y,local_298.y,0.5,0); - local_298.y = local_38._green * 0.9; - local_2b8.y = (GHIDRA_CAST((GHIDRA_CAST(&this->_floorColor))))->Color::GO(); - local_308.y = Math::lerp(local_2b8.y,local_298.y,0.5,0); - local_298.y = local_38._red * 0.9; - fVar19 = (long double)Color::RO(); - local_2b8.y = (float)fVar19; - pEVar9 = GHIDRA_CAST(Math)::lerp(local_2b8.y,local_298.y,0.5,0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_floorColor))))->Color::SetOffset((float)pEVar9,local_308.y,local_2f0.y); - } - tmpColor = GHIDRA_CAST((GHIDRA_CAST((sprite)))->Sprite)::Color(); - (GHIDRA_CAST((GHIDRA_CAST(local_a0))))->Color::operator_assign(tmpColor); - Color::Lerp(GHIDRA_CAST(local_cc),GHIDRA_CAST(local_a0),&this->_floorColor,0.1); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((sprite)))->Sprite)::Color(); - fVar20 = (GHIDRA_CAST((spriteColor)))->Color::A(); - Font::SetLineHeightModifier(GHIDRA_CAST(local_cc),fVar20); - (GHIDRA_CAST((GHIDRA_CAST(local_cc))))->Color::SetTint(0.02,0.02,0.02,1.0); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(GHIDRA_CAST(local_cc)); - } - bVar2 = Game::IsInTimedSet(g_game,0x19); - if (((bVar2 != 0) || (bVar2 = Game::GetDebugFlag(g_game,9), bVar2 != 0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsActiveEnemy(0), bVar2 != 0)) { - pEVar9 = GHIDRA_CAST(((this->_maxHitPoints / 30.0) / 30.0)); - local_28c = pEVar9; - bVar2 = Game::IsInTimedSet(g_game,0x19); - if (bVar2 != 0) { - this->_isInvicible = 1; - } - iVar16 = this->_type; - if (iVar16 == 0x104) { - if (this->_variant != 10) goto LAB_006c9e06; -LAB_006c9da4: - pEVar9 = GHIDRA_CAST(((float)local_28c * 3.0)); -LAB_006c9db4: - local_28c = pEVar9; - } - else { - if ((((iVar16 == 0x47) || (iVar16 == 0x48)) || - ((iVar16 == 0x49 || ((iVar16 == 0x4a || (iVar16 == 0x4b)))))) || (iVar16 == 0x4c)) - goto LAB_006c9da4; -LAB_006c9e06: - if (iVar16 == 0x51) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetBossID(); - if (iVar16 == 0x18) goto LAB_006c9da4; - iVar16 = this->_type; - } - if ((iVar16 != 0x112) && (iVar16 != 0x113)) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetBossID(); - if (iVar16 != 0x37) goto LAB_006c9dbc; - pEVar9 = GHIDRA_CAST(((float)local_28c * 4.0)); - goto LAB_006c9db4; - } - pEVar9 = GHIDRA_CAST(((float)local_28c * 0.33333)); - local_28c = pEVar9; - if (this->_isInvicible != 0) { - pEVar9 = GHIDRA_CAST(0x0); - goto LAB_006c9db4; - } - } -LAB_006c9dbc: - gridEntity = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetVariant(); - if (iVar16 == 0x11) { - pEVar9 = GHIDRA_CAST(((float)local_28c + (float)local_28c)); -LAB_006c9ee0: - local_28c = pEVar9; - } - else { - gridEntity = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetVariant(); - if (iVar16 == 6) { - pEVar9 = GHIDRA_CAST(((float)local_28c * 3.0)); - goto LAB_006c9ee0; - } - gridEntity = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetVariant(); - if (iVar16 != 5) { - pEVar9 = GHIDRA_CAST(((float)local_28c * 6.0)); - goto LAB_006c9ee0; - } - } - bVar2 = Game::GetDebugFlag(g_game,9); - if (bVar2 != 0) { - pEVar9 = GHIDRA_CAST(((float)local_28c * 100.0)); - local_28c = pEVar9; - } - cVar3 = this->IsBoss(); - if ((cVar3 == '\0') && (bVar2 = Game::GetDebugFlag(g_game,9), bVar2 == 0)) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetAliveBossesCount(); - if (iVar16 < 1) { - this->_canShutDoors = 0; - } - } - else { - iVar16 = this->_type; - if (((iVar16 == 0x4a) || (iVar16 == 0x4b)) || (iVar16 == 0x4c)) { - pEVar9 = GHIDRA_CAST(this->_health); - if ((0.0 < (float)pEVar9) || (this->_entityCollisionClass == 0)) goto LAB_006ca08e; - this->_isInvicible = 0; - this->_health = 1.0; - this->_dead = 1; - } - else { - pEVar9 = GHIDRA_CAST(this->_health); - if (0.0 < (float)pEVar9) { -LAB_006ca08e: - pEVar9 = GHIDRA_CAST(((float)pEVar9 - (float)local_28c)); - this->_health = (float)pEVar9; - } - else { - bVar2 = Game::GetDebugFlag(g_game,9); - if ((((bVar2 == 0) && (iVar16 = this->_type, iVar16 != 0x24)) && - ((iVar16 != 0x106 && - ((((iVar16 != 0x107 && (iVar16 != 0x4e)) && (iVar16 != 0x47)) && - ((iVar16 != 0x48 && (iVar16 != 0x49)))))))) && - ((iVar16 != 0x104 || (this->_variant != 10)))) { - gridEntity = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetVariant(); - if (iVar16 != 0x11) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetBossID(); - if (iVar16 != 0x37) { - if (this->_type == 0x51) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar16 = (GHIDRA_CAST((pRVar10)))->Room::GetBossID(); - if (iVar16 == 0x18) goto LAB_006ca02b; - } - this->_canShutDoors = 0; - goto LAB_006ca09e; - } - } - } -LAB_006ca02b: - this->_isInvicible = 0; - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x20); - sourceRef = ::(GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::EntityRef(); - (*pcVar1)(0x3f800000,0,0,sourceRef,0x1e); - this->_dead = 1; - } - } - } - } -LAB_006ca09e: - FUN_006d6650(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFlying(); - if ((bVar2 == 0) && (this->_visible != 0)) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsActiveEnemy(0); - if (bVar2 != 0) { - pEVar9 = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::LengthSquared(); - local_298.y = (float)pEVar9; - if (1.0 < (float)pEVar9) { - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - cVar3 = (GHIDRA_CAST((pRVar10)))->Room::HasWater(); - if (((cVar3 != '\0') && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(7,this->_index), bVar2 != 0) - ) && (this->_entityCollisionClass != 0)) { - uVar4 = Random(); - tmpVec = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_54,&this->_velocity); - uVar33 = 0; - pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar28 = 0; - pEVar7 = Game::Spawn(g_game,1000,99,tmpVec,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); - pEVar7 = GHIDRA_CAST(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33)); - pEVar9 = GHIDRA_CAST((this->_size * 0.05 * this->_scale)); - local_298.y = (float)pEVar9; - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_2f8,&local_298.y); - (GHIDRA_CAST((pEVar7)))->Entity::SetSpriteScale(tmpVec); - set_field_358(pEVar7,-10.0); - local_298.y = 0.5; - tmpVec = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(GHIDRA_CAST((local_318 + 8)),&local_298.y); - (GHIDRA_CAST((pEVar7)))->Entity::SetVelocity(tmpVec); - pEVar7->Update(); - } - } - } - } - tmpVec = &this->_pos; - local_2b8.y = (float)tmpVec; - (GHIDRA_CAST((&this->_pausePosition)))->Vector::operator_assign(tmpVec); - if (this->_isBestiaryEncountered == 0) { - entityList = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryAddBestiaryEncounter(entityList,this->_type,this->_variant); - this->_isBestiaryEncountered = 1; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0xd0)) * 2,this->_index); - if (bVar2 == 0) { - if ((this->_type == 0x322) && (this->_state == 8)) { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - bVar2 = AnimationState::IsLoopingAnimation(animState); - if ((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,this->_index), bVar2 != 0)) - goto LAB_006ca297; - } - } - else { -LAB_006ca297: - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(0); - } - iVar16 = this->_type; - if (iVar16 == 0x38a) { - Hornfel_UpdateFrame(this); - iVar16 = this->_type; - } - if (iVar16 == 0x38b) { - if (this->_state == 1) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - camera = GHIDRA_CAST(FUN_00428a70()); - (GHIDRA_CAST((camera)))->Camera::SetFocusPosition(tmpVec); - iVar16 = this->_type; - goto LAB_006ca2e9; - } - } - else { -LAB_006ca2e9: - if (((iVar16 == 0x5c) && - ((GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero), this->_variant == 1)) && - ((GHIDRA_CAST(this->_entityRef) != GHIDRA_CAST(0x0) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this->_entityRef))))->Entity::IsEnemy(), bVar2 != 0)))) { - pEVar7 = GHIDRA_CAST(this->_entityRef); - tmpVec = (GHIDRA_CAST((pEVar7)))->Entity::Position(&local_54); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__sub(&local_2f8,&this->_pos); - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(tmpVec); - tmpVec = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__unm(GHIDRA_CAST((local_318 + 8))); - (GHIDRA_CAST((&pEVar7->_targetPosition)))->Vector::operator_assign(tmpVec); - } - } - if (this->_type == 0x19b) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered(&DAT_00b1d534); - if (bVar2 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00407470(); - if (0.2 < (float)pEVar9) { - (GHIDRA_CAST((&local_2e8)))->Vector::Vector(this->_size,this->_size * 0.65); - iVar16 = Isaac::Random(10); - pEVar9 = GHIDRA_CAST((iVar16 + 0xc)); - local_298.y = (float)pEVar9; - if (0 < GHIDRA_INT(pEVar9)) { - do { - tmpVec = MusicManager::RandomVector(&local_54); - (GHIDRA_CAST((&local_2e8)))->Vector::Mul(&local_2d0,tmpVec); - fVar20 = random_float(); - local_298.y = fVar20 * 5.0 + 3.0; - tmpVec = Vector::operator_mul(&local_2f8,&local_298.y,&local_2d0); - (GHIDRA_CAST((tmpVec)))->Vector::__div(&local_2e0,&local_2e8.x); - uVar4 = Random(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_2b8.y))))->Vector::__add(GHIDRA_CAST((local_318 + 8)),&local_2d0); - projectile = (Entity_Projectile *) - Game::Spawn(g_game,1000,99,tmpVec,&local_2e0,GHIDRA_CAST(0x0),1,uVar4); - tmpVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity)::SpriteScale(); - local_2f0.y = 2.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_334,&local_2f0.y); - (GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity::SetSpriteScale(tmpVec); - fVar20 = random_float(); - FUN_00444c70(-4.0 - fVar20 * 8.0); - (GHIDRA_CAST((projectile)))->Entity_Projectile::set_falling_accel(1.5); - projectile->Update(); - pEVar9 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar9[-1])) + 0x4bf)))); - } while (pEVar9 != GHIDRA_CAST(0x0)); - this = npc; - } - } - } - } - if (this->_dead != 0) { - if ((((isDeadBefore == 0) && (cVar3 = this->IsBoss(), cVar3 == '\0')) && - (*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x2c)) == '\0')) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000000000000), bVar2 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Pickup::Update(); - uVar4 = 0; - iVar16 = Game::GetNumPlayers(g_game); - if (iVar16 != 0) { - do { - player = Game::GetPlayer(g_game,uVar4); - (GHIDRA_CAST((player)))->Entity_Player::trigger_npc_death(GHIDRA_CAST(this)); - uVar4 = uVar4 + 1; - uVar13 = Game::GetNumPlayers(g_game); - } while (uVar4 < uVar13); - } - FUN_006d5350(); - FUN_0042c770(&local_2a4); - pvVar8 = msvc::iterator_copy(&this->_entityPtrReferrers,&local_298.y); - cVar3 = FUN_0042c710(pvVar8); - while (cVar3 != '\0') { - entitySlot = GHIDRA_CAST(FUN_005cba30()); - *GHIDRA_CAST(*entitySlot) = 0; - set_iterator_post_increment(&local_2a4,&local_2b8.y,0); - pvVar8 = msvc::iterator_copy(&this->_entityPtrReferrers,&local_298.y); - cVar3 = FUN_0042c710(pvVar8); - } - msvc::set::clear(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Stop(); - FUN_0040a9c0(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::RemoveStatusEffects(); - ANM2::Reset(&this->_statusEffectSprite); - this->SetCollisionDamage(0); - this->_entityCollisionClass = 4; - if ((this->_entityGridCollisionClass < 3) || (this->_entityGridCollisionClass == 7)) { - this->_entityGridCollisionClass = 3; - } - pRVar10 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec = (GHIDRA_CAST((pRVar10)))->Room::GetClampedPosition(&local_54,&this->_pos,0.0); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(tmpVec); - if (*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x48)) < 1) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSize(this->_size,this->_sizeMulti,8); - } - this->_mass = 1000.0; - this->_dead = 0; - this->_canShutDoors = 0; - this->_isBoss = 0; - this->_isInvicible = 1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x2000000010011); - this->_health = 10.0; - this->_maxHitPoints = 10.0; - if (((this->_type == 0x322) && (GHIDRA_CAST(this->_parent) != GHIDRA_CAST(0x0))) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::IsFamiliar(), bVar2 != 0)) { - FUN_0062e0e0(this); - } - this->_spawnerType = 0; - this->_spawnerVariant = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSpawnerEntity(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetParent(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetChild(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - this->_stateFrame = this->_type; - this->_type = 0x3c3; - this->ResetColor(); - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x3c); - uVar28 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0x3f800000,0x3f800000,0x3f800000,0x3f000000,0x3f4ccccd, - 0x3f800000,0x3f99999a); - (*pcVar1)(uVar28,6,1,1,1); - } - if (this->_dead != 0) goto LAB_006ca82b; - } - if (this->_state != 0x12) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x80000000000000); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x400000); - } -LAB_006ca82b: - iVar16 = this->_forcedTargetTimer; - if (iVar16 < 1) { - if (iVar16 < 0) { - this->_forcedTargetTimer = iVar16 + 1; - } - } - else { - this->_forcedTargetTimer = iVar16 + -1; - if (iVar16 + -1 == 0) { - cVar3 = this->IsBoss(); - if (cVar3 != '\0') { - this->_forcedTargetTimer = -0x96; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_forcedTarget))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - ExceptionList = local_1c; - return; -} - -// 006ca930 -void Entity_NPC::update_frozen() -{ - BitSet128 flags; - uint32_t rngResult; - Entity *effect; - LayerState *layer; - Vector *clampedPos; - Entity_Tear *iceTear; - int damageEvent; - float fVar1; - float particleScale; - uint8_t auStack_78 [12]; - Vector VStack_6c; - int shardIdx; - float angleRad; - float fStack_5c; - Vector VStack_58; - uint32_t uStack_50; - uint32_t uStack_4c; - uint32_t uStack_48; - uint32_t sourceRef; - uint32_t local_3c; - uint32_t local_38; - uint32_t local_34; - float local_30; - float local_2c; - float local_28; - float local_24; - uint32_t local_20; - uint32_t local_1c; - float fStack_18; - uint32_t local_14; - - local_14 = __security_cookie ^ GHIDRA_UINT(auStack_78); - this->_friction = this->_friction * 0.5; - damageEvent = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - if (damageEvent != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))) { - do { - if (this->_dead != 0) break; - if ((*GHIDRA_CAST((damageEvent + 8)) & 0x1000004) == 0) { - fVar1 = this->_health - 1.0; - this->_health = fVar1; - if (fVar1 <= 0.0) goto LAB_006ca9aa; - } - else { -LAB_006ca9aa: - local_30 = g_vectorZero.x; - local_28 = g_vectorZero.x; - local_2c = g_vectorZero.y; - local_24 = g_vectorZero.y; - sourceRef = 0; - local_3c = 0; - local_38 = 0; - local_34 = 0; - local_20 = 0; - local_1c = 0; - this->Kill(&sourceRef); - } - damageEvent = damageEvent + 0x38; - } while (damageEvent != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - this->_pendingDamage = 0.0; - *GHIDRA_CAST(&this->_pendingDamageFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)) = 0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - if ((this->_flags & 0x800000000000) != 0) { - rngResult = Random(); - if ((rngResult & 1) == 0) { - rngResult = Random(); - effect = Game::SpawnEx(g_game,1000,0x36,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,rngResult,0) - ; - rngResult = Random(); - damageEvent = *GHIDRA_CAST(effect); - particleScale = - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.2; - fVar1 = particleScale * g_vectorOne.x; - (effect->_sprite)._scale.y = particleScale * g_vectorOne.y; - (effect->_sprite)._scale.x = fVar1; - (**(code **)(damageEvent + 0xc))(); - } - rngResult = Random(); - VStack_6c.x = (this->_velocity).x * 0.14; - VStack_6c.y = (this->_velocity).y * 0.14; - effect = Game::SpawnEx(g_game,1000,0x3b,&this->_pos,&VStack_6c,GHIDRA_CAST(0x0),0,rngResult,0); - rngResult = Random(); - *GHIDRA_CAST((effect[1]._sprite._animDefaultName._buf + 4)) = - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 10.0 + 2.0; - rngResult = Random(); - local_20 = 0x3f4ccccd; - local_1c = 0x3f666666; - damageEvent = rngResult % 0xf + 0xf; - fStack_18 = 1.0; - *GHIDRA_CAST((effect[1]._sprite._filename._buf + 4)) = damageEvent; - *GHIDRA_CAST((effect[1]._sprite._filename._buf + 8)) = damageEvent; - (effect->_posOffset).x = (this->_posOffset).x; - (effect->_posOffset).y = (this->_posOffset).y; - layer = ANM2::GetLayer(&effect->_sprite,GHIDRA_CAST(0x0)); - if (&layer->_color != GHIDRA_CAST(&sourceRef)) { - (layer->_color)._tint[0] = 1.0; - (layer->_color)._tint[1] = 1.0; - (layer->_color)._tint[2] = 1.0; - (layer->_color)._tint[3] = 0.4; - (layer->_color)._colorize[0] = 0.0; - (layer->_color)._colorize[1] = 0.0; - (layer->_color)._colorize[2] = 0.0; - (layer->_color)._colorize[3] = 0.0; - *GHIDRA_CAST((layer->_color)._offset) = CONCAT44(local_1c,local_20); - (layer->_color)._offset[2] = fStack_18; - } - if (this->_collidesWithGrid != 0) { - VStack_6c.x = (this->_pos).x - (this->_gridCollisionVelocity).x; - VStack_6c.y = (this->_pos).y - (this->_gridCollisionVelocity).y; - clampedPos = Room::GetClampedPositionImpl(g_game->_room,&VStack_58,&VStack_6c,4.0,4.0,4.0,4.0) - ; - sourceRef = 0; - local_3c = 0; - local_38 = 0; - (this->_pos).x = clampedPos->x; - (this->_pos).y = clampedPos->y; - local_30 = g_vectorZero.x; - local_28 = g_vectorZero.x; - local_2c = g_vectorZero.y; - local_24 = g_vectorZero.y; - local_34 = 0; - local_20 = 0; - local_1c = 0; - this->Kill(&sourceRef); - } - } - if (this->_dead != 0) { - trigger_kill_item_effects(this); - fStack_5c = (float)g_game->_stage + 7.0; - rngResult = Random(); - shardIdx = 0; - VStack_6c.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)] - ) * 2.3283064e-10 * 360.0; - do { - angleRad = ((float)shardIdx * 36.0 + VStack_6c.x) * 0.017453292; - VStack_58.x = cos(angleRad); - VStack_58.x = VStack_58.x * 16.0; - VStack_58.y = sin(angleRad); - VStack_58.y = VStack_58.y * 16.0; - rngResult = Random(); - iceTear = (Entity_Tear *) - Game::SpawnEx(g_game,2,0x29,&this->_pos,&VStack_58,GHIDRA_CAST(0x0),0,rngResult,0); - iceTear->SetCollisionDamage(fStack_5c); - uStack_50 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4))); - VStack_58.y = (float)(GHIDRA_UINT(g_tearFlagIce._l) | GHIDRA_UINT(g_tearFlagSlow._l)); - uStack_48 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4))); - uStack_4c = GHIDRA_UINT(g_tearFlagIce._h) | GHIDRA_UINT(g_tearFlagSlow._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = uStack_50; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = VStack_58.y; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uStack_4c; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_48; - (GHIDRA_CAST((iceTear)))->Entity_Tear::SetTearFlags(flags); - iceTear->_fallingAccel = 0.2; - iceTear->_spawnerType = 1; - iceTear->Update(); - shardIdx = shardIdx + 1; - } while (shardIdx < 10); - } - return; -} - -// 006cb2a0 -void Entity_NPC::fire_projectile_from_params(Entity_Projectile *projectile) -{ - int championColor; - - if (this->_isChampion == 0) { - championColor = -1; - } - else { - championColor = this->_championColorIdx; - } - Entity_Projectile::apply_spawn_flags - (projectile,championColor,this->_scale,this->_flags,GHIDRA_CAST(this)); - return; -} - -// 006d0300 -void Entity_NPC::SetBossColorIdx(int bossColorIdx, int unused) -{ - uint8_t isAnimSet; - std_string *anim; - - if (this->_bosscoloridx != bossColorIdx) { - this->_bosscoloridx = bossColorIdx; - load_graphics(this,1); - anim = &(this->_sprite)._animDefaultName; - if (0xf < (this->_sprite)._animDefaultName._capacity) { - anim = *GHIDRA_CAST(anim->_buf); - } - isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(anim),1); - if ((isAnimSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0); - if ((this->_sprite)._animState._animData != (void *)0x0) { - (this->_sprite)._animState._isPlaying = 0; - } - } - } - this->ResetColor(); - return; -} - -// 006d03e0 -void Entity_NPC::MakeChampion(uint32_t seed, int championColor, uint8_t isInit) -{ - code *pcVar1; - uint32_t extraout_EAX; - Entity *spawnedChild; - uint32_t colorArg; - float *clampedMaxHp; - int iVar2; - uint32_t uVar3; - float scaleX; - float fVar4; - float oldMaxHpCopy; - Entity *local_40; - Entity *local_3c; - uint8_t local_38 [24]; - uint8_t local_20 [8]; - float afStack_18 [3]; - uint32_t local_c; - uint8_t auStack_8 [4]; - float *maxHp; - float oldMaxHp; - uint32_t *parentRef; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - if ((this->_isChampion != 0) && (isInit == 0)) { - return; - } - oldMaxHp = this->_maxHitPoints; - maxHp = &this->_maxHitPoints; - afStack_18[0] = 7.00649e-45; - afStack_18[1] = 4.2039e-45; - local_3c = GHIDRA_CAST(0x15); - afStack_18[2] = 2.94273e-44; - *maxHp = oldMaxHp + oldMaxHp; - oldMaxHpCopy = oldMaxHp; - this->ResetColor(); - if (0.0 < this->_collisionDamage) { - this->_collisionDamage = 2.0; - } - this->_isChampion = 1; - this->_championColorIdx = championColor; - if (championColor < 0) { - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = seed >> ((*GHIDRA_CAST((GHIDRA_CAST(&(afStack_18[0])) + 0x0))) & 0x1f) ^ seed; - uVar3 = uVar3 << ((*GHIDRA_CAST((GHIDRA_CAST(&(afStack_18[1])) + 0x0))) & 0x1f) ^ uVar3; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) = uVar3 >> ((uint8_t)local_3c & 0x1f) ^ uVar3; - fVar4 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&((double)GHIDRA_INT(local_20))) + 0x4))) + - __uint_to_double_fixup[-((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_20))) + 0x4))) >> 0x1f)]) * 2.3283062e-10; - if ((0.01 <= fVar4) || (g_game->_stage < 5)) { - if ((0.05 <= fVar4) || (g_game->_stage < 5)) { - if (0.15 <= fVar4) { - if (0.3 <= fVar4) { - if ((0.35 <= fVar4) || (g_game->_stage < 5)) { - if (g_game->_stage < 3) { - uVar3 = (GHIDRA_CAST((GHIDRA_CAST((local_20 + 4)))))->RNG::RandomInt(6); - championColor = *GHIDRA_CAST((&DAT_00b673c4 + uVar3 * 4)); - } - else { - uVar3 = (GHIDRA_CAST((GHIDRA_CAST((local_20 + 4)))))->RNG::RandomInt(7); - championColor = *GHIDRA_CAST((&DAT_00b673dc + uVar3 * 4)); - } - } - else { - uVar3 = (GHIDRA_CAST((GHIDRA_CAST((local_20 + 4)))))->RNG::RandomInt(4); - championColor = *GHIDRA_CAST((&DAT_00b67380 + uVar3 * 4)); - } - } - else { - uVar3 = (GHIDRA_CAST((GHIDRA_CAST((local_20 + 4)))))->RNG::RandomInt(GHIDRA_UINT((2 < g_game->_stage)) * 2 + 4); - championColor = *GHIDRA_CAST((&DAT_00b67390 + uVar3 * 4)); - } - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_20)) + 0x4))) == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_20))) + 0x4))) >> ((*GHIDRA_CAST((GHIDRA_CAST(&(afStack_18[0])) + 0x0))) & 0x1f) ^ (*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))); - uVar3 = uVar3 << ((*GHIDRA_CAST((GHIDRA_CAST(&(afStack_18[1])) + 0x0))) & 0x1f) ^ uVar3; - championColor = - *GHIDRA_CAST((&DAT_00b673a8 + ((uVar3 >> ((uint8_t)local_3c & 0x1f) ^ uVar3) % 3) * 4)); - } - } - else { - uVar3 = (GHIDRA_CAST((GHIDRA_CAST((local_20 + 4)))))->RNG::RandomInt(4); - championColor = *GHIDRA_CAST((&DAT_00b673b4 + uVar3 * 4)); - } - } - else { - championColor = 0x19; - if (fVar4 < 0.005) { - championColor = 6; - } - } - } - if ((championColor == 0xc) && - ((((iVar2 = this->_type, iVar2 == 0xf0 || (iVar2 == 0xf2)) || (iVar2 == 0xf1)) || - (iVar2 == 0x130)))) { - championColor = 0; -LAB_006d0647: - fVar4 = 1.15; - this->_championColorIdx = championColor; - if (championColor == 0x12) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSize(this->_size * 0.5,this->_sizeMulti, - *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x48))); - fVar4 = 0.5; - } - else if (championColor == 0x13) { - fVar4 = 1.5; - } - } - else { - if ((championColor == 6) && (this->_type == 0x379)) { - championColor = 0x11; - goto LAB_006d0647; - } - if (championColor < 1) { - championColor = 0; - } - if (championColor < 0x19) goto LAB_006d0647; - fVar4 = 1.15; - this->_championColorIdx = 0x19; - } - this->_scale = fVar4; - fVar4 = fVar4 * this->_shrinkStatus1; - scaleX = fVar4 * g_vectorOne.x; - (this->_sprite)._scale.y = fVar4 * g_vectorOne.y; - (this->_sprite)._scale.x = scaleX; - load_graphics(this,0); - switch(this->_championColorIdx) { - case 0: - *maxHp = *maxHp * 1.333; - break; - case 1: - this->_championSpeed = 1.333; - *maxHp = *maxHp * 0.75; - break; - case 7: - *maxHp = *maxHp * 0.333; - case 4: - this->_championSpeed = 0.8; - break; - case 8: - this->_entityGridCollisionClass = 3; - break; - case 9: - uVar3 = Random(); - this->_flickerTimer = uVar3 % 0x1e + 0x3c; - break; - case 10: - uVar3 = Random(); - this->_championTimer = uVar3 % 0x14 + 0x28; - break; - case 0xb: - uVar3 = Random(); - spawnedChild = Game::Spawn(g_game,1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3); - parentRef = &spawnedChild->_parent; - if (spawnedChild->_parent != 0) { - local_3c = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_3c); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - break; - case 0x10: - uVar3 = Random(); - spawnedChild = Game::Spawn(g_game,1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),1,uVar3); - parentRef = &spawnedChild->_parent; - if (spawnedChild->_parent != 0) { - local_3c = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_3c); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - break; - case 0x11: - if (isInit != 0) goto LAB_006d0b75; - uVar3 = Random(); - local_3c = Game::Spawn(g_game,0x60,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3); - parentRef = &local_3c->_parent; - if (local_3c->_parent != 0) { - local_40 = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_40); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - ::(GHIDRA_CAST((GHIDRA_CAST((local_38 + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((local_3c)))->Entity::AddShrink(GHIDRA_CAST((local_38 + 4)),0x96,1,1); - FUN_006b5de0(); - break; - case 0x12: - *maxHp = *maxHp * 0.333; - this->_championSpeed = this->_championSpeed * 1.333; - break; - case 0x13: - *maxHp = *maxHp * 1.5; - this->_championSpeed = this->_championSpeed * 0.9; - case 0x17: - if (0.0 < this->_collisionDamage) { - this->_collisionDamage = 4.0; - } - goto LAB_006d0b75; - case 0x14: - uVar3 = Random(); - local_40 = Game::Spawn(g_game,1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),2,uVar3); - parentRef = &local_40->_parent; - if (local_40->_parent != 0) { - local_3c = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_3c); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - (GHIDRA_CAST((GHIDRA_CAST(local_38))))->Color::Color(1.0,0.2,0.2,1.0); - local_40->SetColor(extraout_EAX,0xffffffff,0xff,0,1); - break; - case 0x16: - *maxHp = *maxHp * 3.0; - break; - case 0x19: - this->_championSpeed = 1.333; - *maxHp = *maxHp * 1.5; - uVar3 = Random(); - this->_championTimer = uVar3 % 0x14 + 0x28; - uVar3 = Random(); - spawnedChild = Game::Spawn(g_game,1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3); - parentRef = &spawnedChild->_parent; - if (spawnedChild->_parent != 0) { - local_40 = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_40); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - if (isInit == 0) { - uVar3 = Random(); - spawnedChild = Game::Spawn(g_game,0x60,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3); - parentRef = &spawnedChild->_parent; - if (spawnedChild->_parent != 0) { - local_40 = GHIDRA_CAST(parentRef); - msvc::multiset::erase(&local_40); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - } - if (*GHIDRA_CAST(g_game->_room) == '\0') { - iVar2 = -1; - } - else { - iVar2 = g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)); - } - hsv_to_rgb(GHIDRA_CAST(local_20),((float)(iVar2 % 0x5a) * 360.0) / 90.0,1.0,1.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(local_38))))->Color::Color((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_20)) + 0x0))),(*GHIDRA_CAST((GHIDRA_CAST(&((float)local_20)) + 0x4))),afStack_18[0],1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Entity::SetColor(colorArg); - } -LAB_006d0b75: - if ((this->_type == 0x10) && (this->_variant == 2)) { - clampedMaxHp = &oldMaxHpCopy; - if (*maxHp <= oldMaxHp) { - clampedMaxHp = maxHp; - } - *maxHp = *clampedMaxHp; - } - if (isInit == 0) { - this->_health = *maxHp; - } - this->ResetColor(); - return; -} - -// 006d0c20 -void Entity_NPC::SetRef_bec(Entity *entity) -{ - Entity_NPC *local_8; - uint32_t *entityRef; - - entityRef = &this->_entityRef; - local_8 = this; - if (*entityRef != 0) { - local_8 = GHIDRA_CAST(entityRef); - msvc::multiset::erase(&local_8); - } - *entityRef = entity; - if (entity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(entityRef); - } - return; -} - -// 006d0c60 -void * Entity_NPC::QueryNPCsType(void *outList, int type, int variant) -{ - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),outList,type,variant,-1,0,0); - return outList; -} - -// 006d0dd0 -EntityList * Entity_NPC::QueryNPCsGroup(EntityList *outList, int groupIdx) -{ - int entity; - int listSize; - uint32_t entityIndex; - Game *game; - void *room; - void *sourceRoom; - - game = g_game; - room = g_game->_room; - entityIndex = 0; - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1294)) = 0; - sourceRoom = game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(sourceRoom) + 0x1264)) != 0) { - do { - entity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(sourceRoom) + 0x125c)) + entityIndex * 4)); - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((entity + 0x28)) == 1)) || - (*GHIDRA_CAST((entity + 0x28)) - 10U < 0x3de)) && - ((entity = __RTDynamicCast(entity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0), - entity != 0 && (*GHIDRA_CAST((entity + 0xc7c)) == groupIdx)))) { - listSize = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1294)); - if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1290)) < listSize + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - listSize = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1294)); - } - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x128c)) + listSize * 4)) = entity; - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1294)) = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1294)) + 1; - } - entityIndex = entityIndex + 1; - } while (entityIndex < *GHIDRA_CAST((GHIDRA_CAST(sourceRoom) + 0x1264))); - } - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::assign(GHIDRA_CAST(outList), - GHIDRA_CAST((GHIDRA_INT(room) + 0x1288))); - return outList; -} - -// 006d1580 -void * Entity_NPC::fireplace_get_loot(void *outLoot, uint8_t isShouldAdvance) -{ - int *ptr; - uint8_t bVar1; - uint32_t uVar2; - int iVar3; - void *lootBlocks; - void *lootBlocks; - RNG *rng; - int *lootList; - void *lootMap; - int lootMapSize; - uint32_t lootOffset; - int lootCount; - float dropChance; - void *local_48; - RNG rngCopy; - RNG trinketRng; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint32_t pickupSubtype; - uint32_t pickupVariant; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00afab6d; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - ExceptionList = &local_1c; - local_48 = outLoot; - lootList = GHIDRA_CAST(0x0); - lootMap = (void *)0x0; - lootMapSize = 0; - lootOffset = 0; - lootCount = 0; - lootList = operator_new(8); - lootList[1] = 0; - *lootList = GHIDRA_INT(&lootList); - local_14 = 0; - if ((((((this->_flags & 0x40000000000) != 0) || (iVar3 = this->_variant, iVar3 == 0xb)) || - (iVar3 == 10)) || ((iVar3 == 0xc || (iVar3 == 0xd)))) || (iVar3 == 4)) { - (GHIDRA_CAST((outLoot)))->LootList::LootList(&lootList); - if (lootCount != 0) { - do { - lootCount = lootCount + -1; - } while (lootCount != 0); - lootOffset = 0; - lootCount = 0; - } - lootBlocks = lootMap; - iVar3 = lootMapSize; - if (lootMapSize != 0) { - do { - lootBlocks = *(void **)(GHIDRA_CAST(lootBlocks) + iVar3 * 4 + -4); - iVar3 = iVar3 + -1; - if (lootBlocks != (void *)0x0) { - operator_delete(lootBlocks,0x14); - lootBlocks = lootMap; - } - } while (iVar3 != 0); - } - if (lootBlocks != (void *)0x0) { - uVar2 = lootMapSize * 4; - lootBlocks = lootBlocks; - if (0xfff < uVar2) { - lootBlocks = *(void **)(GHIDRA_CAST(lootBlocks) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(lootBlocks) + (-4 - GHIDRA_INT(lootBlocks))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(lootBlocks,uVar2); - } - ptr = lootList; - lootMapSize = 0; - lootMap = (void *)0x0; - lootList = GHIDRA_CAST(0x0); - operator_delete(ptr,8); - ExceptionList = local_1c; - return outLoot; - } - rngCopy._seed = (this->_dropRNG)._seed; - rngCopy._shift1 = (this->_dropRNG)._shift1; - rngCopy._shift2 = (this->_dropRNG)._shift2; - rngCopy._shift3 = (this->_dropRNG)._shift3; - rng = &rngCopy; - if (isShouldAdvance != 0) { - rng = &this->_dropRNG; - } - if ((iVar3 == 2) || (iVar3 == 3)) { - bVar1 = Game::IsHardMode(); - if (bVar1 == 0) { - dropChance = 0.25; - } - else { - dropChance = 0.1; - } - local_48 = (void *)(GHIDRA_CAST((rng)))->RNG::RandomFloat(); - if (dropChance <= (float)local_48) goto LAB_006d17dc; - bVar1 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x16); - if (bVar1 != 0) { - trinketRng._seed = rng->_seed; - trinketRng._shift1 = 1; - trinketRng._shift2 = 0xb; - trinketRng._shift3 = 6; - uVar2 = (GHIDRA_CAST((&trinketRng)))->RNG::RandomInt(5); - if (uVar2 != 0) goto LAB_006d17dc; - } - iVar3 = PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,0x16); - if (iVar3 < 2) { - uVar2 = (GHIDRA_CAST((rng)))->RNG::Next(); - pickupSubtype = 3; - } - else { - uVar2 = (GHIDRA_CAST((rng)))->RNG::Next(); - pickupSubtype = 6; - } -LAB_006d17d0: - pickupVariant = 10; - } - else { - bVar1 = Game::IsHardMode(); - if (bVar1 == 0) { - dropChance = 0.25; - } - else { - dropChance = 0.1; - } - local_48 = (void *)(GHIDRA_CAST((rng)))->RNG::RandomFloat(); - if (dropChance <= (float)local_48) goto LAB_006d17dc; - local_48 = (void *)(GHIDRA_CAST((rng)))->RNG::RandomFloat(); - if ((float)local_48 < 0.25) { - bVar1 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x16); - if (bVar1 != 0) { - trinketRng._seed = rng->_seed; - trinketRng._shift1 = 1; - trinketRng._shift2 = 0xb; - trinketRng._shift3 = 6; - uVar2 = (GHIDRA_CAST((&trinketRng)))->RNG::RandomInt(5); - if (uVar2 != 0) goto LAB_006d1719; - } - uVar2 = (GHIDRA_CAST((rng)))->RNG::Next(); - pickupSubtype = 0; - goto LAB_006d17d0; - } -LAB_006d1719: - uVar2 = (GHIDRA_CAST((rng)))->RNG::Next(); - pickupSubtype = 0; - pickupVariant = 0x14; - } - msvc::deque::push_back(5,pickupVariant,pickupSubtype,uVar2,0); -LAB_006d17dc: - (GHIDRA_CAST((outLoot)))->LootList::LootList(&lootList); - FUN_006b84c0(); - ExceptionList = local_1c; - return outLoot; -} - -// 006d2b50 -void Entity_NPC::Interpolate() -{ - int iVar1; - Entity *this_00; - uint8_t isEnemy; - int *playerSlot; - void *playerListEnd; - PlayerManager *playerManager; - float fVar2; - float dy; - uint32_t i; - uint32_t flags; - int type; - - if (this->_pauseTimer != 0) { - return; - } - if (this->_type == 0x3c5) { - flags = GHIDRA_UINT(this->_flags); - if ((flags & 2) == 0) { - (this->_preInterpolatePos).x = (this->_pos).x; - (this->_preInterpolatePos).y = (this->_pos).y; - if (this->_holdCountdown < 1) { - apply_velocity(this,1); - update_move_direction_anim(this); - } - this->_isInterpolating = 1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::CollideWithGrid(1); - iVar1 = this->_child; - if ((iVar1 != 0) && (*GHIDRA_CAST((iVar1 + 0x20)) < GHIDRA_UINT(this->_index))) { - *GHIDRA_CAST((iVar1 + 0x33c)) = (this->_pos).x; - *GHIDRA_CAST((iVar1 + 0x340)) = (this->_pos).y; - } - if (this->_variant == 10) { - playerManager = &g_game->_playerManager; - i = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - playerListEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - } - playerSlot = (playerManager->_playerList)._begin; - if (i < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + i; - } - iVar1 = *playerSlot; - if (*GHIDRA_CAST((iVar1 + 0x3d4)) == this) { - fVar2 = (this->_pos).y; - *GHIDRA_CAST((iVar1 + 0x33c)) = *GHIDRA_CAST((iVar1 + 0x2088)) + (this->_pos).x; - *GHIDRA_CAST((iVar1 + 0x340)) = *GHIDRA_CAST((iVar1 + 0x208c)) + fVar2; - *GHIDRA_CAST((iVar1 + 0x360)) = (this->_velocity).x; - *GHIDRA_CAST((iVar1 + 0x364)) = (this->_velocity).y; - *GHIDRA_CAST((iVar1 + 0x36c)) = this->_friction; - } - i = i + 1; - playerManager = &g_game->_playerManager; - } while (i < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - } - else { - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = flags & 0xfffffffd; - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Interpolate(); - } - if ((this->_aiCallFlags & 2) != 0) { - this->_aiCallPhase = 2; - Entity_NPC_UpdateAI_dispatch(this); - this->_aiCallPhase = 0; - } - UpdateChildEffectPosition(this,1); - if (((((this->_flags & 0x20) != 0 || (this->_flags & 0x200000000000000) != 0) || - (0 < this->_holdCountdown)) || (iVar1 = this->_state, iVar1 == 1)) || - ((iVar1 == 0x12 || (iVar1 == 0x11)))) goto LAB_006d2dd8; - type = this->_type; - if (type == 0x3e) { - if (this->_variant != 3) { -LAB_006d2d6c: - if (type == 0x33e) { - if (this->_variant != 10) goto LAB_006d2dd8; - goto LAB_006d2d79; - } -LAB_006d2d90: - if ((((type != 0x371) && (type != 0x32f)) && ((type != 0x33f || (this->_variant != 0x14)))) || - (iVar1 != 6)) goto LAB_006d2dd8; - } - fVar2 = (this->_v1).x; - } - else { - if (type != 0x393) goto LAB_006d2d6c; - if (this->_variant != 1) goto LAB_006d2d90; -LAB_006d2d79: - fVar2 = (this->_v1).y; - } - (this->_posOffset).y = fVar2 * this->_speedMultiplier * 0.5 + (this->_posOffset).y; -LAB_006d2dd8: - if ((((this->_type == 0x5c) && (this->_variant == 1)) && - (this_00 = GHIDRA_CAST(this->_entityRef), this_00 != GHIDRA_CAST(0x0))) && - (isEnemy = (GHIDRA_CAST((this_00)))->Entity::IsEnemy(), isEnemy != 0)) { - fVar2 = (this_00->_pos).x - (this->_pos).x; - dy = (this_00->_pos).y - (this->_pos).y; - (this->_targetPosition).x = fVar2; - (this->_targetPosition).y = dy; - (this_00->_targetPosition).x = -fVar2; - (this_00->_targetPosition).y = -dy; - } - return; -} - -// 006d2e50 -void Entity_NPC::Render(Vector *offset) -{ - int *piVar1; - int *piVar2; - uint8_t bVar3; - uint32_t uVar4; - uint32_t curses; - LayerState *layer; - float *pfVar5; - int iVar6; - Entity_Player *player; - Entity_NPC *statusTarget; - void *pvVar7; - uint8_t *extraout_ECX; - uint8_t *laterAnimState; - uint8_t *extraout_ECX_00; - uint8_t *extraout_ECX_01; - uint8_t *extraout_ECX_02; - uint8_t *extraout_ECX_03; - uint8_t *extraout_ECX_04; - AnimationState *laterAnimState; - uint8_t *extraout_ECX_05; - uint8_t *extraout_ECX_06; - uint8_t *extraout_ECX_07; - uint32_t extraout_ECX_08; - uint32_t extraout_ECX_09; - uint32_t extraout_ECX_10; - uint32_t extraout_ECX_11; - uint32_t extraout_ECX_12; - uint32_t extraout_ECX_13; - uint32_t extraout_ECX_14; - uint32_t extraout_ECX_15; - uint32_t extraout_ECX_16; - uint32_t extraout_ECX_17; - uint32_t uVar8; - uint32_t extraout_ECX_18; - int *node; - float fVar9; - float fVar10; - double dVar11; - ColorMod trailColor; - ColorMod local_ec; - Vector *renderOffset; - float trailX; - float screenScale; - int renderMode; - Vector renderPos; - float local_a8; - float refOffsetX; - float local_a0; - float *local_9c; - float local_98; - float fStack_94; - Entity_Player *local_90; - Entity_NPC *minecart; - float local_88; - Vector local_84; - float local_7c; - Vector baseOffset; - float local_70; - float alphaMult; - float local_68; - char isHidden; - void *configName; - KColor local_5c; - Color local_48; - uint8_t debugText [4]; - Entity_NPC *local_18; - uint32_t stackCookie; - void *savedExceptionList; - uint8_t *puStack_c; - uint32_t ehState; - Game *game; - char isNil; - Manager *manager; - char *room; - ColorMod *spriteColor; - - ehState = 0xffffffff; - puStack_c = &LAB_00afac0b; - savedExceptionList = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((debugText + 0x18)); - laterAnimState = GHIDRA_CAST(this->_type); - renderOffset = offset; - baseOffset.x = offset->x; - fVar9 = offset->y; - if (((laterAnimState == GHIDRA_CAST(0x3c5)) && (this->_variant == 0)) && (this->_child != 0)) { - return; - } - statusTarget = GHIDRA_CAST(this->_minecart); - renderPos.y = 0.0; - renderPos.x = 0.0; - ExceptionList = &savedExceptionList; - baseOffset.y = fVar9; - local_18 = this; - stackCookie = uVar4; - if ((laterAnimState == GHIDRA_CAST(0x3c5)) && (this->_variant == 10)) { - alphaMult = 1.0; - renderMode = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12bc)); - minecart = this; -LAB_006d301b: - isHidden = '\0'; - } - else { - isHidden = '\0'; - alphaMult = 1.0; - renderMode = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12bc)); - minecart = statusTarget; - if (laterAnimState == GHIDRA_CAST(0x327)) { - if (((g_game->_currentDimensionIdx == 1) && - ((g_game->_stageType == 4 || (g_game->_stageType == 5)))) && - ((g_game->_stage == 2 || - ((g_game->_stage == 1 && (curses = Level::GetCurses(GHIDRA_CAST(g_game)), (curses & 2) != 0))) - ))) { - laterAnimState = GHIDRA_CAST(0x1); - } - else { - laterAnimState = GHIDRA_CAST(0x0); - } - minecart = statusTarget; - if (GHIDRA_CAST(GHIDRA_UINT((renderMode != 5))) != laterAnimState) { - fVar10 = 0.0; - alphaMult = 0.0; - if ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x7240)) <= 0.0) || - ((g_manager->_optionsConfig)._enableWaterSurface == 0)) { - fVar10 = 0.2; - alphaMult = 0.2; - } - fVar9 = g_game->_lightningIntensity; - if (0.0 < fVar9) { - fVar9 = fVar9 + fVar10; - if (fVar9 <= fVar10) { - fVar9 = fVar10; - } - fVar10 = fVar9; - if (1.0 <= fVar9) { - fVar10 = 1.0; - } - alphaMult = fVar10; - } - isHidden = '\x01'; - if (fVar10 != 0.0) goto LAB_006d301b; - } - } - } - statusTarget = minecart; - if (this->_type == 0x371) { - NpcHelper::needle_render(this); -LAB_006d3040: - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - isHidden = layer->_visible == 0; - laterAnimState = extraout_ECX; - } - else if (this->_type == 0x32f) { - render_v1_layer_frames(this,uVar4); - goto LAB_006d3040; - } - if ((((this->_type == 0x32a) && (fVar9 = (this->_posOffset).y, -3.0 < fVar9)) && - (laterAnimState = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) & 0x2000000)), - laterAnimState == GHIDRA_CAST(0x0))) && (renderMode == 3)) { - alphaMult = 0.0; - } - if ((statusTarget != GHIDRA_CAST(0x0)) && (this->_visible != 0)) { - if ((statusTarget->_sprite)._animState._animData != (void *)0x0) { - pfVar5 = AnimationState::GetNullFrameById(&(statusTarget->_sprite)._animState,0); - if (pfVar5 == GHIDRA_CAST(0x0)) { - laterAnimState = extraout_ECX_00; - statusTarget = minecart; - } - else { - local_a8 = g_displayPixelRatio * g_screenPointScale; - local_9c = GHIDRA_CAST(((g_screenHeight - 182.0) * 0.5)); - local_7c = (((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_a8 + 0.5 - ; - dVar11 = floor((double)local_7c); - local_98 = (float)dVar11; - local_7c = (((this->_pos).y - 140.0) * 0.65 + (float)local_9c) * local_a8 + 0.5; - dVar11 = floor((double)local_7c); - statusTarget = minecart; - local_7c = (float)dVar11; - renderPos.x = local_98 / local_a8 + renderOffset->x; - renderPos.y = local_7c / local_a8 + renderOffset->y; - baseOffset.x = baseOffset.x + *pfVar5; - fVar9 = baseOffset.y + pfVar5[1]; - baseOffset.y = fVar9; - (GHIDRA_CAST((GHIDRA_CAST(&minecart->_sprite))))->Sprite::RenderLayer(0,&renderPos,&g_vectorZero,&g_vectorZero); - laterAnimState = extraout_ECX_01; - } - } - alphaMult = alphaMult * (statusTarget->_sprite)._color._tint[3]; - } - iVar6 = this->_spawnerEntity; - if (((iVar6 != 0) && (*GHIDRA_CAST((iVar6 + 0x28)) == 1)) && - (laterAnimState = GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST(laterAnimState) != *GHIDRA_CAST((g_manager + 1)))) { - bVar3 = NetplayManager::IsIdxLocalPlayer(GHIDRA_CAST(laterAnimState),*GHIDRA_CAST((iVar6 + 0x1618))); - laterAnimState = extraout_ECX_02; - if (bVar3 == 0) { - FUN_00925df0(); - alphaMult = alphaMult * fVar9; - laterAnimState = extraout_ECX_03; - } - } - game = g_game; - local_9c = GHIDRA_CAST((this->_sprite)._scale.x); - local_68 = (this->_sprite)._color._tint[3]; - local_7c = (this->_sprite)._scale.y; - if (0.0 < alphaMult) { - (this->_sprite)._color._tint[3] = local_68 * alphaMult; - if (this->_championColorIdx == 0x15) { - room = game->_room; - if (*room == '\0') { - iVar6 = -1; - } - else { - iVar6 = game->_frameCount - *GHIDRA_CAST((room + 0x11f0)); - } - fVar9 = sin((float)iVar6 * 0.2); - if (fVar9 <= 0.0) { - fVar9 = 0.0; - } - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - fVar9 = fVar9 * 0.15 + 1.0; - (this->_sprite)._scale.x = (float)local_9c * fVar9; - (this->_sprite)._scale.y = local_7c * fVar9; - laterAnimState = extraout_ECX_04; - } - iVar6 = this->_type; - if ((iVar6 == 0x111) && (this->_state == 9)) { - if (this->_exists == 0) { - ExceptionList = savedExceptionList; - return; - } - if (this->_visible == 0) { - ExceptionList = savedExceptionList; - return; - } - local_a0 = (this->_velocity).x * 5.0 * -0.14285715; - local_70 = (this->_velocity).y * 5.0 * -0.14285715; - fVar9 = (this->_pos).y; - fVar10 = (this->_pos).x; - trailX = fVar10; - local_98 = fVar9; - (GHIDRA_CAST((&local_48)))->Color::operator_assign(&(this->_sprite)._color); - local_a8 = 8.40779e-45; - spriteColor = &(this->_sprite)._color; - do { - screenScale = g_displayPixelRatio * g_screenPointScale; - local_90 = (Entity_Player *) - (((fVar9 + (this->_posOffset).y) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5 - ); - local_88 = (((fVar10 + (this->_posOffset).x) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) - * screenScale + 0.5; - dVar11 = floor((double)local_88); - local_88 = (float)dVar11 / screenScale; - local_90 = GHIDRA_CAST(((float)local_90 * screenScale + 0.5)); - dVar11 = floor((double)(float)local_90); - local_90 = GHIDRA_CAST((float)dVar11); - trailColor._offset[0] = 0.0; - trailColor._offset[1] = 0.0; - trailColor._offset[2] = 0.0; - local_84.x = baseOffset.x + local_88; - fVar9 = ((float)GHIDRA_INT(local_a8) * 0.9) / 7.0 + 0.1; - local_84.y = baseOffset.y + (float)local_90 / screenScale; - trailColor._tint[2] = fVar9 * local_48._tint[2]; - trailColor._tint[3] = fVar9 * local_48._tint[3] * 0.5; - trailColor._tint[0] = fVar9 * local_48._tint[0]; - trailColor._tint[1] = fVar9 * local_48._tint[1]; - if (spriteColor != &trailColor) { - (this->_sprite)._color._colorize[0] = 0.0; - (this->_sprite)._color._colorize[1] = 0.0; - (this->_sprite)._color._colorize[2] = 0.0; - (this->_sprite)._color._colorize[3] = 0.0; - spriteColor->_tint[0] = trailColor._tint[0]; - (this->_sprite)._color._tint[1] = trailColor._tint[1]; - (this->_sprite)._color._tint[2] = trailColor._tint[2]; - (this->_sprite)._color._tint[3] = trailColor._tint[3]; - (this->_sprite)._color._offset[0] = 0.0; - (this->_sprite)._color._offset[1] = 0.0; - (this->_sprite)._color._offset[2] = 0.0; - } - if ((this->_sprite)._loaded != 0) { - if ((this->_sprite)._overlayRenderFirst == 0) { - AnimationState::Render - (&(this->_sprite)._animState,&local_84,&g_vectorZero,&g_vectorZero); - laterAnimState = &(this->_sprite)._overlayAnimState; - } - else { - AnimationState::Render - (&(this->_sprite)._overlayAnimState,&local_84,&g_vectorZero,&g_vectorZero); - laterAnimState = &(this->_sprite)._animState; - } - AnimationState::Render(laterAnimState,&local_84,&g_vectorZero,&g_vectorZero); - } - local_a8 = (float)(GHIDRA_INT(local_a8) + -1); - fVar10 = local_a0 + trailX; - fVar9 = local_70 + local_98; - trailX = fVar10; - local_98 = fVar9; - } while (-1 < GHIDRA_INT(local_a8)); - local_ec._tint[3] = local_48._tint[3] * 0.2; - local_ec._colorize[0] = 0.0; - local_ec._colorize[1] = 0.0; - local_ec._colorize[2] = 0.0; - local_ec._colorize[3] = 0.0; - local_ec._offset[0] = 0.0; - local_ec._tint[0] = local_48._tint[0]; - local_ec._offset[1] = 0.0; - local_ec._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(&local_ec); - local_a0 = (this->_pos).y + (this->_posOffset).y; - local_90 = GHIDRA_CAST(((g_screenHeight - 182.0) * 0.5)); - local_98 = g_displayPixelRatio * g_screenPointScale; - local_70 = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_98 + 0.5; - dVar11 = floor((double)local_70); - local_88 = (float)dVar11; - local_70 = ((local_a0 - 140.0) * 0.65 + (float)local_90) * local_98 + 0.5; - dVar11 = floor((double)local_70); - local_70 = (float)dVar11; - local_84.x = baseOffset.x + local_88 / local_98; - local_84.y = baseOffset.y + local_70 / local_98; - ANM2::Render(&this->_sprite,&local_84,&g_vectorZero,&g_vectorZero); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&local_48)); - iVar6 = this->_type; - laterAnimState = extraout_ECX_05; - } - if ((((iVar6 == 0x13) && (this->_variant == 3)) && - (laterAnimState = GHIDRA_CAST(this->_child), GHIDRA_CAST(laterAnimState) != GHIDRA_CAST(0x0))) && - (fVar9 = (this->_pos).y, - *GHIDRA_CAST((laterAnimState + 0x340)) <= fVar9 && fVar9 != *GHIDRA_CAST((laterAnimState + 0x340)))) { - RenderSegmentLink(this,&baseOffset,0); - iVar6 = this->_type; - laterAnimState = extraout_ECX_06; - } - if ((iVar6 == 0x3b6) && (this->_variant == 0)) { - render_overlay(this,&baseOffset,0); - iVar6 = this->_type; - laterAnimState = extraout_ECX_07; - } - if (iVar6 == 0x37d) { - if (((this->_targetPosition).x != g_vectorZero.x) || - ((this->_targetPosition).y != g_vectorZero.y)) { - fVar9 = (this->_pos).y; - iVar6 = 0x37d; - pfVar5 = &(this->_targetPosition).y; - if (*pfVar5 <= fVar9 && fVar9 != *pfVar5) { - NpcHelper::ball_and_chain_render_chain(&baseOffset,laterAnimState); - iVar6 = this->_type; - } - goto LAB_006d3907; - } -LAB_006d3c6e: -LAB_006d3c74: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(&baseOffset); - uVar8 = extraout_ECX_17; - } - else { -LAB_006d3907: - if (((iVar6 == 0xf5) && (this->_entityRef != 0)) && (this->_visible != 0)) { - *GHIDRA_CAST((this->_entityRef + 0x171)) = 1; - node = GHIDRA_CAST(this->_entityRef); - refOffsetX = baseOffset.x + - ((((this->_posOffset).x + (this->_pos).x) - (float)node[0xcf]) - - (float)node[0xd3]) * 0.65; - local_a0 = baseOffset.y + - ((((this->_pos).y + (this->_posOffset).y) - (float)node[0xd0]) - - (float)node[0xd4]) * 0.65; - (**(code **)(*node + 0x14))(); - *GHIDRA_CAST((this->_entityRef + 0x171)) = 0; - iVar6 = this->_type; - } - switch(iVar6) { - case 0x343: - FUN_005579b0(); - uVar8 = extraout_ECX_14; - break; - default: - goto LAB_006d3c6e; - case 0x361: - FUN_004e07a0(); - uVar8 = extraout_ECX_13; - break; - case 0x38a: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Pickup::Render(&baseOffset); - uVar8 = extraout_ECX_08; - break; - case 0x38d: - if (this->_variant == 10) { - FUN_00589de0(); - uVar8 = extraout_ECX_09; - break; - } - goto LAB_006d3c74; - case 0x390: - NpcHelper::mother_render(this,&baseOffset); - uVar8 = extraout_ECX_10; - break; - case 0x398: - NpcHelper::horny_boys_render(this,&baseOffset); - uVar8 = extraout_ECX_11; - break; - case 0x399: - NpcHelper::clutch_render(this,&baseOffset); - uVar8 = extraout_ECX_12; - break; - case 0x3b7: - FUN_00598260(); - uVar8 = extraout_ECX_15; - break; - case 0x3c5: - if (this->_variant != 10) goto LAB_006d3c6e; - local_84.x = 0.0; - local_84.y = 0.0; - local_84.x = (float)operator_new(0x18); - *GHIDRA_CAST(local_84.x) = local_84.x; - *GHIDRA_CAST((GHIDRA_CAST(local_84.x) + 4)) = local_84.x; - *GHIDRA_CAST((GHIDRA_CAST(local_84.x) + 8)) = local_84.x; - *GHIDRA_CAST((GHIDRA_CAST(local_84.x) + 0xc)) = 0x101; - ehState = 0; - uVar4 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - player = Game::GetPlayer(g_game,uVar4); - if (GHIDRA_CAST(player->_minecart) == this) { - fStack_94 = (player->_minecartOffset).y; - local_90 = player; - FUN_006dac00(&local_70,&fStack_94); - } - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - node = *GHIDRA_CAST(local_84.x); - if (node != GHIDRA_CAST(local_84.x)) { - do { - piVar1 = GHIDRA_CAST(node[5]); - fVar9 = (local_18->_pos).x; - local_70 = (float)piVar1[0xcf]; - local_a0 = (float)piVar1[0xd0]; - piVar1[0xd0] = GHIDRA_INT(((float)piVar1[0x823] + (local_18->_pos).y)); - piVar1[0xcf] = GHIDRA_INT(((float)piVar1[0x822] + fVar9)); - *GHIDRA_CAST((GHIDRA_CAST(piVar1) + 0x171)) = 1; - fStack_94 = baseOffset.x + (float)piVar1[0x822] * 0.65; - local_90 = GHIDRA_CAST((baseOffset.y + (float)piVar1[0x823] * 0.65)); - (**(code **)(*piVar1 + 0x14))(); - piVar1[0xcf] = GHIDRA_INT(local_70); - *GHIDRA_CAST((GHIDRA_CAST(piVar1) + 0x171)) = 0; - piVar1[0xd0] = GHIDRA_INT(local_a0); - piVar1 = GHIDRA_CAST(node[2]); - if (*GHIDRA_CAST((GHIDRA_CAST(piVar1) + 0xd)) == '\0') { - isNil = *GHIDRA_CAST((*piVar1 + 0xd)); - node = piVar1; - piVar1 = GHIDRA_CAST(*piVar1); - while (isNil == '\0') { - isNil = *GHIDRA_CAST((*piVar1 + 0xd)); - node = piVar1; - piVar1 = GHIDRA_CAST(*piVar1); - } - } - else { - isNil = *GHIDRA_CAST((node[1] + 0xd)); - piVar2 = GHIDRA_CAST(node[1]); - piVar1 = node; - while ((node = piVar2, isNil == '\0' && (piVar1 == GHIDRA_CAST(node[2])))) { - isNil = *GHIDRA_CAST((node[1] + 0xd)); - piVar2 = GHIDRA_CAST(node[1]); - piVar1 = node; - } - } - } while (node != GHIDRA_CAST(local_84.x)); - this = local_18; - } - ehState = 0xffffffff; - FID_conflict__Erase_tree_>_> - (&local_84,(fuzzer_allocator_> *)&local_84, - *(_Tree_node **)(GHIDRA_INT(local_84.x) + 4)); - operator_delete((void *)local_84.x,0x18); - uVar8 = extraout_ECX_16; - } - } - iVar6 = this->_type; - if (iVar6 == 0x376) { - render_overlay(this,&baseOffset,0); - iVar6 = this->_type; - uVar8 = extraout_ECX_18; - } - if (iVar6 == 0x37d) { - if (((this->_targetPosition).x == g_vectorZero.x) && - ((this->_targetPosition).y == g_vectorZero.y)) goto LAB_006d3d39; - iVar6 = 0x37d; - if ((this->_pos).y <= (this->_targetPosition).y) { - NpcHelper::ball_and_chain_render_chain(&baseOffset,uVar8); - iVar6 = this->_type; - } - } - if (iVar6 == 0x13) { - if (((this->_variant != 3) || (this->_child == 0)) || - (*GHIDRA_CAST((this->_child + 0x340)) < (this->_pos).y)) goto LAB_006d3d39; - RenderSegmentLink(this,&baseOffset,0); - iVar6 = this->_type; - } - if (iVar6 == 0x38e) { - NpcHelper::chimera_render_child(this,&baseOffset); - } - } -LAB_006d3d39: - if ((this->_visible == 0) || (alphaMult <= 0.0)) { - local_a0 = (this->_posOffset).y + (this->_pos).y; - local_90 = GHIDRA_CAST(((g_screenHeight - 182.0) * 0.5)); - local_18 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_70 = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_18 + 0.5; - dVar11 = floor((double)local_70); - local_88 = (float)dVar11; - local_70 = ((local_a0 - 140.0) * 0.65 + (float)local_90) * (float)local_18 + 0.5; - dVar11 = floor((double)local_70); - local_70 = (float)dVar11; - (this->_renderPosition).x = baseOffset.x + local_88 / (float)local_18; - (this->_renderPosition).y = baseOffset.y + local_70 / (float)local_18; - } - if (((this->_type == 0x19b) || (this->_type == 0x330)) && - ((this->_entityRef != 0 && - ((((this->_sprite)._animState._animData != (void *)0x0 && - (pfVar5 = AnimationState::GetNullFrame(&(this->_sprite)._animState,&DAT_00b67800), - pfVar5 != GHIDRA_CAST(0x0))) && (*GHIDRA_CAST((pfVar5 + 3)) != '\0')))))) { - iVar6 = this->_entityRef; - fVar9 = 0.0; - local_70 = *GHIDRA_CAST((iVar6 + 0xdc)); - local_90 = *GHIDRA_CAST((iVar6 + 0xe4)); - local_88 = *GHIDRA_CAST((iVar6 + 0xe8)); - local_a0 = *GHIDRA_CAST((iVar6 + 0xe0)); - if (*GHIDRA_CAST((iVar6 + 0x28)) == 5) { - fVar9 = 6.5; - } - fVar10 = *pfVar5; - *GHIDRA_CAST((iVar6 + 0xe0)) = fVar9 + pfVar5[1]; - *GHIDRA_CAST((iVar6 + 0xdc)) = fVar10 + 0.0; - iVar6 = this->_entityRef; - fVar9 = pfVar5[5]; - *GHIDRA_CAST((iVar6 + 0xe4)) = (float)local_90 * pfVar5[4]; - *GHIDRA_CAST((iVar6 + 0xe8)) = local_88 * fVar9; - ANM2::Render(GHIDRA_CAST((this->_entityRef + 0x48)),&this->_renderPosition,&g_vectorZero, - &g_vectorZero); - iVar6 = this->_entityRef; - *GHIDRA_CAST((iVar6 + 0xdc)) = local_70; - *GHIDRA_CAST((iVar6 + 0xe0)) = local_a0; - iVar6 = this->_entityRef; - *GHIDRA_CAST((iVar6 + 0xe4)) = local_90; - *GHIDRA_CAST((iVar6 + 0xe8)) = local_88; - } - if (0.0 < alphaMult) { - if (this->_championColorIdx == 0x15) { - (this->_sprite)._scale.x = (float)local_9c; - (this->_sprite)._scale.y = local_7c; - } - (this->_sprite)._color._tint[3] = local_68; - } - FUN_00860ba0(this,&baseOffset); - if (((renderMode != 1) && (renderMode != 3)) || (isHidden != '\0')) goto LAB_006d44a0; - if (this->_type == 0x3c4) { - sprintf(GHIDRA_CAST((local_48._tint + 3)),&DAT_00b67750); - local_ec._colorize[0] = 1.4013e-45; - local_ec._colorize[1] = 9.18341e-41; - local_ec._colorize[2] = 0.0; - local_ec._colorize[3] = 1.0; - local_ec._offset[0] = -NAN; - local_ec._offset[1] = 0.0; - local_ec._offset[2] = 0.0; - ehState = 1; - local_5c._unk = 0; - local_5c._red = 1.0; - local_5c._green = 1.0; - local_5c._blue = 1.0; - local_5c._alpha = 1.0; - Font::DrawString(&g_manager->_font6_PFTempestaSevenCondensed,GHIDRA_CAST((local_48._tint + 3)), - &local_5c,local_ec._colorize,(this->_renderPosition).x, - (this->_renderPosition).y - 28.0); - ehState = 0xffffffff; - } - if ((((this->_statusEffectSprite)._loaded != 0) && - ((this->_statusEffectSprite)._animState._animData != (void *)0x0)) && - ((this->_statusEffectSprite)._animState._isPlaying != 0)) { - local_68 = (float)(GHIDRA_UINT((this->_statusEffectSprite)._bitflags) >> 0x1f); - iVar6 = AnimationData::find_null_index(GHIDRA_CAST(&this->_sprite),GHIDRA_CAST("OverlayEffect")); - if (iVar6 < 0) { - if (this->_config == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] No OverlayEffect Null found for Entity (%d)\n")); - } - else { - EntityConfig_Entity::GetName(this->_config,GHIDRA_CAST(&configName),0x14); - ehState = 2; - KAGE_LogMessage(1,(uint8_t *) - "[warn] No OverlayEffect Null found for Entity %s with sprite %s\n"); - ehState = 0xffffffff; - if (0xf < GHIDRA_UINT(local_5c._unk)) { - uVar4 = local_5c._unk + 1; - pvVar7 = configName; - if (0xfff < uVar4) { - pvVar7 = *(void **)(GHIDRA_CAST(configName) + -4); - uVar4 = local_5c._unk + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(configName) + (-4 - GHIDRA_INT(pvVar7))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar7,uVar4); - } - local_5c._alpha = 0.0; - local_5c._unk = 0xf; - configName = (void *)(GHIDRA_UINT(configName) & 0xffffff00); - } - } - else { - local_9c = ANM2::GetLayerFrame(&this->_sprite,iVar6); - if (((local_9c != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((local_9c + 3)) != '\0')) && - (((*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x0))) == '\0' || - ((this->_parent == 0 || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::is_same_segmented_body(GHIDRA_CAST(0x0)), bVar3 == 0)))))) { - (this->_statusEffectSprite)._scale.x = local_9c[4]; - (this->_statusEffectSprite)._scale.y = local_9c[5]; - local_7c = g_displayPixelRatio * g_screenPointScale; - local_70 = (((this->_pos).y + (this->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_68 = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_7c + 0.5; - dVar11 = floor((double)local_68); - local_a0 = (float)dVar11 / local_7c; - local_68 = local_70 * local_7c + 0.5; - dVar11 = floor((double)local_68); - local_68 = (float)dVar11; - local_84.x = baseOffset.x + local_a0 + *local_9c; - local_84.y = baseOffset.y + local_68 / local_7c + local_9c[1]; - ANM2::Render(&this->_statusEffectSprite,&local_84,&g_vectorZero,&g_vectorZero); - } - } - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x193,GHIDRA_CAST(&g_game->_playerManager),1); - if (((((((player == GHIDRA_CAST(0x0)) || (this->_visible == 0)) || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsActiveEnemy(0), bVar3 == 0)) || - ((bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x10), bVar3 != 0 || - ((this->_sprite)._color._tint[3] <= 0.0)))) || - (g_game->_frameCount - this->_spawnFrame < 2)) || - ((this->_health <= 0.0 || - (statusTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::GetStatusEffectTarget(), - statusTarget != this)))) || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x800000000), bVar3 != 0)) { - if (this->_controllerID == 0xffffffff) goto LAB_006d44a0; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - bVar3 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerID); - goto LAB_006d445e; - } - } - else { - pvVar7 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetNullFrame(GHIDRA_CAST("OverlayEffect")); - if (pvVar7 == (void *)0x0) goto LAB_006d44a0; - bVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0xc)); -LAB_006d445e: - if (bVar3 == 0) goto LAB_006d44a0; - } - local_84.x = (this->_renderPosition).x + 0.0; - local_84.y = (this->_renderPosition).y + 10.0; - render_debug(&local_84,this); -LAB_006d44a0: - if (((minecart != GHIDRA_CAST(0x0)) && (this->_visible != 0)) && - ((GHIDRA_CAST((GHIDRA_CAST(&minecart->_sprite))))->Sprite::RenderLayer(1,&renderPos,&g_vectorZero,&g_vectorZero), - this->_type == 0x38a)) { - NpcHelper::hornfel_render_minecart(this,GHIDRA_CAST((this->_minecart + 0x48)),&renderPos); - } - if ((((this->_controllerID != 0xffffffff) && - ((g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1)) || - (bVar3 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerID), - bVar3 != 0)))) && ((this->_chargeBarSprite)._loaded != 0)) && - (0.0 < (this->_chargeBarSprite)._color._tint[3])) { - fVar9 = (this->_sprite)._scale.y; - renderPos.y = (this->_renderPosition).y - fVar9 * 35.0; - renderPos.x = fVar9 * 12.0 + (this->_renderPosition).x; - ANM2::Render(&this->_chargeBarSprite,&renderPos,&g_vectorZero,&g_vectorZero); - } - if (((this->_flags & 0x1000002000000000) != 0) && ((GHIDRA_UINT(g_game->_debugFlags) >> 6 & 1) != 0)) { - sprintf(debugText,GHIDRA_CAST("%.02f")); - manager = g_manager; - local_ec._colorize[0] = 5.60519e-45; - local_ec._colorize[1] = 9.18341e-41; - local_ec._colorize[2] = 0.0; - local_ec._colorize[3] = 1.0; - local_ec._offset[0] = -NAN; - local_ec._offset[1] = 0.0; - local_ec._offset[2] = 0.0; - ehState = 3; - local_7c = g_displayPixelRatio * g_screenPointScale; - local_5c._unk = 0; - local_5c._red = 1.0; - local_5c._green = 0.0; - local_5c._blue = 1.0; - local_5c._alpha = 0.5; - local_68 = ((g_screenWidth - 338.0) * 0.5 + ((this->_pos).x - 60.0) * 0.65) * local_7c + 0.5; - dVar11 = floor((double)local_68); - local_70 = (float)dVar11 / local_7c; - local_68 = (((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * local_7c + 0.5; - dVar11 = floor((double)local_68); - local_68 = (float)dVar11; - renderPos.x = local_70 + renderOffset->x; - renderPos.y = local_68 / local_7c + renderOffset->y; - Font::DrawStringScaled - (&manager->_font2_TeamMeatEx12,debugText,&renderPos,&local_5c,local_ec._colorize); - } - ExceptionList = savedExceptionList; - return; -} - -// 006d4840 -uint8_t Entity_NPC::RenderShadowLayer(Vector *offset) -{ - uint8_t bVar1; - - if (this->_type == 0x376) { - render_overlay(this,offset,1); - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::RenderShadowLayer(offset); - return bVar1; - } - if ((this->_type == 0x13) && (this->_variant == 3)) { - RenderSegmentLink(this,offset,1); - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::RenderShadowLayer(offset); - return bVar1; -} - -// 006d4a00 -uint8_t Entity_NPC::CanBeDamagedFromVelocity(Vector velocity) -{ - uint32_t uVar1; - int iVar2; - int cmpResult; - uint32_t uVar3; - uint8_t *cmpName; - bool bVar4; - std_string *psVar5; - Vector facingDir; - uint8_t isDamageable; - std_string animName; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - void *animData; - uint32_t animNameBuf; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af32ed; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(&animName) + 0x28U; - iVar2 = this->_type; - if (iVar2 != 0x29) { - if (iVar2 == 0x61) { - ExceptionList = &local_10; - iVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); - goto LAB_006d4d66; - } - if ((iVar2 != 0xfe) && (iVar2 != 0x11b)) { - if (iVar2 == 0x387) { - if (this->_variant != 1) { - return 1; - } - if ((velocity.x == g_vectorZero.x) && (velocity.y == g_vectorZero.y)) { - return 1; - } - ExceptionList = &local_10; - iVar2 = vector_to_direction(&velocity); - if (iVar2 == this->_i1) { - ExceptionList = local_10; - return 1; - } - ExceptionList = local_10; - return 0; - } - if (iVar2 != 0x17) { - return 1; - } - if (this->_variant != 3) { - return 1; - } - ExceptionList = &local_10; - ANM2::GetAnimation(GHIDRA_CAST(&(this->_sprite)._animState),&animName); - local_8 = 0; - iVar2 = FUN_006da7d0(animName._size - 2,2,&DAT_00b1cde4); - if (iVar2 == 0) { - iVar2 = 1; - } - else { - iVar2 = FUN_006da7d0(animName._size - 4,4,&DAT_00b1cddc); - if (iVar2 == 0) { - iVar2 = 3; - } - else { - iVar2 = 2; - if ((this->_sprite)._flipX != 0) { - iVar2 = 0; - } - } - } - Isaac::GetAxisAlignedUnitVectorFromDir(&facingDir,iVar2); - animNameBuf = (*GHIDRA_CAST((GHIDRA_CAST(&(animName._buf)) + 0x0))); - uVar3 = 6; - if (animName._size < 6) { - uVar3 = animName._size; - } - psVar5 = &animName; - if (0xf < animName._capacity) { - psVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(animName._buf))) + 0x0))); - } - cmpResult = string_compare(GHIDRA_CAST(psVar5),uVar3,GHIDRA_CAST("Attack"),6); - if (cmpResult == 0) { - facingDir.x = 0.70710677; - psVar5 = GHIDRA_CAST(0x3f3504f3); - if (iVar2 == 1) { - psVar5 = GHIDRA_CAST(0xbf3504f3); - } - if ((this->_sprite)._flipX != 0) { - facingDir.x = -0.70710677; - } - } - else { - psVar5 = GHIDRA_CAST(facingDir.y); - } - isDamageable = 0.0 <= (float)psVar5 * velocity.y + facingDir.x * velocity.x; - if (0xf < animName._capacity) { - uVar3 = animName._capacity + 1; - psVar5 = GHIDRA_CAST(animNameBuf); - if (0xfff < uVar3) { - psVar5 = GHIDRA_CAST((GHIDRA_CAST((animNameBuf + -0x18)))->_capacity); - uVar3 = animName._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((animNameBuf + (-4 - GHIDRA_INT(psVar5))))) goto LAB_006d4d56; - } - operator_delete(psVar5,uVar3); - } - ExceptionList = local_10; - return isDamageable; - } - } - animData = (this->_sprite)._animState._animData; - if (animData == (void *)0x0) { - animName._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(animName._buf)) + 0x0))) = GHIDRA_CAST(0x0); - animName._size = 0; - ExceptionList = &local_10; - } - else { - ExceptionList = &local_10; - (GHIDRA_CAST((animName._buf)))->msvc::string::string(animData); - } - psVar5 = &animName; - if (0xf < animName._capacity) { - psVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(animName._buf))) + 0x0))); - } - cmpName = GHIDRA_CAST(&DAT_00b1cde4); - uVar3 = animName._size; - if (2 < animName._size) { - uVar3 = 2; - } - while (uVar1 = uVar3 - 4, 3 < uVar3) { - if (*GHIDRA_CAST(psVar5->_buf) != *GHIDRA_CAST(cmpName)) goto LAB_006d4c56; - psVar5 = GHIDRA_CAST((psVar5->_buf + 4)); - cmpName = cmpName + 4; - uVar3 = uVar1; - } - if (uVar1 == 0xfffffffc) { -LAB_006d4c8a: - uVar3 = 0; - } - else { -LAB_006d4c56: - bVar4 = (uint8_t)psVar5->_buf[0] < *cmpName; - if ((psVar5->_buf[0] == *cmpName) && - ((uVar1 == 0xfffffffd || - ((bVar4 = (uint8_t)psVar5->_buf[1] < cmpName[1], psVar5->_buf[1] == cmpName[1] && - ((uVar1 == 0xfffffffe || - ((bVar4 = (uint8_t)psVar5->_buf[2] < cmpName[2], psVar5->_buf[2] == cmpName[2] && - ((uVar1 == 0xffffffff || - (bVar4 = (uint8_t)psVar5->_buf[3] < cmpName[3], psVar5->_buf[3] == cmpName[3])))))))))))) - goto LAB_006d4c8a; - uVar3 = -GHIDRA_UINT(bVar4) | 1; - } - if (((uVar3 == 0) && (1 < animName._size)) && (animName._size < 3)) { - iVar2 = 1; - } - else { - psVar5 = &animName; - if (0xf < animName._capacity) { - psVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(animName._buf))) + 0x0))); - } - cmpName = &DAT_00b60d94; - uVar3 = animName._size; - if (4 < animName._size) { - uVar3 = 4; - } - while (uVar1 = uVar3 - 4, 3 < uVar3) { - if (*GHIDRA_CAST(psVar5->_buf) != *GHIDRA_CAST(cmpName)) goto LAB_006d4cd6; - psVar5 = GHIDRA_CAST((psVar5->_buf + 4)); - cmpName = cmpName + 4; - uVar3 = uVar1; - } - if (uVar1 == 0xfffffffc) { -LAB_006d4d0a: - uVar3 = 0; - } - else { -LAB_006d4cd6: - bVar4 = (uint8_t)psVar5->_buf[0] < *cmpName; - if ((psVar5->_buf[0] == *cmpName) && - ((uVar1 == 0xfffffffd || - ((bVar4 = (uint8_t)psVar5->_buf[1] < cmpName[1], psVar5->_buf[1] == cmpName[1] && - ((uVar1 == 0xfffffffe || - ((bVar4 = (uint8_t)psVar5->_buf[2] < cmpName[2], psVar5->_buf[2] == cmpName[2] && - ((uVar1 == 0xffffffff || - (bVar4 = (uint8_t)psVar5->_buf[3] < cmpName[3], psVar5->_buf[3] == cmpName[3])))))))))))) - goto LAB_006d4d0a; - uVar3 = -GHIDRA_UINT(bVar4) | 1; - } - if (((uVar3 == 0) && (3 < animName._size)) && (animName._size < 5)) { - iVar2 = 0; - if ((this->_sprite)._flipX == 0) { - iVar2 = 2; - } - } - else { - iVar2 = 3; - } - } - if (0xf < animName._capacity) { - uVar3 = animName._capacity + 1; - psVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(animName._buf))) + 0x0))); - facingDir.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)animName._buf)) + 0x0))); - if (0xfff < uVar3) { - psVar5 = GHIDRA_CAST((GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(animName._buf)) + 0x0))) + -0x18)))->_capacity); - uVar3 = animName._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(animName._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar5))))) { -LAB_006d4d56: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(psVar5,uVar3); - } -LAB_006d4d66: - if ((((0.0 <= velocity.x) || (iVar2 != 2)) && - (((velocity.x <= 0.0 || (iVar2 != 0)) && ((velocity.y <= 0.0 || (iVar2 != 1)))))) && - ((0.0 <= velocity.y || (iVar2 != 3)))) { - ExceptionList = local_10; - return 1; - } - ExceptionList = local_10; - return 0; -} - -// 006d4db0 -uint8_t Entity_NPC::CanReroll() -{ - char cVar1; - - if (((*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0xd8)) & 0x10) == 0) && - (((this->_type != 0x104 || (this->_variant != 10)) || (this->_parent == 0)))) { - cVar1 = this->IsBoss(); - if ((cVar1 == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x2c)) == '\0')) { - return 1; - } - } - return 0; -} - -// 006d4e00 -void Entity_NPC::PlayDeathEffects() -{ - int iVar1; - void *layerFrame; - int *bloodEffect; - uint32_t seed; - Entity *effect; - uint32_t uVar2; - float fVar3; - Vector splatOffset; - Vector local_10; - Manager *manager; - - iVar1 = PlayerManager::GetGFuelCount(); - if (0 < iVar1) { - spawn_gfuel_explosion(); - return; - } - splatOffset.x = g_vectorZero.x; - splatOffset.y = g_vectorZero.y; - if (((this->_sprite)._animState._animData != (void *)0x0) && - (((this->_type != 0x38d || (this->_variant != 10)) && - (layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0), - layerFrame != (void *)0x0)))) { - splatOffset.x = - (*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 8)) * 0.5 - *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x20))) + - *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x10)); - splatOffset.y = - (*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0xc)) * 0.5 - *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x24))) + - *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x14)); - } - manager = g_manager; - if ((this->_flags & 0x10000) != 0) { - return; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x60)) >> 5 & 1) != 0) { - local_10.x = 3.32108e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_10)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10.x),0.9,2,0,1.0,0.0); - uVar2 = 0x2b; - goto LAB_006d51b2; - } - iVar1 = this->_type; - if (iVar1 < 0x11a) { - if (iVar1 != 0x119) { - switch(iVar1) { - case 0xd: - case 0xe: - case 0x12: - case 0xd6: - case 0xde: - case 0xf9: - case 0x100: - break; - default: - goto LAB_006d4f7c; - case 0x55: - case 0x5e: - case 0xd7: - case 0xfa: -code_r0x006d519f: - uVar2 = 0x26; - goto LAB_006d51b2; - } - } -LAB_006d51a6: - uVar2 = 3; - } - else { - if (0x346 < iVar1) { - switch(iVar1) { - case 0x355: - uVar2 = 0x83; - goto LAB_006d51b2; - default: - goto LAB_006d4f7c; - case 0x364: - goto LAB_006d51a6; - case 0x365: - case 0x374: - goto code_r0x006d519f; - } - } - if (iVar1 == 0x346) goto LAB_006d51a6; - if (iVar1 < 0x32b) { - if (iVar1 != 0x32a) { - if ((iVar1 != 0x128) && (iVar1 != 0x328)) goto LAB_006d4f7c; - goto LAB_006d51a6; - } - uVar2 = 0x82; - } - else { - if (iVar1 != 0x332) { -LAB_006d4f7c: - fVar3 = this->_size; - uVar2 = 2; - if (fVar3 < 13.0) { - uVar2 = 1; - } - if ((18.0 <= fVar3) || (30.0 < this->_shadowSize)) { - uVar2 = 3; - } - if ((40.0 <= fVar3) || (50.0 < this->_shadowSize)) { - uVar2 = 4; - } - seed = Random(); - effect = Game::SpawnEx(g_game,1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),uVar2,seed,0); - bloodEffect = GHIDRA_CAST(__RTDynamicCast(effect,0,&IsaacRepentancePlus::Entity:: - RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect:: - RTTI_Type_Descriptor,0)); - bloodEffect[0x37] = GHIDRA_INT(splatOffset.x); - bloodEffect[0x38] = GHIDRA_INT(splatOffset.y); - (**(code **)(*bloodEffect + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); - bloodEffect[0xd6] = 0x41200000; - goto LAB_006d505b; - } - uVar2 = 0x91; - } - } -LAB_006d51b2: - seed = Random(); - local_10.x = splatOffset.x + (this->_pos).x; - local_10.y = splatOffset.y + (this->_pos).y; - effect = Game::SpawnEx(g_game,1000,uVar2,&local_10,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - effect->SetColor(&this->_splatColor,0xffffffff,0xff,0,1); -LAB_006d505b: - if (this->_type == 0x372) { - uVar2 = Random(); - effect = Game::SpawnEx(g_game,1000,0x12,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar2,0); - iVar1 = *GHIDRA_CAST(effect); - (effect->_sprite)._color._colorize[0] = 5.0; - (effect->_sprite)._color._colorize[1] = 5.0; - (effect->_sprite)._color._colorize[2] = 5.0; - (effect->_sprite)._color._colorize[3] = 1.0; - (**(code **)(iVar1 + 0xc))(); - uVar2 = Random(); - effect = Game::SpawnEx(g_game,1000,0x10,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),1,uVar2,0); - fVar3 = g_vectorOne.y * 0.6; - (effect->_sprite)._scale.x = g_vectorOne.x * 0.6; - (effect->_sprite)._scale.y = fVar3; - uVar2 = Random(); - (effect->_sprite)._flipX = ~(uint8_t)uVar2 & 1; - effect->Update(); - PlaySound(this,0xcf,1.0,2,0,1.0); - PlaySound(this,0x50,0.8,2,0,1.0); - } - return; -} - -// 006d5400 -void Entity_NPC::trigger_kill_item_effects() -{ - Vector *pos; - code *pcVar1; - ColorMod color; - uint8_t bVar2; - uint32_t uVar3; - Entity_Player *itemOwner; - Entity_Laser *mawOfVoid; - EntityConfig_Entity *entityConfig; - ColorMod *color_00; - int *playerIt; - uint8_t unused; - uint8_t unused_00; - int iVar4; - ActiveItemDesc *activeSlot; - void *pvVar5; - uint64_t *allocCounter; - int iVar6; - PlayerManager *playerManager; - float damage; - Color aCStackY_1960 [128]; - uint32_t in_stack_fffffcdc; - uint32_t in_stack_fffffce0; - Vector *in_stack_fffffce4; - Vector *in_stack_fffffce8; - EntityRef baitSource; - EntityRef iceSource; - EntityRef magnetizeSource; - EntityRef burnSource; - EntityRef confusionSource; - EntityRef charmSource; - EntityRef fearSource; - EntityRef shrinkSource; - EntityRef freezeSource; - EntityRef midasSource; - EntityRef poisonSource; - EntityRef slowSource; - EntityRef brimstoneMarkSource; - Vector freeTilePos; - uint64_t local_e0; - uint32_t local_d8; - EntityRef damageSource; - uint8_t nearbyEnemies [12]; - float fStack_a0; - EntityList_EL contagionEnemies; - int local_8c [3]; - uint32_t local_80; - void **eraseKey; - float slowingAmount; - Entity_Player *local_74; - float local_70; - Color poofColor; - ColorMod fartColor; - uint32_t stackCookie; - void *prevExceptionList; - uint8_t *puStack_c; - float ehState; - int enemyIdx; - void **aimTargetSlot; - uint32_t flagsHigh; - Game *game; - Entity_NPC *nearbyEnemy; - uint64_t prevAllocBytes; - - ehState = -NAN; - puStack_c = &LAB_00afac5b; - prevExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((&fartColor)[1]._colorize); - ExceptionList = &prevExceptionList; - if (this->_isBoss == 0) { - if (this->_isChampion != 0) { - NpcHelper::ChampionDrop(this); - } - } - else { - (GHIDRA_CAST((g_game->_room)))->Room::TriggerBossDeath(GHIDRA_CAST(this)); - } - if ((this->_type == 0x38f) && (this->_variant == 1)) { - rotgut_death_spawn_effects(this); - } - if ((this->_flags & 0x400000) != 0) { - if ((this->_killDamageFlags & 4) == 0) { - uVar3 = Random(); - iVar6 = uVar3 % 3 + 1; - } - else { - uVar3 = Random(); - iVar6 = uVar3 % 5 + 2; - } - if (iVar6 != 0) { - do { - itemOwner = Game::GetNearestPlayer(g_game,&this->_pos); - itemOwner->_numBlueSpiders = itemOwner->_numBlueSpiders + 1; - spawn_blue_spider(&this->_pos,GHIDRA_CAST(itemOwner),&g_vectorZero); - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - } - } - local_70 = 0.0; - if ((this->_flags & 0x40000000000) == 0) { - if ((this->_flags & 0x800000) != 0) { - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar3; - (this->_dropRNG)._seed = uVar3; - if (uVar3 == (uVar3 / 5) * 5) { - uVar3 = Random(); - game = g_game; - in_stack_fffffce8 = (GHIDRA_CAST((g_game->_room)))->Room::FindFreeTilePosition(&freeTilePos,&this->_pos,0.0); - in_stack_fffffce4 = GHIDRA_CAST(0xa); - in_stack_fffffce0 = 5; - in_stack_fffffcdc = 0x6d55be; - Game::Spawn(game,5,10,in_stack_fffffce8,&g_vectorZero,GHIDRA_CAST(0x0),6,uVar3); - } - } - game = g_game; - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar3; - (this->_dropRNG)._seed = uVar3; - itemOwner = PlayerManager::RandomCollectibleOwner(&game->_playerManager,0x1b2,uVar3,GHIDRA_CAST(0x0)) - ; - if ((itemOwner != GHIDRA_CAST(0x0)) && - ((this->_flags & 0x10000020) != 0 || (this->_flags & 0x2000000000000) != 0)) { - iVar4 = itemOwner->_jarFlies + 1; - iVar6 = 0x14; - if (iVar4 < 0x14) { - iVar6 = iVar4; - } - itemOwner->_jarFlies = iVar6; - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - } - } - if (this->_type == 0x197) { - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) | 8; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - } - else { - this->Remove(); - } - itemOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1d2,GHIDRA_CAST(&g_game->_playerManager),0); - if ((itemOwner != GHIDRA_CAST(0x0)) && - (((this->_flags & 0x200000000) != 0 || (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x72a0)) == '\0')))) { - pos = &this->_pos; - fartColor._tint[0] = 1.0; - fartColor._tint[1] = 1.0; - fartColor._tint[2] = 1.0; - fartColor._tint[3] = 1.0; - in_stack_fffffce8 = GHIDRA_CAST(0x42aa0000); - fartColor._offset[0] = 0.0; - fartColor._colorize[0] = 0.0; - fartColor._colorize[1] = 0.0; - fartColor._colorize[2] = 0.0; - fartColor._colorize[3] = 0.0; - fartColor._offset[1] = 0.0; - fartColor._offset[2] = 0.0; - in_stack_fffffce0 = 0x6d573a; - in_stack_fffffce4 = pos; - Game::Fart(g_game,pos,85.0,GHIDRA_CAST(itemOwner),1.0,1,&fartColor); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&contagionEnemies,pos,85.0,8); - uVar3 = 0; - ehState = 0.0; - if (contagionEnemies._size != 0) { - do { - nearbyEnemy = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(contagionEnemies)) + 0x4))) + uVar3 * 4)); - if ((nearbyEnemy != this) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar2 != 0)) { - iVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(contagionEnemies)) + 0x4))) + uVar3 * 4)); - *GHIDRA_CAST((iVar6 + 0x16c)) = *GHIDRA_CAST((iVar6 + 0x16c)) | 2; - *GHIDRA_CAST((iVar6 + 0x168)) = *GHIDRA_CAST((iVar6 + 0x168)); - } - uVar3 = uVar3 + 1; - } while (uVar3 < GHIDRA_UINT(contagionEnemies._size)); - } - ehState = -NAN; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(contagionEnemies)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(contagionEnemies)) + 0x4))) != 0) { - uVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(contagionEnemies)) + 0x4))) + -4)); - prevAllocBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar3; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocBytes) < uVar3)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(contagionEnemies)) + 0x4))) + -4)); - } - ehState = -NAN; - } - } - local_74 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x198,GHIDRA_CAST(&g_game->_playerManager),0); - if (local_74 != GHIDRA_CAST(0x0)) { - uVar3 = this->_initSeed; - local_e0 = 0x70000000b; - local_d8 = 0xc; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = uVar3 >> 0xb ^ uVar3; - uVar3 = uVar3 << 7 ^ uVar3; - uVar3 = uVar3 >> 0xc ^ uVar3; - for (playerIt = (g_game->_playerManager)._playerList._begin; - playerIt != (g_game->_playerManager)._playerList._end; playerIt = playerIt + 1) { - iVar6 = *playerIt; - if ((*GHIDRA_CAST((iVar6 + 0x2c)) == 0) && (*GHIDRA_CAST((iVar6 + 0x20a9)) == '\0')) { - local_70 = local_70 + *GHIDRA_CAST((iVar6 + 0x156c)); - } - } - if ((float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283062e-10 - < local_70 * 0.025 + 0.25) { - mawOfVoid = (GHIDRA_CAST((local_74)))->Entity_Player::SpawnMawOfVoid(0x3c); - iVar6 = *GHIDRA_CAST(mawOfVoid); - (mawOfVoid->_pos).x = (this->_pos).x; - (mawOfVoid->_pos).y = (this->_pos).y; - mawOfVoid->_disableFollowParent = 1; - (**(code **)(iVar6 + 0xc))(); - } - } - if (((((this->_flags & 0x20000000) != 0) && (g_game->_challenge == 0x21)) && - (itemOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x17e,GHIDRA_CAST(&g_game->_playerManager),1), - itemOwner != GHIDRA_CAST(0x0))) && - (((this->_spawnerType == 1 || (this->_spawnerType == 3)) && - ((itemOwner = GHIDRA_CAST(this->_spawnerEntity), itemOwner != GHIDRA_CAST(0x0) && - (itemOwner->_type == 1)))))) { - uVar3 = 0; - activeSlot = itemOwner->_activeDesc; - do { - if (activeSlot->_item == 0x17e) { - if (-1 < GHIDRA_INT(uVar3)) { - (GHIDRA_CAST((itemOwner)))->Entity_Player::FullCharge(uVar3,0,0); - } - break; - } - uVar3 = uVar3 + 1; - activeSlot = activeSlot + 1; - } while (uVar3 < 4); - } - game = g_game; - if ((this->_flags & 0x800000000000000) != 0) { - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar3 = (this->_dropRNG)._seed; - if (uVar3 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar3; - (this->_dropRNG)._seed = uVar3; - itemOwner = PlayerManager::RandomCollectibleOwner(&game->_playerManager,0x248,uVar3,GHIDRA_CAST(0x0)) - ; - if (((itemOwner != GHIDRA_CAST(0x0)) && (itemOwner->_type == 1)) && - (entityConfig = EntityConfig::GetEntity - (&g_manager->_entityConfig,this->_type,this->_variant,0), - entityConfig != GHIDRA_CAST(0x0))) { - uVar3 = entityConfig->tags; - local_80 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((entityConfig)) + 0xdc)))); - if ((uVar3 & 0x80) == 0) { - if ((uVar3 & 0x40) == 0) { - if ((uVar3 & 0x100) == 0) { - iVar6 = 0x1000a; - } - else { - iVar6 = 0x1000d; - } - } - else { - iVar6 = 0x1000b; - } - } - else { - iVar6 = 0x1000c; - } - in_stack_fffffce8 = GHIDRA_CAST(0x6d5aab); - Entity_Player::AddWisp(itemOwner,iVar6,&this->_pos,0,0); - } - } - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x72a0)) = 1; - if (this->_type == 0x3c3) { - this->_type = this->_stateFrame; - Room::record_killed_npc(); - this->_type = 0x3c3; - } - else { - Room::record_killed_npc(); - } - if (this->_entityRef != 0) { - local_74 = GHIDRA_CAST(&this->_entityRef); - msvc::multiset::erase(); - } - this->_entityRef = 0; - aimTargetSlot = &this->_aimTargetEffect; - if (*aimTargetSlot != (void *)0x0) { - eraseKey = aimTargetSlot; - msvc::multiset::erase(); - } - *aimTargetSlot = (void *)0x0; - local_8c[2] = GHIDRA_INT(this->_flags); - if (((this->_flags & 0x100000000000000) != 0) && ((this->_flags & 0x80000000000000) != 0)) { - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(nearbyEnemies), - &this->_pos,120.0,8); - ehState = 2.8026e-45; - local_70 = 0.0; - if (fStack_a0 != 0.0) { - do { - enemyIdx = GHIDRA_INT(local_70); - nearbyEnemy = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + GHIDRA_INT(local_70) * 4)); - if ((nearbyEnemy != this) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar2 != 0)) { - ::(GHIDRA_CAST((&brimstoneMarkSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddBrimstoneMark(&brimstoneMarkSource,0x96); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x80); - if (bVar2 != 0) { - slowingAmount = this->_slowingAmount; - ::(GHIDRA_CAST((&slowSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - bVar2 = 0; - (GHIDRA_CAST((aCStackY_1960 + 0x81)))->Color::Reset(); - color._tint[2] = 1.3; - color._tint[0] = 1.0; - color._tint[1] = 1.0; - color._tint[3] = 1.0; - color._colorize[0] = (float)in_stack_fffffcdc; - color._colorize[1] = (float)in_stack_fffffce0; - color._colorize[2] = (float)in_stack_fffffce4; - color._colorize[3] = (float)in_stack_fffffce8; - color._offset[0] = 0.15686275; - color._offset[1] = 0.15686275; - color._offset[2] = 0.15686275; - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddSlowing(&slowSource,0x5a,slowingAmount,color,bVar2); - enemyIdx = GHIDRA_INT(local_70); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40); - if (bVar2 != 0) { - damage = this->_poisonTickDamage; - ::(GHIDRA_CAST((&poisonSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddPoison(&poisonSource,0x5a,damage,0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&freezeSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddFreeze(&freezeSource,0x5a,0); - } - } - else { - ::(GHIDRA_CAST((&midasSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddMidasFreeze(&midasSource,0x5a,0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000000); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x800); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&fearSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddFear(&fearSource,0x5a,0); - } - } - else { - ::(GHIDRA_CAST((&shrinkSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddShrink(&shrinkSource,0x5a,0,0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&charmSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddCharmed(&charmSource,0x5a,0,0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x200); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&confusionSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddConfusion(&confusionSource,0x5a,0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&burnSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddBurn(&burnSource,0x5a,0.0,0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x8000000000000); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&magnetizeSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddMagnetized(&magnetizeSource,0x5a,unused); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000000000000); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&iceSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddIce(&iceSource,0x5a); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x10000000000000); - if (bVar2 != 0) { - ::(GHIDRA_CAST((&baitSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(nearbyEnemy))))->Entity::AddBaited(&baitSource,0x5a,unused_00); - } - damageSource._position.x = g_vectorZero.x; - damageSource._velocity.x = g_vectorZero.x; - damageSource._type = 0; - damageSource._position.y = g_vectorZero.y; - damageSource._velocity.y = g_vectorZero.y; - damageSource._variant = 0; - damageSource._spawnerType = 0; - damageSource._spawnerVariant = 0; - damageSource._flags = 0; - damageSource._entity = (void *)0x0; - in_stack_fffffce8 = GHIDRA_CAST(0x41200000); - in_stack_fffffce4 = GHIDRA_CAST(0x6d5f2e); - (**(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + enemyIdx * 4)) + 0x20))(); - enemyIdx = GHIDRA_INT(local_70); - } - local_70 = (float)(enemyIdx + 1); - } while (GHIDRA_UINT(local_70) < GHIDRA_UINT(fStack_a0)); - } - (GHIDRA_CAST((&poofColor)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::MakeBloodPoof(&this->_pos,color_00,1.0); - uVar3 = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - pvVar5 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar5) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar5 = (playerManager->_playerList)._end; - } - playerIt = (playerManager->_playerList)._begin; - if (uVar3 < GHIDRA_UINT((GHIDRA_INT(pvVar5) - GHIDRA_INT(playerIt) >> 2))) { - playerIt = playerIt + uVar3; - } - iVar6 = *playerIt; - iVar4 = *GHIDRA_CAST((iVar6 + 0x13dc)); - if (((iVar4 != 0) || (iVar4 = *GHIDRA_CAST((iVar6 + 0x13e0)), iVar4 != 0)) && - (*GHIDRA_CAST((iVar4 + 0x30)) == 2)) { - (GHIDRA_CAST((GHIDRA_CAST((iVar6 + 0x1508)))))->TemporaryEffects::RemoveNullEffect(0x7f,-1); - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if ((0x7f < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) >> 2) && - (iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1fc)), iVar4 != 0)) { - local_8c[2] = *GHIDRA_CAST((iVar4 + 0x78)); - local_8c[1] = 0; - local_80 = 0; - local_8c[0] = iVar4; - (GHIDRA_CAST((GHIDRA_CAST((iVar6 + 0x1508)))))->TemporaryEffects::AddEffect(local_8c,1,1); - } - } - uVar3 = uVar3 + 1; - playerManager = &g_game->_playerManager; - } while (uVar3 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - ehState = -NAN; - if (nearbyEnemies[0] == '\0') { - ehState = 4.2039e-45; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)nearbyEnemies)) + 0x4))),0); - ehState = -NAN; - } - } - FUN_00860c90(); - ExceptionList = prevExceptionList; - return; -} - -// 006d6610 -void Entity_NPC::SetScale(float scale) -{ - float scaleX; - float spriteScale; - - this->_scale = scale; - spriteScale = scale * this->_shrinkStatus1; - scaleX = spriteScale * g_vectorOne.x; - (this->_sprite)._scale.y = spriteScale * g_vectorOne.y; - (this->_sprite)._scale.x = scaleX; - return; -} - -// 006d6ba0 -void Entity_NPC::PlaySound(int id, float volume, int framedelay, uint8_t loop, float pitch) -{ - undefined3 in_stack_00000011; - Manager *manager; - - manager = g_manager; - if (this->_championColorIdx == 0x12) { - pitch = pitch + 0.5; - } - else if (this->_championColorIdx == 0x13) { - pitch = pitch * 0.5; - } - seed_fart_sound_override(&id); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(id,volume,framedelay,(uint8_t)_loop,pitch,0.0); - return; -} - -// 006d6c20 -int Entity_NPC::GetAliveEnemyCount() -{ - int iVar1; - uint32_t entityIdx; - int aliveCount; - bool isExcluded; - uint32_t entityCount; - int entityType; - - if ((this->_flags & 0x20000000) == 0) { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12c4)) + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12c0)); - aliveCount = 0; - if (0 < iVar1) { - aliveCount = iVar1; - } - return aliveCount; - } - aliveCount = 0; - entityIdx = 0; - entityCount = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1264)); - if (entityCount != 0) { - do { - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x125c)) + entityIdx * 4)); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST((iVar1 + 0x28)) != 1)) { - entityType = *GHIDRA_CAST((iVar1 + 0x28)); - if ((entityType - 10U < 0x3de) && - (((entityType != 0x21 && (entityType != 0x11)) && (entityType != 0x124)))) { - if (entityType == 0x375) { - isExcluded = *GHIDRA_CAST((iVar1 + 0x2c)) == 10; - } - else { - if ((entityType == 0x3c0) || (entityType == 0x3c5)) goto LAB_006d6cda; - isExcluded = entityType == 0xf5; - } - if (!isExcluded) goto LAB_006d6cc0; - } - } - else { -LAB_006d6cc0: - if ((*GHIDRA_CAST((iVar1 + 0x173)) == '\0') && ((*GHIDRA_CAST((iVar1 + 0x168)) & 0x20000000) != 0)) { - aliveCount = aliveCount + 1; - } - } -LAB_006d6cda: - entityIdx = entityIdx + 1; - } while (entityIdx < entityCount); - } - return aliveCount; -} - -// 006d6d20 -uint32_t Entity_NPC::on_player_damaged() -{ - uint32_t uVar1; - - uVar1 = this->_type; - if ((uVar1 == 0x24) || (uVar1 == 0x54)) { - (this->_v1).x = 1.0; - } - else if (((uVar1 == 0x3b7) && (uVar1 = this->_variant - 0x66, uVar1 < 3)) && (this->_state == 3)) - { - this->_state = 8; - uVar1 = Random(); - this->_stateFrame = uVar1 % 0xf + 2; - return uVar1 / 0xf; - } - return uVar1; -} - -// 006d6d80 -void Entity_NPC::room_enter() -{ - Vector *position; - int iVar1; - code *pcVar2; - uint8_t isBirthright; - RoomDescriptor *roomDesc; - int roomDx; - uint32_t doorSlot; - uint32_t extraout_EAX; - code *extraout_EDX; - int iVar3; - bool isFollowingShadow; - Color color; - uint64_t local_14; - float local_8; - Entity_Player *jacob; - - local_8 = (float)(__security_cookie ^ GHIDRA_UINT(((&color)[1]._colorize + 1))); - if (this->_type == 0x362) { - isFollowingShadow = this->_variant == 0; - } - else { - isFollowingShadow = this->_type == 0x363; - } - if ((isFollowingShadow) && (1 < g_game->_frameCount - this->_spawnFrame)) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_lastRoomIdx, - g_game->_lastRoomDimensionIdx); - iVar3 = roomDesc->GridIndex; - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx, - g_game->_currentDimensionIdx); - iVar1 = roomDesc->GridIndex; - if ((iVar3 < 0) || (iVar1 < 0)) { - doorSlot = g_game->_enterDoor; - if (GHIDRA_INT(doorSlot) < 0) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx, - g_game->_currentDimensionIdx); - local_14 = 0xb00000001; - doorSlot = roomDesc->DecorationSeed; - if (doorSlot == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - doorSlot = doorSlot >> 1 ^ doorSlot; - doorSlot = doorSlot << 0xb ^ doorSlot; - doorSlot = (doorSlot >> 0x10 ^ doorSlot) & 3; - } - iVar3 = 0; - roomDx = 0; - doorSlot = doorSlot & 0x80000003; - if (GHIDRA_INT(doorSlot) < 0) { - doorSlot = (doorSlot - 1 | 0xfffffffc) + 1; - } - switch(doorSlot) { - case 0: - roomDx = -1; - break; - case 1: - iVar3 = -1; - break; - case 2: - roomDx = 1; - break; - case 3: - iVar3 = 1; - } - } - else { - roomDx = ((iVar1 / 0xd - iVar3 / 0xd) * 0xd - iVar1) + iVar3; - iVar3 = iVar3 / 0xd - iVar1 / 0xd; - } - iVar1 = this->_type; - position = &this->_pos; - position->x = (float)roomDx * 520.0 + position->x; - (this->_pos).y = (float)iVar3 * 280.0 + (this->_pos).y; - if (((((iVar1 == 0x362) && (this->_variant == 0)) && (this->_subtype == 1)) && - ((this->_parent != 0 && (*GHIDRA_CAST((this->_parent + 0x28)) == 0x362)))) && - (((jacob = GHIDRA_CAST(this->_spawnerEntity), jacob != GHIDRA_CAST(0x0) && - (jacob->_type == 1)) && - (((jacob->_playerType == 0x25 || (jacob->_playerType == 0x27)) && - (isBirthright = (GHIDRA_CAST((jacob)))->Entity_Player::HasCollectible(0x26b,0), isBirthright == 0)))))) { - this->Remove(); - doorSlot = Random(); - Game::Spawn(g_game,1000,0xf,position,&g_vectorZero,GHIDRA_CAST(this),0,doorSlot); - (GHIDRA_CAST((&color)))->Color::Color(); - (*extraout_EDX)(extraout_EAX,0xffffffff,0xff,0,1); - } - } - if ((this->_flags & 0x1000002000000000) != 0) { - this->_damageCountdown = 0x14; - } - return; -} - -// 006d7010 -void Entity_NPC::spawn_damage_numbers() -{ - uint8_t isActiveEnemy; - Entity_Player *spiderModOwner; - Entity_NPC *statusTarget; - uint32_t seed; - uint32_t rngResult; - Entity *damageNumber; - float *damageEvent; - float maxHitPoints; - double dVar2; - Vector local_50; - Vector spawnPos; - float maxHitPoints; - - if (this->_type != 0x3c4) { - spiderModOwner = - PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x193,GHIDRA_CAST(&g_game->_playerManager),1); - if (spiderModOwner == GHIDRA_CAST(0x0)) { - return; - } - isActiveEnemy = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsActiveEnemy(0); - if (isActiveEnemy == 0) { - return; - } - } - if ((((this->_visible != 0) && (maxHitPoints = 0.0, 0.0 < (this->_sprite)._color._tint[3])) && - (0.0 < this->_health)) && - (((statusTarget = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::GetStatusEffectTarget(), - statusTarget == this && (this->_isInvicible == 0)) && - (damageEvent = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))), damageEvent != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))))))) { - do { - if (maxHitPoints < *damageEvent) { - seed = Random(); - local_50.x = 0.0; - rngResult = Random(); - maxHitPoints = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) - * 2.3283064e-10; - local_50.y = -3.0 - (maxHitPoints + maxHitPoints); - spawnPos.x = (this->_pos).x - 0.0; - spawnPos.y = (this->_pos).y - 20.0; - damageNumber = Game::SpawnEx(g_game,0x2329,1,&spawnPos,&local_50,GHIDRA_CAST(0x0),0,seed,0); - dVar2 = floor((double)(*damageEvent * 10.0 + 0.5)); - maxHitPoints = 9999.0; - if ((float)dVar2 / 10.0 <= 9999.0) { - maxHitPoints = (float)dVar2 / 10.0; - } - if (maxHitPoints <= 0.0) { - maxHitPoints = 0.1; - } - maxHitPoints = this->_maxHitPoints; - (damageNumber->_targetPosition).x = maxHitPoints; - (damageNumber->_targetPosition).y = maxHitPoints; - if (damageNumber->_parent != 0) { - msvc::multiset::erase(); - } - damageNumber->_parent = this; - msvc::multiset::insert(); - damageNumber->Update(); - maxHitPoints = 0.0; - } - damageEvent = damageEvent + 0xe; - } while (damageEvent != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc))))); - } - return; -} - -// 006d7230 -void Entity_NPC::update_damage_history() -{ - uint8_t isSharingStatus; - uint32_t ringIdx; - void *pvVar2; - int iVar3; - int eventsBytes; - int iVar4; - uint32_t historyIdx; - float *damageEvent; - float fVar5; - float damageMult; - float fVar6; - Entity_NPC *statusOwner; - uint32_t local_20; - float frameDamage; - uint32_t local_14 [4]; - Entity_NPC *ancestor; - Entity_NPC *nextParent; - uint32_t ringIdx; - - isSharingStatus = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::DoesEntityShareStatus(); - statusOwner = this; - if (isSharingStatus != 0) { - nextParent = GHIDRA_CAST(this->_parent); - statusOwner = this; - while (ancestor = nextParent, ancestor != GHIDRA_CAST(0x0)) { - statusOwner = ancestor; - nextParent = GHIDRA_CAST(ancestor->_parent); - } - } - if ((statusOwner == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (statusOwner->_type != 1)) && - (0x3dd < statusOwner->_type - 10U)))) { - statusOwner = this; - } - fVar5 = 0.0; - if (0.0 < statusOwner->_shieldStrength) { - damageEvent = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - frameDamage = 0.0; - iVar3 = (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) - GHIDRA_INT(damageEvent)) / 0x38; - if (iVar3 != 0) { - do { - if ((GHIDRA_UINT(damageEvent[2]) & 0x2000) == 0) { - fVar5 = fVar5 + *damageEvent; - } - damageEvent = damageEvent + 0xe; - iVar3 = iVar3 + -1; - } while (iVar3 != 0); - frameDamage = fVar5; - } - if (GHIDRA_UINT(statusOwner->_shieldFrames) <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc58))))) { - msvc::deque<4byte>::erase - (local_14,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc48)))),0, - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc54)))),*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc48)))),0, - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc54)))) + 1); - } - local_20 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc58)))); - ringIdx = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc54)))); - if (((local_20 + ringIdx & 3) == 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc50)))) <= local_20 + 4 >> 2)) - { - msvc::deque<4byte>::_Growmap(local_20); - local_20 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc58)))); - ringIdx = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc54)))); - } - ringIdx = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc50)))) * 4 - 1U & ringIdx; - local_14[0] = local_20 + ringIdx; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc54)))) = ringIdx; - ringIdx = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc50)))) - 1U & local_14[0] >> 2; - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc4c)))); - if (*GHIDRA_CAST((iVar3 + ringIdx * 4)) == 0) { - pvVar2 = operator_new(0x10); - *(void **)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc4c)))) + ringIdx * 4) = pvVar2; - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc4c)))); - } - fVar5 = 0.0; - *GHIDRA_CAST((*GHIDRA_CAST((iVar3 + ringIdx * 4)) + (local_14[0] & 3) * 4)) = frameDamage; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc58)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc58)))) + 1; - ringIdx = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc58)))); - if (ringIdx != 0) { - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc54)))); - historyIdx = 0; - do { - ringIdx = iVar3 + historyIdx; - historyIdx = historyIdx + 1; - fVar5 = fVar5 + *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc4c)))) + - (ringIdx >> 2 & *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc50)))) - 1U) * - 4)) + (ringIdx & 3) * 4)); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((statusOwner)) + 0xc54)))); - } while (historyIdx < ringIdx); - } - fVar6 = this->_maxHitPoints / statusOwner->_shieldStrength; - damageMult = 1.0; - fVar5 = (fVar5 / (float)((double)GHIDRA_INT(ringIdx) + __uint_to_double_fixup[-(GHIDRA_INT(ringIdx) >> 0x1f)])) * - 30.0; - if (fVar6 < fVar5) { - fVar6 = fVar6 / fVar5; - damageMult = 0.09 - fVar6 * 0.18; - if (damageMult <= 0.0) { - damageMult = 0.0; - } - damageMult = damageMult + fVar6; - } - this->_pendingDamage = 0.0; - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - local_20 = 0; - eventsBytes = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) - iVar3; - iVar4 = eventsBytes >> 0x1f; - if (eventsBytes / 0x38 + iVar4 != iVar4) { - iVar4 = 0; - do { - fVar5 = *GHIDRA_CAST((iVar4 + iVar3)); - if ((*GHIDRA_CAST((iVar4 + 8 + iVar3)) & 0x40002000) == 0) { - fVar5 = fVar5 * damageMult; - *GHIDRA_CAST((iVar4 + iVar3)) = fVar5; - } - local_20 = local_20 + 1; - iVar4 = iVar4 + 0x38; - this->_pendingDamage = fVar5 + this->_pendingDamage; - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); - } while (local_20 < GHIDRA_UINT(((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) - iVar3) / 0x38))); - } - } - return; -} - -// 006d7520 -void Entity_NPC::update_blood_guide_gibs(float *nullFrame) -{ - Entity_NPC *bloodEffect = this; - void **ppvVar1; - uint8_t bVar2; - int iVar3; - Vector *randomDir; - uint32_t rngResult; - Entity *spawned; - Entity_Effect *bloodEffect; - AnimationState *animState; - float fVar4; - float fVar5; - double pitchRandom; - float fVar6; - float randomFraction; - uint32_t uVar7; - int framedelay; - TypeDescriptor *pTVar8; - TypeDescriptor *pTVar9; - uint32_t uVar10; - Vector local_30; - Vector gibPos; - int *local_20; - uint8_t *local_1c; - uint8_t *local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - float nullPosX; - float nullPosY; - float nullScaleX; - void *room; - code *setColorFn; - int *tmpEntity; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afac9d; - local_10 = ExceptionList; - ppvVar1 = &local_10; - if (nullFrame == GHIDRA_CAST(0x0)) { - if ((bloodEffect->_sprite)._animState._animData == (void *)0x0) { - return; - } - ExceptionList = &local_10; - nullFrame = AnimationState::GetNullFrame(&(bloodEffect->_sprite)._animState,GHIDRA_CAST("BloodGuide")); - ppvVar1 = ExceptionList; - if (nullFrame == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - } - ExceptionList = ppvVar1; - animState = &(bloodEffect->_sprite)._animState; - if ((bloodEffect->_sprite)._animState._animData == (void *)0x0) goto LAB_006d7c3e; - bVar2 = AnimationState::WasEventTriggered(animState,GHIDRA_CAST("BloodStart")); - if ((bVar2 != 0) && - (((bloodEffect->_sprite)._animState._animData == (void *)0x0 || - ((bVar2 = AnimationState::WasEventTriggered(animState,GHIDRA_CAST("BloodStop")), bVar2 == 0 && - (((bloodEffect->_sprite)._animState._animData == (void *)0x0 || - (bVar2 = AnimationState::WasEventTriggered(animState,GHIDRA_CAST("Explosion")), bVar2 == 0))))))) - ) { - if (((bloodEffect->_type == 0x390) && (bloodEffect->_variant == 10)) || - ((*GHIDRA_CAST((GHIDRA_CAST(bloodEffect->_config) + 0x60)) >> 0xd & 1) != 0)) { - iVar3 = (GHIDRA_CAST((GHIDRA_CAST(bloodEffect))))->Entity::GetIntervalTicks(3.0,0.0); - if (iVar3 != 0) { - Game::ShakeScreen(g_game,5); - } - iVar3 = (GHIDRA_CAST((GHIDRA_CAST(bloodEffect))))->Entity::GetIntervalTicks(10.0,0.0); - if (iVar3 != 0) { - randomDir = MusicManager::RandomVector(&local_30); - rngResult = Random(); - local_20 = GHIDRA_CAST(0x47); - fVar6 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) - * 2.3283064e-10; - local_30.y = (fVar6 * randomDir->y * nullFrame[5] * 4.0 + nullFrame[1]) / 0.65; - local_30.x = (fVar6 * randomDir->x * nullFrame[4] * 4.0 + *nullFrame) / 0.65; - local_1c = GHIDRA_CAST(local_30.x); - local_18 = GHIDRA_CAST(local_30.y); - rngResult = Random(); - gibPos.x = (float)local_1c + (bloodEffect->_pos).x; - gibPos.y = (float)local_18 + (bloodEffect->_pos).y; - spawn_gibs(&gibPos,(rngResult & 3) + 6,60.0,GHIDRA_CAST(&local_20),GHIDRA_CAST(bloodEffect), - &bloodEffect->_splatColor,&g_vectorZero,1.0); - rngResult = Random(); - spawn_blood_explosion - ((rngResult & 1) + 3,&bloodEffect->_pos,&local_30,&bloodEffect->_splatColor,&g_vectorZero); - fVar6 = 1.0; - bVar2 = 0; - framedelay = 2; - rngResult = Random(); - pitchRandom = (double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]; - iVar3 = 0x8d; -LAB_006d7a90: - PlaySound(bloodEffect,iVar3,(float)pitchRandom * 2.3283064e-10 * 0.2 + 0.5,framedelay,bVar2,fVar6); - } - } - else { - rngResult = Random(); - if ((rngResult & 1) == 0) { - iVar3 = PlayerManager::GetGFuelCount(); - if (iVar3 < 1) { - rngResult = Random(); - uVar10 = 0; - pTVar9 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar8 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar7 = 0; - spawned = Game::Spawn(g_game,1000,0x11,&bloodEffect->_pos,&g_vectorZero,GHIDRA_CAST(bloodEffect),0, - rngResult); - local_20 = GHIDRA_CAST(__RTDynamicCast(spawned,uVar7,pTVar8,pTVar9,uVar10)); - randomDir = MusicManager::RandomVector(&local_30); - rngResult = Random(); - tmpEntity = local_20; - randomFraction = - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10; - fVar6 = randomDir->y; - fVar4 = randomDir->x; - fVar5 = nullFrame[5]; - nullScaleX = nullFrame[4]; - nullPosY = nullFrame[1]; - nullPosX = *nullFrame; - local_20[0xd6] = 0x42480000; - local_20[0x38] = GHIDRA_INT((randomFraction * fVar6 * fVar5 * 4.0 + nullPosY)); - local_20[0x37] = GHIDRA_INT((randomFraction * fVar4 * nullScaleX * 4.0 + nullPosX)); - rngResult = Random(); - tmpEntity[0x3b] = GHIDRA_INT((((float)(rngResult & 3) + 0.0) * 90.0)); - rngResult = Random(); - local_18 = &DAT_bf800000; - local_1c = local_18; - if ((rngResult & 1) == 0) { - local_1c = GHIDRA_CAST(0x3f800000); - } - rngResult = Random(); - if ((rngResult & 1) == 0) { - local_18 = GHIDRA_CAST(0x3f800000); - } - rngResult = Random(); - setColorFn = *(code **)(*tmpEntity + 0x3c); - fVar6 = 1.0 - (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 0.4; - tmpEntity[0x3a] = GHIDRA_INT((fVar6 * (float)local_1c)); - tmpEntity[0x39] = GHIDRA_INT((fVar6 * (float)local_18)); - (*setColorFn)(&bloodEffect->_splatColor,0xffffffff,0xff,0,1); - fVar6 = 1.0; - bVar2 = 0; - framedelay = 2; - rngResult = Random(); - pitchRandom = (double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]; - iVar3 = 0x48; - goto LAB_006d7a90; - } - local_20 = GHIDRA_CAST(spawn_gfuel_explosion()); - randomDir = MusicManager::RandomVector(&local_30); - rngResult = Random(); - tmpEntity = local_20; - randomFraction = - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10; - fVar6 = randomDir->y; - fVar4 = randomDir->x; - fVar5 = nullFrame[5]; - nullScaleX = nullFrame[4]; - nullPosY = nullFrame[1]; - nullPosX = *nullFrame; - local_20[0xd6] = 0x42480000; - local_20[0x38] = GHIDRA_INT((randomFraction * fVar6 * fVar5 * 4.0 + nullPosY)); - local_20[0x37] = GHIDRA_INT((randomFraction * fVar4 * nullScaleX * 4.0 + nullPosX)); - rngResult = Random(); - if ((rngResult & 1) == 0) { - local_18 = GHIDRA_CAST(0x3f800000); - } - else { - local_18 = &DAT_bf800000; - } - rngResult = Random(); - fVar6 = 1.0 - (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 0.4; - tmpEntity[0x3a] = GHIDRA_INT(fVar6); - tmpEntity[0x39] = GHIDRA_INT((fVar6 * (float)local_18)); - } - } - } - if ((((bloodEffect->_sprite)._animState._animData != (void *)0x0) && - (bVar2 = AnimationState::IsEventTriggered(&(bloodEffect->_sprite)._animState,GHIDRA_CAST("BloodStart")), - bVar2 != 0)) && (bloodEffect->_type == 0x54)) { - local_1c = GHIDRA_CAST(0x4); - do { - rngResult = Random(); - uVar10 = 0; - pTVar9 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar8 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar7 = 0; - spawned = Game::Spawn(g_game,1000,0x2a,&bloodEffect->_pos,&g_vectorZero,GHIDRA_CAST(bloodEffect),0,rngResult); - bloodEffect = GHIDRA_CAST(__RTDynamicCast(spawned,uVar7,pTVar8,pTVar9,uVar10)); - (GHIDRA_CAST((bloodEffect)))->Entity_Effect::FollowParent(GHIDRA_CAST(bloodEffect)); - rngResult = Random(); - fVar6 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - fVar6 = fVar6 + fVar6; - local_18 = GHIDRA_CAST(sin(fVar6)); - rngResult = Random(); - local_20 = GHIDRA_CAST(((float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10)); - fVar5 = cos(fVar6); - fVar6 = nullFrame[5]; - fVar4 = nullFrame[1]; - (bloodEffect->_sprite)._offset.x = fVar5 * (float)local_20 * nullFrame[4] * 3.8 + *nullFrame; - (bloodEffect->_sprite)._offset.y = (float)local_20 * (float)local_18 * fVar6 * 3.8 + fVar4; - rngResult = Random(); - if ((rngResult & 1) == 0) { - fVar6 = 50.0; - } - else { - fVar6 = -50.0; - } - bloodEffect->_renderDepthOffset = fVar6; - bloodEffect->_timeout = -1; - bloodEffect->_lifespan = -1; - rngResult = Random(); - if ((rngResult & 1) == 0) { - (bloodEffect->_sprite)._flipX = 1; - } - bloodEffect->SetColor(&bloodEffect->_splatColor,0xffffffff,0xff,0,1); - local_1c = local_1c + -1; - } while (local_1c != GHIDRA_CAST(0x0)); - } -LAB_006d7c3e: - animState = &(bloodEffect->_sprite)._animState; - if (((bloodEffect->_sprite)._animState._animData != (void *)0x0) && - ((bVar2 = AnimationState::IsEventTriggered(animState,GHIDRA_CAST("BloodStop")), bVar2 != 0 || - (((bloodEffect->_sprite)._animState._animData != (void *)0x0 && - (bVar2 = AnimationState::IsEventTriggered(animState,GHIDRA_CAST("Explosion")), bVar2 != 0)))))) { - room = g_game->_room; - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)); - local_30.x = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1260)); - fVar6 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)); - fVar4 = 0.0; - local_8 = 0; - local_30.y = fVar6; - if (fVar6 != 0.0) { - do { - tmpEntity = *GHIDRA_CAST((iVar3 + GHIDRA_INT(fVar4) * 4)); - if (((tmpEntity != GHIDRA_CAST(0x0)) && (tmpEntity[10] == 1000)) && - ((tmpEntity[0xb] == 0x2a && (GHIDRA_CAST(tmpEntity[0xef]) == bloodEffect)))) { - (**(code **)(*tmpEntity + 0x28))(); - } - fVar4 = (float)(GHIDRA_INT(fVar4) + 1); - } while (GHIDRA_UINT(fVar4) < GHIDRA_UINT(fVar6)); - } - } - ExceptionList = local_10; - return; -} - -// 006d81c0 -void Entity_NPC::ClearDequeRefs() -{ - int iVar1; - uint32_t index; - int *local_8; - int *entityRef; - int *proxy; - - proxy = (this->_entityDeque)._proxy; - for (index = (this->_entityDeque)._offset; - index != (this->_entityDeque)._offset + (this->_entityDeque)._size; index = index + 1) { - if (proxy == GHIDRA_CAST(0x0)) { - iVar1 = 0; - } - else { - iVar1 = *proxy; - } - entityRef = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 4)) + (index >> 2 & *GHIDRA_CAST((iVar1 + 8)) - 1U) * 4)) - + (index & 3) * 4)); - if (*entityRef != 0) { - local_8 = entityRef; - msvc::multiset::erase(&local_8); - } - *entityRef = 0; - } - msvc::deque::_Tidy(); - return; -} - -// 006d8260 -uint8_t Entity_NPC::IsControllerActionPressed(int action) -{ - uint8_t isPressed; - - if (this->_controllerID != -1) { - isPressed = input_is_action_pressed(action,this->_controllerID,GHIDRA_CAST(this),GHIDRA_INT(this)); - if (isPressed != 0) { - return 1; - } - } - return 0; -} - -// 006d8290 -uint8_t Entity_NPC::IsControllerActionTriggered(int buttonAction) -{ - uint8_t isTriggered; - - if (this->_controllerID != -1) { - isTriggered = input_is_action_triggered - (g_manager,buttonAction,this->_controllerID,GHIDRA_CAST(this),0); - if (isTriggered != 0) { - return 1; - } - } - return 0; -} - -// 006d82d0 -Vector * Entity_NPC::GetControllerInput(Vector *outInput, float deadzone) -{ - int controllerIndex; - Vector *cardinalDir; - uint32_t curses; - int unused; - int unused_00; - int unused_01; - int unused_02; - int unused_03; - int unused_04; - void *seedEffectsHead; - float fVar1; - float fVar2; - float inputX; - float inputY; - Vector local_28; - float savedDeadzone; - Vector rawInput; - uint8_t seedFindResult [8]; - void *seedNode; - Game *game; - - controllerIndex = this->_controllerID; - if (controllerIndex != -1) { - savedDeadzone = deadzone; - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c))) == '\0') { - fVar1 = InputManager::GetActionValue(0,controllerIndex,GHIDRA_CAST(this),GHIDRA_INT(this)); - inputX = InputManager::GetActionValue(1,this->_controllerID,GHIDRA_CAST(this),unused_02); - inputX = inputX + (0.0 - fVar1); - rawInput.x = inputX; - fVar1 = InputManager::GetActionValue(2,this->_controllerID,GHIDRA_CAST(this),unused_03); - inputY = InputManager::GetActionValue(3,this->_controllerID,GHIDRA_CAST(this),unused_04); - inputY = inputY + (0.0 - fVar1); - } - else { - fVar1 = InputManager::GetActionValue(4,controllerIndex,GHIDRA_CAST(this),GHIDRA_INT(this)); - inputX = InputManager::GetActionValue(5,this->_controllerID,GHIDRA_CAST(this),unused); - inputX = inputX + (0.0 - fVar1); - rawInput.x = inputX; - fVar1 = InputManager::GetActionValue(6,this->_controllerID,GHIDRA_CAST(this),unused_00); - inputY = InputManager::GetActionValue(7,this->_controllerID,GHIDRA_CAST(this),unused_01); - inputY = inputY + (0.0 - fVar1); - } - game = g_game; - local_28.x = 1.68156e-44; - fVar1 = inputY; - rawInput.y = inputY; - msvc::set::find_node(seedFindResult,&local_28); - if ((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0xd)) { - seedEffectsHead = (game->_seedEffects)._seedEffects; - if (seedNode != seedEffectsHead) { - inputX = inputX * -1.0; - fVar1 = fVar1 * -1.0; - inputY = fVar1; - rawInput.x = inputX; - rawInput.y = fVar1; - } - } - else { - seedEffectsHead = (game->_seedEffects)._seedEffects; - } - local_28.x = 1.06499e-43; - fVar2 = inputX; - msvc::set::find_node(seedFindResult,&local_28); - if (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') { - if (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x4d) { - if (seedNode != seedEffectsHead) { - cardinalDir = Vector::ToCardinal(&local_28,&rawInput); - fVar2 = sqrtf(fVar1 * fVar1 + fVar2 * fVar2); - fVar1 = fVar2 * cardinalDir->y; - fVar2 = fVar2 * cardinalDir->x; - inputX = fVar2; - inputY = fVar1; - } - } - } - fVar1 = sqrtf(fVar1 * fVar1 + fVar2 * fVar2); - if ((savedDeadzone <= 0.0) || (savedDeadzone <= fVar1)) { - if (1.0 < fVar1) { - inputX = inputX / fVar1; - inputY = inputY / fVar1; - } - if (((game->_currentDimensionIdx == 1) && ((game->_stageType == 4 || (game->_stageType == 5))) - ) && ((game->_stage == 2 || - ((game->_stage == 1 && (curses = Level::GetCurses(GHIDRA_CAST(game)), (curses & 2) != 0) - ))))) { - inputX = inputX * -1.0; - } - outInput->x = inputX; - outInput->y = inputY; - return outInput; - } - } - fVar1 = g_vectorZero.y; - outInput->x = g_vectorZero.x; - outInput->y = fVar1; - return outInput; -} - -// 006d85a0 -Vector * Entity_NPC::GetControllerMovementInput(Vector *outInput, float deadzone) -{ - uint8_t bVar1; - Vector *pVVar2; - uint32_t curses; - int unused; - int unused_00; - int unused_01; - int unused_02; - int unused_03; - int unused_04; - int unused_05; - Game *game; - float fVar3; - float fVar4; - uint8_t local_38 [8]; - void *seedNode; - uint8_t local_2c [4]; - Vector local_28; - Vector rawInput; - float minMagnitude; - uint32_t seedKey; - float local_10; - float inputX; - - game = g_game; - if (this->_controllerID == -1) goto LAB_006d8891; - local_10 = 1.03696e-43; - minMagnitude = deadzone; - msvc::set::find_node(local_2c,&local_10); - if (((*GHIDRA_CAST((GHIDRA_CAST(local_28.y) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(local_28.y) + 0x10)) < 0x4b)) && - ((void *)local_28.y != (game->_seedEffects)._seedEffects)) { - pVVar2 = GetControllerInput(this,&local_28,0.0); - rawInput.x = pVVar2->x; - fVar4 = pVVar2->y; - game = g_game; -LAB_006d8761: - rawInput.y = fVar4; - local_10 = fVar4; - inputX = rawInput.x; - } - else { - bVar1 = Game::IsInTimedSet(game,0x4b); - if (bVar1 != 0) { - pVVar2 = GetControllerInput(this,&local_28,0.0); - rawInput.x = pVVar2->x * -1.0; - fVar4 = pVVar2->y * -1.0; - game = g_game; - goto LAB_006d8761; - } - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c))) == '\0') { - local_10 = InputManager::GetActionValue(4,this->_controllerID,GHIDRA_CAST(this),unused); - local_10 = 0.0 - local_10; - rawInput.x = InputManager::GetActionValue(5,this->_controllerID,GHIDRA_CAST(this),unused_03); - rawInput.x = rawInput.x + local_10; - inputX = rawInput.x; - local_10 = InputManager::GetActionValue(6,this->_controllerID,GHIDRA_CAST(this),unused_04); - local_10 = 0.0 - local_10; - fVar4 = InputManager::GetActionValue(7,this->_controllerID,GHIDRA_CAST(this),unused_05); - fVar4 = fVar4 + local_10; - } - else { - local_10 = InputManager::GetActionValue(0,this->_controllerID,GHIDRA_CAST(this),unused); - local_10 = 0.0 - local_10; - rawInput.x = InputManager::GetActionValue(1,this->_controllerID,GHIDRA_CAST(this),unused_00); - rawInput.x = rawInput.x + local_10; - inputX = rawInput.x; - local_10 = InputManager::GetActionValue(2,this->_controllerID,GHIDRA_CAST(this),unused_01); - local_10 = 0.0 - local_10; - fVar4 = InputManager::GetActionValue(3,this->_controllerID,GHIDRA_CAST(this),unused_02); - fVar4 = fVar4 + local_10; - } - game = g_game; - rawInput.y = fVar4; - local_10 = fVar4; - bVar1 = Game::IsInTimedSet(g_game,0xc); - if (bVar1 != 0) { - rawInput.x = inputX * -1.0; - fVar4 = fVar4 * -1.0; - goto LAB_006d8761; - } - } - seedKey = 0x4c; - fVar3 = inputX; - msvc::set::find_node(local_38,&seedKey); - if (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') { - if (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x4d) { - if (seedNode != (game->_seedEffects)._seedEffects) { - pVVar2 = Vector::ToCardinal(&local_28,&rawInput); - fVar3 = sqrtf(fVar4 * fVar4 + fVar3 * fVar3); - fVar4 = fVar3 * pVVar2->y; - fVar3 = fVar3 * pVVar2->x; - local_10 = fVar4; - inputX = fVar3; - } - } - } - fVar4 = sqrtf(fVar4 * fVar4 + fVar3 * fVar3); - if ((minMagnitude <= 0.0) || (minMagnitude <= fVar4)) { - if (1.0 < fVar4) { - inputX = inputX / fVar4; - local_10 = local_10 / fVar4; - } - if (((game->_currentDimensionIdx == 1) && ((game->_stageType == 4 || (game->_stageType == 5)))) - && ((game->_stage == 2 || - ((game->_stage == 1 && (curses = Level::GetCurses(GHIDRA_CAST(game)), (curses & 2) != 0)))))) - { - inputX = inputX * -1.0; - } - outInput->x = inputX; - outInput->y = local_10; - return outInput; - } -LAB_006d8891: - fVar4 = g_vectorZero.y; - outInput->x = g_vectorZero.x; - outInput->y = fVar4; - return outInput; -} - -// 006d88b0 -void Entity_NPC::TransferControl(Entity_NPC *target) -{ - void *playersBegin; - uint32_t *controlledNpcRef; - uint32_t *eraseRef; - Entity_Player *player; - Entity_NPC *newController; - - newController = target; - if (target != this) { - if (this->_controllerID != -1) { - target = GHIDRA_CAST(0x0); - playersBegin = (g_game->_playerManager)._extraPlayers._begin; - if (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - GHIDRA_INT(playersBegin) >> 2 != 0) { - do { - player = *GHIDRA_CAST((GHIDRA_CAST(playersBegin) + GHIDRA_INT(target) * 4)); - if (player->_controllerIndex == this->_controllerID) { - controlledNpcRef = &player->_target; - if (GHIDRA_CAST(player->_target) == this) { - if (GHIDRA_CAST(player->_target) != GHIDRA_CAST(0x0)) { - eraseRef = controlledNpcRef; - msvc::multiset::erase(&eraseRef); - } - *controlledNpcRef = newController; - if (newController != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(controlledNpcRef); - } - } - } - target = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((target)) + 0x1)))); - playersBegin = (g_game->_playerManager)._extraPlayers._begin; - } while (target < (uint8_t *) - (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - GHIDRA_INT(playersBegin) >> 2 - )); - } - } - if (newController != GHIDRA_CAST(0x0)) { - newController->_controllerID = this->_controllerID; - } - this->_controllerID = -1; - } - return; -} - -// 006d8b20 -void Entity_NPC::SpawnControlTarget(int inputMode, float rotation) -{ - int iVar1; - ANM2 *pAVar2; - Vector *pVVar3; - uint32_t seed; - Entity *targetEffect; - int *aimTarget; - Vector local_40; - uint32_t local_38 [8]; - uint32_t local_18; - uint32_t uStack_14; - uint32_t local_10; - uint32_t local_c; - uint8_t auStack_8 [4]; - void **aimTargetSlot; - ColorMod *targetColor; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - aimTarget = this->_aimTargetEffect; - aimTargetSlot = &this->_aimTargetEffect; - if (aimTarget != GHIDRA_CAST(0x0)) { - if (aimTarget[10] == 1000) goto LAB_006d8cba; - (**(code **)(*aimTarget + 0x28))(); - if (*aimTargetSlot != (void *)0x0) { - local_40.y = (float)aimTargetSlot; - msvc::multiset::erase(&local_40.y); - } - *aimTargetSlot = (void *)0x0; - } - if (inputMode == 0) { - pVVar3 = GetControllerMovementInput(this,&local_40,0.0); - if ((pVVar3->x == g_vectorZero.x) && (pVVar3->y == g_vectorZero.y)) { - return; - } - } - else if (((inputMode == 1) && - (pVVar3 = GetControllerInput(this,&local_40,0.0), pVVar3->x == g_vectorZero.x)) && - (pVVar3->y == g_vectorZero.y)) { - return; - } - seed = Random(); - targetEffect = Game::Spawn(g_game,1000,0x1e,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,seed); - iVar1 = *GHIDRA_CAST(targetEffect); - pAVar2 = &targetEffect[1]._sprite; - (pAVar2->_filename)._buf[4] = '\0'; - (pAVar2->_filename)._buf[5] = '\0'; - (pAVar2->_filename)._buf[6] = '\0'; - (pAVar2->_filename)._buf[7] = '\0'; - pAVar2 = &targetEffect[1]._sprite; - (pAVar2->_filename)._buf[8] = '\0'; - (pAVar2->_filename)._buf[9] = '\0'; - (pAVar2->_filename)._buf[10] = '\0'; - (pAVar2->_filename)._buf[0xb] = '\0'; - (**(code **)(iVar1 + 0xc))(); - targetColor = &(targetEffect->_sprite)._color; - local_18 = 0; - uStack_14 = 0; - local_10 = 0; - if (targetColor != GHIDRA_CAST(local_38)) { - (targetEffect->_sprite)._color._colorize[0] = 0.0; - (targetEffect->_sprite)._color._colorize[1] = 0.0; - (targetEffect->_sprite)._color._colorize[2] = 0.0; - (targetEffect->_sprite)._color._colorize[3] = 0.0; - (targetEffect->_sprite)._color._offset[0] = 0.0; - (targetEffect->_sprite)._color._offset[1] = 0.0; - targetColor->_tint[0] = 0.60784316; - (targetEffect->_sprite)._color._tint[1] = 0.0; - (targetEffect->_sprite)._color._tint[2] = 0.0; - (targetEffect->_sprite)._color._tint[3] = 1.0; - (targetEffect->_sprite)._color._offset[2] = 0.0; - } - if (*aimTargetSlot != (void *)0x0) { - local_40.y = (float)aimTargetSlot; - msvc::multiset::erase(&local_40.y); - } - *aimTargetSlot = targetEffect; - msvc::multiset::insert(aimTargetSlot); - aimTarget = this->_aimTargetEffect; -LAB_006d8cba: - aimTarget[0x11d] = GHIDRA_INT(rotation); - *GHIDRA_CAST((GHIDRA_INT(*aimTargetSlot) + 0x424)) = 2; - *GHIDRA_CAST((GHIDRA_INT(*aimTargetSlot) + 0x428)) = inputMode; - return; -} - -// 006d8cf0 -void Entity_NPC::ClearChild() -{ - Entity_NPC *local_8; - void **childRef; - - childRef = &this->_aimTargetEffect; - if (*childRef != GHIDRA_CAST(0x0)) { - local_8 = this; - (**(code **)(*GHIDRA_CAST(*childRef) + 0x28))(); - if (*childRef != (void *)0x0) { - local_8 = GHIDRA_CAST(childRef); - msvc::multiset::erase(&local_8); - } - *childRef = (void *)0x0; - } - return; -} - -// 006d8d30 -Vector * Entity_NPC::GetAimTargetPosition(Vector *outPosition) -{ - float targetX; - float targetY; - void *aimTarget; - - aimTarget = this->_aimTargetEffect; - if (aimTarget == (void *)0x0) { - targetX = (this->_pos).x; - targetY = (this->_pos).y; - } - else { - targetX = *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x33c)); - targetY = *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x340)); - } - outPosition->x = targetX; - outPosition->y = targetY; - return outPosition; -} - -// 006d8d80 -uint8_t Entity_NPC::is_controller_input_idle() -{ - int iVar1; - Vector *pVVar2; - Vector movementInput; - Vector controllerInput; - void *aimTarget; - - aimTarget = this->_aimTargetEffect; - if (aimTarget != (void *)0x0) { - if ((*GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x28)) == 1000) && - (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x428)), iVar1 != 0)) { - if (iVar1 != 1) { - if (iVar1 == 2) { - return 1; - } - return 0; - } - pVVar2 = GetControllerInput(this,&controllerInput,0.1); - } - else { - pVVar2 = GetControllerMovementInput(this,&movementInput,0.1); - } - if ((pVVar2->x == g_vectorZero.x) && (pVVar2->y == g_vectorZero.y)) { - return 1; - } - } - return 0; -} - -// 006d8e40 -void Entity_NPC::UpdateChargeBar(float start, float end, float value, uint8_t isHideWhenFull) -{ - uint8_t *puVar1; - uint8_t bVar2; - LayerState *barLayer; - int chargeFrame; - char *ptr; - uint32_t size; - float chargeFraction; - std_string anm2Path; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00af85cd; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - bVar2 = (this->_chargeBarSprite)._loaded; - if (this->_controllerID == -1) { - if (bVar2 == 0) { - return; - } - } - else { - ExceptionList = &local_1c; - puVar1 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - if (bVar2 == 0) { - anm2Path._size = 0; - anm2Path._capacity = 0xf; - anm2Path._buf[0] = '\0'; - anm2Path._buf[1] = '\0'; - anm2Path._buf[2] = '\0'; - anm2Path._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20); - anm2Path._size = 0x12; - anm2Path._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))),"gfx/chargebar.anm2",0x13); - local_14 = 0; - ANM2::Load(&this->_chargeBarSprite,&anm2Path,1); - local_14 = 0xffffffff; - if (0xf < anm2Path._capacity) { - size = anm2Path._capacity + 1; - ptr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))); - if (0xfff < size) { - ptr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + -4)); - size = anm2Path._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,size); - } - anm2Path._size = 0; - anm2Path._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) & 0xffffff00; - puVar1 = puStack_20; - } - puStack_20 = puVar1; - barLayer = ANM2::GetLayer(&this->_chargeBarSprite,GHIDRA_CAST(0x2)); - barLayer->_visible = 0; - if (start == end) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - chargeFraction = (value - start) / (end - start); - if (chargeFraction <= 0.0) { - chargeFraction = 0.0; - } - if (1.0 <= chargeFraction) { - chargeFraction = 1.0; - } - chargeFrame = GHIDRA_INT((chargeFraction * 100.0 + 0.0)); - if ((isHideWhenFull == 0) || (chargeFrame < 100)) { - bVar2 = ANM2::SetAnimation(&this->_chargeBarSprite,GHIDRA_CAST("Charging"),1); - if ((bVar2 != 0) && - (((this->_chargeBarSprite)._animState._animData != (void *)0x0 && - (AnimationState::SetFrameFloat(&(this->_chargeBarSprite)._animState,(float)chargeFrame), - (this->_chargeBarSprite)._animState._animData != (void *)0x0)))) { - (this->_chargeBarSprite)._animState._isPlaying = 0; - } - (this->_chargeBarSprite)._color._tint[3] = 1.0; - ExceptionList = local_1c; - return; - } - } - (this->_chargeBarSprite)._color._tint[3] = 0.0; - ExceptionList = local_1c; - return; -} - -// 006d9050 -void Entity_NPC::UpdateControllerMovement(uint8_t isForceUpdate) -{ - Vector movementInput; - - if (this->_controllerID == -1) { - (this->_controllerMovement).x = g_vectorZero.x; - (this->_controllerMovement).y = g_vectorZero.y; - return; - } - GetControllerMovementInput(this,&movementInput,0.1); - if (((isForceUpdate != 0) || (movementInput.x != g_vectorZero.x)) || - (movementInput.y != g_vectorZero.y)) { - (this->_controllerMovement).x = movementInput.x; - (this->_controllerMovement).y = movementInput.y; - } - return; -} - -// 006d90e0 -void Entity_NPC::UpdateChildEffectPosition(uint8_t isPredictMovement) -{ - Vector *input; - float fVar1; - float fVar2; - Vector local_18; - Vector local_10; - void *aimTarget; - - if (this->_controllerID == -1) { - return; - } - aimTarget = this->_aimTargetEffect; - if (aimTarget == (void *)0x0) { - return; - } - if (*GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x28)) == 1000) { - if (*GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x428)) == 2) { - if (isPredictMovement == 0) { - fVar1 = (this->_prevPosition).x; - fVar2 = (this->_prevPosition).y; - } - else { - fVar2 = (this->_prevVelocity).y * 0.5 * this->_speedMultiplier + (this->_prevPosition).y; - fVar1 = (this->_prevVelocity).x * 0.5 * this->_speedMultiplier + (this->_prevPosition).x; - } - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x33c)) = fVar1; - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x340)) = fVar2; - aimTarget = this->_aimTargetEffect; - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x360)) = g_vectorZero.x; - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x364)) = g_vectorZero.y; - return; - } - if (*GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x428)) != 0) { - input = GetControllerInput(this,&local_10,0.0); - goto LAB_006d91de; - } - } - input = GetControllerMovementInput(this,&local_18,0.0); -LAB_006d91de: - fVar1 = input->y; - if ((input->x != g_vectorZero.x) || (fVar1 != g_vectorZero.y)) { - aimTarget = this->_aimTargetEffect; - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x360)) = input->x * 8.0 + *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x360)); - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x364)) = fVar1 * 8.0 + *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x364)); - } - aimTarget = this->_aimTargetEffect; - if ((*GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x28)) == 1000) && (0.0 < *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x474)))) { - fVar1 = *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x474)) - 40.0; - local_18.x = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x33c)); - if (fVar1 <= 0.0) { - fVar1 = 0.0; - } - local_10.x = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x340)); - fVar2 = sqrtf(local_10.x * local_10.x + local_18.x * local_18.x); - if (fVar1 < fVar2) { - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x360)) = - (local_18.x / fVar2) * (fVar2 - fVar1) * 0.1 + *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x360)); - *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x364)) = - (local_10.x / fVar2) * (fVar2 - fVar1) * 0.1 + *GHIDRA_CAST((GHIDRA_CAST(aimTarget) + 0x364)); - } - } - return; -} - -// 006d97e0 -uint8_t Entity_NPC::split(float damage, EntityRef *source, uint8_t isPlaySound) -{ - int iVar1; - code *pcVar2; - uint8_t bVar3; - char cVar4; - uint32_t uVar5; - EntityRef *killSourceRef; - Entity_NPC *half; - uint8_t *animNameCh; - void *listData; - LayerState *layer; - uint8_t unk; - uint8_t *expectedNameCh; - Entity_NPC *momPart; - uint32_t rngState; - int iVar6; - uint32_t *parentLinkSlot; - bool bVar7; - bool isUnsplittable; - float fVar8; - float fVar9; - uint8_t *sideSign; - EntityRef dieSourceRef; - EntityRef dieSourceRef2; - uint64_t rngShifts2; - uint8_t hornfelDoors [12]; - int iStack_9c; - uint8_t momParts [12]; - EntityRef *pEStack_8c; - uint8_t geminiBabies [8]; - int iStack_80; - EntityRef *pEStack_7c; - uint64_t rngShifts; - int rngShiftC; - uint8_t peeps [12]; - EntityRef *pEStack_5c; - int halves [2]; - uint32_t *eraseMomPartParent; - int *eraseBabyParent; - uint32_t *erasePeepParent; - int *eraseHalfParent; - uint8_t umbilicalCords [8]; - int iStack_38; - EntityRef *pEStack_34; - Vector spawnPos; - int *local_28; - uint32_t *local_24; - float local_20; - int halfIndex; - uint32_t cleanupFlags; - int local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint8_t *curAnimData; - uint32_t *flagsHigh; - Game *game; - uint64_t halfFlags; - Manager *manager; - int *umbilicalCord; - - manager = g_manager; - local_8 = 0xffffffff; - puStack_c = &LAB_00afad00; - local_10 = ExceptionList; - uVar5 = __security_cookie ^ GHIDRA_UINT((umbilicalCords + 0x3c)); - eraseHalfParent = GHIDRA_CAST(0x0); - cleanupFlags = 0; - if ((this->_dead != 0) || (this->_exists == 0)) { - return 0; - } - ExceptionList = &local_10; - local_20 = damage; - if (isPlaySound != 0) { - local_14 = 0x4d; - seed_fart_sound_override(&local_14); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_14,1.0,2,0,1.0,0.0); - } - iVar6 = this->_type; - if ((((((iVar6 == 0xdf) || (iVar6 == 0xdc)) || (iVar6 == 0x39)) || - ((iVar6 == 0x50 || (iVar6 == 0x5e)))) || - ((((iVar6 == 0x47 || ((iVar6 == 0x48 || (iVar6 == 0x49)))) || (iVar6 == 0x4a)) || - (((iVar6 == 0x4b || (iVar6 == 0x4c)) || (iVar6 == 0x33)))))) || - (this->_championColorIdx == 0xf)) { - bVar7 = true; - } - else { - bVar7 = false; - } - if (iVar6 == 0x2d) { - if (this->_variant != 10) goto LAB_006d98e5; -LAB_006d9a09: - isUnsplittable = false; - } - else { - if (((((iVar6 != 0x4e) && (iVar6 != 0x54)) && - ((iVar6 != 0x112 && ((iVar6 != 0x113 && (iVar6 != 0x66)))))) && (iVar6 != 0x111)) && - ((iVar6 != 0x10a && (iVar6 != 0x65)))) { - if (iVar6 == 0x387) { - if (this->_variant != 0) { - isUnsplittable = this->_variant == 1; - goto LAB_006d9a03; - } - } - else if ((((iVar6 != 0x3e) && (iVar6 != 0x38f)) && (iVar6 != 0x390)) && - (((iVar6 != 0x197 && (iVar6 != 0x196)) && (iVar6 != 0x3b6)))) { - isUnsplittable = iVar6 == 0x3b7; -LAB_006d9a03: - if (!isUnsplittable) goto LAB_006d9a09; - } - } -LAB_006d98e5: - isUnsplittable = true; - } - fVar9 = 0.5; - fVar8 = local_20; - if ((0.5 < this->_scale || this->_scale == 0.5) && (!isUnsplittable)) { - if ((iVar6 == 0x51) && ((this->_variant == 0 && (this->_spawnerType != 0x51)))) { - fVar8 = this->_maxHitPoints * 0.4; - if (this->_health <= fVar8) { - fVar8 = this->_health; - } - this->_health = fVar8; - goto LAB_006d9a4d; - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::is_same_segmented_body(GHIDRA_CAST(0x0)); - if (bVar3 == 0) { - if (iVar6 == 0x387) { - iVar1 = this->_variant; -joined_r0x006d9a82: - if (iVar1 == 10) goto LAB_006d9a2b; - } - else if (iVar6 == 0x38d) { - iVar1 = this->_variant; - goto joined_r0x006d9a82; - } - if (!bVar7) { - if ((iVar6 == 0x41) && (this->_variant == 1)) { - cVar4 = this->IsBoss(); - if (cVar4 == '\0') { - killSourceRef = ::(GHIDRA_CAST((&dieSourceRef)))->EntityRef::EntityRef(); - this->Kill(killSourceRef); - goto LAB_006d9a4d; - } - fVar9 = 0.5; - } - iVar6 = 0x14; - local_20 = (float)this->_initSeed; - rngShifts = 0x500000003; - local_14 = 0x14; - rngShiftC = 0x14; - halves[0] = 0; - halves[1] = 0; - halfIndex = 0; - do { - iVar1 = this->_type; - local_28 = GHIDRA_CAST((this->_size * fVar9)); - spawnPos.y = 0.0; - spawnPos.x = 0.0; - if (iVar1 == 0x104) { - if (this->_variant != 0) goto LAB_006d9b71; -LAB_006d9b3e: - if (halfIndex == 0) { - sideSign = &DAT_bf800000; - } - else { - sideSign = GHIDRA_CAST(0x3f800000); - } - spawnPos.y = (float)local_28 * 0.0; - spawnPos.x = (float)local_28 * (float)sideSign; - } - else { - if ((((iVar1 == 0x24) || (iVar1 == 0x106)) || (iVar1 == 0x107)) || - ((iVar1 == 0x45 && (this->_variant == 0)))) goto LAB_006d9b3e; -LAB_006d9b71: - if (local_20 == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar5 = GHIDRA_UINT(local_20) >> ((uint8_t)rngShifts & 0x1f) ^ GHIDRA_UINT(local_20); - rngShifts2 = 0x100000003; - uVar5 = uVar5 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar5; - local_20 = (float)(uVar5 >> ((uint8_t)iVar6 & 0x1f) ^ uVar5); - if (local_20 == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar5 = GHIDRA_UINT(local_20) >> 3 ^ GHIDRA_UINT(local_20); - uVar5 = uVar5 << 1 ^ uVar5; - uVar5 = uVar5 >> 0xe ^ uVar5; - fVar8 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283062e-10 * 3.14; - source = GHIDRA_CAST((fVar8 + fVar8)); - local_24 = GHIDRA_CAST(sin((float)source)); - spawnPos.x = cos((float)source); - spawnPos.x = spawnPos.x * (float)local_28; - spawnPos.y = (float)local_24 * (float)local_28; - } - spawnPos.y = spawnPos.y + (this->_pos).y; - spawnPos.x = spawnPos.x + (this->_pos).x; - source = GHIDRA_CAST(this->_type); - uVar5 = this->_variant; - if (source == GHIDRA_CAST(0x45)) { - if (uVar5 == 0) { - uVar5 = 1; - } - } - else if (source == GHIDRA_CAST(0x398)) { - uVar5 = 0; - source = GHIDRA_CAST(0x38a); - if (halfIndex != 0) { - source = GHIDRA_CAST(0x45); - } - } - if (local_20 == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - rngState = GHIDRA_UINT(local_20) >> ((uint8_t)rngShifts & 0x1f) ^ GHIDRA_UINT(local_20); - rngState = rngState << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ rngState; - local_20 = (float)(rngState >> ((uint8_t)local_14 & 0x1f) ^ rngState); - half = (Entity_NPC *) - Game::Spawn(g_game,GHIDRA_UINT(source),uVar5,&spawnPos,&g_vectorZero,GHIDRA_CAST(this), - this->_subtype,GHIDRA_UINT(local_20)); - if (this->_isChampion != 0) { - Morph(half,GHIDRA_INT(source),uVar5,this->_subtype,this->_championColorIdx); - } - half->_scoreMultiplier = this->_scoreMultiplier * 0.5; - if (half->_type == 0x322) { - parentLinkSlot = &half->_parent; - local_24 = GHIDRA_CAST(this->_parent); - if (half->_parent != 0) { - source = GHIDRA_CAST(parentLinkSlot); - msvc::multiset::erase(&source); - } - *parentLinkSlot = local_24; - if (local_24 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(parentLinkSlot); - } - if ((halfIndex == 0) && (iVar6 = this->_parent, *GHIDRA_CAST((iVar6 + 0x28)) == 3)) { - parentLinkSlot = GHIDRA_CAST((iVar6 + 0xdc0)); - if (*GHIDRA_CAST((iVar6 + 0xdc0)) != 0) { - local_24 = parentLinkSlot; - msvc::multiset::erase(&local_24); - } - *parentLinkSlot = half; - msvc::multiset::insert(parentLinkSlot); - } - EntityList::AddPersistentEntity - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(half)); - } - if (this->_type == 0x45) { - if (this->_variant != 0) goto LAB_006d9ded; - (half->_sprite)._flipX = halfIndex != 0; - } - else if (this->_type != 0x398) { -LAB_006d9ded: - fVar9 = this->_scale * 0.66; - half->_scale = fVar9; - fVar9 = fVar9 * half->_shrinkStatus1; - fVar8 = fVar9 * g_vectorOne.x; - (half->_sprite)._scale.y = fVar9 * g_vectorOne.y; - (half->_sprite)._scale.x = fVar8; - half->_scaleMulti = this->_scaleMulti * 0.66; - } - if (half->_type == 0x38a) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(hornfelDoors), - 0x3c7,-1,-1,0,0); - cleanupFlags = cleanupFlags | 3; - if (iStack_9c != 0) goto LAB_006d9e96; - source = GHIDRA_CAST(CONCAT13(1,(*GHIDRA_CAST((GHIDRA_CAST(&(source)) + 0x0))))); - } - else { -LAB_006d9e96: - source = GHIDRA_CAST((GHIDRA_UINT(source) & 0xffffff)); - } - if (((cleanupFlags & 1) != 0) && - (cleanupFlags = cleanupFlags & 0xfffffffe, hornfelDoors[0] == '\0')) { - local_8 = 0; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)hornfelDoors)) + 0x4))),0); - local_8 = 0xffffffff; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(source)) + 0x3))) != '\0') { - if (GHIDRA_CAST(half->_minecart) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(half->_minecart) + 0x28))(); - } - half->_state = 0xd; - curAnimData = (half->_sprite)._animState._animData; - if (curAnimData == GHIDRA_CAST(0x0)) { -LAB_006d9f46: - bVar3 = ANM2::SetAnimation(&half->_sprite,&DAT_00b1cdf8,1); - if (bVar3 != 0) { - AnimationState::Rewind(&(half->_sprite)._animState); - (half->_sprite)._animState._isPlaying = 1; - } - } - else { - animNameCh = curAnimData; - if (0xf < *GHIDRA_CAST((curAnimData + 0x14))) { - animNameCh = *GHIDRA_CAST(curAnimData); - } - expectedNameCh = &DAT_00b1cdf8; - do { - bVar3 = *animNameCh; - bVar7 = bVar3 < *expectedNameCh; - if (bVar3 != *expectedNameCh) { -LAB_006d9f28: - uVar5 = -GHIDRA_UINT(bVar7) | 1; - goto LAB_006d9f2d; - } - if (bVar3 == 0) break; - bVar3 = animNameCh[1]; - bVar7 = bVar3 < expectedNameCh[1]; - if (bVar3 != expectedNameCh[1]) goto LAB_006d9f28; - animNameCh = animNameCh + 2; - expectedNameCh = expectedNameCh + 2; - } while (bVar3 != 0); - uVar5 = 0; -LAB_006d9f2d: - if ((uVar5 != 0) || - ((curAnimData[0x34] != 0 && ((half->_sprite)._animState._isPlaying == 0)))) - goto LAB_006d9f46; - } - half->_entityGridCollisionClass = 5; - } - half->_maxHitPoints = this->_maxHitPoints * 0.4; - half->_health = this->_health * 0.4; - half->_hitPointsMulti = this->_hitPointsMulti * 0.4; - game = g_game; - iVar6 = this->_type; - if (iVar6 == 0x104) { - if (this->_variant == 0) { - half->_state = 3; - half->_entityCollisionClass = 4; - (half->_targetPosition).x = 0.3; - (half->_targetPosition).y = 0.0; - } - else { - if (this->_variant != 10) goto LAB_006da2c0; - source = GHIDRA_CAST(this->_parent); - if (source != GHIDRA_CAST(0x0)) { - parentLinkSlot = &half->_parent; - if (half->_parent != 0) { - local_28 = parentLinkSlot; - msvc::multiset::erase(&local_28); - } - *parentLinkSlot = source; - msvc::multiset::insert(parentLinkSlot); - if (halfIndex != 0) { - *GHIDRA_CAST((*parentLinkSlot + 0xbc0)) = *GHIDRA_CAST((*parentLinkSlot + 0xbc0)) + 1; - } - half->_spawnFrame = this->_spawnFrame; - half->_state = this->_state; - local_14 = rngShiftC; - } - } - goto LAB_006da4a7; - } - if (iVar6 == 0x44) { - half->_i1 = this->_i1; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(&half->_sprite))))->Sprite::ReplaceSpritesheet(0,&layer->_spriteSheetPath); - ANM2::LoadGraphics(&half->_sprite,unk); - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(peeps),0x44,-1,-1 - ,0,0); - cleanupFlags = cleanupFlags | 4; - local_8 = 1; - source = GHIDRA_CAST(0x0); - if (pEStack_5c != GHIDRA_CAST(0x0)) { - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)peeps)) + 0x4))); - do { - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(listData) + GHIDRA_INT(source) * 4)); - if (9 < *GHIDRA_CAST((iVar6 + 0x2c))) { - parentLinkSlot = GHIDRA_CAST((iVar6 + 0x3bc)); - if (*GHIDRA_CAST((iVar6 + 0x3bc)) == this) { - if (*GHIDRA_CAST((iVar6 + 0x3bc)) != GHIDRA_CAST(0x0)) { - erasePeepParent = parentLinkSlot; - msvc::multiset::erase(&erasePeepParent); - } - *parentLinkSlot = half; - msvc::multiset::insert(parentLinkSlot); - } - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)peeps)) + 0x4))); - } - source = GHIDRA_CAST((GHIDRA_INT(&source->_type) + 1)); - } while (source < pEStack_5c); - } - local_8 = 0xffffffff; - if (peeps[0] != '\0') goto LAB_006da4a7; - local_8 = 2; - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)peeps)) + 0x4))); -LAB_006da145: - tracked_alloc(1,listData,0); - local_8 = 0xffffffff; - } - else if (iVar6 == 0x4f) { - if (((this->_variant == 0) || (this->_variant == 2)) || (this->_variant == 1)) { - half->_state = 4; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST(umbilicalCords), - 0x4f,0x14,-1,0,0); - cleanupFlags = cleanupFlags | 8; - killSourceRef = GHIDRA_CAST(0x0); - local_8 = 3; - if (pEStack_34 != GHIDRA_CAST(0x0)) { - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)umbilicalCords)) + 0x4))); - do { - umbilicalCord = *GHIDRA_CAST((GHIDRA_CAST(listData) + GHIDRA_INT(killSourceRef) * 4)); - if (GHIDRA_CAST(umbilicalCord[0xef]) == this) { - (**(code **)(*umbilicalCord + 0x28))(); - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)umbilicalCords)) + 0x4))); - } - killSourceRef = GHIDRA_CAST((GHIDRA_INT(&killSourceRef->_type) + 1)); - } while (killSourceRef < pEStack_34); - } - if ((this->_type == 0x4f) && (this->_variant == 2)) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(geminiBabies) - ,0x4f,0xc,-1,0,0); - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)geminiBabies)) + 0x4))); - cleanupFlags = cleanupFlags | 0x10; - iStack_38 = iStack_80; - umbilicalCords[0] = '\x01'; - (*GHIDRA_CAST((GHIDRA_CAST(&(umbilicalCords)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(geminiBabies)) + 0x4))); - pEStack_34 = pEStack_7c; - if (geminiBabies[0] == '\0') { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 4; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)geminiBabies)) + 0x4))),0); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); - } - source = GHIDRA_CAST(0x0); - if (pEStack_7c != GHIDRA_CAST(0x0)) { - do { - umbilicalCord = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(listData) + GHIDRA_INT(source) * 4)) + 0x3bc)); - if (GHIDRA_CAST(*umbilicalCord) == this) { - if (GHIDRA_CAST(*umbilicalCord) != GHIDRA_CAST(0x0)) { - eraseBabyParent = umbilicalCord; - msvc::multiset::erase(&eraseBabyParent); - } - *umbilicalCord = GHIDRA_INT(half); - msvc::multiset::insert(umbilicalCord); - } - source = GHIDRA_CAST((GHIDRA_INT(&source->_type) + 1)); - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)umbilicalCords)) + 0x4))); - } while (source < pEStack_7c); - goto LAB_006da29e; - } - } - else { -LAB_006da29e: - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)umbilicalCords)) + 0x4))); - } - local_8 = 0xffffffff; - if (umbilicalCords[0] == '\0') { - local_8 = 5; - goto LAB_006da145; - } - } - } - else { -LAB_006da2c0: - if (iVar6 == 0x61) { - half->_state = 9; - } - else if (iVar6 == 0x41) { - if (this->_variant == 1) { - half->_spawnerType = 0; - half->_spawnerVariant = 0; - } - } - else if (iVar6 == 0x40) { - if (this->_i1 != 0) { - half->_i1 = 1; - layer = ANM2::GetLayer(&half->_sprite,GHIDRA_CAST(0x1)); - layer->_visible = 0; - } - } - else if (iVar6 == 0x3f) { - if (this->_state == 9) { - half->_state = 9; - } - } - else if (iVar6 == 900) { - half->_state = this->_state; - half->_entityGridCollisionClass = 3; - (half->_sprite)._overlayRenderFirst = 1; - } - else if (iVar6 == 0x2d) { - if (halfIndex == 0) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(momParts), - 0x2d,-1,-1,0,0); - local_8 = 6; - source = GHIDRA_CAST(0x0); - if (pEStack_8c != GHIDRA_CAST(0x0)) { - do { - momPart = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(momParts)) + 0x4))) + GHIDRA_INT(source) * 4)); - if ((momPart == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (momPart->_type != 1)) && - (0x3dd < momPart->_type - 10U)))) { - momPart = GHIDRA_CAST(0x0); - } - if (momPart != this) { - parentLinkSlot = &momPart->_parent; - if (GHIDRA_CAST(momPart->_parent) == this) { - momPart->_health = momPart->_maxHitPoints; - if (GHIDRA_CAST(momPart->_parent) != GHIDRA_CAST(0x0)) { - eraseMomPartParent = parentLinkSlot; - msvc::multiset::erase(&eraseMomPartParent); - } - *parentLinkSlot = half; - msvc::multiset::insert(parentLinkSlot); - } - } - source = GHIDRA_CAST((GHIDRA_INT(&source->_type) + 1)); - } while (source < pEStack_8c); - } - local_8 = 0xffffffff; - if (momParts[0] == '\0') { - local_8 = 7; - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)momParts)) + 0x4))); - goto LAB_006da145; - } - } - else { - parentLinkSlot = &half->_parent; - if (half->_parent != 0) { - eraseHalfParent = parentLinkSlot; - msvc::multiset::erase(&eraseHalfParent); - } - *parentLinkSlot = halves[0]; - if (halves[0] != 0) { - msvc::multiset::insert(parentLinkSlot); - } - } - } - } -LAB_006da4a7: - iVar6 = local_14; - halves[halfIndex] = GHIDRA_INT(half); - half->_spawnGridIndex = this->_spawnGridIndex; - if ((this->_flags & 0x8000000000) != 0) { - halfFlags = half->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&half->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x80; - *GHIDRA_CAST(&half->_flags) = GHIDRA_INT(halfFlags); - } - halfIndex = halfIndex + 1; - if (1 < halfIndex) goto LAB_006da4fe; - fVar9 = 0.5; - } while( true ); - } - killSourceRef = ::(GHIDRA_CAST((&dieSourceRef2)))->EntityRef::EntityRef(); - this->Kill(killSourceRef); - goto LAB_006d9a4d; - } -LAB_006d9a2b: - fVar8 = this->_health + this->_health; - } - this->TakeDamage(fVar8,0,0,source,0x1e,uVar5); -LAB_006d9a4d: - if (isPlaySound != 0) { - Game::ShakeScreen(g_game,0xf); - } - ExceptionList = local_10; - return 1; -LAB_006da4fe: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); - this->Remove(); - goto LAB_006d9a4d; -} - -// 006da530 -void Entity_NPC::UpdatePickupGhosts() -{ - uint32_t uVar1; - Entity_Player *guppysEyeOwner; - Entity_Effect *lootPreview; - void *lootProxy; - void *shopkeeperLoot [4]; - int shopkeeperLootCount; - void *fireplaceLoot [4]; - int fireplaceLootCount; - void **local_14; - void *local_10; - uint8_t *puStack_c; - void *local_8; - void **ghostEntitySlot; - bool isGhostShown; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00afad35; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_UINT((fireplaceLoot + 9)); - ExceptionList = &local_10; - isGhostShown = false; - guppysEyeOwner = - PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x299,GHIDRA_CAST(&g_game->_playerManager),1); - if (guppysEyeOwner != GHIDRA_CAST(0x0)) { - if (this->_type == 0x21) { - if (this->_health <= 1.0) goto LAB_006da6c5; - fireplace_get_loot(this,fireplaceLoot,0); - local_8 = (void *)0x0; - if (fireplaceLootCount != 0) { - ghostEntitySlot = &this->_pickupGhostsEntity; - lootPreview = Entity_Effect::CreateLootPreview - (fireplaceLoot,&this->_pos,GHIDRA_CAST(this),this->_pickupGhostsEntity) - ; - if (*ghostEntitySlot != lootPreview) { - if (*ghostEntitySlot != GHIDRA_CAST(0x0)) { - local_14 = ghostEntitySlot; - msvc::multiset::erase(&local_14); - } - *ghostEntitySlot = lootPreview; - if (lootPreview != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(ghostEntitySlot); - } - } - isGhostShown = true; - } - local_8 = (void *)0xffffffff; - msvc::deque::clear(uVar1); - lootProxy = fireplaceLoot[0]; - fireplaceLoot[0] = (void *)0x0; - } - else { - if ((this->_type != 0x11) || (this->_dead != 0)) goto LAB_006da6c5; - shopkeeper_get_loot(this,shopkeeperLoot,0); - local_8 = (void *)0x1; - if (shopkeeperLootCount != 0) { - ghostEntitySlot = &this->_pickupGhostsEntity; - lootPreview = Entity_Effect::CreateLootPreview - (shopkeeperLoot,&this->_pos,GHIDRA_CAST(this),this->_pickupGhostsEntity - ); - if (*ghostEntitySlot != lootPreview) { - if (*ghostEntitySlot != GHIDRA_CAST(0x0)) { - local_14 = ghostEntitySlot; - msvc::multiset::erase(&local_14); - } - *ghostEntitySlot = lootPreview; - if (lootPreview != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(ghostEntitySlot); - } - } - isGhostShown = true; - } - local_8 = (void *)0xffffffff; - msvc::deque::clear(uVar1); - lootProxy = shopkeeperLoot[0]; - shopkeeperLoot[0] = (void *)0x0; - } - operator_delete(lootProxy,8); - if (isGhostShown) { - ExceptionList = local_10; - return; - } - } -LAB_006da6c5: - if (this->_pickupGhostsEntity != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_pickupGhostsEntity) + 0x28))(); - } - ExceptionList = local_10; - return; -} - -// 007e92b0 -int Entity_NPC::GetBossColorIdx() -{ - return this->_bosscoloridx; -} - -// 0096ce90 -void Entity_NPC::SetAimAngle(float angle) -{ - float prevAngle; - - prevAngle = (this->_pathfinder)._movementTarget.y; - (this->_pathfinder)._movementTarget.x = angle; - (this->_pathfinder)._movementTarget.y = angle; - (this->_pathfinder)._moveDirection.x = prevAngle; - (this->_sprite)._rotation = angle - 90.0; - return; -} - -// 009a8b90 -void Entity_NPC::render_debug(float *param_1, int param_2) -{ - int stageNum; - uint32_t extraout_EAX; - uint32_t extraout_EAX_00; - int in_ECX; - KColor *color; - KColor *color_00; - KColor *color_01; - float fVar1; - double dVar2; - float fVar3; - float fVar4; - uint8_t auStack_ee [2]; - uint8_t local_ec [8]; - uint32_t local_e4; - Vector local_e0; - uint8_t *local_d8; - int local_d4; - float local_d0; - float local_cc; - uint8_t *local_c8; - uint8_t local_c4 [16]; - uint8_t local_b4; - uint8_t local_b0 [8]; - float hpStageRatio; - float maxHitPoints; - KColor local_a0; - uint8_t auStack_84 [12]; - uint8_t local_78 [116]; - code *renderQuadFn; - - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - if (((uint8_t)g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - local_d8 = *GHIDRA_CAST((param_2 + 0x380)); - maxHitPoints = *GHIDRA_CAST((param_2 + 900)); - if ((g_game->_stageType == 4) || (g_game->_stageType == 5)) { - stageNum = g_game->_stage + 1; - } - else { - stageNum = g_game->_stage; - } - hpStageRatio = maxHitPoints / ((float)stageNum + (float)stageNum + 6.0); - dVar2 = (double)hpStageRatio; - libm_sse2_log10_precise(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x0))) = ((float)dVar2 + 1.0) * 24.0 + 0.5; - dVar2 = floor((*GHIDRA_CAST((GHIDRA_CAST(&((double)(float)local_ec)) + 0x0)))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x0))) = (BADTYPE)dVar2; - fVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_ec)) + 0x0))); - if ((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_ec)) + 0x0))) <= 8.0) { - fVar3 = 8.0; - } - if (48.0 <= fVar3) { - fVar3 = 48.0; - } - renderQuadFn = *(code **)(**GHIDRA_CAST((in_ECX + 0x5488)) + 0x14); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_b0)) + 0x4))) = fVar3; - (GHIDRA_CAST((&local_a0)))->KColor::SetFromARGB(0xffffffff); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x0))) = -fVar3 * 0.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x4))) = 4.0; - local_e4 = 0x41000000; - local_e0.x = ((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_ec)) + 0x0))) - 4.0) + *param_1; - local_e0.y = param_1[1] - 4.0; - render_quad_set_rect(local_78,&local_e0,GHIDRA_CAST((local_ec + 4)),color); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c4)) + 0x0))) = 0.0; - local_c8 = GHIDRA_CAST(0x0); - local_d4 = 0; - local_d0 = 0.0; - local_cc = 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c4)) + 0x4))) = 8.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c4)) + 0x8))) = 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c4)) + 0xc))) = 8.0; - local_b4 = 1; - (*renderQuadFn)(); - renderQuadFn = *(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_c4)) + 0x8))) + 0x5488)) + 0x14); - (GHIDRA_CAST((GHIDRA_CAST((local_b0 + 4)))))->KColor::SetFromARGB(0xffffffff); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x0))) = 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x4))) = 8.0; - render_quad_set_rect(auStack_84,GHIDRA_CAST((auStack_ee + -6)),GHIDRA_CAST(local_ec),color_00); - local_d0 = 28.0; - local_d4 = 0; - local_e0.x = 28.0; - local_e0.y = 0.0; - local_d8 = &DAT_42000000; - local_cc = 8.0; - local_c8 = &DAT_42000000; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c4)) + 0x0))) = 8.0; - local_c4[4] = 1; - (*renderQuadFn)(&local_e0); - renderQuadFn = *(code **)(**GHIDRA_CAST((local_c8 + 0x5488)) + 0x14); - (GHIDRA_CAST((GHIDRA_CAST((local_c4 + 0xc)))))->KColor::SetFromARGB(0xffffffff); - fVar3 = param_1[1] - 4.0; - render_quad_set_rect - (&local_a0._unk,GHIDRA_CAST((auStack_ee + -0x12)),GHIDRA_CAST((auStack_ee + -10)),color_01); - local_e0.y = 4.0; - local_e0.x = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x0))) = 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x4))) = 0.0; - local_e4 = 0x41e00000; - local_d8 = GHIDRA_CAST(0x41000000); - local_d4 = 0x41e00000; - local_d0 = 8.0; - local_cc = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_cc)) + 0x1))),1); - (*renderQuadFn)(local_ec,extraout_EAX,g_drawRectUnset); - fVar3 = fVar3 / (float)local_c8; - fVar4 = (local_cc - 1.0) / 5.0; - if (fVar4 <= 0.0) { - fVar4 = 0.0; - } - if (1.0 <= fVar4) { - fVar4 = 1.0; - } - fVar1 = (fVar3 - 0.2) / 0.8; - if (fVar1 <= 0.0) { - fVar1 = 0.0; - } - if (1.0 <= fVar1) { - fVar1 = 1.0; - } - fVar1 = ((fVar4 * 80.0 + 120.0) - 0.0) * fVar1 + 0.0; - fVar4 = (ABS(fVar1 - 120.0) - 0.0) / 120.0; - if (fVar4 <= 0.0) { - fVar4 = 0.0; - } - if (1.0 <= fVar4) { - fVar4 = 1.0; - } - hsv_to_rgb(GHIDRA_CAST(local_b0),fVar1,0.9 - fVar4 * 0.099999964,1.0,1.0); - renderQuadFn = *(code **)(**GHIDRA_CAST((local_d4 + 0x5488)) + 0x14); - (GHIDRA_CAST((GHIDRA_CAST(local_c4))))->KColor::SetFromARGB(0xffffffff); - local_cc = fVar3 * local_d0; - ceil((double)local_cc); - render_quad_set_rect - (&local_a0._green,GHIDRA_CAST((auStack_ee + -0x1e)),GHIDRA_CAST((auStack_ee + -0x16)), - GHIDRA_CAST(local_c4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x4))) = 4.0; - local_e0.x = fVar3 * 24.0 + 4.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x0))) = 8.0; - local_e4 = 0x41800000; - local_e0.y = 16.0; - local_d8 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_d8)) + 0x1))),1)); - (*renderQuadFn)(auStack_ee + -10,extraout_EAX_00,local_b0); - return; -} diff --git a/generated-src/entity_partition.cpp b/generated-src/entity_partition.cpp deleted file mode 100644 index b280fa8..0000000 --- a/generated-src/entity_partition.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "classes.h" - -// 0041c490 -void EntityPartition::query_box(EntityList_EL *outList, Vector *position, Vector *extent) -{ - float *pfVar1; - int iVar2; - float *pfVar3; - void *isSeen; - int resultSize; - uint64_t *allocatedBytes; - int iVar4; - int iVar5; - int iVar6; - uint32_t uVar7; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - float cellSize; - int column; - int entityIndex; - float extentX; - uint64_t oldAllocated; - float posXCopy; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af1690; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (*GHIDRA_CAST((*GHIDRA_CAST(this) + 0xd4)) != 0) { - isSeen = operator_new_tracked(*GHIDRA_CAST((*GHIDRA_CAST(this) + 0xd4))); - memset(isSeen,0,*GHIDRA_CAST((*GHIDRA_CAST(this) + 0xd4))); - extentX = extent->x; - pfVar3 = &position->x; - pfVar1 = &position->y; - cellSize = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); - posXCopy = position->x; - position = GHIDRA_CAST(GHIDRA_INT(((position->y - extent->y) / cellSize))); - iVar5 = GHIDRA_INT(((extent->y + *pfVar1) / cellSize)); - iVar6 = GHIDRA_INT(((*pfVar3 - extentX) / cellSize)); - if (GHIDRA_INT(position) <= iVar5) { - column = iVar6; - do { - for (; column <= GHIDRA_INT(((extentX + posXCopy) / cellSize)); column = column + 1) { - iVar4 = column + *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) * GHIDRA_INT(position); - if ((-1 < iVar4) && - (iVar4 < (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x18))) / 0xa4)) { - uVar7 = 0; - iVar4 = iVar4 * 0xa4 + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x18)); - if (*GHIDRA_CAST((iVar4 + 0xa0)) != 0) { - do { - iVar2 = *GHIDRA_CAST((iVar4 + uVar7 * 4)); - entityIndex = *GHIDRA_CAST((iVar2 + 0x24)); - if (*GHIDRA_CAST((entityIndex + GHIDRA_INT(isSeen))) == '\0') { - resultSize = outList->_size; - if (GHIDRA_UINT(outList->_capacity) < resultSize + 1U) { - KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); - resultSize = outList->_size; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((outList)) + 0x4)))) + resultSize * 4)) = iVar2; - outList->_size = outList->_size + 1; - *GHIDRA_CAST((entityIndex + GHIDRA_INT(isSeen))) = 1; - } - uVar7 = uVar7 + 1; - } while (uVar7 < *GHIDRA_CAST((iVar4 + 0xa0))); - } - } - } - position = GHIDRA_CAST((GHIDRA_INT(&position->x) + 1)); - column = iVar6; - } while (GHIDRA_INT(position) <= iVar5); - } - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (isSeen != (void *)0x0) { - uVar7 = *GHIDRA_CAST((GHIDRA_CAST(isSeen) + -4)); - oldAllocated = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar7; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar7)); - free((void *)(GHIDRA_INT(isSeen) + -4)); - } - } - ExceptionList = local_10; - return; -} diff --git a/generated-src/entity_pickup.cpp b/generated-src/entity_pickup.cpp deleted file mode 100644 index ab1bbeb..0000000 --- a/generated-src/entity_pickup.cpp +++ /dev/null @@ -1,5534 +0,0 @@ -#include "classes.h" - -// 00431740 -int Entity_Pickup::Price() -{ - return this->_price; -} - -// 005832c0 -void Entity_Pickup::GetLootList(Vector *renderOffset) -{ - void *pvVar1; - char cVar2; - Entity_Pickup *segment; - uint32_t pointCountRemainder; - int iVar3; - LayerState *layer; - uint8_t *shader; - int *piVar4; - void *pvVar5; - uint8_t lowerChar; - float *pointCursor; - uint32_t uVar6; - ANM2 *sprite; - float *pointCursor; - char *shaderNameCursor; - bool isPointCountMultipleOf4; - float fVar8; - double dVar9; - uint8_t auStackY_220 [128]; - Vector *image; - int *imageRefCount; - float quad; - float quadY0; - float quadX1; - float quadY1; - float quadX2; - float quadY2; - float quadX3; - float quadY3; - Vector cornerC; - Vector cornerB; - Vector cornerA; - float local_f0; - KColor local_dc; - void *uvQuads; - float *uvQuadsEnd; - float *uvQuadsCap; - void *posQuads; - void *posQuadsEnd; - void *posQuadsCap; - float local_b0; - float *uvQuadsCapCache; - void *posQuadsCapCache; - Vector *local_a4; - float halfWidth; - float local_9c; - void *points; - float *pointsEnd; - float *pointsCap; - float local_8c; - Entity_Pickup *pickup; - float *layerFrame; - float local_80; - Vector *texture; - int *local_78; - float local_74; - float *pointsCapCache; - void *local_6c; - float local_68; - void *local_64; - float pixelScale; - Entity_Pickup *local_5c; - void *local_58; - float local_54; - ColorMod spriteColor; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - float local_14; - uint8_t shaderNameChar; - - puStack_20 = GHIDRA_CAST((&spriteColor)[1]._offset); - puStack_18 = &LAB_00af53de; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT(((&spriteColor)[1]._colorize + 1)); - ExceptionList = &local_1c; - pointCursor = GHIDRA_CAST(0x0); - local_a4 = renderOffset; - local_64 = (void *)0x0; - points = (void *)0x0; - pointsEnd = GHIDRA_CAST(0x0); - pointsCapCache = GHIDRA_CAST(0x0); - pointsCap = GHIDRA_CAST(0x0); - uvQuads = (void *)0x0; - uvQuadsEnd = GHIDRA_CAST(0x0); - uvQuadsCapCache = GHIDRA_CAST(0x0); - uvQuadsCap = GHIDRA_CAST(0x0); - posQuads = (void *)0x0; - posQuadsEnd = (void *)0x0; - posQuadsCapCache = (void *)0x0; - posQuadsCap = (void *)0x0; - local_14 = 2.8026e-45; - spriteColor._tint[0] = (this->_sprite)._color._tint[0]; - spriteColor._tint[1] = (this->_sprite)._color._tint[1]; - spriteColor._tint[2] = (this->_sprite)._color._tint[2]; - spriteColor._tint[3] = (this->_sprite)._color._tint[3]; - spriteColor._offset[2] = (this->_sprite)._color._offset[2]; - spriteColor._colorize[0] = (this->_sprite)._color._colorize[0]; - spriteColor._colorize[1] = (this->_sprite)._color._colorize[1]; - spriteColor._colorize[2] = (this->_sprite)._color._colorize[2]; - spriteColor._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(spriteColor._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - local_5c = this; - while (((segment = GHIDRA_CAST(local_5c->_child), segment != GHIDRA_CAST(0x0) && - (segment->_type == 0x38d)) && (segment->_variant == 10))) { - local_5c = segment; - } - local_68 = 0.0; - segment = this; - while (((segment = GHIDRA_CAST(segment->_child), segment != GHIDRA_CAST(0x0) && - (segment->_type == 0x38d)) && (segment->_variant == 10))) { - local_68 = (float)(GHIDRA_INT(local_68) + 1); - } - pickup = this; - pointCursor = (&spriteColor)[1]._offset; - if ((this->_sprite)._animState._animData == (void *)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("AnimationData is NULL\n")); - pointCursor = GHIDRA_CAST(puStack_20); - } - puStack_20 = GHIDRA_CAST(pointCursor); - if (*GHIDRA_CAST((GHIDRA_INT((pickup->_sprite)._animState._animation) + 0x80)) < 1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")); - } - pvVar5 = (pickup->_sprite)._animState._animData; - if ((pvVar5 != (void *)0x0) && - (-1 < *GHIDRA_CAST((GHIDRA_INT((pickup->_sprite)._animState._animation) + 0x80)))) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x38)); - if (iVar3 < 0) { - ExceptionList = local_1c; - return; - } - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1c)) <= iVar3) { - ExceptionList = local_1c; - return; - } - local_58 = (void *)(iVar3 * 0x10 + *GHIDRA_CAST((GHIDRA_INT((pickup->_sprite)._animState._animData) + 0x18))) - ; - iVar3 = *GHIDRA_CAST((GHIDRA_INT((pickup->_sprite)._animState._layerFrames) + iVar3 * 4)); - if (iVar3 < 0) { - ExceptionList = local_1c; - return; - } - if (*GHIDRA_CAST((GHIDRA_CAST(local_58) + 8)) <= iVar3) { - ExceptionList = local_1c; - return; - } - layerFrame = GHIDRA_CAST((iVar3 * 0x6c + *GHIDRA_CAST((GHIDRA_CAST(local_58) + 4)))); - if (layerFrame == GHIDRA_CAST(0x0)) { - ExceptionList = local_1c; - return; - } - halfWidth = layerFrame[2] * 0.5 * (pickup->_sprite)._scale.x; - if ((pickup->_subtype == 0) && - (*GHIDRA_CAST(&local_5c[1]._priceANM2._overlayAnimState._isPlaying) == 6)) { - fVar8 = (layerFrame[3] - 16.0) * (pickup->_sprite)._scale.y; - } - else { - fVar8 = (pickup->_sprite)._scale.y * layerFrame[3]; - } - iVar3 = pickup->_child; - local_8c = (pickup->_posOffset).x + (pickup->_pos).x; - local_5c = GHIDRA_CAST(((pickup->_posOffset).y + (pickup->_pos).y)); - local_6c = (void *)(fVar8 / (float)GHIDRA_INT(local_68)); - if (((iVar3 != 0) && (*GHIDRA_CAST((iVar3 + 0x28)) == 0x38d)) && (*GHIDRA_CAST((iVar3 + 0x2c)) == 10)) { - do { - local_9c = *GHIDRA_CAST((iVar3 + 0x34c)) + *GHIDRA_CAST((iVar3 + 0x33c)); - local_58 = (void *)(*GHIDRA_CAST((iVar3 + 0x350)) + *GHIDRA_CAST((iVar3 + 0x340))); - local_64 = (void *)(local_9c - local_8c); - local_68 = (float)local_58 - (float)local_5c; - fVar8 = sqrtf((float)local_64 * (float)local_64 + local_68 * local_68); - if (0.0 < fVar8) { - local_64 = (void *)((float)local_64 * (1.0 / fVar8)); - local_68 = local_68 * (1.0 / fVar8); - } - local_8c = (local_8c - 60.0) * 0.65; - local_5c = GHIDRA_CAST((((float)local_5c - 140.0) * 0.65)); - local_54 = (g_screenHeight - 182.0) * 0.5 + (float)local_5c; - pixelScale = g_displayPixelRatio * g_screenPointScale; - local_74 = ((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5; - dVar9 = floor((double)local_74); - local_74 = (float)dVar9 / pixelScale; - local_54 = local_54 * pixelScale + 0.5; - dVar9 = floor((double)local_54); - local_54 = (float)dVar9; - local_b0 = -local_68; - fVar8 = layerFrame[6]; - if (pointCursor == pointsCapCache) { - msvc::vector::_Emplace_reallocate(); - pointsCapCache = pointsCap; - } - else { - *pointCursor = local_74 + halfWidth * fVar8 * local_b0; - pointCursor[1] = local_54 / pixelScale + (float)local_64 * halfWidth * fVar8; - pointsEnd = pointCursor + 2; - } - pointCursor = pointsEnd; - local_74 = (g_screenHeight - 182.0) * 0.5 + (float)local_5c; - pixelScale = g_displayPixelRatio * g_screenPointScale; - local_54 = ((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5; - dVar9 = floor((double)local_54); - local_5c = GHIDRA_CAST(((float)dVar9 / pixelScale)); - local_54 = local_74 * pixelScale + 0.5; - dVar9 = floor((double)local_54); - local_54 = (float)dVar9; - local_80 = -(float)local_64; - fVar8 = layerFrame[6]; - if (pointCursor == pointsCapCache) { - msvc::vector::_Emplace_reallocate(); - pointsCapCache = pointsCap; - } - else { - *pointCursor = (float)local_5c + local_68 * halfWidth * fVar8; - pointCursor[1] = local_54 / pixelScale + local_80 * halfWidth * fVar8; - pointsEnd = pointCursor + 2; - } - pointCursor = pointsEnd; - local_8c = (local_9c - 60.0) * 0.65; - local_78 = GHIDRA_CAST((((float)local_58 - 140.0) * 0.65)); - local_74 = (g_screenHeight - 182.0) * 0.5 + (float)local_78; - pixelScale = g_displayPixelRatio * g_screenPointScale; - local_54 = ((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5; - dVar9 = floor((double)local_54); - local_5c = GHIDRA_CAST(((float)dVar9 / pixelScale)); - local_54 = local_74 * pixelScale + 0.5; - dVar9 = floor((double)local_54); - local_54 = (float)dVar9; - cornerC.y = local_54 / pixelScale + (float)local_64 * halfWidth * layerFrame[6]; - cornerC.x = halfWidth * layerFrame[6] * local_b0 + (float)local_5c; - if (pointCursor == pointsCapCache) { - msvc::vector::_Emplace_reallocate(); - pointsCapCache = pointsCap; - } - else { - *pointCursor = cornerC.x; - pointCursor[1] = cornerC.y; - pointsEnd = pointCursor + 2; - } - pointCursor = pointsEnd; - local_b0 = (g_screenHeight - 182.0) * 0.5 + (float)local_78; - pixelScale = g_displayPixelRatio * g_screenPointScale; - local_78 = GHIDRA_CAST((((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5)); - dVar9 = floor((double)(float)local_78); - local_54 = (float)dVar9 / pixelScale; - local_78 = GHIDRA_CAST((local_b0 * pixelScale + 0.5)); - dVar9 = floor((double)(float)local_78); - local_78 = GHIDRA_CAST((float)dVar9); - local_f0 = (float)local_78 / pixelScale + local_80 * halfWidth * layerFrame[6]; - if (pointCursor == pointsCapCache) { - msvc::vector::_Emplace_reallocate(); - pointsCapCache = pointsCap; - } - else { - *pointCursor = local_68 * halfWidth * layerFrame[6] + local_54; - pointCursor[1] = local_f0; - pointsEnd = pointCursor + 2; - } - iVar3 = *GHIDRA_CAST((iVar3 + 0x3c0)); - local_8c = local_9c; - local_5c = local_58; - pointCursor = pointsEnd; - } while (((iVar3 != 0) && (*GHIDRA_CAST((iVar3 + 0x28)) == 0x38d)) && (*GHIDRA_CAST((iVar3 + 0x2c)) == 10) - ); - local_64 = points; - } - pointCursor = GHIDRA_CAST(0x0); - uVar6 = GHIDRA_INT(pointCursor) - GHIDRA_INT(local_64) >> 3; - if (0 < GHIDRA_INT(uVar6)) { - pointCountRemainder = uVar6 & 0x80000003; - isPointCountMultipleOf4 = pointCountRemainder == 0; - if (GHIDRA_INT(pointCountRemainder) < 0) { - isPointCountMultipleOf4 = (pointCountRemainder - 1 | 0xfffffffc) == 0xffffffff; - } - if (isPointCountMultipleOf4) { - local_80 = layerFrame[1]; - pointCursor = GHIDRA_CAST((GHIDRA_INT(local_64) + 0x1c)); - local_58 = (void *)((uVar6 - 1 >> 2) + 1); - do { - local_dc._unk = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_dc._unk)) + 0x1))),1); - if ((pickup->_sprite)._flipX == 0) { - local_dc._red = *layerFrame; - local_dc._blue = local_dc._red + layerFrame[2]; - } - else { - local_dc._blue = *layerFrame; - local_dc._red = local_dc._blue + layerFrame[2]; - } - local_dc._green = local_80 + (float)local_6c; - if (pointCursor == uvQuadsCapCache) { - local_dc._alpha = local_dc._green; - local_80 = local_dc._green; - msvc::vector::_Emplace_reallocate(); - uvQuadsCapCache = uvQuadsCap; - } - else { - pointCursor[1] = 0.0; - *pointCursor = 0.0; - pointCursor[3] = 0.0; - pointCursor[2] = 0.0; - pointCursor[5] = 0.0; - pointCursor[4] = 0.0; - pointCursor[7] = 0.0; - pointCursor[6] = 0.0; - *pointCursor = local_dc._red; - pointCursor[1] = local_80; - pointCursor[2] = local_dc._blue; - pointCursor[3] = local_80; - pointCursor[4] = local_dc._red; - pointCursor[5] = local_dc._green; - pointCursor[6] = local_dc._blue; - pointCursor[7] = local_dc._green; - pointCursor[8] = (float)local_dc._unk; - uvQuadsEnd = pointCursor + 9; - local_80 = local_dc._green; - } - pointCursor = uvQuadsEnd; - local_dc._unk = 0; - local_dc._red = 1.0; - local_dc._green = 1.0; - local_dc._blue = 1.0; - local_dc._alpha = 1.0; - (GHIDRA_CAST((&quad)))->ColorQuad::ColorQuad(&local_dc); - quadX3 = local_a4->x; - quadY3 = local_a4->y; - quad = quadX3 + pointCursor[-7]; - quadY0 = quadY3 + pointCursor[-6]; - quadX1 = quadX3 + pointCursor[-5]; - quadY1 = quadY3 + pointCursor[-4]; - quadX2 = quadX3 + pointCursor[-3]; - quadX3 = quadX3 + pointCursor[-1]; - quadY2 = quadY3 + pointCursor[-2]; - quadY3 = quadY3 + *pointCursor; - if (posQuadsEnd == posQuadsCapCache) { - msvc::vector::_Emplace_reallocate(); - posQuadsCapCache = posQuadsCap; - } - else { - render_quad_copy(posQuadsEnd,&quad); - posQuadsEnd = (void *)(GHIDRA_INT(posQuadsEnd) + 0x70); - } - local_dc._blue = (float)g_graphicsManager_blendMode[2]; - local_dc._red = (float)g_graphicsManager_blendMode[0]; - pointCursor = pointCursor + 8; - local_58 = (void *)(GHIDRA_INT(local_58) + -1); - } while (local_58 != (void *)0x0); - local_80 = (float)g_graphicsManager_blendMode[4]; - iVar3 = 1; - if (((uint8_t)g_graphicsManager_flags & 4) == 0) { - iVar3 = 6; - } - g_graphicsManager_blendMode[0] = 0; - sprite = &pickup->_sprite; - g_graphicsManager_blendMode[2] = 7; - local_dc._green = (float)g_graphicsManager_blendMode[1]; - local_dc._alpha = (float)g_graphicsManager_blendMode[3]; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - g_graphicsManager_blendMode[1] = iVar3; - layer = ANM2::GetLayer(sprite,GHIDRA_CAST(0x0)); - layer->_wrapSMode = 0; - layer = ANM2::GetLayer(sprite,GHIDRA_CAST(0x0)); - layer->_wrapTMode = 0; - layer = ANM2::GetLayer(sprite,GHIDRA_CAST(0x0)); - LayerState::GetTexture(layer,&texture); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),3); - if (texture != GHIDRA_CAST(0x0)) { - shader = &g_shaders; - if ((DAT_00c7911c & 1) == 0) { - shader = g_currentShader; - } - local_f0 = 0.0; - local_9c = (float)((GHIDRA_INT(pointCursor) - GHIDRA_INT(uvQuads)) / 0x24); - g_currentShader = shader; - if (local_9c != 0.0) { - local_58 = uvQuads; - local_6c = posQuads; - do { - piVar4 = local_78; - image = GHIDRA_CAST(0x0); - imageRefCount = GHIDRA_CAST(0x0); - local_a4 = texture; - if (local_78 != GHIDRA_CAST(0x0)) { - cVar2 = (**(code **)(*local_78 + 4))(); - if (cVar2 != '\0') { - if (((imageRefCount != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(*imageRefCount + 0xc))(), cVar2 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(auStackY_220 + 0x84); - } - image = local_a4; - imageRefCount = piVar4; - } - } - apply_sprite_shader_params(&spriteColor,1,image,imageRefCount); - pvVar1 = local_58; - pvVar5 = local_6c; - (**(code **)(GHIDRA_CAST(texture->x) + 0x14))(local_58); - local_6c = (void *)(GHIDRA_INT(pvVar5) + 0x70); - local_58 = (void *)(GHIDRA_INT(pvVar1) + 0x24); - local_9c = (float)(GHIDRA_INT(local_9c) + -1); - } while (local_9c != 0.0); - } - } - fVar8 = 7.54039e-42; - g_graphicsManager_blendMode[0] = GHIDRA_INT(local_dc._red); - shaderNameCursor = "KAGE_ColorTextureShader"; - g_graphicsManager_blendMode[1] = GHIDRA_INT(local_dc._green); - g_graphicsManager_blendMode[2] = GHIDRA_INT(local_dc._blue); - g_graphicsManager_blendMode[3] = GHIDRA_INT(local_dc._alpha); - g_graphicsManager_blendMode[4] = GHIDRA_INT(local_80); - shaderNameChar = 0x4b; - do { - shaderNameCursor = shaderNameCursor + 1; - lowerChar = shaderNameChar + 0x20; - if (0x19 < (uint8_t)(shaderNameChar + 0xbf)) { - lowerChar = shaderNameChar; - } - uVar6 = GHIDRA_UINT(lowerChar); - if (lowerChar == 0x5c) { - uVar6 = 0x2f; - } - fVar8 = (float)(GHIDRA_INT(fVar8) * 0x21 + uVar6); - shaderNameChar = *shaderNameCursor; - } while (shaderNameChar != 0); - local_6c = (void *)fVar8; - _Find_lower_bound<>(); - if (((*GHIDRA_CAST((GHIDRA_CAST(local_f0) + 0xd)) == '\0') && - (GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_f0) + 0x10))) <= GHIDRA_UINT(fVar8))) && (local_f0 != DAT_00c379bc)) - { - piVar4 = GHIDRA_CAST(std)::map::operator_index(); - pvVar5 = (void *)*piVar4; - if ((pvVar5 != (void *)0x0) && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 4)) & 1) != 0)) { - g_currentShader = pvVar5; - } - } - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),4); - if (((local_78 != GHIDRA_CAST(0x0)) && (cVar2 = (**(code **)(*local_78 + 0xc))(), cVar2 != '\0')) - && (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(); - } - if (posQuads != (void *)0x0) { - uVar6 = ((GHIDRA_INT(posQuadsCapCache) - GHIDRA_INT(posQuads)) / 0x70) * 0x70; - pvVar5 = posQuads; - if (0xfff < uVar6) { - pvVar5 = *(void **)(GHIDRA_CAST(posQuads) + -4); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(posQuads) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00584103; - } - operator_delete(pvVar5,uVar6); - } - if (uvQuads != (void *)0x0) { - uVar6 = ((GHIDRA_INT(uvQuadsCapCache) - GHIDRA_INT(uvQuads)) / 0x24) * 0x24; - pvVar5 = uvQuads; - if (0xfff < uVar6) { - pvVar5 = *(void **)(GHIDRA_CAST(uvQuads) + -4); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(uvQuads) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00584103; - } - operator_delete(pvVar5,uVar6); - } - } - } - if (local_64 != (void *)0x0) { - uVar6 = GHIDRA_INT(pointsCapCache) - GHIDRA_INT(local_64) & 0xfffffff8; - pvVar5 = local_64; - if (0xfff < uVar6) { - pvVar5 = *(void **)(GHIDRA_CAST(local_64) + -4); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_64) + (-4 - GHIDRA_INT(pvVar5))))) { -LAB_00584103: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar5,uVar6); - } - } - ExceptionList = local_1c; - return; -} - -// 005b1930 -bool Entity_Pickup::IsShopItem() -{ - return this->_price != 0; -} - -// 005b1940 -int Entity_Pickup::Timeout() -{ - return this->_timeout; -} - -// 005b1980 -int Entity_Pickup::OptionsPickupIndex() -{ - return this->_optionsPickupIndex; -} - -// 005b19b0 -Vector * Entity_Pickup::GetRandomPickupVelocity(Vector *buffer, Vector *position, RNG *rng, uint32_t ePickupVelType) -{ - Isaac::GetRandomPickupVelocity(buffer,position,ePickupVelType,rng); - return buffer; -} - -// 006e0010 -void Entity_Pickup::Constructor() -{ - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afaea1; - local_10 = ExceptionList; - ExceptionList = &local_10; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - local_8 = 0; - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Pickup::vftable; - ANM2::constructor(&this->_priceANM2); - (this->_colorMod)._tint[0] = 1.0; - (this->_colorMod)._tint[1] = 1.0; - (this->_colorMod)._tint[2] = 1.0; - (this->_colorMod)._tint[3] = 1.0; - (this->_colorMod)._colorize[0] = 0.0; - (this->_colorMod)._colorize[1] = 0.0; - (this->_colorMod)._colorize[2] = 0.0; - (this->_colorMod)._colorize[3] = 0.0; - (this->_colorMod)._offset[0] = 0.0; - (this->_colorMod)._offset[1] = 0.0; - (this->_colorMod)._offset[2] = 0.0; - this->_unkEntityRef = 0; - this->_pickupGhost = (void *)0x0; - this->_megaChestCollectible[0] = (void *)0x0; - this->_megaChestCollectible[1] = (void *)0x0; - this->_flipSaveState = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x5cc)))) = 0; - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),6); - ANM2::constructor(&this->_altPedestalANM2); - ExceptionList = local_10; - return; -} - -// 006e1640 -uint8_t Entity_Pickup::TryFlip(Entity_Player *unusedPlayer, uint32_t unusedSeed) -{ - void *state; - void *extraout_EAX; - EntitySaveState *outSaveState; - uint32_t cycleOffset; - EntitySaveState flippedState [2]; - int local_84; - EntitySaveState *stateCopy; - void *local_10; - uint8_t *puStack_c; - int local_8; - int cycleItem; - int *flipState; - uint32_t *flipStateRef; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afaf4f; - local_10 = ExceptionList; - flipStateRef = &this->_flipSaveState; - if ((this->_flipSaveState == 0) || (this->_variant != 100)) { - return 0; - } - ExceptionList = &local_10; - (GHIDRA_CAST((flippedState)))->EntitySaveState::constructor(); - local_8 = 0; - CanFlip(g_game->_room,this,outSaveState,0); - (this->_dropRNG)._seed = *GHIDRA_CAST((*flipStateRef + 0x38)); - (this->_dropRNG)._shift1 = 5; - (this->_dropRNG)._shift2 = 9; - (this->_dropRNG)._shift3 = 7; - flipState = GHIDRA_CAST(*flipStateRef); - this->_initSeed = flipState[0xd]; - Morph(this,*flipState,flipState[1],flipState[2],1,1,1); - this->_isTouched = *GHIDRA_CAST((*flipStateRef + 0x22)); - if (*GHIDRA_CAST((*flipStateRef + 100)) != 0) { - this->_cycleCollectibleCount = 0; - cycleOffset = 0; - do { - cycleItem = *GHIDRA_CAST((cycleOffset + *GHIDRA_CAST((*flipStateRef + 100)))); - if (cycleItem == 0) break; - if (GHIDRA_UINT(this->_cycleCollectibleCount) < 8) { - this->_cycleCollectibleList[this->_cycleCollectibleCount] = cycleItem; - this->_cycleCollectibleCount = this->_cycleCollectibleCount + 1; - } - cycleOffset = cycleOffset + 4; - } while (cycleOffset < 0x20); - } - if (local_84 == 0) { - state = (void *)0x0; - } - else { - stateCopy = operator_new(0x78); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - if (stateCopy == GHIDRA_CAST(0x0)) { - state = (void *)0x0; - } - else { - (GHIDRA_CAST((stateCopy)))->EntitySaveState::copy(flippedState); - state = extraout_EAX; - } - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - } - (GHIDRA_CAST((flipStateRef)))->EntitySaveStateRef::Set(state); - ANM2::Reset(&this->_altPedestalANM2); - invoke_pending_callbacks(flippedState); - ExceptionList = local_10; - return 1; -} - -// 006e17c0 -void Entity_Pickup::UpdateLootPreview() -{ - void *ptr; - uint8_t isChest; - uint32_t uVar1; - Entity_Player *player; - Entity_Effect *preview; - int extraout_ECX; - void *loot [5]; - Vector local_18; - void *local_10; - uint8_t *puStack_c; - void *local_8; - void **ghostRef; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00afaf7d; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_UINT((loot + 10)); - ExceptionList = &local_10; - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x299,GHIDRA_CAST(&g_game->_playerManager),1); - if (player != GHIDRA_CAST(0x0)) { - isChest = IsChest(this->_variant); - if ((((isChest != 0) && (this->_subtype != 0)) || ((extraout_ECX == 0x45 && (this->_dead == 0))) - ) && (this->_timeout < 1)) { - local_18.x = (this->_pos).x; - local_18.y = (this->_pos).y; - player = Game::GetNearestPlayer(g_game,&local_18); - GetChestLoot(this,loot,0,player); - local_8 = (void *)0x0; - ghostRef = &this->_pickupGhost; - preview = Entity_Effect::CreateLootPreview(loot,&this->_pos,GHIDRA_CAST(this),*ghostRef); - if (*ghostRef != preview) { - if (*ghostRef != GHIDRA_CAST(0x0)) { - local_18.y = (float)ghostRef; - msvc::multiset::erase(&local_18.y); - } - *ghostRef = preview; - if (preview != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(ghostRef); - } - } - msvc::deque::clear(); - ptr = loot[0]; - loot[0] = (void *)0x0; - operator_delete(ptr,8); - ExceptionList = local_10; - return; - } - } - if (this->_pickupGhost != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_pickupGhost) + 0x28))(uVar1); - } - ExceptionList = local_10; - return; -} - -// 006e1a80 -void Entity_Pickup::SetAlternatePedestal(int pedestalType) -{ - uint8_t isOverlaySet; - Vector *nullFrameOffset; - LayerState *layer; - EntityConfig_Entity *pickupConfig; - int partnerPedestalType; - uint32_t i; - Vector *pedestalOffset; - void **megaChestSlot; - void **local_18; - uint8_t lowerBoundResult [8]; - void *foundNode; - void *entityConfig; - Manager *manager; - Entity_Pickup *partnerPickup; - - if ((((this->_variant == 100) && (-1 < pedestalType)) && (this->_price == 0)) && - (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 0x10)) { - isOverlaySet = ANM2::SetOverlayAnimation(&this->_sprite,GHIDRA_CAST("Alternates"),1); - if ((isOverlaySet != 0) && ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_sprite)._overlayAnimState,(float)pedestalType); - } - nullFrameOffset = AnimationState::GetNullFrameById(&(this->_sprite)._overlayAnimState,0); - pedestalOffset = &g_vectorZero; - if (nullFrameOffset != GHIDRA_CAST(0x0)) { - pedestalOffset = nullFrameOffset; - } - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - (layer->_pos).x = pedestalOffset->x; - (layer->_pos).y = pedestalOffset->y; - manager = g_manager; - if (pedestalType == 0xb) { - local_18 = (void **)0x518600; - _Find_lower_bound<>(lowerBoundResult,&local_18); - if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) < 0x518601)) && - (foundNode != (manager->_entityConfig)._entities._head)) { - pickupConfig = GHIDRA_CAST((GHIDRA_INT(foundNode) + 0x18)); - } - else { - pickupConfig = EntityConfig::GetEntity(&manager->_entityConfig,5,0,0); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSize(pickupConfig->collisionRadius, - pickupConfig->collisionRadiusMulti,pickupConfig->gridCollisionPoints); - return; - } - if ((pedestalType != 0xe) && (pedestalType != 0x13)) { - entityConfig = this->_config; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSize(*GHIDRA_CAST((GHIDRA_CAST(entityConfig) + 0x38)), - *GHIDRA_CAST((GHIDRA_CAST(entityConfig) + 0x3c)),*GHIDRA_CAST((GHIDRA_CAST(entityConfig) + 0x48))); - return; - } - local_18 = (void **)0x503900; - _Find_lower_bound<>(lowerBoundResult,&local_18); - if (((*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(foundNode) + 0x10)) < 0x503901)) - && (foundNode != (manager->_entityConfig)._entities._head)) { - pickupConfig = GHIDRA_CAST((GHIDRA_INT(foundNode) + 0x18)); - } - else { - pickupConfig = EntityConfig::GetEntity(&manager->_entityConfig,5,0,0); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSize(pickupConfig->collisionRadius,pickupConfig->collisionRadiusMulti, - pickupConfig->gridCollisionPoints); - if ((this->_megaChestCollectible[0] == (void *)0x0) && - (this->_megaChestCollectible[1] == (void *)0x0)) { - i = 0; - local_18 = g_game->_room; - if (local_18[0x499] != (void *)0x0) { - while ((((partnerPickup = *GHIDRA_CAST((GHIDRA_INT(local_18[0x497]) + i * 4)), - partnerPickup == this || (partnerPickup->_type != 5)) || - ((partnerPickup->_variant != 100 || - ((((partnerPedestalType = GetAlternatePedestal(partnerPickup), - partnerPedestalType != 0xe && - (partnerPedestalType = GetAlternatePedestal(partnerPickup), - partnerPedestalType != 0x13)) || ((partnerPickup->_pos).x != (this->_pos).x)) || - (((partnerPickup->_pos).y != (this->_pos).y || - (partnerPickup->_megaChestCollectible[0] != (void *)0x0)))))))) || - (partnerPickup->_megaChestCollectible[1] != (void *)0x0))) { - i = i + 1; - if (local_18[0x499] <= i) { - return; - } - } - megaChestSlot = this->_megaChestCollectible; - if (this->_megaChestCollectible[0] != partnerPickup) { - if (this->_megaChestCollectible[0] != GHIDRA_CAST(0x0)) { - local_18 = megaChestSlot; - msvc::multiset::erase(&local_18); - } - *megaChestSlot = partnerPickup; - msvc::multiset::insert(megaChestSlot); - } - megaChestSlot = partnerPickup->_megaChestCollectible + 1; - if (partnerPickup->_megaChestCollectible[1] != this) { - if (partnerPickup->_megaChestCollectible[1] != GHIDRA_CAST(0x0)) { - local_18 = megaChestSlot; - msvc::multiset::erase(&local_18); - } - *megaChestSlot = this; - msvc::multiset::insert(megaChestSlot); - } - } - } - } - return; -} - -// 006e1d70 -int Entity_Pickup::GetAlternatePedestal() -{ - void *other; - uint8_t isEqual; - uint8_t *****pppppbVar1; - uint8_t *****animNameHeap; - uint32_t capacity; - uint32_t size; - uint8_t *****animName [4]; - uint32_t animNameSize; - uint32_t animNameCapacity; - uint8_t ****local_8; - bool isAlternates; - bool isAnimNameOwned; - - local_8 = GHIDRA_CAST((__security_cookie ^ GHIDRA_UINT((animName + 7)))); - isAnimNameOwned = false; - if (this->_variant == 100) { - other = (this->_sprite)._overlayAnimState._animData; - if (other == (void *)0x0) { - animName[0] = GHIDRA_CAST(0x0); - animNameCapacity = 0xf; - animNameSize = 0; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(animName))))->msvc::string::string(other); - } - capacity = animNameCapacity; - animNameHeap = animName[0]; - isAnimNameOwned = true; - pppppbVar1 = GHIDRA_CAST(animName); - if (0xf < animNameCapacity) { - pppppbVar1 = animName[0]; - } - isEqual = str_eq(GHIDRA_CAST(pppppbVar1),animNameSize,GHIDRA_CAST("Alternates"),10); - if (isEqual != 0) { - isAlternates = true; - goto LAB_006e1df5; - } - } - else { - animNameHeap = animName[0]; - capacity = animNameCapacity; - } - isAlternates = false; -LAB_006e1df5: - if ((isAnimNameOwned) && (0xf < capacity)) { - size = capacity + 1; - pppppbVar1 = animNameHeap; - if (0xfff < size) { - pppppbVar1 = GHIDRA_CAST(animNameHeap[-1]); - size = capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(animNameHeap) + (-4 - GHIDRA_INT(pppppbVar1))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppbVar1,size); - } - if (isAlternates) { - return GHIDRA_INT((this->_sprite)._overlayAnimState._animFrame); - } - return -1; -} - -// 006e1e60 -void Entity_Pickup::SetForceBlind(uint8_t setBlind) -{ - uint8_t isPrevForceBlind; - - isPrevForceBlind = this->_isForceBlind; - this->_isForceBlind = setBlind; - if (((this->_variant == 100) && (this->_subtype != 0)) && (isPrevForceBlind != setBlind)) { - UpdateSprite(this,0); - } - return; -} - -// 006e21f0 -void Entity_Pickup::UpdateSprite(uint8_t isIgnoreBlind) -{ - char **ppcVar1; - uint8_t isBlind; - int iVar2; - uint32_t curses; - int extraout_ECX; - char *ptr; - int extraout_ECX_00; - int extraout_ECX_01; - int extraout_ECX_02; - int extraout_ECX_03; - std_string spritesheetPath; - uint32_t local_24; - char **ppcStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - void *trinketConfigs; - - ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00afb00d; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(&spritesheetPath) + 0x2cU; - ExceptionList = &local_1c; - iVar2 = this->_variant; - if (iVar2 == 0x15e) { - curses = this->_subtype & 0x7fff; - trinketConfigs = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT(curses) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinketConfigs) >> 2) { - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(trinketConfigs) + curses * 4)); - } - else { - iVar2 = 0; - } - ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - (GHIDRA_CAST((spritesheetPath._buf)))->msvc::string::string((void *)(iVar2 + 0x38)); - local_14 = 0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&spritesheetPath); - (this->_sprite)._bitflags = GHIDRA_UINT(this->_subtype) >> 8 & 0x80; - iVar2 = extraout_ECX; - } - else { - if (iVar2 == 100) { - ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - if (((isIgnoreBlind == 0) && - (ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)), g_game->_currentDimensionIdx != 2) - ) && ((ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)), - curses = Level::GetCurses(GHIDRA_CAST(g_game)), (curses & 0x40) != 0 || - (this->_isForceBlind != 0)))) { - isBlind = 1; - } - else { - isBlind = 0; - } - load_collectible_gfx(&this->_sprite,1,this->_subtype,this->_initSeed,isBlind); - iVar2 = extraout_ECX_01; - ppcVar1 = ppcStack_20; - goto switchD_006e23e9_caseD_1; - } - if ((iVar2 == 0x17c) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x13)) { - ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - (*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) = msvc::_Allocate(0x30); - spritesheetPath._size = 0x26; - spritesheetPath._capacity = 0x2f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spritesheetPath._buf))) + 0x0))),"gfx/Items/Pick Ups/IsaacBed_Barren.png", - 0x27); - local_14 = 1; - goto LAB_006e23b6; - } - ppcVar1 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - if (this->_isPayToPlay == 0) goto switchD_006e23e9_caseD_1; - iVar2 = iVar2 + -0x35; - ppcVar1 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - switch(iVar2) { - case 0: - case 7: - ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - (*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) = msvc::_Allocate(0x40); - spritesheetPath._size = 0x31; - spritesheetPath._capacity = 0x3f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spritesheetPath._buf))) + 0x0))), - "gfx/Items/Pick Ups/Pickup_005_Chests_coinslot.png",0x32); - local_14 = 2; - break; - default: - goto switchD_006e23e9_caseD_1; - case 2: - ppcStack_20 = GHIDRA_CAST((GHIDRA_INT(&spritesheetPath) + 0x38)); - (*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) = msvc::_Allocate(0x30); - spritesheetPath._size = 0x2b; - spritesheetPath._capacity = 0x2f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spritesheetPath._buf))) + 0x0))), - "gfx/Items/Pick Ups/dirty_chest_coinslot.png",0x2c); - local_14 = 3; - break; - case 4: - (*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) = msvc::_Allocate(0x30); - spritesheetPath._size = 0x2a; - spritesheetPath._capacity = 0x2f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spritesheetPath._buf))) + 0x0))), - "gfx/Items/Pick Ups/mega_chest_coinslot.png",0x2b); - local_14 = 4; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&spritesheetPath); - local_14 = 0xffffffff; - iVar2 = extraout_ECX_03; - ppcVar1 = ppcStack_20; - if (spritesheetPath._capacity < 0x10) goto switchD_006e23e9_caseD_1; - curses = spritesheetPath._capacity + 1; - ptr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spritesheetPath._buf))) + 0x0))); - if (0xfff < curses) { - ptr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) + -4)); - iVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) - GHIDRA_INT(ptr); - goto joined_r0x006e253b; - } - goto LAB_006e22cc; - } -LAB_006e23b6: - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&spritesheetPath); - iVar2 = extraout_ECX_02; - } - local_14 = 0xffffffff; - ppcVar1 = ppcStack_20; - if (0xf < spritesheetPath._capacity) { - curses = spritesheetPath._capacity + 1; - ptr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spritesheetPath._buf))) + 0x0))); - if (0xfff < curses) { - ptr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) + -4)); - iVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&(spritesheetPath._buf)) + 0x0))) - GHIDRA_INT(ptr); -joined_r0x006e253b: - curses = spritesheetPath._capacity + 0x24; - if (0x1f < iVar2 - 4U) { - local_14 = 0xffffffff; - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } -LAB_006e22cc: - local_14 = 0xffffffff; - operator_delete(ptr,curses); - iVar2 = extraout_ECX_00; - ppcVar1 = ppcStack_20; - } -switchD_006e23e9_caseD_1: - ppcStack_20 = ppcVar1; - ANM2::LoadGraphics(&this->_sprite,(uint8_t)iVar2); - ExceptionList = local_1c; - return; -} - -// 006e2570 -void Entity_Pickup::update_price_sprite(int price) -{ - uint8_t bVar1; - uint32_t uVar2; - ItemConfig_Item *item; - EntityConfig_Entity *priceConfig; - char *anim; - LayerState *layer; - uint32_t uVar3; - Entity *paymentEffect; - int iVar4; - uint32_t belowGrid; - GridEntity_Spikes *spikes; - GridEntity *pGVar5; - void *pvVar6; - int gridWidth; - int iVar7; - bool isUnsummon; - uint8_t local_20 [4]; - uint8_t local_1c [4]; - void *configNode; - GridEntity *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *childSlot; - Manager *manager; - ANM2 *priceSprite; - Room *room; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afb057; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((local_1c + 0x18)); - ExceptionList = &local_10; - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,this->_subtype); - pGVar5 = GHIDRA_CAST(this->_price); - if ((((pGVar5 == GHIDRA_CAST(0xfffffff6)) && (item != GHIDRA_CAST(0x0))) && - ((item->tags & 0x200000000) != 0)) && (((price != 0 && (price != -6)) && (price != -10)))) { - ExceptionList = local_10; - return; - } - this->_price = price; - local_14 = pGVar5; - if (price == 0) { - if (this->_variant == 100) { - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - (this->_posOffset).y = 0.0; - } - ANM2::Play(&this->_sprite,s_Idle,0); - SetAlternatePedestal(this,0); - } - ANM2::Reset(&this->_priceANM2); - } - else { - AnimationState::SetAnimationData(&(this->_sprite)._overlayAnimState,(void *)0x0); - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - (this->_posOffset).y = -20.0; - } - manager = g_manager; - price = 0x509600; - _Find_lower_bound<>(local_20,&price); - if (((*GHIDRA_CAST((GHIDRA_CAST(configNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(configNode) + 0x10)) < 0x509601)) && - (configNode != (manager->_entityConfig)._entities._head)) { - priceConfig = GHIDRA_CAST((GHIDRA_INT(configNode) + 0x18)); - } - else { - priceConfig = EntityConfig::GetEntity(&manager->_entityConfig,5,0,0); - } - priceSprite = &this->_priceANM2; - ANM2::Load(priceSprite,&priceConfig->anm2Path,1); - if ((this->_price < 0) && (this->_price != -1000)) { - anim = "Hearts"; - } - else { - iVar4 = this->_price; - iVar7 = Room::GetShopItemPrice - (g_game->_room,this->_variant,this->_subtype,this->_shopItemId, - GHIDRA_CAST(0x0)); - if ((iVar4 < iVar7) || (anim = "NumbersWhite", iVar4 == -1000)) { - anim = "NumbersRed"; - } - pGVar5 = local_14; - } - ANM2::SetAnimation(priceSprite,GHIDRA_CAST(anim),1); - iVar4 = this->_price; - if (iVar4 < 0) { - if (iVar4 < -8) { - if (iVar4 == -9) { - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,7.0); - } - } - else if (iVar4 == -1000) { - layer = ANM2::GetLayer(priceSprite,GHIDRA_CAST(0x0)); - layer->_visible = 0; - ANM2::SetLayerFrame(priceSprite,1,0); - ANM2::SetLayerFrame(priceSprite,2,10); - } - } - else { - switch(iVar4) { - case -8: - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,6.0); - } - break; - case -7: - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,5.0); - } - break; - case -6: - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,4.0); - } - if (pGVar5 == GHIDRA_CAST(0xfffffff6)) { - room = g_game->_room; - iVar4 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&this->_pos); - uVar3 = room->_gridWidth + iVar4; - if (uVar3 < 0x1c0) { - pvVar6 = room->_gridEntities[uVar3]; - } - else { - pvVar6 = (void *)0x0; - } - iVar4 = __RTDynamicCast(pvVar6,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0) - ; - if ((((iVar4 != 0) && (price = uVar3, uVar3 < 0x1c0)) && - (iVar4 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar3 * 4 + 0x24)), iVar4 != 0)) && - (*GHIDRA_CAST((iVar4 + 4)) != 1)) { - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar3 * 4 + 0x76c)) = 900; - msvc::set::insert(local_1c,&price); - } - } - break; - case -5: - layer = ANM2::GetLayer(priceSprite,GHIDRA_CAST(0x0)); - layer->_visible = 0; - layer = ANM2::GetLayer(priceSprite,GHIDRA_CAST(0x1)); - layer->_visible = 0; - layer = ANM2::GetLayer(priceSprite,GHIDRA_CAST(0x2)); - childSlot = &this->_child; - layer->_visible = 0; - if (*childSlot == 0) { - uVar3 = Random(); - paymentEffect = - Game::SpawnEx(g_game,1000,0xae,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3,0); - if (paymentEffect->_parent != 0) { - price = GHIDRA_INT(&paymentEffect->_parent); - msvc::multiset::erase(&price); - } - paymentEffect->_parent = this; - msvc::multiset::insert(&paymentEffect->_parent); - paymentEffect->Update(); - if (*childSlot != 0) { - price = GHIDRA_INT(childSlot); - msvc::multiset::erase(&price); - } - *childSlot = paymentEffect; - msvc::multiset::insert(childSlot); - } - break; - case -4: - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,3.0); - } - break; - case -3: - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,2.0); - } - break; - case -2: - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,1.0); - } - break; - case -1: - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_priceANM2)._animState,0.0); - } - } - } - } - else { - if (iVar4 < 10) { - layer = ANM2::GetLayer(priceSprite,GHIDRA_CAST(0x0)); - layer->_visible = 0; - } - else { - price = iVar4 / 10; - if (((this->_priceANM2)._animState._animData != (void *)0x0) && - ((0 < *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)) || - (KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")), - 0 < *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)))))) { - pvVar6 = (this->_priceANM2)._animState._animData; - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x38)); - if ((pvVar6 == (void *)0x0) || ((iVar4 < 0 || (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1c)) <= iVar4)))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("id out of bounds\n")); - } - *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._layerFrames) + iVar4 * 4)) = 0; - AnimationState::AdvanceLayerPosition(&(this->_priceANM2)._animState,iVar4,(float)price); - } - } - price = this->_price % 10; - if ((this->_priceANM2)._animState._animData != (void *)0x0) { - if ((1 < *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80))) || - (KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")), - 1 < *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)))) { - pvVar6 = (this->_priceANM2)._animState._animData; - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x3c)); - if ((pvVar6 == (void *)0x0) || ((iVar4 < 0 || (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1c)) <= iVar4)))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("id out of bounds\n")); - } - *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._layerFrames) + iVar4 * 4)) = 0; - AnimationState::AdvanceLayerPosition(&(this->_priceANM2)._animState,iVar4,(float)price); - } - if (((this->_priceANM2)._animState._animData != (void *)0x0) && - ((2 < *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)) || - (KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")), - 2 < *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)))))) { - pvVar6 = (this->_priceANM2)._animState._animData; - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x40)); - if ((pvVar6 == (void *)0x0) || ((iVar4 < 0 || (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1c)) <= iVar4)))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("id out of bounds\n")); - } - *GHIDRA_CAST((GHIDRA_INT((this->_priceANM2)._animState._layerFrames) + iVar4 * 4)) = 0; - AnimationState::AdvanceLayerPosition(&(this->_priceANM2)._animState,iVar4,10.0); - } - } - } - if (this->_variant == 100) { - bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("ShopIdle"),1); - if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - this->_entityCollisionClass = 1; - pGVar5 = local_14; - goto LAB_006e2c1a; - } - } - else { - ANM2::Play(&this->_sprite,s_Idle,0); - } - this->_entityCollisionClass = 1; - pGVar5 = local_14; - } -LAB_006e2c1a: - if ((this->_price != -5) && (GHIDRA_CAST(this->_child) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_child) + 0x28))(uVar2); - } - if ((pGVar5 == GHIDRA_CAST(0xfffffff6)) && (this->_price == 0)) { - ANM2::Play(&this->_sprite,s_Idle,0); - SetAlternatePedestal(this,0); - uVar2 = Random(); - Game::SpawnEx(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar2,0); - manager = g_manager; - price = 0x50; - seed_fart_sound_override(&price); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(price,1.0,2,0,1.0,0.0); - pvVar6 = g_game->_room; - iVar7 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5)); - iVar4 = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)); - if ((((iVar7 < 0) || (gridWidth = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0xc)), gridWidth <= iVar7)) || - (iVar4 < 0)) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x10)) <= iVar4)) { - gridWidth = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0xc)); - iVar7 = -1; - } - else { - iVar7 = iVar4 * gridWidth + iVar7; - } - if (GHIDRA_UINT((iVar7 + gridWidth)) < 0x1c0) { - belowGrid = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + (iVar7 + gridWidth) * 4 + 0x24)); - } - else { - belowGrid = 0; - } - spikes = (GridEntity_Spikes *) - __RTDynamicCast(belowGrid,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0); - if (spikes == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - isUnsummon = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((spikes)) + 0x4)))) == 0x1c; - } - else { - if (this->_price == -10) { - pvVar6 = g_game->_room; - iVar7 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5)); - iVar4 = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)); - if ((((iVar7 < 0) || (gridWidth = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0xc)), gridWidth <= iVar7)) || - (iVar4 < 0)) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x10)) <= iVar4)) { - gridWidth = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0xc)); - iVar7 = -1; - } - else { - iVar7 = iVar4 * gridWidth + iVar7; - } - uVar2 = iVar7 + gridWidth; - if (uVar2 < 0x1c0) { - belowGrid = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar2 * 4 + 0x24)); - } - else { - belowGrid = 0; - } - iVar4 = __RTDynamicCast(belowGrid,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0); - if ((iVar4 != 0) && (*GHIDRA_CAST((iVar4 + 4)) == 0x1c)) { - if (*GHIDRA_CAST((iVar4 + 0xc)) == 1) { - *GHIDRA_CAST((iVar4 + 0xc)) = 0; - ANM2::Play(GHIDRA_CAST((iVar4 + 0x40)),GHIDRA_CAST("SummonPayment"),0); - ExceptionList = local_10; - return; - } - ExceptionList = local_10; - return; - } - pvVar6 = g_game->_room; - if ((uVar2 < 0x1c0) && - ((childSlot = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar2 * 4 + 0x24)), - childSlot != GHIDRA_CAST(0x0) && (childSlot[1] != 1)))) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar2 * 4 + 0x76c)) = 900; - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar2 * 4 + 0x24)) = 0; - (**(code **)*childSlot)(1); - } - pvVar6 = g_game->_room; - price = Random(); - if ((GHIDRA_INT(uVar2) < 0) || (0x1bf < GHIDRA_INT(uVar2))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if (0x1bf < uVar2) { - ExceptionList = local_10; - return; - } - if (900 < *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar2 * 4 + 0x76c))) { - ExceptionList = local_10; - return; - } - pGVar5 = operator_new(0x158); - local_8 = 0xd; - local_14 = pGVar5; - if (pGVar5 == GHIDRA_CAST(0x0)) { - pGVar5 = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((pGVar5)))->GridEntity::GridEntity(); - *GHIDRA_CAST(pGVar5) = IsaacRepentancePlus::GridEntity_Spikes::vftable; - } - local_8 = 0xffffffff; - if (pGVar5 == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar5)) + 0x4)))) = 0x1c; - pGVar5->_gridIndex = uVar2; - childSlot = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar2 * 4 + 0x24)); - if (childSlot != GHIDRA_CAST(0x0)) { - (**(code **)*childSlot)(1); - } - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar2 * 4 + 0x24)) = pGVar5; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar5)) + 0x8)))) = 0; - pGVar5->_varData = 0; - (GHIDRA_CAST((pGVar5)))->GridEntity::Init(price); - ExceptionList = local_10; - return; - } - room = g_game->_room; - iVar4 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&this->_pos); - uVar2 = iVar4 + room->_gridWidth; - if (uVar2 < 0x1c0) { - pvVar6 = room->_gridEntities[uVar2]; - } - else { - pvVar6 = (void *)0x0; - } - spikes = (GridEntity_Spikes *) - __RTDynamicCast(pvVar6,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0); - if (spikes == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((spikes)) + 0x4)))) != 0x1c) { - ExceptionList = local_10; - return; - } - isUnsummon = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((spikes)) + 0xc)))) == 0; - } - if (isUnsummon) { - (GHIDRA_CAST((spikes)))->GridEntity_Spikes::unsummon(0); - } - ExceptionList = local_10; - return; -} - -// 006e3020 -void Entity_Pickup::AppearFast() -{ - uint8_t *animName; - uint32_t nameCompare; - int frame; - char *appearNameCursor; - bool isNameLess; - uint8_t nameChar; - - if ((((this->_variant == 0x14) && (this->_subtype == 1)) && - ((this->_sprite)._animState._animData != (void *)0x0)) && - ((this->_sprite)._animState._isPlaying != 0)) { - animName = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((animName + 0x14))) { - animName = *GHIDRA_CAST(animName); - } - appearNameCursor = "Appear"; - do { - nameChar = *animName; - isNameLess = nameChar < (uint8_t)*appearNameCursor; - if (nameChar != *appearNameCursor) { -LAB_006e3070: - nameCompare = -GHIDRA_UINT(isNameLess) | 1; - goto LAB_006e3075; - } - if (nameChar == 0) break; - nameChar = animName[1]; - isNameLess = nameChar < (uint8_t)appearNameCursor[1]; - if (nameChar != appearNameCursor[1]) goto LAB_006e3070; - animName = animName + 2; - appearNameCursor = appearNameCursor + 2; - } while (nameChar != 0); - nameCompare = 0; -LAB_006e3075: - if (nameCompare == 0) { - frame = ANM2::GetFrame(&this->_sprite); - if (frame == 0) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("AppearFast"),0); - } - } - } - return; -} - -// 006e38d0 -void Entity_Pickup::Interpolate() -{ - uint8_t isChest; - float *chosenOffsetY; - Entity *this_00; - float maxOffsetY; - float bobOffsetY; - - isChest = IsChest(this->_variant); - if (isChest != 0) { - maxOffsetY = 0.0; - bobOffsetY = (float)this_00[1]._entityRef4._flags * this_00->_speedMultiplier * 0.5 + - this_00[1]._entityRef4._velocity.y; - chosenOffsetY = &bobOffsetY; - if (0.0 <= bobOffsetY) { - chosenOffsetY = &maxOffsetY; - } - (this_00->_posOffset).y = *chosenOffsetY; - } - (GHIDRA_CAST((this_00)))->Entity::Interpolate(); - return; -} - -// 006e3940 -void Entity_Pickup::Update() -{ - uint32_t *puVar1; - int iVar2; - ANM2 other; - Vector pos; - void **ppvVar3; - uint8_t bVar4; - char cVar5; - int iVar6; - uint32_t uVar7; - Entity *pEVar8; - Entity_Player *player; - std_string *animName; - uint8_t *pbVar9; - Vector *freePos; - Vector *pVVar10; - RNG *explosionSprite; - uint32_t jitterFrame; - void *pvVar11; - char *pcVar12; - int extraout_ECX; - PlayerManager *playerManager; - int *piVar13; - uint8_t *puVar14; - int extraout_EDX; - code *extraout_EDX_00; - uint8_t *expectedAnimChar; - code *extraout_EDX_01; - Game *game; - Room *ptr; - Entity *eligibleCapEnd; - bool bVar15; - float fVar16; - float fVar17; - float fVar18; - float fVar19; - Room *pRVar20; - uint64_t uVar21; - double dVar22; - ANM2 aAStackY_8d5c [128]; - uint8_t in_stack_fffffdb8 [244]; - float in_stack_fffffeac; - float in_stack_fffffeb0; - Entity_Player *in_stack_fffffeb4; - Vector *in_stack_fffffeb8; - Vector *in_stack_fffffebc; - uint32_t in_stack_fffffec0; - PlayerManager *in_stack_fffffec4; - int iVar23; - ColorMod lerpedColor; - Entity_Pickup *local_f8; - Vector local_f4; - uint8_t isDead; - RNG local_e8; - int *renderTarget; - Room *local_d0; - Entity *local_cc; - Vector local_c8; - uint8_t local_bd; - uint8_t local_bc [32]; - int animNameSize; - uint8_t *animNameCapacity; - Color tmpColor; - uint8_t local_68 [24]; - float local_50; - uint8_t local_4c [12]; - Entity *local_40; - uint8_t local_34 [12]; - float local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - ANM2 *explosionSprite; - uint64_t flags; - uint32_t flagsHigh; - Manager *manager; - ColorMod *spriteColor; - code *virtualFn; - - puStack_20 = local_34 + 0x30; - local_14 = 0xffffffff; - puStack_18 = &LAB_00afb109; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_34 + 0x24)); - ppvVar3 = &local_1c; - if (0 < this->_dropDelay) { - if (this->_entityCollisionClass == 0) { - this->_dropDelay = this->_dropDelay + -1; - return; - } - ExceptionList = &local_1c; - this->_dropDelay = 0; - ppvVar3 = ExceptionList; - } - ExceptionList = ppvVar3; - fVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e4)))); - local_f8 = this; - if ((fVar17 < 0.0) || - (puVar14 = local_34 + 0x30, - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e8)))) <= 0.0 && *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e8)))) != 0.0)) { - iVar6 = 4; - fVar19 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e8)))); - if (fVar17 < -50.0) { - iVar6 = 0; - } - this->_entityCollisionClass = iVar6; - iVar6 = 6; - if (fVar17 < -50.0) { - iVar6 = 3; - } - this->_entityGridCollisionClass = iVar6; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e8)))) = this->_speedMultiplier * 1.2 + fVar19; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e4)))) = this->_speedMultiplier * fVar19 + fVar17; - puVar14 = local_34 + 0x30; - if (this->_collidesWithGrid != 0) { - bVar4 = IsChest(this->_variant); - puVar14 = puStack_20; - if ((bVar4 != 0) && (this->_subtype != 0)) { - in_stack_fffffec4 = GHIDRA_CAST(0x6e3a57); - bVar4 = TryOpenChest(this,GHIDRA_CAST(0x0)); - puVar14 = puStack_20; - if ((bVar4 != 0) && - ((iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)), iVar6 == 0xb || (iVar6 == 0x11)))) { - (GHIDRA_CAST((&g_game->_ambush)))->Ambush::StartChallenge(); - puVar14 = puStack_20; - } - } - } - puStack_20 = puVar14; - puVar14 = puStack_20; - if (0.0 <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e4))))) { - flags = this->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 & 0xfbffffff; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e8)))) = 0; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(flags); - this->_entityCollisionClass = 4; - this->_entityGridCollisionClass = 5; - bVar4 = IsChest(this->_variant); - puVar14 = puStack_20; - if ((bVar4 != 0) && (this->_subtype != 0)) { - in_stack_fffffec4 = GHIDRA_CAST(0x6e3af2); - bVar4 = TryOpenChest(this,GHIDRA_CAST(0x0)); - puVar14 = puStack_20; - if ((bVar4 != 0) && - ((iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)), iVar6 == 0xb || (iVar6 == 0x11)))) { - (GHIDRA_CAST((&g_game->_ambush)))->Ambush::StartChallenge(); - puVar14 = puStack_20; - } - } - } - } - puStack_20 = puVar14; - iVar6 = this->_variant; - iVar23 = 0x6e3b2b; - bVar4 = IsChest(iVar6); - if (((bVar4 != 0) && - (iVar2 = this->_parent, (this->_posOffset).y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6e4)))), iVar2 != 0)) && - ((this->_flags & 0x200000000000000) != 0)) { - fVar17 = *GHIDRA_CAST((this->_parent + 0x340)); - fVar19 = (this->_pos).y; - (this->_velocity).x = *GHIDRA_CAST((this->_parent + 0x33c)) - (this->_pos).x; - (this->_velocity).y = fVar17 - fVar19; - iVar6 = this->_variant; - } - if (iVar6 == 100) { - if ((this->_flags & 4) != 0) { - uVar7 = Random(); - pVVar10 = &this->_pos; - in_stack_fffffec4 = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x1))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x2))) = 0; - in_stack_fffffebc = &g_vectorZero; - in_stack_fffffeb4 = GHIDRA_CAST(&DAT_0000000f); - in_stack_fffffeb0 = 1.4013e-42; - in_stack_fffffeac = 1.0123364e-38; - in_stack_fffffeb8 = pVVar10; - pEVar8 = Game::Spawn(g_game,1000,0xf,pVVar10,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - pEVar8->Update(); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh; - iVar23 = 0x6e3bf1; - iVar6 = PlayerManager::GetGFuelCount(); - if (1 < iVar6) { - uVar7 = Random(); - in_stack_fffffeac = 1.0123468e-38; - local_cc = Game::Spawn(g_game,1000,0xf,pVVar10,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x8))) = 0.0; - explosionSprite = &local_cc->_sprite; - local_40 = GHIDRA_CAST(0xf); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x14))) = 0.0; - local_d0 = GHIDRA_CAST(explosionSprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x14))) = msvc::_Allocate(0x30); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x8))) = &DAT_00000027; - local_40 = GHIDRA_CAST(&DAT_0000002f); - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_68))) + 0x14))),"gfx/promo/gfuel/effects/explosion4.anm2",0x28); - local_14 = 0; - ANM2::Load(explosionSprite,GHIDRA_CAST((local_68 + 0x14)),1); - local_14 = 0xffffffff; - if (GHIDRA_CAST(&DAT_0000000f) < local_40) { - piVar13 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_40)) + 0x1)))); - pcVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_68))) + 0x14))); - if (GHIDRA_CAST(0xfff) < piVar13) { - pcVar12 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x14))) + -4)); - piVar13 = &local_40->_collisionIndex; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x14))) + (-4 - GHIDRA_INT(pcVar12))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar12,GHIDRA_UINT(piVar13)); - } - uVar7 = Random(); - manager = g_manager; - local_e8._shift3 = 0x33d; - local_c8.y = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9; - seed_fart_sound_override(&local_e8._shift3); - in_stack_fffffebc = GHIDRA_CAST(0x2); - in_stack_fffffeb8 = GHIDRA_CAST(0x3f800000); - in_stack_fffffeb0 = 1.0123948e-38; - in_stack_fffffeb4 = GHIDRA_CAST(local_e8._shift3); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_e8._shift3,1.0,2,0,local_c8.y,0.0); - Game::ShakeScreen(g_game,10); - uVar7 = Random(); - pEVar8 = local_cc; - (local_cc->_sprite)._flipX = ((uint8_t)uVar7 ^ 0xff) & 1; - in_stack_fffffec4 = GHIDRA_CAST(&(local_cc->_sprite)._animDefaultName); - if (0xf < (local_cc->_sprite)._animDefaultName._capacity) { - in_stack_fffffec4 = *GHIDRA_CAST((GHIDRA_CAST(in_stack_fffffec4))->_buf); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x0))) = 0xab; - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x1))) = 0x3d; - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x2))) = 0x6e; - bVar4 = ANM2::SetAnimation(&local_cc->_sprite,GHIDRA_CAST(in_stack_fffffec4),1); - pRVar20 = local_d0; - if (bVar4 != 0) { - AnimationState::Rewind(GHIDRA_CAST((local_d0->_gridEntities + 3))); - *GHIDRA_CAST((pRVar20->_gridEntities + 8)) = 1; - pEVar8 = local_cc; - } - iVar23 = 0x6e3dce; - pEVar8->Update(); - } - } - if (((this->_visible == 0) && (this->_entityCollisionClass != 0)) && - (this->_invisibleFrames = this->_invisibleFrames + 1, 3 < this->_invisibleFrames)) { - this->_visible = 1; - } - if ((this->_flipSaveState == 0) || (this->_variant != 100)) { -LAB_006e3e26: - bVar4 = 0; - } - else { - iVar23 = 1; - in_stack_fffffec4 = &g_game->_playerManager; - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x0))) = 199; - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x1))) = 2; - (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffec0)) + 0x2))) = 0; - in_stack_fffffebc = GHIDRA_CAST(0x6e3e1e); - player = PlayerManager::FirstCollectibleOwner - (in_stack_fffffec4,0x2c7,GHIDRA_CAST(in_stack_fffffec4),1); - if (player == GHIDRA_CAST(0x0)) goto LAB_006e3e26; - bVar4 = 1; - } - if (bVar4 != (this->_altPedestalANM2)._loaded) { - if (bVar4 == 0) { - ANM2::Reset(&this->_altPedestalANM2); - } - else { - ANM2::ANM2(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x248)),&this->_sprite); - other._championColor._offset[0] = in_stack_fffffeac; - other._filename._buf[0] = in_stack_fffffdb8[0]; - other._filename._buf[1] = in_stack_fffffdb8[1]; - other._filename._buf[2] = in_stack_fffffdb8[2]; - other._filename._buf[3] = in_stack_fffffdb8[3]; - other._filename._buf[4] = in_stack_fffffdb8[4]; - other._filename._buf[5] = in_stack_fffffdb8[5]; - other._filename._buf[6] = in_stack_fffffdb8[6]; - other._filename._buf[7] = in_stack_fffffdb8[7]; - other._filename._buf[8] = in_stack_fffffdb8[8]; - other._filename._buf[9] = in_stack_fffffdb8[9]; - other._filename._buf[10] = in_stack_fffffdb8[10]; - other._filename._buf[0xb] = in_stack_fffffdb8[0xb]; - other._filename._buf[0xc] = in_stack_fffffdb8[0xc]; - other._filename._buf[0xd] = in_stack_fffffdb8[0xd]; - other._filename._buf[0xe] = in_stack_fffffdb8[0xe]; - other._filename._buf[0xf] = in_stack_fffffdb8[0xf]; - other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x10))); - other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x14))); - other._animDefaultName._buf[0] = in_stack_fffffdb8[0x18]; - other._animDefaultName._buf[1] = in_stack_fffffdb8[0x19]; - other._animDefaultName._buf[2] = in_stack_fffffdb8[0x1a]; - other._animDefaultName._buf[3] = in_stack_fffffdb8[0x1b]; - other._animDefaultName._buf[4] = in_stack_fffffdb8[0x1c]; - other._animDefaultName._buf[5] = in_stack_fffffdb8[0x1d]; - other._animDefaultName._buf[6] = in_stack_fffffdb8[0x1e]; - other._animDefaultName._buf[7] = in_stack_fffffdb8[0x1f]; - other._animDefaultName._buf[8] = in_stack_fffffdb8[0x20]; - other._animDefaultName._buf[9] = in_stack_fffffdb8[0x21]; - other._animDefaultName._buf[10] = in_stack_fffffdb8[0x22]; - other._animDefaultName._buf[0xb] = in_stack_fffffdb8[0x23]; - other._animDefaultName._buf[0xc] = in_stack_fffffdb8[0x24]; - other._animDefaultName._buf[0xd] = in_stack_fffffdb8[0x25]; - other._animDefaultName._buf[0xe] = in_stack_fffffdb8[0x26]; - other._animDefaultName._buf[0xf] = in_stack_fffffdb8[0x27]; - other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x28))); - other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x2c))); - other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x30))); - other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x34))); - other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x38))); - other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x3c))); - other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0x40))); - other._animState._isPlaying = in_stack_fffffdb8[0x44]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x45))); - other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x48))); - other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x4c))); - other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x50))); - other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x54))); - other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x58))); - other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x5c))); - other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0x60))); - other._overlayAnimState._isPlaying = in_stack_fffffdb8[100]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x65))); - other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x68))); - other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x6c))); - other._overlayRenderFirst = in_stack_fffffdb8[0x70]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x71))); - other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x74))); - other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x78))); - other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x7c))); - other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x80))); - other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x84))); - other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x88))); - other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffdb8)) + 0x8c))); - other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffdb8)) + 0x90))); - other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0x94))); - other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0x98))); - other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0x9c))); - other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xa0))); - other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xa4))); - other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xa8))); - other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xac))); - other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xb0))); - other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xb4))); - other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xb8))); - other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xbc))); - other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xc0))); - other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xc4))); - other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xc8))); - other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xcc))); - other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xd0))); - other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xd4))); - other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xd8))); - other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xdc))); - other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xe0))); - other._championColor._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xe4))); - other._championColor._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xe8))); - other._championColor._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xec))); - other._championColor._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffdb8)) + 0xf0))); - other._championColor._offset[1] = in_stack_fffffeb0; - other._championColor._offset[2] = (float)in_stack_fffffeb4; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x100))) = in_stack_fffffeb8; - other._playbackSpeed = (float)in_stack_fffffebc; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = (char)in_stack_fffffec0; - other._loaded = SUB41(in_stack_fffffec0,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x10a))) = SUB42(in_stack_fffffec0,2); - other._shadowLayerIndex = GHIDRA_INT(in_stack_fffffec4); - other._bitflags = iVar23; - ANM2::operator_assign(&this->_altPedestalANM2,other); - if ((g_game->_currentDimensionIdx == 2) || - ((uVar7 = Level::GetCurses(GHIDRA_CAST(g_game)), (uVar7 & 0x40) == 0 && - (this->_isForceBlind == 0)))) { - bVar4 = 0; - } - else { - bVar4 = 1; - } - load_collectible_gfx - (&this->_altPedestalANM2,1,*GHIDRA_CAST((this->_flipSaveState + 8)), - *GHIDRA_CAST((this->_flipSaveState + 0x34)),bVar4); - ANM2::LoadGraphics(&this->_altPedestalANM2,bVar4); - animName = ANM2::GetAnimation(GHIDRA_CAST(&(this->_sprite)._animState), - GHIDRA_CAST((local_bc + 0x10))); - local_14 = 1; - if (0xf < animName->_capacity) { - animName = *GHIDRA_CAST(animName->_buf); - } - bVar4 = ANM2::SetAnimation(&this->_altPedestalANM2,GHIDRA_CAST(animName),1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_altPedestalANM2)._animState); - (this->_altPedestalANM2)._animState._isPlaying = 1; - } - local_14 = 0xffffffff; - if (&DAT_0000000f < animNameCapacity) { - puVar14 = animNameCapacity + 1; - pvVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_bc)) + 0x10))); - if (GHIDRA_CAST(0xfff) < puVar14) { - pvVar11 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0x10))) + -4); - puVar14 = animNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0x10))) + (-4 - GHIDRA_INT(pvVar11))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar11,GHIDRA_UINT(puVar14)); - } - animNameSize = 0; - animNameCapacity = &DAT_0000000f; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0x10))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0x10))) & 0xffffff00; - } - } - if ((this->_altPedestalANM2)._loaded != 0) { - AnimationState::Update(&(this->_altPedestalANM2)._animState); - AnimationState::Update(&(this->_altPedestalANM2)._overlayAnimState); - } - } - if ((this->_price == 0) && (this->_variant == 10)) { - local_cc = GHIDRA_CAST(0x0); - local_d0 = GHIDRA_CAST(0x0); - pEVar8 = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x4))) = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x8))) = GHIDRA_CAST(0x0); - local_f4.y = 0.0; - local_40 = GHIDRA_CAST(0x0); - local_14 = 2; - local_e8._shift3 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - eligibleCapEnd = GHIDRA_CAST(0x0); - do { - local_c8.y = (float)Game::GetPlayer(g_game,local_e8._shift3); - if ((GHIDRA_CAST(local_c8.y))->_gridEntities[2] == (void *)0x0) { - local_cc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_cc)) + 0x1)))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_c8.y)))) + 0x13c0)))) != 0xe) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_c8.y)))) + 0x13c0)))) != 0x21) goto LAB_006e4032; - } - if (pEVar8 == eligibleCapEnd) { - msvc::vector::_Emplace_reallocate(); - pEVar8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_4c))) + 0x8))); - eligibleCapEnd = local_40; - } - else { - *GHIDRA_CAST(pEVar8) = local_c8.y; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x8))) = &(*GHIDRA_CAST((GHIDRA_CAST((pEVar8)) + 0x4))); - pEVar8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_4c))) + 0x8))); - } - } -LAB_006e4032: - local_e8._shift3 = local_e8._shift3 + 1; - } while (GHIDRA_UINT(local_e8._shift3) < - (uint8_t *) - (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)); - this = local_f8; - local_f4.y = (float)eligibleCapEnd; - } - pEVar8 = GHIDRA_CAST((GHIDRA_INT(pEVar8) - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x4))) >> 2)); - local_d0 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_4c))) + 0x4))); - if ((pEVar8 == local_cc) && (this->_subtype != 7)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_34)) + 0x0))) = this->_initSeed; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_34)) + 0x4))) = 3; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_34)) + 0x8))) = 3; - local_28 = 3.64338e-44; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_34))))->RNG::RandomInt(GHIDRA_UINT(pEVar8)); - pRVar20 = local_d0; - local_c8.y = (float)local_d0->_gridEntities[uVar7 - 9]; - if (GHIDRA_CAST(local_c8.y) != GHIDRA_CAST(0x0)) { - this->Remove(); - switch(this->_subtype) { - case 1: - case 8: - case 9: - case 10: - case 0xc: - iVar6 = 2; - break; - default: - iVar6 = 1; - break; - case 3: - iVar6 = 3; - break; - case 4: - iVar6 = 5; - break; - case 5: - case 6: - case 0xb: - iVar6 = 4; - break; - case 7: - iVar6 = 6; - } - (GHIDRA_CAST((GHIDRA_CAST(local_c8.y))))->Entity_Player::AddBlueFlies(iVar6,&this->_pos,GHIDRA_CAST(0x0)); - if (pRVar20 == GHIDRA_CAST(0x0)) { - ExceptionList = local_1c; - return; - } - uVar7 = GHIDRA_INT(local_f4.y) - GHIDRA_INT(pRVar20) & 0xfffffffc; - ptr = pRVar20; - if (uVar7 < 0x1000) { -LAB_006e4146: - operator_delete(ptr,uVar7); - ExceptionList = local_1c; - return; - } - ptr = *GHIDRA_CAST(&pRVar20[-1]._isPickupVisionInvalid); - uVar7 = uVar7 + 0x23; - if (GHIDRA_UINT((GHIDRA_INT(pRVar20) + (-4 - GHIDRA_INT(ptr)))) < 0x20) goto LAB_006e4146; - goto LAB_006e4192; - } - } - local_14 = 0xffffffff; - if (local_d0 != GHIDRA_CAST(0x0)) { - uVar7 = (GHIDRA_INT(local_f4.y) - GHIDRA_INT(local_d0) >> 2) * 4; - pRVar20 = local_d0; - if (0xfff < uVar7) { - pRVar20 = *GHIDRA_CAST(&local_d0[-1]._isPickupVisionInvalid); - uVar7 = uVar7 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_d0) + (-4 - GHIDRA_INT(pRVar20))))) { -LAB_006e4192: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pRVar20,uVar7); - } - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1a8,GHIDRA_CAST(&g_game->_playerManager),1); - if ((player != GHIDRA_CAST(0x0)) && (this->_price == 0)) { - iVar6 = this->_spawnerType; - if (iVar6 == 5) { - bVar15 = this->_spawnerVariant == 0x45; - } - else { - if (iVar6 == 1) goto LAB_006e4283; - bVar15 = iVar6 == 3; - } - if ((!bVar15) && - ((((iVar6 = this->_variant, iVar6 == 0x1e || (iVar6 == 0x28)) || (iVar6 == 0x14)) || - ((iVar6 == 0x5a || (iVar6 == 300)))))) { - uVar7 = 5; - if (iVar6 == 0x14) { - uVar7 = 10; - } - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(uVar7); - if (uVar7 == 0) { - this->Remove(); - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pEVar8 = Game::Spawn(g_game,5,0x45,&this->_pos,&this->_velocity,GHIDRA_CAST(0x0),0,uVar7); - pEVar8[1]._sprite._color._offset[2] = (float)this->_optionsPickupIndex; - ExceptionList = local_1c; - return; - } - this->_spawnerType = 5; - this->_spawnerVariant = 0x45; - } - } -LAB_006e4283: - if (this->_variant == 0x28) { - iVar6 = this->_subtype; - if (iVar6 == 3) { - uVar7 = Random(); - Game::Spawn(g_game,4,3,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - goto LAB_006e42ba; - } - if (iVar6 == 5) { - uVar7 = Random(); - Game::Spawn(g_game,4,4,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - this->Remove(); - ExceptionList = local_1c; - return; - } - if (iVar6 == 6) { - uVar7 = Random(); - Game::Spawn(g_game,4,0x12,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - this->Remove(); - ExceptionList = local_1c; - return; - } - if (((this->_spawnerType == 4) && - (((iVar6 = this->_spawnerVariant, iVar6 == 3 || (iVar6 == 4)) || (iVar6 == 0x12)))) && - (((this->_sprite)._animState._animData != (void *)0x0 && - ((this->_sprite)._animState._isPlaying != 0)))) { - pbVar9 = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((pbVar9 + 0x14))) { - pbVar9 = *GHIDRA_CAST(pbVar9); - } - pcVar12 = "Appear"; - do { - bVar4 = *pbVar9; - bVar15 = bVar4 < (uint8_t)*pcVar12; - if (bVar4 != *pcVar12) { -LAB_006e4390: - uVar7 = -GHIDRA_UINT(bVar15) | 1; - goto LAB_006e4395; - } - if (bVar4 == 0) break; - bVar4 = pbVar9[1]; - bVar15 = bVar4 < (uint8_t)pcVar12[1]; - if (bVar4 != pcVar12[1]) goto LAB_006e4390; - pbVar9 = pbVar9 + 2; - pcVar12 = pcVar12 + 2; - } while (bVar4 != 0); - uVar7 = 0; -LAB_006e4395: - if (uVar7 == 0) { - ANM2::Play(&this->_sprite,s_Idle,0); - this->_entityCollisionClass = 4; - } - } - } - pVVar10 = &this->_targetPosition; - if (((this->_targetPosition).x == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y) - ) { - pVVar10->x = (this->_pos).x; - (this->_targetPosition).y = (this->_pos).y; - if (this->_variant == 100) { - local_c8.y = (float)g_game->_room; - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_c8.y))))->Room::GetGridIndex(&this->_pos); - if (((-1 < iVar6) && ((GHIDRA_CAST((GHIDRA_CAST(local_bc))))->EntityRef::EntityRef(), extraout_EDX < 0x1c0)) && - (((void **)(GHIDRA_INT(local_c8.y) + 0x24))[extraout_EDX] != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(((void **)(GHIDRA_INT(local_c8.y) + 0x24))[extraout_EDX]) + 0x14))(); - } - } - } - if (this->_gridRepositionState == 2) { - pVVar10->x = (this->_pos).x; - (this->_targetPosition).y = (this->_pos).y; - this->_gridRepositionState = 0; - } - iVar6 = this->_variant; - if (iVar6 == 100) { - pvVar11 = this->_megaChestCollectible[0]; - if (pvVar11 != (void *)0x0) { - pVVar10->x = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x334)); - (this->_targetPosition).y = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x338)); - pvVar11 = this->_megaChestCollectible[0]; - fVar17 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x364)); - (this->_velocity).x = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x360)); - (this->_velocity).y = fVar17; - fVar17 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x340)); - (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x33c)); - (this->_pos).y = fVar17; - goto LAB_006e45ad; - } -LAB_006e4506: - local_c8.y = (float)g_game->_room; - if (((GHIDRA_CAST(local_c8.y))->_roomType != 0x10) && (g_game->_frameCount - this->_spawnFrame < 6)) - { - local_e8._shift2 = GHIDRA_INT(pVVar10->x); - local_e8._shift3 = GHIDRA_INT((this->_targetPosition).y); - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_c8.y))))->Room::GetGridCollisionAtPos(*pVVar10); - if (iVar6 != 0) { - freePos = Room::FindFreePickupSpawnPosition - (GHIDRA_CAST(local_c8.y),GHIDRA_CAST((local_4c + 8)),pVVar10,40.0,1,0,0); - pVVar10->x = freePos->x; - (this->_targetPosition).y = freePos->y; - } - } - fVar17 = (this->_targetPosition).y; - fVar19 = (this->_pos).y; - (this->_velocity).x = pVVar10->x - (this->_pos).x; - (this->_velocity).y = fVar17 - fVar19; - } - else { - if ((this->_price != 0) || (iVar6 == 0x17c)) goto LAB_006e4506; - if (iVar6 == 0x14) { - if (this->_subtype == 6) goto LAB_006e4506; - } - else if ((iVar6 == 0x186) || (iVar6 == 0x39)) goto LAB_006e4506; - } -LAB_006e45ad: - if (this->_gridRepositionState == 1) { - local_c8.y = (float)&this->_pos; - player = Game::GetNearestPlayer(g_game,GHIDRA_CAST(local_c8.y)); - iVar6 = 0; - fVar17 = (player->_pos).x; - fVar19 = (player->_pos).y; - local_d0 = g_game->_room; - do { - if (local_d0->_doors[iVar6] != (void *)0x0) { - local_e8._shift3 = *GHIDRA_CAST((GHIDRA_INT(local_d0->_doors[iVar6]) + 0x24)); - local_cc = GHIDRA_CAST(local_d0->_gridWidth); - fVar16 = ((float)(local_e8._shift3 / GHIDRA_INT(local_cc)) * 40.0 + 120.0) - fVar19; - fVar18 = ((float)(local_e8._shift3 % GHIDRA_INT(local_cc)) * 40.0 + 40.0) - fVar17; - if (fVar16 * fVar16 + fVar18 * fVar18 < 4900.0) { - if (-1 < iVar6) { - local_f4.y = *GHIDRA_CAST(local_c8.y) - fVar17; - local_d0 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_c8.y) + 4)) - fVar19)); - fVar17 = sqrtf(local_f4.y * local_f4.y + (float)local_d0 * (float)local_d0); - if (0.0 < fVar17) { - local_f4.y = local_f4.y * (3.0 / fVar17); - local_d0 = GHIDRA_CAST(((float)local_d0 * (3.0 / fVar17))); - } - pRVar20 = GHIDRA_CAST((*GHIDRA_CAST(local_c8.y) - - ((float)(local_e8._shift3 % GHIDRA_INT(local_cc)) * 40.0 + 40.0))); - local_e8._shift3 = - GHIDRA_INT((*GHIDRA_CAST((GHIDRA_CAST(local_c8.y) + 4)) - - ((float)(local_e8._shift3 / GHIDRA_INT(local_cc)) * 40.0 + 120.0))); - local_c8.y = (float)pRVar20; - fVar17 = sqrtf((float)local_e8._shift3 * (float)local_e8._shift3 + - (float)pRVar20 * (float)pRVar20); - if (fVar17 <= 0.0) { - player = GHIDRA_CAST(local_e8._shift3); - pRVar20 = GHIDRA_CAST(local_c8.y); - } - else { - player = GHIDRA_CAST(((5.0 / fVar17) * (float)local_e8._shift3)); - pRVar20 = GHIDRA_CAST((local_c8.y * (5.0 / fVar17))); - } - (this->_velocity).x = local_f4.y + (float)pRVar20 + (this->_velocity).x; - (this->_velocity).y = (float)local_d0 + (float)player + (this->_velocity).y; - } - break; - } - } - iVar6 = iVar6 + 1; - } while (iVar6 < 8); - this->_gridRepositionState = 2; - } - if (this->_variant == 0x17c) { - this->_renderZOffset = -3000; - } - else if ((((this->_variant == 10) && (this->_subtype == 9)) && (this->_price == 0)) && - (this->_dead == 0)) { - player = Game::GetNearestPlayer(g_game,&this->_pos); - fVar17 = (player->_velocity).x; - fVar19 = (player->_velocity).y; - local_d0 = GHIDRA_CAST(((fVar17 + fVar17 + (player->_pos).x) - (this->_pos).x)); - local_f4.y = (fVar19 + fVar19 + (player->_pos).y) - (this->_pos).y; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_34),&this->_pos, - 50.0,1); - fVar17 = 0.0; - local_14 = 3; - if (local_28 != 0.0) { - do { - iVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_34)) + 0x4))) + GHIDRA_INT(fVar17) * 4)); - if (*GHIDRA_CAST((iVar6 + 0x28)) == 3) { - if (*GHIDRA_CAST((iVar6 + 0x2c)) != 0x40) { - if (*GHIDRA_CAST((iVar6 + 0x2c)) != 0x66) goto LAB_006e4978; - } - pRVar20 = GHIDRA_CAST(((*GHIDRA_CAST((iVar6 + 0x360)) + *GHIDRA_CAST((iVar6 + 0x360)) + - *GHIDRA_CAST((iVar6 + 0x33c))) - (this->_pos).x)); - pEVar8 = (Entity *) - ((*GHIDRA_CAST((iVar6 + 0x364)) + *GHIDRA_CAST((iVar6 + 0x364)) + - *GHIDRA_CAST((iVar6 + 0x340))) - (this->_pos).y); - if ((float)pEVar8 * (float)pEVar8 + (float)pRVar20 * (float)pRVar20 < - (float)local_d0 * (float)local_d0 + local_f4.y * local_f4.y) { - local_f4.y = (float)pEVar8; - local_d0 = pRVar20; - } - } -LAB_006e4978: - fVar17 = (float)(GHIDRA_INT(fVar17) + 1); - } while (GHIDRA_UINT(fVar17) < GHIDRA_UINT(local_28)); - } - local_c8.y = (float)local_d0 * (float)local_d0 + local_f4.y * local_f4.y; - if (2500.0 <= local_c8.y) { - fVar17 = (this->_velocity).y; - fVar19 = (this->_velocity).x; - if (((fVar19 * fVar19 + fVar17 * fVar17 <= 4.0) && - (pvVar11 = (this->_sprite)._animState._animData, pvVar11 != (void *)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x34)) != '\0')) { - pcVar12 = GHIDRA_CAST(s_Idle); - goto LAB_006e4bf6; - } - } - else { - local_e8._shift1 = 5; - local_e8._shift2 = 9; - local_e8._seed = this->_initSeed * ((g_game->_frameCount - this->_spawnFrame) / 10); - if (local_e8._seed == 0) { - local_e8._seed = 1; - } - local_e8._shift3 = 7; - (GHIDRA_CAST((&local_e8)))->RNG::Next(); - local_e8._shift3 = - GHIDRA_INT(((float)((double)local_e8._seed + __uint_to_double_fixup[-(local_e8._seed >> 0x1f)]) - * 2.3283062e-10 * 180.0 - 90.0)); - local_cc = GHIDRA_CAST(((local_c8.y * 3.0) / 2500.0)); - fVar17 = sqrtf(local_c8.y); - if (fVar17 <= 0.0) { - local_c8.y = (float)local_d0; - local_cc = GHIDRA_CAST(local_f4.y); - } - else { - local_c8.y = ((float)local_cc / fVar17) * (float)local_d0; - local_cc = GHIDRA_CAST((((float)local_cc / fVar17) * local_f4.y)); - } - local_e8._shift3 = GHIDRA_INT(((float)local_e8._shift3 * 0.017453292)); - local_d0 = GHIDRA_CAST(cos((float)local_e8._shift3)); - fVar19 = sin((float)local_e8._shift3); - fVar17 = this->_friction; - if (fVar17 != 0.0) { - fVar16 = this->_speedMultiplier; - (this->_velocity).y = - (fVar16 * -(fVar19 * local_c8.y + (float)local_d0 * (float)local_cc)) / fVar17 + - (this->_velocity).y; - (this->_velocity).x = - (fVar16 * -((float)local_d0 * local_c8.y - fVar19 * (float)local_cc)) / fVar17 + - (this->_velocity).x; - } - if (this->_entityCollisionClass != 0) { - pcVar12 = "IdlePanic"; -LAB_006e4bf6: - ANM2::Play(&this->_sprite,GHIDRA_CAST(pcVar12),0); - } - } - local_14 = 0xffffffff; - if (local_34[0] == '\0') { - local_14 = 4; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_34)) + 0x4))),0); - local_14 = 0xffffffff; - } - } - if (((this->_variant == 100) && (this->_subtype == 0x226)) && - ((this->_isTouched != 0 && - ((*GHIDRA_CAST(g_game->_room) != '\0' && - (g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)) == 4)))))) { - uVar7 = Random(); - local_c8.x = (this->_pos).x + 0.0; - local_c8.y = (this->_pos).y + 10.0; - Game::Spawn(g_game,1000,0xf,&local_c8,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - (GHIDRA_CAST((&tmpColor)))->Color::Color(); - (*extraout_EDX_00)(); - this->_timeout = 4; - this->_entityCollisionClass = 0; - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - bVar4 = IsChest(this->_variant); - if (bVar4 == 0) { - if ((extraout_ECX == 0x154) || (extraout_ECX == 0x172)) { - (this->_velocity).x = (this->_velocity).x * 0.6; - (this->_velocity).y = (this->_velocity).y * 0.6; - fVar17 = (this->_targetPosition).x; - fVar19 = (this->_pos).x; - fVar16 = (this->_targetPosition).y - (this->_pos).y; - (this->_sizeMulti).x = 2.0; - (this->_sizeMulti).y = 1.0; - (this->_velocity).x = fVar17 - fVar19; - goto LAB_006e4deb; - } - } - else if ((this->_flags & 0x400000000000000) == 0) { - (this->_velocity).x = (this->_velocity).x * 0.8; - fVar16 = (this->_velocity).y * 0.8; -LAB_006e4deb: - (this->_velocity).y = fVar16; - } - if (this->_variant == 100) { - this->_mass = 8.0; - this->_friction = this->_friction * 0.8; - update_cycle_collectible(this,0); - } - else if ((this->_flags & 0x400000000000000) == 0) { - this->_friction = this->_friction * 0.965; - } - update_magnet_attraction(this); - if ((this->_isAutoUpdatePrice != 0) && (this->_price != 0)) { - local_c8.x = (this->_pos).x; - local_c8.y = (this->_pos).y; - player = Game::GetNearestPlayerEx(&local_c8,1,0,0); - (GHIDRA_CAST((g_game->_room)))->Room::GetShopItemPrice(this->_variant,this->_subtype,this->_shopItemId,player); - iVar6 = _Room::ResolveHeartSubType(); - if (this->_price != iVar6) { - update_price_sprite(this,iVar6); - } - } - local_bd = IsChest(this->_variant); - game = g_game; - uVar7 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - flags = this->_flags; - isDead = this->_dead; - if ((uVar7 & 0x100) == 0) { - if ((isDead == 0) || - (((this->_sprite)._animState._animData != (void *)0x0 && - ((this->_sprite)._animState._isPlaying != 0)))) { - if ((this->_sprite)._animState._animData != (void *)0x0) { - if ((this->_sprite)._animState._isPlaying == 0) { - pbVar9 = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((pbVar9 + 0x14))) { - pbVar9 = *GHIDRA_CAST(pbVar9); - } - pcVar12 = "Appear"; - do { - bVar4 = *pbVar9; - bVar15 = bVar4 < (uint8_t)*pcVar12; - if (bVar4 != *pcVar12) { -LAB_006e52d2: - uVar7 = -GHIDRA_UINT(bVar15) | 1; - goto LAB_006e52d7; - } - if (bVar4 == 0) break; - bVar4 = pbVar9[1]; - bVar15 = bVar4 < (uint8_t)pcVar12[1]; - if (bVar4 != pcVar12[1]) goto LAB_006e52d2; - pbVar9 = pbVar9 + 2; - pcVar12 = pcVar12 + 2; - } while (bVar4 != 0); - uVar7 = 0; -LAB_006e52d7: - if (uVar7 != 0) { - if ((this->_sprite)._animState._isPlaying != 0) goto LAB_006e5393; - uVar21 = _string_holder_c_str(); - do { - expectedAnimChar = GHIDRA_CAST(((uint64_t)uVar21 >> 0x20)); - pbVar9 = GHIDRA_CAST(uVar21); - bVar4 = *pbVar9; - bVar15 = bVar4 < *expectedAnimChar; - if (bVar4 != *expectedAnimChar) { -LAB_006e5320: - uVar7 = -GHIDRA_UINT(bVar15) | 1; - goto LAB_006e5325; - } - if (bVar4 == 0) break; - bVar4 = pbVar9[1]; - bVar15 = bVar4 < expectedAnimChar[1]; - if (bVar4 != expectedAnimChar[1]) goto LAB_006e5320; - uVar21 = CONCAT44(expectedAnimChar + 2,pbVar9 + 2); - } while (bVar4 != 0); - uVar7 = 0; -LAB_006e5325: - if (uVar7 != 0) { - uVar21 = _string_holder_c_str(); - do { - expectedAnimChar = GHIDRA_CAST(((uint64_t)uVar21 >> 0x20)); - pbVar9 = GHIDRA_CAST(uVar21); - bVar4 = *pbVar9; - bVar15 = bVar4 < *expectedAnimChar; - if (bVar4 != *expectedAnimChar) { -LAB_006e5356: - uVar7 = -GHIDRA_UINT(bVar15) | 1; - goto LAB_006e535b; - } - if (bVar4 == 0) break; - bVar4 = pbVar9[1]; - bVar15 = bVar4 < expectedAnimChar[1]; - if (bVar4 != expectedAnimChar[1]) goto LAB_006e5356; - uVar21 = CONCAT44(expectedAnimChar + 2,pbVar9 + 2); - } while (bVar4 != 0); - uVar7 = 0; -LAB_006e535b: - if (uVar7 != 0) goto LAB_006e5393; - } - } - if ((local_bd == 0) || (this->_subtype != 0)) { - ANM2::Play(&this->_sprite,s_Idle,0); - goto LAB_006e53e7; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST("Opened"),0); - } - else { -LAB_006e5393: - bVar4 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("DropSound")); - if (((bVar4 != 0) && (PlayDropSound(this), local_bd == 0)) && - ((bVar4 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("Appear")), bVar4 != 0 || - ((bVar4 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("AppearFast")), bVar4 != 0 || - (bVar4 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("Reappear")), bVar4 != 0)))))) { -LAB_006e53e7: - this->_entityCollisionClass = 4; - if (this->_variant == 0x29) { - this->_entityGridCollisionClass = 5; - } - } - } - } - } - else { - this->Remove(); - } - } - else if (isDead == 0) { - iVar6 = g_game->_frameCount - this->_spawnFrame; - if (this->_variant == 100) { - if (iVar6 == 3) { - piVar13 = &(this->_sprite)._bitflags; - *piVar13 = *piVar13 | 2; - } - else if (iVar6 == 4) { - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - iVar6 = ItemPool::CreateGlitchedCollectible(&game->_proceduralItemManager,uVar7,0); - this->_subtype = iVar6; - UpdateSprite(this,1); - uVar7 = this->_subtype; - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar7)) goto LAB_006e4fc5; - } - else { - if (GHIDRA_INT(uVar7) < 0) { - if ((GHIDRA_INT(uVar7) < 0) && - (pvVar11 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar7) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar11) >> 2)) { - iVar6 = **GHIDRA_CAST((GHIDRA_CAST(pvVar11) + ~uVar7 * 4)); - } - else { - iVar6 = 0; - } - } - else { -LAB_006e4fc5: - pvVar11 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar11) >> 2 <= GHIDRA_INT(uVar7)) - goto LAB_006e5401; - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + uVar7 * 4)); - } - if (iVar6 != 0) { - this->_charge = *GHIDRA_CAST((iVar6 + 0x74)); - if (-1 < *GHIDRA_CAST((iVar6 + 200))) { - this->_charge = *GHIDRA_CAST((iVar6 + 200)); - } - } - } - } - else if (4 < iVar6) goto LAB_006e5014; - } - else if (iVar6 < 6) { - if (iVar6 == 5) { - iVar6 = ANM2::GetFrame(&this->_sprite); - if (((this->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)(iVar6 + 2)), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } - } - } - else if ((iVar6 < 10) || ((iVar6 < 0xf && (uVar7 = Random(), (uVar7 & 7) != 0)))) { - if ((GHIDRA_UINT((this->_sprite)._bitflags) >> 1 & 1) == 0) { - uVar7 = Random(); - if (uVar7 % 6 == 0) { - piVar13 = &(this->_sprite)._bitflags; - *piVar13 = *piVar13 | 2; - } - else { - uVar7 = Random(); - if ((uVar7 & 7) == 0) { - uVar7 = Random(); - iVar6 = ANM2::GetFrame(&this->_sprite); - jitterFrame = iVar6 + -2 + uVar7 % 5; - uVar7 = 6; - if (6 < jitterFrame) { - uVar7 = jitterFrame; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(uVar7); - } - } - } - else { - uVar7 = Random(); - if ((uVar7 & 1) == 0) { - piVar13 = &(this->_sprite)._bitflags; - *piVar13 = *piVar13 & 0xfffffffd; - } - } - } - else { - piVar13 = &(this->_sprite)._bitflags; - *piVar13 = *piVar13 & 0xfffffffd; - flags = this->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 & 0xfffffeff; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(flags); - animName = ANM2::GetAnimation(GHIDRA_CAST(&(this->_sprite)._animState), - GHIDRA_CAST((local_bc + 0x10))); - local_14 = 5; - if (0xf < animName->_capacity) { - animName = *GHIDRA_CAST(animName->_buf); - } - bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(animName),1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - local_14 = 0xffffffff; - (GHIDRA_CAST((local_bc + 0x10)))->msvc::string::_Tidy_deallocate(); - pVVar10 = MusicManager::RandomVector(GHIDRA_CAST((local_4c + 8))); - local_c8.y = pVVar10->x * 8.0; - local_e8._shift3 = GHIDRA_INT((pVVar10->y * 8.0)); - (GHIDRA_CAST((GHIDRA_CAST(local_4c))))->RNG::game_constructor(this->_initSeed,3); - uVar7 = (GHIDRA_CAST((explosionSprite)))->RNG::Next(); - local_f4.x = local_c8.y + (this->_pos).x; - local_f4.y = (float)local_e8._shift3 + (this->_pos).y; - pEVar8 = Game::Spawn(g_game,this->_type,this->_variant,&local_f4,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),this->_subtype,uVar7); - pEVar8->Update(); - (this->_pos).x = (this->_pos).x - local_c8.y; - (this->_pos).y = (this->_pos).y - (float)local_e8._shift3; - } - } - else { -LAB_006e5014: - piVar13 = &(this->_sprite)._bitflags; - *piVar13 = *piVar13 & 0xfffffffd; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(flags); - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar7 & 0xfffffeff; - } -LAB_006e5401: - if ((this->_variant == 0x3a) && (this->_subtype != 0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x4))) = *GHIDRA_CAST(&this->_flags); - flags = this->_flags; - if (((flags & 0x200000000000000) == 0) || - (((flags & 0x400000000000000) != 0 || (this->_child != 0)))) { - if ((this->_collisionCooldown < 1) && - ((this->_entityCollisionClass != 0 && ((flags & 0x600000000000000) == 0)))) { - pVVar10 = &this->_pos; - player = Game::GetNearestPlayer(g_game,pVVar10); - fVar17 = pVVar10->x - (player->_pos).x; - fVar19 = (this->_pos).y - (player->_pos).y; - if (fVar19 * fVar19 + fVar17 * fVar17 < 10000.0) { - uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pEVar8 = Game::Spawn(g_game,0x330,0,pVVar10,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - pEVar8->_renderDepthOffset = 6.0; - flags = this->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 | 0x2000000; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(flags); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&pEVar8->_flags) + 4)); - iVar6 = *GHIDRA_CAST(pEVar8); - *GHIDRA_CAST(&pEVar8->_flags) = GHIDRA_UINT(pEVar8->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar8->_flags) + 4)) = flagsHigh; - (**(code **)(iVar6 + 0xc))(); - (GHIDRA_CAST((&tmpColor)))->Color::Color(1.0,1.0,1.0,0.0); - (*extraout_EDX_01)(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetChild(pEVar8); - } - } - } - else { - this->_visible = 1; - bVar4 = TryOpenChest(this,GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - RemoveOtherOptions(); - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)); - if ((iVar6 == 0xb) || (iVar6 == 0x11)) { - (GHIDRA_CAST((&g_game->_ambush)))->Ambush::StartChallenge(); - } - } - } - } - if ((this->_variant == 10) && (this->_subtype == 0xc)) { - if ((this->_sprite)._animState._animData == (void *)0x0) { - local_bd = 0; -LAB_006e55e8: - fVar17 = (this->_velocity).y; - fVar19 = (this->_velocity).x; - fVar17 = sqrtf(fVar19 * fVar19 + fVar17 * fVar17); - if (3.0 < fVar17) { - uVar7 = Random(); - if (uVar7 % 3 == 0) goto LAB_006e562c; - } - } - else { - local_bd = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("DropSound")); - if (local_bd == 0) goto LAB_006e55e8; -LAB_006e562c: - uVar7 = Random(); - pEVar8 = Game::Spawn(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - uVar7 = Random(); - virtualFn = *(code **)(*GHIDRA_CAST(pEVar8) + 0x3c); - fVar19 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.4 + 0.2; - fVar17 = fVar19 * g_vectorOne.x; - (pEVar8->_sprite)._scale.y = fVar19 * g_vectorOne.y; - (pEVar8->_sprite)._scale.x = fVar17; - (GHIDRA_CAST((&tmpColor)))->Color::Reset(); - tmpColor._tint[0] = (float)0x3f333333; - tmpColor._tint[1] = (float)0x3f666666; - tmpColor._tint[2] = (float)0x3f266666; - tmpColor._tint[3] = 1.0; - (*virtualFn)(); - pEVar8->Update(); - if (local_bd == 0) { - this = local_f8; - } - else { - uVar7 = Random(); - this = local_f8; - for (iVar6 = uVar7 % 3 + 1; iVar6 != 0; iVar6 = iVar6 + -1) { - uVar7 = Random(); - fVar17 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10; - local_d0 = GHIDRA_CAST((fVar17 + fVar17 + 1.0)); - uVar7 = Random(); - fVar17 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_c8.y = fVar17 + fVar17; - local_cc = GHIDRA_CAST(sin(local_c8.y)); - uVar7 = Random(); - local_e8._shift3 = - GHIDRA_INT(((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 0.5 * this->_size)); - fVar17 = cos(local_c8.y); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x8))) = fVar17 * (float)local_e8._shift3 + (this->_pos).x; - local_40 = GHIDRA_CAST(((float)local_cc * (float)local_e8._shift3 + (this->_pos).y)); - uVar7 = Random(); - fVar17 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_c8.y = fVar17 + fVar17; - local_e8._shift3 = GHIDRA_INT(sin(local_c8.y)); - fVar17 = cos(local_c8.y); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_34)) + 0x8))) = fVar17 * (float)local_d0; - local_28 = (float)local_d0 * (float)local_e8._shift3 * 0.5; - uVar7 = Random(); - Game::Spawn(g_game,1000,0x3f,GHIDRA_CAST((local_4c + 8)),GHIDRA_CAST((local_34 + 8)), - GHIDRA_CAST(0x0),0,uVar7); - } - } - } - } - if ((((this->_variant == 0x39) && (this->_subtype != 0)) && - ((this->_sprite)._animState._animData != (void *)0x0)) && - (bVar4 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,s_Open), bVar4 != 0)) { - if (this->_subtype == 1) { - player = GHIDRA_CAST(this->_target); - if ((player == GHIDRA_CAST(0x0)) || (player->_type != 1)) { - player = GHIDRA_CAST(0x0); - } - bVar4 = TryOpenChest(this,player); - if (bVar4 != 0) { - RemoveOtherOptions(); - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)); - if ((iVar6 == 0xb) || (iVar6 == 0x11)) { - (GHIDRA_CAST((&g_game->_ambush)))->Ambush::StartChallenge(); - } - } - } - else { - this->_subtype = this->_subtype + -1; - } - } - if ((((this->_variant == 100) && (g_game->_currentDimensionIdx == 2)) && - (this->_optionsPickupIndex == 1)) && - ((0 < g_game->_deathCertificateExitTimer && (this->_timeout < 1)))) { - uVar7 = Random(); - local_28 = (this->_pos).y + 10.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_34)) + 0x8))) = (this->_pos).x + 0.0; - Game::Spawn(g_game,1000,0xf,GHIDRA_CAST((local_34 + 8)),&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - this->_timeout = 4; - } - if ((0 < this->_timeout) && (iVar6 = this->_timeout + -1, this->_timeout = iVar6, iVar6 == 0)) { - this->Remove(); - } - if (0 < this->_wait) { - this->_wait = this->_wait + -1; - } - if (((0 < this->_chestReCloseTimer) && - (iVar6 = this->_chestReCloseTimer + -1, this->_chestReCloseTimer = iVar6, iVar6 == 0)) && - (this->_variant == 0x35)) { - this->_subtype = 1; - ANM2::Play(&this->_sprite,GHIDRA_CAST("Close"),0); - manager = g_manager; - local_c8.y = 2.94273e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_c8.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c8.y),1.0,2,0,1.0,0.0); - this->_wait = 0x1e; - UpdateLootPreview(this); - } - pRVar20 = g_game->_room; - if (pRVar20->_roomType == 0x10) { - local_c8.x = (this->_pos).x + 0.0; - local_c8.y = (this->_sizeMulti).y * this->_size + 0.5 + (this->_pos).y; - pos.y = local_c8.y; - pos.x = local_c8.x; - iVar6 = (GHIDRA_CAST((pRVar20)))->Room::GetGridCollisionAtPos(pos); - if (iVar6 != 4) { - piVar13 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar20)) + 0x4)))) + 0x10)); - if (((piVar13 == GHIDRA_CAST(0x0)) || (piVar13[2] != 0x10)) || (*piVar13 != 0x23)) { - (this->_velocity).y = (this->_velocity).y + 0.9; - } - else { - (this->_velocity).y = (this->_velocity).y + 0.4; - this->_friction = this->_friction * 0.95; - } - } - piVar13 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)); - if (((piVar13 != GHIDRA_CAST(0x0)) && (piVar13[2] == 0x10)) && - ((*piVar13 == 0x23 && - (((2 < g_game->_frameCount - this->_spawnFrame && (0.0 < (this->_velocity).y)) && - (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x20)) - 30.0 < (this->_pos).y)))))) { - this->Remove(); - uVar7 = Random(); - pEVar8 = Game::Spawn(g_game,1000,0x10,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0x42,uVar7); - pEVar8->Update(); - } - } - bVar4 = Game::IsInTimedSet(g_game,0xb); - if ((bVar4 != 0) && - (((iVar6 = this->_variant, iVar6 == 10 || (iVar6 == 0x1e)) || - ((((iVar6 == 0x28 || ((iVar6 == 0x14 || (iVar6 == 0x46)))) || (iVar6 == 0x5a)) || - (((iVar6 == 300 || (iVar6 == 0x15e)) || (bVar4 = IsChest(iVar6), bVar4 != 0)))))))) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - player = Game::GetNearestPlayerEx(&this->_pos,1,0,0); - if (player != GHIDRA_CAST(0x0)) { - fVar17 = this->_friction; - fVar19 = (player->_lastVelocity).x; - fVar16 = (player->_lastVelocity).y; - if (fVar17 != 0.0) { - fVar18 = this->_speedMultiplier; - (this->_velocity).y = (fVar18 * (fVar16 + fVar16)) / fVar17 + (this->_velocity).y; - (this->_velocity).x = (fVar18 * (fVar19 + fVar19)) / fVar17 + (this->_velocity).x; - } - } - } - game = g_game; - bVar4 = Game::IsInTimedSet(g_game,5); - if ((bVar4 != 0) || (bVar4 = Game::IsInTimedSet(game,6), bVar4 != 0)) { - game = g_game; - if (g_game->_frameCount - this->_spawnFrame < 2) { - local_cc = GHIDRA_CAST((((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5)); - local_c8.y = g_displayPixelRatio * g_screenPointScale; - local_e8._shift3 = - GHIDRA_INT(((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_c8.y + 0.5 - )); - dVar22 = floor((double)(float)local_e8._shift3); - local_d0 = GHIDRA_CAST(((float)dVar22 / local_c8.y)); - local_e8._shift3 = GHIDRA_INT((local_c8.y * (float)local_cc + 0.5)); - dVar22 = floor((double)(float)local_e8._shift3); - local_c8.y = (float)dVar22 / local_c8.y; - pvVar11 = game->_room; - local_cc = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x11fc)); - local_e8._shift3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1200)); - (GHIDRA_CAST((&local_f4)))->shared_ptr::assign((void *)(GHIDRA_INT(pvVar11) + 0x1bc8)); - local_14 = 6; - virtualFn = *(code **)(*GHIDRA_CAST(local_f4.x) + 0x2c); - __ftoui3(); - __ftoui3(); - (*virtualFn)(); - local_14 = 7; - if (((GHIDRA_CAST(local_f4.y) != GHIDRA_CAST(0x0)) && - (cVar5 = (**(code **)(*GHIDRA_CAST(local_f4.y) + 0xc))(), cVar5 != '\0')) && - (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(); - } - this = local_f8; - local_14 = 0xffffffff; - (local_f8->_colorMod)._tint[3] = 1.0; - (local_f8->_colorMod)._tint[0] = 0.0; - (local_f8->_colorMod)._tint[1] = 0.0; - (local_f8->_colorMod)._tint[2] = 0.0; - (local_f8->_colorMod)._tint[3] = 0.7; - (local_f8->_colorMod)._offset[0] = local_50 * 0.9; - (local_f8->_colorMod)._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_4c)) + 0x0))) * 0.9; - (local_f8->_colorMod)._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_4c)) + 0x4))) * 0.9; - (GHIDRA_CAST((GHIDRA_CAST(&local_f8->_sprite))))->Sprite::SetColor(&local_f8->_colorMod); - } - game = g_game; - if (GHIDRA_UINT((g_game->_frameCount + this->_index)) % 0x1e < 2) { - local_cc = GHIDRA_CAST((((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5)); - local_c8.y = g_displayPixelRatio * g_screenPointScale; - local_e8._shift3 = - GHIDRA_INT((local_c8.y * (((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) + 0.5 - )); - dVar22 = floor((double)(float)local_e8._shift3); - local_f8 = GHIDRA_CAST(((float)dVar22 / local_c8.y)); - local_e8._shift3 = GHIDRA_INT((local_c8.y * (float)local_cc + 0.5)); - dVar22 = floor((double)(float)local_e8._shift3); - local_c8.y = (float)dVar22 / local_c8.y; - pvVar11 = game->_room; - local_cc = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x11fc)); - local_e8._shift3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1200)); - (GHIDRA_CAST((&renderTarget)))->shared_ptr::assign((void *)(GHIDRA_INT(pvVar11) + 0x1bc8)); - local_14 = 8; - (**(code **)(*renderTarget + 0x2c))(); - local_14 = 9; - if (((local_d0 != GHIDRA_CAST(0x0)) && - (cVar5 = (**(code **)(GHIDRA_INT(*GHIDRA_CAST(local_d0)) + 0xc))(), cVar5 != '\0')) && - (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(); - } - local_14 = 0xffffffff; - fVar17 = (this->_colorMod)._tint[3]; - (this->_colorMod)._tint[3] = (0.7 - fVar17) * 0.3 + fVar17; - fVar17 = (this->_colorMod)._offset[2]; - fVar19 = (this->_colorMod)._offset[0]; - fVar16 = (this->_colorMod)._offset[1]; - (this->_colorMod)._offset[2] = ((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_4c)) + 0x4))) * 0.9 - fVar17) * 0.5 + fVar17; - (this->_colorMod)._offset[1] = ((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_4c)) + 0x0))) * 0.9 - fVar16) * 0.5 + fVar16; - (this->_colorMod)._offset[0] = (local_50 * 0.9 - fVar19) * 0.5 + fVar19; - } - tmpColor._tint[0] = (this->_sprite)._color._tint[0]; - tmpColor._tint[1] = (this->_sprite)._color._tint[1]; - tmpColor._tint[2] = (this->_sprite)._color._tint[2]; - tmpColor._tint[3] = (this->_sprite)._color._tint[3]; - tmpColor._offset[2] = (this->_sprite)._color._offset[2]; - spriteColor = &(this->_sprite)._color; - tmpColor._colorize[0] = (this->_sprite)._color._colorize[0]; - tmpColor._colorize[1] = (this->_sprite)._color._colorize[1]; - tmpColor._colorize[2] = (this->_sprite)._color._colorize[2]; - tmpColor._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpColor._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - Color::Lerp(&lerpedColor,GHIDRA_CAST(&tmpColor),&this->_colorMod,0.1); - if (spriteColor != &lerpedColor) { - spriteColor->_tint[0] = 0.01; - (this->_sprite)._color._tint[1] = 0.01; - (this->_sprite)._color._tint[2] = 0.01; - (this->_sprite)._color._tint[3] = 1.0; - (this->_sprite)._color._colorize[0] = lerpedColor._colorize[0]; - (this->_sprite)._color._colorize[1] = lerpedColor._colorize[1]; - (this->_sprite)._color._colorize[2] = lerpedColor._colorize[2]; - (this->_sprite)._color._colorize[3] = lerpedColor._colorize[3]; - *GHIDRA_CAST((this->_sprite)._color._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(lerpedColor._offset)) + 0x0))); - (this->_sprite)._color._offset[2] = lerpedColor._offset[2]; - } - } - game = g_game; - uVar7 = this->_timeout; - if ((GHIDRA_INT(uVar7) < 1) || (this->_variant == 100)) { - bVar4 = Game::IsInTimedSet(g_game,0x48); - if (bVar4 != 0) { - iVar6 = this->_spawnFrame; - uVar7 = game->_frameCount - iVar6; - if (0x96 < GHIDRA_INT(uVar7)) { - uVar7 = uVar7 & 0x80000001; - if (GHIDRA_INT(uVar7) < 0) { - uVar7 = (uVar7 - 1 | 0xfffffffe) + 1; - } - if (uVar7 == 1) { - (GHIDRA_CAST((&tmpColor)))->Color::Reset(); - tmpColor._offset[0] = 0.0; - tmpColor._offset[1] = 0.0; - tmpColor._tint[0] = 0.0; - tmpColor._tint[1] = 0.0; - tmpColor._tint[2] = 0.0; - tmpColor._tint[3] = 0.0; - tmpColor._offset[2] = 0.0; - this->SetColor(); - iVar6 = this->_spawnFrame; - } - } - if (0xd2 < g_game->_frameCount - iVar6) { -LAB_006e42ba: - this->Remove(); - ExceptionList = local_1c; - return; - } - } - } - else if (GHIDRA_INT(uVar7) < 0x1e) { - uVar7 = uVar7 & 0x80000001; - if (GHIDRA_INT(uVar7) < 0) { - uVar7 = (uVar7 - 1 | 0xfffffffe) + 1; - } - if (uVar7 == 1) { - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->Color::Reset(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x4))) = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x8))) = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x0))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x4))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x8))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0xc))) = 0.0; - local_40 = GHIDRA_CAST(0x0); - this->SetColor(); - } - } - if ((this->_variant == 0x14) && (this->_subtype == 6)) { - animName = ANM2::GetAnimation(GHIDRA_CAST(&(this->_sprite)._animState), - GHIDRA_CAST((local_bc + 0x10))); - puVar1 = &animName->_size; - if (0xf < animName->_capacity) { - animName = *GHIDRA_CAST(animName->_buf); - } - local_bd = str_eq(GHIDRA_CAST(animName),*puVar1,GHIDRA_CAST("Touched"),7); - (GHIDRA_CAST((local_bc + 0x10)))->msvc::string::_Tidy_deallocate(); - if (local_bd != 0) { - if ((this->_sprite)._animState._animData != (void *)0x0) { - bVar4 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("DropSound")); - manager = g_manager; - if (bVar4 != 0) { - local_c8.y = 3.237e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_c8.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c8.y),0.5,2,0,1.0,0.0); - } - } - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - ANM2::Play(&this->_sprite,s_Idle,0); - } - } - } - if (0 < this->_collisionCooldown) { - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { -LAB_006e6519: - this->_collisionCooldown = this->_collisionCooldown + -1; - } - else { - pbVar9 = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((pbVar9 + 0x14))) { - pbVar9 = *GHIDRA_CAST(pbVar9); - } - pcVar12 = "Appear"; - do { - bVar4 = *pbVar9; - bVar15 = bVar4 < (uint8_t)*pcVar12; - if (bVar4 != *pcVar12) { -LAB_006e64d7: - uVar7 = -GHIDRA_UINT(bVar15) | 1; - goto LAB_006e64dc; - } - if (bVar4 == 0) break; - bVar4 = pbVar9[1]; - bVar15 = bVar4 < (uint8_t)pcVar12[1]; - if (bVar4 != pcVar12[1]) goto LAB_006e64d7; - pbVar9 = pbVar9 + 2; - pcVar12 = pcVar12 + 2; - } while (bVar4 != 0); - uVar7 = 0; -LAB_006e64dc: - if (uVar7 != 0) { - pbVar9 = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((pbVar9 + 0x14))) { - pbVar9 = *GHIDRA_CAST(pbVar9); - } - pcVar12 = "AppearFast"; - do { - bVar4 = *pbVar9; - bVar15 = bVar4 < (uint8_t)*pcVar12; - if (bVar4 != *pcVar12) { -LAB_006e6510: - uVar7 = -GHIDRA_UINT(bVar15) | 1; - goto LAB_006e6515; - } - if (bVar4 == 0) break; - bVar4 = pbVar9[1]; - bVar15 = bVar4 < (uint8_t)pcVar12[1]; - if (bVar4 != pcVar12[1]) goto LAB_006e6510; - pbVar9 = pbVar9 + 2; - pcVar12 = pcVar12 + 2; - } while (bVar4 != 0); - uVar7 = 0; -LAB_006e6515: - if (uVar7 != 0) goto LAB_006e6519; - } - } - } - if (this->_variant == 0x154) { - local_e8._shift3 = this->_target; - if ((GHIDRA_CAST(local_e8._shift3) == GHIDRA_CAST(0x0)) || - ((GHIDRA_CAST(local_e8._shift3))->_type != 1)) { - local_e8._shift3 = GHIDRA_INT(Game)::GetPlayer(g_game,0); - } - if (this->_state == 1) { - ANM2::Play(&this->_sprite,s_Open,0); - uVar7 = 0; - playerManager = &g_game->_playerManager; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) - >> 2 != 0) { - do { - player = PlayerManager::GetPlayer(playerManager,uVar7); - game = g_game; - uVar7 = uVar7 + 1; - playerManager = &g_game->_playerManager; - (player->_velocity).x = g_vectorZero.x; - (player->_velocity).y = g_vectorZero.y; - player->_isControlsEnabled = 0; - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - flags = this->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 | 0x1000; - this->_state = this->_state + 1; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(flags); - this->_entityCollisionClass = 0; - (GHIDRA_CAST((local_e8._shift3 + 0x1b1c)))->x = g_vectorZero.x; - (GHIDRA_CAST((local_e8._shift3 + 0x1b1c)))->y = g_vectorZero.y; - Game::StartStageTransition(game,0,4,GHIDRA_CAST(local_e8._shift3)); - iVar6 = get_stage_ending_id(0); - if ((((iVar6 != 3) && (iVar6 != 4)) && (iVar6 != 5)) && ((iVar6 != 9 && (iVar6 != 0xc)))) { - SoundEffects::PlayWithFartOverride(0x433,1.0,2,0,1.0); - } - } - else if (this->_state == 2) { - iVar6 = ANM2::GetFrame(&this->_sprite); - if ((iVar6 == 6) && - (((iVar6 = get_stage_ending_id(0), iVar6 == 3 || (iVar6 == 4)) || - ((iVar6 == 5 || ((iVar6 == 9 || (iVar6 == 0xc)))))))) { - Game::End(g_game,iVar6); - ExceptionList = local_1c; - return; - } - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - this->_state = this->_state + 1; - manager = g_manager; - local_c8.y = 1.47417e-42; - seed_fart_sound_override(GHIDRA_CAST(&local_c8.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c8.y),1.0,2,0,1.0,0.0); - iVar6 = local_e8._shift3; - (GHIDRA_CAST((GHIDRA_CAST(local_e8._shift3))))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Trapdoor")); - fVar17 = (this->_pos).y; - (GHIDRA_CAST((iVar6 + 0x1b1c)))->x = (this->_pos).x + 0.0; - (GHIDRA_CAST((iVar6 + 0x1b1c)))->y = fVar17 + 20.0; - } - } - } - if (this->_variant != 0x172) goto LAB_006e686a; - player = GHIDRA_CAST(this->_target); - if ((player == GHIDRA_CAST(0x0)) || (player->_type != 1)) { - this->_state = 0; - goto LAB_006e686a; - } - if (this->_state == 1) { - player->_entityCollisionClass = 0; - player->_isControlsEnabled = 0; - (GHIDRA_CAST((player)))->Entity_Player::AnimatePickup(&this->_sprite,1,GHIDRA_CAST("Pickup")); - this->_state = this->_state + 1; - this->_visible = 0; - goto LAB_006e686a; - } - if (this->_state != 2) goto LAB_006e686a; - if (player->_isPlayingItemAnimation == 0) { -LAB_006e67da: - bVar4 = (GHIDRA_CAST((player)))->Entity_Player::IsHoldingItem(); - if (bVar4 != 0) goto LAB_006e686a; - } - else { - pvVar11 = (player->_bodySprite)._animState._animData; - if (pvVar11 == (void *)0x0) { - local_c8.y = 0.0; - } - else { - local_c8.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x30)); - } - puVar14 = GHIDRA_CAST(ANM2)::GetFrame(&player->_bodySprite); - if (puVar14 != &(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_c8.y) + -0x7898))))) + 0x7897)))) goto LAB_006e67da; - } - game = g_game; - player->_entityCollisionClass = 4; - if ((((game->_dailyChallenge)._id == 0) || (iVar6 = get_stage_ending_id(1), iVar6 == 0xff)) || - (iVar6 == 0)) { - Game::FinishChallenge(g_game); - } - else { - Game::End(g_game,iVar6); - } -LAB_006e686a: - if ((((this->_variant == 0x36) && (this->_subtype != 0)) && - ((this->_collisionCooldown < 1 && - ((this->_entityCollisionClass != 0 && - (bVar4 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x97), bVar4 == 0)))))) && - (player = Game::GetNearestPlayer(g_game,&this->_pos), - fVar19 = (this->_pos).x - (player->_pos).x, fVar17 = (this->_pos).y - (player->_pos).y, - fVar17 * fVar17 + fVar19 * fVar19 < 2500.0)) { - Morph(this,this->_type,0x34,this->_subtype,0,0,0); - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,14.0); - } - this->_entityCollisionClass = 4; - SoundEffects::PlayWithFartOverride(0xcd,1.0,2,0,1.0); - } - FUN_00862fe0(); - ExceptionList = local_1c; - return; -} - -// 006e69b0 -void Entity_Pickup::Render(Vector *offset) -{ - Vector *position; - code *pcVar1; - uint32_t uVar2; - LayerState *layer; - double dVar3; - uint8_t *puVar4; - Vector scratchPos; - float worldY; - float screenX; - float local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - float offsetX; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afb151; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - if (((this->_exists != 0) && (this->_visible != 0)) && (this->_dropDelay < 1)) { - if (this->_variant == 100) { - if (this->_megaChestCollectible[0] != (void *)0x0) { - return; - } - worldY = (this->_pos).y + (this->_posOffset).y; - scratchPos.y = (g_screenHeight - 182.0) * 0.5; - local_14 = g_displayPixelRatio * g_screenPointScale; - screenX = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_14 + 0.5; - ExceptionList = &local_10; - dVar3 = floor((double)screenX); - screenX = (float)dVar3 / local_14; - scratchPos.y = ((worldY - 140.0) * 0.65 + scratchPos.y) * local_14 + 0.5; - dVar3 = floor((double)scratchPos.y); - position = &this->_renderPosition; - offsetX = offset->x; - (this->_renderPosition).y = (float)dVar3 / local_14 + offset->y; - position->x = screenX + offsetX; - scratchPos.y = 0.0; - local_14 = 0.0; - if (((this->_altPedestalANM2)._loaded != 0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12bc)) != 5)) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80e40) && - (_Init_thread_header(), DAT_00c80e40 == -1)) { - _DAT_00c5d010 = 0x300000004; - DAT_00c5d018 = 0x1b; - puVar4 = &DAT_00b15710; - _atexit(GHIDRA_CAST<_func_4879 *>(&DAT_00b15710)); - local_8 = 0xffffffff; - _Init_thread_footer(&DAT_00c80e40,puVar4,uVar2); - } - if ((DAT_00c5d00c == 0) && - (KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")), DAT_00c5d00c == 0)) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar2 = DAT_00c5d00c >> ((uint8_t)_DAT_00c5d010 & 0x1f) ^ DAT_00c5d00c; - uVar2 = uVar2 << ((uint8_t)((uint64_t)_DAT_00c5d010 >> 0x20) & 0x1f) ^ uVar2; - DAT_00c5d00c = uVar2 >> ((uint8_t)DAT_00c5d018 & 0x1f) ^ uVar2; - (this->_altPedestalANM2)._color._tint[3] = - (float)((double)GHIDRA_INT(DAT_00c5d00c) + - __uint_to_double_fixup[-(GHIDRA_INT(DAT_00c5d00c) >> 0x1f)]) * 2.3283062e-10 * 0.15 + - 0.05; - if (this->_subtype != 0) { - scratchPos.y = -2.6; - } - scratchPos.x = scratchPos.y + position->x; - scratchPos.y = scratchPos.y + (this->_renderPosition).y; - (GHIDRA_CAST((GHIDRA_CAST(&this->_altPedestalANM2))))->Sprite::RenderLayer(1,&scratchPos,&g_vectorZero, - &g_vectorZero); - local_14 = 2.6; - } - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layer->_visible = 0; - AnimationState::Render - (&(this->_sprite)._overlayAnimState,position,&g_vectorZero,&g_vectorZero); - AnimationState::Render(&(this->_sprite)._animState,position,&g_vectorZero,&g_vectorZero); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layer->_visible = 1; - if (this->_megaChestCollectible[1] == (void *)0x0) { - scratchPos.x = local_14 + position->x; - scratchPos.y = local_14 + (this->_renderPosition).y; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RenderLayer(1,&scratchPos,&g_vectorZero,&g_vectorZero); - } - else { - scratchPos.x = (this->_sprite)._scale.x * -16.0 * 0.65 + position->x; - scratchPos.y = (this->_sprite)._scale.y * 0.0 * 0.65 + (this->_renderPosition).y; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RenderLayer(1,&scratchPos,&g_vectorZero,&g_vectorZero); - scratchPos.x = (this->_sprite)._scale.x * 16.0 * 0.65 + position->x; - scratchPos.y = (this->_sprite)._scale.y * 0.0 * 0.65 + (this->_renderPosition).y; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_megaChestCollectible[1]) + 0x48)))))->Sprite::RenderLayer(1,&scratchPos, - &g_vectorZero,&g_vectorZero); - } - } - else { - ExceptionList = &local_10; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); - } - if ((this->_priceANM2)._loaded != 0) { - ANM2::Render(&this->_priceANM2,&this->_renderPosition,&g_vectorZero,&g_vectorZero); - } - FUN_008630c0(this,offset); - } - ExceptionList = local_10; - return; -} - -// 006e6e40 -uint8_t Entity_Pickup::TryOpenChest(Entity_Player *player) -{ - code *pcVar1; - Vector *pVVar2; - Vector targetPos; - Vector targetPos_00; - uint8_t *puVar3; - uint8_t bVar4; - uint32_t uVar5; - Entity *spawned; - int lootContainer; - Entity_Pickup *pEVar6; - Entity_Player *pEVar7; - int extraout_ECX; - float fVar8; - float nudgeX; - int iVar9; - Vector lootSpawnPos; - Vector lootVelocity; - Vector randomVelocity; - Vector spiderTarget; - Vector playerChestMidpoint; - RNG dropRng; - int *loot [3]; - uint32_t lootFirst; - int lootCount; - float local_80; - void *local_7c; - uint32_t lootIndex; - Vector *chestPos; - float local_70; - Room *local_6c; - Entity_Player *openingPlayer; - Vector *local_64; - char isPickupSpawned; - float local_5c; - Entity_Pickup *chest; - uint8_t isPayToPlay; - uint32_t flashColor; - uint32_t uStack_4c; - uint32_t uStack_48; - uint32_t uStack_44; - uint32_t local_40; - uint32_t uStack_3c; - uint32_t uStack_38; - uint32_t uStack_34; - uint32_t local_30; - uint32_t uStack_2c; - uint32_t local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - int *local_14; - Game *game; - int *lootProxy; - Manager *manager; - ColorMod *poofColor; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00afb180; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((loot + 0x21)); - ExceptionList = &local_1c; - openingPlayer = player; - chest = this; - puVar3 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - if (player == GHIDRA_CAST(0x0)) { - openingPlayer = Game::GetNearestPlayerEx(&this->_pos,1,0,0); - puVar3 = puStack_20; - if (openingPlayer == GHIDRA_CAST(0x0)) { - openingPlayer = Game::GetPlayer(g_game,0); - puVar3 = puStack_20; - } - } - puStack_20 = puVar3; - if (this->_subtype == 0) { - bVar4 = 0; - } - else { - bVar4 = ANM2::SetAnimation(&this->_sprite,s_Open,1); - if (bVar4 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - manager = g_manager; - local_5c = 3.08286e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_5c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_5c),1.0,2,0,1.0,0.0); - manager = g_manager; - iVar9 = this->_variant; - if (((iVar9 == 0x3c) || (iVar9 == 0x35)) || (iVar9 == 0x37)) { - local_5c = 2.18603e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_5c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_5c),1.0,2,0,1.0,0.0); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0xc6,1); - } - uVar5 = Random(); - pVVar2 = &this->_pos; - chestPos = pVVar2; - spawned = Game::Spawn(g_game,1000,0xf,pVVar2,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar5); - fVar8 = (this->_sprite)._scale.x; - local_30 = 0; - uStack_2c = 0; - local_28 = 0; - poofColor = &(spawned->_sprite)._color; - (spawned->_posOffset).y = fVar8 * -10.0; - (spawned->_posOffset).x = fVar8 * 0.0; - fVar8 = (this->_sprite)._scale.y; - (spawned->_sprite)._scale.x = (this->_sprite)._scale.x * 0.8; - (spawned->_sprite)._scale.y = fVar8 * 0.8; - if (poofColor != GHIDRA_CAST(&flashColor)) { - (spawned->_sprite)._color._colorize[0] = 0.0; - (spawned->_sprite)._color._colorize[1] = 0.0; - (spawned->_sprite)._color._colorize[2] = 0.0; - (spawned->_sprite)._color._colorize[3] = 0.0; - (spawned->_sprite)._color._offset[0] = 0.0; - (spawned->_sprite)._color._offset[1] = 0.0; - poofColor->_tint[0] = 1.0; - (spawned->_sprite)._color._tint[1] = 1.0; - (spawned->_sprite)._color._tint[2] = 1.0; - (spawned->_sprite)._color._tint[3] = 0.3; - (spawned->_sprite)._color._offset[2] = 0.0; - } - spawned->_renderDepthOffset = 4.0; - isPickupSpawned = '\0'; - local_5c = (float)this->_variant; - isPayToPlay = this->_isPayToPlay; - GetChestLoot(this,loot,1,openingPlayer); - lootProxy = loot[0]; - local_14 = GHIDRA_CAST(0x0); - chest->_subtype = 0; - game = g_game; - if ((chest->_variant == 0x35) && (lootCount == 0)) { - chest->_chestReCloseTimer = 0; - *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x7894)) = 1; - if (1 < *GHIDRA_CAST(&game->_deathmatchManager)) { - uVar5 = Random(); - Game::Spawn(g_game,1000,0xf,pVVar2,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - manager = g_manager; - local_5c = 3.71344e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_5c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_5c),0.7,2,0,1.0,0.0); - chest->Remove(); - } - } - else { - dropRng._seed = (chest->_dropRNG)._seed; - dropRng._shift1 = 2; - dropRng._shift2 = 7; - dropRng._shift3 = 9; - local_70 = 0.0; - pEVar6 = chest; - uVar5 = lootFirst; - while( true ) { - pEVar7 = openingPlayer; - lootIndex = uVar5; - if (uVar5 == lootFirst + lootCount) break; - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (**GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) == 5) { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) + 4)) - != 100) goto LAB_006e746d; - if (local_5c == 5.46506e-43) { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) + 8)) - == 0x244) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x19f); - pEVar6 = chest; - } - } - if (pEVar6->_variant == 100) { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - local_64 = *(Vector **) - (*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) + - 0xc); - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - local_6c = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + - (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) + 8)); - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (lootProxy == GHIDRA_CAST(0x0)) { - lootContainer = 0; - } - else { - lootContainer = *lootProxy; - } - pEVar6 = (Entity_Pickup *) - Game::Spawn(g_game,**GHIDRA_CAST((*GHIDRA_CAST((lootContainer + 4)) + - (*GHIDRA_CAST((lootContainer + 8)) - 1U & uVar5) * 4)), - *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + - (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) + 4)), - chestPos,&g_vectorZero,GHIDRA_CAST(0x0),GHIDRA_UINT(local_6c),GHIDRA_UINT(local_64)) - ; - } - else { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (lootProxy == GHIDRA_CAST(0x0)) { - lootContainer = 0; - } - else { - lootContainer = *lootProxy; - } - Morph(pEVar6,5,*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((lootContainer + 4)) + - (*GHIDRA_CAST((lootContainer + 8)) - 1U & uVar5) * 4)) + 4)), - *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) + - 8)),0,0,0); - pEVar6 = chest; - } - if (((local_5c == 5.04467e-43) && (g_game->_difficulty != 2)) && - ((g_game->_difficulty != 3 && - ((g_game->_stage == 0xb && (g_game->_startingRoomIdx == g_game->_currentRoomIdx)))))) - { - MakeShopItem(pEVar6,-2); - uVar5 = Random(); - spawned = Game::Spawn(g_game,1000,0xf,&pEVar6->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5) - ; - flashColor = 0x3f800000; - uStack_4c = 0x3f800000; - uStack_48 = 0x3f800000; - uStack_44 = 0x3f800000; - local_30 = 0; - local_40 = 0x40000000; - uStack_3c = 0x3ecccccd; - uStack_38 = 0x3ecccccd; - uStack_34 = 0x3f800000; - uStack_2c = 0; - local_28 = 0; - spawned->SetColor(&flashColor,0xffffffff,0xff,0,1); - } - if (pEVar6->_variant == 100) { - (pEVar6->_targetPosition).x = chestPos->x; - (pEVar6->_targetPosition).y = chestPos->y; - if (GHIDRA_INT(local_5c) < 0x169) { - if (local_5c == 5.04467e-43) { - iVar9 = 5; - } - else { - switch(local_5c) { - case 7.00649e-44: - iVar9 = 10; - break; - case 7.14662e-44: - iVar9 = 6; - break; - case 7.28675e-44: - case 7.56701e-44: - iVar9 = 7; - break; - case 7.42688e-44: - iVar9 = 8; - if (isPayToPlay != 0) { - iVar9 = 0x11; - } - break; - case 7.70714e-44: - iVar9 = 0xc; - if (isPayToPlay != 0) { - iVar9 = 0x12; - } - break; - case 7.84727e-44: - iVar9 = 0xd; - break; - case 7.9874e-44: - iVar9 = 0xe; - if (isPayToPlay != 0) { - iVar9 = 0x13; - } - break; - default: - goto switchD_006e73d9_caseD_3a; - case 8.40779e-44: - iVar9 = 4; - if (isPayToPlay != 0) { - iVar9 = 0x10; - } - } - } - } - else { - if (local_5c != 5.46506e-43) goto switchD_006e73d9_caseD_3a; - iVar9 = 0xb; - } - SetAlternatePedestal(pEVar6,iVar9); - } -switchD_006e73d9_caseD_3a: - isPickupSpawned = '\x01'; -LAB_006e7459: - pEVar6 = chest; - uVar5 = lootIndex; -LAB_006e7467: - uVar5 = uVar5 + 1; - } - else { -LAB_006e746d: - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (**GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) == 0) { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) + 4)) - != 1) goto LAB_006e74e4; - Level::InitializeDevilAngelRoom(GHIDRA_CAST(g_game),0,0); - game = g_game; - g_game->_leaveDoor = -1; - Game::StartRoomTransition(game,-1,-1,3,openingPlayer,-1); - uVar5 = uVar5 + 1; - pEVar6 = chest; - } - else { -LAB_006e74e4: - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (**GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) == 0x55) { - local_64 = &pEVar6->_pos; - if (uVar5 == lootFirst) { - local_6c = g_game->_room; - pEVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((openingPlayer)) + 0x1450)))); - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((openingPlayer)) + 0x1450)))) == GHIDRA_CAST(0x0)) && - (pEVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((openingPlayer)) + 0x144c)))), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((openingPlayer)) + 0x144c)))) == GHIDRA_CAST(0x0))) { - if (openingPlayer->_darkArtsLastSnare == GHIDRA_CAST(0x0)) { - pEVar7 = openingPlayer; - } - else { - pEVar7 = (Entity_Player *) - (GHIDRA_CAST((openingPlayer->_darkArtsLastSnare)))->Entity::GetLastParent(); - } - } - playerChestMidpoint.x = ((pEVar7->_pos).x + local_64->x) * 0.5; - playerChestMidpoint.y = ((pEVar7->_pos).y + local_64->y) * 0.5; - Room::FindFreePickupSpawnPosition - (local_6c,&spiderTarget,&playerChestMidpoint,70.0,0,0,0); - targetPos.y = spiderTarget.y; - targetPos.x = spiderTarget.x; - Entity_NPC::ThrowSpider(&chest->_pos,GHIDRA_CAST(chest),targetPos,0,-30.0); - uVar5 = uVar5 + 1; - pEVar6 = chest; - } - else { - targetPos_00.y = g_vectorZero.y; - targetPos_00.x = g_vectorZero.x; - Entity_NPC::ThrowSpider(local_64,GHIDRA_CAST(pEVar6),targetPos_00,0,-30.0); - uVar5 = uVar5 + 1; - pEVar6 = chest; - } - } - else { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (**GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) == 3) { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4)) - + 4)) == 0x2b) { - (GHIDRA_CAST((openingPlayer)))->Entity_Player::AddBlueFlies(1,chestPos,GHIDRA_CAST(0x0)); - uVar5 = uVar5 + 1; - pEVar6 = chest; - } - else { - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4 - )) + 4)) != 0x49) goto LAB_006e7467; - openingPlayer->_numBlueSpiders = openingPlayer->_numBlueSpiders + 1; - spawn_blue_spider(chestPos,GHIDRA_CAST(openingPlayer),&g_vectorZero); - uVar5 = uVar5 + 1; - pEVar6 = chest; - } - } - else { - local_6c = GHIDRA_CAST(0x3f800000); - if ((pEVar6->_variant == 0x39) && - (local_6c = GHIDRA_CAST(((float)GHIDRA_INT(local_70) * 0.05 + 0.4)), 1.0 <= (float)local_6c)) - { - local_6c = GHIDRA_CAST(0x3f800000); - } - if (lootProxy == GHIDRA_CAST(0x0)) { - iVar9 = 0; - } - else { - iVar9 = *lootProxy; - } - local_7c = *(void **)(*GHIDRA_CAST((iVar9 + 4)) + (*GHIDRA_CAST((iVar9 + 8)) - 1U & uVar5) * 4); - Isaac::GetRandomPickupVelocity(&randomVelocity,&pEVar6->_pos,0,&dropRng); - lootVelocity.x = randomVelocity.x * (float)local_6c; - lootVelocity.y = randomVelocity.y * (float)local_6c; - if (dropRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - bVar4 = (*pcVar1)(); - return bVar4; - } - dropRng._seed = - GHIDRA_UINT(dropRng._seed) >> ((uint8_t)dropRng._shift1 & 0x1f) ^ dropRng._seed; - dropRng._seed = dropRng._seed << ((uint8_t)dropRng._shift2 & 0x1f) ^ dropRng._seed; - dropRng._seed = - GHIDRA_UINT(dropRng._seed) >> ((uint8_t)dropRng._shift3 & 0x1f) ^ dropRng._seed; - local_64 = GHIDRA_CAST(0xe); - if (dropRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - bVar4 = (*pcVar1)(); - return bVar4; - } - uVar5 = GHIDRA_UINT(dropRng._seed) >> 3 ^ dropRng._seed; - uVar5 = uVar5 << 1 ^ uVar5; - uVar5 = uVar5 >> 0xe ^ uVar5; - fVar8 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) - * 2.3283062e-10 * 3.14; - local_64 = GHIDRA_CAST((fVar8 + fVar8)); - lootSpawnPos.x = cos((float)local_64); - pVVar2 = chestPos; - lootSpawnPos.x = lootSpawnPos.x + chestPos->x; - lootSpawnPos.y = sin((float)local_64); - lootSpawnPos.y = lootSpawnPos.y + pVVar2->y; - spawned = (GHIDRA_CAST((local_7c)))->EntitySpawner::Spawn(&lootSpawnPos,&lootVelocity,GHIDRA_CAST(0x0)); - if ((spawned->_type == 5) && (chest->_variant == 0x39)) { - spawned[1]._sprite._championColor._offset[2] = (float)(GHIDRA_INT(local_70) / 2); - } - spawned->Update(); - local_70 = (float)(GHIDRA_INT(local_70) + 1); - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (spawned->_type == 1)) || - (spawned->_type - 10U < 0x3de)) { - local_7c = (void *)chestPos->x; - local_80 = chestPos->y; - local_6c = GHIDRA_CAST(((float)local_7c - (openingPlayer->_pos).x)); - local_64 = GHIDRA_CAST((local_80 - (openingPlayer->_pos).y)); - fVar8 = sqrtf((float)local_64 * (float)local_64 + - (float)local_6c * (float)local_6c); - if (fVar8 <= 0.0) { - nudgeX = (float)local_6c; - pVVar2 = local_64; - } - else { - nudgeX = (float)local_6c * (20.0 / fVar8); - pVVar2 = GHIDRA_CAST(((float)local_64 * (20.0 / fVar8))); - } - (spawned->_pos).x = (float)local_7c + nudgeX; - (spawned->_pos).y = local_80 + (float)pVVar2; - goto switchD_006e73d9_caseD_3a; - } - if ((spawned->_type != 5) || (bVar4 = IsChest(spawned->_variant), bVar4 == 0)) - goto LAB_006e7459; - fVar8 = (chest->_sprite)._scale.y; - (spawned->_sprite)._scale.x = (chest->_sprite)._scale.x * 0.8; - (spawned->_sprite)._scale.y = fVar8 * 0.8; - uVar5 = lootIndex + 1; - pEVar6 = chest; - } - } - } - } - } - pVVar2 = &pEVar6->_pos; - if (isPickupSpawned != '\0') { - local_70 = (pEVar6->_pos).y - (openingPlayer->_pos).y; - local_5c = pVVar2->x - (openingPlayer->_pos).x; - local_80 = local_70 * local_70 + local_5c * local_5c; - if (local_80 < 1600.0) { - local_7c = (void *)(openingPlayer->_velocity).x; - local_64 = GHIDRA_CAST((openingPlayer->_velocity).y); - fVar8 = sqrtf(local_80); - if (0.0 < fVar8) { - local_70 = (1.0 / fVar8) * local_70; - local_5c = (1.0 / fVar8) * local_5c; - } - fVar8 = sqrtf(local_80); - fVar8 = (40.0 - fVar8) * 0.4; - (pEVar7->_velocity).x = ((float)local_7c - fVar8 * local_5c) * 0.5; - (pEVar7->_velocity).y = ((float)local_64 - fVar8 * local_70) * 0.5; - pEVar6 = chest; - } - pEVar6->_wait = 0x14; - } - if (pEVar6->_variant == 0x35) { - pEVar6->_chestReCloseTimer = 0x3c; - } - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && - (bVar4 = IsChest(pEVar6->_variant), bVar4 != 0)) && (extraout_ECX != 0x35)) { - uVar5 = Random(); - Game::Spawn(g_game,1000,0xf,pVVar2,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - manager = g_manager; - local_64 = GHIDRA_CAST(0x109); - seed_fart_sound_override(GHIDRA_CAST(&local_64)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_64),0.7,2,0,1.0,0.0); - chest->Remove(); - } - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x7894)) = 1; - } - msvc::deque::clear(); - lootProxy = loot[0]; - loot[0] = GHIDRA_CAST(0x0); - operator_delete(lootProxy,8); - bVar4 = 1; - } - ExceptionList = local_1c; - return bVar4; -} - -// 006e7be0 -void Entity_Pickup::PlayDropSound() -{ - int iVar1; - uint8_t isChest; - int extraout_ECX; - int extraout_EDX; - int soundId; - Manager *manager; - - iVar1 = this->_variant; - if (iVar1 == 10) { - if (this->_subtype == 7) { - soundId = 0x1d2; - } - else if (this->_subtype == 0xb) { - soundId = 0x1d3; - } - else { - soundId = 0x44; - } - } - else if (iVar1 == 0x14) { - iVar1 = this->_subtype; - if (((iVar1 == 1) || (iVar1 == 5)) || (iVar1 == 4)) { - soundId = 0xe9; - } - else if ((iVar1 == 2) || (iVar1 == 6)) { - soundId = 0xe7; - } - else { - if ((iVar1 != 3) && (iVar1 != 7)) { - return; - } - soundId = 0xc6; - } - } - else if (iVar1 == 0x1e) { - soundId = 0x3b; - } - else { - if (iVar1 == 0x28) { - if (this->_subtype != 4) { - soundId = 0x28; - goto LAB_006e7d6b; - } - } - else { - if (iVar1 != 0x46) { - if (iVar1 == 0x45) { - soundId = 0x26; - } - else { - soundId = GHIDRA_INT(this); - isChest = IsChest(iVar1); - if (isChest == 0) { - if (extraout_ECX == 300) { - soundId = 0xf9; - } - else if (extraout_ECX == 0x15e) { - if (*GHIDRA_CAST((extraout_EDX + 0x30)) == 0x7a) { - soundId = 0x386; - } - else { - soundId = 0xf9; - } - } - else if (extraout_ECX == 0x6e) { - soundId = 0x1cf; - } - else if (extraout_ECX == 0x29) { - soundId = 0x28; - } - else { - if (extraout_ECX != 0x2a) { - return; - } - soundId = 0x102; - } - } - else { - soundId = 0x15; - } - } - goto LAB_006e7d6b; - } - if ((this->_subtype & 0x7ffU) != 0xe) { - soundId = 0x26; - goto LAB_006e7d6b; - } - } - soundId = 0x1d2; - } -LAB_006e7d6b: - manager = g_manager; - seed_fart_sound_override(&soundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); - return; -} - -// 006e7dc0 -void Entity_Pickup::PlayPickupSound() -{ - uint8_t bVar1; - ItemConfig_Card *cardConfig; - uint32_t uVar2; - int *proceduralItem; - Manager *manager; - bool bVar3; - float fVar4; - int iVar5; - RNG pitchRng; - float local_8; - Game *game; - - manager = g_manager; - iVar5 = this->_variant; - if (iVar5 == 10) { - iVar5 = this->_subtype; - if (iVar5 == 4) { - local_8 = 3.72745e-43; - } - else if ((iVar5 == 3) || (iVar5 == 8)) { - local_8 = 7.56701e-44; - } - else if (iVar5 == 6) { - local_8 = 6.55808e-43; - } - else if (iVar5 == 7) { - local_8 = 6.51604e-43; - } - else if (iVar5 == 0xb) { - local_8 = 6.45999e-43; - } - else if (iVar5 == 0xc) { - local_8 = 6.96445e-43; - } - else { - if (iVar5 == 10) { - return; - } - local_8 = 2.5924e-43; - } -LAB_006e8329: - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - iVar5 = 2; -LAB_006e8344: - fVar4 = 1.0; -LAB_006e834c: - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),fVar4,iVar5,0,1.0,0.0); - return; - } - if (iVar5 == 0x14) { - iVar5 = this->_subtype; - if (((iVar5 == 1) || (iVar5 == 4)) || (iVar5 == 7)) { - local_8 = 3.27904e-43; - } - else if ((iVar5 == 2) || (iVar5 == 6)) { - local_8 = 3.25101e-43; - } - else if (iVar5 == 3) { - local_8 = 2.78858e-43; - } - else { - if (iVar5 != 5) { - return; - } - local_8 = 2.8026e-43; - } - goto LAB_006e8329; - } - if (iVar5 == 0x1e) { - iVar5 = this->_subtype; - if (((iVar5 == 1) || (iVar5 == 3)) || (iVar5 == 4)) { - local_8 = 8.12753e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - iVar5 = 2; - fVar4 = 0.85; - goto LAB_006e834c; - } - if (iVar5 != 2) { - return; - } - local_8 = 2.85865e-43; - goto LAB_006e8329; - } - if (iVar5 == 0x28) { - if (this->_subtype == 4) { - local_8 = 6.5861e-43; - } - else { - local_8 = 2.81661e-43; - } - goto LAB_006e8329; - } - if (((iVar5 == 0x46) || (iVar5 == 0x15e)) || (iVar5 == 0x45)) { -LAB_006e8319: - local_8 = 3.53127e-43; - manager = g_manager; - goto LAB_006e8329; - } - if (iVar5 == 300) { - cardConfig = ItemConfig::GetCard(&g_manager->_itemConfig,this->_subtype); - if ((cardConfig == GHIDRA_CAST(0x0)) || - ((((iVar5 = cardConfig->pickupSubtype, iVar5 != 3 && (iVar5 != 4)) && - (((iVar5 != 6 && ((iVar5 != 7 && (iVar5 != 0xd)))) && (iVar5 != 0xf)))) && - (cardConfig->cardType != 2)))) { - local_8 = 1.12104e-44; - } - else { - local_8 = 3.53127e-43; - } - goto LAB_006e8329; - } - if (iVar5 != 100) { - if (iVar5 != 0x29) { - if (iVar5 == 0x2a) { - uVar2 = Random(); - SoundEffects::PlayWithFartOverride - (0x1ca,1.0,2,0, - (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10 * 0.3 + 0.9); - return; - } - return; - } - local_8 = 2.81661e-43; - goto LAB_006e8329; - } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40000); - if (bVar1 != 0) goto LAB_006e8319; - uVar2 = this->_subtype; - if (((GHIDRA_INT(uVar2) < 0) && (iVar5 = FUN_009e0180(uVar2), iVar5 != 0)) && - (*GHIDRA_CAST((iVar5 + 0xc)) != 0)) { - pitchRng._seed = *GHIDRA_CAST((iVar5 + 8)); - pitchRng._shift1 = 1; - pitchRng._shift2 = 5; - pitchRng._shift3 = 0x10; - fVar4 = (GHIDRA_CAST((&pitchRng)))->RNG::RandomFloat(); - local_8 = fVar4 * 1.4 + 0.2; - SoundEffects::PlayWithFartOverride(*GHIDRA_CAST((iVar5 + 0xc)),1.0,2,0,local_8); - return; - } - game = g_game; - if ((uVar2 != 0xffffffff) || - (bVar1 = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f), bVar1 == 0)) { - manager = g_manager; - if (uVar2 < 0x48) { - if ((uVar2 != 0x47) && (uVar2 != 0xb)) { - bVar3 = uVar2 == 0xc; -LAB_006e81cf: - if (!bVar3) { - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)); - if ((iVar5 == 5) || (iVar5 == 6)) { - local_8 = 1.80768e-43; - } - else if ((iVar5 == 4) || (iVar5 == 0xc)) { - local_8 = 1.79366e-43; - } - else if (iVar5 == 2) { - local_8 = 1.82169e-43; - } - else { - if (((iVar5 == 0xe) || (iVar5 == 0x16)) || - ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 4)) + 0x44)) >> 0xb & 1) != 0)) { - local_8 = 4.4281e-43; - goto LAB_006e8329; - } - local_8 = 3.22299e-44; - } - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - iVar5 = 2; - fVar4 = 0.5; - goto LAB_006e834c; - } - } - local_8 = 1.4013e-45; - } - else { - if (uVar2 != 0x5c) { - bVar3 = uVar2 == 0x271; - goto LAB_006e81cf; - } - local_8 = 2.36819e-43; - } - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - iVar5 = 0x1e; - goto LAB_006e8344; - } - iVar5 = PlayerManager::GetGFuelCount(); - manager = g_manager; - switch(iVar5) { - case 0: - case 1: - local_8 = 3.75548e-43; - goto LAB_006e8131; - case 2: - case 3: - goto switchD_006e808c_caseD_2; - case 4: - case 5: - local_8 = 1.84971e-43; - break; - default: - local_8 = 1.84971e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),1.0,2,0,1.0,0.0); - local_8 = 8.46384e-43; - } - manager = g_manager; - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),1.0,2,0,1.0,0.0); -switchD_006e808c_caseD_2: - local_8 = 8.43582e-43; -LAB_006e8131: - manager = g_manager; - seed_fart_sound_override(GHIDRA_CAST(&local_8)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),1.0,2,0,1.0,0.0); - uVar2 = Random(); - proceduralItem = GHIDRA_CAST(FUN_009e0180(this->_subtype)); - SimpleString::operator= - (GHIDRA_CAST((*proceduralItem + 0x20)), - (&PTR_s_GAMER_SPEED_UP__00b67e58)[uVar2 % 0x32]); - return; -} - -// 006e8380 -int Entity_Pickup::GetCoinValue() -{ - if ((this->_variant == 0x14) && (this->_subtype - 1U < 7)) { - return *GHIDRA_CAST((&DAT_00b67e34 + this->_subtype * 4)); - } - return 0; -} - -// 006e83a0 -uint32_t Entity_Pickup::can_player_buy(Entity_Player *param_2) -{ - uint8_t isInstantDeathCurse; - char isDamageTaken; - int iVar1; - int iVar2; - EntityRef *damageSource; - Entity_Player *this_00; - int extraout_EDX; - code *extraout_EDX_00; - bool isInstantDeathCurse; - bool bVar4; - EntityRef damageSourceRef; - uint8_t *redHeartCost; - uint8_t *soulHeartCost; - - if (param_2->_isCoopGhost != 0) { - return 0; - } - iVar2 = this->_price; - if (iVar2 < 1) { - if (iVar2 == -10) { - return 0; - } - } - else { - iVar1 = FUN_0041b770(0x209); - if (iVar1 + param_2->_numCoins < iVar2) { - return 0; - } - } - iVar1 = (GHIDRA_CAST((param_2)))->Entity_Player::GetHealthType(); - if (iVar1 == 2) { - return 1; - } - isInstantDeathCurse = (GHIDRA_CAST((this_00)))->Entity_Player::HasInstantDeathCurse(); - if (isInstantDeathCurse != 0) { - return 1; - } - if (iVar2 + 9U < 9) { - redHeartCost = ReferenceCount::vftable[iVar2 * -2 + 4]; - soulHeartCost = ReferenceCount::vftable[iVar2 * -2 + 5]; - if ((redHeartCost != GHIDRA_CAST(0x0)) || (soulHeartCost != GHIDRA_CAST(0x0))) { - if ((GHIDRA_INT(soulHeartCost) < 1) || (redHeartCost != GHIDRA_CAST(0x0))) { - if (GHIDRA_INT(redHeartCost) < 1) { - return 1; - } - if (0 < GHIDRA_INT(soulHeartCost)) { - iVar2 = (GHIDRA_CAST((param_2)))->Entity_Player::GetEffectiveMaxHearts(); - if (iVar2 < 2) { - return 0; - } - return 1; - } - if (soulHeartCost != GHIDRA_CAST(0x0)) { - return 1; - } - iVar2 = (GHIDRA_CAST((param_2)))->Entity_Player::GetEffectiveMaxHearts(); - bVar4 = false; - isInstantDeathCurse = iVar2 == 0; - } - else { - iVar2 = (GHIDRA_CAST((param_2)))->Entity_Player::GetHealthType(); - if (iVar2 == 2) { - return 1; - } - iVar1 = param_2->_soulHearts; - bVar4 = SBORROW4(iVar1,extraout_EDX); - iVar2 = iVar1 - extraout_EDX; - isInstantDeathCurse = iVar1 == extraout_EDX; - } - if (isInstantDeathCurse || bVar4 != iVar2 < 0) { - return 0; - } - return 1; - } - } - if (iVar2 == -5) { - damageSource = (GHIDRA_CAST((&damageSourceRef)))->EntityRef::EntityRef(); - isDamageTaken = (*extraout_EDX_00)(0x40000000,0x10002080,0,damageSource,0x1e); - if (isDamageTaken == '\0') { - return 0; - } - } - return 1; -} - -// 006e84d0 -void Entity_Pickup::CollectTrinket(Entity_Player *param_2, uint32_t param_3) -{ - uint8_t bVar1; - uint32_t uVar2; - int maxHeartsTaken; - Entity_Pickup *otherPickup; - Entity_Player *restockOwner; - Entity_Player *room; - void *rngEnd; - int iVar3; - uint32_t uVar4; - int iVar5; - EntityRef damageSource; - uint8_t entities [12]; - uint32_t uStack_2c; - Vector poofPos; - float local_20; - float local_1c; - Entity_Pickup *savedThis; - char isStage11Normal; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - bool isFreeDeal; - bool isRemoveOtherDeals; - Entity_Pickup *pickup; - void *rngBegin; - Room *room; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afb1c5; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((entities + 0x34)); - ExceptionList = &local_10; - savedThis = this; - if ((param_3 == 0) && (param_3 = this->_price, param_3 == 0)) goto LAB_006e89de; - ANM2::Reset(&this->_priceANM2); - if (0 < GHIDRA_INT(param_3)) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(entities),3,0xce,0x209,0, - 0); - uVar4 = 0; - local_8 = 0; - if (param_3 != 0) { - do { - if (uStack_2c <= uVar4) break; - damageSource._type = 0; - damageSource._variant = 0; - damageSource._spawnerType = 0; - damageSource._position.y = g_vectorZero.y; - damageSource._velocity.y = g_vectorZero.y; - damageSource._spawnerVariant = 0; - damageSource._position.x = g_vectorZero.x; - damageSource._velocity.x = g_vectorZero.x; - damageSource._flags = 0; - damageSource._entity = (void *)0x0; - (**(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(entities)) + 0x4))) + uVar4 * 4)) + 0x24))(&damageSource,uVar2); - uVar4 = uVar4 + 1; - } while (uVar4 < param_3); - } - uStack_2c = param_3 - uStack_2c; - param_3 = 0; - if (0 < GHIDRA_INT(uStack_2c)) { - param_3 = uStack_2c; - } - if (entities[0] == '\0') { - local_8 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)entities)) + 0x4))),0); - } - local_8 = 0xffffffff; - (GHIDRA_CAST((param_2)))->Entity_Player::AddCoins(-param_3); - FUN_007d8630(param_3); - Player_stats_add(&g_game->_onlinePlayerStats,0xd,param_2,(float)GHIDRA_INT(param_3)); - goto LAB_006e89de; - } - iVar5 = (GHIDRA_CAST((param_2)))->Entity_Player::GetHealthType(); - if ((iVar5 == 2) || (bVar1 = (GHIDRA_CAST((room)))->Entity_Player::HasInstantDeathCurse(), bVar1 != 0)) { - isFreeDeal = true; - } - else { - isFreeDeal = false; - } - isRemoveOtherDeals = false; - switch(param_3) { - case 0xfffffff7: - if (isFreeDeal) { - isRemoveOtherDeals = true; - } - else { - (GHIDRA_CAST((param_2)))->Entity_Player::AddMaxHearts(-2,0); -LAB_006e873c: - (GHIDRA_CAST((param_2)))->Entity_Player::AddSoulHearts(-2,0); - } - break; - case 0xfffffff8: - if (isFreeDeal) { - isRemoveOtherDeals = true; - } - else { -LAB_006e8700: - (GHIDRA_CAST((param_2)))->Entity_Player::AddSoulHearts(-4,0); - } - break; - case 0xfffffff9: - if (!isFreeDeal) goto LAB_006e873c; - isRemoveOtherDeals = true; - break; - case 0xfffffffa: - local_1c = 1.0; - iVar5 = (GHIDRA_CAST((param_2)))->Entity_Player::GetTrinketMultiplier(0xad); - if (iVar5 == 2) { - local_1c = 0.9; - } - else if (iVar5 == 3) { - local_1c = 0.8; - } - rngEnd = (param_2->_trinketRNGs)._end; - if (GHIDRA_INT(rngEnd) - GHIDRA_INT((param_2->_trinketRNGs)._begin) >> 4 < 0xae) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Trinket ID out of bounds!\n")); - rngEnd = (param_2->_trinketRNGs)._end; - } - rngBegin = (param_2->_trinketRNGs)._begin; - uVar2 = (GHIDRA_INT(rngEnd) - GHIDRA_INT(rngBegin) >> 4) - 1; - if (0xad < uVar2) { - uVar2 = 0xad; - } - local_20 = (GHIDRA_CAST((GHIDRA_CAST((uVar2 * 0x10 + GHIDRA_INT(rngBegin))))))->RNG::RandomFloat(); - isRemoveOtherDeals = isFreeDeal; - if (local_20 <= local_1c) { - (GHIDRA_CAST((param_2)))->Entity_Player::TryRemoveTrinket(0xad); - } - break; - case 0xfffffffb: - isRemoveOtherDeals = false; - if (isFreeDeal) { - isRemoveOtherDeals = true; - } - break; - case 0xfffffffc: - if (!isFreeDeal) { - (GHIDRA_CAST((param_2)))->Entity_Player::AddMaxHearts(-2,0); - goto LAB_006e8700; - } - isRemoveOtherDeals = true; - break; - case 0xfffffffd: - if (isFreeDeal) { - isRemoveOtherDeals = true; - } - else { - iVar3 = (param_2->_soulHearts + 1) / 2; - iVar5 = 3; - if (iVar3 < 3) { - iVar5 = iVar3; - } - maxHeartsTaken = 0; - if (0 < 3 - iVar3) { - maxHeartsTaken = 3 - iVar3; - } - (GHIDRA_CAST((param_2)))->Entity_Player::AddMaxHearts(maxHeartsTaken * -2,0); - (GHIDRA_CAST((param_2)))->Entity_Player::AddSoulHearts(iVar5 * -2,0); - } - break; - case 0xfffffffe: - if (isFreeDeal) { - isRemoveOtherDeals = true; - } - else { - (GHIDRA_CAST((param_2)))->Entity_Player::AddMaxHearts(-4,0); - } - break; - case 0xffffffff: - if (isFreeDeal) { - isRemoveOtherDeals = true; - } - else { - (GHIDRA_CAST((param_2)))->Entity_Player::AddMaxHearts(-2,0); - } - } - damageSource._position.y = g_vectorZero.y; - damageSource._velocity.y = g_vectorZero.y; - damageSource._position.x = g_vectorZero.x; - damageSource._velocity.x = g_vectorZero.x; - damageSource._type = 0; - damageSource._variant = 0; - damageSource._spawnerType = 0; - damageSource._spawnerVariant = 0; - damageSource._flags = 0; - damageSource._entity = (void *)0x0; - (GHIDRA_CAST((param_2)))->Entity_Player::set_last_damage(0x400,&damageSource); - if (isRemoveOtherDeals) { - if (((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) || - (isStage11Normal = '\x01', g_game->_stage != 0xb)) { - isStage11Normal = '\0'; - } - local_1c = (float)g_game->_startingRoomIdx; - local_20 = (float)g_game->_currentRoomIdx; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(entities),5,-1,-1,0,0); - pickup = savedThis; - uVar2 = 0; - local_8 = 2; - if (uStack_2c != 0) { - do { - otherPickup = (Entity_Pickup *) - __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(entities)) + 0x4))) + uVar2 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor,0); - if (((otherPickup != GHIDRA_CAST(0x0)) && (otherPickup != pickup)) && - (((otherPickup->_variant == 100 && - ((otherPickup->_subtype != 0 && (otherPickup->_price < 0)))) || - ((isStage11Normal != '\0' && - ((local_1c == local_20 && (otherPickup->_variant == 0x168)))))))) { - uVar4 = Random(); - poofPos.x = (otherPickup->_pos).x + 0.0; - poofPos.y = (otherPickup->_pos).y + 10.0; - Game::Spawn(g_game,1000,0xf,&poofPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - otherPickup->_timeout = 4; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uStack_2c); - } - local_8 = 0xffffffff; - if (entities[0] == '\0') { - local_8 = 3; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)entities)) + 0x4))),0); - local_8 = 0xffffffff; - } - } - bVar1 = (GHIDRA_CAST((param_2)))->Entity_Player::CanPickupItem(); - if ((bVar1 != 0) && (bVar1 = (GHIDRA_CAST((param_2)))->Entity_Player::IsHoldingItem(), bVar1 == 0)) { - (GHIDRA_CAST((param_2)))->Entity_Player::try_trigger_astral_projection(); - } -LAB_006e89de: - pickup = savedThis; - if ((((savedThis->_variant != 100) && (param_3 != 0)) && - ((restockOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x178,GHIDRA_CAST(&g_game->_playerManager),1), - restockOwner != GHIDRA_CAST(0x0) || - ((g_game->_difficulty == 2 || (g_game->_difficulty == 3)))))) && - (room = g_game->_room, room->_roomType == 2)) { - iVar5 = GHIDRA_INT((((pickup->_pos).x - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT((((pickup->_pos).y - 120.0) / 40.0 + 0.5)); - if ((((iVar5 < 0) || (room->_gridWidth <= iVar5)) || (iVar3 < 0)) || - (room->_gridHeight <= iVar3)) { - iVar5 = -1; - } - else { - iVar5 = room->_gridWidth * iVar3 + iVar5; - } - (GHIDRA_CAST((room)))->Room::TriggerRestock(iVar5,pickup->_shopItemId); - } - ExceptionList = local_10; - return; -} - -// 006ed580 -uint8_t Entity_Pickup::empty_pedestal() -{ - uint8_t isAnimSet; - LayerState *shadowLayer; - - if (this->_variant == 100) { - if (this->_subtype != 0) { - this->_subtype = 0; - if (this->_price == 0) { - isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Empty"),1); - if ((isAnimSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0); - if ((this->_sprite)._animState._animData != (void *)0x0) { - (this->_sprite)._animState._isPlaying = 0; - } - } - } - else { - if ((this->_flipSaveState == 0) || ((this->_altPedestalANM2)._loaded == 0)) { - this->Remove(); - return 1; - } - update_price_sprite(this,0); - SetAlternatePedestal(this,0); - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST("Empty"),0); - isAnimSet = ANM2::SetAnimation(&this->_altPedestalANM2,s_Idle,1); - if (isAnimSet != 0) { - AnimationState::Rewind(&(this->_altPedestalANM2)._animState); - (this->_altPedestalANM2)._animState._isPlaying = 1; - } - } - shadowLayer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST("itemshadow")); - if (shadowLayer != GHIDRA_CAST(0x0)) { - shadowLayer->_visible = 0; - } - return 1; - } - } - else if (this->_variant == 0x6e) { - this->Remove(); - return 1; - } - return 0; -} - -// 006ed690 -void Entity_Pickup::update_magnet_attraction() -{ - uint8_t bVar1; - uint8_t isCanCollect; - Entity_Player *pEVar2; - int iVar3; - int iVar4; - int *playerSlot; - int extraout_ECX; - uint32_t *playerEntry; - uint32_t uVar5; - PlayerManager *playerManager; - bool bVar6; - bool bVar7; - bool bVar8; - float fVar9; - float fVar10; - float fVar11; - Entity_Player *closestPlayer; - float closestDistSq; - uint32_t playerIndex; - Game *game; - void *listEnd; - - if (this->_variant == 0x29) { - return; - } - pEVar2 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x35,GHIDRA_CAST(&g_game->_playerManager),1); - if (((pEVar2 == GHIDRA_CAST(0x0)) && - (bVar1 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x44), bVar1 == 0)) && - (bVar1 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,6), bVar1 == 0)) { - if (this->_entityGridCollisionClass == 3) { - this->_entityGridCollisionClass = 5; - } - } - else { - PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,0x44); - if ((((this->_price == 0) || (iVar3 = this->_variant, iVar3 == 0x1e)) || - ((iVar3 == 0x28 || ((iVar3 == 0x14 || (iVar3 == 10)))))) || (iVar3 == 0x5a)) { - playerManager = &g_game->_playerManager; - closestDistSq = 1e+09; - closestPlayer = GHIDRA_CAST(0x0); - playerIndex = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) - >> 2 != 0) { -LAB_006ed780: - listEnd = (playerManager->_playerList)._end; - playerEntry = (playerManager->_playerList)._begin; - if (GHIDRA_INT(listEnd) - GHIDRA_INT(playerEntry) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - listEnd = (playerManager->_playerList)._end; - playerEntry = (playerManager->_playerList)._begin; - } - if (playerIndex < GHIDRA_UINT((GHIDRA_INT(listEnd) - GHIDRA_INT(playerEntry) >> 2))) { - playerEntry = playerEntry + playerIndex; - } - pEVar2 = GHIDRA_CAST(*playerEntry); - bVar1 = (GHIDRA_CAST((pEVar2)))->Entity_Player::HasCollectible(0x35,0); - if ((bVar1 == 0) && (iVar3 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(6), iVar3 < 2)) { - bVar6 = false; - } - else { - bVar6 = true; - } - bVar1 = (GHIDRA_CAST((pEVar2)))->Entity_Player::HasCollectible(0x35,0); - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef8)))) != 6)) { - iVar3 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(6); - bVar7 = false; - bVar8 = iVar3 == 0; -LAB_006ed81f: - bVar8 = !bVar8 && bVar7 == iVar3 < 0; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef0))) == '\0') { - iVar4 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(6); - bVar7 = SBORROW4(iVar4,1); - iVar3 = iVar4 + -1; - bVar8 = iVar4 == 1; - goto LAB_006ed81f; - } - bVar8 = true; - } - if (pEVar2->_variant == 0) { - if (bVar6) { -LAB_006ed878: - if (this->_price == 0) { - uVar5 = this->_variant; - if (uVar5 < 0x15f) { - if (uVar5 == 0x15e) { -LAB_006ed91d: - iVar4 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44); - bVar8 = SBORROW4(iVar4,1); - iVar3 = iVar4 + -1; - bVar6 = iVar4 == 1; -code_r0x006ed929: - isCanCollect = !bVar6 && bVar8 == iVar3 < 0; - goto LAB_006ed92c; - } - switch(uVar5) { - case 10: - goto code_r0x006ed8b3; - default: - break; - case 0x14: - case 0x1e: - case 0x28: - goto LAB_006ed930; - case 0x32: - case 0x34: - case 0x35: - case 0x36: - case 0x37: - case 0x38: - case 0x39: - case 0x3a: - case 0x3c: - iVar4 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44); - bVar8 = SBORROW4(iVar4,2); - iVar3 = iVar4 + -2; - bVar6 = iVar4 == 2; - goto code_r0x006ed929; - case 0x45: - goto LAB_006ed91d; - case 0x5a: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::NeedsCharge(0); - goto LAB_006ed92c; - } - } - } - } - else { - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef8)))) != 0x44)) { - iVar3 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44); - bVar7 = false; - bVar6 = iVar3 == 0; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef0))) != '\0') goto LAB_006ed878; - iVar4 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44); - bVar7 = SBORROW4(iVar4,1); - iVar3 = iVar4 + -1; - bVar6 = iVar4 == 1; - } - if ((!bVar6 && bVar7 == iVar3 < 0) || ((bVar8 && (this->_variant == 0x14)))) - goto LAB_006ed878; - } - goto LAB_006ed989; - } - goto LAB_006eda62; - } - } - } -LAB_006edb53: - if ((this->_price == 0) && (this->_variant == 0x14)) { - uVar5 = 1; - playerManager = &g_game->_playerManager; - if (1 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))) { - do { - listEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(listEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - listEnd = (playerManager->_playerList)._end; - } - game = g_game; - playerSlot = (playerManager->_playerList)._begin; - if (uVar5 < GHIDRA_UINT((GHIDRA_INT(listEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + uVar5; - } - if (*GHIDRA_CAST((*playerSlot + 0x1aec)) == 0x12) { - listEnd = (g_game->_playerManager)._playerList._end; - playerSlot = (g_game->_playerManager)._playerList._begin; - if (GHIDRA_INT(listEnd) - GHIDRA_INT(playerSlot) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - listEnd = (game->_playerManager)._playerList._end; - playerSlot = (game->_playerManager)._playerList._begin; - } - if (uVar5 < GHIDRA_UINT((GHIDRA_INT(listEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + uVar5; - } - fVar10 = *GHIDRA_CAST((*playerSlot + 0x33c)) - (this->_pos).x; - fVar11 = *GHIDRA_CAST((*playerSlot + 0x340)) - (this->_pos).y; - fVar9 = sqrtf(fVar10 * fVar10 + fVar11 * fVar11); - if (0.0 < fVar9) { - fVar11 = (1.0 / fVar9) * fVar11; - fVar10 = (1.0 / fVar9) * fVar10; - } - this->_entityGridCollisionClass = 3; - (this->_velocity).x = (fVar10 * 0.5 + (this->_velocity).x) * 0.8; - (this->_velocity).y = (fVar11 * 0.5 + (this->_velocity).y) * 0.8; - } - uVar5 = uVar5 + 1; - playerManager = &g_game->_playerManager; - } while (uVar5 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - return; -code_r0x006ed8b3: - switch(this->_subtype) { - case 1: - case 2: - case 5: - case 9: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::CanPickRedHearts(); - break; - case 3: - case 8: -LAB_006ed8d7: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::CanPickSoulHearts(); - break; - default: - goto LAB_006ed930; - case 6: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::CanPickBlackHearts(); - break; - case 7: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::CanPickGoldenHearts(); - break; - case 10: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::CanPickRedHearts(); - if (isCanCollect == 0) goto LAB_006ed8d7; - goto LAB_006ed930; - case 0xb: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::CanPickBoneHearts(); - break; - case 0xc: - isCanCollect = (GHIDRA_CAST((pEVar2)))->Entity_Player::CanPickRottenHearts(); - } -LAB_006ed92c: - if (isCanCollect == 0) { -LAB_006ed989: - if ((((pEVar2->_variant == 0) && (bVar1 != 0)) && (bVar1 = IsChest(this->_variant), bVar1 != 0)) - && (this->_subtype != 0)) { - if (((extraout_ECX != 0x32) && (extraout_ECX != 0x38)) && - ((extraout_ECX != 0x168 && ((extraout_ECX != 0x34 && (extraout_ECX != 0x36)))))) { - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef8)))) != 0x13)) { - iVar3 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x13); - bVar8 = false; - bVar6 = iVar3 == 0; -LAB_006eda04: - if (bVar6 || bVar8 != iVar3 < 0) goto LAB_006eda62; - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((pEVar2)) + 0x2ef0))) == '\0') { - iVar4 = (GHIDRA_CAST((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x13); - bVar8 = SBORROW4(iVar4,1); - iVar3 = iVar4 + -1; - bVar6 = iVar4 == 1; - goto LAB_006eda04; - } - iVar3 = this->_variant; - if (((iVar3 != 0x3c) && (iVar3 != 0x35)) && (iVar3 != 0x37)) goto LAB_006eda62; - } - fVar10 = (this->_pos).x - (pEVar2->_pos).x; - fVar9 = (this->_pos).y - (pEVar2->_pos).y; - if (fVar9 * fVar9 + fVar10 * fVar10 < 6400.0) { - TryOpenChest(this,pEVar2); - } - } - } - else { -LAB_006ed930: - fVar9 = (this->_pos).x - (pEVar2->_pos).x; - fVar10 = (this->_pos).y - (pEVar2->_pos).y; - fVar9 = fVar10 * fVar10 + fVar9 * fVar9; - if (fVar9 < closestDistSq) { - closestPlayer = pEVar2; - closestDistSq = fVar9; - } - } -LAB_006eda62: - playerManager = &g_game->_playerManager; - playerIndex = playerIndex + 1; - if (GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2)) <= playerIndex) goto code_r0x006eda8d; - goto LAB_006ed780; -code_r0x006eda8d: - if (closestPlayer != GHIDRA_CAST(0x0)) { - fVar10 = (closestPlayer->_pos).x - (this->_pos).x; - fVar11 = (closestPlayer->_pos).y - (this->_pos).y; - fVar9 = sqrtf(fVar10 * fVar10 + fVar11 * fVar11); - if (0.0 < fVar9) { - fVar11 = (1.0 / fVar9) * fVar11; - fVar10 = (1.0 / fVar9) * fVar10; - } - (this->_velocity).x = (fVar10 * 0.5 + (this->_velocity).x) * 0.8; - (this->_velocity).y = (fVar11 * 0.5 + (this->_velocity).y) * 0.8; - this->_entityGridCollisionClass = 3; - } - goto LAB_006edb53; -} - -// 006edfa0 -void Entity_Pickup::update_cycle_collectible(uint8_t isForce) -{ - uint8_t bVar1; - int frequency; - double dVar2; - int animFrame; - int rotatedState [4]; - int iStack_34; - int local_30; - int iStack_2c; - int iStack_28; - int iStack_24; - uint32_t local_14; - void *animData; - uint32_t cycleCount; - - local_14 = __security_cookie ^ GHIDRA_UINT(&animFrame); - cycleCount = this->_cycleCollectibleCount; - if (cycleCount == 0) { - return; - } - frequency = (-GHIDRA_UINT((cycleCount < 4)) & 0x18) + 6; - if (7 < cycleCount) { - frequency = 1; - } - if (this->_subtype == 0) { - this->_cycleCollectibleCount = 0; - return; - } - if ((isForce == 0) && - (((g_game->_frameCount - this->_spawnFrame < 1 || - (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(frequency,0), bVar1 == 0)) && - (bVar1 = Game::IsPaused(g_game), bVar1 == 0)))) { - return; - } - memcpy(rotatedState + 1,this->_cycleCollectibleList + 1,cycleCount * 4 - 4); - animData = (this->_sprite)._animState._animData; - rotatedState[cycleCount] = this->_subtype; - rotatedState[0] = this->_wait; - if (animData == (void *)0x0) { - animFrame = -1; - } - else { - dVar2 = floor((double)(this->_sprite)._animState._animFrame); - animFrame = GHIDRA_INT(dVar2); - } - Morph(this,this->_type,this->_variant,this->_cycleCollectibleList[0],1,1,1); - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)animFrame); - } - this->_wait = rotatedState[0]; - this->_cycleCollectibleList[0] = rotatedState[1]; - this->_cycleCollectibleList[1] = rotatedState[2]; - this->_cycleCollectibleList[2] = rotatedState[3]; - this->_cycleCollectibleList[3] = iStack_34; - this->_cycleCollectibleCount = cycleCount; - this->_cycleCollectibleList[4] = local_30; - this->_cycleCollectibleList[5] = iStack_2c; - this->_cycleCollectibleList[6] = iStack_28; - this->_cycleCollectibleList[7] = iStack_24; - return; -} - -// 006ee110 -void Entity_Pickup::Remove() -{ - if (this->_pickupGhost != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_pickupGhost) + 0x28))(); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Remove(); - return; -} - -// 006ee130 -void Entity_Pickup::ClearReferences() -{ - Entity_Pickup *eraseKey; - void **ghostRef; - - ghostRef = &this->_pickupGhost; - eraseKey = this; - if (this->_pickupGhost != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_pickupGhost) + 0x28))(); - } - if (this->_unkEntityRef != 0) { - eraseKey = GHIDRA_CAST(&this->_unkEntityRef); - msvc::multiset::erase(&eraseKey); - this->_unkEntityRef = 0; - } - if (*ghostRef != (void *)0x0) { - eraseKey = GHIDRA_CAST(ghostRef); - msvc::multiset::erase(&eraseKey); - *ghostRef = (void *)0x0; - } - if (this->_megaChestCollectible[0] != (void *)0x0) { - eraseKey = GHIDRA_CAST(this->_megaChestCollectible); - msvc::multiset::erase(&eraseKey); - this->_megaChestCollectible[0] = (void *)0x0; - } - if (this->_megaChestCollectible[1] != (void *)0x0) { - eraseKey = GHIDRA_CAST((this->_megaChestCollectible + 1)); - msvc::multiset::erase(&eraseKey); - *GHIDRA_CAST((this->_megaChestCollectible + 1)) = 0; - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - return; -} - -// 006ee200 -uint8_t Entity_Pickup::CanReroll() -{ - int subType; - int variant; - uint8_t bVar1; - - if (this->_dead == 0) { - subType = this->_subtype; - variant = this->_variant; - bVar1 = CanRerollVariant(variant,subType); - if (bVar1 != 0) { - bVar1 = IsChest(variant); - if ((bVar1 == 0) || (subType != 0)) { - return 1; - } - } - } - return 0; -} - -// 006ee240 -uint8_t Entity_Pickup::CanRerollVariant(int variant, int subType) -{ - uint8_t isSeedEffectActive; - char isChallengeOrDaily; - ChallengeParam *challengeParams; - Game *this; - Game *this_00; - Game *this_01; - bool isBlocked; - Game *game; - - game = g_game; - if (((((variant != 0x17c) && (variant != 0x172)) && (variant != 0x154)) && - ((variant != 0x29 && (variant != 0x186)))) && ((variant != 100 || (subType != 0x29c)))) { - isSeedEffectActive = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f); - if (variant != 100) { - return 1; - } - if ((isSeedEffectActive != 0) && (subType == -1)) { - return 0; - } - if (subType == 0x272) { - isChallengeOrDaily = Game::IsChallengeOrDaily(game); - if (isChallengeOrDaily == '\0') { - return 1; - } - challengeParams = Game::GetChallengeParams(this); - isBlocked = challengeParams->_pathType == 2; - } - else if (subType == 0x273) { - isChallengeOrDaily = Game::IsChallengeOrDaily(game); - if (isChallengeOrDaily == '\0') { - return 1; - } - challengeParams = Game::GetChallengeParams(this_00); - isBlocked = challengeParams->_pathType == 2; - } - else { - if ((subType != 0x147) && (subType != 0x148)) { - return 1; - } - isChallengeOrDaily = Game::IsChallengeOrDaily(game); - if (isChallengeOrDaily == '\0') { - return 1; - } - challengeParams = Game::GetChallengeParams(this_01); - if (challengeParams->_pathType == 3) { - return 0; - } - isBlocked = challengeParams->_endStage == 0xc; - } - if (!isBlocked) { - return 1; - } - } - return 0; -} - -// 006ee340 -uint8_t Entity_Pickup::IsChest(int variant) -{ - if (((((variant == 0x32) || (variant == 0x3c)) || (variant == 0x168)) || - ((((variant == 0x33 || (variant == 0x35)) || - ((variant == 0x34 || ((variant == 0x36 || (variant == 0x186)))))) || (variant == 0x37)))) || - (((variant == 0x38 || (variant == 0x39)) || (variant == 0x3a)))) { - return 1; - } - return 0; -} - -// 006ee390 -uint8_t Entity_Pickup::CanBePickedUp(uint8_t ignorePrice) -{ - int variant; - - variant = this->_variant; - if ((((((((variant == 10) || (variant == 0x14)) || (variant == 0x5a)) || - ((variant == 0x28 || (variant == 0x1e)))) || - ((variant == 0x46 || ((variant == 300 || (variant == 0x15e)))))) || (variant == 0x45)) || - ((variant == 0x29 || (variant == 0x2a)))) && ((ignorePrice != 0 || (this->_price == 0)))) { - return 1; - } - return 0; -} - -// 006ee3f0 -uint8_t Entity_Pickup::CanJeraDuplicate() -{ - int variant; - uint8_t bVar1; - - if ((((this->_dead == 0) && (variant = this->_variant, variant != 100)) && (variant != 0x15e)) && - ((variant != 300 || (this->_subtype != 0x21)))) { - bVar1 = CanReroll(this); - if (bVar1 != 0) { - bVar1 = IsChest(variant); - if ((bVar1 == 0) || (this->_subtype != 0)) { - return 1; - } - } - } - return 0; -} - -// 006ee750 -void Entity_Pickup::RemoveOtherOptions() -{ - int *piVar1; - uint64_t qVar2; - uint32_t uVar3; - uint32_t uVar4; - int listData; - Entity_Pickup *in_ECX; - uint64_t *heapCounter; - uint32_t i; - EntityList_EL collectibles; - uint8_t local_28 [12]; - float local_1c; - Vector local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity_Pickup *other; - Game *game; - - game = g_game; - local_8 = 0xffffffff; - puStack_c = &LAB_00afb275; - local_10 = ExceptionList; - uVar3 = __security_cookie ^ GHIDRA_UINT((local_28 + 0x24)); - ExceptionList = &local_10; - if (in_ECX->_optionsPickupIndex != 0) { - if ((((in_ECX->_optionsPickupIndex == 1) && (in_ECX->_variant == 100)) && - (g_game->_currentDimensionIdx == 2)) && (g_game->_deathCertificateExitTimer < 1)) { - g_game->_deathCertificateExitTimer = 0x5a; - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST(local_28),5,-1,-1,0,0); - i = 0; - local_8 = 0; - if (local_1c != 0.0) { - listData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))); - do { - other = *GHIDRA_CAST((listData + i * 4)); - if ((other != GHIDRA_CAST(0x0)) && (other->_type == 5)) { - if (((other->_optionsPickupIndex == in_ECX->_optionsPickupIndex) && (other != in_ECX)) && - ((other->_variant != 100 || (other->_subtype != 0)))) { - uVar4 = Random(); - local_18.x = (other->_pos).x + 0.0; - local_18.y = (other->_pos).y + 10.0; - Game::Spawn(g_game,1000,0xf,&local_18,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - if (other->_variant == 100) { - other->_timeout = 4; - } - else { - other->Remove(uVar3); - } - } - listData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))); - } - i = i + 1; - } while (i < GHIDRA_UINT(local_1c)); - } - local_8 = 0xffffffff; - in_ECX->_optionsPickupIndex = 0; - if (local_28[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - heapCounter = &g_allocatedBytesNoHeap; - } - else { - heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) != 0) { - uVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) + -4)); - qVar2 = *heapCounter; - *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3; - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x4))) + -4))); - } - } - } - local_8 = 0xffffffff; - if (((in_ECX->_variant == 100) && (g_game->_currentRoomIdx == -0xc)) && - ((in_ECX->_flags & 0x40000) != 0)) { - local_18.y = (float)g_game->_room; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(local_18.y) + 0x1218)),&collectibles,5,100,-1,0,0); - local_8 = 2; - uVar4 = 0; - uVar3 = collectibles._size; - if (collectibles._size != 0) { - do { - piVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(collectibles)) + 0x4))) + uVar4 * 4)); - if (((piVar1 != GHIDRA_CAST(0x0)) && (piVar1[10] == 5)) && ((piVar1[0x5a] & 0x40000U) != 0)) { - uVar3 = Random(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_28)) + 0x8))) = (float)piVar1[0xcf] + 0.0; - local_1c = (float)piVar1[0xd0] + 10.0; - Game::Spawn(g_game,1000,0xf,GHIDRA_CAST((local_28 + 8)),&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3); - (**(code **)(*piVar1 + 0x28))(); - uVar3 = collectibles._size; - } - uVar4 = uVar4 + 1; - } while (uVar4 < uVar3); - } - *GHIDRA_CAST((GHIDRA_CAST(local_18.y) + 0x7764)) = 10; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(collectibles)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - heapCounter = &g_allocatedBytesNoHeap; - } - else { - heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(collectibles)) + 0x4))) != 0) { - uVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(collectibles)) + 0x4))) + -4)); - qVar2 = *heapCounter; - *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3; - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(collectibles)) + 0x4))) + -4)); - } - } - } - ExceptionList = local_10; - return; -} - -// 006eea30 -void Entity_Pickup::MakeShopItem(int shopId) -{ - int price; - Game *game; - - game = g_game; - if (this->_price == 0) { - this->_shopItemId = shopId; - price = Room::GetShopItemPrice - (game->_room,this->_variant,this->_subtype,shopId,GHIDRA_CAST(0x0)); - this->_price = price; - price = _Room::ResolveHeartSubType(0xffffffff,price,0); - this->_price = price; - update_price_sprite(this,price); - } - return; -} - -// 006eed30 -int Entity_Pickup::AssignOptionsIndex() -{ - uint64_t *heapAllocatedBytes; - uint32_t uVar1; - int maxIndex; - EntityList_EL local_20; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - uint64_t oldAllocatedBytes; - Entity_Pickup *pickup; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af3860; - local_10 = ExceptionList; - ExceptionList = &local_10; - maxIndex = 2; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&local_20,5,-1,-1,0,0); - uVar1 = 0; - if (local_20._size != 0) { - do { - pickup = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) + uVar1 * 4)); - if ((((pickup != GHIDRA_CAST(0x0)) && (pickup->_type == 5)) && (pickup != this)) && - (maxIndex < pickup->_optionsPickupIndex)) { - maxIndex = pickup->_optionsPickupIndex; - } - uVar1 = uVar1 + 1; - } while (uVar1 < GHIDRA_UINT(local_20._size)); - } - this->_optionsPickupIndex = maxIndex + 1; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - heapAllocatedBytes = &g_allocatedBytesNoHeap; - } - else { - heapAllocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) != 0) { - uVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) + -4)); - oldAllocatedBytes = *heapAllocatedBytes; - *GHIDRA_CAST(heapAllocatedBytes) = GHIDRA_UINT(*heapAllocatedBytes) - uVar1; - *GHIDRA_CAST((GHIDRA_CAST(heapAllocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapAllocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar1)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) + -4)); - } - } - ExceptionList = local_10; - return maxIndex + 1; -} - -// 007e9390 -int Entity_Pickup::Charge() -{ - return this->_charge; -} - -// 007e93a0 -uint8_t Entity_Pickup::AutoUpdatePrice() -{ - return this->_isAutoUpdatePrice; -} - -// 007e93b0 -uint8_t Entity_Pickup::Touched() -{ - return this->_isTouched; -} - -// 007e93c0 -int Entity_Pickup::ShopItemId() -{ - return this->_shopItemId; -} - -// 007ef420 -void Entity_Pickup::RestoreState(Room *room, Entity_Pickup *entity, void *saveState) -{ - uint32_t uVar1; - void *pvVar2; - uint8_t bVar3; - Vector *vecResult; - int iVar4; - uint32_t uVar5; - Entity_Player *player; - uint32_t uVar6; - uint32_t *spawnerSlot; - float fVar7; - float fVar8; - uint8_t bVar9; - uint8_t bVar10; - Vector local_18; - Vector local_10; - void *gameRoom; - double uintFixup; - - if (((entity->_pos).x == g_vectorZero.x) && ((entity->_pos).y == g_vectorZero.y)) { - bVar10 = 0; - bVar9 = 0; - bVar3 = 1; - fVar8 = 40.0; - vecResult = (GHIDRA_CAST((room)))->Room::GetRandomPosition(&local_10,0.0); - vecResult = Room::FindFreePickupSpawnPosition(room,&local_18,vecResult,fVar8,bVar3,bVar9,bVar10) - ; - (entity->_pos).x = vecResult->x; - (entity->_pos).y = vecResult->y; - } - (entity->_dropRNG)._seed = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x38)); - (entity->_dropRNG)._shift1 = 4; - (entity->_dropRNG)._shift2 = 3; - (entity->_dropRNG)._shift3 = 0x11; - iVar4 = entity->_type; - entity->_spawnGridIndex = GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x20))); - entity->_scoreMultiplier = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x58)); - if (iVar4 == 5) { - if (*GHIDRA_CAST((GHIDRA_CAST(saveState) + 8)) != 0) { - entity->_charge = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x10)); - } - update_price_sprite(entity,*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x14))); - entity->_isAutoUpdatePrice = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x60)); - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x18)); - if (iVar4 < -1) { - iVar4 = -2; - } - else if (6 < iVar4) { - iVar4 = 7; - } - entity->_shopItemId = iVar4; - entity->_isTouched = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x22)); - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x24)); - entity->_coopDuplicateIndex = iVar4; - if ((iVar4 != 0) && (iVar4 != -1)) { - entity->_cycleCollectibleCount = 0; - } - bVar3 = entity->_isForceBlind; - entity->_optionsPickupIndex = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x30)); - entity->_spawnerType = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x3c)); - entity->_spawnerVariant = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x40)); - entity->_timeout = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x1c)); - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x54)) * g_vectorOne.x; - (entity->_sprite)._scale.y = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x54)) * g_vectorOne.y; - (entity->_sprite)._scale.x = fVar8; - bVar9 = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x23)); - entity->_isForceBlind = bVar9; - if (((entity->_variant == 100) && (entity->_subtype != 0)) && (bVar3 != bVar9)) { - UpdateSprite(entity,0); - } - SetAlternatePedestal(entity,*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0xc))); - entity->_varData = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x5c)); - entity->_itemPoolType = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x50)); - if (*GHIDRA_CAST((GHIDRA_CAST(saveState) + 100)) != 0) { - entity->_cycleCollectibleCount = 0; - uVar6 = 0; - do { - iVar4 = *GHIDRA_CAST((uVar6 + *GHIDRA_CAST((GHIDRA_CAST(saveState) + 100)))); - if (iVar4 == 0) break; - if (GHIDRA_UINT(entity->_cycleCollectibleCount) < 8) { - entity->_cycleCollectibleList[entity->_cycleCollectibleCount] = iVar4; - entity->_cycleCollectibleCount = entity->_cycleCollectibleCount + 1; - } - uVar6 = uVar6 + 4; - } while (uVar6 < 0x20); - } - if (*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x6c)) != 0) { - (GHIDRA_CAST((&entity->_flipSaveState)))->SharedPtr::assign(GHIDRA_CAST((GHIDRA_INT(saveState) + 0x6c))); - ANM2::Reset(&entity->_altPedestalANM2); - } - UpdateLootPreview(entity); - if (((g_game->_currentRoomIdx == -0xc) && (g_game->_isStartingFromState != 0)) && - ((entity->_variant == 100 && (-1 < entity->_spawnGridIndex)))) { - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *GHIDRA_CAST(&entity->_flags) = GHIDRA_UINT(entity->_flags) | 0x40000; - *GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)) = uVar1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7764)))) = 0xffffffff; - return; - } - } - else { - if (iVar4 == 6) { - iVar4 = entity->_variant; - (entity->_priceANM2)._filename._size = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0xc)); - if (iVar4 == 10) { - (entity->_priceANM2)._filename._capacity = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x10)); - } - (GHIDRA_CAST((GHIDRA_CAST(entity))))->Entity_Slot::SetPrizeType(*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x30))); - return; - } - if (iVar4 == 1000) { - iVar4 = entity->_variant; - if (((iVar4 == 0x15) || (iVar4 == 0x21)) || - ((iVar4 == 0x3f || - ((((iVar4 == 0x40 || (iVar4 == 0x41)) || (iVar4 == 0x45)) || (iVar4 == 0x9e)))))) { - gameRoom = g_game->_room; - local_10.x = *GHIDRA_CAST((GHIDRA_CAST(gameRoom) + 0x14)); - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(gameRoom) + 0x18)); - local_18.x = *GHIDRA_CAST((GHIDRA_CAST(gameRoom) + 0x1c)); - fVar7 = *GHIDRA_CAST((GHIDRA_CAST(gameRoom) + 0x20)); - uVar6 = Random(); - uintFixup = __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]; - uVar5 = Random(); - (entity->_pos).x = - (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * (local_18.x - local_10.x) + local_10.x; - (entity->_pos).y = - (float)((double)GHIDRA_INT(uVar6) + uintFixup) * 2.3283064e-10 * (fVar7 - fVar8) + fVar8; - return; - } - if (iVar4 == 0x44) { - entity->Update(); - return; - } - if (iVar4 != 0x74) { - if (iVar4 != 0x78) { - return; - } - (entity->_priceANM2)._filename._size = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x18)); - (entity->_priceANM2)._filename._capacity = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x10)); - } - (entity->_priceANM2)._animState._animFrame = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0xc)); - return; - } - if ((iVar4 == 0x21) || (iVar4 == 0x124)) { - entity->_health = - (float)((double)*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0xc)) + - __uint_to_double_fixup[-(*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0xc)) >> 0x1f)]); - } - else if (iVar4 == 4) { - gameRoom = *(void **)(GHIDRA_CAST(saveState) + 0x18); - pvVar2 = *(void **)(GHIDRA_CAST(saveState) + 0x1c); - uVar6 = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x14)); - (entity->_priceANM2)._animDefaultName._size = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x10)); - (entity->_priceANM2)._animDefaultName._capacity = uVar6; - (entity->_priceANM2)._animState._animation = gameRoom; - (entity->_priceANM2)._animState._animData = pvVar2; - *GHIDRA_CAST((GHIDRA_INT(&(entity->_priceANM2)._overlayAnimState._animation) + 3)) = 1; - *GHIDRA_CAST(&(entity->_priceANM2)._animState._layerFrames) = - *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x23)); - *GHIDRA_CAST(((entity->_priceANM2)._filename._buf + 8)) = - *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x50)); - (entity->_priceANM2)._animState._nullLayerFrames = *(void **)(GHIDRA_CAST(saveState) + 0x54); - fVar8 = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x54)) * g_vectorOne.x; - (entity->_sprite)._scale.y = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x54)) * g_vectorOne.y; - (entity->_sprite)._scale.x = fVar8; - entity->_spawnerType = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x3c)); - *GHIDRA_CAST(((entity->_priceANM2)._animDefaultName._buf + 0xc)) = - *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0xc)); - if (-1 < *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x60))) { - uVar6 = GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x60))); - if (GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)) <= uVar6) { - uVar6 = 0; - } - player = Game::GetPlayer(g_game,uVar6); - spawnerSlot = &entity->_spawnerEntity; - if (entity->_spawnerEntity != 0) { - local_10.x = (float)spawnerSlot; - msvc::multiset::erase(&local_10); - } - *spawnerSlot = player; - if (player != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(spawnerSlot); - return; - } - } - } - else { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(entity))))->Entity::IsEnemy(); - if (((bVar3 != 0) && (iVar4 != 0x11)) && (iVar4 != 0x38b)) { - entity->_health = *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x50)); - if (-1 < *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x18))) { - Entity_NPC::MakeChampion - (GHIDRA_CAST(entity),*GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x34)), - *GHIDRA_CAST((GHIDRA_CAST(saveState) + 0x18)),0); - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(saveState) + 0x28)))))->Vector::operator_eq(&g_vectorZero); - if (bVar3 != 0) { - bVar10 = 0; - bVar9 = 0; - bVar3 = 1; - fVar8 = 80.0; - vecResult = Room::GetCenterPos(&local_18); - Room::FindFreePickupSpawnPosition(room,&local_10,vecResult,fVar8,bVar3,bVar9,bVar10); - vecResult = MusicManager::RandomVector(&local_18); - uVar6 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10; - fVar8 = vecResult->x; - (entity->_pos).y = fVar7 * vecResult->y * 20.0 + local_10.y; - (entity->_pos).x = fVar7 * fVar8 * 20.0 + local_10.x; - return; - } - } - } - } - return; -} - -// 0085e440 -int Entity_Pickup::Wait() -{ - return this->_wait; -} diff --git a/generated-src/entity_player.cpp b/generated-src/entity_player.cpp deleted file mode 100644 index 5e8dbe1..0000000 --- a/generated-src/entity_player.cpp +++ /dev/null @@ -1,63573 +0,0 @@ -#include "classes.h" - -// 00417800 -Entity_Player * Entity_Player::GetMainTwin() -{ - Entity_Player *mainTwin; - - mainTwin = GHIDRA_CAST(this->_twinPlayer); - if (((mainTwin == GHIDRA_CAST(0x0)) || (mainTwin->_playerIndex == -1)) || - (this->_playerIndex <= mainTwin->_playerIndex)) { - mainTwin = this; - } - return mainTwin; -} - -// 00417820 -uint32_t Entity_Player::GetOtherTwin() -{ - return this->_twinPlayer; -} - -// 00423950 -int Entity_Player::ControllerIndex() -{ - return this->_controllerIndex; -} - -// 004253b0 -int Entity_Player::GetPlayerType() -{ - return this->_playerType; -} - -// 00428b10 -int Entity_Player::GetHearts() -{ - return this->_redHearts; -} - -// 0042a2f0 -int Entity_Player::GetBatteryCharge(int slot) -{ - if (GHIDRA_UINT(slot) < 4) { - return this->_activeDesc[slot]._item; - } - return 0; -} - -// 0042a310 -int Entity_Player::GetMaxHearts() -{ - return this->_maxHearts; -} - -// 0042a320 -uint8_t Entity_Player::IsCoopGhost() -{ - return this->_isCoopGhost; -} - -// 004316d0 -int Entity_Player::GetFireDirection() -{ - return this->_fireDirection; -} - -// 004316e0 -Vector * Entity_Player::GetAimDirection() -{ - return &this->_aimDirection; -} - -// 004316f0 -int Entity_Player::GetNumBlueFlies() -{ - return this->_numBlueFlies; -} - -// 00436160 -void Entity_Player::AddCacheFlags(int flags) -{ - this->_cacheFlags = this->_cacheFlags | flags; - return; -} - -// 00436170 -int Entity_Player::GetHeadDirection() -{ - return this->_headDirection; -} - -// 00436180 -uint8_t Entity_Player::AreOpposingShootDirectionsPressed() -{ - return this->_areOpposingShootDirectionsPressed; -} - -// 004361a0 -long double Entity_Player::GetTearPoisonDamage() -{ - return (long double)this->_meleeDamage; -} - -// 004361b0 -int Entity_Player::GetItemState() -{ - return this->_itemState; -} - -// 004361c0 -TemporaryEffects * Entity_Player::GetEffects() -{ - return &this->_temporaryeffects; -} - -// 004361d0 -void Entity_Player::SetMinDamageCooldown(int cooldown) -{ - int *newCooldown; - - newCooldown = &cooldown; - if (cooldown <= this->_damageCooldown) { - newCooldown = &this->_damageCooldown; - } - this->_damageCooldown = *newCooldown; - return; -} - -// 00499dd0 -int Entity_Player::GetNumCoins() -{ - return this->_numCoins; -} - -// 004e4860 -int Entity_Player::GetMovementDirection() -{ - return this->_moveDirection; -} - -// 00505c80 -int Entity_Player::GetActiveItem(int slot) -{ - if (GHIDRA_UINT(slot) < 4) { - return this->_activeDesc[slot]._charge; - } - return 0; -} - -// 00505cc0 -uint8_t Entity_Player::AreControlsEnabled() -{ - if ((this->_isControlsEnabled == 0) || (0 < this->_controlsCooldown)) { - return 0; - } - return 1; -} - -// 0056ff90 -bool Entity_Player::IsItemQueueEmpty() -{ - return (this->_queuedItem)._item == (void *)0x0; -} - -// 0058e230 -void Entity_Player::StopExtraAnimation() -{ - this->_isPlayingExtraAnimation = 0; - this->_isPlayingItemAnimation = 0; - return; -} - -// 005b1700 -int Entity_Player::GetBoneHearts() -{ - return this->_boneHearts; -} - -// 005b1710 -int Entity_Player::GetRottenHearts() -{ - return this->_rottenHearts; -} - -// 005b1740 -int Entity_Player::GetSoulHearts() -{ - return this->_soulHearts; -} - -// 005b1750 -int Entity_Player::GetBlackHearts() -{ - return this->_blackHearts; -} - -// 005b1760 -int Entity_Player::GetNumKeys() -{ - return this->_numKeys; -} - -// 005b1770 -int Entity_Player::GetGoldenHearts() -{ - return this->_goldenHearts; -} - -// 005b1780 -uint8_t Entity_Player::HasWeaponType(int weaponType) -{ - if (GHIDRA_UINT(weaponType) < 0x11) { - return *GHIDRA_CAST((GHIDRA_CAST(this->_weapons) + weaponType + 0x14)); - } - return 0; -} - -// 005b17c0 -RNG * Entity_Player::GetCollectibleRNG(int id) -{ - void *rngsEnd; - uint32_t lastIndex; - void *rngsBegin; - - if (id < 0) { - return (this->_collectibleRNGs)._begin; - } - rngsEnd = (this->_collectibleRNGs)._end; - if (GHIDRA_INT(rngsEnd) - GHIDRA_INT((this->_collectibleRNGs)._begin) >> 4 <= id) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Collectible ID out of bounds!\n")); - rngsEnd = (this->_collectibleRNGs)._end; - } - rngsBegin = (this->_collectibleRNGs)._begin; - lastIndex = (GHIDRA_INT(rngsEnd) - GHIDRA_INT(rngsBegin) >> 4) - 1; - if (lastIndex < GHIDRA_UINT(id)) { - id = lastIndex; - } - return GHIDRA_CAST((GHIDRA_INT(rngsBegin) + id * 0x10)); -} - -// 005b1a20 -void Entity_Player::moms_bracelet_grab() -{ - uint16_t uVar1; - ANM2 other; - uint64_t qVar2; - uint8_t bVar3; - Vector *pVVar4; - int iVar5; - EntityList_EL *queryResult; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint8_t extraout_CL_01; - uint8_t extraout_CL_02; - int gridIndex; - char *pcVar6; - int GridIndex; - uint32_t uVar7; - uint8_t *entityCount; - ANM2 *room; - uint64_t *allocCounter; - Entity_Effect *entity; - bool isRockShot; - float fVar8; - uint32_t *puVar9; - ANM2 aAStackY_8d98 [128]; - uint8_t in_stack_fffffd7c [244]; - float fVar10; - float fVar11; - Vector *pVVar12; - uint32_t uVar13; - ANM2 spriteCopy; - uint8_t nearbyEntities [8]; - int iStack_48; - uint8_t *puStack_44; - Vector local_40; - Vector local_38; - Entity_Effect *local_30; - uint8_t local_2c [16]; - uint32_t local_1c; - uint32_t local_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity_Effect *heldEffect; - int *rockShot; - Room *room; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af59cd; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((local_2c + 0x28)); - ExceptionList = &local_10; - room = g_game->_room; - if (this->_itemState != 0x25c) { - fVar8 = 0.0; - local_38.x = 0.0; - if (this->_moveDirection != -1) { - pVVar4 = Isaac::GetAxisAlignedUnitVectorFromDir(&local_40,this->_moveDirection); - local_38.x = pVVar4->x; - fVar8 = pVVar4->y; - } - local_38.x = local_38.x * 22.0; - puVar9 = GHIDRA_CAST((fVar8 * 22.0)); - gridIndex = GHIDRA_INT((((local_38.x + (this->_pos).x) - 40.0) / 40.0 + 0.5)); - iVar5 = GHIDRA_INT(((((float)puVar9 + (this->_pos).y) - 120.0) / 40.0 + 0.5)); - if ((((-1 < gridIndex) && (gridIndex < room->_gridWidth)) && (-1 < iVar5)) && - (((iVar5 < room->_gridHeight && - (gridIndex = room->_gridWidth * iVar5 + gridIndex, -1 < gridIndex)) && - (local_40.y = local_38.x, local_38.y = (float)puVar9, - bVar3 = (GHIDRA_CAST((room)))->Room::CanPickupGridEntity(gridIndex), bVar3 != 0)))) { - local_30 = (GHIDRA_CAST((room)))->Room::PickupGridEntity(GridIndex); - if (local_30 != GHIDRA_CAST(0x0)) { - puVar9 = &local_30->_parent; - if (local_30->_parent != 0) { - local_38.y = (float)puVar9; - msvc::multiset::erase(); - } - *puVar9 = this; - msvc::multiset::insert(); - TryHoldEntity(this,GHIDRA_CAST(local_30)); - ExceptionList = local_10; - return; - } - local_30 = GHIDRA_CAST(0x0); - puVar9 = GHIDRA_CAST(local_38.y); - local_38.x = local_40.y; - } - local_38.x = local_38.x + (this->_pos).x; - local_38.y = (float)puVar9 + (this->_pos).y; - local_40.y = (float)&room->_entityList; - EntityList::QueryRadius - (GHIDRA_CAST(local_40.y),GHIDRA_CAST(nearbyEntities),&local_38,22.0,0xffffffff); - local_8 = 0; - local_30 = GHIDRA_CAST(0x0); - entityCount = puStack_44; - if (puStack_44 != GHIDRA_CAST(0x0)) { - do { - entity = *GHIDRA_CAST((((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(nearbyEntities))) + 0x4))))->_buf + GHIDRA_INT(local_30) * 4)) - ; - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || ((GHIDRA_CAST(entity))->_type != 1)) { - iVar5 = (GHIDRA_CAST(entity))->_type; - if (iVar5 - 10U < 0x3de) goto LAB_005b1bf2; -LAB_005b1f4c: - bVar3 = TryHoldEntity(this,GHIDRA_CAST(entity)); - if (bVar3 != 0) goto LAB_005b2306; - entityCount = puStack_44; - } - else { - iVar5 = 1; -LAB_005b1bf2: - if ((GHIDRA_CAST(entity))->_entityCollisionClass == 0) goto LAB_005b1f4c; - if (iVar5 == 0x1b) { - if (((GHIDRA_CAST(entity))->_variant == 0) && ((GHIDRA_CAST(entity))->_subtype == 0)) { - (GHIDRA_CAST(entity))->_subtype = 99; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) = msvc::_Allocate(0x30); - local_1c = 0x2c; - local_18 = 0x2f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))),"gfx/monsters/classic/monster_127_redhost.png", - 0x2d); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - Sprite::ReplaceSpritesheet - (GHIDRA_CAST(&(GHIDRA_CAST(entity))->_sprite),0,GHIDRA_CAST(local_2c)); - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - bVar3 = extraout_CL; - if (0xf < local_18) { - uVar7 = local_18 + 1; - pcVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))); - if (0xfff < uVar7) { - pcVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + -4)); - uVar7 = local_18 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + (-4 - GHIDRA_INT(pcVar6))))) { -LAB_005b1e76: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar6,uVar7); - bVar3 = extraout_CL_00; - } - ANM2::LoadGraphics(&(GHIDRA_CAST(entity))->_sprite,bVar3); - *GHIDRA_CAST((GHIDRA_CAST(entity) + 0x410)) = 0xf; - ANM2::SetFrame(&(GHIDRA_CAST(entity))->_sprite,GHIDRA_CAST("Bombed"),0); - uVar7 = Random(); - local_30 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x88,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar7); - local_38.y = (float)&(GHIDRA_CAST(local_30))->_sprite; - local_1c = 0; - local_18 = 0xf; - local_2c[0] = '\0'; - local_2c[1] = '\0'; - local_2c[2] = '\0'; - local_2c[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) = msvc::_Allocate(0x20); - local_1c = 0x1c; - local_18 = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))),"gfx/002.040_thrown tear.anm2",0x1d); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 2; - ANM2::Load(GHIDRA_CAST(local_38.y),GHIDRA_CAST(local_2c),1); - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - if (0xf < local_18) { - uVar7 = local_18 + 1; - pcVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))); - if (0xfff < uVar7) { - pcVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + -4)); - uVar7 = local_18 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + (-4 - GHIDRA_INT(pcVar6))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar6,uVar7); - } -LAB_005b2124: - ANM2::Play(GHIDRA_CAST(local_38.y),GHIDRA_CAST("Rock1"),0); - heldEffect = local_30; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410))))) + 0x10)))) = 2; - (GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_pendingDamage = 1.26117e-41; - (GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_index = (GHIDRA_CAST(entity))->_initSeed; - if (local_30->_parent != 0) { - local_40.y = (float)&local_30->_parent; - msvc::multiset::erase(); - } - heldEffect->_parent = this; - msvc::multiset::insert(); - entity = heldEffect; -LAB_005b2184: - TryHoldEntity(this,GHIDRA_CAST(entity)); - goto LAB_005b2306; - } - } - else if (iVar5 == 0xcc) { - if (((GHIDRA_CAST(entity))->_variant == 0) && ((GHIDRA_CAST(entity))->_subtype == 0)) { - (GHIDRA_CAST(entity))->_subtype = 99; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) = msvc::_Allocate(0x40); - local_1c = 0x36; - local_18 = 0x3f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))), - "gfx/monsters/rebirth/monster_247_flesh mobile host.png",0x37); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 3; - Sprite::ReplaceSpritesheet - (GHIDRA_CAST(&(GHIDRA_CAST(entity))->_sprite),1,GHIDRA_CAST(local_2c)); - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - bVar3 = extraout_CL_01; - if (0xf < local_18) { - uVar7 = local_18 + 1; - pcVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))); - if (0xfff < uVar7) { - pcVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + -4)); - uVar7 = local_18 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + (-4 - GHIDRA_INT(pcVar6))))) - goto LAB_005b1e76; - } - operator_delete(pcVar6,uVar7); - bVar3 = extraout_CL_02; - } - ANM2::LoadGraphics(&(GHIDRA_CAST(entity))->_sprite,bVar3); - *GHIDRA_CAST((GHIDRA_CAST(entity) + 0x410)) = 0xf; - ANM2::SetFrame(&(GHIDRA_CAST(entity))->_sprite,GHIDRA_CAST("Bombed"),0); - uVar13 = *GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(entity))->_flags) + 4)); - *GHIDRA_CAST(&(GHIDRA_CAST(entity))->_flags) = GHIDRA_UINT((GHIDRA_CAST(entity))->_flags) & 0xffffffef; - *GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(entity))->_flags) + 4)) = uVar13; - uVar7 = Random(); - local_30 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x88,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar7); - local_38.y = (float)&(GHIDRA_CAST(local_30))->_sprite; - local_1c = 0; - local_18 = 0xf; - local_2c[0] = '\0'; - local_2c[1] = '\0'; - local_2c[2] = '\0'; - local_2c[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) = msvc::_Allocate(0x20); - local_1c = 0x1c; - local_18 = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))),"gfx/002.040_thrown tear.anm2",0x1d); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 4; - ANM2::Load(GHIDRA_CAST(local_38.y),GHIDRA_CAST(local_2c),1); - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - if (0xf < local_18) { - uVar7 = local_18 + 1; - pcVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c))) + 0x0))); - if (0xfff < uVar7) { - pcVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + -4)); - uVar7 = local_18 + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) + (-4 - GHIDRA_INT(pcVar6))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar6,uVar7); - } - goto LAB_005b2124; - } - } - else { - if (iVar5 == 0xf5) goto LAB_005b2184; - if (iVar5 == 0x124) { - entity->Remove(); - uVar7 = Random(); - iVar5 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar13)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar13)) + 0x1))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar13)) + 0x2))) = 0; - pVVar12 = &g_vectorZero; - pVVar4 = &this->_pos; - fVar11 = 1.90577e-43; - fVar10 = 1.4013e-42; - fVar8 = 8.36807e-39; - local_30 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x88,pVVar4,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - ANM2::ANM2(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x284)),&(GHIDRA_CAST(entity))->_sprite); - other._championColor._offset[0] = fVar8; - other._filename._buf[0] = in_stack_fffffd7c[0]; - other._filename._buf[1] = in_stack_fffffd7c[1]; - other._filename._buf[2] = in_stack_fffffd7c[2]; - other._filename._buf[3] = in_stack_fffffd7c[3]; - other._filename._buf[4] = in_stack_fffffd7c[4]; - other._filename._buf[5] = in_stack_fffffd7c[5]; - other._filename._buf[6] = in_stack_fffffd7c[6]; - other._filename._buf[7] = in_stack_fffffd7c[7]; - other._filename._buf[8] = in_stack_fffffd7c[8]; - other._filename._buf[9] = in_stack_fffffd7c[9]; - other._filename._buf[10] = in_stack_fffffd7c[10]; - other._filename._buf[0xb] = in_stack_fffffd7c[0xb]; - other._filename._buf[0xc] = in_stack_fffffd7c[0xc]; - other._filename._buf[0xd] = in_stack_fffffd7c[0xd]; - other._filename._buf[0xe] = in_stack_fffffd7c[0xe]; - other._filename._buf[0xf] = in_stack_fffffd7c[0xf]; - other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x10))); - other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x14))); - other._animDefaultName._buf[0] = in_stack_fffffd7c[0x18]; - other._animDefaultName._buf[1] = in_stack_fffffd7c[0x19]; - other._animDefaultName._buf[2] = in_stack_fffffd7c[0x1a]; - other._animDefaultName._buf[3] = in_stack_fffffd7c[0x1b]; - other._animDefaultName._buf[4] = in_stack_fffffd7c[0x1c]; - other._animDefaultName._buf[5] = in_stack_fffffd7c[0x1d]; - other._animDefaultName._buf[6] = in_stack_fffffd7c[0x1e]; - other._animDefaultName._buf[7] = in_stack_fffffd7c[0x1f]; - other._animDefaultName._buf[8] = in_stack_fffffd7c[0x20]; - other._animDefaultName._buf[9] = in_stack_fffffd7c[0x21]; - other._animDefaultName._buf[10] = in_stack_fffffd7c[0x22]; - other._animDefaultName._buf[0xb] = in_stack_fffffd7c[0x23]; - other._animDefaultName._buf[0xc] = in_stack_fffffd7c[0x24]; - other._animDefaultName._buf[0xd] = in_stack_fffffd7c[0x25]; - other._animDefaultName._buf[0xe] = in_stack_fffffd7c[0x26]; - other._animDefaultName._buf[0xf] = in_stack_fffffd7c[0x27]; - other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x28))); - other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x2c))); - other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x30))); - other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x34))); - other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x38))); - other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x3c))); - other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0x40))); - other._animState._isPlaying = in_stack_fffffd7c[0x44]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x45))); - other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x48))); - other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x4c))); - other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x50))); - other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x54))); - other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x58))); - other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x5c))); - other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0x60))); - other._overlayAnimState._isPlaying = in_stack_fffffd7c[100]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x65))); - other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x68))); - other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x6c))); - other._overlayRenderFirst = in_stack_fffffd7c[0x70]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x71))); - other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x74))); - other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x78))); - other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x7c))); - other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x80))); - other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x84))); - other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x88))); - other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffd7c)) + 0x8c))); - other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffd7c)) + 0x90))); - other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0x94))); - other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0x98))); - other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0x9c))); - other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xa0))); - other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xa4))); - other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xa8))); - other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xac))); - other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xb0))); - other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xb4))); - other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xb8))); - other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xbc))); - other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xc0))); - other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xc4))); - other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xc8))); - other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xcc))); - other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xd0))); - other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xd4))); - other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xd8))); - other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xdc))); - other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xe0))); - other._championColor._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xe4))); - other._championColor._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xe8))); - other._championColor._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xec))); - other._championColor._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffd7c)) + 0xf0))); - other._championColor._offset[1] = fVar10; - other._championColor._offset[2] = fVar11; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x100))) = pVVar4; - other._playbackSpeed = (float)pVVar12; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = (char)uVar13; - other._loaded = SUB41(uVar13,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x10a))) = SUB42(uVar13,2); - other._shadowLayerIndex = iVar5; - other._bitflags = uVar7; - ANM2::operator_assign(&local_30->_sprite,other); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410))))) + 0x10)))) = 0xc; - (GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_pendingDamage = 0.0; - *GHIDRA_CAST(&(GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_pendingDamageFlags) = 0; - puVar9 = &local_30->_parent; - (GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_index = (GHIDRA_CAST(entity))->_initSeed; - if (*puVar9 != 0) { - local_40.y = (float)puVar9; - msvc::multiset::erase(); - } - *puVar9 = this; - msvc::multiset::insert(); - TryHoldEntity(this,GHIDRA_CAST(local_30)); - goto LAB_005b2306; - } - } - } - local_30 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x1)))); - } while (local_30 < entityCount); - } - queryResult = EntityList::QueryRadius - (GHIDRA_CAST(local_40.y),GHIDRA_CAST((local_2c + 8)),&this->_pos, - 44.0,6); - nearbyEntities[0] = '\x01'; - (*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((queryResult)) + 0x4)))); - iStack_48 = queryResult->_capacity; - puStack_44 = GHIDRA_CAST(queryResult->_size); - local_38.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)nearbyEntities)) + 0x4))); - if (local_2c[8] == '\0') { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 5; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_2c)) + 0xc))),0); - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - local_38.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)nearbyEntities)) + 0x4))); - } - uVar7 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) = local_38.y; - if (puStack_44 != GHIDRA_CAST(0x0)) { - do { - rockShot = *GHIDRA_CAST(((GHIDRA_CAST(local_38.y))->_buf + uVar7 * 4)); - if (rockShot[10] == 2) { - isRockShot = rockShot[0xb] == 0x28; -LAB_005b219a: - if ((((isRockShot) && (GHIDRA_CAST(rockShot[0xef]) != this)) && - (*GHIDRA_CAST((GHIDRA_CAST(rockShot) + 0x173)) == '\0')) && (-75.0 < (float)rockShot[0xd4])) { - (**(code **)(*rockShot + 0x28))(); - uVar7 = Random(); - local_30 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x88,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7) - ; - ANM2::ANM2(&spriteCopy,GHIDRA_CAST((rockShot + 0x12))); - Isaac::SwapANM2(&local_30->_sprite,&spriteCopy); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 6; - ANM2::Reset(room); - AnimationState::~AnimationState(&spriteCopy._overlayAnimState); - AnimationState::~AnimationState(&spriteCopy._animState); - (GHIDRA_CAST((spriteCopy._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&spriteCopy))))->msvc::string::_Tidy_deallocate(); - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - uVar1 = *GHIDRA_CAST((GHIDRA_CAST(rockShot) + 0x32)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410))))) + 0x10)))) = GHIDRA_UINT(uVar1); - (GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_pendingDamage = - (float)GHIDRA_UINT(*GHIDRA_CAST((rockShot + 0xc))); - (GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_index = rockShot[0xfb]; - *GHIDRA_CAST(&(GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_pendingDamageFlags) = 0; - if (uVar1 == 0xe) { - *GHIDRA_CAST(&(GHIDRA_CAST((GHIDRA_INT(local_30) + 0x410)))->_pendingDamageFlags) = - GHIDRA_INT((float)rockShot[0xe0]); - } - puVar9 = &local_30->_parent; - if (local_30->_parent != 0) { - local_40.y = (float)puVar9; - msvc::multiset::erase(); - } - *puVar9 = this; - msvc::multiset::insert(); - TryHoldEntity(this,GHIDRA_CAST(local_30)); - goto LAB_005b2306; - } - } - else if (rockShot[10] == 9) { - isRockShot = rockShot[0xb] == 8; - goto LAB_005b219a; - } - uVar7 = uVar7 + 1; - } while (uVar7 < puStack_44); - } - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - ANM2::Reset(&this->_heldSprite); - FlushQueueItem(this); - this->_itemState = 0x25c; - this->_itemStateCooldown = 0; -LAB_005b2306: - if (nearbyEntities[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(nearbyEntities))) + 0x4))) != GHIDRA_CAST(0x0)) { - uVar7 = (GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) + -0x114)))->_bitflags; - qVar2 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar7; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar7)); - free(&(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) + -0x114)))->_bitflags); - } - } - } - ExceptionList = local_10; - return; -} - -// 005b2360 -void Entity_Player::UseRedKey() -{ - int *doorIt; - uint32_t doorSlot; - float dy; - float dx; - int door; - - doorSlot = 0; - doorIt = GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7744)); - while ((door = *doorIt, door == 0 || - (dy = (this->_pos).y - *GHIDRA_CAST((door + 0x340)), - dx = (this->_pos).x - *GHIDRA_CAST((door + 0x33c)), 14400.0 <= dy * dy + dx * dx))) { - doorSlot = doorSlot + 1; - doorIt = doorIt + 1; - if (7 < doorSlot) { - return; - } - } - if (doorSlot != 0xffffffff) { - Level::MakeRedRoomDoor(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,doorSlot); - } - return; -} - -// 005b23f0 -void Entity_Player::use_card_hagalaz(RNG *rng) -{ - Entity_Player *npc = this; - uint32_t uVar1; - Entity_NPC *npc; - Entity *spawned; - int *piVar2; - uint32_t uVar3; - void *pvVar4; - uint8_t *particlesLeft; - code *pcVar5; - void *gridX; - int iVar6; - float fVar7; - TypeDescriptor *pTVar8; - uint32_t uVar9; - TypeDescriptor *pTVar10; - uint32_t uVar11; - EntityRef destroySource2; - EntityRef destroySource; - EntityRef damageGridSource; - EntityRef rockDamageSource; - Vector particlePos; - float npcPosY; - float npcPosX; - Vector particleVelocity; - uint32_t entityIndex; - uint32_t rngShift3; - uint32_t rngSeed; - Entity_Player *player; - void *local_1b8; - uint8_t *local_1b4; - int *local_1b0; - uint32_t local_1ac; - uint32_t local_1a8; - uint32_t local_1a4; - float local_1a0; - uint32_t local_19c; - float fStack_198; - float fStack_194; - float fStack_190; - float local_18c; - uint32_t local_188; - uint32_t local_184; - int rockEnemyTable [95]; - Manager *manager; - EntityRef *sourceRef; - - rockEnemyTable[0x5e] = __security_cookie ^ GHIDRA_UINT((rockEnemyTable + 0x5f)); - if (rng == GHIDRA_CAST(0x0)) { - uVar1 = 0; - } - else { - uVar1 = rng->_seed; - } - pvVar4 = g_game->_room; - rngShift3 = 0x19; - local_1b8 = (void *)0x1; - rngSeed = uVar1; - player = npc; - if (1 < *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xc)) + -1) { - do { - local_1b0 = GHIDRA_CAST(0x1); - gridX = local_1b8; - if (1 < *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x10)) + -1) { - do { - if (-1 < GHIDRA_INT(gridX)) { - if (((GHIDRA_INT(gridX) < *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xc))) && (-1 < GHIDRA_INT(local_1b0))) && - (GHIDRA_INT(local_1b0) < *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x10)))) { - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xc)) * GHIDRA_INT(local_1b0) + GHIDRA_INT(gridX); - if (-1 < iVar6) { - piVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + iVar6 * 4 + 0x24)); - if ((piVar2 != GHIDRA_CAST(0x0)) && (piVar2[1] != 0x10)) { - if (rng == GHIDRA_CAST(0x0)) { -LAB_005b2520: - pcVar5 = *(code **)(*piVar2 + 0x14); - (GHIDRA_CAST((&destroySource)))->EntityRef::constructor(GHIDRA_CAST(player)); - (*pcVar5)(0,&destroySource); - if (piVar2[1] == 0x16) { - pcVar5 = *(code **)(*piVar2 + 0x14); - (GHIDRA_CAST((&destroySource2)))->EntityRef::constructor(GHIDRA_CAST(player)); - sourceRef = &destroySource2; - uVar9 = 0; - goto LAB_005b2568; - } - } - else { - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar5 = (code *)swi(3); - (*pcVar5)(); - return; - } - uVar1 = uVar1 >> 5 ^ uVar1; - uVar1 = uVar1 << 0x1b ^ uVar1; - uVar1 = uVar1 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar1; - if ((uVar1 & 3) == 0) goto LAB_005b2520; - pcVar5 = *(code **)(*piVar2 + 0x10); - (GHIDRA_CAST((&damageGridSource)))->EntityRef::constructor(GHIDRA_CAST(player)); - sourceRef = &damageGridSource; - uVar9 = 1; -LAB_005b2568: - (*pcVar5)(uVar9,sourceRef); - } - gridX = local_1b8; - } - } - } - } - local_1b0 = GHIDRA_CAST((GHIDRA_INT(local_1b0) + 1)); - pvVar4 = g_game->_room; - } while (GHIDRA_INT(local_1b0) < *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x10)) + -1); - rngSeed = uVar1; - } - local_1b8 = (void *)(GHIDRA_INT(gridX) + 1); - pvVar4 = g_game->_room; - } while (GHIDRA_INT(local_1b8) < *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xc)) + -1); - } - rockEnemyTable[0] = 0x335; - rockEnemyTable[1] = 0; - rockEnemyTable[2] = 0x17; - rockEnemyTable[3] = 3; - rockEnemyTable[4] = 0x35b; - rockEnemyTable[5] = 0; - rockEnemyTable[6] = 0x29; - rockEnemyTable[7] = 3; - rockEnemyTable[8] = 0x332; - rockEnemyTable[9] = 0; - rockEnemyTable[10] = 0x332; - rockEnemyTable[0xb] = 1; - rockEnemyTable[0xc] = 0x332; - rockEnemyTable[0xd] = 2; - rockEnemyTable[0xe] = 0x12e; - rockEnemyTable[0xf] = 0; - rockEnemyTable[0x10] = 0x12e; - rockEnemyTable[0x11] = 10; - rockEnemyTable[0x12] = 0x33a; - rockEnemyTable[0x13] = 0; - rockEnemyTable[0x14] = 0x2a; - rockEnemyTable[0x15] = 0; - rockEnemyTable[0x16] = 0x2a; - rockEnemyTable[0x17] = 1; - rockEnemyTable[0x18] = 0x2a; - rockEnemyTable[0x19] = 2; - rockEnemyTable[0x1a] = 0xc9; - rockEnemyTable[0x1b] = 0; - rockEnemyTable[0x1c] = 0xca; - rockEnemyTable[0x1d] = 0; - rockEnemyTable[0x1e] = 0xca; - rockEnemyTable[0x1f] = 10; - rockEnemyTable[0x20] = 0xcb; - rockEnemyTable[0x21] = 0; - rockEnemyTable[0x22] = 0xeb; - rockEnemyTable[0x23] = 0; - rockEnemyTable[0x24] = 0xec; - rockEnemyTable[0x25] = 0; - rockEnemyTable[0x26] = 0x324; - rockEnemyTable[0x27] = 0; - rockEnemyTable[0x28] = 0x329; - rockEnemyTable[0x29] = 0; - rockEnemyTable[0x2a] = 0x2c; - rockEnemyTable[0x2b] = 0; - rockEnemyTable[0x2c] = 0x2c; - rockEnemyTable[0x2d] = 1; - rockEnemyTable[0x2e] = 0x36d; - rockEnemyTable[0x2f] = 0; - rockEnemyTable[0x30] = 0x37d; - rockEnemyTable[0x31] = 0; - rockEnemyTable[0x32] = 0x354; - rockEnemyTable[0x33] = 0; - rockEnemyTable[0x34] = 0x393; - rockEnemyTable[0x35] = 1; - rockEnemyTable[0x36] = 0x1b; - rockEnemyTable[0x37] = 0; - rockEnemyTable[0x38] = 0x1b; - rockEnemyTable[0x39] = 1; - rockEnemyTable[0x3a] = 0x1b; - rockEnemyTable[0x3b] = 3; - rockEnemyTable[0x3c] = 0x1b; - rockEnemyTable[0x3d] = 1; - rockEnemyTable[0x3e] = 0xcc; - rockEnemyTable[0x3f] = 0; - rockEnemyTable[0x40] = 0xf7; - rockEnemyTable[0x41] = 0; - rockEnemyTable[0x42] = 0x29; - rockEnemyTable[0x43] = 0; - rockEnemyTable[0x44] = 0x20; - rockEnemyTable[0x45] = 0; - rockEnemyTable[0x46] = 0x29; - rockEnemyTable[0x47] = 2; - rockEnemyTable[0x48] = 0x348; - rockEnemyTable[0x49] = 0; - rockEnemyTable[0x4a] = 0x29; - rockEnemyTable[0x4b] = 4; - rockEnemyTable[0x4c] = 0x348; - rockEnemyTable[0x4d] = 0; - rockEnemyTable[0x4e] = 0xfe; - rockEnemyTable[0x4f] = 0; - rockEnemyTable[0x50] = 0x20; - rockEnemyTable[0x51] = 0; - rockEnemyTable[0x52] = 0x11b; - rockEnemyTable[0x53] = 0; - local_1b8 = g_game->_room; - rockEnemyTable[0x54] = 0x20; - rockEnemyTable[0x55] = 0; - rockEnemyTable[0x56] = 0xd4; - rockEnemyTable[0x57] = 0; - rockEnemyTable[0x58] = 0x11e; - rockEnemyTable[0x59] = 0; - rockEnemyTable[0x5a] = 0xd4; - rockEnemyTable[0x5b] = 3; - rockEnemyTable[0x5c] = 0x11e; - rockEnemyTable[0x5d] = 0; - entityIndex = 0; - if (*GHIDRA_CAST((GHIDRA_CAST(local_1b8) + 0x1264)) != 0) { - do { - if (*GHIDRA_CAST((*GHIDRA_CAST((entityIndex * 4 + *GHIDRA_CAST((GHIDRA_CAST(local_1b8) + 0x125c)))) + 0x28)) - 10U < - 0x3de) { - if (rng == GHIDRA_CAST(0x0)) { -LAB_005b29ae: - npc = (Entity_NPC *) - __RTDynamicCast(*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_1b8) + 0x125c)) + entityIndex * 4)) - ,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - uVar3 = 0; - do { - if ((npc->_type == rockEnemyTable[uVar3 * 2]) && - (npc->_variant == rockEnemyTable[uVar3 * 2 + 1])) { - local_1a8 = 0; - local_1a4 = 0; - local_1a0 = 0.0; - local_19c = 0; - fStack_198 = g_vectorZero.x; - fStack_194 = g_vectorZero.y; - fStack_190 = g_vectorZero.x; - local_18c = g_vectorZero.y; - local_188 = 0; - local_184 = 0; - npc->Kill(&local_1a8); - manager = g_manager; - local_1b0 = GHIDRA_CAST(0x89); - seed_fart_sound_override(GHIDRA_CAST(&local_1b0)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1b0),1.0,2,0,1.0,0.0); - break; - } - uVar3 = uVar3 + 1; - } while (uVar3 < 0x1b); - piVar2 = rockEnemyTable + 0x37; - uVar3 = 0; -LAB_005b2ad0: - if ((npc->_type != piVar2[-1]) || (npc->_variant != *piVar2)) goto LAB_005b2adc; - if (npc->_type == 0xd4) { - npc->_isInvicible = 0; - } - (GHIDRA_CAST((npc)))->Entity_NPC::Morph(rockEnemyTable[uVar3 * 4 + 0x38],rockEnemyTable[uVar3 * 4 + 0x39],0, - -1); - manager = g_manager; - if (*GHIDRA_CAST((GHIDRA_CAST(player->_config) + 0x5c)) < 1) { - local_1b0 = GHIDRA_CAST(0x3f4ccccd); - } - else { - local_1b0 = GHIDRA_CAST(0x3f800000); - } - local_1b4 = GHIDRA_CAST(0x1e); - seed_fart_sound_override(GHIDRA_CAST(&local_1b4)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1b4),(float)local_1b0,2,0,1.0,0.0); - uVar3 = Random(); - particlesLeft = GHIDRA_CAST((uVar3 % 6 + 6)); - if (particlesLeft != GHIDRA_CAST(0x0)) { - local_1b4 = particlesLeft; - do { - uVar1 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_1b4 = GHIDRA_CAST((fVar7 + fVar7)); - uVar1 = Random(); - local_1b0 = GHIDRA_CAST(((float)((double)GHIDRA_INT(uVar1) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283064e-10 * 5.0)); - particleVelocity.x = cos((float)local_1b4); - particleVelocity.x = particleVelocity.x * (float)local_1b0; - particleVelocity.y = sin((float)local_1b4); - particleVelocity.y = particleVelocity.y * (float)local_1b0; - uVar1 = Random(); - npcPosX = (npc->_pos).x; - npcPosY = (npc->_pos).y; - uVar3 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_1b4 = GHIDRA_CAST((fVar7 + fVar7)); - uVar3 = Random(); - local_1b0 = GHIDRA_CAST(((float)((double)GHIDRA_INT(uVar3) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283064e-10 * 20.0)); - fVar7 = cos((float)local_1b4); - particlePos.x = fVar7 * (float)local_1b0 + npcPosX; - fVar7 = sin((float)local_1b4); - uVar11 = 0; - pTVar10 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - particlePos.y = fVar7 * (float)local_1b0 + npcPosY; - pTVar8 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar9 = 0; - spawned = Game::Spawn(g_game,1000,0x3b,&particlePos,&particleVelocity,GHIDRA_CAST(0x0),0, - uVar1); - piVar2 = GHIDRA_CAST(__RTDynamicCast(spawned,uVar9,pTVar8,pTVar10,uVar11)); - local_1b4 = GHIDRA_CAST(0x3f800000); - if (((float)piVar2[0xcf] - (npc->_pos).x) * particleVelocity.y - - ((float)piVar2[0xd0] - (npc->_pos).y) * particleVelocity.x < 0.0) { - local_1b4 = &DAT_bf800000; - } - local_1b0 = piVar2; - uVar1 = Random(); - piVar2[0x11d] = - GHIDRA_INT((((float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)] - ) * 2.3283064e-10 * 10.0 + 2.0) * (float)local_1b4)); - uVar1 = Random(); - iVar6 = uVar1 % 0xf + 0xf; - piVar2[0x117] = iVar6; - piVar2[0x118] = iVar6; - fVar7 = g_vectorOne.y; - piVar2[0x39] = GHIDRA_INT(g_vectorOne.x); - piVar2[0x3a] = GHIDRA_INT(fVar7); - pcVar5 = *(code **)(*piVar2 + 0x3c); - uVar1 = Random(); - local_1ac = 0x3f800000; - local_1a8 = 0x3f800000; - local_1a4 = 0x3f800000; - local_18c = 0.0; - local_188 = 0; - local_184 = 0; - local_19c = 0; - fStack_198 = 0.0; - fStack_194 = 0.0; - fStack_190 = 0.0; - local_1a0 = (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)] - ) * 2.3283064e-10 * 0.5 + 0.2; - (*pcVar5)(&local_1ac,0xffffffff,0xff,0,1); - (**(code **)(*local_1b0 + 0xc))(); - particlesLeft = particlesLeft + -1; - } while (particlesLeft != GHIDRA_CAST(0x0)); - uVar1 = rngSeed; - } - manager = g_manager; - local_1b4 = GHIDRA_CAST(0x89); - seed_fart_sound_override(GHIDRA_CAST(&local_1b4)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1b4),1.0,2,0,1.0,0.0); -LAB_005b2f5e: - manager = g_manager; - if ((npc->_type == 0x13) && - (((npc->_variant == 2 || (npc->_variant == 3)) && (npc->_i2 == 0)))) { - local_1b4 = GHIDRA_CAST(0x89); - seed_fart_sound_override(GHIDRA_CAST(&local_1b4)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1b4),1.0,2,0,1.0,0.0); - rockDamageSource._type = 0; - rockDamageSource._variant = 0; - rockDamageSource._spawnerType = 0; - rockDamageSource._spawnerVariant = 0; - rockDamageSource._position.x = g_vectorZero.x; - rockDamageSource._position.y = g_vectorZero.y; - rockDamageSource._velocity.x = g_vectorZero.x; - rockDamageSource._velocity.y = g_vectorZero.y; - rockDamageSource._flags = 0; - rockDamageSource._entity = (void *)0x0; - npc->TakeDamage(0x42200000,4,0,&rockDamageSource,0x1e); - } - goto LAB_005b3058; - } - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar5 = (code *)swi(3); - (*pcVar5)(); - return; - } - uVar1 = uVar1 >> 5 ^ uVar1; - uVar1 = uVar1 << 0x1b ^ uVar1; - uVar1 = uVar1 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar1; - rngSeed = uVar1; - if ((uVar1 & 3) == 0) goto LAB_005b29ae; - } -LAB_005b3058: - entityIndex = entityIndex + 1; - } while (entityIndex < *GHIDRA_CAST((GHIDRA_CAST(local_1b8) + 0x1264))); - } - if (rng == GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(0x14,4,GHIDRA_CAST(0x0)); - } - return; -LAB_005b2adc: - uVar3 = uVar3 + 1; - piVar2 = piVar2 + 4; - if (9 < uVar3) goto LAB_005b2f5e; - goto LAB_005b2ad0; -} - -// 005c88a0 -int Entity_Player::reroll_collectibles_on_damage(RNG *rng, uint8_t isIncludeActives) -{ - Entity_Player *itemPool = this; - code *pcVar1; - uint8_t bVar2; - char cVar3; - void *pvVar4; - ActiveItemDesc *activeDesc; - ItemConfig_Item *formCostume; - int iVar5; - ItemPool *itemPool; - int *piVar6; - int iVar7; - Entity_Player *this_00; - Entity_Player *heartPlayer; - uint32_t *d4Seed; - uint32_t activeSlot; - void *formsEnd; - int *historyEntry; - int heartsTaken; - uint32_t uVar8; - void *pvVar9; - int *activeEntry; - double dVar10; - int *removedItemsEnd; - void *formCounts; - void *formCountsEnd; - int rerolledCount; - int *removedItemsIt; - float activeChargeRatio; - int *activeHistoryEntry; - ItemConfig_Item *local_1c; - int maxHeartsDelta; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Game *game; - Manager *manager; - - puStack_c = &LAB_00af5dcd; - local_10 = ExceptionList; - ExceptionList = &local_10; - local_8 = 0; - pvVar4 = (GHIDRA_CAST((&itemPool->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x139); - if (pvVar4 != (void *)0x0) { - msvc::vector::_Emplace_reallocate(0,pvVar4); - } - (GHIDRA_CAST((&itemPool->_temporaryeffects)))->TemporaryEffects::ClearEffects(0); - ClearCostumes(itemPool); - update_player_skin(itemPool); - itemPool->_damageModifier = 0; - itemPool->_fireDelayModifier = 0; - itemPool->_speedModifier = 0; - itemPool->_tearRangeModifier = 0; - itemPool->_shotSpeedModifier = 0; - itemPool->_luckModifier = 0; - ResetItemState(itemPool); - pvVar4 = (itemPool->_collectibleRNGs)._begin; - maxHeartsDelta = 0; - d4Seed = GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x11c0)); - rerolledCount = 0; - removedItemsEnd = GHIDRA_CAST(0x0); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - activeHistoryEntry = (itemPool->_history)._historyItems._end; - historyEntry = (itemPool->_history)._historyItems._begin; - activeChargeRatio = 0.0; - if (historyEntry != activeHistoryEntry) { - do { - if ((char)historyEntry[1] == '\0') { - uVar8 = historyEntry[2]; - if (0 < *GHIDRA_CAST((GHIDRA_INT((itemPool->_collectibleCounts)._begin) + uVar8 * 4))) { - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar8)) goto LAB_005c8a2a; -LAB_005c8a44: - local_1c = GHIDRA_CAST(0x0); - } - else if (GHIDRA_INT(uVar8) < 0) { - if ((GHIDRA_INT(uVar8) < 0) && - (pvVar9 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar8) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar9) >> 2)) { - local_1c = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar9) + ~uVar8 * 4))); - } - else { - local_1c = GHIDRA_CAST(0x0); - } - } - else { -LAB_005c8a2a: - pvVar9 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar9) >> 2 <= GHIDRA_INT(uVar8)) - goto LAB_005c8a44; - local_1c = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar8 * 4)); - } - activeSlot = 0xffffffff; - if (local_1c->type == 3) { - activeSlot = 0; - activeDesc = itemPool->_activeDesc; - do { - if (activeDesc->_item == local_1c->id) { - if ((GHIDRA_INT(activeSlot) < 0) || ((isIncludeActives != 0 && (GHIDRA_INT(activeSlot) < 2)))) - goto LAB_005c8a89; - goto LAB_005c8c08; - } - activeSlot = activeSlot + 1; - activeDesc = activeDesc + 1; - } while (activeSlot < 4); - activeSlot = 0xffffffff; - } -LAB_005c8a89: - bVar2 = CanRerollCollectible(itemPool,uVar8,0); - if ((((bVar2 == 0) || (*historyEntry < 0)) || - ((uVar8 == 0x248 && (isIncludeActives == 0)))) || - ((itemPool->_playerType == 0x1e && (*historyEntry <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x1f14)))))))) { -LAB_005c8c08: - if (local_1c->addCostumeOnPickup != 0) { - AddCostume(itemPool,local_1c,0); - } - } - else { - if (-1 < GHIDRA_INT(activeSlot)) { - if (local_1c->maxCharges < 1) { - activeChargeRatio = 1.0; - } - else { - if (GHIDRA_INT(activeSlot) < 4) { - iVar5 = itemPool->_activeDesc[activeSlot]._charge; - } - else { - iVar5 = 0; - } - activeChargeRatio = (float)iVar5 / (float)local_1c->maxCharges; - } - itemPool->_activeDesc[activeSlot]._item = 0; - uVar8 = historyEntry[2]; - } - piVar6 = GHIDRA_CAST((GHIDRA_INT((itemPool->_collectibleCounts)._begin) + uVar8 * 4)); - *piVar6 = *piVar6 + -1; - maxHeartsDelta = maxHeartsDelta - local_1c->addMaxhearts; - TriggerCollectibleRemoved(itemPool,historyEntry[2]); - pvVar9 = (itemPool->_collectibleCounts)._begin; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + historyEntry[2] * 4)) < 1) { - uVar8 = 0; - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + historyEntry[2] * 4)) = 0; - do { - if ((((-1 < GHIDRA_INT(uVar8)) && - (pvVar9 = (g_manager->_itemConfig)._playerForms._begin, - GHIDRA_INT(uVar8) < GHIDRA_INT((g_manager->_itemConfig)._playerForms._end) - GHIDRA_INT(pvVar9) >> 2 - )) && (iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar8 * 4)), iVar5 != 0)) && - ((*GHIDRA_CAST((iVar5 + 8)) != 0 || *GHIDRA_CAST((iVar5 + 0xc)) != 0 && - (cVar3 = ItemConfig::collectible_has_tags(*GHIDRA_CAST((iVar5 + 8))), cVar3 != '\0'))) - ) { - IncrementPlayerFormCounter(itemPool,uVar8,-1); - } - uVar8 = uVar8 + 1; - } while (uVar8 < 0x10); - if (removedItemsEnd == GHIDRA_CAST(0x0)) { - msvc::vector::_Emplace_reallocate(0,historyEntry + 2); - } - else { - *removedItemsEnd = historyEntry[2]; - removedItemsEnd = removedItemsEnd + 1; - } - } - rerolledCount = rerolledCount + 1; - historyEntry[2] = 0; - if (local_1c->type == 3) { - activeHistoryEntry = historyEntry; - } - } - } - } - historyEntry = historyEntry + 7; - } while (historyEntry != (itemPool->_history)._historyItems._end); - } - removedItemsIt = GHIDRA_CAST(0x0); - bVar2 = HasCollectible(itemPool,0x102,0); - if (bVar2 != 0) { - uVar8 = Random(); - itemPool->_speedModifier = itemPool->_speedModifier + (uVar8 % 3 - 1); - uVar8 = Random(); - itemPool->_fireDelayModifier = itemPool->_fireDelayModifier + (uVar8 % 3 - 1); - uVar8 = Random(); - itemPool->_damageModifier = itemPool->_damageModifier + (uVar8 % 3 - 1); - uVar8 = Random(); - itemPool->_tearRangeModifier = itemPool->_tearRangeModifier + (uVar8 % 3 - 1); - uVar8 = Random(); - itemPool->_shotSpeedModifier = itemPool->_shotSpeedModifier + (uVar8 % 3 - 1); - uVar8 = Random(); - itemPool->_luckModifier = itemPool->_luckModifier + (uVar8 % 3 - 1); - } - uVar8 = 0; - do { - if (((itemPool->_hasCurseMistEffect == 0) && (itemPool->_isCoopGhost == 0)) && - ((2 < itemPool->_playerForms[uVar8] && - (((pvVar9 = (g_manager->_itemConfig)._playerForms._begin, - GHIDRA_INT(uVar8) < GHIDRA_INT((g_manager->_itemConfig)._playerForms._end) - GHIDRA_INT(pvVar9) >> 2 && - (iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar8 * 4)), iVar5 != 0)) && - (iVar5 = *GHIDRA_CAST((iVar5 + 0x28)), iVar5 != -1)))))) { - if ((iVar5 < 0) || - (pvVar9 = (g_manager->_itemConfig)._nullItems._begin, - GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 <= iVar5)) { - formCostume = GHIDRA_CAST(0x0); - } - else { - formCostume = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + iVar5 * 4)); - } - AddCostume(itemPool,formCostume,0); - } - game = g_game; - uVar8 = uVar8 + 1; - } while (uVar8 < 0x10); - if (removedItemsEnd != GHIDRA_CAST(0x0)) { - do { - ItemPool::ResetCollectible(&game->_itemPool,*removedItemsIt); - removedItemsIt = removedItemsIt + 1; - } while (removedItemsIt != removedItemsEnd); - } - uVar8 = GHIDRA_INT((g_manager->_itemConfig)._playerForms._end) - - GHIDRA_INT((g_manager->_itemConfig)._playerForms._begin) >> 2; - formCounts = (void *)0x0; - formCountsEnd = (void *)0x0; - if (uVar8 != 0) { - if (0x3fffffff < uVar8) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - formCounts = msvc::_Allocate(uVar8 * 4); - formCountsEnd = (void *)(GHIDRA_INT(formCounts) + uVar8 * 4); - memset(formCounts,0,uVar8 * 4); - } - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); - (itemPool->_history)._isLocked = 1; - historyEntry = (itemPool->_history)._historyItems._begin; - piVar6 = (itemPool->_history)._historyItems._end; - if (historyEntry != piVar6) { - activeEntry = activeHistoryEntry; - do { - if (((char)historyEntry[1] == '\0') && (historyEntry[2] == 0)) { - _isIncludeActives = GHIDRA_CAST(0x0); - do { - game = g_game; - local_1c = GHIDRA_CAST(historyEntry[2]); - if (local_1c != GHIDRA_CAST(0x0)) goto LAB_005c8f47; - uVar8 = *d4Seed; - if (activeEntry == historyEntry) { - if (uVar8 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar8 = *d4Seed; - if (uVar8 == 0) { - pcVar1 = (code *)swi(3); - iVar5 = (*pcVar1)(); - return iVar5; - } - } - uVar8 = uVar8 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x11c4)) & 0x1f) ^ uVar8; - uVar8 = uVar8 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x11c8)) & 0x1f) ^ uVar8; - uVar8 = uVar8 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x11cc)) & 0x1f) ^ uVar8; - *d4Seed = uVar8; - iVar5 = ItemPool::GetCollectible(&game->_itemPool,historyEntry[6],uVar8,0xc,0,0); - historyEntry[2] = iVar5; - activeEntry = (itemPool->_history)._historyItems._end; - activeHistoryEntry = activeEntry; - } - else { - itemPool = &g_game->_itemPool; - if (uVar8 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar8 = *d4Seed; - if (uVar8 == 0) { - pcVar1 = (code *)swi(3); - iVar5 = (*pcVar1)(); - return iVar5; - } - } - uVar8 = uVar8 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x11c4)) & 0x1f) ^ uVar8; - uVar8 = uVar8 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x11c8)) & 0x1f) ^ uVar8; - uVar8 = uVar8 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x11cc)) & 0x1f) ^ uVar8; - *d4Seed = uVar8; - iVar5 = ItemPool::GetCollectible(itemPool,historyEntry[6],uVar8,6,0,0); - historyEntry[2] = iVar5; - } - if ((itemPool->_playerType == 0x1e) && (historyEntry[2] == 0x26b)) { - historyEntry[2] = 0; - } - _isIncludeActives = GHIDRA_CAST((GHIDRA_INT(_isIncludeActives) + 1)); - } while (GHIDRA_INT(_isIncludeActives) < 10); - local_1c = GHIDRA_CAST(historyEntry[2]); - if (local_1c == GHIDRA_CAST(0x0)) { - historyEntry[2] = 0x19; - local_1c = GHIDRA_CAST(0x19); - } -LAB_005c8f47: - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(local_1c)) goto LAB_005c8f8c; -LAB_005c8fa6: - _isIncludeActives = GHIDRA_CAST(0x0); - } - else if (GHIDRA_INT(local_1c) < 0) { - if ((GHIDRA_INT(local_1c) < 0) && - (pvVar9 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~GHIDRA_UINT(local_1c)) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar9) >> 2)) { - _isIncludeActives = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar9) + ~GHIDRA_UINT(local_1c) * 4))); - } - else { - _isIncludeActives = GHIDRA_CAST(0x0); - } - } - else { -LAB_005c8f8c: - pvVar9 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar9) >> 2 <= GHIDRA_INT(local_1c)) - goto LAB_005c8fa6; - _isIncludeActives = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + GHIDRA_INT(local_1c) * 4)); - } - if (*_isIncludeActives == 3) { - dVar10 = ceil((double)((float)_isIncludeActives[0x1d] * activeChargeRatio)); - iVar5 = GHIDRA_INT(dVar10); - } - else { - iVar5 = 0; - } - AddCollectible(itemPool,GHIDRA_INT(local_1c),iVar5,0,0,0,0); - local_1c = GHIDRA_CAST(0x0); - formsEnd = (g_manager->_itemConfig)._playerForms._end; - pvVar9 = (g_manager->_itemConfig)._playerForms._begin; - if (GHIDRA_INT(formsEnd) - GHIDRA_INT(pvVar9) >> 2 != 0) { - do { - if ((((-1 < GHIDRA_INT(local_1c)) && (GHIDRA_INT(local_1c) < GHIDRA_INT(formsEnd) - GHIDRA_INT(pvVar9) >> 2)) && - (iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + GHIDRA_INT(local_1c) * 4)), iVar5 != 0)) && - (*GHIDRA_CAST((iVar5 + 8)) != 0 || *GHIDRA_CAST((iVar5 + 0xc)) != 0)) { - cVar3 = ItemConfig::collectible_has_tags(*GHIDRA_CAST((iVar5 + 8))); - manager = g_manager; - if (cVar3 != '\0') { - piVar6 = GHIDRA_CAST((GHIDRA_INT(formCounts) + GHIDRA_INT(local_1c) * 4)); - *piVar6 = *piVar6 + 1; - formsEnd = (manager->_itemConfig)._playerForms._end; - } - } - local_1c = GHIDRA_CAST((GHIDRA_INT(local_1c) + 1)); - pvVar9 = (g_manager->_itemConfig)._playerForms._begin; - } while (local_1c < GHIDRA_UINT((GHIDRA_INT(formsEnd) - GHIDRA_INT(pvVar9) >> 2))); - activeEntry = activeHistoryEntry; - } - maxHeartsDelta = maxHeartsDelta + _isIncludeActives[0x16]; - piVar6 = (itemPool->_history)._historyItems._end; - } - historyEntry = historyEntry + 7; - } while (historyEntry != piVar6); - } - (itemPool->_history)._isLocked = 0; - if (maxHeartsDelta < 0) { - heartPlayer = itemPool; - do { - iVar5 = maxHeartsDelta; - if (-1 < maxHeartsDelta) break; - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((heartPlayer)) + 0x1950)))); - if (0 < iVar5) { - iVar7 = -maxHeartsDelta; - if (iVar5 < -maxHeartsDelta) { - iVar7 = iVar5; - } - maxHeartsDelta = maxHeartsDelta + iVar7; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((heartPlayer)) + 0x1950)))) = iVar5 - iVar7; - } - heartPlayer = GHIDRA_CAST(heartPlayer->_subPlayer); - iVar5 = maxHeartsDelta; - } while (heartPlayer != GHIDRA_CAST(0x0)); - heartPlayer = itemPool; - maxHeartsDelta = iVar5; - do { - if (-1 < iVar5) break; - iVar7 = heartPlayer->_maxHearts; - if (0 < iVar7) { - heartsTaken = -iVar5; - if (iVar7 < -iVar5) { - heartsTaken = iVar7; - } - AddMaxHearts(heartPlayer,-heartsTaken,0); - iVar5 = maxHeartsDelta + heartsTaken; - if (heartPlayer->_redHearts < 1) { - iVar7 = GetHealthType(heartPlayer); - if ((iVar7 == 3) || (heartPlayer->_playerType == 0x12)) { - AddMaxHearts(heartPlayer,2,0); - AddHearts(heartPlayer,2,1,0); - } - else if (heartPlayer->_soulHearts < 1) { - AddSoulHearts(this_00,2,0); - } - } - maxHeartsDelta = iVar5; - } - heartPlayer = GHIDRA_CAST(heartPlayer->_subPlayer); - } while (heartPlayer != GHIDRA_CAST(0x0)); - } - else if (0 < maxHeartsDelta) { - AddMaxHearts(itemPool,maxHeartsDelta,0); - } - uVar8 = 0; - if (GHIDRA_INT((g_manager->_itemConfig)._playerForms._end) - - GHIDRA_INT((g_manager->_itemConfig)._playerForms._begin) >> 2 != 0) { - do { - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(formCounts) + uVar8 * 4)); - if (0 < iVar5) { - IncrementPlayerFormCounter(itemPool,uVar8,iVar5); - } - uVar8 = uVar8 + 1; - } while (uVar8 < GHIDRA_UINT((GHIDRA_INT((g_manager->_itemConfig)._playerForms._end) - - GHIDRA_INT((g_manager->_itemConfig)._playerForms._begin) >> 2))); - } - itemPool->_cacheFlags = itemPool->_cacheFlags | 0xffff; - EvaluateItems(itemPool); - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - if (formCounts != (void *)0x0) { - uVar8 = GHIDRA_INT(formCountsEnd) - GHIDRA_INT(formCounts) & 0xfffffffc; - pvVar4 = formCounts; - if (0xfff < uVar8) { - pvVar4 = *(void **)(GHIDRA_CAST(formCounts) + -4); - uVar8 = uVar8 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(formCounts) + (-4 - GHIDRA_INT(pvVar4))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar4,uVar8); - } - ExceptionList = local_10; - return rerolledCount; -} - -// 005c96f0 -Entity_Familiar * Entity_Player::AddItemWisp(uint32_t param_1, Vector *param_2, char param_3) -{ - code *pcVar1; - uint8_t isBookOfVirtuesHeld; - void *pvVar2; - void *otherWispConfig; - Entity_Familiar *wisp; - Entity_Player *in_ECX; - int iVar3; - uint32_t otherLayer; - uint32_t uVar4; - int iVar5; - uint32_t *rngSeed; - uint32_t orbitLayer; - int layerStats [10]; - Game *game; - - layerStats[9] = __security_cookie ^ GHIDRA_UINT((layerStats + 10)); - iVar5 = 0x2c8; - isBookOfVirtuesHeld = HasCollectible(in_ECX,0x248,0); - if (isBookOfVirtuesHeld != 0) { - iVar5 = 0x10012; - } - pvVar2 = ItemConfig::get_wisp_config(iVar5); - orbitLayer = GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x18c))); - if (-1 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x18c))) { - uVar4 = 0; - layerStats[6] = 0; - layerStats[7] = 0; - layerStats[8] = 0; - pvVar2 = g_game->_room; - layerStats[0] = 0; - layerStats[1] = 0; - layerStats[2] = 0; - layerStats[3] = 9999; - layerStats[4] = 9999; - layerStats[5] = 9999; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1264)) != 0) { - do { - iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x125c)) + uVar4 * 4)); - if ((((iVar5 != 0) && (*GHIDRA_CAST((iVar5 + 0x28)) == 3)) && - ((iVar3 = *GHIDRA_CAST((iVar5 + 0x2c)), iVar3 == 0xce || (iVar3 == 0xed)))) && - (*GHIDRA_CAST((iVar5 + 0x410)) == in_ECX)) { - if (iVar3 == 0xed) { - iVar3 = *GHIDRA_CAST((iVar5 + 0xf20)); - } - else if (iVar3 == 0xce) { - iVar3 = *GHIDRA_CAST((iVar5 + 0x30)); - } - else { - iVar3 = 0x248; - } - otherWispConfig = ItemConfig::get_wisp_config(iVar3); - iVar3 = *GHIDRA_CAST((iVar5 + 0xd70)); - otherLayer = iVar3 - 7; - if ((otherLayer < 3) && (-1 < GHIDRA_INT(otherLayer))) { - if ((*GHIDRA_CAST((iVar5 + 0x2c)) == 0xce) || - (GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(otherWispConfig) + 0x18e))) < layerStats[iVar3 + -4])) { - layerStats[iVar3 + -4] = GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(otherWispConfig) + 0x18e))); - layerStats[otherLayer] = iVar5; - } - layerStats[iVar3 + -1] = layerStats[iVar3 + -1] + 1; - } - } - uVar4 = uVar4 + 1; - } while (uVar4 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1264))); - } - if (param_3 != '\0') { - uVar4 = 0; - do { - if (layerStats[orbitLayer + 6] < *GHIDRA_CAST((&DAT_00b62c90 + orbitLayer * 4))) break; - orbitLayer = (orbitLayer + 1) % 3; - uVar4 = uVar4 + 1; - } while (uVar4 < 3); - } - if ((*GHIDRA_CAST((&DAT_00b62c90 + orbitLayer * 4)) <= layerStats[orbitLayer + 6]) && - (GHIDRA_CAST(layerStats[orbitLayer]) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(layerStats[orbitLayer]) + 0x28))(); - } - } - pvVar2 = (in_ECX->_collectibleRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(pvVar2) + 0x2c80)); - uVar4 = *rngSeed; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar4 = *rngSeed; - if (uVar4 == 0) { - pcVar1 = (code *)swi(3); - wisp = GHIDRA_CAST((*pcVar1)()); - return wisp; - } - } - game = g_game; - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x2c84)) & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x2c88)) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x2c8c)) & 0x1f) ^ uVar4; - *rngSeed = uVar4; - wisp = (Entity_Familiar *) - Game::Spawn(game,3,0xed,param_2,&g_vectorZero,GHIDRA_CAST(in_ECX),param_1,uVar4); - if ((param_3 != '\0') && (-1 < GHIDRA_INT(orbitLayer))) { - (GHIDRA_CAST((wisp)))->Entity_Familiar::AddToOrbit(orbitLayer + 7); - } - wisp->Update(); - return wisp; -} - -// 005c9930 -void Entity_Player::trigger_book_of_belial_passive(int activeId, int charges) -{ - Entity_Player *effectSprite = this; - void *pvVar1; - uint8_t bVar2; - uint32_t uVar3; - Entity *tmpEntity; - uint32_t uVar4; - LayerState *sparkLayer; - int iVar5; - Game *game; - float fVar6; - float sparkScaleX; - float sparkScaleY; - float fVar7; - int nullEffect [3]; - uint32_t local_7c; - Vector sparkPos; - Vector sparkVelocity; - Entity_Player *player; - Entity *local_64; - code *local_60; - ItemConfig_Item *local_5c; - uint32_t local_58; - uint32_t local_54; - uint8_t local_50 [8]; - float fStack_48; - float fStack_44; - float local_40; - float fStack_3c; - float fStack_38; - float fStack_34; - float local_30; - float fStack_2c; - Entity_Player *local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t uStack_14; - ANM2 *effectSprite; - Manager *manager; - - puStack_20 = local_50 + 0x4c; - uStack_14 = 0xffffffff; - puStack_18 = &LAB_00af5e50; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_50 + 0x40)); - ExceptionList = &local_1c; - player = effectSprite; - bVar2 = HasCollectible(effectSprite,0x3b,0); - if (bVar2 == 0) { - ExceptionList = local_1c; - return; - } - local_58 = g_manager; - local_5c = ItemConfig::GetCollectible(&g_manager->_itemConfig,activeId); - if (activeId < 0xbb) { - if (activeId == 0xba) { -LAB_005ca3b6: - iVar5 = 0x7e; -LAB_005ca3bc: - (GHIDRA_CAST((&effectSprite->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(iVar5,1,1); - ExceptionList = local_1c; - return; - } - switch(activeId) { - case 0x22: - case 0x3b: - case 0x85: - ExceptionList = local_1c; - return; - case 0x28: - case 0x7e: - local_54 = 0x21; - seed_fart_sound_override(GHIDRA_CAST(&local_54)); - (GHIDRA_CAST((&local_58->_sfxManager)))->SoundEffects::Play(local_54,1.0,2,0,1.0,0.0); - UseActiveItem(effectSprite,GHIDRA_CAST((GHIDRA_INT(&local_58) + 2)),0x23,1,-1,0); - Game::ShakeScreen(g_game,8); - pvVar1 = g_game->_room; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x7214)) = 10; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x7218)) = 5; - ExceptionList = local_1c; - return; - case 0x7f: - (GHIDRA_CAST((&effectSprite->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x81,1,2); - ExceptionList = local_1c; - return; - case 0x87: - (GHIDRA_CAST((&effectSprite->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x7b,1,1); - ExceptionList = local_1c; - return; - } -switchD_005c99c5_caseD_23: - if (local_5c == GHIDRA_CAST(0x0)) { - ExceptionList = local_1c; - return; - } - if (local_5c->maxCharges < 1) { - ExceptionList = local_1c; - return; - } - if (local_5c->chargeType != 0) { - ExceptionList = local_1c; - return; - } - } - else if (activeId < 0x22c) { - if (activeId == 0x22b) { - local_54 = 0x89; - seed_fart_sound_override(GHIDRA_CAST(&local_54)); - (GHIDRA_CAST((&local_58->_sfxManager)))->SoundEffects::Play(local_54,1.0,2,0,1.0,0.0); - Game::ShakeScreen(g_game,0xf); - local_58 = GHIDRA_CAST(0x0); - local_5c = g_game->_room; - game = g_game; - if (*GHIDRA_CAST((GHIDRA_CAST(local_5c) + 0x1264)) == 0) { - ExceptionList = local_1c; - return; - } - do { - tmpEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_5c) + 0x125c)) + GHIDRA_INT(local_58) * 4)); - if ((*GHIDRA_CAST(&game->_deathmatchManager) < 2) || (tmpEntity->_type != 1)) { - local_54 = tmpEntity->_type; - if (local_54 - 10 < 0x3de) goto LAB_005c9c18; - } - else { - local_54 = 1; -LAB_005c9c18: - if ((((tmpEntity->_entityCollisionClass != 1) && (tmpEntity->_entityCollisionClass != 0)) - && (tmpEntity->_isInvicible == 0)) && (tmpEntity->_dead == 0)) { - bVar2 = (GHIDRA_CAST((tmpEntity)))->Entity::HasEntityFlags(0x10); - if (((bVar2 == 0) || (local_54 == 0x322)) || (local_54 == 0x362)) { - uVar3 = Random(); - if (uVar3 % 3 == 0) { - if (effectSprite == GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 0.0; - fStack_48 = 0.0; - fStack_44 = 0.0; - local_40 = 0.0; - fStack_3c = g_vectorZero.x; - fStack_38 = g_vectorZero.y; - fStack_34 = g_vectorZero.x; - local_30 = g_vectorZero.y; -LAB_005c9d27: - uVar3 = 0; - if (effectSprite != GHIDRA_CAST(0x0)) goto LAB_005c9d2d; - uVar3 = 0; -LAB_005c9d48: - local_54 = 0; - if (effectSprite != GHIDRA_CAST(0x0)) goto LAB_005c9d53; -LAB_005c9d6c: - uVar4 = 0; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = effectSprite->_type; - fStack_3c = (effectSprite->_pos).x; - fStack_38 = (effectSprite->_pos).y; - fStack_48 = (float)effectSprite->_variant; - fStack_44 = (float)effectSprite->_spawnerType; - local_40 = (float)effectSprite->_spawnerVariant; - fStack_34 = (effectSprite->_velocity).x; - local_30 = (effectSprite->_velocity).y; - if ((effectSprite->_flags & 0x100) == 0) goto LAB_005c9d27; - uVar3 = 1; -LAB_005c9d2d: - if ((effectSprite->_flags & 0x20000000) == 0) goto LAB_005c9d48; - local_54 = 2; -LAB_005c9d53: - if ((effectSprite->_flags & 0x40000000000000) == 0) goto LAB_005c9d6c; - uVar4 = 4; - } - fStack_2c = (float)(uVar3 | local_54 | uVar4); - local_28 = effectSprite; - (GHIDRA_CAST((tmpEntity)))->Entity::AddMidasFreeze(GHIDRA_CAST((local_50 + 4)),3,0); - } - local_60 = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x20); - if (effectSprite == GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 0.0; - fStack_48 = 0.0; - fStack_44 = 0.0; - local_40 = 0.0; - fStack_3c = g_vectorZero.x; - fStack_38 = g_vectorZero.y; - fStack_34 = g_vectorZero.x; - local_30 = g_vectorZero.y; -LAB_005c9e39: - local_54 = 0; - if (effectSprite != GHIDRA_CAST(0x0)) goto LAB_005c9e44; - local_54 = 0; -LAB_005c9e62: - uVar3 = 0; - if (effectSprite != GHIDRA_CAST(0x0)) goto LAB_005c9e68; -LAB_005c9e81: - uVar4 = 0; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = effectSprite->_type; - fStack_3c = (effectSprite->_pos).x; - fStack_38 = (effectSprite->_pos).y; - fStack_48 = (float)effectSprite->_variant; - fStack_44 = (float)effectSprite->_spawnerType; - local_40 = (float)effectSprite->_spawnerVariant; - fStack_34 = (effectSprite->_velocity).x; - local_30 = (effectSprite->_velocity).y; - if ((effectSprite->_flags & 0x100) == 0) goto LAB_005c9e39; - local_54 = 1; -LAB_005c9e44: - if ((effectSprite->_flags & 0x20000000) == 0) goto LAB_005c9e62; - uVar3 = 2; -LAB_005c9e68: - if ((effectSprite->_flags & 0x40000000000000) == 0) goto LAB_005c9e81; - uVar4 = 4; - } - fStack_2c = (float)(uVar3 | uVar4 | local_54); - local_28 = effectSprite; - (*local_60)(effectSprite->_meleeDamage + effectSprite->_meleeDamage + 15.0,0,0,local_50 + 4,0x1e); - } - game = g_game; - } - } - local_58 = GHIDRA_CAST((GHIDRA_INT(local_58) + 1)); - if (*GHIDRA_CAST((GHIDRA_CAST(local_5c) + 0x1264)) <= local_58) { - ExceptionList = local_1c; - return; - } - } while( true ); - } - if (activeId == 0x11a) { - local_54 = 0x1d7; - seed_fart_sound_override(GHIDRA_CAST(&local_54)); - (GHIDRA_CAST((&local_58->_sfxManager)))->SoundEffects::Play(local_54,1.0,2,0,1.0,0.0); - ExceptionList = local_1c; - return; - } - if (activeId != 0x122) { - if (activeId == 0x127) { - uVar3 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((effectSprite->_collectibleRNGs)._begin) + 0x3b0)))))->RNG::RandomInt(4); - manager = g_manager; - if (uVar3 != 0) { - ExceptionList = local_1c; - return; - } - local_54 = 0x112; - seed_fart_sound_override(GHIDRA_CAST(&local_54)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_54,1.0,2,0,1.0,0.0); - iVar5 = 0x22b; - goto LAB_005ca3bc; - } - goto switchD_005c99c5_caseD_23; - } - if (charges < 1) { - ExceptionList = local_1c; - return; - } - } - else { - if (activeId == 0x26f) goto LAB_005ca3b6; - if (activeId != 0x282) goto switchD_005c99c5_caseD_23; - (GHIDRA_CAST((&effectSprite->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x82,1,1); - local_58 = g_manager; - } - if (charges == 0) { - charges = 1; - if (1 < local_5c->_initCharge) { - charges = local_5c->_initCharge; - } - } - bVar2 = (GHIDRA_CAST((&effectSprite->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x22); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((&effectSprite->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x7b); - local_54 = 0x22; - if (bVar2 == 0) goto LAB_005c9f70; - } - local_54 = 0x1d7; -LAB_005c9f70: - seed_fart_sound_override(GHIDRA_CAST(&local_54)); - (GHIDRA_CAST((&local_58->_sfxManager)))->SoundEffects::Play(local_54,1.0,2,0,1.0,0.0); - pvVar1 = (g_manager->_itemConfig)._nullItems._begin; - if ((0x1ec < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU))) && - (iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1ec)), iVar5 != 0)) { - nullEffect[2] = *GHIDRA_CAST((iVar5 + 0x78)); - nullEffect[1] = 0; - local_7c = 0; - nullEffect[0] = iVar5; - (GHIDRA_CAST((&effectSprite->_temporaryeffects)))->TemporaryEffects::AddEffect(nullEffect,1,charges); - } - if (charges < 4) { - uVar3 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0xf,&effectSprite->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3); - local_30 = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = 0.2; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 0.2; - fStack_48 = 0.2; - fStack_44 = 0.6; - local_40 = 1.0; - fStack_3c = 1.0; - fStack_38 = 1.0; - fStack_34 = 1.0; - fStack_2c = 0.0; - local_28 = GHIDRA_CAST(0x0); - tmpEntity->SetColor(local_50,0xffffffff,0xff,0,1); - tmpEntity->Update(); - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = 0.2; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 0.2; - fStack_48 = 0.2; - fStack_44 = 0.6; - local_30 = 0.0; - local_40 = 1.0; - fStack_3c = 1.0; - fStack_38 = 1.0; - fStack_34 = 1.0; - fStack_2c = 0.0; - local_28 = GHIDRA_CAST(0x0); - (GHIDRA_CAST((GHIDRA_CAST(effectSprite))))->Entity::MakeGroundPoof(&effectSprite->_pos,GHIDRA_CAST(local_50),1.0); - } - local_54 = 0; - do { - uVar3 = local_54; - local_5c = GHIDRA_CAST(((float)GHIDRA_INT(local_54) * 0.7 * 0.25 + 0.3)); - local_58 = GHIDRA_CAST(((float)local_5c * 0.0)); - uVar4 = Random(); - local_64 = (Entity *) - ((-10.0 - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - * 2.3283064e-10 * 6.0) * (float)local_5c); - uVar4 = Random(); - local_5c = (ItemConfig_Item *) - (((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 10.0 - 5.0) * 0.017453292); - local_60 = (code *)cos((float)local_5c); - fVar6 = sin((float)local_5c); - fVar7 = ((float)GHIDRA_INT(uVar3) - 0.0) / 12.0; - if (fVar7 <= 0.0) { - fVar7 = 0.0; - } - if (1.0 <= fVar7) { - fVar7 = 1.0; - } - sparkVelocity.y = fVar7 * 1.4 + 0.6; - sparkVelocity.x = - ((float)local_60 * (float)local_58 - fVar6 * (float)local_64) * sparkVelocity.y; - sparkVelocity.y = - ((float)local_60 * (float)local_64 + fVar6 * (float)local_58) * sparkVelocity.y; - sparkPos.x = sparkVelocity.x + sparkVelocity.x + (effectSprite->_pos).x; - sparkPos.y = sparkVelocity.y + sparkVelocity.y + (effectSprite->_pos).y; - uVar3 = Random(); - local_64 = Game::Spawn(g_game,1000,0x3b,&sparkPos,&sparkVelocity,GHIDRA_CAST(effectSprite),0,uVar3); - uVar3 = g_graphicsManager_flags; - effectSprite = &local_64->_sprite; - sparkLayer = ANM2::GetLayer(effectSprite,GHIDRA_CAST(0x0)); - local_30 = 0.0; - fStack_2c = 0.0; - iVar5 = 1; - local_28 = GHIDRA_CAST(0x0); - if ((uVar3 & 4) == 0) { - iVar5 = 6; - } - sparkLayer->_blendMode[0] = 0; - sparkLayer->_blendMode[1] = iVar5; - sparkLayer->_blendMode[2] = 1; - sparkLayer->_blendMode[3] = 1; - sparkLayer->_blendMode[4] = 1; - sparkLayer = ANM2::GetLayer(effectSprite,GHIDRA_CAST(0x0)); - if (&sparkLayer->_color != GHIDRA_CAST(local_50)) { - (sparkLayer->_color)._tint[0] = 5.0; - (sparkLayer->_color)._tint[1] = 0.5; - (sparkLayer->_color)._tint[2] = 0.2; - (sparkLayer->_color)._tint[3] = 1.0; - (sparkLayer->_color)._colorize[0] = 0.0; - (sparkLayer->_color)._colorize[1] = 0.0; - (sparkLayer->_color)._colorize[2] = 0.0; - (sparkLayer->_color)._colorize[3] = 0.0; - *GHIDRA_CAST((sparkLayer->_color)._offset) = CONCAT44(fStack_2c,local_30); - (sparkLayer->_color)._offset[2] = (float)local_28; - } - uVar3 = Random(); - tmpEntity = local_64; - *GHIDRA_CAST((local_64[1]._sprite._animDefaultName._buf + 4)) = - (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 - * 10.0 + 2.0; - uVar3 = Random(); - iVar5 = uVar3 % 10 + 10; - *GHIDRA_CAST((tmpEntity[1]._sprite._filename._buf + 4)) = iVar5; - *GHIDRA_CAST((tmpEntity[1]._sprite._filename._buf + 8)) = iVar5; - uVar3 = Random(); - sparkScaleX = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283064e-10 * 0.4 + 0.2; - sparkScaleY = sparkScaleX * g_vectorOne.y; - sparkScaleX = sparkScaleX * g_vectorOne.x; - fVar7 = (player->_playerSpriteScale).y; - fVar6 = (player->_playerSpriteScale).x; - tmpEntity->_renderZOffset = -600; - (tmpEntity->_sprite)._scale.y = sparkScaleY * fVar7; - (tmpEntity->_sprite)._scale.x = sparkScaleX * fVar6; - local_54 = local_54 + 1; - effectSprite = player; - } while (GHIDRA_INT(local_54) < 5); - ExceptionList = local_1c; - return; -} - -// 005ca470 -void Entity_Player::TriggerBookOfVirtues(int collectibleId, int charge) -{ - code *pcVar1; - uint8_t isItemHeld; - uint32_t uVar2; - void *pvVar3; - uint16_t wispCount; - uint32_t *rngSeed; - Entity_Player *soundId [2]; - Manager *manager; - - soundId[0] = this; - isItemHeld = HasCollectible(this,0x248,0); - if (isItemHeld == 0) { - return; - } - if (collectibleId == 0x61) { - pvVar3 = (this->_collectibleRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(pvVar3) + 0x2480)); - uVar2 = *rngSeed; - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar2 = *rngSeed; - if (uVar2 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar2 = uVar2 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x2484)) & 0x1f) ^ uVar2; - uVar2 = uVar2 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x2488)) & 0x1f) ^ uVar2; - uVar2 = uVar2 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x248c)) & 0x1f) ^ uVar2; - *rngSeed = uVar2; - collectibleId = *GHIDRA_CAST((&DAT_00b62c9c + (uVar2 % 7) * 4)); - if (collectibleId == 0xb1) { - wispCount = 3; - ItemConfig::get_wisp_config(0xb1); - goto LAB_005ca50f; - } - } - pvVar3 = ItemConfig::get_wisp_config(collectibleId); - wispCount = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 400)); -LAB_005ca50f: - isItemHeld = HasCollectible(this,0x164,0); - if (isItemHeld != 0) { - wispCount = wispCount * 2; - } - if (0 < (short)wispCount) { - uVar2 = GHIDRA_UINT(wispCount); - do { - AddWisp(this,collectibleId,&this->_pos,0,0); - manager = g_manager; - uVar2 = uVar2 - 1; - } while (uVar2 != 0); - soundId[0] = GHIDRA_CAST(0x1d7); - seed_fart_sound_override(GHIDRA_CAST(soundId)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(soundId[0]),1.0,2,0,1.0,0.0); - } - return; -} - -// 005caa70 -void Entity_Player::console_spawn(int *spawnSpec, uint8_t isAddWisp) -{ - int iVar1; - uint32_t uVar2; - code *pcVar3; - float fVar4; - uint64_t qVar5; - Entity_Player *this_00; - uint8_t isBookOfVirtues; - uint32_t uVar6; - Vector *position; - Entity *tmpEntity; - Entity *chainEntity; - Entity *nextChainNpc; - void *pvVar7; - float *ptr; - uint32_t i; - uint32_t *puVar8; - Vector *pos; - EntityRef removeSource; - uint32_t *spawnedEnd; - Vector VStack_70; - EntityRef local_68; - Entity *spawned; - uint32_t *rng; - uint32_t *local_38; - uint32_t *local_34; - Entity_Player *local_30; - void *local_2c; - Vector *playerPos; - float *entriesBegin; - float *entriesEnd; - float *entriesCapacityEnd; - float local_18; - float local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Game *game; - float playerPosY; - uint32_t *rngState; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af5ec5; - local_10 = ExceptionList; - uVar6 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - i = 0; - local_34 = g_game->_room; - local_30 = this; - if (*GHIDRA_CAST((GHIDRA_CAST(local_34) + 0x1264)) != 0) { - do { - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_34) + 0x125c)) + i * 4)); - if (((*GHIDRA_CAST((iVar1 + 0x16c)) & 0x10000000) != 0) && - (*GHIDRA_CAST((iVar1 + 0x264)) == local_30)) { - *GHIDRA_CAST((iVar1 + 0x168)) = *GHIDRA_CAST((iVar1 + 0x168)); - *GHIDRA_CAST((iVar1 + 0x16c)) = *GHIDRA_CAST((iVar1 + 0x16c)) | 0x20000000; - removeSource._type = 0; - removeSource._variant = 0; - removeSource._spawnerType = 0; - removeSource._position.y = g_vectorZero.y; - removeSource._velocity.y = g_vectorZero.y; - removeSource._spawnerVariant = 0; - removeSource._position.x = g_vectorZero.x; - removeSource._velocity.x = g_vectorZero.x; - removeSource._flags = 0; - removeSource._entity = (void *)0x0; - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_34) + 0x125c)) + i * 4)) + 0x24)) - (&removeSource,uVar6); - } - i = i + 1; - } while (i < *GHIDRA_CAST((GHIDRA_CAST(local_34) + 0x1264))); - } - if (*spawnSpec == 0) { - ExceptionList = local_10; - return; - } - puVar8 = GHIDRA_CAST(0x0); - rng = GHIDRA_CAST((GHIDRA_INT((local_30->_collectibleRNGs)._begin) + 0x1fe0)); - local_38 = GHIDRA_CAST(0x0); - local_2c = (void *)0x0; - spawnedEnd = GHIDRA_CAST(0x0); - local_34 = GHIDRA_CAST(0x0); - entriesBegin = GHIDRA_CAST(0x0); - entriesEnd = GHIDRA_CAST(0x0); - entriesCapacityEnd = GHIDRA_CAST(0x0); - local_8 = 1; - playerPos = &local_30->_pos; - local_68._position.x = playerPos->x; - local_68._position.y = (local_30->_pos).y; - local_68._velocity.x = (float)*spawnSpec; - local_68._velocity.y = (float)spawnSpec[1]; - local_68._flags = spawnSpec[2]; - local_68._entity = (void *)spawnSpec[3]; - msvc::vector<24byte>::_Emplace_reallocate(0,&local_68._position); - switch(*spawnSpec) { - case 0x13: - playerPosY = (float)*spawnSpec; - fVar4 = (float)spawnSpec[1]; - VStack_70.x = (float)spawnSpec[2]; - VStack_70.y = (float)spawnSpec[3]; - uVar6 = Random(); - local_14 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_14 = local_14 + local_14; - local_18 = cos(local_14); - local_18 = local_18 * 40.0; - local_14 = sin(local_14); - local_14 = local_14 * 40.0; - local_68._position.x = local_18 + playerPos->x; - local_68._position.y = local_14 + playerPos->y; - local_68._flags = GHIDRA_INT(VStack_70.x); - local_68._entity = (void *)VStack_70.y; - local_68._velocity.x = playerPosY; - local_68._velocity.y = fVar4; - if (entriesEnd == entriesCapacityEnd) { - msvc::vector<24byte>::_Emplace_reallocate(entriesEnd,&local_68._position); - } - else { - *entriesEnd = local_68._position.x; - entriesEnd[1] = local_68._position.y; - entriesEnd[2] = playerPosY; - entriesEnd[3] = fVar4; - *GHIDRA_CAST((entriesEnd + 4)) = CONCAT44(VStack_70.y,VStack_70.x); - entriesEnd = entriesEnd + 6; - } - playerPosY = playerPos->y; - *entriesBegin = playerPos->x - local_18; - entriesBegin[1] = playerPosY - local_14; - break; - default: -switchD_005cac1b_caseD_14: - break; - case 0x45: - if (spawnSpec[1] != 1) goto switchD_005cac1b_caseD_14; - playerPosY = (float)*spawnSpec; - fVar4 = (float)spawnSpec[1]; - VStack_70.x = (float)spawnSpec[2]; - VStack_70.y = (float)spawnSpec[3]; - uVar6 = Random(); - local_14 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_14 = local_14 + local_14; - local_18 = cos(local_14); - local_18 = local_18 * 40.0; - local_14 = sin(local_14); - local_14 = local_14 * 40.0; - local_68._position.x = local_18 + playerPos->x; - local_68._position.y = local_14 + playerPos->y; - local_68._flags = GHIDRA_INT(VStack_70.x); - local_68._entity = (void *)VStack_70.y; - local_68._velocity.x = playerPosY; - local_68._velocity.y = fVar4; - if (entriesEnd == entriesCapacityEnd) { - msvc::vector<24byte>::_Emplace_reallocate(entriesEnd,&local_68._position); - } - else { - *entriesEnd = local_68._position.x; - entriesEnd[1] = local_68._position.y; - entriesEnd[2] = playerPosY; - entriesEnd[3] = fVar4; - *GHIDRA_CAST((entriesEnd + 4)) = CONCAT44(VStack_70.y,VStack_70.x); - entriesEnd = entriesEnd + 6; - } - playerPosY = playerPos->y; - *entriesBegin = playerPos->x - local_18; - entriesBegin[1] = playerPosY - local_14; - break; - case 0x52: - playerPosY = (float)spawnSpec[1]; - VStack_70.x = (float)spawnSpec[2]; - VStack_70.y = (float)spawnSpec[3]; - uVar6 = Random(); - local_14 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_14 = local_14 + local_14; - local_18 = cos(local_14); - local_18 = local_18 * 40.0; - local_14 = sin(local_14); - local_14 = local_14 * 40.0; - local_68._position.x = local_18 + playerPos->x; - VStack_70.x = 50.0; - local_68._position.y = local_14 + playerPos->y; - local_68._velocity.x = 1.16308e-43; - local_68._flags = 0x42480000; - local_68._entity = (void *)VStack_70.y; - local_68._velocity.y = playerPosY; - if (entriesEnd == entriesCapacityEnd) { - msvc::vector<24byte>::_Emplace_reallocate(entriesEnd,&local_68._position); - } - else { - *entriesEnd = local_68._position.x; - entriesEnd[1] = local_68._position.y; - entriesEnd[2] = 1.16308e-43; - entriesEnd[3] = playerPosY; - *GHIDRA_CAST((entriesEnd + 4)) = CONCAT44(VStack_70.y,0x42480000); - entriesEnd = entriesEnd + 6; - } - playerPosY = playerPos->y; - *entriesBegin = playerPos->x - local_18; - entriesBegin[1] = playerPosY - local_14; - break; - case 0xed: - playerPosY = (float)*spawnSpec; - fVar4 = (float)spawnSpec[1]; - VStack_70.x = (float)spawnSpec[2]; - VStack_70.y = (float)spawnSpec[3]; - uVar6 = Random(); - local_14 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_14 = local_14 + local_14; - local_18 = cos(local_14); - local_18 = local_18 * 40.0; - local_14 = sin(local_14); - local_14 = local_14 * 40.0; - local_68._position.x = local_18 + playerPos->x; - local_68._position.y = local_14 + playerPos->y; - local_68._flags = GHIDRA_INT(VStack_70.x); - local_68._entity = (void *)VStack_70.y; - local_68._velocity.x = playerPosY; - local_68._velocity.y = fVar4; - if (entriesEnd == entriesCapacityEnd) { - msvc::vector<24byte>::_Emplace_reallocate(entriesEnd,&local_68._position); - } - else { - *entriesEnd = local_68._position.x; - entriesEnd[1] = local_68._position.y; - entriesEnd[2] = playerPosY; - entriesEnd[3] = fVar4; - *GHIDRA_CAST((entriesEnd + 4)) = CONCAT44(VStack_70.y,VStack_70.x); - entriesEnd = entriesEnd + 6; - } - playerPosY = playerPos->y; - *entriesBegin = playerPos->x - local_18; - entriesBegin[1] = playerPosY - local_14; - } - local_18 = 0.0; - iVar1 = GHIDRA_INT(entriesEnd) - GHIDRA_INT(entriesBegin) >> 0x1f; - if ((GHIDRA_INT(entriesEnd) - GHIDRA_INT(entriesBegin)) / 0x18 + iVar1 != iVar1) { - local_2c = (void *)0x0; - do { - local_14 = 0.0; - if (0 < spawnSpec[3]) { - do { - rngState = rng; - DAT_00c71670 = 1; - uVar6 = *rng; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = *rngState; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - game = g_game; - uVar6 = uVar6 >> ((uint8_t)rngState[1] & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)rngState[2] & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)rngState[3] & 0x1f) ^ uVar6; - *rngState = uVar6; - pos = GHIDRA_CAST((GHIDRA_INT(local_2c) + GHIDRA_INT(entriesBegin))); - position = Room::FindFreePickupSpawnPosition(game->_room,&VStack_70,pos,40.0,0,0,0); - tmpEntity = Game::Spawn(g_game,GHIDRA_UINT(pos[1].x),GHIDRA_UINT(pos[1].y),position,&g_vectorZero, - GHIDRA_CAST(local_30),0,uVar6); - qVar5 = tmpEntity->_flags; - rngState = GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)); - *rngState = *rngState | 0x10000020; - *GHIDRA_CAST(&tmpEntity->_flags) = GHIDRA_INT(qVar5); - spawned = tmpEntity; - (GHIDRA_CAST((&local_68)))->EntityRef::constructor(GHIDRA_CAST(local_30)); - (GHIDRA_CAST((tmpEntity)))->Entity::AddCharmed(&local_68,-1,0,0); - (GHIDRA_CAST((tmpEntity)))->Entity::SetVisibleFlag(0); - tmpEntity->_health = pos[2].x; - tmpEntity->_maxHitPoints = pos[2].x; - ANM2::LoadDeliriumForm(&tmpEntity->_sprite,tmpEntity->_type,tmpEntity->_variant,1); - if (local_38 == local_34) { - msvc::vector::_Emplace_reallocate(local_38,&spawned); - local_34 = GHIDRA_CAST(0x0); - } - else { - *local_38 = tmpEntity; - spawnedEnd = local_38 + 1; - } - local_14 = (float)(GHIDRA_INT(local_14) + 1); - local_38 = spawnedEnd; - } while (GHIDRA_INT(local_14) < spawnSpec[3]); - puVar8 = spawnedEnd; - } - local_2c = (void *)(GHIDRA_INT(local_2c) + 0x18); - local_18 = (float)(GHIDRA_INT(local_18) + 1); - } while (GHIDRA_UINT(local_18) < GHIDRA_UINT(((GHIDRA_INT(entriesEnd) - GHIDRA_INT(entriesBegin)) / 0x18))); - local_2c = (void *)0x0; - } - puVar8 = GHIDRA_CAST((GHIDRA_INT(puVar8) >> 2)); - local_14 = 0.0; - pvVar7 = (void *)0x0; - local_38 = puVar8; - if (puVar8 != GHIDRA_CAST(0x0)) { - do { - tmpEntity = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + GHIDRA_INT(local_14) * 4)); - spawned = tmpEntity; - tmpEntity->Update(); - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)); - *GHIDRA_CAST(&tmpEntity->_flags) = GHIDRA_UINT(tmpEntity->_flags) | 0x80000000; - *GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)) = uVar2; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::AddPersistentEntity(tmpEntity); - for (chainEntity = GHIDRA_CAST(tmpEntity->_parent); chainEntity != GHIDRA_CAST(0x0); - chainEntity = GHIDRA_CAST(chainEntity->_parent)) { - tmpEntity = chainEntity; - } - chainEntity = (Entity *) - __RTDynamicCast(tmpEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - tmpEntity = spawned; - spawnSpec = GHIDRA_CAST(0x0); - if (chainEntity != GHIDRA_CAST(0x0)) { - do { - if (chainEntity == tmpEntity) { - nextChainNpc = (Entity *) - __RTDynamicCast(chainEntity->_child,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0) - ; - if (nextChainNpc == GHIDRA_CAST(spawnSpec)) break; - } - else { - ANM2::LoadDeliriumForm(&chainEntity->_sprite,chainEntity->_type,chainEntity->_variant,1) - ; - nextChainNpc = (Entity *) - __RTDynamicCast(chainEntity->_child,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0) - ; - spawnSpec = GHIDRA_CAST(chainEntity); - } - chainEntity = nextChainNpc; - } while (nextChainNpc != GHIDRA_CAST(0x0)); - puVar8 = local_38; - } - local_14 = (float)(GHIDRA_INT(local_14) + 1); - pvVar7 = local_2c; - } while (GHIDRA_UINT(local_14) < puVar8); - } - if (g_game->_hallucinationTimer < 1) { - Game::ShowHallucination(g_game,0x19,0x3f); - } - this_00 = local_30; - isBookOfVirtues = HasCollectible(local_30,0x248,0); - rngState = rng; - if ((isBookOfVirtues != 0) && (isAddWisp != 0)) { - uVar6 = *rng; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = *rngState; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)rngState[1] & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)rngState[2] & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)rngState[3] & 0x1f) ^ uVar6; - *rngState = uVar6; - AddWisp(this_00,*GHIDRA_CAST((&DAT_00b62c80 + (uVar6 & 3) * 4)),playerPos,0,0); - } - if (entriesBegin != GHIDRA_CAST(0x0)) { - uVar6 = ((GHIDRA_INT(entriesCapacityEnd) - GHIDRA_INT(entriesBegin)) / 0x18) * 0x18; - ptr = entriesBegin; - if (0xfff < uVar6) { - ptr = GHIDRA_CAST(entriesBegin[-1]); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(entriesBegin) + (-4 - GHIDRA_INT(ptr))))) goto LAB_005cb36d; - } - operator_delete(ptr,uVar6); - } - if (local_2c != (void *)0x0) { - uVar6 = GHIDRA_INT(local_34) - GHIDRA_INT(local_2c) & 0xfffffffc; - pvVar7 = local_2c; - if (0xfff < uVar6) { - pvVar7 = *(void **)(GHIDRA_CAST(local_2c) + -4); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_2c) + (-4 - GHIDRA_INT(pvVar7))))) { -LAB_005cb36d: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar7,uVar6); - } - ExceptionList = local_10; - return; -} - -// 005cb480 -void Entity_Player::update_mini_mush_costume() -{ - bool bVar1; - char cVar2; - uint32_t uVar3; - void *costumesEnd; - int otherStackCount; - int *peer; - int *effect; - uint64_t *allocCounter; - uint32_t uVar4; - uint32_t peerCount; - int iVar5; - void *pvVar6; - PlayerManager *playerManager; - int costumeLevel3; - int costumeLevel2; - int costumeLevel1; - int stackCount; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint64_t allocatedBytes; - void **costumesEndSlot; - int *effectsEnd; - Game *game; - bool isCostumeRemoved; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af5ef0; - local_10 = ExceptionList; - uVar3 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - if ((this->_temporaryeffects)._disabled == 0) { - for (peer = (this->_temporaryeffects)._effects._begin; - peer != (this->_temporaryeffects)._effects._end; peer = peer + 4) { - if ((*GHIDRA_CAST(*peer) == 0) && ((GHIDRA_CAST(*peer))[1] == 0x47)) { - iVar5 = peer[1]; - goto LAB_005cb4e6; - } - } - iVar5 = 0; -LAB_005cb4e6: - pvVar6 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x246); - if (pvVar6 == (void *)0x0) { - stackCount = 0; - } - else { - stackCount = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 4)); - } - } - else { - stackCount = 0; - iVar5 = 0; - } - stackCount = stackCount + iVar5; - pvVar6 = (g_manager->_itemConfig)._nullItems._begin; - iVar5 = GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar6) >> 2; - if (iVar5 < 0x48) { - costumeLevel1 = 0; - costumeLevel2 = 0; - costumeLevel3 = 0; - } - else { - costumeLevel1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x11c)); - if (iVar5 < 0x49) { - costumeLevel2 = 0; - costumeLevel3 = 0; - } - else { - costumeLevel2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x120)); - if (iVar5 < 0x4a) { - costumeLevel3 = 0; - } - else { - costumeLevel3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x124)); - } - } - } - pvVar6 = (this->_costumeSpriteDescs)._begin; - isCostumeRemoved = false; - costumesEnd = (this->_costumeSpriteDescs)._end; - bVar1 = false; - if (pvVar6 != costumesEnd) { - do { - isCostumeRemoved = bVar1; - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x114)); - if (((iVar5 == costumeLevel1) || (iVar5 == costumeLevel2)) || (iVar5 == costumeLevel3)) { - msvc::_Move_unchecked(pvVar6,uVar3); - costumesEnd = (this->_costumeSpriteDescs)._end; - local_8 = 0; - ANM2::Reset(GHIDRA_CAST((GHIDRA_INT(costumesEnd) + -0x130))); - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xd8)); - if (iVar5 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar4 = *GHIDRA_CAST((iVar5 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar4)); - free((void *)(iVar5 + -4)); - *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xd8)) = 0; - } - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xd4)); - if (iVar5 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar4 = *GHIDRA_CAST((iVar5 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar4)); - free((void *)(iVar5 + -4)); - *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xd4)) = 0; - } - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xf8)); - if (iVar5 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar4 = *GHIDRA_CAST((iVar5 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar4)); - free((void *)(iVar5 + -4)); - *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xf8)) = 0; - } - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xf4)); - if (iVar5 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar4 = *GHIDRA_CAST((iVar5 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar4)); - free((void *)(iVar5 + -4)); - *GHIDRA_CAST((GHIDRA_CAST(costumesEnd) + -0xf4)) = 0; - } - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(costumesEnd) + -0x118)))))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(costumesEnd) + -0x130)))))->msvc::string::_Tidy_deallocate(); - isCostumeRemoved = true; - local_8 = 0xffffffff; - costumesEndSlot = &(this->_costumeSpriteDescs)._end; - *costumesEndSlot = (void *)(GHIDRA_INT(*costumesEndSlot) + -0x130); - costumesEnd = (this->_costumeSpriteDescs)._end; - } - else { - pvVar6 = (void *)(GHIDRA_INT(pvVar6) + 0x130); - } - bVar1 = isCostumeRemoved; - } while (pvVar6 != costumesEnd); - } - if (stackCount < 7) { - if (stackCount < 4) { - if (stackCount < 1) { - if (isCostumeRemoved) { - UpdateCostumes(this); - } - } - else { - pvVar6 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU)) < 0x11d - ) { - AddCostume(this,GHIDRA_CAST(0x0),0); - } - else { - AddCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x11c)),0); - } - } - } - else { - pvVar6 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU)) < 0x121) - { - AddCostume(this,GHIDRA_CAST(0x0),0); - } - else { - AddCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x120)),0); - } - } - } - else { - pvVar6 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU)) < 0x125) { - AddCostume(this,GHIDRA_CAST(0x0),0); - } - else { - AddCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x124)),0); - } - } - peer = GHIDRA_CAST(g_manager->_netplayManager); - if (peer != *GHIDRA_CAST((g_manager + 1))) { - uVar4 = GHIDRA_INT(*GHIDRA_CAST((g_manager + 1))) - GHIDRA_INT(peer) >> 2; - uVar3 = 0; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((*peer + 0xc)) == this->_controllerIndex) { - cVar2 = (**(code **)(*GHIDRA_CAST((*peer + 0x370)) + 0x14))(); - if (cVar2 == '\0') { - ExceptionList = local_10; - return; - } - break; - } - uVar3 = uVar3 + 1; - peer = peer + 1; - } while (uVar3 < uVar4); - } - } - uVar3 = 1; - playerManager = &g_game->_playerManager; - if (1 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))) { - do { - pvVar6 = (playerManager->_playerList)._end; - peer = (playerManager->_playerList)._begin; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT(peer) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (playerManager->_playerList)._end; - peer = (playerManager->_playerList)._begin; - } - if (uVar3 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(peer) >> 2))) { - peer = peer + uVar3; - } - effectsEnd = GHIDRA_CAST(g_manager->_netplayManager); - if (effectsEnd != *GHIDRA_CAST((g_manager + 1))) { - peerCount = GHIDRA_INT(*GHIDRA_CAST((g_manager + 1))) - GHIDRA_INT(effectsEnd) >> 2; - uVar4 = 0; - if (peerCount != 0) { - do { - if (*GHIDRA_CAST((*effectsEnd + 0xc)) == *GHIDRA_CAST((*peer + 0x1618))) { - cVar2 = (**(code **)(*GHIDRA_CAST((*effectsEnd + 0x370)) + 0x14))(); - if (cVar2 == '\0') goto LAB_005cb950; - break; - } - uVar4 = uVar4 + 1; - effectsEnd = effectsEnd + 1; - } while (uVar4 < peerCount); - } - } - if ((this->_temporaryeffects)._disabled == 0) { - peer = (this->_temporaryeffects)._effects._begin; - effectsEnd = (this->_temporaryeffects)._effects._end; - effect = peer; - if (peer == effectsEnd) goto LAB_005cb939; - do { - iVar5 = *GHIDRA_CAST(*effect); - if ((((iVar5 == 1) || (iVar5 == 3)) || (iVar5 == 4)) && ((GHIDRA_CAST(*effect))[1] == 0x246)) { - iVar5 = effect[1]; - goto LAB_005cb910; - } - effect = effect + 4; - } while (effect != effectsEnd); - iVar5 = 0; -LAB_005cb910: - do { - if ((*GHIDRA_CAST(*peer) == 0) && ((GHIDRA_CAST(*peer))[1] == 0x47)) { - otherStackCount = peer[1] + iVar5; - if (peer[1] + iVar5 < stackCount) { - otherStackCount = stackCount; - } - stackCount = otherStackCount; - goto LAB_005cb950; - } - peer = peer + 4; - } while (peer != effectsEnd); - } - else { -LAB_005cb939: - iVar5 = 0; - } - if (iVar5 < stackCount) { - iVar5 = stackCount; - } - stackCount = iVar5; -LAB_005cb950: - uVar3 = uVar3 + 1; - playerManager = &g_game->_playerManager; - } while (uVar3 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - game = g_game; - g_game->_dizzyTargetIntensity = (float)stackCount / 10.0; - game->_dizzyIntensityChangeSpeed = 0.001; - ExceptionList = local_10; - return; -} - -// 005cd740 -Vector * Entity_Player::GetLastDirection() -{ - return &this->_lastDirection; -} - -// 005cd7d0 -EntityDesc * Entity_Player::FriendBallEnemy() -{ - return &this->_friendBallEnemy; -} - -// 0060d050 -int Entity_Player::GetNumBlueSpiders() -{ - return this->_numBlueSpiders; -} - -// 0060d080 -int Entity_Player::GetDamageCooldown() -{ - return this->_damageCooldown; -} - -// 0060d090 -void Entity_Player::ResetDamageCooldown() -{ - this->_damageCooldown = 0; - return; -} - -// 0060d0a0 -Vector * Entity_Player::SpriteScale(Vector *outScale) -{ - float scaleY; - - scaleY = (this->_playerSpriteScale).y; - outScale->x = (this->_playerSpriteScale).x; - outScale->y = scaleY; - return outScale; -} - -// 0065cf20 -int Entity_Player::GetBrokenHearts() -{ - return this->_brokenHearts; -} - -// 0065cf30 -int Entity_Player::GetNumBombs() -{ - return this->_numBombs; -} - -// 0065cf40 -uint8_t Entity_Player::HasGoldenKey() -{ - return this->_hasGoldenKey; -} - -// 0065cf50 -uint8_t Entity_Player::HasGoldenBomb() -{ - return this->_hasGoldenBomb; -} - -// 0065cf60 -uint8_t Entity_Player::IsP2Appearing() -{ - if ((this->_variant == 1) && (0 < this->_damageCooldown)) { - return 1; - } - return 0; -} - -// 0065cf80 -RNG * Entity_Player::GetTrinketRNG(int id) -{ - uint32_t index; - uint32_t clampedId; - void *rngs; - - if ((id < 0) || (GHIDRA_INT((this->_trinketRNGs)._end) - GHIDRA_INT((this->_trinketRNGs)._begin) >> 4 <= id)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Trinket ID out of bounds!\n")); - } - rngs = (this->_trinketRNGs)._begin; - index = (GHIDRA_INT((this->_trinketRNGs)._end) - GHIDRA_INT(rngs) >> 4) - 1; - clampedId = -GHIDRA_UINT((id != 0)) & id; - if (clampedId < index) { - index = clampedId; - } - return GHIDRA_CAST((index * 0x10 + GHIDRA_INT(rngs))); -} - -// 00665c10 -int Entity_Player::GetTractorBeam() -{ - return this->_tractorBeam; -} - -// 00665c20 -ColorMod * Entity_Player::get_laser_color_copy(ColorMod *outColor) -{ - float fVar1; - float fVar2; - float fVar3; - - fVar1 = (this->_laserColor)._tint[1]; - fVar2 = (this->_laserColor)._tint[2]; - fVar3 = (this->_laserColor)._tint[3]; - outColor->_tint[0] = (this->_laserColor)._tint[0]; - outColor->_tint[1] = fVar1; - outColor->_tint[2] = fVar2; - outColor->_tint[3] = fVar3; - fVar1 = (this->_laserColor)._colorize[1]; - fVar2 = (this->_laserColor)._colorize[2]; - fVar3 = (this->_laserColor)._colorize[3]; - outColor->_colorize[0] = (this->_laserColor)._colorize[0]; - outColor->_colorize[1] = fVar1; - outColor->_colorize[2] = fVar2; - outColor->_colorize[3] = fVar3; - fVar1 = (this->_laserColor)._offset[2]; - *GHIDRA_CAST(outColor->_offset) = *GHIDRA_CAST((this->_laserColor)._offset); - outColor->_offset[2] = fVar1; - return outColor; -} - -// 006b5fd0 -uint32_t Entity_Player::get_grid_collision_at(Vector *position) -{ - Room *this_00; - char cVar1; - uint8_t bVar2; - uint32_t uVar3; - uint32_t gridIndex; - float *gridPos; - Entity_Player *this_01; - int gridRow; - int iVar4; - float roundBias; - float dy; - float dx; - float gridOriginY; - uint8_t gridPosOut [4]; - int gridColumn; - void *roomPtr; - - this_00 = g_game->_room; - iVar4 = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - gridRow = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)); - if ((((iVar4 < 0) || (this_00->_gridWidth <= iVar4)) || (gridRow < 0)) || - (this_00->_gridHeight <= gridRow)) { - iVar4 = -1; - } - else { - iVar4 = this_00->_gridWidth * gridRow + iVar4; - } - uVar3 = (GHIDRA_CAST((this_00)))->Room::GetGridCollision(iVar4); - roundBias = 0.5; - if (uVar3 == 3) { - gridColumn = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - if (-1 < gridColumn) { - gridOriginY = 120.0; - roomPtr = g_game->_room; - if ((((gridColumn < *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0xc))) && - (iVar4 = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)), -1 < iVar4)) && - ((iVar4 < *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0x10)) && - ((gridIndex = *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0xc)) * iVar4 + gridColumn, gridIndex < 0x1c0 && - (iVar4 = *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + gridIndex * 4 + 0x24)), iVar4 != 0)))))) && - (*GHIDRA_CAST((iVar4 + 4)) == 0xe)) { - if (*GHIDRA_CAST((iVar4 + 8)) - 7U < 4) { - gridPos = GHIDRA_CAST(FUN_00718d20(gridPosOut)); - dx = position->x - *gridPos; - dy = position->y - gridPos[1]; - if (1444.0 < dy * dy + dx * dx) { - uVar3 = 0; - } - } - else { - dx = position->x - - ((float)(*GHIDRA_CAST((iVar4 + 0x24)) % *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0xc))) * 40.0 + 40.0); - dy = position->y - - ((float)(*GHIDRA_CAST((iVar4 + 0x24)) / *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0xc))) * 40.0 + 120.0); - if (324.0 < dy * dy + dx * dx) { - uVar3 = 0; - } - } - } - goto LAB_006b61a0; - } - } - gridOriginY = 120.0; -LAB_006b61a0: - if ((this == GHIDRA_CAST(0x0)) || (this->_type != 1)) { - this = GHIDRA_CAST(0x0); - } - if (uVar3 == 4) { - roomPtr = g_game->_room; - gridColumn = GHIDRA_INT(((position->x - 40.0) / 40.0 + roundBias)); - if ((((gridColumn < 0) || (*GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0xc)) <= gridColumn)) || - (iVar4 = GHIDRA_INT(((position->y - gridOriginY) / 40.0 + roundBias)), iVar4 < 0)) || - ((*GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0x10)) <= iVar4 || - (uVar3 = *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + 0xc)) * iVar4 + gridColumn, 0x1bf < uVar3)))) { - iVar4 = 0; - } - else { - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(roomPtr) + uVar3 * 4 + 0x24)); - } - if (this == GHIDRA_CAST(0x0)) { - return 4; - } - if (iVar4 == 0) { - return 4; - } - if (*GHIDRA_CAST((iVar4 + 4)) != 0x10) { - return 4; - } - if ((*GHIDRA_CAST((iVar4 + 0x3a0)) >> 4 & 1) == 0) { - return 4; - } - cVar1 = FUN_007103a0(); - if (cVar1 == '\0') { - return 4; - } - iVar4 = GetHealthType(this); - if (((iVar4 != 2) && (bVar2 = HasInstantDeathCurse(this_01), bVar2 == 0)) && - (g_game->_currentDimensionIdx != 1)) { - return 4; - } - uVar3 = 5; - } - else if (uVar3 != 5) { - return uVar3; - } - if ((((this->_variant != 0) || (this->_isCoopGhost != 0)) || (this->_parent != 0)) || - (bVar2 = IsHologram(this), bVar2 != 0)) { - uVar3 = 4; - } - return uVar3; -} - -// 006b84a0 -uint8_t Entity_Player::ControlsEnabled() -{ - return this->_isControlsEnabled; -} - -// 006dacd0 -uint8_t Entity_Player::HasFullHearts() -{ - int healthType; - int extraout_EDX; - - healthType = GetHealthType(this); - if ((healthType == 1) || (healthType == 2)) { - return *GHIDRA_CAST((extraout_EDX + 0x1340)) <= *GHIDRA_CAST((extraout_EDX + 0x1344)); - } - return *GHIDRA_CAST((extraout_EDX + 0x1340)) + *GHIDRA_CAST((extraout_EDX + 0x1d88)) * 2 <= - *GHIDRA_CAST((extraout_EDX + 0x1344)); -} - -// 006dad10 -int Entity_Player::GetJarHearts() -{ - return this->_jarHearts; -} - -// 006dad20 -int Entity_Player::GetSoulCharge() -{ - return this->_effectiveSoulCharge; -} - -// 006dad30 -int Entity_Player::GetBloodCharge() -{ - return this->_effectiveBloodCharge; -} - -// 006dad60 -Vector * Entity_Player::GetVelocityBeforeUpdate() -{ - return &this->_lastVelocity; -} - -// 006dad70 -int Entity_Player::GetEternalHearts() -{ - return this->_eternalHearts; -} - -// 006dad80 -void Entity_Player::set_last_damage(uint64_t damageFlags, EntityRef *source) -{ - this->_lastDamageFlags = damageFlags; - (this->_lastDamageSource)._type = source->_type; - (this->_lastDamageSource)._variant = source->_variant; - (this->_lastDamageSource)._spawnerType = source->_spawnerType; - (this->_lastDamageSource)._spawnerVariant = source->_spawnerVariant; - (this->_lastDamageSource)._position.x = (source->_position).x; - (this->_lastDamageSource)._position.y = (source->_position).y; - (this->_lastDamageSource)._velocity.x = (source->_velocity).x; - (this->_lastDamageSource)._velocity.y = (source->_velocity).y; - (this->_lastDamageSource)._flags = source->_flags; - (this->_lastDamageSource)._entity = source->_entity; - return; -} - -// 006dae00 -int Entity_Player::GetBabySkin() -{ - return this->_babySkin; -} - -// 006dae10 -int Entity_Player::GetSubPlayer() -{ - return this->_subPlayer; -} - -// 006f0020 -void Entity_Player::SetSoulCharge(int param_2) -{ - this->_effectiveSoulCharge = param_2; - return; -} - -// 006f0030 -void Entity_Player::SetBloodCharge(int param_2) -{ - this->_effectiveBloodCharge = param_2; - return; -} - -// 00753900 -void * Entity_Player::GetPocketItem(int SlotID) -{ - int clampedSlot; - - if (SlotID < 1) { - SlotID = 0; - } - clampedSlot = 3; - if (SlotID < 3) { - clampedSlot = SlotID; - } - return this->_pocketSlots + clampedSlot * 2; -} - -// 00753930 -Vector * Entity_Player::TearsOffset() -{ - return &this->_tearsOffset; -} - -// 00753980 -void Entity_Player::EnableWeaponType(int param_2, uint8_t param_3) -{ - *GHIDRA_CAST((GHIDRA_CAST(this->_weapons) + param_2 + 0x14)) = param_3; - return; -} - -// 007539c0 -void Entity_Player::QueueExtraAnimation(uint8_t *animName) -{ - uint8_t *nameEnd; - uint8_t nameChar; - - nameEnd = animName; - do { - nameChar = *nameEnd; - nameEnd = nameEnd + 1; - } while (nameChar != 0); - (GHIDRA_CAST(((this->_queuedExtraAnimation)._buf)))->msvc::string::assign(animName,GHIDRA_INT(nameEnd) - GHIDRA_INT((animName + 1))); - return; -} - -// 007539f0 -uint8_t Entity_Player::CanShoot() -{ - return this->_canShoot; -} - -// 00753a00 -RNG * Entity_Player::GetPillRNG(int pillEffect) -{ - void *pvVar1; - uint32_t clampedIndex; - uint32_t uVar2; - - if ((pillEffect < 0) || - (GHIDRA_INT((this->_pillRNGs)._end) - GHIDRA_INT((this->_pillRNGs)._begin) >> 4 <= pillEffect)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Pill ID out of bounds!\n")); - } - pvVar1 = (this->_pillRNGs)._begin; - clampedIndex = (GHIDRA_INT((this->_pillRNGs)._end) - GHIDRA_INT(pvVar1) >> 4) - 1; - uVar2 = -GHIDRA_UINT((pillEffect != 0)) & pillEffect; - if (uVar2 < clampedIndex) { - clampedIndex = uVar2; - } - return GHIDRA_CAST((clampedIndex * 0x10 + GHIDRA_INT(pvVar1))); -} - -// 00753a60 -RNG * Entity_Player::GetCardRNG(int cardId) -{ - void *pvVar1; - uint32_t cardIndex; - uint32_t uVar2; - - if ((cardId < 0) || (GHIDRA_INT((this->_cardRNGs)._end) - GHIDRA_INT((this->_cardRNGs)._begin) >> 4 <= cardId)) - { - KAGE_LogMessage(0x10,GHIDRA_CAST("Card ID out of bounds!\n")); - } - pvVar1 = (this->_cardRNGs)._begin; - cardIndex = (GHIDRA_INT((this->_cardRNGs)._end) - GHIDRA_INT(pvVar1) >> 4) - 1; - uVar2 = -GHIDRA_UINT((cardId != 0)) & cardId; - if (uVar2 < cardIndex) { - cardIndex = uVar2; - } - return GHIDRA_CAST((cardIndex * 0x10 + GHIDRA_INT(pvVar1))); -} - -// 00753ac0 -uint32_t Entity_Player::IsSubPlayer() -{ - return GHIDRA_UINT(this->_playerIndex) >> 0x1f; -} - -// 00753c20 -int Entity_Player::GetPoopMana() -{ - return this->_poopMana; -} - -// 00753c30 -uint8_t Entity_Player::HasCurseMistEffect() -{ - return this->_hasCurseMistEffect; -} - -// 00753da0 -void Entity_Player::constructor() -{ - uint8_t *puVar1; - ActiveItemDesc *activeDesc; - int *containerProxy; - uint32_t *puVar2; - void *sentinelNode; - int remaining; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - std_deque *deque; - std_set *proceduralItemIds; - - local_14 = 0xffffffff; - puStack_18 = &LAB_00afe9e2; - local_1c = ExceptionList; - ExceptionList = &local_1c; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - local_14 = 0; - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Player::vftable; - ANM2::constructor(&this->_bodySprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - ANM2::constructor(&this->_crownOfLightSprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - ANM2::constructor(&this->_darkPrincesCrownSprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 3; - _eh_vector_constructor_iterator_(this->_chargeBarSprites,0x114,7,ANM2::constructor,ANM2::~ANM2); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 4; - ANM2::constructor(&this->_bloodGushSprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 5; - ANM2::constructor(&this->_heldSprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 6; - ANM2::constructor(&this->_statusEffectSprite); - (this->_costumeSpriteDescs)._begin = (void *)0x0; - (this->_costumeSpriteDescs)._end = (void *)0x0; - (this->_costumeSpriteDescs)._capacity = (void *)0x0; - (this->_headAnim)._buf[0] = '\0'; - (this->_headAnim)._buf[1] = '\0'; - (this->_headAnim)._buf[2] = '\0'; - (this->_headAnim)._buf[3] = '\0'; - (this->_headAnim)._size = 0; - (this->_headAnim)._capacity = 0xf; - (this->_headAnim)._buf[0] = '\0'; - (this->_queuedExtraAnimation)._buf[0] = '\0'; - (this->_queuedExtraAnimation)._buf[1] = '\0'; - (this->_queuedExtraAnimation)._buf[2] = '\0'; - (this->_queuedExtraAnimation)._buf[3] = '\0'; - (this->_queuedExtraAnimation)._size = 0; - (this->_queuedExtraAnimation)._capacity = 0xf; - (this->_queuedExtraAnimation)._buf[0] = '\0'; - (this->_name)._buf[0] = '\0'; - (this->_name)._buf[1] = '\0'; - (this->_name)._buf[2] = '\0'; - (this->_name)._buf[3] = '\0'; - (this->_name)._size = 0; - (this->_name)._capacity = 0xf; - (this->_name)._buf[0] = '\0'; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - (this->_tearColor)._tint[0] = 1.0; - (this->_tearColor)._tint[1] = 1.0; - (this->_tearColor)._tint[2] = 1.0; - (this->_tearColor)._tint[3] = 1.0; - (this->_tearColor)._colorize[0] = 0.0; - (this->_tearColor)._colorize[1] = 0.0; - (this->_tearColor)._colorize[2] = 0.0; - (this->_tearColor)._colorize[3] = 0.0; - (this->_tearColor)._offset[0] = 0.0; - (this->_tearColor)._offset[1] = 0.0; - (this->_tearColor)._offset[2] = 0.0; - (this->_laserColor)._tint[0] = 1.0; - (this->_laserColor)._tint[1] = 1.0; - (this->_laserColor)._tint[2] = 1.0; - (this->_laserColor)._tint[3] = 1.0; - (this->_laserColor)._colorize[0] = 0.0; - (this->_laserColor)._colorize[1] = 0.0; - (this->_laserColor)._colorize[2] = 0.0; - (this->_laserColor)._colorize[3] = 0.0; - (this->_laserColor)._offset[0] = 0.0; - (this->_laserColor)._offset[1] = 0.0; - (this->_laserColor)._offset[2] = 0.0; - (this->_playerSpriteScale).y = 0.0; - (this->_playerSpriteScale).x = 0.0; - (this->_bodyScale).y = 0.0; - (this->_bodyScale).x = 0.0; - (this->_headScale).y = 0.0; - (this->_headScale).x = 0.0; - (this->_temporaryeffects)._effects._begin = (void *)0x0; - (this->_temporaryeffects)._effects._end = (void *)0x0; - (this->_temporaryeffects)._effects._capacity = (void *)0x0; - (this->_temporaryeffects)._cacheFlags = 0; - (this->_temporaryeffects)._shouldEvaluateCache = 0; - (this->_temporaryeffects)._disabled = 0; - (this->_temporaryeffects)._player = this; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xc; - remaining = 4; - activeDesc = this->_activeDesc; - do { - activeDesc->_item = 0; - activeDesc->_unk = 0; - activeDesc->_charge = 0; - activeDesc->_batteryCharge = 0; - activeDesc->_subCharge = 0; - activeDesc->_timeRechargeCooldown = 0; - activeDesc->_partialCharge = 0; - activeDesc->_varData = 0; - remaining = remaining + -1; - activeDesc = activeDesc + 1; - } while (remaining != 0); - this->_controllerIndex = -1; - puVar1 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1668))); - this->_playerIndex = -1; - this->_glowingHourglassIndex = -1; - (this->_aimDirection).y = 0.0; - (this->_aimDirection).x = 0.0; - (this->_lastDirection).y = 0.0; - (this->_lastDirection).x = 0.0; - (this->_movementVector).y = 0.0; - (this->_movementVector).x = 0.0; - (this->_tearsOffset).y = 0.0; - (this->_tearsOffset).x = 0.0; - (this->_recentMovementVector).y = 0.0; - (this->_recentMovementVector).x = 0.0; - (this->_lastVelocity).y = 0.0; - (this->_lastVelocity).x = 0.0; - *GHIDRA_CAST(puVar1) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x166c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1670)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1674)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1678)))) = 0; - containerProxy = operator_new(8); - containerProxy[1] = 0; - *GHIDRA_CAST(puVar1) = containerProxy; - *containerProxy = GHIDRA_INT(puVar1); - (this->_lastDamageSource)._type = 0; - (this->_lastDamageSource)._variant = 0; - (this->_lastDamageSource)._spawnerType = 0; - (this->_lastDamageSource)._spawnerVariant = 0; - (this->_lastDamageSource)._position.x = g_vectorZero.x; - (this->_lastDamageSource)._position.y = g_vectorZero.y; - (this->_lastDamageSource)._velocity.x = g_vectorZero.x; - (this->_lastDamageSource)._velocity.y = g_vectorZero.y; - (this->_lastDamageSource)._flags = 0; - (this->_lastDamageSource)._entity = (void *)0x0; - (this->_collectibleCounts)._begin = (void *)0x0; - (this->_collectibleCounts)._end = (void *)0x0; - (this->_collectibleCounts)._capacity = (void *)0x0; - (this->_pillEffectUses)._begin = (void *)0x0; - (this->_pillEffectUses)._end = (void *)0x0; - (this->_pillEffectUses)._capacity = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e4)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e8)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16ec)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16f0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16f4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16f8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16fc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1700)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1704)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1708)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x170c)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1710)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1714)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1718)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x171c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1720)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1724)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1728)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x172c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1730)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1734)))) = 0; - (this->_levelEffectItems)._begin = (void *)0x0; - (this->_levelEffectItems)._end = (void *)0x0; - (this->_levelEffectItems)._capacity = (void *)0x0; - (this->_smeltedTrinkets)._begin = (void *)0x0; - (this->_smeltedTrinkets)._end = (void *)0x0; - (this->_smeltedTrinkets)._capacity = (void *)0x0; - (this->_voidedCollectibles)._begin = (void *)0x0; - (this->_voidedCollectibles)._end = (void *)0x0; - (this->_voidedCollectibles)._capacity = (void *)0x0; - (this->_voidedPassives)._begin = (void *)0x0; - (this->_voidedPassives)._end = (void *)0x0; - (this->_voidedPassives)._capacity = (void *)0x0; - (this->_collectibleRNGs)._begin = (void *)0x0; - (this->_collectibleRNGs)._end = (void *)0x0; - (this->_collectibleRNGs)._capacity = (void *)0x0; - (this->_trinketRNGs)._begin = (void *)0x0; - (this->_trinketRNGs)._end = (void *)0x0; - (this->_trinketRNGs)._capacity = (void *)0x0; - (this->_pillRNGs)._begin = (void *)0x0; - (this->_pillRNGs)._end = (void *)0x0; - (this->_pillRNGs)._capacity = (void *)0x0; - (this->_cardRNGs)._begin = (void *)0x0; - (this->_cardRNGs)._end = (void *)0x0; - (this->_cardRNGs)._capacity = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x17; - this->_playerFormsRewarded = 0; - remaining = 4; - (this->_footprintColor1)._tint[0] = 1.0; - (this->_footprintColor1)._tint[1] = 1.0; - (this->_footprintColor1)._tint[2] = 1.0; - (this->_footprintColor1)._tint[3] = 1.0; - (this->_footprintColor1)._colorize[0] = 0.0; - (this->_footprintColor1)._colorize[1] = 0.0; - (this->_footprintColor1)._colorize[2] = 0.0; - (this->_footprintColor1)._colorize[3] = 0.0; - (this->_footprintColor1)._offset[0] = 0.0; - (this->_footprintColor1)._offset[1] = 0.0; - (this->_footprintColor1)._offset[2] = 0.0; - (this->_footprintColor2)._tint[0] = 1.0; - (this->_footprintColor2)._tint[1] = 1.0; - (this->_footprintColor2)._tint[2] = 1.0; - (this->_footprintColor2)._tint[3] = 1.0; - (this->_footprintColor2)._colorize[0] = 0.0; - (this->_footprintColor2)._colorize[1] = 0.0; - (this->_footprintColor2)._colorize[2] = 0.0; - (this->_footprintColor2)._colorize[3] = 0.0; - (this->_footprintColor2)._offset[0] = 0.0; - (this->_footprintColor2)._offset[1] = 0.0; - (this->_footprintColor2)._offset[2] = 0.0; - (this->_friendBallEnemy)._type = 0; - (this->_friendBallEnemy)._variant = 0; - (this->_friendBallEnemy)._subtype = 0; - (this->_friendBallEnemy)._championId = -1; - (this->_friendBallEnemy)._health = 0.0; - (this->_friendBallEnemy)._maxHealth = 0.0; - (this->_friendBallEnemy)._playerControlled = 0; - puVar2 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1af0)))); - do { - puVar2[1] = 0; - *puVar2 = 0; - remaining = remaining + -1; - puVar2 = puVar2 + 2; - } while (remaining != 0); - (this->_moveToTarget).y = 0.0; - (this->_moveToTarget).x = 0.0; - FUN_008391a0(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x18; - FUN_008391a0(); - (this->_movingBoxContents)._begin = (void *)0x0; - (this->_movingBoxContents)._end = (void *)0x0; - (this->_movingBoxContents)._capacity = (void *)0x0; - this->_subPlayer = 0; - (this->_pendingWisps)._begin = (void *)0x0; - (this->_pendingWisps)._end = (void *)0x0; - (this->_pendingWisps)._capacity = (void *)0x0; - (this->_history)._historyItems._begin = (void *)0x0; - (this->_history)._historyItems._capacity = (void *)0x0; - (this->_history)._isLocked = 0; - (this->_history)._player = this; - (this->_history)._historyItems._end = (void *)0x0; - this->_inventory[0] = -1; - this->_inventory[1] = -1; - this->_inventory[2] = -1; - this->_inventory[3] = -1; - this->_inventory[4] = -1; - this->_inventory[5] = -1; - this->_inventory[6] = -1; - this->_inventory[7] = -1; - this->_inventory[8] = -1; - this->_inventory[9] = -1; - this->_inventory[10] = -1; - this->_inventory[0xb] = -1; - this->_inventory[0xc] = -1; - this->_inventory[0xd] = -1; - this->_inventory[0xe] = -1; - this->_inventory[0xf] = -1; - (this->_contactHitList)._begin = (void *)0x0; - (this->_contactHitList)._end = (void *)0x0; - (this->_contactHitList)._capacity = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e50)))) = 0; - this->_userProfile = KAGE::System::UserProfile::vftable; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x1e; - deque = &this->_afterImageFrames; - deque->_proxy = (void *)0x0; - (this->_afterImageFrames)._map = (void *)0x0; - (this->_afterImageFrames)._mapSize = 0; - (this->_afterImageFrames)._offset = 0; - (this->_afterImageFrames)._size = 0; - containerProxy = operator_new(8); - containerProxy[1] = 0; - deque->_proxy = containerProxy; - *containerProxy = GHIDRA_INT(deque); - this->_twinPlayer = 0; - this->_backupPlayer = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e84)))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x21; - deque = &this->_echoChamberItems; - this->_marsUnk1 = 0x5a; - this->_marsCooldown = 0; - this->_marsUnk2 = -1; - this->_marsUnkBool = 1; - (this->_forgottenBodyPos).y = 0.0; - (this->_forgottenBodyPos).x = 0.0; - deque->_proxy = (void *)0x0; - (this->_echoChamberItems)._map = (void *)0x0; - (this->_echoChamberItems)._mapSize = 0; - (this->_echoChamberItems)._offset = 0; - (this->_echoChamberItems)._size = 0; - containerProxy = operator_new(8); - containerProxy[1] = 0; - deque->_proxy = containerProxy; - *containerProxy = GHIDRA_INT(deque); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x22; - (this->_suplexTargetPos).y = 0.0; - (this->_suplexTargetPos).x = 0.0; - (this->_suplexLandPos).y = 0.0; - (this->_suplexLandPos).x = 0.0; - this->_bagOfCraftingOutput = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f50)))) = 0xffffffff; - (this->_itemWispsList)._head = (void *)0x0; - (this->_itemWispsList)._size = 0; - sentinelNode = operator_new(0x18); - *(void **)sentinelNode = sentinelNode; - *(void **)(GHIDRA_CAST(sentinelNode) + 4) = sentinelNode; - *(void **)(GHIDRA_CAST(sentinelNode) + 8) = sentinelNode; - *GHIDRA_CAST((GHIDRA_CAST(sentinelNode) + 0xc)) = 0x101; - (this->_itemWispsList)._head = sentinelNode; - (this->_itemCards)._begin = (void *)0x0; - (this->_itemCards)._end = (void *)0x0; - (this->_itemCards)._capacity = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x24; - (this->_roomTemporaryCollectibles)._head = (void *)0x0; - (this->_roomTemporaryCollectibles)._size = 0; - sentinelNode = operator_new(0x18); - *(void **)sentinelNode = sentinelNode; - *(void **)(GHIDRA_CAST(sentinelNode) + 4) = sentinelNode; - *(void **)(GHIDRA_CAST(sentinelNode) + 8) = sentinelNode; - *GHIDRA_CAST((GHIDRA_CAST(sentinelNode) + 0xc)) = 0x101; - (this->_roomTemporaryCollectibles)._head = sentinelNode; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x25; - proceduralItemIds = &(this->_proceduralItems)._itemIds; - proceduralItemIds->_head = (void *)0x0; - (this->_proceduralItems)._itemIds._size = 0; - sentinelNode = operator_new(0x18); - *(void **)sentinelNode = sentinelNode; - *(void **)(GHIDRA_CAST(sentinelNode) + 4) = sentinelNode; - *(void **)(GHIDRA_CAST(sentinelNode) + 8) = sentinelNode; - *GHIDRA_CAST((GHIDRA_CAST(sentinelNode) + 0xc)) = 0x101; - proceduralItemIds->_head = sentinelNode; - (this->_extraCollectibleCounts)._begin = (void *)0x0; - (this->_extraCollectibleCounts)._end = (void *)0x0; - (this->_extraCollectibleCounts)._capacity = (void *)0x0; - (this->_extraTrinketCounts)._begin = (void *)0x0; - (this->_extraTrinketCounts)._end = (void *)0x0; - (this->_extraTrinketCounts)._capacity = (void *)0x0; - (this->_proceduralItems)._player = (void *)0x0; - (this->_darkArtsHitList)._begin = (void *)0x0; - (this->_darkArtsHitList)._end = (void *)0x0; - (this->_darkArtsHitList)._capacity = (void *)0x0; - this->_shadowImage[0] = 0; - this->_shadowImage[1] = 0; - this->_shadowImage[2] = 0; - this->_shadowImage[3] = 0; - this->_shadowImage[4] = 0; - this->_shadowImage[5] = 0; - this->_shadowImage[6] = 0; - this->_shadowImage[7] = 0; - (this->_consumablesBackup).coins = 0; - (this->_consumablesBackup).keys = 0; - (this->_consumablesBackup).bombs = 0; - (this->_consumablesBackup).goldkey = 0; - (this->_consumablesBackup).goldbomb = 0; - (this->_consumablesBackup).soulcharges = 0; - (this->_consumablesBackup).gigabombs = 0; - (this->_consumablesBackup).poopmana = 0; - (this->_consumablesBackup).bloodcharges = 0; - (this->_curseMistFamiliars)._begin = (void *)0x0; - (this->_curseMistFamiliars)._end = (void *)0x0; - (this->_curseMistFamiliars)._capacity = (void *)0x0; - (this->_minecartOffset).y = 0.0; - (this->_minecartOffset).x = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a8)))) = 1; - this->_playerHUD = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20d8)))) = 0; - (this->_greedResetCollectibles)._begin = (void *)0x0; - (this->_greedResetCollectibles)._end = (void *)0x0; - (this->_greedResetCollectibles)._capacity = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x2b; - input_state_reset(&this->_unlistedRestoreState); - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),0x2c); - this->_replacedPlayer = (void *)0x0; - OnlineEmotes::constructor(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d8)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2eec)))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) = 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) = 0; - ExceptionList = local_1c; - return; -} - -// 007579c0 -void Entity_Player::ResetColor() -{ - ColorMod *spriteColor; - uint32_t local_30 [11]; - float colorizeA; - float colorizeB; - float colorizeG; - float colorizeR; - float offsetB; - float tintA; - float tintB; - float tintG; - float tintR; - - tintR = (this->_color)._tint[0]; - tintG = (this->_color)._tint[1]; - tintB = (this->_color)._tint[2]; - tintA = (this->_color)._tint[3]; - offsetB = (this->_color)._offset[2]; - colorizeR = (this->_color)._colorize[0]; - colorizeG = (this->_color)._colorize[1]; - colorizeB = (this->_color)._colorize[2]; - colorizeA = (this->_color)._colorize[3]; - spriteColor = &(this->_sprite)._color; - if (spriteColor != GHIDRA_CAST(local_30)) { - *GHIDRA_CAST((this->_sprite)._color._offset) = *GHIDRA_CAST((this->_color)._offset); - spriteColor->_tint[0] = tintR; - (this->_sprite)._color._tint[1] = tintG; - (this->_sprite)._color._tint[2] = tintB; - (this->_sprite)._color._tint[3] = tintA; - (this->_sprite)._color._offset[2] = offsetB; - (this->_sprite)._color._colorize[0] = colorizeR; - (this->_sprite)._color._colorize[1] = colorizeG; - (this->_sprite)._color._colorize[2] = colorizeB; - (this->_sprite)._color._colorize[3] = colorizeA; - } - return; -} - -// 00757a40 -void Entity_Player::ClearReferences() -{ - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - release_weapons_and_effects(this,0); - return; -} - -// 00757ab0 -uint8_t Entity_Player::CanShutDoors() -{ - return CONCAT31((int3)(GHIDRA_UINT(g_game) >> 8),1 < *GHIDRA_CAST(&g_game->_deathmatchManager)); -} - -// 00757ac0 -void Entity_Player::release_weapons_and_effects(uint8_t isRemoveEntities) -{ - uint8_t *puVar1; - Entity_Player *pEVar2; - uint32_t *playerSlot; - Entity_Player *pEVar3; - void *playerListEnd; - int *playerListBegin; - int weaponsLeft; - Game *game; - void **weaponSlot; - PlayerManager *playerManager; - void **ppvStack_14; - Vector throwVelocity; - - weaponsLeft = 4; - weaponSlot = this->_weapons; - do { - weaponSlot = weaponSlot + 1; - if (*weaponSlot != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*weaponSlot) + 0x14))(); - if (*weaponSlot != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(*weaponSlot))(1); - } - *weaponSlot = (void *)0x0; - } - weaponsLeft = weaponsLeft + -1; - } while (weaponsLeft != 0); - if (this->_weapons[0] != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_weapons[0]) + 0x14))(); - if (this->_weapons[0] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_weapons[0]))(1); - } - this->_weapons[0] = (void *)0x0; - } - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1424)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1424)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1424)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1424))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1424)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1420)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1420)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1420)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1420))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1420)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x142c)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x142c)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x142c)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x142c))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x142c)))) = 0; - if ((isRemoveEntities != 0) && (GHIDRA_CAST(this->_tractorBeam) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_tractorBeam) + 0x28))(); - } - if (this->_tractorBeam != 0) { - ppvStack_14 = (void **)&this->_tractorBeam; - msvc::multiset::erase(&ppvStack_14); - } - this->_tractorBeam = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1434)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1434)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1434)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1434))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1434)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1438)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1438)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1438)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1438))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1438)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440)))) = 0; - if ((isRemoveEntities != 0) && (GHIDRA_CAST(this->_breathOfLifeEffect) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_breathOfLifeEffect) + 0x28))(); - } - if (this->_breathOfLifeEffect != 0) { - ppvStack_14 = (void **)&this->_breathOfLifeEffect; - msvc::multiset::erase(&ppvStack_14); - } - this->_breathOfLifeEffect = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1448)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1448)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1448)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1448))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1448)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x144c)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x144c)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x144c)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x144c))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x144c)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1450)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1450)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1450)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1450))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1450)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1454)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1454)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1454)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1454))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1454)))) = 0; - if ((isRemoveEntities != 0) && (this->_megaBlastLaser != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_megaBlastLaser) + 0x28))(); - } - if (this->_megaBlastLaser != (void *)0x0) { - ppvStack_14 = &this->_megaBlastLaser; - msvc::multiset::erase(&ppvStack_14); - } - this->_megaBlastLaser = (void *)0x0; - if ((isRemoveEntities != 0) && (this->_markedTarget != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_markedTarget) + 0x28))(); - } - if (this->_markedTarget != (void *)0x0) { - ppvStack_14 = &this->_markedTarget; - msvc::multiset::erase(&ppvStack_14); - } - this->_markedTarget = (void *)0x0; - if ((isRemoveEntities != 0) && (this->_forgottenBody != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_forgottenBody) + 0x28))(); - } - if (this->_forgottenBody != (void *)0x0) { - ppvStack_14 = &this->_forgottenBody; - msvc::multiset::erase(&ppvStack_14); - } - this->_forgottenBody = (void *)0x0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c)))) = 0; - if ((isRemoveEntities != 0) && (GHIDRA_CAST(this->_salvationEffect) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_salvationEffect) + 0x28))(); - } - if (this->_salvationEffect != 0) { - ppvStack_14 = (void **)&this->_salvationEffect; - msvc::multiset::erase(&ppvStack_14); - } - this->_salvationEffect = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88)))) = 0; - if ((isRemoveEntities != 0) && (GHIDRA_CAST(this->_astralProjectionBody) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_astralProjectionBody) + 0x28))(); - } - if (this->_astralProjectionBody != 0) { - ppvStack_14 = (void **)&this->_astralProjectionBody; - msvc::multiset::erase(&ppvStack_14); - } - this->_astralProjectionBody = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f00)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f00)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f00)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f00))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f00)))) = 0; - if ((isRemoveEntities != 0) && (this->_montezumaLaser != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_montezumaLaser) + 0x28))(); - } - if (this->_montezumaLaser != (void *)0x0) { - ppvStack_14 = &this->_montezumaLaser; - msvc::multiset::erase(&ppvStack_14); - } - this->_montezumaLaser = (void *)0x0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f04)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f04)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f04)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f04))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f04)))) = 0; - if ((isRemoveEntities != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0)))) + 0x28))(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0)))) != 0) { - ppvStack_14 = (void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0))); - msvc::multiset::erase(&ppvStack_14); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0)))) = 0; - if ((isRemoveEntities != 0) && (this->_darkArtsLastSnare != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_darkArtsLastSnare) + 0x28))(); - } - if (this->_darkArtsLastSnare != (void *)0x0) { - ppvStack_14 = &this->_darkArtsLastSnare; - msvc::multiset::erase(&ppvStack_14); - } - this->_darkArtsLastSnare = (void *)0x0; - if ((isRemoveEntities != 0) && (GHIDRA_CAST(this->_darkEsau) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_darkEsau) + 0x28))(); - } - if (this->_darkEsau != 0) { - ppvStack_14 = (void **)&this->_darkEsau; - msvc::multiset::erase(&ppvStack_14); - } - this->_darkEsau = 0; - puVar1 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e84))); - if (*GHIDRA_CAST(puVar1) != 0) { - ppvStack_14 = (void **)puVar1; - msvc::multiset::erase(&ppvStack_14); - *GHIDRA_CAST(puVar1) = 0; - } - (this->_moveToTarget).x = g_vectorZero.x; - (this->_moveToTarget).y = g_vectorZero.y; - if (isRemoveEntities != 0) { - throwVelocity.x = (this->_velocity).x * 0.1; - throwVelocity.y = (this->_velocity).y * 0.1; - ThrowHeldEntity(this,&throwVelocity); - } - if (this->_heldEntity != (void *)0x0) { - ppvStack_14 = &this->_heldEntity; - msvc::multiset::erase(&ppvStack_14); - } - this->_heldEntity = (void *)0x0; - if (this->_replacedPlayer == (void *)0x0) { - if (((this->_valid != 0) && - (playerListBegin = GHIDRA_CAST(this->_subPlayer), playerListBegin != GHIDRA_CAST(0x0))) && - ((char)playerListBegin[0x5c] == '\0')) { - (**(code **)(*playerListBegin + 0x44))(); - if (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_subPlayer))(1); - } - this->_subPlayer = 0; - } - playerListBegin = this->_backupPlayer; - if ((playerListBegin != GHIDRA_CAST(0x0)) && ((char)playerListBegin[0x5c] == '\0')) { - (**(code **)(*playerListBegin + 0x44))(); - if (this->_backupPlayer != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_backupPlayer))(1); - } - this->_backupPlayer = (void *)0x0; - } - if (((isRemoveEntities != 0) && - (pEVar2 = GHIDRA_CAST(this->_twinPlayer), pEVar2 != GHIDRA_CAST(0x0))) && - ((pEVar2->_playerIndex == -1 || - ((this->_playerIndex <= pEVar2->_playerIndex || (pEVar2 == this)))))) { - PlayerManager::RemoveCoPlayer(&g_game->_playerManager,pEVar2,0); - } - if (this->_twinPlayer != 0) { - ppvStack_14 = (void **)&this->_twinPlayer; - msvc::multiset::erase(&ppvStack_14); - this->_twinPlayer = 0; - } - if (isRemoveEntities != 0) { - playerManager = &g_game->_playerManager; - ppvStack_14 = (void **)0x0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) - >> 2 != 0) { - do { - playerListEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - game = g_game; - } - playerSlot = (playerManager->_playerList)._begin; - if (ppvStack_14 < (void **)(GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2)) { - playerSlot = playerSlot + GHIDRA_INT(ppvStack_14); - } - pEVar2 = GHIDRA_CAST(*playerSlot); - pEVar3 = GHIDRA_CAST(pEVar2->_parent); - if ((pEVar3 == GHIDRA_CAST(0x0)) || (pEVar3->_type != 1)) { - if (pEVar2->_variant == 1) { - playerListBegin = (game->_playerManager)._playerList._begin; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT(playerListBegin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n") - ); - playerListBegin = (game->_playerManager)._playerList._begin; - game = g_game; - } - pEVar3 = GHIDRA_CAST(*playerListBegin); - } - else { - pEVar3 = GHIDRA_CAST(0x0); - } - } - if ((pEVar3 == this) && (pEVar2->_parent != 0)) { - PlayerManager::RemoveCoPlayer(&game->_playerManager,pEVar2,0); - game = g_game; - } - playerManager = &game->_playerManager; - ppvStack_14 = (void **)(GHIDRA_INT(ppvStack_14) + 1); - } while (ppvStack_14 < - (void **)(GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2)); - } - } - } - return; -} - -// 007584b0 -uint32_t Entity_Player::InvalidateCoPlayerItems() -{ - int *playerSlot; - Entity_Player *ownerPlayer; - uint32_t playerCount; - void *playerListEnd; - uint32_t i; - PlayerManager *playerManager; - Game *game; - int otherPlayer; - - i = 0; - playerManager = &g_game->_playerManager; - playerCount = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 - != 0) { - do { - playerListEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - game = g_game; - } - playerSlot = (playerManager->_playerList)._begin; - if (i < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + i; - } - otherPlayer = *playerSlot; - ownerPlayer = *GHIDRA_CAST((otherPlayer + 0x3bc)); - if ((ownerPlayer == GHIDRA_CAST(0x0)) || (ownerPlayer->_type != 1)) { - if (*GHIDRA_CAST((otherPlayer + 0x2c)) == 1) { - playerSlot = (game->_playerManager)._playerList._begin; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT(playerSlot) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerSlot = (game->_playerManager)._playerList._begin; - game = g_game; - } - ownerPlayer = GHIDRA_CAST(*playerSlot); - } - else { - ownerPlayer = GHIDRA_CAST(0x0); - } - } - if (ownerPlayer == this) { - *GHIDRA_CAST((otherPlayer + 0x131c)) = 1; - } - playerManager = &game->_playerManager; - i = i + 1; - playerCount = GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2; - } while (i < playerCount); - } - return playerCount; -} - -// 007585b0 -void Entity_Player::cycle_spectate_target() -{ - int iVar1; - uint8_t isValidTarget; - Entity *nextTarget; - Entity *extraout_ECX; - Entity *extraout_ECX_00; - Entity *extraout_ECX_01; - Entity *unused; - Entity *extraout_ECX_02; - Entity *pEVar2; - Entity *candidate; - uint32_t uVar3; - float fVar4; - Entity *local_48; - Entity_Player *local_44; - Entity *local_40; - char isPastCurrent; - int actionOrder [13]; - Manager *manager; - - actionOrder[0xc] = __security_cookie ^ GHIDRA_UINT((actionOrder + 0xd)); - local_44 = this; - isValidTarget = input_is_action_triggered(g_manager,0xd,this->_controllerIndex,GHIDRA_CAST(0x0),0); - unused = extraout_ECX; - if (isValidTarget != 0) { - unused = GHIDRA_CAST(&this->_target); - isPastCurrent = *GHIDRA_CAST(unused) == 0; - local_48 = g_game->_room; - uVar3 = 0; - pEVar2 = GHIDRA_CAST(0x0); - local_40 = unused; - if (local_48[4]._charmedCountdown != 0) { - do { - candidate = *GHIDRA_CAST((local_48[4]._poisonCountdown + uVar3 * 4)); - if ((candidate == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (candidate->_type != 1)) && - (0x3dd < candidate->_type - 10U)))) { - candidate = GHIDRA_CAST(0x0); - } - nextTarget = pEVar2; - if (candidate == *GHIDRA_CAST(unused)) { - isPastCurrent = '\x01'; - } - else if (candidate != GHIDRA_CAST(0x0)) { - isValidTarget = (GHIDRA_CAST((candidate)))->Entity::is_valid_target(); - if (isValidTarget != 0) { - nextTarget = candidate; - if (pEVar2 != GHIDRA_CAST(0x0)) { - nextTarget = pEVar2; - } - if (isPastCurrent != '\0') goto LAB_00758685; - } - unused = local_40; - } - uVar3 = uVar3 + 1; - pEVar2 = nextTarget; - } while (uVar3 < GHIDRA_UINT(local_48[4]._charmedCountdown)); - candidate = nextTarget; - if (nextTarget != GHIDRA_CAST(0x0)) { -LAB_00758685: - pEVar2 = local_40; - this = local_44; - unused = *GHIDRA_CAST(local_40); - if (candidate != unused) { - fVar4 = 0.0; - if (unused == GHIDRA_CAST(0x0)) { - fVar4 = (candidate->_pos).y; - (local_44->_pos).x = (candidate->_pos).x; - (local_44->_pos).y = fVar4; - (local_44->_velocity).x = g_vectorZero.x; - (local_44->_velocity).y = g_vectorZero.y; - fVar4 = 1.0; - } - else if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (unused->_type == 1)) || - (unused->_type - 10U < 0x3de)) { - unused[3]._bleedDamageAccumulator = -NAN; - } - (local_44->_targetPosition).x = fVar4; - if (*GHIDRA_CAST(local_40) != 0) { - local_48 = local_40; - msvc::multiset::erase(&local_48); - } - *GHIDRA_CAST(pEVar2) = candidate; - msvc::multiset::insert(pEVar2); - if ((g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) || - (isValidTarget = - NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerIndex), - unused = extraout_ECX_00, isValidTarget != 0)) { - manager = g_manager; - local_40 = GHIDRA_CAST(0xc3); - seed_fart_sound_override(GHIDRA_CAST(&local_40)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_40),1.0,2,0,1.0,0.0); - unused = extraout_ECX_01; - } - goto LAB_007587aa; - } - } - } - this = local_44; - } -LAB_007587aa: - iVar1 = this->_target; - if (((iVar1 != 0) && - (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (*GHIDRA_CAST((iVar1 + 0x28)) == 1)) || - (*GHIDRA_CAST((iVar1 + 0x28)) - 10U < 0x3de)))) && (*GHIDRA_CAST((iVar1 + 0xf1c)) == -1)) { - uVar3 = 0; - actionOrder[0] = 0; - actionOrder[1] = 2; - actionOrder[2] = 1; - actionOrder[3] = 3; - actionOrder[4] = 4; - actionOrder[5] = 6; - actionOrder[6] = 5; - actionOrder[7] = 7; - actionOrder[8] = 9; - actionOrder[9] = 10; - actionOrder[10] = 8; - actionOrder[0xb] = 0xb; - while (isValidTarget = - input_is_action_pressed - (actionOrder[uVar3],this->_controllerIndex,GHIDRA_CAST(0x0),GHIDRA_INT(unused)), - isValidTarget == 0) { - uVar3 = uVar3 + 1; - unused = extraout_ECX_02; - if (0xb < uVar3) { - return; - } - } - *GHIDRA_CAST((iVar1 + 0xf1c)) = this->_controllerIndex; - } - return; -} - -// 00758850 -void Entity_Player::trigger_max_hearts_removed(int removed) -{ - int *strengthRemovedPtr; - int empressRemoved; - int heartsRemoved; - int empressHearts; - int *strengthHearts; - - empressHearts = this->_reverseEmpressMaxHearts; - heartsRemoved = removed / 2; - empressRemoved = empressHearts; - if (heartsRemoved < empressHearts) { - empressRemoved = heartsRemoved; - } - this->_reverseEmpressMaxHearts = empressHearts - empressRemoved; - strengthHearts = &this->_strengthMaxHearts; - removed = heartsRemoved - empressRemoved; - strengthRemovedPtr = &removed; - if (*strengthHearts <= heartsRemoved - empressRemoved) { - strengthRemovedPtr = strengthHearts; - } - *strengthHearts = *strengthHearts - *strengthRemovedPtr; - return; -} - -// 007588a0 -void Entity_Player::AddMaxHearts(int amount, uint8_t ignoreKeeper) -{ - uint8_t bVar1; - int iVar2; - int iVar3; - Entity_Player *this_00; - Entity_Player *this_01; - int clampedSoulHearts; - int newMaxHearts; - Entity_Player *linkedPlayer; - - iVar2 = this->_playerType; - while ((iVar2 == 0x28 && - (linkedPlayer = GHIDRA_CAST(this->_twinPlayer), linkedPlayer != GHIDRA_CAST(0x0)))) - { - iVar2 = linkedPlayer->_playerType; - this = linkedPlayer; - } - iVar2 = GetHealthType(this); - if (iVar2 != 2) { - iVar2 = GetHealthType(this_00); - if (iVar2 == 1) { - bVar1 = HasCollectible(this_01,0x26b,0); - if (((bVar1 != 0) && (this->_playerType == 4)) && (0 < amount)) { - AddSoulHearts(this,amount * 2,0); - return; - } - if ((this->_playerType == 0xc) || (this->_playerType == 0x18)) { - AddBlackHearts(this,amount); - return; - } - AddSoulHearts(this,amount,0); - return; - } - iVar2 = GetHealthType(this_01); - if (iVar2 == 4) { - AddBoneHearts(this,amount / 2); - return; - } - iVar2 = GetHeartLimit(this,ignoreKeeper); - if (amount < 0) { - trigger_max_hearts_removed(this,-amount); - } - if (ignoreKeeper == 0) { - amount = scale_for_hard_difficulty(amount); - } - iVar3 = this->_maxHearts; - if (iVar2 < iVar3 + amount) { - trigger_max_hearts_removed(this,(iVar3 - iVar2) + amount); - iVar3 = this->_maxHearts; - } - newMaxHearts = amount + iVar3; - if (iVar2 < amount + iVar3) { - newMaxHearts = iVar2; - } - this->_maxHearts = newMaxHearts; - if (newMaxHearts < 0) { - this->_maxHearts = 0; - AddBoneHearts(this,newMaxHearts / 2); - newMaxHearts = this->_maxHearts; - } - iVar3 = GetEffectiveMaxHearts(this); - if (iVar2 < this->_soulHearts + iVar3) { - clampedSoulHearts = 0; - if (0 < iVar2 - iVar3) { - clampedSoulHearts = iVar2 - iVar3; - } - this->_soulHearts = clampedSoulHearts; - } - if (iVar3 < this->_redHearts) { - this->_redHearts = iVar3; - } - if (0xd < newMaxHearts) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,1); - } - UpdateBlackHeartMask(this); - update_greeds_gullet(this); - UpdateHeartDependentEffects(this); - ClampGoldenHearts(this,0); - update_bone_hearts(this); - ClampHeartsToLimit(this,1,0); - } - return; -} - -// 00758a70 -void Entity_Player::AddHearts(int hearts, uint8_t unk, uint8_t unk2) -{ - uint32_t *puVar1; - uint64_t qVar2; - int iVar3; - Entity_Player *this_00; - Entity_Player *this_01; - int oldRedHearts; - - while( true ) { - while( true ) { - if ((0 < hearts) && (1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) { - hearts = hearts << 3; - } - iVar3 = this->_playerType; - if ((iVar3 != 0x28) || (GHIDRA_CAST(this->_twinPlayer) == GHIDRA_CAST(0x0))) break; - unk2 = 0; - this = GHIDRA_CAST(this->_twinPlayer); - } - if ((0 < hearts) && ((unk == 0 && (g_game->_challenge == 0x19)))) { - return; - } - if (iVar3 != 0x11) break; - if (GHIDRA_CAST(this->_subPlayer) == GHIDRA_CAST(0x0)) goto LAB_00758b08; - unk2 = 0; - unk = 0; - this = GHIDRA_CAST(this->_subPlayer); - } - if (iVar3 == 0x24) { - AddBloodCharge(this,hearts); - return; - } - if (((iVar3 == 0x16) && (unk == 0)) && (0 < hearts)) { - hearts = hearts * 2; - } -LAB_00758b08: - iVar3 = GetHealthType(this); - if ((iVar3 != 1) && (iVar3 = GetHealthType(this_00), iVar3 != 2)) { - iVar3 = GetHealthType(this_01); - if (iVar3 == 3) { - iVar3 = hearts + 1; - if (hearts < 1) { - iVar3 = hearts - 1; - } - hearts = iVar3 - (iVar3 >> 0x1f) & 0xfffffffe; - } - oldRedHearts = this->_redHearts; - iVar3 = this->_maxHearts + this->_boneHearts * 2; - if (oldRedHearts + hearts < iVar3) { - iVar3 = oldRedHearts + hearts; - } - if (iVar3 < 0) { - iVar3 = 0; - } - this->_redHearts = iVar3; - if (0 < hearts) { - qVar2 = this->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 & 0xfffffffb; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(qVar2); - this->_bleedOutHealth = 0; - } - if (iVar3 != oldRedHearts) { - UpdateHeartDependentEffects(this); - } - ClampGoldenHearts(this,unk2); - update_bone_hearts(this); - if ((0 < hearts) && (oldRedHearts < this->_redHearts)) { - _player_hud_set_heart_anim_state(this); - } - } - return; -} - -// 00758c20 -void Entity_Player::AddEternalHearts(int amount) -{ - int iVar1; - int newEternalHearts; - uint32_t leftoverEternalHearts; - Entity_Player *this_00; - Entity_Player *this_01; - - if (this->_isCoopGhost != 0) { - RevivePlayerGhost(this); - return; - } - iVar1 = GetHealthType(this); - if (iVar1 != 3) { - iVar1 = GetHealthType(this_00); - if (iVar1 != 2) { - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - AddMaxHearts(this_01,amount,0); - AddHearts(this,amount,0,0); - return; - } - newEternalHearts = amount + this->_eternalHearts; - iVar1 = 0; - if (0 < newEternalHearts) { - iVar1 = newEternalHearts; - } - this->_eternalHearts = iVar1; - if (1 < iVar1) { - FUN_00758bd0(); - AddMaxHearts(this,this->_eternalHearts - (this->_eternalHearts >> 0x1f) & 0xfffffffe,0); - AddHearts(this,this->_eternalHearts - (this->_eternalHearts >> 0x1f) & 0xfffffffe,0,0); - leftoverEternalHearts = this->_eternalHearts & 0x80000001; - if (GHIDRA_INT(leftoverEternalHearts) < 0) { - leftoverEternalHearts = (leftoverEternalHearts - 1 | 0xfffffffe) + 1; - } - this->_eternalHearts = leftoverEternalHearts; - } - } - } - return; -} - -// 00758d00 -void Entity_Player::AddSoulHearts(int amount, uint8_t unk) -{ - uint8_t bVar1; - int iVar2; - int iVar3; - int heartLimit; - HUD *hudPlayerSlot; - Entity_Player *this_00; - uint32_t uVar4; - int extraout_EDX; - int count; - int extraout_EDX_00; - int iVar5; - int *activeCharge; - Game *game; - - game = g_game; - do { - while ((this->_playerType == 0x28 && - (GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0)))) { - unk = 0; - this = GHIDRA_CAST(this->_twinPlayer); - } - if ((((this->_isUpdatingGreedsGullet == 0) && (game->_isStartingFromState == 0)) && - (game->_isRestoringGlowingHourglassState == 0)) && (0 < amount)) { - bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x66); - if (bVar1 == 0) { -LAB_00758d9a: - uVar4 = 0; - activeCharge = &this->_activeDesc[0]._charge; - do { - if ((GHIDRA_CAST((activeCharge + -2)))->_item == 0x249) { - iVar3 = GetActiveMaxCharge(this,uVar4); - iVar2 = *activeCharge; - if (iVar2 + amount < iVar3) { - iVar3 = iVar2 + amount; - } - iVar5 = 0; - if (0 < iVar3) { - iVar5 = iVar3; - } - if (iVar5 != iVar2) { - SetActiveCharge(this,iVar5,uVar4); - amount = amount + (iVar2 - iVar5); - } - } - uVar4 = uVar4 + 1; - activeCharge = activeCharge + 8; - } while (uVar4 < 4); - } - else { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x66,-1); - iVar2 = amount + -2; - amount = 0; - if (0 < iVar2) { - amount = iVar2; - } - if (0 < amount) goto LAB_00758d9a; - } - game = g_game; - } - iVar2 = GetHealthType(this); - if (iVar2 == 2) { - if (extraout_EDX < 1) { - return; - } - this->_soulHearts = 1; - return; - } - iVar2 = GetHealthType(this_00); - if (iVar2 == 3) { - if (count < 1) { - return; - } - AddBlueFlies(this,(count * 3 + 1) / 2,&this->_pos,GHIDRA_CAST(0x0)); - return; - } - if (this->_playerType != 0x10) { - if (this->_playerType == 0x12) { - AddSoulCharge(this,count); - return; - } - iVar2 = GetHealthType(this); - if ((iVar2 == 1) && (extraout_EDX_00 < 0)) { - trigger_max_hearts_removed(this,-extraout_EDX_00); - } - if (1 < *GHIDRA_CAST(&game->_deathmatchManager)) { - ClampHeartsToLimit(this,3,amount); - return; - } - iVar3 = this->_soulHearts; - iVar2 = iVar3 + amount; - iVar5 = 0; - if (0 < iVar2) { - iVar5 = iVar2; - } - this->_soulHearts = iVar5; - heartLimit = GetHeartLimit(this,0); - iVar2 = this->_maxHearts + this->_boneHearts * 2; - iVar5 = this->_soulHearts; - if (heartLimit < iVar2 + iVar5) { - iVar5 = heartLimit - iVar2; - this->_soulHearts = iVar5; - } - if (7 < iVar5) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x50); - } - UpdateBlackHeartMask(this); - ClampGoldenHearts(this,unk); - update_bone_hearts(this); - if ((amount < 1) || (this->_soulHearts < iVar3)) { - return; - } - hudPlayerSlot = &g_game->_hud; - uVar4 = 0; - do { - if (*GHIDRA_CAST(hudPlayerSlot->_playerHUD) == this) { - hudPlayerSlot->_playerHUD[0xd] = 4; - return; - } - uVar4 = uVar4 + 1; - hudPlayerSlot = GHIDRA_CAST((hudPlayerSlot->_playerHUD + 0x6dc)); - } while (uVar4 < 8); - return; - } - this = GHIDRA_CAST(this->_subPlayer); - if (this == GHIDRA_CAST(0x0)) { - return; - } - unk = 0; - } while( true ); -} - -// 00758f90 -void Entity_Player::AddBlackHearts(int amount) -{ - int iVar1; - int heartLimit; - uint32_t slotParity; - Entity_Player *this_00; - int extraout_EDX; - uint32_t uVar2; - int iVar3; - uint32_t uVar4; - uint32_t local_10; - int roundingAdjust; - - while( true ) { - for (; (this->_playerType == 0x28 && - (GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0))); - this = GHIDRA_CAST(this->_twinPlayer)) { - } - iVar1 = GetHealthType(this); - if (iVar1 == 2) { - return; - } - if (extraout_EDX != 0x10) break; - this = GHIDRA_CAST(this->_subPlayer); - if (this == GHIDRA_CAST(0x0)) { - return; - } - } - iVar1 = GetHealthType(this); - if (iVar1 == 3) { - AddBlueFlies(this_00,(amount * 4 + 1) / 2,&this->_pos,GHIDRA_CAST(0x0)); - return; - } - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - ClampHeartsToLimit(this,6,amount); - return; - } - uVar4 = this->_soulHearts; - roundingAdjust = 0; - uVar2 = uVar4 + 1; - if ((uVar4 & 1) == 0) { - uVar2 = uVar4; - } - local_10 = amount & 1; - if (((uVar4 & 1) != 0) && (local_10 != 0)) { - roundingAdjust = -1; - local_10 = 0; - } - iVar1 = this->_boneHearts; - iVar3 = this->_maxHearts; - heartLimit = GetHeartLimit(this,0); - if (GHIDRA_INT((uVar2 + iVar3 + iVar1 * 2)) < heartLimit + -1) { - iVar1 = GHIDRA_INT((local_10 + uVar2 + amount)) / 2; - uVar4 = GHIDRA_INT((roundingAdjust + uVar2)) / 2; - if (GHIDRA_INT(uVar4) < iVar1) { - uVar2 = this->_blackHearts; - do { - uVar2 = uVar2 | 1 << (uVar4 & 0x1f); - uVar4 = uVar4 + 1; - } while (GHIDRA_INT(uVar4) < iVar1); - this->_blackHearts = uVar2; - } - } - else { - uVar4 = uVar2 - 1; - local_10 = 0; - while ((0 < GHIDRA_INT(uVar4) && (uVar2 = uVar2 - 2, GHIDRA_INT(local_10) < amount))) { - if ((this->_soulHearts < GHIDRA_INT(uVar4)) || (GHIDRA_INT(uVar4) < 1)) { -LAB_007590f3: - local_10 = local_10 + 2; - this->_blackHearts = this->_blackHearts | 1 << (GHIDRA_INT(uVar4) / 2 & 0x1fU); - } - else { - slotParity = uVar4 & 0x80000001; - if (GHIDRA_INT(slotParity) < 0) { - slotParity = (slotParity - 1 | 0xfffffffe) + 1; - } - if ((slotParity != 1) || ((this->_blackHearts & 1 << ((uint8_t)(GHIDRA_INT(uVar2) / 2) & 0x1f)) == 0)) - goto LAB_007590f3; - } - uVar4 = uVar4 - 2; - } - } - AddSoulHearts(this,amount,0); - if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && (this->_dead == 0)) && - (iVar1 = this->_goldenHearts, 0 < iVar1)) { - iVar3 = this->_redHearts; - if (this->_maxHearts < this->_redHearts) { - iVar3 = this->_maxHearts; - } - iVar3 = (iVar3 + 1) / 2 + (this->_soulHearts + 1) / 2 + this->_boneHearts; - if (iVar3 < iVar1) { - BreakGoldenHearts(this,iVar1 - iVar3); - this->_goldenHearts = iVar3; - } - } - update_bone_hearts(this); - return; -} - -// 007591e0 -void Entity_Player::RemoveBlackHeart(int soulHeartIndex) -{ - if ((soulHeartIndex <= this->_soulHearts) && (-1 < soulHeartIndex)) { - this->_blackHearts = this->_blackHearts & ~(1 << (GHIDRA_UINT(soulHeartIndex) >> 1 & 0x1f)); - ClampGoldenHearts(this,0); - update_bone_hearts(this); - } - return; -} - -// 00759220 -uint8_t Entity_Player::IsBlackHeart(int heart) -{ - if ((((this->_soulHearts < heart) || (heart < 1)) || ((heart & 1U) == 0)) || - ((this->_blackHearts & 1 << ((uint8_t)((heart + -1) / 2) & 0x1f)) == 0)) { - return 0; - } - return 1; -} - -// 007592a0 -void Entity_Player::UpdateBlackHeartMask() -{ - uint32_t uVar1; - int movedCount; - uint32_t uVar2; - uint32_t local_8; - uint8_t rotateShift; - - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - uVar1 = this->_soulHearts; - if (uVar1 == 0) { - this->_blackHearts = 0; - return; - } - movedCount = 0; - local_8 = GHIDRA_INT((uVar1 + 1)) / 2; - uVar2 = 0; - if (local_8 < 0x20) { - rotateShift = (uint8_t)local_8 & 0x1f; - uVar1 = 1 << rotateShift | 1U >> 0x20 - rotateShift; - do { - if ((this->_blackHearts & uVar1) != 0) { - uVar2 = uVar2 | 1 << (local_8 & 0x1f); - movedCount = movedCount + 1; - } - uVar1 = uVar1 << 1 | GHIDRA_UINT((GHIDRA_INT(uVar1) < 0)); - local_8 = local_8 + 1; - } while (local_8 < 0x20); - uVar1 = this->_soulHearts; - } - this->_blackHearts = this->_blackHearts & ~uVar2; - uVar2 = uVar1; - local_8 = uVar1; - while ((0 < GHIDRA_INT(uVar1) && (local_8 = local_8 - 1, 0 < movedCount))) { - if ((uVar1 & 1) != 0) { - if (((GHIDRA_INT(uVar2) < GHIDRA_INT(uVar1)) || (uVar1 == 0)) || - ((this->_blackHearts & 1 << ((uint8_t)(GHIDRA_INT(local_8) / 2) & 0x1f)) == 0)) { - movedCount = movedCount + -1; - this->_blackHearts = this->_blackHearts | 1 << (uVar1 >> 1 & 0x1f); - } - uVar2 = this->_soulHearts; - } - uVar1 = uVar1 - 1; - } - } - return; -} - -// 00759390 -void Entity_Player::AddJarHearts(int amount) -{ - int iVar1; - int newJarHearts; - Game *game; - Entity_Player *twin; - - iVar1 = this->_playerType; - while ((iVar1 == 0x28 && (twin = GHIDRA_CAST(this->_twinPlayer), twin != GHIDRA_CAST(0x0)) - )) { - iVar1 = twin->_playerType; - this = twin; - } - newJarHearts = this->_jarHearts + amount; - iVar1 = 8; - if (newJarHearts < 8) { - iVar1 = newJarHearts; - } - this->_jarHearts = iVar1; - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 00759400 -void Entity_Player::AddCoins(int amount) -{ - int iVar1; - Entity_Player *deepPocketsOwner; - int *clampedPtr; - Entity_Player *this_00; - int leftoverCoins; - int *cappedPtr; - int extraout_EDX; - int coins; - int clampValues [4]; - Game *game; - - coins = amount; - if (0 < amount) { - iVar1 = GetHealthType(this); - coins = extraout_EDX; - if (iVar1 == 3) { - iVar1 = this->_redHearts; - AddHearts(this_00,extraout_EDX * 2,0,0); - leftoverCoins = amount - (this->_redHearts - iVar1) / 2; - coins = 0; - if (0 < leftoverCoins) { - coins = leftoverCoins; - } - if (iVar1 < this->_redHearts) { - AddImmaculateConceptionCounter(1); - } - } - } - coins = this->_numCoins + coins; - clampValues[0] = coins; - deepPocketsOwner = - PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1a0,GHIDRA_CAST(&g_game->_playerManager),1); - clampValues[2] = 0; - clampValues[1] = (-GHIDRA_UINT((deepPocketsOwner != GHIDRA_CAST(0x0))) & 900) + 99; - cappedPtr = clampValues; - if (clampValues[1] <= coins) { - cappedPtr = clampValues + 1; - } - clampedPtr = clampValues + 2; - if (0 < *cappedPtr) { - clampedPtr = cappedPtr; - } - this->_numCoins = *clampedPtr; - ConsumableCountChanged(this,1); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 00759500 -void Entity_Player::AddBombs(int amount) -{ - int *clamped; - int *upperClamped; - int clampValues [4]; - Game *game; - - if ((this->_playerType == 0x19) && (0 < amount)) { - if (0x18 < amount) { - amount = 0x18; - } - if (amount != 0) { - AddBlueFlies(this,amount,&this->_pos,GHIDRA_CAST(0x0)); - return; - } - } - else { - clampValues[0] = this->_numBombs + amount; - clampValues[1] = 99; - clampValues[2] = 0; - upperClamped = clampValues; - if (0x62 < clampValues[0]) { - upperClamped = clampValues + 1; - } - clamped = clampValues + 2; - if (0 < *upperClamped) { - clamped = upperClamped; - } - this->_numBombs = *clamped; - ConsumableCountChanged(this,4); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - } - return; -} - -// 007595b0 -void Entity_Player::AddKeys(int amount) -{ - int *clampedKeys; - int *cappedKeys; - int keyBounds [2]; - Game *game; - - amount = amount + this->_numKeys; - keyBounds[1] = 99; - cappedKeys = &amount; - if (0x62 < amount) { - cappedKeys = keyBounds + 1; - } - keyBounds[0] = 0; - clampedKeys = keyBounds; - if (0 < *cappedKeys) { - clampedKeys = cappedKeys; - } - this->_numKeys = *clampedKeys; - ConsumableCountChanged(this,2); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 00759620 -void Entity_Player::AddGoldenKey() -{ - Game *game; - - this->_hasGoldenKey = 1; - ConsumableCountChanged(this,8); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 00759660 -void Entity_Player::RemoveGoldenKey() -{ - Game *game; - - this->_hasGoldenKey = 0; - ConsumableCountChanged(this,8); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007596a0 -void Entity_Player::SyncConsumables(Entity_Player *target, uint32_t mask) -{ - uint8_t isHasItem; - int iVar1; - - if (((mask & 1) != 0) && (target->_numCoins = this->_numCoins, target->_valid != 0)) { - isHasItem = HasCollectible(target,0x6d,0); - if (isHasItem != 0) { - target->_cacheFlags = target->_cacheFlags | 1; - EvaluateItems(target); - } - update_greeds_gullet(target); - } - if ((mask & 2) != 0) { - target->_numKeys = this->_numKeys; - } - if ((mask & 4) != 0) { - target->_numBombs = this->_numBombs; - iVar1 = target->_numGigaBombs; - if (this->_numBombs < target->_numGigaBombs) { - iVar1 = this->_numBombs; - } - target->_numGigaBombs = iVar1; - } - if ((mask & 8) != 0) { - target->_hasGoldenKey = this->_hasGoldenKey; - } - if ((mask & 0x10) != 0) { - target->_hasGoldenBomb = this->_hasGoldenBomb; - } - if ((mask & 0x40) != 0) { - iVar1 = this->_numGigaBombs; - if (this->_numBombs < this->_numGigaBombs) { - iVar1 = this->_numBombs; - } - target->_numGigaBombs = iVar1; - } - if ((mask & 0x20) != 0) { - iVar1 = target->_effectiveSoulCharge; - target->_effectiveSoulCharge = this->_effectiveSoulCharge; - if (target->_valid != 0) { - apply_soul_charge_to_actives(target,iVar1); - } - } - if ((mask & 0x100) != 0) { - iVar1 = target->_effectiveBloodCharge; - target->_effectiveBloodCharge = this->_effectiveBloodCharge; - if (target->_valid != 0) { - blood_charge_changed(target,iVar1); - } - } - if ((char)mask < '\0') { - target->_poopMana = this->_poopMana; - } - return; -} - -// 007597e0 -void Entity_Player::ConsumableCountChanged(int bitflags) -{ - uint32_t *playerSlot; - void *playerListEnd; - int coins; - uint32_t playerIdx; - Game *game; - uint64_t oldStateFlags; - uint32_t *stateFlagsHigh; - - if (-1 < this->_playerIndex) { - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - playerIdx = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - game = g_game; - playerListEnd = (g_game->_playerManager)._playerList._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (game->_playerManager)._playerList._end; - } - playerSlot = (game->_playerManager)._playerList._begin; - if (playerIdx < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + playerIdx; - } - SyncConsumables(this,GHIDRA_CAST(*playerSlot),bitflags); - playerIdx = playerIdx + 1; - } while (playerIdx < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - if ((bitflags & 1U) != 0) { - coins = this->_numCoins; - if (0x36 < coins) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,2); - coins = this->_numCoins; - } - game = g_game; - if (0x62 < coins) { - oldStateFlags = g_game->_gameStateFlags; - stateFlagsHigh = GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)); - *stateFlagsHigh = *stateFlagsHigh | 0x800; - *GHIDRA_CAST(&game->_gameStateFlags) = GHIDRA_INT(oldStateFlags); - coins = this->_numCoins; - } - if ((((coins < 1) && ((game->_gameStateFlags & 0x80000000000) != 0)) && - (game->_isRestoringGlowingHourglassState == 0)) && - ((game->_isStartingFromState == 0 && (this->_hasCurseMistEffect == 0)))) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x247); - return; - } - } - } - else { - SyncConsumables(this,this,bitflags); - } - } - return; -} - -// 00759950 -void Entity_Player::restore_curse_mist_backup(int *backup) -{ - this->_numCoins = *backup; - this->_numKeys = backup[1]; - this->_numBombs = backup[2]; - this->_hasGoldenKey = *GHIDRA_CAST((backup + 3)); - this->_hasGoldenBomb = *GHIDRA_CAST((GHIDRA_CAST(backup) + 0xd)); - this->_numGigaBombs = backup[5]; - this->_effectiveSoulCharge = backup[4]; - this->_effectiveBloodCharge = backup[7]; - this->_poopMana = backup[6]; - if (this->_valid == 0) { - return; - } - ConsumableCountChanged(this,-1); - return; -} - -// 007599d0 -Entity * Entity_Player::AddBlueFlies(int amount, Vector *pos, Entity *target) -{ - Manager *unusedArg; - uint8_t isInputActive; - int iVar1; - int iVar2; - uint32_t rngResult; - Entity *fly; - bool isInputActive; - bool bVar4; - uint32_t *erasedRef; - Entity_Player *player; - uint32_t *flyTarget; - PersistentGameData *persistentData; - - player = this; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x5e)) { - iVar2 = GetTrinketMultiplier(this,0x5e); - bVar4 = false; - isInputActive = iVar2 == 0; -LAB_00759a0e: - if (isInputActive || bVar4 != iVar2 < 0) goto LAB_00759a6a; - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar1 = GetTrinketMultiplier(this,0x5e); - bVar4 = SBORROW4(iVar1,1); - iVar2 = iVar1 + -1; - isInputActive = iVar1 == 1; - goto LAB_00759a0e; - } - iVar1 = 2; - iVar2 = GetTrinketMultiplier(this,0x5e); - if (iVar2 == 2) { - rngResult = Random(); - if (rngResult % 5 == 0) { - iVar1 = 3; - } - } - else if ((iVar2 == 3) && (rngResult = Random(), rngResult % 5 == 0)) { - amount = amount * 4; - goto LAB_00759a6a; - } - amount = iVar1 * amount; -LAB_00759a6a: - this->_numBlueFlies = this->_numBlueFlies + amount; - fly = GHIDRA_CAST(0x0); - iVar2 = this->_numBlueFlies; - if (0 < amount) { - do { - rngResult = Random(); - fly = Game::SpawnEx(g_game,3,0x2b,pos,&g_vectorZero,GHIDRA_CAST(this),0,rngResult,0); - if ((target != GHIDRA_CAST(0x0)) && (target->_dead == 0)) { - flyTarget = &fly->_target; - if (fly->_target != 0) { - erasedRef = flyTarget; - msvc::multiset::erase(&erasedRef); - } - *flyTarget = target; - msvc::multiset::insert(flyTarget); - this = player; - } - *GHIDRA_CAST(&fly->_flags) = GHIDRA_UINT(fly->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&fly->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&fly->_flags) + 4)); - amount = amount + -1; - } while (amount != 0); - iVar2 = this->_numBlueFlies; - } - unusedArg = g_manager; - if (iVar2 < 0x14) { - return fly; - } - persistentData = &g_manager->_persistentGameData; - if ((*GHIDRA_CAST((GHIDRA_CAST(&((g_manager->_persistentGameData))) + 0x1))) != '\0') { - return fly; - } - if ((g_manager->_persistentGameData)._achievements[0x184] != 0) { - return fly; - } - (g_manager->_persistentGameData)._achievements[0x184] = 1; - if (((unusedArg->_netplayManager == *GHIDRA_CAST((unusedArg + 1))) || - (isInputActive = Manager::IsGameplayInputActive(GHIDRA_INT(unusedArg)), isInputActive == 0)) && - ((unusedArg->_persistentGameData)._isSteamAchievementsEnabled != 0)) { - PersistentGameData::UnlockSteamAchievement(persistentData,0x184); - Manager::queue_achievement_popup(0x184); - } - *GHIDRA_CAST(persistentData) = 1; - PersistentGameData::check_challenge_unlocks(persistentData); - PersistentGameData::check_collection_unlocks(persistentData); - return fly; -} - -// 00759b80 -void Entity_Player::RemoveBlueFly() -{ - this->_numBlueFlies = this->_numBlueFlies + -1; - return; -} - -// 00759b90 -void Entity_Player::AddLeprosy() -{ - if (this->_numLeprosy < 3) { - this->_cacheFlags = this->_cacheFlags | 0x200; - this->_numLeprosy = this->_numLeprosy + 1; - EvaluateItems(this); - return; - } - return; -} - -// 00759bc0 -Entity * Entity_Player::AddBoneOrbital(Vector *Position) -{ - uint32_t seed; - Entity *orbital; - - seed = Random(); - orbital = Game::Spawn(g_game,3,0x80,Position,&g_vectorZero,GHIDRA_CAST(this),0,seed); - return orbital; -} - -// 00759bf0 -Entity * Entity_Player::AddSwarmFlyOrbital(Vector *position) -{ - Entity_Player *game = this; - code *pcVar1; - uint32_t uVar2; - Entity *swarmFly; - void *pvVar3; - void *pvVar4; - uint32_t entityIndex; - uint32_t *rngSeed; - int blockIndex; - int *flyDeque; - void *flyDequeMap; - int flyDequeMapSize; - uint32_t flyDequeOffset; - uint32_t flyDequeSize; - int familiar; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int *flyDequeProxy; - Game *game; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afebed; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - flyDeque = GHIDRA_CAST(0x0); - flyDequeMap = (void *)0x0; - flyDequeMapSize = 0; - flyDequeOffset = 0; - flyDequeSize = 0; - flyDeque = operator_new(8); - flyDeque[1] = 0; - *flyDeque = GHIDRA_INT(&flyDeque); - local_8 = 0; - entityIndex = 0; - pvVar3 = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1264)) != 0) { - do { - familiar = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x125c)) + entityIndex * 4)); - if ((familiar == 0) || (*GHIDRA_CAST((familiar + 0x28)) != 3)) { - familiar = 0; - } - else if ((*GHIDRA_CAST((familiar + 0x2c)) == 0xe5) && - (*GHIDRA_CAST((familiar + 0x410)) == game)) { - msvc::deque::push_front(&familiar); - } - entityIndex = entityIndex + 1; - } while (entityIndex < *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1264))); - } - if (0xf < flyDequeSize) { - do { - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(flyDequeMap) + - (flyDequeOffset >> 2 & flyDequeMapSize - 1U) * 4)) + - (flyDequeOffset & 3) * 4)) + 0x28))(uVar2); - flyDequeSize = flyDequeSize - 1; - if (flyDequeSize == 0) { - flyDequeOffset = 0; - } - else { - flyDequeOffset = flyDequeOffset + 1; - } - } while (0xf < flyDequeSize); - } - pvVar3 = (game->_collectibleRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(pvVar3) + 0x2b50)); - uVar2 = *rngSeed; - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar2 = *rngSeed; - if (uVar2 == 0) { - pcVar1 = (code *)swi(3); - swarmFly = GHIDRA_CAST((*pcVar1)()); - return swarmFly; - } - } - game = g_game; - uVar2 = uVar2 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x2b54)) & 0x1f) ^ uVar2; - uVar2 = uVar2 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x2b58)) & 0x1f) ^ uVar2; - uVar2 = uVar2 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x2b5c)) & 0x1f) ^ uVar2; - *rngSeed = uVar2; - swarmFly = Game::Spawn(game,3,0xe5,position,&g_vectorZero,GHIDRA_CAST(game),0,uVar2); - swarmFly->Update(); - if (flyDequeSize != 0) { - do { - flyDequeSize = flyDequeSize - 1; - } while (flyDequeSize != 0); - flyDequeOffset = 0; - flyDequeSize = 0; - } - pvVar3 = flyDequeMap; - blockIndex = flyDequeMapSize; - if (flyDequeMapSize != 0) { - do { - pvVar4 = *(void **)(GHIDRA_CAST(pvVar3) + blockIndex * 4 + -4); - blockIndex = blockIndex + -1; - if (pvVar4 != (void *)0x0) { - operator_delete(pvVar4,0x10); - pvVar3 = flyDequeMap; - } - } while (blockIndex != 0); - } - if (pvVar3 != (void *)0x0) { - uVar2 = flyDequeMapSize * 4; - pvVar4 = pvVar3; - if (0xfff < uVar2) { - pvVar4 = *(void **)(GHIDRA_CAST(pvVar3) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar3) + (-4 - GHIDRA_INT(pvVar4))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar4,uVar2); - } - flyDequeProxy = flyDeque; - flyDequeMapSize = 0; - flyDequeMap = (void *)0x0; - flyDeque = GHIDRA_CAST(0x0); - operator_delete(flyDequeProxy,8); - ExceptionList = local_10; - return swarmFly; -} - -// 00759e20 -uint8_t Entity_Player::TryUseKey() -{ - uint8_t bVar1; - int hearts; - uint32_t seed; - Entity *heartEffect; - uint8_t unk2; - int soundId [2]; - Game *game; - Manager *manager; - - if (this->_hasGoldenKey == 0) { - if (this->_numKeys < 1) { - return 0; - } - this->_numKeys = this->_numKeys + -1; - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - ConsumableCountChanged(this,2); - bVar1 = HasTrinket(this,0x57,0); - if (bVar1 != 0) { - unk2 = 0; - bVar1 = 0; - hearts = GetTrinketMultiplier(this,0x57); - AddHearts(this,hearts,bVar1,unk2); - manager = g_manager; - soundId[0] = 0x9d; - if (this->_playerType == 0x16) { - soundId[0] = 0x266; - } - seed_fart_sound_override(soundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId[0],1.0,2,0,1.0,0.0); - seed = Random(); - heartEffect = Game::SpawnEx(g_game,1000,0x31,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0) - ; - __RTDynamicCast(heartEffect,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); - } - } - return 1; -} - -// 0075bf00 -void Entity_Player::UpdateCostumes() -{ - int iVar1; - float fVar2; - float fVar3; - uint8_t bVar4; - void *costumeIter; - int *piVar5; - ItemConfig_Item *nullItem; - uint32_t uVar6; - LayerState *layer; - uint8_t *pbVar7; - float fVar8; - uint32_t *headSkinPath; - uint32_t *puVar9; - std_string *pngFilename; - void *pvVar10; - char cVar11; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint32_t layerId; - uint8_t *expectedAnimName; - ColorMod *layerColor; - uint32_t *extraout_ECX; - uint32_t *extraout_ECX_00; - uint32_t *puVar12; - uint32_t *extraout_ECX_01; - uint32_t *extraout_ECX_02; - uint32_t *extraout_ECX_03; - int iVar13; - uint32_t size; - ANM2 *costumeSprite; - uint8_t *pbVar14; - Entity_Player *playerAlias; - bool isNameLess; - char *pcVar15; - uint8_t eraseResult [4]; - LayerState *local_e4; - int matchedLayers; - ANM2 *local_dc; - uint8_t *bodyIndex; - void *playerConfig; - uint32_t *headColor; - ANM2 *local_cc; - int local_c8; - uint32_t *bodyColor; - uint32_t cleanupFlags; - uint8_t *local_bc; - std_vector *costumeDescs; - uint8_t local_b1; - Entity_Player *local_b0; - char local_aa; - char local_a9; - uint32_t *local_a8; - uint8_t local_a2; - uint8_t local_a1; - uint32_t local_a0 [5]; - char bodySkinPathTmp [12]; - uint32_t local_80; - uint32_t uStack_7c; - float local_78; - std_string headSheetPath; - std_string bodySheetPath; - std_string skinPath; - std_string tmpPath; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int *effectsEnd; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afeef5; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(&tmpPath) + 0x28U; - cleanupFlags = 0; - if (this->_variant == 1) { - return; - } - if (DAT_00c81148 != '\0') { - return; - } - pvVar10 = (this->_costumeSpriteDescs)._end; - local_a9 = '\0'; - iVar13 = -1; - local_a1 = 0; - local_aa = '\0'; - local_a2 = 0; - costumeDescs = &this->_costumeSpriteDescs; - costumeIter = costumeDescs->_begin; - DAT_00c81148 = '\x01'; - local_c8 = -1; - local_a8 = GHIDRA_CAST(0x4b); - if (costumeIter == pvVar10) { -LAB_0075c0c6: - local_a8 = GHIDRA_CAST(0xffffffff); - } - else { - local_b1 = this->_canFly; - do { - piVar5 = *GHIDRA_CAST((GHIDRA_CAST(costumeIter) + 0x114)); - if (piVar5 != GHIDRA_CAST(0x0)) { - iVar1 = *piVar5; - if (((iVar1 == 1) || (iVar1 == 3)) || (iVar1 == 4)) { - iVar1 = piVar5[1]; - if (iVar1 < 0x253) { - if (iVar1 == 0x252) { - local_a9 = '\x01'; - } - else if (iVar1 == 0x82) { - local_a8 = GHIDRA_CAST(0x4d); - } - else if (iVar1 == 0xb5) { - local_a8 = GHIDRA_CAST(0x4e); - } - } - else if (iVar1 == 0x271) { - local_a2 = 1; - } - else if (iVar1 == 0x2c0) { - local_a1 = 1; - } - } - else if (*piVar5 == 0) { - iVar1 = piVar5[1]; - iVar13 = iVar1; - if (3 < iVar1 - 0x4bU) { - iVar13 = local_c8; - } - local_c8 = iVar13; - if (iVar1 == 0x67) { - local_aa = '\x01'; - } - } - } - if ((((local_b1 != 0) && (*GHIDRA_CAST((GHIDRA_CAST(costumeIter) + 0x11d)) != '\0')) && - ((piVar5 == GHIDRA_CAST(0x0) || (3 < piVar5[1] - 0x4bU)))) && (local_a8 == GHIDRA_CAST(0x4b))) - { - local_a8 = GHIDRA_CAST(0x4c); - } - costumeIter = (void *)(GHIDRA_INT(costumeIter) + 0x130); - pvVar10 = (this->_costumeSpriteDescs)._end; - } while (costumeIter != pvVar10); - if (local_a9 == '\0') goto LAB_0075c0c6; - } - ExceptionList = &local_10; - local_b0 = this; - if (local_a8 != GHIDRA_CAST(iVar13)) { - costumeIter = (this->_costumeSpriteDescs)._begin; - if (costumeIter != pvVar10) { - do { - piVar5 = *GHIDRA_CAST((GHIDRA_CAST(costumeIter) + 0x114)); - if (((piVar5 == GHIDRA_CAST(0x0)) || (*piVar5 != 0)) || (3 < piVar5[1] - 0x4bU)) { - costumeIter = (void *)(GHIDRA_INT(costumeIter) + 0x130); - } - else { - piVar5 = GHIDRA_CAST(std)::vector::erase(eraseResult,costumeIter); - costumeIter = (void *)*piVar5; - } - } while (costumeIter != (this->_costumeSpriteDescs)._end); - } - if (local_a8 != GHIDRA_CAST(0xffffffff)) { - if ((GHIDRA_INT(local_a8) < 0) || - (pvVar10 = (g_manager->_itemConfig)._nullItems._begin, - GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar10) >> 2 <= GHIDRA_INT(local_a8))) { - nullItem = GHIDRA_CAST(0x0); - } - else { - nullItem = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + GHIDRA_INT(local_a8) * 4)); - } - AddCostume(this,nullItem,0); - } - } - if ((local_a1 == 0) || (this->_playerType != 0x1b)) { - cVar11 = '\0'; - } - else { - cVar11 = '\x01'; - } - if (cVar11 != local_aa) { - pvVar10 = (g_manager->_itemConfig)._nullItems._begin; - iVar13 = GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar10) >> 2; - if (local_aa == '\0') { - if (iVar13 < 0x68) { - nullItem = GHIDRA_CAST(0x0); - } - else { - nullItem = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x19c)); - } - AddCostume(this,nullItem,0); - } - else if (iVar13 < 0x68) { - RemoveCostume(this,GHIDRA_CAST(0x0)); - } - else { - RemoveCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x19c))); - } - } - iVar13 = this->_playerType; - if ((iVar13 < 0) || - (playerConfig = (g_manager->_entityConfig)._players._begin, - (GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(playerConfig)) / 0x148 <= iVar13)) { - playerConfig = (void *)0x0; -LAB_0075c224: - KAGE_LogMessage(0x10,GHIDRA_CAST("Could not load config for player type %d\n")); - } - else { - playerConfig = (void *)(iVar13 * 0x148 + GHIDRA_INT(playerConfig)); - if (playerConfig == (void *)0x0) goto LAB_0075c224; - } - headColor = *GHIDRA_CAST((GHIDRA_CAST(playerConfig) + 0xe4)); - uVar6 = 0; - piVar5 = &local_b0->_playerCostumeMap[0]._layerID; - do { - (GHIDRA_CAST((piVar5 + -1)))->_index = -1; - *piVar5 = -1; - piVar5[1] = -1; - if (((uVar6 == 0) || (3 < uVar6)) && (uVar6 != 0xb)) { - bVar4 = 0; - } - else { - bVar4 = 1; - } - *GHIDRA_CAST((piVar5 + 2)) = bVar4; - uVar6 = uVar6 + 1; - piVar5 = piVar5 + 4; - } while (uVar6 < 0xf); - local_c8 = -1; - local_a8 = GHIDRA_CAST(0xffffffff); - local_bc = GHIDRA_CAST(0x0); - pvVar10 = costumeDescs->_begin; - bodyColor = headColor; - if (0 < (GHIDRA_INT(costumeDescs->_end) - GHIDRA_INT(pvVar10)) / 0x130) { - do { - costumeSprite = GHIDRA_CAST((GHIDRA_INT(pvVar10) + GHIDRA_INT(local_bc) * 0x130)); - pbVar14 = local_bc; - bodyIndex = local_bc; - if ((local_b0->_hasCurseMistEffect == 0) || - (((piVar5 = *GHIDRA_CAST(costumeSprite[1]._filename._buf), piVar5 != GHIDRA_CAST(0x0) && - (*piVar5 == 0)) && (piVar5[1] == *GHIDRA_CAST((GHIDRA_CAST(playerConfig) + 0xac)))))) { -LAB_0075c397: - if (((local_b0->_isCoopGhost == 0) && - ((local_a2 == 0 || - (((piVar5 = *GHIDRA_CAST(costumeSprite[1]._filename._buf), piVar5 != GHIDRA_CAST(0x0) && - (*piVar5 == 3)) && (piVar5[1] == 0x271)))))) && - ((piVar5 = *GHIDRA_CAST(costumeSprite[1]._filename._buf), piVar5 == GHIDRA_CAST(0x0) || - ((((iVar13 = *piVar5, iVar13 != 1 && (iVar13 != 3)) && (iVar13 != 4)) || - ((piVar5[1] != 0xd6 || ((local_b0->_playerType != 8 && (local_b0->_playerType != 0xb))) - ))))))) { - local_dc = &local_b0->_sprite; - local_a1 = 0; - matchedLayers = 0; - pbVar14 = GHIDRA_CAST(0x0); - local_cc = costumeSprite; - do { - layer = ANM2::GetLayer(local_dc,pbVar14); - pvVar10 = layer->_layerData; - if (pvVar10 == (void *)0x0) { - pbVar7 = &s_empty; - } - else { - pbVar7 = GHIDRA_CAST((GHIDRA_INT(pvVar10) + 8)); - if (0xf < *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1c))) { - pbVar7 = *GHIDRA_CAST(pbVar7); - } - } - local_e4 = ANM2::GetLayer(costumeSprite,pbVar7); - if (local_e4 == GHIDRA_CAST(0x0)) { -LAB_0075c5f9: - } - else { - if ((*GHIDRA_CAST((costumeSprite[1]._filename._buf + 4)) < - local_b0->_playerCostumeMap[GHIDRA_INT(pbVar14)]._priority) || - (((local_b0->_canFly != 0 && (costumeSprite[1]._filename._buf[9] == '\0')) && - (local_b0->_playerCostumeMap[GHIDRA_INT(pbVar14)]._isBodyLayer != 0)))) { - if (pbVar14 == &DAT_00000004) { -LAB_0075c594: - if ((char)costumeSprite[1]._filename._capacity != '\0') goto LAB_0075c59d; - } - else if (pbVar14 == GHIDRA_CAST(0x1)) { -LAB_0075c5ca: - if ((char)costumeSprite[1]._filename._capacity != '\0') goto LAB_0075c5d3; - } - goto LAB_0075c5f9; - } - if (((matchedLayers != 0) && (bodyIndex == local_bc)) && - ((pbVar14 != GHIDRA_CAST(0x0) && - (bVar4 = local_b0->_playerCostumeMap[GHIDRA_INT(pbVar14)]._isBodyLayer, local_a1 != bVar4 - )))) { - if (bVar4 == 0) { - local_bc = local_bc + 1; - } - else { - bodyIndex = bodyIndex + 1; - } - } - local_a1 = local_b0->_playerCostumeMap[GHIDRA_INT(pbVar14)]._isBodyLayer; - pbVar7 = local_bc; - if (local_a1 != 0) { - pbVar7 = bodyIndex; - } - local_b0->_playerCostumeMap[GHIDRA_INT(pbVar14)]._index = GHIDRA_INT(pbVar7); - if (local_e4->_layerData == GHIDRA_CAST(0x0)) { - layerId = 0xffffffff; - } - else { - layerId = *GHIDRA_CAST(local_e4->_layerData); - } - matchedLayers = matchedLayers + 1; - *(uint32_t *) - (GHIDRA_INT((&(local_b0->_sprite)._filename + -3)) + GHIDRA_INT((pbVar14 + 0x123)) * 0x10) = - layerId; - local_b0->_playerCostumeMap[GHIDRA_INT(pbVar14)]._priority = - *GHIDRA_CAST((local_cc[1]._filename._buf + 4)); - cVar11 = (char)local_cc[1]._filename._capacity; - costumeSprite = local_cc; - if (pbVar14 == &DAT_00000004) { - if (cVar11 == '\0') goto LAB_0075c594; - headColor = *GHIDRA_CAST((local_cc[1]._filename._buf + 0xc)); -LAB_0075c59d: - iVar13 = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 4)); - if (local_c8 <= iVar13) { - headColor = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 0xc)); - local_c8 = iVar13; - } - } - else { - if (pbVar14 != GHIDRA_CAST(0x1)) goto LAB_0075c5f9; - if (cVar11 == '\0') goto LAB_0075c5ca; - bodyColor = *GHIDRA_CAST((local_cc[1]._filename._buf + 0xc)); -LAB_0075c5d3: - puVar9 = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 4)); - if (GHIDRA_INT(local_a8) <= GHIDRA_INT(puVar9)) { - bodyColor = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 0xc)); - local_a8 = puVar9; - } - } - } - pbVar14 = pbVar14 + 1; - } while (pbVar14 < &DAT_0000000f); - if ((char)costumeSprite[1]._filename._capacity != '\0') { - iVar13 = *GHIDRA_CAST(costumeSprite[1]._filename._buf); - if (iVar13 != 0) { - if (*GHIDRA_CAST((iVar13 + 0xa9)) != '\0') { - iVar1 = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 4)); - if (local_c8 <= iVar1) { - headColor = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 0xc)); - local_c8 = iVar1; - } - } - if (*GHIDRA_CAST((iVar13 + 0xaa)) != '\0') { - puVar9 = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 4)); - if (GHIDRA_INT(local_a8) <= GHIDRA_INT(puVar9)) { - bodyColor = *GHIDRA_CAST((costumeSprite[1]._filename._buf + 0xc)); - local_a8 = puVar9; - } - } - } - } - pbVar14 = bodyIndex; - if (GHIDRA_INT(bodyIndex) < GHIDRA_INT(local_bc)) { - pbVar14 = local_bc; - } - } - } - else { - iVar13 = *piVar5; - if ((((iVar13 == 1) || (iVar13 == 3)) || (iVar13 == 4)) && - ((piVar5[1] == 0x14 && ((local_b0->_temporaryeffects)._disabled == 0)))) { - piVar5 = (local_b0->_temporaryeffects)._effects._begin; - effectsEnd = (local_b0->_temporaryeffects)._effects._end; - if (piVar5 != effectsEnd) { - do { - iVar13 = *GHIDRA_CAST(*piVar5); - if ((((iVar13 == 1) || (iVar13 == 3)) || (iVar13 == 4)) && - ((GHIDRA_CAST(*piVar5))[1] == 0x14)) goto LAB_0075c397; - piVar5 = piVar5 + 4; - } while (piVar5 != effectsEnd); - } - } - } - local_bc = pbVar14 + 1; - pvVar10 = costumeDescs->_begin; - } while (GHIDRA_INT(local_bc) < (GHIDRA_INT(costumeDescs->_end) - GHIDRA_INT(pvVar10)) / 0x130); - } - if ((local_b0->_playerType == 0xc) || (local_a9 = '\0', local_b0->_playerType == 0x18)) { - local_a9 = '\x01'; - } - local_cc = GHIDRA_CAST(0x0); - playerAlias = local_b0; -LAB_0075c6e0: - iVar13 = playerAlias->_playerCostumeMap[GHIDRA_INT(local_cc)]._index; - if (iVar13 < 0) goto LAB_0075cdb5; - pvVar10 = (playerAlias->_costumeSpriteDescs)._begin; - iVar13 = iVar13 * 0x130; - local_a2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x11f)); - if (((local_a2 == 0) || - (((puVar9 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x124)), puVar9 == headColor || - (playerAlias->_playerCostumeMap[GHIDRA_INT(local_cc)]._isBodyLayer != 0)) && - ((playerAlias = local_b0, puVar9 == bodyColor || - (local_b0->_playerCostumeMap[GHIDRA_INT(local_cc)]._isBodyLayer == 0)))))) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 300)) == playerAlias->_playerType)) goto LAB_0075cdb5; - local_bc = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x34)); - if (local_bc == GHIDRA_CAST(0x0)) { - local_bc = &s_empty; -LAB_0075c790: - local_b1 = 0; - } - else { - if (0xf < *GHIDRA_CAST((local_bc + 0x14))) { - local_bc = *GHIDRA_CAST(local_bc); - } - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x44)) == '\0') goto LAB_0075c790; - local_b1 = 1; - } - local_e4 = GHIDRA_CAST(GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x40)))); - local_a8 = headColor; - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x124)) != bodyColor) && - (local_b0->_playerCostumeMap[GHIDRA_INT(local_cc)]._isBodyLayer != 0)) { - local_a8 = bodyColor; - } - piVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x114)); - if ((*piVar5 == 0) && ((iVar1 = piVar5[1], iVar1 == 0xc || (iVar1 == 0x58)))) { -LAB_0075cd71: - puVar9 = local_a8; -LAB_0075cac5: - } - else { - if ((local_a2 != 0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x120)) != local_a8)) { - pbVar14 = GHIDRA_CAST(0x0); - local_aa = '\0'; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x80)) != 0) { - do { - local_a2 = 0; - local_a1 = 0; - local_dc = GHIDRA_CAST(local_b0->_playerType); - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(pvVar10) + iVar13)),pbVar14); - if (layer->_layerData == (void *)0x0) { - tmpPath._capacity = 0xf; - tmpPath._size = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((tmpPath._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20)); - } - cleanupFlags = cleanupFlags | 2; - local_8 = 3; - costume_path_apply_skin_color - (&skinPath,&tmpPath,GHIDRA_INT(local_a8),GHIDRA_INT(local_dc),&local_a2,&local_a1); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),5); - if (0xf < tmpPath._capacity) { - uVar6 = tmpPath._capacity + 1; - pcVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpPath._buf))) + 0x0))); - if (0xfff < uVar6) { - pcVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + -4)); - uVar6 = tmpPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar15))))) - goto LAB_0075cfcd; - } - operator_delete(pcVar15,uVar6); - } - tmpPath._size = 0; - tmpPath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) & 0xffffff00; - Sprite::ReplaceSpritesheet - (GHIDRA_CAST((GHIDRA_INT(costumeDescs->_begin) + iVar13)),GHIDRA_INT(pbVar14),&skinPath); - if ((local_a1 == 0) && (local_a9 != '\0')) { - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(costumeDescs->_begin) + iVar13)),pbVar14); - fVar3 = fRam00c5d09c; - fVar2 = fRam00c5d098; - fVar8 = fRam00c5d094; - layerColor = &layer->_color; - if (layerColor != GHIDRA_CAST(&DAT_00c5d090)) { - layerColor->_tint[0] = _DAT_00c5d090; - (layer->_color)._tint[1] = fVar8; - (layer->_color)._tint[2] = fVar2; - (layer->_color)._tint[3] = fVar3; - fVar3 = fRam00c5d0ac; - fVar2 = fRam00c5d0a8; - fVar8 = fRam00c5d0a4; - (layer->_color)._colorize[0] = _DAT_00c5d0a0; - (layer->_color)._colorize[1] = fVar8; - (layer->_color)._colorize[2] = fVar2; - (layer->_color)._colorize[3] = fVar3; - *GHIDRA_CAST((layer->_color)._offset) = DAT_00c5d0b0; - fVar8 = DAT_00c5d0b8; - goto LAB_0075c9d3; - } - } - else { - local_80 = 0; - uStack_7c = 0; - local_78 = 0.0; - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(costumeDescs->_begin) + iVar13)),pbVar14); - layerColor = &layer->_color; - if (layerColor != GHIDRA_CAST(local_a0)) { - layerColor->_tint[0] = 1.0; - (layer->_color)._tint[1] = 1.0; - (layer->_color)._tint[2] = 1.0; - (layer->_color)._tint[3] = 1.0; - (layer->_color)._colorize[0] = 0.0; - (layer->_color)._colorize[1] = 0.0; - (layer->_color)._colorize[2] = 0.0; - (layer->_color)._colorize[3] = 0.0; - *GHIDRA_CAST((layer->_color)._offset) = CONCAT44(uStack_7c,local_80); - fVar8 = local_78; -LAB_0075c9d3: - layerColor->_offset[2] = fVar8; - } - } - if ((local_a2 != 0) || (local_a1 != 0)) { - local_aa = '\x01'; - } - local_8 = 0xffffffff; - if (0xf < skinPath._capacity) { - uVar6 = skinPath._capacity + 1; - pvVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)skinPath._buf)) + 0x0))); - if (0xfff < uVar6) { - pvVar10 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(skinPath._buf)) + 0x0))) + -4); - uVar6 = skinPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(skinPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar10))))) goto LAB_0075cfcd; - } - operator_delete(pvVar10,uVar6); - } - pbVar14 = pbVar14 + 1; - pvVar10 = costumeDescs->_begin; - } while (pbVar14 < *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x80))); - } - if (local_aa != '\0') goto LAB_0075cd71; - (GHIDRA_CAST((tmpPath._buf)))->msvc::string::string((void *)(GHIDRA_INT(pvVar10) + iVar13)); - puVar9 = local_a8; - cleanupFlags = cleanupFlags | 4; - local_8 = 6; - KAGE_LogMessage(1,(uint8_t *) - "Costume %s supports skin color alts but no alt spritesheet could be found! (skin color %d)\n" - ); - local_8 = 0xffffffff; - if (0xf < tmpPath._capacity) { - uVar6 = tmpPath._capacity + 1; - pcVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpPath._buf))) + 0x0))); - if (0xfff < uVar6) { - pcVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + -4)); - uVar6 = tmpPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar15))))) goto LAB_0075cfcd; - } - operator_delete(pcVar15,uVar6); - } - goto LAB_0075cac5; - } - pbVar14 = GHIDRA_CAST(0x0); - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x80)) == 0) goto LAB_0075cd71; - do { - local_a2 = 0; - local_dc = GHIDRA_CAST(local_b0->_playerType); - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(pvVar10) + iVar13)),pbVar14); - if (layer->_layerData == (void *)0x0) { - tmpPath._capacity = 0xf; - tmpPath._size = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((tmpPath._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20)); - } - cleanupFlags = cleanupFlags | 1; - local_8 = 0; - costume_path_apply_skin_color(&skinPath,&tmpPath,-1,GHIDRA_INT(local_dc),GHIDRA_CAST(0x0),&local_a2); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); - if (0xf < tmpPath._capacity) { - uVar6 = tmpPath._capacity + 1; - pcVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpPath._buf))) + 0x0))); - if (0xfff < uVar6) { - pcVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + -4)); - uVar6 = tmpPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar15))))) goto LAB_0075cfcd; - } - operator_delete(pcVar15,uVar6); - } - tmpPath._size = 0; - tmpPath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) & 0xffffff00; - Sprite::ReplaceSpritesheet - (GHIDRA_CAST((GHIDRA_INT(costumeDescs->_begin) + iVar13)),GHIDRA_INT(pbVar14),&skinPath); - if ((local_a2 == 0) && (local_a9 != '\0')) { - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(costumeDescs->_begin) + iVar13)),pbVar14); - fVar3 = fRam00c5d09c; - fVar2 = fRam00c5d098; - fVar8 = fRam00c5d094; - layerColor = &layer->_color; - if (layerColor != GHIDRA_CAST(&DAT_00c5d090)) { - layerColor->_tint[0] = _DAT_00c5d090; - (layer->_color)._tint[1] = fVar8; - (layer->_color)._tint[2] = fVar2; - (layer->_color)._tint[3] = fVar3; - fVar3 = fRam00c5d0ac; - fVar2 = fRam00c5d0a8; - fVar8 = fRam00c5d0a4; - (layer->_color)._colorize[0] = _DAT_00c5d0a0; - (layer->_color)._colorize[1] = fVar8; - (layer->_color)._colorize[2] = fVar2; - (layer->_color)._colorize[3] = fVar3; - *GHIDRA_CAST((layer->_color)._offset) = DAT_00c5d0b0; - fVar8 = DAT_00c5d0b8; - goto LAB_0075cd12; - } - } - else { - local_80 = 0; - uStack_7c = 0; - local_78 = 0.0; - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(costumeDescs->_begin) + iVar13)),pbVar14); - layerColor = &layer->_color; - if (layerColor != GHIDRA_CAST(local_a0)) { - layerColor->_tint[0] = 1.0; - (layer->_color)._tint[1] = 1.0; - (layer->_color)._tint[2] = 1.0; - (layer->_color)._tint[3] = 1.0; - (layer->_color)._colorize[0] = 0.0; - (layer->_color)._colorize[1] = 0.0; - (layer->_color)._colorize[2] = 0.0; - (layer->_color)._colorize[3] = 0.0; - *GHIDRA_CAST((layer->_color)._offset) = CONCAT44(uStack_7c,local_80); - fVar8 = local_78; -LAB_0075cd12: - layerColor->_offset[2] = fVar8; - } - } - local_8 = 0xffffffff; - if (0xf < skinPath._capacity) { - uVar6 = skinPath._capacity + 1; - pvVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)skinPath._buf)) + 0x0))); - if (0xfff < uVar6) { - pvVar10 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(skinPath._buf)) + 0x0))) + -4); - uVar6 = skinPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(skinPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar10))))) goto LAB_0075cfcd; - } - operator_delete(pvVar10,uVar6); - } - pbVar14 = pbVar14 + 1; - pvVar10 = costumeDescs->_begin; - } while (pbVar14 < *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar13 + 0x80))); - puVar9 = local_a8; - } - playerAlias = local_b0; - *GHIDRA_CAST((GHIDRA_CAST(costumeDescs->_begin) + iVar13 + 0x124)) = puVar9; - *GHIDRA_CAST((GHIDRA_INT((local_b0->_costumeSpriteDescs)._begin) + iVar13 + 300)) = local_b0->_playerType; - costumeSprite = GHIDRA_CAST((GHIDRA_INT((local_b0->_costumeSpriteDescs)._begin) + iVar13)); - ANM2::LoadGraphics(costumeSprite,(uint8_t)costumeSprite); - if ((local_bc != GHIDRA_CAST(0x0)) && (*local_bc != 0)) { - pvVar10 = (playerAlias->_costumeSpriteDescs)._begin; - if (local_b1 == 0) { - costumeSprite = GHIDRA_CAST((iVar13 + GHIDRA_INT(pvVar10))); - bVar4 = ANM2::SetAnimation(costumeSprite,local_bc,1); - if (((bVar4 != 0) && ((costumeSprite->_animState)._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&costumeSprite->_animState,(float)GHIDRA_INT(local_e4)), - (costumeSprite->_animState)._animData != (void *)0x0)) { - (costumeSprite->_animState)._isPlaying = 0; - } - } - else { - costumeSprite = GHIDRA_CAST((GHIDRA_INT(pvVar10) + iVar13)); - pbVar14 = (costumeSprite->_animState)._animData; - if (pbVar14 == GHIDRA_CAST(0x0)) { -LAB_0075cd95: - bVar4 = ANM2::SetAnimation(costumeSprite,local_bc,1); - if (bVar4 != 0) { - AnimationState::Rewind(&costumeSprite->_animState); - (costumeSprite->_animState)._isPlaying = 1; - } - } - else { - pbVar7 = pbVar14; - expectedAnimName = local_bc; - if (0xf < *GHIDRA_CAST((pbVar14 + 0x14))) { - pbVar7 = *GHIDRA_CAST(pbVar14); - } - do { - bVar4 = *pbVar7; - isNameLess = bVar4 < *expectedAnimName; - if (bVar4 != *expectedAnimName) { -LAB_0075cd7c: - uVar6 = -GHIDRA_UINT(isNameLess) | 1; - goto LAB_0075cd81; - } - if (bVar4 == 0) break; - bVar4 = pbVar7[1]; - isNameLess = bVar4 < expectedAnimName[1]; - if (bVar4 != expectedAnimName[1]) goto LAB_0075cd7c; - pbVar7 = pbVar7 + 2; - expectedAnimName = expectedAnimName + 2; - } while (bVar4 != 0); - uVar6 = 0; -LAB_0075cd81: - if ((uVar6 != 0) || ((pbVar14[0x34] != 0 && ((costumeSprite->_animState)._isPlaying == 0)))) - goto LAB_0075cd95; - } - playerAlias = local_b0; - } - } -LAB_0075cdb5: - puVar9 = bodyColor; - local_cc = GHIDRA_CAST((GHIDRA_INT(local_cc) + 1)); - if (0xe < local_cc) goto code_r0x0075cdcb; - goto LAB_0075c6e0; -code_r0x0075cdcb: - puVar12 = GHIDRA_CAST(playerAlias->_headColor); - if ((puVar12 != headColor) || (GHIDRA_CAST(playerAlias->_bodyColor) != bodyColor)) { - if ((g_game->_challenge == 0x2a) && (playerAlias->_playerType == 0x23)) { - uVar6 = 0; - do { - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) = msvc::_Allocate(0x40); - tmpPath._size = 0x3c; - tmpPath._capacity = 0x3f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpPath._buf))) + 0x0))), - "gfx/characters/costumes/character_016b_theforgotten_bomb.png",0x3d); - local_8 = 7; - (GHIDRA_CAST((GHIDRA_CAST(&playerAlias->_sprite))))->Sprite::ReplaceSpritesheet(uVar6,&tmpPath); - local_8 = 0xffffffff; - bVar4 = extraout_CL; - if (0xf < tmpPath._capacity) { - size = tmpPath._capacity + 1; - pcVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpPath._buf))) + 0x0))); - if (0xfff < size) { - pcVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + -4)); - size = tmpPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar15))))) - goto LAB_0075d0d4; - } - operator_delete(pcVar15,size); - bVar4 = extraout_CL_00; - } - uVar6 = uVar6 + 1; - } while (uVar6 < 0xf); - ANM2::LoadGraphics(&playerAlias->_sprite,bVar4); - playerAlias = local_b0; - } - else { - if (*GHIDRA_CAST((GHIDRA_CAST(playerConfig) + 0x2c)) != 0) { - headSheetPath._size = 0; - headSheetPath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath._buf)) + 0x0))) = (void *)0x0; - bodySheetPath._size = 0; - bodySheetPath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath._buf)) + 0x0))) = (void *)0x0; - local_8 = 9; - if (puVar12 != headColor) { - headSkinPath = costume_path_apply_skin_color - (&skinPath,(void *)(GHIDRA_INT(playerConfig) + 0x1c),GHIDRA_INT(headColor),-1, - GHIDRA_CAST(0x0),GHIDRA_CAST(0x0)); - puVar12 = GHIDRA_CAST(&headSheetPath); - if (puVar12 != headSkinPath) { - (*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath._buf)) + 0x0))) = *headSkinPath; - (*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath._buf)) + 0x4))) = headSkinPath[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath._buf)) + 0x8))) = headSkinPath[2]; - (*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath._buf)) + 0xc))) = headSkinPath[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath)) + 0x10))) = *GHIDRA_CAST((headSkinPath + 4)); - headSkinPath[4] = 0; - headSkinPath[5] = 0xf; - *GHIDRA_CAST(headSkinPath) = 0; - } - if (0xf < skinPath._capacity) { - uVar6 = skinPath._capacity + 1; - pvVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)skinPath._buf)) + 0x0))); - if (0xfff < uVar6) { - pvVar10 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(skinPath._buf)) + 0x0))) + -4); - uVar6 = skinPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(skinPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar10))))) { -LAB_0075cfcd: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar10,uVar6); - puVar12 = extraout_ECX; - } - } - if (GHIDRA_CAST(playerAlias->_bodyColor) != puVar9) { - puVar9 = costume_path_apply_skin_color - (bodySkinPathTmp,(void *)(GHIDRA_INT(playerConfig) + 0x1c),GHIDRA_INT(puVar9),-1, - GHIDRA_CAST(0x0),GHIDRA_CAST(0x0)); - if (&bodySheetPath != GHIDRA_CAST(puVar9)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath._buf)) + 0x0))) = *puVar9; - (*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath._buf)) + 0x4))) = puVar9[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath._buf)) + 0x8))) = puVar9[2]; - (*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath._buf)) + 0xc))) = puVar9[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath)) + 0x10))) = *GHIDRA_CAST((puVar9 + 4)); - puVar9[4] = 0; - puVar9[5] = 0xf; - *GHIDRA_CAST(puVar9) = 0; - } - (GHIDRA_CAST((bodySkinPathTmp)))->msvc::string::_Tidy_deallocate(); - puVar12 = extraout_ECX_00; - } - uVar6 = 0; - do { - if (uVar6 != 0xd) { - if (((uVar6 == 0) || (3 < uVar6)) && (uVar6 != 0xb)) { - puVar12 = GHIDRA_CAST(0x0); - } - else { - puVar12 = GHIDRA_CAST(0x1); - } - pngFilename = &bodySheetPath; - if ((char)puVar12 == '\0') { - pngFilename = &headSheetPath; - } - if (pngFilename->_size != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&playerAlias->_sprite))))->Sprite::ReplaceSpritesheet(uVar6,pngFilename); - puVar12 = extraout_ECX_01; - } - } - uVar6 = uVar6 + 1; - } while (uVar6 < 0xf); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),8); - if (0xf < bodySheetPath._capacity) { - uVar6 = bodySheetPath._capacity + 1; - pvVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)bodySheetPath._buf)) + 0x0))); - if (0xfff < uVar6) { - pvVar10 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath._buf)) + 0x0))) + -4); - uVar6 = bodySheetPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(bodySheetPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar10))))) goto LAB_0075d0d4; - } - operator_delete(pvVar10,uVar6); - puVar12 = extraout_ECX_02; - } - local_8 = 0xffffffff; - if (0xf < headSheetPath._capacity) { - uVar6 = headSheetPath._capacity + 1; - pvVar10 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)headSheetPath._buf)) + 0x0))); - if (0xfff < uVar6) { - pvVar10 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath._buf)) + 0x0))) + -4); - uVar6 = headSheetPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(headSheetPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar10))))) { -LAB_0075d0d4: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar10,uVar6); - puVar12 = extraout_ECX_03; - } - } - ANM2::LoadGraphics(&playerAlias->_sprite,(uint8_t)puVar12); - } - playerAlias->_headColor = GHIDRA_INT(headColor); - playerAlias->_bodyColor = GHIDRA_INT(bodyColor); - } - pbVar14 = &playerAlias->_playerCostumeMap[0]._isBodyLayer; - local_cc = GHIDRA_CAST(0xf); - do { - if (-1 < (GHIDRA_CAST((pbVar14 + -0xc)))->_index) { - costumeSprite = - GHIDRA_CAST(((GHIDRA_CAST((pbVar14 + -0xc)))->_index * 0x130 + - GHIDRA_INT(costumeDescs->_begin))); - if (*pbVar14 == 0) { - pcVar15 = "HeadDown"; - } - else { - pcVar15 = "WalkDown"; - } - bVar4 = ANM2::SetAnimation(costumeSprite,GHIDRA_CAST(pcVar15),1); - if (((bVar4 != 0) && ((costumeSprite->_animState)._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&costumeSprite->_animState,0.0), - (costumeSprite->_animState)._animData != (void *)0x0)) { - (costumeSprite->_animState)._isPlaying = 0; - } - pvVar10 = ANM2::GetAnimationData(costumeSprite,GHIDRA_CAST("SubAnim")); - if (pvVar10 != (void *)0x0) { - ANM2::PlayOverlay(costumeSprite,GHIDRA_CAST("SubAnim"),0); - } - } - pbVar14 = pbVar14 + 0x10; - local_cc = GHIDRA_CAST((GHIDRA_INT(local_cc) + -1)); - } while (local_cc != GHIDRA_CAST(0x0)); - if (local_b0->_isCoopGhost != 0) { - reset_body_sprite(local_b0); - } - DAT_00c81148 = '\0'; - ExceptionList = local_10; - return; -} - -// 0075d1d0 -void Entity_Player::AddCostume(ItemConfig_Item *collectibleID, uint8_t itemStateOnly) -{ - void **ppvVar1; - uint8_t bVar2; - int iVar3; - int *piVar4; - void *pvVar5; - LayerState *layer; - uint8_t *layerName; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint32_t uVar6; - uint8_t *costumeMapEntry; - uint8_t *layerId; - uint32_t local_184; - ANM2 *local_180; - ItemConfig_Item *costumeItem; - char isHasHeadLayer; - char isHasBodyLayer; - ANM2 newCostume; - ItemConfig_Item *local_60; - uint32_t local_5c; - uint32_t local_58; - uint32_t local_54; - uint32_t local_50; - uint16_t local_4c; - uint32_t local_48; - void *duplicateItemName [5]; - uint32_t uStack_30; - void *itemName [4]; - uint32_t uStack_1c; - uint32_t uStack_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - void *local_8; - ANM2 *costumeSprite; - void *edenHairBegin; - bool isDuplicate; - Manager *manager; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00afef40; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((itemName + 10)); - ExceptionList = &local_10; - costumeItem = collectibleID; - if (((this->_variant != 1) && (collectibleID != GHIDRA_CAST(0x0))) && - (this->_isCoopGhost == 0)) { - if (collectibleID->type == 1) { - if ((collectibleID->id == 0x76) && (iVar3 = GetCollectibleNum(this,0x76,0), 1 < iVar3)) { - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) >> 2 < 0x2e) { - collectibleID = GHIDRA_CAST(0x0); - } - else { - collectibleID = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xb4)); - } - costumeItem = collectibleID; - } - if (collectibleID->type == 1) { - if ((collectibleID->id == 0x299) && (iVar3 = GetCollectibleNum(this,0x299,0), 1 < iVar3)) { - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) >> 2 < 0x7e) { - collectibleID = GHIDRA_CAST(0x0); - } - else { - collectibleID = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 500)); - } - costumeItem = collectibleID; - } - if (((collectibleID->type == 1) && (collectibleID->id == 0x2da)) && - (iVar3 = GetCollectibleNum(this,0x2da,0), 1 < iVar3)) { - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) >> 2 < 0x7f) { - collectibleID = GHIDRA_CAST(0x0); - } - else { - collectibleID = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1f8)); - } - costumeItem = collectibleID; - } - } - } - if (((collectibleID->type == 0) && (collectibleID->id == 0x37)) && - (bVar2 = HasCollectible(this,0x14,0), bVar2 != 0)) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x84,1,1); - } - if ((collectibleID->costume).anm2Path._size != 0) { - if (((this->_valid != 0) && (bVar2 = (GHIDRA_CAST((collectibleID)))->Item::HasTags(0x40000000), bVar2 != 0)) && - (this->_backupPlayer != GHIDRA_CAST(0x0))) { - AddCostume(this->_backupPlayer,collectibleID,itemStateOnly); - } - if ((g_game->_challenge != 0x1e) || - ((bVar2 = (GHIDRA_CAST((collectibleID)))->Item::IsCollectible(), bVar2 != 0 && (collectibleID->id == 0xb8)))) - { - pvVar5 = (this->_costumeSpriteDescs)._begin; - isDuplicate = false; - if (pvVar5 != (this->_costumeSpriteDescs)._end) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x114)) == collectibleID) { - piVar4 = GHIDRA_CAST(std)::vector::erase(&local_184,pvVar5); - isDuplicate = true; - pvVar5 = (void *)*piVar4; - } - else { - pvVar5 = (void *)(GHIDRA_INT(pvVar5) + 0x130); - } - } while (pvVar5 != (this->_costumeSpriteDescs)._end); - if (isDuplicate) { - ItemConfig_Item::GetLocalizedName(collectibleID,GHIDRA_CAST(duplicateItemName),0); - local_8 = (void *)0x0; - KAGE_LogMessage(1,(uint8_t *) - "Adding costume for %d (%s) which was added before and never removed.\n" - ); - local_8 = (void *)0xffffffff; - if (0xf < uStack_30) { - uVar6 = uStack_30 + 1; - pvVar5 = duplicateItemName[0]; - if (0xfff < uVar6) { - pvVar5 = *(void **)(GHIDRA_INT(duplicateItemName[0]) + -4); - uVar6 = uStack_30 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(duplicateItemName[0]) + (-4 - GHIDRA_INT(pvVar5))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar5,uVar6); - } - } - } - ANM2::constructor(&newCostume); - local_5c = 0; - local_58 = 0; - local_54 = 0; - local_50 = 0; - local_4c = 0; - local_48 = 0xffffffff; - local_8 = (void *)0x1; - pvVar5 = (this->_costumeSpriteDescs)._end; - local_60 = collectibleID; - if (pvVar5 == (this->_costumeSpriteDescs)._capacity) { - FUN_007dd940(pvVar5,&newCostume); - } - else { - FUN_007dd8a0(); - ppvVar1 = &(this->_costumeSpriteDescs)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x130); - } - local_8 = (void *)0x2; - ANM2::Reset(&newCostume); - AnimationState::~AnimationState(&newCostume._overlayAnimState); - AnimationState::~AnimationState(&newCostume._animState); - (GHIDRA_CAST((newCostume._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&newCostume))))->msvc::string::_Tidy_deallocate(); - local_8 = (void *)0xffffffff; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0x18)) = (collectibleID->costume).priority; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0x13)) = (collectibleID->costume).isFlying - ; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0x12)) = - (collectibleID->costume).hasOverlay; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0x10)) = (collectibleID->costume).skinColor - ; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0xc)) = (collectibleID->costume).skinColor; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0x11)) = - (collectibleID->costume).hasSkinAlt; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -8)) = - (collectibleID->costume).overwriteColor; - *GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -7)) = itemStateOnly; - if (((g_game->_dailyChallenge)._specialDailyId == 0xd) && - ((((iVar3 = collectibleID->type, iVar3 == 1 || (iVar3 == 3)) || (iVar3 == 4)) && - (collectibleID->id == 0x1a8)))) { - piVar4 = GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0x18)); - *piVar4 = *piVar4 + 3; - } - local_180 = GHIDRA_CAST((GHIDRA_INT((this->_costumeSpriteDescs)._end) + -0x130)); - ANM2::Load(local_180,&(collectibleID->costume).anm2Path,0); - manager = g_manager; - bVar2 = extraout_CL; - if ((collectibleID->type == 0) && - ((collectibleID->id == 0xc || (collectibleID->id == 0x58)))) { - local_184 = this->_initSeed; - pvVar5 = (g_manager->_entityConfig)._edenHair._end; - if ((g_manager->_entityConfig)._edenHair._begin == pvVar5) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Eden has no hair!\n")); - pvVar5 = (manager->_entityConfig)._edenHair._end; - } - edenHairBegin = (manager->_entityConfig)._edenHair._begin; - Sprite::ReplaceSpritesheet - (GHIDRA_CAST(local_180),0, - (std_string *) - (GHIDRA_INT(edenHairBegin) + - (local_184 % GHIDRA_UINT(((GHIDRA_INT(pvVar5) - GHIDRA_INT(edenHairBegin)) / 0x18))) * 0x18)); - bVar2 = extraout_CL_00; - } - costumeSprite = local_180; - ANM2::LoadGraphics(local_180,bVar2); - local_180 = &this->_sprite; - isHasHeadLayer = '\0'; - costumeMapEntry = &this->_playerCostumeMap[0]._isBodyLayer; - isHasBodyLayer = '\0'; - layerId = GHIDRA_CAST(0x0); - do { - layer = ANM2::GetLayer(local_180,layerId); - pvVar5 = layer->_layerData; - if (pvVar5 == (void *)0x0) { - layerName = &s_empty; - } - else { - layerName = GHIDRA_CAST((GHIDRA_INT(pvVar5) + 8)); - if (0xf < *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1c))) { - layerName = *GHIDRA_CAST(layerName); - } - } - layer = ANM2::GetLayer(costumeSprite,layerName); - if (layer != GHIDRA_CAST(0x0)) { - if (*costumeMapEntry == 0) { - isHasHeadLayer = '\x01'; - } - else { - isHasBodyLayer = '\x01'; - } - } - layerId = layerId + 1; - costumeMapEntry = costumeMapEntry + 0x10; - } while (layerId < &DAT_0000000f); - if (isHasHeadLayer == '\0') { - if (isHasBodyLayer == '\0') { - ItemConfig_Item::GetLocalizedName(costumeItem,GHIDRA_CAST(itemName),0); - local_8 = (void *)0x3; - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Costume for item %d (%s) has no layers!\n")); - local_8 = (void *)0xffffffff; - if (0xf < uStack_18) { - uVar6 = uStack_18 + 1; - pvVar5 = itemName[0]; - if (0xfff < uVar6) { - pvVar5 = *(void **)(GHIDRA_INT(itemName[0]) + -4); - uVar6 = uStack_18 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(itemName[0]) + (-4 - GHIDRA_INT(pvVar5))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar5,uVar6); - } - uStack_1c = 0; - uStack_18 = 0xf; - itemName[0] = (void *)(GHIDRA_UINT(itemName[0]) & 0xffffff00); - } - } - else if (isHasBodyLayer != '\0') { - pvVar5 = (this->_costumeSpriteDescs)._end; - if (pvVar5 == (this->_costumeSpriteDescs)._capacity) { - FUN_007ddac0(pvVar5,GHIDRA_INT(pvVar5) + -0x130); - } - else { - FUN_007de0e0(GHIDRA_INT(pvVar5) + -0x130); - ppvVar1 = &(this->_costumeSpriteDescs)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x130); - } - } - UpdateCostumes(this); - } - } - } - ExceptionList = local_10; - return; -} - -// 0075d800 -void Entity_Player::AddNullCostume(int costumeid) -{ - void *nullItemsBegin; - - if ((costumeid < 0) || - (nullItemsBegin = (g_manager->_itemConfig)._nullItems._begin, - GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItemsBegin) >> 2 <= costumeid)) { - AddCostume(this,GHIDRA_CAST(0x0),0); - return; - } - AddCostume(this,*GHIDRA_CAST((GHIDRA_CAST(nullItemsBegin) + costumeid * 4)),0); - return; -} - -// 0075d850 -void Entity_Player::RemoveCostume(ItemConfig_Item *Item) -{ - uint8_t isHasTag; - int *nextCostumeIt; - void *costumeIt; - Entity_Player *local_c [2]; - bool isRemoved; - - if (((Item != GHIDRA_CAST(0x0)) && (this->_variant != 1)) && - ((Item->costume).anm2Path._size != 0)) { - local_c[0] = this; - if (this->_valid != 0) { - isHasTag = ::(GHIDRA_CAST((Item)))->Item::HasTags(0x40000000); - if ((isHasTag != 0) && (this->_backupPlayer != GHIDRA_CAST(0x0))) { - RemoveCostume(this->_backupPlayer,Item); - } - } - costumeIt = (this->_costumeSpriteDescs)._begin; - isRemoved = false; - if (costumeIt != (this->_costumeSpriteDescs)._end) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(costumeIt) + 0x114)) == Item) { - nextCostumeIt = GHIDRA_CAST(std)::vector::erase(local_c,costumeIt); - isRemoved = true; - costumeIt = (void *)*nextCostumeIt; - } - else { - costumeIt = (void *)(GHIDRA_INT(costumeIt) + 0x130); - } - } while (costumeIt != (this->_costumeSpriteDescs)._end); - if (isRemoved) { - UpdateCostumes(this); - } - } - } - return; -} - -// 0075d980 -uint8_t Entity_Player::IsNullItemCostumeVisible(int nullItemID, int playerSpriteLayerID) -{ - uint8_t isVisible; - void *nullItems; - - if ((nullItemID < 0) || - (nullItems = (g_manager->_itemConfig)._nullItems._begin, - GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItems) >> 2 <= nullItemID)) { - isVisible = IsItemCostumeVisible(this,GHIDRA_CAST(0x0),playerSpriteLayerID); - return isVisible; - } - isVisible = IsItemCostumeVisible - (this,*GHIDRA_CAST((GHIDRA_CAST(nullItems) + nullItemID * 4)), - playerSpriteLayerID); - return isVisible; -} - -// 0075dfe0 -void Entity_Player::ClearCostumes() -{ - uint32_t layer; - uint8_t bVar1; - int *costumeMapLayerId; - - FUN_007ddf80(this); - (this->_costumeSpriteDescs)._end = (this->_costumeSpriteDescs)._begin; - layer = 0; - costumeMapLayerId = &this->_playerCostumeMap[0]._layerID; - do { - (GHIDRA_CAST((costumeMapLayerId + -1)))->_index = -1; - *costumeMapLayerId = -1; - costumeMapLayerId[1] = 0; - if (((layer == 0) || (3 < layer)) && (layer != 0xb)) { - bVar1 = 0; - } - else { - bVar1 = 1; - } - *GHIDRA_CAST((costumeMapLayerId + 2)) = bVar1; - layer = layer + 1; - costumeMapLayerId = costumeMapLayerId + 4; - } while (layer < 0xf); - return; -} - -// 0075e190 -void Entity_Player::ClearQueueItem() -{ - uint8_t isHoldingItem; - - isHoldingItem = IsHoldingItem(this); - if (isHoldingItem != 0) { - ANM2::Reset(&this->_heldSprite); - } - (this->_queuedItem)._item = (void *)0x0; - (this->_queuedItem)._charge = 0; - (this->_queuedItem)._flags = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x17d0)))) = 0; - return; -} - -// 0075e1d0 -uint8_t Entity_Player::FlushQueueItem() -{ - int unk; - int charge; - int vardata; - uint32_t trinketId; - uint32_t uVar1; - int iVar2; - uint32_t type; - uint8_t queueFlags; - RNG dailyRng; - int *itemConfig; - void *room; - - if ((this->_queuedItem)._item == (void *)0x0) { - try_trigger_astral_projection(this); - return 0; - } - KAGE_LogMessage(1,GHIDRA_CAST("item queue flush\n")); - itemConfig = (this->_queuedItem)._item; - charge = (this->_queuedItem)._charge; - uVar1 = *GHIDRA_CAST(&(this->_queuedItem)._flags); - vardata = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x17d0)))); - unk = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x17d4)))); - (this->_queuedItem)._item = (void *)0x0; - (this->_queuedItem)._charge = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x17d0)))) = 0; - iVar2 = *itemConfig; - queueFlags = (uint8_t)uVar1; - if (((iVar2 == 1) || (iVar2 == 3)) || (iVar2 == 4)) { - iVar2 = itemConfig[1]; - if ((g_game->_dailyChallenge)._specialDailyId == 7) { - room = g_game->_room; - dailyRng._shift1 = 1; - dailyRng._shift2 = 5; - dailyRng._shift3 = 0x10; - dailyRng._seed = iVar2; - uVar1 = (GHIDRA_CAST((&dailyRng)))->RNG::Next(); - iVar2 = ItemPool::GetSeededCollectible(uVar1,0,*GHIDRA_CAST((GHIDRA_CAST(room) + 4))); - } - AddCollectible(this,iVar2,charge,~queueFlags & 1,0,vardata,unk); - } - else if (iVar2 == 2) { - trinketId = itemConfig[1]; - if ((g_game->_dailyChallenge)._specialDailyId == 7) { - trinketId = ItemPool::GetTrinket(&g_game->_itemPool,0); - } - type = trinketId | 0x8000; - if ((uVar1 & 2) == 0) { - type = trinketId; - } - AddTrinket(this,type,queueFlags & 1 ^ 1); - try_trigger_astral_projection(this); - return 1; - } - try_trigger_astral_projection(this); - return 1; -} - -// 0075e320 -void Entity_Player::IncrementPlayerFormCounter(int ePlayerForm, int num) -{ - uint8_t bVar1; - Vector *position; - int iVar2; - int charge; - ItemConfig_Item *Item; - char isFormActive; - int iVar3; - uint8_t *formName; - uint32_t uVar4; - Manager *manager; - int *activeVarData; - HUD *messageSlot; - bool bVar5; - uint32_t slot; - uint8_t bVar6; - uint8_t bVar7; - char isFormActiveBefore; - Manager *sfxOwner; - Vector local_18; - Vector local_10; - bool isPrevFound; - void *playerFormConfigs; - - if ((((this->_hasCurseMistEffect == 0) && (this->_isCoopGhost == 0)) && (GHIDRA_UINT(ePlayerForm) < 0x10) - ) && (2 < this->_playerForms[ePlayerForm])) { - isFormActiveBefore = '\x01'; - } - else { - isFormActiveBefore = '\0'; - } - iVar3 = this->_playerForms[ePlayerForm] + num; - iVar2 = 0; - if (0 < iVar3) { - iVar2 = iVar3; - } - this->_playerForms[ePlayerForm] = iVar2; - if (ePlayerForm == 0xf) { - this->_playerForms[0xf] = 0; - bVar1 = HasCollectible(this,0x23,0); - if (bVar1 != 0) { - this->_playerForms[0xf] = this->_playerForms[0xf] + 1; - } - bVar1 = HasCollectible(this,0x106,0); - if (bVar1 != 0) { - this->_playerForms[0xf] = this->_playerForms[0xf] + 1; - } - bVar1 = HasTrinket(this,0x30,0); - if (bVar1 != 0) { - this->_playerForms[0xf] = this->_playerForms[0xf] + 1; - } - } - if (((this->_hasCurseMistEffect == 0) && (this->_isCoopGhost == 0)) && - ((GHIDRA_UINT(ePlayerForm) < 0x10 && (2 < this->_playerForms[ePlayerForm])))) { - isFormActive = '\x01'; - } - else { - isFormActive = '\0'; - } - if (isFormActiveBefore == isFormActive) { - return; - } - if (isFormActive != '\0') { - Player_stats_add(&g_game->_onlinePlayerStats,10,this,1.0); - } - manager = g_manager; - sfxOwner = g_manager; - if ((ePlayerForm < 0) || - (playerFormConfigs = (g_manager->_itemConfig)._playerForms._begin, - GHIDRA_INT((g_manager->_itemConfig)._playerForms._end) - GHIDRA_INT(playerFormConfigs) >> 2 <= ePlayerForm)) - { - local_10.x = 0.0; - } - else { - local_10.x = *GHIDRA_CAST((GHIDRA_CAST(playerFormConfigs) + ePlayerForm * 4)); - if (local_10.x != 0.0) { - this->_cacheFlags = this->_cacheFlags | *GHIDRA_CAST((GHIDRA_CAST(local_10.x) + 0x2c)); - } - } - switch(ePlayerForm) { - case 0: - if (isFormActive == '\0') break; - PersistentGameData::TryUnlock(&manager->_persistentGameData,0x41); - goto LAB_0075e806; - case 1: - if (isFormActive != '\0') { - PersistentGameData::TryUnlock(&manager->_persistentGameData,0xb2); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x160); - goto LAB_0075e806; - } - break; - case 2: - if (isFormActive == '\0') break; - bVar5 = (this->_playerFormsRewarded & 4) == 0; - goto LAB_0075e541; - case 3: - if (isFormActive != '\0') { - if ((this->_playerFormsRewarded & 8) == 0) { - AddSoulHearts(this,6,0); - } - goto LAB_0075e806; - } - break; - default: - goto switchD_0075e474_caseD_4; - case 5: - if (isFormActive != '\0') { - if ((this->_playerFormsRewarded & 0x20) == 0) { - uVar4 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_collectibleRNGs)._begin) + 0xd0)))))->RNG::Next(); - position = Room::FindFreePickupSpawnPosition(g_game->_room,&local_18,&this->_pos,40.0,0,0,0) - ; - Game::SpawnEx(g_game,5,0x46,position,&g_vectorZero,GHIDRA_CAST(this),0,uVar4,0); - } - goto LAB_0075e806; - } - break; - case 8: - if (isFormActive != '\0') { - if ((this->_playerFormsRewarded & 0x100U) == 0) { - AddBlackHearts(this,4); - } - goto LAB_0075e806; - } - break; - case 0xb: - if (isFormActive == '\0') break; - bVar5 = (this->_playerFormsRewarded & 0x800U) == 0; -LAB_0075e541: - if (bVar5) { - AddMaxHearts(this,2,0); - AddHearts(this,2,0,0); - } -LAB_0075e806: - AddPlayerFormCostume(this,ePlayerForm); - if (local_10.x != 0.0) { - formName = GHIDRA_CAST((GHIDRA_INT(local_10.x) + 0x10)); - messageSlot = &g_game->_hud; - if (0xf < *GHIDRA_CAST((GHIDRA_CAST(local_10.x) + 0x24))) { - formName = *GHIDRA_CAST(formName); - } - formName = string_table_translate(&g_manager->_stringTable,formName); - uVar4 = 0; - do { - if ((*GHIDRA_CAST((GHIDRA_CAST((messageSlot)) + 0x3ed8))) == '\0') { - HUD_Message::Show(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((messageSlot)) + 0x3ed0)))),formName,&s_empty,1,0); - break; - } - uVar4 = uVar4 + 1; - messageSlot = GHIDRA_CAST((messageSlot->_playerHUD + 500)); - } while (uVar4 < 6); - } - manager = g_manager; - local_10.x = 1.84971e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_10)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10.x),1.0,2,0,1.0,0.0); - uVar4 = Random(); - local_10.x = (this->_pos).x + 0.0; - local_10.y = (this->_pos).y + 5.0; - Game::SpawnEx(g_game,1000,0xf,&local_10,&g_vectorZero,GHIDRA_CAST(this),2,uVar4,0); - this->_playerForms[(GHIDRA_UINT(ePlayerForm) >> 5) + 0x10] = - this->_playerForms[(GHIDRA_UINT(ePlayerForm) >> 5) + 0x10] | 1 << ((uint8_t)ePlayerForm & 0x1f); - return; - case 0xf: - bVar5 = false; - activeVarData = &this->_activeDesc[0]._varData; - isPrevFound = false; - uVar4 = 0; - do { - if ((GHIDRA_CAST((activeVarData + -7)))->_item == 0x23) { - if (bVar5) { - *activeVarData = 0; - bVar5 = isPrevFound; - } - else { - bVar5 = isPrevFound; - if (*activeVarData == 1) { - if ((this->_playerFormsRewarded & 0x8000U) == 0) { - bVar7 = 1; - bVar6 = 0; - bVar1 = 0; - slot = uVar4; - iVar2 = GetActiveMaxCharge(this,uVar4); - AddActiveCharge(this,iVar2,slot,bVar1,bVar6,bVar7); - sfxOwner = g_manager; - } - if (isFormActive != '\0') { - local_18.x = 1.46996e-42; - seed_fart_sound_override(GHIDRA_CAST(&local_18)); - (GHIDRA_CAST((&sfxOwner->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18.x),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(0x2f,3,GHIDRA_CAST(0x0)); - sfxOwner = g_manager; - } - bVar5 = true; - } - } - local_18.x = 1.46996e-42; - seed_fart_sound_override(GHIDRA_CAST(&local_18)); - (GHIDRA_CAST((&sfxOwner->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18.x),1.0,2,0,1.0,0.0); - HUD::InvalidateActiveItem(&g_game->_hud,this,uVar4); - sfxOwner = g_manager; - manager = g_manager; - isPrevFound = bVar5; - } - uVar4 = uVar4 + 1; - activeVarData = activeVarData + 8; - } while (uVar4 < 4); - if (!bVar5) { - if (isFormActive != '\0') { - iVar2 = GetActiveItemSlot(this,0x23); - if (-1 < iVar2) { - if (((this->_playerFormsRewarded & 0x8000U) == 0) || - ((this->_activeDesc[iVar2]._varData == 1 && - (iVar3 = GetActiveItem(this,iVar2), 0 < iVar3)))) { - iVar3 = 1; - } - else { - iVar3 = 0; - } - this->_activeDesc[iVar2]._varData = iVar3; - if ((this->_playerFormsRewarded & 0x8000U) == 0) { - bVar7 = 1; - bVar6 = 0; - bVar1 = 0; - iVar3 = iVar2; - charge = GetActiveMaxCharge(this,iVar2); - AddActiveCharge(this,charge,iVar3,bVar1,bVar6,bVar7); - sfxOwner = g_manager; - } - HUD::InvalidateActiveItem(&g_game->_hud,this,iVar2); - local_18.x = 1.46996e-42; - seed_fart_sound_override(GHIDRA_CAST(&local_18)); - (GHIDRA_CAST((&sfxOwner->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18.x),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(0x2f,3,GHIDRA_CAST(0x0)); - } - goto LAB_0075e806; - } - break; - } -switchD_0075e474_caseD_4: - if (isFormActive == '\0') break; - goto LAB_0075e806; - } - if ((((-1 < ePlayerForm) && - (playerFormConfigs = (manager->_itemConfig)._playerForms._begin, - ePlayerForm < GHIDRA_INT((manager->_itemConfig)._playerForms._end) - GHIDRA_INT(playerFormConfigs) >> 2)) - && (iVar2 = *GHIDRA_CAST((GHIDRA_CAST(playerFormConfigs) + ePlayerForm * 4)), iVar2 != 0)) && - (iVar2 = *GHIDRA_CAST((iVar2 + 0x28)), iVar2 != -1)) { - Item = (GHIDRA_CAST((&manager->_itemConfig)))->Config::GetNullItem(iVar2); - RemoveCostume(this,Item); - } - return; -} - -// 0075e9a0 -void Entity_Player::AddPlayerFormCostume(int playerForm) -{ - void *pvVar1; - int iVar2; - - if (-1 < playerForm) { - pvVar1 = (g_manager->_itemConfig)._playerForms._begin; - if (((playerForm < GHIDRA_INT((g_manager->_itemConfig)._playerForms._end) - GHIDRA_INT(pvVar1) >> 2) && - (iVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + playerForm * 4)), iVar2 != 0)) && - (iVar2 = *GHIDRA_CAST((iVar2 + 0x28)), iVar2 != -1)) { - if ((-1 < iVar2) && - (pvVar1 = (g_manager->_itemConfig)._nullItems._begin, - iVar2 < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) >> 2)) { - AddCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + iVar2 * 4)),0); - return; - } - AddCostume(this,GHIDRA_CAST(0x0),0); - } - } - return; -} - -// 0075ea20 -void Entity_Player::SetItemState(int collectibleId) -{ - FlushQueueItem(this); - this->_itemState = collectibleId; - return; -} - -// 0075ea40 -void Entity_Player::render_charge_bars(Vector *renderPos) -{ - code *pcVar1; - uint8_t bVar2; - int bar; - void *effect; - ANM2 *chargeBar; - AnimationState *secondLayer; - void **weaponSlot2; - uint32_t uVar4; - void **weaponSlot; - long double fVar5; - float fVar6; - int visibleBars [6]; - int visibleBarCount; - float barOffsetY; - float barOffsetX; - uint8_t local_14 [8]; - float local_c; - float local_8; - int bar; - void *collectibles; - Manager *manager; - Entity_Player *twin; - - if ((g_manager->_optionsConfig)._enableChargeBars == 0) { - return; - } - if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && - (bVar2 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerIndex), - bVar2 == 0)) { - return; - } - manager = g_manager; - barOffsetY = (this->_playerSpriteScale).y; - visibleBarCount = 0; - barOffsetX = barOffsetY * 12.0; - barOffsetY = barOffsetY * -35.0; - if ((this->_itemState == 0x2c6) && (5 < this->_bagOfCraftingHoldFrames)) { - bar = GHIDRA_INT(((((float)this->_bagOfCraftingHoldFrames - 5.0) / 25.0) * 100.0)); - chargeBar = this->_chargeBarSprites; - } - else { - if (this->_playerType == 0x1b) { - effect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x2c0); - collectibles = (manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectibles) & 0xfffffffcU)) < - 0xb01) { - bar = 0; - } - else { - bar = *GHIDRA_CAST((GHIDRA_CAST(collectibles) + 0xb00)); - } - if (effect == (void *)0x0) { - fVar6 = 0.0; - } - else { - fVar6 = ((float)*GHIDRA_CAST((GHIDRA_CAST(effect) + 8)) * 100.0) / (float)*GHIDRA_CAST((bar + 0x78)); - } - FUN_0075ef20(this->_chargeBarSprites + 5,GHIDRA_INT(fVar6)); - } - bVar2 = HasCollectible(this,0x2c9,0); - if ((bVar2 != 0) && (this->_playerType == 0x1a)) { - FUN_0075ef20(this->_chargeBarSprites + 6, - GHIDRA_INT((((float)this->_eveSumptoriumCharge / 60.0) * 100.0))); - } - weaponSlot2 = this->_weapons + 1; - local_8 = 0.0; - weaponSlot = weaponSlot2; - do { - if (*weaponSlot != GHIDRA_CAST(0x0)) { - fVar5 = (long double)(**(code **)(*GHIDRA_CAST(*weaponSlot) + 0x1c))(); - local_c = (float)fVar5; - if (0.0 < local_c) { - bar = GHIDRA_INT((local_c * 100.0)); - goto LAB_0075ebfa; - } - } - local_8 = (float)(GHIDRA_INT(local_8) + 1); - weaponSlot = weaponSlot + 1; - } while (GHIDRA_UINT(local_8) < 4); - bar = 0; -LAB_0075ebfa: - FUN_0075ef20(this->_chargeBarSprites,bar); - uVar4 = 0; - do { - if (*weaponSlot2 != GHIDRA_CAST(0x0)) { - fVar5 = (long double)(**(code **)(*GHIDRA_CAST(*weaponSlot2) + 0x20))(); - local_c = (float)fVar5; - if (0.0 < local_c) { - bar = GHIDRA_INT((local_c * 100.0)); - goto LAB_0075ec3c; - } - } - uVar4 = uVar4 + 1; - weaponSlot2 = weaponSlot2 + 1; - } while (uVar4 < 4); - bar = 0; -LAB_0075ec3c: - FUN_0075ef20(this->_chargeBarSprites + 1,bar); - bVar2 = HasCollectible(this,399,0); - if (bVar2 != 0) { - fVar6 = ((float)this->_mawOfTheVoidChargeTimer * 100.0) / 150.0; - if (fVar6 <= 0.0) { - fVar6 = 0.0; - } - if (100.0 <= fVar6) { - fVar6 = 100.0; - } - bar = 0; - if (5 < GHIDRA_INT(fVar6)) { - bar = GHIDRA_INT(fVar6); - } - FUN_0075ef20(this->_chargeBarSprites + 2,bar); - } - bVar2 = HasCollectible(this,0x283,0); - if (bVar2 != 0) { - fVar6 = ((float)this->_revelationChargeTimer * 100.0) / 150.0; - if (fVar6 <= 0.0) { - fVar6 = 0.0; - } - if (100.0 <= fVar6) { - fVar6 = 100.0; - } - bar = 0; - if (5 < GHIDRA_INT(fVar6)) { - bar = GHIDRA_INT(fVar6); - } - FUN_0075ef20(this->_chargeBarSprites + 3,bar); - } - bVar2 = HasCollectible(this,0x2a8,0); - if (bVar2 == 0) goto LAB_0075ed54; - fVar6 = ((float)this->_montezumaChargeTimer * 100.0) / 150.0; - if (fVar6 <= 0.0) { - fVar6 = 0.0; - } - if (100.0 <= fVar6) { - fVar6 = 100.0; - } - bar = 0; - if (5 < GHIDRA_INT(fVar6)) { - bar = GHIDRA_INT(fVar6); - } - chargeBar = this->_chargeBarSprites + 4; - } - FUN_0075ef20(chargeBar,bar); -LAB_0075ed54: - local_8 = 1.0; - bar = visibleBarCount; - if (((this->_exists != 0) && - (((this->_playerType == 0x1d || (this->_playerType == 0x26)) && - (twin = GHIDRA_CAST(this->_twinPlayer), twin != GHIDRA_CAST(0x0))))) && - (((twin->_playerIndex != -1 && (twin->_playerIndex < this->_playerIndex)) && (twin != this)))) - { - local_14 = (uint8_t [8])0x500000002; - uVar4 = g_game->_frameCount + 1; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> 2 ^ uVar4; - uVar4 = uVar4 << 5 ^ uVar4; - uVar4 = uVar4 >> 0x15 ^ uVar4; - local_8 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10 * 0.15 + 0.05; - } - while (bar = bar + -1, -1 < bar) { - bar = visibleBars[bar]; - *GHIDRA_CAST((bar + 0xb4)) = local_8; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x4))) = barOffsetX + renderPos->x + *GHIDRA_CAST((&DAT_00c5d0bc + bar * 8)); - local_c = barOffsetY + renderPos->y + *GHIDRA_CAST((&DAT_00c5d0c0 + bar * 8)); - if (*GHIDRA_CAST((bar + 0x109)) != '\0') { - if (*GHIDRA_CAST((bar + 0x70)) == '\0') { - AnimationState::Render - (GHIDRA_CAST((bar + 0x30)),GHIDRA_CAST((local_14 + 4)),&g_vectorZero, - &g_vectorZero); - secondLayer = GHIDRA_CAST((bar + 0x50)); - } - else { - AnimationState::Render - (GHIDRA_CAST((bar + 0x50)),GHIDRA_CAST((local_14 + 4)),&g_vectorZero, - &g_vectorZero); - secondLayer = GHIDRA_CAST((bar + 0x30)); - } - AnimationState::Render(secondLayer,GHIDRA_CAST((local_14 + 4)),&g_vectorZero,&g_vectorZero); - } - *GHIDRA_CAST((bar + 0xb4)) = 0x3f800000; - } - return; -} - -// 0075eff0 -int Entity_Player::GetCollectibleCount() -{ - int totalCount; - int remaining; - int *countIt; - - countIt = (this->_collectibleCounts)._begin; - totalCount = 0; - for (remaining = GHIDRA_INT((this->_collectibleCounts)._end) - GHIDRA_INT(countIt) >> 2; remaining != 0; - remaining = remaining + -1) { - totalCount = totalCount + *countIt; - countIt = countIt + 1; - } - return totalCount; -} - -// 00763570 -void Entity_Player::EvaluateItems() -{ - uint8_t auVar1 [16]; - uint8_t bVar2; - char cVar3; - uint8_t isProptosisEffect; - int iVar4; - int iVar5; - Vector *vecResult; - Weapon *weapon; - int iVar6; - int iVar7; - int iVar8; - int iVar9; - float *pfVar10; - void *pvVar11; - Entity *entity; - ChallengeParam *challengeParams; - float *pfVar12; - int *piVar13; - uint32_t *puVar14; - int iVar15; - int iVar16; - int iVar17; - int iVar18; - int iVar19; - int numOddMushroomLarge; - int numMark; - int numGrowthHormones; - int numPentagram; - int numSteven; - int numSynthoilEffects; - int numDarkMatterEffects; - int numGuillotineEffects; - int numOddMushroomEffects; - int numGrowthHormonesEffects; - int nullDamageUpCount; - ItemConfig *itemConfig; - ItemConfig_Item *pIVar20; - Entity_Player *pEVar21; - BitSet128 *flagsResult; - ColorMod *other; - ColorMod *other_00; - Entity_Familiar *this_00; - ColorMod *other_01; - ColorMod *color; - ColorMod *other_02; - RNG *pRVar22; - uint32_t *clampedCount; - ItemConfig_Item *collectibleItem; - PersistentGameData *persistentGameData; - char *pcVar23; - RNG *rng; - ItemOverlay *this_01; - EntityList *entityList; - Room *room; - PlayerManager *playerManager; - TemporaryEffects *temporaryEffects; - ColorMod *extraout_EAX; - ColorMod *colorResult; - Entity_Player *parentPlayer; - uint32_t uVar24; - int *weaponTypeCursor; - uint32_t uVar25; - uint8_t *puVar26; - char *pcVar27; - bool isWeaponTypesChanged; - long double fVar28; - uint8_t auVar29 [16]; - float fVar30; - TemporaryEffects *pTVar31; - float fVar32; - Entity_Player *pEVar33; - Color aCStackY_1d2c [128]; - float fVar34; - BitSet128 ringWormFlags; - BitSet128 tinyPlanetFlags; - BitSet128 ipecacFlags; - BitSet128 hookWormFlags; - BitSet128 wiggleWormFlags; - BitSet128 belialFlags; - BitSet128 continuumFlags; - BitSet128 ouroborosFlags; - Vector randomOffset; - Vector randomDir; - Vector throwVelocity; - Vector headScaleVec; - Vector spriteScaleVec; - Vector coPlayerSpawnPos; - Vector coPlayerOffset; - Vector coopBabySpawnPos; - Vector coopBabyOffset; - Vector clampedSpawnPos; - Vector unclampedSpawnPos; - KColor playerSlotColor; - uint8_t fortuneCookieWisps [16]; - uint8_t familiarList [36]; - int local_5a4; - int local_5a0; - int local_59c; - EntityList_EL local_598; - int stitchesCount; - float throwVelocityScale; - int haloFlyCount; - int local_57c; - EntityList_EL local_578; - uint32_t local_568; - float twinAverageSpeed; - uint32_t dogmaMinSpeed; - float berserkColorAmount; - float bloodLustColorAmount; - uint32_t bloodLustCap; - int bloodLustCount; - int lustyBloodEffectNum; - float taurusColorAmount; - float headScaleFactor; - float spriteScaleFactor; - int local_53c; - int foundSoulNeeded; - int local_534; - int damoclesCount; - int local_52c; - int soulTrinketMultiplier; - float spawnRadius; - uint32_t local_520; - int lilDeliriumCount; - uint32_t haloFlyCap; - float scaledRange; - float rangeAboveMin; - uint32_t local_50c; - uint32_t local_508; - uint32_t local_504; - uint32_t local_500; - int evesMascaraCount; - uint32_t local_4f8; - int eyeOfOccultCount; - uint32_t local_4f0; - float rawDamage; - uint32_t local_4e8; - float local_4e4; - uint32_t local_4e0; - float local_4dc; - uint32_t local_4d8; - float local_4d4; - uint32_t local_4d0; - int extraBrimstoneCount; - uint32_t local_4c8; - float local_4c4; - uint32_t local_4c0; - uint32_t local_4bc; - float local_4b8; - uint8_t coopBabyList [12]; - uint8_t coPlayerList [12]; - float fireRate; - Entity_Player *coPlayer; - Entity_Player *coopBaby; - float colorLerpAmount; - Entity_Player *otherPlayer; - RNG *local_488; - RNG *local_484; - Entity_Player *local_480; - uint8_t isEffectsDisabled; - uint8_t local_47b; - bool isActiveFullyCharged; - bool isActiveEmpty; - float local_478; - char isMistOrGhost; - ItemConfig_Item *local_470; - Entity_Player *local_46c; - TemporaryEffects *local_468; - TemporaryEffects *local_464; - ItemConfig_Item *local_460; - Entity_Player *player; - ColorMod lerpedColor; - Color defaultLaserColor [2]; - Color defaultTearColor; - Color pvpTearColor; - Color tearGlowColor; - Color laserGlowColor; - Color antiGravityColor [3]; - Color toxicShockColor; - Color lerpTargetColor; - RNG seededRng; - Color spriteColor; - RNG formFamiliarRng; - RNG statShuffleRng; - char local_1c0 [2]; - uint8_t abStack_1be [2]; - uint8_t local_1bc; - uint8_t auStack_1bb [379]; - uint8_t damageTearsBonus [8]; - float rangeBonus; - float shotSpeedBonus; - float speedBonus; - float luckBonus; - uint8_t prevWeaponTypes [16]; - uint8_t prevWeaponTypesTail; - float local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Game *game; - uint32_t swapStat; - float tintAlpha; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00aff0d2; - local_10 = ExceptionList; - local_14 = (float)(__security_cookie ^ GHIDRA_UINT((prevWeaponTypes + 0x24))); - ExceptionList = &local_10; - isEffectsDisabled = (this->_temporaryeffects)._disabled; - if ((this->_hasCurseMistEffect != 0) || (isMistOrGhost = '\0', this->_isCoopGhost != 0)) { - isMistOrGhost = '\x01'; - } - temporaryEffects = &this->_temporaryeffects; - speedBonus = 0.0; - _damageTearsBonus = ZEXT816(0); - luckBonus = 0.0; - local_468 = temporaryEffects; - player = this; - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xf0); - if (bVar2 != 0) { - rangeBonus = 1.0; - damageTearsBonus = (uint8_t [8])0x3f80000000000000; - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x0))) = 0x3f800000; - luckBonus = (float)&DAT_bf800000; - speedBonus = (float)&DAT_bf800000; - shotSpeedBonus = (float)&DAT_bf800000; - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)); - statShuffleRng._seed = 0; - if (iVar4 != 0) { - statShuffleRng._seed = *GHIDRA_CAST((iVar4 + 0x5c)); - } - statShuffleRng._shift1 = 3; - statShuffleRng._shift2 = 3; - statShuffleRng._shift3 = 0x1a; - local_8 = (void *)0x0; - uVar25 = 0; - do { - local_460 = GHIDRA_CAST((6 - uVar25)); - (GHIDRA_CAST((&statShuffleRng)))->RNG::Next(); - uVar24 = 0; - if (local_460 != GHIDRA_CAST(0x0)) { - uVar24 = GHIDRA_UINT(statShuffleRng._seed) % GHIDRA_UINT(local_460); - } - swapStat = *GHIDRA_CAST((damageTearsBonus + uVar25 * 4)); - iVar4 = uVar24 + uVar25; - *GHIDRA_CAST((damageTearsBonus + uVar25 * 4)) = *GHIDRA_CAST((damageTearsBonus + iVar4 * 4)) - ; - uVar25 = uVar25 + 1; - *GHIDRA_CAST((damageTearsBonus + iVar4 * 4)) = swapStat; - } while (uVar25 < 5); - local_8 = (void *)0xffffffff; - } - iVar4 = GetTrinketMultiplier(player,0x5c); - local_484 = GHIDRA_CAST(((float)iVar4 * 0.2 + 1.0)); - if (player->_playerType == 0x24) { - local_484 = GHIDRA_CAST(((float)local_484 * 0.75)); - } - bVar2 = HasCollectible(player,0x298,0); - if (bVar2 != 0) { - iVar4 = GetCollectibleNum(player,0x16,0); - auVar29 = _damageTearsBonus; - fVar30 = (float)iVar4; - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x4))) = (void *)(fVar30 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x4)))); - rangeBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0x8))); - shotSpeedBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0xc))); - rangeBonus = fVar30 + rangeBonus; - speedBonus = speedBonus - fVar30 * 0.15; - iVar4 = GetCollectibleNum(player,0x17,0); - auVar29 = _damageTearsBonus; - fVar30 = (float)iVar4; - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x4))) = (void *)(fVar30 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x4)))); - auVar1 = _damageTearsBonus; - shotSpeedBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0xc))); - _damageTearsBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar1)) + 0x0))); - shotSpeedBonus = fVar30 + shotSpeedBonus; - speedBonus = speedBonus - fVar30 * 0.15; - iVar4 = GetCollectibleNum(player,0x18,0); - auVar29 = _damageTearsBonus; - fVar30 = (float)iVar4; - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x0))) = fVar30 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x0))); - auVar1 = _damageTearsBonus; - shotSpeedBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0xc))); - _damageTearsBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar1)) + 0x0))); - shotSpeedBonus = fVar30 + shotSpeedBonus; - speedBonus = speedBonus - fVar30 * 0.15; - iVar4 = GetCollectibleNum(player,0x19,0); - fVar30 = (float)iVar4; - rangeBonus = fVar30 + rangeBonus; - shotSpeedBonus = fVar30 + shotSpeedBonus; - speedBonus = speedBonus - fVar30 * 0.15; - iVar4 = GetCollectibleNum(player,0x1a,0); - auVar29 = _damageTearsBonus; - fVar30 = (float)iVar4; - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x0))) = fVar30 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x0))); - auVar1 = _damageTearsBonus; - rangeBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0x8))); - shotSpeedBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0xc))); - damageTearsBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar1)) + 0x0))); - rangeBonus = fVar30 + rangeBonus; - speedBonus = speedBonus - fVar30 * 0.15; - iVar4 = GetCollectibleNum(player,0x15a,0); - fVar30 = (float)iVar4; - luckBonus = fVar30 + luckBonus; - shotSpeedBonus = fVar30 + shotSpeedBonus; - speedBonus = speedBonus - fVar30 * 0.15; - iVar4 = GetCollectibleNum(player,0x1c8,0); - fVar30 = (float)iVar4; - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x0))) = fVar30 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x0))); - luckBonus = fVar30 + luckBonus; - speedBonus = speedBonus - fVar30 * 0.15; - iVar4 = GetCollectibleNum(player,0x2c3,0); - fVar30 = (float)iVar4; - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x4))) = (void *)(fVar30 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x4)))); - luckBonus = fVar30 + luckBonus; - speedBonus = speedBonus - fVar30 * 0.15; - } - bVar2 = HasCollectible(player,0x29f,0); - auVar29 = _damageTearsBonus; - if (bVar2 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x4))) = - (void *)((float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1db2)))) * 0.1 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x4)))); - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x0))) = - (void *)((float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1db0)))) * 0.1 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x0)))); - rangeBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0x8))); - shotSpeedBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0xc))); - rangeBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1db4)))) * 0.1 + rangeBonus; - shotSpeedBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1db6)))) * 0.1 + shotSpeedBonus; - speedBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1db8)))) * 0.1 + speedBonus; - luckBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dba)))) * 0.1 + luckBonus; - } - bVar2 = HasCollectible(player,0x2ae,0); - auVar29 = _damageTearsBonus; - if (bVar2 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x4))) = - (void *)((float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dbe)))) * 0.2 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x4)))); - (*GHIDRA_CAST((GHIDRA_CAST(&(damageTearsBonus)) + 0x0))) = - (void *)((float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dbc)))) * 0.2 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x0)))); - rangeBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0x8))); - shotSpeedBonus = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0xc))); - rangeBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dc0)))) * 0.2 + rangeBonus; - shotSpeedBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dc2)))) * 0.2 + shotSpeedBonus; - speedBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dc4)))) * 0.2 + speedBonus; - luckBonus = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dc6)))) * 0.2 + luckBonus; - } - iVar4 = GetActiveMaxCharge(player,0); - if (iVar4 < 1) { - isActiveEmpty = false; - isActiveFullyCharged = false; - } - else { - iVar5 = GetTotalActiveCharge(player,0); - isActiveFullyCharged = iVar4 <= iVar5; - isActiveEmpty = player->_activeDesc[0]._charge == 0; - } - if ((player->_cacheFlags & 0x100U) != 0) { - prevWeaponTypes = *(uint8_t (*) [16])&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x13f0))); - prevWeaponTypesTail = (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1400))); - FUN_007539a0(); - if ((player->_playerType == 0x10) || - (((((player->_variant == 1 && (player->_babySkin == 0x39)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c0), bVar2 != 0)) || - ((player->_playerType == 0x23 || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x271), bVar2 != 0)))) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x6e), bVar2 != 0)))) { -LAB_00763e51: - EnableWeaponType(player); - } - else { - bVar2 = HasCollectible(player,0x243,0); - if (bVar2 != 0) { - HasCollectible(player,0x2a6,0); - goto LAB_00763e51; - } - bVar2 = HasCollectible(player,0xa8,0); - if (((bVar2 != 0) || (bVar2 = HasCollectible(player,0x2a6,0), bVar2 != 0)) || - (bVar2 = HasCollectible(player,0x72,0), bVar2 != 0)) goto LAB_00763e51; - bVar2 = HasCollectible(player,0x213,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(player,0x34,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(player,0x76,0); - if ((((bVar2 == 0) || (bVar2 = HasCollectible(player,0x18b,0), bVar2 != 0)) && - (((player->_playerType != 7 && - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2), bVar2 == 0 && - (player->_playerType != 0x1c)))) || - (bVar2 = HasCollectible(player,0x18b,0), bVar2 != 0)))) && - (((bVar2 = HasCollectible(player,0x18b,0), bVar2 == 0 && - (bVar2 = HasCollectible(player,0x44,0), bVar2 == 0)) && - (bVar2 = HasCollectible(player,0x149,0), bVar2 == 0)))) { - HasCollectible(player,0xe5,0); - } - } - else { - HasCollectible(player,0xe5,0); - } - goto LAB_00763e51; - } - HasCollectible(player,0xe5,0); - EnableWeaponType(player); - bVar2 = HasCollectible(player,0x72,0); - if (bVar2 != 0) goto LAB_00763e51; - } - bVar2 = HasWeaponType(player,2); - if ((bVar2 != 0) && (bVar2 = HasWeaponType(player,4), bVar2 != 0)) { - EnableWeaponType(player); - } - bVar2 = HasWeaponType(player,0xe); - if ((bVar2 != 0) && - (((bVar2 = HasCollectible(player,0x76,0), bVar2 != 0 && - (bVar2 = HasCollectible(player,0x18b,0), bVar2 == 0)) || - (((player->_playerType == 7 || - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2), bVar2 != 0 || - (player->_playerType == 0x1c)))) && (bVar2 = HasCollectible(player,0x18b,0), bVar2 == 0)) - )))) { - EnableWeaponType(player); - EnableWeaponType(player); - } - bVar2 = HasWeaponType(player,7); - pEVar33 = player; - if ((bVar2 != 0) && (bVar2 = HasWeaponType(player,5), bVar2 != 0)) { - EnableWeaponType(pEVar33); - } - bVar2 = HasWeaponType(pEVar33,2); - if ((bVar2 != 0) && (bVar2 = HasWeaponType(pEVar33,3), bVar2 != 0)) { - EnableWeaponType(pEVar33); - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x100); - weaponTypeCursor = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar33)) + 0x13f0)))); - uVar25 = 0xd; - piVar13 = GHIDRA_CAST(prevWeaponTypes); - do { - if (*piVar13 != *weaponTypeCursor) goto LAB_00763fb3; - piVar13 = piVar13 + 1; - weaponTypeCursor = weaponTypeCursor + 1; - isWeaponTypesChanged = 3 < uVar25; - uVar25 = uVar25 - 4; - } while (isWeaponTypesChanged); - if ((char)*piVar13 == (char)*weaponTypeCursor) { - isWeaponTypesChanged = false; - } - else { -LAB_00763fb3: - isWeaponTypesChanged = true; - } - if (isWeaponTypesChanged) { - pEVar33 = player; - if (((player->_heldEntity != GHIDRA_CAST(0x0)) && (player->_itemState != 0x25c)) && - (player->_itemState != 0x2c5)) { - bVar2 = (GHIDRA_CAST((player->_heldEntity)))->Entity::IsEnemy(); - pEVar33 = player; - if (bVar2 == 0) { - (**(code **)(*GHIDRA_CAST(player->_heldEntity) + 0x28))(); - } - else { - throwVelocityScale = 0.1; - vecResult = (GHIDRA_CAST((&player->_velocity)))->Vector::__mul(&throwVelocity,&throwVelocityScale); - ThrowHeldEntity(pEVar33,vecResult); - } - } - uVar25 = 0; - do { - Isaac::DestoryWeapon(GHIDRA_CAST((GHIDRA_INT(pEVar33->_weapons) + uVar25 + 4))); - uVar25 = uVar25 + 4; - pEVar33 = player; - } while (uVar25 < 0x10); - local_470 = GHIDRA_CAST((player->_weapons + 1)); - uVar25 = 0; - iVar4 = 0; - do { - if (3 < iVar4) break; - if (*GHIDRA_CAST((GHIDRA_CAST(pEVar33->_weapons) + uVar25 + 0x14)) != '\0') { - weapon = Isaac::CreateWeapon(uVar25,GHIDRA_CAST(pEVar33)); - iVar4 = iVar4 + 1; - local_470->type = GHIDRA_INT(weapon); - local_470 = GHIDRA_CAST(&local_470->id); - pEVar33 = player; - } - uVar25 = uVar25 + 1; - } while (uVar25 < 0x11); - pEVar33->_cacheFlags = pEVar33->_cacheFlags | 1; - temporaryEffects = local_468; - } - } - if ((player->_cacheFlags & 4U) != 0) { - player->_cacheFlags = player->_cacheFlags | 8; - } - bVar2 = HasCollectible(player,0x130,0); - if (((bVar2 != 0) || (iVar4 = GetZodiacEffect(player), iVar4 == 0x130)) && - ((player->_cacheFlags & 0x1bU) != 0)) { - player->_cacheFlags = player->_cacheFlags | 0x1b; - } - pEVar33 = player; - if ((player->_cacheFlags & 2) != 0) { - if (isMistOrGhost == '\0') { - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - local_470 = GHIDRA_CAST(((float)iVar4 * 0.5 - (float)*piVar13 * 0.4)); - } - else { - local_470 = GHIDRA_CAST(0x0); - } - iVar4 = GetCollectibleNum(player,0x20,0); - pEVar33 = player; - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_470)); - iVar4 = GetCollectibleNum(player,0x50,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x17d,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,1,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(1); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x172,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x155,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x156,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x156); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0xb7,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x18a,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x223,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x259,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x256,0); - local_460 = GHIDRA_CAST((((float)iVar4 + (float)local_460) * 0.7)); - iVar4 = GetCollectibleNum(pEVar33,6,0); - iVar5 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(6); - local_460 = GHIDRA_CAST(((float)(iVar4 + iVar5) * 1.5 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x29d,0); - iVar5 = GetCollectibleNum(pEVar33,0x234,0); - iVar6 = GetCollectibleNum(pEVar33,0xff,0); - iVar7 = GetCollectibleNum(pEVar33,0x73,0); - iVar8 = GetCollectibleNum(pEVar33,0x48,0); - local_460 = (ItemConfig_Item *) - ((float)(iVar8 + iVar4 + iVar5 + iVar6 + iVar7) * 0.5 + (float)local_460); - iVar4 = GetCollectibleNum(pEVar33,0xc4,0); - iVar5 = GetCollectibleNum(pEVar33,0xb6,0); - iVar6 = GetTrinketMultiplier(pEVar33,0x60); - iVar7 = GetTrinketMultiplier(pEVar33,0x1a); - iVar8 = GetTrinketMultiplier(pEVar33,0xb); - iVar9 = GetTrinketMultiplier(pEVar33,10); - local_460 = (ItemConfig_Item *) - ((float)(iVar9 + (iVar4 - iVar5) + iVar6 + iVar7 + iVar8) * 0.4 + (float)local_460); - iVar4 = GetCollectibleNum(pEVar33,0xbd,0); - iVar5 = GetCollectibleNum(pEVar33,0x65,0); - iVar6 = GetCollectibleNum(pEVar33,0x5a,0); - local_46c = GHIDRA_CAST(((float)(iVar6 + iVar4 + iVar5) * 0.2 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x14b,0); - iVar5 = GetCollectibleNum(pEVar33,0xed,0); - iVar6 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0xed); - local_46c = GHIDRA_CAST(((float)local_46c - (float)(iVar6 + iVar4 + iVar5) * 0.3)); - iVar4 = GetCollectibleNum(pEVar33,0x1b6,0); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.75 + (float)local_46c)); - iVar4 = GetCollectibleNum(pEVar33,0x1bb,0); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.3 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x1d1,0); - local_478 = (float)iVar4 * 0.35 + (float)local_460; - bVar2 = HasTrinket(pEVar33,0x65,0); - if ((bVar2 != 0) && (isActiveEmpty != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,0x65); - local_478 = local_478 + (float)iVar4 * 0.5; - } - bVar2 = HasTrinket(pEVar33,100,0); - if ((bVar2 != 0) && (isActiveFullyCharged != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,100); - local_478 = local_478 + (float)iVar4 * 0.2; - } - iVar4 = pEVar33->_playerType; - if ((iVar4 == 6) || (iVar4 == 0x1b)) { - local_478 = local_478 - 0.1; -LAB_0076474b: - fVar30 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x4))) * 0.5; - if ((iVar4 == 9) || (iVar4 == 0x1e)) { - fVar30 = fVar30 + pEVar33->_edenFireDelay; - } - } - else { - if (iVar4 != 0x19) { - if ((iVar4 == 0x22) || (iVar4 == 0x1a)) { - local_478 = local_478 - 0.5; - } - else { - if (iVar4 != 7) { - bVar2 = (GHIDRA_CAST((local_468)))->TemporaryEffects::HasTrinketEffect(0xa2); - if (bVar2 == 0) { - iVar4 = pEVar33->_playerType; - if (((iVar4 == 0x13) || (iVar4 == 0x25)) || (iVar4 == 0x27)) { - local_478 = local_478 + 0.27777; - } - else if ((iVar4 == 0x14) || (iVar4 == 0x26)) { - local_478 = local_478 - 0.099649; - } - goto LAB_0076474b; - } - iVar4 = pEVar33->_playerType; - } - local_478 = local_478 + 0.5; - } - goto LAB_0076474b; - } - local_478 = local_478 - 0.35; - fVar30 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x4))) * 0.5; - } - if (fVar30 < 0.0) { - fVar30 = fVar30 * 0.686655; - } - local_478 = fVar30 + local_478; - if ((iVar4 == 0xe) && (bVar2 = HasCollectible(pEVar33,0xf5,0), bVar2 == 0)) { - local_478 = local_478 - 1.9; - } - if ((pEVar33->_playerType == 0x21) && (bVar2 = HasCollectible(pEVar33,0xf5,0), bVar2 == 0)) { - local_478 = local_478 - 2.2; - } - temporaryEffects = local_468; - bVar2 = (GHIDRA_CAST((local_468)))->TemporaryEffects::HasCollectibleEffect(0x271); - if (bVar2 != 0) { - local_478 = local_478 - 1.9; - } - bVar2 = HasPlayerForm(player,7); - if (bVar2 != 0) { - local_478 = local_478 - 0.3; - } - if (0 < player->_coopBabyBuffTimers[1]) { - local_478 = local_478 + 1.0; - } - local_4bc = 0; - local_4b8 = local_478 * 1.3 + 1.0; - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - FUN_00431260(); - local_4c0 = 0; - local_460 = GHIDRA_CAST(fVar30); - pfVar10 = GHIDRA_CAST(std)::min(); - local_4c8 = 0x40a00000; - local_4c4 = (16.0 - (float)local_460 * 6.0) - *pfVar10 * 6.0; - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33 = player; - local_478 = *pfVar10; - local_480 = GHIDRA_CAST((30.0 / (local_478 + 1.0))); - bVar2 = HasCollectible(player,600,0); - if (bVar2 != 0) { - local_480 = GHIDRA_CAST(((float)local_480 * 1.2)); - } - if (((float)local_484 != 1.0) && (2.7272727 < (float)local_480)) { - local_480 = (Entity_Player *) - ((float)local_480 + ((float)local_480 - 2.7272727) * ((float)local_484 - 1.0)); - } - bVar2 = HasCollectible(pEVar33,0x197,0); - if (((bVar2 == 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x197), bVar2 == 0)) || - (pEVar33->_purityState != 1)) { - local_464 = GHIDRA_CAST(0x0); - } - else { - local_464 = GHIDRA_CAST(0x40000000); - } - iVar4 = GetZodiacEffect(pEVar33); - if (iVar4 == 0x133) { - local_470 = GHIDRA_CAST(0x3f800000); - } - else { - local_470 = GHIDRA_CAST(0x0); - } - iVar4 = GetZodiacEffect(pEVar33); - if (iVar4 == 0x135) { - local_488 = GHIDRA_CAST(0x3f800000); - } - else { - local_488 = GHIDRA_CAST(0x0); - } - if ((pEVar33->_hasCurseMistEffect == 0) && (pEVar33->_isCoopGhost == 0)) { - local_46c = GHIDRA_CAST(pEVar33->_fireDelayModifier); - } - else { - local_46c = GHIDRA_CAST(0x0); - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba); - pEVar33 = player; - if (bVar2 == 0) { - local_460 = GHIDRA_CAST(0x0); - } - else { - local_460 = GHIDRA_CAST(0x40000000); - } - iVar4 = GetCollectibleNum(player,0x133,0); - iVar5 = GetCollectibleNum(pEVar33,0xe4,0); - iVar6 = GetCollectibleNum(pEVar33,0xe0,0); - iVar7 = GetCollectibleNum(pEVar33,0xce,0); - iVar8 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0xce); - local_470 = (ItemConfig_Item *) - ((float)(iVar8 + iVar4 + iVar5 + iVar6 + iVar7) + (float)local_470); - iVar4 = GetCollectibleNum(pEVar33,0x135,0); - local_470 = (ItemConfig_Item *) - (((float)iVar4 + (float)local_470 + (float)local_488 + (float)GHIDRA_INT(local_46c)) * 0.5) - ; - iVar4 = GetTrinketMultiplier(pEVar33,0x27); - local_460 = (ItemConfig_Item *) - ((float)GHIDRA_INT(pEVar33->_brittleBonesUpgrades) * 0.4 + - (float)iVar4 + (float)local_464 + (float)local_470 + (float)local_460); - iVar4 = GetCollectibleNum(pEVar33,0x18d,0); - iVar5 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x18d); - local_460 = GHIDRA_CAST(((float)(iVar4 + iVar5) + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetNullEffectNum(0x3e); - local_460 = GHIDRA_CAST(((float)iVar4 * 1.5 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x246); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.75 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetNullEffectNum(0x47); - local_480 = GHIDRA_CAST(((float)iVar4 * 0.3 + (float)local_460 + (float)local_480)); - bVar2 = HasCollectible(pEVar33,0x78,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x78), bVar2 == 0 - )) { - temporaryEffects = local_468; - } - else { - iVar4 = GetCollectibleNum(pEVar33,0x78,0); - temporaryEffects = local_468; - iVar5 = (GHIDRA_CAST((local_468)))->TemporaryEffects::GetCollectibleEffectNum(0x78); - local_480 = GHIDRA_CAST(((float)(iVar4 + iVar5) * 0.7 + 1.0 + (float)local_480)); - } - if ((((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) != 0x67) || ((*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef0))) != '\x01')) || - (player->_numKeys != player->_numBombs)) || - (local_47b = 1, player->_numBombs != player->_numCoins)) { - local_47b = 0; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0x67); - pEVar33 = player; - if ((bVar2 != 0) || (local_47b != 0)) { - iVar4 = GetTrinketMultiplier(player,0x67); - local_480 = GHIDRA_CAST(((float)iVar4 + (float)iVar4 + (float)local_480)); - } - iVar4 = GetCollectibleNum(pEVar33,0x22a,0); - local_46c = GHIDRA_CAST(((float)iVar4 * 0.5 + (float)local_480)); - bVar2 = HasWeaponType(player,2); - if (bVar2 == 0) { - iVar4 = GetCollectibleNum(player,0xde,0); - local_46c = GHIDRA_CAST(((float)iVar4 + (float)local_46c)); - } - iVar4 = is_achievement_79_unlocked(player); - fVar30 = (float)iVar4 * 0.5 + (float)local_46c; - local_464 = GHIDRA_CAST(fVar30); - iVar4 = get_seeded_variant(player); - if (iVar4 == 3) { -LAB_00764de6: - fVar30 = (float)local_464 * 0.4; -LAB_00764df6: - local_464 = GHIDRA_CAST(fVar30); - } - else { - if (iVar4 == 4) { - fVar30 = (float)local_464 * 5.5; - goto LAB_00764df6; - } - if (iVar4 == 5) goto LAB_00764de6; - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x1b4); - if (pvVar11 != (void *)0x0) { - fVar30 = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) + (float)local_464; - local_464 = GHIDRA_CAST(fVar30); - } - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x39); - if (0 < iVar4) { - fVar30 = (float)iVar4 * 0.4 + 0.8 + (float)local_464; - local_464 = GHIDRA_CAST(fVar30); - } - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x237); - if (0 < iVar4) { - fVar30 = (float)iVar4 * 0.4 + (float)local_464; - local_464 = GHIDRA_CAST(fVar30); - } - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x4a); - if (0 < iVar4) { - fVar30 = (float)iVar4 * 0.5 + 0.5 + (float)local_464; - local_464 = GHIDRA_CAST(fVar30); - } - FUN_00753880(); - local_464 = GHIDRA_CAST((fVar30 + (float)local_464)); - if (0 < player->_grantedCollectibleCountdown) { - local_464 = GHIDRA_CAST(((float)local_464 + 1.5)); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x30); - if (pvVar11 != (void *)0x0) { - local_464 = GHIDRA_CAST(((float)local_464 + (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 0.25)); - } - bVar2 = HasCollectible(player,0xf5,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(player,0x99,0); - if ((bVar2 == 0) && - ((bVar2 = HasCollectible(player,0xa9,0), bVar2 == 0 || - (bVar2 = HasWeaponType(player,0xe), bVar2 != 0)))) { - bVar2 = HasCollectible(player,2,0); - if ((bVar2 != 0) || - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(2), bVar2 != 0 || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x41), bVar2 != 0)))) { - local_464 = GHIDRA_CAST(((float)local_464 * 0.51)); - } - } - else { - local_464 = GHIDRA_CAST(((float)local_464 * 0.42)); - } - } - bVar2 = HasCollectible(player,0x95,0); - if ((bVar2 != 0) && - (((bVar2 = HasWeaponType(player,1), bVar2 != 0 || - (bVar2 = HasWeaponType(player,7), bVar2 != 0)) || - (bVar2 = HasWeaponType(player,3), bVar2 != 0)))) { - local_464 = GHIDRA_CAST(((float)local_464 / 3.0)); - } - bVar2 = HasCollectible(player,0x213,0); - if (bVar2 != 0) { - bVar2 = HasCollectible(player,0x95,0); - if ((bVar2 == 0) && (bVar2 = HasWeaponType(player,1), bVar2 != 0)) { - local_464 = GHIDRA_CAST(((float)local_464 * 0.5)); - } - local_460 = GHIDRA_CAST((30.0 / (float)local_464)); - bVar2 = HasWeaponType(player,0xe); - if (bVar2 == 0) { - fVar30 = (float)local_464 * 10.0; - fVar32 = (float)local_460 + 10.0; - } - else { - fVar30 = (float)local_464 * 4.0; - fVar32 = (float)local_460 + 4.0; - } - local_464 = GHIDRA_CAST(((float)local_464 - fVar30 / fVar32)); - local_46c = GHIDRA_CAST(0x0); - bVar2 = HasCollectible(player,0x76,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(player,0x34,0); - if (bVar2 != 0) { - local_46c = GHIDRA_CAST(0x41200000); - } - } - else { - local_46c = GHIDRA_CAST(0x41a00000); - } - bVar2 = HasWeaponType(player,7); - pEVar33 = local_46c; - if (bVar2 != 0) { - pEVar33 = GHIDRA_CAST(((float)local_46c * 0.5)); - } - local_464 = (TemporaryEffects *) - ((float)local_464 - - ((float)pEVar33 * (float)local_464) / (30.0 / (float)local_464 + (float)pEVar33)); - } - bVar2 = HasWeaponType(player,2); - if (bVar2 == 0) { - bVar2 = HasWeaponType(player,5); - if (bVar2 == 0) { - bVar2 = HasWeaponType(player,10); - if (bVar2 != 0) { - local_464 = GHIDRA_CAST(((float)local_464 * 0.5)); - } - } - else { - local_464 = GHIDRA_CAST(((float)local_464 / 2.5)); - } - } - else { - local_464 = GHIDRA_CAST(((float)local_464 / 3.0)); - if (((player->_playerType == 7) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2), bVar2 != 0)) && - (bVar2 = HasCollectible(player,0x76,0), bVar2 == 0)) { - local_464 = GHIDRA_CAST(((float)local_464 / 1.25)); - } - } - bVar2 = HasCollectible(player,0x98,0); - if (bVar2 != 0) { - local_464 = GHIDRA_CAST(((float)local_464 / 1.5)); - } - if (player->_playerType == 0x1a) { - local_464 = GHIDRA_CAST(((float)local_464 * 0.66)); - } - bVar2 = HasCollectible(player,0x136,0); - if (bVar2 != 0) { - local_464 = GHIDRA_CAST(((float)local_464 * 0.66)); - } - bVar2 = HasWeaponType(player,7); - if (bVar2 == 0) { - bVar2 = HasWeaponType(player,9); - if ((bVar2 != 0) && (bVar2 = HasCollectible(player,0xe5,0), bVar2 != 0)) { - local_464 = GHIDRA_CAST(((float)local_464 / 3.1)); - } - } - else { - local_464 = GHIDRA_CAST(((float)local_464 / 4.3)); - } - bVar2 = HasCollectible(player,0x231,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(player,0x14a,0); - if (bVar2 != 0) { - local_464 = GHIDRA_CAST(((float)local_464 * 5.5)); - } - } - else { - local_464 = GHIDRA_CAST(((float)local_464 * 4.0)); - } - if (player->_hallowedGroundCountdown != 0) { - local_464 = GHIDRA_CAST(((float)local_464 * 2.5)); - } - bVar2 = HasCollectible(player,0x170,0); - if ((bVar2 != 0) && (0 < player->_epiphoraCharge)) { - local_464 = (TemporaryEffects *) - ((float)local_464 * ((float)player->_epiphoraCharge / 180.0 + 1.0)); - } - if (0 < player->_peeBurstCooldown) { - local_464 = (TemporaryEffects *) - ((((float)player->_peeBurstCooldown * 5.0) / (float)player->_maxPeeBurstCooldown + - 1.0) * (float)local_464); - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x3f); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2d9); - if ((((bVar2 != 0) && (bVar2 = HasCollectible(player,0x3b,0), bVar2 != 0)) && - (entity = GHIDRA_CAST(FUN_0042d040()), entity != GHIDRA_CAST(0x0))) && - (((iVar4 = (GHIDRA_CAST((entity)))->Entity::SubType(), iVar4 != 8 && - (iVar4 = (GHIDRA_CAST((entity)))->Entity::SubType(), iVar4 != 4)) && - ((iVar4 = (GHIDRA_CAST((entity)))->Entity::SubType(), iVar4 != 0xf && - (uVar25 = (GHIDRA_CAST((entity)))->Entity::SpawnerType(), (uVar25 & 0x10) == 0)))))) { - local_464 = GHIDRA_CAST(((float)local_464 * 3.0)); - } - } - else { - local_464 = GHIDRA_CAST(((float)local_464 * 4.0)); - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c0); - if (bVar2 != 0) { - local_464 = GHIDRA_CAST(((float)local_464 + 2.0)); - } - bVar2 = HasCollectible(player,0x2b7,0); - if ((bVar2 != 0) && (isEffectsDisabled == 0)) { - fVar30 = Math::clamp(0.0,6.0,(float)GHIDRA_INT(player->_bloodLustCounter)); - local_464 = GHIDRA_CAST((fVar30 * 0.05 * fVar30 + fVar30 * 0.2 + (float)local_464)); - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xba); - if ((bVar2 != 0) && (isEffectsDisabled == 0)) { - fVar30 = Math::clamp(0.0,999.0,(float)GHIDRA_INT(player->_bloodLustCounter)); - local_464 = GHIDRA_CAST((fVar30 * 0.15 + 0.33 + (float)local_464)); - } - iVar4 = get_seeded_variant(player); - pTVar31 = local_464; - if (iVar4 == 2) { - pTVar31 = GHIDRA_CAST(((float)local_464 * 0.75)); - } - local_478 = 30.0 / ((float)pTVar31 * player->_d8FireDelayModifier) - 1.0; - if (player->_variant == 1) { - pEVar33 = GetMainPlayer(player); - cVar3 = CanShoot(pEVar33); - if (cVar3 == '\0') { - local_478 = 10.0; - } - } - if ((player->_variant == 0) && (iVar4 = Game::Challenge(g_game), iVar4 != 0)) { - iVar4 = Game::Challenge(g_game); - challengeParams = Manager::GetChallengeParams(g_manager,iVar4); - if (0.0 < challengeParams->_minFireRate) { - iVar4 = Game::Challenge(g_game); - Manager::GetChallengeParams(g_manager,iVar4); - pfVar10 = GHIDRA_CAST(std)::max(); - local_478 = *pfVar10; - } - } - pvVar11 = g_luaEngine; - pfVar10 = &player->_maxfiredelay; - *pfVar10 = local_478; - LuaEngine::EvaluateItems(pvVar11,player,2); - pfVar12 = GHIDRA_CAST(std)::max(); - game = g_game; - *pfVar10 = *pfVar12; - Game::GetField26614(game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - pEVar33 = player; - } - else { - entityList = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar13 = GHIDRA_CAST((GHIDRA_CAST((entityList)))->EntityList)::Size(); - pEVar33 = player; - (**(code **)(*piVar13 + 0x6c))(); - } - } - if ((pEVar33->_cacheFlags & 1) != 0) { - pTVar31 = GHIDRA_CAST(&pEVar33->_damage); - *GHIDRA_CAST(pTVar31) = 0.0; - pEVar33->_meleeDamage = 0.0; - local_464 = pTVar31; - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x22); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)(*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) + -1) + 2.0 + *GHIDRA_CAST(pTVar31); - } - bVar2 = HasCollectible(player,7,0); - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) + 1.0; - } - bVar2 = HasCollectible(player,0x5a,0); - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) + 1.0; - } - bVar2 = HasCollectible(player,0xd8,0); - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) + 1.0; - } - bVar2 = HasPlayerForm(player,5); - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) + 2.0; - } - bVar2 = HasPlayerForm(player,7); - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) - 0.3; - } - bVar2 = HasCollectible(player,0x6d,0); - local_460 = GHIDRA_CAST(0x3d23d70a); - if (bVar2 != 0) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - fVar30 = 0.04; - } - else { - fVar30 = 0.1; - } - *GHIDRA_CAST(pTVar31) = (float)player->_numCoins * fVar30 + *GHIDRA_CAST(pTVar31); - } - bVar2 = HasCollectible(player,0x28e,0); - if (bVar2 != 0) { - puVar14 = GHIDRA_CAST(FUN_0042c810()); - local_46c = GHIDRA_CAST(*puVar14); - puVar14 = GHIDRA_CAST(FUN_0042c810()); - local_488 = GHIDRA_CAST(*puVar14); - puVar14 = GHIDRA_CAST(FUN_0042c810()); - local_470 = GHIDRA_CAST(*puVar14); - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar5 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - *GHIDRA_CAST(local_464) = - (float)GHIDRA_INT((GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST((GHIDRA_INT(local_488) + -8)))[-9].x) + - GHIDRA_INT(((local_470->name)._buf + *piVar13 + iVar4 + iVar5)))) + - GHIDRA_INT((local_46c->_sprite)._filename._buf))) * 0.6 + *GHIDRA_CAST(local_464); - pTVar31 = local_464; - temporaryEffects = local_468; - } - if ((0 < player->_redStewBonusDuration) && (isEffectsDisabled == 0)) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - local_460 = GHIDRA_CAST(0x3d656042); - } - *GHIDRA_CAST(local_464) = - (float)(player->_redStewBonusDuration / 10) * (float)local_460 + *GHIDRA_CAST(local_464); - pTVar31 = local_464; - } - bVar2 = HasCollectible(player,0x2cc,0); - if (bVar2 != 0) { - *GHIDRA_CAST(local_464) = - (float)((player->_keepersSackBonus / 3 + 2) / 3) * 0.5 + *GHIDRA_CAST(local_464); - pTVar31 = local_464; - } - local_460 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x7b); - local_470 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x7c); - local_488 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x81); - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x82); - if (local_460 == (void *)0x0) { - fVar30 = player->_damage; - } - else { - fVar30 = ((float)*GHIDRA_CAST((GHIDRA_CAST(local_460) + 4)) + (float)*GHIDRA_CAST((GHIDRA_CAST(local_460) + 4))) / 3.0 + - *GHIDRA_CAST(pTVar31); - *GHIDRA_CAST(pTVar31) = fVar30; - } - if (local_470 != (void *)0x0) { - fVar30 = fVar30 + ((float)*GHIDRA_CAST((GHIDRA_CAST(local_470) + 8)) + (float)*GHIDRA_CAST((GHIDRA_CAST(local_470) + 8))) - / 90.0; - *GHIDRA_CAST(pTVar31) = fVar30; - } - if (local_488 != GHIDRA_CAST(0x0)) { - fVar30 = fVar30 + ((float)local_488->_shift1 * 6.0) / 3.0; - *GHIDRA_CAST(pTVar31) = fVar30; - } - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 0.5 + fVar30; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2d9); - if (((((bVar2 != 0) && (bVar2 = HasCollectible(player,0x3b,0), bVar2 != 0)) && - (local_46c = GHIDRA_CAST(FUN_0042d040()), local_46c != GHIDRA_CAST(0x0))) && - ((iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_46c))))->Entity::SubType(), iVar4 != 8 && - (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_46c))))->Entity::SubType(), iVar4 != 4)))) && - ((iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_46c))))->Entity::SubType(), iVar4 != 0xf && - (uVar25 = (GHIDRA_CAST((GHIDRA_CAST(local_46c))))->Entity::SpawnerType(), (uVar25 & 0x10) == 0)))) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) + 2.0; - } - bVar2 = HasTrinket(player,0x65,0); - if ((bVar2 != 0) && (isActiveEmpty != false)) { - iVar4 = GetTrinketMultiplier(player,0x65); - *GHIDRA_CAST(pTVar31) = (float)iVar4 * 1.5 + *GHIDRA_CAST(pTVar31); - } - bVar2 = HasTrinket(player,100,0); - if ((bVar2 != 0) && (isActiveFullyCharged != false)) { - iVar4 = GetTrinketMultiplier(player,100); - *GHIDRA_CAST(pTVar31) = (float)iVar4 * 0.5 + *GHIDRA_CAST(pTVar31); - } - if (player->_variant == 1) { - iVar4 = player->_babySkin; - if (iVar4 == 0xd) { - fVar30 = *GHIDRA_CAST(pTVar31) + 2.0; - } - else if (iVar4 == 0x17) { - fVar30 = *GHIDRA_CAST(pTVar31) + 1.0; - } - else { - if (iVar4 != 0x36) goto LAB_00765c5f; - fVar30 = *GHIDRA_CAST(pTVar31) + 1.5; - } - *GHIDRA_CAST(pTVar31) = fVar30; - } -LAB_00765c5f: - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x7a); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = - (float)(*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4))) * 1.5 + - *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x6e); - if (pvVar11 == (void *)0x0) { - fVar30 = player->_damage; - } - else { - fVar30 = (float)(*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4))) * 1.5 + - *GHIDRA_CAST(pTVar31); - *GHIDRA_CAST(pTVar31) = fVar30; - } - if (0 < player->_grantedCollectibleCountdown) { - *GHIDRA_CAST(pTVar31) = fVar30 + 1.0; - } - extraBrimstoneCount = GetCollectibleNum(player,0x76,0); - extraBrimstoneCount = extraBrimstoneCount + -1; - local_4d0 = 0; - iVar4 = GetCollectibleNum(player,0x279,0); - local_470 = GHIDRA_CAST((float)iVar4); - iVar5 = GetCollectibleNum(player,0x2c4,0); - iVar6 = GetCollectibleNum(player,0x250,0); - iVar7 = GetCollectibleNum(player,0x23c,0); - iVar8 = GetCollectibleNum(player,0x213,0); - iVar9 = GetCollectibleNum(player,0x159,0); - iVar15 = GetCollectibleNum(player,0x148,0); - iVar16 = GetCollectibleNum(player,0x103,0); - iVar17 = GetCollectibleNum(player,0xd0,0); - iVar18 = GetCollectibleNum(player,0xce,0); - iVar19 = GetCollectibleNum(player,0xa5,0); - numOddMushroomLarge = GetCollectibleNum(player,0x79,0); - numMark = GetCollectibleNum(player,0x4f,0); - numGrowthHormones = GetCollectibleNum(player,0x46,0); - numPentagram = GetCollectibleNum(player,0x33,0); - numSteven = GetCollectibleNum(player,0x32,0); - piVar13 = GHIDRA_CAST(std)::max(); - iVar4 = *piVar13; - numSynthoilEffects = (GHIDRA_CAST((local_468)))->TemporaryEffects::GetCollectibleEffectNum(0x159); - temporaryEffects = local_468; - numDarkMatterEffects = (GHIDRA_CAST((local_468)))->TemporaryEffects::GetCollectibleEffectNum(0x103); - numGuillotineEffects = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0xce); - numOddMushroomEffects = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x79); - numGrowthHormonesEffects = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x46); - nullDamageUpCount = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x38); - local_460 = (ItemConfig_Item *) - ((float)nullDamageUpCount * 3.0 + - (float)(iVar5 + iVar6 + iVar7 + iVar8 + iVar9 + iVar15 + iVar16 + iVar17 + iVar18 + - iVar19 + numOddMushroomLarge + numMark + numGrowthHormones + numPentagram + - numSteven + iVar4 + numSynthoilEffects + numDarkMatterEffects + - numGuillotineEffects + numOddMushroomEffects + numGrowthHormonesEffects)); - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x42); - local_460 = (ItemConfig_Item *) - ((float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1dc8)))) + (float)iVar4 * 1.5 + (float)local_460); - iVar4 = GetCollectibleNum(player,0x2dc,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(player,0x2da,0); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.75 + (float)local_460)); - iVar4 = is_achievement_79_unlocked(player); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.75 + (float)local_460)); - bVar2 = HasCollectible(player,0x105,0); - isProptosisEffect = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x105); - iVar4 = GetCollectibleNum(player,0x29d,0); - iVar5 = GetCollectibleNum(player,0x14b,0); - iVar6 = GetCollectibleNum(player,0x133,0); - iVar7 = GetCollectibleNum(player,0xc5,0); - iVar8 = GetCollectibleNum(player,0x50,0); - iVar9 = GetCollectibleNum(player,4,0); - iVar15 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x2b4); - local_460 = (ItemConfig_Item *) - ((float)GHIDRA_INT((iVar15 + GHIDRA_UINT(bVar2) + GHIDRA_UINT(isProptosisEffect) + iVar4 + iVar5 + iVar6 - + iVar7 + iVar8 + iVar9)) * 0.5 + (float)local_460); - iVar4 = GetCollectibleNum(player,0x1cf,0); - iVar5 = GetCollectibleNum(player,0x1bd,0); - iVar6 = GetCollectibleNum(player,0xc9,0); - iVar7 = GetCollectibleNum(player,0xc1,0); - iVar8 = GetCollectibleNum(player,0xbd,0); - iVar9 = GetCollectibleNum(player,0x8a,0); - iVar15 = GetCollectibleNum(player,0x65,0); - iVar16 = GetCollectibleNum(player,0x3e,0); - iVar17 = GetCollectibleNum(player,0xc,0); - iVar18 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0xc9); - iVar19 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0xc); - local_460 = (ItemConfig_Item *) - ((float)(iVar19 + iVar4 + iVar5 + iVar6 + iVar7 + iVar8 + iVar9 + iVar15 + iVar16 + - iVar17 + iVar18) * 0.3 + (float)local_460); - iVar4 = GetCollectibleNum(player,0x167,0); - iVar5 = GetCollectibleNum(player,0xed,0); - iVar6 = GetCollectibleNum(player,0xe6,0); - iVar7 = GetCollectibleNum(player,5,0); - iVar8 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0xed); - pTVar31 = local_464; - *GHIDRA_CAST(local_464) = - (float)(iVar8 + iVar4 + iVar5 + iVar6 + iVar7) * 1.5 + (float)local_460 + - (float)local_470 + (float)local_470 + *GHIDRA_CAST(local_464); - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x36); - if (0 < iVar4) { - *GHIDRA_CAST(pTVar31) = ((float)iVar4 / 23.0) * ((float)iVar4 / 23.0) * 20.0 + *GHIDRA_CAST(pTVar31); - } - bVar2 = HasCollectible(player,0x2b6,0); - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = (float)player->_brokenHearts * 0.25 + *GHIDRA_CAST(pTVar31); - } - bVar2 = HasCollectible(player,0x3b,0); - if (bVar2 != 0) { - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x246); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.2)); - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x47); - *GHIDRA_CAST(pTVar31) = (float)iVar4 * 0.2 + (float)local_460 + *GHIDRA_CAST(pTVar31); - } - iVar4 = Game::Challenge(g_game); - if (iVar4 != 0) { - iVar4 = Game::Challenge(g_game); - challengeParams = Manager::GetChallengeParams(g_manager,iVar4); - *GHIDRA_CAST(pTVar31) = challengeParams->_addDamage + *GHIDRA_CAST(pTVar31); - } - bVar2 = HasCollectible(player,0x78,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x78), bVar2 != 0)) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) * 0.9 - 0.4; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x53); - if (bVar2 == 0) { - fVar30 = player->_damage; - } - else { - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x53); - fVar30 = (float)iVar4 + (float)iVar4 + *GHIDRA_CAST(pTVar31); - *GHIDRA_CAST(pTVar31) = fVar30; - } - if (0 < player->_coopBabyBuffTimers[0]) { - *GHIDRA_CAST(pTVar31) = fVar30 + 2.0; - } - local_460 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x19b); - if (local_460 != (void *)0x0) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - local_4d8 = 0x40a00000; - } - else { - local_4d8 = 0x42c80000; - } - local_4d4 = (float)*GHIDRA_CAST((GHIDRA_CAST(local_460) + 4)) * 0.5; - pfVar10 = GHIDRA_CAST(std)::min(); - *GHIDRA_CAST(pTVar31) = *pfVar10 + *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetTrinketEffect(0x3a); - if (pvVar11 != (void *)0x0) { - local_4e0 = 0x40a00000; - local_4dc = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 0.5; - pfVar10 = GHIDRA_CAST(std)::min(); - *GHIDRA_CAST(pTVar31) = *pfVar10 + *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x7e); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 1.2 + *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x22b); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 1.2 + *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x6f); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 0.25 + *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x31); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 0.5 + *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffect(0x30); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 0.35 + *GHIDRA_CAST(pTVar31); - } - pvVar11 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetTrinketEffect(0x28); - if (pvVar11 != (void *)0x0) { - *GHIDRA_CAST(pTVar31) = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 4)) * 1.8 + *GHIDRA_CAST(pTVar31); - } - bVar2 = HasTrinket(player,0x50,0); - if (bVar2 != 0) { - iVar4 = GetCollectibleNum(player,0x28e,0); - iVar5 = GetCollectibleNum(player,0x158,0); - iVar6 = GetCollectibleNum(player,0x153,0); - iVar7 = GetCollectibleNum(player,0x106,0); - iVar8 = GetCollectibleNum(player,0x104,0); - iVar9 = GetCollectibleNum(player,0xe6,0); - iVar15 = GetCollectibleNum(player,0xd8,0); - iVar16 = GetCollectibleNum(player,0xd7,0); - iVar17 = GetCollectibleNum(player,0x50,0); - iVar18 = GetCollectibleNum(player,0x4f,0); - iVar19 = GetTrinketMultiplier(player,0x11); - local_460 = (ItemConfig_Item *) - ((float)iVar19 + - (float)(iVar4 + iVar5 + iVar6 + iVar7 + iVar8 + iVar9 + iVar15 + iVar16 + iVar17 + - iVar18)); - iVar4 = GetTrinketMultiplier(player,0x16); - local_460 = GHIDRA_CAST((((float)iVar4 + (float)local_460) * 0.5)); - iVar4 = GetTrinketMultiplier(player,0x50); - *GHIDRA_CAST(local_464) = (float)iVar4 * (float)local_460 + *GHIDRA_CAST(local_464); - pTVar31 = local_464; - } - bVar2 = HasCollectible(player,0x197,0); - if (((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x197), bVar2 != 0)) && - (player->_purityState == 0)) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) + 4.0; - } - local_460 = GHIDRA_CAST(0x40600000); - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - entityList = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar13 = GHIDRA_CAST((GHIDRA_CAST((entityList)))->EntityList)::Size(); - local_460 = *GHIDRA_CAST((*piVar13 + 0x4c)); - fVar28 = (long double)(*(code *)local_460)(); - local_460 = GHIDRA_CAST((float)(fVar28 * (long double)3.5)); - } - pTVar31 = local_464; - local_4e8 = 0; - local_4e4 = *GHIDRA_CAST(local_464) * 1.2 + 1.0; - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - FUN_00431260(); - *GHIDRA_CAST(pTVar31) = fVar30 * (float)local_460; - bVar2 = HasCollectible(player,0xa9,0); - if (bVar2 != 0) { - bVar2 = HasCollectible(player,2,0); - if (((bVar2 == 0) && (bVar2 = HasCollectible(player,0x99,0), bVar2 == 0)) && - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(2), bVar2 == 0 && - ((bVar2 = HasWeaponType(player,0xe), bVar2 == 0 && - (bVar2 = HasCollectible(player,0xf5,0), bVar2 == 0)))))) { - fVar30 = *GHIDRA_CAST(pTVar31) + 4.0 + *GHIDRA_CAST(pTVar31) + 4.0; - } - else { - fVar30 = *GHIDRA_CAST(pTVar31) + 5.0; - } - *GHIDRA_CAST(pTVar31) = fVar30; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2); - if (bVar2 == 0) { - uVar25 = player->_playerType; - if (uVar25 == 5) { - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x7a); - if (bVar2 != 0) goto LAB_00766878; - uVar25 = player->_playerType; - } - if (uVar25 == 0x1a) { - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x6e); - if (bVar2 != 0) goto LAB_00766878; - uVar25 = player->_playerType; - } - if (uVar25 < 0x29) { - *GHIDRA_CAST(pTVar31) = (*GHIDRA_CAST((&DAT_00b6bce8 + uVar25 * 4)) + 1.0) * *GHIDRA_CAST(pTVar31); - } - } - else { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) * 1.5; - } -LAB_00766878: - if ((player->_variant == 1) && (player->_babySkin == 0x39)) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) * 1.5; - } - iVar4 = player->_playerType; - if ((iVar4 == 9) || (iVar4 == 0x1e)) { - fVar30 = player->_edenDamage + *GHIDRA_CAST(pTVar31); - *GHIDRA_CAST(pTVar31) = fVar30; - } - else { - fVar30 = player->_damage; - } - if (iVar4 == 0x13) { - fVar30 = fVar30 - 0.75; -LAB_007668df: - *GHIDRA_CAST(pTVar31) = fVar30; - } - else if (iVar4 == 0x14) { - fVar30 = fVar30 + 0.25; - goto LAB_007668df; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(100); - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) + 2.0; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - pEVar33 = player; - if (bVar2 != 0) { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) * 4.0; - } - if ((player->_playerType == 0x10) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x78), bVar2 != 0)) { - pEVar33->_damage = (pEVar33->_damage + 2.0) * 3.0; - } - fVar30 = (float)(pEVar33->_potatoPeelerBandageCounter + pEVar33->_potatoPeelerCounter) * 0.2 + - pEVar33->_damage; - pEVar33->_damage = fVar30; - if ((pEVar33->_hasCurseMistEffect == 0) && (pEVar33->_isCoopGhost == 0)) { - iVar4 = pEVar33->_damageModifier; - } - else { - iVar4 = 0; - } - fVar30 = (float)iVar4 + (*GHIDRA_CAST((GHIDRA_CAST(&((float)damageTearsBonus)) + 0x0))) + fVar30; - rawDamage = fVar30; - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_damage = *pfVar10; - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c0); - if (bVar2 != 0) { - fVar30 = pEVar33->_damage + 3.0; - pEVar33->_damage = fVar30; - } - FUN_00753870(); - pEVar33->_damage = fVar30 + pEVar33->_damage; - iVar4 = GetTrinketMultiplier(pEVar33,0x23); - pEVar33->_damage = (float)iVar4 + (float)iVar4 + pEVar33->_damage; - bVar2 = HasCollectible(pEVar33,0x201,0); - if (bVar2 != 0) { - pEVar33->_damage = pEVar33->_damage + 0.1; - } - itemConfig = Isaac::GetItemConfig(); - pIVar20 = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x29); - bVar2 = TemporaryEffects::has_item_effect(temporaryEffects,pIVar20); - if (bVar2 != 0) { - pEVar33->_damage = pEVar33->_damage + 7.0; - } - bVar2 = HasWeaponType(pEVar33,10); - if ((bVar2 != 0) && (bVar2 = HasCollectible(pEVar33,0x72,0), bVar2 != 0)) { - pEVar33->_damage = pEVar33->_damage + 4.0; - } - bVar2 = HasCollectible(pEVar33,0x19f,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x19f), bVar2 != 0)) { - pEVar33->_damage = pEVar33->_damage + pEVar33->_damage; - } - bVar2 = HasCollectible(pEVar33,0xb6,0); - if (bVar2 != 0) { - pEVar33->_damage = pEVar33->_damage * 2.3 + 1.0; - } - bVar2 = HasCollectible(pEVar33,0x3b,0); - if ((bVar2 != 0) && (bVar2 = HasCollectible(pEVar33,0x290,0), bVar2 != 0)) { - pEVar33->_damage = pEVar33->_damage * 1.4 + 1.0; - } - bVar2 = HasCollectible(pEVar33,0x23d,0); - if ((bVar2 != 0) || (0 < pEVar33->_hallowedGroundCountdown)) { - pEVar33->_damage = pEVar33->_damage * 1.2; - } - bVar2 = HasCollectible(pEVar33,0x1ed,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x1ed), bVar2 != 0)) { - local_460 = (ItemConfig_Item *) - (((pEVar33->_boneHearts * 2 - pEVar33->_redHearts) + pEVar33->_maxHearts) / 2); - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - pIVar20 = local_460; - if (cVar3 != '\0') { - pIVar20 = GHIDRA_CAST((GHIDRA_UINT(local_460) >> 3)); - } - fVar30 = (float)GHIDRA_INT(pIVar20) + (float)GHIDRA_INT(pIVar20); - pow_wrapper(); - pEVar33->_damage = fVar30 * 0.1 + pEVar33->_damage; - } - bVar2 = HasCollectible(pEVar33,0x9d,0); - if ((bVar2 != 0) && (isEffectsDisabled == 0)) { - bVar2 = HasCollectible(pEVar33,0x26b,0); - if ((bVar2 == 0) || (pEVar33->_playerType != 6)) { - fVar30 = 6.0; - } - else { - fVar30 = 10.0; - } - fVar30 = Math::clamp(0.0,fVar30,(float)GHIDRA_INT(pEVar33->_bloodLustCounter)); - pEVar33->_damage = fVar30 * 0.1 * fVar30 + fVar30 * 0.4 + pEVar33->_damage; - } - if ((((pEVar33->_playerType == 7) || (pEVar33->_playerType == 0x1c)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2), bVar2 != 0)) && - (bVar2 = HasCollectible(pEVar33,0x76,0), bVar2 == 0)) { - bVar2 = HasWeaponType(pEVar33,2); - if ((bVar2 == 0) || (bVar2 = HasCollectible(pEVar33,0x149,0), bVar2 == 0)) { - bVar2 = HasWeaponType(pEVar33,9); - if (bVar2 == 0) goto LAB_00766d4e; - fVar30 = pEVar33->_damage * 0.65; - } - else { - fVar30 = pEVar33->_damage * 0.5; - } - pEVar33->_damage = fVar30; - } -LAB_00766d4e: - bVar2 = HasWeaponType(pEVar33,2); - if (bVar2 == 0) { - bVar2 = HasWeaponType(pEVar33,9); - if ((bVar2 != 0) && (bVar2 = HasCollectible(pEVar33,0x76,0), bVar2 != 0)) goto LAB_00766d97; - } - else { - iVar4 = GetCollectibleNum(pEVar33,0x76,0); - if (iVar4 < 2) { -LAB_00766d97: - bVar2 = HasCollectible(pEVar33,0x44,0); - if (bVar2 == 0) goto LAB_00766dbe; - fVar30 = pEVar33->_damage * 1.5; - } - else { - fVar30 = pEVar33->_damage * 1.2; - } - pEVar33->_damage = fVar30; - } -LAB_00766dbe: - bVar2 = HasCollectible(pEVar33,0x213,0); - fVar30 = pEVar33->_damage; - if (bVar2 != 0) { - fVar30 = fVar30 * 1.5; - pEVar33->_damage = fVar30; - } - pEVar33->_meleeDamage = fVar30; - bVar2 = HasCollectible(pEVar33,0x95,0); - if (bVar2 != 0) { - bVar2 = HasWeaponType(pEVar33,1); - if (((bVar2 == 0) && (bVar2 = HasWeaponType(pEVar33,7), bVar2 == 0)) && - (bVar2 = HasWeaponType(pEVar33,0xe), bVar2 == 0)) { - fVar30 = pEVar33->_damage + 2.0; - } - else { - fVar30 = pEVar33->_damage + 40.0; - } - pEVar33->_damage = fVar30; - pEVar33->_meleeDamage = pEVar33->_meleeDamage + 2.0; - } - bVar2 = HasCollectible(pEVar33,4,0); - if ((((bVar2 != 0) || - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x22), bVar2 != 0 && - (bVar2 = HasCollectible(pEVar33,7,0), bVar2 != 0)))) || - (bVar2 = HasCollectible(pEVar33,0xc,0), bVar2 != 0)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xc), bVar2 != 0)) { - pEVar33->_damage = pEVar33->_damage * 1.5; - pEVar33->_meleeDamage = pEVar33->_meleeDamage * 1.5; - } - bVar2 = HasCollectible(pEVar33,0x136,0); - if (bVar2 != 0) { - pEVar33->_damage = pEVar33->_damage + pEVar33->_damage; - pEVar33->_meleeDamage = pEVar33->_meleeDamage + pEVar33->_meleeDamage; - } - bVar2 = HasCollectible(pEVar33,0x231,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x14a,0); - if (bVar2 != 0) { - pEVar33->_damage = pEVar33->_damage * 0.2; - fVar30 = pEVar33->_meleeDamage * 0.2; - goto LAB_00766f9a; - } - } - else { - pEVar33->_damage = pEVar33->_damage * 0.3; - fVar30 = pEVar33->_meleeDamage * 0.3; -LAB_00766f9a: - pEVar33->_meleeDamage = fVar30; - } - bVar2 = HasCollectible(pEVar33,0xf5,0); - if ((bVar2 != 0) || (pEVar33->_babySkin == 0x41)) { - pEVar33->_damage = pEVar33->_damage * 0.8; - pEVar33->_meleeDamage = pEVar33->_meleeDamage * 0.8; - } - bVar2 = HasCollectible(pEVar33,0x175,0); - pfVar10 = &pEVar33->_damage; - pfVar12 = &pEVar33->_meleeDamage; - if (bVar2 == 0) { - pEVar33->_deadEyeMisses = 0; - pEVar33->_deadEyeCharges = 0; - fVar30 = *pfVar10; - fVar32 = *pfVar12; - } - else { - fVar32 = (float)pEVar33->_deadEyeCharges * 0.125 + 1.0; - fVar30 = fVar32 * *pfVar10; - *pfVar10 = fVar30; - fVar32 = fVar32 * *pfVar12; - *pfVar12 = fVar32; - } - if (0 < pEVar33->_damageMultiplierStacks) { - fVar32 = pow(1.5,(float)GHIDRA_INT(pEVar33->_damageMultiplierStacks)); - fVar30 = fVar32 * pEVar33->_damage; - fVar32 = fVar32 * pEVar33->_meleeDamage; - } - fVar32 = pEVar33->_d8DamageModifier * fVar32; - fVar30 = pEVar33->_d8DamageModifier * fVar30; - pEVar33->_damage = fVar30; - pEVar33->_meleeDamage = fVar32; - if (((float)local_484 != 0.0) && (3.5 < fVar30)) { - pEVar33->_damage = (fVar30 - 3.5) * ((float)local_484 - 1.0) + fVar30; - pEVar33->_meleeDamage = (fVar32 - 3.5) * ((float)local_484 - 1.0) + fVar32; - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,1); - iVar4 = GetTrinketMultiplier(pEVar33,0x42); - pEVar33->_damage = (float)iVar4 * 0.5 + pEVar33->_damage; - if (pEVar33->_variant == 1) { - pEVar21 = GetMainPlayer(pEVar33); - cVar3 = CanShoot(pEVar21); - if (cVar3 == '\0') { - pEVar33->_damage = 3.5; - } - } - if ((pEVar33->_variant == 0) && (iVar4 = Game::Challenge(g_game), iVar4 != 0)) { - iVar4 = Game::Challenge(g_game); - challengeParams = Manager::GetChallengeParams(g_manager,iVar4); - if (challengeParams->_maxDamage != 0) { - local_4f0 = 0x42c80000; - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_damage = *pfVar10; - } - } - if (pEVar33->_variant == 1) { - if ((pEVar33->_babySkin == 0x3b) && - (pEVar21 = GHIDRA_CAST(__RTDynamicCast()), pEVar21 != GHIDRA_CAST(0x0))) { - iVar4 = GetTrinketMultiplier(pEVar21,0xb4); - pTVar31 = local_464; - if (iVar4 == 2) { - *GHIDRA_CAST(local_464) = *GHIDRA_CAST(local_464) * 0.75; - } - else { - if (iVar4 != 3) goto LAB_00767233; - *GHIDRA_CAST(local_464) = *GHIDRA_CAST(local_464) * 1.0; - } - } - else { -LAB_00767233: - *GHIDRA_CAST(local_464) = *GHIDRA_CAST(local_464) * 0.5; - pTVar31 = local_464; - } - } - else { - pTVar31 = GHIDRA_CAST(&pEVar33->_damage); - } - if (pEVar33->_isCoopGhost == 0) { - bVar2 = IsHologram(pEVar33); - if (bVar2 != 0) { - pEVar33->_damage = pEVar33->_damage * 0.25; - } - } - else { - *GHIDRA_CAST(pTVar31) = *GHIDRA_CAST(pTVar31) * 0.25; - } - bVar2 = Game::GetDebugFlag(g_game,3); - if (bVar2 != 0) { - pEVar33->_damage = pEVar33->_damage + 40.0; - pEVar33->_meleeDamage = pEVar33->_meleeDamage + 40.0; - } - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_damage = *pfVar10; - pfVar10 = GHIDRA_CAST(std)::max(); - game = g_game; - pEVar33->_meleeDamage = *pfVar10; - Game::GetField26614(game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - entityList = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar13 = GHIDRA_CAST((GHIDRA_CAST((entityList)))->EntityList)::Size(); - (**(code **)(*piVar13 + 0x68))(); - } - } - uVar25 = pEVar33->_cacheFlags; - if ((uVar25 & 4) != 0) { - if (isMistOrGhost == '\0') { - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - local_460 = GHIDRA_CAST((float)(*piVar13 - iVar4)); - pEVar33 = player; - } - else { - local_460 = GHIDRA_CAST(0x0); - } - eyeOfOccultCount = GetCollectibleNum(pEVar33,0x23c,0); - local_4f8 = 1; - evesMascaraCount = GetCollectibleNum(player,0x136,0); - local_500 = 1; - piVar13 = GHIDRA_CAST(std)::min(); - iVar4 = *piVar13; - iVar5 = GetCollectibleNum(player,0xb7,0); - pEVar33 = player; - iVar6 = GetCollectibleNum(player,0x156,0); - iVar7 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x156); - iVar8 = GetCollectibleNum(pEVar33,0x29d,0); - pEVar33 = player; - iVar9 = GetCollectibleNum(player,0x18d,0); - iVar15 = GetCollectibleNum(pEVar33,0x155,0); - iVar16 = GetCollectibleNum(pEVar33,0x153,0); - iVar17 = GetCollectibleNum(pEVar33,0xc2,0); - iVar18 = GetCollectibleNum(pEVar33,0xb0,0); - local_488 = GHIDRA_CAST(((float)(iVar18 + iVar8 + (((iVar5 - iVar4) - iVar6) - iVar7) + iVar9 + - iVar15 + iVar16 + iVar17) * 0.16)); - iVar4 = GetCollectibleNum(pEVar33,0x234,0); - iVar5 = GetCollectibleNum(pEVar33,0xff,0); - iVar6 = GetCollectibleNum(pEVar33,0x8f,0); - iVar7 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x8f); - local_470 = GHIDRA_CAST(((float)(iVar7 + iVar4 + iVar5 + iVar6) * 0.2)); - iVar4 = GetCollectibleNum(pEVar33,0xa5,0); - local_464 = (TemporaryEffects *) - ((float)iVar4 * 0.23 + 1.0 + (float)local_470 + (float)local_488 + - (float)local_460 * 0.15); - iVar4 = GetCollectibleNum(pEVar33,0xb6,0); - local_464 = GHIDRA_CAST(((float)local_464 - (float)iVar4 * 0.25)); - iVar4 = GetCollectibleNum(pEVar33,0xd5,0); - local_464 = GHIDRA_CAST(((float)local_464 - (float)iVar4 * 0.15)); - piVar13 = GHIDRA_CAST(std)::min(); - local_464 = GHIDRA_CAST(((float)local_464 - (float)*piVar13 * 0.5)); - iVar4 = GetCollectibleNum(pEVar33,0x150,0); - local_464 = GHIDRA_CAST(((float)local_464 - (float)iVar4 * 0.4)); - iVar4 = GetCollectibleNum(pEVar33,0x14b,0); - local_464 = GHIDRA_CAST(((float)local_464 - (float)iVar4 * 0.3)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x19f); - local_464 = GHIDRA_CAST(((float)local_464 - (float)iVar4 * 0.3)); - iVar4 = GetCollectibleNum(pEVar33,0x149,0); - if ((pEVar33->_hasCurseMistEffect == 0) && (pEVar33->_isCoopGhost == 0)) { - iVar5 = pEVar33->_shotSpeedModifier; - } - else { - iVar5 = 0; - } - fVar30 = ((float)iVar5 + shotSpeedBonus) * 0.2 + (float)iVar4 * 0.2 + (float)local_464; - pEVar33->_shotspeed = fVar30; - bVar2 = HasTrinket(pEVar33,0x65,0); - if ((bVar2 != 0) && (isActiveEmpty != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,0x65); - fVar30 = (float)iVar4 * 0.3 + pEVar33->_shotspeed; - pEVar33->_shotspeed = fVar30; - } - bVar2 = HasTrinket(pEVar33,100,0); - if ((bVar2 != 0) && (isActiveFullyCharged != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,100); - fVar30 = (float)iVar4 * 0.1 + pEVar33->_shotspeed; - pEVar33->_shotspeed = fVar30; - } - iVar4 = pEVar33->_playerType; - if (iVar4 == 6) { - fVar30 = pEVar33->_shotspeed + 0.31; -LAB_007677a7: - pEVar33->_shotspeed = fVar30; - } - else { - if ((iVar4 == 9) || (iVar4 == 0x1e)) { - fVar30 = pEVar33->_edenShotSpeed + pEVar33->_shotspeed; - goto LAB_007677a7; - } - if (iVar4 == 0x13) { - fVar30 = pEVar33->_shotspeed + 0.15; - goto LAB_007677a7; - } - if (iVar4 == 0x14) { - fVar30 = pEVar33->_shotspeed - 0.15; - goto LAB_007677a7; - } - } - FUN_007538b0(); - fVar30 = fVar30 * 0.2 + pEVar33->_shotspeed; - pEVar33->_shotspeed = fVar30; - if (0 < pEVar33->_coopBabyBuffTimers[3]) { - pEVar33->_shotspeed = fVar30 + 0.5; - } - bVar2 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba); - if (bVar2 != 0) { - pEVar33->_shotspeed = pEVar33->_shotspeed + 0.2; - } - itemConfig = Isaac::GetItemConfig(); - pIVar20 = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x2a); - bVar2 = TemporaryEffects::has_item_effect(&pEVar33->_temporaryeffects,pIVar20); - if (bVar2 != 0) { - pEVar33->_shotspeed = pEVar33->_shotspeed - 1.0; - } - iVar4 = GetTrinketMultiplier(pEVar33,0x1b); - pEVar33->_shotspeed = (float)iVar4 * 0.5 + pEVar33->_shotspeed; - iVar4 = GetCollectibleNum(pEVar33,0x22a,0); - pEVar33->_shotspeed = (float)iVar4 * 0.2 + pEVar33->_shotspeed; - bVar2 = HasCollectible(pEVar33,5,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(5), bVar2 != 0)) - { - pEVar33->_shotspeed = pEVar33->_shotspeed * 1.6; - } - pfVar10 = &pEVar33->_shotspeed; - bVar2 = HasCollectible(pEVar33,0x95,0); - if (bVar2 == 0) { - fVar30 = pEVar33->_shotspeed; - } - else { - fVar30 = *pfVar10 * 0.8; - *pfVar10 = fVar30; - } - if ((pEVar33->_variant == 1) && (pEVar33->_babySkin == 0x15)) { - *pfVar10 = fVar30 * 0.5; - } - iVar4 = GetTrinketMultiplier(pEVar33,0x42); - fVar30 = *pfVar10 - (float)iVar4 * 0.5; - *pfVar10 = fVar30; - if (((float)local_484 != 1.0) && (0.0 < fVar30 - 1.0)) { - *pfVar10 = ((float)local_484 - 1.0) * (fVar30 - 1.0) + fVar30; - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,4); - if ((pEVar33->_variant == 0) && (iVar4 = Game::Challenge(g_game), iVar4 != 0)) { - iVar4 = Game::Challenge(g_game); - challengeParams = Manager::GetChallengeParams(g_manager,iVar4); - if (challengeParams->_minShotSpeed != 0) { - local_504 = 0x3f800000; - pfVar12 = GHIDRA_CAST(std)::min(); - *pfVar10 = *pfVar12; - } - } - iVar4 = get_seeded_variant(pEVar33); - if (iVar4 != -1) { - local_508 = 0x40400000; - pfVar12 = GHIDRA_CAST(std)::max(); - *pfVar10 = *pfVar12; - } - pfVar12 = GHIDRA_CAST(std)::max(); - *pfVar10 = *pfVar12; - uVar25 = pEVar33->_cacheFlags; - temporaryEffects = local_468; - } - if ((uVar25 & 8) == 0) { - temporaryEffects = local_468; - pEVar33 = player; - } - else { - pfVar10 = &pEVar33->_tearrange; - *pfVar10 = 260.0; - pEVar33->_tearheight = -23.75; - pEVar33->_tearfallspeed = 0.0; - pEVar33->_tearfallaccel = 0.0; - iVar4 = pEVar33->_playerType; - if ((((((iVar4 == 2) || (iVar4 == 8)) || (iVar4 == 7)) || ((iVar4 == 0x17 || (iVar4 == 0x18)))) - || (iVar4 == 0x1d)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2), bVar2 != 0)) { - fVar30 = *pfVar10 - 80.0; -LAB_00767b03: - *pfVar10 = fVar30; - } - else { - iVar4 = player->_playerType; - if ((iVar4 == 6) || (iVar4 == 0x1b)) { -LAB_00767ac2: - fVar30 = *pfVar10 - 60.0; - goto LAB_00767b03; - } - if ((iVar4 == 9) || (iVar4 == 0x1e)) { - fVar30 = player->_edenTearRange + *pfVar10; - goto LAB_00767b03; - } - if (iVar4 == 0x13) goto LAB_00767ac2; - if (iVar4 == 0x14) { - fVar30 = *pfVar10 + 60.0; - goto LAB_00767b03; - } - } - if ((player->_hasCurseMistEffect == 0) && (player->_isCoopGhost == 0)) { - local_460 = GHIDRA_CAST(player->_tearRangeModifier); - } - else { - local_460 = GHIDRA_CAST(0x0); - } - if (isMistOrGhost == '\0') { - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - local_470 = GHIDRA_CAST(((float)iVar4 * 0.5 - (float)*piVar13 * 0.4)); - } - else { - local_470 = GHIDRA_CAST(0x0); - } - pEVar33 = player; - iVar4 = GetCollectibleNum(player,0x47,0); - iVar5 = GetCollectibleNum(pEVar33,0xc,0); - iVar6 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x47); - iVar7 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0xc); - local_460 = (ItemConfig_Item *) - ((float)(iVar7 + GHIDRA_INT(local_460) + iVar4 + iVar5 + iVar6) + rangeBonus); - iVar4 = GetCollectibleNum(pEVar33,0x1e,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x1f,0); - local_460 = GHIDRA_CAST(((float)iVar4 * 1.5 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x18d,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x1d,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460 + (float)local_470)); - iVar4 = GetCollectibleNum(pEVar33,0x153,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x159,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x159); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0xe,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0xe); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x172,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0xbd,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x1c7,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x163,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x293,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x29d,0); - local_460 = GHIDRA_CAST((((float)iVar4 + (float)local_460) * 100.0)); - iVar4 = GetCollectibleNum(pEVar33,0x1ce,0); - iVar5 = GetCollectibleNum(pEVar33,0x1c5,0); - iVar6 = GetCollectibleNum(pEVar33,0xc5,0); - iVar7 = GetCollectibleNum(pEVar33,0x79,0); - iVar8 = GetCollectibleNum(pEVar33,0x6e,0); - iVar9 = GetCollectibleNum(pEVar33,0x65,0); - iVar15 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x79); - local_46c = (Entity_Player *) - ((float)(iVar15 + iVar4 + iVar5 + iVar6 + iVar7 + iVar8 + iVar9) * 60.0 + - (float)local_460); - iVar4 = GetCollectibleNum(pEVar33,0x150,0); - local_46c = GHIDRA_CAST(((float)local_46c - (float)iVar4 * 60.0)); - iVar4 = GetCollectibleNum(pEVar33,0x171,0); - local_460 = GHIDRA_CAST(((float)iVar4 * 120.0 + (float)local_46c)); - iVar4 = GetCollectibleNum(pEVar33,0x18a,0); - fVar30 = (float)iVar4 * 120.0 + (float)local_460 + pEVar33->_tearrange; - pEVar33->_tearrange = fVar30; - bVar2 = HasCollectible(pEVar33,0x23c,0); - if (bVar2 != 0) { - pEVar33->_tearheight = pEVar33->_tearheight - 8.0; - fVar30 = pEVar33->_tearrange + 80.0; - pEVar33->_tearrange = fVar30; - } - bVar2 = HasCollectible(pEVar33,0x252,0); - if (bVar2 != 0) { - fVar30 = pEVar33->_tearheight - 8.0; - pEVar33->_tearheight = fVar30; - } - bVar2 = HasCollectible(pEVar33,0x256,0); - temporaryEffects = &pEVar33->_temporaryeffects; - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2b0), bVar2 != 0)) { - fVar30 = pEVar33->_tearheight * 0.4; - pEVar33->_tearheight = fVar30; - } - bVar2 = HasCollectible(pEVar33,0x2cc,0); - if (bVar2 != 0) { - fVar30 = (float)((pEVar33->_keepersSackBonus / 3 + 1) / 3) * 10.0 + pEVar33->_tearrange; - pEVar33->_tearrange = fVar30; - } - FUN_007538a0(); - pEVar33->_tearrange = fVar30 * 60.0 + pEVar33->_tearrange; - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - pfVar10 = &pEVar33->_tearrange; - if (bVar2 == 0) { - fVar30 = pEVar33->_tearrange; - } - else { - pEVar33->_tearfallaccel = 0.8; - pEVar33->_tearheight = pEVar33->_tearheight - 80.0; - fVar30 = *pfVar10 + 80.0; - *pfVar10 = fVar30; - } - if (0 < pEVar33->_coopBabyBuffTimers[3]) { - *pfVar10 = fVar30 + 80.0; - } - bVar2 = HasTrinket(pEVar33,0x65,0); - if ((bVar2 != 0) && (isActiveEmpty != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,0x65); - pEVar33->_tearrange = (float)iVar4 * 60.0 + pEVar33->_tearrange; - } - bVar2 = HasTrinket(pEVar33,100,0); - if ((bVar2 != 0) && (isActiveFullyCharged != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,100); - pEVar33->_tearrange = (float)iVar4 * 30.0 + pEVar33->_tearrange; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba); - if (bVar2 != 0) { - pEVar33->_tearrange = pEVar33->_tearrange + 60.0; - } - itemConfig = Isaac::GetItemConfig(); - pIVar20 = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x29); - bVar2 = TemporaryEffects::has_item_effect(temporaryEffects,pIVar20); - if (bVar2 != 0) { - pEVar33->_tearheight = pEVar33->_tearheight - 30.0; - pEVar33->_tearrange = pEVar33->_tearrange + 120.0; - } - bVar2 = HasCollectible(pEVar33,0x197,0); - if (((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x197), bVar2 != 0)) && - (pEVar33->_purityState == 3)) { - pEVar33->_tearrange = pEVar33->_tearrange + 120.0; - } - bVar2 = HasCollectible(pEVar33,0x95,0); - if ((bVar2 == 0) && (bVar2 = HasCollectible(pEVar33,0x213,0), bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,0xe0,0); - if (bVar2 != 0) goto LAB_00768248; - } - else { - bVar2 = HasCollectible(pEVar33,0xe5,0); - if (bVar2 == 0) { - pEVar33->_tearfallaccel = 0.8; -LAB_00768248: - pEVar33->_tearrange = pEVar33->_tearrange * 0.8; - } - } - bVar2 = HasCollectible(pEVar33,0xe9,0); - if (bVar2 != 0) { - pEVar33->_tearrange = pEVar33->_tearrange + 260.0; - pEVar33->_tearfallaccel = pEVar33->_tearfallaccel * 0.01; - } - bVar2 = HasCollectible(pEVar33,0x133,0); - if ((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 0x133)) { - pEVar33->_tearrange = pEVar33->_tearrange + 30.0; - } - bVar2 = HasCollectible(pEVar33,0xd6,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xd6), bVar2 != 0)) { - pEVar33->_tearrange = pEVar33->_tearrange + 60.0; - } - bVar2 = HasTrinket(pEVar33,0x1a,0); - if ((bVar2 != 0) && (bVar2 = HasWeaponType(pEVar33,1), bVar2 != 0)) { - iVar4 = GetTrinketMultiplier(pEVar33,0x1a); - pEVar33->_tearrange = (float)iVar4 * 60.0 + pEVar33->_tearrange; - } - bVar2 = HasTrinket(pEVar33,0x60,0); - if (bVar2 != 0) { - iVar4 = GetTrinketMultiplier(pEVar33,0x60); - pEVar33->_tearrange = (float)iVar4 * 60.0 + pEVar33->_tearrange; - } - iVar4 = Game::Challenge(g_game); - if (iVar4 != 0) { - iVar4 = Game::Challenge(g_game); - challengeParams = Manager::GetChallengeParams(g_manager,iVar4); - if (challengeParams->_bigRange != 0) { - pEVar33->_tearrange = pEVar33->_tearrange + 400.0; - } - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xc0); - if (bVar2 != 0) { - pEVar33->_tearheight = pEVar33->_tearheight + pEVar33->_tearheight; - pEVar33->_tearfallspeed = pEVar33->_tearfallspeed * 0.5; - pEVar33->_tearrange = pEVar33->_tearrange + 120.0; - } - bVar2 = HasTrinket(pEVar33,0x41,0); - if (bVar2 != 0) { - iVar4 = GetTrinketMultiplier(pEVar33,0x41); - pEVar33->_tearheight = ((float)iVar4 + (float)iVar4) * pEVar33->_tearheight; - iVar4 = GetTrinketMultiplier(pEVar33,0x41); - pEVar33->_tearfallspeed = (float)iVar4 * 0.5 * pEVar33->_tearfallspeed; - iVar4 = GetTrinketMultiplier(pEVar33,0x41); - pEVar33->_tearrange = (float)iVar4 * 120.0 + pEVar33->_tearrange; - } - bVar2 = HasCollectible(pEVar33,6,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(6), bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,0x1b8,0); - if (bVar2 != 0) { - pEVar33->_tearheight = pEVar33->_tearheight + 18.0; - } - } - else { - pEVar33->_tearheight = pEVar33->_tearheight + 18.0; - local_50c = 0x43480000; - rangeAboveMin = pEVar33->_tearrange - 60.0; - pfVar10 = GHIDRA_CAST(std)::max(); - scaledRange = *pfVar10 * 0.8; - pfVar10 = GHIDRA_CAST(std)::min(); - pEVar33->_tearrange = *pfVar10; - } - bVar2 = HasCollectible(pEVar33,5,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(5), bVar2 != 0)) { - pEVar33->_tearrange = pEVar33->_tearrange + pEVar33->_tearrange + 60.0; - } - iVar4 = get_seeded_variant(pEVar33); - pfVar10 = &pEVar33->_tearrange; - if (iVar4 == 5) { - fVar30 = *pfVar10 + 200.0; - } - else { - fVar30 = pEVar33->_tearrange; - } - fVar30 = fVar30 * pEVar33->_d8RangeModifier; - *pfVar10 = fVar30; - if (((float)local_484 != 1.0) && (260.0 < fVar30)) { - *pfVar10 = (fVar30 - 260.0) * ((float)local_484 - 1.0) + fVar30; - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,8); - if (pEVar33->_tearrange <= 40.0 && pEVar33->_tearrange != 40.0) { - pEVar33->_tearrange = 40.0; - } - if (0.0 < pEVar33->_tearfallaccel) { - pEVar33->_tearfallaccel = pEVar33->_shotspeed * pEVar33->_shotspeed * pEVar33->_tearfallaccel; - } - } - uVar25 = pEVar33->_cacheFlags; - if ((uVar25 & 0x10) != 0) { - _DAT_00c5c3d4 = pEVar33->_edenSpeed; - local_480 = GHIDRA_CAST(0x0); - if (GHIDRA_UINT(pEVar33->_playerType) < 0x29) { - local_480 = *GHIDRA_CAST((&DAT_00c5c3b0 + pEVar33->_playerType * 4)); - } - _DAT_00c5c428 = _DAT_00c5c3d4; - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2); - if (bVar2 != 0) { - local_480 = DAT_00c5c3cc; - } - if (isMistOrGhost == '\0') { - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.5 - (float)*piVar13 * 0.4)); - temporaryEffects = local_468; - pEVar33 = player; - } - else { - local_460 = GHIDRA_CAST(0x0); - } - iVar4 = is_achievement_79_unlocked(pEVar33); - if (iVar4 < 1) { - local_46c = GHIDRA_CAST(GetCollectibleNum(pEVar33,0x8f,0)); - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x8f); - local_46c = GHIDRA_CAST((GHIDRA_INT(local_46c) + iVar4)); - } - else { - local_46c = GHIDRA_CAST(0x0); - } - iVar4 = GetCollectibleNum(pEVar33,0xe,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x10))) = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0xe) - ; - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x10))) = iVar4 + (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x10))); - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x14))) = 1; - iVar4 = GetCollectibleNum(pEVar33,0xd,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x18))) = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0xd) - ; - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x18))) = iVar4 + (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x18))); - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x1c))) = 1; - iVar4 = GetCollectibleNum(pEVar33,0xe8,0); - iVar5 = GetCollectibleNum(pEVar33,0x77,0); - iVar6 = GetCollectibleNum(pEVar33,0x1c,0); - iVar7 = GetCollectibleNum(pEVar33,0x1b,0); - iVar8 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x42); - local_460 = (ItemConfig_Item *) - ((float)(iVar8 + iVar4 + iVar5 + iVar6 + iVar7) + (float)local_460); - iVar4 = GetCollectibleNum(pEVar33,0x154,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0xc,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0xc); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x47,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x47); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x65,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x7a); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x78,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x78); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460 + (float)GHIDRA_INT(local_46c))); - iVar4 = GetCollectibleNum(pEVar33,0x52,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x23b,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetNullEffectNum(0x6e); - local_470 = GHIDRA_CAST((((float)iVar4 + (float)local_460) * 0.3)); - iVar4 = GetCollectibleNum(pEVar33,0x46,0); - iVar5 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x46); - local_460 = GHIDRA_CAST(((float)(iVar4 + iVar5) * 0.5)); - iVar4 = GetCollectibleNum(pEVar33,0x24e,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x2c0); - local_460 = GHIDRA_CAST((((float)iVar4 + (float)local_460) * 0.4)); - piVar13 = GHIDRA_CAST(std)::min(); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(std)::min(); - iVar6 = GetCollectibleNum(player,0x5a,0); - iVar5 = *piVar13; - iVar7 = GetCollectibleNum(player,0x81,0); - iVar8 = GetCollectibleNum(player,0x79,0); - iVar9 = (GHIDRA_CAST((local_468)))->TemporaryEffects::GetCollectibleEffectNum(0x79); - iVar15 = GetCollectibleNum(player,0x29d,0); - iVar16 = GetCollectibleNum(player,0xbd,0); - iVar17 = GetCollectibleNum(player,0x4f,0); - iVar18 = (GHIDRA_CAST((local_468)))->TemporaryEffects::GetCollectibleEffectNum(0x2b0); - pEVar33 = player; - local_460 = (ItemConfig_Item *) - ((float)(iVar18 + ((((iVar5 - iVar6) - iVar7) - iVar8) - iVar9) + iVar15 + iVar16 + - iVar17) * 0.2 + - (float)iVar4 * 0.3 + (float)local_480 + 1.0 + (float)local_460 + (float)local_470); - iVar4 = GetCollectibleNum(player,0x1bd,0); - if ((pEVar33->_hasCurseMistEffect == 0) && (pEVar33->_isCoopGhost == 0)) { - iVar5 = pEVar33->_speedModifier; - } - else { - iVar5 = 0; - } - pEVar33->_movespeed = ((float)iVar5 + speedBonus) * 0.2 + (float)iVar4 * 0.1 + (float)local_460; - if ((0x28 < GHIDRA_UINT(pEVar33->_playerType)) || - (0.0 <= *GHIDRA_CAST((&DAT_00c5c3b0 + pEVar33->_playerType * 4)))) { - bVar2 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x3e); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x41), bVar2 != 0)) { - pEVar33->_movespeed = pEVar33->_movespeed - 0.1; - } - } - temporaryEffects = &pEVar33->_temporaryeffects; - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x36); - if (0 < iVar4) { - pEVar33->_movespeed = (float)iVar4 * 0.05 + pEVar33->_movespeed; - } - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x246); - local_460 = GHIDRA_CAST(((float)iVar4 * 0.03)); - iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetNullEffectNum(0x47); - fVar30 = pEVar33->_movespeed - ((float)iVar4 * 0.06 + (float)local_460); - pEVar33->_movespeed = fVar30; - bVar2 = HasCollectible(pEVar33,0x252,0); - if (bVar2 != 0) { - fVar30 = Math::lerp(-0.3,0.2,pEVar33->_jupiterCharge,0); - fVar30 = fVar30 + pEVar33->_movespeed; - pEVar33->_movespeed = fVar30; - } - bVar2 = HasCollectible(pEVar33,0x2b7,0); - if ((bVar2 != 0) && (isEffectsDisabled == 0)) { - fVar32 = Math::clamp(0.0,6.0,(float)GHIDRA_INT(pEVar33->_bloodLustCounter)); - fVar30 = fVar32 * 0.05; - pEVar33->_movespeed = fVar32 * 0.02 * fVar32 + fVar30 + pEVar33->_movespeed; - } - bVar2 = HasCollectible(pEVar33,0x2cc,0); - if (bVar2 != 0) { - fVar30 = (float)(pEVar33->_keepersSackBonus / 9) * 0.03 + pEVar33->_movespeed; - pEVar33->_movespeed = fVar30; - } - FUN_00753890(); - pEVar33->_movespeed = fVar30 * 0.2 + pEVar33->_movespeed; - bVar2 = HasTrinket(pEVar33,0x65,0); - if ((bVar2 != 0) && (isActiveEmpty != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,0x65); - pEVar33->_movespeed = (float)iVar4 * 0.5 + pEVar33->_movespeed; - } - bVar2 = HasTrinket(pEVar33,100,0); - if ((bVar2 != 0) && (isActiveFullyCharged != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,100); - pEVar33->_movespeed = (float)iVar4 * 0.25 + pEVar33->_movespeed; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x4d); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x12a), bVar2 != 0)) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.28; - } - bVar2 = HasTrinket(pEVar33,0x25,0); - if (bVar2 == 0) { - fVar30 = pEVar33->_movespeed; - } - else { - iVar4 = GetTrinketMultiplier(pEVar33,0x25); - fVar30 = (float)iVar4 * 0.15 + pEVar33->_movespeed; - pEVar33->_movespeed = fVar30; - } - if (0 < pEVar33->_coopBabyBuffTimers[2]) { - pEVar33->_movespeed = fVar30 + 0.15; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x53); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_movespeed - 0.18; - } - bVar2 = HasCollectible(pEVar33,0xe6,0); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.2; - } - bVar2 = HasPlayerForm(pEVar33,5); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.15; - } - bVar2 = HasPlayerForm(pEVar33,0xe); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.2; - } - bVar2 = HasCollectible(pEVar33,0x82,0); - if ((bVar2 != 0) || (bVar2 = HasCollectible(pEVar33,0xb5,0), bVar2 != 0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(familiarList)) + 0x20))) = 0x3fc00000; - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_movespeed = *pfVar10; - } - bVar2 = HasCollectible(pEVar33,299,0); - if ((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 299)) { - pEVar33->_movespeed = pEVar33->_movespeed - 0.3; - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(299); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_taurusSpeedBonus + pEVar33->_movespeed; - } - } - bVar2 = HasCollectible(pEVar33,300,0); - if ((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 300)) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.25; - } - bVar2 = HasCollectible(pEVar33,0x132,0); - if ((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 0x132)) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.2; - } - bVar2 = HasCollectible(pEVar33,0x133,0); - if ((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 0x133)) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.1; - } - bVar2 = HasCollectible(pEVar33,0x13a,0); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_movespeed - 0.4; - } - bVar2 = HasCollectible(pEVar33,0x197,0); - if (((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x197), bVar2 != 0)) && - (pEVar33->_purityState == 2)) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.5; - } - itemConfig = Isaac::GetItemConfig(); - pIVar20 = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x2a); - bVar2 = TemporaryEffects::has_item_effect(temporaryEffects,pIVar20); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.5; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x32); - if (bVar2 != 0) { - pEVar33->_movespeed = pEVar33->_movespeed + 0.5; - } - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c1); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x1f1); - if (bVar2 != 0) { - fVar30 = pEVar33->_movespeed + 0.5; - goto LAB_00769200; - } - } - else { - fVar30 = pEVar33->_movespeed + 1.0; -LAB_00769200: - pEVar33->_movespeed = fVar30; - } - pfVar10 = &pEVar33->_movespeed; - fVar30 = pEVar33->_d8SpeedModifier * *pfVar10; - *pfVar10 = fVar30; - if (((float)local_484 != 1.0) && (1.0 < fVar30)) { - *pfVar10 = (fVar30 - 1.0) * ((float)local_484 - 1.0) + fVar30; - } - entityList = GHIDRA_CAST(FUN_00421780()); - iVar4 = (GHIDRA_CAST((entityList)))->EntityList::Size(); - if (iVar4 == 0x2b) { - pEVar33->_movespeed = pEVar33->_movespeed - 1.0; - } - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - entityList = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar13 = GHIDRA_CAST((GHIDRA_CAST((entityList)))->EntityList)::Size(); - (**(code **)(*piVar13 + 100))(); - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x10); - uVar25 = pEVar33->_cacheFlags; - } - if ((uVar25 & 0x20) == 0) { - local_464 = &pEVar33->_temporaryeffects; - } - else { - pEVar33->_tearFlags = g_tearFlagsNone; - bVar2 = HasCollectible(pEVar33,0x23c,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x23c), bVar2 != 0)) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagOccult); - } - bVar2 = HasCollectible(pEVar33,0x254,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x254), bVar2 != 0)) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagIce); - } - bVar2 = HasCollectible(pEVar33,0x250,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x250), bVar2 != 0)) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagRock); - } - bVar2 = HasTrinket(pEVar33,0x90,0); - if (bVar2 != 0) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagTurnHorizontal); - } - bVar2 = HasCollectible(pEVar33,0x23a,0); - if (bVar2 != 0) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagRainbow); - } - bVar2 = HasCollectible(pEVar33,0xb6,0); - if (((((bVar2 != 0) || (bVar2 = HasCollectible(pEVar33,3,0), bVar2 != 0)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xc0), bVar2 != 0)) || - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(3), bVar2 != 0 || - (bVar2 = HasCollectible(pEVar33,0x14b,0), bVar2 != 0)))) || - (((pEVar33->_variant == 1 && (pEVar33->_babySkin == 4)) || - (0 < pEVar33->_hallowedGroundCountdown)))) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagHoming); - } - local_468 = GHIDRA_CAST(&pEVar33->_tearFlags); - local_464 = local_468; - bVar2 = HasCollectible(pEVar33,0x84,0); - if (bVar2 != 0) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagGrow); - local_468 = GHIDRA_CAST(&pEVar33->_tearFlags); - } - bVar2 = HasCollectible(pEVar33,0x20c,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_464))))->BitSet128::operator__(&g_tearFlagLaser); - } - bVar2 = HasCollectible(pEVar33,0x105,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x105), bVar2 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_464))))->BitSet128::operator__(&g_tearFlagShrink); - } - bVar2 = HasCollectible(pEVar33,0xb9,0); - if ((((((bVar2 != 0) || (bVar2 = HasCollectible(pEVar33,0x73,0), bVar2 != 0)) || - (bVar2 = HasCollectible(pEVar33,0x9f,0), bVar2 != 0)) || - (((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x73), bVar2 != 0 || - (bVar2 = HasWeaponType(pEVar33,8), bVar2 != 0)) || - ((bVar2 = HasCollectible(pEVar33,0x150,0), bVar2 != 0 || - ((bVar2 = HasCollectible(pEVar33,0x17b,0), bVar2 != 0 || - (bVar2 = HasCollectible(pEVar33,0x166,0), bVar2 != 0)))))))) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x166), bVar2 != 0)) || - (((((iVar4 = pEVar33->_playerType, iVar4 == 10 || (iVar4 == 0x1f)) || (iVar4 == 0x27)) || - (((pEVar33->_variant == 1 && (pEVar33->_babySkin == 0x3b)) || - ((iVar4 == 0x11 || ((pEVar33->_variant == 1 && (pEVar33->_babySkin == 0x3a)))))))) || - ((pEVar33->_isCoopGhost != 0 || - ((((iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x2a5), iVar4 == 1 - || (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x42), bVar2 != 0)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x65), bVar2 != 0)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x70), bVar2 != 0)))))))) { - (GHIDRA_CAST((GHIDRA_CAST(local_464))))->BitSet128::operator__(&g_tearFlagSpectral); - } - bVar2 = HasCollectible(pEVar33,0x30,0); - if (((((bVar2 != 0) || (bVar2 = HasCollectible(pEVar33,0xed,0), bVar2 != 0)) || - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xed), bVar2 != 0 || - ((bVar2 = HasCollectible(pEVar33,0x132,0), bVar2 != 0 || - (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 0x132)))))) || - (bVar2 = HasWeaponType(pEVar33,8), bVar2 != 0)) || - (bVar2 = HasCollectible(pEVar33,0x150,0), bVar2 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_464))))->BitSet128::operator__(&g_tearFlagPiercing); - } - bVar2 = HasCollectible(pEVar33,0xa9,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_464))))->BitSet128::operator__(&g_tearFlagPersistent); - local_468 = local_464; - } - bVar2 = HasCollectible(pEVar33,0x131,0); - if ((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 0x131)) { - (GHIDRA_CAST((GHIDRA_CAST(local_464))))->BitSet128::operator__(&g_tearFlagPoison); - } - bVar2 = HasCollectible(pEVar33,0x68,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_464))))->BitSet128::operator__(&g_tearFlagSplit); - } - bVar2 = HasCollectible(pEVar33,5,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(5), bVar2 != 0)) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagBoomerang); - } - bVar2 = HasTrinket(pEVar33,10,0); - if (bVar2 != 0) { - flagsResult = BitSet128::operator_or(&wiggleWormFlags,&g_tearFlagWiggle,&g_tearFlagSpectral); - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasTrinket(pEVar33,0x1a,0); - if (bVar2 != 0) { - flagsResult = BitSet128::operator_or(&hookWormFlags,&g_tearFlagSquare,&g_tearFlagSpectral); - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasCollectible(pEVar33,0x95,0); - if ((bVar2 != 0) && - ((bVar2 = HasWeaponType(pEVar33,8), bVar2 == 0 || - (bVar2 = HasCollectible(pEVar33,0x21c,0), bVar2 != 0)))) { - flagsResult = BitSet128::operator_or(&ipecacFlags,&g_tearFlagExplosive,&g_tearFlagPoison); - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasCollectible(pEVar33,0xe9,0); - if (bVar2 != 0) { - flagsResult = BitSet128::operator_or(&tinyPlanetFlags,&g_tearFlagOrbit,&g_tearFlagSpectral); - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasCollectible(pEVar33,0xde,0); - if ((((bVar2 != 0) && (bVar2 = HasWeaponType(pEVar33,8), bVar2 == 0)) && - (bVar2 = HasWeaponType(pEVar33,7), bVar2 == 0)) && - ((bVar2 = HasWeaponType(pEVar33,1), bVar2 == 0 || - ((bVar2 = HasCollectible(pEVar33,0x13c,0), bVar2 == 0 && - (bVar2 = HasCollectible(pEVar33,0x45,0), bVar2 == 0)))))) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagWait); - } - bVar2 = HasCollectible(pEVar33,0xe0,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagQuadsplit); - } - bVar2 = HasCollectible(pEVar33,0xdd,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagBounce); - } - bVar2 = HasCollectible(pEVar33,0x13b,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagAttractor); - } - bVar2 = HasTrinket(pEVar33,9,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagPulse); - } - bVar2 = HasCollectible(pEVar33,0x135,0); - if (((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 0x135)) || - ((bVar2 = HasCollectible(pEVar33,0x167,0), bVar2 != 0 || - ((bVar2 = HasTrinket(pEVar33,0x4d,0), bVar2 != 0 || - (bVar2 = HasCollectible(pEVar33,0x250,0), bVar2 != 0)))))) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagKnockback); - } - bVar2 = HasTrinket(pEVar33,0xb,0); - if (bVar2 != 0) { - flagsResult = BitSet128::operator_or(&ringWormFlags,&g_tearFlagSpiral,&g_tearFlagSpectral); - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasTrinket(pEVar33,0xc,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagFlat); - } - bVar2 = HasTrinket(pEVar33,0x60,0); - if (bVar2 != 0) { - flagsResult = BitSet128::operator_or(&ouroborosFlags,&g_tearFlagBigSpiral,&g_tearFlagSpectral) - ; - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasCollectible(pEVar33,0x14b,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagGlow); - } - bVar2 = HasCollectible(pEVar33,0x171,0); - if (bVar2 != 0) { - flagsResult = BitSet128::operator_or(&continuumFlags,&g_tearFlagContinuum,&g_tearFlagSpectral) - ; - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasCollectible(pEVar33,0x18d,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagTractorBeam); - } - bVar2 = HasCollectible(pEVar33,0x215,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagLasershot); - } - bVar2 = HasCollectible(pEVar33,0x101,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x101), bVar2 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagBurn); - } - bVar2 = HasCollectible(pEVar33,0x13d,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x13d), bVar2 != 0)) { - (GHIDRA_CAST((&pEVar33->_tearFlags)))->BitSet128::operator__(&g_tearFlagMysteriousLiquidCreep); - } - bVar2 = HasCollectible(pEVar33,0x103,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x103), bVar2 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagDarkMatter); - } - bVar2 = HasCollectible(pEVar33,0x1c5,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagBone); - } - bVar2 = HasCollectible(pEVar33,0x1ce,0); - if (bVar2 != 0) { - flagsResult = BitSet128::operator_or(&belialFlags,&g_tearFlagPiercing,&g_tearFlagBelial); - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(flagsResult); - } - bVar2 = HasCollectible(pEVar33,0x1ee,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagJacobs); - } - bVar2 = HasCollectible(pEVar33,0x214,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagAbsorb); - } - bVar2 = HasCollectible(pEVar33,0x211,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagPop); - } - bVar2 = HasCollectible(pEVar33,0x21c,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagHydrobounce); - } - bVar2 = HasCollectible(pEVar33,0xd5,0); - if (bVar2 == 0) { - local_464 = temporaryEffects; - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x78); - if (bVar2 != 0) goto LAB_00769c23; - } - else { -LAB_00769c23: - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagShielded); - local_464 = &pEVar33->_temporaryeffects; - } - bVar2 = HasCollectible(pEVar33,0x1fa,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_468))))->BitSet128::operator__(&g_tearFlagBackstab); - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x20); - uVar25 = pEVar33->_cacheFlags; - } - cVar3 = (char)uVar25; - if ((uVar25 & 0x40) != 0) { - (GHIDRA_CAST((defaultLaserColor)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::operator_assign(other); - bVar2 = HasCollectible(pEVar33,0x1ad,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x1ad), bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,0x95,0); - if (bVar2 != 0) { - fVar34 = 1.0; - fVar32 = 3.0; - fVar30 = 1.8; - goto LAB_0076a3bd; - } - bVar2 = HasCollectible(pEVar33,0xb6,0); - if ((bVar2 != 0) || (0 < pEVar33->_hallowedGroundCountdown)) { - fVar34 = 6.0; - fVar32 = 6.0; - fVar30 = 5.0; - goto LAB_0076a3bd; - } - bVar2 = HasCollectible(pEVar33,0x254,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x23c,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x23c), bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,0x101,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x67,0); - if ((((bVar2 == 0) && (bVar2 = HasCollectible(pEVar33,0x13d,0), bVar2 == 0)) && - (bVar2 = HasCollectible(pEVar33,0x131,0), bVar2 == 0)) && - ((iVar4 = GetZodiacEffect(pEVar33), iVar4 != 0x131 && - (bVar2 = HasCollectible(pEVar33,0x1cb,0), bVar2 == 0)))) { - bVar2 = HasCollectible(pEVar33,0x68,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x59,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x13b,0); - if (((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x13b), - bVar2 == 0)) && - ((bVar2 = HasCollectible(pEVar33,0x191,0), bVar2 == 0 && - (bVar2 = HasCollectible(pEVar33,0x269,0), bVar2 == 0)))) { - bVar2 = HasCollectible(pEVar33,0x26a,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x229,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x1ee,0); - if (bVar2 != 0) { - fVar32 = 4.9; - fVar30 = 3.8; - goto LAB_00769f94; - } - bVar2 = HasCollectible(pEVar33,6,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(6), - bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,3,0); - if (((bVar2 == 0) && - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(3), - bVar2 == 0 && - (bVar2 = TemporaryEffects::HasCollectibleEffect - (temporaryEffects,0xc0), bVar2 == 0)))) && - ((pEVar33->_variant != 1 || (pEVar33->_babySkin != 4)))) { - bVar2 = HasCollectible(pEVar33,200,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x18e,0); - if ((bVar2 == 0) && - (bVar2 = TemporaryEffects::HasCollectibleEffect - (temporaryEffects,0x18e), bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,0x45,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x231,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x14a,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x84,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x103,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetTint(3.0,3.0,3.0, - 1.0); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetOffset(-0.5,-0.5, - -0.5); - goto LAB_0076a232; - } - if (pEVar33->_playerType != 0x19) goto LAB_0076a3c8; - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetTint(2.0,2.0,2.0, - 1.0); - fVar34 = 0.1; - fVar32 = 0.3; - fVar30 = 0.7; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetTint(3.0,3.0,3.0, - 1.0); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetOffset(-0.5,-0.5, - -0.5); - fVar34 = 1.2; - fVar32 = 1.2; - fVar30 = 1.3; - } - } - else { - fVar34 = 4.2; - fVar32 = 5.0; - fVar30 = 5.6; - } - } - else { - fVar34 = 3.8; - fVar32 = 5.2; - fVar30 = 5.6; - } - } - else { - fVar34 = 1.7; - fVar32 = 1.7; - fVar30 = 3.0; - } - } - else { - fVar34 = 4.0; - fVar32 = 1.2; - fVar30 = 1.2; - } - } - else { - fVar34 = 3.5; - fVar32 = 1.0; - fVar30 = 4.0; - } - } - else { - fVar34 = 3.5; - fVar32 = 1.0; - fVar30 = 3.0; - } - } - else { - fVar34 = 1.0; - fVar32 = 4.9; - fVar30 = 5.0; - } - } - else { - fVar34 = 4.0; - fVar32 = 2.0; - fVar30 = 2.0; - } - } - else { - fVar34 = 0.0; - fVar32 = 1.0; - fVar30 = 5.0; - } - } - else { -LAB_0076a232: - fVar34 = 1.0; - fVar32 = 1.0; - fVar30 = 1.0; - } - } - else { - fVar34 = 5.0; - fVar32 = 5.2; - fVar30 = 5.2; - } - } - else { - fVar34 = 0.4; - fVar32 = 1.5; - fVar30 = 3.0; - } - } - else { - fVar34 = 1.0; - fVar32 = 4.0; - fVar30 = 1.8; - } - } - else { - fVar34 = 1.0; - fVar32 = 3.0; - fVar30 = 5.0; - } - } - else { - fVar34 = 3.0; - fVar32 = 0.5; - fVar30 = 3.0; - } - goto LAB_0076a3bd; - } - fVar32 = 4.4; - fVar30 = 4.0; -LAB_00769f94: - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetColorize(fVar30,fVar32,6.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetOffset(0.1,0.1,0.1); - } - else { - fVar34 = 1.0; - fVar32 = 4.0; - fVar30 = 6.0; -LAB_0076a3bd: - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::SetColorize(fVar30,fVar32,fVar34,1.0); - } -LAB_0076a3c8: - (GHIDRA_CAST((&defaultTearColor)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::operator_assign(other_00); - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - this_00 = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - (GHIDRA_CAST((this_00)))->Entity_Familiar::GetPlayerSlot(&playerSlotColor,pEVar33); - (GHIDRA_CAST((&pvpTearColor)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::operator_assign(other_01); - } - bVar2 = HasCollectible(pEVar33,0x13d,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x13d), bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,0x101,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x101), bVar2 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetColorize(1.8,0.9,0.3,1.0); - fVar34 = 0.0; - fVar32 = 0.0; - fVar30 = 0.3; - goto LAB_0076aab9; - } - bVar2 = HasCollectible(pEVar33,0x103,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x103), bVar2 == 0)) { - bVar2 = HasCollectible(pEVar33,0x95,0); - if ((bVar2 == 0) || (bVar2 = HasWeaponType(pEVar33,5), bVar2 != 0)) { - bVar2 = HasCollectible(pEVar33,0xb6,0); - if ((bVar2 == 0) && (pEVar33->_hallowedGroundCountdown < 1)) { - bVar2 = HasCollectible(pEVar33,0x23c,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x23c), bVar2 != 0)) - { - fVar32 = 0.25; - fVar30 = 0.0; - goto LAB_0076a9c3; - } - bVar2 = HasCollectible(pEVar33,0x84,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x68,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x45,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,6,0); - if ((bVar2 == 0) && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(6), bVar2 == 0 - )) { - bVar2 = HasCollectible(pEVar33,3,0); - if (((bVar2 == 0) && - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(3), - bVar2 == 0 && - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xc0), - bVar2 == 0)))) && ((pEVar33->_variant != 1 || (pEVar33->_babySkin != 4)))) - { - bVar2 = HasCollectible(pEVar33,0x136,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0xdd,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(1.0,1.0,0.8,1.0); - fVar34 = 0.1; - fVar32 = 0.1; - fVar30 = 0.1; - goto LAB_0076aab9; - } - bVar2 = HasCollectible(pEVar33,0x150,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x231,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar33,0x14a,0); - if (bVar2 != 0) goto LAB_0076a9da; - bVar2 = HasCollectible(pEVar33,0x18e,0); - if (((bVar2 != 0) || - (bVar2 = TemporaryEffects::HasCollectibleEffect - (temporaryEffects,0x18e), bVar2 != 0)) && - (bVar2 = HasWeaponType(pEVar33,4), bVar2 != 0)) { - fVar32 = 1.0; - fVar30 = 0.5; - goto LAB_0076a81e; - } - bVar2 = HasWeaponType(pEVar33,10); - if ((bVar2 == 0) || - (bVar2 = HasCollectible(pEVar33,0x213,0), bVar2 == 0)) { - if ((pEVar33->_playerType == 0x19) && - (bVar2 = HasCollectible(pEVar33,0x2a6,0), bVar2 == 0)) { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(1.5,1.5,1.5,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetColorize(0.7,0.6,0.5,1.0); - fVar34 = -0.4; - fVar32 = -0.45; - fVar30 = -0.4; - goto LAB_0076aab9; - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(0.92,0.05,0.03,1.0); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(1.8,1.7,1.0,1.0); - } - goto LAB_0076aac4; - } - tintAlpha = 0.9; - fVar34 = 0.1; - fVar32 = 0.25; - fVar30 = 0.5; - } - else { - tintAlpha = 1.0; - fVar34 = 0.2; - fVar32 = 0.2; - fVar30 = 0.2; - } - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(fVar30,fVar32,fVar34,tintAlpha); - FUN_00683010(); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(0.4,0.15,0.38,1.0); - FUN_00683010(); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(1.0,1.0,0.0,1.0); - FUN_00683010(); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(0.33,0.18,0.18,1.0); - FUN_00683010(); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(0.9,0.3,0.08,1.0); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(0.2,0.09,0.065,1.0); - } - } - else { -LAB_0076a9da: - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(1.5,2.0,2.0,1.0); - } - } - else { - fVar32 = 0.4; - fVar30 = 0.9; -LAB_0076a81e: - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetTint(0.5,fVar30,fVar32,1.0); - } - } - else { - fVar32 = 0.3; - fVar30 = 0.3; -LAB_0076a9c3: - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetColorize(0.3,fVar30,fVar32,1.0); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetColorize(0.2,1.0,0.2,1.0); - fVar34 = 0.0; - fVar32 = 0.2; - fVar30 = 0.0; -LAB_0076aab9: - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::SetOffset(fVar30,fVar32,fVar34); - } -LAB_0076aac4: - bVar2 = HasCollectible(pEVar33,0x73,0); - if ((((((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x73), bVar2 != 0)) || - ((iVar4 = pEVar33->_playerType, iVar4 == 10 || ((iVar4 == 0x1f || (iVar4 == 0x27)))))) || - ((pEVar33->_variant == 1 && (pEVar33->_babySkin == 0x3b)))) || - (((((bVar2 = HasCollectible(pEVar33,0x9f,0), bVar2 != 0 || - (bVar2 = HasCollectible(pEVar33,0xb9,0), bVar2 != 0)) || (pEVar33->_playerType == 0x11)) - || ((pEVar33->_variant == 1 && (pEVar33->_babySkin == 0x3a)))) || - (pEVar33->_isCoopGhost != 0)))) || - (((iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x2a5), iVar4 == 1 || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x42), bVar2 != 0)) || - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x65), bVar2 != 0 || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x70), bVar2 != 0)))))) { - (GHIDRA_CAST((&tearGlowColor)))->Color::Color(1.5,2.0,2.0,0.5); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_tearColor))))->Color::__mul(color); - (GHIDRA_CAST((&laserGlowColor)))->Color::Color(1.5,2.0,2.0,0.5); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_laserColor))))->Color::__mul(other_02); - } - bVar2 = IsHologram(pEVar33); - if (bVar2 != 0) { - Font::SetLineHeightModifier(GHIDRA_CAST(&pEVar33->_tearColor),0.2); - Font::SetLineHeightModifier(GHIDRA_CAST(&pEVar33->_laserColor),0.2); - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x40); - cVar3 = (char)pEVar33->_cacheFlags; - } - if (cVar3 < '\0') { - local_47b = pEVar33->_canFly; - iVar4 = GetCollectibleNum(pEVar33,0xb9,0); - iVar5 = GetCollectibleNum(pEVar33,0xb8,0); - iVar6 = GetCollectibleNum(pEVar33,0xb5,0); - iVar7 = GetCollectibleNum(pEVar33,0xb3,0); - iVar8 = GetCollectibleNum(pEVar33,0x9f,0); - iVar9 = GetCollectibleNum(pEVar33,0x82,0); - iVar15 = GetCollectibleNum(pEVar33,0x52,0); - iVar16 = GetCollectibleNum(pEVar33,0x14,0); - iVar17 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x14); - if ((((iVar17 + iVar4 + iVar5 + iVar6 + iVar7 + iVar8 + iVar9 + iVar15 + iVar16 < 1) && - (bVar2 = HasPlayerForm(pEVar33,0), bVar2 == 0)) && - (bVar2 = HasPlayerForm(pEVar33,1), bVar2 == 0)) && - (bVar2 = HasPlayerForm(pEVar33,8), bVar2 == 0)) { - bVar2 = HasPlayerForm(pEVar33,3); - temporaryEffects = &pEVar33->_temporaryeffects; - if (((((((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x21), bVar2 != 0)) - || ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x14), bVar2 != 0 - || ((pEVar33->_variant == 1 || (iVar4 = pEVar33->_playerType, iVar4 == 10)))))) || - (iVar4 == 0x1f)) || (((iVar4 == 0x27 || (iVar4 == 0x28)) || (iVar4 == 7)))) || - ((iVar4 == 0x11 || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x199), bVar2 != 0)))) - || ((((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0x76), bVar2 != 0 || - ((bVar2 = HasPlayerForm(pEVar33,0xe), bVar2 != 0 || - (iVar4 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::GetCollectibleEffectNum(0x2a5), - iVar4 == 1)))) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x42), bVar2 != 0)) || - ((((((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x43), bVar2 != 0 || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(100), bVar2 != 0)) || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x65), bVar2 != 0)) || - ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasNullEffect(0x70), bVar2 != 0 || - (bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasTrinketEffect(0xa2), bVar2 != 0)))) - || ((bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x2ca), - bVar2 != 0 && (pEVar33->_playerType == 0x23)))) || - ((bVar2 = HasCollectible(pEVar33,0x283,0), bVar2 != 0 || - (bVar2 = HasCollectible(pEVar33,0x279,0), bVar2 != 0)))))))) goto LAB_0076ae8d; - iVar4 = 5; - bVar2 = 0; - } - else { -LAB_0076ae8d: - iVar4 = 3; - bVar2 = 1; - } - pEVar33->_canFly = bVar2; - pEVar33->_entityGridCollisionClass = iVar4; - if (((local_47b != 0) && (bVar2 == 0)) && (cVar3 = FUN_007d1810(), cVar3 != '\0')) { - pEVar33->_canFly = 1; - pEVar33->_entityGridCollisionClass = 3; - bVar2 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x21); - if (bVar2 == 0) { - (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x21,1,1); - } - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x80); - pEVar33->_entityGridCollisionClass = GHIDRA_UINT((pEVar33->_canFly == 0)) * 2 + 3; - if (pEVar33->_canFly != local_47b) { - UpdateCostumes(pEVar33); - } - } - if ((((pEVar33->_cacheFlags & 0x200U) != 0) && (pEVar33->_variant == 0)) && - (cVar3 = FUN_00417390(), cVar3 != '\0')) { - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,8); - local_468 = GHIDRA_CAST(&pEVar33->_collectibleRNGs); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(player,8,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(8); - pEVar33 = player; - CheckFamiliar(player,1,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x71); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x71,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x71); - pEVar33 = player; - CheckFamiliar(player,2,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x58); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x58,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x58); - pEVar33 = player; - CheckFamiliar(player,3,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,99); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,99,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(99); - pEVar33 = player; - CheckFamiliar(player,4,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,100); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,100,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(100); - pEVar33 = player; - CheckFamiliar(player,5,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x5f); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x5f,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x5f); - pEVar33 = player; - CheckFamiliar(player,6,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x43); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x43,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x43); - pEVar33 = player; - CheckFamiliar(player,7,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xbc); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xbc,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xbc); - pEVar33 = player; - CheckFamiliar(player,8,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xa3); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xa3,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xa3); - pEVar33 = player; - CheckFamiliar(player,9,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xa7); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xa7,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xa7); - pEVar33 = player; - CheckFamiliar(player,10,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xae); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xae,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xae); - pEVar33 = player; - CheckFamiliar(player,0xb,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x83); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x83,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x83); - pEVar33 = player; - CheckFamiliar(player,0x14,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x5e); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x5e,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x5e); - pEVar33 = player; - CheckFamiliar(player,0x15,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x60); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x60,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x60); - pEVar33 = player; - CheckFamiliar(player,0x16,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x62); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x62,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x62); - pEVar33 = player; - CheckFamiliar(player,0x17,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x80); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x80,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x80); - pEVar33 = player; - CheckFamiliar(player,0x1e,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x39); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x39,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x39); - pEVar33 = player; - CheckFamiliar(player,0x1f,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x70); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x70,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x70); - pEVar33 = player; - CheckFamiliar(player,0x20,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x9b); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x9b,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x9b); - pEVar33 = player; - CheckFamiliar(player,0x11,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xaa); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xaa,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xaa); - pEVar33 = player; - CheckFamiliar(player,0x10,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xb2); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xb2,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xb2); - pEVar33 = player; - CheckFamiliar(player,0x19,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xb); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xb,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xb); - pEVar33 = player; - CheckFamiliar(player,0x29,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xbb); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xbb,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xbb); - pEVar33 = player; - CheckFamiliar(player,0x2a,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xac); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xac,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xac); - pEVar33 = player; - CheckFamiliar(player,0x23,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x108); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x108,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x108); - pEVar33 = player; - CheckFamiliar(player,0x32,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x10b); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x10b,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x10b); - pEVar33 = player; - CheckFamiliar(player,0x35,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0xce); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0xce,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xce); - pEVar33 = player; - CheckFamiliar(player,0x44,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x109); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x109,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x109); - pEVar33 = player; - CheckFamiliar(player,0x33,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x10a); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x10a,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x10a); - pEVar33 = player; - CheckFamiliar(player,0x34,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x10c); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x10c,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x10c); - pEVar33 = player; - CheckFamiliar(player,0x36,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x141); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x141,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x141); - pEVar33 = player; - CheckFamiliar(player,0x4b,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x10f); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x10f,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x10f); - pEVar33 = player; - CheckFamiliar(player,0x39,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x10e); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x10e,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x10e); - pEVar33 = player; - CheckFamiliar(player,0x38,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x13f); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x13f,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x13f); - pEVar33 = player; - CheckFamiliar(player,0x4c,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x140); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x140,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x140); - pEVar33 = player; - CheckFamiliar(player,0x4d,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x117); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x117,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x117); - iVar6 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetNullEffectNum(0x6b); - pEVar33 = player; - CheckFamiliar(player,0x41,iVar6 + iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x10d); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x10d,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x10d); - pEVar33 = player; - CheckFamiliar(player,0x37,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x110); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x110,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x110); - pEVar33 = player; - CheckFamiliar(player,0x3a,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x111); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x111,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x111); - pEVar33 = player; - CheckFamiliar(player,0x3b,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x118); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x118,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x118); - pEVar33 = player; - CheckFamiliar(player,0x42,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x119); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x119,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x119); - pEVar33 = player; - CheckFamiliar(player,0x43,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x142); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x142,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x142); - CheckFamiliar(player,0x4a,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x114); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - local_5a4 = GetCollectibleNum(player,0x114,0); - local_5a0 = 1; - clampedCount = GHIDRA_CAST(std)::min(); - pEVar33 = player; - CheckFamiliar(player,0x3e,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x13e); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x13e,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x13e); - pEVar33 = player; - CheckFamiliar(player,0x4f,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x115); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x115,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x115); - pEVar33 = player; - CheckFamiliar(player,0x3f,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x113); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x113,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x113); - pEVar33 = player; - CheckFamiliar(player,0x3d,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x168); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x168,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x168); - pEVar33 = player; - CheckFamiliar(player,0x50,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x169); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x169,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x169); - pEVar33 = player; - CheckFamiliar(player,0x51,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x16a); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x16a,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x16a); - pEVar33 = player; - CheckFamiliar(player,0x52,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x16b); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x16b,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x16b); - pEVar33 = player; - CheckFamiliar(player,0x53,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x16c); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x16c,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x16c); - pEVar33 = player; - CheckFamiliar(player,0x54,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x16d); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x16d,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x16d); - pEVar33 = player; - CheckFamiliar(player,0x55,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x174); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x174,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x174); - pEVar33 = player; - CheckFamiliar(player,0x56,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x180); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x180,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x180); - pEVar33 = player; - CheckFamiliar(player,0x57,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x181); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x181,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x181); - pEVar33 = player; - CheckFamiliar(player,0x58,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x186); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x186,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x186); - iVar6 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetNullEffectNum(0x43); - pEVar33 = player; - CheckFamiliar(player,0x5c,iVar6 + iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x183); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x183,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x183); - pEVar33 = player; - CheckFamiliar(player,0x59,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1a1); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1a1,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1a1); - pEVar33 = player; - CheckFamiliar(player,0x60,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x185); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x185,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x185); - pEVar33 = player; - CheckFamiliar(player,0x5b,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x195); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x195,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x195); - pEVar33 = player; - CheckFamiliar(player,0x5d,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x193); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x193,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x193); - pEVar33 = player; - CheckFamiliar(player,0x5e,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x194); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x194,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x194); - pEVar33 = player; - CheckFamiliar(player,0x5f,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1b3); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1b3,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1b3); - pEVar33 = player; - CheckFamiliar(player,0x61,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1aa); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1aa,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1aa); - pEVar33 = player; - CheckFamiliar(player,0x62,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1ae); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1ae,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1ae); - pEVar33 = player; - CheckFamiliar(player,99,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1af); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1af,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1af); - pEVar33 = player; - CheckFamiliar(player,0x65,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1d9); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1d9,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1d9); - pEVar33 = player; - CheckFamiliar(player,0x68,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1d5); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1d5,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1d5); - pEVar33 = player; - CheckFamiliar(player,0x69,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1d4); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1d4,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1d4); - pEVar33 = player; - CheckFamiliar(player,0x6a,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1d6); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1d6,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1d6); - pEVar33 = player; - CheckFamiliar(player,0x6b,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1d7); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1d7,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1d7); - pEVar33 = player; - CheckFamiliar(player,0x6c,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1d8); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1d8,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1d8); - pEVar33 = player; - CheckFamiliar(player,0x6d,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1d3); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1d3,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1d3); - pEVar33 = player; - CheckFamiliar(player,0x6e,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1ec); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1ec,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1ec); - pEVar33 = player; - CheckFamiliar(player,0x6f,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1eb); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1eb,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1eb); - pEVar33 = player; - CheckFamiliar(player,0x70,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,500); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,500,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(500); - pEVar33 = player; - CheckFamiliar(player,0x72,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1fd); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1fd,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1fd); - CheckFamiliar(player,0x74,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x1fc); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = GetCollectibleNum(player,0x1fc,0); - pEVar33 = player; - CheckFamiliar(player,0x75,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x1ff); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x1ff,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1ff); - pEVar33 = player; - CheckFamiliar(player,0x76,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x206); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x206,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x206); - pEVar33 = player; - CheckFamiliar(player,0x77,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x20e); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x20e,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x20e); - pEVar33 = player; - CheckFamiliar(player,0x7a,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x210); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x210,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x210); - pEVar33 = player; - CheckFamiliar(player,0x7b,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x21b); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x21b,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x21b); - pEVar33 = player; - CheckFamiliar(player,0x7c,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x219); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x219,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x219); - pEVar33 = player; - CheckFamiliar(player,0x7d,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x21e); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x21e,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x21e); - pEVar33 = player; - CheckFamiliar(player,0x7e,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x220); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x220,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x220); - pEVar33 = player; - CheckFamiliar(player,0x7f,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x21f); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x21f,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x21f); - pEVar33 = player; - CheckFamiliar(player,0x81,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x224); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x224,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x224); - CheckFamiliar(player,0x82,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x1b1); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - local_59c = GetCollectibleNum(player,0x1b1,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_598)) + 0x0))) = 1; - clampedCount = GHIDRA_CAST(std)::min(); - pEVar33 = player; - CheckFamiliar(player,0x83,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x28f); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x28f,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x28f); - pEVar33 = player; - CheckFamiliar(player,0xe2,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x289); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x289,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x289); - pEVar33 = player; - CheckFamiliar(player,0xe1,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x23f); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x23f,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x23f); - pEVar33 = player; - CheckFamiliar(player,200,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x25f); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x25f,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x25f); - pEVar33 = player; - CheckFamiliar(player,0xd0,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x260); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x260,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x260); - pEVar33 = player; - CheckFamiliar(player,0xd1,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x285); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x285,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x285); - pEVar33 = player; - CheckFamiliar(player,0xd8,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x275); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x275,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x275); - CheckFamiliar(player,0xda,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x239); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_598)) + 0x4))) = GetCollectibleNum(player,0x239,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_578)) + 0x0))) = 1; - clampedCount = GHIDRA_CAST(std)::min(); - CheckFamiliar(player,0xcb,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x237); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - local_598._capacity = GetCollectibleNum(player,0x237,0); - local_598._size = 1; - clampedCount = GHIDRA_CAST(std)::min(); - CheckFamiliar(player,0xdd,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x27b); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - stitchesCount = GetCollectibleNum(player,0x27b,0); - local_57c = 1; - clampedCount = GHIDRA_CAST(std)::min(); - pEVar33 = player; - CheckFamiliar(player,0xde,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x245); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x245,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x245); - CheckFamiliar(player,0xcc,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x264); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_578)) + 0x4))) = GetCollectibleNum(player,0x264,0); - local_578._capacity = 1; - clampedCount = GHIDRA_CAST(std)::min(); - pEVar33 = player; - CheckFamiliar(player,0xd3,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x267); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x267,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x267); - pEVar33 = player; - CheckFamiliar(player,0xd4,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x2a7); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x2a7,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x2a7); - pEVar33 = player; - CheckFamiliar(player,0xe6,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x2a9); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x2a9,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x2a9); - pEVar33 = player; - CheckFamiliar(player,0xe8,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x2aa); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x2aa,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x2aa); - pEVar33 = player; - CheckFamiliar(player,0xe9,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x28c); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x28c,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x28c); - pEVar33 = player; - CheckFamiliar(player,0xef,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x2ba); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x2ba,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x2ba); - CheckFamiliar(player,0xeb,(iVar4 + iVar5) * 2,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x28b); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - local_578._size = GetCollectibleNum(player,0x28b,0); - local_568 = 1; - clampedCount = GHIDRA_CAST(std)::min(); - pEVar33 = player; - CheckFamiliar(player,0xec,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetTrinket(itemConfig,0xba); - local_470 = GHIDRA_CAST(&pEVar33->_trinketRNGs); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = GetTrinketMultiplier(player,0xba); - pEVar33 = player; - CheckFamiliar(player,0xe7,uVar25,pRVar22,pIVar20,0); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x235); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x235,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x235); - pEVar33 = player; - CheckFamiliar(player,0xf1,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x2b9); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x2b9,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x2b9); - CheckFamiliar(player,0xf2,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x2bf); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetNullEffectNum(0x83); - pEVar33 = player; - CheckFamiliar(player,0xf4,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x20d); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(pEVar33,0x79,GHIDRA_INT(pEVar33->_numLeprosy),pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x1b4); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = GetCollectibleNum(player,0x1b4,0); - pEVar33 = player; - CheckFamiliar(player,100,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,10); - local_488 = GHIDRA_CAST(rng_vector_at()); - if (isMistOrGhost == '\0') { - piVar13 = GHIDRA_CAST(FUN_0042c810()); - haloFlyCount = *piVar13; - } - else { - haloFlyCount = 0; - } - iVar4 = GetCollectibleNum(pEVar33,10,0); - haloFlyCap = 10; - haloFlyCount = haloFlyCount + iVar4 * 2; - iVar4 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetNullEffectNum(0x6b); - piVar13 = GHIDRA_CAST(std)::min(); - CheckFamiliar(pEVar33,0x21,*piVar13 + iVar4 * -2,local_488,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x51); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = GetCollectibleNum(player,0x51,0); - pEVar33 = player; - CheckFamiliar(player,0x28,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x75); - local_460 = GHIDRA_CAST(rng_vector_at()); - bVar2 = (GHIDRA_CAST((local_464)))->TemporaryEffects::HasCollectibleEffect(0x75); - if ((bVar2 == 0) && - (((bVar2 = HasCollectible(pEVar33,0x75,0), bVar2 == 0 || (pEVar33->_playerType != 5)) || - (bVar2 = HasCollectible(pEVar33,0x26b,0), bVar2 == 0)))) { - uVar25 = 0; - } - else { - uVar25 = 1; - } - CheckFamiliar(pEVar33,0xe,uVar25,GHIDRA_CAST(local_460),pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x112); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - bVar2 = (GHIDRA_CAST((local_464)))->TemporaryEffects::HasCollectibleEffect(0x112); - pEVar33 = player; - CheckFamiliar(player,0x3c,GHIDRA_UINT((bVar2 != 0)),pRVar22,pIVar20,-1); - iVar4 = GetCollectibleNum(pEVar33,0x49,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x49); - uVar25 = pEVar33->_potatoPeelerCounter + iVar5 + iVar4; - local_460 = GHIDRA_CAST((GHIDRA_INT((uVar25 + (GHIDRA_INT(uVar25) >> 0x1f & 3U))) >> 2)); - uVar25 = uVar25 & 0x80000003; - if (GHIDRA_INT(uVar25) < 0) { - uVar25 = (uVar25 - 1 | 0xfffffffc) + 1; - } - itemConfig = Isaac::GetItemConfig(); - collectibleItem = ItemConfig::GetCollectible(itemConfig,0x49); - iVar4 = -1; - pIVar20 = collectibleItem; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(player,0x2c,GHIDRA_UINT((uVar25 == 1)),pRVar22,pIVar20,iVar4); - iVar4 = -1; - pIVar20 = collectibleItem; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(player,0x2d,GHIDRA_UINT((uVar25 == 2)),pRVar22,pIVar20,iVar4); - iVar4 = -1; - pIVar20 = collectibleItem; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - pEVar33 = player; - CheckFamiliar(player,0x2e,GHIDRA_UINT((uVar25 == 3)),pRVar22,pIVar20,iVar4); - iVar4 = -1; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - pIVar20 = local_460; - CheckFamiliar(pEVar33,0x2f,GHIDRA_UINT(local_460),pRVar22,collectibleItem,iVar4); - if (0 < GHIDRA_INT(pIVar20)) { - persistentGameData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryUnlock(persistentGameData,0x90); - } - iVar4 = GetCollectibleNum(pEVar33,0xcf,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xcf); - uVar25 = pEVar33->_potatoPeelerBandageCounter + iVar5 + iVar4; - local_460 = GHIDRA_CAST((GHIDRA_INT((uVar25 + (GHIDRA_INT(uVar25) >> 0x1f & 3U))) >> 2)); - uVar25 = uVar25 & 0x80000003; - if (GHIDRA_INT(uVar25) < 0) { - uVar25 = (uVar25 - 1 | 0xfffffffc) + 1; - } - itemConfig = Isaac::GetItemConfig(); - collectibleItem = ItemConfig::GetCollectible(itemConfig,0xcf); - iVar4 = -1; - pIVar20 = collectibleItem; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(player,0x45,GHIDRA_UINT((uVar25 == 1)),pRVar22,pIVar20,iVar4); - iVar4 = -1; - pIVar20 = collectibleItem; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(player,0x46,GHIDRA_UINT((uVar25 == 2)),pRVar22,pIVar20,iVar4); - iVar4 = -1; - pIVar20 = collectibleItem; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - pEVar33 = player; - CheckFamiliar(player,0x47,GHIDRA_UINT((uVar25 == 3)),pRVar22,pIVar20,iVar4); - iVar4 = -1; - pRVar22 = GHIDRA_CAST(rng_vector_at()); - pIVar20 = local_460; - CheckFamiliar(pEVar33,0x48,GHIDRA_UINT(local_460),pRVar22,collectibleItem,iVar4); - if (0 < GHIDRA_INT(pIVar20)) { - persistentGameData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryUnlock(persistentGameData,0x13); - } - uVar24 = 0x23; - uVar25 = EntityPtr::Ref(); - (GHIDRA_CAST((&seededRng)))->RNG::game_constructor(uVar25,uVar24); - local_8 = (void *)0x1; - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x6b); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x6b); - CheckFamiliar(player,0x30,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x145); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x145); - CheckFamiliar(player,0x4e,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x1f8); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x1f8); - CheckFamiliar(player,0x73,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x204); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x204); - pEVar33 = player; - CheckFamiliar(player,0x78,uVar25,pRVar22,pIVar20,-1); - local_488 = GHIDRA_CAST(Game)::GetNumPlayers(g_game); - local_460 = GHIDRA_CAST(0x0); - if (local_488 != GHIDRA_CAST(0x0)) { - puVar26 = auStack_1bb; - do { - local_46c = Game::GetPlayer(g_game,GHIDRA_UINT(local_460)); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_46c))))->Entity::Variant(); - if (iVar4 == 0) { - iVar4 = GetCollectibleNum(local_46c,0xee,0); - puVar26[-5] = (char)iVar4; - iVar4 = GetCollectibleNum(local_46c,0xef,0); - puVar26[-4] = (char)iVar4; - puVar26[-3] = 0; - iVar4 = GetCollectibleNum(local_46c,0x272,0); - puVar26[-2] = (char)iVar4; - iVar4 = GetCollectibleNum(local_46c,0x273,0); - puVar26[-1] = (char)iVar4; - *puVar26 = 0; - } - else { - *GHIDRA_CAST((puVar26 + -4)) = 0; - puVar26[-5] = 0; - *GHIDRA_CAST((puVar26 + -1)) = 0; - puVar26[-2] = 0; - } - puVar26 = puVar26 + 6; - local_460 = GHIDRA_CAST((GHIDRA_INT(&local_460->type) + 1)); - } while (local_460 < local_488); - pcVar27 = local_1c0; - local_484 = local_488; - pRVar22 = local_488; - do { - local_46c = GHIDRA_CAST(&local_1bc); - for (local_460 = GHIDRA_CAST(0x0); - ((pEVar33 = player, *pcVar27 != '\0' || (pcVar27[3] != '\0')) && (local_460 < pRVar22)); - local_460 = GHIDRA_CAST((GHIDRA_INT(&local_460->type) + 1))) { - pEVar33 = local_46c + -1; - pcVar23 = GHIDRA_CAST(FUN_007dd3a0()); - cVar3 = *pcVar23; - *pcVar27 = *pcVar27 - cVar3; - (*GHIDRA_CAST((GHIDRA_CAST((pEVar33)) + 0x2efd))) = (*GHIDRA_CAST((GHIDRA_CAST((pEVar33)) + 0x2efd))) - cVar3; - pcVar27[2] = pcVar27[2] + cVar3; - pcVar23 = GHIDRA_CAST(FUN_007dd3a0()); - cVar3 = *pcVar23; - pcVar27[3] = pcVar27[3] - cVar3; - *GHIDRA_CAST(local_46c) = *GHIDRA_CAST(local_46c) - cVar3; - pcVar27[5] = pcVar27[5] + cVar3; - local_46c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_46c)) + 0x6)))); - pRVar22 = local_488; - } - pcVar27 = pcVar27 + 6; - local_484 = GHIDRA_CAST((GHIDRA_INT(&local_484[-1]._shift3) + 3)); - } while (local_484 != GHIDRA_CAST(0x0)); - local_484 = GHIDRA_CAST(abStack_1be); - local_460 = GHIDRA_CAST(0x0); - do { - pRVar22 = local_484; - local_480 = Game::GetPlayer(g_game,GHIDRA_UINT(local_460)); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_480))))->Entity::Variant(); - if (iVar4 == 0) { - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0xee); - local_46c = GHIDRA_CAST(&local_480->_collectibleRNGs); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(local_480,0x1a,GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_484) + -2))),pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0xef); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(local_480,0x1b,GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_484) + -1))),pRVar22,pIVar20,-1); - rng = GHIDRA_CAST(rng_vector_at()); - pRVar22 = local_484; - CheckFamiliar(local_480,0x1c,GHIDRA_UINT(*GHIDRA_CAST(local_484)),rng,GHIDRA_CAST(0x0),-1); - if (*GHIDRA_CAST(pRVar22) != 0) { - persistentGameData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryUnlock(persistentGameData,0x3a); - persistentGameData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryUnlock(persistentGameData,0x172); - } - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x272); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(local_480,0xd5,GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_484) + 1))),pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x273); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(local_480,0xd6,GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_484) + 2))),pRVar22,pIVar20,-1); - rng = GHIDRA_CAST(rng_vector_at()); - pRVar22 = local_484; - CheckFamiliar(local_480,0xdf,GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_484) + 3))),rng, - GHIDRA_CAST(0x0),-1); - } - local_484 = GHIDRA_CAST((GHIDRA_INT(pRVar22) + 6)); - local_460 = GHIDRA_CAST((GHIDRA_INT(&local_460->type) + 1)); - } while (local_460 < local_488); - } - bVar2 = HasCollectible(pEVar33,0x184,0); - if (((bVar2 == 0) || (bVar2 = HasCollectible(pEVar33,0x116,0), bVar2 == 0)) || - (bVar2 = HasCollectible(pEVar33,0x90,0), bVar2 == 0)) { - iVar4 = -1; - pIVar20 = GHIDRA_CAST(0x0); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(pEVar33,0x66,0,pRVar22,pIVar20,iVar4); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x184); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(player,0x184,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x184); - pEVar33 = player; - CheckFamiliar(player,0x5a,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x116); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x116,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x116); - pEVar33 = player; - CheckFamiliar(player,0x40,iVar4 + iVar5,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x90); - local_488 = GHIDRA_CAST(rng_vector_at()); - iVar4 = GetCollectibleNum(pEVar33,0x90,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x90); - uVar25 = iVar4 + iVar5; - pRVar22 = local_488; - } - else { - bVar2 = Game::GetStateFlag(g_game,0x25); - if (bVar2 == 0) { - Game::SetStateFlag(); - this_01 = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((this_01)))->ItemOverlay::Show(0x26,0,GHIDRA_CAST(0x0)); - } - iVar4 = -1; - pIVar20 = GHIDRA_CAST(0x0); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(pEVar33,0x66,1,pRVar22,pIVar20,iVar4); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x184); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(pEVar33,0x5a,0,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x116); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(pEVar33,0x40,0,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x90); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = 0; - } - CheckFamiliar(pEVar33,0x18,uVar25,pRVar22,local_460,-1); - itemConfig = Isaac::GetItemConfig(); - local_460 = ItemConfig::GetCollectible(itemConfig,0x207); - iVar4 = GetCollectibleNum(pEVar33,0x207,0); - lilDeliriumCount = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x207); - lilDeliriumCount = iVar4 + lilDeliriumCount; - local_520 = 0; - piVar13 = GHIDRA_CAST(std)::max(); - local_488 = GHIDRA_CAST(0x0); - pEVar21 = GHIDRA_CAST(*piVar13); - local_46c = pEVar21; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(familiarList),3,-1,-1,0,0); - local_8 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2)); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(familiarList))))->EntityList::Size(); - if (iVar4 != 0) { - uVar25 = 0; - do { - msvc::vector::operator_index(); - piVar13 = GHIDRA_CAST(__RTDynamicCast()); - cVar3 = FUN_005b18e0(); - if ((cVar3 != '\0') && (cVar3 = FUN_0060d130(), cVar3 == '\0')) { - if (GHIDRA_INT(local_488) < GHIDRA_INT(local_46c)) { - local_488 = GHIDRA_CAST((GHIDRA_INT(&local_488->_seed) + 1)); - FUN_005b1910(); - } - else { - (**(code **)(*piVar13 + 0x28))(); - } - } - uVar25 = uVar25 + 1; - uVar24 = (GHIDRA_CAST((GHIDRA_CAST(familiarList))))->EntityList::Size(); - } while (uVar25 < uVar24); - pEVar21 = local_46c; - pEVar33 = player; - } - if (GHIDRA_INT(local_488) < GHIDRA_INT(pEVar21)) { - local_46c = GHIDRA_CAST((GHIDRA_INT(pEVar21) - GHIDRA_INT(local_488))); - local_488 = GHIDRA_CAST(&pEVar33->_pos); - do { - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = (GHIDRA_CAST((pRVar22)))->RNG::Next(); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = MusicManager::RandomVector(&randomDir); - spawnRadius = 20.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&randomOffset,&spawnRadius); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_488))))->Vector::__add(&unclampedSpawnPos,vecResult); - vecResult = (GHIDRA_CAST((room)))->Room::GetClampedPosition(&clampedSpawnPos,vecResult,20.0); - pEVar33 = player; - Game::Spawn(g_game,3,0x33,vecResult,&g_vectorZero,GHIDRA_CAST(player),0,uVar25); - piVar13 = GHIDRA_CAST(__RTDynamicCast()); - FUN_00638e20(); - FUN_005b1910(); - (**(code **)(*piVar13 + 0xc))(); - local_46c = GHIDRA_CAST((GHIDRA_INT(local_46c) + -1)); - } while (local_46c != GHIDRA_CAST(0x0)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - (GHIDRA_CAST((familiarList)))->EntityList_Query::~EntityList_Query(); - FUN_007e8f70(); - iVar4 = -1; - pIVar20 = GHIDRA_CAST(0x0); - pRVar22 = &formFamiliarRng; - local_8 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3)); - bVar2 = HasPlayerForm(pEVar33,0xc); - CheckFamiliar(pEVar33,0x71,GHIDRA_UINT((bVar2 != 0)),pRVar22,pIVar20,iVar4); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetTrinket(itemConfig,0x36); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - bVar2 = HasTrinket(player,0x36,0); - CheckFamiliar(player,0xc,GHIDRA_UINT((bVar2 != 0)),pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetTrinket(itemConfig,0x39); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - soulTrinketMultiplier = GetTrinketMultiplier(player,0x39); - local_52c = 3; - clampedCount = GHIDRA_CAST(std)::min(); - CheckFamiliar(player,0xd,*clampedCount,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetTrinket(itemConfig,0x3c); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - bVar2 = (GHIDRA_CAST((local_464)))->TemporaryEffects::HasTrinketEffect(0x3c); - pEVar33 = player; - CheckFamiliar(player,0xf,GHIDRA_UINT((bVar2 != 0)),pRVar22,pIVar20,-1); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - CheckFamiliar(pEVar33,0x67,GHIDRA_INT(pEVar33->_tonsilCount),pRVar22,GHIDRA_CAST(0x0),-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x262); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - bVar2 = (GHIDRA_CAST((local_464)))->TemporaryEffects::HasCollectibleEffect(0x262); - CheckFamiliar(player,0xd2,GHIDRA_UINT((bVar2 != 0)),pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x25d); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - uVar25 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x25d); - CheckFamiliar(player,0xcf,uVar25,pRVar22,pIVar20,-1); - itemConfig = Isaac::GetItemConfig(); - pIVar20 = ItemConfig::GetCollectible(itemConfig,0x290); - pRVar22 = GHIDRA_CAST(rng_vector_at()); - damoclesCount = GetCollectibleNum(player,0x290,0); - local_534 = 1; - clampedCount = GHIDRA_CAST(std)::min(); - pEVar33 = player; - CheckFamiliar(player,0xca,*clampedCount,pRVar22,pIVar20,-1); - if (DAT_00c7ac69 == '\0') { - DAT_00c7ac69 = 1; - bVar2 = HasTrinket(pEVar33,0xb4,0); - if (bVar2 == 0) { - local_46c = GHIDRA_CAST(0x0); - } - else { - foundSoulNeeded = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetTrinketEffectNum(0xb4); - local_53c = 0; - foundSoulNeeded = 1 - foundSoulNeeded; - piVar13 = GHIDRA_CAST(std)::max(); - local_46c = GHIDRA_CAST(*piVar13); - } - local_470 = GHIDRA_CAST(GetCollectibleNum(pEVar33,0x29b,0)); - _eh_vector_constructor_iterator_(coopBabyList,0xc,2,FUN_00424510,FID_conflict__Tidy); - local_8 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),4)); - uVar25 = 0; - iVar4 = Game::GetNumPlayers(g_game); - if (iVar4 != 0) { - do { - otherPlayer = Game::GetPlayer(g_game,uVar25); - pEVar21 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(otherPlayer))))->Entity)::Parent(); - if ((pEVar21 == pEVar33) && (cVar3 = (GHIDRA_CAST((GHIDRA_CAST(otherPlayer))))->Entity::IsDead(), cVar3 == '\0') - ) { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(otherPlayer))))->Entity::Variant(); - if ((iVar4 == 1) && (iVar4 = GetBabySkin(otherPlayer), iVar4 == 0x3b)) { -LAB_0076ef58: - msvc::vector::push_back(); - } - else { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(otherPlayer))))->Entity::Variant(); - if (iVar4 == 0) { - temporaryEffects = GHIDRA_CAST(GetEffects(otherPlayer)); - bVar2 = (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x29b); - if (bVar2 != 0) goto LAB_0076ef58; - } - } - } - uVar25 = uVar25 + 1; - uVar24 = Game::GetNumPlayers(g_game); - } while (uVar25 < uVar24); - } - iVar4 = (GHIDRA_CAST((coopBabyList)))->msvc::vector::size(); - pEVar21 = local_46c; - if (GHIDRA_INT(local_46c) < iVar4) { - do { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - puVar14 = GHIDRA_CAST(FUN_00708a50()); - PlayerManager::RemoveCoPlayer(playerManager,GHIDRA_CAST(*puVar14),0); - FUN_007dc650(); - iVar4 = (GHIDRA_CAST((coopBabyList)))->msvc::vector::size(); - } while (GHIDRA_INT(pEVar21) < iVar4); - pEVar33 = player; - } - pEVar21 = local_46c; - iVar4 = (GHIDRA_CAST((coopBabyList)))->msvc::vector::size(); - while (iVar4 < GHIDRA_INT(pEVar21)) { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - coopBaby = PlayerManager::SpawnCoPlayerBaby(playerManager,0x3b); - SetControllerIndex(coopBaby,pEVar33->_controllerIndex,0); - (GHIDRA_CAST((GHIDRA_CAST(coopBaby))))->Entity::SetParent(GHIDRA_CAST(pEVar33)); - vecResult = (GHIDRA_CAST((&coopBabyOffset)))->Vector::Vector(0.0,4.0); - vecResult = (GHIDRA_CAST((&pEVar33->_pos)))->Vector::__add(&coopBabySpawnPos,vecResult); - (GHIDRA_CAST((GHIDRA_CAST(coopBaby))))->Entity::SetPosition(vecResult); - apply_coop_baby_spawn_bonus(coopBaby); - coopBaby->_cacheFlags = 0xffff; - EvaluateItems(coopBaby); - msvc::vector::push_back(); - iVar4 = (GHIDRA_CAST((coopBabyList)))->msvc::vector::size(); - } - cVar3 = FUN_0060d1e0(); - if ((cVar3 == '\0') && (cVar3 = FUN_00738330(), cVar3 == '\0')) { - iVar4 = (GHIDRA_CAST((coPlayerList)))->msvc::vector::size(); - pIVar20 = local_470; - if (GHIDRA_INT(local_470) < iVar4) { - do { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - puVar14 = GHIDRA_CAST(FUN_00708a50()); - PlayerManager::RemoveCoPlayer(playerManager,GHIDRA_CAST(*puVar14),0); - FUN_007dc650(); - iVar4 = (GHIDRA_CAST((coPlayerList)))->msvc::vector::size(); - } while (GHIDRA_INT(pIVar20) < iVar4); - pEVar33 = player; - } - pIVar20 = local_470; - iVar4 = (GHIDRA_CAST((coPlayerList)))->msvc::vector::size(); - while (iVar4 < GHIDRA_INT(pIVar20)) { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - coPlayer = PlayerManager::SpawnCoPlayer2(playerManager,0xe); - SetControllerIndex(coPlayer,pEVar33->_controllerIndex,0); - (GHIDRA_CAST((GHIDRA_CAST(coPlayer))))->Entity::SetParent(GHIDRA_CAST(pEVar33)); - vecResult = (GHIDRA_CAST((&coPlayerOffset)))->Vector::Vector(0.0,4.0); - vecResult = (GHIDRA_CAST((&pEVar33->_pos)))->Vector::__add(&coPlayerSpawnPos,vecResult); - (GHIDRA_CAST((GHIDRA_CAST(coPlayer))))->Entity::SetPosition(vecResult); - temporaryEffects = GHIDRA_CAST(GetEffects(coPlayer)); - (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::AddCollectibleEffect(0x29b,1,1); - InitPostLevelInitStats(coPlayer); - msvc::vector::push_back(); - iVar4 = (GHIDRA_CAST((coPlayerList)))->msvc::vector::size(); - } - } - DAT_00c7ac69 = '\0'; - local_8 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3)); - _eh_vector_destructor_iterator_(coopBabyList,0xc,2,FID_conflict__Tidy); - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x200); - local_46c = GHIDRA_CAST(0x0); - local_460 = GHIDRA_CAST(0x1); - do { - pIVar20 = local_460; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - if (*piVar13 != 0) { - itemConfig = Isaac::GetItemConfig(); - local_470 = ItemConfig::GetCollectible(itemConfig,GHIDRA_INT(pIVar20)); - if ((local_470 != GHIDRA_CAST(0x0)) && (local_470->type == 4)) { - iVar4 = GetCollectibleNum(pEVar33,local_470->id,0); - iVar5 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(local_470->id); - local_46c = GHIDRA_CAST((GHIDRA_INT((&(local_46c->_sprite)._filename + -3)) + iVar4 + iVar5)) - ; - pIVar20 = local_460; - } - } - local_460 = GHIDRA_CAST((GHIDRA_INT(pIVar20) + 1)); - } while (GHIDRA_INT(local_460) < 0x2dd); - if (GHIDRA_CAST(&DAT_00000004) < local_46c) { - persistentGameData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryUnlock(persistentGameData,0x163); - } - guard_check_icall(); - local_8 = (void *)0xffffffff; - guard_check_icall(); - } - uVar25 = pEVar33->_cacheFlags; - if ((uVar25 & 0x400) != 0) { - if (isMistOrGhost == '\0') { - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - local_460 = GHIDRA_CAST((float)(*piVar13 - iVar4)); - pEVar33 = player; - } - else { - local_460 = GHIDRA_CAST(0x0); - } - if ((pEVar33->_hasCurseMistEffect == 0) && (pEVar33->_isCoopGhost == 0)) { - iVar4 = pEVar33->_luckModifier; - } - else { - iVar4 = 0; - } - iVar5 = GetCollectibleNum(pEVar33,0xfd,0); - local_460 = (ItemConfig_Item *) - ((float)iVar4 + luckBonus + (float)local_460 + (float)pEVar33->_donateLuck + - pEVar33->_edenLuck + (float)iVar5); - iVar4 = GetCollectibleNum(pEVar33,0x2e,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x157,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x163,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x1b7,0); - local_470 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,5,0); - local_470 = GHIDRA_CAST(((float)local_470 - (float)iVar4)); - iVar4 = GetCollectibleNum(pEVar33,0x29d,0); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_470)); - iVar4 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetNullEffectNum(0x38); - local_460 = GHIDRA_CAST(((float)iVar4 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x278,0); - local_460 = GHIDRA_CAST(((float)(iVar4 * 2) + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x2da,0); - pEVar33->_luck = (float)iVar4 + (float)local_460; - bVar2 = HasTrinket(pEVar33,0x2a,0); - if (bVar2 != 0) { - iVar4 = GetTrinketMultiplier(pEVar33,0x2a); - pEVar33->_luck = (float)iVar4 + pEVar33->_luck; - } - bVar2 = HasTrinket(pEVar33,0x91,0); - if (bVar2 != 0) { - iVar4 = GetTrinketMultiplier(pEVar33,0x91); - pEVar33->_luck = (float)iVar4 * 10.0 + pEVar33->_luck; - } - if ((pEVar33->_playerType == 2) && (bVar2 = HasCollectible(pEVar33,0x26b,0), bVar2 != 0)) { - pEVar33->_luck = pEVar33->_luck + 1.0; - } - iVar4 = pEVar33->_playerType; - if (iVar4 == 8) { - fVar30 = pEVar33->_luck - 1.0; -LAB_0076f615: - pEVar33->_luck = fVar30; - } - else { - if ((iVar4 == 0xe) || (iVar4 == 0x21)) { -LAB_0076f605: - fVar30 = pEVar33->_luck - 2.0; - goto LAB_0076f615; - } - if (iVar4 == 0x13) { - fVar30 = pEVar33->_luck + 1.0; - goto LAB_0076f615; - } - if (iVar4 == 0x14) { - fVar30 = pEVar33->_luck - 1.0; - goto LAB_0076f615; - } - if (iVar4 == 0x26) goto LAB_0076f605; - } - local_470 = GHIDRA_CAST(0x0); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(fortuneCookieWisps),3,0xce,0x22d,0,0); - local_8 = &DAT_00000005; - uVar25 = 0; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(fortuneCookieWisps))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar14 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar21 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar14))))->Entity_Familiar)::Player(); - if (pEVar21 == pEVar33) { - local_470 = GHIDRA_CAST((GHIDRA_INT(&local_470->type) + 1)); - } - uVar25 = uVar25 + 1; - uVar24 = (GHIDRA_CAST((GHIDRA_CAST(fortuneCookieWisps))))->EntityList::Size(); - } while (uVar25 < uVar24); - } - fVar30 = (float)((double)GHIDRA_INT(local_470) + __uint_to_double_fixup[-(GHIDRA_INT(local_470) >> 0x1f)]) * - 0.2 + pEVar33->_luck; - auVar29 = ZEXT416(GHIDRA_UINT(fVar30)); - pEVar33->_luck = fVar30; - FUN_007538c0(); - fVar30 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0x0))) + pEVar33->_luck; - pEVar33->_luck = fVar30; - if (0 < pEVar33->_coopBabyBuffTimers[4]) { - pEVar33->_luck = fVar30 + 2.0; - } - bVar2 = HasTrinket(pEVar33,0x65,0); - if ((bVar2 != 0) && (isActiveEmpty != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,0x65); - pEVar33->_luck = (float)iVar4 + (float)iVar4 + pEVar33->_luck; - } - bVar2 = HasCollectible(pEVar33,0x1ec,0); - if (bVar2 != 0) { - pEVar33->_luck = pEVar33->_luck + 1.0; - } - bVar2 = HasTrinket(pEVar33,100,0); - if ((bVar2 != 0) && (isActiveFullyCharged != false)) { - iVar4 = GetTrinketMultiplier(pEVar33,100); - pEVar33->_luck = (float)iVar4 + pEVar33->_luck; - } - entityList = GHIDRA_CAST(FUN_00421780()); - iVar4 = (GHIDRA_CAST((entityList)))->EntityList::Size(); - if (iVar4 == 0x17) { - pEVar33->_luck = pEVar33->_luck + 50.0; - } - bVar2 = Game::GetDebugFlag(g_game,8); - if (bVar2 != 0) { - pEVar33->_luck = pEVar33->_luck + 50.0; - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x400); - local_8 = (void *)0xffffffff; - (GHIDRA_CAST((fortuneCookieWisps)))->EntityList_Query::~EntityList_Query(); - uVar25 = pEVar33->_cacheFlags; - } - if (((uVar25 & 0x800) != 0) && (pEVar33->_variant == 0)) { - if (isMistOrGhost == '\0') { - piVar13 = GHIDRA_CAST(FUN_0042c810()); - iVar4 = *piVar13; - piVar13 = GHIDRA_CAST(FUN_0042c810()); - fVar30 = (float)(*piVar13 - iVar4); - pEVar33 = player; - local_460 = GHIDRA_CAST(fVar30); - } - else { - fVar30 = 0.0; - } - iVar4 = GetCollectibleNum(pEVar33,0x47,0); - local_460 = (ItemConfig_Item *) - (((GHIDRA_UINT((0 < pEVar33->_coopBabyBuffTimers[6])) - - GHIDRA_UINT((0 < pEVar33->_coopBabyBuffTimers[5]))) + GHIDRA_INT(fVar30)) - iVar4); - iVar4 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x47); - iVar4 = GHIDRA_INT(local_460) - iVar4; - iVar5 = GetCollectibleNum(pEVar33,0x1b6,0); - iVar6 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0xc); - iVar7 = GetCollectibleNum(pEVar33,0xc,0); - local_460 = GHIDRA_CAST(((float)(iVar7 + (iVar4 - iVar5) + iVar6) * 0.322 + 0.0)); - iVar4 = GetCollectibleNum(pEVar33,0x12e,0); - local_470 = GHIDRA_CAST(((float)iVar4 * 0.263 + (float)local_460)); - iVar4 = GetCollectibleNum(pEVar33,0x154,0); - local_470 = GHIDRA_CAST(((float)local_470 - (float)iVar4 * 0.152)); - iVar4 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetNullEffectNum(0x29); - local_484 = GHIDRA_CAST(((float)iVar4 * 0.678 + (float)local_470)); - iVar4 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x2b0); - iVar5 = GetCollectibleNum(pEVar33,0x256,0); - local_484 = GHIDRA_CAST(((float)local_484 - (float)(iVar5 + iVar4))); - iVar4 = GetCollectibleNum(pEVar33,0x79,0); - iVar5 = GetCollectibleNum(pEVar33,0x78,0); - iVar6 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x78); - iVar7 = (GHIDRA_CAST((local_464)))->TemporaryEffects::GetCollectibleEffectNum(0x79); - local_46c = GHIDRA_CAST(((float)(iVar7 + ((iVar4 - iVar5) - iVar6)) * 0.152 + 0.0)); - bVar2 = Game::IsInTimedSet(g_game,0x23); - if (bVar2 != 0) { - local_46c = GHIDRA_CAST(((float)local_46c + 1.585)); - } - bVar2 = Game::IsInTimedSet(g_game,0x24); - if (bVar2 != 0) { - local_46c = GHIDRA_CAST(((float)local_46c - 1.0)); - } - entityList = GHIDRA_CAST(FUN_00421780()); - iVar4 = (GHIDRA_CAST((entityList)))->EntityList::Size(); - pRVar22 = local_484; - if (iVar4 == 0x2d) { - pRVar22 = GHIDRA_CAST(((float)local_484 + 0.485)); - } - fVar30 = 2.0; - if ((float)pRVar22 < 2.0) { - pow_wrapper(); - } - else { - fVar30 = ((float)pRVar22 - 2.0) * 2.77259 + 4.0; - } - spriteScaleFactor = fVar30; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&spriteScaleVec,&spriteScaleFactor); - (GHIDRA_CAST((&pEVar33->_playerSpriteScale)))->Vector::operator_assign(vecResult); - headScaleFactor = 2.0; - if ((float)local_46c < 2.0) { - pow_wrapper(); - } - else { - headScaleFactor = ((float)local_46c - 2.0) * 2.77259 + 4.0; - } - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&headScaleVec,&headScaleFactor); - (GHIDRA_CAST((&pEVar33->_headScale)))->Vector::operator_assign(vecResult); - (GHIDRA_CAST((&pEVar33->_bodyScale)))->Vector::operator_assign(&g_vectorOne); - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x800); - pfVar10 = GHIDRA_CAST(std)::min(); - if (3.0 <= *pfVar10) { - persistentGameData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryUnlock(persistentGameData,0x169); - } - } - if ((pEVar33->_cacheFlags & 0x1000U) != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_sprite))))->Sprite::Color(); - local_47b = FUN_00753560(); - (GHIDRA_CAST((&spriteColor)))->Color::Color(); - if (((pEVar33->_playerType == 0x11) || - (bVar2 = (GHIDRA_CAST((local_464)))->TemporaryEffects::HasNullEffect(0x65), bVar2 != 0)) || - (pEVar33->_playerType == 0x28)) { - colorResult = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); -LAB_0076fc8b: - (GHIDRA_CAST((&spriteColor)))->Color::__mul(colorResult); - } - else { - bVar2 = HasCollectible(pEVar33,0xde,0); - if (bVar2 != 0) { - (GHIDRA_CAST((antiGravityColor)))->Color::Color(1.4,2.0,1.8,1.0); - colorResult = extraout_EAX; - goto LAB_0076fc8b; - } - } - bVar2 = HasCollectible(pEVar33,0x22a,0); - if (bVar2 != 0) { - colorResult = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - (GHIDRA_CAST((&spriteColor)))->Color::__mul(colorResult); - } - (GHIDRA_CAST((aCStackY_1d2c + 0x81)))->Color::operator_assign(GHIDRA_CAST(&spriteColor)); - colorResult = GHIDRA_CAST(FUN_004072e0()); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_color))))->Color::operator_assign(colorResult); - bVar2 = HasCollectible(pEVar33,0xd,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_color))))->Color::SetColorize(1.25,1.25,1.25,0.25); - } - bVar2 = HasCollectible(pEVar33,0x15e,0); - if (bVar2 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_color))))->Color::SetColorize(0.0,1.0,0.0,0.5); - colorResult = (GHIDRA_CAST((&toxicShockColor)))->Color::Color(1.0,1.0,1.0,0.0,0.2,0.0); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_color))))->Color::__mul(colorResult); - } - colorLerpAmount = 0.0; - pvVar11 = (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(299); - if ((pvVar11 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 8)) == 0)) { - taurusColorAmount = pEVar33->_taurusSpeedBonus * 0.5; - pfVar10 = GHIDRA_CAST(std)::max(); - colorLerpAmount = *pfVar10; - } - lustyBloodEffectNum = - (GHIDRA_CAST((&pEVar33->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x19b); - if ((0 < pEVar33->_bloodLustCounter) || (0 < lustyBloodEffectNum)) { - bloodLustCount = GHIDRA_INT(pEVar33->_bloodLustCounter); - bloodLustCap = 6; - msvc::max(); - piVar13 = GHIDRA_CAST(std)::min(); - bloodLustColorAmount = (float)*piVar13 * 0.125; - pfVar10 = GHIDRA_CAST(std)::max(); - colorLerpAmount = *pfVar10; - } - local_470 = GHIDRA_CAST(colorLerpAmount); - if (pEVar33->_playerType == 0x1b) { - berserkColorAmount = Math::clamp(0.0,1.0,(float)pEVar33->_samsonBerserkCharge / 100000.0); - puVar14 = GHIDRA_CAST(std)::max(); - local_470 = GHIDRA_CAST(*puVar14); - } - colorLerpAmount = (float)local_470; - if (0.0 < (float)local_470) { - (GHIDRA_CAST((&lerpTargetColor)))->Color::Color(); - (GHIDRA_CAST((aCStackY_1d2c + 0x81)))->Color::operator_assign(GHIDRA_CAST(&spriteColor)); - colorResult = GHIDRA_CAST(FUN_004072e0()); - colorResult = Color::Lerp(&lerpedColor,&pEVar33->_color,colorResult,(float)local_470); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar33->_color))))->Color::operator_assign(colorResult); - } - LuaEngine::EvaluateItems(g_luaEngine,pEVar33,0x1000); - if (local_47b != 0) { - pEVar33->ResetColor(); - } - } - bVar2 = HasCollectible(pEVar33,0x130,0); - if (((bVar2 != 0) || (iVar4 = GetZodiacEffect(pEVar33), iVar4 == 0x130)) && - ((pEVar33->_cacheFlags & 0x1b) != 0)) { - fVar30 = (pEVar33->_damage * 30.0) / (pEVar33->_maxfiredelay + 1.0); - FUN_00431260(); - pow_wrapper(); - local_470 = GHIDRA_CAST((fVar30 * 2.161616 - 2.0)); - fVar30 = pEVar33->_movespeed; - FUN_009bfc00(); - fVar32 = pEVar33->_tearrange; - local_460 = GHIDRA_CAST(fVar30); - FUN_009bfd00(); - pIVar20 = (ItemConfig_Item *) - ((fVar32 + (float)local_460 + (float)local_470 + (float)local_470) * 0.25); - local_470 = pIVar20; - FUN_009bfc20(); - pEVar33->_movespeed = (float)pIVar20; - pIVar20 = local_470; - FUN_009bfc80(); - pEVar33->_maxfiredelay = (float)pIVar20; - pIVar20 = local_470; - FUN_009bfcd0(); - pEVar33->_damage = (float)pIVar20; - auVar29 = ZEXT416(local_470); - FUN_009bfd20(); - pEVar33->_tearrange = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar29)) + 0x0))); - pEVar33->_cacheFlags = pEVar33->_cacheFlags | 0x1b; - } - bVar2 = HasCollectible(pEVar33,0x232,0); - pEVar21 = player; - if (((bVar2 != 0) && (isEffectsDisabled == 0)) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar33)) + 0x2ef4)))) == 0 && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar33)) + 0x2ef8)))) == 0)))) { - uVar25 = pEVar33->_cacheFlags; - if ((uVar25 & 1) != 0) { - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - pEVar21->_rockBottomDamage = fVar30; - pEVar33->_damage = fVar30; - uVar25 = pEVar21->_cacheFlags; - pEVar33 = pEVar21; - } - if ((uVar25 & 2) != 0) { - fireRate = 30.0 / (pEVar33->_maxfiredelay + 1.0); - pfVar10 = GHIDRA_CAST(std)::max(); - fireRate = *pfVar10; - pEVar33->_rockBottomMaxFireDelay = fireRate; - pEVar33->_maxfiredelay = 30.0 / fireRate - 1.0; - uVar25 = pEVar33->_cacheFlags; - } - pEVar21 = player; - if ((uVar25 & 8) != 0) { - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - pEVar21->_rockBottomTearRange = fVar30; - pEVar33->_tearrange = fVar30; - uVar25 = pEVar21->_cacheFlags; - pEVar33 = pEVar21; - } - pEVar21 = player; - if ((uVar25 & 0x10) != 0) { - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - pEVar21->_rockBottomMoveSpeed = fVar30; - pEVar33->_movespeed = fVar30; - uVar25 = pEVar21->_cacheFlags; - pEVar33 = pEVar21; - } - pEVar21 = player; - if ((uVar25 & 0x400) != 0) { - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - pEVar21->_rockBottomLuck = fVar30; - pEVar33->_luck = fVar30; - uVar25 = pEVar21->_cacheFlags; - pEVar33 = pEVar21; - } - pEVar21 = player; - if ((uVar25 & 4) != 0) { - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - pEVar21->_rockBottomShotSpeed = fVar30; - pEVar33->_shotspeed = fVar30; - pEVar33 = pEVar21; - } - } - bVar2 = HasCollectible(pEVar33,0x279,0); - if ((bVar2 != 0) && ((pEVar33->_cacheFlags & 0x10) != 0)) { - dogmaMinSpeed = 0x3f8ccccd; - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_movespeed = *pfVar10; - } - if ((pEVar33->_cacheFlags & 0x80000010U) != 0x10) goto LAB_00770492; - pEVar21 = GHIDRA_CAST(GetOtherTwin(pEVar33)); - if (pEVar21 != GHIDRA_CAST(0x0)) { - pEVar21->_cacheFlags = pEVar21->_cacheFlags | 0x80000010; - EvaluateItems(pEVar21); - if ((pEVar33->_playerType == 0x13) || (pEVar33->_playerType == 0x14)) { - twinAverageSpeed = (pEVar33->_movespeed + pEVar21->_movespeed) * 0.5; - } - else { - parentPlayer = GetMainTwin(pEVar33); - if (parentPlayer != pEVar33) { - msvc::min(); - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - pEVar21->_movespeed = fVar30; - pEVar33->_movespeed = fVar30; - goto LAB_007703f8; - } - } - msvc::min(); - pfVar10 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar10; - pEVar33->_movespeed = fVar30; - pEVar21->_movespeed = fVar30; - } -LAB_007703f8: - if ((GHIDRA_CAST(pEVar33->_parent) == GHIDRA_CAST(0x0)) || - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar33->_parent))))->Entity::is_player(), bVar2 == 0)) { - fVar30 = 0.0; - local_460 = GHIDRA_CAST(0x0); - iVar4 = Game::GetNumPlayers(g_game); - if (iVar4 != 0) { - do { - pEVar21 = Game::GetPlayer(g_game,GHIDRA_UINT(fVar30)); - parentPlayer = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar21))))->Entity)::Parent(); - if ((parentPlayer == pEVar33) && (cVar3 = (GHIDRA_CAST((GHIDRA_CAST(pEVar21))))->Entity::IsDead(), cVar3 == '\0')) - { - pEVar21->_cacheFlags = pEVar21->_cacheFlags | 0x10; - Level::SetHeartPicked(GHIDRA_CAST(&pEVar21->_temporaryeffects)); - } - fVar30 = (float)(GHIDRA_INT(local_460) + 1); - local_460 = GHIDRA_CAST(fVar30); - fVar32 = (float)Game::GetNumPlayers(g_game); - } while (GHIDRA_UINT(fVar30) < GHIDRA_UINT(fVar32)); - } - } - else { - pEVar33->_movespeed = *GHIDRA_CAST((pEVar33->_parent + 0x1568)); - } -LAB_00770492: - uVar25 = pEVar33->_cacheFlags; - if ((uVar25 & 0x2000) != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((room)))->Room::InvalidatePickupVision(); - uVar25 = pEVar33->_cacheFlags; - } - if ((uVar25 & 0x10) != 0) { - msvc::min(); - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_movespeed = *pfVar10; - } - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_shotspeed = *pfVar10; - if (-5.0 < pEVar33->_tearheight) { - pEVar33->_tearheight = -5.0; - } - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_tearrange = *pfVar10; - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_damage = *pfVar10; - pfVar10 = GHIDRA_CAST(std)::max(); - pEVar33->_maxfiredelay = *pfVar10; - uVar25 = pEVar33->_cacheFlags; - if ((uVar25 & 0xc) != 0) { - fVar30 = pEVar33->_tearheight; - FUN_0067da40(); - pEVar33->_tearfallspeed = -fVar30; - uVar25 = pEVar33->_cacheFlags; - } - if (((uVar25 & 0x10) != 0) && (iVar4 = is_achievement_79_unlocked(pEVar33), 0 < iVar4)) { - iVar4 = is_achievement_79_unlocked(pEVar33); - pEVar33->_movespeed = (float)iVar4 * 0.2 + pEVar33->_movespeed; - } - pEVar33->_cacheFlags = 0; - ExceptionList = local_10; - return; -} - -// 00770600 -void Entity_Player::RespawnFamiliars() -{ - this->_cacheFlags = this->_cacheFlags | 0x200; - EvaluateItems(this); - return; -} - -// 00770610 -void Entity_Player::GetNPCTarget() -{ - int in_ECX; - - if (((*GHIDRA_CAST((in_ECX + 0x1450)) == 0) && (*GHIDRA_CAST((in_ECX + 0x144c)) == 0)) && - (*GHIDRA_CAST((in_ECX + 0x200c)) != GHIDRA_CAST(0x0))) { - (GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x200c)))))->Entity::GetLastParent(); - return; - } - return; -} - -// 007706e0 -uint8_t Entity_Player::HasCollectible(int type, uint8_t ignoreModifiers) -{ - uint8_t bVar1; - char cVar2; - ItemConfig_Item *collectible; - Entity_Player *mainPlayer; - int iVar3; - PersistentGameData *userData; - int iVar4; - uint32_t rollResult; - PersistentGameData *persistentData; - int extraout_ECX; - int extraout_ECX_00; - bool isMatch; - uint64_t userId; - int typeKey; - PersistentGameData *local_24; - ItemConfig_Item *savedCollectible; - uint8_t *local_1c; - RNG local_18; - uint32_t local_8; - - local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - typeKey = type; - collectible = ItemConfig::GetCollectible(&g_manager->_itemConfig,type); - while( true ) { - if (collectible == GHIDRA_CAST(0x0)) { - return 0; - } - savedCollectible = collectible; - if ((this->_variant != 1) || - (((mainPlayer = GHIDRA_CAST(this->_parent), mainPlayer == GHIDRA_CAST(0x0) || - (mainPlayer->_type != 1)) && - (mainPlayer = Game::GetPlayer(g_game,0), mainPlayer == GHIDRA_CAST(0x0))))) break; - collectible = ItemConfig::GetCollectible(&g_manager->_itemConfig,type); - this = mainPlayer; - } - if (((this->_isCoopGhost != 0) && (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) && - ((collectible->tags & 0x8000) == 0)) { - return 0; - } - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))) != 0) && (type == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))))) && - ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) != '\0')) { - return 1; - } - if (type < 0) { - bVar1 = collectible_set_has(&this->_proceduralItems,type); - return bVar1; - } - if (ignoreModifiers != 0) goto LAB_00770c3e; - if (((type == 0x147) || (type == 0x148)) && (bVar1 = HasTrinket(this,0x15,0), bVar1 != 0)) { - local_1c = GHIDRA_CAST((g_game->_frameCount & 0x80000003)); - if (GHIDRA_INT(local_1c) < 0) { - local_1c = GHIDRA_CAST(((GHIDRA_UINT((local_1c + -1)) | 0xfffffffc) + 1)); - } - iVar3 = GetTrinketMultiplier(this,0x15); - if (iVar3 < 2) { - if (local_1c == GHIDRA_CAST(0x0)) { - isMatch = type == 0x147; - goto LAB_00770856; - } - if (local_1c == GHIDRA_CAST(0x1)) goto LAB_00770850; - } - else if ((local_1c == GHIDRA_CAST(0x0)) || (local_1c == GHIDRA_CAST(0x1))) { - if (type == 0x147) { - return 1; - } -LAB_00770850: - isMatch = type == 0x148; -LAB_00770856: - if (isMatch) { - return 1; - } - } - } - if (type == 0x139) { - if ((this->_playerType == 10) || - ((bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x70), bVar1 != 0 && - (this->_playerType != 0x1f)))) { - local_1c = GHIDRA_CAST(&g_manager->_netplayManager); - local_24 = &g_manager->_persistentGameData; - persistentData = local_24; - if (*GHIDRA_CAST(local_1c) != *GHIDRA_CAST((g_manager + 1))) { - userId = FUN_00a23920(); - local_18._shift3 = GHIDRA_INT(((uint64_t)userId >> 0x20)); - local_18._shift2 = GHIDRA_INT(userId); - userData = GHIDRA_CAST(FUN_0090c300(&local_18._shift2)); - persistentData = local_24; - if (userData != GHIDRA_CAST(0x0)) { - persistentData = userData; - } - } - if (persistentData->_achievements[0xfa] != 0) { - return 1; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2) && (g_game != GHIDRA_CAST(0x0))) { - if ((g_game->_dailyChallenge)._id != 0) { - return 1; - } - bVar1 = g_game->_isDebug; -LAB_00770a3e: - if (bVar1 != 0) { - return 1; - } - } - } - } - else if (type == 9) { - bVar1 = HasTrinket(this,0x5d,0); - if (bVar1 != 0) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)); - local_18._seed = 0; - if (iVar3 != 0) { - local_18._seed = *GHIDRA_CAST((iVar3 + 0x58)); - } - local_18._shift1 = 1; - local_18._shift2 = 0xb; - local_18._shift3 = 6; - rollResult = (GHIDRA_CAST((&local_18)))->RNG::RandomInt(100); - if (rollResult < 0x21) { - return 1; - } - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - return 1; - } - } - } - else if (type == 0x3b) { - cVar2 = FUN_007da770(); - if (cVar2 != '\0') { - return 1; - } - } - else if (type == 0x131) { - if ((this->_grantedCollectibleFlags & 0x10) != 0) { - return 1; - } - } - else if (type == 0x101) { - if ((this->_grantedCollectibleFlags & 8) != 0) { - return 1; - } - } - else if (type == 0xe7) { - if ((this->_grantedCollectibleFlags & 0x20) != 0) { - return 1; - } - } - else if (type == 0xb6) { - bVar1 = (uint8_t)this->_grantedCollectibleFlags & 0x40; - goto LAB_00770a3e; - } - iVar3 = get_seeded_variant(this); - if (type == 0x14a) { - if (iVar3 == 1) { - return 1; - } - } - else if ((type == 0x99) && (iVar3 == 2)) { - return 1; - } - iVar4 = is_achievement_79_unlocked(this); - iVar3 = extraout_ECX; - if (8 < iVar4) { - rollResult = Seeds::GetStartSeed(&g_game->_seedEffects); - iVar3 = is_achievement_79_unlocked(this); - local_18._shift1 = 1; - local_18._shift2 = 0x1b; - local_18._seed = 1; - if (1 < iVar3 + rollResult) { - local_18._seed = iVar3 + rollResult; - } - local_18._shift3 = 0x1b; - rollResult = (GHIDRA_CAST((&local_18)))->RNG::RandomInt(6); - if (type == *GHIDRA_CAST((&DAT_00b6bcd0 + rollResult * 4))) { - return 1; - } - iVar3 = extraout_ECX_00; - collectible = savedCollectible; - } - bVar1 = IsInnateCollectible(this,type,iVar3); - if (((bVar1 == 0) && - ((type != 0x76 || - (bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x76), bVar1 == 0))) - ) && ((this->_valid == 0 || - ((((collectible == GHIDRA_CAST(0x0) || - (bVar1 = (GHIDRA_CAST((collectible)))->Item::HasTags(0x40000000), bVar1 == 0)) || - (this->_backupPlayer == GHIDRA_CAST(0x0))) || - (bVar1 = HasCollectible(this->_backupPlayer,type,0), bVar1 == 0)))))) { - if (((this->_hasCurseMistEffect != 0) && (collectible != GHIDRA_CAST(0x0))) && - ((bVar1 = (GHIDRA_CAST((collectible)))->Item::HasTags(0x8000), bVar1 == 0 && (type != 0x216)))) { - return 0; - } - if (((((((this->_itemWispsList)._size == 0) || - (msvc::set::find(&local_24,&typeKey), local_24 == (this->_itemWispsList)._head)) || - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_24)) + 0x14)))) < 1)) && - (((((this->_modelingClayEffect == 0 || (this->_modelingClayEffect != type)) && - (iVar3 = FUN_009e0650(type), iVar3 < 1)) && - (((savedCollectible == GHIDRA_CAST(0x0) || - (bVar1 = ItemConfig_Item::is_mom_item(savedCollectible), bVar1 == 0)) || - (bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(type), - bVar1 == 0)))) && (iVar3 = GetActiveItemSlot(this,type), iVar3 < 0)))) && - (((type == 0xbf || (bVar1 = HasCollectible(this,0xbf,0), bVar1 == 0)) || - (type != this->_threeDollarBillItem)))) && - ((bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1e8), bVar1 == 0 - || (type != this->_metronomeCollectibleID)))) { -LAB_00770c3e: - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))) == 0) || - ((type != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))) || ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) != '\0')))) { - return 0 < *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + type * 4)); - } - return 1 < *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + type * 4)); - } - } - return 1; -} - -// 00770ca0 -int Entity_Player::GetCollectibleNum(int collectibleID, uint8_t OnlyCountTrueItems) -{ - uint8_t isMomItem; - Entity_Player *mainPlayer; - ItemConfig_Item *collectible; - void *pvVar1; - uint32_t uVar2; - ItemConfig_Item *extraout_ECX; - ItemConfig_Item *extraout_ECX_00; - ItemConfig_Item *unused; - int id; - int iVar3; - int count; - bool isNotGranted; - void *wispIter [2]; - - id = collectibleID; - if (-1 < collectibleID) { - while (id < GHIDRA_INT((this->_collectibleCounts)._end) - GHIDRA_INT((this->_collectibleCounts)._begin) >> 2) - { - if ((this->_variant != 1) || - (mainPlayer = GetMainPlayer(this), mainPlayer == GHIDRA_CAST(0x0))) { - iVar3 = *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + id * 4)); - collectible = ItemConfig::GetCollectible(&g_manager->_itemConfig,id); - if ((collectible != GHIDRA_CAST(0x0)) && (collectible->type == 3)) { - iVar3 = 0; - } - count = iVar3; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))) != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))) == id)) { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - count = 0; - if (0 < iVar3 + -1) { - count = iVar3 + -1; - } - } - else { - count = iVar3 + 1; - } - } - if ((this->_isCoopGhost != 0) && ((collectible->tags & 0x8000) == 0)) { - return 0; - } - iVar3 = this->_activeDesc[0]._item; - if ((iVar3 != 0) && (iVar3 == id)) { - count = count + 1; - } - iVar3 = this->_activeDesc[1]._item; - if ((iVar3 != 0) && (iVar3 == id)) { - count = count + 1; - } - iVar3 = this->_activeDesc[2]._item; - if ((iVar3 != 0) && (iVar3 == id)) { - count = count + 1; - } - iVar3 = this->_activeDesc[3]._item; - if ((iVar3 != 0) && (iVar3 == id)) { - count = count + 1; - } - if (OnlyCountTrueItems != 0) { - return count; - } - if (((this->_hasCurseMistEffect != 0) && ((collectible->tags & 0x8000) == 0)) && - (id != 0x216)) { - count = 0; - } - unused = collectible; - if (((id != 0x188) && (id != 0x19d)) && (id != 0x19c)) { - isMomItem = HasCollectible(this,0x188,0); - if ((isMomItem != 0) && (iVar3 = GetZodiacEffect(this), id == iVar3)) { - count = count + 1; - } - isMomItem = HasCollectible(this,0x19d,0); - unused = extraout_ECX; - if ((isMomItem != 0) || - (isMomItem = HasCollectible(this,0x19c,0), unused = extraout_ECX_00, isMomItem != 0)) { - if (id < 0x117) { - if (id == 0x116) { - uVar2 = 2; - } - else { - switch(id) { - case 0x62: - uVar2 = 0x100; - break; - default: - goto switchD_00770e4b_caseD_63; - case 0x70: - uVar2 = 0x40; - break; - case 0x71: - uVar2 = 4; - break; - case 0xb2: - uVar2 = 0x80; - break; - case 0x10e: - uVar2 = 1; - break; - case 0x113: - uVar2 = 0x10; - } - } - } - else if (id < 0x1a2) { - if (id == 0x1a1) { - uVar2 = 0x20; - } - else if (id == 0x168) { - uVar2 = 8; - } - else if (id == 0x16b) { - uVar2 = 0x200; - } - else { - if (id != 0x186) goto switchD_00770e4b_caseD_63; - uVar2 = 0x400; - } - } - else if (id == 0x2a7) { - uVar2 = 0x800; - } - else { - if (id != 0x2ba) goto switchD_00770e4b_caseD_63; - uVar2 = 0x1000; - } - if ((this->_conceptionFamiliarFlags & uVar2) != 0) { - count = count + 1; - } - } - } -switchD_00770e4b_caseD_63: - isMomItem = IsInnateCollectible(this,id,GHIDRA_INT(unused)); - if (isMomItem != 0) { - count = count + 1; - } - if (id == 0x3b) { - if ((this->_playerType != 3) && (this->_playerType != 0xc)) goto LAB_00770f59; - isMomItem = HasCollectible(this,0x26b,0); - isNotGranted = isMomItem == 0; - } - else if (id == 0x131) { - isNotGranted = (this->_grantedCollectibleFlags & 0x10) == 0; - } - else if (id == 0x101) { - isNotGranted = (this->_grantedCollectibleFlags & 8) == 0; - } - else if (id == 0xe7) { - isNotGranted = (this->_grantedCollectibleFlags & 0x20) == 0; - } - else { - if (id != 0x6c) goto LAB_00770f59; - isNotGranted = (this->_grantedCollectibleFlags & 0x40) == 0; - } - if (!isNotGranted) { - count = count + 1; - } -LAB_00770f59: - iVar3 = get_seeded_variant(this); - if (id == 0x14a) { - if (iVar3 == 1) { - count = count + 1; - } - } - else if (id == 0x99) { - if (iVar3 == 2) { - count = count + 3; - } - } - else if (id == 0x76) { - if (((this->_temporaryeffects)._disabled == 0) && - (pvVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x76), - pvVar1 != (void *)0x0)) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)); - } - else { - iVar3 = 0; - } - count = count + iVar3; - } - if ((((this->_valid != 0) && (collectible != GHIDRA_CAST(0x0))) && - ((collectible->tags & 0x40000000) != 0)) && - (this->_backupPlayer != GHIDRA_CAST(0x0))) { - iVar3 = GetCollectibleNum(this->_backupPlayer,id,0); - count = count + iVar3; - } - if (this->_hasCurseMistEffect == 0) { - if (((this->_itemWispsList)._size != 0) && - (msvc::set::find(wispIter,&collectibleID), id = collectibleID, - wispIter[0] != (this->_itemWispsList)._head)) { - count = count + *GHIDRA_CAST((GHIDRA_INT(wispIter[0]) + 0x14)); - } - if ((this->_modelingClayEffect != 0) && (this->_modelingClayEffect == id)) { - count = count + 1; - } - pvVar1 = (this->_extraCollectibleCounts)._begin; - if (id < GHIDRA_INT((this->_extraCollectibleCounts)._end) - GHIDRA_INT(pvVar1)) { - uVar2 = GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + id))); - } - else { - uVar2 = 0; - } - count = count + uVar2; - if ((collectible != GHIDRA_CAST(0x0)) && - (isMomItem = ItemConfig_Item::is_mom_item(collectible), isMomItem != 0)) { - iVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(id); - count = count + iVar3; - } - if ((((id != 0xbf) && (isMomItem = HasCollectible(this,0xbf,0), isMomItem != 0)) && - (this->_threeDollarBillItem != 0)) && (id == this->_threeDollarBillItem)) { - count = count + 1; - } - isMomItem = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1e8); - if (((isMomItem != 0) && (this->_metronomeCollectibleID != 0)) && - (id == this->_metronomeCollectibleID)) { - count = count + 1; - } - } - return count; - } - this = mainPlayer; - } - } - return 0; -} - -// 007711a0 -uint8_t Entity_Player::VoidHasCollectible(int id) -{ - uint32_t i; - int *voidedIt; - ActiveItemDesc *activeSlot; - uint32_t voidedCount; - - i = 0; - activeSlot = this->_activeDesc; - while (activeSlot->_item != 0x1dd) { - i = i + 1; - activeSlot = activeSlot + 1; - if (3 < i) { - return 0; - } - } - if (GHIDRA_INT(i) < 0) { - return 0; - } - i = 0; - voidedIt = (this->_voidedCollectibles)._begin; - voidedCount = GHIDRA_INT((this->_voidedCollectibles)._end) - GHIDRA_INT(voidedIt) >> 2; - if (voidedCount == 0) { - return 0; - } - do { - if (*voidedIt == id) { - return 1; - } - i = i + 1; - voidedIt = voidedIt + 1; - } while (i < voidedCount); - return 0; -} - -// 00771200 -uint8_t Entity_Player::IsInnateCollectible(int collectibleId, int unused) -{ - int iVar1; - PersistentGameData *peerData; - uint32_t userIdLo; - uint32_t userIdHi; - Manager *manager; - PersistentGameData *persistentData; - bool isInnate; - uint32_t userIdKey; - uint32_t uStack_1c; - uint8_t findResult [8]; - int foundNode; - - manager = g_manager; - persistentData = &g_manager->_persistentGameData; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - iVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e50)))); - if (iVar1 == 0) { - uStack_1c = 0; - userIdKey = 0; - userIdLo = userIdKey; - userIdHi = uStack_1c; - } - else { - userIdLo = *GHIDRA_CAST((iVar1 + 8)); - userIdHi = *GHIDRA_CAST((iVar1 + 0xc)); - } - _userIdKey = CONCAT44(userIdHi,userIdLo); - FUN_00731ee0(findResult,&userIdKey); - if ((((*GHIDRA_CAST((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST((foundNode + 0x14)) <= userIdHi)) && - ((*GHIDRA_CAST((foundNode + 0x14)) < userIdHi || (*GHIDRA_CAST((foundNode + 0x10)) <= userIdLo)))) && - ((foundNode != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(manager[1]._gamestate)) + 0xc0)))) && - (peerData = GHIDRA_CAST(FUN_00914150(&userIdKey)), manager = g_manager, - peerData != GHIDRA_CAST(0x0))))) { - persistentData = peerData; - } - } - iVar1 = this->_playerType; - if (iVar1 == 0xd) { - if (collectibleId == 0x168) { - return 1; - } - if (collectibleId == 0x19c) { - return 1; - } - } - else if (iVar1 == 10) { - if (collectibleId == 0x139) { - if (persistentData->_achievements[0xfa] == 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x8)))) != 2) { - return 0; - } - if (g_game == GHIDRA_CAST(0x0)) { - return 0; - } - if (((g_game->_dailyChallenge)._id == 0) && (g_game->_isDebug == 0)) { - return 0; - } - } - return 1; - } - } - else { - if (iVar1 == 2) { - isInnate = collectibleId == 0x2e; - } - else if (iVar1 == 5) { - if (collectibleId == 0x7a) { - return 1; - } - isInnate = collectibleId == 0x75; - } - else if (iVar1 == 6) { - isInnate = collectibleId == 0x9d; - } - else if ((iVar1 == 8) || (iVar1 == 0xb)) { - if (collectibleId != 0xd6) { - return 0; - } - if (persistentData->_achievements[0x14b] == 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x8)))) != 2) { - return 0; - } - if (g_game == GHIDRA_CAST(0x0)) { - return 0; - } - if (((g_game->_dailyChallenge)._id == 0) && (g_game->_isDebug == 0)) { - return 0; - } - } - if (iVar1 == 0xb) { - return 1; - } - isInnate = g_game->_challenge == 0; - } - else { - if (iVar1 != 0x12) { - return 0; - } - if (g_game->_challenge == 0x25) { - return 0; - } - if (g_game->_challenge == 0x26) { - return 0; - } - isInnate = collectibleId == 0x248; - } - if (isInnate) { - return 1; - } - } - return 0; -} - -// 00771410 -void Entity_Player::apply_innate_collectibles() -{ - Game *pGVar1; - uint8_t bVar2; - ItemConfig_Item *collectibleConfig; - int unused; - Entity_Player *extraout_ECX; - Entity_Player *extraout_ECX_00; - Entity_Player *extraout_ECX_01; - Entity_Player *extraout_ECX_02; - Entity_Player *extraout_ECX_03; - Entity_Player *unused_00; - uint32_t collectibleId; - void *collectiblesBegin; - uint32_t *removedWord; - - collectibleId = 0; - unused_00 = this; - do { - bVar2 = IsInnateCollectible(this,collectibleId,GHIDRA_INT(unused_00)); - pGVar1 = g_game; - if (bVar2 == 0) { - IsInnateCollectible(this,collectibleId,unused); - bVar2 = HasCollectible(this,collectibleId,0); - unused_00 = extraout_ECX_00; - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(collectibleId); - unused_00 = extraout_ECX_01; - if (bVar2 == 0) { - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,collectibleId); - unused_00 = extraout_ECX_02; - if (collectibleConfig != GHIDRA_CAST(0x0)) { - RemoveCostume(this,collectibleConfig); - unused_00 = extraout_ECX_03; - } - } - } - } - else { - if (g_game->_challenge != 0x2b) { - if (collectibleId == 0x1e4) { - ItemPool::RemoveCollectible(&g_game->_itemPool,0x126,0,0); - } - if (collectibleId < (pGVar1->_itemPool)._removedCollectibles._size) { - removedWord = GHIDRA_CAST((GHIDRA_INT((pGVar1->_itemPool)._removedCollectibles._begin) + - (collectibleId >> 5) * 4)); - *removedWord = *removedWord | 1 << (collectibleId & 0x1f); - } - } - unused_00 = (g_manager->_itemConfig)._collectibles._begin; - if ((GHIDRA_INT(collectibleId) < - GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(unused_00) >> 2) && - (collectibleConfig = - *(ItemConfig_Item **) - (GHIDRA_INT((&(unused_00->_sprite)._filename + -3)) + collectibleId * 4), - collectibleConfig != GHIDRA_CAST(0x0))) { - AddCostume(this,collectibleConfig,0); - unused_00 = extraout_ECX; - } - } - collectibleId = collectibleId + 1; - } while (GHIDRA_INT(collectibleId) < 0x2dd); - if (this->_playerType == 5) { - collectiblesBegin = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectiblesBegin) & - 0xfffffffcU)) < 0x1e9) { - RemoveCostume(this,GHIDRA_CAST(0x0)); - return; - } - RemoveCostume(this,*GHIDRA_CAST((GHIDRA_CAST(collectiblesBegin) + 0x1e8))); - } - return; -} - -// 00771550 -uint8_t Entity_Player::HasTrinket(uint32_t type, uint8_t ignoreModifiers) -{ - uint8_t isHasExtraTrinketSlot; - int trinketMultiplier; - uint32_t slot; - int *trinketId; - uint32_t trinketSlotCount; - - trinketSlotCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))); - if (((trinketSlotCount != 0) && (trinketSlotCount == type)) && ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) != '\0')) { - return 1; - } - if (ignoreModifiers != 0) { - trinketSlotCount = 1; - isHasExtraTrinketSlot = HasCollectible(this,0x8b,0); - if ((isHasExtraTrinketSlot != 0) || - (isHasExtraTrinketSlot = HasCollectible(this,0x1ca,0), isHasExtraTrinketSlot != 0)) { - trinketSlotCount = 2; - } - slot = 0; - trinketId = this->_trinketsID; - do { - if ((*trinketId & 0x7fffU) == type) { - return 1; - } - slot = slot + 1; - trinketId = trinketId + 1; - } while (slot < trinketSlotCount); - return 0; - } - if (((trinketSlotCount == 0) || (trinketSlotCount != type)) || ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) != '\0')) { - trinketMultiplier = GetTrinketMultiplier(this,type); - return 0 < trinketMultiplier; - } - trinketMultiplier = GetTrinketMultiplier(this,type); - return 1 < trinketMultiplier; -} - -// 00771620 -uint8_t Entity_Player::HasGoldenTrinket(uint32_t TrinketID) -{ - uint8_t isExtraSlotItem; - uint32_t slot; - int *trinket; - uint32_t trinketSlotCount; - - trinketSlotCount = 1; - isExtraSlotItem = HasCollectible(this,0x8b,0); - if ((isExtraSlotItem != 0) || - (isExtraSlotItem = HasCollectible(this,0x1ca,0), isExtraSlotItem != 0)) { - trinketSlotCount = 2; - } - trinket = this->_trinketsID; - slot = 0; - do { - if (((*trinket & 0x7fffU) == TrinketID) && ((*trinket & 0x8000U) != 0)) { - return 1; - } - slot = slot + 1; - trinket = trinket + 1; - } while (slot < trinketSlotCount); - if ((*GHIDRA_CAST((GHIDRA_INT((this->_smeltedTrinkets)._begin) + TrinketID * 4 + 2)) < 1) && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) & 0x7fff) != TrinketID || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) & 0x8000) == 0)))) { - return 0; - } - return 1; -} - -// 007716f0 -uint8_t Entity_Player::TryHoldTrinket(int trinketId) -{ - uint8_t isHasExtraTrinketSlot; - char cVar1; - uint32_t extraout_ECX; - int *trinketIt; - uint32_t uVar2; - uint32_t slot; - bool bVar3; - bool isUnpickableTick; - - slot = 0; - trinketIt = this->_trinketsID; - do { - uVar2 = 1; - isHasExtraTrinketSlot = HasCollectible(this,0x8b,0); - if ((isHasExtraTrinketSlot != 0) || - (isHasExtraTrinketSlot = HasCollectible(this,0x1ca,0), isHasExtraTrinketSlot != 0)) { - uVar2 = 2; - } - if (uVar2 <= slot) { - return 0; - } - uVar2 = *trinketIt; - if (((uVar2 & 0x7fff) == 0x35) && - (isHasExtraTrinketSlot = is_trinket_unpickable_id(trinketId), uVar2 = extraout_ECX, - isHasExtraTrinketSlot != 0)) { - isUnpickableTick = true; - } - else { - isUnpickableTick = false; - } - if (uVar2 == 0) { - return 1; - } - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - if (uVar2 != 0x35) { - if (uVar2 != 0x40) { - return 1; - } - bVar3 = g_game->_challenge == 0x1c; - goto LAB_00771793; - } - } - else { - cVar1 = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 0x50))(this); - bVar3 = cVar1 == '\0'; -LAB_00771793: - if (!bVar3) { - return 1; - } - } - if (isUnpickableTick) { - return 1; - } - slot = slot + 1; - trinketIt = trinketIt + 1; - } while( true ); -} - -// 007717c0 -int Entity_Player::GetMaxTrinkets() -{ - uint8_t isHasCollectible; - - isHasCollectible = HasCollectible(this,0x8b,0); - if ((isHasCollectible == 0) && - (isHasCollectible = HasCollectible(this,0x1ca,0), isHasCollectible == 0)) { - return 1; - } - return 2; -} - -// 00771800 -Entity_Pickup * Entity_Player::DropTrinket(Vector *DropPos, uint8_t ReplaceTick) -{ - void *pvVar1; - Manager *pMVar2; - char cVar3; - int *userIter; - int gridY; - Entity *spawnedEffect; - int *effect; - Game *game; - uint32_t userCount; - int iVar4; - uint32_t uVar5; - Entity_Player *player; - int gridWidth; - Entity_Pickup *droppedPickup; - uint32_t uVar6; - Entity_Pickup *pEStack_2c; - Entity_Player *savedThis; - float fStack_24; - Manager *pMStack_20; - float sfxVolume; - int *local_18; - Vector VStack_10; - float droppedTrinketType; - - savedThis = this; - FlushQueueItem(this); - uVar6 = 0xffffffff; - uVar5 = 0; - userIter = this->_trinketsID; - game = g_game; - local_18 = userIter; - do { - if (*GHIDRA_CAST(&game->_deathmatchManager) < 2) { - if ((*userIter == 0x35) || ((*userIter == 0x40 && (game->_challenge == 0x1c)))) - goto LAB_0077186b; -LAB_0077187d: - if (uVar6 != 0xffffffff) goto LAB_0077188b; - if (*userIter == 0) break; - uVar6 = uVar5; - } - else { - cVar3 = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_deathmatchManager))) + 0xc)))) + 0x50))(savedThis); - game = g_game; - if (cVar3 != '\0') goto LAB_0077187d; -LAB_0077186b: - if (((*userIter & 0x7fffU) == 0x35) && (ReplaceTick != 0)) goto LAB_0077187d; -LAB_0077188b: - if (*userIter == 0) break; - } - uVar5 = uVar5 + 1; - userIter = userIter + 1; - } while (uVar5 < 2); - sfxVolume = 1.0; - if (ReplaceTick != 0) { - uVar5 = 0; - userIter = local_18; - do { - if (*userIter == 0x35) { - pMStack_20 = g_manager; - userIter = GHIDRA_CAST(g_manager->_netplayManager); - if (userIter == *GHIDRA_CAST((g_manager + 1))) goto LAB_0077191b; - userCount = GHIDRA_INT(*GHIDRA_CAST((g_manager + 1))) - GHIDRA_INT(userIter) >> 2; - local_18 = GHIDRA_CAST(savedThis->_controllerIndex); - uVar6 = 0; - if (userCount == 0) goto LAB_0077191b; - goto LAB_00771900; - } - uVar5 = uVar5 + 1; - userIter = userIter + 1; - } while (uVar5 < 2); - } - goto LAB_0077196b; - while( true ) { - uVar6 = uVar6 + 1; - userIter = userIter + 1; - if (userCount <= uVar6) break; -LAB_00771900: - if (*GHIDRA_CAST((*userIter + 0xc)) == local_18) { - cVar3 = (**(code **)(*GHIDRA_CAST((*userIter + 0x370)) + 0x14))(); - if (cVar3 == '\0') { - fStack_24 = (float)(g_manager->_optionsConfig)._onlinePlayerVolume * 0.1; - goto LAB_00771923; - } - break; - } - } -LAB_0077191b: - fStack_24 = 1.0; -LAB_00771923: - pMVar2 = g_manager; - pEStack_2c = GHIDRA_CAST(0x38f); - seed_fart_sound_override(GHIDRA_CAST(&pEStack_2c)); - (GHIDRA_CAST((&pMVar2->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(pEStack_2c),fStack_24,2,0,1.0,0.0); - uVar6 = uVar5; -LAB_0077196b: - player = savedThis; - pEStack_2c = GHIDRA_CAST(0x0); - droppedPickup = GHIDRA_CAST(0x0); - if (uVar6 != 0xffffffff) { - pMStack_20 = GHIDRA_CAST(savedThis->_trinketsID[uVar6]); - userIter = savedThis->_trinketsID + uVar6; - local_18 = GHIDRA_CAST(0x0); - fStack_24 = (float)(GHIDRA_UINT(pMStack_20) & 0x7fff); - if ((fStack_24 == 2.24208e-44) && - (local_18 = GHIDRA_CAST(GetTrinketMultiplier(savedThis,0x10)), 3 < GHIDRA_INT(local_18))) { - local_18 = GHIDRA_CAST(0x3); - } - for (; (pMVar2 = pMStack_20, uVar6 == 0 && (*userIter != 0)); userIter = userIter + 1) { - uVar6 = 1; - *userIter = userIter[1]; - } - player->_trinketsID[uVar6] = 0; - if (pMStack_20 == GHIDRA_CAST(0x0)) { - droppedPickup = GHIDRA_CAST(0x0); - } - else { - pvVar1 = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT(fStack_24) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar1) >> 2) { - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + GHIDRA_INT(fStack_24) * 4)); - } - else { - iVar4 = 0; - } - player->_cacheFlags = player->_cacheFlags | *GHIDRA_CAST((iVar4 + 0x54)); - if (player->_variant == 0) { - uVar6 = Random(); - pEStack_2c = (Entity_Pickup *) - Game::SpawnEx(g_game,5,0x15e,DropPos,&g_vectorZero,GHIDRA_CAST(player), - GHIDRA_UINT(pMVar2),uVar6,0); - if (pEStack_2c != GHIDRA_CAST(0x0)) { - pEStack_2c->_collisionCooldown = 4; - pEStack_2c->_isTouched = 1; - } - } - TriggerTrinketRemoved(player,GHIDRA_UINT(pMVar2)); - droppedTrinketType = fStack_24; - pvVar1 = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT(fStack_24) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar1) >> 2) && - (VStack_10.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + GHIDRA_INT(fStack_24) * 4)), - GHIDRA_CAST(VStack_10.x) != GHIDRA_CAST(0x0))) { - if (((GHIDRA_CAST(VStack_10.x))->addCostumeOnPickup == 0) && - ((player->_temporaryeffects)._disabled == 0)) { - for (userIter = (player->_temporaryeffects)._effects._begin; - userIter != (player->_temporaryeffects)._effects._end; userIter = userIter + 4) { - if ((*GHIDRA_CAST(*userIter) == 2) && (GHIDRA_CAST((GHIDRA_CAST(*userIter))[1]) == pMStack_20)) - goto LAB_00771b15; - } - } - RemoveCostume(player,GHIDRA_CAST(VStack_10.x)); - } -LAB_00771b15: - if (droppedTrinketType == 1.70958e-43) { - userIter = GHIDRA_CAST(g_manager->_netplayManager); - if (userIter != *GHIDRA_CAST((g_manager + 1))) { - VStack_10.x = (float)player->_controllerIndex; - uVar6 = 0; - uVar5 = GHIDRA_INT(*GHIDRA_CAST((g_manager + 1))) - GHIDRA_INT(userIter) >> 2; - if (uVar5 != 0) { - do { - player = savedThis; - if (*GHIDRA_CAST((*userIter + 0xc)) == GHIDRA_CAST(VStack_10.x)) { - cVar3 = (**(code **)(*GHIDRA_CAST((*userIter + 0x370)) + 0x14))(); - if (cVar3 == '\0') { - sfxVolume = (float)(g_manager->_optionsConfig)._onlinePlayerVolume * 0.1; - } - break; - } - uVar6 = uVar6 + 1; - userIter = userIter + 1; - } while (uVar6 < uVar5); - } - } - pMVar2 = g_manager; - pMStack_20 = GHIDRA_CAST(0x385); - seed_fart_sound_override(GHIDRA_CAST(&pMStack_20)); - (GHIDRA_CAST((&pMVar2->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(pMStack_20),sfxVolume,2,0,1.0,0.0); - } - else if ((droppedTrinketType == 2.24208e-44) && - (pvVar1 = g_game->_room, (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)) + 0x44)) & 1) == 0)) { - iVar4 = GHIDRA_INT((((pEStack_2c->_pos).x - 40.0) / 40.0 + 0.5)); - if ((iVar4 < 0) || - (((gridWidth = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)), gridWidth <= iVar4 || - (gridY = GHIDRA_INT((((pEStack_2c->_pos).y - 120.0) / 40.0 + 0.5)), gridY < 0)) || - (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x10)) <= gridY)))) { - gridWidth = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)); - iVar4 = -1; - } - else { - iVar4 = gridY * gridWidth + iVar4; - } - VStack_10.x = (float)(iVar4 % gridWidth) * 40.0 + 40.0; - VStack_10.y = (float)(iVar4 / gridWidth) * 40.0 + 120.0; - if (0 < GHIDRA_INT(local_18)) { - uVar6 = 0; - userIter = local_18; - do { - uVar5 = Random(); - spawnedEffect = - Game::SpawnEx(g_game,1000,0x1d,&VStack_10,&g_vectorZero,GHIDRA_CAST(0x0),uVar6,uVar5,0 - ); - effect = GHIDRA_CAST(__RTDynamicCast(spawnedEffect,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect:: - RTTI_Type_Descriptor,0)); - effect[0xcd] = GHIDRA_INT(VStack_10.x); - effect[0xce] = GHIDRA_INT(VStack_10.y); - (**(code **)(*effect + 0xc))(); - uVar6 = uVar6 + 0x1e; - userIter = GHIDRA_CAST((GHIDRA_INT(userIter) + -1)); - } while (userIter != GHIDRA_CAST(0x0)); - } - } - droppedPickup = pEStack_2c; - } - } - if (player->_cacheFlags != 0) { - EvaluateItems(player); - } - return droppedPickup; -} - -// 00771d30 -void Entity_Player::AddTrinket(int type, uint8_t firsttime) -{ - uint8_t isExtraSlotItemHeld; - char cVar1; - int *trinketSlot; - uint32_t slot; - void *pvVar2; - uint32_t uVar3; - uint32_t uVar4; - uint32_t slot; - void *trinketName [4]; - uint32_t trinketNameSize; - uint32_t trinketNameCapacity; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - void *local_8; - Game *game; - ItemConfig_Item *trinketConfig; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00aff10d; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((trinketName + 10)); - ExceptionList = &local_10; - pvVar2 = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT((type & 0x7fffU)) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar2) >> 2) && - (trinketConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + (type & 0x7fffU) * 4)), - trinketConfig != GHIDRA_CAST(0x0))) { - if (trinketConfig->addCostumeOnPickup != 0) { - AddCostume(this,trinketConfig,0); - } - uVar3 = 1; - isExtraSlotItemHeld = HasCollectible(this,0x8b,0); - if ((isExtraSlotItemHeld != 0) || - (isExtraSlotItemHeld = HasCollectible(this,0x1ca,0), isExtraSlotItemHeld != 0)) { - uVar3 = 2; - } - slot = 0; - trinketSlot = this->_trinketsID; - do { - if (*trinketSlot == 0) { - this->_cacheFlags = this->_cacheFlags | trinketConfig->cacheFlags; - this->_trinketsID[slot] = type; - break; - } - slot = slot + 1; - trinketSlot = trinketSlot + 1; - } while (slot < uVar3); - ItemConfig_Item::GetLocalizedName(trinketConfig,GHIDRA_CAST(trinketName),0); - local_8 = (void *)0x0; - KAGE_LogMessage(1,GHIDRA_CAST("Adding trinket %d (%s) to player %d (%s)\n")); - local_8 = (void *)0xffffffff; - if (0xf < trinketNameCapacity) { - uVar3 = trinketNameCapacity + 1; - pvVar2 = trinketName[0]; - if (0xfff < uVar3) { - pvVar2 = *(void **)(GHIDRA_INT(trinketName[0]) + -4); - uVar3 = trinketNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(trinketName[0]) + (-4 - GHIDRA_INT(pvVar2))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar2,uVar3); - } - trinketNameSize = 0; - trinketNameCapacity = 0xf; - trinketName[0] = (void *)(GHIDRA_UINT(trinketName[0]) & 0xffffff00); - TriggerTrinketAdded(this,type,firsttime); - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - slot = 0; - uVar4 = 0x10; - cVar1 = ItemConfig::trinket_has_tags(0x10,0); - if ((cVar1 != '\0') && (uVar3 = FUN_0075f020(0x10,0,uVar4,slot), 2 < uVar3)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x16f); - } - InvalidateCoPlayerItems(this); - } - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - if (this->_parent != 0) { - DropTrinket(this,&this->_pos,1); - } - } - ExceptionList = local_10; - return; -} - -// 00771f60 -uint8_t Entity_Player::TryRemoveTrinket(uint32_t id) -{ - uint8_t bVar1; - int iVar2; - uint32_t uVar3; - uint32_t uVar4; - void *pvVar5; - int *piVar6; - int *piVar7; - int *local_30; - void *trinketName [5]; - uint32_t trinketNameCapacity; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - void *local_8; - Entity_Player *procItemOwner; - ItemConfig_Item *queuedItem; - ItemConfig_Item *trinketConfig; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00af32ed; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((trinketName + 10)); - ExceptionList = &local_10; - uVar3 = id & 0x7fff; - pvVar5 = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT(uVar3) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar5) >> 2) && - (trinketConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + uVar3 * 4)), - trinketConfig != GHIDRA_CAST(0x0))) { - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - InvalidateCoPlayerItems(this); - } - queuedItem = (this->_queuedItem)._item; - if ((queuedItem != GHIDRA_CAST(0x0)) && (queuedItem == trinketConfig)) { - ClearQueueItem(this); - ExceptionList = local_10; - return 1; - } - piVar7 = GHIDRA_CAST(0x1); - local_30 = GHIDRA_CAST(0x1); - bVar1 = HasCollectible(this,0x8b,0); - if ((bVar1 != 0) || (bVar1 = HasCollectible(this,0x1ca,0), bVar1 != 0)) { - piVar7 = GHIDRA_CAST(0x2); - local_30 = GHIDRA_CAST(0x2); - } - uVar4 = 0; - piVar6 = this->_trinketsID; - do { - if ((*piVar6 == id) || ((*piVar6 & 0x7fffU) == id)) { - if (uVar4 < GHIDRA_INT(piVar7) - 1U) { - iVar2 = (GHIDRA_INT(piVar7) - 1U) - uVar4; - piVar7 = this->_trinketsID + uVar4 + 1; - piVar6 = this->_trinketsID + uVar4; - for (; iVar2 != 0; iVar2 = iVar2 + -1) { - *piVar6 = *piVar7; - piVar7 = piVar7 + 1; - piVar6 = piVar6 + 1; - } - piVar7 = local_30; - } - this->_trinketsID[GHIDRA_INT(piVar7) - 1] = 0; - ItemConfig_Item::GetLocalizedName(trinketConfig,GHIDRA_CAST(trinketName),0); - local_8 = (void *)0x0; - KAGE_LogMessage(1,GHIDRA_CAST("Removing trinket %d (%s) from player %d (%s)\n")); - local_8 = (void *)0xffffffff; - if (0xf < trinketNameCapacity) { - uVar4 = trinketNameCapacity + 1; - pvVar5 = trinketName[0]; - if (0xfff < uVar4) { - pvVar5 = *(void **)(GHIDRA_INT(trinketName[0]) + -4); - uVar4 = trinketNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(trinketName[0]) + (-4 - GHIDRA_INT(pvVar5))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar5,uVar4); - } - TriggerTrinketRemoved(this,id); - pvVar5 = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT(uVar3) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar5) >> 2) && - (trinketConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + uVar3 * 4)), - trinketConfig != GHIDRA_CAST(0x0))) { - if ((trinketConfig->addCostumeOnPickup == 0) && ((this->_temporaryeffects)._disabled == 0) - ) { - for (piVar7 = (this->_temporaryeffects)._effects._begin; - piVar7 != (this->_temporaryeffects)._effects._end; piVar7 = piVar7 + 4) { - if ((*GHIDRA_CAST(*piVar7) == 2) && ((GHIDRA_CAST(*piVar7))[1] == id)) { - ExceptionList = local_10; - return 1; - } - } - } - RemoveCostume(this,trinketConfig); - } - ExceptionList = local_10; - return 1; - } - uVar4 = uVar4 + 1; - piVar6 = piVar6 + 1; - } while (uVar4 < piVar7); - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - bVar1 = TryRemoveSmeltedTrinket(this,id); - ExceptionList = local_10; - return bVar1; - } - piVar7 = (this->_proceduralItems)._itemIds._head; - local_30 = GHIDRA_CAST(*piVar7); - if (local_30 != piVar7) { - do { - uVar3 = ~local_30[4]; - if ((local_30[4] < 0) && - (GHIDRA_INT(uVar3) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._begin) >> 2)) { - piVar7 = (this->_proceduralItems)._itemIds._head; - iVar2 = *GHIDRA_CAST((GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._begin) + uVar3 * 4 - )); - if ((iVar2 != 0) && - (((piVar6 = *GHIDRA_CAST((iVar2 + 0x10)), piVar6 != GHIDRA_CAST(0x0) && (*piVar6 == 2)) && - (piVar6[1] == id)))) { - if (local_30[4] == 0) { - ExceptionList = local_10; - return 0; - } - procItemOwner = (this->_proceduralItems)._player; - if (procItemOwner == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return 0; - } - RemoveCollectible(procItemOwner,local_30[4],0,0,1); - ExceptionList = local_10; - return 1; - } - } - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_30); - } while (local_30 != piVar7); - } - } - ExceptionList = local_10; - return 0; -} - -// 00772260 -uint8_t Entity_Player::TryRemoveSmeltedTrinket(uint32_t id) -{ - uint8_t isRemoved; - void *pvVar1; - uint32_t uVar2; - uint32_t trinketID; - int historyEntry; - void *local_30; - uint32_t uStack_2c; - char acStack_28 [12]; - uint32_t uStack_1c; - uint32_t local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - short *smeltedCount; - std_vector *smeltedTrinkets; - ItemConfig_Item *trinketConfig; - - local_8 = 0xffffffff; - puStack_c = &LAB_00aff155; - local_10 = ExceptionList; - local_18 = __security_cookie ^ GHIDRA_UINT((acStack_28 + 0x24)); - ExceptionList = &local_10; - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - InvalidateCoPlayerItems(this); - } - trinketID = id & 0x7fff; - pvVar1 = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT(trinketID) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar1) >> 2) && - (trinketConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + trinketID * 4)), - trinketConfig != GHIDRA_CAST(0x0))) { - smeltedTrinkets = &this->_smeltedTrinkets; - if (((id >> 0xf & 1) == 0) && (0 < *GHIDRA_CAST((GHIDRA_CAST(smeltedTrinkets->_begin) + trinketID * 4)))) { - ItemConfig_Item::GetLocalizedName(trinketConfig,GHIDRA_CAST(&local_30),0); - local_8 = 0; - KAGE_LogMessage(1,GHIDRA_CAST("Removing smelted trinket %d (%s) from player %d (%s)\n")); - local_8 = 0xffffffff; - if (0xf < uStack_1c) { - uVar2 = uStack_1c + 1; - pvVar1 = local_30; - if (0xfff < uVar2) { - pvVar1 = *(void **)(GHIDRA_CAST(local_30) + -4); - uVar2 = uStack_1c + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_30) + (-4 - GHIDRA_INT(pvVar1))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar1,uVar2); - } - smeltedCount = GHIDRA_CAST((trinketID * 4 + GHIDRA_INT(smeltedTrinkets->_begin))); - *smeltedCount = *smeltedCount + -1; - TriggerTrinketRemoved(this,trinketID); - local_30 = (void *)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x1))),'\x01'); - historyEntry = g_game->_frameCount; - acStack_28[0] = '\x01'; - acStack_28[1] = '\0'; - acStack_28[2] = '\0'; - acStack_28[3] = '\0'; - acStack_28[4] = '\0'; - acStack_28[5] = '\0'; - acStack_28[6] = '\0'; - acStack_28[7] = '\0'; - acStack_28[8] = '\x01'; - acStack_28[9] = '\0'; - acStack_28[10] = '\0'; - acStack_28[0xb] = '\0'; - uStack_1c = 0; - uStack_2c = trinketID; - FUN_00721b70(&historyEntry); - } - else { - if (*GHIDRA_CAST((GHIDRA_CAST(smeltedTrinkets->_begin) + trinketID * 4 + 2)) < 1) goto LAB_00772509; - ItemConfig_Item::GetLocalizedName(trinketConfig,GHIDRA_CAST(&local_30),0); - local_8 = 1; - KAGE_LogMessage(1,GHIDRA_CAST("Removing smelted trinket %d (%s) from player %d (%s)\n")); - local_8 = 0xffffffff; - if (0xf < uStack_1c) { - uVar2 = uStack_1c + 1; - pvVar1 = local_30; - if (0xfff < uVar2) { - pvVar1 = *(void **)(GHIDRA_CAST(local_30) + -4); - uVar2 = uStack_1c + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_30) + (-4 - GHIDRA_INT(pvVar1))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar1,uVar2); - } - smeltedCount = GHIDRA_CAST((GHIDRA_INT(smeltedTrinkets->_begin) + trinketID * 4 + 2)); - *smeltedCount = *smeltedCount + -1; - TriggerTrinketRemoved(this,trinketID | 0x8000); - local_30 = (void *)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x1))),'\x01'); - historyEntry = g_game->_frameCount; - acStack_28[0] = '\x01'; - acStack_28[1] = '\0'; - acStack_28[2] = '\0'; - acStack_28[3] = '\0'; - acStack_28[4] = '\0'; - acStack_28[5] = '\0'; - acStack_28[6] = '\0'; - acStack_28[7] = '\0'; - acStack_28[8] = '\x01'; - acStack_28[9] = '\0'; - acStack_28[10] = '\0'; - acStack_28[0xb] = '\0'; - uStack_1c = 0; - uStack_2c = trinketID | 0x8000; - FUN_00721b70(&historyEntry); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(smeltedTrinkets->_begin) + trinketID * 4)) < 1) && - (*GHIDRA_CAST((GHIDRA_CAST(smeltedTrinkets->_begin) + trinketID * 4 + 2)) < 1)) { - TryRemoveTrinketCostume(this,trinketID); - } - isRemoved = 1; - } - else { - KAGE_LogMessage(4,GHIDRA_CAST("Tried to remove smelted trinket with invalid trinket type (%d) \n")); -LAB_00772509: - isRemoved = 0; - } - ExceptionList = local_10; - return isRemoved; -} - -// 00772530 -uint8_t Entity_Player::replace_trinket(int unused0, int unused1, int unused2) -{ - ItemConfig_Item *pIVar1; - uint8_t bVar2; - uint32_t index; - int *piVar3; - void *pvVar4; - short *smeltedGoldenCount; - uint32_t index; - ItemConfig_Item *storeCredit; - void *oldName [5]; - uint32_t oldNameCapacity; - void *newName [4]; - uint32_t newNameSize; - uint32_t newNameCapacity; - void *smeltedOldName [4]; - uint32_t smeltedOldNameSize; - uint32_t smeltedOldNameCapacity; - void *smeltedNewName [4]; - uint32_t smeltedNewNameSize; - uint32_t smeltedNewNameCapacity; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - void *local_8; - short goldenCount; - short *smeltedCount; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00aff1a5; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((smeltedNewName + 10)); - ExceptionList = &local_10; - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - InvalidateCoPlayerItems(this); - } - pvVar4 = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar4) >> 2 < 0xe) { - storeCredit = GHIDRA_CAST(0x0); - } - else { - storeCredit = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x34)); - } - pIVar1 = (this->_queuedItem)._item; - if (((pIVar1 == GHIDRA_CAST(0x0)) || (pIVar1 != storeCredit)) || - (bVar2 = (this->_queuedItem)._flags, (bVar2 & 2) == 0)) { - index = 1; - bVar2 = HasCollectible(this,0x8b,0); - if ((bVar2 != 0) || (bVar2 = HasCollectible(this,0x1ca,0), bVar2 != 0)) { - index = 2; - } - index = 0; - piVar3 = this->_trinketsID; - do { - if (*piVar3 == 0x800d) { - this->_trinketsID[index] = 0xd; - ItemConfig_Item::GetLocalizedName(storeCredit,GHIDRA_CAST(oldName),0); - local_8 = (void *)0x0; - ItemConfig_Item::GetLocalizedName(storeCredit,GHIDRA_CAST(newName),0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - KAGE_LogMessage(1,(uint8_t *) - "Replacing trinket %d (%s) from player %d (%s) with trinket %d (%s)\n"); - local_8 = (void *)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8); - if (0xf < newNameCapacity) { - index = newNameCapacity + 1; - pvVar4 = newName[0]; - if (0xfff < index) { - pvVar4 = *(void **)(GHIDRA_INT(newName[0]) + -4); - index = newNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(newName[0]) + (-4 - GHIDRA_INT(pvVar4))))) goto LAB_00772920; - } - operator_delete(pvVar4,index); - } - local_8 = (void *)0xffffffff; - newNameSize = 0; - newNameCapacity = 0xf; - newName[0] = (void *)(GHIDRA_UINT(newName[0]) & 0xffffff00); - if (0xf < oldNameCapacity) { - index = oldNameCapacity + 1; - pvVar4 = oldName[0]; - if (0xfff < index) { - pvVar4 = *(void **)(GHIDRA_INT(oldName[0]) + -4); - index = oldNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(oldName[0]) + (-4 - GHIDRA_INT(pvVar4))))) { -LAB_00772920: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar4,index); - } - TriggerTrinketRemoved(this,0x800d); - pvVar4 = (g_manager->_itemConfig)._trinkets._begin; - if (((0x34 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar4) & 0xfffffffcU)) - ) && (pIVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x34)), - pIVar1 != GHIDRA_CAST(0x0))) && - ((pIVar1->addCostumeOnPickup != 0 || - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasTrinketEffect(0x800d), bVar2 == 0 - )))) { - RemoveCostume(this,pIVar1); - } - TriggerTrinketAdded(this,0xd,0); - if (storeCredit->addCostumeOnPickup != 0) { - AddCostume(this,storeCredit,0); - } - goto LAB_007729a1; - } - index = index + 1; - piVar3 = piVar3 + 1; - } while (index < index); - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - pvVar4 = (this->_history)._historyItems._begin; - index = 0; - index = (GHIDRA_INT((this->_history)._historyItems._end) - GHIDRA_INT(pvVar4)) / 0x1c; - if (index != 0) { - piVar3 = GHIDRA_CAST((GHIDRA_INT(pvVar4) + 8)); - do { - if (((char)piVar3[-1] != '\0') && (*piVar3 == 0x800d)) { - smeltedGoldenCount = - GHIDRA_CAST((GHIDRA_INT((this->_smeltedTrinkets)._begin) + storeCredit->id * 4 + 2)); - smeltedCount = GHIDRA_CAST((GHIDRA_INT((this->_smeltedTrinkets)._begin) + storeCredit->id * 4)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + index * 0x1c + 8)) = 0xd; - goldenCount = *smeltedGoldenCount; - if (0 < goldenCount) { - *smeltedGoldenCount = goldenCount + -1; - TriggerTrinketRemoved(this,0x800d); - pvVar4 = (this->_smeltedTrinkets)._begin; - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + storeCredit->id * 4)) < 1) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + storeCredit->id * 4 + 2)) < 1)) { - TryRemoveTrinketCostume(this,0x800d); - } - *smeltedCount = *smeltedCount + 1; - TriggerTrinketAdded(this,0xd,0); - if (storeCredit->addCostumeOnPickup != 0) { - AddCostume(this,storeCredit,0); - } - } - ItemConfig_Item::GetLocalizedName(storeCredit,GHIDRA_CAST(smeltedOldName),0); - local_8 = (void *)0x2; - ItemConfig_Item::GetLocalizedName(storeCredit,GHIDRA_CAST(smeltedNewName),0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 3; - KAGE_LogMessage(1,(uint8_t *) - "Replacing smelted trinket %d (%s) from player %d (%s) with trinket %d (%s)\n" - ); - local_8 = (void *)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); - if (0xf < smeltedNewNameCapacity) { - index = smeltedNewNameCapacity + 1; - pvVar4 = smeltedNewName[0]; - if (0xfff < index) { - pvVar4 = *(void **)(GHIDRA_INT(smeltedNewName[0]) + -4); - index = smeltedNewNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(smeltedNewName[0]) + (-4 - GHIDRA_INT(pvVar4))))) goto LAB_007727f2; - } - operator_delete(pvVar4,index); - } - local_8 = (void *)0xffffffff; - smeltedNewNameSize = 0; - smeltedNewNameCapacity = 0xf; - smeltedNewName[0] = (void *)(GHIDRA_UINT(smeltedNewName[0]) & 0xffffff00); - if (0xf < smeltedOldNameCapacity) { - index = smeltedOldNameCapacity + 1; - pvVar4 = smeltedOldName[0]; - if (0xfff < index) { - pvVar4 = *(void **)(GHIDRA_INT(smeltedOldName[0]) + -4); - index = smeltedOldNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(smeltedOldName[0]) + (-4 - GHIDRA_INT(pvVar4))))) { -LAB_007727f2: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar4,index); - } - smeltedOldNameSize = 0; - smeltedOldNameCapacity = 0xf; - smeltedOldName[0] = (void *)(GHIDRA_UINT(smeltedOldName[0]) & 0xffffff00); - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - goto LAB_007729a1; - } - index = index + 1; - piVar3 = piVar3 + 7; - } while (index < index); - } - } - bVar2 = 0; - } - else { - (this->_queuedItem)._item = storeCredit; - (this->_queuedItem)._flags = bVar2 & 0xfd; -LAB_007729a1: - bVar2 = 1; - } - ExceptionList = local_10; - return bVar2; -} - -// 007791f0 -void Entity_Player::SetFullHearts() -{ - int iVar1; - HUD *playerHud; - uint32_t hudIdx; - int extraout_EDX; - int effectiveHearts; - Entity_Player *subPlayer; - - iVar1 = this->_playerType; - while ((iVar1 == 0x11 && - (subPlayer = GHIDRA_CAST(this->_subPlayer), subPlayer != GHIDRA_CAST(0x0)))) { - iVar1 = subPlayer->_playerType; - this = subPlayer; - } - iVar1 = GetHealthType(this); - if ((iVar1 == 1) || (iVar1 == 2)) { - iVar1 = this->_maxHearts; - } - else { - iVar1 = this->_maxHearts + this->_boneHearts * 2; - } - this->_redHearts = iVar1; - if (extraout_EDX <= iVar1) { - playerHud = &g_game->_hud; - hudIdx = 0; - do { - if (*GHIDRA_CAST(playerHud->_playerHUD) == this) { - playerHud->_playerHUD[0xc] = 4; - break; - } - hudIdx = hudIdx + 1; - playerHud = GHIDRA_CAST((playerHud->_playerHUD + 0x6dc)); - } while (hudIdx < 8); - } - UpdateHeartDependentEffects(this); - if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && (this->_dead == 0)) && - (iVar1 = this->_goldenHearts, 0 < iVar1)) { - effectiveHearts = this->_redHearts; - if (this->_maxHearts < this->_redHearts) { - effectiveHearts = this->_maxHearts; - } - effectiveHearts = (effectiveHearts + 1) / 2 + (this->_soulHearts + 1) / 2 + this->_boneHearts; - if (effectiveHearts < iVar1) { - BreakGoldenHearts(this,iVar1 - effectiveHearts); - this->_goldenHearts = effectiveHearts; - } - } - update_bone_hearts(this); - return; -} - -// 00779320 -Entity * Entity_Player::GetFocusEntity() -{ - Entity *target; - uint32_t weaponIdx; - void **weaponSlot; - - target = this->_markedTarget; - if (target == GHIDRA_CAST(0x0)) { - weaponIdx = 0; - weaponSlot = this->_weapons; - do { - weaponSlot = weaponSlot + 1; - if ((*weaponSlot != GHIDRA_CAST(0x0)) && - (target = GHIDRA_CAST((**(code **)(*GHIDRA_CAST(*weaponSlot) + 0x24))()), target != GHIDRA_CAST(0x0))) - { - return target; - } - weaponIdx = weaponIdx + 1; - } while (weaponIdx < 4); - target = GHIDRA_CAST(0x0); - } - return target; -} - -// 00779360 -Vector * Entity_Player::GetMovementJoystick(Vector *outJoystick) -{ - uint8_t bVar1; - uint32_t curses; - Entity_Player *extraout_ECX; - Entity_Player *unused; - int unused_00; - int unused_01; - int unused_02; - void *seedEffectsEnd; - float fVar2; - float rightValue; - float cardinalPositive; - float resultX; - float minusOne; - float joystickX; - float cardinalY; - float joystickY; - uint32_t seedKey; - uint8_t seedIter [8]; - void *seedNode; - Game *game; - int playerType; - Entity_Player *twin; - - playerType = this->_playerType; - unused = this; - if ((((playerType == 0x14) || - ((unused = GHIDRA_CAST(this->_parent), unused != GHIDRA_CAST(0x0) && - (unused->_type == 1)))) || - (((playerType == 0x1d || (playerType == 0x26)) && - ((((twin = GHIDRA_CAST(this->_twinPlayer), twin != GHIDRA_CAST(0x0) && - (unused = GHIDRA_CAST(twin->_playerIndex), unused != GHIDRA_CAST(0xffffffff))) && - (GHIDRA_INT(unused) < this->_playerIndex)) && (twin != this)))))) && - ((this->_isControlsEnabled != 0 && (this->_controlsCooldown < 1)))) { - bVar1 = input_is_action_pressed(0xb,this->_controllerIndex,GHIDRA_CAST(0x0),GHIDRA_INT(unused)); - fVar2 = g_vectorZero.y; - unused = extraout_ECX; - if (bVar1 != 0) { - outJoystick->x = g_vectorZero.x; - outJoystick->y = fVar2; - return outJoystick; - } - } - fVar2 = InputManager::GetActionValue(0,this->_controllerIndex,GHIDRA_CAST(this),GHIDRA_INT(unused)); - cardinalY = 0.0; - rightValue = InputManager::GetActionValue(1,this->_controllerIndex,GHIDRA_CAST(this),unused_00); - joystickX = rightValue + (0.0 - fVar2); - fVar2 = InputManager::GetActionValue(2,this->_controllerIndex,GHIDRA_CAST(this),unused_01); - joystickY = InputManager::GetActionValue(3,this->_controllerIndex,GHIDRA_CAST(this),unused_02); - game = g_game; - joystickY = joystickY + (0.0 - fVar2); - minusOne = (float)&DAT_bf800000; - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && ((this->_flags & 0x200) != 0)) { - joystickX = joystickX * -1.0; - joystickY = joystickY * -1.0; - } - seedKey = 0xc; - resultX = joystickX; - fVar2 = joystickY; - msvc::set::find_node(seedIter,&seedKey); - if ((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0xd)) { - seedEffectsEnd = (game->_seedEffects)._seedEffects; - if (seedNode != seedEffectsEnd) { - resultX = resultX * minusOne; - fVar2 = fVar2 * minusOne; - joystickX = resultX; - joystickY = fVar2; - } - } - else { - seedEffectsEnd = (game->_seedEffects)._seedEffects; - } - seedKey = 0x4c; - msvc::set::find_node(seedIter,&seedKey); - if (((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x4d)) && - (seedNode != seedEffectsEnd)) { - cardinalPositive = 0.0; - if (ABS(resultX) <= ABS(fVar2)) { - joystickX = 0.0; - if (0.0 <= fVar2) { - cardinalPositive = 1.0; - goto LAB_00779591; - } - cardinalY = minusOne; - } - else if (0.0 <= resultX) { - joystickX = 1.0; -LAB_00779591: - cardinalY = cardinalPositive; - } - else { - joystickX = minusOne; - } - fVar2 = sqrtf(fVar2 * fVar2 + resultX * resultX); - joystickY = cardinalY * fVar2; - resultX = joystickX * fVar2; - joystickX = resultX; - } - if ((game->_currentDimensionIdx != 1) || ((game->_stageType != 4 && (game->_stageType != 5)))) - goto LAB_00779606; - if (game->_stage != 2) { - if (game->_stage != 1) goto LAB_00779606; - curses = Level::GetCurses(GHIDRA_CAST(game)); - resultX = joystickX; - if ((curses & 2) == 0) goto LAB_00779606; - } - resultX = resultX * -1.0; -LAB_00779606: - outJoystick->x = resultX; - outJoystick->y = joystickY; - return outJoystick; -} - -// 00779620 -Vector * Entity_Player::GetShootingJoystick(Vector *outJoystick) -{ - uint8_t isTimedSetActive; - Vector *movementJoystick; - uint32_t curses; - int unused; - int unused_00; - int unused_01; - int unused_02; - Game *game; - void *seedEffectsHead; - uint8_t *puVar1; - float fVar2; - uint8_t *snappedX; - uint8_t *snappedY; - uint32_t seedEffect; - Vector local_20; - void *seedNode; - uint8_t seedFindResult [8]; - void *seedNode2; - int controllerIndex; - float joystickX; - - game = g_game; - snappedY = GHIDRA_CAST(0x0); - outJoystick->y = 0.0; - outJoystick->x = 0.0; - seedEffect = 0x4a; - msvc::set::find_node(&local_20,&seedEffect); - if ((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x4b)) { - seedEffectsHead = (game->_seedEffects)._seedEffects; - if (seedNode == seedEffectsHead) goto LAB_00779739; - movementJoystick = GetMovementJoystick(this,&local_20); - game = g_game; - fVar2 = movementJoystick->y; - outJoystick->x = movementJoystick->x; - outJoystick->y = fVar2; - } - else { - seedEffectsHead = (game->_seedEffects)._seedEffects; -LAB_00779739: - seedEffect = 0x4b; - msvc::set::find_node(&local_20,&seedEffect); - if (((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x4c)) && - (seedNode != seedEffectsHead)) { - movementJoystick = GetMovementJoystick(this,&local_20); - game = g_game; - fVar2 = movementJoystick->y * -1.0; - outJoystick->x = movementJoystick->x * -1.0; - outJoystick->y = fVar2; - } - else { - fVar2 = InputManager::GetActionValue(4,this->_controllerIndex,GHIDRA_CAST(this),unused); - controllerIndex = this->_controllerIndex; - outJoystick->x = outJoystick->x - fVar2; - fVar2 = InputManager::GetActionValue(5,controllerIndex,GHIDRA_CAST(this),unused_00); - controllerIndex = this->_controllerIndex; - outJoystick->x = fVar2 + outJoystick->x; - fVar2 = InputManager::GetActionValue(6,controllerIndex,GHIDRA_CAST(this),unused_01); - controllerIndex = this->_controllerIndex; - outJoystick->y = outJoystick->y - fVar2; - fVar2 = InputManager::GetActionValue(7,controllerIndex,GHIDRA_CAST(this),unused_02); - game = g_game; - fVar2 = fVar2 + outJoystick->y; - outJoystick->y = fVar2; - isTimedSetActive = Game::IsInTimedSet(game,0xc); - if (isTimedSetActive != 0) { - fVar2 = fVar2 * -1.0; - outJoystick->x = outJoystick->x * -1.0; - outJoystick->y = fVar2; - } - } - } - puVar1 = &DAT_bf800000; - seedEffect = 0x4c; - msvc::set::find_node(seedFindResult,&seedEffect); - if (((*GHIDRA_CAST((GHIDRA_CAST(seedNode2) + 0xd)) != '\0') || (0x4c < *GHIDRA_CAST((GHIDRA_CAST(seedNode2) + 0x10)))) || - (seedNode2 == (game->_seedEffects)._seedEffects)) goto LAB_007798af; - joystickX = outJoystick->x; - if (ABS(joystickX) <= ABS(fVar2)) { - snappedX = GHIDRA_CAST(0x0); - if (0.0 <= fVar2) { - puVar1 = GHIDRA_CAST(0x3f800000); - } -LAB_00779872: - snappedY = puVar1; - } - else { - if (0.0 <= joystickX) { - snappedX = GHIDRA_CAST(0x3f800000); - puVar1 = GHIDRA_CAST(0x0); - goto LAB_00779872; - } - snappedX = puVar1; - } - fVar2 = sqrtf(joystickX * joystickX + fVar2 * fVar2); - outJoystick->x = (float)snappedX * fVar2; - outJoystick->y = (float)snappedY * fVar2; -LAB_007798af: - if (((game->_currentDimensionIdx == 1) && ((game->_stageType == 4 || (game->_stageType == 5)))) && - ((game->_stage == 2 || - ((game->_stage == 1 && (curses = Level::GetCurses(GHIDRA_CAST(game)), (curses & 2) != 0)))))) { - outJoystick->x = outJoystick->x * -1.0; - } - return outJoystick; -} - -// 00779900 -void Entity_Player::GetBodyMoveDirection(Vector *buffer) -{ - uint8_t isMontezumasRevenge; - void *weapon; - void *pvVar1; - float fVar2; - Vector moveDirection; - - moveDirection.x = (this->_recentMovementVector).x; - pvVar1 = this->_weapons[0]; - moveDirection.y = (this->_recentMovementVector).y; - if (pvVar1 == (void *)0x0) { - if (this->_weapons[1] != (void *)0x0) { - weapon = this->_weapons[1]; - goto LAB_00779944; - } - } - else { - weapon = pvVar1; -LAB_00779944: - if ((*GHIDRA_CAST((GHIDRA_CAST(weapon) + 0x3c)) != g_vectorZero.x) || - (*GHIDRA_CAST((GHIDRA_CAST(weapon) + 0x40)) != g_vectorZero.y)) { - if (pvVar1 == (void *)0x0) { - pvVar1 = this->_weapons[1]; - } - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x40)); - buffer->x = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x3c)); - buffer->y = fVar2; - return; - } - } - isMontezumasRevenge = HasCollectible(this,0x2a8,0); - if (isMontezumasRevenge != 0) { - pvVar1 = this->_montezumaLaser; - if ((pvVar1 == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x28)) != 7)) { - if (this->_montezumaChargeTimer < 1) goto LAB_007799dd; - fVar2 = this->_bodyAngle; - } - else { - fVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x41c)) + 180.0; - } - moveDirection.x = cos(fVar2 * 0.017453292); - moveDirection.y = sin(fVar2 * 0.017453292); - } -LAB_007799dd: - buffer->x = moveDirection.x; - buffer->y = moveDirection.y; - return; -} - -// 00779a20 -int Entity_Player::GetWeaponModifiers() -{ - uint8_t isHasItem; - uint32_t finalModifiers; - uint32_t modifiers; - - isHasItem = HasCollectible(this,0x45,0); - modifiers = GHIDRA_UINT((isHasItem != 0)); - isHasItem = HasCollectible(this,0x13c,0); - if (isHasItem != 0) { - modifiers = modifiers | 2; - } - isHasItem = HasCollectible(this,0x76,0); - if (isHasItem != 0) { - modifiers = modifiers | 4; - } - isHasItem = HasCollectible(this,0xe5,0); - if (isHasItem != 0) { - modifiers = modifiers | 8; - } - isHasItem = HasCollectible(this,0x149,0); - if (isHasItem != 0) { - modifiers = modifiers | 0x10; - } - isHasItem = HasCollectible(this,0xde,0); - if (isHasItem != 0) { - modifiers = modifiers | 0x20; - } - isHasItem = HasCollectible(this,0x18d,0); - if (isHasItem != 0) { - modifiers = modifiers | 0x40; - } - isHasItem = HasCollectible(this,0x255,0); - if (isHasItem != 0) { - modifiers = modifiers | 0x100; - } - isHasItem = HasCollectible(this,0x14a,0); - if ((isHasItem != 0) || (isHasItem = HasCollectible(this,0x231,0), isHasItem != 0)) { - modifiers = modifiers | 0x80; - } - finalModifiers = modifiers | 0x200; - if (this->_playerType != 0x1c) { - finalModifiers = modifiers; - } - isHasItem = HasCollectible(this,0x2a6,0); - if (isHasItem != 0) { - finalModifiers = finalModifiers | 0x800; - } - return finalModifiers; -} - -// 00779b40 -void Entity_Player::update_body_animations() -{ - uint8_t bVar1; - Vector *vecResult; - int nextCooldown; - int iVar2; - float *pfVar3; - char *headAnimName; - uint32_t uVar4; - void *pvVar5; - Entity *spawnedEffect; - ColorMod *color; - uint8_t extraout_CL; - uint8_t isUnused; - uint8_t isUnused_00; - uint8_t isUnused_01; - uint8_t isUnused_02; - uint8_t isUnused_03; - Entity_Player *tempEffects; - uint8_t *blinkAnimName; - uint32_t uVar6; - float fVar7; - float normalDot; - float fVar8; - float fVar9; - Vector local_70; - float local_68; - float local_64; - float local_60; - float moveX; - uint8_t *local_58; - float local_54; - uint8_t local_50 [40]; - float local_28; - int moveActions [2]; - Vector VStack_1c; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - int local_8; - uint64_t flags; - float gridVelocityX; - bool isSlippery; - TemporaryEffects *tempEffects; - - local_8 = 0xffffffff; - puStack_c = &LAB_00aff2ed; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((moveActions + 8)); - if (this->_heightVelocity <= 0.0 && this->_heightVelocity != 0.0) { - return; - } - pfVar3 = &(this->_posOffset).y; - if (*pfVar3 <= 0.0 && *pfVar3 != 0.0) { - return; - } - iVar2 = this->_target; - if (iVar2 != 0) { - fVar7 = *GHIDRA_CAST((iVar2 + 0x340)); - fVar8 = (this->_pos).y; - (this->_velocity).x = *GHIDRA_CAST((iVar2 + 0x33c)) - (this->_pos).x; - (this->_velocity).y = fVar7 - fVar8; - return; - } - ExceptionList = &local_10; - (this->_lastVelocity).x = (this->_velocity).x; - (this->_lastVelocity).y = (this->_velocity).y; - moveX = g_vectorZero.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = g_vectorZero.x; - local_54 = g_vectorZero.y; - local_28 = g_vectorZero.y; - if ((this->_isControlsEnabled != 0) && (this->_controlsCooldown < 1)) { - vecResult = GetMovementJoystick(this,&VStack_1c); - moveX = vecResult->x; - local_54 = vecResult->y; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = moveX; - local_28 = local_54; - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x8000); - if ((bVar1 != 0) && (this->_canFly == 0)) { - local_54 = 0.0; - local_28 = 0.0; - } - fVar7 = sqrtf(moveX * moveX + local_54 * local_54); - if (1.0 < fVar7) { - (GHIDRA_CAST((GHIDRA_CAST((local_50 + 0x24)))))->Vector::Normalize(); - local_54 = local_28; - moveX = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_50)) + 0x24))); - } - } - iVar2 = this->_playerType; - if ((((iVar2 == 0x23) && (this->_isCoopGhost == 0)) || (this->_suplexState != 0)) || - (this->_darkArtsBlastPending != 0)) { - moveX = g_vectorZero.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = g_vectorZero.x; - local_54 = g_vectorZero.y; - local_28 = g_vectorZero.y; - } - if (((((iVar2 == 0x13) || (iVar2 == 0x14)) || ((iVar2 == 0x1d || (iVar2 == 0x26)))) && - (this->_twinPlayer != 0)) || (iVar2 == 0x1a)) { - tempEffects = GHIDRA_CAST(this->_twinPlayer); - if (((tempEffects == GHIDRA_CAST(0x0)) || (tempEffects->_playerIndex == -1)) || - (this->_playerIndex <= tempEffects->_playerIndex)) { - tempEffects = this; - } - vecResult = GetMovementJoystick(tempEffects,&VStack_1c); - if ((vecResult->x != g_vectorZero.x) || (vecResult->y != g_vectorZero.y)) { - this->_actionHoldDrop = 0; - } - } - tempEffects = &this->_temporaryeffects; - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x3f); - if (bVar1 == 0) { - this->_reverseChariotMoveCooldown = 0; - fVar7 = moveX; - fVar8 = local_54; - } - else { - fVar7 = sqrtf(moveX * moveX + local_54 * local_54); - if (fVar7 <= 0.25) { - iVar2 = this->_reverseChariotMoveCooldown + -1; - } - else if (this->_reverseChariotMoveCooldown < 1) { - vecResult = (GHIDRA_CAST((GHIDRA_CAST((local_50 + 0x24)))))->Vector::Normalized(&VStack_1c); - fVar7 = this->_speedMultiplier; - fVar8 = vecResult->y; - (this->_velocity).x = (vecResult->x + vecResult->x) * fVar7 + (this->_velocity).x; - (this->_velocity).y = (fVar8 + fVar8) * fVar7 + (this->_velocity).y; - iVar2 = 5; - } - else { - nextCooldown = this->_reverseChariotMoveCooldown + -1; - iVar2 = 1; - if (1 < nextCooldown) { - iVar2 = nextCooldown; - } - } - this->_reverseChariotMoveCooldown = iVar2; - fVar7 = g_vectorZero.x; - fVar8 = g_vectorZero.y; - } - fVar9 = 0.6; - if (0 < this->_ponyCharge) { - vecResult = Vector::ToCardinal(GHIDRA_CAST((local_50 + 0x24)),&this->_movementVector); - fVar7 = fVar7 + (vecResult->x - fVar7) * fVar9; - fVar8 = fVar8 + (vecResult->y - fVar8) * fVar9; - } - (this->_movementVector).x = fVar7; - (this->_movementVector).y = fVar8; - if ((fVar7 != g_vectorZero.x) || (fVar8 != g_vectorZero.y)) { - (this->_recentMovementVector).x = fVar7; - (this->_recentMovementVector).y = fVar8; - } - this->_moveDirection = -1; - fVar9 = this->_movespeed * 0.25 + 0.75; - fVar7 = fVar7 * fVar9; - fVar9 = fVar9 * fVar8; - local_68 = fVar9; - if (ABS(fVar7) <= ABS(fVar9)) { - if (0.0 <= fVar9) { - iVar2 = -1; - if (0.0 < fVar9) { - this->_moveDirection = 3; - iVar2 = 3; - } - } - else { - this->_moveDirection = 1; - iVar2 = 1; - } - } - else { - iVar2 = 0; - if (0.0 <= fVar7) { - iVar2 = 2; - } - this->_moveDirection = iVar2; - } - moveX = fVar7; - if (this->_suplexState == 1) { - iVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); - this->_moveDirection = iVar2; - } - if (iVar2 != -1) { - fVar7 = atan2f(fVar9,fVar7); - fVar7 = LerpAngleDeg(this->_bodyAngle,fVar7 * 57.295776,0.3); - this->_bodyAngle = fVar7; - fVar7 = moveX; - fVar9 = local_68; - } - local_60 = (this->_velocity).x; - local_58 = GHIDRA_CAST((this->_velocity).y); - local_54 = ((float)this->_slipperyTimer - 0.0) / 60.0; - if ((this->_playerType == 0x23) && (this->_isCoopGhost == 0)) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar1 == 0) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000000000); - fVar7 = local_60; - if (bVar1 == 0) { - local_64 = local_54 * 0.51 + 0.45; - } - else { - local_64 = 0.97; - } - } - else { - local_64 = 1.0; - fVar7 = local_60; - } - } - else { - fVar8 = *GHIDRA_CAST(&this->_flags); - uVar6 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if ((GHIDRA_UINT(fVar8) & 0x80) != 0) { - local_54 = 0.0; - } - if (((fVar7 != 0.0) || ((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = fVar8, fVar9 != 0.0)) && - (((GHIDRA_UINT(fVar8) & 0x8000) == 0 || ((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = fVar8, this->_canFly != 0)))) { - local_64 = (this->_velocity).x; - local_70.y = (float)local_58 * fVar9 + local_64 * fVar7; - local_60 = fVar7 * local_70.y; - local_70.y = local_70.y * fVar9; - fVar7 = sqrtf(local_54 * 0.19999999 + 0.8); - (this->_velocity).x = (local_64 - local_60) * fVar7 + local_60; - (this->_velocity).y = ((float)local_58 - local_70.y) * fVar7 + local_70.y; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = *GHIDRA_CAST(&this->_flags); - uVar6 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - fVar7 = moveX; - } - local_58 = GHIDRA_CAST((this->_velocity).y); - local_60 = (this->_velocity).x; - local_64 = 0.0; - local_70.y = (local_54 * 0.7 - 0.2) * (local_60 * fVar7 + (float)local_58 * local_68); - pfVar3 = &local_70.y; - if (local_70.y <= 0.0) { - pfVar3 = &local_64; - } - local_70.y = (*pfVar3 / this->_movespeed + 3.0) * 0.4; - if ((uVar6 & 0x4000000) == 0) { - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x3f); - if (((bVar1 == 0) && (this->_suplexState < 2)) && - ((this->_playerType != 0x23 || (this->_isCoopGhost != 0)))) { - fVar7 = local_54 * 0.185 + 0.775; - } - else { - fVar7 = local_54 * 0.51 + 0.45; - } - } - else { - fVar7 = 1.0; - } - local_64 = sqrtf(fVar7); - fVar9 = this->_movespeed * 4.41; - fVar8 = (local_70.y * 0.25 - local_70.y) * local_54 + local_70.y; - fVar7 = moveX * 0.5 * fVar8 + local_60; - local_28 = local_68 * 0.5 * fVar8 + (this->_velocity).y; - (this->_velocity).y = local_28; - isSlippery = 0.0 < local_54; - local_54 = fVar7; - if ((isSlippery) && - (local_70.y = fVar7 * fVar7 + local_28 * local_28, fVar9 * fVar9 < local_70.y)) { - VStack_1c.y = sqrtf(local_60 * local_60 + (float)local_58 * (float)local_58); - fVar8 = sqrtf(local_70.y); - fVar7 = local_54; - if (0.0 < fVar8) { - fVar7 = local_54 * (VStack_1c.y / fVar8); - (this->_velocity).x = fVar7; - (this->_velocity).y = (VStack_1c.y / fVar8) * local_28; - } - } - } - flags = this->_flags; - local_28 = fVar7 * local_64; - (this->_velocity).x = local_28; - if (((flags & 0x8000) == 0) || (this->_canFly != 0)) { - (this->_velocity).y = local_64 * (this->_velocity).y; - } - else { - (this->_velocity).y = (this->_velocity).y + 0.225; - } - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x32); - if (bVar1 != 0) { - bVar1 = this->_collidesWithGrid; - (this->_velocity).x = local_60 * 0.05 + local_28; - (this->_velocity).y = (float)local_58 * 0.05 + (this->_velocity).y; - if (bVar1 != 0) { - fVar7 = (this->_gridCollisionNormal).y; - fVar8 = (this->_gridCollisionNormal).x; - fVar9 = (this->_gridCollisionVelocity).y; - gridVelocityX = (this->_gridCollisionVelocity).x; - normalDot = fVar8 * gridVelocityX + fVar7 * fVar9; - fVar8 = fVar8 * normalDot * 0.8; - fVar7 = fVar7 * normalDot * 0.8; - (this->_velocity).x = gridVelocityX - (fVar8 + fVar8); - (this->_velocity).y = fVar9 - (fVar7 + fVar7); - } - } - if ((this->_flags & 0x4000) != 0) goto LAB_0077ae15; - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x5d); - if (bVar1 != 0) { - switch(this->_moveDirection) { - case 0: - case 1: - bVar1 = 0x4c; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = 1.12104e-44; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) = 1.6631262e+22; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x18))) = 7.301531e+31; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x1c))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x1c))) & 0xffffff00; - local_8 = 1; - break; - default: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = 1.26117e-44; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) = 1.6631262e+22; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x18))) = 4.371238e+24; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x1c))) = 0x74; - local_8 = 0; - bVar1 = extraout_CL; - } - local_28 = 2.10195e-44; - PlayCollectibleAnim(this,0x5d,0,local_50 + 0x14,-1,bVar1); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_28)) { - uVar6 = GHIDRA_INT(local_28) + 1; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_50)) + 0x14))); - if (0xfff < uVar6) { - pvVar5 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + -4); - uVar6 = GHIDRA_INT(local_28) + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_0077a500; - } - operator_delete(pvVar5,uVar6); - } - } - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x4d); - if (bVar1 == 0) { - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x12a); - if (bVar1 == 0) { - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(299); - if ((bVar1 == 0) || - (pvVar5 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(299), - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 8)) < 1)) { - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x3a); - if (bVar1 != 0) { - switch(this->_moveDirection) { - case 0: - local_58 = GHIDRA_CAST(0xb1da88); - break; - case 1: - local_58 = GHIDRA_CAST(&DAT_00b1e020); - break; - case 2: - local_58 = GHIDRA_CAST(0xb1dac0); - break; - default: - local_58 = GHIDRA_CAST(0xb1e044); - } - pvVar5 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(0x3a); - blinkAnimName = GHIDRA_CAST("Blink"); - if (0x59 < *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 8))) { - blinkAnimName = local_58; - } - (GHIDRA_CAST((local_50 + 0x14)))->msvc::string::string_from_cstr(blinkAnimName); - local_8 = 5; - PlayCollectibleAnim(this,0x3a,1,local_50 + 0x14,-1,isUnused_02); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_28)) { - uVar6 = GHIDRA_INT(local_28) + 1; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_50)) + 0x14))); - if (0xfff < uVar6) { - pvVar5 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + -4); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pvVar5)); - goto joined_r0x0077a7e1; - } - goto LAB_0077a7e7; - } - } - } - else { - switch(this->_moveDirection) { - case 0: - headAnimName = "HeadLeft"; - break; - case 1: - headAnimName = "HeadUp"; - break; - case 2: - headAnimName = "HeadRight"; - break; - default: - headAnimName = "HeadDown"; - } - (GHIDRA_CAST((local_50 + 0x14)))->msvc::string::string_from_cstr(GHIDRA_CAST(headAnimName)); - local_8 = 4; - PlayCollectibleAnim(this,299,0,local_50 + 0x14,0,isUnused_01); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_28)) { - uVar6 = GHIDRA_INT(local_28) + 1; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_50)) + 0x14))); - if (0xfff < uVar6) { - pvVar5 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + -4); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pvVar5)); - goto joined_r0x0077a7e1; - } - goto LAB_0077a7e7; - } - } - } - else { - switch(this->_moveDirection) { - case 0: - headAnimName = "HeadLeft"; - break; - case 1: - headAnimName = "HeadUp"; - break; - case 2: - headAnimName = "HeadRight"; - break; - default: - headAnimName = "HeadDown"; - } - (GHIDRA_CAST((local_50 + 0x14)))->msvc::string::string_from_cstr(GHIDRA_CAST(headAnimName)); - local_8 = 3; - PlayCollectibleAnim(this,0x12a,0,local_50 + 0x14,-1,isUnused_00); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_28)) { - uVar6 = GHIDRA_INT(local_28) + 1; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_50)) + 0x14))); - if (0xfff < uVar6) { - pvVar5 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + -4); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pvVar5)); - goto joined_r0x0077a7e1; - } - goto LAB_0077a7e7; - } - } - } - else { - switch(this->_moveDirection) { - case 0: - headAnimName = "HeadLeft"; - break; - case 1: - headAnimName = "HeadUp"; - break; - case 2: - headAnimName = "HeadRight"; - break; - default: - headAnimName = "HeadDown"; - } - (GHIDRA_CAST((local_50 + 0x14)))->msvc::string::string_from_cstr(GHIDRA_CAST(headAnimName)); - local_8 = 2; - PlayCollectibleAnim(this,0x4d,0,local_50 + 0x14,-1,isUnused); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_28)) { - uVar6 = GHIDRA_INT(local_28) + 1; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_50)) + 0x14))); - if (0xfff < uVar6) { - pvVar5 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + -4); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pvVar5)); -joined_r0x0077a7e1: - uVar6 = GHIDRA_INT(local_28) + 0x24; - if (0x1f < uVar4) goto LAB_0077a500; - } -LAB_0077a7e7: - local_8 = 0xffffffff; - operator_delete(pvVar5,uVar6); - } - } - bVar1 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x139); - if (bVar1 != 0) { - local_28 = 2.10195e-44; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = 9.80909e-45; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) = 4.514758e+27; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x18))) = 1.0505631e-38; - local_8 = 6; - PlayCollectibleAnim(this,0x139,1,local_50 + 0x14,-1,isUnused_03); - local_8 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_28)) { - uVar6 = GHIDRA_INT(local_28) + 1; - pvVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_50)) + 0x14))); - if (0xfff < uVar6) { - pvVar5 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + -4); - uVar6 = GHIDRA_INT(local_28) + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pvVar5))))) { -LAB_0077a500: - local_8 = 0xffffffff; - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar5,uVar6); - } - } - bVar1 = HasCollectible(this,0x252,0); - if (bVar1 == 0) { - this->_jupiterCharge = 0.0; - } - else { - local_54 = this->_jupiterCharge; - if ((moveX == g_vectorZero.x) && (local_68 == g_vectorZero.y)) { - fVar7 = (this->_velocity).y; - fVar8 = (this->_velocity).x; - if (fVar8 * fVar8 + fVar7 * fVar7 < 1.0) { - fVar7 = this->_speedMultiplier / 60.0 + local_54; - if (1.0 <= fVar7) { - fVar7 = 1.0; - } - this->_jupiterCharge = fVar7; - } - } - else { - local_28 = local_54 - this->_speedMultiplier / 60.0; - if (local_28 <= 0.0) { - local_28 = 0.0; - } - this->_jupiterCharge = local_28; - if (0.0 < local_28) { - local_60 = 2.0; - iVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0); - if (iVar2 != 0) { - if (0.3 < local_28) { - uVar6 = Random(); - play_sound_with_fart_seed(0x25,this->_jupiterCharge,(uVar6 & 7) + 5,0,1.0); - } - fVar7 = (this->_recentMovementVector).y; - fVar8 = (this->_recentMovementVector).x; - if (fVar8 * fVar8 + fVar7 * fVar7 <= 0.01) { - iVar2 = this->_moveDirection; - if (iVar2 == -1) { - iVar2 = 3; - } - vecResult = Isaac::GetAxisAlignedUnitVectorFromDir(&VStack_1c,iVar2); - } - else { - vecResult = (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::Normalized(GHIDRA_CAST((local_50 + 0x24))) - ; - } - local_68 = -vecResult->x; - local_58 = GHIDRA_CAST((GHIDRA_UINT(vecResult->y) ^ 0x80000000)); - uVar6 = Random(); - uVar4 = Random(); - local_28 = ((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 40.0 - 20.0) * 0.017453292; - VStack_1c.y = cos(local_28); - local_28 = sin(local_28); - uVar4 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 20.0 + 6.0; - local_70.x = local_68 * 4.0 + (this->_pos).x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = (VStack_1c.y * local_68 - local_28 * (float)local_58) * fVar7; - local_28 = (local_28 * local_68 + VStack_1c.y * (float)local_58) * fVar7; - local_70.y = (float)local_58 * 4.0 + (this->_pos).y; - spawnedEffect = - Game::Spawn(g_game,1000,99,&local_70,GHIDRA_CAST((local_50 + 0x24)),GHIDRA_CAST(0x0),1, - uVar6); - uVar6 = Random(); - fVar8 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 1.5 + 1.0; - fVar7 = (spawnedEffect->_sprite)._scale.x; - (spawnedEffect->_sprite)._scale.y = fVar8 * (spawnedEffect->_sprite)._scale.y; - (spawnedEffect->_sprite)._scale.x = fVar8 * fVar7; - (GHIDRA_CAST((GHIDRA_CAST(local_50))))->Color::Color(0.3,0.42,0.25,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&spawnedEffect->_sprite))))->Sprite::SetColor(color); - spawnedEffect->Update(); - uVar6 = Random(); - local_28 = ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 40.0 - 20.0) * 0.017453292; - VStack_1c.y = cos(local_28); - local_28 = sin(local_28); - uVar6 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 10.0 + 10.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = (VStack_1c.y * local_68 - local_28 * (float)local_58) * fVar7; - local_28 = (local_28 * local_68 + VStack_1c.y * (float)local_58) * fVar7; - uVar6 = Random(); - uVar4 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0; - VStack_1c.y = fVar7 * (float)local_58 + (this->_pos).y; - VStack_1c.x = fVar7 * local_68 + (this->_pos).x; - spawnedEffect = - Game::Spawn(g_game,1000,0x8d,&VStack_1c,GHIDRA_CAST((local_50 + 0x24)),GHIDRA_CAST(this),0, - uVar6); - uVar6 = Random(); - iVar2 = uVar6 % 0x1e + 0x3c; - *GHIDRA_CAST((spawnedEffect[1]._sprite._filename._buf + 4)) = iVar2; - *GHIDRA_CAST((spawnedEffect[1]._sprite._filename._buf + 8)) = iVar2; - bVar1 = HasTrinket(this,0x86,0); - if (bVar1 == 0) { - local_60 = 1.0; - } - uVar6 = Random(); - fVar8 = ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 0.4 + 0.6) * local_60; - fVar7 = fVar8 * g_vectorOne.x; - (spawnedEffect->_sprite)._scale.y = fVar8 * g_vectorOne.y; - (spawnedEffect->_sprite)._scale.x = fVar7; - spawnedEffect->SetCollisionDamage(this->_meleeDamage * 0.5); - spawnedEffect->Update(); - } - } - } - if (this->_jupiterCharge != local_54) { - this->_cacheFlags = this->_cacheFlags | 0x10; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - } -LAB_0077ae15: - bVar1 = HasCollectible(this,0x251,0); - if ((bVar1 != 0) && (this->_isControlsEnabled != 0)) { - iVar2 = 0; - moveActions[0] = 0; - moveActions[1] = 1; - VStack_1c.x = 2.8026e-45; - VStack_1c.y = 4.2039e-45; - do { - bVar1 = input_is_action_triggered - (g_manager,moveActions[iVar2],this->_controllerIndex,GHIDRA_CAST(this),0); - if (bVar1 != 0) { - if ((((this->_marsLastTapDirection == iVar2) && (this->_marsTapFrames < 0xb)) && - (bVar1 = HasCollectible(this,0x251,0), bVar1 != 0)) && (this->_marsCooldown < 1)) { - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x944 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & - 0xfffffffcU))) && (fVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x944)), fVar7 != 0.0) - ) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x24))) = *GHIDRA_CAST((GHIDRA_CAST(fVar7) + 0x78)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x20))) = 0.0; - local_28 = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x1c))) = fVar7; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(local_50 + 0x1c,0,1); - } - this->_marsUnk2 = this->_marsLastTapDirection; - this->_marsCooldown = this->_marsUnk1; - this->_marsUnkBool = 0; - } - this->_marsLastTapDirection = iVar2; - this->_marsTapFrames = 0; - } - iVar2 = iVar2 + 1; - } while (iVar2 < 4); - } - iVar2 = this->_marsTapFrames + 1; - if (10000 < iVar2) { - iVar2 = 10000; - } - this->_marsTapFrames = iVar2; - bVar1 = HasTrinket(this,0x6d,0); - if ((bVar1 == 0) || (iVar2 = GetTrinketMultiplier(this,0x6d), iVar2 < 2)) { - this->_ductTapeMode = 0; - } - else if ((this->_isControlsEnabled != 0) && - (bVar1 = input_is_action_triggered(g_manager,0xb,this->_controllerIndex,GHIDRA_CAST(this),0), - bVar1 != 0)) { - uVar6 = this->_ductTapeMode + 1U & 0x80000003; - if (GHIDRA_INT(uVar6) < 0) { - uVar6 = (uVar6 - 1 | 0xfffffffc) + 1; - } - this->_ductTapeMode = uVar6; - if (uVar6 == 0) { - this->_ductTapeMode = 1; - } - } - ExceptionList = local_10; - return; -} - -// 0077b020 -void Entity_Player::update_shooting() -{ - TemporaryEffects *this_00; - int64_t lVar1; - int64_t lVar2; - Vector direction; - Vector velocity; - Vector position; - Vector position_00; - ANM2 *pAVar3; - uint8_t bVar4; - char cVar5; - uint16_t uVar6; - uint16_t extraout_var; - Vector *pVVar7; - void *pvVar8; - uint32_t uVar9; - Entity *tmpEntity; - BitSet128 *pBVar10; - float *pfVar11; - uint32_t extraout_EAX; - uint32_t *clampedCharge; - RNG *rng; - Vector *pVVar12; - char *pcVar13; - ItemConfig *itemConfig; - ItemConfig_Item *nullItem; - Vector *posOffset; - Entity_Laser *laser; - Weapon *weapon; - int *piVar14; - Entity_Effect *effect; - ColorMod *entityColor; - Room *room; - EntityList *pEVar15; - Entity_Familiar *this_01; - Entity_Player *tmpPlayer; - std_string *animString; - Vector *other; - Entity_Tear *tear; - Vector *posOffset_00; - Entity_Effect *pEVar16; - Vector *other_00; - Vector *other_01; - EntityConfig *this_02; - EntityConfig_Entity *entityConfigEntry; - Entity_Knife *knife; - void *otherTwin; - Vector *other_02; - Vector *other_03; - Vector *vector; - Vector *vector_00; - Vector *this_03; - Vector *vec; - ColorMod *color; - Sprite *this_04; - LayerState *costumeLayer; - void **ppvVar17; - int iVar18; - int iVar19; - Game *game; - uint32_t uVar20; - uint8_t *puVar21; - bool bVar22; - long double fVar23; - float fVar24; - float fVar25; - float fVar26; - float fVar27; - uint64_t uVar28; - uint32_t uVar29; - TypeDescriptor *pTVar30; - TypeDescriptor *pTVar31; - BitSet128 *pBVar32; - uint32_t uVar33; - BitSet128 *pBVar34; - Vector inheritedVelocity; - Vector cardinalDirection; - Entity_Effect *cleanupFlags; - Vector local_308; - Vector local_300; - void **local_2f8; - Vector local_2f4; - Vector local_2ec; - Vector local_2e4; - uint32_t local_2dc; - Vector local_2d8; - Vector local_2d0; - uint8_t isOpposingDirections; - uint8_t isDirectionHeld; - Vector local_2c4; - Vector local_2bc; - Entity_Effect *local_2b4; - Vector local_2b0; - Entity_Effect *local_2a8; - Vector shootDirection; - Vector local_29c; - Entity_Player *local_294; - Vector local_290; - char isInputAllowed; - uint8_t local_286; - char local_285; - Entity_Effect *local_284; - uint8_t isShooting; - TearParams bagTearParams; - TearParams knifeTearParams; - Color particleColor; - TearParams hitParams; - char overlayAnimName [24]; - char hemoptysisHeadLeft [24]; - char hemoptysisHeadUp [24]; - char hemoptysisHeadRight [24]; - char mawHeadDown [8]; - BitSet128 local_b0; - char local_a0 [24]; - char mawHeadRight [8]; - BitSet128 local_80; - uint8_t local_70 [52]; - uint8_t local_3c [4]; - float fStack_38; - Vector VStack_34; - char mawHeadLeft [4]; - int enemyType; - uint8_t auStack_24 [8]; - float fStack_1c; - int iStack_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint64_t buttBombFlagsHi; - uint64_t buttBombFlagsLo; - Manager *manager; - code *virtualFn; - - local_8 = 0xffffffff; - puStack_c = &LAB_00aff3d7; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((auStack_24 + 0x20)); - ExceptionList = &local_10; - local_29c.y = 0.0; - cleanupFlags = GHIDRA_CAST(0x0); - shootDirection.x = g_vectorZero.x; - shootDirection.y = g_vectorZero.y; - isShooting = 0; - isOpposingDirections = 0; - if (((this->_isControlsEnabled == 0) || (0 < this->_controlsCooldown)) || - (isInputAllowed = '\x01', (this->_flags & 0x800) != 0)) { - isInputAllowed = '\0'; - } - local_294 = this; - if ((this->_target != 0) && (*GHIDRA_CAST((this->_target + 0x173)) != '\0')) { - this->_entityCollisionClass = 4; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - } - lVar2 = CONCAT44(local_2c4.y,local_290.y); - if ((this->_playerType == 0x28) && (this->_itemState == 0)) { - isInputAllowed = '\0'; - lVar2 = CONCAT44(local_2c4.y,local_290.y); - } - else if (isInputAllowed != '\0') { - if ((((this->_isPlayingExtraAnimation == 0) && (this->_isPlayingItemAnimation == 0)) || - (bVar4 = ANM2::IsFinishedImpl(&this->_bodySprite,GHIDRA_CAST("LiftItem")), bVar4 != 0)) && - ((((this->_entityCollisionClass != 0 || (this->_suplexState == 2)) || - ((this->_isCoopGhost != 0 || - (((this->_flags & 0x200000000000000) != 0 || - (bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x11a), - bVar4 != 0)))))) || (bVar4 = IsHologram(this), bVar4 != 0)))) { - local_286 = '\0'; - local_285 = '\0'; - bVar4 = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4a); - if ((bVar4 == 0) && (bVar4 = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4b), bVar4 == 0)) { - bVar4 = input_is_action_pressed(4,this->_controllerIndex,GHIDRA_CAST(this),0); - if (bVar4 != 0) { - isShooting = 1; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x1))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = isShooting; - bVar4 = input_is_action_pressed(5,this->_controllerIndex,GHIDRA_CAST(this),0); - if (bVar4 != 0) { - local_285 = '\x01'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = 1; - } - bVar4 = input_is_action_pressed(6,this->_controllerIndex,GHIDRA_CAST(this),0); - if (bVar4 != 0) { - local_286 = '\x01'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = 1; - } - iVar19 = this->_controllerIndex; - iVar18 = 7; - } - else { - bVar4 = input_is_action_pressed(0,this->_controllerIndex,GHIDRA_CAST(this),0); - uVar6 = CONCAT11(isShooting,bVar4); - if (bVar4 != 0) { - isShooting = 1; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x1))) = (undefined3)(CONCAT22(extraout_var,uVar6) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = isShooting; - bVar4 = input_is_action_pressed(1,this->_controllerIndex,GHIDRA_CAST(this),0); - if (bVar4 != 0) { - local_285 = '\x01'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = 1; - } - bVar4 = input_is_action_pressed(2,this->_controllerIndex,GHIDRA_CAST(this),0); - if (bVar4 != 0) { - local_286 = '\x01'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = 1; - } - iVar19 = this->_controllerIndex; - iVar18 = 3; - } - bVar4 = input_is_action_pressed(iVar18,iVar19,GHIDRA_CAST(this),0); - if (((bVar4 != 0) && ((*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = 1, local_286 != '\0')) || - ((isShooting != 0 && (local_285 != '\0')))) { - isOpposingDirections = 1; - } - bVar4 = GetMouseAimTarget(this,&shootDirection,0); - if ((bVar4 == 0) && ((uint8_t)local_284 == 0)) { - isShooting = 0; -LAB_0077b373: - pVVar7 = GetShootingJoystick(this,&local_29c); - shootDirection.x = shootDirection.x + pVVar7->x; - shootDirection.y = shootDirection.y + pVVar7->y; - } - else { - isShooting = 1; - if (bVar4 == 0) goto LAB_0077b373; - } - lVar2 = CONCAT44(local_2c4.y,local_290.y); - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && ((this->_flags & 0x200) != 0)) { - shootDirection.x = shootDirection.x * -1.0; - shootDirection.y = shootDirection.y * -1.0; - } - if (0.001 < shootDirection.y * shootDirection.y + shootDirection.x * shootDirection.x) { - uVar28 = GetTimeNs(); - local_2bc.y = (float)(uVar28 >> 0x20); - lVar1 = (uVar28 & 0xffffffff) * 0x431bde82; - local_2a8 = GHIDRA_CAST(((uint64_t)lVar1 >> 0x20)); - local_2f8 = (void **)((uint64_t)GHIDRA_UINT(local_2bc.y) * 0xd7b634db >> 0x20); - lVar2 = (uint64_t)GHIDRA_UINT(local_2bc.y) * 0x431bde82; - uVar28 = (uint64_t)GHIDRA_UINT(local_2bc.y) * 0xd7b634db + - ((uVar28 & 0xffffffff) * 0xd7b634db >> 0x20); - uVar20 = GHIDRA_UINT((uVar28 >> 0x20)); - lVar1 = lVar1 + (uVar28 & 0xffffffff); - local_29c.x = (float)lVar1; - uVar9 = GHIDRA_UINT(((uint64_t)lVar1 >> 0x20)); - lVar1 = lVar2 + (uint64_t)CONCAT14(CARRY4(uVar20,uVar9),uVar20 + uVar9); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_294)) + 0x1f90)))) = - GHIDRA_UINT(lVar1) >> 0x12 | GHIDRA_INT(((uint64_t)lVar1 >> 0x20)) * 0x4000; - this = local_294; - } - local_2c4.y = (float)((uint64_t)lVar2 >> 0x20); - local_290.y = (float)lVar2; - piVar14 = this->_weapons[0]; - if ((piVar14 == GHIDRA_CAST(0x0)) && (piVar14 = this->_weapons[1], piVar14 == GHIDRA_CAST(0x0))) - goto LAB_0077b57e; - fVar23 = (long double)(**(code **)(*piVar14 + 0x18))(); - local_2f8 = (void **)(float)fVar23; - if ((0.0 < (float)local_2f8) && ((0.0 < (float)piVar14[5] && (isOpposingDirections == 0)))) { - fVar24 = sqrtf(shootDirection.y * shootDirection.y + shootDirection.x * shootDirection.x); - lVar2 = CONCAT44(local_2c4.y,local_290.y); - if (fVar24 < 0.5) { - shootDirection.x = g_vectorZero.x; - shootDirection.y = g_vectorZero.y; - isShooting = 0; - goto LAB_0077b57e; - } - } - } - lVar2 = CONCAT44(local_2c4.y,local_290.y); - } -LAB_0077b57e: - local_2c4.y = (float)((uint64_t)lVar2 >> 0x20); - local_290.y = (float)lVar2; - if ((this->_variant == 1) && (this->_babySkin == 7)) { - if (shootDirection.x < 0.0) { - fVar26 = -shootDirection.x * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1af8)))); - fVar24 = -shootDirection.x * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1afc)))); - } - else { - fVar26 = shootDirection.x * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1af0)))); - fVar24 = shootDirection.x * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1af4)))); - } - if (shootDirection.y < 0.0) { - fVar27 = -shootDirection.y * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b08)))); - fVar25 = -shootDirection.y * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b0c)))); - } - else { - fVar27 = shootDirection.y * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b00)))); - fVar25 = shootDirection.y * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b04)))); - } - shootDirection.x = fVar26 + 0.0 + fVar27; - shootDirection.y = fVar24 + 0.0 + fVar25; - } - local_2ec.y = shootDirection.y; - local_284 = GHIDRA_CAST(shootDirection.x); - local_286 = 0; - if (0 < this->_peeBurstCooldown) { - if (this->_peeBurstCooldown < this->_maxPeeBurstCooldown + -5) { - isShooting = 1; - local_286 = 1; - if ((shootDirection.x == g_vectorZero.x) && (shootDirection.y == g_vectorZero.y)) { - shootDirection.x = (this->_lastDirection).x; - shootDirection.y = (this->_lastDirection).y; - } - if ((shootDirection.x == g_vectorZero.x) && (shootDirection.y == g_vectorZero.y)) { - pVVar7 = Isaac::GetAxisAlignedUnitVectorFromDir(&local_29c,this->_headDirection); - lVar2 = CONCAT44(local_2c4.y,local_290.y); - shootDirection.x = pVVar7->x; - shootDirection.y = pVVar7->y; - } - } - local_2c4.y = (float)((uint64_t)lVar2 >> 0x20); - local_290.y = (float)lVar2; - if ((this->_flags & 0x4000) == 0) { - this->_peeBurstCooldown = this->_peeBurstCooldown + -1; - this->_cacheFlags = this->_cacheFlags | 2; - EvaluateItems(this); - lVar2 = CONCAT44(local_2c4.y,local_290.y); - } - this->_blinkTime = 8; - } - local_2c4.y = (float)((uint64_t)lVar2 >> 0x20); - local_290.y = (float)lVar2; - if ((((this->_isPlayingExtraAnimation != 0) || (this->_isPlayingItemAnimation != 0)) && - (this->_heldEntity != (void *)0x0)) && - ((this->_itemState != 0x25c && (this->_itemState != 0x2c5)))) { - local_29c.x = (this->_velocity).x * 0.1; - local_29c.y = (this->_velocity).y * 0.1; - ThrowHeldEntity(this,&local_29c); - lVar2 = CONCAT44(local_2c4.y,local_290.y); - } - local_2c4.y = (float)((uint64_t)lVar2 >> 0x20); - local_290.y = (float)lVar2; - this_00 = &this->_temporaryeffects; - local_2e4.y = (float)this_00; - bVar4 = (GHIDRA_CAST((this_00)))->TemporaryEffects::HasCollectibleEffect(0x5d); - if (((bVar4 != 0) || (bVar4 = (GHIDRA_CAST((this_00)))->TemporaryEffects::HasCollectibleEffect(0x4d), bVar4 != 0)) - || ((bVar4 = (GHIDRA_CAST((this_00)))->TemporaryEffects::HasCollectibleEffect(0x12a), bVar4 != 0 || - (((bVar4 = (GHIDRA_CAST((this_00)))->TemporaryEffects::HasCollectibleEffect(299), bVar4 != 0 && - (pvVar8 = (GHIDRA_CAST((this_00)))->TemporaryEffects::GetCollectibleEffect(299), - *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 8)) != 0)) || (0 < this->_fireBlockCooldown)))))) { - shootDirection.x = g_vectorZero.x; - shootDirection.y = g_vectorZero.y; - isShooting = 0; - local_286 = 0; - } - iVar19 = this->_itemStateCooldown; - if (iVar19 < 1) { -LAB_0077b892: - if (iVar19 != 0) goto LAB_0077b894; - } - else { - if ((this->_flags & 0x4000) == 0) { - iVar19 = iVar19 + -1; - this->_itemStateCooldown = iVar19; - if (iVar19 < 1) { - cVar5 = FUN_00730910(); - if (cVar5 != '\0') { - (GHIDRA_CAST((this_00)))->TemporaryEffects::RemoveCollectibleEffect(this->_itemState,1); - TryRemoveCollectibleCostume(this,this->_itemState,0); - } - ResetItemState(this); - iVar19 = this->_itemStateCooldown; - goto LAB_0077b892; - } - } -LAB_0077b894: - shootDirection.x = g_vectorZero.x; - shootDirection.y = g_vectorZero.y; - } - local_2dc = 0; - if (iVar19 == 0) { - local_2dc = GHIDRA_UINT(local_286); - } - local_2bc.y = (float)GHIDRA_CAST(0x0); - if (iVar19 == 0) { - local_2bc.y = (float)GHIDRA_UINT(isShooting); - } - if ((shootDirection.x == 0.0) && (shootDirection.y == 0.0)) { - isDirectionHeld = 0; - if (SUB41(local_2bc.y,0) != '\0') { - shootDirection.x = (float)(GHIDRA_UINT((this->_lastDirection).x) ^ 0x80000000); - shootDirection.y = (float)(GHIDRA_UINT((this->_lastDirection).y) ^ 0x80000000); - } - } - else { - isDirectionHeld = 1; - } - if ((shootDirection.x != 0.0) || (local_286 = '\0', shootDirection.y != 0.0)) { - local_286 = '\x01'; - } - if ((this->_isCoopGhost == 0) && (this->_canShoot == 0)) { - isShooting = 0; - } - else { - isShooting = 1; - } - effect = GHIDRA_CAST(this->_suplexState); - local_2f8 = this->_weapons + 1; - local_2d0.y = 0.0; - local_308.x = shootDirection.x; - local_308.y = shootDirection.y; - local_2b4 = effect; - if (*local_2f8 != GHIDRA_CAST(0x0)) { - local_2d0.y = (float)(**(code **)(*GHIDRA_CAST(*local_2f8) + 0x30))(); - } - piVar14 = this->_markedTarget; - if (effect == GHIDRA_CAST(0x2)) { - local_2d0.y = 4.2039e-44; -LAB_0077b9dc: - if (((piVar14 != GHIDRA_CAST(0x0)) && - (bVar4 = input_is_action_triggered(g_manager,0xb,this->_controllerIndex,GHIDRA_CAST(this),0), - bVar4 != 0)) && (local_2b4 != GHIDRA_CAST(0x2))) { - ppvVar17 = &this->_markedTarget; - (**(code **)(*GHIDRA_CAST(this->_markedTarget) + 0x28))(); - if (*ppvVar17 != (void *)0x0) { - local_2a8 = GHIDRA_CAST(ppvVar17); - msvc::multiset::erase(&local_2a8); - } - *ppvVar17 = (void *)0x0; - } - if ((this->_flags & 0x4000) == 0) { - piVar14 = this->_markedTarget; - ppvVar17 = &this->_markedTarget; - if (piVar14 != GHIDRA_CAST(0x0)) { - if (GHIDRA_CAST(piVar14[0xb]) == GHIDRA_CAST(local_2d0.y)) goto LAB_0077bba3; - (**(code **)(*piVar14 + 0x28))(); - if (*ppvVar17 != (void *)0x0) { - local_2a8 = GHIDRA_CAST(ppvVar17); - msvc::multiset::erase(&local_2a8); - } - *ppvVar17 = (void *)0x0; - } - if ((((float)local_284 != g_vectorZero.x) || (local_2ec.y != g_vectorZero.y)) || - (local_2b4 == GHIDRA_CAST(0x2))) { - uVar9 = Random(); - local_29c.x = (float)local_284 * 5.0 + (this->_pos).x; - local_29c.y = local_2ec.y * 5.0 + (this->_pos).y; - local_2d0.y = (float)Game::Spawn(g_game,1000,GHIDRA_UINT(local_2d0.y),&local_29c,&g_vectorZero, - GHIDRA_CAST(this),0,uVar9); - if ((GHIDRA_CAST(local_2d0.y) == GHIDRA_CAST(0x0)) || ((GHIDRA_CAST(local_2d0.y))->_type != 1000)) { - local_2d0.y = 0.0; - } - pAVar3 = &(GHIDRA_CAST((GHIDRA_INT(local_2d0.y) + 0x410)))->_sprite; - (pAVar3->_filename)._buf[4] = '\0'; - (pAVar3->_filename)._buf[5] = '\0'; - (pAVar3->_filename)._buf[6] = '\0'; - (pAVar3->_filename)._buf[7] = '\0'; - pAVar3 = &(GHIDRA_CAST((GHIDRA_INT(local_2d0.y) + 0x410)))->_sprite; - (pAVar3->_filename)._buf[8] = '\0'; - (pAVar3->_filename)._buf[9] = '\0'; - (pAVar3->_filename)._buf[10] = '\0'; - (pAVar3->_filename)._buf[0xb] = '\0'; - if (*ppvVar17 != (void *)0x0) { - local_2a8 = GHIDRA_CAST(ppvVar17); - msvc::multiset::erase(&local_2a8); - } - *ppvVar17 = (void *)local_2d0.y; - msvc::multiset::insert(ppvVar17); - } - } -LAB_0077bba3: - effect = local_2b4; - bVar4 = SUB41(local_2bc.y,0); - pvVar8 = this->_markedTarget; - local_285 = (char)local_2dc; - if ((pvVar8 != (void *)0x0) && ((this->_itemState == 0 || (local_2b4 == GHIDRA_CAST(0x2))))) - { - if (bVar4 != 0) { - local_29c.x = (float)local_284; - local_29c.y = local_2ec.y; - if (1.0 < local_2ec.y * local_2ec.y + (float)local_284 * (float)local_284) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = bVar4; - (GHIDRA_CAST((&local_29c)))->Vector::Normalize(); - pvVar8 = this->_markedTarget; - bVar4 = (uint8_t)local_284; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = bVar4; - *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x360)) = local_29c.x * 8.0 + *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x360)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x364)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x364)) + local_29c.y * 8.0; - bVar4 = (uint8_t)local_284; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = bVar4; - if (effect == GHIDRA_CAST(0x2)) { - local_290.y = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_markedTarget) + 0x340)); - local_2a8 = GHIDRA_CAST(((this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(this->_markedTarget) + 0x33c)))) - ; - fVar24 = sqrtf(local_290.y * local_290.y + (float)local_2a8 * (float)local_2a8); - if (60.0 < fVar24) { - pvVar8 = this->_markedTarget; - *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x360)) = - *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x360)) + ((float)local_2a8 / fVar24) * (fVar24 - 60.0) * 0.1 - ; - *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x364)) = - (fVar24 - 60.0) * (local_290.y / fVar24) * 0.1 + *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x364)); - } - } - bVar4 = HasCollectible(this,0xd2,0); - if (bVar4 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_2bc.y)) + 0x0))); - local_285 = (char)local_2dc; - bVar4 = (uint8_t)local_284; - if (this->_mass == 1000.0) goto LAB_0077be15; - } - local_285 = '\x01'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = 1; - goto LAB_0077be0f; - } - } - else { - if (GHIDRA_CAST(local_2d0.y) != GHIDRA_CAST(0x0)) goto LAB_0077b9dc; - bVar4 = SUB41(local_2bc.y,0); - local_285 = (char)local_2dc; - if (piVar14 == GHIDRA_CAST(0x0)) goto LAB_0077be15; - if ((this->_flags & 0x4000) != 0) { - goto LAB_0077be15; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = bVar4; - (**(code **)(*piVar14 + 0x28))(); - if (this->_markedTarget != (void *)0x0) { - local_2a8 = GHIDRA_CAST(&this->_markedTarget); - msvc::multiset::erase(&local_2a8); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_2bc.y)) + 0x0))); - local_285 = (char)local_2dc; - this->_markedTarget = (void *)0x0; -LAB_0077be0f: - bVar4 = (uint8_t)local_284; - } -LAB_0077be15: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_284)) + 0x0))) = bVar4; - bVar4 = HasCollectible(this,0x17a,0); - game = g_game; - if ((((bVar4 != 0) && (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) && (isInputAllowed != '\0')) && - (this->_fireBlockCooldown < 1)) { - if ((uint8_t)local_284 == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18b8)))) = 0; - } - else { - iVar19 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18b8)))) + 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18b8)))) = iVar19; - if (iVar19 == 0x96) { - GetBombFlags(this,GHIDRA_CAST(local_3c),0); - uVar9 = Random(); - local_29c.x = (this->_velocity).x * 0.1; - local_29c.y = (this->_velocity).y * 0.1; - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,4,9,&this->_pos,&local_29c,GHIDRA_CAST(local_294),0,uVar9); - iVar19 = __RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33); - pBVar10 = BitSet128::operator_or - (GHIDRA_CAST(auStack_24),GHIDRA_CAST(local_3c),&g_tearFlagButtBomb); - local_2bc.y = 5.1848e-44; - buttBombFlagsLo = pBVar10->_l; - uVar29 = *GHIDRA_CAST((GHIDRA_INT(&pBVar10->_l) + 4)); - buttBombFlagsHi = pBVar10->_h; - uVar33 = *GHIDRA_CAST((GHIDRA_INT(&pBVar10->_h) + 4)); - *GHIDRA_CAST((iVar19 + 0x463)) = 1; - *GHIDRA_CAST((iVar19 + 0x438)) = GHIDRA_INT(buttBombFlagsLo); - *GHIDRA_CAST((iVar19 + 0x43c)) = uVar29; - *GHIDRA_CAST((iVar19 + 0x440)) = GHIDRA_INT(buttBombFlagsHi); - *GHIDRA_CAST((iVar19 + 0x444)) = uVar33; - manager = g_manager; - seed_fart_sound_override(GHIDRA_CAST(&local_2bc.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_2bc.y),1.0,2,0,1.0,0.0); - uVar9 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x22,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar9); - virtualFn = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::Reset(); - (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::SetTint(1.8,0.7,1.5,1.0); - (*virtualFn)(local_70,0xffffffff,0xff,0,1); - tmpEntity->Update(); - this = local_294; - ShootCandle(local_294,&g_vectorZero); - game = g_game; - } - } - } - if ((game->_dailyChallenge)._specialDailyId == 0x29) { - if (*GHIDRA_CAST(&game->_stageTransition) == 0) { - if ((isInputAllowed != '\0') && ((uint8_t)local_284 != 0)) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x1e,0); - if ((bVar4 != 0) && (uVar9 = Random(), (uVar9 & 3) == 0)) { - Game::ButterBeanFart(g_game,&this->_pos,120.0,GHIDRA_CAST(this),1,0); - } - game = g_game; - } - goto LAB_0077c05c; - } - } - else { -LAB_0077c05c: - if (((*GHIDRA_CAST(&game->_stageTransition) == 0) && (isInputAllowed != '\0')) && - (this->_fireBlockCooldown < 1)) { - if ((uint8_t)local_284 == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18f0)))) = 0; - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18f0)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18f0)))) + 1; - } - } - } - tmpPlayer = local_294; - if ((0 < this->_megaBlastDuration) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f00)))) != 0)) { - isShooting = 0; - } - iVar19 = this->_fireBlockCooldown; - local_2b4 = GHIDRA_CAST(0xf); - local_2a8 = GHIDRA_CAST(0x0); - if (iVar19 < 1) { - local_2a8 = GHIDRA_CAST(GHIDRA_UINT(isShooting)); - } - isShooting = (uint8_t)local_2a8; - if (((this->_isUrethraBlocked != 0) && (iVar19 < 1)) && (isInputAllowed != '\0')) { - if (((uint8_t)local_284 == 0) || - ((local_285 != '\0' && (this->_maxBladderCharge <= this->_bladderCharge)))) { - if ((*GHIDRA_CAST(game->_room) != '\0') && - (5 < game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x11f0)))) { - if (this->_maxBladderCharge <= this->_bladderCharge) { - TryForgottenThrow(local_294,&this->_lastDirection); - game = g_game; - tmpPlayer->_isUrethraBlocked = 0; - tmpPlayer->_blinkTime = 10; - iVar19 = game->_frameCount; - uVar9 = Random(); - local_294->_maxPeeBurstCooldown = 0xb4; - local_294->_peeBurstCooldown = 0xb4; - local_294->_nextUrethraBlockFrame = iVar19 + (uVar9 % GHIDRA_UINT(local_2b4) + 0xf) * 0x1e; - local_29c.y = (this->_lastDirection).y * 15.0 * local_294->_shotspeed; - local_29c.x = (this->_lastDirection).x * 15.0 * local_294->_shotspeed; - velocity.y = local_29c.y; - velocity.x = local_29c.x; - tear = FireTear(local_294,&local_294->_pos,velocity,0x45,GHIDRA_CAST(0x0),1.0); - (GHIDRA_CAST((tear)))->Entity_Tear::ChangeVariant(0x16); - tear->SetCollisionDamage(tear->_collisionDamage * 10.0); - local_2a8 = GHIDRA_CAST(tear->_fScale); - uVar9 = Random(); - local_290.y = 0.01; - local_2a8 = (Entity_Effect *) - (((float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) - * 2.3283064e-10 * 0.3 + 1.2) * (float)local_2a8); - pfVar11 = GHIDRA_CAST(&local_2a8); - if ((float)local_2a8 <= 0.01) { - pfVar11 = &local_290.y; - } - fVar24 = *pfVar11; - tear->_baseScale = fVar24; - tear->_fScale = fVar24; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - local_3c = *(uint8_t (*) [4])&(tear->_tearFlags)._l; - fStack_38 = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)); - VStack_34.x = *GHIDRA_CAST(&(tear->_tearFlags)._h); - VStack_34.y = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)); - pBVar32 = &g_tearFlagSpectral; - pBVar10 = BitSet128::operator_or - (GHIDRA_CAST(auStack_24),GHIDRA_CAST(local_3c),&g_tearFlagPiercing); - pBVar10 = BitSet128::operator_or(&local_80,pBVar10,pBVar32); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*pBVar10); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel(0.0); - FUN_00444c70(0xc0400000); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(-10.0); - virtualFn = *(code **)(*GHIDRA_CAST(tear) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::Color(); - (*virtualFn)(extraout_EAX,0xffffffff,0xff,0,1); - tear->Update(); - this = local_294; - } - this->_bladderCharge = 0; - } - } - else if (this->_bladderCharge < this->_maxBladderCharge) { - this->_bladderCharge = this->_bladderCharge + 1; - } - iVar19 = this->_fireBlockCooldown; - isShooting = '\0'; - } - if (this->_ibsCharge < 1.0) { - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a8))) = 1; -LAB_0077c4aa: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a4)))) = 0; - } - else if (((iVar19 < 1) && (isInputAllowed != '\0')) && (this->_itemState == 0)) { - if ((uint8_t)local_284 == 0) { - rng = GHIDRA_CAST(rng_vector_at(0x2d5)); - uVar9 = (GHIDRA_CAST((rng)))->RNG::RandomInt(0xb); - UsePoopSpell(this,uVar9 + 1); - this->_ibsCharge = (float)&DAT_bf800000; - goto LAB_0077c4aa; - } - local_2a8 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a4)))) + 0.033333335)); - local_290.y = 1.0; - clampedCharge = GHIDRA_CAST(std)::min(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a4)))) = *clampedCharge; - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a8))) != '\0') { - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a8))) = 0; - SoundEffects::PlayWithFartOverride(0x360,1.0,2,0,1.0); - } - } - if (this->_headDirectionTime < 0) { - tmpEntity = GetFocusEntity(this); - local_2bc.y = (float)tmpEntity; - if (tmpEntity != GHIDRA_CAST(0x0)) { - FUN_004172b0(&local_29c); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 != 0) { - pVVar7 = (GHIDRA_CAST((tmpEntity)))->Entity::Position(&local_2b0); - pVVar12 = GHIDRA_CAST(FUN_004172b0(&local_290)); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__add(&local_2c4,pVVar12); - local_2a8 = GHIDRA_CAST(0x3f000000); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__mul(&local_2d0,GHIDRA_CAST(&local_2a8)); - (GHIDRA_CAST((&local_29c)))->Vector::operator_assign(pVVar7); - tmpEntity = GHIDRA_CAST(local_2bc.y); - } - pVVar7 = (GHIDRA_CAST((&local_29c)))->Vector::__sub(&local_2b0,&this->_pos); - (GHIDRA_CAST((&local_308)))->Vector::operator_assign(pVVar7); - if ((tmpEntity == this->_markedTarget) && (this->_itemState == 0)) { - (GHIDRA_CAST((&shootDirection)))->Vector::operator_assign(&local_308); - isDirectionHeld = (GHIDRA_CAST((&shootDirection)))->Vector::operator_ne(&g_vectorZero); - } - } - if ((local_308.x != 0.0) || (local_308.y != 0.0)) { - effect = GHIDRA_CAST(local_308.x); - Math::abs(); - pEVar16 = GHIDRA_CAST(local_308.y); - local_2a8 = effect; - Math::abs(); - if ((float)local_2a8 <= (float)pEVar16) { - if (0.0 <= local_308.y) { - SimpleString::operator=(GHIDRA_CAST(&this->_headAnim),"HeadDown"); - this->_headDirection = 3; - } - else { - SimpleString::operator=(GHIDRA_CAST(&this->_headAnim),"HeadUp"); - this->_headDirection = 1; - } - } - else { - if (0.0 <= local_308.x) { - local_2bc.y = 2.8026e-45; - pcVar13 = "HeadRight"; - } - else { - local_2bc.y = 0.0; - pcVar13 = "HeadLeft"; - } - SimpleString::operator=(GHIDRA_CAST(&this->_headAnim),pcVar13); - this->_headDirection = GHIDRA_INT(local_2bc.y); - } - } - } - if (this->_fireBlockCooldown < 1) { - this->_fireDirection = -1; - pEVar16 = GHIDRA_CAST(shootDirection.y); - Math::abs(); - effect = GHIDRA_CAST(shootDirection.x); - local_2a8 = pEVar16; - Math::abs(); - if (0.01 < (float)local_2a8 + (float)effect) { - iVar19 = vector_to_direction(&shootDirection); - this->_fireDirection = iVar19; - } - } - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - FUN_00428b50(); - cVar5 = FUN_0082ee30(); - if ((cVar5 == '\0') && (isInputAllowed != '\0')) { - bVar4 = HasCollectible(this,399,0); - if (bVar4 != 0) { - if (((uint8_t)local_284 == 0) || - ((local_285 != '\0' && (0x96 < this->_mawOfTheVoidChargeTimer)))) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar19 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (5 < iVar19) { - if (0x96 < this->_mawOfTheVoidChargeTimer) { - laser = SpawnMawOfVoid(this,0x3c); - laser->Update(); - if (local_285 == '\0') { - piVar14 = GHIDRA_CAST(std)::max(); - this->_fireBlockCooldown = *piVar14; - } - itemConfig = Isaac::GetItemConfig(); - nullItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x13); - RemoveCostume(this,nullItem); - (GHIDRA_CAST((mawHeadDown)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadDownShoot")); - local_8 = 0; - (GHIDRA_CAST((mawHeadRight)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadRightShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - (GHIDRA_CAST((local_70 + 0x2c)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadUpShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 2; - (GHIDRA_CAST((mawHeadLeft)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadLeftShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 3; - pVVar7 = Vector::ToCardinal(&local_29c,&this->_lastDirection); - pvVar8 = string_from_direction - (local_a0,*pVVar7,mawHeadLeft,local_70 + 0x2c,mawHeadRight, - mawHeadDown); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 4; - PlayCollectibleAnim(this,399,0,pvVar8,-1,0); - (GHIDRA_CAST((local_a0)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((mawHeadLeft)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((local_70 + 0x2c)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((mawHeadRight)))->msvc::string::_Tidy_deallocate(); - local_8 = 0xffffffff; - (GHIDRA_CAST((mawHeadDown)))->msvc::string::_Tidy_deallocate(); - this->_fireDirection = -1; - } - this->_mawOfTheVoidChargeTimer = 0; - } - } - else { - this->_mawOfTheVoidChargeTimer = this->_mawOfTheVoidChargeTimer + 1; - if (this->_mawOfTheVoidChargeTimer == 0x96) { - itemConfig = Isaac::GetItemConfig(); - bVar4 = 0; - nullItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x13); - AddCostume(this,nullItem,bVar4); - } - } - } - bVar4 = HasCollectible(this,0x283,0); - if (bVar4 != 0) { - if (((uint8_t)local_284 == 0) || ((local_285 != '\0' && (0x96 < this->_revelationChargeTimer))) - ) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar19 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (5 < iVar19) { - if (0x96 < this->_revelationChargeTimer) { - clampedCharge = GHIDRA_CAST(FUN_00753940()); - local_29c.x = (float)*clampedCharge; - local_29c.y = (float)clampedCharge[1]; - GetLaserOffset(this,&local_2b0,4,&local_29c); - local_2a8 = GHIDRA_CAST((GHIDRA_CAST((&local_29c)))->Vector)::GetAngleDegrees(); - laser = Entity_Laser::ShootAngle - (5,&this->_pos,(float)local_2a8,0x1e,posOffset,GHIDRA_CAST(this),0); - laser->SetCollisionDamage(this->_meleeDamage); - FUN_00456830(GHIDRA_INT((this->_tearFlags)._l), - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)), - GHIDRA_INT((this->_tearFlags)._h), - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4))); - if (local_308.y <= -0.5) { - fVar24 = -10.0; - } - else { - fVar24 = 3000.0; - } - set_field_358(laser,fVar24); - if (local_285 == '\0') { - piVar14 = GHIDRA_CAST(std)::max(); - this->_fireBlockCooldown = *piVar14; - } - this->_fireDirection = -1; - } - this->_revelationChargeTimer = 0; - } - } - else { - this->_revelationChargeTimer = this->_revelationChargeTimer + 1; - } - } - bVar4 = HasCollectible(this,0x2a8,0); - if (bVar4 != 0) { - if (((uint8_t)local_284 == 0) || ((local_285 != '\0' && (0x96 < this->_montezumaChargeTimer)))) - { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar19 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (5 < iVar19) { - if (0x96 < this->_montezumaChargeTimer) { - Vector::FromAngle(&local_2b0,this->_bodyAngle + 180.0); - GetLaserOffset(this,&local_29c,-1,&local_2b0); - local_29c.y = local_29c.y - (this->_bodyScale).y * 4.0; - laser = Entity_Laser::ShootAngle - (0xc,&this->_pos,this->_bodyAngle + 180.0,0x1e,&local_29c, - GHIDRA_CAST(this),0); - laser->SetCollisionDamage(this->_meleeDamage); - pBVar10 = (GHIDRA_CAST((&g_tearFlagWait)))->BitSet128::__bnot(GHIDRA_CAST(auStack_24)); - pBVar10 = BitSet128::operator_and(GHIDRA_CAST(local_3c),&this->_tearFlags,pBVar10); - FUN_00456830(GHIDRA_INT(pBVar10->_l),*GHIDRA_CAST((GHIDRA_INT(&pBVar10->_l) + 4)),GHIDRA_INT(pBVar10->_h), - *GHIDRA_CAST((GHIDRA_INT(&pBVar10->_h) + 4))); - (GHIDRA_CAST((laser)))->Entity_Laser::SetMaxDistance(120.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_montezumaLaser))))->EntityPtr::SetReference(GHIDRA_CAST(laser)); - if (local_2b0.y <= -0.5) { - fVar24 = -10.0; - } - else { - fVar24 = 3000.0; - } - set_field_358(laser,fVar24); - if (local_285 == '\0') { - piVar14 = GHIDRA_CAST(std)::max(); - this->_fireBlockCooldown = *piVar14; - } - this->_fireDirection = -1; - } - this->_montezumaChargeTimer = 0; - } - } - else { - this->_montezumaChargeTimer = this->_montezumaChargeTimer + 1; - } - } - if ((this->_playerType == 0x1a) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000), bVar4 == 0)) { - if (((uint8_t)local_284 == 0) || (cVar5 = FUN_007dac30(), cVar5 == '\0')) { - this->_eveSumptoriumCharge = 0; - } - else { - this->_eveSumptoriumCharge = this->_eveSumptoriumCharge + 1; - if (0x3b < this->_eveSumptoriumCharge) { - this->_eveSumptoriumCharge = 0; - SpawnClot(this,&this->_pos,0); - } - } - } - } - } - local_2d0.y = (float)GetWeaponModifiers(this); - if (this->_itemState == 0x2f) { - if (this->_weapons[0] != GHIDRA_CAST(0x0)) { - iVar19 = (GHIDRA_CAST((this->_weapons[0])))->Entity::SubType(); - if (iVar19 == 6) goto LAB_0077cde3; - if (this->_weapons[0] != (void *)0x0) { - Isaac::DestoryWeapon(this->_weapons); - } - } - weapon = Isaac::CreateWeapon(6,GHIDRA_CAST(this)); - this->_weapons[0] = weapon; - } - else { - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x93); - if (bVar4 == 0) { - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x280); - pvVar8 = this->_weapons[0]; - if (bVar4 == 0) { - if (this->_playerType != 0x20) { - if (pvVar8 != (void *)0x0) { - Isaac::DestoryWeapon(this->_weapons); - } - goto LAB_0077cde3; - } - if (pvVar8 == (void *)0x0) { -LAB_0077cdbc: - weapon = Isaac::CreateWeapon(GHIDRA_INT(local_2b4),GHIDRA_CAST(this)); - this->_weapons[0] = weapon; - } - else { - iVar19 = (GHIDRA_CAST(()))->Entity::SubType(); - if (iVar19 != 0xf) { - if (this->_weapons[0] != (void *)0x0) { - Isaac::DestoryWeapon(this->_weapons); - } - goto LAB_0077cdbc; - } - } - isShooting = '\x01'; - } - else { - if (pvVar8 != (void *)0x0) { - iVar19 = (GHIDRA_CAST(()))->Entity::SubType(); - if (iVar19 == 0xc) goto LAB_0077cd7e; - if (this->_weapons[0] != (void *)0x0) { - Isaac::DestoryWeapon(this->_weapons); - } - } - weapon = Isaac::CreateWeapon(0xc,GHIDRA_CAST(this)); - this->_weapons[0] = weapon; -LAB_0077cd7e: - isShooting = '\x01'; - } - } - else { - if (this->_weapons[0] != GHIDRA_CAST(0x0)) { - iVar19 = (GHIDRA_CAST((this->_weapons[0])))->Entity::SubType(); - if (iVar19 == 0xb) goto LAB_0077cd7e; - if (this->_weapons[0] != (void *)0x0) { - Isaac::DestoryWeapon(this->_weapons); - } - } - weapon = Isaac::CreateWeapon(0xb,GHIDRA_CAST(this)); - this->_weapons[0] = weapon; - isShooting = '\x01'; - } - } -LAB_0077cde3: - local_2bc.y = (float)(this->_weapons + 1); - local_2b4 = GHIDRA_CAST(&DAT_00000004); - do { - if (*(void **)local_2bc.y != (void *)0x0) { - FUN_004316c0(); - FUN_004316b0(local_2d0.y); - } - local_2bc.y = (float)(GHIDRA_INT(local_2bc.y) + 4); - local_2b4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_2b4[-1])) + 0x4bf)))); - } while (local_2b4 != GHIDRA_CAST(0x0)); - if (this->_weapons[0] == (void *)0x0) { - local_2bc.y = (float)(this->_weapons + 1); - local_2b4 = GHIDRA_CAST(&DAT_00000004); - do { - local_2a8 = *GHIDRA_CAST(local_2bc.y); - if (local_2a8 != GHIDRA_CAST(0x0)) { - virtualFn = *(code **)(*GHIDRA_CAST(local_2a8) + 8); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - (*virtualFn)(bVar4); - } - local_2bc.y = (float)(GHIDRA_INT(local_2bc.y) + 4); - local_2b4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_2b4[-1])) + 0x4bf)))); - } while (local_2b4 != GHIDRA_CAST(0x0)); - } - else { - FUN_004316c0(); - FUN_004316b0(GHIDRA_UINT(local_2d0.y) | 0x80000000); - virtualFn = *(code **)(*GHIDRA_CAST(this->_weapons[0]) + 8); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_294))))->Entity::HasEntityFlags(0x4000); - (*virtualFn)(bVar4); - this = local_294; - } - if ((this->_itemState == 0x31) && (local_286 != '\0')) { - this->_blinkTime = 10; - } - local_2a8 = GHIDRA_CAST(this->_blinkTime); - local_2dc = 2; - if (GHIDRA_INT(local_2a8) < 9) { - local_2dc = 0; - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 == 0) { - if (-1 < this->_blinkTime) { - this->_blinkTime = this->_blinkTime + -1; - } - if (-1 < this->_headDirectionTime) { - this->_headDirectionTime = this->_headDirectionTime + -1; - } - } - local_290.y = (GHIDRA_CAST((&shootDirection)))->Vector::LengthSquared(); - if (1.0 < local_290.y) { - (GHIDRA_CAST((&shootDirection)))->Vector::Normalize(); - } - Vector::ToCardinal(&cardinalDirection,&shootDirection); - bVar4 = HasCollectible(this,0x220,0); - if ((bVar4 != 0) || - ((this->_playerType == 0xd && (bVar4 = HasCollectible(this,0x26b,0), bVar4 != 0)))) { - local_290.y = 9.80909e-45; - piVar14 = GHIDRA_CAST(std)::max(); - this->_blinkTime = *piVar14; - } - bVar4 = HasCollectible(this,0xf3,0); - piVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428)))); - puVar21 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428))); - local_290.y = (float)puVar21; - if (bVar4 == 0) { - if (piVar14 != GHIDRA_CAST(0x0)) { - (**(code **)(*piVar14 + 0x28))(); - (GHIDRA_CAST((GHIDRA_CAST(puVar21))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - else { - if (piVar14 == GHIDRA_CAST(0x0)) { - uVar9 = Random(); - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x2f,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar9); - effect = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33)); - (GHIDRA_CAST((GHIDRA_CAST(local_290.y))))->EntityPtr::SetReference(GHIDRA_CAST(effect)); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetParent(GHIDRA_CAST(local_294)); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_294)) + 0x1404))))); - FUN_0043eea0(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_294)) + 0x1404))))); - pVVar7 = Vector::FromAngle(&local_29c,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_294)) + 0x1404)))) + 90.0); - local_290.y = 30.0; - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__mul(&local_2b0,&local_290.y); - pVVar7 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_2c4,pVVar7); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetPosition(pVVar7); - this = local_294; - effect->SetColor(&local_294->_tearColor,0xffffffff,0xff,0,1); - effect->Update(); - } - else { - effect = (Entity_Effect *) - __RTDynamicCast(piVar14,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); - local_2b4 = effect; - if ((uint8_t)local_284 == 0) { - local_2bc.y = 0.8; - } - else { - local_29c.x = shootDirection.x; - local_29c.y = shootDirection.y; - if ((shootDirection.y == 0.0) && (shootDirection.x == 0.0)) { - switch(this->_headDirection) { - case 0: - local_29c.x = (float)&DAT_bf800000; - break; - case 1: - local_29c.y = (float)&DAT_bf800000; - break; - case 2: - local_29c.x = 1.0; - break; - case 3: - local_29c.y = 1.0; - } - } - fVar24 = (GHIDRA_CAST((&local_29c)))->Vector::GetAngleDegrees(); - local_290.y = fVar24 - 90.0; - local_290.y = normalize_angle_degrees(local_290.y); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(local_290.y); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1404)))) = local_290.y; - local_2bc.y = 0.5; - } - fVar23 = (long double)(GHIDRA_CAST((effect)))->Entity_Effect::Rotation(); - local_290.y = (float)fVar23; - fVar23 = (long double)(GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SpriteRotation(); - local_2c4.y = (float)fVar23; - local_290.y = LerpAngleDeg(local_2c4.y,local_290.y,local_2bc.y); - FUN_0043eea0(local_290.y); - pVVar7 = Vector::FromAngle(&local_29c,local_290.y + 90.0); - local_290.y = 30.0; - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__mul(&local_2b0,&local_290.y); - pVVar7 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_2c4,pVVar7); - effect = local_2b4; - (GHIDRA_CAST((GHIDRA_CAST(local_2b4))))->Entity::SetPosition(pVVar7); - effect->SetColor(&this->_tearColor,0xffffffff,0xff,0,1); - local_290.y = (float)&DAT_00000007; - piVar14 = GHIDRA_CAST(std)::max(); - this->_blinkTime = *piVar14; - } - cVar5 = FUN_00423960(); - if (cVar5 != '\0') { - pVVar7 = GHIDRA_CAST(0x3f800000); - local_2bc.y = 1.0; - bVar4 = IsLocalPlayer(this); - if (bVar4 == 0) { - FUN_00417900(); - FUN_00925df0(); - local_2bc.y = (float)pVVar7; - } - entityColor = GHIDRA_CAST((GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428)))))))->Entity)::GetColor(); - (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::operator_assign(entityColor); - Font::SetLineHeightModifier(GHIDRA_CAST(local_70),local_2bc.y); - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1428)))) + 0x3c))(local_70,0xffffffff,0xff,0,1); - } - } - bVar4 = HasCollectible(this,0x195,0); - if (((((bVar4 != 0) || (bVar4 = HasCollectible(this,0x238,0), bVar4 != 0)) || - (bVar4 = HasCollectible(this,0x2d6,0), bVar4 != 0)) || - (bVar4 = HasCollectible(this,0x2a9,0), bVar4 != 0)) && (this->_isControlsEnabled != 0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x0))) = 4; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x4))) = 6; - fStack_1c = 7.00649e-45; - iStack_18 = 7; - local_2bc.y = 0.0; - do { - pVVar7 = GHIDRA_CAST(local_2bc.y); - bVar4 = input_is_action_triggered - (g_manager,*GHIDRA_CAST((auStack_24 + GHIDRA_INT(local_2bc.y) * 4)), - this->_controllerIndex,GHIDRA_CAST(this),0); - if (bVar4 != 0) { - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f94)))) == pVVar7) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f98)))) < 0xb)) { - Isaac::GetAxisAlignedUnitVectorFromDir(&local_29c,GHIDRA_INT(pVVar7)); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((room)))->Room::IsMirrorWorld(); - if (bVar4 != 0) { - local_29c.x = local_29c.x * -1.0; - } - local_290.y = 3.25101e-43; - local_2c4.y = 9.54284e-43; - pVVar7 = GHIDRA_CAST(FUN_005cbfa0(&local_290.y)); - (GHIDRA_CAST((GHIDRA_CAST(local_3c))))->Vector::operator_assign(pVVar7); - local_290.y = 1.30321e-43; - local_2c4.y = 5.67526e-43; - pVVar7 = GHIDRA_CAST(FUN_005cbfa0(&local_290.y)); - (GHIDRA_CAST((&VStack_34)))->Vector::operator_assign(pVVar7); - local_2b4 = GHIDRA_CAST(0x0); - local_290.y = 0.0; - do { - puVar21 = GHIDRA_CAST(local_290.y); - bVar4 = HasCollectible(this,*GHIDRA_CAST((local_3c + GHIDRA_INT(local_290.y) * 8)),0); - if (bVar4 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - pEVar15 = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist - (pEVar15,GHIDRA_CAST(&local_80),3, - *GHIDRA_CAST((local_3c + GHIDRA_INT(puVar21) * 8 + 4)),-1,0,0); - local_8 = 5; - fVar24 = 0.0; - local_2c4.y = 0.0; - iVar19 = (GHIDRA_CAST((GHIDRA_CAST(&local_80))))->EntityList::Size(); - if (iVar19 != 0) { - local_2d0.y = (float)(GHIDRA_INT(local_2b4) * 0xc); - do { - msvc::vector::operator_index(fVar24); - this_01 = GHIDRA_CAST(FUN_00435de0()); - if (((this_01 != GHIDRA_CAST(0x0)) && - (tmpPlayer = GHIDRA_CAST((GHIDRA_CAST((this_01)))->Entity_Familiar)::Player(), - tmpPlayer == this)) && - ((iVar19 = FUN_00753d30(), -1 < iVar19 && - (iVar19 = FUN_00753d30(), iVar19 <= GHIDRA_INT(local_2d0.y))))) { - FUN_00753d40(local_2d0.y); - position.y = local_29c.y; - position.x = local_29c.x; - (GHIDRA_CAST((GHIDRA_CAST(this_01))))->Entity::SetTargetPosition(position); - local_2b4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_2b4)) + 0x1)))); - local_2d0.y = (float)(GHIDRA_INT(local_2d0.y) + 0xc); - } - fVar24 = (float)(GHIDRA_INT(local_2c4.y) + 1); - local_2c4.y = fVar24; - fVar26 = (float)(GHIDRA_CAST((GHIDRA_CAST(&local_80))))->EntityList::Size(); - } while (GHIDRA_UINT(fVar24) < GHIDRA_UINT(fVar26)); - } - local_8 = 0xffffffff; - (GHIDRA_CAST((&local_80)))->EntityList_Query::~EntityList_Query(); - puVar21 = GHIDRA_CAST(local_290.y); - } - local_290.y = (float)(puVar21 + 1); - } while (puVar21 + 1 < GHIDRA_CAST(0x2)); - bVar4 = HasCollectible(this,0x238,0); - if ((bVar4 != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f9c)))) < 1)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f9c)))) = 0x5a; - play_sound_with_fart_seed(0x238,1.0,2,0,1.0); - puVar21 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0))); - local_290.y = (float)puVar21; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1fa0)))) + 0x28))(); - (GHIDRA_CAST((GHIDRA_CAST(puVar21))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - uVar9 = Random(); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xbc,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar9); - (GHIDRA_CAST((GHIDRA_CAST(local_290.y))))->EntityPtr::SetReference(GHIDRA_CAST(effect)); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetParent(GHIDRA_CAST(local_294)); - fVar24 = (GHIDRA_CAST((&local_29c)))->Vector::GetAngleDegrees(); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(fVar24); - fVar23 = (long double)(GHIDRA_CAST((effect)))->Entity_Effect::Rotation(); - Vector::FromAngle(&local_2b0,(float)fVar23); - local_290.y = 10.0; - pVVar7 = (GHIDRA_CAST((&local_2b0)))->Vector::__mul(&local_300,&local_290.y); - pVVar7 = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_2f4,pVVar7); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetPosition(pVVar7); - local_290.y = 10.0; - pVVar7 = (GHIDRA_CAST((&local_2b0)))->Vector::__mul(&local_2d8,&local_290.y); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetVelocity(pVVar7); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x1e); - effect->Update(); - this = local_294; - virtualFn = *(code **)(*GHIDRA_CAST(local_294) + 0x3c); - uVar29 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0,0,0,0x3f99999a,0x3f99999a,0x3f800000); - (*virtualFn)(uVar29,8,2,1,1); - } - bVar4 = HasCollectible(this,0x2d6,0); - if ((bVar4 != 0) && - (bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x2d6), - bVar4 == 0)) { - local_2ec.y = (float)Isaac::CreateWeapon(2,GHIDRA_CAST(this)); - FUN_004316c0(); - uVar9 = GetWeaponModifiers(this); - FUN_004316b0(uVar9 | 0x200); - (GHIDRA_CAST((GHIDRA_CAST(local_2ec.y))))->Weapon_Brimstone::fire((float)&local_29c,0); - Isaac::DestoryWeapon(GHIDRA_CAST(&local_2ec.y)); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x2d6,1,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x75,1,1); - (GHIDRA_CAST((local_a0)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadDownShoot")); - local_8 = 6; - (GHIDRA_CAST((hemoptysisHeadRight)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadRightShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 7; - (GHIDRA_CAST((hemoptysisHeadUp)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadUpShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 8; - (GHIDRA_CAST((hemoptysisHeadLeft)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadLeftShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 9; - direction.y = local_29c.y; - direction.x = local_29c.x; - animString = string_from_direction - (local_70 + 0x14,direction,hemoptysisHeadLeft,hemoptysisHeadUp, - hemoptysisHeadRight,local_a0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 10; - play_null_costume_anim(this,0x75,0,animString,-1,0); - (GHIDRA_CAST((local_70 + 0x14)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((hemoptysisHeadLeft)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((hemoptysisHeadUp)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((hemoptysisHeadRight)))->msvc::string::_Tidy_deallocate(); - local_8 = 0xffffffff; - (GHIDRA_CAST((local_a0)))->msvc::string::_Tidy_deallocate(); - } - pVVar7 = GHIDRA_CAST(local_2bc.y); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f94)))) = pVVar7; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f98)))) = 0; - } - local_2bc.y = (float)(GHIDRA_INT(&pVVar7->x) + 1); - } while (GHIDRA_INT(local_2bc.y) < 4); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f98)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f98)))) + 1; - bVar4 = HasCollectible(this,400,0); - piVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x142c)))); - puVar21 = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x142c))); - local_290.y = (float)puVar21; - if (bVar4 == 0) { - if (piVar14 != GHIDRA_CAST(0x0)) { - (**(code **)(*piVar14 + 0x28))(); - (GHIDRA_CAST((GHIDRA_CAST(puVar21))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - else if (piVar14 == GHIDRA_CAST(0x0)) { - uVar9 = Random(); - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x53,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar9); - effect = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33)); - (GHIDRA_CAST((GHIDRA_CAST(local_290.y))))->EntityPtr::SetReference(GHIDRA_CAST(effect)); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetParent(GHIDRA_CAST(local_294)); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_294)) + 0x1408))))); - FUN_0043eea0(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_294)) + 0x1408))))); - Vector::FromAngle(&local_29c,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_294)) + 0x1408)))) + 90.0); - local_290.y = 45.0; - pVVar7 = (GHIDRA_CAST((&local_29c)))->Vector::__mul(&local_2d8,&local_290.y); - pVVar7 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_2f4,pVVar7); - pVVar12 = (GHIDRA_CAST((&local_29c)))->Vector::Rotated(&local_300,90.0); - local_2c4.y = 10.0; - pVVar12 = (GHIDRA_CAST((pVVar12)))->Vector::__mul(&inheritedVelocity,&local_2c4.y); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__add(GHIDRA_CAST(&local_b0._h),pVVar12); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetPosition(pVVar7); - pVVar7 = (GHIDRA_CAST((&local_2d8)))->Vector::Vector(0.0,-15.0); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetPositionOffset(pVVar7); - effect->SetColor(&local_294->_tearColor,0xffffffff,0xff,0,1); - effect->Update(); - this = local_294; - } - else { - effect = (Entity_Effect *) - __RTDynamicCast(piVar14,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); - local_2b4 = effect; - if ((uint8_t)local_284 == 0) { - local_290.y = 0.8; - } - else { - local_29c.x = shootDirection.x; - local_29c.y = shootDirection.y; - if ((shootDirection.y == 0.0) && (shootDirection.x == 0.0)) { - switch(this->_headDirection) { - case 0: - local_29c.x = (float)&DAT_bf800000; - break; - case 1: - local_29c.y = (float)&DAT_bf800000; - break; - case 2: - local_29c.x = 1.0; - break; - case 3: - local_29c.y = 1.0; - } - } - fVar24 = (GHIDRA_CAST((&local_29c)))->Vector::GetAngleDegrees(); - local_290.y = fVar24 - 90.0; - local_290.y = normalize_angle_degrees(local_290.y); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(local_290.y); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1408)))) = local_290.y; - local_290.y = 0.5; - } - fVar23 = (long double)(GHIDRA_CAST((effect)))->Entity_Effect::Rotation(); - local_2c4.y = (float)fVar23; - fVar23 = (long double)(GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SpriteRotation(); - local_2bc.y = (float)fVar23; - local_290.y = LerpAngleDeg(local_2bc.y,local_2c4.y,local_290.y); - FUN_0043eea0(local_290.y); - Vector::FromAngle(&local_2b0,local_290.y + 90.0); - local_290.y = 45.0; - pVVar7 = (GHIDRA_CAST((&local_2b0)))->Vector::__mul(&local_2d8,&local_290.y); - pVVar7 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_2f4,pVVar7); - pVVar12 = (GHIDRA_CAST((&local_2b0)))->Vector::Rotated(&local_300,90.0); - local_2c4.y = 10.0; - pVVar12 = (GHIDRA_CAST((pVVar12)))->Vector::__mul(&inheritedVelocity,&local_2c4.y); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__add(GHIDRA_CAST(&local_b0._h),pVVar12); - effect = local_2b4; - (GHIDRA_CAST((GHIDRA_CAST(local_2b4))))->Entity::SetPosition(pVVar7); - effect->SetColor(&this->_tearColor,0xffffffff,0xff,0,1); - local_290.y = (float)&DAT_00000007; - piVar14 = GHIDRA_CAST(std)::max(); - this->_blinkTime = *piVar14; - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (((((bVar4 == 0) && (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0), bVar4 != 0)) && - ((bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x145), bVar4 != 0 - || ((bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000), bVar4 != 0 && - ((this->_entityRef2)._entity == this)))))) && - (bVar4 = IsFullSpriteRendering(this), bVar4 == 0)) && (iVar19 = Isaac::Random(2), iVar19 == 0) - ) { - (GHIDRA_CAST((GHIDRA_CAST(&local_29c))))->EntityPtr::clear(); - fVar24 = this->_meleeDamage * 0.75; - local_2c4.y = fVar24; - FUN_00431260(); - local_2d0.y = (fVar24 * 0.15 + local_2c4.y * 0.04 + 0.6) * 0.9; - iVar19 = Isaac::Random(2); - local_290.y = (float)((double)iVar19 + __uint_to_double_fixup[-(iVar19 >> 0x1f)]) * 0.4 + 0.9; - fVar24 = random_float(); - local_290.y = fVar24 * 0.05 + local_290.y; - (GHIDRA_CAST((&local_308)))->Vector::Normalized(&local_2b0); - if (local_286 != '\0') { - local_2bc.y = 8.0; - pVVar7 = (GHIDRA_CAST((&local_2b0)))->Vector::__mul(&local_2d8,&local_2bc.y); - (GHIDRA_CAST((&local_29c)))->Vector::operator_add_assign(pVVar7); - } - pVVar7 = MusicManager::RandomVector(&local_2d8); - local_2bc.y = random_float(); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__mul(&local_2f4,&local_2bc.y); - local_2b4 = GHIDRA_CAST(0x40000000); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__mul(&local_300,GHIDRA_CAST(&local_2b4)); - (GHIDRA_CAST((&local_29c)))->Vector::operator_add_assign(pVVar7); - GetTearMovementInheritance(this,&inheritedVelocity,&local_2b0,1); - (GHIDRA_CAST((&local_29c)))->Vector::operator_add_assign(other); - uVar9 = Random(); - tear = GHIDRA_CAST(Game)::Spawn(g_game,2,1,&this->_pos,&local_29c,GHIDRA_CAST(this),0,uVar9); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale(local_290.y * local_2d0.y); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(-12.0); - fVar23 = (long double)(GHIDRA_CAST((tear)))->Entity_Tear::FallingAcceleration(); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel((float)(fVar23 + (long double)0.5)); - fVar23 = (long double)(GHIDRA_CAST((tear)))->Entity_Tear::FallingSpeed(); - local_2bc.y = (float)fVar23; - fVar24 = random_float(); - FUN_00444c70((local_2bc.y - fVar24 * 10.0) - 4.0); - tear->SetCollisionDamage(local_290.y * local_2c4.y); - tear->Update(); - } - effect = GHIDRA_CAST(this->_luck); - local_2b4 = effect; - local_29c.y = (float)effect; - bVar4 = HasTrinket(this,0x8b,0); - if (bVar4 != 0) { - iVar19 = GetTrinketMultiplier(this,0x8b); - effect = GHIDRA_CAST(((float)iVar19 + (float)iVar19 + 2.0 + (float)local_2b4)); - this->_luck = (float)effect; - local_2b4 = effect; - } - iVar19 = this->_itemState; - if (iVar19 < 0x1e2) { - if (iVar19 == 0x1e1) { - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar4 != 0) || ((uint8_t)local_284 == 0)) goto LAB_0077fc4f; - (GHIDRA_CAST((&knifeTearParams)))->TearParams::constructor(); - uVar9 = Random(); - pVVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Position(&local_2d8); - knife = GHIDRA_CAST(Game)::Spawn(g_game,8,8,pVVar7,&g_vectorZero,GHIDRA_CAST(this),0,uVar9); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetParent(GHIDRA_CAST(this)); - pVVar7 = (GHIDRA_CAST((&local_2f4)))->Vector::Vector(6.0,0.0); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetTargetPosition(*pVVar7); - fVar24 = (GHIDRA_CAST((&shootDirection)))->Vector::GetAngleDegrees(); - FUN_005b15d0(fVar24); - pVVar7 = (GHIDRA_CAST((&local_300)))->Vector::Vector(0.0,-14.0); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetPositionOffset(pVVar7); - pVVar7 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::SpriteScale(); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetSpriteScale(pVVar7); - (GHIDRA_CAST((knife)))->Entity_Knife::SetAttackAnimation(); - FUN_00665bc0(1); - FUN_00753770(0); - knife->SetCollisionDamage(0x42da0000); - knife->Update(); - this->_itemStateCooldown = 5; - uVar9 = GetActiveItemSlot(this,0x1e1); - if (-1 < GHIDRA_INT(uVar9)) { - DischargeActiveItem(this,uVar9,0); - } - this->_blinkTime = 1; - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - fVar24 = random_float(); - play_sound_with_fart_seed(0xfc,1.0,2,0,fVar24 * 0.2 + 0.9); - } - else if (iVar19 < 0xa5) { - if (iVar19 == 0xa4) { -switchD_0077e14f_caseD_2a: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - if ((uint8_t)local_284 == 0) goto LAB_0077fc4f; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 != 0) goto switchD_0077f19d_caseD_2c5; - local_2bc.y = (float)&this->_lastVelocity; - if (this->_itemState == 0xa4) { - bVar4 = HasCollectible(this,0x164,0); - local_2e4.x = 14.0; - local_2e4.y = 7.0; - local_290.y = (float)&local_2e4; - local_2c4.y = (float)((bVar4 != 0) + 1); - do { - fVar24 = local_290.y; - uVar9 = Random(); - pVVar7 = (GHIDRA_CAST((&cardinalDirection)))->Vector::__mul(&local_2d8,GHIDRA_CAST(fVar24)); - local_2d0.y = 0.5; - pVVar12 = (GHIDRA_CAST((GHIDRA_CAST(local_2bc.y))))->Vector::__mul(&local_2f4,&local_2d0.y); - local_2ec.y = 2.0; - pVVar12 = (GHIDRA_CAST((pVVar12)))->Vector::__mul(&local_300,&local_2ec.y); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__add(&inheritedVelocity,pVVar12); - this = local_294; - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,1000,10,&local_294->_pos,pVVar7,GHIDRA_CAST(local_294),0, - uVar9); - pEVar16 = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33)); - (GHIDRA_CAST((pEVar16)))->Entity_Effect::SetTimeout(0x3c); - pEVar16->SetCollisionDamage(0x41b80000); - Game::GetField26614(g_game); - cVar5 = DeathmatchManager::is_active(); - if (cVar5 != '\0') { - pEVar15 = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar14 = GHIDRA_CAST((GHIDRA_CAST((pEVar15)))->EntityList)::Size(); - (**(code **)(*piVar14 + 0x44))(pEVar16); - } - bVar4 = IsLocalPlayer(this); - if (bVar4 == 0) { - entityColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar16))))->Entity)::GetColor(); - (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::operator_assign(entityColor); - FUN_00417900(); - FUN_00925df0(); - local_2b0.y = (float)effect; - fVar24 = (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::A(); - effect = GHIDRA_CAST(local_2b0.y); - Font::SetLineHeightModifier(GHIDRA_CAST(local_70),fVar24 * local_2b0.y); - pEVar16->SetColor(local_70,0xffffffff,0xff,0,1); - } - pEVar16->Update(); - local_290.y = (float)(GHIDRA_INT(local_290.y) + 4); - local_2c4.y = (float)(GHIDRA_INT(local_2c4.y) + -1); - } while (local_2c4.y != 0.0); -LAB_0077e64e: - iVar19 = 0x1d7; - } - else { - if (this->_itemState == 0x121) { - bVar4 = HasCollectible(this,0x164,0); - local_2e4.x = 14.0; - local_2e4.y = 7.0; - local_290.y = (float)&local_2e4; - local_2c4.y = (float)((bVar4 != 0) + 1); - do { - fVar24 = local_290.y; - uVar9 = Random(); - pVVar7 = (GHIDRA_CAST((&cardinalDirection)))->Vector::__mul(&local_2d8,GHIDRA_CAST(fVar24)); - local_2b0.y = 0.5; - pVVar12 = (GHIDRA_CAST((GHIDRA_CAST(local_2bc.y))))->Vector::__mul(&local_2f4,&local_2b0.y); - local_2d0.y = 2.0; - pVVar12 = (GHIDRA_CAST((pVVar12)))->Vector::__mul(&local_300,&local_2d0.y); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__add(&inheritedVelocity,pVVar12); - this = local_294; - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x34,&local_294->_pos,pVVar7,GHIDRA_CAST(local_294),0 - ,uVar9); - tmpEntity = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33)); - tmpEntity->SetCollisionDamage(0x41b80000); - Game::GetField26614(g_game); - cVar5 = DeathmatchManager::is_active(); - if (cVar5 != '\0') { - pEVar15 = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar14 = GHIDRA_CAST((GHIDRA_CAST((pEVar15)))->EntityList)::Size(); - (**(code **)(*piVar14 + 0x44))(tmpEntity); - } - bVar4 = IsLocalPlayer(this); - if (bVar4 == 0) { - entityColor = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetColor(); - (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::operator_assign(entityColor); - FUN_00417900(); - FUN_00925df0(); - local_2ec.y = (float)effect; - fVar24 = (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Color::A(); - effect = GHIDRA_CAST(local_2ec.y); - Font::SetLineHeightModifier(GHIDRA_CAST(local_70),fVar24 * local_2ec.y); - tmpEntity->SetColor(local_70,0xffffffff,0xff,0,1); - } - tmpEntity->Update(); - local_290.y = (float)(GHIDRA_INT(local_290.y) + 4); - local_2c4.y = (float)(GHIDRA_INT(local_2c4.y) + -1); - } while (local_2c4.y != 0.0); - local_2c4.y = 0.0; - goto LAB_0077e64e; - } - uVar9 = Random(); - local_2b0.y = 14.0; - pVVar7 = (GHIDRA_CAST((&cardinalDirection)))->Vector::__mul(&local_2d8,&local_2b0.y); - local_290.y = 0.5; - pVVar12 = (GHIDRA_CAST((GHIDRA_CAST(local_2bc.y))))->Vector::__mul(&local_2f4,&local_290.y); - local_2c4.y = 2.0; - pVVar12 = (GHIDRA_CAST((pVVar12)))->Vector::__mul(&local_300,&local_2c4.y); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__add(&inheritedVelocity,pVVar12); - this = local_294; - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,2,4,&local_294->_pos,pVVar7,GHIDRA_CAST(local_294),0,uVar9); - tear = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33)); - tmpEntity = GHIDRA_CAST(0x0); - iVar19 = Isaac::Random(2); - GetTearHitParams(this,&hitParams,5,1.0,iVar19 * 2 + -1,tmpEntity); - pBVar34 = &g_tearFlagPoison; - pBVar32 = &g_tearFlagExplosive; - pBVar10 = GetBombFlags(this,GHIDRA_CAST(auStack_24),0); - pBVar10 = BitSet128::operator_or(GHIDRA_CAST(local_3c),&hitParams._flags,pBVar10); - pBVar10 = BitSet128::operator_or(&local_80,pBVar10,pBVar32); - pBVar10 = BitSet128::operator_or(&local_b0,pBVar10,pBVar34); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*pBVar10); - tear->SetCollisionDamage(this->_damage + 185.0); - fVar24 = random_float(); - FUN_00444c70(fVar24 * 0.2 + 1.2); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(-33.0); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetParent(GHIDRA_CAST(this)); - tear->Update(); - iVar19 = 0xfc; - } - play_sound_with_fart_seed(iVar19,1.0,2,0,1.0); - goto LAB_0077e9ef; - } - switch(iVar19) { - case 0: - Vector::ToCardinal(&local_2b0,&local_308); - bVar4 = HasCollectible(this,0x1d1,0); - if ((bVar4 != 0) || (this->_markedTarget != (void *)0x0)) { - (GHIDRA_CAST((&local_2b0)))->Vector::operator_assign(&local_308); - } - if (((isShooting != '\0') || (this->_playerType == 0xd)) || (this->_playerType == 0x20)) { - bVar4 = HasCollectible(this,0xf4,0); - if (bVar4 != 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1468)))) < 1) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1468)))) = 0xf; - if (((local_286 != '\0') || (this->_markedTarget != (void *)0x0)) && - (iVar19 = Isaac::Random(3), iVar19 != 0)) { - laser = FireTechLaser(this,&this->_pos,2,&local_2b0,0,1,GHIDRA_CAST(0x0),1.0); - (GHIDRA_CAST((laser)))->Entity_Laser::set_scale(0.8); - laser->Update(); - this->_blinkTime = 5; - } - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1468)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1468)))) + -1; - } - } - if ((isShooting != '\0') && (bVar4 = IsExtraAnimationFinished(this), bVar4 != 0)) { - FUN_00428b50(); - cVar5 = FUN_0082ee30(); - if ((cVar5 == '\0') && (isInputAllowed != '\0')) { - trigger_fire_item_effects(this,&shootDirection,(uint8_t)local_284); - } - } - } - break; - default: - goto switchD_0077e14f_caseD_1; - case 0x2a: - goto switchD_0077e14f_caseD_2a; - case 0x2f: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - trigger_fire_item_effects(this,&shootDirection,1); - if (this->_itemState == 0) { - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - } - break; - case 0x31: - if ((local_286 == '\0') || - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000), bVar4 != 0)) break; - this->_itemStateCooldown = 0x1e; - play_sound_with_fart_seed(5,1.0,2,0,1.0); - GetLaserOffset(this,&local_2d8,3,&cardinalDirection); - fVar24 = cardinalDirection.y; - FUN_00456230(); - laser = Entity_Laser::ShootAngle - (3,&this->_pos,fVar24 * 57.295776,0xf,posOffset_00,GHIDRA_CAST(this),0); - laser->SetCollisionDamage(this->_damage + this->_damage); - if (cardinalDirection.y <= -0.5) { - fVar24 = -50.0; - } - else { - fVar24 = 3000.0; - } - set_field_358(laser,fVar24); - laser->Update(); - DischargeActiveItem(this,0,0); - piVar14 = &this->_blinkTime; - *piVar14 = 0x1e; - goto LAB_0077fc55; - } - } - else { - switch(iVar19) { - case 0x121: - goto switchD_0077e14f_caseD_2a; - default: -switchD_0077e14f_caseD_1: - KAGE_LogMessage(1,GHIDRA_CAST("No Such State %d\n")); - break; - case 0x152: - if ((local_286 != '\0') && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000), bVar4 == 0)) { - this->_itemStateCooldown = 0xf; - local_2b0.y = 15.0; - pVVar7 = (GHIDRA_CAST((&cardinalDirection)))->Vector::__mul(&local_2d8,&local_2b0.y); - local_290.y = 0.5; - pVVar12 = (GHIDRA_CAST((&this->_lastVelocity)))->Vector::__mul(&local_2f4,&local_290.y); - local_2c4.y = 2.0; - pVVar12 = (GHIDRA_CAST((pVVar12)))->Vector::__mul(&local_300,&local_2c4.y); - (GHIDRA_CAST((pVVar7)))->Vector::__add(&local_2ec,pVVar12); - uVar9 = Random(); - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x3c,&this->_pos,&local_2ec,GHIDRA_CAST(this),0,uVar9); - effect = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33)); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(GHIDRA_INT((-this->_tearheight * 0.75))); - effect->SetCollisionDamage(this->_damage + this->_damage); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetParent(GHIDRA_CAST(this)); - effect->Update(); - SoundEffects::PlayWithFartOverride(0x344,1.0,2,0,1.0); - this->_blinkTime = 0xf; - DischargeActiveItem(this,0,0); - ANM2::Reset(&this->_heldSprite); - itemConfig = Isaac::GetItemConfig(); - nullItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x1e); - RemoveCostume(this,nullItem); - } - break; - case 0x160: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - if ((uint8_t)local_284 == 0) goto LAB_0077fc4f; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 == 0) { - local_2b0.y = 10.0; - (GHIDRA_CAST((&shootDirection)))->Vector::__mul(&local_2e4,&local_2b0.y); - GetTearMovementInheritance(this,&local_2d8,&shootDirection,0); - (GHIDRA_CAST((&local_2e4)))->Vector::operator_add_assign(other_00); - pVVar7 = (GHIDRA_CAST((&local_2e4)))->Vector::__mul(&local_2f4,&this->_shotspeed); - tear = FireTear(this,&this->_pos,*pVVar7,1,GHIDRA_CAST(0x0),1.0); - fVar23 = (long double)(GHIDRA_CAST((tear)))->Entity_Tear::Scale(); - (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((float)(fVar23 * (long double)5.0)); - virtualFn = *(code **)(*GHIDRA_CAST(tear) + 0x40); - fVar23 = (long double)(GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::CollisionDamage(); - local_2b0.y = (float)((long double)10.0 + fVar23 * (long double)10.0); - (*virtualFn)(local_2b0.y); - pBVar34 = &g_tearFlagSpectral; - pBVar32 = &g_tearFlagPiercing; - pBVar10 = (GHIDRA_CAST((tear)))->Entity_Tear::TearFlags(GHIDRA_CAST(auStack_24)); - pBVar10 = BitSet128::operator_or(GHIDRA_CAST(local_3c),pBVar10,pBVar32); - pBVar10 = BitSet128::operator_or(&local_80,pBVar10,pBVar34); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*pBVar10); - this = local_294; - play_sound_with_fart_seed(0x1e2,1.0,2,0,1.0); - pVVar7 = (GHIDRA_CAST((&local_2e4)))->Vector::__unm(&local_300); - bVar4 = 0; - local_2b0.y = 0.5; - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__mul(&local_2d8,&local_2b0.y); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(pVVar7,bVar4); - goto LAB_0077ed69; - } - break; - case 0x17e: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - SoundEffects::PlayWithFartOverride(0x3fe,1.0,2,0,1.0); - } - if ((uint8_t)local_284 == 0) goto LAB_0077fc4f; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 == 0) { - local_2b0.y = 15.0; - (GHIDRA_CAST((&shootDirection)))->Vector::__mul(&local_2c4,&local_2b0.y); - GetTearMovementInheritance(this,&local_2d8,&shootDirection,0); - (GHIDRA_CAST((&local_2c4)))->Vector::operator_add_assign(other_01); - iVar19 = Game::Challenge(g_game); - if (iVar19 == 0x21) { - rng = GHIDRA_CAST(rng_vector_at(0x17e)); - uVar9 = (GHIDRA_CAST((rng)))->RNG::RandomInt(2); - if (uVar9 == 0) { - FUN_00417910(); - local_290.y = (float)FUN_006ef3f0(); - } - else { - FUN_00417910(); - local_290.y = (float)FUN_005cd4e0(); - } - iVar19 = FUN_0060c6e0(); - if (iVar19 != 0) { - rng = GHIDRA_CAST(rng_vector_at(0x17e)); - uVar9 = FUN_0060c6e0(); - uVar9 = (GHIDRA_CAST((rng)))->RNG::RandomInt(uVar9); - piVar14 = GHIDRA_CAST(FUN_0060c6c0(uVar9)); - enemyType = *piVar14; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x0))) = piVar14[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x4))) = piVar14[2]; - fStack_1c = (float)piVar14[3]; - iStack_18 = piVar14[4]; - bVar4 = Entity_NPC::Redirect(&enemyType,GHIDRA_CAST(auStack_24)); - if (bVar4 != 0) { - this_02 = GHIDRA_CAST(FUN_00417910()); - entityConfigEntry = EntityConfig::GetEntity(this_02,enemyType,(*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x0))),0); - if (entityConfigEntry != GHIDRA_CAST(0x0)) { - piVar14 = GHIDRA_CAST(FUN_005cd4b0(entityConfigEntry->id,entityConfigEntry->variant, - entityConfigEntry->subtype,entityConfigEntry->baseHP - ,0)); - enemyType = *piVar14; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x0))) = piVar14[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x4))) = piVar14[2]; - fStack_1c = (float)piVar14[3]; - } - } - (this->_friendBallEnemy)._maxHealth = fStack_1c; - (this->_friendBallEnemy)._type = enemyType; - (this->_friendBallEnemy)._variant = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x0))); - (this->_friendBallEnemy)._health = fStack_1c * 0.5; - (this->_friendBallEnemy)._subtype = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_24)) + 0x4))); - } - uVar9 = Random(); - uVar20 = 1; - } - else { - iVar19 = (this->_friendBallEnemy)._type; - uVar9 = Random(); - uVar20 = GHIDRA_UINT((iVar19 != 0)); - } - tmpEntity = Game::Spawn(g_game,1000,0x51,&this->_pos,&local_2c4,GHIDRA_CAST(this),uVar20, - uVar9); - (GHIDRA_CAST((tmpEntity)))->Entity::SetParent(GHIDRA_CAST(this)); - tmpEntity->Update(); - SoundEffects::PlayWithFartOverride(0x400,1.0,2,0,1.0); - goto LAB_0077ed69; - } - } - } - goto switchD_0077f19d_caseD_2c5; - } - switch(iVar19) { - case 0x200: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - if ((uint8_t)local_284 == 0) break; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 != 0) goto switchD_0077f19d_caseD_2c5; - uVar9 = Random(); - local_2b0.y = 34.0; - pVVar7 = (GHIDRA_CAST((&cardinalDirection)))->Vector::__mul(&local_2d8,&local_2b0.y); - local_290.y = 0.5; - pVVar12 = (GHIDRA_CAST((&local_294->_lastVelocity)))->Vector::__mul(&local_2f4,&local_290.y); - local_2c4.y = 2.0; - pVVar12 = (GHIDRA_CAST((pVVar12)))->Vector::__mul(&local_300,&local_2c4.y); - pVVar7 = (GHIDRA_CAST((pVVar7)))->Vector::__add(&inheritedVelocity,pVVar12); - this = local_294; - uVar33 = 0; - pTVar31 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar30 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar29 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x6b,&local_294->_pos,pVVar7,GHIDRA_CAST(local_294),0,uVar9); - piVar14 = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar29,pTVar30,pTVar31,uVar33)); - (**(code **)(*piVar14 + 0xc))(); - SoundEffects::PlayWithFartOverride(0x42c,1.0,2,0,1.0); -LAB_0077e9ef: - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - this->_itemStateCooldown = 5; - DischargeActiveItem(this,0,0); - piVar14 = &this->_blinkTime; - *piVar14 = 1; - goto LAB_0077fc55; - default: - goto switchD_0077e14f_caseD_1; - case 0x25c: - FUN_00420ae0(); - cVar5 = FUN_0082ee30(); - if (cVar5 == '\0') { -LAB_0077f304: - if (((this->_isPlayingItemAnimation == 0) && (this->_isPlayingExtraAnimation == 0)) && - (this->_heldEntity != (void *)0x0)) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - ANM2::Reset(&this->_heldSprite); - } - } - else { - FUN_00420ae0(); - cVar5 = FUN_0082eb90(); - if (cVar5 == '\0') goto LAB_0077f304; - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 != 0) goto switchD_0077f19d_caseD_2c5; - if ((this->_playerType == 0x28) && (this->_heldEntity != (void *)0x0)) { - pvVar8 = this->_heldEntity; - otherTwin = (void *)GetOtherTwin(this); - if ((pvVar8 != otherTwin) || - ((iVar19 = FUN_0042d040(), iVar19 == 0 || (0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x18f8)))))) - goto LAB_0077f3b7; - piVar14 = GHIDRA_CAST(FUN_0042d040()); - cVar5 = (**(code **)(*piVar14 + 0x40))(); - if (((cVar5 == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x1908)) == '\0')) || (this->_canShoot == 0)) - goto LAB_0077f3b7; -LAB_0077f493: - if (this->_heldEntity != (void *)0x0) break; - } - else { -LAB_0077f3b7: - if ((uint8_t)local_284 == 0) goto LAB_0077f493; - if (this->_heldEntity != (void *)0x0) { - local_2b0.y = 10.0; - (GHIDRA_CAST((&shootDirection)))->Vector::__mul(&local_290,&local_2b0.y); - GetTearMovementInheritance(this,&local_2d8,&shootDirection,0); - (GHIDRA_CAST((&local_290)))->Vector::operator_add_assign(other_02); - local_2b0.y = 1.2; - (GHIDRA_CAST((&local_290)))->Vector::operator_mul_assign(&local_2b0.y); - ThrowHeldEntity(this,&local_290); - ANM2::Reset(&this->_heldSprite); - this->_blinkTime = 1; - this->_itemStateCooldown = 5; - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - if (this->_activeDesc[0]._item == 0x25c) { - DischargeActiveItem(this,0,0); - } - goto switchD_0077f19d_caseD_2c5; - } - } - if (this->_itemStateCooldown == 0) { - ANM2::Reset(&this->_heldSprite); - this->_itemStateCooldown = 5; - goto LAB_0077ed7e; - } - break; - case 0x26f: - case 0x27e: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar4 == 0) { - if (((this->_itemState == 0x26f) && (this->_numKeys < 1)) && (this->_itemStateCooldown == 0)) - { - this->_itemStateCooldown = 5; - goto LAB_0077ed7e; - } - if ((uint8_t)local_284 == 0) break; - local_2b0.y = 10.0; - (GHIDRA_CAST((&shootDirection)))->Vector::__mul(&local_2bc,&local_2b0.y); - GetTearMovementInheritance(this,&local_2d8,&shootDirection,0); - (GHIDRA_CAST((&local_2bc)))->Vector::operator_add_assign(other_03); - uVar9 = 0x2d; - local_290.y = 6.30584e-44; - if (this->_itemState == 0x26f) { - local_2b0.y = this->_shotspeed * 1.5; - uVar9 = 0x2c; - local_290.y = (float)&DAT_0000002c; - (GHIDRA_CAST((&local_2bc)))->Vector::operator_mul_assign(&local_2b0.y); - } - GetTearHitParams(this,&hitParams,1,1.0,0,GHIDRA_CAST(this)); - uVar20 = Random(); - tear = (Entity_Tear *) - Game::Spawn(g_game,2,uVar9,&this->_pos,&local_2bc,GHIDRA_CAST(this),1,uVar20); - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(hitParams._tearHeight); - if (GHIDRA_CAST(local_290.y) == GHIDRA_CAST(0x2d)) { - tear->SetCollisionDamage(0x41700000); - } - else { - Game::GetField26614(g_game); - cVar5 = DeathmatchManager::is_active(); - if (cVar5 == '\0') { - fVar24 = hitParams._tearDamage * 5.0 + 30.0; - } - else { - fVar24 = hitParams._tearDamage * 4.0 + 5.0; - } - tear->SetCollisionDamage(fVar24); - pBVar10 = BitSet128::operator_or - (GHIDRA_CAST(auStack_24),&hitParams._flags,&g_tearFlagPiercing); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*pBVar10); - } - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetParent(GHIDRA_CAST(this)); - tear->Update(); - this->_itemStateCooldown = 5; - DischargeActiveItem(this,0,0); - this->_blinkTime = 1; - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - fVar24 = random_float(); - play_sound_with_fart_seed(0xfc,1.0,2,0,fVar24 * 0.2 + 0.9); - if (this->_itemState == 0x26f) { - AddKeys(this,-1); - } - } - case 0x2c5: -switchD_0077f19d_caseD_2c5: - break; - case 0x2c6: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar4 == 0) && ((uint8_t)local_284 != 0)) { - (GHIDRA_CAST((&bagTearParams)))->TearParams::constructor(); - uVar9 = Random(); - pVVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Position(&local_2d8); - knife = GHIDRA_CAST(Game)::Spawn(g_game,8,4,pVVar7,&g_vectorZero,GHIDRA_CAST(this),0,uVar9); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetParent(GHIDRA_CAST(this)); - pVVar7 = (GHIDRA_CAST((&local_2f4)))->Vector::Vector(6.0,0.0); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetTargetPosition(*pVVar7); - fVar24 = (GHIDRA_CAST((&shootDirection)))->Vector::GetAngleDegrees(); - FUN_005b15d0(fVar24); - pVVar7 = (GHIDRA_CAST((&local_300)))->Vector::Vector(0.0,-14.0); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetPositionOffset(pVVar7); - pVVar7 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::SpriteScale(); - (GHIDRA_CAST((GHIDRA_CAST(knife))))->Entity::SetSpriteScale(pVVar7); - (GHIDRA_CAST((knife)))->Entity_Knife::SetAttackAnimation(); - FUN_00665bc0(1); - FUN_00753770(0); - knife->SetCollisionDamage(0x3f800000); - knife->Update(); - this->_itemStateCooldown = 5; - uVar9 = GetActiveItemSlot(this,0x2c6); - if (-1 < GHIDRA_INT(uVar9)) { - DischargeActiveItem(this,uVar9,0); - } - this->_blinkTime = 1; - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - fVar24 = random_float(); - play_sound_with_fart_seed(2,1.0,2,0,fVar24 * 0.2 + 0.9); - goto switchD_0077f19d_caseD_2c5; - } - break; - case 0x2d8: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar4 == 0) && ((uint8_t)local_284 != 0)) { - bVar4 = HasCollectible(this,0x164,0); - local_2d0.x = 0.0; - local_2d0.y = 0.0; - local_2bc.y = (float)((bVar4 != 0) + 1); - if (bVar4 != 0) { - local_2d0.x = -10.0; - local_2d0.y = 10.0; - } - local_290.y = 0.0; - do { - fVar24 = local_290.y; - local_2b0.y = 10.0; - (GHIDRA_CAST((&shootDirection)))->Vector::__mul(&local_2e4,&local_2b0.y); - GetTearMovementInheritance(this,&local_2d8,&shootDirection,0); - local_2c4.y = 0.4; - pVVar7 = Vector::operator_mul(&local_2f4,&local_2c4.y,vector); - (GHIDRA_CAST((&local_2e4)))->Vector::operator_add_assign(pVVar7); - (GHIDRA_CAST((&local_2e4)))->Vector::Normalize(); - (GHIDRA_CAST((&local_2e4)))->Vector::Rotate((&local_2d0.x)[GHIDRA_INT(fVar24)]); - uVar9 = Random(); - tmpEntity = Game::Spawn(g_game,3,0xf0,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar9); - (GHIDRA_CAST((tmpEntity)))->Entity::ClearEntityFlags(4); - position_00.y = local_2e4.y; - position_00.x = local_2e4.x; - (GHIDRA_CAST((tmpEntity)))->Entity::SetTargetPosition(position_00); - FUN_005b18f0(1); - tmpEntity->Update(); - local_290.y = (float)(GHIDRA_INT(GHIDRA_CAST(local_290.y)) + 1); - } while (GHIDRA_UINT(local_290.y) < GHIDRA_UINT(local_2bc.y)); - play_sound_with_fart_seed(0x1ee,1.0,2,0,1.0); -LAB_0077ed69: - this->_itemStateCooldown = 5; - DischargeActiveItem(this,0,0); -LAB_0077ed7e: - this->_blinkTime = 1; - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - goto switchD_0077f19d_caseD_2c5; - } - break; - case 0x2d9: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::SetLastFrame(); - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar4 == 0) && ((uint8_t)local_284 != 0)) { - local_2b0.y = 10.0; - (GHIDRA_CAST((&shootDirection)))->Vector::__mul(&local_2d0,&local_2b0.y); - GetTearMovementInheritance(this,&local_2d8,&shootDirection,0); - local_2b0.y = 0.4; - pVVar7 = Vector::operator_mul(&local_2f4,&local_2b0.y,vector_00); - (GHIDRA_CAST((&local_2d0)))->Vector::operator_add_assign(pVVar7); - uVar9 = Random(); - tmpEntity = Game::Spawn(g_game,3,0xf3,&this->_pos,&g_vectorZero,GHIDRA_CAST(local_294),0,uVar9); - (GHIDRA_CAST((tmpEntity)))->Entity::ClearEntityFlags(4); - (GHIDRA_CAST((tmpEntity)))->Entity::AddEntityFlags(0x400000000000000); - pVVar7 = (GHIDRA_CAST((&local_300)))->Vector::Vector(-24.0,-7.0); - (GHIDRA_CAST((tmpEntity)))->Entity::SetTargetPosition(*pVVar7); - (GHIDRA_CAST((tmpEntity)))->Entity::SetVelocity(&local_2d0); - FUN_005b18f0(1); - tmpEntity->Update(); - uVar9 = Random(); - local_2b0.y = 0.35; - pVVar7 = (GHIDRA_CAST((&local_2d0)))->Vector::__mul(&local_2d8,&local_2b0.y); - tmpEntity = Game::Spawn(g_game,1000,2,&this->_pos,pVVar7,GHIDRA_CAST(0x0),2,uVar9); - tmpEntity->Update(); - (GHIDRA_CAST((GHIDRA_CAST(local_2e4.y))))->TemporaryEffects::AddCollectibleEffect(0x2d9,1,2); - this = local_294; - play_sound_with_fart_seed(0x417,1.0,2,0,1.0); - goto LAB_0077ed69; - } - } -LAB_0077fc4f: - piVar14 = &this->_blinkTime; -LAB_0077fc55: - effect = GHIDRA_CAST(this->_luck); - if (this->_luck == (float)local_2b4) { - this->_luck = local_29c.y; - effect = GHIDRA_CAST(local_29c.y); - } - if ((((uint8_t)local_284 == 0) && (*piVar14 < 0)) && (this->_headDirectionTime < 0)) { - FUN_00420ae0(); - cVar5 = FUN_0082ee30(); - if (cVar5 == '\0') { - iVar19 = this->_moveDirection; - GetBodyMoveDirection(this,&local_2d8); - bVar4 = (GHIDRA_CAST((this_03)))->Vector::operator_ne(&g_vectorZero); - if (bVar4 != 0) { - GetBodyMoveDirection(this,&local_2d8); - iVar19 = vector_to_direction(vec); - } - switch(iVar19) { - case 0: - SimpleString::operator=(GHIDRA_CAST(&this->_headAnim),"HeadLeft"); - this->_headDirection = 0; - break; - case 1: - SimpleString::operator=(GHIDRA_CAST(&this->_headAnim),"HeadUp"); - this->_headDirection = 1; - break; - case 2: - SimpleString::operator=(GHIDRA_CAST(&this->_headAnim),"HeadRight"); - this->_headDirection = 2; - break; - default: - SimpleString::operator=(GHIDRA_CAST(&this->_headAnim),"HeadDown"); - this->_headDirection = 3; - } - } - } - bVar4 = IsFullSpriteRendering(this); - if (bVar4 == 0) { - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - bVar4 = HasCollectible(this,0x2ab,0); - if ((bVar4 != 0) && - ((iVar19 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetOverlayFrame(), iVar19 == 0 && - (8 < GHIDRA_INT(local_2a8))))) { - local_29c.y = (this->_posOffset).y; - (GHIDRA_CAST((&particleColor)))->Color::Color(); - fVar24 = random_float(); - Game::SpawnParticles(g_game,&this->_pos,0x23,1,fVar24 * 3.0 + 2.0,color,local_29c.y,1); - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetOverlayFrame(&this->_headAnim,local_2dc); - local_294 = GHIDRA_CAST(&this->_playerCostumeMap[0]._isBodyLayer); - local_290.y = 2.10195e-44; - do { - if ((((-1 < (GHIDRA_CAST((GHIDRA_INT(local_294) + -0xc)))->_index) && - (*GHIDRA_CAST(local_294) == 0)) && - (this_04 = GHIDRA_CAST(FUN_005cbd10((GHIDRA_CAST((GHIDRA_INT(local_294) + -0xc)))->_index)) - , this_04[1]._filename._buf[8] == '\0')) && - (iVar19 = FUN_0040bcb0(&this->_headAnim), iVar19 != 0)) { - if (*GHIDRA_CAST((iVar19 + 0x34)) == '\0') { - if (GHIDRA_INT(local_2a8) < 9) { - uVar29 = FUN_00421620("_Idle"); - local_8 = 0xb; - cleanupFlags = GHIDRA_CAST((GHIDRA_UINT(cleanupFlags) | 1)); - local_29c.y = (float)cleanupFlags; - iVar19 = FUN_0040bcb0(uVar29); - local_286 = '\x01'; - if (iVar19 == 0) goto LAB_0077ff13; - } - else { -LAB_0077ff13: - local_286 = '\0'; - } - local_8 = 0xffffffff; - if ((GHIDRA_UINT(cleanupFlags) & 1) != 0) { - cleanupFlags = GHIDRA_CAST((GHIDRA_UINT(cleanupFlags) & 0xfffffffe)); - (GHIDRA_CAST((local_70 + 0x14)))->msvc::string::_Tidy_deallocate(); - } - if (local_286 == '\0') { - ANM2::SetFrame(GHIDRA_CAST(this_04),&this->_headAnim,local_2dc); - } - else { - animString = GHIDRA_CAST(FUN_00421620("_Idle")); - local_8 = 0xc; - (GHIDRA_CAST((this_04)))->Sprite::Play(animString,0); - local_8 = 0xffffffff; - (GHIDRA_CAST((local_70 + 0x14)))->msvc::string::_Tidy_deallocate(); - } - } - else { - (GHIDRA_CAST((this_04)))->Sprite::Play(&this->_headAnim,0); - costumeLayer = (GHIDRA_CAST((this_04)))->Sprite::GetLayer(*GHIDRA_CAST((GHIDRA_CAST(local_294) + -8))); - (costumeLayer->_pos).y = (float)GHIDRA_INT(local_2dc) * (costumeLayer->_size).y; - } - if (this_04[1]._filename._buf[10] != '\0') { - uVar29 = FUN_00421620("_Overlay"); - local_8 = 0xd; - local_29c.y = (float)FUN_0040bcb0(uVar29); - local_8 = 0xffffffff; - (GHIDRA_CAST((local_70 + 0x14)))->msvc::string::_Tidy_deallocate(); - if (GHIDRA_CAST(local_29c.y) != GHIDRA_CAST(0x0)) { - if ((char)*GHIDRA_CAST((GHIDRA_CAST(local_29c.y) + 0x34)) == '\0') { - animString = GHIDRA_CAST(FUN_00421620("_Overlay")); - local_8 = 0xf; - (GHIDRA_CAST((this_04)))->Sprite::SetOverlayFrame(animString,local_2dc); - pcVar13 = overlayAnimName; - } - else { - uVar29 = FUN_00421620("_Overlay"); - local_8 = 0xe; - Sprite::PlayOverlay(uVar29,0); - pcVar13 = local_a0; - } - local_8 = 0xffffffff; - (GHIDRA_CAST((pcVar13)))->msvc::string::_Tidy_deallocate(); - } - } - } - local_294 = GHIDRA_CAST((GHIDRA_INT(local_294) + 0x10)); - local_290.y = (float)(GHIDRA_INT(local_290.y) + -1); - } while (local_290.y != 0.0); - local_290.y = 0.0; - } - else { - uVar9 = 0; - ppvVar17 = this->_weapons + 1; - do { - if (*ppvVar17 != (void *)0x0) { - FUN_004e46b0(); - if (0.0 < (float)effect) goto LAB_007800b3; - ppvVar17 = local_2f8; - } - uVar9 = uVar9 + 1; - ppvVar17 = ppvVar17 + 1; - local_2f8 = ppvVar17; - } while (uVar9 < 4); - ANM2::SetFrame(&this->_sprite,&this->_headAnim,local_2dc); - } - } -LAB_007800b3: - bVar4 = IsExtraAnimationFinished(this); - if (bVar4 != 0) { - FUN_00428b50(); - cVar5 = FUN_0082ee30(); - if (((cVar5 == '\0') && (isInputAllowed != '\0')) && - (bVar4 = HasCollectible(this,0x170,0), bVar4 != 0)) { - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8))))) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8)))) + -1; - } - bVar4 = HasWeaponType(this,10); - if (bVar4 == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8)))) = 0; - } - else if ((((uint8_t)local_284 == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18ac)))) == -1)) || - (iVar19 = vector_to_direction(&shootDirection), iVar19 == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18ac))))) - ) { - iVar19 = FUN_00505ca0(); - if (0 < iVar19) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8)))) = 10; - } - if ((uint8_t)local_284 != 0) { - iVar19 = vector_to_direction(&shootDirection); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18ac)))) = iVar19; - } - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8)))) = 0xffffffff; - iVar19 = vector_to_direction(&shootDirection); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18ac)))) = iVar19; - } - iVar19 = vector_to_direction(&this->_aimDirection); - iVar18 = vector_to_direction(&shootDirection); - if ((iVar18 == iVar19) || - (bVar4 = (GHIDRA_CAST((&this->_aimDirection)))->Vector::operator_ne(&g_vectorZero), bVar4 == 0)) { - bVar22 = false; - } - else { - bVar22 = true; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8)))) < 0) || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18a8)))) == 0 && (((uint8_t)local_284 == 0 || (bVar22)))))) { - iVar19 = this->_fireBlockCooldown; - bVar22 = iVar19 == 0; - if (!bVar22) goto LAB_007802cb; - this->_cacheFlags = this->_cacheFlags | 2; - this->_epiphoraCharge = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18ac)))) = 0xffffffff; - EvaluateItems(this); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (((bVar4 != 0) && (isShooting != '\0')) && - (bVar4 = IsExtraAnimationFinished(this), bVar4 != 0)) { - FUN_00428b50(); - cVar5 = FUN_0082ee30(); - if (cVar5 == '\0') { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x4000); - trigger_fire_item_effects(this,&shootDirection,(uint8_t)local_284); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x4000); - } - } - } - else { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar4 == 0) && (this->_epiphoraCharge < 0xb4)) { - this->_cacheFlags = this->_cacheFlags | 2; - this->_epiphoraCharge = this->_epiphoraCharge + 1; - EvaluateItems(this); - } - } - } - } - iVar19 = this->_fireBlockCooldown; - bVar22 = iVar19 == 0; -LAB_007802cb: - if (bVar22 || iVar19 < 0) { - (GHIDRA_CAST((&this->_aimDirection)))->Vector::operator_assign(&shootDirection); - this->_areOpposingShootDirectionsPressed = isOpposingDirections; - if (isDirectionHeld == 0) { - msvc::deque::_Tidy(); - } - else { - (GHIDRA_CAST((&this->_lastDirection)))->Vector::operator_assign(&shootDirection); - FUN_007dc7b0(&shootDirection); - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1668)))))))->Room::GetGridHeight(); - while (3 < uVar9) { - FUN_00499560(); - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1668)))))))->Room::GetGridHeight(); - } - } - } - ExceptionList = local_10; - return; -} - -// 00780560 -BitSet128 * Entity_Player::GetBombFlags(BitSet128 *outFlags, uint8_t isRollChances) -{ - uint8_t isHasCollectible; - uint32_t uVar1; - int iVar2; - int iVar3; - uint32_t uVar4; - uint32_t uVar5; - bool bVar6; - bool bVar7; - uint32_t flagsLowHiWord; - BitSet128 nancyBombFlags [16]; - uint64_t flagsHigh; - uint32_t *flagsWord; - - *GHIDRA_CAST(&outFlags->_l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)) = 0; - *GHIDRA_CAST(&outFlags->_h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)) = 0; - isHasCollectible = HasCollectible(this,0x7d,0); - if (isHasCollectible != 0) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagHoming._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagHoming._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x8c,0); - if (isHasCollectible != 0) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagPoison._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagPoison._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0xd1,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 0x12 - GHIDRA_INT((this->_luck * -3.0)))))) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagButtBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagButtBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagButtBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagButtBomb._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x100,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 0x19 - GHIDRA_INT((this->_luck * -6.0)))))) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagBurn._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagBurn._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0xdc,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 10 - GHIDRA_INT((this->_luck * -3.0)))))) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagSadBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSadBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagSadBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSadBomb._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x16e,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 0x21 - GHIDRA_INT((this->_luck * -8.0)))))) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagScatterBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagScatterBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagScatterBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagScatterBomb._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x16f,0); - if (isHasCollectible != 0) { - uVar4 = GHIDRA_UINT(g_tearFlagSticky._l) | GHIDRA_UINT(g_tearFlagEgg._l); - uVar1 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSticky._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagEgg._l)) + 0x4))); - uVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSticky._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagEgg._h)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagSticky._h) | GHIDRA_UINT(g_tearFlagEgg._h) - ; - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | uVar4; - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | uVar1; - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | uVar5; - } - isHasCollectible = HasCollectible(this,0x1b0,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 10 - GHIDRA_INT((this->_luck * -3.0)))))) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagGlitterBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlitterBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagGlitterBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlitterBomb._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x13b,0); - if (isHasCollectible != 0) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagAttractor._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAttractor._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagAttractor._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAttractor._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x161,0); - if (isHasCollectible != 0) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagCrossBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCrossBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagCrossBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCrossBomb._h)) + 0x4))); - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x47)) { - iVar3 = GetTrinketMultiplier(this,0x47); - bVar7 = false; - bVar6 = iVar3 == 0; -LAB_007808cb: - if (bVar6 || bVar7 != iVar3 < 0) { - flagsLowHiWord = *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - goto LAB_00780901; - } - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x47); - bVar7 = SBORROW4(iVar2,1); - iVar3 = iVar2 + -1; - bVar6 = iVar2 == 1; - goto LAB_007808cb; - } - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagCreepTrail._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCreepTrail._l)) + 0x4))); - flagsLowHiWord = *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagCreepTrail._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCreepTrail._h)) + 0x4))); -LAB_00780901: - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - flagsHigh = outFlags->_h; - if ((this->_hasGoldenBomb != 0) && (isRollChances == 0)) { - uVar4 = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagGoldenBomb._l); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGoldenBomb._l)) + 0x4))) | flagsLowHiWord; - *GHIDRA_CAST(&outFlags->_l) = uVar4; - uVar1 = uVar1 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGoldenBomb._h)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(flagsHigh) | GHIDRA_UINT(g_tearFlagGoldenBomb._h); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)) = uVar1; - } - isHasCollectible = HasCollectible(this,0x205,0); - if ((isHasCollectible != 0) && (isRollChances == 0)) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagFastBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFastBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagFastBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFastBomb._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x266,0); - if (isHasCollectible != 0) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagBloodBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBloodBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagBloodBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBloodBomb._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x286,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 10 - GHIDRA_INT((this->_luck * -3.0)))))) { - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagBrimstoneBomb._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBrimstoneBomb._l)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(g_tearFlagBrimstoneBomb._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBrimstoneBomb._h)) + 0x4))); - } - isHasCollectible = HasCollectible(this,0x2d7,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 0x21 - GHIDRA_INT((this->_luck * -8.0)))))) { - uVar5 = GHIDRA_UINT(g_tearFlagGhostBomb._h) | GHIDRA_UINT(g_tearFlagSpectral._h); - uVar1 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGhostBomb._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGhostBomb._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))); - *GHIDRA_CAST(&outFlags->_l) = - GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagGhostBomb._l) | GHIDRA_UINT(g_tearFlagSpectral._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | uVar1; - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | uVar5; - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | uVar4; - } - isHasCollectible = HasCollectible(this,0x233,0); - if ((isHasCollectible != 0) && - ((isRollChances == 0 || - (uVar1 = Random(), GHIDRA_INT((uVar1 % 100)) <= 0x32 - GHIDRA_INT((this->_luck * -8.0)))))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagHoming._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagHoming._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[1]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagPoison._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[1]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[1]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagPoison._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[1]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[2]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagButtBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[2]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagButtBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[2]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagButtBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[2]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagButtBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[3]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagBurn._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[3]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[3]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagBurn._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[3]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[4]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagSadBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[4]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSadBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[4]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagSadBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[4]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSadBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[5]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagScatterBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[5]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagScatterBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[5]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagScatterBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[6]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSticky._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagEgg._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[5]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagScatterBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[6]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagSticky._l) | GHIDRA_UINT(g_tearFlagEgg._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[6]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagSticky._h) | GHIDRA_UINT(g_tearFlagEgg._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[6]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSticky._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagEgg._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[7]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagGlitterBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[7]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlitterBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[7]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagGlitterBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[7]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlitterBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[8]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagAttractor._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[8]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAttractor._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[8]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagAttractor._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[8]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAttractor._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[9]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagCrossBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[9]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCrossBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[9]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagCrossBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[9]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCrossBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[10]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagCreepTrail._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[10]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCreepTrail._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[10]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagCreepTrail._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[10]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCreepTrail._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xb]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagGoldenBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xb]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGoldenBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xb]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagGoldenBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xb]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGoldenBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xc]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagFastBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xc]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFastBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xc]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagFastBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xc]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFastBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xd]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagBloodBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xd]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBloodBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xd]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagBloodBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xd]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBloodBomb._h)) + 0x4))); - uVar1 = GHIDRA_UINT((15.0 - this->_luck)); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xe]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagBrimstoneBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xe]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBrimstoneBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xe]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagBrimstoneBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xe]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBrimstoneBomb._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xf]._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagGhostBomb._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xf]._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGhostBomb._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xf]._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagGhostBomb._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(nancyBombFlags[0xf]._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGhostBomb._h)) + 0x4))); - if (uVar1 == 0) { - uVar4 = 0; - } - else { - uVar4 = Random(); - uVar4 = uVar4 % uVar1; - } - iVar3 = (GHIDRA_INT(uVar4) < 5) + 2; - if (2 < GHIDRA_INT(uVar4)) { - iVar3 = (GHIDRA_INT(uVar4) < 5) + 1; - } - iVar2 = iVar3 + 1; - if (uVar4 != 0) { - iVar2 = iVar3; - } - do { - uVar1 = Random(); - uVar1 = uVar1 & 0xf; - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(nancyBombFlags[uVar1]._l); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - *flagsWord = *flagsWord | *GHIDRA_CAST((GHIDRA_INT(&nancyBombFlags[uVar1]._l) + 4)); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(outFlags->_h) | GHIDRA_UINT(nancyBombFlags[uVar1]._h); - flagsWord = GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *flagsWord = *flagsWord | *GHIDRA_CAST((GHIDRA_INT(&nancyBombFlags[uVar1]._h) + 4)); - iVar2 = iVar2 + -1; - } while (iVar2 != 0); - } - uVar1 = GHIDRA_UINT(outFlags->_l); - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); - if (((uVar1 & GHIDRA_UINT(g_tearFlagGhostBomb._l)) != 0 || (uVar4 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGhostBomb._l)) + 0x4)))) != 0) - || ((GHIDRA_UINT(outFlags->_h) & GHIDRA_UINT(g_tearFlagGhostBomb._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGhostBomb._h)) + 0x4)))) != 0)) { - uVar4 = uVar4 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))); - flagsHigh = outFlags->_h; - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)); - *GHIDRA_CAST(&outFlags->_l) = uVar1 | GHIDRA_UINT(g_tearFlagSpectral._l); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)) = uVar4; - uVar5 = uVar5 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))); - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_UINT(flagsHigh) | GHIDRA_UINT(g_tearFlagSpectral._h); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)) = uVar5; - } - return outFlags; -} - -// 00780eb0 -uint32_t Entity_Player::GetBombVariant() -{ - return 0; -} - -// 00780ec0 -float Entity_Player::check_bomb_tearflags(BitSet128 tearFlags) -{ - uint8_t isHasCollectible; - - isHasCollectible = HasCollectible(this,0x6a,0); - if (isHasCollectible == 0) { - if (((GHIDRA_UINT(tearFlags._l) & GHIDRA_UINT(g_tearFlagPersistent._l)) == 0 && - ((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPersistent._l)) + 0x4))) & (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4)))) == 0) && - ((GHIDRA_UINT(tearFlags._h) & GHIDRA_UINT(g_tearFlagPersistent._h)) == 0 && - ((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPersistent._h)) + 0x4))) & (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4)))) == 0)) { - isHasCollectible = HasCollectible(this,0x1a4,0); - if (isHasCollectible == 0) { - return 1.0; - } - } - } - return 1.5; -} - -// 00780f40 -void Entity_Player::update_bomb_input() -{ - BitSet128 tearFlags; - uint32_t uVar1; - uint32_t uVar2; - uint32_t uVar3; - uint8_t bVar4; - char isDamaged; - undefined3 extraout_var; - EntityRef *sourceRef; - float *extraout_EAX; - uint32_t rngResult; - Entity *pEVar5; - int iVar6; - Entity_Player *self; - int iVar7; - int *gigaBombsLeft; - uint32_t extraout_EDX; - uint32_t rngResult; - Manager *manager; - bool bVar9; - bool bVar10; - float fVar11; - float fVar12; - float fVar13; - float bombRadius; - uint32_t damageAmount; - float fVar14; - float fStack_d0; - char isPartnerGigaBomb; - char isRocket; - uint8_t isFreeBomb; - undefined3 uStack_c7; - float fStack_c4; - Entity *pEStack_c0; - float fStack_bc; - Vector launchVelocity; - int bombIndex; - uint32_t bombVariant; - int bombCount; - float bombScale; - Vector aimDir; - Vector bombVelocity; - Vector inheritedVelocity; - BitSet128 bombFlags; - BitSet128 bombFlagsCopy; - EntityRef damageSource; - Game *game; - bool isGigaBomb; - uint8_t lerpT [16]; - Entity_Player *partnerPlayer; - code *takeDamageFn; - - if (((this->_isCoopGhost == 0) && (bVar4 = IsHologram(this), bVar4 == 0)) && - (this->_playerType != 0x28)) { - if (this->_playerType == 0x19) { - if (((this->_isControlsEnabled != 0) && (this->_controlsCooldown < 1)) && - ((bVar4 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::HasEntityFlags(0x800), bVar4 == 0 && - ((bVar4 = input_is_action_triggered(g_manager,8,this->_controllerIndex,GHIDRA_CAST(this),0), - bVar4 != 0 && - (this->_lastActionTriggers = this->_lastActionTriggers | 1, 0 < this->_poopMana)))))) { - UsePoopSpell(this,this->_poopSpellQueue[0]); - this->_poopSpellQueue[0] = this->_poopSpellQueue[1]; - this->_poopSpellQueue[1] = this->_poopSpellQueue[2]; - this->_poopSpellQueue[2] = this->_poopSpellQueue[3]; - this->_poopSpellQueue[3] = this->_poopSpellQueue[4]; - this->_poopSpellQueue[4] = this->_poopSpellQueue[5]; - this->_poopSpellQueue[5] = 0; - poop_spell_roll(this); - AddPoopMana(this,-1); - return; - } - } - else { - iVar7 = this->_bombPlaceDelay; - if (iVar7 < 1) { - bVar4 = AreControlsEnabled(self); - if (((bVar4 != 0) && (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x800), bVar4 == 0)) && - (bVar4 = input_is_action_triggered(g_manager,8,this->_controllerIndex,GHIDRA_CAST(this),0), - bVar4 != 0)) { - this->_lastActionTriggers = this->_lastActionTriggers | 1; - isFreeBomb = this->_hasGoldenBomb; - partnerPlayer = GHIDRA_CAST(this->_twinPlayer); - isGigaBomb = 0 < this->_numGigaBombs; - isPartnerGigaBomb = '\0'; - uStack_c7 = extraout_var; - if (partnerPlayer != GHIDRA_CAST(0x0)) { - bVar4 = HasCollectible(partnerPlayer,0x205,0); - iVar7 = 0x1e; - if (bVar4 != 0) { - iVar7 = 1; - } - if ((partnerPlayer->_bombPlaceDelay == iVar7) && - (isFreeBomb = 1, (*GHIDRA_CAST((GHIDRA_CAST((partnerPlayer)) + 0x1dd8))) != '\0')) { - isGigaBomb = true; - isPartnerGigaBomb = '\x01'; - } - } - partnerPlayer = GHIDRA_CAST(this->_parent); - if ((partnerPlayer != GHIDRA_CAST(0x0)) && (partnerPlayer->_type == 1)) { - bVar4 = HasCollectible(partnerPlayer,0x205,0); - iVar7 = 0x1e; - if (bVar4 != 0) { - iVar7 = 1; - } - if (partnerPlayer->_bombPlaceDelay == iVar7) { - isFreeBomb = 1; - uStack_c7 = 0; - if ((*GHIDRA_CAST((GHIDRA_CAST((partnerPlayer)) + 0x1dd8))) != '\0') { - isGigaBomb = true; - isPartnerGigaBomb = '\x01'; - } - } - } - if (((this->_numBombs < 1) && (isFreeBomb == 0)) && (this->_bombPlaceDelay < 1)) { - bVar4 = HasCollectible(this,0x266,0); - game = g_game; - if (bVar4 != 0) { - if ((this->_playerType == 0x24) && (0 < this->_effectiveBloodCharge)) { - AddBloodCharge(this,-1); - isFreeBomb = 1; - uStack_c7 = 0; - } - else { - this->_damageCooldown = 0; - takeDamageFn = *(code **)(*GHIDRA_CAST(this) + 0x20); - if (*GHIDRA_CAST(&game->_deathmatchManager) < 2) { - sourceRef = (GHIDRA_CAST((&damageSource)))->EntityRef::EntityRef(); - damageAmount = 0x3f800000; - rngResult = 0; - } - else { - damageAmount = 0x41000000; - sourceRef = (GHIDRA_CAST((&damageSource)))->EntityRef::EntityRef(); - rngResult = extraout_EDX; - } - isDamaged = (*takeDamageFn)(damageAmount,0x42820,rngResult,sourceRef,0x1e); - if (isDamaged != '\0') { - isFreeBomb = 1; - } - uStack_c7 = 0; - } - } - } - if (((0 < this->_numBombs) || (isFreeBomb != 0)) && (this->_bombPlaceDelay < 1)) { - bVar4 = HasCollectible(this,0x205,0); - game = g_game; - iVar7 = 0x1e; - if (bVar4 != 0) { - iVar7 = 1; - } - this->_bombPlaceDelay = iVar7; - if ((1 < *GHIDRA_CAST(&game->_deathmatchManager)) && - (iVar7 = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_deathmatchManager))) + 0xc)))) + 4))(), - iVar7 == 3)) { - this->_bombPlaceDelay = 0xf; - } - bombCount = 1; - bVar4 = HasTrinket(this,0xa4,0); - if (bVar4 != 0) { - bombCount = GetTrinketMultiplier(this,0xa4); - bombCount = bombCount + 1; - } - bombIndex = 0; - if (0 < bombCount) { - do { - GetBombFlags(this,&bombFlags,0); - uVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(bombFlags._h)) + 0x4))); - uVar2 = GHIDRA_UINT(bombFlags._h); - bombRadius = (*GHIDRA_CAST((GHIDRA_CAST(&(bombFlags._l)) + 0x4))); - uVar1 = GHIDRA_UINT(bombFlags._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(bombFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = GHIDRA_UINT(bombFlags._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = GHIDRA_UINT(bombFlags._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(bombFlags._h)) + 0x4))); - bombScale = check_bomb_tearflags(this,tearFlags); - launchVelocity.x = (this->_velocity).x * 0.1; - launchVelocity.y = (this->_velocity).y * 0.1; - bombVelocity.x = launchVelocity.x; - bombVelocity.y = launchVelocity.y; - bVar4 = HasCollectible(this,0x247,0); - if (bVar4 == 0) { -LAB_00781520: - iVar7 = 0; - bombVariant = 0; - isRocket = '\0'; - fStack_d0 = 0.0; - if (isGigaBomb) { -LAB_00781539: - bombScale = 1.0; - bombVariant = 0x11; - if (iVar7 == 0x13) { - bombVariant = 0x14; - } - } - } - else { - fStack_c4 = 0.0; - pEStack_c0 = GHIDRA_CAST(0x0); - if ((this->_fireDirection != -1) && - ((pEVar5 = GHIDRA_CAST((this->_aimDirection).x), (float)pEVar5 != g_vectorZero.x - || ((this->_aimDirection).y != g_vectorZero.y)))) { - fStack_c4 = (this->_aimDirection).y; - pEStack_c0 = pEVar5; - } - if (((float)pEStack_c0 == g_vectorZero.x) && (fStack_c4 == g_vectorZero.y)) - goto LAB_00781520; - aimDir.x = (float)pEStack_c0; - aimDir.y = fStack_c4; - fVar11 = sqrtf((float)pEStack_c0 * (float)pEStack_c0 + fStack_c4 * fStack_c4); - if (0.0 < fVar11) { - pEStack_c0 = GHIDRA_CAST(((float)pEStack_c0 * (1.0 / fVar11))); - fStack_c4 = fStack_c4 * (1.0 / fVar11); - aimDir.x = (float)pEStack_c0; - aimDir.y = fStack_c4; - } - GetTearMovementInheritance(this,&inheritedVelocity,&aimDir,0); - launchVelocity.x = (float)pEStack_c0 * 10.0 + *extraout_EAX; - launchVelocity.y = fStack_c4 * 10.0 + extraout_EAX[1]; - bombVelocity.x = launchVelocity.x; - bombVelocity.y = launchVelocity.y; - fStack_d0 = atan2f(fStack_c4,(float)pEStack_c0); - iVar7 = 0x13; - fStack_d0 = fStack_d0 * 57.295776; - bombVariant = 0x13; - isRocket = '\x01'; - if (isGigaBomb) { - (this->_velocity).x = (this->_velocity).x - (float)pEStack_c0 * 5.0; - (this->_velocity).y = (this->_velocity).y - fStack_c4 * 5.0; - goto LAB_00781539; - } - } - rngResult = Random(); - pEVar5 = Game::SpawnEx(g_game,4,bombVariant,&this->_pos,&bombVelocity,GHIDRA_CAST(this) - ,0,rngResult,0); - pEStack_c0 = pEVar5; - if (1 < bombCount) { - if (isRocket == '\0') { - rngResult = Random(); - fStack_bc = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - fStack_bc = fStack_bc + fStack_bc; - fVar13 = cos(fStack_bc); - fVar11 = (this->_pos).x; - fVar14 = sin(fStack_bc); - fVar12 = (this->_pos).y; - (pEVar5->_pos).x = fVar13 * 8.0 + fVar11; - (pEVar5->_pos).y = fVar14 * 8.0 + fVar12; - } - else { - fVar11 = sqrtf(launchVelocity.x * launchVelocity.x + - launchVelocity.y * launchVelocity.y); - if (0.0 < fVar11) { - launchVelocity.x = launchVelocity.x * (1.0 / fVar11); - launchVelocity.y = launchVelocity.y * (1.0 / fVar11); - } - fVar12 = launchVelocity.x * 80.0; - fVar11 = (this->_pos).x; - fStack_c4 = (float)bombCount * 3.0; - fStack_bc = (this->_pos).y - launchVelocity.y * 80.0; - fVar13 = -fStack_c4; - if ((float)(bombCount + -1) == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); - } - fVar14 = ((float)bombIndex - 0.0) / ((float)(bombCount + -1) - 0.0); - lerpT = ZEXT416(GHIDRA_UINT(fVar14)); - if (fVar14 <= 0.0) { - lerpT = ZEXT816(0); - } - if (1.0 <= (*GHIDRA_CAST((GHIDRA_CAST(&(lerpT)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(lerpT)) + 0x0))) = 0x3f800000; - } - fStack_c4 = ((fStack_c4 - fVar13) * (*GHIDRA_CAST((GHIDRA_CAST(&(lerpT)) + 0x0))) + fVar13) * 0.017453292; - fVar13 = cos(fStack_c4); - fVar14 = sin(fStack_c4); - (pEVar5->_pos).y = - (launchVelocity.x * fVar14 + launchVelocity.y * fVar13) * 80.0 + fStack_bc; - (pEVar5->_pos).x = - (launchVelocity.x * fVar13 - launchVelocity.y * fVar14) * 80.0 + - (fVar11 - fVar12); - } - } - pEVar5[1]._collisionIndex = GHIDRA_INT(bombScale); - *GHIDRA_CAST(&pEVar5[1]._pendingDamageFlags) = fStack_d0; - pEVar5[1]._type = uVar1; - pEVar5[1]._variant = GHIDRA_INT(bombRadius); - pEVar5[1]._subtype = uVar2; - pEVar5[1]._spawnerType = uVar3; - pEVar5[1]._sprite._filename._buf[0xb] = '\x01'; - manager = g_manager; - fStack_bc = (float)(uVar3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlitterBomb._h)) + 0x4)))); - fStack_c4 = bombRadius; - if (((uVar1 & GHIDRA_UINT(g_tearFlagGlitterBomb._l)) != 0 || - (GHIDRA_UINT(bombRadius) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlitterBomb._l)) + 0x4)))) != 0) || - ((uVar2 & GHIDRA_UINT(g_tearFlagGlitterBomb._h)) != 0 || fStack_bc != 0.0)) { - fStack_d0 = 1.21493e-42; - seed_fart_sound_override(GHIDRA_CAST(&fStack_d0)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(fStack_d0),1.0,2,0,1.0,0.0); - pEVar5 = pEStack_c0; - } - if (1.5 <= bombScale) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x8)))) + 85.0; - } - if (isGigaBomb) { - if ((pEVar5->_sprite)._animState._animData != (void *)0x0) { - AnimationState::AdvancePosition - (&(pEVar5->_sprite)._animState, - *GHIDRA_CAST((GHIDRA_INT((pEVar5->_sprite)._animState._animData) + 0x30)) + -1); - } - *GHIDRA_CAST((pEVar5 + 1)) = 0x2d; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x4)))) = 0x2d; - } - if (bombIndex == 0) { - if (isPartnerGigaBomb == '\0') { - fStack_bc = (float)(this->_numGigaBombs - 1); - gigaBombsLeft = GHIDRA_CAST(&fStack_bc); - if (this->_numBombs <= GHIDRA_INT(fStack_bc)) { - gigaBombsLeft = &this->_numBombs; - } - iVar7 = 0; - if (0 < *gigaBombsLeft) { - iVar7 = *gigaBombsLeft; - } - this->_numGigaBombs = iVar7; - ConsumableCountChanged(this,0x40); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - } - if (isFreeBomb == 0) { - iVar6 = this->_numBombs + -1; - iVar7 = 99; - if (iVar6 < 99) { - iVar7 = iVar6; - } - iVar6 = 0; - if (0 < iVar7) { - iVar6 = iVar7; - } - this->_numBombs = iVar6; - ConsumableCountChanged(this,4); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x85)) { - iVar7 = GetTrinketMultiplier(this,0x85); - bVar10 = false; - bVar9 = iVar7 == 0; -LAB_007819da: - if (!bVar9 && bVar10 == iVar7 < 0) goto LAB_007819e1; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar6 = GetTrinketMultiplier(this,0x85); - bVar10 = SBORROW4(iVar6,1); - iVar7 = iVar6 + -1; - bVar9 = iVar6 == 1; - goto LAB_007819da; - } -LAB_007819e1: - *GHIDRA_CAST((pEVar5 + 1)) = 0x16; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x4)))) = 0x16; - iVar7 = GetTrinketMultiplier(this,0x85); - if (iVar7 == 1) { - bombRadius = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x8)))) + 15.000001; - } - else if (iVar7 == 2) { - bombRadius = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x8)))) + 30.000002; - } - else { - if (iVar7 != 3) goto LAB_00781a4c; - bombRadius = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x8)))) + 50.0; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar5[1])) + 0x8)))) = bombRadius; - } -LAB_00781a4c: - if (((uVar1 & GHIDRA_UINT(g_tearFlagFastBomb._l)) != 0 || - (GHIDRA_UINT(fStack_c4) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFastBomb._l)) + 0x4)))) != 0) || - ((uVar2 & GHIDRA_UINT(g_tearFlagFastBomb._h)) != 0 || - (uVar3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFastBomb._h)) + 0x4)))) != 0)) { - rngResult = *GHIDRA_CAST((GHIDRA_INT(&pEStack_c0->_flags) + 4)); - *GHIDRA_CAST(&pEStack_c0->_flags) = GHIDRA_UINT(pEStack_c0->_flags) | 0x4000000; - *GHIDRA_CAST((GHIDRA_INT(&pEStack_c0->_flags) + 4)) = rngResult; - } - manager = g_manager; - if (bombIndex == 0) { - if (isRocket == '\0') { - fStack_d0 = 5.60519e-44; -LAB_00781b30: - seed_fart_sound_override(GHIDRA_CAST(&fStack_d0)); - bombRadius = 1.0; - } - else { - if (bombVariant != 0x14) { - fStack_d0 = 7.52497e-43; - goto LAB_00781b30; - } - fStack_d0 = 6.75426e-43; - seed_fart_sound_override(GHIDRA_CAST(&fStack_d0)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(fStack_d0),1.0,4,0,1.0,0.0); - manager = g_manager; - fStack_d0 = 7.52497e-43; - seed_fart_sound_override(GHIDRA_CAST(&fStack_d0)); - bombRadius = 0.8; - } - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(fStack_d0),1.0,4,0,bombRadius,0.0); - } - pEStack_c0->Update(); - bombIndex = bombIndex + 1; - } while (bombIndex < bombCount); - } - } - } - } - else { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::HasEntityFlags(0x4000); - if (bVar4 == 0) { - this->_bombPlaceDelay = iVar7 + -1; - return; - } - } - } - } - return; -} - -// 00782630 -void Entity_Player::GetFlyingOffset(Vector *outOffset) -{ - float zeroX; - - zeroX = g_vectorZero.x; - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - outOffset->y = g_vectorZero.y; - outOffset->x = zeroX; - return; - } - if (this->_canFly == 0) { - outOffset->y = g_vectorZero.y; - outOffset->x = zeroX; - return; - } - outOffset->y = -4.0; - outOffset->x = 0.0; - return; -} - -// 007826d0 -void Entity_Player::trigger_fire_item_effects(Vector *direction, uint8_t isShotFired) -{ - char isLocalPlayer; - uint8_t bVar1; - uint32_t uVar2; - Entity *deadToothRing; - uint32_t isInputDisabledArg; - int remaining; - void **weaponSlot; - float ringScaleY; - undefined3 in_stack_00000009; - Entity_Player *apEStack_c [2]; - uint8_t *deadToothRingRef; - Game *game; - uint32_t *parentRef; - code *weaponFireFn; - - apEStack_c[0] = this; - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || - (isLocalPlayer = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 0x48))(this), - isLocalPlayer != '\0')) { - bVar1 = HasCollectible(this,0x1be,0); - if ((bVar1 != 0) && - ((isShotFired != 0 && - (deadToothRingRef = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1438))), *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1438)))) == 0)))) { - uVar2 = Random(); - deadToothRing = - Game::SpawnEx(g_game,1000,0x6a,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar2,0); - ringScaleY = g_vectorOne.y * 0.8; - (deadToothRing->_sprite)._scale.x = g_vectorOne.x * 0.8; - (deadToothRing->_sprite)._scale.y = ringScaleY; - if (*GHIDRA_CAST(deadToothRingRef) != 0) { - apEStack_c[0] = GHIDRA_CAST(deadToothRingRef); - msvc::multiset::erase(apEStack_c); - } - *GHIDRA_CAST(deadToothRingRef) = deadToothRing; - if (deadToothRing != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(deadToothRingRef); - } - parentRef = &deadToothRing->_parent; - if (deadToothRing->_parent != 0) { - apEStack_c[0] = GHIDRA_CAST(parentRef); - msvc::multiset::erase(apEStack_c); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - deadToothRing->Update(); - } - bVar1 = HasCollectible(this,0x1f6,0); - game = g_game; - if ((((bVar1 != 0) && (isShotFired != 0)) && ((this->_flags & 0x4000) == 0)) && - (((bVar1 = Game::IsPaused(g_game), bVar1 == 0 && (game->_frameCount % 0x1e == 0)) && - (uVar2 = Random(), uVar2 % 3 == 0)))) { - DoZitEffect(this,direction); - } - if (this->_weapons[0] != GHIDRA_CAST(0x0)) { - weaponFireFn = *(code **)(*GHIDRA_CAST(this->_weapons[0]) + 0xc); - uVar2 = GHIDRA_UINT(this->_flags) & 0x4000; - if (uVar2 == 0) { - (*weaponFireFn)(direction,_isShotFired,0); - return; - } - (*weaponFireFn)(direction,_isShotFired,CONCAT31((int3)(uVar2 >> 8),1)); - return; - } - weaponSlot = this->_weapons; - remaining = 4; - do { - weaponSlot = weaponSlot + 1; - if (*weaponSlot != GHIDRA_CAST(0x0)) { - apEStack_c[0] = *GHIDRA_CAST((*GHIDRA_CAST(*weaponSlot) + 0xc)); - uVar2 = GHIDRA_UINT(this->_flags) & 0x4000; - if (uVar2 == 0) { - isInputDisabledArg = 0; - } - else { - isInputDisabledArg = CONCAT31((int3)(uVar2 >> 8),1); - } - (*(code *)apEStack_c[0])(direction,_isShotFired,isInputDisabledArg); - } - remaining = remaining + -1; - } while (remaining != 0); - } - return; -} - -// 007828f0 -uint8_t * Entity_Player::GetDeathAnimName() -{ - uint8_t isLostCurse; - int effectNum; - char *animName; - int playerType; - - playerType = this->_playerType; - if ((((playerType != 10) && (playerType != 0x1f)) && (playerType != 0x27)) && - ((playerType != 0x28 && (playerType != 0x11)))) { - effectNum = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x2a5); - if (effectNum != 1) { - effectNum = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetNullEffectNum(0x65); - if (effectNum != 1) { - isLostCurse = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x70); - if (((isLostCurse == 0) && ((this->_variant != 1 || (this->_babySkin != 0x3b)))) && - (this->_isCoopGhost == 0)) { - if (playerType == 0x23) { - return GHIDRA_CAST("ForgottenDeath"); - } - animName = "HoleDeath"; - if (this->_pitfallState == 0) { - animName = "Death"; - } - return GHIDRA_CAST(animName); - } - } - } - } - return GHIDRA_CAST("LostDeath"); -} - -// 00782a40 -Entity * Entity_Player::GetActiveWeaponEntity() -{ - Entity *weaponEntity; - int *weapon; - - weapon = this->_weapons[0]; - if ((weapon == GHIDRA_CAST(0x0)) && (weapon = this->_weapons[1], weapon == GHIDRA_CAST(0x0))) { - return GHIDRA_CAST(0x0); - } - /* WARNING: Could not recover jumptable at 0x00782a58. Too many branches */ - /* WARNING: Treating indirect jump as call */ - weaponEntity = GHIDRA_CAST((**(code **)(*weapon + 0x28))()); - return weaponEntity; -} - -// 00782a60 -uint32_t Entity_Player::CanTurnHead() -{ - return GHIDRA_UINT(this->_headDirectionTime) >> 0x1f; -} - -// 00782a70 -float Entity_Player::FireDelay() -{ - void *weapon; - - weapon = this->_weapons[0]; - if ((weapon == (void *)0x0) && (weapon = this->_weapons[1], weapon == (void *)0x0)) { - return 0.0; - } - return *GHIDRA_CAST((GHIDRA_CAST(weapon) + 0xc)); -} - -// 00782af0 -void Entity_Player::Update() -{ - uint8_t bVar1; - BitSet128 tearFlags; - uint64_t qVar2; - uint8_t bVar3; - char cVar4; - short sVar5; - int iVar6; - Entity *tmpEntity; - Vector *vecResult; - Room *room; - int iVar7; - float *pfVar8; - PlayerManager *playerManager; - uint32_t uVar9; - Vector *vecResult2; - SoundEffects *sfx; - uint32_t *puVar10; - Entity_Effect *spawnedEffect; - Vector *other; - PauseScreen *pauseScreen; - uint32_t *puVar11; - RNG *rng; - ColorMod *color; - BitSet128 *pBVar12; - Level *pLVar13; - int *piVar14; - void *pvVar15; - uint8_t *pbVar16; - void *layerFrame; - ColorMod *color_00; - TemporaryEffects *tempEffects; - int numPlayers; - Entity_NPC *tractorBeam; - Vector *offset; - ItemConfig *itemConfig; - ItemConfig_Item *itemCfg; - Entity_Projectile *projectile; - Sprite *sprite; - ColorMod *color_01; - AnimationState *animState; - ColorMod *other_00; - ColorMod *other_01; - ColorMod *from; - LayerState *layer; - uint8_t *layerCount; - ColorMod *extraout_EAX; - EntityList *entityList; - uint8_t *puVar17; - std_string *anim; - char *walkAnim; - ColorMod *Color; - ColorMod *color_02; - Entity_Player *deathAnimPlayer; - MusicManager *musicManager; - GridEntity *gridEntity; - int noHalfHpFloors; - PersistentGameData *persistentData; - Color *colorBuf; - Entity_Player *activeDesc; - char *pcVar18; - ANM2 *pAVar19; - PlayerCostumeMap *costumeMap; - bool bVar20; - long double projectileAngle; - float in_XMM0_Da; - float fVar21; - uint8_t auVar22 [12]; - uint8_t auVar23 [12]; - uint8_t auVar24 [16]; - BitSet128 BVar25; - uint8_t extraout_var [12]; - uint8_t extraout_var_00 [12]; - uint8_t extraout_var_01 [12]; - uint8_t extraout_var_02 [12]; - uint8_t extraout_var_03 [12]; - uint8_t extraout_var_04 [12]; - uint8_t extraout_var_05 [12]; - uint8_t auVar26 [12]; - uint64_t uVar27; - EntityList aEStackY_5708 [128]; - BitSet128 tearFlags_00; - Vector *in_stack_fffffdbc; - uint32_t uVar28; - uint32_t uVar29; - float fVar30; - BitSet128 *pBVar31; - uint32_t uVar32; - uint8_t **src; - EntityRef *other_02; - Vector local_228 [3]; - Vector local_210 [14]; - BitSet128 local_1a0; - Vector local_190; - float local_188; - Vector scratchVec; - Vector local_17c; - Vector local_174; - Vector local_16c; - Vector local_164; - Entity_Player *local_15c; - Vector local_158; - Vector local_150; - std_string *local_148; - Vector local_144; - Vector local_13c; - Entity_Player *player; - Entity_Player *local_130; - uint8_t local_12a; - uint8_t local_129; - uint32_t local_128; - uint8_t local_122; - char local_121; - Entity_Player *local_120; - Color local_11c; - uint8_t local_f0 [88]; - uint8_t local_98 [48]; - uint8_t local_68 [20]; - uint8_t *puStack_54; - float fStack_50; - float local_4c; - int local_48; - void *local_44; - char tmpString [8]; - uint8_t local_24 [4]; - float fStack_20; - Vector VStack_1c; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int64_t elapsedMs; - Game *game; - ColorMod *tmpColor; - code *vfunc; - - local_8 = 0xffffffff; - puStack_c = &LAB_00aff534; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((local_24 + 0x20)); - ExceptionList = &local_10; - local_158.y = 0.0; - local_15c = GHIDRA_CAST(0x0); - player = this; - if (((this->_parent != 0) && (this->_variant == 0)) && (this->_playerHUD == (void *)0x0)) { - PlayerHUD::make_ref(&g_game->_hud,GHIDRA_CAST(&local_16c),this); - local_8 = 0; - FUN_007dd3d0(); - local_8 = 0xffffffff; - FUN_007dc660(); - } - if (this->_playerHUD != GHIDRA_CAST(0x0)) { - PlayerHUD::Update(this->_playerHUD); - } - ItemUseAnim::update(); - iVar6 = this->_salvationEffect; - if (iVar6 != 0) { - get_salvation_scale(); - *GHIDRA_CAST((iVar6 + 0x478)) = in_XMM0_Da * 1.2; - iVar6 = this->_salvationEffect; - *GHIDRA_CAST((iVar6 + 0x34c)) = 0; - *GHIDRA_CAST((iVar6 + 0x350)) = 0xc1700000; - if ((this->_flags & 0x4000) == 0) { - in_XMM0_Da = 0.0; - } - else { - in_XMM0_Da = 0.5; - } - in_XMM0_Da = (float)((g_game->_frameCount - this->_spawnFrame) % 0x168) + in_XMM0_Da; - *GHIDRA_CAST((this->_salvationEffect + 0xec)) = in_XMM0_Da; - } - if ((this->_playerType == 0x1d) || (this->_playerType == 0x26)) { - if (((this->_backupPlayer == (void *)0x0) || - (*GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x170)) != '\0')) || - ((bVar3 = HasCollectible(this,0x26b,0), bVar3 == 0 && - (bVar3 = HasCollectible(this->_backupPlayer,0x26b,0), bVar3 == 0)))) { - iVar6 = EntityPtr::Ref(); - if ((iVar6 != 0) && (bVar3 = HasCollectible(this,0x26b,0), bVar3 == 0)) { - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - bVar3 = HasCollectible(activeDesc,0x26b,0); - if ((bVar3 == 0) && (bVar3 = IsHologram(this), bVar3 == 0)) { - pvVar15 = (void *)EntityPtr::Ref(); - this->_backupPlayer = pvVar15; - iVar6 = EntityPtr::Ref(); - tmpEntity = GHIDRA_CAST(0x0); - *GHIDRA_CAST((iVar6 + 0x1e6c)) = this; - iVar6 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST((iVar6 + 0x1e68)))))->EntityPtr::Set(tmpEntity); - (GHIDRA_CAST((GHIDRA_CAST(&this->_twinPlayer))))->EntityPtr::Set(GHIDRA_CAST(0x0)); - room_exit(this->_backupPlayer,0); - FUN_004173a0(); - game = g_game; - *GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x172)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x161c)) = 0xffffffff; - Level::GetCurrentRoom(GHIDRA_CAST(game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(local_24),3,-1,-1,0,0); - local_8 = 1; - uVar29 = 0; - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_24))))->EntityList::Size(); - if (iVar6 != 0) { - do { - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - local_120 = GHIDRA_CAST(*puVar10); - pvVar15 = (void *)(GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Familiar::Player(); - if (pvVar15 == this->_backupPlayer) { - local_120->Remove(); - } - uVar29 = uVar29 + 1; - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_24))))->EntityList::Size(); - } while (uVar29 < uVar9); - } - uVar29 = Random(); - vecResult = (GHIDRA_CAST((this->_backupPlayer)))->Entity::Position(&local_16c); - in_stack_fffffdbc = &g_vectorZero; - Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar29); - Game::GetPlayerManager(g_game); - FUN_009b9fc0(); - local_8 = 0xffffffff; - (GHIDRA_CAST((local_24)))->EntityList_Query::~EntityList_Query(); - } - } - } - else { - local_150.y = (float)&this->_twinPlayer; - (GHIDRA_CAST((GHIDRA_CAST(local_150.y))))->EntityPtr::Set(this->_backupPlayer); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_backupPlayer) + 0x1e68)))))->EntityPtr::Set(GHIDRA_CAST(this)); - *GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x1e6c)) = 0; - local_120 = GHIDRA_CAST(this->_controllerIndex); - this->_backupPlayer = (void *)0x0; - iVar6 = EntityPtr::Ref(); - if (*GHIDRA_CAST((iVar6 + 0x20e8)) != '\0') { - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - iVar6 = EntityPtr::Ref(); - RestoreGameState(activeDesc,GHIDRA_CAST((iVar6 + 0x20ec))); - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - iVar6 = EntityPtr::Ref(); - spawn_dark_esau(activeDesc,(void *)(iVar6 + 0x20ec)); - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x20e8)) = 0; - } - SetControllerIndex(this,GHIDRA_INT(local_120),1); - iVar6 = EntityPtr::Ref(); - if (*GHIDRA_CAST((iVar6 + 0x1824)) == '\0') { - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - InitPostLevelInitStats(activeDesc); - } - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x172)) = 1; - tmpEntity = GHIDRA_CAST(EntityPtr)::Ref(); - this = player; - vecResult = MusicManager::RandomVector(&local_16c); - local_120 = GHIDRA_CAST(0x41700000); - vecResult = Vector::operator_mul(&scratchVec,GHIDRA_CAST(&local_120),vecResult); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_17c,vecResult); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPosition(vecResult); - tmpEntity = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((tmpEntity)))->Entity::SetVelocity(&this->_velocity); - Game::GetPlayerManager(g_game); - EntityPtr::Ref(); - FUN_009b9f60(); - uVar29 = 0xffffffff; - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - SyncConsumables(this,activeDesc,uVar29); - iVar6 = EntityPtr::Ref(); - in_XMM0_Da = 0.0; - *GHIDRA_CAST((iVar6 + 0x13f0)) = 0; - *GHIDRA_CAST((iVar6 + 0x13f4)) = 0; - *GHIDRA_CAST((iVar6 + 0x13f8)) = 0; - *GHIDRA_CAST((iVar6 + 0x13fc)) = 0; - *GHIDRA_CAST((iVar6 + 0x1400)) = 0; - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x1574)) = 0xffff; - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - EvaluateItems(activeDesc); - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x410)) = 1; - iVar6 = EntityPtr::Ref(); - ANM2::Reset(GHIDRA_CAST((iVar6 + 0x41c))); - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x139a)) = 0; - iVar6 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST((iVar6 + 0x48)))))->Sprite::SetLastFrame(); - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x1398)) = 0; - } - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - if (this->_damageMultiplierStacks != this->_lastDamageMultiplierStacks) { - this->_cacheFlags = this->_cacheFlags | 1; - this->_lastDamageMultiplierStacks = this->_damageMultiplierStacks; - Level::SetHeartPicked(GHIDRA_CAST(&this->_temporaryeffects)); - } - cVar4 = FUN_00417390(); - if (cVar4 != '\0') { - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - if ((cVar4 == '\0') && (this->_isLevelStartPending != 0)) { - level_start(this,1); - } - } - } - } - cVar4 = FUN_00417390(); - if ((cVar4 == '\0') && (this->_spawnerType == 0x388)) { - cVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::IsLoaded(); - if (cVar4 == '\0') { - ExceptionList = local_10; - return; - } - ANM2::Update(&this->_bodySprite); - ExceptionList = local_10; - return; - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = (GHIDRA_CAST((room)))->Room::HasCurseMist(); - if (bVar3 != this->_hasCurseMistEffect) { - if (bVar3 == 0) { - RemoveCurseMistEffect(this); - } - else { - AddCurseMistEffect(this); - } - } - } - } - } - if ((this->_variant == 0) && (cVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDead(), cVar4 == '\0')) { - bVar3 = HasTrinket(this,0x67,0); - if (bVar3 == 0) { -LAB_007831dd: - bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasTrinketEffect(0x67); - if (bVar3 == 0) goto LAB_0078320d; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveTrinketEffect(0x67,1); - } - else { - iVar6 = GetNumBombs(this); - iVar7 = GetNumCoins(this); - if (iVar6 != iVar7) goto LAB_007831dd; - iVar6 = GetNumCoins(this); - iVar7 = GetNumKeys(this); - if (iVar6 != iVar7) goto LAB_007831dd; - bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasTrinketEffect(0x67); - if (bVar3 != 0) goto LAB_0078320d; - in_stack_fffffdbc = GHIDRA_CAST(0x7831db); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddTrinketEffect(0x67,1,1); - } - AddCacheFlags(this,2); - EvaluateItems(this); - } -LAB_0078320d: - if (this->_variant == 2) { - FUN_00417920(); - cVar4 = FUN_004178f0(); - if (cVar4 == '\0') { -LAB_0078328a: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (this->_target != 0) { - local_150.y = (this->_targetPosition).x + 0.1; - local_120 = GHIDRA_CAST(0x3f800000); - pfVar8 = GHIDRA_CAST(std)::min(); - tmpEntity = GHIDRA_CAST(this->_target); - local_120 = GHIDRA_CAST(*pfVar8); - (this->_targetPosition).x = (float)local_120; - vecResult = (GHIDRA_CAST((tmpEntity)))->Entity::Position(&local_16c); - vecResult = vector_lerp(&scratchVec,&this->_pos,vecResult,0,(float)local_120); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(vecResult); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - ExceptionList = local_10; - return; - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_130 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetEntities(); - uVar29 = 0; - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->EntityList::Size(); - if (iVar6 == 0) { - ExceptionList = local_10; - return; - } - do { - tmpEntity = GHIDRA_CAST(FUN_00417610()); - local_120 = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::to_npc_or_coop_player(); - if (local_120 != GHIDRA_CAST(0x0)) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::is_valid_target(); - activeDesc = local_120; - if (bVar3 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(local_120)); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity::Position(&local_16c); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(vecResult); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - (this->_targetPosition).x = 1.0; - ExceptionList = local_10; - return; - } - } - uVar29 = uVar29 + 1; - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->EntityList::Size(); - } while (uVar29 < uVar9); - ExceptionList = local_10; - return; - } - (GHIDRA_CAST((&PTR_vftable_00c57b18)))->InputManager::get_device(&local_17c,this->_controllerIndex); - local_8 = 2; - iVar6 = EntityPtr::Ref(); - if (iVar6 != 0) { - EntityPtr::Ref(); - cVar4 = QueueItemData::Touched(); - if (cVar4 != '\0') { - local_8 = 0xffffffff; - FUN_004242b0(); - goto LAB_0078328a; - } - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - PlayerManager::RemoveCoPlayer(playerManager,this,0); - FUN_004242b0(); - ExceptionList = local_10; - return; - } - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1dd8))) = 0; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d4))) == '\0') { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d0)))) = 0; - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d0)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d0)))) + 1; - } - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d4))) = 0; - } - if (this->_exists == 0) { - ExceptionList = local_10; - return; - } - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x131c))) != '\0') { - FUN_007829a0(); - } - vecResult = &this->_pos; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c)))) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c)))))))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x143c)))))))->Entity::SetVelocity(&g_vectorZero); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440)))) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440)))))))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1440)))))))->Entity::SetVelocity(&g_vectorZero); - } - local_120 = GHIDRA_CAST(this->_breathOfLifeEffect); - if (local_120 != GHIDRA_CAST(0x0)) { - vecResult2 = (GHIDRA_CAST((&local_16c)))->Vector::Vector(0.0,-15.0); - (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::SetPositionOffset(vecResult2); - (GHIDRA_CAST((GHIDRA_CAST(this->_breathOfLifeEffect))))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((GHIDRA_CAST(this->_breathOfLifeEffect))))->Entity::SetVelocity(&g_vectorZero); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78)))) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78)))))))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e78)))))))->Entity::SetVelocity(&g_vectorZero); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c)))) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c)))))))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e7c)))))))->Entity::SetVelocity(&g_vectorZero); - } - if (GHIDRA_CAST(this->_salvationEffect) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(this->_salvationEffect))))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((GHIDRA_CAST(this->_salvationEffect))))->Entity::SetVelocity(&g_vectorZero); - } - iVar6 = EntityPtr::Ref(); - if (iVar6 != 0) { - tmpEntity = GHIDRA_CAST(EntityPtr)::Ref(); - activeDesc = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::Target(); - if (activeDesc == this) { - tmpEntity = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPosition(vecResult); - tmpEntity = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((tmpEntity)))->Entity::SetVelocity(&this->_velocity); - } - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88)))) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88)))))))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e88)))))))->Entity::SetVelocity(&g_vectorZero); - } - FUN_00757a10(); - this->_speedMultiplier = in_XMM0_Da; - local_12a = IsExtraAnimationFinished(this); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x200000000000000); - if (bVar3 == 0) { - pfVar8 = &(this->_posOffset).y; - if ((*pfVar8 <= 0.0 && *pfVar8 != 0.0) || - (this->_heightVelocity <= 0.0 && this->_heightVelocity != 0.0)) { - if (((this->_canFly == 0) && (this->_entityGridCollisionClass == 5)) || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000000000), bVar3 != 0)) { - fVar30 = this->_forgottenBHeight - this->_heightVelocity; - this->_forgottenBHeight = fVar30; - if (0.0 < fVar30) { - this->_forgottenBHeightVelocity = this->_forgottenBHeightVelocity - fVar30 * 0.2; - } - (this->_posOffset).y = this->_heightVelocity + (this->_posOffset).y; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000000000); - if (bVar3 == 0) { - this->_heightVelocity = this->_heightVelocity + 1.1; - } - else { - fVar30 = this->_heightVelocity + 0.6; - this->_heightVelocity = fVar30; - if ((fVar30 < 0.0) || - (pfVar8 = &(this->_posOffset).y, *pfVar8 <= -26.0 && *pfVar8 != -26.0)) { - this->_entityGridCollisionClass = 3; - } - else { - this->_entityGridCollisionClass = GHIDRA_UINT((this->_canFly == 0)) * 2 + 3; - } - } - if (0.0 < (this->_posOffset).y) { - (this->_posOffset).y = 0.0; - this->_heightVelocity = 0.0; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000000000); - if (bVar3 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x400000000000000); - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - if ((cVar4 == '\0') && (this->_isControlsEnabled = 1, this->_playerType == 0x23)) { - Game::ShakeScreen(g_game,4); - play_sound_with_fart_seed(499,1.0,2,0,1.0); - in_stack_fffffdbc = GHIDRA_CAST(0x1d3); - play_sound_with_fart_seed(0x1d3,1.0,2,0,1.0); - } - } - } - } - } - else { - (this->_posOffset).y = 0.0; - this->_heightVelocity = 0.0; - } - } - } - else { - this->_heightVelocity = 0.0; - } - if (this->_playerType == 0x23) { - fVar30 = this->_forgottenBHeightVelocity; - fVar21 = fVar30 + this->_forgottenBHeight; - this->_forgottenBHeight = fVar21; - if ((fVar21 < 0.0) || (this->_forgottenBHeight = 0.0, fVar30 <= 0.0)) { - fVar30 = fVar30 + 0.6; - } - else if (2.0 <= fVar30) { - fVar30 = fVar30 * -0.45; - } - else { - fVar30 = 0.0; - } - this->_forgottenBHeightVelocity = fVar30; - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::EntityRef(); - bVar3 = HasCollectible(this,0x278,0); - if ((bVar3 == 0) && - (bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x278), bVar3 == 0)) - { - local_16c.y = *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)); - } - else { - local_16c.y = *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)); - *GHIDRA_CAST(&this->_pendingDamageFlags) = GHIDRA_UINT(this->_pendingDamageFlags) & 0xffff7fff; - *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)) = local_16c.y; - } - if ((this->_pendingDamageFlags & 0x8000) == 0) { - if ((0 < this->_poisonDamageFrames) && - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0), bVar3 != 0)) { - this->_poisonDamageFrames = 0; - sfx = MusicManager::SFXManager(); - SFXManager::Stop(sfx,0x24e); - } - } - else { - local_144.y = (float)(GHIDRA_UINT(local_144.y) & 0xffffff00); - msvc::iterator_copy(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8))),&local_128); - FUN_00456190(); - cVar4 = FUN_0042c710(); - if (cVar4 != '\0') { - do { - pfVar8 = GHIDRA_CAST(EntityPtr)::Ref(); - if ((*pfVar8 == 0.0) && (iVar6 = EntityPtr::Ref(), (*GHIDRA_CAST((iVar6 + 8)) & 0x8000) != 0)) - { - iVar6 = EntityPtr::Ref(); - if (*GHIDRA_CAST((iVar6 + 0x10)) != 0) { - iVar6 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::operator_(GHIDRA_CAST((iVar6 + 0x10))); - } - iVar6 = EntityPtr::Ref(); - local_144.y = (float)(GHIDRA_UINT(local_144.y) & 0xff); - if (*GHIDRA_CAST((iVar6 + 0x18)) == 0x3b6) { - local_144.y = 1.4013e-45; - } - pfVar8 = GHIDRA_CAST(std)::vector::erase(); - local_128 = GHIDRA_CAST(*pfVar8); - } - else { - FUN_004a11b0(); - } - FUN_00456190(); - cVar4 = FUN_0042c710(); - } while (cVar4 != '\0'); - this = player; - } - *GHIDRA_CAST(&this->_pendingDamageFlags) = GHIDRA_UINT(this->_pendingDamageFlags) & 0xffff7fff; - this->_poisonDamageFrames = this->_poisonDamageFrames + 1; - *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)) = - *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_144.y)) + 0x0))) == '\0') { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x40); - sfx = MusicManager::SFXManager(); - bVar3 = SFXManager::IsPlaying(sfx,0x24e); - if (bVar3 == 0) { - sfx = MusicManager::SFXManager(); - in_stack_fffffdbc = GHIDRA_CAST(0x1); - (GHIDRA_CAST((sfx)))->SoundEffects::Play(0x24e,1.0,1,0,1.0,0.0); - } - } - } - if ((0 < this->_poisonDamageFrames) && (this->_dead == 0)) { - local_150.y = 1.0; - local_164.y = (float)this->_poisonDamageFrames / 30.0; - puVar10 = GHIDRA_CAST(std)::min(); - local_148 = GHIDRA_CAST(*puVar10); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40); - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - if (bVar3 == 0) { - local_150.y = Math::lerp((float)local_148,0.0,0.2,0); - local_164.y = Math::lerp((float)local_148,0.0,0.5,0); - Math::lerp((float)local_148,0.0,0.5,0); - ::(GHIDRA_CAST(()))->Color::Color(); - in_stack_fffffdbc = GHIDRA_CAST(0x2); - (*vfunc)(); - if (0x14 < this->_poisonDamageFrames) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); - goto joined_r0x00783ce0; - } - } - else { - Math::lerp((float)local_148,0.0,0.5,0); - ::(GHIDRA_CAST(()))->Color::Color(); - in_stack_fffffdbc = GHIDRA_CAST(0x2); - (*vfunc)(); - if (0x14 < this->_poisonDamageFrames) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); -joined_r0x00783ce0: - if (bVar3 != 0) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - ::(GHIDRA_CAST(()))->Color::Color(); - in_stack_fffffdbc = GHIDRA_CAST(0x3); - (*vfunc)(); - } - } - } - if (0x1e < this->_poisonDamageFrames) { - this->_damageCooldown = 0; - this->_poisonDamageFrames = this->_poisonDamageFrames + -0x1e; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40); - if (bVar3 == 0) { - uVar29 = Random(); - in_stack_fffffdbc = &g_vectorZero; - tmpEntity = Game::Spawn(g_game,1000,0x13,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar29) - ; - FUN_004316b0(); - FUN_004b7070(); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - (GHIDRA_CAST((sprite)))->Sprite::SetFrame_1(3); - tmpEntity->Update(); - } - else { - this->TakeDamage(); - in_stack_fffffdbc = GHIDRA_CAST(0x24f); - play_sound_with_fart_seed(0x24f,1.0,2,0,1.0); - } - } - } - if (0 < this->_pauseTimer) { - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if ((cVar4 != '\0') && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ed2)))) == 0)) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - ::(GHIDRA_CAST(()))->Color::Color(); - in_stack_fffffdbc = GHIDRA_CAST(0x3); - (*vfunc)(); - } - } - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (((cVar4 == '\0') && (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40), bVar3 != 0)) && - (this->_poisonDamageFrames < 1)) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x40); - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - ANM2::Update(&this->_bodySprite); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered(&DAT_00b64ba4); - if (bVar3 != 0) { - uVar29 = Random(); - in_stack_fffffdbc = &g_vectorZero; - spawnedEffect = - (Entity_Effect *) - Game::Spawn(g_game,1000,0xc,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),10,uVar29); - (GHIDRA_CAST((spawnedEffect)))->Entity_Effect::FollowParent(GHIDRA_CAST(player)); - set_field_358(spawnedEffect,-10.0); - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Scale(); - (GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity::SetSpriteScale(vecResult); - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity)::SpriteScale(); - vecResult2 = (GHIDRA_CAST((&local_16c)))->Vector::Vector(0.0,-20.0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Mul(&scratchVec,vecResult2); - GetFlyingOffset(player,&local_17c); - (GHIDRA_CAST((vecResult)))->Vector::__add(&local_174,other); - FUN_004563c0(); - (GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity::AddEntityFlags(0x100000000000); - spawnedEffect->Update(); - (GHIDRA_CAST((spawnedEffect)))->Entity_Effect::set_rotation(0.0); - this = player; - } - } - bVar3 = (GHIDRA_CAST((&PTR_vftable_00c57b18)))->InputManager::is_device_connected(this->_controllerIndex); - if (bVar3 == 0) { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Controller %d has disconnected.\n")); - if ((this->_variant == 0) || (this->_parent != 0)) { - pauseScreen = GHIDRA_CAST(func_0x00753cf0()); - PauseScreen::Show(pauseScreen); - ExceptionList = local_10; - return; - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - PlayerManager::RemoveCoPlayer(playerManager,this,0); - uVar29 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::Position(&local_16c); - vecResult2 = (GHIDRA_CAST((&scratchVec)))->Vector::Vector(0.0,-10.0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&local_17c,vecResult2); - Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar29); - ExceptionList = local_10; - return; - } - } - if ((this->_isPlayingExtraAnimation != 0) && - (bVar3 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty), bVar3 != 0)) { - this->_isPlayingExtraAnimation = 0; - } - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if ((cVar4 != '\0') && - (bVar3 = ANM2::IsFinishedImpl(&this->_sprite,GHIDRA_CAST("LightTravel")), bVar3 != 0)) { - FUN_0044bf90(); - } - if ((this->_isHurtPending != 0) && (this->_isPlayingExtraAnimation == 0)) { - this->_isHurtPending = 0; - bVar3 = HasCollectible(this,0x23f,0); - if ((bVar3 != 0) && - (bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x37), bVar3 == 0)) { - local_150.y = 1.4013e-45; - local_120 = GHIDRA_CAST(GHIDRA_INT((5.0 - this->_luck))); - puVar11 = GHIDRA_CAST(std)::max(); - uVar29 = *puVar11; - if (this->_redHearts < 2) { - uVar29 = 1; - } - rng = GHIDRA_CAST(rng_vector_at()); - uVar29 = (GHIDRA_CAST((rng)))->RNG::RandomInt(uVar29); - if (uVar29 == 0) { - play_sound_with_fart_seed(0xb5,1.0,0x14,0,1.0); - play_sound_with_fart_seed(0x1e,1.0,2,0,1.0); - fVar30 = 1.0; - vecResult = &g_vectorZero; - ::(GHIDRA_CAST((GHIDRA_CAST((local_f0 + 0x2c)))))->Color::Color(); - spawn_gibs(&this->_pos,0xe,40.0,GHIDRA_CAST(&DAT_00b6bc94),GHIDRA_CAST(this),color,vecResult,fVar30) - ; - iVar6 = Isaac::Random(3); - iVar6 = iVar6 + 1; - if (0 < iVar6) { - do { - ThrowBlueSpider(this,&this->_pos,&g_vectorZero); - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - } - in_stack_fffffdbc = GHIDRA_CAST(0x784279); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x37,1,1); - EvaluateItems(this); - } - } - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = HasCollectible(this,0x281,0); - if (((bVar3 != 0) && (iVar6 = (GHIDRA_CAST((room)))->Room::GetAliveEnemiesCount(), 0 < iVar6)) && - (iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(3.0,0.0), iVar6 != 0)) { - local_130 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetEntities(); - local_144.y = 0.0; - uVar29 = 0; - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->EntityList::Size(); - if (iVar6 == 0) { - pAVar19 = GHIDRA_CAST(0x0); -LAB_0078438c: - iVar6 = Isaac::Random(2); - if (iVar6 != 0) goto LAB_0078439a; - } - else { - do { - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - local_120 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar10))))->Entity)::ToTear(); - if (local_120 != GHIDRA_CAST(0x0)) { - pBVar31 = &g_tearFlagChain; - pBVar12 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::TearFlags(GHIDRA_CAST(local_24)); - pBVar12 = BitSet128::operator_and(&local_1a0,pBVar12,pBVar31); - bVar3 = (GHIDRA_CAST((pBVar12)))->BitSet128::IsNonZero(); - if ((bVar3 != 0) && - (activeDesc = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity)::Parent(), - activeDesc == this)) { - local_144.y = (float)((GHIDRA_CAST(local_144.y))->_buf + 1); - } - } - uVar29 = uVar29 + 1; - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->EntityList::Size(); - } while (uVar29 < uVar9); - pAVar19 = GHIDRA_CAST(local_144.y); - if (GHIDRA_UINT(local_144.y) < GHIDRA_CAST(0xc)) goto LAB_0078438c; -LAB_0078439a: - if ((GHIDRA_CAST(&DAT_00000013) < pAVar19) || (iVar6 = Isaac::Random(5), iVar6 != 0)) - goto LAB_007845eb; - } - if (this->_moveDirection == -1) { - vecResult = (GHIDRA_CAST((&local_17c)))->Vector::Vector(0.0,1.0); - } - else { - vecResult = Isaac::GetAxisAlignedUnitVectorFromDir(&scratchVec,this->_moveDirection); - } - local_16c.x = vecResult->x; - local_16c.y = vecResult->y; - uVar29 = Random(); - this = player; - local_120 = GHIDRA_CAST(0x40400000); - vecResult = (GHIDRA_CAST((&local_16c)))->Vector::__mul(&scratchVec,GHIDRA_CAST(&local_120)); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__add(&local_17c,vecResult); - activeDesc = (Entity_Player *) - Game::Spawn(g_game,2,1,&this->_pos,vecResult,GHIDRA_CAST(this),0,uVar29); - local_130 = activeDesc; - FUN_00753720(); - fVar30 = this->_poisonTickDamage - 3.5; - if (fVar30 < 0.0) { - fVar30 = fVar30 * -10.0; - FUN_00431260(); - fVar30 = -fVar30 / 10.0; - } - else { - fVar30 = fVar30 + fVar30; - FUN_00431260(); - fVar30 = fVar30 * 0.5; - } - local_164.y = fVar30 + 3.5; - local_150.y = 1.0; - msvc::max(); - activeDesc->SetCollisionDamage(); - pBVar12 = BitSet128::operator_or(GHIDRA_CAST(local_24),&g_tearFlagChain,&g_tearFlagSpectral); - (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity_Tear::SetTearFlags(*pBVar12); - (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity::SetParent(GHIDRA_CAST(this)); - fVar30 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity_Tear::SetScale(fVar30 * 0.2 + 0.9); - (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity_Projectile::SetHeight(-6.0); - FUN_00444c70(); - (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity_Projectile::set_falling_accel(-0.03); - vfunc = *(code **)(*GHIDRA_CAST(activeDesc) + 0x3c); - random_float(); - ::(GHIDRA_CAST(()))->Color::Color(); - in_stack_fffffdbc = GHIDRA_CAST(0xff); - (*vfunc)(); - local_130->Update(); - } - } -LAB_007845eb: - if (((this->_isPlayingItemAnimation != 0) && - (bVar3 = ANM2::IsFinishedImpl(&this->_bodySprite,&s_empty), bVar3 != 0)) && - (bVar3 = ANM2::IsFinishedImpl(&this->_bodySprite,GHIDRA_CAST("LiftItem")), bVar3 == 0)) { - this->_isPlayingItemAnimation = 0; - ANM2::Reset(&this->_bodySprite); - ANM2::Reset(&this->_heldSprite); - } - update_pitfall(this); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - update_suplex(this); - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - if (this->_isBrokenRemotePending == 0) { - if (this->_cursedPennyPending != 0) { - FUN_00424510(); - local_8 = 3; - local_128 = GHIDRA_CAST(rng_vector_at()); - FUN_00424510(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 4; - local_129 = 0; - iVar6 = 0; - local_122 = 0; - iVar7 = GetTrinketMultiplier(this,0xac); - if (iVar7 == 2) { - iVar6 = 0x19; - } - else if (iVar7 == 3) { - iVar6 = 0x32; - } - iVar7 = this->_cursedPennyPending; - if (iVar7 == 1) { - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - local_120 = GHIDRA_CAST(0x1); - if (iVar6 + 0x32U <= uVar29) { - local_122 = 1; - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x2); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x4); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x5); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x6); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x9); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xb); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xc); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xd); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x14); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x15); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x16); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x18); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x12); - } - FUN_007dc620(); - local_129 = 1; - } - else if (iVar7 == 2) { - local_129 = 1; - local_122 = 1; - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - if (uVar29 < iVar6 + 0x32U) { - local_120 = GHIDRA_CAST(0x2); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x4); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x9); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xb); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xc); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x18); - } - else { - local_120 = GHIDRA_CAST(0x1); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x5); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x6); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xd); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x14); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x15); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x16); -LAB_00784aac: - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x12); - } -LAB_007852a3: - FUN_007dc620(); - } - else { - if (iVar7 == 3) { - local_129 = 1; - local_122 = 1; - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - if (uVar29 < iVar6 + 0x19U) { - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - if (uVar29 < 0x32) { - pLVar13 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::InitializeDevilAngelRoom(pLVar13,1,0); - local_120 = GHIDRA_CAST(0xffffffff); - msvc::vector::push_back(); - } - else { - pLVar13 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::InitializeDevilAngelRoom(pLVar13,0,1); - local_120 = GHIDRA_CAST(0xffffffff); - msvc::vector::push_back(); - } - goto LAB_007852b2; - } - local_120 = GHIDRA_CAST(0x1); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x2); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x4); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x5); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x6); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x9); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xa); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xb); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xc); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xd); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x14); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x15); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x18); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x12); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xfffffffe); - msvc::vector::push_back(); - } - else { - if (iVar7 == 5) { - local_129 = 1; - local_122 = 1; - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - if (uVar29 < iVar6 + 0x32U) { - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(&DAT_00000008); - goto LAB_007852a3; - } - local_120 = GHIDRA_CAST(0x1); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x2); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x4); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x5); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x6); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x9); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xb); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xc); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xd); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x14); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x15); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x18); -LAB_00785224: - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x12); - } - else { - if (iVar7 != 4) { - if (iVar7 == 7) { - local_129 = 1; - local_122 = 1; - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - if (iVar6 + 10U <= uVar29) { - local_120 = GHIDRA_CAST(0x1); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x2); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x4); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x5); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x6); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x9); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xb); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xc); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xd); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x18); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x14); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x15); - goto LAB_00785224; - } - local_120 = GHIDRA_CAST(0xfffffffe); - msvc::vector::push_back(); - } - else if (iVar7 == 6) { - local_129 = 1; - local_122 = 1; - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - local_120 = GHIDRA_CAST(0xa); - if (0x31 < uVar29) { - local_120 = GHIDRA_CAST(&DAT_00000005); - } - goto LAB_007852a3; - } - goto LAB_007852b2; - } - local_129 = 1; - local_122 = 1; - uVar29 = (GHIDRA_CAST((local_128)))->RNG::RandomInt(100); - if (uVar29 < iVar6 + 0x32U) { - local_120 = GHIDRA_CAST(0x14); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x15); - goto LAB_00784aac; - } - local_120 = GHIDRA_CAST(0x1); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x2); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x4); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x5); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x6); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x9); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xb); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xc); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0xd); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x18); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x7); - FUN_007dc620(); - local_120 = GHIDRA_CAST(0x8); - } - FUN_007dc620(); - } - local_120 = GHIDRA_CAST(0xfffffffa); - msvc::vector::push_back(); - } -LAB_007852b2: - FUN_005cbe20(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 5; - local_158.y = 0.0; - pLVar13 = GHIDRA_CAST(Config)::GetCollectibles(); - iVar6 = Level::GetRoomCount(pLVar13); - if (0 < iVar6) { - iVar6 = 0; - do { - room = GHIDRA_CAST(Config)::GetCollectibles(); - iVar7 = (GHIDRA_CAST((room)))->Room::GetTopLeftPos(); - activeDesc = GHIDRA_CAST((iVar6 + iVar7)); - local_130 = activeDesc; - if (*GHIDRA_CAST((iVar6 + 0x10 + iVar7)) != 0) { - Config::GetCollectibles(); - iVar7 = FUN_004f8930(); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((activeDesc)) + 0xc)))) == iVar7) { - uVar29 = 0; - iVar7 = (GHIDRA_CAST((&fStack_20)))->msvc::vector::size(); - if (iVar7 != 0) { - do { - piVar14 = GHIDRA_CAST(FUN_0042c810()); - if (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_130)) + 0x10)))) + 8)) == *piVar14) { - local_144.y = *GHIDRA_CAST(local_130); - msvc::set::find(); - msvc::iterator_copy(&local_17c,&local_120); - cVar4 = FUN_00557bb0(); - if (cVar4 != '\0') { - msvc::set::insert(); - activeDesc = local_130; - cVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->RoomDescriptor::Clear(); - if (((cVar4 != '\0') && (local_122 != 0)) || - ((cVar4 = (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->RoomDescriptor::Clear(), - cVar4 == '\0' && (local_129 != 0)))) { - bVar3 = local_122; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((activeDesc)) + 0x40)))) == 0) { - bVar3 = local_129; - } - if (bVar3 != 0) { - msvc::vector::push_back(); - } - } - } - break; - } - uVar29 = uVar29 + 1; - uVar9 = (GHIDRA_CAST((&fStack_20)))->msvc::vector::size(); - } while (uVar29 < uVar9); - } - } - } - iVar6 = iVar6 + 0xb8; - puVar17 = GHIDRA_CAST((GHIDRA_INT(local_158.y) + 1)); - local_158.y = (float)puVar17; - pLVar13 = GHIDRA_CAST(Config)::GetCollectibles(); - iVar7 = Level::GetRoomCount(pLVar13); - } while (GHIDRA_INT(puVar17) < iVar7); - this = player; - } - iVar6 = 0; - iVar7 = (GHIDRA_CAST(((void *)(GHIDRA_INT(&local_1a0._l) + 4))))->msvc::vector::size(); - if (iVar7 != 0) { - uVar29 = (GHIDRA_CAST(((void *)(GHIDRA_INT(&local_1a0._l) + 4))))->msvc::vector::size(); - (GHIDRA_CAST((local_128)))->RNG::RandomInt(uVar29); - piVar14 = GHIDRA_CAST(FUN_0042c810()); - iVar6 = *piVar14; - } - if ((this->_cursedPennyPending == 6) && - (piVar14 = GHIDRA_CAST(FUN_0042c810()), *piVar14 == 10)) { - if (iVar6 == 0) { - pLVar13 = GHIDRA_CAST(Config)::GetCollectibles(); - iVar6 = Level::QueryRoomTypeIndex(pLVar13,5,0,local_128,0); - goto LAB_007854cf; - } -LAB_007854d3: - Config::GetCollectibles(); - FUN_00428ae0(); - in_stack_fffffdbc = GHIDRA_CAST(0xffffffff); - Game::StartRoomTransition(g_game,iVar6,-1,3,this,-1); - } - else { -LAB_007854cf: - if (iVar6 != 0) goto LAB_007854d3; - iVar6 = GetTrinketMultiplier(this,4); - if ((float)iVar6 <= 1.0) { - in_stack_fffffdbc = GHIDRA_CAST(&DAT_0000002c); - } - else { - in_stack_fffffdbc = GHIDRA_CAST(0x1a3); - } - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_128) + 2)),GHIDRA_INT(in_stack_fffffdbc),1,-1,0); - } - FUN_00424420(); - FID_conflict__Tidy(&fStack_20); - local_8 = 0xffffffff; - FID_conflict__Tidy((void *)(GHIDRA_INT(&local_1a0._l) + 4)); - } - } - else { - iVar6 = GetTrinketMultiplier(this,4); - if ((float)iVar6 <= 1.0) { - in_stack_fffffdbc = GHIDRA_CAST(&DAT_0000002c); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_128) + 2)),0x2c,1,-1,0); - } - else { - in_stack_fffffdbc = GHIDRA_CAST(0x1a3); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_128) + 2)),0x1a3,1,-1,0); - } - } - this->_isBrokenRemotePending = 0; - this->_cursedPennyPending = 0; - } - } - } - activeDesc = GHIDRA_CAST((this->_activeDesc + 1)); - local_120 = activeDesc; - if (((this->_activeDesc[1]._item != 0) && (bVar3 = HasCollectible(this,0x216,0), bVar3 == 0)) && - (cVar4 = IsCoopGhost(this), cVar4 == '\0')) { - FUN_005b19d0(); - rng = GHIDRA_CAST(rng_vector_at()); - uVar9 = (GHIDRA_CAST((rng)))->RNG::Next(); - uVar29 = *GHIDRA_CAST(local_120); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(room,&local_16c,&player->_pos,40.0,0,0,0); - this = player; - Game::Spawn(g_game,5,100,vecResult,&g_vectorZero,GHIDRA_CAST(player),uVar29,uVar9); - __RTDynamicCast(); - FUN_005b1990(); - FUN_005b1920(); - in_stack_fffffdbc = GHIDRA_CAST(this->_activeDesc[1]._item); - activeDesc = GHIDRA_CAST((this->_activeDesc + 1)); - RemoveCollectible(this,GHIDRA_UINT(in_stack_fffffdbc),0,1,1); - FUN_005b19d0(); - } - bVar3 = HasCollectible(this,0x3b,0); - if ((bVar3 != 0) && (cVar4 = FUN_007da770(), cVar4 == '\0')) { - local_120 = GHIDRA_CAST(&this->_collectibleCounts); - puVar10 = GHIDRA_CAST(FUN_0042c810()); - *puVar10 = 0; - local_130 = GHIDRA_CAST(0x1); - do { - if (*GHIDRA_CAST(activeDesc) == 0x3b) { - *GHIDRA_CAST(activeDesc) = 0x22; - piVar14 = GHIDRA_CAST(FUN_0042c810()); - *piVar14 = *piVar14 + 1; - } - this = player; - local_130 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_130[-1])) + 0x2eff)))); - activeDesc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(activeDesc[-1])) + 0x2ee0)))); - } while (-1 < GHIDRA_INT(local_130)); - UpdateBookOfVirtues(player,0); - } - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (((cVar4 != '\0') && (this->_variant == 0)) && - ((bVar3 = HasCollectible(this,0x1f1,0), bVar3 != 0 && - (bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1f1), bVar3 == 0))) - ) { - uVar27 = get_time_ms(); - elapsedMs = uVar27 - (int64_t)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f90)))); - local_16c.y = (float)((uint64_t)elapsedMs >> 0x20); - if ((local_16c.y != 0.0) || (15000 < GHIDRA_UINT(elapsedMs))) { - in_stack_fffffdbc = GHIDRA_CAST(0x78577d); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1f1,1,1); - uVar29 = 0; - pvVar15 = (void *)Game::GetPlayerManager(g_game); - iVar6 = (GHIDRA_CAST((pvVar15)))->msvc::vector::size(); - if (iVar6 != 0) { - do { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - local_130 = PlayerManager::GetPlayer(playerManager,uVar29); - if ((local_130 != this) && - (activeDesc = GHIDRA_CAST(EntityPtr)::Ref(), local_130 != activeDesc)) { - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::constructor(GHIDRA_CAST(this)); - in_stack_fffffdbc = GHIDRA_CAST(0x7857e1); - (GHIDRA_CAST((GHIDRA_CAST(local_130))))->Entity::AddConfusion(GHIDRA_CAST(local_68),0x5a,0); - } - uVar29 = uVar29 + 1; - pvVar15 = (void *)Game::GetPlayerManager(g_game); - uVar9 = (GHIDRA_CAST((pvVar15)))->msvc::vector::size(); - } while (uVar29 < uVar9); - } - } - } - bVar3 = Game::IsInTimedSet(g_game,0x34); - if (bVar3 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x8000000); - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x8000000); - if (bVar3 == 0) { - iVar6 = this->_slipperyTimer + -1; - if (iVar6 < 0) { - iVar6 = 0; - } - this->_slipperyTimer = iVar6; - } - else { - this->_slipperyTimer = 0x3c; - } - this->_lastActionTriggers = 0; - if (this->_dead == 0) { - if (((this->_variant == 1) && (this->_isGlitchBaby != 0)) && - (bVar3 = IsExtraAnimationFinished(this), bVar3 != 0)) { - pcVar18 = "Appear"; - Config::GetPillEffects(); - pbVar16 = GHIDRA_CAST(_string_holder_c_str()); - do { - bVar3 = *pbVar16; - bVar20 = bVar3 < (uint8_t)*pcVar18; - if (bVar3 != *pcVar18) { -LAB_007858c0: - uVar29 = -GHIDRA_UINT(bVar20) | 1; - goto LAB_007858c5; - } - if (bVar3 == 0) break; - bVar3 = pbVar16[1]; - bVar20 = bVar3 < (uint8_t)pcVar18[1]; - if (bVar3 != pcVar18[1]) goto LAB_007858c0; - pbVar16 = pbVar16 + 2; - pcVar18 = pcVar18 + 2; - } while (bVar3 != 0); - uVar29 = 0; -LAB_007858c5: - if (uVar29 == 0) { - PlayExtraAnimation(this,GHIDRA_CAST("Glitch")); - } - else { - pcVar18 = "Glitch"; - Config::GetPillEffects(); - pbVar16 = GHIDRA_CAST(_string_holder_c_str()); - do { - bVar3 = *pbVar16; - bVar20 = bVar3 < (uint8_t)*pcVar18; - if (bVar3 != *pcVar18) { -LAB_00785910: - uVar29 = -GHIDRA_UINT(bVar20) | 1; - goto LAB_00785915; - } - if (bVar3 == 0) break; - bVar3 = pbVar16[1]; - bVar20 = bVar3 < (uint8_t)pcVar18[1]; - if (bVar3 != pcVar18[1]) goto LAB_00785910; - pbVar16 = pbVar16 + 2; - pcVar18 = pcVar18 + 2; - } while (bVar3 != 0); - uVar29 = 0; -LAB_00785915: - if (uVar29 == 0) { - InitBabySkin(this); - } - } - } - if (this->_heldEntity != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((this->_heldEntity)))->Entity::SetPosition(&this->_pos); - (GHIDRA_CAST((this->_heldEntity)))->Entity::SetVelocity(&this->_velocity); - bVar3 = (GHIDRA_CAST((this->_heldEntity)))->Entity::is_player(); - if (bVar3 != 0) { - pvVar15 = this->_heldEntity; - layerFrame = ANM2::GetLayerFrame(&this->_bodySprite,0); - if ((layerFrame != (void *)0x0) || - ((1 < this->_suplexState && - (layerFrame = ANM2::GetLayerFrame(&this->_sprite,0), layerFrame != (void *)0x0)))) { - FUN_0067f2e0(); - *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x350)) = local_16c.y * (this->_playerSpriteScale).y; - } - } - } - tempEffects = &this->_temporaryeffects; - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x1f1); - if (bVar3 != 0) { - in_stack_fffffdbc = GHIDRA_CAST(0x7859db); - cVar4 = FUN_00a20920(); - if (cVar4 == '\0') { - in_stack_fffffdbc = GHIDRA_CAST(0x7859f3); - cVar4 = FUN_00a20920(); - if (cVar4 != '\0') goto LAB_00785a2e; - in_stack_fffffdbc = GHIDRA_CAST(0x785a0b); - cVar4 = FUN_00a20920(); - if (cVar4 != '\0') goto LAB_00785a2e; - in_stack_fffffdbc = GHIDRA_CAST(0x785a23); - cVar4 = FUN_00a20920(); - local_121 = '\0'; - if (cVar4 != '\0') goto LAB_00785a2e; - } - else { -LAB_00785a2e: - local_121 = '\x01'; - } - FUN_00417900(); - cVar4 = FUN_007538d0(); - if (cVar4 == '\0') { -joined_r0x00785a7e: - if (local_121 == '\0') goto LAB_00785b62; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&local_16c))))->EntityPtr::clear(); - bVar3 = GetMouseAimTarget(this,&local_16c,0); - if (bVar3 == 0) goto joined_r0x00785a7e; - } - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x1f1,1); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar6 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (6 < iVar6) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveNullEffect(0x30,-1); - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddNullEffect(0x30,0,0x1e); - play_sound_with_fart_seed(0x50,1.0,2,0,1.0); - Game::ShakeScreen(g_game,10); - ::(GHIDRA_CAST((GHIDRA_CAST((local_f0 + 0x2c)))))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::MakeGroundPoofAtSelf(color_00,0.8); - in_stack_fffffdbc = GHIDRA_CAST(g_tearFlagsNone._l); - Game::DamageRadius(&this->_pos,GHIDRA_CAST(this),0,0,0,50.0,g_tearFlagsNone,15.0,80.0); - this->_cacheFlags = this->_cacheFlags | tempEffects->_cacheFlags; - EvaluateItems(this); - FUN_00753790(); - } - } -LAB_00785b62: - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (cVar4 == '\0') { -LAB_00785bc0: - update_body_animations(this); - update_bomb_input(this); - ControlActiveItem(this,0); - pocket_use_input(this); - update_shooting(this); - pockets_rotate(); - } - else { - iVar6 = this->_freezeCountdown; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - tempEffects = GHIDRA_CAST(FUN_004360d0()); - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x1de); - if (((bVar3 == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ed2)))) != 0)) && (iVar6 == 0)) goto LAB_00785bc0; - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - } - activeDesc = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::ToPlayer(); - local_158.y = (float)activeDesc; - bVar3 = IsHologram(this); - if (bVar3 != 0) { - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - local_158.y = (float)activeDesc; - } - if (activeDesc != GHIDRA_CAST(0x0)) { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - (GHIDRA_CAST((GHIDRA_CAST(&local_17c))))->EntityPtr::clear(); - pAVar19 = GHIDRA_CAST(0x0); - local_144.y = 0.0; - iVar6 = Game::GetNumPlayers(g_game); - if (iVar6 != 0) { - do { - local_120 = Game::GetPlayer(g_game,GHIDRA_UINT(pAVar19)); - if (local_120 != this) { - if (local_120 != GHIDRA_CAST(local_158.y)) { - activeDesc = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity)::Parent(); - if (activeDesc != GHIDRA_CAST(local_158.y)) goto LAB_00785d5e; - } - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Position(&local_16c); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&scratchVec,vecResult); - local_130 = GHIDRA_CAST((GHIDRA_CAST((&scratchVec)))->Vector)::LengthSquared(); - bVar3 = (GHIDRA_CAST((&scratchVec)))->Vector::operator_ne(&g_vectorZero); - if ((bVar3 != 0) && ((float)local_130 < 144.0)) { - local_150.y = 0.5; - vecResult = Vector::operator_mul(&local_174,&local_150.y,&scratchVec); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__div(&local_13c,GHIDRA_CAST(&local_130)); - (GHIDRA_CAST((&local_17c)))->Vector::operator_add_assign(vecResult); - } - pAVar19 = GHIDRA_CAST(local_144.y); - } -LAB_00785d5e: - pAVar19 = GHIDRA_CAST(((pAVar19->_filename)._buf + 1)); - local_144.y = (float)pAVar19; - numPlayers = Game::GetNumPlayers(g_game); - } while (pAVar19 < GHIDRA_UINT(numPlayers)); - } - local_120 = GHIDRA_CAST((GHIDRA_CAST((&local_17c)))->Vector)::Length(); - if (2.0 < (float)local_120) { - (GHIDRA_CAST((&local_17c)))->Vector::Resize(2.0); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity(&local_17c,0); - } - } - } - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - bVar3 = HasCollectible(this,0x18d,0); - if ((bVar3 == 0) || - ((this->_weapons[1] == GHIDRA_CAST(0x0) || - (cVar4 = (**(code **)(*GHIDRA_CAST(this->_weapons[1]) + 0x34))(), cVar4 == '\0')))) { - if (GHIDRA_CAST(this->_tractorBeam) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_tractorBeam) + 0x28))(); - } - } - else { - local_174.x = (this->_aimDirection).x; - local_174.y = (this->_aimDirection).y; - iVar6 = FUN_007826c0(); - if ((iVar6 == 0) && - ((bVar3 = (GHIDRA_CAST((&local_174)))->Vector::operator_eq(&g_vectorZero), bVar3 != 0 || - (bVar3 = HasCollectible(this,0x1d1,0), bVar3 == 0)))) { - vecResult = Isaac::GetAxisAlignedUnitVectorFromDir(&local_16c,this->_headDirection); - (GHIDRA_CAST((&local_174)))->Vector::operator_assign(vecResult); - } - else { - (GHIDRA_CAST((&local_174)))->Vector::Normalize(); - } - tractorBeam = GHIDRA_CAST(__RTDynamicCast()); - if (this->_tractorBeam == 0) { - uVar29 = Random(); - Game::Spawn(g_game,7,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar29); - tractorBeam = GHIDRA_CAST(__RTDynamicCast()); - (GHIDRA_CAST((GHIDRA_CAST(tractorBeam))))->Entity::SetParent(GHIDRA_CAST(this)); - tractorBeam->Update(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_tractorBeam))))->EntityPtr::SetReference(GHIDRA_CAST(tractorBeam)); - } - local_120 = GHIDRA_CAST(0x41400000); - vecResult = (GHIDRA_CAST((&local_174)))->Vector::__mul(&local_16c,GHIDRA_CAST(&local_120)); - in_stack_fffffdbc = GHIDRA_CAST(0x785f36); - GetLaserOffset(this,&scratchVec,6,vecResult); - (GHIDRA_CAST((GHIDRA_CAST(tractorBeam))))->Entity::SetPositionOffset(offset); - local_120 = GHIDRA_CAST((GHIDRA_CAST((&local_174)))->Vector)::GetAngleDegrees(); - fVar30 = normalize_angle_degrees((float)local_120); - (GHIDRA_CAST((tractorBeam)))->Entity_NPC::SetAimAngle(fVar30); - if (local_174.y <= -0.5) { - fVar30 = -10.0; - } - else { - fVar30 = 3000.0; - } - set_field_358(tractorBeam,fVar30); - bVar3 = IsExtraAnimationFinished(this); - if (bVar3 != 0) { - IsHoldingItem(this); - } - FUN_0044bf90(); - local_120 = GHIDRA_CAST(&DAT_00000005); - piVar14 = GHIDRA_CAST(std)::max(); - this->_blinkTime = *piVar14; - } - local_144.y = (float)(GHIDRA_UINT(local_144.y) & 0xffffff00); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if ((cVar4 != '\0') && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ed2)))) != 0)) { - sVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ed2)))) + -1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ed2)))) = sVar5; - local_144.y = (float)(GHIDRA_UINT(local_144.y) & 0xff); - if (sVar5 == 0) { - local_144.y = 1.4013e-45; - } - } - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - tempEffects = GHIDRA_CAST(FUN_004360d0()); - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x1de); - if (((bVar3 != 0) && ((this->_fireDirection != -1 || ((this->_lastActionTriggers & 4) != 0)))) - || ((*GHIDRA_CAST((GHIDRA_CAST(&(local_144.y)) + 0x0))) != '\0')) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - tempEffects = GHIDRA_CAST(FUN_004360d0()); - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x1de,1); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00821940(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ed2)))) = 0; - } - } - if (this->_moveDirection != -1) { - this->_lastActionTriggers = this->_lastActionTriggers | 2; - } - if (this->_fireDirection != -1) { - this->_lastActionTriggers = this->_lastActionTriggers | 4; - } - bVar3 = HasCollectible(this,0xd2,0); - if ((bVar3 == 0) || (this->_lastActionTriggers != 0)) { - if (this->_mass == 1000.0) { - itemConfig = Isaac::GetItemConfig(); - itemCfg = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(4); - RemoveCostume(this,itemCfg); - this->_mass = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x44)); - } - this->_gnawedLeafTimer = 0; - } - else { - iVar6 = this->_gnawedLeafTimer; - this->_gnawedLeafTimer = iVar6 + 1; - if (0x3c < iVar6) { - if (this->_mass != 1000.0) { - SoundEffects::PlayWithFartOverride(0x35a,1.0,2,0,1.0); - itemConfig = Isaac::GetItemConfig(); - bVar3 = 0; - itemCfg = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(4); - AddCostume(this,itemCfg,bVar3); - this->_mass = 1000.0; - uVar29 = Random(); - in_stack_fffffdbc = GHIDRA_CAST(0x0); - Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),2,uVar29); - tmpEntity = GHIDRA_CAST(__RTDynamicCast()); - this = player; - vecResult = (GHIDRA_CAST((&local_16c)))->Vector::Vector(0.0,-10.0); - vecResult = (GHIDRA_CAST((&this->_posOffset)))->Vector::__add(&scratchVec,vecResult); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(vecResult); - set_field_358(tmpEntity,(this->_posOffset).y + 1.0); - tmpEntity->Update(); - } - if ((this->_variant == 1) || (this->_isCoopGhost != 0)) { - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::SetColorize(1.0,1.0,1.0,1.0); - in_stack_fffffdbc = GHIDRA_CAST(0x2); - this->SetColor(); - } - } - } - if (this->_mass != 1000.0) { - this->_mass = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x44)); - } - tempEffects = &this->_temporaryeffects; - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x251); - if (((bVar3 == 0) && (this->_ponyCharge < 1)) && - (bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x2ca), bVar3 == 0)) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x40000000); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x40000000); - } - cVar4 = Level::GetHeartPicked(GHIDRA_CAST(tempEffects)); - if (cVar4 != '\0') { - this->_cacheFlags = this->_cacheFlags | tempEffects->_cacheFlags; - EvaluateItems(this); - } - FUN_00753790(); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::Update(); - update_effects(this); - } - if (this->_montezumaLaser != (void *)0x0) { - projectile = GHIDRA_CAST(FUN_00435df0()); - if (projectile != GHIDRA_CAST(0x0)) { - projectileAngle = (long double)(GHIDRA_CAST((projectile)))->Entity_Projectile::Damage(); - Vector::FromAngle(&local_13c,(float)projectileAngle); - local_120 = GHIDRA_CAST(0xc1600000); - Vector::operator_mul(&local_16c,GHIDRA_CAST(&local_120),&local_13c); - FUN_00753750(); - in_stack_fffffdbc = GHIDRA_CAST(0x7863f7); - GetLaserOffset(this,&local_174,-1,&local_13c); - local_120 = GHIDRA_CAST(0x41500000); - vecResult = Vector::operator_mul(&scratchVec,GHIDRA_CAST(&local_120),&local_13c); - (GHIDRA_CAST((&local_174)))->Vector::operator_add_assign(vecResult); - local_174.y = local_174.y - (this->_bodyScale).y * 4.0; - (GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity::SetPositionOffset(&local_174); - if (local_13c.y <= -0.5) { - fVar30 = -40.0; - } - else { - fVar30 = 3000.0; - } - set_field_358(projectile,fVar30); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - local_164.y = (float)Random(); - fVar30 = random_float(); - vecResult = (GHIDRA_CAST((&local_13c)))->Vector::Rotated(&local_16c,fVar30 * 90.0 - 45.0); - fVar30 = random_float(); - local_120 = GHIDRA_CAST((fVar30 * 10.0 + 6.0)); - in_stack_fffffdbc = (GHIDRA_CAST((vecResult)))->Vector::__mul(&scratchVec,GHIDRA_CAST(&local_120)); - local_130 = GHIDRA_CAST(&player->_pos); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->Vector::__add(&local_17c,&local_174); - local_150.y = 14.0; - vecResult2 = Vector::operator_mul(&local_144,&local_150.y,&local_13c); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&local_158,vecResult2); - tmpEntity = Game::Spawn(g_game,1000,99,vecResult,in_stack_fffffdbc,GHIDRA_CAST(0x0),1, - GHIDRA_UINT(local_164.y)); - vecResult = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::SpriteScale(); - fVar30 = random_float(); - local_164.y = fVar30 * 1.5 + 1.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&local_190,&local_164.y); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - ::(GHIDRA_CAST((GHIDRA_CAST((local_f0 + 0x2c)))))->Color::Color(0.6,0.34,0.26,1.0); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(color_01); - set_field_358(tmpEntity,20.0); - tmpEntity->Update(); - iVar6 = Isaac::Random(5); - if (iVar6 == 0) { - local_164.y = (float)Random(); - fVar30 = random_float(); - vecResult = (GHIDRA_CAST((&local_13c)))->Vector::Rotated(&local_16c,fVar30 * 90.0 - 45.0); - fVar30 = random_float(); - local_120 = GHIDRA_CAST((fVar30 * 3.0 + 2.0)); - in_stack_fffffdbc = (GHIDRA_CAST((vecResult)))->Vector::__mul(&scratchVec,GHIDRA_CAST(&local_120)); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->Vector::__add(&local_17c,&local_174); - local_150.y = 14.0; - vecResult2 = Vector::operator_mul(&local_144,&local_150.y,&local_13c); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&local_158,vecResult2); - tmpEntity = Game::Spawn(g_game,1000,0x3a,vecResult,in_stack_fffffdbc,GHIDRA_CAST(0x0),0, - GHIDRA_UINT(local_164.y)); - tmpEntity->Update(); - } - iVar6 = Isaac::Random(5); - if (iVar6 == 0) { - local_164.y = (float)Random(); - fVar30 = random_float(); - vecResult = (GHIDRA_CAST((&local_13c)))->Vector::Rotated(&local_16c,fVar30 * 30.0 - 15.0); - fVar30 = random_float(); - local_120 = GHIDRA_CAST((fVar30 * 5.0 + 6.0)); - in_stack_fffffdbc = (GHIDRA_CAST((vecResult)))->Vector::__mul(&scratchVec,GHIDRA_CAST(&local_120)); - vecResult = (GHIDRA_CAST((&local_17c)))->Vector::Vector(local_174.x,0.0); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_130))))->Vector::__add(&local_144,vecResult); - local_150.y = 14.0; - vecResult2 = Vector::operator_mul(&local_158,&local_150.y,&local_13c); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&local_190,vecResult2); - projectile = (Entity_Projectile *) - Game::Spawn(g_game,9,5,vecResult,in_stack_fffffdbc,GHIDRA_CAST(player),0, - GHIDRA_UINT(local_164.y)); - uVar29 = 0x80; - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (cVar4 == '\0') { - uVar29 = 0x80000080; - } - (GHIDRA_CAST((projectile)))->Entity_Projectile::set_projectile_flags((uint64_t)uVar29); - projectile->Update(); - } - this = player; - } - } - } - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - ANM2::Update(&this->_heldSprite); - ANM2::Update(&this->_crownOfLightSprite); - ANM2::Update(&this->_darkPrincesCrownSprite); - pAVar19 = this->_chargeBarSprites; - iVar6 = 7; - do { - ANM2::Update(pAVar19); - this = player; - pAVar19 = pAVar19 + 1; - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - ANM2::Update(&player->_bloodGushSprite); - } - local_120 = GHIDRA_CAST(&this->_sprite); - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_120))))->Sprite)::Scale(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_crownOfLightSprite))))->Sprite::SetScale(vecResult); - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Scale(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_darkPrincesCrownSprite))))->Sprite::SetScale(vecResult); - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Scale(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_bloodGushSprite))))->Sprite::SetScale(vecResult); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x0))) = ZEXT812(0x42700000); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0; - local_150.y = (float)BVar25._l; - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(&this->_playerSpriteScale); - cVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::IsLoaded(); - if ((cVar4 != '\0') && - ((bVar3 = ANM2::IsPlaying(&this->_bodySprite,&s_empty), bVar3 != 0 && - (pvVar15 = (GHIDRA_CAST((GHIDRA_CAST(&this->_bodySprite))))->Sprite::GetNullFrame(GHIDRA_CAST("ItemWalk")), - pvVar15 != (void *)0x0)))) { - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Scale(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Mul(&local_13c,GHIDRA_CAST((GHIDRA_INT(pvVar15) + 0x10))); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetScale(vecResult); - } - local_16c.x = g_vectorOne.x; - local_16c.y = g_vectorOne.y; - if ((-1 < this->_playerCostumeMap[4]._index) && - ((iVar6 = FUN_005cbd10(), *GHIDRA_CAST((iVar6 + 0x114)) == 0 || - ((iVar6 = FUN_005cbd10(), *GHIDRA_CAST((*GHIDRA_CAST((iVar6 + 0x114)) + 4)) != 0x256 && - (iVar6 = FUN_005cbd10(), *GHIDRA_CAST((*GHIDRA_CAST((iVar6 + 0x114)) + 4)) != 0x2b0)))))) { - FUN_005cbd10(); - Config::GetPillEffects(); - cVar4 = FUN_004073a0(); - if (cVar4 == '\0') { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - pvVar15 = AnimationState::GetLayerFrame(animState,this->_playerCostumeMap[4]._layerID); - if (pvVar15 != (void *)0x0) { - spawnedEffect = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x1c)); - Math::abs(); - fVar30 = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 0x18)); - local_164.y = (float)spawnedEffect; - Math::abs(); - vecResult = (GHIDRA_CAST((&local_13c)))->Vector::Vector(fVar30,local_164.y); - (GHIDRA_CAST((&local_16c)))->Vector::operator_assign(vecResult); - } - } - } - local_148 = GHIDRA_CAST(g_vectorOne.x); - local_188 = g_vectorOne.x; - local_128 = GHIDRA_CAST(g_vectorOne.y); - local_190.y = g_vectorOne.y; - local_158.y = 0.0; - bVar3 = HasCollectible(this,0x1ed,0); - if (((bVar3 != 0) || - (bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ed), bVar3 != 0) - ) && (bVar3 = IsExtraAnimationFinished(this), bVar3 != 0)) { - uVar29 = ((this->_boneHearts * 2 - this->_redHearts) + this->_maxHearts) / 2; - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (cVar4 != '\0') { - uVar29 = uVar29 >> 2; - } - local_164.y = (float)GHIDRA_INT(uVar29) / 24.0; - local_190.y = 1.0 - (1.0 - local_164.y) * (1.0 - local_164.y); - fVar30 = local_164.y * 9.0 * local_164.y + 1.0; - local_144.y = ((fVar30 + fVar30) * 3.1415927) / 30.0; - iVar6 = Game::GetFrameCount(g_game); - local_130 = GHIDRA_CAST((local_190.y * 0.5)); - auVar24 = ZEXT416(GHIDRA_UINT(((float)iVar6 * local_144.y))); - FUN_00417150(); - fVar30 = ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x0))) * 0.5 + 0.5) * 1.2; - pow_wrapper(); - local_158.y = (fVar30 - 0.2) * (float)local_130 + 1.0; - iVar6 = Game::GetFrameCount(g_game); - auVar24 = ZEXT416(GHIDRA_UINT(((float)(iVar6 + -3) * local_144.y))); - FUN_00417150(); - fVar30 = ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x0))) * 0.5 + 0.5) * 1.2; - pow_wrapper(); - fVar30 = (fVar30 - 0.2) * local_164.y * local_164.y; - local_148 = GHIDRA_CAST(((1.0 / local_158.y - 1.0) * 0.5 + 1.0 + fVar30)); - local_128 = GHIDRA_CAST((fVar30 * 0.5 + local_158.y)); - iVar6 = Game::GetFrameCount(g_game); - auVar24 = ZEXT416(GHIDRA_UINT(((float)(iVar6 + 10) * local_144.y))); - FUN_00417150(); - fVar30 = ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x0))) * 0.5 + 0.5) * 1.2; - pow_wrapper(); - local_158.y = (fVar30 - 0.2) * (float)local_130; - iVar6 = Game::GetFrameCount(g_game); - auVar24 = ZEXT416(GHIDRA_UINT(((float)(iVar6 + 0x14) * local_144.y))); - FUN_00417150(); - fVar30 = ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x0))) * 0.5 + 0.5) * 1.2; - pow_wrapper(); - local_190.y = (fVar30 - 0.2) * local_190.y * 0.1 + 1.0; - local_188 = 1.0 / local_190.y; - } - scratchVec.x = g_vectorOne.x; - local_174.x = g_vectorZero.x; - scratchVec.y = g_vectorOne.y; - local_174.y = g_vectorZero.y; - if (-1 < this->_playerCostumeMap[1]._index) { - sprite = GHIDRA_CAST(FUN_005cbd10()); - vecResult = (GHIDRA_CAST((sprite)))->Sprite::GetNullFrame(GHIDRA_CAST("HeadTransform")); - if ((vecResult != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST(&vecResult[1].y) != '\0')) { - (GHIDRA_CAST((&local_174)))->Vector::operator_assign(vecResult); - (GHIDRA_CAST((&scratchVec)))->Vector::operator_assign(vecResult + 2); - if (this->_playerType == 0x20) { - iVar7 = 0; - iVar6 = FUN_0042d040(); - if (iVar6 != 0) { - FUN_0042d040(); - iVar7 = FUN_0067efb0(); - } - local_174.y = local_174.y - ((float)iVar7 + (float)iVar7); - } - } - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Entity::AddFlagsLow(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::Color(); - bVar3 = HasCollectible(this,0xca,0); - if ((bVar3 != 0) && - (((bVar3 = HasCollectible(this,0xd2,0), bVar3 != 0 && (this->_mass == 1000.0)) || - (bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x3b), bVar3 != 0)))) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c811c8) && - (_Init_thread_header(), DAT_00c811c8 == -1)) { - local_8 = 6; - in_stack_fffffdbc = GHIDRA_CAST(0x3f800000); - ::(GHIDRA_CAST(()))->Color::Color(); - local_8 = 0xffffffff; - _Init_thread_footer(); - } - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(GHIDRA_CAST(&DAT_00c811cc)); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::__mul(GHIDRA_CAST(&DAT_00c811cc)); - } - iVar6 = this->_bladderCharge; - if (iVar6 < 1) { - local_164.y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20a4)))); - if (0.0 < local_164.y) { - if (1.0 <= local_164.y) { - iVar6 = Game::GetFrameCount(g_game); - sinf_wrapper((float)iVar6 * 0.2); - } - colorBuf = &local_11c; - goto LAB_00786ffb; - } - } - else { - local_164.y = (float)iVar6 / (float)this->_maxBladderCharge; - if (this->_maxBladderCharge <= iVar6) { - iVar6 = Game::GetFrameCount(g_game); - sinf_wrapper((float)iVar6 * 0.2); - } - colorBuf = GHIDRA_CAST((local_f0 + 0x2c)); -LAB_00786ffb: - ::(GHIDRA_CAST((colorBuf)))->Color::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(other_00); - } - if ((0 < this->_flashCountdown) || - (iVar6 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(699), iVar6 == 4) - ) { - iVar6 = Game::GetFrameCount(g_game); - sinf_wrapper((float)iVar6 * 0.2); - ::(GHIDRA_CAST((GHIDRA_CAST((local_98 + 0x2c)))))->Color::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(other_01); - } - if (0 < this->_maggySwingCooldown) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - this->_maggySwingCooldown = this->_maggySwingCooldown + -1; - } - local_130 = GHIDRA_CAST(&DAT_00000006); - local_164.y = (float)(8 - this->_maggySwingCooldown); - msvc::min(); - local_144.y = 0.0; - piVar14 = GHIDRA_CAST(std)::max(); - fVar30 = *GHIDRA_CAST((&DAT_00b6bc98 + *piVar14 * 4)); - local_188 = (2.0 - fVar30) * local_188; - local_148 = GHIDRA_CAST(((2.0 - fVar30) * (float)local_148)); - local_128 = GHIDRA_CAST((fVar30 * (float)local_128)); - local_190.y = fVar30 * local_190.y; - local_158.y = (fVar30 - 1.0) * 4.0 + local_158.y; - } - if (0.0 < this->_jellyBellyBounceTimer) { - local_164.y = this->_jellyBellyBounceTimer - this->_speedMultiplier; - local_130 = GHIDRA_CAST(0x0); - pfVar8 = GHIDRA_CAST(std)::max(); - fVar30 = *pfVar8; - this->_jellyBellyBounceTimer = fVar30; - fVar30 = sinf_wrapper(((fVar30 + fVar30) * 3.1415927) / 10.0); - fVar21 = this->_jellyBellyBounceTimer + 1.0; - local_164.y = 1.0 - (this->_jellyBellyBounceTimer / 20.0) * fVar30 * 0.4; - fVar30 = sinf_wrapper(((fVar21 + fVar21) * 3.1415927) / 10.0); - fVar30 = 1.0 - ((this->_jellyBellyBounceTimer + 1.0) / 20.0) * fVar30 * 0.4; - local_128 = GHIDRA_CAST((local_164.y * (float)local_128)); - local_148 = GHIDRA_CAST(((2.0 - local_164.y) * (float)local_148)); - local_188 = (2.0 - fVar30) * local_188; - local_190.y = fVar30 * local_190.y; - local_158.y = (fVar30 - 1.0) * 3.0 + local_158.y; - } - bVar3 = HasCollectible(this,0x251,0); - if (((bVar3 != 0) && (this->_marsCooldown < 1)) && - (iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), iVar6 % 0x1e < 2)) { - in_stack_fffffdbc = GHIDRA_CAST(0x3f800000); - tmpColor = (ColorMod *)::(GHIDRA_CAST(()))->Color::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(tmpColor); - } - pvVar15 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetNullEffect(0x3f); - if ((pvVar15 != (void *)0x0) && (uVar29 = *GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 8)), GHIDRA_INT(uVar29) < 0x5a)) { - fVar30 = (float)(uVar29 & 0x8000000f); - if (GHIDRA_INT(fVar30) < 0) { - fVar30 = (float)((GHIDRA_INT(fVar30) - 1U | 0xfffffff0) + 1); - } - local_164.y = (float)(uVar29 & 0x80000007); - if (GHIDRA_INT(local_164.y) < 0) { - local_164.y = (float)((GHIDRA_INT(local_164.y) - 1U | 0xfffffff8) + 1); - } - if (0x17 < GHIDRA_INT(uVar29)) { - local_164.y = fVar30; - } - if (GHIDRA_INT(local_164.y) < 5) { - tmpColor = (ColorMod *)::(GHIDRA_CAST(()))->Color::Color(); - ::(GHIDRA_CAST((&local_11c)))->Color::Color(); - in_stack_fffffdbc = GHIDRA_CAST((local_98 + 0x2c)); - ::Color::Lerp(GHIDRA_CAST(in_stack_fffffdbc),from,tmpColor,(float)GHIDRA_INT(local_164.y) * 0.25); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(GHIDRA_CAST((local_98 + 0x2c))); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::__mul(GHIDRA_CAST((local_98 + 0x2c))); - } - } - auVar22 = ZEXT812(0); - local_130 = GHIDRA_CAST(0x0); - if (1 < this->_reverseChariotMoveCooldown) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0xc))) = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x10))) = (void *)0xbf000000; - puStack_54 = &DAT_bf800000; - fStack_50 = 0.5; - local_4c = 2.0; - local_48 = 0x3f800000; - local_44 = (void *)0x0; - local_164.y = 8.40779e-45; - piVar14 = GHIDRA_CAST(std)::min(); - local_130 = *GHIDRA_CAST((local_68 + *piVar14 * 4 + 0xc)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x4))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar22)) + 0x0))) = local_130; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x0))) = auVar22; - bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x2c0); - if (bVar3 != 0) { - fVar30 = sinf_wrapper(this->_updateTime * 1.5707964); - local_174.x = fVar30 + local_174.x; - fVar30 = sinf_wrapper(this->_updateTime * 1.2566371); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = - GHIDRA_CAST(((SUB124(ZEXT812(0x3f800000),0) - (fVar30 * 0.5 + 0.5)) * 0.4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = SUB128(ZEXT812(0x3f800000),4); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0; - in_stack_fffffdbc = GHIDRA_CAST(0x0); - ::(GHIDRA_CAST(()))->Color::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(GHIDRA_CAST((local_98 + 0x2c))); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::__mul(GHIDRA_CAST((local_98 + 0x2c))); - } - iVar6 = Game::Challenge(g_game); - if (iVar6 == 0x2a) { - if (this->_playerType == 0x23) { - itemConfig = Isaac::GetItemConfig(); - local_13c.y = (float)(GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x6a); - costumeMap = this->_playerCostumeMap; - local_164.y = 0.0; - do { - if (((-1 < costumeMap->_index) && (costumeMap->_isBodyLayer == 0)) && - (local_144.y = (float)FUN_005cbd10(), - *GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_144.y) + 0x114)))->_filename)._buf) == - GHIDRA_CAST(local_13c.y))) { - FUN_0041e470(); - cVar4 = FUN_004073a0(); - fVar30 = local_144.y; - if (cVar4 == '\0') { - if ((this->_isPlayingExtraAnimation == 0) && (this->_isPlayingItemAnimation == 0)) { - cVar4 = FUN_0040aa70(); - if (cVar4 != '\0') { - ANM2::PlayOverlay(GHIDRA_CAST(fVar30),GHIDRA_CAST("Pulse"),1); - pBVar12 = GHIDRA_CAST(local_24); - uVar28 = 0x7876a1; - pBVar31 = GetBombFlags(this,pBVar12,0); - uVar32 = 0; - local_24 = *(uint8_t (*) [4])&pBVar31->_l; - fStack_20 = *GHIDRA_CAST((GHIDRA_INT(&pBVar31->_l) + 4)); - VStack_1c.x = *GHIDRA_CAST(&pBVar31->_h); - VStack_1c.y = *GHIDRA_CAST((GHIDRA_INT(&pBVar31->_h) + 4)); - FUN_00435bc0(); - GetBombVariant(); - FUN_00435bc0(); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = uVar28; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = GHIDRA_CAST(in_stack_fffffdbc); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = pBVar12; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = uVar32; - fVar30 = check_bomb_tearflags(this,tearFlags); - if (1.5 <= fVar30) { - local_150.y = 110.0; - } - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::GetColor(); - activeDesc = player; - vecResult = MusicManager::RandomVector(&local_13c); - vecResult = (GHIDRA_CAST((&activeDesc->_pos)))->Vector::__add(&local_164,vecResult); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags_00._l)) + 0x4))) = fStack_20; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags_00._l)) + 0x0))) = local_24; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags_00._h)) + 0x0))) = VStack_1c.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags_00._h)) + 0x4))) = VStack_1c.y; - Game::BombExplosionEffects - (g_game,vecResult,local_150.y,tearFlags_00,tmpColor,GHIDRA_CAST(activeDesc) - ,1.25,1,4,1); - (GHIDRA_CAST((&activeDesc->_velocity)))->Vector::operator_assign(&g_vectorZero); - vfunc = *(code **)(*GHIDRA_CAST(activeDesc) + 0x54); - vecResult = MusicManager::RandomVector(&local_150); - fVar30 = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST((fVar30 * 3.0 + 2.0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = extraout_var; - local_13c.y = (float)GHIDRA_CAST(BVar25._l); - (GHIDRA_CAST((vecResult)))->Vector::__mul(&local_164,&local_13c.y); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (*vfunc)(); - this = player; - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_144.y))))->Sprite::RemoveOverlay(); - } - } - else { - ANM2::PlayOverlay(GHIDRA_CAST(local_144.y),GHIDRA_CAST("Pulse"),0); - } - FUN_0041e470(); - cVar4 = FUN_004073a0(); - if (cVar4 == '\0') { - animState = GHIDRA_CAST(FUN_0041e470()); - vecResult = AnimationState::GetNullFrame(animState,GHIDRA_CAST("HeadAnim")); - if (vecResult != GHIDRA_CAST(0x0)) { - FUN_00a10570(); - (GHIDRA_CAST((&local_174)))->Vector::operator_add_assign(vecResult); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(GHIDRA_CAST((vecResult + 3))); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::__mul(GHIDRA_CAST((vecResult + 3))); - } - } - break; - } - local_164.y = (float)(GHIDRA_INT(local_164.y) + 1); - costumeMap = costumeMap + 1; - } while (GHIDRA_UINT(local_164.y) < 0xf); - goto LAB_0078784d; - } - } - else { -LAB_0078784d: - if (this->_playerType == 0x23) { - local_174.y = local_174.y + this->_forgottenBHeight; - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(local_174.y)); - } - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000); - if (((bVar3 != 0) && ((this->_entityRef2)._entity == this)) && (this->_bleedOutHealth < 0x96)) { - fVar30 = (float)this->_bleedOutHealth / 150.0; - ::(GHIDRA_CAST((GHIDRA_CAST((local_98 + 0x2c)))))->Color::Color(1.0,fVar30,fVar30,1.0); - ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::__mul(GHIDRA_CAST((local_98 + 0x2c))); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::__mul(GHIDRA_CAST((local_98 + 0x2c))); - } - bVar3 = IsLocalPlayer(this); - if (bVar3 == 0) { - FUN_00417900(); - FUN_00925df0(); - local_150.y = (float)BVar25._l; - fVar30 = ::(GHIDRA_CAST((GHIDRA_CAST(local_f0))))->Color::A(); - Font::SetLineHeightModifier(GHIDRA_CAST(local_f0),fVar30 * local_150.y); - fVar30 = ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::A(); - Font::SetLineHeightModifier(GHIDRA_CAST(local_98),fVar30 * local_150.y); - } - if (this->_isPlayingExtraAnimation == 0) { -LAB_00787961: - local_121 = '\0'; - } - else { - bVar3 = IsCollectibleCostumeVisible(this,0x271,-1); - local_121 = '\x01'; - if (bVar3 != 0) goto LAB_00787961; - } - local_164.y = (float)&this->_sprite; - pbVar16 = GHIDRA_CAST(0x0); - local_150.y = (float)&this->_playerCostumeMap[0]._isBodyLayer; - do { - if (*GHIDRA_CAST((void **))local_150.y == '\0') { - tmpColor = GHIDRA_CAST(local_f0); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - ::(GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(tmpColor); - vecResult = &this->_headScale; - if (local_121 == '\0') { - vecResult = (GHIDRA_CAST((&local_174)))->Vector::Mul(&local_144,&this->_bodyScale); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (GHIDRA_CAST((&layer->_pos)))->Vector::operator_assign(vecResult); - vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::Mul(GHIDRA_CAST(&local_1a0._h),&this->_headScale); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Mul(&VStack_1c,&local_16c); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(vecResult); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (layer->_size).x = local_188 * (layer->_size).x; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (layer->_size).y = local_190.y * (layer->_size).y; - local_13c.y = ((this->_headScale).y - (this->_bodyScale).y) * 2.5 + local_158.y * 8.0; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (layer->_pos).y = local_13c.y + (layer->_pos).y; - goto LAB_00787b47; - } -LAB_00787a31: - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(vecResult); - vecResult = &g_vectorZero; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (GHIDRA_CAST((&layer->_pos)))->Vector::operator_assign(vecResult); - } - else { - tmpColor = GHIDRA_CAST(local_98); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - ::(GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(tmpColor); - vecResult = &this->_bodyScale; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(vecResult); - if (local_121 != '\0') { - vecResult = &g_vectorOne; - goto LAB_00787a31; - } - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (layer->_size).x = (float)local_148 * (layer->_size).x; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - (layer->_size).y = (float)local_128 * (layer->_size).y; -LAB_00787b47: - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(pbVar16); - BVar25 = (BitSet128)ZEXT416(local_130); - (layer->_pos).x = (float)local_130; - } - pbVar16 = pbVar16 + 1; - local_150.y = (float)((GHIDRA_CAST((GHIDRA_INT(local_150.y) + 8)))->_buf + 8); - } while (GHIDRA_INT(pbVar16) < 0xf); - FUN_005cbe20(); - local_8 = 7; - local_158.y = 0.0; - do { - local_130 = GHIDRA_CAST((this->_playerCostumeMap + GHIDRA_INT(local_158.y))); - if (-1 < *GHIDRA_CAST(local_130)) { - if ((*GHIDRA_CAST((GHIDRA_CAST((local_130)) + 0xc))) == '\0') { - sprite = GHIDRA_CAST(FUN_005cbd10()); - if (GHIDRA_CAST(0x3) < GHIDRA_UINT(local_158.y)) { - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_164.y))))->Sprite)::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST((local_228 + -7)))))->Color::operator_assign(tmpColor); - goto LAB_00787c20; - } - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(tmpColor); - } - else { - sprite = GHIDRA_CAST(FUN_005cbd10()); - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_120))))->Sprite)::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST((local_228 + -7)))))->Color::operator_assign(tmpColor); -LAB_00787c20: - tmpColor = GHIDRA_CAST(FUN_004072e0()); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(tmpColor); - this = player; - } - sprite = GHIDRA_CAST(FUN_005cbd10()); - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Scale(); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(vecResult); - activeDesc = local_130; - sprite = GHIDRA_CAST(FUN_005cbd10()); - local_150.y = (float)(GHIDRA_CAST((sprite)))->Sprite::GetLayer(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((activeDesc)) + 0x4))))); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(local_158.y)); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x34)))))->Vector::operator_assign(&layer->_size); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(local_158.y)); - fVar30 = local_150.y; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_150.y) + 0x40)))))->Vector::operator_assign(&layer->_pos); - activeDesc = local_130; - if (GHIDRA_CAST(local_158.y) == GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((GHIDRA_CAST(fVar30) + 0x8c)) = *GHIDRA_CAST((GHIDRA_CAST(fVar30) + 0x8c)) | 1; - } - msvc::set::insert(); - if ((((*GHIDRA_CAST((GHIDRA_CAST((activeDesc)) + 0xc))) != '\0') && - (iVar6 = FUN_005cbd10(), *GHIDRA_CAST((iVar6 + 0x114)) != 0)) && - ((iVar6 = FUN_005cbd10(), **GHIDRA_CAST((iVar6 + 0x114)) == 0 && - (iVar6 = FUN_005cbd10(), *GHIDRA_CAST((*GHIDRA_CAST((iVar6 + 0x114)) + 4)) == 0x5a)))) { - local_144.y = 0.0; - iVar6 = FUN_0042d040(); - if (iVar6 != 0) { - FUN_0042d040(); - local_144.y = (float)FUN_0067efb0(); - } - bVar3 = IsHoldingItem(this); - if (bVar3 != 0) { - local_144.y = 0.0; - } - sprite = GHIDRA_CAST(FUN_005cbd10()); - local_13c.y = (float)GHIDRA_INT(local_144.y) * 96.0; - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((activeDesc)) + 0x4))))); - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(local_13c.y)); - (layer->_cropOffset).y = local_13c.y; - } - } - local_158.y = (float)(GHIDRA_INT(local_158.y) + 1); - } while (GHIDRA_UINT(local_158.y) < &DAT_0000000f); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - FUN_0042c770(); - msvc::iterator_copy(&local_17c,&local_150.y); - cVar4 = FUN_0042c710(); - if (cVar4 != '\0') { - local_164.y = (float)&this->_costumeSpriteDescs; - do { - FUN_005cba30(); - tmpEntity = GHIDRA_CAST(FUN_005cbd10()); - local_13c.y = (float)tmpEntity; - (GHIDRA_CAST((tmpEntity)))->Entity::AddFlagsLow(); - ANM2::Update(GHIDRA_CAST(tmpEntity)); - FUN_0041e470(); - cVar4 = FUN_004073a0(); - if (cVar4 == '\0') { - pAVar19 = GHIDRA_CAST(FUN_0041e470()); - ANM2::GetAnimation(pAVar19,GHIDRA_CAST((local_68 + 0x10))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 8; - local_15c = GHIDRA_CAST((GHIDRA_UINT(local_15c) | 1)); - local_158.y = (float)local_15c; - iVar6 = FUN_006da7d0(); - local_128 = GHIDRA_CAST(CONCAT13(1,(undefined3)local_128)); - if (iVar6 != 0) goto LAB_00787ec4; - } - else { -LAB_00787ec4: - local_128 = GHIDRA_CAST((GHIDRA_UINT(local_128) & 0xffffff)); - } - local_8 = 7; - if ((GHIDRA_UINT(local_15c) & 1) != 0) { - local_15c = GHIDRA_CAST((GHIDRA_UINT(local_15c) & 0xfffffffe)); - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) != '\0') { - gridEntity = GHIDRA_CAST(FUN_0041e470()); - iVar6 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(); - fVar30 = local_13c.y; - if (iVar6 != 0) { - pbVar16 = GHIDRA_CAST(0x0); - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_13c.y))))->Sprite::GetLayerCount(); - if (iVar6 != 0) { - do { - animState = GHIDRA_CAST(FUN_0041e470()); - tmpEntity = AnimationState::GetLayerFrame(animState,GHIDRA_INT(pbVar16)); - local_13c.y = (float)tmpEntity; - if (tmpEntity != GHIDRA_CAST(0x0)) { - layer = (GHIDRA_CAST((GHIDRA_CAST(fVar30))))->Sprite::GetLayer(pbVar16); - (GHIDRA_CAST((&layer->_cropOffset)))->Vector::operator_assign(GHIDRA_CAST(tmpEntity)); - (GHIDRA_CAST((GHIDRA_CAST(fVar30))))->Sprite::GetLayer(pbVar16); - FUN_00a10570(); - } - pbVar16 = pbVar16 + 1; - layerCount = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(fVar30))))->Sprite)::GetLayerCount(); - } while (pbVar16 < layerCount); - } - } - } - set_iterator_post_increment(&local_144.y,&local_130,0); - msvc::iterator_copy(&local_17c,&local_150.y); - cVar4 = FUN_0042c710(); - } while (cVar4 != '\0'); - this = player; - } - } - local_8 = 0xffffffff; - FUN_00424420(); - } - if (this->_dead == 0) { - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - pvVar15 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x11a); - if (pvVar15 != (void *)0x0) { - itemConfig = Isaac::GetItemConfig(); - itemCfg = ItemConfig::GetCollectible(itemConfig,0x11a); - local_164.y = (float)itemCfg->maxCooldown; - local_13c.y = 0.0; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - tmpEntity = GHIDRA_CAST(local_13c.y); - } - else { - tmpEntity = GHIDRA_CAST(0x3f000000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = - (Entity_Effect *) - (SUB124(ZEXT812(0x3f800000),0) - - (((float)*GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 8)) - (float)tmpEntity) - 1.0) / - ((float)GHIDRA_INT(local_164.y) - 2.0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = SUB128(ZEXT812(0x3f800000),4); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0; - local_150.y = (float)GHIDRA_CAST(BVar25._l); - vecResult = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(&VStack_1c,&this->_pos); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(GHIDRA_CAST(&local_1a0._h),&local_150.y); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&local_16c,&local_150.y); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_add_assign(vecResult); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - entityList = GHIDRA_CAST(FUN_00421780()); - iVar6 = (GHIDRA_CAST((entityList)))->EntityList::Size(); - if ((iVar6 == 0x21) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 8)) == 1)) { - uVar29 = Random(); - spawnedEffect = - (Entity_Effect *) - Game::Spawn(g_game,1000,0x3d,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar29); - (GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity::SetParent(GHIDRA_CAST(this)); - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(this->_size)); - (GHIDRA_CAST((spawnedEffect)))->Entity_Effect::SetRadii(this->_size,90.0); - (GHIDRA_CAST((spawnedEffect)))->Entity_Effect::SetTimeout(10); - } - } - tempEffects = &this->_temporaryeffects; - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x146); - local_128 = GHIDRA_CAST(CONCAT13(bVar3,(undefined3)local_128)); - bVar3 = HasCollectible(this,0x3b,0); - if ((bVar3 != 0) && - ((bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x11a), bVar3 != 0 || - ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) != '\0')))) { - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(4.0,0.0); - if (iVar6 != 0) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - ::(GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - } - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0); - if (iVar6 != 0) { - (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_16c,&this->_posOffset); - local_13c.y = (float)ANM2::GetLayer(&this->_sprite,GHIDRA_CAST("extra")); - if (GHIDRA_CAST(local_13c.y) != GHIDRA_CAST(0x0)) { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar6 = _ptr_deref_or_minus1(); - pvVar15 = AnimationState::GetLayerFrame(animState,iVar6); - if (pvVar15 != (void *)0x0) { - vecResult = GHIDRA_CAST(FUN_0067f2e0()); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(&local_1a0._h))))->Vector::Vector(0.0,-10.0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&scratchVec,vecResult2); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Mul(&local_17c,&this->_playerSpriteScale); - (GHIDRA_CAST((&local_16c)))->Vector::operator_add_assign(vecResult); - } - } - uVar29 = Random(); - local_13c.y = 0.1; - vecResult = (GHIDRA_CAST((&player->_velocity)))->Vector::__mul(&VStack_1c,&local_13c.y); - fVar30 = random_float(); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(&local_1a0._h))))->Vector::Vector(0.0,-2.0 - fVar30 * 6.0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&scratchVec,vecResult2); - this = player; - spawnedEffect = - (Entity_Effect *) - Game::Spawn(g_game,1000,0x3b,&local_16c,vecResult,GHIDRA_CAST(player),0,uVar29); - local_164.y = (float)spawnedEffect; - (GHIDRA_CAST((&puStack_54)))->BlendMode::SetMode(2,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity)::GetSprite(); - src = &puStack_54; - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,src); - if (this->_headColor == 6) { - fVar21 = 0.21; - colorBuf = GHIDRA_CAST((local_f0 + 0x2c)); - fVar30 = 0.2; - } - else { - fVar21 = 0.2; - colorBuf = &local_11c; - fVar30 = 0.5; - } - ::(GHIDRA_CAST((colorBuf)))->Color::Color(5.0,fVar30,fVar21,1.0); - local_150.y = (float)extraout_EAX; - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity)::GetSprite(); - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - ::(GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(GHIDRA_CAST(local_150.y)); - fVar30 = random_float(); - (GHIDRA_CAST((spawnedEffect)))->Entity_Effect::set_rotation(fVar30 * 10.0 + 2.0); - iVar6 = Isaac::Random(10); - (GHIDRA_CAST((spawnedEffect)))->Entity_Effect::SetTimeout(iVar6 + 10); - fVar30 = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST((fVar30 * 0.3 + 0.4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = extraout_var_00; - local_150.y = (float)GHIDRA_CAST(BVar25._l); - vecResult = (GHIDRA_CAST((&this->_playerSpriteScale)))->Vector::__mul(&local_17c,&local_150.y); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Mul(&local_174,&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(local_164.y))))->Entity::SetSpriteScale(vecResult); - FUN_00440e90(); - } - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0); - if (iVar6 != 0) { - Config::GetCollectibles(); - iVar6 = _get_index_plus_one_if_kind_4_5(); - local_150.y = (float)iVar6 * 0.2 + 2.0; - local_13c.y = this->_size + 40.0; - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(local_13c.y)); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_24),&this->_pos,local_13c.y,10); - local_8 = 9; - activeDesc = GHIDRA_CAST(0x0); - local_130 = GHIDRA_CAST(0x0); - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_24))))->EntityList::Size(); - if (iVar6 != 0) { - do { - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(*puVar10))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar3 == 0) || - (piVar14 = GHIDRA_CAST(std)::vector::operator_index(), - GHIDRA_CAST(*piVar14) == this)) { -LAB_0078863e: - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(*puVar10))))->Entity::IsProjectile(); - if ((bVar3 != 0) && ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) == '\0')) { - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - cVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar10))))->Entity::IsDead(); - if (cVar4 == '\0') { - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - uVar27 = (GHIDRA_CAST((GHIDRA_CAST(*puVar10))))->Entity_Projectile::ProjectileFlags(); - if ((uVar27 & 0x80000000) == 0) { - msvc::vector::operator_index(); - FUN_00652f80(); - } - } - } - } - else { - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(*puVar10))))->Entity::HasEntityFlags(0x20000000); - if (bVar3 != 0) goto LAB_0078863e; - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - vfunc = *(code **)(*GHIDRA_CAST(*puVar10) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::constructor(GHIDRA_CAST(player)); - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(local_150.y)); - (*vfunc)(); - puVar10 = GHIDRA_CAST(std)::vector::operator_index(); - this = player; - tmpEntity = GHIDRA_CAST(*puVar10); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::constructor(GHIDRA_CAST(player)); - (GHIDRA_CAST((tmpEntity)))->Entity::AddBurn(GHIDRA_CAST(local_68),0x96,0.0,0); - activeDesc = local_130; - } - activeDesc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((activeDesc)) + 0x1)))); - local_130 = activeDesc; - puVar17 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_24))))->EntityList)::Size(); - } while (activeDesc < puVar17); - } - local_8 = 0xffffffff; - (GHIDRA_CAST((local_24)))->EntityList_Query::~EntityList_Query(); - } - tempEffects = &this->_temporaryeffects; - } - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c1); - if ((bVar3 != 0) && - ((((cVar4 = FUN_00a209c0(), cVar4 != '\0' || (cVar4 = FUN_00a209c0(), cVar4 != '\0')) || - (cVar4 = FUN_00a209c0(), cVar4 != '\0')) || (cVar4 = FUN_00a209c0(), cVar4 != '\0')))) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x2c1,-1); - } - } - update_ladder(this); - if (0 < this->_damageCooldown) { - this->_damageCooldown = this->_damageCooldown + -1; - } - if (0 < this->_controlsCooldown) { - this->_controlsCooldown = this->_controlsCooldown + -1; - } - if (0 < this->_fireBlockCooldown) { - this->_fireBlockCooldown = this->_fireBlockCooldown + -1; - } - if (0 < this->_itemHoldCooldown) { - this->_itemHoldCooldown = this->_itemHoldCooldown + -1; - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ecc)))) != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ecc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ecc)))) + -1; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ec8)))) < 0) && - (sVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ec8)))) + 1, *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ec8)))) = sVar5, - sVar5 == 0)) { - rng = GetCollectibleRNG(this,0x197); - uVar29 = (GHIDRA_CAST((rng)))->RNG::RandomInt(4); - this->_purityState = uVar29; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x197,1,1); - itemConfig = Isaac::GetItemConfig(); - bVar3 = 0; - itemCfg = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x11); - AddCostume(this,itemCfg,bVar3); - update_purity_glow(this); - } - } - if (0 < this->_flashCountdown) { - this->_flashCountdown = this->_flashCountdown + -1; - } - if ((0 < this->_coopBabyBuffTimers[0]) && - (iVar6 = this->_coopBabyBuffTimers[0] + -1, this->_coopBabyBuffTimers[0] = iVar6, iVar6 == 0) - ) { - this->_cacheFlags = this->_cacheFlags | 1; - EvaluateItems(this); - } - if ((0 < this->_coopBabyBuffTimers[1]) && - (iVar6 = this->_coopBabyBuffTimers[1] + -1, this->_coopBabyBuffTimers[1] = iVar6, iVar6 == 0) - ) { - this->_cacheFlags = this->_cacheFlags | 2; - EvaluateItems(this); - } - if ((0 < this->_coopBabyBuffTimers[2]) && - (iVar6 = this->_coopBabyBuffTimers[2] + -1, this->_coopBabyBuffTimers[2] = iVar6, iVar6 == 0) - ) { - this->_cacheFlags = this->_cacheFlags | 0x10; - EvaluateItems(this); - } - if ((0 < this->_coopBabyBuffTimers[3]) && - (iVar6 = this->_coopBabyBuffTimers[3] + -1, this->_coopBabyBuffTimers[3] = iVar6, iVar6 == 0) - ) { - this->_cacheFlags = this->_cacheFlags | 0xc; - EvaluateItems(this); - } - if ((0 < this->_coopBabyBuffTimers[4]) && - (iVar6 = this->_coopBabyBuffTimers[4] + -1, this->_coopBabyBuffTimers[4] = iVar6, iVar6 == 0) - ) { - this->_cacheFlags = this->_cacheFlags | 0x400; - EvaluateItems(this); - } - if ((0 < this->_coopBabyBuffTimers[5]) && - (iVar6 = this->_coopBabyBuffTimers[5] + -1, this->_coopBabyBuffTimers[5] = iVar6, iVar6 == 0) - ) { - this->_cacheFlags = this->_cacheFlags | 0x800; - EvaluateItems(this); - } - if ((0 < this->_coopBabyBuffTimers[6]) && - (iVar6 = this->_coopBabyBuffTimers[6] + -1, this->_coopBabyBuffTimers[6] = iVar6, iVar6 == 0) - ) { - this->_cacheFlags = this->_cacheFlags | 0x800; - EvaluateItems(this); - } - if (0 < this->_coopBabyBuffTimers[7]) { - this->_coopBabyBuffTimers[7] = this->_coopBabyBuffTimers[7] + -1; - } - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18e0))))) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18e0)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x18e0)))) + -1; - } - local_122 = 0; - bVar3 = IsHoldingItem(this); - if (bVar3 == 0) { - if (local_12a == 0) { - bVar3 = IsExtraAnimationFinished(this); - local_129 = 1; - if (bVar3 != 0) goto LAB_00788a54; - } -LAB_00788a4d: - local_129 = 0; - } - else { - local_150.y = (float)ANM2::GetLayerFrame(&this->_bodySprite,0); - if (GHIDRA_CAST(local_150.y) != GHIDRA_CAST(0x0)) { - local_122 = ((GHIDRA_CAST(local_150.y))->_spriteSheetPath)._buf[4]; - pbVar16 = GHIDRA_CAST(0x0); - local_13c.y = (float)&this->_heldSprite; - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_13c.y))))->Sprite::GetLayerCount(); - fVar30 = local_13c.y; - if (iVar6 != 0) { - do { - vecResult = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_120))))->Sprite)::Scale(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_150.y))))->Vector::Mul(&VStack_1c,vecResult); - layer = (GHIDRA_CAST((GHIDRA_CAST(fVar30))))->Sprite::GetLayer(pbVar16); - (GHIDRA_CAST((&layer->_pos)))->Vector::operator_assign(vecResult); - layer = (GHIDRA_CAST((GHIDRA_CAST(fVar30))))->Sprite::GetLayer(pbVar16); - pbVar16 = pbVar16 + 1; - layer->_visible = local_122; - layerCount = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(fVar30))))->Sprite)::GetLayerCount(); - } while (pbVar16 < layerCount); - this = player; - } - } - if ((this->_isHeldItemVisible == 0) || (local_122 != 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar6 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (iVar6 != 0) goto LAB_00788a4d; - } - local_129 = 1; - } -LAB_00788a54: - bVar3 = IsExtraAnimationFinished(this); - if (bVar3 == 0) { - bVar3 = IsHoldingItem(this); - local_128 = GHIDRA_CAST((GHIDRA_UINT(local_128) & 0xffffff)); - if (bVar3 != 0) goto LAB_00788a71; - } - else { -LAB_00788a71: - local_128 = GHIDRA_CAST(CONCAT13(1,(undefined3)local_128)); - } - local_12a = this->_canFly; - local_121 = '\x01'; - bVar3 = IsCollectibleCostumeVisible(this,0x271,1); - if (bVar3 != 0) { - local_128 = GHIDRA_CAST(CONCAT13(1,(undefined3)local_128)); - local_12a = 0; - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - local_121 = '\x01'; - if (cVar4 != '\0') goto LAB_00788ade; - } - else { -LAB_00788ade: - local_121 = '\0'; - } - local_122 = 0; - this->_isPlayingExtraAnimation = 0; - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar3 == 0) && ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) != '\0')) { - if (local_129 != 0) { - FlushQueueItem(this); - } - local_148 = GHIDRA_CAST(0xb1e044); - pcVar18 = "PickupWalkDown"; - if (local_122 != 0) { - local_148 = GHIDRA_CAST(0xb6b084); - } - local_158.y = 1.0; - GetBodyMoveDirection(this,&local_174); - bVar3 = (GHIDRA_CAST((&local_174)))->Vector::operator_eq(&g_vectorZero); - if (bVar3 == 0) { - tmpEntity = GHIDRA_CAST(local_174.x); - Math::abs(); - local_13c.y = (float)tmpEntity; - if (local_122 == 0) { - tmpEntity = GHIDRA_CAST(local_174.y); - Math::abs(); - if (local_13c.y <= (float)tmpEntity) { - pcVar18 = "WalkDown"; - walkAnim = GHIDRA_CAST(&DAT_00b1e020); - goto LAB_00788e85; - } - pcVar18 = "WalkRight"; - walkAnim = "WalkLeft"; - tmpEntity = GHIDRA_CAST(local_174.x); - } - else { - tmpEntity = GHIDRA_CAST(local_174.y); - Math::abs(); - if (local_13c.y <= (float)tmpEntity) { - walkAnim = "PickupWalkUp"; -LAB_00788e85: - tmpEntity = GHIDRA_CAST(local_174.y); - } - else { - pcVar18 = "PickupWalkRight"; - walkAnim = "PickupWalkLeft"; - tmpEntity = GHIDRA_CAST(local_174.x); - } - } - local_144.y = (float)pcVar18; - if ((float)tmpEntity <= 0.0) { - local_144.y = (float)walkAnim; - } - if (((this->_variant == 0) && (this->_isCoopGhost == 0)) && (local_121 != '\0')) { - ANM2::Play(&this->_sprite,GHIDRA_CAST(local_144.y),0); - } - local_148 = GHIDRA_CAST(&this->_playerCostumeMap[0]._isBodyLayer); - local_120 = GHIDRA_CAST(&DAT_0000000f); - do { - if (((-1 < (GHIDRA_CAST((GHIDRA_INT(local_148) + -0xc)))->_index) && - (*GHIDRA_CAST(local_148) != 0)) && - ((pAVar19 = GHIDRA_CAST(FUN_005cbd10()), this->_variant != 1 && (this->_isCoopGhost == 0)))) - { - pvVar15 = *(void **)pAVar19[1]._filename._buf; - if (((pvVar15 != (void *)0x0) && (bVar3 = (GHIDRA_CAST((pvVar15)))->Item::IsNull(), bVar3 != 0)) && - (*GHIDRA_CAST((*GHIDRA_CAST(pAVar19[1]._filename._buf) + 4)) == 0x4c)) { - local_158.y = local_158.y + local_158.y; - } - if ((local_122 == 0) || - ((bVar3 = (GHIDRA_CAST((*(void **)pAVar19[1]._filename._buf)))->Item::IsNull(), bVar3 != 0 && - (*GHIDRA_CAST((*GHIDRA_CAST(pAVar19[1]._filename._buf) + 4)) == 0x5a)))) { - if ((pAVar19[1]._filename._buf[8] == '\0') && - (ANM2::Play(pAVar19,GHIDRA_CAST(local_144.y),0), pAVar19[1]._filename._buf[10] != '\0')) - { - (GHIDRA_CAST((tmpString)))->msvc::string::string_from_cstr(GHIDRA_CAST(local_144.y)); - local_8 = 0x11; - FUN_0060c790(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x12; - Sprite::PlayOverlay(); - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - local_8 = 0xffffffff; - (GHIDRA_CAST((tmpString)))->msvc::string::_Tidy_deallocate(); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(pAVar19))))->Sprite::Stop(); - } - } - local_148 = GHIDRA_CAST((GHIDRA_INT(local_148) + 0x10)); - local_120 = GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST(&(local_120[-1])) + 0x2dec))) + 0x113)); - } while (local_120 != GHIDRA_CAST(0x0)); - } - else { - if (((this->_variant == 0) && (this->_isCoopGhost == 0)) && (local_121 != '\0')) { - if ((local_12a == 0) || (this->_playerType == 0x23)) { - ANM2::SetFrame(&this->_sprite,local_148,0); - } - else { - ANM2::Play(&this->_sprite,GHIDRA_CAST(local_148),0); - } - } - local_130 = GHIDRA_CAST(&this->_playerCostumeMap[0]._isBodyLayer); - local_128 = GHIDRA_CAST(0xf); - do { - if (((-1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_130[-1])) + 0x2ef4))))) && (*GHIDRA_CAST(local_130) != 0)) && - ((pAVar19 = GHIDRA_CAST(FUN_005cbd10()), this->_variant != 1 && (this->_isCoopGhost == 0)))) - { - pvVar15 = *(void **)pAVar19[1]._filename._buf; - if (((pvVar15 != (void *)0x0) && (bVar3 = (GHIDRA_CAST((pvVar15)))->Item::IsNull(), bVar3 != 0)) && - (*GHIDRA_CAST((*GHIDRA_CAST(pAVar19[1]._filename._buf) + 4)) == 0x4c)) { - local_158.y = local_158.y + local_158.y; - } - if (pAVar19[1]._filename._buf[8] == '\0') { - if ((local_122 == 0) || - ((bVar3 = (GHIDRA_CAST((*(void **)pAVar19[1]._filename._buf)))->Item::IsNull(), bVar3 != 0 && - (*GHIDRA_CAST((*GHIDRA_CAST(pAVar19[1]._filename._buf) + 4)) == 0x5a)))) { - piVar14 = *GHIDRA_CAST(pAVar19[1]._filename._buf); - if ((*piVar14 == 3) && (piVar14[1] == 0x271)) { - ANM2::SetFrame(pAVar19,GHIDRA_CAST("WalkIdle"),0); - } - else { - if (local_12a == 0) { - (GHIDRA_CAST((tmpString)))->msvc::string::string_from_cstr(GHIDRA_CAST(local_148)); - local_8 = 10; - FUN_0060c790(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xc; - (GHIDRA_CAST((tmpString)))->msvc::string::_Tidy_deallocate(); - iVar6 = FUN_0040bcb0(); - if (iVar6 == 0) { - ANM2::SetFrame(pAVar19,local_148,0); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(pAVar19))))->Sprite::Play(GHIDRA_CAST((local_68 + 0x10)),0); - } - local_8 = 0xffffffff; - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - } - else { - ANM2::Play(pAVar19,GHIDRA_CAST(local_148),0); - } - if (pAVar19[1]._filename._buf[10] != '\0') { - (GHIDRA_CAST((tmpString)))->msvc::string::string_from_cstr(GHIDRA_CAST(local_148)); - if (local_12a == 0) { - local_8 = 0xf; - anim = GHIDRA_CAST(FUN_0060c790()); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x10; - ANM2::SetFrame(pAVar19,anim,0); - } - else { - local_8 = 0xd; - FUN_0060c790(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xe; - Sprite::PlayOverlay(); - } - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - local_8 = 0xffffffff; - (GHIDRA_CAST((tmpString)))->msvc::string::_Tidy_deallocate(); - } - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(pAVar19))))->Sprite::Stop(); - } - } - } - local_130 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_130)) + 0x10)))); - local_128 = GHIDRA_CAST((GHIDRA_INT(local_128) + -1)); - } while (local_128 != GHIDRA_CAST(0x0)); - local_128 = GHIDRA_CAST(0x0); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x0))) = ZEXT812(0x3f800000); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0; - local_144.y = (float)BVar25._l; - bVar3 = ANM2::IsPlaying(&this->_sprite,&s_empty); - if (bVar3 == 0) { - fVar30 = local_144.y; - } - else { - local_120 = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - if (2.3 <= (float)local_120) { - fVar30 = local_144.y; - } - else { - fVar30 = assert_lerp_range((float)local_120,1.0,2.3,0.5,1.0,1); - } - BVar25 = (BitSet128)ZEXT416(local_120); - if (6.0 < (float)local_120) { - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST(assert_lerp_range((float)local_120,6.0,10.0,1.0,2.0,1)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = extraout_var_01; - fVar30 = (float)GHIDRA_CAST(BVar25._l); - } - if (0 < this->_slipperyTimer) { - fVar30 = 1.0; - local_13c.y = (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::Dot(&this->_velocity); - local_13c.y = assert_lerp_range(local_13c.y,-3.0,1.0,3.0,fVar30,1); - fVar30 = (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::Length(); - local_13c.y = fVar30 * local_13c.y; - auVar23 = ZEXT812(0x3f000000); - auVar26 = ZEXT812(0x40800000); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))) <= local_13c.y) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))) = local_13c.y; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x0))) = auVar23; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))) <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar23)) + 0x0))); - } - fVar30 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar26)) + 0x0))); - } - } - local_144.y = fVar30 * local_158.y; - set_PlaybackSpeed(&this->_sprite,local_144.y); - pbVar16 = &this->_playerCostumeMap[0]._isBodyLayer; - local_120 = GHIDRA_CAST(&DAT_0000000f); - do { - if ((-1 < (GHIDRA_CAST((pbVar16 + -0xc)))->_index) && (*pbVar16 != 0)) { - pAVar19 = GHIDRA_CAST(FUN_005cbd10()); - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(local_144.y)); - set_PlaybackSpeed(pAVar19,local_144.y); - } - pbVar16 = pbVar16 + 0x10; - local_120 = GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST(&(local_120[-1])) + 0x2dec))) + 0x113)); - } while (local_120 != GHIDRA_CAST(0x0)); - } - cVar4 = FUN_0040c2d0(); - if ((cVar4 == '\0') && (bVar3 = IsExtraAnimationFinished(this), bVar3 != 0)) { - pbVar16 = (GHIDRA_CAST(((this->_queuedExtraAnimation)._buf)))->msvc::string::c_str(); - PlayExtraAnimation(this,pbVar16); - FUN_0040c2f0(); - } - layer = GHIDRA_CAST(&this->_temporaryeffects); - local_150.y = (float)layer; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::HasCollectibleEffect(0x4d); - if ((bVar3 == 0) && - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::HasCollectibleEffect(0x5d), bVar3 == 0)) - { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::HasCollectibleEffect(299); - if (bVar3 != 0) { - pvVar15 = (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::GetCollectibleEffect(299); - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar15) + 8)) != 0) goto LAB_00789259; - } - } - else { -LAB_00789259: - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = &player->_pos; - vecResult2 = (GHIDRA_CAST((&player->_velocity)))->Vector::Normalized(&VStack_1c); - local_13c.y = 40.0; - vecResult2 = (GHIDRA_CAST((vecResult2)))->Vector::__mul(GHIDRA_CAST(&local_1a0._h),&local_13c.y); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&local_16c,vecResult2); - local_120 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetGridIndex(vecResult); - if (GHIDRA_INT(local_120) < 0) { - layer = GHIDRA_CAST(local_150.y); - this = player; - } - else { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - this = player; - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::constructor(GHIDRA_CAST(player)); - (GHIDRA_CAST((room)))->Room::DamageGridWithSource(GHIDRA_INT(local_120),1,GHIDRA_CAST(local_68)); - layer = GHIDRA_CAST(&this->_temporaryeffects); - } - } - if ((this->_flags & 0x80) != 0) { - auVar24 = ZEXT416(GHIDRA_UINT(this->_slowingAmount)); - FUN_00431260(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auVar24)) + 0x0))) * this->_friction)); - this->_friction = (float)GHIDRA_CAST(BVar25._l); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar6 = (GHIDRA_CAST((room)))->Room::GetBossID(); - if ((iVar6 == 0x37) && - ((*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x0))) = ZEXT812(0x43a00000), (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0, pfVar8 = &(this->_pos).y, - *pfVar8 <= (float)BVar25._l && (float)BVar25._l != *pfVar8)) { - (this->_pos).y = 320.0; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::HasCollectibleEffect(0x251); - if (bVar3 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::RemoveCollectibleEffect(0x251,-1); - this->_marsUnk2 = -1; - dash_impact(this); - bVar3 = 0; - vecResult = (GHIDRA_CAST((&VStack_1c)))->Vector::Vector(0.0,-10.0); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity(vecResult,bVar3); - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::HasCollectibleEffect(0x82); - if ((bVar3 != 0) || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::HasCollectibleEffect(0xb5), bVar3 != 0 - )) { - this->_ponyCharge = 0; - (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::RemoveCollectibleEffect(0x82,-1); - (GHIDRA_CAST((GHIDRA_CAST(layer))))->TemporaryEffects::RemoveCollectibleEffect(0xb5,-1); - Game::ShakeScreen(g_game,8); - bVar3 = 0; - vecResult = (GHIDRA_CAST((&VStack_1c)))->Vector::Vector(0.0,-10.0); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity(vecResult,bVar3); - } - } - bVar3 = (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::operator_ne(&g_vectorZero); - if (bVar3 != 0) { - local_150.y = 2.0; - local_13c.y = (GHIDRA_CAST((&this->_velocity)))->Vector::Length(); - local_120 = GHIDRA_CAST(0x3f800000); - msvc::max(); - pfVar8 = GHIDRA_CAST(std)::min(); - local_164.y = *pfVar8 * 0.5; - (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::operator_mul_assign(&local_164.y); - local_13c.y = (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::LengthSquared(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x0))) = ZEXT812(0x3c23d70a); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._h)) + 0x4))) = 0; - if (local_13c.y < (float)BVar25._l) { - (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::operator_assign(&g_vectorZero); - } - } - FUN_007b9aa0(); - if (this->_dead != 0) goto LAB_007894ef; - } - else { -LAB_007894ef: - pAVar19 = GHIDRA_CAST(GetDeathAnimName(this)); - local_144.y = (float)pAVar19; - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00428b50(); - local_12a = FUN_0082ee30(); - if (local_12a != 0) goto LAB_00789743; - Config::GetPillEffects(); - pbVar16 = GHIDRA_CAST(_string_holder_c_str()); - do { - bVar3 = *pbVar16; - bVar1 = (pAVar19->_filename)._buf[0]; - bVar20 = bVar3 < bVar1; - if (bVar3 != bVar1) { -LAB_00789567: - uVar29 = -GHIDRA_UINT(bVar20) | 1; - goto LAB_0078956c; - } - if (bVar3 == 0) break; - bVar3 = pbVar16[1]; - bVar1 = (pAVar19->_filename)._buf[1]; - bVar20 = bVar3 < bVar1; - if (bVar3 != bVar1) goto LAB_00789567; - pbVar16 = pbVar16 + 2; - pAVar19 = GHIDRA_CAST(((pAVar19->_filename)._buf + 2)); - } while (bVar3 != 0); - uVar29 = 0; -LAB_0078956c: - if (uVar29 != 0) { - this->_visible = 1; - PlayExtraAnimation(this,GHIDRA_CAST(local_144.y)); - iVar6 = GetTrinketMultiplier(this,0x15); - if (iVar6 < 1) { -LAB_007895b1: - iVar6 = GetTrinketMultiplier(this,0x15); - if (1 < iVar6) { - uVar29 = Game::GetFrameCount(g_game); - uVar29 = uVar29 & 0x80000003; - if (GHIDRA_INT(uVar29) < 0) { - uVar29 = (uVar29 - 1 | 0xfffffffc) + 1; - } - if (uVar29 == 2) goto LAB_007895db; - } - } - else { - uVar29 = Game::GetFrameCount(g_game); - uVar29 = uVar29 & 0x80000003; - if (GHIDRA_INT(uVar29) < 0) { - uVar29 = (uVar29 - 1 | 0xfffffffc) + 1; - } - if (uVar29 != 3) goto LAB_007895b1; -LAB_007895db: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddTrinketEffect(0x17,1,1); - } - ThrowHeldEntity(this,&g_vectorZero); - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST("ghost")); - if (layer != GHIDRA_CAST(0x0)) { - layer->_visible = 1; - } - if ((((this->_parent == 0) && (this->_variant == 0)) && (this->_isCoopGhost == 0)) && - (bVar3 = WillPlayerRevive(this), bVar3 == 0)) { - activeDesc = GHIDRA_CAST(0x0); - local_120 = GHIDRA_CAST(0x0); - iVar6 = Game::GetNumPlayers(g_game); - if (iVar6 != 0) { - do { - activeDesc = Game::GetPlayer(g_game,GHIDRA_UINT(activeDesc)); - if ((((activeDesc != this) && - (deathAnimPlayer = GHIDRA_CAST(GetOtherTwin(this)), - activeDesc != deathAnimPlayer)) && - ((iVar6 = (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity::Parent(), iVar6 == 0 && - (iVar6 = (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity::Variant(), iVar6 == 0)))) && - ((cVar4 = (GHIDRA_CAST((GHIDRA_CAST(activeDesc))))->Entity::IsDead(), cVar4 == '\0' || - (bVar3 = WillPlayerRevive(activeDesc), bVar3 != 0)))) goto LAB_007896f1; - activeDesc = GHIDRA_CAST(((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_120)) + 0x0)))))->_buf + 1)); - local_120 = activeDesc; - deathAnimPlayer = GHIDRA_CAST(Game)::GetNumPlayers(g_game); - } while (activeDesc < deathAnimPlayer); - } - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (cVar4 == '\0') { - Game::DeleteSaveState(); - persistent_game_data_set_writable(); - } - } -LAB_007896f1: - if ((((this->_variant == 1) && (iVar6 = GetBabySkin(this), iVar6 == 0x3b)) && - (GHIDRA_CAST(this->_parent) != GHIDRA_CAST(0x0))) && - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::is_player(), bVar3 != 0)) { - tempEffects = GHIDRA_CAST(GetEffects(GHIDRA_CAST(this->_parent))); - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddTrinketEffect(0xb4,1,1); - } - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - } - } - else { -LAB_00789743: - local_12a = 1; - } - fVar30 = this->_friction * 0.6; - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(fVar30)); - this->_friction = fVar30; - if ((this->_playerType == 0x13) || (this->_playerType == 0x14)) { - cVar4 = FUN_006f0040(); - local_121 = '\x01'; - if (cVar4 == '\0') goto LAB_00789784; - } - else { -LAB_00789784: - local_121 = '\0'; - } - FUN_00417900(); - iVar6 = FUN_007538e0(); - local_128 = GHIDRA_CAST(CONCAT13(iVar6 == 0,(undefined3)local_128)); - cVar4 = FUN_00423960(); - if (cVar4 == '\0') { -LAB_007897da: - cVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))); - } - else { - pvVar15 = (void *)FUN_00417920(); - pvVar15 = (GHIDRA_CAST((pvVar15)))->InputManager::GetDeviceByPlayerEntity(this); - if (pvVar15 == (void *)0x0) goto LAB_007897da; - iVar6 = FUN_00753d50(); - cVar4 = iVar6 == 0; - } - if ((local_121 == '\0') || (iVar6 = 10, cVar4 == '\0')) { - iVar6 = 9; - } - if ((((this->_activeDesc[0]._item == 0x28d) && - (bVar3 = ANM2::IsPlaying(&this->_sprite,&s_empty), bVar3 != 0)) && - (bVar3 = input_is_action_triggered(g_manager,iVar6,this->_controllerIndex,GHIDRA_CAST(0x0),0), - bVar3 != 0)) && - (((local_158.y = (float)ANM2::GetLayer(&this->_sprite,GHIDRA_CAST("ghost")), - GHIDRA_CAST(local_158.y) != GHIDRA_CAST(0x0) && (*GHIDRA_CAST(local_158.y) != 0)) && - ((char)((GHIDRA_CAST(local_158.y))->_sprite)._animDefaultName._capacity != '\0')))) { - (GHIDRA_CAST((GHIDRA_CAST(&local_16c))))->EntityPtr::clear(); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar6 = _ptr_deref_or_minus1(); - local_13c.y = (float)AnimationState::GetLayerFrame(animState,iVar6); - if ((GHIDRA_CAST(local_13c.y) != GHIDRA_CAST(0x0)) && - ((char)(GHIDRA_CAST(local_13c.y))->_variant != '\0')) { - gridEntity = GHIDRA_CAST(Config)::GetPillEffects(); - iVar6 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(); - iVar7 = _ptr_deref_or_minus1(); - if (-1 < *GHIDRA_CAST((iVar6 + 0x38 + iVar7 * 4))) { - gridEntity = GHIDRA_CAST(Config)::GetPillEffects(); - (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(); - render_build_sprite_quad - (local_228,&g_vectorZero,(void *)local_13c.y,GHIDRA_CAST(local_158.y), - &g_vectorZero,&g_vectorZero,&this->_sprite); - vecResult = (GHIDRA_CAST((local_228)))->Vector::__add(&VStack_1c,local_210); - local_13c.y = 0.5; - (GHIDRA_CAST((vecResult)))->Vector::__mul(GHIDRA_CAST(&local_1a0._h),&local_13c.y); - vecResult = GHIDRA_CAST(FUN_0067f2e0()); - (GHIDRA_CAST((&local_16c)))->Vector::operator_assign(vecResult); - } - uVar29 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x90,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar29); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(&local_16c); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - fVar30 = random_float(); - (GHIDRA_CAST((sprite)))->Sprite::SetRotation(fVar30 * 360.0); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - local_13c.y = 1.5; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_1c,&local_13c.y); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(vecResult); - tmpEntity->SetCollisionDamage(); - tmpEntity->Update(); - fVar30 = random_float(); - this = player; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST((fVar30 * 0.2 + 0.9)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = extraout_var_02; - play_sound_with_fart_seed(0x1dd,1.25,2,0,(float)GHIDRA_CAST(BVar25._l)); - Game::ShakeScreen(g_game,0xe); - *GHIDRA_CAST(&((GHIDRA_CAST((GHIDRA_INT(local_158.y) + 0x48)))->_animDefaultName)._capacity) = 0; - } - } - pAVar19 = &this->_sprite; - local_190.y = (float)pAVar19; - if (this->_playerType == 0x23) { - bVar3 = ANM2::IsPlaying(pAVar19,GHIDRA_CAST(local_144.y)); - if ((bVar3 != 0) && (iVar6 = ANM2::GetFrame(pAVar19), iVar6 == 0x13)) { - FUN_0042a020(); - FUN_0069d9d0(); - FUN_0069d9d0(); - FUN_0069d9d0(); - uVar29 = 0; - do { - Isaac::DestoryWeapon(GHIDRA_CAST((GHIDRA_INT(this->_weapons) + uVar29 + 4))); - uVar29 = uVar29 + 4; - } while (uVar29 < 0x10); - Isaac::DestoryWeapon(this->_weapons); - iVar6 = Game::Challenge(g_game); - if (iVar6 == 0x2a) { - ::(GHIDRA_CAST((GHIDRA_CAST((local_f0 + 0x2c)))))->Color::Color(); - BVar25 = g_tearFlagGigaBomb; - Game::BombExplosionEffects - (g_game,&this->_pos,60.0,g_tearFlagGigaBomb,Color,GHIDRA_CAST(this),1.0,1,4,1); - } - else { - spawn_gibs(&this->_pos,6,40.0,GHIDRA_CAST(&local_158.y),GHIDRA_CAST(this),&this->_color, - &g_vectorZero,1.0); - play_sound_with_fart_seed(0x1b,1.0,2,0,1.0); - } -LAB_00789f05: - pAVar19 = &this->_sprite; - } - } - else { - bVar3 = ANM2::IsPlaying(pAVar19,GHIDRA_CAST(local_144.y)); - if ((bVar3 != 0) && - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(pAVar19))))->Sprite::IsEventTriggered("DeathSound"), bVar3 != 0)) { - bVar3 = IsHologram(this); - if (bVar3 == 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST(get_voice_pitch(this)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = extraout_var_03; - play_sound_with_fart_seed(0xd9,1.0,2,0,(float)GHIDRA_CAST(BVar25._l)); - } - if (this->_playerType == 0x19) { - local_150.y = (float)&this->_pos; - vecResult = (GHIDRA_CAST((&VStack_1c)))->Vector::Vector(10.0,0.0); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(GHIDRA_CAST(&local_1a0._h),vecResult); - Game::ButterBeanFart(g_game,vecResult,120.0,GHIDRA_CAST(this),1,0); - uVar29 = Random(); - vecResult = (GHIDRA_CAST((&VStack_1c)))->Vector::Vector(10.0,0.0); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(GHIDRA_CAST(&local_1a0._h),vecResult); - Game::Spawn(g_game,0xf5,0,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar29); - local_120 = GHIDRA_CAST(0x6); - do { - uVar29 = Random(); - vecResult = (GHIDRA_CAST((&VStack_1c)))->Vector::Vector(-1.0,0.0); - fVar30 = random_float(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Rotated(GHIDRA_CAST(&local_1a0._h),fVar30 * 40.0 - 20.0); - fVar30 = random_float(); - local_13c.y = fVar30 * 20.0 + 6.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&local_16c,&local_13c.y); - vecResult2 = (GHIDRA_CAST((&scratchVec)))->Vector::Vector(4.0,0.0); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(local_150.y))))->Vector::__sub(&local_17c,vecResult2); - tmpEntity = Game::Spawn(g_game,1000,99,vecResult2,vecResult,GHIDRA_CAST(0x0),1,uVar29); - vecResult = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::SpriteScale(); - fVar30 = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST((fVar30 * 1.5 + 1.0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = extraout_var_04; - local_164.y = (float)GHIDRA_CAST(BVar25._l); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&local_174,&local_164.y); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - ::(GHIDRA_CAST((GHIDRA_CAST((local_f0 + 0x2c)))))->Color::Color(0.4,0.33,0.25,1.0); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(color_02); - tmpEntity->Update(); - local_120 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_120[-1])) + 0x2eff)))); - } while (local_120 != GHIDRA_CAST(0x0)); - local_130 = GHIDRA_CAST(0x0); - local_120 = GHIDRA_CAST(0x0); - this = player; - if (0 < player->_poopMana) { - do { - if (0x12 < GHIDRA_INT(local_130)) break; - uVar29 = Random(); - vecResult = (GHIDRA_CAST((&VStack_1c)))->Vector::Vector(-1.0,0.0); - fVar30 = random_float(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Rotated(GHIDRA_CAST(&local_1a0._h),fVar30 * 40.0 - 20.0); - fVar30 = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25._l)) + 0x0))) = GHIDRA_CAST((fVar30 * 6.0 + 3.0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar25)) + 0x4))) = extraout_var_05; - local_13c.y = (float)GHIDRA_CAST(BVar25._l); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&local_16c,&local_13c.y); - vecResult2 = (GHIDRA_CAST((&scratchVec)))->Vector::Vector(4.0,0.0); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(local_150.y))))->Vector::__sub(&local_17c,vecResult2); - tmpEntity = Game::Spawn(g_game,5,0x2a,vecResult2,vecResult,GHIDRA_CAST(0x0),0,uVar29); - FUN_005b19f0(); - tmpEntity->Update(); - this = player; - AddPoopMana(player,-1); - local_130 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_130)) + 0x1)))); - } while (GHIDRA_INT(local_130) < this->_poopMana); - } - goto LAB_00789f05; - } - } - } - if ((local_12a == 0) && - (((bVar3 = ANM2::IsPlaying(pAVar19,GHIDRA_CAST(local_144.y)), bVar3 != 0 && - ((iVar6 = ANM2::GetFrame(pAVar19), 7 < iVar6 || (this->_playerType == 0x23)))) || - (bVar3 = ANM2::IsFinishedImpl(pAVar19,&s_empty), bVar3 != 0)))) { - local_158.y = (float)&this->_twinPlayer; - iVar6 = EntityPtr::Ref(); - if ((iVar6 != 0) && (iVar6 = EntityPtr::Ref(), *GHIDRA_CAST((iVar6 + 0x173)) == '\0')) { - iVar6 = EntityPtr::Ref(); - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - pbVar16 = GetDeathAnimName(activeDesc); - bVar3 = ANM2::IsPlaying(GHIDRA_CAST((iVar6 + 0x48)),pbVar16); - if (bVar3 == 0) { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - bVar3 = PlayerManager::IsCoopPlay(playerManager); - if (bVar3 == 0) { - qVar2 = this->_lastDamageFlags; - uVar28 = *GHIDRA_CAST((GHIDRA_INT(&this->_lastDamageFlags) + 4)); - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x16a8)) = GHIDRA_INT(qVar2); - *GHIDRA_CAST((iVar6 + 0x16ac)) = uVar28; - other_02 = &player->_lastDamageSource; - iVar6 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST((iVar6 + 0x167c)))))->EntityRef::operator_(other_02); - piVar14 = GHIDRA_CAST(EntityPtr)::Ref(); - vfunc = *(code **)(*piVar14 + 0x24); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::EntityRef(); - (*vfunc)(); - iVar6 = EntityPtr::Ref(); - *GHIDRA_CAST((iVar6 + 0x171)) = 1; - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - deathAnimPlayer = GHIDRA_CAST(EntityPtr)::Ref(); - pbVar16 = GetDeathAnimName(deathAnimPlayer); - PlayExtraAnimation(activeDesc,pbVar16); - } - else { - activeDesc = GHIDRA_CAST(EntityPtr)::Ref(); - cVar4 = IsCoopGhost(activeDesc); - if (cVar4 == '\0') { - piVar14 = GHIDRA_CAST(EntityPtr)::Ref(); - vfunc = *(code **)(*piVar14 + 0x24); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::EntityRef(); - (*vfunc)(); - } - } - } - } - } - bVar3 = ANM2::IsFinishedImpl(GHIDRA_CAST(local_190.y),GHIDRA_CAST(local_144.y)); - this = player; - if (bVar3 != 0) { - player->_visible = 0; - } - } - if ((this->_flags & 0x4000) == 0) { - bVar3 = HasCollectible(this,0x177,0); - if (bVar3 == 0) { -LAB_0078a11e: - local_128 = GHIDRA_CAST((GHIDRA_UINT(local_128) & 0xffffff)); - } - else { - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::string_from_cstr(&s_empty); - local_8 = 0x13; - local_15c = GHIDRA_CAST((GHIDRA_UINT(local_15c) | 2)); - local_158.y = (float)local_15c; - bVar3 = IsCollectibleAnimFinished(this,0x177,GHIDRA_CAST((local_68 + 0x10))); - local_128 = GHIDRA_CAST(CONCAT13(1,(undefined3)local_128)); - if (bVar3 == 0) goto LAB_0078a11e; - } - local_8 = 0xffffffff; - if ((GHIDRA_UINT(local_15c) & 2) != 0) { - local_15c = GHIDRA_CAST((GHIDRA_UINT(local_15c) & 0xfffffffd)); - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) != '\0') { - ClearCollectibleAnim(this,0x177); - } - bVar3 = HasCollectible(this,399,0); - if (bVar3 == 0) { -LAB_0078a1b2: - local_128 = GHIDRA_CAST((GHIDRA_UINT(local_128) & 0xffffff)); - } - else { - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::string_from_cstr(&s_empty); - local_8 = 0x14; - local_15c = GHIDRA_CAST((GHIDRA_UINT(local_15c) | 4)); - local_158.y = (float)local_15c; - bVar3 = IsCollectibleAnimFinished(this,399,GHIDRA_CAST((local_68 + 0x10))); - local_128 = GHIDRA_CAST(CONCAT13(1,(undefined3)local_128)); - if (bVar3 == 0) goto LAB_0078a1b2; - } - local_8 = 0xffffffff; - if ((GHIDRA_UINT(local_15c) & 4) != 0) { - local_15c = GHIDRA_CAST((GHIDRA_UINT(local_15c) & 0xfffffffb)); - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) != '\0') { - ClearCollectibleAnim(this,399); - } - bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x75); - if (bVar3 == 0) { -LAB_0078a242: - local_128 = GHIDRA_CAST((GHIDRA_UINT(local_128) & 0xffffff)); - } - else { - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::string_from_cstr(&s_empty); - local_8 = 0x15; - local_15c = GHIDRA_CAST((GHIDRA_UINT(local_15c) | 8)); - local_158.y = (float)local_15c; - cVar4 = FUN_007ad720(); - local_128 = GHIDRA_CAST(CONCAT13(1,(undefined3)local_128)); - if (cVar4 == '\0') goto LAB_0078a242; - } - local_8 = 0xffffffff; - if ((GHIDRA_UINT(local_15c) & 8) != 0) { - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) != '\0') { - FUN_007ad610(); - itemConfig = Isaac::GetItemConfig(); - itemCfg = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x75); - RemoveCostume(this,itemCfg); - } - } - update_footprints(this); - if ((this->_variant == 1) || (this->_isCoopGhost != 0)) { - update_baby_skin_effects(this); - } - if ((0 < this->_delayedSfxDelay) && - (iVar6 = this->_delayedSfxDelay + -1, this->_delayedSfxDelay = iVar6, iVar6 == 0)) { - SoundEffects::PlayWithFartOverride(this->_delayedSfxId,this->_delayedSfxVolume,2,0,1.0); - this->_delayedSfxId = 0; - } - bVar3 = Game::GetDebugFlag(g_game,7); - if (bVar3 != 0) { - piVar14 = &this->_activeDesc[0]._charge; - local_120 = GHIDRA_CAST(0x0); - do { - if ((GHIDRA_CAST((piVar14 + -2)))->_item != 0) { - iVar6 = GetActiveMaxCharge(this,GHIDRA_INT(local_120)); - *piVar14 = iVar6; - } - local_120 = GHIDRA_CAST(((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_120)) + 0x0)))))->_buf + 1)); - piVar14 = piVar14 + 8; - } while (local_120 < GHIDRA_CAST(&DAT_00000004)); - if (this->_playerType == 0x19) { - this->_poopMana = 9; - } - } - bVar3 = Game::IsInTimedSet(g_game,1); - if ((bVar3 != 0) && (this->_variant == 0)) { - musicManager = GHIDRA_CAST(MusicManager)::MusicManager(); - fVar30 = (GHIDRA_CAST((&this->_velocity)))->Vector::Length(); - local_13c.y = fVar30 * 0.1 + 0.5; - BVar25 = (BitSet128)ZEXT416(GHIDRA_UINT(local_13c.y)); - MusicManager::PitchSlide(musicManager); - } - bVar3 = Game::IsInTimedSet(g_game,2); - if ((bVar3 != 0) && (this->_variant == 0)) { - musicManager = GHIDRA_CAST(MusicManager)::MusicManager(); - BVar25 = (BitSet128)ZEXT816(0); - FUN_00a155f0(); - MusicManager::PitchSlide(musicManager); - } - bVar3 = Game::IsInTimedSet(g_game,0x25); - if (bVar3 != 0) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - ::(GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - tmpColor = (ColorMod *)::(GHIDRA_CAST(()))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(tmpColor); - } - bVar3 = Game::IsInTimedSet(g_game,0xe); - if (bVar3 != 0) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - ::(GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - tmpColor = (ColorMod *)::(GHIDRA_CAST(()))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(tmpColor); - } - bVar3 = Game::IsInTimedSet(g_game,0x35); - if (bVar3 != 0) { - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::Color(); - ::(GHIDRA_CAST((GHIDRA_CAST(local_98))))->Color::SetColorize(1.0,1.0,1.0,1.0); - this->SetColor(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(local_98)); - } - bVar3 = Game::IsInTimedSet(g_game,0x18); - if (bVar3 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - activeDesc = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetGridIndex(&this->_pos); - local_120 = activeDesc; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - gridEntity = (GHIDRA_CAST((room)))->Room::GetGridEntity(GHIDRA_UINT(activeDesc)); - if (gridEntity == GHIDRA_CAST(0x0)) { - local_12a = 0; - local_128 = GHIDRA_CAST((GHIDRA_UINT(local_128) & 0xffffff)); -LAB_0078a679: - local_121 = '\0'; - } - else { - iVar6 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(); - local_12a = iVar6 == 0xe; - if ((bool)local_12a) { - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(gridEntity))))->EntityList::Size(); - local_128 = GHIDRA_CAST(CONCAT13(iVar6 == 1000,(undefined3)local_128)); -LAB_0078a64a: - iVar6 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(); - if ((iVar6 != 1) && (iVar6 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar6 != 10)) - goto LAB_0078a679; - local_121 = '\x01'; - } - else { - local_121 = '\0'; - local_128 = GHIDRA_CAST((GHIDRA_UINT(local_128) & 0xffffff)); - if (gridEntity != GHIDRA_CAST(0x0)) goto LAB_0078a64a; - } - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((room)))->Room::GetGridPosition(&VStack_1c,GHIDRA_INT(local_120)); - FUN_00a0ff00(); - if ((float)BVar25._l < 20.0 - this->_size * 0.5) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = (GHIDRA_CAST((room)))->Room::is_type_16(); - if ((bVar3 == 0) && - (((gridEntity == GHIDRA_CAST(0x0) || ((*GHIDRA_CAST((GHIDRA_CAST(&(local_128)) + 0x3))) != '\0')) || - ((local_121 != '\0' && (local_12a == 0)))))) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - rng = GHIDRA_CAST(rng_vector_at()); - uVar29 = (GHIDRA_CAST((rng)))->RNG::Next(); - (GHIDRA_CAST((room)))->Room::SpawnGridEntity(GHIDRA_INT(local_120),0xe,0,uVar29,0); - play_sound_with_fart_seed(0x25,0.3,2,0,1.0); - } - } - } - bVar3 = Game::IsInTimedSet(g_game,0x1a); - if ((bVar3 != 0) && (iVar6 = Game::GetFrameCount(g_game), 0x3c < iVar6)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar6 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if ((10 < iVar6) && (bVar3 = IsExtraAnimationFinished(this), bVar3 != 0)) { - FUN_00420ae0(); - cVar4 = FUN_0082ee30(); - if (cVar4 == '\0') { - FUN_00428b50(); - cVar4 = FUN_0082ee30(); - if ((cVar4 == '\0') && - (((local_13c.y = (GHIDRA_CAST((&this->_lastVelocity)))->Vector::Length(), local_13c.y < 0.2 && - (local_13c.y = (GHIDRA_CAST((&this->_recentMovementVector)))->Vector::Length(), local_13c.y < 0.1)) || - ((local_13c.y = (GHIDRA_CAST((&this->_lastVelocity)))->Vector::Length(), local_13c.y < 0.2 && - (this->_collidesWithGrid != 0)))))) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::EntityRef(); - (*vfunc)(); - } - } - } - } - bVar3 = Game::IsInTimedSet(g_game,0x1b); - if ((bVar3 != 0) && (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000), bVar3 == 0)) { - iVar6 = Game::GetFrameCount(g_game); - iVar6 = 0x545 - iVar6 % 0x546; - if (iVar6 == 0) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::EntityRef(); - (*vfunc)(); - fVar30 = 1.0; - fVar21 = 8.0; - } - else { - if ((iVar6 == (iVar6 / 0x1e) * 0x1e) && (iVar6 < 0x97)) { - fVar30 = 1.0; - } - else { - if ((iVar6 != (iVar6 / 0xf) * 0xf) || (0x96 < iVar6)) goto LAB_0078a970; - fVar30 = 0.8; - } - fVar21 = 4.0; - } - SoundEffects::PlayWithFartOverride(0x23,fVar30,0,0,fVar21); - } -LAB_0078a970: - bVar3 = Game::IsInTimedSet(g_game,0x1c); - if ((bVar3 != 0) && (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000), bVar3 == 0)) { - iVar6 = Game::GetFrameCount(g_game); - iVar6 = 53999 - iVar6; - if ((iVar6 < 1) && (bVar3 = IsExtraAnimationFinished(this), bVar3 != 0)) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::EntityRef(); - cVar4 = (*vfunc)(); - if (cVar4 == '\0') goto LAB_0078aa79; - fVar30 = 1.0; - fVar21 = 8.0; - } - else { - if ((iVar6 == (iVar6 / 0x1e) * 0x1e) && (iVar6 < 0x385)) { - fVar30 = 1.0; - } - else { - if ((iVar6 != (iVar6 / 0xf) * 0xf) || (300 < iVar6)) goto LAB_0078aa79; - fVar30 = 0.8; - } - fVar21 = 4.0; - } - SoundEffects::PlayWithFartOverride(0x23,fVar30,0,0,fVar21); - } -LAB_0078aa79: - local_16c.y = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - uVar29 = GHIDRA_UINT(this->_flags); - if ((uVar29 & 0x4000) != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x8000); - local_16c.y = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - uVar29 = GHIDRA_UINT(this->_flags); - } - if ((uVar29 & 0x4000) == 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x8000000); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000); - if ((bVar3 != 0) && ((this->_entityRef2)._entity == this)) { - iVar6 = this->_redHearts - this->_rottenHearts; - if (0 < iVar6) { - if ((this->_soulHearts < 1) && (this->_boneHearts < 1)) { - iVar7 = GetHealthType(this); - iVar7 = scale_for_hard_difficulty(2 - GHIDRA_UINT((iVar7 != 3))); - if (iVar6 <= iVar7) goto LAB_0078ac08; - } - bVar3 = HasInstantDeathCurse(this); - if (bVar3 == 0) { - iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetHitPointsLost(); - uVar29 = this->_bleedOutHealth - iVar6; - this->_bleedOutHealth = uVar29; - if (GHIDRA_INT(uVar29) < 1) { - this->_bleedOutHealth = 600; - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST(local_68))))->EntityRef::EntityRef(); - FUN_00665a30(); - (*vfunc)(); - this = player; - } - else if (GHIDRA_INT(uVar29) < 0x1e) { - uVar29 = uVar29 & 0x80000003; - bVar20 = uVar29 == 0; - if (GHIDRA_INT(uVar29) < 0) { - bVar20 = (uVar29 - 1 | 0xfffffffc) == 0xffffffff; - } - if (bVar20) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - ::(GHIDRA_CAST((GHIDRA_CAST((local_f0 + 0x2c)))))->Color::Color(1.0,0.0,0.0,1.0,0.0,0.0); - (*vfunc)(); - } - } - goto LAB_0078ac1d; - } - } -LAB_0078ac08: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x400000000); - this->_bleedOutHealth = 0; - } -LAB_0078ac1d: - if (this->_playerType == 0x16) { - iVar6 = this->_redHearts; - iVar7 = FUN_007d4320(); - if (((iVar7 < iVar6) || (1 < this->_soulHearts)) || - ((this->_soulHearts == 1 && (0 < this->_boneHearts + iVar6)))) { - if (this->_maggyHealthDrainCooldown == 0) { - this->_maggyHealthDrainCooldown = 300; - } - else { - iVar6 = this->_maggyHealthDrainCooldown + -1; - this->_maggyHealthDrainCooldown = iVar6; - if (iVar6 < 1) { - iVar6 = this->_redHearts; - iVar7 = FUN_007d4320(); - if (iVar7 < iVar6) { - AddHearts(this,-1,0,0); - this->_maggyHealthDrainCooldown = 300; - } - else { - if ((1 < this->_soulHearts) || - ((this->_soulHearts == 1 && (0 < this->_boneHearts + iVar6)))) { - AddSoulHearts(this,-1,0); - } - this->_maggyHealthDrainCooldown = 300; - } - } - } - goto LAB_0078ace4; - } - } - this->_maggyHealthDrainCooldown = 0; - } -LAB_0078ace4: - bVar3 = IsHeldItemVisible(this); - vecResult = &this->_moveToTarget; - this->_isHeldItemVisible = bVar3; - bVar3 = (GHIDRA_CAST((vecResult)))->Vector::operator_ne(&g_vectorZero); - if (bVar3 != 0) { - vecResult2 = (GHIDRA_CAST((vecResult)))->Vector::__sub(&VStack_1c,&this->_pos); - local_13c.y = (GHIDRA_CAST((vecResult2)))->Vector::Length(); - if (1.0 < local_13c.y) { - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&VStack_1c,&this->_pos); - local_13c.y = 0.18; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(GHIDRA_CAST(&local_1a0._h),&local_13c.y); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_16c,vecResult); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetPosition(vecResult); - } - bVar3 = Game::IsGreedMode(g_game); - if (bVar3 == 0) { - if (this->_soulHearts + this->_redHearts < 2) { - iVar6 = Game::GetLastLevelWithoutHalfHp(g_game); - Config::GetCollectibles(); - iVar7 = EntityPtr::Ref(); - noHalfHpFloors = iVar7 - iVar6; - if (9 < iVar7) { - if (iVar7 < 0xc) { - noHalfHpFloors = noHalfHpFloors + -1; - } - else { - noHalfHpFloors = 10 - iVar6; - } - } - if (2 < noHalfHpFloors) { - persistentData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::TryUnlock(persistentData,0x149); - } - } - else { - Config::GetCollectibles(); - iVar6 = EntityPtr::Ref(); - Game::SetLastLevelWithoutHalfHp(g_game,iVar6); - } - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar3 != 0) || (cVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDead(), cVar4 != '\0')) goto LAB_0078b0f0; - qVar2 = this->_flags; - if ((qVar2 & 0x100) == 0) { - if ((qVar2 & 0x200) != 0) { - local_15c = GHIDRA_CAST(0xb67610); - goto LAB_0078af55; - } - if ((qVar2 & 0x1000) != 0) { - local_15c = GHIDRA_CAST(0xb67618); - goto LAB_0078af55; - } - if ((qVar2 & 0x40) != 0) { - local_15c = GHIDRA_CAST(0xb67620); - goto LAB_0078af55; - } - if ((qVar2 & 0x800) != 0) { - local_15c = GHIDRA_CAST(&DAT_00b67628); - goto LAB_0078af55; - } - if ((this->_flags & 0x400000000) != 0) { - local_15c = GHIDRA_CAST(0xb67690); - goto LAB_0078af55; - } - if ((qVar2 & 0x80) != 0) { - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (cVar4 != '\0') { - local_15c = GHIDRA_CAST(&DAT_00b6769c); - goto LAB_0078af55; - } - } - if (0 < this->_pauseTimer) { - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if ((cVar4 != '\0') && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ed2)))) == 0)) { - local_15c = GHIDRA_CAST(0xb6b02c); - goto LAB_0078af55; - } - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_statusEffectSprite))))->Sprite::Stop(); - } - else { - local_15c = GHIDRA_CAST(0xb67630); -LAB_0078af55: - pAVar19 = &this->_statusEffectSprite; - cVar4 = (GHIDRA_CAST((GHIDRA_CAST(pAVar19))))->Sprite::IsLoaded(); - if (cVar4 == '\0') { - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/StatusEffects.anm2")); - local_8 = 0x16; - ANM2::Load(pAVar19,GHIDRA_CAST((local_68 + 0x10)),1); - local_8 = 0xffffffff; - (GHIDRA_CAST((local_68 + 0x10)))->msvc::string::_Tidy_deallocate(); - } - bVar3 = ANM2::IsPlaying(pAVar19,&s_empty); - if (bVar3 != 0) { - ANM2::Update(pAVar19); - } - ANM2::Play(pAVar19,GHIDRA_CAST(local_15c),0); - } - Config::GetPillEffects(); - local_13c.y = (float)FUN_0040bc90(); - bVar3 = IsExtraAnimationFinished(this); - if (bVar3 == 0) { - local_120 = GHIDRA_CAST(0xffffffff); - } - else { - FUN_0041e470(); - local_120 = GHIDRA_CAST(FUN_0040bc90()); - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetOverlayFrame(); - ANM2::GetFrame(&this->_sprite); - FUN_00753830(); - FUN_00839840(); - cVar4 = Level::IsAltStage(); - if (cVar4 != '\0') { - Config::GetCollectibles(); - iVar6 = EntityPtr::Ref(); - if ((iVar6 == 0xc) && (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x96,0), bVar3 != 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar6 = (GHIDRA_CAST((room)))->Room::GetDeliriumDistance(); - iVar6 = Isaac::Random(iVar6 * 0x69 + 0x4b); - if ((iVar6 == 0) && (cVar4 = Game::HasHallucination(g_game), cVar4 == '\0')) { - Game::ShowHallucination(g_game); - } - } - } - cVar4 = Level::IsAltStage(); - if ((cVar4 != '\0') && (cVar4 = Game::HasHallucination(g_game), cVar4 != '\0')) { - FUN_00839830(); - } -LAB_0078b0f0: - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - cVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDead(); - if (cVar4 != '\0') { - msvc::deque<12byte>::_Tidy(); - } - FUN_0060c560(); - _range_to_span(); - cVar4 = FUN_0060c450(); - while (cVar4 != '\0') { - piVar14 = GHIDRA_CAST(FUN_0060c420()); - *piVar14 = *piVar14 + -1; - piVar14 = GHIDRA_CAST(FUN_0060c420()); - if (*piVar14 < 1) { - FUN_00479d50(); - FUN_007dc6d0(); - FUN_0078b330(); - } - else { - FUN_0060c410(); - } - _range_to_span(); - cVar4 = FUN_0060c450(); - } - this->_damageMultiplierStacks = 0; - } - if (this->_isCoopGhost != 0) { - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (cVar4 != '\0') { - this->_entityCollisionClass = 0; - } - this->_entityGridCollisionClass = 3; - } - bVar3 = IsHologram(this); - if (bVar3 != 0) { - this->_entityCollisionClass = 0; - } - Game::GetField26614(g_game); - cVar4 = DeathmatchManager::is_active(); - if (cVar4 != '\0') { - entityList = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar14 = GHIDRA_CAST((GHIDRA_CAST((entityList)))->EntityList)::Size(); - (**(code **)(*piVar14 + 0x58))(); - } - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar3 == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16b8)))) = 0; - } - FUN_00864130(); - ExceptionList = local_10; - return; -} - -// 0078b350 -uint8_t Entity_Player::IsHeadless() -{ - uint8_t isHasEffect; - TemporaryEffects *tempEffects; - - isHasEffect = HasCollectible(this,0xce,0); - if (isHasEffect == 0) { - tempEffects = &this->_temporaryeffects; - isHasEffect = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x145); - if (isHasEffect == 0) { - isHasEffect = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0xce); - if (isHasEffect == 0) { - isHasEffect = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x37); - if (isHasEffect == 0) { - isHasEffect = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x2d9); - if (isHasEffect == 0) { - return 0; - } - } - } - } - } - return 1; -} - -// 0078ca00 -void Entity_Player::Render(Vector *offset) -{ - uint8_t bVar1; - short sVar2; - float *extraout_EAX; - Entity_Player *localPlayer; - float *pfVar3; - void *pvVar4; - Vector *pVVar5; - KColor *color; - uint32_t extraout_EDX; - uint32_t extraout_EDX_00; - uint32_t uVar6; - Manager *manager; - int iVar7; - uint32_t afterImageIdx; - float fVar8; - float fVar9; - float fVar10; - float fVar11; - float shadowHeight; - double flooredCoord; - uint8_t auStack_164 [24]; - float fStack_14c; - KColor *imageRefCount; - uint8_t auStack_12a [2]; - float quad0X; - float quad0Y; - float quad1X; - float quad1Y; - float quad2X; - float quad2Y; - float quad3X; - float quad3Y; - KColor drawColor; - Vector local_9c; - float local_94; - float local_90; - Entity_Player *local_8c; - Vector *renderOffset; - Vector renderPos; - float netplayAlpha; - float heldScaleX; - float heldOffsetY; - float heldScaleY; - uint32_t isHeldBehind; - float local_68; - float local_64; - char isHolding; - float local_5c; - float local_58; - float local_54; - Vector local_50; - Vector local_48; - ColorMod tmpColor; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - float local_8; - Game *game; - int *heldEntity; - int shadowImageHeight; - - local_8 = -NAN; - puStack_c = &LAB_00aff61d; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((&tmpColor)[1]._colorize); - renderOffset = offset; - local_8c = this; - if (this->_variant == 2) { - if (this->_target == 0) { - return; - } - } - else if (this->_target == 0) { - local_64 = offset->x; - local_54 = offset->y; - if ((this->_flags & 0x200000000000000) == 0) { - local_64 = local_64 + (this->_posOffset).x * 0.65; - local_54 = local_54 + (this->_posOffset).y * 0.65; - } - ExceptionList = &local_10; - renderPos.x = local_64; - renderPos.y = local_54; - if (this->_canFly != 0) { - GetFlyingOffset(this,&local_9c); - renderPos.x = local_64 + *extraout_EAX; - renderPos.y = local_54 + extraout_EAX[1]; - } - fVar9 = 1.0; - netplayAlpha = 1.0; - manager = g_manager; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - bVar1 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerIndex); - manager = g_manager; - if (bVar1 == 0) { - FUN_00925df0(); - netplayAlpha = fVar9; - } - } - if (this->_visible == 0) { - ExceptionList = local_10; - return; - } - if ((((0 < this->_damageCooldown) && (this->_damageCooldown % 6 < 3)) && - (bVar1 = IsExtraAnimationFinished(this), bVar1 != 0)) && - ((g_game->_challenge != 0x1e && - (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x1000000000), bVar1 == 0)))) { - ExceptionList = local_10; - return; - } - if (((manager->_netplayManager != *GHIDRA_CAST((manager + 1))) && - (1 < GHIDRA_UINT((*GHIDRA_CAST((manager + 1)) - manager->_netplayManager >> 2)))) && - ((bVar1 = IsInvisible(this), bVar1 == 0 || - (localPlayer = GHIDRA_CAST(FUN_0090b0e0()), localPlayer == this)))) { - iVar7 = *GHIDRA_CAST((*GHIDRA_CAST(this->_shadowImage) + 0x10)); - shadowImageHeight = *GHIDRA_CAST((*GHIDRA_CAST(this->_shadowImage) + 0x14)); - local_54 = (float)((double)iVar7 + __uint_to_double_fixup[-(iVar7 >> 0x1f)]); - local_90 = (float)((double)shadowImageHeight + - __uint_to_double_fixup[-(shadowImageHeight >> 0x1f)]); - FUN_00682260(); - local_5c = this->_shadowSize * (this->_sprite)._scale.x; - if (0.001 <= local_5c) { - get_netplay_player_color(&g_game->_playerManager,&tmpColor,this); - bVar1 = IsLocalPlayer(this); - if (bVar1 == 0) { - tmpColor._tint[3] = netplayAlpha; - } - local_64 = g_displayPixelRatio * g_screenPointScale; - local_50.y = ((((this->_pos).x + (this->_shadowOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_64 + 0.5; - flooredCoord = floor((double)local_50.y); - local_58 = (float)flooredCoord / local_64; - local_50.y = ((((this->_pos).y + (this->_shadowOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * local_64 + 0.5; - flooredCoord = floor((double)local_50.y); - game = g_game; - local_50.y = (float)flooredCoord; - fVar9 = local_5c * local_54; - shadowHeight = local_5c * local_90; - fVar11 = local_50.y / local_64; - local_48.x = fVar9; - local_48.y = shadowHeight; - (GHIDRA_CAST((&drawColor)))->KColor::SetFromARGB(0xffffffff); - pVVar5 = &local_48; - local_50.x = (local_58 + renderOffset->x + (game->_screenShakeOffset).x) - fVar9 * 0.5; - local_50.y = (fVar11 + renderOffset->y + (game->_screenShakeOffset).y) - shadowHeight * 0.5; - imageRefCount = color; - render_quad_set_rect(&quad0X,&local_50,pVVar5,color); - (GHIDRA_CAST((auStack_12a + -10)))->KAGE::SmartPointer::operator_assign(this->_shadowImage); - apply_sprite_shader_params(&tmpColor,1,pVVar5,imageRefCount); - drawColor._unk = 0; - drawColor._red = tmpColor._tint[0]; - drawColor._green = tmpColor._tint[1]; - drawColor._blue = tmpColor._tint[2]; - drawColor._alpha = tmpColor._tint[3]; - (**(code **)(**GHIDRA_CAST(this->_shadowImage) + 0x1c))(); - this = local_8c; - } - } - pvVar4 = this->_heldEntity; - isHolding = pvVar4 != (void *)0x0; - heldOffsetY = 0.0; - local_64 = 0.0; - heldScaleX = g_vectorOne.x; - local_9c.y = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12bc)); - heldScaleY = g_vectorOne.y; - local_58 = 0.0; - isHeldBehind = isHeldBehind & 0xffffff00; - if (pvVar4 == (void *)0x0) goto LAB_0078d290; - isHeldBehind = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x354)) >> 0x1f; - if ((this->_itemState == 0x25c) || (1 < this->_suplexState)) { - if ((this->_bodySprite)._animState._animData == (void *)0x0) { -LAB_0078ced5: - if (1 < this->_suplexState) { - pfVar3 = ANM2::GetLayerFrame(&this->_sprite,0); - uVar6 = extraout_EDX_00; - if (pfVar3 != GHIDRA_CAST(0x0)) goto LAB_0078cef6; - } - isHolding = '\0'; - goto LAB_0078d290; - } - pfVar3 = AnimationState::GetNullFrameById(&(this->_bodySprite)._animState,0); - uVar6 = extraout_EDX; - if (pfVar3 == GHIDRA_CAST(0x0)) goto LAB_0078ced5; -LAB_0078cef6: - local_64 = *pfVar3; - heldOffsetY = pfVar3[1]; - if (1 < this->_suplexState) { - heldScaleX = pfVar3[4]; - heldScaleY = pfVar3[5]; - isHeldBehind = CONCAT31((int3)(GHIDRA_UINT(uVar6) >> 8),this->_suplexState == 4); - local_58 = pfVar3[0x11]; - local_50.y = *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0x7c)); - if (local_50.y != 0.0) { - local_90 = INFINITY; - local_54 = INFINITY; - local_5c = 0.0; - if (*GHIDRA_CAST((GHIDRA_CAST(local_50.y) + 0x1c)) != 0) { - iVar7 = 0; - do { - local_48.y = (float)ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(this->_heldEntity) + 0x48)), - *GHIDRA_CAST((iVar7 + *GHIDRA_CAST((GHIDRA_CAST(local_50.y) + 0x18)) - ))); - pvVar4 = AnimationState::GetLayerFrame - (GHIDRA_CAST((GHIDRA_INT(this->_heldEntity) + 0x78)), - *GHIDRA_CAST((iVar7 + *GHIDRA_CAST((GHIDRA_CAST(local_50.y) + 0x18))))); - if (pvVar4 != (void *)0x0) { - fStack_14c = 1.109483e-38; - render_build_sprite_quad - (&quad0X,&g_vectorZero,pvVar4,GHIDRA_CAST(local_48.y),&g_vectorZero, - &g_vectorZero,GHIDRA_CAST((GHIDRA_INT(this->_heldEntity) + 0x48))); - fVar9 = quad0X; - if (local_90 <= quad0X) { - fVar9 = local_90; - } - fVar11 = quad0Y; - if (local_54 <= quad0Y) { - fVar11 = local_54; - } - if (quad2X < fVar9) { - fVar9 = quad2X; - } - else { - } - if (quad2Y < fVar11) { - fVar11 = quad2Y; - } - else { - } - if (quad1X < fVar9) { - fVar9 = quad1X; - } - else { - } - if (quad1Y < fVar11) { - fVar11 = quad1Y; - } - else { - } - local_90 = quad3X; - if (fVar9 <= quad3X) { - local_90 = fVar9; - } - local_54 = quad3Y; - if (fVar11 <= quad3Y) { - local_54 = fVar11; - } - } - iVar7 = iVar7 + 0x10; - local_5c = (float)(GHIDRA_INT(local_5c) + 1); - } while (GHIDRA_UINT(local_5c) < GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(local_50.y) + 0x1c)))); - } - sVar2 = fdclass(); - if (sVar2 < 1) { - fVar9 = heldScaleY * 0.2 * local_54; - if (local_58 == 0.0) { - heldOffsetY = heldOffsetY - fVar9; - } - else { - heldOffsetY = heldOffsetY + fVar9; - } - } - } - } - } - pvVar4 = this->_heldEntity; - if (((pvVar4 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x171)) == '\0')) && - ((char)isHeldBehind != '\0')) { - local_48.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe4)); - local_5c = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe8)); - local_50.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xfc)); - local_54 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xec)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe4)) = heldScaleX * local_48.y; - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe8)) = heldScaleY * local_5c; - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xec)) = local_54 + local_58; - bVar1 = IsLocalPlayer(this); - if (bVar1 == 0) { - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xfc)) = local_50.y * netplayAlpha; - } - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0x171)) = 1; - heldEntity = this->_heldEntity; - local_94 = ((this->_pos).x - (float)heldEntity[0xcf]) * 0.65 + renderPos.x + local_64; - local_90 = ((this->_pos).y - (float)heldEntity[0xd0]) * 0.65 + renderPos.y + heldOffsetY; - (**(code **)(*heldEntity + 0x14))(); - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0x171)) = 0; - pvVar4 = this->_heldEntity; - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe4)) = local_48.y; - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe8)) = local_5c; - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xec)) = local_54; - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xfc)) = local_50.y; - } -LAB_0078d290: - tmpColor._tint[0] = (this->_sprite)._color._tint[0]; - tmpColor._tint[1] = (this->_sprite)._color._tint[1]; - tmpColor._tint[2] = (this->_sprite)._color._tint[2]; - tmpColor._tint[3] = (this->_sprite)._color._tint[3]; - tmpColor._offset[2] = (this->_sprite)._color._offset[2]; - afterImageIdx = 0; - tmpColor._colorize[0] = (this->_sprite)._color._colorize[0]; - tmpColor._colorize[1] = (this->_sprite)._color._colorize[1]; - tmpColor._colorize[2] = (this->_sprite)._color._colorize[2]; - tmpColor._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpColor._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - if ((this->_afterImageFrames)._size != 0) { - do { - local_50.y = (float)(this->_afterImageFrames)._offset; - fVar9 = (float)**GHIDRA_CAST((GHIDRA_INT((this->_afterImageFrames)._map) + - (afterImageIdx + GHIDRA_INT(local_50.y) & - (this->_afterImageFrames)._mapSize - 1) * 4)) / 10.0; - if (fVar9 <= 0.0) { - fVar9 = 0.0; - } - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - tmpColor._tint[3] = fVar9 * (this->_sprite)._color._tint[3] * netplayAlpha; - render_color_stack_push(&tmpColor); - local_50.y = (float)(this->_afterImageFrames)._offset; - iVar7 = *GHIDRA_CAST((GHIDRA_INT((this->_afterImageFrames)._map) + - (GHIDRA_INT(local_50.y) + afterImageIdx & (this->_afterImageFrames)._mapSize - 1) * - 4)); - local_48.x = (*GHIDRA_CAST((iVar7 + 4)) - (this->_pos).x) * 0.65 + renderPos.x; - local_48.y = (*GHIDRA_CAST((iVar7 + 8)) - (this->_pos).y) * 0.65 + renderPos.y; - Render(this,&local_48,0); - g_colorStackSize = g_colorStackSize - 1; - if (g_colorStackSize == 0) { - DAT_00c78dbc = 0; - } - afterImageIdx = afterImageIdx + 1; - } while (afterImageIdx < (this->_afterImageFrames)._size); - } - Render(this,&renderPos,1); - if (((isHolding != '\0') && (pvVar4 = this->_heldEntity, pvVar4 != (void *)0x0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x171)) == '\0' && ((char)isHeldBehind == '\0')))) { - local_50.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xfc)); - local_48.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe4)); - local_5c = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe8)); - local_54 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xec)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe4)) = heldScaleX * local_48.y; - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe8)) = heldScaleY * local_5c; - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xec)) = local_54 + local_58; - bVar1 = IsLocalPlayer(this); - if (bVar1 == 0) { - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xfc)) = local_50.y * netplayAlpha; - } - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0x171)) = 1; - heldEntity = this->_heldEntity; - local_68 = ((this->_pos).x - (float)heldEntity[0xcf]) * 0.65 + renderPos.x + local_64; - local_64 = ((this->_pos).y - (float)heldEntity[0xd0]) * 0.65 + renderPos.y + heldOffsetY; - (**(code **)(*heldEntity + 0x14))(); - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0x171)) = 0; - pvVar4 = this->_heldEntity; - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe4)) = local_48.y; - *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xe8)) = local_5c; - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xec)) = local_54; - *GHIDRA_CAST((GHIDRA_CAST(this->_heldEntity) + 0xfc)) = local_50.y; - } - FUN_00864210(); - if ((this->_playerHUD != (void *)0x0) && - ((local_9c.y == 1.4013e-45 || (local_9c.y == 4.2039e-45)))) { - local_48.x = (this->_renderPosition).x + 0.0; - local_48.y = (this->_renderPosition).y - (this->_playerSpriteScale).y * 30.0; - FUN_0084a870(); - } - if ((1 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))) && - (((local_9c.y == 1.4013e-45 || (local_9c.y == 4.2039e-45)) && - (*GHIDRA_CAST(&g_game->_roomTransition) == 0)))) { - iVar7 = PlayerManager::GetPlayerSlotFromController - (&g_game->_playerManager,this->_controllerIndex); - if (-1 < iVar7) { - local_50.y = g_displayPixelRatio * g_screenPointScale; - fVar9 = (g_manager->_optionsConfig)._hudOffset; - local_54 = fVar9 * 12.0 + 16.0; - local_5c = fVar9 * 28.0 + 10.0; - local_48.y = ((g_screenWidth - 338.0) * 0.5 + ((this->_pos).x - 60.0) * 0.65) * local_50.y + - 0.5; - flooredCoord = floor((double)local_48.y); - local_64 = (float)flooredCoord / local_50.y; - local_48.y = (((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * local_50.y - + 0.5; - flooredCoord = floor((double)local_48.y); - game = g_game; - local_48.y = (float)flooredCoord; - local_64 = local_64 + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1204)); - local_58 = local_48.y / local_50.y + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1208)); - fVar9 = local_64; - if (local_64 <= g_vectorZero.x) { - fVar9 = g_vectorZero.x; - } - if (g_screenWidth + 0.0 <= fVar9) { - fVar9 = g_screenWidth + 0.0; - } - fVar11 = local_58; - if (local_58 <= g_vectorZero.y) { - fVar11 = g_vectorZero.y; - } - if (g_screenHeight + 10.0 <= fVar11) { - fVar11 = g_screenHeight + 10.0; - } - fVar9 = sqrtf((local_58 - fVar11) * (local_58 - fVar11) + - (local_64 - fVar9) * (local_64 - fVar9)); - fVar11 = (fVar9 - 30.0) / 250.0; - if (fVar11 <= 0.0) { - fVar11 = 0.0; - } - if (1.0 <= fVar11) { - fVar11 = 1.0; - } - fVar8 = local_5c + g_vectorZero.x + 0.0; - fVar10 = (fVar9 - 10.0) / 140.0; - fVar9 = local_64; - if (local_64 <= fVar8) { - fVar9 = fVar8; - } - if (fVar10 <= 0.0) { - fVar10 = 0.0; - } - if (1.0 <= fVar10) { - fVar10 = 1.0; - } - fVar8 = ((g_screenWidth - local_5c) - 0.0) + 0.0; - if (fVar8 <= fVar9) { - fVar9 = fVar8; - } - fVar8 = local_54 + g_vectorZero.y + 10.0; - if (local_58 <= fVar8) { - local_58 = fVar8; - } - fVar8 = ((g_screenHeight - local_54) - 10.0) + 35.0; - if (fVar8 <= local_58) { - local_58 = fVar8; - } - if (0.0 < fVar10 + 0.0) { - iVar7 = this->_playerType; - fVar8 = ((2.0 - fVar11) - 2.0) * -1.0; - local_50.x = fVar9 - (2.0 - fVar11) * 0.5; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - if (1.0 <= fVar8) { - fVar8 = 1.0; - } - local_50.y = (-18.0 - (fVar8 + fVar8)) + local_58; - get_netplay_player_color(&game->_playerManager,GHIDRA_CAST(auStack_164),local_8c); - HUD::render_player_type_icon(iVar7,&local_50); - this = local_8c; - } - } - } - if ((this->_dead == 0) && ((local_9c.y == 1.4013e-45 || (local_9c.y == 4.2039e-45)))) { - render_charge_bars(this,&this->_renderPosition); - if (((this->_statusEffectSprite)._loaded != 0) && - (((this->_statusEffectSprite)._animState._animData != (void *)0x0 && - ((this->_statusEffectSprite)._animState._isPlaying != 0)))) { - local_48.y = (this->_statusEffectSprite)._color._tint[3]; - pfVar3 = &(this->_playerSpriteScale).y; - fVar9 = *pfVar3; - (this->_statusEffectSprite)._color._tint[3] = local_48.y * netplayAlpha; - pVVar5 = &this->_playerSpriteScale; - if (fVar9 < (this->_playerSpriteScale).x) { - pVVar5 = GHIDRA_CAST(pfVar3); - } - fVar11 = pVVar5->x * g_vectorOne.x; - (this->_statusEffectSprite)._scale.y = pVVar5->x * g_vectorOne.y; - (this->_statusEffectSprite)._scale.x = fVar11; - local_50.x = fVar9 * 0.0 + (this->_renderPosition).x; - local_50.y = fVar9 * -35.0 + (this->_renderPosition).y; - ANM2::Render(&this->_statusEffectSprite,&local_50,&g_vectorZero,&g_vectorZero); - (this->_statusEffectSprite)._color._tint[3] = local_48.y; - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c5c)))) != 0) && (0 < g_game->_hallucinationTimer)) { - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c58))))))->HallucinationOverlay::Render(renderOffset); - } - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - ExceptionList = local_10; - return; - } - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 0x5c))(); - ExceptionList = local_10; - return; - } - ExceptionList = &local_10; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - bVar1 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerIndex); - if (bVar1 == 0) goto LAB_0078dbfd; - } - local_50.y = g_displayPixelRatio * g_screenPointScale; - local_48.y = (((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_50.y + 0.5; - local_5c = ((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5; - flooredCoord = floor((double)local_48.y); - local_8c = GHIDRA_CAST(((float)flooredCoord / local_50.y)); - local_48.y = local_5c * local_50.y + 0.5; - flooredCoord = floor((double)local_48.y); - local_48.y = (float)flooredCoord; - tmpColor._colorize[0] = 1.4013e-45; - tmpColor._colorize[1] = 9.18341e-41; - tmpColor._colorize[2] = 0.0; - tmpColor._colorize[3] = 1.0; - tmpColor._offset[0] = -NAN; - tmpColor._offset[1] = 0.0; - tmpColor._offset[2] = 0.0; - local_8 = 0.0; - drawColor._unk = 0; - drawColor._red = 1.0; - drawColor._green = 0.6; - drawColor._blue = 0.6; - drawColor._alpha = 1.0; - Font::DrawString(&g_manager->_font6_PFTempestaSevenCondensed,&DAT_00b6b080,&drawColor, - tmpColor._colorize,(float)local_8c + offset->x + 0.0, - (local_48.y / local_50.y + offset->y) - 40.0); -LAB_0078dbfd: - ExceptionList = local_10; - return; -} - -// 0078dc20 -uint8_t Entity_Player::RenderShadowLayer(Vector *offset) -{ - uint8_t bVar1; - - bVar1 = HasCollectible(this,0x1b1,0); - if (bVar1 == 0) { - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::RenderShadowLayer(offset); - return bVar1; - } - return 1; -} - -// 0078dc60 -void Entity_Player::RenderGlow(Vector *position) -{ - uint8_t bVar1; - LayerState *layer; - ANM2 *glowSprite; - int extraout_EDX; - int extraout_EDX_00; - float alphaCopy; - uint8_t *layerName; - float savedAlpha; - int costumeIdx; - - if (this->_visible != 0) { - bVar1 = IsFullSpriteRendering(this); - if (bVar1 == 0) { - costumeIdx = this->_playerCostumeMap[0]._index; - if (costumeIdx < 0) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - savedAlpha = (layer->_color)._tint[3]; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - alphaCopy = savedAlpha; - bVar1 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerIndex); - if (bVar1 == 0) { - ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - FUN_00925df0(); - *GHIDRA_CAST((extraout_EDX_00 + 0x54)) = alphaCopy * savedAlpha; - } - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RenderLayer(0,position,&g_vectorZero,&g_vectorZero); - layerName = GHIDRA_CAST(0x0); - glowSprite = &this->_sprite; - } - else { - layer = ANM2::GetLayer(GHIDRA_CAST((costumeIdx * 0x130 + GHIDRA_INT((this->_costumeSpriteDescs)._begin) - )),GHIDRA_CAST(this->_playerCostumeMap[0]._layerID)); - savedAlpha = (layer->_color)._tint[3]; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - alphaCopy = savedAlpha; - bVar1 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerIndex); - if (bVar1 == 0) { - ANM2::GetLayer(GHIDRA_CAST((this->_playerCostumeMap[0]._index * 0x130 + - GHIDRA_INT((this->_costumeSpriteDescs)._begin))), - GHIDRA_CAST(this->_playerCostumeMap[0]._layerID)); - FUN_00925df0(); - *GHIDRA_CAST((extraout_EDX + 0x54)) = alphaCopy * savedAlpha; - } - } - (GHIDRA_CAST(((Sprite *) - (this->_playerCostumeMap[0]._index * 0x130 + - GHIDRA_INT((this->_costumeSpriteDescs)._begin)))))->Sprite::RenderLayer(this->_playerCostumeMap[0]._layerID,position,&g_vectorZero,&g_vectorZero); - layerName = GHIDRA_CAST(this->_playerCostumeMap[0]._layerID); - glowSprite = GHIDRA_CAST((this->_playerCostumeMap[0]._index * 0x130 + - GHIDRA_INT((this->_costumeSpriteDescs)._begin))); - } - layer = ANM2::GetLayer(glowSprite,layerName); - (layer->_color)._tint[3] = savedAlpha; - } - } - return; -} - -// 0078dde0 -void Entity_Player::RenderBody(Vector *position) -{ - uint8_t isCheck; - int iVar1; - void *pvVar2; - uint32_t layerId; - float prevGushOffsetY; - float gushOffsetY; - Vector local_10; - int *costumeItem; - int costumeItemType; - bool isBodyRendered; - - if ((this->_visible != 0) && (isCheck = IsFullSpriteRendering(this), isCheck == 0)) { - prevGushOffsetY = 0.0; - gushOffsetY = 0.0; - layerId = 1; - isBodyRendered = false; - do { - iVar1 = this->_playerCostumeMap[layerId]._index; - if (iVar1 < 0) { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RenderLayer(layerId,position,&g_vectorZero,&g_vectorZero); - isBodyRendered = true; - prevGushOffsetY = gushOffsetY; - } - else { - if ((this->_canFly == 0) || - (*GHIDRA_CAST((iVar1 * 0x130 + 0x11d + GHIDRA_INT((this->_costumeSpriteDescs)._begin))) != '\0')) { - if (layerId == 1) { - local_10.x = (float)(iVar1 * 0x130); - costumeItem = *GHIDRA_CAST((GHIDRA_CAST(local_10.x) + 0x114 + - GHIDRA_INT((this->_costumeSpriteDescs)._begin))); - if (costumeItem != GHIDRA_CAST(0x0)) { - costumeItemType = *costumeItem; - if (costumeItemType == 0) { - if (costumeItem[1] - 0x4bU < 4) { - gushOffsetY = *GHIDRA_CAST((GHIDRA_CAST(local_10.x) + 0xa0 + - GHIDRA_INT((this->_costumeSpriteDescs)._begin))) * -15.0; - goto LAB_0078dedb; - } - } - else if ((((costumeItemType == 1) || (costumeItemType == 3)) || (costumeItemType == 4) - ) && (costumeItem[1] == 0x271)) { - gushOffsetY = *GHIDRA_CAST((GHIDRA_CAST(local_10.x) + 0xa0 + - GHIDRA_INT((this->_costumeSpriteDescs)._begin))) * -65.0; -LAB_0078dedb: - if (prevGushOffsetY <= gushOffsetY) { - gushOffsetY = prevGushOffsetY; - } - } - } - } - (GHIDRA_CAST((GHIDRA_CAST((iVar1 * 0x130 + GHIDRA_INT((this->_costumeSpriteDescs)._begin))))))->Sprite::RenderLayer(this->_playerCostumeMap[layerId]._layerID,position,&g_vectorZero, - &g_vectorZero); - iVar1 = this->_playerCostumeMap[layerId]._index * 0x130; - pvVar2 = (this->_costumeSpriteDescs)._begin; - prevGushOffsetY = gushOffsetY; - if (((*GHIDRA_CAST((iVar1 + 0x34 + GHIDRA_INT(pvVar2))) != 0) && - (pvVar2 = AnimationState::GetLayerFrame - (GHIDRA_CAST((GHIDRA_INT(pvVar2) + iVar1 + 0x30)), - this->_playerCostumeMap[layerId]._layerID), pvVar2 != (void *)0x0 - )) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x2c)) != '\0')) { - isBodyRendered = true; - goto LAB_0078df80; - } - } - } -LAB_0078df80: - layerId = layerId + 1; - } while (layerId < 4); - if ((isBodyRendered) && (isCheck = IsHeadless(this), isCheck != 0)) { - local_10.x = position->x + 0.0; - local_10.y = gushOffsetY * 0.65 + position->y; - (GHIDRA_CAST((GHIDRA_CAST(&this->_bloodGushSprite))))->Sprite::RenderLayer(0,&local_10,&g_vectorZero,&g_vectorZero) - ; - } - } - return; -} - -// 0078dff0 -void Entity_Player::RenderHead(Vector *position) -{ - uint8_t bVar1; - uint32_t layerId; - Sprite *costumeSprite; - AnimationState *secondAnimState; - uint32_t layer; - int *costumeLayerIdPtr; - - if (this->_visible != 0) { - bVar1 = IsFullSpriteRendering(this); - if (bVar1 == 0) { - layer = 4; - costumeLayerIdPtr = &this->_playerCostumeMap[4]._layerID; - do { - if ((GHIDRA_CAST((costumeLayerIdPtr + -1)))->_index < 0) { - costumeSprite = GHIDRA_CAST(&this->_sprite); - layerId = layer; - } - else { - costumeSprite = - (Sprite *) - ((GHIDRA_CAST((costumeLayerIdPtr + -1)))->_index * 0x130 + - GHIDRA_INT((this->_costumeSpriteDescs)._begin)); - layerId = *costumeLayerIdPtr; - } - (GHIDRA_CAST((costumeSprite)))->Sprite::RenderLayer(layerId,position,&g_vectorZero,&g_vectorZero); - layer = layer + 1; - costumeLayerIdPtr = costumeLayerIdPtr + 4; - } while (layer < 0xb); - bVar1 = HasCollectible(this,0x1ba,0); - if ((bVar1 != 0) && ((this->_darkPrincesCrownSprite)._loaded != 0)) { - if ((this->_darkPrincesCrownSprite)._overlayRenderFirst == 0) { - AnimationState::Render - (&(this->_darkPrincesCrownSprite)._animState,position,&g_vectorZero, - &g_vectorZero); - secondAnimState = &(this->_darkPrincesCrownSprite)._overlayAnimState; - } - else { - AnimationState::Render - (&(this->_darkPrincesCrownSprite)._overlayAnimState,position,&g_vectorZero, - &g_vectorZero); - secondAnimState = &(this->_darkPrincesCrownSprite)._animState; - } - AnimationState::Render(secondAnimState,position,&g_vectorZero,&g_vectorZero); - } - bVar1 = HasCollectible(this,0x19f,0); - if ((bVar1 != 0) && ((this->_crownOfLightSprite)._loaded != 0)) { - if ((this->_crownOfLightSprite)._overlayRenderFirst == 0) { - AnimationState::Render - (&(this->_crownOfLightSprite)._animState,position,&g_vectorZero,&g_vectorZero); - secondAnimState = &(this->_crownOfLightSprite)._overlayAnimState; - } - else { - AnimationState::Render - (&(this->_crownOfLightSprite)._overlayAnimState,position,&g_vectorZero, - &g_vectorZero); - secondAnimState = &(this->_crownOfLightSprite)._animState; - } - AnimationState::Render(secondAnimState,position,&g_vectorZero,&g_vectorZero); - } - } - } - return; -} - -// 0078e190 -void Entity_Player::RenderTop(Vector *param_2) -{ - uint8_t isFullSprite; - int costumeIndex; - - if (this->_visible != 0) { - isFullSprite = IsFullSpriteRendering(this); - if (isFullSprite == 0) { - costumeIndex = this->_playerCostumeMap[0xb]._index; - if (-1 < costumeIndex) { - (GHIDRA_CAST(((Sprite *) - (costumeIndex * 0x130 + GHIDRA_INT((this->_costumeSpriteDescs)._begin)))))->Sprite::RenderLayer(this->_playerCostumeMap[0xb]._layerID,param_2,&g_vectorZero, - &g_vectorZero); - return; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::RenderLayer(0xb,param_2,&g_vectorZero,&g_vectorZero); - } - } - return; -} - -// 0078fec0 -void Entity_Player::RemoveCollectibleByHistoryIndex(int index, uint8_t RemovedBool) -{ - int collectibleId; - uint8_t isInSet; - void *historyItems; - - if (((-1 < index) && - (historyItems = (this->_history)._historyItems._begin, - index < (GHIDRA_INT((this->_history)._historyItems._end) - GHIDRA_INT(historyItems)) / 0x1c)) && - (*GHIDRA_CAST((GHIDRA_CAST(historyItems) + index * 0x1c + 4)) == '\0')) { - collectibleId = *GHIDRA_CAST((GHIDRA_CAST(historyItems) + index * 0x1c + 8)); - if (collectibleId < 0) { - isInSet = collectible_set_has(&this->_proceduralItems,collectibleId); - if (isInSet != 0) goto LAB_0078ff31; - } - else if (0 < *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + collectibleId * 4))) { -LAB_0078ff31: - isInSet = (this->_history)._isLocked; - (this->_history)._isLocked = 1; - RemoveCollectible(this,*GHIDRA_CAST((GHIDRA_CAST(historyItems) + index * 0x1c + 8)),1,0,1); - (this->_history)._isLocked = isInSet; - (GHIDRA_CAST((&this->_history)))->History::RemoveHistoryItemByIndex(index); - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - return; - } - } - return; -} - -// 0078ff90 -void Entity_Player::TriggerCollectibleRemoved(int collectibleID) -{ - std_vector *itemRng; - char isUserTracked; - uint8_t bVar1; - int iVar2; - uint32_t uVar3; - Vector *spawnPos; - ItemConfig_Item *itemConfig; - RNG *itemRng; - uint32_t uVar4; - uint32_t uVar5; - short newCatLives; - QueueItemData *srcSlot; - int *pocketSlot; - uint64_t netUserId; - int *local_1c; - int excessPockets; - uint32_t slotIndex; - Vector freePosOut; - Game *game; - void *nullItems; - - game = g_game; - itemRng = &g_game->_onlinePlayerStats; - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && (this != GHIDRA_CAST(0x0))) { - netUserId = player_get_net_user_id(this); - local_1c = GHIDRA_CAST((netUserId >> 0x20)); - if ((netUserId != 0xffffffffffffffff) && - ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 && ((*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x1c030))) == '\0')))) { - isUserTracked = FUN_00425a70(netUserId); - if (isUserTracked == '\0') { - online_stats_add_user(itemRng,GHIDRA_UINT(netUserId),GHIDRA_UINT(local_1c)); - } - iVar2 = FUN_00426560(GHIDRA_UINT(netUserId),local_1c); - if (iVar2 != 0) { - *GHIDRA_CAST((iVar2 + 0x14)) = *GHIDRA_CAST((iVar2 + 0x14)) - 1.0; - } - } - } - if (collectibleID < 0x12f) { - if ((collectibleID == 0x12e) || (collectibleID == 0xc)) { - IncrementPlayerFormCounter(this,0xd,-1); - } - else if (collectibleID == 0x51) { - iVar2 = GetCollectibleNum(this,0x51,0); - newCatLives = this->_deadCatLives; - if (iVar2 * 9 < GHIDRA_INT(this->_deadCatLives)) { - newCatLives = (short)(iVar2 * 9); - } - this->_deadCatLives = newCatLives; - } - } - else if (collectibleID == 0x2b6) { - AddBrokenHearts(this,-3); - } - iVar2 = GetCollectibleNum(this,collectibleID,0); - if (0 < iVar2) { - return; - } - if (collectibleID < 0xfc) { - if (collectibleID == 0xfb) { -switchD_0079018f_caseD_fc: - uVar3 = GetMaxPocketItems(this); - uVar4 = GHIDRA_UINT((this->_pocketSlots[0] != 0)); - uVar5 = uVar4 + 1; - if (this->_pocketSlots[2] == 0) { - uVar5 = uVar4; - } - uVar4 = uVar5 + 1; - if (this->_pocketSlots[4] == 0) { - uVar4 = uVar5; - } - uVar5 = uVar4 + 1; - if (this->_pocketSlots[6] == 0) { - uVar5 = uVar4; - } - iVar2 = uVar5 - uVar3; - excessPockets = iVar2; - if (iVar2 < 1) goto switchD_0079018f_caseD_fd; - slotIndex = 3; - local_1c = this->_pocketSlots + 6; - do { - pocketSlot = local_1c; - if (iVar2 < 1) break; - if ((*local_1c != 0) && (local_1c[1] != 2)) { - uVar3 = Random(); - uVar5 = *pocketSlot; - spawnPos = Room::FindFreePickupSpawnPosition - (g_game->_room,&freePosOut,&this->_pos,40.0,0,0,0); - pocketSlot = local_1c; - uVar4 = 0x46; - if (local_1c[1] == 1) { - uVar4 = 300; - } - Game::SpawnEx(g_game,5,uVar4,spawnPos,&g_vectorZero,GHIDRA_CAST(this),uVar5,uVar3,0); - if (slotIndex < 3) { - srcSlot = GHIDRA_CAST((pocketSlot + 2)); - for (uVar5 = (3 - slotIndex) * 2 & 0x3ffffffe; uVar5 != 0; uVar5 = uVar5 - 1) { - *pocketSlot = GHIDRA_INT(srcSlot->_item); - srcSlot = GHIDRA_CAST(&srcSlot->_charge); - pocketSlot = pocketSlot + 1; - } - pocketSlot = local_1c; - } - iVar2 = excessPockets + -1; - this->_pocketSlots[6] = 0; - this->_pocketSlots[7] = 1; - excessPockets = iVar2; - } - slotIndex = slotIndex - 1; - local_1c = pocketSlot + -2; - } while (-1 < GHIDRA_INT(slotIndex)); - } - else { - if (collectibleID == 0x23) { -switchD_0079018f_caseD_106: - IncrementPlayerFormCounter(this,0xf,-1); - goto switchD_0079018f_caseD_fd; - } - if (collectibleID != 0x8b) goto switchD_0079018f_caseD_fd; -switchD_0079025a_caseD_1ca: - if (this->_trinketsID[1] == 0) goto switchD_0079018f_caseD_fd; - uVar3 = Random(); - uVar5 = this->_trinketsID[1]; - spawnPos = Room::FindFreePickupSpawnPosition(g_game->_room,&freePosOut,&this->_pos,40.0,0,0,0) - ; - Game::SpawnEx(g_game,5,0x15e,spawnPos,&g_vectorZero,GHIDRA_CAST(this),uVar5,uVar3,0); - this->_trinketsID[1] = 0; - } - } - else { - if (collectibleID < 0x1b8) { - if (collectibleID == 0x1b7) { - bVar1 = HasTrinket(this,0x79,0); - if (bVar1 != 0) { - remove_wooden_cross_mantles(this); - } - goto switchD_0079018f_caseD_fd; - } - switch(collectibleID) { - case 0xfc: - case 0x1a0: - goto switchD_0079018f_caseD_fc; - case 0x106: - goto switchD_0079018f_caseD_106; - case 0x122: - UseActiveItem(this,GHIDRA_CAST(&local_1c),collectibleID,1,-1,0); - break; - case 0x197: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x197,1); - itemRng = GetCollectibleRNG(this,0x197); - uVar5 = (GHIDRA_CAST((itemRng)))->RNG::RandomInt(4); - this->_purityState = uVar5; - nullItems = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItems) & 0xfffffffcU)) < - 0x45) { - RemoveCostume(this,GHIDRA_CAST(0x0)); - } - else { - RemoveCostume(this,*GHIDRA_CAST((GHIDRA_CAST(nullItems) + 0x44))); - } - } - goto switchD_0079018f_caseD_fd; - } - switch(collectibleID) { - case 0x1c6: - goto switchD_0079018f_caseD_fc; - case 0x1ca: - goto switchD_0079025a_caseD_1ca; - case 0x1f5: - update_greeds_gullet(this); - break; - case 0x232: - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef4)))) == 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0)) { - FUN_007d3e00(); - } - break; - case 0x244: - (GHIDRA_CAST((g_game->_room)))->Room::UpdateRedKey(); - } - } -switchD_0079018f_caseD_fd: - itemConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,collectibleID); - bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(collectibleID); - if (((bVar1 != 0) && (itemConfig != GHIDRA_CAST(0x0))) && - (itemConfig->clearEffectsOnRemove != 0)) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(collectibleID,1); - } - return; -} - -// 007907a0 -void Entity_Player::ClearTemporaryEffects() -{ - void *pvVar1; - uint8_t isMirrorDimension; - int iVar2; - int *piVar3; - int *itemConfig; - int *collectibleNode; - int trinketEffect [3]; - uint32_t local_c; - uint32_t collectibleId; - - if (GHIDRA_INT((this->_temporaryeffects)._effects._end) - GHIDRA_INT((this->_temporaryeffects)._effects._begin) - >> 4 != 0) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::ClearEffects(0); - } - iVar2 = this->_strengthMaxHearts; - if (0 < iVar2) { - do { - if (2 < this->_soulHearts + this->_boneHearts * 2 + this->_maxHearts) { - AddMaxHearts(this,-2,0); - } - iVar2 = iVar2 + -1; - } while (iVar2 != 0); - } - this->_strengthMaxHearts = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x170c)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1710)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1714)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1718)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x171c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1720)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1724)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1728)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x172c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1730)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1734)))) = 0; - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar3 = (this->_temporaryeffects)._effects._begin; - piVar3 != (this->_temporaryeffects)._effects._end; piVar3 = piVar3 + 4) { - if ((*GHIDRA_CAST(*piVar3) == 0) && ((GHIDRA_CAST(*piVar3))[1] == 0x70)) { - if (piVar3[1] == 2) { - iVar2 = g_game->_currentDimensionIdx; - if (*GHIDRA_CAST(&g_game->_roomTransition) != 0) { - iVar2 = (g_game->_roomTransition)._targetDimension; - } - isMirrorDimension = Level::HasMirrorDimension(GHIDRA_CAST(g_game)); - if ((isMirrorDimension == 0) || (iVar2 == 0)) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x70,-1); - pvVar1 = this->_backupPlayer; - if ((pvVar1 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1519)) == '\0')) { - piVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x150c)); - goto joined_r0x00790924; - } - } - } - break; - } - } -LAB_00790947: - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar3 = (this->_temporaryeffects)._effects._begin; - piVar3 != (this->_temporaryeffects)._effects._end; piVar3 = piVar3 + 4) { - if ((*GHIDRA_CAST(*piVar3) == 2) && ((GHIDRA_CAST(*piVar3))[1] == 0xa2)) { - if ((piVar3[1] == 1) && - ((pvVar1 = (g_manager->_itemConfig)._trinkets._begin, - 0x288 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU - )) && (iVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x288)), iVar2 != 0)))) { - trinketEffect[2] = *GHIDRA_CAST((iVar2 + 0x78)); - trinketEffect[1] = 0; - local_c = 0; - trinketEffect[0] = iVar2; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(trinketEffect,1); - } - break; - } - } - } - } - if ((this->_roomTemporaryCollectibles)._size != 0) { - piVar3 = (this->_roomTemporaryCollectibles)._head; - collectibleNode = GHIDRA_CAST(*piVar3); - if (collectibleNode != piVar3) { - do { - piVar3 = collectibleNode; - collectibleId = collectibleNode[4]; - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(collectibleId)) goto LAB_00790a4a; -LAB_00790a64: - itemConfig = GHIDRA_CAST(0x0); - } - else if (GHIDRA_INT(collectibleId) < 0) { - if ((GHIDRA_INT(collectibleId) < 0) && - (pvVar1 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~collectibleId) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar1) >> 2)) { - itemConfig = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar1) + ~collectibleId * 4))); - } - else { - itemConfig = GHIDRA_CAST(0x0); - } - } - else { -LAB_00790a4a: - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) >> 2 <= - GHIDRA_INT(collectibleId)) goto LAB_00790a64; - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + collectibleId * 4)); - } - if ((*itemConfig != 3) && (iVar2 = 0, 0 < collectibleNode[5])) { - do { - RemoveCollectible(this,itemConfig[1],1,0,1); - iVar2 = iVar2 + 1; - } while (iVar2 < piVar3[5]); - } - piVar3[5] = 0; - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&collectibleNode); - piVar3 = (this->_roomTemporaryCollectibles)._head; - } while (collectibleNode != piVar3); - } - FID_conflict__Erase_tree_>_> - (&this->_roomTemporaryCollectibles, - (fuzzer_allocator_> *) - &this->_roomTemporaryCollectibles,(_Tree_node *)piVar3[1]); - piVar3[1] = GHIDRA_INT(piVar3); - *piVar3 = GHIDRA_INT(piVar3); - piVar3[2] = GHIDRA_INT(piVar3); - (this->_roomTemporaryCollectibles)._size = 0; - } - SetPocketActiveItem(this,0,3,0); - return; -joined_r0x00790924: - if (piVar3 == *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1510))) goto LAB_00790947; - if ((*GHIDRA_CAST(*piVar3) == 0) && ((GHIDRA_CAST(*piVar3))[1] == 0x70)) { - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar1) + 0x1508)))))->TemporaryEffects::RemoveNullEffect(0x70,-1); - goto LAB_00790947; - } - piVar3 = piVar3 + 4; - goto joined_r0x00790924; -} - -// 007910f0 -int Entity_Player::GetTotalActiveCharge(int slot) -{ - ItemConfig_Item *item; - int chargeMode; - int iVar1; - int bethanyCharge; - - iVar1 = this->_activeDesc[slot]._batteryCharge + this->_activeDesc[slot]._charge; - if (this->_playerType == 0x12) { - bethanyCharge = this->_effectiveSoulCharge; - } - else { - bethanyCharge = 0; - if (this->_playerType == 0x24) { - bethanyCharge = this->_effectiveBloodCharge; - } - } - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,this->_activeDesc[slot]._item); - if (item != GHIDRA_CAST(0x0)) { - if ((item->type == 3) && ((item->id == 0x28f || (item->id == 0x146)))) { - chargeMode = 2; - } - else if ((item->chargeType == 1) || ((item->chargeType == 2 && (0xc < item->maxCharges)))) { - chargeMode = 1; - } - else { - chargeMode = 0; - } - if (chargeMode == 1) { - if ((0 < bethanyCharge) && (iVar1 < item->maxCharges)) { - iVar1 = item->maxCharges; - } - return iVar1; - } - if (chargeMode == 2) { - return iVar1; - } - } - return bethanyCharge + iVar1; -} - -// 007911c0 -int Entity_Player::GetActiveItemSlot(int id) -{ - uint32_t slot; - ActiveItemDesc *activeDesc; - - slot = 0; - activeDesc = this->_activeDesc; - do { - if (activeDesc->_item == id) { - return slot; - } - slot = slot + 1; - activeDesc = activeDesc + 1; - } while (slot < 4); - return -1; -} - -// 007911f0 -int Entity_Player::GetCollectibleMaxCharge(int collectibleId, int varData, int unused) -{ - uint8_t isConditionMet; - ItemConfig_Item *pIVar1; - - if (((((collectibleId == 0x11e) || (collectibleId == 0x107)) || (collectibleId == 0x15c)) || - (collectibleId == 0x1fe)) && (0 < varData)) { - return varData; - } - if (collectibleId == 0x1e9) { - if ((varData & 0xffffU) != 0) { - return varData & 0xffffU; - } - } - else if (collectibleId == 0x2c9) { - if (this->_playerType == 0x1a) { - return 0x1e; - } - } - else if (collectibleId == 0x2d2) { - if (((this->_playerType == 0x25) || (this->_playerType == 0x27)) && - (isConditionMet = HasCollectible(this,0x26b,0), isConditionMet != 0)) { - return 300; - } - } - else if (collectibleId == 0x2c7) { - if ((this->_playerType == 0x1d) || (this->_playerType == 0x26)) { - return 4; - } - } - else if (collectibleId == 0x1a6) { - if (varData < 3) { - return 0; - } - } - else if (((collectibleId == 0x23) && - (isConditionMet = HasPlayerForm(this,0xf), isConditionMet != 0)) && (varData == 1)) { - return 10; - } - pIVar1 = ItemConfig::GetCollectible(&g_manager->_itemConfig,collectibleId); - if (pIVar1 == GHIDRA_CAST(0x0)) { - return 0; - } - return pIVar1->maxCharges; -} - -// 00791320 -int Entity_Player::GetActiveMaxCharge(int slot) -{ - int maxCharge; - - if ((slot == 3) || - (((slot == 2 && (this->_activeDesc[2]._item == 0x244)) && (g_game->_challenge == 0x2c)))) { - return 0; - } - maxCharge = GetCollectibleMaxCharge - (this,this->_activeDesc[slot]._item,this->_activeDesc[slot]._varData, - GHIDRA_INT(this)); - return maxCharge; -} - -// 00791420 -void Entity_Player::SetActiveCharge(int charge, int slot) -{ - uint8_t isBulbTrinketHeld; - int previousTotalCharge; - int iVar1; - uint32_t eachSlot; - int iVar2; - Game *game; - - if (slot < 0) { - eachSlot = 0; - do { - SetActiveCharge(this,charge,eachSlot); - eachSlot = eachSlot + 1; - } while (eachSlot < 4); - return; - } - if (3 < slot) { - return; - } - previousTotalCharge = GetTotalActiveCharge(this,slot); - if (this->_activeDesc[slot]._item != 0) { - iVar1 = GetActiveMaxCharge(this,slot); - iVar2 = charge; - if (iVar1 < charge) { - iVar2 = iVar1; - } - this->_activeDesc[slot]._charge = iVar2; - iVar2 = charge - iVar1; - if (iVar2 < 0) { - iVar2 = 0; - } - if (iVar2 < iVar1) { - iVar1 = iVar2; - } - this->_activeDesc[slot]._batteryCharge = iVar1; - } - iVar1 = GetTotalActiveCharge(this,slot); - if ((previousTotalCharge != iVar1) && - ((isBulbTrinketHeld = HasTrinket(this,0x65,0), isBulbTrinketHeld != 0 || - (isBulbTrinketHeld = HasTrinket(this,100,0), isBulbTrinketHeld != 0)))) { - this->_cacheFlags = this->_cacheFlags | 0x41f; - EvaluateItems(this); - } - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 00791510 -void Entity_Player::SetActiveVarData(int vardata, int slot) -{ - this->_activeDesc[slot]._varData = vardata; - return; -} - -// 00791a40 -void Entity_Player::ControlActiveItem(int slot) -{ - Manager *pMVar1; - uint8_t bVar2; - char cVar3; - uint32_t uVar4; - void *pvVar5; - float *drainAmount; - Entity *breathEffect; - Entity_Familiar *wisp; - ItemConfig_Item *pIVar6; - ItemConfig_Item *itemConfig; - uint32_t seed; - int iVar7; - uint16_t *extraout_EAX; - uint16_t *extraout_EAX_00; - int *piVar8; - uint32_t *extraout_ECX; - int extraout_ECX_00; - int extraout_ECX_01; - int unused; - int unused_00; - int iVar9; - int unused_01; - int *piVar10; - Entity_Player *this_00; - uint32_t nearbyCount; - int extraout_EDX; - int iVar11; - float in_XMM0_Da; - float distSq; - float fVar12; - uint32_t uVar13; - Vector *position; - TypeDescriptor *pTVar14; - TypeDescriptor *pTVar15; - uint8_t isDontUpdate; - uint32_t uVar16; - EntityRef local_c8; - int totalChargeBefore; - int *candidateItems; - int *candidateItemsEnd; - int *candidateItemsCapacity; - Vector local_90; - uint8_t local_88 [4]; - int *local_84; - int *local_80; - uint8_t *local_7c; - Vector local_78; - uint32_t local_70; - Vector local_6c; - int slotOffset; - int local_60; - int savedSlot; - uint16_t local_56; - Manager *local_54; - Manager *local_50; - int local_4c; - ItemConfig_Item *local_48; - uint8_t local_44; - char local_43; - char isItemPressed; - char isItemTriggered; - uint32_t local_40; - uint32_t uStack_3c; - uint32_t uStack_38; - uint32_t uStack_34; - uint32_t local_30; - uint32_t uStack_2c; - uint32_t uStack_28; - uint32_t uStack_24; - uint32_t local_20; - uint32_t local_1c; - uint32_t local_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *breathEffectSlot; - Game *game; - int *itemEntry; - code *takeDamageFn; - - local_8 = 0xffffffff; - puStack_c = &LAB_00aff6b3; - local_10 = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - savedSlot = slot; - if (this->_variant == 1) { - return; - } - if (this->_isCoopGhost != 0) { - return; - } - ExceptionList = &local_10; - local_14 = uVar4; - bVar2 = IsHologram(this); - if (bVar2 != 0) { - ExceptionList = local_10; - return; - } - iVar9 = this->_playerType; - if (iVar9 == 0x28) { - ExceptionList = local_10; - return; - } - iVar11 = 9; - if ((iVar9 == 0x13) || (iVar9 == 0x14)) { - local_44 = 1; - cVar3 = FUN_006f0040(uVar4); - isItemTriggered = '\x01'; - if (cVar3 == '\0') goto LAB_00791acf; - } - else { - local_44 = 0; -LAB_00791acf: - isItemTriggered = '\0'; - } - breathEffectSlot = &g_manager->_netplayManager; - local_43 = (g_manager->_optionsConfig)._jacobEsauControls == 0; - if (*breathEffectSlot != *GHIDRA_CAST((g_manager + 1))) { - pvVar5 = (GHIDRA_CAST((breathEffectSlot)))->InputManager::GetDeviceByPlayerEntity(this); - breathEffectSlot = extraout_ECX; - if (pvVar5 != (void *)0x0) { - local_43 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x3d0)) == 0; - } - } - if (((isItemTriggered != '\0') && (local_43 != '\0')) || (slot != 0)) { - iVar11 = 10; - } - bVar2 = input_is_action_pressed - (iVar11,this->_controllerIndex,GHIDRA_CAST(this),GHIDRA_INT(breathEffectSlot)); - if (bVar2 == 0) { -LAB_00791b40: - isItemPressed = '\0'; - } - else { - cVar3 = FUN_00708350(); - isItemPressed = '\x01'; - if (cVar3 != '\0') goto LAB_00791b40; - } - bVar2 = input_is_action_triggered(g_manager,iVar11,this->_controllerIndex,GHIDRA_CAST(this),0); - iVar9 = extraout_ECX_00; - if (bVar2 == 0) { -LAB_00791b6a: - isItemTriggered = '\0'; - } - else { - cVar3 = FUN_00708350(); - isItemTriggered = '\x01'; - iVar9 = extraout_ECX_01; - if (cVar3 != '\0') goto LAB_00791b6a; - } - if (local_44 != 0) { - if (local_43 == '\0') { - cVar3 = FUN_00753bf0(); - if (((cVar3 != '\0') && - (bVar2 = input_is_action_pressed(0xb,this->_controllerIndex,GHIDRA_CAST(this),unused), - bVar2 != 0)) || - ((cVar3 = FUN_006f0040(), cVar3 != '\0' && - (bVar2 = input_is_action_pressed(0xb,this->_controllerIndex,GHIDRA_CAST(this),unused_00), - bVar2 == 0)))) goto LAB_00791bd4; - } - else { - bVar2 = input_is_action_pressed(0xb,this->_controllerIndex,GHIDRA_CAST(this),iVar9); - if ((bVar2 != 0) && (this->_twinPlayer != 0)) { -LAB_00791bd4: - isItemTriggered = '\0'; - isItemPressed = '\0'; - } - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x800); - if (((bVar2 != 0) || (this->_hasCurseMistEffect != 0)) || (this->_isCoopGhost != 0)) { - isItemTriggered = '\0'; - isItemPressed = '\0'; - } - if ((this->_itemStateCooldown != 0) && (this->_itemState != 0)) { - ExceptionList = local_10; - return; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_56)) + 0x1))) = (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26cc))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26cc))) = 0; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_56)) + 0x1))) != '\0') { - isItemTriggered = '\x01'; - isItemPressed = '\x01'; - } - totalChargeBefore = GetTotalActiveCharge(this,slot); - if ((this->_itemState == 0x2c5) || (this->_suplexState != 0)) { - if (this->_suplexState != 2) { - ExceptionList = local_10; - return; - } - if (isItemTriggered == '\0') { - ExceptionList = local_10; - return; - } - if (this->_suplexAimCountdown < 2) { - ExceptionList = local_10; - return; - } - this->_suplexAimCountdown = 1; - ExceptionList = local_10; - return; - } - local_70 = local_70 & 0xffffff; - if (((((((slot == 0) && (isItemPressed == '\0')) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000), bVar2 == 0)) && - ((bVar2 = HasTrinket(this,0x95,0), bVar2 != 0 && - (iVar9 = this->_activeDesc[0]._item, iVar9 != 0)))) && - ((cVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->KAGE_Filesys_FileManager::OpenRead(iVar9,0), - cVar3 != '\0' && ((this->_entityCollisionClass != 0 && (this->_itemState == 0)))))) && - (this->_damageCooldown < 2)) && - (bVar2 = HasInvincibility(this,0,GHIDRA_CAST(0x0)), bVar2 == 0)) { - in_XMM0_Da = this->_friction * (this->_velocity).x; - local_90.y = this->_speedMultiplier * this->_friction * (this->_velocity).y + (this->_pos).y; - local_90.x = this->_speedMultiplier * in_XMM0_Da + (this->_pos).x; - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_88),&local_90, - this->_size + 150.0,GHIDRA_UINT((1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) * 4 + 10); - uVar4 = 0; - nearbyCount = GHIDRA_UINT(local_7c); - if (local_7c != GHIDRA_CAST(0x0)) { - do { - breathEffect = GHIDRA_CAST(local_84[uVar4]); - if ((breathEffect->_dead == 0) && (breathEffect->_entityCollisionClass != 0)) { - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (breathEffect->_type != 1)) { - iVar9 = breathEffect->_type; - if ((((0x3dd < iVar9 - 10U) && (iVar9 != 9)) && (iVar9 != 2)) || - ((iVar9 == 0x21 && (breathEffect->_variant == 4)))) goto LAB_00791f0d; - } - else { - iVar9 = 1; - } - if ((breathEffect->_flags & 0x20000000) == 0) { - if (iVar9 == 9) { - if ((breathEffect[1]._type & 0x80000000U) == 0) goto LAB_00791e44; - } - else { - in_XMM0_Da = 0.0; - if (0.0 < breathEffect->_collisionDamage) { -LAB_00791e44: - local_90.x = this->_speedMultiplier * this->_friction * (this->_velocity).x; - local_90.y = this->_speedMultiplier * this->_friction * (this->_velocity).y; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetCollisionCapsule(&local_c8,&local_90); - local_78.y = breathEffect->_speedMultiplier * - (breathEffect->_velocity).y * breathEffect->_friction; - in_XMM0_Da = breathEffect->_speedMultiplier * - (breathEffect->_velocity).x * breathEffect->_friction; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x0))) = SUB41(in_XMM0_Da,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x1))) = (uint8_t)(GHIDRA_UINT(in_XMM0_Da) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x2))) = (uint16_t)(GHIDRA_UINT(in_XMM0_Da) >> 0x10); - (GHIDRA_CAST((breathEffect)))->Entity::GetCollisionCapsule(&uStack_3c,&local_78); - local_6c.y = 0.0; - local_6c.x = 0.0; - bVar2 = Capsule::Collide(GHIDRA_CAST(&local_c8),GHIDRA_CAST(&uStack_3c),&local_6c); - if (bVar2 != 0) { - local_70 = CONCAT13(1,(undefined3)local_70); - isItemTriggered = '\x01'; - isItemPressed = '\x01'; - break; - } - nearbyCount = GHIDRA_UINT(local_7c); - } - } - } - } -LAB_00791f0d: - uVar4 = uVar4 + 1; - } while (uVar4 < nearbyCount); - } - (GHIDRA_CAST((local_88)))->EntityList_Query::~EntityList_Query(); - slot = savedSlot; - } - local_50 = GHIDRA_CAST((GHIDRA_UINT(local_50) & 0xffffff00)); - slotOffset = GHIDRA_INT((slot + 0xac)) * 0x20; - local_43 = '\0'; - local_90.y = *GHIDRA_CAST((GHIDRA_INT(&(this->_sprite)._filename) + slotOffset + -0x48)); - if (local_90.y == 4.56823e-43) { - local_4c = slot * 0x20; - bVar2 = AreControlsEnabled(this); - if (bVar2 == 0) { - iVar9 = this->_activeDesc[slot]._timeRechargeCooldown; -LAB_007922ae: - if (((9 < iVar9) && (*GHIDRA_CAST(&g_game->_roomTransition) == 0)) && - ((bVar2 = AreControlsEnabled(this), bVar2 == 0 || (isItemPressed == '\0')))) { - local_43 = '\x01'; - bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x146); - pMVar1 = g_manager; - if (bVar2 == 0) { - local_48 = GHIDRA_CAST(0x10b); - seed_fart_sound_override(GHIDRA_CAST(&local_48)); - (GHIDRA_CAST((&pMVar1->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_48),1.0,2,0,1.0,0.0); - DischargeActiveItem(this,slot,0); - iVar9 = local_4c; - } - else { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x146,-1); - iVar9 = slot * 0x20; - if (this->_activeDesc[slot]._charge == 0) { - DischargeActiveItem(this,slot,0); - this->_activeDesc[slot]._timeRechargeCooldown = 9; - isItemTriggered = '\0'; - goto LAB_007926d7; - } - } - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._timeRechargeCooldown) + iVar9)) = 9; - } - } - else { - iVar9 = this->_activeDesc[slot]._timeRechargeCooldown; - if (*GHIDRA_CAST(&g_game->_roomTransition) != 0) goto LAB_007922ae; - if ((9 < iVar9) && (isItemPressed != '\0')) { -LAB_00791ff1: - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar2 == 0) { - iVar9 = GetActiveMaxCharge(this,slot); - local_54 = GHIDRA_CAST((GHIDRA_INT((iVar9 + (iVar9 >> 0x1f & 3U))) >> 2)); - bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x146); - if (bVar2 == 0) { - local_48 = GHIDRA_CAST(this->_activeDesc[slot]._batteryCharge); - local_6c.y = (float)&DAT_00000004; - if (GHIDRA_INT(local_48) < 1) { - piVar8 = &this->_activeDesc[slot]._charge; - local_48 = GHIDRA_CAST(*piVar8); - drainAmount = &local_6c.y; - if (GHIDRA_INT(local_48) < 5) { - drainAmount = GHIDRA_CAST(piVar8); - } - AddActiveCharge(this,-GHIDRA_INT(*drainAmount),slot,0,0,0); - iVar9 = this->_activeDesc[slot]._charge; - } - else { - drainAmount = &local_6c.y; - if (GHIDRA_INT(local_48) < 5) { - drainAmount = GHIDRA_CAST(&this->_activeDesc[slot]._batteryCharge); - } - AddActiveCharge(this,-GHIDRA_INT(*drainAmount),slot,0,0,0); - iVar9 = this->_activeDesc[slot]._batteryCharge; - } - if (iVar9 < 1) { - bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x146); - if (bVar2 == 0) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x146,0,2); - pMVar1 = g_manager; - local_48 = GHIDRA_CAST(0x1fa); - seed_fart_sound_override(GHIDRA_CAST(&local_48)); - (GHIDRA_CAST((&pMVar1->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_48),1.0,2,0,1.0,0.0); - breathEffectSlot = &this->_breathOfLifeEffect; - if (GHIDRA_CAST(this->_breathOfLifeEffect) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_breathOfLifeEffect) + 0x28))(); - if (*breathEffectSlot != 0) { - local_6c.y = (float)breathEffectSlot; - msvc::multiset::erase(&local_6c.y); - } - *breathEffectSlot = 0; - } - uVar4 = Random(); - breathEffect = Game::Spawn(g_game,1000,0x7b,&this->_pos,&this->_velocity, - GHIDRA_CAST(this),9,uVar4); - *breathEffectSlot = breathEffect; - (breathEffect->_posOffset).x = 0.0; - (breathEffect->_posOffset).y = -15.0; - local_54 = GHIDRA_CAST((*breathEffectSlot + 0x3bc)); - if (*GHIDRA_CAST(local_54) != 0) { - local_6c.y = (float)local_54; - msvc::multiset::erase(&local_6c.y); - } - *GHIDRA_CAST(local_54) = this; - msvc::multiset::insert(local_54); - ANM2::Play(GHIDRA_CAST((*breathEffectSlot + 0x48)),GHIDRA_CAST("Appear"),0); - bVar2 = HasCollectible(this,0x3b,0); - if (bVar2 != 0) { - local_40 = 0x3f800000; - uStack_3c = 0x3f800000; - uStack_38 = 0x3f800000; - uStack_34 = 0x3f800000; - in_XMM0_Da = 1.0; - local_30 = 0x3f800000; - uStack_2c = 0x3d4ccccd; - uStack_28 = 0x3d75c28f; - uStack_24 = 0x3f800000; - local_20 = 0; - local_1c = 0xbe4ccccd; - local_18 = 0xbe4ccccd; - (**(code **)(*GHIDRA_CAST(*breathEffectSlot) + 0x3c))(&local_40,0xffffffff,0xff,0,1); - } - (**(code **)(*GHIDRA_CAST(*breathEffectSlot) + 0xc))(); - isItemTriggered = '\0'; - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._timeRechargeCooldown) + local_4c)) = 0xb; - goto LAB_007926d7; - } - } - else { - local_6c.y = (float)(iVar9 / GHIDRA_INT(local_54)); - if (GHIDRA_INT(local_6c.y) < GHIDRA_INT(local_48) / GHIDRA_INT(local_54)) { - in_XMM0_Da = (float)GHIDRA_INT(local_6c.y) * 0.2; - fVar12 = 1.6 - in_XMM0_Da; - if (fVar12 <= 1.0) { - fVar12 = 1.0; - } - if (1.6 <= fVar12) { - fVar12 = 1.6; - } - play_sound_with_fart_seed(0x1fb,1.0,1,0,fVar12); - } - } - } - } -LAB_00792293: - this->_activeDesc[slot]._timeRechargeCooldown = 0xb; - isItemTriggered = '\0'; - goto LAB_007926d7; - } - if (isItemTriggered == '\0') goto LAB_007922ae; - if (9 < iVar9) goto LAB_00791ff1; - iVar9 = GetActiveMaxCharge(this,slot); - if (iVar9 <= this->_activeDesc[slot]._charge) { - local_50 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x1))),1)); - iVar9 = GetActiveMaxCharge(this,slot); - if (this->_activeDesc[slot]._batteryCharge < iVar9) { - this->_activeDesc[slot]._batteryCharge = 0; - this->_activeDesc[slot]._timeRechargeCooldown = 0xb; - isItemTriggered = '\0'; - goto LAB_007926d7; - } - goto LAB_00792293; - } - } - isItemTriggered = '\0'; - } - else if (local_90.y == 9.94922e-43) { - if ((GHIDRA_CAST(slot) == GHIDRA_CAST(0x2)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000), bVar2 == 0)) { - if ((this->_itemState == 0x2c6) && - (((bVar2 = AreControlsEnabled(this), bVar2 != 0 && (isItemPressed != '\0')) && - (this->_bagOfCraftingOutput != 0)))) { - this->_bagOfCraftingHoldFrames = this->_bagOfCraftingHoldFrames + 1; - if (0x1d < this->_bagOfCraftingHoldFrames) { - ResetItemState(this); - iVar9 = this->_bagOfCraftingOutput; - local_48 = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar9); - if (local_48 != GHIDRA_CAST(0x0)) { - AnimateCollectible(this,iVar9,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - if (local_48->type == 3) { - FlushQueueItem(this); - pMVar1 = GHIDRA_CAST(this->_activeDesc[0]._item); - local_6c.y = (float)pMVar1; - bVar2 = ItemConfig::IsValidCollectible(GHIDRA_INT(pMVar1)); - if (((bVar2 != 0) && (pMVar1 != GHIDRA_CAST(0x248))) && - ((bVar2 = HasCollectible(this,0x216,0), bVar2 == 0 || - ((bVar2 = ItemConfig::IsValidCollectible(this->_activeDesc[1]._item), bVar2 != 0 - && (this->_activeDesc[1]._item != 0x248)))))) { - RemoveCollectible(this,GHIDRA_UINT(pMVar1),0,0,0); - bVar2 = Game::IsGreedMode(g_game); - uVar4 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_6c.y) * 0x10 + - GHIDRA_INT((this->_collectibleRNGs)._begin))))))->RNG::Next(); - tainted_cain_pedestal_burst(this,&this->_pos,unused_01,uVar4,GHIDRA_UINT(bVar2) << 4); - } - } - HUD::ShowItemText(&g_game->_hud,this,local_48); - iVar9 = ItemPool::GetFirstItemPoolForCollectible - (&g_game->_itemPool,this->_bagOfCraftingOutput); - SetQueuedItem(this,local_48,local_48->_initCharge,0,0,iVar9); - bVar2 = HasCollectible(this,0x248,0); - if (bVar2 != 0) { - position = &this->_pos; - isDontUpdate = 0; - bVar2 = 0; - iVar9 = Entity_Familiar::GetRandomWisp - (GHIDRA_CAST((GHIDRA_INT((this->_collectibleRNGs)._begin) + 0x2c60))); - AddWisp(this,iVar9,position,bVar2,isDontUpdate); - } - } - game = g_game; - in_XMM0_Da = 0.0; - this->_bagOfCraftingHoldFrames = 0; - this->_bagOfCraftingOutput = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f50)))) = 0xffffffff; - this->_bagOfCraftingContent[0] = 0; - this->_bagOfCraftingContent[1] = 0; - this->_bagOfCraftingContent[2] = 0; - this->_bagOfCraftingContent[3] = 0; - this->_bagOfCraftingContent[4] = 0; - this->_bagOfCraftingContent[5] = 0; - this->_bagOfCraftingContent[6] = 0; - this->_bagOfCraftingContent[7] = 0; - HUD::InvalidateCraftingItem(&game->_hud,this); - pMVar1 = g_manager; - local_48 = GHIDRA_CAST(0x84); - seed_fart_sound_override(GHIDRA_CAST(&local_48)); - (GHIDRA_CAST((&pMVar1->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_48),1.0,2,0,1.0,0.0); - } - } - else { - this->_bagOfCraftingHoldFrames = 0; - } - } - } - else if (local_90.y == 9.1785e-43) { - local_44 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x32); - game = g_game; - if (local_44 == 0) { - bVar2 = AreControlsEnabled(this); - if ((bVar2 != 0) && (local_50 = GHIDRA_CAST((GHIDRA_UINT(local_50) & 0xff)), isItemPressed != '\0')) { - local_50 = GHIDRA_CAST(0x1); - } - } - else { - this->_activeDesc[slot]._timeRechargeCooldown = 0xf; - if (((*GHIDRA_CAST(&game->_roomTransition) == 0) && - ((bVar2 = AreControlsEnabled(this), bVar2 == 0 || (isItemPressed == '\0')))) || - (this->_activeDesc[slot]._charge < 1)) { - local_43 = '\x01'; - } - } - bVar2 = HasCollectible(this,0x248,0); - if ((((bVar2 != 0) && (local_44 != 0)) && (local_43 == '\0')) && - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(6,0), bVar2 != 0 && - (wisp = AddWisp(this,0x28f,&this->_pos,0,1), wisp != GHIDRA_CAST(0x0))))) { - uVar13 = *GHIDRA_CAST((GHIDRA_INT(&wisp->_flags) + 4)); - iVar9 = *GHIDRA_CAST(wisp); - *GHIDRA_CAST(&wisp->_flags) = GHIDRA_UINT(wisp->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&wisp->_flags) + 4)) = uVar13; - wisp->_isNotCountedAsFollower = 1; - (**(code **)(iVar9 + 0xc))(); - } - } -LAB_007926d7: - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if ((bVar2 == 0) && (GHIDRA_CAST(slot) == GHIDRA_CAST(0x0))) { - local_4c = 0; - uVar4 = 0; - do { - iVar9 = *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._timeRechargeCooldown) + uVar4)); - if (0 < iVar9) { - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._timeRechargeCooldown) + uVar4)) = iVar9 + -1; - } - if (*GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._item) + uVar4)) != 0) { - pIVar6 = GHIDRA_CAST(GetActiveMaxCharge(this,local_4c)); - local_48 = pIVar6; - local_78.y = (float)GetActiveMaxCharge(this,local_4c); - local_54 = GHIDRA_CAST(GetActiveMaxCharge(this,local_4c)); - if (*GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._timeRechargeCooldown) + uVar4)) < 1) { - local_6c.y = (float)g_manager; - itemConfig = ItemConfig::GetCollectible - (&g_manager->_itemConfig, - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._item) + uVar4))); - if ((itemConfig != GHIDRA_CAST(0x0)) && (itemConfig->chargeType == 1)) { - iVar9 = 1; - if (*GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._item) + uVar4)) == 0x246) { - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar8 = (this->_temporaryeffects)._effects._begin; - piVar8 != (this->_temporaryeffects)._effects._end; piVar8 = piVar8 + 4) { - if ((*GHIDRA_CAST(*piVar8) == 0) && ((GHIDRA_CAST(*piVar8))[1] == 0x47)) { - iVar11 = piVar8[1]; - goto LAB_00792a66; - } - } - iVar11 = 0; -LAB_00792a66: - pvVar5 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x246); - if (pvVar5 == (void *)0x0) goto LAB_007927a6; - iVar9 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 4)); - } - else { - iVar11 = 0; -LAB_007927a6: - iVar9 = 0; - } - iVar11 = (10 - iVar9) - iVar11; - iVar9 = 0; - if (0 < iVar11) { - iVar9 = iVar11; - } - iVar9 = (iVar9 + 1) * iVar9; - } - iVar11 = *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._charge) + uVar4)); - if (iVar11 < GHIDRA_INT(local_48)) { - iVar11 = GHIDRA_INT(local_48) - iVar11; - iVar7 = iVar9; - if (iVar11 < iVar9) { - iVar7 = iVar11; - } - iVar11 = *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._charge) + uVar4)) + iVar7; - iVar9 = iVar9 - iVar7; - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._charge) + uVar4)) = iVar11; - if (GHIDRA_INT(local_48) <= iVar11) { - HUD::FlashChargeBar(&g_game->_hud,this,local_4c); - local_60 = 0xab; - seed_fart_sound_override(&local_60); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_6c.y) + 0x2a324)))))->SoundEffects::Play(local_60,1.0,2,0,1.0, - 0.0); - } - } - bVar2 = HasCollectible(this,0x3f,0); - if (((bVar2 != 0) && - (iVar11 = *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._batteryCharge) + uVar4)), - iVar11 < GHIDRA_INT(local_48))) && (0 < iVar9)) { - if (GHIDRA_INT(local_48) - iVar11 < iVar9) { - iVar9 = GHIDRA_INT(local_48) - iVar11; - } - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._batteryCharge) + uVar4)) = iVar9 + iVar11; - pIVar6 = local_48; - if (iVar9 + iVar11 < GHIDRA_INT(local_48)) goto LAB_0079293f; - HUD::FlashChargeBar(&g_game->_hud,this,local_4c); - pMVar1 = g_manager; - local_60 = 0xaa; - seed_fart_sound_override(&local_60); - (GHIDRA_CAST((&pMVar1->_sfxManager)))->SoundEffects::Play(local_60,1.0,2,0,1.0,0.0); - seed = Random(); - uVar16 = 0; - pTVar15 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar14 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar13 = 0; - breathEffect = Game::Spawn(g_game,1000,0x31,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1, - seed); - iVar9 = __RTDynamicCast(breathEffect,uVar13,pTVar14,pTVar15,uVar16); - *GHIDRA_CAST((iVar9 + 0xdc)) = 0; - *GHIDRA_CAST((iVar9 + 0xe0)) = 0xc1c00000; - *GHIDRA_CAST((iVar9 + 0x358)) = 0x3f800000; - } - pIVar6 = local_48; - } -LAB_0079293f: - bVar2 = HasCollectible(this,0x74,0); - if (((bVar2 != 0) && (GHIDRA_CAST(local_78.y) == GHIDRA_CAST(0x1))) && - ((*GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._charge) + uVar4)) == 0 && - (local_54 == GHIDRA_CAST(0x0))))) { - iVar9 = *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._subCharge) + uVar4)); - if (iVar9 == 0) { - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12c0)) + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12c4)); - iVar11 = 0; - if (0 < iVar7) { - iVar11 = iVar7; - } - if (iVar11 < 1) goto LAB_007929af; - } - iVar9 = iVar9 + 1; - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._subCharge) + uVar4)) = iVar9; - if (iVar9 < 0x1c2) goto LAB_007929ba; - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._charge) + uVar4)) = 1; - } -LAB_007929af: - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._subCharge) + uVar4)) = 0; - } -LAB_007929ba: - bVar2 = HasCollectible(this,0x287,0); - if (((bVar2 == 0) || (local_54 != GHIDRA_CAST(0x0))) || - ((GHIDRA_INT(pIVar6) <= *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._charge) + uVar4)) && - ((bVar2 = HasCollectible(this,0x3f,0), bVar2 == 0 || - (GHIDRA_INT(pIVar6) <= *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._batteryCharge) + uVar4)))))))) { - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._partialCharge) + uVar4)) = 0; - } - else { - in_XMM0_Da = *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._partialCharge) + uVar4)); - if (1.0 <= in_XMM0_Da) { - in_XMM0_Da = in_XMM0_Da - 1.0; - *GHIDRA_CAST((GHIDRA_INT(&this->_activeDesc[0]._partialCharge) + uVar4)) = in_XMM0_Da; - AddActiveCharge(this,1,local_4c,0,0,0); - } - } - } - local_4c = local_4c + 1; - uVar4 = uVar4 + 0x20; - } while (uVar4 < 0x80); - slot = savedSlot; - } - bVar2 = AreControlsEnabled(this); - if ((bVar2 == 0) || ((isItemTriggered == '\0' && ((char)local_50 == '\0')))) goto LAB_00793653; - local_6c.y = (float)this->_itemState; - this->_lastActionTriggers = this->_lastActionTriggers | 0x10; - iVar9 = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset)); - isItemTriggered = '\x01'; - if (iVar9 != 0x93) { - if (iVar9 == 0x2d2) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_88),1000,0xc1,0,0 - ,0); - iVar9 = 0; - fVar12 = 1e+09; - uVar4 = 0; - if (local_7c != GHIDRA_CAST(0x0)) { - do { - iVar11 = local_84[uVar4]; - if (*GHIDRA_CAST((iVar11 + 0x3c8)) == this) { - distSq = (this->_pos).y - *GHIDRA_CAST((iVar11 + 0x340)); - in_XMM0_Da = (this->_pos).x - *GHIDRA_CAST((iVar11 + 0x33c)); - in_XMM0_Da = in_XMM0_Da * in_XMM0_Da; - distSq = distSq * distSq + in_XMM0_Da; - if (distSq < fVar12) { - iVar9 = iVar11; - fVar12 = distSq; - } - } - uVar4 = uVar4 + 1; - } while (uVar4 < local_7c); - slot = savedSlot; - if (iVar9 != 0) { - *GHIDRA_CAST((iVar9 + 0x173)) = 1; - isItemTriggered = '\0'; - } - } - } - else { - if (iVar9 != 0x2d9) goto LAB_00792c68; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_88),3,0xf3,0,0,0) - ; - uVar4 = 0; - if (local_7c != GHIDRA_CAST(0x0)) { - do { - iVar9 = local_84[uVar4]; - if ((iVar9 == 0) || (*GHIDRA_CAST((iVar9 + 0x28)) != 3)) { - iVar9 = 0; - } - if (*GHIDRA_CAST((iVar9 + 0x410)) == this) { - if (*GHIDRA_CAST((iVar9 + 0xd88)) == 0) { - *GHIDRA_CAST((iVar9 + 0xd88)) = 1; - } - isItemTriggered = '\0'; - } - uVar4 = uVar4 + 1; - } while (uVar4 < local_7c); - } - } - (GHIDRA_CAST((local_88)))->EntityList_Query::~EntityList_Query(); - if (isItemTriggered != '\0') goto LAB_00792c68; - goto LAB_007935ed; - } - bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x93); - if (bVar2 != 0) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x93,-1); - AnimateCollectible(this,0x93,GHIDRA_CAST("HideItem"),GHIDRA_CAST("PlayerPickupSparkle")); - goto LAB_007935ed; - } -LAB_00792c68: - iVar9 = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset)); - if (iVar9 == 0) goto LAB_007935ed; - local_78.y = (float)ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar9); - local_60 = GetActiveMaxCharge(this,slot); - iVar9 = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset)); - if (iVar9 == 0x28f) { - if ((char)local_50 == '\0') goto LAB_00792df3; - if (this->_activeDesc[slot]._charge < 0x10) goto LAB_00792da8; - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0xc9) { - local_88 = (uint8_t [4])0x0; - } - else { - local_88 = *(uint8_t (*) [4])(GHIDRA_INT(pvVar5) + 200); - } - local_84 = GHIDRA_CAST(0x0); - local_7c = GHIDRA_CAST(0x0); - local_80 = GHIDRA_CAST(0xffffffff); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(local_88,0,1); - uVar4 = 0; - pvVar5 = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1264)) != 0) { - do { - iVar9 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x125c)) + uVar4 * 4)); - if ((*GHIDRA_CAST((iVar9 + 0x28)) == 3) && (*GHIDRA_CAST((iVar9 + 0x410)) == this)) { - *GHIDRA_CAST((iVar9 + 0x16c)) = *GHIDRA_CAST((iVar9 + 0x16c)) | 0x200; - *GHIDRA_CAST((iVar9 + 0x168)) = *GHIDRA_CAST((iVar9 + 0x168)); - if (-1 < *GHIDRA_CAST((iVar9 + 0xd70))) { - *GHIDRA_CAST((iVar9 + 0x370)) = *GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 0x330)) + 0x38)) + 5.0; - } - } - uVar4 = uVar4 + 1; - } while (uVar4 < *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1264))); - } - EvaluateItems(this); - goto LAB_007935ed; - } - if ((char)local_50 != '\0') { -LAB_00792da8: - if (this->_activeDesc[slot]._charge != local_60) goto LAB_00792df3; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x4000); - if (bVar2 != 0) goto LAB_007935ed; - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_70) + 2)),iVar9,5,slot,0); - AddActiveCharge(this,-1,0,0,0,0); - goto LAB_00793273; - } -LAB_00792df3: - cVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->KAGE_Filesys_FileManager::OpenRead(iVar9,slot); - iVar9 = *GHIDRA_CAST((GHIDRA_INT(&(this->_sprite)._filename) + GHIDRA_INT((slot + 0xac)) * 0x20 + -0x48)); - if (cVar3 == '\0') { - local_70 = CONCAT13(1,(undefined3)local_70); - if (iVar9 == 0x1ab) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_88),0x124,-1,1,0, - 0); - local_8 = 2; - if (local_7c != GHIDRA_CAST(0x0)) { - local_54 = GHIDRA_CAST(0x0); - if (local_7c != GHIDRA_CAST(0x0)) { - piVar8 = local_84; - do { - iVar9 = piVar8[GHIDRA_INT(local_54)]; - in_XMM0_Da = *GHIDRA_CAST((iVar9 + 0x380)); - if (1.0 < in_XMM0_Da) { - if (1 < g_game->_frameCount - *GHIDRA_CAST((iVar9 + 0x328))) { - piVar8 = GHIDRA_CAST(__RTDynamicCast(iVar9,0,&IsaacRepentancePlus::Entity:: - RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC:: - RTTI_Type_Descriptor,0)); - takeDamageFn = *(code **)(*piVar8 + 0x20); - (GHIDRA_CAST((&local_c8)))->EntityRef::constructor(GHIDRA_CAST(this)); - (*takeDamageFn)(0x42c80000,4,0,&local_c8,0x1e); - local_70 = local_70 & 0xffffff; - } - piVar8 = local_84; - } - local_54 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_54)) + 0x1)))); - } while (local_54 < local_7c); - slot = savedSlot; - } - } - local_8 = 0xffffffff; - (GHIDRA_CAST((local_88)))->EntityList_Query::~EntityList_Query(); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_70)) + 0x3))) == '\0') goto LAB_007935ed; - } - bVar2 = HasCollectible(this,0xcd,0); - if ((((bVar2 != 0) && (this->_itemState == 0)) && - (pIVar6 = ItemConfig::GetCollectible - (&g_manager->_itemConfig, - *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset))), - pIVar6 != GHIDRA_CAST(0x0))) && (iVar9 = FUN_007308d0(), iVar9 != 2)) { - local_54 = GHIDRA_CAST(FUN_007308d0()); - if (local_54 == GHIDRA_CAST(0x1)) { - local_50 = local_54; - iVar9 = GetHealthType(this); - local_4c = 2 - GHIDRA_UINT((iVar9 != 3)); - } - else { - local_50 = GHIDRA_CAST(GetActiveMaxCharge(this,slot)); - iVar9 = GetTotalActiveCharge(this,slot); - local_50 = GHIDRA_CAST((GHIDRA_INT(local_50) - iVar9)); - iVar9 = GetHealthType(this); - local_4c = 2 - GHIDRA_UINT((iVar9 != 3)); - if (extraout_EDX < 1) goto LAB_007935ed; - } - iVar9 = local_4c; - if (local_4c < this->_soulHearts + this->_redHearts + this->_boneHearts) { - IsLocalPlayer(this); - SoundEffects::PlayWithFartOverride(0x38a,in_XMM0_Da,2,0,1.0); - iVar11 = 0; - if (local_50 != GHIDRA_CAST(0x0)) { - local_48 = GHIDRA_CAST(0x0); - do { - local_60 = this->_soulHearts; - local_70 = this->_redHearts; - if (GHIDRA_INT((local_60 + local_70 + this->_boneHearts)) <= iVar9) break; - this->_damageCooldown = 0; - local_78.y = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x20)); - (GHIDRA_CAST((&local_c8)))->EntityRef::constructor(GHIDRA_CAST(this)); - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - uVar13 = 0x3f800000; - } - else { - uVar13 = 0x41000000; - } - cVar3 = (*(code *)local_78.y)(uVar13,0x2042821,0,&local_c8,0x1e); - if (cVar3 == '\0') break; - if (local_54 == GHIDRA_CAST(0x1)) { - FullCharge(this,savedSlot,0,0); - break; - } - if ((this->_playerType == 0x16) && - ((this->_soulHearts < local_60 || - ((this->_redHearts < GHIDRA_INT(local_70) && - (bVar2 = HasCollectible(this,0x26b,0), - GHIDRA_INT((GHIDRA_UINT((bVar2 != 0)) * 2 + 4)) <= this->_redHearts)))))) { - if (local_48 != GHIDRA_CAST(0x0)) { - local_48 = GHIDRA_CAST(0x0); - goto LAB_00793587; - } - local_48 = GHIDRA_CAST(0x1); - iVar11 = iVar11 + -1; - } - else { -LAB_00793587: - AddActiveCharge(this,1,savedSlot,0,0,0); - iVar7 = GetHealthType(this); - if (iVar7 == 3) { - iVar11 = iVar11 + 1; - iVar9 = GetActiveMaxCharge(this_00,savedSlot); - iVar7 = GetTotalActiveCharge(this,savedSlot); - if (iVar7 < iVar9) { - AddActiveCharge(this,1,savedSlot,0,0,0); - } - iVar9 = local_4c; - } - } - iVar11 = iVar11 + 1; - } while (iVar11 < GHIDRA_INT(local_50)); - } - } - } - goto LAB_007935ed; - } - pvVar5 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(iVar9); - if (((local_60 == 0) && (pvVar5 != (void *)0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(local_78.y) + 0x78)) != 0)) - goto LAB_007935ed; - if (0x123 < iVar9) { - switch(iVar9) { - case 0x124: - iVar11 = 3; - iVar9 = 0xf; - break; - default: - goto switchD_00792e5b_caseD_24; - case 0x182: - iVar11 = 3; - iVar9 = 0x25; - break; - case 0x196: - iVar11 = 3; - iVar9 = 0x24; - break; - case 0x1a6: - if (2 < this->_activeDesc[slot]._varData) goto switchD_00792e5b_caseD_42; - goto switchD_00792e5b_caseD_24; - } - goto LAB_00792f6c; - } - if (iVar9 == 0x123) { - iVar11 = 0; - iVar9 = 0x13; - goto LAB_00792f6c; - } - switch(iVar9) { - case 0x21: - iVar11 = 3; - iVar9 = 10; - break; - case 0x22: - case 0x3b: - bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x22); - if (bVar2 == 0) { - iVar11 = 3; - iVar9 = 0x22; - break; - } - goto switchD_00792e5b_caseD_24; - case 0x23: - bVar2 = HasPlayerForm(this,0xf); - if ((bVar2 == 0) || (this->_activeDesc[slot]._varData == 0)) { - iVar11 = 3; - iVar9 = 1; - break; - } - default: - goto switchD_00792e5b_caseD_24; - case 0x27: - iVar11 = 3; - iVar9 = 7; - break; - case 0x29: - iVar11 = 3; - iVar9 = 8; - break; - case 0x41: - iVar11 = 3; - iVar9 = 9; - break; - case 0x42: -switchD_00792e5b_caseD_42: - iVar11 = 3; - iVar9 = 0xe; - break; - case 0x4e: - iVar11 = 3; - iVar9 = 0xb; - break; - case 0x7b: - iVar11 = 3; - iVar9 = 2; - break; - case 0x7c: - if (this->_itemState == 0) { - iVar11 = 3; - iVar9 = 4; - break; - } - goto switchD_00792e5b_caseD_24; - case 0xab: - iVar11 = 3; - iVar9 = 0x20; - break; - case 0x11b: - iVar11 = 3; - iVar9 = 0x1c; - break; - case 0x11c: - iVar11 = 3; - iVar9 = 0x11; - } -LAB_00792f6c: - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(iVar9,iVar11,GHIDRA_CAST(0x0)); -switchD_00792e5b_caseD_24: - if ((GHIDRA_CAST(slot) != GHIDRA_CAST(0x0)) || (local_44 = 1, this->_activeDesc[1]._item == 0)) { - local_44 = 0; - } - local_50 = GHIDRA_CAST(this->_activeDesc[slot]._varData); - if ((g_game->_challenge == 0x20) && (GHIDRA_CAST(slot) == GHIDRA_CAST(0x0))) { - msvc::vector::copy_constructor(&g_manager->_itemConfig); - piVar8 = local_84; - local_8 = 1; - candidateItems = GHIDRA_CAST(slot); - candidateItemsEnd = GHIDRA_CAST(slot); - candidateItemsCapacity = GHIDRA_CAST(slot); - FUN_0042c820(GHIDRA_INT(local_80) - GHIDRA_INT(local_84) >> 2); - piVar10 = candidateItemsEnd; - if (piVar8 != local_80) { - do { - itemEntry = GHIDRA_CAST(*piVar8); - if (itemEntry != GHIDRA_CAST(0x0)) { - if (*itemEntry == 3) { - pIVar6 = GHIDRA_CAST(itemEntry[1]); - if (pIVar6 != GHIDRA_CAST(0x1db)) { - if (pIVar6 != GHIDRA_CAST(0x274)) { - local_78.y = (float)pIVar6; - if (piVar10 == candidateItemsCapacity) { - msvc::vector::_Emplace_reallocate(piVar10,&local_78.y); - piVar10 = candidateItemsEnd; - } - else { - *piVar10 = GHIDRA_INT(pIVar6); - candidateItemsEnd = piVar10 + 1; - piVar10 = candidateItemsEnd; - } - } - } - } - } - piVar8 = piVar8 + 1; - } while (piVar8 != local_80); - } - piVar8 = candidateItems; - iVar9 = Isaac::Random(GHIDRA_INT(piVar10) - GHIDRA_INT(candidateItems) >> 2); - local_54 = GHIDRA_CAST(piVar8[iVar9]); - if ((GHIDRA_CAST(this->_itemState) != GHIDRA_CAST(0x0)) && (local_54 != GHIDRA_CAST(this->_itemState)) - ) { - ResetItemState(this); - } - this->_wildCardItem = GHIDRA_INT(local_54); - this->_wildCardItemType = 2; - this->_wildCardVarData = 0; - UseActiveItem(this,&local_56,GHIDRA_INT(local_54),((*GHIDRA_CAST((GHIDRA_CAST(&(local_56)) + 0x1))) != '\0') + 2,-1,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x0))) = (char)*extraout_EAX; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x1))) = (uint8_t)((uint16_t)*extraout_EAX >> 8); - pIVar6 = ItemConfig::GetCollectible(&g_manager->_itemConfig,GHIDRA_INT(local_54)); - AddCostume(this,pIVar6,1); - if ((this->_itemState != 0) && ((bool)local_44 == (this->_activeDesc[1]._item != 0))) { - DischargeActiveItem(this,0,0); - } - local_8 = local_8 & 0xffffff00; - if (piVar8 != GHIDRA_CAST(0x0)) { - uVar4 = (GHIDRA_INT(candidateItemsCapacity) - GHIDRA_INT(piVar8) >> 2) * 4; - piVar10 = piVar8; - if (0xfff < uVar4) { - piVar10 = GHIDRA_CAST(piVar8[-1]); - uVar4 = uVar4 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(piVar8) + (-4 - GHIDRA_INT(piVar10))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(piVar10,uVar4); - } - local_8 = 0xffffffff; - FID_conflict__Tidy(&local_84); - iVar9 = slotOffset; - } - else { - if ((this->_itemState != 0) && - (*GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset)) != this->_itemState)) { - ResetItemState(this); - } - iVar9 = slotOffset; - this->_wildCardItemType = 2; - this->_wildCardItem = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset)); - this->_wildCardVarData = this->_activeDesc[slot]._varData; - UseActiveItem(this,&local_56,*GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset)), - ((*GHIDRA_CAST((GHIDRA_CAST(&(local_56)) + 0x1))) != '\0') + 4,slot,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x0))) = (char)*extraout_EAX_00; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x1))) = (uint8_t)((uint16_t)*extraout_EAX_00 >> 8); - } - bVar2 = HasCollectible(this,0x164,0); - if ((((((bVar2 != 0) && (this->_itemState == 0)) && (GHIDRA_CAST(local_6c.y) == GHIDRA_CAST(0x0))) && - (((*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x1))) == 0 && - (iVar11 = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + iVar9)), iVar11 != 0)))) && - (0 < local_60)) && ((iVar11 != 0x20b && (iVar11 != 0x20f)))) { - UseActiveItem(this,&local_56,iVar11,0x621,-1,GHIDRA_INT(local_50)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_70)) + 0x3))) == '\0') { -LAB_0079324d: - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x0))) != '\0') { - DischargeActiveItem(this,slot,(*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x1)))); - } - } - else if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x0))) != '\0') { - iVar11 = GetTrinketMultiplier(this,0x95); - if (iVar11 == 2) { - uVar4 = 10; - } - else { - if (iVar11 < 3) goto LAB_0079324d; - uVar4 = 5; - } - uVar4 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0x950)))))->RNG::RandomInt(uVar4); - if (uVar4 != 0) goto LAB_0079324d; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_78.x)) + 0x1))) != 0) { - RemoveCollectible(this,*GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + iVar9)),0,slot,1); - } -LAB_00793273: - bVar2 = HasTrinket(this,4,0); - if ((bVar2 != 0) && (GHIDRA_CAST(slot) == GHIDRA_CAST(0x0))) { - this->_isBrokenRemotePending = 1; - } -LAB_007935ed: - fVar12 = local_6c.y; - pMVar1 = GHIDRA_CAST(this->_itemState); - if (((GHIDRA_CAST(local_6c.y) == pMVar1) && (this->_itemStateCooldown < 1)) && - (pMVar1 != GHIDRA_CAST(0x0))) { - if (pMVar1 == GHIDRA_CAST(0x31)) { - iVar9 = 0x31; - } - else { - iVar9 = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + slotOffset)); - } - TryRemoveCollectibleCostume(this,iVar9,0); - ResetItemState(this); - if (((GHIDRA_CAST(fVar12) != GHIDRA_CAST(0x0)) && (GHIDRA_CAST(fVar12) != GHIDRA_CAST(0x82))) && - ((GHIDRA_CAST(fVar12) != GHIDRA_CAST(0xb5) && (GHIDRA_CAST(fVar12) != GHIDRA_CAST(0x152))))) { - AnimateCollectible(this,GHIDRA_INT(fVar12),GHIDRA_CAST("HideItem"),GHIDRA_CAST("PlayerPickupSparkle")); - } - } -LAB_00793653: - fVar12 = local_90.y; - if (local_43 != '\0') { - if (local_90.y == 9.1785e-43) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x32,1); - iVar9 = savedSlot; - if ((this->_activeDesc[savedSlot]._charge == 0) && - (bVar2 = HasTrinket(this,0x8a,0), bVar2 != 0)) { - DischargeActiveItem(this,iVar9,0); - } - } - else if ((local_90.y != 4.56823e-43) && - (pIVar6 = ItemConfig::GetCollectible(&g_manager->_itemConfig,GHIDRA_INT(local_90.y)), - pIVar6 != GHIDRA_CAST(0x0))) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(GHIDRA_INT(fVar12),-1); - piVar8 = &this->_cacheFlags; - *piVar8 = *piVar8 | pIVar6->cacheFlags; - if (*piVar8 != 0) { - EvaluateItems(this); - } - } - } - if (((savedSlot == 0) && (iVar9 = GetTotalActiveCharge(this,0), totalChargeBefore != iVar9)) && - ((bVar2 = HasTrinket(this,0x65,0), bVar2 != 0 || (bVar2 = HasTrinket(this,100,0), bVar2 != 0))) - ) { - this->_cacheFlags = this->_cacheFlags | 0x41f; - EvaluateItems(this); - } - ExceptionList = local_10; - return; -} - -// 00793940 -uint8_t Entity_Player::HasTimedItem() -{ - ItemConfig_Item *activeItemConfig; - - activeItemConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,this->_activeDesc[0]._item); - if ((activeItemConfig == GHIDRA_CAST(0x0)) || (activeItemConfig->chargeType != 1)) { - return 0; - } - return 1; -} - -// 00794e50 -void Entity_Player::update_effects() -{ - code *pcVar1; - ColorMod color; - ColorMod color_00; - Vector direction; - Vector direction_00; - BitSet128 tearFlags; - BitSet128 flags; - BitSet128 flags_00; - RNG rng; - Vector sizeMulti; - Vector pos; - Vector position; - Vector position_00; - uint8_t bVar2; - char cVar3; - undefined3 extraout_var; - int iVar4; - EntityList_EL *queryList; - Vector *tmpVec; - uint32_t uVar5; - Entity *queryList; - PersistentGameData *persistentData; - void *pvVar7; - Room *room; - BitSet128 *tmpFlags; - Room *currentRoom; - Entity_Tear *pEVar8; - uint32_t *puVar9; - uint8_t *puVar10; - ItemConfig *itemConfig; - ColorMod *color_01; - Entity_Effect *effect; - Entity_Bomb *bomb; - TemporaryEffects *tempEffects; - RNG *rngPtr; - float fVar11; - MusicManager *musicManager; - Music *music; - Level *level; - ColorMod *tmpColor; - ItemConfig_Item *configItem; - PlayerManager *playerManager; - GridEntity *pGVar12; - EntityList *entityList; - TearParams *pTVar13; - SoundEffects *sfx; - EntityRef *sourceRef; - RNG *music; - Vector *pVVar14; - float *pfVar15; - RNG *playerManager; - Sprite *sprite; - ColorMod *color_02; - LayerState *layer; - ANM2 *anm; - ColorMod *color_03; - ItemPool *itemPool; - HUD *hud; - Entity_Familiar *pEVar16; - Entity_Laser *laser; - std_string *animName; - Entity_Pickup *pickup; - float fVar17; - Entity_NPC *pEVar18; - Vector *offset; - Vector *offset_00; - uint8_t *puVar19; - Color *entityColor; - ColorMod *from; - uint8_t *layerCount; - EntityConfig *entityConfig; - EntityConfig_Entity *entityConfigEntry; - int iVar20; - int blue; - Entity_Player *pEVar21; - uint32_t uVar22; - Entity_Player *pEVar23; - Entity_Player *pEVar24; - ActiveItemDesc *pAVar25; - uint8_t *layerIndex; - bool bVar26; - long double fVar27; - void *pvVar28; - uint8_t auVar30 [12]; - uint8_t auVar31 [12]; - double dVar29; - BitSet128 flags_01; - uint8_t extraout_var_00 [12]; - uint8_t auVar32 [16]; - uint8_t auVar33 [16]; - uint8_t auVar34 [16]; - BitSet128 BVar35; - uint8_t extraout_var_01 [12]; - uint8_t extraout_var_02 [12]; - uint8_t extraout_var_03 [12]; - uint8_t extraout_var_04 [12]; - uint8_t extraout_var_05 [12]; - BitSet128 BVar36; - uint8_t auVar37 [16]; - uint64_t projectileFlags; - Color aCStackY_2e04 [128]; - uint32_t in_stack_ffffe824; - uint32_t in_stack_ffffe828; - uint32_t in_stack_ffffe82c; - Vector *in_stack_ffffe830; - Vector *in_stack_ffffe834; - Entity_Player *in_stack_ffffe838; - EntityList_EL *in_stack_ffffe83c; - Entity_Player *in_stack_ffffe840; - uint32_t uVar38; - uint32_t uVar39; - TypeDescriptor *outResult; - char *pcVar40; - Entity_Player *pEVar41; - uint32_t uVar42; - Entity *pEVar43; - EntityRef planCSource; - EntityRef challengeDamageSource; - EntityRef challengeKillSource; - EntityRef auraFearSource; - EntityRef auraBossFearSource; - EntityRef auraCharmSource; - EntityRef auraBossCharmSource; - EntityRef freezeSource; - EntityRef fearSource; - EntityRef charmSource; - EntityRef spotlightSlowSource; - EntityRef spotlightSlowSourcePvp; - EntityRef confusionSource; - EntityRef mirrorDamageSource; - EntityRef breathOfLifeSource; - EntityRef dashDamageSource; - EntityRef fireplaceDamageSource; - Capsule dashCapsule [13]; - Capsule hitCapsule [13]; - EntityRef damageAuraSource; - BitSet128 homingBombFlags; - BitSet128 spawnedBombFlags; - BitSet128 cookbookBombFlags; - BitSet128 notWaitFlags3; - BitSet128 capturedTearFlags2; - BitSet128 rageLaserFlags2; - BitSet128 notWaitFlags4; - BitSet128 megaBlastFlags2; - BitSet128 megaBlastFlags; - BitSet128 notWaitFlags2; - BitSet128 rageLaserFlags; - BitSet128 notWaitFlags; - BitSet128 fartBombFlags; - BitSet128 quadsplitFlagMatch; - BitSet128 explosiveFlagMatch; - BitSet128 explosiveCheckFlags; - BitSet128 orbitFlagsBase; - BitSet128 capturedFlagsBase; - BitSet128 quadsplitCheckFlags; - BitSet128 slowedTearFlags; - BitSet128 currentTearFlags2 [2]; - BitSet128 slowFlagMatch; - BitSet128 currentTearFlags; - BitSet128 bombFlagsCopy [2]; - uint8_t snareBlendMode [20]; - uint8_t trailBlendMode [20]; - EntityRef challengeDeathSource; - Vector marsDashVelocity; - Vector smoke2PosOffset; - Vector smoke2HeightOffset; - Vector smoke2Scale; - Vector smoke2SpawnPos; - Vector smoke2Velocity; - Vector smoke2InheritedVel; - Vector smoke2OffsetVel; - Vector smoke2DirRandomized; - Vector smoke2DirScaled; - Vector smoke2RandomDir; - Vector smoke2Spread; - Vector smoke2Origin; - Vector smokePosOffset; - Vector smokeHeightOffset; - Vector smokeScale; - Vector smokeSpawnPos; - Vector smokeVelocity; - Vector smokeInheritedVel; - Vector smokeOffsetVel; - Vector smokeDirRandomized; - Vector smokeDirScaled; - Vector smokeRandomDir; - Vector smokeSpread; - Vector smokeOrigin; - Vector snareScale2; - Vector snareScale; - Vector snareTargetPos2; - Vector snareTargetPos; - Vector darkArtsAuraOffset; - Vector salvationOffset; - Vector orbitTearPos; - Vector capturedProjPos2; - Vector capturedProjVel; - Vector capturedProjPos; - Vector damageAuraTargetPos; - Vector auraEnemyPos; - Vector negPushDir; - Vector pushDirNorm; - Vector pushedEnemyVel; - Vector toPushedEnemy; - Vector pushedEnemyPos; - Vector bendOffset; - Vector projVelBeforeBend; - Vector rotatedLeft; - Vector rotatedRight; - Vector negProjPerp; - Vector projPerp; - Vector projDir; - Vector projVel; - Vector toProjectileNorm; - Vector deflectedProjVel2; - Vector deflectedProjVel; - Vector deflectedProjPos; - Vector crownOffset; - Vector trailCheckPos; - Vector trailSumPos; - Vector farthestTrailPos; - Vector trailPos; - Vector trailPointPos; - Vector lastTrailPos; - Vector haloOffset; - Vector slowedTearVel; - Vector spotlitTearVel; - Vector spotlitTearPos; - Vector slowedProjectileVel; - Vector spotlitProjectileVel; - Vector spotlitProjectilePos; - Vector spotlitEnemyPos; - Vector bobCreepScale; - Vector knifeOffset; - Vector aquariusCreepScale; - Vector tarCreepScale; - Vector heartOffset; - Vector anemicCreepScale; - Vector freeSpawnPos; - Vector targetEnemyPos; - Vector enemyPos; - Vector randomRoomPos; - Vector stompEffectPos; - Vector stompRandomDir; - Vector capturedTearVel; - Vector wispSpawnPos2; - Vector capturedShotVel; - Vector wispSpawnPos; - Vector otherPlayerPos; - Vector cloudScale; - Vector stompyDustPos; - Vector stompyDustOffset; - Vector stompyRandomDir; - Vector stompyPos; - Vector stompyDustVel; - Vector montezumaDir; - Vector rageRecoilVel; - Vector rageRecoilDir; - Vector rageLaserOffset2; - Vector megaBlastRecoilVel; - Vector megaBlastRecoilDir; - Vector megaBlastLaserOffset; - Vector megaBlastOffset; - Vector cordDelta; - Vector cordLaserOffset; - Vector prevCordPos; - Vector pushVelocity; - Vector heartPushVel; - Vector heartPushPos; - Vector heartPushPosY; - Vector heartPushPosX; - Vector heartProjPos; - Vector heartProjPosY; - Vector heartProjPosX; - Vector coinPullVel; - Vector coinPos; - Vector rageLaserOffset; - Vector poofScale [2]; - Vector bounceVelocity; - Vector reflectedVelocity; - Vector reflectNormal; - Vector gridHitDir; - Vector trailPosOffset; - Vector trailHeightOffset; - Vector trailVel; - Vector twinPullVel; - Vector toTwin; - Vector knockbackVelScaled; - Vector knockbackVel; - Vector bossKnockbackScaled; - Vector bossKnockbackVel; - Vector toHitEntity; - Vector hitEntityPos; - Vector hitCapsulePos; - Vector selfPos; - Vector hitPos3; - Vector hitPos2; - Vector hitPos; - Vector dashCapsuleSize; - Vector beamSizeMulti; - Vector beamPos; - Vector beamOffset; - Vector ponySideDir; - uint8_t darkArtsCapsule [32]; - float darkArtsCapsuleSize; - uint8_t dashTempEffect [8]; - int dashTempEffectCooldown; - uint8_t vesselShieldEffect [8]; - uint32_t vesselShieldCooldown; - uint8_t taurusEffect [8]; - uint32_t taurusEffectCooldown; - uint8_t polaroidEffect [8]; - int polaroidEffectCooldown; - uint8_t momFootQuery [16]; - BitSet128 capturedTearFlags; - BitSet128 orbitTearFlags; - Vector riftSpawnPos; - Vector twinPos; - EntityPtr capsuleHitInfo [2]; - Vector clampedBeamPos; - Vector darkEsauRespawnPos; - Vector darkEsauSpawnPos; - Vector farthestPos; - Vector trollBombPos; - Vector stompPos; - uint8_t deflectQuery [16]; - uint8_t freezeQuery [16]; - uint8_t damageAuraQuery [16]; - uint8_t riftQuery [16]; - uint8_t familiarQuery [16]; - uint8_t coinQuery [16]; - uint8_t local_cd4 [16]; - uint8_t dashHits [16]; - uint8_t darkArtsHits [16]; - uint8_t chainLightningQuery [16]; - uint8_t auraQuery [16]; - uint8_t local_c84 [24]; - Vector knockbackDir; - Vector smoke2Offset; - Vector smokeOffset; - Vector snarePos; - Vector damageAuraCenter; - Vector newVelocity; - uint8_t local_c3c [20]; - float jupiterCooldownMin; - float jupiterCooldownNext; - float voltCooldownLeft; - float voltCooldownMin; - float partialChargeMin; - float poofScaleFactor; - float ibsChargeMax; - float pushStrength; - Entity_Player *cordPlayer; - Entity *cordFamiliar; - float minLaserTimeout; - float laserTimeout; - float megaBlastRecoil; - float rageRecoil; - float stompyDustVelFactor; - float stompyDustSpread; - float cloudScaleFactor; - float smokeSpeedWanted; - float pushBoost; - float minTearHeight2; - float capturedTearHeight; - uint32_t minTearHeight; - float orbitTearHeight; - uint32_t maxCollisionPoints; - float snareScaleFactor; - void *snareScaleFactor2; - void *smokeCountCap; - void *smokeRandomScale; - float smokeOffsetLength; - float smokeVelFactor; - float ibsChargeNext; - float smokeInheritFactor; - float smokeScaleWanted; - float smokeSpeedMax; - float smoke2RandomScale; - float smoke2OffsetLength; - float smoke2VelFactor; - uint8_t local_b94 [20]; - float doubledSizeScale; - float maxSizeScale; - float smokeScaleMax; - float smoke2InheritFactor; - float smoke2ScaleWanted; - float smoke2ScaleMax; - float smoke2SpeedWanted; - float smoke2SpeedMax; - float marsDashSpeed; - float beamSideOffset; - float aquariusScaleFactor; - float bossKnockbackFactor; - float hitFriction; - float trailVelFactor; - float reflectDot; - float suplexCountdownCap; - float bounceStrength; - float local_b3c; - float minMarsCooldown; - Vector dashDir; - float local_b2c [2]; - float bendFactor; - float local_b20 [2]; - int stewDurationLeft; - float invTrailCount; - float tearSlowFactor; - float projectileSlowFactor; - float bobScaleFactor; - float tarScaleFactor; - float anemicScaleFactor; - uint8_t local_afa [2]; - uint8_t targetIndices [12]; - Vector pushDir; - Vector rageDir; - uint8_t local_adc [24]; - Vector megaBlastDir; - float local_abc; - float knockbackStrength; - Vector spawnPos; - int collisionPointCount; - Vector snareOffset; - Vector cordEnd; - uint8_t local_a98 [24]; - Vector averagePos; - Vector rageLaserDir; - float pushRadius; - float shadowScale; - float chargeLeft; - float projectileSpeed; - Vector toProjectile; - WeightedOutcomePicker poolPicker [4]; - uint8_t cordEntities [12]; - float dashSpeed; - Entity *local_a3c; - void *local_a38; - Entity_Tear *local_a34; - Entity_Player *local_a30; - uint8_t local_a29; - Entity_Tear *local_a28; - Entity_Player *savedPlayer; - float local_a20; - Entity_Familiar *local_a1c; - Entity_Tear *local_a14; - uint8_t local_a0d; - Entity_Tear *local_a0c; - Entity_Player *local_a08; - Entity_NPC *local_a04; - Entity_Player *local_a00; - Entity_Player *local_9fc; - uint8_t haloTearParams [104]; - uint8_t newHaloTearParams [104]; - TearParams TStack_928; - TearParams aTStack_8c0 [2]; - Color poofColor [2]; - Color splatColor [3]; - ColorMod fadedSpriteColor; - ColorMod footprintColor [2]; - Color fartColor [8]; - Color snareBlackColor; - Color fartColor2 [6]; - TearParams TStack_408; - TearParams aquariusTearParams; - TearParams local_338; - Color smokeColor [2]; - Color trailColor; - Color chargeFadeColor [2]; - Color mirrorFadeColor; - char rageHeadAnim [24]; - Color tearColorCopy; - Color flashColor; - RNG projectileRng; - RNG tearRng; - char headDownShoot2 [24]; - char headRightShoot2 [24]; - char headUpShoot2 [24]; - char headLeftShoot2 [24]; - char headDownShoot [24]; - char headRightShoot [24]; - char headUpShoot [24]; - char headLeftShoot [24]; - uint8_t local_78 [68]; - RNG deflectRng; - void *local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint8_t isDontUpdateWisp; - Manager *manager; - int *salvationEffect; - BitSet128 *tmpFlags2; - - puStack_20 = local_78 + 0x74; - local_14 = -NAN; - puStack_18 = &LAB_00aff8a0; - local_1c = ExceptionList; - local_24 = (void *)(__security_cookie ^ GHIDRA_UINT((local_78 + 0x68))); - if (*GHIDRA_CAST(&g_game->_stageTransition) != 0) { - return; - } - ExceptionList = &local_1c; - savedPlayer = this; - puVar10 = local_78 + 0x74; - if (this->_isPlayingExtraAnimation != 0) { - bVar2 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("Trapdoor")); - puVar10 = puStack_20; - if (bVar2 != 0) { - ExceptionList = local_1c; - return; - } - } - puStack_20 = puVar10; - UpdateBookOfVirtues(this,0); - salvationEffect = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)); - if (((salvationEffect != GHIDRA_CAST(0x0)) && (salvationEffect[2] == 0x10)) && - (*salvationEffect == 0x23)) { - salvationEffect = &this->_activeDesc[0]._varData; - local_a34 = GHIDRA_CAST(0x0); - do { - if (((GHIDRA_CAST((salvationEffect + -7)))->_item == 0x1a6) && (*salvationEffect < 3)) { - *salvationEffect = 3; - FullCharge(this,GHIDRA_INT(local_a34),0,0); - } - local_a34 = GHIDRA_CAST((GHIDRA_INT(local_a34) + 1)); - salvationEffect = salvationEffect + 8; - } while (local_a34 < &DAT_00000004); - } - bVar2 = HasTrinket(this,0x78,0); - pvVar28 = (void *)0x3f800000; - shadowScale = 1.0; - if (((bVar2 != 0) && (pcVar40 = g_game->_room, *pcVar40 != '\0')) && - ((g_game->_frameCount - *GHIDRA_CAST((pcVar40 + 0x11f0)) == 1 && - ((*GHIDRA_CAST((pcVar40 + 8)) == 5 && (pcVar40[1] != '\0')))))) { - local_a34 = GHIDRA_CAST((GHIDRA_UINT(local_a34) & 0xffffff00)); - bVar2 = HasGoldenTrinket(this,0x78); - if ((bVar2 != 0) || (bVar2 = HasCollectible(this,0x1b7,0), bVar2 != 0)) { - local_a34 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_a34)) + 0x1))),1)); - } - uVar22 = 0; - do { - bVar2 = FullCharge(this,uVar22,0,(uint8_t)local_a34); - manager = g_manager; - if (CONCAT31(extraout_var,bVar2) != 0) break; - uVar22 = uVar22 + 1; - } while (uVar22 < 4); - local_abc = 2.38221e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_abc)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_abc),1.0,2,0,1.0,0.0); - uVar22 = Random(); - in_stack_ffffe838 = GHIDRA_CAST(0x0); - in_stack_ffffe834 = &g_vectorZero; - in_stack_ffffe830 = &this->_pos; - in_stack_ffffe82c = 0x31; - in_stack_ffffe828 = 1000; - in_stack_ffffe824 = 0x79506a; - in_stack_ffffe840 = - (Entity_Player *) - Game::Spawn(g_game,1000,0x31,in_stack_ffffe830,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar22); - in_stack_ffffe83c = GHIDRA_CAST(0x795070); - iVar4 = __RTDynamicCast(); - *GHIDRA_CAST((iVar4 + 0xdc)) = 0; - *GHIDRA_CAST((iVar4 + 0xe0)) = 0xc1c00000; - *GHIDRA_CAST((iVar4 + 0x358)) = 0x3f800000; - } - tempEffects = &this->_temporaryeffects; - local_a34 = GHIDRA_CAST(tempEffects); - local_a0d = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x3d); - bVar2 = HasCollectible(this,0x226,0); - if ((((((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x226), bVar2 == 0)) || - (local_a0d != 0)) && - ((*GHIDRA_CAST(g_game->_room) != '\0' && - (0x1e < g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)))))) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(10,0), bVar2 != 0)) && - ((uVar22 = Random(), uVar22 % 5 == 0 && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1bb0)) != 6)))) { - in_stack_ffffe840 = GHIDRA_CAST(0x3e8); - in_stack_ffffe83c = GHIDRA_CAST(momFootQuery); - in_stack_ffffe838 = GHIDRA_CAST(0x795164); - queryList = EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),in_stack_ffffe83c,1000,0x1d, - -1,0,0); - uVar22 = queryList->_size; - if (momFootQuery[0] == '\0') { - local_14 = 0.0; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)momFootQuery)) + 0x4))),0); - local_14 = -NAN; - } - if (uVar22 < 2) { - uVar22 = Random(); - local_a3c = GHIDRA_CAST((this->_pos).x); - local_a08 = GHIDRA_CAST((this->_pos).y); - tmpVec = MusicManager::RandomVector(&stompRandomDir); - local_a28 = GHIDRA_CAST((tmpVec->x * 40.0)); - local_a04 = GHIDRA_CAST((tmpVec->y * 40.0)); - uVar5 = Random(); - pvVar28 = (void *)((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) - * 2.3283064e-10); - (GHIDRA_CAST((&stompPos)))->Vector::Vector((float)local_a3c + (float)local_a28 * (float)pvVar28, - (float)local_a04 * (float)pvVar28 + (float)local_a08); - in_stack_ffffe840 = GHIDRA_CAST(&stompPos); - in_stack_ffffe83c = GHIDRA_CAST(&DAT_0000001d); - in_stack_ffffe838 = GHIDRA_CAST(0x3e8); - in_stack_ffffe834 = GHIDRA_CAST(0x795279); - queryList = Game::Spawn(g_game,1000,0x1d,GHIDRA_CAST(in_stack_ffffe840),&g_vectorZero,GHIDRA_CAST(0x0), - 0,uVar22); - tmpVec = (GHIDRA_CAST((queryList)))->Entity::Position(&stompEffectPos); - (GHIDRA_CAST((queryList)))->Entity::SetTargetPosition(*tmpVec); - queryList->SetCollisionDamage(); - queryList->Update(); - } - } - iVar4 = Game::Challenge(g_game); - if (iVar4 == 0x16) { - iVar4 = Game::GetFrameCount(); - if ((0x7080 < iVar4) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(300,0), bVar2 != 0)) { - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((&challengeDamageSource)))->EntityRef::EntityRef(); - in_stack_ffffe840 = GHIDRA_CAST(0x3f800000); - in_stack_ffffe83c = GHIDRA_CAST(0x795311); - (*pcVar1)(); - } - } - else { - iVar4 = Game::Challenge(g_game); - if (((iVar4 == 0x18) && (this->_dead == 0)) && (this->_numCoins < 1)) { - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x24); - (GHIDRA_CAST((&challengeKillSource)))->EntityRef::EntityRef(); - (*pcVar1)(); - (GHIDRA_CAST((&challengeDeathSource)))->EntityRef::EntityRef(); - challengeDeathSource._type = 0x125; - challengeDeathSource._variant = 0; - set_last_damage(this,0,&challengeDeathSource); - } - } - if (this->_playerType == 0xb) { - persistentData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - bVar2 = PersistentGameData::Unlocked(persistentData,0x14b); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0xd6), bVar2 == 0)) - { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0xd6,1,1); - } - } - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - pvVar7 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0x41); - if ((pvVar7 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 8)) % 5 == 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_random_pickup_position(room,&trollBombPos,0,0); - uVar22 = Random(); - in_stack_ffffe834 = &g_vectorZero; - in_stack_ffffe830 = &trollBombPos; - in_stack_ffffe82c = 3; - in_stack_ffffe828 = 4; - in_stack_ffffe824 = 0x79543a; - in_stack_ffffe838 = this; - in_stack_ffffe840 = - (Entity_Player *) - Game::Spawn(g_game,4,3,in_stack_ffffe830,&g_vectorZero,GHIDRA_CAST(this),0,uVar22); - in_stack_ffffe83c = GHIDRA_CAST(0x795440); - local_a28 = GHIDRA_CAST(__RTDynamicCast()); - if (local_a28 != GHIDRA_CAST(0x0)) { - tmpFlags = GetBombFlags(this,&cookbookBombFlags,0); - pvVar28 = *(void **)&tmpFlags->_l; - in_stack_ffffe840 = GHIDRA_CAST(0x795473); - FUN_006a6910(); - } - } - pvVar7 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0xa0); - if ((pvVar7 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 8)) % 5 == 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - currentRoom = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec = (GHIDRA_CAST((currentRoom)))->Room::GetRandomPosition(&randomRoomPos,20.0); - Room::FindFreePickupSpawnPosition(room,&spawnPos,tmpVec,0.0,0,0,0); - iVar4 = Isaac::Random(2); - if (iVar4 == 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pEVar8 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetEntities(); - local_a0c = pEVar8; - FUN_00424510(); - local_14 = 1.4013e-45; - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->EntityList::Size(); - FUN_0042c820(); - pEVar23 = GHIDRA_CAST(0x0); - local_9fc = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->EntityList::Size(); - pEVar8 = local_a0c; - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar2 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Position(&enemyPos); - local_a20 = tmpVec->x; - pvVar28 = (void *)tmpVec->y; - local_a1c = pvVar28; - iVar4 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(*tmpVec); - pEVar23 = local_9fc; - if (iVar4 == 0) { - msvc::vector::operator_index(); - msvc::vector::push_back(); - } - } - pEVar23 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1)))); - local_9fc = pEVar23; - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->EntityList)::Size(); - } while (pEVar23 < puVar10); - this = savedPlayer; - } - iVar4 = (GHIDRA_CAST((targetIndices)))->msvc::vector::size(); - if (iVar4 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((targetIndices)))->msvc::vector::size(); - Isaac::Random(iVar4); - puVar9 = GHIDRA_CAST(FUN_0042c810()); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Position(&targetEnemyPos); - tmpVec = Room::FindFreePickupSpawnPosition(room,&freeSpawnPos,tmpVec,0.0,0,0,0); - (GHIDRA_CAST((&spawnPos)))->Vector::operator_assign(tmpVec); - } - local_14 = -NAN; - FID_conflict__Tidy(targetIndices); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pos.y = spawnPos.y; - pos.x = spawnPos.x; - iVar4 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos); - if (iVar4 == 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - currentRoom = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((currentRoom)))->Room::GetGridIndex(&spawnPos); - (GHIDRA_CAST((room)))->Room::SetGridPath(iVar4,900); - } - uVar22 = Random(); - in_stack_ffffe840 = GHIDRA_CAST(&spawnPos); - in_stack_ffffe83c = GHIDRA_CAST(&DAT_00000013); - in_stack_ffffe838 = GHIDRA_CAST(0x3e8); - in_stack_ffffe834 = GHIDRA_CAST(0x7956f9); - queryList = Game::Spawn(g_game,1000,0x13,GHIDRA_CAST(in_stack_ffffe840),&g_vectorZero,GHIDRA_CAST(this),0 - ,uVar22); - pcVar1 = *(code **)(*GHIDRA_CAST(queryList) + 0x40); - fVar27 = (long double)(GHIDRA_CAST((queryList)))->Entity::CollisionDamage(); - local_a04 = GHIDRA_CAST((float)fVar27); - FUN_0060d040(); - local_a28 = GHIDRA_CAST(((float)pvVar28 + (float)local_a04)); - (*pcVar1)(); - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(savedPlayer)); - pEVar8 = local_a34; - this = savedPlayer; - } - itemConfig = Isaac::GetItemConfig(); - ItemConfig::GetCollectible(itemConfig,0xb4); - iVar4 = FUN_00930a00(); - if ((iVar4 != 0) && (*GHIDRA_CAST((iVar4 + 8)) % 5 == 0)) { - (GHIDRA_CAST((fartColor)))->Color::Color(); - in_stack_ffffe840 = GHIDRA_CAST(&this->_pos); - Game::Fart(g_game,GHIDRA_CAST(in_stack_ffffe840),100.0,GHIDRA_CAST(this),1.0,0,color_01); - Game::ButterBeanFart(g_game,GHIDRA_CAST(in_stack_ffffe840),120.0,GHIDRA_CAST(this),0,1); - uVar22 = Random(); - in_stack_ffffe83c = GHIDRA_CAST(0x8d); - in_stack_ffffe838 = GHIDRA_CAST(0x3e8); - in_stack_ffffe834 = GHIDRA_CAST(0x795805); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0x8d,GHIDRA_CAST(in_stack_ffffe840),&g_vectorZero,GHIDRA_CAST(this),0 - ,uVar22); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x5a); - effect->Update(); - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - } - itemConfig = Isaac::GetItemConfig(); - (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0); - local_a28 = GHIDRA_CAST(FUN_00930a00()); - if ((local_a28 != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_a28)))) + 0x8)))) % 10 == 0) - ) { - iVar4 = this->_playerType; - uVar22 = Random(); - in_stack_ffffe834 = &g_vectorZero; - in_stack_ffffe830 = &this->_pos; - in_stack_ffffe82c = 9; - if (iVar4 != 0x19) { - in_stack_ffffe82c = 0; - } - in_stack_ffffe828 = 4; - in_stack_ffffe824 = 0x7958a0; - in_stack_ffffe838 = this; - in_stack_ffffe840 = - (Entity_Player *) - Game::Spawn(g_game,4,in_stack_ffffe82c,in_stack_ffffe830,&g_vectorZero,GHIDRA_CAST(this),0, - uVar22); - in_stack_ffffe83c = GHIDRA_CAST(0x7958a6); - bomb = GHIDRA_CAST(__RTDynamicCast()); - if (bomb != GHIDRA_CAST(0x0)) { - GetBombFlags(this,&spawnedBombFlags,0); - in_stack_ffffe840 = GHIDRA_CAST(0x7958d1); - FUN_006a6910(); - if (1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a28)) + 0x4))))) { - tmpFlags2 = &g_tearFlagHoming; - tmpFlags = (GHIDRA_CAST((bomb)))->Entity_Bomb::Flags(bombFlagsCopy); - BitSet128::operator_or(&homingBombFlags,tmpFlags,tmpFlags2); - in_stack_ffffe840 = GHIDRA_CAST(0x79590f); - FUN_006a6910(); - FUN_006a6930(); - } - } - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - } - itemConfig = Isaac::GetItemConfig(); - (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x1c); - iVar4 = FUN_00930a00(); - local_a04 = GHIDRA_CAST(0x41200000); - if ((iVar4 != 0) && ((*GHIDRA_CAST((iVar4 + 8)) & 1) == 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_a00 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetGridIndex(&this->_pos); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_a28 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetGridEntity(GHIDRA_UINT(local_a00)); - if ((local_a28 == GHIDRA_CAST(0x0)) || - ((iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_a28))))->GridEntity::GetType(), iVar4 == 1 || - (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_a28))))->GridEntity::GetType(), iVar4 == 10)))) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::is_type_16(); - if (bVar2 == 0) { - local_a0c = GHIDRA_CAST(GetPillRNG(this,0x1e)); - pEVar23 = GHIDRA_CAST(0x0); - local_9fc = GHIDRA_CAST(0x0); - bVar2 = HasCollectible(this,0x21f,0); - if (bVar2 == 0) { - tempEffects = GHIDRA_CAST(GetEffects(this)); - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x21f); - if (bVar2 != 0) goto LAB_00795a1c; - } - else { -LAB_00795a1c: - rngPtr = GetCollectibleRNG(this,0x21f); - uVar22 = (GHIDRA_CAST((rngPtr)))->RNG::RandomInt(100); - if (uVar22 < 0x21) { - pEVar23 = GHIDRA_CAST(&DAT_00000006); - } - local_9fc = pEVar23; - } - bVar2 = HasTrinket(this,0x5b,0); - if (bVar2 != 0) { - local_9fc = GHIDRA_CAST(0x21); - iVar4 = GetTrinketMultiplier(this,0x5b); - if (iVar4 == 2) { - local_9fc = GHIDRA_CAST(0x42); - } - else if (iVar4 == 3) { - local_9fc = GHIDRA_CAST(0x64); - } - rngPtr = GHIDRA_CAST(rng_vector_at()); - fVar11 = (float)(GHIDRA_CAST((rngPtr)))->RNG::RandomInt(100); - if (GHIDRA_UINT(fVar11) < local_9fc) { - pEVar23 = GHIDRA_CAST(&DAT_00000005); - } - local_9fc = pEVar23; - } - bVar2 = HasCollectible(this,0xca,0); - if (bVar2 != 0) { - uVar22 = (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->RNG::RandomInt(100); - if (GHIDRA_INT((uVar22 - GHIDRA_INT((this->_luck * 10.0)))) < 0x1a) { - pEVar23 = GHIDRA_CAST(0x3); - } - local_9fc = pEVar23; - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar22 = (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->RNG::Next(); - (GHIDRA_CAST((room)))->Room::SpawnGridEntity(GHIDRA_INT(local_a00),0xe,GHIDRA_UINT(local_9fc),uVar22,0); - in_stack_ffffe83c = GHIDRA_CAST(0x795b43); - Game::ButterBeanFart(g_game,&this->_pos,120.0,GHIDRA_CAST(this),0,0); - in_stack_ffffe840 = GHIDRA_CAST(0x795b60); - play_sound_with_fart_seed(0x25,1.0,2,0,1.0); - ShootCandle(this,&g_vectorZero); - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - } - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0x4d); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(299); - if ((bVar2 != 0) && - (pvVar28 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(299), - *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) != 0)) { - local_9fc = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(299); - musicManager = GHIDRA_CAST(MusicManager)::MusicManager(); - MusicManager::PitchSlide(musicManager); - goto LAB_00795cf2; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0x5d); - if (bVar2 != 0) { - local_9fc = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0x5d); - musicManager = GHIDRA_CAST(MusicManager)::MusicManager(); - MusicManager::PitchSlide(musicManager); - goto LAB_00795cf2; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0x12a); - if (bVar2 != 0) { - local_9fc = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0x12a); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x18,0); - if ((bVar2 != 0) && (iVar4 = Isaac::Random(2), iVar4 != 0)) { - musicManager = GHIDRA_CAST(MusicManager)::MusicManager(); - random_float(); - MusicManager::PitchSlide(musicManager); - music = GHIDRA_CAST(MusicManager)::MusicManager(); - iVar4 = Isaac::Random(3); - if (iVar4 == 0) { - fVar11 = 0.0; - } - else { - fVar11 = 1.0; - } - (GHIDRA_CAST((music)))->Music::VolumeSlide(fVar11,0.08); - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - } - goto LAB_00795cf2; - } - } - else { - local_9fc = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0x4d); - musicManager = GHIDRA_CAST(MusicManager)::MusicManager(); - MusicManager::PitchSlide(musicManager); -LAB_00795cf2: - if (local_9fc != GHIDRA_CAST(0x0)) { - uVar22 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_9fc)) + 0x8)))); - if (GHIDRA_INT(uVar22) < 0x1f) { - local_9fc = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x3c)); - if ((uVar22 & 1) == 0) { - in_stack_ffffe840 = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - } - else { - in_stack_ffffe840 = GHIDRA_CAST(FUN_00757980()); - } - in_stack_ffffe83c = GHIDRA_CAST(0x795e7b); - (*(code *)local_9fc)(); - } - else { - uVar22 = uVar22 & 0x80000003; - bVar26 = uVar22 == 0; - if (GHIDRA_INT(uVar22) < 0) { - bVar26 = (uVar22 - 1 | 0xfffffffc) == 0xffffffff; - } - if (bVar26) { - (GHIDRA_CAST((&flashColor)))->Color::Color(); - iVar4 = Isaac::Random(6); - if (iVar4 == 0) { - iVar20 = 0; - local_a00 = GHIDRA_CAST(0x32); - iVar4 = 0xff; - blue = 0; - } - else { - iVar4 = Isaac::Random(5); - if (iVar4 == 0) { - local_a00 = GHIDRA_CAST(0x32); - iVar20 = 0xff; - blue = 0; - iVar4 = 0; - } - else { - iVar4 = Isaac::Random(4); - if (iVar4 == 0) { - local_a00 = GHIDRA_CAST(0x32); - iVar4 = 0; -LAB_00795ddd: - blue = 0xff; - iVar20 = 0; - } - else { - iVar4 = Isaac::Random(3); - if (iVar4 == 0) { - iVar4 = 0xff; - local_a00 = GHIDRA_CAST(0x46); - iVar20 = 0xff; - blue = 0; - } - else { - iVar4 = Isaac::Random(2); - local_a00 = GHIDRA_CAST(0x46); - if (iVar4 != 0) { - iVar4 = 0xff; - goto LAB_00795ddd; - } - iVar20 = 0xff; - blue = 0xff; - iVar4 = 0; - } - } - } - } - (GHIDRA_CAST((GHIDRA_CAST(&flashColor))))->KColor::FromRGBA255(iVar4,iVar20,blue,0xff); - FUN_00683010(); - in_stack_ffffe840 = GHIDRA_CAST(&flashColor); - in_stack_ffffe83c = GHIDRA_CAST(0x795e1e); - this->SetColor(); - } - } - } - } - pvVar28 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0xd6); - if ((((pvVar28 != (void *)0x0) || - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000), bVar2 != 0 && - ((this->_entityRef2)._entity == this)))) || - ((this->_playerType == 0x16 && (0 < this->_maggyHealthDrainCooldown)))) && - (iVar4 = Isaac::Random(5), iVar4 == 0)) { - uVar22 = Random(); - in_stack_ffffe834 = &g_vectorZero; - in_stack_ffffe830 = &this->_pos; - in_stack_ffffe82c = 0x2e; - in_stack_ffffe828 = 1000; - in_stack_ffffe824 = 0x795f02; - in_stack_ffffe838 = this; - in_stack_ffffe840 = - (Entity_Player *) - Game::Spawn(g_game,1000,0x2e,in_stack_ffffe830,&g_vectorZero,GHIDRA_CAST(this),0,uVar22); - in_stack_ffffe83c = GHIDRA_CAST(0x795f08); - queryList = GHIDRA_CAST(__RTDynamicCast()); - fVar11 = random_float(); - anemicScaleFactor = fVar11 * 0.5 + 0.2; - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&anemicCreepScale,&anemicScaleFactor); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - queryList->Update(); - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - } - pvVar28 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0x146); - if (pvVar28 == (void *)0x0) { - if (GHIDRA_CAST(this->_breathOfLifeEffect) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(this->_breathOfLifeEffect))))->Entity::SetParent(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(&this->_breathOfLifeEffect))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - else if (this->_activeDesc[0]._item == 0x146) { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) == 1) { - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::RemoveCollectibleEffect(0x146,-1); - ResetDamageCooldown(this); - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((&breathOfLifeSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - in_stack_ffffe840 = GHIDRA_CAST(0x3f800000); - in_stack_ffffe83c = GHIDRA_CAST(0x795fc6); - (*pcVar1)(); - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::AddCollectibleEffect(0x146,1,1); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::RemoveCollectibleEffect(0x146,-1); - } - Config::GetCollectibles(); - iVar4 = FUN_004f8930(); - if (iVar4 != 0) { - level = GHIDRA_CAST(Config)::GetCollectibles(); - bVar2 = Level::HasMirrorDimension(level); - if (bVar2 != 0) { - level = GHIDRA_CAST(Config)::GetCollectibles(); - bVar2 = Level::GetStateFlag(level,0x17); - if (bVar2 != 0) { - local_a28 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetNullEffect(0x74); - if (local_a28 == GHIDRA_CAST(0x0)) { -LAB_007960af: - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::AddNullEffect(0x74,1,1); - if (local_a28 != GHIDRA_CAST(0x0)) goto LAB_007960c6; - iVar4 = 0; - } - else { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_a28)))) + 0x8)))) == 1) { - if (5 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_a28)))) + 0x4))))) { - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((&mirrorDamageSource)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - in_stack_ffffe840 = GHIDRA_CAST(0x3f800000); - in_stack_ffffe83c = GHIDRA_CAST(0x7960a9); - (*pcVar1)(); - pEVar8 = GHIDRA_CAST(&this->_temporaryeffects); - } - goto LAB_007960af; - } -LAB_007960c6: - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a28)) + 0x4)))); - } - local_9fc = GHIDRA_CAST(Math)::clamp(0.0,1.0,1.0 - (float)iVar4 / 6.0); - if ((float)local_9fc < 0.99) { - FUN_00757980(); - (GHIDRA_CAST((&mirrorFadeColor)))->Color::Color(); - local_a28 = GHIDRA_CAST(Math)::lerp(0.6,1.0,(float)local_9fc,0); - Math::lerp(0.5,1.0,(float)local_9fc,0); - (GHIDRA_CAST((aCStackY_2e04 + 0x81)))->Color::Color(); - in_stack_ffffe824 = 0x796199; - tmpColor = GHIDRA_CAST(FUN_004072e0()); - (GHIDRA_CAST((&mirrorFadeColor)))->Color::operator_assign(tmpColor); - in_stack_ffffe840 = GHIDRA_CAST(&mirrorFadeColor); - in_stack_ffffe83c = GHIDRA_CAST(0x7961c3); - this->SetColor(); - } - } - } - } - local_a28 = GHIDRA_CAST(GetActiveItemSlot(this,0x146)); - if (-1 < GHIDRA_INT(local_a28)) { - iVar4 = GetActiveMaxCharge(this,GHIDRA_INT(local_a28)); - local_a28 = GHIDRA_CAST(this->_activeDesc[GHIDRA_INT(local_a28)]._charge); - local_9fc = GHIDRA_CAST(((float)GHIDRA_INT(local_a28) / (float)iVar4)); - if ((float)local_9fc < 0.99) { - FUN_00757980(); - (GHIDRA_CAST((chargeFadeColor)))->Color::Color(); - if ((local_a28 == GHIDRA_CAST(0x0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0x146), - bVar2 != 0)) { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - fVar11 = sinf_wrapper((float)iVar4 * 3.1415927 * 0.5); - local_9fc = GHIDRA_CAST((fVar11 * 0.5 + 0.5)); - local_a28 = GHIDRA_CAST(Math)::lerp(0.6,1.0,(float)local_9fc,0); - Math::lerp(0.5,1.0,(float)local_9fc,0); - (GHIDRA_CAST((0x3f800000)))->Color::Color((float)local_9fc * 0.25,(float)local_9fc * 0.35); - } - else { - local_a28 = GHIDRA_CAST(Math)::lerp(0.6,1.0,(float)local_9fc,0); - Math::lerp(0.5,1.0,(float)local_9fc,0); - (GHIDRA_CAST((aCStackY_2e04 + 0x81)))->Color::Color(); - } - in_stack_ffffe824 = 0x7963b7; - tmpColor = GHIDRA_CAST(FUN_004072e0()); - (GHIDRA_CAST((chargeFadeColor)))->Color::operator_assign(tmpColor); - in_stack_ffffe840 = GHIDRA_CAST(chargeFadeColor); - in_stack_ffffe83c = GHIDRA_CAST(0x7963e1); - this->SetColor(); - } - } - bVar2 = HasCollectible(this,0xbf,0); - if (bVar2 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (iVar4 % 0xb4 == 0) { - AddDollarBillEffect(this); - } - } - bVar2 = HasCollectible(this,0xda,0); - if ((bVar2 != 0) && (bVar2 = HasFullHearts(this), bVar2 == 0)) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x708,0); - if (bVar2 == 0) goto LAB_00796537; - iVar4 = Isaac::Random(2); - bVar2 = iVar4 != 0; - } - else { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(900,0); - } - if (bVar2 != 0) { - AddHearts(this,1,0,0); - iVar4 = 0x9d; - if (this->_playerType == 0x16) { - iVar4 = 0x266; - } - play_sound_with_fart_seed(iVar4,1.0,2,0,1.0); - uVar22 = Random(); - in_stack_ffffe838 = GHIDRA_CAST(0x0); - in_stack_ffffe834 = &g_vectorZero; - in_stack_ffffe830 = &this->_pos; - in_stack_ffffe82c = 0x31; - in_stack_ffffe828 = 1000; - in_stack_ffffe824 = 0x7964ff; - in_stack_ffffe840 = - (Entity_Player *) - Game::Spawn(g_game,1000,0x31,in_stack_ffffe830,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar22); - in_stack_ffffe83c = GHIDRA_CAST(0x796505); - pvVar28 = (void *)__RTDynamicCast(); - (GHIDRA_CAST((&heartOffset)))->Vector::Vector(0.0,-24.0); - FUN_004563c0(); - set_field_358(pvVar28,1.0); - } - } -LAB_00796537: - bVar2 = HasCollectible(this,0xe7,0); - if (((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0), bVar2 != 0)) && - (uVar22 = Isaac::Random(5), 1 < uVar22)) { - uVar22 = Random(); - in_stack_ffffe834 = &g_vectorZero; - in_stack_ffffe830 = &this->_pos; - in_stack_ffffe82c = 0x2d; - in_stack_ffffe828 = 1000; - in_stack_ffffe824 = 0x7965a8; - in_stack_ffffe838 = this; - in_stack_ffffe840 = - (Entity_Player *) - Game::Spawn(g_game,1000,0x2d,in_stack_ffffe830,&g_vectorZero,GHIDRA_CAST(this),0,uVar22); - in_stack_ffffe83c = GHIDRA_CAST(0x7965ae); - queryList = GHIDRA_CAST(__RTDynamicCast()); - fVar11 = random_float(); - tarScaleFactor = fVar11 * 0.5 + 0.2; - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&tarCreepScale,&tarScaleFactor); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - queryList->Update(); - } - bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasTrinketEffect(0x45); - if (((bVar2 == 0) && (bVar2 = HasTrinket(this,0x45,0), bVar2 != 0)) && - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(300,0), bVar2 != 0 && - (iVar4 = Isaac::Random(5), iVar4 == 0)))) { - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetTrinket(itemConfig,0x45); - (GHIDRA_CAST((polaroidEffect)))->TemporaryEffect::TemporaryEffect(configItem); - iVar4 = GetTrinketMultiplier(this,0x45); - iVar20 = Isaac::Random(5); - polaroidEffectCooldown = iVar4 * (iVar20 + 3) * 0x1e; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(polaroidEffect,1,1); - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - pvVar28 = (void *)Game::GetPlayerManager(g_game); - iVar4 = (GHIDRA_CAST((pvVar28)))->msvc::vector::size(); - if (iVar4 != 0) { - uVar22 = 0; - do { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - local_9fc = PlayerManager::GetPlayer(playerManager,uVar22); - if ((local_9fc != this) && - (pEVar23 = GHIDRA_CAST(EntityPtr)::Ref(), local_9fc != pEVar23)) { - (GHIDRA_CAST((&confusionSource)))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->Entity::AddConfusion(&confusionSource,0x5a,0); - } - uVar22 = uVar22 + 1; - pvVar28 = (void *)Game::GetPlayerManager(g_game); - uVar5 = (GHIDRA_CAST((pvVar28)))->msvc::vector::size(); - } while (uVar22 < uVar5); - } - } - } - tempEffects = &this->_temporaryeffects; - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(299); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01)) + 0x0))) = ZEXT812(0x40000000); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x4))) = 0; - local_a28 = GHIDRA_CAST(flags_01._l); - if (bVar2 == 0) { - bVar2 = HasCollectible(this,299,0); - if (((bVar2 != 0) || (iVar4 = GetZodiacEffect(this), iVar4 == 299)) && - (flags_01 = (BitSet128)ZEXT416(GHIDRA_UINT(this->_taurusSpeedBonus)), this->_taurusSpeedBonus != 0.0 - )) { - this->_taurusSpeedBonus = 0.0; - this->_cacheFlags = this->_cacheFlags | 0x10; -LAB_00796889: - EvaluateItems(this); - } - } - else { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((room)))->Room::GetAliveEnemiesCount(); - if ((iVar4 != 0) || - ((*GHIDRA_CAST((GHIDRA_CAST(&(flags_01)) + 0x0))) = ZEXT812(0x40000000), (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x4))) = 0, - (float)flags_01._l < this->_movespeed || (float)flags_01._l == this->_movespeed)) { - flags_01 = (BitSet128)ZEXT416(GHIDRA_UINT(this->_movespeed)); - if ((this->_movespeed < 2.0) || - (pvVar28 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(299), - *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) != 0)) { - fVar11 = this->_taurusSpeedBonus + 0.0022222223; - flags_01 = (BitSet128)ZEXT416(GHIDRA_UINT(fVar11)); - this->_taurusSpeedBonus = fVar11; - this->_cacheFlags = this->_cacheFlags | 0x1010; - goto LAB_00796889; - } - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(299,1); - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,299); - (GHIDRA_CAST((taurusEffect)))->TemporaryEffect::TemporaryEffect(configItem); - taurusEffectCooldown = 0xb4; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddEffect(taurusEffect,1,1); - } - else { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(299,1); - } - } - bVar2 = HasCollectible(this,0x134,0); - if (bVar2 == 0) { - iVar4 = GetZodiacEffect(this); - if (iVar4 == 0x134) goto LAB_007968b4; - } - else { -LAB_007968b4: - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); - if (bVar2 != 0) { - iVar4 = Isaac::Random(5); - if (iVar4 != 0) { - iVar4 = Isaac::Random(2); - GetTearHitParams(this,&aquariusTearParams,1,(this->_meleeDamage * 0.666) / this->_damage, - (-GHIDRA_UINT((iVar4 != 0)) & 2) - 1,GHIDRA_CAST(0x0)); - uVar22 = Random(); - in_stack_ffffe834 = GHIDRA_CAST(0x796943); - queryList = Game::Spawn(g_game,1000,0x36,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar22); - fVar11 = random_float(); - aquariusScaleFactor = fVar11 * 0.5 + 0.2; - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&aquariusCreepScale,&aquariusScaleFactor); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - queryList->SetCollisionDamage(); - FUN_00665b80(); - in_stack_ffffe83c = GHIDRA_CAST(&aquariusTearParams._tearColor); - in_stack_ffffe840 = GHIDRA_CAST(0xffffffff); - queryList->SetColor(); - in_stack_ffffe838 = GHIDRA_CAST(0x7969d3); - queryList->Update(); - flags_01 = aquariusTearParams._flags; - } - } - } - tempEffects = &this->_temporaryeffects; - bVar2 = HasCollectible(this,0x199,0); - if (bVar2 != 0) { - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x199); - if (this->_redHearts < 1) { - if (bVar2 != 0) goto LAB_00796a3f; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddCollectibleEffect(0x199,1,1); - itemConfig = Isaac::GetItemConfig(); - bVar2 = 0; - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x12); - AddCostume(this,configItem,bVar2); - } - else if (bVar2 != 0) { -LAB_00796a3f: - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x4b0,0); - if (bVar2 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::IsClear(); - if (bVar2 != 0) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') goto LAB_00796ab9; - } - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x3a); - (GHIDRA_CAST((vesselShieldEffect)))->TemporaryEffect::TemporaryEffect(configItem); - vesselShieldCooldown = 300; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddEffect(vesselShieldEffect,1,1); - } - } - } -LAB_00796ab9: - bVar2 = HasPlayerForm(this,9); - local_a1c = GHIDRA_CAST(&DAT_0000000f); - if (((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x708,0), bVar2 != 0)) && - (iVar4 = Isaac::Random(0xf), iVar4 == 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::IsClear(); - if (bVar2 == 0) { - in_stack_ffffe840 = GHIDRA_CAST(local_afa); - in_stack_ffffe83c = GHIDRA_CAST(0x796b1a); - UseActiveItem(this,GHIDRA_CAST(in_stack_ffffe840),0x24,1,-1,0); - } - } - bVar2 = HasPlayerForm(this,6); - if ((bVar2 != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1434)))) == 0)) { - uVar22 = Random(); - in_stack_ffffe828 = 8; - in_stack_ffffe824 = 0x796b6a; - Game::Spawn(g_game,8,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),3,uVar22); - queryList = GHIDRA_CAST(__RTDynamicCast()); - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(this)); - tmpVec = (GHIDRA_CAST((&knifeOffset)))->Vector::Vector(0.0,-10.0); - (GHIDRA_CAST((queryList)))->Entity::SetPositionOffset(tmpVec); - (GHIDRA_CAST((&tearColorCopy)))->Color::operator_assign(&this->_tearColor); - FUN_007cf940(); - local_a08 = GHIDRA_CAST(flags_01._l); - fVar11 = (GHIDRA_CAST((&tearColorCopy)))->Color::A(); - Font::SetLineHeightModifier(GHIDRA_CAST(&tearColorCopy),fVar11 * (float)local_a08); - in_stack_ffffe840 = GHIDRA_CAST(&tearColorCopy); - queryList->SetColor(); - in_stack_ffffe82c = 0x796c1d; - FUN_005cd5c0(); - in_stack_ffffe83c = GHIDRA_CAST(this->_damage); - flags_01 = (BitSet128)ZEXT416(in_stack_ffffe83c); - queryList->SetCollisionDamage(); - in_stack_ffffe834 = GHIDRA_CAST(0x200000); - in_stack_ffffe830 = GHIDRA_CAST(0x796c42); - (GHIDRA_CAST((queryList)))->Entity::AddEntityFlags(0x200000); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1434)))))))->EntityPtr::SetReference(queryList); - in_stack_ffffe838 = GHIDRA_CAST(0x796c58); - queryList->Update(); - } - bVar2 = HasTrinket(this,0x19,0); - if ((bVar2 != 0) && (this->_variant == 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pEVar23 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetGridIndex(&this->_pos); - local_a08 = pEVar23; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pGVar12 = (GHIDRA_CAST((room)))->Room::GetGridEntity(GHIDRA_UINT(pEVar23)); - GetTrinketMultiplier(this,0x19); - HasGoldenTrinket(this,0x19); - iVar4 = Game::GetFrameCount(g_game); - if (((iVar4 % 900 == 0) && (iVar4 = Isaac::Random(2), iVar4 == 0)) && - (((pGVar12 == GHIDRA_CAST(0x0) || (iVar4 = (GHIDRA_CAST((pGVar12)))->GridEntity::GetType(), iVar4 == 1)) || - (iVar4 = (GHIDRA_CAST((pGVar12)))->GridEntity::GetType(), iVar4 == 10)))) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::is_type_16(); - if (bVar2 == 0) { - pEVar23 = GHIDRA_CAST(0x0); - bVar2 = HasGoldenTrinket(this,0x19); - if (bVar2 != 0) { - pEVar23 = GHIDRA_CAST(0x3); - } - local_9fc = pEVar23; - bVar2 = HasTrinket(this,0x5b,0); - if (bVar2 != 0) { - local_9fc = GHIDRA_CAST(0x21); - iVar4 = GetTrinketMultiplier(this,0x5b); - if (iVar4 == 2) { - local_9fc = GHIDRA_CAST(0x42); - } - else if (iVar4 == 3) { - local_9fc = GHIDRA_CAST(0x64); - } - rngPtr = GHIDRA_CAST(rng_vector_at()); - fVar11 = (float)(GHIDRA_CAST((rngPtr)))->RNG::RandomInt(100); - if (GHIDRA_UINT(fVar11) < local_9fc) { - pEVar23 = GHIDRA_CAST(&DAT_00000005); - } - local_9fc = pEVar23; - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - rngPtr = GHIDRA_CAST(rng_vector_at()); - uVar22 = (GHIDRA_CAST((rngPtr)))->RNG::Next(); - in_stack_ffffe83c = GHIDRA_CAST(0x796de2); - in_stack_ffffe840 = local_a08; - (GHIDRA_CAST((room)))->Room::SpawnGridEntity(GHIDRA_INT(local_a08),0xe,GHIDRA_UINT(local_9fc),uVar22,0); - goto LAB_00796de7; - } - } - iVar4 = Game::GetFrameCount(g_game); - if ((iVar4 % 0x708 == 0) && (iVar4 = Isaac::Random(2), iVar4 == 0)) { - in_stack_ffffe840 = GHIDRA_CAST(&this->_pos); - in_stack_ffffe83c = GHIDRA_CAST(0x797184); - Game::ButterBeanFart(g_game,GHIDRA_CAST(in_stack_ffffe840),120.0,GHIDRA_CAST(this),1,0); - } - } -LAB_00796de7: - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar22 = (GHIDRA_CAST((room)))->Room::GetSpawnSeed(); - bVar2 = HasTrinket(this,0x46,0); - if (bVar2 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::IsClear(); - if ((bVar2 == 0) && - (((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(900,uVar22 % 0x708), bVar2 != 0 && - (iVar4 = Isaac::Random(2), iVar4 == 0)) || - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x708,uVar22 % 0x708), bVar2 != 0)))) { - in_stack_ffffe840 = GHIDRA_CAST(0x796e7c); - play_sound_with_fart_seed(0xb5,0.7,2,0,1.0); - iVar4 = GetTrinketMultiplier(this,0x46); - if (0 < iVar4) { - do { - ThrowBlueSpider(this,&this->_pos,&g_vectorZero); - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - } - } - } - bVar2 = HasTrinket(this,0x40,0); - if ((bVar2 != 0) && (iVar4 = Game::GetFrameCount(g_game), iVar4 % 0x5a == 0)) { - this->_cacheFlags = this->_cacheFlags | 0x2e; - EvaluateItems(this); - } - bVar2 = HasPlayerForm(this,4); - pEVar23 = this; - if (bVar2 != 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(5,0); - if (bVar2 != 0) { - uVar22 = Random(); - in_stack_ffffe834 = &g_vectorZero; - in_stack_ffffe830 = &this->_pos; - in_stack_ffffe82c = 0x2e; - in_stack_ffffe828 = 1000; - in_stack_ffffe824 = 0x796f36; - Game::Spawn(g_game,1000,0x2e,in_stack_ffffe830,&g_vectorZero,GHIDRA_CAST(this),0,uVar22); - queryList = GHIDRA_CAST(__RTDynamicCast()); - fVar11 = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x0))) = fVar11 * 0.5 + 0.2; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01)) + 0x4))) = extraout_var_00; - bobScaleFactor = (float)flags_01._l; - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&bobCreepScale,&bobScaleFactor); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - pcVar1 = *(code **)(*GHIDRA_CAST(queryList) + 0x3c); - in_stack_ffffe840 = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - (*pcVar1)(); - in_stack_ffffe83c = GHIDRA_CAST(0x796fc3); - queryList->Update(); - pEVar23 = savedPlayer; - in_stack_ffffe838 = this; - } - } - bVar2 = HasCollectible(pEVar23,0x1a9,0); - if (bVar2 != 0) { - uVar22 = 10; - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - uVar22 = 0xe; - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - outResult = GHIDRA_CAST(local_a98); - uVar39 = 0x797030; - EntityList::QueryRadius(entityList,GHIDRA_CAST(outResult),&pEVar23->_pos,200.0,uVar22); - pEVar24 = GHIDRA_CAST(0x0); - local_14 = 2.8026e-45; - local_a00 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_a98))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar2 == 0) { -LAB_007971e6: - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Type(); - if (iVar4 == 9) { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - outResult = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar39 = 0; - in_stack_ffffe840 = GHIDRA_CAST(*puVar9); - in_stack_ffffe83c = GHIDRA_CAST(0x797223); - local_9fc = GHIDRA_CAST(__RTDynamicCast()); - if (local_9fc != GHIDRA_CAST(0x0)) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->Entity::Position(&spotlitProjectilePos); - bVar2 = IsPosInSpotLight(pEVar23,tmpVec); - if ((bVar2 != 0) && - (projectileFlags = - (GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->Entity_Projectile::ProjectileFlags(), - (projectileFlags & 0x1000000) == 0)) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->Entity::Velocity(&spotlitProjectileVel); - projectileSlowFactor = 0.5; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&slowedProjectileVel,&projectileSlowFactor); - (GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->Entity::SetVelocity(tmpVec); - outResult = GHIDRA_CAST(0x7972bb); - (GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->Entity_Projectile::AddProjectileFlags(0x1000000); - } - } - } - else { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Type(); - if (iVar4 == 2) { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - outResult = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar39 = 0; - in_stack_ffffe840 = GHIDRA_CAST(*puVar9); - in_stack_ffffe83c = GHIDRA_CAST(0x7972f6); - local_a0c = GHIDRA_CAST(__RTDynamicCast()); - if ((local_a0c != GHIDRA_CAST(0x0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->Entity::IsDescendantOf(GHIDRA_CAST(pEVar23)), bVar2 == 0) - ) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->Entity::Position(&spotlitTearPos); - bVar2 = IsPosInSpotLight(pEVar23,tmpVec); - if (bVar2 != 0) { - outResult = GHIDRA_CAST(0x79734b); - tmpFlags = GHIDRA_CAST(FUN_00435bc0()); - tmpFlags2 = (GHIDRA_CAST((local_a0c)))->Entity_Tear::TearFlags(¤tTearFlags); - tmpFlags = BitSet128::operator_and(&slowFlagMatch,tmpFlags2,tmpFlags); - bVar2 = (GHIDRA_CAST((tmpFlags)))->BitSet128::IsZero(); - if (bVar2 != 0) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->Entity::Velocity(&spotlitTearVel); - tearSlowFactor = 0.5; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&slowedTearVel,&tearSlowFactor); - (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->Entity::SetVelocity(tmpVec); - tmpFlags = GHIDRA_CAST(FUN_00435bc0()); - tmpFlags2 = (GHIDRA_CAST((local_a0c)))->Entity_Tear::TearFlags(currentTearFlags2); - tmpFlags = BitSet128::operator_or(&slowedTearFlags,tmpFlags2,tmpFlags); - flags_01 = *tmpFlags; - uVar39 = (uint32_t)flags_01._l; - outResult = (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x4))); - in_stack_ffffe840 = GHIDRA_CAST(0x797406); - (GHIDRA_CAST((local_a0c)))->Entity_Tear::SetTearFlags(flags_01); - } - goto LAB_00797406; - } - } - } - } - } - else { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Position(&spotlitEnemyPos); - bVar2 = IsPosInSpotLight(pEVar23,tmpVec); - if (bVar2 == 0) goto LAB_007971e6; - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - queryList = GHIDRA_CAST(*puVar9); - fVar11 = 1.115285e-38; - (GHIDRA_CAST((&spotlightSlowSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - bVar2 = 0; - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x28,0x28,0x28); - color_00._tint[1] = (float)in_stack_ffffe828; - color_00._tint[0] = (float)in_stack_ffffe824; - color_00._tint[2] = (float)in_stack_ffffe82c; - color_00._tint[3] = (float)in_stack_ffffe830; - color_00._colorize[0] = (float)in_stack_ffffe834; - color_00._colorize[1] = (float)in_stack_ffffe838; - color_00._colorize[2] = (float)in_stack_ffffe83c; - color_00._colorize[3] = (float)in_stack_ffffe840; - color_00._offset[0] = (float)uVar39; - color_00._offset[1] = (float)outResult; - color_00._offset[2] = fVar11; - (GHIDRA_CAST((queryList)))->Entity::AddSlowing(&spotlightSlowSource,2,0.9,color_00,bVar2); - } - else { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - queryList = GHIDRA_CAST(*puVar9); - msvc::vector::operator_index(); - iVar4 = FUN_00753710(); - fVar11 = 1.1152604e-38; - (GHIDRA_CAST((&spotlightSlowSourcePvp)))->EntityRef::constructor(GHIDRA_CAST(savedPlayer)); - bVar2 = 1; - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x28,0x28,0x28); - color._tint[1] = (float)in_stack_ffffe828; - color._tint[0] = (float)in_stack_ffffe824; - color._tint[2] = (float)in_stack_ffffe82c; - color._tint[3] = (float)in_stack_ffffe830; - color._colorize[0] = (float)in_stack_ffffe834; - color._colorize[1] = (float)in_stack_ffffe838; - color._colorize[2] = (float)in_stack_ffffe83c; - color._colorize[3] = (float)in_stack_ffffe840; - color._offset[0] = (float)uVar39; - color._offset[1] = (float)outResult; - color._offset[2] = fVar11; - (GHIDRA_CAST((queryList)))->Entity::AddSlowing(&spotlightSlowSourcePvp,2 - GHIDRA_UINT((iVar4 != 0)),0.9,color,bVar2); - pEVar23 = savedPlayer; - } -LAB_00797406: - pEVar24 = local_a00; - } - pEVar24 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar24)) + 0x1)))); - local_a00 = pEVar24; - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_a98))))->EntityList)::Size(); - } while (pEVar24 < puVar10); - } - local_14 = -NAN; - (GHIDRA_CAST((local_a98)))->EntityList_Query::~EntityList_Query(); - } - bVar2 = HasCollectible(pEVar23,0x1a7,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar23,0x1a7,0); - if ((bVar2 == 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1454)))) != GHIDRA_CAST(0x0))) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1454)))) + 0x28))(); - } - } - else { - local_a08 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1454)))); - local_a3c = *GHIDRA_CAST(local_a08); - if (local_a3c == GHIDRA_CAST(0x0)) { - uVar22 = Random(); - Game::Spawn(g_game,7,8,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),3,uVar22); - queryList = GHIDRA_CAST(__RTDynamicCast()); - tmpVec = (GHIDRA_CAST((&haloOffset)))->Vector::Vector(0.0,-20.0); - (GHIDRA_CAST((queryList)))->Entity::SetPositionOffset(tmpVec); - pEVar23 = savedPlayer; - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(savedPlayer)); - (GHIDRA_CAST((queryList)))->Entity::SetSpawnerEntity(GHIDRA_CAST(pEVar23)); - set_field_358(queryList,3000.0); - pEVar43 = GHIDRA_CAST(0x0); - pcVar1 = *(code **)(*GHIDRA_CAST(queryList) + 0x40); - iVar4 = Isaac::Random(2); - in_stack_ffffe840 = GHIDRA_CAST(newHaloTearParams); - pTVar13 = GetTearHitParams(savedPlayer,GHIDRA_CAST(in_stack_ffffe840),3,1.0,iVar4 * 2 + -1, - pEVar43); - flags_01 = (BitSet128)ZEXT416(GHIDRA_UINT(pTVar13->_tearDamage)); - (*pcVar1)(); - queryList->Update(); - (GHIDRA_CAST((GHIDRA_CAST(local_a08))))->EntityPtr::SetReference(queryList); - pEVar23 = savedPlayer; - } - else { - queryList = GHIDRA_CAST(0x0); - pcVar1 = *(code **)(*GHIDRA_CAST(local_a3c) + 0x40); - iVar4 = Isaac::Random(2); - in_stack_ffffe840 = GHIDRA_CAST(haloTearParams); - pTVar13 = GetTearHitParams(pEVar23,GHIDRA_CAST(in_stack_ffffe840),3,1.0,iVar4 * 2 + -1,queryList - ); - flags_01 = (BitSet128)ZEXT416(GHIDRA_UINT(pTVar13->_tearDamage)); - (*pcVar1)(); - } - } - ClampGoldenHearts(pEVar23,0); - bVar2 = HasCollectible(pEVar23,0x1a4,0); - dVar29 = (double)(ZEXT48(in_stack_ffffe840) << 0x20); - if (bVar2 != 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1adc)))) < 1) { - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad4)))); - iVar20 = pEVar23->_coopBabyBuffTimers[iVar4 + 0x25]; - while ((iVar20 == 0 && (iVar4 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8))))))) { - iVar4 = (iVar4 + 1) % 0x60; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad4)))) = iVar4; - iVar20 = pEVar23->_coopBabyBuffTimers[iVar4 + 0x25]; - } - queryList = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8)))) - iVar4)); - local_a3c = GHIDRA_CAST(&(queryList->_sprite)._animDefaultName); - if (-1 < GHIDRA_INT(queryList)) { - local_a3c = queryList; - } - dVar29 = (double)(ZEXT48(in_stack_ffffe840) << 0x20); - if (GHIDRA_INT(local_a3c) < 0x5f) { - if (((0 < GHIDRA_INT(local_a3c)) && - (local_a08 = (Entity_Player *) - pEVar23->_coopBabyBuffTimers - [(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8)))) + 0x5f) % 0x60 + 0x25], - local_a08 != GHIDRA_CAST(0x0))) && - (cVar3 = (GHIDRA_CAST((GHIDRA_CAST(local_a08))))->Entity::IsDead(), cVar3 == '\0')) { - (GHIDRA_CAST((GHIDRA_CAST(local_a08))))->Entity::Position(&lastTrailPos); - FUN_00a0ff70(); - dVar29 = (double)(ZEXT48(in_stack_ffffe840) << 0x20); - if ((float)flags_01._l < 100.0) goto LAB_00797b3b; - } - uVar22 = Random(); - pEVar43 = Game::Spawn(g_game,1000,0x5c,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),0, - uVar22); - effect = GHIDRA_CAST(__RTDynamicCast()); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x3c); - effect->Update(); - pEVar23->_coopBabyBuffTimers[*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8)))) + 0x25] = GHIDRA_INT(effect); - msvc::multiset::insert(); - queryList = local_a3c; - dVar29 = (double)(ZEXT48(pEVar43) << 0x20); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8)))) = (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8)))) + 1) % 0x60; - if (0xb < GHIDRA_INT(local_a3c)) { - local_a30 = GHIDRA_CAST(0xffffffff); - (GHIDRA_CAST((GHIDRA_CAST(&averagePos))))->EntityPtr::clear(); - dVar29 = (double)(ZEXT48(pEVar43) << 0x20); - local_a14 = GHIDRA_CAST((GHIDRA_INT(queryList) / 2)); - if (-1 < GHIDRA_INT(local_a14)) { - pEVar24 = GHIDRA_CAST(0xffffffff); - do { - if (-1 < GHIDRA_INT(pEVar24)) goto LAB_00797a7b; - pEVar21 = (Entity_Player *) - ((GHIDRA_INT((&(local_a14->_sprite)._filename + -3)) + - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad4))))) % 0x60); - local_a3c = (Entity *) - pEVar23->_coopBabyBuffTimers[GHIDRA_INT((GHIDRA_INT(&pEVar21->_collisionIndex) + 1))]; - local_a00 = pEVar21; - if (local_a3c == GHIDRA_CAST(0x0)) goto LAB_00797a5e; - entityColor = GHIDRA_CAST((GHIDRA_CAST((local_a3c)))->Entity)::GetColor(); - local_a08 = GHIDRA_CAST((GHIDRA_CAST((entityColor)))->Color)::A(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0))) = ZEXT812(0x3f000000); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0xc))) = 0; - if ((float)local_a08 < (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0)))) { -LAB_00797a58: - pEVar24 = local_a30; - } - else { - (GHIDRA_CAST((local_a3c)))->Entity::Position(&trailPointPos); - FUN_00a0ff70(); - if (400.0 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0)))) goto LAB_00797a58; - local_a30 = pEVar21; - (GHIDRA_CAST((GHIDRA_CAST(&farthestPos))))->EntityPtr::clear(); - pEVar24 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8)))); - auVar32 = ZEXT816(0); - fVar11 = 0.0; - local_a0c = GHIDRA_CAST(0x0); - local_a08 = pEVar21; - if (pEVar21 != pEVar24) { - do { - local_a08 = (Entity_Player *) - pEVar23->_coopBabyBuffTimers - [GHIDRA_INT((GHIDRA_INT(&pEVar21->_collisionIndex) + 1))]; - if (local_a08 != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_a08))))->Entity::Position(&trailPos); - FUN_00a0ff70(); - local_a3c = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0))); - if ((float)local_a0c < (float)local_a3c) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a08))))->Entity::Position(&farthestTrailPos); - (GHIDRA_CAST((&farthestPos)))->Vector::operator_assign(tmpVec); - local_a0c = GHIDRA_CAST(local_a3c); - } - auVar32 = ZEXT416(local_a0c); - } - fVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0))); - pEVar21 = GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar21)) + 0x1)))) % 0x60)); - pEVar24 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8)))); - } while (pEVar21 != pEVar24); - pEVar21 = local_a00; - } - local_a0c = GHIDRA_CAST((fVar11 * 0.5)); - if ((float)local_a0c < 2500.0) { - local_a30 = GHIDRA_CAST(0xffffffff); - pEVar24 = GHIDRA_CAST(0xffffffff); - } - else { - pvVar28 = (void *)(GHIDRA_INT(pEVar24) - GHIDRA_INT(pEVar21)); - local_a38 = (void *)(GHIDRA_INT(pvVar28) + 0x60); - if (-1 < GHIDRA_INT(pvVar28)) { - local_a38 = pvVar28; - } - (GHIDRA_CAST((&averagePos)))->Vector::operator_assign(&g_vectorZero); - local_9fc = pEVar21; - if (pEVar21 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8))))) { - do { - if ((Entity *) - pEVar23->_coopBabyBuffTimers[GHIDRA_INT((GHIDRA_INT(&local_9fc->_collisionIndex) + 1))] - != GHIDRA_CAST(0x0)) { - tmpVec = (GHIDRA_CAST(((Entity *) - pEVar23->_coopBabyBuffTimers - [GHIDRA_INT((GHIDRA_INT(&local_9fc->_collisionIndex) + 1))])))->Entity::Position(&trailSumPos); - (GHIDRA_CAST((&averagePos)))->Vector::operator_add_assign(tmpVec); - } - local_9fc = GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST((local_9fc)) + 0x1)))) % 0x60)); - } while (local_9fc != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8))))); - pEVar21 = local_a00; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar33)) + 0x0))) = SUB124(ZEXT812(0x3f800000),0) / (float)GHIDRA_INT(local_a38); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar33)) + 0x4))) = SUB128(ZEXT812(0x3f800000),4); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar33)) + 0xc))) = 0; - invTrailCount = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar33)) + 0x0))); - (GHIDRA_CAST((&averagePos)))->Vector::operator_mul_assign(&invTrailCount); - local_9fc = GHIDRA_CAST(0x0); - if (pEVar21 == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8))))) goto LAB_00797a58; - do { - if ((Entity *) - pEVar23->_coopBabyBuffTimers[GHIDRA_INT((GHIDRA_INT(&pEVar21->_collisionIndex) + 1))] != - GHIDRA_CAST(0x0)) { - (GHIDRA_CAST(((Entity *) - pEVar23->_coopBabyBuffTimers - [GHIDRA_INT((GHIDRA_INT(&pEVar21->_collisionIndex) + 1))])))->Entity::Position(&trailCheckPos); - FUN_00a0ff70(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar33)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar33)) + 0x0))) / (float)local_a0c; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar33)) + 0x0))) < 0.25) { - local_9fc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_9fc)) + 0x1)))); - auVar33 = ZEXT416(GHIDRA_UINT(((float)GHIDRA_INT(local_a38) * 0.25))); - if ((float)GHIDRA_INT(local_a38) * 0.25 < - (float)((double)GHIDRA_INT(local_9fc) + - __uint_to_double_fixup[-(GHIDRA_INT(local_9fc) >> 0x1f)])) { - local_a30 = GHIDRA_CAST(0xffffffff); - } - } - } - pEVar21 = GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar21)) + 0x1)))) % 0x60)); - pEVar24 = local_a30; - } while (pEVar21 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ad8))))); - } - } -LAB_00797a5e: - dVar29 = (double)(ZEXT48(pEVar43) << 0x20); - local_a14 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_a14[-1])) + 0x847)))); - } while (-1 < GHIDRA_INT(local_a14)); - if (-1 < GHIDRA_INT(pEVar24)) { -LAB_00797a7b: - pEVar8 = local_a0c; - FUN_00431260(); - local_a14 = pEVar8; - uVar22 = Random(); - Game::Spawn(g_game,1000,0x5d,&averagePos,&g_vectorZero,GHIDRA_CAST(pEVar23),0,uVar22); - salvationEffect = GHIDRA_CAST(__RTDynamicCast()); - FUN_00435ed0(); - (**(code **)(*salvationEffect + 0xc))(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1adc)))) = 0x2d; - dVar29 = (double)averagePos.x; - KAGE_LogMessage(1,(uint8_t *) - "closed black powder circle at %.2f, %.2f with radius %.2f\n"); - } - } - } - } - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1adc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1adc)))) + -1; - dVar29 = (double)(ZEXT48(in_stack_ffffe840) << 0x20); - } - } -LAB_00797b3b: - salvationEffect = GHIDRA_CAST(FUN_0042d040()); - if (((salvationEffect == GHIDRA_CAST(0x0)) || (bVar2 = HasCollectible(pEVar23,0x1b8,0), bVar2 == 0)) || - (cVar3 = (**(code **)(*salvationEffect + 0x3c))(), cVar3 == '\0')) { - if (pEVar23->_isUrethraBlocked != 0) { - pEVar23->_isUrethraBlocked = 0; - } - } - else if (((pEVar23->_peeBurstCooldown < 1) && (pEVar23->_isUrethraBlocked == 0)) && - (iVar4 = Game::GetFrameCount(g_game), pEVar23->_nextUrethraBlockFrame <= iVar4)) { - pEVar23->_isUrethraBlocked = 1; - iVar4 = Isaac::Random(3); - pEVar23->_maxBladderCharge = (iVar4 + 1) * 0x1e; - pEVar23->_bladderCharge = 0; - } - bVar2 = HasCollectible(pEVar23,0x1ba,0); - if (bVar2 != 0) { - cVar3 = FUN_007db360(); - if (cVar3 == '\0') { - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba); - if (bVar2 != 0) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x1ba,1); - pcVar40 = "FloatNoGlow"; - goto LAB_00797c41; - } - } - else { - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba); - if (bVar2 == 0) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1ba,1,1); - pcVar40 = "FloatGlow"; -LAB_00797c41: - ANM2::Play(&pEVar23->_darkPrincesCrownSprite,GHIDRA_CAST(pcVar40),0); - } - } - bVar2 = HasCollectible(pEVar23,0x19f,0); - if (bVar2 == 0) { - tmpVec = &g_vectorZero; - } - else { - tmpVec = (GHIDRA_CAST((&crownOffset)))->Vector::Vector(0.0,-7.0); - } - (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_darkPrincesCrownSprite))))->Sprite::set_offset(tmpVec); - } - bVar2 = HasCollectible(pEVar23,0x201,0); - if ((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::IsFrame(5,0), bVar2 != 0)) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - pGVar12 = GHIDRA_CAST(FUN_00428a60()); - queryList = GHIDRA_CAST((GHIDRA_CAST((pGVar12)))->GridEntity)::GetSprite(); - (GHIDRA_CAST((GHIDRA_CAST(local_b94))))->EntityList_EL::constructor(queryList); - pEVar24 = GHIDRA_CAST(0x0); - local_14 = 4.2039e-45; - local_9fc = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_b94))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar2 != 0) { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::IsDescendantOf(GHIDRA_CAST(pEVar23)); - if (bVar2 == 0) { - iVar4 = Isaac::Random(700); - if (iVar4 == 0) { - iVar4 = Isaac::Random(2); - if (iVar4 == 0) { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - queryList = GHIDRA_CAST(*puVar9); - (GHIDRA_CAST((&charmSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - uVar22 = 0x797d84; - (GHIDRA_CAST((queryList)))->Entity::AddCharmed(&charmSource,0xdc,0,0); - dVar29 = (double)((uint64_t)uVar22 << 0x20); - } - else { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - queryList = GHIDRA_CAST(*puVar9); - (GHIDRA_CAST((&fearSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((queryList)))->Entity::AddFear(&fearSource,0xdc,0); - } - pEVar24 = local_9fc; - } - } - } - pEVar24 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar24)) + 0x1)))); - local_9fc = pEVar24; - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_b94))))->EntityList)::Size(); - } while (pEVar24 < puVar10); - } - local_14 = -NAN; - (GHIDRA_CAST((local_b94)))->EntityList_Query::~EntityList_Query(); - } - bVar2 = HasCollectible(pEVar23,0x222,0); - if (bVar2 == 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x143c)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x143c)))) + 0x28))(); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x143c)))))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - else { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(freezeQuery),&pEVar23->_pos,40.0,8); - local_14 = 5.60519e-45; - local_a14 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(freezeQuery))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar24 = GHIDRA_CAST(*puVar9); - local_a08 = pEVar24; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar2 != 0) { - cVar3 = pEVar24->IsBoss(); - iVar4 = -4; - if (cVar3 != '\0') { - iVar4 = -0x32; - } - (GHIDRA_CAST((&freezeSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((GHIDRA_CAST(local_a08))))->Entity::AddFreeze(&freezeSource,iVar4,0); - } - puVar19 = &(*GHIDRA_CAST((GHIDRA_CAST((local_a14)) + 0x1))); - local_a14 = GHIDRA_CAST(puVar19); - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(freezeQuery))))->EntityList)::Size(); - } while (puVar19 < puVar10); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x143c)))) == 0) { - uVar22 = Random(); - tmpVec = &pEVar23->_pos; - queryList = Game::Spawn(g_game,1000,0x7b,tmpVec,&g_vectorZero,GHIDRA_CAST(pEVar23),0,uVar22); - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x143c)))))))->EntityPtr::SetReference(queryList); - dVar29 = (double)(ZEXT48(tmpVec) << 0x20); - } - local_14 = -NAN; - (GHIDRA_CAST((freezeQuery)))->EntityList_Query::~EntityList_Query(); - } - tempEffects = &pEVar23->_temporaryeffects; - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x93); - if ((bVar2 != 0) && (bVar2 = HasCollectible(pEVar23,0x93,0), bVar2 == 0)) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x93,-1); - } - pvVar28 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetNullEffect(0x30); - if (pvVar28 != (void *)0x0) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveNullEffect(0x30,1); - } - if (pEVar23->_playerType == 0x25) { - iVar4 = Game::Challenge(g_game); - if (iVar4 == 0x2c) { - local_a08 = GHIDRA_CAST(FUN_005b1720()); - iVar4 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetNullEffectNum(0x6d); - if ((GHIDRA_INT(local_a08) <= iVar4) && ((iVar4 - GHIDRA_INT(local_a08)) % 6 == 0)) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddNullEffect(0x6d,1,1); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_random_pickup_position(room,&darkEsauSpawnPos,1,0); - uVar22 = Random(); - tmpVec = &darkEsauSpawnPos; -LAB_007980ae: - queryList = Game::Spawn(g_game,0x362,0,tmpVec,&g_vectorZero,GHIDRA_CAST(pEVar23),0,uVar22); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_darkEsau))))->EntityPtr::SetReference(queryList); - queryList->Update(); - dVar29 = (double)(ZEXT48(tmpVec) << 0x20); - } - } - else { - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x6d); - if ((bVar2 != 0) && - (pvVar28 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetNullEffect(0x6d), - *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) < 0xb)) { - if (pEVar23->_isControlsEnabled != 0) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x6d,-1); - if (GHIDRA_CAST(pEVar23->_darkEsau) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(pEVar23->_darkEsau) + 0x28))(); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_random_pickup_position(room,&darkEsauRespawnPos,1,0); - uVar22 = Random(); - tmpVec = &darkEsauRespawnPos; - goto LAB_007980ae; - } - pvVar28 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::GetNullEffect(0x6d); - if (pvVar28 != (void *)0x0) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) = 10; - } - } - } - } - tempEffects = &pEVar23->_temporaryeffects; - local_a08 = GHIDRA_CAST(pEVar23->_redStewBonusDuration); - if (0 < GHIDRA_INT(local_a08)) { - stewDurationLeft = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetHitPointsLost(); - stewDurationLeft = pEVar23->_redStewBonusDuration - stewDurationLeft; - local_b20[1] = 0.0; - salvationEffect = GHIDRA_CAST(std)::max(); - iVar4 = *salvationEffect; - pEVar23->_redStewBonusDuration = iVar4; - if (iVar4 / 10 < GHIDRA_INT(local_a08) / 10) { - Level::SetHeartPicked(GHIDRA_CAST(tempEffects)); - tempEffects->_cacheFlags = tempEffects->_cacheFlags | 1; - } - } - sfx = MusicManager::SFXManager(); - local_a29 = SFXManager::IsPlaying(sfx,0x251); - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c0); - if ((bVar2 == 0) || - (local_a08 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(0x2c0), - local_a08 == GHIDRA_CAST(0x0))) { - bVar2 = local_a29; - } - else { - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(local_a08) + 8)); - bVar26 = false; - if (iVar4 == 0x2d) { - sfx = MusicManager::SFXManager(); - uVar22 = 0x3f800000; - (GHIDRA_CAST((sfx)))->SoundEffects::Play(0x251,1.0,0x3c,0,1.0,0.0); - dVar29 = (double)((uint64_t)uVar22 << 0x20); - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(local_a08) + 8)); - bVar26 = iVar4 == 0x2d; - } - bVar2 = !bVar26 && 0x2c < iVar4; - } - if (bVar2 != 0) { - sfx = MusicManager::SFXManager(); - SFXManager::Stop(sfx,0x251); - } - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x280); - if ((bVar2 != 0) && (bVar2 = HasCollectible(pEVar23,0x280,0), bVar2 == 0)) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x280,-1); - } - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x3c); - if (bVar2 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(deflectQuery),&pEVar23->_pos,120.0,10); - local_14 = 7.00649e-45; - local_a38 = (void *)0x0; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(deflectQuery))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar24 = GHIDRA_CAST(*puVar9); - local_a00 = pEVar24; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::FrameCount(); - if (2 < iVar4) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsProjectile(); - if ((bVar2 == 0) || - (projectileFlags = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Projectile::ProjectileFlags(), - (projectileFlags & 0x80000000) != 0)) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsActiveEnemy(0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::HasEntityFlags(0x20000000), bVar2 == 0)) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Position(&pushedEnemyPos); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__sub(&toPushedEnemy,&pEVar23->_pos); - (GHIDRA_CAST((tmpVec)))->Vector::__sub(GHIDRA_CAST((local_a98 + 0x10)),&pEVar23->_velocity); - local_a08 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((local_a98 + 0x10)))))->Vector)::LengthSquared(); - if (0.01 <= (float)local_a08) { - local_b2c[0] = (GHIDRA_CAST((GHIDRA_CAST((local_a98 + 0x10)))))->Vector::LengthSquared(); - local_b2c[0] = 60.0 / local_b2c[0]; - (GHIDRA_CAST((GHIDRA_CAST((local_a98 + 0x10)))))->Vector::operator_mul_assign(local_b2c); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Velocity(&pushedEnemyVel); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST((local_a98 + 0x10)))))->Vector::Normalized(&pushDirNorm); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__unm(&negPushDir); - local_a08 = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Dot(pVVar14); - if (0.0 < (float)local_a08) { - pushBoost = (float)local_a08 * 0.25 + 1.0; - (GHIDRA_CAST((GHIDRA_CAST((local_a98 + 0x10)))))->Vector::operator_mul_assign(&pushBoost); - } - (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::AddVelocity(GHIDRA_CAST((local_a98 + 0x10)),0); - } - } - } - else { - uVar5 = 0x47; - uVar22 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::InitSeed(); - (GHIDRA_CAST((&deflectRng)))->RNG::game_constructor(uVar22,uVar5); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 6; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Position(&deflectedProjPos); - (GHIDRA_CAST((tmpVec)))->Vector::__sub(&toProjectile,&pEVar23->_pos); - local_a08 = GHIDRA_CAST((GHIDRA_CAST((&toProjectile)))->Vector)::LengthSquared(); - if (0.01 <= (float)local_a08) { - local_b20[0] = (GHIDRA_CAST((&toProjectile)))->Vector::LengthSquared(); - local_b20[0] = 60.0 / local_b20[0]; - (GHIDRA_CAST((&toProjectile)))->Vector::operator_mul_assign(local_b20); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Velocity(&deflectedProjVel); - pEVar8 = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Length(); - projectileSpeed = (float)pEVar8; - if (0.0 < (float)pEVar8) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Velocity(&deflectedProjVel2); - local_a08 = GHIDRA_CAST((GHIDRA_CAST((&toProjectile)))->Vector)::Dot(tmpVec); - pEVar8 = GHIDRA_CAST(0x0); - if ((float)local_a08 < 0.0) { - tmpVec = (GHIDRA_CAST((&toProjectile)))->Vector::Normalized(&toProjectileNorm); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::Velocity(&projVel); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__div(&projDir,&projectileSpeed); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::Rotated(&projPerp,90.0); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__unm(&negProjPerp); - fVar11 = (GHIDRA_CAST((tmpVec)))->Vector::Dot(pVVar14); - local_a08 = GHIDRA_CAST((fVar11 - 0.01)); - fVar11 = (GHIDRA_CAST((&deflectRng)))->RNG::RandomFloat(); - pEVar8 = GHIDRA_CAST((fVar11 * 0.02 + (float)local_a08)); - local_a14 = pEVar8; - Math::abs(); - if ((float)pEVar8 < 0.5) { - pEVar24 = GHIDRA_CAST(0x3f000000); - FUN_00753550(); - pEVar8 = local_a14; - if ((float)local_a14 <= 0.0) { - local_9fc = GHIDRA_CAST((GHIDRA_UINT(pEVar24) ^ 0x80000000)); - FUN_00753550(); - tmpVec = &rotatedLeft; - } - else { - local_9fc = pEVar24; - FUN_00753550(); - tmpVec = &rotatedRight; - } - tmpVec = (GHIDRA_CAST((&toProjectile)))->Vector::Rotated(tmpVec, - (((float)local_9fc - (float)pEVar8) * 180.0) / - 3.1415927); - (GHIDRA_CAST((&toProjectile)))->Vector::operator_assign(tmpVec); - } - pEVar24 = local_a00; - } - } - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Velocity(&projVelBeforeBend); - FUN_004d3050(); - bendFactor = (float)pEVar8; - pVVar14 = Vector::operator_mul(&bendOffset,&bendFactor,&toProjectile); - (GHIDRA_CAST((tmpVec)))->Vector::__add(&newVelocity,pVVar14); - local_b2c[1] = 5.0; - pfVar15 = GHIDRA_CAST(std)::max(); - if (0.4 < projectileSpeed) { - (GHIDRA_CAST((&newVelocity)))->Vector::Resize(*pfVar15); - } - (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::SetVelocity(&newVelocity); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),5); - guard_check_icall(); - } - else { - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),5); - guard_check_icall(); - } - } - } - pvVar7 = (void *)(GHIDRA_INT(local_a38) + 1); - local_a38 = pvVar7; - pvVar28 = (void *)(GHIDRA_CAST((GHIDRA_CAST(deflectQuery))))->EntityList::Size(); - } while (pvVar7 < pvVar28); - } - local_14 = -NAN; - (GHIDRA_CAST((deflectQuery)))->EntityList_Query::~EntityList_Query(); - } - local_a0d = HasCollectible(pEVar23,0x22a,0); - local_a29 = HasCollectible(pEVar23,0x24f,0); - if ((local_a0d != 0) || (local_a29 != 0)) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - local_a14 = (void *)0x42f00000; - } - else { - local_a14 = (void *)0x42a00000; - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - if (local_a29 == 0) { - auVar30 = ZEXT812(0x42a00000); - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar30)) + 0x4))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar30)) + 0x0))) = local_a14; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar34)) + 0xc))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar34)) + 0x0))) = auVar30; - EntityList::QueryRadius(entityList,GHIDRA_CAST(auraQuery),&pEVar23->_pos,(*GHIDRA_CAST((GHIDRA_CAST(&(auVar30)) + 0x0))),8); - local_14 = 9.80909e-45; - local_a14 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(auraQuery))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar24 = GHIDRA_CAST(*puVar9); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar2 != 0) && (pEVar24 != pEVar23)) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { -LAB_0079886f: - local_9fc = GHIDRA_CAST((GHIDRA_UINT(local_9fc) & 0xffffff00)); - } - else { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::is_player(); - local_9fc = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_9fc)) + 0x1))),1)); - if (bVar2 == 0) goto LAB_0079886f; - } - if (local_a29 != 0) { - cVar3 = pEVar24->IsBoss(); - if (cVar3 == '\0') { - iVar4 = FUN_00753700(); - local_a08 = GHIDRA_CAST((0x3c - iVar4)); - if (GHIDRA_INT(local_a08) < 1) goto LAB_007988e6; - (GHIDRA_CAST((&auraCharmSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - sourceRef = &auraCharmSource; - pEVar21 = local_a08; - pEVar41 = local_9fc; - } - else { - (GHIDRA_CAST((&auraBossCharmSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - sourceRef = &auraBossCharmSource; - pEVar21 = GHIDRA_CAST(&DAT_0000003c); - pEVar41 = GHIDRA_CAST(0x0); - } - uVar22 = 0x7988e6; - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::AddCharmed(sourceRef,GHIDRA_INT(pEVar21),(uint8_t)pEVar41,0); - dVar29 = (double)((uint64_t)uVar22 << 0x20); - } -LAB_007988e6: - FUN_00417340(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar34)) + 0x0))) = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auVar34)) + 0x0))) + 80.0)); - local_a08 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(auVar34))) + 0x0))); - if (local_a0d != 0) { - if (local_a29 != 0) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Position(&auraEnemyPos); - local_a3c = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::DistanceSquared(&pEVar23->_pos); - auVar34 = ZEXT416(local_a08); - if ((float)local_a08 < (float)local_a3c) goto LAB_0079898c; - } - cVar3 = pEVar24->IsBoss(); - if (cVar3 == '\0') { - (GHIDRA_CAST((&auraFearSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - sourceRef = &auraFearSource; - iVar4 = -0x14; - pEVar21 = local_9fc; - } - else { - (GHIDRA_CAST((&auraBossFearSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - iVar4 = -0x3c; - sourceRef = &auraBossFearSource; - pEVar21 = GHIDRA_CAST(0x0); - } - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::AddFear(sourceRef,iVar4,(uint8_t)pEVar21); - } - } -LAB_0079898c: - puVar19 = &(*GHIDRA_CAST((GHIDRA_CAST((local_a14)) + 0x1))); - local_a14 = GHIDRA_CAST(puVar19); - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(auraQuery))))->EntityList)::Size(); - } while (puVar19 < puVar10); - } - local_14 = -NAN; - (GHIDRA_CAST((auraQuery)))->EntityList_Query::~EntityList_Query(); - } - bVar2 = HasCollectible(pEVar23,0x22f,0); - if (((bVar2 != 0) && (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetIntervalTicks(6.0,0.0), iVar4 != 0)) && - (cVar3 = FUN_00758590(), cVar3 == '\0')) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - queryList = GHIDRA_CAST(chainLightningQuery); - uVar39 = 0x798a2e; - EntityList::QueryRadius(entityList,queryList,&pEVar23->_pos,60.0,8); - local_14 = 1.12104e-44; - uVar22 = 0; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(chainLightningQuery))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - uVar42 = 0x798a64; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(pEVar23)); - uVar38 = (uint32_t)((uint64_t)dVar29 >> 0x20); - if (bVar2 != 0) { - local_a08 = GHIDRA_CAST((pEVar23->_meleeDamage * 0.75)); - pEVar24 = pEVar23; - FUN_00435bc0(); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = uVar39; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = uVar38; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = queryList; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = uVar42; - queryList = spawn_chain_lightning - (&pEVar23->_pos,tearFlags,GHIDRA_CAST(pEVar24),(float)local_a08); - queryList->Update(); - break; - } - uVar22 = uVar22 + 1; - uVar5 = (GHIDRA_CAST((GHIDRA_CAST(chainLightningQuery))))->EntityList::Size(); - } while (uVar22 < uVar5); - } - local_14 = -NAN; - (GHIDRA_CAST((chainLightningQuery)))->EntityList_Query::~EntityList_Query(); - } - bVar2 = HasCollectible(pEVar23,0x23e,0); - local_a3c = (void *)0x41400000; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x0))) = ZEXT812(0x40800000); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x4))) = 0; - local_a08 = GHIDRA_CAST(BVar35._l); - if ((bVar2 == 0) || (cVar3 = FUN_00758590(), cVar3 != '\0')) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e78)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e78)))) + 0x28))(); - queryList = GHIDRA_CAST(0x0); - goto LAB_00798d8c; - } - } - else { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - local_a14 = GHIDRA_CAST(0x40800000); - } - else { - local_a14 = GHIDRA_CAST(0x41400000); - } - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - auVar30 = ZEXT812(0x3f800000); - } - else { - auVar30 = ZEXT812(0x40000000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x4))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x0))) = auVar30; - local_a38 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar30)) + 0x0))); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetIntervalTicks((float)local_a14,0.0); - if (iVar4 != 0) { - damageAuraCenter.y = (pEVar23->_pos).y; - damageAuraCenter.x = (pEVar23->_pos).x; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(damageAuraQuery),&pEVar23->_pos,90.0,8); - local_14 = 1.26117e-44; - local_a14 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(damageAuraQuery))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar24 = GHIDRA_CAST(*puVar9); - local_a00 = pEVar24; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar2 != 0) && (pEVar24 != pEVar23)) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Position(&damageAuraTargetPos); - local_a0c = GHIDRA_CAST((GHIDRA_CAST((&damageAuraCenter)))->Vector)::Distance(tmpVec); - FUN_00417340(); - local_9fc = GHIDRA_CAST(((float)local_a0c - (float)BVar35._l)); - fVar11 = 0.4; - Config::GetCollectibles(); - iVar4 = EntityPtr::Ref(); - local_9fc = (Entity_Player *) - assert_lerp_range((float)local_9fc,30.0,90.0, - (float)iVar4 * 0.32 + (float)local_a38 * 3.6,fVar11,1); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar24) + 0x20); - (GHIDRA_CAST((&damageAuraSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - BVar35 = (BitSet128)ZEXT416(local_9fc); - (*pcVar1)(); - } - puVar19 = &(*GHIDRA_CAST((GHIDRA_CAST((local_a14)) + 0x1))); - local_a14 = GHIDRA_CAST(puVar19); - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(damageAuraQuery))))->EntityList)::Size(); - } while (puVar19 < puVar10); - } - local_14 = -NAN; - (GHIDRA_CAST((damageAuraQuery)))->EntityList_Query::~EntityList_Query(); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e78)))) == 0) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x7b,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),2,uVar22) - ; - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(pEVar23)); -LAB_00798d8c: - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e78)))))))->EntityPtr::SetReference(queryList); - } - } - iVar4 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(0x2a1); - if (iVar4 == 1) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f04)))) == 0) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0xb9,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),0,uVar22) - ; - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((queryList)))->Entity::AddEntityFlags(0x2000200000); - queryList->Update(); - goto LAB_00798e34; - } - } - else if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f04)))) != 0) && - ((cVar3 = FUN_004173d0(), cVar3 == '\0' || - (iVar4 = (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f04)))))))->Entity_Tear::TearIndex(), iVar4 == 0)))) - { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f04)))) + 0x28))(); - queryList = GHIDRA_CAST(0x0); -LAB_00798e34: - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f04)))))))->EntityPtr::SetReference(queryList); - } - bVar2 = HasCollectible(pEVar23,0x253,0); - if (bVar2 == 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e7c)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e7c)))) + 0x28))(); - queryList = GHIDRA_CAST(0x0); - goto LAB_007994c3; - } - } - else { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::IsFrame(2,0); - if (bVar2 != 0) { - Config::GetCollectibles(); - iVar4 = _get_index_plus_one_if_kind_4_5(); - local_a14 = GHIDRA_CAST(((float)iVar4 * 0.5 + 3.0)); - BVar35 = (BitSet128)ZEXT416(local_a14); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_9fc = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetEntities(); - local_a38 = (void *)0x0; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar24 = GHIDRA_CAST(*puVar9); - local_a00 = pEVar24; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsProjectile(); - if ((((bVar2 == 0) || (cVar3 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsDead(), cVar3 != '\0')) || - (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::EntityCollisionClass(), iVar4 == 0)) || - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::HasEntityFlags(0x80000000), bVar2 != 0)) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (((cVar3 != '\0') && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsTear(), bVar2 != 0)) && - ((cVar3 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsDead(), cVar3 == '\0' && - (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::EntityCollisionClass(), iVar4 != 0)))) { - uVar5 = 0x17; - uVar22 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::InitSeed(); - (GHIDRA_CAST((&tearRng)))->RNG::game_constructor(uVar22,uVar5); - local_14 = 1.54143e-44; - local_a0c = GHIDRA_CAST((GHIDRA_CAST((playerManager)))->RNG)::RandomFloat(); - local_14 = -NAN; - guard_check_icall(); - BVar35._l = (double)(float)local_a0c; - BVar35._h = 0; - if (BVar35._l < 0.15) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Position(&orbitTearPos); - local_a0c = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Distance(&pEVar23->_pos); - BVar35 = (BitSet128)ZEXT416(local_a0c); - if (((float)local_a0c <= 100.0) && (85.0 <= (float)local_a0c)) { - tmpFlags2 = &g_tearFlagNoGridDamage; - tmpFlags = BitSet128::operator_or - (&orbitFlagsBase,&g_tearFlagOrbitAdvanced,&g_tearFlagSpectral - ); - BitSet128::operator_or(&orbitTearFlags,tmpFlags,tmpFlags2); - tmpFlags2 = &g_tearFlagExplosive; - tmpFlags = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Tear::TearFlags(&explosiveCheckFlags); - tmpFlags = BitSet128::operator_and(&explosiveFlagMatch,tmpFlags,tmpFlags2); - bVar2 = (GHIDRA_CAST((tmpFlags)))->BitSet128::IsNonZero(); - if (bVar2 != 0) { - (GHIDRA_CAST((&orbitTearFlags)))->BitSet128::operator__(&g_tearFlagExplosive); - } - tmpFlags2 = &g_tearFlagQuadsplit; - tmpFlags = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Tear::TearFlags(&quadsplitCheckFlags); - tmpFlags = BitSet128::operator_and(&quadsplitFlagMatch,tmpFlags,tmpFlags2); - bVar2 = (GHIDRA_CAST((tmpFlags)))->BitSet128::IsNonZero(); - if (bVar2 != 0) { - (GHIDRA_CAST((&orbitTearFlags)))->BitSet128::operator__(&g_tearFlagQuadsplit); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(orbitTearFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x0))) = (uint32_t)orbitTearFlags._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x0))) = (uint32_t)orbitTearFlags._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(orbitTearFlags._h)) + 0x4))); - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Tear::SetTearFlags(flags_00); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar24) + 0x40); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity_Tear::Scale(); - local_a0c = GHIDRA_CAST((float)(fVar27 * (long double)(float)local_a14)); - (*pcVar1)(); - pEVar24 = local_a00; - (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity_Effect::set_state(1); - minTearHeight = 0xc1a00000; - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Tear::Height(); - orbitTearHeight = (float)fVar27; - pfVar15 = GHIDRA_CAST(std)::max(); - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(*pfVar15)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Projectile::SetHeight(*pfVar15); - FUN_00444c70(); - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Projectile::set_falling_accel(-0.09); - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::SetSpawnerEntity(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - } - } - } - } - else { - uVar5 = 0x17; - uVar22 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::InitSeed(); - (GHIDRA_CAST((&projectileRng)))->RNG::game_constructor(uVar22,uVar5); - local_14 = 1.4013e-44; - local_a0c = GHIDRA_CAST((GHIDRA_CAST((music)))->RNG)::RandomFloat(); - local_14 = -NAN; - guard_check_icall(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x0))) = ZEXT812(0x3ecccccd); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x4))) = 0; - if ((float)local_a0c < (float)BVar35._l) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Position(&capturedProjPos); - local_a0c = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Distance(&pEVar23->_pos); - BVar35 = (BitSet128)ZEXT416(local_a0c); - if (((float)local_a0c <= 100.0) && (85.0 <= (float)local_a0c)) { - local_a0c = GHIDRA_CAST(0x1); - uVar39 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Variant(); - switch(uVar39) { - case 1: - local_a0c = GHIDRA_CAST(&DAT_0000001d); - break; - case 4: - case 6: - local_a0c = GHIDRA_CAST(0x0); - break; - case 7: - local_a0c = GHIDRA_CAST(&DAT_00000014); - break; - case 9: - local_a0c = GHIDRA_CAST(&DAT_0000002a); - } - uVar22 = Random(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Velocity(&capturedProjVel); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::Position(&capturedProjPos2); - pEVar23 = savedPlayer; - local_a30 = (Entity_Player *) - Game::Spawn(g_game,2,GHIDRA_UINT(local_a0c),pVVar14,tmpVec, - GHIDRA_CAST(savedPlayer),0,uVar22); - (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - tmpFlags2 = &g_tearFlagNoGridDamage; - tmpFlags = BitSet128::operator_or - (&capturedFlagsBase,&g_tearFlagOrbitAdvanced, - &g_tearFlagSpectral); - BitSet128::operator_or(&capturedTearFlags,tmpFlags,tmpFlags2); - pEVar24 = local_a00; - projectileFlags = (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity_Projectile::ProjectileFlags() - ; - if ((projectileFlags & 2) != 0) { - (GHIDRA_CAST((&capturedTearFlags)))->BitSet128::operator__(&g_tearFlagExplosive); - } - projectileFlags = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Projectile::ProjectileFlags(); - if ((projectileFlags & 0x10000) != 0) { - (GHIDRA_CAST((&capturedTearFlags)))->BitSet128::operator__(&g_tearFlagQuadsplit); - } - pEVar24 = local_a30; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(capturedTearFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (uint32_t)capturedTearFlags._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (uint32_t)capturedTearFlags._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(capturedTearFlags._h)) + 0x4))); - (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity_Tear::SetTearFlags(flags); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar24) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::GetColor(); - (*pcVar1)(); - pcVar1 = *(code **)(*GHIDRA_CAST(local_a30) + 0x40); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity_Tear::Scale(); - local_a0c = GHIDRA_CAST((float)(fVar27 * (long double)(float)local_a14)); - (*pcVar1)(); - (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity_Effect::set_state(1); - pEVar24 = local_a00; - minTearHeight2 = -20.0; - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity_Tear::Height(); - capturedTearHeight = (float)fVar27; - pfVar15 = GHIDRA_CAST(std)::max(); - (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity_Projectile::SetHeight(*pfVar15); - FUN_00444c70(); - (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity_Projectile::set_falling_accel(-0.09); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_Tear::Scale(); - local_a0c = GHIDRA_CAST((float)fVar27); - BVar35 = (BitSet128)ZEXT416(local_a0c); - FUN_00652ae0(); - FUN_0067af30(); - (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity_Tear::SetScale((float)BVar35._l); - pEVar24->Remove(); - } - } - } - pvVar7 = (void *)(GHIDRA_INT(local_a38) + 1); - local_a38 = pvVar7; - pvVar28 = (void *)(GHIDRA_CAST((GHIDRA_CAST(local_9fc))))->EntityList::Size(); - } while (pvVar7 < pvVar28); - } - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e7c)))) == 0) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x7b,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),5,uVar22) - ; - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(pEVar23)); -LAB_007994c3: - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e7c)))))))->EntityPtr::SetReference(queryList); - } - } - bVar2 = HasCollectible(pEVar23,0x2b8,0); - salvationEffect = GHIDRA_CAST(pEVar23->_salvationEffect); - if (bVar2 == 0) { - if (salvationEffect != GHIDRA_CAST(0x0)) { - (**(code **)(*salvationEffect + 0x28))(); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_salvationEffect))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - else { - local_a0d = 0; - if (salvationEffect == GHIDRA_CAST(0x0)) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x7b,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),6,uVar22) - ; - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_salvationEffect))))->EntityPtr::SetReference(queryList); - local_a0d = 1; - if (pEVar23->_salvationEffect != 0) goto LAB_00799548; - } - else { -LAB_00799548: - get_salvation_scale(); - FUN_00435ed0(); - queryList = GHIDRA_CAST(pEVar23->_salvationEffect); - tmpVec = (GHIDRA_CAST((&salvationOffset)))->Vector::Vector(0.0,-15.0); - (GHIDRA_CAST((queryList)))->Entity::SetPositionOffset(tmpVec); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar23->_salvationEffect))))->Entity)::GetSprite(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::HasEntityFlags(0x4000); - if (bVar2 == 0) { - local_a14 = GHIDRA_CAST(0x0); - } - else { - local_a14 = GHIDRA_CAST(0x3f000000); - } - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::FrameCount(); - fVar11 = (float)(iVar4 % 0x168) + (float)local_a14; - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(fVar11)); - (GHIDRA_CAST((sprite)))->Sprite::SetRotation(fVar11); - } - if (local_a0d != 0) { - (**(code **)(*GHIDRA_CAST(pEVar23->_salvationEffect) + 0xc))(); - } - } - local_a29 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x2c1); - if (local_a29 == 0) { - if (pEVar23->_darkArtsBlastPending != 0) { - pEVar8 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_sprite))))->Sprite)::Color(); - BVar35 = (BitSet128)ZEXT816(0); - goto LAB_00799685; - } - } - else { - if (pEVar23->_darkArtsBlastPending == 0) { - local_a14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_sprite))))->Sprite)::Color(); - fVar11 = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = fVar11 * 0.1 + 0.1; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x4))) = extraout_var_01; - pEVar8 = local_a14; - } - else { - pEVar8 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_sprite))))->Sprite)::Color(); - BVar35 = (BitSet128)ZEXT816(0); - } -LAB_00799685: - Font::SetLineHeightModifier(GHIDRA_CAST(pEVar8),(float)BVar35._l); - FUN_00435d90(); - pvVar28 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::GetNullEffect(0x6f); - if (pvVar28 != (void *)0x0) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) = ((*GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) + 0x1d) / 0x1e) * 0x1e + 1; - } - } - if (((pEVar23->_darkArtsBlastPending != 0) && - (SetMinDamageCooldown(pEVar23,8), pEVar23->_darkArtsBlastPending != 0)) && - ((pEVar23->_darkArtsLastSnare == (void *)0x0 || (cVar3 = (GHIDRA_CAST(()))->Entity::IsDead(), cVar3 != '\0')))) { - pEVar23->_darkArtsBlastPending = 0; - (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_darkArtsLastSnare))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - pEVar23->ResetColor(); - play_sound_with_fart_seed(0x50,1.0,2,0,1.0); - Game::ShakeScreen(g_game,10); - tmpColor = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::MakeGroundPoofAtSelf(tmpColor,0.8); - Game::DamageRadius(&pEVar23->_pos,GHIDRA_CAST(pEVar23),0,0,0,50.0,g_tearFlagsNone, - pEVar23->_darkArtsDamage,80.0); - BVar35 = (BitSet128)ZEXT816(0x3f800000); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar23) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - FUN_00435d90(); - SetMinDamageCooldown(pEVar23,0xf); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddEntityFlags(0x1000000000); - (GHIDRA_CAST((&pEVar23->_darkArtsHitList)))->msvc::vector::clear(0); - pEVar23->_darkArtsDamage = 0.0; - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x80,-1); - } - if (local_a29 == 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))))))->Entity::SetParent(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetCollisionCapsule(darkArtsCapsule,&g_vectorZero); - darkArtsCapsuleSize = darkArtsCapsuleSize + 10.0; - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(darkArtsCapsuleSize)); - if ((pEVar23->_playerType == 0x18) && (bVar2 = HasCollectible(pEVar23,0x26b,0), bVar2 != 0)) { - darkArtsCapsuleSize = darkArtsCapsuleSize + 30.0; - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(darkArtsCapsuleSize)); - local_a0d = 0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))) == 0) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x7b,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),8, - uVar22); - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))))))->EntityPtr::SetReference(queryList); - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(darkArtsCapsuleSize)); - local_a0d = 1; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))) != 0) goto LAB_007999a3; - } - else { -LAB_007999a3: - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = (float)BVar35._l / 120.0; - FUN_00435ed0(); - queryList = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))); - tmpVec = (GHIDRA_CAST((&darkArtsAuraOffset)))->Vector::Vector(0.0,-15.0); - (GHIDRA_CAST((queryList)))->Entity::SetPositionOffset(tmpVec); - } - if (local_a0d != 0) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))) + 0xc))(); - } - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::query_player_capsule_hits - (entityList,GHIDRA_CAST(darkArtsHits),darkArtsCapsule,10); - local_14 = 1.68156e-44; - local_a14 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(darkArtsHits))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar8 = GHIDRA_CAST(*puVar9); - local_a0c = pEVar8; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::IsActiveEnemy(0); - if ((bVar2 == 0) || - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::HasEntityFlags(0x20000000), bVar2 != 0)) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::IsProjectile(); - if (bVar2 != 0) { - projectileFlags = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity_Projectile::ProjectileFlags(); - if ((projectileFlags & 0x80000000) == 0) goto LAB_00799a98; - } - } - else { -LAB_00799a98: - bVar2 = EntityList::HitListContains - (GHIDRA_CAST(&pEVar23->_darkArtsHitList),GHIDRA_CAST(pEVar8)); - if (bVar2 == 0) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::Position(&snareTargetPos); - local_a30 = GHIDRA_CAST(&pEVar23->_pos); - (GHIDRA_CAST((tmpVec)))->Vector::__sub(&snareOffset,GHIDRA_CAST(local_a30)); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))) == 0) { - local_9fc = GHIDRA_CAST((pEVar23->_size + 10.0)); - local_a38 = (void *)(GHIDRA_CAST((&snareOffset)))->Vector::Length(); - } - else { - local_9fc = GHIDRA_CAST((pEVar23->_size + 40.0)); - local_a38 = (void *)(GHIDRA_CAST((&snareOffset)))->Vector::Length(); - } - if ((float)local_9fc < (float)local_a38) { - (GHIDRA_CAST((&snareOffset)))->Vector::Resize((float)local_9fc); - } - (GHIDRA_CAST((&pEVar23->_pos)))->Vector::__add(&snarePos,&snareOffset); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::IsEnemy(); - if (bVar2 != 0) { - queryList = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::GetStatusEffectTarget(); - uVar22 = (GHIDRA_CAST((queryList)))->Entity::GetHitListIndex(); - uVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->Entity::GetHitListIndex(); - if (uVar22 == uVar5) { - local_a0c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_a0c))))->Entity)::GetStatusEffectTarget(); - } - } - FUN_00431620(); - queryList = GHIDRA_CAST(0x0); - iVar4 = Isaac::Random(2); - GetTearHitParams(pEVar23,&TStack_408,1,2.0,iVar4 * 2 + -1,queryList); - uVar22 = Random(); - pEVar24 = (Entity_Player *) - Game::Spawn(g_game,1000,0xc2,&snarePos,&g_vectorZero,GHIDRA_CAST(pEVar23),0, - uVar22); - local_a00 = pEVar24; - if (pEVar23->_darkArtsLastSnare != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((pEVar23->_darkArtsLastSnare)))->Entity::SetChild(GHIDRA_CAST(pEVar24)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::SetParent(pEVar23->_darkArtsLastSnare); - (GHIDRA_CAST((pEVar23->_darkArtsLastSnare)))->Entity::SubType(); - FUN_00435cd0(); - } - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar24) + 0x40); - (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::SubType(); - (*pcVar1)(); - FUN_00665b80(); - pEVar8 = local_a0c; - (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::SetTarget(GHIDRA_CAST(local_a0c)); - local_a00->Update(); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_darkArtsLastSnare))))->EntityPtr::SetReference(GHIDRA_CAST(local_a00)); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::CollisionDamage(); - local_a38 = (void *)(float)fVar27; - pEVar23->_darkArtsDamage = (float)local_a38 + pEVar23->_darkArtsDamage; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_a00))))->Entity::SubType(); - fVar11 = (float)((double)iVar4 + __uint_to_double_fixup[-(iVar4 >> 0x1f)]) * 0.05 + 1.5; - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(fVar11)); - play_sound_with_fart_seed(0x1fb,0.8,1,0,fVar11); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e88)))) != 0) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::Position(&snareTargetPos2); - local_a38 = (void *)(GHIDRA_CAST((tmpVec)))->Vector::Distance(&pEVar23->_pos); - FUN_00417340(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = (float)BVar35._l + pEVar23->_size + 10.0; - if ((float)BVar35._l < (float)local_a38) { - uVar22 = Random(); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xa6,&snarePos,&g_vectorZero,GHIDRA_CAST(pEVar23),0, - uVar22); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetParent(GHIDRA_CAST(pEVar8)); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity)::GetSprite(); - (GHIDRA_CAST((&snareBlackColor)))->Color::Color(0.0,0.0,0.0,1.0); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(color_02); - (GHIDRA_CAST((snareBlendMode)))->BlendMode::SetMode(1,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity)::GetSprite(); - puVar10 = snareBlendMode; - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,puVar10); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity)::GetSprite(); - snareScaleFactor = 2.0; - tmpVec = Vector::operator_mul(&snareScale,&snareScaleFactor,&g_vectorOne); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(tmpVec); - (GHIDRA_CAST((effect)))->Entity_Effect::SetRadii(0.32,0.32); - effect->Update(); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetPosition(GHIDRA_CAST(local_a30)); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity)::GetSprite(); - snareScaleFactor2 = (void *)0x3f800000; - tmpVec = Vector::operator_mul(&snareScale2,GHIDRA_CAST(&snareScaleFactor2),&g_vectorOne) - ; - (GHIDRA_CAST((sprite)))->Sprite::SetScale(tmpVec); - (GHIDRA_CAST((effect)))->Entity_Effect::SetRadii(0.16,0.16); - effect->Update(); - pEVar23 = savedPlayer; - } - } - } - } - puVar19 = &(*GHIDRA_CAST((GHIDRA_CAST((local_a14)) + 0x1))); - local_a14 = GHIDRA_CAST(puVar19); - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(darkArtsHits))))->EntityList)::Size(); - } while (puVar19 < puVar10); - } - local_14 = -NAN; - (GHIDRA_CAST((darkArtsHits)))->EntityList_Query::~EntityList_Query(); - } - pEVar8 = GHIDRA_CAST(&pEVar23->_temporaryeffects); - local_a14 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetNullEffect(0x6f); - if (local_a14 != GHIDRA_CAST(0x0)) { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetIntervalTicks(2.0,0.0); - if (iVar4 != 0) { - if (local_a29 == 0) { - if (pEVar23->_darkArtsBlastPending == 0) { - smokeCountCap = (void *)0x10; - salvationEffect = GHIDRA_CAST(std)::min(); - local_9fc = GHIDRA_CAST(((float)*salvationEffect * 0.0625)); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x4))) = extraout_var_02; - if ((float)BVar35._l < (float)local_9fc + 0.6) { - tmpVec = GHIDRA_CAST(TearsOffset(pEVar23)); - (GHIDRA_CAST((&pEVar23->_pos)))->Vector::__add(&smokeOrigin,tmpVec); - tmpVec = (GHIDRA_CAST((&smokeSpread)))->Vector::Vector(1.0,0.8); - pVVar14 = MusicManager::RandomVector(&smokeRandomDir); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::Mul(&smokeDirScaled,pVVar14); - smokeRandomScale = (void *)random_float(); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&smokeDirRandomized,GHIDRA_CAST(&smokeRandomScale)); - smokeOffsetLength = 16.0; - (GHIDRA_CAST((tmpVec)))->Vector::__mul(&smokeOffset,&smokeOffsetLength); - uVar22 = Random(); - smokeVelFactor = 0.3; - tmpVec = (GHIDRA_CAST((&smokeOffset)))->Vector::__mul(&smokeOffsetVel,&smokeVelFactor); - smokeInheritFactor = 0.5; - pVVar14 = (GHIDRA_CAST((&savedPlayer->_velocity)))->Vector::__mul(&smokeInheritedVel,&smokeInheritFactor); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__add(&smokeVelocity,pVVar14); - pVVar14 = GHIDRA_CAST(TearsOffset(savedPlayer)); - pVVar14 = (GHIDRA_CAST((&savedPlayer->_pos)))->Vector::__add(&smokeSpawnPos,pVVar14); - queryList = Game::Spawn(g_game,1000,0x6f,pVVar14,tmpVec,GHIDRA_CAST(0x0),0,uVar22); - smokeScaleWanted = (float)local_9fc * 1.33 + 0.66; - tmpVec = &g_vectorOne; - smokeScaleMax = 1.0; - pfVar15 = GHIDRA_CAST(std)::min(); - tmpVec = Vector::operator_mul(&smokeScale,pfVar15,tmpVec); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - tmpVec = (GHIDRA_CAST((&smokeHeightOffset)))->Vector::Vector(0.0,-30.0); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__add(&smokePosOffset,&smokeOffset); - (GHIDRA_CAST((queryList)))->Entity::SetPositionOffset(tmpVec); - anm = GHIDRA_CAST((GHIDRA_CAST((queryList)))->Entity)::GetSprite(); - smokeSpeedMax = 1.0; - smokeSpeedWanted = 1.3 - (float)local_9fc * 0.5; - pfVar15 = GHIDRA_CAST(std)::min(); - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(*pfVar15)); - set_PlaybackSpeed(anm,*pfVar15); - (GHIDRA_CAST((smokeColor)))->Color::Color(0.03137255,0.0,0.0,1.0); - queryList->SetColor(); - set_field_358(queryList,-20.0); - queryList->Update(); - pEVar8 = local_a34; - pEVar23 = savedPlayer; - } - } - } - } - if (GHIDRA_INT((GHIDRA_CAST((GHIDRA_INT(local_a14) + 8)))->x) % GHIDRA_INT(local_a1c) == 0) { - TemporaryEffects::RemoveNullEffect - (GHIDRA_CAST(pEVar8),0x6f,GHIDRA_INT(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a14)) + 0x4))))) / 0x1e + 1); - } - } - pvVar28 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetNullEffect(0x72); - if (pvVar28 != (void *)0x0) { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetIntervalTicks(2.0,0.0); - if (iVar4 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x4))) = extraout_var_03; - if ((float)BVar35._l < 1.6) { - tmpVec = GHIDRA_CAST(TearsOffset(pEVar23)); - (GHIDRA_CAST((&pEVar23->_pos)))->Vector::__add(&smoke2Origin,tmpVec); - tmpVec = (GHIDRA_CAST((&smoke2Spread)))->Vector::Vector(1.0,0.8); - pVVar14 = MusicManager::RandomVector(&smoke2RandomDir); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::Mul(&smoke2DirScaled,pVVar14); - smoke2RandomScale = random_float(); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&smoke2DirRandomized,&smoke2RandomScale); - smoke2OffsetLength = 16.0; - (GHIDRA_CAST((tmpVec)))->Vector::__mul(&smoke2Offset,&smoke2OffsetLength); - uVar22 = Random(); - smoke2VelFactor = 0.3; - tmpVec = (GHIDRA_CAST((&smoke2Offset)))->Vector::__mul(&smoke2OffsetVel,&smoke2VelFactor); - smoke2InheritFactor = 0.5; - pVVar14 = (GHIDRA_CAST((&savedPlayer->_velocity)))->Vector::__mul(&smoke2InheritedVel,&smoke2InheritFactor); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__add(&smoke2Velocity,pVVar14); - pVVar14 = GHIDRA_CAST(TearsOffset(savedPlayer)); - pVVar14 = (GHIDRA_CAST((&savedPlayer->_pos)))->Vector::__add(&smoke2SpawnPos,pVVar14); - queryList = Game::Spawn(g_game,1000,0x6f,pVVar14,tmpVec,GHIDRA_CAST(0x0),0,uVar22); - smoke2ScaleWanted = 1.99; - smoke2ScaleMax = 1.0; - tmpVec = &g_vectorOne; - pfVar15 = GHIDRA_CAST(std)::min(); - tmpVec = Vector::operator_mul(&smoke2Scale,pfVar15,tmpVec); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - tmpVec = (GHIDRA_CAST((&smoke2HeightOffset)))->Vector::Vector(0.0,-30.0); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__add(&smoke2PosOffset,&smoke2Offset); - (GHIDRA_CAST((queryList)))->Entity::SetPositionOffset(tmpVec); - anm = GHIDRA_CAST((GHIDRA_CAST((queryList)))->Entity)::GetSprite(); - smoke2SpeedWanted = 0.79999995; - smoke2SpeedMax = 1.0; - pfVar15 = GHIDRA_CAST(std)::min(); - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(*pfVar15)); - set_PlaybackSpeed(anm,*pfVar15); - set_field_358(queryList,-20.0); - queryList->Update(); - pEVar8 = local_a34; - } - } - } - itemConfig = Isaac::GetItemConfig(); - (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x73); - iVar4 = FUN_00930a00(); - pEVar23 = savedPlayer; - if (iVar4 != 0) { - uVar22 = *GHIDRA_CAST((iVar4 + 8)) & 0x80000007; - bVar26 = uVar22 == 0; - if (GHIDRA_INT(uVar22) < 0) { - bVar26 = (uVar22 - 1 | 0xfffffff8) == 0xffffffff; - } - if (bVar26) { - if (GHIDRA_INT(*GHIDRA_CAST((iVar4 + 8))) < 0x3d) { - uVar22 = Random(); - pEVar23 = savedPlayer; - local_a1c = (Entity_Familiar *) - Game::Spawn(g_game,4,9,&savedPlayer->_pos,&g_vectorZero,GHIDRA_CAST(savedPlayer),0, - uVar22); - if (local_a1c != GHIDRA_CAST(0x0)) { - tmpFlags = GetBombFlags(pEVar23,&fartBombFlags,0); - BVar35 = *tmpFlags; - FUN_006a6910(); - } - } - else { - play_sound_with_fart_seed(0x25,1.0,2,0,1.0); - (GHIDRA_CAST((fartColor2)))->Color::Color(); - tmpVec = &pEVar23->_pos; - Game::Fart(g_game,tmpVec,85.0,GHIDRA_CAST(pEVar23),1.0,0,color_03); - Game::ButterBeanFart(g_game,tmpVec,120.0,GHIDRA_CAST(pEVar23),0,0); - uVar22 = Random(); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0x8d,tmpVec,&g_vectorZero,GHIDRA_CAST(pEVar23),1,uVar22); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(-1); - effect->Update(); - pEVar8 = GHIDRA_CAST(&pEVar23->_temporaryeffects); - } - } - } - itemConfig = Isaac::GetItemConfig(); - ItemConfig::GetCollectible(itemConfig,0x271); - local_a1c = GHIDRA_CAST(FUN_00930a00()); - if (local_a1c != GHIDRA_CAST(0x0)) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c8120c) && - (_Init_thread_header(), DAT_00c8120c == -1)) { - local_14 = 1.82169e-44; - BVar35 = (BitSet128)ZEXT816(0x3f800000); - (GHIDRA_CAST(()))->Color::Color(); - local_14 = -NAN; - _Init_thread_footer(); - } - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a1c)) + 0x8)))))->_buf); - if (iVar4 < 0x1f) { - iVar4 = iVar4 % 10; - } - else { - if (iVar4 < 0x5b) { - iVar20 = 0xf; - } - else { - if (0x96 < iVar4) goto LAB_0079a6f8; - iVar20 = 0x1e; - } - iVar4 = iVar4 % iVar20; - } - if (iVar4 == 0) { - pEVar23->SetColor(); - } - } -LAB_0079a6f8: - dashSpeed = 15.0; - if (pEVar23->_ponyCharge < 1) { - if (pEVar23->_suplexState == 1) { - if (8 < pEVar23->_suplexAimCountdown) { - local_a0c = GHIDRA_CAST((pEVar23->_suplexAimCountdown + -8)); - local_a00 = GHIDRA_CAST(0x2c5); - dashSpeed = 12.0; - goto LAB_0079ad8f; - } - } - else { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0x251); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0x2ca); - if (((bVar2 != 0) && (pEVar23->_playerType == 0x23)) && - (iVar4 = GetOtherTwin(pEVar23), iVar4 != 0)) { - local_a00 = GHIDRA_CAST(0x2ca); - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x2ca); - iVar4 = FUN_00930a00(); - local_a0c = GHIDRA_CAST((configItem->maxCooldown - *GHIDRA_CAST((iVar4 + 8)))); - local_a1c = GHIDRA_CAST((GHIDRA_CAST((&pEVar23->_velocity)))->Vector)::LengthSquared(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x0))) = ZEXT812(0x41c80000); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x4))) = 0; - pEVar8 = GHIDRA_CAST(&pEVar23->_temporaryeffects); - if ((float)local_a1c < (float)BVar35._l) { - dashSpeed = 0.0; - } - goto LAB_0079ad8f; - } - } - else if (pEVar23->_marsCooldown == pEVar23->_marsUnk1) { - switch(pEVar23->_marsUnk2) { - case 0: - iVar4 = 0; - break; - case 1: - iVar4 = 2; - break; - case 2: - iVar4 = 1; - break; - case 3: - iVar4 = 3; - break; - default: - iVar4 = -1; - } - Isaac::GetAxisAlignedUnitVectorFromDir(&dashDir,iVar4); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::IsMirrorWorld(); - if (bVar2 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = -dashDir.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x4))) = 0x80000000; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x0))) = 0x80000000; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x4))) = 0x80000000; - dashDir.x = (float)BVar35._l; - } - marsDashSpeed = 4.0; - bVar2 = 0; - tmpVec = Vector::operator_mul(&marsDashVelocity,&marsDashSpeed,&dashDir); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddVelocity(tmpVec,bVar2); - (GHIDRA_CAST((&pEVar23->_contactHitList)))->msvc::vector::clear(0); - play_sound_with_fart_seed(0x77,1.0,2,0,1.0); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x3a); - RemoveCostume(pEVar23,configItem); - } - else { - pvVar28 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::GetCollectibleEffect(0x251); - if ((pvVar28 != (void *)0x0) && - (local_a0c = *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)), 0 < GHIDRA_INT(local_a0c))) { - local_a00 = GHIDRA_CAST(0x251); - dashSpeed = 15.0; - itemConfig = Isaac::GetItemConfig(); - local_a1c = GHIDRA_CAST(ItemConfig)::GetCollectible(itemConfig,0x2c0); - local_a14 = GHIDRA_CAST(FUN_00930a00()); - if ((local_a14 != GHIDRA_CAST(0x0)) && (GHIDRA_INT((GHIDRA_CAST((GHIDRA_INT(local_a14) + 8)))->x) < 4)) { - (GHIDRA_CAST((dashTempEffect)))->TemporaryEffect::TemporaryEffect(GHIDRA_CAST(local_a1c)); - dashTempEffectCooldown = 4 - GHIDRA_INT((GHIDRA_CAST((GHIDRA_INT(local_a14) + 8)))->x); - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::AddEffect(dashTempEffect,0,1); - } - goto LAB_0079ad8f; - } - } - } - (GHIDRA_CAST((&pEVar23->_contactHitList)))->msvc::vector::clear(0); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::ClearEntityFlags(0x4000000); - } - else { - local_a00 = GHIDRA_CAST(0x82); - local_a0c = GHIDRA_CAST((0x3c - pEVar23->_ponyCharge)); -LAB_0079ad8f: - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::HasEntityFlags(0x4000); - if (bVar2 == 0) { - local_a1c = GHIDRA_CAST((GHIDRA_UINT(local_a0c) & 0x80000003)); - if (GHIDRA_INT(local_a1c) < 0) { - local_a1c = GHIDRA_CAST(((GHIDRA_UINT(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_a1c[-1])) + 0xf47)))) | 0xfffffffc) + 1)); - } - if (local_a1c == GHIDRA_CAST(0x0)) { - local_a14 = *GHIDRA_CAST((*GHIDRA_CAST(pEVar23) + 0x3c)); - if (local_a00 != GHIDRA_CAST(0x2ca)) { - (GHIDRA_CAST(()))->Color::Color(); - (*(code *)local_a14)(); - goto LAB_0079aeb9; - } - (GHIDRA_CAST(()))->Color::Color(); - (*(code *)local_a14)(); - } - else { -LAB_0079aeb9: - if ((local_a00 == GHIDRA_CAST(0x82)) && ((GHIDRA_UINT(local_a0c) & 1) == 0)) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0xb5); - if (bVar2 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_a14 = GHIDRA_CAST((GHIDRA_CAST((&pEVar23->_velocity)))->Vector)::Rotated(&ponySideDir,90.0); - if (local_a1c != GHIDRA_CAST(0x0)) { - local_a3c = (void *)0x40800000; - } - fVar11 = random_float(); - beamSideOffset = (fVar11 - 0.5) * (float)local_a3c; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a14))))->Vector::__mul(&beamOffset,&beamSideOffset); - tmpVec = (GHIDRA_CAST((&pEVar23->_pos)))->Vector::__add(&beamPos,tmpVec); - (GHIDRA_CAST((room)))->Room::GetClampedPosition(&clampedBeamPos,tmpVec,10.0); - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x13,&clampedBeamPos,&g_vectorZero,GHIDRA_CAST(pEVar23),2, - uVar22); - pcVar1 = *(code **)(*GHIDRA_CAST(queryList) + 0x40); - fVar27 = (long double)GetTearPoisonDamage(savedPlayer); - local_a1c = GHIDRA_CAST((float)(fVar27 * (long double)4.0 + (long double)10.0)); - (*pcVar1)(); - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__unm(&beamSizeMulti); - (GHIDRA_CAST((queryList)))->Entity::SetSize(64.0,*tmpVec,-1); - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(savedPlayer)); - queryList->Update(); - pEVar23 = savedPlayer; - } - } - } - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(dashSpeed)); - if (0.0 < dashSpeed) { - local_a14 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_a3c = GHIDRA_CAST((GHIDRA_CAST((&pEVar23->_velocity)))->Vector)::Length(); - local_a1c = GHIDRA_CAST((GHIDRA_CAST((&pEVar23->_velocity)))->Vector)::GetAngleDegrees(); - knockbackStrength = 15.0; - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - local_a08 = GHIDRA_CAST(0x40000000); - } - local_9fc = GHIDRA_CAST(((pEVar23->_meleeDamage + 2.0) * (float)local_a08)); - local_a08 = GHIDRA_CAST(0x41c00000); - if (local_a00 == GHIDRA_CAST(0x82)) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - local_a04 = GHIDRA_CAST(0x41a00000); - } - local_9fc = GHIDRA_CAST(((float)local_9fc + (float)local_a04)); - } - else if ((local_a00 == GHIDRA_CAST(0x2ca)) && - (bVar2 = HasCollectible(pEVar23,0x164,0), bVar2 != 0)) { - local_9fc = GHIDRA_CAST(((float)local_9fc + (float)local_9fc)); - local_a08 = GHIDRA_CAST(0x42100000); - } - BVar35 = (BitSet128)ZEXT416(local_a1c); - pEVar16 = local_a1c; - tmpVec = (GHIDRA_CAST((&dashCapsuleSize)))->Vector::Vector((float)local_a3c / 24.0,1.0); - (GHIDRA_CAST((dashCapsule)))->Capsule::constructor(&pEVar23->_pos,tmpVec,(float)pEVar16,(float)local_a08); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius - (entityList,GHIDRA_CAST(dashHits),&pEVar23->_pos,(float)local_a3c * 3.0, - 0xffffffff); - local_14 = 1.96182e-44; - local_a04 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(dashHits))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - local_a30 = GHIDRA_CAST(*puVar9); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::Position(&hitPos); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::Position(&hitPos2); - bVar2 = (GHIDRA_CAST((tmpVec)))->Vector::operator_ne(pVVar14); - if (bVar2 == 0) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::Position(&hitPos3); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::Position(&selfPos); - bVar2 = (GHIDRA_CAST((tmpVec)))->Vector::operator_eq(pVVar14); - pEVar24 = local_a30; - if ((bVar2 == 0) && (FUN_00417340(), 0.0 < (float)BVar35._l)) { - pfVar15 = GHIDRA_CAST(FUN_00417350()); - BVar35 = (BitSet128)ZEXT816(0); - if (0.0 < *pfVar15) { - iVar4 = FUN_00417350(); - BVar35 = (BitSet128)ZEXT816(0); - if ((0.0 < *GHIDRA_CAST((iVar4 + 4))) && - (bVar2 = EntityList::HitListContains - (GHIDRA_CAST(&pEVar23->_contactHitList),GHIDRA_CAST(pEVar24)), - bVar2 == 0)) { - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity)::GetSprite(); - fVar27 = (long double)(GHIDRA_CAST((sprite)))->Sprite::Rotation(); - local_a1c = GHIDRA_CAST((float)fVar27); - tmpVec = GHIDRA_CAST(FUN_00417350()); - FUN_00417340(); - local_a08 = GHIDRA_CAST(BVar35._l); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::Position(&hitCapsulePos); - BVar35 = (BitSet128)ZEXT416(local_a1c); - Capsule::constructor - (hitCapsule,pVVar14,tmpVec,(float)local_a1c,(float)local_a08); - (GHIDRA_CAST((capsuleHitInfo)))->EntityPtr::clear(); - cVar3 = FUN_00440e80(); - pEVar24 = local_a30; - if (cVar3 != '\0') { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::Position(&hitEntityPos); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__sub(&toHitEntity,&pEVar23->_pos); - (GHIDRA_CAST((tmpVec)))->Vector::Normalized(&knockbackDir); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsEnemy(); - if (bVar2 != 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsType(0x21,-1,-1); - if (bVar2 == 0) { - if (local_a00 == GHIDRA_CAST(0x2c5)) { - bVar2 = TryHoldEntity(pEVar23,GHIDRA_CAST(pEVar24)); - if (bVar2 != 0) { - pEVar23->_itemState = 0x2c5; - pEVar23->_suplexAimCountdown = 0x3c; - pEVar23->_suplexState = 2; - play_sound_with_fart_seed(0x407,1.0,2,0,1.0); - fVar11 = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = fVar11 * 0.2 + 0.9; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x4))) = extraout_var_04; - play_sound_with_fart_seed(0xf9,1.0,2,0,(float)BVar35._l); - break; - } - } - else { - cVar3 = pEVar24->IsBoss(); - if (cVar3 == '\0') { - tmpVec = (GHIDRA_CAST((&knockbackDir)))->Vector::__mul(&knockbackVel,&knockbackStrength) - ; - Entity::get_friction(); - bVar2 = 0; - hitFriction = (float)BVar35._l; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__div(&knockbackVelScaled,&hitFriction); - pEVar24 = local_a30; - } - else { - tmpVec = (GHIDRA_CAST((&knockbackDir)))->Vector::__mul(&bossKnockbackVel, - &knockbackStrength); - bVar2 = 0; - bossKnockbackFactor = 0.6; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&bossKnockbackScaled, - &bossKnockbackFactor); - } - (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::AddVelocity(tmpVec,bVar2); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar24) + 0x20); - (GHIDRA_CAST((&dashDamageSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - BVar35 = (BitSet128)ZEXT416(local_9fc); - cVar3 = (*pcVar1)(); - pEVar24 = local_a30; - if ((cVar3 != '\0') && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)) - , bVar2 != 0)) { - play_sound_with_fart_seed(0x4d,1.0,10,0,1.5); - effect = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity_NPC::MakeSplat(1.0); - pcVar1 = *(code **)(*GHIDRA_CAST(effect) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(local_a30))))->Entity::SplatColor(); - (*pcVar1)(); - pEVar23 = savedPlayer; - Entity::ForceCollide(GHIDRA_CAST(savedPlayer),GHIDRA_CAST(local_a30),0); - } - } - } - else { - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar24) + 0x20); - (GHIDRA_CAST((&fireplaceDamageSource)))->EntityRef::constructor(GHIDRA_CAST(pEVar23)); - (*pcVar1)(); - } - } - FUN_00431620(); - } - } - } - } - } - pVVar14 = GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST((local_a04)) + 0x0)))) + 1)); - local_a04 = GHIDRA_CAST(pVVar14); - tmpVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(dashHits))))->EntityList)::Size(); - } while (pVVar14 < tmpVec); - } - local_14 = -NAN; - (GHIDRA_CAST((dashHits)))->EntityList_Query::~EntityList_Query(); - } - } - if (local_a00 == GHIDRA_CAST(0x2ca)) { - if ((pEVar23->_playerType != 0x23) || (iVar4 = GetOtherTwin(pEVar23), iVar4 == 0)) - goto LAB_0079ba07; - queryList = GHIDRA_CAST(GetOtherTwin(pEVar23)); - (GHIDRA_CAST((queryList)))->Entity::Position(&twinPos); - local_a1c = GHIDRA_CAST(assert_lerp_range((float)GHIDRA_INT(local_a0c),0.0,15.0,1.0,16.0,1)); - tmpVec = (GHIDRA_CAST((&twinPos)))->Vector::__sub(&toTwin,&pEVar23->_pos); - BVar35 = (BitSet128)ZEXT416(local_a1c); - bVar2 = 0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::Resized(&twinPullVel,(float)local_a1c); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddVelocity(tmpVec,bVar2); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetIntervalTicks(2.0,0.0); - if (iVar4 == 0) goto LAB_0079ba07; - uVar22 = Random(); - trailVelFactor = 0.5; - tmpVec = (GHIDRA_CAST((&pEVar23->_velocity)))->Vector::__mul(&trailVel,&trailVelFactor); - queryList = Game::Spawn(g_game,1000,0x6f,&pEVar23->_pos,tmpVec,GHIDRA_CAST(pEVar23),0,uVar22); - (GHIDRA_CAST((trailBlendMode)))->BlendMode::SetMode(2,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((queryList)))->Entity)::GetSprite(); - puVar10 = trailBlendMode; - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,puVar10); - pEVar23 = savedPlayer; - tmpVec = (GHIDRA_CAST((&trailHeightOffset)))->Vector::Vector(0.0,-8.0); - tmpVec = (GHIDRA_CAST((&pEVar23->_posOffset)))->Vector::__add(&trailPosOffset,tmpVec); - (GHIDRA_CAST((queryList)))->Entity::SetPositionOffset(tmpVec); - fVar11 = random_float(); - local_a1c = GHIDRA_CAST((fVar11 * 0.7 + 0.3)); - (GHIDRA_CAST((&trailColor)))->Color::Color(0.0,0.0,0.0,1.0); - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(((float)local_a1c * 0.7))); - (GHIDRA_CAST((&trailColor)))->Color::SetOffset((float)local_a1c * 0.4,(float)local_a1c * 0.7,(float)local_a1c); - queryList->SetColor(); - set_field_358(queryList,-5.0); - queryList->Update(); - SetMinDamageCooldown(pEVar23,8); -LAB_0079ba25: - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddEntityFlags(0x1000000000); - } - else { - if (pEVar23->_collidesWithGrid == 0) { - bVar2 = (GHIDRA_CAST((&pEVar23->_velocity)))->Vector::operator_ne(&g_vectorZero); - if ((bVar2 != 0) && (pEVar23->_dead == 0)) { - (GHIDRA_CAST((&pEVar23->_velocity)))->Vector::Normalize(); - (GHIDRA_CAST((&pEVar23->_velocity)))->Vector::operator_mul_assign(&dashSpeed); - } - } - else { - pVVar14 = (GHIDRA_CAST((&pEVar23->_gridCollisionVelocity)))->Vector::Normalized(&gridHitDir); - tmpVec = &pEVar23->_gridCollisionNormal; - local_a1c = GHIDRA_CAST((GHIDRA_CAST((pVVar14)))->Vector)::Dot(tmpVec); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x0))) = ZEXT812(0x3e4ccccd); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x4))) = 0; - if ((float)BVar35._l <= (float)local_a1c) { - if (pEVar23->_suplexState == 1) { - suplexCountdownCap = 1.12104e-44; - salvationEffect = GHIDRA_CAST(std)::min(); - pEVar23->_suplexAimCountdown = *salvationEffect; - } - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x251); - if (bVar2 != 0) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x251,-1); - pEVar23->_marsUnk2 = -1; - dash_impact(pEVar23); - } - pEVar23->_ponyCharge = 0; - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x82,-1); - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0xb5,-1); - Game::ShakeScreen(g_game,8); - bounceStrength = -10.0; - bVar2 = 0; - tmpVec = Vector::operator_mul - (&bounceVelocity,&bounceStrength,&pEVar23->_gridCollisionNormal); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddVelocity(tmpVec,bVar2); - } - else { - reflectDot = (GHIDRA_CAST((&pEVar23->_gridCollisionVelocity)))->Vector::Dot(tmpVec); - reflectDot = reflectDot + reflectDot; - tmpVec = Vector::operator_mul(&reflectNormal,&reflectDot,tmpVec); - tmpVec = (GHIDRA_CAST((&pEVar23->_gridCollisionVelocity)))->Vector::__sub(&reflectedVelocity,tmpVec); - (GHIDRA_CAST((&pEVar23->_velocity)))->Vector::operator_assign(tmpVec); - } - } - local_b3c = 1.4013e-44; - FUN_007dd490(); - FUN_007dc740(); -LAB_0079ba07: - SetMinDamageCooldown(pEVar23,8); - if ((local_a00 != GHIDRA_CAST(0x251)) || (pEVar23->_marsUnkBool == 0)) goto LAB_0079ba25; - } - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddEntityFlags(0x4000000); - pEVar8 = GHIDRA_CAST(&pEVar23->_temporaryeffects); - } - if (0 < pEVar23->_ponyCharge) { - pEVar23->_ponyCharge = pEVar23->_ponyCharge + -1; - } - bVar2 = HasCollectible(pEVar23,0x251,0); - if (((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::HasEntityFlags(0x4000), bVar2 == 0)) && - (-1 < pEVar23->_marsCooldown)) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->TemporaryEffects::HasCollectibleEffect(0x251); - if (bVar2 == 0) { - if (pEVar23->_marsUnkBool == 0) { - pEVar23->_marsUnkBool = 1; - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::ClearEntityFlags(0x1000000000); - SetMinDamageCooldown(pEVar23,0x1e); - } - pEVar23->_marsUnk2 = -1; - } - iVar4 = 1; - bVar2 = HasCollectible(pEVar23,0x82,0); - if ((bVar2 != 0) || (bVar2 = HasCollectible(pEVar23,0xb5,0), bVar2 != 0)) { - iVar4 = 2; - } - minMarsCooldown = -NAN; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c3c)) + 0x10))) = pEVar23->_marsCooldown - iVar4; - salvationEffect = GHIDRA_CAST(std)::max(); - iVar4 = *salvationEffect; - pEVar23->_marsCooldown = iVar4; - if (iVar4 == -1) { - play_sound_with_fart_seed(0xab,1.0,2,0,0.8); - BVar35 = (BitSet128)ZEXT816(0x3f000000); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar23) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - itemConfig = Isaac::GetItemConfig(); - bVar2 = 0; - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x3a); - AddCostume(pEVar23,configItem,bVar2); - } - } - bVar2 = HasCollectible(pEVar23,0x238,0); - if (((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::HasEntityFlags(0x4000), bVar2 == 0)) && - (-1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f9c)))))) { - jupiterCooldownNext = (float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f9c)))) + -1); - jupiterCooldownMin = -NAN; - salvationEffect = GHIDRA_CAST(std)::max(); - iVar4 = *salvationEffect; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f9c)))) = iVar4; - if (iVar4 == -1) { - play_sound_with_fart_seed(0xab,1.0,2,0,0.8); - BVar35 = (BitSet128)ZEXT816(0x3f000000); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar23) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - } - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::HasEntityFlags(0x4000); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar23,0x297,0); - if (bVar2 == 0) { - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ea4))))) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ea4)))) = 0; - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x3b); - if (bVar2 != 0) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x3b,1); - auVar31 = ZEXT812(0x3f000000); - goto LAB_0079bc57; - } - } - } - else { - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ea4)))) + 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ea4)))) = iVar4; - if (((iVar4 == 0x69) || (iVar4 == 0x78)) || (iVar4 == 0x87)) { - local_a1c = GHIDRA_CAST((9 - iVar4 / 0xf)); - if ((GHIDRA_UINT(local_a1c) & 1) == 0) { - fVar11 = 1.7; - } - else { - fVar11 = 1.4; - } - SoundEffects::PlayWithFartOverride(0x1d5,0.8 - (float)GHIDRA_INT(local_a1c) * 0.2,1,0,fVar11); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = SUB128(ZEXT812(0x3f800000),4); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = SUB124(ZEXT812(0x3f800000),0) - (float)GHIDRA_INT(local_a1c) * 0.3; -LAB_0079bc57: - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._h)) + 0x4))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x0))) = auVar31; - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar23) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - } - else if (iVar4 == 0x96) { - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x3b); - if (bVar2 == 0) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x3b,1,1); - BVar35 = (BitSet128)ZEXT816(0x3f000000); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar23) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - play_sound_with_fart_seed(0xcd,1.0,2,0,1.0); - } - } - else if (0xb3 < iVar4) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x3b,1); - BVar35 = (BitSet128)ZEXT816(0x3f000000); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar23) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ea4)))) = 0; - } - } - } - pvVar28 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::GetNullEffect(0x3e); - if ((pvVar28 != (void *)0x0) && (uVar22 = *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)), GHIDRA_INT(uVar22) < 0x5a)) { - if (GHIDRA_INT(uVar22) < 0x20) { - uVar22 = uVar22 & 0x80000007; - if (GHIDRA_INT(uVar22) < 0) { - uVar22 = (uVar22 - 1 | 0xfffffff8) + 1; - } - } - else { - uVar22 = uVar22 & 0x8000000f; - if (GHIDRA_INT(uVar22) < 0) { - uVar22 = (uVar22 - 1 | 0xfffffff0) + 1; - } - uVar22 = GHIDRA_INT(uVar22) / 2; - } - bVar2 = IsNullItemCostumeVisible(pEVar23,0x3e,-1); - if (GHIDRA_INT(uVar22) < 4) { - if (bVar2 != 0) { - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x3e); - RemoveCostume(pEVar23,configItem); - } - } - else if (bVar2 == 0) { - itemConfig = Isaac::GetItemConfig(); - bVar2 = 0; - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x3e); - AddCostume(pEVar23,configItem,bVar2); - } - } - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x42); - if (bVar2 != 0) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - FUN_00417920(); - pEVar24 = GHIDRA_CAST(FUN_0090b0e0()); - if (pEVar24 != pEVar23) goto LAB_0079bd65; - } - Game::Darken(g_game,1.0,0x3c); - } -LAB_0079bd65: - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x45); - if (((bVar2 != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ed8)))) < 0)) && - (bVar2 = CanPickupItem(pEVar23), bVar2 != 0)) { - FlushQueueItem(pEVar23); - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x45,1); - Game::GetItemPool(g_game); - rngPtr = GHIDRA_CAST(rng_vector_at()); - uVar22 = (GHIDRA_CAST((rngPtr)))->RNG::Next(); - iVar4 = ItemPool::GetPill(uVar22); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ed8)))) = iVar4; - AnimatePill(pEVar23,iVar4,GHIDRA_CAST("UseItem")); - play_sound_with_fart_seed(0xfc,1.0,2,0,1.0); - } - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x7a); - if (((bVar2 != 0) && (bVar2 = CanPickupItem(pEVar23), bVar2 != 0)) && - (bVar2 = IsHoldingItem(pEVar23), bVar2 == 0)) { - FlushQueueItem(pEVar23); - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x7a,1); - rngPtr = GHIDRA_CAST(rng_vector_at()); - local_a1c = GHIDRA_CAST(rngPtr); - FUN_00424510(); - local_14 = 2.10195e-44; - bVar2 = Game::IsGreedMode(g_game); - if (bVar2 == 0) { - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,0,100,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,1,0x1e,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,2,0x1e,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,3,10,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,4,10,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,5,2,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,0x1a,2,0); - iVar4 = 0xc; - } - else { - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,0x10,100,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,0x12,0x32,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,0x11,0x1e,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,0x13,10,0); - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,0x14,10,0); - iVar4 = 0x1a; - } - iVar20 = 0; - uVar38 = 2; - uVar39 = 0x79bf5d; - WeightedOutcomePicker::AddOutcomeWeight(poolPicker,iVar4,2,0); - uVar5 = 0x23; - uVar22 = (GHIDRA_CAST((rngPtr)))->RNG::Next(); - (GHIDRA_CAST((GHIDRA_CAST((aCStackY_2e04[0x81]._colorize + 3)))))->RNG::game_constructor(uVar22,uVar5); - rng._shift1 = iVar4; - rng._seed = uVar39; - rng._shift2 = uVar38; - rng._shift3 = iVar20; - uVar22 = (GHIDRA_CAST((poolPicker)))->WeightedOutcomePicker::PickOutcome(rng); - Isaac::GetItemConfig(); - FUN_00730de0(); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - uVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_a1c))))->RNG::Next(); - local_a1c = GHIDRA_CAST(ItemPool)::GetCollectible(itemPool,uVar22,uVar5,0,8,0); - Isaac::GetItemConfig(); - FUN_00730e20(); - pEVar23 = savedPlayer; - queryList = GHIDRA_CAST(AddItemWisp()); - fVar27 = (long double)(GHIDRA_CAST((queryList)))->Entity::HitPoints(); - (GHIDRA_CAST((queryList)))->Entity::SetField380((float)(fVar27 * (long double)4.0)); - itemConfig = Isaac::GetItemConfig(); - pEVar16 = local_a1c; - local_a1c = GHIDRA_CAST(ItemConfig)::GetCollectible(itemConfig,GHIDRA_INT(local_a1c)); - if (local_a1c != GHIDRA_CAST(0x0)) { - hud = GHIDRA_CAST(Game)::GetHUD(g_game); - HUD::ShowItemText(hud,pEVar23,GHIDRA_CAST(local_a1c)); - } - AnimateCollectible(pEVar23,GHIDRA_INT(pEVar16),GHIDRA_CAST("UseItem"),GHIDRA_CAST("PlayerPickupSparkle")); - SoundEffects::PlayWithFartOverride(0x13c,1.0,2,0,1.0); - local_14 = -NAN; - msvc::vector::_Tidy(); - } - if (-1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ed8))))) { - FUN_00420ae0(); - cVar3 = FUN_0082ee30(); - if (((cVar3 == '\0') && (bVar2 = AreControlsEnabled(pEVar23), bVar2 != 0)) && - (bVar2 = ANM2::IsPlaying(&pEVar23->_bodySprite,GHIDRA_CAST("UseItem")), bVar2 == 0)) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(local_cd4),3,-1,-1,1,0); - local_14 = 2.24208e-44; - uVar22 = 0; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_cd4))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - local_a1c = GHIDRA_CAST(*puVar9); - pEVar24 = GHIDRA_CAST((GHIDRA_CAST((local_a1c)))->Entity_Familiar)::Player(); - if (pEVar24 == pEVar23) { - (GHIDRA_CAST((local_a1c)))->Entity_Familiar::farting_baby_fart(); - } - uVar22 = uVar22 + 1; - uVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_cd4))))->EntityList::Size(); - } while (uVar22 < uVar5); - } - persistentData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::IncreaseEventCounter(persistentData,6,1); - persistentData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::AddToCollection(persistentData,0x2b); - uVar22 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ed8)))); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - iVar4 = ItemPool::GetPillEffect(itemPool,uVar22,pEVar23); - UsePill(pEVar23,iVar4,uVar22,0x100); - if (pEVar23->_cacheFlags != 0) { - InvalidateCoPlayerItems(pEVar23); - EvaluateItems(pEVar23); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ed8)))) = 0xffffffff; - local_14 = -NAN; - (GHIDRA_CAST((local_cd4)))->EntityList_Query::~EntityList_Query(); - } - } - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x46); - if ((bVar2 != 0) && (bVar2 = IsExtraAnimationFinished(pEVar23), bVar2 != 0)) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x46,1); - } - bVar2 = HasCollectible(pEVar23,0x287,0); - if (bVar2 != 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ec8)))) < 1) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00428a60(); - FUN_007537b0(); - } - else { - BVar35 = (BitSet128) - ZEXT416(GHIDRA_UINT((float)((double)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) + - __uint_to_double_fixup - [-(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) >> 0x1f)]))); - } - local_a04 = GHIDRA_CAST(BVar35._l); - if (0.0 < (float)local_a04) { - damage_charge_scale(); - chargeLeft = (float)BVar35._l * (float)local_a04; - pAVar25 = pEVar23->_activeDesc; - local_a00 = GHIDRA_CAST(0x0); - do { - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(chargeLeft)); - if (chargeLeft <= 0.0) break; - if (pAVar25->_item != 0) { - itemConfig = Isaac::GetItemConfig(); - ItemConfig::GetCollectible(itemConfig,pAVar25->_item); - local_a04 = GHIDRA_CAST(GetActiveMaxCharge(pEVar23,GHIDRA_INT(local_a00))); - iVar4 = GetActiveMaxCharge(pEVar23,GHIDRA_INT(local_a00)); - if ((iVar4 == 0) && - ((pAVar25->_charge < GHIDRA_INT(local_a04) || - ((bVar2 = HasCollectible(pEVar23,0x3f,0), bVar2 != 0 && - (pAVar25->_batteryCharge < GHIDRA_INT(local_a04))))))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_b94)) + 0x10))) = 1.0 - (float)pAVar25->_partialCharge; - partialChargeMin = 0.0; - msvc::max(); - pfVar15 = GHIDRA_CAST(std)::min(); - chargeLeft = chargeLeft - *pfVar15; - BVar35 = (BitSet128)ZEXT416(GHIDRA_UINT(chargeLeft)); - pAVar25->_partialCharge = GHIDRA_INT((*pfVar15 + (float)pAVar25->_partialCharge)); - } - } - local_a00 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a00)) + 0x1)))); - pAVar25 = pAVar25 + 1; - } while (local_a00 < &DAT_00000004); - } - } - else { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetHitPointsLost(); - voltCooldownLeft = (float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ec8)))) - iVar4); - voltCooldownMin = 0.0; - puVar9 = GHIDRA_CAST(std)::max(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1ec8)))) = *puVar9; - } - } - bVar2 = HasCollectible(pEVar23,0x2c0,0); - if (((bVar2 != 0) || (pEVar23->_playerType == 0x1b)) && - (bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x2c0), bVar2 == 0) - ) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00428a60(); - FUN_007537b0(); - } - else { - BVar35 = (BitSet128) - ZEXT416(GHIDRA_UINT((float)((double)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) + - __uint_to_double_fixup - [-(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) >> 0x1f)]))); - } - local_a04 = GHIDRA_CAST(BVar35._l); - if (0.0 < (float)local_a04) { - itemConfig = Isaac::GetItemConfig(); - ItemConfig::GetCollectible(itemConfig,0x2c0); - damage_charge_scale(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = (float)BVar35._l * (float)local_a04 * 50000.0; - iVar4 = GHIDRA_INT((float)BVar35._l); - if (pEVar23->_playerType == 0x1b) { - add_samson_berserk_charge(pEVar23,iVar4); - } - local_a08 = GHIDRA_CAST(pEVar23->_activeDesc); - local_a04 = GHIDRA_CAST(0x0); - do { - if (iVar4 < 1) break; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a08)) + 0x0)))) == 0x2c0) { - iVar20 = AddActiveCharge(pEVar23,iVar4,GHIDRA_INT(local_a04),0,0,1); - iVar4 = iVar4 - iVar20; - } - local_a04 = GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(local_a04))->x) + 1)); - local_a08 = GHIDRA_CAST((GHIDRA_INT(local_a08) + 0x20)); - } while (local_a04 < GHIDRA_CAST(&DAT_00000004)); - } - } - if (pEVar23->_playerType == 0x19) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00428a60(); - FUN_007537b0(); - } - else { - BVar35 = (BitSet128) - ZEXT416(GHIDRA_UINT((float)((double)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) + - __uint_to_double_fixup - [-(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) >> 0x1f)]))); - } - local_a04 = GHIDRA_CAST(BVar35._l); - if (0.0 < (float)local_a04) { - damage_charge_scale(); - fVar11 = (float)BVar35._l * (float)local_a04 * 1.5 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f74)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f74)))) = fVar11; - if (1.0 <= fVar11) { - pEVar16 = GHIDRA_CAST(GHIDRA_INT(fVar11)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f74)))) = fVar11 - (float)GHIDRA_INT(pEVar16); - local_a1c = pEVar16; - if (0 < GHIDRA_INT(pEVar16)) { - local_a04 = GHIDRA_CAST(&pEVar23->_pos); - do { - uVar22 = Random(); - tmpVec = GHIDRA_CAST(FUN_0058e240()); - queryList = Game::Spawn(g_game,5,0x2a,GHIDRA_CAST(local_a04),tmpVec,GHIDRA_CAST(0x0),0,uVar22); - queryList->Update(); - pEVar16 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar16[-1])) + 0xf47)))); - } while (pEVar16 != GHIDRA_CAST(0x0)); - pEVar23 = savedPlayer; - } - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x22,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(0x0),10,uVar22); - pcVar1 = *(code **)(*GHIDRA_CAST(queryList) + 0x3c); - (GHIDRA_CAST((poofColor)))->Color::Color(); - (*pcVar1)(); - poofScaleFactor = 0.5; - tmpVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(poofScale,&poofScaleFactor); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - fVar11 = random_float(); - pEVar23 = savedPlayer; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35._l)) + 0x0))) = fVar11 * 0.2 + 1.8; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar35)) + 0x4))) = extraout_var_05; - play_sound_with_fart_seed(0x25,0.8,2,0,(float)BVar35._l); - } - } - } - bVar2 = HasCollectible(pEVar23,0x2d5,0); - if (bVar2 != 0) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_00428a60(); - FUN_007537b0(); - local_a04 = GHIDRA_CAST(BVar35._l); - } - else { - local_a04 = (Entity_NPC *) - (float)((double)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) + - __uint_to_double_fixup[-(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x16b8)))) >> 0x1f)]); - } - if (0.0 < (float)local_a04) { - damage_charge_scale(); - FUN_007d9360(); - } - } - fVar11 = pEVar23->_ibsCharge; - BVar36 = (BitSet128)ZEXT416(GHIDRA_UINT(fVar11)); - if (fVar11 < 0.0) { - ibsChargeNext = fVar11 + 0.016666668; - BVar36 = (BitSet128)ZEXT416(GHIDRA_UINT(ibsChargeNext)); - ibsChargeMax = 0.0; - pfVar15 = GHIDRA_CAST(std)::min(); - pEVar23->_ibsCharge = *pfVar15; - } - tempEffects = &pEVar23->_temporaryeffects; - local_a04 = GHIDRA_CAST((GHIDRA_CAST((tempEffects)))->TemporaryEffects)::GetCollectibleEffectNum(699); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if ((iVar4 == 3) || (local_a04 == GHIDRA_CAST(&DAT_00000005))) { - bVar2 = HasCollectible(pEVar23,699,0); - if (bVar2 == 0) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveCollectibleEffect(699,-1); - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,699); - RemoveCostume(pEVar23,configItem); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x60); - RemoveCostume(pEVar23,configItem); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x61); - RemoveCostume(pEVar23,configItem); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x62); - RemoveCostume(pEVar23,configItem); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(99); - RemoveCostume(pEVar23,configItem); - } - else { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_a0d = (GHIDRA_CAST((room)))->Room::IsClear(); - pGVar12 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((pGVar12)))->GridEntity::GetVariant(); - if (iVar4 == 0xb) { -LAB_0079c87f: - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::IsAmbushDone(); - } - else { - pGVar12 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((pGVar12)))->GridEntity::GetVariant(); - if (iVar4 == 0x11) goto LAB_0079c87f; - bVar2 = local_a0d; - } - if ((bVar2 == 0) && - ((local_a04 == GHIDRA_CAST(&DAT_00000004) || (local_a04 == GHIDRA_CAST(&DAT_00000005))))) - { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddCollectibleEffect(699,0,6 - GHIDRA_INT(local_a04)); - queryList = GHIDRA_CAST(0x0); - iVar4 = Isaac::Random(2); - GetTearHitParams(pEVar23,aTStack_8c0,3,1.5,iVar4 * 2 + -1,queryList); - Isaac::GetAxisAlignedUnitVectorFromDir(&rageDir,pEVar23->_headDirection); - bVar2 = (GHIDRA_CAST((&pEVar23->_aimDirection)))->Vector::operator_ne(&g_vectorZero); - if (bVar2 != 0) { - (GHIDRA_CAST((&rageDir)))->Vector::operator_assign(&pEVar23->_aimDirection); - } - local_a1c = GHIDRA_CAST((GHIDRA_CAST((&rageDir)))->Vector)::GetAngleDegrees(); - bVar2 = 0; - pEVar24 = pEVar23; - tmpVec = (GHIDRA_CAST((&rageLaserOffset)))->Vector::Vector(0.0,-30.0); - laser = Entity_Laser::ShootAngle - (0xb,&pEVar23->_pos,(float)local_a1c,0x5a,tmpVec,GHIDRA_CAST(pEVar24),bVar2); - laser->SetCollisionDamage(); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f00)))))))->EntityPtr::SetReference(GHIDRA_CAST(laser)); - tmpFlags = (GHIDRA_CAST((&g_tearFlagWait)))->BitSet128::__bnot(¬WaitFlags); - tmpFlags = BitSet128::operator_and(&rageLaserFlags,&aTStack_8c0[0]._flags,tmpFlags); - BVar36 = *tmpFlags; - FUN_00456830(); - laser->SetColor(); - laser->Update(); - itemConfig = Isaac::GetItemConfig(); - bVar2 = 0; - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(99); - AddCostume(pEVar23,configItem,bVar2); - (GHIDRA_CAST((headDownShoot)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadDownShoot")); - local_14 = 2.38221e-44; - (GHIDRA_CAST((headRightShoot)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadRightShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x12; - (GHIDRA_CAST((headUpShoot)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadUpShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x13; - (GHIDRA_CAST((headLeftShoot)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadLeftShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x14; - direction.y = rageDir.y; - direction.x = rageDir.x; - animName = string_from_direction - (rageHeadAnim,direction,headLeftShoot,headUpShoot,headRightShoot, - headDownShoot); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),0x15); - play_null_costume_anim(pEVar23,99,0,animName,-1,0); - (GHIDRA_CAST((rageHeadAnim)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((headLeftShoot)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((headUpShoot)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((headRightShoot)))->msvc::string::_Tidy_deallocate(); - local_14 = -NAN; - (GHIDRA_CAST((headDownShoot)))->msvc::string::_Tidy_deallocate(); - } - } - } - bVar2 = HasCollectible(pEVar23,0x26b,0); - if (bVar2 != 0) { - if (pEVar23->_playerType == 5) { - cVar3 = IsCoopGhost(pEVar23); - if (((cVar3 == '\0') && (bVar2 = HasCollectible(pEVar23,0x75,0), bVar2 != 0)) && - (bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x75), - bVar2 == 0)) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x75,1,1); - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x75); - RemoveCostume(pEVar23,configItem); - } - } - else if (pEVar23->_playerType == 0x21) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - local_a1c = GHIDRA_CAST(&pEVar23->_pos); - EntityList::QueryRadius(entityList,GHIDRA_CAST(coinQuery),GHIDRA_CAST(local_a1c),80.0,0x10); - local_14 = 3.08286e-44; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(coinQuery))))->EntityList::Size(); - if (iVar4 != 0) { - uVar22 = 0; - do { - msvc::vector::operator_index(); - pickup = GHIDRA_CAST(FUN_00435e30()); - if (((pickup != GHIDRA_CAST(0x0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pickup))))->Entity::IsType(5,0x14,-1), bVar2 != 0)) && - ((iVar4 = (GHIDRA_CAST((pickup)))->Entity_Pickup::Timeout(), 0 < iVar4 && - (cVar3 = (GHIDRA_CAST((GHIDRA_CAST(pickup))))->Entity::IsDead(), cVar3 == '\0')))) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pickup))))->Entity::Position(&coinPos); - (GHIDRA_CAST((GHIDRA_CAST(local_a1c))))->Vector::__sub(GHIDRA_CAST((local_c84 + 0x10)),tmpVec); - local_a04 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((local_c84 + 0x10)))))->Vector)::LengthSquared(); - BVar36 = (BitSet128)ZEXT416(local_a04); - if (16.0 < (float)local_a04) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST((local_c84 + 0x10)))))->Vector::Resized(&coinPullVel,10.0); - (GHIDRA_CAST((GHIDRA_CAST(pickup))))->Entity::SetVelocity(tmpVec); - FUN_0044bfa0(); - } - } - uVar22 = uVar22 + 1; - uVar5 = (GHIDRA_CAST((GHIDRA_CAST(coinQuery))))->EntityList::Size(); - } while (uVar22 < uVar5); - pEVar23 = savedPlayer; - } - local_14 = -NAN; - (GHIDRA_CAST((coinQuery)))->EntityList_Query::~EntityList_Query(); - } - } - bVar2 = HasCollectible(pEVar23,0x75,0); - if ((((bVar2 != 0) && ((pEVar23->_playerType == 10 || (pEVar23->_playerType == 0x1f)))) && - (cVar3 = IsCoopGhost(pEVar23), cVar3 == '\0')) && - (bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x75), bVar2 == 0)) - { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x75,1,1); - } - pvVar28 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x2c9); - if (pvVar28 != (void *)0x0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(familiarQuery),3,0xee,-1,1,0); - local_14 = 3.22299e-44; - local_a04 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(familiarQuery))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar16 = GHIDRA_CAST(*puVar9); - pEVar24 = GHIDRA_CAST((GHIDRA_CAST((pEVar16)))->Entity_Familiar)::Player(); - if (((pEVar24 == pEVar23) && (iVar4 = FUN_0060d110(), iVar4 == 0)) && - (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar16))))->Entity::SubType(), iVar4 != 7)) { - FUN_00436200(); - bVar2 = HasCollectible(pEVar23,0x248,0); - if (bVar2 != 0) { - AddWisp(pEVar23,0x2c9,&pEVar23->_pos,0,0); - } - goto LAB_0079ce72; - } - puVar19 = &(*GHIDRA_CAST((GHIDRA_CAST((local_a04)) + 0x1))); - local_a04 = GHIDRA_CAST(puVar19); - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(familiarQuery))))->EntityList)::Size(); - } while (puVar19 < puVar10); - } - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x2c9,-1); -LAB_0079ce72: - local_14 = -NAN; - (GHIDRA_CAST((familiarQuery)))->EntityList_Query::~EntityList_Query(); - } - bVar2 = HasCollectible(pEVar23,0x27a,0); - if ((bVar2 != 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::IsFrame(0x1e,0), bVar2 != 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar2 = (GHIDRA_CAST((room)))->Room::IsClear(); - if (bVar2 != 0) { - Game::GetAmbush(g_game); - cVar3 = FUN_005cd630(); - if (cVar3 == '\0') goto LAB_0079cfcb; - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(riftQuery),1000,0xbd,0,0,0); - local_14 = 3.36312e-44; - uVar22 = 0; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(riftQuery))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar24 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity)::SpawnerEntity(); - if (pEVar24 == pEVar23) goto LAB_0079cfb9; - uVar22 = uVar22 + 1; - uVar5 = (GHIDRA_CAST((GHIDRA_CAST(riftQuery))))->EntityList::Size(); - } while (uVar22 < uVar5); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_random_pickup_position(room,&riftSpawnPos,1,0); - rngPtr = GHIDRA_CAST(rng_vector_at()); - uVar22 = (GHIDRA_CAST((rngPtr)))->RNG::Next(); - queryList = Game::Spawn(g_game,1000,0xbd,&riftSpawnPos,&g_vectorZero,GHIDRA_CAST(pEVar23),0,uVar22); - queryList->Update(); -LAB_0079cfb9: - local_14 = -NAN; - (GHIDRA_CAST((riftQuery)))->EntityList_Query::~EntityList_Query(); - } -LAB_0079cfcb: - bVar2 = HasCollectible(pEVar23,0x114,0); - if (bVar2 != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = (GHIDRA_CAST((room)))->Room::GetEntities(); - (GHIDRA_CAST((GHIDRA_CAST(local_c84))))->EntityList_EL::constructor(GHIDRA_CAST(entityList)); - local_14 = 3.50325e-44; - local_a08 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_c84))))->EntityList::Size(); - if (iVar4 != 0) { - do { - msvc::vector::operator_index(); - local_a04 = GHIDRA_CAST(FUN_004aad40()); - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - queryList = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity)::to_npc_or_coop_player(); - pEVar18 = local_a04; - if (local_a04 == GHIDRA_CAST(0x0)) { - if (queryList != GHIDRA_CAST(0x0)) { - FUN_00417340(); - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar36._l)) + 0x0))) = (float)BVar36._l + pEVar23->_size + 8.0; - pushRadius = (float)BVar36._l; - iVar4 = (GHIDRA_CAST((queryList)))->Entity::EntityCollisionClass(); - if (iVar4 != 0) { - tmpVec = (GHIDRA_CAST((queryList)))->Entity::Position(&heartPushPosX); - BVar36 = (BitSet128)ZEXT416(GHIDRA_UINT((tmpVec->x - (pEVar23->_pos).x))); - Math::abs(); - if ((float)BVar36._l < pushRadius) { - tmpVec = (GHIDRA_CAST((queryList)))->Entity::Position(&heartPushPosY); - BVar36 = (BitSet128)ZEXT416(GHIDRA_UINT((tmpVec->y - (pEVar23->_pos).y))); - Math::abs(); - if ((float)BVar36._l < pushRadius) { - tmpVec = (GHIDRA_CAST((queryList)))->Entity::Position(&heartPushPos); - (GHIDRA_CAST((tmpVec)))->Vector::__sub(&pushDir,&pEVar23->_pos); - local_a1c = GHIDRA_CAST((GHIDRA_CAST((&pushDir)))->Vector)::Length(); - BVar36 = (BitSet128)ZEXT416(GHIDRA_UINT(pushRadius)); - if (((float)local_a1c < pushRadius) && (0.0 < (float)local_a1c)) { - (GHIDRA_CAST((&pushDir)))->Vector::__div_assign(&pushRadius); - tmpVec = (GHIDRA_CAST((queryList)))->Entity::Velocity(&heartPushVel); - local_a1c = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Dot(&pushDir); - BVar36 = (BitSet128)ZEXT416(local_a1c); - if ((float)local_a1c < 0.0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar36._l)) + 0x0))) = -(float)local_a1c; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar36._l)) + 0x4))) = 0x80000000; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar36._h)) + 0x0))) = 0x80000000; - (*GHIDRA_CAST((GHIDRA_CAST(&(BVar36._h)) + 0x4))) = 0x80000000; - bVar2 = 0; - pushStrength = (float)BVar36._l; - tmpVec = Vector::operator_mul(&pushVelocity,&pushStrength,&pushDir); - (GHIDRA_CAST((queryList)))->Entity::AddVelocity_divided(tmpVec,bVar2); - } - } - } - } - } - } - } - else { - FUN_00417340(); - local_a34 = GHIDRA_CAST(((float)BVar36._l + pEVar23->_size + 20.0)); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity_Tear::Height(); - local_a1c = GHIDRA_CAST((float)fVar27); - BVar36 = (BitSet128)ZEXT416(local_a1c); - if (-90.0 < (float)local_a1c) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::Position(&heartProjPosX); - BVar36 = (BitSet128)ZEXT416(GHIDRA_UINT((tmpVec->x - (pEVar23->_pos).x))); - Math::abs(); - if ((float)BVar36._l < (float)local_a34) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::Position(&heartProjPosY); - BVar36 = (BitSet128)ZEXT416(GHIDRA_UINT((tmpVec->y - (pEVar23->_pos).y))); - Math::abs(); - if ((float)BVar36._l < (float)local_a34) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::Position(&heartProjPos); - local_a1c = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Distance(&pEVar23->_pos); - BVar36 = (BitSet128)ZEXT416(local_a34); - if ((float)local_a1c < (float)local_a34) { - (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::Die(); - } - } - } - } - } - pAVar25 = GHIDRA_CAST((GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST((local_a08)) + 0x0)))) + 1)); - local_a08 = GHIDRA_CAST(pAVar25); - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_c84))))->EntityList)::Size(); - } while (pAVar25 < puVar10); - } - local_14 = -NAN; - (GHIDRA_CAST((local_c84)))->EntityList_Query::~EntityList_Query(); - } - bVar2 = HasTrinket(pEVar23,0x7d,0); - if (bVar2 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(local_c3c),3,-1,-1,0,0); - local_14 = 3.64338e-44; - FUN_00424510(); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),0x1b); - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - (GHIDRA_CAST((GHIDRA_CAST(local_c3c))))->EntityList::Size(); - Game::GetNumPlayers(g_game); - FUN_0042c820(); - fVar11 = 0.0; - local_a04 = GHIDRA_CAST(0x0); - iVar4 = Game::GetNumPlayers(g_game); - if (iVar4 != 0) { - do { - pEVar24 = Game::GetPlayer(g_game,GHIDRA_UINT(fVar11)); - if (((pEVar24 != pEVar23) && (cVar3 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::IsDead(), cVar3 == '\0')) - && (cVar3 = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Visible(), cVar3 != '\0')) { - cordPlayer = pEVar24; - msvc::vector::push_back(); - } - fVar11 = (float)(GHIDRA_INT(local_a04) + 1); - local_a04 = GHIDRA_CAST(fVar11); - fVar17 = (float)Game::GetNumPlayers(g_game); - } while (GHIDRA_UINT(fVar11) < GHIDRA_UINT(fVar17)); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_c3c))))->EntityList::Size(); - FUN_0042c820(); - } - local_a04 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_c3c))))->EntityList::Size(); - if (iVar4 != 0) { - do { - msvc::vector::operator_index(); - queryList = GHIDRA_CAST(FUN_00435de0()); - if (((queryList != GHIDRA_CAST(0x0)) && (cVar3 = FUN_00753d20(), cVar3 == '\0')) && - (cVar3 = (GHIDRA_CAST((queryList)))->Entity::Visible(), cVar3 != '\0')) { - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if ((cVar3 == '\0') || - (bVar2 = (GHIDRA_CAST((queryList)))->Entity::IsDescendantOf(GHIDRA_CAST(pEVar23)), bVar2 != 0)) { - cordFamiliar = queryList; - msvc::vector::push_back(); - } - } - puVar19 = &(*GHIDRA_CAST((GHIDRA_CAST((local_a04)) + 0x1))); - local_a04 = GHIDRA_CAST(puVar19); - puVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_c3c))))->EntityList)::Size(); - } while (puVar19 < puVar10); - } - iVar4 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(); - if (iVar4 != 0) { - iVar4 = 2; - iVar20 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(); - if (iVar20 == 1) { - iVar4 = 0x3c; - } - else { - iVar20 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(); - if (iVar20 == 2) { - iVar4 = 10; - } - else { - uVar22 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(); - if ((2 < uVar22) && (uVar22 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(), uVar22 < 9)) { - iVar4 = 4; - } - } - } - iVar20 = Game::GetFrameCount(g_game); - if (iVar20 % iVar4 == 0) { - if (pEVar23->_extensionCordIndex == -1) { -LAB_0079d585: - iVar4 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(); - iVar4 = iVar4 + -1; - pEVar23->_extensionCordIndex = iVar4; - } - else { - iVar4 = pEVar23->_extensionCordIndex; - iVar20 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(); - if (iVar20 <= iVar4) goto LAB_0079d585; - } - if (-1 < iVar4) { - puVar9 = GHIDRA_CAST(FUN_0042c810()); - (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Position(GHIDRA_CAST((local_adc + 0x10))); - cordEnd.x = (pEVar23->_pos).x; - cordEnd.y = (pEVar23->_pos).y; - if (0 < pEVar23->_extensionCordIndex) { - puVar9 = GHIDRA_CAST(FUN_0042c810()); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Position(&prevCordPos); - (GHIDRA_CAST((&cordEnd)))->Vector::operator_assign(tmpVec); - } - local_a1c = (Entity_Familiar *) - (GHIDRA_CAST((GHIDRA_CAST((local_adc + 0x10)))))->Vector::DistanceSquared(&cordEnd); - if (400.0 < (float)local_a1c) { - iVar4 = GetTrinketMultiplier(pEVar23,0x7d); - local_a04 = GHIDRA_CAST(((float)iVar4 * 6.0)); - puVar9 = GHIDRA_CAST(FUN_0042c810()); - queryList = GHIDRA_CAST(*puVar9); - tmpVec = (GHIDRA_CAST((&cordLaserOffset)))->Vector::Vector(0.0,-20.0); - pVVar14 = (GHIDRA_CAST((&cordEnd)))->Vector::__sub(&cordDelta,GHIDRA_CAST((local_adc + 0x10))); - local_a1c = GHIDRA_CAST((GHIDRA_CAST((pVVar14)))->Vector)::GetAngleDegrees(); - laser = Entity_Laser::ShootAngle - (2,GHIDRA_CAST((local_adc + 0x10)),(float)local_a1c,3,tmpVec,queryList,0); - FUN_00435cd0(); - fVar11 = (GHIDRA_CAST((GHIDRA_CAST((local_adc + 0x10)))))->Vector::Distance(&cordEnd); - (GHIDRA_CAST((laser)))->Entity_Laser::SetMaxDistance(fVar11); - laser->SetCollisionDamage(); - set_field_0x37c(); - pcVar1 = *(code **)(*GHIDRA_CAST(laser) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - (GHIDRA_CAST((laser)))->Entity_Laser::set_disable_init_sound(); - laser->Update(); - pEVar23 = savedPlayer; - } - salvationEffect = &pEVar23->_extensionCordIndex; - *salvationEffect = *salvationEffect + -1; - if (*salvationEffect < 0) { - iVar4 = (GHIDRA_CAST((cordEntities)))->msvc::vector::size(); - pEVar23->_extensionCordIndex = iVar4 + -1; - } - } - } - } - FID_conflict__Tidy(cordEntities); - local_14 = -NAN; - (GHIDRA_CAST((local_c3c)))->EntityList_Query::~EntityList_Query(); - } - if ((0 < pEVar23->_megaBlastDuration) && (bVar2 = AreControlsEnabled(pEVar23), bVar2 != 0)) { - pEVar23->_megaBlastDuration = pEVar23->_megaBlastDuration + -1; - queryList = GHIDRA_CAST(0x0); - iVar4 = Isaac::Random(2); - GetTearHitParams(pEVar23,&local_338,3,1.0,iVar4 * 2 + -1,queryList); - Isaac::GetAxisAlignedUnitVectorFromDir(&megaBlastDir,pEVar23->_headDirection); - bVar2 = (GHIDRA_CAST((&pEVar23->_aimDirection)))->Vector::operator_ne(&g_vectorZero); - if (bVar2 != 0) { - (GHIDRA_CAST((&megaBlastDir)))->Vector::operator_assign(&pEVar23->_aimDirection); - } - local_a04 = GHIDRA_CAST((GHIDRA_CAST((&megaBlastDir)))->Vector)::GetAngleDegrees(); - local_a1c = GHIDRA_CAST(&pEVar23->_megaBlastLaser); - if ((*(void **)local_a1c == (void *)0x0) && (0xf < pEVar23->_megaBlastDuration)) { - iVar4 = 6; - bVar2 = HasCollectible(savedPlayer,0x44,0); - if (bVar2 != 0) { - iVar4 = 0xf; - } - tmpVec = (GHIDRA_CAST((&megaBlastOffset)))->Vector::Vector(0.0,-30.0); - minLaserTimeout = 0.0; - laserTimeout = (float)(savedPlayer->_megaBlastDuration + -0xf); - salvationEffect = GHIDRA_CAST(std)::max(); - laser = Entity_Laser::ShootAngle - (iVar4,&savedPlayer->_pos,(float)local_a04,*salvationEffect,tmpVec, - GHIDRA_CAST(savedPlayer),0); - pcVar1 = *(code **)(*GHIDRA_CAST(laser) + 0x40); - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 == '\0') { - local_a28 = GHIDRA_CAST(0x40a00000); - } - (*pcVar1)(); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((room)))->Room::GetFrameCount(); - (GHIDRA_CAST((laser)))->Entity_Laser::set_disable_init_sound(); - (GHIDRA_CAST((GHIDRA_CAST(local_a1c))))->EntityPtr::SetReference(GHIDRA_CAST(laser)); - tmpFlags = (GHIDRA_CAST((&g_tearFlagWait)))->BitSet128::__bnot(¬WaitFlags2); - BitSet128::operator_and(&megaBlastFlags,&local_338._flags,tmpFlags); - FUN_00456830(); - pEVar23 = savedPlayer; - laser->SetColor(); - laser->Update(); - } - pEVar18 = GHIDRA_CAST(__RTDynamicCast()); - if (pEVar18 != GHIDRA_CAST(0x0)) { - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity_Projectile::Damage(); - local_a1c = GHIDRA_CAST((float)fVar27); - fVar11 = LerpAngleDeg((float)local_a1c,(float)local_a04,0.3); - (GHIDRA_CAST((pEVar18)))->Entity_NPC::SetAimAngle(fVar11); - GetLaserOffset(pEVar23,&megaBlastLaserOffset,4,&megaBlastDir); - (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::SetPositionOffset(offset); - tmpFlags = (GHIDRA_CAST((&g_tearFlagWait)))->BitSet128::__bnot(¬WaitFlags3); - BitSet128::operator_and(&megaBlastFlags2,&local_338._flags,tmpFlags); - FUN_00456830(); - pEVar18->SetColor(); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::Child(); - if (iVar4 != 0) { - salvationEffect = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity)::Child(); - (**(code **)(*salvationEffect + 0x3c))(); - } - if (megaBlastDir.y <= -0.5) { - fVar11 = -10.0; - } - else { - fVar11 = 3000.0; - } - set_field_358(pEVar18,fVar11); - } - tmpVec = (GHIDRA_CAST((&megaBlastDir)))->Vector::__unm(&megaBlastRecoilDir); - bVar2 = 0; - megaBlastRecoil = 0.85; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&megaBlastRecoilVel,&megaBlastRecoil); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddVelocity_divided(tmpVec,bVar2); - pEVar23->_blinkTime = 7; - if (pEVar23->_megaBlastDuration < 1) { - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x1f); - RemoveCostume(pEVar23,configItem); - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f00)))) != 0) && (bVar2 = AreControlsEnabled(pEVar23), bVar2 != 0)) { - queryList = GHIDRA_CAST(0x0); - iVar4 = Isaac::Random(2); - GetTearHitParams(pEVar23,&TStack_928,3,1.0,iVar4 * 2 + -1,queryList); - Isaac::GetAxisAlignedUnitVectorFromDir(&rageLaserDir,pEVar23->_headDirection); - bVar2 = (GHIDRA_CAST((&pEVar23->_aimDirection)))->Vector::operator_ne(&g_vectorZero); - if (bVar2 != 0) { - (GHIDRA_CAST((&rageLaserDir)))->Vector::operator_assign(&pEVar23->_aimDirection); - } - local_a1c = GHIDRA_CAST((GHIDRA_CAST((&rageLaserDir)))->Vector)::GetAngleDegrees(); - pEVar18 = GHIDRA_CAST(FUN_00435df0()); - if (pEVar18 != GHIDRA_CAST(0x0)) { - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity_Projectile::Damage(); - local_a28 = GHIDRA_CAST((float)fVar27); - fVar11 = LerpAngleDeg((float)local_a28,(float)local_a1c,0.3); - (GHIDRA_CAST((pEVar18)))->Entity_NPC::SetAimAngle(fVar11); - GetLaserOffset(pEVar23,&rageLaserOffset2,4,&rageLaserDir); - (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::SetPositionOffset(offset_00); - tmpFlags = (GHIDRA_CAST((&g_tearFlagWait)))->BitSet128::__bnot(¬WaitFlags4); - BitSet128::operator_and(&rageLaserFlags2,&TStack_928._flags,tmpFlags); - FUN_00456830(); - pEVar18->SetColor(); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity::Child(); - if (iVar4 != 0) { - salvationEffect = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar18))))->Entity)::Child(); - (**(code **)(*salvationEffect + 0x3c))(); - } - if (rageLaserDir.y <= -0.5) { - fVar11 = -10.0; - } - else { - fVar11 = 3000.0; - } - set_field_358(pEVar18,fVar11); - } - tmpVec = (GHIDRA_CAST((&rageLaserDir)))->Vector::__unm(&rageRecoilDir); - bVar2 = 0; - rageRecoil = 0.15; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&rageRecoilVel,&rageRecoil); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::AddVelocity_divided(tmpVec,bVar2); - (GHIDRA_CAST((headDownShoot2)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadDownShoot")); - local_14 = 3.92364e-44; - (GHIDRA_CAST((headRightShoot2)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadRightShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x1d; - (GHIDRA_CAST((headUpShoot2)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadUpShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x1e; - (GHIDRA_CAST((headLeftShoot2)))->msvc::string::string_from_cstr(GHIDRA_CAST("HeadLeftShoot")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x1f; - direction_00.y = rageLaserDir.y; - direction_00.x = rageLaserDir.x; - string_from_direction - (local_78 + 0x2c,direction_00,headLeftShoot2,headUpShoot2,headRightShoot2, - headDownShoot2); - (GHIDRA_CAST((headLeftShoot2)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((headUpShoot2)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((headRightShoot2)))->msvc::string::_Tidy_deallocate(); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),0x24); - (GHIDRA_CAST((headDownShoot2)))->msvc::string::_Tidy_deallocate(); - play_null_costume_anim(pEVar23,99,0,GHIDRA_CAST((local_78 + 0x2c)),-2,0); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(99); - iVar4 = get_costume_anim_frame(pEVar23,Weapon::is_held_item,configItem,0); - if (0xf < iVar4) { - play_item_costume_anim - (pEVar23,Weapon::is_held_item,configItem,0,GHIDRA_CAST((local_78 + 0x2c)),8); - } - pEVar23->_blinkTime = 7; - local_14 = -NAN; - (GHIDRA_CAST((local_78 + 0x2c)))->msvc::string::_Tidy_deallocate(); - } - iVar4 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffectNum(699); - if ((5 < iVar4) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1f00)))) == 0)) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(699,-1); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(99); - RemoveCostume(pEVar23,configItem); - itemConfig = Isaac::GetItemConfig(); - bVar2 = 0; - configItem = ItemConfig::GetCollectible(itemConfig,699); - AddCostume(pEVar23,configItem,bVar2); - } - if ((pEVar23->_montezumaLaser != (void *)0x0) && (bVar2 = AreControlsEnabled(pEVar23), bVar2 != 0) - ) { - local_a28 = GHIDRA_CAST((pEVar23->_bodyAngle + 180.0)); - local_a04 = GHIDRA_CAST(FUN_00435df0()); - if (local_a04 != GHIDRA_CAST(0x0)) { - Vector::FromAngle(&montezumaDir,(float)local_a28); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_a04))))->Entity_Projectile::Damage(); - local_a1c = GHIDRA_CAST((float)fVar27); - fVar11 = LerpAngleDeg((float)local_a1c,(float)local_a28,0.3); - (GHIDRA_CAST((local_a04)))->Entity_NPC::SetAimAngle(fVar11); - } - } - if ((0 < pEVar23->_planCKillCountdown) && - (iVar4 = pEVar23->_planCKillCountdown + -1, pEVar23->_planCKillCountdown = iVar4, iVar4 == 0)) - { - if ((pEVar23->_playerType == 3) && - ((bVar2 = HasCollectible(pEVar23,0x26b,0), bVar2 != 0 && - (bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1db), - bVar2 == 0)))) { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1db,0,1); - } - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar23) + 0x24); - (GHIDRA_CAST((&planCSource)))->EntityRef::EntityRef(); - (*pcVar1)(); - *GHIDRA_CAST(&pEVar23->_lastDamageFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&pEVar23->_lastDamageFlags) + 4)) = 0; - (pEVar23->_lastDamageSource)._type = 0; - (pEVar23->_lastDamageSource)._variant = 0; - } - bVar2 = HasPlayerForm(pEVar23,0xd); - if (bVar2 != 0) { - local_a1c = GHIDRA_CAST((GHIDRA_CAST((&pEVar23->_velocity)))->Vector)::LengthSquared(); - if (1.0 < (float)local_a1c) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::IsFrame(5,0); - if (bVar2 != 0) { - local_a1c = GHIDRA_CAST(Random()); - stompyDustVelFactor = 0.7; - local_a28 = (Entity_Tear *) - (GHIDRA_CAST((&pEVar23->_velocity)))->Vector::__mul(&stompyDustVel,&stompyDustVelFactor); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::Position(&stompyPos); - pVVar14 = MusicManager::RandomVector(&stompyRandomDir); - stompyDustSpread = random_float(); - stompyDustSpread = stompyDustSpread * 20.0; - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&stompyDustOffset,&stompyDustSpread); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__add(&stompyDustPos,pVVar14); - Game::Spawn(g_game,1000,0x3b,tmpVec,GHIDRA_CAST(local_a28),GHIDRA_CAST(0x0),0,GHIDRA_UINT(local_a1c)); - effect = GHIDRA_CAST(__RTDynamicCast()); - iVar4 = Isaac::Random(2); - if (iVar4 == 0) { - local_a28 = GHIDRA_CAST(0x3f800000); - } - else { - local_a28 = GHIDRA_CAST(&DAT_bf800000); - } - fVar11 = random_float(); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(fVar11 * 5.0 * (float)local_a28); - iVar4 = Isaac::Random(0xf); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(iVar4 + 0xf); - effect->Update(); - pEVar23 = savedPlayer; - } - } - } - bVar2 = HasCollectible(pEVar23,0x1bf,0); - if (bVar2 != 0) { - FUN_00428b50(); - cVar3 = FUN_0082ee30(); - if ((((cVar3 == '\0') && (bVar2 = AreControlsEnabled(pEVar23), bVar2 != 0)) && - (pEVar23->_fireBlockCooldown < 1)) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x18f0)))) % 0xf0 < 2 && (1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x18f0)))))))) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x69,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),0,uVar22) - ; - bVar2 = HasTrinket(pEVar23,0x86,0); - if (bVar2 != 0) { - tmpVec = GHIDRA_CAST((GHIDRA_CAST((queryList)))->Entity)::SpriteScale(); - cloudScaleFactor = 2.0; - tmpVec = Vector::operator_mul(&cloudScale,&cloudScaleFactor,tmpVec); - (GHIDRA_CAST((queryList)))->Entity::SetSpriteScale(tmpVec); - } - queryList->Update(); - SoundEffects::PlayWithFartOverride(0x35c,1.0,2,0,1.0); - } - } - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (((cVar3 != '\0') && (bVar2 = HasCollectible(pEVar23,0x2b5,0), bVar2 != 0)) && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::IsFrame(300,0), bVar2 != 0)) { - AddSwarmFlyOrbital(pEVar23,&pEVar23->_pos); - } - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if ((((cVar3 != '\0') && (pEVar23->_dead == 0)) && (pEVar23->_variant == 0)) && - (cVar3 = IsCoopGhost(pEVar23), cVar3 == '\0')) { - local_a28 = GHIDRA_CAST(0x4e6e6b28); - puVar10 = GHIDRA_CAST(0x0); - local_9fc = GHIDRA_CAST(0x0); - local_a04 = GHIDRA_CAST(0x0); - iVar4 = Game::GetNumPlayers(g_game); - if (iVar4 != 0) { - do { - pEVar24 = Game::GetPlayer(g_game,GHIDRA_UINT(puVar10)); - if (pEVar24 != pEVar23) { - bVar2 = HasCollectible(pEVar24,0x2b8,0); - if (bVar2 != 0) { - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar24))))->Entity::Position(&otherPlayerPos); - local_a34 = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::DistanceSquared(&pEVar23->_pos); - auVar32 = ZEXT416(local_a28); - if ((float)local_a34 < (float)local_a28) { - get_salvation_scale(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar37)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar37)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0))) * 70.0 + pEVar23->_size; - FUN_006daa90(); - if ((double)(float)local_a34 < (*GHIDRA_CAST((GHIDRA_CAST(&(auVar37)) + 0x0)))) { - local_a28 = local_a34; - local_9fc = pEVar24; - } - } - } - } - puVar10 = &(*GHIDRA_CAST((GHIDRA_CAST((local_a04)) + 0x1))); - local_a04 = GHIDRA_CAST(puVar10); - puVar19 = GHIDRA_CAST(Game)::GetNumPlayers(g_game); - pEVar24 = local_9fc; - } while (puVar10 < puVar19); - if (local_9fc != GHIDRA_CAST(0x0)) { - iVar4 = EntityPtr::Ref(); - if (iVar4 == 0) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x13,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar24),3, - uVar22); - (GHIDRA_CAST((queryList)))->Entity::SetTarget(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(local_9fc)); - queryList->SetCollisionDamage(); - queryList->Update(); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1e84)))))))->EntityPtr::Set(queryList); - } - iVar4 = EntityPtr::Ref(); - if (iVar4 != 0) { - effect = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((effect)))->Entity_Effect::set_state(1); - } - } - } - } - FUN_00863be0(); - level = GHIDRA_CAST(Config)::GetCollectibles(); - bVar2 = Level::GetStateFlag(level,0x19); - if (bVar2 == 0) { - if (0 < pEVar23->_imExcitedSpeedupCountdown) { - iVar4 = pEVar23->_imExcitedSpeedupCountdown + -1; - pEVar23->_imExcitedSpeedupCountdown = iVar4; - if (iVar4 == (iVar4 / 900) * 900) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((room)))->Room::SetBrokenWatchState(2); - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1c,0,1); - } - } - } - else { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((room)))->Room::SetBrokenWatchState(2); - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1c,0,1); - pEVar23->_imExcitedSpeedupCountdown = 0; - } - tempEffects = &pEVar23->_temporaryeffects; - if ((0 < pEVar23->_rUaWizardTimer) && - (iVar4 = pEVar23->_rUaWizardTimer + -1, pEVar23->_rUaWizardTimer = iVar4, iVar4 == 0)) { - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(6); - RemoveCostume(pEVar23,configItem); - } - local_9fc = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(0x20a); - if (local_9fc == (void *)0x0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1440)))) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1440)))) + 0x28))(); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1440)))))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - } - else { - uVar22 = 2; - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - uVar22 = 6; - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(local_adc),&pEVar23->_pos,50.0,uVar22); - local_14 = 5.1848e-44; - local_a34 = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_adc))))->EntityList::Size(); - if (iVar4 != 0) { - do { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::Type(); - if (iVar4 == 9) { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar8 = GHIDRA_CAST(*puVar9); - local_a28 = pEVar8; - projectileFlags = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity_Projectile::ProjectileFlags(); - if ((projectileFlags & 0x80000000) == 0) { - fVar27 = (long double)(GHIDRA_CAST((pEVar8)))->Entity_Tear::Height(); - local_a1c = GHIDRA_CAST((float)fVar27); - if (-50.0 < (float)local_a1c) { - bVar2 = HasCollectible(pEVar23,0x248,0); - if (bVar2 == 0) { - projectileFlags = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity_Projectile::ProjectileFlags(); - Entity_Projectile::set_projectile_flags - (GHIDRA_CAST(local_a28), - CONCAT44(GHIDRA_UINT((projectileFlags >> 0x20)) & _DAT_00c5d0e4, - (GHIDRA_UINT(projectileFlags) | 0x80000080) & _DAT_00c5d0e0) | - 0x500000000); - pEVar8 = local_a28; - FUN_004aad90(); - Isaac::Random(0xf); - FUN_004aadd0(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::Velocity(&capturedShotVel); - (GHIDRA_CAST((tmpVec)))->Vector::Length(); - FUN_004aadb0(); - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - pEVar23 = savedPlayer; - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::SetParent(GHIDRA_CAST(savedPlayer)); - position.y = g_vectorZero.y; - position.x = g_vectorZero.x; - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::SetTargetPosition(position); - fVar27 = (long double)(GHIDRA_CAST((pEVar8)))->Entity_Tear::FallingAcceleration(); - local_a1c = GHIDRA_CAST((float)fVar27); - if (0.0 < (float)local_a1c) { - fVar27 = (long double)(GHIDRA_CAST((pEVar8)))->Entity_Tear::FallingSpeed(); - local_a1c = GHIDRA_CAST((float)fVar27); - if (0.0 < (float)local_a1c) { - fVar27 = (long double)(GHIDRA_CAST((pEVar8)))->Entity_Tear::FallingSpeed(); - local_a1c = GHIDRA_CAST((float)fVar27); - FUN_00444c70(); - } - } - } - else { - isDontUpdateWisp = 0; - bVar2 = 0; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::Position(&wispSpawnPos); - AddWisp(pEVar23,0x20a,tmpVec,bVar2,isDontUpdateWisp); - pEVar8->Remove(); - } - } - } - } - else { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::IsDescendantOf(GHIDRA_CAST(pEVar23)); - if (bVar2 == 0) { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar9))))->Entity::IsTear(); - if (bVar2 != 0) { - msvc::vector::operator_index(); - iVar4 = __RTDynamicCast(); - if (iVar4 != 0) { - puVar9 = GHIDRA_CAST(std)::vector::operator_index(); - pEVar8 = GHIDRA_CAST(*puVar9); - fVar27 = (long double)(GHIDRA_CAST((pEVar8)))->Entity_Tear::Height(); - local_a1c = GHIDRA_CAST((float)fVar27); - if (-50.0 < (float)local_a1c) { - bVar2 = HasCollectible(pEVar23,0x248,0); - if (bVar2 == 0) { - tmpFlags = BitSet128::operator_or - (&capturedTearFlags2,GHIDRA_CAST(&DAT_00c346d0), - GHIDRA_CAST(&DAT_00c346b0)); - (GHIDRA_CAST((pEVar8)))->Entity_Tear::SetTearFlags(*tmpFlags); - FUN_00665b30(); - Isaac::Random(0xf); - FUN_00753740(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::Velocity(&capturedTearVel); - local_a1c = GHIDRA_CAST((GHIDRA_CAST((tmpVec)))->Vector)::Length(); - FUN_00753730(); - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::SetSpawnerEntity(GHIDRA_CAST(pEVar23)); - position_00.y = g_vectorZero.y; - position_00.x = g_vectorZero.x; - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::SetTargetPosition(position_00); - } - else { - isDontUpdateWisp = 0; - bVar2 = 0; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity::Position(&wispSpawnPos2); - AddWisp(pEVar23,0x20a,tmpVec,bVar2,isDontUpdateWisp); - pEVar8->Remove(); - } - } - } - } - } - } - local_a34 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a34)) + 0x1)))); - pEVar8 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_adc))))->EntityList)::Size(); - } while (local_a34 < pEVar8); - } - effect = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1440)))); - if (effect == GHIDRA_CAST(0x0)) { - uVar22 = Random(); - queryList = Game::Spawn(g_game,1000,0x7b,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),1,uVar22) - ; - (GHIDRA_CAST((queryList)))->Entity::SetParent(GHIDRA_CAST(pEVar23)); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1440)))))))->EntityPtr::SetReference(queryList); - effect = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x1440)))); - if (effect != GHIDRA_CAST(0x0)) goto LAB_0079e9c1; - } - else { -LAB_0079e9c1: - (GHIDRA_CAST((effect)))->Entity_Effect::set_state(GHIDRA_UINT((*GHIDRA_CAST((GHIDRA_CAST(local_9fc) + 8)) < 0x3c))); - } - local_14 = -NAN; - (GHIDRA_CAST((local_adc)))->EntityList_Query::~EntityList_Query(); - tempEffects = &pEVar23->_temporaryeffects; - } - if ((0 < pEVar23->_hallowedGroundCountdown) && - (iVar4 = pEVar23->_hallowedGroundCountdown + -1, pEVar23->_hallowedGroundCountdown = iVar4, - iVar4 < 1)) { - AddCacheFlags(pEVar23,99); - EvaluateItems(pEVar23); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::IsFrame(3,0); - if (bVar2 != 0) { - bVar2 = IsHologram(pEVar23); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar23,0xbd,0); - if (((((bVar2 == 0) && (bVar2 = IsHeadless(pEVar23), bVar2 == 0)) && - (bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0xd6), bVar2 == 0)) && - ((bVar2 = HasCollectible(pEVar23,0x281,0), bVar2 == 0 && - (iVar4 = pEVar23->_playerType, iVar4 != 0x26)))) && - (((iVar4 != 0x1d && (iVar4 != 0x1a)) || (iVar4 = Isaac::Random(4), iVar4 != 0)))) { - bVar2 = HasCollectible(pEVar23,0x240,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar23,0x26a,0); - if (bVar2 == 0) { - bVar2 = HasCollectible(pEVar23,0x2a0,0); - if (bVar2 != 0) { - iVar4 = 6; - goto LAB_0079eac8; - } - bVar2 = HasCollectible(pEVar23,0x255,0); - if (bVar2 != 0) { - iVar4 = Isaac::Random(2); - if (iVar4 == 0) { - fVar11 = random_float(); - effect = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity_NPC::MakeSplat(fVar11 * 0.5 + 0.2); - pcVar1 = *(code **)(*GHIDRA_CAST(effect) + 0x3c); - (GHIDRA_CAST((splatColor)))->Color::Color(0.0,0.0,0.0,0.08); - (*pcVar1)(); - pEVar23 = savedPlayer; - } - } - } - else { - iVar4 = Isaac::Random(8); - if (iVar4 == 0) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c8126c) && - (_Init_thread_header(), DAT_00c8126c == -1)) { - local_14 = 5.46506e-44; - (GHIDRA_CAST(()))->Color::Color(); - local_14 = -NAN; - _Init_thread_footer(); - } - fVar11 = random_float(); - effect = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity_NPC::MakeSplat(fVar11 * 0.5 + 0.2); - effect->SetColor(); - } - } - } - else { - iVar4 = Isaac::Random(4); - if (iVar4 == 0) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c8123c) && - (_Init_thread_header(), DAT_00c8123c == -1)) { - local_14 = 5.32493e-44; - (GHIDRA_CAST(()))->Color::Color(); - local_14 = -NAN; - _Init_thread_footer(); - } - fVar11 = random_float(); - effect = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity_NPC::MakeSplat(fVar11 * 0.5 + 0.2); - effect->SetColor(); - } - } - } - else { - iVar4 = 2; -LAB_0079eac8: - iVar4 = Isaac::Random(iVar4); - if (iVar4 == 0) { - fVar11 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity_NPC::MakeSplat(fVar11 * 0.5 + 0.2); - } - } - } - } - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (((cVar3 != '\0') && (bVar2 = HasCollectible(pEVar23,0x240,0), bVar2 != 0)) && - (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::GetIntervalTicks(210.0,0.0), iVar4 != 0)) { - rngPtr = GetCollectibleRNG(pEVar23,0x240); - uVar22 = (GHIDRA_CAST((rngPtr)))->RNG::RandomInt(100); - if (uVar22 < 0x1e) { - uVar22 = 0; - } - else if (uVar22 < 0x2c) { - uVar22 = 1; - } - else if (uVar22 < 0x3a) { - uVar22 = 0xd; - } - else if (uVar22 < 0x48) { - uVar22 = 3; - } - else { - uVar22 = (-GHIDRA_UINT((uVar22 < 0x56)) & 0xfffffffe) + 6; - } - uVar5 = Random(); - Game::Spawn(g_game,3,0xc9,&pEVar23->_pos,&g_vectorZero,GHIDRA_CAST(pEVar23),uVar22,uVar5); - } - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x32); - if (bVar2 != 0) { - if (pEVar23->_activeDesc[0]._item == 0x28f) { - AddActiveCharge(pEVar23,-1,0,0,0,0); - } - else { - (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x32,1); - } - } - if ((0 < pEVar23->_grantedCollectibleCountdown) && - (iVar4 = pEVar23->_grantedCollectibleCountdown + -1, - pEVar23->_grantedCollectibleCountdown = iVar4, iVar4 < 1)) { - pEVar23->_grantedCollectibleFlags = 0; - AddCacheFlags(pEVar23,99); - EvaluateItems(pEVar23); - } - bVar2 = Game::IsInTimedSet(g_game,3); - if (((bVar2 == 0) && (bVar2 = Game::IsInTimedSet(g_game,6), bVar2 == 0)) && - (bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1f1), bVar2 == 0) - ) { - pvVar28 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::GetTrinketEffect(0x45); - if (pvVar28 == (void *)0x0) goto LAB_0079ef52; - if (0x1d < *GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8))) goto LAB_0079ee43; - local_a34 = GHIDRA_CAST(sinf_wrapper((float)*GHIDRA_CAST((GHIDRA_CAST(pvVar28) + 8)) * 0.1)); - if ((float)local_a34 <= 0.0) goto LAB_0079ef52; - } - else { -LAB_0079ee43: - local_a34 = (void *)0x3f800000; - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar4 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); - if (iVar4 < 2) { - fVar11 = 1.0; - } - else { - fVar11 = 0.1; - } - tmpColor = Color::Lerp(footprintColor,&pEVar23->_footprintColor2,&pEVar23->_footprintColor1,0.5); - Color::Lerp(GHIDRA_CAST(local_78),GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x170c)))),tmpColor,fVar11); - entityColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_sprite))))->Sprite)::Color(); - fVar11 = (GHIDRA_CAST((entityColor)))->Color::A(); - Font::SetLineHeightModifier(GHIDRA_CAST(local_78),fVar11); - (GHIDRA_CAST((GHIDRA_CAST(local_78))))->Color::SetTint(0.01,0.01,0.01,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar23)) + 0x170c)))))))->Color::operator_assign(GHIDRA_CAST(local_78)); - tmpColor = GHIDRA_CAST(local_78); - pEVar8 = local_a34; - from = GHIDRA_CAST(FUN_00757980()); - tmpColor = Color::Lerp(&fadedSpriteColor,from,tmpColor,(float)pEVar8); - (GHIDRA_CAST((GHIDRA_CAST(local_78))))->Color::operator_assign(tmpColor); - (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_sprite))))->Sprite::SetColor(GHIDRA_CAST(local_78)); -LAB_0079ef52: - local_a34 = (void *)0x3f800000; - layerIndex = GHIDRA_CAST(0x0); - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_sprite))))->Sprite::GetLayerCount(); - if (iVar4 != 0) { - anm = &pEVar23->_sprite; - local_a1c = GHIDRA_CAST(anm); - do { - layer = (GHIDRA_CAST((GHIDRA_CAST(anm))))->Sprite::GetLayer(layerIndex); - layerIndex = layerIndex + 1; - local_a34 = GHIDRA_CAST(((float)local_a34 + (layer->_size).x)); - layerCount = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(anm))))->Sprite)::GetLayerCount(); - } while (layerIndex < layerCount); - pEVar23 = savedPlayer; - } - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar23->_sprite))))->Sprite::GetLayerCount(); - local_a00 = (Entity_Player *) - Math::clamp(0.3,1.0,((float)local_a34 / - (float)((double)iVar4 + __uint_to_double_fixup[-(iVar4 >> 0x1f)])) - * (pEVar23->_playerSpriteScale).x); - collisionPointCount = *GHIDRA_CAST((GHIDRA_CAST(pEVar23->_config) + 0x48)); - bVar2 = HasCollectible(pEVar23,0x47,0); - if (bVar2 != 0) { - local_a00 = GHIDRA_CAST(((float)local_a00 * 0.75)); - } - bVar2 = HasCollectible(pEVar23,0x256,0); - if ((bVar2 != 0) || - (bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x2b0), bVar2 != 0) - ) { - local_a00 = GHIDRA_CAST(((float)local_a00 * 0.5)); - maxCollisionPoints = 0xc; - salvationEffect = GHIDRA_CAST(std)::min(); - collisionPointCount = *salvationEffect; - } - bVar2 = (GHIDRA_CAST((&pEVar23->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - if (bVar2 == 0) { - fVar11 = 1.0; - } - else { - doubledSizeScale = (float)local_a00 + (float)local_a00; - maxSizeScale = 2.0; - pfVar15 = GHIDRA_CAST(std)::min(); - local_a00 = GHIDRA_CAST(*pfVar15); - shadowScale = 3.0; - fVar11 = shadowScale; - } - if (pEVar23->_isCoopGhost != 0) { - shadowScale = fVar11 * 0.5; - } - bVar2 = Game::IsInTimedSet(g_game,0xe); - if (bVar2 != 0) { - shadowScale = 0.0; - } - local_a20 = (pEVar23->_sizeMulti).x; - local_a1c = GHIDRA_CAST((pEVar23->_sizeMulti).y); - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(pEVar23->_config) + 0x48)); - entityConfig = GHIDRA_CAST(FUN_00417910()); - entityConfigEntry = EntityConfig::GetEntity(entityConfig,pEVar23->_type,pEVar23->_variant,0); - sizeMulti.y = (float)local_a1c; - sizeMulti.x = local_a20; - (GHIDRA_CAST((GHIDRA_CAST(pEVar23))))->Entity::SetSize((float)local_a00 * entityConfigEntry->collisionRadius,sizeMulti, - iVar4); - pEVar23->_shadowSize = shadowScale * *GHIDRA_CAST((GHIDRA_CAST(pEVar23->_config) + 0x24)); - ExceptionList = local_1c; - return; -} - -// 0079f3c0 -void Entity_Player::update_ladder() -{ - code *pcVar1; - int64_t lVar2; - int64_t lVar3; - int64_t lVar4; - uint8_t bVar5; - char isBanned; - uint32_t uVar6; - int *piVar7; - int iVar8; - uint32_t upGridIdx; - GridEntity_Pit *pit; - uint32_t uVar9; - int unusedArg; - void *pvVar10; - int *piVar11; - int iVar12; - PlayerManager *playerManager; - Game *game; - bool bVar13; - float deltaX; - float deltaY; - float fVar14; - uint64_t timeNs; - uint8_t auStack_b8 [4]; - int *local_b4; - void *room; - int *local_ac; - uint32_t local_a8; - Game *local_a4; - void *local_a0; - char isLadderOwner; - int *spawnSubType; - Entity *local_94; - float local_90; - uint32_t local_8c; - int *piStack_88; - float fStack_84; - uint32_t spawnType; - Entity_Player *local_7c; - int *apiStack_78 [3]; - uint32_t spawnVariant; - int *local_68; - int *local_64; - int *local_60; - int *ladderSlot; - int local_58 [3]; - int triggerKeyType; - int triggerKeyVariant; - uint64_t rngShifts; - uint32_t rngShift3; - uint8_t auStack_34 [4]; - uint8_t local_30 [8]; - int local_28; - uint8_t auStack_24 [8]; - RNG cardRng; - uint32_t stackCookie; - float moveDirY; - Entity *ladder; - Manager *manager; - Entity_Player *otherPlayer; - uint32_t *spawnerSlot; - - stackCookie = __security_cookie ^ GHIDRA_UINT(auStack_b8); - local_7c = this; - bVar5 = HasCollectible(this,0x3c,0); - if ((bVar5 == 0) || (local_7c->_variant != 0)) { - local_b4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_7c)) + 0x1424)))); - isLadderOwner = '\0'; - if (local_b4 == GHIDRA_CAST(0x0)) { - return; - } - } - else { - local_b4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_7c)) + 0x1424)))); - isLadderOwner = '\x01'; - } - piVar7 = local_b4; - ladderSlot = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_7c)) + 0x1424)))); - room = g_game->_room; - if (local_b4 != GHIDRA_CAST(0x0)) goto LAB_0079fa87; - local_8c = Random(); - local_a4 = g_game; - spawnVariant = 8; - spawnType = 1000; - spawnSubType = piVar7; - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&spawnType),GHIDRA_CAST(&spawnVariant),&g_vectorZero,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_CAST(&spawnSubType),&local_8c); - uVar9 = spawnVariant; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_0079f708: - local_b4 = spawnSubType; - } - else { - local_ac = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - uVar6 = Random(); - piVar11 = spawnSubType; - piVar7 = local_ac; - rngShifts = 0x900000005; - local_94 = GHIDRA_CAST(0x7); - rngShift3 = 7; - local_a8 = uVar6; - if (spawnType != 5) goto LAB_0079f708; - if (uVar9 < 0x12d) { - if (uVar9 == 300) { - while ((local_b4 = spawnSubType, spawnSubType == GHIDRA_CAST(0x0) || - (isBanned = (**(code **)(*local_ac + 0x24))(spawnSubType), isBanned != '\0'))) { - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)rngShifts & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)local_94 & 0x1f) ^ uVar6; - iVar8 = ItemPool::GetCardEx(uVar6,0x19,10,10,1); - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._shift3 = 7; - cardRng._seed = uVar6; - spawnSubType = GHIDRA_CAST(lua_callback_run_get_card(&cardRng,iVar8,1,1,0)); - } - } - else { - if (uVar9 == 0x46) { - local_68 = GHIDRA_CAST((GHIDRA_UINT(spawnSubType) >> 0xb)); - do { - local_b4 = spawnSubType; - if (spawnSubType != GHIDRA_CAST(0x0)) { - pcVar1 = *(code **)(*local_ac + 0x28); - iVar8 = ItemPool::GetPillEffect - (&g_game->_itemPool,GHIDRA_UINT(spawnSubType),GHIDRA_CAST(0x0)); - isBanned = (*pcVar1)(iVar8); - if (isBanned == '\0') goto LAB_0079f710; - uVar6 = local_a8; - } - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)rngShifts & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)local_94 & 0x1f) ^ uVar6; - local_a8 = uVar6; - uVar9 = ItemPool::GetPill(uVar6); - spawnSubType = GHIDRA_CAST((uVar9 | (GHIDRA_UINT(local_68) & 1) << 0xb)); - } while( true ); - } - if (uVar9 != 100) goto LAB_0079f708; - local_b4 = spawnSubType; - if (spawnSubType == GHIDRA_CAST(0x19)) { -LAB_0079f54a: - bVar13 = false; - } - else { - local_68 = spawnSubType; - msvc::set::find_node(local_30,&local_68); - if (((*GHIDRA_CAST((local_28 + 0xd)) == '\0') && (*GHIDRA_CAST((local_28 + 0x10)) <= GHIDRA_INT(piVar11))) - && (local_28 != piVar7[8])) goto LAB_0079f54a; - bVar13 = true; - } - if ((piVar11 == GHIDRA_CAST(0x0)) || (bVar13)) { - local_b4 = GHIDRA_CAST((**(code **)(*piVar7 + 0x84))(0)); - spawnSubType = local_b4; - } - } - } - else { - if (uVar9 != 0x15e) goto LAB_0079f708; - while ((local_b4 = spawnSubType, spawnSubType == GHIDRA_CAST(0x0) || - (isBanned = (**(code **)(*local_ac + 0x2c))(spawnSubType), isBanned != '\0'))) { - spawnSubType = GHIDRA_CAST(ItemPool)::GetTrinket(&g_game->_itemPool,0); - } - } - } -LAB_0079f710: - local_94 = (GHIDRA_CAST((local_a4->_entityFactory)))->EntityFactory::Create(spawnType,0); - lVar2 = CONCAT44(local_60,local_a8); - if (local_94 != GHIDRA_CAST(0x0)) { - timeNs = GetTimeNs(); - ladder = local_94; - local_a8 = GHIDRA_UINT((timeNs >> 0x20)); - lVar2 = (timeNs & 0xffffffff) * 0x431bde82; - local_64 = GHIDRA_CAST(((uint64_t)lVar2 >> 0x20)); - local_a0 = (void *)((uint64_t)local_a8 * 0xd7b634db >> 0x20); - timeNs = (uint64_t)local_a8 * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar6 = GHIDRA_UINT((timeNs >> 0x20)); - lVar2 = lVar2 + (timeNs & 0xffffffff); - local_58[0] = GHIDRA_INT(lVar2); - uVar9 = GHIDRA_UINT(((uint64_t)lVar2 >> 0x20)); - lVar2 = (uint64_t)local_a8 * 0x431bde82 + - (uint64_t)CONCAT14(CARRY4(uVar6,uVar9),uVar6 + uVar9); - local_94->_spawnerType = 0; - uVar9 = GHIDRA_UINT(((uint64_t)lVar2 >> 0x20)); - local_94->_spawnerVariant = 0; - local_ac = GHIDRA_CAST((GHIDRA_UINT(lVar2) >> 0x12 | uVar9 * 0x4000)); - local_90 = (float)(uVar9 >> 0x12); - spawnerSlot = &local_94->_spawnerEntity; - if (*spawnerSlot != 0) { - local_64 = spawnerSlot; - msvc::multiset::erase(&local_64); - } - iVar8 = *GHIDRA_CAST(ladder); - *spawnerSlot = 0; - (ladder->_pos).x = g_vectorZero.x; - (ladder->_pos).y = g_vectorZero.y; - (ladder->_velocity).x = g_vectorZero.x; - (ladder->_velocity).y = g_vectorZero.y; - (**(code **)(iVar8 + 4))(spawnType,spawnVariant,local_b4,local_8c); - game = local_a4; - pvVar10 = local_a4->_room; - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1214)) = iVar8 + 1; - ladder->_index = iVar8; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar10) + 0x1218)))))->EntityList::AddEntity(ladder); - bVar5 = Game::ShouldEraseEnemy(ladder); - if (bVar5 != 0) { - Entity::RemoveWithPoof(ladder,unusedArg); - } - if ((ladder->_exists != 0) && - ((game->_proceduralItemManager)._proceduralItems._begin != - (game->_proceduralItemManager)._proceduralItems._end)) { - triggerKeyVariant = ladder->_variant; - triggerKeyType = ladder->_type; - msvc::map::find(&local_a0,&triggerKeyType); - if (local_a0 == (game->_proceduralItemManager)._spawnTriggerTargets._head) { - local_58[0] = ladder->_type; - local_58[1] = 0xffffffff; - piVar7 = GHIDRA_CAST(std)::map::find(auStack_34,local_58); - local_a0 = (void *)*piVar7; - if (local_a0 == (game->_proceduralItemManager)._spawnTriggerTargets._head) - goto LAB_0079f990; - } - playerManager = &g_game->_playerManager; - local_a4 = GHIDRA_CAST(0x0); - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) - >> 2 != 0) { - do { - pvVar10 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar10) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar10 = (playerManager->_playerList)._end; - } - piVar7 = (playerManager->_playerList)._begin; - if (local_a4 < GHIDRA_CAST((GHIDRA_INT(pvVar10) - GHIDRA_INT(piVar7) >> 2))) { - piVar7 = piVar7 + GHIDRA_INT(local_a4); - } - trigger_set_dispatch((void *)(*piVar7 + 0x1fc8),6,ladder,&g_vectorZero,&g_vectorZero); - playerManager = &g_game->_playerManager; - local_a4 = GHIDRA_CAST((GHIDRA_INT(&local_a4->_stage) + 1)); - } while (local_a4 < - GHIDRA_CAST((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } -LAB_0079f990: - timeNs = GetTimeNs(); - uVar9 = GHIDRA_UINT((timeNs >> 0x20)); - lVar3 = (timeNs & 0xffffffff) * 0x431bde82; - local_b4 = GHIDRA_CAST(((uint64_t)lVar3 >> 0x20)); - lVar4 = (uint64_t)uVar9 * 0xd7b634db; - local_a4 = GHIDRA_CAST(((uint64_t)lVar4 >> 0x20)); - lVar2 = (uint64_t)uVar9 * 0x431bde82; - timeNs = lVar4 + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar6 = GHIDRA_UINT((timeNs >> 0x20)); - lVar3 = lVar3 + (timeNs & 0xffffffff); - apiStack_78[0] = GHIDRA_CAST(lVar3); - uVar9 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - lVar3 = lVar2 + (uint64_t)CONCAT14(CARRY4(uVar6,uVar9),uVar6 + uVar9); - uVar6 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - piVar7 = GHIDRA_CAST((GHIDRA_UINT(lVar3) >> 0x12 | uVar6 * 0x4000)); - uVar9 = GHIDRA_INT(piVar7) - GHIDRA_INT(local_ac); - bVar13 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar9); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar9; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + (((uVar6 >> 0x12) - GHIDRA_INT(local_90)) - GHIDRA_UINT((piVar7 < local_ac))) - + GHIDRA_UINT(bVar13); - } - piVar7 = ladderSlot; - ladder = local_94; - local_a8 = GHIDRA_UINT(lVar2); - local_94->_visible = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_94[1])) + 0x40)))) = 0xffffffff; - if (*ladderSlot != 0) { - local_60 = ladderSlot; - msvc::multiset::erase(&local_60); - lVar2 = CONCAT44(local_60,local_a8); - } - local_60 = GHIDRA_CAST(((uint64_t)lVar2 >> 0x20)); - local_a8 = GHIDRA_UINT(lVar2); - *piVar7 = GHIDRA_INT(ladder); - piStack_88 = piVar7; - msvc::set::insert_unique(auStack_24,&piStack_88); - local_b4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_7c)) + 0x1424)))); -LAB_0079fa87: - local_90 = (local_7c->_pos).x; - local_94 = GHIDRA_CAST((local_7c->_pos).y); - local_ac = GHIDRA_CAST((local_7c->_velocity).x); - local_a4 = GHIDRA_CAST((local_7c->_velocity).y); - local_a8 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)); - piVar7 = local_b4; - if (*GHIDRA_CAST((GHIDRA_CAST(local_b4) + 0x171)) != '\0') { - uVar9 = local_b4[0x114]; - uVar6 = 0; - fVar14 = (float)(GHIDRA_INT(uVar9) % GHIDRA_INT(local_a8)) * 40.0 + 40.0; - piVar7 = GHIDRA_CAST(((float)(GHIDRA_INT(uVar9) / GHIDRA_INT(local_a8)) * 40.0 + 120.0)); - game = g_game; - fStack_84 = fVar14; - apiStack_78[0] = piVar7; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - pvVar10 = (game->_playerManager)._playerList._end; - piVar11 = (game->_playerManager)._playerList._begin; - if (GHIDRA_INT(pvVar10) - GHIDRA_INT(piVar11) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar10 = (game->_playerManager)._playerList._end; - piVar11 = (game->_playerManager)._playerList._begin; - game = g_game; - fVar14 = fStack_84; - piVar7 = apiStack_78[0]; - } - if (uVar6 < GHIDRA_UINT((GHIDRA_INT(pvVar10) - GHIDRA_INT(piVar11) >> 2))) { - piVar11 = piVar11 + uVar6; - } - otherPlayer = GHIDRA_CAST(*piVar11); - if (((otherPlayer == local_7c) || (otherPlayer->_entityGridCollisionClass == 5)) && - (deltaX = (otherPlayer->_pos).x - fVar14, deltaY = (otherPlayer->_pos).y - (float)piVar7, - deltaY * deltaY + deltaX * deltaX <= 3249.0)) { - piVar7 = local_b4; - goto LAB_0079fc67; - } - uVar6 = uVar6 + 1; - } while (uVar6 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((game->_playerManager)._playerList._begin) >> 2))); - uVar9 = local_b4[0x114]; - } - piVar7 = local_b4; - if (((-1 < GHIDRA_INT(uVar9)) && (uVar9 < 0x1c0)) && - ((pit = *GHIDRA_CAST((GHIDRA_CAST(room) + uVar9 * 4 + 0x24)), pit != GHIDRA_CAST(0x0) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pit)) + 0x4)))) == 7)))) { - pit->_hasLadder = 0; - (GHIDRA_CAST((pit)))->GridEntity_Pit::UpdateCollision(); - } - piVar7[0x114] = -1; - *GHIDRA_CAST((GHIDRA_CAST(piVar7) + 0x171)) = 0; - } -LAB_0079fc67: - if (isLadderOwner == '\0') { - if (*GHIDRA_CAST((GHIDRA_CAST(piVar7) + 0x171)) == '\0') { - (**(code **)(*piVar7 + 0x28))(); - piVar7 = ladderSlot; - if (*ladderSlot != 0) { - apiStack_78[0] = ladderSlot; - msvc::multiset::erase(apiStack_78); - } - *piVar7 = 0; - } - } - else { - iVar12 = GHIDRA_INT(((local_90 - 40.0) / 40.0 + 0.5)); - iVar8 = GHIDRA_INT((((float)local_94 - 120.0) / 40.0 + 0.5)); - if (((-1 < iVar12) && (iVar12 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)))) && - ((-1 < iVar8 && - ((iVar8 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x10)) && - (piStack_88 = GHIDRA_CAST((iVar8 * *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)) + iVar12)), -1 < GHIDRA_INT(piStack_88))))) - )) { - fStack_84 = (float)local_ac; - apiStack_78[0] = &local_a4->_stage; - fVar14 = sqrtf((float)local_ac * (float)local_ac + (float)local_a4 * (float)local_a4); - piVar11 = local_b4; - if (fVar14 <= 0.0) { - moveDirY = (float)apiStack_78[0]; - } - else { - fStack_84 = (1.0 / fVar14) * (float)local_ac; - moveDirY = (1.0 / fVar14) * (float)local_a4; - } - iVar8 = GHIDRA_INT((((fStack_84 * 40.0 + local_90) - 40.0) / 40.0 + 0.5)); - iVar12 = GHIDRA_INT((((moveDirY * 40.0 + (float)local_94) - 120.0) / 40.0 + 0.5)); - if ((((iVar8 < 0) || (*GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)) <= iVar8)) || (iVar12 < 0)) || - (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x10)) <= iVar12)) { - uVar9 = 0xffffffff; - } - else { - uVar9 = iVar12 * *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)) + iVar8; - } - if (piVar7[0x114] != uVar9) { - if (GHIDRA_INT(piStack_88) < 0x1c0) { - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(room) + GHIDRA_INT(piStack_88) * 4 + 0x24)); - } - else { - iVar8 = 0; - } - if (uVar9 < 0x1c0) { - local_8c = *GHIDRA_CAST((GHIDRA_CAST(room) + uVar9 * 4 + 0x24)); - } - else { - local_8c = 0; - } - if (((((iVar8 == 0) || (*GHIDRA_CAST((iVar8 + 4)) != 7)) || (1 < *GHIDRA_CAST((iVar8 + 0xc)))) && - ((local_8c != 0 && (*GHIDRA_CAST((local_8c + 4)) == 7)))) && (*GHIDRA_CAST((local_8c + 0xc)) == 0)) - { - fStack_84 = (float)(uVar9 + 1); - uVar6 = uVar9 - 1; - upGridIdx = uVar9 - local_a8; - piStack_88 = GHIDRA_CAST((uVar9 + local_a8)); - if (((((ABS((float)local_ac) <= ABS((float)local_a4)) || (GHIDRA_INT(uVar6) < 0)) || - (GHIDRA_INT((local_a8 * local_a8)) <= GHIDRA_INT(uVar6))) || - (((uVar6 < 0x1c0 && - (apiStack_78[0] = *GHIDRA_CAST((GHIDRA_CAST(room) + uVar9 * 4 + 0x20)), - apiStack_78[0] != GHIDRA_CAST(0x0))) && (apiStack_78[0][1] == 7)))) || - ((GHIDRA_INT((local_a8 * local_a8)) <= GHIDRA_INT(fStack_84) || - (((uVar9 + 1 < 0x1c0 && (*GHIDRA_CAST((GHIDRA_CAST(room) + uVar9 * 4 + 0x28)) != 0)) && - (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + uVar9 * 4 + 0x28)) + 4)) == 7)))))) { - if (ABS((float)local_a4) <= ABS((float)local_ac)) { - return; - } - if (GHIDRA_INT(upGridIdx) < 0) { - return; - } - if (GHIDRA_INT((local_a8 * local_a8)) <= GHIDRA_INT(upGridIdx)) { - return; - } - if (((upGridIdx < 0x1c0) && - (iVar8 = *GHIDRA_CAST((GHIDRA_CAST(room) + upGridIdx * 4 + 0x24)), iVar8 != 0)) && - (*GHIDRA_CAST((iVar8 + 4)) == 7)) { - return; - } - if (GHIDRA_INT(piStack_88) < 0) { - return; - } - if (GHIDRA_INT((local_a8 * local_a8)) <= GHIDRA_INT(piStack_88)) { - return; - } - if (((piStack_88 < GHIDRA_CAST(0x1c0)) && - (iVar8 = *GHIDRA_CAST((GHIDRA_CAST(room) + GHIDRA_INT(piStack_88) * 4 + 0x24)), iVar8 != 0)) && - (*GHIDRA_CAST((iVar8 + 4)) == 7)) { - return; - } - local_a0 = (void *)0x2; - } - else { - local_a0 = (void *)0x1; - } - uVar6 = local_b4[0x114]; - if (((-1 < GHIDRA_INT(uVar6)) && (uVar6 < 0x1c0)) && - ((pit = *GHIDRA_CAST((GHIDRA_CAST(room) + uVar6 * 4 + 0x24)), - pit != GHIDRA_CAST(0x0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pit)) + 0x4)))) == 7)))) { - pit->_hasLadder = 0; - (GHIDRA_CAST((pit)))->GridEntity_Pit::UpdateCollision(); - } - pit = (GridEntity_Pit *) - __RTDynamicCast(local_8c,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Pit::RTTI_Type_Descriptor,0); - pit->_hasLadder = 1; - (GHIDRA_CAST((pit)))->GridEntity_Pit::UpdateCollision(); - piVar11[0x114] = uVar9; - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)); - piVar11[0xcf] = GHIDRA_INT(((float)(GHIDRA_INT(uVar9) % iVar8) * 40.0 + 40.0)); - piVar11[0xd0] = GHIDRA_INT(((float)(GHIDRA_INT(uVar9) / iVar8) * 40.0 + 120.0)); - *GHIDRA_CAST((GHIDRA_CAST(piVar11) + 0x171)) = 1; - manager = g_manager; - if (local_a0 == (void *)0x1) { - iVar8 = 0x42b40000; - } - else { - iVar8 = 0; - } - piVar11[0x3b] = iVar8; - local_a0 = (void *)0x43e; - seed_fart_sound_override(GHIDRA_CAST(&local_a0)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_a0),1.0,2,0,1.0,0.0); - return; - } - } - } - } - return; -} - -// 007a0080 -void Entity_Player::trigger_npc_death(Entity *npc) -{ - uint8_t bVar1; - int iVar2; - uint32_t uVar3; - Entity *pEVar4; - ItemConfig_Item *collectibleID; - Entity_Player *firstPlayer; - void *pvVar5; - int *effect; - int iVar6; - bool bVar7; - bool bVar8; - float distance; - Entity *pEVar9; - TemporaryEffects *pTVar10; - uint8_t local_3c [4]; - void *local_38; - Vector local_34; - int tmpEffect [2]; - Vector local_24; - Entity *killedNpc; - TemporaryEffects *local_18; - void *local_10; - uint8_t *puStack_c; - int local_8; - void *collectibles; - Game *game; - Manager *manager; - - pEVar4 = npc; - local_8 = 0xffffffff; - puStack_c = &LAB_00aff8d0; - local_10 = ExceptionList; - ExceptionList = &local_10; - killedNpc = (Entity *) - __RTDynamicCast(npc,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0, - __security_cookie ^ GHIDRA_UINT((tmpEffect + 10))); - if ((pEVar4->_flags & 0x40000000000) == 0) { - pTVar10 = &this->_temporaryeffects; - bVar1 = (GHIDRA_CAST((pTVar10)))->TemporaryEffects::HasCollectibleEffect(0x5d); - game = g_game; - if ((((bVar1 != 0) && ((this->_flags & 0x4000) == 0)) && - (bVar1 = Game::IsPaused(g_game), bVar1 == 0)) && ((~(uint8_t)game->_frameCount & 1) != 0)) { - AddHearts(this,1,0,0); - } - bVar1 = HasCollectible(this,0x19b,0); - if (bVar1 != 0) { - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x19b < GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) >> 2) && - (iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x66c)), iVar6 != 0)) { - local_34.x = *GHIDRA_CAST((iVar6 + 0x78)); - local_38 = (void *)0x0; - local_34.y = 0.0; - local_3c = (uint8_t [4])iVar6; - (GHIDRA_CAST((pTVar10)))->TemporaryEffects::AddEffect(local_3c,0,1); - } - if ((npc->_type == 1) && (1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) { - iVar6 = 4; - do { - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x19b < GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) >> 2) && - (iVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x66c)), iVar2 != 0)) { - local_34.x = *GHIDRA_CAST((iVar2 + 0x78)); - local_38 = (void *)0x0; - local_34.y = 0.0; - local_3c = (uint8_t [4])iVar2; - (GHIDRA_CAST((pTVar10)))->TemporaryEffects::AddEffect(local_3c,0,1); - } - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x3a)) { - iVar6 = GetTrinketMultiplier(this,0x3a); - bVar8 = false; - bVar7 = iVar6 == 0; -LAB_007a0232: - if (!bVar7 && bVar8 == iVar6 < 0) goto LAB_007a023d; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x3a); - bVar8 = SBORROW4(iVar2,1); - iVar6 = iVar2 + -1; - bVar7 = iVar2 == 1; - goto LAB_007a0232; - } -LAB_007a023d: - iVar2 = 0x29a; - iVar6 = GetTrinketMultiplier(this,0x3a); - if (iVar6 == 2) { - iVar2 = 0x514; - } - else if (2 < iVar6) { - iVar2 = 0x9c4; - } - iVar6 = __ftoui3(); - uVar3 = Random(); - if (uVar3 % 10000 < GHIDRA_UINT((iVar2 + iVar6))) { - pvVar5 = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar5) >> 2 < 0x3b) { - local_3c = (uint8_t [4])0x0; - } - else { - local_3c = *(uint8_t (*) [4])(GHIDRA_INT(pvVar5) + 0xe8); - } - local_34.x = *GHIDRA_CAST((GHIDRA_CAST(local_3c) + 0x78)); - local_38 = (void *)0x0; - local_34.y = 0.0; - (GHIDRA_CAST((pTVar10)))->TemporaryEffects::AddEffect(local_3c,1,1); - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x3c)) { - iVar6 = GetTrinketMultiplier(this,0x3c); - bVar8 = false; - bVar7 = iVar6 == 0; -LAB_007a0306: - if (!bVar7 && bVar8 == iVar6 < 0) goto LAB_007a030d; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x3c); - bVar8 = SBORROW4(iVar2,1); - iVar6 = iVar2 + -1; - bVar7 = iVar2 == 1; - goto LAB_007a0306; - } -LAB_007a030d: - iVar6 = 0x32; - iVar2 = GetTrinketMultiplier(this,0x3c); - if (iVar2 == 2) { - iVar6 = 100; - } - else if (2 < iVar2) { - iVar6 = 0x96; - } - iVar2 = __ftoui3(); - uVar3 = Random(); - if (uVar3 % 1000 < GHIDRA_UINT((iVar6 + iVar2))) { - (GHIDRA_CAST((pTVar10)))->TemporaryEffects::AddTrinketEffect(0x3c,1,1); - } - } - trigger_vampire_charm_kill(this); - bVar1 = HasCollectible(this,0x208,0); - if ((bVar1 != 0) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x160c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x160c)))) + 1, - 0xe < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x160c)))))) { - uVar3 = Random(); - pEVar4 = Game::SpawnEx(g_game,1000,0x31,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar3,0); - iVar6 = __RTDynamicCast(pEVar4,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); - uVar3 = 0; - *GHIDRA_CAST((iVar6 + 0xdc)) = 0; - *GHIDRA_CAST((iVar6 + 0xe0)) = 0xc1c00000; - *GHIDRA_CAST((iVar6 + 0x358)) = 0x3f800000; - do { - AddActiveCharge(this,1,uVar3,0,0,0); - uVar3 = uVar3 + 1; - } while (uVar3 < 4); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x160c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x160c)))) + -0xf; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x76)) { - iVar6 = GetTrinketMultiplier(this,0x76); - bVar8 = false; - bVar7 = iVar6 == 0; -LAB_007a0440: - if (!bVar7 && bVar8 == iVar6 < 0) goto LAB_007a044b; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x76); - bVar8 = SBORROW4(iVar2,1); - iVar6 = iVar2 + -1; - bVar7 = iVar2 == 1; - goto LAB_007a0440; - } -LAB_007a044b: - bVar1 = (GHIDRA_CAST((pTVar10)))->TemporaryEffects::HasTrinketEffect(0x76); - if (bVar1 == 0) { - uVar3 = 0x14; - iVar6 = GetTrinketMultiplier(this,0x76); - if (iVar6 == 2) { - uVar3 = 10; - } - else if (iVar6 == 3) { - uVar3 = 7; - } - uVar3 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0x760)))))->RNG::RandomInt(uVar3); - if (uVar3 == 0) { - (GHIDRA_CAST((pTVar10)))->TemporaryEffects::AddTrinketEffect(0x76,1,1); - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) >> 2 < 0x29) { - collectibleID = GHIDRA_CAST(0x0); - } - else { - collectibleID = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xa0)); - } - AddCostume(this,collectibleID,0); - } - } - } - pEVar4 = killedNpc; - if ((((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 1)) != '\0') && (killedNpc != GHIDRA_CAST(0x0))) && - (-1 < killedNpc->_spawnGridIndex)) && - (firstPlayer = Game::GetPlayer(g_game,0), this == firstPlayer)) { - award_fly_kill_points(&g_game->_scoreSheet,pEVar4); - } - bVar1 = HasCollectible(this,0x212,0); - pEVar4 = npc; - if ((bVar1 != 0) && (pvVar5 = g_game->_room, *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bbc)) == '\0')) { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bb8)) != GHIDRA_CAST(0x0)) { - if ((npc != *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bb8))) && ((npc->_flags & 0x20000000) == 0)) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bbc)) = 1; - } - npc = GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0x1bb8)); - msvc::multiset::erase(&npc); - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bb8)) = 0; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bbc)) == '\0') { - distance = (pEVar4->_pos).y; - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bc0)) = (pEVar4->_pos).x; - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1bc4)) = distance; - } - } - } - } - if (0 < this->_redStewBonusDuration) { - iVar2 = this->_redStewBonusDuration + 0x1e; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - iVar6 = 9000; - if (iVar2 < 9000) { - iVar6 = iVar2; - } - (this->_temporaryeffects)._cacheFlags = (this->_temporaryeffects)._cacheFlags | 1; - this->_redStewBonusDuration = iVar6; - } - if (((pEVar4->_flags & 0x80000000000000) != 0) && - (pvVar5 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x2c0), - pvVar5 != (void *)0x0)) { - collectibles = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectibles) >> 2 < 0x2c1) { - tmpEffect[0] = 0; - } - else { - tmpEffect[0] = *GHIDRA_CAST((GHIDRA_CAST(collectibles) + 0xb00)); - } - distance = (float)(*GHIDRA_CAST((tmpEffect[0] + 0x78)) - *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 8))); - tmpEffect[1] = 0; - local_24.y = 0.0; - if (this->_playerType == 0x1b) { - bVar1 = HasCollectible(this,0x26b,0); - local_24.x = 1.26117e-43; - if (bVar1 == 0) goto LAB_007a0661; - } - else { -LAB_007a0661: - local_24.x = 4.2039e-44; - } - if (GHIDRA_INT(distance) < GHIDRA_INT(local_24.x)) { - local_24.x = distance; - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(tmpEffect,0,1); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_3c),&this->_pos, - 60.0,2); - distance = 0.0; - if (local_34.y != 0.0) { - do { - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(local_38) + GHIDRA_INT(distance) * 4)); - if (((*GHIDRA_CAST((iVar6 + 0x28)) == 9) && (*GHIDRA_CAST((iVar6 + 0x173)) == '\0')) && - ((*GHIDRA_CAST((iVar6 + 0x438)) & 0x80000000) == 0)) { - *GHIDRA_CAST((iVar6 + 0x173)) = 1; - } - distance = (float)(GHIDRA_INT(distance) + 1); - } while (GHIDRA_UINT(distance) < GHIDRA_UINT(local_34.y)); - } - if (local_3c[0] == '\0') { - local_8 = 0; - tracked_alloc(1,local_38,0); - local_8 = 0xffffffff; - } - } - npc = GHIDRA_CAST(((pEVar4->_pos).y - (this->_pos).y)); - local_24.x = (pEVar4->_pos).x - (this->_pos).x; - local_24.y = (float)npc; - local_18 = GHIDRA_CAST(local_24.x); - distance = sqrtf((float)npc * (float)npc + local_24.x * local_24.x); - pEVar9 = npc; - pTVar10 = local_18; - if (0.0 < distance) { - pEVar9 = GHIDRA_CAST(((float)npc * (1.0 / distance))); - pTVar10 = GHIDRA_CAST(((float)local_18 * (1.0 / distance))); - local_24.x = (float)pTVar10; - local_24.y = (float)pEVar9; - } - local_34.x = (pEVar4->_pos).x - (float)pTVar10 * pEVar4->_size; - local_34.y = (pEVar4->_pos).y - (float)pEVar9 * pEVar4->_size; - trigger_set_dispatch(&this->_proceduralItems,3,pEVar4,&local_34,&local_24); - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0xbd)) { - iVar6 = GetTrinketMultiplier(this,0xbd); - bVar8 = false; - bVar7 = iVar6 == 0; -LAB_007a0809: - if (bVar7 || bVar8 != iVar6 < 0) goto LAB_007a0930; - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0xbd); - bVar8 = SBORROW4(iVar2,1); - iVar6 = iVar2 + -1; - bVar7 = iVar2 == 1; - goto LAB_007a0809; - } - pTVar10 = GHIDRA_CAST(0x1e); - iVar2 = 0x96; - iVar6 = GetTrinketMultiplier(this,0xbd); - manager = g_manager; - if (iVar6 == 2) { - pTVar10 = GHIDRA_CAST(0x2d); - iVar2 = 0xe1; - } - else if (iVar6 == 3) { - pTVar10 = GHIDRA_CAST(&DAT_0000003c); - iVar2 = 300; - } - local_18 = &this->_temporaryeffects; - if ((this->_temporaryeffects)._disabled == 0) { - for (effect = (this->_temporaryeffects)._effects._begin; - effect != (this->_temporaryeffects)._effects._end; effect = effect + 4) { - iVar6 = *GHIDRA_CAST(*effect); - if ((((iVar6 == 1) || (iVar6 == 3)) || (iVar6 == 4)) && ((GHIDRA_CAST(*effect))[1] == 0x3a)) { - if (iVar2 <= effect[2]) goto LAB_007a0930; - goto LAB_007a088a; - } - } - } - effect = GHIDRA_CAST(0x0); -LAB_007a088a: - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0xe9) { - tmpEffect[0] = 0; - } - else { - tmpEffect[0] = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xe8)); - } - tmpEffect[1] = 0; - local_24.y = 0.0; - local_24.x = (float)pTVar10; - if (effect == GHIDRA_CAST(0x0)) { - npc = GHIDRA_CAST(0x404); - seed_fart_sound_override(GHIDRA_CAST(&npc)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(npc),1.0,2,0,1.0,0.0); - local_24.y = 1.4013e-45; - } - else if (iVar2 - effect[2] < GHIDRA_INT(pTVar10)) { - local_24.x = (float)(iVar2 - effect[2]); - } - (GHIDRA_CAST((local_18)))->TemporaryEffects::AddEffect(tmpEffect,1,1); -LAB_007a0930: - if (killedNpc != GHIDRA_CAST(0x0)) { - PersistentGameData::AddBestiaryKill - (&g_manager->_persistentGameData,killedNpc->_type,killedNpc->_variant); - } - ExceptionList = local_10; - return; -} - -// 007a0970 -Entity_Bomb * Entity_Player::FireBomb(Vector *pos, Vector *vel, Entity *source) -{ - BitSet128 tearFlags; - uint64_t qVar1; - Entity_Player *pEVar2; - uint8_t bVar3; - uint32_t uVar4; - uint32_t seed; - Entity *spawned; - Entity_Bomb *bomb; - int iVar5; - Entity_Player *refSlot; - float unaff_ESI; - bool bVar6; - bool bVar7; - float fVar8; - int *piVar9; - int iVar10; - Entity_Player *local_a8; - float bombScale; - Entity_Player *local_a0; - Vector local_9c; - Vector *local_94; - float fStack_90; - Entity_Player *playerCopy; - Vector spawnX; - Vector VStack_80; - TearParams local_78; - uint32_t local_c; - uint32_t flagsHigh; - int *laser; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_a8); - local_a0 = GHIDRA_CAST(0x1e); - spawnX.x = pos->x + (this->_tearsOffset).x; - local_94 = vel; - spawnX.y = (this->_tearsOffset).y + pos->y; - local_9c.x = vel->x; - local_a8 = GHIDRA_CAST(vel->y); - playerCopy = this; - bVar3 = HasCollectible(this,0xe9,0); - if (bVar3 != 0) { - uVar4 = Random(); - local_a0 = GHIDRA_CAST(0x28); - fVar8 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 2.4; - local_a8 = GHIDRA_CAST((fVar8 * (float)local_a8)); - local_9c.x = fVar8 * local_9c.x; - } - bVar3 = HasCollectible(this,0xe0,0); - if (bVar3 != 0) { - local_9c.x = local_9c.x * 1.2; - local_a8 = GHIDRA_CAST(((float)local_a8 * 1.2)); - } - bombScale = 1.0; - GetTearHitParams(this,&local_78,5,1.0,GHIDRA_INT((char)this->_tearDisplacement),source); - uVar4 = 0; - bVar3 = HasCollectible(this,0x247,0); - if (bVar3 != 0) { - uVar4 = 0x13; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78._flags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = (uint32_t)local_78._flags._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = (uint32_t)local_78._flags._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78._flags._h)) + 0x4))); - fStack_90 = check_bomb_tearflags(this,tearFlags); - if (0.55 < local_78._tearScale) { - if (local_78._tearScale <= 0.75) { - bombScale = 0.8; - fStack_90 = fStack_90 * 0.6; - } - else if (2.0 < local_78._tearScale) { - fStack_90 = fStack_90 * 1.2; - } - } - else { - fStack_90 = fStack_90 * 0.45; - bombScale = 0.65; - } - local_9c.y = local_78._tearDamage; - fVar8 = local_78._tearDamage * 10.0; - local_78._tearDamage = local_78._tearDamage * 5.0 + 30.0; - if (fVar8 <= local_78._tearDamage) { - local_78._tearDamage = fVar8; - } - if (1.5 <= fStack_90) { - local_78._tearDamage = local_78._tearDamage + 25.0; - } - seed = Random(); - VStack_80.y = -this->_tearheight / 23.75; - VStack_80.x = local_9c.x * VStack_80.y; - VStack_80.y = (float)local_a8 * VStack_80.y; - spawned = Game::SpawnEx(g_game,4,uVar4,&spawnX,&VStack_80,GHIDRA_CAST(this),0,seed,0); - bomb = (Entity_Bomb *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor); - *GHIDRA_CAST(&bomb->_flags) = GHIDRA_UINT(bomb->_flags) | 0x4000000; - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&bomb->_flags) + 4)); - bomb->_entityGridCollisionClass = 6; - *GHIDRA_CAST((GHIDRA_INT(&bomb->_flags) + 4)) = flagsHigh; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x85)) { - iVar5 = GetTrinketMultiplier(this,0x85); - bVar7 = false; - bVar6 = iVar5 == 0; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) != '\0') { - bVar6 = true; - goto LAB_007a0c76; - } - iVar10 = GetTrinketMultiplier(this,0x85); - bVar7 = SBORROW4(iVar10,1); - iVar5 = iVar10 + -1; - bVar6 = iVar10 == 1; - } - bVar6 = !bVar6 && bVar7 == iVar5 < 0; -LAB_007a0c76: - iVar5 = *GHIDRA_CAST(bomb); - *GHIDRA_CAST(&(bomb->_tearFlags)._l) = (uint32_t)local_78._flags._l; - *GHIDRA_CAST((GHIDRA_INT(&(bomb->_tearFlags)._l) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78._flags._l)) + 0x4))); - *GHIDRA_CAST(&(bomb->_tearFlags)._h) = (uint32_t)local_78._flags._h; - *GHIDRA_CAST((GHIDRA_INT(&(bomb->_tearFlags)._h) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78._flags._h)) + 0x4))); - bomb->_loadCostumes = 1; - local_a8 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_a0[-1])) + 0x2ef1)))); - if (!bVar6) { - local_a8 = local_a0; - } - bomb->_explosionCountdown1 = GHIDRA_INT(local_a8); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((bomb)) + 0x414)))) = local_a8; - bomb->_scale = fStack_90; - iVar10 = 0xff; - bomb->_explosionDamage = local_78._tearDamage; - bomb->_radiusMultiplier = bombScale; - bomb->_isFetus = 1; - (**(code **)(iVar5 + 0x3c))(&local_78._tearColor,0xffffffff,0xff,0); - if (bomb->_parent != 0) { - msvc::multiset::erase((&local_78)[-1]._tearColor._colorize); - } - bomb->_parent = this; - msvc::multiset::insert(&bomb->_parent); - if (((GHIDRA_UINT((bomb->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagPiercing._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(bomb->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((bomb->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagPiercing._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(bomb->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._h)) + 0x4)))) != 0)) { - bomb->SetCollisionDamage(unaff_ESI * 2.5); - } - if ((bomb->_variant == 0x13) || (bomb->_variant == 0x14)) { - fVar8 = atan2f(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_a8)) + 0x4)))),*GHIDRA_CAST(local_a8)); - bomb->_explosionCountdown1 = iVar10 + 0x3c; - bomb->_rocketAngle = fVar8 * 57.295776; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((bomb)) + 0x414)))) = iVar10 + 0x3c; - } - bVar3 = HasCollectible(this,0x18b,0); - if (bVar3 != 0) { - uVar4 = Random(); - bVar3 = HasCollectible(local_a0,0x76,0); - pEVar2 = local_a0; - spawned = Game::SpawnEx(g_game,7,2 - (bVar3 != 0),&local_9c,&g_vectorZero,GHIDRA_CAST(local_a0),3, - uVar4,0); - laser = GHIDRA_CAST(__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor,0)); - laser[0xd3] = 0; - laser[0xd4] = -0x3f600000; - refSlot = GHIDRA_CAST((laser + 0xef)); - if (*GHIDRA_CAST(refSlot) != 0.0) { - local_a8 = refSlot; - msvc::multiset::erase(&local_a8); - } - *GHIDRA_CAST(refSlot) = bomb; - msvc::multiset::insert(refSlot); - piVar9 = GHIDRA_CAST(0x0); - laser[0xd6] = 0x453b8000; - iVar5 = *GHIDRA_CAST((GHIDRA_INT(&(pEVar2->_tearFlags)._l) + 4)); - qVar1 = (pEVar2->_tearFlags)._h; - iVar10 = *GHIDRA_CAST((GHIDRA_INT(&(pEVar2->_tearFlags)._h) + 4)); - laser[0x10a] = GHIDRA_INT((pEVar2->_tearFlags)._l); - laser[0x10b] = iVar5; - laser[0x10c] = GHIDRA_INT(qVar1); - laser[0x10d] = iVar10; - (**(code **)(*laser + 0x3c))(&pEVar2->_laserColor,0xffffffff,0xff,0,1); - (**(code **)(*piVar9 + 0x40))(pEVar2->_damage); - laser[0x12f] = 0x42480000; - refSlot = GHIDRA_CAST((laser + 0xf2)); - if (laser[0xf2] != 0) { - local_a8 = refSlot; - msvc::multiset::erase(&local_a8); - } - *GHIDRA_CAST(refSlot) = pEVar2; - msvc::multiset::insert(refSlot); - } - if ((bomb->_variant == 0x13) || (bomb->_variant == 0x14)) { - bomb->Update(); - } - return bomb; -} - -// 007a1090 -uint8_t Entity_Player::TriggerDeath(uint8_t checkOnly) -{ - code *pcVar1; - uint8_t bVar2; - uint32_t uVar3; - Entity_Player *tmpPlayer; - ColorMod *color; - int *piVar4; - int iVar5; - RNG *guppysCollarRng; - ColorMod *extraout_EAX; - ColorMod *extraout_EAX_00; - Entity_Player **ppEVar6; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - short newDeadCatLives; - uint32_t slotIndex; - Entity_Player *extraout_ECX; - Entity_Player *extraout_ECX_00; - Entity_Player *extraout_ECX_01; - Entity_Player *extraout_ECX_02; - Entity_Player *extraout_ECX_03; - void *extraout_ECX_04; - Entity_Player *extraout_ECX_05; - Entity_Player *extraout_ECX_06; - Entity_Player *extraout_ECX_07; - Entity_Player *extraout_ECX_08; - Entity_Player *extraout_ECX_09; - Entity_Player *extraout_ECX_10; - Entity_Player *extraout_ECX_11; - Entity_Player *extraout_ECX_12; - Entity_Player *extraout_ECX_13; - Entity_Player *extraout_ECX_14; - Entity_Player *extraout_ECX_15; - Entity_Player *extraout_ECX_16; - Entity_Player *extraout_ECX_17; - void *pvVar7; - int unused; - Entity_Player *extraout_ECX_18; - Entity_Player *extraout_ECX_19; - Entity_Player *extraout_ECX_20; - int unused_00; - Entity_Player *extraout_ECX_21; - Entity_Player *extraout_ECX_22; - Entity_Player *extraout_ECX_23; - Entity_Player *extraout_ECX_24; - Entity_Player *extraout_ECX_25; - Entity_Player *extraout_ECX_26; - Entity_Player *tmpPlayer; - char *pocketCopySrc; - Entity_Player **playerIter; - uint32_t uVar9; - int iVar10; - uint32_t *pocketCopyDst; - uint32_t *puVar11; - ColorMod *color_00; - Entity_Player *local_84; - Entity_Player *local_80; - Vector local_7c; - int effectKey [3]; - uint32_t local_68; - Color gibColor; - Color boneGibColor; - uint32_t stackCookie; - Entity_Player *deathPlayer; - float forgottenBodyY; - Manager *manager; - Entity_Player *parentPlayer; - void *rngArray; - - stackCookie = __security_cookie ^ GHIDRA_UINT(&local_84); - local_84 = this; - if (this->_variant == 1) { - if (checkOnly == 0) { - coop_baby_death_effect(this); - PlayerManager::trigger_coop_baby_death(&g_game->_playerManager,this); - this->_visible = 0; - return 0; - } - return 0; - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c8129c) && - (_Init_thread_header(&DAT_00c8129c), DAT_00c8129c == -1)) { - _atexit(GHIDRA_CAST<_func_4879 *>(&LAB_00b15b90)); - _Init_thread_footer(&DAT_00c8129c); - } - g_triggerDeathPlayersEnd = g_triggerDeathPlayers; - local_80 = GHIDRA_CAST(this->_twinPlayer); - if (local_80 == GHIDRA_CAST(0x0)) { -LAB_007a114f: - local_80 = this; - if (g_triggerDeathPlayersEnd == DAT_00c812a8) { -LAB_007a11cc: - msvc::vector::_Emplace_reallocate(g_triggerDeathPlayersEnd,&local_80); - } - else { - *g_triggerDeathPlayersEnd = this; - g_triggerDeathPlayersEnd = g_triggerDeathPlayersEnd + 1; - } - } - else { - if (((local_80->_playerIndex != -1) && (local_80->_playerIndex < this->_playerIndex)) && - (local_80 != this)) { - if (g_triggerDeathPlayers == DAT_00c812a8) { - msvc::vector::_Emplace_reallocate(g_triggerDeathPlayers,&local_80); - } - else { - *g_triggerDeathPlayers = local_80; - g_triggerDeathPlayersEnd = g_triggerDeathPlayersEnd + 1; - } - goto LAB_007a114f; - } - if (g_triggerDeathPlayers == DAT_00c812a8) { - local_80 = this; - msvc::vector::_Emplace_reallocate(g_triggerDeathPlayers,&local_80); - } - else { - *g_triggerDeathPlayers = this; - g_triggerDeathPlayersEnd = g_triggerDeathPlayersEnd + 1; - } - local_80 = GHIDRA_CAST(this->_twinPlayer); - if (g_triggerDeathPlayersEnd == DAT_00c812a8) goto LAB_007a11cc; - *g_triggerDeathPlayersEnd = local_80; - g_triggerDeathPlayersEnd = g_triggerDeathPlayersEnd + 1; - } - if (((checkOnly == 0) && (bVar2 = HasTrinket(this,0x17,0), bVar2 != 0)) && - (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0xd)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x52); - } - local_80 = GHIDRA_CAST((*g_triggerDeathPlayers)->_playerType); - for (ppEVar6 = g_triggerDeathPlayers; ppEVar6 != g_triggerDeathPlayersEnd; ppEVar6 = ppEVar6 + 1) - { - tmpPlayer = *ppEVar6; - if ((tmpPlayer->_temporaryeffects)._disabled == 0) { - for (piVar4 = (tmpPlayer->_temporaryeffects)._effects._begin; - piVar4 != (tmpPlayer->_temporaryeffects)._effects._end; piVar4 = piVar4 + 4) { - if ((*GHIDRA_CAST(*piVar4) == 0) && ((GHIDRA_CAST(*piVar4))[1] == 0x71)) goto LAB_007a15d3; - } - } - } - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - uVar9 = 0; - uVar3 = GetMaxPocketItems(*ppEVar6); - if (uVar3 != 0) { - do { - tmpPlayer = *ppEVar6; - uVar3 = uVar9; - if (GHIDRA_INT(uVar9) < 1) { - uVar3 = 0; - } - slotIndex = 3; - if (GHIDRA_INT(uVar3) < 3) { - slotIndex = uVar3; - } - if ((tmpPlayer->_pocketSlots[slotIndex * 2 + 1] == 1) && - (tmpPlayer->_pocketSlots[slotIndex * 2] == 0x59)) goto LAB_007a15d3; - uVar9 = uVar9 + 1; - uVar3 = GetMaxPocketItems(tmpPlayer); - } while (uVar9 < uVar3); - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } -LAB_007a12d4: - tmpPlayer = GHIDRA_CAST(FUN_007a0fe0()); - tmpPlayer = local_84; - if (tmpPlayer != GHIDRA_CAST(0x0)) { - if (checkOnly != 0) { - return 1; - } - RemoveCollectible(tmpPlayer,0xb,0,0,1); - parentPlayer = extraout_ECX; - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - tmpPlayer = *ppEVar6; - parentPlayer = GHIDRA_CAST(0x0); - if (tmpPlayer != GHIDRA_CAST(0x0)) { - LuaEngine::RunScript(GHIDRA_CAST(tmpPlayer),0xb,tmpPlayer == tmpPlayer); - parentPlayer = extraout_ECX_00; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } - goto LAB_007a1331; - } - if (local_84->_playerType == 8) { - if (checkOnly != 0) { - return 1; - } - LuaEngine::RunScript(GHIDRA_CAST(*g_triggerDeathPlayers),0x14c,1); - parentPlayer = extraout_ECX_09; - } - else { - tmpPlayer = GHIDRA_CAST(FUN_007a0fe0()); - if (tmpPlayer == GHIDRA_CAST(0x0)) { - tmpPlayer = GHIDRA_CAST(FUN_007a0fe0()); - if (tmpPlayer == GHIDRA_CAST(0x0)) { - tmpPlayer = GHIDRA_CAST(FUN_007a0fe0()); - if ((tmpPlayer == GHIDRA_CAST(0x0)) || - (guppysCollarRng = GetCollectibleRNG(tmpPlayer,0xd4), (guppysCollarRng->_seed & 1) == 0)) - { - tmpPlayer = GHIDRA_CAST(FUN_007a0fe0()); - if (tmpPlayer == GHIDRA_CAST(0x0)) { - parentPlayer = GHIDRA_CAST(FUN_007a0fe0()); - if (parentPlayer == GHIDRA_CAST(0x0)) { - parentPlayer = GHIDRA_CAST(FUN_007a1020()); - if (parentPlayer != GHIDRA_CAST(0x0)) { - iVar10 = GetTrinketMultiplier(parentPlayer,0x1c); - if (iVar10 == 1) { - uVar3 = 0x16; - } - else { - iVar10 = GetTrinketMultiplier(parentPlayer,0x1c); - uVar3 = 0x32; - if (iVar10 == 2) { - uVar3 = 0x21; - } - } - pvVar7 = (parentPlayer->_trinketRNGs)._end; - if (GHIDRA_INT((GHIDRA_INT(pvVar7) - GHIDRA_INT((parentPlayer->_trinketRNGs)._begin) & 0xfffffff0U)) < - 0x1c1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Trinket ID out of bounds!\n")); - pvVar7 = (parentPlayer->_trinketRNGs)._end; - } - rngArray = (parentPlayer->_trinketRNGs)._begin; - uVar9 = (GHIDRA_INT(pvVar7) - GHIDRA_INT(rngArray) >> 4) - 1; - if (0x1c < uVar9) { - uVar9 = 0x1c; - } - uVar9 = (GHIDRA_CAST((GHIDRA_CAST((uVar9 * 0x10 + GHIDRA_INT(rngArray))))))->RNG::RandomInt(100); - if (uVar9 < uVar3) { - if (checkOnly != 0) { - return 1; - } - ReviveFromTrinket(*g_triggerDeathPlayers,0x1c,unused); - parentPlayer = extraout_ECX_18; - goto LAB_007a1335; - } - } - parentPlayer = GHIDRA_CAST(FUN_007a0fe0()); - if (parentPlayer == GHIDRA_CAST(0x0)) { - tmpPlayer = GHIDRA_CAST(FUN_007a1020()); - parentPlayer = extraout_ECX_20; - if (tmpPlayer == GHIDRA_CAST(0x0)) { - if ((tmpPlayer->_playerType == 0x1f) && - (bVar2 = HasCollectible(tmpPlayer,0x26b,0), parentPlayer = extraout_ECX_22, - bVar2 != 0)) { - if (checkOnly != 0) { - return 1; - } - RemoveCollectible(tmpPlayer,0x26b,0,0,1); - LuaEngine::RunScript(GHIDRA_CAST(*g_triggerDeathPlayers),0x26b,1); - parentPlayer = extraout_ECX_23; - } - else if (checkOnly != 0) { - return 0; - } - } - else if (((g_manager->_persistentGameData)._achievements[0x52] == 0) && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) { - if (checkOnly != 0) { - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0xd) { - return 1; - } - return 0; - } - } - else { - if (checkOnly != 0) { - return 1; - } - TryRemoveTrinket(tmpPlayer,0x17); - (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::RemoveTrinketEffect(0x17,-1); - ReviveFromTrinket(*g_triggerDeathPlayers,0x17,unused_00); - parentPlayer = extraout_ECX_21; - } - } - else { - if (checkOnly != 0) { - return 1; - } - RemoveCollectible(parentPlayer,0x137,0,0,1); - LuaEngine::RunScript(GHIDRA_CAST(*g_triggerDeathPlayers),0x137,1); - parentPlayer = extraout_ECX_19; - } - } - else { - if (checkOnly != 0) { - return 1; - } - RemoveCollectible(parentPlayer,0xa1,0,0,1); - LuaEngine::RunScript(GHIDRA_CAST(*g_triggerDeathPlayers),0xa1,1); - parentPlayer = extraout_ECX_17; - } - } - else { - if (checkOnly != 0) { - return 1; - } - RemoveCollectible(tmpPlayer,0x14c,0,0,1); - parentPlayer = extraout_ECX_15; - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - deathPlayer = *ppEVar6; - parentPlayer = GHIDRA_CAST(0x0); - if (deathPlayer != GHIDRA_CAST(0x0)) { - LuaEngine::RunScript(GHIDRA_CAST(deathPlayer),0x14c,tmpPlayer == deathPlayer); - parentPlayer = extraout_ECX_16; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } - } - } - else { - if (checkOnly != 0) { - return 1; - } - parentPlayer = extraout_ECX_13; - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - deathPlayer = *ppEVar6; - parentPlayer = GHIDRA_CAST(0x0); - if (deathPlayer != GHIDRA_CAST(0x0)) { - LuaEngine::RunScript(GHIDRA_CAST(deathPlayer),0xd4,tmpPlayer == deathPlayer); - parentPlayer = extraout_ECX_14; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } - } - } - else { - if (checkOnly != 0) { - return 1; - } - RemoveCollectible(tmpPlayer,0x2b0,0,0,1); - parentPlayer = extraout_ECX_11; - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - deathPlayer = *ppEVar6; - parentPlayer = GHIDRA_CAST(0x0); - if (deathPlayer != GHIDRA_CAST(0x0)) { - LuaEngine::RunScript(GHIDRA_CAST(deathPlayer),0x2b0,tmpPlayer == deathPlayer); - parentPlayer = extraout_ECX_12; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } - } - } - else { - if (checkOnly != 0) { - return 1; - } - iVar10 = tmpPlayer->_deadCatLives + -1; - newDeadCatLives = 0; - if (0 < iVar10) { - newDeadCatLives = (short)iVar10; - } - tmpPlayer->_deadCatLives = newDeadCatLives; - parentPlayer = (Entity_Player *) - (*GHIDRA_CAST((GHIDRA_INT((tmpPlayer->_collectibleCounts)._begin) + 0x144)) * 9 + -8); - if (GHIDRA_INT(newDeadCatLives) < GHIDRA_INT(parentPlayer)) { - do { - RemoveCollectible(tmpPlayer,0x51,0,0,1); - parentPlayer = (Entity_Player *) - (*GHIDRA_CAST((GHIDRA_INT((tmpPlayer->_collectibleCounts)._begin) + 0x144)) * 9 + -8); - } while (GHIDRA_INT(tmpPlayer->_deadCatLives) < GHIDRA_INT(parentPlayer)); - } - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - deathPlayer = *ppEVar6; - parentPlayer = GHIDRA_CAST(0x0); - if (deathPlayer != GHIDRA_CAST(0x0)) { - LuaEngine::RunScript(GHIDRA_CAST(deathPlayer),0x51,tmpPlayer == deathPlayer); - parentPlayer = extraout_ECX_10; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } - } - } -LAB_007a1335: - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - parentPlayer = *ppEVar6; - if (parentPlayer != GHIDRA_CAST(0x0)) { - parentPlayer->_pitfallState = 0; - parentPlayer->_isControlsEnabled = 1; - parentPlayer->_entityCollisionClass = 4; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } - ppEVar6 = g_triggerDeathPlayers; - tmpPlayer = *g_triggerDeathPlayers; - if ((tmpPlayer->_dead != 0) && (tmpPlayer->_parent == 0)) { - local_7c.x = (float)&g_game->_playerManager; - bVar2 = PlayerManager::IsCoopPlay(GHIDRA_CAST(local_7c.x)); - parentPlayer = extraout_ECX_01; - if ((bVar2 != 0) && - (((uVar3 = PlayerManager::GetNumAlivePlayers(GHIDRA_CAST(local_7c.x)), - parentPlayer = extraout_ECX_02, 1 < uVar3 && (tmpPlayer->_isCoopGhost == 0)) && - (ppEVar6 != g_triggerDeathPlayersEnd)))) { - do { - parentPlayer = GHIDRA_CAST(0x0); - if (*ppEVar6 != GHIDRA_CAST(0x0)) { - MorphToCoopGhost(*ppEVar6); - parentPlayer = extraout_ECX_03; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } - } - tmpPlayer = *g_triggerDeathPlayers; - if (tmpPlayer->_dead == 0) { - if (((local_80 == GHIDRA_CAST(0x3)) && (tmpPlayer->_playerType != 0xc)) && - (bVar2 = HasCollectible(tmpPlayer,0x26b,0), parentPlayer = extraout_ECX_24, bVar2 != 0)) { - tmpPlayer = *g_triggerDeathPlayers; - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1db); - parentPlayer = extraout_ECX_25; - if (bVar2 != 0) { - pvVar7 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x76c < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) & - 0xfffffffcU))) && (iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x76c)), iVar10 != 0)) { - effectKey[2] = *GHIDRA_CAST((iVar10 + 0x78)); - effectKey[1] = 0; - local_68 = 0; - effectKey[0] = iVar10; - (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::RemoveEffect(effectKey,-1); - } - (*g_triggerDeathPlayers)->_maxHearts = 0; - (*g_triggerDeathPlayers)->_redHearts = 0; - (*g_triggerDeathPlayers)->_playerType = 0xc; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0xffff; - update_player_skin(tmpPlayer); - EvaluateItems(tmpPlayer); - TryPreventDeath(tmpPlayer); - parentPlayer = extraout_ECX_26; - } - } - RemoveCollectible(*g_triggerDeathPlayers,local_80,parentPlayer); - ppEVar6 = g_triggerDeathPlayersEnd; - playerIter = g_triggerDeathPlayers; - if (g_triggerDeathPlayers == g_triggerDeathPlayersEnd) { - return 1; - } - do { - tmpPlayer = *playerIter; - if (tmpPlayer != GHIDRA_CAST(0x0)) { - pvVar7 = (tmpPlayer->_collectibleRNGs)._end; - if (GHIDRA_INT((GHIDRA_INT(pvVar7) - GHIDRA_INT((tmpPlayer->_collectibleRNGs)._begin) & 0xfffffff0U)) < 0xd41) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Collectible ID out of bounds!\n")); - pvVar7 = (tmpPlayer->_collectibleRNGs)._end; - } - rngArray = (tmpPlayer->_collectibleRNGs)._begin; - uVar3 = (GHIDRA_INT(pvVar7) - GHIDRA_INT(rngArray) >> 4) - 1; - uVar9 = 0xd4; - if (uVar3 < 0xd4) { - uVar9 = uVar3; - } - puVar11 = GHIDRA_CAST((uVar9 * 0x10 + GHIDRA_INT(rngArray))); - uVar3 = *puVar11; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar3 = *puVar11; - if (uVar3 == 0) { - pcVar1 = (code *)swi(3); - bVar2 = (*pcVar1)(); - return bVar2; - } - } - uVar3 = uVar3 >> ((uint8_t)puVar11[1] & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)puVar11[2] & 0x1f) ^ uVar3; - *puVar11 = uVar3 >> ((uint8_t)puVar11[3] & 0x1f) ^ uVar3; - pvVar7 = (tmpPlayer->_trinketRNGs)._end; - if (GHIDRA_INT((GHIDRA_INT(pvVar7) - GHIDRA_INT((tmpPlayer->_trinketRNGs)._begin) & 0xfffffff0U)) < 0x1c1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Trinket ID out of bounds!\n")); - pvVar7 = (tmpPlayer->_trinketRNGs)._end; - } - rngArray = (tmpPlayer->_trinketRNGs)._begin; - uVar3 = (GHIDRA_INT(pvVar7) - GHIDRA_INT(rngArray) >> 4) - 1; - if (0x1c < uVar3) { - uVar3 = 0x1c; - } - puVar11 = GHIDRA_CAST((uVar3 * 0x10 + GHIDRA_INT(rngArray))); - uVar3 = *puVar11; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar3 = *puVar11; - if (uVar3 == 0) { - pcVar1 = (code *)swi(3); - bVar2 = (*pcVar1)(); - return bVar2; - } - } - uVar3 = uVar3 >> ((uint8_t)puVar11[1] & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)puVar11[2] & 0x1f) ^ uVar3; - *puVar11 = uVar3 >> ((uint8_t)puVar11[3] & 0x1f) ^ uVar3; - init_forgotten_twin(tmpPlayer); - UpdateCanShoot(tmpPlayer); - tmpPlayer->ResetColor(); - ppEVar6 = g_triggerDeathPlayersEnd; - } - playerIter = playerIter + 1; - } while (playerIter != ppEVar6); - return 1; - } - parentPlayer = GHIDRA_CAST(tmpPlayer->_parent); - if (((parentPlayer == GHIDRA_CAST(0x0)) || (tmpPlayer->_variant != 0)) || - (parentPlayer->_type != 1)) { - PlayerManager::trigger_coop_baby_death(&g_game->_playerManager,tmpPlayer); - tmpPlayer->_visible = 0; - return 1; - } - local_7c.x = (float)&tmpPlayer->_temporaryeffects; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_7c.x))))->TemporaryEffects::HasCollectibleEffect(0x29b); - manager = g_manager; - if (bVar2 != 0) { - pvVar7 = (g_manager->_itemConfig)._collectibles._begin; - if ((0xa6c < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) & 0xfffffffcU)) - ) && (iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0xa6c)), iVar10 != 0)) { - effectKey[2] = *GHIDRA_CAST((iVar10 + 0x78)); - effectKey[1] = 0; - local_68 = 0; - effectKey[0] = iVar10; - (GHIDRA_CAST((GHIDRA_CAST(local_7c.x))))->TemporaryEffects::RemoveEffect(effectKey,-1); - pvVar7 = extraout_ECX_04; - } - PlayerManager::RemoveCoPlayer(&g_game->_playerManager,*g_triggerDeathPlayers,(uint8_t)pvVar7); - RemoveCollectible(parentPlayer,0x29b,0,0,1); - iVar10 = 5; - do { - iVar5 = iVar10; - local_7c.x = ((*g_triggerDeathPlayers)->_pos).x; - local_7c.y = ((*g_triggerDeathPlayers)->_pos).y; - parentPlayer->_numBlueSpiders = parentPlayer->_numBlueSpiders + 1; - spawn_blue_spider(&local_7c,GHIDRA_CAST(parentPlayer),&g_vectorZero); - manager = g_manager; - iVar10 = iVar5 + -1; - } while (iVar10 != 0); - iVar10 = (*g_triggerDeathPlayers)->_playerType; - if ((iVar10 == 0x10) || (iVar10 == 0x23)) { - local_84 = GHIDRA_CAST(0x1b); - seed_fart_sound_override(GHIDRA_CAST(&local_84)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_84),1.0,2,0,1.0,0.0); - gibColor._offset[0] = 0.0; - gibColor._tint[0] = 1.0; - gibColor._tint[1] = 1.0; - gibColor._tint[2] = 1.0; - gibColor._tint[3] = 1.0; - gibColor._offset[1] = 0.0; - gibColor._offset[2] = 0.0; - gibColor._colorize[0] = 0.0; - gibColor._colorize[1] = 0.0; - gibColor._colorize[2] = 0.0; - gibColor._colorize[3] = 0.0; - local_7c.x = 2.10195e-44; - spawn_gibs(&(*g_triggerDeathPlayers)->_pos,0xe,80.0,GHIDRA_CAST(&local_7c),GHIDRA_CAST(tmpPlayer), - GHIDRA_CAST(&gibColor),&g_vectorZero,1.0); - return 1; - } - if (((iVar10 == 10) || (iVar10 == 0x1f)) || (iVar10 == 0x27)) { - local_84 = GHIDRA_CAST(0x50); - seed_fart_sound_override(GHIDRA_CAST(&local_84)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_84),1.0,2,0,1.0,0.0); - uVar3 = Random(); - Game::SpawnEx(g_game,1000,0xf,&(*g_triggerDeathPlayers)->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar3,0); - return 1; - } - local_84 = GHIDRA_CAST(0x1e); - seed_fart_sound_override(GHIDRA_CAST(&local_84)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_84),1.0,2,0,1.0,0.0); - uVar3 = Random(); - Game::SpawnEx(g_game,1000,2,&(*g_triggerDeathPlayers)->_pos,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar3, - 0); - (GHIDRA_CAST((&gibColor)))->Color::Color(); - local_7c.x = 9.80909e-45; - spawn_gibs(&tmpPlayer->_pos,iVar5 + 7,80.0,GHIDRA_CAST(&local_7c),GHIDRA_CAST(tmpPlayer),color,&g_vectorZero, - 1.0); - return 1; - } - iVar10 = tmpPlayer->_playerType; - if ((iVar10 == 0x10) || (iVar10 == 0x23)) { - local_84 = GHIDRA_CAST(0x1b); - seed_fart_sound_override(GHIDRA_CAST(&local_84)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_84),1.25,2,0,1.0,0.0); - (GHIDRA_CAST((&boneGibColor)))->Color::Color(); - local_80 = GHIDRA_CAST(0xf); - puVar11 = GHIDRA_CAST(&local_80); - iVar10 = 0xe; - color_00 = extraout_EAX_00; - } - else { - bVar2 = extraout_CL; - if (((iVar10 == 10) || (iVar10 == 0x1f)) || (iVar10 == 0x27)) goto LAB_007a1f38; - local_84 = GHIDRA_CAST(0x1e); - seed_fart_sound_override(GHIDRA_CAST(&local_84)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_84),1.0,2,0,1.0,0.0); - uVar3 = Random(); - Game::SpawnEx(g_game,1000,2,&tmpPlayer->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar3,0); - (GHIDRA_CAST((&gibColor)))->Color::Color(); - iVar10 = 8; - local_7c.x = (float)&DAT_00000007; - puVar11 = GHIDRA_CAST(&local_7c); - color_00 = extraout_EAX; - } - spawn_gibs(&tmpPlayer->_pos,iVar10,80.0,puVar11,GHIDRA_CAST(tmpPlayer),color_00,&g_vectorZero,1.0); - bVar2 = extraout_CL_00; -LAB_007a1f38: - PlayerManager::RemoveCoPlayer(&g_game->_playerManager,*g_triggerDeathPlayers,bVar2); - return 1; -LAB_007a15d3: - if (tmpPlayer == GHIDRA_CAST(0x0)) goto LAB_007a12d4; - if (checkOnly != 0) { - return 1; - } - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x71); - if (bVar2 == 0) { - parentPlayer = GHIDRA_CAST(0x0); - piVar4 = tmpPlayer->_pocketSlots; -LAB_007a1630: - if ((piVar4[1] != 1) || (*piVar4 != 0x59)) goto LAB_007a163b; - if (parentPlayer < GHIDRA_CAST(0x3)) { - pocketCopySrc = - (tmpPlayer->_sprite)._filename._buf + GHIDRA_INT(&parentPlayer->_baitedCountdown) * 8 + -0x40; - pocketCopyDst = - (uint32_t *) - (GHIDRA_INT((&(tmpPlayer->_sprite)._filename + -3)) + GHIDRA_INT(&parentPlayer->_baitedCountdown) * 8); - for (uVar3 = (3 - GHIDRA_INT(parentPlayer)) * 2 & 0x3ffffffe; parentPlayer = GHIDRA_CAST(0x0), - uVar3 != 0; uVar3 = uVar3 - 1) { - *pocketCopyDst = *GHIDRA_CAST(pocketCopySrc); - pocketCopySrc = pocketCopySrc + 4; - pocketCopyDst = pocketCopyDst + 1; - } - } - tmpPlayer->_pocketSlots[6] = 0; - tmpPlayer->_pocketSlots[7] = 1; - goto LAB_007a1683; - } - parentPlayer = extraout_ECX_05; - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - parentPlayer = GHIDRA_CAST(0x0); - if (*ppEVar6 != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((&(*ppEVar6)->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x71,1); - parentPlayer = extraout_ECX_06; - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } -LAB_007a1683: - ppEVar6 = g_triggerDeathPlayers; - if (g_triggerDeathPlayers != g_triggerDeathPlayersEnd) { - do { - tmpPlayer = *ppEVar6; - if (tmpPlayer != GHIDRA_CAST(0x0)) { - if (-1 < tmpPlayer->_playerIndex) { - Revive(tmpPlayer); - } - tmpPlayer->_soulHearts = 0; - tmpPlayer->_blackHearts = 0; - tmpPlayer->_eternalHearts = 0; - tmpPlayer->_boneHeartsMask = 0; - tmpPlayer->_boneHearts = 0; - tmpPlayer->_rottenHearts = 0; - if (tmpPlayer->_maxHearts < 1) { - iVar10 = GetHealthType(tmpPlayer); - if (iVar10 == 4) { - tmpPlayer->_redHearts = 0; - AddBoneHearts(tmpPlayer,1); - } - else { - iVar10 = GetHealthType(tmpPlayer); - if (iVar10 == 3) { - tmpPlayer->_redHearts = 2; - tmpPlayer->_maxHearts = 2; - } - else if (tmpPlayer->_playerType == 0x12) { - tmpPlayer->_maxHearts = 2; - tmpPlayer->_redHearts = 1; - } - else { - tmpPlayer->_redHearts = 0; - tmpPlayer->_soulHearts = 1; - } - } - } - else { - tmpPlayer->_redHearts = 1; - iVar10 = GetHealthType(tmpPlayer); - if (iVar10 == 3) { - tmpPlayer->_redHearts = 2; - } - } - pvVar7 = tmpPlayer->_forgottenBody; - tmpPlayer->_visible = 1; - tmpPlayer->_damageCooldown = 0x5a; - if (pvVar7 != (void *)0x0) { - forgottenBodyY = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x340)); - (tmpPlayer->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x33c)); - (tmpPlayer->_pos).y = forgottenBodyY; - } - UpdateHeartDependentEffects(tmpPlayer); - parentPlayer = extraout_ECX_07; - if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && (tmpPlayer->_dead == 0)) && - (iVar10 = tmpPlayer->_goldenHearts, 0 < iVar10)) { - iVar5 = tmpPlayer->_redHearts; - if (tmpPlayer->_maxHearts < tmpPlayer->_redHearts) { - iVar5 = tmpPlayer->_maxHearts; - } - parentPlayer = (Entity_Player *) - ((iVar5 + 1) / 2 + (tmpPlayer->_soulHearts + 1) / 2 + tmpPlayer->_boneHearts); - local_7c.x = (float)parentPlayer; - if (GHIDRA_INT(parentPlayer) < iVar10) { - BreakGoldenHearts(tmpPlayer,iVar10 - GHIDRA_INT(parentPlayer)); - tmpPlayer->_goldenHearts = GHIDRA_INT(local_7c.x); - parentPlayer = extraout_ECX_08; - } - } - } - ppEVar6 = ppEVar6 + 1; - } while (ppEVar6 != g_triggerDeathPlayersEnd); - } -LAB_007a1331: - tmpPlayer = local_84; - goto LAB_007a1335; -LAB_007a163b: - parentPlayer = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((parentPlayer)) + 0x1)))); - piVar4 = piVar4 + 2; - if (GHIDRA_CAST(0x3) < parentPlayer) goto LAB_007a1683; - goto LAB_007a1630; -} - -// 007a2220 -void Entity_Player::Revive() -{ - Vector *safePos; - LayerState *layer; - int reducedBrokenHearts; - Vector local_10; - uint32_t *flagsHigh; - uint64_t oldFlags; - int twinPlayer; - - if (this->_dead != 0) { - this->_dead = 0; - this->_damageCooldown = 1; - twinPlayer = GetHeartLimit(this,0); - if (twinPlayer < 1) { - reducedBrokenHearts = this->_brokenHearts + -1; - twinPlayer = 0; - if (0 < reducedBrokenHearts) { - twinPlayer = reducedBrokenHearts; - } - this->_brokenHearts = twinPlayer; - } - if (this->_maxHearts < 1) { - if (this->_boneHearts < 1) { - this->_redHearts = 0; - this->_soulHearts = 1; - } - } - else { - this->_redHearts = 1; - this->_soulHearts = 0; - } - if ((this->_variant == 1) || (this->_isCoopGhost != 0)) { - PlayExtraAnimation(this,GHIDRA_CAST("Appear")); - local_10.x = (this->_pos).x; - local_10.y = (this->_pos).y; - safePos = PlayerManager::find_safe_spawn_position(&local_10,this->_pos); - (this->_pos).x = safePos->x; - (this->_pos).y = safePos->y; - this->_damageCooldown = 0x96; - } - if (this->_playerType == 0x23) { - twinPlayer = this->_twinPlayer; - if (twinPlayer != 0) { - if (*GHIDRA_CAST((twinPlayer + 0x1410)) == this) { - if (*GHIDRA_CAST((twinPlayer + 0x1410)) != GHIDRA_CAST(0x0)) { - local_10.x = (float)(twinPlayer + 0x1410); - msvc::multiset::erase(&local_10); - } - *GHIDRA_CAST((twinPlayer + 0x1410)) = 0; - oldFlags = this->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHigh = *flagsHigh & 0xf9ffffff; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(oldFlags); - } - } - this->_cacheFlags = 0xffff; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13fc)))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1400))) = 0; - EvaluateItems(this); - } - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0xc)); - layer->_visible = 1; - } - return; -} - -// 007a3430 -void Entity_Player::ReviveFromTrinket(uint32_t trinketId, int unused) -{ - Entity_Player *game = this; - int *piVar1; - int *cooldownSource; - ItemConfig_Item *trinketConfig; - void *pvVar2; - uint32_t uVar3; - uint32_t leaveDoor; - int heartTotal; - int iVar4; - int minCooldown; - void *trinketName [5]; - uint32_t trinketNameCapacity; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - void *local_8; - Game *game; - bool isBeastRoom; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00aff10d; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((trinketName + 10)); - ExceptionList = &local_10; - if (-1 < game->_playerIndex) { - Revive(game); - } - piVar1 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)); - if (((piVar1 == GHIDRA_CAST(0x0)) || (piVar1[2] != 0x10)) || (*piVar1 != 0x23)) { - isBeastRoom = false; - } - else { - isBeastRoom = true; - } - if (trinketId == 0x17) { - RemoveSkinCostume(game); - game->_maxHearts = 0; - game->_redHearts = 0; - game->_soulHearts = 1; - game->_blackHearts = 0; - game->_boneHeartsMask = 0; - game->_boneHearts = 0; - game->_rottenHearts = 0; - game->_eternalHearts = 0; - if (game->_playerType != 0x1f) { - game->_playerType = 10; - } - game->_cacheFlags = game->_cacheFlags | 0xffff; - EvaluateItems(game); - update_player_skin(game); - if (game->_parent == 0) { - if (!isBeastRoom) { - iVar4 = 0xe; -LAB_007a3769: - game = g_game; - uVar3 = g_game->_enterDoor; - if (GHIDRA_INT(uVar3) < 0) { - leaveDoor = 0xffffffff; - } - else { - leaveDoor = uVar3; - if (6 < GHIDRA_INT(uVar3)) { - leaveDoor = 7; - } - } - g_game->_leaveDoor = leaveDoor; - uVar3 = uVar3 & 0x80000003; - if (GHIDRA_INT(uVar3) < 0) { - uVar3 = (uVar3 - 1 | 0xfffffffc) + 1; - } - Game::StartRoomTransition(game,game->_lastRoomIdx,uVar3,iVar4,game,-1); - goto LAB_007a3558; - } - } - else { - game->_visible = 1; - game->_damageCooldown = 0x78; - AnimateTrinket(game,0x17,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - } - } - else if (trinketId == 0x1c) { - RemoveSkinCostume(game); - game->_soulHearts = 6; - game->_blackHearts = 0; - game->_boneHeartsMask = 0; - game->_boneHearts = 0; - game->_rottenHearts = 0; - game->_eternalHearts = 0; - game->_maxHearts = 0; - game->_redHearts = 0; - if (game->_playerType != 0x19) { - game->_playerType = 4; - } - game->_cacheFlags = game->_cacheFlags | 0xffff; - EvaluateItems(game); - update_player_skin(game); - if (game->_parent == 0) { - if (!isBeastRoom) { - iVar4 = 5; - goto LAB_007a3769; - } - } - else { - game->_visible = 1; - game->_damageCooldown = 0x78; - AnimateCollectible(game,0xa1,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - } - } - else { - pvVar2 = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT((trinketId & 0x7fff)) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar2) >> 2) - { - trinketConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + (trinketId & 0x7fff) * 4)); - } - else { - trinketConfig = GHIDRA_CAST(0x0); - } - ItemConfig_Item::GetLocalizedName(trinketConfig,GHIDRA_CAST(trinketName),0); - local_8 = (void *)0x0; - KAGE_LogMessage(4,GHIDRA_CAST("No revival effect associated with trinket %d (%s)\n")); - local_8 = (void *)0xffffffff; - if (0xf < trinketNameCapacity) { - uVar3 = trinketNameCapacity + 1; - pvVar2 = trinketName[0]; - if (0xfff < uVar3) { - pvVar2 = *(void **)(GHIDRA_INT(trinketName[0]) + -4); - uVar3 = trinketNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(trinketName[0]) + (-4 - GHIDRA_INT(pvVar2))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar2,uVar3); - } - } - piVar1 = &game->_damageCooldown; - game->_visible = 1; - minCooldown = 0x5a; - cooldownSource = &minCooldown; - if (0x59 < *piVar1) { - cooldownSource = piVar1; - } - *piVar1 = *cooldownSource; -LAB_007a3558: - UpdateHeartDependentEffects(game); - if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && (game->_dead == 0)) && - (iVar4 = game->_goldenHearts, 0 < iVar4)) { - heartTotal = game->_redHearts; - if (game->_maxHearts < game->_redHearts) { - heartTotal = game->_maxHearts; - } - heartTotal = (heartTotal + 1) / 2 + (game->_soulHearts + 1) / 2 + game->_boneHearts; - if (heartTotal < iVar4) { - BreakGoldenHearts(game,iVar4 - heartTotal); - game->_goldenHearts = heartTotal; - } - } - ExceptionList = local_10; - return; -} - -// 007a37c0 -void Entity_Player::remove_twin() -{ - int iVar1; - ItemConfig_Item *item; - void *twinSmeltedTrinkets; - uint8_t extraout_CL; - uint8_t unusedBool; - Entity_Player *in_ECX; - void *pvVar2; - Game *game; - Entity_Player *player; - uint32_t uVar3; - uint32_t *twinSlot; - int *local_c [2]; - int *countSlot; - bool isBackupPlayer; - short *smeltedCount; - - isBackupPlayer = false; - player = GHIDRA_CAST(in_ECX->_twinPlayer); - if (player == GHIDRA_CAST(0x0)) { - player = in_ECX->_backupPlayer; - if (player == GHIDRA_CAST(0x0)) { - return; - } - isBackupPlayer = true; - } - (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::ClearEffects(1); - if (player->_playerType != 0x28) { - uVar3 = 0; - if (GHIDRA_INT((in_ECX->_collectibleCounts)._end) - GHIDRA_INT((in_ECX->_collectibleCounts)._begin) >> 2 != 0) - { - game = g_game; - do { - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar3)) goto LAB_007a386d; - } - else { - if (GHIDRA_INT(uVar3) < 0) { - if ((GHIDRA_INT(uVar3) < 0) && - (GHIDRA_INT(~uVar3) < - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._begin) >> 2)) { - item = (ItemConfig_Item *) - **(uint32_t **) - (GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._begin) + ~uVar3 * 4); - } - else { - item = GHIDRA_CAST(0x0); - } - } - else { -LAB_007a386d: - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) >> 2 <= GHIDRA_INT(uVar3)) - goto LAB_007a38d8; - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar3 * 4)); - } - if (((item != GHIDRA_CAST(0x0)) && (item->type != 3)) && - (local_c[0] = *GHIDRA_CAST((GHIDRA_INT((player->_collectibleCounts)._begin) + uVar3 * 4)), - 0 < GHIDRA_INT(local_c[0]))) { - countSlot = GHIDRA_CAST((GHIDRA_INT((in_ECX->_collectibleCounts)._begin) + uVar3 * 4)); - *countSlot = *countSlot + GHIDRA_INT(local_c[0]); - game = g_game; - *GHIDRA_CAST((GHIDRA_INT((player->_collectibleCounts)._begin) + uVar3 * 4)) = 0; - if (item->addCostumeOnPickup != 0) { - AddCostume(in_ECX,item,0); - game = g_game; - } - } - } -LAB_007a38d8: - uVar3 = uVar3 + 1; - } while (uVar3 < GHIDRA_UINT((GHIDRA_INT((in_ECX->_collectibleCounts)._end) - - GHIDRA_INT((in_ECX->_collectibleCounts)._begin) >> 2))); - } - pvVar2 = (in_ECX->_smeltedTrinkets)._begin; - local_c[0] = GHIDRA_CAST(0x0); - if (GHIDRA_INT((in_ECX->_smeltedTrinkets)._end) - GHIDRA_INT(pvVar2) >> 2 != 0) { - do { - twinSmeltedTrinkets = (player->_smeltedTrinkets)._begin; - iVar1 = GHIDRA_INT(local_c[0]) * 4; - if (((0 < *GHIDRA_CAST((GHIDRA_CAST(twinSmeltedTrinkets) + iVar1))) || - (0 < *GHIDRA_CAST((GHIDRA_CAST(twinSmeltedTrinkets) + iVar1 + 2)))) && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + iVar1)) < 1 && (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + iVar1 + 2)) < 1)))) { - pvVar2 = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT((GHIDRA_UINT(local_c[0]) & 0x7fff)) < - GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar2) >> 2) { - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + (GHIDRA_UINT(local_c[0]) & 0x7fff) * 4)); - } - else { - item = GHIDRA_CAST(0x0); - } - AddCostume(in_ECX,item,0); - pvVar2 = (in_ECX->_smeltedTrinkets)._begin; - twinSmeltedTrinkets = (player->_smeltedTrinkets)._begin; - } - local_c[0] = GHIDRA_CAST((GHIDRA_INT(local_c[0]) + 1)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + iVar1)) = - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + iVar1)) + *GHIDRA_CAST((GHIDRA_CAST(twinSmeltedTrinkets) + iVar1)); - smeltedCount = GHIDRA_CAST((GHIDRA_INT((in_ECX->_smeltedTrinkets)._begin) + iVar1 + 2)); - *smeltedCount = - *smeltedCount + *GHIDRA_CAST((iVar1 + 2 + GHIDRA_INT((player->_smeltedTrinkets)._begin))); - *GHIDRA_CAST((GHIDRA_INT((player->_smeltedTrinkets)._begin) + iVar1)) = 0; - pvVar2 = (in_ECX->_smeltedTrinkets)._begin; - } while (local_c[0] < GHIDRA_CAST((GHIDRA_INT((in_ECX->_smeltedTrinkets)._end) - GHIDRA_INT(pvVar2) >> 2))); - } - uVar3 = 0; - pvVar2 = (in_ECX->_pillEffectUses)._begin; - if (GHIDRA_INT((in_ECX->_pillEffectUses)._end) - GHIDRA_INT(pvVar2) >> 2 != 0) { - do { - iVar1 = *GHIDRA_CAST((GHIDRA_INT((player->_pillEffectUses)._begin) + uVar3 * 4)); - if (0 < iVar1) { - countSlot = GHIDRA_CAST((GHIDRA_INT(pvVar2) + uVar3 * 4)); - *countSlot = *countSlot + iVar1; - *GHIDRA_CAST((GHIDRA_INT((player->_pillEffectUses)._begin) + uVar3 * 4)) = 0; - } - uVar3 = uVar3 + 1; - pvVar2 = (in_ECX->_pillEffectUses)._begin; - } while (uVar3 < GHIDRA_UINT((GHIDRA_INT((in_ECX->_pillEffectUses)._end) - GHIDRA_INT(pvVar2) >> 2))); - } - msvc::vector<4byte>::insert_range - ((in_ECX->_voidedCollectibles)._end,(player->_voidedCollectibles)._begin, - (player->_voidedCollectibles)._end,local_c[0]); - msvc::vector<8byte>::insert_range - ((in_ECX->_voidedPassives)._end,(player->_voidedPassives)._begin, - (player->_voidedPassives)._end,local_c[0]); - (GHIDRA_CAST((&in_ECX->_history)))->History::merge(&player->_history); - in_ECX->_cacheFlags = in_ECX->_cacheFlags | 0xffff; - (in_ECX->_temporaryeffects)._shouldEvaluateCache = 1; - } - twinSlot = &in_ECX->_twinPlayer; - if (isBackupPlayer) { - (**(code **)(*GHIDRA_CAST(in_ECX->_backupPlayer) + 0x44))(); - if (in_ECX->_backupPlayer != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(in_ECX->_backupPlayer))(1); - in_ECX->_backupPlayer = (void *)0x0; - return; - } - } - else { - unusedBool = 0; - if (*twinSlot != 0) { - local_c[0] = twinSlot; - msvc::multiset::erase(local_c); - *twinSlot = 0; - unusedBool = extraout_CL; - } - PlayerManager::RemoveCoPlayer(&g_game->_playerManager,player,unusedBool); - } - return; -} - -// 007a3af0 -void Entity_Player::AddPocketItem(int id, uint32_t pocketItemType) -{ - uint32_t maxPocketItems; - int *slotType; - uint32_t slot; - int remaining; - void **slotEntry; - uint32_t insertSlot; - Game *game; - void *movedType; - - maxPocketItems = GetMaxPocketItems(this); - if (pocketItemType == 2) { - maxPocketItems = maxPocketItems + 1; - } - if (((this->_pocketSlots[0] != 0) && (this->_pocketSlots[maxPocketItems * 2 + -2] != 0)) && - (slot = 0, maxPocketItems != 0)) { - slotType = this->_pocketSlots + 1; - do { - if ((slotType[-1] != 0) && (*slotType != 2)) { - DropPocketItem(this,slot,&this->_pos); - break; - } - slot = slot + 1; - slotType = slotType + 2; - } while (slot < maxPocketItems); - } - insertSlot = 0; - if (this->_pocketSlots[1] == 2) { - insertSlot = GHIDRA_UINT((0 < this->_pocketSlots[0])); - } - if ((this->_pocketSlots[maxPocketItems * 2 + -2] == 0) && - (GHIDRA_INT(insertSlot) <= GHIDRA_INT((maxPocketItems - 2)))) { - remaining = ((maxPocketItems - 2) - insertSlot) + 1; - slotEntry = (void **)(this->_pocketSlots + maxPocketItems * 2 + -2); - do { - movedType = (GHIDRA_CAST((slotEntry + -1)))->_begin; - *slotEntry = slotEntry[-2]; - slotEntry[1] = movedType; - remaining = remaining + -1; - slotEntry = slotEntry + -2; - } while (remaining != 0); - } - this->_pocketSlots[insertSlot * 2] = id; - this->_pocketSlots[insertSlot * 2 + 1] = pocketItemType; - (GHIDRA_CAST((g_game->_room)))->Room::UpdateRedKey(); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - if ((this->_parent != 0) && (pocketItemType != 2)) { - DropPocketItem(this,insertSlot,&this->_pos); - } - return; -} - -// 007a3c10 -void Entity_Player::AddCard(int card) -{ - AddPocketItem(this,card,1); - return; -} - -// 007a3c30 -void Entity_Player::AddPill(int pillColor) -{ - AddPocketItem(this,pillColor,0); - return; -} - -// 007a3c50 -int Entity_Player::GetCard(int slot) -{ - if (((slot < 0) || (3 < GHIDRA_UINT(slot))) || (this->_pocketSlots[slot * 2 + 1] != 1)) { - return 0; - } - return this->_pocketSlots[slot * 2]; -} - -// 007a3c80 -int Entity_Player::GetPill(int slot) -{ - if (((slot < 0) || (3 < GHIDRA_UINT(slot))) || (this->_pocketSlots[slot * 2 + 1] != 0)) { - return 0; - } - return this->_pocketSlots[slot * 2]; -} - -// 007a3cb0 -void Entity_Player::SetCard(int slot, int card) -{ - if ((-1 < slot) && (GHIDRA_UINT(slot) < 4)) { - this->_pocketSlots[slot * 2] = card; - this->_pocketSlots[slot * 2 + 1] = 1; - (GHIDRA_CAST((g_game->_room)))->Room::UpdateRedKey(); - } - return; -} - -// 007a3cf0 -void Entity_Player::SetPill(int slot, int pillColor) -{ - if ((-1 < slot) && (GHIDRA_UINT(slot) < 4)) { - this->_pocketSlots[slot * 2] = pillColor; - this->_pocketSlots[slot * 2 + 1] = 0; - (GHIDRA_CAST((g_game->_room)))->Room::UpdateRedKey(); - } - return; -} - -// 007a3d30 -void Entity_Player::pocket_use_input() -{ - uint8_t bVar1; - uint8_t isDropHeld; - char cVar2; - uint32_t uVar3; - void *inputDevice; - int iVar4; - Vector *copySpawnPos; - uint32_t uVar5; - int unused; - int unused_00; - int unused_01; - int pocketKind; - bool isClassicTwinControls; - EntityList_EL familiars; - Vector VStack_24; - uint32_t pocketId; - float fStack_18; - char isJacobOrEsau; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - Game *game; - bool isUseBombAction; - int swapTmp; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00aff93d; - local_10 = ExceptionList; - uVar3 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - if (*GHIDRA_CAST(&g_game->_stageTransition) != 0) { - return; - } - if (*GHIDRA_CAST(&g_game->_roomTransition) != 0) { - return; - } - ExceptionList = &local_10; - bVar1 = IsHologram(this); - if (bVar1 != 0) { - ExceptionList = local_10; - return; - } - if ((this->_playerType == 0x13) || (this->_playerType == 0x14)) { - isJacobOrEsau = '\x01'; - cVar2 = FUN_00753bf0(uVar3); - if (cVar2 != '\0') { - isUseBombAction = true; - goto LAB_007a3da4; - } - } - else { - isJacobOrEsau = '\0'; - } - isUseBombAction = false; -LAB_007a3da4: - isClassicTwinControls = (g_manager->_optionsConfig)._jacobEsauControls == 0; - if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && - (inputDevice = (GHIDRA_CAST((&g_manager->_netplayManager)))->InputManager::GetDeviceByPlayerEntity(this), - inputDevice != (void *)0x0)) { - isClassicTwinControls = *GHIDRA_CAST((GHIDRA_CAST(inputDevice) + 0x3d0)) == 0; - } - iVar4 = 10; - if ((isUseBombAction) && (isClassicTwinControls)) { - iVar4 = 9; - } - bVar1 = input_is_action_triggered(g_manager,iVar4,this->_controllerIndex,GHIDRA_CAST(this),0); - if (isJacobOrEsau != '\0') { - if (isClassicTwinControls) { - if ((this->_twinPlayer != 0) && - (isDropHeld = input_is_action_pressed(0xb,this->_controllerIndex,GHIDRA_CAST(this),unused), - isDropHeld == 0)) { - bVar1 = 0; - } - } - else { - cVar2 = FUN_00753bf0(); - if ((cVar2 == '\0') || - (isDropHeld = input_is_action_pressed(0xb,this->_controllerIndex,GHIDRA_CAST(this),unused_00), - isDropHeld == 0)) { - cVar2 = FUN_006f0040(); - if (cVar2 != '\0') { - isDropHeld = input_is_action_pressed(0xb,this->_controllerIndex,GHIDRA_CAST(this),unused_01); - bVar1 = bVar1 & -(isDropHeld != 0); - } - } - else { - bVar1 = 0; - } - } - } - if (((this->_flags & 0x800) != 0) || (this->_isCoopGhost != 0)) { - bVar1 = 0; - } - if ((this->_pocketSlots[1] == 2) && (0 < this->_pocketSlots[0])) { - ControlActiveItem(this,this->_pocketSlots[0] + -1); - ExceptionList = local_10; - return; - } - if (this->_isControlsEnabled == 0) { - ExceptionList = local_10; - return; - } - if (0 < this->_controlsCooldown) { - ExceptionList = local_10; - return; - } - if (bVar1 == 0) { - ExceptionList = local_10; - return; - } - bVar1 = ANM2::IsPlaying(&this->_bodySprite,GHIDRA_CAST("UseItem")); - if (bVar1 != 0) { - ExceptionList = local_10; - return; - } - Game::save_rewind_state(-1); - g_game->_isPocketItemRewindSaved = 1; - KAGE_LogMessage(1,GHIDRA_CAST("Action PillCard Triggered\n")); - iVar4 = this->_pocketSlots[0]; - if (iVar4 == 0) { - ExceptionList = local_10; - return; - } - this->_lastActionTriggers = this->_lastActionTriggers | 8; - pocketKind = this->_pocketSlots[1]; - pocketId = this->_pocketSlots[0]; - fStack_18 = (float)pocketKind; - if (pocketKind == 1) { - if ((iVar4 == 0x4e) && - (cVar2 = KAGE_Filesys_FileManager::OpenRead - (GHIDRA_CAST(this),0x244,0xffffffff), cVar2 == '\0')) { - ExceptionList = local_10; - return; - } - PersistentGameData::AddToCollection(&g_manager->_persistentGameData,0x3d); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0xc4,1); - iVar4 = this->_pocketSlots[0]; - this->_pocketSlots[1] = this->_pocketSlots[3]; - swapTmp = this->_pocketSlots[5]; - this->_pocketSlots[0] = this->_pocketSlots[2]; - this->_pocketSlots[3] = swapTmp; - this->_pocketSlots[2] = this->_pocketSlots[4]; - this->_pocketSlots[5] = this->_pocketSlots[7]; - this->_pocketSlots[4] = this->_pocketSlots[6]; - this->_pocketSlots[6] = 0; - TriggerEchoChamber(this,1,pocketId); - UseCard(this,iVar4,4); - if ((iVar4 != 0x50) && (iVar4 != 0x30)) { - this->_wildCardItemType = 1; - this->_wildCardItem = iVar4; - this->_wildCardVarData = 0; - } - } - else if (pocketKind == 0) { - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,1,0); - uVar5 = 0; - uStack_8 = 0; - uVar3 = familiars._size; - if (familiars._size != 0) { - do { - if (*GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + uVar5 * 4)) + 0x410)) == this) { - (GHIDRA_CAST(()))->Entity_Familiar::farting_baby_fart(); - uVar3 = familiars._size; - } - uVar5 = uVar5 + 1; - } while (uVar5 < uVar3); - pocketKind = GHIDRA_INT(fStack_18); - } - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,6,1); - PersistentGameData::AddToCollection(&g_manager->_persistentGameData,0x2b); - uVar3 = this->_pocketSlots[0]; - fStack_18 = (float)ItemPool::GetPillEffect(&g_game->_itemPool,uVar3,this); - if (((uVar3 & 0x7ff) != 0xe) || - (uVar5 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_collectibleRNGs)._begin) + 0x4b0)))))->RNG::RandomInt(100), uVar5 < 5 - )) { - iVar4 = this->_pocketSlots[3]; - this->_pocketSlots[0] = this->_pocketSlots[2]; - this->_pocketSlots[1] = iVar4; - this->_pocketSlots[2] = this->_pocketSlots[4]; - this->_pocketSlots[3] = this->_pocketSlots[5]; - this->_pocketSlots[4] = this->_pocketSlots[6]; - this->_pocketSlots[5] = this->_pocketSlots[7]; - this->_pocketSlots[6] = 0; - } - TriggerEchoChamber(this,pocketKind,pocketId); - UsePill(this,GHIDRA_INT(fStack_18),uVar3,0); - this->_wildCardItemType = 0; - this->_wildCardItem = GHIDRA_INT(fStack_18); - this->_wildCardVarData = uVar3; - if (this->_cacheFlags != 0) { - InvalidateCoPlayerItems(this); - EvaluateItems(this); - } - uStack_8 = 0xffffffff; - (GHIDRA_CAST((&familiars)))->EntityList_Query::~EntityList_Query(); - } - else if (pocketKind == 2) { - ControlActiveItem(this,iVar4 + -1); - } - bVar1 = HasTrinket(this,0x4f,0); - if ((bVar1 != 0) && ((pocketKind == 1 || (pocketKind == 0)))) { - fStack_18 = 0.25; - iVar4 = GetTrinketMultiplier(this,0x4f); - if (iVar4 == 2) { - fStack_18 = 0.33; - } - else if (iVar4 == 3) { - fStack_18 = 0.5; - } - VStack_24.y = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0x4f0)))))->RNG::RandomFloat(); - if (VStack_24.y < fStack_18) { - uVar3 = Random(); - copySpawnPos = Room::FindFreePickupSpawnPosition - (g_game->_room,&VStack_24,&this->_pos,40.0,0,0,0); - uVar5 = 0x46; - if (pocketKind == 1) { - uVar5 = 300; - } - Game::Spawn(g_game,5,uVar5,copySpawnPos,&g_vectorZero,GHIDRA_CAST(this),pocketId,uVar3); - } - } - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - ExceptionList = local_10; - return; -} - -// 007a42b0 -void Entity_Player::pockets_rotate() -{ - uint8_t bVar1; - char isTrinketDroppable; - HUD *hud; - int iVar2; - uint8_t *craftSlot; - Game *game; - float fVar3; - Vector *pos; - Entity_Player *in_ECX; - int extraout_ECX; - uint32_t uVar4; - int extraout_ECX_00; - int extraout_ECX_01; - uint32_t uVar5; - int *pocketSlot; - int iVar6; - Vector local_18; - Vector local_10; - void *cards; - uint32_t *cardsBegin; - uint32_t firstCard; - bool isAnythingToDrop; - Manager *manager; - int swapItem; - - if (in_ECX->_variant != 0) { - return; - } - if (in_ECX->_isCoopGhost != 0) { - return; - } - bVar1 = IsHologram(in_ECX); - if (bVar1 != 0) { - return; - } - local_10.x = (float)in_ECX->_controllerIndex; - if (0 < in_ECX->_forgottenSwapFormCooldown) { - in_ECX->_forgottenSwapFormCooldown = in_ECX->_forgottenSwapFormCooldown + -1; - } - bVar1 = input_is_action_triggered(g_manager,0xb,GHIDRA_INT(local_10.x),GHIDRA_CAST(in_ECX),0); - iVar6 = extraout_ECX; - if (bVar1 == 0) goto LAB_007a457c; - bVar1 = SwapForgottenForm(in_ECX,0,0); - if (bVar1 == 0) { - local_18.x = 0.0; - pocketSlot = in_ECX->_pocketSlots; - do { - pocketSlot = pocketSlot + 2; - if (*pocketSlot == 0) break; - iVar6 = *pocketSlot; - iVar2 = pocketSlot[1]; - *pocketSlot = pocketSlot[-2]; - game = g_game; - pocketSlot[1] = pocketSlot[-1]; - pocketSlot[-2] = iVar6; - pocketSlot[-1] = iVar2; - if ((game->_hud)._hudRefreshType != 2) { - (game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - local_18.x = (float)(GHIDRA_INT(local_18.x) + 1); - } while (GHIDRA_UINT(local_18.x) < 3); - game = g_game; - if (in_ECX->_itemState == 0) { - if (in_ECX->_activeDesc[0]._item == 0x1e9) { - uVar4 = in_ECX->_activeDesc[0]._varData; - uVar5 = ((GHIDRA_INT(uVar4) >> 0x10) + 1U) % 10; - in_ECX->_activeDesc[0]._varData = uVar5 << 0x10 | uVar4 & 0xffff; - hud = &game->_hud; - uVar4 = 0; - do { - if (*GHIDRA_CAST(hud->_playerHUD) == in_ECX) { - hud->_playerHUD[400] = 0; - hud->_playerHUD[0x191] = 0; - hud->_playerHUD[0x192] = 0; - hud->_playerHUD[0x193] = 0; - break; - } - uVar4 = uVar4 + 1; - hud = GHIDRA_CAST((hud->_playerHUD + 0x6dc)); - } while (uVar4 < 8); - if (uVar5 != 0) goto LAB_007a43f6; - } - SwapActiveItems(in_ECX); - } - } -LAB_007a43f6: - if (in_ECX->_playerType == 0x15) { - bVar1 = HasCollectible(in_ECX,0x26b,0); - iVar2 = 0; - iVar6 = GHIDRA_UINT((bVar1 != 0)) * 4 + 8; - do { - if (in_ECX->_inventory[iVar2] < 0) { - iVar6 = iVar2; - break; - } - iVar2 = iVar2 + 1; - } while (iVar2 < iVar6); - if (1 < iVar6) { - iVar2 = 0; - if (0 < iVar6 + -1) { - do { - swapItem = in_ECX->_inventory[iVar2]; - in_ECX->_inventory[iVar2] = in_ECX->_inventory[iVar2 + 1]; - in_ECX->_inventory[iVar2 + 1] = swapItem; - iVar2 = iVar2 + 1; - } while (iVar2 < iVar6 + -1); - } - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - } - } - if (in_ECX->_playerType == 0x17) { - bVar1 = in_ECX->_bagOfCraftingContent[0]; - craftSlot = in_ECX->_bagOfCraftingContent; - if ((bVar1 != 0) && (in_ECX->_bagOfCraftingContent[1] != 0)) { - uVar4 = 0; - do { - if (craftSlot[1] == 0) break; - *craftSlot = craftSlot[1]; - uVar4 = uVar4 + 1; - craftSlot = craftSlot + 1; - } while (uVar4 < 7); - in_ECX->_bagOfCraftingContent[uVar4] = bVar1; - } - cardsBegin = (in_ECX->_itemCards)._begin; - uVar4 = GHIDRA_INT((in_ECX->_itemCards)._end) - GHIDRA_INT(cardsBegin) >> 2; - if (1 < uVar4) { - firstCard = *cardsBegin; - uVar5 = 0; - if (uVar4 != 1) { - do { - cards = (in_ECX->_itemCards)._begin; - *GHIDRA_CAST((GHIDRA_CAST(cards) + uVar5 * 4)) = *GHIDRA_CAST((GHIDRA_CAST(cards) + uVar5 * 4 + 4)); - uVar5 = uVar5 + 1; - } while (uVar5 < (GHIDRA_INT((in_ECX->_itemCards)._end) - GHIDRA_INT((in_ECX->_itemCards)._begin) >> 2) - - 1U); - } - hud = &g_game->_hud; - *GHIDRA_CAST((GHIDRA_INT((in_ECX->_itemCards)._end) + -4)) = firstCard; - HUD::mark_all_slots_dirty(hud,0,0); - } - } - iVar2 = is_achievement_79_unlocked(in_ECX); - manager = g_manager; - iVar6 = extraout_ECX_00; - if (0 < iVar2) { - local_18.x = 1.16028e-42; - seed_fart_sound_override(GHIDRA_CAST(&local_18)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18.x),1.2,1,0,1.0,0.0); - Game::ShakeScreen(g_game,8); - iVar6 = extraout_ECX_01; - } -LAB_007a457c: - bVar1 = input_is_action_pressed(0xb,GHIDRA_INT(local_10.x),GHIDRA_CAST(in_ECX),iVar6); - if (bVar1 == 0) { - in_ECX->_actionHoldDrop = 0; - return; - } - in_ECX->_actionHoldDrop = in_ECX->_actionHoldDrop + 1; - game = g_game; - if ((GHIDRA_UINT(in_ECX->_actionHoldDrop) < 0x79) || ((g_game->_dailyChallenge)._specialDailyId == 4)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1880)))) = 0; - } - else { - uVar4 = 0; - in_ECX->_actionHoldDrop = 0; - isAnythingToDrop = false; - local_18.x = (float)in_ECX->_trinketsID; - do { - iVar6 = *GHIDRA_CAST(local_18.x); - if (iVar6 != 0) { - if (*GHIDRA_CAST(&game->_deathmatchManager) < 2) { - if ((iVar6 != 0x35) && ((iVar6 != 0x40 || (game->_challenge != 0x1c)))) goto LAB_007a461f; - } - else { - isTrinketDroppable = - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_deathmatchManager))) + 0xc)))) + 0x50))(); - game = g_game; - if (isTrinketDroppable != '\0') { -LAB_007a461f: - isAnythingToDrop = true; - } - } - } - uVar4 = uVar4 + 1; - local_18.x = (float)(GHIDRA_INT(local_18.x) + 4); - } while (uVar4 < 2); - local_18.x = 0.0; - uVar4 = GetMaxPocketItems(in_ECX); - if (uVar4 != 0) { - pocketSlot = in_ECX->_pocketSlots + 1; - do { - if ((pocketSlot[-1] != 0) && (*pocketSlot != 2)) { - isAnythingToDrop = true; - } - local_18.x = (float)(GHIDRA_INT(local_18.x) + 1); - pocketSlot = pocketSlot + 2; - fVar3 = (float)GetMaxPocketItems(in_ECX); - } while (GHIDRA_UINT(local_18.x) < GHIDRA_UINT(fVar3)); - } - game = g_game; - if (isAnythingToDrop) { - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - in_ECX->_lastActionTriggers = in_ECX->_lastActionTriggers | 0x20; - iVar6 = 2; - while( true ) { - Room::FindFreePickupSpawnPosition(game->_room,&local_10,&in_ECX->_pos,0.0,0,0,0); - DropTrinket(in_ECX,&local_10,0); - if ((in_ECX->_variant == 0) && (in_ECX->_isCoopGhost == 0)) { - InvalidateCoPlayerItems(in_ECX); - } - iVar6 = iVar6 + -1; - if (iVar6 == 0) break; - game = g_game; - } - iVar6 = 4; - do { - pos = Room::FindFreePickupSpawnPosition(g_game->_room,&local_18,&in_ECX->_pos,0.0,0,0,0); - DropPocketItem(in_ECX,-1,pos); - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - return; - } - } - return; -} - -// 007a4760 -void Entity_Player::SwapActiveItems() -{ - int iVar1; - int iVar2; - int iVar3; - uint8_t bVar4; - HUD *playerHudIt; - uint32_t hudIndex; - int oldBatteryCharge; - int oldCharge; - int oldItem; - int oldPartialCharge; - int oldSubCharge; - int oldTimeRechargeCooldown; - int oldUnk; - int oldVarData; - - if (this->_activeDesc[1]._item == 0) { - return; - } - ResetItemState(this); - this->_itemStateCooldown = 0; - iVar1 = this->_activeDesc[1]._unk; - iVar2 = this->_activeDesc[1]._charge; - iVar3 = this->_activeDesc[1]._batteryCharge; - oldItem = this->_activeDesc[0]._item; - oldUnk = this->_activeDesc[0]._unk; - oldCharge = this->_activeDesc[0]._charge; - oldBatteryCharge = this->_activeDesc[0]._batteryCharge; - oldSubCharge = this->_activeDesc[0]._subCharge; - oldTimeRechargeCooldown = this->_activeDesc[0]._timeRechargeCooldown; - oldPartialCharge = this->_activeDesc[0]._partialCharge; - oldVarData = this->_activeDesc[0]._varData; - this->_activeDesc[0]._item = this->_activeDesc[1]._item; - this->_activeDesc[0]._unk = iVar1; - this->_activeDesc[0]._charge = iVar2; - this->_activeDesc[0]._batteryCharge = iVar3; - iVar1 = this->_activeDesc[1]._timeRechargeCooldown; - iVar2 = this->_activeDesc[1]._partialCharge; - iVar3 = this->_activeDesc[1]._varData; - this->_activeDesc[0]._subCharge = this->_activeDesc[1]._subCharge; - this->_activeDesc[0]._timeRechargeCooldown = iVar1; - this->_activeDesc[0]._partialCharge = iVar2; - this->_activeDesc[0]._varData = iVar3; - this->_activeDesc[1]._item = oldItem; - this->_activeDesc[1]._unk = oldUnk; - this->_activeDesc[1]._charge = oldCharge; - this->_activeDesc[1]._batteryCharge = oldBatteryCharge; - this->_activeDesc[1]._subCharge = oldSubCharge; - this->_activeDesc[1]._timeRechargeCooldown = oldTimeRechargeCooldown; - this->_activeDesc[1]._partialCharge = oldPartialCharge; - this->_activeDesc[1]._varData = oldVarData; - this->_itemHoldCooldown = 0; - bVar4 = HasTrinket(this,0x65,0); - if ((bVar4 != 0) || (bVar4 = HasTrinket(this,100,0), bVar4 != 0)) { - this->_cacheFlags = this->_cacheFlags | 0x41f; - EvaluateItems(this); - } - playerHudIt = &g_game->_hud; - hudIndex = 0; - do { - if (*GHIDRA_CAST(playerHudIt->_playerHUD) == this) { - playerHudIt->_playerHUD[400] = 0; - playerHudIt->_playerHUD[0x191] = 0; - playerHudIt->_playerHUD[0x192] = 0; - playerHudIt->_playerHUD[0x193] = 0; - playerHudIt->_playerHUD[0x1ac] = 0; - playerHudIt->_playerHUD[0x1ad] = 0; - playerHudIt->_playerHUD[0x1ae] = 0; - playerHudIt->_playerHUD[0x1af] = 0; - playerHudIt->_playerHUD[0x1c8] = 0; - playerHudIt->_playerHUD[0x1c9] = 0; - playerHudIt->_playerHUD[0x1ca] = 0; - playerHudIt->_playerHUD[0x1cb] = 0; - playerHudIt->_playerHUD[0x1e4] = 0; - playerHudIt->_playerHUD[0x1e5] = 0; - playerHudIt->_playerHUD[0x1e6] = 0; - playerHudIt->_playerHUD[0x1e7] = 0; - return; - } - hudIndex = hudIndex + 1; - playerHudIt = GHIDRA_CAST((playerHudIt->_playerHUD + 0x6dc)); - } while (hudIndex < 8); - return; -} - -// 007a4850 -void Entity_Player::RemovePocketItem(int slot) -{ - uint32_t dwordsLeft; - int *slotIt; - int *destSlot; - Game *game; - - if (slot == -1) { - slot = 0; - slotIt = this->_pocketSlots + 1; - while ((slotIt[-1] == 0 || (*slotIt == 2))) { - slot = slot + 1; - slotIt = slotIt + 2; - if (3 < GHIDRA_UINT(slot)) { - return; - } - } - if (slot == 0xffffffff) { - return; - } - } - if ((this->_pocketSlots[slot * 2] != 0) && (this->_pocketSlots[slot * 2 + 1] != 2)) { - if (GHIDRA_UINT(slot) < 3) { - slotIt = this->_pocketSlots + slot * 2 + 2; - destSlot = this->_pocketSlots + slot * 2; - for (dwordsLeft = (3 - slot) * 2 & 0x3ffffffe; dwordsLeft != 0; dwordsLeft = dwordsLeft - 1) { - *destSlot = *slotIt; - slotIt = slotIt + 1; - destSlot = destSlot + 1; - } - } - game = g_game; - this->_pocketSlots[6] = 0; - this->_pocketSlots[7] = 1; - (GHIDRA_CAST((game->_room)))->Room::UpdateRedKey(); - } - return; -} - -// 007a48f0 -void Entity_Player::DropPocketItem(int slot, Vector *pos) -{ - int *pocketCursor; - uint32_t uVar1; - uint32_t variant; - Entity *pickup; - int *copyDst; - Game *game; - - if (slot == -1) { - slot = 0; - pocketCursor = this->_pocketSlots + 1; - while ((pocketCursor[-1] == 0 || (*pocketCursor == 2))) { - slot = slot + 1; - pocketCursor = pocketCursor + 2; - if (3 < GHIDRA_UINT(slot)) { - return; - } - } - if (slot == 0xffffffff) { - return; - } - } - if ((this->_pocketSlots[slot * 2] != 0) && (this->_pocketSlots[slot * 2 + 1] != 2)) { - uVar1 = Random(); - variant = 0x46; - if (this->_pocketSlots[slot * 2 + 1] == 1) { - variant = 300; - } - pickup = Game::Spawn(g_game,5,variant,pos,&g_vectorZero,GHIDRA_CAST(this), - this->_pocketSlots[slot * 2],uVar1); - if (pickup != GHIDRA_CAST(0x0)) { - pickup[1]._sprite._championColor._offset[0] = 5.60519e-45; - } - if (GHIDRA_UINT(slot) < 3) { - pocketCursor = this->_pocketSlots + slot * 2 + 2; - copyDst = this->_pocketSlots + slot * 2; - for (uVar1 = (3 - slot) * 2 & 0x3ffffffe; uVar1 != 0; uVar1 = uVar1 - 1) { - *copyDst = *pocketCursor; - pocketCursor = pocketCursor + 1; - copyDst = copyDst + 1; - } - } - game = g_game; - this->_pocketSlots[6] = 0; - this->_pocketSlots[7] = 1; - (GHIDRA_CAST((game->_room)))->Room::UpdateRedKey(); - } - return; -} - -// 007a49e0 -void Entity_Player::spawn_low_health_blood_splat() -{ - int iVar1; - uint8_t isHasKidneyStone; - uint32_t rngResult; - Entity *bloodSplat; - ColorMod *splatColor; - float scaleX; - float fVar2; - uint8_t colorParams [44]; - uint32_t local_c; - - local_c = __security_cookie ^ GHIDRA_UINT(colorParams); - if (((((this->_variant == 0) && (this->_boneHearts + this->_soulHearts + this->_redHearts < 2)) && - (iVar1 = this->_playerType, iVar1 != 10)) && - ((((iVar1 != 0x10 && (iVar1 != 0x11)) && - ((iVar1 != 0x1f && ((iVar1 != 0x23 && (iVar1 != 0x28)))))) && (iVar1 != 0x27)))) && - (this->_isCoopGhost == 0)) { - rngResult = Random(); - bloodSplat = Game::SpawnEx(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,rngResult,0); - rngResult = Random(); - fVar2 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.3; - scaleX = fVar2 * g_vectorOne.x; - (bloodSplat->_sprite)._scale.y = fVar2 * g_vectorOne.y; - (bloodSplat->_sprite)._scale.x = scaleX; - rngResult = Random(); - (bloodSplat->_sprite)._rotation = ((float)(rngResult & 3) + 0.0) * 90.0; - rngResult = Random(); - (bloodSplat->_sprite)._flipX = ~(uint8_t)rngResult & 1; - isHasKidneyStone = HasCollectible(this,0x1b8,0); - if (((isHasKidneyStone == 0) && (this->_playerType != 5)) && (this->_playerType != 0x1a)) { - splatColor = ColorParams::set_from_bytes(GHIDRA_CAST(colorParams),0,0,0,0xb4,0xf4,0xf4,0); - bloodSplat->SetColor(splatColor,0xffffffff,0xff,0,1); - } - bloodSplat->Update(); - } - return; -} - -// 007a4ba0 -void Entity_Player::level_start(uint8_t isForced) -{ - float fVar1; - Entity_Player *pEVar2; - code *pcVar3; - uint64_t qVar4; - uint8_t bVar5; - int iVar6; - Vector *outPosition; - uint32_t forcedCurses; - uint32_t preventedCurses; - uint32_t uVar7; - int *piVar8; - Vector *spawnPos; - int iVar9; - void *pvVar10; - ItemConfig_Item *Item; - void *pvVar11; - Room *room_00; - Entity_Player *familiar; - Entity_Player *this_01; - int extraout_ECX; - Game *game; - uint32_t extraout_ECX_00; - uint32_t extraout_ECX_01; - uint32_t extraout_ECX_02; - int extraout_EDX; - int extraout_EDX_00; - uint64_t *allocatedBytes; - uint32_t uVar12; - Room *room; - uint32_t *rngSeed; - void **roomData; - uint32_t local_100 [3]; - Vector heartPos2; - Vector heartPos; - Vector sackPos; - Vector greedStartPos; - Vector startPos; - Vector homeStartPos; - EntityList_EL familiars; - int redemptionEffect [3]; - uint32_t local_a8; - uint32_t nullEffect; - uint32_t local_a0; - int local_9c; - uint32_t local_98; - int foundSoulEffect [3]; - uint32_t local_88; - int salvationEffect [3]; - uint32_t local_78; - EntityList_EL darkEsaus; - Vector greedBasePos; - Vector trapdoorPos; - Vector homeBasePos; - uint64_t local_48; - Vector startX; - uint32_t local_34; - Game *local_30; - char local_29; - uint64_t local_24; - uint32_t local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity_Familiar *familiar; - Manager *manager; - - local_8 = 0xffffffff; - puStack_c = &LAB_00aff978; - local_10 = ExceptionList; - local_18 = __security_cookie ^ GHIDRA_UINT((salvationEffect + 0x20)); - ExceptionList = &local_10; - this->_delayedSfxId = 0; - this->_delayedSfxDelay = 0; - (this->_moveToTarget).x = g_vectorZero.x; - (this->_moveToTarget).y = g_vectorZero.y; - game = g_game; - local_34 = this; - if ((this->_variant == 0) && (isForced == 0)) { - if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) { - greedBasePos.x = 320.0; - spawnPos = &greedBasePos; - greedBasePos.y = 280.0; - outPosition = &greedStartPos; - } - else { - iVar6 = _get_index_plus_one_if_kind_4_5(local_18); - if ((iVar6 != 1) || (bVar5 = Level::IsAscent(GHIDRA_CAST(game)), bVar5 != 0)) { - spawnPos = PlayerManager::get_player_start_position - (&game->_playerManager,&startPos,this,&g_vectorZero, - GHIDRA_INT(&game->_playerManager)); - fVar1 = spawnPos->x; - (this->_pos).x = fVar1; - (this->_pos).y = spawnPos->y; - if ((game->_challenge == 0x1f) && (game->_stage == 0xb)) { - (this->_pos).x = fVar1 + 0.0; - (this->_pos).y = (this->_pos).y + 100.0; - } - uVar7 = game->_debugCurses; - iVar6 = game->_stage; - uVar12 = game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - game = g_game; - iVar9 = iVar6 + 1; - if ((~preventedCurses & (forcedCurses | uVar7 | uVar12) & 2) == 0) { - iVar9 = iVar6; - } - bVar5 = Level::IsAscent(GHIDRA_CAST(g_game)); - if ((bVar5 == 0) || ((iVar9 == 6 && (bVar5 = Level::IsAltPath(GHIDRA_CAST(game)), bVar5 != 0)))) - { - this = local_34; - } - else { - room = game->_room; - startX.x = g_vectorZero.x; - startX.y = g_vectorZero.y; - roomData = room->_doors; - uVar7 = 0; - do { - uVar12 = uVar7 + 1; - if (8 < uVar12) break; - if (*roomData != (void *)0x0) { - if (uVar7 != 0xffffffff) goto LAB_007a4df2; - break; - } - roomData = roomData + 1; - uVar7 = uVar12; - } while (uVar12 < 8); - uVar7 = Random(); - uVar7 = uVar7 & 7; - uVar12 = 0; - room = g_game->_room; - do { - if ((uVar7 < 8) && - ((*GHIDRA_CAST((*GHIDRA_CAST(((GHIDRA_CAST(room))->_stageType + 0x10)) + 0x38 + (uVar7 >> 5) * 4)) & - 1 << ((uint8_t)uVar7 & 0x1f)) != 0)) break; - uVar7 = uVar7 + 1 & 0x80000007; - if (GHIDRA_INT(uVar7) < 0) { - uVar7 = (uVar7 - 1 | 0xfffffff8) + 1; - } - uVar12 = uVar12 + 1; - } while (uVar12 < 8); - game = g_game; - local_30 = GHIDRA_CAST(room); -LAB_007a4df2: - this = local_34; - startX.x = g_vectorZero.x; - startX.y = g_vectorZero.y; - if (uVar7 < 8) { - startX.x = (float)(room->_doorGridPositions[uVar7] % room->_gridWidth) * 40.0 + 40.0; - startX.y = (float)(room->_doorGridPositions[uVar7] / room->_gridWidth) * 40.0 + 120.0; - } - uVar7 = uVar7 & 0x80000003; - if (GHIDRA_INT(uVar7) < 0) { - uVar7 = (uVar7 - 1 | 0xfffffffc) + 1; - } - switch(uVar7) { - case 0: - startX.x = startX.x + 40.0; - startX.y = startX.y + 0.0; - break; - case 1: - startX.y = startX.y + 40.0; - startX.x = startX.x + 0.0; - break; - case 2: - startX.x = startX.x - 40.0; - startX.y = startX.y - 0.0; - break; - case 3: - startX.y = startX.y - 40.0; - startX.x = startX.x - 0.0; - } - uVar7 = 0; - (local_34->_pos).x = startX.x; - (local_34->_pos).y = startX.y; - room_00 = game->_room; - if (0 < room_00->_gridHeight * room_00->_gridWidth) { - local_30 = GHIDRA_CAST(0x24); - do { - if (uVar7 < 0x1c0) { - local_34 = *(Entity_Player **) - (GHIDRA_INT(local_30->_roomList[0]._doors) + - GHIDRA_INT((room_00->_gridEntities + -0xe)) + -0x1c); - if ((local_34 != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_34)) + 0x4)))) == 0x11)) { - trapdoorPos.x = - (float)(local_34->_collisionIndex % room_00->_gridWidth) * 40.0 + 40.0; - trapdoorPos.y = - (float)(local_34->_collisionIndex / room_00->_gridWidth) * 40.0 + 120.0; - bVar5 = pathfinder_can_reach_pos(&trapdoorPos,&startX,room_00); - if (bVar5 != 0) { - iVar6 = local_34->_collisionIndex; - iVar9 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - (this->_pos).x = (float)(iVar6 % iVar9) * 40.0 + 40.0; - (this->_pos).y = (float)(iVar6 / iVar9) * 40.0 + 120.0; - break; - } - game = g_game; - } - } - room_00 = game->_room; - uVar7 = uVar7 + 1; - local_30 = GHIDRA_CAST(&local_30->_stageType); - } while (GHIDRA_INT(uVar7) < room_00->_gridHeight * room_00->_gridWidth); - } - } - goto LAB_007a4fdc; - } - homeBasePos.x = 320.0; - spawnPos = &homeBasePos; - homeBasePos.y = 380.0; - outPosition = &homeStartPos; - } - spawnPos = PlayerManager::get_player_start_position - (&game->_playerManager,outPosition,this,spawnPos,GHIDRA_INT(&game->_playerManager) - ); - (this->_pos).x = spawnPos->x; - (this->_pos).y = spawnPos->y; - } -LAB_007a4fdc: - if (this->_postLevelInitFinished == 0) { - ExceptionList = local_10; - return; - } - spawn_low_health_blood_splat(this); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1ae0)))) = 0; - if (this->_variant == 1) { - if (this->_isGlitchBaby != 0) { - this->_babySkin = 0x19; - InitBabySkin(this); - game = g_game; - uVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0xa8)))); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_playerManager))) + 0xa8)))); - if (uVar7 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_playerManager))) + 0xac)))) & 0x1f) ^ uVar7; - pEVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_playerManager))) + 0xb4)))); - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_playerManager))) + 0xb0)))) & 0x1f) ^ uVar7; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_playerManager))) + 0xa8)))) = uVar7 >> ((uint8_t)pEVar2 & 0x1f) ^ uVar7; - uVar7 = GetGlitchBabySubType(pEVar2); - this->_subtype = uVar7; - if (0x46 < uVar7) { - uVar7 = 0x47; - } - this->_babySkin = uVar7; - PlayExtraAnimation(this,GHIDRA_CAST("Glitch")); - if (this->_variant != 1) goto LAB_007a50ce; - } - iVar6 = this->_parent; - if (iVar6 != 0) { - fVar1 = *GHIDRA_CAST((iVar6 + 0x340)); - (this->_pos).x = *GHIDRA_CAST((iVar6 + 0x33c)); - (this->_pos).y = fVar1; - } - } -LAB_007a50ce: - this->_isLevelStartPending = 0; - FUN_007daff0(); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x42,-1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x4a,-1); - pvVar10 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x2b8 < GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar10) >> 2) && - (iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xae0)), iVar6 != 0)) { - salvationEffect[2] = *GHIDRA_CAST((iVar6 + 0x78)); - salvationEffect[1] = 0; - local_78 = 0; - salvationEffect[0] = iVar6; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(salvationEffect,-1); - } - pvVar10 = (g_manager->_itemConfig)._trinkets._begin; - if ((0xb4 < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar10) >> 2) && - (iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x2d0)), iVar6 != 0)) { - foundSoulEffect[2] = *GHIDRA_CAST((iVar6 + 0x78)); - foundSoulEffect[1] = 0; - local_88 = 0; - foundSoulEffect[0] = iVar6; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(foundSoulEffect,-1); - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x6d,-1); - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&darkEsaus,0x362,-1,-1,0,0); - local_8 = 0; - uVar7 = 0; - if (darkEsaus._size != 0) { - iVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&(darkEsaus)) + 0x4))); - do { - piVar8 = *GHIDRA_CAST((iVar6 + uVar7 * 4)); - if (GHIDRA_CAST(piVar8[0xf2]) == this) { - (**(code **)(*piVar8 + 0x28))(); - iVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&(darkEsaus)) + 0x4))); - } - uVar7 = uVar7 + 1; - } while (uVar7 < GHIDRA_UINT(darkEsaus._size)); - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x81,1); - if (this->_playerType == 0x27) { - iVar6 = 0x25; -LAB_007a5236: - ChangePlayerType(this,iVar6,0); - } - else if (this->_playerType == 0xb) { - iVar6 = 8; - goto LAB_007a5236; - } - if ((this->_playerType == 0x25) && (g_game->_challenge != 0x2c)) { - pvVar10 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar10) >> 2 < 0x6e) { - nullEffect = 0; - } - else { - nullEffect = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1b4)); - } - uVar7 = (g_game->_devilAngelRoomRNG)._seed; - local_a0 = 0; - local_98 = 0; - local_24 = 0x70000000b; - local_30 = GHIDRA_CAST(0xc); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar7 = uVar7 >> 0xb ^ uVar7; - uVar7 = uVar7 << 7 ^ uVar7; - local_9c = ((uVar7 >> 0xc ^ uVar7) % 0x14) * 0x1e + 0x262; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&nullEffect,1,1); - } - bVar5 = HasCollectible(this,0x2a4,0); - if (bVar5 != 0) { - iVar6 = GetHealthType(this); - if (((iVar6 == 0) && (iVar6 = GetHeartLimit(familiar,0), this->_maxHearts < iVar6)) && - (this->_redHearts < 3)) { - AddMaxHearts(this,2,0); - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(0x29,0,GHIDRA_CAST(0x0)); - } - pEVar2 = GHIDRA_CAST(this->_subPlayer); - if (((pEVar2 != GHIDRA_CAST(0x0)) && (iVar6 = GetHealthType(pEVar2), iVar6 == 0)) && - ((iVar6 = GetHeartLimit(this_01,0), pEVar2->_maxHearts < iVar6 && (pEVar2->_redHearts < 3)))) - { - AddMaxHearts(pEVar2,2,0); - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(0x29,0,GHIDRA_CAST(0x0)); - } - } - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar8 = (this->_temporaryeffects)._effects._begin; - piVar8 != (this->_temporaryeffects)._effects._end; piVar8 = piVar8 + 4) { - iVar6 = *GHIDRA_CAST(*piVar8); - if ((((iVar6 == 1) || (iVar6 == 3)) || (iVar6 == 4)) && ((GHIDRA_CAST(*piVar8))[1] == 0x2a1)) { - if (0 < piVar8[1]) { - iVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f04)))); - if (((iVar6 != 0) && (*GHIDRA_CAST((iVar6 + 0x28)) == 1000)) && (piVar8[1] == 1)) { - *GHIDRA_CAST((iVar6 + 0x450)) = 2; - } - pvVar10 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x2a1 < GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar10) >> 2) && - (iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xa84)), iVar6 != 0)) { - redemptionEffect[2] = *GHIDRA_CAST((iVar6 + 0x78)); - redemptionEffect[1] = 0; - local_a8 = 0; - redemptionEffect[0] = iVar6; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(redemptionEffect,-1); - } - } - break; - } - } - } - this->_forgottenBodyRoomIdx = -99999; - bVar5 = HasTrinket(this,0xa0,0); - if ((bVar5 != 0) && (local_30 = GHIDRA_CAST(GetTrinketMultiplier(this,0xa0)), 0 < GHIDRA_INT(local_30))) { - do { - pvVar10 = (this->_trinketRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(pvVar10) + 0xa00)); - uVar7 = *rngSeed; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *rngSeed; - if (uVar7 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - game = g_game; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xa04)) & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xa08)) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xa0c)) & 0x1f) ^ uVar7; - *rngSeed = uVar7; - spawnPos = Room::FindFreePickupSpawnPosition(game->_room,&sackPos,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,0x45,spawnPos,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - local_30 = GHIDRA_CAST((GHIDRA_INT(&local_30[-1]._console) + 3)); - } while (local_30 != GHIDRA_CAST(0x0)); - } - if ((isForced == 0) && (this->_backupPlayer != (void *)0x0)) { - *GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x1fc4)) = 1; - if (*GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x20e8)) != '\0') { - *GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x2620)) = 1; - } - } - if (0 < this->_eternalHearts) { - this->_eternalHearts = 0; - iVar9 = GetHealthType(this); - iVar6 = extraout_EDX; - if ((iVar9 == 1) && ((this->_playerType == 0xc || (iVar6 = 6, this->_playerType == 0x18)))) { - iVar6 = 0x2e; - } - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(iVar6,1,GHIDRA_CAST(0x0)); - AddMaxHearts(this,2,0); - AddHearts(this,2,0,0); - } - iVar6 = this->_subPlayer; - if ((iVar6 != 0) && (0 < *GHIDRA_CAST((iVar6 + 0x1348)))) { - *GHIDRA_CAST((iVar6 + 0x1348)) = 0; - iVar9 = GetHealthType(GHIDRA_CAST(this->_subPlayer)); - iVar6 = extraout_EDX_00; - if ((iVar9 == 1) && - ((*GHIDRA_CAST((extraout_ECX + 0x13c0)) == 0xc || - (iVar6 = 6, *GHIDRA_CAST((extraout_ECX + 0x13c0)) == 0x18)))) { - iVar6 = 0x2e; - } - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(iVar6,1,GHIDRA_CAST(0x0)); - AddMaxHearts(GHIDRA_CAST(this->_subPlayer),2,0); - AddHearts(GHIDRA_CAST(this->_subPlayer),2,0,0); - } - if (this->_isCoopGhost == 0) { - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,0xe8,1,0,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - uVar7 = 0; - if (familiars._size != 0) { - do { - iVar6 = __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + uVar7 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - if ((iVar6 != 0) && (*GHIDRA_CAST((iVar6 + 0x410)) == this)) { - *GHIDRA_CAST((iVar6 + 0x30)) = 0; - } - uVar7 = uVar7 + 1; - } while (uVar7 < GHIDRA_UINT(familiars._size)); - } - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) != 0) { - uVar7 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - qVar4 = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar7; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar4) < uVar7)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - } - local_8 = local_8 & 0xffffff00; - } - } - bVar5 = HasCollectible(this,0x36,0); - if ((bVar5 != 0) || (bVar5 = HasCollectible(this,0x14d,0), bVar5 != 0)) { - Level::ApplyMapEffect(GHIDRA_CAST(g_game)); - } - bVar5 = HasCollectible(this,0xf6,0); - if ((bVar5 != 0) || (bVar5 = HasCollectible(this,0x14d,0), bVar5 != 0)) { - Level::ApplyBlueMapEffect(GHIDRA_CAST(g_game)); - } - local_29 = '\0'; - bVar5 = HasTrinket(this,0x3b,0); - if (bVar5 != 0) { - GetTrinketMultiplier(this,0x3b); - iVar6 = __ftoui3(); - uVar7 = Random(); - local_29 = uVar7 % 100 < GHIDRA_UINT((iVar6 * 0x19)); - } - bVar5 = HasCollectible(this,0x15,0); - if (((bVar5 != 0) || (bVar5 = HasCollectible(this,0x14d,0), bVar5 != 0)) || (local_29 != '\0')) { - Level::ApplyCompassEffect(GHIDRA_CAST(g_game),1); - } - bVar5 = HasTrinket(this,0x37,0); - if (bVar5 != 0) { - iVar6 = GetTrinketMultiplier(this,0x37); - AddEternalHearts(this,iVar6); - } - bVar5 = HasCollectible(this,0x24c,0); - game = g_game; - if (bVar5 != 0) { - if (-1 < g_game->_lastBossRoomListIdx) { - piVar8 = &g_game->_roomList[g_game->_lastBossRoomListIdx].DisplayFlags; - *piVar8 = *piVar8 | 4; - } - Minimap::Refresh(&game->_minimap); - piVar8 = &game->_levelStateFlags; - *piVar8 = *piVar8 | 0x40000; - } - bVar5 = HasCollectible(this,0x24d,0); - if (bVar5 != 0) { - Level::reveal_secret_room(GHIDRA_CAST(g_game)); - } - bVar5 = HasTrinket(this,0x17,0); - if (bVar5 != 0) { - iVar6 = GetTrinketMultiplier(this,0x17); - local_30 = GHIDRA_CAST(0x21); - if (iVar6 == 2) { - local_30 = GHIDRA_CAST(0x42); - } - else if (2 < iVar6) { - local_30 = GHIDRA_CAST(0x64); - } - pvVar10 = (this->_trinketRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(pvVar10) + 0x170)); - uVar7 = *rngSeed; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *rngSeed; - if (uVar7 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x174)) & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x178)) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x17c)) & 0x1f) ^ uVar7; - *rngSeed = uVar7; - if (GHIDRA_CAST((uVar7 % 100)) < local_30) { - iVar6 = 0; - local_30 = g_game; - if (0 < g_game->_nbRooms) { - roomData = &g_game->_roomList[0].Data; - game = g_game; - do { - pvVar10 = *roomData; - if (pvVar10 == (void *)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("[error] Room %d is not initialized\n")); - pvVar10 = *roomData; - game = local_30; - } - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 8)) == 8) { - piVar8 = &game->_roomList[iVar6].DisplayFlags; - *piVar8 = *piVar8 | 4; - break; - } - iVar6 = iVar6 + 1; - roomData = roomData + 0x2e; - } while (iVar6 < game->_nbRooms); - } - Minimap::Refresh(&g_game->_minimap); - } - } - bVar5 = HasCollectible(this,0x236,0); - if (bVar5 != 0) { - AddSoulHearts(this,1,0); - } - uVar7 = 0; - do { - uVar12 = this->_activeDesc[uVar7]._item; - if (uVar12 == 0x93) { - if (uVar7 == 3) { - iVar6 = 0; - } - else if (((uVar7 == 2) && (this->_activeDesc[2]._item == 0x244)) && - (g_game->_challenge == 0x2c)) { - iVar6 = 0; - } - else { - iVar6 = GetCollectibleMaxCharge(this,0x93,this->_activeDesc[uVar7]._varData,0x93); - } -LAB_007a5a54: - AddActiveCharge(this,iVar6,uVar7,0,0,1); - uVar12 = extraout_ECX_01; - } - else if (uVar12 == 0x1a6) { - this->_activeDesc[uVar7]._varData = 0; - SetActiveCharge(this,0,uVar7); - uVar12 = extraout_ECX_00; - } - else if (uVar12 == 0x27e) { - iVar6 = 1; - goto LAB_007a5a54; - } - uVar7 = uVar7 + 1; - } while (uVar7 < 4); - if (((this->_hasCurseMistEffect == 0) && (this->_isCoopGhost == 0)) && - (2 < this->_playerForms[0xf])) { - uVar12 = uVar12 & 0xffffff00; - uVar7 = 0; - local_29 = '\0'; - do { - if (this->_activeDesc[uVar7]._item == 0x23) { - if ((char)uVar12 == '\0') { - if (this->_activeDesc[uVar7]._varData == 1) { - if (uVar7 == 3) { - iVar6 = 0; - } - else { - iVar6 = GetCollectibleMaxCharge(this,0x23,1,uVar12); - } - AddActiveCharge(this,iVar6,uVar7,0,0,1); - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(0x2f,3,GHIDRA_CAST(0x0)); - manager = g_manager; - local_30 = GHIDRA_CAST(0x419); - seed_fart_sound_override(GHIDRA_CAST(&local_30)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,2,0,1.0,0.0); - local_29 = '\x01'; - } - } - else { - this->_activeDesc[uVar7]._varData = 0; - } - HUD::InvalidateActiveItem(&g_game->_hud,this,uVar7); - uVar12 = CONCAT31((int3)(GHIDRA_UINT(extraout_ECX_02) >> 8),local_29); - } - uVar7 = uVar7 + 1; - } while (uVar7 < 4); - if ((char)uVar12 == '\0') { - this->_activeDesc[0]._varData = 1; - iVar6 = GetCollectibleMaxCharge(this,this->_activeDesc[0]._item,1,uVar12); - AddActiveCharge(this,iVar6,0,0,0,1); - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(0x2f,3,GHIDRA_CAST(0x0)); - } - } - bVar5 = HasTrinket(this,0x8e,0); - if (bVar5 != 0) { - iVar6 = GetTrinketMultiplier(this,0x8e); - iVar6 = iVar6 << 2; - if (iVar6 != 0) { - do { - AddWisp(this,0x248,&this->_pos,0,0); - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - } - } - bVar5 = HasTrinket(this,0xa8,0); - if (bVar5 != 0) { - iVar6 = GetTrinketMultiplier(this,0xa8); - AddBoneHearts(this,iVar6); - } - bVar5 = HasCollectible(this,0x102,0); - if (bVar5 != 0) { - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_34) + 2)),0x11c,1,-1,0); - this->_isPlayingItemAnimation = 0; - ANM2::Reset(&this->_bodySprite); - (this->_sprite)._playbackSpeed = 1.0; - AnimationState::SetAnimationData(&(this->_sprite)._overlayAnimState,(void *)0x0); - bVar5 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("Glitch"),1); - if (bVar5 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - this->_isPlayingExtraAnimation = 1; - this->_isPlayingItemAnimation = 0; - } - bVar5 = HasCollectible(this,0x188,0); - if (bVar5 != 0) { - bVar5 = HasCollectible(this,299,0); - if (bVar5 == 0) { - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar8 = (this->_temporaryeffects)._effects._begin; - piVar8 != (this->_temporaryeffects)._effects._end; piVar8 = piVar8 + 4) { - iVar6 = *GHIDRA_CAST(*piVar8); - if ((((iVar6 == 1) || (iVar6 == 3)) || (iVar6 == 4)) && ((GHIDRA_CAST(*piVar8))[1] == 299)) - goto LAB_007a5d32; - } - } - pvVar10 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar10) >> 2 < 300) { - Item = GHIDRA_CAST(0x0); - } - else { - Item = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x4ac)); - } - RemoveCostume(this,Item); - } -LAB_007a5d32: - this->_cacheFlags = this->_cacheFlags | 0xffff; - } - bVar5 = HasTrinket(this,0x77,0); - if (bVar5 != 0) { - iVar6 = GetTrinketMultiplier(this,0x77); - if (iVar6 == 1) { - iVar6 = GetHealthType(this); - if ((iVar6 == 1) || (iVar6 == 2)) { - iVar6 = this->_maxHearts; - } - else { - iVar6 = this->_maxHearts + this->_boneHearts * 2; - } - iVar6 = (iVar6 - this->_redHearts) / 2; - } - else { - if (iVar6 != 2) { - if (iVar6 == 3) { - iVar6 = GetHealthType(this); - if ((iVar6 == 1) || (iVar6 == 2)) { - iVar6 = this->_maxHearts; - } - else { - iVar6 = this->_maxHearts + this->_boneHearts * 2; - } - iVar6 = iVar6 - this->_redHearts; - iVar9 = 1; - if (1 < iVar6) { - iVar9 = iVar6; - } - AddHearts(this,iVar9,0,0); - uVar7 = Random(); - spawnPos = Room::get_random_pickup_position(g_game->_room,&heartPos,0,0); - Game::Spawn(g_game,5,10,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); - uVar7 = Random(); - spawnPos = Room::get_random_pickup_position(g_game->_room,&heartPos2,0,0); - Game::Spawn(g_game,5,10,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); - } - goto LAB_007a5eb3; - } - iVar6 = GetHealthType(this); - if ((iVar6 == 1) || (iVar6 == 2)) { - iVar6 = this->_maxHearts - this->_redHearts; - } - else { - iVar6 = (this->_maxHearts + this->_boneHearts * 2) - this->_redHearts; - } - } - iVar9 = 1; - if (1 < iVar6) { - iVar9 = iVar6; - } - AddHearts(this,iVar9,0,0); - } -LAB_007a5eb3: - if (g_game->_challenge == 0x1f) { - pvVar10 = (this->_history)._historyItems._begin; - local_34 = GHIDRA_CAST(0x0); - iVar9 = GHIDRA_INT((this->_history)._historyItems._end) - GHIDRA_INT(pvVar10); - iVar6 = iVar9 >> 0x1f; - if (iVar9 / 0x1c + iVar6 != iVar6) { - iVar6 = 0; - do { - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar6 + 4)) == '\0') && - (bVar5 = HasCollectible(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar6 + 8)),0), bVar5 != 0)) { - RemoveCollectible(this,*GHIDRA_CAST((GHIDRA_INT((this->_history)._historyItems._begin) + - GHIDRA_INT(local_34) * 0x1c + 8)),0,0,1); - break; - } - pvVar10 = (this->_history)._historyItems._begin; - iVar6 = iVar6 + 0x1c; - local_34 = GHIDRA_CAST((GHIDRA_INT(local_34) + 1)); - } while (local_34 < GHIDRA_UINT(((GHIDRA_INT((this->_history)._historyItems._end) - GHIDRA_INT(pvVar10)) / 0x1c))); - } - AddMaxHearts(this,-2,0); - if (((this->_redHearts < 1) && (this->_soulHearts < 1)) && (this->_boneHearts < 1)) { - AddSoulHearts(this,1,0); - } - } - pvVar10 = (this->_collectibleRNGs)._begin; - local_48 = 0x500000001; - uVar7 = g_game->_dungeonPlacementSeed; - local_34 = GHIDRA_CAST(0x13); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar7 = uVar7 >> 1 ^ uVar7; - uVar7 = uVar7 << 5 ^ uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x2c4)) = 0x700000002; - local_30 = GHIDRA_CAST((uVar7 >> 0x13 ^ uVar7)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x2cc)) = 9; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x2c0)) = local_30; - pvVar10 = (this->_collectibleRNGs)._begin; - startX.y = (float)(GHIDRA_INT(pvVar10) + 0x1440); - if (local_30 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar7 = GHIDRA_UINT(local_30) >> 1 ^ GHIDRA_UINT(local_30); - uVar7 = uVar7 << 5 ^ uVar7; - uVar7 = uVar7 >> 0x13 ^ uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1444)) = 0x700000002; - *GHIDRA_CAST(startX.y) = uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x144c)) = 9; - pvVar10 = (this->_collectibleRNGs)._begin; - startX.y = (float)(GHIDRA_INT(pvVar10) + 0x13c0); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar7 = uVar7 >> 1 ^ uVar7; - uVar7 = uVar7 << 5 ^ uVar7; - uVar7 = uVar7 >> 0x13 ^ uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x13c4)) = 0x700000002; - *GHIDRA_CAST(startX.y) = uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x13cc)) = 9; - pvVar10 = (this->_trinketRNGs)._begin; - startX.y = (float)(GHIDRA_INT(pvVar10) + 0x2b0); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar7 = uVar7 >> 1 ^ uVar7; - uVar7 = uVar7 << 5 ^ uVar7; - uVar7 = uVar7 >> 0x13 ^ uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x2b4)) = 0x700000002; - *GHIDRA_CAST(startX.y) = uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 700)) = 9; - pvVar10 = (this->_pillRNGs)._begin; - startX.y = (float)(GHIDRA_INT(pvVar10) + 0x130); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar7 = uVar7 >> 1 ^ uVar7; - uVar7 = uVar7 << 5 ^ uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x134)) = 0x700000002; - *GHIDRA_CAST(startX.y) = uVar7 >> 0x13 ^ uVar7; - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x13c)) = 9; - if (isForced == 0) { - this->_hasGoldenKey = 0; - this->_hasGoldenBomb = 0; - } - pvVar10 = (this->_levelEffectItems)._begin; - if ((pvVar10 != (this->_levelEffectItems)._end) && - (GHIDRA_CAST(local_100) != &this->_levelEffectItems)) { - pvVar11 = (this->_levelEffectItems)._capacity; - (this->_levelEffectItems)._begin = (void *)0x0; - (this->_levelEffectItems)._end = (void *)0x0; - (this->_levelEffectItems)._capacity = (void *)0x0; - if (pvVar10 != (void *)0x0) { - uVar7 = GHIDRA_INT(pvVar11) - GHIDRA_INT(pvVar10) & 0xfffffffc; - pvVar11 = pvVar10; - if (0xfff < uVar7) { - pvVar11 = *(void **)(GHIDRA_CAST(pvVar10) + -4); - uVar7 = uVar7 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar10) + (-4 - GHIDRA_INT(pvVar11))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar11,uVar7); - } - } - manager = g_manager; - this->_bloodLustCounter = 0; - pvVar10 = (manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar10) >> 2 < 0x9e) { - iVar6 = 0; - } - else { - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x274)); - } - uVar7 = *GHIDRA_CAST((iVar6 + 0x54)) | this->_cacheFlags; - this->_cacheFlags = uVar7; - pvVar10 = (manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar10) >> 2 < 0x2b8) { - iVar6 = 0; - } - else { - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xadc)); - } - this->_cacheFlags = uVar7 | *GHIDRA_CAST((iVar6 + 0x54)); - EvaluateItems(this); - if (isForced != 0) { - uVar7 = 0; - pvVar10 = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1264)) != 0) { - do { - familiar = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x125c)) + uVar7 * 4)); - if (((familiar != GHIDRA_CAST(0x0)) && (familiar->_type == 3)) && - (familiar->_player == this)) { - (GHIDRA_CAST((familiar)))->Entity_Familiar::level_start(); - } - uVar7 = uVar7 + 1; - } while (uVar7 < *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1264))); - } - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(darkEsaus)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(darkEsaus)) + 0x4))) != 0) { - uVar7 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(darkEsaus)) + 0x4))) + -4)); - qVar4 = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar7; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar4) < uVar7)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(darkEsaus)) + 0x4))) + -4))); - } - } - ExceptionList = local_10; - return; -} - -// 007a6300 -void Entity_Player::ShootCandle(Vector *direction) -{ - uint8_t isHasBirdsEye; - uint8_t isHasGhostPepper; - uint32_t rngResult; - Vector fireDirection; - - if ((NAN(g_vectorZero.x)) || (NAN(g_vectorZero.y))) { - fireDirection.x = g_vectorZero.x; - fireDirection.y = g_vectorZero.y; - } - else { - fireDirection.x = (this->_movementVector).x; - if ((fireDirection.x == g_vectorZero.x) && ((this->_movementVector).y == g_vectorZero.y)) { - fireDirection.x = 0.0; - fireDirection.y = (float)&DAT_bf800000; - } - else { - fireDirection.x = -fireDirection.x; - fireDirection.y = (float)(GHIDRA_UINT((this->_movementVector).y) ^ 0x80000000); - } - } - isHasBirdsEye = HasCollectible(this,0x268,0); - isHasGhostPepper = HasCollectible(this,0x1ef,0); - if (isHasBirdsEye == 0) { - if (isHasGhostPepper == 0) { - return; - } - } - else if ((isHasGhostPepper == 0) || (rngResult = Random(), (rngResult & 1) == 0)) { - ShootRedCandle(this,&fireDirection); - return; - } - ShootBlueCandle(this,&fireDirection); - return; -} - -// 007a6430 -int Entity_Player::GetTrinket(uint32_t slot) -{ - if (slot < 2) { - return this->_trinketsID[slot]; - } - return 0; -} - -// 007a6450 -void Entity_Player::SetControllerIndex(int index, uint8_t isIncludePlayerOwned) -{ - int iVar1; - uint32_t entityCount; - int *piVar3; - uint32_t *puVar4; - void *playerListEnd; - int iVar5; - uint32_t entityIndex; - PlayerManager *playerManager; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - uint32_t entityCount; - Game *game; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00aff9bd; - local_10 = ExceptionList; - entityCount = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - KAGE_LogMessage(1,(uint8_t *) - "Entity_Player::SetControllerId() Setting controller ID to %d, (Prev: %d) \n"); - game = g_game; - if ((index != -1) && (iVar1 = this->_controllerIndex, iVar1 != index)) { - if (iVar1 == -1) { - FUN_009b94e0(index); - } - else if ((*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0x5c))) != '\0') { - iVar5 = 0; - piVar3 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0x60)))); - do { - if (*piVar3 == iVar1) { - KAGE_LogMessage(1,GHIDRA_CAST("Reassigning Player Color (%d) Prev(%d) New(%d) \n")); - (game->_seedEffects)._stageSeeds[iVar5 + -0x25] = index; - goto LAB_007a650d; - } - iVar5 = iVar5 + 1; - piVar3 = piVar3 + 1; - } while (iVar5 < 4); - KAGE_LogMessage(8,(uint8_t *) - "PlayerManager::ReassignPlayerColor(%d, %d) cannot reassign the color, because there is no color assigned to the original controller ID \n" - ); - } - } -LAB_007a650d: - if (this->_controllerIndex != -1) { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x125c)); - entityCount = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1264)); - entityIndex = 0; - uStack_8 = 0; - if (entityCount != 0) { - do { - iVar5 = __RTDynamicCast(*GHIDRA_CAST((iVar1 + entityIndex * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0,entityCount); - if ((iVar5 != 0) && (*GHIDRA_CAST((iVar5 + 0xf1c)) == this->_controllerIndex)) { - *GHIDRA_CAST((iVar5 + 0xf1c)) = index; - } - entityIndex = entityIndex + 1; - } while (entityIndex < entityCount); - } - uStack_8 = 0xffffffff; - } - this->_controllerIndex = index; - if (isIncludePlayerOwned != 0) { - if (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0)) { - SetControllerIndex(GHIDRA_CAST(this->_subPlayer),index,0); - } - if (this->_backupPlayer != GHIDRA_CAST(0x0)) { - SetControllerIndex(this->_backupPlayer,this->_controllerIndex,0); - } - if (GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0)) { - SetControllerIndex(GHIDRA_CAST(this->_twinPlayer),this->_controllerIndex,0); - } - if (this->_parent == 0) { - entityCount = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) - >> 2 != 0) { - do { - playerListEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - } - puVar4 = (playerManager->_playerList)._begin; - if (entityCount < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(puVar4) >> 2))) { - puVar4 = puVar4 + entityCount; - } - if (GHIDRA_CAST((GHIDRA_CAST(*puVar4))->_parent) == this) { - SetControllerIndex(GHIDRA_CAST(*puVar4),this->_controllerIndex,1); - } - entityCount = entityCount + 1; - playerManager = &g_game->_playerManager; - } while (entityCount < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - } - ExceptionList = local_10; - return; -} - -// 007a6680 -void Entity_Player::room_exit(uint8_t isKeepHolyMantle) -{ - void **ppvVar1; - uint8_t bVar2; - ItemConfig_Item *costumeItem; - void *pvVar3; - int *piVar4; - int *piVar5; - int *piVar6; - int familiarCount; - int iVar7; - ItemConfig_Item *activeConfig; - int local_44; - ActiveItemDesc *activeDesc; - int effectDesc [3]; - uint32_t uStack_24; - int removeDesc [3]; - uint32_t uStack_14; - uint32_t activeItemId; - int roomEntity; - TemporaryEffects *tempEffects; - - FlushQueueItem(this); - if (isKeepHolyMantle == 0) { - this->_holyMantleState = 0; - } - tempEffects = &this->_temporaryeffects; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13b5)))) = 0; - this->_cursedPennyPending = 0; - this->_roomDamageTaken = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16b8)))) = 0; - bVar2 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x15); - if ((bVar2 != 0) && (bVar2 = HasCollectible(this,0x15,0), bVar2 == 0)) { - Level::RemoveCompassEffect(GHIDRA_CAST(g_game)); - } - local_44 = this->_metronomeCollectibleID; - if (local_44 != 0) { - pvVar3 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x7a0 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar3) & 0xfffffffcU)) - ) && (iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x7a0)), iVar7 != 0)) { - effectDesc[2] = *GHIDRA_CAST((iVar7 + 0x78)); - effectDesc[1] = 0; - uStack_24 = 0; - effectDesc[0] = iVar7; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveEffect(effectDesc,1); - local_44 = this->_metronomeCollectibleID; - } - costumeItem = ItemConfig::GetCollectible(&g_manager->_itemConfig,local_44); - this->_metronomeCollectibleID = 0; - if ((this->_activeDesc[0]._item != local_44) && - (bVar2 = HasCollectible(this,local_44,0), bVar2 == 0)) { - RemoveCostume(this,costumeItem); - } - } - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar5 = (this->_temporaryeffects)._effects._begin; - piVar5 != (this->_temporaryeffects)._effects._end; piVar5 = piVar5 + 4) { - if ((*GHIDRA_CAST(*piVar5) == 2) && ((GHIDRA_CAST(*piVar5))[1] == 0x76)) { - pvVar3 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar3) & 0xfffffffcU)) < 0xa1) - { - costumeItem = GHIDRA_CAST(0x0); - } - else { - costumeItem = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0xa0)); - } - RemoveCostume(this,costumeItem); - break; - } - } - } - if ((((this->_temporaryeffects)._disabled == 0) && - (pvVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(0x246), pvVar3 != (void *)0x0)) - && (local_44 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 4)), 0 < local_44)) { - do { - pvVar3 = (g_manager->_itemConfig)._nullItems._begin; - if (0x11c < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar3) & 0xfffffffcU))) - { - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x11c)); - if (iVar7 != 0) { - effectDesc[2] = *GHIDRA_CAST((iVar7 + 0x78)); - effectDesc[1] = 0; - uStack_24 = 0; - effectDesc[0] = iVar7; - if ((this->_temporaryeffects)._disabled == 0) { - piVar5 = (this->_temporaryeffects)._effects._end; - for (piVar4 = (this->_temporaryeffects)._effects._begin; piVar4 != piVar5; - piVar4 = piVar4 + 4) { - if (*piVar4 == iVar7) { - piVar4[1] = piVar4[1] + 1; - piVar4[2] = piVar4[2] + effectDesc[2]; - goto LAB_007a68f1; - } - } - if (piVar5 == (this->_temporaryeffects)._effects._capacity) { - msvc::vector::_Emplace_reallocate(piVar5,effectDesc); - } - else { - *piVar5 = iVar7; - piVar5[1] = 0; - piVar5[2] = effectDesc[2]; - piVar5[3] = 0; - ppvVar1 = &(this->_temporaryeffects)._effects._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x10); - } - pvVar3 = (this->_temporaryeffects)._effects._begin; - *(uint32_t *) - (((GHIDRA_INT((this->_temporaryeffects)._effects._end) - GHIDRA_INT(pvVar3) & 0xfffffff0U) - 0xc) + - GHIDRA_INT(pvVar3)) = 1; -LAB_007a68f1: - tempEffects->_cacheFlags = tempEffects->_cacheFlags | *GHIDRA_CAST((effectDesc[0] + 0x54)); - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - } - } - pvVar3 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x918 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar3) & - 0xfffffffcU))) && (iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x918)), iVar7 != 0)) { - removeDesc[2] = *GHIDRA_CAST((iVar7 + 0x78)); - removeDesc[1] = 0; - uStack_14 = 0; - removeDesc[0] = iVar7; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveEffect(removeDesc,1); - } - local_44 = local_44 + -1; - } while (local_44 != 0); - } - if ((this->_temporaryeffects)._disabled == 0) { - piVar5 = (this->_temporaryeffects)._effects._begin; - piVar4 = (this->_temporaryeffects)._effects._end; - if (piVar5 != piVar4) { -LAB_007a6984: - if ((*GHIDRA_CAST(*piVar5) != 0) || ((GHIDRA_CAST(*piVar5))[1] != 0x6e)) goto LAB_007a6991; - if ((this->_playerType != 0x1a) || - (this->_boneHearts + this->_goldenHearts + this->_soulHearts + this->_eternalHearts + - this->_redHearts != 1)) goto LAB_007a6a2f; - familiarCount = 0; - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1254)); - if (iVar7 != 0) { - piVar5 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x124c)); - do { - roomEntity = *piVar5; - if (((((roomEntity != 0) && (*GHIDRA_CAST((roomEntity + 0x28)) == 3)) && - (*GHIDRA_CAST((roomEntity + 0x410)) == this)) && - ((*GHIDRA_CAST((roomEntity + 0x2c)) == 0xee && (*GHIDRA_CAST((roomEntity + 0x30)) != 7)))) && - (*GHIDRA_CAST((roomEntity + 0x173)) == '\0')) { - familiarCount = familiarCount + 1; - } - piVar5 = piVar5 + 1; - iVar7 = iVar7 + -1; - } while (iVar7 != 0); - if (familiarCount != 0) { -LAB_007a6a2f: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x6e,-1); - } - } - } - } -LAB_007a6a3a: - ClearTemporaryEffects(this); - activeDesc = this->_activeDesc; - local_44 = 4; - do { - activeItemId = activeDesc->_item; - if (activeItemId != 0) { - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar5 = (this->_temporaryeffects)._effects._begin; - piVar5 != (this->_temporaryeffects)._effects._end; piVar5 = piVar5 + 4) { - iVar7 = *GHIDRA_CAST(*piVar5); - if ((((iVar7 == 1) || (iVar7 == 3)) || (iVar7 == 4)) && - (*GHIDRA_CAST((*piVar5 + 4)) == activeItemId)) { - if (activeItemId != 0x31) goto LAB_007a6b37; - break; - } - } - } - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(activeItemId)) goto LAB_007a6af0; -LAB_007a6b0a: - activeConfig = GHIDRA_CAST(0x0); - } - else if (GHIDRA_INT(activeItemId) < 0) { - if ((GHIDRA_INT(activeItemId) < 0) && - (pvVar3 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~activeItemId) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar3) >> 2)) { - activeConfig = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar3) + ~activeItemId * 4))); - } - else { - activeConfig = GHIDRA_CAST(0x0); - } - } - else { -LAB_007a6af0: - pvVar3 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar3) >> 2 <= GHIDRA_INT(activeItemId) - ) goto LAB_007a6b0a; - activeConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + activeItemId * 4)); - } - if ((activeConfig->addCostumeOnPickup == 0) || - (bVar2 = HasCollectible(this,activeItemId,0), bVar2 == 0)) { - RemoveCostume(this,activeConfig); - } - } -LAB_007a6b37: - activeDesc = activeDesc + 1; - local_44 = local_44 + -1; - } while (local_44 != 0); - if ((this->_itemState != 0x25c) || (*GHIDRA_CAST(&g_game->_stageTransition) != 0)) { - ANM2::Reset(&this->_bodySprite); - this->_isPlayingItemAnimation = 0; - ResetItemState(this); - this->_itemStateCooldown = 0; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1d78)))) <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c54)))) && - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c54)))) != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1d78))))) { - list_anm2_state_assign(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b34)))); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c5c)))) != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c60)))) = **GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c58)))); - } - msvc::deque<12byte>::_Tidy(); - if ((this->_parent != 0) && ((this->_temporaryeffects)._disabled == 0)) { - piVar5 = (this->_temporaryeffects)._effects._begin; - piVar4 = (this->_temporaryeffects)._effects._end; - piVar6 = piVar5; - if (piVar5 != piVar4) { - do { - if ((*GHIDRA_CAST(*piVar6) == 0) && ((GHIDRA_CAST(*piVar6))[1] == 0x78)) goto LAB_007a6c2c; - piVar6 = piVar6 + 4; - } while (piVar6 != piVar4); - while ((piVar6 = GHIDRA_CAST(*piVar5), *piVar6 != 0 || (piVar6[1] != 0x79))) { - piVar5 = piVar5 + 4; - if (piVar5 == piVar4) { - return; - } - } -LAB_007a6c2c: - PlayerManager::RemoveCoPlayer(&g_game->_playerManager,this,(uint8_t)piVar6); - } - } - return; -LAB_007a6991: - piVar5 = piVar5 + 4; - if (piVar5 == piVar4) goto LAB_007a6a3a; - goto LAB_007a6984; -} - -// 007a6c50 -void Entity_Player::room_enter() -{ - Room *pRVar1; - code *pcVar2; - ANM2 *pAVar3; - uint64_t qVar4; - Vector *pVVar5; - uint8_t bVar6; - uint32_t uVar7; - ItemConfig_Item *collectible; - PlayerCostumeMap *pPVar8; - RoomDescriptor *roomDesc; - uint32_t uVar9; - Entity *spawned; - uint8_t *format; - void *pvVar10; - int *piVar11; - ItemConfig *itemConfig; - Entity_Player *extraout_ECX; - Entity_Player *extraout_ECX_00; - Entity_Player *extraout_ECX_01; - Entity_Player *extraout_ECX_02; - Entity_Player *itemConfig; - EntityConfig_Entity *entityConfig; - std_string *psVar12; - uint32_t *activesCapacity; - uint32_t *puVar13; - Game *game; - void **ppvVar14; - int iVar15; - uint8_t *wispChance; - void *ptr; - int followedPlayer; - float enemyPosX; - float fVar17; - float enemyPosX; - uint32_t uVar18; - TypeDescriptor *pTVar19; - TypeDescriptor *pTVar20; - uint8_t unk2; - uint32_t uVar21; - EntityRef charmRef; - EntityRef sourceRef; - ColorMod cloudColor; - uint8_t lowerBound [8]; - void *configNode; - uint8_t queryList [12]; - int iStack_cc; - float nullEffect; - uint32_t local_c4; - uint32_t nullEffectCooldown; - uint32_t local_bc; - int collectibleEffect; - uint32_t local_b4; - uint32_t collectibleEffectCooldown; - uint32_t local_ac; - Vector launchVelocity; - Vector enterPos; - uint32_t configKey; - uint32_t collectibleId; - Entity_Player *local_90; - void *actives; - uint32_t *activesEnd; - uint32_t *activesCapacityEnd; - Vector *local_80; - void *local_7c; - uint32_t *local_78; - uint32_t *local_74; - uint8_t *local_70; - std_string *entityName [5]; - uint32_t entityNameCapacity; - uint8_t message [64]; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - GridEntity_Door *door; - Manager *manager; - uint32_t *nextNode; - uint32_t *node; - float targetX; - - local_8 = 0xffffffff; - puStack_c = &LAB_00affa03; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((message + 0x50)); - if (this->_postLevelInitFinished == 0) { - return; - } - ExceptionList = &local_10; - local_90 = this; - if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) >> 0xd & 1) != 0) { - AddCurseMistEffect(this); - } - if (((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0xf) && - (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x40)) == 1)) && - (bVar6 = HasTrinket(this,0xb6,0), bVar6 != 0)) { - wispChance = GHIDRA_CAST(0x0); - local_70 = GHIDRA_CAST(0x0); - followedPlayer = GetTrinketMultiplier(this,0xb6); - if (followedPlayer == 2) { - wispChance = GHIDRA_CAST(0x32); -LAB_007a6d0d: - local_70 = wispChance; - } - else if (followedPlayer == 3) { - wispChance = GHIDRA_CAST(0x64); - goto LAB_007a6d0d; - } - local_7c = (void *)0x0; - do { - if (wispChance == GHIDRA_CAST(0x0)) { -LAB_007a6f9e: - AddWisp(this,0x248,&this->_pos,1,0); - } - else { - pvVar10 = (this->_trinketRNGs)._begin; - puVar13 = GHIDRA_CAST((GHIDRA_INT(pvVar10) + 0xb60)); - uVar7 = *puVar13; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *puVar13; - if (uVar7 == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xb64)) & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xb68)) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xb6c)) & 0x1f) ^ uVar7; - *puVar13 = uVar7; - if (wispChance <= GHIDRA_CAST((uVar7 % 100))) goto LAB_007a6f9e; - actives = (void *)0x0; - puVar13 = GHIDRA_CAST(0x0); - local_74 = GHIDRA_CAST(0x0); - activesEnd = GHIDRA_CAST(0x0); - activesCapacityEnd = GHIDRA_CAST(0x0); - local_8 = 0; - uVar7 = 0; - itemConfig = &g_manager->_itemConfig; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((itemConfig->_collectibles)._begin) >> 2 != 0) { - activesCapacity = GHIDRA_CAST(0x0); - do { - collectible = ItemConfig::GetCollectible(itemConfig,uVar7); - if (collectible != GHIDRA_CAST(0x0)) { - if (collectible->type == 3) { - if (collectible[1].type != 0) { - if (0 < *GHIDRA_CAST((collectible[1].type + 400))) { - collectibleId = uVar7; - if (puVar13 == activesCapacity) { - msvc::vector::_Emplace_reallocate(puVar13,&collectibleId); - activesCapacity = activesCapacityEnd; - puVar13 = activesEnd; - } - else { - *puVar13 = uVar7; - activesEnd = puVar13 + 1; - puVar13 = activesEnd; - } - } - } - } - } - uVar7 = uVar7 + 1; - itemConfig = &g_manager->_itemConfig; - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((itemConfig->_collectibles)._begin) >> 2))); - this = local_90; - local_74 = activesCapacity; - } - pvVar10 = actives; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0xb60)))))->RNG::RandomInt(GHIDRA_INT(puVar13) - GHIDRA_INT(actives) >> 2); - AddWisp(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + uVar7 * 4)),&this->_pos,1,0); - local_8 = 0xffffffff; - if (pvVar10 != (void *)0x0) { - uVar7 = (GHIDRA_INT(local_74) - GHIDRA_INT(pvVar10) >> 2) * 4; - ptr = pvVar10; - if (0xfff < uVar7) { - ptr = *(void **)(GHIDRA_CAST(pvVar10) + -4); - uVar7 = uVar7 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar10) + (-4 - GHIDRA_INT(ptr))))) goto LAB_007a7912; - } - operator_delete(ptr,uVar7); - actives = (void *)0x0; - activesEnd = GHIDRA_CAST(0x0); - activesCapacityEnd = GHIDRA_CAST(0x0); - } - wispChance = local_70; - } - manager = g_manager; - local_7c = (void *)(GHIDRA_INT(local_7c) + 1); - } while (GHIDRA_INT(local_7c) < 5); - local_7c = (void *)0x1d7; - seed_fart_sound_override(GHIDRA_CAST(&local_7c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_7c),1.0,2,0,1.0,0.0); - } - piVar11 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)); - if (((piVar11 != GHIDRA_CAST(0x0)) && (piVar11[2] == 0x10)) && - ((*piVar11 == 0x23 && - ((*GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + 0x9e4)) < 1 && (this->_playerType != 0x28)) - )))) { - AddCollectible(this,0x279,0,1,0,0,0); - } - if ((this->_playerType == 0x23) && (g_game->_challenge == 0x2a)) { - pvVar10 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar10) >> 2 < 0x6b) { - followedPlayer = 0; - } - else { - followedPlayer = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1a8)); - } - uVar7 = 0; - pPVar8 = this->_playerCostumeMap; - do { - iVar15 = pPVar8->_index; - if (((-1 < iVar15) && (pPVar8->_isBodyLayer == 0)) && - (pvVar10 = (this->_costumeSpriteDescs)._begin, - *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar15 * 0x130 + 0x114)) == followedPlayer)) { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + iVar15 * 0x130 + 0x54)) != 0) { - AnimationState::SetFrameFloat - (GHIDRA_CAST((GHIDRA_INT(pvVar10) + iVar15 * 0x130 + 0x50)),0.0); - } - break; - } - uVar7 = uVar7 + 1; - pPVar8 = pPVar8 + 1; - } while (uVar7 < 0xf); - } - bVar6 = HasTrinket(this,0xb7,0); - if (bVar6 != 0) { - pvVar10 = (this->_trinketRNGs)._begin; - followedPlayer = GetTrinketMultiplier(this,0xb7); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar10) + 0xb70)))))->RNG::RandomInt(followedPlayer + 1); - twins_duplicate_familiars(this,uVar7); - } - bVar6 = HasCollectible(this,0x3b,0); - itemConfig = extraout_ECX; - if (bVar6 != 0) { - bVar6 = HasCollectible(this,0x1da,0); - itemConfig = extraout_ECX_00; - if (bVar6 != 0) { - bVar6 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0xd6); - if (bVar6 == 0) { - pvVar10 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar10) >> 2 < 0xd7) { - collectibleEffect = 0; - } - else { - collectibleEffect = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x358)); - } - collectibleEffectCooldown = *GHIDRA_CAST((collectibleEffect + 0x78)); - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - collectibleEffectCooldown = 300; - } - local_b4 = 0; - local_ac = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&collectibleEffect,1,1); - } - bVar6 = HasCollectible(this,0x3b,0); - itemConfig = extraout_ECX_01; - if (((bVar6 != 0) && - (itemConfig = (g_manager->_itemConfig)._nullItems._begin, - 0x7b < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(itemConfig) >> 2)) && - (enemyPosX = (itemConfig->_splatColor)._tint[2], enemyPosX != 0.0)) { - nullEffectCooldown = *GHIDRA_CAST((GHIDRA_CAST(enemyPosX) + 0x78)); - local_c4 = 0; - local_bc = 0; - nullEffect = enemyPosX; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&nullEffect,1,4); - itemConfig = extraout_ECX_02; - } - } - } - (this->_moveToTarget).x = g_vectorZero.x; - (this->_moveToTarget).y = g_vectorZero.y; - GetEnterPosition(itemConfig,&enterPos); - game = g_game; - if (((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) && - (uVar7 = g_game->_greedLastBeatenWave, uVar7 < GHIDRA_UINT(g_game->_greedModeWave))) { - uVar7 = -GHIDRA_UINT((uVar7 != 0)) & uVar7; - uVar9 = 0xc; - if (uVar7 < 0xc) { - uVar9 = uVar7; - } - g_game->_greedModeWave = uVar9; - } - local_80 = &this->_pos; - local_80->x = enterPos.x; - (this->_pos).y = enterPos.y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - uVar7 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - qVar4 = this->_flags; - this->_strengthMaxHearts = 0; - this->_heightVelocity = 0.0; - (this->_posOffset).y = 0.0; - if ((uVar7 & 0x4000000) != 0) { - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(qVar4); - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar7 & 0xfbffffff; - this->_isControlsEnabled = 1; - } - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(game),game->_lastRoomIdx,game->_lastRoomDimensionIdx); - if ((*GHIDRA_CAST((GHIDRA_CAST(roomDesc->Data) + 8)) == 0x10) && - ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 0x10000) != 0)) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(queryList),0x38f,0,-1,0,0 - ); - local_8 = 1; - if (iStack_cc != 0) { - enemyPosX = *GHIDRA_CAST((*(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(queryList))) + 0x4))) + 0x340)); - followedPlayer = *GHIDRA_CAST(this); - (this->_pos).x = *GHIDRA_CAST((*(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(queryList))) + 0x4))) + 0x33c)); - (this->_pos).y = enemyPosX; - pcVar2 = *(code **)(followedPlayer + 0x54); - uVar7 = Random(); - local_70 = (uint8_t *) - ((((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 - 0.5) * 70.0 + 90.0) * 0.017453292); - local_74 = GHIDRA_CAST(sin((float)local_70)); - enemyPosX = cos((float)local_70); - launchVelocity.x = enemyPosX * 6.0; - launchVelocity.y = (float)local_74 * 6.0; - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(0x0)); - (*pcVar2)(&sourceRef,&launchVelocity,0x41900000); - } - local_8 = 0xffffffff; - if (queryList[0] == '\0') { - local_8 = 2; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)queryList)) + 0x4))),0); - local_8 = 0xffffffff; - } - } - bVar6 = HasCollectible(this,0x253,0); - if (bVar6 != 0) { - fire_saturnus_tears(this); - } - if ((this->_pitfallState != 0) && (this->_dead == 0)) { - this->_pitfallTimer = 0; - this->_pitfallState = 0; - this->_isPlayingExtraAnimation = 0; - this->_isPlayingItemAnimation = 0; - this->_isControlsEnabled = 1; - this->_entityCollisionClass = 4; - } - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x189c))))) { - this->_isControlsEnabled = 1; - this->_entityCollisionClass = 4; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x189c)))) = 0; - this->_visible = 1; - } - if ((this->_flags & 0x200000000000000) == 0) { - this->_entityCollisionClass = 4; - } - bVar6 = HasTrinket(this,0x4b,0); - if ((bVar6 != 0) || (bVar6 = HasTrinket(this,0xa6,0), bVar6 != 0)) { - this->_cacheFlags = this->_cacheFlags | 0xffff; - EvaluateItems(this); - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - } - bVar6 = HasTrinket(this,0x35,0); - if (((bVar6 != 0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 5)) && - (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 1)) != '\0')) { - unk2 = 0; - bVar6 = 0; - followedPlayer = GetTrinketMultiplier(this,0x35); - AddHearts(this,followedPlayer * 2,bVar6,unk2); - } - bVar6 = HasCollectible(this,0x24e,0); - if ((bVar6 != 0) && (pvVar10 = g_game->_room, *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 8)) == 1)) { - uVar7 = 0; - do { - door = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + uVar7 * 4 + 0x724)); - if ((door != GHIDRA_CAST(0x0)) && (door->_targetRoomType == 1)) { - (GHIDRA_CAST((door)))->GridEntity_Door::Open(); - } - uVar7 = uVar7 + 1; - } while (uVar7 < 8); - } - bVar6 = HasTrinket(this,0x7c,0); - if (bVar6 != 0) { - uVar7 = g_game->_enterDoor; - if (uVar7 == 0xffffffff) { - uVar7 = 0; - do { - followedPlayer = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar7 * 4 + 0x724)); - if ((followedPlayer != 0) && - (followedPlayer = *GHIDRA_CAST((followedPlayer + 0x24)), - iVar15 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)), - fVar17 = (this->_pos).x - ((float)(followedPlayer % iVar15) * 40.0 + 40.0), - enemyPosX = (this->_pos).y - ((float)(followedPlayer / iVar15) * 40.0 + 120.0), - enemyPosX * enemyPosX + fVar17 * fVar17 < 10000.0)) goto LAB_007a75ef; - uVar7 = uVar7 + 1; - } while (uVar7 < 8); - } - else { -LAB_007a75ef: - if (-1 < GHIDRA_INT(uVar7)) { - if (GHIDRA_INT(uVar7) < 8) { - door = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar7 * 4 + 0x724)); - followedPlayer = GetTrinketMultiplier(this,0x7c); - if ((door == GHIDRA_CAST(0x0)) || ((GHIDRA_CAST((door)))->GridEntity_Door::Open(), followedPlayer < 3)) - goto LAB_007a7642; - if ((GHIDRA_UINT(door->_doorFlags) >> 3 & 1) != 0) { - (GHIDRA_CAST((door)))->GridEntity_Door::TryUnlock(this,1); - } - } - else { - followedPlayer = GetTrinketMultiplier(this,0x7c); -LAB_007a7642: - if (followedPlayer < 2) goto LAB_007a766b; - } - if (g_game->_lastRoomIdx == -5) { - (GHIDRA_CAST((g_game->_room)))->Room::TrySpawnBossRushDoor(1,1); - } - } - } - } -LAB_007a766b: - if (g_game->_isLevelGenerating == 0) { - spawn_low_health_blood_splat(this); - } - bVar6 = HasCollectible(this,0x15e,0); - if ((bVar6 != 0) && ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0)) { - cloudColor._tint[0] = 1.0; - cloudColor._tint[1] = 1.0; - cloudColor._tint[2] = 1.0; - cloudColor._tint[3] = 1.0; - cloudColor._offset[0] = 0.0; - cloudColor._offset[1] = 0.0; - cloudColor._offset[2] = 0.0; - cloudColor._colorize[0] = _DAT_00bac030; - cloudColor._colorize[1] = _UNK_00bac034; - cloudColor._colorize[2] = _UNK_00bac038; - cloudColor._colorize[3] = _UNK_00bac03c; - Game::start_poop_cloud_screen_effect(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1618)),&cloudColor); - } - bVar6 = HasCollectible(this,0x1f9,0); - if (((bVar6 != 0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 1)) != '\0')) && - ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0)) { - pvVar10 = (this->_collectibleRNGs)._begin; - puVar13 = GHIDRA_CAST((GHIDRA_INT(pvVar10) + 0x1f90)); - uVar7 = *puVar13; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *puVar13; - if (uVar7 == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1f94)) & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1f98)) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1f9c)) & 0x1f) ^ uVar7; - *puVar13 = uVar7; - if (uVar7 == (uVar7 / 5) * 5) { - pvVar10 = (this->_collectibleRNGs)._begin; - puVar13 = GHIDRA_CAST((GHIDRA_INT(pvVar10) + 0x1f90)); - uVar7 = *puVar13; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *puVar13; - if (uVar7 == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1f94)) & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1f98)) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1f9c)) & 0x1f) ^ uVar7; - *puVar13 = uVar7; - uVar7 = *GHIDRA_CAST((&DAT_00b6bc74 + (uVar7 % 6) * 4)); - uVar9 = Random(); - uVar21 = 0; - pTVar20 = &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor; - pTVar19 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar18 = 0; - spawned = Game::Spawn(g_game,uVar7,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar9); - spawned = GHIDRA_CAST(__RTDynamicCast(spawned,uVar18,pTVar19,pTVar20,uVar21)); - (GHIDRA_CAST((&charmRef)))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((spawned)))->Entity::AddCharmed(&charmRef,-1,0,0); - spawned->Update(); - (GHIDRA_CAST((spawned)))->Entity::SetVisibleFlag(0); - manager = g_manager; - uVar7 = uVar7 << 0x14; - configKey = uVar7; - _Find_lower_bound<>(lowerBound,&configKey); - if (((*GHIDRA_CAST((GHIDRA_CAST(configNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(configNode) + 0x10)) <= uVar7)) && - (configNode != (manager->_entityConfig)._entities._head)) { - entityConfig = GHIDRA_CAST((GHIDRA_INT(configNode) + 0x18)); - } - else { - entityConfig = GHIDRA_CAST(0x0); - } - EntityConfig_Entity::GetName(entityConfig,GHIDRA_CAST(entityName),0x14); - local_8 = 3; - psVar12 = GHIDRA_CAST(entityName); - if (0xf < entityNameCapacity) { - psVar12 = entityName[0]; - } - format = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST("#POKE_GO_APPEAR_NOTIFY")); - sprintf(message,format); - HUD::show_fortune_line(&g_game->_hud,message,GHIDRA_INT(format),GHIDRA_INT(psVar12)); - local_8 = 0xffffffff; - if (0xf < entityNameCapacity) { - uVar7 = entityNameCapacity + 1; - psVar12 = entityName[0]; - if (0xfff < uVar7) { - psVar12 = GHIDRA_CAST(entityName[0][-1]._capacity); - uVar7 = entityNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(entityName[0]) + (-4 - GHIDRA_INT(psVar12))))) { -LAB_007a7912: - local_8 = 0xffffffff; - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(psVar12,uVar7); - } - entityName[0] = GHIDRA_CAST((GHIDRA_UINT(entityName[0]) & 0xffffff00)); - } - } - bVar6 = HasCollectible(this,0x1bd,0); - game = g_game; - if (bVar6 != 0) { - local_70 = GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x724)); - uVar7 = 0; - do { - followedPlayer = *GHIDRA_CAST((local_70 + uVar7 * 4)); - if (((followedPlayer != 0) && (*GHIDRA_CAST((followedPlayer + 0xc)) != 2)) && - ((*GHIDRA_CAST((followedPlayer + 0x160)) == 7 || (*GHIDRA_CAST((followedPlayer + 0x160)) == 8)))) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(game),*GHIDRA_CAST((followedPlayer + 0x394)),-1); - manager = g_manager; - if (roomDesc->VisitedCount == 0) { - if ((GHIDRA_CAST(this->_delayedSfxId) != GHIDRA_CAST(0x0)) && - (0 < this->_delayedSfxDelay)) { - local_74 = GHIDRA_CAST(this->_delayedSfxVolume); - followedPlayer = this->_delayedSfxFrameDelay; - local_70 = GHIDRA_CAST(this->_delayedSfxId); - seed_fart_sound_override(GHIDRA_CAST(&local_70)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_70),(float)local_74,followedPlayer,0, - 1.0,0.0); - } - game = g_game; - this->_delayedSfxId = 0x1ba; - this->_delayedSfxVolume = 1.0; - this->_delayedSfxDelay = 0x1e; - this->_delayedSfxFrameDelay = 2; - break; - } - game = g_game; - } - uVar7 = uVar7 + 1; - } while (uVar7 < 8); - manager = g_manager; - if (((((((game->_levelStateFlags & 0x2000U) == 0) && - (followedPlayer = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x768)), -1 < followedPlayer)) && - (followedPlayer < 0x1c0)) && - (followedPlayer = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + followedPlayer * 4 + 0x24)), - followedPlayer != 0)) && - ((iVar15 = *GHIDRA_CAST((followedPlayer + 4)), iVar15 == 2 || - ((iVar15 != 3 && - ((((iVar15 == 4 || (iVar15 == 5)) || ((iVar15 == 6 || (iVar15 == 0x16)))) || - ((iVar15 != 0x18 && (((iVar15 == 0x19 || (iVar15 == 0x1a)) || (iVar15 == 0x1b)))))))))))) - && (*GHIDRA_CAST((followedPlayer + 0xc)) != 2)) { - if ((GHIDRA_CAST(this->_delayedSfxId) != GHIDRA_CAST(0x0)) && (0 < this->_delayedSfxDelay)) { - local_78 = GHIDRA_CAST(this->_delayedSfxVolume); - followedPlayer = this->_delayedSfxFrameDelay; - local_74 = GHIDRA_CAST(this->_delayedSfxId); - seed_fart_sound_override(GHIDRA_CAST(&local_74)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_74),(float)local_78,followedPlayer,0,1.0, - 0.0); - game = g_game; - } - this->_delayedSfxId = 0x1b9; - this->_delayedSfxVolume = 1.0; - this->_delayedSfxDelay = 0x3c; - this->_delayedSfxFrameDelay = 2; - } - } - if (((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 4)) + 0x44)) & 1) == 0) && - (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 1)) != '\0')) { - spawn_locusts(this); - game = g_game; - } - followedPlayer = this->_variant; - if (followedPlayer == 1) { - this->_hasBabyRoomShield = 1; - if (this->_babySkin != 0x3a) goto LAB_007a7cd9; - followedPlayer = this->_parent; - if ((followedPlayer == 0) || (*GHIDRA_CAST((followedPlayer + 0x28)) != 1)) { - piVar11 = (game->_playerManager)._playerList._begin; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT(piVar11) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - piVar11 = (game->_playerManager)._playerList._begin; - } - followedPlayer = *piVar11; - } - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0x72,GHIDRA_CAST((followedPlayer + 0x33c)),&g_vectorZero, - GHIDRA_CAST(0x0),0,uVar7); - if (spawned->_child != 0) { - local_78 = &spawned->_child; - msvc::multiset::erase(&local_78); - } - spawned->_child = followedPlayer; - if (followedPlayer != 0) { - msvc::multiset::insert(&spawned->_child); - } - node = &spawned->_target; - if (spawned->_target != 0) { - local_78 = node; - msvc::multiset::erase(&local_78); - } - *node = this; - msvc::multiset::insert(node); - followedPlayer = *GHIDRA_CAST(spawned); - pAVar3 = &spawned[1]._sprite; - (pAVar3->_animDefaultName)._buf[8] = '\0'; - (pAVar3->_animDefaultName)._buf[9] = '\0'; - (pAVar3->_animDefaultName)._buf[10] = -0x10; - (pAVar3->_animDefaultName)._buf[0xb] = 'B'; - (**(code **)(followedPlayer + 0xc))(); - followedPlayer = this->_variant; - game = g_game; - } - if ((followedPlayer == 0) && (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 1)) != '\0')) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1820)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1820)))) + 1; - bVar6 = HasCollectible(this,0x151,0); - if ((bVar6 != 0) && (((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1820))) & 3) == 0)) { - pRVar1 = g_game->_room; - uVar7 = Random(); - manager = g_manager; - pRVar1->_brokenWatchState = 2 - GHIDRA_UINT((uVar7 % 10 != 0)); - enemyPosX = (GHIDRA_CAST((pRVar1)))->Room::time_scale_update(); - (manager->_musicManager)._targetPitch = enemyPosX; - } - game = g_game; - } -LAB_007a7cd9: - if ((((this->_variant == 1) && (this->_parent != 0)) && - (roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(game),game->_currentRoomIdx,-1), - roomDesc->ListIndex == g_game->_lastBossRoomListIdx)) && (g_game->_stage == 6)) { - enemyPosX = *GHIDRA_CAST((this->_parent + 0x340)); - (this->_pos).x = *GHIDRA_CAST((this->_parent + 0x33c)); - (this->_pos).y = enemyPosX; - } - ppvVar14 = this->_weapons; - followedPlayer = 4; - do { - ppvVar14 = ppvVar14 + 1; - if (*ppvVar14 != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*ppvVar14) + 0x2c))(); - } - followedPlayer = followedPlayer + -1; - } while (followedPlayer != 0); - if (this->_weapons[0] != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_weapons[0]) + 0x2c))(); - } - pRVar1 = g_game->_room; - iVar15 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5)); - followedPlayer = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)); - if (this->_canFly == 0) { - if (((((-1 < iVar15) && (iVar15 < pRVar1->_gridWidth)) && - ((-1 < followedPlayer && - ((followedPlayer < pRVar1->_gridHeight && - (uVar7 = pRVar1->_gridWidth * followedPlayer + iVar15, uVar7 < 0x1c0)))))) && - (pRVar1->_gridEntities[uVar7] != (void *)0x0)) && - (*GHIDRA_CAST((GHIDRA_INT(pRVar1->_gridEntities[uVar7]) + 4)) == 0xe)) { - (GHIDRA_CAST((pRVar1)))->Room::RemoveGridEntity(pRVar1->_gridWidth * followedPlayer + iVar15,900,1); - } - } - else if ((((-1 < iVar15) && (iVar15 < pRVar1->_gridWidth)) && (-1 < followedPlayer)) && - (((followedPlayer < pRVar1->_gridHeight && - (uVar7 = pRVar1->_gridWidth * followedPlayer + iVar15, uVar7 < 0x1c0)) && - (((pvVar10 = pRVar1->_gridEntities[uVar7], pvVar10 != (void *)0x0 && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 4)) == 0xe && (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 8)) == 1)))) && - (followedPlayer = - __RTDynamicCast(pvVar10,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Poop::RTTI_Type_Descriptor,0), - *GHIDRA_CAST((followedPlayer + 8)) == 1)))))) { - *GHIDRA_CAST((followedPlayer + 0xc)) = 1000; - *GHIDRA_CAST((followedPlayer + 0x154)) = 0x78; - *GHIDRA_CAST((followedPlayer + 0x3c)) = 0; - pvVar10 = ANM2::GetAnimationData(GHIDRA_CAST((followedPlayer + 0x40)),GHIDRA_CAST("State5")); - iVar15 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x30)); - bVar6 = ANM2::SetAnimation(GHIDRA_CAST((followedPlayer + 0x40)),GHIDRA_CAST("State5"),1); - if (((bVar6 != 0) && (*GHIDRA_CAST((followedPlayer + 0x74)) != 0)) && - (AnimationState::SetFrameFloat(GHIDRA_CAST((followedPlayer + 0x70)),(float)iVar15), - *GHIDRA_CAST((followedPlayer + 0x74)) != 0)) { - *GHIDRA_CAST((followedPlayer + 0x84)) = 0; - } - } - pvVar10 = g_game->_room; - if (g_game->_enterDoor + 1U < 9) { - followedPlayer = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + g_game->_enterDoor * 4 + 0x724)); - } - else { - followedPlayer = 0; - } - local_7c = pvVar10; - uVar7 = Random(); - enemyPosX = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_78 = GHIDRA_CAST((enemyPosX + enemyPosX)); - local_74 = GHIDRA_CAST(cos((float)local_78)); - local_70 = GHIDRA_CAST(sin((float)local_78)); - pVVar5 = local_80; - if (followedPlayer != 0) { - switch(*GHIDRA_CAST((followedPlayer + 0x164))) { - case 0: - local_74 = GHIDRA_CAST(0x3f800000); - local_70 = GHIDRA_CAST(0x0); - break; - case 1: - local_74 = GHIDRA_CAST(0x0); - local_70 = GHIDRA_CAST(0x3f800000); - break; - case 2: - local_74 = GHIDRA_CAST(&DAT_bf800000); - local_70 = GHIDRA_CAST(0x0); - break; - case 3: - local_74 = GHIDRA_CAST(0x0); - local_70 = &DAT_bf800000; - } - } - uVar7 = 0; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1254)) != 0) { - do { - if ((g_game->_isRestoringGlowingHourglassState == 0) || - (piVar11 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x124c)) + uVar7 * 4)), piVar11[10] != 0x322)) { - followedPlayer = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x124c)) + uVar7 * 4)); - if (((*GHIDRA_CAST((followedPlayer + 0x168)) & 0x20000000) != 0) && - (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (*GHIDRA_CAST((followedPlayer + 0x28)) == 1)) || - (*GHIDRA_CAST((followedPlayer + 0x28)) - 10U < 0x3de)))) { - piVar11 = GHIDRA_CAST(__RTDynamicCast(followedPlayer,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0)) - ; - uVar9 = Random(); - local_80 = GHIDRA_CAST(((float)GHIDRA_INT((uVar9 % 0x5a - 0x2d)) * 0.017453292)); - local_78 = GHIDRA_CAST(cos((float)local_80)); - enemyPosX = sin((float)local_80); - local_80 = GHIDRA_CAST(((float)local_78 * (float)local_74 - enemyPosX * (float)local_70)); - local_78 = GHIDRA_CAST((enemyPosX * (float)local_74 + (float)local_78 * (float)local_70)); - uVar9 = Random(); - followedPlayer = piVar11[10]; - enemyPosX = (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10 * 10.0; - if (((followedPlayer == 0x24) || (followedPlayer == 0x106)) || (followedPlayer == 0x107)) - { - enemyPosX = (float)piVar11[0xdc]; - } - fVar17 = (float)piVar11[0xce]; - targetX = (float)piVar11[0xcd]; - enemyPosX = (float)local_80 * enemyPosX + pVVar5->x; - enemyPosX = (float)local_78 * enemyPosX + pVVar5->y; - if (3600.0 < targetX * targetX + fVar17 * fVar17) { - piVar11[0xcd] = GHIDRA_INT(((targetX - (float)piVar11[0xcf]) + enemyPosX)); - piVar11[0xce] = GHIDRA_INT(((fVar17 - (float)piVar11[0xd0]) + enemyPosX)); - } - piVar11[0xcf] = GHIDRA_INT(enemyPosX); - piVar11[0xd0] = GHIDRA_INT(enemyPosX); - piVar11[0x106] = GHIDRA_INT(g_vectorZero.x); - piVar11[0x107] = GHIDRA_INT(g_vectorZero.y); - piVar11[0x108] = GHIDRA_INT(g_vectorZero.x); - piVar11[0x109] = GHIDRA_INT(g_vectorZero.y); - if (piVar11[10] == 0x1e) { - (**(code **)(*piVar11 + 0xc))(); - piVar11[0xcd] = piVar11[0xcf]; - piVar11[0xce] = piVar11[0xd0]; - } - pvVar10 = local_7c; - } - } - else { - (**(code **)(*piVar11 + 0x28))(); - } - uVar7 = uVar7 + 1; - } while (uVar7 < *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x1254))); - this = local_90; - } - bVar6 = HasTrinket(this,0x5d,0); - if (((bVar6 != 0) && - (pvVar10 = g_game->_room, (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 4)) + 0x44)) & 1) == 0)) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 1)) != '\0')) { - iVar15 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x12c4)) + *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0x12c0)); - followedPlayer = 0; - if (0 < iVar15) { - followedPlayer = iVar15; - } - if (((0 < followedPlayer) && (g_game->_isRestoringGlowingHourglassState == 0)) && - (followedPlayer = GetTrinketMultiplier(this,0x5d), 0 < followedPlayer)) { - do { - AddBlueFlies(this,1,&this->_pos,GHIDRA_CAST(0x0)); - followedPlayer = followedPlayer + -1; - } while (followedPlayer != 0); - } - } - bVar6 = HasTrinket(this,0xb0,0); - if (bVar6 != 0) { - spawn_lil_clot_familiars(this); - } - if (this->_playerType == 0x11) { - spawn_forgotten_body(this); - } - preload_item_sounds(this); - node = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b34)))); - *GHIDRA_CAST(node[1]) = 0; - node = GHIDRA_CAST(*node); - while (node != GHIDRA_CAST(0x0)) { - /* WARNING: Read-only address (ram,0x00bac030) is written */ - nextNode = GHIDRA_CAST(*node); - operator_delete(node,0x28); - node = nextNode; - } - /* WARNING: Read-only address (ram,0x00bac030) is written */ - *GHIDRA_CAST(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b34))))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b34)))); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b34)))) + 4)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b34)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b38)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b3c)))) = **GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b34)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c54)))) = 0; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c5c)))) != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c60)))) = **GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1c58)))); - } - /* WARNING: Read-only address (ram,0x00bac030) is written */ - ExceptionList = local_10; - return; -} - -// 007a8350 -void Entity_Player::TriggerNewRoom_TemporaryEffects() -{ - code *pcVar1; - uint8_t bVar2; - char isCrownActive; - int iVar3; - uint32_t uVar4; - ItemConfig_Item *item; - RoomDescriptor *roomDesc; - void *pvVar5; - int trinketMultiplier; - int *effectIter; - Game *game; - uint32_t *trinketSeed; - int local_38 [8]; - RNG RStack_18; - uint32_t local_8; - char *crownAnim; - uint32_t levelEffectItemId; - Manager *manager; - - local_8 = __security_cookie ^ GHIDRA_UINT((local_38 + 0xd)); - bVar2 = HasTrinket(this,0x20,0); - if (bVar2 != 0) { - iVar3 = GetTrinketMultiplier(this,0x20); - if ((GHIDRA_INT((4 / (int64_t)iVar3)) == 0) || - (uVar4 = Random(), GHIDRA_INT(((uint64_t)uVar4 % (4 / (int64_t)iVar3 & 0xffffffffU))) == 0)) { - pvVar5 = (this->_trinketRNGs)._begin; - trinketSeed = GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0x200)); - local_38[6] = 0xc; - local_38[7] = 0x47; - RStack_18._seed = 0x79; - RStack_18._shift1 = 0x78; - RStack_18._shift2 = 0x156; - RStack_18._shift3 = 0x18e; - uVar4 = *trinketSeed; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar4 = *trinketSeed; - if (uVar4 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - manager = g_manager; - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x204)) & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x208)) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x20c)) & 0x1f) ^ uVar4; - *trinketSeed = uVar4; - RStack_18._seed = - GHIDRA_INT(ItemConfig)::GetCollectible(&manager->_itemConfig,local_38[uVar4 % 6 + 6]); - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT((GHIDRA_CAST(RStack_18._seed))->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - } - bVar2 = HasTrinket(this,0x84,0); - if (bVar2 != 0) { - iVar3 = GetTrinketMultiplier(this,0x84); - if ((GHIDRA_INT((4 / (int64_t)iVar3)) == 0) || - (uVar4 = Random(), GHIDRA_INT(((uint64_t)uVar4 % (4 / (int64_t)iVar3 & 0xffffffffU))) == 0)) { - add_random_drug_item_effect(this); - } - } - bVar2 = HasTrinket(this,0x99,0); - if (bVar2 != 0) { - iVar3 = GetTrinketMultiplier(this,0x99); - if ((GHIDRA_INT((4 / (int64_t)iVar3)) == 0) || - (uVar4 = Random(), GHIDRA_INT(((uint64_t)uVar4 % (4 / (int64_t)iVar3 & 0xffffffffU))) == 0)) { - AddRandomMomItemEffect(this); - } - } - bVar2 = HasCollectible(this,0x2a1,0); - if (bVar2 != 0) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)); - if ((((iVar3 != 0) && (*GHIDRA_CAST((iVar3 + 0x40)) == 1)) && - ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0xe || ((*GHIDRA_CAST((iVar3 + 0x44)) >> 0xb & 1) != 0)))) - && (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x2a1), - bVar2 == 0)) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x2a1,1,1); - } - } - iVar3 = this->_modelingClayEffect; - this->_modelingClayEffect = 0; - if (iVar3 != 0) { - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar3); - if (item != GHIDRA_CAST(0x0)) { - this->_cacheFlags = this->_cacheFlags | item->cacheFlags; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - TryRemoveCollectibleCostume(this,iVar3,0); - } - bVar2 = HasTrinket(this,0xa6,0); - if (bVar2 != 0) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,-1); - if (GHIDRA_CAST(roomDesc->SpawnSeed) != GHIDRA_CAST(0x0)) { - RStack_18._shift1 = 7; - RStack_18._shift2 = 0x11; - RStack_18._shift3 = 0x15; - RStack_18._seed = roomDesc->SpawnSeed; - iVar3 = GetTrinketMultiplier(this,0xa6); - uVar4 = (GHIDRA_CAST((&RStack_18)))->RNG::RandomInt(GHIDRA_UINT((2 / (int64_t)iVar3))); - if (uVar4 == 0) { - ModelingClay_roll(this,&RStack_18); - } - } - } - if (this->_holyMantleState == 0) { - bVar2 = HasCollectible(this,0x139,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x139), bVar2 == 0)) - { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x139,1,1); - } - bVar2 = HasCollectible(this,0x217,0); - if ((bVar2 != 0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 5)) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x139,1,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x217,1,1); - } - } - else { - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x4e4 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) - ) && (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x4e4)), item != GHIDRA_CAST(0x0))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(&RStack_18,1); - } - manager = g_manager; - if ((((this->_temporaryeffects)._disabled != 0) || - (pvVar5 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x139), - pvVar5 == (void *)0x0)) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 4)) < 1)) { - pvVar5 = (manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0x4e5) - { - RemoveCostume(this,GHIDRA_CAST(0x0)); - } - else { - RemoveCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x4e4))); - } - } - } - bVar2 = HasCollectible(this,299,0); - if ((bVar2 != 0) || (iVar3 = GetZodiacEffect(this), iVar3 == 299)) { - this->_taurusSpeedBonus = 0.0; - local_38[5] = 0; - local_38[6] = 0; - local_38[7] = 0; - RStack_18._seed = 0; - RStack_18._shift1 = 0; - RStack_18._shift2 = 0; - RStack_18._shift3 = 0; - local_38[1] = 0x3f800000; - local_38[2] = 0x3f800000; - local_38[3] = 0x3f800000; - local_38[4] = 0x3f800000; - this->SetColor(local_38 + 1,0xffffffff,0xff,0,1); - if ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 1)) != '\0') && - ((pvVar5 = (g_manager->_itemConfig)._collectibles._begin, - 0x4ac < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) - && (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x4ac)), item != GHIDRA_CAST(0x0))))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - } - bVar2 = HasCollectible(this,0x7a,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x7a), bVar2 == 0)) { - TryRemoveCollectibleCostume(this,0x7a,0); - if ((this->_redHearts < 2) || - ((this->_playerType == 5 && - ((this->_redHearts < 3 || (bVar2 = HasCollectible(this,0x26b,0), bVar2 != 0)))))) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x7a,1,1); - } - } - bVar2 = HasTrinket(this,0x21,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(100), bVar2 == 0)) { - trinketMultiplier = GetTrinketMultiplier(this,0x21); - iVar3 = 1; - if (trinketMultiplier == 2) { - iVar3 = 2; - } - else if (2 < trinketMultiplier) { - iVar3 = 3; - } - if (this->_redHearts <= iVar3) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(100,1,1); - } - } - bVar2 = HasCollectible(this,0x199,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x199), bVar2 == 0)) { - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0x49) { - item = GHIDRA_CAST(0x0); - } - else { - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x48)); - } - RemoveCostume(this,item); - if (this->_redHearts < 1) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x199,1,1); - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0x49) { - item = GHIDRA_CAST(0x0); - } - else { - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x48)); - } - AddCostume(this,item,0); - } - } - bVar2 = HasCollectible(this,0x8e,0); - if (((bVar2 != 0) && - (pvVar5 = (g_manager->_itemConfig)._collectibles._begin, - 0x238 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)))) - && (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x238)), item != GHIDRA_CAST(0x0))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - bVar2 = HasCollectible(this,0x197,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x197), bVar2 == 0)) { - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x65c < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) - ) && (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x65c)), item != GHIDRA_CAST(0x0))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0x45) { - item = GHIDRA_CAST(0x0); - } - else { - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x44)); - } - AddCostume(this,item,0); - update_purity_glow(this); - } - bVar2 = HasCollectible(this,0x19f,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x19f), bVar2 == 0)) { - bVar2 = HasFullHearts(this); - if (bVar2 == 0) { - crownAnim = "FloatNoGlow"; - } - else { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x19f,1,1); - crownAnim = "FloatGlow"; - } - ANM2::Play(&this->_crownOfLightSprite,GHIDRA_CAST(crownAnim),0); - } - bVar2 = HasCollectible(this,0x1ba,0); - if ((bVar2 != 0) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba), bVar2 == 0)) { - isCrownActive = FUN_007db360(); - if (isCrownActive == '\0') { - crownAnim = "FloatNoGlow"; - } - else { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1ba,1,1); - crownAnim = "FloatGlow"; - } - ANM2::Play(&this->_darkPrincesCrownSprite,GHIDRA_CAST(crownAnim),0); - } - iVar3 = 0; - if ((this->_holyMantleStacks & 0xf0) != 0) { - do { - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x4e4 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & - 0xfffffffcU))) && - (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x4e4)), item != GHIDRA_CAST(0x0))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - iVar3 = iVar3 + 1; - } while (iVar3 < GHIDRA_INT(GHIDRA_UINT((this->_holyMantleStacks >> 4)))); - } - if ((this->_temporaryeffects)._disabled == 0) { - for (effectIter = (this->_temporaryeffects)._effects._begin; - effectIter != (this->_temporaryeffects)._effects._end; effectIter = effectIter + 4) { - if ((*GHIDRA_CAST(*effectIter) == 0) && ((GHIDRA_CAST(*effectIter))[1] == 0x2e)) { - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x4e4 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & - 0xfffffffcU))) && - (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x4e4)), item != GHIDRA_CAST(0x0))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - break; - } - } - } - if ((((this->_variant == 0) && (bVar2 = HasCollectible(this,0x1f1,0), bVar2 != 0)) && - (pvVar5 = (g_manager->_itemConfig)._collectibles._begin, - 0x7c4 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)))) - && (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x7c4)), item != GHIDRA_CAST(0x0))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - bVar2 = HasCollectible(this,0x24c,0); - if (bVar2 != 0) { - if ((this->_temporaryeffects)._disabled == 0) { - for (effectIter = (this->_temporaryeffects)._effects._begin; - effectIter != (this->_temporaryeffects)._effects._end; effectIter = effectIter + 4) { - if ((*GHIDRA_CAST(*effectIter) == 0) && ((GHIDRA_CAST(*effectIter))[1] == 0x38)) goto LAB_007a8d7b; - } - } - pvVar5 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0xe1) { - item = GHIDRA_CAST(0x0); - } - else { - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xe0)); - } - RemoveCostume(this,item); - if (((-1 < g_game->_lastBossRoomListIdx) && - ((g_game->_roomList[g_game->_lastBossRoomListIdx].Flags & 1) != 0)) && - ((pvVar5 = (g_manager->_itemConfig)._nullItems._begin, - 0xe0 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) && - (item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xe0)), item != GHIDRA_CAST(0x0))))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - } - } -LAB_007a8d7b: - if ((this->_hasCurseMistEffect == 0) && (this->_isCoopGhost == 0)) { - uVar4 = 0; - pvVar5 = (this->_levelEffectItems)._begin; - game = g_game; - if (GHIDRA_INT((this->_levelEffectItems)._end) - GHIDRA_INT(pvVar5) >> 2 != 0) { - do { - levelEffectItemId = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + uVar4 * 4)); - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(levelEffectItemId)) goto LAB_007a8dea; - } - else { - if (GHIDRA_INT(levelEffectItemId) < 0) { - if ((GHIDRA_INT(levelEffectItemId) < 0) && - (pvVar5 = (game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~levelEffectItemId) < - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar5) >> 2)) { - item = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar5) + ~levelEffectItemId * 4))); - } - else { - item = GHIDRA_CAST(0x0); - } - } - else { -LAB_007a8dea: - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) >> 2 <= - GHIDRA_INT(levelEffectItemId)) goto LAB_007a8e36; - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + levelEffectItemId * 4)); - } - if (item != GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(RStack_18)) + 0x4))) = (uint64_t)GHIDRA_UINT(item->maxCooldown) << 0x20; - RStack_18._shift3 = 0; - RStack_18._seed = GHIDRA_INT(item); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&RStack_18,1,1); - game = g_game; - } - } -LAB_007a8e36: - uVar4 = uVar4 + 1; - pvVar5 = (this->_levelEffectItems)._begin; - } while (uVar4 < GHIDRA_UINT((GHIDRA_INT((this->_levelEffectItems)._end) - GHIDRA_INT(pvVar5) >> 2))); - } - } - bVar2 = HasTrinket(this,0x9a,0); - if ((bVar2 != 0) && (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x40)) == 1)) { - pvVar5 = (this->_trinketRNGs)._begin; - trinketSeed = GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0x9a0)); - uVar4 = *trinketSeed; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar4 = *trinketSeed; - if (uVar4 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x9a4)) & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x9a8)) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x9ac)) & 0x1f) ^ uVar4; - *trinketSeed = uVar4; - iVar3 = GetTrinketMultiplier(this,0x9a); - if (GHIDRA_INT((uVar4 & 1)) < iVar3) { - pvVar5 = (this->_trinketRNGs)._begin; - trinketSeed = GHIDRA_CAST((GHIDRA_INT(pvVar5) + 0xb70)); - uVar4 = *trinketSeed; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar4 = *trinketSeed; - if (uVar4 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xb74)) & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xb78)) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xb7c)) & 0x1f) ^ uVar4; - *trinketSeed = uVar4; - iVar3 = *GHIDRA_CAST((&DAT_00b1f450 + (uVar4 % 10) * 4)); - SetPocketActiveItem(this,iVar3,3,1); - AnimateCollectible(this,iVar3,GHIDRA_CAST("UseItem"),GHIDRA_CAST("PlayerPickupSparkle")); - manager = g_manager; - local_38[0] = 0xfc; - seed_fart_sound_override(local_38); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_38[0],1.0,2,0,1.0,0.0); - } - } - this->_holyMantleState = 1 < this->_holyMantleState; - return; -} - -// 007a8fd0 -void Entity_Player::TriggerRoomClear() -{ - void **ppvVar1; - int iVar2; - code *pcVar3; - int iVar4; - RNG rng; - uint8_t bVar5; - int iVar6; - Entity *spawnedEntity; - uint32_t uVar7; - int *piVar8; - ItemConfig_Item *itemConfig; - int *effect; - void *pvVar9; - uint64_t *allocatedBytes; - uint32_t *puVar10; - uint32_t uVar11; - uint8_t auVar12 [4]; - Game *pGVar13; - float fVar14; - uint32_t uVar15; - TypeDescriptor *pTVar16; - Vector *position; - TypeDescriptor *pTVar17; - uint8_t bVar18; - uint32_t uVar19; - uint32_t local_98; - uint32_t local_94; - uint32_t local_90; - uint32_t local_8c; - uint32_t local_88; - uint32_t local_84; - Vector local_80; - Entity_Player *player; - Vector local_74; - uint32_t local_6c; - uint32_t *local_68; - uint32_t local_64; - uint32_t local_60; - TemporaryEffects *local_5c; - Game *local_58; - uint8_t local_54 [4]; - uint64_t uStack_50; - Entity_Player *pEStack_48; - Entity_Player *local_44; - uint8_t local_40 [8]; - float fStack_38; - float fStack_34; - float local_30; - float fStack_2c; - float fStack_28; - float fStack_24; - float local_20; - float local_1c; - float local_18; - uint32_t stackCookie; - void *prevExceptionList; - uint8_t *puStack_c; - uint32_t ehState; - Entity_Player *effectsOwner; - Entity_Familiar *familiar; - Manager *manager; - uint64_t prevAllocatedBytes; - void *trinketRngs; - - ehState = 0xffffffff; - puStack_c = &LAB_00affa55; - prevExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((local_40 + 0x3c)); - ExceptionList = &prevExceptionList; - player = this; - bVar5 = HasTrinket(this,0x8f,0); - if ((bVar5 == 0) && (bVar5 = HasCollectible(this,0x287,0), bVar5 == 0)) { - local_60 = GHIDRA_CAST(0x0); - do { - puVar10 = local_60; - local_5c = GHIDRA_CAST((GHIDRA_INT((local_60 + 0x2b)) * 0x20)); - uVar11 = *GHIDRA_CAST((GHIDRA_INT(&local_5c[-3]._cacheFlags) + GHIDRA_INT((this->_sprite)._filename._buf))); - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar11)) goto LAB_007a907b; - } - else { - if (GHIDRA_INT(uVar11) < 0) { - if ((GHIDRA_INT(uVar11) < 0) && - (pvVar9 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar11) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar9) >> 2)) { - iVar6 = **GHIDRA_CAST((GHIDRA_CAST(pvVar9) + ~uVar11 * 4)); - } - else { - iVar6 = 0; - } - } - else { -LAB_007a907b: - pvVar9 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar9) >> 2 <= GHIDRA_INT(uVar11)) - goto LAB_007a9338; - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar11 * 4)); - } - if (iVar6 != 0) { - iVar6 = GetActiveMaxCharge(this,GHIDRA_INT(local_60)); - if (iVar6 == 0) { - puVar10 = GHIDRA_CAST(0x1); - local_68 = GHIDRA_CAST(0x1); - if ((((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) != 0x11) && - (iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)), iVar6 != 0)) && - (iVar6 = *GHIDRA_CAST((iVar6 + 0x10)), iVar6 != 0)) && - (((iVar6 = *GHIDRA_CAST((iVar6 + 0x48)), iVar6 == 8 || (iVar6 == 0xb)) || - ((iVar6 == 0xc || ((iVar6 == 9 || (iVar6 == 10)))))))) { - puVar10 = GHIDRA_CAST(0x2); - local_68 = GHIDRA_CAST(0x2); - } - effectsOwner = GHIDRA_CAST(GetTrinketMultiplier(this,0x48)); - local_44 = GHIDRA_CAST(0x10); - if (GHIDRA_INT(effectsOwner) < 0x10) { - local_44 = effectsOwner; - } - if (0 < GHIDRA_INT(local_44)) { - do { - pvVar9 = (this->_trinketRNGs)._end; - if (GHIDRA_INT(pvVar9) - GHIDRA_INT((this->_trinketRNGs)._begin) >> 4 < 0x49) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Trinket ID out of bounds!\n")); - pvVar9 = (this->_trinketRNGs)._end; - } - trinketRngs = (this->_trinketRNGs)._begin; - uVar11 = (GHIDRA_INT(pvVar9) - GHIDRA_INT(trinketRngs) >> 4) - 1; - if (0x48 < uVar11) { - uVar11 = 0x48; - } - puVar10 = GHIDRA_CAST((uVar11 * 0x10 + GHIDRA_INT(trinketRngs))); - uVar11 = *puVar10; - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar11 = *puVar10; - if (uVar11 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar11 = uVar11 >> ((uint8_t)puVar10[1] & 0x1f) ^ uVar11; - uVar11 = uVar11 << ((uint8_t)puVar10[2] & 0x1f) ^ uVar11; - uVar11 = uVar11 >> ((uint8_t)puVar10[3] & 0x1f) ^ uVar11; - *puVar10 = uVar11; - if (uVar11 % 0x14 == 0) { - iVar6 = GetTrinketMultiplier(this,0x48); - local_68 = GHIDRA_CAST((GHIDRA_INT(local_68) + iVar6)); - } - local_44 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_44[-1])) + 0x2eff)))); - } while (0 < GHIDRA_INT(local_44)); - puVar10 = local_68; - } - if (local_60 == GHIDRA_CAST(0x3)) { - local_68 = GHIDRA_CAST(0x0); - } - else if (((local_60 == GHIDRA_CAST(0x2)) && (this->_activeDesc[2]._item == 0x244)) && - (g_game->_challenge == 0x2c)) { - local_68 = GHIDRA_CAST(0x0); - } - else { - local_68 = GHIDRA_CAST(GetCollectibleMaxCharge) - (this,*GHIDRA_CAST((GHIDRA_INT(&local_5c[-3]._cacheFlags) + - GHIDRA_INT((this->_sprite)._filename._buf))), - this->_activeDesc[GHIDRA_INT(local_60)]._varData,GHIDRA_INT(local_60)) - ; - } - effectsOwner = GHIDRA_CAST(GetTrinketMultiplier(this,3)); - local_44 = GHIDRA_CAST(0x3); - if (GHIDRA_INT(effectsOwner) < 3) { - local_44 = effectsOwner; - } - if ((GHIDRA_INT(local_44) < 1) || - (this->_activeDesc[GHIDRA_INT(local_60)]._charge + GHIDRA_INT(puVar10) < - GHIDRA_INT(local_68) - GHIDRA_INT(local_44))) { - AddActiveCharge(this,GHIDRA_INT(puVar10),GHIDRA_INT(local_60),0,0,0); - } - else { - iVar6 = AddActiveCharge(this,GHIDRA_INT((&(local_44->_sprite)._filename + -3)) + GHIDRA_INT(puVar10) - ,GHIDRA_INT(local_60),0,0,0); - manager = g_manager; - if (iVar6 != 0) { - local_44 = GHIDRA_CAST(0xaa); - seed_fart_sound_override(GHIDRA_CAST(&local_44)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44),1.0,2,0,1.0,0.0); - uVar11 = Random(); - uVar19 = 0; - pTVar17 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar16 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar15 = 0; - spawnedEntity = - Game::Spawn(g_game,1000,0x31,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar11); - iVar6 = __RTDynamicCast(spawnedEntity,uVar15,pTVar16,pTVar17,uVar19); - *GHIDRA_CAST((iVar6 + 0xdc)) = 0; - *GHIDRA_CAST((iVar6 + 0xe0)) = 0xc1c00000; - *GHIDRA_CAST((iVar6 + 0x358)) = 0x3f800000; - puVar10 = local_60; - goto LAB_007a9338; - } - } - puVar10 = local_60; - } - else if (iVar6 == 1) { - FullCharge(this,GHIDRA_INT(puVar10),0,0); - } - } - } -LAB_007a9338: - local_60 = GHIDRA_CAST((GHIDRA_INT(puVar10) + 1)); - } while (local_60 < &DAT_00000004); - } - bVar5 = HasTrinket(this,0x2e,0); - if (bVar5 != 0) { - uVar11 = 10 - GHIDRA_INT((this->_luck * 0.5)); - if (GHIDRA_INT(uVar11) < 1) { - uVar11 = 1; - } - if ((uVar11 == 0) || (uVar7 = Random(), uVar7 % uVar11 == 0)) { - bVar18 = 0; - bVar5 = 0; - iVar6 = GetTrinketMultiplier(this,0x2e); - AddHearts(this,iVar6,bVar5,bVar18); - manager = g_manager; - local_44 = GHIDRA_CAST(0x9d); - if (this->_playerType == 0x16) { - local_44 = GHIDRA_CAST(0x266); - } - seed_fart_sound_override(GHIDRA_CAST(&local_44)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44),1.0,2,0,1.0,0.0); - uVar11 = Random(); - uVar19 = 0; - pTVar17 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar16 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar15 = 0; - spawnedEntity = Game::Spawn(g_game,1000,0x31,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar11) - ; - iVar6 = __RTDynamicCast(spawnedEntity,uVar15,pTVar16,pTVar17,uVar19); - *GHIDRA_CAST((iVar6 + 0xdc)) = 0; - *GHIDRA_CAST((iVar6 + 0xe0)) = 0xc1c00000; - *GHIDRA_CAST((iVar6 + 0x358)) = 0x3f800000; - } - } - bVar5 = HasTrinket(this,0x46,0); - if (bVar5 != 0) { - AddBlueSpider(this,&this->_pos); - } - if (0 < this->_rottenHearts) { - iVar6 = 0; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_54),3,0x2b,-1,0,0); - uVar11 = 0; - ehState = 0; - if (pEStack_48 != GHIDRA_CAST(0x0)) { - do { - iVar2 = *GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + uVar11 * 4)); - if (((iVar2 != 0) && (*GHIDRA_CAST((iVar2 + 0x28)) == 3)) && - (*GHIDRA_CAST((iVar2 + 0x410)) == this)) { - iVar6 = iVar6 + 1; - } - uVar11 = uVar11 + 1; - } while (uVar11 < pEStack_48); - } - iVar6 = this->_rottenHearts * 2 - iVar6; - if (0 < iVar6) { - AddBlueFlies(this,iVar6,&this->_pos,GHIDRA_CAST(0x0)); - } - ehState = 0xffffffff; - if (local_54[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (GHIDRA_CAST(uStack_50) != GHIDRA_CAST(0x0)) { - uVar11 = *GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar11; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar11)); - free(GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + -4))); - } - ehState = 0xffffffff; - } - } - try_end_astral_projection(this); - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar8 = (this->_temporaryeffects)._effects._begin; - piVar8 != (this->_temporaryeffects)._effects._end; piVar8 = piVar8 + 4) { - if ((*GHIDRA_CAST(*piVar8) == 0) && ((GHIDRA_CAST(*piVar8))[1] == 0x70)) { - if (piVar8[1] == 1) { - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if ((0x70 < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2) && - (itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x1c0)), - itemConfig != GHIDRA_CAST(0x0))) { - uStack_50 = (uint64_t)GHIDRA_UINT(itemConfig->maxCooldown) << 0x20; - pEStack_48 = GHIDRA_CAST(0x0); - local_54 = (uint8_t [4])itemConfig; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(local_54,1,1); - } - pvVar9 = this->_backupPlayer; - if ((pvVar9 != (void *)0x0) && - (local_5c = GHIDRA_CAST((GHIDRA_INT(pvVar9) + 0x1508)), - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x1519)) == '\0')) { - piVar8 = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x150c)); - goto joined_r0x007a9607; - } - } - break; - } - } - } -LAB_007a9679: - bVar5 = HasCollectible(this,0x2b5,0); - if (bVar5 != 0) { - AddSwarmFlyOrbital(this,&this->_pos); - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x47,1); - bVar5 = HasCollectible(this,699,0); - if (bVar5 != 0) { - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar8 = (this->_temporaryeffects)._effects._begin; - piVar8 != (this->_temporaryeffects)._effects._end; piVar8 = piVar8 + 4) { - iVar6 = *GHIDRA_CAST(*piVar8); - if ((((iVar6 == 1) || (iVar6 == 3)) || (iVar6 == 4)) && ((GHIDRA_CAST(*piVar8))[1] == 699)) { - iVar6 = piVar8[1]; - if (iVar6 < 5) goto LAB_007a96f8; - goto LAB_007a9930; - } - } - } - iVar6 = 0; -LAB_007a96f8: - pvVar9 = (g_manager->_itemConfig)._collectibles._begin; - if ((699 < GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar9) >> 2) && - (itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xaec)), - itemConfig != GHIDRA_CAST(0x0))) { - uStack_50 = (uint64_t)GHIDRA_UINT(itemConfig->maxCooldown) << 0x20; - pEStack_48 = GHIDRA_CAST(0x0); - local_54 = (uint8_t [4])itemConfig; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(local_54,0,1); - } - pvVar9 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar9) >> 2 < 700) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xaec)); - } - RemoveCostume(this,itemConfig); - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 0x61) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x180)); - } - RemoveCostume(this,itemConfig); - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 0x62) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x184)); - } - RemoveCostume(this,itemConfig); - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 99) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x188)); - } - RemoveCostume(this,itemConfig); - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 100) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x18c)); - } - RemoveCostume(this,itemConfig); - switch(iVar6) { - case 0: - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 0x61) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x180)); - } - break; - case 1: - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 0x62) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x184)); - } - break; - case 2: - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 99) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x188)); - } - break; - case 3: - case 4: - pvVar9 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 < 100) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x18c)); - } - break; - default: - goto switchD_007a9848_default; - } - AddCostume(this,itemConfig,0); -switchD_007a9848_default: - local_20 = 0.0; - local_30 = 0.0; - fStack_2c = 0.0; - fStack_28 = 0.0; - fStack_24 = 0.0; - local_1c = 0.0; - local_18 = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x0))) = 0.1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x4))) = 0.1; - fStack_38 = 0.1; - fStack_34 = 1.0; - this->SetColor(local_40,6,0xff,1,1); - } -LAB_007a9930: - bVar5 = HasTrinket(this,0xa3,0); - if (bVar5 != 0) { - local_5c = GHIDRA_CAST(GetTrinketMultiplier(this,0xa3)); - local_44 = GHIDRA_CAST(0x0); - if (0 < GHIDRA_INT(local_5c)) { - do { - uStack_50 = 0; - pEStack_48 = GHIDRA_CAST(0x0); - ehState = 2; - local_74.x = 0.0; - local_74.y = 2.8026e-44; - msvc::vector<8byte>::_Emplace_reallocate(0,&local_74); - uVar11 = 0; - uVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(uStack_50))) + 0x4))) - GHIDRA_INT(GHIDRA_CAST(uStack_50)) >> 3; - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - if (uVar7 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + uVar11 * 8)) == 1) { - piVar8 = GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + 4 + uVar11 * 8)); - *piVar8 = *piVar8 + 6; - effectsOwner = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))); - if (*piVar8 < 0) { - *GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + 4 + uVar11 * 8)) = 0; - } - goto LAB_007a9a17; - } - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - local_6c = 1; - local_68 = GHIDRA_CAST(&DAT_00000006); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))) == pEStack_48) { - msvc::vector<8byte>::_Emplace_reallocate((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))),&local_6c); - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - effectsOwner = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))); - } - else { - *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(uStack_50))) + 0x4))) = 1; - *GHIDRA_CAST(&((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4)))(*GHIDRA_CAST((GHIDRA_CAST(()))) + 0x4))) = 6; - effectsOwner = GHIDRA_CAST(&((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4)))(*GHIDRA_CAST((GHIDRA_CAST(()))) + 0x8))); - uStack_50 = CONCAT44(effectsOwner,GHIDRA_CAST(uStack_50)); - } -LAB_007a9a17: - uVar11 = 0; - uVar7 = GHIDRA_INT(effectsOwner) - iVar6 >> 3; - if (uVar7 != 0) { - do { - if (*GHIDRA_CAST((iVar6 + uVar11 * 8)) == 2) { - piVar8 = GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)); - *piVar8 = *piVar8 + 6; - if (*piVar8 < 0) { - *GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)) = 0; - } - goto LAB_007a9a7b; - } - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - local_64 = 2; - local_60 = GHIDRA_CAST(&DAT_00000006); - if (effectsOwner == pEStack_48) { - msvc::vector<8byte>::_Emplace_reallocate(effectsOwner,&local_64); - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - effectsOwner = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))); - } - else { - *GHIDRA_CAST(effectsOwner) = 2; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x4)))) = 6; - uStack_50 = CONCAT44(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8))),GHIDRA_CAST(uStack_50)); - effectsOwner = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8)))); - } -LAB_007a9a7b: - uVar11 = 0; - uVar7 = GHIDRA_INT(effectsOwner) - iVar6 >> 3; - if (uVar7 != 0) { - do { - if (*GHIDRA_CAST((iVar6 + uVar11 * 8)) == 3) { - piVar8 = GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)); - *piVar8 = *piVar8 + 1; - if (*piVar8 < 0) { - *GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)) = 0; - } - goto LAB_007a9ae5; - } - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - local_88 = 3; - local_84 = 1; - if (effectsOwner == pEStack_48) { - msvc::vector<8byte>::_Emplace_reallocate(effectsOwner,&local_88); - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - effectsOwner = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))); - } - else { - *GHIDRA_CAST(effectsOwner) = 3; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x4)))) = 1; - uStack_50 = CONCAT44(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8))),GHIDRA_CAST(uStack_50)); - effectsOwner = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8)))); - } -LAB_007a9ae5: - uVar11 = 0; - uVar7 = GHIDRA_INT(effectsOwner) - iVar6 >> 3; - if (uVar7 != 0) { - do { - if (*GHIDRA_CAST((iVar6 + uVar11 * 8)) == 4) { - piVar8 = GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)); - *piVar8 = *piVar8 + 1; - if (*piVar8 < 0) { - *GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)) = 0; - } - goto LAB_007a9b52; - } - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - local_90 = 4; - local_8c = 1; - if (effectsOwner == pEStack_48) { - msvc::vector<8byte>::_Emplace_reallocate(effectsOwner,&local_90); - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - effectsOwner = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))); - } - else { - *GHIDRA_CAST(effectsOwner) = 4; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x4)))) = 1; - uStack_50 = CONCAT44(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8))),GHIDRA_CAST(uStack_50)); - effectsOwner = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8)))); - } -LAB_007a9b52: - uVar11 = 0; - uVar7 = GHIDRA_INT(effectsOwner) - iVar6 >> 3; - if (uVar7 != 0) { - do { - if (*GHIDRA_CAST((iVar6 + uVar11 * 8)) == 5) { - piVar8 = GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)); - *piVar8 = *piVar8 + 1; - if (*piVar8 < 0) { - *GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)) = 0; - } - goto LAB_007a9bc0; - } - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - local_98 = 5; - local_94 = 1; - if (effectsOwner == pEStack_48) { - msvc::vector<8byte>::_Emplace_reallocate(effectsOwner,&local_98); - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - effectsOwner = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))); - } - else { - *GHIDRA_CAST(effectsOwner) = 5; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x4)))) = 1; - uStack_50 = CONCAT44(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8))),GHIDRA_CAST(uStack_50)); - effectsOwner = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8)))); - } -LAB_007a9bc0: - uVar11 = 0; - uVar7 = GHIDRA_INT(effectsOwner) - iVar6 >> 3; - if (uVar7 != 0) { - do { - if (*GHIDRA_CAST((iVar6 + uVar11 * 8)) == 6) { - piVar8 = GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)); - *piVar8 = *piVar8 + 1; - if (*piVar8 < 0) { - *GHIDRA_CAST((iVar6 + 4 + uVar11 * 8)) = 0; - } - goto LAB_007a9c21; - } - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - local_80.x = 8.40779e-45; - local_80.y = 1.4013e-45; - if (effectsOwner == pEStack_48) { - msvc::vector<8byte>::_Emplace_reallocate(effectsOwner,&local_80); - } - else { - *GHIDRA_CAST(effectsOwner) = 6; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x4)))) = 1; - uStack_50 = CONCAT44(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x8))),GHIDRA_CAST(uStack_50)); - } -LAB_007a9c21: - pvVar9 = (this->_trinketRNGs)._begin; - puVar10 = GHIDRA_CAST((GHIDRA_INT(pvVar9) + 0xa30)); - uVar11 = *puVar10; - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar11 = *puVar10; - if (uVar11 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar11 = uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa34)) & 0x1f) ^ uVar11; - uVar11 = uVar11 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa38)) & 0x1f) ^ uVar11; - uVar11 = uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa3c)) & 0x1f) ^ uVar11; - *puVar10 = uVar11; - rng._shift1 = 5; - rng._seed = uVar11; - rng._shift2 = 9; - rng._shift3 = 7; - uVar11 = (GHIDRA_CAST((GHIDRA_CAST(&uStack_50))))->WeightedOutcomePicker::PickOutcome(rng); - Entity_Familiar::ThrowDip(uVar11,&this->_pos,GHIDRA_CAST(this)); - ehState = 0xffffffff; - if (GHIDRA_CAST(uStack_50) != (void *)0x0) { - uVar11 = (GHIDRA_INT(pEStack_48) - GHIDRA_INT(GHIDRA_CAST(uStack_50)) >> 3) * 8; - pvVar9 = GHIDRA_CAST(uStack_50); - if (0xfff < uVar11) { - pvVar9 = *(void **)(GHIDRA_INT(GHIDRA_CAST(uStack_50)) + -4); - uVar11 = uVar11 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + (-4 - GHIDRA_INT(pvVar9))))) - goto LAB_007aa32a; - } - operator_delete(pvVar9,uVar11); - uStack_50 = 0; - pEStack_48 = GHIDRA_CAST(0x0); - } - local_44 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_44)) + 0x1)))); - } while (GHIDRA_INT(local_44) < GHIDRA_INT(local_5c)); - } - } - bVar5 = HasTrinket(this,0xa7,0); - if (bVar5 != 0) { - local_60 = GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0xa70)); - iVar6 = GetTrinketMultiplier(this,0xa7); - local_5c = GHIDRA_CAST((5 - iVar6)); - uVar11 = *local_60; - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar11 = *local_60; - if (uVar11 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar11 = uVar11 >> ((uint8_t)local_60[1] & 0x1f) ^ uVar11; - uVar11 = uVar11 ^ uVar11 << ((uint8_t)local_60[2] & 0x1f); - uVar11 = uVar11 ^ uVar11 >> ((uint8_t)local_60[3] & 0x1f); - *local_60 = uVar11; - if ((local_5c == GHIDRA_CAST(0x0)) || (uVar11 % GHIDRA_UINT(local_5c) == 0)) { - pvVar9 = (this->_trinketRNGs)._begin; - puVar10 = GHIDRA_CAST((GHIDRA_INT(pvVar9) + 0xa70)); - uVar11 = *puVar10; - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar11 = *puVar10; - if (uVar11 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar11 = uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa74)) & 0x1f) ^ uVar11; - uStack_50 = 0xb00000001; - uVar11 = uVar11 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa78)) & 0x1f) ^ uVar11; - local_5c = (TemporaryEffects *) - (uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa7c)) & 0x1f) ^ uVar11); - *puVar10 = GHIDRA_UINT(local_5c); - local_60 = GHIDRA_CAST(&DAT_00000006); - if (local_5c == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar11 = GHIDRA_UINT(local_5c) >> 1 ^ GHIDRA_UINT(local_5c); - uVar11 = uVar11 << 0xb ^ uVar11; - local_68 = GHIDRA_CAST((uVar11 >> 6 ^ uVar11)); - local_58 = GHIDRA_CAST(0x115); - if ((GHIDRA_UINT(local_68) & 3) != 0) { - local_58 = GHIDRA_CAST(0xe3); - } - uVar11 = Random(); - fVar14 = (float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_5c = GHIDRA_CAST((fVar14 + fVar14)); - local_44 = GHIDRA_CAST(sin((float)local_5c)); - fVar14 = cos((float)local_5c); - local_74.x = fVar14 * 10.0 + (this->_pos).x; - local_74.y = (float)local_44 * 10.0 + (this->_pos).y; - if (local_68 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar11 = GHIDRA_UINT(local_68) >> ((uint8_t)uStack_50 & 0x1f) ^ GHIDRA_UINT(local_68); - uVar11 = uVar11 << ((uint8_t)((uint64_t)uStack_50 >> 0x20) & 0x1f) ^ uVar11; - spawnedEntity = - Game::Spawn(g_game,GHIDRA_UINT(local_58),0,&local_74,&g_vectorZero,GHIDRA_CAST(this),0, - uVar11 >> ((uint8_t)local_60 & 0x1f) ^ uVar11); - if ((spawnedEntity == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (spawnedEntity->_type != 1)) && - (0x3dd < spawnedEntity->_type - 10U)))) { - spawnedEntity = GHIDRA_CAST(0x0); - } - fStack_28 = g_vectorZero.y; - local_20 = g_vectorZero.y; - fStack_2c = g_vectorZero.x; - fStack_24 = g_vectorZero.x; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x4))) = 0.0; - fStack_38 = 0.0; - fStack_34 = 0.0; - local_30 = 0.0; - local_1c = 0.0; - local_18 = 0.0; - (GHIDRA_CAST((spawnedEntity)))->Entity::AddCharmed(GHIDRA_CAST((local_40 + 4)),-1,0,0); - spawnedEntity->Update(); - (GHIDRA_CAST((spawnedEntity)))->Entity::SetVisibleFlag(0); - fVar14 = spawnedEntity->_maxHitPoints + spawnedEntity->_maxHitPoints; - local_20 = 0.0; - local_1c = 0.0; - local_18 = 0.0; - spawnedEntity->_maxHitPoints = fVar14; - spawnedEntity->_health = fVar14; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x0))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x4))) = 1.0; - fStack_38 = 1.0; - fStack_34 = 1.0; - local_30 = 0.0; - fStack_2c = 0.0; - fStack_28 = 0.0; - fStack_24 = 0.0; - uVar11 = Random(); - Game::SpawnParticles - (g_game,&local_74,0x23,4, - (float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0,GHIDRA_CAST(local_40),100000.0,0); - uVar11 = Random(); - local_44 = (Entity_Player *) - ((float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0); - uVar11 = Random(); - iVar6 = (uVar11 & 1) + 2; - do { - uVar11 = Random(); - uVar7 = Random(); - fVar14 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_58 = GHIDRA_CAST((fVar14 + fVar14)); - local_5c = GHIDRA_CAST(sin((float)local_58)); - local_80.x = cos((float)local_58); - local_80.x = local_80.x * (float)local_44; - local_80.y = (float)local_5c * 0.5 * (float)local_44; - spawnedEntity = Game::Spawn(g_game,1000,5,&local_74,&local_80,GHIDRA_CAST(0x0),1,uVar11); - uVar15 = *GHIDRA_CAST((GHIDRA_INT(&spawnedEntity->_flags) + 4)); - iVar2 = *GHIDRA_CAST(spawnedEntity); - *GHIDRA_CAST(&spawnedEntity->_flags) = GHIDRA_UINT(spawnedEntity->_flags) | 0x10000; - *GHIDRA_CAST((GHIDRA_INT(&spawnedEntity->_flags) + 4)) = uVar15; - (**(code **)(iVar2 + 0xc))(); - iVar6 = iVar6 + -1; - } while (iVar6 != 0); - this = player; - } - } - bVar5 = HasTrinket(this,0xaa,0); - if (bVar5 != 0) { - if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) >> 10 & 1) == 0) { - iVar6 = GetTrinketMultiplier(this,0xaa); - pGVar13 = GHIDRA_CAST((4 - iVar6)); - } - else { - iVar6 = GetTrinketMultiplier(this,0xaa); - pGVar13 = GHIDRA_CAST(((5 - iVar6) * 2)); - } - local_58 = GHIDRA_CAST(0x1); - if (1 < GHIDRA_INT(pGVar13)) { - local_58 = pGVar13; - } - pvVar9 = (this->_trinketRNGs)._begin; - puVar10 = GHIDRA_CAST((GHIDRA_INT(pvVar9) + 0xaa0)); - uVar11 = *puVar10; - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar11 = *puVar10; - if (uVar11 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar11 = uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xaa4)) & 0x1f) ^ uVar11; - uVar11 = uVar11 ^ uVar11 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xaa8)) & 0x1f); - uVar11 = uVar11 ^ uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xaac)) & 0x1f); - *puVar10 = uVar11; - if ((local_58 == GHIDRA_CAST(0x0)) || (uVar11 % GHIDRA_UINT(local_58) == 0)) { - effectsOwner = GHIDRA_CAST(0x0); - local_44 = GHIDRA_CAST(0x0); - uStack_50 = 0; - pEStack_48 = GHIDRA_CAST(0x0); - ehState = 3; - pGVar13 = GHIDRA_CAST(0x0); - do { - bVar5 = Level::CanSpawnDoorOutline(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,GHIDRA_UINT(pGVar13)); - if (bVar5 != 0) { - local_58 = pGVar13; - if (effectsOwner == local_44) { - msvc::vector<4byte>::_Emplace_reallocate(effectsOwner,&local_58); - local_44 = pEStack_48; - effectsOwner = (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_50)) + 0x4))); - } - else { - *GHIDRA_CAST(effectsOwner) = pGVar13; - uStack_50 = CONCAT44(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x4))),GHIDRA_CAST(uStack_50)); - effectsOwner = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x4)))); - } - } - this = player; - pGVar13 = GHIDRA_CAST((GHIDRA_INT(&pGVar13->_stage) + 1)); - } while (pGVar13 < GHIDRA_CAST(&DAT_00000008)); - if (GHIDRA_CAST(uStack_50) != effectsOwner) { - local_58 = g_game; - local_68 = GHIDRA_CAST((GHIDRA_INT((player->_trinketRNGs)._begin) + 0xaa0)); - uVar11 = GHIDRA_INT(effectsOwner) - GHIDRA_INT(GHIDRA_CAST(uStack_50)) >> 2; - local_60 = GHIDRA_CAST(*local_68); - if (local_60 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - local_60 = GHIDRA_CAST(*local_68); - if (local_60 == GHIDRA_CAST(0x0)) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar7 = GHIDRA_UINT(local_60) >> ((uint8_t)local_68[1] & 0x1f) ^ GHIDRA_UINT(local_60); - uVar7 = uVar7 ^ uVar7 << ((uint8_t)local_68[2] & 0x1f); - uVar7 = uVar7 ^ uVar7 >> ((uint8_t)local_68[3] & 0x1f); - *local_68 = uVar7; - if (uVar11 == 0) { - uVar7 = 0; - } - else { - uVar7 = uVar7 % uVar11; - } - Level::MakeRedRoomDoor - (GHIDRA_CAST(local_58),g_game->_currentRoomIdx, - *GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + uVar7 * 4))); - } - ehState = 0xffffffff; - if (GHIDRA_CAST(uStack_50) != GHIDRA_CAST(0x0)) { - uVar11 = (GHIDRA_INT(local_44) - GHIDRA_INT(GHIDRA_CAST(uStack_50)) >> 2) * 4; - effectsOwner = GHIDRA_CAST(uStack_50); - if (0xfff < uVar11) { - effectsOwner = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(uStack_50))[-1])) + 0x2efc)))); - uVar11 = uVar11 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + (-4 - GHIDRA_INT(effectsOwner))))) { -LAB_007aa32a: - ehState = 0xffffffff; - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(effectsOwner,uVar11); - uStack_50 = 0; - pEStack_48 = GHIDRA_CAST(0x0); - } - } - } - if ((this->_variant == 1) && (this->_babySkin == 0x40)) { - uVar11 = (this->_dropRNG)._seed; - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar11 = (this->_dropRNG)._seed; - if (uVar11 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar11 = uVar11 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar11; - uVar11 = uVar11 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar11; - uVar11 = uVar11 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar11; - (this->_dropRNG)._seed = uVar11; - uVar11 = uVar11 % 10; - bVar5 = (uint8_t)uVar11; - if (uVar11 == 0) { - position = &this->_pos; - bVar18 = bVar5; - iVar6 = Entity_Familiar::GetRandomWisp(&this->_dropRNG); - AddWisp(this,iVar6,position,bVar5,bVar18); - } - } - if ((((this->_playerType != 0x1d) && (this->_playerType != 0x26)) || - ((effectsOwner = this->_backupPlayer, effectsOwner == GHIDRA_CAST(0x0) && - (this->_twinPlayer == 0)))) || - ((0 < this->_controlsCooldown || (this->_hasCurseMistEffect != 0)))) goto LAB_007aa526; - local_44 = GHIDRA_CAST(this->_twinPlayer); - if (local_44 == GHIDRA_CAST(0x0)) { - local_44 = effectsOwner; -LAB_007aa43d: - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_54),3,-1,-1,1,0); - uVar11 = 0; - ehState = 4; - if (pEStack_48 != GHIDRA_CAST(0x0)) { - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - do { - familiar = *GHIDRA_CAST((iVar6 + uVar11 * 4)); - if (familiar->_player == this) { - (GHIDRA_CAST((familiar)))->Entity_Familiar::TriggerRoomClear(); - iVar6 = GHIDRA_INT(GHIDRA_CAST(uStack_50)); - } - uVar11 = uVar11 + 1; - } while (uVar11 < pEStack_48); - } - ehState = 0xffffffff; - if (local_54[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (GHIDRA_CAST(uStack_50) != GHIDRA_CAST(0x0)) { - uVar11 = *GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar11; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar11)); - free(GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(uStack_50)) + -4))); - } - } - ehState = 0xffffffff; - } - else if (local_44 == effectsOwner) goto LAB_007aa43d; - effectsOwner = local_44; - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_60) + 2)),0x2c7,0,-1,0); - if ((effectsOwner == this->_backupPlayer) && (this->_isCoopGhost == 0)) { - effectsOwner->_activeDesc[2]._item = 0; - TriggerRoomClear(effectsOwner); - } - iVar6 = this->_activeDesc[2]._unk; - iVar2 = this->_activeDesc[2]._charge; - iVar4 = this->_activeDesc[2]._batteryCharge; - effectsOwner->_activeDesc[2]._item = this->_activeDesc[2]._item; - effectsOwner->_activeDesc[2]._unk = iVar6; - effectsOwner->_activeDesc[2]._charge = iVar2; - effectsOwner->_activeDesc[2]._batteryCharge = iVar4; - iVar6 = this->_activeDesc[2]._timeRechargeCooldown; - iVar2 = this->_activeDesc[2]._partialCharge; - iVar4 = this->_activeDesc[2]._varData; - effectsOwner->_activeDesc[2]._subCharge = this->_activeDesc[2]._subCharge; - effectsOwner->_activeDesc[2]._timeRechargeCooldown = iVar6; - effectsOwner->_activeDesc[2]._partialCharge = iVar2; - effectsOwner->_activeDesc[2]._varData = iVar4; -LAB_007aa526: - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar8 = (this->_temporaryeffects)._effects._begin; - piVar8 != (this->_temporaryeffects)._effects._end; piVar8 = piVar8 + 4) { - if ((*GHIDRA_CAST(*piVar8) == 2) && ((GHIDRA_CAST(*piVar8))[1] == 0xa2)) { - pvVar9 = (g_manager->_itemConfig)._trinkets._begin; - if ((0x288 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar9) & 0xfffffffcU)) - ) && (itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x288)), - itemConfig != GHIDRA_CAST(0x0))) { - uStack_50 = (uint64_t)GHIDRA_UINT(itemConfig->maxCooldown) << 0x20; - pEStack_48 = GHIDRA_CAST(0x0); - local_54 = (uint8_t [4])itemConfig; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(local_54,1); - } - goto LAB_007aa725; - } - } - } - bVar5 = HasTrinket(this,0xa2,0); - if (bVar5 != 0) { - pvVar9 = (this->_trinketRNGs)._begin; - puVar10 = GHIDRA_CAST((GHIDRA_INT(pvVar9) + 0xa20)); - iVar6 = GetTrinketMultiplier(this,0xa2); - uVar11 = *puVar10; - local_58 = GHIDRA_CAST(0x1); - if (1 < 4 - iVar6) { - local_58 = GHIDRA_CAST((4 - iVar6)); - } - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar11 = *puVar10; - if (uVar11 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar11 = uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa24)) & 0x1f) ^ uVar11; - uVar11 = uVar11 ^ uVar11 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa28)) & 0x1f); - uVar11 = uVar11 ^ uVar11 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xa2c)) & 0x1f); - *puVar10 = uVar11; - if ((((local_58 == GHIDRA_CAST(0x0)) || (uVar11 % GHIDRA_UINT(local_58) == 0)) && - (pvVar9 = (g_manager->_itemConfig)._trinkets._begin, - 0x288 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar9) & 0xfffffffcU)))) && - (auVar12 = *(uint8_t (*) [4])(GHIDRA_INT(pvVar9) + 0x288), auVar12 != (uint8_t [4])0x0)) { - local_58 = GHIDRA_CAST((GHIDRA_CAST(auVar12))->maxCooldown); - uStack_50 = ZEXT48(local_58) << 0x20; - pEStack_48 = GHIDRA_CAST(0x0); - local_54 = auVar12; - if ((this->_temporaryeffects)._disabled == 0) { - piVar8 = (this->_temporaryeffects)._effects._end; - for (effect = (this->_temporaryeffects)._effects._begin; effect != piVar8; - effect = effect + 4) { - if ((uint8_t [4])*effect == auVar12) { - if (effect != piVar8) { - effect[1] = effect[1] + 2; - effect[2] = GHIDRA_INT(local_58->_roomList[0]._doors) + effect[2] + -0x30; - goto LAB_007aa715; - } - break; - } - } - piVar8 = (this->_temporaryeffects)._effects._end; - if (piVar8 == (this->_temporaryeffects)._effects._capacity) { - msvc::vector::_Emplace_reallocate(piVar8,local_54); - } - else { - *piVar8 = GHIDRA_INT(auVar12); - piVar8[1] = 0; - piVar8[2] = GHIDRA_INT(local_58); - piVar8[3] = 0; - ppvVar1 = &(this->_temporaryeffects)._effects._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x10); - } - auVar12 = local_54; - pvVar9 = (this->_temporaryeffects)._effects._begin; - *(uint32_t *) - (((GHIDRA_INT((this->_temporaryeffects)._effects._end) - GHIDRA_INT(pvVar9) & 0xfffffff0U) - 0xc) + - GHIDRA_INT(pvVar9)) = 2; - effectsOwner = (this->_temporaryeffects)._player; - if (effectsOwner != GHIDRA_CAST(0x0)) { - AddCostume(effectsOwner,GHIDRA_CAST(local_54),0); - } -LAB_007aa715: - (this->_temporaryeffects)._cacheFlags = - (this->_temporaryeffects)._cacheFlags | (GHIDRA_CAST(auVar12))->cacheFlags; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - } - } -LAB_007aa725: - trigger_set_dispatch(&this->_proceduralItems,5,GHIDRA_CAST(0x0),&this->_pos,&g_vectorZero); - if (GHIDRA_INT((this->_pendingWisps)._end) - GHIDRA_INT((this->_pendingWisps)._begin) >> 2 != 0) { - uVar11 = 0; - do { - AddWisp(this,*GHIDRA_CAST((GHIDRA_INT((this->_pendingWisps)._begin) + uVar11 * 4)),&this->_pos,0,0); - uVar11 = uVar11 + 1; - pvVar9 = (this->_pendingWisps)._begin; - } while (uVar11 < GHIDRA_UINT((GHIDRA_INT((this->_pendingWisps)._end) - GHIDRA_INT(pvVar9) >> 2))); - (this->_pendingWisps)._end = pvVar9; - } - ExceptionList = prevExceptionList; - return; -joined_r0x007a9607: - if (piVar8 == *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x1510))) goto LAB_007a9679; - if ((*GHIDRA_CAST(*piVar8) == 0) && ((GHIDRA_CAST(*piVar8))[1] == 0x70)) { - if ((piVar8[1] == 1) && - ((pvVar9 = (g_manager->_itemConfig)._nullItems._begin, - 0x70 < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar9) >> 2 && - (itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0x1c0)), - itemConfig != GHIDRA_CAST(0x0))))) { - uStack_50 = (uint64_t)GHIDRA_UINT(itemConfig->maxCooldown) << 0x20; - pEStack_48 = GHIDRA_CAST(0x0); - local_54 = (uint8_t [4])itemConfig; - (GHIDRA_CAST((local_5c)))->TemporaryEffects::AddEffect(local_54,1,1); - } - goto LAB_007a9679; - } - piVar8 = piVar8 + 4; - goto joined_r0x007a9607; -} - -// 007aa7c0 -uint8_t Entity_Player::HasPlayerForm(int playerForm) -{ - if ((((this->_hasCurseMistEffect == 0) && (this->_isCoopGhost == 0)) && (GHIDRA_UINT(playerForm) < 0x10)) - && (2 < this->_playerForms[playerForm])) { - return 1; - } - return 0; -} - -// 007aa800 -uint8_t Entity_Player::CanAddCollectible(int collectibleId) -{ - ItemConfig_Item *item; - - if (collectibleId != 0) { - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,collectibleId); - if (((item != GHIDRA_CAST(0x0)) && (item->type == 3)) && (this->_parent != 0)) { - return 0; - } - } - return this->_itemHoldCooldown == 0; -} - -// 007ab110 -uint8_t Entity_Player::IsExtraAnimationFinished() -{ - if ((this->_isPlayingExtraAnimation == 0) && (this->_isPlayingItemAnimation == 0)) { - return 1; - } - return 0; -} - -// 007ab130 -void Entity_Player::AnimatePickup(ANM2 *param_2, uint8_t param_3, uint8_t *param_4) -{ - uint8_t bVar1; - Entity_Player *pEVar2; - uint32_t uVar3; - uint8_t *animName; - LayerState *shadowLayer; - char *pickupName; - uint8_t *****pppppbVar4; - ANM2 *this_00; - bool isLess; - ANM2 spriteCopy; - uint32_t local_7c [11]; - Entity_Player *player; - uint8_t *savedAnimName; - ANM2 *savedSprite; - uint32_t cleanupFlags; - char isOnlineCollectible; - uint8_t *****spritePath [4]; - uint32_t spritePathSize; - uint32_t spritePathCapacity; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint8_t ****local_14; - - puStack_20 = GHIDRA_CAST((spritePath + 0xe)); - local_14 = GHIDRA_CAST(0xffffffff); - puStack_18 = &LAB_00affae0; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((spritePath + 0xb)); - ExceptionList = &local_1c; - savedAnimName = param_4; - savedSprite = param_2; - cleanupFlags = 0; - player = this; - if ((g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) || - (GHIDRA_UINT((*GHIDRA_CAST((g_manager + 1)) - g_manager->_netplayManager >> 2)) < 2)) { -LAB_007ab226: - puStack_20 = GHIDRA_CAST((spritePath + 0xe)); - } - else { - pickupName = "Pickup"; - do { - bVar1 = *param_4; - isLess = bVar1 < (uint8_t)*pickupName; - if (bVar1 != *pickupName) { -LAB_007ab1d1: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007ab1d6; - } - if (bVar1 == 0) break; - bVar1 = param_4[1]; - isLess = bVar1 < (uint8_t)pickupName[1]; - if (bVar1 != pickupName[1]) goto LAB_007ab1d1; - param_4 = param_4 + 2; - pickupName = pickupName + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_007ab1d6: - if (uVar3 != 0) goto LAB_007ab226; - (GHIDRA_CAST((GHIDRA_CAST(spritePath))))->msvc::string::string(param_2); - pppppbVar4 = GHIDRA_CAST(spritePath); - if (0xf < spritePathCapacity) { - pppppbVar4 = spritePath[0]; - } - cleanupFlags = 3; - uVar3 = msvc::string::find(GHIDRA_CAST(pppppbVar4),spritePathSize,0,GHIDRA_CAST("Collectible"),0xb); - if ((uVar3 != 0xffffffff) && (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - isOnlineCollectible = '\x01'; - goto LAB_007ab230; - } - } - isOnlineCollectible = '\0'; -LAB_007ab230: - if (((cleanupFlags & 1) != 0) && (0xf < spritePathCapacity)) { - uVar3 = spritePathCapacity + 1; - pppppbVar4 = spritePath[0]; - if (0xfff < uVar3) { - pppppbVar4 = GHIDRA_CAST(spritePath[0][-1]); - uVar3 = spritePathCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(spritePath[0]) + (-4 - GHIDRA_INT(pppppbVar4))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppbVar4,uVar3); - } - pEVar2 = player; - animName = GHIDRA_CAST("Pickup_Online"); - if (isOnlineCollectible == '\0') { - animName = savedAnimName; - } - PlayExtraAnimation(player,animName); - ANM2::ANM2(&spriteCopy,savedSprite); - Isaac::SwapANM2(&pEVar2->_heldSprite,&spriteCopy); - local_14 = GHIDRA_CAST(0x0); - ANM2::Reset(this_00); - AnimationState::~AnimationState(&spriteCopy._overlayAnimState); - AnimationState::~AnimationState(&spriteCopy._animState); - (GHIDRA_CAST((spriteCopy._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&spriteCopy))))->msvc::string::_Tidy_deallocate(); - (pEVar2->_heldSprite)._bitflags = savedSprite->_bitflags; - if (param_3 != 0) { - shadowLayer = ANM2::GetLayer(&pEVar2->_heldSprite,GHIDRA_CAST("shadow")); - if (shadowLayer != GHIDRA_CAST(0x0)) { - if (&shadowLayer->_color != GHIDRA_CAST(local_7c)) { - (shadowLayer->_color)._colorize[0] = 0.0; - (shadowLayer->_color)._colorize[1] = 0.0; - (shadowLayer->_color)._colorize[2] = 0.0; - (shadowLayer->_color)._colorize[3] = 0.0; - (shadowLayer->_color)._offset[0] = 0.0; - (shadowLayer->_color)._offset[1] = 0.0; - (shadowLayer->_color)._tint[0] = 0.0; - (shadowLayer->_color)._tint[1] = 0.0; - (shadowLayer->_color)._tint[2] = 0.0; - (shadowLayer->_color)._tint[3] = 0.0; - (shadowLayer->_color)._offset[2] = 0.0; - } - } - } - (pEVar2->_heldSprite)._offset.x = 0.0; - (pEVar2->_heldSprite)._offset.y = -4.0; - ExceptionList = local_1c; - return; -} - -// 007ab550 -void Entity_Player::AnimateTrinket(int trinketId, uint8_t *animName, uint8_t *spriteAnimName) -{ - uint8_t bVar1; - EntityConfig_Entity *pickupConfig; - uint8_t *currentAnimChar; - uint32_t compareResult; - uint8_t unk; - uint8_t *newAnimChar; - bool isLess; - uint32_t entityKey; - Entity_Player *player; - uint8_t lowerBoundResult [8]; - void *lowerBoundNode; - uint8_t *animData; - ANM2 *heldSprite; - Manager *manager; - int trinketConfig; - void *trinketsBegin; - - trinketsBegin = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinketsBegin) >> 2 <= - GHIDRA_INT((trinketId & 0x7fffU))) { - return; - } - trinketConfig = *GHIDRA_CAST((GHIDRA_CAST(trinketsBegin) + (trinketId & 0x7fffU) * 4)); - if (trinketConfig == 0) { - return; - } - heldSprite = &this->_heldSprite; - player = this; - ANM2::Reset(heldSprite); - manager = g_manager; - entityKey = 0x506400; - _Find_lower_bound<>(lowerBoundResult,&entityKey); - if (((*GHIDRA_CAST((GHIDRA_CAST(lowerBoundNode) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(lowerBoundNode) + 0x10)) < 0x506401)) && - (lowerBoundNode != (manager->_entityConfig)._entities._head)) { - pickupConfig = GHIDRA_CAST((GHIDRA_INT(lowerBoundNode) + 0x18)); - } - else { - pickupConfig = EntityConfig::GetEntity(&manager->_entityConfig,5,0,0); - } - ANM2::Load(heldSprite,&pickupConfig->anm2Path,0); - (GHIDRA_CAST((GHIDRA_CAST(heldSprite))))->Sprite::ReplaceSpritesheet(1,GHIDRA_CAST((trinketConfig + 0x38))); - ANM2::LoadGraphics(heldSprite,unk); - animData = (this->_heldSprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - currentAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - currentAnimChar = *GHIDRA_CAST(animData); - } - newAnimChar = spriteAnimName; - do { - bVar1 = *currentAnimChar; - isLess = bVar1 < *newAnimChar; - if (bVar1 != *newAnimChar) { -LAB_007ab650: - compareResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007ab655; - } - if (bVar1 == 0) break; - bVar1 = currentAnimChar[1]; - isLess = bVar1 < newAnimChar[1]; - if (bVar1 != newAnimChar[1]) goto LAB_007ab650; - currentAnimChar = currentAnimChar + 2; - newAnimChar = newAnimChar + 2; - } while (bVar1 != 0); - compareResult = 0; -LAB_007ab655: - if ((compareResult == 0) && - ((animData[0x34] == 0 || ((this->_heldSprite)._animState._isPlaying != 0)))) - goto LAB_007ab67d; - } - bVar1 = ANM2::SetAnimation(heldSprite,spriteAnimName,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_heldSprite)._animState); - (this->_heldSprite)._animState._isPlaying = 1; - } -LAB_007ab67d: - (player->_heldSprite)._offset.x = 0.0; - (player->_heldSprite)._offset.y = -4.0; - PlayExtraAnimation(player,animName); - return; -} - -// 007ab6b0 -void Entity_Player::AnimateCard(int cardId, uint8_t *animName) -{ - uint8_t bVar1; - uint8_t *curAnimChar; - void *pvVar2; - EntityConfig_Entity *entityConfig; - uint8_t *expectedName; - char *pcVar3; - uint32_t uVar4; - ANM2 *heldSprite; - bool isLess; - uint8_t *cardAnimName; - std_string cardAnm2Path; - std_string local_3c; - uint32_t stackCookie; - void **ppvStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint8_t *animData; - int cardConfig; - - ppvStack_20 = (void **)(GHIDRA_INT(&cardAnm2Path) + 0x50); - local_14 = 0xffffffff; - puStack_18 = &LAB_00affb25; - local_1c = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_INT(&cardAnm2Path) + 0x44U; - ExceptionList = &local_1c; - heldSprite = &this->_heldSprite; - if (0x61 < cardId) { - pvVar2 = (g_manager->_itemConfig)._cards._begin; - ppvStack_20 = (void **)(GHIDRA_INT(&cardAnm2Path) + 0x50); - if (((cardId < GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT(pvVar2) >> 2) && - (cardConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + cardId * 4)), - ppvStack_20 = (void **)(GHIDRA_INT(&cardAnm2Path) + 0x50), cardConfig != 0)) && - (ppvStack_20 = (void **)(GHIDRA_INT(&cardAnm2Path) + 0x50), *GHIDRA_CAST((cardConfig + 0x6c)) != 0)) { - ppvStack_20 = (void **)(GHIDRA_INT(&cardAnm2Path) + 0x50); - ANM2::Reset(heldSprite); - (GHIDRA_CAST((cardAnm2Path._buf)))->msvc::string::string(*(void **)(cardConfig + 0x6c)); - local_14 = 0; - ANM2::Load(heldSprite,&cardAnm2Path,1); - local_14 = 0xffffffff; - if (0xf < cardAnm2Path._capacity) { - uVar4 = cardAnm2Path._capacity + 1; - pvVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)cardAnm2Path._buf)) + 0x0))); - if (0xfff < uVar4) { - pvVar2 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(cardAnm2Path._buf)) + 0x0))) + -4); - uVar4 = cardAnm2Path._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(cardAnm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar2))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar2,uVar4); - } - ANM2::Play(heldSprite,GHIDRA_CAST("Sparkle"),0); - cardAnimName = GHIDRA_CAST((cardConfig + 0x38)); - if (0xf < *GHIDRA_CAST((cardConfig + 0x4c))) { - cardAnimName = *GHIDRA_CAST(cardAnimName); - } - animData = (this->_heldSprite)._overlayAnimState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimChar = animData; - expectedName = cardAnimName; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - do { - bVar1 = *curAnimChar; - isLess = bVar1 < *expectedName; - if (bVar1 != *expectedName) { -LAB_007ab7f4: - uVar4 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007ab7f9; - } - if (bVar1 == 0) break; - bVar1 = curAnimChar[1]; - isLess = bVar1 < expectedName[1]; - if (bVar1 != expectedName[1]) goto LAB_007ab7f4; - curAnimChar = curAnimChar + 2; - expectedName = expectedName + 2; - } while (bVar1 != 0); - uVar4 = 0; -LAB_007ab7f9: - if ((uVar4 == 0) && - ((animData[0x34] == 0 || ((this->_heldSprite)._overlayAnimState._isPlaying != 0)))) - goto LAB_007abab4; - } - bVar1 = ANM2::SetOverlayAnimation(heldSprite,cardAnimName,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_heldSprite)._overlayAnimState); - (this->_heldSprite)._overlayAnimState._isPlaying = 1; - } - } - goto LAB_007abab4; - } - ANM2::Reset(heldSprite); - local_3c._size = 0; - local_3c._capacity = 0xf; - local_3c._buf[0] = '\0'; - local_3c._buf[1] = '\0'; - local_3c._buf[2] = '\0'; - local_3c._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) = msvc::_Allocate(0x20); - local_3c._size = 0x19; - local_3c._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_3c._buf))) + 0x0))),"gfx/ui/ui_cardspills.anm2",0x1a); - local_14 = 1; - ANM2::Load(heldSprite,&local_3c,1); - local_14 = 0xffffffff; - if (0xf < local_3c._capacity) { - uVar4 = local_3c._capacity + 1; - pcVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_3c._buf))) + 0x0))); - if (0xfff < uVar4) { - pcVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) + -4)); - uVar4 = local_3c._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar3))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar3,uVar4); - } - animData = (this->_heldSprite)._animState._animData; - heldSprite = &this->_heldSprite; - local_3c._size = 0; - local_3c._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) & 0xffffff00; - if (animData == GHIDRA_CAST(0x0)) { -LAB_007ab949: - bVar1 = ANM2::SetAnimation(heldSprite,GHIDRA_CAST("Sparkle"),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_heldSprite)._animState); - (this->_heldSprite)._animState._isPlaying = 1; - } - } - else { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - pcVar3 = "Sparkle"; - do { - bVar1 = *curAnimChar; - isLess = bVar1 < (uint8_t)*pcVar3; - if (bVar1 != *pcVar3) { -LAB_007ab936: - uVar4 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007ab93b; - } - if (bVar1 == 0) break; - bVar1 = curAnimChar[1]; - isLess = bVar1 < (uint8_t)pcVar3[1]; - if (bVar1 != pcVar3[1]) goto LAB_007ab936; - curAnimChar = curAnimChar + 2; - pcVar3 = pcVar3 + 2; - } while (bVar1 != 0); - uVar4 = 0; -LAB_007ab93b: - if ((uVar4 != 0) || ((animData[0x34] != 0 && ((this->_heldSprite)._animState._isPlaying == 0)))) - goto LAB_007ab949; - } - bVar1 = ANM2::SetOverlayAnimation(heldSprite,GHIDRA_CAST("CardFronts"),1); - if ((bVar1 != 0) && ((this->_heldSprite)._overlayAnimState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_heldSprite)._overlayAnimState,(float)cardId); - } - uVar4 = 0; - if ((this->_heldSprite)._layerCount != 0) { - do { - pvVar2 = AnimationState::GetLayerFrame(&(this->_heldSprite)._overlayAnimState,uVar4); - if ((pvVar2 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x2c)) != '\0')) goto LAB_007abab4; - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT((this->_heldSprite)._layerCount)); - } - if ((((cardId < 0) || - (pvVar2 = (g_manager->_itemConfig)._cards._begin, - GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT(pvVar2) >> 2 <= cardId)) || - (cardConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + cardId * 4)), cardConfig == 0)) || - (entityConfig = EntityConfig::GetEntity - (&g_manager->_entityConfig,5,300,*GHIDRA_CAST((cardConfig + 0x54))), - entityConfig == GHIDRA_CAST(0x0))) goto LAB_007abab4; - ANM2::Load(heldSprite,&entityConfig->anm2Path,1); - animData = (this->_heldSprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_007aba73: - bVar1 = ANM2::SetAnimation(heldSprite,GHIDRA_CAST("Sparkle"),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_heldSprite)._animState); - (this->_heldSprite)._animState._isPlaying = 1; - } - } - else { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - pcVar3 = "Sparkle"; - do { - bVar1 = *curAnimChar; - isLess = bVar1 < (uint8_t)*pcVar3; - if (bVar1 != *pcVar3) { -LAB_007aba60: - uVar4 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007aba65; - } - if (bVar1 == 0) break; - bVar1 = curAnimChar[1]; - isLess = bVar1 < (uint8_t)pcVar3[1]; - if (bVar1 != pcVar3[1]) goto LAB_007aba60; - curAnimChar = curAnimChar + 2; - pcVar3 = pcVar3 + 2; - } while (bVar1 != 0); - uVar4 = 0; -LAB_007aba65: - if ((uVar4 != 0) || ((animData[0x34] != 0 && ((this->_heldSprite)._animState._isPlaying == 0)))) - goto LAB_007aba73; - } - bVar1 = ANM2::SetOverlayAnimation(heldSprite,&DAT_00b6b338,1); - if ((bVar1 != 0) && ((this->_heldSprite)._overlayAnimState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_heldSprite)._overlayAnimState,0.0); - } -LAB_007abab4: - (this->_heldSprite)._offset.x = 0.0; - (this->_heldSprite)._offset.y = -12.0; - PlayExtraAnimation(this,animName); - ExceptionList = local_1c; - return; -} - -// 007abb00 -void Entity_Player::AnimatePill(int pillColor, uint8_t *animName) -{ - uint8_t bVar1; - EntityConfig_Entity *pillConfig; - uint8_t *curAnimChar; - uint32_t animCompare; - char *sparkleChar; - bool isLess; - uint8_t *animData; - ANM2 *heldSprite; - - heldSprite = &this->_heldSprite; - ANM2::Reset(heldSprite); - pillConfig = EntityConfig::GetEntity(&g_manager->_entityConfig,5,0x46,pillColor); - if (pillConfig == GHIDRA_CAST(0x0)) goto LAB_007abbd4; - ANM2::Load(heldSprite,&pillConfig->anm2Path,1); - animData = (this->_heldSprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_007abb93: - bVar1 = ANM2::SetAnimation(heldSprite,GHIDRA_CAST("Sparkle"),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_heldSprite)._animState); - (this->_heldSprite)._animState._isPlaying = 1; - } - } - else { - curAnimChar = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimChar = *GHIDRA_CAST(animData); - } - sparkleChar = "Sparkle"; - do { - bVar1 = *curAnimChar; - isLess = bVar1 < (uint8_t)*sparkleChar; - if (bVar1 != *sparkleChar) { -LAB_007abb80: - animCompare = -GHIDRA_UINT(isLess) | 1; - goto LAB_007abb85; - } - if (bVar1 == 0) break; - bVar1 = curAnimChar[1]; - isLess = bVar1 < (uint8_t)sparkleChar[1]; - if (bVar1 != sparkleChar[1]) goto LAB_007abb80; - curAnimChar = curAnimChar + 2; - sparkleChar = sparkleChar + 2; - } while (bVar1 != 0); - animCompare = 0; -LAB_007abb85: - if ((animCompare != 0) || - ((animData[0x34] != 0 && ((this->_heldSprite)._animState._isPlaying == 0)))) - goto LAB_007abb93; - } - bVar1 = ANM2::SetOverlayAnimation(heldSprite,&DAT_00b6b338,1); - if ((bVar1 != 0) && ((this->_heldSprite)._overlayAnimState._animData != (void *)0x0)) { - AnimationState::SetFrameFloat(&(this->_heldSprite)._overlayAnimState,0.0); - } -LAB_007abbd4: - (this->_heldSprite)._offset.x = 0.0; - (this->_heldSprite)._offset.y = -12.0; - PlayExtraAnimation(this,animName); - return; -} - -// 007abc00 -void Entity_Player::AnimateTrapdoor() -{ - PlayExtraAnimation(this,GHIDRA_CAST("Trapdoor")); - return; -} - -// 007abc10 -void Entity_Player::AnimateLightTravel() -{ - Entity_Player *in_ECX; - - PlayExtraAnimation(in_ECX,GHIDRA_CAST("LightTravel")); - return; -} - -// 007abc20 -void Entity_Player::AnimatePitfallIn(uint8_t isIgnoreEffect) -{ - uint8_t isHasEffect; - int pitfallState; - - if ((isIgnoreEffect == 0) && - (isHasEffect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271), - isHasEffect != 0)) { - return; - } - PlayExtraAnimation(this,GHIDRA_CAST("FallIn")); - this->_isControlsEnabled = 0; - pitfallState = 1; - this->_entityCollisionClass = 0; - this->_pitfallTimer = 0; - if (isIgnoreEffect != 0) { - pitfallState = 4; - } - this->_pitfallState = pitfallState; - return; -} - -// 007abc90 -void Entity_Player::AnimatePitfallOut() -{ - this->_pitfallState = 3; - PlayExtraAnimation(this,GHIDRA_CAST("JumpOut")); - return; -} - -// 007abcb0 -void Entity_Player::AnimateAppear() -{ - PlayExtraAnimation(this,GHIDRA_CAST("Appear")); - return; -} - -// 007abcc0 -void Entity_Player::AnimateTeleport(uint8_t isUp) -{ - uint8_t bVar1; - char *animName; - undefined3 in_stack_00000005; - Manager *manager; - - bVar1 = isUp; - animName = "TeleportUp"; - if (isUp == 0) { - animName = "TeleportDown"; - } - PlayExtraAnimation(this,GHIDRA_CAST(animName)); - manager = g_manager; - if (bVar1 != 0) { - _isUp = 0xd7; - seed_fart_sound_override(GHIDRA_CAST(&isUp)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(_isUp,1.0,2,0,1.0,0.0); - } - return; -} - -// 007abd30 -void Entity_Player::AnimateHappy() -{ - int soundId; - Manager *manager; - - manager = g_manager; - soundId = 0x10c; - seed_fart_sound_override(&soundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); - PlayExtraAnimation(this,GHIDRA_CAST("Happy")); - return; -} - -// 007abd90 -void Entity_Player::AnimateSad() -{ - int soundId; - Manager *manager; - - manager = g_manager; - soundId = 0x10b; - seed_fart_sound_override(&soundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); - PlayExtraAnimation(this,&DAT_00b1cdf8); - return; -} - -// 007abdf0 -void Entity_Player::AddPrettyFly() -{ - int *haloOfFliesCount; - - haloOfFliesCount = GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + 0x28)); - *haloOfFliesCount = *haloOfFliesCount + 1; - this->_cacheFlags = this->_cacheFlags | 0x200; - EvaluateItems(this); - AnimateHappy(this); - return; -} - -// 007abe20 -void Entity_Player::PlayExtraAnimation(uint8_t *animName) -{ - uint8_t isAnimSet; - - this->_isPlayingItemAnimation = 0; - ANM2::Reset(&this->_bodySprite); - (this->_sprite)._playbackSpeed = 1.0; - AnimationState::SetAnimationData(&(this->_sprite)._overlayAnimState,(void *)0x0); - isAnimSet = ANM2::SetAnimation(&this->_sprite,animName,1); - if (isAnimSet != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - this->_isPlayingItemAnimation = 0; - this->_isPlayingExtraAnimation = 1; - return; -} - -// 007abf80 -void Entity_Player::active_used_post(int slot, uint8_t unk, int chargeBeforeUse) -{ - int *piVar1; - int iVar2; - code *pcVar3; - RNG rng; - RNG rng_00; - RNG rng_01; - Game *pGVar4; - uint8_t bVar5; - char isDeathmatchBanned; - uint32_t uVar6; - ItemConfig_Item *collectibleConfig; - int iVar7; - int unused; - uint32_t uVar8; - void *pvVar9; - void *freeBlock; - uint32_t *rngSeed; - bool isExcludedItem; - float in_XMM0_Da; - short sStack0000000a; - void *expansionPicker; - int *expansionPickerEnd; - int *expansionPickerCapacity; - void *activePicker; - int *activePickerEnd; - int *activePickerCapacity; - int newOutcomeId; - int newOutcomeWeight; - int expansionOutcomeId; - Manager *local_1c; - int qualityWeight; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Manager *manager; - - local_8 = 0xffffffff; - puStack_c = &LAB_00affb8d; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (this->_activeDesc[slot]._item == 0x1da) { - RemoveCollectible(this,0x1da,0,slot,1); - AddCollectible(this,0x160,-1,0,slot,0,0); - AnimateCollectible(this,0x160,GHIDRA_CAST("UseItem"),GHIDRA_CAST("PlayerPickupSparkle")); - } - iVar7 = chargeBeforeUse; - if (slot == 0) { - TriggerBookOfVirtues(this,this->_activeDesc[0]._item,chargeBeforeUse); - trigger_book_of_belial_passive(this,this->_activeDesc[0]._item,iVar7); - } - bVar5 = HasTrinket(this,0x8a,0); - if (((bVar5 != 0) && (slot == 0)) && - (bVar5 = ItemConfig::IsValidCollectible(this->_activeDesc[0]._item), bVar5 != 0)) { - bVar5 = HasCollectible(this,0x2d1,0); - pGVar4 = g_game; - if (bVar5 == 0) { - pvVar9 = (void *)0x0; - local_1c = g_manager; - activePicker = (void *)0x0; - activePickerEnd = GHIDRA_CAST(0x0); - activePickerCapacity = GHIDRA_CAST(0x0); - local_8 = 0; - freeBlock = (g_manager->_itemConfig)._collectibles._begin; - chargeBeforeUse = 0; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(freeBlock) >> 2 != 0) { - do { - if ((((chargeBeforeUse != this->_activeDesc[0]._item) && - (piVar1 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + chargeBeforeUse * 4)), piVar1 != GHIDRA_CAST(0x0))) && - ((*piVar1 == 3 && (((piVar1[0x2f] & 1U) == 0 && (piVar1[0x12] != 0)))))) && - (bVar5 = (GHIDRA_CAST((piVar1)))->Item::IsAvailable(0xffffffff), bVar5 != 0)) { - iVar7 = piVar1[1]; - uVar8 = GHIDRA_INT(activePickerEnd) - GHIDRA_INT(pvVar9) >> 3; - qualityWeight = *GHIDRA_CAST((&DAT_00b6bc60 + piVar1[0x30] * 4)); - uVar6 = 0; - if (uVar8 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar6 * 8)) == iVar7) { - piVar1 = GHIDRA_CAST((GHIDRA_INT(pvVar9) + uVar6 * 8 + 4)); - *piVar1 = *piVar1 + qualityWeight; - if (*piVar1 < 0) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar6 * 8 + 4)) = 0; - } - goto LAB_007ac194; - } - uVar6 = uVar6 + 1; - } while (uVar6 < uVar8); - } - if (0 < qualityWeight) { - newOutcomeId = iVar7; - newOutcomeWeight = qualityWeight; - if (activePickerEnd == activePickerCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(activePickerEnd,&newOutcomeId); - pvVar9 = activePicker; - } - else { - *activePickerEnd = iVar7; - activePickerEnd[1] = qualityWeight; - activePickerEnd = activePickerEnd + 2; - } - } - } -LAB_007ac194: - chargeBeforeUse = chargeBeforeUse + 1; - freeBlock = (local_1c->_itemConfig)._collectibles._begin; - } while (GHIDRA_UINT(chargeBeforeUse) < - GHIDRA_UINT((GHIDRA_INT((local_1c->_itemConfig)._collectibles._end) - GHIDRA_INT(freeBlock) >> 2))); - } - uVar6 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0x8a0)))))->RNG::Next(); - in_XMM0_Da = 7.00649e-45; - rng._shift1 = 5; - rng._seed = uVar6; - rng._shift2 = 9; - rng._shift3 = 7; - uVar6 = (GHIDRA_CAST((GHIDRA_CAST(&activePicker))))->WeightedOutcomePicker::PickOutcome(rng); - local_8 = 0xffffffff; - if (activePicker != (void *)0x0) { - uVar8 = (GHIDRA_INT(activePickerCapacity) - GHIDRA_INT(activePicker) >> 3) * 8; - freeBlock = activePicker; - if (0xfff < uVar8) { - freeBlock = *(void **)(GHIDRA_CAST(activePicker) + -4); - uVar8 = uVar8 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(activePicker) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_007ac7ad; - } - operator_delete(freeBlock,uVar8); - activePicker = (void *)0x0; - activePickerEnd = GHIDRA_CAST(0x0); - activePickerCapacity = GHIDRA_CAST(0x0); - } - } - else { - uVar6 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0x8a0)))))->RNG::Next(); - uVar6 = ItemPool::CreateGlitchedCollectible(&pGVar4->_proceduralItemManager,uVar6,8); - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,uVar6); - if (collectibleConfig->type != 3) goto LAB_007ac2d2; - } - if (uVar6 != 0) { - iVar7 = GetTrinketMultiplier(this,0x8a); - RemoveCollectible(this,this->_activeDesc[0]._item,0,0,1); - AddCollectible(this,uVar6,0,0,0,0,0); - if (1 < iVar7) { - uVar6 = 0x14; - if (iVar7 == 2) { - uVar6 = 10; - } - uVar8 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0x8a0)))))->RNG::RandomInt(100); - if (uVar8 < uVar6) { - iVar7 = GetCollectibleMaxCharge - (this,this->_activeDesc[0]._item,this->_activeDesc[0]._varData,unused); - AddActiveCharge(this,iVar7,0,0,0,0); - } - } - } - } -LAB_007ac2d2: - bVar5 = HasTrinket(this,0x7a,0); - if ((bVar5 != 0) && (slot == 0)) { - iVar7 = this->_activeDesc[0]._item; - bVar5 = ItemConfig::IsValidCollectible(iVar7); - if ((bVar5 != 0) && - (((unk == 0 && - (collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar7), - collectibleConfig != GHIDRA_CAST(0x0))) && (collectibleConfig->type == 3)))) { - IsLocalPlayer(this); - SoundEffects::PlayWithFartOverride(0x385,in_XMM0_Da,2,0,1.0); - DropCollectible(this,this->_activeDesc[0]._item,GHIDRA_CAST(0x0),0); - } - } - bVar5 = HasTrinket(this,0xb5,0); - if ((bVar5 != 0) && (slot == 0)) { - iVar7 = this->_activeDesc[0]._item; - bVar5 = ItemConfig::IsValidCollectible(iVar7); - if (bVar5 == 0) { - ExceptionList = local_10; - return; - } - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar7); - iVar7 = GetActiveMaxCharge(this,0); - if (collectibleConfig == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return; - } - if (((iVar7 != 0) || (collectibleConfig->maxCharges < 1)) && - ((bVar5 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasTrinketEffect(0xb5), bVar5 != 0 && - (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)))) { - ExceptionList = local_10; - return; - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddTrinketEffect(0xb5,1,1); - manager = g_manager; - expansionPicker = (void *)0x0; - expansionPickerEnd = GHIDRA_CAST(0x0); - expansionPickerCapacity = GHIDRA_CAST(0x0); - pvVar9 = (void *)0x0; - activePicker = (void *)0x0; - activePickerEnd = GHIDRA_CAST(0x0); - activePickerCapacity = GHIDRA_CAST(0x0); - local_8 = 2; - freeBlock = (g_manager->_itemConfig)._collectibles._begin; - _unk = 0; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(freeBlock) >> 2 != 0) { - do { - if (((((_unk != this->_activeDesc[0]._item) && - (piVar1 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + _unk * 4)), piVar1 != GHIDRA_CAST(0x0))) && - (*piVar1 == 3)) && (((piVar1[0x2f] & 1U) == 0 && (piVar1[0x12] != 0)))) && - ((bVar5 = (GHIDRA_CAST((piVar1)))->Item::IsAvailable(0xffffffff), bVar5 != 0 && - ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || - (isDeathmatchBanned = - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 0x30)) - (piVar1[1]), isDeathmatchBanned == '\0')))))) { - iVar7 = piVar1[1]; - if (iVar7 < 0x1ea) { - if ((iVar7 == 0x1e9) || (iVar7 == 0x1a6)) goto LAB_007ac5c0; - isExcludedItem = iVar7 == 0x1e8; - } - else { - isExcludedItem = iVar7 == 0x2bf; - } - if (!isExcludedItem) { - iVar2 = piVar1[0x1d]; - if ((iVar2 == 1) || (iVar2 == 2)) { - uVar6 = 0; - uVar8 = GHIDRA_INT(expansionPickerEnd) - GHIDRA_INT(expansionPicker) >> 3; - if (uVar8 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(expansionPicker) + uVar6 * 8)) == iVar7) { - piVar1 = GHIDRA_CAST((GHIDRA_INT(expansionPicker) + uVar6 * 8 + 4)); - *piVar1 = *piVar1 + 1; - if (*piVar1 < 0) { - *GHIDRA_CAST((GHIDRA_CAST(expansionPicker) + uVar6 * 8 + 4)) = 0; - } - goto LAB_007ac5c0; - } - uVar6 = uVar6 + 1; - } while (uVar6 < uVar8); - } - local_1c = GHIDRA_CAST(0x1); - expansionOutcomeId = iVar7; - if (expansionPickerEnd == expansionPickerCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(expansionPickerEnd,&expansionOutcomeId); - } - else { - *expansionPickerEnd = iVar7; - expansionPickerEnd[1] = 1; - expansionPickerEnd = expansionPickerEnd + 2; - } - } - else if (iVar2 == 3) { - uVar6 = 0; - uVar8 = GHIDRA_INT(activePickerEnd) - GHIDRA_INT(pvVar9) >> 3; - if (uVar8 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar6 * 8)) == iVar7) { - piVar1 = GHIDRA_CAST((GHIDRA_INT(pvVar9) + uVar6 * 8 + 4)); - *piVar1 = *piVar1 + 1; - if (*piVar1 < 0) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + uVar6 * 8 + 4)) = 0; - } - goto LAB_007ac5c0; - } - uVar6 = uVar6 + 1; - } while (uVar6 < uVar8); - } - newOutcomeWeight = 1; - newOutcomeId = iVar7; - if (activePickerEnd == activePickerCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(activePickerEnd,&newOutcomeId); - pvVar9 = activePicker; - } - else { - *activePickerEnd = iVar7; - activePickerEnd[1] = 1; - activePickerEnd = activePickerEnd + 2; - } - } - } - } -LAB_007ac5c0: - _unk = _unk + 1; - freeBlock = (manager->_itemConfig)._collectibles._begin; - } while (_unk < GHIDRA_UINT((GHIDRA_INT((manager->_itemConfig)._collectibles._end) - GHIDRA_INT(freeBlock) >> 2))); - } - slot = 1; - iVar7 = GetTrinketMultiplier(this,0xb5); - if (iVar7 == 2) { - slot = 2; - } - else if (iVar7 == 3) { - slot = 2; - uVar6 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0xb50)))))->RNG::Next(); - rng_00._shift1 = 5; - rng_00._seed = uVar6; - rng_00._shift2 = 9; - rng_00._shift3 = 7; - uVar6 = (GHIDRA_CAST((GHIDRA_CAST(&activePicker))))->WeightedOutcomePicker::PickOutcome(rng_00); - if (uVar6 == 0) { - pvVar9 = activePicker; - } - else { - iVar7 = this->_itemState; - this->_itemState = 0; - UseActiveItem(this,&sStack0000000a,uVar6,5,0,0); - pvVar9 = activePicker; - if (this->_itemState == 0) { - this->_itemState = iVar7; - } - else { - this->_itemStateCooldown = 0; - } - } - } - do { - freeBlock = (this->_trinketRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(freeBlock) + 0xb50)); - uVar6 = *rngSeed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = *rngSeed; - if (uVar6 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(freeBlock) + 0xb54)) & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(freeBlock) + 0xb58)) & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(freeBlock) + 0xb5c)) & 0x1f) ^ uVar6; - *rngSeed = uVar6; - rng_01._shift1 = 5; - rng_01._seed = uVar6; - rng_01._shift2 = 9; - rng_01._shift3 = 7; - uVar6 = (GHIDRA_CAST((GHIDRA_CAST(&expansionPicker))))->WeightedOutcomePicker::PickOutcome(rng_01); - if (uVar6 != 0) { - iVar7 = this->_itemState; - this->_itemState = 0; - UseActiveItem(this,&sStack0000000a,uVar6,5,0,0); - if (this->_itemState == 0) { - this->_itemState = iVar7; - } - else { - this->_itemStateCooldown = 0; - } - } - slot = slot + -1; - } while (slot != 0); - if (pvVar9 != (void *)0x0) { - uVar6 = GHIDRA_INT(activePickerCapacity) - GHIDRA_INT(pvVar9) & 0xfffffff8; - freeBlock = pvVar9; - if (0xfff < uVar6) { - freeBlock = *(void **)(GHIDRA_CAST(pvVar9) + -4); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar9) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_007ac7ad; - } - operator_delete(freeBlock,uVar6); - } - if (expansionPicker != (void *)0x0) { - uVar6 = GHIDRA_INT(expansionPickerCapacity) - GHIDRA_INT(expansionPicker) & 0xfffffff8; - freeBlock = expansionPicker; - if (0xfff < uVar6) { - freeBlock = *(void **)(GHIDRA_CAST(expansionPicker) + -4); - uVar6 = uVar6 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(expansionPicker) + (-4 - GHIDRA_INT(freeBlock))))) { -LAB_007ac7ad: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar6); - } - } - ExceptionList = local_10; - return; -} - -// 007ac7e0 -void Entity_Player::DischargeActiveItem(uint32_t slot, uint8_t unk) -{ - void **ppvVar1; - PlayerManager *this_00; - code *srcDescTail; - uint32_t uVar3; - int subCharge; - int rechargeCooldown; - float fVar6; - uint8_t bVar7; - uint32_t uVar8; - ItemConfig_Item *itemConfig; - int iVar9; - Entity *effect; - int *playerSlot; - uint32_t extraout_EAX; - ColorMod *color; - uint32_t *puVar10; - char isCacheDirty; - int iVar11; - float *historyItem; - void *pvVar12; - Vector *position; - uint32_t *rngSeed; - uint32_t uVar13; - TypeDescriptor *pTVar14; - TypeDescriptor *pTVar15; - uint32_t uVar16; - float local_88; - float fStack_84; - Entity_Player *pEStack_80; - Entity_Player *pEStack_7c; - uint32_t activeSlot; - int local_74; - int descOffset; - float *local_6c; - Entity_Player *local_68; - Entity_Player *local_64; - Entity_Player *local_60; - Game *local_5c; - Entity_Player *local_58; - char isItemMoved; - Color local_50; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - float local_14; - uint32_t *dstDescHead; - char *dstDescTail; - float *historyEnd; - Manager *manager; - Entity_Player *otherPlayer; - int partialCharge; - int rechargeCooldown; - char *srcDescTail; - int subCharge; - int varData; - - puStack_20 = GHIDRA_CAST((&local_50)[1]._offset); - local_14 = -NAN; - puStack_18 = &LAB_00affbc7; - local_1c = ExceptionList; - uVar8 = __security_cookie ^ GHIDRA_UINT(((&local_50)[1]._colorize + 1)); - local_68 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x1))),unk)); - activeSlot = slot; - if (3 < slot) { - return; - } - descOffset = slot * 0x20 + 0x1580; - if (this->_activeDesc[slot]._item == 0) { - return; - } - local_6c = GHIDRA_CAST((slot * 0x20)); - local_64 = *GHIDRA_CAST((GHIDRA_CAST((local_6c + 0x563)) + GHIDRA_INT(this))); - ExceptionList = &local_1c; - local_58 = this; - local_24 = uVar8; - local_74 = GetActiveMaxCharge(this,slot); - local_5c = GHIDRA_CAST(GetActiveMaxCharge(this,slot)); - if (*GHIDRA_CAST((GHIDRA_CAST((local_6c + 0x562)) + GHIDRA_INT(this))) < local_74) { - iVar11 = *GHIDRA_CAST((GHIDRA_CAST((local_6c + 0x562)) + GHIDRA_INT(this))) - local_74; - itemConfig = ItemConfig::GetCollectible - (&g_manager->_itemConfig, - *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + descOffset))); - if ((itemConfig != GHIDRA_CAST(0x0)) && (iVar9 = FUN_007308d0(uVar8), iVar9 != 2)) { - iVar9 = FUN_007308d0(uVar8); - if (iVar9 == 1) { - iVar11 = -1; - } - iVar9 = GetEffectiveSoulCharge(this); - if ((iVar9 < 1) || - (((this->_playerType == 0x12 && (bVar7 = HasCollectible(this,0x26b,0), bVar7 != 0)) && - (uVar8 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_collectibleRNGs)._begin) + 0x26b0)))))->RNG::RandomInt(2), - uVar8 == 0)))) { - iVar9 = GetEffectiveBloodCharge(this); - if (0 < iVar9) { - AddBloodCharge(this,iVar11); - } - } - else { - AddSoulCharge(this,iVar11); - } - } - } - bVar7 = HasCollectible(this,0x74,0); - if ((bVar7 != 0) && - (local_60 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_64)) + 0x1)))), GHIDRA_INT(local_60) < GHIDRA_INT(local_5c))) { - local_5c = GHIDRA_CAST(g_manager); - itemConfig = ItemConfig::GetCollectible - (&g_manager->_itemConfig, - *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + descOffset))); - iVar11 = GetActiveMaxCharge(this,activeSlot); - if (itemConfig != GHIDRA_CAST(0x0)) { - if (iVar11 == 1) { - local_64 = local_60; - if (GHIDRA_INT(local_60) < local_74 / 2) { - local_64 = GHIDRA_CAST((local_74 / 2)); - } - } - else if (iVar11 == 0) { - local_64 = local_60; - local_60 = GHIDRA_CAST(0xab); - seed_fart_sound_override(GHIDRA_CAST(&local_60)); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_5c->_glowingHourglassStates[0])) + 0x3938)))))))->SoundEffects::Play(GHIDRA_INT(local_60),1.0,2,0,1.0,0.0); - } - } - uVar8 = Random(); - uVar16 = 0; - pTVar15 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar14 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar13 = 0; - effect = Game::Spawn(g_game,1000,0x31,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8); - iVar11 = __RTDynamicCast(effect,uVar13,pTVar14,pTVar15,uVar16); - *GHIDRA_CAST((iVar11 + 0xdc)) = 0; - *GHIDRA_CAST((iVar11 + 0xe0)) = 0xc1c00000; - *GHIDRA_CAST((iVar11 + 0x358)) = 0x3f800000; - } - uVar8 = activeSlot; - local_74 = *GHIDRA_CAST((GHIDRA_CAST((local_6c + 0x562)) + GHIDRA_INT(this))); - SetActiveCharge(this,GHIDRA_INT(local_64),activeSlot); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1826))) = 0; - iVar11 = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + descOffset)); - if (iVar11 != 0x2bf) { - if ((iVar11 == 0x2c7) && (uVar8 == 2)) { - iVar11 = this->_twinPlayer; - if (iVar11 != 0) { - iVar9 = this->_activeDesc[2]._unk; - subCharge = this->_activeDesc[2]._charge; - rechargeCooldown = this->_activeDesc[2]._batteryCharge; - subCharge = this->_activeDesc[2]._subCharge; - rechargeCooldown = this->_activeDesc[2]._timeRechargeCooldown; - partialCharge = this->_activeDesc[2]._partialCharge; - varData = this->_activeDesc[2]._varData; - *GHIDRA_CAST((iVar11 + 0x15c0)) = this->_activeDesc[2]._item; - *GHIDRA_CAST((iVar11 + 0x15c4)) = iVar9; - *GHIDRA_CAST((iVar11 + 0x15c8)) = subCharge; - *GHIDRA_CAST((iVar11 + 0x15cc)) = rechargeCooldown; - *GHIDRA_CAST((iVar11 + 0x15d0)) = subCharge; - *GHIDRA_CAST((iVar11 + 0x15d4)) = rechargeCooldown; - *GHIDRA_CAST((iVar11 + 0x15d8)) = partialCharge; - *GHIDRA_CAST((iVar11 + 0x15dc)) = varData; - active_used_post(this,2,(uint8_t)local_68,local_74); - ExceptionList = local_1c; - return; - } - pvVar12 = this->_backupPlayer; - if (pvVar12 != (void *)0x0) { - iVar11 = this->_activeDesc[2]._unk; - iVar9 = this->_activeDesc[2]._charge; - subCharge = this->_activeDesc[2]._batteryCharge; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15c0)) = this->_activeDesc[2]._item; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15c4)) = iVar11; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15c8)) = iVar9; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15cc)) = subCharge; - iVar11 = this->_activeDesc[2]._timeRechargeCooldown; - iVar9 = this->_activeDesc[2]._partialCharge; - subCharge = this->_activeDesc[2]._varData; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15d0)) = this->_activeDesc[2]._subCharge; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15d4)) = iVar11; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15d8)) = iVar9; - *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x15dc)) = subCharge; - active_used_post(this,2,(uint8_t)local_68,local_74); - ExceptionList = local_1c; - return; - } - } - goto LAB_007ad261; - } - if (*GHIDRA_CAST((GHIDRA_CAST((local_6c + 0x567)) + GHIDRA_INT(this))) == 0) { - iVar11 = 0; - local_5c = g_game; - playerSlot = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0x80)))); -LAB_007aca80: - if (*playerSlot != 0) goto code_r0x007aca85; - local_68 = operator_new(0x2f00); - local_14 = 0.0; - if (local_68 == GHIDRA_CAST(0x0)) { - uVar13 = 0; - } - else { - constructor(local_68); - uVar13 = extraout_EAX; - } - local_14 = -NAN; - *GHIDRA_CAST((GHIDRA_CAST((&local_5c->_seedEffects + -1)) + iVar11 * 4)) = uVar13; - if (-1 < iVar11) { - otherPlayer = *GHIDRA_CAST((GHIDRA_CAST((&g_game->_seedEffects + -1)) + iVar11 * 4)); - *GHIDRA_CAST((GHIDRA_CAST((local_6c + 0x567)) + GHIDRA_INT(this))) = iVar11 + 1; - local_64 = otherPlayer; - otherPlayer->Init(this->_type,this->_variant,0,this->_initSeed); - (otherPlayer->_pos).x = (this->_pos).x; - (otherPlayer->_pos).y = (this->_pos).y; - (otherPlayer->_velocity).x = (this->_velocity).x; - (otherPlayer->_velocity).y = (this->_velocity).y; - (GHIDRA_CAST((&otherPlayer->_temporaryeffects)))->TemporaryEffects::AddNullEffect(100,1,1); - otherPlayer->_maxHearts = 0; - otherPlayer->_redHearts = 0; - otherPlayer->_eternalHearts = 0; - this->_boneHeartsMask = 0; - otherPlayer->_boneHearts = 0; - otherPlayer->_rottenHearts = 0; - otherPlayer->_soulHearts = 6; - otherPlayer->_blackHearts = -1; - UpdateBlackHeartMask(otherPlayer); - otherPlayer->_edenSpeed = this->_edenSpeed; - otherPlayer->_edenFireDelay = this->_edenFireDelay; - otherPlayer->_edenDamage = this->_edenDamage; - otherPlayer->_edenTearRange = this->_edenTearRange; - otherPlayer->_edenShotSpeed = this->_edenShotSpeed; - otherPlayer->_edenLuck = this->_edenLuck; - otherPlayer->_totalDamageTaken = this->_totalDamageTaken; - SyncConsumables(this,otherPlayer,0xffffffff); - pvVar12 = (this->_collectibleRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x2bf0)); - (otherPlayer->_history)._isLocked = 1; - historyItem = (local_58->_history)._historyItems._begin; - otherPlayer = local_58; - if (historyItem != (local_58->_history)._historyItems._end) { - do { - if (*GHIDRA_CAST((historyItem + 1)) == '\0') { - if (0 < *GHIDRA_CAST((GHIDRA_INT((otherPlayer->_collectibleCounts)._begin) + GHIDRA_INT(historyItem[2]) * 4 - ))) { - itemConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,GHIDRA_INT(historyItem[2])); - otherPlayer = local_58; - if (itemConfig->type != 3) { - bVar7 = CanRerollCollectible(local_58,GHIDRA_INT(historyItem[2]),0); - if ((bVar7 != 0) && (0 < GHIDRA_INT(*historyItem))) { - local_50._colorize[0] = *historyItem; - local_50._colorize[1] = historyItem[1]; - local_50._colorize[3] = historyItem[3]; - local_68 = GHIDRA_CAST(historyItem[6]); - fVar6 = historyItem[4]; - pEStack_7c = GHIDRA_CAST(historyItem[5]); - local_50._colorize[2] = 0.0; - local_60 = GHIDRA_CAST(0x0); - local_50._offset[0] = fVar6; - local_50._offset[1] = (float)pEStack_7c; - local_50._offset[2] = (float)local_68; - do { - if (local_50._colorize[2] != 0.0) goto LAB_007ace88; - uVar8 = *rngSeed; - local_5c = GHIDRA_CAST(&g_game->_itemPool); - if (uVar8 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar8 = *rngSeed; - if (uVar8 == 0) { - srcDescTail = (code *)swi(3); - (*srcDescTail)(); - return; - } - } - uVar8 = uVar8 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x2bf4)) & 0x1f) ^ uVar8; - uVar8 = uVar8 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x2bf8)) & 0x1f) ^ uVar8; - uVar8 = uVar8 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x2bfc)) & 0x1f) ^ uVar8; - *rngSeed = uVar8; - local_50._colorize[2] = - (float)ItemPool::GetCollectible - (GHIDRA_CAST(local_5c),GHIDRA_INT(historyItem[6]),uVar8,6,0,0); - local_60 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_60)) + 0x1)))); - } while (GHIDRA_INT(local_60) < 10); - if (local_50._colorize[2] == 0.0) { - local_50._colorize[2] = 3.50325e-44; - } -LAB_007ace88: - AddCollectible(local_64,GHIDRA_INT(local_50._colorize[2]),0,0,0,0,0); - historyEnd = (local_64->_history)._historyItems._end; - if (historyEnd == (local_64->_history)._historyItems._capacity) { - msvc::vector<28byte>::_Emplace_reallocate(historyEnd,local_50._colorize); - } - else { - *historyEnd = local_50._colorize[0]; - historyEnd[1] = local_50._colorize[1]; - historyEnd[2] = local_50._colorize[2]; - historyEnd[3] = local_50._colorize[3]; - historyEnd[4] = fVar6; - historyEnd[5] = (float)pEStack_7c; - historyEnd[6] = (float)local_68; - ppvVar1 = &(local_64->_history)._historyItems._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x1c); - } - } - otherPlayer = local_58; - } - } - } - historyItem = historyItem + 7; - } while (historyItem != (otherPlayer->_history)._historyItems._end); - } - (local_64->_history)._isLocked = 0; - this = local_58; - goto LAB_007acefb; - } - goto LAB_007acacf; - } -LAB_007acefb: - local_68 = *GHIDRA_CAST((GHIDRA_CAST((local_6c + 0x567)) + GHIDRA_INT(this))); - if (0 < GHIDRA_INT(local_68)) { - otherPlayer = (Entity_Player *) - (g_game->_seedEffects)._stageSeeds[GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_68[-1])) + 0x2ee2))))]; - local_58 = otherPlayer; - if (otherPlayer != GHIDRA_CAST(0x0)) { - otherPlayer->_isControlsEnabled = 0; - local_64 = GHIDRA_CAST(this->_darkEsau); - if (local_64 != GHIDRA_CAST(0x0)) { - local_5c = GHIDRA_CAST(&this->_darkEsau); - msvc::multiset::erase(&local_5c); - this->_darkEsau = 0; - } - local_6c = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetNullEffect(0x6d); - if (local_6c == GHIDRA_CAST(0x0)) { - pvVar12 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar12) & 0xfffffffcU)) < - 0x1b5) { - local_88 = 0.0; - } - else { - local_88 = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1b4)); - } - pEStack_80 = *GHIDRA_CAST((GHIDRA_CAST(local_88) + 0x78)); - fStack_84 = 0.0; - pEStack_7c = GHIDRA_CAST(0x0); - } - else { - local_88 = *local_6c; - fStack_84 = local_6c[1]; - pEStack_80 = GHIDRA_CAST(local_6c[2]); - pEStack_7c = GHIDRA_CAST(local_6c[3]); - } - this_00 = &g_game->_playerManager; - otherPlayer->_totalDamageTaken = this->_totalDamageTaken; - local_50._colorize[3] = local_88; - local_50._offset[0] = fStack_84; - local_50._offset[1] = (float)pEStack_80; - local_50._offset[2] = (float)pEStack_7c; - PlayerManager::replace_player(this_00,this,otherPlayer); - manager = g_manager; - local_60 = GHIDRA_CAST(0x418); - (g_game->_seedEffects)._stageSeeds[GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_68[-1])) + 0x2ee2))))] = GHIDRA_INT(this); - seed_fart_sound_override(GHIDRA_CAST(&local_60)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_60),1.0,2,0,1.0,0.0); - otherPlayer = local_58; - if (local_58->_playerType != this->_playerType) { - ChangePlayerType(local_58,this->_playerType,1); - } - if (local_64 != GHIDRA_CAST(0x0)) { - if (otherPlayer->_darkEsau != 0) { - local_5c = GHIDRA_CAST(&otherPlayer->_darkEsau); - msvc::multiset::erase(&local_5c); - } - otherPlayer->_darkEsau = local_64; - msvc::multiset::insert(&otherPlayer->_darkEsau); - } - (GHIDRA_CAST((&otherPlayer->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x6d,-1); - if (local_6c != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((&otherPlayer->_temporaryeffects)))->TemporaryEffects::AddEffect(local_50._colorize + 3,1,1); - } - pvVar12 = (this->_history)._historyItems._begin; - isCacheDirty = '\0'; - isItemMoved = '\0'; - if (pvVar12 != (this->_history)._historyItems._end) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 4)) == '\0') { - local_68 = (Entity_Player *) - ItemConfig::GetCollectible - (&g_manager->_itemConfig,*GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 8))); - if (((local_68 == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(local_68) == 3)) || - ((*GHIDRA_CAST(&(local_68->_sprite)._overlayRenderFirst) & 0x8000) == 0)) { - isCacheDirty = isItemMoved; - goto LAB_007ad16e; - } - *(uint32_t *) - (GHIDRA_INT((local_58->_collectibleCounts)._begin) + *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 8)) * 4) = - *(uint32_t *) - (GHIDRA_INT((this->_collectibleCounts)._begin) + *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 8)) * 4); - *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 8)) * 4)) - = 0; - (GHIDRA_CAST((&local_58->_history)))->History::AddHistoryItem(pvVar12); - puVar10 = GHIDRA_CAST(std)::vector::erase(&pEStack_7c,pvVar12); - pvVar12 = (void *)*puVar10; - local_58->_cacheFlags = - local_58->_cacheFlags | *GHIDRA_CAST(((local_68->_sprite)._filename._buf + 0xc)); - isCacheDirty = '\x01'; - isItemMoved = '\x01'; - } - else { -LAB_007ad16e: - pvVar12 = (void *)(GHIDRA_INT(pvVar12) + 0x1c); - } - } while (pvVar12 != (this->_history)._historyItems._end); - if (isCacheDirty != '\0') { - (local_58->_temporaryeffects)._shouldEvaluateCache = 1; - } - } - otherPlayer = local_58; - uVar8 = Random(); - effect = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8); - effect->Update(); - uVar8 = *GHIDRA_CAST((GHIDRA_INT((&(otherPlayer->_sprite)._filename + -3)) + descOffset)); - if ((uVar8 != *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + descOffset))) && (uVar8 != 0)) - { - RemoveCollectible(otherPlayer,uVar8,1,0,1); - } - puVar10 = GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + descOffset)); - uVar13 = puVar10[1]; - uVar16 = puVar10[2]; - uVar3 = puVar10[3]; - dstDescHead = GHIDRA_CAST((GHIDRA_INT((&(otherPlayer->_sprite)._filename + -3)) + descOffset)); - *dstDescHead = *puVar10; - dstDescHead[1] = uVar13; - dstDescHead[2] = uVar16; - dstDescHead[3] = uVar3; - srcDescTail = (this->_sprite)._filename._buf + descOffset + -0x38; - uVar13 = *GHIDRA_CAST((srcDescTail + 4)); - uVar16 = *GHIDRA_CAST((srcDescTail + 8)); - uVar3 = *GHIDRA_CAST((srcDescTail + 0xc)); - dstDescTail = (otherPlayer->_sprite)._filename._buf + descOffset + -0x38; - *GHIDRA_CAST(dstDescTail) = *GHIDRA_CAST(srcDescTail); - *GHIDRA_CAST((dstDescTail + 4)) = uVar13; - *GHIDRA_CAST((dstDescTail + 8)) = uVar16; - *GHIDRA_CAST((dstDescTail + 0xc)) = uVar3; - AnimateCollectible(otherPlayer,0x2bf,GHIDRA_CAST("UseItem"),GHIDRA_CAST("PlayerPickupSparkle")); - SyncConsumables(this,otherPlayer,0xffffffff); - otherPlayer->_isControlsEnabled = 1; - otherPlayer->_controlsCooldown = 1; - bVar7 = HasCollectible(this,0x248,0); - if ((bVar7 != 0) || (bVar7 = HasCollectible(otherPlayer,0x248,0), bVar7 != 0)) { - AddWisp(otherPlayer,0x2bf,&this->_pos,0,0); - } - TriggerNewRoom_TemporaryEffects(otherPlayer); - } - } -LAB_007ad261: - uVar8 = activeSlot; - active_used_post(this,activeSlot,unk,local_74); - if (uVar8 == 3) { - SetPocketActiveItem(this,0,3,0); - } - ExceptionList = local_1c; - return; -code_r0x007aca85: - iVar11 = iVar11 + 1; - playerSlot = playerSlot + 1; - if (3 < iVar11) goto LAB_007acacf; - goto LAB_007aca80; -LAB_007acacf: - manager = g_manager; - local_60 = GHIDRA_CAST(0x35); - seed_fart_sound_override(GHIDRA_CAST(&local_60)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_60),1.0,2,0,1.0,0.0); - uVar8 = Random(); - position = &this->_pos; - effect = Game::Spawn(g_game,1000,0x61,position,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8); - effect->Update(); - local_5c = GHIDRA_CAST((local_58->_posOffset).y); - (GHIDRA_CAST((&local_50)))->Color::Color(); - uVar8 = Random(); - Game::SpawnParticles - (g_game,position,0x23,8, - (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0,color,(float)local_5c,0); - uVar8 = Random(); - effect = Game::Spawn(g_game,1000,2,position,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar8); - effect->Update(); - this = local_58; - (GHIDRA_CAST((&local_58->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x83,1,1); - EvaluateItems(this); - AnimateCollectible(this,0x2bf,GHIDRA_CAST("UseItem"),GHIDRA_CAST("PlayerPickupSparkle")); - if (unk == 0) { - RemoveCollectible(this,*GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + descOffset)),0, - activeSlot,1); - ExceptionList = local_1c; - return; - } - goto LAB_007acefb; -} - -// 007ad3a0 -void Entity_Player::TryRemoveTrinketCostume(int trinketId) -{ - ItemConfig_Item *Item; - uint8_t isHasTrinketEffect; - void *trinkets; - - trinkets = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT((trinketId & 0x7fffU)) < - GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinkets) >> 2) && - (Item = *GHIDRA_CAST((GHIDRA_CAST(trinkets) + (trinketId & 0x7fffU) * 4)), - Item != GHIDRA_CAST(0x0))) { - if ((Item->addCostumeOnPickup == 0) && - (isHasTrinketEffect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasTrinketEffect(trinketId), - isHasTrinketEffect != 0)) { - return; - } - RemoveCostume(this,Item); - } - return; -} - -// 007ad400 -void Entity_Player::TryRemoveNullCostume(int param_1) -{ - Entity_Player *in_ECX; - void *nullItems; - - if ((param_1 < 0) || - (nullItems = (g_manager->_itemConfig)._nullItems._begin, - GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItems) >> 2 <= param_1)) { - RemoveCostume(in_ECX,GHIDRA_CAST(0x0)); - return; - } - RemoveCostume(in_ECX,*GHIDRA_CAST((GHIDRA_CAST(nullItems) + param_1 * 4))); - return; -} - -// 007ad440 -uint32_t Entity_Player::GetMaxPocketItems() -{ - uint8_t isHasItem; - uint32_t result; - uint32_t count; - - count = 1; - isHasItem = HasCollectible(this,0xfb,0); - if (isHasItem == 0) { - isHasItem = HasCollectible(this,0xfc,0); - if (isHasItem == 0) { - isHasItem = HasCollectible(this,0x1c6,0); - if (isHasItem == 0) goto LAB_007ad488; - } - } - count = 2; -LAB_007ad488: - if ((this->_pocketSlots[1] == 2) && (0 < this->_pocketSlots[0])) { - count = count + 1; - } - if ((this->_pocketSlots[3] == 2) && (0 < this->_pocketSlots[2])) { - count = count + 1; - } - if ((this->_pocketSlots[5] == 2) && (0 < this->_pocketSlots[4])) { - count = count + 1; - } - if ((this->_pocketSlots[7] != 2) || (result = count + 1, this->_pocketSlots[6] < 1)) { - result = count; - } - return result; -} - -// 007ad4e0 -void Entity_Player::stop_costume_item_anims() -{ - PlayerCostumeMap *costumeMapEntry; - int batchesLeft; - - if (this->_isCoopGhost == 0) { - costumeMapEntry = this->_playerCostumeMap + 1; - batchesLeft = 3; - do { - if (-1 < costumeMapEntry[-1]._index) { - *(uint8_t *) - (costumeMapEntry[-1]._index * 0x130 + 0x11c + GHIDRA_INT((this->_costumeSpriteDescs)._begin)) = 0; - } - if (-1 < costumeMapEntry->_index) { - *(uint8_t *) - (costumeMapEntry->_index * 0x130 + 0x11c + GHIDRA_INT((this->_costumeSpriteDescs)._begin)) = 0; - } - if (-1 < costumeMapEntry[1]._index) { - *(uint8_t *) - (costumeMapEntry[1]._index * 0x130 + 0x11c + GHIDRA_INT((this->_costumeSpriteDescs)._begin)) = 0; - } - if (-1 < costumeMapEntry[2]._index) { - *(uint8_t *) - (costumeMapEntry[2]._index * 0x130 + 0x11c + GHIDRA_INT((this->_costumeSpriteDescs)._begin)) = 0; - } - if (-1 < costumeMapEntry[3]._index) { - *(uint8_t *) - (costumeMapEntry[3]._index * 0x130 + 0x11c + GHIDRA_INT((this->_costumeSpriteDescs)._begin)) = 0; - } - costumeMapEntry = costumeMapEntry + 5; - batchesLeft = batchesLeft + -1; - } while (batchesLeft != 0); - } - return; -} - -// 007ad5a0 -void Entity_Player::ClearCollectibleAnim(int collectible) -{ - ItemConfig_Item *item; - PlayerCostumeMap *costumeEntry; - int remaining; - void *costumeDescs; - int costumeIndex; - - if (this->_isCoopGhost == 0) { - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,collectible); - costumeEntry = this->_playerCostumeMap; - remaining = 0xf; - do { - costumeIndex = costumeEntry->_index; - if ((-1 < costumeIndex) && - (costumeDescs = (this->_costumeSpriteDescs)._begin, - *GHIDRA_CAST((GHIDRA_CAST(costumeDescs) + costumeIndex * 0x130 + 0x114)) == item)) { - *GHIDRA_CAST((GHIDRA_CAST(costumeDescs) + costumeIndex * 0x130 + 0x11c)) = 0; - } - costumeEntry = costumeEntry + 1; - remaining = remaining + -1; - } while (remaining != 0); - } - return; -} - -// 007ad680 -uint8_t Entity_Player::IsCollectibleAnimFinished(int collectible, std_string *animName) -{ - uint8_t isAnimFinished; - ItemConfig_Item *item; - std_string *animName_00; - PlayerCostumeMap *costumeMapEntry; - ANM2 *costumeSprite; - uint32_t costumeLayer; - void *animData; - - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,collectible); - costumeLayer = 0; - isAnimFinished = 1; - costumeMapEntry = this->_playerCostumeMap; - do { - if (((-1 < costumeMapEntry->_index) && - (costumeSprite = - GHIDRA_CAST((costumeMapEntry->_index * 0x130 + GHIDRA_INT((this->_costumeSpriteDescs)._begin))), - costumeSprite[1]._filename._buf[8] != '\0')) && - (*GHIDRA_CAST(costumeSprite[1]._filename._buf) == item)) { - animName_00 = animName; - if (0xf < animName->_capacity) { - animName_00 = *GHIDRA_CAST(animName->_buf); - } - isAnimFinished = ANM2::IsFinishedImpl(costumeSprite,GHIDRA_CAST(animName_00)); - if ((isAnimFinished != 0) && - ((animData = (costumeSprite->_animState)._animData, animData == (void *)0x0 || - (*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x34)) == '\0')))) { - return 1; - } - isAnimFinished = 0; - } - costumeLayer = costumeLayer + 1; - costumeMapEntry = costumeMapEntry + 1; - if (0xe < costumeLayer) { - return isAnimFinished; - } - } while( true ); -} - -// 007ad860 -void Entity_Player::TriggerTrinketAdded(uint32_t trinketID, uint8_t firstTimePickingUp) -{ - uint8_t isMomsBox; - uint32_t uVar1; - int iVar2; - uint32_t goldenFlag; - int *bibleUpgrade; - Game *game; - void *trinketsBegin; - - game = g_game; - if (this->_variant != 0) { - return; - } - goldenFlag = trinketID & 0x8000; - uVar1 = trinketID & 0x7fff; - switch(uVar1) { - case 7: - bibleUpgrade = &(g_game->_itemPool)._pools[6]._bibleUpgrade; - *bibleUpgrade = *bibleUpgrade + 5; - bibleUpgrade = &(game->_itemPool)._pools[1]._bibleUpgrade; - *bibleUpgrade = *bibleUpgrade + 5; - break; - case 0x30: - IncrementPlayerFormCounter(this,0xf,1); - break; - case 0x47: - IncrementPlayerFormCounter(this,4,1); - break; - case 0x6d: - iVar2 = GetTrinketMultiplier(this,0x6d); - if ((1 < iVar2) && (this->_ductTapeMode == 0)) { - this->_ductTapeMode = 1; - } - break; - case 0x79: - FUN_007db0a0(); - if ((goldenFlag != 0) || (isMomsBox = HasCollectible(this,0x1b7,0), isMomsBox != 0)) { - FUN_007db0a0(); - } - break; - case 0x84: - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - add_random_drug_item_effect(); - } - break; - case 0x92: - Level::update_treasure_room_doors_for_trinket(); - break; - case 0x99: - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - AddRandomMomItemEffect(); - } - break; - case 0x9c: - update_greeds_gullet(this); - if (firstTimePickingUp == 0) goto LAB_007ad9f7; - AddHearts(this,GHIDRA_UINT((goldenFlag != 0)) * 2 + 2,0,0); - goto LAB_007ad9e6; - case 0xa6: - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - ModelingClay_roll(this,GHIDRA_CAST((GHIDRA_INT((this->_trinketRNGs)._begin) + 0xa60))); - } - break; - case 0xa9: - IncrementPlayerFormCounter(this,0,(goldenFlag != 0) + 1); - break; - case 0xb0: - spawn_lil_clot_familiars(this); - break; - case 0xb7: - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - twins_duplicate_familiars(this,1); - } - } - if (firstTimePickingUp != 0) { -LAB_007ad9e6: - if (trinketID == 0x9f) { - AddKeys(this,1); - } - } -LAB_007ad9f7: - trinketsBegin = (g_manager->_itemConfig)._trinkets._begin; - if (((GHIDRA_INT(uVar1) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinketsBegin) >> 2) && - (iVar2 = *GHIDRA_CAST((GHIDRA_CAST(trinketsBegin) + uVar1 * 4)), iVar2 != 0)) && - (uVar1 = *GHIDRA_CAST((iVar2 + 0x54)), uVar1 != 0)) { - this->_cacheFlags = this->_cacheFlags | uVar1; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - return; -} - -// 007adb30 -void Entity_Player::TriggerTrinketRemoved(uint32_t trinketID) -{ - uint8_t isHeld; - ItemConfig_Item *item; - int iVar1; - uint32_t uVar2; - uint32_t i; - ItemConfig_Item *effectItem; - uint32_t local_14; - int effectCooldown; - uint32_t local_c; - int *bibleUpgrade; - Game *game; - int playerForm; - void *trinkets; - - game = g_game; - if (this->_variant != 0) { - return; - } - uVar2 = trinketID & 0x7fff; - switch(uVar2) { - case 7: - bibleUpgrade = &(g_game->_itemPool)._pools[6]._bibleUpgrade; - *bibleUpgrade = *bibleUpgrade + -5; - bibleUpgrade = &(game->_itemPool)._pools[1]._bibleUpgrade; - *bibleUpgrade = *bibleUpgrade + -5; - break; - case 0x30: - iVar1 = -1; - playerForm = 0xf; - goto LAB_007adda7; - case 0x47: - iVar1 = -1; - playerForm = 4; - goto LAB_007adda7; - case 0x79: - isHeld = HasTrinket(this,0x79,0); - if (isHeld == 0) { - remove_wooden_cross_mantles(this); - isHeld = HasCollectible(this,0x1b7,0); - if (isHeld != 0) { - remove_wooden_cross_mantles(this); - } - } - break; - case 0x84: - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && - (isHeld = HasTrinket(this,trinketID,0), isHeld == 0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2edc)))) != 0)) - { - TemporaryEffects::RemoveCollectibleEffect - (&this->_temporaryeffects,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2edc)))),1); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2edc)))) = 0; - } - break; - case 0x92: - Level::update_treasure_room_doors_for_trinket(); - break; - case 0x99: - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && - (isHeld = HasTrinket(this,trinketID,0), isHeld == 0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee0)))) != 0)) - { - TemporaryEffects::RemoveCollectibleEffect - (&this->_temporaryeffects,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee0)))),1); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee0)))) = 0; - } - break; - case 0x9c: - update_greeds_gullet(this); - break; - case 0xa6: - isHeld = HasTrinket(this,trinketID,0); - if (isHeld == 0) { - iVar1 = this->_modelingClayEffect; - this->_modelingClayEffect = 0; - if (iVar1 != 0) { - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar1); - if (item != GHIDRA_CAST(0x0)) { - this->_cacheFlags = this->_cacheFlags | item->cacheFlags; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - TryRemoveCollectibleCostume(this,iVar1,0); - } - } - break; - case 0xa9: - iVar1 = -1 - GHIDRA_UINT(((trinketID & 0x8000) != 0)); - playerForm = 0; -LAB_007adda7: - IncrementPlayerFormCounter(this,playerForm,iVar1); - break; - case 0xb7: - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && - (isHeld = HasTrinket(this,trinketID,0), isHeld == 0)) { - i = 0; - iVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee4)))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee8)))) - iVar1 >> 2 != 0) { - do { - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,*GHIDRA_CAST((iVar1 + i * 4))); - if (item != GHIDRA_CAST(0x0)) { - effectCooldown = item->maxCooldown; - local_14 = 0; - local_c = 0; - effectItem = item; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(&effectItem,1); - } - i = i + 1; - iVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee4)))); - } while (i < GHIDRA_UINT((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee8)))) - iVar1 >> 2))); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee8)))) = iVar1; - } - } - trinkets = (g_manager->_itemConfig)._trinkets._begin; - if (((GHIDRA_INT(uVar2) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinkets) >> 2) && - (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(trinkets) + uVar2 * 4)), iVar1 != 0)) && - (uVar2 = *GHIDRA_CAST((iVar1 + 0x54)), uVar2 != 0)) { - this->_cacheFlags = this->_cacheFlags | uVar2; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - return; -} - -// 007ae4b0 -void Entity_Player::RestoreGameState(GameStatePlayer *saveState) -{ - uint32_t friendBallHealth; - uint32_t uVar2; - uint32_t uVar3; - int iVar4; - EntityConfig_Player *pEVar5; - char cVar6; - uint32_t uVar7; - uint32_t *puVar8; - Entity_Player *mainPlayer; - void *pvVar9; - int iVar10; - void *extraout_ECX; - uint32_t uVar11; - int iVar12; - int *playerFormDst; - Entity_Player *player; - uint32_t *movingBoxEntry; - int *playerFormSrc; - short *psVar13; - Entity_Player *self; - uint8_t *pbVar14; - int *trinketDst; - GameStatePlayer *pGVar15; - uint8_t local_60 [4]; - int *local_5c; - GameStatePlayer *local_58; - Game *local_54; - Entity_Player *selfSaved; - uint32_t *local_4c; - int *local_48; - EntityConfig_Player *local_44; - Game *local_40; - void *local_3c [3]; - void *local_30; - int *local_2c; - int *local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - void *local_14; - uint64_t friendBallHealth; - Game *game; - Manager *manager; - void *smeltedCounts; - - puStack_20 = GHIDRA_CAST((local_3c + 0xe)); - local_14 = (void *)0xffffffff; - puStack_18 = &LAB_00affbfd; - local_1c = ExceptionList; - uVar7 = __security_cookie ^ GHIDRA_UINT((local_3c + 0xb)); - local_58 = saveState; - if (this->_replacedPlayer != (void *)0x0) { - return; - } - ExceptionList = &local_1c; - selfSaved = this; - local_24 = uVar7; - SetControllerIndex(this,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(saveState[0x1b6])) + 0x2)))),1); - iVar10 = this->_playerType; - if ((GHIDRA_INT((g_manager->_entityConfig)._players._end) - - GHIDRA_INT((g_manager->_entityConfig)._players._begin)) / 0x148 <= iVar10) { - this->_playerType = 0; - iVar10 = 0; - } - if (g_game->_isRestoringGlowingHourglassState != 0) { - if (iVar10 != *GHIDRA_CAST(saveState)) { - RemoveSkinCostume(this); - stop_costume_item_anims(this); - this->_playerType = *GHIDRA_CAST(saveState); - update_player_skin(this); - this->ResetColor(uVar7); - } - if (((g_game->_isRestoringGlowingHourglassState != 0) && (this->_isCoopGhost != 0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(&(saveState[0x1da])) + 0x2))) == '\0')) { - RevivePlayerGhost(this); - } - } - if ((this->_playerType < 0) || - (pvVar9 = (void *)this->_playerType, - (GHIDRA_INT((g_manager->_entityConfig)._players._end) - - GHIDRA_INT((g_manager->_entityConfig)._players._begin)) / 0x148 <= GHIDRA_INT(pvVar9))) { - local_44 = GHIDRA_CAST(0x0); - } - else { - local_44 = (EntityConfig_Player *) - (GHIDRA_INT(pvVar9) * 0x148 + GHIDRA_INT((g_manager->_entityConfig)._players._begin)); - if (local_44 != GHIDRA_CAST(0x0)) goto LAB_007ae611; - } - KAGE_LogMessage(0x10,GHIDRA_CAST("Could not load config for player type %d\n")); - pvVar9 = extraout_ECX; -LAB_007ae611: - local_44 = (EntityConfig_Player *) - EntityConfig_Player::GetDisplayName(local_44,GHIDRA_CAST(local_3c),pvVar9); - if (GHIDRA_CAST(&this->_name) != local_44) { - (GHIDRA_CAST(((this->_name)._buf)))->msvc::string::_Tidy_deallocate(); - friendBallHealth = *GHIDRA_CAST((GHIDRA_INT(&local_44->_id) + 4)); - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&local_44->_id) + 8)); - uVar3 = *GHIDRA_CAST((GHIDRA_INT(&local_44->_id) + 0xc)); - *GHIDRA_CAST((this->_name)._buf) = local_44->_id; - *GHIDRA_CAST(((this->_name)._buf + 4)) = friendBallHealth; - *GHIDRA_CAST(((this->_name)._buf + 8)) = uVar2; - *GHIDRA_CAST(((this->_name)._buf + 0xc)) = uVar3; - *GHIDRA_CAST(&(this->_name)._size) = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x10)); - *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x10)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x14)) = 0xf; - *GHIDRA_CAST(&local_44->_id) = '\0'; - } - if (0xf < local_28) { - uVar7 = GHIDRA_INT(local_28) + 1; - pvVar9 = local_3c[0]; - if (0xfff < uVar7) { - pvVar9 = *(void **)(GHIDRA_INT(local_3c[0]) + -4); - uVar7 = GHIDRA_INT(local_28) + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_3c[0]) + (-4 - GHIDRA_INT(pvVar9))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar9,uVar7); - } - pGVar15 = local_58; - local_2c = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST(0xf); - local_3c[0] = (void *)(GHIDRA_UINT(local_3c[0]) & 0xffffff00); - uVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(saveState[0x79])) + 0x1)))) - *GHIDRA_CAST((saveState + 0x78)) >> 2; - uVar7 = GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2; - if (uVar11 < uVar7) { - uVar7 = uVar11; - } - local_44 = GHIDRA_CAST(0x0); - if (uVar7 != 0) { - do { - *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + GHIDRA_INT(local_44) * 4)) = - *GHIDRA_CAST((*GHIDRA_CAST((saveState + 0x78)) + GHIDRA_INT(local_44) * 4)); - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 1)); - } while (local_44 < uVar7); - } - playerFormSrc = this->_trinketsID; - *playerFormSrc = *GHIDRA_CAST((saveState + 0x84)); - local_44 = GHIDRA_CAST(0x0); - this->_trinketsID[1] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(saveState[0x85])) + 0x1)))); - do { - if (GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - - GHIDRA_INT((g_manager->_itemConfig)._trinkets._begin) >> 2 <= GHIDRA_INT((*playerFormSrc & 0x7fffU))) { - if (local_44 == GHIDRA_CAST(0x0)) { - trinketDst = playerFormSrc; - playerFormDst = playerFormSrc; - for (iVar10 = 1; playerFormDst = playerFormDst + 1, iVar10 != 0; iVar10 = iVar10 + -1) { - *trinketDst = *playerFormDst; - trinketDst = trinketDst + 1; - } - this = selfSaved; - } - this->_trinketsID[1] = 0; - } - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 1)); - playerFormSrc = playerFormSrc + 1; - } while (local_44 < 2); - local_40 = GHIDRA_CAST(&this->_voidedCollectibles); - (this->_voidedCollectibles)._end = (GHIDRA_CAST(local_40))->_begin; - local_44 = (EntityConfig_Player *) - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x7d])) + 0x1)))) - *GHIDRA_CAST((local_58 + 0x7c)) >> 2); - if (GHIDRA_UINT((GHIDRA_INT((this->_voidedCollectibles)._capacity) - GHIDRA_INT((GHIDRA_CAST(local_40))->_begin) >> 2 - )) < local_44) { - if (0x3fffffff < local_44) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - msvc::vector::_Reallocate(local_44); - } - game = local_40; - iVar10 = *GHIDRA_CAST((pGVar15 + 0x7c)); - local_44 = GHIDRA_CAST(0x0); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x7d])) + 0x1)))) - iVar10 >> 2 != 0) { - do { - local_40 = GHIDRA_CAST((iVar10 + GHIDRA_INT(local_44) * 4)); - if (local_40->_stage < - GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2) { - playerFormSrc = GHIDRA_CAST(game->_stageType); - if (playerFormSrc == *GHIDRA_CAST(&game->_bossChallenge)) { - msvc::vector::_Emplace_reallocate(playerFormSrc,local_40); - } - else { - *playerFormSrc = local_40->_stage; - game->_stageType = GHIDRA_INT((GHIDRA_INT(game->_stageType) + 4)); - } - } - iVar10 = *GHIDRA_CAST((pGVar15 + 0x7c)); - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 1)); - } while (local_44 < GHIDRA_UINT((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x7d])) + 0x1)))) - iVar10 >> 2))); - this = selfSaved; - } - pvVar9 = (this->_voidedPassives)._begin; - local_40 = GHIDRA_CAST(&this->_voidedPassives); - (this->_voidedPassives)._end = pvVar9; - local_44 = (EntityConfig_Player *) - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x81])) + 0x1)))) - *GHIDRA_CAST((pGVar15 + 0x80)) >> 3); - if (GHIDRA_UINT((GHIDRA_INT((this->_voidedPassives)._capacity) - GHIDRA_INT(pvVar9) >> 3)) < local_44) { - if (0x1fffffff < local_44) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - msvc::vector<8byte>::_Reallocate_exactly(local_44); - } - game = local_40; - local_54 = *GHIDRA_CAST((pGVar15 + 0x80)); - local_48 = GHIDRA_CAST(0x0); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x81])) + 0x1)))) - GHIDRA_INT(local_54) >> 3 != 0) { - do { - pGVar15 = local_58; - playerFormSrc = GHIDRA_CAST((GHIDRA_INT(local_54) + GHIDRA_INT(local_48) * 8)); - if (*playerFormSrc < - GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2) { - playerFormDst = GHIDRA_CAST(game->_stageType); - if (playerFormDst == *GHIDRA_CAST(&game->_bossChallenge)) { - msvc::vector<8byte>::_Emplace_reallocate(playerFormDst,playerFormSrc); - } - else { - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(local_54) + 4 + GHIDRA_INT(local_48) * 8)); - *playerFormDst = *playerFormSrc; - playerFormDst[1] = iVar10; - game->_stageType = GHIDRA_INT((GHIDRA_INT(game->_stageType) + 8)); - } - } - local_54 = *GHIDRA_CAST((pGVar15 + 0x80)); - local_48 = GHIDRA_CAST((GHIDRA_INT(local_48) + 1)); - } while (local_48 < GHIDRA_UINT((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x81])) + 0x1)))) - GHIDRA_INT(local_54) >> 3))); - this = selfSaved; - } - local_40 = GHIDRA_CAST(&this->_movingBoxContents); - msvc::vector::resize - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0xa1])) + 0x1)))) - *GHIDRA_CAST((pGVar15 + 0xa0))) / 0x78); - local_54 = *GHIDRA_CAST((pGVar15 + 0xa0)); - local_48 = GHIDRA_CAST(0x0); - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0xa1])) + 0x1)))) - GHIDRA_INT(local_54); - iVar10 = iVar12 >> 0x1f; - if (iVar12 / 0x78 + iVar10 != iVar10) { - local_44 = GHIDRA_CAST(0x0); - do { - movingBoxEntry = GHIDRA_CAST((GHIDRA_INT(local_40->_stage) + GHIDRA_INT(local_44))); - *movingBoxEntry = *GHIDRA_CAST((GHIDRA_CAST(local_44) + GHIDRA_INT(local_54))); - movingBoxEntry[1] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 4U + GHIDRA_INT(local_54))); - movingBoxEntry[2] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 8U + GHIDRA_INT(local_54))); - movingBoxEntry[3] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0xcU + GHIDRA_INT(local_54))); - movingBoxEntry[4] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x10U + GHIDRA_INT(local_54))); - movingBoxEntry[5] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x14U + GHIDRA_INT(local_54))); - movingBoxEntry[6] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x18U + GHIDRA_INT(local_54))); - *GHIDRA_CAST((GHIDRA_CAST(movingBoxEntry) + 0x22)) = - *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x22U + GHIDRA_INT(local_54))); - movingBoxEntry[9] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x24U + GHIDRA_INT(local_54))); - movingBoxEntry[7] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x1cU + GHIDRA_INT(local_54))); - *GHIDRA_CAST((movingBoxEntry + 8)) = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x20U + GHIDRA_INT(local_54))); - movingBoxEntry[10] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x28U + GHIDRA_INT(local_54))); - movingBoxEntry[0xb] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x2cU + GHIDRA_INT(local_54))); - movingBoxEntry[0xc] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x30U + GHIDRA_INT(local_54))); - movingBoxEntry[0xd] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x34U + GHIDRA_INT(local_54))); - movingBoxEntry[0xe] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x38U + GHIDRA_INT(local_54))); - movingBoxEntry[0xf] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x3cU + GHIDRA_INT(local_54))); - movingBoxEntry[0x10] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x40U + GHIDRA_INT(local_54))); - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x3cU + GHIDRA_INT(local_54))); - movingBoxEntry[0x12] = iVar10; - movingBoxEntry[0x13] = iVar10 >> 0x1f; - *GHIDRA_CAST((GHIDRA_CAST(movingBoxEntry) + 0x23)) = - *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x23U + GHIDRA_INT(local_54))); - movingBoxEntry[0x14] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x50U + GHIDRA_INT(local_54))); - movingBoxEntry[0x15] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x54U + GHIDRA_INT(local_54))); - *GHIDRA_CAST((movingBoxEntry + 0x18)) = - *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x60U + GHIDRA_INT(local_54))); - movingBoxEntry[0x16] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x58U + GHIDRA_INT(local_54))); - movingBoxEntry[0x17] = *GHIDRA_CAST((GHIDRA_CAST(local_44) + 0x5cU + GHIDRA_INT(local_54))); - local_4c = movingBoxEntry; - puVar8 = GHIDRA_CAST(FUN_004d7250(GHIDRA_INT(local_54) + 100 + GHIDRA_INT(local_44))); - pGVar15 = local_58; - friendBallHealth = puVar8[1]; - puVar8[1] = movingBoxEntry[0x1a]; - movingBoxEntry[0x1a] = friendBallHealth; - friendBallHealth = *puVar8; - *puVar8 = movingBoxEntry[0x19]; - movingBoxEntry[0x19] = friendBallHealth; - local_14 = (void *)0x0; - if (((local_5c != GHIDRA_CAST(0x0)) && (cVar6 = (**(code **)(*local_5c + 0xc))(), cVar6 != '\0')) && - (g_entitySaveStateExtraDataReleaseFn != (void *)0x0)) { - (*g_entitySaveStateExtraDataReleaseFn)(local_60); - } - pEVar5 = local_44; - local_14 = (void *)0xffffffff; - (GHIDRA_CAST((local_4c + 0x1b)))->SharedPtr::assign((void *)(GHIDRA_INT(local_54) + 0x6c + GHIDRA_INT(local_44))); - local_54 = *GHIDRA_CAST((pGVar15 + 0xa0)); - local_44 = GHIDRA_CAST((GHIDRA_INT(pEVar5) + 0x78)); - local_48 = GHIDRA_CAST((GHIDRA_INT(local_48) + 1)); - } while (local_48 < GHIDRA_UINT(((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0xa1])) + 0x1)))) - GHIDRA_INT(local_54)) / 0x78))); - this = selfSaved; - } - self = selfSaved; - playerFormDst = this->_playerForms; - iVar10 = 0x10; - playerFormSrc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x61])) + 0x1)))); - do { - iVar12 = *playerFormSrc; - playerFormSrc = playerFormSrc + 1; - *playerFormDst = iVar12; - playerFormDst = playerFormDst + 1; - iVar10 = iVar10 + -1; - } while (iVar10 != 0); - selfSaved->_playerFormsRewarded = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x76])) + 0x2)))); - ClearCostumes(selfSaved); - local_48 = GHIDRA_CAST(0x0); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x9a])) + 0x2)))) != 0) { - do { - local_4c = *GHIDRA_CAST((*GHIDRA_CAST((pGVar15 + 0x9c)) + 4 + GHIDRA_INT(local_48) * 8)); - if ((local_4c < - (uint32_t *) - (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2)) && - (*GHIDRA_CAST((*GHIDRA_CAST((pGVar15 + 0x9c)) + GHIDRA_INT(local_48) * 8)) < 5)) { - /* WARNING: Could not recover jumptable at 0x007aeb80. Too many branches */ - /* WARNING: Treating indirect jump as call */ - (*(code *)(&PTR_DAT_007afc04)[*GHIDRA_CAST((*GHIDRA_CAST((pGVar15 + 0x9c)) + GHIDRA_INT(local_48) * 8))])(); - return; - } - local_48 = GHIDRA_CAST((GHIDRA_INT(local_48) + 1)); - self = selfSaved; - pGVar15 = local_58; - } while (local_48 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x9a])) + 0x2))))); - } - uVar11 = *GHIDRA_CAST((pGVar15 + 0x98)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x96])) + 0x2)))) >> 2; - uVar7 = GHIDRA_INT((self->_pillEffectUses)._end) - GHIDRA_INT((self->_pillEffectUses)._begin) >> 2; - if (uVar11 < uVar7) { - uVar7 = uVar11; - } - local_44 = GHIDRA_CAST(0x0); - if (uVar7 != 0) { - do { - *GHIDRA_CAST((GHIDRA_INT((self->_pillEffectUses)._begin) + GHIDRA_INT(local_44) * 4)) = - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x96])) + 0x2)))) + GHIDRA_INT(local_44) * 4)); - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 1)); - } while (local_44 < uVar7); - } - uVar11 = GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2; - uVar7 = *GHIDRA_CAST((pGVar15 + 0x88)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x86])) + 0x2)))) >> 2; - if (uVar11 < uVar7) { - uVar7 = uVar11; - } - if (uVar7 != 0) { - uVar11 = 0; - local_44 = GHIDRA_CAST(0x0); - do { - puVar8 = GHIDRA_CAST((GHIDRA_INT((self->_collectibleRNGs)._begin) + GHIDRA_INT(local_44))); - iVar10 = uVar11 * 4; - uVar11 = uVar11 + 1; - *puVar8 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x86])) + 0x2)))) + iVar10)); - *GHIDRA_CAST((puVar8 + 1)) = 0x900000005; - puVar8[3] = 7; - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 0x10)); - } while (uVar11 < uVar7); - } - uVar11 = GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - - GHIDRA_INT((g_manager->_itemConfig)._trinkets._begin) >> 2; - uVar7 = *GHIDRA_CAST((pGVar15 + 0x8c)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x8a])) + 0x2)))) >> 2; - if (uVar11 < uVar7) { - uVar7 = uVar11; - } - if (uVar7 != 0) { - uVar11 = 0; - local_44 = GHIDRA_CAST(0x0); - do { - puVar8 = GHIDRA_CAST((GHIDRA_INT((self->_trinketRNGs)._begin) + GHIDRA_INT(local_44))); - iVar10 = uVar11 * 4; - uVar11 = uVar11 + 1; - *puVar8 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x8a])) + 0x2)))) + iVar10)); - *GHIDRA_CAST((puVar8 + 1)) = 0x900000005; - puVar8[3] = 7; - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 0x10)); - } while (uVar11 < uVar7); - } - uVar11 = GHIDRA_INT((g_manager->_itemConfig)._pillEffects._end) - - GHIDRA_INT((g_manager->_itemConfig)._pillEffects._begin) >> 2; - uVar7 = *GHIDRA_CAST((pGVar15 + 0x90)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x8e])) + 0x2)))) >> 2; - if (uVar11 < uVar7) { - uVar7 = uVar11; - } - if (uVar7 != 0) { - uVar11 = 0; - local_44 = GHIDRA_CAST(0x0); - do { - puVar8 = GHIDRA_CAST((GHIDRA_INT((self->_pillRNGs)._begin) + GHIDRA_INT(local_44))); - iVar10 = uVar11 * 4; - uVar11 = uVar11 + 1; - *puVar8 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x8e])) + 0x2)))) + iVar10)); - *GHIDRA_CAST((puVar8 + 1)) = 0x900000005; - puVar8[3] = 7; - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 0x10)); - } while (uVar11 < uVar7); - } - game = GHIDRA_CAST((GHIDRA_INT((g_manager->_itemConfig)._cards._end) - - GHIDRA_INT((g_manager->_itemConfig)._cards._begin) >> 2)); - local_40 = GHIDRA_CAST((*GHIDRA_CAST((pGVar15 + 0x94)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x92])) + 0x2)))) >> 2)); - if (game < local_40) { - local_40 = game; - } - game = GHIDRA_CAST(0x0); - if (local_40 != GHIDRA_CAST(0x0)) { - local_44 = GHIDRA_CAST(0x0); - do { - puVar8 = GHIDRA_CAST((GHIDRA_INT((self->_cardRNGs)._begin) + GHIDRA_INT(local_44))); - iVar10 = GHIDRA_INT(game) * 4; - game = GHIDRA_CAST((GHIDRA_INT(&game->_stage) + 1)); - *puVar8 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x92])) + 0x2)))) + iVar10)); - *GHIDRA_CAST((puVar8 + 1)) = 0x900000005; - puVar8[3] = 7; - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + 0x10)); - } while (game < local_40); - } - self->_goldenHearts = 0; - self->_eternalHearts = 0; - self->_boneHearts = 0; - self->_blackHearts = 0; - self->_soulHearts = 0; - self->_maxHearts = 0; - self->_redHearts = 0; - self->_brokenHearts = 0; - self->_rottenHearts = 0; - AddMaxHearts(self,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[2])) + 0x2)))),1); - self->_blackHearts = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[5])) + 0x1)))); - AddSoulHearts(self,*GHIDRA_CAST((pGVar15 + 4)),0); - self->_eternalHearts = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[6])) + 0x2)))); - self->_boneHearts = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x126])) + 0x2)))); - self->_boneHeartsMask = *GHIDRA_CAST((pGVar15 + 0x128)); - AddHearts(self,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[1])) + 0x1)))),1,0); - if (((*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x132])) + 0x2))) != '\0') && (self->_subPlayer != 0)) { - FUN_007ae430(pGVar15 + 0x134); - } - local_54 = GHIDRA_CAST(0x0); - local_30 = (void *)0x0; - local_48 = GHIDRA_CAST(0x0); - local_2c = GHIDRA_CAST(0x0); - local_44 = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST(0x0); - local_14 = (void *)0x1; - local_40 = GHIDRA_CAST(&g_game->_playerManager); - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT(((GHIDRA_CAST(local_40))->_playerList)._begin) >> 2 != 0) { - uVar7 = 0; - do { - pvVar9 = (void *)local_40->_stageType; - if (GHIDRA_INT(pvVar9) - GHIDRA_INT((GHIDRA_CAST(&local_40->_stage))->_begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar9 = (void *)local_40->_stageType; - } - playerFormSrc = (GHIDRA_CAST(&local_40->_stage))->_begin; - if (uVar7 < GHIDRA_UINT((GHIDRA_INT(pvVar9) - GHIDRA_INT(playerFormSrc) >> 2))) { - playerFormSrc = playerFormSrc + uVar7; - } - local_54 = GHIDRA_CAST(*playerFormSrc); - if (local_54->_roomList[0].AllowedDoors == 1) { - mainPlayer = local_54->_roomList[5].Data; - if ((mainPlayer == GHIDRA_CAST(0x0)) || (mainPlayer->_type != 1)) { - local_40 = g_game; - playerFormSrc = (g_game->_playerManager)._playerList._begin; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT(playerFormSrc) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerFormSrc = (local_40->_playerManager)._playerList._begin; - } - mainPlayer = GHIDRA_CAST(*playerFormSrc); - } - if (mainPlayer == self) { - if (GHIDRA_CAST(local_48) == local_44) { - local_40 = local_54; - msvc::vector::_Emplace_reallocate(local_48,&local_40); - local_44 = GHIDRA_CAST(local_28); - local_48 = local_2c; - } - else { - *local_48 = GHIDRA_INT(local_54); - local_48 = local_48 + 1; - local_2c = local_48; - } - } - } - uVar7 = uVar7 + 1; - local_40 = GHIDRA_CAST(&g_game->_playerManager); - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT(((GHIDRA_CAST(local_40))->_playerList)._begin) >> 2))); - pGVar15 = local_58; - } - local_40 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x12e])) + 0x2)))); - local_4c = (void *)0x0; - iVar10 = *GHIDRA_CAST((pGVar15 + 0x130)) - GHIDRA_INT(local_40) >> 0x1f; - local_54 = local_30; - if ((*GHIDRA_CAST((pGVar15 + 0x130)) - GHIDRA_INT(local_40)) / 0x1c + iVar10 != iVar10) { - iVar10 = GHIDRA_INT(local_48) - GHIDRA_INT(local_30); - local_48 = GHIDRA_CAST(0x0); - do { - psVar13 = GHIDRA_CAST((GHIDRA_INT(local_48) + GHIDRA_INT(local_40))); - if (local_4c < (void *)(iVar10 >> 2)) { - if (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_54) + GHIDRA_INT(local_4c) * 4)) + 0x1aec)) == GHIDRA_INT(*psVar13)) { - FUN_007ae430(psVar13); - } - } - else { - PlayerManager::SpawnCoPlayerBaby(&g_game->_playerManager,GHIDRA_INT(*psVar13)); - FUN_007ae430(GHIDRA_INT(local_48) + GHIDRA_INT((local_40->_roomList + -1)) + 0xa4); - PlayerManager::RemoveCoPlayer(&g_game->_playerManager,player,(uint8_t)player); - pGVar15 = local_58; - } - local_40 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x12e])) + 0x2)))); - local_4c = GHIDRA_CAST((GHIDRA_INT(local_4c) + 1)); - local_48 = local_48 + 7; - } while (local_4c < (void *)((*GHIDRA_CAST((pGVar15 + 0x130)) - GHIDRA_INT(local_40)) / 0x1c)); - self = selfSaved; - } - if (&self->_history != GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x13e])) + 0x2))))) { - msvc::vector::assign - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x13e])) + 0x2)))),*GHIDRA_CAST((pGVar15 + 0x140)),local_5c); - } - game = g_game; - iVar10 = *GHIDRA_CAST((pGVar15 + 0x144)); - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x145])) + 0x1)))); - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x146])) + 0x2)))); - self->_inventory[0] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x142])) + 0x2)))); - self->_inventory[1] = iVar10; - self->_inventory[2] = iVar12; - self->_inventory[3] = iVar4; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x149])) + 0x1)))); - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x14a])) + 0x2)))); - iVar4 = *GHIDRA_CAST((pGVar15 + 0x14c)); - self->_inventory[4] = *GHIDRA_CAST((pGVar15 + 0x148)); - self->_inventory[5] = iVar10; - self->_inventory[6] = iVar12; - self->_inventory[7] = iVar4; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x14e])) + 0x2)))); - iVar12 = *GHIDRA_CAST((pGVar15 + 0x150)); - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x151])) + 0x1)))); - self->_inventory[8] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x14d])) + 0x1)))); - self->_inventory[9] = iVar10; - self->_inventory[10] = iVar12; - self->_inventory[0xb] = iVar4; - iVar10 = *GHIDRA_CAST((pGVar15 + 0x154)); - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x155])) + 0x1)))); - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x156])) + 0x2)))); - self->_inventory[0xc] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x152])) + 0x2)))); - self->_inventory[0xd] = iVar10; - self->_inventory[0xe] = iVar12; - self->_inventory[0xf] = iVar4; - HUD::mark_all_slots_dirty(&game->_hud,0,0); - uVar7 = 0; - if (GHIDRA_INT((self->_smeltedTrinkets)._end) - GHIDRA_INT((self->_smeltedTrinkets)._begin) >> 2 != 0) { - do { - *GHIDRA_CAST((GHIDRA_INT((self->_smeltedTrinkets)._begin) + uVar7 * 4)) = 0; - uVar7 = uVar7 + 1; - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((self->_smeltedTrinkets)._end) - - GHIDRA_INT((self->_smeltedTrinkets)._begin) >> 2))); - } - pvVar9 = (self->_history)._historyItems._begin; - if (pvVar9 != (self->_history)._historyItems._end) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 4)) != '\0') { - uVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 8)) & 0x7fff; - smeltedCounts = (self->_smeltedTrinkets)._begin; - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 8)) >> 0xf & 1) == 0) { - psVar13 = GHIDRA_CAST((GHIDRA_INT(smeltedCounts) + uVar7 * 4)); - *psVar13 = *psVar13 + 1; - } - else { - psVar13 = GHIDRA_CAST((GHIDRA_INT(smeltedCounts) + uVar7 * 4 + 2)); - *psVar13 = *psVar13 + 1; - } - } - pvVar9 = (void *)(GHIDRA_INT(pvVar9) + 0x1c); - } while (pvVar9 != (self->_history)._historyItems._end); - pGVar15 = local_58; - } - self->_jarHearts = *GHIDRA_CAST((pGVar15 + 8)); - self->_jarFlies = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[9])) + 0x1)))); - self->_numCoins = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[10])) + 0x2)))); - self->_numKeys = *GHIDRA_CAST((pGVar15 + 0xc)); - self->_numBombs = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0xd])) + 0x1)))); - self->_hasGoldenKey = (*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0xe])) + 0x2))); - self->_hasGoldenBomb = *GHIDRA_CAST((pGVar15 + 0xf)); - self->_monkeyPawCounter = GHIDRA_UINT(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0xf])) + 0x1))))); - self->_totalDamageTaken = GHIDRA_UINT(*GHIDRA_CAST((pGVar15 + 0x10))); - self->_holyMantleState = -((*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x10])) + 0x2))) != '\0') & 2; - self->_tonsilCounter = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x11])) + 0x1)))); - self->_tonsilCount = *GHIDRA_CAST((pGVar15 + 0x12)); - self->_numLeprosy = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x12])) + 0x2)))); - self->_speedModifier = *GHIDRA_CAST((pGVar15 + 0x18)); - self->_fireDelayModifier = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x19])) + 0x1)))); - self->_damageModifier = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1a])) + 0x2)))); - self->_tearRangeModifier = *GHIDRA_CAST((pGVar15 + 0x1c)); - self->_shotSpeedModifier = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1d])) + 0x1)))); - self->_luckModifier = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1e])) + 0x2)))); - self->_donateLuck = *GHIDRA_CAST((pGVar15 + 0x20)); - self->_potatoPeelerCounter = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x21])) + 0x1)))); - self->_potatoPeelerBandageCounter = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x22])) + 0x2)))); - self->_brittleBonesUpgrades = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x13d])) + 0x1)))); - self->_redStewBonusDuration = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x169])) + 0x1)))); - self->_brokenHearts = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x16a])) + 0x2)))); - self->_rottenHearts = *GHIDRA_CAST((pGVar15 + 0x16c)); - self->_effectiveSoulCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x16d])) + 0x1)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1dcc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x16e])) + 0x2)))); - self->_urnSouls = *GHIDRA_CAST((pGVar15 + 0x170)); - self->_numGigaBombs = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x171])) + 0x1)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1db0)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x172])) + 0x2)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1db8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x175])) + 0x1)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1dbc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x176])) + 0x2)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1dc4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x179])) + 0x1)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1dc8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x17a])) + 0x2)))); - self->_rockBottomDamage = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x17e])) + 0x2)))); - self->_rockBottomMaxFireDelay = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x17d])) + 0x1)))); - self->_rockBottomLuck = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x182])) + 0x2)))); - self->_rockBottomTearRange = *GHIDRA_CAST((pGVar15 + 0x180)); - self->_rockBottomMoveSpeed = *GHIDRA_CAST((pGVar15 + 0x17c)); - self->_rockBottomShotSpeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x181])) + 0x1)))); - self->_reverseEmpressMaxHearts = *GHIDRA_CAST((pGVar15 + 0x184)); - self->_reverseSunBoneHearts = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x185])) + 0x1)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1ed8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x186])) + 0x2)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1ec8)))) = *GHIDRA_CAST((pGVar15 + 0x188)); - self->_forgottenBodyRoomIdx = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x189])) + 0x1)))); - (self->_forgottenBodyPos).x = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x18a])) + 0x2)))); - (self->_forgottenBodyPos).y = *GHIDRA_CAST((pGVar15 + 0x18c)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1f14)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x18d])) + 0x1)))); - self->_maggyHealthDrainCooldown = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x18e])) + 0x2)))); - if (&self->_echoChamberItems != GHIDRA_CAST((pGVar15 + 400))) { - local_40 = GHIDRA_CAST((GHIDRA_UINT(local_40) & 0xffffff00)); - msvc::deque::operator_assign(pGVar15 + 400,local_40); - } - uVar11 = *GHIDRA_CAST((pGVar15 + 0x198)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x196])) + 0x2)))); - uVar7 = 8; - if (uVar11 < 8) { - uVar7 = uVar11; - } - uVar11 = 0; - if (uVar7 != 0) { - do { - self->_bagOfCraftingContent[uVar11] = *GHIDRA_CAST((uVar11 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x196])) + 0x2)))))); - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - friendBallHealth = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x19a])) + 0x2)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1f50)))) = *GHIDRA_CAST((pGVar15 + 0x19c)); - self->_bagOfCraftingOutput = friendBallHealth; - uVar11 = *GHIDRA_CAST((pGVar15 + 0x1a0)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x19e])) + 0x2)))); - uVar7 = 6; - if (uVar11 < 6) { - uVar7 = uVar11; - } - uVar11 = 0; - if (uVar7 != 0) { - do { - self->_poopSpellQueue[uVar11] = *GHIDRA_CAST((uVar11 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x19e])) + 0x2)))))); - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - uVar11 = *GHIDRA_CAST((pGVar15 + 0x1a4)) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1a2])) + 0x2)))); - uVar7 = 0x14; - if (uVar11 < 0x14) { - uVar7 = uVar11; - } - uVar11 = 0; - if (uVar7 != 0) { - do { - self->_poopSpellQueue[uVar11 + 6] = *GHIDRA_CAST((uVar11 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1a2])) + 0x2)))))); - uVar11 = uVar11 + 1; - } while (uVar11 < uVar7); - } - (*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1f72))) = (*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1a6])) + 0x2))); - self->_poopMana = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x19d])) + 0x1)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0x1f74)))) = *GHIDRA_CAST((pGVar15 + 0x1a8)); - self->_effectiveBloodCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1a9])) + 0x1)))); - if (&self->_itemCards != GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1aa])) + 0x2))))) { - local_5c = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1aa])) + 0x2)))); - local_48 = GHIDRA_CAST((*GHIDRA_CAST((pGVar15 + 0x1ac)) - GHIDRA_INT(local_5c))); - local_40 = GHIDRA_CAST((GHIDRA_INT(local_48) >> 2)); - local_4c = (self->_itemCards)._begin; - if (GHIDRA_CAST((GHIDRA_INT((self->_itemCards)._capacity) - GHIDRA_INT(local_4c) >> 2)) < local_40) { - msvc::vector::reserve_clear(local_40); - local_4c = (self->_itemCards)._begin; - } - memmove(local_4c,local_5c,(size_t)local_48); - (self->_itemCards)._end = (void *)(GHIDRA_INT(local_48) + GHIDRA_INT(local_4c)); - } - self->_modelingClayEffect = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1ae])) + 0x2)))); - self->_keepersSackBonus = *GHIDRA_CAST((pGVar15 + 0x1b0)); - self->_isLevelStartPending = *GHIDRA_CAST((pGVar15 + 0x1bc)); - self->_hasCurseMistEffect = (*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1bc])) + 0x1))); - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1be])) + 0x2)))); - iVar12 = *GHIDRA_CAST((pGVar15 + 0x1c0)); - friendBallHealth = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1c1])) + 0x1)))); - (self->_consumablesBackup).coins = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1bd])) + 0x1)))); - (self->_consumablesBackup).keys = iVar10; - (self->_consumablesBackup).bombs = iVar12; - (self->_consumablesBackup).goldkey = (char)friendBallHealth; - (self->_consumablesBackup).goldbomb = (char)(GHIDRA_UINT(friendBallHealth) >> 8); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((self->_consumablesBackup))) + 0xe)))) = (short)(GHIDRA_UINT(friendBallHealth) >> 0x10); - iVar10 = *GHIDRA_CAST((pGVar15 + 0x1c4)); - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1c5])) + 0x1)))); - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1c6])) + 0x2)))); - (self->_consumablesBackup).soulcharges = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1c2])) + 0x2)))); - (self->_consumablesBackup).gigabombs = iVar10; - (self->_consumablesBackup).poopmana = iVar12; - (self->_consumablesBackup).bloodcharges = iVar4; - if (&self->_curseMistFamiliars != GHIDRA_CAST((pGVar15 + 0x1c8))) { - msvc::vector<52byte>::assign - (*GHIDRA_CAST((pGVar15 + 0x1c8)),*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1c9])) + 0x1)))),local_5c); - } - self->_curseMistRedHearts = *GHIDRA_CAST((pGVar15 + 0x1cc)); - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1ce])) + 0x2)))); - self->_curseMistPocketSlots[0] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1cd])) + 0x1)))); - self->_curseMistPocketSlots[1] = iVar10; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1d1])) + 0x1)))); - self->_curseMistPocketSlots[2] = *GHIDRA_CAST((pGVar15 + 0x1d0)); - self->_curseMistPocketSlots[3] = iVar10; - iVar10 = *GHIDRA_CAST((pGVar15 + 0x1d4)); - self->_curseMistPocketSlots[4] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1d2])) + 0x2)))); - self->_curseMistPocketSlots[5] = iVar10; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1d6])) + 0x2)))); - self->_curseMistPocketSlots[6] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1d5])) + 0x1)))); - self->_curseMistPocketSlots[7] = iVar10; - self->_curseMistTrinkets[0] = *GHIDRA_CAST((pGVar15 + 0x1d8)); - self->_curseMistTrinkets[1] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1d9])) + 0x1)))); - self->_isCoopGhost = (*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1da])) + 0x2))); - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1dd])) + 0x1)))); - self->_ghostPocketSlots[0] = *GHIDRA_CAST((pGVar15 + 0x1dc)); - self->_ghostPocketSlots[1] = iVar10; - iVar10 = *GHIDRA_CAST((pGVar15 + 0x1e0)); - self->_ghostPocketSlots[2] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1de])) + 0x2)))); - self->_ghostPocketSlots[3] = iVar10; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1e2])) + 0x2)))); - self->_ghostPocketSlots[4] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1e1])) + 0x1)))); - self->_ghostPocketSlots[5] = iVar10; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1e5])) + 0x1)))); - self->_ghostPocketSlots[6] = *GHIDRA_CAST((pGVar15 + 0x1e4)); - self->_ghostPocketSlots[7] = iVar10; - self->_ghostTrinkets[0] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1e6])) + 0x2)))); - self->_ghostTrinkets[1] = *GHIDRA_CAST((pGVar15 + 0x1e8)); - self->_wildCardItemType = (*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1e9])) + 0x1))); - self->_wildCardItem = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1ea])) + 0x2)))); - self->_wildCardVarData = *GHIDRA_CAST((pGVar15 + 0x1ec)); - self->_samsonBerserkCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1ed])) + 0x1)))); - self->_ibsCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1ee])) + 0x2)))); - std_map_copy_assign(&(self->_proceduralItems)._itemIds,&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x1f1])) + 0x1)))); - (GHIDRA_CAST((&self->_proceduralItems)))->GlitchedItemSet::recalculate(); - manager = g_manager; - selfSaved->_edenSpeed = *GHIDRA_CAST((pGVar15 + 0x24)); - selfSaved->_edenFireDelay = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x25])) + 0x1)))); - selfSaved->_edenDamage = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x26])) + 0x2)))); - selfSaved->_edenTearRange = *GHIDRA_CAST((pGVar15 + 0x28)); - selfSaved->_edenShotSpeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x29])) + 0x1)))); - selfSaved->_edenLuck = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x2a])) + 0x2)))); - selfSaved->_vampireCharmKills = *GHIDRA_CAST((pGVar15 + 0x2c)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((selfSaved)) + 0x160c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x2d])) + 0x1)))); - pvVar9 = (manager->_itemConfig)._collectibles._end; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x2e])) + 0x2)))) < - GHIDRA_INT(pvVar9) - GHIDRA_INT((manager->_itemConfig)._collectibles._begin) >> 2) { - selfSaved->_activeDesc[0]._item = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x2e])) + 0x2)))); - selfSaved->_activeDesc[0]._unk = *GHIDRA_CAST((pGVar15 + 0x30)); - selfSaved->_activeDesc[0]._charge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x31])) + 0x1)))); - selfSaved->_activeDesc[0]._batteryCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x32])) + 0x2)))); - selfSaved->_activeDesc[0]._partialCharge = *GHIDRA_CAST((pGVar15 + 0x34)); - selfSaved->_activeDesc[0]._varData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x35])) + 0x1)))); - pvVar9 = (manager->_itemConfig)._collectibles._end; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x36])) + 0x2)))) < - GHIDRA_INT(pvVar9) - GHIDRA_INT((manager->_itemConfig)._collectibles._begin) >> 2) { - selfSaved->_activeDesc[1]._item = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x36])) + 0x2)))); - selfSaved->_activeDesc[1]._unk = *GHIDRA_CAST((pGVar15 + 0x38)); - selfSaved->_activeDesc[1]._charge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x39])) + 0x1)))); - selfSaved->_activeDesc[1]._batteryCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x3a])) + 0x2)))); - selfSaved->_activeDesc[1]._partialCharge = *GHIDRA_CAST((pGVar15 + 0x3c)); - selfSaved->_activeDesc[1]._varData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x3d])) + 0x1)))); - pvVar9 = (manager->_itemConfig)._collectibles._end; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x3e])) + 0x2)))) < - GHIDRA_INT(pvVar9) - GHIDRA_INT((manager->_itemConfig)._collectibles._begin) >> 2) { - selfSaved->_activeDesc[2]._item = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x3e])) + 0x2)))); - selfSaved->_activeDesc[2]._unk = *GHIDRA_CAST((pGVar15 + 0x40)); - selfSaved->_activeDesc[2]._charge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x41])) + 0x1)))); - selfSaved->_activeDesc[2]._batteryCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x42])) + 0x2)))); - selfSaved->_activeDesc[2]._partialCharge = *GHIDRA_CAST((pGVar15 + 0x44)); - selfSaved->_activeDesc[2]._varData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x45])) + 0x1)))); - pvVar9 = (manager->_itemConfig)._collectibles._end; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x46])) + 0x2)))) < - GHIDRA_INT(pvVar9) - GHIDRA_INT((manager->_itemConfig)._collectibles._begin) >> 2) { - selfSaved->_activeDesc[3]._item = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x46])) + 0x2)))); - selfSaved->_activeDesc[3]._unk = *GHIDRA_CAST((pGVar15 + 0x48)); - selfSaved->_activeDesc[3]._charge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x49])) + 0x1)))); - selfSaved->_activeDesc[3]._batteryCharge = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x4a])) + 0x2)))); - selfSaved->_activeDesc[3]._partialCharge = *GHIDRA_CAST((pGVar15 + 0x4c)); - selfSaved->_activeDesc[3]._varData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x4d])) + 0x1)))); - } - iVar10 = selfSaved->_variant; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((selfSaved)) + 0x1738)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x16])) + 0x2)))); - (selfSaved->_playerSpriteScale).x = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x4e])) + 0x2)))); - (selfSaved->_playerSpriteScale).y = *GHIDRA_CAST((pGVar15 + 0x50)); - if ((iVar10 == 0) && (selfSaved->_isCoopGhost == 0)) { - (selfSaved->_headScale).x = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x51])) + 0x1)))); - (selfSaved->_headScale).y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x52])) + 0x2)))); - (selfSaved->_bodyScale).x = *GHIDRA_CAST((pGVar15 + 0x54)); - (selfSaved->_bodyScale).y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x55])) + 0x1)))); - } - local_40 = GHIDRA_CAST(selfSaved->_pocketSlots); - iVar10 = *GHIDRA_CAST((pGVar15 + 0x58)); - *GHIDRA_CAST(local_40) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x56])) + 0x2)))); - selfSaved->_pocketSlots[1] = iVar10; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x5a])) + 0x2)))); - selfSaved->_pocketSlots[2] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x59])) + 0x1)))); - selfSaved->_pocketSlots[3] = iVar10; - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x5d])) + 0x1)))); - selfSaved->_pocketSlots[4] = *GHIDRA_CAST((pGVar15 + 0x5c)); - selfSaved->_pocketSlots[5] = iVar10; - iVar10 = *GHIDRA_CAST((pGVar15 + 0x60)); - selfSaved->_pocketSlots[6] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar15[0x5e])) + 0x2)))); - selfSaved->_pocketSlots[7] = iVar10; - local_48 = GHIDRA_CAST(0x0); - do { - if (((local_40->_stageType == 1) && (local_40->_stage != 0)) && - (GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT((g_manager->_itemConfig)._cards._begin) >> 2 - <= local_40->_stage)) { - if (local_48 < 3) { - pbVar14 = &local_40->_bossChallenge; - game = local_40; - for (uVar7 = (3 - GHIDRA_INT(local_48)) * 2 & 0x3ffffffe; uVar7 != 0; uVar7 = uVar7 - 1) { - game->_stage = *GHIDRA_CAST(pbVar14); - pbVar14 = pbVar14 + 4; - game = GHIDRA_CAST(&game->_stageType); - } - } - selfSaved->_pocketSlots[6] = 0; - } - local_48 = GHIDRA_CAST((GHIDRA_INT(local_48) + 1)); - local_40 = GHIDRA_CAST(&local_40->_bossChallenge); - } while (local_48 < 4); - selfSaved->_rUaWizardTimer = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0xad])) + 0x1)))); - selfSaved->_bloodLustCounter = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0xae])) + 0x2)))); - selfSaved->_deadCatLives = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0xaf])) + 0x1)))); - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0xb1])) + 0x1)))); - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0xb2])) + 0x2)))); - iVar4 = *GHIDRA_CAST((local_58 + 0xb4)); - (selfSaved->_friendBallEnemy)._type = *GHIDRA_CAST((local_58 + 0xb0)); - (selfSaved->_friendBallEnemy)._variant = iVar10; - (selfSaved->_friendBallEnemy)._subtype = iVar12; - (selfSaved->_friendBallEnemy)._championId = iVar4; - friendBallHealth = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0xb5])) + 0x1)))); - (selfSaved->_friendBallEnemy)._health = (float)GHIDRA_INT(friendBallHealth); - (selfSaved->_friendBallEnemy)._maxHealth = (float)GHIDRA_INT(((uint64_t)friendBallHealth >> 0x20)); - *GHIDRA_CAST(&(selfSaved->_friendBallEnemy)._playerControlled) = *GHIDRA_CAST((local_58 + 0xb8)) - ; - selfSaved->_purityState = *GHIDRA_CAST((local_58 + 0x118)); - selfSaved->_immaculateConceptionState = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x119])) + 0x1)))); - selfSaved->_cambionConceptionState = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x11a])) + 0x2)))); - selfSaved->_conceptionFamiliarFlags = *GHIDRA_CAST((local_58 + 0x11c)); - selfSaved->_d8DamageModifier = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x11d])) + 0x1)))); - selfSaved->_d8SpeedModifier = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x11e])) + 0x2)))); - selfSaved->_d8RangeModifier = *GHIDRA_CAST((local_58 + 0x120)); - selfSaved->_d8FireDelayModifier = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x121])) + 0x1)))); - selfSaved->_goldenHearts = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x122])) + 0x2)))); - selfSaved->_planCKillCountdown = *GHIDRA_CAST((local_58 + 0x14)); - selfSaved->_imExcitedSpeedupCountdown = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_58[0x15])) + 0x1)))); - selfSaved->_holyMantleStacks = *GHIDRA_CAST((local_58 + 0x1f0)); - selfSaved->_ductTapeMode = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT((uint8_t)local_58[0x1f0]))) + 0x1))); - selfSaved->_dead = 0; - try_trigger_astral_projection(selfSaved); - if (local_54 != (void *)0x0) { - uVar7 = GHIDRA_INT(local_44) - GHIDRA_INT(local_54) & 0xfffffffc; - game = local_54; - if (0xfff < uVar7) { - game = *GHIDRA_CAST((GHIDRA_CAST(local_54) + -4)); - uVar7 = uVar7 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_54) + (-4 - GHIDRA_INT(game))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(game,uVar7); - } - ExceptionList = local_1c; - return; -} - -// 007afc20 -uint8_t Entity_Player::try_trigger_astral_projection() -{ - ANM2 other; - ANM2 *pAVar1; - uint8_t isNoHearts; - void *astralEffect; - int iVar3; - uint32_t seed; - Entity *astralBody; - LayerState *ghostLayer; - Entity_Player *tempEffects; - ANM2 aAStackY_8c70 [128]; - uint8_t in_stack_fffffea4 [240]; - float fVar4; - float fVar5; - float fVar6; - Vector *position; - Vector *pVVar7; - Entity_Player *pEVar8; - uint32_t uVar9; - EntityRef emptyRef; - uint32_t *astralBodyRef; - bool isNoHearts; - TemporaryEffects *tempEffects; - - if (((this->_redHearts < 1) && (this->_soulHearts < 1)) && (this->_boneHearts < 1)) { - isNoHearts = true; - } - else { - isNoHearts = false; - } - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (isNoHearts)) && (0 < this->_blackHearts)) { - isNoHearts = false; - } - if (((this->_dead != 0) || (!isNoHearts)) || (this->_isCoopGhost != 0)) { - return 0; - } - tempEffects = &this->_temporaryeffects; - if (((this->_temporaryeffects)._disabled == 0) && - (astralEffect = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(0x2a5), - astralEffect != (void *)0x0)) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(astralEffect) + 4)); - if (iVar3 == 1) { - return 0; - } - } - else { - iVar3 = 0; - } - isNoHearts = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c0); - if (isNoHearts != 0) { - return 0; - } - if (iVar3 != 2) { - isNoHearts = HasCollectible(this,0x2a2,0); - if (((isNoHearts != 0) && (iVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetNullEffectNum(0x66), iVar3 == 0)) - && (iVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetNullEffectNum(0x65), iVar3 == 0)) { - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddNullEffect(0x65,1,1); - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddNullEffect(0x66,1,1); - this->_soulHearts = 0; - this->_blackHearts = 0; - this->_eternalHearts = 0; - this->_boneHeartsMask = 0; - this->_boneHearts = 0; - this->_rottenHearts = 0; - if (this->_maxHearts < 1) { - iVar3 = GetHealthType(this); - if (iVar3 == 4) { - this->_redHearts = 0; - AddBoneHearts(tempEffects,1); - } - else { - iVar3 = GetHealthType(tempEffects); - if (iVar3 == 3) { - this->_redHearts = 2; - this->_maxHearts = 2; - } - else if (this->_playerType == 0x12) { - this->_maxHearts = 2; - this->_redHearts = 1; - } - else { - this->_redHearts = 0; - this->_soulHearts = 1; - } - } - } - else { - this->_redHearts = 1; - iVar3 = GetHealthType(this); - if (iVar3 == 3) { - this->_redHearts = 2; - } - } - astralBodyRef = &this->_astralProjectionBody; - this->_damageCooldown = 0x1e; - if (this->_astralProjectionBody == 0) { - seed = Random(); - iVar3 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar9)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar9)) + 0x1))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar9)) + 0x2))) = 0; - pVVar7 = &g_vectorZero; - position = &this->_pos; - fVar6 = 8.40779e-45; - fVar5 = 1.4013e-42; - fVar4 = 1.1295154e-38; - pEVar8 = this; - astralBody = Game::SpawnEx(g_game,1000,6,position,&g_vectorZero,GHIDRA_CAST(this),0,seed,0); - ANM2::ANM2(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x15c)),&this->_sprite); - other._championColor._colorize[3] = fVar4; - other._filename._buf[0] = in_stack_fffffea4[0]; - other._filename._buf[1] = in_stack_fffffea4[1]; - other._filename._buf[2] = in_stack_fffffea4[2]; - other._filename._buf[3] = in_stack_fffffea4[3]; - other._filename._buf[4] = in_stack_fffffea4[4]; - other._filename._buf[5] = in_stack_fffffea4[5]; - other._filename._buf[6] = in_stack_fffffea4[6]; - other._filename._buf[7] = in_stack_fffffea4[7]; - other._filename._buf[8] = in_stack_fffffea4[8]; - other._filename._buf[9] = in_stack_fffffea4[9]; - other._filename._buf[10] = in_stack_fffffea4[10]; - other._filename._buf[0xb] = in_stack_fffffea4[0xb]; - other._filename._buf[0xc] = in_stack_fffffea4[0xc]; - other._filename._buf[0xd] = in_stack_fffffea4[0xd]; - other._filename._buf[0xe] = in_stack_fffffea4[0xe]; - other._filename._buf[0xf] = in_stack_fffffea4[0xf]; - other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x10))); - other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x14))); - other._animDefaultName._buf[0] = in_stack_fffffea4[0x18]; - other._animDefaultName._buf[1] = in_stack_fffffea4[0x19]; - other._animDefaultName._buf[2] = in_stack_fffffea4[0x1a]; - other._animDefaultName._buf[3] = in_stack_fffffea4[0x1b]; - other._animDefaultName._buf[4] = in_stack_fffffea4[0x1c]; - other._animDefaultName._buf[5] = in_stack_fffffea4[0x1d]; - other._animDefaultName._buf[6] = in_stack_fffffea4[0x1e]; - other._animDefaultName._buf[7] = in_stack_fffffea4[0x1f]; - other._animDefaultName._buf[8] = in_stack_fffffea4[0x20]; - other._animDefaultName._buf[9] = in_stack_fffffea4[0x21]; - other._animDefaultName._buf[10] = in_stack_fffffea4[0x22]; - other._animDefaultName._buf[0xb] = in_stack_fffffea4[0x23]; - other._animDefaultName._buf[0xc] = in_stack_fffffea4[0x24]; - other._animDefaultName._buf[0xd] = in_stack_fffffea4[0x25]; - other._animDefaultName._buf[0xe] = in_stack_fffffea4[0x26]; - other._animDefaultName._buf[0xf] = in_stack_fffffea4[0x27]; - other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x28))); - other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x2c))); - other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x30))); - other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x34))); - other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x38))); - other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x3c))); - other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0x40))); - other._animState._isPlaying = in_stack_fffffea4[0x44]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x45))); - other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x48))); - other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x4c))); - other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x50))); - other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x54))); - other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x58))); - other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x5c))); - other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0x60))); - other._overlayAnimState._isPlaying = in_stack_fffffea4[100]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x65))); - other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x68))); - other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x6c))); - other._overlayRenderFirst = in_stack_fffffea4[0x70]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x71))); - other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x74))); - other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x78))); - other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x7c))); - other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x80))); - other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x84))); - other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x88))); - other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffea4)) + 0x8c))); - other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffea4)) + 0x90))); - other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0x94))); - other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0x98))); - other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0x9c))); - other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xa0))); - other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xa4))); - other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xa8))); - other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xac))); - other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xb0))); - other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xb4))); - other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xb8))); - other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xbc))); - other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xc0))); - other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xc4))); - other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xc8))); - other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xcc))); - other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xd0))); - other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xd4))); - other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xd8))); - other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xdc))); - other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xe0))); - other._championColor._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xe4))); - other._championColor._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xe8))); - other._championColor._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffea4)) + 0xec))); - other._championColor._offset[0] = fVar5; - other._championColor._offset[1] = fVar6; - other._championColor._offset[2] = (float)position; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x100))) = pVVar7; - other._playbackSpeed = (float)pEVar8; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = (char)uVar9; - other._loaded = SUB41(uVar9,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x10a))) = SUB42(uVar9,2); - other._shadowLayerIndex = seed; - other._bitflags = iVar3; - ANM2::operator_assign(&astralBody->_sprite,other); - ghostLayer = ANM2::GetLayer(&astralBody->_sprite,GHIDRA_CAST("ghost")); - if (ghostLayer != GHIDRA_CAST(0x0)) { - ghostLayer->_visible = 0; - } - AnimationState::SetAnimationData(&(astralBody->_sprite)._overlayAnimState,(void *)0x0); - ANM2::Play(&astralBody->_sprite,GHIDRA_CAST("Death"),0); - uVar9 = *GHIDRA_CAST((GHIDRA_INT(&astralBody->_flags) + 4)); - *GHIDRA_CAST(&astralBody->_flags) = GHIDRA_UINT(astralBody->_flags) | 0x200000; - *GHIDRA_CAST((GHIDRA_INT(&astralBody->_flags) + 4)) = uVar9; - iVar3 = *GHIDRA_CAST(astralBody); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(astralBody[1])) + 0x40)))) = 10; - (**(code **)(iVar3 + 0xc))(); - if (*astralBodyRef != 0) { - msvc::multiset::erase(); - } - *astralBodyRef = astralBody; - msvc::multiset::insert(); - if (*astralBodyRef == 0) { - return 0; - } - } - seed = Random(); - astralBody = Game::SpawnEx(g_game,1000,0x72,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - iVar3 = *astralBodyRef; - if (astralBody->_child != 0) { - msvc::multiset::erase(); - } - astralBody->_child = iVar3; - if (iVar3 != 0) { - msvc::multiset::insert(); - } - if (astralBody->_target != 0) { - msvc::multiset::erase(); - } - astralBody->_target = this; - msvc::multiset::insert(); - iVar3 = *GHIDRA_CAST(astralBody); - pAVar1 = &astralBody[1]._sprite; - (pAVar1->_animDefaultName)._buf[8] = '\0'; - (pAVar1->_animDefaultName)._buf[9] = '\0'; - (pAVar1->_animDefaultName)._buf[10] = -0x60; - (pAVar1->_animDefaultName)._buf[0xb] = 'B'; - (astralBody->_targetPosition).x = 10.0; - (astralBody->_targetPosition).y = 0.0; - (**(code **)(iVar3 + 0xc))(); - return 0; - } - if (((this->_lastDamageSource)._type == 6) || ((this->_lastDamageFlags & 0x400) != 0)) { - Player_stats_add(&g_game->_onlinePlayerStats,4,this,1.0); - } - emptyRef._type = 0; - emptyRef._variant = 0; - emptyRef._spawnerType = 0; - emptyRef._spawnerVariant = 0; - emptyRef._position.x = g_vectorZero.x; - emptyRef._position.y = g_vectorZero.y; - emptyRef._velocity.x = g_vectorZero.x; - emptyRef._velocity.y = g_vectorZero.y; - emptyRef._flags = 0; - emptyRef._entity = (void *)0x0; - (GHIDRA_CAST((&this->_lastDamageSource)))->EntityRef::operator_(&emptyRef); - } - (GHIDRA_CAST((&emptyRef)))->EntityRef::EntityRef(); - this->Kill(); - return 1; -} - -// 007b0070 -void Entity_Player::spawn_dark_esau(void *gameStatePlayer) -{ - void **ppvVar1; - char cVar2; - uint8_t bVar3; - uint32_t uVar4; - Menu_Stats *spawnedFamiliar; - uint32_t uVar5; - Entity *spawnedEntity; - Entity_NPC *restoredEnemy; - Vector *candidatePos; - int *effectIt; - int iVar6; - Manager *manager; - void *itemListBegin; - float fVar7; - float fVar8; - uint32_t uVar9; - TypeDescriptor *pTVar10; - TypeDescriptor *pTVar11; - uint32_t uVar12; - float *local_6c; - Vector local_64; - float local_5c; - uint32_t *local_58; - uint32_t *local_54; - Vector local_50; - float fStack_48; - uint32_t uStack_44; - Vector spawnPos; - EntityRef charmSource; - float *effectsEnd; - uint32_t *familiarRecord; - void *itemListEnd; - Room *room; - std_vector *tempEffects; - float velocityX; - float velocityY; - - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x37c)); - if (iVar6 != (*GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 900)) - *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x380))) / - 0x34) { - KAGE_LogMessage(0x10,GHIDRA_CAST("m_FamiliarCount does not match m_Familiars.size()")); - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x37c)); - } - local_64.x = 0.0; - if (iVar6 != 0) { - local_6c = GHIDRA_CAST(0x0); - do { - local_54 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x380)) + GHIDRA_INT(local_6c))); - uVar5 = *local_54; - local_58 = GHIDRA_CAST(local_54[2]); - room = g_game->_room; - uVar4 = Random(); - local_5c = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_5c = local_5c + local_5c; - fVar7 = cos(local_5c); - local_50.x = fVar7 * 20.0 + (this->_pos).x; - fVar7 = sin(local_5c); - local_50.y = fVar7 * 20.0 + (this->_pos).y; - Room::GetClampedPositionImpl(room,&spawnPos,&local_50,20.0,20.0,20.0,20.0); - familiarRecord = local_54; - spawnedFamiliar = - (Menu_Stats *) - Game::SpawnEx(g_game,3,local_54[1],&spawnPos,&g_vectorZero,GHIDRA_CAST(this),GHIDRA_UINT(local_58), - uVar5,0); - Menu_Stats::Render(spawnedFamiliar,familiarRecord); - local_64.x = (float)(GHIDRA_INT(local_64.x) + 1); - local_6c = GHIDRA_CAST((GHIDRA_INT(local_6c) + 0x34)); - } while (GHIDRA_UINT(local_64.x) < GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x37c)))); - } - if (this->_replacedPlayer == (void *)0x0) { - if (this->_playerType == 0x11) { - spawn_forgotten_body(this); - } - local_5c = 0.0; - if (0 < *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x22c))) { - local_6c = GHIDRA_CAST((GHIDRA_INT(gameStatePlayer) + 0x244)); - do { - room = g_game->_room; - local_58 = GHIDRA_CAST(((room->_bottomRightPos).x - (room->_topLeftPos).x)); - local_54 = GHIDRA_CAST(((room->_bottomRightPos).y - (room->_topLeftPos).y)); - uVar5 = Random(); - familiarRecord = local_54; - if ((float)local_54 <= (float)local_58) { - familiarRecord = local_58; - } - local_50.y = (float)local_54 * 0.5 + (room->_topLeftPos).y; - local_50.x = (float)local_58 * 0.5 + (room->_topLeftPos).x; - Room::FindFreePickupSpawnPosition - (room,&spawnPos,&local_50, - (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * (float)familiarRecord,0,0,0); - uVar5 = Random(); - uVar12 = 0; - pTVar11 = &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor; - pTVar10 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar9 = 0; - spawnedEntity = - Game::Spawn(g_game,GHIDRA_UINT(local_6c[-5]),GHIDRA_UINT(local_6c[-4]),&spawnPos,&g_vectorZero, - GHIDRA_CAST(0x0),GHIDRA_UINT(local_6c[-3]),uVar5); - restoredEnemy = GHIDRA_CAST(__RTDynamicCast(spawnedEntity,uVar9,pTVar10,pTVar11,uVar12)); - if (restoredEnemy != GHIDRA_CAST(0x0)) { - restoredEnemy->_health = local_6c[-1]; - restoredEnemy->_maxHitPoints = *local_6c; - (GHIDRA_CAST((restoredEnemy)))->Entity_NPC::Morph(GHIDRA_INT(local_6c[-5]),GHIDRA_INT(local_6c[-4]),GHIDRA_INT(local_6c[-3]), - GHIDRA_INT(local_6c[-2])); - if (*GHIDRA_CAST((local_6c + 1)) != '\0') { - restoredEnemy->_controllerID = this->_controllerIndex; - } - local_64.x = (float)g_game->_room; - cVar2 = restoredEnemy->CanShutDoors(); - if ((cVar2 != '\0') && (restoredEnemy->_type != 0x362)) { - *GHIDRA_CAST((GHIDRA_CAST(local_64.x) + 0x12c0)) = *GHIDRA_CAST((GHIDRA_CAST(local_64.x) + 0x12c0)) + -1; - cVar2 = restoredEnemy->IsBoss(); - if (cVar2 != '\0') { - *GHIDRA_CAST((GHIDRA_CAST(local_64.x) + 0x12c8)) = *GHIDRA_CAST((GHIDRA_CAST(local_64.x) + 0x12c8)) + -1; - } - } - restoredEnemy->_canShutDoors = 0; - charmSource._type = this->_type; - charmSource._position.x = (this->_pos).x; - charmSource._position.y = (this->_pos).y; - charmSource._variant = this->_variant; - charmSource._spawnerType = this->_spawnerType; - charmSource._spawnerVariant = this->_spawnerVariant; - charmSource._velocity.x = (this->_velocity).x; - charmSource._velocity.y = (this->_velocity).y; - local_64.x = (float)GHIDRA_UINT(((this->_flags & 0x100) != 0)); - if ((this->_flags & 0x20000000) == 0) { - uVar5 = 0; - } - else { - uVar5 = 2; - } - if ((this->_flags & 0x40000000000000) == 0) { - uVar4 = 0; - } - else { - uVar4 = 4; - } - charmSource._flags = uVar4 | uVar5 | GHIDRA_UINT(local_64.x); - charmSource._entity = this; - (GHIDRA_CAST((GHIDRA_CAST(restoredEnemy))))->Entity::AddCharmed(&charmSource,-1,0,0); - restoredEnemy->Update(); - } - local_5c = (float)(GHIDRA_INT(local_5c) + 1); - local_6c = local_6c + 7; - } while (GHIDRA_INT(local_5c) < *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x22c))); - } - if (&this->_levelEffectItems != GHIDRA_CAST((GHIDRA_INT(gameStatePlayer) + 0x424))) { - local_54 = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x424)); - local_64.x = (float)(*GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x428)) - GHIDRA_INT(local_54)); - local_5c = (float)(GHIDRA_INT(local_64.x) >> 2); - local_6c = (this->_levelEffectItems)._begin; - if (GHIDRA_UINT((GHIDRA_INT((this->_levelEffectItems)._capacity) - GHIDRA_INT(local_6c) >> 2)) < GHIDRA_UINT(local_5c)) { - msvc::vector::reserve_clear(local_5c); - local_6c = (this->_levelEffectItems)._begin; - } - memmove(local_6c,local_54,(size_t)local_64.x); - (this->_levelEffectItems)._end = (void *)(GHIDRA_INT(local_64.x) + GHIDRA_INT(local_6c)); - } - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x430)); - this->_bleedOutHealth = iVar6; - if (0 < iVar6) { - local_54 = GHIDRA_CAST(this->_type); - uVar5 = GHIDRA_UINT(this->_flags); - uVar4 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - fVar7 = (this->_pos).x; - fVar8 = (this->_pos).y; - velocityX = (this->_velocity).x; - velocityY = (this->_velocity).y; - local_58 = GHIDRA_CAST(this->_variant); - local_64.x = (float)this->_spawnerType; - iVar6 = this->_spawnerVariant; - *GHIDRA_CAST(&this->_flags) = uVar5; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar4 | 4; - local_5c = (float)GHIDRA_UINT(((uVar5 & 0x100) != 0)); - if ((uVar5 & 0x20000000) == 0) { - uVar5 = 0; - } - else { - uVar5 = 2; - } - if ((uVar4 & 0x400000) == 0) { - uVar4 = 0; - } - else { - uVar4 = 4; - } - (this->_entityRef2)._position.x = fVar7; - (this->_entityRef2)._type = GHIDRA_INT(local_54); - (this->_entityRef2)._variant = GHIDRA_INT(local_58); - (this->_entityRef2)._spawnerType = GHIDRA_INT(local_64.x); - (this->_entityRef2)._spawnerVariant = iVar6; - (this->_entityRef2)._position.y = fVar8; - (this->_entityRef2)._velocity.x = velocityX; - (this->_entityRef2)._velocity.y = velocityY; - (this->_entityRef2)._flags = uVar4 | uVar5 | GHIDRA_UINT(local_5c); - (this->_entityRef2)._entity = this; - } - this->_greedsGulletHearts = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x434)); - tempEffects = &(this->_temporaryeffects)._effects; - this->_greedsGulletOverflow = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x438)); - (this->_queuedItem)._item = *(void **)(GHIDRA_CAST(gameStatePlayer) + 0x408); - (this->_queuedItem)._charge = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x40c)); - (this->_queuedItem)._flags = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x410)); - if (tempEffects != GHIDRA_CAST((GHIDRA_INT(gameStatePlayer) + 0x414))) { - local_54 = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x414)); - local_64.x = (float)(*GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x418)) - GHIDRA_INT(local_54)); - local_5c = (float)(GHIDRA_INT(local_64.x) >> 4); - local_6c = tempEffects->_begin; - if (GHIDRA_UINT((GHIDRA_INT((this->_temporaryeffects)._effects._capacity) - GHIDRA_INT(local_6c) >> 4)) < - GHIDRA_UINT(local_5c)) { - vector16_clear_and_reserve(tempEffects,GHIDRA_UINT(local_5c)); - local_6c = (this->_temporaryeffects)._effects._begin; - } - memmove(local_6c,local_54,(size_t)local_64.x); - (this->_temporaryeffects)._effects._end = (void *)(GHIDRA_INT(local_64.x) + GHIDRA_INT(local_6c)); - } - this->_strengthMaxHearts = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x420)); - if ((this->_temporaryeffects)._effects._begin == (this->_temporaryeffects)._effects._end) { - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x518)); - local_64.x = 0.0; - if (*GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x51c)) - iVar6 >> 4 != 0) { - local_6c = GHIDRA_CAST(0x0); - manager = g_manager; - do { - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_6c) + 4 + iVar6)); - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(local_6c) + *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x518)))); - if (iVar6 == 0) { - if (GHIDRA_INT(uVar5) < 0) goto LAB_007b07a0; - itemListBegin = (manager->_itemConfig)._nullItems._begin; - itemListEnd = (manager->_itemConfig)._nullItems._end; -LAB_007b0792: - if (GHIDRA_INT(uVar5) < GHIDRA_INT(itemListEnd) - GHIDRA_INT(itemListBegin) >> 2) { - local_50.x = *GHIDRA_CAST((GHIDRA_CAST(itemListBegin) + uVar5 * 4)); - } - else { -LAB_007b07a0: - local_50.x = 0.0; - } - } - else { - if (iVar6 == 2) { - itemListBegin = (manager->_itemConfig)._trinkets._begin; - uVar5 = uVar5 & 0x7fff; - itemListEnd = (manager->_itemConfig)._trinkets._end; - goto LAB_007b0792; - } - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar5)) goto LAB_007b0760; - goto LAB_007b07a0; - } - if (-1 < GHIDRA_INT(uVar5)) { -LAB_007b0760: - itemListBegin = (manager->_itemConfig)._collectibles._begin; - itemListEnd = (manager->_itemConfig)._collectibles._end; - goto LAB_007b0792; - } - if ((-1 < GHIDRA_INT(uVar5)) || - (itemListBegin = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(itemListBegin) >> 2 - <= GHIDRA_INT(~uVar5))) goto LAB_007b07a0; - local_50.x = **GHIDRA_CAST((GHIDRA_CAST(itemListBegin) + ~uVar5 * 4)); - } - uStack_44 = 0; - local_50.y = *GHIDRA_CAST((GHIDRA_CAST(local_6c) + 8 + *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x518)))); - fStack_48 = *GHIDRA_CAST((GHIDRA_CAST(local_6c) + 0xc + *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x518)))); - effectsEnd = (this->_temporaryeffects)._effects._end; - if (effectsEnd == (this->_temporaryeffects)._effects._capacity) { - msvc::vector::_Emplace_reallocate(effectsEnd,&local_50); - manager = g_manager; - } - else { - *effectsEnd = local_50.x; - effectsEnd[1] = local_50.y; - effectsEnd[2] = fStack_48; - effectsEnd[3] = 0.0; - ppvVar1 = &(this->_temporaryeffects)._effects._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x10); - } - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x518)); - local_6c = GHIDRA_CAST((GHIDRA_INT(local_6c) + 0x10)); - local_64.x = (float)(GHIDRA_INT(local_64.x) + 1); - } while (GHIDRA_UINT(local_64.x) < GHIDRA_UINT((*GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x51c)) - iVar6 >> 4))); - } - } - if (0.0 < *GHIDRA_CAST((GHIDRA_CAST(gameStatePlayer) + 0x530))) { - if (GHIDRA_CAST(this->_darkEsau) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_darkEsau) + 0x28))(); - } - room = g_game->_room; - local_58 = GHIDRA_CAST(((room->_bottomRightPos).x - (room->_topLeftPos).x)); - local_54 = GHIDRA_CAST(((room->_bottomRightPos).y - (room->_topLeftPos).y)); - uVar5 = Random(); - familiarRecord = local_54; - if ((float)local_54 <= (float)local_58) { - familiarRecord = local_58; - } - local_50.y = (float)local_54 * 0.5 + (room->_topLeftPos).y; - local_50.x = (float)local_58 * 0.5 + (room->_topLeftPos).x; - Room::FindFreePickupSpawnPosition - (room,&local_64,&local_50, - (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283064e-10 * (float)familiarRecord,1,0,0); - local_5c = 0.0; - do { - fVar8 = (this->_pos).x - local_64.x; - fVar7 = (this->_pos).y - local_64.y; - if (6400.0 <= fVar7 * fVar7 + fVar8 * fVar8) break; - room = g_game->_room; - candidatePos = (GHIDRA_CAST((room)))->Room::GetRandomPosition(&spawnPos,20.0); - candidatePos = Room::FindFreePickupSpawnPosition(room,&local_50,candidatePos,0.0,1,0,0); - local_64.x = candidatePos->x; - local_64.y = candidatePos->y; - local_5c = (float)(GHIDRA_INT(local_5c) + 1); - } while (GHIDRA_INT(local_5c) < 0x14); - uVar5 = Random(); - spawnedEntity = Game::SpawnEx(g_game,0x362,0,&local_64,&g_vectorZero,GHIDRA_CAST(this),0,uVar5,0) - ; - if (this->_darkEsau != 0) { - local_54 = &this->_darkEsau; - msvc::multiset::erase(&local_54); - } - this->_darkEsau = spawnedEntity; - if (spawnedEntity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&this->_darkEsau); - } - uVar9 = *GHIDRA_CAST((GHIDRA_INT(&spawnedEntity->_flags) + 4)); - *GHIDRA_CAST(&spawnedEntity->_flags) = GHIDRA_UINT(spawnedEntity->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&spawnedEntity->_flags) + 4)) = uVar9; - spawnedEntity->Update(); - } - if (this->_isCoopGhost != 0) { - reset_body_sprite(this); - this->_isPlayingItemAnimation = 0; - ANM2::Reset(&this->_bodySprite); - (this->_sprite)._playbackSpeed = 1.0; - AnimationState::SetAnimationData(&(this->_sprite)._overlayAnimState,(void *)0x0); - bVar3 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("GhostAppear"),1); - if (bVar3 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - this->_isPlayingExtraAnimation = 1; - this->_isPlayingItemAnimation = 0; - this->_entityGridCollisionClass = 3; - this->_isCoopGhost = 1; - this->_isInvicible = 1; - this->_visible = 1; - } - if ((this->_temporaryeffects)._disabled == 0) { - for (effectIt = (this->_temporaryeffects)._effects._begin; - effectIt != (this->_temporaryeffects)._effects._end; effectIt = effectIt + 4) { - if ((*GHIDRA_CAST(*effectIt) == 0) && ((GHIDRA_CAST(*effectIt))[1] == 0x78)) { - if ((this->_parent != 0) && (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_subPlayer) + 0x44))(); - if (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_subPlayer))(1); - } - this->_subPlayer = 0; - } - break; - } - } - } - UpdateCanShoot(this); - this->_cacheFlags = this->_cacheFlags | 0xffff; - EvaluateItems(this); - Level::RemoveCompassEffect(GHIDRA_CAST(g_game)); - this->_postLevelInitFinished = 1; - } - return; -} - -// 007b2200 -void Entity_Player::DonateLuck(int luck) -{ - this->_donateLuck = this->_donateLuck + luck; - this->_cacheFlags = this->_cacheFlags | 0x400; - EvaluateItems(this); - return; -} - -// 007b2230 -void Entity_Player::UseCard(int cardType, uint32_t useFlag) -{ - code *pcVar1; - RNG rng; - bool isAnyMarked; - Game *game; - uint8_t bVar4; - char cVar5; - Room *pRVar6; - uint32_t uVar7; - Entity_Player *player; - PersistentGameData *persistentData; - GlowingHourglassState *hourglassState; - Entity_NPC *npc; - Ambush *ambush; - Minimap *minimap; - RoomDescriptor *roomDesc; - Seeds *seeds; - char *markBelow; - Vector *vecResult2; - float *pfVar16; - int iVar17; - ItemOverlay *itemOverlay; - EntityList *entityList; - Room *pRVar20; - EntityPtr EVar21; - Level *pLVar22; - Level *level; - Entity_Effect *effect; - EntityRef *sourceRef; - ItemPool_Item *pool; - uint32_t *puVar27; - uint8_t *puVar28; - EntityPtr *entryPtr; - HUD *hud; - uint32_t uVar30; - Entity *tmpEntity; - PlayerManager *playerManager; - EntityPtr EVar33; - Vector *vecResult; - TemporaryEffects *playerEffects; - uint32_t uVar36; - int *piVar37; - ItemConfig *itemConfig; - ItemConfig_Item *configItem; - ItemPool *itemPool; - int iVar41; - char *markCell; - char *markAbove; - RNG *rngSource; - void *pvVar45; - uint32_t *copyDst; - uint8_t *puVar47; - float in_XMM0_Da; - TypeDescriptor *pTVar48; - TypeDescriptor *pTVar49; - uint32_t shiftidx; - uint32_t uVar50; - float fVar51; - uint32_t uVar52; - EntityRef suicideKingRef; - Vector VStack_488; - uint8_t evilCharmEffect [8]; - uint32_t evilCharmCooldown; - uint8_t bookOfShadowsEffect [8]; - uint32_t bookOfShadowsCooldown; - uint8_t darkArtsEffect [8]; - int darkArtsCooldown; - uint8_t unicornEffect [8]; - int unicornCooldown; - Vector VStack_440; - EntityList_EL hermitPickups; - EntityList_EL shardCollectibles; - EntityList_EL creditPickups; - ItemConfig_Item *whoreClothEffect; - uint32_t uStack_404; - int whoreClothCooldown; - uint32_t uStack_3fc; - ItemConfig_Item *whoreEffect; - uint32_t uStack_3f4; - int whoreCooldown; - uint32_t uStack_3ec; - ItemConfig_Item *belialEffect; - uint32_t uStack_3e4; - int belialCooldown; - uint32_t uStack_3dc; - ItemConfig_Item *telepathyEffect; - uint32_t uStack_3d4; - int telepathyCooldown; - uint32_t uStack_3cc; - EntityList_EL towerEffects; - Vector spawnPos; - EntityList_EL jeraPickups; - Vector spawnPos2; - Vector VStack_398; - uint8_t tmpEffect [8]; - uint32_t berserkCooldown; - Vector pickupPos; - uint32_t announcerDelay; - Vector VStack_374; - int cardConfig; - Vector VStack_368; - Vector VStack_360; - Vector VStack_358; - WeightedOutcomePicker outcomePicker [3]; - Vector VStack_344; - int targetsBegin; - int targetsEnd; - Vector VStack_330; - uint8_t auStack_328 [12]; - Vector VStack_31c; - Vector VStack_314; - uint32_t uStack_30c; - Vector VStack_308; - Vector VStack_300; - uint32_t uStack_2f8; - EntityPtr EStack_2f4; - Vector VStack_2f0; - uint32_t uStack_2e8; - EntityPtr EStack_2e4; - uint8_t isPlayAnim; - uint8_t isPlayAnnouncer; - Vector VStack_2dc; - Vector VStack_2d4; - Vector VStack_2cc; - Vector VStack_2c4; - Vector VStack_2bc; - Vector VStack_2b4; - uint32_t local_2ac; - uint32_t local_2a8; - uint16_t uStack_2a2; - Vector VStack_2a0; - uint32_t local_298; - int card; - EntityRef soulLazarusRef; - RNG shardRng; - EntityRef EStack_254; - RNG RStack_22c; - RNG towerRng; - RNG RStack_20c; - RNG tmpRng; - int *speedStat; - int *fireDelayStat; - int *damageStat; - int *rangeStat; - int *shotSpeedStat; - int *luckStat; - char gridMarks [448]; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00affd56; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((gridMarks + 0x1d0)); - card = cardType; - if (cardType < 0) { - return; - } - pvVar45 = (g_manager->_itemConfig)._cards._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT(pvVar45) >> 2 <= cardType) { - return; - } - cardConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar45) + cardType * 4)); - if (cardConfig == 0) { - return; - } - ExceptionList = &local_10; - VStack_2d4.y = (float)this; - Player_stats_add(5,this); - announcerDelay = 2; - VStack_2a0.y = (float)(g_manager->_optionsConfig)._announcerVoiceMode; - if ((EntityPtr)VStack_2a0.y == (EntityPtr)0x0) { - announcerDelay = 900; - } - if (g_game->_challenge == 0x20) { - rngSource = GHIDRA_CAST((cardType * 0x10 + GHIDRA_INT((this->_cardRNGs)._begin))); - (GHIDRA_CAST((rngSource)))->RNG::Next(); - cardType = GHIDRA_UINT(rngSource->_seed) % 0x61 + 1; - card = cardType; - } - VStack_2dc.y = (float)(useFlag >> 7 & 0xffffff01); - local_2ac = useFlag >> 5 & 0xffffff01; - bVar4 = HasCollectible(this,0x1c3,0); - if ((bVar4 == 0) || ((*GHIDRA_CAST((cardConfig + 0x58)) != 0 && (*GHIDRA_CAST((cardConfig + 0x58)) != 5)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) = 0; - bVar4 = ~(uint8_t)(useFlag >> 1) & 1; -LAB_007b23cf: - local_2a8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_2a8)) + 0x1))),bVar4); - } - else { - isPlayAnnouncer = 1; - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) = 1; - VStack_2bc.y = (float)(CONCAT31((uint3)(useFlag >> 9),~(uint8_t)(useFlag >> 1)) & 0xffffff01); - local_2a8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_2a8)) + 0x1))),SUB41(VStack_2bc.y,0)); - if ((useFlag & 4) != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) = 1; - local_2a8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_2a8)) + 0x1))),SUB41(VStack_2bc.y,0)); - if ((char)local_2ac == '\0') { - UseCard(this,cardType,0x20); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) = isPlayAnnouncer; - bVar4 = SUB41(VStack_2bc.y,0); - goto LAB_007b23cf; - } - } - } - isPlayAnim = ~(uint8_t)useFlag & 1; - pRVar6 = GHIDRA_CAST(GetCardRNG(cardType)); - local_298 = pRVar6; - uVar7 = Random(); - if (((((((uVar7 & 1) == 0) && ((EntityPtr)VStack_2a0.y == (EntityPtr)0x0)) || - ((EntityPtr)VStack_2a0.y == (EntityPtr)0x2)) && ((useFlag & 0x100) == 0)) && - ((5 < g_game->_stage - 1U || (bVar4 = Game::GetStateFlag(g_game,0x30), bVar4 == 0)))) && - (g_game->_stage != 0xd)) { - isPlayAnnouncer = '\x01'; - } - else { - isPlayAnnouncer = '\0'; - } - game = g_game; - switch(card) { - case 1: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - g_game->_leaveDoor = -1; - Game::StartRoomTransition(game,game->_startingRoomIdx,-1,3,this,0); - goto LAB_007b8998; - case 2: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - piVar37 = GHIDRA_CAST(BitSet128)::operator_and(&g_tearFlagHoming); - if ((*piVar37 != 0 || piVar37[1] != 0) || (piVar37[2] != 0 || piVar37[3] != 0)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x185); - } - telepathyEffect = ItemConfig::GetCollectible(&g_manager->_itemConfig,0xc0); - uStack_3d4 = 0; - telepathyCooldown = telepathyEffect->maxCooldown; - uStack_3cc = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&telepathyEffect,(uint8_t)local_2a8,1); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - belialEffect = ItemConfig::GetCollectible(&g_manager->_itemConfig,0x22); - uStack_3e4 = 0; - belialCooldown = belialEffect->maxCooldown; - uStack_3dc = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&belialEffect,(uint8_t)local_2a8,1); - } - break; - case 3: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - VStack_2dc.y = (float)g_game->_room; - VStack_2d4.y = (float)this; - VStack_2cc.y = (float)this; - if (((GHIDRA_CAST(VStack_2dc.y))->_roomList[0x19].DecorationSeed != 0) && - ((GHIDRA_CAST(VStack_2dc.y))->_roomList[0x26].GreedSubType != 6)) { - VStack_2b4.y = (float)(GHIDRA_UINT(VStack_2b4.y) & 0xffffff00); - VStack_2bc.y = 1.4013e-45; - VStack_2a0.y = 0.0; - if (1 < GHIDRA_UINT((GHIDRA_CAST(VStack_2dc.y))->_roomList[0x19].DecorationSeed)) { - do { - pRVar6 = *GHIDRA_CAST((*GHIDRA_CAST(&(GHIDRA_CAST((GHIDRA_INT(VStack_2dc.y) + 0x14)))[0x19]). - PoopCount + GHIDRA_INT(VStack_2bc.y) * 4)); - cVar5 = this->IsValidTarget(pRVar6); - if ((cVar5 != '\0') && - (((bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar4 != 0 || - ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && - (pRVar6->_gridEntities[1] == (void *)0x1)) || - ((GHIDRA_INT(pRVar6->_gridEntities[1]) - 10U < 0x3de && - (pRVar6->_gridEntities[1] != (void *)0x21)))) && ((*GHIDRA_CAST((GHIDRA_CAST(&(VStack_2b4.y)) + 0x0))) == '\0')))) - && ((*GHIDRA_CAST((GHIDRA_CAST(pRVar6->_gridEntities) + 0x14f)) == 0 && - (VStack_2a0.y <= (float)*GHIDRA_CAST((pRVar6->_gridEntities + 0xd7)))))))) { - VStack_2d4.y = VStack_2cc.y; - VStack_2cc.y = (float)pRVar6; - VStack_2a0.y = (float)*GHIDRA_CAST((pRVar6->_gridEntities + 0xd7)); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - VStack_2b4.y = (float)(GHIDRA_UINT(VStack_2b4.y) & 0xff); - if (bVar4 != 0) { - VStack_2b4.y = 1.4013e-45; - } - } - VStack_2bc.y = (float)(GHIDRA_INT(VStack_2bc.y) + 1); - } while (GHIDRA_UINT(VStack_2bc.y) < - GHIDRA_UINT((GHIDRA_CAST((GHIDRA_INT(VStack_2dc.y) + 0x14)))[0x19].DecorationSeed)); - } - } - fVar51 = VStack_2cc.y; - if ((GHIDRA_CAST(VStack_2d4.y) == GHIDRA_CAST(0x0)) || (GHIDRA_CAST(VStack_2d4.y) == this)) { - VStack_2d4.y = VStack_2cc.y; - } - if (GHIDRA_CAST(VStack_2cc.y) != GHIDRA_CAST(0x0)) { - uVar7 = Random(); - VStack_2a0.x = (GHIDRA_CAST(((void **)(GHIDRA_INT(fVar51) + 0x24) + 0xc6)))->x; - VStack_2a0.y = *GHIDRA_CAST(((void **)(GHIDRA_INT(fVar51) + 0x24) + 199)); - uVar52 = 0; - pTVar49 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar48 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar36 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x1d,&VStack_2a0,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - tmpEntity = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar36,pTVar48,pTVar49,uVar52)); - (GHIDRA_CAST((tmpEntity)))->Entity::SetTarget(GHIDRA_CAST(VStack_2cc.y)); - tmpEntity->Update(); - } - fVar51 = VStack_2d4.y; - if (((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) && (GHIDRA_CAST(VStack_2d4.y) != GHIDRA_CAST(0x0))) { - tmpEntity = GHIDRA_CAST(Entity_Effect)::CreateTimer(0,0); - pvVar45 = ((void **)(GHIDRA_INT(fVar51) + 0x24))[199]; - (tmpEntity->_pos).x = (GHIDRA_CAST(((void **)(GHIDRA_INT(fVar51) + 0x24) + 0xc6)))->x; - (tmpEntity->_pos).y = (float)pvVar45; - (GHIDRA_CAST((tmpEntity)))->Entity::SetTarget(GHIDRA_CAST(fVar51)); - } - break; - case 4: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x7a); - if (bVar4 == 0) { - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(3,3,GHIDRA_CAST(0x0)); - } - whoreEffect = ItemConfig::GetCollectible(&g_manager->_itemConfig,0x7a); - uStack_3f4 = 0; - whoreCooldown = whoreEffect->maxCooldown; - uStack_3ec = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&whoreEffect,(uint8_t)local_2a8,1); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - whoreClothEffect = ItemConfig::GetCollectible(&g_manager->_itemConfig,0x7a); - uStack_404 = 0; - whoreClothCooldown = whoreClothEffect->maxCooldown; - uStack_3fc = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&whoreClothEffect,(uint8_t)local_2a8,1); - } - break; - case 5: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - iVar41 = Level::QueryRoomTypeIndex(5,0,pRVar6,0); - game = g_game; - if (-1 < iVar41) { - g_game->_leaveDoor = -1; - Game::StartRoomTransition(game,iVar41,-1,3,this,-1); - isPlayAnim = 0; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - roomDesc = Level::GetRoomByIdx(pLVar22,iVar41,-1); - if (roomDesc->VisitedCount == 0) { - AddSoulHearts(this,2,0); - } - } - break; - case 6: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - VStack_2a0.y = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) + 2); - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&spawnPos2,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),3,uVar7); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - pRVar6 = local_298; - } while (VStack_2a0.y != 0.0); - VStack_2a0.y = 0.0; - break; - case 7: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - VStack_2a0.y = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) + 2); - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&spawnPos,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),1,uVar7); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - pRVar6 = local_298; - } while (VStack_2a0.y != 0.0); - VStack_2a0.y = 0.0; - break; - case 8: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x4d); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - unicornCooldown = unicornCooldown * 2; - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(unicornEffect,(uint8_t)local_2a8,1); - break; - case 9: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - VStack_2a0.y = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) + 1); - do { - bVar4 = HasTrinket(this,0x16,0); - if (bVar4 == 0) { -LAB_007b2f5b: - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&spawnPos,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - pRVar6 = local_298; - } - else { - rngSource = GHIDRA_CAST(FUN_005cbd00(0x16)); - uVar7 = (GHIDRA_CAST((rngSource)))->RNG::RandomInt(5); - if (uVar7 == 0) goto LAB_007b2f5b; - } - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&spawnPos2,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,0x28,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_358,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,0x1e,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_344,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,0x14,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - pRVar6 = local_298; - } while (VStack_2a0.y != 0.0); - VStack_2a0.y = 0.0; - break; - case 10: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - Config::GetCollectibles(); - iVar41 = Level::QueryRoomTypeIndex(2,0,pRVar6,0); - if (-1 < iVar41) { - Config::GetCollectibles(); - FUN_00428ae0(0xffffffff); - Game::StartRoomTransition(g_game,iVar41,-1,3,this,-1); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - FUN_00420ae0(); - FUN_00753c40(2); - } - goto LAB_007b8998; - } - break; - case 0xb: - play_sound_with_fart_seed(0x109,2,0,0x3f800000); - VStack_2b4.y = 1.4013e-45; - iVar41 = FUN_0067f030(); - if (iVar41 == 0) { - persistentData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - bVar4 = PersistentGameData::Unlocked(persistentData,0x25f); - if (bVar4 == 0) goto LAB_007b319e; - VStack_2b4.y = 2.24208e-44; - } - else if (iVar41 < 0x1a) { -LAB_007b319e: - VStack_2b4.y = 4.2039e-45; - } - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_344,&this->_pos,40.0,0,0,0); - pRVar6 = GHIDRA_CAST(VStack_2b4.y); - goto LAB_007b31f0; - case 0xc: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0xc,(uint8_t)local_2a8,1); - iVar41 = GetHeartLimit(this,0); - iVar17 = GetEffectiveMaxHearts(this); - if (iVar17 < iVar41) { - this->_strengthMaxHearts = this->_strengthMaxHearts + 1; - AddMaxHearts(this,2,0); - } - AddHearts(this,2,0,0); - break; - case 0xd: - itemConfig = Isaac::GetItemConfig(); - iVar41 = 1; - uVar7 = local_2a8; - configItem = ItemConfig::GetCollectible(itemConfig,0x14); - bVar4 = (uint8_t)uVar7; - goto LAB_007b327d; - case 0xe: - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0xc,0,GHIDRA_CAST(0x0)); - SoundEffects::PlayWithFartOverride(0x21,2,0,0x3f800000); - UseActiveItem(this,&uStack_2a2,0x23,1,-1,0); - persistentData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - PersistentGameData::IncreaseEventCounter(persistentData,7,1); - break; - case 0xf: - play_sound_with_fart_seed(0x109,2,0,0x3f800000); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_344,&this->_pos,40.0,0,0,0); - pRVar6 = GHIDRA_CAST(0x2); - goto LAB_007b31f0; - case 0x10: - SoundEffects::PlayWithFartOverride(0x22,2,0,0x3f800000); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x22,3,GHIDRA_CAST(0x0)); - itemConfig = Isaac::GetItemConfig(); - iVar41 = 1; - uVar7 = local_2a8; - configItem = ItemConfig::GetCollectible(itemConfig,0x22); - bVar4 = (uint8_t)uVar7; - goto LAB_007b327d; - case 0x11: - itemConfig = Isaac::GetItemConfig(); - iVar41 = 1; - uVar7 = local_2a8; - configItem = ItemConfig::GetCollectible(itemConfig,0x41); - bVar4 = (uint8_t)uVar7; -LAB_007b327d: - pvVar45 = (void *)(GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(pvVar45,bVar4,iVar41); - break; - case 0x12: - Config::GetCollectibles(); - VStack_2b4.y = (float)Level::QueryRoomTypeIndex(0x18,0,pRVar6,0); - if (GHIDRA_INT(VStack_2b4.y) < 0) { -LAB_007b3428: - Config::GetCollectibles(); - VStack_2b4.y = (float)Level::QueryRoomTypeIndex(4,0,pRVar6,0); - if (GHIDRA_INT(VStack_2b4.y) < 0) break; - } - else { - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - roomDesc = Level::GetRoomByIdx(pLVar22,GHIDRA_INT(VStack_2b4.y),-1); - if (*GHIDRA_CAST((GHIDRA_CAST(roomDesc->Data) + 8)) != 0x18) goto LAB_007b3428; - } - Config::GetCollectibles(); - FUN_00428ae0(0xffffffff); - Game::StartRoomTransition(g_game,GHIDRA_INT(VStack_2b4.y),-1,3,this,-1); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - FUN_00420ae0(); - FUN_00753c40(1); - } - goto LAB_007b8998; - case 0x13: - Config::GetCollectibles(); - uVar52 = 0; - uVar36 = 7; - goto LAB_007b34ad; - case 0x14: - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) == 0) { - fVar51 = 1.0; - } - else { - fVar51 = 2.0; - } - VStack_2c4.y = fVar51 * 100.0; - Level::GetCurrentRoom(); - VStack_2dc.y = (float)(GHIDRA_CAST(()))->Room::GetEntities(); - EVar33 = (EntityPtr)0x0; - VStack_2bc.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 != 0) { - do { - entryPtr = GHIDRA_CAST(std)::vector::operator_index(EVar33); - VStack_2a0.y = *GHIDRA_CAST(entryPtr); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - pcVar1 = *(code **)(*GHIDRA_CAST(VStack_2a0.y) + 0x20); - (GHIDRA_CAST((&EStack_254)))->EntityRef::constructor(GHIDRA_CAST(this)); - (*pcVar1)(VStack_2c4.y,0,0,&EStack_254,0x1e); - EVar33 = (EntityPtr)VStack_2bc.y; - } - EVar33 = (EntityPtr)(GHIDRA_INT(EVar33) + 1); - VStack_2bc.y = (float)EVar33; - EVar21 = (EntityPtr)(GHIDRA_CAST(()))->EntityList::Size(); - } while (GHIDRA_UINT(EVar33) < GHIDRA_UINT(EVar21)); - } - uVar7 = 0; - Game::GetPlayerManager(g_game); - iVar41 = (GHIDRA_CAST(()))->msvc::vector::size(); - if (iVar41 != 0) { - do { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - player = PlayerManager::GetPlayer(playerManager,uVar7); - if (player->_dead == 0) { - SetFullHearts(player); - } - uVar7 = uVar7 + 1; - Game::GetPlayerManager(g_game); - uVar30 = (GHIDRA_CAST(()))->msvc::vector::size(); - } while (uVar7 < uVar30); - } - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::ShowMap(pLVar22); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((pRVar6)))->Room::StopRain(); - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::RemoveCurses(pLVar22,1); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(5,0,GHIDRA_CAST(0x0)); - break; - case 0x15: - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(3); - if (uVar7 == 0) { - VStack_2d4.y = (float)&DAT_00000005; - } - else { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(0x32); - if (uVar7 == 0) { - VStack_2d4.y = (float)&DAT_0000000d; - } - else { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(0x32); - if (uVar7 == 0) { - persistentData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - bVar4 = PersistentGameData::Unlocked(persistentData,0x266); - if (bVar4 != 0) { - VStack_2d4.y = 2.52234e-44; - goto LAB_007b36ff; - } - } - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(0x32); - if (uVar7 == 0) { - VStack_2d4.y = (float)&DAT_00000007; - } - else { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(0x32); - VStack_2d4.y = (float)&DAT_00000004; - if (uVar7 == 0) { - VStack_2d4.y = (float)&DAT_00000009; - } - } - } - } -LAB_007b36ff: - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_344,&this->_pos,40.0,0,0,0); - pRVar6 = GHIDRA_CAST(VStack_2d4.y); - goto LAB_007b31f0; - case 0x16: - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::ShowMap(pLVar22); - break; - case 0x17: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - iVar41 = this->_numBombs; - if (iVar41 == 0) { - iVar41 = 2; - } - AddBombs(this,iVar41 + (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_2a2))) + 0x1))) * 2); - break; - case 0x18: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - iVar41 = this->_numCoins; - if (iVar41 == 0) { - iVar41 = 2; - } - AddCoins(this,iVar41 + (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_2a2))) + 0x1))) * 2); - break; - case 0x19: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - iVar41 = this->_numKeys; - if (iVar41 == 0) { - iVar41 = 2; - } - AddKeys(this,iVar41 + (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_2a2))) + 0x1))) * 2); - break; - case 0x1a: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - if (this->_playerType == 0x24) { - iVar41 = this->_effectiveBloodCharge; - if (iVar41 == 0) { - iVar41 = 2; - } - AddBloodCharge(iVar41 + (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_2a2))) + 0x1))) * 2); - } - else { - iVar41 = this->_redHearts; - iVar17 = iVar41; - if (iVar41 == 0) { - iVar17 = 2; - } - VStack_2a0.y = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_2a2))) + 0x1))) * 2); - puVar28 = GHIDRA_CAST((GHIDRA_INT(VStack_2a0.y) + iVar17)); - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - iVar17 = iVar41; - if (iVar41 == 0) { - iVar17 = 0x10; - } - uVar7 = iVar17 + (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_2a2))) + 0x1))) * 0x10; - puVar28 = GHIDRA_CAST((uVar7 >> 3)); - this->_redHearts = (uVar7 & 7) + iVar41; - } - AddHearts(this,GHIDRA_INT(puVar28),0,0); - } - break; - case 0x1b: - case 0x1c: - case 0x1d: - case 0x1e: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - EVar33 = (EntityPtr)g_game->_room; - VStack_2a0.y = (float)EVar33; - FUN_00424510(); - uStack_8 = 0; - if (*(void **)(GHIDRA_CAST(EVar33) + 0x1264) != (void *)0x0) { - pvVar45 = (void *)0x0; - do { - pLVar22 = *(Level **) - (GHIDRA_INT((GHIDRA_CAST((GHIDRA_INT(EVar33) + 0x125c)))->_index) + GHIDRA_INT(pvVar45) * 4); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(pLVar22->_roomList[1])) + 0xa7))) == '\0') { - puVar28 = pLVar22->_roomList[0].OverrideData; - if (puVar28 == &DAT_00000005) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pLVar22))))->Entity_Pickup::CanReroll(); - if (((bVar4 != 0) && (pLVar22->_roomList[7].AllowedDoors == 0)) && - (pLVar22->_roomList[0].AllowedDoors != 100)) { - vecResult = &VStack_2dc; - VStack_2dc.y = (float)pLVar22; - goto LAB_007b2675; - } - } - else if (((((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (puVar28 != GHIDRA_CAST(0x1))) - && ((puVar28 + -10 < GHIDRA_CAST(0x3de) && - ((puVar28 != GHIDRA_CAST(0x1) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pLVar22))))->Entity::IsActiveEnemy(0), bVar4 != 0)))))) && - ((*GHIDRA_CAST((GHIDRA_CAST(&(pLVar22->_roomList[1])) + 0xa7))) == '\0')) && - (cVar5 = (GHIDRA_CAST((GHIDRA_CAST(pLVar22))))->Entity_NPC::CanReroll(), cVar5 != '\0')) { - VStack_2c4.y = (float)pLVar22; - vecResult = &VStack_2c4; -LAB_007b2675: - emplace_back<>(&vecResult->y); - } - } - pvVar45 = (void *)(GHIDRA_INT(pvVar45) + 1); - EVar33 = (EntityPtr)VStack_2a0.y; - } while (pvVar45 < *(void **)(GHIDRA_CAST(VStack_2a0.y) + 0x1264)); - this = GHIDRA_CAST(VStack_2d4.y); - } - VStack_2bc.y = 0.0; - VStack_2f0.y = *GHIDRA_CAST((&DAT_00b6bbd8 + card * 4)); - if (targetsEnd - targetsBegin >> 2 != 0) { - do { - fVar51 = VStack_2bc.y; - iVar41 = *GHIDRA_CAST((targetsBegin + GHIDRA_INT(VStack_2bc.y) * 4)); - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((iVar41 + 0x28)) == 1)) || - (*GHIDRA_CAST((iVar41 + 0x28)) - 10U < 0x3de)) { - uVar7 = Random(); - iVar41 = *GHIDRA_CAST((targetsBegin + GHIDRA_INT(fVar51) * 4)); - VStack_2cc.x = *GHIDRA_CAST((iVar41 + 0x33c)); - VStack_2cc.y = *GHIDRA_CAST((iVar41 + 0x340)); - Game::Spawn(g_game,1000,0xf,&VStack_2cc,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - piVar37 = *GHIDRA_CAST((targetsBegin + GHIDRA_INT(fVar51) * 4)); - VStack_2a0.y = 0.0; - if (piVar37[10] == 5) { - VStack_2a0.y = *GHIDRA_CAST((piVar37 + 0x14a)); - } - (**(code **)(*piVar37 + 0x28))(); - iVar41 = *GHIDRA_CAST((targetsBegin + GHIDRA_INT(fVar51) * 4)); - VStack_2b4.x = *GHIDRA_CAST((iVar41 + 0x33c)); - VStack_2b4.y = *GHIDRA_CAST((iVar41 + 0x340)); - pRVar6 = g_game->_room; - VStack_2d4.x = *GHIDRA_CAST((iVar41 + 0x33c)); - VStack_2d4.y = *GHIDRA_CAST((iVar41 + 0x340)); - iVar41 = (GHIDRA_CAST((pRVar6)))->Room::GetGridIndex(&VStack_2d4); - uVar7 = (GHIDRA_CAST((pRVar6)))->Room::GetGridCollision(iVar41); - if (uVar7 != 0) { - vecResult = Room::FindFreePickupSpawnPosition - (g_game->_room,&VStack_358,&VStack_2b4,0.0,0,0,0); - VStack_2b4.x = vecResult->x; - VStack_2b4.y = vecResult->y; - } - fVar51 = VStack_2bc.y; - RStack_20c._seed = *GHIDRA_CAST((*GHIDRA_CAST((targetsBegin + GHIDRA_INT(VStack_2bc.y) * 4)) + 0x3ec)); - RStack_20c._shift1 = 1; - RStack_20c._shift2 = 5; - RStack_20c._shift3 = 0x10; - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x0))) = 1; - uVar7 = (GHIDRA_CAST((&RStack_20c)))->RNG::Next(); - tmpEntity = Game::Spawn(g_game,5,GHIDRA_UINT(VStack_2f0.y),&VStack_2b4,&g_vectorZero,GHIDRA_CAST(this),0 - ,uVar7); - uStack_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_8))) + 0x1))) << 8; - VStack_2bc.y = (float)(GHIDRA_INT(fVar51) + 1); - tmpEntity[1]._sprite._championColor._tint[0] = VStack_2a0.y; - } while (GHIDRA_UINT(VStack_2bc.y) < GHIDRA_UINT((targetsEnd - targetsBegin >> 2))); - } - uStack_8 = 0xffffffff; - FID_conflict__Tidy(&targetsBegin); - break; - case 0x1f: - g_game->_leaveDoor = -1; - iVar41 = Level::QueryRoomTypeIndex(0xe,0,pRVar6,0); - Game::StartRoomTransition(g_game,iVar41,-1,3,this,0); - goto LAB_007b8998; - case 0x20: - use_card_hagalaz(0); - break; - case 0x21: - Level::GetCurrentRoom(); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,&jeraPickups,5,-1,-1,0,0); - uStack_8 = 3; - EVar33 = (EntityPtr)0x0; - VStack_2bc.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 != 0) { - do { - puVar27 = GHIDRA_CAST(std)::vector::operator_index(EVar33); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar27))))->Entity_Pickup::CanJeraDuplicate(); - if (bVar4 != 0) { - entryPtr = GHIDRA_CAST(std)::vector::operator_index(EVar33); - EVar33 = *entryPtr; - VStack_2a0.y = (float)EVar33; - VStack_2dc.y = (float)(GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity::InitSeed(); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity::SubType(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->Entity::Position(&VStack_330); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_31c,vecResult,40.0,0,0,0); - uVar30 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->Entity::Variant(); - this = GHIDRA_CAST(VStack_2d4.y); - Game::Spawn(g_game,5,uVar30,vecResult,&g_vectorZero,GHIDRA_CAST(VStack_2d4.y),uVar7, - GHIDRA_UINT(VStack_2dc.y)); - EVar33 = (EntityPtr)VStack_2bc.y; - } - EVar33 = (EntityPtr)(GHIDRA_INT(EVar33) + 1); - VStack_2bc.y = (float)EVar33; - EVar21 = (EntityPtr)(GHIDRA_CAST(()))->EntityList::Size(); - } while (GHIDRA_UINT(EVar33) < GHIDRA_UINT(EVar21)); - } - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x15,4,GHIDRA_CAST(0x0)); - uStack_8 = 0xffffffff; - (GHIDRA_CAST((&jeraPickups)))->EntityList_Query::~EntityList_Query(); - break; - case 0x22: - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&uStack_2f8) + 2)),0x54,1,-1,0); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x16,4,GHIDRA_CAST(0x0)); - break; - case 0x23: - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::RemoveCurses(pLVar22,0xffffffff); - AddSoulHearts(this,2,0); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x17,4,GHIDRA_CAST(0x0)); - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - if (cVar5 != '\0') { - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x278); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - evilCharmCooldown = 600; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(evilCharmEffect,1,1); - } - break; - case 0x24: - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::ShowMap(pLVar22); - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::ApplyBlueMapEffect(pLVar22); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x18,4,GHIDRA_CAST(0x0)); - break; - case 0x25: - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&uStack_2f8) + 2)),0x69,1,-1,0); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x19,4,GHIDRA_CAST(0x0)); - break; - case 0x26: - iVar41 = 3; - do { - uVar7 = Random(); - Game::Spawn(g_game,3,0xe7,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0x19,uVar7); - FUN_005b18f0(1); - iVar41 = iVar41 + -1; - } while (iVar41 != 0); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x1a,4,GHIDRA_CAST(0x0)); - break; - case 0x27: - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x3a); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - bookOfShadowsCooldown = 600; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(bookOfShadowsEffect,(uint8_t)local_2a8,1); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x1b,4,GHIDRA_CAST(0x0)); - break; - case 0x28: - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(4); - if (uVar7 == 0) { - if ((*GHIDRA_CAST((GHIDRA_CAST(&(VStack_2dc.y)) + 0x0))) == '\0') { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_330,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,300,vecResult,&g_vectorZero,GHIDRA_CAST(this),0x28,uVar7); - pRVar6 = local_298; - } - } - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(9); - VStack_2b4.y = *GHIDRA_CAST((&DAT_00b6bc20 + uVar7 * 4)); - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - if (cVar5 != '\0') { - Game::GetField26614(g_game); - piVar37 = GHIDRA_CAST((GHIDRA_CAST(()))->EntityList)::Size(); - cVar5 = (**(code **)(*piVar37 + 0x24))(VStack_2b4.y); - if (cVar5 != '\0') { - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(9); - pRVar20 = *GHIDRA_CAST((&DAT_00b6bc20 + uVar7 * 4)); - VStack_2b4.y = (float)pRVar20; - Game::GetField26614(g_game); - piVar37 = GHIDRA_CAST((GHIDRA_CAST(()))->EntityList)::Size(); - cVar5 = (**(code **)(*piVar37 + 0x24))(pRVar20); - } while (cVar5 != '\0'); - this = GHIDRA_CAST(VStack_2d4.y); - } - } - UseCard(this,GHIDRA_INT(VStack_2b4.y),0); - break; - case 0x29: - if ((((this->_queuedItem)._item != (void *)0x0) && - (cVar5 = (GHIDRA_CAST(()))->Item::IsCollectible(), cVar5 != '\0')) && - (bVar4 = (GHIDRA_CAST(((this->_queuedItem)._item)))->Item::HasTags(0x8000), bVar4 == 0)) { - speedStat = &this->_speedModifier; - (this->_queuedItem)._item = (void *)0x0; - fireDelayStat = &this->_fireDelayModifier; - (this->_queuedItem)._charge = 0; - damageStat = &this->_damageModifier; - rangeStat = &this->_tearRangeModifier; - shotSpeedStat = &this->_shotSpeedModifier; - luckStat = &this->_luckModifier; - uVar36 = FUN_005cbd00(0x29); - FUN_005cbfe0(uVar36); - *speedStat = *speedStat + 1; - *fireDelayStat = *fireDelayStat + 1; - uVar7 = Random(); - this = GHIDRA_CAST(VStack_2d4.y); - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)))))->Vector::__add(&VStack_31c,vecResult); - Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - VStack_2b4.y = (float)(GHIDRA_CAST(()))->Room::GetEntities(); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) = 0; - FUN_00424510(); - uStack_8 = 4; - pRVar6 = GHIDRA_CAST(0x0); - VStack_2cc.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 != 0) { - do { - msvc::vector::operator_index(pRVar6); - local_298 = GHIDRA_CAST(FUN_00435e30()); - if (((local_298 != GHIDRA_CAST(0x0)) && - (cVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity_Pickup::IsShopItem(), cVar5 == '\0')) && - ((cVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity::IsDead(), cVar5 == '\0' && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity_Pickup::CanReroll(), bVar4 != 0)))) { - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity::Variant(); - if (((iVar41 == 100) && (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity::SubType(), iVar41 != 0)) && - (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity_Pickup::Timeout(), iVar41 < 1)) { - speedStat = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1520)))); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) = 1; - fireDelayStat = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1524)))); - damageStat = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1528)))); - rangeStat = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x152c)))); - shotSpeedStat = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1530)))); - luckStat = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1534)))); - uVar36 = FUN_005cbd00(0x29); - FUN_005cbfe0(uVar36); - *speedStat = *speedStat + 1; - *fireDelayStat = *fireDelayStat + 1; - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity::Position(&VStack_330); - vecResult2 = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&VStack_360,vecResult2); - Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - FUN_0060d1f0(4); - Entity_Pickup::RemoveOtherOptions(); - iVar41 = FUN_005b1960(); - if (iVar41 != -1) { - Game::GetPlayerManager(g_game); - uVar7 = PlayerManager::GetNumAlivePlayers(); - if (iVar41 + 1U < uVar7) { - msvc::vector::push_back(&local_298); - } - } - } - else { - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity::Variant(); - if ((iVar41 != 100) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity_Pickup::CanReroll(), bVar4 != 0)) { - (**(code **)(*GHIDRA_CAST(local_298) + 0x28))(); - tmpEntity = GHIDRA_CAST(0x0); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity::Position(&VStack_368); - AddBlueFlies(this,1,vecResult,tmpEntity); - } - } - } - puVar47 = GHIDRA_CAST((GHIDRA_INT(VStack_2cc.y) + 1)); - VStack_2cc.y = (float)puVar47; - puVar28 = GHIDRA_CAST((GHIDRA_CAST(()))->EntityList)::Size(); - pRVar6 = GHIDRA_CAST(VStack_2cc.y); - this = GHIDRA_CAST(VStack_2d4.y); - } while (puVar47 < puVar28); - } - EVar33 = (EntityPtr)0x0; - VStack_2bc.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->msvc::vector::size(); - if (iVar41 != 0) { - VStack_2a0.y = (float)((void **)(GHIDRA_INT(VStack_2d4.y) + 0x24) + 0xee); - do { - puVar27 = GHIDRA_CAST(FUN_0042c810(EVar33)); - tmpEntity = GHIDRA_CAST(*puVar27); - iVar41 = FUN_005b1960(); - (GHIDRA_CAST((tmpEntity)))->Entity::Position(&VStack_2dc); - tmpEntity->Remove(); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->RNG::Next(); - uVar7 = ItemPool::GetCollectible(itemPool,2,uVar7,0,0,0); - uVar30 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->RNG::Next(); - tmpEntity = Game::Spawn(g_game,5,100,&VStack_2dc,&g_vectorZero,GHIDRA_CAST(0x0),uVar7,uVar30); - FUN_006e2ff0(iVar41 + 1); - tmpEntity->Update(); - EVar33 = (EntityPtr)(GHIDRA_INT(VStack_2bc.y) + 1); - VStack_2bc.y = (float)EVar33; - EVar21 = (EntityPtr)(GHIDRA_CAST(()))->msvc::vector::size(); - } while (GHIDRA_UINT(EVar33) < GHIDRA_UINT(EVar21)); - } - FUN_007dc610(); - this = GHIDRA_CAST(VStack_2d4.y); - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1574)) = *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1574)) | 0x41f; - EvaluateItems(); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&uStack_2f8) + 2)),0x23,1,-1,0); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar41 = (GHIDRA_CAST(()))->GridEntity::GetVariant(); - if (iVar41 != 0xb) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar41 = (GHIDRA_CAST(()))->GridEntity::GetVariant(); - if (iVar41 != 0x11) goto LAB_007b4865; - } - ambush = GHIDRA_CAST(Game)::GetAmbush(g_game); - (GHIDRA_CAST((ambush)))->Ambush::StartChallenge(); - } -LAB_007b4865: - uStack_8 = 0xffffffff; - FID_conflict__Tidy(auStack_328); - break; - case 0x2a: - VStack_2dc.y = (float)&this->_lastVelocity; - (GHIDRA_CAST((GHIDRA_CAST(VStack_2dc.y))))->Vector::Normalized(&VStack_2f0); - bVar4 = (GHIDRA_CAST((&VStack_2f0)))->Vector::operator_eq(&g_vectorZero); - if (bVar4 != 0) { - (GHIDRA_CAST((&VStack_2f0)))->Vector::operator_assign(&this->_movementVector); - } - bVar4 = (GHIDRA_CAST((&VStack_2f0)))->Vector::operator_eq(&g_vectorZero); - if (bVar4 != 0) { - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - (GHIDRA_CAST((&VStack_2f0)))->Vector::operator_assign(vecResult); - } - uVar7 = Random(); - VStack_2a0.y = 10.0; - vecResult = (GHIDRA_CAST((&VStack_2f0)))->Vector::__mul(&VStack_398,&VStack_2a0.y); - VStack_2bc.y = 0.5; - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2dc.y))))->Vector::__mul(&VStack_368,&VStack_2bc.y); - VStack_2c4.y = 2.0; - vecResult2 = (GHIDRA_CAST((vecResult2)))->Vector::__mul(&VStack_360,&VStack_2c4.y); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&VStack_31c,vecResult2); - this = GHIDRA_CAST(VStack_2d4.y); - Game::Spawn(g_game,2,9,GHIDRA_CAST(((void **)(GHIDRA_INT(VStack_2d4.y) + 0x24) + 0xc6)),vecResult, - GHIDRA_CAST(VStack_2d4.y),0,uVar7); - goto LAB_007b8998; - case 0x2b: - Level::GetCurrentRoom(); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,&creditPickups,5,-1,-1,0,0); - uStack_8 = 2; - uVar7 = 0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 != 0) { - do { - puVar27 = GHIDRA_CAST(std)::vector::operator_index(uVar7); - VStack_2a0.y = (float)__RTDynamicCast(*puVar27,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup:: - RTTI_Type_Descriptor,0); - if (((EntityPtr)VStack_2a0.y != (EntityPtr)0x0) && - (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->Entity_Pickup::Price(), iVar41 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->Entity_Pickup::update_price_sprite(0); - } - uVar7 = uVar7 + 1; - uVar30 = (GHIDRA_CAST(()))->EntityList::Size(); - } while (uVar7 < uVar30); - } - uStack_8 = 0xffffffff; - (GHIDRA_CAST((&creditPickups)))->EntityList_Query::~EntityList_Query(); - break; - case 0x2c: - VStack_2a0.y = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomFloat(); - if (0.05 <= VStack_2a0.y) { - Game::ShowRule(); - } - else { - FUN_0065d070(); - } - break; - case 0x2d: - play_sound_with_fart_seed(0x25,2,0,0x3f800000); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::SetCardAgainstHumanity(); - break; - case 0x2e: - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x24); - sourceRef = (GHIDRA_CAST((&suicideKingRef)))->EntityRef::EntityRef(); - (*pcVar1)(sourceRef); - *GHIDRA_CAST(&this->_lastDamageFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_lastDamageFlags) + 4)) = 0; - (this->_lastDamageSource)._type = 0; - (this->_lastDamageSource)._variant = 0; - VStack_2a0.y = 0.0; - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_344,GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xc6)),40.0, - 0,0,0); - uVar30 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->RNG::RandomInt(0xc); - this = GHIDRA_CAST(VStack_2d4.y); - Game::Spawn(g_game,5,*GHIDRA_CAST((&DAT_00b6bbf0 + uVar30 * 4)),vecResult,&g_vectorZero, - GHIDRA_CAST(VStack_2d4.y),0,uVar7); - fVar51 = VStack_2a0.y; - FUN_005b19f0(VStack_2a0.y); - VStack_2a0.y = (float)(GHIDRA_INT(fVar51) + 1); - } while (GHIDRA_INT(VStack_2a0.y) < 10); - goto LAB_007b8998; - case 0x2f: - UseActiveItem(this,&uStack_2a2,0xaf,1,-1,0); - break; - case 0x30: - iVar41 = this->_activeDesc[0]._item; - if (iVar41 != 0) { - if (iVar41 != 0x11e) { - if ((((iVar41 == 0x1a6) && - (hourglassState = Game::GetGlowingHourglassState(g_game), - hourglassState != GHIDRA_CAST(0x0))) && (-1 < this->_glowingHourglassIndex)) && - (hourglassState = Game::GetGlowingHourglassState(g_game), - hourglassState != GHIDRA_CAST(0x0))) { - VStack_2a0.y = (float)(hourglassState->_eventCounters + - this->_glowingHourglassIndex * 0x177 + -0x182d); - VStack_2b4.y = 0.0; - pfVar16 = GHIDRA_CAST((GHIDRA_INT(VStack_2a0.y) + 0x104)); -LAB_007b3be0: - cVar5 = FUN_00753630(); - if ((cVar5 == '\0') || (*pfVar16 != 6.72623e-44)) goto LAB_007b3bf0; - if (GHIDRA_UINT(VStack_2b4.y) < GHIDRA_CAST(0x3)) { - puVar27 = GHIDRA_CAST((GHIDRA_INT(VStack_2b4.y) * 8 + 0x10c + GHIDRA_INT(VStack_2a0.y))); - copyDst = GHIDRA_CAST((GHIDRA_INT(VStack_2b4.y) * 8 + 0x104 + GHIDRA_INT(VStack_2a0.y))); - for (uVar7 = (3 - GHIDRA_INT(VStack_2b4.y)) * 2 & 0x3ffffffe; uVar7 != 0; uVar7 = uVar7 - 1) { - *copyDst = *puVar27; - puVar27 = puVar27 + 1; - copyDst = copyDst + 1; - } - this = GHIDRA_CAST(VStack_2d4.y); - } - FUN_00753620(); - } -LAB_007b3c4c: - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&uStack_2f8) + 2)), - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1580)))))->_item,4,0,0); - TriggerBookOfVirtues((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1580)))))->_item,0); - goto LAB_007b8998; - } - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - bVar4 = Level::IsNextStageAvailable(pLVar22); - if (bVar4 == 0) { - uVar7 = Random(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_31c,&this->_pos,0.0,0,0,0); - Game::Spawn(g_game,0x11,2,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - } - else { - Config::GetCollectibles(); - FUN_00428ae0(0xffffffff); - Game::StartRoomTransition(g_game,-2,-1,3,this,-1); - } - RemoveCollectible(this,this->_activeDesc[0]._item,0,0,1); - } - break; - case 0x31: - UseActiveItem(this,&uStack_2a2,0x69,1,-1,0); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&uStack_2f8) + 2)),0xa6,1,-1,0); - break; - case 0x32: - Level::GetCurrentRoom(); - VStack_2a0.y = (float)(GHIDRA_CAST(()))->Room::GetEntities(); - pRVar6 = GHIDRA_CAST(0x0); - VStack_2c4.x = 0.0; - VStack_2c4.y = 0.0; - VStack_2b4.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 != 0) { - do { - puVar27 = GHIDRA_CAST(std)::vector::operator_index(pRVar6); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar27))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - if (VStack_2c4.x == 0.0) { - pfVar16 = GHIDRA_CAST(std)::vector::operator_index(pRVar6); - VStack_2c4.x = *pfVar16; - } - else { - if (GHIDRA_CAST(VStack_2c4.y) != GHIDRA_CAST(0x0)) { - VStack_2dc.y = (float)(GHIDRA_CAST((GHIDRA_CAST(VStack_2c4.y))))->Entity::Position(&VStack_31c); - VStack_2bc.y = (float)(GHIDRA_CAST((GHIDRA_CAST(VStack_2c4.x))))->Entity::Position(&VStack_360); - puVar27 = GHIDRA_CAST(std)::vector::operator_index(pRVar6); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(*puVar27))))->Entity::Position(&VStack_368); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2c4.x))))->Entity::Position(&VStack_398); - VStack_2dc.y = (GHIDRA_CAST((GHIDRA_CAST(VStack_2dc.y))))->Vector::DistanceSquared(GHIDRA_CAST(VStack_2bc.y)); - VStack_2bc.y = (GHIDRA_CAST((vecResult)))->Vector::DistanceSquared(vecResult2); - pRVar6 = GHIDRA_CAST(VStack_2b4.y); - if (VStack_2bc.y <= VStack_2dc.y) goto LAB_007b3d9f; - } - pfVar16 = GHIDRA_CAST(std)::vector::operator_index(pRVar6); - VStack_2c4.y = *pfVar16; - } - } -LAB_007b3d9f: - pRVar6 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar6)) + 0x1)))); - VStack_2b4.y = (float)pRVar6; - puVar28 = GHIDRA_CAST((GHIDRA_CAST(()))->EntityList)::Size(); - } while (pRVar6 < puVar28); - } - VStack_2a0.y = 0.0; - do { - EVar33 = *GHIDRA_CAST((&VStack_2c4.x + GHIDRA_INT(VStack_2a0.y))); - VStack_2bc.y = (float)EVar33; - if (EVar33 != (EntityPtr)0x0) { - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity::Position(&VStack_31c); - vecResult2 = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&VStack_368,vecResult2); - uVar52 = 0; - pTVar49 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar48 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar36 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x5b,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - effect = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar36,pTVar48,pTVar49,uVar52)); - fVar51 = VStack_2bc.y; - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetTarget(GHIDRA_CAST(VStack_2bc.y)); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x96); - effect->Update(); - npc = (Entity_NPC *) - __RTDynamicCast(fVar51,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(fVar51))))->Entity::Position(&VStack_330); - (GHIDRA_CAST((npc)))->Entity_NPC::hold_set(0x96,vecResult); - } - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + 1); - this = GHIDRA_CAST(VStack_2d4.y); - } while (GHIDRA_INT(VStack_2a0.y) < 2); - break; - case 0x33: - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x2e); - if (bVar4 == 0) { - bVar4 = (uint8_t)local_2a8; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x2e,bVar4,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x139,bVar4,1); - } - break; - case 0x34: - Game::ShakeScreen(g_game,0x1e); - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x29); - cVar5 = vector_contains_int(configItem); - if (cVar5 == '\0') { - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x29); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(tmpEffect,(uint8_t)local_2a8,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x12e,0,1); - } - break; - case 0x35: - pRVar20 = GHIDRA_CAST(Level)::GetCurrentRoom(); - Room::FindFreePickupSpawnPosition(pRVar20,&pickupPos,&this->_pos,0.0,0,0,0); - VStack_2a0.y = (float)&this->_cardRNGs; - VStack_2b4.y = 0.0; - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - Game::GetItemPool(g_game); - rngSource = GHIDRA_CAST(FUN_005cbd00(0x35)); - uVar30 = (GHIDRA_CAST((rngSource)))->RNG::Next(); - uVar30 = ItemPool::GetCard(uVar30,1,0,0); - vecResult = Vector::FromAngle(&VStack_374,(float)GHIDRA_INT(VStack_2b4.y) * -90.0); - VStack_2dc.y = 2.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_300,&VStack_2dc.y); - this = GHIDRA_CAST(VStack_2d4.y); - Game::Spawn(g_game,5,300,&pickupPos,vecResult,GHIDRA_CAST(VStack_2d4.y),uVar30,uVar7); - VStack_2b4.y = (float)(GHIDRA_INT(VStack_2b4.y) + 1); - pRVar6 = local_298; - } while (GHIDRA_INT(VStack_2b4.y) < 3); - break; - case 0x36: - itemConfig = Isaac::GetItemConfig(); - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x2a); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(tmpEffect,1,1); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - playerEffects = GHIDRA_CAST(FUN_004360d0()); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddCollectibleEffect(0xe8,1,1); - break; - case 0x37: - VStack_2b4.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(8); - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - if (cVar5 != '\0') { - pRVar20 = GHIDRA_CAST(VStack_2b4.y); - do { - if ((pRVar20 != GHIDRA_CAST(0x0)) && (pRVar20 != GHIDRA_CAST(&DAT_00000006))) break; - pRVar20 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG)::RandomInt(8); - VStack_2b4.y = (float)pRVar20; - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - } while (cVar5 != '\0'); - this = GHIDRA_CAST(VStack_2d4.y); - } - switch(VStack_2b4.y) { - case 0.0: - VStack_2dc.y = (float)Config::GetCollectibles(); - uVar7 = Level::GetCurrentRoomIndex(GHIDRA_CAST(VStack_2dc.y)); - if (-1 < GHIDRA_INT(uVar7)) { - if (uVar7 < 0xa9) { - pRVar6 = GHIDRA_CAST((GHIDRA_INT(uVar7) / 0xd)); - VStack_2bc.y = (float)(GHIDRA_INT(uVar7) % 0xd); - local_298 = GHIDRA_CAST((GHIDRA_INT(VStack_2bc.y) + -3)); - VStack_2c4.y = (float)(GHIDRA_INT(VStack_2bc.y) + 3); - VStack_2b4.y = (float)pRVar6; - if (GHIDRA_INT(local_298) <= GHIDRA_INT((GHIDRA_INT(VStack_2bc.y) + 3))) { - VStack_2cc.y = -NAN; - do { - fVar51 = VStack_2cc.y; - if ((GHIDRA_CAST((GHIDRA_INT(VStack_2cc.y) + GHIDRA_INT(VStack_2bc.y))) < GHIDRA_CAST(0xd)) && - (GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(&(pRVar6[-1])) + 0x7895)))) <= GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar6)) + 0x3)))))) { - uVar7 = 0xfffffffd; - VStack_2a0.y = 9.80909e-45; - iVar41 = GHIDRA_INT(local_298->_gridEntities) + GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(&(pRVar6[-1])) + 0x7895)))) * 0xd + -0x24 - ; - do { - if (GHIDRA_INT(pRVar6->_gridEntities) + (uVar7 - 0x24) < 0xd) { - if (GHIDRA_INT((((GHIDRA_UINT(fVar51) ^ GHIDRA_INT(fVar51) >> 0x1f) - (GHIDRA_INT(fVar51) >> 0x1f)) + - ((uVar7 ^ GHIDRA_INT(uVar7) >> 0x1f) - (GHIDRA_INT(uVar7) >> 0x1f)))) < 4) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(VStack_2dc.y),iVar41,-1); - pRVar6 = GHIDRA_CAST(VStack_2b4.y); - fVar51 = VStack_2cc.y; - if (roomDesc->Data != (void *)0x0) { - roomDesc->DisplayFlags = roomDesc->DisplayFlags | 5; - } - } - else { - pRVar6 = GHIDRA_CAST(VStack_2b4.y); - fVar51 = VStack_2cc.y; - } - } - uVar7 = uVar7 + 1; - iVar41 = iVar41 + 0xd; - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - } while (VStack_2a0.y != 0.0); - VStack_2a0.y = 0.0; - } - local_298 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_298)) + 0x1)))); - VStack_2cc.y = (float)(GHIDRA_INT(fVar51) + 1); - } while (GHIDRA_INT(local_298) <= GHIDRA_INT(VStack_2c4.y)); - this = GHIDRA_CAST(VStack_2d4.y); - } - } - } - minimap = GHIDRA_CAST(FUN_00738380()); - Minimap::Refresh(minimap); - break; - case 1.4013e-45: - Game::GetItemPool(g_game); - ItemPool::ResetRoomBlacklist(); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,&shardCollectibles,5,100,-1,0,0); - uStack_8 = 5; - uVar30 = 0xb; - local_298 = GHIDRA_CAST(0x0); - uVar7 = EntityPtr::Ref(); - (GHIDRA_CAST((&shardRng)))->RNG::game_constructor(uVar7,uVar30); - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),6); - uVar7 = (GHIDRA_CAST((&shardRng)))->RNG::RandomInt(2); - VStack_2a0.y = (float)((-GHIDRA_UINT((uVar7 != 0)) & 0xffffffdc) + 0x24); - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 != 0) { - uVar7 = 0; - do { - puVar27 = GHIDRA_CAST(std)::vector::operator_index(uVar7); - tmpEntity = GHIDRA_CAST(*puVar27); - cVar5 = (GHIDRA_CAST((tmpEntity)))->Entity::IsDead(); - if ((cVar5 == '\0') && (iVar41 = (GHIDRA_CAST((tmpEntity)))->Entity::SubType(), iVar41 != 0)) { - pRVar6 = GHIDRA_CAST(__RTDynamicCast(tmpEntity,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup:: - RTTI_Type_Descriptor,0)); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity_Pickup::CanReroll(); - if (((bVar4 != 0) && - ((iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity_Pickup::OptionsPickupIndex(), iVar41 == 0 - || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity_Pickup::Timeout(), iVar41 < 0)))) && - ((uVar30 = (GHIDRA_CAST((&shardRng)))->RNG::Next(), local_298 == GHIDRA_CAST(0x0) || (uVar30 != 0)))) { - local_298 = pRVar6; - } - } - pRVar6 = local_298; - uVar7 = uVar7 + 1; - uVar30 = (GHIDRA_CAST(()))->EntityList::Size(); - this = GHIDRA_CAST(VStack_2d4.y); - } while (uVar7 < uVar30); - if (pRVar6 != GHIDRA_CAST(0x0)) { - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::Variant(); - iVar17 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->Entity::Type(); - Entity_Pickup::Morph(GHIDRA_CAST(local_298),iVar17,iVar41,GHIDRA_INT(VStack_2a0.y),1,0,0); - FUN_005b1950(0); - } - } - guard_check_icall(); - uStack_8 = 0xffffffff; - (GHIDRA_CAST((&shardCollectibles)))->EntityList_Query::~EntityList_Query(); - break; - case 2.8026e-45: - uVar7 = Random(); - Game::Spawn(g_game,3,0xe7,GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xc6)),&g_vectorZero, - GHIDRA_CAST(this),0x19,uVar7); - FUN_005b18f0(1); - break; - case 4.2039e-45: - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x3a); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - RStack_22c._shift2 = 0x5a; - TemporaryEffects::AddEffect - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1508)))),&RStack_22c,(uint8_t)local_2a8,1); - break; - case 5.60519e-45: - use_card_hagalaz(pRVar6); - break; - case 7.00649e-45: - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&uStack_30c) + 2)),0x1dc,1,-1,0); - break; - case 8.40779e-45: - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&VStack_314.y) + 2)),0x54,1,-1,0); - break; - case 9.80909e-45: - AddSoulHearts(this,1,0); - } - break; - case 0x38: - iVar41 = 0; - VStack_2bc.x = (float)this; - uVar7 = 0; - VStack_2bc.y = (float)this->_subPlayer; - EVar33 = (EntityPtr)0x0; - VStack_314.y = 0.0; - EStack_2f4 = (EntityPtr)0x0; - VStack_2b4.y = 0.0; - uStack_2f8 = 0; - VStack_2cc.y = 0.0; - uStack_30c = 0; - local_2a8 = 0; - VStack_2a0.y = 0.0; - do { - player = GHIDRA_CAST((&VStack_2bc.x)[GHIDRA_INT(VStack_2a0.y)]); - if (player != GHIDRA_CAST(0x0)) { - uStack_2f8 = uStack_2f8 + player->_eternalHearts; - VStack_2cc.y = (float)(GHIDRA_INT(VStack_2cc.y) + player->_goldenHearts); - VStack_2f0.y = (float)player->_rottenHearts; - local_2ac = player->_redHearts; - player->_eternalHearts = 0; - player->_goldenHearts = 0; - uStack_2e8 = (float)FUN_00759260(); - EStack_2e4 = (EntityPtr)player->_soulHearts; - VStack_2c4.y = (float)player->_boneHearts; - if ((player->_redHearts < 1) || (player->_maxHearts < 1)) { - if (player->_boneHearts < 1) { - if (0 < GHIDRA_INT(EStack_2e4)) { - AddSoulHearts(player,1 - GHIDRA_INT(EStack_2e4),0); - } - } - else { - AddHearts(player,-player->_redHearts,0,0); - AddSoulHearts(player,-player->_soulHearts,0); - player->_boneHearts = 1; - update_bone_hearts(player); - } - } - else { - iVar17 = GetHealthType(player); - iVar41 = player->_redHearts; - if (iVar17 == 3) { - if (2 < iVar41) { - iVar17 = 2; - goto LAB_007b4f9f; - } - } - else if (1 < iVar41) { - iVar17 = 1; -LAB_007b4f9f: - AddHearts(player,iVar17 - iVar41,0,0); - } - AddSoulHearts(player,-player->_soulHearts,0); - player->_boneHearts = 0; - update_bone_hearts(player); - } - VStack_2f0.y = (float)(GHIDRA_INT(VStack_2f0.y) - player->_rottenHearts); - local_2ac = (local_2ac + GHIDRA_INT(VStack_2f0.y) * -2) - player->_redHearts; - iVar41 = FUN_00759260(); - uStack_2e8 = (float)(GHIDRA_INT(uStack_2e8) - iVar41); - EStack_2e4 = (EntityPtr)((GHIDRA_INT(EStack_2e4) + GHIDRA_INT(uStack_2e8) * -2) - player->_soulHearts); - if ((0 < GHIDRA_INT(local_2ac)) && (iVar41 = GetHealthType(player), iVar41 == 3)) { - iVar41 = local_2ac + 1; - local_2ac = 0; - local_2a8 = local_2a8 + iVar41 / 2; - } - EVar33 = EStack_2e4; - if (GHIDRA_INT(EStack_2e4) < 0) { - iVar41 = (1 - GHIDRA_INT(EStack_2e4)) / 2; - uStack_2e8 = (float)(GHIDRA_INT(uStack_2e8) - iVar41); - EVar33 = (EntityPtr)(GHIDRA_INT(EStack_2e4) + iVar41 * 2); - } - fVar51 = (float)(GHIDRA_INT(VStack_2c4.y) - player->_boneHearts); - uVar7 = uVar7 + local_2ac; - VStack_2c4.y = fVar51; - VStack_314.y = (float)(GHIDRA_INT((GHIDRA_INT(VStack_2f0.y) + 0x24)) + GHIDRA_INT(VStack_314.y) + -0x24); - VStack_2b4.y = (float)(GHIDRA_INT(VStack_2b4.y) + GHIDRA_INT(uStack_2e8)); - EVar33 = (EntityPtr)(GHIDRA_INT(EStack_2f4) + GHIDRA_INT(EVar33)); - uStack_30c = uStack_30c + GHIDRA_INT(fVar51); - iVar41 = local_2a8; - EStack_2f4 = EVar33; - } - this = GHIDRA_CAST(VStack_2d4.y); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + 1); - } while (GHIDRA_UINT(VStack_2a0.y) < 2); - if (0 < *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1da8))) { - EStack_2f4 = (EntityPtr)(GHIDRA_INT(EVar33) + *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1da8))); - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1da8)) = 0; - } - uVar30 = uVar7; - if (0 < *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1dac))) { - uVar30 = uVar7 + *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1dac)); - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1dac)) = 0; - } - local_2a8 = iVar41 + *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1368)); - VStack_2bc.y = *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1dd4)); - VStack_2dc.y = (float)GHIDRA_UINT((*GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1361)) != '\0')); - EStack_2e4 = (EntityPtr)(*GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1364)) - GHIDRA_INT(VStack_2bc.y)); - uStack_2e8 = *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x135c)); - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1368)) = 0; - VStack_2a0.y = (float)GHIDRA_UINT((*GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1360)) != '\0')); - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1364)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1dd4)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1361)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x135c)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1360)) = 0; - local_2ac = uVar7; - FUN_005b19d0(); - shiftidx = 0x2c; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_298))))->RNG::Next(); - (GHIDRA_CAST((&tmpRng)))->RNG::game_constructor(uVar7,shiftidx); - uStack_8 = 7; - VStack_2f0.y = (float)((void **)(GHIDRA_INT(this) + 0x24) + 0xc6); - if (0 < GHIDRA_INT(uVar30)) { - do { - iVar41 = nullsub_7dd380(); - if (GHIDRA_INT(uVar30) < iVar41) { - iVar41 = nullsub_7dd380(); - if (GHIDRA_INT(uVar30) < iVar41) { - VStack_2c4.y = 2.8026e-45; - } - else { - VStack_2c4.y = 1.4013e-45; - } - } - else { - VStack_2c4.y = 7.00649e-45; - } - iVar41 = nullsub_7dd380(); - local_2ac = uVar30 - iVar41; - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_300,GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)),40.0, - 0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),GHIDRA_UINT(VStack_2c4.y),uVar7); - uVar30 = local_2ac; - } while (0 < GHIDRA_INT(local_2ac)); - } - VStack_2c4.y = (float)((void **)(GHIDRA_INT(this) + 0x24) + 0xc6); - fVar51 = VStack_314.y; - EVar33 = EStack_2f4; - if (0 < GHIDRA_INT(VStack_314.y)) { - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_300,GHIDRA_CAST(VStack_2c4.y),40.0,0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),0xc,uVar7); - VStack_314.y = (float)(GHIDRA_INT(VStack_314.y) + -1); - fVar51 = 0.0; - EVar33 = EStack_2f4; - } while (VStack_314.y != 0.0); - } - while( true ) { - VStack_314.y = fVar51; - EStack_2f4 = EVar33; - if (GHIDRA_INT(EVar33) < 1) break; - iVar41 = nullsub_7dd380(); - if (GHIDRA_INT(EVar33) < iVar41) { - VStack_2c4.y = (float)&DAT_00000008; - } - else { - VStack_2c4.y = 4.2039e-45; - } - iVar41 = nullsub_7dd380(); - EStack_2f4 = (EntityPtr)(GHIDRA_INT(EVar33) - iVar41); - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_300,GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)),40.0,0, - 0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),GHIDRA_UINT(VStack_2c4.y),uVar7); - fVar51 = VStack_314.y; - EVar33 = EStack_2f4; - } - VStack_2c4.y = 0.0; - iVar41 = nullsub_7dd380(); - if (0 < iVar41) { - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_300,GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)),40.0, - 0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),6,uVar7); - fVar51 = (float)(GHIDRA_INT(VStack_2c4.y) + 1); - VStack_2c4.y = fVar51; - iVar41 = nullsub_7dd380(); - } while (GHIDRA_INT(fVar51) < iVar41); - } - if (0 < uStack_30c) { - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_300,GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)),40.0, - 0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),0xb,uVar7); - uStack_30c = uStack_30c + -1; - } while (uStack_30c != 0); - } - if (0 < uStack_2f8) { - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_374,GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)),40.0, - 0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),4,uVar7); - uStack_2f8 = uStack_2f8 + -1; - } while (uStack_2f8 != 0); - } - local_298 = GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)); - if (0 < GHIDRA_INT(VStack_2cc.y)) { - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_330,GHIDRA_CAST(((void **)(GHIDRA_INT(this) + 0x24) + 0xc6)),40.0, - 0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),7,uVar7); - VStack_2cc.y = (float)(GHIDRA_INT(VStack_2cc.y) + -1); - } while (VStack_2cc.y != 0.0); - VStack_2f0.y = (float)((void **)(GHIDRA_INT(this) + 0x24) + 0xc6); - VStack_2cc.y = 0.0; - } - VStack_2b4.y = (float)local_298; - if (0 < GHIDRA_INT(local_2a8)) { - do { - if (local_2a8 < 100) { - if (0x18 < local_2a8) { - uVar7 = 0x4a; - local_2a8 = local_2a8 - 0x19; - goto LAB_007b5662; - } - VStack_2c4.y = 2.8026e-44; - if (local_2a8 < 10) { - if (local_2a8 < 5) { - if (local_2a8 < 2) { - uVar7 = 1; - local_2a8 = local_2a8 - 1; - } - else { - uVar7 = 4; - local_2a8 = local_2a8 - 2; - } - } - else { - uVar7 = 2; - local_2a8 = local_2a8 - 5; - } - } - else { - uVar7 = 3; - local_2a8 = local_2a8 - 10; - } - local_298 = GHIDRA_CAST((GHIDRA_CAST((&tmpRng)))->RNG)::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - fVar51 = 40.0; - } - else { - uVar7 = 0x12; - local_2a8 = local_2a8 - 100; -LAB_007b5662: - VStack_2c4.y = 1.4013e-43; - local_298 = GHIDRA_CAST((GHIDRA_CAST((&tmpRng)))->RNG)::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - fVar51 = 10.0; - } - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_31c,GHIDRA_CAST(VStack_2f0.y),fVar51,0,0,0); - fVar51 = VStack_2c4.y; - tmpEntity = Game::Spawn(g_game,5,GHIDRA_UINT(VStack_2c4.y),vecResult,&g_vectorZero,GHIDRA_CAST(this),uVar7 - ,GHIDRA_UINT(local_298)); - VStack_2c4.y = (float)tmpEntity; - if (fVar51 == 1.4013e-43) { - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2c4.y))))->Entity::Position(&VStack_360); - Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - } while (0 < GHIDRA_INT(local_2a8)); - local_298 = GHIDRA_CAST(VStack_2f0.y); - } - VStack_2cc.y = VStack_2b4.y; - if (0 < GHIDRA_INT(EStack_2e4)) { - do { - if (GHIDRA_UINT(EStack_2e4) < 99) { - if (9 < GHIDRA_UINT(EStack_2e4)) { - uVar7 = 0x13; - EStack_2e4 = (EntityPtr)(GHIDRA_INT(EStack_2e4) + -10); - goto LAB_007b57d2; - } - VStack_2c4.y = 5.60519e-44; - if (GHIDRA_UINT(EStack_2e4) < 2) { - uVar7 = 1; - EStack_2e4 = (EntityPtr)(GHIDRA_INT(EStack_2e4) + -1); - } - else { - uVar7 = 2; - EStack_2e4 = (EntityPtr)(GHIDRA_INT(EStack_2e4) + -2); - } - VStack_2b4.y = (float)(GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - fVar51 = 40.0; - } - else { - uVar7 = 0xbe; - EStack_2e4 = (EntityPtr)(GHIDRA_INT(EStack_2e4) + -99); -LAB_007b57d2: - VStack_2c4.y = 1.4013e-43; - VStack_2b4.y = (float)(GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - fVar51 = 10.0; - } - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_368,GHIDRA_CAST(local_298),fVar51,0,0,0); - fVar51 = VStack_2c4.y; - tmpEntity = Game::Spawn(g_game,5,GHIDRA_UINT(VStack_2c4.y),vecResult,&g_vectorZero,GHIDRA_CAST(this),uVar7 - ,GHIDRA_UINT(VStack_2b4.y)); - VStack_2c4.y = (float)tmpEntity; - if (fVar51 == 1.4013e-43) { - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2c4.y))))->Entity::Position(&VStack_398); - Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - } while (0 < GHIDRA_INT(EStack_2e4)); - VStack_2b4.y = (float)local_298; - } - for (; VStack_2dc.y != 0.0; VStack_2dc.y = (float)(GHIDRA_INT(VStack_2dc.y) - 1)) { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_344,GHIDRA_CAST(VStack_2b4.y),40.0,0,0,0); - Game::Spawn(g_game,5,0x28,vecResult,&g_vectorZero,GHIDRA_CAST(this),4,uVar7); - } - VStack_2dc.y = 0.0; - fVar51 = uStack_2e8; - EVar33 = (EntityPtr)VStack_2bc.y; - if (0 < GHIDRA_INT(VStack_2bc.y)) { - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&spawnPos,GHIDRA_CAST(VStack_2cc.y),40.0,0,0,0); - Game::Spawn(g_game,5,0x28,vecResult,&g_vectorZero,GHIDRA_CAST(this),7,uVar7); - VStack_2bc.y = (float)(GHIDRA_INT(VStack_2bc.y) + -1); - fVar51 = uStack_2e8; - EVar33 = (EntityPtr)0x0; - } while ((EntityPtr)VStack_2bc.y != (EntityPtr)0x0); - } - while (VStack_2bc.y = (float)EVar33, 0 < GHIDRA_INT(fVar51)) { - if (GHIDRA_UINT(fVar51) < 99) { - VStack_2c4.y = 4.2039e-44; - if (GHIDRA_UINT(fVar51) < 2) { - VStack_2dc.y = 1.4013e-45; - fVar51 = (float)(GHIDRA_INT(fVar51) - 1); - } - else { - VStack_2dc.y = 4.2039e-45; - fVar51 = (float)(GHIDRA_INT(fVar51) - 2); - } - uStack_2e8 = fVar51; - VStack_2bc.y = (float)(GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar20 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pRVar6 = GHIDRA_CAST(0x42200000); - } - else { - VStack_2bc.y = (float)(GHIDRA_CAST((&tmpRng)))->RNG::Next(); - VStack_2f0.y = 10.0; - fVar51 = (float)(GHIDRA_INT(fVar51) - 99); - VStack_2c4.y = 1.4013e-43; - VStack_2dc.y = (float)&DAT_00000011; - uStack_2e8 = fVar51; - pRVar20 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pRVar6 = GHIDRA_CAST(VStack_2f0.y); - } - vecResult = Room::FindFreePickupSpawnPosition - (pRVar20,&spawnPos2,GHIDRA_CAST(VStack_2cc.y),(float)pRVar6,0,0,0); - VStack_2bc.y = (float)Game::Spawn(g_game,5,GHIDRA_UINT(VStack_2c4.y),vecResult,&g_vectorZero, - GHIDRA_CAST(this),GHIDRA_UINT(VStack_2dc.y),GHIDRA_UINT(VStack_2bc.y)); - EVar33 = (EntityPtr)VStack_2bc.y; - if (VStack_2c4.y == 1.4013e-43) { - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2bc.y))))->Entity::Position(&VStack_358); - Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - fVar51 = uStack_2e8; - EVar33 = (EntityPtr)VStack_2bc.y; - } - } - for (; VStack_2a0.y != 0.0; VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) - 1)) { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_2bc,GHIDRA_CAST(VStack_2cc.y),40.0,0,0,0); - Game::Spawn(g_game,5,0x1e,vecResult,&g_vectorZero,GHIDRA_CAST(this),2,uVar7); - } - iVar41 = 2; - VStack_2a0.y = 0.0; - do { - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::FindFreePickupSpawnPosition(pRVar6,&pickupPos,GHIDRA_CAST(VStack_2cc.y),0.0,0,0,0); - DropTrinket(this,&pickupPos,0); - iVar41 = iVar41 + -1; - } while (iVar41 != 0); - uVar30 = GetMaxPocketItems(this); - uVar7 = 0; - if (uVar30 != 0) { - do { - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition - (pRVar6,&VStack_300,GHIDRA_CAST(VStack_2cc.y),0.0,0,0,0); - DropPocketItem(this,uVar7,vecResult); - uVar7 = uVar7 + 1; - uVar30 = GetMaxPocketItems(this); - } while (uVar7 < uVar30); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - Config::GetCollectibles(); - EVar33 = (EntityPtr)FUN_0042c7f0(); - FUN_00424510(); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x0))) = 8; - if (0 < GHIDRA_INT(EVar33)) { -joined_r0x007b5c54: - EVar33 = (EntityPtr)(GHIDRA_INT(EVar33) + -1); - VStack_2a0.y = (float)EVar33; - if (-1 < GHIDRA_INT(EVar33)) { - Config::GetCollectibles(); - iVar41 = FUN_005cbe00(EVar33); - if (*GHIDRA_CAST((iVar41 + 4)) == '\0') { - Config::GetCollectibles(); - iVar41 = FUN_005cbe00(EVar33); - VStack_2b4.y = *GHIDRA_CAST((iVar41 + 8)); - bVar4 = CanRerollCollectible(this,GHIDRA_INT(VStack_2b4.y),0); - if (bVar4 != 0) { - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,GHIDRA_INT(VStack_2b4.y)); - if (configItem->type != 3) { - VStack_2bc.y = (float)&(*GHIDRA_CAST((GHIDRA_CAST(&(((GHIDRA_CAST(this))->_fxLayers))) + 0xb0))); - iVar41 = 0; - piVar37 = GHIDRA_CAST(FUN_0042c810(VStack_2b4.y)); - EVar33 = (EntityPtr)VStack_2a0.y; - if (0 < *piVar37) { - do { - uVar7 = (GHIDRA_CAST(()))->msvc::vector::size(); - this = GHIDRA_CAST(VStack_2d4.y); - EVar33 = (EntityPtr)VStack_2a0.y; - if (2 < uVar7) break; - msvc::vector::push_back(&VStack_2b4.y); - iVar41 = iVar41 + 1; - piVar37 = GHIDRA_CAST(FUN_0042c810(VStack_2b4.y)); - this = GHIDRA_CAST(VStack_2d4.y); - EVar33 = (EntityPtr)VStack_2a0.y; - } while (iVar41 < *piVar37); - } - } - } - } - goto joined_r0x007b5c54; - } - uVar7 = 0; - iVar41 = (GHIDRA_CAST(()))->msvc::vector::size(); - if (iVar41 != 0) { - do { - piVar37 = GHIDRA_CAST(FUN_0042c810(uVar7)); - DropCollectible(this,*piVar37,GHIDRA_CAST(0x0),1); - uVar7 = uVar7 + 1; - uVar30 = (GHIDRA_CAST(()))->msvc::vector::size(); - } while (uVar7 < uVar30); - } - } - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),7); - FID_conflict__Tidy(auStack_328); - } - FUN_005b19d0(); - ConsumableCountChanged(this,-1); - Game::GetHUD(g_game); - FUN_009a6110(1); - uStack_8 = 0xffffffff; - guard_check_icall(); - break; - case 0x39: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x3c,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x3c,(uint8_t)local_2a8,1); - break; - case 0x3a: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x3d,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x3d,(uint8_t)local_2a8,1); - break; - case 0x3b: - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x3e); - if (bVar4 == 0) { - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x2a,3,GHIDRA_CAST(0x0)); - } - iVar41 = this->_reverseEmpressMaxHearts; - this->_reverseEmpressMaxHearts = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x3e,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x3e,(uint8_t)local_2a8,1); - this->_reverseEmpressMaxHearts = iVar41; - VStack_2a0.y = (float)(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_2a2))) + 0x1))) - iVar41) + 2); - if (0 < GHIDRA_INT(VStack_2a0.y)) { - do { - iVar41 = GetHeartLimit(this,0); - iVar17 = GetEffectiveMaxHearts(this); - if (iVar17 < iVar41) { - this->_reverseEmpressMaxHearts = this->_reverseEmpressMaxHearts + 1; - AddMaxHearts(this,2,0); - } - AddHearts(this,2,0,0); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - } while ((EntityPtr)VStack_2a0.y != (EntityPtr)0x0); - VStack_2a0.y = 0.0; - } - break; - case 0x3c: - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - rngSource = GHIDRA_CAST(FUN_005cbd00(0x3c)); - uVar7 = (GHIDRA_CAST((rngSource)))->RNG::Next(); - Level::TryInitializeExtraBossRoom(pLVar22,uVar7); - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - roomDesc = Level::GetRoomByIdx(pLVar22,-0x11,-1); - if (roomDesc->Data == (void *)0x0) { - rngSource = GHIDRA_CAST(FUN_005cbd00(0x3c)); - uVar7 = (GHIDRA_CAST((rngSource)))->RNG::Next(); - Game::MoveToRandomRoom(g_game,0,uVar7,this); - } - else { - Config::GetCollectibles(); - FUN_00428ae0(0xffffffff); - Game::StartRoomTransition(g_game,-0x11,-1,3,this,0); - } - goto LAB_007b8998; - case 0x3d: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - VStack_2a0.y = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) + 2); - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_308,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),0xb,uVar7); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - pRVar6 = local_298; - } while (VStack_2a0.y != 0.0); - VStack_2a0.y = 0.0; - break; - case 0x3e: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - VStack_2a0.y = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) + 1); - VStack_2dc.y = (float)&this->_pos; - do { - EVar33 = (EntityPtr)(GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - VStack_2bc.y = (float)EVar33; - pRVar20 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar7 = (GHIDRA_CAST((pRVar20)))->Room::GetSeededCollectible(GHIDRA_UINT(EVar33),0); - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - fVar51 = VStack_2bc.y; - if (cVar5 != '\0') { - do { - Game::GetField26614(g_game); - piVar37 = GHIDRA_CAST((GHIDRA_CAST(()))->EntityList)::Size(); - cVar5 = (**(code **)(*piVar37 + 0x30))(uVar7); - if (cVar5 == '\0') break; - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar7 = (GHIDRA_CAST((pRVar6)))->Room::GetSeededCollectible(GHIDRA_UINT(fVar51),0); - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - } while (cVar5 != '\0'); - pRVar6 = local_298; - } - pRVar20 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::FindFreePickupSpawnPosition(pRVar20,&VStack_2cc,GHIDRA_CAST(VStack_2dc.y),40.0,0,0,0); - uVar30 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - Game::Spawn(g_game,5,100,&VStack_2cc,&g_vectorZero,GHIDRA_CAST(0x0),uVar7,uVar30); - uVar7 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0xf,&VStack_2cc,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - pcVar1 = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - uVar36 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0x40000000,0x3ecccccd,0x3ecccccd,0x3f800000,0,0,0); - (*pcVar1)(uVar36,0xffffffff,0xff,0,1); - SoundEffects::PlayWithFartOverride(0x13c,2,0,0x3f800000); - this = GHIDRA_CAST(VStack_2d4.y); - if (*GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1340)) < 1) { - if (*GHIDRA_CAST((GHIDRA_CAST(VStack_2d4.y) + 0x1d88)) < 1) { - AddSoulHearts(GHIDRA_CAST(VStack_2d4.y),-4,0); - } - else { - AddBoneHearts(GHIDRA_CAST(VStack_2d4.y),-1); - } - } - else { - AddMaxHearts(GHIDRA_CAST(VStack_2d4.y),-2,0); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x13c0)) != 10) && (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x13c0)) != 0x1f)) { - AddBrokenHearts(this,1); - } - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(this) + 0x1618))))) + 0x90)))) = 0x400; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(this) + 0x1618))))) + 0x94)))) = 0; - pRVar6 = local_298; - } while (VStack_2a0.y != 0.0); - VStack_2a0.y = 0.0; - break; - case 0x3f: - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x3f); - if (bVar4 == 0) { - play_sound_with_fart_seed(0x1e7,2,0,0x3f800000); - Game::ShakeScreen(g_game,4); - VStack_2f0.y = (float)&this->_pos; - VStack_2bc.y = 4.2039e-45; - do { - vecResult = MusicManager::RandomVector(&VStack_308); - random_float(); - pLVar22 = GHIDRA_CAST((in_XMM0_Da * 5.0)); - VStack_2dc.y = (float)pLVar22; - (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_2cc,&VStack_2dc.y); - uVar7 = Random(); - vecResult = MusicManager::RandomVector(&VStack_300); - random_float(); - VStack_2c4.y = (float)pLVar22 * 20.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_374,&VStack_2c4.y); - fVar51 = VStack_2f0.y; - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2f0.y))))->Vector::__add(&VStack_330,vecResult); - uVar52 = 0; - pTVar49 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar48 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar36 = 0; - tmpEntity = Game::Spawn(g_game,1000,0x3b,vecResult,&VStack_2cc,GHIDRA_CAST(0x0),0,uVar7); - effect = GHIDRA_CAST(__RTDynamicCast(tmpEntity,uVar36,pTVar48,pTVar49,uVar52)); - VStack_2a0.y = 1.0; - vecResult = (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::Position(&VStack_31c); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&VStack_360,GHIDRA_CAST(fVar51)); - vecResult2 = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - VStack_2b4.y = (GHIDRA_CAST((vecResult)))->Vector::Dot(vecResult2); - puVar28 = GHIDRA_CAST(0x0); - if (VStack_2b4.y < 0.0) { - puVar28 = &DAT_bf800000; - VStack_2a0.y = (float)&DAT_bf800000; - } - random_float(); - fVar51 = ((float)puVar28 * 10.0 + 2.0) * VStack_2a0.y; - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(fVar51); - iVar41 = Isaac::Random(0xf); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(iVar41 + 0xf); - uVar50 = 0; - uVar52 = 0; - uVar36 = 0; - pcVar1 = *(code **)(*GHIDRA_CAST(effect) + 0x3c); - random_float(0,0,0); - in_XMM0_Da = 1.0; - uVar36 = (GHIDRA_CAST((fVar51 * 0.5 + 0.2)))->Color::Color(uVar36,uVar52,uVar50); - (*pcVar1)(uVar36,0xffffffff,0xff,0,1); - effect->Update(); - this = GHIDRA_CAST(VStack_2d4.y); - VStack_2bc.y = (float)(GHIDRA_INT(VStack_2bc.y) + -1); - } while ((EntityPtr)VStack_2bc.y != (EntityPtr)0x0); - pcVar1 = *(code **)(*GHIDRA_CAST(VStack_2d4.y) + 0x3c); - uVar36 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0,0,0,0x3f4ccccd,0x3f4ccccd,0x3f4ccccd); - (*pcVar1)(uVar36,2,0xff,1,1); - pRVar6 = local_298; - } - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1508)))))))->TemporaryEffects::RemoveNullEffect(0x3f,1); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1508)))))))->TemporaryEffects::AddNullEffect(0x3f,1,1); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(10); - if (uVar7 == 0) { - itemConfig = Isaac::GetItemConfig(); - bVar4 = 0; - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x44); - AddCostume(this,configItem,bVar4); - } - goto LAB_007b8998; - case 0x40: - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) + 1) * 3); - EVar33 = (EntityPtr)(uVar7 + 2); - VStack_2a0.y = (float)EVar33; - if (EVar33 != (EntityPtr)0x0) { - VStack_2bc.y = (float)&this->_pos; - do { - pRVar20 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::FindFreePickupSpawnPosition(pRVar20,&VStack_358,GHIDRA_CAST(VStack_2bc.y),40.0,0,0,0); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - Game::Spawn(g_game,5,0x3c,&VStack_358,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - EVar33 = (EntityPtr)(GHIDRA_INT(EVar33) + -1); - this = GHIDRA_CAST(VStack_2d4.y); - } while (EVar33 != (EntityPtr)0x0); - } - break; - case 0x41: - local_2ac = 0; - Level::GetCurrentRoom(); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,&hermitPickups,5,-1,-1,0,0); - uStack_8 = 9; - EVar33 = (EntityPtr)0x0; - VStack_2bc.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 == 0) { -LAB_007b6afb: - uVar30 = 0x21; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - (GHIDRA_CAST((&RStack_22c)))->RNG::game_constructor(uVar7,uVar30); - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),0xb); - uVar7 = (GHIDRA_CAST((&RStack_22c)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::GetCenterPos(&VStack_308); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_300,vecResult,0.0,0,0,0); - Game::Spawn(g_game,5,0x14,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); - guard_check_icall(); - } - else { - do { - puVar27 = GHIDRA_CAST(std)::vector::operator_index(EVar33); - pRVar6 = GHIDRA_CAST(*puVar27); - VStack_2b4.y = (float)pRVar6; - cVar5 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::Exists(); - if (((((cVar5 == '\0') || (cVar5 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::IsDead(), cVar5 != '\0')) || - (cVar5 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity_Pickup::IsShopItem(), cVar5 != '\0')) || - ((cVar5 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::Visible(), cVar5 == '\0' || - (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity_Pickup::Timeout(), 0 < iVar41)))) || - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity_Pickup::CanReroll(), bVar4 == 0)) - goto switchD_007b66d7_caseD_b; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::Variant(); - if (uVar7 < 0x47) { - if (uVar7 == 0x46) { -LAB_007b6844: - local_2a8 = 5; - } - else { - switch(uVar7) { - case 10: - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - if ((iVar41 == 4) || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(), iVar41 == 7)) { -LAB_007b6706: - local_2a8 = 10; - } - else { - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - if (((iVar41 == 6) || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(), iVar41 == 0xb)) - || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(), iVar41 == 5)) { - local_2a8 = 6; - } - else { - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - if (iVar41 == 3) goto LAB_007b6844; - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - if ((iVar41 == 8) || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(), iVar41 == 0xc)) - { - local_2a8 = 2; - } - else { - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - local_2a8 = GHIDRA_UINT((iVar41 != 2)) * 2 + 1; - } - } - } - break; - default: - goto switchD_007b66d7_caseD_b; - case 0x1e: - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - if (((iVar41 == 3) || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(), iVar41 == 2)) || - (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(), iVar41 == 4)) goto LAB_007b6706; - goto LAB_007b6844; - case 0x28: - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - if ((iVar41 == 2) || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(), iVar41 == 4)) - goto LAB_007b6706; - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - if (iVar41 != 7) goto LAB_007b6844; - local_2a8 = 10; - break; - case 0x45: - local_2a8 = 7; - } - } -LAB_007b684f: - uVar30 = 0x10; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::InitSeed(); - (GHIDRA_CAST((&tmpRng)))->RNG::game_constructor(uVar7,uVar30); - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),10); - if (9 < local_2a8) { - VStack_2a0.y = (float)((local_2a8 - 5) / 5); - local_2a8 = local_2a8 + GHIDRA_INT(VStack_2a0.y) * -5; - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - uVar30 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - vecResult = RandomVector(&VStack_308,uVar30); - VStack_2dc.y = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - vecResult = GHIDRA_CAST(Vector)::operator_mul(vecResult); - VStack_2c4.y = 5.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_374,&VStack_2c4.y); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2b4.y))))->Entity::Position(&VStack_330); - Game::Spawn(g_game,5,0x14,vecResult2,vecResult,GHIDRA_CAST(0x0),2,uVar7); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) - 1); - } while (VStack_2a0.y != 0.0); - VStack_2a0.y = 0.0; - } - if (0 < GHIDRA_INT(local_2a8)) { - do { - uVar7 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - uVar30 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - vecResult = RandomVector(&VStack_31c,uVar30); - VStack_2f0.y = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - vecResult = GHIDRA_CAST(Vector)::operator_mul(vecResult); - VStack_2cc.y = 5.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_368,&VStack_2cc.y); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2b4.y))))->Entity::Position(&VStack_398); - Game::Spawn(g_game,5,0x14,vecResult2,vecResult,GHIDRA_CAST(0x0),1,uVar7); - local_2a8 = local_2a8 - 1; - } while (local_2a8 != 0); - } - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2b4.y))))->Entity::Position(&VStack_344); - tmpEntity = Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - pcVar1 = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - uVar36 = (GHIDRA_CAST((0x3f800000)))->Color::Color(0x40400000,0x4019999a,0x3f800000,0x3f800000,0,0,0); - (*pcVar1)(uVar36,0xffffffff,0xff,0,1); - fVar51 = VStack_2b4.y; - cVar5 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2b4.y))))->Entity::IsType(5,100,0xffffffff); - if (cVar5 == '\0') { - (**(code **)(*GHIDRA_CAST(fVar51) + 0x28))(); - } - else { - FUN_0060d1f0(4); - } - Entity_Pickup::RemoveOtherOptions(); - uVar7 = local_2ac + 1; - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),9); - local_2ac = uVar7; - guard_check_icall(); - } - else { - if (uVar7 < 0x12d) { - if ((uVar7 == 300) || (uVar7 == 0x5a)) goto LAB_007b6844; - if (uVar7 == 100) { - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->Entity::SubType(); - local_2a8 = -GHIDRA_UINT((iVar41 != 0)) & 0xf; - if (local_2a8 != 0) goto LAB_007b684f; - } - } - else if (uVar7 == 0x15e) goto LAB_007b6844; -switchD_007b66d7_caseD_b: - uVar7 = local_2ac; - VStack_2bc.y = (float)EVar33; - } - EVar33 = (EntityPtr)(GHIDRA_INT(VStack_2bc.y) + 1); - VStack_2bc.y = (float)EVar33; - EVar21 = (EntityPtr)(GHIDRA_CAST(()))->EntityList::Size(); - } while (GHIDRA_UINT(EVar33) < GHIDRA_UINT(EVar21)); - if (uVar7 == 0) { - pRVar6 = local_298; - goto LAB_007b6afb; - } - (GHIDRA_CAST((GHIDRA_CAST(local_298))))->RNG::Next(); - } - uStack_8 = 0xffffffff; - (GHIDRA_CAST((&hermitPickups)))->EntityList_Query::~EntityList_Query(); - this = GHIDRA_CAST(VStack_2d4.y); - break; - case 0x42: - Game::Darken(g_game,0x3f800000,0x3c); - Game::ShakeScreen(g_game,0x32); - VStack_2a0.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(6); - VStack_2bc.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - fVar51 = VStack_2a0.y; - if ((EntityPtr)VStack_2a0.y == (EntityPtr)0x0) { - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&uStack_2e8) + 2)),0x11c,0x11,-1,0); - } - else { - if (((((EntityPtr)VStack_2a0.y == (EntityPtr)0x1) || - ((EntityPtr)VStack_2a0.y == (EntityPtr)0x5)) || - ((EntityPtr)VStack_2a0.y == (EntityPtr)0x2)) && - ((UseActiveItem(this,GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(EStack_2e4)) + 0x2)))),0xa6,1,-1,0), - (EntityPtr)fVar51 == (EntityPtr)0x2 || ((EntityPtr)fVar51 == (EntityPtr)0x5)))) { - Game::RerollLevelPickups(g_game,VStack_2bc.y); - } - if (((EntityPtr)fVar51 == (EntityPtr)0x3) || ((EntityPtr)fVar51 == (EntityPtr)0x5)) { - Game::RerollLevelCollectibles(g_game); - UseActiveItem(this,GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(EStack_2f4)) + 0x2)))),0x69,1,-1,0); - } - if ((EntityPtr)fVar51 == (EntityPtr)0x4) { - seeds = GHIDRA_CAST(Game)::GetSeeds(g_game); - Config::GetCollectibles(); - uVar36 = _get_index_plus_one_if_kind_4_5(); - Seeds::ForgetStageSeed(seeds,uVar36); - Game::StartStageTransition(g_game,1,0,0); - } - else if ((EntityPtr)fVar51 == (EntityPtr)0x5) { - uVar7 = 0; - iVar41 = Game::GetNumPlayers(g_game); - if (iVar41 != 0) { - do { - VStack_2a0.y = (float)Game::GetPlayer(g_game,uVar7); - iVar41 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->Entity::Variant(); - if (iVar41 == 0) { - UseActiveItem(GHIDRA_CAST(VStack_2a0.y),GHIDRA_CAST((GHIDRA_INT(&VStack_314.y) + 2)),0x11c, - 0x11,-1,0); - } - uVar7 = uVar7 + 1; - uVar30 = Game::GetNumPlayers(g_game); - } while (uVar7 < uVar30); - } - } - } - break; - case 0x43: - Level::GetCurrentRoom(); - playerEffects = GHIDRA_CAST(FUN_004360d0()); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddNullEffect(0x40,1,1); - break; - case 0x44: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x41,1,1); - break; - case 0x45: - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_2ac) + 2)),0x221,3,-1,0); - break; - case 0x46: - if ((char)local_2ac != '\0') { - ExceptionList = local_10; - return; - } - iVar41 = 5; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_2a2)) + 0x1))) != 0) { - iVar41 = 10; - } - do { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x45,1,1); - iVar41 = iVar41 + -1; - } while (iVar41 != 0); - this = GHIDRA_CAST(VStack_2d4.y); - goto LAB_007b8998; - case 0x47: - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x43); - if (bVar4 == 0) { - play_sound_with_fart_seed(0x10a,2,0,0x3f800000); - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(10,3,GHIDRA_CAST(0x0)); - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x43,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x43,1,1); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_2a8) + 2)),0x21,3,-1,0); - break; - case 0x48: - uVar30 = 0x2d; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - (GHIDRA_CAST((&towerRng)))->RNG::game_constructor(uVar7,uVar30); - uStack_8 = 0xc; - memset(gridMarks,0,0x1c0); - local_298 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar7 = (GHIDRA_CAST(()))->EntityList::Size(); - local_2a8 = uVar7; - local_2ac = (GHIDRA_CAST((local_298)))->Room::GetGridHeight(); - VStack_2cc.y = (float)(local_2ac * uVar7); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,&towerEffects,1000,0xa1,-1,0,0); - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),0xd); - if (0 < GHIDRA_INT(VStack_2cc.y)) { - uVar7 = 0; - pRVar6 = local_298; - do { - fVar51 = 0.0; - vecResult = (GHIDRA_CAST((pRVar6)))->Room::GetGridPosition(&VStack_308,uVar7); - bVar4 = (GHIDRA_CAST((pRVar6)))->Room::IsPositionInRoom(vecResult,fVar51); - if (bVar4 != 0) { - VStack_2a0.y = (float)(GHIDRA_CAST((pRVar6)))->Room::GetGridEntity(uVar7); - uVar30 = (GHIDRA_CAST((pRVar6)))->Room::GetGridCollision(uVar7); - if (uVar30 == 0) { - if ((EntityPtr)VStack_2a0.y != (EntityPtr)0x0) { - (GHIDRA_CAST(()))->GridEntity::GetType(); - cVar5 = is_grid_type_floor_special(); - if (cVar5 != '\0') goto LAB_007b6f0b; - } - VStack_2b4.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - if (iVar41 != 0) { - do { - puVar27 = GHIDRA_CAST(std)::vector::operator_index(VStack_2b4.y); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(*puVar27))))->Entity::Position(&VStack_300); - uVar30 = (GHIDRA_CAST((local_298)))->Room::GetGridIndex(vecResult); - if (uVar30 == uVar7) { - pRVar6 = local_298; - goto LAB_007b6f0b; - } - VStack_2b4.y = (float)(GHIDRA_INT(VStack_2b4.y) + 1); - pRVar6 = GHIDRA_CAST((GHIDRA_CAST(()))->EntityList)::Size(); - } while (GHIDRA_UINT(VStack_2b4.y) < pRVar6); - pRVar6 = local_298; - } - gridMarks[uVar7] = '\x05'; - } - } -LAB_007b6f0b: - uVar7 = uVar7 + 1; - } while (GHIDRA_INT(uVar7) < GHIDRA_INT(VStack_2cc.y)); - uVar7 = local_2a8; - this = GHIDRA_CAST(VStack_2d4.y); - } - EStack_2f4 = (EntityPtr)(uVar7 - 1); - VStack_2a0.y = 1.4013e-45; - if (1 < GHIDRA_INT(EStack_2f4)) { - iVar41 = uVar7 - 1; - VStack_2c4.y = (float)(local_2ac - 1); - do { - if (1 < GHIDRA_INT((local_2ac - 1))) { - markAbove = gridMarks + GHIDRA_INT(VStack_2a0.y); - markBelow = gridMarks + GHIDRA_INT((GHIDRA_INT(VStack_2a0.y) + uVar7 * 2)); - VStack_2dc.y = (float)(-1 - uVar7); - markCell = markAbove + uVar7; - VStack_2bc.y = (float)(1 - uVar7); - iVar41 = local_2ac - 2; - do { - if ((((*markCell != '\0') && (uVar7 = local_2a8, markBelow[GHIDRA_INT(VStack_2bc.y)] != '\0')) && - (markBelow[GHIDRA_INT(((GHIDRA_CAST(VStack_2dc.y))->_roomList + -1)) + 0xa4] != '\0')) && - ((*markBelow != '\0' && (*markAbove != '\0')))) { - *markCell = '2'; - } - markBelow = markBelow + uVar7; - markAbove = markAbove + uVar7; - markCell = markCell + uVar7; - iVar41 = iVar41 + -1; - } while (iVar41 != 0); - iVar41 = uVar7 - 1; - } - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + 1); - } while (GHIDRA_INT(VStack_2a0.y) < iVar41); - this = GHIDRA_CAST(VStack_2d4.y); - } - VStack_2b4.y = 0.0; - do { - FUN_00424510(); - fVar51 = VStack_2cc.y; - iVar41 = 0; - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),0xe); - isAnyMarked = false; - if (GHIDRA_INT(VStack_2cc.y) < 1) { -LAB_007b73c1: - msvc::vector::_Tidy(); - break; - } - do { - if (gridMarks[iVar41] != '\0') { - WeightedOutcomePicker::AddOutcomeWeight(outcomePicker,iVar41,GHIDRA_INT(gridMarks[iVar41]),0); - isAnyMarked = true; - } - iVar41 = iVar41 + 1; - } while (iVar41 < GHIDRA_INT(fVar51)); - this = GHIDRA_CAST(VStack_2d4.y); - if (!isAnyMarked) goto LAB_007b73c1; - rng._shift1 = towerRng._shift1; - rng._seed = towerRng._seed; - rng._shift2 = towerRng._shift2; - rng._shift3 = towerRng._shift3; - uVar7 = (GHIDRA_CAST((outcomePicker)))->WeightedOutcomePicker::PickOutcome(rng); - vecResult = (GHIDRA_CAST((local_298)))->Room::GetGridPosition(&VStack_308,uVar7); - fVar51 = (GHIDRA_CAST((&towerRng)))->RNG::RandomFloat(); - VStack_2a0.y = fVar51 * 36.0 - 18.0; - fVar51 = (GHIDRA_CAST((&towerRng)))->RNG::RandomFloat(); - VStack_2bc.y = fVar51 * 36.0 - 18.0; - vecResult2 = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - (GHIDRA_CAST((vecResult)))->Vector::__add(&VStack_314,vecResult2); - VStack_2bc.y = 0.0; - iVar41 = GHIDRA_INT(uVar7) % GHIDRA_INT(local_2a8); - VStack_2c4.y = (float)(GHIDRA_INT(uVar7) / GHIDRA_INT(local_2a8)); - VStack_2a0.y = (float)(iVar41 + -2); - puVar27 = GHIDRA_CAST(std)::max(); - pLVar22 = GHIDRA_CAST(*puVar27); - EStack_2e4 = (EntityPtr)(iVar41 + 2); - VStack_2bc.y = (float)EStack_2f4; - VStack_2dc.y = (float)pLVar22; - VStack_2a0.y = (float)EStack_2e4; - piVar37 = GHIDRA_CAST(std)::min(); - if (GHIDRA_INT(pLVar22) <= *piVar37) { - uStack_2e8 = (float)(GHIDRA_INT(VStack_2c4.y) - 2); - pRVar6 = GHIDRA_CAST((GHIDRA_INT(VStack_2c4.y) + 2)); - VStack_2f0.y = (float)pRVar6; - do { - VStack_2bc.y = 0.0; - VStack_2a0.y = uStack_2e8; - pfVar16 = GHIDRA_CAST(std)::max(); - fVar51 = *pfVar16; - VStack_2bc.y = (float)(local_2ac - 1); - VStack_2c4.y = fVar51; - VStack_2a0.y = (float)pRVar6; - piVar37 = GHIDRA_CAST(std)::min(); - if (GHIDRA_INT(fVar51) <= *piVar37) { - uVar7 = GHIDRA_INT((GHIDRA_CAST((GHIDRA_INT(VStack_2dc.y) + 0x14)))->_doors) + - GHIDRA_INT(fVar51) * local_2a8 + -0x30; - do { - if (gridMarks[uVar7] != '\0') { - (GHIDRA_CAST((local_298)))->Room::GetGridPosition(&VStack_358,uVar7); - VStack_2a0.y = (GHIDRA_CAST((&VStack_358)))->Vector::DistanceSquared(&VStack_314); - if (5625.0 < VStack_2a0.y) { - gridMarks[uVar7] = '\x01'; - } - else { - if (0x1bf < uVar7) { - /* WARNING: Subroutine does not return */ - FUN_00aef86f(); - } - gridMarks[uVar7] = '\0'; - uVar30 = (GHIDRA_CAST((&towerRng)))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = (GHIDRA_CAST((pRVar6)))->Room::GetGridPosition(&VStack_374,uVar7); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xb1,vecResult,&g_vectorZero, - GHIDRA_CAST(VStack_2d4.y),1,uVar30); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(GHIDRA_INT(VStack_2b4.y)); - effect->Update(); - fVar51 = VStack_2c4.y; - } - } - uVar7 = uVar7 + local_2a8; - VStack_2a0.y = VStack_2f0.y; - fVar51 = (float)(GHIDRA_INT(fVar51) + 1); - VStack_2bc.y = (float)(local_2ac - 1); - VStack_2c4.y = fVar51; - piVar37 = GHIDRA_CAST(std)::min(); - } while (GHIDRA_INT(fVar51) <= *piVar37); - pRVar6 = GHIDRA_CAST(VStack_2f0.y); - } - VStack_2a0.y = (float)EStack_2e4; - pLVar22 = GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(VStack_2dc.y)) + 1)); - VStack_2bc.y = (float)EStack_2f4; - VStack_2dc.y = (float)pLVar22; - piVar37 = GHIDRA_CAST(std)::min(); - } while (GHIDRA_INT(pLVar22) <= *piVar37); - } - uVar7 = (GHIDRA_CAST((&towerRng)))->RNG::Next(); - this = GHIDRA_CAST(VStack_2d4.y); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xb1,&VStack_314,&g_vectorZero,GHIDRA_CAST(VStack_2d4.y),0, - uVar7); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(GHIDRA_INT(VStack_2b4.y)); - effect->Update(); - msvc::vector::_Tidy(); - VStack_2b4.y = (float)(GHIDRA_INT((GHIDRA_INT(VStack_2b4.y) + 4)) + 1); - } while (GHIDRA_INT(VStack_2b4.y) < 0x23); - (GHIDRA_CAST((&towerEffects)))->EntityList_Query::~EntityList_Query(); - uStack_8 = 0xffffffff; - guard_check_icall(); - break; - case 0x49: - Config::GetCollectibles(); - VStack_2bc.y = (float)FUN_0042c7f0(); - if (0 < GHIDRA_INT(VStack_2bc.y)) { - iVar41 = 0; - do { - Config::GetCollectibles(); - piVar37 = GHIDRA_CAST(FUN_005cbe00(iVar41)); - if (((char)piVar37[1] == '\0') && (0 < *piVar37)) { - Config::GetCollectibles(); - iVar17 = FUN_005cbe00(iVar41); - VStack_2a0.y = *GHIDRA_CAST((iVar17 + 8)); - bVar4 = CanRerollCollectible(this,GHIDRA_INT(VStack_2a0.y),0); - if (bVar4 != 0) { - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,GHIDRA_INT(VStack_2a0.y)); - if ((configItem->type != 3) && (piVar37 = GHIDRA_CAST(FUN_0042c810(VStack_2a0.y)), 0 < *piVar37)) - { - RemoveCollectibleByHistoryIndex(this,iVar41,1); - AnimateCollectible(this,GHIDRA_INT(VStack_2a0.y),GHIDRA_CAST("Pickup"), - GHIDRA_CAST("PlayerPickupSparkle")); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x46,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x46,1,1); - goto LAB_007b8998; - } - } - } - iVar41 = iVar41 + 1; - } while (iVar41 < GHIDRA_INT(VStack_2bc.y)); - } - break; - case 0x4a: - Config::GetCollectibles(); - uVar52 = 1; - uVar36 = 0x1d; -LAB_007b34ad: - iVar41 = Level::QueryRoomTypeIndex(uVar36,0,pRVar6,uVar52); - if (-1 < iVar41) { - Config::GetCollectibles(); - FUN_00428ae0(0xffffffff); - Game::StartRoomTransition(g_game,iVar41,-1,3,this,-1); - goto LAB_007b8998; - } - break; - case 0x4b: - bVar4 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x42); - if (bVar4 == 0) { - itemOverlay = GHIDRA_CAST(Game)::GetItemOverlay(g_game); - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(0x2b,0,GHIDRA_CAST(0x0)); - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x42,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x42,1,1); - if ((0 < this->_maxHearts) && (iVar41 = GetHealthType(this), iVar41 == 0)) { - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - if (cVar5 == '\0') { - iVar41 = this->_maxHearts; - this->_maxHearts = 0; - iVar41 = iVar41 / 2; - this->_boneHearts = this->_boneHearts + iVar41; - this->_boneHeartsMask = - this->_boneHeartsMask << ((uint8_t)iVar41 & 0x1f) | (1 << ((uint8_t)iVar41 & 0x1f)) - 1U; - UpdateHeartDependentEffects(this); - this->_reverseSunBoneHearts = iVar41; - break; - } - } - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - if (cVar5 != '\0') { - this->_boneHearts = this->_boneHearts + this->_redHearts; - this->_maxHearts = 0; - this->_redHearts = 0; - } - break; - case 0x4c: - play_sound_with_fart_seed(0x109,2,0,0x3f800000); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_308,&this->_pos,40.0,0,0,0); - pRVar6 = GHIDRA_CAST(0xa); -LAB_007b31f0: - tmpEntity = Game::Spawn(g_game,6,GHIDRA_UINT(pRVar6),vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - (GHIDRA_CAST((tmpEntity)))->Entity::AddEntityFlags(4); - break; - case 0x4d: - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(); - VStack_2a0.y = (float)(GHIDRA_CAST((pRVar6)))->Room::GetGridIndex(&this->_pos); - if (-1 < GHIDRA_INT(VStack_2a0.y)) { - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar7 = Random(); - (GHIDRA_CAST((pRVar6)))->Room::SpawnGridEntity(GHIDRA_INT(VStack_2a0.y),0x12,0,uVar7,0); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - VStack_2a0.y = (float)(GHIDRA_CAST((pRVar6)))->Room::GetGridEntity(GHIDRA_UINT(VStack_2a0.y)); - if ((EntityPtr)VStack_2a0.y != (EntityPtr)0x0) { - iVar41 = (GHIDRA_CAST(()))->GridEntity::GetType(); - if (iVar41 == 0x12) { - iVar41 = (GHIDRA_CAST(()))->GridEntity::GetVariant(); - if (iVar41 == 0) { - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - Level::SetStateFlag(pLVar22,0xd,1); - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->GridEntity::Position(&VStack_308); - tmpEntity = Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - tmpEntity->Update(); - } - } - } - } - break; - case 0x4e: - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_298) + 2)),0x244,1,-1,0); - break; - case 0x4f: - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(0x14); - VStack_2bc.y = (float)(uVar7 + 1); - VStack_2a0.y = 0.0; - if ((EntityPtr)VStack_2bc.y != (EntityPtr)0x0) { - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_308,&this->_pos,40.0,0,0,0); - tmpEntity = Game::Spawn(g_game,5,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),1,uVar7); - FUN_005b19f0(VStack_2a0.y); - tmpEntity->Update(); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + 1); - pRVar6 = local_298; - } while (GHIDRA_UINT(VStack_2a0.y) < GHIDRA_UINT(VStack_2bc.y)); - } - break; - case 0x50: - if (-1 < (char)(uint8_t)useFlag) { - bVar4 = this->_wildCardItemType; - if (bVar4 == 1) { - UseCard(this,this->_wildCardItem,0x180); - } - else if (bVar4 == 0) { - UsePill(this->_wildCardItem,this->_wildCardVarData,0x180); - if (this->_cacheFlags != 0) { - InvalidateCoPlayerItems(this); - EvaluateItems(); - } - } - else if (bVar4 == 2) { - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_298) + 2)),this->_wildCardItem,0x484,-1, - this->_wildCardVarData); - TriggerBookOfVirtues(this->_wildCardItem,0); - goto LAB_007b8998; - } - } - break; - case 0x51: - Level::GetCurrentRoom(); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(&RStack_20c),5,100,-1,0,0); - uStack_8 = 0xf; - EVar33 = (EntityPtr)0x0; - VStack_2a0.y = 0.0; - iVar41 = (GHIDRA_CAST(()))->EntityList::Size(); - pRVar6 = local_298; - if (iVar41 != 0) { - do { - puVar27 = GHIDRA_CAST(std)::vector::operator_index(EVar33); - tmpEntity = GHIDRA_CAST(*puVar27); - cVar5 = (GHIDRA_CAST((tmpEntity)))->Entity::IsDead(); - if (cVar5 == '\0') { - iVar41 = (GHIDRA_CAST((tmpEntity)))->Entity::SubType(); - if (iVar41 != 0) { - EVar33 = (EntityPtr)FUN_00435e30(); - VStack_2bc.y = (float)EVar33; - if (((EVar33 != (EntityPtr)0x0) && - ((iVar41 = (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity_Pickup::OptionsPickupIndex(), iVar41 == 0 - || (iVar41 = (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity_Pickup::Timeout(), iVar41 < 0)))) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity_Pickup::CanReroll(), bVar4 != 0)) { - pRVar20 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - iVar41 = (GHIDRA_CAST((pRVar20)))->Room::GetSeededCollectible(uVar7,0); - FUN_006daca0(iVar41); - uVar7 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2bc.y))))->Entity::Position(&VStack_308); - tmpEntity = Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - tmpEntity->Update(); - } - } - } - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + 1); - EVar21 = (EntityPtr)(GHIDRA_CAST(()))->EntityList::Size(); - EVar33 = (EntityPtr)VStack_2a0.y; - } while (GHIDRA_UINT(VStack_2a0.y) < GHIDRA_UINT(EVar21)); - this = GHIDRA_CAST(VStack_2d4.y); - } - uStack_8 = 0xffffffff; - (GHIDRA_CAST((&RStack_20c)))->EntityList_Query::~EntityList_Query(); - break; - case 0x52: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x72,1,1); - break; - case 0x53: - SoundEffects::PlayWithFartOverride(0xcc,2,0,0x3f800000); - VStack_2b4.y = 0.0; - do { - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - level = GHIDRA_CAST(Config)::GetCollectibles(); - iVar41 = Level::GetCurrentRoomIndex(level); - bVar4 = Level::CanSpawnDoorOutline(pLVar22,iVar41,GHIDRA_UINT(VStack_2b4.y)); - if (bVar4 != 0) { - Config::GetCollectibles(); - pLVar22 = GHIDRA_CAST(Config)::GetCollectibles(); - uVar36 = Level::GetCurrentRoomIndex(pLVar22); - Level::MakeRedRoomDoor(uVar36,VStack_2b4.y); - } - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - fVar51 = VStack_2b4.y; - VStack_2a0.y = (float)(GHIDRA_CAST((pRVar6)))->Room::GetDoor(GHIDRA_INT(VStack_2b4.y)); - if ((((EntityPtr)VStack_2a0.y != (EntityPtr)0x0) && - (cVar5 = FUN_0056ff60(0x10), cVar5 == '\0')) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->GridEntity_Door::TryUnlock(this,1), bVar4 == 0)) { - (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->GridEntity_Door::Open(); - (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->GridEntity_Door::TryBlowOpen(0,GHIDRA_CAST(0x0)); - } - VStack_2b4.y = (float)(GHIDRA_INT(fVar51) + 1); - } while (GHIDRA_INT(VStack_2b4.y) < 8); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - playerEffects = GHIDRA_CAST(FUN_004360d0()); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddCollectibleEffect(0xaf,1,1); - break; - case 0x54: - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x2c1); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - darkArtsCooldown = 0x5a - darkArtsCooldown; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(darkArtsEffect,1,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x80,1,1); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((pRVar6)))->Room::SetPauseTimer(0x5a); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&VStack_2d4.y) + 2)),0x2c1,9,-1,0); - break; - case 0x55: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x73,1,1); - play_sound_with_fart_seed(0x25,2,0,0x3f800000); - play_sound_with_fart_seed(0x95,2,0,0x3fc00000); - uVar7 = Random(); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xc3,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),1,uVar7); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x24); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetParent(GHIDRA_CAST(this)); - effect->Update(); - break; - case 0x56: - VStack_2a0.y = 2.10195e-44; - do { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - FUN_0043eed0(&VStack_2b4); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - random_float(); - VStack_2dc.y = -80.0 - in_XMM0_Da * 120.0; - vecResult = MusicManager::RandomVector(&VStack_308); - VStack_2bc.y = 1000.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_300,&VStack_2bc.y); - vecResult = (GHIDRA_CAST((&VStack_2b4)))->Vector::__add(&VStack_374,vecResult); - vecResult = (GHIDRA_CAST((pRVar6)))->Room::GetClampedPosition(&VStack_330,vecResult,VStack_2dc.y); - (GHIDRA_CAST((&VStack_2b4)))->Vector::operator_assign(vecResult); - uVar7 = Random(); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xc5,&VStack_2b4,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - VStack_2dc.y = *GHIDRA_CAST((*GHIDRA_CAST(effect) + 0x40)); - bVar4 = HasCollectible(this,0xf7,0); - if (bVar4 == 0) { - in_XMM0_Da = 1.0; - } - else { - in_XMM0_Da = 2.0; - } - (*(code *)VStack_2dc.y)(in_XMM0_Da); - iVar41 = Isaac::Random(0x96); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(iVar41 + 300); - iVar41 = Isaac::Random(0x5a); - (GHIDRA_CAST((effect)))->Entity_Effect::set_state(iVar41); - effect->Update(); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - } while ((EntityPtr)VStack_2a0.y != (EntityPtr)0x0); - break; - case 0x57: - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x2c0); - (GHIDRA_CAST((configItem)))->TemporaryEffect::TemporaryEffect(); - berserkCooldown = 300; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(tmpEffect,1,1); - play_sound_with_fart_seed(0x250,2,0,0x3f800000); - play_sound_with_fart_seed(0x28a,2,0,0x3f800000); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - Level::UpdateBackwardsPathStages(); - break; - case 0x58: - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - iVar41 = 0xf0; - if (cVar5 != '\0') { - iVar41 = 0x5a; - } - this->_megaBlastDuration = iVar41; - itemConfig = Isaac::GetItemConfig(); - bVar4 = 0; - configItem = (GHIDRA_CAST((itemConfig)))->Config::GetNullItem(0x1f); - AddCostume(this,configItem,bVar4); - break; - case 0x59: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x71,-1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x71,1,1); - pcVar1 = *(code **)(*GHIDRA_CAST(this) + 0x24); - sourceRef = (GHIDRA_CAST((&soulLazarusRef)))->EntityRef::EntityRef(); - (*pcVar1)(sourceRef); - *GHIDRA_CAST(&this->_lastDamageFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_lastDamageFlags) + 4)) = 0; - (this->_lastDamageSource)._type = 0; - (this->_lastDamageSource)._variant = 0; - goto LAB_007b8998; - case 0x5a: - Level::GetCurrentRoom(); - playerEffects = GHIDRA_CAST(FUN_004360d0()); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddCollectibleEffect(0x192,1,1); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&VStack_2d4.y) + 2)),0x69,1,-1,0); - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_298) + 2)),0xa6,1,-1,0); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - playerEffects = GHIDRA_CAST(FUN_004360d0()); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x192,-1); - break; - case 0x5b: - spawn_ghost_corpse(); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x70,-1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x70,1,2); - iVar41 = GetPlayerType(this); - if (iVar41 != 10) { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x139,1,1); - (GHIDRA_CAST(("Shimmer")))->msvc::string::string_from_cstr(); - uStack_8 = 0x10; - PlayCollectibleAnim(this,0x139,1,&EStack_254._position,0xffffffff,0); - uStack_8 = 0xffffffff; - (GHIDRA_CAST(()))->msvc::string::_Tidy_deallocate(); - } - break; - case 0x5c: - FUN_00424510(); - uStack_8 = 0x11; - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - pool = ItemPool::GetPool(itemPool,0x1c); - VStack_2b4.y = (float)&pool->_poolList; - VStack_2cc.y = 0.0; - iVar41 = FUN_00414410(); - if (iVar41 != 0) { - do { - iVar41 = FUN_004143f0(VStack_2cc.y); - if (*GHIDRA_CAST((iVar41 + 0x14)) != '\0') { - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - if (cVar5 != '\0') { - Game::GetField26614(g_game); - piVar37 = GHIDRA_CAST((GHIDRA_CAST(()))->EntityList)::Size(); - pcVar1 = *(code **)(*piVar37 + 0x30); - puVar27 = GHIDRA_CAST(FUN_004143f0(VStack_2cc.y)); - cVar5 = (*pcVar1)(*puVar27); - if (cVar5 != '\0') goto LAB_007b81fb; - this = GHIDRA_CAST(VStack_2d4.y); - } - itemConfig = Isaac::GetItemConfig(); - piVar37 = GHIDRA_CAST(FUN_004143f0(VStack_2cc.y)); - configItem = ItemConfig::GetCollectible(itemConfig,*piVar37); - if ((configItem != GHIDRA_CAST(0x0)) && (configItem->type == 4)) { - bVar4 = (GHIDRA_CAST((configItem)))->Item::HasTags(0x8000000); - if ((bVar4 == 0) || (bVar4 = HasCollectible(this,configItem->id,0), bVar4 == 0)) { - msvc::vector::push_back(&configItem->id); - } - } - } -LAB_007b81fb: - puVar47 = GHIDRA_CAST((GHIDRA_INT(VStack_2cc.y) + 1)); - VStack_2cc.y = (float)puVar47; - puVar28 = GHIDRA_CAST(FUN_00414410()); - this = GHIDRA_CAST(VStack_2d4.y); - } while (puVar47 < puVar28); - pRVar6 = local_298; - } - cVar5 = FUN_004bc660(); - if (cVar5 == '\0') { - uVar7 = (GHIDRA_CAST(()))->msvc::vector::size(); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(uVar7); - entryPtr = GHIDRA_CAST(FUN_0042c810(uVar7)); - EVar33 = *entryPtr; - VStack_2a0.y = (float)EVar33; - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,GHIDRA_INT(EVar33)); - if ((useFlag & 0x800) == 0) { - hud = GHIDRA_CAST(Game)::GetHUD(g_game); - HUD::ShowItemText(hud,this,configItem); - } - SoundEffects::PlayWithFartOverride(0x80,2,0,0x3f800000); - AnimateCollectible(this,GHIDRA_INT(VStack_2a0.y),GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - SetQueuedItem(configItem,0xffffffff,0,0,0xffffffff); - isPlayAnim = 0; - } - uStack_8 = 0xffffffff; - FID_conflict__Tidy(outcomePicker); - break; - case 0x5d: - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(0x19); - VStack_2bc.y = (float)(uVar7 + 1); - VStack_2a0.y = 0.0; - if ((EntityPtr)VStack_2bc.y != (EntityPtr)0x0) { - do { - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::Next(); - pRVar6 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::FindFreePickupSpawnPosition(pRVar6,&VStack_308,&this->_pos,40.0,0,0,0); - tmpEntity = Game::Spawn(g_game,5,0x14,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); - FUN_005b19f0(VStack_2a0.y); - tmpEntity->Update(); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + 1); - pRVar6 = local_298; - } while (GHIDRA_UINT(VStack_2a0.y) < GHIDRA_UINT(VStack_2bc.y)); - } - break; - case 0x5e: - VStack_2a0.y = 0.0; - Game::GetField26614(g_game); - FUN_00429550(); - VStack_2bc.y = (float)&this->_pos; - do { - uVar7 = Random(); - uVar30 = (GHIDRA_CAST((GHIDRA_CAST(pRVar6))))->RNG::RandomInt(5); - vecResult = MusicManager::RandomVector(&VStack_308); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2bc.y))))->Vector::__add(&VStack_300,vecResult); - this = GHIDRA_CAST(VStack_2d4.y); - tmpEntity = Game::Spawn(g_game,3,0x2b,vecResult,&g_vectorZero,GHIDRA_CAST(VStack_2d4.y),uVar30 + 1, - uVar7); - tmpEntity->Update(); - EVar33 = (EntityPtr)(GHIDRA_INT(VStack_2a0.y) + 1); - VStack_2a0.y = (float)EVar33; - Game::GetField26614(g_game); - cVar5 = FUN_00429550(); - iVar41 = 0xf; - if (cVar5 != '\0') { - iVar41 = 10; - } - pRVar6 = local_298; - } while (GHIDRA_INT(EVar33) < iVar41); - break; - case 0x5f: - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(); - EVar33 = (EntityPtr)PlayerManager::SpawnCoPlayer2(playerManager,0x10); - VStack_2a0.y = (float)EVar33; - SetControllerIndex(GHIDRA_CAST(EVar33),this->_controllerIndex,0); - (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity::SetParent(GHIDRA_CAST(this)); - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&VStack_300,vecResult); - (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity::SetPosition(vecResult); - playerEffects = GHIDRA_CAST(GetEffects(GHIDRA_CAST(EVar33))); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddNullEffect(0x78,1,1); - init_forgotten_twin(GHIDRA_CAST(EVar33)); - InitPostLevelInitStats(GHIDRA_CAST(EVar33)); - AddBoneHearts(GHIDRA_CAST(EVar33),1); - AddHearts(GHIDRA_CAST(EVar33),2,1,0); - uVar7 = Random(); - vecResult = &VStack_440; - goto LAB_007b850e; - case 0x60: - VStack_2a0.y = 8.40779e-45; - do { - rngSource = GHIDRA_CAST(FUN_005cbd00(0x2ad)); - Isaac::GetItemConfig(); - Config::GetCollectibles(); - iVar41 = (GHIDRA_CAST(()))->msvc::vector::size(); - uVar7 = (GHIDRA_CAST((rngSource)))->RNG::RandomInt(iVar41 - 1); - VStack_2bc.y = (float)(uVar7 + 1); - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,uVar7 + 1); - if (((configItem == GHIDRA_CAST(0x0)) || - (cVar5 = ItemConfig::IsValidCollectible(VStack_2bc.y), cVar5 == '\0')) || - (configItem->type != 3)) { - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x248); - } - if ((configItem[1].type == 0) || (*GHIDRA_CAST((configItem[1].type + 400)) < 1)) { - itemConfig = Isaac::GetItemConfig(); - configItem = ItemConfig::GetCollectible(itemConfig,0x248); - } - AddWisp(this,configItem->id,&this->_pos,1,0); - VStack_2a0.y = (float)(GHIDRA_INT(VStack_2a0.y) + -1); - } while ((EntityPtr)VStack_2a0.y != (EntityPtr)0x0); - SoundEffects::PlayWithFartOverride2(0x1d7,&this->_pos,2,0,0x3f800000); - break; - case 0x61: - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(); - EVar33 = (EntityPtr)PlayerManager::SpawnCoPlayer2(playerManager,0x14); - VStack_2a0.y = (float)EVar33; - SetControllerIndex(GHIDRA_CAST(EVar33),this->_controllerIndex,0); - (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity::SetParent(GHIDRA_CAST(this)); - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Vector)::Vector(); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&VStack_308,vecResult); - (GHIDRA_CAST((GHIDRA_CAST(EVar33))))->Entity::SetPosition(vecResult); - playerEffects = GHIDRA_CAST(GetEffects(GHIDRA_CAST(EVar33))); - (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddNullEffect(0x79,1,1); - init_forgotten_twin(GHIDRA_CAST(EVar33)); - InitPostLevelInitStats(GHIDRA_CAST(EVar33)); - VStack_2c4.y = (float)FUN_005cbd00(0x2bf); - VStack_2cc.y = (float)(GHIDRA_INT(EVar33) + 0x1dec); - FUN_005b16f0(1); - VStack_2dc.y = (float)Config::GetCollectibles(); - msvc::iterator_copy(&local_298); - uVar36 = FUN_00456190(&VStack_2f0.y); - cVar5 = FUN_0042c710(uVar36); - while (cVar5 != '\0') { - iVar41 = EntityPtr::Ref(); - if (*GHIDRA_CAST((iVar41 + 4)) == '\0') { - iVar41 = EntityPtr::Ref(); - piVar37 = GHIDRA_CAST(FUN_0042c810(*GHIDRA_CAST((iVar41 + 8)))); - if (0 < *piVar37) { - itemConfig = Isaac::GetItemConfig(); - iVar41 = EntityPtr::Ref(); - configItem = ItemConfig::GetCollectible(itemConfig,*GHIDRA_CAST((iVar41 + 8))); - if (configItem->type != 3) { - bVar4 = 0; - iVar41 = EntityPtr::Ref(); - bVar4 = CanRerollCollectible(this,*GHIDRA_CAST((iVar41 + 8)),bVar4); - if (bVar4 != 0) { - piVar37 = GHIDRA_CAST(EntityPtr)::Ref(); - EStack_254._spawnerVariant = *piVar37; - EStack_254._position.x = (float)piVar37[1]; - EStack_254._velocity.x = (float)piVar37[3]; - EStack_254._velocity.y = (float)piVar37[4]; - EStack_254._flags = piVar37[5]; - EStack_254._entity = (void *)piVar37[6]; - uStack_8 = 0x12; - EStack_254._position.y = 0.0; - VStack_2bc.y = 0.0; - do { - if (EStack_254._position.y != 0.0) goto LAB_007b8881; - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(VStack_2c4.y))))->RNG::Next(); - iVar41 = EntityPtr::Ref(); - EStack_254._position.y = - (float)ItemPool::GetCollectible(itemPool,*GHIDRA_CAST((iVar41 + 0x18)),uVar7,7,0,0); - if (EStack_254._position.y == 8.67404e-43) { - EStack_254._position.y = 0.0; - } - VStack_2bc.y = (float)(GHIDRA_INT(VStack_2bc.y) + 1); - } while (GHIDRA_INT(VStack_2bc.y) < 10); - if (EStack_254._position.y != 0.0) { -LAB_007b8881: - AddCollectible(GHIDRA_CAST(VStack_2a0.y),GHIDRA_INT(EStack_254._position.y),0,1,0,0,0); - itemConfig = Isaac::GetItemConfig(); - iVar41 = EntityPtr::Ref(); - ItemConfig::GetCollectible(itemConfig,*GHIDRA_CAST((iVar41 + 8))); - Config::GetCollectibles(); - FUN_007221a0(&EStack_254._spawnerVariant); - } - uStack_8 = 0xffffffff; - guard_check_icall(); - this = GHIDRA_CAST(VStack_2d4.y); - } - } - } - } - FUN_005cba20(); - uVar36 = FUN_00456190(&VStack_2f0.y); - cVar5 = FUN_0042c710(uVar36); - } - FUN_005b16f0(0); - uVar7 = Random(); - vecResult = &VStack_488; -LAB_007b850e: - tmpEntity = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x1d9c)))); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(VStack_2a0.y))))->Entity::Position(vecResult); - tmpEntity = Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,tmpEntity,0,uVar7); - tmpEntity->Update(); - this = GHIDRA_CAST(VStack_2d4.y); - break; - default: - Isaac::GetItemConfig(); - Config::GetCards(); - iVar41 = (GHIDRA_CAST(()))->msvc::vector::size(); - if (iVar41 <= card) { - /* WARNING: Subroutine does not return */ - KAGE_LogMessage(1,"Warning: Card % don\'t exist\n",card); - } - } - if (isPlayAnim != 0) { - AnimateCard(this,card,"UseItem"); - } -LAB_007b8998: - if ((isPlayAnnouncer != '\0') && (*GHIDRA_CAST((cardConfig + 0x5c)) != 0)) { - PlayDelayedSFX(this,*GHIDRA_CAST((cardConfig + 0x5c)),*GHIDRA_CAST((cardConfig + 0x60)),announcerDelay); - } - FUN_00863cc0(card,this,useFlag); - ExceptionList = local_10; - return; -LAB_007b3bf0: - pfVar16 = pfVar16 + 2; - VStack_2b4.y = (float)(GHIDRA_INT(VStack_2b4.y) + 1); - if (GHIDRA_CAST(0x3) < GHIDRA_UINT(VStack_2b4.y)) goto LAB_007b3c4c; - goto LAB_007b3be0; -} - -// 007b8cb0 -void Entity_Player::update_footprints() -{ - float fVar1; - int iVar2; - uint8_t bVar3; - Vector *tmpVec; - uint32_t rngResult; - uint32_t rngResult2; - Entity *spawned; - int *splat; - ColorMod *color; - KColor *color_00; - int unusedArg; - int effectTimeout; - float oldOffsetBlue; - double dVar5; - uint32_t uVar6; - TypeDescriptor *pTVar7; - void *pvVar8; - uint8_t auStack_13a [2]; - uint8_t quad [112]; - uint32_t shaderColor; - uint32_t uStack_bc; - uint32_t uStack_b8; - uint32_t uStack_b4; - uint32_t local_b0; - float floorRed; - float floorGreen; - float floorBlue; - KColor tmpKColor; - int savedBlendMode0; - int savedBlendMode1; - Vector VStack_7c; - Vector local_74; - Vector local_6c; - Entity_Player *local_64; - Vector local_60; - Vector local_58; - float local_50; - Vector local_4c; - uint8_t *local_44; - Color tmpColor; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - float local_8; - Manager *manager; - float oldOffsetBlue; - float oldOffsetGreen; - float oldOffsetRed; - code *sampleColorFn; - - local_8 = -NAN; - puStack_c = &LAB_00affd9d; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((&tmpColor)[1]._colorize); - ExceptionList = &local_10; - if (((this->_variant == 0) && (this->_isCoopGhost == 0)) && - (local_64 = this, bVar3 = IsHologram(this), bVar3 == 0)) { - if ((this->_footprintColor2)._tint[3] == 0.0) { - local_58.y = ((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5; - local_60.y = g_displayPixelRatio * g_screenPointScale; - local_44 = (uint8_t *) - ((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_60.y + - 0.5); - dVar5 = floor((double)(float)local_44); - VStack_7c.y = (float)dVar5 / local_60.y; - local_44 = GHIDRA_CAST((local_58.y * local_60.y + 0.5)); - dVar5 = floor((double)(float)local_44); - local_44 = GHIDRA_CAST(((float)dVar5 / local_60.y)); - pvVar8 = g_game->_room; - local_60.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x11fc)); - local_58.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x1200)); - (GHIDRA_CAST((&local_4c)))->shared_ptr::assign((void *)(GHIDRA_INT(pvVar8) + 0x1bc8)); - local_8 = 0.0; - sampleColorFn = *(code **)(*GHIDRA_CAST(local_4c.x) + 0x2c); - __ftoui3(); - __ftoui3(); - (*sampleColorFn)(&tmpKColor); - local_8 = -NAN; - FUN_0041c710(); - this = local_64; - local_60.y = (float)&local_64->_footprintColor2; - (local_64->_footprintColor2)._tint[3] = 1.0; - (GHIDRA_CAST(local_60.y))->_tint[0] = 0.0; - (local_64->_footprintColor2)._tint[1] = 0.0; - (local_64->_footprintColor2)._tint[2] = 0.0; - (local_64->_footprintColor2)._tint[3] = 0.7; - (local_64->_footprintColor2)._offset[0] = tmpKColor._red * 0.9; - (local_64->_footprintColor2)._offset[2] = tmpKColor._blue * 0.9; - (local_64->_footprintColor2)._offset[1] = tmpKColor._green * 0.9; - (GHIDRA_CAST((GHIDRA_CAST(&local_64->_footprintColor1))))->Color::operator_assign(GHIDRA_CAST(local_60.y)); - } - else { - local_60.y = (float)&this->_footprintColor2; - } - bVar3 = is_footstep_triggered(this,-1); - if (bVar3 != 0) { - local_6c.x = (this->_velocity).y; - local_6c.y = -(this->_velocity).x; - tmpVec = (GHIDRA_CAST((&local_6c)))->Vector::Normalized(&local_74); - local_58.y = tmpVec->x + tmpVec->x; - VStack_7c.y = tmpVec->y + tmpVec->y; - bVar3 = is_footstep_triggered(this,0); - local_44 = &DAT_bf800000; - if (bVar3 == 0) { - local_60.y = (float)&this->_footprintColor1; - } - else { - local_58.y = local_58.y * -1.0; - VStack_7c.y = VStack_7c.y * -1.0; - } - local_6c.x = local_58.y + (this->_pos).x; - local_6c.y = VStack_7c.y + (this->_pos).y; - local_58.y = g_displayPixelRatio * g_screenPointScale; - VStack_7c.y = (local_6c.y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5; - local_50 = ((local_6c.x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_58.y + 0.5; - dVar5 = floor((double)local_50); - local_4c.y = (float)dVar5 / local_58.y; - local_50 = VStack_7c.y * local_58.y + 0.5; - dVar5 = floor((double)local_50); - local_50 = (float)dVar5 / local_58.y; - bVar3 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - manager = g_manager; - if (bVar3 != 0) { - local_58.y = 6.72623e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_58.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_58.y),0.5,1,0,1.0,0.0); - Game::ShakeScreen(g_game,5); - rngResult = Random(); - local_58.x = (local_64->_velocity).x * 0.7; - local_58.y = (local_64->_velocity).y * 0.7; - tmpVec = MusicManager::RandomVector(&local_74); - rngResult2 = Random(); - oldOffsetBlue = (float)((double)GHIDRA_INT(rngResult2) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult2) >> 0x1f)] - ) * 2.3283064e-10 * 20.0; - VStack_7c.x = local_6c.x + oldOffsetBlue * tmpVec->x; - VStack_7c.y = local_6c.y + oldOffsetBlue * tmpVec->y; - spawned = Game::Spawn(g_game,1000,0x3b,&VStack_7c,&local_58,GHIDRA_CAST(0x0),0,rngResult); - rngResult = Random(); - if ((rngResult & 1) == 0) { - local_44 = GHIDRA_CAST(0x3f800000); - } - rngResult = Random(); - *GHIDRA_CAST((spawned[1]._sprite._animDefaultName._buf + 4)) = - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 5.0 * (float)local_44; - rngResult = Random(); - iVar2 = *GHIDRA_CAST(spawned); - effectTimeout = rngResult % 0xf + 0xf; - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 4)) = effectTimeout; - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 8)) = effectTimeout; - (**(code **)(iVar2 + 0xc))(); - this = local_64; - } - oldOffsetBlue = (this->_velocity).y; - fVar1 = (this->_velocity).x; - if (0.16000001 < fVar1 * fVar1 + oldOffsetBlue * oldOffsetBlue) { - rngResult = Random(); - pTVar7 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar6 = 0; - spawned = Game::Spawn(g_game,1000,7,&local_6c,&g_vectorZero,GHIDRA_CAST(0x0),0,rngResult); - splat = GHIDRA_CAST(__RTDynamicCast(spawned,uVar6,pTVar7)); - oldOffsetBlue = g_vectorOne.y * 0.1; - splat[0x39] = GHIDRA_INT((g_vectorOne.x * 0.1)); - splat[0x3a] = GHIDRA_INT(oldOffsetBlue); - (**(code **)(*splat + 0x3c))(local_60.y,0xffffffff,0xff); - (**(code **)(*splat + 0xc))(); - } - pvVar8 = g_game->_room; - local_58.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x11fc)); - local_44 = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x1200)); - (GHIDRA_CAST((&VStack_7c)))->shared_ptr::assign((void *)(GHIDRA_INT(pvVar8) + 0x1bc8)); - local_8 = 1.4013e-45; - (**(code **)(*GHIDRA_CAST(VStack_7c.x) + 0x2c))(&floorRed); - local_8 = -NAN; - FUN_0041c710(); - oldOffsetBlue = *GHIDRA_CAST((GHIDRA_CAST(local_60.y) + 0x20)); - fVar1 = (GHIDRA_CAST((GHIDRA_INT(local_60.y) + 0x20)))[2]; - oldOffsetGreen = (GHIDRA_CAST((GHIDRA_INT(local_60.y) + 0x20)))[1]; - oldOffsetRed = *GHIDRA_CAST((GHIDRA_CAST(local_60.y) + 0x20)); - (GHIDRA_CAST(local_60.y))[3] = (0.7 - (GHIDRA_CAST(local_60.y))[3]) * 0.3 + (GHIDRA_CAST(local_60.y))[3]; - oldOffsetBlue = (GHIDRA_CAST((GHIDRA_INT(local_60.y) + 0x20)))[2]; - *GHIDRA_CAST((GHIDRA_CAST(local_60.y) + 0x20)) = (floorRed * 0.9 - oldOffsetBlue) * 0.5 + oldOffsetRed; - (GHIDRA_CAST((GHIDRA_INT(local_60.y) + 0x20)))[2] = (floorBlue * 0.9 - fVar1) * 0.5 + oldOffsetBlue; - (GHIDRA_CAST((GHIDRA_INT(local_60.y) + 0x20)))[1] = - (floorGreen * 0.9 - oldOffsetGreen) * 0.5 + (GHIDRA_CAST((GHIDRA_INT(local_60.y) + 0x20)))[1]; - if (0.0 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x7240))) { - oldOffsetBlue = (this->_velocity).y; - fVar1 = (this->_velocity).x; - if (1.0 < fVar1 * fVar1 + oldOffsetBlue * oldOffsetBlue) { - local_60.y = oldOffsetBlue + local_6c.y; - local_60.x = local_6c.x + fVar1; - rngResult = Random(); - spawned = Game::Spawn(g_game,1000,99,&local_60,&g_vectorZero,GHIDRA_CAST(this),0,rngResult); - iVar2 = *GHIDRA_CAST(spawned); - (spawned->_velocity).x = (this->_velocity).x; - (spawned->_velocity).y = (this->_velocity).y; - (**(code **)(iVar2 + 0xc))(); - rngResult = Random(); - for (local_44 = GHIDRA_CAST((rngResult % 5 + 3)); local_44 != GHIDRA_CAST(0x0); - local_44 = GHIDRA_CAST((GHIDRA_INT(local_44) + -1))) { - rngResult = Random(); - rngResult2 = Random(); - local_50 = (float)((double)GHIDRA_INT(rngResult2) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult2) >> 0x1f)]) * 2.3283064e-10; - local_64 = GHIDRA_CAST((local_50 * (this->_velocity).y)); - local_50 = local_50 * (this->_velocity).x; - rngResult2 = Random(); - local_4c.y = (float)((double)GHIDRA_INT(rngResult2) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult2) >> 0x1f)]) * 2.3283064e-10 - * 3.14; - local_4c.y = local_4c.y + local_4c.y; - local_58.y = sin(local_4c.y); - oldOffsetBlue = cos(local_4c.y); - local_74.x = oldOffsetBlue + local_50; - local_74.y = local_58.y + (float)local_64; - spawned = Game::Spawn(g_game,1000,99,&local_60,&local_74,GHIDRA_CAST(this),1,rngResult); - spawned->Update(); - } - } - } - if ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1be8)) != '\0') && - (oldOffsetBlue = (this->_velocity).y, fVar1 = (this->_velocity).x, - 0.16000001 < fVar1 * fVar1 + oldOffsetBlue * oldOffsetBlue)) { - FUN_00683680(); - g_graphicsManager_flags = g_graphicsManager_flags & 0xfffffffd; - (GHIDRA_CAST((&local_74)))->shared_ptr::assign((void *)(GHIDRA_INT(g_game->_room) + 0x1bd8)); - local_8 = 2.8026e-45; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget((void *)local_74.x,0); - local_8 = -NAN; - FUN_0041c710(); - iVar2 = g_graphicsManager_blendMode[4]; - savedBlendMode0 = g_graphicsManager_blendMode[0]; - savedBlendMode1 = g_graphicsManager_blendMode[1]; - VStack_7c.x = (float)g_graphicsManager_blendMode[2]; - VStack_7c.y = (float)g_graphicsManager_blendMode[3]; - g_graphicsManager_blendMode[4] = 7; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 0; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 0; - local_44 = GHIDRA_CAST(((g_screenHeight - 182.0) * 0.5)); - local_50 = (g_screenWidth - 338.0) * 0.5; - local_60.y = g_displayPixelRatio * g_screenPointScale; - local_4c.y = (local_50 - 52.0) * local_60.y + 0.5; - dVar5 = floor((double)local_4c.y); - local_58.y = (float)dVar5 / local_60.y; - local_4c.y = ((float)local_44 - 52.0) * local_60.y + 0.5; - dVar5 = floor((double)local_4c.y); - local_64 = GHIDRA_CAST(((float)dVar5 / local_60.y)); - local_4c.y = ((local_6c.x - 60.0) * 0.65 + local_50) * local_60.y + 0.5; - dVar5 = floor((double)local_4c.y); - local_50 = (float)dVar5 / local_60.y; - local_4c.y = ((local_6c.y - 140.0) * 0.65 + (float)local_44) * local_60.y + 0.5; - dVar5 = floor((double)local_4c.y); - local_4c.y = (float)dVar5; - oldOffsetBlue = local_4c.y / local_60.y; - (GHIDRA_CAST((&tmpKColor)))->KColor::SetFromARGB(0xffffffff); - tmpVec = &local_74; - local_74.x = 20.0; - local_74.y = 20.0; - local_4c.x = (local_50 - local_58.y) - 10.0; - local_4c.y = (oldOffsetBlue - (float)local_64) - 10.0; - render_quad_set_rect(quad,&local_4c,tmpVec,color_00); - FUN_00682260(); - pvVar8 = (void *)0x7b9800; - (GHIDRA_CAST((&tmpColor)))->Color::Color(); - (GHIDRA_CAST((auStack_13a + -10)))->KAGE::SmartPointer::operator_assign(&DAT_00c79844); - apply_sprite_shader_params(color,1,tmpVec,pvVar8); - local_b0 = 0; - shaderColor = 0x3f800000; - uStack_bc = 0x3f800000; - uStack_b8 = 0x3f800000; - uStack_b4 = 0x3e75c28f; - (**(code **)(*DAT_00c79844 + 0x1c))(); - _glfw_context_reset(); - pop_render_target(); - g_graphicsManager_blendMode[0] = savedBlendMode0; - g_graphicsManager_blendMode[1] = savedBlendMode1; - g_graphicsManager_blendMode[2] = GHIDRA_INT(VStack_7c.x); - g_graphicsManager_blendMode[3] = GHIDRA_INT(VStack_7c.y); - g_graphicsManager_blendMode[4] = iVar2; - shader_cache_find(unusedArg); - } - } - } - ExceptionList = local_10; - return; -} - -// 007b98c0 -void Entity_Player::SetFootprintColor(KColor color, uint8_t unk) -{ - uint8_t isFootstep; - - isFootstep = is_footstep_triggered(this,-1); - if (((isFootstep != 0) || (unk != 0)) && (this->_canFly == 0)) { - isFootstep = is_footstep_triggered(this,0); - if (isFootstep != 0) { - (this->_footprintColor2)._offset[0] = color._red; - (this->_footprintColor2)._offset[1] = color._green; - (this->_footprintColor2)._offset[2] = color._blue; - return; - } - (this->_footprintColor1)._offset[0] = color._red; - (this->_footprintColor1)._offset[1] = color._green; - (this->_footprintColor1)._offset[2] = color._blue; - } - return; -} - -// 007b9940 -uint8_t Entity_Player::is_footstep_triggered(int foot) -{ - uint8_t isAnyFootstep; - uint8_t isLeftFootstep; - Sprite *costumeSprite; - int *anm2Id; - int costumeIndex; - Game *game; - - game = g_game; - costumeIndex = this->_playerCostumeMap[1]._index; - if (-1 < costumeIndex) { - costumeSprite = GHIDRA_CAST((costumeIndex * 0x130 + GHIDRA_INT((this->_costumeSpriteDescs)._begin))); - anm2Id = *GHIDRA_CAST(costumeSprite[1]._filename._buf); - if (((anm2Id != GHIDRA_CAST(0x0)) && (*anm2Id == 3)) && (anm2Id[1] == 0x271)) { - if (foot != -1) { - if (foot == 0) { - isAnyFootstep = (GHIDRA_CAST((costumeSprite)))->Sprite::IsEventTriggered("LeftFootstep"); - return isAnyFootstep; - } - return 0; - } - isAnyFootstep = (GHIDRA_CAST((costumeSprite)))->Sprite::IsEventTriggered("LeftFootstep"); - if (isAnyFootstep != 0) { - return 1; - } - isAnyFootstep = (GHIDRA_CAST((costumeSprite)))->Sprite::IsEventTriggered("RightFootstep"); - if (isAnyFootstep == 0) { - return 0; - } - return 1; - } - } - if ((((this->_flags & 0x4000) == 0) && - (isAnyFootstep = Game::IsPaused(g_game), isAnyFootstep == 0)) && - ((game->_frameCount % 6 == 0 && (this->_canFly == 0)))) { - isAnyFootstep = 1; - isLeftFootstep = Game::IsPaused(game); - if ((isLeftFootstep == 0) && (game->_frameCount % 0xc == 0)) { - isLeftFootstep = 1; - goto LAB_007b9a30; - } - } - else { - isAnyFootstep = 0; - } - isLeftFootstep = 0; -LAB_007b9a30: - if (foot == -1) { - return isAnyFootstep; - } - if (foot == 0) { - return isLeftFootstep; - } - return 0; -} - -// 007b9b50 -void Entity_Player::update_pitfall() -{ - Vector pos; - uint8_t bVar1; - uint8_t isRightPressed; - uint8_t isUpPressed; - uint8_t isDownPressed; - uint8_t *curAnimName; - uint32_t cmpResult; - EntityRef *damageRefPtr; - int iVar2; - Vector *pVVar3; - char *unused; - Entity_Player *extraout_ECX; - int unused_00; - uint32_t extraout_ECX_00; - int unused_01; - bool isLess; - Vector landingPos; - Vector doorPos; - Vector freeDoorPos; - EntityRef damageRef; - Room *room; - - iVar2 = this->_pitfallState; - if (iVar2 != 0) { - if (*GHIDRA_CAST(&g_game->_roomTransition) == 0) { - if (this->_dead != 0) { - return; - } - unused = GHIDRA_CAST(this); - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying == 0)) { - curAnimName = (this->_sprite)._animState._animData; - if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { - curAnimName = *GHIDRA_CAST(curAnimName); - } - unused = "FallIn"; - do { - bVar1 = *curAnimName; - isLess = bVar1 < (uint8_t)*unused; - if (bVar1 != *unused) { -LAB_007b9bd8: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007b9bdd; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - isLess = bVar1 < (*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)(GHIDRA_CAST(unused)))) + 0x1))); - if (bVar1 != (*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(unused)))) + 0x1)))) goto LAB_007b9bd8; - curAnimName = curAnimName + 2; - unused = &(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(unused)))) + 0x2))); - } while (bVar1 != 0); - cmpResult = 0; -LAB_007b9bdd: - if ((cmpResult == 0) && (iVar2 == 1)) { - this->_pitfallState = 2; - damageRefPtr = (GHIDRA_CAST((&damageRef)))->EntityRef::EntityRef(); - this->TakeDamage(0x3f800000,0x80000,0,damageRefPtr,0x1e); - unused = GHIDRA_CAST(extraout_ECX); - } - } - if (((this->_pitfallState != 4) && (this->_pitfallState == 2)) && - (this->_pitfallTimer = this->_pitfallTimer + 1, 0x27 < this->_pitfallTimer)) { - bVar1 = input_is_action_pressed(0,this->_controllerIndex,GHIDRA_CAST(this),GHIDRA_INT(unused)); - isRightPressed = input_is_action_pressed(1,this->_controllerIndex,GHIDRA_CAST(this),unused_00); - isUpPressed = input_is_action_pressed - (2,this->_controllerIndex,GHIDRA_CAST(this), - CONCAT31((int3)(GHIDRA_UINT(extraout_ECX_00) >> 8),bVar1 | isRightPressed) - ); - isDownPressed = input_is_action_pressed(3,this->_controllerIndex,GHIDRA_CAST(this),unused_01); - if ((isDownPressed != 0 || ((bVar1 | isRightPressed) != 0 || isUpPressed != 0)) || - (0x77 < this->_pitfallTimer)) { - landingPos.x = (this->_pos).x; - landingPos.y = (this->_pos).y; - room = g_game->_room; - iVar2 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(this->_pos); - if (iVar2 < 1) { - this->_pitfallState = 3; - PlayExtraAnimation(this,GHIDRA_CAST("JumpOut")); - } - else { - Room::FindFreePickupSpawnPosition(room,&landingPos,&landingPos,0.0,1,0,0); - room = g_game->_room; - pos.y = landingPos.y; - pos.x = landingPos.x; - iVar2 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos); - if (((0 < iVar2) && (g_game->_enterDoor + 1U < 9)) && - (room->_doors[g_game->_enterDoor] != GHIDRA_CAST(0x0))) { - pVVar3 = (GHIDRA_CAST((room->_doors[g_game->_enterDoor])))->GridEntity::Position(&doorPos); - pVVar3 = Room::FindFreePickupSpawnPosition(room,&freeDoorPos,pVVar3,0.0,1,0,0); - landingPos.x = pVVar3->x; - landingPos.y = pVVar3->y; - } - Teleport(this,&landingPos,0,0); - this->_pitfallState = 3; - PlayExtraAnimation(this,GHIDRA_CAST("JumpOut")); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetLastFrame(); - } - this->_damageCooldown = 0x78; - } - } - if ((this->_pitfallState == 3) && - (((this->_sprite)._animState._animData == (void *)0x0 || - ((this->_sprite)._animState._isPlaying == 0)))) { - this->_isPlayingExtraAnimation = 0; - this->_pitfallTimer = 0; - this->_pitfallState = 0; - this->_isControlsEnabled = 1; - this->_entityCollisionClass = 4; - return; - } - } - else { - if (iVar2 == 3) { - return; - } - if ((g_game->_roomTransition)._animation != 2) { - return; - } - } - this->_isPlayingExtraAnimation = 1; - } - return; -} - -// 007b9e10 -void Entity_Player::TryDecreaseGlowingHourglassUses(int unk1, uint8_t unk2) -{ - uint8_t isCheck; - int iVar1; - int iVar2; - char isDecreasePending; - ActiveItemDesc *active; - uint32_t slot; - void *boxContents; - - active = this->_activeDesc; - slot = 0; - isDecreasePending = (char)unk1; - do { - if (active->_item == 0x1a6) { - if (active->_varData < 3) { - if (unk2 == 0) { - if (isDecreasePending != '\0') { - active->_varData = active->_varData + 1; - goto LAB_007b9e7b; - } - } - else { - this->_activeDesc[0]._varData = 3; - } - } - } - else if (((active->_item == 0x1dd) && (isCheck = VoidHasCollectible(this,0x1a6), isCheck != 0)) - && (isDecreasePending != '\0')) { - SetActiveCharge(this,0,slot); -LAB_007b9e7b: - isDecreasePending = '\0'; - } - slot = slot + 1; - active = active + 1; - if (3 < slot) { - if (((this->_movingBoxContents)._begin != (this->_movingBoxContents)._end) && - (isCheck = HasCollectible(this,0x20b,0), isCheck != 0)) { - unk1 = 0; - boxContents = (this->_movingBoxContents)._begin; - iVar1 = GHIDRA_INT((this->_movingBoxContents)._end) - GHIDRA_INT(boxContents); - iVar2 = iVar1 >> 0x1f; - if (iVar1 / 0x78 + iVar2 != iVar2) { - iVar2 = 0; - do { - if (((*GHIDRA_CAST((iVar2 + GHIDRA_INT(boxContents))) == 5) && - (*GHIDRA_CAST((iVar2 + 4 + GHIDRA_INT(boxContents))) == 100)) && - (*GHIDRA_CAST((iVar2 + 8 + GHIDRA_INT(boxContents))) == 0x1a6)) { - if (unk2 == 0) { - if ((isDecreasePending != '\0') && - (iVar1 = *GHIDRA_CAST((iVar2 + 0x5c + GHIDRA_INT(boxContents))), iVar1 < 3)) { - *GHIDRA_CAST((iVar2 + 0x5c + GHIDRA_INT(boxContents))) = iVar1 + 1; - isDecreasePending = '\0'; - } - } - else { - *GHIDRA_CAST((iVar2 + 0x5c + GHIDRA_INT(boxContents))) = 3; - } - } - boxContents = (this->_movingBoxContents)._begin; - iVar2 = iVar2 + 0x78; - unk1 = unk1 + 1; - } while (GHIDRA_UINT(unk1) < - GHIDRA_UINT(((GHIDRA_INT((this->_movingBoxContents)._end) - GHIDRA_INT(boxContents)) / 0x78))); - } - } - return; - } - } while( true ); -} - -// 007b9f60 -uint8_t Entity_Player::GetMouseAimTarget(Vector *outTarget, uint8_t isSkipNetCursor) -{ - void *pvVar1; - uint8_t bVar2; - char isLastRef; - uint32_t uVar3; - int netDevice; - int iVar4; - int *windowSize; - Entity *focusEntity; - int unused; - int extraout_ECX; - float extraHeight; - float pixelScale; - int windowSizeBuf [2]; - int device; - int *deviceRefCount; - double cursorY; - double cursorX; - float focusX; - float local_14; - void *local_10; - uint8_t *puStack_c; - int local_8; - float cameraY; - Manager *manager; - - local_8 = 0xffffffff; - puStack_c = &LAB_00affddd; - local_10 = ExceptionList; - uVar3 = __security_cookie ^ GHIDRA_UINT((windowSizeBuf + 0xe)); - ExceptionList = &local_10; - iVar4 = this->_controllerIndex; - (GHIDRA_CAST((&PTR_vftable_00c57b18)))->InputManager::get_device(&device,iVar4); - local_8 = 0; - if (device == 0) { - netDevice = 0; - } - else { - netDevice = __RTDynamicCast(device,0,&KAGE::Input::InputDeviceBase::RTTI_Type_Descriptor, - &IsaacRepentancePlus::NetInputDevice::RTTI_Type_Descriptor,0,uVar3); - } - if (isSkipNetCursor == 0) { - if ((netDevice == 0) || (*GHIDRA_CAST((netDevice + 0x3d4)) == '\0')) goto LAB_007b9fe7; - outTarget->x = *GHIDRA_CAST((netDevice + 0x398)); - outTarget->y = *GHIDRA_CAST((netDevice + 0x39c)); -LAB_007ba1ff: - focusEntity = GetFocusEntity(this); - if (focusEntity == GHIDRA_CAST(0x0)) { - focusX = (this->_pos).x; - local_14 = (this->_pos).y; - } - else { - focusX = (focusEntity->_pos).x; - local_14 = (focusEntity->_pos).y; - } - outTarget->x = (outTarget->x - focusX) * 0.2; - outTarget->y = (outTarget->y - local_14) * 0.2; - } - else { - if (netDevice != 0) { - if (*GHIDRA_CAST((netDevice + 0x378)) == 0) { - iVar4 = -0x21524111; - } - else { - iVar4 = *GHIDRA_CAST((*GHIDRA_CAST((netDevice + 0x378)) + 0xc)); - } - } -LAB_007b9fe7: - bVar2 = 0; - if (((g_manager->_optionsConfig)._enableMouseControl == 0) || (iVar4 != 0)) goto LAB_007ba260; - iVar4 = glfwGetMouseButton(); - pvVar1 = g_glfwWindow; - if (iVar4 == 0) goto LAB_007ba260; - if (g_glfwWindow == (void *)0x0) { - _wassert(L"window != NULL", - L"C:\\nicalis\\builderbob\\projects\\KAGE\\Source\\Platforms\\PC\\Shared\\Source\\External\\gl\\GLFW_3.4\\src\\input.c" - ,0x310); - } - cursorX = 0.0; - cursorY = 0.0; - if (_glfw == 0) { - _glfwInputError(0x10001,0); - } - else if (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x70)) == 0x34003) { - cursorX = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1e0)); - cursorY = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1e8)); - } - else { - (*DAT_00c736a0)(pvVar1,&cursorX,&cursorY); - } - _isSkipNetCursor = (float)cursorX; - local_14 = (float)cursorY; - bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsMirrorWorld(); - iVar4 = unused; - if (bVar2 != 0) { - windowSize = glfw_get_window_size(windowSizeBuf,unused); - _isSkipNetCursor = - (float)((double)*windowSize + __uint_to_double_fixup[-(*windowSize >> 0x1f)]) - - _isSkipNetCursor; - iVar4 = extraout_ECX; - } - windowSize = glfw_get_window_size(windowSizeBuf,iVar4); - manager = g_manager; - extraHeight = g_screenHeight - 182.0; - pixelScale = (float)((double)windowSize[1] + __uint_to_double_fixup[-(windowSize[1] >> 0x1f)]) / - DAT_00c79980; - cameraY = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1208)); - outTarget->x = ((_isSkipNetCursor / pixelScale - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1204))) - - (g_screenWidth - 338.0) * 0.5) / 0.65 + 60.0; - outTarget->y = ((local_14 / pixelScale - cameraY) - extraHeight * 0.5) / 0.65 + 140.0; - if (manager->_netplayManager == *GHIDRA_CAST((manager + 1))) goto LAB_007ba1ff; - } - bVar2 = 1; -LAB_007ba260: - local_8 = 1; - if (deviceRefCount != GHIDRA_CAST(0x0)) { - isLastRef = (**(code **)(*deviceRefCount + 0xc))(); - if ((isLastRef != '\0') && (g_inputDeviceRelease != (void *)0x0)) { - (*g_inputDeviceRelease)(&device); - } - } - ExceptionList = local_10; - return bVar2; -} - -// 007ba2b0 -void Entity_Player::update_baby_skin_effects() -{ - Entity_Player *game = this; - code *pcVar1; - uint8_t bVar2; - Entity_Familiar **ppEVar3; - uint32_t uVar4; - Entity *spawnedEntity; - int iVar5; - BitSet128 *bombFlags; - int *creepEffect; - void *pvVar6; - uint32_t rngResult; - Entity_Player *tmpPlayer; - TearParams *pTVar7; - int enemyCount; - Entity_Familiar **ppEVar8; - Game *game; - float fVar9; - float fVar10; - uint32_t uVar11; - TypeDescriptor *pTVar12; - TypeDescriptor *pTVar13; - uint32_t rngResult; - EntityRef sourceRef; - int roomEntity; - Entity_Familiar *local_a4 [2]; - Entity_Familiar *local_9c; - float local_98; - uint8_t local_94 [8]; - Vector local_8c; - Entity_Player *local_84; - int i; - TearParams tearHitParams; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - float local_8; - float pullStrength; - uint8_t *blueFlyRef; - uint64_t bombFlagsHigh; - uint64_t bombFlagsLow; - - game = g_game; - local_8 = -NAN; - puStack_c = &LAB_00affe10; - local_10 = ExceptionList; - rngResult = __security_cookie ^ GHIDRA_UINT(((&tearHitParams)[1]._tearColor._colorize + 3)); - if (game->_dead != 0) { - return; - } - iVar5 = game->_babySkin; - ExceptionList = &local_10; - local_84 = game; - local_14 = rngResult; - if (iVar5 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x78,game->_index); - if ((bVar2 != 0) && (rngResult = Random(), game = g_game, rngResult % 0x1e == 0)) { - enemyCount = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12c4)) + *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x12c0)); - iVar5 = 0; - if (0 < enemyCount) { - iVar5 = enemyCount; - } - if ((iVar5 < 1) || (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::HasEntityFlags(0x4000), bVar2 != 0)) - goto LAB_007bb592; - Room::FindFreePickupSpawnPosition(game->_room,&local_8c,&game->_pos,0.0,1,0,0); - game->_numBlueSpiders = game->_numBlueSpiders + 1; - spawn_blue_spider(&local_8c,GHIDRA_CAST(game),&g_vectorZero); - } - goto LAB_007bb58c; - } - if (iVar5 == 5) { - i = 0; - local_8c.y = (float)g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(local_8c.y) + 0x1264)) != 0) { - do { - roomEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_8c.y) + 0x125c)) + i * 4)); - if ((((1 < *GHIDRA_CAST(&game->_deathmatchManager)) && (*GHIDRA_CAST((roomEntity + 0x28)) == 1)) || - (*GHIDRA_CAST((roomEntity + 0x28)) - 10U < 0x3de)) || (*GHIDRA_CAST((roomEntity + 0x28)) == 9)) { - local_a4[1] = GHIDRA_CAST((game->_pos).y); - local_9c = GHIDRA_CAST((game->_pos).x); - local_98 = (float)local_a4[1] - *GHIDRA_CAST((roomEntity + 0x340)); - local_84 = GHIDRA_CAST(((float)local_9c - *GHIDRA_CAST((roomEntity + 0x33c)))); - fVar9 = sqrtf(local_98 * local_98 + (float)local_84 * (float)local_84); - if (0.0 < fVar9) { - local_84 = GHIDRA_CAST(((float)local_84 * (1.0 / fVar9))); - local_98 = local_98 * (1.0 / fVar9); - } - local_a4[0] = GHIDRA_CAST(0x3f666666); - fVar9 = (float)local_a4[1] - *GHIDRA_CAST((roomEntity + 0x340)); - fVar10 = (float)local_9c - *GHIDRA_CAST((roomEntity + 0x33c)); - fVar9 = sqrtf(fVar9 * fVar9 + fVar10 * fVar10); - local_9c = GHIDRA_CAST(0x0); - local_a4[1] = GHIDRA_CAST((((300.0 - fVar9) * 0.9) / 300.0)); - ppEVar8 = local_a4 + 1; - if ((float)local_a4[1] <= 0.0) { - ppEVar8 = local_a4 + 2; - } - ppEVar3 = local_a4; - if ((float)*ppEVar8 <= 0.9 && (float)*ppEVar8 != 0.9) { - ppEVar3 = ppEVar8; - } - fVar9 = *GHIDRA_CAST((roomEntity + 0x36c)); - pullStrength = (float)*ppEVar3; - if (fVar9 != 0.0) { - *GHIDRA_CAST((roomEntity + 0x360)) = - (pullStrength * (float)local_84 * *GHIDRA_CAST((roomEntity + 0x39c))) / fVar9 + - *GHIDRA_CAST((roomEntity + 0x360)); - *GHIDRA_CAST((roomEntity + 0x364)) = - (pullStrength * local_98 * *GHIDRA_CAST((roomEntity + 0x39c))) / fVar9 + - *GHIDRA_CAST((roomEntity + 0x364)); - } - } - i = i + 1; - } while (GHIDRA_UINT(i) < *GHIDRA_CAST((GHIDRA_CAST(local_8c.y) + 0x1264))); - } - goto LAB_007bb592; - } - if (iVar5 == 6) { - if ((g_game->_frameCount - game->_spawnFrame) % 900 != 0) goto LAB_007bb592; - uVar4 = Random(); - if ((uVar4 & 1) == 0) { - game = g_game; - if (g_game->_frameCount - game->_spawnFrame < 6) goto LAB_007bb592; - uVar4 = Random(); - rngResult = 0; - pTVar13 = &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor; - pTVar12 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar11 = 0; - spawnedEntity = Game::Spawn(g_game,4,3,&game->_pos,&g_vectorZero,GHIDRA_CAST(game),0,uVar4); - iVar5 = __RTDynamicCast(spawnedEntity,uVar11,pTVar12,pTVar13,rngResult,rngResult); - if (iVar5 != 0) { - bombFlags = GetBombFlags(game,GHIDRA_CAST(local_94),0); - bombFlagsLow = bombFlags->_l; - uVar11 = *GHIDRA_CAST((GHIDRA_INT(&bombFlags->_l) + 4)); - bombFlagsHigh = bombFlags->_h; - rngResult = *GHIDRA_CAST((GHIDRA_INT(&bombFlags->_h) + 4)); - *GHIDRA_CAST((iVar5 + 0x463)) = 1; - *GHIDRA_CAST((iVar5 + 0x438)) = GHIDRA_INT(bombFlagsLow); - *GHIDRA_CAST((iVar5 + 0x43c)) = uVar11; - *GHIDRA_CAST((iVar5 + 0x440)) = GHIDRA_INT(bombFlagsHigh); - *GHIDRA_CAST((iVar5 + 0x444)) = rngResult; - } - } - goto LAB_007bb58c; - } - if (iVar5 == 10) { - uVar4 = Random(); - if (uVar4 % 0x50 == 0) { - uVar4 = Random(); - rngResult = 0; - pTVar13 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar12 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar11 = 0; - spawnedEntity = Game::Spawn(g_game,1000,0x2e,&game->_pos,&g_vectorZero,GHIDRA_CAST(game),0,uVar4) - ; - creepEffect = GHIDRA_CAST(__RTDynamicCast(spawnedEntity,uVar11,pTVar12,pTVar13,rngResult,rngResult)); - rngResult = Random(); - fVar10 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.2; - fVar9 = fVar10 * g_vectorOne.x; - creepEffect[0x3a] = GHIDRA_INT((fVar10 * g_vectorOne.y)); - creepEffect[0x39] = GHIDRA_INT(fVar9); - (**(code **)(*creepEffect + 0xc))(); - } - bVar2 = IsExtraAnimationFinished(game); - if (bVar2 == 0) goto LAB_007bb58c; -LAB_007bb576: - ANM2::PlayOverlay(&game->_sprite,GHIDRA_CAST("Dripping"),0); - (game->_sprite)._overlayRenderFirst = 1; - goto LAB_007bb58c; - } - if (iVar5 == 3) { - pvVar6 = ANM2::GetAnimationData(&game->_sprite,GHIDRA_CAST("Dripping")); - if (pvVar6 != (void *)0x0) { - bVar2 = IsExtraAnimationFinished(game); - if (bVar2 != 0) goto LAB_007bb576; - goto LAB_007bb58c; - } -LAB_007bade5: - if (game->_babySkin == 0x28) { - tmpPlayer = GetMainPlayer(game); - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0xf8); - if (bVar2 != 0) goto LAB_007bae5e; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 == 0) || (rngResult = Random(), rngResult % 0x32 != 0)) goto LAB_007bb58c; - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (0x3e0 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU - ))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x3e0)); - goto LAB_007bad9f; - } -LAB_007bad98: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = 0; - goto LAB_007bad9f; - } -LAB_007bae5e: - if (game->_babySkin == 0x29) { - tmpPlayer = GetMainPlayer(game); - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0xce); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 == 0) || (rngResult = Random(), rngResult % 0x32 != 0)) goto LAB_007bb58c; - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (0x338 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & - 0xfffffffcU))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x338)); - goto LAB_007bad9f; - } - goto LAB_007bad98; - } - } - if (game->_babySkin == 0x2b) { - tmpPlayer = GetMainPlayer(game); - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x7a); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 == 0) || (rngResult = Random(), rngResult % 0x32 != 0)) goto LAB_007bb58c; - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (0x1e8 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & - 0xfffffffcU))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1e8)); - goto LAB_007bad9f; - } - goto LAB_007bad98; - } - } - if (game->_babySkin == 0x2d) { - tmpPlayer = GetMainPlayer(game); - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0xd6); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 == 0) || (rngResult = Random(), rngResult % 0x32 != 0)) goto LAB_007bb58c; - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (0x358 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & - 0xfffffffcU))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x358)); - goto LAB_007bad9f; - } - goto LAB_007bad98; - } - } - iVar5 = game->_babySkin; - if (iVar5 != 0x30) { - if (iVar5 == 0x2f) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(7,game->_index); - if (bVar2 != 0) { - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_94), - &game->_pos,150.0,8); - local_8 = 0.0; - i = 0; - if ((void *)local_8c.y != (void *)0x0) { - do { - iVar5 = i; - bVar2 = (GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x4))) + i * 4)))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar2 != 0) { - pcVar1 = *(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x4))) + iVar5 * 4)) + 0x20); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(local_84)); - rngResult = Random(); - pTVar7 = GetTearHitParams(local_84,&tearHitParams,1,1.0,(rngResult & 1) * 2 + -1, - GHIDRA_CAST(0x0)); - (*pcVar1)(pTVar7->_tearDamage * 0.3,0,0,&sourceRef,0x1e); - iVar5 = i; - } - i = iVar5 + 1; - } while (GHIDRA_UINT(i) < GHIDRA_UINT(local_8c.y)); - game = local_84; - } - (GHIDRA_CAST((local_94)))->EntityList_Query::~EntityList_Query(); - } - goto LAB_007bb58c; - } - if (iVar5 != 0x32) { -LAB_007bb2d2: - if (game->_babySkin == 0x33) { - tmpPlayer = GetMainPlayer(game); - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x22); - if (bVar2 == 0) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (0x88 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & - 0xfffffffcU))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x88)); - goto LAB_007bad9f; - } - goto LAB_007bad98; - } - goto LAB_007bb58c; - } - } - game = g_game; - if (game->_babySkin == 0x34) { - bVar2 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)),0x40); - if (bVar2 != 0) goto LAB_007bb44f; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if (bVar2 == 0) goto LAB_007bb592; - rngResult = Random(); - if (rngResult % 0x32 != 0) goto LAB_007bb58c; - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU)) < - 0x101) { -LAB_007bb3be: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = 0; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x100)); - } -LAB_007bb3c8: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x4))) = 0; - local_8c.y = 0.0; - local_8c.x = 2.10195e-43; - TemporaryEffects::AddEffect - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)),local_94,1,1); - } - else { - if ((game->_babySkin == 0x31) && - (tmpPlayer = GetMainPlayer(game), *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((tmpPlayer)) + 0x18e0)))) < 1)) { - tmpPlayer = GetMainPlayer(game); - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((tmpPlayer)) + 0x18e0)))); - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((tmpPlayer)) + 0x18e0)))) = iVar5; - goto LAB_007bb58c; - } - game = g_game; -LAB_007bb44f: - iVar5 = game->_babySkin; - if (iVar5 == 0x35) { - bVar2 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x7310)),0xd7); - if (bVar2 != 0) { -LAB_007bb562: - if (game->_isCoopGhost == 0) goto LAB_007bb592; -LAB_007bb56b: - bVar2 = IsExtraAnimationFinished(game); - if (bVar2 == 0) goto LAB_007bb592; - goto LAB_007bb576; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if (bVar2 == 0) goto LAB_007bb592; - rngResult = Random(); - if (rngResult % 0x32 == 0) { - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU - )) < 0x35d) goto LAB_007bb3be; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x35c)); - goto LAB_007bb3c8; - } - } - else { - if (iVar5 != 0x37) { - if ((iVar5 != 0x3a) && (iVar5 != 0x3b)) goto LAB_007bb562; - goto LAB_007bb56b; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x1b14)))) != 0) goto LAB_007bb592; - rngResult = 0; - pTVar13 = &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor; - pTVar12 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar11 = 0; - spawnedEntity = AddBlueFlies(game,1,&game->_pos,GHIDRA_CAST(0x0)); - local_a4[0] = (Entity_Familiar *) - __RTDynamicCast(spawnedEntity,uVar11,pTVar12,pTVar13,rngResult); - (GHIDRA_CAST((local_a4[0])))->Entity_Familiar::set_player(game); - blueFlyRef = &(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x1b14))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x1b14)))) != 0) { - local_8c.y = (float)blueFlyRef; - msvc::multiset::erase(&local_8c.y); - } - *GHIDRA_CAST(blueFlyRef) = local_a4[0]; - if (local_a4[0] != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(blueFlyRef); - } - } - } - goto LAB_007bb58c; - } - tmpPlayer = GetMainPlayer(game); - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x19b); - if (bVar2 != 0) goto LAB_007bb2d2; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 == 0) || (rngResult = Random(), rngResult % 0x32 != 0)) goto LAB_007bb58c; - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU)) < - 0x66d) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x4))) = 5; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x66c)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x4))) = 5; - } - goto LAB_007bada9; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - local_98 = 0.0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,GHIDRA_UINT(local_98)); - iVar5 = tmpPlayer->_coopBabyBuffTimers[0]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[0] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 1; - EvaluateItems(tmpPlayer); - fVar9 = local_98; - tmpPlayer = Game::GetPlayer(g_game,GHIDRA_UINT(local_98)); - iVar5 = tmpPlayer->_coopBabyBuffTimers[1]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[1] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 2; - EvaluateItems(tmpPlayer); - tmpPlayer = Game::GetPlayer(g_game,GHIDRA_UINT(fVar9)); - iVar5 = tmpPlayer->_coopBabyBuffTimers[2]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[2] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0x10; - EvaluateItems(tmpPlayer); - tmpPlayer = Game::GetPlayer(g_game,GHIDRA_UINT(fVar9)); - iVar5 = tmpPlayer->_coopBabyBuffTimers[3]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[3] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0xc; - EvaluateItems(tmpPlayer); - tmpPlayer = Game::GetPlayer(g_game,GHIDRA_UINT(fVar9)); - iVar5 = tmpPlayer->_coopBabyBuffTimers[4]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[4] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0x400; - EvaluateItems(tmpPlayer); - local_98 = (float)(GHIDRA_INT(fVar9) + 1); - } while (GHIDRA_UINT(local_98) < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - } - else { - if (iVar5 == 0x1f) { - if (game->_coopBabyBuffTimers[0] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,i); - iVar5 = tmpPlayer->_coopBabyBuffTimers[0]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[0] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 1; - EvaluateItems(tmpPlayer); - i = i + 1; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 == 0x20) { - if (game->_coopBabyBuffTimers[1] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,i); - iVar5 = tmpPlayer->_coopBabyBuffTimers[1]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[1] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 2; - EvaluateItems(tmpPlayer); - i = i + 1; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 == 0x21) { - if (game->_coopBabyBuffTimers[2] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,i); - iVar5 = tmpPlayer->_coopBabyBuffTimers[2]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[2] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0x10; - EvaluateItems(tmpPlayer); - i = i + 1; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 == 0x22) { - if (game->_coopBabyBuffTimers[3] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,i); - iVar5 = tmpPlayer->_coopBabyBuffTimers[3]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[3] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0xc; - EvaluateItems(tmpPlayer); - i = i + 1; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 == 0x23) { - if (game->_coopBabyBuffTimers[4] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,i); - iVar5 = tmpPlayer->_coopBabyBuffTimers[4]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[4] = iVar5; - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0x400; - EvaluateItems(tmpPlayer); - i = i + 1; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 == 0x24) { - if (game->_coopBabyBuffTimers[5] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,i); - iVar5 = tmpPlayer->_coopBabyBuffTimers[5]; - if (iVar5 < 1) { - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0x800; - EvaluateItems(tmpPlayer); - iVar5 = tmpPlayer->_coopBabyBuffTimers[5]; - } - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - i = i + 1; - tmpPlayer->_coopBabyBuffTimers[5] = iVar5; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 == 0x25) { - if (game->_coopBabyBuffTimers[6] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(g_game,i); - iVar5 = tmpPlayer->_coopBabyBuffTimers[6]; - if (iVar5 < 1) { - tmpPlayer->_cacheFlags = tmpPlayer->_cacheFlags | 0x800; - EvaluateItems(tmpPlayer); - iVar5 = tmpPlayer->_coopBabyBuffTimers[6]; - } - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - i = i + 1; - tmpPlayer->_coopBabyBuffTimers[6] = iVar5; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - game = g_game; - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 == 0x26) { - if (game->_coopBabyBuffTimers[7] < 1) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 != 0) && (rngResult = Random(), rngResult % 0x32 == 0)) { - i = 0; - game = g_game; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - tmpPlayer = Game::GetPlayer(game,i); - game = g_game; - iVar5 = tmpPlayer->_coopBabyBuffTimers[7]; - if (iVar5 < 0x96) { - iVar5 = 0x96; - } - tmpPlayer->_coopBabyBuffTimers[7] = iVar5; - i = i + 1; - } while (GHIDRA_UINT(i) < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((game->_playerManager)._playerList._begin) >> 2))); - game = local_84; - } - goto LAB_007bb592; - } - goto LAB_007bb58c; - } - goto LAB_007bade5; - } - if (iVar5 != 0x27) goto LAB_007bade5; - tmpPlayer = GetMainPlayer(game); - bVar2 = (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x14); - if (bVar2 != 0) goto LAB_007bade5; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(game))))->Entity::IsFrame(0x1e,0); - if ((bVar2 == 0) || (rngResult = Random(), rngResult % 0x32 != 0)) goto LAB_007bb58c; - pvVar6 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU)) < 0x51) - goto LAB_007bad98; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x50)); -LAB_007bad9f: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_94)) + 0x4))) = 0; -LAB_007bada9: - local_8c.x = 2.10195e-43; - local_8c.y = 0.0; - tmpPlayer = GetMainPlayer(game); - (GHIDRA_CAST((&tmpPlayer->_temporaryeffects)))->TemporaryEffects::AddEffect(local_94,1,1); - } -LAB_007bb58c: - game = g_game; -LAB_007bb592: - fVar9 = sin((float)game->_frameCount * 0.2); - (game->_posOffset).y = fVar9 + fVar9; - ExceptionList = local_10; - return; -} - -// 007bb5e0 -void Entity_Player::coop_baby_death_effect() -{ - Vector velocity; - Vector targetPos; - uint64_t qVar1; - uint64_t qVar2; - uint32_t rngValue; - Vector *spawnPos; - Entity *spawned; - BitSet128 *pBVar3; - int *effect; - uint32_t extraout_EAX; - int iVar4; - float fVar5; - uint8_t auStack_58 [4]; - float local_54; - Entity_Player *local_50; - float local_4c; - uint8_t local_48 [16]; - Color effectColor; - uint32_t local_c; - Game *game; - uint32_t temp_10305fbffd8d0a; - uint32_t temp_12305fbffd8d0a; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_58); - iVar4 = this->_babySkin; - local_50 = this; - if (iVar4 == 0) { - rngValue = Random(); - iVar4 = rngValue % 3 + 1; - if (iVar4 != 0) { - do { - rngValue = Random(); - fVar5 = (float)((double)GHIDRA_INT(rngValue) + __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_50 = GHIDRA_CAST((fVar5 + fVar5)); - rngValue = Random(); - local_54 = (float)((double)GHIDRA_INT(rngValue) + __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) - * 2.3283064e-10 * 40.0; - fVar5 = cos((float)local_50); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_48)) + 0x0))) = fVar5 * local_54 + (this->_pos).x; - fVar5 = sin((float)local_50); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_48)) + 0x4))) = fVar5 * local_54 + (this->_pos).y; - this->_numBlueSpiders = this->_numBlueSpiders + 1; - spawn_blue_spider(GHIDRA_CAST(local_48),GHIDRA_CAST(this),&g_vectorZero); - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - return; - } - } - else { - if (iVar4 == 1) { - rngValue = Random(); - game = g_game; - spawnPos = (GHIDRA_CAST((g_game->_room)))->Room::FindFreeTilePosition(GHIDRA_CAST(local_48),&local_50->_pos,0.0); - Game::SpawnEx(game,5,10,spawnPos,&g_vectorZero,GHIDRA_CAST(local_50),0,rngValue,0); - return; - } - if (iVar4 == 3) { - iVar4 = 0; - do { - local_54 = (float)iVar4 * 0.017453292; - fVar5 = cos(local_54); - local_50 = GHIDRA_CAST((fVar5 * 10.0)); - local_4c = sin(local_54); - local_4c = local_4c * 10.0; - velocity.y = local_4c; - velocity.x = (float)local_50; - FireTear(this,&this->_pos,velocity,3,GHIDRA_CAST(0x0),1.0); - iVar4 = iVar4 + 0x2d; - } while (iVar4 < 0x168); - return; - } - if (iVar4 == 6) { - rngValue = Random(); - spawned = Game::SpawnEx(g_game,4,3,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,rngValue,0); - iVar4 = __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor,0); - if (iVar4 != 0) { - pBVar3 = GetBombFlags(this,GHIDRA_CAST(local_48),0); - qVar1 = pBVar3->_l; - temp_10305fbffd8d0a = *GHIDRA_CAST((GHIDRA_INT(&pBVar3->_l) + 4)); - qVar2 = pBVar3->_h; - temp_12305fbffd8d0a = *GHIDRA_CAST((GHIDRA_INT(&pBVar3->_h) + 4)); - *GHIDRA_CAST((iVar4 + 0x463)) = 1; - *GHIDRA_CAST((iVar4 + 0x438)) = GHIDRA_INT(qVar1); - *GHIDRA_CAST((iVar4 + 0x43c)) = temp_10305fbffd8d0a; - *GHIDRA_CAST((iVar4 + 0x440)) = GHIDRA_INT(qVar2); - *GHIDRA_CAST((iVar4 + 0x444)) = temp_12305fbffd8d0a; - return; - } - } - else if (iVar4 == 9) { - rngValue = Random(); - iVar4 = rngValue % 3 + 1; - if (iVar4 != 0) { - do { - Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST(local_48),&this->_pos,100.0,0,0,0); - targetPos.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_48)) + 0x4))); - targetPos.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_48)) + 0x0))); - Entity_NPC::ThrowSpider(&this->_pos,GHIDRA_CAST(this),targetPos,0,-30.0); - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - return; - } - } - else if (iVar4 == 0xf) { - rngValue = Random(); - local_54 = (float)(rngValue % 3 + 1); - if (local_54 != 0.0) { - do { - rngValue = Random(); - spawnPos = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST(local_48),&this->_pos,40.0,0,0,0); - Game::SpawnEx(g_game,5,0x14,spawnPos,&g_vectorZero,GHIDRA_CAST(this),0,rngValue,0); - local_54 = (float)(GHIDRA_INT(local_54) + -1); - } while (local_54 != 0.0); - return; - } - } - else { - if (iVar4 == 0x13) { - rngValue = Random(); - game = g_game; - spawnPos = (GHIDRA_CAST((g_game->_room)))->Room::FindFreeTilePosition(GHIDRA_CAST(local_48),&local_50->_pos,0.0); - Game::SpawnEx(game,5,0x28,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,rngValue,0); - return; - } - if (iVar4 == 10) { - rngValue = Random(); - spawned = Game::SpawnEx(g_game,1000,0x25,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,rngValue - ,0); - effect = GHIDRA_CAST(__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor - ,&IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0 - )); - (GHIDRA_CAST((&effectColor)))->Color::Color(); - (**(code **)(*effect + 0x3c))(extraout_EAX,0xffffffff,0xff,0,1); - (**(code **)(*effect + 0xc))(); - return; - } - if (iVar4 == 0xe) { - rngValue = Random(); - Game::SpawnEx(g_game,5,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,rngValue,0); - return; - } - if (iVar4 == 0x16) { - rngValue = Random(); - AddBlueFlies(this,rngValue % 3 + 1,&this->_pos,GHIDRA_CAST(0x0)); - return; - } - if ((iVar4 == 2) || (iVar4 == 0x37)) { - effect = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))); - if (effect == GHIDRA_CAST(0x0)) { - return; - } - } - else { - if (iVar4 == 0x17) { - rngValue = Random(); - game = g_game; - spawnPos = Room::FindFreeTilePosition - (g_game->_room,GHIDRA_CAST(local_48),&local_50->_pos,0.0); - Game::SpawnEx(game,5,10,spawnPos,&g_vectorZero,GHIDRA_CAST(local_50),2,rngValue,0); - return; - } - if (iVar4 == 0x2e) { - UseCard(this,0x14,0); - return; - } - if (iVar4 != 0x38) { - return; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))) == GHIDRA_CAST(0x0)) { - return; - } - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))) + 0x28))(); - effect = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b14)))) + 0x3c0)); - if (effect == GHIDRA_CAST(0x0)) { - return; - } - if (effect[10] != 3) { - return; - } - if (effect[0xb] != 0x21) { - return; - } - } - (**(code **)(*effect + 0x28))(); - } - } - return; -} - -// 007bc740 -void Entity_Player::InitPostLevelInitStats() -{ - code *pcVar1; - int *piVar2; - uint8_t bVar3; - char cVar4; - PersistentGameData *pPVar5; - Entity_Player *tmpPlayer; - int iVar6; - ItemConfig_Item *collectibleConfig; - void *pvVar7; - Entity *familiar; - uint8_t shift2; - uint8_t shift3; - ColorMod *other; - uint32_t *netplayManager; - void *collectibles; - Game *extraout_EDX; - Game *extraout_EDX_00; - Game *extraout_EDX_01; - Game *pGVar8; - Game *extraout_EDX_02; - uint32_t uVar9; - uint32_t uVar10; - uint32_t uVar11; - Entity_Player *pEVar12; - int *piVar13; - int iVar14; - int *piVar15; - ChallengeParam *pCVar16; - uint8_t local_120 [8]; - int local_118; - uint8_t local_114 [8]; - int local_10c; - uint64_t deviceUserId; - uint64_t playerUserId; - uint32_t razorBladeId; - uint32_t woodenNickelId; - uint32_t d6Id; - int tmpEffect [3]; - uint32_t local_e0; - uint64_t local_dc; - uint32_t local_d4; - ChallengeParam *local_d0; - RNG rng; - uint32_t local_bc; - ChallengeParam *pCStack_b8; - ItemConfig *local_b4; - int rngShift3; - uint32_t local_ac; - uint32_t uStack_a8; - PersistentGameData *local_a4; - uint32_t dailyItemId1; - uint32_t dailyItemId2; - uint32_t dailyItemId3; - PersistentGameData *local_94; - uint32_t local_90; - Entity_Player *playerCopy; - uint32_t dailyItemId4; - int *itemsBegin; - int *itemsEnd; - int *itemsCapacity; - Manager *local_78; - int *local_74; - Color tintColor; - RNG cardRng; - RNG local_34; - RNG tmpRng; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity_Player *twin; - Manager *manager; - - pGVar8 = g_game; - local_8 = 0xffffffff; - puStack_c = &LAB_00affeb0; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - uVar9 = this->_initSeed; - rng._shift1 = 1; - rng._shift2 = 5; - rngShift3 = 0x13; - rng._shift3 = 0x13; - rng._seed = uVar9; - local_90 = uVar9; - playerCopy = this; - local_d0 = Game::GetChallengeParams(g_game); - uStack_a8 = playerCopy->_playerType; - if ((GHIDRA_INT(uStack_a8) < 0) || - ((GHIDRA_INT((g_manager->_entityConfig)._players._end) - - GHIDRA_INT((g_manager->_entityConfig)._players._begin)) / 0x148 <= GHIDRA_INT(uStack_a8))) { - local_a4 = GHIDRA_CAST(0x0); -LAB_007bc81f: - KAGE_LogMessage(0x10,GHIDRA_CAST("Could not load config for player type %d\n")); - pGVar8 = g_game; - } - else { - local_a4 = (PersistentGameData *) - (uStack_a8 * 0x148 + GHIDRA_INT((g_manager->_entityConfig)._players._begin)); - if (local_a4 == GHIDRA_CAST(0x0)) goto LAB_007bc81f; - } - pEVar12 = playerCopy; - manager = g_manager; - pCStack_b8 = GHIDRA_CAST(pGVar8->_frameCount); - local_94 = &g_manager->_persistentGameData; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - iVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((playerCopy)) + 0x1e50)))); - if (iVar14 == 0) { - local_dc = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_dc)) + 0x4))) = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_dc)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(playerUserId)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_dc)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(playerUserId)) + 0x0))) = GHIDRA_UINT(local_dc); - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(playerUserId)) + 0x4))) = *GHIDRA_CAST((iVar14 + 0xc)); - (*GHIDRA_CAST((GHIDRA_CAST(&(playerUserId)) + 0x0))) = *GHIDRA_CAST((iVar14 + 8)); - } - local_b4 = (*GHIDRA_CAST((GHIDRA_CAST(&(playerUserId)) + 0x4))); - uStack_a8 = GHIDRA_UINT(playerUserId); - FUN_00731ee0(local_114,&playerUserId); - if ((((*GHIDRA_CAST((local_10c + 0xd)) == '\0') && (*GHIDRA_CAST((local_10c + 0x14)) <= local_b4)) - && ((*GHIDRA_CAST((local_10c + 0x14)) < local_b4 || - (*GHIDRA_CAST((local_10c + 0x10)) <= uStack_a8)))) && - ((local_10c != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(manager[1]._gamestate)) + 0xc0)))) && - (pPVar5 = GHIDRA_CAST(FUN_00914150(&playerUserId)), - pPVar5 != GHIDRA_CAST(0x0))))) { - local_94 = pPVar5; - } - else { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar12)) + 0x1e50)))) == 0) { - local_dc = 0; - } - KAGE_LogMessage(4,(uint8_t *) - "Entity_Player::InitPostLevelInitStats -> Failed to find save data for player %llu, this will incorrectly use the local save data for this player!\n" - ); - } - pGVar8 = g_game; - } - manager = g_manager; - bVar3 = (GHIDRA_CAST((&playerCopy->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x29b); - pEVar12 = playerCopy; - if (bVar3 != 0) { - EvaluateItems(playerCopy); - tmpPlayer = Game::GetPlayer(g_game,0); - ConsumableCountChanged(tmpPlayer,-1); - goto LAB_007bea6e; - } - iVar14 = *GHIDRA_CAST((local_a4->_achievements + 0x90)); - if (iVar14 == 0) { - iVar14 = *GHIDRA_CAST((local_a4->_achievements + 0x94)); - if (iVar14 == 0) { - if (playerCopy->_playerType == 1) { - if ((local_94->_achievements[0x14c] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x8)))) == 2 && (pGVar8 != GHIDRA_CAST(0x0))) && - (((pGVar8->_dailyChallenge)._id != 0 || (pGVar8->_isDebug != 0)))))) { - uVar11 = ItemPool::ForceAddPillEffect(&pGVar8->_itemPool,5); - uVar10 = 0; - do { - uStack_a8 = ItemPool::ForceAddPillEffect(&g_game->_itemPool,7); - if ((uVar11 != uStack_a8) || - (uVar11 = ItemPool::ForceAddPillEffect(&g_game->_itemPool,5), uVar11 != uStack_a8)) - break; - uVar10 = uVar10 + 1; - } while (uVar10 < 10); - AddPocketItem(playerCopy,uVar11,0); - uVar10 = -GHIDRA_UINT(((uVar11 & 0x7ff) != 0)) & uVar11 & 0x7ff; - uVar11 = 0xe; - if (uVar10 < 0xe) { - uVar11 = uVar10; - } - *GHIDRA_CAST((GHIDRA_CAST((&g_game->_itemPool + 1)) + uVar11 + 0x3c)) = 1; - } - pEVar12 = playerCopy; - } - } - else { - if (iVar14 < 1) { - iVar14 = ItemPool::GetPill(playerCopy->_initSeed); - } - AddPocketItem(pEVar12,iVar14,0); - } - } - else if (iVar14 < 1) { - iVar14 = playerCopy->_initSeed; - iVar6 = ItemPool::GetCardEx(iVar14,0x19,10,10,1); - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._shift3 = 7; - cardRng._seed = iVar14; - iVar14 = lua_callback_run_get_card(&cardRng,iVar6,1,1,0); - AddPocketItem(pEVar12,iVar14,1); - uVar9 = local_90; - } - else { - AddPocketItem(playerCopy,iVar14,1); - } - msvc::vector::copy_constructor(local_a4->_achievements + 0x9c); - pPVar5 = local_94; - local_8 = 0; - if (g_game->_challenge == 0) { - if ((pEVar12->_playerType == 0) && - ((local_94->_achievements[0x1d] != 0 || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - d6Id = 0x69; - if (itemsEnd == itemsCapacity) { - msvc::vector::_Emplace_reallocate(itemsEnd,&d6Id); - } - else { - *itemsEnd = 0x69; - itemsEnd = itemsEnd + 1; - } - } - if ((pEVar12->_playerType == 0xe) && - ((pPVar5->_achievements[0xec] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - woodenNickelId = 0x15d; - if (itemsEnd == itemsCapacity) { - msvc::vector::_Emplace_reallocate(itemsEnd,&woodenNickelId); - } - else { - *itemsEnd = 0x15d; - itemsEnd = itemsEnd + 1; - } - } - if ((pEVar12->_playerType == 5) && - ((pPVar5->_achievements[0xf8] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - razorBladeId = 0x7e; - if (itemsEnd == itemsCapacity) { - msvc::vector::_Emplace_reallocate(itemsEnd,&razorBladeId); - } - else { - *itemsEnd = 0x7e; - itemsEnd = itemsEnd + 1; - } - } - } - switch((g_game->_dailyChallenge)._specialDailyId) { - case 1: - AddBombs(pEVar12,99); - break; - case 3: - pEVar12->_luckModifier = pEVar12->_luckModifier + 7; - dailyItemId2 = 0x17e; - msvc::vector::push_back(&dailyItemId2); - dailyItemId1 = 200; - msvc::vector::push_back(&dailyItemId1); - dailyItemId3 = 0x3f; - msvc::vector::push_back(&dailyItemId3); - break; - case 5: - piVar15 = GHIDRA_CAST((GHIDRA_INT((pEVar12->_pillEffectUses)._begin) + 0x48)); - *piVar15 = *piVar15 + 0x12; - pEVar12->_cacheFlags = pEVar12->_cacheFlags | 0x400; - (GHIDRA_CAST((&tintColor)))->Color::Color(); - tintColor._colorize[0] = 0.0; - tintColor._colorize[1] = 1.0; - tintColor._colorize[2] = 0.0; - tintColor._colorize[3] = 0.6; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar12)) + 0x16e0)))))))->Color::operator_assign(other); - pEVar12->SetColor(&tintColor,1,0xff,0,1); - break; - case 6: - dailyItemId3 = 0x8a; - msvc::vector::push_back(&dailyItemId3); - dailyItemId2 = 7; - msvc::vector::push_back(&dailyItemId2); - dailyItemId1 = 0x53; - msvc::vector::push_back(&dailyItemId1); - break; - case 8: - dailyItemId3 = 0x1f; - msvc::vector::push_back(&dailyItemId3); - dailyItemId2 = 0x29; - msvc::vector::push_back(&dailyItemId2); - dailyItemId1 = 0x37; - msvc::vector::push_back(&dailyItemId1); - break; - case 9: - dailyItemId3 = 0xa3; - msvc::vector::push_back(&dailyItemId3); - dailyItemId2 = 0x43; - msvc::vector::push_back(&dailyItemId2); - dailyItemId1 = 8; - msvc::vector::push_back(&dailyItemId1); - dailyItemId4 = 0x10c; - msvc::vector::push_back(&dailyItemId4); - local_78 = GHIDRA_CAST(0x109); - msvc::vector::push_back(&local_78); - local_74 = GHIDRA_CAST(0xf7); - msvc::vector::push_back(&local_74); - break; - case 10: - local_74 = GHIDRA_CAST(0xaf); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0xaa); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x74; - msvc::vector::push_back(&dailyItemId4); - break; - case 0xb: - local_74 = GHIDRA_CAST(0xbf); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x1a2); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0xae; - msvc::vector::push_back(&dailyItemId4); - break; - case 0xc: - local_74 = GHIDRA_CAST(0x34); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x16e); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x14a; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x247; - msvc::vector::push_back(&dailyItemId3); - break; - case 0xd: - dailyItemId1 = 0x1a8; - msvc::vector::push_back(&dailyItemId1); - break; - case 0xe: - itemsEnd = itemsBegin; - dailyItemId1 = 0x51; - msvc::vector::push_back(&dailyItemId1); - break; - case 0x10: - dailyItemId1 = 0x30; - msvc::vector::push_back(&dailyItemId1); - break; - case 0x11: - dailyItemId1 = 0x84; - msvc::vector::push_back(&dailyItemId1); - dailyItemId2 = 0xad; - msvc::vector::push_back(&dailyItemId2); - break; - case 0x12: - dailyItemId2 = 0x5d; - msvc::vector::push_back(&dailyItemId2); - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) >> 2 < 0x24) { - AddCostume(pEVar12,GHIDRA_CAST(0x0),0); - } - else { - AddCostume(pEVar12,*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x8c)),0); - } - break; - case 0x13: - dailyItemId2 = 0x84; - msvc::vector::push_back(&dailyItemId2); - dailyItemId1 = 0x4a; - msvc::vector::push_back(&dailyItemId1); - AddKeys(pEVar12,1); - break; - case 0x14: - local_74 = GHIDRA_CAST(0x91); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x86); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0xd4; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x16: - local_74 = GHIDRA_CAST(0x17a); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(&DAT_00000006); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0xd1; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x123; - msvc::vector::push_back(&dailyItemId3); - break; - case 0x17: - local_74 = GHIDRA_CAST(0x96); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x1be); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x56; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x18: - local_74 = GHIDRA_CAST(0x14a); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x1b4); - msvc::vector::push_back(&local_78); - break; - case 0x19: - local_74 = GHIDRA_CAST(0x174); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x74); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x3f; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x164; - msvc::vector::push_back(&dailyItemId3); - dailyItemId2 = 0x8b; - msvc::vector::push_back(&dailyItemId2); - break; - case 0x1a: - local_74 = GHIDRA_CAST(0x19d); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x186); - msvc::vector::push_back(&local_78); - dailyItemId4 = 499; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x1b: - local_74 = GHIDRA_CAST(&DAT_00000068); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x18d); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x1c9; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x1d: - local_74 = GHIDRA_CAST(&DAT_00000043); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(&DAT_00000008); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0xa3; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 99; - msvc::vector::push_back(&dailyItemId3); - dailyItemId2 = 100; - msvc::vector::push_back(&dailyItemId2); - dailyItemId1 = 0x142; - msvc::vector::push_back(&dailyItemId1); - break; - case 0x1e: - local_74 = GHIDRA_CAST(0x111); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x13c); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x173; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x51; - msvc::vector::push_back(&dailyItemId3); - dailyItemId2 = 0x81; - msvc::vector::push_back(&dailyItemId2); - break; - case 0x1f: - local_74 = GHIDRA_CAST(0xb4); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x1bf); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x1e4; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x74; - msvc::vector::push_back(&dailyItemId3); - break; - case 0x20: - local_74 = GHIDRA_CAST(0x44); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x243); - msvc::vector::push_back(&local_78); - break; - case 0x21: - local_74 = GHIDRA_CAST(0x11a); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x13a); - msvc::vector::push_back(&local_78); - break; - case 0x22: - local_74 = GHIDRA_CAST(0x1a8); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0xa6); - msvc::vector::push_back(&local_78); - break; - case 0x23: - local_74 = GHIDRA_CAST(0xd2); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x24); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x178; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x24: - local_74 = GHIDRA_CAST(0x12); - msvc::vector::push_back(&local_74); - break; - case 0x25: - local_74 = GHIDRA_CAST(0x7f); - msvc::vector::push_back(&local_74); - break; - case 0x26: - local_74 = GHIDRA_CAST(0x1e0); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x97); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x10c; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x27: - local_74 = GHIDRA_CAST(0xf5); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x7b); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x5f; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x28: - local_74 = GHIDRA_CAST(0x76); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x26); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0xdd; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x139; - msvc::vector::push_back(&dailyItemId3); - dailyItemId2 = 3; - msvc::vector::push_back(&dailyItemId2); - break; - case 0x2a: - local_74 = GHIDRA_CAST(0xb6); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0xb3); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x176; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x2b: - local_74 = GHIDRA_CAST(0xe8); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x151); - msvc::vector::push_back(&local_78); - break; - case 0x2d: - local_74 = GHIDRA_CAST(0x13a); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x81); - msvc::vector::push_back(&local_78); - break; - case 0x2e: - local_74 = GHIDRA_CAST(0x34); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x16e); - msvc::vector::push_back(&local_78); - break; - case 0x2f: - local_74 = GHIDRA_CAST(0x192); - msvc::vector::push_back(&local_74); - break; - case 0x30: - local_74 = GHIDRA_CAST(0x9c); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x11e); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x4a; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x4b; - msvc::vector::push_back(&dailyItemId3); - break; - case 0x31: - local_74 = GHIDRA_CAST(0x13c); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x173); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x16e; - msvc::vector::push_back(&dailyItemId4); - dailyItemId3 = 0x111; - msvc::vector::push_back(&dailyItemId3); - break; - case 0x32: - local_74 = GHIDRA_CAST(0x11e); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x4b); - msvc::vector::push_back(&local_78); - dailyItemId4 = 0x9c; - msvc::vector::push_back(&dailyItemId4); - break; - case 0x33: - local_74 = GHIDRA_CAST(0xf9); - msvc::vector::push_back(&local_74); - local_78 = GHIDRA_CAST(0x19e); - msvc::vector::push_back(&local_78); - break; - case 0x34: - itemsEnd = itemsBegin; - } - pEVar12 = playerCopy; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - uVar11 = 0; - uStack_a8 = GHIDRA_INT(itemsEnd) - GHIDRA_INT(itemsBegin) >> 2; - if (uStack_a8 != 0) { - do { - uVar9 = itemsBegin[uVar11]; - AddCollectible(pEVar12,uVar9,-1,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar9,0,0); - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar9)) goto LAB_007bd89b; - } - else { - if (GHIDRA_INT(uVar9) < 0) { - if ((GHIDRA_INT(uVar9) < 0) && - (pvVar7 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar9) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar7) >> 2)) { - iVar14 = **GHIDRA_CAST((GHIDRA_CAST(pvVar7) + ~uVar9 * 4)); - } - else { - iVar14 = 0; - } - } - else { -LAB_007bd89b: - pvVar7 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) >> 2 <= GHIDRA_INT(uVar9)) - goto LAB_007bd8ee; - iVar14 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + uVar9 * 4)); - } - if (iVar14 != 0) { - tmpEffect[2] = *GHIDRA_CAST((iVar14 + 0x78)); - tmpEffect[1] = 0; - local_e0 = 0; - tmpEffect[0] = iVar14; - (GHIDRA_CAST((&pEVar12->_temporaryeffects)))->TemporaryEffects::RemoveEffect(tmpEffect,1); - } - } -LAB_007bd8ee: - uVar11 = uVar11 + 1; - } while (uVar11 < uStack_a8); - uVar9 = local_90; - } - } - local_8 = 0xffffffff; - FID_conflict__Tidy(&itemsBegin); - pEVar12 = playerCopy; - apply_innate_collectibles(playerCopy); - if (g_game->_challenge == 0x2c) { - SetPocketActiveItem(pEVar12,0x244,2,0); - pEVar12->_activeDesc[2]._varData = 0x14; - pGVar8 = extraout_EDX_00; - } - else { - pGVar8 = extraout_EDX; - if (*GHIDRA_CAST((local_a4->_achievements + 0xb8)) != 0) { - SetPocketActiveItem(pEVar12,*GHIDRA_CAST((local_a4->_achievements + 0xb8)),2,0); - pGVar8 = extraout_EDX_01; - } - } - iVar14 = *GHIDRA_CAST((local_a4->_achievements + 0xa8)); - if (iVar14 != 0) goto LAB_007bdacf; - if (g_game->_challenge == 0) { - iVar6 = pEVar12->_playerType; - if (iVar6 == 0xe) { - if ((local_94->_achievements[0xed] != 0) || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) { - iVar14 = 0x53; - } - } - else if (iVar6 == 2) { - if ((local_94->_achievements[0xf5] != 0) || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) { - iVar14 = 0x13; - } - } - else if ((iVar6 == 6) && - ((local_94->_achievements[0x14e] != 0 || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - iVar14 = 0x22; - } - } - pGVar8 = g_game; - switch((g_game->_dailyChallenge)._specialDailyId) { - case 4: - iVar14 = 0x3d; - break; - default: - if (iVar14 != 0) break; - goto LAB_007bdb1f; - case 0x12: - iVar14 = 8; - break; - case 0x19: - iVar14 = 3; - AddTrinket(pEVar12,0x48,1); - pGVar8 = g_game; - pvVar7 = (g_game->_itemPool)._trinketPoolItems._begin; - if (((0x48 < GHIDRA_INT((g_game->_itemPool)._trinketPoolItems._end) - GHIDRA_INT(pvVar7) >> 3) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x244)) != '\0')) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x245)) != '\0')) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x244)) = 0; - piVar15 = &(pGVar8->_itemPool)._numAvailableTrinkets; - *piVar15 = *piVar15 + -1; - } - break; - case 0x1e: - case 0x31: - iVar14 = 0x35; - } -LAB_007bdacf: - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - AddTrinket(pEVar12,iVar14,1); - pGVar8 = g_game; - if (((0 < iVar14) && - (pvVar7 = (g_game->_itemPool)._trinketPoolItems._begin, - iVar14 < GHIDRA_INT((g_game->_itemPool)._trinketPoolItems._end) - GHIDRA_INT(pvVar7) >> 3)) && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + iVar14 * 8 + 4)) != '\0' && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + iVar14 * 8 + 5)) != '\0')))) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + iVar14 * 8 + 4)) = 0; - piVar15 = &(pGVar8->_itemPool)._numAvailableTrinkets; - *piVar15 = *piVar15 + -1; - } - } -LAB_007bdb1f: - pPVar5 = local_a4; - if (*GHIDRA_CAST((local_a4->_achievements + 0x90)) == 0) { - iVar14 = (g_game->_dailyChallenge)._specialDailyId; - if (iVar14 == 0x27) { - iVar14 = 0x31; - } - else if (iVar14 == 0x30) { - iVar14 = 0x15; - } - else { - if (iVar14 != 0x32) goto LAB_007bdb5f; - iVar14 = 0xc; - } - AddPocketItem(pEVar12,iVar14,1); - pGVar8 = extraout_EDX_02; - } -LAB_007bdb5f: - local_94 = (PersistentGameData *) - CONCAT31((int3)(GHIDRA_UINT(pGVar8) >> 8),*GHIDRA_CAST(&g_game->_deathmatchManager) < 2); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && - (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1)))) { - (GHIDRA_CAST((&PTR_vftable_00c57b18)))->InputManager::get_device(&local_dc,pEVar12->_controllerIndex); - local_8 = 1; - if (GHIDRA_UINT(local_dc) != 0) { - iVar14 = __RTDynamicCast(GHIDRA_UINT(local_dc),0,&KAGE::Input::InputDeviceBase::RTTI_Type_Descriptor, - &IsaacRepentancePlus::NetInputDevice::RTTI_Type_Descriptor,0); - if (iVar14 != 0) { - iVar14 = *GHIDRA_CAST((iVar14 + 0x374)); - if (iVar14 == 0) { - local_ac = 0; - uVar11 = local_ac; - uStack_a8 = 0; - local_ac = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(deviceUserId)) + 0x0))) = local_ac; - uVar10 = uStack_a8; - local_ac = uVar11; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(deviceUserId)) + 0x0))) = *GHIDRA_CAST((iVar14 + 8)); - uVar10 = *GHIDRA_CAST((iVar14 + 0xc)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(deviceUserId)) + 0x4))) = uVar10; - uStack_a8 = GHIDRA_UINT(deviceUserId); - FUN_00731ee0(local_120,&deviceUserId); - if (((*GHIDRA_CAST((local_118 + 0xd)) != '\0') || (uVar10 < *GHIDRA_CAST((local_118 + 0x14)))) || - ((uVar10 <= *GHIDRA_CAST((local_118 + 0x14)) && (uStack_a8 < *GHIDRA_CAST((local_118 + 0x10)))))) { - local_118 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(g_manager[1]._gamestate)) + 0xc8)))); - } - local_94 = GHIDRA_CAST((GHIDRA_UINT(local_94) & 0xff)); - if (local_118 != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(g_manager[1]._gamestate)) + 0xc8))))) { - local_94 = GHIDRA_CAST(0x0); - } - pPVar5 = local_a4; - } - } - local_8 = 2; - if ((((*GHIDRA_CAST((GHIDRA_CAST(&(local_dc)) + 0x4))) != GHIDRA_CAST(0x0)) && - (cVar4 = (**(code **)(*(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_dc))) + 0x4))) + 0xc))(), cVar4 != '\0')) && - (g_inputDeviceRelease != (void *)0x0)) { - (*g_inputDeviceRelease)(&local_dc); - } - local_8 = 0xffffffff; - } - if (((char)local_94 != '\0') && ((*GHIDRA_CAST(pPVar5) == 9 || (*GHIDRA_CAST(pPVar5) == 0x1e)))) { - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - bVar3 = (uint8_t)rng._shift1; - uVar9 = uVar9 >> (bVar3 & 0x1f) ^ uVar9; - shift2 = (uint8_t)rng._shift2; - uVar9 = uVar9 << (shift2 & 0x1f) ^ uVar9; - shift3 = (uint8_t)rngShift3; - uVar9 = uVar9 >> (shift3 & 0x1f) ^ uVar9; - if (uVar9 == (uVar9 / 3) * 3) { - bVar3 = 1; - uVar11 = ItemPool::GetTrinket(&g_game->_itemPool,0); - AddTrinket(pEVar12,uVar11,bVar3); - } - else { - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar9 = uVar9 >> (bVar3 & 0x1f) ^ uVar9; - uVar9 = uVar9 << (shift2 & 0x1f) ^ uVar9; - uVar9 = uVar9 >> (shift3 & 0x1f) ^ uVar9; - if ((uVar9 & 1) == 0) { - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar9 = uVar9 >> (bVar3 & 0x1f) ^ uVar9; - uVar9 = uVar9 << (shift2 & 0x1f) ^ uVar9; - rng._seed = uVar9 >> (shift3 & 0x1f) ^ uVar9; - if ((rng._seed & 1U) == 0) { - uVar9 = (GHIDRA_CAST((&rng)))->RNG::Next(); - iVar14 = ItemPool::GetCardEx(uVar9,0x19,0,0,1); - tmpRng._shift1 = 5; - tmpRng._shift2 = 9; - tmpRng._shift3 = 7; - tmpRng._seed = uVar9; - iVar14 = lua_callback_run_get_card(&tmpRng,iVar14,0,0,0); - AddPocketItem(pEVar12,iVar14,1); - } - else { - uVar9 = (GHIDRA_CAST((&rng)))->RNG::Next(); - iVar14 = ItemPool::GetPill(uVar9); - AddPocketItem(pEVar12,iVar14,0); - } - uVar9 = rng._seed; - rngShift3 = rng._shift3; - } - } - local_90 = 0; - local_94 = GHIDRA_CAST(0x0); - uStack_a8 = 100; - do { - uVar11 = (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2) - 1; - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar9 = uVar9 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar9; - uVar9 = uVar9 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar9; - uVar9 = uVar9 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar9; - uVar10 = 0; - if (uVar11 != 0) { - uVar10 = uVar9 % uVar11; - } - uVar10 = uVar10 + 1; - local_b4 = &g_manager->_itemConfig; - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar10)) goto LAB_007bdf2c; -LAB_007bdf3f: - piVar15 = GHIDRA_CAST(0x0); - } - else if (GHIDRA_INT(uVar10) < 0) { - if ((GHIDRA_INT(uVar10) < 0) && - (pvVar7 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar10) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar7) >> 2)) { - piVar15 = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar7) + ~uVar10 * 4))); - } - else { - piVar15 = GHIDRA_CAST(0x0); - } - } - else { -LAB_007bdf2c: - pvVar7 = (local_b4->_collectibles)._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) >> 2 <= GHIDRA_INT(uVar10)) - goto LAB_007bdf3f; - piVar15 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + uVar10 * 4)); - } - rng._seed = uVar9; - if (((((uVar10 != 0) && - (GHIDRA_INT(uVar10) < - GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((local_b4->_collectibles)._begin) >> 2)) && (uVar10 != 0xeb)) && - ((uVar10 != 0x2b && (uVar10 != 0x3d)))) && - ((collectibleConfig = ItemConfig::GetCollectible(local_b4,uVar10), - collectibleConfig != GHIDRA_CAST(0x0) && ((piVar15[0x2f] & 1U) == 0)))) { - bVar3 = (GHIDRA_CAST((piVar15)))->Item::IsAvailable(0xffffffff); - if (bVar3 != 0) { - if (*piVar15 == 3) { - if (local_94 == GHIDRA_CAST(0x0)) { - local_94 = GHIDRA_CAST(uVar10); - } - } - else if (local_90 == 0) { - local_90 = uVar10; - } - } - } - pEVar12 = playerCopy; - uVar11 = local_90; - uStack_a8 = uStack_a8 - 1; - } while (uStack_a8 != 0); - local_90 = uVar9; - if (local_94 != GHIDRA_CAST(0x0)) { - AddCollectible(playerCopy,GHIDRA_INT(local_94),-1,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,GHIDRA_INT(local_94),0,0); - } - if (uVar11 != 0) { - AddCollectible(pEVar12,uVar11,-1,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar11,0,0); - } - pEVar12 = playerCopy; - } - pCVar16 = local_d0; - if (local_d0->_isMegaSatan != 0) { - AddCollectible(pEVar12,0xee,0,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,0xee,0,0); - AddCollectible(pEVar12,0xef,0,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,0xef,0,0); - } - if ((g_game->_challenge == 0) && ((g_game->_dailyChallenge)._id == 0)) { - if (pCStack_b8 == GHIDRA_CAST(0x0)) { - local_a4 = &g_manager->_persistentGameData; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - iVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar12)) + 0x1e50)))); - if (iVar14 == 0) { - local_bc = 0; - uVar11 = local_bc; - pCStack_b8 = GHIDRA_CAST(0x0); - local_bc = 0; - local_d4 = local_bc; - pCVar16 = pCStack_b8; - local_bc = uVar11; - } - else { - local_d4 = *GHIDRA_CAST((iVar14 + 8)); - pCVar16 = *GHIDRA_CAST((iVar14 + 0xc)); - } - pCStack_b8 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(g_manager[1]._gamestate)) + 0xc0)))); - local_d0 = pCVar16; - uStack_a8 = local_d4; - FUN_00731ee0(&local_34._shift1,&local_d4); - if ((((*GHIDRA_CAST((local_34._shift3 + 0xd)) == '\0') && - (*GHIDRA_CAST((local_34._shift3 + 0x14)) <= pCVar16)) && - ((*GHIDRA_CAST((local_34._shift3 + 0x14)) < pCVar16 || - (*GHIDRA_CAST((local_34._shift3 + 0x10)) <= uStack_a8)))) && - (local_34._shift3 != *GHIDRA_CAST((pCStack_b8->_name)._buf))) { - local_a4 = GHIDRA_CAST(FUN_00914150(&local_d4)); - } - else { - local_a4 = GHIDRA_CAST(0x0); - } - } - local_94 = GHIDRA_CAST(local_a4->_eventCounters[0x72]); - local_b4 = GHIDRA_CAST((GHIDRA_UINT(local_94) >> 0x10)); - if (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) { - local_b4 = GHIDRA_CAST((GHIDRA_UINT(local_94) & 0xffff)); - } - if (GHIDRA_CAST(0x2) < local_b4) { - local_b4 = GHIDRA_CAST(0x2); - } - if (local_b4 != GHIDRA_CAST(0x0)) { - do { - uStack_a8 = 0; -LAB_007be1e0: - uVar11 = (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2) - 1; - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar9 = uVar9 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar9; - uVar9 = uVar9 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar9; - rng._seed = uVar9 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar9; - uVar9 = 0; - if (uVar11 != 0) { - uVar9 = GHIDRA_UINT(rng._seed) % uVar11; - } - uVar9 = uVar9 + 1; - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar9)) goto LAB_007be280; -LAB_007be29a: - piVar15 = GHIDRA_CAST(0x0); - } - else if (GHIDRA_INT(uVar9) < 0) { - if ((-1 < GHIDRA_INT(uVar9)) || - (pvVar7 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar7) >> 2 <= - GHIDRA_INT(~uVar9))) goto LAB_007be29a; - piVar15 = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar7) + ~uVar9 * 4))); - } - else { -LAB_007be280: - pvVar7 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) >> 2 <= GHIDRA_INT(uVar9)) - goto LAB_007be29a; - piVar15 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + uVar9 * 4)); - } - local_90 = rng._seed; - if ((((uVar9 == 0) || - (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2 <= GHIDRA_INT(uVar9))) || - (uVar9 == 0xeb)) || - (((uVar9 == 0x2b || (uVar9 == 0x3d)) || - ((collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,uVar9), - collectibleConfig == GHIDRA_CAST(0x0) || ((piVar15[0x2f] & 1U) != 0)))))) { -LAB_007be376: - uStack_a8 = uStack_a8 + 1; - pEVar12 = playerCopy; - if (99 < GHIDRA_INT(uStack_a8)) goto LAB_007be345; - uVar9 = local_90; - goto LAB_007be1e0; - } - bVar3 = (GHIDRA_CAST((piVar15)))->Item::IsAvailable(0xffffffff); - pEVar12 = playerCopy; - if ((bVar3 == 0) || ((*piVar15 == 3 && (playerCopy->_activeDesc[0]._item != 0)))) - goto LAB_007be376; - AddCollectible(playerCopy,uVar9,-1,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar9,0,0); -LAB_007be345: - local_b4 = GHIDRA_CAST((GHIDRA_INT((local_b4 + -1)) + 0x10f)); - if (local_b4 == GHIDRA_CAST(0x0)) goto code_r0x007be352; - uVar9 = local_90; - } while( true ); - } - } - } - else { - twin = GHIDRA_CAST(pEVar12->_twinPlayer); - if ((((twin == GHIDRA_CAST(0x0)) || (twin->_playerIndex == -1)) || - (pEVar12->_playerIndex <= twin->_playerIndex)) || (twin == pEVar12)) { - piVar15 = (pCVar16->_collectibleList)._begin; - if (piVar15 < (pCVar16->_collectibleList)._end) { - do { - iVar14 = *piVar15; - if (iVar14 < 0) { - RemoveCollectible(pEVar12,-iVar14,0,0,1); - } - else { - AddCollectible(pEVar12,iVar14,-1,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,*piVar15,0,0); - } - piVar15 = piVar15 + 1; - } while (piVar15 < (pCVar16->_collectibleList)._end); - } - piVar15 = (pCVar16->_trinketList)._begin; - if (piVar15 < (pCVar16->_trinketList)._end) { - do { - AddTrinket(pEVar12,*piVar15,1); - pGVar8 = g_game; - iVar14 = *piVar15; - if (((0 < iVar14) && - (pvVar7 = (g_game->_itemPool)._trinketPoolItems._begin, - iVar14 < GHIDRA_INT((g_game->_itemPool)._trinketPoolItems._end) - GHIDRA_INT(pvVar7) >> 3)) && - ((*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + iVar14 * 8 + 4)) != '\0' && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + iVar14 * 8 + 5)) != '\0')))) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + iVar14 * 8 + 4)) = 0; - piVar13 = &(pGVar8->_itemPool)._numAvailableTrinkets; - *piVar13 = *piVar13 + -1; - } - piVar15 = piVar15 + 1; - pCVar16 = local_d0; - } while (piVar15 < (local_d0->_trinketList)._end); - } - if (pCVar16->_startingPill != -1) { - uVar9 = ItemPool::ForceAddPillEffect(&g_game->_itemPool,pCVar16->_startingPill); - AddPocketItem(pEVar12,uVar9,0); - uVar11 = -GHIDRA_UINT(((uVar9 & 0x7ff) != 0)) & uVar9 & 0x7ff; - uVar9 = 0xe; - if (uVar11 < 0xe) { - uVar9 = uVar11; - } - *GHIDRA_CAST((GHIDRA_CAST((&g_game->_itemPool + 1)) + uVar9 + 0x3c)) = 1; - } - iVar14 = pCVar16->_startingCard; - if (iVar14 != 0) { - if (iVar14 == -1) { - if (local_90 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - local_90 = local_90 >> ((uint8_t)rng._shift1 & 0x1f) ^ local_90; - local_90 = local_90 << ((uint8_t)rng._shift2 & 0x1f) ^ local_90; - uVar9 = local_90 >> ((uint8_t)rngShift3 & 0x1f) ^ local_90; - rng._seed = uVar9; - local_90 = uVar9; - iVar14 = ItemPool::GetCardEx(uVar9,0x19,0,0,1); - local_34._shift1 = 5; - local_34._shift2 = 9; - local_34._shift3 = 7; - local_34._seed = uVar9; - iVar14 = lua_callback_run_get_card(&local_34,iVar14,0,0,0); - AddPocketItem(pEVar12,iVar14,1); - goto LAB_007be608; - } - AddPocketItem(pEVar12,iVar14,1); - } - } - else { - piVar15 = (pCVar16->_collectibleTwinList)._begin; - if (piVar15 < (pCVar16->_collectibleTwinList)._end) { - do { - iVar14 = *piVar15; - if (iVar14 < 0) { - RemoveCollectible(pEVar12,-iVar14,0,0,1); - } - else { - AddCollectible(pEVar12,iVar14,-1,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,*piVar15,0,0); - } - piVar15 = piVar15 + 1; - } while (piVar15 < (pCVar16->_collectibleTwinList)._end); - } - } - } -LAB_007be602: - uVar9 = local_90; - goto LAB_007be608; -code_r0x007be352: - netplayManager = &g_manager->_netplayManager; - if (*netplayManager == *GHIDRA_CAST((g_manager + 1))) { - uVar11 = GHIDRA_UINT(local_94) & 0xffff0000; - } - else { - uVar11 = GHIDRA_UINT(local_94) & 0xffff; - } - local_a4->_eventCounters[0x72] = uVar11; - pvVar7 = (GHIDRA_CAST((netplayManager)))->InputManager::GetDeviceByPlayerEntity(pEVar12); - if (pvVar7 == (void *)0x0) goto LAB_007be602; - cVar4 = (**(code **)(*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x370)) + 0x14))(); - uVar9 = local_90; - if (cVar4 != '\0') { - g_manager[1]._persistentGameData._eventCounters[0x83] = uVar11; - } -LAB_007be608: - EvaluateItems(pEVar12); - pGVar8 = g_game; - netplayManager = (g_game->_playerManager)._playerList._begin; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT(netplayManager) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - netplayManager = (pGVar8->_playerManager)._playerList._begin; - } - ConsumableCountChanged(GHIDRA_CAST(*netplayManager),-1); - if (pEVar12->_replacedPlayer == (void *)0x0) { - iVar14 = pEVar12->_playerType; - if (iVar14 == 0x13) { - tmpPlayer = InitTwin(pEVar12,0x14); - InitPostLevelInitStats(tmpPlayer); - } - else if (iVar14 == 0x23) { - if (pEVar12->_isCoopGhost == 0) { - tmpPlayer = InitTwin(pEVar12,0x28); - InitPostLevelInitStats(tmpPlayer); - } - } - else if (iVar14 == 0x22) { - uVar11 = Random(); - familiar = Game::Spawn(g_game,3,0xe7,&pEVar12->_pos,&g_vectorZero,GHIDRA_CAST(pEVar12),0x19, - uVar11); - familiar->Update(); - } - else if ((iVar14 == 0x25) && (g_game->_challenge != 0x2c)) { - (GHIDRA_CAST((&pEVar12->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x6d,-1); - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) >> 2 < 0x6e) { - tmpEffect[0] = 0; - } - else { - tmpEffect[0] = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x1b4)); - } - tmpEffect[1] = 0; - local_e0 = 0; - tmpRng._shift1 = 0xb; - tmpRng._shift2 = 7; - uVar11 = (g_game->_devilAngelRoomRNG)._seed; - pCStack_b8 = GHIDRA_CAST(0xc); - if (uVar11 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar11 = uVar11 >> 0xb ^ uVar11; - uVar11 = uVar11 << 7 ^ uVar11; - tmpEffect[2] = ((uVar11 >> 0xc ^ uVar11) % 0x14) * 0x1e + 0x262; - (GHIDRA_CAST((&pEVar12->_temporaryeffects)))->TemporaryEffects::AddEffect(tmpEffect,1,1); - } - } - manager = g_manager; - if (g_game->_challenge == 0x1f) { - itemsBegin = GHIDRA_CAST(0x0); - itemsEnd = GHIDRA_CAST(0x0); - local_a4 = GHIDRA_CAST(0x0); - itemsCapacity = GHIDRA_CAST(0x0); - local_8 = 3; - local_78 = g_manager; - pvVar7 = (g_manager->_itemConfig)._collectibles._end; - collectibles = (g_manager->_itemConfig)._collectibles._begin; - uVar11 = GHIDRA_INT(pvVar7) - GHIDRA_INT(collectibles) >> 2; - if (uVar11 != 0) { - if (0x3fffffff < uVar11) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - msvc::vector::_Reallocate(uVar11); - pvVar7 = (manager->_itemConfig)._collectibles._end; - collectibles = (manager->_itemConfig)._collectibles._begin; - } - uVar11 = 0; - piVar15 = itemsEnd; - local_a4 = GHIDRA_CAST(itemsCapacity); - if (GHIDRA_INT(pvVar7) - GHIDRA_INT(collectibles) >> 2 != 0) { - do { - local_74 = *GHIDRA_CAST((GHIDRA_CAST(collectibles) + uVar11 * 4)); - if (uVar11 != 0) { - pvVar7 = (g_manager->_itemConfig)._collectibles._begin; - if ((((GHIDRA_INT(uVar11) < GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) >> 2) - && (uVar11 != 0xeb)) && (uVar11 != 0x2b)) && (uVar11 != 0x3d)) { - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar11)) goto LAB_007be8da; - } - else { - if (GHIDRA_INT(uVar11) < 0) { - if ((GHIDRA_INT(uVar11) < 0) && - (pvVar7 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar11) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar7) >> 2)) - { - iVar14 = **GHIDRA_CAST((GHIDRA_CAST(pvVar7) + ~uVar11 * 4)); - } - else { - iVar14 = 0; - } - } - else { -LAB_007be8da: - iVar14 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + uVar11 * 4)); - } - if (((iVar14 != 0) && ((local_74[0x2f] & 1U) == 0)) && (*local_74 != 3)) { - bVar3 = (GHIDRA_CAST((local_74)))->Item::IsAvailable(0xffffffff); - if (bVar3 != 0) { - pCStack_b8 = GHIDRA_CAST(local_74[1]); - if (GHIDRA_CAST(piVar15) == local_a4) { - msvc::vector::_Emplace_reallocate(piVar15,&pCStack_b8); - local_a4 = GHIDRA_CAST(itemsCapacity); - piVar15 = itemsEnd; - } - else { - *piVar15 = GHIDRA_INT(pCStack_b8); - itemsEnd = piVar15 + 1; - piVar15 = itemsEnd; - } - } - } - } - } - } - uVar11 = uVar11 + 1; - collectibles = (local_78->_itemConfig)._collectibles._begin; - } while (uVar11 < GHIDRA_UINT((GHIDRA_INT((local_78->_itemConfig)._collectibles._end) - GHIDRA_INT(collectibles) - >> 2))); - uVar9 = local_90; - } - local_d0 = GHIDRA_CAST(0x0); - piVar13 = itemsBegin; - do { - piVar2 = itemsBegin; - if (piVar13 == piVar15) break; - uVar11 = GHIDRA_INT(piVar15) - GHIDRA_INT(itemsBegin) >> 2; - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar9 = uVar9 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar9; - uVar9 = uVar9 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar9; - uVar9 = uVar9 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar9; - uVar10 = 0; - if (uVar11 != 0) { - uVar10 = uVar9 % uVar11; - } - if (uVar10 < (GHIDRA_INT(piVar15) - GHIDRA_INT(itemsBegin) >> 2) - 1U) { - iVar14 = itemsBegin[uVar10]; - itemsBegin[uVar10] = piVar15[-1]; - piVar15[-1] = iVar14; - } - piVar15 = piVar15 + -1; - AddCollectible(playerCopy,*piVar15,0,1,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,*piVar15,0,0); - local_d0 = GHIDRA_CAST(((local_d0->_name)._buf + 1)); - piVar13 = piVar2; - itemsEnd = piVar15; - } while (local_d0 < GHIDRA_CAST(0xa)); - local_8 = 0xffffffff; - if (piVar13 != GHIDRA_CAST(0x0)) { - deallocate(piVar13,GHIDRA_INT(local_a4) - GHIDRA_INT(piVar13) >> 2); - } - pEVar12 = playerCopy; - } - if (g_game->_challenge == 0x2b) { - iVar14 = 3; - do { - AddItemCard(pEVar12,0); - iVar14 = iVar14 + -1; - } while (iVar14 != 0); - } -LAB_007bea6e: - pEVar12->_postLevelInitFinished = 1; - ExceptionList = local_10; - return; -} - -// 007bebb0 -void Entity_Player::update_player_skin() -{ - uint32_t uVar1; - uint32_t uVar2; - uint32_t uVar3; - void *pvVar4; - ChallengeParam *challengeParams; - ItemConfig_Item *costume; - std_string *strResult; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint8_t extraout_CL_01; - uint8_t extraout_CL_02; - uint8_t extraout_CL_03; - uint8_t extraout_CL_04; - int iVar5; - char *freePtr; - void *extraout_ECX; - void *extraout_ECX_00; - void *extraout_ECX_01; - uint8_t *freeSize; - uint32_t uVar6; - Game *game; - std_string *playerName; - uint8_t unk; - Entity_Player *local_78; - LayerState *local_74; - EntityConfig_Player *playerConfig; - void *displayName [5]; - uint32_t displayNameCapacity; - void *skinColorStr [5]; - uint32_t skinColorStrCapacity; - std_string local_3c; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - void *local_14; - - game = g_game; - puStack_20 = GHIDRA_CAST((skinColorStr + 0x14)); - local_14 = (void *)0xffffffff; - puStack_18 = &LAB_00affefd; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((skinColorStr + 0x11)); - ExceptionList = &local_1c; - local_78 = this; - if (this->_isCoopGhost != 0) { - reset_body_sprite(this); - ExceptionList = local_1c; - return; - } - iVar5 = this->_playerType; - if ((iVar5 < 0) || - (pvVar4 = (g_manager->_entityConfig)._players._begin, - (GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(pvVar4)) / 0x148 <= iVar5)) { - playerConfig = GHIDRA_CAST(0x0); - } - else { - playerConfig = GHIDRA_CAST((iVar5 * 0x148 + GHIDRA_INT(pvVar4))); - } - this->_bodyColor = -1; - this->_headColor = -1; - if (game->_challenge == 0x1e) { - uVar6 = 0; - puStack_20 = GHIDRA_CAST((skinColorStr + 0x14)); - do { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) = msvc::_Allocate(0x30); - local_3c._size = 0x26; - local_3c._capacity = GHIDRA_UINT(&DAT_0000002f); - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_3c._buf))) + 0x0))),"gfx/characters/costumes/NiceLilith.png",0x27); - local_14 = (void *)0x0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(uVar6,&local_3c); - local_14 = (void *)0xffffffff; - unk = extraout_CL; - if (&DAT_0000000f < local_3c._capacity) { - freeSize = GHIDRA_CAST((local_3c._capacity + 1)); - freePtr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_3c._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < freeSize) { - freePtr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) + -4)); - freeSize = GHIDRA_CAST((local_3c._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) + (-4 - GHIDRA_INT(freePtr))))) goto LAB_007bee2a; - } - operator_delete(freePtr,GHIDRA_UINT(freeSize)); - unk = extraout_CL_00; - } - uVar6 = uVar6 + 1; - } while (uVar6 < 0xf); -LAB_007bee42: - ANM2::LoadGraphics(&this->_sprite,unk); - } - else { - puStack_20 = GHIDRA_CAST((skinColorStr + 0x14)); - if ((playerConfig->_skinPath)._size != 0) { - uVar6 = 0; - local_74 = GHIDRA_CAST(&playerConfig->_skinPath); - puStack_20 = GHIDRA_CAST((skinColorStr + 0x14)); - do { - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(uVar6,GHIDRA_CAST(local_74)); - uVar6 = uVar6 + 1; - } while (uVar6 < 0xf); - local_74 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST("ghost")); - this = local_78; - if (local_74 == GHIDRA_CAST(0x0)) { - unk = extraout_CL_01; - } - else { - iVar5 = local_78->_playerType; - pvVar4 = (void *)FUN_004562f0(skinColorStr); - local_14 = (void *)0x1; - strResult = costume_path_apply_skin_color(&local_3c,pvVar4,-1,iVar5,GHIDRA_CAST(0x0),GHIDRA_CAST(0x0)) - ; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - if (local_74->_layerData == GHIDRA_CAST(0x0)) { - iVar5 = -1; - } - else { - iVar5 = *GHIDRA_CAST(local_74->_layerData); - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(iVar5,strResult); - local_14 = (void *)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - unk = extraout_CL_02; - if (&DAT_0000000f < local_3c._capacity) { - freeSize = GHIDRA_CAST((local_3c._capacity + 1)); - freePtr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_3c._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < freeSize) { - freePtr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) + -4)); - freeSize = GHIDRA_CAST((local_3c._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) + (-4 - GHIDRA_INT(freePtr))))) - goto LAB_007bee2a; - } - operator_delete(freePtr,GHIDRA_UINT(freeSize)); - unk = extraout_CL_03; - } - local_14 = (void *)0xffffffff; - local_3c._size = 0; - local_3c._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_3c._buf)) + 0x0))) & 0xffffff00; - if (0xf < skinColorStrCapacity) { - uVar6 = skinColorStrCapacity + 1; - pvVar4 = skinColorStr[0]; - if (0xfff < uVar6) { - pvVar4 = *(void **)(GHIDRA_INT(skinColorStr[0]) + -4); - uVar6 = skinColorStrCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(skinColorStr[0]) + (-4 - GHIDRA_INT(pvVar4))))) { -LAB_007bee2a: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar4,uVar6); - unk = extraout_CL_04; - } - } - goto LAB_007bee42; - } - } - iVar5 = playerConfig->_costumeID; - if (iVar5 == -1) { - UpdateCostumes(this); - } - else if ((iVar5 < 0) || - (pvVar4 = (g_manager->_itemConfig)._nullItems._begin, - GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar4) >> 2 <= iVar5)) { - AddCostume(this,GHIDRA_CAST(0x0),0); - } - else { - AddCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + iVar5 * 4)),0); - } - game = g_game; - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - challengeParams = Game::GetChallengeParams(g_game); - if (challengeParams->_canShoot == 0) { - if ((this->_playerType != 0x23) && (this->_playerType != 0x28)) { - pvVar4 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar4) & 0xfffffffcU)) < 0x39) - { - costume = GHIDRA_CAST(0x0); - } - else { - costume = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x38)); - } - AddCostume(this,costume,0); - goto LAB_007beef4; - } - } - } - else { -LAB_007beef4: - game = g_game; - } - local_78 = GHIDRA_CAST(0x36); - msvc::set::find_node(GHIDRA_CAST((GHIDRA_INT(&local_3c) + 0xc)),&local_78); - if (((*GHIDRA_CAST((local_3c._capacity + 0xd)) != '\0') || (0x36 < *GHIDRA_CAST((local_3c._capacity + 0x10))) - ) || ((void *)local_3c._capacity == (game->_seedEffects)._seedEffects)) { - pvVar4 = extraout_ECX; - if ((game->_dailyChallenge)._specialDailyId != 0x13) goto LAB_007bef66; - } - pvVar4 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar4) & 0xfffffffcU)) < 0x41) { - costume = GHIDRA_CAST(0x0); - } - else { - costume = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x40)); - } - AddCostume(this,costume,0); - pvVar4 = extraout_ECX_00; - game = g_game; -LAB_007bef66: - if ((game->_challenge == 0x2a) && (this->_playerType == 0x23)) { - pvVar4 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar4) & 0xfffffffcU)) < 0x1a9) { - costume = GHIDRA_CAST(0x0); - } - else { - costume = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x1a8)); - } - AddCostume(this,costume,0); - pvVar4 = extraout_ECX_01; - } - strResult = EntityConfig_Player::GetDisplayName(playerConfig,GHIDRA_CAST(displayName),pvVar4); - playerName = &this->_name; - if (playerName != strResult) { - (GHIDRA_CAST((playerName->_buf)))->msvc::string::_Tidy_deallocate(); - uVar1 = *GHIDRA_CAST((strResult->_buf + 4)); - uVar2 = *GHIDRA_CAST((strResult->_buf + 8)); - uVar3 = *GHIDRA_CAST((strResult->_buf + 0xc)); - *GHIDRA_CAST(playerName->_buf) = *GHIDRA_CAST(strResult->_buf); - *GHIDRA_CAST(((this->_name)._buf + 4)) = uVar1; - *GHIDRA_CAST(((this->_name)._buf + 8)) = uVar2; - *GHIDRA_CAST(((this->_name)._buf + 0xc)) = uVar3; - uVar6 = strResult->_capacity; - (this->_name)._size = strResult->_size; - (this->_name)._capacity = uVar6; - strResult->_size = 0; - strResult->_capacity = 0xf; - strResult->_buf[0] = '\0'; - } - if (0xf < displayNameCapacity) { - uVar6 = displayNameCapacity + 1; - pvVar4 = displayName[0]; - if (0xfff < uVar6) { - pvVar4 = *(void **)(GHIDRA_INT(displayName[0]) + -4); - uVar6 = displayNameCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(displayName[0]) + (-4 - GHIDRA_INT(pvVar4))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar4,uVar6); - } - ExceptionList = local_1c; - return; -} - -// 007bf040 -void Entity_Player::InitBabySkin() -{ - uint8_t unk; - Entity_Player *pEVar1; - Entity_Player *extraout_ECX; - Entity_Player *extraout_ECX_00; - Entity_Player *extraout_ECX_01; - uint32_t uVar2; - Manager *manager; - - manager = g_manager; - uVar2 = this->_babySkin; - if (uVar2 < 0x47) { - pEVar1 = (Entity_Player *) - (GHIDRA_INT((g_manager->_entityConfig)._babies._end) - - GHIDRA_INT((g_manager->_entityConfig)._babies._begin)); - if (GHIDRA_UINT((GHIDRA_INT(pEVar1) / 0x38)) <= uVar2) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Baby list is smaller than requested baby %d!")); - pEVar1 = extraout_ECX; - } - uVar2 = 0; - if ((this->_sprite)._layerCount != 0) { - do { - Sprite::ReplaceSpritesheet - (GHIDRA_CAST(&this->_sprite),uVar2, - (std_string *) - (GHIDRA_INT((manager->_entityConfig)._babies._begin) + this->_babySkin * 0x38 + 0x1c)); - uVar2 = uVar2 + 1; - } while (uVar2 < GHIDRA_UINT((this->_sprite)._layerCount)); - ANM2::LoadGraphics(&this->_sprite,unk); - return; - } - } - else { - pEVar1 = this; - if (uVar2 == 0x47) { - uVar2 = this->_subtype; - if ((uVar2 < 0x47) || - (GHIDRA_UINT(((GHIDRA_INT((g_manager->_entityConfig)._babies._end) - - GHIDRA_INT((g_manager->_entityConfig)._babies._begin)) / 0x38)) <= uVar2)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Bad baby basic id %d")); - uVar2 = this->_subtype; - pEVar1 = extraout_ECX_00; - if (uVar2 < 0x47) goto LAB_007bf18d; - } - pEVar1 = (Entity_Player *) - (GHIDRA_INT((manager->_entityConfig)._babies._end) - - GHIDRA_INT((manager->_entityConfig)._babies._begin)); - if ((uVar2 < GHIDRA_UINT((GHIDRA_INT(pEVar1) / 0x38))) && (uVar2 = 0, (this->_sprite)._layerCount != 0)) { - do { - Sprite::ReplaceSpritesheet - (GHIDRA_CAST(&this->_sprite),uVar2, - (std_string *) - (GHIDRA_INT((manager->_entityConfig)._babies._begin) + this->_subtype * 0x38 + 0x1c)); - uVar2 = uVar2 + 1; - pEVar1 = extraout_ECX_01; - } while (uVar2 < GHIDRA_UINT((this->_sprite)._layerCount)); - } - } - } -LAB_007bf18d: - ANM2::LoadGraphics(&this->_sprite,(uint8_t)pEVar1); - return; -} - -// 007bf1a0 -Entity_Laser * Entity_Player::FireDelayedBrimstone(float angle, Entity *parent) -{ - uint8_t bVar1; - int brimstoneCount; - Entity_Laser *laser; - uint32_t uVar2; - float *maxDistancePtr; - uint32_t uVar3; - int variant; - uint32_t uVar4; - bool bVar5; - float fVar6; - uint8_t uStack_99; - uint8_t hitParams [16]; - float fStack_7c; - uint32_t uStack_58; - uint32_t uStack_54; - uint32_t uStack_50; - uint32_t uStack_4c; - float fStack_44; - uint32_t local_c; - uint32_t *parentRef; - - local_c = __security_cookie ^ GHIDRA_UINT(hitParams); - (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams)) + 0x4))) = angle; - variant = 1; - (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams)) + 0x8))) = parent; - bVar1 = HasCollectible(this,0x44,0); - if (bVar1 != 0) { - variant = 9; - } - brimstoneCount = GetCollectibleNum(this,0x76,0); - if ((1 < brimstoneCount) && (bVar5 = variant == 9, variant = 0xb, bVar5)) { - variant = 0xe; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams)) + 0xc))) = (parent->_pos).x; - fStack_7c = (parent->_pos).y; - laser = Entity_Laser::ShootAngle - (variant,GHIDRA_CAST((hitParams + 0xc)),(*GHIDRA_CAST((GHIDRA_CAST(&((float)hitParams)) + 0x4))),10, - &parent->_posOffset,GHIDRA_CAST(this),0); - fVar6 = 0.0; - laser->SetColor(&this->_laserColor,0xffffffff,0xff); - uVar2 = Random(); - GetTearHitParams(this,GHIDRA_CAST(hitParams),2,1.0,(uVar2 & 1) * 2 + -1,GHIDRA_CAST(0x0)); - laser->SetCollisionDamage(fStack_44); - uVar4 = ~GHIDRA_UINT(g_tearFlagOccult._h); - uVar3 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._h)) + 0x4))); - uVar2 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._l)) + 0x4))); - *GHIDRA_CAST(&(laser->_tearFlags)._l) = ~GHIDRA_UINT(g_tearFlagOccult._l) & uStack_58; - *GHIDRA_CAST((GHIDRA_INT(&(laser->_tearFlags)._l) + 4)) = uVar2 & uStack_54; - *GHIDRA_CAST(&(laser->_tearFlags)._h) = uVar4 & uStack_50; - *GHIDRA_CAST((GHIDRA_INT(&(laser->_tearFlags)._h) + 4)) = uVar3 & uStack_4c; - (*GHIDRA_CAST((GHIDRA_CAST((laser)) + 0x517))) = 1; - fVar6 = sin(fVar6 * 0.017453292); - if (fVar6 <= -0.5) { - fVar6 = -10.0; - } - else { - fVar6 = 3000.0; - } - parentRef = &laser->_parent; - laser->_renderDepthOffset = fVar6; - if (*parentRef != 0) { - msvc::multiset::erase(hitParams + -0x14); - } - *parentRef = 1; - msvc::multiset::insert(parentRef); - if ((this->_playerType != 7) && - (bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasTrinketEffect(0xa2), bVar1 == 0)) { - return laser; - } - bVar1 = HasCollectible(this,0x76,0); - if (bVar1 == 0) { - maxDistancePtr = GHIDRA_CAST((hitParams + -0x10)); - if (this->_tearrange * 0.25 + 32.0 <= 60.0) { - maxDistancePtr = GHIDRA_CAST((hitParams + -0x14)); - } - laser->_maxDistance = *maxDistancePtr; - } - return laser; -} - -// 007bf3d0 -uint8_t Entity_Player::CanPickupItem() -{ - uint8_t bVar1; - uint8_t *animChar; - uint32_t compareResult; - char *deathChar; - uint8_t *otherAnimChar; - uint8_t *animName; - bool isLess; - - animName = (this->_sprite)._animState._animData; - if (animName == GHIDRA_CAST(0x0)) { - animName = &s_empty; - } - else if (0xf < *GHIDRA_CAST((animName + 0x14))) { - animName = *GHIDRA_CAST(animName); - } - if ((this->_isPlayingExtraAnimation != 0) || (this->_isPlayingItemAnimation != 0)) { - otherAnimChar = &DAT_00b1d3b0; - animChar = animName; - do { - bVar1 = *animChar; - isLess = bVar1 < *otherAnimChar; - if (bVar1 != *otherAnimChar) { -LAB_007bf423: - compareResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007bf428; - } - if (bVar1 == 0) break; - bVar1 = animChar[1]; - isLess = bVar1 < otherAnimChar[1]; - if (bVar1 != otherAnimChar[1]) goto LAB_007bf423; - animChar = animChar + 2; - otherAnimChar = otherAnimChar + 2; - } while (bVar1 != 0); - compareResult = 0; -LAB_007bf428: - if ((compareResult != 0) && (bVar1 = IsHoldingItem(this), bVar1 == 0)) { - return 0; - } - } - if (this->_dead == 0) { - deathChar = "Death"; - do { - bVar1 = *animName; - isLess = bVar1 < (uint8_t)*deathChar; - if (bVar1 != *deathChar) { -LAB_007bf465: - compareResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007bf46a; - } - if (bVar1 == 0) break; - bVar1 = animName[1]; - isLess = bVar1 < (uint8_t)deathChar[1]; - if (bVar1 != deathChar[1]) goto LAB_007bf465; - animName = animName + 2; - deathChar = deathChar + 2; - } while (bVar1 != 0); - compareResult = 0; -LAB_007bf46a: - if ((compareResult != 0) && (this->_megaBlastDuration < 1)) { - return 1; - } - } - return 0; -} - -// 007bf490 -uint8_t Entity_Player::IsHoldingItem() -{ - uint8_t *animName; - uint8_t *animCursor; - uint32_t cmpResult; - char *expectedCursor; - bool isLess; - uint8_t ch; - - animName = (this->_bodySprite)._animState._animData; - if (animName == GHIDRA_CAST(0x0)) { - animName = &s_empty; - } - else if (0xf < *GHIDRA_CAST((animName + 0x14))) { - animName = *GHIDRA_CAST(animName); - } - expectedCursor = "Pickup"; - animCursor = animName; - do { - ch = *animCursor; - isLess = ch < (uint8_t)*expectedCursor; - if (ch != *expectedCursor) { -LAB_007bf4d1: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007bf4d6; - } - if (ch == 0) break; - ch = animCursor[1]; - isLess = ch < (uint8_t)expectedCursor[1]; - if (ch != expectedCursor[1]) goto LAB_007bf4d1; - animCursor = animCursor + 2; - expectedCursor = expectedCursor + 2; - } while (ch != 0); - cmpResult = 0; -LAB_007bf4d6: - if (cmpResult != 0) { - expectedCursor = "Pickup_Online"; - animCursor = animName; - do { - ch = *animCursor; - isLess = ch < (uint8_t)*expectedCursor; - if (ch != *expectedCursor) { -LAB_007bf505: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007bf50a; - } - if (ch == 0) break; - ch = animCursor[1]; - isLess = ch < (uint8_t)expectedCursor[1]; - if (ch != expectedCursor[1]) goto LAB_007bf505; - animCursor = animCursor + 2; - expectedCursor = expectedCursor + 2; - } while (ch != 0); - cmpResult = 0; -LAB_007bf50a: - if (cmpResult != 0) { - expectedCursor = "LiftItem"; - animCursor = animName; - do { - ch = *animCursor; - isLess = ch < (uint8_t)*expectedCursor; - if (ch != *expectedCursor) { -LAB_007bf540: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007bf545; - } - if (ch == 0) break; - ch = animCursor[1]; - isLess = ch < (uint8_t)expectedCursor[1]; - if (ch != expectedCursor[1]) goto LAB_007bf540; - animCursor = animCursor + 2; - expectedCursor = expectedCursor + 2; - } while (ch != 0); - cmpResult = 0; -LAB_007bf545: - if (cmpResult != 0) { - expectedCursor = "HideItem"; - animCursor = animName; - do { - ch = *animCursor; - isLess = ch < (uint8_t)*expectedCursor; - if (ch != *expectedCursor) { -LAB_007bf570: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007bf575; - } - if (ch == 0) break; - ch = animCursor[1]; - isLess = ch < (uint8_t)expectedCursor[1]; - if (ch != expectedCursor[1]) goto LAB_007bf570; - animCursor = animCursor + 2; - expectedCursor = expectedCursor + 2; - } while (ch != 0); - cmpResult = 0; -LAB_007bf575: - if (cmpResult != 0) { - expectedCursor = "UseItem"; - do { - ch = *animName; - isLess = ch < (uint8_t)*expectedCursor; - if (ch != *expectedCursor) { -LAB_007bf5a0: - cmpResult = -GHIDRA_UINT(isLess) | 1; - goto LAB_007bf5a5; - } - if (ch == 0) break; - ch = animName[1]; - isLess = ch < (uint8_t)expectedCursor[1]; - if (ch != expectedCursor[1]) goto LAB_007bf5a0; - animName = animName + 2; - expectedCursor = expectedCursor + 2; - } while (ch != 0); - cmpResult = 0; -LAB_007bf5a5: - if (cmpResult != 0) { - return 0; - } - } - } - } - } - return 1; -} - -// 007bf5c0 -uint8_t Entity_Player::IsHeldItemVisible() -{ - uint8_t isHoldingItem; - void *nullFrame; - - isHoldingItem = IsHoldingItem(this); - if ((isHoldingItem != 0) && ((this->_bodySprite)._animState._animData != (void *)0x0)) { - nullFrame = AnimationState::GetNullFrameById(&(this->_bodySprite)._animState,0); - if (nullFrame != (void *)0x0) { - return *GHIDRA_CAST((GHIDRA_CAST(nullFrame) + 0xc)); - } - } - return 0; -} - -// 007bf5f0 -void Entity_Player::AddBlueSpider(Vector *position) -{ - uint32_t seed; - Entity *spider; - uint32_t flagsHigh; - - this->_numBlueSpiders = this->_numBlueSpiders + 1; - seed = Random(); - spider = Game::SpawnEx(g_game,3,0x49,position,&g_vectorZero,GHIDRA_CAST(this),0,seed,0); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&spider->_flags) + 4)); - *GHIDRA_CAST(&spider->_flags) = GHIDRA_UINT(spider->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&spider->_flags) + 4)) = flagsHigh; - return; -} - -// 007bf640 -Entity_Familiar * Entity_Player::ThrowBlueSpider(Vector *position, Vector *target) -{ - Entity_Familiar *extraout_EAX; - - this->_numBlueSpiders = this->_numBlueSpiders + 1; - spawn_blue_spider(position,GHIDRA_CAST(this),target); - return extraout_EAX; -} - -// 007bf660 -void Entity_Player::RemoveBlueSpider() -{ - this->_numBlueSpiders = this->_numBlueSpiders + -1; - return; -} - -// 007bf670 -int Entity_Player::GetExtraLives() -{ - int extraLives; - void *collectibleCounts; - - collectibleCounts = (this->_collectibleCounts)._begin; - extraLives = GHIDRA_INT(this->_deadCatLives) + *GHIDRA_CAST((GHIDRA_CAST(collectibleCounts) + 0xac0)) + - *GHIDRA_CAST((GHIDRA_CAST(collectibleCounts) + 0x530)) + *GHIDRA_CAST((GHIDRA_CAST(collectibleCounts) + 0x4dc)) + - *GHIDRA_CAST((GHIDRA_CAST(collectibleCounts) + 0x350)) + *GHIDRA_CAST((GHIDRA_CAST(collectibleCounts) + 0x284)) + - *GHIDRA_CAST((GHIDRA_CAST(collectibleCounts) + 0x2c)); - if (this->_playerType == 0x1f) { - extraLives = extraLives + *GHIDRA_CAST((GHIDRA_CAST(collectibleCounts) + 0x9ac)); - } - return GHIDRA_UINT((this->_playerType == 8)) + extraLives; -} - -// 007c2e90 -uint32_t Entity_Player::GetGlitchBabySubType() -{ - code *pcVar1; - uint8_t isUnlocked; - uint32_t rngValue; - void *babiesBegin; - void *extraout_EDX; - void *pvVar2; - int babyOffset; - int *candidatesEnd; - int *candidatesEndSlot; - void *local_1c; - uint32_t babyIndex; - void *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t babyCount; - Manager *manager; - - manager = g_manager; - puStack_c = &LAB_00afff3d; - local_10 = ExceptionList; - ExceptionList = &local_10; - rngValue = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0xa8)))); - candidatesEndSlot = GHIDRA_CAST(0x0); - local_8 = 0; - local_14 = (g_manager->_entityConfig)._babies._end; - babiesBegin = (g_manager->_entityConfig)._babies._begin; - babyCount = (GHIDRA_INT(local_14) - GHIDRA_INT(babiesBegin)) / 0x38; - local_1c = babiesBegin; - if (babyCount != 0) { - if (0x3fffffff < babyCount) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - msvc::vector::_Reallocate(babyCount); - local_14 = (manager->_entityConfig)._babies._end; - babiesBegin = (manager->_entityConfig)._babies._begin; - } - candidatesEnd = GHIDRA_CAST(0x0); - local_14 = (void *)(GHIDRA_INT(local_14) - GHIDRA_INT(babiesBegin)); - babyIndex = 0; - if (GHIDRA_INT(local_14) / 0x38 + (GHIDRA_INT(local_14) >> 0x1f) != GHIDRA_INT(local_14) >> 0x1f) { - babyOffset = 0; - do { - pvVar2 = (void *)(babyOffset + GHIDRA_INT(babiesBegin)); - if ((*GHIDRA_CAST((babyOffset + GHIDRA_INT(babiesBegin))) != 0x19) && - (*GHIDRA_CAST((babyOffset + GHIDRA_INT(babiesBegin))) != 0x18)) { - if (-1 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x34))) { - isUnlocked = PersistentGameData::Unlocked - (&g_manager->_persistentGameData,*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x34))); - pvVar2 = extraout_EDX; - if (isUnlocked == 0) goto LAB_007c2fce; - } - if (candidatesEnd == GHIDRA_CAST(0x0)) { - local_1c = pvVar2; - msvc::vector::_Emplace_reallocate(0,&local_1c); - candidatesEnd = candidatesEndSlot; - } - else { - *candidatesEnd = GHIDRA_INT(pvVar2); - candidatesEndSlot = candidatesEnd + 1; - candidatesEnd = candidatesEndSlot; - } - } -LAB_007c2fce: - babyOffset = babyOffset + 0x38; - babyIndex = babyIndex + 1; - babiesBegin = (manager->_entityConfig)._babies._begin; - local_1c = babiesBegin; - } while (babyIndex < - GHIDRA_UINT(((GHIDRA_INT((manager->_entityConfig)._babies._end) - GHIDRA_INT(babiesBegin)) / 0x38))); - } - if (candidatesEnd == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(1,GHIDRA_CAST("[err] Couldn\'t select a baby subtype!\n")); - ExceptionList = local_10; - return 0x47; - } - if (rngValue == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - rngValue = (*pcVar1)(); - return rngValue; - } - rngValue = rngValue >> 5 ^ rngValue; - rngValue = rngValue << 9 ^ rngValue; - if (GHIDRA_INT(candidatesEnd) >> 2 == 0) { - rngValue = 0; - } - else { - rngValue = (rngValue >> 7 ^ rngValue) % GHIDRA_UINT((GHIDRA_INT(candidatesEnd) >> 2)); - } - ExceptionList = local_10; - return **GHIDRA_CAST((rngValue * 4)); -} - -// 007c3100 -uint8_t Entity_Player::HasInvincibility(uint64_t damageFlags, EntityRef *source) -{ - uint8_t isInvincible; - uint8_t isBloodSlotSource; - void *effect; - bool isRedHeartDamage; - bool isBloodSlotSource; - TemporaryEffects *tempEffects; - - if ((damageFlags & 0x2000) != 0) { - return 0; - } - isRedHeartDamage = (damageFlags & 0x20) != 0; - tempEffects = &this->_temporaryeffects; - isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x3a); - if (isInvincible == 0) { -LAB_007c3182: - isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x5d); - if (((((((isInvincible == 0) && - (isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x4d), - isInvincible == 0)) && - (isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x12a), - isInvincible == 0)) && - (isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c), - isInvincible == 0)) && - (((isInvincible = HasCollectible(this,0xd2,0), isInvincible == 0 || (this->_mass != 1000.0) - ) || (isRedHeartDamage)))) && - (((isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x146), - isInvincible == 0 && - ((isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(299), - isInvincible == 0 || - (effect = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(299), - *GHIDRA_CAST((GHIDRA_CAST(effect) + 8)) == 0)))) && - ((isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x3b), isInvincible == 0 || - (isRedHeartDamage)))))) && - ((((isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasNullEffect(0x3f), isInvincible == 0 || - (isRedHeartDamage)) && - (((isInvincible = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x2c1), - isInvincible == 0 && (this->_darkArtsBlastPending == 0)) || (isRedHeartDamage)))) && - ((this->_suplexState == 0 || (isRedHeartDamage)))))) { - isBloodSlotSource = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - isInvincible = 0; - if (isBloodSlotSource == 0) goto LAB_007c3287; - } - } - else if (source != GHIDRA_CAST(0x0)) { - if (source->_type == 6) { - if (source->_variant == 2) { - isBloodSlotSource = true; - goto LAB_007c3167; - } - isBloodSlotSource = false; - if (source->_variant != 5) goto LAB_007c3167; - } - else { - isBloodSlotSource = false; -LAB_007c3167: - if (!isBloodSlotSource) goto LAB_007c3285; - } - effect = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::GetCollectibleEffect(0x3a); - if (*GHIDRA_CAST((GHIDRA_CAST(effect) + 0xc)) != 0) goto LAB_007c3182; - } -LAB_007c3285: - isInvincible = 1; -LAB_007c3287: - if ((this->_variant == 1) && (this->_babySkin == 0x18)) { - isInvincible = 1; - } - if (this->_isCoopGhost != 0) { - isInvincible = 1; - } - return isInvincible; -} - -// 007c32c0 -uint8_t Entity_Player::IsInvisible() -{ - uint8_t isHasEffect; - int *effect; - - if ((this->_temporaryeffects)._disabled == 0) { - for (effect = (this->_temporaryeffects)._effects._begin; - effect != (this->_temporaryeffects)._effects._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 2) && ((GHIDRA_CAST(*effect))[1] == 0x45)) { - return 1; - } - } - } - isHasEffect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1f1); - if ((isHasEffect == 0) && (this->_playerType != 0x23)) { - return 0; - } - return 1; -} - -// 007c3320 -uint8_t Entity_Player::HasPoisonImmunity() -{ - uint8_t isHasCollectible; - - isHasCollectible = HasCollectible(this,0x252,0); - if (isHasCollectible == 0) { - isHasCollectible = HasCollectible(this,0x8c,0); - if ((isHasCollectible == 0) && - (((this->_hasCurseMistEffect != 0 || (this->_isCoopGhost != 0)) || - (this->_playerForms[4] < 3)))) { - return 0; - } - } - return 1; -} - -// 007c3380 -uint8_t Entity_Player::CanCrushRocks() -{ - uint8_t isHasEffect; - int zodiacEffect; - - isHasEffect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x53); - if (isHasEffect == 0) { - isHasEffect = HasCollectible(this,0x12e,0); - if (isHasEffect == 0) { - isHasEffect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x12e); - if (isHasEffect == 0) { - zodiacEffect = GetZodiacEffect(this); - if (zodiacEffect != 0x12e) { - isHasEffect = HasCollectible(this,0x13a,0); - if (isHasEffect == 0) { - isHasEffect = HasPlayerForm(this,0xd); - if (isHasEffect == 0) { - isHasEffect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - if (isHasEffect == 0) { - return 0; - } - } - } - } - } - } - } - return 1; -} - -// 007c3410 -uint8_t Entity_Player::CanPickRedHearts() -{ - uint8_t isFullHearts; - int iVar1; - Entity_Player *heartPlayer; - Entity_Player *extraout_ECX; - - do { - iVar1 = this->_playerType; - if (iVar1 == 0x24) { - if (this->_effectiveBloodCharge < 99) { - return 1; - } -LAB_007c3453: - iVar1 = GetHealthType(this); - heartPlayer = extraout_ECX; - if (iVar1 == 3) { - return 0; - } -LAB_007c343f: - isFullHearts = HasFullHearts(heartPlayer); - return isFullHearts ^ 1; - } - if (iVar1 != 0x28) { - if ((iVar1 != 0x11) || - (heartPlayer = GHIDRA_CAST(this->_subPlayer), heartPlayer == GHIDRA_CAST(0x0))) - goto LAB_007c3453; - goto LAB_007c343f; - } - if (GHIDRA_CAST(this->_twinPlayer) == GHIDRA_CAST(0x0)) goto LAB_007c3453; - this = GHIDRA_CAST(this->_twinPlayer); - } while( true ); -} - -// 007c3460 -uint8_t Entity_Player::CanPickSoulHearts() -{ - int activeMaxCharge; - int activeMaxCharge; - int *activeCharge; - uint32_t activeSlot; - - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - return this->_maxHearts < 0xa0; - } - while( true ) { - while (this->_playerType != 0x28) { - if ((this->_playerType != 0x10) || (GHIDRA_CAST(this->_subPlayer) == GHIDRA_CAST(0x0)) - ) goto LAB_007c34ac; - this = GHIDRA_CAST(this->_subPlayer); - } - if (GHIDRA_CAST(this->_twinPlayer) == GHIDRA_CAST(0x0)) break; - this = GHIDRA_CAST(this->_twinPlayer); - } -LAB_007c34ac: - activeCharge = &this->_activeDesc[0]._charge; - activeSlot = 0; - do { - if (((GHIDRA_CAST((activeCharge + -2)))->_item == 0x249) && - (activeMaxCharge = *activeCharge, activeMaxCharge = GetActiveMaxCharge(this,activeSlot), - activeMaxCharge < activeMaxCharge)) { - return 1; - } - activeSlot = activeSlot + 1; - activeCharge = activeCharge + 8; - } while (activeSlot < 4); - if (this->_playerType == 0x12) { - if (this->_effectiveSoulCharge < 99) { - return 1; - } - } - else if (this->_playerType == 0x10) { - return 0; - } - activeMaxCharge = GetHeartLimit(this,0); - if (this->_soulHearts + this->_boneHearts * 2 + this->_maxHearts < activeMaxCharge) { - return 1; - } - return 0; -} - -// 007c3550 -uint8_t Entity_Player::CanPickBlackHearts() -{ - uint8_t bVar1; - uint32_t uVar2; - uint32_t halfHeartIdx; - int soulHearts; - - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - return this->_maxHearts < 0xa0; - } - while( true ) { - while (this->_playerType != 0x28) { - if ((this->_playerType != 0x10) || (GHIDRA_CAST(this->_subPlayer) == GHIDRA_CAST(0x0)) - ) goto LAB_007c359c; - this = GHIDRA_CAST(this->_subPlayer); - } - if (GHIDRA_CAST(this->_twinPlayer) == GHIDRA_CAST(0x0)) break; - this = GHIDRA_CAST(this->_twinPlayer); - } -LAB_007c359c: - bVar1 = CanPickSoulHearts(this); - if (bVar1 != 0) { - return 1; - } - soulHearts = this->_soulHearts; - halfHeartIdx = 1; - if (1 < soulHearts) { - if (soulHearts < 1) { - return 1; - } - do { - if (GHIDRA_INT(halfHeartIdx) < 1) { - return 1; - } - uVar2 = halfHeartIdx & 0x80000001; - if (GHIDRA_INT(uVar2) < 0) { - uVar2 = (uVar2 - 1 | 0xfffffffe) + 1; - } - if (uVar2 != 1) { - return 1; - } - if ((this->_blackHearts & 1 << ((uint8_t)(GHIDRA_INT((halfHeartIdx - 1)) / 2) & 0x1f)) == 0) { - return 1; - } - halfHeartIdx = halfHeartIdx + 2; - } while (GHIDRA_INT(halfHeartIdx) < soulHearts); - } - return 0; -} - -// 007c3620 -void Entity_Player::RemoveSkinCostume() -{ - int iVar1; - void *pvVar2; - - iVar1 = this->_playerType; - if (-1 < iVar1) { - if (((iVar1 < (GHIDRA_INT((g_manager->_entityConfig)._players._end) - - GHIDRA_INT((g_manager->_entityConfig)._players._begin)) / 0x148) && - (pvVar2 = (void *)(iVar1 * 0x148 + GHIDRA_INT((g_manager->_entityConfig)._players._begin)), - pvVar2 != (void *)0x0)) && (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xac)), iVar1 != -1)) { - if ((-1 < iVar1) && - (pvVar2 = (g_manager->_itemConfig)._nullItems._begin, - iVar1 < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar2) >> 2)) { - RemoveCostume(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + iVar1 * 4))); - return; - } - RemoveCostume(this,GHIDRA_CAST(0x0)); - } - } - return; -} - -// 007c36b0 -void Entity_Player::ResetItemState() -{ - uint8_t bVar1; - ItemConfig_Item *Item; - int *eraseResult; - void *pvVar2; - uint8_t *animNameCursor; - uint32_t uVar3; - char *targetNameCursor; - bool isLess; - uint8_t eraseResultBuf [4]; - - if (this->_itemState == 0x31) { - TryRemoveCollectibleCostume(this,0x31,0); - } - else if (this->_itemState == 0x152) { - pvVar2 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar2) & 0xfffffffcU)) < 0x79) { - Item = GHIDRA_CAST(0x0); - } - else { - Item = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x78)); - } - RemoveCostume(this,Item); - } - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - pvVar2 = (this->_costumeSpriteDescs)._begin; - if (pvVar2 != (this->_costumeSpriteDescs)._end) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x129)) == '\0') { - pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 0x130); - } - else { - eraseResult = GHIDRA_CAST(std)::vector::erase(eraseResultBuf,pvVar2); - pvVar2 = (void *)*eraseResult; - } - } while (pvVar2 != (this->_costumeSpriteDescs)._end); - } - UpdateCostumes(this); - } - if ((this->_isPlayingExtraAnimation != 0) || (this->_isPlayingItemAnimation != 0)) { - if (((this->_bodySprite)._animState._animData != (void *)0x0) && - ((this->_bodySprite)._animState._isPlaying != 0)) { - animNameCursor = (this->_bodySprite)._animState._animData; - if (animNameCursor == GHIDRA_CAST(0x0)) { - animNameCursor = &s_empty; - } - else if (0xf < *GHIDRA_CAST((animNameCursor + 0x14))) { - animNameCursor = *GHIDRA_CAST(animNameCursor); - } - targetNameCursor = "HideItem"; - do { - bVar1 = *animNameCursor; - isLess = bVar1 < (uint8_t)*targetNameCursor; - if (bVar1 != *targetNameCursor) { -LAB_007c37b3: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007c37b8; - } - if (bVar1 == 0) break; - bVar1 = animNameCursor[1]; - isLess = bVar1 < (uint8_t)targetNameCursor[1]; - if (bVar1 != targetNameCursor[1]) goto LAB_007c37b3; - animNameCursor = animNameCursor + 2; - targetNameCursor = targetNameCursor + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_007c37b8: - if (uVar3 == 0) goto LAB_007c37d4; - } - if (this->_itemState == 0x25c) { - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - } - } -LAB_007c37d4: - this->_itemState = 0; - return; -} - -// 007c37f0 -void Entity_Player::SetShootingCooldown(int cooldown) -{ - int *maxCooldown; - int *fireBlockCooldown; - - fireBlockCooldown = &this->_fireBlockCooldown; - maxCooldown = &cooldown; - if (cooldown < *fireBlockCooldown) { - maxCooldown = fireBlockCooldown; - } - *fireBlockCooldown = *maxCooldown; - return; -} - -// 007c3810 -uint8_t Entity_Player::NeedsCharge(int slot) -{ - uint8_t bVar1; - ItemConfig_Item *item; - int iVar2; - uint32_t activeSlot; - - if (slot < 0) { - activeSlot = 0; - do { - bVar1 = NeedsCharge(this,activeSlot); - if (bVar1 != 0) { - return 1; - } - activeSlot = activeSlot + 1; - } while (activeSlot < 4); - return 0; - } - if ((slot < 4) && (iVar2 = this->_activeDesc[slot]._item, iVar2 != 0)) { - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar2); - iVar2 = GetActiveMaxCharge(this,slot); - if ((item != GHIDRA_CAST(0x0)) && - (((item->type == 3 && (iVar2 != 2)) && (iVar2 = GetActiveMaxCharge(this,slot), iVar2 != 0)))) - { - if (iVar2 <= this->_activeDesc[slot]._charge) { - bVar1 = HasCollectible(this,0x3f,0); - if (bVar1 == 0) { - return 0; - } - if (iVar2 <= this->_activeDesc[slot]._batteryCharge) { - return 0; - } - } - return 1; - } - } - return 0; -} - -// 007c38c0 -uint8_t Entity_Player::FullCharge(int slot, uint8_t isForce, uint8_t isOvercharge) -{ - uint8_t slotResult; - ItemConfig_Item *item; - int maxCharge; - int chargeAmount; - uint32_t activeSlot; - uint8_t result; - - if (slot < 0) { - result = 0; - activeSlot = 0; - do { - slotResult = FullCharge(this,activeSlot,isForce,0); - activeSlot = activeSlot + 1; - result = result + slotResult; - } while (activeSlot < 4); - return result; - } - if (3 < slot) { - return 0; - } - result = 0; - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,this->_activeDesc[slot]._item); - if (item != GHIDRA_CAST(0x0)) { - maxCharge = GetActiveMaxCharge(this,slot); - chargeAmount = maxCharge * 2; - if ((this->_activeDesc[slot]._item == 0x1b9) && (isForce == 0)) { - chargeAmount = maxCharge / 2; - } - chargeAmount = AddActiveCharge(this,chargeAmount,slot,1,isOvercharge,isForce); - result = (uint8_t)chargeAmount; - } - return result; -} - -// 007c3980 -void Entity_Player::add_random_stat_up(RNG *rng) -{ - code *pcVar1; - uint32_t rngSeed; - int *statModifiers [4]; - int *local_10; - int *local_c; - int *local_8; - - local_8 = GHIDRA_CAST((__security_cookie ^ GHIDRA_UINT((statModifiers + 7)))); - statModifiers[0] = &this->_speedModifier; - rngSeed = rng->_seed; - statModifiers[1] = &this->_fireDelayModifier; - statModifiers[2] = &this->_damageModifier; - statModifiers[3] = &this->_tearRangeModifier; - local_10 = &this->_shotSpeedModifier; - local_c = &this->_luckModifier; - if (rngSeed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - rngSeed = rng->_seed; - if (rngSeed == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - rngSeed = rngSeed >> ((uint8_t)rng->_shift1 & 0x1f) ^ rngSeed; - rngSeed = rngSeed << ((uint8_t)rng->_shift2 & 0x1f) ^ rngSeed; - rngSeed = rngSeed >> ((uint8_t)rng->_shift3 & 0x1f) ^ rngSeed; - rng->_seed = rngSeed; - *statModifiers[rngSeed % 6] = *statModifiers[rngSeed % 6] + 1; - this->_cacheFlags = this->_cacheFlags | 0x41f; - EvaluateItems(this); - if ((this->_pitfallState == 0) && (this->_dead == 0)) { - AnimateHappy(this); - } - return; -} - -// 007c3a60 -void Entity_Player::preload_item_sounds() -{ - uint8_t isOwned; - uint8_t *loadedCount; - Manager *manager; - void *sounds; - - manager = g_manager; - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f1))) != '\0') { - sounds = (g_manager->_sfxManager)._sounds._begin; - if (0x102 < (GHIDRA_INT((g_manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x1bd08)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x1bb70))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x1bd09)) = 0; - } - sounds = (manager->_sfxManager)._sounds._begin; - if (0x96 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x10368)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 66000))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x10369)) = 0; - } - } - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f3))) != '\0') { - sounds = (manager->_sfxManager)._sounds._begin; - if (0x85 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xe630)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0xe498))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xe631)) = 0; - } - } - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f2))) != '\0') { - sounds = (manager->_sfxManager)._sounds._begin; - if (7 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xda0)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0xc08))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xda1)) = 0; - } - } - isOwned = HasCollectible(this,0x9b,0); - if (isOwned != 0) { - sounds = (manager->_sfxManager)._sounds._begin; - if (0xed < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x198f0)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x19758))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x198f1)) = 0; - } - } - sounds = (manager->_sfxManager)._sounds._begin; - if (0x37 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x6020)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x5e88))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x6021)) = 0; - } - isOwned = HasCollectible(this,0x31,0); - if (isOwned != 0) { - sounds = (manager->_sfxManager)._sounds._begin; - if (5 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xa30)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x898))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xa31)) = 0; - } - } - if (this->_activeDesc[0]._item != 0) { - sounds = (manager->_sfxManager)._sounds._begin; - if (0xab < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x12780)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x125e8))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x12781)) = 0; - } - sounds = (manager->_sfxManager)._sounds._begin; - if (0xda < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x17848)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x176b0))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x17849)) = 0; - } - isOwned = HasCollectible(this,0x3f,0); - if (isOwned == 0) { - isOwned = HasTrinket(this,3,0); - if (isOwned == 0) goto LAB_007c3e5c; - } - sounds = (manager->_sfxManager)._sounds._begin; - if (0xaa < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x125c8)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x12430))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x125c9)) = 0; - } - } -LAB_007c3e5c: - isOwned = HasCollectible(this,0x24,0); - if (isOwned != 0) { - sounds = (manager->_sfxManager)._sounds._begin; - if (0x25 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x4130)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x3f98))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x4131)) = 0; - } - } - isOwned = HasCollectible(this,0x2d,0); - if (isOwned == 0) { - isOwned = HasCollectible(this,0x3e,0); - if (isOwned == 0) goto LAB_007c3f3a; - } - sounds = (manager->_sfxManager)._sounds._begin; - if (0x9d < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x10f70)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x10dd8))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x10f71)) = 0; - } -LAB_007c3f3a: - isOwned = HasCollectible(this,0x53,0); - if (isOwned != 0) { - sounds = (manager->_sfxManager)._sounds._begin; - if (0x77 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xce20)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0xcc88))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xce21)) = 0; - } - } - if ((this->_pocketSlots[1] == 0) && (this->_pocketSlots[0] != 0)) { - sounds = (manager->_sfxManager)._sounds._begin; - if (0x84 < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xe478)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0xe2e0))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0xe479)) = 0; - } - sounds = (manager->_sfxManager)._sounds._begin; - if (0x10c < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x1ce38)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x1cca0))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x1ce39)) = 0; - } - sounds = (manager->_sfxManager)._sounds._begin; - if (0x10b < (GHIDRA_INT((manager->_sfxManager)._sounds._end) - GHIDRA_INT(sounds)) / 0x1b8) { - if (*GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x1cc80)) == '\0') { - KAGE_LogMessage(1,GHIDRA_CAST("Preload sound %d.\n")); - SoundEffect::Load(GHIDRA_CAST((GHIDRA_INT(sounds) + 0x1cae8))); - loadedCount = &(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_sfxManager))) + 0xc))); - *GHIDRA_CAST(loadedCount) = *GHIDRA_CAST(loadedCount) + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(sounds) + 0x1cc81)) = 0; - } - } - return; -} - -// 007c40e0 -uint8_t Entity_Player::CanUsePill(int pillEffect) -{ - uint8_t isInstantDeathCursed; - int minHealth; - int iVar1; - - if (pillEffect == 1) { - isInstantDeathCursed = HasInstantDeathCurse(this); - if (isInstantDeathCursed == 0) { - iVar1 = (this->_boneHearts - this->_rottenHearts) + this->_soulHearts + this->_redHearts; -LAB_007c410f: - minHealth = 0x10; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - minHealth = 2; - } - return minHealth < iVar1; - } - } - else { - if (pillEffect != 6) { - return 1; - } - isInstantDeathCursed = HasInstantDeathCurse(this); - if (isInstantDeathCursed == 0) { - iVar1 = GetHealthType(this); - if (iVar1 == 1) { - iVar1 = this->_soulHearts; - } - else { - if (iVar1 == 3) { - return 0; - } - if (iVar1 == 4) { - iVar1 = this->_boneHearts * 2; - } - else { - iVar1 = this->_maxHearts; - } - } - goto LAB_007c410f; - } - } - return 0; -} - -// 007c4180 -void Entity_Player::UsePill(int pillEffect, int pillColor, uint32_t useFlags) -{ - std_vector *onlineStats; - int iVar1; - code *pcVar2; - ANM2 *pAVar3; - uint16_t *puVar4; - char cVar5; - uint8_t bVar6; - void *pvVar7; - uint32_t uVar8; - uint32_t uVar9; - std_string *pillNameResult; - StringTable *pillRng; - char *pcVar10; - uint32_t *puVar11; - uint32_t uVar12; - ColorMod *color; - int iVar13; - undefined3 extraout_var; - Game *game; - int *piVar14; - ItemConfig_Item *itemConfig; - Entity_Player *pEVar15; - Entity_Tear *tear; - BitSet128 *tearFlags; - uint32_t uVar16; - Entity *tmpEntity; - Vector *pVVar17; - uint32_t *rngState; - uint8_t *pbVar18; - uint8_t *pbVar19; - ColorMod *color_00; - Manager *extraout_ECX; - Manager *extraout_ECX_00; - Manager *extraout_ECX_01; - Manager *extraout_ECX_02; - Manager *extraout_ECX_03; - ColorMod *other; - Manager *extraout_ECX_04; - Manager *extraout_ECX_05; - Manager *extraout_ECX_06; - Manager *extraout_ECX_07; - Manager *extraout_ECX_08; - void *Effect; - Vector *direction; - Manager *extraout_ECX_09; - Manager *extraout_ECX_10; - Manager *extraout_ECX_11; - Manager *extraout_ECX_12; - ColorMod *other_00; - Color *this_01; - Manager *extraout_ECX_13; - Manager *extraout_ECX_14; - ColorMod *other_01; - Manager *extraout_ECX_15; - ColorMod *other_02; - Manager *extraout_ECX_16; - ColorMod *other_03; - Manager *extraout_ECX_17; - ColorMod *other_04; - uint16_t *puVar20; - Manager *extraout_ECX_18; - Manager *extraout_ECX_19; - Manager *extraout_ECX_20; - Manager *extraout_ECX_21; - Manager *extraout_ECX_22; - uint32_t extraout_ECX_23; - uint32_t extraout_ECX_24; - Vector *direction_00; - ColorMod *color_01; - Manager *extraout_ECX_25; - Manager *extraout_ECX_26; - Manager *extraout_ECX_27; - Manager *pMVar21; - Manager *extraout_ECX_28; - Manager *extraout_ECX_29; - Manager *extraout_ECX_30; - Manager *extraout_ECX_31; - Manager *extraout_ECX_32; - Manager *extraout_ECX_33; - Manager *extraout_ECX_34; - Manager *extraout_ECX_35; - Manager *extraout_ECX_36; - void *Effect_00; - Manager *extraout_ECX_37; - Manager *extraout_ECX_38; - Manager *extraout_ECX_39; - Manager *extraout_ECX_40; - Manager *extraout_ECX_41; - Manager *extraout_ECX_42; - Manager *extraout_ECX_43; - Manager *extraout_ECX_44; - Manager *extraout_ECX_45; - Manager *extraout_ECX_46; - Manager *extraout_ECX_47; - Manager *extraout_ECX_48; - Manager *extraout_ECX_49; - Manager *extraout_ECX_50; - float **ppfVar22; - char extraout_DL; - ItemPool **textCapacity; - char *size; - RNG *pillRng; - int extraout_EDX; - ItemPool *pIVar23; - uint8_t *copySrc; - float *pfVar24; - uint8_t *copyDst; - bool bVar25; - float rngFloat; - char acStackY_308 [128]; - void *in_stack_fffffd8c; - int in_stack_fffffd90; - char *in_stack_fffffd94; - uint8_t flashHUD; - int iVar26; - float fVar27; - uint8_t force; - float blueOffset; - uint32_t useFlagsLocal; - Manager *pillConfig; - Vector local_230; - uint8_t tempEffect [4]; - float *local_224; - Vector local_220; - uint8_t local_216; - char isSkipStatDown; - uint32_t local_214; - float *local_210; - Manager *local_20c; - ItemPool *local_208; - uint32_t isHorsePill; - Color luckUpColor; - Color tearsUpColor; - Color effectColor; - Color local_17c; - Color CStack_150; - std_string pillDescription; - std_string pillName; - uint8_t local_ec [8]; - float fStack_e4; - float fStack_e0; - float fStack_dc; - float **local_d8; - float fStack_d4; - float fStack_d0; - float fStack_cc; - float local_c8; - uint8_t *local_c4; - uint8_t local_c0 [20]; - uint8_t local_ac [4]; - uint8_t experimentalText [132]; - uint32_t stackCookie; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint32_t flagsHigh; - - game = g_game; - puStack_20 = experimentalText + 0xa4; - local_14 = 0xffffffff; - puStack_18 = &LAB_00afff9c; - local_1c = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((experimentalText + 0x98)); - ExceptionList = &local_1c; - onlineStats = &g_game->_onlinePlayerStats; - g_game->_bloomDuration = 0x1e; - game->_bloomTimer = 0x1e; - game->_bloomStrength = 1.0; - Player_stats_add(onlineStats,6,this,1.0); - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - useFlagsLocal = useFlags; - } - else { - pvVar7 = (GHIDRA_CAST((&g_manager->_netplayManager)))->InputManager::GetDeviceByPlayerEntity(this); - if ((pvVar7 == (void *)0x0) || - (cVar5 = (**(code **)(*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x370)) + 0x14))(), cVar5 != '\0')) { - useFlagsLocal = useFlags; - } - else { - useFlagsLocal = useFlags | 0x900; - } - } - isHorsePill = GHIDRA_UINT(pillColor) >> 0xb & 0xffffff01; - uVar8 = pillColor & 0x7ff; - if (uVar8 == 0xe) { - pvVar7 = (this->_collectibleRNGs)._begin; - rngState = GHIDRA_CAST((GHIDRA_INT(pvVar7) + 0x4b0)); - local_208 = &g_game->_itemPool; - uVar9 = *rngState; - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar9 = *rngState; - if (uVar9 == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar9 = uVar9 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x4b4)) & 0x1f) ^ uVar9; - uVar9 = uVar9 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x4b8)) & 0x1f) ^ uVar9; - uVar9 = uVar9 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x4bc)) & 0x1f) ^ uVar9; - *rngState = uVar9; - in_stack_fffffd94 = GHIDRA_CAST(0x7c4310); - ItemPool::on_pill_used(local_208,pillColor,uVar9,rngState); - } - else { - uVar12 = -GHIDRA_UINT((uVar8 != 0)) & uVar8; - uVar9 = 0xe; - if (uVar12 < 0xe) { - uVar9 = uVar12; - } - *GHIDRA_CAST((GHIDRA_CAST((&g_game->_itemPool + 1)) + uVar9 + 0x3c)) = 1; - } - pillName._size = 0; - pillName._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) = GHIDRA_CAST(0x0); - pillDescription._size = 0; - pillDescription._capacity = 0xf; - pillDescription._buf[0] = '\0'; - pillDescription._buf[1] = '\0'; - pillDescription._buf[2] = '\0'; - pillDescription._buf[3] = '\0'; - local_14 = 1; - local_20c = g_manager; - if ((pillEffect < 0) || - (pvVar7 = (g_manager->_itemConfig)._pillEffects._begin, - GHIDRA_INT((g_manager->_itemConfig)._pillEffects._end) - GHIDRA_INT(pvVar7) >> 2 <= pillEffect)) { - pillConfig = GHIDRA_CAST(0x0); - } - else { - pillConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + pillEffect * 4)); - } - if (g_game->_challenge == 0x20) { - if (-1 < pillEffect) { - if (pillEffect < 0x32) { - rngState = GHIDRA_CAST((pillEffect * 0x10 + GHIDRA_INT((this->_pillRNGs)._begin))); - uVar9 = *rngState; - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar9 = *rngState; - if (uVar9 == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar9 = uVar9 >> ((uint8_t)rngState[1] & 0x1f) ^ uVar9; - uVar9 = uVar9 << ((uint8_t)rngState[2] & 0x1f) ^ uVar9; - local_208 = GHIDRA_CAST((uVar9 >> ((uint8_t)rngState[3] & 0x1f))); - uVar9 = GHIDRA_UINT(local_208) ^ uVar9; - *rngState = uVar9; - uVar9 = uVar9 % 0x32; - pvVar7 = (local_20c->_itemConfig)._pillEffects._begin; - if (GHIDRA_INT((local_20c->_itemConfig)._pillEffects._end) - GHIDRA_INT(pvVar7) >> 2 <= GHIDRA_INT(uVar9)) { - pillConfig = GHIDRA_CAST(0x0); - goto LAB_007c46b3; - } - pillConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + uVar9 * 4)); - } -LAB_007c4477: - if (pillConfig != GHIDRA_CAST(0x0)) { - pillNameResult = PocketItemConfig::GetName(pillConfig,GHIDRA_CAST(local_c0),0x14); - if (&pillName != pillNameResult) { - if (0xf < pillName._capacity) { - uVar9 = pillName._capacity + 1; - ppfVar22 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(pillName._buf))) + 0x0))); - if (0xfff < uVar9) { - ppfVar22 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) + -4)); - uVar9 = pillName._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) + (-4 - GHIDRA_INT(ppfVar22))))) - goto LAB_007c453e; - } - operator_delete(ppfVar22,uVar9); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) = *GHIDRA_CAST(pillNameResult->_buf); - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x4))) = *GHIDRA_CAST((pillNameResult->_buf + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x8))) = *GHIDRA_CAST((pillNameResult->_buf + 8)); - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0xc))) = *GHIDRA_CAST((pillNameResult->_buf + 0xc)); - pillName._size = pillNameResult->_size; - pillName._capacity = pillNameResult->_capacity; - pillNameResult->_size = 0; - pillNameResult->_capacity = 0xf; - pillNameResult->_buf[0] = '\0'; - } - if (0xf < GHIDRA_UINT(local_ac)) { - uVar9 = GHIDRA_INT(local_ac) + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_c0)) + 0x0))); - if (0xfff < uVar9) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x0))) + -4); - uVar9 = GHIDRA_INT(local_ac) + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x0))) + (-4 - GHIDRA_INT(pvVar7))))) { -LAB_007c453e: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar7,uVar9); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x10))) = 0; - local_ac = (uint8_t [4])0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x0))) & 0xffffff00; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((pillConfig->_persistentGameData))) + 0x1c)))) == 0) { - CStack_150._colorize[1] = 0.0; - CStack_150._offset[2] = 2.10195e-44; - CStack_150._offset[1] = 0.0; - } - else { - pbVar19 = &(*GHIDRA_CAST((GHIDRA_CAST(&((pillConfig->_persistentGameData))) + 0xc))); - if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((pillConfig->_persistentGameData))) + 0x20))))) { - pbVar19 = *GHIDRA_CAST(pbVar19); - } - pillRng = &g_manager->_stringTable; - local_20c = *GHIDRA_CAST(pillRng); - if (*pbVar19 == 0x23) { - local_208 = GHIDRA_CAST((pbVar19 + 1)); - local_214 = (float)(GHIDRA_UINT(local_214) & 0xffffff); - in_stack_fffffd94 = "PocketItems"; - in_stack_fffffd90 = 0x7c45e5; - StringTable::get_string - (pillRng,GHIDRA_CAST("PocketItems"),GHIDRA_INT(local_20c),GHIDRA_CAST(local_208), - GHIDRA_CAST((GHIDRA_INT(&local_214) + 3))); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))) == '\0') { - local_216 = 0; - in_stack_fffffd94 = "PocketItems"; - in_stack_fffffd90 = 0x7c461e; - pbVar19 = StringTable::get_string - (pillRng,GHIDRA_CAST("PocketItems"),GHIDRA_INT(local_20c),GHIDRA_CAST(local_208), - &local_216); - } - } - CStack_150._colorize[1] = 0.0; - CStack_150._offset[1] = 0.0; - CStack_150._offset[2] = 2.10195e-44; - pbVar18 = pbVar19; - do { - bVar6 = *pbVar18; - pbVar18 = pbVar18 + 1; - } while (bVar6 != 0); - (GHIDRA_CAST((GHIDRA_CAST((CStack_150._colorize + 1)))))->msvc::string::assign(pbVar19, - GHIDRA_INT(pbVar18) - GHIDRA_INT((pbVar19 + 1))); - } - if (0xf < pillDescription._capacity) { - uVar9 = pillDescription._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)pillDescription._buf)) + 0x0))); - if (0xfff < uVar9) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) + -4); - uVar9 = pillDescription._capacity + 0x24; - if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) - GHIDRA_INT(pvVar7)) - 4U) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar7,uVar9); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) = CStack_150._colorize[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x4))) = CStack_150._colorize[2]; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x8))) = CStack_150._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0xc))) = CStack_150._offset[0]; - pillDescription._size = GHIDRA_UINT(CStack_150._offset[1]); - pillDescription._capacity = GHIDRA_UINT(CStack_150._offset[2]); - } - } - } - else if (-1 < pillEffect) goto LAB_007c4477; -LAB_007c46b3: - game = g_game; - local_208 = GHIDRA_CAST(0x1d); - msvc::set::find_node(); - pMVar21 = g_manager; - if ((*GHIDRA_CAST((GHIDRA_CAST(local_220.y) + 0xd)) != '\0') || - (pfVar24 = GHIDRA_CAST(local_220.y), 0x1d < GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(local_220.y) + 0x10))))) { - pfVar24 = (game->_seedEffects)._seedEffects; - } - if (pfVar24 != (game->_seedEffects)._seedEffects) { - local_214 = (float)(GHIDRA_UINT(local_214) & 0xffffff); - in_stack_fffffd94 = "PocketItems"; - in_stack_fffffd90 = 0x7c472f; - StringTable::get_string - (&g_manager->_stringTable,GHIDRA_CAST("PocketItems"),*GHIDRA_CAST(&g_manager->_stringTable), - GHIDRA_CAST(0xb67da9),GHIDRA_CAST((GHIDRA_INT(&local_214) + 3))); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))) == '\0') { - local_216 = 0; - in_stack_fffffd94 = "PocketItems"; - in_stack_fffffd90 = 0x7c4761; - pcVar10 = GHIDRA_CAST(StringTable)::get_string - (&pMVar21->_stringTable,GHIDRA_CAST("PocketItems"), - *GHIDRA_CAST(&pMVar21->_stringTable),GHIDRA_CAST(0xb67da9),&local_216); - } - else { - pcVar10 = "#QUESTION_MARKS_NAME"; - } - pbVar19 = GHIDRA_CAST(pcVar10); - do { - bVar6 = *pbVar19; - pbVar19 = pbVar19 + 1; - } while (bVar6 != 0); - (GHIDRA_CAST((pillName._buf)))->msvc::string::assign(GHIDRA_CAST(pcVar10),GHIDRA_INT(pbVar19) - GHIDRA_INT((pcVar10 + 1))); - pillDescription._size = 0; - pillNameResult = &pillDescription; - if (0xf < pillDescription._capacity) { - pillNameResult = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(pillDescription._buf))) + 0x0))); - } - pillNameResult->_buf[0] = '\0'; - } - game = g_game; - textCapacity = &local_208; - ppfVar22 = &local_224; - local_208 = GHIDRA_CAST(0x9); - iVar26 = 0x7c47d0; - msvc::set::find_node(); - if ((*GHIDRA_CAST((GHIDRA_CAST(local_220.y) + 0xd)) != '\0') || - (pfVar24 = GHIDRA_CAST(local_220.y), 9 < GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(local_220.y) + 0x10))))) { - pfVar24 = (game->_seedEffects)._seedEffects; - } - if (pfVar24 != (game->_seedEffects)._seedEffects) { - (GHIDRA_CAST((acStackY_308 + 0x94)))->msvc::string::string(&pillName); - puVar11 = string_scramble_seeded - (&local_d8,in_stack_fffffd8c,in_stack_fffffd90,GHIDRA_INT(in_stack_fffffd94),iVar26 - ,GHIDRA_UINT(ppfVar22),GHIDRA_UINT(textCapacity)); - if (&pillName != GHIDRA_CAST(puVar11)) { - if (0xf < pillName._capacity) { - textCapacity = GHIDRA_CAST((pillName._capacity + 1)); - ppfVar22 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(pillName._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < textCapacity) { - ppfVar22 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) + -4)); - textCapacity = GHIDRA_CAST((pillName._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) + (-4 - GHIDRA_INT(ppfVar22))))) - goto LAB_007c48c4; - } - iVar26 = 0x7c4852; - operator_delete(ppfVar22,GHIDRA_UINT(textCapacity)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) = *puVar11; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x4))) = puVar11[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x8))) = puVar11[2]; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0xc))) = puVar11[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillName)) + 0x10))) = *GHIDRA_CAST((puVar11 + 4)); - puVar11[4] = 0; - puVar11[5] = 0xf; - *GHIDRA_CAST(puVar11) = 0; - } - if (&DAT_0000000f < local_c4) { - textCapacity = GHIDRA_CAST((local_c4 + 1)); - ppfVar22 = local_d8; - if (GHIDRA_CAST(0xfff) < textCapacity) { - ppfVar22 = GHIDRA_CAST(local_d8[-1]); - textCapacity = GHIDRA_CAST((local_c4 + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(local_d8) + (-4 - GHIDRA_INT(ppfVar22))))) { -LAB_007c48c4: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - iVar26 = 0x7c48d1; - operator_delete(ppfVar22,GHIDRA_UINT(textCapacity)); - } - (GHIDRA_CAST((acStackY_308 + 0x94)))->msvc::string::string(&pillDescription); - pillNameResult = - string_scramble_seeded - (CStack_150._colorize + 1,in_stack_fffffd8c,in_stack_fffffd90, - GHIDRA_INT(in_stack_fffffd94),iVar26,GHIDRA_UINT(ppfVar22),GHIDRA_UINT(textCapacity)); - if (&pillDescription != pillNameResult) { - if (0xf < pillDescription._capacity) { - uVar9 = pillDescription._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)pillDescription._buf)) + 0x0))); - if (0xfff < uVar9) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) + -4); - uVar9 = pillDescription._capacity + 0x24; - if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) - GHIDRA_INT(pvVar7)) - 4U) goto LAB_007c49a4; - } - operator_delete(pvVar7,uVar9); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) = *GHIDRA_CAST(pillNameResult->_buf); - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x4))) = *GHIDRA_CAST((pillNameResult->_buf + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x8))) = *GHIDRA_CAST((pillNameResult->_buf + 8)); - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0xc))) = *GHIDRA_CAST((pillNameResult->_buf + 0xc)); - pillDescription._size = pillNameResult->_size; - pillDescription._capacity = pillNameResult->_capacity; - pillNameResult->_size = 0; - pillNameResult->_capacity = 0xf; - pillNameResult->_buf[0] = '\0'; - } - if (GHIDRA_CAST(0xf) < GHIDRA_UINT(CStack_150._offset[2])) { - size = GHIDRA_CAST((GHIDRA_INT(CStack_150._offset[2]) + 1)); - pcVar10 = GHIDRA_CAST(CStack_150._colorize[1]); - if (GHIDRA_CAST(0xfff) < size) { - pcVar10 = *GHIDRA_CAST((GHIDRA_INT(CStack_150._colorize[1]) + -4)); - size = GHIDRA_CAST((GHIDRA_INT(CStack_150._offset[2]) + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(CStack_150._colorize[1]) + (-4 - GHIDRA_INT(pcVar10))))) { -LAB_007c49a4: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar10,GHIDRA_UINT(size)); - } - CStack_150._offset[1] = 0.0; - CStack_150._offset[2] = 2.10195e-44; - CStack_150._colorize[1] = (float)(GHIDRA_UINT(CStack_150._colorize[1]) & 0xffffff00); - } - local_230.y = (float)(useFlagsLocal & 0x800); - if (GHIDRA_CAST(local_230.y) == GHIDRA_CAST(0x0)) { - if (pillEffect != 0x31) { - PlayerHUD::show_pill_name(); - goto LAB_007c4a29; - } -LAB_007c4a2e: - piVar14 = GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + pillEffect * 4)); - *piVar14 = *piVar14 + 1; - if ((char)isHorsePill != '\0') { - piVar14 = GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + pillEffect * 4)); - *piVar14 = *piVar14 + 1; - } - } - else { -LAB_007c4a29: - if (GHIDRA_UINT(pillEffect) < 0x32) goto LAB_007c4a2e; - } - FUN_00763290(); - if (4 < *GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + 0xac))) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x182); - } - iVar26 = 2; - local_20c = GHIDRA_CAST((g_manager->_optionsConfig)._announcerVoiceMode); - if (local_20c == (void *)0x0) { - iVar26 = 900; - } - if ((pillEffect < 0) || - (GHIDRA_INT((this->_pillRNGs)._end) - GHIDRA_INT((this->_pillRNGs)._begin) >> 4 <= pillEffect)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Pill ID out of bounds!\n")); - } - pvVar7 = (this->_pillRNGs)._begin; - uVar9 = (GHIDRA_INT((this->_pillRNGs)._end) - GHIDRA_INT(pvVar7) >> 4) - 1; - uVar12 = -GHIDRA_UINT((pillEffect != 0)) & pillEffect; - if (uVar12 < uVar9) { - uVar9 = uVar12; - } - pillRng = GHIDRA_CAST((uVar9 * 0x10 + GHIDRA_INT(pvVar7))); - local_214 = (float)(useFlagsLocal >> 7 & 0xffffff01); - uVar9 = Random(); - if (((((uVar9 & 1) == 0) && (local_20c == (void *)0x0)) || (local_20c == (void *)0x2)) && - ((useFlagsLocal & 0x100) == 0)) { - iVar13 = g_game->_stage; - if ((iVar13 < 1) || (6 < iVar13)) { - if (iVar13 != 0xd) goto LAB_007c4b4b; - goto LAB_007c4b59; - } - bVar6 = Game::GetStateFlag(g_game,0x30); - if (bVar6 != 0) goto LAB_007c4b59; -LAB_007c4b4b: - local_216 = 1; - } - else { -LAB_007c4b59: - local_216 = 0; - } - game = g_game; - cVar5 = (char)isHorsePill; - local_208 = GHIDRA_CAST(0x25c); - local_210 = GHIDRA_CAST(0x84); - if (cVar5 != '\0') { - local_210 = GHIDRA_CAST(0x25c); - } - switch(pillEffect) { - case 0: - pVVar17 = &this->_pos; - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - if (extraout_DL != '\0') { - Game::Fart(g_game,pVVar17,170.0,GHIDRA_CAST(this),2.0,0,color); - Game::ButterBeanFart(g_game,pVVar17,200.0,GHIDRA_CAST(this),0,0); - pIVar23 = g_game->_room; - local_208 = pIVar23; - iVar13 = FUN_00456540(); - if (0 < iVar13) { - cVar5 = '\0'; - local_214 = (float)(GHIDRA_UINT(local_214) & 0xffffff); - local_20c = (void *)0x0; - if (pIVar23[2]._pools[0xf]._poolList._capacity != (void *)0x0) { - do { - tmpEntity = *(Entity **) - (GHIDRA_INT(pIVar23[2]._pools[0xf]._poolList._begin) + GHIDRA_INT(local_20c) * 4); - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (tmpEntity->_type == 1)) || - (tmpEntity->_type - 10U < 0x3de)) { - local_ac = *(uint8_t (*) [4])(GHIDRA_INT(&tmpEntity->_flags) + 4); - if (((tmpEntity->_flags & 0x11) == 0) && ((tmpEntity->_flags & 0x20000011) == 0)) { - (GHIDRA_CAST((GHIDRA_CAST((local_ec + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((tmpEntity)))->Entity::AddPoison(GHIDRA_CAST((local_ec + 4)),0x5a,0.0,0); - local_214 = (float)CONCAT13(1,(undefined3)local_214); - cVar5 = '\x01'; - } - else { - cVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))); - } - } - local_20c = GHIDRA_CAST((GHIDRA_INT(local_20c) + 1)); - pIVar23 = local_208; - } while (local_20c < local_208[2]._pools[0xf]._poolList._capacity); - if (cVar5 != '\0') { - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 0.0; - local_d8 = GHIDRA_CAST(0x3f800000); - fStack_d4 = 0.0; - fStack_d0 = 1.0; - Game::start_poop_cloud_screen_effect(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1618)),color_00); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX; - break; - } - } - } - goto LAB_007c5fcc; - } - Game::Fart(g_game,pVVar17,85.0,GHIDRA_CAST(this),1.0,0,color); - Game::ButterBeanFart(g_game,pVVar17,120.0,GHIDRA_CAST(this),0,0); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_00; - break; - case 1: - pcVar2 = *(code **)(*GHIDRA_CAST(this) + 0x20); - (GHIDRA_CAST((GHIDRA_CAST((local_ec + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - (*pcVar2)(); - AnimateSad(this); - pMVar21 = extraout_ECX_01; - break; - case 2: - AddSoulHearts(this,(isHorsePill & 0xff) * 4 + 4,0); - goto LAB_007c4df2; - case 3: - if (this->_playerType == 0x19) { - iVar13 = this->_numKeys; - this->_numKeys = this->_poopMana; - this->_poopMana = iVar13; - AddPoopMana(this,0); - if ((char)isHorsePill != '\0') { - AddPoopMana(this,(this->_poopMana + 1) / 2); - goto LAB_007c4eaa; - } - } - else { - iVar13 = this->_numKeys; - bVar6 = this->_hasGoldenBomb; - this->_numKeys = this->_numBombs; - this->_numBombs = iVar13; - this->_hasGoldenBomb = this->_hasGoldenKey; - this->_hasGoldenKey = bVar6; - if (cVar5 != '\0') { - AddBombs(this,(iVar13 + 1) / 2); -LAB_007c4eaa: - AddKeys(this,(this->_numKeys + 1) / 2); - } - } - ConsumableCountChanged(this,0x1e); - AnimateHappy(this); - game = g_game; - pMVar21 = extraout_ECX_03; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - break; - case 4: - play_sound_with_fart_seed(0x25,1.0,2,0,1.0); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0,-1); - puVar11 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(puVar11) & 0xfffffffcU)) < 1) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = GHIDRA_CAST(*puVar11); - } - (GHIDRA_CAST((tempEffect)))->TemporaryEffect::TemporaryEffect(itemConfig); - local_220.x = (float)&DAT_0000003c; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(Effect,1,1); - if ((char)isHorsePill != '\0') { - local_220.x = 4.2039e-44; - goto LAB_007c5476; - } - goto LAB_007c548c; - case 5: - if (cVar5 != '\0') { - AddSoulHearts(this,6,0); - } - SetFullHearts(this); -LAB_007c4df2: - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - pMVar21 = extraout_ECX_02; - break; - case 6: - AddMaxHearts(this,(isHorsePill & 0xff ^ 1) * 2 + -4,0); - TryPreventDeath(this); - AnimationState::SetAnimationData(&(this->_sprite)._overlayAnimState,(void *)0x0); - AnimateSad(this); - pMVar21 = extraout_ECX_05; - break; - case 7: - AddMaxHearts(this,(isHorsePill & 0xff) * 2 + 2,0); - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 1.0; - local_d8 = GHIDRA_CAST(0x3f000000); - fStack_d4 = 0.0; - fStack_d0 = 0.33; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))))))->Color::operator_assign(other); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(0.3,0.3,0.3,0.5,0.25,0.25); - this->SetColor(); - this->_cacheFlags = this->_cacheFlags | 0x1000; - pMVar21 = extraout_ECX_04; - break; - case 8: - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) & 0xfffffffcU)) < 9) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 8)); - } - if (cVar5 != '\0') { - RemoveCostume(this,itemConfig); - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) & 0xfffffffcU)) < 0x1d9) - { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x1d8)); - } - } - AddCostume(this,itemConfig,0); - play_sound_with_fart_seed(0xc5,1.0,2,0,1.0); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_10; - break; - case 9: - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) & 0xfffffffcU)) < 5) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 4)); - } - if (cVar5 != '\0') { - RemoveCostume(this,itemConfig); - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) & 0xfffffffcU)) < 0x1dd) - { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x1dc)); - } - } - AddCostume(this,itemConfig,0); - AnimateSad(this); - IncrementPlayerFormCounter(this,0xb,1); - pMVar21 = extraout_ECX_11; - break; - case 10: - if (cVar5 != '\0') { - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x6b,1,1); - } - this->_cacheFlags = this->_cacheFlags | 0x200; - AnimateHappy(this); - pMVar21 = extraout_ECX_08; - break; - case 0xb: - this->_cacheFlags = this->_cacheFlags | 8; - AnimateSad(this); - pMVar21 = extraout_ECX_12; - break; - case 0xc: - this->_cacheFlags = this->_cacheFlags | 0x1008; - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 0.5; - local_d8 = GHIDRA_CAST(0x3f800000); - fStack_d4 = 1.0; - fStack_d0 = 0.33; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))))))->Color::operator_assign(other_00); - this_01 = &local_17c; - blueOffset = 0.5; - goto LAB_007c5622; - case 0xd: - this->_cacheFlags = this->_cacheFlags | 0x10; - AnimateSad(this); - pMVar21 = extraout_ECX_14; - break; - case 0xe: - this->_cacheFlags = this->_cacheFlags | 0x1010; - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 1.0; - local_d8 = GHIDRA_CAST(0x3f800000); - fStack_d4 = 0.0; - fStack_d0 = 0.33; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))))))->Color::operator_assign(other_01); - this_01 = &CStack_150; - blueOffset = 0.25; - rngFloat = 0.5; - fVar27 = 0.5; - goto LAB_007c5631; - case 0xf: - this->_cacheFlags = this->_cacheFlags | 2; - AnimateSad(this); - pMVar21 = extraout_ECX_15; - break; - case 0x10: - this->_cacheFlags = this->_cacheFlags | 0x1002; - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 0.5; - local_d8 = GHIDRA_CAST(0x3f000000); - fStack_d4 = 1.0; - fStack_d0 = 0.33; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))))))->Color::operator_assign(other_02); - this_01 = &tearsUpColor; - blueOffset = 0.5; - rngFloat = 0.4; - fVar27 = 0.4; - goto LAB_007c5631; - case 0x11: - this->_cacheFlags = this->_cacheFlags | 0x400; - AnimateSad(this); - pMVar21 = extraout_ECX_16; - break; - case 0x12: - this->_cacheFlags = this->_cacheFlags | 0x1400; - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 0.0; - local_d8 = GHIDRA_CAST(0x3f800000); - fStack_d4 = 0.0; - fStack_d0 = 0.33; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))))))->Color::operator_assign(other_03); - this_01 = &luckUpColor; - blueOffset = 0.25; -LAB_007c5622: - rngFloat = 0.5; - fVar27 = 0.25; - goto LAB_007c5631; - case 0x13: - if (cVar5 == '\0') { - iVar13 = g_game->_stage; - uVar9 = Level::GetCurses(GHIDRA_CAST(g_game)); - if (((uVar9 & 2) != 0) && (bVar6 = Game::IsGreedMode(g_game), bVar6 == 0)) { - iVar13 = iVar13 + 1; - } - bVar6 = PlayerManager::AnyoneHasCollectible(&g_game->_playerManager,0x226); - if ((((bVar6 == 0) || (bVar6 = Game::IsGreedMode(g_game), bVar6 != 0)) || (iVar13 != 6)) && - ((bVar6 = Level::HasPhotoDoor(GHIDRA_CAST(g_game)), bVar6 == 0 || - (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 8)) != g_game->_lastBossRoomListIdx)))) { - local_20c = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_20c)) + 0x1))),1)); - } - else { - local_20c = GHIDRA_CAST((GHIDRA_UINT(local_20c) & 0xffffff00)); - } - uVar9 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_pillRNGs)._begin) + 0x130)))))->RNG::Next(); - Game::MoveToRandomRoom(g_game,(uint8_t)local_20c,uVar9,this); - pMVar21 = extraout_ECX_07; - } - else { - local_224 = GHIDRA_CAST(0x0); - local_220.x = 0.0; - local_220.y = 0.0; - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),2); - local_208 = GHIDRA_CAST(0x4); - msvc::vector<4byte>::_Emplace_reallocate(); - local_208 = GHIDRA_CAST(0x2); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 2.8026e-45; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0x7); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 9.80909e-45; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0x8); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 1.12104e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0x12); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 2.52234e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0x14); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 2.8026e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0x15); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 2.94273e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0xc); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 1.68156e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0xb); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 1.54143e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0x18); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 3.36312e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(0x9); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 1.26117e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - local_208 = GHIDRA_CAST(&DAT_0000000d); - if (local_220.x == local_220.y) { - msvc::vector<4byte>::_Emplace_reallocate(); - } - else { - *GHIDRA_CAST(local_220.x) = 1.82169e-44; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - teleport_to_random_room_of_types(this,&local_224,1); - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - FID_conflict__Tidy(&local_224); - pMVar21 = extraout_ECX_06; - } - break; - case 0x14: - uVar12 = 0; - fVar27 = local_214; - uVar9 = isHorsePill; - do { - if (SUB41(fVar27,0) == '\0') { -LAB_007c5dc8: - force = 0; - bVar6 = 0; - if ((char)uVar9 == '\0') { - bVar6 = FullCharge(this,uVar12,0,0); - if (CONCAT31(extraout_var,bVar6) != 0) break; - } - else { - flashHUD = 1; - uVar9 = uVar12; - iVar13 = GetActiveMaxCharge(this,uVar12); - AddActiveCharge(this,iVar13 * 2,uVar9,flashHUD,bVar6,force); - } - fVar27 = local_214; - uVar9 = isHorsePill; - } - else if (uVar12 != 0) goto LAB_007c5dc8; - uVar12 = uVar12 + 1; - } while (uVar12 < 4); - uVar9 = (GHIDRA_CAST((pillRng)))->RNG::RandomInt(2); - local_208 = GHIDRA_CAST((uVar9 + 3)); - if ((char)isHorsePill == '\0') { - local_208 = GHIDRA_CAST((uVar9 + 1)); - } - fVar27 = 0.0; - if (0 < GHIDRA_INT(local_208)) { - do { - local_230.y = (float)Random(); - if (((char)local_214 == '\0') || (local_20c = (void *)0x2, fVar27 == 0.0)) { - local_20c = (void *)0x1; - } - pVVar17 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((local_c0 + 0x10)),&this->_pos,40.0,0,0,0); - tmpEntity = Game::Spawn(g_game,5,0x5a,pVVar17,&g_vectorZero,GHIDRA_CAST(this),GHIDRA_UINT(local_20c), - GHIDRA_UINT(local_230.y)); - tmpEntity[1]._sprite._championColor._offset[2] = fVar27; - fVar27 = (float)(GHIDRA_INT(fVar27) + 1); - } while (GHIDRA_INT(fVar27) < GHIDRA_INT(local_208)); - } - AnimateHappy(this); - pMVar21 = extraout_ECX_19; - break; - case 0x15: - iVar13 = GetEffectiveMaxHearts(this); - if (2 < iVar13) { - iVar13 = 2; - } - iVar13 = scale_for_hard_difficulty(iVar13); - pEVar15 = GHIDRA_CAST(this->_subPlayer); - this->_redHearts = iVar13; - if (pEVar15 != GHIDRA_CAST(0x0)) { - iVar13 = GetEffectiveMaxHearts(pEVar15); - if (2 < iVar13) { - iVar13 = 2; - } - pEVar15->_redHearts = iVar13; - } - UpdateHeartDependentEffects(this); - iVar13 = GetHealthType(this); - local_230.y = (float)&DAT_00000014; - if (iVar13 != 3) { - local_230.y = 1.4013e-44; - } - uVar9 = (GHIDRA_CAST((pillRng)))->RNG::RandomInt(4); - local_20c = (void *)0x0; - local_208 = GHIDRA_CAST((uVar9 + 4)); - if ((char)isHorsePill == '\0') { - local_208 = GHIDRA_CAST((uVar9 + 1)); - } - if (0 < GHIDRA_INT(local_208)) { - do { - uVar9 = Random(); - pVVar17 = Room::FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((local_c0 + 0x10)),&this->_pos,40.0,0,0,0); - tmpEntity = Game::Spawn(g_game,5,GHIDRA_UINT(local_230.y),pVVar17,&g_vectorZero,GHIDRA_CAST(this),1, - uVar9); - tmpEntity[1]._sprite._championColor._offset[2] = (float)local_20c; - local_20c = GHIDRA_CAST((GHIDRA_INT(local_20c) + 1)); - } while (GHIDRA_INT(local_20c) < GHIDRA_INT(local_208)); - } -LAB_007c5fcc: - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_20; - break; - case 0x16: - this->_controlsCooldown = 0x78; - if (cVar5 != '\0') { - this->_controlsCooldown = 0xf0; - } - (GHIDRA_CAST((&effectColor)))->Color::Color(0.6,0.6,0.6,0.4,0.4,0.4); - this->SetColor(); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_21; - break; - case 0x17: - (*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x11))) = 1; - if (cVar5 != '\0') { - Level::ApplyMapEffect(GHIDRA_CAST(game)); - Level::ApplyBlueMapEffect(GHIDRA_CAST(g_game)); - Level::ApplyCompassEffect(GHIDRA_CAST(g_game),1); - game = g_game; - } - Game::UpdateVisibility(game); - AnimateHappy(this); - pMVar21 = extraout_ECX_22; - break; - case 0x18: - uVar9 = Random(); - Game::Spawn(g_game,1000,0x22,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar9); - piVar14 = GHIDRA_CAST(__RTDynamicCast()); - (GHIDRA_CAST((&effectColor)))->Color::Color(); - (**(code **)(*piVar14 + 0x3c))(); - if ((char)isHorsePill != '\0') { - SFXManager::Stop(&g_manager->_sfxManager,0x25); - FUN_0092df00(0x25,extraout_ECX_23,0,0); - FUN_0092df00(0x25,extraout_ECX_24,0x14,0); - Game::ShakeScreen(g_game,3); - piVar14[0x39] = GHIDRA_INT(((float)piVar14[0x39] + (float)piVar14[0x39])); - piVar14[0x3a] = GHIDRA_INT(((float)piVar14[0x3a] + (float)piVar14[0x3a])); - } - (**(code **)(*piVar14 + 0xc))(); - ShootCandle(this,direction_00); - local_20c = (void *)0x0; - local_208 = g_game->_room; - if (local_208[2]._pools[0xf]._poolList._capacity != (void *)0x0) { - do { - pEVar15 = *(Entity_Player **) - (GHIDRA_INT(local_208[2]._pools[0xf]._poolList._begin) + GHIDRA_INT(local_20c) * 4); - if ((pEVar15 != this) && - (bVar6 = (GHIDRA_CAST((GHIDRA_CAST(pEVar15))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar6 != 0)) { - if ((char)isHorsePill == '\0') { - (GHIDRA_CAST((GHIDRA_CAST((local_ec + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - iVar13 = 0x96; - } - else { - cVar5 = pEVar15->IsBoss(); - if ((cVar5 == '\0') && ((pEVar15->_flags & 0x20000000) == 0)) { - (GHIDRA_CAST((GHIDRA_CAST((local_ec + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar15))))->Entity::AddCharmed(GHIDRA_CAST((local_ec + 4)),-1,0,1); - if (pEVar15->_type == 0x104) { - if (pEVar15->_parent != 0) { - local_230.y = (float)&pEVar15->_parent; - msvc::multiset::erase(); - } - pEVar15->_parent = 0; - } - goto LAB_007c62d0; - } - (GHIDRA_CAST((GHIDRA_CAST((local_ec + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - iVar13 = 300; - } - (GHIDRA_CAST((GHIDRA_CAST(pEVar15))))->Entity::AddCharmed(GHIDRA_CAST((local_ec + 4)),iVar13,0,0); - } -LAB_007c62d0: - local_20c = GHIDRA_CAST((GHIDRA_INT(local_20c) + 1)); - } while (local_20c < local_208[2]._pools[0xf]._poolList._capacity); - } - if ((char)isHorsePill == '\0') { -LAB_007c7497: - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_48; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 2.0; - local_d8 = GHIDRA_CAST(0x0); - fStack_d4 = 1.0; - fStack_d0 = 1.0; - Game::start_poop_cloud_screen_effect - (GHIDRA_CAST((*GHIDRA_CAST((extraout_EDX + 0x18300)) + 0x1618)),color_01); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_25; - } - break; - case 0x19: - Level::AddCurse(GHIDRA_CAST(g_game),4,0); - if ((char)isHorsePill != '\0') { - bVar6 = HasCollectible(this,0x28e,0); - local_214 = (float)CONCAT13(bVar6,(undefined3)local_214); - bVar6 = HasCollectible(this,0x4b,0); - if (((bVar6 == 0) && (bVar6 = HasCollectible(this,0x12f,0), bVar6 == 0)) && - ((bVar6 = HasCollectible(this,0x2e,0), bVar6 == 0 && - (iVar13 = GetZodiacEffect(this), iVar13 != 0x12f)))) { - bVar25 = false; - } - else { - bVar25 = true; - } - game = g_game; - if (((*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))) == '\0') && (!bVar25)) { - uVar9 = 0; - do { - uVar16 = -GHIDRA_UINT(((uVar9 & 0x7ff) != 0)) & uVar9 & 0x7ff; - uVar12 = 0xe; - if (uVar16 < 0xe) { - uVar12 = uVar16; - } - uVar9 = uVar9 + 1; - *GHIDRA_CAST((GHIDRA_CAST((&game->_itemPool + 1)) + uVar12 + 0x3c)) = 0; - } while (GHIDRA_INT(uVar9) < 0xe); - AnimateSad(this); - pMVar21 = extraout_ECX_26; - break; - } - } - goto LAB_007c679f; - case 0x1a: - uVar9 = Random(); - Game::Spawn(g_game,1000,0x4e,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar9); - tmpEntity = GHIDRA_CAST(__RTDynamicCast()); - if ((char)isHorsePill != '\0') { - pAVar3 = &tmpEntity[1]._sprite; - (pAVar3->_animDefaultName)._buf[8] = '\0'; - (pAVar3->_animDefaultName)._buf[9] = '\0'; - (pAVar3->_animDefaultName)._buf[10] = '\0'; - (pAVar3->_animDefaultName)._buf[0xb] = '@'; - } - goto LAB_007c6454; - case 0x1b: - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) & 0xfffffffcU)) < 0x19) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x18)); - } - AddCostume(this,itemConfig,0); - AnimateHappy(this); - pMVar21 = GHIDRA_CAST(0x708); - cVar5 = (char)isHorsePill; - iVar13 = 900; - if (cVar5 != '\0') { - iVar13 = 0x708; - } - this->_rUaWizardTimer = this->_rUaWizardTimer + iVar13; - goto LAB_007c7557; - case 0x1c: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x6c,1,1); - if ((char)isHorsePill != '\0') { - AddHearts(this,0x14,0,0); - } - AnimateHappy(this); - pMVar21 = extraout_ECX_29; - break; - case 0x1d: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddNullEffect(0x1d,1,1); - if ((char)isHorsePill == '\0') goto LAB_007c679f; - AddBrokenHearts(this,1); - AnimateSad(this); - pMVar21 = extraout_ECX_28; - break; - case 0x1e: - play_sound_with_fart_seed(0x25,1.0,2,0,1.0); - pvVar7 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar7) & 0xfffffffcU)) < 0x71) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x70)); - } - (GHIDRA_CAST((tempEffect)))->TemporaryEffect::TemporaryEffect(itemConfig); - local_220.x = 4.2039e-44; - if ((char)isHorsePill != '\0') { - local_220.x = 4.2039e-43; - } -LAB_007c5476: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(tempEffect,1,1); -LAB_007c548c: - AnimateSad(this); - ShootCandle(this,direction); - pMVar21 = extraout_ECX_09; - break; - case 0x1f: - Level::AddCurse(GHIDRA_CAST(g_game),0x20,0); - pvVar7 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) >> 2 < 0x157) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x558)); - } - AddCostume(this,itemConfig,0); - if ((char)isHorsePill != '\0') { - local_224 = GHIDRA_CAST(0x0); - local_210 = GHIDRA_CAST(0x0); - local_220.x = 0.0; - local_220.y = 0.0; - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),4); - uVar9 = Level::filter_curses(GHIDRA_CAST(g_game),1); - pfVar24 = GHIDRA_CAST(0x0); - if (uVar9 == 0) { - local_230.y = 1.4013e-45; - msvc::vector<4byte>::_Emplace_reallocate(); - local_210 = GHIDRA_CAST(local_220.y); - pfVar24 = GHIDRA_CAST(local_220.x); - } - uVar9 = Level::filter_curses(GHIDRA_CAST(g_game),4); - if (uVar9 == 0) { - local_230.y = (float)&DAT_00000004; - if (pfVar24 == local_210) { - msvc::vector<4byte>::_Emplace_reallocate(); - local_210 = GHIDRA_CAST(local_220.y); - pfVar24 = GHIDRA_CAST(local_220.x); - } - else { - *pfVar24 = 5.60519e-45; - local_220.x = (float)(pfVar24 + 1); - pfVar24 = GHIDRA_CAST(local_220.x); - } - } - uVar9 = Level::filter_curses(GHIDRA_CAST(g_game),8); - if (uVar9 == 0) { - local_230.y = (float)&DAT_00000008; - if (pfVar24 == local_210) { - msvc::vector<4byte>::_Emplace_reallocate(); - local_210 = GHIDRA_CAST(local_220.y); - pfVar24 = GHIDRA_CAST(local_220.x); - } - else { - *pfVar24 = 1.12104e-44; - local_220.x = (float)(pfVar24 + 1); - pfVar24 = GHIDRA_CAST(local_220.x); - } - } - uVar9 = Level::filter_curses(GHIDRA_CAST(g_game),0x40); - if (uVar9 == 0) { - local_230.y = 8.96831e-44; - if (pfVar24 == local_210) { - msvc::vector<4byte>::_Emplace_reallocate(); - local_210 = GHIDRA_CAST(local_220.y); - pfVar24 = GHIDRA_CAST(local_220.x); - } - else { - *pfVar24 = 8.96831e-44; - local_220.x = (float)(pfVar24 + 1); - pfVar24 = GHIDRA_CAST(local_220.x); - } - } - uVar9 = GHIDRA_INT(pfVar24) - GHIDRA_INT(local_224) >> 2; - if (uVar9 != 0) { - uVar9 = (GHIDRA_CAST((&g_game->_generationRNG)))->RNG::RandomInt(uVar9); - Level::AddCurse(GHIDRA_CAST(g_game),GHIDRA_UINT(local_224[uVar9]),0); - } - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - if (local_224 != GHIDRA_CAST(0x0)) { - deallocate(local_224,GHIDRA_INT(local_210) - GHIDRA_INT(local_224) >> 2); - } - } -LAB_007c679f: - AnimateSad(this); - pMVar21 = extraout_ECX_30; - break; - case 0x20: - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - this->_cacheFlags = this->_cacheFlags | 0x800; - IncrementPlayerFormCounter(this,0xd,(isHorsePill & 0xff) + 1); - pMVar21 = extraout_ECX_31; - break; - case 0x21: - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - this->_cacheFlags = this->_cacheFlags | 0x800; - pMVar21 = extraout_ECX_32; - break; - case 0x22: - pvVar7 = g_game->_room; - local_210 = GHIDRA_CAST(0x1); - local_214 = (float)(GHIDRA_UINT(local_214) & 0xffffff); - if (1 < *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0xc)) + -1) { - do { - local_208 = GHIDRA_CAST(0x1); - pfVar24 = local_210; - if (1 < *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x10)) + -1) { - do { - if (-1 < GHIDRA_INT(pfVar24)) { - local_20c = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0xc)); - if (((GHIDRA_INT(pfVar24) < GHIDRA_INT(local_20c)) && (-1 < GHIDRA_INT(local_208))) && - (GHIDRA_INT(local_208) < *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x10)))) { - pfVar24 = GHIDRA_CAST((GHIDRA_INT(local_208) * GHIDRA_INT(local_20c) + GHIDRA_INT(local_210))); - if (((-1 < GHIDRA_INT(pfVar24)) && - (piVar14 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + GHIDRA_INT(pfVar24) * 4 + 0x24)), - piVar14 != GHIDRA_CAST(0x0))) && (piVar14[1] == 0xe)) { - iVar13 = piVar14[9]; - iVar1 = piVar14[9]; - this->_numBlueSpiders = this->_numBlueSpiders + 1; - local_230.x = (float)(iVar13 % GHIDRA_INT(local_20c)) * 40.0 + 40.0; - local_230.y = (float)(iVar1 / GHIDRA_INT(local_20c)) * 40.0 + 120.0; - spawn_blue_spider(&local_230,GHIDRA_CAST(this),&g_vectorZero); - if ((char)isHorsePill != '\0') { - iVar13 = piVar14[9]; - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - this->_numBlueSpiders = this->_numBlueSpiders + 1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x10))) = (float)(iVar13 % iVar1) * 40.0 + 40.0; - local_ac = (uint8_t [4])((float)(iVar13 / iVar1) * 40.0 + 120.0); - spawn_blue_spider(GHIDRA_CAST((local_c0 + 0x10)),GHIDRA_CAST(this),&g_vectorZero); - } - pcVar2 = *(code **)(*piVar14 + 0x14); - (GHIDRA_CAST((GHIDRA_CAST((local_ec + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); - (*pcVar2)(); - local_214 = (float)CONCAT13(1,(undefined3)local_214); - } - pfVar24 = local_210; - } - } - local_208 = GHIDRA_CAST((GHIDRA_INT(&local_208->_seed) + 1)); - pvVar7 = g_game->_room; - } while (GHIDRA_INT(local_208) < *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x10)) + -1); - } - local_210 = GHIDRA_CAST((GHIDRA_INT(pfVar24) + 1)); - pvVar7 = g_game->_room; - } while (GHIDRA_INT(local_210) < *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0xc)) + -1); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))) != '\0') goto LAB_007c7497; - } - uVar9 = (GHIDRA_CAST((pillRng)))->RNG::RandomInt(2); - iVar13 = uVar9 + 1; - if (iVar13 < 1) goto LAB_007c7497; - do { - this->_numBlueSpiders = this->_numBlueSpiders + 1; - spawn_blue_spider(&this->_pos,GHIDRA_CAST(this),&g_vectorZero); - if ((char)isHorsePill != '\0') { - this->_numBlueSpiders = this->_numBlueSpiders + 1; - spawn_blue_spider(&this->_pos,GHIDRA_CAST(this),&g_vectorZero); - } - iVar13 = iVar13 + -1; - } while (iVar13 != 0); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_33; - break; - case 0x23: - iVar13 = (GHIDRA_CAST((g_game->_room)))->Room::GetAliveEnemiesCount(); - bVar25 = false; - if (iVar13 == 0) { - uVar9 = (GHIDRA_CAST((pillRng)))->RNG::RandomInt(3); - iVar13 = uVar9 + 1; - bVar25 = iVar13 == 0; - } - if (bVar25 || iVar13 < 0) goto LAB_007c7497; - do { - this->_numBlueSpiders = this->_numBlueSpiders + 1; - spawn_blue_spider(&this->_pos,GHIDRA_CAST(this),&g_vectorZero); - if ((char)isHorsePill != '\0') { - this->_numBlueSpiders = this->_numBlueSpiders + 1; - spawn_blue_spider(&this->_pos,GHIDRA_CAST(this),&g_vectorZero); - } - iVar13 = iVar13 + -1; - } while (iVar13 != 0); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_34; - break; - case 0x24: - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x5d,1,1); - cVar5 = '\0'; - pMVar21 = extraout_ECX_35; - if ((char)isHorsePill != '\0') { - Game::ShakeScreen(g_game,0x1e); - local_230.y = (float)(g_manager->_itemConfig)._nullItems._begin; - iVar13 = GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(local_230.y) >> 2; - if (iVar13 < 0x2a) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(local_230.y) + 0xa4)); - } - bVar6 = TemporaryEffects::has_item_effect(&this->_temporaryeffects,itemConfig); - pMVar21 = extraout_ECX_36; - if (bVar6 == 0) { - if (iVar13 < 0x2a) { - itemConfig = GHIDRA_CAST(0x0); - } - else { - itemConfig = *GHIDRA_CAST((GHIDRA_CAST(local_230.y) + 0xa4)); - } - (GHIDRA_CAST((tempEffect)))->TemporaryEffect::TemporaryEffect(itemConfig); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(Effect_00,1,1); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x12e,0,1); - pMVar21 = extraout_ECX_37; - } - break; - } - goto LAB_007c7557; - case 0x25: - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - pEVar15 = GHIDRA_CAST(FUN_0090b0e0()); - if (pEVar15 != this) goto LAB_007c7497; - cVar5 = (char)isHorsePill; - } - iVar13 = 900; - if (cVar5 != '\0') { - iVar13 = 0xa8c; - } - Game::AddPixelation(g_game,iVar13); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_38; - break; - case 0x26: - iVar13 = 3; - if (cVar5 != '\0') { - iVar13 = 0xc; - } - AddBlueFlies(this,iVar13,&this->_pos,GHIDRA_CAST(0x0)); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_39; - break; - case 0x27: - local_210 = GHIDRA_CAST(0x3); - if (cVar5 != '\0') { - local_210 = GHIDRA_CAST(&DAT_00000009); - } - iVar13 = 0; - do { - uVar9 = Random(); - local_230.y = (((float)iVar13 * 360.0) / 3.0) * 0.017453292; - local_20c = GHIDRA_CAST(cos(local_230.y)); - local_230.y = sin(local_230.y); - if ((char)isHorsePill == '\0') { - local_208 = GHIDRA_CAST(0x42200000); - } - else { - local_208 = GHIDRA_CAST(0x42a00000); - } - uVar12 = Random(); - fVar27 = (float)((double)GHIDRA_INT(uVar12) + __uint_to_double_fixup[-(GHIDRA_INT(uVar12) >> 0x1f)]) * - 2.3283064e-10 * (float)local_208 + 35.0; - local_ac = (uint8_t [4])(fVar27 * local_230.y + (this->_pos).y); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x10))) = fVar27 * (float)local_20c + (this->_pos).x; - tmpEntity = Game::Spawn(g_game,1000,0x5e,GHIDRA_CAST((local_c0 + 0x10)),&g_vectorZero, - GHIDRA_CAST(this),0,uVar9); - *GHIDRA_CAST(&tmpEntity->_flags) = GHIDRA_UINT(tmpEntity->_flags) | 0x20000000; - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)); - (tmpEntity->_sprite)._scale.x = 5.0; - (tmpEntity->_sprite)._scale.y = 5.0; - *GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)) = flagsHigh; - if ((char)isHorsePill != '\0') { - pAVar3 = &tmpEntity[1]._sprite; - (pAVar3->_filename)._buf[4] = -0x7c; - (pAVar3->_filename)._buf[5] = '\x03'; - (pAVar3->_filename)._buf[6] = '\0'; - (pAVar3->_filename)._buf[7] = '\0'; - pAVar3 = &tmpEntity[1]._sprite; - (pAVar3->_filename)._buf[8] = -0x7c; - (pAVar3->_filename)._buf[9] = '\x03'; - (pAVar3->_filename)._buf[10] = '\0'; - (pAVar3->_filename)._buf[0xb] = '\0'; - } - tmpEntity->Update(); - iVar13 = iVar13 + 1; - } while (iVar13 < GHIDRA_INT(local_210)); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_40; - break; - case 0x28: - local_210 = GHIDRA_CAST(0x3); - if (cVar5 != '\0') { - local_210 = GHIDRA_CAST(&DAT_00000009); - } - iVar13 = 0; - do { - uVar9 = Random(); - local_230.y = (((float)iVar13 * 360.0) / 3.0) * 0.017453292; - local_20c = GHIDRA_CAST(cos(local_230.y)); - local_230.y = sin(local_230.y); - if ((char)isHorsePill == '\0') { - local_208 = GHIDRA_CAST(0x42200000); - } - else { - local_208 = GHIDRA_CAST(0x42a00000); - } - uVar12 = Random(); - fVar27 = (float)((double)GHIDRA_INT(uVar12) + __uint_to_double_fixup[-(GHIDRA_INT(uVar12) >> 0x1f)]) * - 2.3283064e-10 * (float)local_208 + 35.0; - local_ac = (uint8_t [4])(fVar27 * local_230.y + (this->_pos).y); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x10))) = fVar27 * (float)local_20c + (this->_pos).x; - tmpEntity = Game::Spawn(g_game,1000,0x2d,GHIDRA_CAST((local_c0 + 0x10)),&g_vectorZero, - GHIDRA_CAST(this),0,uVar9); - *GHIDRA_CAST(&tmpEntity->_flags) = GHIDRA_UINT(tmpEntity->_flags) | 0x20000000; - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)); - (tmpEntity->_sprite)._scale.x = 5.0; - (tmpEntity->_sprite)._scale.y = 5.0; - *GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)) = flagsHigh; - if ((char)isHorsePill != '\0') { - pAVar3 = &tmpEntity[1]._sprite; - (pAVar3->_filename)._buf[4] = -0x7c; - (pAVar3->_filename)._buf[5] = '\x03'; - (pAVar3->_filename)._buf[6] = '\0'; - (pAVar3->_filename)._buf[7] = '\0'; - pAVar3 = &tmpEntity[1]._sprite; - (pAVar3->_filename)._buf[8] = -0x7c; - (pAVar3->_filename)._buf[9] = '\x03'; - (pAVar3->_filename)._buf[10] = '\0'; - (pAVar3->_filename)._buf[0xb] = '\0'; - } - tmpEntity->Update(); - iVar13 = iVar13 + 1; - } while (iVar13 < GHIDRA_INT(local_210)); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_41; - break; - case 0x29: - if (cVar5 != '\0') { - Level::SetStateFlag(GHIDRA_CAST(g_game),0x18,1); - } - (GHIDRA_CAST((g_game->_room)))->Room::SetBrokenWatchState(1); - (GHIDRA_CAST((g_game->_room)))->Room::SetSlowDown(0x7fffffff); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_42; - break; - case 0x2a: - if (cVar5 != '\0') { - Level::SetStateFlag(GHIDRA_CAST(g_game),0x19,1); - } - (GHIDRA_CAST((g_game->_room)))->Room::SetBrokenWatchState(2); - uVar9 = (GHIDRA_CAST((pillRng)))->RNG::RandomInt(2); - this->_imExcitedSpeedupCountdown = (uVar9 + 2) * 900; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1c,0,1); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_43; - break; - case 0x2b: - if (cVar5 != '\0') { - if (this->_trinketsID[0] != 0) { - this->_trinketsID[0] = this->_trinketsID[0] | 0x8000; - } - if (this->_trinketsID[1] != 0) { - this->_trinketsID[1] = this->_trinketsID[1] | 0x8000; - } - this->_cacheFlags = this->_cacheFlags | 0xffff; - EvaluateItems(this); - } - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_214) + 2)),0x1df,1,-1,0); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_44; - break; - case 0x2c: - if (cVar5 == '\0') { - uVar9 = Random(); - pVVar17 = Isaac::GetAxisAlignedUnitVectorFromDir(&local_220,this->_headDirection); - local_ac = (uint8_t [4])(pVVar17->y * 10.0 * this->_shotspeed); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x10))) = pVVar17->x * 10.0 * this->_shotspeed; - Game::Spawn(g_game,2,0,&this->_pos,GHIDRA_CAST((local_c0 + 0x10)),GHIDRA_CAST(this),0,uVar9); - tear = GHIDRA_CAST(__RTDynamicCast()); - tear->SetCollisionDamage(); - tearFlags = BitSet128::operator_or - (GHIDRA_CAST((CStack_150._colorize + 2)),&g_tearFlagExplosive, - &g_tearFlagPoison); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*tearFlags); - tear->_fallingAccel = 0.6; - tear->_fallingSpeed = -13.0; - (GHIDRA_CAST((&effectColor)))->Color::Color(0.5,0.9,0.4,1.0); - tear->SetColor(); - tear->Update(); - pMVar21 = extraout_ECX_46; - } - else { - local_20c = GHIDRA_CAST(0x6); - do { - pVVar17 = Isaac::GetAxisAlignedUnitVectorFromDir(&local_220,this->_headDirection); - fVar27 = pVVar17->x; - local_214 = pVVar17->y; - local_210 = GHIDRA_CAST(this->_shotspeed); - uVar9 = Random(); - rngFloat = (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_230.y = rngFloat + rngFloat; - local_208 = GHIDRA_CAST(cos(local_230.y)); - local_230.y = sin(local_230.y); - uVar9 = Random(); - rngFloat = (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x10))) = - ((float)local_208 + (float)local_208) * rngFloat + fVar27 * 8.0 * (float)local_210; - local_ac = (uint8_t [4]) - ((local_230.y + local_230.y) * rngFloat + local_214 * 8.0 * (float)local_210); - uVar9 = Random(); - local_208 = (ItemPool *) - ((float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10 + 0.8); - uVar9 = Random(); - Game::Spawn(g_game,2,0,&this->_pos,GHIDRA_CAST((local_c0 + 0x10)),GHIDRA_CAST(this),0,uVar9); - tear = GHIDRA_CAST(__RTDynamicCast()); - tear->SetCollisionDamage(); - tearFlags = BitSet128::operator_or - (GHIDRA_CAST((CStack_150._colorize + 2)),&g_tearFlagExplosive, - &g_tearFlagPoison); - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*tearFlags); - tear->_fallingAccel = 0.6; - uVar9 = Random(); - tear->_fallingSpeed = - -9.0 - (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10 * 5.0; - pIVar23 = local_208; - if ((float)local_208 <= 0.01) { - pIVar23 = GHIDRA_CAST(0x3c23d70a); - } - tear->_baseScale = (float)pIVar23; - tear->_fScale = (float)pIVar23; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Reset(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x0))) = 0.5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_ec)) + 0x4))) = 0.9; - fStack_e4 = 0.4; - fStack_e0 = 1.0; - tear->SetColor(); - tear->Update(); - local_20c = GHIDRA_CAST((GHIDRA_INT(local_20c) + -1)); - } while (local_20c != GHIDRA_CAST(0x0)); - local_20c = (void *)0x0; - pMVar21 = extraout_ECX_45; - } - break; - case 0x2d: - if (cVar5 == '\0') { - UseActiveItem(this,GHIDRA_CAST((GHIDRA_INT(&local_214) + 2)),0x12a,1,-1,0); - goto LAB_007c7497; - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x5d,1,1); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_47; - break; - case 0x2e: - uVar9 = pillColor; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1738)))) != 0) { - uVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1738)))); - } - uVar16 = Random(); - pVVar17 = Room::FindFreePickupSpawnPosition(g_game->_room,&local_220,&this->_pos,40.0,0,0,0); - uVar12 = uVar9 | 0x800; - if ((char)isHorsePill == '\0') { - uVar12 = uVar9; - } - tmpEntity = Game::Spawn(g_game,5,0x46,pVVar17,&g_vectorZero,GHIDRA_CAST(this),uVar12,uVar16); -LAB_007c6454: - tmpEntity->Update(); - AnimatePill(this,pillColor,GHIDRA_CAST("UseItem")); - pMVar21 = extraout_ECX_27; - break; - case 0x2f: - this->_cacheFlags = this->_cacheFlags | 4; - AnimateSad(this); - pMVar21 = extraout_ECX_17; - break; - case 0x30: - this->_cacheFlags = this->_cacheFlags | 0x1004; - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(local_ec))))->Color::Color(); - fStack_dc = 1.3; - local_d8 = GHIDRA_CAST(0x3fa66666); - fStack_d4 = 1.3; - fStack_d0 = 0.5; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))))))->Color::operator_assign(other_04); - this_01 = &effectColor; - blueOffset = 0.5; - rngFloat = 0.5; - fVar27 = 0.5; -LAB_007c5631: - (GHIDRA_CAST((this_01)))->Color::Color(0.3,0.3,0.3,fVar27,rngFloat,blueOffset); - this->SetColor(); - pMVar21 = extraout_ECX_13; - break; - case 0x31: - local_17c._colorize[1] = 9.80909e-45; - local_17c._colorize[2] = 2.24208e-44; - local_17c._colorize[3] = 1.68156e-44; - local_17c._offset[0] = 1.96182e-44; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x0))) = (void *)0x0; - local_c0[4] = '\x02'; - local_c0[5] = '\0'; - local_c0[6] = '\0'; - local_c0[7] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x8))) = 8; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0xc))) = 0x40000000010; - local_ac = (uint8_t [4])0x4; - local_17c._offset[1] = 2.52234e-44; - local_17c._offset[2] = 6.72623e-44; - local_d8 = GHIDRA_CAST(&DAT_00000006); - fStack_d4 = 2.10195e-44; - fStack_d0 = 1.54143e-44; - fStack_cc = 1.82169e-44; - local_c8 = 2.38221e-44; - local_c4 = &DAT_0000002f; - CStack_150._colorize[1] = 1.6778514e-38; - CStack_150._colorize[2] = 1.6778486e-38; - CStack_150._colorize[3] = 1.6778991e-38; - CStack_150._offset[0] = 1.6778963e-38; - CStack_150._offset[1] = 1.6779053e-38; - CStack_150._offset[2] = 1.6779019e-38; - bVar6 = HasCollectible(this,0x4b,0); - if (((bVar6 == 0) && (bVar6 = HasCollectible(this,0x12f,0), bVar6 == 0)) && - ((bVar6 = HasCollectible(this,0x2e,0), bVar6 == 0 && - (iVar13 = GetZodiacEffect(this), iVar13 != 0x12f)))) { - isSkipStatDown = '\0'; - bVar6 = HasCollectible(this,0x28e,0); - local_214 = (float)CONCAT13(bVar6,(undefined3)local_214); - } - else { - bVar6 = HasCollectible(this,0x28e,0); - fVar27 = local_214; - local_214 = (float)CONCAT13(bVar6,(undefined3)local_214); - isSkipStatDown = '\x01'; - if (bVar6 != 0) { - local_214 = (float)(GHIDRA_UINT(fVar27) & 0xffffff); - isSkipStatDown = '\0'; - } - } - local_224 = GHIDRA_CAST(0x0); - local_220.x = 0.0; - local_220.y = 0.0; - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),3); - msvc::vector::_Reallocate(); - local_20c = (void *)0x0; - pfVar24 = GHIDRA_CAST(local_220.y); - do { - if (GHIDRA_CAST(local_220.x) == pfVar24) { - msvc::vector::_Emplace_reallocate(); - pfVar24 = GHIDRA_CAST(local_220.y); - } - else { - *GHIDRA_CAST(local_220.x) = local_20c; - local_220.x = (float)(GHIDRA_INT(local_220.x) + 4); - } - fVar27 = local_220.x; - local_20c = GHIDRA_CAST((GHIDRA_INT(local_20c) + 1)); - } while (local_20c < (void *)0x6); - RNG::Shuffle(GHIDRA_CAST((GHIDRA_INT((this->_pillRNGs)._begin) + 0x310)),GHIDRA_CAST(local_224),GHIDRA_CAST(local_220.x)) - ; - if ((*local_224 == 0.0) && (bVar6 = CanUsePill(this,6), bVar6 == 0)) { - *local_224 = *GHIDRA_CAST((GHIDRA_CAST(fVar27) + -4)); - *GHIDRA_CAST((GHIDRA_CAST(fVar27) + -4)) = 0.0; - } - pfVar24 = local_224; - bVar6 = (uint8_t)isHorsePill; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))) == '\0') { - piVar14 = GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + - GHIDRA_INT(local_17c._colorize[GHIDRA_INT(local_224[1]) + 1]) * 4)); - *piVar14 = *piVar14 + 1; - if (bVar6 != 0) { - piVar14 = GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + - GHIDRA_INT(local_17c._colorize[GHIDRA_INT(local_224[1]) + 1]) * 4)); - *piVar14 = *piVar14 + 1; - } - this->_cacheFlags = this->_cacheFlags | *GHIDRA_CAST((local_c0 + GHIDRA_INT(local_224[1]) * 4)); - if (local_224[1] == 0.0) { - AddMaxHearts(this,(isHorsePill & 0xff) * 2 + 2,0); - bVar6 = (uint8_t)isHorsePill; - } - } - if (isSkipStatDown == '\0') { - piVar14 = GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + - *GHIDRA_CAST((local_c0 + GHIDRA_INT(*pfVar24) * 4 + -0x18)) * 4)); - *piVar14 = *piVar14 + 1; - if (bVar6 != 0) { - piVar14 = GHIDRA_CAST((GHIDRA_INT((this->_pillEffectUses)._begin) + - *GHIDRA_CAST((local_c0 + GHIDRA_INT(*pfVar24) * 4 + -0x18)) * 4)); - *piVar14 = *piVar14 + 1; - } - this->_cacheFlags = this->_cacheFlags | *GHIDRA_CAST((local_c0 + GHIDRA_INT(*pfVar24) * 4)); - if (*pfVar24 == 0.0) { - AddMaxHearts(this,(bVar6 ^ 1) * 2 + -4,0); - TryPreventDeath(this); - } - } - if (GHIDRA_CAST(local_230.y) == GHIDRA_CAST(0x0)) { - if (isSkipStatDown == '\0') { - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))) == '\0') { - sprintf(GHIDRA_CAST(&fStack_e0),GHIDRA_CAST(CStack_150._colorize[GHIDRA_INT(pfVar24[1]) + 1])); - pbVar18 = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST(&fStack_e0)); - pbVar19 = pbVar18; - do { - bVar6 = *pbVar19; - pbVar19[GHIDRA_INT((experimentalText + -GHIDRA_INT(pbVar18)))] = bVar6; - pbVar19 = pbVar19 + 1; - } while (bVar6 != 0); - puVar4 = GHIDRA_CAST((local_ac + 3)); - do { - puVar20 = puVar4; - puVar4 = GHIDRA_CAST((GHIDRA_INT(puVar20) + 1)); - } while (*GHIDRA_CAST((GHIDRA_CAST(puVar20) + 1)) != '\0'); - *GHIDRA_CAST((GHIDRA_CAST(puVar20) + 1)) = 0x202c; - *GHIDRA_CAST((GHIDRA_CAST(puVar20) + 3)) = 0; - sprintf(GHIDRA_CAST(&fStack_e0),GHIDRA_CAST(CStack_150._colorize[GHIDRA_INT(*pfVar24) + 1])); - pbVar18 = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST(&fStack_e0)); - pbVar19 = pbVar18; - do { - bVar6 = *pbVar19; - pbVar19 = pbVar19 + 1; - } while (bVar6 != 0); - copyDst = local_ac + 3; - do { - copySrc = copyDst + 1; - copyDst = copyDst + 1; - } while (*copySrc != 0); - copySrc = pbVar18; - for (uVar9 = GHIDRA_UINT((GHIDRA_INT(pbVar19) - GHIDRA_INT(pbVar18))) >> 2; uVar9 != 0; uVar9 = uVar9 - 1) { - *GHIDRA_CAST(copyDst) = *GHIDRA_CAST(copySrc); - copySrc = copySrc + 4; - copyDst = copyDst + 4; - } - for (uVar9 = GHIDRA_INT(pbVar19) - GHIDRA_INT(pbVar18) & 3; uVar9 != 0; uVar9 = uVar9 - 1) { - *copyDst = *copySrc; - copySrc = copySrc + 1; - copyDst = copyDst + 1; - } - pfVar24 = local_224; - } - else { - sprintf(GHIDRA_CAST(&fStack_e0),GHIDRA_CAST(CStack_150._colorize[GHIDRA_INT(*pfVar24) + 1])); - pbVar18 = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST(&fStack_e0)); - pbVar19 = pbVar18; - do { - bVar6 = *pbVar19; - pbVar19[GHIDRA_INT((experimentalText + -GHIDRA_INT(pbVar18)))] = bVar6; - pbVar19 = pbVar19 + 1; - } while (bVar6 != 0); - } - } - else { - sprintf(GHIDRA_CAST(&fStack_e0),GHIDRA_CAST(CStack_150._colorize[GHIDRA_INT(pfVar24[1]) + 1])); - pbVar18 = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST(&fStack_e0)); - pbVar19 = pbVar18; - do { - bVar6 = *pbVar19; - pbVar19[GHIDRA_INT((experimentalText + -GHIDRA_INT(pbVar18)))] = bVar6; - pbVar19 = pbVar19 + 1; - } while (bVar6 != 0); - } - iVar13 = toupper(GHIDRA_INT((char)experimentalText[0])); - experimentalText[0] = (uint8_t)iVar13; - PlayerHUD::show_pill_name(); - } - if (isSkipStatDown == '\0') { - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_214)) + 0x3))) == '\0') { - AnimateHappy(this); - } - else { - AnimateSad(this); - } - } - else { - AnimateHappy(this); - play_sound_with_fart_seed(GHIDRA_INT(local_210),1.0,2,0,1.0); - } - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - deallocate(pfVar24,GHIDRA_INT(local_220.y) - GHIDRA_INT(pfVar24) >> 2); - pMVar21 = extraout_ECX_18; - break; - default: - pMVar21 = g_manager; - if (GHIDRA_INT((g_manager->_itemConfig)._pillEffects._end) - - GHIDRA_INT((g_manager->_itemConfig)._pillEffects._begin) >> 2 <= pillEffect) { - KAGE_LogMessage(1,GHIDRA_CAST("Pill %d Effect Not Implemented!\n")); - pMVar21 = extraout_ECX_49; - break; - } - goto LAB_007c7557; - } - cVar5 = (char)isHorsePill; -LAB_007c7557: - if (((local_216 != 0) && (pMVar21 = pillConfig, pillConfig != GHIDRA_CAST(0x0))) && - (uVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((pillConfig->_persistentGameData))) + 0x28)))), uVar9 != 0)) { - if (cVar5 != '\0') { - uVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((pillConfig->_persistentGameData))) + 0x2c)))); - } - PlayDelayedSFX(this,uVar9,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((pillConfig->_persistentGameData))) + 0x30)))),iVar26,1.0); - pMVar21 = extraout_ECX_50; - } - LuaEngine::UsePill(GHIDRA_CAST(pMVar21),pillEffect,this,useFlagsLocal); - if ((char)isHorsePill != '\0') { - bVar6 = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST("Happy")); - if (bVar6 == 0) { - bVar6 = ANM2::IsPlaying(&this->_sprite,&DAT_00b1cdf8); - if (bVar6 == 0) goto LAB_007c7658; - SFXManager::Stop(&g_manager->_sfxManager,0x10b); - iVar26 = 0x25b; - } - else { - SFXManager::Stop(&g_manager->_sfxManager,0x10c); - iVar26 = 0x25a; - } - (GHIDRA_CAST((&g_manager->_sfxManager)))->SoundEffects::Play(iVar26,1.0,2,0,1.0,0.0); - } -LAB_007c7658: - bVar6 = HasCollectible(this,0x28e,0); - if ((bVar6 != 0) && - (((this->_cacheFlags = this->_cacheFlags | 1, pillEffect == 0x19 || (pillEffect == 1)) || - ((((pillEffect == 0x1b || ((pillEffect == 0x16 || (pillEffect == 0x1d)))) || - (pillEffect == 0x1f)) || ((pillEffect == 0x25 || (pillEffect == 0x2a)))))))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0xc))) = 0x30000000d; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_c0)) + 0x8))) = pillRng->_seed; - local_ac = (uint8_t [4])0x1b; - uVar9 = (GHIDRA_CAST((GHIDRA_CAST((local_c0 + 8)))))->RNG::Next(); - pVVar17 = Room::FindFreePickupSpawnPosition(g_game->_room,&local_220,&this->_pos,40.0,0,0,0); - Game::Spawn(g_game,5,10,pVVar17,&g_vectorZero,GHIDRA_CAST(0x0),6,uVar9); - } - if ((pillColor != 0) && (uVar8 != 0xe)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1738)))) = pillColor; - } - if (0xf < pillDescription._capacity) { - uVar8 = pillDescription._capacity + 1; - pvVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)pillDescription._buf)) + 0x0))); - if (0xfff < uVar8) { - pvVar7 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) + -4); - uVar8 = pillDescription._capacity + 0x24; - if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) - GHIDRA_INT(pvVar7)) - 4U) goto LAB_007c77b1; - } - operator_delete(pvVar7,uVar8); - } - pillDescription._size = 0; - pillDescription._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(pillDescription._buf)) + 0x0))) & 0xffffff00; - if (0xf < pillName._capacity) { - uVar8 = pillName._capacity + 1; - ppfVar22 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(pillName._buf))) + 0x0))); - if (0xfff < uVar8) { - ppfVar22 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) + -4)); - uVar8 = pillName._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(pillName._buf)) + 0x0))) + (-4 - GHIDRA_INT(ppfVar22))))) { -LAB_007c77b1: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ppfVar22,uVar8); - } - ExceptionList = local_1c; - return; -} - -// 007c78b0 -void Entity_Player::AddDeadEyeCharge() -{ - if (this->_deadEyeCharges < 8) { - this->_cacheFlags = this->_cacheFlags | 1; - this->_deadEyeCharges = this->_deadEyeCharges + 1; - EvaluateItems(this); - } - this->_deadEyeMisses = 0; - return; -} - -// 007c78e0 -void Entity_Player::ClearDeadEyeCharge() -{ - uint32_t roll; - uint32_t resetChance; - - if (this->_deadEyeCharges != 0) { - this->_deadEyeMisses = this->_deadEyeMisses + 1; - resetChance = 0x32; - if (this->_deadEyeMisses == 1) { - resetChance = 0x14; - } - else if (this->_deadEyeMisses == 2) { - resetChance = 0x21; - } - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13fa))) != '\0') { - resetChance = 100; - } - roll = Random(); - if (roll % 100 < resetChance) { - this->_cacheFlags = this->_cacheFlags | 1; - this->_deadEyeMisses = 0; - this->_deadEyeCharges = 0; - EvaluateItems(this); - return; - } - } - return; -} - -// 007c7960 -int Entity_Player::GetZodiacEffect() -{ - code *pcVar1; - uint8_t isHasZodiac; - int iVar2; - uint32_t uVar3; - Game *game; - - isHasZodiac = HasCollectible(this,0x188,0); - game = g_game; - if (isHasZodiac == 0) { - return 0; - } - uVar3 = g_game->_stage; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_seedEffects))) + 0x4)))) == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Error: Game Start Seed was not set.\n")); - } - if (uVar3 == 0) { - uVar3 = 0; - } - else if (0xc < uVar3) { - uVar3 = 0xd; - } - uVar3 = (game->_seedEffects)._stageSeeds[uVar3]; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - iVar2 = (*pcVar1)(); - return iVar2; - } - uVar3 = uVar3 >> 2 ^ uVar3; - uVar3 = uVar3 << 7 ^ uVar3; - return *GHIDRA_CAST((&DAT_00b6bb10 + ((uVar3 >> 9 ^ uVar3) % 0xc) * 4)); -} - -// 007c7c60 -void Entity_Player::update_purity_glow(Entity_Player *player) -{ - uint8_t *text; - int purityState; - ItemConfig_Item *glowNullItem; - uint8_t *textEnd; - void *pvVar1; - uint32_t size; - std_string costumePath; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint8_t ch; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af6ebd; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(&costumePath) + 0x28U; - ExceptionList = &local_10; - purityState = player->_purityState; - if (3 < purityState) { - KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Purity has a wrong state!")); - purityState = player->_purityState; - } - text = (&PTR_s_gfx_characters_costumes_PurityGl_00b6bb40)[purityState]; - costumePath._size = 0; - costumePath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(costumePath._buf)) + 0x0))) = (void *)0x0; - textEnd = text; - do { - ch = *textEnd; - textEnd = textEnd + 1; - } while (ch != 0); - (GHIDRA_CAST((costumePath._buf)))->msvc::string::assign(text,GHIDRA_INT(textEnd) - GHIDRA_INT((text + 1))); - local_8 = 0; - pvVar1 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU)) < 0x45) { - glowNullItem = GHIDRA_CAST(0x0); - } - else { - glowNullItem = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x44)); - } - ReplaceCostumeSprite(player,glowNullItem,&costumePath,0); - if (0xf < costumePath._capacity) { - size = costumePath._capacity + 1; - pvVar1 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)costumePath._buf)) + 0x0))); - if (0xfff < size) { - pvVar1 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(costumePath._buf)) + 0x0))) + -4); - size = costumePath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(costumePath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar1))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar1,size); - } - ExceptionList = local_10; - return; -} - -// 007c7d70 -void Entity_Player::trigger_immaculate_conception(uint8_t isCambion) -{ - uint8_t bVar1; - int playerType; - int iVar2; - ItemConfig_Item *pIVar3; - uint8_t *costumePathEnd; - int iVar4; - void *freeBlock; - uint32_t freeSize; - int iVar5; - std_string immaculateSkinPath; - std_string cambionSkinPath; - void *immaculatePath [4]; - uint32_t immaculatePathSize; - uint32_t immaculatePathCapacity; - void *cambionPath [4]; - uint32_t cambionPathSize; - uint32_t cambionPathCapacity; - uint32_t local_18; - void *local_10; - uint8_t *puStack_c; - void *local_8; - uint8_t *costumePath; - - local_8 = (void *)0xffffffff; - puStack_c = &LAB_00b00025; - local_10 = ExceptionList; - local_18 = __security_cookie ^ GHIDRA_UINT((cambionPath + 0xb)); - ExceptionList = &local_10; - if (isCambion == 0) { - iVar5 = 5; - iVar4 = this->_immaculateConceptionState; - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - iVar5 = 0x14; - } - iVar2 = 0xf; - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - iVar2 = 0x3c; - } - if (iVar2 <= iVar4) { - KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Immaculate has a wrong state!")); - iVar4 = this->_immaculateConceptionState; - } - iVar2 = this->_bodyColor; - playerType = this->_playerType; - immaculatePathSize = 0; - immaculatePathCapacity = 0xf; - costumePath = (&PTR_s_gfx_characters_costumes_costume__00b6bb04)[iVar4 / iVar5]; - immaculatePath[0] = (void *)0x0; - costumePathEnd = costumePath; - do { - bVar1 = *costumePathEnd; - costumePathEnd = costumePathEnd + 1; - } while (bVar1 != 0); - (GHIDRA_CAST((GHIDRA_CAST(immaculatePath))))->msvc::string::assign(costumePath, - GHIDRA_INT(costumePathEnd) - GHIDRA_INT((costumePath + 1))); - local_8 = (void *)0x3; - costume_path_apply_skin_color - (&immaculateSkinPath,immaculatePath,iVar2,playerType,GHIDRA_CAST(0x0),GHIDRA_CAST(0x0)); - local_8 = (void *)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),5); - if (0xf < immaculatePathCapacity) { - freeSize = immaculatePathCapacity + 1; - freeBlock = immaculatePath[0]; - if (0xfff < freeSize) { - freeBlock = *(void **)(GHIDRA_INT(immaculatePath[0]) + -4); - freeSize = immaculatePathCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(immaculatePath[0]) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,freeSize); - } - immaculatePathSize = 0; - immaculatePathCapacity = 0xf; - immaculatePath[0] = (void *)(GHIDRA_UINT(immaculatePath[0]) & 0xffffff00); - freeBlock = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(freeBlock) & 0xfffffffcU)) < - 0x675) { - pIVar3 = GHIDRA_CAST(0x0); - } - else { - pIVar3 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + 0x674)); - } - ReplaceCostumeSprite(this,pIVar3,&immaculateSkinPath,0); - if (immaculateSkinPath._capacity < 0x10) { - ExceptionList = local_10; - return; - } - freeSize = immaculateSkinPath._capacity + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)immaculateSkinPath._buf)) + 0x0))); - if (0xfff < freeSize) { - freeBlock = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(immaculateSkinPath._buf)) + 0x0))) + -4); - freeSize = immaculateSkinPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(immaculateSkinPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - } - else { - iVar4 = this->_playerType; - iVar5 = this->_bodyColor; - iVar2 = GetCambionPregnancyLevel(this); - cambionPathSize = 0; - cambionPathCapacity = 0xf; - costumePath = (&PTR_s_gfx_characters_costumes_costume__00b6baf8)[iVar2]; - cambionPath[0] = (void *)0x0; - costumePathEnd = costumePath; - do { - bVar1 = *costumePathEnd; - costumePathEnd = costumePathEnd + 1; - } while (bVar1 != 0); - (GHIDRA_CAST((GHIDRA_CAST(cambionPath))))->msvc::string::assign(costumePath,GHIDRA_INT(costumePathEnd) - GHIDRA_INT((costumePath + 1))); - local_8 = (void *)0x0; - costume_path_apply_skin_color(&cambionSkinPath,cambionPath,iVar5,iVar4,GHIDRA_CAST(0x0),GHIDRA_CAST(0x0)); - local_8 = (void *)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); - if (0xf < cambionPathCapacity) { - freeSize = cambionPathCapacity + 1; - freeBlock = cambionPath[0]; - if (0xfff < freeSize) { - freeBlock = *(void **)(GHIDRA_INT(cambionPath[0]) + -4); - freeSize = cambionPathCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(cambionPath[0]) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,freeSize); - } - cambionPathSize = 0; - cambionPathCapacity = 0xf; - cambionPath[0] = (void *)(GHIDRA_UINT(cambionPath[0]) & 0xffffff00); - freeBlock = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(freeBlock) & 0xfffffffcU)) < - 0x671) { - pIVar3 = GHIDRA_CAST(0x0); - } - else { - pIVar3 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + 0x670)); - } - ReplaceCostumeSprite(this,pIVar3,&cambionSkinPath,0); - if (cambionSkinPath._capacity < 0x10) { - ExceptionList = local_10; - return; - } - freeSize = cambionSkinPath._capacity + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)cambionSkinPath._buf)) + 0x0))); - if (0xfff < freeSize) { - freeBlock = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(cambionSkinPath._buf)) + 0x0))) + -4); - freeSize = cambionSkinPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(cambionSkinPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - } - operator_delete(freeBlock,freeSize); - ExceptionList = local_10; - return; -} - -// 007c8050 -void Entity_Player::AddImmaculateConceptionCounter(int param_1) -{ - code *pcVar1; - uint8_t isImmaculateConceptionOwned; - uint32_t rngResult; - Vector *position; - Entity_Player *in_ECX; - int iVar2; - uint32_t *rngSeed; - uint8_t auStack_34 [4]; - int counterStep; - Vector local_2c; - int oldStage; - uint32_t familiarFlagOptions [7]; - void *collectibleRngs; - uint32_t familiarFlag; - Manager *manager; - - familiarFlagOptions[5] = __security_cookie ^ GHIDRA_UINT(auStack_34); - isImmaculateConceptionOwned = HasCollectible(in_ECX,0x19d,0); - if (isImmaculateConceptionOwned != 0) { - iVar2 = 0xf; - counterStep = 5; - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - counterStep = 0x14; - iVar2 = 0x3c; - } - oldStage = in_ECX->_immaculateConceptionState / counterStep; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - param_1 = 1; - } - else { - param_1 = param_1 << 3; - } - param_1 = in_ECX->_immaculateConceptionState + param_1; - in_ECX->_immaculateConceptionState = param_1; - if (iVar2 <= param_1) { - collectibleRngs = (in_ECX->_collectibleRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(collectibleRngs) + 0x19d0)); - familiarFlagOptions[0] = 0x40; - familiarFlagOptions[1] = 0x80; - familiarFlagOptions[2] = 0x100; - familiarFlagOptions[3] = 0x200; - familiarFlagOptions[4] = 0x400; - rngResult = *rngSeed; - if (rngResult == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - rngResult = *rngSeed; - if (rngResult == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - rngResult = rngResult >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(collectibleRngs) + 0x19d4)) & 0x1f) ^ - rngResult; - rngResult = rngResult << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(collectibleRngs) + 0x19d8)) & 0x1f) ^ - rngResult; - rngResult = rngResult >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(collectibleRngs) + 0x19dc)) & 0x1f) ^ - rngResult; - *rngSeed = rngResult; - manager = g_manager; - iVar2 = 0; - do { - familiarFlag = familiarFlagOptions[GHIDRA_INT((rngResult % 5 + iVar2)) % 5]; - if ((in_ECX->_conceptionFamiliarFlags & familiarFlag) == 0) { - local_2c.x = 1.41531e-42; - seed_fart_sound_override(GHIDRA_CAST(&local_2c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_2c.x),1.0,2,0,1.0,0.0); - in_ECX->_conceptionFamiliarFlags = in_ECX->_conceptionFamiliarFlags | familiarFlag; - in_ECX->_cacheFlags = in_ECX->_cacheFlags | 0x200; - EvaluateItems(in_ECX); - break; - } - iVar2 = iVar2 + 1; - } while (iVar2 < 5); - rngResult = Random(); - position = Room::FindFreePickupSpawnPosition(g_game->_room,&local_2c,&in_ECX->_pos,40.0,0,0,0) - ; - Game::SpawnEx(g_game,5,10,position,&g_vectorZero,GHIDRA_CAST(in_ECX),3,rngResult,0); - in_ECX->_immaculateConceptionState = 0; - param_1 = 0; - } - if (oldStage != param_1 / counterStep) { - trigger_immaculate_conception(in_ECX,0); - } - } - return; -} - -// 007c8240 -void Entity_Player::dash_impact() -{ - uint32_t *puVar1; - float fVar2; - uint64_t qVar3; - uint8_t bVar4; - int *piVar5; - uint32_t seed; - Entity *ringEffect; - Vector *pushDirection; - Entity *unused; - Entity *unused_00; - Game *game; - int iVar6; - float fVar7; - float fVar8; - double dVar9; - EntityRef sourceRef; - EntityList_EL nearbyEntities; - Vector pushResult; - Vector targetPos; - Vector local_40; - Vector local_38; - Vector reflectVelocity; - float local_28; - float local_24; - float local_20; - float local_1c; - float local_18; - float deltaX; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int *damageCooldown; - uint32_t flagsHigh; - Entity_Projectile *target; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0005d; - local_10 = ExceptionList; - ExceptionList = &local_10; - qVar3 = this->_flags; - damageCooldown = &this->_damageCooldown; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 & 0xffffffef; - game = g_game; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(qVar3); - this->_marsUnkBool = 1; - local_20 = 4.2039e-44; - piVar5 = GHIDRA_CAST(&local_20); - if (0x1d < *damageCooldown) { - piVar5 = damageCooldown; - } - iVar6 = 0; - *damageCooldown = *piVar5; - do { - local_20 = (float)iVar6 * 360.0 * 0.125 * 0.017453292; - local_18 = sin(local_20); - local_20 = cos(local_20); - local_20 = local_20 * 40.0; - local_18 = local_18 * 40.0; - local_40.x = local_20 + (this->_pos).x; - local_40.y = local_18 + (this->_pos).y; - bVar4 = (GHIDRA_CAST((game->_room)))->Room::IsPositionInRoom(&local_40,0.0); - if (bVar4 != 0) { - seed = Random(); - local_38.x = local_20 + (this->_pos).x; - local_38.y = local_18 + (this->_pos).y; - ringEffect = Game::Spawn(g_game,1000,0x93,&local_38,&g_vectorZero,GHIDRA_CAST(this),0,seed); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&ringEffect->_flags) + 4)); - *GHIDRA_CAST(&ringEffect->_flags) = GHIDRA_UINT(ringEffect->_flags) | 0x20000000; - *GHIDRA_CAST((GHIDRA_INT(&ringEffect->_flags) + 4)) = flagsHigh; - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((ringEffect)))->Entity::AddBurn(&sourceRef,10,0.0,0); - ringEffect->Update(); - game = g_game; - } - iVar6 = iVar6 + 1; - } while (iVar6 < 8); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&nearbyEntities,&this->_pos,80.0,0xffffffff); - local_8 = 0; - local_20 = 0.0; - if (nearbyEntities._size != 0) { - do { - fVar8 = local_20; - target = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEntities)) + 0x4))) + GHIDRA_INT(local_20) * 4)); - if (((target->_type != 1) && - (((bVar4 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar4 != 0 || - (target->_type == 4)) || (target->_type == 5)))) && - ((target->_mass != 0.0 && ((target->_flags & 0x4000000) == 0)))) { - local_28 = target->_size + 80.0; - deltaX = (target->_pos).x - (this->_pos).x; - local_18 = (target->_pos).y - (this->_pos).y; - local_24 = local_18 * local_18 + deltaX * deltaX; - local_1c = sqrtf(local_24); - if (0.0 < local_1c) { - if (target->_type == 9) { - fVar7 = (target->_velocity).x; - fVar2 = (target->_velocity).y; - if (local_1c <= 0.0) { - reflectVelocity.x = deltaX; - reflectVelocity.y = local_18; - (GHIDRA_CAST((target)))->Entity_Projectile::Reflect(unused,&reflectVelocity); - } - else { - fVar7 = sqrtf(fVar7 * fVar7 + fVar2 * fVar2); - reflectVelocity.y = (fVar7 / local_1c) * local_18; - reflectVelocity.x = (fVar7 / local_1c) * deltaX; - (GHIDRA_CAST((target)))->Entity_Projectile::Reflect(unused_00,&reflectVelocity); - } - } - else if ((target->_type == 2) && - (iVar6 = __RTDynamicCast(target,0,&IsaacRepentancePlus::Entity:: - RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor,0 - ), iVar6 != 0)) { - local_20 = (target->_velocity).x; - local_1c = (target->_velocity).y; - local_24 = sqrtf(local_24); - if (local_24 <= 0.0) { - local_38.y = local_18; - local_38.x = deltaX; - } - else { - fVar7 = sqrtf(local_20 * local_20 + local_1c * local_1c); - local_38.y = local_18 * (fVar7 / local_24); - local_38.x = deltaX * (fVar7 / local_24); - } - (GHIDRA_CAST((target)))->Entity_Projectile::Deflect(GHIDRA_CAST(this),&local_38); - } - else { - fVar7 = 7.0; - if (local_28 - local_1c <= 7.0) { - fVar7 = local_28 - local_1c; - } - fVar2 = target->_mass; - fVar7 = fVar7 + fVar7; - if (fVar2 <= 20.0) { - if (fVar2 <= 30.0) { - if (50.0 < fVar2) { - fVar7 = fVar7 * 0.015; - } - } - else { - fVar7 = fVar7 * 0.2; - } - } - else { - fVar7 = fVar7 * 0.5; - } - (target->_velocity).x = (deltaX / local_1c) * fVar7 + (target->_velocity).x * 0.5; - (target->_velocity).y = (local_18 / local_1c) * fVar7 + (target->_velocity).y * 0.5; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((((bVar4 != 0) && (0.0 < target->_mass)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity::HasEntityFlags(0x4000000), bVar4 == 0)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity::HasEntityFlags(0x20000000), bVar4 == 0)) { - targetPos.x = (target->_pos).x; - targetPos.y = (target->_pos).y; - (GHIDRA_CAST((&targetPos)))->Vector::__sub(&local_40,&this->_pos); - fVar8 = (GHIDRA_CAST((&local_40)))->Vector::Length(); - local_28 = fVar8; - (GHIDRA_CAST((&local_40)))->Vector::__div_assign(&local_28); - local_24 = assert_lerp_range((fVar8 - (this->_size + target->_size)) + target->_mass, - 10.0,80.0,20.0,1.0,1); - local_28 = 16.0; - pushDirection = (GHIDRA_CAST((&local_40)))->Vector::__mul(&pushResult,&local_28); - (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(this)); - bVar4 = 1; - dVar9 = floor((double)local_24); - local_28 = (float)dVar9; - iVar6 = thunk_FUN_00af0780(); - Entity::AddKnockback(GHIDRA_CAST(target),&sourceRef,pushDirection,iVar6,bVar4); - fVar8 = local_20; - } - } - } - } - local_20 = (float)(GHIDRA_INT(fVar8) + 1); - } while (GHIDRA_UINT(local_20) < GHIDRA_UINT(nearbyEntities._size)); - } - (GHIDRA_CAST((&nearbyEntities)))->EntityList_Query::~EntityList_Query(); - ExceptionList = local_10; - return; -} - -// 007c8830 -void Entity_Player::spawn_locusts() -{ - code *pcVar1; - uint8_t isFishTailHeld; - int iVar2; - int locustCount; - int iVar3; - uint32_t uVar4; - Entity *pEVar5; - int fishTailMultiplier; - uint32_t rngResult; - uint32_t *conquestRngSeed; - bool bVar6; - bool bVar7; - void *trinketRngs; - - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x71)) { - locustCount = GetTrinketMultiplier(this,0x71); - bVar7 = false; - bVar6 = locustCount == 0; -LAB_007c8868: - if (!bVar6 && bVar7 == locustCount < 0) goto LAB_007c8873; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x71); - bVar7 = SBORROW4(iVar2,1); - locustCount = iVar2 + -1; - bVar6 = iVar2 == 1; - goto LAB_007c8868; - } -LAB_007c8873: - locustCount = GetTrinketMultiplier(this,0x71); - iVar2 = 1; - isFishTailHeld = HasTrinket(this,0x5e,0); - if (isFishTailHeld != 0) { - iVar2 = 2; - iVar3 = GetTrinketMultiplier(this,0x5e); - if (iVar3 == 2) { - uVar4 = Random(); - if (uVar4 % 5 == 0) { - iVar2 = 3; - } - } - else if ((iVar3 == 3) && (uVar4 = Random(), uVar4 % 5 == 0)) { - iVar2 = 4; - } - } - iVar2 = iVar2 * locustCount; - if (0 < iVar2) { - do { - uVar4 = Random(); - pEVar5 = Game::SpawnEx(g_game,3,0x2b,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),1,uVar4,0); - *GHIDRA_CAST(&pEVar5->_flags) = GHIDRA_UINT(pEVar5->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)); - iVar2 = iVar2 + -1; - } while (iVar2 != 0); - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x72)) { - locustCount = GetTrinketMultiplier(this,0x72); - bVar7 = false; - bVar6 = locustCount == 0; -LAB_007c894d: - if (!bVar6 && bVar7 == locustCount < 0) goto LAB_007c8958; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x72); - bVar7 = SBORROW4(iVar2,1); - locustCount = iVar2 + -1; - bVar6 = iVar2 == 1; - goto LAB_007c894d; - } -LAB_007c8958: - locustCount = GetTrinketMultiplier(this,0x72); - iVar2 = 1; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x5e)) { - iVar3 = GetTrinketMultiplier(this,0x5e); - bVar7 = false; - bVar6 = iVar3 == 0; -LAB_007c8997: - if (!bVar6 && bVar7 == iVar3 < 0) goto LAB_007c899e; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - fishTailMultiplier = GetTrinketMultiplier(this,0x5e); - bVar7 = SBORROW4(fishTailMultiplier,1); - iVar3 = fishTailMultiplier + -1; - bVar6 = fishTailMultiplier == 1; - goto LAB_007c8997; - } -LAB_007c899e: - iVar2 = 2; - iVar3 = GetTrinketMultiplier(this,0x5e); - if (iVar3 == 2) { - uVar4 = Random(); - if (uVar4 % 5 == 0) { - iVar2 = 3; - } - } - else if ((iVar3 == 3) && (uVar4 = Random(), uVar4 % 5 == 0)) { - iVar2 = 4; - } - } - iVar2 = iVar2 * locustCount; - if (0 < iVar2) { - do { - uVar4 = Random(); - pEVar5 = Game::SpawnEx(g_game,3,0x2b,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),2,uVar4,0); - *GHIDRA_CAST(&pEVar5->_flags) = GHIDRA_UINT(pEVar5->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)); - iVar2 = iVar2 + -1; - } while (iVar2 != 0); - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x73)) { - locustCount = GetTrinketMultiplier(this,0x73); - bVar7 = false; - bVar6 = locustCount == 0; -LAB_007c8a59: - if (!bVar6 && bVar7 == locustCount < 0) goto LAB_007c8a64; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x73); - bVar7 = SBORROW4(iVar2,1); - locustCount = iVar2 + -1; - bVar6 = iVar2 == 1; - goto LAB_007c8a59; - } -LAB_007c8a64: - locustCount = GetTrinketMultiplier(this,0x73); - iVar2 = 1; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x5e)) { - iVar3 = GetTrinketMultiplier(this,0x5e); - bVar7 = false; - bVar6 = iVar3 == 0; -LAB_007c8aa3: - if (!bVar6 && bVar7 == iVar3 < 0) goto LAB_007c8aaa; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - fishTailMultiplier = GetTrinketMultiplier(this,0x5e); - bVar7 = SBORROW4(fishTailMultiplier,1); - iVar3 = fishTailMultiplier + -1; - bVar6 = fishTailMultiplier == 1; - goto LAB_007c8aa3; - } -LAB_007c8aaa: - iVar2 = 2; - iVar3 = GetTrinketMultiplier(this,0x5e); - if (iVar3 == 2) { - uVar4 = Random(); - if (uVar4 % 5 == 0) { - iVar2 = 3; - } - } - else if ((iVar3 == 3) && (uVar4 = Random(), uVar4 % 5 == 0)) { - iVar2 = 4; - } - } - iVar2 = iVar2 * locustCount; - if (0 < iVar2) { - do { - uVar4 = Random(); - pEVar5 = Game::SpawnEx(g_game,3,0x2b,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),3,uVar4,0); - *GHIDRA_CAST(&pEVar5->_flags) = GHIDRA_UINT(pEVar5->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)); - iVar2 = iVar2 + -1; - } while (iVar2 != 0); - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x74)) { - locustCount = GetTrinketMultiplier(this,0x74); - bVar7 = false; - bVar6 = locustCount == 0; -LAB_007c8b68: - if (!bVar6 && bVar7 == locustCount < 0) goto LAB_007c8b73; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x74); - bVar7 = SBORROW4(iVar2,1); - locustCount = iVar2 + -1; - bVar6 = iVar2 == 1; - goto LAB_007c8b68; - } -LAB_007c8b73: - locustCount = GetTrinketMultiplier(this,0x74); - iVar2 = 1; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x5e)) { - iVar3 = GetTrinketMultiplier(this,0x5e); - bVar7 = false; - bVar6 = iVar3 == 0; -LAB_007c8bb2: - if (!bVar6 && bVar7 == iVar3 < 0) goto LAB_007c8bb9; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - fishTailMultiplier = GetTrinketMultiplier(this,0x5e); - bVar7 = SBORROW4(fishTailMultiplier,1); - iVar3 = fishTailMultiplier + -1; - bVar6 = fishTailMultiplier == 1; - goto LAB_007c8bb2; - } -LAB_007c8bb9: - iVar2 = 2; - iVar3 = GetTrinketMultiplier(this,0x5e); - if (iVar3 == 2) { - uVar4 = Random(); - if (uVar4 % 5 == 0) { - iVar2 = 3; - } - } - else if ((iVar3 == 3) && (uVar4 = Random(), uVar4 % 5 == 0)) { - iVar2 = 4; - } - } - iVar2 = iVar2 * locustCount; - if (0 < iVar2) { - do { - uVar4 = Random(); - pEVar5 = Game::SpawnEx(g_game,3,0x2b,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),4,uVar4,0); - *GHIDRA_CAST(&pEVar5->_flags) = GHIDRA_UINT(pEVar5->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)); - iVar2 = iVar2 + -1; - } while (iVar2 != 0); - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x75)) { - locustCount = GetTrinketMultiplier(this,0x75); - bVar7 = false; - bVar6 = locustCount == 0; -LAB_007c8c78: - if (bVar6 || bVar7 != locustCount < 0) { - return; - } - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar2 = GetTrinketMultiplier(this,0x75); - bVar7 = SBORROW4(iVar2,1); - locustCount = iVar2 + -1; - bVar6 = iVar2 == 1; - goto LAB_007c8c78; - } - locustCount = GetTrinketMultiplier(this,0x75); - trinketRngs = (this->_trinketRNGs)._begin; - conquestRngSeed = GHIDRA_CAST((GHIDRA_INT(trinketRngs) + 0x750)); - iVar2 = GetTrinketMultiplier(this,0x75); - uVar4 = *conquestRngSeed; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar4 = *conquestRngSeed; - if (uVar4 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(trinketRngs) + 0x754)) & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(trinketRngs) + 0x758)) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(trinketRngs) + 0x75c)) & 0x1f) ^ uVar4; - *conquestRngSeed = uVar4; - uVar4 = uVar4 % (5 - (iVar2 != 2)); - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0x5e)) { - iVar2 = GetTrinketMultiplier(this,0x5e); - bVar7 = false; - bVar6 = iVar2 == 0; -LAB_007c8d1e: - if (bVar6 || bVar7 != iVar2 < 0) goto LAB_007c8d6e; - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) == '\0') { - iVar3 = GetTrinketMultiplier(this,0x5e); - bVar7 = SBORROW4(iVar3,1); - iVar2 = iVar3 + -1; - bVar6 = iVar3 == 1; - goto LAB_007c8d1e; - } - iVar3 = 2; - iVar2 = GetTrinketMultiplier(this,0x5e); - if (iVar2 == 2) { - rngResult = Random(); - if (rngResult % 5 == 0) { - iVar3 = 3; - } - } - else if ((iVar2 == 3) && (rngResult = Random(), rngResult % 5 == 0)) { - iVar3 = 4; - } - uVar4 = uVar4 * iVar3; -LAB_007c8d6e: - locustCount = locustCount + uVar4; - if (0 < locustCount) { - do { - uVar4 = Random(); - pEVar5 = Game::SpawnEx(g_game,3,0x2b,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),5,uVar4,0); - *GHIDRA_CAST(&pEVar5->_flags) = GHIDRA_UINT(pEVar5->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&pEVar5->_flags) + 4)); - locustCount = locustCount + -1; - } while (locustCount != 0); - } - return; -} - -// 007c8dc0 -Entity_Laser * Entity_Player::SpawnMawOfVoid(int timeout) -{ - uint32_t uVar1; - Entity *spawned; - Entity_Laser *laser; - uint32_t tearFlagsWord3; - uint32_t tearFlagsWord2; - uint32_t local_c; - Manager *manager; - uint32_t *parentRef; - - manager = g_manager; - local_c = GHIDRA_CAST(0x1aa); - seed_fart_sound_override(&local_c); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c),1.0,2,0,1.0,0.0); - uVar1 = Random(); - spawned = Game::SpawnEx(g_game,7,1,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),3,uVar1,0); - laser = (Entity_Laser *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor,0); - parentRef = &laser->_parent; - (laser->_posOffset).x = 0.0; - (laser->_posOffset).y = -20.0; - if (*parentRef != 0) { - local_c = parentRef; - msvc::multiset::erase(&local_c); - } - *parentRef = this; - if (this != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(parentRef); - } - laser->_renderDepthOffset = 3000.0; - uVar1 = ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._l)) + 0x4)))) & - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPulse._l)) + 0x4))); - tearFlagsWord2 = - ~(GHIDRA_UINT(g_tearFlagGrow._h) | GHIDRA_UINT(g_tearFlagShrink._h)) & GHIDRA_UINT((this->_tearFlags)._h) | - GHIDRA_UINT(g_tearFlagPulse._h); - tearFlagsWord3 = - ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._h)) + 0x4)))) & - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPulse._h)) + 0x4))); - *GHIDRA_CAST(&(laser->_tearFlags)._l) = - ~(GHIDRA_UINT(g_tearFlagGrow._l) | GHIDRA_UINT(g_tearFlagShrink._l)) & GHIDRA_UINT((this->_tearFlags)._l) | - GHIDRA_UINT(g_tearFlagPulse._l); - *GHIDRA_CAST((GHIDRA_INT(&(laser->_tearFlags)._l) + 4)) = uVar1; - *GHIDRA_CAST(&(laser->_tearFlags)._h) = tearFlagsWord2; - *GHIDRA_CAST((GHIDRA_INT(&(laser->_tearFlags)._h) + 4)) = tearFlagsWord3; - laser->SetCollisionDamage(this->_damage); - laser->_timeout = timeout; - if (laser->_spawnerEntity != 0) { - msvc::multiset::erase(GHIDRA_INT(register0x00000010) + -0x10); - } - laser->_spawnerEntity = this; - msvc::multiset::insert(&laser->_spawnerEntity); - return laser; -} - -// 007c8f80 -void Entity_Player::AddGoldenBomb() -{ - Game *game; - - this->_hasGoldenBomb = 1; - ConsumableCountChanged(this,0x10); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007c8fc0 -void Entity_Player::RemoveGoldenBomb() -{ - Game *game; - - this->_hasGoldenBomb = 0; - ConsumableCountChanged(this,0x10); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007c9000 -void Entity_Player::AddDollarBillEffect() -{ - int id; - uint32_t rngResult; - ItemConfig_Item *oldItem; - ItemConfig_Item *newItem; - Manager *manager; - - rngResult = Random(); - manager = g_manager; - id = *GHIDRA_CAST((&DAT_00b6bb50 + (rngResult % 0x26) * 4)); - oldItem = ItemConfig::GetCollectible(&g_manager->_itemConfig,this->_threeDollarBillItem); - newItem = ItemConfig::GetCollectible(&manager->_itemConfig,id); - this->_threeDollarBillItem = id; - if (oldItem != GHIDRA_CAST(0x0)) { - this->_cacheFlags = this->_cacheFlags | oldItem->cacheFlags; - } - if (newItem != GHIDRA_CAST(0x0)) { - this->_cacheFlags = this->_cacheFlags | newItem->cacheFlags; - } - EvaluateItems(this); - return; -} - -// 007c90b0 -int Entity_Player::GetCambionPregnancyLevel() -{ - int conceptionState; - - conceptionState = this->_cambionConceptionState; - if (0xe < conceptionState) { - if (0x1d < conceptionState) { - if (conceptionState < 0x3c) { - return (conceptionState + -0x1e) / 10; - } - if (conceptionState < 0x5a) { - return (conceptionState + -0x3c) / 10; - } - if (conceptionState < 99) { - return (conceptionState + -0x5a) / 3; - } - return 0; - } - conceptionState = conceptionState + -0xf; - } - return conceptionState / 5; -} - -// 007c9130 -Entity * Entity_Player::ShootRedCandle(Vector *dir) -{ - uint8_t isLocalPlayer; - uint32_t rngResult; - float *extraout_EAX; - Entity *flame; - uint32_t *netplayManager; - float unaff_ESI; - float scaleY; - uint32_t local_c0; - float fStack_bc; - float fStack_b8; - Vector VStack_b4; - Vector VStack_ac; - float fStack_a4; - float fStack_a0; - float fStack_9c; - float fStack_98; - float fStack_94; - float fStack_90; - float fStack_8c; - uint64_t uStack_88; - float fStack_80; - TearParams hitParams; - uint32_t local_c; - Manager *manager; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_c0); - flame = GHIDRA_CAST(0x0); - rngResult = Random(); - local_c0 = 0x3f800000; - GetTearHitParams(this,&hitParams,1,1.0,(rngResult & 1) * 2 + -1,flame); - fStack_bc = dir->x; - fStack_b8 = dir->y; - GetTearMovementInheritance(this,&VStack_ac,dir,0); - VStack_b4.x = (fStack_bc * 10.0 + *extraout_EAX) * 1.4; - VStack_b4.y = (fStack_b8 * 10.0 + extraout_EAX[1]) * 1.4; - rngResult = Random(); - flame = Game::SpawnEx(g_game,1000,0x34,&this->_pos,&VStack_b4,GHIDRA_CAST(this),0,rngResult,0); - (**(code **)(*GHIDRA_CAST(flame) + 0x40)) - ((hitParams._tearDamage * 4.0 * this->_meleeDamage) / this->_damage); - manager = g_manager; - netplayManager = &g_manager->_netplayManager; - scaleY = hitParams._tearDamage * g_vectorOne.y; - (flame->_sprite)._scale.x = hitParams._tearDamage * g_vectorOne.x; - (flame->_sprite)._scale.y = scaleY; - if (*netplayManager != *GHIDRA_CAST((manager + 1))) { - isLocalPlayer = - NetplayManager::IsIdxLocalPlayer(GHIDRA_CAST(netplayManager),this->_controllerIndex); - if (isLocalPlayer == 0) { - VStack_ac.y = (flame->_sprite)._color._tint[0]; - fStack_a4 = (flame->_sprite)._color._tint[1]; - fStack_a0 = (flame->_sprite)._color._tint[2]; - fStack_80 = (flame->_sprite)._color._offset[2]; - fStack_98 = (flame->_sprite)._color._colorize[0]; - fStack_94 = (flame->_sprite)._color._colorize[1]; - fStack_90 = (flame->_sprite)._color._colorize[2]; - fStack_8c = (flame->_sprite)._color._colorize[3]; - uStack_88 = *GHIDRA_CAST((flame->_sprite)._color._offset); - if ((g_game == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - unaff_ESI = (float)(g_manager->_optionsConfig)._onlinePlayerOpacity * 0.09 + 0.1; - } - fStack_9c = (flame->_sprite)._color._tint[3] * unaff_ESI; - flame->SetColor(&VStack_ac.y,0xffffffff,0xff,0,1); - } - } - flame->Update(); - return flame; -} - -// 007c9350 -Entity * Entity_Player::ShootBlueCandle(Vector *dir) -{ - ANM2 *pAVar1; - uint8_t isLocalPlayer; - uint32_t rngResult; - float *extraout_EAX; - Entity *flame; - uint32_t *netplayManager; - float unaff_ESI; - float scaleY; - uint32_t local_c0; - float fStack_bc; - float fStack_b8; - Vector VStack_b4; - Vector VStack_ac; - float fStack_a4; - float fStack_a0; - float fStack_9c; - float fStack_98; - float fStack_94; - float fStack_90; - float fStack_8c; - uint64_t uStack_88; - float fStack_80; - TearParams hitParams; - uint32_t local_c; - Manager *manager; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_c0); - flame = GHIDRA_CAST(0x0); - rngResult = Random(); - local_c0 = 0x3f800000; - GetTearHitParams(this,&hitParams,1,1.0,(rngResult & 1) * 2 + -1,flame); - fStack_bc = dir->x; - fStack_b8 = dir->y; - GetTearMovementInheritance(this,&VStack_ac,dir,0); - VStack_b4.x = (fStack_bc * 10.0 + *extraout_EAX) * 1.4; - VStack_b4.y = (fStack_b8 * 10.0 + extraout_EAX[1]) * 1.4; - rngResult = Random(); - flame = Game::SpawnEx(g_game,1000,10,&this->_pos,&VStack_b4,GHIDRA_CAST(this),0,rngResult,0); - (**(code **)(*GHIDRA_CAST(flame) + 0x40)) - ((hitParams._tearDamage * 6.0 * this->_meleeDamage) / this->_damage); - manager = g_manager; - pAVar1 = &flame[1]._sprite; - (pAVar1->_filename)._buf[4] = '<'; - (pAVar1->_filename)._buf[5] = '\0'; - (pAVar1->_filename)._buf[6] = '\0'; - (pAVar1->_filename)._buf[7] = '\0'; - netplayManager = &manager->_netplayManager; - pAVar1 = &flame[1]._sprite; - (pAVar1->_filename)._buf[8] = '<'; - (pAVar1->_filename)._buf[9] = '\0'; - (pAVar1->_filename)._buf[10] = '\0'; - (pAVar1->_filename)._buf[0xb] = '\0'; - scaleY = hitParams._tearDamage * g_vectorOne.y; - hitParams._tearDamage = hitParams._tearDamage * g_vectorOne.x; - flame->_entityGridCollisionClass = 0; - (flame->_sprite)._scale.y = scaleY; - (flame->_sprite)._scale.x = hitParams._tearDamage; - if (*netplayManager != *GHIDRA_CAST((manager + 1))) { - isLocalPlayer = - NetplayManager::IsIdxLocalPlayer(GHIDRA_CAST(netplayManager),this->_controllerIndex); - if (isLocalPlayer == 0) { - VStack_ac.y = (flame->_sprite)._color._tint[0]; - fStack_a4 = (flame->_sprite)._color._tint[1]; - fStack_a0 = (flame->_sprite)._color._tint[2]; - fStack_80 = (flame->_sprite)._color._offset[2]; - fStack_98 = (flame->_sprite)._color._colorize[0]; - fStack_94 = (flame->_sprite)._color._colorize[1]; - fStack_90 = (flame->_sprite)._color._colorize[2]; - fStack_8c = (flame->_sprite)._color._colorize[3]; - uStack_88 = *GHIDRA_CAST((flame->_sprite)._color._offset); - if ((g_game == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - unaff_ESI = (float)(g_manager->_optionsConfig)._onlinePlayerOpacity * 0.09 + 0.1; - } - fStack_9c = (flame->_sprite)._color._tint[3] * unaff_ESI; - flame->SetColor(&VStack_ac.y,0xffffffff,0xff,0,1); - } - } - flame->Update(); - return flame; -} - -// 007c9590 -void Entity_Player::DoZitEffect(Vector *direction) -{ - Entity_Player *zitTear = this; - uint32_t rngResult; - float *extraout_EAX; - Entity *spawned; - Entity_Tear *zitTear; - int creepCount; - uint8_t auStack_54 [4]; - float local_50; - float local_4c; - Vector scratchVec; - Vector inheritedVelocity; - uint32_t tearColor; - uint32_t uStack_34; - uint32_t uStack_30; - uint32_t uStack_2c; - uint32_t uStack_28; - uint32_t uStack_24; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t uStack_18; - uint32_t uStack_14; - uint32_t uStack_10; - uint32_t local_c; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_54); - rngResult = Random(); - for (creepCount = rngResult % 3 + 1; creepCount != 0; creepCount = creepCount + -1) { - local_4c = (float)Random(); - rngResult = Random(); - local_50 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10; - scratchVec.x = sqrtf(direction->x * direction->x + direction->y * direction->y); - if (scratchVec.x <= 0.0) { - scratchVec.x = direction->x; - scratchVec.y = direction->y; - } - else { - scratchVec.x = (local_50 * 75.0 + 10.0) / scratchVec.x; - scratchVec.y = scratchVec.x * direction->y; - scratchVec.x = scratchVec.x * direction->x; - } - scratchVec.x = scratchVec.x + (zitTear->_pos).x; - scratchVec.y = scratchVec.y + (zitTear->_pos).y; - Game::SpawnEx(g_game,1000,0x2c,&scratchVec,&g_vectorZero,GHIDRA_CAST(zitTear),0,GHIDRA_UINT(local_4c),0); - } - local_4c = direction->x; - local_50 = direction->y; - GetTearMovementInheritance(zitTear,&inheritedVelocity,direction,0); - scratchVec.x = (local_4c * 10.0 + *extraout_EAX) * zitTear->_shotspeed; - scratchVec.y = (local_50 * 10.0 + extraout_EAX[1]) * zitTear->_shotspeed; - rngResult = Random(); - spawned = Game::SpawnEx(g_game,2,0,&zitTear->_pos,&scratchVec,GHIDRA_CAST(zitTear),0,rngResult,0); - zitTear = (Entity_Tear *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor,0); - uStack_18 = 0x3f333333; - uStack_14 = 0x3f333333; - uStack_10 = 0x3f333333; - uStack_28 = 0; - uStack_24 = 0; - uStack_20 = 0; - uStack_1c = 0; - tearColor = 0x3e99999a; - uStack_34 = 0x3e99999a; - uStack_30 = 0x3e99999a; - uStack_2c = 0x3f800000; - zitTear->SetColor(&tearColor,0xffffffff,0xff,0,1); - zitTear->SetCollisionDamage(zitTear->_damage + zitTear->_damage); - (GHIDRA_CAST((zitTear)))->Entity_Tear::SetTearFlags(g_tearFlagSlow); - zitTear->_baseScale = 0.5; - zitTear->_fScale = 0.5; - (GHIDRA_CAST((zitTear)))->Entity_Tear::ResetSpriteScale(); - zitTear->Update(); - return; -} - -// 007c97f0 -void Entity_Player::apply_victory_lap_penalty(uint32_t param_1) -{ - code *pcVar1; - uint32_t uVar2; - Entity_Player *in_ECX; - uint32_t uVar3; - void *historyItem; - uint32_t *itemsEnd; - float removeFraction; - uint32_t *local_3c; - int shuffleIndex; - uint32_t *local_2c; - uint32_t remaining; - uint32_t swapIndex; - uint32_t i; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t swapTmp; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0008d; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - if (g_game->_victoryLap == 2) { - ExceptionList = &local_10; - if (6 < in_ECX->_maxHearts) { - AddMaxHearts(in_ECX,6 - in_ECX->_maxHearts,0); - } - removeFraction = 0.5; - } - else { - if (g_game->_victoryLap < 3) { - return; - } - ExceptionList = &local_10; - RemoveSkinCostume(in_ECX); - in_ECX->_cacheFlags = in_ECX->_cacheFlags | 0xffff; - in_ECX->_maxHearts = 0; - in_ECX->_redHearts = 0; - in_ECX->_soulHearts = 1; - in_ECX->_blackHearts = 0; - in_ECX->_boneHeartsMask = 0; - in_ECX->_boneHearts = 0; - in_ECX->_eternalHearts = 0; - in_ECX->_playerType = 10; - EvaluateItems(in_ECX); - update_player_skin(in_ECX); - UpdateCanShoot(in_ECX); - if (g_game->_victoryLap < 4) { - ExceptionList = local_10; - return; - } - removeFraction = 0.75; - } - itemsEnd = GHIDRA_CAST(0x0); - local_2c = GHIDRA_CAST(0x0); - local_3c = GHIDRA_CAST(0x0); - local_8 = 0; - historyItem = (in_ECX->_history)._historyItems._begin; - if (historyItem != (in_ECX->_history)._historyItems._end) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(historyItem) + 4)) == '\0') { - if (itemsEnd == GHIDRA_CAST(0x0)) { - msvc::vector::_Emplace_reallocate(0,GHIDRA_CAST((GHIDRA_INT(historyItem) + 8))); - itemsEnd = local_3c; - } - else { - *itemsEnd = *GHIDRA_CAST((GHIDRA_CAST(historyItem) + 8)); - local_3c = itemsEnd + 1; - itemsEnd = local_3c; - } - } - historyItem = (void *)(GHIDRA_INT(historyItem) + 0x1c); - } while (historyItem != (in_ECX->_history)._historyItems._end); - local_2c = itemsEnd; - } - uVar3 = GHIDRA_INT(local_2c) >> 2; - shuffleIndex = uVar3 - 1; - if (0 < shuffleIndex) { - remaining = uVar3; - do { - if (param_1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - param_1 = param_1 >> 4 ^ param_1; - param_1 = param_1 << 5 ^ param_1; - param_1 = param_1 >> 0xf ^ param_1; - if (remaining == 0) { - swapIndex = 0; - } - else { - swapIndex = param_1 % remaining; - } - remaining = remaining - 1; - swapTmp = *GHIDRA_CAST((shuffleIndex * 4)); - *GHIDRA_CAST((shuffleIndex * 4)) = *GHIDRA_CAST((swapIndex * 4)); - shuffleIndex = shuffleIndex + -1; - *GHIDRA_CAST((swapIndex * 4)) = swapTmp; - } while (0 < shuffleIndex); - } - floor((double)((float)((double)GHIDRA_INT((uVar3 + 1)) + - __uint_to_double_fixup[-(GHIDRA_INT((uVar3 + 1)) >> 0x1f)]) * removeFraction)); - uVar2 = __ftoui3(uVar2); - if (uVar2 < uVar3) { - uVar3 = uVar2; - } - i = 0; - if (uVar3 != 0) { - do { - RemoveCollectible(in_ECX,*GHIDRA_CAST((i * 4)),0,0,1); - i = i + 1; - } while (i < uVar3); - } - ExceptionList = local_10; - return; -} - -// 007c9ad0 -float Entity_Player::get_voice_pitch() -{ - uint8_t isHasEffect; - float local_c; - void *pillEffectUses; - - if (this->_variant == 0) { - local_c = 1.0; - } - else { - local_c = 1.5; - } - pillEffectUses = (this->_pillEffectUses)._begin; - local_c = (float)(*GHIDRA_CAST((GHIDRA_CAST(pillEffectUses) + 0x84)) - *GHIDRA_CAST((GHIDRA_CAST(pillEffectUses) + 0x80))) * - 0.1 + local_c; - isHasEffect = HasCollectible(this,0x256,0); - if (isHasEffect == 0) { - isHasEffect = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x2b0); - if (isHasEffect == 0) goto LAB_007c9b57; - } - local_c = local_c + 0.5; -LAB_007c9b57: - isHasEffect = HasCollectible(this,0x1b6,0); - if (isHasEffect != 0) { - local_c = local_c + 0.2; - } - if (((this->_hasCurseMistEffect == 0) && (this->_isCoopGhost == 0)) && - (2 < this->_playerForms[0xb])) { - local_c = local_c - 0.2; - } - if (local_c <= 0.5) { - local_c = 0.5; - } - if (2.0 <= local_c) { - local_c = 2.0; - } - return local_c; -} - -// 007c9bb0 -void Entity_Player::AddJarFlies(int amount) -{ - int clampedFlies; - int totalFlies; - Game *game; - - totalFlies = this->_jarFlies + amount; - clampedFlies = 0x14; - if (totalFlies < 0x14) { - clampedFlies = totalFlies; - } - this->_jarFlies = clampedFlies; - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007c9c00 -uint8_t Entity_Player::IsPosInSpotLight(Vector *position) -{ - float dirX; - float dirX; - float fVar2; - float cosAngle; - float distance; - float distanceSq; - - dirX = position->distanceSq - (this->_pos).distanceSq; - dirX = position->y - (this->_pos).y; - fVar2 = this->_bodyAngle * 0.017453292; - cosAngle = cos(fVar2); - fVar2 = sin(fVar2); - distanceSq = dirX * dirX + dirX * dirX; - distance = sqrtf(distanceSq); - if (0.0 < distance) { - dirX = dirX * (1.0 / distance); - dirX = dirX * (1.0 / distance); - } - if (distanceSq < 40000.0) { - dirX = dirX * cosAngle + fVar2 * dirX; - FUN_00652a70(); - if (dirX * 57.295776 < 20.0) { - return 1; - } - } - return 0; -} - -// 007c9d10 -void Entity_Player::AddGoldenHearts(int amount, uint8_t retBool) -{ - int iVar1; - HUD *playerHud; - int iVar2; - uint32_t hudIndex; - int newGoldenHearts; - Entity_Player *twin; - - iVar1 = this->_playerType; - while ((iVar1 == 0x28 && (twin = GHIDRA_CAST(this->_twinPlayer), twin != GHIDRA_CAST(0x0)) - )) { - retBool = 0; - iVar1 = twin->_playerType; - this = twin; - } - iVar1 = this->_playerType; - if ((((iVar1 == 10) || (iVar1 == 0x1f)) || (iVar1 == 0xe)) || (iVar1 == 0x21)) { - BreakGoldenHearts(this,1); - } - else { - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - ClampHeartsToLimit(this,7,amount * 2); - return; - } - iVar1 = this->_goldenHearts; - iVar2 = this->_redHearts; - if (this->_maxHearts < this->_redHearts) { - iVar2 = this->_maxHearts; - } - newGoldenHearts = amount + iVar1; - iVar2 = (iVar2 + 1) / 2 + (this->_soulHearts + 1) / 2 + this->_boneHearts; - if (iVar2 < newGoldenHearts) { - newGoldenHearts = iVar2; - } - iVar2 = 0; - if (0 < newGoldenHearts) { - iVar2 = newGoldenHearts; - } - this->_goldenHearts = iVar2; - ClampGoldenHearts(this,retBool); - if (iVar1 < this->_goldenHearts) { - playerHud = &g_game->_hud; - hudIndex = 0; - do { - if (*GHIDRA_CAST(playerHud->_playerHUD) == this) { - playerHud->_playerHUD[0xe] = 4; - return; - } - hudIndex = hudIndex + 1; - playerHud = GHIDRA_CAST((playerHud->_playerHUD + 0x6dc)); - } while (hudIndex < 8); - return; - } - } - return; -} - -// 007c9e30 -uint8_t Entity_Player::CanPickGoldenHearts() -{ - int cappedRedHearts; - - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - return this->_maxHearts < 0xa0; - } - while ((this->_playerType == 0x28 && (GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0))) - ) { - this = GHIDRA_CAST(this->_twinPlayer); - } - cappedRedHearts = this->_redHearts; - if (this->_maxHearts < this->_redHearts) { - cappedRedHearts = this->_maxHearts; - } - return this->_goldenHearts < - (cappedRedHearts + 1) / 2 + (this->_soulHearts + 1) / 2 + this->_boneHearts; -} - -// 007c9ea0 -void Entity_Player::UpdateHeartDependentEffects() -{ - uint8_t isOwned; - int iVar1; - int *entitySlot; - int iVar2; - int iVar3; - Game *game; - float redHeartRatio; - char *pcVar4; - int nullEffect [3]; - uint32_t local_c; - void *nullItems; - - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - iVar3 = this->_redHearts; - iVar1 = (iVar3 + 1) / 2; - iVar2 = this->_rottenHearts; - if (iVar1 < this->_rottenHearts) { - iVar2 = iVar1; - } - this->_rottenHearts = iVar2; - if (iVar3 < iVar2 * 2) { - iVar3 = iVar2 * 2; - } - this->_redHearts = iVar3; - } - update_greeds_gullet(this); - game = g_game; - if (((this->_dead == 0) && (this->_playerType == 0x1a)) && - (this->_boneHearts + this->_goldenHearts + this->_soulHearts + this->_eternalHearts + - this->_redHearts == 1)) { - pcVar4 = g_game->_room; - if (((*pcVar4 != '\0') && (1 < g_game->_frameCount - *GHIDRA_CAST((pcVar4 + 0x11f0)))) && - (isOwned = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x6e), isOwned == 0)) { - iVar3 = *GHIDRA_CAST((pcVar4 + 0x1254)); - iVar2 = 0; - if (iVar3 != 0) { - entitySlot = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x124c)); - do { - iVar1 = *entitySlot; - if (((iVar1 != 0) && (*GHIDRA_CAST((iVar1 + 0x28)) == 3)) && - ((*GHIDRA_CAST((iVar1 + 0x410)) == this && - (((*GHIDRA_CAST((iVar1 + 0x2c)) == 0xee && (*GHIDRA_CAST((iVar1 + 0x30)) != 7)) && - (*GHIDRA_CAST((iVar1 + 0x173)) == '\0')))))) { - iVar2 = iVar2 + 1; - } - entitySlot = entitySlot + 1; - iVar3 = iVar3 + -1; - } while (iVar3 != 0); - if (iVar2 != 0) goto LAB_007ca02e; - } - (GHIDRA_CAST((&game->_itemOverlay)))->ItemOverlay::Show(3,3,GHIDRA_CAST(0x0)); - nullItems = (g_manager->_itemConfig)._nullItems._begin; - if ((0x1b8 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItems) & - 0xfffffffcU))) && (iVar3 = *GHIDRA_CAST((GHIDRA_CAST(nullItems) + 0x1b8)), iVar3 != 0)) { - nullEffect[2] = *GHIDRA_CAST((iVar3 + 0x78)); - nullEffect[1] = 0; - local_c = 0; - nullEffect[0] = iVar3; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(nullEffect,1,1); - } - goto LAB_007ca028; - } - } - else { -LAB_007ca028: - game = g_game; - } -LAB_007ca02e: - iVar3 = *GHIDRA_CAST(&game->_deathmatchManager); - iVar2 = (1 < iVar3) + 1; - if (this->_dead == 0) { - if (1 < iVar3) { - iVar2 = iVar2 * 8; - } - if (iVar2 < this->_redHearts) { - if (this->_playerType == 5) { - iVar2 = 0x10; - if (iVar3 < 2) { - iVar2 = 2; - } - if (iVar2 < this->_redHearts) { - isOwned = HasCollectible(this,0x26b,0); - if (isOwned == 0) goto LAB_007ca100; - game = g_game; - } - if ((*GHIDRA_CAST(game->_room) != '\0') && - (1 < game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x11f0)))) goto LAB_007ca0b0; - } - } - else { -LAB_007ca0b0: - isOwned = HasCollectible(this,0x7a,0); - if ((isOwned != 0) && - (isOwned = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x7a), - isOwned == 0)) { - if (this->_postLevelInitFinished != 0) { - (GHIDRA_CAST((&g_game->_itemOverlay)))->ItemOverlay::Show(3,3,GHIDRA_CAST(0x0)); - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x7a,1,1); - } - } - } -LAB_007ca100: - isOwned = HasCollectible(this,0x19f,0); - if (isOwned != 0) { - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - if (((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13b5))) != '\0') || (isOwned = HasFullHearts(this), isOwned == 0)) - goto LAB_007ca198; -LAB_007ca169: - isOwned = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x19f); - if (isOwned != 0) goto LAB_007ca1c8; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x19f,1,1); - pcVar4 = "FloatGlow"; - } - else { - if (0.8 <= (float)this->_redHearts / (float)this->_maxHearts) goto LAB_007ca169; -LAB_007ca198: - isOwned = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x19f); - if (isOwned == 0) goto LAB_007ca1c8; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x19f,1); - pcVar4 = "FloatNoGlow"; - } - ANM2::Play(&this->_crownOfLightSprite,GHIDRA_CAST(pcVar4),0); - } -LAB_007ca1c8: - isOwned = HasCollectible(this,0x1ba,0); - if (isOwned == 0) goto LAB_007ca260; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - if (this->_redHearts == 2) goto LAB_007ca2a6; -LAB_007ca230: - isOwned = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba); - if (isOwned == 0) goto LAB_007ca260; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x1ba,1); - pcVar4 = "FloatNoGlow"; - } - else { - redHeartRatio = (float)this->_redHearts / (float)this->_maxHearts; - if ((redHeartRatio < 0.1) || (0.3 < redHeartRatio)) goto LAB_007ca230; -LAB_007ca2a6: - isOwned = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ba); - if (isOwned != 0) goto LAB_007ca260; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1ba,1,1); - pcVar4 = "FloatGlow"; - } - ANM2::Play(&this->_darkPrincesCrownSprite,GHIDRA_CAST(pcVar4),0); -LAB_007ca260: - isOwned = HasCollectible(this,0x1ed,0); - if ((isOwned != 0) || - (isOwned = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x1ed), isOwned != 0 - )) { - this->_cacheFlags = this->_cacheFlags | 1; - EvaluateItems(this); - } - return; -} - -// 007ca2d0 -void Entity_Player::BreakGoldenHearts(int count) -{ - Vector *position; - uint64_t qVar1; - ANM2 *pAVar2; - uint8_t bVar3; - uint32_t uVar4; - Entity *effect; - uint8_t *curAnimName; - char *pcVar5; - Entity_Player *self; - uint8_t *size; - int *piVar6; - uint64_t *allocCounter; - bool isLess; - EntityList_EL nearbyEnemies; - Vector coinPos; - Vector randomVelocity; - Vector coinVelocity; - Entity *local_5c; - Entity_Player *player; - ANM2 *local_54; - uint8_t local_50 [8]; - float fStack_48; - float fStack_44; - float local_40; - char *pcStack_3c; - float fStack_38; - float fStack_34; - float local_30; - float local_2c; - uint8_t *local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint8_t *animData; - Entity_Player *enemy; - Manager *manager; - int vtable; - - manager = g_manager; - puStack_20 = local_50 + 0x4c; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b000d5; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_50 + 0x40)); - if (count < 1) { - return; - } - local_54 = GHIDRA_CAST(0x1ab); - ExceptionList = &local_1c; - player = this; - seed_fart_sound_override(GHIDRA_CAST(&local_54)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_54),1.0,2,0,1.0,0.0); - uVar4 = Random(); - effect = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - local_2c = 0.0; - local_28 = &DAT_0000000f; - pcStack_3c = GHIDRA_CAST(0x0); - local_5c = effect; - local_54 = &effect->_sprite; - pcStack_3c = msvc::_Allocate(0x30); - local_2c = 4.48416e-44; - local_28 = &DAT_0000002f; - builtin_strncpy(pcStack_3c,"gfx/293.000_UltraGreedCoins.anm2",0x21); - local_14 = 0; - ANM2::Load(&effect->_sprite,GHIDRA_CAST(&pcStack_3c),1); - local_14 = 0xffffffff; - if (&DAT_0000000f < local_28) { - size = local_28 + 1; - pcVar5 = pcStack_3c; - if (GHIDRA_CAST(0xfff) < size) { - pcVar5 = *GHIDRA_CAST((pcStack_3c + -4)); - size = local_28 + 0x24; - if (GHIDRA_CAST(0x1f) < pcStack_3c + (-4 - GHIDRA_INT(pcVar5))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar5,GHIDRA_UINT(size)); - } - pAVar2 = local_54; - animData = (effect->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - pcVar5 = "CrumbleNoDebris"; - do { - bVar3 = *curAnimName; - isLess = bVar3 < (uint8_t)*pcVar5; - if (bVar3 != *pcVar5) { -LAB_007ca463: - uVar4 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007ca468; - } - if (bVar3 == 0) break; - bVar3 = curAnimName[1]; - isLess = bVar3 < (uint8_t)pcVar5[1]; - if (bVar3 != pcVar5[1]) goto LAB_007ca463; - curAnimName = curAnimName + 2; - pcVar5 = pcVar5 + 2; - } while (bVar3 != 0); - uVar4 = 0; -LAB_007ca468: - if ((uVar4 == 0) && ((animData[0x34] == 0 || ((local_54->_animState)._isPlaying != 0)))) - goto LAB_007ca49c; - } - bVar3 = ANM2::SetAnimation(local_54,GHIDRA_CAST("CrumbleNoDebris"),1); - if (bVar3 != 0) { - AnimationState::Rewind(&pAVar2->_animState); - (pAVar2->_animState)._isPlaying = 1; - } -LAB_007ca49c: - local_5c->Update(); - uVar4 = Random(); - position = &this->_pos; - effect = Game::Spawn(g_game,1000,0x12,position,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - vtable = *GHIDRA_CAST(effect); - (effect->_sprite)._color._colorize[0] = 10.0; - (effect->_sprite)._color._colorize[1] = 7.5; - (effect->_sprite)._color._colorize[2] = 0.0; - (effect->_sprite)._color._colorize[3] = 1.0; - (**(code **)(vtable + 0xc))(); - pAVar2 = local_54; - do { - local_54 = pAVar2; - local_5c = GHIDRA_CAST((this->_posOffset).y); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 1.0; - fStack_48 = 1.0; - fStack_44 = 1.0; - local_30 = 0.0; - local_2c = 0.0; - local_40 = 0.0; - pcStack_3c = GHIDRA_CAST(0x0); - fStack_38 = 0.0; - fStack_34 = 0.0; - local_28 = GHIDRA_CAST(0x0); - uVar4 = Random(); - Game::SpawnParticles - (g_game,position,0x5f,10, - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 12.0 + 8.0,GHIDRA_CAST(local_50),(float)local_5c,0); - uVar4 = Random(); - piVar6 = GHIDRA_CAST((uVar4 % 6)); - while (local_54 = GHIDRA_CAST((GHIDRA_INT(piVar6) + 3)), local_54 != GHIDRA_CAST(0x0)) { - Isaac::GetRandomPickupVelocity(&randomVelocity,position,0,GHIDRA_CAST(0x0)); - uVar4 = Random(); - coinVelocity.y = - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 0.66 + 0.33; - coinVelocity.x = randomVelocity.x * coinVelocity.y; - coinVelocity.y = randomVelocity.y * coinVelocity.y; - uVar4 = Random(); - coinPos.x = coinVelocity.x + position->x; - coinPos.y = coinVelocity.y + (this->_pos).y; - Game::Spawn(g_game,5,0x14,&coinPos,&coinVelocity,GHIDRA_CAST(this),0,uVar4); - piVar6 = &local_54[-1]._bitflags; - } - count = count + -1; - pAVar2 = GHIDRA_CAST(0x0); - } while (count != 0); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&nearbyEnemies,position,80.0,8); - uVar4 = 0; - local_14 = 1; - if (nearbyEnemies._size != 0) { - self = player; - do { - enemy = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + uVar4 * 4)); - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (enemy->_type == 1)) || - (enemy->_type - 10U < 0x3de)) && (enemy != self)) { - enemy->_bossStatusEffectCooldown = 0; - (GHIDRA_CAST((GHIDRA_CAST(enemy))))->Entity::CopyStatusEffects(); - (GHIDRA_CAST((GHIDRA_CAST((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST(player)); - (GHIDRA_CAST((GHIDRA_CAST(enemy))))->Entity::AddMidasFreeze(GHIDRA_CAST((local_50 + 4)),0xb4,0); - if ((enemy->_flags & 0x400) != 0) { - local_30 = 1.0; - local_40 = 0.0; - pcStack_3c = GHIDRA_CAST(0x0); - fStack_38 = 0.0; - fStack_34 = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 1.0; - fStack_48 = 1.0; - fStack_44 = 1.0; - local_2c = 0.9; - local_28 = GHIDRA_CAST(0x0); - enemy->SetColor(local_50,0xf,0xff,1,1); - } - self = player; - } - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT(nearbyEnemies._size)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) != 0) { - uVar4 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + -4)); - qVar1 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar4)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x4))) + -4)); - } - } - ExceptionList = local_1c; - return; -} - -// 007ca7c0 -void Entity_Player::ClampGoldenHearts(uint8_t isSkipBreak) -{ - int goldenHearts; - int goldenHearts; - - if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && (this->_dead == 0)) && - (goldenHearts = this->_goldenHearts, 0 < goldenHearts)) { - goldenHearts = this->_redHearts; - if (this->_maxHearts < this->_redHearts) { - goldenHearts = this->_maxHearts; - } - goldenHearts = (goldenHearts + 1) / 2 + (this->_soulHearts + 1) / 2 + this->_boneHearts; - if (goldenHearts < goldenHearts) { - if (isSkipBreak == 0) { - BreakGoldenHearts(this,goldenHearts - goldenHearts); - } - this->_goldenHearts = goldenHearts; - } - } - return; -} - -// 007ca840 -void Entity_Player::AddBoneHearts(int amount) -{ - int iVar1; - Entity_Player *this_00; - int iVar2; - uint32_t boneHeartMask; - int extraout_EDX; - uint32_t heartBit; - - while( true ) { - while ((this->_playerType == 0x28 && - (GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0)))) { - this = GHIDRA_CAST(this->_twinPlayer); - } - iVar1 = GetHealthType(this); - if (iVar1 == 2) { - return; - } - iVar1 = GetHealthType(this_00); - if (iVar1 == 3) { - if (amount < 1) { - return; - } - AddBlueFlies(this,amount * 4,&this->_pos,GHIDRA_CAST(0x0)); - return; - } - if (extraout_EDX != 0x11) break; - this = GHIDRA_CAST(this->_subPlayer); - if (this == GHIDRA_CAST(0x0)) { - return; - } - } - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - ClampHeartsToLimit(this,0xb,amount * 2); - UpdateHeartDependentEffects(this); - return; - } - if (amount < 0) { - iVar1 = GetHealthType(this); - if (iVar1 == 4) { - trigger_max_hearts_removed(this,amount * -2); - } - iVar2 = this->_boneHearts + amount; - iVar1 = 0; - if (0 < iVar2) { - iVar1 = iVar2; - } - this->_boneHearts = iVar1; - iVar2 = GetEffectiveMaxHearts(this); - iVar1 = this->_redHearts; - if (iVar2 < this->_redHearts) { - iVar1 = iVar2; - } - this->_redHearts = iVar1; - update_bone_hearts(this); - UpdateHeartDependentEffects(this); - return; - } - iVar1 = this->_soulHearts; - iVar2 = GetHeartLimit(this,0); - iVar2 = (iVar1 + (this->_boneHearts + amount) * 2 + this->_maxHearts) - iVar2; - if (iVar2 < iVar1) { - iVar1 = iVar2; - } - if (0 < iVar1) { - AddSoulHearts(this,-iVar1,0); - } - iVar1 = GetHeartLimit(this,0); - iVar1 = iVar1 / 2 - (this->_maxHearts + 1 + this->_soulHearts + this->_boneHearts * 2 >> 1); - if (iVar1 < amount) { - amount = iVar1; - } - if (amount < 1) { - return; - } - iVar1 = this->_boneHearts; - boneHeartMask = this->_boneHeartsMask; - this->_boneHearts = iVar1 + amount; - iVar2 = 0; - do { - heartBit = iVar2 + (this->_soulHearts + 1 >> 1) + iVar1; - iVar2 = iVar2 + 1; - boneHeartMask = boneHeartMask | 1 << (heartBit & 0x1f); - } while (iVar2 < amount); - this->_boneHeartsMask = boneHeartMask; - UpdateHeartDependentEffects(this); - return; -} - -// 007caa00 -uint8_t Entity_Player::CanPickBoneHearts() -{ - int heartLimit; - Entity_Player *this_00; - int extraout_EDX; - - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - return this->_maxHearts < 0xa0; - } - while( true ) { - while (this->_playerType != 0x28) { - if ((this->_playerType != 0x11) || (GHIDRA_CAST(this->_subPlayer) == GHIDRA_CAST(0x0)) - ) goto LAB_007caa4c; - this = GHIDRA_CAST(this->_subPlayer); - } - if (GHIDRA_CAST(this->_twinPlayer) == GHIDRA_CAST(0x0)) break; - this = GHIDRA_CAST(this->_twinPlayer); - } -LAB_007caa4c: - heartLimit = GetHealthType(this); - if (((heartLimit == 2) || (extraout_EDX == 0x11)) || - (heartLimit = GetHeartLimit(this_00,0), - heartLimit / 2 <= this->_maxHearts + this->_boneHearts * 2 >> 1)) { - return 0; - } - return 1; -} - -// 007caaa0 -uint8_t Entity_Player::IsBoneHeart(int heart) -{ - if ((this->_boneHearts < 1) || ((this->_boneHeartsMask & 1 << ((uint8_t)heart & 0x1f)) == 0)) { - return 0; - } - return 1; -} - -// 007caad0 -uint8_t Entity_Player::TryPreventDeath() -{ - int iVar1; - Entity_Player *this_00; - uint8_t unk; - uint8_t unk2; - - if (this->_boneHearts + this->_redHearts + this->_soulHearts != 0) { - return 0; - } - iVar1 = GetHealthType(this); - switch(iVar1) { - case 0: - if (this->_playerType == 0x12) { - if (this->_maxHearts < 2) { - AddMaxHearts(this_00,2,0); - } - AddHearts(this,1,1,0); - return 1; - } - if (0 < this->_maxHearts) { - unk2 = 0; - unk = 1; - iVar1 = scale_for_hard_difficulty(1); - AddHearts(this,iVar1,unk,unk2); - return 1; - } - break; - case 3: - if (this->_maxHearts < 2) { - AddMaxHearts(this_00,2,0); - } - AddHearts(this,2,1,0); - return 1; - case 4: - AddBoneHearts(this_00,1); - return 1; - } - this->_soulHearts = 1; - return 1; -} - -// 007cabc0 -void Entity_Player::update_bone_hearts() -{ - int iVar1; - int iVar2; - uint32_t uVar3; - uint32_t bit; - uint32_t uVar4; - uint8_t topShift; - - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - iVar1 = GetHeartLimit(this,0); - iVar2 = iVar1 / 2 - (this->_maxHearts + 1 + this->_soulHearts >> 1); - iVar1 = this->_boneHearts; - if (iVar2 < this->_boneHearts) { - iVar1 = iVar2; - } - this->_boneHearts = iVar1; - if (iVar1 < 1) { - this->_boneHearts = 0; - this->_boneHeartsMask = 0; - return; - } - iVar2 = (this->_soulHearts + 1) / 2 + iVar1; - this->_boneHeartsMask = this->_boneHeartsMask & 0xffffffffU >> (0x20U - (char)iVar2 & 0x1f); - uVar4 = 0; - uVar3 = this->_boneHeartsMask; - if (0 < iVar2) { - bit = 1; - do { - if (((bit & uVar3) != 0) && (iVar1 = iVar1 + -1, iVar1 < 0)) { - uVar3 = uVar3 & ~(1 << (uVar4 & 0x1f)); - } - uVar4 = uVar4 + 1; - bit = bit << 1 | GHIDRA_UINT((GHIDRA_INT(bit) < 0)); - } while (GHIDRA_INT(uVar4) < iVar2); - this->_boneHeartsMask = uVar3; - } - uVar3 = iVar2 - 1; - if (-1 < GHIDRA_INT(uVar3)) { - topShift = (uint8_t)uVar3 & 0x1f; - uVar4 = 1 << topShift | 1U >> 0x20 - topShift; - do { - if (iVar1 < 1) { - return; - } - if ((uVar4 & this->_boneHeartsMask) == 0) { - iVar1 = iVar1 + -1; - this->_boneHeartsMask = this->_boneHeartsMask | 1 << (uVar3 & 0x1f); - } - uVar4 = uVar4 >> 1 | GHIDRA_UINT(((uVar4 & 1) != 0)) << 0x1f; - uVar3 = uVar3 - 1; - } while (-1 < GHIDRA_INT(uVar3)); - } - } - return; -} - -// 007cacb0 -void Entity_Player::ClampHeartsToLimit(int heartType, int amount) -{ - int addedHearts; - int blackHearts; - int trimmed; - int addedHearts; - int totalHearts; - int soulHearts; - int blackHearts; - - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - return; - } - addedHearts = amount * 8; - blackHearts = GetHeartLimit(this,0); - soulHearts = this->_soulHearts; - blackHearts = this->_blackHearts; - addedHearts = this->_rottenHearts; - totalHearts = this->_maxHearts + soulHearts + blackHearts + this->_goldenHearts + - this->_boneHearts + addedHearts + addedHearts; - if ((blackHearts < totalHearts) && (0 < soulHearts)) { - trimmed = totalHearts - blackHearts; - if (soulHearts < totalHearts - blackHearts) { - trimmed = soulHearts; - } - soulHearts = soulHearts - trimmed; - totalHearts = totalHearts - trimmed; - this->_soulHearts = soulHearts; - } - amount = this->_goldenHearts; - if (blackHearts < totalHearts) { - if (0 < amount) { - trimmed = totalHearts - blackHearts; - if (amount < totalHearts - blackHearts) { - trimmed = amount; - } - amount = amount - trimmed; - totalHearts = totalHearts - trimmed; - this->_goldenHearts = amount; - if (totalHearts <= blackHearts) goto LAB_007cadbc; - } - if (0 < addedHearts) { - trimmed = totalHearts - blackHearts; - if (addedHearts < totalHearts - blackHearts) { - trimmed = addedHearts; - } - totalHearts = totalHearts - trimmed; - this->_rottenHearts = addedHearts - trimmed; - } - if (blackHearts < totalHearts) { - addedHearts = this->_boneHearts; - if (0 < addedHearts) { - trimmed = totalHearts - blackHearts; - if (addedHearts < totalHearts - blackHearts) { - trimmed = addedHearts; - } - totalHearts = totalHearts - trimmed; - this->_boneHearts = addedHearts - trimmed; - if (totalHearts <= blackHearts) goto LAB_007cadbc; - } - if (0 < blackHearts) { - addedHearts = totalHearts - blackHearts; - if (blackHearts < totalHearts - blackHearts) { - addedHearts = blackHearts; - } - totalHearts = totalHearts - addedHearts; - this->_blackHearts = blackHearts - addedHearts; - } - } - } -LAB_007cadbc: - blackHearts = (addedHearts - totalHearts) + blackHearts; - if (addedHearts < blackHearts) { - blackHearts = addedHearts; - } - if (blackHearts < 0) { - blackHearts = 0; - } - switch(heartType) { - case 3: - this->_soulHearts = soulHearts + blackHearts; - return; - case 6: - this->_blackHearts = this->_blackHearts + blackHearts; - break; - case 7: - this->_goldenHearts = blackHearts + amount; - return; - case 0xb: - this->_boneHearts = this->_boneHearts + blackHearts; - return; - case 0xc: - this->_rottenHearts = this->_rottenHearts + blackHearts; - return; - } - return; -} - -// 007cae60 -int Entity_Player::GetHeartLimit(uint8_t isKeeperBypass) -{ - uint8_t bVar1; - int iVar2; - int gulletHearts; - int gulletHearts; - - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - return 0xa0; - } - if (this->_variant == 0) { - iVar2 = this->_playerType; - if ((iVar2 == 0x10) && - (bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x78), bVar1 != 0)) { - return 6; - } - if ((iVar2 == 0x14) && - (bVar1 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x79), bVar1 != 0)) { - return 4; - } -LAB_007caedc: - iVar2 = this->_playerType; - if ((iVar2 != 0x10) && (iVar2 != 0x11)) { - gulletHearts = 0x18; - goto LAB_007caefe; - } - } - else if (this->_variant != 1) goto LAB_007caedc; - iVar2 = this->_playerType; - gulletHearts = 0xc; -LAB_007caefe: - if ((iVar2 == 1) && (bVar1 = HasCollectible(this,0x26b,0), bVar1 != 0)) { - gulletHearts = gulletHearts + 0xc; - } - iVar2 = this->_playerType; - if ((iVar2 == 0xe) || (iVar2 == 0x21)) { - if (isKeeperBypass != 0) { - return gulletHearts; - } - gulletHearts = GetGreedsGulletHearts(this); - iVar2 = GHIDRA_UINT((iVar2 != 0x21)) * 2 + 4 + gulletHearts * 2; - gulletHearts = 0x18; - if (iVar2 < 0x18) { - gulletHearts = iVar2; - } - if ((this->_playerType == 0xe) && (bVar1 = HasCollectible(this,0x26b,0), bVar1 != 0)) { - gulletHearts = gulletHearts + 2; - } - bVar1 = HasCollectible(this,0x1f5,0); - if (bVar1 != 0) { - iVar2 = this->_numCoins / 0x19; - gulletHearts = iVar2 + 1; - if (this->_numCoins != 99) { - gulletHearts = iVar2; - } - gulletHearts = gulletHearts + gulletHearts * 2; - } - } - else if (isKeeperBypass != 0) { - return gulletHearts; - } - gulletHearts = gulletHearts + this->_brokenHearts * -2; - iVar2 = 0; - if (0 < gulletHearts) { - iVar2 = gulletHearts; - } - return iVar2; -} - -// 007cafe0 -int Entity_Player::GetHealthType() -{ - switch(this->_playerType) { - case 4: - case 0xc: - case 0x11: - case 0x18: - case 0x19: - case 0x23: - case 0x24: - return 1; - default: - return 0; - case 10: - case 0x1f: - case 0x28: - return 2; - case 0xe: - case 0x21: - return 3; - case 0x10: - return 4; - } -} - -// 007cb060 -int Entity_Player::GetEffectiveMaxHearts() -{ - int healthType; - int extraout_EDX; - - healthType = GetHealthType(this); - if ((healthType == 1) || (healthType == 2)) { - return *GHIDRA_CAST((extraout_EDX + 0x1340)); - } - return *GHIDRA_CAST((extraout_EDX + 0x1340)) + *GHIDRA_CAST((extraout_EDX + 0x1d88)) * 2; -} - -// 007cb090 -void Entity_Player::apply_coop_baby_spawn_bonus() -{ - ANM2 *pAVar1; - Entity_Player *linkedPlayer; - uint32_t seed; - Entity *pEVar2; - Entity_Player *local_8; - uint32_t *targetSlot; - int vtable; - - local_8 = this; - switch(this->_babySkin) { - case 0x1b: - AddBlackHearts(this,2); - return; - case 0x1c: - AddMaxHearts(this,2,0); - AddHearts(this,2,0,0); - return; - case 0x1d: - linkedPlayer = GetMainPlayer(this); - AddEternalHearts(linkedPlayer,1); - return; - case 0x1e: - AddSoulHearts(this,2,0); - return; - case 0x2a: - linkedPlayer = GetMainPlayer(this); - SetFullHearts(linkedPlayer); - return; - case 0x3a: - linkedPlayer = GetMainPlayer(this); - seed = Random(); - pEVar2 = Game::Spawn(g_game,1000,0x72,&linkedPlayer->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed); - if (pEVar2->_child != 0) { - local_8 = GHIDRA_CAST(&pEVar2->_child); - msvc::multiset::erase(&local_8); - } - pEVar2->_child = linkedPlayer; - if (linkedPlayer != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&pEVar2->_child); - } - targetSlot = &pEVar2->_target; - if (pEVar2->_target != 0) { - local_8 = GHIDRA_CAST(targetSlot); - msvc::multiset::erase(&local_8); - } - *targetSlot = this; - msvc::multiset::insert(targetSlot); - vtable = *GHIDRA_CAST(pEVar2); - pAVar1 = &pEVar2[1]._sprite; - (pAVar1->_animDefaultName)._buf[8] = '\0'; - (pAVar1->_animDefaultName)._buf[9] = '\0'; - (pAVar1->_animDefaultName)._buf[10] = -0x10; - (pAVar1->_animDefaultName)._buf[0xb] = 'B'; - (**(code **)(vtable + 0xc))(); - return; - case 0x3b: - AddMaxHearts(this,-this->_maxHearts,0); - this->_soulHearts = 1; - } - return; -} - -// 007cb580 -uint8_t Entity_Player::IsFullSpriteRendering() -{ - uint8_t isHeldItemVisible; - - isHeldItemVisible = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271); - if ((isHeldItemVisible != 0) || - ((this->_isPlayingExtraAnimation == 0 && (this->_isPlayingItemAnimation == 0)))) { - return 0; - } - isHeldItemVisible = IsHoldingItem(this); - if ((isHeldItemVisible == 0) || - (isHeldItemVisible = IsHeldItemVisible(this), isHeldItemVisible != 0)) { - return 1; - } - return 0; -} - -// 007cb6e0 -int Entity_Player::GetTrinketMultiplier(uint32_t type) -{ - void *pvVar1; - uint8_t isHasCollectible; - char cVar2; - Entity_Player *parentPlayer; - uint32_t uVar3; - int iVar4; - RoomDescriptor *roomDesc; - int *trinketSlot; - uint32_t trinketId; - int multiplier; - Entity_Player *player; - int trinketSlotsLeft; - RNG roomRng; - uint32_t local_8; - - local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - player = this; - if (this->_variant == 1) { - do { - parentPlayer = GHIDRA_CAST(this->_parent); - if (((parentPlayer == GHIDRA_CAST(0x0)) || (parentPlayer->_type != 1)) && - ((player = this, this->_variant != 1 || - (parentPlayer = Game::GetPlayer(g_game,0), parentPlayer == GHIDRA_CAST(0x0))))) break; - this = parentPlayer; - player = parentPlayer; - } while (parentPlayer->_variant == 1); - } - multiplier = 0; - if ((type == 0x56) && (player->_playerType == 4)) { - multiplier = 1; - } - if (player->_hasCurseMistEffect != 0) { - return multiplier; - } - if (player->_isCoopGhost != 0) { - return multiplier; - } - trinketId = type & 0x7fff; - if ((g_game->_dailyChallenge)._specialDailyId == 0x1c) { - uVar3 = 0; - do { - if (trinketId == *GHIDRA_CAST((GHIDRA_INT(&DAT_00b6bad0) + uVar3))) { - multiplier = multiplier + 1; - break; - } - uVar3 = uVar3 + 4; - } while (uVar3 < 0x28); - } - if (((trinketId != 0x15) && (trinketId != 0x40)) && (trinketId != 0x4b)) { - iVar4 = GetTrinketMultiplier(player,0x15); - if (0 < iVar4) { - uVar3 = g_game->_frameCount & 0x80000003; - if (GHIDRA_INT(uVar3) < 0) { - uVar3 = (uVar3 - 1 | 0xfffffffc) + 1; - } - if ((trinketId == 0x30) && ((uVar3 == 2 || ((1 < iVar4 && (uVar3 == 3)))))) { - return iVar4 + multiplier; - } - } - iVar4 = GetTrinketMultiplier(player,0x40); - if ((0 < iVar4) && (trinketId == (&DAT_00b6bad0)[GHIDRA_UINT((g_game->_frameCount / 0x5a)) % 10])) { - multiplier = multiplier + iVar4; - } - iVar4 = GetTrinketMultiplier(player,0x4b); - if (0 < iVar4) { - if ((trinketId == 0x7a) && (g_game->_challenge == 0x29)) goto LAB_007cb8d8; - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,-1); - if (roomDesc->SpawnSeed != 0) { - roomRng._shift1 = 2; - roomRng._shift2 = 7; - roomRng._shift3 = 0x19; - roomRng._seed = roomDesc->SpawnSeed; - uVar3 = (GHIDRA_CAST((&roomRng)))->RNG::RandomInt(0xbd); - if (trinketId == uVar3 + 1) { - multiplier = multiplier + iVar4; - } - } - } - if (trinketId == 0x17) { - iVar4 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::GetTrinketEffectNum(0x17); - multiplier = multiplier + iVar4; - } - else { - if (trinketId == 0x18) { - iVar4 = player->_coopBabyBuffTimers[7]; - } - else { - if (trinketId != 0x13) goto LAB_007cb8d8; - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x18e0)))); - } - if (0 < iVar4) { - multiplier = multiplier + 1; - } - } - } -LAB_007cb8d8: - trinketSlotsLeft = 1; - isHasCollectible = HasCollectible(player,0x8b,0); - if ((isHasCollectible != 0) || - (isHasCollectible = HasCollectible(player,0x1ca,0), isHasCollectible != 0)) { - trinketSlotsLeft = 2; - } - trinketSlot = player->_trinketsID; - do { - iVar4 = multiplier; - if (((*trinketSlot & 0x7fffU) == trinketId) && - (iVar4 = multiplier + 1, (*trinketSlot & 0x8000U) != 0)) { - iVar4 = multiplier + 2; - } - trinketSlot = trinketSlot + 1; - trinketSlotsLeft = trinketSlotsLeft + -1; - multiplier = iVar4; - } while (trinketSlotsLeft != 0); - trinketSlot = (player->_queuedItem)._item; - if (((((trinketSlot != GHIDRA_CAST(0x0)) && (*trinketSlot == 2)) && (trinketSlot[1] == trinketId)) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) == 0 || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) == trinketId)))) && - (multiplier = iVar4 + 1, ((player->_queuedItem)._flags & 2) != 0)) { - multiplier = iVar4 + 2; - } - pvVar1 = (player->_smeltedTrinkets)._begin; - if (trinketId < GHIDRA_UINT((GHIDRA_INT((player->_smeltedTrinkets)._end) - GHIDRA_INT(pvVar1) >> 2))) { - multiplier = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + trinketId * 4)) + multiplier + - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + trinketId * 4 + 2)) * 2; - } - pvVar1 = (player->_extraTrinketCounts)._begin; - if (GHIDRA_INT(trinketId) < GHIDRA_INT((player->_extraTrinketCounts)._end) - GHIDRA_INT(pvVar1)) { - cVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + trinketId)); - } - else { - cVar2 = '\0'; - } - uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))); - iVar4 = multiplier + 1; - if (cVar2 == '\0') { - iVar4 = multiplier; - } - if ((uVar3 != 0) && ((uVar3 & 0x7fff) == trinketId)) { - if ((*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef0))) == '\0') { - multiplier = 0; - if (0 < iVar4 + -1) { - multiplier = iVar4 + -1; - } - iVar4 = multiplier; - if ((uVar3 & 0x8000) != 0) { - iVar4 = 0; - if (0 < multiplier + -1) { - iVar4 = multiplier + -1; - } - } - } - else { - iVar4 = ((uVar3 & 0x8000) != 0) + 1 + iVar4; - } - } - if ((0 < iVar4) && (isHasCollectible = HasCollectible(player,0x1b7,0), isHasCollectible != 0)) { - iVar4 = iVar4 + 1; - } - return iVar4; -} - -// 007cba30 -void Entity_Player::UpdateCanShoot() -{ - uint8_t isCanShoot; - char isDeathmatchAllowed; - ChallengeParam *challengeParams; - void *playerConfig; - Game *game; - Game *pGVar1; - uint8_t isChallengeCanShoot; - int variant; - - game = g_game; - variant = this->_variant; - this->_canShoot = 1; - pGVar1 = g_game; - if (variant == 0) { - challengeParams = Game::GetChallengeParams(game); - if (challengeParams->_canShoot != 0) goto LAB_007cba8b; - this->_canShoot = 0; - isChallengeCanShoot = 0; - } - else { - if ((variant == 1) && (this->_babySkin == 0x1a)) { - isCanShoot = 0; - this->_canShoot = 0; - goto LAB_007cbb1a; - } -LAB_007cba8b: - isCanShoot = 1; - isChallengeCanShoot = 1; - pGVar1 = game; - if (variant != 0) goto LAB_007cbb1a; - } - if (this->_playerType < 0) { -LAB_007cbaf2: - playerConfig = (void *)0x0; -LAB_007cbaf4: - KAGE_LogMessage(0x10,GHIDRA_CAST("Could not load config for player type %d\n")); - isChallengeCanShoot = this->_canShoot; - game = g_game; - } - else { - playerConfig = (g_manager->_entityConfig)._players._begin; - if ((GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(playerConfig)) / 0x148 <= - this->_playerType) goto LAB_007cbaf2; - playerConfig = (void *)(this->_playerType * 0x148 + GHIDRA_INT(playerConfig)); - if (playerConfig == (void *)0x0) goto LAB_007cbaf4; - } - if ((isChallengeCanShoot == 0) || (*GHIDRA_CAST((GHIDRA_CAST(playerConfig) + 0xd0)) == '\0')) { - isCanShoot = 0; - } - else { - isCanShoot = 1; - } - this->_canShoot = isCanShoot; - pGVar1 = game; -LAB_007cbb1a: - if (1 < *GHIDRA_CAST(&pGVar1->_deathmatchManager)) { - if (isCanShoot != 0) { - isDeathmatchAllowed = - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((pGVar1->_deathmatchManager))) + 0xc)))) + 0x48))(this); - if (isDeathmatchAllowed != '\0') { - this->_canShoot = 1; - return; - } - } - this->_canShoot = 0; - } - return; -} - -// 007cbb60 -uint8_t Entity_Player::WillPlayerRevive() -{ - uint8_t isReviving; - - isReviving = TriggerDeath(this,1); - return isReviving; -} - -// 007cbb70 -float Entity_Player::GetGreedDonationBreakChance() -{ - float jamChance; - - jamChance = GetGreedDonationJamChance(this,GHIDRA_CAST(0x0)); - return jamChance; -} - -// 007cbb90 -float Entity_Player::GetGreedDonationJamChance(PersistentGameData *data) -{ - int iVar1; - float chance; - double dVar2; - float cappedChance; - - if (0x28 < this->_playerType) { - return 99.9; - } - if (data == GHIDRA_CAST(0x0)) { - data = &g_manager->_persistentGameData; - } - iVar1 = this->_playerType * 0x90; - if (iVar1 == -0xc35ed0) { - iVar1 = 0; - } - else { - iVar1 = *GHIDRA_CAST((&DAT_00c35f10 + iVar1)); - } - chance = (float)((double)data->_eventCounters[iVar1] + - __uint_to_double_fixup[-(data->_eventCounters[iVar1] >> 0x1f)]) * 0.023; - FUN_007df1e0(this); - chance = chance - 1.0; - if (100.0 <= chance) { - chance = 100.0; - } - dVar2 = floor((double)(chance * 0.2 + 0.5)); - chance = (float)dVar2; - if (g_game->_difficulty == 3) { - cappedChance = 1.0; - if (chance <= 1.0) { - cappedChance = chance; - } - chance = cappedChance; - } - return chance; -} - -// 007cbc60 -void Entity_Player::hallowed_ground_add(int count) -{ - int oldCountdown; - int oldCountdown; - - oldCountdown = this->_hallowedGroundCountdown; - oldCountdown = count + oldCountdown; - if (4 < oldCountdown) { - oldCountdown = 4; - } - this->_hallowedGroundCountdown = oldCountdown; - if (0 < oldCountdown != 0 < oldCountdown) { - this->_cacheFlags = this->_cacheFlags | 99; - EvaluateItems(this); - } - return; -} - -// 007cbcb0 -void Entity_Player::resolve_tainted_soul() -{ - return; -} - -// 007cbcd0 -void Entity_Player::init_forgotten_twin() -{ - uint8_t isNullEffectActive; - uint32_t seed; - uint32_t extraout_EAX; - int *extraout_EAX_00; - int *subPlayer; - code *extraout_EDX; - Vector darkEsauPos; - Vector local_48; - Color poofColor; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - int *local_8; - Entity *darkEsau; - - local_8 = GHIDRA_CAST(0xffffffff); - puStack_c = &LAB_00b00117; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((&poofColor)[1]._colorize); - ExceptionList = &local_10; - if (-1 < this->_playerIndex) { - if ((this->_playerType == 0x10) || (this->_playerType == 0x11)) { - subPlayer = GHIDRA_CAST(this->_subPlayer); - isNullEffectActive = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x78); - if (isNullEffectActive == 0) { - if (subPlayer == GHIDRA_CAST(0x0)) { - local_48.y = (float)operator_new(0x2f00); - if (GHIDRA_CAST(local_48.y) == GHIDRA_CAST(0x0)) { - subPlayer = GHIDRA_CAST(0x0); - } - else { - local_8 = subPlayer; - constructor(GHIDRA_CAST(local_48.y)); - subPlayer = extraout_EAX_00; - } - local_8 = GHIDRA_CAST(0xffffffff); - this->_subPlayer = GHIDRA_INT(subPlayer); - (**(code **)(*subPlayer + 4)) - (this->_type,this->_variant,(this->_playerType == 0x10) + '\x10',this->_initSeed - ); - } - } - else if (subPlayer != GHIDRA_CAST(0x0)) { - (**(code **)(*subPlayer + 0x44))(); - if (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_subPlayer))(1); - } - this->_subPlayer = 0; - } - } - else { - subPlayer = GHIDRA_CAST(this->_subPlayer); - if ((subPlayer != GHIDRA_CAST(0x0)) && ((char)subPlayer[0x5c] == '\0')) { - (**(code **)(*subPlayer + 0x44))(local_14); - if (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_subPlayer))(1); - } - this->_subPlayer = 0; - } - if (this->_forgottenBody != (void *)0x0) { - seed = Random(); - darkEsau = this->_forgottenBody; - local_48.x = (darkEsau->_pos).x; - local_48.y = (darkEsau->_pos).y; - Game::Spawn(g_game,1000,0xf,&local_48,&g_vectorZero,darkEsau,0,seed); - (**(code **)(*GHIDRA_CAST(this->_forgottenBody) + 0x28))(); - } - if (((this->_darkEsau != 0) && (this->_playerType != 0x25)) && (this->_playerType != 0x27)) { - seed = Random(); - darkEsau = GHIDRA_CAST(this->_darkEsau); - darkEsauPos.x = (darkEsau->_pos).x; - darkEsauPos.y = (darkEsau->_pos).y; - Game::Spawn(g_game,1000,0xf,&darkEsauPos,&g_vectorZero,darkEsau,0,seed); - (GHIDRA_CAST((&poofColor)))->Color::Color(); - (*extraout_EDX)(extraout_EAX,0xffffffff,0xff,0,1); - (**(code **)(*GHIDRA_CAST(this->_darkEsau) + 0x28))(); - } - } - } - ExceptionList = local_10; - return; -} - -// 007cbef0 -Entity * Entity_Player::spawn_forgotten_body() -{ - ColorMod *pCVar1; - int iVar2; - float fVar3; - float fVar4; - float fVar5; - ANM2 *pAVar6; - uint32_t uVar7; - uint8_t bVar8; - RoomDescriptor *bodyRoom; - Entity_Familiar *body; - Entity *pEVar9; - uint32_t bodyDimension; - uint32_t uVar10; - void **ppvStack_14; - Vector spawnPos; - void **bodySlot; - Game *game; - bool isBirthrightBody; - int *roomConfig; - - pEVar9 = this->_forgottenBody; - bodySlot = &this->_forgottenBody; - if (pEVar9 != GHIDRA_CAST(0x0)) { - if (this->_replacedPlayer != (void *)0x0) { - return pEVar9; - } - pEVar9->Remove(); - } - bVar8 = HasCollectible(this,0x26b,0); - if ((bVar8 == 0) || (this->_playerType != 0x11)) { - isBirthrightBody = false; - } - else { - isBirthrightBody = true; - } - uVar10 = this->_forgottenBodyRoomIdx; - bodyDimension = 0; - if (-1 < GHIDRA_INT(uVar10)) { - bodyDimension = uVar10 / 0xa9; - uVar10 = uVar10 % 0xa9; - } - if (((((isBirthrightBody) && (uVar10 != 0xfffe7961)) && - ((roomConfig = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)), roomConfig == GHIDRA_CAST(0x0) - || ((roomConfig[2] != 0x10 || (*roomConfig != 0x23)))))) && - (bodyDimension == g_game->_currentDimensionIdx)) && - (bodyRoom = Level::GetRoomByIdx(GHIDRA_CAST(g_game),uVar10,bodyDimension), - bodyRoom != *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)))) { - return GHIDRA_CAST(0x0); - } - spawnPos.x = (this->_pos).x; - spawnPos.y = (this->_pos).y; - if ((isBirthrightBody) && (this->_forgottenBodyRoomIdx != -99999)) { - spawnPos.x = (this->_forgottenBodyPos).x; - spawnPos.y = (this->_forgottenBodyPos).y; - } - uVar10 = Random(); - body = (Entity_Familiar *) - Game::SpawnEx(g_game,3,900,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar10,0); - (body->_pos).x = spawnPos.x; - (body->_pos).y = spawnPos.y; - (GHIDRA_CAST((GHIDRA_CAST(body))))->Entity::SetSize(this->_size,this->_sizeMulti,-1); - pCVar1 = &(body->_sprite)._color; - (body->_sprite)._scale.x = (this->_playerSpriteScale).x; - (body->_sprite)._scale.y = (this->_playerSpriteScale).y; - if (pCVar1 != GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0))))) { - fVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e4)))); - fVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e8)))); - fVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16ec)))); - pCVar1->_tint[0] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16e0)))); - (body->_sprite)._color._tint[1] = fVar3; - (body->_sprite)._color._tint[2] = fVar4; - (body->_sprite)._color._tint[3] = fVar5; - fVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16f4)))); - fVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16f8)))); - fVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16fc)))); - (body->_sprite)._color._colorize[0] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x16f0)))); - (body->_sprite)._color._colorize[1] = fVar3; - (body->_sprite)._color._colorize[2] = fVar4; - (body->_sprite)._color._colorize[3] = fVar5; - uVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1704)))); - (body->_sprite)._color._offset[0] = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1700)))); - (body->_sprite)._color._offset[1] = (float)uVar7; - (body->_sprite)._color._offset[2] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1708)))); - } - *GHIDRA_CAST(&body->_flags) = GHIDRA_UINT(body->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&body->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&body->_flags) + 4)); - if (*bodySlot != (void *)0x0) { - ppvStack_14 = bodySlot; - msvc::multiset::erase(&ppvStack_14); - } - *bodySlot = body; - msvc::multiset::insert(bodySlot); - game = g_game; - iVar2 = g_game->_currentRoomIdx; - if (iVar2 != -0x10) { - this->_forgottenBodyRoomIdx = iVar2; - if (-1 < iVar2) { - this->_forgottenBodyRoomIdx = game->_currentDimensionIdx * 0xa9 + iVar2; - } - (this->_forgottenBodyPos).x = spawnPos.x; - (this->_forgottenBodyPos).y = spawnPos.y; - } - if (!isBirthrightBody) { - uVar10 = Random(); - pEVar9 = Game::SpawnEx(g_game,1000,0x72,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar10,0); - if (pEVar9->_child != 0) { - ppvStack_14 = (void **)&pEVar9->_child; - msvc::multiset::erase(&ppvStack_14); - } - pEVar9->_child = body; - msvc::multiset::insert(&pEVar9->_child); - if (pEVar9->_target != 0) { - ppvStack_14 = (void **)&pEVar9->_target; - msvc::multiset::erase(&ppvStack_14); - } - pEVar9->_target = this; - msvc::multiset::insert(&pEVar9->_target); - iVar2 = *GHIDRA_CAST(pEVar9); - pAVar6 = &pEVar9[1]._sprite; - (pAVar6->_animDefaultName)._buf[8] = '\0'; - (pAVar6->_animDefaultName)._buf[9] = '\0'; - (pAVar6->_animDefaultName)._buf[10] = -0x10; - (pAVar6->_animDefaultName)._buf[0xb] = 'B'; - (**(code **)(iVar2 + 0xc))(); - } - return GHIDRA_CAST(body); -} - -// 007cc200 -uint8_t Entity_Player::SwapForgottenForm(uint8_t isForce, uint8_t isNoEffects) -{ - void *pvVar1; - uint8_t bVar2; - uint32_t swapDwordTmp; - RoomDescriptor *bodyRoom; - ItemConfig_Item **trailCountPtr; - Entity *spawnedEffect; - ItemConfig_Item *pIVar4; - int *piVar5; - uint8_t *pbVar6; - uint32_t *effect; - uint8_t *animNameChar; - Entity_Player *effectsOwner; - ItemConfig_Item **minTrailCountPtr; - char *expectedChar; - uint8_t *swapByte; - void **ppvVar8; - int iVar9; - uint32_t uVar10; - TemporaryEffects *tempEffects; - bool isLess; - float fVar11; - double dVar12; - Color spriteColor; - ItemConfig_Item *trailCount; - int trailIndex; - float trailX; - float angleSin; - uint8_t local_a0 [8]; - Vector local_98; - Vector poofVelocity; - float local_88; - ItemConfig_Item *local_84; - int crownEffectKey [2]; - float local_78; - ItemConfig_Item *local_74; - Entity_Player *local_70; - ItemConfig_Item *effectEntryItem; - uint32_t effectEntryCount; - Vector VStack_64; - ItemConfig_Item *local_5c; - uint8_t local_55; - ItemConfig_Item *local_54; - ColorMod colorMod; - uint32_t local_24; - uint8_t *puStack_20; - void *savedExceptionList; - uint8_t *puStack_18; - float ehState; - uint64_t crownAnim; - int *effectsEnd; - Entity_Player *effectsOwner; - Game *game; - int playerType; - float posOffsetY; - uint8_t swapByteTmp; - uint32_t swapDwordTmp; - - puStack_20 = GHIDRA_CAST((&colorMod)[1]._offset); - ehState = -NAN; - puStack_18 = &LAB_00b00140; - savedExceptionList = ExceptionList; - swapDwordTmp = __security_cookie ^ GHIDRA_UINT(((&colorMod)[1]._colorize + 1)); - iVar9 = this->_subPlayer; - if (iVar9 == 0) { - return 0; - } - playerType = this->_playerType; - if ((playerType == 0x10) || (playerType == 0x11)) { - if (isForce == 0) { - if (0 < this->_forgottenSwapFormCooldown) goto LAB_007cc270; - if (((*GHIDRA_CAST((iVar9 + 0x1344)) < 1) && (*GHIDRA_CAST((iVar9 + 0x134c)) < 1)) && - (*GHIDRA_CAST((iVar9 + 0x1d88)) < 1)) { - return 0; - } - if (*GHIDRA_CAST(&g_game->_roomTransition) != 0) { - return 0; - } - if (*GHIDRA_CAST(&g_game->_stageTransition) != 0) { - return 0; - } - if (0 < g_game->_deathCertificateExitTimer) { - return 0; - } - } - } - else { -LAB_007cc270: - if (((playerType != 0x25) && (playerType != 0x27)) || (isForce == 0)) { - return 0; - } - } - ExceptionList = &savedExceptionList; - if (((playerType == 0x10) || (playerType == 0x11)) && (isNoEffects == 0)) { - this->_forgottenSwapFormCooldown = 0xf; - } - local_70 = this; - local_24 = swapDwordTmp; - RemoveSkinCostume(this); - bVar2 = HasCollectible(this,0x7a,0); - if ((bVar2 == 0) || (local_55 = 1, 1 < this->_redHearts)) { - local_55 = 0; - } - ppvVar8 = this->_weapons; - local_5c = GHIDRA_CAST(&DAT_00000004); - do { - ppvVar8 = ppvVar8 + 1; - if (*ppvVar8 != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*ppvVar8) + 0x14))(swapDwordTmp); - } - local_5c = GHIDRA_CAST((GHIDRA_INT(&local_5c[-1]._initCharge) + 3)); - } while (local_5c != GHIDRA_CAST(0x0)); - iVar9 = this->_redHearts; - this->_redHearts = *GHIDRA_CAST((this->_subPlayer + 0x1344)); - *GHIDRA_CAST((this->_subPlayer + 0x1344)) = iVar9; - iVar9 = this->_maxHearts; - this->_maxHearts = *GHIDRA_CAST((this->_subPlayer + 0x1340)); - *GHIDRA_CAST((this->_subPlayer + 0x1340)) = iVar9; - iVar9 = this->_soulHearts; - this->_soulHearts = *GHIDRA_CAST((this->_subPlayer + 0x134c)); - *GHIDRA_CAST((this->_subPlayer + 0x134c)) = iVar9; - iVar9 = this->_blackHearts; - this->_blackHearts = *GHIDRA_CAST((this->_subPlayer + 0x1350)); - *GHIDRA_CAST((this->_subPlayer + 0x1350)) = iVar9; - iVar9 = this->_eternalHearts; - this->_eternalHearts = *GHIDRA_CAST((this->_subPlayer + 0x1348)); - *GHIDRA_CAST((this->_subPlayer + 0x1348)) = iVar9; - iVar9 = this->_boneHearts; - this->_boneHearts = *GHIDRA_CAST((this->_subPlayer + 0x1d88)); - *GHIDRA_CAST((this->_subPlayer + 0x1d88)) = iVar9; - iVar9 = this->_boneHeartsMask; - this->_boneHeartsMask = *GHIDRA_CAST((this->_subPlayer + 0x1d8c)); - *GHIDRA_CAST((this->_subPlayer + 0x1d8c)) = iVar9; - iVar9 = this->_brokenHearts; - this->_brokenHearts = *GHIDRA_CAST((this->_subPlayer + 0x1da0)); - *GHIDRA_CAST((this->_subPlayer + 0x1da0)) = iVar9; - iVar9 = this->_rottenHearts; - this->_rottenHearts = *GHIDRA_CAST((this->_subPlayer + 0x1da4)); - *GHIDRA_CAST((this->_subPlayer + 0x1da4)) = iVar9; - iVar9 = this->_reverseEmpressMaxHearts; - this->_reverseEmpressMaxHearts = *GHIDRA_CAST((this->_subPlayer + 0x1ecc)); - *GHIDRA_CAST((this->_subPlayer + 0x1ecc)) = iVar9; - iVar9 = this->_goldenHearts; - this->_goldenHearts = *GHIDRA_CAST((this->_subPlayer + 0x194c)); - *GHIDRA_CAST((this->_subPlayer + 0x194c)) = iVar9; - iVar9 = this->_playerType; - this->_playerType = *GHIDRA_CAST((this->_subPlayer + 0x13c0)); - *GHIDRA_CAST((this->_subPlayer + 0x13c0)) = iVar9; - bVar2 = this->_tearDisplacement; - this->_tearDisplacement = *GHIDRA_CAST((this->_subPlayer + 0x1578)); - *GHIDRA_CAST((this->_subPlayer + 0x1578)) = bVar2; - iVar9 = this->_strengthMaxHearts; - this->_strengthMaxHearts = *GHIDRA_CAST((this->_subPlayer + 0x18a0)); - *GHIDRA_CAST((this->_subPlayer + 0x18a0)) = iVar9; - swapDwordTmp = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1950)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1950)))) = *GHIDRA_CAST((this->_subPlayer + 0x1950)); - *GHIDRA_CAST((this->_subPlayer + 0x1950)) = swapDwordTmp; - swapByte = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f0))); - effectsOwner = GHIDRA_CAST(this->_subPlayer); - if ((this != effectsOwner) && (swapByte != &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1401))))) { - do { - swapByteTmp = *swapByte; - *swapByte = swapByte[GHIDRA_INT(effectsOwner) - GHIDRA_INT(this)]; - swapByte[GHIDRA_INT(effectsOwner) - GHIDRA_INT(this)] = swapByteTmp; - swapByte = swapByte + 1; - } while (swapByte != &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1401)))); - effectsOwner = GHIDRA_CAST(local_70->_subPlayer); - this = local_70; - } - ppvVar8 = this->_weapons + 1; - if ((ppvVar8 != effectsOwner->_weapons + 1) && - (local_54 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x13f0)))), GHIDRA_CAST(ppvVar8) != local_54)) { - iVar9 = GHIDRA_INT((effectsOwner->_weapons + 1)) - GHIDRA_INT(ppvVar8); - do { - pvVar1 = *ppvVar8; - *ppvVar8 = *(void **)(GHIDRA_CAST(ppvVar8) + iVar9); - *(void **)(GHIDRA_CAST(ppvVar8) + iVar9) = pvVar1; - ppvVar8 = ppvVar8 + 1; - } while (GHIDRA_CAST(ppvVar8) != local_54); - } - if (this->_weapons[1] != (void *)0x0) { - *GHIDRA_CAST((GHIDRA_INT(this->_weapons[1]) + 4)) = this; - } - if (this->_weapons[2] != (void *)0x0) { - *GHIDRA_CAST((GHIDRA_INT(this->_weapons[2]) + 4)) = this; - } - if (this->_weapons[3] != (void *)0x0) { - *GHIDRA_CAST((GHIDRA_INT(this->_weapons[3]) + 4)) = this; - } - if (this->_weapons[4] != (void *)0x0) { - *GHIDRA_CAST((GHIDRA_INT(this->_weapons[4]) + 4)) = this; - } - if (this->_playerType == 0x11) { - if ((isNoEffects == 0) || (this->_forgottenBody == (void *)0x0)) { - spawn_forgotten_body(this); - } - this->ResetColor(); - if (isNoEffects == 0) { - spriteColor._offset[2] = (this->_sprite)._color._offset[2]; - colorMod._colorize[0] = 0.0; - colorMod._colorize[1] = 0.0; - colorMod._colorize[2] = 0.0; - colorMod._colorize[3] = 0.0; - colorMod._tint[0] = 1.0; - colorMod._tint[1] = 1.0; - colorMod._tint[2] = 1.0; - colorMod._tint[3] = 1.0; - spriteColor._tint[0] = (this->_sprite)._color._tint[0]; - spriteColor._tint[1] = (this->_sprite)._color._tint[1]; - spriteColor._tint[2] = (this->_sprite)._color._tint[2]; - spriteColor._tint[3] = (this->_sprite)._color._tint[3]; - colorMod._offset[0] = 1.0; - colorMod._offset[1] = 1.0; - colorMod._offset[2] = 1.0; - spriteColor._colorize[0] = (this->_sprite)._color._colorize[0]; - spriteColor._colorize[1] = (this->_sprite)._color._colorize[1]; - spriteColor._colorize[2] = (this->_sprite)._color._colorize[2]; - spriteColor._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(spriteColor._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - (GHIDRA_CAST((&spriteColor)))->Color::__mul(&colorMod); - colorMod._tint[0] = spriteColor._tint[0]; - colorMod._tint[1] = spriteColor._tint[1]; - colorMod._tint[2] = spriteColor._tint[2]; - colorMod._tint[3] = spriteColor._tint[3]; - colorMod._offset[2] = spriteColor._offset[2]; - colorMod._colorize[0] = spriteColor._colorize[0]; - colorMod._colorize[1] = spriteColor._colorize[1]; - colorMod._colorize[2] = spriteColor._colorize[2]; - colorMod._colorize[3] = spriteColor._colorize[3]; - colorMod._offset[0] = spriteColor._offset[0]; - colorMod._offset[1] = spriteColor._offset[1]; - this->SetColor(&colorMod,8,0xff,1); - } - } - else if (this->_playerType == 0x10) { - swapDwordTmp = this->_forgottenBodyRoomIdx; - local_5c = GHIDRA_CAST(0x0); - uVar10 = swapDwordTmp; - if (-1 < GHIDRA_INT(swapDwordTmp)) { - local_5c = GHIDRA_CAST((swapDwordTmp / 0xa9)); - uVar10 = swapDwordTmp % 0xa9; - swapDwordTmp = this->_forgottenBodyRoomIdx; - } - if (((this->_forgottenBody == (void *)0x0) && (swapDwordTmp != 0xfffe7961)) && - (bodyRoom = Level::GetRoomByIdx(GHIDRA_CAST(g_game),uVar10,GHIDRA_INT(local_5c)), - bodyRoom != *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)))) { - bVar2 = HasCollectible(this,0x26b,0); - game = g_game; - if (bVar2 == 0) goto LAB_007cc74d; - g_game->_leaveDoor = -1; - Game::StartRoomTransition(game,uVar10,-1,0x11,this,GHIDRA_INT(local_5c)); - this->_forgottenBodyRoomIdx = -99999; - } - else { -LAB_007cc74d: - pvVar1 = this->_forgottenBody; - if (pvVar1 == (void *)0x0) { - local_78 = g_vectorZero.x; - local_74 = GHIDRA_CAST(g_vectorZero.y); - } - else { - local_78 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x33c)) - (this->_pos).x; - local_74 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x340)) - (this->_pos).y)); - } - poofVelocity.x = local_78 * 0.1; - poofVelocity.y = (float)local_74 * 0.1; - local_5c = GHIDRA_CAST(poofVelocity.y); - local_54 = GHIDRA_CAST(poofVelocity.x); - if (isNoEffects == 0) { - if (pvVar1 != (void *)0x0) { - fVar11 = sqrtf(poofVelocity.y * poofVelocity.y + poofVelocity.x * poofVelocity.x); - if ((4.0 < fVar11) && (0.0 < fVar11)) { - poofVelocity.y = (4.0 / fVar11) * (float)local_5c; - poofVelocity.x = (4.0 / fVar11) * (float)local_54; - } - local_84 = GHIDRA_CAST(0xc); - local_5c = GHIDRA_CAST(&DAT_00000004); - fVar11 = sqrtf(local_78 * local_78 + (float)local_74 * (float)local_74); - local_54 = GHIDRA_CAST((fVar11 / 20.0)); - dVar12 = floor((double)(float)local_54); - local_54 = GHIDRA_CAST(GHIDRA_INT(dVar12)); - minTrailCountPtr = &local_5c; - if (3 < GHIDRA_INT(dVar12)) { - minTrailCountPtr = &local_54; - } - trailCountPtr = &local_84; - if (GHIDRA_INT(*minTrailCountPtr) < 0xd) { - trailCountPtr = minTrailCountPtr; - } - trailCount = *trailCountPtr; - if (0 < GHIDRA_INT(trailCount)) { - local_74 = GHIDRA_CAST((float)GHIDRA_INT((GHIDRA_INT(&trailCount->type) + 1))); - trailIndex = 0; - do { - trailIndex = trailIndex + 1; - trailX = (this->_pos).x; - local_88 = (this->_pos).y; - local_5c = GHIDRA_CAST(((float)trailIndex / (float)local_74)); - trailX = trailX + (*GHIDRA_CAST((GHIDRA_CAST(this->_forgottenBody) + 0x33c)) - trailX) * - (float)local_5c; - local_88 = local_88 + - (*GHIDRA_CAST((GHIDRA_CAST(this->_forgottenBody) + 0x340)) - local_88) * - (float)local_5c; - swapDwordTmp = Random(); - fVar11 = (float)((double)GHIDRA_INT(swapDwordTmp) + __uint_to_double_fixup[-(GHIDRA_INT(swapDwordTmp) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_84 = GHIDRA_CAST((fVar11 + fVar11)); - angleSin = sin((float)local_84); - swapDwordTmp = Random(); - local_54 = (ItemConfig_Item *) - ((float)((double)GHIDRA_INT(swapDwordTmp) + __uint_to_double_fixup[-(GHIDRA_INT(swapDwordTmp) >> 0x1f)] - ) * 2.3283064e-10); - fVar11 = cos((float)local_84); - VStack_64.x = fVar11 * (float)local_54 * 15.0 + trailX; - VStack_64.y = local_88 + (float)local_54 * angleSin * 15.0; - swapDwordTmp = Random(); - uVar10 = Random(); - local_98.y = (float)((double)GHIDRA_INT(uVar10) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * 2.3283064e-10 * - 0.5 + 0.5; - local_98.x = poofVelocity.x * local_98.y; - local_98.y = poofVelocity.y * local_98.y; - spawnedEffect = - Game::SpawnEx(g_game,1000,0x6f,&VStack_64,&local_98,GHIDRA_CAST(0x0),0,swapDwordTmp,0); - colorMod._colorize[0] = 0.0; - colorMod._colorize[1] = 0.0; - colorMod._colorize[2] = 0.0; - colorMod._colorize[3] = 0.0; - colorMod._tint[0] = 1.0; - colorMod._tint[1] = 1.0; - colorMod._tint[2] = 1.0; - colorMod._tint[3] = 1.0; - colorMod._offset[0] = 1.0; - colorMod._offset[1] = 1.0; - colorMod._offset[2] = 1.0; - spawnedEffect->SetColor(&colorMod,0xffffffff,0xff,0); - local_88 = (float)local_5c * g_vectorOne.x; - local_5c = GHIDRA_CAST(((float)local_5c * g_vectorOne.y)); - swapDwordTmp = Random(); - fVar11 = (float)((double)GHIDRA_INT(swapDwordTmp) + __uint_to_double_fixup[-(GHIDRA_INT(swapDwordTmp) >> 0x1f)]) * - 2.3283064e-10 * 0.3 + 0.3; - (spawnedEffect->_sprite)._scale.y = fVar11 * (float)local_5c; - (spawnedEffect->_sprite)._scale.x = fVar11 * local_88; - fVar11 = (this->_sprite)._scale.y; - posOffsetY = (this->_posOffset).y; - (spawnedEffect->_posOffset).x = (this->_posOffset).x + 0.0; - (spawnedEffect->_posOffset).y = fVar11 * -16.0 + posOffsetY; - } while (trailIndex < GHIDRA_INT(trailCount)); - } - } - swapDwordTmp = Random(); - spawnedEffect = - Game::SpawnEx(g_game,1000,0x10,&this->_pos,&poofVelocity,GHIDRA_CAST(0x0),10,swapDwordTmp,0); - (spawnedEffect->_posOffset).x = (this->_posOffset).x; - (spawnedEffect->_posOffset).y = (this->_posOffset).y; - (spawnedEffect->_sprite)._scale.x = (this->_sprite)._scale.x; - (spawnedEffect->_sprite)._scale.y = (this->_sprite)._scale.y; - pvVar1 = this->_forgottenBody; - if ((pvVar1 != (void *)0x0) && (10 < g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x328)))) { - VStack_64.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x33c)); - VStack_64.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x340)); - EntityList::QueryRadius - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_a0), - &VStack_64,*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x370)) + 25.0,2); - fVar11 = 0.0; - if (local_98.y != 0.0) { - do { - iVar9 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_a0)) + 0x4))) + GHIDRA_INT(fVar11) * 4)); - if ((*GHIDRA_CAST((iVar9 + 0x173)) == '\0') && (-50.0 < *GHIDRA_CAST((iVar9 + 0x410)))) { - *GHIDRA_CAST((iVar9 + 0x438)) = 0; - *GHIDRA_CAST((iVar9 + 0x43c)) = 0; - *GHIDRA_CAST((iVar9 + 0x173)) = 1; - } - fVar11 = (float)(GHIDRA_INT(fVar11) + 1); - } while (GHIDRA_UINT(fVar11) < GHIDRA_UINT(local_98.y)); - } - if (local_a0[0] == '\0') { - ehState = 0.0; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_a0)) + 0x4))),0); - ehState = -NAN; - } - } - } - pvVar1 = this->_forgottenBody; - if (pvVar1 != (void *)0x0) { - VStack_64.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x33c)); - VStack_64.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x340)); - Teleport(this,&VStack_64,0,0); - piVar5 = this->_forgottenBody; - (this->_velocity).x = g_vectorZero.x; - iVar9 = *piVar5; - (this->_velocity).y = g_vectorZero.y; - (**(code **)(iVar9 + 0x28))(); - } - } - this->ResetColor(); - if (isNoEffects == 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(spriteColor._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - colorMod._tint[0] = (this->_sprite)._color._tint[0] * 1.0; - colorMod._tint[1] = (this->_sprite)._color._tint[1] * 1.0; - colorMod._tint[2] = (this->_sprite)._color._tint[2] * 1.0; - colorMod._tint[3] = (this->_sprite)._color._tint[3] * 1.0; - spriteColor._offset[2] = (this->_sprite)._color._offset[2] + 1.0; - colorMod._colorize[0] = (this->_sprite)._color._colorize[0]; - colorMod._colorize[1] = (this->_sprite)._color._colorize[1]; - colorMod._colorize[2] = (this->_sprite)._color._colorize[2]; - colorMod._colorize[3] = (this->_sprite)._color._colorize[3]; - colorMod._offset[1] = spriteColor._offset[1] + 1.0; - colorMod._offset[0] = spriteColor._offset[0] + 1.0; - colorMod._offset[2] = spriteColor._offset[2]; - this->SetColor(&colorMod,8,0xff,1); - } - this->_forgottenBodyRoomIdx = -99999; - } - tempEffects = &this->_temporaryeffects; - if ((this->_temporaryeffects)._disabled == 0) { - for (piVar5 = (this->_temporaryeffects)._effects._begin; - piVar5 != (this->_temporaryeffects)._effects._end; piVar5 = piVar5 + 4) { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && (*GHIDRA_CAST((*piVar5 + 4)) == 0x7a)) { - local_74 = GHIDRA_CAST(piVar5[1]); - pIVar4 = local_74; - if (0 < GHIDRA_INT(local_74)) { - local_5c = local_74; - do { - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x1e8 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & - 0xfffffffcU))) && - (pIVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1e8)), - pIVar4 != GHIDRA_CAST(0x0))) { - VStack_64.x = (float)pIVar4->maxCooldown; - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = pIVar4; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveEffect(&effectEntryItem,1); - } - local_5c = GHIDRA_CAST((GHIDRA_INT(&local_5c[-1]._initCharge) + 3)); - } while (local_5c != GHIDRA_CAST(0x0)); - local_5c = GHIDRA_CAST(0x0); - pIVar4 = local_74; - } - goto LAB_007ccdf8; - } - } - } - pIVar4 = GHIDRA_CAST(0x0); -LAB_007ccdf8: - local_54 = GHIDRA_CAST((GHIDRA_INT(&pIVar4[-1]._initCharge) + 3)); - if (local_55 == 0) { - local_54 = pIVar4; - } - bVar2 = HasCollectible(this,0x7a,0); - if (bVar2 != 0) { - if ((this->_temporaryeffects)._disabled == 0) { - piVar5 = (this->_temporaryeffects)._effects._begin; - effectsEnd = (this->_temporaryeffects)._effects._end; - if (piVar5 != effectsEnd) { - do { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && (*GHIDRA_CAST((*piVar5 + 4)) == 0x7a)) - goto LAB_007ccfa0; - piVar5 = piVar5 + 4; - } while (piVar5 != effectsEnd); - piVar5 = (this->_temporaryeffects)._effects._begin; - do { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && (*GHIDRA_CAST((*piVar5 + 4)) == 0x7a)) - goto LAB_007ccf4a; - piVar5 = piVar5 + 4; - } while (piVar5 != (this->_temporaryeffects)._effects._end); - } - } - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU)) < 0x1e9) - { - local_5c = GHIDRA_CAST(0x0); - } - else { - local_5c = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1e8)); - } - if ((local_5c->addCostumeOnPickup == 0) || (bVar2 = HasCollectible(this,0x7a,0), bVar2 == 0)) { - RemoveCostume(this,local_5c); - } -LAB_007ccf4a: - if (((this->_redHearts < 2) && - (pvVar1 = (g_manager->_itemConfig)._collectibles._begin, - 0x1e8 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU))) - ) && (pIVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1e8)), pIVar4 != GHIDRA_CAST(0x0)) - ) { - VStack_64.x = (float)pIVar4->maxCooldown; - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = pIVar4; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::AddEffect(&effectEntryItem,1,1); - } - } -LAB_007ccfa0: - effectsOwner = this; - if (0 < GHIDRA_INT(local_54)) { - pIVar4 = local_54; - do { - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (0x1e8 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU - ))) { - local_5c = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1e8)); - if (local_5c != GHIDRA_CAST(0x0)) { - local_74 = GHIDRA_CAST(local_5c->maxCooldown); - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = local_5c; - VStack_64.x = (float)local_74; - if ((this->_temporaryeffects)._disabled == 0) { - effect = (this->_temporaryeffects)._effects._begin; - if (effect != (this->_temporaryeffects)._effects._end) { - do { - if (GHIDRA_CAST(*effect) == local_5c) { - if (effect != (this->_temporaryeffects)._effects._end) { - effect[1] = effect[1] + 1; - effect[2] = (local_74->name)._buf + effect[2] + -8; - goto LAB_007cd080; - } - break; - } - effect = effect + 4; - } while (effect != (this->_temporaryeffects)._effects._end); - } - effect = (this->_temporaryeffects)._effects._end; - if (effect == (this->_temporaryeffects)._effects._capacity) { - msvc::vector::_Emplace_reallocate(effect,&effectEntryItem); - local_5c = effectEntryItem; - } - else { - *effect = local_5c; - effect[1] = 0; - effect[2] = local_74; - effect[3] = 0; - ppvVar8 = &(this->_temporaryeffects)._effects._end; - *ppvVar8 = (void *)(GHIDRA_INT(*ppvVar8) + 0x10); - } - local_54 = (this->_temporaryeffects)._effects._end; - pvVar1 = (this->_temporaryeffects)._effects._begin; - *GHIDRA_CAST((((GHIDRA_INT(local_54) - GHIDRA_INT(pvVar1) & 0xfffffff0U) - 0xc) + GHIDRA_INT(pvVar1))) = 1; - effectsOwner = (this->_temporaryeffects)._player; - effectEntryItem = local_5c; - if (effectsOwner != GHIDRA_CAST(0x0)) { - effectEntryItem = local_5c; - AddCostume(effectsOwner,local_5c,0); - } -LAB_007cd080: - tempEffects->_cacheFlags = tempEffects->_cacheFlags | local_5c->cacheFlags; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - } - } - pIVar4 = GHIDRA_CAST((GHIDRA_INT(&pIVar4[-1]._initCharge) + 3)); - } while (pIVar4 != GHIDRA_CAST(0x0)); - effectsOwner = local_70; - } - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x664 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU))) - && (pIVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x664)), pIVar4 != GHIDRA_CAST(0x0))) { - VStack_64.x = (float)pIVar4->maxCooldown; - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = pIVar4; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveEffect(&effectEntryItem,1); - } - bVar2 = HasCollectible(effectsOwner,0x199,0); - if (bVar2 != 0) { - if ((effectsOwner->_temporaryeffects)._disabled == 0) { - for (piVar5 = (effectsOwner->_temporaryeffects)._effects._begin; - piVar5 != (effectsOwner->_temporaryeffects)._effects._end; piVar5 = piVar5 + 4) { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && (*GHIDRA_CAST((*piVar5 + 4)) == 0x199)) - goto LAB_007cd27a; - } - } - pvVar1 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU)) < 0x49) { - pIVar4 = GHIDRA_CAST(0x0); - } - else { - pIVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x48)); - } - RemoveCostume(effectsOwner,pIVar4); - if (effectsOwner->_redHearts < 1) { - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (0x664 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU - ))) { - local_54 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x664)); - if (local_54 != GHIDRA_CAST(0x0)) { - local_74 = GHIDRA_CAST(local_54->maxCooldown); - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = local_54; - VStack_64.x = (float)local_74; - if ((this->_temporaryeffects)._disabled == 0) { - effect = (this->_temporaryeffects)._effects._begin; - if (effect != (this->_temporaryeffects)._effects._end) { - do { - if (GHIDRA_CAST(*effect) == local_54) { - if (effect != (this->_temporaryeffects)._effects._end) { - effect[1] = effect[1] + 1; - effect[2] = (local_74->name)._buf + effect[2] + -8; - goto LAB_007cd242; - } - break; - } - effect = effect + 4; - } while (effect != (this->_temporaryeffects)._effects._end); - } - effect = (this->_temporaryeffects)._effects._end; - if (effect == (this->_temporaryeffects)._effects._capacity) { - msvc::vector::_Emplace_reallocate(effect,&effectEntryItem); - local_54 = effectEntryItem; - } - else { - *effect = local_54; - effect[1] = 0; - effect[2] = local_74; - effect[3] = 0; - ppvVar8 = &(this->_temporaryeffects)._effects._end; - *ppvVar8 = (void *)(GHIDRA_INT(*ppvVar8) + 0x10); - } - local_70 = (this->_temporaryeffects)._effects._end; - pvVar1 = (this->_temporaryeffects)._effects._begin; - *GHIDRA_CAST((((GHIDRA_INT(local_70) - GHIDRA_INT(pvVar1) & 0xfffffff0U) - 0xc) + GHIDRA_INT(pvVar1))) = 1; - effectsOwner = (this->_temporaryeffects)._player; - effectEntryItem = local_54; - if (effectsOwner != GHIDRA_CAST(0x0)) { - effectEntryItem = local_54; - AddCostume(effectsOwner,local_54,0); - } -LAB_007cd242: - tempEffects->_cacheFlags = tempEffects->_cacheFlags | local_54->cacheFlags; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - } - } - pvVar1 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU)) < 0x49) { - pIVar4 = GHIDRA_CAST(0x0); - } - else { - pIVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x48)); - } - AddCostume(effectsOwner,pIVar4,0); - } - } -LAB_007cd27a: - bVar2 = HasCollectible(effectsOwner,0x19f,0); - if (bVar2 != 0) { - if ((*GHIDRA_CAST((GHIDRA_CAST((effectsOwner)) + 0x13b5))) == '\0') { - iVar9 = GetHealthType(effectsOwner); - if ((iVar9 == 1) || (iVar9 == 2)) { - iVar9 = effectsOwner->_maxHearts; - } - else { - iVar9 = effectsOwner->_maxHearts + effectsOwner->_boneHearts * 2; - } - if (iVar9 <= effectsOwner->_redHearts) { - bVar2 = (effectsOwner->_temporaryeffects)._disabled; - if (bVar2 == 0) { - piVar5 = (effectsOwner->_temporaryeffects)._effects._begin; - effectsEnd = (effectsOwner->_temporaryeffects)._effects._end; - if (piVar5 != effectsEnd) { - do { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && - (*GHIDRA_CAST((*piVar5 + 4)) == 0x19f)) goto LAB_007cd59e; - piVar5 = piVar5 + 4; - } while (piVar5 != effectsEnd); - bVar2 = (effectsOwner->_temporaryeffects)._disabled; - } - } - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (0x67c < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & - 0xfffffffcU))) { - local_54 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x67c)); - if (local_54 != GHIDRA_CAST(0x0)) { - local_74 = GHIDRA_CAST(local_54->maxCooldown); - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = local_54; - VStack_64.x = (float)local_74; - if (bVar2 == 0) { - effect = (this->_temporaryeffects)._effects._begin; - if (effect != (this->_temporaryeffects)._effects._end) { - do { - if (GHIDRA_CAST(*effect) == local_54) { - if (effect != (this->_temporaryeffects)._effects._end) { - effect[1] = effect[1] + 1; - effect[2] = (local_74->name)._buf + effect[2] + -8; - goto LAB_007cd3ef; - } - break; - } - effect = effect + 4; - } while (effect != (this->_temporaryeffects)._effects._end); - } - effect = (this->_temporaryeffects)._effects._end; - if (effect == (this->_temporaryeffects)._effects._capacity) { - msvc::vector::_Emplace_reallocate(effect,&effectEntryItem); - local_54 = effectEntryItem; - } - else { - *effect = local_54; - effect[1] = 0; - effect[2] = local_74; - effect[3] = 0; - ppvVar8 = &(this->_temporaryeffects)._effects._end; - *ppvVar8 = (void *)(GHIDRA_INT(*ppvVar8) + 0x10); - } - local_70 = (this->_temporaryeffects)._effects._end; - pvVar1 = (this->_temporaryeffects)._effects._begin; - *GHIDRA_CAST((((GHIDRA_INT(local_70) - GHIDRA_INT(pvVar1) & 0xfffffff0U) - 0xc) + GHIDRA_INT(pvVar1))) = 1 - ; - effectsOwner = (this->_temporaryeffects)._player; - effectEntryItem = local_54; - if (effectsOwner != GHIDRA_CAST(0x0)) { - effectEntryItem = local_54; - AddCostume(effectsOwner,local_54,0); - } -LAB_007cd3ef: - tempEffects->_cacheFlags = tempEffects->_cacheFlags | local_54->cacheFlags; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - } - } - } - pbVar6 = (effectsOwner->_crownOfLightSprite)._animState._animData; - if (pbVar6 != GHIDRA_CAST(0x0)) { - if (0xf < *GHIDRA_CAST((pbVar6 + 0x14))) { - pbVar6 = *GHIDRA_CAST(pbVar6); - } - expectedChar = "FloatGlow"; - do { - bVar2 = *pbVar6; - isLess = bVar2 < (uint8_t)*expectedChar; - if (bVar2 != *expectedChar) { -LAB_007cd434: - swapDwordTmp = -GHIDRA_UINT(isLess) | 1; - goto LAB_007cd439; - } - if (bVar2 == 0) break; - bVar2 = pbVar6[1]; - isLess = bVar2 < (uint8_t)expectedChar[1]; - if (bVar2 != expectedChar[1]) goto LAB_007cd434; - pbVar6 = pbVar6 + 2; - expectedChar = expectedChar + 2; - } while (bVar2 != 0); - swapDwordTmp = 0; -LAB_007cd439: - if (swapDwordTmp == 0) { - if ((*GHIDRA_CAST((GHIDRA_INT((effectsOwner->_crownOfLightSprite)._animState._animData) + 0x34)) != '\0') - && ((effectsOwner->_crownOfLightSprite)._animState._isPlaying == 0)) { - crownAnim = 0x100b6ae50; - goto LAB_007cd57d; - } - goto LAB_007cd59e; - } - } - crownAnim = 0x100b6ae50; - goto LAB_007cd57d; - } - } - if ((effectsOwner->_temporaryeffects)._disabled == 0) { - for (piVar5 = (effectsOwner->_temporaryeffects)._effects._begin; - piVar5 != (effectsOwner->_temporaryeffects)._effects._end; piVar5 = piVar5 + 4) { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && (*GHIDRA_CAST((*piVar5 + 4)) == 0x19f)) { - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x67c < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & - 0xfffffffcU))) && - (pIVar4 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x67c)), pIVar4 != GHIDRA_CAST(0x0)) - ) { - VStack_64.x = (float)pIVar4->maxCooldown; - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = pIVar4; - (GHIDRA_CAST((tempEffects)))->TemporaryEffects::RemoveEffect(&effectEntryItem,1); - } - pbVar6 = (effectsOwner->_crownOfLightSprite)._animState._animData; - if (pbVar6 == GHIDRA_CAST(0x0)) goto LAB_007cd576; - if (0xf < *GHIDRA_CAST((pbVar6 + 0x14))) { - pbVar6 = *GHIDRA_CAST(pbVar6); - } - expectedChar = "FloatNoGlow"; - goto LAB_007cd530; - } - } - } - } - goto LAB_007cd59e; - while( true ) { - bVar2 = animNameChar[1]; - isLess = bVar2 < (uint8_t)expectedChar[1]; - if (bVar2 != expectedChar[1]) goto LAB_007cd880; - animNameChar = animNameChar + 2; - expectedChar = expectedChar + 2; - if (bVar2 == 0) break; -LAB_007cd860: - bVar2 = *animNameChar; - isLess = bVar2 < (uint8_t)*expectedChar; - if (bVar2 != *expectedChar) { -LAB_007cd880: - swapDwordTmp = -GHIDRA_UINT(isLess) | 1; - goto LAB_007cd885; - } - if (bVar2 == 0) break; - } - swapDwordTmp = 0; -LAB_007cd885: - if ((swapDwordTmp != 0) || - ((pbVar6[0x34] != 0 && ((effectsOwner->_darkPrincesCrownSprite)._animState._isPlaying == 0)))) { -LAB_007cd8a4: - crownAnim = 0x100b6ae44; - goto LAB_007cd8ab; - } - goto LAB_007cd8c2; - while( true ) { - bVar2 = pbVar6[1]; - isLess = bVar2 < (uint8_t)expectedChar[1]; - if (bVar2 != expectedChar[1]) goto LAB_007cd550; - pbVar6 = pbVar6 + 2; - expectedChar = expectedChar + 2; - if (bVar2 == 0) break; -LAB_007cd530: - bVar2 = *pbVar6; - isLess = bVar2 < (uint8_t)*expectedChar; - if (bVar2 != *expectedChar) { -LAB_007cd550: - swapDwordTmp = -GHIDRA_UINT(isLess) | 1; - goto LAB_007cd555; - } - if (bVar2 == 0) break; - } - swapDwordTmp = 0; -LAB_007cd555: - if ((swapDwordTmp != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((effectsOwner->_crownOfLightSprite)._animState._animData) + 0x34)) != '\0' && - ((effectsOwner->_crownOfLightSprite)._animState._isPlaying == 0)))) { -LAB_007cd576: - crownAnim = 0x100b6ae44; -LAB_007cd57d: - bVar2 = ANM2::SetAnimation(&effectsOwner->_crownOfLightSprite,GHIDRA_CAST(crownAnim), - (uint8_t)((uint64_t)crownAnim >> 0x20)); - if (bVar2 != 0) { - AnimationState::Rewind(&(effectsOwner->_crownOfLightSprite)._animState); - tempEffects = &effectsOwner->_temporaryeffects; - (effectsOwner->_crownOfLightSprite)._animState._isPlaying = 1; - } - } -LAB_007cd59e: - bVar2 = HasCollectible(effectsOwner,0x1ba,0); - if (bVar2 == 0) goto LAB_007cd90a; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - if (effectsOwner->_redHearts != 2) goto LAB_007cd606; -LAB_007cd657: - local_55 = (effectsOwner->_temporaryeffects)._disabled; - if (local_55 == 0) { - for (piVar5 = (effectsOwner->_temporaryeffects)._effects._begin; - piVar5 != (effectsOwner->_temporaryeffects)._effects._end; piVar5 = piVar5 + 4) { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && (*GHIDRA_CAST((*piVar5 + 4)) == 0x1ba)) - goto LAB_007cd8c2; - } - } - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (0x6e8 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU))) - { - local_54 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x6e8)); - if (local_54 != GHIDRA_CAST(0x0)) { - local_74 = GHIDRA_CAST(local_54->maxCooldown); - effectEntryCount = 0; - VStack_64.y = 0.0; - effectEntryItem = local_54; - VStack_64.x = (float)local_74; - if (local_55 == 0) { - effect = (tempEffects->_effects)._begin; - if (effect != (tempEffects->_effects)._end) { - do { - if (GHIDRA_CAST(*effect) == local_54) { - if (effect != (tempEffects->_effects)._end) { - effect[1] = effect[1] + 1; - effect[2] = (local_74->name)._buf + effect[2] + -8; - goto LAB_007cd76f; - } - break; - } - effect = effect + 4; - } while (effect != (tempEffects->_effects)._end); - } - effect = (tempEffects->_effects)._end; - if (effect == (tempEffects->_effects)._capacity) { - msvc::vector::_Emplace_reallocate(effect,&effectEntryItem); - local_54 = effectEntryItem; - } - else { - *effect = local_54; - effect[1] = 0; - effect[2] = local_74; - effect[3] = 0; - ppvVar8 = &(tempEffects->_effects)._end; - *ppvVar8 = (void *)(GHIDRA_INT(*ppvVar8) + 0x10); - } - local_70 = (tempEffects->_effects)._end; - pvVar1 = (tempEffects->_effects)._begin; - *GHIDRA_CAST((((GHIDRA_INT(local_70) - GHIDRA_INT(pvVar1) & 0xfffffff0U) - 0xc) + GHIDRA_INT(pvVar1))) = 1; - effectEntryItem = local_54; - if (tempEffects->_player != GHIDRA_CAST(0x0)) { - effectEntryItem = local_54; - AddCostume(tempEffects->_player,local_54,0); - } -LAB_007cd76f: - tempEffects->_cacheFlags = tempEffects->_cacheFlags | local_54->cacheFlags; - tempEffects->_shouldEvaluateCache = 1; - } - } - } - pbVar6 = (effectsOwner->_darkPrincesCrownSprite)._animState._animData; - if (pbVar6 == GHIDRA_CAST(0x0)) { -LAB_007cd7e4: - crownAnim = 0x100b6ae50; - } - else { - animNameChar = pbVar6; - if (0xf < *GHIDRA_CAST((pbVar6 + 0x14))) { - animNameChar = *GHIDRA_CAST(pbVar6); - } - expectedChar = "FloatGlow"; - do { - bVar2 = *animNameChar; - isLess = bVar2 < (uint8_t)*expectedChar; - if (bVar2 != *expectedChar) { -LAB_007cd7b4: - swapDwordTmp = -GHIDRA_UINT(isLess) | 1; - goto LAB_007cd7b9; - } - if (bVar2 == 0) break; - bVar2 = animNameChar[1]; - isLess = bVar2 < (uint8_t)expectedChar[1]; - if (bVar2 != expectedChar[1]) goto LAB_007cd7b4; - animNameChar = animNameChar + 2; - expectedChar = expectedChar + 2; - } while (bVar2 != 0); - swapDwordTmp = 0; -LAB_007cd7b9: - if (swapDwordTmp != 0) goto LAB_007cd7e4; - if ((pbVar6[0x34] == 0) || ((effectsOwner->_darkPrincesCrownSprite)._animState._isPlaying != 0)) - goto LAB_007cd8c2; - crownAnim = 0x100b6ae50; - } -LAB_007cd8ab: - bVar2 = ANM2::SetAnimation(&effectsOwner->_darkPrincesCrownSprite,GHIDRA_CAST(crownAnim), - (uint8_t)((uint64_t)crownAnim >> 0x20)); - if (bVar2 != 0) { - AnimationState::Rewind(&(effectsOwner->_darkPrincesCrownSprite)._animState); - (effectsOwner->_darkPrincesCrownSprite)._animState._isPlaying = 1; - } - } - else { - fVar11 = (float)effectsOwner->_redHearts / (float)effectsOwner->_maxHearts; - if ((0.1 <= fVar11) && (fVar11 <= 0.3)) goto LAB_007cd657; -LAB_007cd606: - if ((effectsOwner->_temporaryeffects)._disabled == 0) { - for (piVar5 = (effectsOwner->_temporaryeffects)._effects._begin; - piVar5 != (effectsOwner->_temporaryeffects)._effects._end; piVar5 = piVar5 + 4) { - iVar9 = *GHIDRA_CAST(*piVar5); - if ((((iVar9 == 1) || (iVar9 == 3)) || (iVar9 == 4)) && ((GHIDRA_CAST(*piVar5))[1] == 0x1ba)) { - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if ((0x6e8 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & - 0xfffffffcU))) && (iVar9 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x6e8)), iVar9 != 0)) { - local_78 = *GHIDRA_CAST((iVar9 + 0x78)); - crownEffectKey[1] = 0; - local_74 = GHIDRA_CAST(0x0); - crownEffectKey[0] = iVar9; - (GHIDRA_CAST((&effectsOwner->_temporaryeffects)))->TemporaryEffects::RemoveEffect(crownEffectKey,1); - } - pbVar6 = (effectsOwner->_darkPrincesCrownSprite)._animState._animData; - if (pbVar6 == GHIDRA_CAST(0x0)) goto LAB_007cd8a4; - animNameChar = pbVar6; - if (0xf < *GHIDRA_CAST((pbVar6 + 0x14))) { - animNameChar = *GHIDRA_CAST(pbVar6); - } - expectedChar = "FloatNoGlow"; - goto LAB_007cd860; - } - } - } - } -LAB_007cd8c2: - bVar2 = HasCollectible(effectsOwner,0x19f,0); - if (bVar2 == 0) { - (effectsOwner->_darkPrincesCrownSprite)._offset.x = g_vectorZero.x; - (effectsOwner->_darkPrincesCrownSprite)._offset.y = g_vectorZero.y; - } - else { - (effectsOwner->_darkPrincesCrownSprite)._offset.x = 0.0; - (effectsOwner->_darkPrincesCrownSprite)._offset.y = -7.0; - } -LAB_007cd90a: - effectsOwner->_cacheFlags = effectsOwner->_cacheFlags | 0xffff; - effectsOwner->_itemHoldCooldown = 10; - EvaluateItems(effectsOwner); - stop_costume_item_anims(effectsOwner); - update_player_skin(effectsOwner); - update_purity_glow(effectsOwner); - ExceptionList = savedExceptionList; - return 1; -} - -// 007ce270 -Entity_Player * Entity_Player::GetMainPlayer() -{ - Entity_Player *firstPlayer; - - firstPlayer = GHIDRA_CAST(this->_parent); - if ((firstPlayer == GHIDRA_CAST(0x0)) || (firstPlayer->_type != 1)) { - if (this->_variant == 1) { - firstPlayer = Game::GetPlayer(g_game,0); - return firstPlayer; - } - firstPlayer = GHIDRA_CAST(0x0); - } - return firstPlayer; -} - -// 007ce2a0 -uint8_t Entity_Player::CanRerollCollectible(int id, uint8_t unk) -{ - uint8_t isQuestItem; - ChallengeParam *challengeParams; - int challengeItem; - Manager *manager; - int *challengeItemIter; - bool isBlocked; - int challengeItem; - - if (id == 0x102) { - return 0; - } - if (id == 0x290) { - return 0; - } - isQuestItem = ItemConfig::IsQuestItem(id); - if (isQuestItem != 0) { - return 0; - } - if (g_game->_challenge != 0) { - isBlocked = false; - challengeParams = Manager::GetChallengeParams(manager,g_game->_challenge); - challengeItemIter = (challengeParams->_collectibleList)._begin; - challengeItem = GHIDRA_INT((challengeParams->_collectibleList)._end) - GHIDRA_INT(challengeItemIter) >> 2; - if (challengeItem != 0) { - do { - challengeItem = *challengeItemIter; - challengeItemIter = challengeItemIter + 1; - if (challengeItem == id) { - isBlocked = true; - } - challengeItem = challengeItem + -1; - } while (challengeItem != 0); - if (isBlocked) { - return 0; - } - } - } - if (unk == 0) { - challengeItem = this->_playerType; - if (challengeItem == 2) { - isBlocked = id == 0x2e; - } - else if (challengeItem == 5) { - if (id == 0x75) { - return 0; - } - isBlocked = id == 0x7a; - } - else if (challengeItem == 6) { - isBlocked = id == 0x9d; - } - else if (challengeItem == 8) { - isBlocked = id == 0xd6; - } - else if (challengeItem == 10) { - isBlocked = id == 0x139; - } - else { - if (challengeItem != 0xd) { - if (challengeItem != 0x12) { - return 1; - } - if (id == 0x248) { - return 0; - } - return 1; - } - if (id == 0x168) { - return 0; - } - isBlocked = id == 0x19c; - } - if (isBlocked) { - return 0; - } - } - return 1; -} - -// 007ce390 -int Entity_Player::GetGreedsGulletHearts() -{ - uint8_t isGreedsGullet; - int iVar1; - int hearts; - - hearts = 0; - isGreedsGullet = HasCollectible(this,0x1f5,0); - if (isGreedsGullet != 0) { - iVar1 = this->_numCoins; - if (99 < iVar1) { - hearts = GetTrinketMultiplier(this,0x9c); - return hearts + iVar1 / 100 + 3; - } - if (iVar1 == 99) { - hearts = GetTrinketMultiplier(this,0x9c); - return hearts + 4; - } - hearts = 0; - if (0 < iVar1) { - hearts = iVar1; - } - hearts = hearts / 0x19; - } - iVar1 = GetTrinketMultiplier(this,0x9c); - return iVar1 + hearts; -} - -// 007ce420 -void Entity_Player::update_greeds_gullet() -{ - uint8_t isHeld; - int iVar1; - int iVar2; - int iVar3; - short cappedHearts; - short sVar4; - int amount; - short extraout_DX; - int extraout_EDX; - int extraout_EDX_00; - Entity_Player *healthPlayer; - - if (g_game->_isRestoringGlowingHourglassState != 0) { - return; - } - if (g_game->_isStartingFromState != 0) { - return; - } - healthPlayer = this; - if ((this->_playerType == 0x11) && (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0))) { - healthPlayer = GHIDRA_CAST(this->_subPlayer); - } - if (healthPlayer->_isUpdatingGreedsGullet != 0) { - return; - } - healthPlayer->_isUpdatingGreedsGullet = 1; - sVar4 = this->_greedsGulletHearts; - iVar1 = GHIDRA_INT(sVar4); - this->_isUpdatingGreedsGullet = 1; - iVar2 = GetHealthType(healthPlayer); - switch(iVar2) { - case 0: - case 3: - iVar2 = healthPlayer->_maxHearts; - break; - case 1: - iVar2 = healthPlayer->_soulHearts + 1; - break; - default: - goto switchD_007ce498_caseD_2; - case 4: - cappedHearts = (short)healthPlayer->_boneHearts + this->_greedsGulletOverflow; - if (cappedHearts < sVar4) { - sVar4 = cappedHearts; - } - goto LAB_007ce4e1; - } - cappedHearts = (short)(iVar2 >> 1) + this->_greedsGulletOverflow; - if (cappedHearts < sVar4) { - sVar4 = cappedHearts; - } -LAB_007ce4e1: - this->_greedsGulletHearts = sVar4; -switchD_007ce498_caseD_2: - if (sVar4 < iVar1) { - isHeld = HasTrinket(this,0x9c,0); - if (isHeld != 0) { - TryRemoveTrinket(this,0x9c); - iVar1 = iVar1 + -1; - } - if (this->_greedsGulletHearts < iVar1) { - do { - iVar1 = iVar1 + -1; - if (iVar1 < 3) { - iVar2 = -0x19; - } - else if (iVar1 == 3) { - iVar2 = -0x18; - } - else { - iVar2 = (iVar1 != 4) - 0x65; - } - AddCoins(this,iVar2); - } while (this->_greedsGulletHearts < iVar1); - } - } - iVar1 = GetGreedsGulletHearts(this); - iVar2 = GHIDRA_INT(this->_greedsGulletHearts); - if ((iVar1 != iVar2) || (0 < this->_greedsGulletOverflow)) { - if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && - ((iVar2 < iVar1 && (this->_greedsGulletRedHearts < iVar1)))) { - iVar3 = scale_for_hard_difficulty((iVar1 - iVar2) * 2); - this->_redHearts = this->_redHearts + iVar3; - this->_greedsGulletRedHearts = extraout_DX; - } - iVar3 = GetHealthType(healthPlayer); - sVar4 = (short)iVar1; - switch(iVar3) { - case 0: - case 3: - iVar3 = (this->_greedsGulletOverflow - iVar2) + extraout_EDX; - iVar1 = healthPlayer->_maxHearts; - iVar2 = iVar3 * 8; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - iVar2 = iVar3; - } - AddMaxHearts(healthPlayer,iVar3 * 2,0); - this->_greedsGulletHearts = sVar4; - iVar1 = (iVar2 + (iVar1 >> 1)) - (healthPlayer->_maxHearts >> 1); - break; - case 1: - iVar2 = scale_for_hard_difficulty(extraout_EDX + (this->_greedsGulletOverflow - iVar2)); - iVar1 = healthPlayer->_soulHearts; - AddSoulHearts(healthPlayer,extraout_EDX_00 * 2,0); - this->_greedsGulletHearts = sVar4; - iVar1 = ((iVar1 + 1 >> 1) + iVar2) - (healthPlayer->_soulHearts + 1 >> 1); - break; - default: - goto switchD_007ce5c5_caseD_2; - case 4: - iVar2 = scale_for_hard_difficulty((this->_greedsGulletOverflow - iVar2) + extraout_EDX); - iVar1 = healthPlayer->_boneHearts; - AddBoneHearts(healthPlayer,amount); - this->_greedsGulletHearts = sVar4; - iVar1 = (iVar2 + iVar1) - healthPlayer->_boneHearts; - } - sVar4 = 0; - if (0 < iVar1) { - sVar4 = (short)iVar1; - } - this->_greedsGulletOverflow = sVar4; - } -switchD_007ce5c5_caseD_2: - healthPlayer->_isUpdatingGreedsGullet = 0; - this->_isUpdatingGreedsGullet = 0; - return; -} - -// 007ce6e0 -void Entity_Player::ChangePlayerType(int playerType, uint8_t unk) -{ - code *pcVar1; - uint8_t bVar2; - Entity_Player *pEVar3; - ItemConfig_Item *Item; - float *pfVar4; - int iVar5; - void *pvVar6; - Vector *pos; - uint8_t *nameCursor; - int *extraout_EAX; - Entity_Player *subPlayer; - uint32_t extraout_ECX; - int *piVar7; - uint32_t uVar8; - uint32_t uVar9; - void *pvVar10; - bool isLess; - RNG heartRng; - int twinRedHearts; - int local_50; - int twinRottenHearts; - int oldPlayerType; - float local_44; - uint32_t local_40; - Entity_Player *local_3c; - Vector local_38; - uint8_t local_2d; - Entity_Player *animName [4]; - int animNameSize; - float animNameCapacity; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - Entity_Player *local_8; - uint8_t *curAnim; - uint32_t *flagsHigh; - Game *game; - uint64_t oldFlags; - short *smeltedCount; - int twinPlayer; - - local_8 = GHIDRA_CAST(0xffffffff); - puStack_c = &LAB_00b001ff; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((animName + 10)); - if (playerType < 0) { - return; - } - ExceptionList = &local_10; - local_3c = this; - if (unk != 0) { - if (playerType == 0x10) { - if (this->_playerType == 0x11) { -LAB_007cea0f: - SwapForgottenForm(this,1,1); - ExceptionList = local_10; - return; - } - } - else if ((playerType == 0x11) && (this->_playerType == 0x10)) goto LAB_007cea0f; - } - uVar8 = 0; - if (((this->_playerType == 0x12) && - (local_38.y = (float)this->_effectiveSoulCharge, 0 < GHIDRA_INT(local_38.y))) && (unk == 0)) { - twinPlayer = 0; - iVar5 = twinPlayer; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - pEVar3 = Game::GetPlayer(g_game,uVar8); - twinPlayer = iVar5 + 1; - if (pEVar3->_playerType != 0x12) { - twinPlayer = iVar5; - } - uVar8 = uVar8 + 1; - iVar5 = twinPlayer; - } while (uVar8 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - uVar8 = GHIDRA_INT(local_38.y) / twinPlayer; - if (uVar8 == 0) { - uVar8 = 1; - } - } - RemoveSkinCostume(this); - oldPlayerType = this->_playerType; - if (oldPlayerType == 0xb) { - oldPlayerType = 0xb; - local_38.y = (float)(g_manager->_entityConfig)._players._begin; - if ((8 < (GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(local_38.y)) / 0x148) && - ((void *)local_38.y != (void *)0xfffff5c0)) { - oldPlayerType = 0xb; - if (*GHIDRA_CAST((GHIDRA_CAST(local_38.y) + 0xaec)) != -1) { - Item = (GHIDRA_CAST((&g_manager->_itemConfig)))->Config::GetNullItem(*GHIDRA_CAST((GHIDRA_CAST(local_38.y) + 0xaec))); - RemoveCostume(this,Item); - oldPlayerType = this->_playerType; - } - } - } - this->_playerType = playerType; - if (0 < GHIDRA_INT(uVar8)) { - AddSoulCharge(this,-uVar8); - AddSoulHearts(this,uVar8,0); - } - if (oldPlayerType == 0x23) { - twinPlayer = this->_twinPlayer; - if (twinPlayer != 0) { - local_38.x = *GHIDRA_CAST((twinPlayer + 0x33c)); - local_38.y = *GHIDRA_CAST((twinPlayer + 0x340)); - Teleport(this,&local_38,0,0); - } - oldFlags = this->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHigh = *flagsHigh & 0xfbffffff; - (this->_posOffset).y = 0.0; - this->_heightVelocity = 0.0; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(oldFlags); - } - pEVar3 = GHIDRA_CAST(GetHealthType(this)); - local_40 = this->_subPlayer; - if (local_40 != 0) { - twinPlayer = this->_soulHearts; - iVar5 = this->_boneHearts; - bVar2 = (uint8_t)((twinPlayer + 1) / 2); - local_3c->_maxHearts = local_3c->_maxHearts + *GHIDRA_CAST((local_40 + 0x1340)); - local_3c->_redHearts = local_3c->_redHearts + *GHIDRA_CAST((local_40 + 0x1344)); - local_3c->_soulHearts = *GHIDRA_CAST((local_40 + 0x134c)) + twinPlayer; - twinPlayer = local_3c->_subPlayer; - local_3c->_boneHearts = *GHIDRA_CAST((local_40 + 0x1d88)) + iVar5; - local_3c->_blackHearts = - local_3c->_blackHearts | *GHIDRA_CAST((twinPlayer + 0x1350)) << (bVar2 & 0x1f); - local_3c->_boneHeartsMask = - local_3c->_boneHeartsMask | *GHIDRA_CAST((twinPlayer + 0x1d8c)) << ((char)iVar5 + bVar2 & 0x1f); - local_3c->_eternalHearts = local_3c->_eternalHearts + *GHIDRA_CAST((twinPlayer + 0x1348)); - local_3c->_rottenHearts = local_3c->_rottenHearts + *GHIDRA_CAST((twinPlayer + 0x1da4)); - local_3c->_goldenHearts = local_3c->_goldenHearts + *GHIDRA_CAST((twinPlayer + 0x194c)); - this = local_3c; - } - local_38.y = (float)pEVar3; - init_forgotten_twin(this); - if (GHIDRA_CAST(this->_subPlayer) != GHIDRA_CAST(0x0)) { - twinPlayer = GetHealthType(GHIDRA_CAST(this->_subPlayer)); - if (twinPlayer == 1) { - subPlayer->_soulHearts = this->_soulHearts; - *GHIDRA_CAST((this->_subPlayer + 0x1350)) = this->_blackHearts; - this->_soulHearts = 0; - this->_blackHearts = 0; - } - else if (twinPlayer == 4) { - AddBoneHearts(subPlayer,this->_boneHearts); - *GHIDRA_CAST((this->_subPlayer + 0x1344)) = this->_redHearts; - this->_redHearts = 0; - this->_boneHearts = 0; - this->_boneHeartsMask = 0; - } - if (1 < this->_eternalHearts) { - this->_eternalHearts = this->_eternalHearts + -1; - piVar7 = GHIDRA_CAST((this->_subPlayer + 0x1348)); - *piVar7 = *piVar7 + 1; - } - update_bone_hearts(GHIDRA_CAST(this->_subPlayer)); - } - if (pEVar3 == GHIDRA_CAST(0x2)) { - this->_rottenHearts = 0; - this->_boneHeartsMask = 0; - this->_boneHearts = 0; - this->_eternalHearts = 0; - this->_maxHearts = 0; - this->_redHearts = 0; - this->_soulHearts = 1; -LAB_007ceb8b: - this->_blackHearts = 0; - } - else { - if (pEVar3 == GHIDRA_CAST(0x3)) { - local_38.y = 1.4013e-45; - pfVar4 = &local_38.y; - if (this->_brokenHearts < 2) { - pfVar4 = GHIDRA_CAST(&this->_brokenHearts); - } - this->_brokenHearts = GHIDRA_INT(*pfVar4); - AddMaxHearts(this,4,0); - this->_rottenHearts = 0; - this->_boneHeartsMask = 0; - this->_boneHearts = 0; -LAB_007ceb81: - this->_soulHearts = 0; - goto LAB_007ceb8b; - } - if (pEVar3 == GHIDRA_CAST(0x1)) { - this->_rottenHearts = 0; - this->_maxHearts = 0; - this->_redHearts = 0; - } - else if (pEVar3 == GHIDRA_CAST(&DAT_00000004)) { - twinPlayer = this->_maxHearts; - this->_maxHearts = 0; - twinPlayer = twinPlayer / 2; - if (0 < twinPlayer) { - AddBoneHearts(this,twinPlayer); - } - local_38.y = (float)GetEffectiveMaxHearts(this); - piVar7 = &this->_redHearts; - pfVar4 = &local_38.y; - if (*piVar7 <= GHIDRA_INT(local_38.y)) { - pfVar4 = GHIDRA_CAST(piVar7); - } - *piVar7 = GHIDRA_INT(*pfVar4); - goto LAB_007ceb81; - } - } - if (this->_isCoopGhost == 0) { - TryPreventDeath(this); - } - update_bone_hearts(this); - UpdateHeartDependentEffects(this); - UpdateCanShoot(this); - AddEternalHearts(this,0); - twinPlayer = this->_twinPlayer; - if (twinPlayer == 0) { -LAB_007ceccc: - if (this->_playerType == 0x13) { -LAB_007cecd9: - if (unk == 0) { - local_3c = InitTwin(this,0x14); - InitPostLevelInitStats(local_3c); - heartRng._shift3 = 0x17; - heartRng._seed = *GHIDRA_CAST((GHIDRA_INT((this->_collectibleRNGs)._begin) + 0x1e20)); - heartRng._shift1 = 8; - heartRng._shift2 = 9; - uVar9 = (this->_maxHearts + 1) / 2; - uVar8 = uVar9 & 0x80000001; - if (GHIDRA_INT(uVar8) < 0) { - uVar8 = (uVar8 - 1 | 0xfffffffe) + 1; - } - uVar8 = (GHIDRA_CAST((&heartRng)))->RNG::RandomInt(uVar8 + 1); - uVar8 = (uVar8 + GHIDRA_INT(uVar9) / 2) * 2; - uVar9 = this->_boneHearts & 0x80000001; - if (GHIDRA_INT(uVar9) < 0) { - uVar9 = (uVar9 - 1 | 0xfffffffe) + 1; - } - local_40 = uVar8; - uVar9 = (GHIDRA_CAST((&heartRng)))->RNG::RandomInt(uVar9 + 1); - local_50 = uVar9 + this->_boneHearts / 2; - twinPlayer = uVar8 + local_50 * 2; - uVar8 = this->_redHearts; - uVar9 = uVar8 & 0x80000001; - if (GHIDRA_INT(uVar9) < 0) { - uVar9 = (uVar9 - 1 | 0xfffffffe) + 1; - } - uVar9 = (GHIDRA_CAST((&heartRng)))->RNG::RandomInt(uVar9 + 1); - twinRedHearts = uVar9 + GHIDRA_INT(uVar8) / 2; - if (twinPlayer < twinRedHearts) { - twinRedHearts = twinPlayer; - } - uVar9 = this->_rottenHearts; - iVar5 = local_40 + - (((local_50 - this->_boneHearts) * 2 - this->_maxHearts) - twinRedHearts) + uVar8; - twinPlayer = 0; - if (0 < iVar5) { - twinPlayer = iVar5; - } - twinRedHearts = twinRedHearts + twinPlayer; - uVar8 = uVar9 & 0x80000001; - if (GHIDRA_INT(uVar8) < 0) { - uVar8 = (uVar8 - 1 | 0xfffffffe) + 1; - } - uVar8 = (GHIDRA_CAST((&heartRng)))->RNG::RandomInt(uVar8 + 1); - twinPlayer = uVar8 + GHIDRA_INT(uVar9) / 2; - twinRottenHearts = (twinRedHearts + 1) / 2; - if (twinPlayer < twinRottenHearts) { - twinRottenHearts = twinPlayer; - } - iVar5 = (uVar9 - (this->_redHearts - twinRedHearts) / 2) - twinRottenHearts; - twinPlayer = 0; - if (0 < iVar5) { - twinPlayer = iVar5; - } - twinRottenHearts = twinRottenHearts + twinPlayer; - uVar8 = this->_soulHearts & 0x80000001; - if (GHIDRA_INT(uVar8) < 0) { - uVar8 = (uVar8 - 1 | 0xfffffffe) + 1; - } - uVar8 = (GHIDRA_CAST((&heartRng)))->RNG::RandomInt(uVar8 + 1); - local_44 = (float)(uVar8 + this->_soulHearts / 2); - uVar8 = this->_goldenHearts & 0x80000001; - if (GHIDRA_INT(uVar8) < 0) { - uVar8 = (uVar8 - 1 | 0xfffffffe) + 1; - } - uVar8 = (GHIDRA_CAST((&heartRng)))->RNG::RandomInt(uVar8 + 1); - pEVar3 = local_3c; - local_38.y = (float)(uVar8 + this->_goldenHearts / 2); - local_3c->_maxHearts = local_40; - AddBoneHearts(local_3c,local_50); - twinPlayer = twinRedHearts; - pEVar3->_soulHearts = GHIDRA_INT(local_44); - pEVar3->_redHearts = twinRedHearts; - pEVar3->_blackHearts = - pEVar3->_blackHearts | - this->_blackHearts << ((uint8_t)((this->_soulHearts - GHIDRA_INT(local_44)) / 2) & 0x1f); - pEVar3->_goldenHearts = GHIDRA_INT(local_38.y); - pEVar3->_rottenHearts = twinRottenHearts; - pEVar3->_brokenHearts = this->_brokenHearts; - if (0 < GHIDRA_INT(local_44)) { - AddSoulHearts(this,-GHIDRA_INT(local_44),0); - } - if (0 < twinPlayer) { - AddHearts(this,-twinPlayer,0,0); - } - if (0 < local_50) { - AddBoneHearts(this,-local_50); - } - if (0 < GHIDRA_INT(local_40)) { - AddMaxHearts(this,-local_40,0); - } - this->_goldenHearts = this->_goldenHearts - GHIDRA_INT(local_38.y); - this->_rottenHearts = this->_rottenHearts - twinRottenHearts; - if (this->_soulHearts + this->_redHearts + this->_boneHearts < 1) { - AddSoulHearts(this,1,0); - } - if (pEVar3->_boneHearts + pEVar3->_redHearts + pEVar3->_soulHearts < 1) { - AddSoulHearts(pEVar3,1,0); - } - if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && (this->_dead == 0)) && - (0 < this->_goldenHearts)) { - twinPlayer = (this->_soulHearts + 1) / 2 + - (*GHIDRA_CAST((GHIDRA_INT((&this->_headAnim + 1)) + - ((this->_redHearts <= this->_maxHearts) + 2) * 4)) + 1) / 2 + - this->_boneHearts; - if (twinPlayer < this->_goldenHearts) { - BreakGoldenHearts(this,this->_goldenHearts - twinPlayer); - this->_goldenHearts = twinPlayer; - } - } - update_bone_hearts(this); - UpdateHeartDependentEffects(this); - ClampGoldenHearts(pEVar3,0); - update_bone_hearts(pEVar3); - UpdateHeartDependentEffects(pEVar3); - (this->_history)._isLocked = 1; - pvVar10 = (this->_history)._historyItems._begin; - if (pvVar10 != (this->_history)._historyItems._end) { - uVar8 = heartRng._seed; - do { - local_40 = *GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 8)); - local_2d = '\0'; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 4)) == '\0') { - local_38.y = (float)ItemConfig::GetCollectible(&g_manager->_itemConfig,local_40); - bVar2 = CanRerollCollectible(this,local_40,0); - if (((bVar2 != 0) && (*GHIDRA_CAST(local_38.y) != 3)) && - (local_44 = (float)(local_40 * 4), - 0 < *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + GHIDRA_INT(local_44))))) { - if (uVar8 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar8 = uVar8 >> ((uint8_t)heartRng._shift1 & 0x1f) ^ uVar8; - uVar8 = uVar8 << ((uint8_t)heartRng._shift2 & 0x1f) ^ uVar8; - uVar8 = uVar8 >> ((uint8_t)heartRng._shift3 & 0x1f) ^ uVar8; - if ((uVar8 & 1) == 0) { - piVar7 = GHIDRA_CAST((GHIDRA_INT(local_44) + GHIDRA_INT((local_3c->_collectibleCounts)._begin))); - *piVar7 = *piVar7 + 1; - if (*GHIDRA_CAST((GHIDRA_INT(&((GHIDRA_CAST((GHIDRA_INT(local_38.y) + 0x48)))->_overlayAnimState)). - _currentlyTriggeredEvents + 2)) != '\0') { - AddCostume(local_3c,GHIDRA_CAST(local_38.y),0); - } - (GHIDRA_CAST((&local_3c->_history)))->History::AddHistoryItem(pvVar10); - piVar7 = GHIDRA_CAST(std)::vector::erase(&local_50,pvVar10); - pvVar10 = (void *)*piVar7; - History::remove_index_refs - (&this->_history, - (GHIDRA_INT(pvVar10) - GHIDRA_INT((this->_history)._historyItems._begin)) / 0x1c); - local_2d = '\x01'; - RemoveCollectible(this,local_40,1,0,1); - } - } - } - else { - uVar9 = local_40 & 0x7fff; - pvVar6 = (g_manager->_itemConfig)._trinkets._begin; - if (GHIDRA_INT(uVar9) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar6) >> 2) { - local_38.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + uVar9 * 4)); - } - else { - local_38.y = 0.0; - } - pvVar6 = (this->_smeltedTrinkets)._begin; - local_44 = (float)(uVar9 * 4); - if ((0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + GHIDRA_INT(local_44)))) || - (0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + GHIDRA_INT(local_44) + 2)))) { - if (uVar8 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar8 = uVar8 >> ((uint8_t)heartRng._shift1 & 0x1f) ^ uVar8; - uVar8 = uVar8 << ((uint8_t)heartRng._shift2 & 0x1f) ^ uVar8; - uVar8 = uVar8 >> ((uint8_t)heartRng._shift3 & 0x1f) ^ uVar8; - if ((uVar8 & 1) == 0) { - pvVar6 = (local_3c->_smeltedTrinkets)._begin; - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + GHIDRA_INT(local_44))) < 1) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + GHIDRA_INT(local_44) + 2)) < 1)) { - AddCostume(local_3c,GHIDRA_CAST(local_38.y),0); - pvVar6 = (local_3c->_smeltedTrinkets)._begin; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 8)) & 0x8000) == 0) { - *GHIDRA_CAST((GHIDRA_CAST(local_44) + GHIDRA_INT(pvVar6))) = - *GHIDRA_CAST((GHIDRA_CAST(local_44) + GHIDRA_INT(pvVar6))) + 1; - } - else { - smeltedCount = GHIDRA_CAST((GHIDRA_INT(local_44) + 2 + GHIDRA_INT(pvVar6))); - *smeltedCount = *smeltedCount + 1; - } - (GHIDRA_CAST((&local_3c->_history)))->History::AddHistoryItem(pvVar10); - TryRemoveSmeltedTrinket(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 8))); - piVar7 = GHIDRA_CAST(std)::vector::erase(&twinRedHearts,pvVar10); - pvVar10 = (void *)*piVar7; - History::remove_index_refs - (&this->_history, - (GHIDRA_INT(pvVar10) - GHIDRA_INT((this->_history)._historyItems._begin)) / 0x1c); - local_2d = '\x01'; - } - } - } - pvVar6 = (void *)(GHIDRA_INT(pvVar10) + 0x1c); - if (local_2d != '\0') { - pvVar6 = pvVar10; - } - pvVar10 = pvVar6; - } while (pvVar6 != (this->_history)._historyItems._end); - pEVar3 = local_3c; - } - (this->_history)._isLocked = 0; - pEVar3->_cacheFlags = 0xffff; - EvaluateItems(pEVar3); - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - uVar9 = 0; - uVar8 = GetMaxPocketItems(this); - if (uVar8 != 0) { - do { - pos = Room::FindFreePickupSpawnPosition(g_game->_room,&local_38,&this->_pos,0.0,0,0,0); - DropPocketItem(this,uVar9,pos); - uVar9 = uVar9 + 1; - uVar8 = GetMaxPocketItems(this); - } while (uVar9 < uVar8); - } - } - } - } - else { - if (this->_playerType == 0x13) goto LAB_007cecd9; - if (unk != 0) goto LAB_007ceccc; - iVar5 = this->_soulHearts; - local_38.y = (float)*GHIDRA_CAST((twinPlayer + 0x1da0)); - piVar7 = &this->_brokenHearts; - pfVar4 = &local_38.y; - if (GHIDRA_INT(*GHIDRA_CAST((twinPlayer + 0x1da0))) <= *piVar7) { - pfVar4 = GHIDRA_CAST(piVar7); - } - *piVar7 = GHIDRA_INT(*pfVar4); - AddMaxHearts(this,*GHIDRA_CAST((twinPlayer + 0x1340)),0); - AddBoneHearts(this,*GHIDRA_CAST((this->_twinPlayer + 0x1d88))); - AddEternalHearts(this,*GHIDRA_CAST((this->_twinPlayer + 0x1348))); - AddHearts(this,*GHIDRA_CAST((this->_twinPlayer + 0x1344)),1,0); - AddSoulHearts(this,*GHIDRA_CAST((this->_twinPlayer + 0x134c)),0); - AddGoldenHearts(this,*GHIDRA_CAST((this->_twinPlayer + 0x194c)),0); - this->_blackHearts = - this->_blackHearts | *GHIDRA_CAST((this->_twinPlayer + 0x1350)) << ((uint8_t)(iVar5 / 2) & 0x1f); - twinPlayer = this->_rottenHearts + *GHIDRA_CAST((this->_twinPlayer + 0x1da4)); - iVar5 = (this->_redHearts + 1) / 2; - if (iVar5 < twinPlayer) { - twinPlayer = iVar5; - } - this->_rottenHearts = twinPlayer; - UpdateBlackHeartMask(this); - } - if ((this->_playerType == 0x12) && (0 < this->_soulHearts)) { - AddSoulCharge(this,this->_soulHearts); - game = g_game; - this->_soulHearts = 0; - if (*GHIDRA_CAST(&game->_deathmatchManager) < 2) { - this->_blackHearts = 0; - } - twinPlayer = GetHealthType(this); - if ((twinPlayer == 1) || (twinPlayer == 2)) { - twinPlayer = this->_maxHearts; - } - else { - twinPlayer = this->_maxHearts + this->_boneHearts * 2; - } - if (twinPlayer < 1) { - this->_maxHearts = 2; - this->_redHearts = 2; - } - } - if (this->_playerType == 0x19) { - poop_spell_roll(this); - } - if (this->_config == (void *)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Player Config invalid!\n")); - } - pvVar10 = (this->_sprite)._animState._animData; - if (pvVar10 == (void *)0x0) { - animNameCapacity = 2.10195e-44; - animNameSize = 0; - animName[0] = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(animName))))->msvc::string::string(pvVar10); - } - local_8 = GHIDRA_CAST(0x0); - local_2d = (this->_sprite)._animState._isPlaying; - local_44 = (this->_sprite)._animState._animFrame; - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),0); - update_player_skin(this); - this->ResetColor(); - RemoveCollectible(this,oldPlayerType,extraout_ECX); - if (animNameSize == 0) goto LAB_007cf515; - if (local_2d == 0) { - pEVar3 = GHIDRA_CAST(animName); - if (0xf < GHIDRA_UINT(animNameCapacity)) { - pEVar3 = animName[0]; - } - bVar2 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(pEVar3),1); - if (((bVar2 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(local_44)), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } - goto LAB_007cf515; - } - curAnim = (this->_sprite)._animState._animData; - local_38.y = (float)animName; - if (0xf < GHIDRA_UINT(animNameCapacity)) { - local_38.y = (float)animName[0]; - } - if (curAnim == GHIDRA_CAST(0x0)) { -LAB_007cf49f: - bVar2 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST(local_38.y),1); - if (bVar2 != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - } - else { - nameCursor = curAnim; - pEVar3 = GHIDRA_CAST(local_38.y); - if (0xf < *GHIDRA_CAST((curAnim + 0x14))) { - nameCursor = *GHIDRA_CAST(curAnim); - } - do { - bVar2 = *nameCursor; - isLess = bVar2 < *GHIDRA_CAST(pEVar3); - if (bVar2 != *GHIDRA_CAST(pEVar3)) { -LAB_007cf486: - uVar8 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007cf48b; - } - if (bVar2 == 0) break; - bVar2 = nameCursor[1]; - isLess = bVar2 < (*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)pEVar3)) + 0x1))); - if (bVar2 != (*GHIDRA_CAST((GHIDRA_CAST((pEVar3)) + 0x1)))) goto LAB_007cf486; - nameCursor = nameCursor + 2; - pEVar3 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar3)) + 0x2)))); - } while (bVar2 != 0); - uVar8 = 0; -LAB_007cf48b: - if ((uVar8 != 0) || ((curAnim[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) - goto LAB_007cf49f; - } - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,local_44); - } -LAB_007cf515: - if (unk == 0) { - if (this->_playerType == 0x23) { - pEVar3 = InitTwin(this,0x28); - InitPostLevelInitStats(pEVar3); - } - else if ((this->_playerType == 0x1d) && (this->_backupPlayer == (void *)0x0)) { - local_38.y = (float)operator_new(0x2f00); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - if (GHIDRA_CAST(local_38.y) == GHIDRA_CAST(0x0)) { - piVar7 = GHIDRA_CAST(0x0); - } - else { - constructor(GHIDRA_CAST(local_38.y)); - piVar7 = extraout_EAX; - } - local_8 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8)); - this->_backupPlayer = piVar7; - (**(code **)(*piVar7 + 4))(this->_type,this->_variant,0x26,this->_initSeed); - *GHIDRA_CAST((GHIDRA_CAST(this->_backupPlayer) + 0x1e6c)) = this; - } - } - this->_cacheFlags = 0xffff; - EvaluateItems(this); - apply_innate_collectibles(this); - UpdateCostumes(this); - if (0xf < GHIDRA_UINT(animNameCapacity)) { - uVar8 = GHIDRA_INT(animNameCapacity) + 1; - pEVar3 = animName[0]; - if (0xfff < uVar8) { - pEVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(animName[0][-1])) + 0x2efc)))); - uVar8 = GHIDRA_INT(animNameCapacity) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(animName[0]) + (-4 - GHIDRA_INT(pEVar3))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pEVar3,uVar8); - } - ExceptionList = local_10; - return; -} - -// 007cf610 -void Entity_Player::RemoveCollectible(int param_2) -{ - code *pcVar1; - uint8_t bVar2; - int playerType; - uint32_t *eraseResult; - uint32_t uVar3; - Entity_Player *extraout_ECX; - Entity_Player *this_00; - Entity_Player *extraout_ECX_00; - void *pvVar4; - bool isPairedType; - uint8_t eraseOut [4]; - uint32_t tempEffect; - uint32_t local_28; - int effectCooldown; - uint32_t local_20; - Entity_Player *local_1c; - uint64_t local_14; - uint32_t local_8; - - local_8 = __security_cookie ^ GHIDRA_UINT((eraseOut + 0x2c)); - playerType = this->_playerType; - if (param_2 == playerType) { - return; - } - if (playerType == 0x25) { - isPairedType = param_2 == 0x27; -LAB_007cf648: - if (isPairedType) { - return; - } - } - else if (playerType == 0x27) { - isPairedType = param_2 == 0x25; - goto LAB_007cf648; - } - if (this->_twinPlayer != 0) { - if (*GHIDRA_CAST((this->_twinPlayer + 0x13c0)) == param_2) { - return; - } - if (param_2 == 0x13) { - if (playerType == 0x13) goto LAB_007cf690; - } - else { - if (param_2 != 0x23) goto LAB_007cf67f; - if (playerType == 0x23) goto LAB_007cf690; - } - remove_twin(); - } -LAB_007cf67f: - if ((param_2 == 0x1d) || (param_2 == 0x26)) { - remove_twin(); - } -LAB_007cf690: - playerType = this->_playerType; - if (playerType == 0x15) { - bVar2 = HasCollectible(this,0x26b,0); - (this->_history)._isLocked = 1; - pvVar4 = (this->_history)._historyItems._begin; - this_00 = GHIDRA_CAST((GHIDRA_UINT((bVar2 != 0)) * 4 + 8)); - local_1c = this_00; - if (pvVar4 != (this->_history)._historyItems._end) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 4)) == '\0') { - uVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 8)); - bVar2 = CanAddCollectibleToInventory(this_00,uVar3); - this_00 = extraout_ECX; - if (bVar2 == 0) goto LAB_007cf6f6; - if (0 < GHIDRA_INT(local_1c)) { - this_00 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_1c[-1])) + 0x2eff)))); - local_1c = this_00; - goto LAB_007cf6f6; - } - if (0 < *GHIDRA_CAST((GHIDRA_INT((this->_collectibleCounts)._begin) + uVar3 * 4))) { - RemoveCollectible(this,uVar3,1,0,1); - } - eraseResult = GHIDRA_CAST(std)::vector::erase(eraseOut,pvVar4); - pvVar4 = (void *)*eraseResult; - this_00 = extraout_ECX_00; - } - else { -LAB_007cf6f6: - pvVar4 = (void *)(GHIDRA_INT(pvVar4) + 0x1c); - } - } while (pvVar4 != (this->_history)._historyItems._end); - } - (this->_history)._isLocked = 0; - FUN_00721eb0(); - playerType = this->_playerType; - } - if (((playerType == 0x25) || (playerType == 0x27)) && - (bVar2 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x6d), bVar2 == 0)) { - pvVar4 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar4) & 0xfffffffcU)) < 0x1b5) { - tempEffect = 0; - } - else { - tempEffect = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x1b4)); - } - local_28 = 0; - local_20 = 0; - local_14 = 0x70000000b; - uVar3 = (g_game->_devilAngelRoomRNG)._seed; - local_1c = GHIDRA_CAST(0xc); - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = uVar3 >> 0xb ^ uVar3; - uVar3 = uVar3 << 7 ^ uVar3; - effectCooldown = ((uVar3 >> 0xc ^ uVar3) % 3) * 0x1e + 100; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&tempEffect,1,1); - } - if (param_2 == 0x23) { - this->_cacheFlags = this->_cacheFlags | 0x80; - this->_canFly = 1; - EvaluateItems(this); - } - playerType = this->_playerType; - if ((playerType < 0) || - (pvVar4 = (g_manager->_entityConfig)._players._begin, - (GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(pvVar4)) / 0x148 <= playerType)) { - pvVar4 = (void *)0x0; - } - else { - pvVar4 = (void *)(playerType * 0x148 + GHIDRA_INT(pvVar4)); - } - SetPocketActiveItem(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xf0)),2,0); - HUD::mark_all_slots_dirty(&g_game->_hud,1,1); - return; -} - -// 007cf8c0 -uint8_t Entity_Player::IsLocalPlayer() -{ - uint8_t isLocal; - - if (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) { - return 1; - } - isLocal = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),this->_controllerIndex); - return isLocal; -} - -// 007d12c0 -void Entity_Player::GetGlyphOfBalanceDrop(int *variant, int *subtype) -{ - int iVar1; - int iVar2; - uint32_t bombsOrMana; - EntityList_EL *trinketList; - int effectiveMaxHearts; - bool isQueryMade; - Entity_Player *this_00; - Entity_Player *this_01; - EntityList_EL trinketQuery; - bool isDropTrinket; - bool isSoulHealth; - - isQueryMade = false; - iVar1 = GetHealthType(this); - if (((iVar1 == 0) || (iVar1 = GetHealthType(this_00), iVar1 == 4)) && (this->_playerType != 0x12)) - { - isSoulHealth = true; - } - else { - isSoulHealth = false; - } - if (this->_redHearts < 2) { - iVar1 = GetHealthType(this); - if ((iVar1 == 1) || (iVar1 == 2)) { - iVar1 = this->_maxHearts; - } - else { - iVar1 = this->_maxHearts + this->_boneHearts * 2; - } - if ((1 < iVar1) && - ((iVar1 = GetHealthType(this), iVar1 == 0 || (iVar1 = GetHealthType(this_01), iVar1 == 4)))) - goto LAB_007d15d3; - } - iVar1 = GetHealthType(this); - if ((iVar1 == 1) || (iVar1 == 2)) { - iVar1 = this->_maxHearts; - } - else { - iVar1 = this->_maxHearts + this->_boneHearts * 2; - } - if (((iVar1 == 0) && (this->_soulHearts < 4)) && (isSoulHealth)) goto LAB_007d1599; - if (this->_numKeys < 1) { -LAB_007d1505: - if (*variant != 0x1e) { - *variant = 0x1e; - *subtype = 0; - return; - } - } - else { - iVar1 = this->_playerType; - if (iVar1 == 0x19) { - if (this->_poopMana < 1) { - if (*variant == 0x2a) { - return; - } - *variant = 0x2a; - *subtype = 1; - return; - } - } - else { - if (this->_numBombs < 1) goto LAB_007d1541; - if (iVar1 == 0x12) { - if (this->_effectiveSoulCharge < 1) goto LAB_007d1599; - } - else if ((iVar1 == 0x24) && (this->_effectiveBloodCharge < 1)) goto LAB_007d15d3; - } - iVar2 = GetEffectiveMaxHearts(this); - if (((this->_redHearts < iVar2) && (iVar2 = GetEffectiveMaxHearts(this), -1 < iVar2)) && - (iVar2 = GetHealthType(this), iVar2 != 3)) goto LAB_007d15d3; - if (4 < this->_numCoins) { - if (iVar1 == 0x19) { - bombsOrMana = this->_poopMana; - } - else { - bombsOrMana = GHIDRA_UINT((4 < this->_numBombs)); - } - if (((bombsOrMana == 0) || (this->_numKeys < 5)) || (this->_trinketsID[0] != 0)) { -LAB_007d14a0: - isDropTrinket = false; - } - else { - trinketList = EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&trinketQuery,5,0x15e, - -1,0,0); - isQueryMade = true; - if (trinketList->_size != 0) goto LAB_007d14a0; - isDropTrinket = true; - } - if (isQueryMade) { - (GHIDRA_CAST((&trinketQuery)))->EntityList_Query::~EntityList_Query(); - } - if (isDropTrinket) { - *variant = 0x15e; - *subtype = 0; - return; - } - if (0xe < this->_numCoins) { - if (4 < this->_numKeys) { - iVar1 = this->_playerType; - if (iVar1 == 0x19) { - if (this->_poopMana < 5) { - if (*variant == 0x2a) { - return; - } - *variant = 0x2a; - *subtype = 1; - return; - } - } - else { - if (this->_numBombs < 5) { -LAB_007d1541: - if (*variant == 0x28) { - return; - } - *variant = 0x28; - *subtype = 0; - return; - } - if (iVar1 == 0x12) { - if (this->_effectiveSoulCharge < 0xc) goto LAB_007d1599; - } - else if ((iVar1 == 0x24) && (this->_effectiveBloodCharge < 0xc)) { -LAB_007d15d3: - if (*variant == 10) { - return; - } - *variant = 10; - *subtype = 1; - return; - } - } - iVar2 = GetHeartLimit(this,0); - effectiveMaxHearts = GetEffectiveMaxHearts(this); - iVar1 = 0xc; - if (iVar2 < 0xc) { - iVar1 = iVar2; - } - if (iVar1 <= effectiveMaxHearts + this->_soulHearts) { - return; - } - if (!isSoulHealth) { - return; - } -LAB_007d1599: - if (*variant == 10) { - if (*subtype == 3) { - return; - } - if (*subtype == 6) { - return; - } - } - *variant = 10; - *subtype = 3; - return; - } - goto LAB_007d1505; - } - } - if (*variant != 0x14) { - *variant = 0x14; - *subtype = 0; - return; - } - } - return; -} - -// 007d1620 -void Entity_Player::GetEnterPosition(Vector *buffer) -{ - uint32_t enterDoor; - Vector *levelEnterPos; - uint32_t attempt; - float doorY; - float doorX; - Vector enterPosBuf; - Vector enterPosBuf2; - int doorGridIndex; - Game *game; - int gridWidth; - - enterDoor = g_game->_enterDoor; - if (enterDoor == 0xffffffff) { - enterDoor = Random(); - enterDoor = enterDoor & 7; - attempt = 0; - do { - if ((enterDoor < 8) && - ((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)) + 0x38 + (enterDoor >> 5) * 4 - )) & 1 << ((uint8_t)enterDoor & 0x1f)) != 0)) break; - enterDoor = enterDoor + 1 & 0x80000007; - if (GHIDRA_INT(enterDoor) < 0) { - enterDoor = (enterDoor - 1 | 0xfffffff8) + 1; - } - attempt = attempt + 1; - } while (attempt < 8); - } - game = g_game; - buffer->y = 0.0; - buffer->x = 0.0; - levelEnterPos = Level::GetEnterPosition(GHIDRA_CAST(game),&enterPosBuf); - if ((levelEnterPos->x == g_vectorZero.x) && (levelEnterPos->y == g_vectorZero.y)) { - doorY = g_vectorZero.y; - doorX = g_vectorZero.x; - if (enterDoor < 8) { - doorGridIndex = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + enterDoor * 4 + 0x744)); - gridWidth = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - doorX = (float)(doorGridIndex % gridWidth) * 40.0 + 40.0; - doorY = (float)(doorGridIndex / gridWidth) * 40.0 + 120.0; - } - buffer->x = doorX; - buffer->y = doorY; - enterDoor = enterDoor & 0x80000003; - if (GHIDRA_INT(enterDoor) < 0) { - enterDoor = (enterDoor - 1 | 0xfffffffc) + 1; - } - switch(enterDoor) { - case 0: - buffer->x = doorX + 40.0; - buffer->y = doorY + 0.0; - return; - case 1: - buffer->y = doorY + 40.0; - buffer->x = doorX + 0.0; - return; - case 2: - buffer->x = doorX - 40.0; - buffer->y = doorY - 0.0; - return; - case 3: - buffer->y = doorY - 40.0; - buffer->x = doorX - 0.0; - return; - } - } - else { - levelEnterPos = Level::GetEnterPosition(GHIDRA_CAST(g_game),&enterPosBuf2); - buffer->x = levelEnterPos->x; - buffer->y = levelEnterPos->y; - } - return; -} - -// 007d1860 -Entity_Familiar * Entity_Player::AddMinisaac(Vector *position, uint8_t isPlayAnim) -{ - uint8_t bVar1; - uint32_t uVar2; - uint32_t seed; - Entity_Familiar *minisaac; - uint8_t *curAnimName; - Entity *bloodSplat; - char *appearName; - uint8_t *splatAnimName; - bool bVar3; - float fVar4; - float fVar5; - float fVar6; - Vector local_24; - Vector local_1c; - Entity_Player *player; - Vector launchVelocity; - uint8_t *animData; - Manager *manager; - - player = this; - if (isPlayAnim == 0) { - launchVelocity.x = g_vectorZero.x; - launchVelocity.y = g_vectorZero.y; - } - else { - uVar2 = Random(); - local_24.x = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_24.x = local_24.x + local_24.x; - uVar2 = Random(); - local_1c.x = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10 * 3.0 + 2.0; - fVar4 = cos(local_24.x); - launchVelocity.x = fVar4 * local_1c.x; - fVar4 = sin(local_24.x); - launchVelocity.y = fVar4 * local_1c.x; - } - local_1c.x = (float)&launchVelocity; - local_24.x = launchVelocity.x; - local_24.y = launchVelocity.y; - uVar2 = this->_headColor + 1; - if (this->_headColor < 0) { - uVar2 = 0; - } - if (this->_playerType == 0x10) { - uVar2 = 99; - } - seed = Random(); - minisaac = (Entity_Familiar *) - Game::SpawnEx(g_game,3,0xe4,position,&local_24,GHIDRA_CAST(this),uVar2,seed,0); - if (isPlayAnim == 0) goto LAB_007d1be2; - *GHIDRA_CAST(&minisaac->_flags) = GHIDRA_UINT(minisaac->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&minisaac->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&minisaac->_flags) + 4)); - animData = (minisaac->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_007d19f9: - bVar1 = ANM2::SetAnimation(&minisaac->_sprite,GHIDRA_CAST("Appear"),1); - if (bVar1 != 0) { - AnimationState::Rewind(&(minisaac->_sprite)._animState); - (minisaac->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - appearName = "Appear"; - do { - bVar1 = *curAnimName; - bVar3 = bVar1 < (uint8_t)*appearName; - if (bVar1 != *appearName) { -LAB_007d19e3: - uVar2 = -GHIDRA_UINT(bVar3) | 1; - goto LAB_007d19e8; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - bVar3 = bVar1 < (uint8_t)appearName[1]; - if (bVar1 != appearName[1]) goto LAB_007d19e3; - curAnimName = curAnimName + 2; - appearName = appearName + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_007d19e8: - if ((uVar2 != 0) || ((animData[0x34] != 0 && ((minisaac->_sprite)._animState._isPlaying == 0)))) - goto LAB_007d19f9; - } - AnimationState::SetAnimationData(&(minisaac->_sprite)._overlayAnimState,(void *)0x0); - minisaac->_state = 1; - minisaac->_entityCollisionClass = 0; - uVar2 = Random(); - local_1c.y = *GHIDRA_CAST((GHIDRA_CAST(local_1c.x) + 4)) * 0.4; - local_1c.x = *GHIDRA_CAST(local_1c.x) * 0.4; - bloodSplat = Game::SpawnEx(g_game,1000,2,position,&local_1c,GHIDRA_CAST(0x0),1,uVar2,0); - local_1c.x = (float)bloodSplat; - uVar2 = Random(); - (bloodSplat->_sprite)._rotation = - (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * 2.3283064e-10 * - 360.0; - animData = (bloodSplat->_sprite)._animState._animData; - if (animData == GHIDRA_CAST(0x0)) { -LAB_007d1b16: - bVar1 = ANM2::SetAnimation(&bloodSplat->_sprite,&DAT_00b1d534,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(bloodSplat->_sprite)._animState); - (bloodSplat->_sprite)._animState._isPlaying = 1; - } - } - else { - curAnimName = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - curAnimName = *GHIDRA_CAST(animData); - } - splatAnimName = &DAT_00b1d534; - do { - bVar1 = *curAnimName; - bVar3 = bVar1 < *splatAnimName; - if (bVar1 != *splatAnimName) { -LAB_007d1b00: - uVar2 = -GHIDRA_UINT(bVar3) | 1; - goto LAB_007d1b05; - } - if (bVar1 == 0) break; - bVar1 = curAnimName[1]; - bVar3 = bVar1 < splatAnimName[1]; - if (bVar1 != splatAnimName[1]) goto LAB_007d1b00; - curAnimName = curAnimName + 2; - splatAnimName = splatAnimName + 2; - } while (bVar1 != 0); - uVar2 = 0; -LAB_007d1b05: - if ((uVar2 != 0) || - ((animData[0x34] != 0 && ((bloodSplat->_sprite)._animState._isPlaying == 0)))) - goto LAB_007d1b16; - } - uVar2 = Random(); - fVar4 = local_1c.x; - manager = g_manager; - local_1c.x = 4.2039e-44; - fVar6 = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283064e-10 * 0.4 + 0.8; - fVar5 = fVar6 * g_vectorOne.y; - ((GHIDRA_CAST((GHIDRA_INT(fVar4) + 0x48)))->_scale).x = fVar6 * g_vectorOne.x; - ((GHIDRA_CAST((GHIDRA_INT(fVar4) + 0x48)))->_scale).y = fVar5; - *GHIDRA_CAST((GHIDRA_CAST(fVar4) + 0x354)) = 2000; - seed_fart_sound_override(GHIDRA_CAST(&local_1c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c.x),1.0,2,0,1.0,0.0); -LAB_007d1be2: - minisaac->_entityGridCollisionClass = GHIDRA_UINT((player->_canFly == 0)) * 2 + 3; - return minisaac; -} - -// 007d1c10 -uint32_t Entity_Player::play_hurt_effects() -{ - uint64_t qVar1; - uint8_t isOwned; - void *pvVar2; - int iVar3; - Entity_Laser *laser; - Entity_Player *in_ECX; - uint32_t wispIdx; - uint64_t *heapCounter; - uint32_t uVar4; - int wispCount; - short local_52; - uint8_t local_50 [12]; - float local_44 [12]; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - float local_8; - void *collectibleConfigs; - Manager *manager; - - local_8 = -NAN; - puStack_c = &LAB_00b002bd; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((local_44 + 0x10)); - ExceptionList = &local_10; - pvVar2 = (GHIDRA_CAST((&in_ECX->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x146); - if ((((0 < in_ECX->_damageCooldown) && ((in_ECX->_flags & 0x1000000000) == 0)) || - (pvVar2 == (void *)0x0)) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 4)) != 2)) { - ExceptionList = local_10; - return 0; - } - collectibleConfigs = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectibleConfigs) >> 2 < 0x147) { - iVar3 = 0; - } - else { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(collectibleConfigs) + 0x518)); - } - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 8)) < *GHIDRA_CAST((iVar3 + 0x78)) + -5) { - ExceptionList = local_10; - return 0; - } - (GHIDRA_CAST((&in_ECX->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x146,1); - isOwned = HasCollectible(in_ECX,0x3b,0); - if (isOwned == 0) { - uVar4 = 0; - do { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x8))) = 0; - local_44[0] = -12.0; - laser = Entity_Laser::ShootAngle - (5,&in_ECX->_pos, - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - * 90.0,0x1e,GHIDRA_CAST((local_50 + 8)),GHIDRA_CAST(in_ECX),0); - laser->SetCollisionDamage(0x41400000); - local_44[1] = 1.0; - local_44[2] = 1.0; - local_44[3] = 1.0; - local_44[4] = 1.0; - local_44[5] = 1.0; - local_44[6] = 1.0; - local_44[7] = 1.0; - local_44[8] = 1.0; - local_44[9] = 0.0; - local_44[10] = 0.0; - local_44[0xb] = 0.0; - laser->SetColor(local_44 + 1,0xffffffff,0xff,0,1); - laser->_disableFollowParent = 1; - if (uVar4 == 3) { - laser->_renderDepthOffset = -10.0; - break; - } - uVar4 = uVar4 + 1; - laser->_renderDepthOffset = 3000.0; - } while (uVar4 < 4); - pvVar2 = (GHIDRA_CAST((&in_ECX->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x3a); - if ((pvVar2 != (void *)0x0) && (0x95 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 8)))) goto LAB_007d1f00; - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) >> 2 < 0x3b) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = 0; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xe8)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x8))) = 0x1e; - iVar3 = 1; - } - else { - UseActiveItem(in_ECX,&local_52,0x23,9,-1,0); - manager = g_manager; - local_44[0] = 1.12104e-43; - seed_fart_sound_override(GHIDRA_CAST(local_44)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44[0]),1.0,2,0,1.0,0.0); - manager = g_manager; - local_44[0] = 4.76441e-44; - seed_fart_sound_override(GHIDRA_CAST(local_44)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44[0]),1.0,2,0,1.0,0.0); - pvVar2 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar2) >> 2 < 0x70) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x8))) = 0x96; - iVar3 = 0x14; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1bc)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x8))) = 0x96; - iVar3 = 0x14; - } - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) = 0; - local_44[0] = 0.0; - (GHIDRA_CAST((&in_ECX->_temporaryeffects)))->TemporaryEffects::AddEffect(local_50,1,iVar3); -LAB_007d1f00: - isOwned = HasCollectible(in_ECX,0x248,0); - if (isOwned != 0) { - iVar3 = 0; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_50),3,0xce,0x146,0, - 0); - wispIdx = 0; - local_8 = 0.0; - wispCount = iVar3; - if (local_44[0] != 0.0) { - do { - iVar3 = wispCount + 1; - if (*GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) + wispIdx * 4)) + 0x410)) != in_ECX) { - iVar3 = wispCount; - } - wispIdx = wispIdx + 1; - wispCount = iVar3; - } while (wispIdx < GHIDRA_UINT(local_44[0])); - } - iVar3 = 4 - iVar3; - if (0 < iVar3) { - do { - AddWisp(in_ECX,0x146,&in_ECX->_pos,1,0); - iVar3 = iVar3 + -1; - } while (iVar3 != 0); - } - if (local_50[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - heapCounter = &g_allocatedBytesNoHeap; - } - else { - heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) != 0) { - uVar4 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) + -4)); - qVar1 = *heapCounter; - *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar4)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_50)) + 0x4))) + -4))); - } - } - } - ExceptionList = local_10; - return 1; -} - -// 007d2000 -Entity_Player * Entity_Player::InitTwin(int playerType) -{ - Entity_Player *twin; - Vector *safePos; - Vector VStack_10; - Game *game; - float playerX; - float playerY; - - twin = PlayerManager::SpawnCoPlayer2(&g_game->_playerManager,playerType); - if (GHIDRA_CAST(twin->_twinPlayer) != this) { - if (GHIDRA_CAST(twin->_twinPlayer) != GHIDRA_CAST(0x0)) { - VStack_10.x = (float)&twin->_twinPlayer; - msvc::multiset::erase(&VStack_10); - } - twin->_twinPlayer = this; - if (this != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&twin->_twinPlayer); - } - } - if (GHIDRA_CAST(this->_twinPlayer) != twin) { - if (GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0)) { - VStack_10.x = (float)&this->_twinPlayer; - msvc::multiset::erase(&VStack_10); - } - this->_twinPlayer = twin; - if (twin != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&this->_twinPlayer); - } - } - SetControllerIndex(twin,this->_controllerIndex,0); - VStack_10.x = (this->_pos).x; - VStack_10.y = (this->_pos).y; - safePos = PlayerManager::find_safe_spawn_position(&VStack_10,this->_pos); - (twin->_pos).x = safePos->x; - game = g_game; - (twin->_pos).y = safePos->y; - playerY = (this->_pos).y; - playerX = (this->_pos).x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((twin)) + 0x1e50)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1e50)))); - (twin->_pos).y = playerY + 0.0; - (twin->_pos).x = playerX + 20.0; - (this->_pos).x = (this->_pos).x - 20.0; - (this->_pos).y = (this->_pos).y + 0.0; - HUD::AssignPlayerHUDs(&game->_hud); - return twin; -} - -// 007d2170 -uint8_t Entity_Player::TryHoldEntity(Entity *entity) -{ - int iVar1; - uint8_t bVar2; - Entity_Player *local_c [2]; - uint64_t flags; - uint32_t *flagsHigh; - void **heldSlot; - Manager *manager; - - if (this->_heldEntity != (void *)0x0) { - return 0; - } - if (entity == GHIDRA_CAST(0x0)) { - return 0; - } - this->_isHeldEntityVisible = entity->_visible; - this->_heldEntityGridCollisionClass = entity->_entityGridCollisionClass; - this->_heldEntityCollisionClass = entity->_entityCollisionClass; - iVar1 = entity->_type; - local_c[0] = this; - if (iVar1 == 4) { - if (entity->_entityCollisionClass == 0) { - return 0; - } - if (entity->_dead != 0) { - return 0; - } - iVar1 = this->_type; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x2000020; - entity->_spawnerType = iVar1; - *GHIDRA_CAST(&entity->_flags) = GHIDRA_INT(entity->_flags); - (entity->_posOffset).x = g_vectorZero.x; - (entity->_posOffset).y = g_vectorZero.y; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(entity))))->Entity_Bomb::IsRocket(); - if (bVar2 != 0) { - ANM2::Play(&entity->_sprite,s_Idle,0); - (entity->_sprite)._rotation = 0.0; - } - goto LAB_007d23e6; - } - if (iVar1 == 1000) { - if (entity->_variant == 0x88) { - iVar1 = this->_type; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x20; - entity->_spawnerType = iVar1; - *GHIDRA_CAST(&entity->_flags) = GHIDRA_INT(entity->_flags); - (entity->_posOffset).x = 0.0; - (entity->_posOffset).y = -10.0; - goto LAB_007d23e6; - } -LAB_007d23a4: - bVar2 = (GHIDRA_CAST((entity)))->Entity::IsEnemy(); - if ((bVar2 == 0) || (this->_suplexState != 1)) { - if (iVar1 != 0xf5) { - return 0; - } - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x2000020; - } - else { - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x2000000; - } - } - else { - if (iVar1 != 3) { - if ((((iVar1 == 1) && (GHIDRA_CAST(entity) != this)) && (entity[4]._health == 4.90454e-44) - ) && ((bVar2 = (GHIDRA_CAST((entity)))->Entity::HasEntityFlags(0x200000000000000), bVar2 == 0 && - (bVar2 = (GHIDRA_CAST((entity)))->Entity::HasEntityFlags(0x400000000000000), bVar2 == 0)))) { - (entity->_velocity).x = g_vectorZero.x; - (entity->_velocity).y = g_vectorZero.y; - flags = entity->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x2000000; - *GHIDRA_CAST(&entity->_flags) = GHIDRA_INT(flags); - bVar2 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST(&entity[5]._sprite._overlayRenderFirst),0x2ca); - manager = g_manager; - if (bVar2 != 0) { - local_c[0] = GHIDRA_CAST(0x248); - seed_fart_sound_override(GHIDRA_CAST(local_c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c[0]),1.0,2,0,1.0,0.0); - } - TemporaryEffects::RemoveCollectibleEffect - (GHIDRA_CAST(&entity[5]._sprite._overlayRenderFirst),0x2ca,-1); - goto LAB_007d23e6; - } - goto LAB_007d23a4; - } - if ((entity->_variant != 0xc9) && (entity->_variant != 0xef)) goto LAB_007d23a4; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x2000000; - } - *GHIDRA_CAST(&entity->_flags) = GHIDRA_INT(entity->_flags); -LAB_007d23e6: - heldSlot = &this->_heldEntity; - entity->_visible = 0; - entity->_entityCollisionClass = 0; - if (*heldSlot != (void *)0x0) { - local_c[0] = GHIDRA_CAST(heldSlot); - msvc::multiset::erase(local_c); - } - *heldSlot = entity; - msvc::multiset::insert(heldSlot); - PlayExtraAnimation(this,GHIDRA_CAST("LiftItem")); - ANM2::Reset(&this->_heldSprite); - FlushQueueItem(this); - this->_itemState = 0x25c; - this->_itemStateCooldown = 0; - return 1; -} - -// 007d2470 -Entity * Entity_Player::ThrowHeldEntity(Vector *Velocity) -{ - ANM2 other; - char cVar1; - Entity_Tear *thrownEntity; - LayerState *layer; - Entity *unaff_EBX; - int *heldEntity; - uint8_t *layerIndex; - float fVar2; - ANM2 aAStackY_8c88 [128]; - uint8_t in_stack_fffffe8c [244]; - float fVar3; - float fVar4; - int iVar5; - int iVar6; - Vector *local_44; - uint32_t flagsHigh; - void **heldEntitySlot; - Manager *manager; - - heldEntitySlot = &this->_heldEntity; - thrownEntity = *heldEntitySlot; - if (thrownEntity == GHIDRA_CAST(0x0)) { - return GHIDRA_CAST(0x0); - } - thrownEntity->_visible = this->_isHeldEntityVisible; - *GHIDRA_CAST((GHIDRA_INT(*heldEntitySlot) + 0x188)) = this->_heldEntityCollisionClass; - *GHIDRA_CAST((GHIDRA_INT(*heldEntitySlot) + 0x184)) = this->_heldEntityGridCollisionClass; - local_44 = GHIDRA_CAST(GHIDRA_UINT(((this->_flags & 0x100) != 0))); - cVar1 = (**(code **)(*GHIDRA_CAST(*heldEntitySlot) + 0x54))(); - heldEntity = *heldEntitySlot; - iVar5 = heldEntity[10]; - if (cVar1 == '\0') { - if (iVar5 == 4) { - if ((heldEntity[0xb] == 0x13) || (heldEntity[0xb] == 0x14)) { - fVar2 = atan2f(Velocity->y,Velocity->x); - heldEntity[0x10a] = GHIDRA_INT((fVar2 * 57.295776)); - iVar5 = -0x3ea00000; - } - else { - iVar5 = -0x3e400000; - heldEntity[0x107] = -0x3f800000; - } - heldEntity[0xd3] = 0; - heldEntity[0xd4] = iVar5; - heldEntity[0xd8] = GHIDRA_INT(Velocity->x); - fVar2 = Velocity->y; - heldEntity[0x5b] = heldEntity[0x5b] & 0xfdffffdf; - heldEntity[0xd9] = GHIDRA_INT(fVar2); - heldEntity[0x5a] = heldEntity[0x5a]; - heldEntity[0x10b] = 0x41700000; - } - else if (iVar5 == 1000) { - if (heldEntity[0xb] == 0x88) { - fVar4 = 5.60519e-44; - fVar3 = 2.8026e-45; - fVar2 = 1.1493498e-38; - thrownEntity = (Entity_Tear *) - Game::SpawnEx(g_game,2,0x28,local_44,Velocity,unaff_EBX, - GHIDRA_UINT(*GHIDRA_CAST((heldEntity + 0x109))) | - heldEntity[0x108] << 0x10,heldEntity[0x10c],0); - thrownEntity->SetCollisionDamage(); - if (heldEntity[0x108] == 0xe) { - thrownEntity->_health = (float)heldEntity[0x10a]; - if (heldEntity[0x109] - 7U < 4) { - thrownEntity->_baseScale = 3.0; - thrownEntity->_fScale = 3.0; - (GHIDRA_CAST((thrownEntity)))->Entity_Tear::ResetSpriteScale(); - } - thrownEntity->SetCollisionDamage(); - if (heldEntity[0x10d] == 1) { - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&thrownEntity->_flags) + 4)); - *GHIDRA_CAST(&thrownEntity->_flags) = GHIDRA_UINT(thrownEntity->_flags) | 0x40000; - *GHIDRA_CAST((GHIDRA_INT(&thrownEntity->_flags) + 4)) = flagsHigh; - } - } - if ((heldEntity[0x108] == 0x19) && (heldEntity[0x10a] == 4)) { - thrownEntity->SetCollisionDamage(); - } - thrownEntity->_tearIdx = heldEntity[0x114]; - iVar6 = -0x3e100000; - iVar5 = 0x7d284a; - (GHIDRA_CAST((GHIDRA_CAST(thrownEntity))))->Entity_Projectile::SetHeight(-30.0); - thrownEntity->_fallingAccel = 0.8; - thrownEntity->_fallingSpeed = -5.0; - thrownEntity->_prismTouched = 1; - ANM2::ANM2(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x174)),GHIDRA_CAST((heldEntity + 0x12))); - other._championColor._offset[0] = fVar2; - other._filename._buf[0] = in_stack_fffffe8c[0]; - other._filename._buf[1] = in_stack_fffffe8c[1]; - other._filename._buf[2] = in_stack_fffffe8c[2]; - other._filename._buf[3] = in_stack_fffffe8c[3]; - other._filename._buf[4] = in_stack_fffffe8c[4]; - other._filename._buf[5] = in_stack_fffffe8c[5]; - other._filename._buf[6] = in_stack_fffffe8c[6]; - other._filename._buf[7] = in_stack_fffffe8c[7]; - other._filename._buf[8] = in_stack_fffffe8c[8]; - other._filename._buf[9] = in_stack_fffffe8c[9]; - other._filename._buf[10] = in_stack_fffffe8c[10]; - other._filename._buf[0xb] = in_stack_fffffe8c[0xb]; - other._filename._buf[0xc] = in_stack_fffffe8c[0xc]; - other._filename._buf[0xd] = in_stack_fffffe8c[0xd]; - other._filename._buf[0xe] = in_stack_fffffe8c[0xe]; - other._filename._buf[0xf] = in_stack_fffffe8c[0xf]; - other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x10))); - other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x14))); - other._animDefaultName._buf[0] = in_stack_fffffe8c[0x18]; - other._animDefaultName._buf[1] = in_stack_fffffe8c[0x19]; - other._animDefaultName._buf[2] = in_stack_fffffe8c[0x1a]; - other._animDefaultName._buf[3] = in_stack_fffffe8c[0x1b]; - other._animDefaultName._buf[4] = in_stack_fffffe8c[0x1c]; - other._animDefaultName._buf[5] = in_stack_fffffe8c[0x1d]; - other._animDefaultName._buf[6] = in_stack_fffffe8c[0x1e]; - other._animDefaultName._buf[7] = in_stack_fffffe8c[0x1f]; - other._animDefaultName._buf[8] = in_stack_fffffe8c[0x20]; - other._animDefaultName._buf[9] = in_stack_fffffe8c[0x21]; - other._animDefaultName._buf[10] = in_stack_fffffe8c[0x22]; - other._animDefaultName._buf[0xb] = in_stack_fffffe8c[0x23]; - other._animDefaultName._buf[0xc] = in_stack_fffffe8c[0x24]; - other._animDefaultName._buf[0xd] = in_stack_fffffe8c[0x25]; - other._animDefaultName._buf[0xe] = in_stack_fffffe8c[0x26]; - other._animDefaultName._buf[0xf] = in_stack_fffffe8c[0x27]; - other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x28))); - other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x2c))); - other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x30))); - other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x34))); - other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x38))); - other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x3c))); - other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0x40))); - other._animState._isPlaying = in_stack_fffffe8c[0x44]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x45))); - other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x48))); - other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x4c))); - other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x50))); - other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x54))); - other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x58))); - other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x5c))); - other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0x60))); - other._overlayAnimState._isPlaying = in_stack_fffffe8c[100]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x65))); - other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x68))); - other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x6c))); - other._overlayRenderFirst = in_stack_fffffe8c[0x70]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x71))); - other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x74))); - other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x78))); - other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x7c))); - other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x80))); - other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x84))); - other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x88))); - other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe8c)) + 0x8c))); - other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe8c)) + 0x90))); - other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0x94))); - other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0x98))); - other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0x9c))); - other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xa0))); - other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xa4))); - other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xa8))); - other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xac))); - other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xb0))); - other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xb4))); - other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xb8))); - other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xbc))); - other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xc0))); - other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xc4))); - other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xc8))); - other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xcc))); - other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xd0))); - other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xd4))); - other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xd8))); - other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xdc))); - other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xe0))); - other._championColor._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xe4))); - other._championColor._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xe8))); - other._championColor._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xec))); - other._championColor._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe8c)) + 0xf0))); - other._championColor._offset[1] = fVar3; - other._championColor._offset[2] = fVar4; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x100))) = local_44; - other._playbackSpeed = (float)Velocity; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = unaff_EBX; - other._shadowLayerIndex = iVar5; - other._bitflags = iVar6; - ANM2::operator_assign(&thrownEntity->_sprite,other); - layerIndex = GHIDRA_CAST(0x0); - if ((thrownEntity->_sprite)._layerCount != 0) { - do { - layer = ANM2::GetLayer(&thrownEntity->_sprite,layerIndex); - (layer->_pos).x = g_vectorZero.x; - (layer->_pos).y = g_vectorZero.y; - layer = ANM2::GetLayer(&thrownEntity->_sprite,layerIndex); - layerIndex = layerIndex + 1; - (layer->_size).x = g_vectorOne.x; - (layer->_size).y = g_vectorOne.y; - } while (layerIndex < GHIDRA_CAST((thrownEntity->_sprite)._layerCount)); - } - thrownEntity->Update(); - iVar5 = *GHIDRA_CAST(*heldEntitySlot); - } - else { - if (heldEntity[0xb] != 0x76) goto LAB_007d28f9; - iVar5 = *heldEntity; - } - (**(code **)(iVar5 + 0x28))(); - } - } - else { - if (iVar5 == 1) { - heldEntity[0x5b] = heldEntity[0x5b] | 0x4000000; - *GHIDRA_CAST((heldEntity + 0x104)) = 1; - heldEntity[0x5a] = heldEntity[0x5a]; - heldEntity[0x61] = 3; - heldEntity = *heldEntitySlot; - } - manager = g_manager; - if (heldEntity[10] == 0xf5) { - seed_fart_sound_override(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x50))); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(0x361,1.0,2,0,1.0,0.0); - heldEntity = *heldEntitySlot; - } - heldEntity[0x5b] = heldEntity[0x5b] & 0xfdffffff; - heldEntity[0x5a] = heldEntity[0x5a]; - } -LAB_007d28f9: - if (*heldEntitySlot != (void *)0x0) { - msvc::multiset::erase(); - } - *heldEntitySlot = (void *)0x0; - return GHIDRA_CAST(thrownEntity); -} - -// 007d2a00 -void Entity_Player::AddFriendlyDip(int subtype, Vector *position) -{ - Entity_Familiar::ThrowDip(subtype,position,GHIDRA_CAST(this)); - return; -} - -// 007d2a20 -void Entity_Player::ThrowFriendlyDip(int subtype, Vector *position, Vector *target) -{ - spawn_dip_at(subtype,position,GHIDRA_CAST(this),target); - return; -} - -// 007d2a40 -void Entity_Player::AddBrokenHearts(int amount) -{ - uint8_t isHasHeartbreak; - int heartLimit; - int iVar1; - int brokenHearts; - Entity_Player *twin; - - iVar1 = this->_playerType; - while ((iVar1 == 0x28 && (twin = GHIDRA_CAST(this->_twinPlayer), twin != GHIDRA_CAST(0x0)) - )) { - iVar1 = twin->_playerType; - this = twin; - } - brokenHearts = this->_brokenHearts + amount; - heartLimit = GetHeartLimit(this,1); - iVar1 = 0; - if (0 < brokenHearts) { - iVar1 = brokenHearts; - } - brokenHearts = heartLimit / 2; - if (iVar1 < heartLimit / 2) { - brokenHearts = iVar1; - } - this->_brokenHearts = brokenHearts; - AddMaxHearts(this,0,0); - isHasHeartbreak = HasCollectible(this,0x2b6,0); - if (isHasHeartbreak != 0) { - this->_cacheFlags = this->_cacheFlags | 1; - EvaluateItems(this); - } - return; -} - -// 007d2ad0 -void Entity_Player::AddSoulCharge(int count) -{ - int oldSoulCharge; - int *clamped; - int *capped; - int chargeBounds [2]; - Game *game; - - chargeBounds[1] = 99; - chargeBounds[0] = 0; - oldSoulCharge = this->_effectiveSoulCharge; - count = count + oldSoulCharge; - capped = chargeBounds + 1; - if (count < 100) { - capped = &count; - } - clamped = chargeBounds; - if (-1 < *capped) { - clamped = capped; - } - this->_effectiveSoulCharge = *clamped; - apply_soul_charge_to_actives(this,oldSoulCharge); - ConsumableCountChanged(this,0x20); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007d2b50 -int Entity_Player::GetEffectiveSoulCharge() -{ - if (this->_playerType == 0x12) { - return this->_effectiveSoulCharge; - } - return 0; -} - -// 007d2b70 -void Entity_Player::apply_soul_charge_to_actives(int oldSoulCharge) -{ - uint8_t isHasBulb; - int iVar1; - uint32_t proceduralIdx; - uint32_t itemId; - int maxCharge; - uint32_t slot; - bool isNotProcedural; - int local_8; - void *itemList; - Manager *manager; - - if (this->_playerType == 0x12) { - slot = 0; - do { - itemId = this->_activeDesc[slot]._item; - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(itemId)) goto LAB_007d2bd3; -LAB_007d2bf5: - local_8 = 0; - } - else if (GHIDRA_INT(itemId) < 0) { - proceduralIdx = ~itemId; - isNotProcedural = -1 < GHIDRA_INT(itemId); - itemId = proceduralIdx; - if ((isNotProcedural) || - (itemList = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(itemList) >> 2 <= - GHIDRA_INT(proceduralIdx))) goto LAB_007d2bf5; - local_8 = **GHIDRA_CAST((GHIDRA_CAST(itemList) + proceduralIdx * 4)); - } - else { -LAB_007d2bd3: - itemList = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(itemList) >> 2 <= GHIDRA_INT(itemId)) - goto LAB_007d2bf5; - local_8 = *GHIDRA_CAST((GHIDRA_CAST(itemList) + itemId * 4)); - } - if (slot == 3) { - maxCharge = 0; - } - else if (((slot == 2) && (this->_activeDesc[2]._item == 0x244)) && - (g_game->_challenge == 0x2c)) { - maxCharge = 0; - } - else { - maxCharge = GetCollectibleMaxCharge - (this,this->_activeDesc[slot]._item,this->_activeDesc[slot]._varData, - itemId); - } - iVar1 = GetActiveMaxCharge(this,slot); - if (((local_8 != 0) && (iVar1 != 1)) && (0 < maxCharge)) { - local_8 = GetTotalActiveCharge(this,slot); - if (this->_playerType == 0x12) { - iVar1 = this->_effectiveSoulCharge; - } - else { - iVar1 = 0; - } - iVar1 = (local_8 - iVar1) + oldSoulCharge; - if ((iVar1 < local_8) && (iVar1 < maxCharge)) { - HUD::FlashChargeBar(&g_game->_hud,this,slot); - iVar1 = local_8; - manager = g_manager; - local_8 = 0xda; - if (iVar1 < maxCharge) { - local_8 = 0xab; - } - seed_fart_sound_override(&local_8); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_8,1.0,2,0,1.0,0.0); - } - } - slot = slot + 1; - } while (slot < 4); - isHasBulb = HasTrinket(this,0x65,0); - if ((isHasBulb == 0) && (isHasBulb = HasTrinket(this,100,0), isHasBulb == 0)) { - return; - } - this->_cacheFlags = this->_cacheFlags | 0x40f; - EvaluateItems(this); - } - return; -} - -// 007d2d40 -void Entity_Player::AddBloodCharge(int amount) -{ - int oldBloodCharge; - int *clampedPtr; - int *cappedPtr; - int bounds [2]; - Game *game; - - bounds[1] = 99; - bounds[0] = 0; - oldBloodCharge = this->_effectiveBloodCharge; - amount = amount + oldBloodCharge; - cappedPtr = bounds + 1; - if (amount < 100) { - cappedPtr = &amount; - } - clampedPtr = bounds; - if (-1 < *cappedPtr) { - clampedPtr = cappedPtr; - } - this->_effectiveBloodCharge = *clampedPtr; - blood_charge_changed(this,oldBloodCharge); - ConsumableCountChanged(this,0x100); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007d2dd0 -int Entity_Player::GetEffectiveBloodCharge() -{ - if (this->_playerType == 0x24) { - return this->_effectiveBloodCharge; - } - return 0; -} - -// 007d2df0 -void Entity_Player::blood_charge_changed(int oldBloodCharge) -{ - uint8_t isHasBulb; - int iVar1; - uint32_t proceduralIdx; - uint32_t itemId; - int maxCharge; - uint32_t slot; - bool isNotProcedural; - int local_8; - void *itemList; - Manager *manager; - - if (this->_playerType == 0x24) { - slot = 0; - do { - itemId = this->_activeDesc[slot]._item; - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(itemId)) goto LAB_007d2e53; -LAB_007d2e75: - local_8 = 0; - } - else if (GHIDRA_INT(itemId) < 0) { - proceduralIdx = ~itemId; - isNotProcedural = -1 < GHIDRA_INT(itemId); - itemId = proceduralIdx; - if ((isNotProcedural) || - (itemList = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(itemList) >> 2 <= - GHIDRA_INT(proceduralIdx))) goto LAB_007d2e75; - local_8 = **GHIDRA_CAST((GHIDRA_CAST(itemList) + proceduralIdx * 4)); - } - else { -LAB_007d2e53: - itemList = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(itemList) >> 2 <= GHIDRA_INT(itemId)) - goto LAB_007d2e75; - local_8 = *GHIDRA_CAST((GHIDRA_CAST(itemList) + itemId * 4)); - } - if (slot == 3) { - maxCharge = 0; - } - else if (((slot == 2) && (this->_activeDesc[2]._item == 0x244)) && - (g_game->_challenge == 0x2c)) { - maxCharge = 0; - } - else { - maxCharge = GetCollectibleMaxCharge - (this,this->_activeDesc[slot]._item,this->_activeDesc[slot]._varData, - itemId); - } - iVar1 = GetActiveMaxCharge(this,slot); - if (((local_8 != 0) && (iVar1 != 1)) && (0 < maxCharge)) { - local_8 = GetTotalActiveCharge(this,slot); - if (this->_playerType == 0x24) { - iVar1 = this->_effectiveBloodCharge; - } - else { - iVar1 = 0; - } - iVar1 = (local_8 - iVar1) + oldBloodCharge; - if ((iVar1 < local_8) && (iVar1 < maxCharge)) { - HUD::FlashChargeBar(&g_game->_hud,this,slot); - iVar1 = local_8; - manager = g_manager; - local_8 = 0xda; - if (iVar1 < maxCharge) { - local_8 = 0xab; - } - seed_fart_sound_override(&local_8); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_8,1.0,2,0,1.0,0.0); - } - } - slot = slot + 1; - } while (slot < 4); - isHasBulb = HasTrinket(this,0x65,0); - if ((isHasBulb == 0) && (isHasBulb = HasTrinket(this,100,0), isHasBulb == 0)) { - return; - } - this->_cacheFlags = this->_cacheFlags | 0x40f; - EvaluateItems(this); - } - return; -} - -// 007d2fc0 -void Entity_Player::AddRottenHearts(int amount, uint8_t unk) -{ - uint32_t *puVar1; - int iVar2; - int newRedHearts; - Entity_Player *this_00; - Entity_Player *this_01; - Entity_Player *this_02; - int newRedHearts; - int amount_00; - int prevRottenHearts; - - while( true ) { - while ((newRedHearts = this->_playerType, newRedHearts == 0x28 && - (GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0)))) { - this = GHIDRA_CAST(this->_twinPlayer); - } - if (((0 < amount) && (unk == 0)) && (g_game->_challenge == 0x19)) break; - if ((newRedHearts != 0x11) || (GHIDRA_CAST(this->_subPlayer) == GHIDRA_CAST(0x0))) { - iVar2 = GetHealthType(this); - if ((iVar2 != 1) && (iVar2 = GetHealthType(this_00), iVar2 != 2)) { - iVar2 = GetHealthType(this_01); - if (iVar2 == 3) { - if (0 < amount_00) { - AddBlueFlies(this_02,(amount_00 * 3 + 1) / 2,&this->_pos,GHIDRA_CAST(0x0)); - return; - } - } - else { - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - ClampHeartsToLimit(this,0xc,amount_00); - return; - } - iVar2 = amount_00; - if (((newRedHearts == 0x16) && (unk == 0)) && (0 < amount_00)) { - iVar2 = amount_00 * 2; - } - prevRottenHearts = this->_rottenHearts; - newRedHearts = this->_maxHearts + this->_boneHearts * 2; - newRedHearts = this->_redHearts + iVar2; - if (newRedHearts < newRedHearts) { - newRedHearts = newRedHearts; - } - if (newRedHearts < 0) { - newRedHearts = 0; - } - this->_redHearts = newRedHearts; - if (iVar2 < 1) { - this->_rottenHearts = (iVar2 + -1) / 2 + prevRottenHearts; - UpdateHeartDependentEffects(this); - ClampGoldenHearts(this,0); - update_bone_hearts(this); - } - else { - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar1 = *puVar1 & 0xfffffffb; - this->_bleedOutHealth = 0; - this->_rottenHearts = (iVar2 + 1) / 2 + prevRottenHearts; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(this->_flags); - UpdateHeartDependentEffects(this); - ClampGoldenHearts(this,0); - update_bone_hearts(this); - if (prevRottenHearts < this->_rottenHearts) { - _player_hud_set_heart_anim_state(this); - return; - } - } - } - } - return; - } - unk = 0; - this = GHIDRA_CAST(this->_subPlayer); - } - return; -} - -// 007d3180 -bool Entity_Player::CanPickRottenHearts() -{ - uint8_t isFullHearts; - int iVar1; - - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - return this->_maxHearts < 0xa0; - } - while( true ) { - while (this->_playerType != 0x28) { - if ((this->_playerType != 0x11) || (GHIDRA_CAST(this->_subPlayer) == GHIDRA_CAST(0x0)) - ) goto LAB_007d31bd; - this = GHIDRA_CAST(this->_subPlayer); - } - if (GHIDRA_CAST(this->_twinPlayer) == GHIDRA_CAST(0x0)) break; - this = GHIDRA_CAST(this->_twinPlayer); - } -LAB_007d31bd: - iVar1 = GetHealthType(this); - if (iVar1 == 3) { - return false; - } - isFullHearts = HasFullHearts(this); - if ((isFullHearts == 0) || (iVar1 = GetEffectiveMaxHearts(this), this->_rottenHearts * 2 < iVar1)) - { - return true; - } - return false; -} - -// 007d3200 -void Entity_Player::UpdateBookOfVirtues(uint8_t addedBookOfVirtues) -{ - uint8_t isHasItem; - int currentActive; - Game *extraout_ECX; - Game *unused; - int iVar1; - void *removedCollectibles; - - iVar1 = 0; - isHasItem = HasCollectible(this,0x248,0); - if (isHasItem != 0) { - iVar1 = 0x248; - } - isHasItem = HasCollectible(this,0x3b,0); - unused = extraout_ECX; - if (isHasItem != 0) { - iVar1 = 0x3b; - removedCollectibles = (g_game->_itemPool)._removedCollectibles._begin; - unused = g_game; - if ((((*GHIDRA_CAST((GHIDRA_CAST(removedCollectibles) + 4)) & 4) == 0) && (g_game->_challenge != 0x2b)) && - (0x22 < (g_game->_itemPool)._removedCollectibles._size)) { - unused = GHIDRA_CAST((GHIDRA_INT(removedCollectibles) + 4)); - unused->_stage = unused->_stage | 4; - currentActive = this->_activeDesc[0]._item; - goto LAB_007d327a; - } - } - currentActive = this->_activeDesc[0]._item; - if (iVar1 == 0) { - if ((currentActive == 0x248) || (currentActive == 0x3b)) { - this->_activeDesc[0]._item = 0; - return; - } - return; - } -LAB_007d327a: - if ((iVar1 == currentActive) || - (((currentActive != 0 && (currentActive != 0x248)) && (currentActive != 0x3b)))) { - return; - } - this->_activeDesc[0]._item = iVar1; - if ((addedBookOfVirtues == 0) && ((this->_playerType != 0x12 || (iVar1 != 0x248)))) { - iVar1 = 0; - } - else { - iVar1 = GetCollectibleMaxCharge(this,iVar1,this->_activeDesc[0]._varData,GHIDRA_INT(unused)); - } - this->_activeDesc[0]._charge = iVar1; - this->_activeDesc[0]._batteryCharge = 0; - this->_activeDesc[0]._subCharge = 0; - this->_activeDesc[0]._partialCharge = 0; - this->_activeDesc[0]._timeRechargeCooldown = 0; - this->_activeDesc[0]._varData = 0; - return; -} - -// 007d3350 -void Entity_Player::trigger_vampire_charm_kill() -{ - uint8_t isHasVampireCharm; - uint32_t seed; - Entity *heartEffect; - int iVar1; - Entity_Player *soundId [2]; - Manager *manager; - - iVar1 = 0xd; - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - iVar1 = 8; - } - soundId[0] = this; - isHasVampireCharm = HasCollectible(this,0x3e,0); - if (((isHasVampireCharm != 0) && - (this->_vampireCharmKills = this->_vampireCharmKills + 1, manager = g_manager, - iVar1 <= this->_vampireCharmKills)) && (this->_dead == 0)) { - soundId[0] = GHIDRA_CAST(0x9d); - if (this->_playerType == 0x16) { - soundId[0] = GHIDRA_CAST(0x266); - } - seed_fart_sound_override(GHIDRA_CAST(soundId)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(soundId[0]),1.0,2,0,1.0,0.0); - AddHearts(this,1,1,0); - this->_vampireCharmKills = this->_vampireCharmKills - iVar1; - seed = Random(); - heartEffect = Game::SpawnEx(g_game,1000,0x31,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - iVar1 = __RTDynamicCast(heartEffect,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); - *GHIDRA_CAST((iVar1 + 0xdc)) = 0; - *GHIDRA_CAST((iVar1 + 0xe0)) = 0xc1c00000; - *GHIDRA_CAST((iVar1 + 0x358)) = 0x3f800000; - } - return; -} - -// 007d3480 -void Entity_Player::AddUrnSouls(uint32_t amount) -{ - uint32_t *clamped; - uint32_t *upperClamped; - uint32_t local_c [2]; - Game *game; - - amount = amount + this->_urnSouls; - local_c[1] = 0x14; - upperClamped = &amount; - if (0x13 < GHIDRA_INT(amount)) { - upperClamped = local_c + 1; - } - clamped = local_c; - if (0 < GHIDRA_INT(*upperClamped)) { - clamped = upperClamped; - } - this->_urnSouls = *clamped; - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007d34f0 -void Entity_Player::AddGigaBombs(int amount) -{ - int *clamped; - int *upperClamped; - int minCount; - Game *game; - - amount = this->_numGigaBombs + amount; - upperClamped = &amount; - if (this->_numBombs <= amount) { - upperClamped = &this->_numBombs; - } - minCount = 0; - clamped = &minCount; - if (0 < *upperClamped) { - clamped = upperClamped; - } - this->_numGigaBombs = *clamped; - ConsumableCountChanged(this,0x40); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007d35b0 -uint8_t Entity_Player::try_end_astral_projection() -{ - float fVar1; - uint8_t bVar2; - float fVar3; - Manager *pMVar4; - void *pvVar5; - ItemConfig_Item *Item; - uint32_t uVar6; - uint32_t rngResult; - Entity *effect; - float *roomColorMod; - uint8_t *deathAnimChar; - char *expectedAnimChar; - bool isCharLess; - float fVar7; - double dVar8; - uint8_t auStack_f4 [20]; - int soundId [3]; - float local_d4; - float local_d0; - float local_cc; - float local_c8; - float local_c4; - float trailStepDivisor; - Vector local_bc; - float bodyX; - float playerY; - int trailStep; - Color local_a8; - Vector trailVelocity; - ColorMod effectColor; - uint32_t local_44; - int astralBody; - Game *game; - - local_44 = __security_cookie ^ GHIDRA_UINT(auStack_f4); - if ((((this->_temporaryeffects)._disabled != 0) || - (pvVar5 = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x2a5), - pvVar5 == (void *)0x0)) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 4)) != 1)) { - return 0; - } - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if ((0xa94 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU))) - && (fVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xa94)), fVar7 != 0.0)) { - local_a8._tint[2] = *GHIDRA_CAST((GHIDRA_CAST(fVar7) + 0x78)); - local_a8._tint[1] = 0.0; - local_a8._tint[3] = 0.0; - local_a8._tint[0] = fVar7; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&local_a8,1,1); - } - pvVar5 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar5) & 0xfffffffcU)) < 0xa95) { - Item = GHIDRA_CAST(0x0); - } - else { - Item = *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xa94)); - } - RemoveCostume(this,Item); - astralBody = this->_astralProjectionBody; - if (astralBody != 0) { - local_d4 = *GHIDRA_CAST((astralBody + 0x33c)) - (this->_pos).x; - local_d0 = *GHIDRA_CAST((astralBody + 0x340)) - (this->_pos).y; - local_cc = local_d4 * 0.1; - local_c8 = local_d0 * 0.1; - local_bc.x = local_cc; - local_bc.y = local_c8; - fVar7 = sqrtf(local_cc * local_cc + local_c8 * local_c8); - if ((4.0 < fVar7) && (0.0 < fVar7)) { - local_bc.y = (4.0 / fVar7) * local_c8; - local_bc.x = (4.0 / fVar7) * local_cc; - } - local_d4 = sqrtf(local_d0 * local_d0 + local_d4 * local_d4); - local_d4 = local_d4 / 20.0; - dVar8 = floor((double)local_d4); - local_d4 = (float)dVar8; - astralBody = GHIDRA_INT(dVar8); - if (astralBody < 4) { - astralBody = 4; - } - if (0xc < astralBody) { - astralBody = 0xc; - } - if (0 < astralBody) { - trailStepDivisor = (float)(astralBody + 1); - trailStep = 0; - do { - trailStep = trailStep + 1; - local_d0 = (float)trailStep / trailStepDivisor; - bodyX = *GHIDRA_CAST((this->_astralProjectionBody + 0x33c)); - local_c4 = *GHIDRA_CAST((this->_astralProjectionBody + 0x340)); - local_d4 = (this->_pos).x; - playerY = (this->_pos).y; - uVar6 = Random(); - local_c8 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_c8 = local_c8 + local_c8; - uVar6 = Random(); - local_cc = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10; - fVar7 = cos(local_c8); - local_a8._tint[0] = fVar7 * local_cc * 15.0 + (bodyX - local_d4) * local_d0 + local_d4; - fVar7 = sin(local_c8); - local_a8._tint[1] = fVar7 * local_cc * 15.0 + (local_c4 - playerY) * local_d0 + playerY; - uVar6 = Random(); - rngResult = Random(); - trailVelocity.x = - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.5; - trailVelocity.y = trailVelocity.x * local_bc.y; - trailVelocity.x = trailVelocity.x * local_bc.x; - effect = Game::SpawnEx(g_game,1000,0x6f,GHIDRA_CAST(&local_a8),&trailVelocity,GHIDRA_CAST(0x0),0, - uVar6,0); - effectColor._offset[0] = 1.0; - effectColor._offset[1] = 1.0; - effectColor._colorize[0] = 0.0; - effectColor._colorize[1] = 0.0; - effectColor._colorize[2] = 0.0; - effectColor._colorize[3] = 0.0; - effectColor._tint[0] = 1.0; - effectColor._tint[1] = 1.0; - effectColor._tint[2] = 1.0; - effectColor._tint[3] = 1.0; - effectColor._offset[2] = 1.0; - effect->SetColor(&effectColor,0xffffffff,0xff,0); - local_c4 = local_d0 * g_vectorOne.x; - local_d0 = local_d0 * g_vectorOne.y; - uVar6 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 0.3 + 0.3; - (effect->_sprite)._scale.y = local_d0 * fVar7; - (effect->_sprite)._scale.x = fVar7 * local_c4; - fVar7 = (this->_posOffset).y; - fVar1 = (this->_sprite)._scale.y; - (effect->_posOffset).x = (this->_posOffset).x + 0.0; - (effect->_posOffset).y = fVar7 - fVar1 * 16.0; - } while (trailStep < astralBody); - } - uVar6 = Random(); - effect = Game::SpawnEx(g_game,1000,0x10,&this->_pos,&local_bc,GHIDRA_CAST(0x0),10,uVar6,0); - effectColor._tint[0] = 1.0; - effectColor._tint[1] = 1.0; - effectColor._tint[2] = 1.0; - effectColor._tint[3] = 1.0; - effectColor._colorize[0] = 1.0; - effectColor._colorize[1] = 1.0; - effectColor._colorize[2] = 1.0; - effectColor._colorize[3] = 1.0; - effectColor._offset[0] = 0.0; - effectColor._offset[1] = 0.0; - effectColor._offset[2] = 0.0; - effect->SetColor(&effectColor,0xffffffff,0xff,0); - (effect->_posOffset).x = (this->_posOffset).x; - (effect->_posOffset).y = (this->_posOffset).y; - (effect->_sprite)._scale.x = (this->_sprite)._scale.x; - (effect->_sprite)._scale.y = (this->_sprite)._scale.y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - local_bc.x = *GHIDRA_CAST((this->_astralProjectionBody + 0x33c)); - local_bc.y = *GHIDRA_CAST((this->_astralProjectionBody + 0x340)); - Teleport(this,&local_bc,0,0); - (**(code **)(*GHIDRA_CAST(this->_astralProjectionBody) + 0x28))(); - } - this->ResetColor(); - local_a8._offset[2] = (this->_sprite)._color._offset[2]; - effectColor._colorize[0] = 0.0; - effectColor._colorize[1] = 0.0; - effectColor._colorize[2] = 0.0; - effectColor._colorize[3] = 0.0; - effectColor._tint[0] = 1.0; - effectColor._tint[1] = 1.0; - effectColor._tint[2] = 1.0; - effectColor._tint[3] = 1.0; - local_a8._tint[0] = (this->_sprite)._color._tint[0]; - local_a8._tint[1] = (this->_sprite)._color._tint[1]; - local_a8._tint[2] = (this->_sprite)._color._tint[2]; - local_a8._tint[3] = (this->_sprite)._color._tint[3]; - effectColor._offset[0] = 1.0; - effectColor._offset[1] = 1.0; - effectColor._offset[2] = 1.0; - local_a8._colorize[0] = (this->_sprite)._color._colorize[0]; - local_a8._colorize[1] = (this->_sprite)._color._colorize[1]; - local_a8._colorize[2] = (this->_sprite)._color._colorize[2]; - local_a8._colorize[3] = (this->_sprite)._color._colorize[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a8._offset)) + 0x0))) = *GHIDRA_CAST((this->_sprite)._color._offset); - (GHIDRA_CAST((&local_a8)))->Color::__mul(&effectColor); - effectColor._tint[0] = local_a8._tint[0]; - effectColor._tint[1] = local_a8._tint[1]; - effectColor._tint[2] = local_a8._tint[2]; - effectColor._tint[3] = local_a8._tint[3]; - effectColor._offset[2] = local_a8._offset[2]; - effectColor._colorize[0] = local_a8._colorize[0]; - effectColor._colorize[1] = local_a8._colorize[1]; - effectColor._colorize[2] = local_a8._colorize[2]; - effectColor._colorize[3] = local_a8._colorize[3]; - effectColor._offset[0] = local_a8._offset[0]; - effectColor._offset[1] = local_a8._offset[1]; - this->SetColor(&effectColor,8,0xff,1,1); - game = g_game; - g_game->_bloomDuration = 10; - game->_bloomTimer = 10; - game->_bloomStrength = 0.6; - roomColorMod = (GHIDRA_CAST((game->_room)))->Room::get_color_modifier(&local_bc.x); - game = g_game; - fVar7 = roomColorMod[1]; - fVar1 = roomColorMod[2]; - fVar3 = roomColorMod[3]; - (g_game->_targetColorModifier)._red = *roomColorMod; - (game->_targetColorModifier)._green = fVar7; - (game->_targetColorModifier)._blue = fVar1; - (game->_targetColorModifier)._amount = fVar3; - fVar7 = roomColorMod[5]; - (game->_targetColorModifier)._brightness = roomColorMod[4]; - (game->_targetColorModifier)._contrast = fVar7; - fVar7 = (game->_targetColorModifier)._green; - fVar1 = (game->_targetColorModifier)._blue; - fVar3 = (game->_targetColorModifier)._amount; - (game->_currentColorModifier)._red = (game->_targetColorModifier)._red; - (game->_currentColorModifier)._green = fVar7; - (game->_currentColorModifier)._blue = fVar1; - (game->_currentColorModifier)._amount = fVar3; - fVar7 = (game->_targetColorModifier)._contrast; - (game->_currentColorModifier)._brightness = (game->_targetColorModifier)._brightness; - (game->_currentColorModifier)._contrast = fVar7; - game->_shouldLerpColorModState = 0; - try_trigger_astral_projection(this); - if (this->_dead == 0) { - astralBody = this->_damageCooldown; - if (astralBody < 0x78) { - astralBody = 0x78; - } - this->_damageCooldown = astralBody; - } - else { - expectedAnimChar = "Death"; - deathAnimChar = GetDeathAnimName(this); - do { - bVar2 = *deathAnimChar; - isCharLess = bVar2 < (uint8_t)*expectedAnimChar; - if (bVar2 != *expectedAnimChar) { -LAB_007d3d20: - uVar6 = -GHIDRA_UINT(isCharLess) | 1; - goto LAB_007d3d25; - } - if (bVar2 == 0) break; - bVar2 = deathAnimChar[1]; - isCharLess = bVar2 < (uint8_t)expectedAnimChar[1]; - if (bVar2 != expectedAnimChar[1]) goto LAB_007d3d20; - deathAnimChar = deathAnimChar + 2; - expectedAnimChar = expectedAnimChar + 2; - } while (bVar2 != 0); - uVar6 = 0; -LAB_007d3d25: - if (uVar6 == 0) { - PlayExtraAnimation(this,GHIDRA_CAST("Death")); - if ((this->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,24.0); - } - local_d4 = get_voice_pitch(this); - pMVar4 = g_manager; - soundId[0] = 0xd9; - seed_fart_sound_override(soundId); - (GHIDRA_CAST((&pMVar4->_sfxManager)))->SoundEffects::Play(soundId[0],1.0,2,0,local_d4,0.0); - return 1; - } - } - return 1; -} - -// 007d3e40 -void Entity_Player::fire_saturnus_tears() -{ - uint32_t uVar1; - uint32_t uVar2; - Vector velocity; - BitSet128 flags; - uint32_t rngResult; - Entity_Tear *tear; - float fVar3; - float fVar4; - float fVar5; - int i; - Vector tearPos; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t uStack_18; - uint32_t uStack_14; - uint64_t flagsHigh; - uint64_t flagsLow; - Game *game; - double uintFixup; - - rngResult = Random(); - uintFixup = __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]; - i = 0; - do { - fVar5 = (float)((double)GHIDRA_INT(rngResult) + uintFixup) * 2.3283064e-10 * 360.0 - - (float)i * 51.42857; - fVar3 = fVar5 * 0.017453292; - fVar4 = cos(fVar3); - tearPos.x = fVar4 * 4.0 + (this->_pos).x; - fVar3 = sin(fVar3); - tearPos.y = fVar3 * 4.0 + (this->_pos).y; - fVar5 = (fVar5 + 90.0) * 0.017453292; - fVar3 = this->_shotspeed * 10.0; - fVar4 = cos(fVar5); - fVar5 = sin(fVar5); - velocity.y = fVar5 * fVar3; - velocity.x = fVar4 * fVar3; - tear = FireTear(this,&tearPos,velocity,0x47,GHIDRA_CAST(0x0),1.5); - tear->SetCollisionDamage(tear->_collisionDamage + 5.0); - flagsLow = (tear->_tearFlags)._l; - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)); - flagsHigh = (tear->_tearFlags)._h; - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)); - tear->_tearIdx = 1; - uStack_20 = ~(GHIDRA_UINT(g_tearFlagHoming._l) | GHIDRA_UINT(g_tearFlagBounce._l) | - GHIDRA_UINT(g_tearFlagBoomerang._l) | GHIDRA_UINT(g_tearFlagOrbit._l) | - GHIDRA_UINT(g_tearFlagLudovico._l) | GHIDRA_UINT(g_tearFlagOccult._l)) & - (GHIDRA_UINT(flagsLow) | GHIDRA_UINT(g_tearFlagNoGridDamage._l) | GHIDRA_UINT(g_tearFlagSpectral._l) | - GHIDRA_UINT(g_tearFlagOrbitAdvanced._l)); - uStack_1c = ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBoomerang._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._l)) + 0x4)))) & - (uVar1 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagNoGridDamage._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbitAdvanced._l)) + 0x4)))); - uStack_18 = ~(GHIDRA_UINT(g_tearFlagHoming._h) | GHIDRA_UINT(g_tearFlagBounce._h) | - GHIDRA_UINT(g_tearFlagBoomerang._h) | GHIDRA_UINT(g_tearFlagOrbit._h) | - GHIDRA_UINT(g_tearFlagLudovico._h) | GHIDRA_UINT(g_tearFlagOccult._h)) & - (GHIDRA_UINT(flagsHigh) | GHIDRA_UINT(g_tearFlagNoGridDamage._h) | GHIDRA_UINT(g_tearFlagSpectral._h) | - GHIDRA_UINT(g_tearFlagOrbitAdvanced._h)); - uStack_14 = ~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBoomerang._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._h)) + 0x4)))) & - (uVar2 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagNoGridDamage._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbitAdvanced._h)) + 0x4)))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = uStack_1c; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = uStack_20; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uStack_18; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_14; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); - tear->_height = -20.0; - fVar3 = (GHIDRA_CAST((tear)))->Entity_Tear::get_height_offset_y(-20.0); - game = g_game; - (tear->_posOffset).y = fVar3; - if (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) { - (tear->_posOffset).y = -18.0; - } - i = i + 1; - tear->_fallingSpeed = 0.0; - tear->_fallingAccel = -0.096; - } while (i < 7); - return; -} - -// 007d4150 -int Entity_Player::GetMaxInventorySize() -{ - uint8_t isBirthright; - - isBirthright = HasCollectible(this,0x26b,0); - return GHIDRA_UINT((isBirthright != 0)) * 4 + 8; -} - -// 007d4170 -uint8_t Entity_Player::CanAddCollectibleToInventory(int id) -{ - uint8_t isQuestItem; - ItemConfig_Item *item; - - item = ItemConfig::GetCollectible(&g_manager->_itemConfig,id); - if ((((item != GHIDRA_CAST(0x0)) && (item->type != 3)) && (id != 0x290)) && (id != 0x26b)) { - isQuestItem = (GHIDRA_CAST((item)))->Item::HasTags(0x8000); - if (isQuestItem == 0) { - return 1; - } - } - return 0; -} - -// 007d41d0 -void Entity_Player::SetPocketActiveItem(int collectible, int slot, uint8_t keepInPools) -{ - ItemConfig_Item *item; - uint32_t uVar1; - int *pocketSlot; - int *srcSlot; - int *dstSlot; - uint32_t pocketIdx; - Game *game; - uint32_t *removedWord; - - if (slot - 2U < 2) { - pocketSlot = this->_pocketSlots; - pocketIdx = 0; - do { - if ((pocketSlot[1] == 2) && (*pocketSlot == slot + 1)) { - uVar1 = this->_activeDesc[*pocketSlot + -1]._item; - if (uVar1 != 0) { - RemoveCollectible(this,uVar1,1,slot,1); - } - if (pocketIdx < 3) { - srcSlot = pocketSlot + 2; - dstSlot = pocketSlot; - for (uVar1 = (3 - pocketIdx) * 2 & 0x3ffffffe; uVar1 != 0; uVar1 = uVar1 - 1) { - *dstSlot = *srcSlot; - srcSlot = srcSlot + 1; - dstSlot = dstSlot + 1; - } - } - this->_pocketSlots[6] = 0; - this->_pocketSlots[7] = 1; - } - pocketIdx = pocketIdx + 1; - pocketSlot = pocketSlot + 2; - } while (pocketIdx < 4); - if ((collectible != 0) && - (item = ItemConfig::GetCollectible(&g_manager->_itemConfig,collectible), - item != GHIDRA_CAST(0x0))) { - AddPocketItem(this,slot + 1,2); - AddCollectible(this,collectible,-1,1,slot,0,0); - game = g_game; - if ((keepInPools == 0) && ((-1 < collectible && (g_game->_challenge != 0x2b)))) { - if (collectible == 0x1e4) { - ItemPool::RemoveCollectible(&g_game->_itemPool,0x126,0,0); - } - if (GHIDRA_UINT(collectible) < (game->_itemPool)._removedCollectibles._size) { - removedWord = GHIDRA_CAST((GHIDRA_INT((game->_itemPool)._removedCollectibles._begin) + - (GHIDRA_UINT(collectible) >> 5) * 4)); - *removedWord = *removedWord | 1 << (collectible & 0x1fU); - } - } - } - } - return; -} - -// 007d4340 -void Entity_Player::get_salvation_scale() -{ - int in_ECX; - - if (*GHIDRA_CAST((in_ECX + 0x1519)) == '\0') { - (GHIDRA_CAST((GHIDRA_CAST((in_ECX + 0x1508)))))->TemporaryEffects::GetCollectibleEffect(0x2b8); - } - return; -} - -// 007d4390 -void Entity_Player::update_suplex() -{ - Entity_Player *pEVar1; - uint8_t bVar2; - char *animName; - uint8_t **ppuVar3; - std_string *curAnimChars; - uint32_t uVar4; - Entity *effect; - uint32_t rngResult; - int iVar5; - Entity_Familiar *wisp; - Vector *targetPos; - void *pvVar6; - int iVar7; - int *piVar8; - AnimationState *animState; - float fVar9; - float fVar10; - Vector markedPosX; - uint8_t *local_7c4; - uint8_t *bombRadius; - Entity_Player *local_7bc; - uint8_t *local_7b8; - uint8_t *local_7b4; - uint8_t isSuperLeap; - Entity_Player *local_7ac; - NPCAI_Pathfinder pathfinder; - void *local_60 [2]; - uint32_t local_58; - EntityRef EStack_54; - void *curAnim [2]; - uint8_t local_24 [8]; - Vector local_1c; - uint32_t stackCookie; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *animNameSize; - Manager *manager; - Room *room; - int *suplexWisp; - code *takeDamageFn; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b00308; - local_10 = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((local_24 + 0x20)); - ExceptionList = &local_10; - local_7bc = this; - iVar5 = this->_suplexState; - if (((iVar5 != 0) && (1 < iVar5)) && (this->_entityCollisionClass = 0, 2 < iVar5)) { - this->_entityGridCollisionClass = 0; - } - pvVar6 = this->_heldEntity; - if ((((pvVar6 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x28)) == 4)) && - ((iVar5 == 2 || ((iVar5 == 3 || (iVar5 == 4)))))) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x410)) < 2)) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x410)) = 10; - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x414)) = 10; - iVar5 = this->_suplexState; - } - if (0 < this->_suplexAimCountdown) { - iVar7 = this->_suplexAimCountdown + (GHIDRA_INT(this->_updateTime) - GHIDRA_INT(this->_prevUpdateTime)) * -2; - this->_suplexAimCountdown = iVar7; - if (iVar5 == 5) { - this->_suplexAimCountdown = 0; -LAB_007d44b8: - if (this->_heldEntity == (void *)0x0) { - this->_cacheFlags = this->_cacheFlags | 0x80; - this->_suplexState = 0; - this->_entityCollisionClass = 4; - EvaluateItems(this); - this->_blinkTime = 1; - this->_itemStateCooldown = 5; - PlayExtraAnimation(this,GHIDRA_CAST("HideItem")); - } - else { - pvVar6 = this->_markedTarget; - targetPos = &markedPosX; - if (pvVar6 == (void *)0x0) { - local_1c.x = (this->_pos).x; - local_1c.y = (float)(this->_pos).y; - targetPos = &local_1c; - } - else { - markedPosX.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x33c)); - markedPosX.y = (float)*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x340)); - } - (this->_suplexTargetPos).x = targetPos->x; - (this->_suplexTargetPos).y = targetPos->y; - (this->_suplexLandPos).x = (this->_pos).x; - (this->_suplexLandPos).y = (this->_pos).y; - animName = "SuperLeapUp"; - if (this->_suplexState != 5) { - animName = "LeapUp"; - } - PlayExtraAnimation(this,GHIDRA_CAST(animName)); - manager = g_manager; - this->_suplexState = 3; - local_7ac = GHIDRA_CAST(0x408); - seed_fart_sound_override(GHIDRA_CAST(&local_7ac)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_7ac),1.0,2,0,1.0,0.0); - bVar2 = HasCollectible(this,0x248,0); - if (bVar2 != 0) { - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_24),3,0xce, - 0x2c5,0,0); - piVar8 = GHIDRA_CAST(0x0); - local_8 = 0; - if (GHIDRA_CAST(local_1c.y) != GHIDRA_CAST(0x0)) { - pvVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_24)) + 0x4))); - do { - suplexWisp = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + GHIDRA_INT(piVar8) * 4)); - if (GHIDRA_CAST(suplexWisp[0x104]) == this) { - EStack_54._position.x = g_vectorZero.x; - EStack_54._velocity.x = g_vectorZero.x; - EStack_54._position.y = g_vectorZero.y; - EStack_54._velocity.y = g_vectorZero.y; - EStack_54._type = 0; - EStack_54._variant = 0; - EStack_54._spawnerType = 0; - EStack_54._spawnerVariant = 0; - EStack_54._flags = 0; - EStack_54._entity = (void *)0x0; - (**(code **)(*suplexWisp + 0x24))(&EStack_54); - pvVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_24)) + 0x4))); - } - piVar8 = GHIDRA_CAST((GHIDRA_INT(piVar8) + 1)); - } while (piVar8 < GHIDRA_UINT(local_1c.y)); - } - local_8 = 0xffffffff; - if (local_24[0] == '\0') { - local_8 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_24)) + 0x4))),0); - local_8 = 0xffffffff; - } - } - } - } - else if (iVar7 < 1) { - this->_suplexAimCountdown = 0; - if (iVar5 == 1) { - this->_cacheFlags = this->_cacheFlags | 0x80; - this->_suplexState = 0; - this->_entityCollisionClass = 4; - EvaluateItems(this); - } - else if (iVar5 == 2) goto LAB_007d44b8; - } - } - if (this->_suplexState == 3) { - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) { - ExceptionList = local_10; - return; - } - this->_suplexState = 4; - Teleport(this,&this->_suplexTargetPos,0,0); - pvVar6 = this->_heldEntity; - if (pvVar6 != (void *)0x0) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x33c)) = (this->_suplexTargetPos).x; - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x340)) = (this->_suplexTargetPos).y; - } - curAnimChars = ANM2::GetAnimation(GHIDRA_CAST(&(this->_sprite)._animState),GHIDRA_CAST(curAnim)); - animNameSize = &curAnimChars->_size; - if (0xf < curAnimChars->_capacity) { - curAnimChars = *GHIDRA_CAST(curAnimChars->_buf); - } - isSuperLeap = str_eq(GHIDRA_CAST(curAnimChars),*animNameSize,GHIDRA_CAST("SuperLeapUp"),0xb); - if (&DAT_0000000f < GHIDRA_UINT(local_1c.y)) { - piVar8 = GHIDRA_CAST((GHIDRA_INT(local_1c.y) + 1)); - pvVar6 = curAnim[0]; - if (GHIDRA_CAST(0xfff) < piVar8) { - pvVar6 = *(void **)(GHIDRA_INT(curAnim[0]) + -4); - piVar8 = GHIDRA_CAST((GHIDRA_INT(local_1c.y) + 0x24)); - if (0x1f < GHIDRA_UINT((GHIDRA_INT(curAnim[0]) + (-4 - GHIDRA_INT(pvVar6))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar6,GHIDRA_UINT(piVar8)); - } - if (isSuperLeap == 0) { - animName = "LeapDown"; - } - else { - animName = "SuperLeapDown"; - } - PlayExtraAnimation(this,GHIDRA_CAST(animName)); - ExceptionList = local_10; - return; - } - if (this->_suplexState != 4) { - ExceptionList = local_10; - return; - } - if ((this->_sprite)._animState._animData != (void *)0x0) { - bVar2 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,&DAT_00b1d534); - manager = g_manager; - if (bVar2 != 0) { - fVar9 = (this->_playerSpriteScale).x; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - local_7b4 = GHIDRA_CAST(0x42200000); - local_7b8 = GHIDRA_CAST((fVar9 * 50.0)); - ppuVar3 = &local_7b8; - if ((float)local_7b8 <= 40.0) { - ppuVar3 = &local_7b4; - } - bombRadius = *ppuVar3; - } - else { - bombRadius = GHIDRA_CAST(0x41c80000); - } - local_7b4 = GHIDRA_CAST((fVar9 * 25.0)); - local_7c4 = GHIDRA_CAST(0x41a00000); - local_7ac = GHIDRA_CAST(0x409); - ppuVar3 = &local_7b4; - if ((float)local_7b4 <= 20.0) { - ppuVar3 = &local_7c4; - } - local_7b8 = *ppuVar3; - seed_fart_sound_override(GHIDRA_CAST(&local_7ac)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_7ac),1.0,2,0,1.0,0.0); - curAnimChars = ANM2::GetAnimation(GHIDRA_CAST(&(local_7bc->_sprite)._animState), - GHIDRA_CAST(curAnim)); - animNameSize = &curAnimChars->_size; - if (0xf < curAnimChars->_capacity) { - curAnimChars = *GHIDRA_CAST(curAnimChars->_buf); - } - isSuperLeap = str_eq(GHIDRA_CAST(curAnimChars),*animNameSize,GHIDRA_CAST("SuperLeapDown"),0xd); - if (&DAT_0000000f < GHIDRA_UINT(local_1c.y)) { - piVar8 = GHIDRA_CAST((GHIDRA_INT(local_1c.y) + 1)); - pvVar6 = curAnim[0]; - if (GHIDRA_CAST(0xfff) < piVar8) { - pvVar6 = *(void **)(GHIDRA_INT(curAnim[0]) + -4); - piVar8 = GHIDRA_CAST((GHIDRA_INT(local_1c.y) + 0x24)); - if (0x1f < GHIDRA_UINT((GHIDRA_INT(curAnim[0]) + (-4 - GHIDRA_INT(pvVar6))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar6,GHIDRA_UINT(piVar8)); - } - manager = g_manager; - local_1c.x = 0.0; - local_1c.y = 2.10195e-44; - curAnim[0] = (void *)(GHIDRA_UINT(curAnim[0]) & 0xffffff00); - if (isSuperLeap == 0) { - Game::ShakeScreen(g_game,0xe); - manager = g_manager; - local_7b4 = GHIDRA_CAST(0x34); - seed_fart_sound_override(GHIDRA_CAST(&local_7b4)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_7b4),1.0,2,0,1.0,0.0); - this = local_7bc; - Game::MakeShockwave(g_game,&local_7bc->_pos,0.04,0.025,0xd); - local_7b4 = GHIDRA_CAST(0x428c0000); - local_7c4 = GHIDRA_CAST(((this->_playerSpriteScale).x * 40.0 + 50.0)); - ppuVar3 = &local_7c4; - if ((float)local_7c4 <= 70.0) { - ppuVar3 = &local_7b4; - } - local_1c.y = (float)*ppuVar3 / 9.0; - uVar4 = Random(); - markedPosX.y = (float)Game::Spawn(g_game,1000,0x3d,&this->_pos,&g_vectorZero,GHIDRA_CAST(this), - 0,uVar4); - local_7bc = GHIDRA_CAST(&(GHIDRA_CAST(markedPosX.y))->_parent); - if ((GHIDRA_CAST(markedPosX.y))->_parent != 0) { - local_7ac = local_7bc; - msvc::multiset::erase(&local_7ac); - } - *GHIDRA_CAST(local_7bc) = this; - msvc::multiset::insert(local_7bc); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(markedPosX.y) + 0x410))))) + 0x44)))) = this->_size; - *GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(markedPosX.y) + 0x410)))->_sprite)._filename._buf) = *ppuVar3 - ; - *GHIDRA_CAST((((GHIDRA_CAST((GHIDRA_INT(markedPosX.y) + 0x410)))->_sprite)._filename._buf + 4)) = - GHIDRA_INT(local_1c.y); - *GHIDRA_CAST((((GHIDRA_CAST((GHIDRA_INT(markedPosX.y) + 0x410)))->_sprite)._filename._buf + 8)) = - GHIDRA_INT(local_1c.y); - } - else { - bombRadius = GHIDRA_CAST(((float)bombRadius * 6.0)); - local_7ac = GHIDRA_CAST(0x34); - local_7b8 = GHIDRA_CAST(((float)*ppuVar3 + (float)*ppuVar3)); - seed_fart_sound_override(GHIDRA_CAST(&local_7ac)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_7ac),1.0,2,0,1.0,0.0); - uVar4 = Random(); - pEVar1 = local_7bc; - targetPos = &local_7bc->_pos; - effect = Game::Spawn(g_game,1000,0x7f,targetPos,&g_vectorZero,GHIDRA_CAST(local_7bc),0,uVar4); - fVar9 = (pEVar1->_pos).y; - iVar5 = *GHIDRA_CAST(effect); - (effect->_targetPosition).x = targetPos->x; - (effect->_targetPosition).y = fVar9; - (**(code **)(iVar5 + 0xc))(); - uVar4 = Random(); - effect = Game::Spawn(g_game,1000,0x12,targetPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - fVar9 = g_vectorOne.y * 2.0; - iVar5 = *GHIDRA_CAST(effect); - (effect->_sprite)._scale.x = g_vectorOne.x * 2.0; - (effect->_sprite)._scale.y = fVar9; - (**(code **)(iVar5 + 0xc))(); - uVar4 = 0; - do { - rngResult = Random(); - local_7c4 = (uint8_t *) - ((((((float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) + - (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10) - - 0.5) * 360.0) / 15.0) * 0.017453292); - local_7ac = GHIDRA_CAST(sin((float)local_7c4)); - rngResult = Random(); - local_7b4 = (uint8_t *) - ((float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 5.0 + 15.0); - local_1c.x = cos((float)local_7c4); - local_1c.x = local_1c.x * (float)local_7b4; - local_1c.y = (float)local_7b4 * (float)local_7ac * 0.85; - rngResult = Random(); - local_7ac = (Entity_Player *) - Game::Spawn(g_game,1000,0x3b,targetPos,&local_1c,GHIDRA_CAST(0x0),0,rngResult); - rngResult = Random(); - if ((rngResult & 1) == 0) { - local_7b4 = &DAT_bf800000; - } - else { - local_7b4 = GHIDRA_CAST(0x3f800000); - } - rngResult = Random(); - (local_7ac->_bodySprite)._overlayAnimState._layerFrames = - (void *)(((float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 10.0 + 2.0) * (float)local_7b4); - rngResult = Random(); - fVar10 = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.6 + - 1.0; - fVar9 = fVar10 * g_vectorOne.x; - (local_7ac->_sprite)._scale.y = fVar10 * g_vectorOne.y; - (local_7ac->_sprite)._scale.x = fVar9; - rngResult = Random(); - EStack_54._velocity.y = 0.0; - EStack_54._flags = 0; - fVar9 = (float)(rngResult % 0x28 + 0x28); - EStack_54._entity = (void *)0x0; - EStack_54._spawnerVariant = 0; - EStack_54._position.x = 0.0; - EStack_54._position.y = 0.0; - EStack_54._velocity.x = 0.0; - iVar5 = *GHIDRA_CAST(local_7ac); - (local_7ac->_bodySprite)._animState._animFrame = fVar9; - *GHIDRA_CAST(&(local_7ac->_bodySprite)._animState._isPlaying) = fVar9; - local_58 = 0x3ee66666; - EStack_54._type = 0x3ee66666; - EStack_54._variant = 0x3eeb851f; - EStack_54._spawnerType = 0x3f400000; - (**(code **)(iVar5 + 0x3c))(); - uVar4 = uVar4 + 1; - } while (uVar4 < 0xf); - uVar4 = Random(); - this = local_7bc; - effect = Game::Spawn(g_game,1000,0x10,targetPos,&g_vectorZero,GHIDRA_CAST(local_7bc),1,uVar4); - fVar9 = g_vectorOne.y * 2.0; - (effect->_sprite)._scale.x = g_vectorOne.x * 2.0; - (effect->_sprite)._scale.y = fVar9; - uVar4 = Random(); - (effect->_sprite)._flipX = ((uint8_t)uVar4 ^ 0xff) & 1; - effect->Update(); - } - local_1c.y = (float)this->_heldEntity; - if (GHIDRA_CAST(local_1c.y) != GHIDRA_CAST(0x0)) { - takeDamageFn = *(code **)(*GHIDRA_CAST(local_1c.y) + 0x20); - (GHIDRA_CAST((&EStack_54)))->EntityRef::constructor(GHIDRA_CAST(this)); - (*takeDamageFn)(); - pvVar6 = this->_heldEntity; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x28)) == 4) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x410)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x414)) = 0; - (**(code **)(*GHIDRA_CAST(this->_heldEntity) + 0xc))(); - } - } - targetPos = &this->_pos; - Game::BombDamage(g_game,targetPos,(float)bombRadius,(float)local_7b8,0,GHIDRA_CAST(this), - g_tearFlagsNone,0x1000000,0); - room = g_game->_room; - iVar7 = GHIDRA_INT(((targetPos->x - 40.0) / 40.0 + 0.5)); - iVar5 = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)); - if ((((iVar7 < 0) || (room->_gridWidth <= iVar7)) || (iVar5 < 0)) || - (room->_gridHeight <= iVar5)) { - iVar7 = -1; - } - else { - iVar7 = iVar5 * room->_gridWidth + iVar7; - } - uVar4 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar7); - if ((uVar4 == 0) || ((this->_canFly != 0 && (GHIDRA_INT(uVar4) < 4)))) { - (GHIDRA_CAST((GHIDRA_CAST(&pathfinder))))->PathFinder::Init(GHIDRA_CAST(this)); - local_8 = 2; - bVar2 = (GHIDRA_CAST((&pathfinder)))->NPCAI_Pathfinder::HasPathToPos(&this->_suplexLandPos,0); - if (bVar2 != 0) { - (this->_suplexLandPos).x = targetPos->x; - (this->_suplexLandPos).y = (this->_pos).y; - } - local_8 = 0xffffffff; - FID_conflict__Erase_tree_>_> - (local_60,(fuzzer_allocator_> *)local_60, - *(_Tree_node **)(GHIDRA_INT(local_60[0]) + 4)); - operator_delete(local_60[0],0x14); - } - bVar2 = HasCollectible(this,0x248,0); - if (bVar2 != 0) { - local_7b8 = GHIDRA_CAST(0x3); - do { - wisp = AddWisp(this,0x2c5,targetPos,0,1); - if (wisp != GHIDRA_CAST(0x0)) { - fVar9 = (this->_pos).y; - (wisp->_targetPosition).x = targetPos->x; - (wisp->_targetPosition).y = fVar9; - } - local_7b8 = local_7b8 + -1; - } while (local_7b8 != GHIDRA_CAST(0x0)); - } - } - if ((this->_sprite)._animState._animData != (void *)0x0) { - animState = &(this->_sprite)._animState; - bVar2 = AnimationState::IsEventTriggered(animState,&DAT_00b1d3b0); - if (bVar2 != 0) { - ThrowHeldEntity(this,&g_vectorZero); - } - goto LAB_007d4fc6; - } - } - animState = &(this->_sprite)._animState; -LAB_007d4fc6: - if ((this->_sprite)._animState._animData != (void *)0x0) { - bVar2 = AnimationState::WasEventTriggered(animState,&DAT_00b1d3b0); - if (bVar2 != 0) { - fVar9 = (this->_suplexLandPos).y; - fVar10 = (this->_pos).y; - (this->_velocity).x = ((this->_suplexLandPos).x - (this->_pos).x) * 0.3; - (this->_velocity).y = (fVar9 - fVar10) * 0.3; - } - if (((this->_sprite)._animState._animData != (void *)0x0) && - ((this->_sprite)._animState._isPlaying != 0)) { - ExceptionList = local_10; - return; - } - } - this->_suplexState = 0; - this->_blinkTime = 1; - this->_itemStateCooldown = 5; - iVar5 = this->_damageCooldown; - this->_entityCollisionClass = 4; - if (iVar5 < 0xf) { - iVar5 = 0xf; - } - this->_cacheFlags = this->_cacheFlags | 0x80; - this->_damageCooldown = iVar5; - EvaluateItems(this); - ExceptionList = local_10; - return; -} - -// 007d5170 -uint32_t Entity_Player::bag_of_crafting_collect(Entity_Pickup *param_1) -{ - int iVar1; - float fVar2; - Entity *pEVar3; - uint8_t bVar4; - uint32_t uVar5; - undefined3 extraout_var; - uint8_t *animName; - uint32_t *craftingOutput; - HUD *playerHud; - Entity_Player *in_ECX; - char *collectAnimName; - Entity_Pickup *extraout_ECX; - Entity_Pickup *pickup; - uint32_t uVar6; - int iVar7; - bool isLess; - Entity *local_50; - Entity_Pickup *collectedPickup; - ColorMod poofColor; - uint8_t local_1c [12]; - float local_10; - uint32_t local_c; - uint8_t auStack_8 [4]; - bool isCoinUpgraded; - Manager *manager; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - collectedPickup = param_1; - uVar5 = param_1->_variant; - if ((((uVar5 == 10) || (uVar5 == 0x14)) || (uVar5 == 0x5a)) || - (((uVar5 == 0x28 || (uVar5 == 0x1e)) || ((uVar5 == 0x46 || (uVar5 == 300)))))) { - if ((uVar5 == 0x45) || (uVar5 == 0x29)) goto switchD_007d5299_caseD_4; - } - else if ((uVar5 == 0x15e) || (((uVar5 == 0x45 || (uVar5 == 0x29)) || (uVar5 != 0x2a)))) - goto switchD_007d5299_caseD_4; - if ((param_1->_price != 0) && - (uVar5 = (GHIDRA_CAST((param_1)))->Entity_Pickup::can_player_buy(in_ECX), (char)uVar5 == '\0')) - goto switchD_007d5299_caseD_4; - iVar1 = param_1->_variant; - iVar7 = param_1->_subtype; - local_50 = GHIDRA_CAST(0x0); - isCoinUpgraded = false; - bVar4 = HasCollectible(in_ECX,0x3b,0); - pickup = collectedPickup; - uVar5 = CONCAT31(extraout_var,bVar4); - if ((bVar4 == 0) || (iVar1 != 10)) { - if (iVar1 < 0x2b) { - if (iVar1 != 0x2a) goto LAB_007d5282; - } - else if (iVar1 != 0x46) { - if (iVar1 == 0x5a) { - if ((iVar7 == 1) || (iVar7 == 3)) goto LAB_007d54dd; - } - else { - if (iVar1 != 300) goto switchD_007d5299_caseD_4; - if (iVar7 == 0x31) goto LAB_007d54dd; - if (iVar7 != 0x4e) { - ItemConfig::GetCard(&g_manager->_itemConfig,collectedPickup->_subtype); - } - } - goto LAB_007d54e0; - } - goto LAB_007d54dd; - } - if (((iVar7 == 2) || (iVar7 == 1)) || (iVar7 == 5)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1c)) + 0x4))) = 1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1c)) + 0x8))) = 0x13; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1c)) + 0x0))) = collectedPickup->_initSeed; - local_10 = 4.2039e-45; - uVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_1c))))->RNG::RandomInt(8); - if (uVar5 != 0) goto LAB_007d5282; - iVar7 = 6; - isCoinUpgraded = true; - } - else { -LAB_007d5282: - isCoinUpgraded = false; - if (0x1e < iVar1 - 10U) goto switchD_007d5299_caseD_4; - } - uVar5 = 0; - pickup = collectedPickup; - /* WARNING (jumptable): Sanity check requires truncation of jumptable */ - /* WARNING: Could not find normalized switch variable to match jumptable */ - switch(*GHIDRA_CAST((GHIDRA_INT(&PTR_caseD_2_007d587c) + iVar1 + 2))) { - case 0: - switch(iVar7) { - case 3: - case 8: - break; - case 4: - break; - case 5: - local_50 = GHIDRA_CAST(0x1); - break; - case 6: - break; - case 7: - break; - default: - break; - case 10: - local_50 = GHIDRA_CAST(0x1); - break; - case 0xb: - break; - case 0xc: - } - break; - case 1: - switch(iVar7) { - case 2: - break; - case 3: - break; - case 4: - local_50 = GHIDRA_CAST(0x8); - break; - case 5: - break; - case 6: - goto switchD_007d5299_caseD_4; - case 7: - break; - default: - } - break; - case 2: - if (iVar7 == 2) break; - if (iVar7 == 3) { - local_50 = GHIDRA_CAST(0xc); - break; - } - goto LAB_007d54e0; - case 3: - if (iVar7 == 2) { - local_50 = GHIDRA_CAST(0xf); - } - else if (iVar7 != 4) goto LAB_007d54e0; - break; - case 4: -switchD_007d5299_caseD_4: - return uVar5 & 0xffffff00; - } -LAB_007d54dd: - pickup = collectedPickup; -LAB_007d54e0: - uVar6 = 0; - uVar5 = 0; - do { - if (in_ECX->_bagOfCraftingContent[uVar5] == 0) break; - uVar5 = uVar5 + 1; - uVar6 = uVar6 + 1; - } while (uVar5 < 8); - uVar5 = 0; - do { - fVar2 = poofColor._tint[uVar5 - 3]; - if (fVar2 != 0.0) { - if (7 < uVar6) { - uVar6 = 7; - in_ECX->_bagOfCraftingContent[0] = in_ECX->_bagOfCraftingContent[1]; - in_ECX->_bagOfCraftingContent[1] = in_ECX->_bagOfCraftingContent[2]; - in_ECX->_bagOfCraftingContent[2] = in_ECX->_bagOfCraftingContent[3]; - in_ECX->_bagOfCraftingContent[3] = in_ECX->_bagOfCraftingContent[4]; - in_ECX->_bagOfCraftingContent[4] = in_ECX->_bagOfCraftingContent[5]; - in_ECX->_bagOfCraftingContent[5] = in_ECX->_bagOfCraftingContent[6]; - in_ECX->_bagOfCraftingContent[6] = in_ECX->_bagOfCraftingContent[7]; - in_ECX->_bagOfCraftingContent[7] = 0; - } - in_ECX->_bagOfCraftingContent[uVar6] = SUB41(fVar2,0); - uVar6 = uVar6 + 1; - } - uVar5 = uVar5 + 1; - } while (uVar5 < 2); - uVar5 = Random(); - local_10 = (pickup->_pos).y; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1c)) + 0x8))) = (pickup->_pos).x; - local_50 = Game::Spawn(g_game,1000,0xf,GHIDRA_CAST((local_1c + 8)),&g_vectorZero,GHIDRA_CAST(0x0),1, - uVar5); - if (isCoinUpgraded) { - poofColor._offset[0] = 0.0; - poofColor._colorize[0] = 0.0; - poofColor._colorize[1] = 0.0; - poofColor._colorize[2] = 0.0; - poofColor._colorize[3] = 0.0; - poofColor._offset[1] = 0.0; - poofColor._offset[2] = 0.0; - poofColor._tint[0] = 0.12; - poofColor._tint[1] = 0.12; - poofColor._tint[2] = 0.12; - poofColor._tint[3] = 1.0; - local_50->SetColor(&poofColor,0xffffffff,0xff,0,1); - } - local_50->Update(); - Entity_Pickup::RemoveOtherOptions(); - local_50 = GHIDRA_CAST(&pickup->_sprite); - (pickup->_velocity).x = g_vectorZero.x; - (pickup->_velocity).y = g_vectorZero.y; - pickup->_entityCollisionClass = 0; - pickup->_entityGridCollisionClass = 3; - animName = (pickup->_sprite)._animState._animData; - if (animName == GHIDRA_CAST(0x0)) { -LAB_007d5690: - bVar4 = ANM2::SetAnimation(&pickup->_sprite,GHIDRA_CAST("Collect"),1); - pEVar3 = local_50; - if (bVar4 != 0) { - AnimationState::Rewind(GHIDRA_CAST(&local_50->_subtype)); - (*GHIDRA_CAST((GHIDRA_CAST((pEVar3)) + 0x44))) = 1; - pickup = collectedPickup; - } - } - else { - if (0xf < *GHIDRA_CAST((animName + 0x14))) { - animName = *GHIDRA_CAST(animName); - } - collectAnimName = "Collect"; - do { - bVar4 = *animName; - isLess = bVar4 < (uint8_t)*collectAnimName; - if (bVar4 != *collectAnimName) { -LAB_007d5670: - uVar5 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007d5675; - } - if (bVar4 == 0) break; - bVar4 = animName[1]; - isLess = bVar4 < (uint8_t)collectAnimName[1]; - if (bVar4 != collectAnimName[1]) goto LAB_007d5670; - animName = animName + 2; - collectAnimName = collectAnimName + 2; - } while (bVar4 != 0); - uVar5 = 0; -LAB_007d5675: - if ((uVar5 != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((pickup->_sprite)._animState._animData) + 0x34)) != '\0' && - ((pickup->_sprite)._animState._isPlaying == 0)))) goto LAB_007d5690; - } - local_50 = GHIDRA_CAST(0xf9); - pickup->_dead = 1; - manager = g_manager; - if (isCoinUpgraded) { - local_50 = GHIDRA_CAST(0x13c); - } - seed_fart_sound_override(GHIDRA_CAST(&local_50)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_50),1.0,2,0,1.0,0.0); - pickup = collectedPickup; - if (collectedPickup->_price != 0) { - (GHIDRA_CAST((collectedPickup)))->Entity_Pickup::CollectTrinket(in_ECX,0); - pickup = extraout_ECX; - } - if (uVar6 < 8) { - playerHud = &g_game->_hud; - in_ECX->_bagOfCraftingOutput = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1f50)))) = 0xffffffff; - if (in_ECX == GHIDRA_CAST(0x0)) goto LAB_007d57e0; - uVar5 = 0; - while (*GHIDRA_CAST(playerHud->_playerHUD) != in_ECX) { - uVar5 = uVar5 + 1; - playerHud = GHIDRA_CAST((playerHud->_playerHUD + 0x6dc)); - if (7 < uVar5) { - return CONCAT31((int3)(GHIDRA_UINT(playerHud) >> 8),1); - } - } - } - else { - craftingOutput = - CalculateBagOfCraftingOutput - (GHIDRA_CAST((local_1c + 8)),in_ECX->_bagOfCraftingContent,(uint8_t)pickup); - uVar5 = *craftingOutput; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1f50)))) = craftingOutput[1]; - playerHud = &g_game->_hud; - in_ECX->_bagOfCraftingOutput = uVar5; - if (in_ECX == GHIDRA_CAST(0x0)) { -LAB_007d57e0: - if (*GHIDRA_CAST(playerHud->_playerHUD) != 0) { - playerHud->_playerHUD[0x6ad] = 1; - } - if (*GHIDRA_CAST((playerHud->_playerHUD + 0x6dc)) != 0) { - playerHud->_playerHUD[0xd89] = 1; - } - if (*GHIDRA_CAST((playerHud->_playerHUD + 0xdb8)) != 0) { - playerHud->_playerHUD[0x1465] = 1; - } - if (*GHIDRA_CAST((playerHud->_playerHUD + 0x1494)) != 0) { - playerHud->_playerHUD[0x1b41] = 1; - } - if (*GHIDRA_CAST((playerHud->_playerHUD + 0x1b70)) != 0) { - playerHud->_playerHUD[0x221d] = 1; - } - if (*GHIDRA_CAST((playerHud->_playerHUD + 0x224c)) != 0) { - playerHud->_playerHUD[0x28f9] = 1; - } - if (*GHIDRA_CAST((playerHud->_playerHUD + 0x2928)) != 0) { - playerHud->_playerHUD[0x2fd5] = 1; - } - if (*GHIDRA_CAST((playerHud->_playerHUD + 0x3004)) != 0) { - playerHud->_playerHUD[0x36b1] = 1; - } - return CONCAT31((int3)(GHIDRA_UINT(playerHud) >> 8),1); - } - uVar5 = 0; - while (*GHIDRA_CAST(playerHud->_playerHUD) != in_ECX) { - uVar5 = uVar5 + 1; - playerHud = GHIDRA_CAST((playerHud->_playerHUD + 0x6dc)); - if (7 < uVar5) { - return CONCAT31((int3)(GHIDRA_UINT(playerHud) >> 8),1); - } - } - } - playerHud->_playerHUD[0x6ad] = 1; - return CONCAT31((int3)(GHIDRA_UINT(playerHud) >> 8),1); -} - -// 007d65c0 -int Entity_Player::GetMaxPoopMana() -{ - Entity_Player *birthrightOwner; - - birthrightOwner = PlayerManager::FirstBirthrightOwner(&g_game->_playerManager,0x19); - return (-GHIDRA_UINT((birthrightOwner != GHIDRA_CAST(0x0))) & 0x14) + 9; -} - -// 007d65e0 -void Entity_Player::AddPoopMana(int amount) -{ - Entity_Player *birthrightOwner; - int *clampedPtr; - int *cappedPtr; - int newMana; - int minMana; - int maxMana; - Game *game; - - newMana = amount + this->_poopMana; - amount = newMana; - birthrightOwner = PlayerManager::FirstBirthrightOwner(&g_game->_playerManager,0x19); - minMana = 0; - maxMana = (-GHIDRA_UINT((birthrightOwner != GHIDRA_CAST(0x0))) & 0x14) + 9; - cappedPtr = &amount; - if (maxMana <= newMana) { - cappedPtr = &maxMana; - } - clampedPtr = &minMana; - if (0 < *cappedPtr) { - clampedPtr = cappedPtr; - } - this->_poopMana = *clampedPtr; - ConsumableCountChanged(this,0x80); - game = g_game; - if ((g_game->_hud)._hudRefreshType != 2) { - (g_game->_hud)._hudRefreshType = 1; - (game->_hud)._hudRefreshCountdown = 2; - } - return; -} - -// 007d6670 -void Entity_Player::poop_spell_roll() -{ - code *pcVar1; - uint32_t uVar2; - int *weightPtr; - int cumulativeWeight; - uint8_t bVar3; - uint32_t uVar4; - uint32_t uVar5; - void *freeBlock; - uint32_t weightRoll; - uint32_t earlyDiarrheaEntry; - uint32_t earlyDiarrheaWeight; - uint32_t earlyHolyEntry; - uint32_t earlyHolyWeight; - uint32_t earlyBlackEntry; - uint32_t earlyBlackWeight; - uint32_t midBombEntry; - uint32_t midBombWeight; - uint32_t midStinkyEntry; - uint32_t midStinkyWeight; - uint32_t midStoneEntry; - uint32_t midStoneWeight; - uint32_t midBurningEntry; - uint32_t midBurningWeight; - uint32_t midCornyEntry; - uint32_t midCornyWeight; - uint32_t lateBombEntry; - uint32_t lateBombWeight; - uint32_t lateStinkyEntry; - uint32_t lateStinkyWeight; - uint32_t lateStoneEntry; - uint32_t lateStoneWeight; - uint32_t lateBurningEntry; - uint32_t lateBurningWeight; - uint32_t lateCornyEntry; - uint32_t lateCornyWeight; - uint32_t lateLiquidEntry; - uint32_t lateLiquidWeight; - uint32_t lateFartEntry; - uint32_t lateFartWeight; - uint32_t latePoopEntry; - uint32_t latePoopWeight; - uint32_t local_54; - uint32_t slot; - uint32_t local_4c; - Entity_Player *player; - void *earlyPoolData; - void *earlyPoolBegin; - uint32_t *earlyPoolEnd; - uint32_t *earlyPoolCapacity; - RNG *spellRng; - void *midPoolData; - void *latePoolData; - void *midPoolBegin; - uint32_t *midPoolEnd; - uint32_t *midPoolCapacity; - void *latePoolBegin; - uint32_t *latePoolEnd; - uint32_t *latePoolCapacity; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - RNG *rng; - void *latePoolDataCopy; - uint32_t *latePoolEndCopy; - Entity_Player *playerCopy; - RNG *spellRngCopy; - - puStack_c = &LAB_00b0039d; - local_10 = ExceptionList; - ExceptionList = &local_10; - spellRng = GHIDRA_CAST((GHIDRA_INT((this->_collectibleRNGs)._begin) + 0x17a0)); - slot = 0; - player = this; - do { - if (this->_poopSpellQueue[slot] == 0) { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) == '\0') { - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f5e))) = 10; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) = 1; - latePoolBegin = (void *)0x0; - latePoolEnd = GHIDRA_CAST(0x0); - latePoolCapacity = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f5f))) = 9; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) = (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) + '\x01'; - this->_poopSpellQueue[(*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)this)) + 0x1f72))) + 6] = 8; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) = (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) + '\x01'; - local_8 = 0; - latePoopEntry = 1; - latePoopWeight = 5; - msvc::vector<8byte>::_Emplace_reallocate(0,&latePoopEntry); - uVar2 = 0; - latePoolData = latePoolBegin; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8)) == 9) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 5; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d67ba; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - lateFartEntry = 9; - lateFartWeight = 5; - if (latePoolEnd == latePoolCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(latePoolEnd,&lateFartEntry); - } - else { - *latePoolEnd = 9; - latePoolEnd[1] = 5; - latePoolEnd = latePoolEnd + 2; - } -LAB_007d67ba: - uVar2 = 0; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8)) == 8) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 3; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6821; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - lateLiquidEntry = 8; - lateLiquidWeight = 3; - if (latePoolEnd == latePoolCapacity) { - latePoolData = latePoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(latePoolEnd,&lateLiquidEntry); - } - else { - *latePoolEnd = 8; - latePoolEnd[1] = 3; - latePoolEnd = latePoolEnd + 2; - } -LAB_007d6821: - uVar2 = 0; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8)) == 2) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d688a; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - lateCornyEntry = 2; - lateCornyWeight = 1; - if (latePoolEnd == latePoolCapacity) { - latePoolData = latePoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(latePoolEnd,&lateCornyEntry); - } - else { - *latePoolEnd = 2; - latePoolEnd[1] = 1; - latePoolEnd = latePoolEnd + 2; - } -LAB_007d688a: - uVar2 = 0; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8)) == 3) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d68f1; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - lateBurningEntry = 3; - lateBurningWeight = 1; - if (latePoolEnd == latePoolCapacity) { - latePoolData = latePoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(latePoolEnd,&lateBurningEntry); - } - else { - *latePoolEnd = 3; - latePoolEnd[1] = 1; - latePoolEnd = latePoolEnd + 2; - } -LAB_007d68f1: - uVar2 = 0; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8)) == 4) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d695a; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - lateStoneEntry = 4; - lateStoneWeight = 1; - if (latePoolEnd == latePoolCapacity) { - latePoolData = latePoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(latePoolEnd,&lateStoneEntry); - } - else { - *latePoolEnd = 4; - latePoolEnd[1] = 1; - latePoolEnd = latePoolEnd + 2; - } -LAB_007d695a: - uVar2 = 0; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8)) == 5) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d69ca; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - lateStinkyEntry = 5; - lateStinkyWeight = 1; - if (latePoolEnd == latePoolCapacity) { - latePoolData = latePoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(latePoolEnd,&lateStinkyEntry); - } - else { - *latePoolEnd = 5; - latePoolEnd[1] = 1; - latePoolEnd = latePoolEnd + 2; - } -LAB_007d69ca: - uVar2 = 0; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8)) == 10) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(latePoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6a3a; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - lateBombEntry = 10; - lateBombWeight = 1; - if (latePoolEnd == latePoolCapacity) { - latePoolData = latePoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(latePoolEnd,&lateBombEntry); - } - else { - *latePoolEnd = 10; - latePoolEnd[1] = 1; - latePoolEnd = latePoolEnd + 2; - } -LAB_007d6a3a: - latePoolEndCopy = latePoolEnd; - latePoolDataCopy = latePoolBegin; - midPoolBegin = (void *)0x0; - midPoolEnd = GHIDRA_CAST(0x0); - midPoolCapacity = GHIDRA_CAST(0x0); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - midCornyEntry = 2; - midCornyWeight = 1; - latePoolData = latePoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(0,&midCornyEntry); - uVar2 = 0; - uVar4 = GHIDRA_INT(midPoolEnd) - GHIDRA_INT(midPoolBegin) >> 3; - midPoolData = midPoolBegin; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8)) == 3) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(midPoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6af3; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - midBurningEntry = 3; - midBurningWeight = 1; - if (midPoolEnd == midPoolCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(midPoolEnd,&midBurningEntry); - } - else { - *midPoolEnd = 3; - midPoolEnd[1] = 1; - midPoolEnd = midPoolEnd + 2; - } -LAB_007d6af3: - uVar2 = 0; - uVar4 = GHIDRA_INT(midPoolEnd) - GHIDRA_INT(midPoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8)) == 4) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(midPoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6b64; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - midStoneEntry = 4; - midStoneWeight = 1; - if (midPoolEnd == midPoolCapacity) { - midPoolData = midPoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(midPoolEnd,&midStoneEntry); - } - else { - *midPoolEnd = 4; - midPoolEnd[1] = 1; - midPoolEnd = midPoolEnd + 2; - } -LAB_007d6b64: - uVar2 = 0; - uVar4 = GHIDRA_INT(midPoolEnd) - GHIDRA_INT(midPoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8)) == 5) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(midPoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6bd5; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - midStinkyEntry = 5; - midStinkyWeight = 1; - if (midPoolEnd == midPoolCapacity) { - midPoolData = midPoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(midPoolEnd,&midStinkyEntry); - } - else { - *midPoolEnd = 5; - midPoolEnd[1] = 1; - midPoolEnd = midPoolEnd + 2; - } -LAB_007d6bd5: - uVar2 = 0; - uVar4 = GHIDRA_INT(midPoolEnd) - GHIDRA_INT(midPoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8)) == 10) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(midPoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(midPoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6c46; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - midBombEntry = 10; - midBombWeight = 1; - if (midPoolEnd == midPoolCapacity) { - midPoolData = midPoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(midPoolEnd,&midBombEntry); - } - else { - *midPoolEnd = 10; - midPoolEnd[1] = 1; - midPoolEnd = midPoolEnd + 2; - } -LAB_007d6c46: - earlyPoolBegin = (void *)0x0; - earlyPoolEnd = GHIDRA_CAST(0x0); - earlyPoolCapacity = GHIDRA_CAST(0x0); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),2); - earlyBlackEntry = 6; - earlyBlackWeight = 1; - midPoolData = midPoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(0,&earlyBlackEntry); - uVar2 = 0; - uVar4 = GHIDRA_INT(earlyPoolEnd) - GHIDRA_INT(earlyPoolBegin) >> 3; - earlyPoolData = earlyPoolBegin; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(earlyPoolBegin) + uVar2 * 8)) == 7) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(earlyPoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(earlyPoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6cfb; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - earlyHolyEntry = 7; - earlyHolyWeight = 1; - if (earlyPoolEnd == earlyPoolCapacity) { - msvc::vector<8byte>::_Emplace_reallocate(earlyPoolEnd,&earlyHolyEntry); - } - else { - *earlyPoolEnd = 7; - earlyPoolEnd[1] = 1; - earlyPoolEnd = earlyPoolEnd + 2; - } -LAB_007d6cfb: - uVar2 = 0; - uVar4 = GHIDRA_INT(earlyPoolEnd) - GHIDRA_INT(earlyPoolBegin) >> 3; - if (uVar4 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(earlyPoolBegin) + uVar2 * 8)) == 0xb) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(earlyPoolBegin) + uVar2 * 8 + 4)); - *weightPtr = *weightPtr + 1; - if (*weightPtr < 0) { - *GHIDRA_CAST((GHIDRA_CAST(earlyPoolBegin) + uVar2 * 8 + 4)) = 0; - } - goto LAB_007d6d73; - } - uVar2 = uVar2 + 1; - } while (uVar2 < uVar4); - } - earlyDiarrheaEntry = 0xb; - earlyDiarrheaWeight = 1; - if (earlyPoolEnd == earlyPoolCapacity) { - earlyPoolData = earlyPoolBegin; - msvc::vector<8byte>::_Emplace_reallocate(earlyPoolEnd,&earlyDiarrheaEntry); - } - else { - *earlyPoolEnd = 0xb; - earlyPoolEnd[1] = 1; - earlyPoolEnd = earlyPoolEnd + 2; - } -LAB_007d6d73: - bVar3 = (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))); - playerCopy = player; - earlyPoolData = earlyPoolBegin; - spellRngCopy = spellRng; - while (player = playerCopy, spellRng = spellRngCopy, bVar3 < 0x14) { - uVar2 = spellRngCopy->_seed; - if (bVar3 < 4) { - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar2 = spellRngCopy->_seed; - if (uVar2 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar2 = uVar2 >> ((uint8_t)spellRngCopy->_shift1 & 0x1f) ^ uVar2; - uVar2 = uVar2 << ((uint8_t)spellRngCopy->_shift2 & 0x1f) ^ uVar2; - uVar4 = 0; - uVar2 = uVar2 >> ((uint8_t)spellRngCopy->_shift3 & 0x1f) ^ uVar2; - local_4c = 7; - spellRngCopy->_seed = uVar2; - weightRoll = 0; - uVar5 = GHIDRA_INT(earlyPoolEnd) - GHIDRA_INT(earlyPoolData) >> 3; - if (uVar5 != 0) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(earlyPoolData) + 4)); - do { - weightRoll = weightRoll + *weightPtr; - weightPtr = weightPtr + 2; - uVar4 = uVar4 + 1; - } while (uVar4 < uVar5); - } - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar2 = uVar2 >> 5 ^ uVar2; - uVar2 = uVar2 << 9 ^ uVar2; - if (weightRoll == 0) { - weightRoll = 0; - } - else { - weightRoll = (uVar2 >> 7 ^ uVar2) % weightRoll; - } - cumulativeWeight = 0; - uVar2 = 0; - uVar4 = GHIDRA_INT(earlyPoolEnd) - GHIDRA_INT(earlyPoolData) >> 3; - if (uVar4 == 0) { -LAB_007d6e6a: - KAGE_LogMessage(0x10,(uint8_t *) - "No weights were added. At least one outcome needs weight."); - } - else { - weightPtr = GHIDRA_CAST((GHIDRA_INT(earlyPoolData) + 4)); - do { - cumulativeWeight = cumulativeWeight + *weightPtr; - if (GHIDRA_INT(weightRoll) < cumulativeWeight) { - bVar3 = (uint8_t)*GHIDRA_CAST((GHIDRA_CAST(earlyPoolData) + uVar2 * 8)); - goto LAB_007d6e7b; - } - uVar2 = uVar2 + 1; - weightPtr = weightPtr + 2; - } while (uVar2 < uVar4); - if (cumulativeWeight < 1) goto LAB_007d6e6a; - } - bVar3 = 0; -LAB_007d6e7b: - player->_poopSpellQueue[(*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)player)) + 0x1f72))) + 6] = bVar3; - (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1f72))) = (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1f72))) + '\x01'; - bVar3 = (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1f72))); - playerCopy = player; - spellRngCopy = spellRng; - latePoolEndCopy = latePoolEnd; - } - else { - if (bVar3 < 0xf) { - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar2 = spellRngCopy->_seed; - if (uVar2 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar2 = uVar2 >> ((uint8_t)spellRngCopy->_shift1 & 0x1f) ^ uVar2; - uVar2 = uVar2 << ((uint8_t)spellRngCopy->_shift2 & 0x1f) ^ uVar2; - uVar4 = 0; - uVar2 = uVar2 >> ((uint8_t)spellRngCopy->_shift3 & 0x1f) ^ uVar2; - local_4c = 7; - spellRngCopy->_seed = uVar2; - weightRoll = 0; - uVar5 = GHIDRA_INT(midPoolEnd) - GHIDRA_INT(midPoolData) >> 3; - if (uVar5 != 0) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(midPoolData) + 4)); - do { - weightRoll = weightRoll + *weightPtr; - weightPtr = weightPtr + 2; - uVar4 = uVar4 + 1; - } while (uVar4 < uVar5); - } - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar2 = uVar2 >> 5 ^ uVar2; - uVar2 = uVar2 << 9 ^ uVar2; - if (weightRoll == 0) { - weightRoll = 0; - } - else { - weightRoll = (uVar2 >> 7 ^ uVar2) % weightRoll; - } - cumulativeWeight = 0; - uVar2 = 0; - uVar4 = GHIDRA_INT(midPoolEnd) - GHIDRA_INT(midPoolData) >> 3; - if (uVar4 == 0) goto LAB_007d6f8c; - weightPtr = GHIDRA_CAST((GHIDRA_INT(midPoolData) + 4)); - do { - cumulativeWeight = cumulativeWeight + *weightPtr; - if (GHIDRA_INT(weightRoll) < cumulativeWeight) { - bVar3 = (uint8_t)*GHIDRA_CAST((GHIDRA_CAST(midPoolData) + uVar2 * 8)); - goto LAB_007d6f9d; - } - uVar2 = uVar2 + 1; - weightPtr = weightPtr + 2; - } while (uVar2 < uVar4); -LAB_007d6f88: - if (cumulativeWeight < 1) goto LAB_007d6f8c; - } - else { - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar2 = spellRngCopy->_seed; - if (uVar2 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar2 = uVar2 >> ((uint8_t)spellRngCopy->_shift1 & 0x1f) ^ uVar2; - uVar2 = uVar2 << ((uint8_t)spellRngCopy->_shift2 & 0x1f) ^ uVar2; - uVar4 = 0; - local_4c = uVar2 >> ((uint8_t)spellRngCopy->_shift3 & 0x1f) ^ uVar2; - spellRngCopy->_seed = local_4c; - uVar5 = 0; - local_54 = 7; - uVar2 = GHIDRA_INT(latePoolEndCopy) - GHIDRA_INT(latePoolDataCopy) >> 3; - if (uVar2 != 0) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolDataCopy) + 4)); - do { - uVar5 = uVar5 + *weightPtr; - weightPtr = weightPtr + 2; - uVar4 = uVar4 + 1; - } while (uVar4 < uVar2); - } - if (local_4c == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar2 = local_4c >> 5 ^ local_4c; - uVar2 = uVar2 << 9 ^ uVar2; - if (uVar5 == 0) { - uVar5 = 0; - } - else { - uVar5 = (uVar2 >> 7 ^ uVar2) % uVar5; - } - cumulativeWeight = 0; - uVar2 = 0; - uVar4 = GHIDRA_INT(latePoolEnd) - GHIDRA_INT(latePoolDataCopy) >> 3; - if (uVar4 != 0) { - weightPtr = GHIDRA_CAST((GHIDRA_INT(latePoolDataCopy) + 4)); - do { - cumulativeWeight = cumulativeWeight + *weightPtr; - if (GHIDRA_INT(uVar5) < cumulativeWeight) { - bVar3 = (uint8_t)*GHIDRA_CAST((GHIDRA_CAST(latePoolDataCopy) + uVar2 * 8)); - goto LAB_007d6f9d; - } - uVar2 = uVar2 + 1; - weightPtr = weightPtr + 2; - } while (uVar2 < uVar4); - goto LAB_007d6f88; - } -LAB_007d6f8c: - KAGE_LogMessage(0x10,(uint8_t *) - "No weights were added. At least one outcome needs weight."); - } - bVar3 = 0; -LAB_007d6f9d: - player->_poopSpellQueue[(*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)player)) + 0x1f72))) + 6] = bVar3; - (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1f72))) = (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1f72))) + '\x01'; - bVar3 = (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1f72))); - playerCopy = player; - spellRngCopy = spellRng; - latePoolEndCopy = latePoolEnd; - } - } - uVar2 = 0; - do { - uVar4 = spellRng->_seed; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar4 = spellRng->_seed; - if (uVar4 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - latePoolDataCopy = latePoolData; - uVar4 = uVar4 >> ((uint8_t)spellRng->_shift1 & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)spellRng->_shift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)spellRng->_shift3 & 0x1f) ^ uVar4; - uVar5 = 0; - spellRng->_seed = uVar4; - if (0x14 - uVar2 != 0) { - uVar5 = uVar4 % (0x14 - uVar2); - } - uVar5 = uVar5 + uVar2; - if (uVar5 != uVar2) { - bVar3 = playerCopy->_poopSpellQueue[uVar2 + 6]; - playerCopy->_poopSpellQueue[uVar2 + 6] = playerCopy->_poopSpellQueue[uVar5 + 6]; - playerCopy->_poopSpellQueue[uVar5 + 6] = bVar3; - } - uVar2 = uVar2 + 1; - } while (uVar2 < 0x13); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - if (earlyPoolData != (void *)0x0) { - uVar2 = (GHIDRA_INT(earlyPoolCapacity) - GHIDRA_INT(earlyPoolData) >> 3) * 8; - freeBlock = earlyPoolData; - if (0xfff < uVar2) { - freeBlock = *(void **)(GHIDRA_CAST(earlyPoolData) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(earlyPoolData) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_007d7282; - } - operator_delete(freeBlock,uVar2); - earlyPoolBegin = (void *)0x0; - earlyPoolEnd = GHIDRA_CAST(0x0); - earlyPoolCapacity = GHIDRA_CAST(0x0); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0; - if (midPoolData != (void *)0x0) { - uVar2 = (GHIDRA_INT(midPoolCapacity) - GHIDRA_INT(midPoolData) >> 3) * 8; - freeBlock = midPoolData; - if (0xfff < uVar2) { - freeBlock = *(void **)(GHIDRA_CAST(midPoolData) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(midPoolData) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_007d7282; - } - operator_delete(freeBlock,uVar2); - midPoolBegin = (void *)0x0; - midPoolEnd = GHIDRA_CAST(0x0); - midPoolCapacity = GHIDRA_CAST(0x0); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xff; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))) = 0xffffff; - if (latePoolDataCopy != (void *)0x0) { - uVar2 = GHIDRA_INT(latePoolCapacity) - GHIDRA_INT(latePoolDataCopy) & 0xfffffff8; - freeBlock = latePoolDataCopy; - if (0xfff < uVar2) { - freeBlock = *(void **)(GHIDRA_CAST(latePoolDataCopy) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(latePoolDataCopy) + (-4 - GHIDRA_INT(freeBlock))))) { -LAB_007d7282: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar2); - } - this = player; - } - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) = (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1f72))) + -1; - this->_poopSpellQueue[slot] = this->_poopSpellQueue[(*GHIDRA_CAST((GHIDRA_CAST(((uint8_t)this)) + 0x1f72))) + 6]; - } - slot = slot + 1; - if (5 < slot) { - ExceptionList = local_10; - return; - } - } while( true ); -} - -// 007d7290 -void Entity_Player::UsePoopSpell(uint32_t param_2) -{ - Vector *pos; - code *pcVar1; - ANM2 *pAVar2; - uint32_t rngResult; - Entity *spawned; - ColorMod *color; - Vector *direction; - uint32_t *poopRngSeed; - uint8_t auStack_68 [4]; - uint32_t *local_64; - Vector local_60; - uint32_t local_58; - uint32_t local_54; - BitSet128 bombFlags; - Color fartColor; - uint32_t securityCookie; - void *collectibleRngs; - Game *game; - Manager *manager; - float *nullItems; - int oldParent; - uint32_t *parentRef; - - manager = g_manager; - securityCookie = __security_cookie ^ GHIDRA_UINT(auStack_68); - collectibleRngs = (this->_collectibleRNGs)._begin; - poopRngSeed = GHIDRA_CAST((GHIDRA_INT(collectibleRngs) + 0x17a0)); - if (((-1 < GHIDRA_INT(param_2)) && (param_2 < 0xc)) && - (local_64 = GHIDRA_CAST((&PTR_00b6ba00)[param_2]), 0 < GHIDRA_INT(local_64))) { - rngResult = *poopRngSeed; - if (rngResult == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - rngResult = *poopRngSeed; - if (rngResult == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - game = g_game; - rngResult = rngResult >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(collectibleRngs) + 0x17a4)) & 0x1f) ^ - rngResult; - rngResult = rngResult << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(collectibleRngs) + 0x17a8)) & 0x1f) ^ - rngResult; - rngResult = rngResult >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(collectibleRngs) + 0x17ac)) & 0x1f) ^ - rngResult; - *poopRngSeed = rngResult; - spawned = Game::SpawnEx(game,0xf5,GHIDRA_UINT(local_64),&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0, - rngResult,0); - spawned->Update(); - if ((spawned->_sprite)._animState._animData != (void *)0x0) { - AnimationState::AdvancePosition - (&(spawned->_sprite)._animState, - *GHIDRA_CAST((GHIDRA_INT((spawned->_sprite)._animState._animData) + 0x30)) + -1); - } - TryHoldEntity(this,spawned); - manager = g_manager; - local_64 = GHIDRA_CAST(0x25f); - seed_fart_sound_override(GHIDRA_CAST(&local_64)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_64),1.0,2,0,1.0,0.0); - return; - } - switch(param_2) { - case 8: - local_64 = GHIDRA_CAST(0x25); - seed_fart_sound_override(GHIDRA_CAST(&local_64)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_64),1.0,2,0,1.0,0.0); - manager = g_manager; - local_64 = GHIDRA_CAST(0x95); - seed_fart_sound_override(GHIDRA_CAST(&local_64)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_64),1.0,2,0,1.5,0.0); - rngResult = Random(); - local_60.x = (float)Game::SpawnEx(g_game,1000,0xc3,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),1, - rngResult,0); - oldParent = (GHIDRA_CAST(local_60.x))->_parent; - pAVar2 = &(GHIDRA_CAST((GHIDRA_INT(local_60.x) + 0x410)))->_sprite; - (pAVar2->_filename)._buf[4] = '$'; - (pAVar2->_filename)._buf[5] = '\0'; - (pAVar2->_filename)._buf[6] = '\0'; - (pAVar2->_filename)._buf[7] = '\0'; - parentRef = &(GHIDRA_CAST(local_60.x))->_parent; - pAVar2 = &(GHIDRA_CAST((GHIDRA_INT(local_60.x) + 0x410)))->_sprite; - (pAVar2->_filename)._buf[8] = '$'; - (pAVar2->_filename)._buf[9] = '\0'; - (pAVar2->_filename)._buf[10] = '\0'; - (pAVar2->_filename)._buf[0xb] = '\0'; - if (oldParent != 0) { - local_64 = parentRef; - msvc::multiset::erase(&local_64); - } - *parentRef = this; - msvc::multiset::insert(parentRef); - (**(code **)(*GHIDRA_CAST(local_60.x) + 0xc))(); - break; - case 9: - (GHIDRA_CAST((&fartColor)))->Color::Color(); - pos = &this->_pos; - Game::Fart(g_game,pos,85.0,GHIDRA_CAST(this),1.0,0,color); - Game::ButterBeanFart(g_game,pos,120.0,GHIDRA_CAST(this),0,0); - rngResult = Random(); - spawned = Game::SpawnEx(g_game,1000,0x8d,pos,&g_vectorZero,GHIDRA_CAST(this),1,rngResult,0); - oldParent = *GHIDRA_CAST(spawned); - pAVar2 = &spawned[1]._sprite; - (pAVar2->_filename)._buf[4] = -1; - (pAVar2->_filename)._buf[5] = -1; - (pAVar2->_filename)._buf[6] = -1; - (pAVar2->_filename)._buf[7] = -1; - pAVar2 = &spawned[1]._sprite; - (pAVar2->_filename)._buf[8] = -1; - (pAVar2->_filename)._buf[9] = -1; - (pAVar2->_filename)._buf[10] = -1; - (pAVar2->_filename)._buf[0xb] = -1; - (**(code **)(oldParent + 0xc))(); - return; - case 10: - GetBombFlags(this,&bombFlags,0); - rngResult = Random(); - local_60.x = (this->_velocity).x * 0.1; - local_60.y = (this->_velocity).y * 0.1; - spawned = Game::SpawnEx(g_game,4,9,&this->_pos,&local_60,GHIDRA_CAST(this),0,rngResult,0); - spawned = (Entity *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Bomb::RTTI_Type_Descriptor,0); - spawned[1]._type = GHIDRA_INT(bombFlags._l); - spawned[1]._variant = (*GHIDRA_CAST((GHIDRA_CAST(&(bombFlags._l)) + 0x4))); - spawned[1]._subtype = GHIDRA_INT(bombFlags._h); - spawned[1]._spawnerType = (*GHIDRA_CAST((GHIDRA_CAST(&(bombFlags._h)) + 0x4))); - spawned[1]._sprite._filename._buf[0xb] = '\x01'; - TryHoldEntity(this,spawned); - manager = g_manager; - local_64 = GHIDRA_CAST(0x25f); - seed_fart_sound_override(GHIDRA_CAST(&local_64)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_64),1.0,2,0,1.0,0.0); - return; - case 0xb: - local_64 = GHIDRA_CAST(0x25); - seed_fart_sound_override(GHIDRA_CAST(&local_64)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_64),1.0,2,0,1.0,0.0); - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0,-1); - nullItems = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItems) & 0xfffffffcU)) < 1) { - local_60.x = 0.0; - } - else { - local_60.x = *nullItems; - } - local_60.y = 0.0; - local_54 = 0; - local_58 = 0x3c; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&local_60,1,1); - AnimateSad(this); - ShootCandle(this,direction); - return; - } - return; -} - -// 007d7740 -void Entity_Player::RecomputeWispCollectibles(Entity_Familiar *wisp) -{ - char cVar1; - void *pvVar2; - int *piVar3; - int *piVar4; - uint8_t bVar5; - Entity_Familiar *pEVar6; - int iVar7; - Game *game; - Entity_Player *this_00; - uint32_t uVar8; - Entity_Familiar *pEVar9; - ItemConfig_Item *item; - int *removedNode; - uint8_t local_50 [8]; - Entity_Familiar *roomWispFoundNode; - uint8_t local_44 [4]; - uint8_t local_40 [4]; - Entity_Familiar *wispFoundNode; - int *removedItems; - uint32_t local_34; - Entity_Familiar *newWispItems; - uint32_t newWispItemsSize; - Entity_Familiar *insertKey; - std_map *local_24; - uint8_t local_20 [4]; - Entity_Familiar *local_1c; - Entity_Player *player; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity_Familiar *oldListHead; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b003d5; - local_10 = ExceptionList; - ExceptionList = &local_10; - newWispItems = GHIDRA_CAST(0x0); - newWispItemsSize = 0; - player = this; - pEVar6 = operator_new(0x18); - *GHIDRA_CAST(pEVar6) = pEVar6; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x4)))) = pEVar6; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x8)))) = pEVar6; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0xc)))) = 0x101; - local_8 = 0; - newWispItems = pEVar6; - if ((((wisp != GHIDRA_CAST(0x0)) && (wisp->_type == 3)) && (wisp->_variant == 0xed)) && - (wisp->_dead == 0)) { - pEVar9 = GHIDRA_CAST(wisp->_subtype); - wisp = pEVar9; - msvc::set::find_node(local_44,&wisp); - if ((((*GHIDRA_CAST((GHIDRA_CAST((wispFoundNode)) + 0xd))) == '\0') && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((wispFoundNode)) + 0x10)))) <= GHIDRA_INT(pEVar9))) - && (wispFoundNode != pEVar6)) { - wispFoundNode->_pendingDamage = (float)(GHIDRA_INT(wispFoundNode->_pendingDamage) + 1); - } - else { - local_24 = GHIDRA_CAST(0x1); - insertKey = pEVar9; - FUN_005cc7e0(local_20,&insertKey); - } - } - uVar8 = 0; - local_1c = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(local_1c) + 0x1254)) != 0) { - do { - iVar7 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_1c) + 0x124c)) + uVar8 * 4)); - if (((iVar7 != 0) && (*GHIDRA_CAST((iVar7 + 0x28)) == 3)) && - ((*GHIDRA_CAST((iVar7 + 0x410)) == this && - (((*GHIDRA_CAST((iVar7 + 0x2c)) == 0xed && (*GHIDRA_CAST((iVar7 + 0x172)) != '\0')) && - (*GHIDRA_CAST((iVar7 + 0x173)) == '\0')))))) { - pEVar6 = *GHIDRA_CAST((iVar7 + 0x30)); - wisp = pEVar6; - msvc::set::find_node(local_50,&wisp); - if ((((*GHIDRA_CAST((GHIDRA_CAST((roomWispFoundNode)) + 0xd))) == '\0') && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((roomWispFoundNode)) + 0x10)))) <= GHIDRA_INT(pEVar6))) && - (roomWispFoundNode != newWispItems)) { - roomWispFoundNode->_pendingDamage = (float)(GHIDRA_INT(roomWispFoundNode->_pendingDamage) + 1); - } - else { - local_24 = GHIDRA_CAST(0x1); - insertKey = pEVar6; - FUN_005cc7e0(local_40,&insertKey); - } - } - uVar8 = uVar8 + 1; - } while (uVar8 < *GHIDRA_CAST((GHIDRA_CAST(local_1c) + 0x1254))); - } - local_24 = &this->_itemWispsList; - pEVar6 = *GHIDRA_CAST((this->_itemWispsList)._head); - pEVar9 = *GHIDRA_CAST(newWispItems); - removedItems = GHIDRA_CAST(0x0); - local_34 = 0; - wisp = pEVar9; - local_1c = pEVar6; - removedItems = operator_new(0x14); - *removedItems = GHIDRA_INT(removedItems); - removedItems[1] = GHIDRA_INT(removedItems); - removedItems[2] = GHIDRA_INT(removedItems); - *GHIDRA_CAST((removedItems + 3)) = 0x101; - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - game = g_game; -LAB_007d7900: - while (oldListHead = local_24->_head, pEVar6 != oldListHead) { - if (pEVar9 == newWispItems) { -LAB_007d7a52: - uVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x10)))); - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar8)) goto LAB_007d7a8a; - } - else { - if (GHIDRA_INT(uVar8) < 0) { - if ((GHIDRA_INT(uVar8) < 0) && - (pvVar2 = (game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar8) < - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar2) >> 2)) { - iVar7 = **GHIDRA_CAST((GHIDRA_CAST(pvVar2) + ~uVar8 * 4)); - } - else { - iVar7 = 0; - } - } - else { -LAB_007d7a8a: - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) >> 2 <= GHIDRA_INT(uVar8)) - goto LAB_007d7ab7; - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar8 * 4)); - } - if (iVar7 != 0) { - player->_cacheFlags = player->_cacheFlags | *GHIDRA_CAST((iVar7 + 0x54)); - } - } -LAB_007d7ab7: - FUN_007dd660(local_40,&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x10)))); - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_1c); - pEVar6 = local_1c; - game = g_game; - } - else { - uVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x10)))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar9)) + 0x10)))) < GHIDRA_INT(uVar8)) goto LAB_007d7914; - if (GHIDRA_INT(uVar8) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar9)) + 0x10))))) goto LAB_007d7a52; - if (pEVar6->_pendingDamage != pEVar9->_pendingDamage) { - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar8)) goto LAB_007d79a5; - } - else { - if (GHIDRA_INT(uVar8) < 0) { - if ((GHIDRA_INT(uVar8) < 0) && - (pvVar2 = (game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar8) < - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar2) >> 2)) { - iVar7 = **GHIDRA_CAST((GHIDRA_CAST(pvVar2) + ~uVar8 * 4)); - } - else { - iVar7 = 0; - } - } - else { -LAB_007d79a5: - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) >> 2 <= GHIDRA_INT(uVar8)) - goto LAB_007d79d2; - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar8 * 4)); - } - if (iVar7 != 0) { - player->_cacheFlags = player->_cacheFlags | *GHIDRA_CAST((iVar7 + 0x54)); - } - } - } -LAB_007d79d2: - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_1c); - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&wisp); - pEVar9 = wisp; - pEVar6 = local_1c; - } - } - if (pEVar9 != newWispItems) { -LAB_007d7914: - uVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar9)) + 0x10)))); - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar8)) goto LAB_007d79f5; -LAB_007d7a24: - item = GHIDRA_CAST(0x0); - } - else { - if (GHIDRA_INT(uVar8) < 0) { - if ((GHIDRA_INT(uVar8) < 0) && - (pvVar2 = (game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar8) < - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar2) >> 2)) { - item = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar2) + ~uVar8 * 4))); - } - else { - item = GHIDRA_CAST(0x0); - } - } - else { -LAB_007d79f5: - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) >> 2 <= GHIDRA_INT(uVar8)) - goto LAB_007d7a24; - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar8 * 4)); - } - if (item != GHIDRA_CAST(0x0)) { - player->_cacheFlags = player->_cacheFlags | item->cacheFlags; - } - } - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&wisp); - if (item->addCostumeOnPickup == 0) { - pEVar9 = wisp; - } - else { - AddCostume(player,item,0); - pEVar9 = wisp; - game = g_game; - } - goto LAB_007d7900; - } - if (local_24 != GHIDRA_CAST(&newWispItems)) { - local_24->_head = newWispItems; - uVar8 = local_24->_size; - local_24->_size = newWispItemsSize; - newWispItems = oldListHead; - newWispItemsSize = uVar8; - } - removedNode = GHIDRA_CAST(*removedItems); - if (removedNode == removedItems) { - this_00 = player; -LAB_007d7bcf: - EvaluateItems(this_00); - FID_conflict__Erase_tree_>_> - (&removedItems,(fuzzer_allocator_> *)&removedItems - ,(_Tree_node *)removedItems[1]); - operator_delete(removedItems,0x14); - FID_conflict__Erase_tree_>_> - (&newWispItems,(fuzzer_allocator_> *)&newWispItems - ,*(_Tree_node **)&(*GHIDRA_CAST((GHIDRA_CAST((newWispItems)) + 0x4)))); - operator_delete(newWispItems,0x18); - ExceptionList = local_10; - return; - } - do { - this_00 = player; - uVar8 = removedNode[4]; - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar8)) goto LAB_007d7b33; -LAB_007d7b52: - item = GHIDRA_CAST(0x0); - } - else if (GHIDRA_INT(uVar8) < 0) { - if ((-1 < GHIDRA_INT(uVar8)) || - (pvVar2 = (game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar2) >> 2 <= GHIDRA_INT(~uVar8) - )) goto LAB_007d7b52; - item = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar2) + ~uVar8 * 4))); - } - else { -LAB_007d7b33: - pvVar2 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) >> 2 <= GHIDRA_INT(uVar8)) - goto LAB_007d7b52; - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar8 * 4)); - } - TriggerCollectibleRemoved(player,uVar8); - if ((item->addCostumeOnPickup != 0) && - (bVar5 = HasCollectible(this_00,removedNode[4],0), bVar5 == 0)) { - RemoveCostume(this_00,item); - } - piVar3 = GHIDRA_CAST(removedNode[2]); - if (*GHIDRA_CAST((GHIDRA_CAST(piVar3) + 0xd)) == '\0') { - cVar1 = *GHIDRA_CAST((*piVar3 + 0xd)); - removedNode = piVar3; - piVar3 = GHIDRA_CAST(*piVar3); - while (cVar1 == '\0') { - cVar1 = *GHIDRA_CAST((*piVar3 + 0xd)); - removedNode = piVar3; - piVar3 = GHIDRA_CAST(*piVar3); - } - } - else { - cVar1 = *GHIDRA_CAST((removedNode[1] + 0xd)); - piVar4 = GHIDRA_CAST(removedNode[1]); - piVar3 = removedNode; - while ((removedNode = piVar4, cVar1 == '\0' && (piVar3 == GHIDRA_CAST(removedNode[2])))) { - cVar1 = *GHIDRA_CAST((removedNode[1] + 0xd)); - piVar4 = GHIDRA_CAST(removedNode[1]); - piVar3 = removedNode; - } - } - if (removedNode == removedItems) goto LAB_007d7bcf; - game = g_game; - } while( true ); -} - -// 007d7c30 -void Entity_Player::trigger_cracked_orb(Vector *effectPos) -{ - Entity_Player *door = this; - float fVar1; - float fVar2; - code *pcVar3; - Entity_Player *parent; - uint8_t bVar4; - uint32_t uVar5; - RoomDescriptor *revealedRoom; - Game *pGVar6; - Entity *unlockEffect; - Entity_Effect *orbEffect; - float *extraout_EAX; - int *piVar7; - void *pvVar8; - uint32_t uVar9; - int iVar10; - int *pushCursor; - uint32_t roomCount; - int *roomListEntry; - uint32_t *rngSeed; - EntityRef playerRef; - int *unrevealedRooms; - int *unrevealedEnd; - int *unrevealedCapacity; - Vector local_44; - Vector blownDoorPos; - Vector gridEffectPos; - int *unrevealedCapEnd; - int *unrevealedBegin; - Game *local_24; - Entity_Player *player; - uint32_t local_1c; - char isAnyOpened; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - GridEntity_Door *door; - Manager *manager; - int *roomIdxList; - - puStack_c = &LAB_00b0040d; - local_10 = ExceptionList; - uVar5 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - iVar10 = 0; - piVar7 = GHIDRA_CAST(0x0); - local_24 = g_game; - pushCursor = GHIDRA_CAST(0x0); - unrevealedBegin = GHIDRA_CAST(0x0); - unrevealedRooms = GHIDRA_CAST(0x0); - unrevealedEnd = GHIDRA_CAST(0x0); - unrevealedCapEnd = GHIDRA_CAST(0x0); - unrevealedCapacity = GHIDRA_CAST(0x0); - local_8 = 0; - player = door; - if (0 < g_game->_nbRooms) { - roomListEntry = &g_game->_roomList[0].SafeGridIndex; - do { - if (((uint8_t)roomListEntry[0xe] & 5) != 5) { - if (pushCursor == piVar7) { - msvc::vector::_Emplace_reallocate(pushCursor,roomListEntry); - piVar7 = unrevealedCapacity; - pushCursor = unrevealedEnd; - } - else { - *pushCursor = *roomListEntry; - unrevealedEnd = pushCursor + 1; - pushCursor = unrevealedEnd; - } - } - roomIdxList = unrevealedRooms; - iVar10 = iVar10 + 1; - roomListEntry = roomListEntry + 0x2e; - } while (iVar10 < local_24->_nbRooms); - unrevealedBegin = unrevealedRooms; - unrevealedCapEnd = piVar7; - if (unrevealedRooms != pushCursor) { - roomCount = GHIDRA_INT(pushCursor) - GHIDRA_INT(unrevealedRooms) >> 2; - pvVar8 = (player->_collectibleRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(pvVar8) + 0x2a30)); - uVar9 = *rngSeed; - if (uVar9 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar9 = *rngSeed; - if (uVar9 == 0) { - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - } - uVar9 = uVar9 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x2a34)) & 0x1f) ^ uVar9; - uVar9 = uVar9 ^ uVar9 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x2a38)) & 0x1f); - uVar9 = uVar9 ^ uVar9 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x2a3c)) & 0x1f); - *rngSeed = uVar9; - if (roomCount == 0) { - uVar9 = 0; - } - else { - uVar9 = uVar9 % roomCount; - } - revealedRoom = Level::GetRoomByIdx(GHIDRA_CAST(local_24),roomIdxList[uVar9],-1); - revealedRoom->DisplayFlags = revealedRoom->DisplayFlags | 5; - Minimap::Refresh(&g_game->_minimap); - manager = g_manager; - local_24 = GHIDRA_CAST(0x352); - seed_fart_sound_override(GHIDRA_CAST(&local_24)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_24),1.0,2,0,1.0,0.0); - } - } - isAnyOpened = '\0'; - local_24 = GHIDRA_CAST(0x0); - pvVar8 = g_game->_room; - if (0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0xc))) { - local_1c = 0x24; - do { - if (((local_24 < GHIDRA_CAST(0x1c0)) && - (piVar7 = *GHIDRA_CAST((local_1c + GHIDRA_INT(pvVar8))), piVar7 != GHIDRA_CAST(0x0))) && - ((((iVar10 = piVar7[1], iVar10 == 2 || - (((((iVar10 == 3 || (iVar10 == 4)) || (iVar10 == 5)) || - ((iVar10 == 6 || (iVar10 == 0x16)))) || (iVar10 == 0x18)))) || - (((iVar10 == 0x19 || (iVar10 == 0x1a)) || (iVar10 == 0x1b)))) && - ((((piVar7[3] == 1 || (piVar7[3] == 4)) && (iVar10 != 3)) && (iVar10 != 0x18)))))) { - if ((iVar10 != 4) && (iVar10 != 0x16)) { - if ((g_game->_levelStateFlags & 0x2000U) == 0) { - pGVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x768)); - } - else { - pGVar6 = GHIDRA_CAST(0xffffffff); - } - if (pGVar6 != local_24) goto LAB_007d7f10; - } - pcVar3 = *(code **)(*piVar7 + 0x14); - (GHIDRA_CAST((&playerRef)))->EntityRef::constructor(GHIDRA_CAST(player)); - (*pcVar3)(1,&playerRef,uVar5); - uVar9 = Random(); - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - gridEffectPos.x = (float)(piVar7[9] % iVar10) * 40.0 + 40.0; - gridEffectPos.y = (float)(piVar7[9] / iVar10) * 40.0 + 120.0; - unlockEffect = Game::Spawn(g_game,1000,0xad,&gridEffectPos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar9); - unlockEffect->Update(); - isAnyOpened = '\x01'; - } -LAB_007d7f10: - local_24 = GHIDRA_CAST((GHIDRA_INT(&local_24->_stage) + 1)); - local_1c = local_1c + 4; - pvVar8 = g_game->_room; - } while (GHIDRA_INT(local_24) < *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0xc))); - } - local_1c = 0; - local_24 = GHIDRA_CAST(0x724); - do { - pGVar6 = local_24; - local_1c = local_1c + 1; - if ((local_1c < 9) && - (door = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + GHIDRA_INT((local_24->_roomList + -1)) + 0xa4)), - door != GHIDRA_CAST(0x0))) { - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x8)))); - if (((iVar10 == 1) || (((iVar10 == 4 || (iVar10 == 3)) || (iVar10 == 2)))) || (iVar10 == 5)) { - bVar4 = (GHIDRA_CAST((door)))->GridEntity_Door::TryUnlock(player,1); - if (bVar4 == 0) goto LAB_007d80f4; - uVar5 = Random(); - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - local_44.x = (float)(door->_gridIndex % iVar10) * 40.0 + 40.0; - local_44.y = (float)(door->_gridIndex / iVar10) * 40.0 + 120.0; - unlockEffect = Game::Spawn(g_game,1000,0xad,&local_44,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - unlockEffect->Update(); - isAnyOpened = '\x01'; - } - else { - if ((((door->_currentRoomType != 7) && (door->_targetRoomType != 7)) && - ((door->_currentRoomType != 8 && (door->_targetRoomType != 8)))) || - (bVar4 = (GHIDRA_CAST((door)))->GridEntity_Door::TryBlowOpen(0,GHIDRA_CAST(0x0)), bVar4 == 0)) - goto LAB_007d80f4; - uVar5 = Random(); - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - blownDoorPos.x = (float)(door->_gridIndex % iVar10) * 40.0 + 40.0; - blownDoorPos.y = (float)(door->_gridIndex / iVar10) * 40.0 + 120.0; - unlockEffect = Game::Spawn(g_game,1000,0xad,&blownDoorPos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar5); - unlockEffect->Update(); - isAnyOpened = '\x01'; - } - } - else { -LAB_007d80f4: - local_24 = pGVar6; - } - local_24 = GHIDRA_CAST(&local_24->_stageType); - if (0x743 < GHIDRA_INT(local_24)) { - if (isAnyOpened != '\0') { - uVar5 = Random(); - orbEffect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xad,effectPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - parent = player; - (orbEffect->_sprite)._scale.x = (player->_playerSpriteScale).x; - (orbEffect->_sprite)._scale.y = (player->_playerSpriteScale).y; - if ((effectPos->x == g_vectorZero.x) && (effectPos->y == g_vectorZero.y)) { - (orbEffect->_pos).x = (player->_pos).x; - (orbEffect->_pos).y = (player->_pos).y; - GetFlyingOffset(player,&local_44); - fVar1 = extraout_EAX[1]; - fVar2 = (parent->_posOffset).y; - (orbEffect->_posOffset).x = (parent->_posOffset).x + *extraout_EAX; - (orbEffect->_posOffset).y = fVar1 + fVar2; - (GHIDRA_CAST((orbEffect)))->Entity_Effect::FollowParent(GHIDRA_CAST(parent)); - } - else { - (orbEffect->_posOffset).x = 0.0; - (orbEffect->_posOffset).y = -16.0; - } - orbEffect->Update(); - } - if (unrevealedBegin != GHIDRA_CAST(0x0)) { - uVar5 = GHIDRA_INT(unrevealedCapEnd) - GHIDRA_INT(unrevealedBegin) & 0xfffffffc; - piVar7 = unrevealedBegin; - if (0xfff < uVar5) { - piVar7 = GHIDRA_CAST(unrevealedBegin[-1]); - uVar5 = uVar5 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(unrevealedBegin) + (-4 - GHIDRA_INT(piVar7))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(piVar7,uVar5); - } - ExceptionList = local_10; - return; - } - } while( true ); -} - -// 007d8240 -uint32_t Entity_Player::AddItemCard(uint32_t itemID) -{ - void **ppvVar1; - void *pvVar2; - void *pvVar3; - uint32_t *_Src; - int starterDeckCount; - uint32_t uVar4; - Entity *droppedCard; - int starterDeckCount; - size_t _Size; - Vector dropPos; - uint32_t *cardsEnd; - - if (itemID != 0) { - pvVar2 = (this->_itemCards)._end; - pvVar3 = (this->_itemCards)._begin; - starterDeckCount = GetCollectibleNum(this,0xfb,0); - starterDeckCount = 0x14; - if (starterDeckCount + 3 < 0x14) { - starterDeckCount = starterDeckCount + 3; - } - if (GHIDRA_INT(pvVar2) - GHIDRA_INT(pvVar3) >> 2 == starterDeckCount) { - Room::FindFreePickupSpawnPosition(g_game->_room,&dropPos,&this->_pos,0.0,0,0,0); - uVar4 = Random(); - droppedCard = Game::SpawnEx(g_game,5,300,&dropPos,&g_vectorZero,GHIDRA_CAST(this), - *GHIDRA_CAST((this->_itemCards)._begin) | 0x8000,uVar4,0); - if (droppedCard != GHIDRA_CAST(0x0)) { - droppedCard[1]._sprite._championColor._offset[0] = 5.60519e-45; - } - pvVar3 = (this->_itemCards)._begin; - pvVar2 = (void *)(GHIDRA_INT(pvVar3) + 4); - memmove(pvVar3,pvVar2,GHIDRA_INT((this->_itemCards)._end) - GHIDRA_INT(pvVar2)); - ppvVar1 = &(this->_itemCards)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + -4); - } - } - pvVar2 = (this->_itemCards)._end; - pvVar3 = (this->_itemCards)._begin; - starterDeckCount = GetCollectibleNum(this,0xfb,0); - uVar4 = 0x14; - if (GHIDRA_INT((starterDeckCount + 3U)) < 0x14) { - uVar4 = starterDeckCount + 3U; - } - if (uVar4 <= GHIDRA_UINT((GHIDRA_INT(pvVar2) - GHIDRA_INT(pvVar3) >> 2))) { - return 0; - } - if (itemID == 0) { - uVar4 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT((this->_collectibleRNGs)._begin) + 0x2c60)))))->RNG::Next(); - itemID = ItemPool::GetCardImpl(uVar4); - } - uVar4 = itemID; - cardsEnd = (this->_itemCards)._end; - _Src = (this->_itemCards)._begin; - if (cardsEnd == (this->_itemCards)._capacity) { - msvc::vector::_Emplace_reallocate(_Src,&itemID); - uVar4 = itemID; - } - else if (_Src == cardsEnd) { - *cardsEnd = itemID; - ppvVar1 = &(this->_itemCards)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 4); - } - else { - *cardsEnd = cardsEnd[-1]; - ppvVar1 = &(this->_itemCards)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 4); - _Size = GHIDRA_INT(cardsEnd) + (-4 - GHIDRA_INT(_Src)); - memmove((void *)(GHIDRA_INT(cardsEnd) - _Size),_Src,_Size); - *_Src = uVar4; - } - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - return uVar4; -} - -// 007d83f0 -void Entity_Player::spawn_lil_clot_familiars() -{ - int lilClotMultiplier; - int iVar1; - uint32_t flagsHigh; - Entity *pEVar3; - Entity *bloodPoof; - uint32_t uVar4; - int iVar5; - bool bVar6; - bool bVar7; - float local_1c; - int clotsToSpawn; - float cosAngle; - Vector velocity; - uint32_t flagsHigh; - Manager *manager; - - uVar4 = 0; - iVar5 = 0; - flagsHigh = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1254)); - if (flagsHigh != 0) { - do { - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x124c)) + uVar4 * 4)); - if ((((*GHIDRA_CAST((iVar1 + 0x28)) == 3) && (*GHIDRA_CAST((iVar1 + 0x2c)) == 0xee)) && - (*GHIDRA_CAST((iVar1 + 0x30)) == 7)) && (*GHIDRA_CAST((iVar1 + 0x410)) == this)) { - iVar5 = iVar5 + 1; - } - uVar4 = uVar4 + 1; - } while (uVar4 < flagsHigh); - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef8)))) != 0xb0)) { - iVar1 = GetTrinketMultiplier(this,0xb0); - bVar7 = false; - bVar6 = iVar1 == 0; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ef0))) != '\0') goto LAB_007d8486; - lilClotMultiplier = GetTrinketMultiplier(this,0xb0); - bVar7 = SBORROW4(lilClotMultiplier,1); - iVar1 = lilClotMultiplier + -1; - bVar6 = lilClotMultiplier == 1; - } - if (bVar6 || bVar7 != iVar1 < 0) { - return; - } -LAB_007d8486: - iVar1 = GetTrinketMultiplier(this,0xb0); - if ((iVar5 < iVar1) && (clotsToSpawn = GetTrinketMultiplier(this,0xb0), iVar5 < clotsToSpawn)) { - clotsToSpawn = clotsToSpawn - iVar5; - do { - flagsHigh = Random(); - uVar4 = Random(); - local_1c = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_1c = local_1c + local_1c; - cosAngle = cos(local_1c); - velocity.y = sin(local_1c); - velocity.x = cosAngle + cosAngle; - velocity.y = velocity.y + velocity.y; - pEVar3 = Game::SpawnEx(g_game,3,0xee,&this->_pos,&velocity,GHIDRA_CAST(this),7,flagsHigh,0); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&pEVar3->_flags) + 4)); - iVar5 = *GHIDRA_CAST(pEVar3); - *GHIDRA_CAST(&pEVar3->_flags) = GHIDRA_UINT(pEVar3->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&pEVar3->_flags) + 4)) = flagsHigh; - (**(code **)(iVar5 + 0xc))(); - manager = g_manager; - local_1c = 1.00893e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_1c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c),1.0,2,0,1.0,0.0); - flagsHigh = Random(); - bloodPoof = Game::SpawnEx(g_game,1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,flagsHigh,0); - bloodPoof->SetColor(&pEVar3->_splatColor,0xffffffff,0xff,0,1); - iVar5 = *GHIDRA_CAST(bloodPoof); - (bloodPoof->_sprite)._offset.x = 0.0; - (bloodPoof->_sprite)._offset.y = -6.0; - bloodPoof->_renderDepthOffset = 10.0; - (**(code **)(iVar5 + 0xc))(); - clotsToSpawn = clotsToSpawn + -1; - } while (clotsToSpawn != 0); - } - return; -} - -// 007d8740 -void Entity_Player::creep_contact_add(int flags, int count) -{ - int oldCount; - int oldCount; - int oldFlags; - - oldCount = this->_grantedCollectibleCountdown; - oldCount = count + oldCount; - oldFlags = this->_grantedCollectibleFlags; - this->_grantedCollectibleFlags = flags; - if (4 < oldCount) { - oldCount = 4; - } - this->_grantedCollectibleCountdown = oldCount; - if ((0 < oldCount != 0 < oldCount) || (oldFlags != flags)) { - this->_cacheFlags = this->_cacheFlags | 99; - EvaluateItems(this); - } - return; -} - -// 007d87a0 -uint8_t Entity_Player::spawn_ghost_corpse() -{ - int iVar1; - uint8_t bVar2; - uint32_t uVar3; - Entity *corpseEffect; - LayerState *ghostLayer; - uint8_t *cursor; - char *deathCursor; - ANM2 *this_00; - uint32_t *puVar4; - bool isLess; - ANM2 spriteCopy; - Entity_Player *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint8_t *animData; - uint32_t flagsHigh; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b00430; - local_10 = ExceptionList; - ExceptionList = &local_10; - local_14 = this; - uVar3 = Random(); - corpseEffect = Game::SpawnEx(g_game,1000,6,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3,0); - ANM2::ANM2(&spriteCopy,&this->_sprite); - Isaac::SwapANM2(&corpseEffect->_sprite,&spriteCopy); - local_8 = 0; - ANM2::Reset(this_00); - AnimationState::~AnimationState(&spriteCopy._overlayAnimState); - AnimationState::~AnimationState(&spriteCopy._animState); - (GHIDRA_CAST((spriteCopy._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&spriteCopy))))->msvc::string::_Tidy_deallocate(); - local_8 = 0xffffffff; - ghostLayer = ANM2::GetLayer(&corpseEffect->_sprite,GHIDRA_CAST("ghost")); - if (ghostLayer != GHIDRA_CAST(0x0)) { - ghostLayer->_visible = 0; - } - AnimationState::SetAnimationData(&(corpseEffect->_sprite)._overlayAnimState,(void *)0x0); - (corpseEffect->_sprite)._playbackSpeed = 1.0; - animData = (corpseEffect->_sprite)._animState._animData; - if (animData != GHIDRA_CAST(0x0)) { - cursor = animData; - if (0xf < *GHIDRA_CAST((animData + 0x14))) { - cursor = *GHIDRA_CAST(animData); - } - deathCursor = "Death"; - do { - bVar2 = *cursor; - isLess = bVar2 < (uint8_t)*deathCursor; - if (bVar2 != *deathCursor) { -LAB_007d88c0: - uVar3 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007d88c5; - } - if (bVar2 == 0) break; - bVar2 = cursor[1]; - isLess = bVar2 < (uint8_t)deathCursor[1]; - if (bVar2 != deathCursor[1]) goto LAB_007d88c0; - cursor = cursor + 2; - deathCursor = deathCursor + 2; - } while (bVar2 != 0); - uVar3 = 0; -LAB_007d88c5: - if ((uVar3 == 0) && - ((animData[0x34] == 0 || ((corpseEffect->_sprite)._animState._isPlaying != 0)))) - goto LAB_007d88f8; - } - bVar2 = ANM2::SetAnimation(&corpseEffect->_sprite,GHIDRA_CAST("Death"),1); - if (bVar2 != 0) { - AnimationState::Rewind(&(corpseEffect->_sprite)._animState); - (corpseEffect->_sprite)._animState._isPlaying = 1; - } -LAB_007d88f8: - if ((corpseEffect->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(corpseEffect->_sprite)._animState,6.0); - } - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&corpseEffect->_flags) + 4)); - *GHIDRA_CAST(&corpseEffect->_flags) = GHIDRA_UINT(corpseEffect->_flags) | 0x200000; - *GHIDRA_CAST((GHIDRA_INT(&corpseEffect->_flags) + 4)) = flagsHigh; - iVar1 = *GHIDRA_CAST(corpseEffect); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(corpseEffect[1])) + 0x40)))) = 10; - (**(code **)(iVar1 + 0xc))(); - puVar4 = &local_14->_astralProjectionBody; - if (*puVar4 != 0) { - local_14 = GHIDRA_CAST(puVar4); - msvc::multiset::erase(&local_14); - } - *puVar4 = corpseEffect; - msvc::multiset::insert(puVar4); - ExceptionList = local_10; - return 1; -} - -// 007d8980 -void Entity_Player::AddCurseMistEffect() -{ - void **ppvVar1; - uint32_t *puVar2; - int iVar3; - uint64_t qVar4; - Entity_Familiar *familiar; - void *familiarListData; - uint64_t emptyBackup; - uint64_t uStack_60; - uint64_t local_58; - uint64_t uStack_50; - uint32_t local_48; - uint32_t uStack_44; - uint64_t uStack_40; - uint32_t local_38; - int tmpBackup [3]; - uint16_t local_28; - uint8_t familiarList [4]; - void *pvStack_20; - int iStack_1c; - uint32_t uStack_18; - uint32_t familiarIdx; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - void *backupEnd; - uint32_t *backupSlot; - int *familiarEntity; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0045d; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (this->_hasCurseMistEffect == 0) { - if ((this->_backupPlayer != GHIDRA_CAST(0x0)) && (this->_valid != 0)) { - AddCurseMistEffect(this->_backupPlayer); - } - qVar4 = this->_flags; - puVar2 = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *puVar2 = *puVar2 & 0xfffffffb; - this->_cacheFlags = this->_cacheFlags | 0xffff; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(qVar4); - this->_bleedOutHealth = 0; - this->_hasCurseMistEffect = 1; - UpdateCostumes(this); - if (this->_valid != 0) { - (this->_consumablesBackup).coins = this->_numCoins; - (this->_consumablesBackup).keys = this->_numKeys; - (this->_consumablesBackup).bombs = this->_numBombs; - (this->_consumablesBackup).goldkey = this->_hasGoldenKey; - (this->_consumablesBackup).goldbomb = this->_hasGoldenBomb; - (this->_consumablesBackup).gigabombs = this->_numGigaBombs; - (this->_consumablesBackup).soulcharges = this->_effectiveSoulCharge; - (this->_consumablesBackup).bloodcharges = this->_effectiveBloodCharge; - (this->_consumablesBackup).poopmana = this->_poopMana; - tmpBackup[0] = 0; - tmpBackup[1] = 0; - tmpBackup[2] = 0; - local_28 = 0; - familiarList = (uint8_t [4])0x0; - pvStack_20 = (void *)0x0; - iStack_1c = 0; - uStack_18 = 0; - restore_curse_mist_backup(this,tmpBackup); - (this->_curseMistFamiliars)._end = (this->_curseMistFamiliars)._begin; - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(familiarList),3,-1,-1,0 - ,0); - local_8 = 0; - familiarIdx = 0; - if (uStack_18 != 0) { - familiarListData = pvStack_20; - do { - iVar3 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(familiarListData) + familiarIdx * 4)) + 0x2c)); - if (((iVar3 == 0x58) || (iVar3 == 0xca)) || (iVar3 == 0xe7)) { - backupSlot = (this->_curseMistFamiliars)._end; - emptyBackup = 0; - uStack_60 = 0; - local_58 = 0; - uStack_50 = 0; - uStack_40 = 0; - local_38 = 0; - uStack_44 = 0; - local_48 = 0; - if (backupSlot == (this->_curseMistFamiliars)._capacity) { - vector_PlayerItemBackup_emplace_reallocate(backupSlot,&emptyBackup); - familiarListData = pvStack_20; - } - else { - *backupSlot = 0; - backupSlot[1] = 0; - backupSlot[2] = 0; - backupSlot[3] = 0; - backupSlot[4] = 0; - backupSlot[5] = 0; - backupSlot[6] = 0; - backupSlot[7] = 0; - backupSlot[8] = 0; - backupSlot[9] = 0; - backupSlot[10] = 0; - backupSlot[0xb] = 0; - backupSlot[0xc] = 0; - ppvVar1 = &(this->_curseMistFamiliars)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x34); - } - backupEnd = (this->_curseMistFamiliars)._end; - familiar = (Entity_Familiar *) - __RTDynamicCast(*GHIDRA_CAST((GHIDRA_CAST(familiarListData) + familiarIdx * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0 - ); - (GHIDRA_CAST((familiar)))->Entity_Familiar::store_backup((void *)(GHIDRA_INT(backupEnd) + -0x34)); - familiarEntity = *GHIDRA_CAST((GHIDRA_CAST(pvStack_20) + familiarIdx * 4)); - if (familiarEntity[0xb] == 0xe7) { - (**(code **)(*familiarEntity + 0x28))(); - } - familiarListData = pvStack_20; - } - familiarIdx = familiarIdx + 1; - } while (familiarIdx < uStack_18); - } - local_8 = 0xffffffff; - if (familiarList[0] == '\0') { - local_8 = 1; - tracked_alloc(1,pvStack_20,0); - local_8 = 0xffffffff; - } - } - iVar3 = this->_pocketSlots[0]; - this->_curseMistPocketSlots[1] = this->_pocketSlots[1]; - this->_curseMistPocketSlots[0] = iVar3; - this->_pocketSlots[0] = 0; - this->_pocketSlots[1] = 1; - iVar3 = this->_pocketSlots[2]; - this->_curseMistPocketSlots[3] = this->_pocketSlots[3]; - this->_curseMistPocketSlots[2] = iVar3; - this->_pocketSlots[2] = 0; - this->_pocketSlots[3] = 1; - iVar3 = this->_pocketSlots[4]; - this->_curseMistPocketSlots[5] = this->_pocketSlots[5]; - this->_curseMistPocketSlots[4] = iVar3; - this->_pocketSlots[4] = 0; - this->_pocketSlots[5] = 1; - iVar3 = this->_pocketSlots[6]; - this->_curseMistPocketSlots[7] = this->_pocketSlots[7]; - this->_curseMistPocketSlots[6] = iVar3; - this->_pocketSlots[6] = 0; - this->_pocketSlots[7] = 1; - this->_curseMistTrinkets[0] = this->_trinketsID[0]; - iVar3 = this->_trinketsID[1]; - this->_trinketsID[0] = 0; - this->_curseMistTrinkets[1] = iVar3; - this->_trinketsID[1] = 0; - EvaluateItems(this); - if (this->_playerType == 0xe) { - this->_curseMistRedHearts = this->_redHearts; - AddMaxHearts(this,0,0); - } - } - ExceptionList = local_10; - return; -} - -// 007d8d20 -void Entity_Player::RemoveCurseMistEffect() -{ - ConsumableData *backup; - uint64_t qVar1; - uint8_t bVar2; - Entity_Player *itemOwner; - int iVar3; - uint32_t *puVar4; - uint32_t *puVar5; - uint32_t uVar6; - uint32_t variantIdx; - Entity_Familiar *familiar; - int *piVar7; - uint64_t *allocatedBytes; - int iVar8; - uint32_t *key; - EntityList_EL familiars; - uint8_t lowerBound [8]; - void *lowerBoundNode; - void *variantCounts; - uint32_t variantCountsSize; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Game *game; - void *savedFamiliars; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b00495; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (this->_hasCurseMistEffect != 0) { - if ((this->_backupPlayer != GHIDRA_CAST(0x0)) && (this->_valid != 0)) { - RemoveCurseMistEffect(this->_backupPlayer); - } - this->_cacheFlags = this->_cacheFlags | 0xffff; - this->_hasCurseMistEffect = 0; - UpdateCostumes(this); - bVar2 = 0; - if (this->_valid != 0) { - backup = &this->_consumablesBackup; - iVar8 = this->_numCoins + backup->coins; - itemOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1a0,GHIDRA_CAST(&g_game->_playerManager),1); - iVar3 = (-GHIDRA_UINT((itemOwner != GHIDRA_CAST(0x0))) & 900) + 99; - if (iVar8 < iVar3) { - iVar3 = iVar8; - } - iVar8 = this->_numKeys + (this->_consumablesBackup).keys; - backup->coins = iVar3; - iVar3 = 99; - if (iVar8 < 99) { - iVar3 = iVar8; - } - (this->_consumablesBackup).keys = iVar3; - iVar8 = (this->_consumablesBackup).bombs + this->_numBombs; - iVar3 = 99; - if (iVar8 < 99) { - iVar3 = iVar8; - } - (this->_consumablesBackup).bombs = iVar3; - if (((this->_consumablesBackup).goldkey == 0) && (this->_hasGoldenKey == 0)) { - bVar2 = 0; - } - else { - bVar2 = 1; - } - (this->_consumablesBackup).goldkey = bVar2; - if (((this->_consumablesBackup).goldbomb == 0) && (this->_hasGoldenBomb == 0)) { - bVar2 = 0; - } - else { - bVar2 = 1; - } - (this->_consumablesBackup).goldbomb = bVar2; - local_14 = (this->_consumablesBackup).gigabombs + this->_numGigaBombs; - piVar7 = GHIDRA_CAST(&local_14); - if (iVar3 <= GHIDRA_INT(local_14)) { - piVar7 = &(this->_consumablesBackup).bombs; - } - iVar8 = this->_effectiveSoulCharge + (this->_consumablesBackup).soulcharges; - (this->_consumablesBackup).gigabombs = *piVar7; - game = g_game; - iVar3 = 99; - if (iVar8 < 99) { - iVar3 = iVar8; - } - (this->_consumablesBackup).soulcharges = iVar3; - iVar8 = (this->_consumablesBackup).bloodcharges + this->_effectiveBloodCharge; - iVar3 = 99; - if (iVar8 < 99) { - iVar3 = iVar8; - } - (this->_consumablesBackup).bloodcharges = iVar3; - iVar8 = this->_poopMana + (this->_consumablesBackup).poopmana; - itemOwner = PlayerManager::FirstBirthrightOwner(&game->_playerManager,0x19); - iVar3 = (-GHIDRA_UINT((itemOwner != GHIDRA_CAST(0x0))) & 0x14) + 9; - if (iVar8 < iVar3) { - iVar3 = iVar8; - } - (this->_consumablesBackup).poopmana = iVar3; - restore_curse_mist_backup(this,&backup->coins); - bVar2 = this->_valid; - } - iVar3 = this->_curseMistPocketSlots[1]; - this->_pocketSlots[0] = this->_curseMistPocketSlots[0]; - iVar8 = this->_curseMistPocketSlots[2]; - this->_pocketSlots[1] = iVar3; - iVar3 = this->_curseMistPocketSlots[3]; - this->_pocketSlots[2] = iVar8; - iVar8 = this->_curseMistPocketSlots[4]; - this->_pocketSlots[3] = iVar3; - iVar3 = this->_curseMistPocketSlots[5]; - this->_pocketSlots[4] = iVar8; - iVar8 = this->_curseMistPocketSlots[6]; - this->_pocketSlots[5] = iVar3; - iVar3 = this->_curseMistPocketSlots[7]; - this->_pocketSlots[6] = iVar8; - this->_pocketSlots[7] = iVar3; - this->_trinketsID[0] = this->_curseMistTrinkets[0]; - this->_trinketsID[1] = this->_curseMistTrinkets[1]; - if (bVar2 != 0) { - ConsumableCountChanged(this,-1); - } - EvaluateItems(this); - savedFamiliars = (this->_curseMistFamiliars)._begin; - variantCounts = (void *)0x0; - variantCountsSize = 0; - variantCounts = operator_new(0x18); - *(void **)variantCounts = variantCounts; - *(void **)(GHIDRA_CAST(variantCounts) + 4) = variantCounts; - *(void **)(GHIDRA_CAST(variantCounts) + 8) = variantCounts; - *GHIDRA_CAST((GHIDRA_CAST(variantCounts) + 0xc)) = 0x101; - local_8 = 0; - if (savedFamiliars != (this->_curseMistFamiliars)._end) { - key = GHIDRA_CAST((GHIDRA_INT(savedFamiliars) + 4)); - do { - _Find_lower_bound<>(lowerBound,key); - if (((*GHIDRA_CAST((GHIDRA_CAST(lowerBoundNode) + 0xd)) != '\0') || - (*key < *GHIDRA_CAST((GHIDRA_CAST(lowerBoundNode) + 0x10)))) || (lowerBoundNode == variantCounts)) { - puVar4 = map_find_value(&variantCounts,GHIDRA_UINT(key)); - *puVar4 = 0; - } - puVar5 = map_find_value(&variantCounts,GHIDRA_UINT(key)); - uVar6 = *key; - variantIdx = *puVar5; - local_14 = variantIdx; - if (uVar6 == 0xe7) { - uVar6 = Random(); - Game::Spawn(g_game,3,0xe7,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),key[1],uVar6); - uVar6 = *key; - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,uVar6,-1,0,0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - if (familiars._size != 0) { - variantIdx = -GHIDRA_UINT((variantIdx != 0)) & variantIdx; - uVar6 = familiars._size - 1U; - if (variantIdx < familiars._size - 1U) { - uVar6 = variantIdx; - } - familiar = (Entity_Familiar *) - __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + uVar6 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); - Menu_Stats::Render(GHIDRA_CAST(familiar),key + -1); - *GHIDRA_CAST(&familiar->_flags) = GHIDRA_UINT(familiar->_flags) | 4; - iVar3 = familiar->_variant; - *GHIDRA_CAST((GHIDRA_INT(&familiar->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&familiar->_flags) + 4)); - if (iVar3 == 0xca) { - familiar->_subtype = key[1]; - } - variantIdx = local_14; - } - local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) != 0) { - uVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - qVar1 = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar6; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar6)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4))); - } - local_8 = local_8 & 0xffffff00; - } - piVar7 = map_find_value(&variantCounts,GHIDRA_UINT(key)); - *piVar7 = variantIdx + 1; - puVar5 = key + 0xc; - key = key + 0xd; - } while (puVar5 != (this->_curseMistFamiliars)._end); - } - iVar3 = this->_playerType; - (this->_curseMistFamiliars)._end = (this->_curseMistFamiliars)._begin; - if (iVar3 == 0xe) { - bVar2 = 0; - iVar3 = GetHeartLimit(this,0); - AddMaxHearts(this,iVar3 - this->_maxHearts,bVar2); - this->_redHearts = this->_curseMistRedHearts; - } - FID_conflict__Erase_tree_>_> - (&variantCounts, - (fuzzer_allocator_> *)&variantCounts, - *(_Tree_node **)(GHIDRA_INT(variantCounts) + 4)); - operator_delete(variantCounts,0x18); - } - ExceptionList = local_10; - return; -} - -// 007d9180 -void Entity_Player::AttachMinecart(Entity_NPC *minecart) -{ - Entity_Player *local_c [2]; - float cartY; - uint32_t *minecartRef; - float playerY; - - minecartRef = &this->_minecart; - if (GHIDRA_CAST(this->_minecart) != minecart) { - local_c[0] = this; - if (GHIDRA_CAST(this->_minecart) != GHIDRA_CAST(0x0)) { - local_c[0] = GHIDRA_CAST(minecartRef); - msvc::multiset::erase(local_c); - } - *minecartRef = minecart; - if (minecart != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(minecartRef); - } - } - playerY = (this->_pos).y; - cartY = (minecart->_targetPosition).y; - (this->_minecartOffset).x = (this->_pos).x - (minecart->_targetPosition).x; - (this->_minecartOffset).y = playerY - cartY; - return; -} - -// 007d9200 -void Entity_Player::add_samson_berserk_charge(int amount) -{ - int *cappedCharge; - int local_1c; - int berserkEffect [3]; - uint32_t local_c; - int *berserkCharge; - int berserkItem; - void *collectibles; - Manager *manager; - - berserkItem = amount + this->_samsonBerserkCharge; - berserkCharge = &this->_samsonBerserkCharge; - *berserkCharge = berserkItem; - if (this->_suplexState != 0) { - local_1c = 99999; - cappedCharge = &local_1c; - if (berserkItem < 100000) { - cappedCharge = berserkCharge; - } - berserkItem = *cappedCharge; - *berserkCharge = berserkItem; - } - if (99999 < berserkItem) { - *berserkCharge = 0; - collectibles = (g_manager->_itemConfig)._collectibles._begin; - if ((0xb00 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectibles) & - 0xfffffffcU))) && - (berserkItem = *GHIDRA_CAST((GHIDRA_CAST(collectibles) + 0xb00)), berserkItem != 0)) { - berserkEffect[2] = *GHIDRA_CAST((berserkItem + 0x78)); - berserkEffect[1] = 0; - local_c = 0; - berserkEffect[0] = berserkItem; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(berserkEffect,1,1); - } - manager = g_manager; - local_1c = 0x250; - seed_fart_sound_override(&local_1c); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_1c,1.0,2,0,1.0,0.0); - manager = g_manager; - local_1c = 0x28a; - seed_fart_sound_override(&local_1c); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_1c,1.0,2,0,1.0,0.0); - Level::UpdateBackwardsPathStages(g_game->_room); - } - this->_cacheFlags = this->_cacheFlags | 0x1000; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - return; -} - -// 007d93b0 -void Entity_Player::RevivePlayerGhost() -{ - int iVar1; - uint8_t isAnimSet; - std_string *ANM2Path; - int iVar2; - uint32_t seed; - Entity_Player *twin; - void *configNode; - void *configHead; - int aiStack_1c [2]; - uint8_t lowerBound [8]; - void *boundNode; - Manager *manager; - - aiStack_1c[1] = 0x100000; - do { - this->_isCoopGhost = 0; - this->_isInvicible = 0; - this->_entityCollisionClass = 4; - AnimationState::SetAnimationData(&(this->_sprite)._overlayAnimState,(void *)0x0); - manager = g_manager; - _Find_lower_bound<>(lowerBound,aiStack_1c + 1); - if ((*GHIDRA_CAST((GHIDRA_CAST(boundNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(boundNode) + 0x10)) < 0x100001)) - { - configNode = boundNode; - configHead = (manager->_entityConfig)._entities._head; - } - else { - configNode = (manager->_entityConfig)._entities._head; - configHead = configNode; - } - ANM2Path = GHIDRA_CAST((GHIDRA_INT(configNode) + 0x8c)); - if (configNode == configHead) { - ANM2Path = GHIDRA_CAST(0x74); - } - ANM2::Load(&this->_sprite,ANM2Path,0); - update_player_skin(this); - if (g_game->_isRestoringGlowingHourglassState == 0) { - PlayExtraAnimation(this,GHIDRA_CAST("Appear")); - } - this->_damageCooldown = 0x3c; - UpdateCostumes(this); - iVar2 = this->_ghostPocketSlots[0]; - this->_pocketSlots[1] = this->_ghostPocketSlots[1]; - iVar1 = this->_ghostPocketSlots[3]; - this->_pocketSlots[0] = iVar2; - iVar2 = this->_ghostPocketSlots[2]; - this->_pocketSlots[3] = iVar1; - iVar1 = this->_ghostPocketSlots[5]; - this->_pocketSlots[2] = iVar2; - iVar2 = this->_ghostPocketSlots[4]; - this->_pocketSlots[5] = iVar1; - iVar1 = this->_ghostPocketSlots[7]; - this->_pocketSlots[4] = iVar2; - iVar2 = this->_ghostPocketSlots[6]; - this->_pocketSlots[7] = iVar1; - this->_pocketSlots[6] = iVar2; - this->_trinketsID[0] = this->_ghostTrinkets[0]; - this->_trinketsID[1] = this->_ghostTrinkets[1]; - this->_cacheFlags = this->_cacheFlags | 0xffff; - EvaluateItems(this); - iVar2 = this->_maxHearts; - this->_soulHearts = 0; - this->_blackHearts = 0; - this->_eternalHearts = 0; - this->_boneHeartsMask = 0; - this->_boneHearts = 0; - this->_rottenHearts = 0; - if (iVar2 < 1) { - iVar2 = GetHealthType(this); - if (iVar2 == 4) { - this->_redHearts = 2; - AddBoneHearts(this,1); - } - else { - iVar2 = GetHealthType(this); - if (iVar2 == 3) { - this->_redHearts = 4; - this->_maxHearts = 4; - } - else { - iVar2 = GetHealthType(this); - this->_redHearts = 0; - this->_soulHearts = GHIDRA_UINT((iVar2 != 2)) * 2 + 1; - } - } - } - else { - if (3 < iVar2) { - iVar2 = 3; - } - this->_redHearts = iVar2; - iVar2 = GetHealthType(this); - if (iVar2 == 3) { - this->_redHearts = 2; - } - } - manager = g_manager; - aiStack_1c[0] = 0x50; - seed_fart_sound_override(aiStack_1c); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(aiStack_1c[0],1.0,2,0,1.0,0.0); - seed = Random(); - Game::SpawnEx(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); - if (this->_playerType == 0x23) { - twin = InitTwin(this,0x28); - InitPostLevelInitStats(twin); - twin->_isPlayingItemAnimation = 0; - ANM2::Reset(&twin->_bodySprite); - (twin->_sprite)._playbackSpeed = 1.0; - AnimationState::SetAnimationData(&(twin->_sprite)._overlayAnimState,(void *)0x0); - isAnimSet = ANM2::SetAnimation(&twin->_sprite,GHIDRA_CAST("Appear"),1); - if (isAnimSet != 0) { - AnimationState::Rewind(&(twin->_sprite)._animState); - (twin->_sprite)._animState._isPlaying = 1; - } - twin->_isPlayingExtraAnimation = 1; - twin->_isPlayingItemAnimation = 0; - twin->_damageCooldown = 0x3c; - } - this = this->_backupPlayer; - } while ((this != GHIDRA_CAST(0x0)) && (this->_isCoopGhost != 0)); - return; -} - -// 007d96f0 -void Entity_Player::MorphToCoopGhost() -{ - uint64_t qVar1; - uint8_t isAnimChanged; - uint32_t uVar2; - int secondTrinket; - int iVar3; - uint64_t *allocCounter; - uint32_t i; - EntityList_EL itemWisps; - EntityList_EL wisps; - int *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Entity_Player *backupPlayer; - Game *game; - uint32_t *twinRef; - int *wisp; - uint32_t wispData; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b004d5; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - if (this->_playerType != 0x28) { - if (this->_playerType == 0x23) { - twinRef = &this->_twinPlayer; - if ((GHIDRA_CAST(this->_twinPlayer) != GHIDRA_CAST(0x0)) && - (PlayerManager::RemoveCoPlayer - (&g_game->_playerManager,GHIDRA_CAST(this->_twinPlayer), - (uint8_t)&g_game->_playerManager), *twinRef != 0)) { - local_14 = twinRef; - msvc::multiset::erase(&local_14); - *twinRef = 0; - } - } - Revive(this); - if ((this->_playerType == 0x11) && (this->_forgottenBody != (void *)0x0)) { - SwapForgottenForm(this,1,0); - } - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveNullEffect(0x70,1); - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 0x60))(this,uVar2); - } - UpdateCostumes(this); - if (this->_hasCurseMistEffect == 0) { - iVar3 = this->_pocketSlots[1]; - this->_ghostPocketSlots[0] = this->_pocketSlots[0]; - this->_ghostPocketSlots[1] = iVar3; - this->_pocketSlots[0] = 0; - this->_pocketSlots[1] = 1; - iVar3 = this->_pocketSlots[3]; - this->_ghostPocketSlots[2] = this->_pocketSlots[2]; - this->_ghostPocketSlots[3] = iVar3; - this->_pocketSlots[2] = 0; - this->_pocketSlots[3] = 1; - iVar3 = this->_pocketSlots[5]; - this->_ghostPocketSlots[4] = this->_pocketSlots[4]; - this->_ghostPocketSlots[5] = iVar3; - this->_pocketSlots[4] = 0; - this->_pocketSlots[5] = 1; - iVar3 = this->_pocketSlots[7]; - this->_ghostPocketSlots[6] = this->_pocketSlots[6]; - this->_ghostPocketSlots[7] = iVar3; - this->_pocketSlots[6] = 0; - this->_pocketSlots[7] = 1; - iVar3 = this->_trinketsID[0]; - secondTrinket = this->_trinketsID[1]; - this->_trinketsID[0] = 0; - this->_trinketsID[1] = 0; - } - else { - iVar3 = this->_curseMistPocketSlots[1]; - this->_ghostPocketSlots[0] = this->_curseMistPocketSlots[0]; - this->_ghostPocketSlots[1] = iVar3; - this->_curseMistPocketSlots[0] = 0; - this->_curseMistPocketSlots[1] = 1; - iVar3 = this->_curseMistPocketSlots[3]; - this->_ghostPocketSlots[2] = this->_curseMistPocketSlots[2]; - this->_ghostPocketSlots[3] = iVar3; - this->_curseMistPocketSlots[2] = 0; - this->_curseMistPocketSlots[3] = 1; - iVar3 = this->_curseMistPocketSlots[5]; - this->_ghostPocketSlots[4] = this->_curseMistPocketSlots[4]; - this->_ghostPocketSlots[5] = iVar3; - this->_curseMistPocketSlots[4] = 0; - this->_curseMistPocketSlots[5] = 1; - iVar3 = this->_curseMistPocketSlots[7]; - this->_ghostPocketSlots[6] = this->_curseMistPocketSlots[6]; - this->_ghostPocketSlots[7] = iVar3; - this->_curseMistPocketSlots[6] = 0; - this->_curseMistPocketSlots[7] = 1; - iVar3 = this->_curseMistTrinkets[0]; - secondTrinket = this->_curseMistTrinkets[1]; - this->_curseMistTrinkets[0] = 0; - this->_curseMistTrinkets[1] = 0; - } - this->_ghostTrinkets[0] = iVar3; - this->_ghostTrinkets[1] = secondTrinket; - reset_body_sprite(this); - this->_isPlayingItemAnimation = 0; - ANM2::Reset(&this->_bodySprite); - (this->_sprite)._playbackSpeed = 1.0; - AnimationState::SetAnimationData(&(this->_sprite)._overlayAnimState,(void *)0x0); - isAnimChanged = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST("GhostAppear"),1); - if (isAnimChanged != 0) { - AnimationState::Rewind(&(this->_sprite)._animState); - (this->_sprite)._animState._isPlaying = 1; - } - game = g_game; - this->_isPlayingExtraAnimation = 1; - this->_isPlayingItemAnimation = 0; - if (1 < *GHIDRA_CAST(&game->_deathmatchManager)) { - this->_entityCollisionClass = 0; - } - this->_entityGridCollisionClass = 3; - this->_cacheFlags = this->_cacheFlags | 0xffff; - this->_isCoopGhost = 1; - this->_isInvicible = 1; - this->_visible = 1; - EvaluateItems(this); - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&wisps,3,0xce,-1,0,0); - wispData = (*GHIDRA_CAST((GHIDRA_CAST(&(wisps)) + 0x4))); - local_8 = 0; - i = 0; - uVar2 = wisps._size; - if (wisps._size != 0) { - do { - wisp = *GHIDRA_CAST((wispData + i * 4)); - if (GHIDRA_CAST(wisp[0x104]) == this) { - (**(code **)(*wisp + 0x28))(); - uVar2 = wisps._size; - } - i = i + 1; - } while (i < uVar2); - } - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&itemWisps,3,0xed,-1,0,0); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - i = 0; - uVar2 = itemWisps._size; - if (itemWisps._size != 0) { - do { - wisp = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(itemWisps)) + 0x4))) + i * 4)); - if (GHIDRA_CAST(wisp[0x104]) == this) { - (**(code **)(*wisp + 0x28))(); - uVar2 = itemWisps._size; - } - i = i + 1; - } while (i < uVar2); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(itemWisps)) + 0x0))) == '\0') { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(itemWisps)) + 0x4))) != 0) { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(itemWisps)) + 0x4))) + -4)); - qVar1 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(itemWisps)) + 0x4))) + -4)); - } - } - local_8 = 0xffffffff; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(wisps)) + 0x0))) == '\0') { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(wisps)) + 0x4))) != 0) { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(wisps)) + 0x4))) + -4)); - qVar1 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(wisps)) + 0x4))) + -4))); - } - } - local_8 = 0xffffffff; - backupPlayer = this->_backupPlayer; - if ((backupPlayer != GHIDRA_CAST(0x0)) && (backupPlayer->_isCoopGhost == 0)) { - MorphToCoopGhost(backupPlayer); - } - } - ExceptionList = local_10; - return; -} - -// 007d9b70 -void Entity_Player::reset_body_sprite() -{ - EntityConfig_Entity *playerEntityConfig; - int iVar1; - int extraout_ECX; - uint32_t layerId; - int iVar2; - uint8_t findResult [8]; - void *node; - Entity_Player *local_c; - Manager *local_8; - Manager *manager; - ANM2 *sprite; - - manager = g_manager; - local_8 = GHIDRA_CAST(0x100100); - local_c = this; - _Find_lower_bound<>(findResult,&local_8); - if (((*GHIDRA_CAST((GHIDRA_CAST(node) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(node) + 0x10)) < 0x100101)) && - (node != (manager->_entityConfig)._entities._head)) { - playerEntityConfig = GHIDRA_CAST((GHIDRA_INT(node) + 0x18)); - } - else { - playerEntityConfig = EntityConfig::GetEntity(&manager->_entityConfig,1,0,0); - } - sprite = &this->_sprite; - ANM2::Load(sprite,&playerEntityConfig->anm2Path,0); - iVar2 = this->_playerType; - iVar1 = 0x3c; - if ((iVar2 == 4) || (iVar2 == 0x19)) { - iVar1 = 0x3e; - } - else if (((iVar2 == 0xe) || (iVar2 == 0x21)) || - ((iVar2 == 0xf || (((iVar2 == 0x22 || (iVar2 == 0x10)) || (iVar2 == 0x23)))))) { - iVar1 = 0x3f; - } - else if (((iVar2 == 7) || (iVar2 == 0x1c)) || ((iVar2 == 0xd || (iVar2 == 0x20)))) { - iVar1 = 0x3d; - } - layerId = 0; - local_8 = g_manager; - if ((this->_sprite)._layerCount != 0) { - iVar2 = iVar1 * 0x38; - do { - Sprite::ReplaceSpritesheet - (GHIDRA_CAST(sprite),layerId, - GHIDRA_CAST((GHIDRA_INT((local_8->_entityConfig)._babies._begin) + iVar2 + 0x1c))); - layerId = layerId + 1; - iVar1 = extraout_ECX; - } while (layerId < GHIDRA_UINT((local_c->_sprite)._layerCount)); - } - ANM2::LoadGraphics(sprite,(uint8_t)iVar1); - return; -} - -// 007d9d00 -uint32_t * Entity_Player::CalculateBagOfCraftingOutput(uint32_t *output, uint8_t *bagContent, uint8_t unused) -{ - int iVar1; - code *pcVar2; - uint8_t pickup4; - ItemConfig_Item *recipeItem; - uint32_t *puVar4; - uint32_t uVar5; - int iVar6; - int iVar7; - uint32_t weightCount; - void *pvVar8; - Game *game; - std_vector *psVar9; - uint32_t *puVar10; - float fVar11; - float fVar12; - int itemWeightsEnd; - void *itemWeightsCapacityEnd; - uint32_t seed; - uint32_t local_7c; - int maxQuality; - int minQuality; - void *local_70; - float totalWeight; - std_vector *local_68; - uint8_t *local_64; - uint64_t *local_60; - uint32_t *local_5c; - void *poolWeights; - uint32_t *poolWeightsEnd; - uint32_t *poolWeightsCapacityEnd; - uint32_t local_4c; - float local_48; - uint8_t pickupCounts [31]; - void *prevExceptionList; - uint8_t *puStack_18; - uint32_t ehState; - Manager *manager; - uint8_t pickup2; - uint8_t pickup3; - uint8_t pickup4; - uint8_t pickup5; - uint8_t pickup6; - uint8_t pickup7; - - manager = g_manager; - ehState = 0xffffffff; - puStack_18 = &LAB_00b00518; - prevExceptionList = ExceptionList; - ExceptionList = &prevExceptionList; - local_64 = bagContent; - FUN_00753660(&local_4c,bagContent); - recipeItem = ItemConfig::GetCollectible(&manager->_itemConfig,local_4c); - if ((recipeItem == GHIDRA_CAST(0x0)) || - (pickup4 = (GHIDRA_CAST((recipeItem)))->Item::IsAvailable(0xffffffff), pickup4 == 0)) { - local_4c = 0; - local_48 = -NAN; - } - if (local_4c == 0) { - pickupCounts[0] = 0; - pickupCounts[1] = 0; - pickupCounts[2] = 0; - pickupCounts[3] = 0; - pickupCounts[4] = 0; - pickupCounts[5] = 0; - pickupCounts[6] = 0; - pickupCounts[7] = 0; - pickupCounts[8] = 0; - pickupCounts[9] = 0; - pickupCounts[10] = 0; - pickupCounts[0xb] = 0; - pickupCounts[0xc] = 0; - pickupCounts[0xd] = 0; - pickupCounts[0xe] = 0; - pickupCounts[0xf] = 0; - pickupCounts[0x18] = 0; - pickupCounts[0x19] = 0; - pickupCounts[0x1a] = 0; - pickupCounts[0x1b] = 0; - pickupCounts[0x10] = 0; - pickupCounts[0x11] = 0; - pickupCounts[0x12] = 0; - pickupCounts[0x13] = 0; - pickupCounts[0x14] = 0; - pickupCounts[0x15] = 0; - pickupCounts[0x16] = 0; - pickupCounts[0x17] = 0; - pickup4 = *local_64; - pickup3 = local_64[3]; - pickup4 = local_64[4]; - pickup5 = local_64[5]; - pickupCounts[0x1c] = 0; - pickupCounts[0x1d] = 0; - pickupCounts[0x1e] = 0; - pickupCounts[pickup4] = pickupCounts[pickup4] + 1; - local_68 = GHIDRA_CAST(GHIDRA_UINT(local_64[1])); - poolWeights = (void *)0x0; - poolWeightsEnd = GHIDRA_CAST(0x0); - pickupCounts[GHIDRA_INT(local_68)] = pickupCounts[GHIDRA_INT(local_68)] + 1; - pickup2 = local_64[2]; - pickup6 = local_64[6]; - poolWeightsCapacityEnd = GHIDRA_CAST(0x0); - pickupCounts[pickup2] = pickupCounts[pickup2] + 1; - pickupCounts[pickup3] = pickupCounts[pickup3] + 1; - pickupCounts[pickup4] = pickupCounts[pickup4] + 1; - pickupCounts[pickup5] = pickupCounts[pickup5] + 1; - pickup7 = local_64[7]; - pickupCounts[pickup6] = pickupCounts[pickup6] + 1; - pickupCounts[pickup7] = pickupCounts[pickup7] + 1; - iVar6 = *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_UINT(pickup7) * 4)) + - *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_UINT(pickup6) * 4)) + - *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_UINT(pickup5) * 4)) + - *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_UINT(pickup4) * 4)) + - *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_UINT(pickup3) * 4)) + - *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_UINT(pickup2) * 4)) + - *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_INT(local_68) * 4)) + *GHIDRA_CAST((&DAT_00b6ba30 + GHIDRA_UINT(pickup4) * 4)); - ehState = 0; - local_4c = 0; - local_48 = 1.0; - FUN_007dd690(0,&local_4c); - local_4c = 1; - local_48 = 2.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 1; - poolWeightsEnd[1] = 0x40000000; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 2; - local_48 = 2.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 2; - poolWeightsEnd[1] = 0x40000000; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 4; - local_48 = (float)pickupCounts[4] * 10.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 4; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 3; - local_48 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pickupCounts))) + 0x0))) >> 0x18) * 10.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 3; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 5; - local_48 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pickupCounts))) + 0x4))) >> 0x10 & 0xff) * 5.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 5; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 8; - local_48 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pickupCounts))) + 0x4))) >> 8 & 0xff) * 10.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 8; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 0xc; - local_48 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pickupCounts))) + 0x4))) >> 0x18) * 10.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 0xc; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 9; - local_48 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pickupCounts))) + 0x18))) >> 8 & 0xff) * 10.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 9; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - local_4c = 7; - local_48 = (float)pickupCounts[0x1d] * 10.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 7; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - if (((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pickupCounts))) + 0x0))) >> 8 & 0xff) + GHIDRA_UINT(pickupCounts[8]) + GHIDRA_UINT(pickupCounts[0xc]) + - ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pickupCounts))) + 0xc))) >> 0x18) == 0) { - local_4c = 0x1a; - local_48 = (float)pickupCounts[0x17] * 10.0; - if (poolWeightsEnd == poolWeightsCapacityEnd) { - local_5c = poolWeightsEnd; - FUN_007dd690(poolWeightsEnd,&local_4c); - } - else { - *poolWeightsEnd = 0x1a; - poolWeightsEnd[1] = local_48; - poolWeightsEnd = poolWeightsEnd + 2; - } - } - game = g_game; - seed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_seedEffects))) + 0x4)))); - local_5c = poolWeightsEnd; - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Error: Game Start Seed was not set.\n")); - seed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_seedEffects))) + 0x4)))); - } - local_70 = (void *)0x0; - psVar9 = GHIDRA_CAST((1 - GHIDRA_INT(pickupCounts))); - local_60 = &DAT_00b1f4d4; - local_7c = 0x1f; - local_68 = psVar9; - do { - if (pickupCounts[GHIDRA_INT(local_70)] != 0) { - if (&DAT_00000050 < pickupCounts + GHIDRA_INT(&psVar9->_begin) + GHIDRA_INT(local_70)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG: Invalid ShiftIdx\n")); - } - local_64 = GHIDRA_CAST(0x0); - do { - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - puVar4 = GHIDRA_CAST((*pcVar2)()); - return puVar4; - } - seed = seed >> ((uint8_t)*local_60 & 0x1f) ^ seed; - seed = seed << ((uint8_t)((uint64_t)*local_60 >> 0x20) & 0x1f) ^ seed; - seed = seed >> ((uint8_t)*GHIDRA_CAST((local_60 + 1)) & 0x1f) ^ seed; - local_64 = local_64 + 1; - } while (local_64 < GHIDRA_CAST(GHIDRA_UINT(pickupCounts[GHIDRA_INT(local_70)]))); - psVar9 = local_68; - } - puVar10 = local_5c; - local_60 = GHIDRA_CAST((GHIDRA_INT(local_60) + 0xc)); - local_70 = (void *)(GHIDRA_INT(local_70) + 1); - local_7c = local_7c + -1; - } while (local_7c != 0); - local_48 = 2.8026e-44; - pickupCounts[0x10] = 1; - pickupCounts[0x11] = 0; - pickupCounts[0x12] = 0; - pickupCounts[0x13] = 0; - pickupCounts[0x14] = 0x15; - pickupCounts[0x15] = 0; - pickupCounts[0x16] = 0; - pickupCounts[0x17] = 0; - local_68 = GHIDRA_CAST(0x0); - local_70 = (void *)0x0; - local_64 = GHIDRA_CAST((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2)); - itemWeightsEnd = 0; - itemWeightsCapacityEnd = (void *)0x0; - if (local_64 != GHIDRA_CAST(0x0)) { - if (0x3fffffff < local_64) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - uVar5 = GHIDRA_INT(local_64) * 4; - local_70 = msvc::_Allocate(uVar5); - itemWeightsCapacityEnd = (void *)(GHIDRA_INT(local_70) + uVar5); - itemWeightsEnd = msvc::fill_n<4byte>(local_70,local_64,&local_68); - } - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),1); - totalWeight = 0.0; - puVar10 = GHIDRA_CAST((GHIDRA_INT(puVar10) - GHIDRA_INT(poolWeights) >> 3)); - local_64 = GHIDRA_CAST(0x0); - pvVar8 = poolWeights; - local_5c = puVar10; - if (puVar10 != GHIDRA_CAST(0x0)) { - do { - fVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + GHIDRA_INT(local_64) * 8 + 4)); - if (0.0 < fVar11) { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + GHIDRA_INT(local_64) * 8)); - if (((iVar1 == 4) || (iVar1 == 3)) || (iVar7 = iVar6, iVar1 == 5)) { - iVar7 = iVar6 + -5; - } - minQuality = 0; - maxQuality = 1; - if (iVar7 < 0x23) { - if (iVar7 < 0x1f) { - if (iVar7 < 0x1b) { - if (iVar7 < 0x17) { - if (iVar7 < 0x13) { - if (iVar7 < 0xf) { - if (iVar7 < 9) goto LAB_007da41c; - minQuality = 0; - } - else { - minQuality = 1; - } - maxQuality = 2; - } - else { - maxQuality = 3; - minQuality = 2; - } - } - else { - maxQuality = 4; - minQuality = 2; - } - } - else { - maxQuality = 4; - minQuality = 3; - } - } - else { - maxQuality = 4; - minQuality = 3; - } - } - else { - maxQuality = 4; - minQuality = 4; - } -LAB_007da41c: - local_7c = 0; - local_68 = &(g_game->_itemPool)._pools[iVar1]._poolList; - pvVar8 = local_68->_begin; - iVar7 = GHIDRA_INT(local_68->_end) - GHIDRA_INT(pvVar8); - iVar1 = iVar7 >> 0x1f; - if (iVar7 / 0x18 + iVar1 == iVar1) { - pvVar8 = poolWeights; - } - else { - local_60 = GHIDRA_CAST(0x0); - game = g_game; - do { - uVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + GHIDRA_INT(local_60))); - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar5)) goto LAB_007da49b; - } - else { - if (GHIDRA_INT(uVar5) < 0) { - if ((GHIDRA_INT(uVar5) < 0) && - (pvVar8 = (game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar5) < - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar8) >> 2)) - { - pvVar8 = (void *)**GHIDRA_CAST((GHIDRA_CAST(pvVar8) + ~uVar5 * 4)); - } - else { - pvVar8 = (void *)0x0; - } -LAB_007da4b3: - if (((pvVar8 != (void *)0x0) && (pickup4 = (GHIDRA_CAST((pvVar8)))->Item::IsAvailable(1), pickup4 != 0)) - && ((minQuality <= *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0xc4)) && - (*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0xc4)) <= maxQuality)))) { - fVar12 = fVar11 * *GHIDRA_CAST((GHIDRA_CAST(local_60) + GHIDRA_INT(local_68->_begin) + 4)); - totalWeight = fVar12 + totalWeight; - *GHIDRA_CAST((GHIDRA_CAST(local_70) + *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 4)) * 4)) = - fVar12 + *GHIDRA_CAST((GHIDRA_CAST(local_70) + *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 4)) * 4)); - } - } - else { -LAB_007da49b: - pvVar8 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT(uVar5) < - GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar8) >> 2) { - pvVar8 = *(void **)(GHIDRA_CAST(pvVar8) + uVar5 * 4); - goto LAB_007da4b3; - } - } - game = g_game; - } - local_60 = local_60 + 3; - local_7c = local_7c + 1; - pvVar8 = local_68->_begin; - } while (local_7c < GHIDRA_UINT(((GHIDRA_INT(local_68->_end) - GHIDRA_INT(pvVar8)) / 0x18))); - pvVar8 = poolWeights; - puVar10 = local_5c; - } - } - local_64 = GHIDRA_CAST((GHIDRA_INT(local_64) + 1)); - } while (local_64 < puVar10); - } - local_5c = GHIDRA_CAST(0x19); - game = g_game; - if (0.0 < totalWeight) { - local_68 = GHIDRA_CAST(0x0); - do { - local_5c = GHIDRA_CAST(0x19); - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - puVar4 = GHIDRA_CAST((*pcVar2)()); - return puVar4; - } - seed = seed >> (pickupCounts[0x10] & 0x1f) ^ seed; - seed = seed << (pickupCounts[0x14] & 0x1f) ^ seed; - seed = seed >> (SUB41(local_48,0) & 0x1f) ^ seed; - weightCount = itemWeightsEnd - GHIDRA_INT(local_70) >> 2; - uVar5 = 0; - fVar11 = (float)((double)GHIDRA_INT(seed) + __uint_to_double_fixup[-(GHIDRA_INT(seed) >> 0x1f)]) * - 2.3283062e-10 * totalWeight; - if (weightCount != 0) { - do { - fVar12 = *GHIDRA_CAST((GHIDRA_CAST(local_70) + uVar5 * 4)); - if (fVar11 < fVar12) { - local_5c = GHIDRA_CAST(uVar5); - goto LAB_007da627; - } - uVar5 = uVar5 + 1; - fVar11 = fVar11 - fVar12; - } while (uVar5 < weightCount); - } -LAB_007da627: - if (game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(local_5c)) goto LAB_007da666; - } - else { - if (GHIDRA_INT(local_5c) < 0) { - iVar6 = -1 - GHIDRA_INT(local_5c); - if ((iVar6 < 0) || - (pvVar8 = (game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT((game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar8) >> 2 <= iVar6 - )) { - pvVar8 = (void *)0x0; - } - else { - pvVar8 = (void *)**GHIDRA_CAST((GHIDRA_CAST(pvVar8) + iVar6 * 4)); - } - } - else { -LAB_007da666: - pvVar8 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar8) >> 2 <= GHIDRA_INT(local_5c) - ) goto LAB_007da698; - pvVar8 = *(void **)(GHIDRA_CAST(pvVar8) + GHIDRA_INT(local_5c) * 4); - } - if (pvVar8 != (void *)0x0) { - pickup4 = (GHIDRA_CAST((pvVar8)))->Item::IsAvailable(6); - game = g_game; - if (pickup4 != 0) break; - } - } -LAB_007da698: - local_68 = GHIDRA_CAST((GHIDRA_INT(&local_68->_begin) + 1)); - local_5c = GHIDRA_CAST(0x19); - } while (GHIDRA_INT(local_68) < 0x14); - } - uVar5 = ItemPool::GetFirstItemPoolForCollectible(&game->_itemPool,GHIDRA_INT(local_5c)); - *output = GHIDRA_UINT(local_5c); - output[1] = uVar5; - if (local_70 != (void *)0x0) { - uVar5 = GHIDRA_INT(itemWeightsCapacityEnd) - GHIDRA_INT(local_70) & 0xfffffffc; - pvVar8 = local_70; - if (0xfff < uVar5) { - pvVar8 = *(void **)(GHIDRA_CAST(local_70) + -4); - uVar5 = uVar5 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_70) + (-4 - GHIDRA_INT(pvVar8))))) goto LAB_007da72b; - } - operator_delete(pvVar8,uVar5); - } - if (poolWeights != (void *)0x0) { - uVar5 = GHIDRA_INT(poolWeightsCapacityEnd) - GHIDRA_INT(poolWeights) & 0xfffffff8; - pvVar8 = poolWeights; - if (0xfff < uVar5) { - pvVar8 = *(void **)(GHIDRA_CAST(poolWeights) + -4); - uVar5 = uVar5 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(poolWeights) + (-4 - GHIDRA_INT(pvVar8))))) { -LAB_007da72b: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar8,uVar5); - } - } - else { - output[1] = GHIDRA_UINT(local_48); - *output = local_4c; - } - ExceptionList = prevExceptionList; - return output; -} - -// 007da810 -void Entity_Player::SpawnClot(Vector *pos, uint8_t unk) -{ - uint32_t uVar1; - uint8_t isBoneHeart; - int iVar2; - float blackHeartMask; - uint32_t uVar3; - uint32_t angleRoll; - Entity *bloodSplat; - int minRedHearts; - int extraout_EDX; - int iVar4; - uint32_t uVar5; - float local_18; - Entity *local_14; - Vector clotVelocity; - Game *game; - Manager *manager; - - iVar2 = GetHealthType(this); - game = g_game; - if (0 < this->_goldenHearts) { - iVar2 = this->_goldenHearts + -1; - this->_goldenHearts = iVar2; - if (((*GHIDRA_CAST(&game->_deathmatchManager) < 2) && (this->_dead == 0)) && (0 < iVar2)) { - iVar4 = this->_redHearts; - if (this->_maxHearts < this->_redHearts) { - iVar4 = this->_maxHearts; - } - iVar4 = (iVar4 + 1) / 2 + (this->_soulHearts + 1) / 2 + this->_boneHearts; - if (iVar4 < iVar2) { - BreakGoldenHearts(this,iVar2 - iVar4); - this->_goldenHearts = iVar4; - } - } - uVar5 = 4; - goto LAB_007daaa6; - } - if (0 < this->_eternalHearts) { - this->_eternalHearts = this->_eternalHearts + -1; - UpdateHeartDependentEffects(this); - uVar5 = 3; - goto LAB_007daaa6; - } - iVar4 = this->_redHearts; - if ((iVar4 < 1) || (this->_boneHearts + this->_soulHearts < 1)) { - if (unk == 0) { - minRedHearts = (iVar2 == 3) + 1; - } - else { - minRedHearts = 0; - } - if (iVar4 - this->_rottenHearts <= minRedHearts) { - iVar2 = this->_boneHearts; - uVar5 = this->_soulHearts; - if (GHIDRA_INT((iVar2 + uVar5)) <= GHIDRA_INT((unk ^ 1))) { - return; - } - if ((0 < iVar2) && - (isBoneHeart = IsBoneHeart(this,(GHIDRA_INT((uVar5 + 1)) >> 1) + iVar2 + -1), isBoneHeart != 0)) { - AddBoneHearts(this,-1); - uVar5 = 5; - goto LAB_007daaa6; - } - iVar2 = GetHealthType(this); - if ((iVar2 == 2) && (unk != 0)) { - this->_soulHearts = 0; - } - else { - if (0 < GHIDRA_INT(uVar5)) { - uVar3 = uVar5 & 0x80000001; - if (GHIDRA_INT(uVar3) < 0) { - uVar3 = (uVar3 - 1 | 0xfffffffe) + 1; - } - if (uVar3 != 1) goto LAB_007daa01; - blackHeartMask = (float)this->_blackHearts; - if ((GHIDRA_UINT(blackHeartMask) & 1 << ((uint8_t)(GHIDRA_INT((uVar5 - 1)) / 2) & 0x1f)) == 0) - goto LAB_007daa0d; -LAB_007daa69: - this->_blackHearts = GHIDRA_UINT(blackHeartMask) & ~(1 << (uVar5 >> 1 & 0x1f)); - ClampGoldenHearts(this,0); - update_bone_hearts(this); -LAB_007daa84: - AddSoulHearts(this,-1,0); - uVar5 = 2; - goto LAB_007daaa6; - } -LAB_007daa01: - if (0 < GHIDRA_INT(uVar5)) { -LAB_007daa0d: - uVar3 = uVar5 - 1; - if ((GHIDRA_INT(uVar3) <= GHIDRA_INT(uVar5)) && (0 < GHIDRA_INT(uVar3))) { - uVar3 = uVar3 & 0x80000001; - if (GHIDRA_INT(uVar3) < 0) { - uVar3 = (uVar3 - 1 | 0xfffffffe) + 1; - } - if (uVar3 == 1) { - blackHeartMask = (float)this->_blackHearts; - local_18 = blackHeartMask; - if ((GHIDRA_UINT(blackHeartMask) & 1 << ((uint8_t)(GHIDRA_INT((uVar5 - 2)) / 2) & 0x1f)) != 0) { - uVar3 = uVar5 & 0x80000001; - if (GHIDRA_INT(uVar3) < 0) { - uVar3 = (uVar3 - 1 | 0xfffffffe) + 1; - } - if ((uVar3 == 1) && (-1 < GHIDRA_INT(uVar5))) goto LAB_007daa69; - goto LAB_007daa84; - } - } - } - } - AddSoulHearts(this,-1,0); - } - uVar5 = 1; - goto LAB_007daaa6; - } - } - if (this->_rottenHearts < 1) { - uVar5 = 0; - iVar4 = 2; - if (iVar2 != 3) { - iVar4 = 1; - } - iVar2 = scale_for_hard_difficulty(iVar4); - this->_redHearts = extraout_EDX - iVar2; - UpdateHeartDependentEffects(this); - } - else { - this->_rottenHearts = this->_rottenHearts + -1; - iVar2 = 0x10; - uVar5 = 6; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - iVar2 = 2; - } - this->_redHearts = iVar4 - iVar2; - UpdateHeartDependentEffects(this); - } -LAB_007daaa6: - uVar3 = Random(); - angleRoll = Random(); - local_18 = (float)((double)GHIDRA_INT(angleRoll) + __uint_to_double_fixup[-(GHIDRA_INT(angleRoll) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_18 = local_18 + local_18; - local_14 = GHIDRA_CAST(cos(local_18)); - clotVelocity.y = sin(local_18); - clotVelocity.x = (float)local_14 + (float)local_14; - clotVelocity.y = clotVelocity.y + clotVelocity.y; - local_14 = Game::SpawnEx(g_game,3,0xee,pos,&clotVelocity,GHIDRA_CAST(this),uVar5,uVar3,0); - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&local_14->_flags) + 4)); - iVar2 = *GHIDRA_CAST(local_14); - *GHIDRA_CAST(&local_14->_flags) = GHIDRA_UINT(local_14->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&local_14->_flags) + 4)) = uVar1; - (**(code **)(iVar2 + 0xc))(); - manager = g_manager; - local_18 = 1.00893e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_18)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18),1.0,2,0,1.0,0.0); - uVar5 = Random(); - bloodSplat = Game::SpawnEx(g_game,1000,2,pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar5,0); - bloodSplat->SetColor(&local_14->_splatColor,0xffffffff,0xff,0,1); - iVar2 = *GHIDRA_CAST(bloodSplat); - (bloodSplat->_sprite)._offset.x = 0.0; - (bloodSplat->_sprite)._offset.y = -6.0; - bloodSplat->_renderDepthOffset = 10.0; - (**(code **)(iVar2 + 0xc))(); - if (unk != 0) { - try_trigger_astral_projection(this); - } - return; -} - -// 007dac80 -uint8_t Entity_Player::TryForgottenThrow(Vector *dir) -{ - float *extraout_EAX; - Vector throwVelocity; - Vector throwDir; - Vector inheritedVelocity; - Entity_Player *soul; - - if ((((this->_playerType == 0x23) && - (soul = GHIDRA_CAST(this->_twinPlayer), soul != GHIDRA_CAST(0x0))) && - (soul->_heldEntity == this)) && (this->_peeBurstCooldown < 1)) { - (GHIDRA_CAST((dir)))->Vector::Normalized(&throwDir); - throwVelocity.x = throwDir.x * 10.0; - throwVelocity.y = throwDir.y * 10.0; - GetTearMovementInheritance(soul,&inheritedVelocity,&throwDir,0); - throwVelocity.x = (throwVelocity.x + *extraout_EAX) * 1.2; - throwVelocity.y = (extraout_EAX[1] + throwVelocity.y) * 1.2; - ThrowHeldEntity(soul,&throwVelocity); - ANM2::Reset(&soul->_heldSprite); - soul->_blinkTime = 1; - soul->_itemStateCooldown = 5; - PlayExtraAnimation(soul,GHIDRA_CAST("HideItem")); - return 1; - } - return 0; -} - -// 007daed0 -void Entity_Player::ResetPlayer() -{ - void *oldBegin; - std_vector *greedResetCollectibles; - uint32_t uVar2; - int emptyCollectibles [4]; - void *oldBegin; - - if ((this->_variant == 0) && (this->_isCoopGhost == 0)) { - InitPostLevelInitStats(this); - uVar2 = 0; - if (GHIDRA_INT((this->_greedResetCollectibles)._end) - GHIDRA_INT((this->_greedResetCollectibles)._begin) >> 2 - != 0) { - do { - AddCollectible(this,*GHIDRA_CAST((GHIDRA_INT((this->_greedResetCollectibles)._begin) + uVar2 * 4)),0,0,0, - 0,0); - uVar2 = uVar2 + 1; - } while (uVar2 < GHIDRA_UINT((GHIDRA_INT((this->_greedResetCollectibles)._end) - - GHIDRA_INT((this->_greedResetCollectibles)._begin) >> 2))); - } - EvaluateItems(this); - RecomputeWispCollectibles(this,GHIDRA_CAST(0x0)); - } - greedResetCollectibles = &this->_greedResetCollectibles; - if (GHIDRA_CAST(emptyCollectibles) != greedResetCollectibles) { - oldBegin = greedResetCollectibles->_begin; - oldBegin = (this->_greedResetCollectibles)._capacity; - greedResetCollectibles->_begin = (void *)0x0; - (this->_greedResetCollectibles)._end = (void *)0x0; - (this->_greedResetCollectibles)._capacity = (void *)0x0; - if (oldBegin != (void *)0x0) { - uVar2 = GHIDRA_INT(oldBegin) - GHIDRA_INT(oldBegin) & 0xfffffffc; - oldBegin = oldBegin; - if (0xfff < uVar2) { - oldBegin = *(void **)(GHIDRA_CAST(oldBegin) + -4); - uVar2 = uVar2 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(oldBegin) + (-4 - GHIDRA_INT(oldBegin))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(oldBegin,uVar2); - } - } - return; -} - -// 007db160 -void Entity_Player::remove_wooden_cross_mantles() -{ - int iVar1; - int *effect; - uint8_t mantleStacks; - uint32_t keptCrossStacks; - uint32_t crossStacksLeft; - int removedEffect [3]; - uint32_t local_c; - int stacksToRemove; - void *collectibles; - uint8_t crossStacks; - int *effectsEnd; - int mantleConfig; - - iVar1 = GetTrinketMultiplier(this,0x79); - if (iVar1 == 0) { - iVar1 = 0; - } - else if (iVar1 == 1) { - iVar1 = 1; - } - else { - iVar1 = 2; - } - mantleStacks = this->_holyMantleStacks; - keptCrossStacks = iVar1 - (mantleStacks & 0xf); - if (GHIDRA_INT(keptCrossStacks) < 0) { - keptCrossStacks = 0; - } - crossStacks = mantleStacks >> 4; - crossStacksLeft = GHIDRA_UINT(crossStacks); - if (keptCrossStacks < crossStacksLeft) { - stacksToRemove = crossStacksLeft - keptCrossStacks; - do { - iVar1 = stacksToRemove; - crossStacksLeft = crossStacksLeft - 1; - crossStacks = (uint8_t)crossStacksLeft; - collectibles = (g_manager->_itemConfig)._collectibles._begin; - if ((0x4e4 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectibles) & - 0xfffffffcU))) && - (mantleConfig = *GHIDRA_CAST((GHIDRA_CAST(collectibles) + 0x4e4)), mantleConfig != 0)) { - removedEffect[2] = *GHIDRA_CAST((mantleConfig + 0x78)); - removedEffect[1] = 0; - local_c = 0; - removedEffect[0] = mantleConfig; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::RemoveEffect(removedEffect,1); - } - if ((this->_temporaryeffects)._disabled == 0) { - effect = (this->_temporaryeffects)._effects._begin; - effectsEnd = (this->_temporaryeffects)._effects._end; - if (effect != effectsEnd) { - do { - iVar1 = *GHIDRA_CAST(*effect); - if ((((iVar1 == 1) || (iVar1 == 3)) || (iVar1 == 4)) && ((GHIDRA_CAST(*effect))[1] == 0x139)) - { - if (0 < effect[1]) goto LAB_007db29a; - break; - } - effect = effect + 4; - } while (effect != effectsEnd); - iVar1 = stacksToRemove; - } - } - collectibles = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectibles) & 0xfffffffcU)) - < 0x4e5) { - RemoveCostume(this,GHIDRA_CAST(0x0)); - stacksToRemove = iVar1; - } - else { - RemoveCostume(this,*GHIDRA_CAST((GHIDRA_CAST(collectibles) + 0x4e4))); - stacksToRemove = iVar1; - } -LAB_007db29a: - stacksToRemove = stacksToRemove + -1; - } while (stacksToRemove != 0); - mantleStacks = this->_holyMantleStacks; - } - this->_holyMantleStacks = mantleStacks & 0xf | crossStacks << 4; - return; -} - -// 007db6b0 -uint8_t Entity_Player::HasInstantDeathCurse() -{ - int *effect; - - if ((this->_temporaryeffects)._disabled == 0) { - for (effect = (this->_temporaryeffects)._effects._begin; - effect != (this->_temporaryeffects)._effects._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 0) && ((GHIDRA_CAST(*effect))[1] == 0x70)) { - return 1; - } - } - } - if (this->_playerType == 0x27) { - return 1; - } - return 0; -} - -// 007db700 -uint8_t Entity_Player::IsHologram() -{ - Entity_Player *twin; - - if (((this->_exists == 0) || - (((this->_playerType != 0x1d && (this->_playerType != 0x26)) || - (twin = GHIDRA_CAST(this->_twinPlayer), twin == GHIDRA_CAST(0x0))))) || - (((twin->_playerIndex == -1 || (this->_playerIndex <= twin->_playerIndex)) || (twin == this)))) - { - return 0; - } - return 1; -} - -// 007db740 -void Entity_Player::TriggerEchoChamber(uint32_t pocketItemType, int cardOrPillColor) -{ - uint32_t pillColor; - uint8_t isEchoChamberHeld; - int iVar1; - uint32_t uVar2; - Vector local_10; - uint32_t *entry; - - isEchoChamberHeld = HasCollectible(this,700,0); - if (isEchoChamberHeld != 0) { - local_10.x = (float)(this->_echoChamberItems)._proxy; - uVar2 = (this->_echoChamberItems)._offset; - while (uVar2 != (this->_echoChamberItems)._size + (this->_echoChamberItems)._offset) { - if (GHIDRA_CAST(local_10.x) == GHIDRA_CAST(0x0)) { - iVar1 = 0; - } - else { - iVar1 = *GHIDRA_CAST(local_10.x); - } - entry = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 4)) + (uVar2 >> 1 & *GHIDRA_CAST((iVar1 + 8)) - 1U) * 4)) + - (uVar2 & 1) * 8)); - if (entry[1] == 1) { - UseCard(this,*entry,0x980); - uVar2 = uVar2 + 1; - } - else { - if (entry[1] == 0) { - pillColor = *entry; - iVar1 = ItemPool::GetPillEffect(&g_game->_itemPool,pillColor,this); - UsePill(this,iVar1,pillColor,0x980); - } - uVar2 = uVar2 + 1; - } - } - local_10.y = (float)pocketItemType; - local_10.x = (float)cardOrPillColor; - if ((pocketItemType == 1) || (pocketItemType == 0)) { - (GHIDRA_CAST((&this->_echoChamberItems)))->msvc::deque::push_back(&local_10); - uVar2 = (this->_echoChamberItems)._size; - if (3 < uVar2) { - while( true ) { - uVar2 = uVar2 - 1; - (this->_echoChamberItems)._size = uVar2; - if (uVar2 == 0) break; - if (uVar2 < 4) { - return; - } - } - (this->_echoChamberItems)._offset = 0; - } - } - } - return; -} - -// 007db8d0 -int Entity_Player::get_seeded_variant() -{ - code *pcVar1; - int unlockState; - int gameStartSeed; - uint32_t uVar2; - Game *game; - - unlockState = is_achievement_79_unlocked(this); - game = g_game; - switch(unlockState) { - case 0: - case 1: - return -1; - case 2: - return 0; - case 3: - return 1; - case 4: - return 2; - case 5: - return 3; - case 6: - return 4; - case 7: - return 5; - } - gameStartSeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_seedEffects))) + 0x4)))); - if (gameStartSeed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Error: Game Start Seed was not set.\n")); - gameStartSeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((game->_seedEffects))) + 0x4)))); - } - uVar2 = 1; - if (1 < GHIDRA_UINT((gameStartSeed + unlockState))) { - uVar2 = gameStartSeed + unlockState; - } - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - unlockState = (*pcVar1)(); - return unlockState; - } - uVar2 = uVar2 >> 2 ^ uVar2; - uVar2 = uVar2 << 0xf ^ uVar2; - return ((uVar2 >> 0x11 ^ uVar2) & 3) + 2; -} - -// 007dba30 -uint8_t Entity_Player::is_evil_charm_immune(EntityRef source) -{ - uint8_t isHasEvilCharm; - bool isHazardSource; - - isHazardSource = false; - isHasEvilCharm = HasCollectible(this,0x278,0); - if ((isHasEvilCharm == 0) && - (isHasEvilCharm = (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x278), - isHasEvilCharm == 0)) { - return 0; - } - if (source._type < 0x22) { - if (source._type == 0x21) { - return 1; - } - if (source._type == 0) { - isHazardSource = source._variant == 10000; - } - else if ((source._type == 9) && (source._variant == 2)) { -switchD_007dbabc_caseD_16: - isHazardSource = true; - } - } - else if (source._type == 1000) { - switch(source._variant) { - case 0x16: - case 0x17: - case 0x18: - case 0x19: - case 0x1a: - case 0x20: - case 0x25: - case 0x2c: - case 0x2d: - case 0x2e: - case 0x35: - case 0x36: - case 0x38: - case 0x4e: - case 0x5a: - case 0x5e: - case 0x8d: - case 0x93: - case 0x9b: - case 0xa9: - case 0xcc: - goto switchD_007dbabc_caseD_16; - default: - break; - } - } - if (((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d4))) != '\0') || (isHazardSource)) { - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d4))) = 1; - if ((isHazardSource) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d0)))) < 0x1e)) { - return 1; - } - } - else { - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x26d4))) = 0; - } - return 0; -} - -// 007dbba0 -void Entity_Player::add_random_drug_item_effect() -{ - code *pcVar1; - uint32_t seed; - uint32_t *brokenSyringeSeed; - int drugItems [4]; - ItemConfig_Item *local_18; - uint32_t uStack_14; - int iStack_10; - uint32_t uStack_c; - uint32_t local_8; - int collectibleId; - Manager *manager; - void *trinketRngs; - - local_8 = __security_cookie ^ GHIDRA_UINT((drugItems + 9)); - drugItems[0] = 0xd; - drugItems[1] = 0xe; - drugItems[2] = 0xf0; - drugItems[3] = 0x46; - trinketRngs = (this->_trinketRNGs)._begin; - brokenSyringeSeed = GHIDRA_CAST((GHIDRA_INT(trinketRngs) + 0x840)); - local_18 = GHIDRA_CAST(0x8f); - uStack_14 = 0x159; - iStack_10 = 0x1ed; - uStack_c = 0x1f0; - seed = *brokenSyringeSeed; - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - seed = *brokenSyringeSeed; - if (seed == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - manager = g_manager; - seed = seed >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(trinketRngs) + 0x844)) & 0x1f) ^ seed; - seed = seed << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(trinketRngs) + 0x848)) & 0x1f) ^ seed; - seed = seed >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(trinketRngs) + 0x84c)) & 0x1f) ^ seed; - *brokenSyringeSeed = seed; - collectibleId = drugItems[seed & 7]; - local_18 = ItemConfig::GetCollectible(&manager->_itemConfig,collectibleId); - iStack_10 = local_18->maxCooldown; - uStack_14 = 0; - uStack_c = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&local_18,1,1); - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2edc)))) = collectibleId; - } - return; -} - -// 007dbc80 -void Entity_Player::AddRandomMomItemEffect() -{ - code *pcVar1; - uint32_t rngState; - uint32_t *rngSeed; - ItemConfig_Item *effectItem; - uint32_t local_48; - int effectCooldown; - uint32_t local_40; - int momItems [13]; - int momItemId; - void *playerRngs; - - momItems[0xc] = 0x2dc; - momItems[0] = 0x1d; - momItems[1] = 0x1e; - momItems[2] = 0x1f; - momItems[3] = 0x37; - playerRngs = (this->_trinketRNGs)._begin; - rngSeed = GHIDRA_CAST((GHIDRA_INT(playerRngs) + 0x990)); - momItems[4] = 0x6e; - momItems[5] = 0x72; - momItems[6] = 199; - momItems[7] = 200; - rngState = *rngSeed; - momItems[8] = 0xd9; - momItems[9] = 0xe4; - momItems[10] = 0x163; - momItems[0xb] = 0x1fc; - if (rngState == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - rngState = *rngSeed; - if (rngState == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - rngState = rngState >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(playerRngs) + 0x994)) & 0x1f) ^ rngState; - rngState = rngState << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(playerRngs) + 0x998)) & 0x1f) ^ rngState; - rngState = rngState >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(playerRngs) + 0x99c)) & 0x1f) ^ rngState; - *rngSeed = rngState; - momItemId = momItems[rngState % 0xd]; - effectItem = ItemConfig::GetCollectible(&g_manager->_itemConfig,momItemId); - effectCooldown = effectItem->maxCooldown; - local_48 = 0; - local_40 = 0; - (GHIDRA_CAST((&this->_temporaryeffects)))->TemporaryEffects::AddEffect(&effectItem,1,1); - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2ee0)))) = momItemId; - } - return; -} - -// 007dbd70 -void Entity_Player::ModelingClay_roll(RNG *rng) -{ - void *pvVar1; - code *pcVar2; - uint32_t seed; - int collectibleId; - ItemConfig_Item *collectibleConfig; - code *filterFn; - uint32_t *filterSlot; - void **filtersEnd; - Manager *manager; - - manager = g_manager; - filterFn = FUN_007dbe70; - filterSlot = (g_manager->_itemConfig)._availabilityFilters._end; - if (filterSlot == (g_manager->_itemConfig)._availabilityFilters._capacity) { - msvc::vector<4byte>::_Emplace_reallocate(filterSlot,&filterFn); - } - else { - *filterSlot = FUN_007dbe70; - filtersEnd = &(manager->_itemConfig)._availabilityFilters._end; - *filtersEnd = (void *)(GHIDRA_INT(*filtersEnd) + 4); - } - seed = rng->_seed; - pvVar1 = g_game->_room; - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - seed = rng->_seed; - if (seed == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - seed = seed >> ((uint8_t)rng->_shift1 & 0x1f) ^ seed; - seed = seed << ((uint8_t)rng->_shift2 & 0x1f) ^ seed; - seed = seed >> ((uint8_t)rng->_shift3 & 0x1f) ^ seed; - rng->_seed = seed; - collectibleId = ItemPool::GetSeededCollectible(seed,1,*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4))); - manager = g_manager; - this->_modelingClayEffect = collectibleId; - filtersEnd = &(manager->_itemConfig)._availabilityFilters._end; - *filtersEnd = (void *)(GHIDRA_INT(*filtersEnd) + -4); - collectibleConfig = ItemConfig::GetCollectible(&manager->_itemConfig,this->_modelingClayEffect); - if (collectibleConfig != GHIDRA_CAST(0x0)) { - this->_cacheFlags = this->_cacheFlags | collectibleConfig->cacheFlags; - (this->_temporaryeffects)._shouldEvaluateCache = 1; - if (collectibleConfig->addCostumeOnPickup != 0) { - AddCostume(this,collectibleConfig,0); - } - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - } - return; -} - -// 007dbeb0 -void Entity_Player::twins_duplicate_familiars(int count) -{ - void *pvVar1; - code *pcVar2; - ItemConfig_Item *collectibleConfig; - ItemConfig *itemConfig; - int *piVar3; - uint32_t *puVar4; - uint32_t uVar5; - uint32_t *itemsBegin; - uint32_t *itemsEnd; - int iVar6; - uint32_t uVar7; - int effectEntry [3]; - uint32_t local_38; - uint32_t *familiarItems; - uint32_t *familiarItemsEnd; - uint32_t *familiarItemsCapEnd; - TemporaryEffects *temporaryEffects; - uint32_t local_24; - uint32_t local_20; - Entity_Player *player; - uint32_t *itemsCapEnd; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Game *game; - Entity_Player *playerReg; - int roomEntity; - - puStack_c = &LAB_00b0059d; - local_10 = ExceptionList; - if (count < 1) { - return; - } - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1264)); - if (iVar6 != 0) { - piVar3 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x125c)); - uVar7 = 0; - do { - roomEntity = *piVar3; - piVar3 = piVar3 + 1; - uVar5 = uVar7 + 1; - if (*GHIDRA_CAST((roomEntity + 0x28)) != 3) { - uVar5 = uVar7; - } - iVar6 = iVar6 + -1; - uVar7 = uVar5; - } while (iVar6 != 0); - if (0x3b < uVar5) { - return; - } - } - puVar4 = GHIDRA_CAST(0x0); - itemsEnd = GHIDRA_CAST(0x0); - familiarItems = GHIDRA_CAST(0x0); - familiarItemsEnd = GHIDRA_CAST(0x0); - itemsCapEnd = GHIDRA_CAST(0x0); - familiarItemsCapEnd = GHIDRA_CAST(0x0); - local_8 = 0; - uVar7 = 1; - itemConfig = &g_manager->_itemConfig; - ExceptionList = &local_10; - player = this; - if (4 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((itemConfig->_collectibles)._begin) & 0xfffffffcU))) { - do { - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar7)) goto LAB_007dbf93; - } - else { - if (GHIDRA_INT(uVar7) < 0) { - if ((GHIDRA_INT(uVar7) < 0) && - (pvVar1 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar7) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar1) >> 2)) { - piVar3 = GHIDRA_CAST(**GHIDRA_CAST((GHIDRA_CAST(pvVar1) + ~uVar7 * 4))); - } - else { - piVar3 = GHIDRA_CAST(0x0); - } - } - else { -LAB_007dbf93: - pvVar1 = (itemConfig->_collectibles)._begin; - if (GHIDRA_INT((itemConfig->_collectibles)._end) - GHIDRA_INT(pvVar1) >> 2 <= GHIDRA_INT(uVar7)) - goto LAB_007dc03e; - piVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 4)); - } - if (piVar3 != GHIDRA_CAST(0x0)) { - if ((piVar3[0x2e] & 0x8000000U) == 0) { - if (*piVar3 == 4) { - iVar6 = GetCollectibleNum(player,uVar7,0); - if (((((iVar6 < 1) || (uVar7 == 0)) || - (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((g_manager->_itemConfig)._collectibles._begin) >> 2 <= GHIDRA_INT(uVar7))) || - ((uVar7 == 0xeb || (uVar7 == 0x2b)))) || (uVar7 == 0x3d)) { - puVar4 = itemsCapEnd; - } - else { - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,uVar7); - puVar4 = itemsCapEnd; - if (collectibleConfig != GHIDRA_CAST(0x0)) { - local_20 = uVar7; - if (itemsEnd == itemsCapEnd) { - msvc::vector::_Emplace_reallocate(itemsEnd,&local_20); - itemsCapEnd = familiarItemsCapEnd; - puVar4 = familiarItemsCapEnd; - itemsEnd = familiarItemsEnd; - } - else { - *itemsEnd = uVar7; - familiarItemsEnd = itemsEnd + 1; - itemsEnd = familiarItemsEnd; - } - } - } - } - } - } - } -LAB_007dc03e: - uVar7 = uVar7 + 1; - itemConfig = &g_manager->_itemConfig; - } while (GHIDRA_INT(uVar7) < - GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - - GHIDRA_INT((itemConfig->_collectibles)._begin) >> 2); - } - temporaryEffects = &player->_temporaryeffects; - itemsBegin = familiarItems; - do { - playerReg = player; - if (itemsBegin == itemsEnd) { - local_20 = 8; - if (itemsEnd == puVar4) { - msvc::vector::_Emplace_reallocate(itemsEnd,&local_20); - itemsCapEnd = familiarItemsCapEnd; - puVar4 = familiarItemsCapEnd; - itemsBegin = familiarItems; - } - else { - *itemsEnd = 8; - familiarItemsEnd = itemsEnd + 1; - } - local_20 = 0x43; - if (familiarItemsEnd == puVar4) { - msvc::vector::_Emplace_reallocate(familiarItemsEnd,&local_20); - itemsCapEnd = familiarItemsCapEnd; - itemsBegin = familiarItems; - itemsEnd = familiarItemsEnd; - } - else { - *familiarItemsEnd = 0x43; - familiarItemsEnd = familiarItemsEnd + 1; - itemsEnd = familiarItemsEnd; - } - } - pvVar1 = (playerReg->_trinketRNGs)._begin; - puVar4 = GHIDRA_CAST((GHIDRA_INT(pvVar1) + 0xb70)); - local_20 = GHIDRA_INT(itemsEnd) - GHIDRA_INT(itemsBegin) >> 2; - uVar7 = *puVar4; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *puVar4; - if (uVar7 == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xb74)) & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xb78)) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xb7c)) & 0x1f) ^ uVar7; - *puVar4 = uVar7; - if (local_20 != 0) { - local_20 = uVar7 % local_20; - } - pvVar1 = (player->_trinketRNGs)._begin; - puVar4 = GHIDRA_CAST((GHIDRA_INT(pvVar1) + 0xb70)); - local_24 = GHIDRA_INT(itemsEnd) - GHIDRA_INT(itemsBegin) >> 2; - uVar7 = *puVar4; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar7 = *puVar4; - if (uVar7 == 0) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xb74)) & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xb78)) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xb7c)) & 0x1f) ^ uVar7; - uVar5 = 0; - *puVar4 = uVar7; - if (local_24 != 0) { - uVar5 = uVar7 % local_24; - } - uVar7 = itemsBegin[uVar5]; - local_24 = uVar7; - if (g_game == GHIDRA_CAST(0x0)) { - if (-1 < GHIDRA_INT(uVar7)) goto LAB_007dc1df; - } - else { - if (GHIDRA_INT(uVar7) < 0) { - if ((GHIDRA_INT(uVar7) < 0) && - (pvVar1 = (g_game->_proceduralItemManager)._proceduralItems._begin, - GHIDRA_INT(~uVar7) < - GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar1) >> 2)) { - iVar6 = **GHIDRA_CAST((GHIDRA_CAST(pvVar1) + ~uVar7 * 4)); - } - else { - iVar6 = 0; - } - } - else { -LAB_007dc1df: - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) >> 2 <= GHIDRA_INT(uVar7)) - goto LAB_007dc222; - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + uVar7 * 4)); - } - if (iVar6 != 0) { - effectEntry[2] = *GHIDRA_CAST((iVar6 + 0x78)); - effectEntry[1] = 0; - local_38 = 0; - effectEntry[0] = iVar6; - (GHIDRA_CAST((temporaryEffects)))->TemporaryEffects::AddEffect(effectEntry,1,1); - } - } -LAB_007dc222: - itemsEnd = itemsEnd + -1; - uVar5 = itemsBegin[local_20]; - itemsBegin[local_20] = *itemsEnd; - game = g_game; - *itemsEnd = uVar5; - familiarItemsEnd = itemsEnd; - if (1 < *GHIDRA_CAST(&game->_deathmatchManager)) { - puVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ee8)))); - if (puVar4 == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2eec))))) { - msvc::vector::_Emplace_reallocate(puVar4,&local_24); - } - else { - *puVar4 = uVar7; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ee8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ee8)))) + 4; - } - } - count = count + -1; - if (count == 0) { - if (itemsBegin != GHIDRA_CAST(0x0)) { - uVar7 = GHIDRA_INT(itemsCapEnd) - GHIDRA_INT(itemsBegin) & 0xfffffffc; - puVar4 = itemsBegin; - if (0xfff < uVar7) { - puVar4 = GHIDRA_CAST(itemsBegin[-1]); - uVar7 = uVar7 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(itemsBegin) + (-4 - GHIDRA_INT(puVar4))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(puVar4,uVar7); - } - ExceptionList = local_10; - return; - } - puVar4 = itemsCapEnd; - } while( true ); -} - -// 007e9280 -std_string * Entity_Player::GetName() -{ - std_string *nameBuf; - - nameBuf = &this->_name; - if (0xf < (this->_name)._capacity) { - nameBuf = *GHIDRA_CAST(nameBuf->_buf); - } - return nameBuf; -} - -// 007e92a0 -long double Entity_Player::GetSmoothBodyRotation() -{ - return (long double)this->_bodyAngle; -} - -// 00832850 -void Entity_Player::TriggerRoomExit() -{ - void *pvVar1; - void *pvVar2; - uint32_t uVar3; - int iVar4; - int iVar5; - LayerState *layerState; - int iVar6; - void *pvVar7; - AnimationState *lastAnimState; - KColor *color; - KColor *color_00; - KColor *color_01; - int *transitionTarget; - float fVar8; - float fVar9; - AnimationLayer *local_168; - Vector local_164; - Vector local_15c; - void *layerFrame; - Vector local_150; - int layerOffset; - float local_144; - KColor local_140; - uint32_t local_120; - int local_11c; - uint32_t local_118; - uint32_t local_114; - uint32_t local_110; - float local_10c; - uint32_t local_108; - KColor whiteColor; - uint8_t quadPrimary [104]; - uint8_t auStack_88 [8]; - uint8_t quadSecondary [124]; - AnimationLayer *layerId; - - iVar6 = *GHIDRA_CAST(this); - if ((iVar6 != 2) && (iVar6 != 3)) { - return; - } - if ((this->_bossStatusEffectCooldown != 0) && (iVar6 == 2)) { - local_15c.x = g_screenWidth * 0.5; - local_11c = *GHIDRA_CAST(((this->_sprite)._animDefaultName._buf + 0xc)); - local_15c.y = g_screenHeight * 0.5; - if (local_11c == 0) { - return; - } - local_120 = 0; - if (*GHIDRA_CAST((local_11c + 0x1c)) == 0) { - return; - } - layerOffset = 0; - do { - layerId = *GHIDRA_CAST((layerOffset + *GHIDRA_CAST((local_11c + 0x18)))); - layerFrame = AnimationState::GetLayerFrame - (GHIDRA_CAST(((this->_sprite)._animDefaultName._buf + 8)), - GHIDRA_INT(layerId)); - layerState = ANM2::GetLayer(GHIDRA_CAST(&this->_spawnerVariant),GHIDRA_CAST(layerId)); - if (((layerState->_visible != 0) && (layerFrame != (void *)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x2c)) != '\0')) { - local_168 = GHIDRA_CAST((*GHIDRA_CAST((local_11c + 0x18)) + layerOffset)); - if ((((GHIDRA_INT(layerId) < 0) || - (*GHIDRA_CAST((*GHIDRA_CAST(((this->_sprite)._animDefaultName._buf + 8)) + 0x80)) <= GHIDRA_INT(layerId))) - && (KAGE_LogMessage(0x10,GHIDRA_CAST("LayerId out of bounds\n")), GHIDRA_INT(layerId) < 0)) || - (*GHIDRA_CAST((*GHIDRA_CAST(((this->_sprite)._animDefaultName._buf + 8)) + 0x80)) <= GHIDRA_INT(layerId))) { - iVar6 = 0; - } - else { - iVar6 = *GHIDRA_CAST(((this->_sprite)._animDefaultName._size + - *GHIDRA_CAST((*GHIDRA_CAST(((this->_sprite)._animDefaultName._buf + 0xc)) + 0x38 + - GHIDRA_INT(layerId) * 4)) * 4)); - } - AnimationLayer::RenderFrame - (local_168,&local_15c,iVar6,&g_vectorZero,&g_vectorZero, - GHIDRA_CAST(&this->_spawnerVariant)); - local_168 = layerId; - _Find_lower_bound<>(&local_140,&local_168); - if (((*GHIDRA_CAST((GHIDRA_CAST(local_140._blue) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(local_140._blue) + 0x10)) <= layerId)) && - ((local_140._blue != (float)this->_charmedCountdown && - (local_168 = layerId, iVar6 = FUN_00833010(&local_168), *GHIDRA_CAST((iVar6 + 0x109)) != '\0' - )))) { - local_150.x = -*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x20)) * *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x18)); - local_164.x = -*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x24)) * *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x1c)); - local_144 = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x5c)) * 0.017453292; - local_168 = GHIDRA_CAST(cos(local_144)); - fVar8 = sin(local_144); - local_144 = (float)local_168 * local_150.x - fVar8 * local_164.x; - local_168 = GHIDRA_CAST(((float)local_168 * local_164.x + fVar8 * local_150.x)); - local_164.x = (float)layerId; - local_150.x = (float)(GHIDRA_INT(layerFrame) + 0x30); - iVar6 = FUN_00833010(&local_164); - if (GHIDRA_CAST((iVar6 + 0xa8)) != GHIDRA_CAST(local_150.x)) { - pvVar7 = *(void **)(GHIDRA_CAST(local_150.x) + 4); - pvVar1 = *(void **)(GHIDRA_CAST(local_150.x) + 8); - pvVar2 = *(void **)(GHIDRA_CAST(local_150.x) + 0xc); - (GHIDRA_CAST((iVar6 + 0xa8)))->_animation = *(void **)local_150.x; - *(void **)(iVar6 + 0xac) = pvVar7; - *(void **)(iVar6 + 0xb0) = pvVar1; - *(void **)(iVar6 + 0xb4) = pvVar2; - uVar3 = *GHIDRA_CAST((GHIDRA_CAST(local_150.x) + 0x14)); - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(local_150.x) + 0x18)); - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_150.x) + 0x1c)); - *GHIDRA_CAST((iVar6 + 0xb8)) = *GHIDRA_CAST((GHIDRA_CAST(local_150.x) + 0x10)); - *GHIDRA_CAST((iVar6 + 0xbc)) = uVar3; - *GHIDRA_CAST((iVar6 + 0xc0)) = iVar4; - *GHIDRA_CAST((iVar6 + 0xc4)) = iVar5; - *GHIDRA_CAST((iVar6 + 200)) = *GHIDRA_CAST((GHIDRA_CAST(local_150.x) + 0x20)); - *(void **)(iVar6 + 0xd0) = (GHIDRA_CAST((GHIDRA_INT(local_150.x) + 0x20)))->_layerFrames; - } - local_164.x = (float)layerId; - iVar6 = FUN_00833010(&local_164); - *GHIDRA_CAST((iVar6 + 0xa4)) = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x5c)); - local_164.x = (float)layerId; - iVar6 = FUN_00833010(&local_164); - *GHIDRA_CAST((iVar6 + 0x9c)) = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x18)); - *GHIDRA_CAST((iVar6 + 0xa0)) = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x1c)); - local_164.x = (float)layerId; - iVar6 = FUN_00833010(&local_164); - fVar8 = (float)(this->_sprite)._numNullLayers; - fVar9 = *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x14)); - *GHIDRA_CAST((iVar6 + 0x94)) = - local_144 + (float)(this->_sprite)._nullLayerNames + - *GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0x10)); - *GHIDRA_CAST((iVar6 + 0x98)) = (float)local_168 + fVar8 + fVar9; - local_164.x = (float)layerId; - iVar6 = FUN_00833010(&local_164); - if (*GHIDRA_CAST((iVar6 + 0x109)) != '\0') { - local_150.x = (float)(iVar6 + 0x50); - if (*GHIDRA_CAST((iVar6 + 0x70)) == '\0') { - AnimationState::Render - (GHIDRA_CAST((iVar6 + 0x30)),&local_15c,&g_vectorZero,&g_vectorZero); - lastAnimState = GHIDRA_CAST(local_150.x); - } - else { - AnimationState::Render - (GHIDRA_CAST(local_150.x),&local_15c,&g_vectorZero,&g_vectorZero); - lastAnimState = GHIDRA_CAST((iVar6 + 0x30)); - } - AnimationState::Render(lastAnimState,&local_15c,&g_vectorZero,&g_vectorZero); - } - } - } - local_120 = local_120 + 1; - layerOffset = layerOffset + 0x10; - } while (local_120 < *GHIDRA_CAST((local_11c + 0x1c))); - return; - } - iVar6 = *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)); - if ((((((iVar6 != 1) && (iVar6 != 2)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10)))) != -1)) && - ((iVar6 != 0xb && (iVar6 != 0x10)))) && - ((iVar6 != 0x11 && ((iVar6 != 0x12 && (iVar6 != 0x14)))))) && (iVar6 != 0x13)) { - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); - fVar9 = 1.0; - local_15c.y = 0.0; - local_15c.x = 0.0; - local_164.y = 0.0; - local_164.x = 0.0; - fVar8 = (3.0 - (fVar8 + fVar8)) * fVar8 * fVar8; - switch(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10))))) { - case 0: - local_15c.x = (float)this->_midasFreezeCountdown + g_screenWidth; - local_164.x = (fVar8 - 1.0) * local_15c.x; - local_15c.x = local_15c.x * fVar8; - break; - case 1: - local_15c.y = (float)this->_fearCountdown + g_screenHeight; - local_164.y = (fVar8 - 1.0) * local_15c.y; - local_15c.y = local_15c.y * fVar8; - break; - case 2: - local_15c.x = (float)this->_midasFreezeCountdown + g_screenWidth; - local_164.x = (1.0 - fVar8) * local_15c.x; - local_15c.x = -fVar8 * local_15c.x; - break; - case 3: - local_15c.y = (float)this->_fearCountdown + g_screenHeight; - local_164.y = (1.0 - fVar8) * local_15c.y; - local_15c.y = -fVar8 * local_15c.y; - } - set_blend_mode(&DAT_00c798e0,1); - (GHIDRA_CAST((&whiteColor)))->KColor::SetFromARGB(0xffffffff); - local_150.x = g_screenWidth; - local_150.y = g_screenHeight; - render_quad_set_rect(quadPrimary,&local_15c,&local_150,color); - (GHIDRA_CAST((&whiteColor)))->KColor::SetFromARGB(0xffffffff); - local_15c.x = g_screenWidth; - local_15c.y = g_screenHeight; - render_quad_set_rect(quadSecondary,&local_164,&local_15c,color_00); - local_140._alpha = fVar9 - fVar8; - local_140._unk = 0; - local_140._red = 1.0; - local_140._green = 1.0; - local_140._blue = 1.0; - local_108 = 0; - local_118 = 0x3f800000; - local_114 = 0x3f800000; - local_110 = 0x3f800000; - local_10c = fVar8; - (**(code **)(*GHIDRA_CAST(this->_type) + 0x1c))(quadPrimary,&local_140); - (**(code **)(*GHIDRA_CAST(this->_subtype) + 0x1c))(auStack_88,&local_120); - return; - } - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[2] = 0; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 0; - (GHIDRA_CAST((&whiteColor)))->KColor::SetFromARGB(0xffffffff); - render_quad_set_uniform_color(quadPrimary,0.0,0.0,g_screenWidth,g_screenHeight,color_01); - if (*GHIDRA_CAST(this) == 2) { - transitionTarget = GHIDRA_CAST(this->_type); - } - else { - if (*GHIDRA_CAST(this) != 3) goto LAB_00832ee2; - transitionTarget = GHIDRA_CAST(this->_subtype); - } - (**(code **)(*transitionTarget + 0x1c))(quadPrimary,g_drawRectUnset); -LAB_00832ee2: - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - if (((uint8_t)g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - iVar6 = *GHIDRA_CAST((GHIDRA_INT(&this->_pendingDamageFlags) + 4)); - local_140._red = 0.0; - local_140._green = 0.0; - local_140._blue = 0.0; - if ((iVar6 == 3) || (iVar6 == 0x12)) { - local_140._red = 1.0; - local_140._green = 1.0; - local_140._blue = 1.0; - local_140._alpha = 1.0; - } - local_140._unk = 0; - local_140._alpha = (GHIDRA_CAST((GHIDRA_CAST(this))))->RoomTransition::get_hud_alpha(); - local_140._alpha = 1.0 - local_140._alpha; - pvVar7 = render_quad_set_uniform_color - (quadSecondary,0.0,0.0,g_screenWidth,g_screenHeight,&local_140); - render_color_shader_pass(pvVar7); - return; -} - -// 0083ab80 -int Entity_Player::GetModelingClayEffect() -{ - return this->_modelingClayEffect; -} - -// 00841ca0 -int Entity_Player::GetJarFlies() -{ - return this->_jarFlies; -} - -// 00841cb0 -int Entity_Player::GetActiveSubCharge(int slot) -{ - if (GHIDRA_UINT(slot) < 4) { - return this->_activeDesc[slot]._subCharge; - } - return 0; -} - -// 00841cd0 -int Entity_Player::GetPoopSpell(int position) -{ - if (GHIDRA_UINT(position) < 6) { - return GHIDRA_UINT(this->_poopSpellQueue[position]); - } - return 0; -} - -// 0085e200 -uint8_t Entity_Player::HasFullHeartsAndSoulHearts() -{ - return this->_maxHearts <= this->_soulHearts + this->_redHearts; -} - -// 0085e220 -Vector * Entity_Player::GetMovementVector() -{ - return &this->_movementVector; -} - -// 0085e230 -Vector * Entity_Player::GetRecentMovementVector() -{ - return &this->_recentMovementVector; -} - -// 0085e240 -int Entity_Player::GetTearRangeModifier() -{ - return this->_tearRangeModifier; -} - -// 0085e250 -int Entity_Player::ControlsCooldown() -{ - return this->_controlsCooldown; -} - -// 0085e260 -void Entity_Player::AddControlsCooldown(int param_2) -{ - this->_controlsCooldown = this->_controlsCooldown + param_2; - return; -} - -// 0085e270 -EntityRef * Entity_Player::GetLastDamageSource() -{ - return &this->_lastDamageSource; -} - -// 0085e280 -uint64_t Entity_Player::GetLastDamageFlags() -{ - return this->_lastDamageFlags; -} - -// 0085e290 -int Entity_Player::GetTotalDamageTaken() -{ - return this->_totalDamageTaken; -} - -// 0085e2c0 -int Entity_Player::GetLastActionTriggers() -{ - return this->_lastActionTriggers; -} - -// 0085e2d0 -int Entity_Player::GetBodyColor() -{ - return this->_bodyColor; -} - -// 0085e2e0 -int Entity_Player::GetHeadColor() -{ - return this->_headColor; -} - -// 0085e2f0 -int Entity_Player::GetNumGigaBombs() -{ - return this->_numGigaBombs; -} - -// 009d16ee -uint32_t Entity_Player::restore_save_state_part2() -{ - void *pvVar1; - int iVar2; - uint32_t uVar3; - uint32_t uVar4; - uint32_t uVar5; - char cVar6; - uint8_t bVar7; - uint32_t uVar8; - int iVar9; - uint32_t uVar10; - void *pvVar11; - ItemConfig_Item *collectibleConfig; - uint8_t uVar12; - void *checksum; - uint32_t extraout_ECX; - uint32_t extraout_ECX_00; - uint32_t extraout_ECX_01; - void *checksum2; - uint8_t bVar13; - uint32_t uVar14; - uint32_t *puVar15; - int unaff_EBX; - int unaff_EBP; - int unaff_ESI; - uint32_t *puVar16; - uint32_t *fieldPtr; - uint16_t *shortField; - uint8_t *shortArrayField; - int *piVar17; - uint8_t *byteField; - Manager *manager; - uint32_t *unaff_EDI; - int iVar18; - int iVar19; - char *format; - EntitySaveState *saveStateSlot; - - iVar9 = *GHIDRA_CAST((unaff_ESI + 0x1d0)); - *GHIDRA_CAST((unaff_EBP + -0x44)) = 0; - if (iVar9 != 0) { - do { - cVar6 = (**(code **)(*GHIDRA_CAST(*unaff_EDI) + 0x10))(); - if (cVar6 != '\0') goto LAB_009d1988; - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x44)) * 8; - puVar16 = GHIDRA_CAST((*GHIDRA_CAST((unaff_ESI + 0x1d4)) + iVar18)); - (**(code **)(*GHIDRA_CAST(**GHIDRA_CAST((unaff_EBX + 8))) + 0x14))(puVar16,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *puVar16; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - puVar16 = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x1d4)) + 4 + iVar18)); - (**(code **)(*GHIDRA_CAST(**GHIDRA_CAST((unaff_EBX + 8))) + 0x14))(puVar16,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *puVar16; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - unaff_ESI = *GHIDRA_CAST((unaff_EBP + -0x24)); - iVar9 = *GHIDRA_CAST((*GHIDRA_CAST((unaff_ESI + 0x1d4)) + 4 + iVar18)); - iVar18 = *GHIDRA_CAST((*GHIDRA_CAST((unaff_ESI + 0x1d4)) + iVar18)); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = iVar9; - bVar7 = is_valid_item_config_id(iVar18,iVar9); - if (bVar7 == 0) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Invalid costume (type: %d, ID: %d)\n")); - goto code_r0x009d459a; - } - unaff_EDI = *GHIDRA_CAST((unaff_EBX + 8)); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x44)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x44)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_ESI + 0x1d0))); - } - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - uVar8 = puVar16[2]; - if (0x2f < uVar8) { - GameStateReader::read_int_vector(puVar16,GHIDRA_CAST((unaff_ESI + 0x194))); - GameStateReader::read_int_vector(puVar16,GHIDRA_CAST((unaff_ESI + 0x1a0))); - GameStateReader::read_int_vector(puVar16,GHIDRA_CAST((unaff_ESI + 0x1ac))); - GameStateReader::read_int_vector(puVar16,GHIDRA_CAST((unaff_ESI + 0x1b8))); - uVar8 = puVar16[2]; - } - if (0x2e < uVar8) { - GameStateReader::read_int_vector(puVar16,GHIDRA_CAST((unaff_ESI + 0x1c4))); - iVar18 = 0; - iVar9 = *GHIDRA_CAST((unaff_ESI + 0x1c8)) - *GHIDRA_CAST((unaff_ESI + 0x1c4)) >> 2; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = iVar9; - if (0 < iVar9) { - do { - if (0 < iVar18) { - pvVar11 = (g_manager->_itemConfig)._pillEffects._begin; - if ((GHIDRA_INT((g_manager->_itemConfig)._pillEffects._end) - GHIDRA_INT(pvVar11) >> 2 <= iVar18) || - (*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + iVar18 * 4)) == 0)) { - format = "Invalid pill effect %d\n"; - goto LAB_009d4590; - } - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x1c)); - } - iVar18 = iVar18 + 1; - } while (iVar18 < iVar9); - } - } - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x1ec)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x204)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)) + 0x1f0; - *GHIDRA_CAST((unaff_EBP + -0x3c)) = 5; - *GHIDRA_CAST((unaff_EBP + -0x44)) = iVar9; - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(iVar9,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = **GHIDRA_CAST((unaff_EBP + -0x44)); - Checksum::Update(checksum,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x44)) + 4; - piVar17 = GHIDRA_CAST((unaff_EBP + -0x3c)); - *piVar17 = *piVar17 + -1; - *GHIDRA_CAST((unaff_EBP + -0x44)) = iVar9; - } while (*piVar17 != 0); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x208)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - if (GHIDRA_UINT(puVar16[2]) < 0x4d) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x3c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x3c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - *GHIDRA_CAST((iVar9 + 0x20c)) = *GHIDRA_CAST((unaff_EBP + -0x3c)); - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(iVar9 + 0x20c,2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((iVar9 + 0x20c))); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),2); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x20e)),2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((iVar9 + 0x20e))); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),2); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x210)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x210)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x214)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x218)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - if (0x1e < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x21c)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x220)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x224)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - if (0x1d < uVar8) { - iVar18 = *GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x50)) = iVar9 + 0x22c; - (**(code **)(iVar18 + 0x14))(iVar9 + 0x22c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x22c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar18 = *GHIDRA_CAST((iVar9 + 0x22c)); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = 10; - piVar17 = GHIDRA_CAST((unaff_EBP + -0x1c)); - if (iVar18 < 0xb) { - piVar17 = GHIDRA_CAST((iVar9 + 0x22c)); - } - *GHIDRA_CAST((unaff_EBP + -0x44)) = 0; - iVar18 = *piVar17; - *GHIDRA_CAST((iVar9 + 0x22c)) = iVar18; - if (0 < iVar18) { - iVar9 = iVar9 + 0x234; - *GHIDRA_CAST((unaff_EBP + -0x40)) = iVar9; - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + -4)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + -4)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(*GHIDRA_CAST((unaff_EBP + -0x40)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = **GHIDRA_CAST((unaff_EBP + -0x40)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x40)) + 4)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x40)) + 8)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x40)) + 0xc)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x40)) + 0x10)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x40)); - *GHIDRA_CAST((unaff_EBP + -0x3c)) = GHIDRA_CAST((iVar9 + 0x14)); - if (uVar8 < 0x74) { - *GHIDRA_CAST((iVar9 + 0x14)) = 0; - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(*GHIDRA_CAST((unaff_EBP + -0x3c)),1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = **GHIDRA_CAST((unaff_EBP + -0x3c)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x38)),1); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x40)); - } - iVar9 = iVar9 + 0x1c; - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x44)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x44)) = iVar18; - *GHIDRA_CAST((unaff_EBP + -0x40)) = iVar9; - } while (iVar18 < **GHIDRA_CAST((unaff_EBP + -0x50))); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - } - if (0x38 < GHIDRA_UINT(puVar16[2])) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x50,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x50)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar18 = *GHIDRA_CAST((iVar9 + 0x1e8)); - iVar19 = *GHIDRA_CAST((iVar9 + 0x1e0)); - *GHIDRA_CAST((unaff_EBP + -0x3c)) = GHIDRA_CAST((iVar9 + 0x1e0)); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x50)); - if (GHIDRA_UINT(((iVar18 - iVar19) / 0x78)) < uVar8) { - if (0x2222222 < uVar8) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - msvc::vector::_Reallocate_exactly(uVar8); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x50)); - } - *GHIDRA_CAST((unaff_EBP + -0x44)) = 0; - if (uVar8 != 0) { - pvVar11 = *(void **)(unaff_EBP + -0x28); - do { - *GHIDRA_CAST((unaff_EBP + -0xf0)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xec)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xe8)) = 0xffffffff; - *GHIDRA_CAST((unaff_EBP + -0xe4)) = 0xffffffff; - *GHIDRA_CAST((unaff_EBP + -0x100)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xd8)) = g_vectorZero.x; - *GHIDRA_CAST((unaff_EBP + -0xd4)) = g_vectorZero.y; - *GHIDRA_CAST((unaff_EBP + -0xfc)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xf8)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xf4)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xe0)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xdc)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xd0)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xcc)) = 0; - *GHIDRA_CAST((unaff_EBP + -200)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xc4)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xc0)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xb8)) = 0xffffffff; - *GHIDRA_CAST((unaff_EBP + -0xb4)) = 0xffffffff; - *GHIDRA_CAST((unaff_EBP + -0xb0)) = 0x42700000; - *GHIDRA_CAST((unaff_EBP + -0xac)) = 0x3f800000; - *GHIDRA_CAST((unaff_EBP + -0xa8)) = 0x3f800000; - *GHIDRA_CAST((unaff_EBP + -0xa4)) = 0; - *GHIDRA_CAST((unaff_EBP + -0xa0)) = 1; - *GHIDRA_CAST((unaff_EBP + -0x9c)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x98)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x94)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x90)) = 0; - *GHIDRA_CAST((unaff_EBP + -4)) = 3; - if (GHIDRA_UINT(puVar16[2]) < 0x67) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x100,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x100)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0xfc,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0xfc)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0xf8,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0xf8)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0xf0,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0xf0)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0xcc,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0xcc)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - if (0x5a < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0xd0,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0xd0)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0xde,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0xde)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x38)),1); - uVar8 = puVar16[2]; - } - if (0x5d < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0xdd,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0xdd)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x38)),1); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),2); - *GHIDRA_CAST((unaff_EBP + -0xf4)) = GHIDRA_INT(*GHIDRA_CAST((unaff_EBP + -0x30))); - } - } - else { - read_entity_save_state_tree((void *)(unaff_EBP + -0x100),puVar16); - } - saveStateSlot = *GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x3c)) + 4)); - if (saveStateSlot == *GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x3c)) + 8))) { - msvc::vector::_Emplace_reallocate(saveStateSlot,unaff_EBP + -0x100); - } - else { - (GHIDRA_CAST((saveStateSlot)))->EntitySaveState::copy((void *)(unaff_EBP + -0x100)); - piVar17 = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x3c)) + 4)); - *piVar17 = *piVar17 + 0x78; - } - *GHIDRA_CAST((unaff_EBP + -4)) = 4; - if (((*GHIDRA_CAST((unaff_EBP + -0x90)) != GHIDRA_CAST(0x0)) && - (cVar6 = (**(code **)(**GHIDRA_CAST((unaff_EBP + -0x90)) + 0xc))(), cVar6 != '\0')) && - (g_entitySaveStateReleaseFn != (void *)0x0)) { - (*g_entitySaveStateReleaseFn)(unaff_EBP + -0x94); - } - *GHIDRA_CAST((unaff_EBP + -4)) = 5; - if (((*GHIDRA_CAST((unaff_EBP + -0x98)) != GHIDRA_CAST(0x0)) && - (cVar6 = (**(code **)(**GHIDRA_CAST((unaff_EBP + -0x98)) + 0xc))(), cVar6 != '\0')) && - (g_entitySaveStateExtraDataReleaseFn != (void *)0x0)) { - (*g_entitySaveStateExtraDataReleaseFn)(unaff_EBP + -0x9c); - } - *GHIDRA_CAST((unaff_EBP + -4)) = 0xffffffff; - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x44)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x44)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x50))); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - } - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x348)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x348)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x34c)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x350)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x354)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x358)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x35c)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x360)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x364)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x368)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - if (GHIDRA_UINT(puVar16[2]) < 0x8c) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x3c)) = *GHIDRA_CAST((unaff_EBP + -0x1c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x3c)),4); - *GHIDRA_CAST((iVar9 + 0x36c)) = 0; - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(iVar9 + 0x36c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x36c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - } - if (GHIDRA_UINT(puVar16[2]) < 0x23) { - *GHIDRA_CAST((iVar9 + 0x370)) = 0; - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x370)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x370)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - } - if (0x1f < GHIDRA_UINT(puVar16[2])) { - iVar18 = *GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x44)) = iVar9 + 0x37c; - (**(code **)(iVar18 + 0x14))(iVar9 + 0x37c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x37c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - *GHIDRA_CAST((unaff_EBP + -4)) = 6; - uVar10 = *GHIDRA_CAST((iVar9 + 0x37c)); - *GHIDRA_CAST((unaff_EBP + -0x40)) = iVar9 + 0x380; - msvc::vector<52byte>::resize(uVar10); - *GHIDRA_CAST((unaff_EBP + -4)) = 0xffffffff; - iVar18 = *GHIDRA_CAST((iVar9 + 0x37c)); - *GHIDRA_CAST((unaff_EBP + -0x3c)) = 0; - if (iVar18 != 0) { - *GHIDRA_CAST((unaff_EBP + -0x30)) = 0; - do { - cVar6 = (**(code **)(*GHIDRA_CAST(*puVar16) + 0x10))(); - if (cVar6 != '\0') { - KAGE_LogMessage(1,(uint8_t *) - "[warn] Invalid familiar count %d. Save file %s might be corrupt.\n"); - goto code_r0x009d459a; - } - fieldPtr = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x30)))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + 4 + *GHIDRA_CAST((unaff_EBP + -0x30)))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + 8 + *GHIDRA_CAST((unaff_EBP + -0x30)))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + 0xc + *GHIDRA_CAST((unaff_EBP + -0x30)))) - ; - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x10 + *GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x14 + *GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x18 + *GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x1c + *GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - if (0x54 < uVar8) { - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x20 + *GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x24 + *GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (0x59 < uVar8) { - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x28 + *GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - iVar9 = **GHIDRA_CAST((unaff_EBP + -0x40)); - if (uVar8 < 0x8f) { - *GHIDRA_CAST((iVar9 + 0x2c + *GHIDRA_CAST((unaff_EBP + -0x30)))) = - *GHIDRA_CAST((iVar9 + *GHIDRA_CAST((unaff_EBP + -0x30)))); - } - else { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x30)) + 0x2c + iVar9)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - } - cVar6 = '\0'; - uVar8 = puVar16[2]; - *GHIDRA_CAST((unaff_EBP + -0x1d)) = 0; - if (0x9b < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x38)),1); - cVar6 = *GHIDRA_CAST((unaff_EBP + -0x1d)); - } - *GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x30)) + 0x30)) = - cVar6 != '\0'; - cVar6 = '\0'; - uVar8 = puVar16[2]; - *GHIDRA_CAST((unaff_EBP + -0x29)) = 0; - if (0x9f < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x29,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0x29)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x38)),1); - cVar6 = *GHIDRA_CAST((unaff_EBP + -0x29)); - } - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x30)); - *GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + 0x31 + iVar9)) = cVar6 != '\0'; - *GHIDRA_CAST((unaff_EBP + -0x30)) = iVar9 + 0x34; - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x3c)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x3c)) = uVar8; - } while (uVar8 < **GHIDRA_CAST((unaff_EBP + -0x44))); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - } - if (0x3f < GHIDRA_UINT(puVar16[2])) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x38)),1); - *GHIDRA_CAST((unaff_EBP + -4)) = 8; - vector28_resize((void *)(iVar9 + 0x38c),GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x1d)))); - *GHIDRA_CAST((unaff_EBP + -4)) = 0xffffffff; - uVar10 = GameStatePlayer::read_part3(); - return uVar10; - } - if (GHIDRA_UINT(puVar16[2]) < 0x41) { - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x34)); - *GHIDRA_CAST((unaff_EBP + -0x34)) = uVar10; -LAB_009d29c0: - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *GHIDRA_CAST((unaff_EBP + -0x28)) = uVar10; - } - else { - shortField = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x3b8)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(shortField,2,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*shortField); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),2); - uVar8 = puVar16[2]; - if (0x57 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x430)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (uVar8 < 0x72) { - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),2); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *GHIDRA_CAST((iVar9 + 0x434)) = GHIDRA_INT(*GHIDRA_CAST((unaff_EBP + -0x30))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),2); - *GHIDRA_CAST((iVar9 + 0x438)) = *GHIDRA_CAST((unaff_EBP + -0x30)); - uVar8 = puVar16[2]; - } - *GHIDRA_CAST((unaff_EBP + -0x28)) = *GHIDRA_CAST((unaff_EBP + -0x34)); - if (uVar8 < 0x4f) { - pvVar11 = *(void **)(unaff_EBP + -0x34); - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x43c)),4,1); - pvVar11 = *(void **)(unaff_EBP + -0x34); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x43c)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (0x4f < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x440)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x444)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x34); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (0x51 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x448)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x34); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (0x5a < uVar8) { - shortArrayField = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x458)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(shortArrayField,2,6); - Checksum::Update(*(void **)(unaff_EBP + -0x34),shortArrayField,0xc); - shortArrayField = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x464)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(shortArrayField,2,6); - Checksum::Update(*(void **)(unaff_EBP + -0x34),shortArrayField,0xc); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x470)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x34); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x34)); - *GHIDRA_CAST((unaff_EBP + -0x3c)) = uVar10; - *(void **)(unaff_EBP + -0x48) = pvVar11; - if (uVar8 < 0x5d) { - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *(void **)(unaff_EBP + -0x34) = pvVar11; - *GHIDRA_CAST((unaff_EBP + -0x28)) = uVar10; - if (0x5b < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x44c)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x44c)); - Checksum::Update(*(void **)(unaff_EBP + -0x48),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x3c)); - *GHIDRA_CAST((unaff_EBP + -0x34)) = extraout_ECX; - goto LAB_009d29c0; - } - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x38)),1); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *GHIDRA_CAST((iVar9 + 0x44c)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x1d))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x38)),1); - *GHIDRA_CAST((iVar9 + 0x454)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x1d))); - } - } - uVar8 = puVar16[2]; - if (0x62 < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x29,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0x29)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x38)),1); - *GHIDRA_CAST((iVar9 + 0x450)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x29))); - uVar8 = puVar16[2]; - } - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x28)); - if (0x5e < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x474)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x474)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x478)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x47c)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x480)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x484)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x488)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x28)); - } - *GHIDRA_CAST((unaff_EBP + -0x40)) = uVar10; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar10; - if (uVar8 < 0x60) { -LAB_009d2c5b: - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - uVar8 = puVar16[2]; - if (uVar8 < 0x61) { - pvVar11 = *(void **)(unaff_EBP + -0x28); - } - else { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x490)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (0x61 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x494)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (uVar8 < 100) { - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x40)); - *GHIDRA_CAST((unaff_EBP + -0x40)) = uVar10; - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),2); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *GHIDRA_CAST((iVar9 + 0x498)) = GHIDRA_INT(*GHIDRA_CAST((unaff_EBP + -0x30))); - uVar8 = puVar16[2]; - if (0x69 < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x49c)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x49c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4a0)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4a4)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4a8)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - if (0x6b < uVar8) { - uVar10 = 4; - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x4ac)),4,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x4ac)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - if (GHIDRA_UINT(puVar16[2]) < 0x90) { - *GHIDRA_CAST((unaff_EBP + -100)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x60)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x5c)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x58)) = 0; - *GHIDRA_CAST((unaff_EBP + -4)) = 0xc; - *GHIDRA_CAST((unaff_EBP + -0x88)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x84)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x80)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x7c)) = 0; - *GHIDRA_CAST((unaff_EBP + -4)) = 0xd; - GameStateReader::read_bool_vector(puVar16,(void *)(unaff_EBP + -100),0); - GameStateReader::read_bool_vector(puVar16,(void *)(unaff_EBP + -0x88),0); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - uVar8 = 0; - *GHIDRA_CAST((unaff_EBP + -0x34)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x58)) != 0) { - do { - if (2 < *GHIDRA_CAST((iVar9 + 0x4c0))) break; - if ((*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -100)) + (uVar8 >> 5) * 4)) & - 1 << ((uint8_t)uVar8 & 0x1f)) == 0) { - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x34)); - } - else { - uVar8 = *GHIDRA_CAST((iVar9 + 0x4bc)); - *GHIDRA_CAST((unaff_EBP + -0x44)) = uVar8; - if (((uVar8 & 1) == 0) && - (*GHIDRA_CAST((unaff_EBP + -0x44)) = uVar8, - *GHIDRA_CAST((iVar9 + 0x4b8)) <= *GHIDRA_CAST((iVar9 + 0x4c0)) + 2U >> 1)) { - msvc::deque::_Growmap(*GHIDRA_CAST((unaff_EBP + -100))); - *GHIDRA_CAST((unaff_EBP + -0x44)) = *GHIDRA_CAST((iVar9 + 0x4bc)); - } - iVar18 = *GHIDRA_CAST((iVar9 + 0x4b8)); - uVar8 = iVar18 * 2; - uVar14 = uVar8 - 1 & *GHIDRA_CAST((unaff_EBP + -0x44)); - *GHIDRA_CAST((iVar9 + 0x4bc)) = uVar14; - if (uVar14 == 0) { - uVar14 = uVar8; - } - *GHIDRA_CAST((unaff_EBP + -0x50)) = uVar14; - *GHIDRA_CAST((unaff_EBP + -0x50)) = uVar14 - 1; - uVar8 = uVar14 - 1 >> 1 & iVar18 - 1U; - iVar18 = *GHIDRA_CAST((iVar9 + 0x4b4)); - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - iVar19 = iVar9; - if (*GHIDRA_CAST((iVar18 + uVar8 * 4)) == 0) { - pvVar11 = operator_new(0x10); - *(void **)(*GHIDRA_CAST((iVar9 + 0x4b4)) + uVar8 * 4) = pvVar11; - iVar19 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x50)) & 1; - iVar2 = *GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 0x4b4)) + *GHIDRA_CAST((unaff_EBP + -0x48)) * 4)); - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x34)); - *GHIDRA_CAST((iVar2 + uVar8 * 8)) = iVar18; - *GHIDRA_CAST((iVar2 + 4 + uVar8 * 8)) = 1; - *GHIDRA_CAST((iVar9 + 0x4c0)) = *GHIDRA_CAST((iVar9 + 0x4c0)) + 1; - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - *GHIDRA_CAST((iVar9 + 0x4bc)) = *GHIDRA_CAST((unaff_EBP + -0x50)); - iVar9 = iVar19; - if ((0 < iVar18) && - ((pvVar11 = (g_manager->_itemConfig)._cards._begin, - GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT(pvVar11) >> 2 <= iVar18 || - (*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + iVar18 * 4)) == 0)))) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Invalid pocket item (type: %d, ID: %d)\n")); - pvVar11 = *(void **)(unaff_EBP + -0x88); - if (pvVar11 != (void *)0x0) { - deallocate(pvVar11,*GHIDRA_CAST((unaff_EBP + -0x80)) - GHIDRA_INT(pvVar11) >> 2); - } - pvVar11 = *(void **)(unaff_EBP + -100); - if (pvVar11 == (void *)0x0) { - uVar10 = FUN_009d459a(uVar10); - return uVar10; - } - deallocate(pvVar11,*GHIDRA_CAST((unaff_EBP + -0x5c)) - GHIDRA_INT(pvVar11) >> 2); - goto code_r0x009d459a; - } - } - uVar8 = iVar18 + 1; - *GHIDRA_CAST((unaff_EBP + -0x34)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x58))); - } - uVar8 = 0; - *GHIDRA_CAST((unaff_EBP + -0x44)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x7c)) != 0) { - do { - if (2 < *GHIDRA_CAST((iVar9 + 0x4c0))) break; - if ((*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x88)) + (uVar8 >> 5) * 4)) & - 1 << ((uint8_t)uVar8 & 0x1f)) != 0) { - uVar8 = *GHIDRA_CAST((iVar9 + 0x4bc)); - *GHIDRA_CAST((unaff_EBP + -0x34)) = uVar8; - if (((uVar8 & 1) == 0) && - (*GHIDRA_CAST((unaff_EBP + -0x34)) = uVar8, - *GHIDRA_CAST((iVar9 + 0x4b8)) <= *GHIDRA_CAST((iVar9 + 0x4c0)) + 2U >> 1)) { - msvc::deque::_Growmap(iVar9 + 0x4b0); - *GHIDRA_CAST((unaff_EBP + -0x34)) = *GHIDRA_CAST((iVar9 + 0x4bc)); - } - iVar18 = *GHIDRA_CAST((iVar9 + 0x4b8)); - iVar2 = iVar18 * 2; - puVar15 = GHIDRA_CAST((unaff_EBP + -0x34)); - *puVar15 = *puVar15 & iVar2 - 1U; - uVar8 = *puVar15; - iVar19 = *GHIDRA_CAST((unaff_EBP + -0x34)); - *GHIDRA_CAST((iVar9 + 0x4bc)) = iVar19; - if (uVar8 == 0) { - iVar19 = iVar2; - } - *GHIDRA_CAST((unaff_EBP + -0x34)) = iVar19 - 1U; - uVar8 = iVar19 - 1U >> 1 & iVar18 - 1U; - iVar18 = *GHIDRA_CAST((iVar9 + 0x4b4)); - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - if (*GHIDRA_CAST((iVar18 + uVar8 * 4)) == 0) { - pvVar11 = operator_new(0x10); - *(void **)(*GHIDRA_CAST((iVar9 + 0x4b4)) + *GHIDRA_CAST((unaff_EBP + -0x48)) * 4) = pvVar11; - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x34)); - uVar14 = uVar8 & 1; - iVar18 = *GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 0x4b4)) + *GHIDRA_CAST((unaff_EBP + -0x48)) * 4)); - *GHIDRA_CAST((iVar18 + uVar14 * 8)) = *GHIDRA_CAST((unaff_EBP + -0x44)); - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - *GHIDRA_CAST((iVar18 + 4 + uVar14 * 8)) = 0; - *GHIDRA_CAST((iVar9 + 0x4c0)) = *GHIDRA_CAST((iVar9 + 0x4c0)) + 1; - *GHIDRA_CAST((iVar9 + 0x4bc)) = uVar8; - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x44)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x44)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x7c))); - } - pvVar11 = *(void **)(unaff_EBP + -0x88); - if (pvVar11 != (void *)0x0) { - deallocate(pvVar11,*GHIDRA_CAST((unaff_EBP + -0x80)) - GHIDRA_INT(pvVar11) >> 2); - } - *GHIDRA_CAST((unaff_EBP + -4)) = 0xffffffff; - pvVar11 = *(void **)(unaff_EBP + -100); - if (pvVar11 != (void *)0x0) { - deallocate(pvVar11,*GHIDRA_CAST((unaff_EBP + -0x5c)) - GHIDRA_INT(pvVar11) >> 2); - } - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x29,1,1); - *GHIDRA_CAST((unaff_EBP + -0x38)) = *GHIDRA_CAST((unaff_EBP + -0x29)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x38)),1); - *GHIDRA_CAST((unaff_EBP + -0x35)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x29)) != '\0') { - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x4c,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x4c)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x30)),1); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x48,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x48)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - if (((*GHIDRA_CAST((unaff_EBP + -0x4c)) == '\x01') && - (iVar9 = *GHIDRA_CAST((unaff_EBP + -0x48)), 0 < iVar9)) && - ((pvVar1 = (g_manager->_itemConfig)._cards._begin, - GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT(pvVar1) >> 2 <= iVar9 || - (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + iVar9 * 4)) == 0)))) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Invalid pocket item (type: %d, ID: %d)\n")); - goto code_r0x009d459a; - } - bVar7 = *GHIDRA_CAST((unaff_EBP + -0x35)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x35)) = bVar7; - } while (bVar7 < *GHIDRA_CAST((unaff_EBP + -0x29))); - } - } - piVar17 = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4c4)); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = piVar17; - FUN_007dccd0(8); - uVar8 = 0; - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - do { - iVar9 = *piVar17; - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + uVar8)),1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((iVar9 + uVar8)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x30)),1); - piVar17 = *GHIDRA_CAST((unaff_EBP + -0x1c)); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < 8); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4d0)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - if (0x98 < GHIDRA_UINT(puVar16[2])) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4d4)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - } - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4dc; - FUN_007dccd0(6); - uVar8 = 0; - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - do { - byteField = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x1c)) + uVar8)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(byteField,1,1); - pvVar11 = *(void **)(unaff_EBP + -0x28); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *byteField; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x30)),1); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < 6); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x30)),1); - uVar12 = *GHIDRA_CAST((unaff_EBP + -0x1d)); - if (0x14 < *GHIDRA_CAST((unaff_EBP + -0x1d))) { - uVar12 = 0x14; - } - piVar17 = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4e8)); - *GHIDRA_CAST((unaff_EBP + -0x1d)) = uVar12; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = piVar17; - FUN_007dccd0(uVar12); - uVar8 = 0; - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x1d)) != '\0') { - do { - iVar9 = *piVar17; - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + uVar8)),1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((iVar9 + uVar8)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x30)),1); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)) + 1; - piVar17 = *GHIDRA_CAST((unaff_EBP + -0x1c)); - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x1d))); - } - byteField = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4f4)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(byteField,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *byteField; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x30)),1); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4d8)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4f8)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x4fc)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x528)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - } - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x40)); - } - uVar8 = puVar16[2]; - *GHIDRA_CAST((unaff_EBP + -0x34)) = uVar10; - if (0x74 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x52c)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - *GHIDRA_CAST((unaff_EBP + -0x40)) = extraout_ECX_00; - } - if (0x75 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x514)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (0x77 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x530)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - if (0x7d < uVar8) { - GameStatePlayer::read_block_538(GHIDRA_CAST((iVar9 + 0x538)),puVar16); - uVar8 = puVar16[2]; - } - if (uVar8 < 0xa4) { - *GHIDRA_CAST((iVar9 + 0x564)) = *GHIDRA_CAST((iVar9 + 4)); - } - else { - piVar17 = GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x38)) = 0; - (**(code **)(*piVar17 + 0x14))(unaff_EBP + -0x38,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x38)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - *GHIDRA_CAST((unaff_EBP + -4)) = 0xe; - *GHIDRA_CAST((unaff_EBP + -0x40)) = iVar9 + 0x558; - msvc::vector<52byte>::resize(*GHIDRA_CAST((unaff_EBP + -0x38))); - *GHIDRA_CAST((unaff_EBP + -4)) = 0xffffffff; - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - if (0 < *GHIDRA_CAST((unaff_EBP + -0x38))) { - *GHIDRA_CAST((unaff_EBP + -0x28)) = 0; - do { - cVar6 = (**(code **)(*GHIDRA_CAST(*puVar16) + 0x10))(); - if (cVar6 != '\0') { - KAGE_LogMessage(1,(uint8_t *) - "[warn] Invalid familiar count %d. Save file %s might be corrupt.\n"); - goto code_r0x009d459a; - } - fieldPtr = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 4)) - ; - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = GHIDRA_CAST((**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 8)) - ; - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0xc); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x10); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x14); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x18); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x1c); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x20); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x24); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x28); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = (uint32_t *) - (**GHIDRA_CAST((unaff_EBP + -0x40)) + *GHIDRA_CAST((unaff_EBP + -0x28)) + 0x2c); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x34); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - piVar17 = GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x29)) = 0; - (**(code **)(*piVar17 + 0x14))(unaff_EBP + -0x29,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x29)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x30)),1); - *GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x28)) + 0x30 + **GHIDRA_CAST((unaff_EBP + -0x40)))) = - *GHIDRA_CAST((unaff_EBP + -0x29)) != '\0'; - piVar17 = GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x1d)) = 0; - (**(code **)(*piVar17 + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x30)),1); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x28)); - *GHIDRA_CAST((iVar9 + 0x31 + **GHIDRA_CAST((unaff_EBP + -0x40)))) = - *GHIDRA_CAST((unaff_EBP + -0x1d)) != '\0'; - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x48)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x28)) = iVar9 + 0x34; - *GHIDRA_CAST((unaff_EBP + -0x48)) = iVar18; - } while (iVar18 < *GHIDRA_CAST((unaff_EBP + -0x38))); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x564)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x564)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *GHIDRA_CAST((unaff_EBP + -0x40)) = extraout_ECX_01; - } - uVar8 = puVar16[2]; - if (0x7f < uVar8) { - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x50)) = iVar9 + 0x568; - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x29,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x29)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x30)),1); - *GHIDRA_CAST((unaff_EBP + -0x44)) = 0; - *GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x50)) + 4)) = GHIDRA_INT(*GHIDRA_CAST((unaff_EBP + -0x29))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x44,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x44)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - cVar6 = *GHIDRA_CAST((unaff_EBP + -0x29)); - piVar17 = *GHIDRA_CAST((unaff_EBP + -0x50)); - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x44)); - *piVar17 = iVar18; - if ((cVar6 == '\x01') && (0 < iVar18)) { - pvVar11 = (g_manager->_itemConfig)._cards._begin; - pvVar1 = (g_manager->_itemConfig)._cards._end; - *(void **)(unaff_EBP + -0x1c) = pvVar11; - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - if ((GHIDRA_INT(pvVar1) - GHIDRA_INT(pvVar11) >> 2 <= iVar18) || - (*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x1c)) + iVar18 * 4)) == 0)) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Invalid pre curse pocket item (type: %d, ID: %d)\n")); - goto code_r0x009d459a; - } - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x50)) = piVar17 + 2; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x74))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(iVar9 + 0x588,4,2); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((iVar9 + 0x588)),8); - uVar8 = 0; - puVar15 = GHIDRA_CAST((iVar9 + 0x588)); - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - do { - uVar14 = *puVar15; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = uVar14; - if (0 < GHIDRA_INT(uVar14)) { - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - if ((GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - - GHIDRA_INT((g_manager->_itemConfig)._trinkets._begin) >> 2 <= GHIDRA_INT((uVar14 & 0x7fff))) || - (iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)), - *GHIDRA_CAST((GHIDRA_INT((g_manager->_itemConfig)._trinkets._begin) + (uVar14 & 0x7fff) * 4)) == 0)) - { - format = "[warn] Invalid pre curse trinket %d\n"; - goto LAB_009d4590; - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)); - } - uVar8 = uVar8 + 1; - puVar15 = puVar15 + 1; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < 2); - uVar8 = puVar16[2]; - } - if (0x81 < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(iVar9 + 0x590,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((iVar9 + 0x590)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x30)),1); - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - *GHIDRA_CAST((unaff_EBP + -0x50)) = iVar9 + 0x598; - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x35,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x35)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x30)),1); - *GHIDRA_CAST((unaff_EBP + -0x44)) = 0; - **GHIDRA_CAST((unaff_EBP + -0x50)) = GHIDRA_INT(*GHIDRA_CAST((unaff_EBP + -0x35))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x44,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x44)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - piVar17 = *GHIDRA_CAST((unaff_EBP + -0x50)); - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x44)); - piVar17[-1] = iVar18; - if (((*GHIDRA_CAST((iVar9 + 0x590)) != '\0') && - (iVar19 = *piVar17, *GHIDRA_CAST((unaff_EBP + -0x3c)) = iVar19, iVar19 == 1)) && (0 < iVar18)) - { - pvVar11 = (g_manager->_itemConfig)._cards._begin; - pvVar1 = (g_manager->_itemConfig)._cards._end; - *(void **)(unaff_EBP + -0x1c) = pvVar11; - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - if ((GHIDRA_INT(pvVar1) - GHIDRA_INT(pvVar11) >> 2 <= iVar18) || - (*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x1c)) + iVar18 * 4)) == 0)) { - KAGE_LogMessage(1,(uint8_t *) - "[warn] Invalid pre coop ghost pocket item (type: %d, ID: %d)\n"); - goto code_r0x009d459a; - } - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x50)) = piVar17 + 2; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x74))); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(iVar9 + 0x5b4,4,2); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((iVar9 + 0x5b4)),8); - cVar6 = *GHIDRA_CAST((iVar9 + 0x590)); - puVar15 = GHIDRA_CAST((iVar9 + 0x5b4)); - uVar8 = 0; - *GHIDRA_CAST((unaff_EBP + -0x35)) = cVar6; - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - do { - if (cVar6 != '\0') { - uVar14 = *puVar15; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = uVar14; - if (0 < GHIDRA_INT(uVar14)) { - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - if ((GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - - GHIDRA_INT((g_manager->_itemConfig)._trinkets._begin) >> 2 <= GHIDRA_INT((uVar14 & 0x7fff))) || - (iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)), - *GHIDRA_CAST((GHIDRA_INT((g_manager->_itemConfig)._trinkets._begin) + (uVar14 & 0x7fff) * 4)) == 0 - )) { - format = "[warn] Invalid pre coop ghost trinket %d\n"; - goto LAB_009d4590; - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)); - } - cVar6 = *GHIDRA_CAST((unaff_EBP + -0x35)); - } - uVar8 = uVar8 + 1; - puVar15 = puVar15 + 1; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < 2); - uVar8 = puVar16[2]; - } - if (0x80 < uVar8) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x5c8)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x5c8)); - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - if (uVar8 < 0x82) { - pvVar11 = *(void **)(unaff_EBP + -0x40); - *(void **)(unaff_EBP + -0x28) = pvVar11; - } - else { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x5cc)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x40),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - if (0xa7 < uVar8) { - byteField = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x5d0)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(byteField,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *byteField; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x30)),1); - uVar8 = puVar16[2]; - } - if (0xa8 < uVar8) { - byteField = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x5d1)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(byteField,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *byteField; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x30)),1); - uVar8 = puVar16[2]; - } - pvVar11 = *(void **)(unaff_EBP + -0x40); - *(void **)(unaff_EBP + -0x28) = pvVar11; - if (0x82 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x524)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x34),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - pvVar11 = *(void **)(unaff_EBP + -0x28); - } - } - if (uVar8 < 0x6e) { -LAB_009d3eb4: - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - else { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x30)),1); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *GHIDRA_CAST((unaff_EBP + -0x48)) = iVar9 + 0x500; - msvc::vector<4byte>::resize(*GHIDRA_CAST((unaff_EBP + -0x1d))); - uVar8 = 0; - *GHIDRA_CAST((unaff_EBP + -0x35)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x1d)) != '\0') { - iVar9 = **GHIDRA_CAST((unaff_EBP + -0x48)); - do { - puVar16 = GHIDRA_CAST((iVar9 + uVar8 * 4)); - (**(code **)(*GHIDRA_CAST(**GHIDRA_CAST((unaff_EBX + 8))) + 0x14))(puVar16,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *puVar16; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar9 = **GHIDRA_CAST((unaff_EBP + -0x48)); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = iVar9; - iVar18 = *GHIDRA_CAST((iVar9 + uVar8 * 4)); - if (0 < iVar18) { - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar18); - if (collectibleConfig == GHIDRA_CAST(0x0)) { - format = "[warn] Invalid item card %d\n"; - goto LAB_009d4590; - } - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x1c)); - } - bVar7 = *GHIDRA_CAST((unaff_EBP + -0x35)) + 1; - uVar8 = GHIDRA_UINT(bVar7); - *GHIDRA_CAST((unaff_EBP + -0x35)) = bVar7; - } while (bVar7 < *GHIDRA_CAST((unaff_EBP + -0x1d))); - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - goto LAB_009d3eb4; - } - } - if (GHIDRA_UINT(puVar16[2]) < 0x6f) { -LAB_009d3f14: - uVar8 = puVar16[2]; - if (0x72 < uVar8) { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x510)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = puVar16[2]; - } - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - if (0x7e < uVar8) { - iVar18 = *GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x3c)) = iVar9 + 0x5bc; - (**(code **)(iVar18 + 0x14))(iVar9 + 0x5bc,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((iVar9 + 0x5bc)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x30)),1); - if (*GHIDRA_CAST((iVar9 + 0x5bc)) != -1) { - iVar18 = *GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x48)) = iVar9 + 0x5c0; - (**(code **)(iVar18 + 0x14))(iVar9 + 0x5c0,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x5c0)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(GHIDRA_CAST((iVar9 + 0x5c4)),4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((iVar9 + 0x5c4)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - cVar6 = **GHIDRA_CAST((unaff_EBP + -0x3c)); - *GHIDRA_CAST((unaff_EBP + -0x2d)) = cVar6; - if (cVar6 == '\x02') { - iVar9 = **GHIDRA_CAST((unaff_EBP + -0x48)); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = iVar9; - manager = g_manager; - if (0 < iVar9) { - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,iVar9); - if (collectibleConfig == GHIDRA_CAST(0x0)) { - format = "[warn] Invalid active item wildcard effect %d\n"; - goto LAB_009d4590; - } - goto LAB_009d4022; - } - } - else { - manager = g_manager; -LAB_009d4022: - iVar9 = **GHIDRA_CAST((unaff_EBP + -0x48)); - if (((*GHIDRA_CAST((unaff_EBP + -0x2d)) == '\x01') && (0 < iVar9)) && - ((pvVar11 = (manager->_itemConfig)._cards._begin, - GHIDRA_INT((manager->_itemConfig)._cards._end) - GHIDRA_INT(pvVar11) >> 2 <= iVar9 || - (*GHIDRA_CAST((GHIDRA_CAST(pvVar11) + iVar9 * 4)) == 0)))) { - KAGE_LogMessage(1,(uint8_t *) - "[warn] Invalid pocket item wildcard effect (type: %d, id: %d)\n"); - goto code_r0x009d459a; - } - } - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - } - if (0x42 < GHIDRA_UINT(puVar16[2])) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x44,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x44)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - *GHIDRA_CAST((unaff_EBP + -0x48)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x44)) != 0) { - do { - cVar6 = (**(code **)(*GHIDRA_CAST(*puVar16) + 0x10))(); - if (cVar6 != '\0') { - KAGE_LogMessage(1,(uint8_t *) - "[warn] Invalid history count %d. Save file %s might be corrupt.\n") - ; - } - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x3c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x3c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x74,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x74)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x34,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x34)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x30)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x50,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x50)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x38,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x38)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x3c)); - uVar14 = uVar8 & 0xffffff; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = uVar14; - *GHIDRA_CAST((unaff_EBP + -0x3c)) = uVar14; - cVar6 = (char)(uVar8 >> 0x18); - if (cVar6 == '\x03') { - *GHIDRA_CAST((unaff_EBP + -0x6c)) = 1; - uVar14 = -uVar14; - } - else { - if (cVar6 == '\x02') { - uVar14 = -uVar14; - } - else { - if (cVar6 == '\x01') { - if (uVar14 != 0) { - pvVar11 = (g_manager->_itemConfig)._trinkets._begin; - pvVar1 = (g_manager->_itemConfig)._trinkets._end; - *(void **)(unaff_EBP + -0x1c) = pvVar11; - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - if ((GHIDRA_INT(pvVar1) - GHIDRA_INT(pvVar11) >> 2 <= GHIDRA_INT((uVar8 & 0x7fff))) || - (*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x1c)) + (uVar8 & 0x7fff) * 4)) == 0)) { - format = "[warn] Invalid history trinket %d\n"; - goto LAB_009d4590; - } - } - *GHIDRA_CAST((unaff_EBP + -0x6c)) = 1; - goto LAB_009d422f; - } - if (uVar14 != 0) { - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,uVar14); - if (collectibleConfig == GHIDRA_CAST(0x0)) { - format = "[warn] Invalid history collectible %d\n"; - goto LAB_009d4590; - } - uVar14 = *GHIDRA_CAST((unaff_EBP + -0x1c)); - } - } - *GHIDRA_CAST((unaff_EBP + -0x6c)) = 0; - } -LAB_009d422f: - *GHIDRA_CAST((unaff_EBP + -100)) = *GHIDRA_CAST((unaff_EBP + -0x74)); - *GHIDRA_CAST((unaff_EBP + -0x60)) = *GHIDRA_CAST((unaff_EBP + -0x34)); - *GHIDRA_CAST((unaff_EBP + -0x5c)) = *GHIDRA_CAST((unaff_EBP + -0x30)); - *GHIDRA_CAST((unaff_EBP + -0x68)) = uVar14; - uVar10 = *GHIDRA_CAST((unaff_EBP + -0x50)); - *GHIDRA_CAST((unaff_EBP + -0x58)) = uVar10; - *GHIDRA_CAST((unaff_EBP + -0x70)) = *GHIDRA_CAST((unaff_EBP + -0x38)); - if (*GHIDRA_CAST((unaff_EBP + -0x38)) < 0) { - *GHIDRA_CAST((unaff_EBP + -0x70)) = g_game->_frameCount; - } - fieldPtr = *GHIDRA_CAST((iVar9 + 0x3c0)); - if (fieldPtr == *GHIDRA_CAST((iVar9 + 0x3c4))) { - msvc::vector<28byte>::_Emplace_reallocate(fieldPtr,unaff_EBP + -0x70); - } - else { - uVar3 = *GHIDRA_CAST((unaff_EBP + -0x6c)); - uVar4 = *GHIDRA_CAST((unaff_EBP + -0x68)); - uVar5 = *GHIDRA_CAST((unaff_EBP + -100)); - *fieldPtr = *GHIDRA_CAST((unaff_EBP + -0x70)); - fieldPtr[1] = uVar3; - fieldPtr[2] = uVar4; - fieldPtr[3] = uVar5; - uVar3 = *GHIDRA_CAST((unaff_EBP + -0x5c)); - fieldPtr[4] = *GHIDRA_CAST((unaff_EBP + -0x60)); - fieldPtr[5] = uVar3; - fieldPtr[6] = uVar10; - *GHIDRA_CAST((iVar9 + 0x3c0)) = *GHIDRA_CAST((iVar9 + 0x3c0)) + 0x1c; - } - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x48)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x48)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x44))); - } - if (100 < GHIDRA_UINT(puVar16[2])) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x29,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x29)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x30)),1); - *GHIDRA_CAST((unaff_EBP + -0x35)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x29)) != '\0') { - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),2); - bVar7 = *GHIDRA_CAST((unaff_EBP + -0x35)); - bVar13 = bVar7 + 1; - *GHIDRA_CAST((unaff_EBP + -0x35)) = bVar13; - *GHIDRA_CAST((iVar9 + 0x3c8 + GHIDRA_UINT(bVar7) * 4)) = GHIDRA_INT(*GHIDRA_CAST((unaff_EBP + -0x30))); - } while (bVar13 < *GHIDRA_CAST((unaff_EBP + -0x29))); - } - } - } - if (0x50 < GHIDRA_UINT(puVar16[2])) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x1d,1,1); - *GHIDRA_CAST((unaff_EBP + -0x30)) = *GHIDRA_CAST((unaff_EBP + -0x1d)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x30)),1); - FUN_0042c820(*GHIDRA_CAST((unaff_EBP + -0x1d))); - *GHIDRA_CAST((unaff_EBP + -0x35)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x1d)) != '\0') { - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x50,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x50)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - fieldPtr = *GHIDRA_CAST((iVar9 + 0x428)); - if (fieldPtr == *GHIDRA_CAST((iVar9 + 0x42c))) { - msvc::vector::_Emplace_reallocate(fieldPtr,unaff_EBP + -0x50); - } - else { - *fieldPtr = *GHIDRA_CAST((unaff_EBP + -0x50)); - *GHIDRA_CAST((iVar9 + 0x428)) = *GHIDRA_CAST((iVar9 + 0x428)) + 4; - } - if ((0 < *GHIDRA_CAST((unaff_EBP + -0x50))) && - (collectibleConfig = - ItemConfig::GetCollectible(&g_manager->_itemConfig,*GHIDRA_CAST((unaff_EBP + -0x50))) - , collectibleConfig == GHIDRA_CAST(0x0))) { - format = "[warn] Invalid Monster Manual collectible %d\n"; - goto LAB_009d4590; - } - bVar7 = *GHIDRA_CAST((unaff_EBP + -0x35)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x35)) = bVar7; - } while (bVar7 < *GHIDRA_CAST((unaff_EBP + -0x1d))); - } - } - if (0x89 < GHIDRA_UINT(puVar16[2])) { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x3c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x3c)); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x3c)) != 0) { - *GHIDRA_CAST((unaff_EBP + -0x44)) = iVar9 + 0x5d4; - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x38,2,1); - *GHIDRA_CAST((unaff_EBP + -0x48)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x38))); - Checksum::Update(checksum2,GHIDRA_CAST((unaff_EBP + -0x48)),2); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,2,1); - *GHIDRA_CAST((unaff_EBP + -0x48)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - Checksum::Update(checksum2,GHIDRA_CAST((unaff_EBP + -0x48)),2); - *GHIDRA_CAST((unaff_EBP + -0x54)) = GHIDRA_INT(*GHIDRA_CAST((unaff_EBP + -0x38))); - *GHIDRA_CAST((unaff_EBP + -0x50)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - std_map_int_insert(*(void **)(unaff_EBP + -0x44),(void *)(unaff_EBP + -0x78), - GHIDRA_CAST((unaff_EBP + -0x54))); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x1c)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x3c))); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - } - } - *GHIDRA_CAST((unaff_EBP + -0x3c)) = iVar9 + 0x4b0; - msvc::deque::_Tidy(); - if (0x9c < GHIDRA_UINT(puVar16[2])) { - piVar17 = GHIDRA_CAST(*puVar16); - *GHIDRA_CAST((unaff_EBP + -0x28)) = 0; - (**(code **)(*piVar17 + 0x14))(unaff_EBP + -0x28,4,1); - pvVar11 = *(void **)(unaff_EBP + -0x40); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *GHIDRA_CAST((unaff_EBP + -0x28)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x1c)),4); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x28)) != 0) { - do { - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x80,4,1); - *GHIDRA_CAST((unaff_EBP + -0x48)) = *GHIDRA_CAST((unaff_EBP + -0x80)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x48)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x7c,4,1); - *GHIDRA_CAST((unaff_EBP + -0x48)) = *GHIDRA_CAST((unaff_EBP + -0x7c)); - Checksum::Update(pvVar11,GHIDRA_CAST((unaff_EBP + -0x48)),4); - msvc::deque::push_back(unaff_EBP + -0x80); - uVar8 = *GHIDRA_CAST((unaff_EBP + -0x1c)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = uVar8; - } while (uVar8 < *GHIDRA_CAST((unaff_EBP + -0x28))); - } - } - uVar10 = 1; - goto LAB_009d459c; - } - piVar17 = GHIDRA_CAST((iVar9 + 0x50c)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(piVar17,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *piVar17; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - if ((*piVar17 < 1) || - (collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,*piVar17), - collectibleConfig != GHIDRA_CAST(0x0))) goto LAB_009d3f14; - format = "[warn] Invalid modeling clay effect %d\n"; -LAB_009d4590: - KAGE_LogMessage(1,GHIDRA_CAST(format)); - } - else { - fieldPtr = GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x48c)); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(fieldPtr,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *fieldPtr; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - (**(code **)(*GHIDRA_CAST(*puVar16) + 0x14))(unaff_EBP + -0x30,2,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),2); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - *GHIDRA_CAST((unaff_EBP + -4)) = 10; - uVar8 = GHIDRA_UINT(*GHIDRA_CAST((unaff_EBP + -0x30))); - iVar18 = *GHIDRA_CAST((iVar9 + 0x51c)); - iVar19 = *GHIDRA_CAST((iVar9 + 0x518)); - *GHIDRA_CAST((unaff_EBP + -0x44)) = iVar18; - uVar14 = iVar18 - iVar19 >> 4; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = iVar19; - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - if (uVar8 < uVar14) { - iVar18 = uVar8 * 0x10 + *GHIDRA_CAST((iVar9 + 0x518)); -LAB_009d2c3f: - *GHIDRA_CAST((iVar9 + 0x51c)) = iVar18; - } - else if (uVar14 < uVar8) { - if (uVar8 <= GHIDRA_UINT((*GHIDRA_CAST((iVar9 + 0x520)) - *GHIDRA_CAST((unaff_EBP + -0x1c)) >> 4))) { - iVar18 = uVar8 - uVar14; - *GHIDRA_CAST((unaff_EBP + -0x1c)) = iVar18; - if (iVar18 == 0) { - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x44)); - } - else { - memset(*(void **)(unaff_EBP + -0x44),0,iVar18 * 0x10); - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x44)) + *GHIDRA_CAST((unaff_EBP + -0x1c)) * 0x10; - } - goto LAB_009d2c3f; - } - msvc::vector<16byte>::_Resize_reallocate(uVar8,uVar8); - } - *GHIDRA_CAST((unaff_EBP + -4)) = 0xffffffff; - *GHIDRA_CAST((unaff_EBP + -0x44)) = 0; - if (*GHIDRA_CAST((unaff_EBP + -0x30)) == 0) goto LAB_009d2c5b; - while (cVar6 = (**(code **)(*GHIDRA_CAST(*puVar16) + 0x10))(), cVar6 == '\0') { - iVar19 = (*GHIDRA_CAST((unaff_EBP + -0x44)) & 0xffff) * 0x10; - puVar16 = GHIDRA_CAST((*GHIDRA_CAST((iVar9 + 0x518)) + iVar19)); - (**(code **)(*GHIDRA_CAST(**GHIDRA_CAST((unaff_EBX + 8))) + 0x14))(puVar16,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *puVar16; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - puVar16 = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x518)) + 4 + iVar19)); - (**(code **)(*GHIDRA_CAST(**GHIDRA_CAST((unaff_EBX + 8))) + 0x14))(puVar16,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *puVar16; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - puVar16 = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x518)) + 8 + iVar19)); - (**(code **)(*GHIDRA_CAST(**GHIDRA_CAST((unaff_EBX + 8))) + 0x14))(puVar16,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *puVar16; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - puVar16 = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((unaff_EBP + -0x24)) + 0x518)) + 0xc + iVar19)); - (**(code **)(*GHIDRA_CAST(**GHIDRA_CAST((unaff_EBX + 8))) + 0x14))(puVar16,4,1); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = *puVar16; - Checksum::Update(*(void **)(unaff_EBP + -0x28),GHIDRA_CAST((unaff_EBP + -0x1c)),4); - iVar9 = *GHIDRA_CAST((unaff_EBP + -0x24)); - iVar18 = *GHIDRA_CAST((iVar19 + 4 + *GHIDRA_CAST((iVar9 + 0x518)))); - iVar19 = *GHIDRA_CAST((iVar19 + *GHIDRA_CAST((iVar9 + 0x518)))); - *GHIDRA_CAST((unaff_EBP + -0x1c)) = iVar18; - bVar7 = is_valid_item_config_id(iVar19,iVar18); - if (bVar7 == 0) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Invalid temporary effect (type: %d, ID: %d)\n")); - goto code_r0x009d459a; - } - iVar18 = *GHIDRA_CAST((unaff_EBP + -0x44)) + 1; - *GHIDRA_CAST((unaff_EBP + -0x44)) = iVar18; - if (*GHIDRA_CAST((unaff_EBP + -0x30)) <= (uint16_t)iVar18) goto LAB_009d2c5b; - puVar16 = *GHIDRA_CAST((unaff_EBX + 8)); - } -LAB_009d1988: - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Invalid costume count %d. Save file %s might be corrupt.\n")); - } -code_r0x009d459a: - uVar10 = 0; -LAB_009d459c: - ExceptionList = *(void **)(unaff_EBP + -0xc); - return uVar10; -} - -// 00a9f630 -void Entity_Player::AddTrinket(int param_2, char param_3) -{ - uint32_t streamSize; - uint32_t unaff_EBX; - int unaff_ESI; - uint32_t streamSize; - int iVar2; - uint32_t nextChunkOffset; - uint32_t unaff_EDI; - uint32_t uStack_2c; - uint32_t *puStack_28; - int iStack_24; - int local_1c; - uint8_t riffHeader [12]; - uint32_t local_c; - - local_c = __security_cookie ^ GHIDRA_UINT(&uStack_2c); - local_1c = param_2; - streamSize = this->Init(); - this->Render(riffHeader,0xc,1); - streamSize = 0xc; - if (iStack_24 != 0x46464952) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Not RIFF format.\n")); - } - if (local_1c != 0x45564157) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Not Wave format.\n")); - } - if (0xc < streamSize) { - do { - this->Render(riffHeader + -0x1c,8,1); - iVar2 = streamSize + 8; - if (unaff_ESI == 0x20746d66) { - this->Render(uStack_2c,0x10,1); - nextChunkOffset = streamSize + 0x18; - if (0x10 < unaff_EBX) { - this->Render(riffHeader + -0x20,2,1); - iVar2 = streamSize + 0x1a; - streamSize = unaff_EDI & 0xffff; -LAB_00a9f733: - nextChunkOffset = iVar2 + streamSize; - if (nextChunkOffset == streamSize) { - return; - } - this->Update(streamSize,1); - } - } - else { - if (unaff_ESI != 0x61746164) { - streamSize = unaff_EBX; - goto LAB_00a9f733; - } - if (puStack_28 == GHIDRA_CAST(0x0)) { - return; - } - *puStack_28 = unaff_EBX; - if (param_3 != '\0') { - return; - } - this->Render(puStack_28[1],1,unaff_EBX); - nextChunkOffset = iVar2 + unaff_EBX; - } - streamSize = nextChunkOffset; - } while (nextChunkOffset < streamSize); - } - return; -} diff --git a/generated-src/entity_projectile.cpp b/generated-src/entity_projectile.cpp deleted file mode 100644 index 37883d1..0000000 --- a/generated-src/entity_projectile.cpp +++ /dev/null @@ -1,3476 +0,0 @@ -#include "classes.h" - -// 00417830 -uint64_t Entity_Projectile::ProjectileFlags() -{ - return this->_projectileFlags; -} - -// 00444c90 -void Entity_Projectile::set_falling_accel(float accel) -{ - this->_fallingAccel = accel; - return; -} - -// 00447740 -void Entity_Projectile::set_projectile_flags(uint64_t flags) -{ - this->_projectileFlags = flags; - return; -} - -// 00456420 -void Entity_Projectile::AddHeight(float param_2) -{ - this->_height = param_2 + this->_height; - return; -} - -// 00456450 -void Entity_Projectile::AddFallingSpeed(float param_2) -{ - this->_fallingSpeed = param_2 + this->_fallingSpeed; - return; -} - -// 00456470 -void Entity_Projectile::AddFallingAccel(float param_2) -{ - this->_fallingAccel = param_2 + this->_fallingAccel; - return; -} - -// 00456490 -void Entity_Projectile::AddProjectileFlags(uint64_t flags) -{ - uint32_t *flagsHigh; - - *GHIDRA_CAST(&this->_projectileFlags) = GHIDRA_UINT(this->_projectileFlags) | GHIDRA_UINT(flags); - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *flagsHigh = *flagsHigh | (*GHIDRA_CAST((GHIDRA_CAST(&(flags)) + 0x4))); - return; -} - -// 004b70a0 -int Entity_Projectile::ChangeTimeout() -{ - return this->_changeTimeout; -} - -// 004d3060 -long double Entity_Projectile::CurvingStrength() -{ - return (long double)this->_curvingStrength; -} - -// 004d3070 -int Entity_Projectile::WiggleFrameOffset() -{ - return this->_wiggleFrameOffset; -} - -// 00652b00 -void Entity_Projectile::Constructor() -{ - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Projectile::vftable; - this->_isRenderedAtGround = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x464)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x460)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x46c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x468)))) = 0; - return; -} - -// 00652b90 -void Entity_Projectile::Init(int type, int variant, int subType, uint32_t initSeed) -{ - uint32_t uVar1; - LayerState *layer; - int iVar2; - uint64_t flags; - uint32_t *flagsHigh; - double uintFixup; - float velX; - - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Init(type,variant,subType,initSeed); - this->_entityGridCollisionClass = 4; - if (this->_config != (void *)0x0) { - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); - } - this->_height = -23.0; - uVar1 = Random(); - this->_fallingAccel = 0.0; - this->_scale = 1.0; - *GHIDRA_CAST(&this->_projectileFlags) = 0; - iVar2 = this->_variant; - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)) = 0; - this->_homingStrength = 1.0; - this->_curvingStrength = 0.015; - this->_acceleration = 1.01; - uintFixup = __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]; - this->_orbitDistance = 0.0; - this->_animKey = -1; - this->_collisionDamage = 1.0; - this->_isRenderedAtGround = 0; - *GHIDRA_CAST(&this->_changeFlags) = 0; - *GHIDRA_CAST((GHIDRA_INT(&this->_changeFlags) + 4)) = 0; - this->_changeVelocity = 0.0; - this->_changeTimeout = 0x1e; - this->_maxHitPoints = 0.0; - this->_fallingSpeed = ((float)((double)GHIDRA_INT(uVar1) + uintFixup) * 2.3283064e-10 - 0.5) * 0.2; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x460)))) = g_vectorZero.x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x464)))) = g_vectorZero.y; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x470)))) = 0; - uVar1 = g_graphicsManager_flags; - if (iVar2 == 2) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - iVar2 = 1; - if ((uVar1 & 4) == 0) { - iVar2 = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = iVar2; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - (layer->_pos).x = 0.0; - (layer->_pos).y = 8.0; - } - } - if ((this->_spawnerEntity != 0) && ((*GHIDRA_CAST((this->_spawnerEntity + 0x16c)) & 0x400000) != 0)) { - velX = (this->_velocity).x; - flags = this->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x400000; - *GHIDRA_CAST(&this->_flags) = GHIDRA_INT(flags); - (this->_velocity).x = velX * 0.8; - (this->_velocity).y = (this->_velocity).y * 0.8; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x468)))) = g_vectorZero.x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x46c)))) = g_vectorZero.y; - FUN_008624b0(this); - return; -} - -// 00652f60 -uint8_t Entity_Projectile::CanShutDoors() -{ - if ((this->_variant == 0xb) && ((this->_projectileFlags & 0x80000000) == 0)) { - return 1; - } - return 0; -} - -// 00652fa0 -void Entity_Projectile::Reflect(Entity *unused, Vector *newVelocity) -{ - int *parentSlot [2]; - uint64_t changeFlags; - uint32_t *flagsHigh; - uint32_t *parent; - uint64_t projectileFlags; - - changeFlags = this->_changeFlags; - parent = &this->_parent; - projectileFlags = this->_projectileFlags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *flagsHigh = *flagsHigh & 0xfffffffe; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_changeFlags) + 4)); - *flagsHigh = *flagsHigh & 0xfffffffe; - *GHIDRA_CAST(&this->_changeFlags) = GHIDRA_UINT(changeFlags) & 0xfbe3e7fe | 0x80000080; - *GHIDRA_CAST(&this->_projectileFlags) = GHIDRA_UINT(projectileFlags) & 0xfbe3e7fe | 0x80000080; - (this->_velocity).x = newVelocity->x; - (this->_velocity).y = newVelocity->y; - if (*parent != 0) { - parentSlot[0] = parent; - msvc::multiset::erase(parentSlot); - } - *parent = 0; - this->_dead = 0; - if ((0.0 < this->_fallingAccel) && (0.0 < this->_fallingSpeed)) { - this->_fallingSpeed = -this->_fallingSpeed * 0.85; - } - return; -} - -// 00653070 -void Entity_Projectile::Update() -{ - uint32_t *puVar1; - uint32_t projFlagsHigh; - Vector pos; - Vector pos_00; - Vector pos_01; - uint8_t bVar3; - char cVar4; - uint32_t uVar5; - void *extraout_EAX; - int sizeIndex; - AnimationState *animState; - ColorMod *color; - Room *room; - int sizeIndex; - ColorMod *tmpColor; - Vector *vecResult; - Font *spriteColor; - Vector *vecResult2; - Entity *tmpEntity; - Sprite *sprite; - LayerState *layer; - Entity_Projectile *otherProjectile; - Entity_Effect *pEVar7; - ANM2 *anm2; - EntityList *entityList; - Entity_Projectile *pEVar8; - uint32_t uVar9; - uint32_t *listEntry; - ColorMod *color_00; - float *pfVar10; - Entity_Player **ppEVar11; - Entity_Player *player; - PlayerManager *playerManager; - RNG *this_00; - TearParams *other; - TearParams *extraout_EAX_00; - Entity_Tear *this_01; - uint8_t *puVar12; - TemporaryEffects *tempEffects; - int *piVar13; - Color *pCVar14; - KColor *this_02; - char *animFormat; - code *vfunc; - Entity_NPC *this_03; - Entity_Player *tmpEntity; - long double fVar16; - float in_XMM0_Da; - float fVar17; - uint8_t auVar18 [16]; - float fVar19; - float fVar20; - uint64_t projFlags; - Color aCStackY_1c2c [128]; - void *pvVar21; - KColor purpleGlowColor; - KColor orangeGlowColor; - Vector triangleFirstVelocity; - Vector sineVelocityOffset; - Vector sawtoothRightVelocity; - Vector sawtoothLeftVelocity; - Vector angleDir; - Vector angleVelocity; - Vector homingTargetPos; - Vector tractorVelocity; - Vector orbitSteer; - Vector sawtoothFirstVelocity; - Vector orbitSteerDir; - Vector megaWiggleOffset; - Vector orbitVelocity; - Vector flippedHorizontalVelocity; - Vector wiggleOffset; - Vector triangleRightVelocity; - Vector triangleLeftVelocity; - Vector VStack_518; - Vector VStack_510; - Vector VStack_508; - Vector VStack_500; - uint8_t entityQuery2 [24]; - Vector toPlayer; - int modemChance; - float tractorSpeed; - float speed; - Vector VStack_4cc; - Vector VStack_4c4; - Vector VStack_4bc; - Vector VStack_4b4; - Vector orbitParentTangent; - Vector VStack_4a4; - float accelerateFactor; - float accelerateExFactor; - float decelerateFactor; - float speedCapScale; - float megaWiggleAmount; - float wiggleAmount; - float sineFactor; - float wiggleStrength; - Vector VStack_47c; - Vector VStack_474; - Vector VStack_46c; - uint8_t entityQuery [36]; - Vector VStack_440; - Vector VStack_438; - Vector VStack_430; - Vector VStack_428; - Vector fromOrbitParent; - Vector VStack_418; - float fStack_410; - float fStack_40c; - Vector VStack_408; - Vector VStack_400; - Vector VStack_3f8; - Vector VStack_3f0; - Vector VStack_3e4; - Vector VStack_3dc; - uint8_t isSideView; - Vector *pVStack_3d0; - Vector VStack_3cc; - Vector *pVStack_3c4; - char isCircleProc; - float fStack_3bc; - Vector tmpVecC; - Vector VStack_3b0; - Vector VStack_3a8; - Vector VStack_3a0; - Vector *pVStack_398; - Vector scratchVec; - Vector tmpVecB; - Vector *pVStack_384; - float fStack_380; - float fStack_37c; - Entity_Player *pEStack_378; - Entity_Player *pEStack_374; - Vector tmpVecA; - Entity_Player *pEStack_368; - Entity_Player *pEStack_364; - Entity_Player *pEStack_360; - Entity_Player *pEStack_35c; - Entity_Effect *pEStack_358; - Entity_Player *pEStack_354; - Entity_Projectile *projectile; - Entity_Player *pEStack_34c; - TearParams TStack_348; - TearParams TStack_2e0; - TearParams spawnerTearParams; - Color cyanTrailColor; - Color purpleTrailColor; - Color orangeTrailColor; - uint8_t auStack_160 [44]; - Color purpleTint; - Color CStack_108; - RNG rng; - uint8_t auStack_cc [64]; - uint8_t auStack_8c [40]; - uint8_t animName [12]; - KColor blueGlowColor; - uint8_t subtypeHigh [8]; - uint8_t auStack_3c [8]; - Vector VStack_34; - float forwardDirX; - float forwardDirY; - uint32_t securityCookie; - uint8_t *puStack_20; - void *pvStack_1c; - uint8_t *puStack_18; - uint32_t uStack_14; - uint32_t projFlagsHigh; - uint64_t savedProjFlags; - - puStack_20 = auStack_3c + 0x38; - uStack_14 = -1; - puStack_18 = &UNK_00af75f6; - pvStack_1c = ExceptionList; - securityCookie = __security_cookie ^ GHIDRA_UINT((auStack_3c + 0x2c)); - ExceptionList = &pvStack_1c; - pEStack_368 = GHIDRA_CAST(0x0); - VStack_3cc.y = (float)&this->_speedMultiplier; - projectile = this; - FUN_00652df0(); - this->_speedMultiplier = in_XMM0_Da; - if (0 < this->_pauseTimer) { - this->_pauseTimer = this->_pauseTimer + -1; - } - if ((this->_projectileFlags & 0x40003810) != 0) { - this->_collidesWithGrid = 0; - } - if (((this->_flags & 0x20) != 0) && (this->_freezeCountdown < 1)) { - uVar5 = Random(); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(uVar5 % 7 + 0xc,0); - if (bVar3 != 0) { - *GHIDRA_CAST(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xffffffdf; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x460)))) = g_vectorZero.x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x464)))) = g_vectorZero.y; - goto LAB_00653169; - } - } - if (((this->_flags & 0x20) != 0) && (this->_dead == 0)) { - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - ExceptionList = pvStack_1c; - return; - } - sizeIndex = this->_variant; - if ((((sizeIndex == 0) || (sizeIndex == 3)) || (sizeIndex == 4)) || (sizeIndex == 6)) { - sizeIndex = GHIDRA_INT((this->_scale * 3.0 + 3.0)); - sizeIndex = 0xd; - if (sizeIndex < 0xd) { - sizeIndex = sizeIndex; - } - if (this->_animKey != sizeIndex) { - if (this->_spawnerType == 0x3b6) { - animFormat = "DogmaElectricTear%d"; - if ((this->_projectileFlags & 0xc00000000000) == 0) { - animFormat = "DogmaTear%d"; - } - sprintf_s(subtypeHigh,0x20,GHIDRA_CAST(animFormat)); - this->_renderDepthOffset = 300.0; - piVar13 = &(this->_sprite)._bitflags; - *piVar13 = *piVar13 | 0x20; - } - else { - sprintf_s(subtypeHigh,0x20,GHIDRA_CAST("RegularTear%d")); - } - ANM2::Play(&this->_sprite,subtypeHigh,0); - this->_animKey = sizeIndex; - } - } - else if (sizeIndex == 1) { - if (this->_animKey != 100) { - if ((this->_projectileFlags & 0x200000000000) != 0) { - (GHIDRA_CAST((auStack_3c)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/bone_projectile_holy.png")); - uStack_14 = 0; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST(auStack_3c)); - uStack_14 = -1; - (GHIDRA_CAST((auStack_3c)))->msvc::string::_Tidy_deallocate(); - ANM2::LoadGraphics(&this->_sprite,0); - } - ANM2::Play(&this->_sprite,&DAT_00b1d6fc,0); - pvVar21 = (this->_sprite)._animState._animData; - if (pvVar21 != (void *)0x0) { - AnimationState::SetFrameFloat - (&(this->_sprite)._animState, - (float)GHIDRA_INT((GHIDRA_UINT((this->_dropRNG)._seed) % *GHIDRA_CAST((GHIDRA_CAST(pvVar21) + 0x30))))); - } - this->_animKey = 100; - } - } - else if (sizeIndex == 2) { - if (this->_animKey != 200) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Flickering"),0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar5 = AnimationState::GetAnimationLength(animState); - uVar9 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(uVar9 % uVar5); - (GHIDRA_CAST((auStack_cc + 0x2c)))->BlendMode::SetMode(2,0); - pvVar21 = extraout_EAX; - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,pvVar21); - this->_animKey = 200; - this->_isInitFlag176 = 0; - } - pEStack_34c = GHIDRA_CAST(Math)::clamp(0.1,1.0,this->_updateTime / 15.0); - ppEVar11 = &pEStack_34c; - vecResult = &tmpVecA; -LAB_0065334c: - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(vecResult,GHIDRA_CAST(ppEVar11)); - layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(vecResult); - } - else if (sizeIndex == 5) { - if (this->_animKey != 300) { - animFormat = "Small%02d"; - if (6.0 < this->_scale * 3.0 + 3.0) { - animFormat = &UNK_00b64a24; - } - Isaac::Random(4); - sprintf_s(auStack_8c + 8,0x20,GHIDRA_CAST(animFormat)); - ANM2::Play(&this->_sprite,auStack_8c + 8,0); - this->_animKey = 300; - } - } - else { - if (sizeIndex == 7) { - if (this->_animKey != 400) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("MoveHori"),0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar5 = AnimationState::GetAnimationLength(animState); - uVar9 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(uVar9 % uVar5); - this->_animKey = 400; - } - fVar19 = (this->_velocity).y; - FUN_00456230(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar19 * 57.295776); - ppEVar11 = &pEStack_354; - pEStack_354 = GHIDRA_CAST((this->_scale / 2.75)); - vecResult = &tmpVecB; - goto LAB_0065334c; - } - if ((sizeIndex == 0xc) && (this->_animKey != 700)) { - animFormat = &UNK_00b64a64; - if (this->_scale <= 1.5 && this->_scale != 1.5) { - animFormat = "Small"; - } - ANM2::Play(&this->_sprite,GHIDRA_CAST(animFormat),0); - this->_animKey = 700; - } - } - pEStack_358 = GHIDRA_CAST(&this->_scale); - fVar19 = this->_scale * *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x24)); - sizeIndex = this->_variant; - this->_shadowSize = fVar19; - if (sizeIndex == 8) { - this->_shadowSize = fVar19 + fVar19; - } - else if (sizeIndex == 9) { - if (this->_animKey != 500) { - sprintf_s(animName,0x20,GHIDRA_CAST("Rotate%d")); - ANM2::Play(&this->_sprite,animName,0); - this->_animKey = 500; - } - } - else if (sizeIndex == 0xb) { - if (this->_animKey != 600) { - ANM2::Play(&this->_sprite,&DAT_00b1d6fc,0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar5 = AnimationState::GetAnimationLength(animState); - uVar9 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(uVar9 % uVar5); - projectile->_animKey = 600; - this = projectile; - } - } - else { - if (sizeIndex == 0xd) { - player = GHIDRA_CAST(&this->_sprite); - pEStack_35c = player; - if (this->_animKey != 800) { - ANM2::Play(GHIDRA_CAST(player),&DAT_00b1d6fc,0); - bVar3 = EntityPtr::Ref(); - set_byte_0x101(player,bVar3 & 1); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar5 = AnimationState::GetAnimationLength(animState); - uVar9 = EntityPtr::Ref(); - player = pEStack_35c; - (GHIDRA_CAST((GHIDRA_CAST(pEStack_35c))))->Sprite::SetFrame_1(uVar9 % uVar5); - this = projectile; - projectile->_animKey = 800; - (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::AddFlagsLow(); -LAB_00653797: - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&tmpVecC,&this->_scale); - (GHIDRA_CAST((GHIDRA_CAST(player))))->Sprite::SetScale(vecResult); - } - } - else { - if (sizeIndex != 0xe) { - if (sizeIndex == 0xf) { - if (this->_animKey != 1000) { - anm2 = &this->_sprite; - ANM2::Play(anm2,s_Idle,0); - this = projectile; - bVar3 = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST(anm2))))->Sprite::set_flip_x(bVar3 & 1); - uVar5 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(4); - pEStack_35c = (Entity_Player *) - ((float)((double)GHIDRA_INT(uVar5) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 48.0); - layer = (GHIDRA_CAST((GHIDRA_CAST(anm2))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - (layer->_cropOffset).x = (float)pEStack_35c; - fVar19 = random_float(); - (GHIDRA_CAST((GHIDRA_CAST(anm2))))->Sprite::SetRotation(fVar19 * 20.0 - 10.0); - this->_animKey = 1000; - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&tmpVecC,GHIDRA_CAST(pEStack_358)); - (GHIDRA_CAST((GHIDRA_CAST(anm2))))->Sprite::SetScale(vecResult); - } - } - else if (sizeIndex == 0x10) { - pVStack_3c4 = GHIDRA_CAST(&DAT_0000000d); - pEStack_35c = GHIDRA_CAST(GHIDRA_INT((this->_scale * 3.0 + 3.0))); - piVar13 = GHIDRA_CAST(std)::min(); - pEStack_35c = GHIDRA_CAST((*piVar13 + 0x44c)); - if (GHIDRA_CAST(this->_animKey) != pEStack_35c) { - sprintf_s(animName,0x20,GHIDRA_CAST("RegularTear%d")); - ANM2::Play(&this->_sprite,animName,0); - this->_animKey = GHIDRA_INT(pEStack_35c); - } - pEStack_35c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::GetAngleDegrees(); - if (((float)pEStack_35c < -90.0) || (90.0 < (float)pEStack_35c)) { - pEStack_364 = GHIDRA_CAST((180.0 - (float)pEStack_35c)); - pEStack_360 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(pEStack_360)) + 0x1))),1)); - } - else { - pEStack_360 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(pEStack_360))) + 0x1))) << 8)); - pEStack_364 = pEStack_35c; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x((uint8_t)pEStack_360); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation((float)pEStack_364); - if (this->_child == 0) { - uVar5 = Random(); - pEVar7 = (Entity_Effect *) - Game::Spawn(g_game,1000,0xa6,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity)::GetSprite(); - (GHIDRA_CAST((&CStack_108)))->Color::Color(0.9,0.0,0.0,0.8); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(color); - (GHIDRA_CAST((auStack_cc + 0x2c)))->BlendMode::SetMode(1,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity)::GetSprite(); - puVar12 = auStack_cc + 0x2c; - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,puVar12); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity)::GetSprite(); - pEStack_35c = GHIDRA_CAST((*GHIDRA_CAST(pEStack_358) + *GHIDRA_CAST(pEStack_358))); - vecResult = Vector::operator_mul(&tmpVecC,GHIDRA_CAST(&pEStack_35c),&g_vectorOne); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(vecResult); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetRadii(0.15,0.15); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetParent(GHIDRA_CAST(projectile)); - pEVar7->Update(); - this = projectile; - (GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity::SetChild(GHIDRA_CAST(pEVar7)); - if (this->_child == 0) goto LAB_00653bc5; - } - if (this->_visible == 0) { - sprite = GHIDRA_CAST((GHIDRA_CAST(()))->Entity)::GetSprite(); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((sprite)))->Sprite)::Color(); - Font::SetLineHeightModifier(spriteColor,0.0); - } - else { - sprite = GHIDRA_CAST((GHIDRA_CAST(()))->Entity)::GetSprite(); - spriteColor = GHIDRA_CAST((GHIDRA_CAST((sprite)))->Sprite)::Color(); - pCVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - fVar19 = (GHIDRA_CAST((pCVar14)))->Color::A(); - pEStack_35c = GHIDRA_CAST((fVar19 * 0.5)); - Font::SetLineHeightModifier(spriteColor,(float)pEStack_35c); - tmpEntity = GHIDRA_CAST(this->_child); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&tmpVecC,&this->_posOffset); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPosition(vecResult); - (GHIDRA_CAST((GHIDRA_CAST(this->_child))))->Entity::SetVelocity(&this->_velocity); - } - } - goto LAB_00653bc5; - } - player = GHIDRA_CAST(&this->_sprite); - pEStack_35c = player; - if (this->_animKey != 900) { - ANM2::Play(GHIDRA_CAST(player),&DAT_00b1d6fc,0); - bVar3 = EntityPtr::Ref(); - set_byte_0x101(player,bVar3 & 1); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - uVar5 = AnimationState::GetAnimationLength(animState); - uVar9 = EntityPtr::Ref(); - player = pEStack_35c; - (GHIDRA_CAST((GHIDRA_CAST(pEStack_35c))))->Sprite::SetFrame_1(uVar9 % uVar5); - projectile->_animKey = 900; - this = projectile; - goto LAB_00653797; - } - } - fVar19 = (this->_velocity).y; - FUN_00456230(); - pEStack_35c = GHIDRA_CAST((fVar19 * 57.295776)); - cVar4 = (GHIDRA_CAST((GHIDRA_CAST(player))))->Sprite::FlipY(); - if (cVar4 == '\0') { - puVar12 = GHIDRA_CAST(0x3f800000); - } - else { - puVar12 = &DAT_bf800000; - } - (GHIDRA_CAST((GHIDRA_CAST(player))))->Sprite::SetRotation(((float)pEStack_35c + 180.0) * (float)puVar12); - } -LAB_00653bc5: - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - isSideView = (GHIDRA_CAST((room)))->Room::is_type_16(); - if ((isSideView != 0) && (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), sizeIndex == 1)) { - if (0.0 < this->_fallingAccel) { - pEStack_34c = GHIDRA_CAST((this->_velocity).y); - fVar19 = (this->_velocity).x; - Math::abs(); - if ((float)pEStack_34c < fVar19) { - (this->_velocity).y = this->_fallingSpeed * 0.5 + (float)pEStack_34c; - } - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = (GHIDRA_CAST((room)))->Room::IsBeastDungeon(); - if (bVar3 == 0) { - uVar5 = GHIDRA_UINT(this->_projectileFlags); - if ((uVar5 & 2) != 0) { - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)) = - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *GHIDRA_CAST(&this->_projectileFlags) = uVar5 & 0xffffdfef; - } - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - fVar19 = 0.2; - if (sizeIndex == 1) { - savedProjFlags = this->_projectileFlags; - if ((savedProjFlags & 0x9800000000) == 0) { - if (((this->_projectileFlags & 2) != 0) && (this->_spawnerType == 0x389)) { - fVar20 = 1.0; - fVar17 = 0.8; - this_02 = &purpleGlowColor; - goto LAB_00653d5c; - } - if ((savedProjFlags & 0x200000000000) != 0) { - fVar20 = 1.0; - fVar19 = 0.8; - fVar17 = 0.1; - this_02 = &blueGlowColor; - goto LAB_00653d5c; - } - if ((savedProjFlags & 0x80000000000000) != 0) { - fVar19 = 0.0; - this_02 = GHIDRA_CAST((auStack_8c + 0x14)); - goto LAB_00653d51; - } - if ((savedProjFlags & 0x800000000000) != 0) { - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x7b,&this->_pos,&this->_velocity, - GHIDRA_CAST(this->_spawnerEntity),4,uVar5); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&tmpVecA,&this->_scale); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - (GHIDRA_CAST((tmpEntity)))->Entity::SetParent(GHIDRA_CAST(this)); - tmpEntity->Update(); - } - } - else { - this_02 = &orangeGlowColor; -LAB_00653d51: - fVar17 = 1.0; - fVar20 = 0.0; -LAB_00653d5c: - (GHIDRA_CAST((this_02)))->KColor::KColor(fVar17,fVar19,fVar20,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_pos))))->Entity::AddFear(); - } - if (((this->_projectileFlags & 0x20000000000000) != 0) && - (pEStack_35c = GHIDRA_CAST(this->_subtype), - &(*GHIDRA_CAST((GHIDRA_CAST(&(pEStack_35c[-1])) + 0x2eff))) < GHIDRA_CAST(0x3e7))) { - fStack_380 = this->_scale; - pEStack_360 = pEStack_35c; - if (100 < GHIDRA_INT(pEStack_35c)) { - pEStack_360 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEStack_35c[-1])) + 0x2e9c)))); - } - if (0 < GHIDRA_INT(pEStack_360)) { - pEStack_374 = pEStack_360; - do { - uVar5 = Random(); - player = (Entity_Player *) - Game::Spawn(g_game,9,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(this->_spawnerEntity),0 - ,uVar5); - pEStack_354 = player; - (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::SetTarget(GHIDRA_CAST(this)); - (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::SetParent(GHIDRA_CAST(this->_parent)); - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((GHIDRA_CAST(auStack_cc))))->Color::operator_assign(tmpColor); - sizeIndex = Isaac::Random(2); - if (sizeIndex == 0) { - pEStack_364 = GHIDRA_CAST(0x40800000); - } - else { - pEStack_364 = GHIDRA_CAST(0x3f800000); - } - FUN_005cd370(); - FUN_005cd380(); - FUN_005cd3a0(); - player->SetColor(); - set_projectile_flags(GHIDRA_CAST(player),0x20000000002000); - random_float(); - FUN_00565de0(); - vecResult = (GHIDRA_CAST((&tmpVecA)))->Vector::Vector(20.0,8.0); - vecResult = Vector::operator_mul(&tmpVecB,&fStack_380,vecResult); - fVar19 = random_float(); - pEStack_34c = GHIDRA_CAST((fVar19 * 0.2 + 0.8)); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecC,GHIDRA_CAST(&pEStack_34c)); - (GHIDRA_CAST((GHIDRA_CAST(pEStack_354))))->Entity::SetTargetPosition(*vecResult); - random_float(); - FUN_004508a0(); - if (100 < GHIDRA_INT(pEStack_35c)) { - FUN_00435cd0(); - } - pEStack_374 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEStack_374[-1])) + 0x2eff)))); - } while (pEStack_374 != GHIDRA_CAST(0x0)); - pEStack_374 = GHIDRA_CAST(0x0); - } - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - Font::SetLineHeightModifier(spriteColor,0.0); - this->_subtype = 1000; - } - } - VStack_408.x = *GHIDRA_CAST(&this->_projectileFlags); - if ((this->_projectileFlags & 0x4000000000) != 0) { - fVar19 = 45.0; - if (((this->_subtype == 0) && (this->_spawnerType == 0x3d)) && (this->_spawnerVariant == 7)) { - fVar19 = 10.0; - } - if (fVar19 < this->_updateTime) { - this->_dead = 1; - } - } - if ((((this->_projectileFlags & 0x20000000000000) != 0) && - (GHIDRA_CAST(this->_target) != GHIDRA_CAST(0x0))) && - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::IsProjectile(), bVar3 != 0)) { - vecResult = Vector::FromAngle(&tmpVecA,this->_homingStrength); - Vector::operator_mul(&VStack_418,&(this->_targetPosition).x,vecResult); - vecResult = Vector::FromAngle(&tmpVecA,this->_homingStrength + 90.0); - Vector::operator_mul(&VStack_438,&(this->_targetPosition).y,vecResult); - sizeIndex = Game::GetFrameCount(g_game); - pEStack_360 = (Entity_Player *) - ((((float)(GHIDRA_UINT((sizeIndex + this->_initSeed)) % 0x1e) + 0.0) * 6.2831855) / 30.0); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Position(&tmpVecA); - player = pEStack_360; - FUN_00417150(); - pEStack_34c = player; - vecResult2 = Vector::operator_mul(&tmpVecB,GHIDRA_CAST(&pEStack_34c),&VStack_418); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecC,vecResult2); - pEStack_354 = GHIDRA_CAST(sinf_wrapper((float)pEStack_360)); - vecResult2 = Vector::operator_mul(&VStack_3f8,GHIDRA_CAST(&pEStack_354),&VStack_438); - (GHIDRA_CAST((vecResult)))->Vector::__add(&VStack_46c,vecResult2); - vecResult = (GHIDRA_CAST((&VStack_46c)))->Vector::__sub(&VStack_3b0,&this->_pos); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(vecResult); - this->_friction = 1.0; - this->_fallingSpeed = 0.0; - this->_height = -23.0; - } - if (((this->_projectileFlags & 0x200000000000) == 0) || - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), sizeIndex == 0)) { - if ((this->_spawnerType == 0x33c) && - ((this->_variant == 1 && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), sizeIndex != 0)))) { - uVar5 = Random(); - pEStack_34c = GHIDRA_CAST(0x3f000000); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - tmpEntity = Game::Spawn(g_game,1000,0x6f,&this->_pos,vecResult,GHIDRA_CAST(this),0,uVar5); - (GHIDRA_CAST((auStack_cc + 0x2c)))->BlendMode::SetMode(2,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - puVar12 = auStack_cc + 0x2c; - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,puVar12); - vecResult = &projectile->_posOffset; - vecResult2 = (GHIDRA_CAST((&tmpVecB)))->Vector::Vector(0.0,projectile->_fallingSpeed * 0.5); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecC,vecResult2); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(vecResult); - fVar19 = random_float(); - pEStack_354 = GHIDRA_CAST((fVar19 * 0.7 + 0.3)); - (GHIDRA_CAST((&purpleTrailColor)))->Color::Color(0.0,0.0,0.0,1.0); - (GHIDRA_CAST((&purpleTrailColor)))->Color::SetOffset((float)pEStack_354 * 0.4,(float)pEStack_354 * 0.3, - (float)pEStack_354 * 0.7); - pEStack_354 = GHIDRA_CAST(0x3f28f5c3); - vecResult = Vector::operator_mul(&tmpVecB,GHIDRA_CAST(&pEStack_354),&g_vectorOne); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - goto LAB_0065453a; - } - } - else { - uVar5 = Random(); - pEStack_34c = GHIDRA_CAST(0x3f000000); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - tmpEntity = Game::Spawn(g_game,1000,0x6f,&this->_pos,vecResult,GHIDRA_CAST(this),0,uVar5); - (GHIDRA_CAST((auStack_cc + 0x2c)))->BlendMode::SetMode(2,0); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - puVar12 = auStack_cc + 0x2c; - layer = (GHIDRA_CAST((sprite)))->Sprite::GetLayer(GHIDRA_CAST(0x0)); - copy_20_bytes(layer->_blendMode,puVar12); - vecResult = &projectile->_posOffset; - vecResult2 = (GHIDRA_CAST((&tmpVecB)))->Vector::Vector(0.0,projectile->_fallingSpeed * 0.5); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecC,vecResult2); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(vecResult); - fVar19 = random_float(); - pEStack_354 = GHIDRA_CAST((fVar19 * 0.7 + 0.3)); - (GHIDRA_CAST((&cyanTrailColor)))->Color::Color(0.0,0.0,0.0,1.0); - (GHIDRA_CAST((&cyanTrailColor)))->Color::SetOffset(0.0,(float)pEStack_354 * 0.7,(float)pEStack_354); -LAB_0065453a: - tmpEntity->SetColor(); - set_field_358(tmpEntity,-5.0); - tmpEntity->Update(); - this = projectile; - } - if (((this->_projectileFlags & 0x80000000000000) != 0) && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(8.0,0.0), sizeIndex != 0)) { - (GHIDRA_CAST((&this->_velocity)))->Vector::Rotated(&VStack_3f8,90.0); - pEStack_360 = GHIDRA_CAST(0x0); - do { - player = pEStack_360; - pEStack_35c = GHIDRA_CAST(Random()); - pEStack_34c = GHIDRA_CAST(0x3e19999a); - vecResult = (GHIDRA_CAST((&VStack_3f8)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - if (player == GHIDRA_CAST(0x0)) { - pEStack_354 = GHIDRA_CAST(&DAT_bf800000); - } - else { - pEStack_354 = GHIDRA_CAST(0x3f800000); - } - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecB,GHIDRA_CAST(&pEStack_354)); - otherProjectile = - (Entity_Projectile *) - Game::Spawn(g_game,9,0,&this->_pos,vecResult,GHIDRA_CAST(0x0),0,GHIDRA_UINT(pEStack_35c)); - (GHIDRA_CAST((GHIDRA_CAST(otherProjectile))))->Entity::SetSpawnerEntity(GHIDRA_CAST(this->_spawnerEntity)); - FUN_004316b0(); - FUN_004b7070(); - otherProjectile->SetColor(); - FUN_00450880(); - set_projectile_flags(otherProjectile,0x8000000); - set_falling_accel(otherProjectile,-0.04); - FUN_004aad70(); - otherProjectile->Update(); - pEStack_360 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_360)) + 0x1)))); - } while (GHIDRA_INT(pEStack_360) < 2); - } - if ((this->_variant == 0xe) && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), sizeIndex != 0)) { - if (this->_updateTime <= 40.0 && this->_updateTime != 40.0) { - fVar19 = random_float(); - if (fVar19 < (50.0 - this->_updateTime) / 40.0) { - uVar5 = Random(); - pEStack_34c = GHIDRA_CAST(0x3f000000); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - pEVar7 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x3b,&this->_pos,vecResult,GHIDRA_CAST(this),0,uVar5); - vecResult = &projectile->_posOffset; - vecResult2 = (GHIDRA_CAST((&tmpVecB)))->Vector::Vector(0.0,projectile->_fallingSpeed * 0.5); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecC,vecResult2); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetPositionOffset(vecResult); - pEStack_354 = GHIDRA_CAST(0x3fc00000); - vecResult = Vector::operator_mul(&tmpVecB,GHIDRA_CAST(&pEStack_354),&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetSpriteScale(vecResult); - fVar19 = random_float(); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::set_rotation(fVar19 * 10.0 + 2.0); - sizeIndex = Isaac::Random(0xf); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(sizeIndex + 0xf); - vfunc = *(code **)(*GHIDRA_CAST(pEVar7) + 0x3c); - (GHIDRA_CAST((&CStack_108)))->Color::Color(0.4,0.35,0.3,0.6); - (*vfunc)(); - vfunc = *(code **)(*GHIDRA_CAST(pEVar7) + 0x3c); - (GHIDRA_CAST((&CStack_108)))->Color::Color(3.0,0.8,0.0,0.8); - (*vfunc)(); - set_field_358(pEVar7,-1000.0); - pEVar7->Update(); - this = projectile; - } - } - pEStack_35c = GHIDRA_CAST(Random()); - pEStack_34c = GHIDRA_CAST(0x3f000000); - pVStack_3c4 = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - vecResult = MusicManager::RandomVector(&tmpVecB); - vecResult = Vector::operator_mul(&tmpVecC,&projectile->_size,vecResult); - pEStack_354 = GHIDRA_CAST(random_float()); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_3a8,GHIDRA_CAST(&pEStack_354)); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&VStack_408,vecResult); - otherProjectile = projectile; - tmpEntity = Game::Spawn(g_game,1000,0x6f,vecResult,pVStack_3c4,GHIDRA_CAST(projectile),0, - GHIDRA_UINT(pEStack_35c)); - vecResult = (GHIDRA_CAST((GHIDRA_CAST((entityQuery + 0x1c)))))->Vector::Vector(0.0, - otherProjectile->_fallingSpeed * 0.5); - vecResult = (GHIDRA_CAST((&otherProjectile->_posOffset)))->Vector::__add(&VStack_474,vecResult); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(vecResult); - fVar19 = random_float(); - pEStack_35c = GHIDRA_CAST((fVar19 * 0.7 + 0.3)); - (GHIDRA_CAST((&orangeTrailColor)))->Color::Color(0.0,0.0,0.0,1.0); - (GHIDRA_CAST((&orangeTrailColor)))->Color::SetOffset(1.0,(float)pEStack_35c,0.0); - fVar19 = random_float(); - pEStack_35c = GHIDRA_CAST((fVar19 + 1.0)); - vecResult = Vector::operator_mul - (GHIDRA_CAST((entityQuery + 0x1c)),GHIDRA_CAST(&pEStack_35c),&g_vectorOne); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - Isaac::Random(0x13); - (*vfunc)(); - FUN_00440e90(); - anm2 = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - set_PlaybackSpeed(anm2,0.6); - tmpEntity->Update(); - this = projectile; - } - if (((((this->_projectileFlags & 2) != 0) && (this->_spawnerType == 0x3b7)) && - (this->_spawnerVariant == 0x14)) && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0), sizeIndex != 0)) { - uVar5 = Random(); - pEStack_34c = GHIDRA_CAST(0x3f000000); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - tmpEntity = Game::Spawn(g_game,1000,0x6f,&this->_pos,vecResult,GHIDRA_CAST(this),0,uVar5); - vecResult = &projectile->_posOffset; - vecResult2 = (GHIDRA_CAST((&tmpVecB)))->Vector::Vector(0.0,projectile->_fallingSpeed * 0.5); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecC,vecResult2); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(vecResult); - random_float(); - (GHIDRA_CAST(()))->Color::Color(); - tmpEntity->SetColor(); - FUN_00440e90(); - tmpEntity->Update(); - this = projectile; - } - pEStack_364 = GHIDRA_CAST(0xc2a00000); - if (((this->_projectileFlags & 0x20000000000000) != 0) && (this->_subtype == 1000)) { - if (this->_dead == 0) { - if (this->_spawnerType != 0x390) { - if ((this->_target == 0) && - (player = Game::GetNearestPlayerEx(&this->_pos,0,0,0), player != GHIDRA_CAST(0x0))) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(player)); - } - if (GHIDRA_CAST(this->_target) != GHIDRA_CAST(0x0)) { - vecResult = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Position(&tmpVecA); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&tmpVecB,&this->_pos); - (GHIDRA_CAST((vecResult)))->Vector::Normalized(&VStack_3a0); - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Dot(&VStack_3a0); - if (0.0 < (float)pEStack_34c) { - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - vecResult = (GHIDRA_CAST((&VStack_3a0)))->Vector::__mul(&tmpVecA,&this->_speedMultiplier); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(vecResult); - (GHIDRA_CAST((&this->_velocity)))->Vector::Resize((float)pEStack_34c); - } - } - } - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(4.0,0.0); - if (sizeIndex != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(entityQuery),9,-1,-1,0,0); - uStack_14 = 3; - uVar5 = 0; - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(entityQuery))))->EntityList::Size(); - if (sizeIndex != 0) { - do { - msvc::vector::operator_index(); - tmpEntity = GHIDRA_CAST(FUN_004aad40()); - otherProjectile = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::Target(); - if (otherProjectile == this) goto LAB_006555d5; - uVar5 = uVar5 + 1; - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(entityQuery))))->EntityList::Size(); - } while (uVar5 < uVar9); - } - this->Remove(); -LAB_006555d5: - uStack_14 = -1; - (GHIDRA_CAST((entityQuery)))->EntityList_Query::~EntityList_Query(); - } - } - else { - this->_subtype = 0; - SoundEffects::PlayWithFartOverride(0x1e,1.0,2,0,1.0); - uVar5 = Random(); - pEStack_354 = GHIDRA_CAST(&this->_pos); - tmpEntity = Game::Spawn(g_game,1000,2,GHIDRA_CAST(pEStack_354),&g_vectorZero,GHIDRA_CAST(0x0),3, - uVar5); - pEStack_34c = GHIDRA_CAST(0x3fc00000); - vecResult = Vector::operator_mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c),&g_vectorOne); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - vecResult = (GHIDRA_CAST((&tmpVecA)))->Vector::Vector(0.0,-20.0); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(vecResult); - set_field_358(tmpEntity,4.0); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - FUN_00424510(); - uStack_14 = 1; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(entityQuery2),9,-1,-1,0,0); - uStack_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x1))),2); - uVar5 = 0; - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(entityQuery2))))->EntityList::Size(); - otherProjectile = projectile; - if (sizeIndex != 0) { - do { - msvc::vector::operator_index(); - pEStack_34c = GHIDRA_CAST(FUN_004aad40()); - if ((pEStack_34c != GHIDRA_CAST(0x0)) && - (pEVar8 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEStack_34c))))->Entity)::Target(), - pEVar8 == otherProjectile)) { - msvc::vector::push_back(); - } - uVar5 = uVar5 + 1; - uVar9 = (GHIDRA_CAST((GHIDRA_CAST(entityQuery2))))->EntityList::Size(); - } while (uVar5 < uVar9); - } - this_03 = GHIDRA_CAST(projectile); - vecResult = (GHIDRA_CAST((&projectile->_velocity)))->Vector::Normalized(&tmpVecA); - (GHIDRA_CAST((vecResult)))->Vector::__unm(&VStack_3f0); - pEStack_374 = GHIDRA_CAST(0x42a00000); - bVar3 = (GHIDRA_CAST((&VStack_3f0)))->Vector::operator_eq(&g_vectorZero); - if (bVar3 != 0) { - vecResult = MusicManager::RandomVector(&tmpVecA); - (GHIDRA_CAST((&VStack_3f0)))->Vector::operator_assign(vecResult); - pEStack_364 = GHIDRA_CAST(0xc3340000); - pEStack_374 = GHIDRA_CAST(0x43340000); - } - uVar5 = (GHIDRA_CAST((entityQuery + 0x10)))->msvc::vector::size(); - if (uVar5 < 2) { - pEStack_374 = GHIDRA_CAST(0x0); - pEStack_364 = GHIDRA_CAST(0x0); - } - else { - pEStack_374 = GHIDRA_CAST(((float)pEStack_374 - (float)pEStack_364)); - sizeIndex = (GHIDRA_CAST((entityQuery + 0x10)))->msvc::vector::size(); - pEStack_374 = (Entity_Player *) - ((float)pEStack_374 / - (float)((double)(sizeIndex + -1) + __uint_to_double_fixup[-(sizeIndex + -1 >> 0x1f)])) - ; - } - sizeIndex = (GHIDRA_CAST((entityQuery + 0x10)))->msvc::vector::size(); - if (sizeIndex != 0) { - uVar5 = 0; - do { - listEntry = GHIDRA_CAST(FUN_0042c810()); - otherProjectile = GHIDRA_CAST(*listEntry); - (GHIDRA_CAST((&VStack_3f0)))->Vector::Rotated(&VStack_3a0, - (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)] - ) * (float)pEStack_374 + (float)pEStack_364); - pEStack_34c = GHIDRA_CAST(0x40c00000); - vecResult = (GHIDRA_CAST((&VStack_3a0)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(pEStack_354))))->Vector::__add(&tmpVecB,vecResult); - (GHIDRA_CAST((GHIDRA_CAST(otherProjectile))))->Entity::SetPosition(vecResult); - fVar19 = random_float(); - pEStack_35c = GHIDRA_CAST((fVar19 * 3.0 + 9.0)); - vecResult = (GHIDRA_CAST((&VStack_3a0)))->Vector::__mul(&tmpVecC,GHIDRA_CAST(&pEStack_35c)); - (GHIDRA_CAST((GHIDRA_CAST(otherProjectile))))->Entity::SetVelocity(vecResult); - set_projectile_flags(otherProjectile,0x80); - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(otherProjectile))))->Entity::SubType(); - if (sizeIndex == 1000) { - projFlags = ProjectileFlags(otherProjectile); - set_projectile_flags(otherProjectile,projFlags | 0x20000000000000); - } - FUN_0044bfa0(); - set_falling_accel(otherProjectile,-0.094); - (GHIDRA_CAST((GHIDRA_CAST(otherProjectile))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - Isaac::Random(0x1e); - FUN_00444cb0(); - uVar5 = uVar5 + 1; - uVar9 = (GHIDRA_CAST((entityQuery + 0x10)))->msvc::vector::size(); - } while (uVar5 < uVar9); - this_03 = GHIDRA_CAST(projectile); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = Room::GetClampedPositionImpl(room,&tmpVecA,&this_03->_pos,3.0,3.0,3.0,3.0); - (GHIDRA_CAST((&this_03->_pos)))->Vector::operator_assign(vecResult); - if (this_03->_spawnerType != 0x390) { - pEStack_360 = GHIDRA_CAST(&DAT_00000006); - do { - vecResult = MusicManager::RandomVector(&tmpVecA); - pEStack_34c = GHIDRA_CAST(random_float()); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecB,GHIDRA_CAST(&pEStack_34c)); - pEStack_354 = GHIDRA_CAST(0x42a00000); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecC,GHIDRA_CAST(&pEStack_354)); - (GHIDRA_CAST((&this_03->_pos)))->Vector::__add(&scratchVec,vecResult); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pos.y = scratchVec.y; - pos.x = scratchVec.x; - sizeIndex = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos); - if (0 < sizeIndex) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = (GHIDRA_CAST((room)))->Room::FindFreeTilePosition(&VStack_408,&scratchVec,64.0); - fVar19 = random_float(); - pEStack_35c = GHIDRA_CAST((fVar19 * 38.0 - 19.0)); - fVar19 = random_float(); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST((entityQuery + 0x1c)))))->Vector::Vector(fVar19 * 38.0 - 19.0, - (float)pEStack_35c); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&VStack_474,vecResult2); - (GHIDRA_CAST((&scratchVec)))->Vector::operator_assign(vecResult); - } - vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::__sub(&VStack_4b4,&this_03->_pos); - (GHIDRA_CAST((vecResult)))->Vector::Normalized(&VStack_3a8); - fVar19 = random_float(); - pEStack_35c = GHIDRA_CAST((fVar19 * 15.0 - 30.0)); - fVar19 = random_float(); - pVStack_3c4 = GHIDRA_CAST((fVar19 * 15.0)); - vecResult = Vector::operator_mul(&VStack_4c4,GHIDRA_CAST(&pVStack_3c4),&VStack_3a8); - vecResult = (GHIDRA_CAST((&this_03->_pos)))->Vector::__add(&VStack_4cc,vecResult); - spawn_small_maggot_jump(vecResult,(float)pEStack_35c,&this_03->_pos); - pEStack_360 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEStack_360[-1])) + 0x2eff)))); - } while (pEStack_360 != GHIDRA_CAST(0x0)); - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x17,&this_03->_pos,&g_vectorZero,GHIDRA_CAST(this_03),0, - uVar5); - pEStack_34c = GHIDRA_CAST(0x3fc00000); - vecResult = Vector::operator_mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c),&g_vectorOne); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - } - fVar19 = random_float(); - pEVar7 = (GHIDRA_CAST((this_03)))->Entity_NPC::MakeSplat((fVar19 * 0.5 + 0.5) * 1.5); - vfunc = *(code **)(*GHIDRA_CAST(pEVar7) + 0x3c); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0); - (*vfunc)(); - pEVar7->Update(); - Game::ShakeScreen(g_game,5); - (GHIDRA_CAST((entityQuery2)))->EntityList_Query::~EntityList_Query(); - uStack_14 = -1; - FID_conflict__Tidy(entityQuery + 0x10); - this = projectile; - } - } - if (this->_variant == 0xe) { - this->_dead = 0; - } - if ((((this->_spawnerType == 0x390) && (this->_spawnerVariant == 0)) && (this->_subtype == 1)) && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(4.0,0.0), sizeIndex != 0)) { - uVar5 = Random(); - pEStack_34c = GHIDRA_CAST(0x3e4ccccd); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_34c)); - otherProjectile = - GHIDRA_CAST(Game)::Spawn(g_game,9,0,&this->_pos,vecResult,GHIDRA_CAST(0x0),0,uVar5); - (GHIDRA_CAST((GHIDRA_CAST(otherProjectile))))->Entity::SetSpawnerEntity(GHIDRA_CAST(this->_spawnerEntity)); - FUN_004316b0(); - FUN_004b7070(); - otherProjectile->SetColor(); - FUN_00444c70(); - set_falling_accel(otherProjectile,1.0); - otherProjectile->Update(); - } - if (this->_dead != 0) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20); - if (bVar3 != 0) goto LAB_00653169; - pEStack_374 = GHIDRA_CAST(0x0); - pEStack_368 = GHIDRA_CAST(0xa); - if ((this->_projectileFlags & 2) == 0) { - sizeIndex = this->_variant; - if (((((sizeIndex == 0) || (sizeIndex == 3)) || ((sizeIndex == 4 || ((sizeIndex == 5 || (sizeIndex == 6)))))) || - (sizeIndex == 0xc)) || ((sizeIndex == 0xd || (sizeIndex == 0x10)))) { - fStack_380 = this->_height; - pEStack_368 = GHIDRA_CAST(0x96); - fVar19 = this->_scale; - uVar5 = 0xb; - pEStack_360 = GHIDRA_CAST((fVar19 * 0.8)); - if (-5.0 < fStack_380) { - pEStack_368 = GHIDRA_CAST(0x102); - } - pEStack_364 = GHIDRA_CAST(0x3f800000); - if (sizeIndex == 4) { - if (0.4 <= fVar19) { - if (0.8 <= fVar19) { - if (fStack_380 <= -5.0) { - uVar5 = 0xc; - } - else { - uVar5 = 0xd; - } - } - else { - uVar5 = 0x4f; - pEStack_364 = GHIDRA_CAST(0x3f59999a); - pEStack_360 = GHIDRA_CAST(0x3f800000); - } - } - else { - uVar5 = 0x50; - pEStack_364 = GHIDRA_CAST(0x3f333333); - pEStack_360 = GHIDRA_CAST(0x3f800000); - } - } - else if (sizeIndex == 5) { - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - fVar19 = random_float(); - Game::SpawnParticles(g_game,&this->_pos,0x3a,4,fVar19 * 2.0 + 1.0,tmpColor,fStack_380,0); - uVar5 = 0x2b; - } - else if (sizeIndex == 6) { - uVar5 = 0x66; - } - else { - cVar4 = _has_flag_0x110(); - if (cVar4 != '\0') { - uVar5 = 200; - } - } - uVar9 = Random(); - Game::Spawn(g_game,1000,uVar5,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar9); - player = GHIDRA_CAST(__RTDynamicCast()); - pEStack_374 = player; - (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::SetPositionOffset(&this->_posOffset); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_360)); - (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::SetSpriteScale(vecResult); - Isaac::Random(4); - FUN_0043eea0(); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(&this->_pos,-80.0); - if (bVar3 != 0) { - SoundEffects::PlayWithFartOverride2 - (GHIDRA_INT(pEStack_368),GHIDRA_INT(&this->_pos),2,0,1.0,(float)pEStack_364); - } - } - else if (sizeIndex == 1) { - fStack_380 = this->_height; - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - fVar19 = random_float(); - Game::SpawnParticles(g_game,&this->_pos,0x23,8,fVar19 * 2.0 + 1.0,tmpColor,fStack_380,1); - } - else if (sizeIndex == 2) { - uVar5 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity::Position(&VStack_3b0); - vecResult2 = (GHIDRA_CAST((&tmpVecA)))->Vector::Vector(0.0,-10.0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecB,vecResult2); - tmpEntity = Game::Spawn(g_game,1000,0xf,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar5); - this = projectile; - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&projectile->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((GHIDRA_CAST(auStack_cc))))->Color::operator_assign(tmpColor); - fVar19 = (GHIDRA_CAST((GHIDRA_CAST(auStack_cc))))->Color::A(); - Font::SetLineHeightModifier(GHIDRA_CAST(auStack_cc),fVar19 * 0.3); - tmpEntity->SetColor(); - } - else if (sizeIndex == 7) { - uVar5 = Random(); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity::Position(&VStack_3b0); - vecResult2 = (GHIDRA_CAST((&tmpVecA)))->Vector::Vector(0.0,-10.0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecB,vecResult2); - tmpEntity = Game::Spawn(g_game,1000,0x61,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - otherProjectile = projectile; - fStack_380 = projectile->_height; - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&projectile->_sprite))))->Sprite)::Color(); - fVar19 = random_float(); - pEStack_368 = GHIDRA_CAST((fVar19 * 3.0 + 2.0)); - sizeIndex = Isaac::Random(2); - Game::SpawnParticles - (g_game,&otherProjectile->_pos,0x62,sizeIndex + 4,(float)pEStack_368,tmpColor, - fStack_380,0); - fVar19 = random_float(); - SoundEffects::PlayWithFartOverride2 - (0x8a,GHIDRA_INT(&otherProjectile->_pos),2,0,fVar19 * 0.5 + 2.0,0.2); -LAB_00655e83: - this = projectile; - } - else if (sizeIndex == 8) { - (GHIDRA_CAST((&CStack_108)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color_00); - rng_pair_init(subtypeHigh); - (*GHIDRA_CAST((GHIDRA_CAST(&(subtypeHigh)) + 0x0))) = GHIDRA_UINT(this->_subtype) >> 0x10; - (*GHIDRA_CAST((GHIDRA_CAST(&(subtypeHigh)) + 0x4))) = this->_subtype & 0xffff; - VStack_34.x = (float)this->_initSeed; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40000); - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_3c)) + 0x0))) = (BADTYPE)this->_health; - VStack_34.y = (float)GHIDRA_UINT((bVar3 != 0)); - Entity::DestroyRockGridAt - (&this->_pos,GHIDRA_CAST(subtypeHigh),GHIDRA_CAST(this),this->_wiggleFrameOffset - ); - } - else { - if (sizeIndex == 9) { - (GHIDRA_CAST((GHIDRA_CAST(auStack_160))))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST(auStack_160))))->KColor::FromRGBA255(0x8c,0x7b,0x7b,0xff); - tmpColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((GHIDRA_CAST(auStack_160))))->Color::__mul(tmpColor); - uVar5 = Random(); - pEStack_360 = GHIDRA_CAST(&this->_pos); - tmpEntity = Game::Spawn(g_game,1000,0x91,GHIDRA_CAST(pEStack_360),&g_vectorZero, - GHIDRA_CAST(this),0,uVar5); - pVStack_384 = &projectile->_posOffset; - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(pVStack_384); - tmpEntity->SetColor(); - tmpEntity->Update(); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(pEStack_358)); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(vecResult); - sprite = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - (GHIDRA_CAST((sprite)))->Sprite::SetRotation(0.0); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - player = pEStack_360; - bVar3 = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(GHIDRA_CAST(pEStack_360),-20.0); - if (bVar3 != 0) { - SoundEffects::PlayWithFartOverride2(0x89,GHIDRA_INT(player),2,0,1.0,1.0); - pEStack_34c = GHIDRA_CAST(0x10); - fStack_380 = 1.4013e-45; - fVar19 = random_float(); - pEStack_368 = GHIDRA_CAST(GHIDRA_INT((*GHIDRA_CAST(pEStack_358) * 4.0 * (fVar19 * 0.5 + 1.0)))) - ; - msvc::max(); - listEntry = GHIDRA_CAST(std)::min(); - tmpEntity = GHIDRA_CAST(*listEntry); - pEStack_354 = tmpEntity; - if (0 < GHIDRA_INT(tmpEntity)) { - pEStack_35c = GHIDRA_CAST(&projectile->_size); - do { - fVar19 = random_float(); - Vector::FromAngle(&VStack_3a0,fVar19 * 360.0); - fVar19 = random_float(); - pVStack_3c4 = GHIDRA_CAST((fVar19 * 2.0 + 1.0)); - pEStack_354 = GHIDRA_CAST(random_float()); - vecResult = (GHIDRA_CAST((&VStack_3a0)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_354)); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(pEStack_35c)); - (GHIDRA_CAST((GHIDRA_CAST(player))))->Vector::__add(&VStack_46c,vecResult); - uVar5 = Random(); - vecResult = (GHIDRA_CAST((&VStack_3a0)))->Vector::__mul(&tmpVecB,GHIDRA_CAST(&pVStack_3c4)); - tmpEntity = Game::Spawn(g_game,1000,0x23,&VStack_46c,vecResult,GHIDRA_CAST(0x0),1,uVar5 - ); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(pVStack_384); - tmpEntity->SetColor(); - tmpEntity->Update(); - tmpEntity = GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST(&(tmpEntity[-1])) + 0x2a88))) + 0x477)); - player = pEStack_360; - } while (tmpEntity != GHIDRA_CAST(0x0)); - } - } - goto LAB_00655e83; - } - if (sizeIndex == 0xb) { - uVar5 = Random(); - vecResult = &this->_pos; - pEStack_34c = GHIDRA_CAST(vecResult); - tmpEntity = Game::Spawn(g_game,1000,2,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar5); - (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(&this->_posOffset); - SoundEffects::PlayWithFartOverride2(0x102,GHIDRA_INT(vecResult),2,0,1.0,1.0); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - VStack_3f0.x = vecResult->x; - VStack_3f0.y = (this->_pos).y; - sizeIndex = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(*vecResult); - if (sizeIndex == 0) { - uVar5 = Random(); - tmpEntity = GHIDRA_CAST(this->_spawnerEntity); - fStack_380 = 0.1; - vecResult = (GHIDRA_CAST((&projectile->_velocity)))->Vector::__mul(&VStack_3b0,&fStack_380); - tmpEntity = Game::Spawn(g_game,0x18, - GHIDRA_UINT((GHIDRA_UINT(projectile->_initSeed) % GHIDRA_UINT(pEStack_368) == 0)), - GHIDRA_CAST(pEStack_34c),vecResult,tmpEntity,0,uVar5); - (GHIDRA_CAST((tmpEntity)))->Entity::ClearEntityFlags(4); - (GHIDRA_CAST((tmpEntity)))->Entity::SetField380(24.0); - anm2 = GHIDRA_CAST((GHIDRA_CAST((tmpEntity)))->Entity)::GetSprite(); - ANM2::Play(anm2,GHIDRA_CAST("ReGenProjectile"),0); - FUN_00440ed0(); - this = projectile; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity::HasEntityFlags(0x1000000); - if (bVar3 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(auStack_8c))))->EntityRef::constructor(GHIDRA_CAST(this)); - (GHIDRA_CAST((tmpEntity)))->Entity::AddShrink(GHIDRA_CAST(auStack_8c),-0x96,0,0); - } - } - } - } - if ((this->_projectileFlags & 0x4000) != 0) { - uVar5 = Random(); - Game::Spawn(g_game,1000,0x38,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - pEVar7 = GHIDRA_CAST(__RTDynamicCast()); - pEVar7->Update(); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(0xb4); - } - } - else { - uVar5 = Random(); - vecResult = &this->_pos; - pEStack_358 = GHIDRA_CAST(vecResult); - pEStack_374 = (Entity_Player *) - Game::Spawn(g_game,1000,1,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - if (GHIDRA_CAST(this->_parent) == GHIDRA_CAST(0x0)) { - otherProjectile = this; - } - else { - otherProjectile = GHIDRA_CAST(this->_parent); - } - Game::BombDamage(g_game,vecResult,50.0,60.0,1,GHIDRA_CAST(otherProjectile),g_tearFlagsNone,4,0); - projFlagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *GHIDRA_CAST(&this->_projectileFlags) = GHIDRA_UINT(this->_projectileFlags) & 0xfffffffd; - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)) = projFlagsHigh; - sizeIndex = this->_spawnerType; - if (sizeIndex == 0x389) { - pEStack_360 = GHIDRA_CAST(0x0); - do { - vecResult = Vector::FromAngle(&VStack_3b0,(float)GHIDRA_INT(pEStack_360) * 60.0 + 0.0); - fStack_380 = 8.0; - Vector::operator_mul(&VStack_3f8,&fStack_380,vecResult); - uVar5 = Random(); - otherProjectile = - (Entity_Projectile *) - Game::Spawn(g_game,9,2,&this->_pos,&VStack_3f8,GHIDRA_CAST(this->_parent),0,uVar5); - FUN_004316b0(); - FUN_004b7070(); - set_falling_accel(otherProjectile,0.05); - otherProjectile->SetColor(); - pEStack_360 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_360)) + 0x1)))); - } while (GHIDRA_INT(pEStack_360) < 6); - sizeIndex = this->_spawnerType; - } - if ((sizeIndex == 0x3b7) && (this->_spawnerVariant == 0x14)) { - Game::ShakeScreen(g_game,8); - pEStack_360 = GHIDRA_CAST(0x0); - do { - player = pEStack_360; - uVar5 = Random(); - pEStack_368 = GHIDRA_CAST(projectile->_spawnerEntity); - vecResult = (GHIDRA_CAST((&VStack_3b0)))->Vector::Vector(0.0,-2.0 - (float)GHIDRA_INT(player) * 7.0); - vecResult2 = MusicManager::RandomVector(&tmpVecA); - fStack_380 = 10.0; - vecResult2 = (GHIDRA_CAST((vecResult2)))->Vector::__mul(&tmpVecB,&fStack_380); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Vector::__add(&tmpVecC,vecResult2); - pEVar7 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x8d,vecResult2,vecResult,GHIDRA_CAST(pEStack_368),0,uVar5); - FUN_004316b0(); - FUN_004b7070(); - fVar19 = random_float(); - pEStack_34c = GHIDRA_CAST((fVar19 * 0.3 + 1.2)); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_46c,GHIDRA_CAST(&pEStack_34c)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetSpriteScale(vecResult); - pEVar7->Update(); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(0x168); - uVar5 = Random(); - fVar19 = random_float(); - vecResult = (GHIDRA_CAST((&VStack_438)))->Vector::Vector(0.0,-10.0 - fVar19 * 28.0); - fVar19 = random_float(); - pEStack_368 = GHIDRA_CAST((fVar19 * 20.0 - 10.0)); - fVar19 = random_float(); - vecResult2 = (GHIDRA_CAST((&VStack_418)))->Vector::Vector(fVar19 * 60.0 - 30.0,(float)pEStack_368); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Vector::__add(&VStack_3a8,vecResult2); - otherProjectile = - (Entity_Projectile *) - Game::Spawn(g_game,9,0,vecResult2,vecResult,GHIDRA_CAST(0x0),0,uVar5); - fVar19 = random_float(); - fVar19 = fVar19 * 0.7 + 1.0; - FUN_004508a0(); - this = projectile; - (GHIDRA_CAST((GHIDRA_CAST(otherProjectile))))->Entity::SetSpawnerEntity(GHIDRA_CAST(projectile->_spawnerEntity)); - FUN_004316b0(); - FUN_004b7070(); - otherProjectile->SetColor(); - FUN_00444c70(); - set_falling_accel(otherProjectile,1.0); - otherProjectile->Update(); - pEStack_360 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_360)) + 0x1)))); - } while (GHIDRA_INT(pEStack_360) < 0xe); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_lava_line_y(); - fVar17 = (this->_pos).y; - if (fVar19 <= fVar17) { - VStack_3f0.x = (this->_pos).x; - auVar18 = ZEXT416(GHIDRA_UINT(fVar17)); - VStack_3f0.y = fVar17; - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_lava_line_y(); - VStack_3f0.y = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar18)) + 0x0))); - pEVar7 = Entity_Effect::CreateTimer(reroll_entity_to_free_tile,5,4,0); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetSpawnerEntity(GHIDRA_CAST(this->_spawnerEntity)); - FUN_004316b0(); - FUN_004b7070(); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetPosition(&VStack_3f0); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::set_state(1); - } - } - } - VStack_438.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - if ((uVar5 & 0x104) != 0) { - uVar5 = Random(); - uVar9 = 0x17; - if ((this->_projectileFlags & 4) == 0) { - uVar9 = 0x16; - } - Game::Spawn(g_game,1000,uVar9,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - pEVar7 = GHIDRA_CAST(__RTDynamicCast()); - FUN_004316b0(); - if ((this->_projectileFlags & 0x10) == 0) { - pEStack_354 = GHIDRA_CAST(0x40400000); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_354)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetSpriteScale(vecResult); - } - else { - pEStack_354 = GHIDRA_CAST(0x3fc00000); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_354)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetSpriteScale(vecResult); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(10); - } - pEVar7->Update(); - uVar5 = Random(); - Game::Spawn(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - tmpEntity = GHIDRA_CAST(__RTDynamicCast()); - fVar19 = random_float(); - pEStack_354 = GHIDRA_CAST((fVar19 + 0.8)); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_354)); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&projectile->_sprite))))->Sprite::Color(); - (*vfunc)(); - tmpEntity->Update(); - VStack_438.y = *GHIDRA_CAST((GHIDRA_INT(&projectile->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(projectile->_projectileFlags); - this = projectile; - } - if ((uVar5 & 8) != 0) { - sizeIndex = this->_spawnerType; - if (sizeIndex == 0x3e) { - uVar5 = Random(); - Game::Spawn(g_game,1000,0x19,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - tmpEntity = GHIDRA_CAST(__RTDynamicCast()); - pEStack_354 = GHIDRA_CAST(0x40000000); - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_354)); - (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(vecResult); - tmpEntity->Update(); - SoundEffects::PlayWithFartOverride(0x3a6,1.0,2,0,1.0); - } - else { - if ((sizeIndex == 0x133) || (sizeIndex == 0x22)) { - uVar5 = Random(); - Game::Spawn(g_game,1000,0x1a,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - pEVar7 = GHIDRA_CAST(__RTDynamicCast()); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(0x96); - pEStack_354 = GHIDRA_CAST(0x40000000); - } - else { - uVar5 = Random(); - Game::Spawn(g_game,1000,0x1a,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - pEVar7 = GHIDRA_CAST(__RTDynamicCast()); - pEStack_354 = GHIDRA_CAST(0x40400000); - } - vecResult = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_354)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetSpriteScale(vecResult); - pEVar7->Update(); - } - } - if ((this->_projectileFlags & 0x10000) != 0) { - if (this->_spawnerType == 0x3e) { - pEStack_354 = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - (GHIDRA_CAST((&VStack_3cc)))->Vector::Vector((float)pEStack_354,0.0); - sizeIndex = Isaac::Random(2); - if (sizeIndex == 0) { - vecResult = (GHIDRA_CAST((&VStack_3cc)))->Vector::Rotated(&VStack_3b0,45.0); - (GHIDRA_CAST((&VStack_3cc)))->Vector::operator_assign(vecResult); - } - pEStack_354 = GHIDRA_CAST((GHIDRA_CAST((&VStack_3cc)))->Vector)::LengthSquared(); - if (25.0 <= (float)pEStack_354) { - vecResult = &VStack_400; - VStack_400.x = VStack_3cc.x; - VStack_400.y = VStack_3cc.y; - } - else { - pEStack_35c = GHIDRA_CAST(0x3fcccccd); - vecResult = (GHIDRA_CAST((&VStack_3cc)))->Vector::__mul(&VStack_3b0,GHIDRA_CAST(&pEStack_35c)); - } - (GHIDRA_CAST((&VStack_3cc)))->Vector::operator_assign(vecResult); - pEStack_364 = GHIDRA_CAST(&this->_sprite); - pEStack_358 = GHIDRA_CAST(0x4); - do { - uVar5 = Random(); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&tmpVecA,&this->_velocity); - Game::Spawn(g_game,this->_type,this->_variant,vecResult,&VStack_3cc,GHIDRA_CAST(0x0),0,uVar5) - ; - tmpEntity = GHIDRA_CAST(__RTDynamicCast()); - otherProjectile = projectile; - FUN_004316b0(); - FUN_004b7070(); - pEStack_354 = GHIDRA_CAST((otherProjectile->_height * 0.6)); - pVStack_384 = GHIDRA_CAST(0xc1b80000); - msvc::min(); - FUN_00450880(); - pEStack_354 = GHIDRA_CAST((otherProjectile->_scale - 0.667)); - pVStack_384 = GHIDRA_CAST(0x3f800000); - msvc::max(); - FUN_004508a0(); - savedProjFlags = otherProjectile->_projectileFlags; - tmpEntity[1]._variant = *GHIDRA_CAST((GHIDRA_INT(&otherProjectile->_projectileFlags) + 4)); - sizeIndex = *GHIDRA_CAST(tmpEntity); - tmpEntity[1]._type = GHIDRA_UINT(savedProjFlags) & 0xfffeffff; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(tmpEntity[1])) + 0x8)))) = 0x3dcccccd; - vfunc = *(code **)(sizeIndex + 0x3c); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(tmpEntity[1])) + 0x4)))) = 0xc0400000; - (GHIDRA_CAST((GHIDRA_CAST(pEStack_364))))->Sprite::Color(); - (*vfunc)(); - (GHIDRA_CAST((tmpEntity)))->Entity::SetParent(GHIDRA_CAST(projectile->_parent)); - tmpEntity->Update(); - vecResult = (GHIDRA_CAST((&tmpVecB)))->Vector::Vector(VStack_3cc.y,-VStack_3cc.x); - (GHIDRA_CAST((&VStack_3cc)))->Vector::operator_assign(vecResult); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEStack_358[-1])) + 0x4bf)))); - this = projectile; - } while (pEStack_358 != GHIDRA_CAST(0x0)); - pEStack_358 = GHIDRA_CAST(0x0); - } - else if ((this->_spawnerType == 0x38f) && (this->_spawnerVariant == 2)) { - pEStack_354 = GHIDRA_CAST(&this->_pos); - pEStack_358 = GHIDRA_CAST(0xffffffff); - do { - pEVar7 = pEStack_358; - uVar5 = Random(); - pEStack_35c = GHIDRA_CAST(projectile->_spawnerEntity); - fVar19 = random_float(); - fVar19 = Math::lerp(-6.0,-10.0,fVar19,0); - vecResult = (GHIDRA_CAST((&VStack_3b0)))->Vector::Vector(0.0,fVar19); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Rotated(&tmpVecA,(float)GHIDRA_INT(pEVar7) * 30.0); - vecResult2 = (GHIDRA_CAST((&tmpVecB)))->Vector::Vector(0.0,-6.0); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(pEStack_354))))->Vector::__add(&tmpVecC,vecResult2); - otherProjectile = - (Entity_Projectile *) - Game::Spawn(g_game,9,0,vecResult2,vecResult,GHIDRA_CAST(pEStack_35c),0,uVar5); - set_projectile_flags(otherProjectile,0x100002000); - FUN_004aad90(); - FUN_004aadd0(); - this = projectile; - FUN_004316b0(); - FUN_004b7070(); - set_falling_accel(otherProjectile,0.2); - otherProjectile->SetColor(); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_358)) + 0x2)))); - } while (GHIDRA_INT(pEStack_358) < 2); - } - else { - MusicManager::RandomVector(&VStack_3e4); - pEStack_35c = GHIDRA_CAST(&this->_velocity); - pEStack_354 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEStack_35c))))->Vector)::Length(); - (GHIDRA_CAST((&VStack_3e4)))->Vector::operator_mul_assign(GHIDRA_CAST(&pEStack_354)); - pVStack_384 = &this->_pos; - pEStack_358 = GHIDRA_CAST(0x0); - pEStack_364 = GHIDRA_CAST(&this->_sprite); - do { - (GHIDRA_CAST((GHIDRA_CAST(&scratchVec))))->EntityPtr::clear(); - if (pEStack_358 < GHIDRA_CAST(0x2)) { - vecResult = &VStack_3e4; - } - else { - vecResult = (GHIDRA_CAST((&VStack_3b0)))->Vector::Vector(VStack_3e4.y,-VStack_3e4.x); - } - (GHIDRA_CAST((&scratchVec)))->Vector::operator_assign(vecResult); - if ((GHIDRA_UINT(pEStack_358) & 1) != 0) { - vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::__unm(&tmpVecA); - (GHIDRA_CAST((&scratchVec)))->Vector::operator_assign(vecResult); - } - uVar5 = Random(); - tmpEntity = GHIDRA_CAST(this->_parent); - vecResult = (GHIDRA_CAST((pVStack_384)))->Vector::__sub(&tmpVecB,GHIDRA_CAST(pEStack_35c)); - otherProjectile = projectile; - Game::Spawn(g_game,projectile->_type,projectile->_variant,vecResult,&scratchVec,tmpEntity, - 0,uVar5); - tmpEntity = GHIDRA_CAST(__RTDynamicCast()); - FUN_00450880(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(tmpEntity[1])) + 0x8)))) = otherProjectile->_fallingAccel; - random_float(); - FUN_00444c70(); - tmpEntity->SetCollisionDamage(); - sizeIndex = *GHIDRA_CAST((GHIDRA_INT(&otherProjectile->_projectileFlags) + 4)); - tmpEntity[1]._type = GHIDRA_UINT(otherProjectile->_projectileFlags) & 0xfffeffff; - tmpEntity[1]._variant = sizeIndex; - FUN_004508a0(); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(pEStack_364))))->Sprite::Color(); - (*vfunc)(); - (GHIDRA_CAST((tmpEntity)))->Entity::SetParent(GHIDRA_CAST(projectile->_parent)); - tmpEntity->Update(); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_358)) + 0x1)))); - this = projectile; - } while (GHIDRA_INT(pEStack_358) < 4); - } - } - if ((this->_projectileFlags & 0x800000000) != 0) { - SoundEffects::PlayWithFartOverride2(0x1e3,GHIDRA_INT(&this->_pos),0x2d,0,1.0,1.0); - sizeIndex = 0; - do { - uVar5 = Random(); - pEStack_358 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x94,&this->_pos,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),0,uVar5); - (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Entity::SetParent(GHIDRA_CAST(this)); - (GHIDRA_CAST((pEStack_358)))->Entity_Effect::set_rotation((float)sizeIndex * 90.0 + 0.0); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000000); - if ((bVar3 != 0) || ((this->_projectileFlags & 0x80000000) != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Entity::AddEntityFlags(0x20000000); - } - sizeIndex = sizeIndex + 1; - } while (sizeIndex < 4); - } - if ((this->_projectileFlags & 0x1000000000) != 0) { - SoundEffects::PlayWithFartOverride2(0x1e3,GHIDRA_INT(&this->_pos),0x2d,0,1.0,1.0); - pEStack_358 = GHIDRA_CAST(0x0); - do { - uVar5 = Random(); - pEVar7 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x94,&this->_pos,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),0,uVar5); - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::SetParent(GHIDRA_CAST(this)); - FUN_004316b0(); - FUN_004b7070(); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::set_rotation((float)GHIDRA_INT(pEStack_358) * 90.0 + 45.0); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000000); - if ((bVar3 != 0) || ((this->_projectileFlags & 0x80000000) != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(pEVar7))))->Entity::AddEntityFlags(0x20000000); - } - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_358)) + 0x1)))); - } while (GHIDRA_INT(pEStack_358) < 4); - } - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - VStack_418.x = *GHIDRA_CAST(&this->_projectileFlags); - if ((uVar5 & 0x40) != 0) { - pVStack_384 = GHIDRA_CAST(0x40000000); - vecResult = &this->_pos; - pVStack_398 = vecResult; - vecResult2 = (GHIDRA_CAST((&this->_gridCollisionVelocity)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pVStack_384)); - (GHIDRA_CAST((vecResult)))->Vector::operator__(vecResult2); - SoundEffects::PlayWithFartOverride2(0x1e,GHIDRA_INT(vecResult),2,0,1.0,1.0); - uVar5 = Random(); - Game::Spawn(g_game,1000,2,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar5); - player = GHIDRA_CAST(&DAT_00000008); - pEStack_364 = GHIDRA_CAST(&DAT_00000008); - if (this->_spawnerType == 0x3d) { - if (this->_spawnerVariant == 7) { - player = GHIDRA_CAST(&DAT_00000006); - } - pEStack_364 = player; - } - fStack_37c = (float)GHIDRA_INT(pEStack_364); - pEStack_358 = GHIDRA_CAST(0x0); - do { - vecResult = Vector::FromAngle(&tmpVecA,((float)GHIDRA_INT(pEStack_358) * 360.0) / fStack_37c + 0.0) - ; - pVStack_384 = GHIDRA_CAST(0x41200000); - (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_430,GHIDRA_CAST(&pVStack_384)); - uVar5 = Random(); - tmpEntity = GHIDRA_CAST(this->_spawnerEntity); - vecResult = (GHIDRA_CAST((pVStack_398)))->Vector::__add(&tmpVecC,&VStack_430); - otherProjectile = - GHIDRA_CAST(Game)::Spawn(g_game,9,0,vecResult,&VStack_430,tmpEntity,0,uVar5); - this = projectile; - FUN_004316b0(); - FUN_004b7070(); - if (this->_subtype == 0) { - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)) & 0xffffffbf; - } - else { - FUN_004508a0(); - FUN_00435cd0(); - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - set_projectile_flags(otherProjectile,CONCAT44(uVar5,GHIDRA_INT(this->_projectileFlags))); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_358)) + 0x1)))); - } while (GHIDRA_INT(pEStack_358) < GHIDRA_INT(pEStack_364)); - VStack_418.x = *GHIDRA_CAST(&this->_projectileFlags); - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - if ((uVar5 & 0x400000) != 0) { - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::Normalized(&tmpVecA); - (GHIDRA_CAST((vecResult)))->Vector::__unm(&VStack_438); - pVStack_398 = &this->_pos; - pEStack_358 = GHIDRA_CAST(0xffffffff); - do { - vecResult = (GHIDRA_CAST((&VStack_438)))->Vector::Rotated(&tmpVecC,(float)GHIDRA_INT(pEStack_358) * 24.0); - fStack_37c = 10.0; - (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_428,&fStack_37c); - uVar5 = Random(); - tmpEntity = GHIDRA_CAST(this->_spawnerEntity); - vecResult = (GHIDRA_CAST((pVStack_398)))->Vector::__add(&VStack_418,&VStack_428); - otherProjectile = - GHIDRA_CAST(Game)::Spawn(g_game,9,0,vecResult,&VStack_428,tmpEntity,0,uVar5); - this = projectile; - FUN_004316b0(); - FUN_004b7070(); - set_falling_accel(otherProjectile,-0.04); - set_projectile_flags(otherProjectile,this->_projectileFlags & 0xffbfffffffffffff); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_358)) + 0x2)))); - } while (GHIDRA_INT(pEStack_358) < 2); - VStack_418.x = *GHIDRA_CAST(&this->_projectileFlags); - uVar5 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - if ((uVar5 & 0x20000) != 0) { - SoundEffects::PlayWithFartOverride2(0x1e,GHIDRA_INT(&this->_pos),2,0,1.0,1.0); - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar5); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - this = projectile; - if ((projectile->_spawnerType == 0x38f) && (projectile->_spawnerVariant == 2)) { - pEStack_364 = *GHIDRA_CAST(&projectile->_projectileFlags); - pVStack_398 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(&projectile->_projectileFlags) + 4)) & 0xfffdffff)); - pEStack_358 = GHIDRA_CAST(0x0); - fStack_37c = (float)(GHIDRA_UINT(pVStack_398) | 0x401); - do { - fVar19 = random_float(); - fVar19 = Math::lerp(-6.0,-10.0,fVar19,0); - vecResult = (GHIDRA_CAST((&tmpVecC)))->Vector::Vector(0.0,fVar19); - fVar19 = assert_lerp_range((float)GHIDRA_INT(pEStack_358),0.0,12.0,-75.0,75.0,1); - (GHIDRA_CAST((vecResult)))->Vector::Rotated(&VStack_418,fVar19); - uVar5 = Random(); - otherProjectile = - (Entity_Projectile *) - Game::Spawn(g_game,9,0,&this->_pos,&VStack_418,GHIDRA_CAST(this->_spawnerEntity),0,uVar5 - ); - set_projectile_flags(otherProjectile,CONCAT44(fStack_37c,pEStack_364)); - FUN_004aad90(); - FUN_004aadd0(); - FUN_004316b0(); - FUN_004b7070(); - set_falling_accel(otherProjectile,-0.1); - random_float(); - FUN_004508a0(); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_358)) + 0x1)))); - } while (GHIDRA_INT(pEStack_358) < 0xd); - } - else { - pEStack_358 = GHIDRA_CAST(0x10); - do { - fVar19 = random_float(); - fVar19 = Math::lerp(-10.0,-22.0,fVar19,0); - vecResult = (GHIDRA_CAST((&tmpVecC)))->Vector::Vector(0.0,fVar19); - fVar19 = random_float(); - fVar19 = Math::lerp(-70.0,70.0,fVar19,0); - (GHIDRA_CAST((vecResult)))->Vector::Rotated(&VStack_3a8,fVar19); - uVar5 = Random(); - otherProjectile = - (Entity_Projectile *) - Game::Spawn(g_game,9,0,&this->_pos,&VStack_3a8,GHIDRA_CAST(this->_spawnerEntity),0,uVar5 - ); - otherProjectile->SetColor(); - set_projectile_flags(otherProjectile,this->_projectileFlags & 0xfffdfffffffffffd); - FUN_004316b0(); - FUN_004b7070(); - set_falling_accel(otherProjectile,0.75); - random_float(); - FUN_004508a0(); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEStack_358[-1])) + 0x4bf)))); - } while (pEStack_358 != GHIDRA_CAST(0x0)); - } - } - if ((this->_projectileFlags & 0x200000000000) != 0) { - if (this->_variant == 1) { - SoundEffects::PlayWithFartOverride2(0x1eb,GHIDRA_INT(&this->_pos),2,0,1.0,1.0); - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(&this->_pos,0.0); - if (bVar3 != 0) { - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),0,uVar5); - vfunc = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - tmpEntity->Update(); - this = projectile; - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(projectile))))->Entity::HasEntityFlags(0x20000000); - if ((bVar3 == 0) && ((this->_projectileFlags & 0x80000000) == 0)) { - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,0x21,0xc,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - (GHIDRA_CAST((tmpEntity)))->Entity::SetTargetPosition(this->_pos); - fVar16 = (long double)(GHIDRA_CAST((tmpEntity)))->Entity::HitPoints(); - pVStack_398 = GHIDRA_CAST((float)fVar16); - fVar19 = random_float(); - fStack_37c = fVar19 * 0.2 + 0.6; - (GHIDRA_CAST((tmpEntity)))->Entity::SetField380(fStack_37c * (float)pVStack_398); - } - else { - uVar5 = Random(); - pEVar7 = (Entity_Effect *) - Game::Spawn(g_game,1000,10,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - FUN_004316b0(); - FUN_004b7070(); - random_float(); - FUN_00435ed0(); - pEVar7->SetCollisionDamage(); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(0x96); - } - SoundEffects::PlayWithFartOverride2(0x1d7,GHIDRA_INT(&this->_pos),2,0,1.0,1.0); - } - } - if ((this->_projectileFlags & 0x8000000000) != 0) { - uVar5 = Random(); - vecResult = &this->_pos; - pEStack_358 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x93,vecResult,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),0,uVar5); - FUN_004316b0(); - FUN_004b7070(); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000000); - if ((bVar3 != 0) || ((this->_projectileFlags & 0x80000000) != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Entity::AddEntityFlags(0x20000000); - } - sizeIndex = Isaac::Random(10); - if (sizeIndex == 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(vecResult,0.0); - if (bVar3 != 0) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000000); - if ((bVar3 == 0) && ((this->_projectileFlags & 0x80000000) == 0)) { - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,0x21,10,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - (GHIDRA_CAST((tmpEntity)))->Entity::SetTargetPosition(this->_pos); - fVar16 = (long double)(GHIDRA_CAST((tmpEntity)))->Entity::HitPoints(); - pVStack_398 = GHIDRA_CAST((float)fVar16); - fVar19 = random_float(); - fStack_37c = fVar19 * 0.2 + 0.4; - (GHIDRA_CAST((tmpEntity)))->Entity::SetField380(fStack_37c * (float)pVStack_398); - } - else { - uVar5 = Random(); - pEVar7 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x34,vecResult,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - random_float(); - FUN_00435ed0(); - pEVar7->SetCollisionDamage(); - sizeIndex = Isaac::Random(0x78); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(sizeIndex + 300); - } - } - } - } - uVar5 = GHIDRA_UINT(this->_projectileFlags); - if ((this->_projectileFlags & 0x400000000000) != 0) { - if (this->_target == 0) { - VStack_3f8.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - tmpEntity = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(this->_spawnerEntity) == GHIDRA_CAST(0x0)) { -LAB_00657ca1: - if ((uVar5 & 0x80000000) != 0) goto LAB_00657cca; - tmpEntity = Game::GetNearestTargetPlayer(&this->_pos,tmpEntity,0,1,(void *)0x0,5000.0); - } - else { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::HasEntityFlags(0x100); - tmpEntity = GHIDRA_CAST(this->_spawnerEntity); - if (bVar3 == 0) { - VStack_3f8.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - goto LAB_00657ca1; - } -LAB_00657cca: - tmpEntity = Game::GetNearestEnemy(&this->_pos,tmpEntity,5000.0,(void *)0x0); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(tmpEntity); - } - uVar5 = Random(); - pEStack_358 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x7e,&this->_pos,&g_vectorZero, - GHIDRA_CAST(this->_spawnerEntity),1,uVar5); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Entity)::GetSprite(); - tmpColor = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(tmpColor); - if (GHIDRA_CAST(this->_target) == GHIDRA_CAST(0x0)) { - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::Normalized(&VStack_3b0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__unm(&tmpVecA); - } - else { - vecResult = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Position(&VStack_3b0); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&tmpVecA,&this->_pos); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Normalized(&tmpVecB); - } - pEVar7 = pEStack_358; - (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Entity::SetTargetPosition(*vecResult); - pEVar7->Update(); - } - if ((this->_projectileFlags & 0x80000000000000) != 0) { - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::Normalized(&VStack_3b0); - (GHIDRA_CAST((vecResult)))->Vector::__unm(&VStack_3f8); - play_sound_with_fart_seed(0x1e,1.0,2,0,1.0); - uVar5 = Random(); - pVStack_398 = &this->_pos; - tmpEntity = Game::Spawn(g_game,1000,2,pVStack_398,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar5); - tmpEntity->Update(); - pEStack_358 = GHIDRA_CAST(0xfffffffe); - do { - uVar5 = Random(); - tmpEntity = GHIDRA_CAST(this->_spawnerEntity); - vecResult = (GHIDRA_CAST((&VStack_3f8)))->Vector::Rotated(&VStack_3b0,(float)GHIDRA_INT(pEStack_358) * 24.0); - fStack_37c = 10.0; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecA,&fStack_37c); - tmpEntity = Game::Spawn(g_game,9,0,pVStack_398,vecResult,tmpEntity,0,uVar5); - this = projectile; - (GHIDRA_CAST((tmpEntity)))->Entity::SetTarget(GHIDRA_CAST(projectile)); - (GHIDRA_CAST((tmpEntity)))->Entity::SetParent(GHIDRA_CAST(this->_parent)); - tmpEntity->SetColor(); - tmpEntity->Update(); - pEStack_358 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_358)) + 0x1)))); - } while (GHIDRA_INT(pEStack_358) < 3); - } - if (this->_variant == 0xf) { - uVar5 = Random(); - vecResult = &this->_pos; - tmpEntity = Game::Spawn(g_game,1000,2,vecResult,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar5); - tmpEntity->SetColor(); - tmpEntity->Update(); - this = projectile; - play_sound_with_fart_seed(0x1e,1.0,2,0,1.0); - FUN_00557b50(); - spawn_gibs(vecResult,8,40.0,GHIDRA_CAST(&fStack_37c),GHIDRA_CAST(this),&g_colorGreenSplat, - &g_vectorZero,1.0); - } - if (pEStack_374 != GHIDRA_CAST(0x0)) { - vfunc = *(code **)(*GHIDRA_CAST(pEStack_374) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Color(); - (*vfunc)(); - if (this->_variant == 3) { - vfunc = *(code **)(*GHIDRA_CAST(pEStack_374) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - } - else { - if (this->_variant != 0xc) goto LAB_006580b1; - vfunc = *(code **)(*GHIDRA_CAST(pEStack_374) + 0x3c); - (GHIDRA_CAST((&CStack_108)))->Color::Color(0.0,0.0,0.0,1.0); - } - (*vfunc)(); - } -LAB_006580b1: - this->Remove(); - if (this->_variant != 2) { - ExceptionList = pvStack_1c; - return; - } - if (this->_spawnerType == 0x3b7) { - play_sound_with_fart_seed(700,1.0,2,0,1.0); - ExceptionList = pvStack_1c; - return; - } - ExceptionList = pvStack_1c; - return; - } - VStack_408.x = *GHIDRA_CAST(&this->_projectileFlags); - if ((this->_projectileFlags & 0x400000000) != 0) { - if ((this->_parent != 0) && - ((((this->_projectileFlags & 0x100000000) == 0 || - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), sizeIndex < 1)) || - ((0 < this->_changeTimeout && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks((float)this->_changeTimeout,0.0), - sizeIndex == 0)))))) { - pEStack_358 = GHIDRA_CAST(&this->_velocity); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&VStack_3b0,GHIDRA_CAST(pEStack_358)); - vecResult2 = GHIDRA_CAST(FUN_004172b0()); - (GHIDRA_CAST((vecResult)))->Vector::__sub(&VStack_3a0,vecResult2); - pEStack_360 = GHIDRA_CAST((GHIDRA_CAST((&VStack_3a0)))->Vector)::Length(); - if ((float)pEStack_360 != 0.0) { - (GHIDRA_CAST((&VStack_3a0)))->Vector::__div(&VStack_400,GHIDRA_CAST(&pEStack_360)); - fVar19 = (GHIDRA_CAST((&VStack_400)))->Vector::GetAngleDegrees(); - this->_curvingStrength = fVar19; - (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Vector::operator__(&this->_targetPosition); - bVar3 = 0; - fStack_37c = (50.0 - (float)pEStack_360) * 0.1; - vecResult = (GHIDRA_CAST((&VStack_400)))->Vector::__mul(&VStack_3b0,&fStack_37c); - vecResult = vector_lerp(&tmpVecA,GHIDRA_CAST(pEStack_358),vecResult,bVar3,0.3); - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(projectile->_parent))))->Entity::Velocity(&tmpVecB); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__add(&tmpVecC,vecResult2); - (GHIDRA_CAST((GHIDRA_CAST(pEStack_358))))->Vector::operator_assign(vecResult); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(projectile->_parent))))->Entity::Velocity(&VStack_3f8); - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(vecResult); - this = projectile; - } - fVar19 = Math::lerp(this->_height,-23.0,0.4,0); - this->_height = fVar19; - update_height_collision(this); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(8,0); - if (bVar3 != 0) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - (GHIDRA_CAST((&CStack_108)))->Color::Color(1.0,1.0,1.0,0.35,0.45,0.5); - (GHIDRA_CAST((aCStackY_1c2c + 0x81)))->Color::operator_assign(&projectile->_color); - FUN_004072e0(); - (*vfunc)(); - } - goto LAB_0065acd8; - } - vecResult = Vector::FromAngle(&angleDir,this->_curvingStrength); - vecResult = Vector::operator_mul(&angleVelocity,&this->_changeVelocity,vecResult); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(vecResult); - this->_curvingStrength = 0.015; - } - if (*(code **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x470))) != (code *)0x0) { - (**(code **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x470))))(); - } - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - if ((GHIDRA_UINT(fVar19) & 0x10000) == 0) { - if ((uVar5 & 1) != 0) { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0); - if (bVar3 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - } - tmpEntity = GHIDRA_CAST(this->_target); - if (tmpEntity == GHIDRA_CAST(0x0)) { - if (((GHIDRA_CAST(this->_spawnerEntity) == GHIDRA_CAST(0x0)) || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::HasEntityFlags(0x100), bVar3 == 0)) && - ((this->_projectileFlags & 0x80000000) == 0)) { - tmpEntity = Game::GetNearestTargetPlayer - (&this->_pos,GHIDRA_CAST(this->_spawnerEntity),0,1,(void *)0x0,500.0); - } - else { - tmpEntity = Game::GetNearestEnemy - (&this->_pos,GHIDRA_CAST(this->_spawnerEntity),500.0,(void *)0x0); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(tmpEntity); - tmpEntity = GHIDRA_CAST(this->_target); - if (tmpEntity != GHIDRA_CAST(0x0)) goto LAB_00658602; - } - else { -LAB_00658602: - (GHIDRA_CAST((tmpEntity)))->Entity::Position(&VStack_3a0); - (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Velocity(&VStack_3a8); - fStack_3bc = 0.5; - vecResult = (GHIDRA_CAST((&VStack_3a8)))->Vector::__mul(&VStack_4a4,&fStack_3bc); - vecResult = (GHIDRA_CAST((&VStack_3a0)))->Vector::__add(GHIDRA_CAST((entityQuery2 + 0x10)),vecResult); - (GHIDRA_CAST((vecResult)))->Vector::__sub(&scratchVec,&this->_pos); - fStack_3bc = (GHIDRA_CAST((&scratchVec)))->Vector::Length(); - if (fStack_3bc < 100.0) { - vecResult = (GHIDRA_CAST((&VStack_3a0)))->Vector::__sub(&VStack_4a4,&this->_pos); - (GHIDRA_CAST((&scratchVec)))->Vector::operator_assign(vecResult); - vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::Normalized(GHIDRA_CAST((entityQuery2 + 0x10))); - fStack_3bc = 1.4; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_4a4,&fStack_3bc); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_510,&this->_homingStrength); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_518,&this->_speedMultiplier); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(vecResult); - fStack_3bc = this->_speedMultiplier; - fVar19 = Math::lerp(1.0,0.92,this->_homingStrength,0); - fStack_37c = Math::timescale_factor(fVar19,fStack_3bc); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_mul_assign(&fStack_37c); - } - } - pCVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::GetColor(); - fStack_3bc = (GHIDRA_CAST((pCVar14)))->Color::R(); - if (fStack_3bc == 1.0) { - (GHIDRA_CAST((&purpleTint)))->Color::Color(); - (GHIDRA_CAST((&purpleTint)))->Color::SetColorize(0.8,0.15,1.0,1.0); - (GHIDRA_CAST((&purpleTint)))->Color::SetOffset(0.26,0.05,0.4); - this->SetColor(); - } - } - } - else { - tmpEntity = GHIDRA_CAST(this->_target); - if (tmpEntity == GHIDRA_CAST(0x0)) { - VStack_3a8.y = fVar19; - if (GHIDRA_CAST(this->_spawnerEntity) == GHIDRA_CAST(0x0)) { -LAB_00658433: - if ((uVar5 & 0x80000000) != 0) goto LAB_00658462; - tmpEntity = Game::GetNearestTargetPlayer - (&this->_pos,GHIDRA_CAST(this->_spawnerEntity),0,1,(void *)0x0,5000.0); - } - else { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::HasEntityFlags(0x100); - if (bVar3 == 0) { - VStack_3a8.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - goto LAB_00658433; - } -LAB_00658462: - tmpEntity = Game::GetNearestEnemy - (&this->_pos,GHIDRA_CAST(this->_spawnerEntity),5000.0,(void *)0x0); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(tmpEntity); - tmpEntity = GHIDRA_CAST(this->_target); - if (tmpEntity == GHIDRA_CAST(0x0)) goto LAB_00658802; - } - vecResult = (GHIDRA_CAST((tmpEntity)))->Entity::Position(&homingTargetPos); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__sub(&VStack_518,&this->_pos); - fStack_37c = 0.1; - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_510,&fStack_37c); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__add(GHIDRA_CAST((entityQuery2 + 0x10)),vecResult); - pVStack_398 = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - fStack_3bc = 0.001; - pfVar10 = GHIDRA_CAST(std)::max(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Resized(&VStack_4a4,*pfVar10); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(vecResult); - } -LAB_00658802: - uVar5 = GHIDRA_UINT(this->_projectileFlags); - VStack_3a0.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - if (((uVar5 & 0x10) != 0) && (this->_spawnerType != 0x11d)) { - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*vfunc)(); - VStack_3a0.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - } - if (((uVar5 & 0x400) != 0) && (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0), bVar3 != 0)) { - uVar5 = Random(); - pEVar7 = (Entity_Effect *) - Game::Spawn(g_game,1000,0x16,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - if (this->_spawnerType != 0x10e) { - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(0x5a); - } - } - if (((this->_projectileFlags & 0x4000) != 0) && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(20.0,0.0), sizeIndex != 0)) { - uVar5 = Random(); - Game::Spawn(g_game,1000,0x38,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); - pEVar7 = GHIDRA_CAST(__RTDynamicCast()); - pEVar7->Update(); - (GHIDRA_CAST((pEVar7)))->Entity_Effect::SetTimeout(0xb4); - } - if ((this->_projectileFlags & 0x40000000) == 0) goto LAB_00658b5a; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = (GHIDRA_CAST((room)))->Room::ScreenWrapPosition(&tmpVecA,&this->_pos,-100.0); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(vecResult); - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,this->_index); - if (bVar3 == 0) goto LAB_00658b5a; - fVar19 = this->_updateTime; - (GHIDRA_CAST((GHIDRA_CAST(auStack_cc))))->Color::Color(); - switch(GHIDRA_INT((fVar19 * 0.5)) % 9) { - case 0: - fVar19 = 0.33; - goto LAB_00658b2f; - case 1: - fVar19 = 0.66; - goto LAB_00658b2f; - case 2: - fVar19 = 1.0; - goto LAB_00658b2f; - case 3: - fVar20 = 0.66; - fVar19 = 0.66; - fVar17 = 0.66; - break; - case 4: - fVar20 = 0.33; - fVar19 = 0.33; - fVar17 = 0.33; - break; - case 5: - (GHIDRA_CAST((GHIDRA_CAST(auStack_cc))))->Color::SetTint(0.0,0.0,0.0,1.0); - goto LAB_00658b41; - case 6: - fVar20 = 0.33; - fVar19 = 0.0; - fVar17 = 0.33; - break; - case 7: - fVar20 = 0.66; - fVar19 = 0.0; - fVar17 = 0.66; - break; - case 8: - fVar19 = 0.0; -LAB_00658b2f: - fVar20 = 1.0; - fVar17 = 1.0; - break; - default: - goto LAB_00658b41; - } - (GHIDRA_CAST((GHIDRA_CAST(auStack_cc))))->Color::SetColorize(fVar17,fVar19,fVar20,1.0); -LAB_00658b41: - this->SetColor(); -LAB_00658b5a: - if ((this->_projectileFlags & 0x1800) != 0) { - if (((this->_projectileFlags & 0x100000000000000) == 0) || (this->_parent == 0)) { - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&VStack_3e4,&this->_targetPosition); - (GHIDRA_CAST((&VStack_428)))->Vector::Vector(-VStack_3e4.y,VStack_3e4.x); - if ((this->_projectileFlags & 0x1000) != 0) { - vecResult = (GHIDRA_CAST((&VStack_428)))->Vector::__unm(&VStack_508); - (GHIDRA_CAST((&VStack_428)))->Vector::operator_assign(vecResult); - } - if (this->_orbitDistance <= 0.0) { - pEStack_34c = GHIDRA_CAST(0x3f000000); - ppEVar11 = &pEStack_34c; - } - else { - fVar19 = (GHIDRA_CAST((&VStack_3e4)))->Vector::Length(); - pEStack_34c = GHIDRA_CAST((1.0 - fVar19 / this->_orbitDistance)); - fVar19 = Math::clamp(-1.0,1.0,(float)pEStack_34c); - pEStack_354 = GHIDRA_CAST((fVar19 * 0.5)); - ppEVar11 = &pEStack_354; - } - (GHIDRA_CAST((&VStack_3e4)))->Vector::operator_mul_assign(GHIDRA_CAST(ppEVar11)); - vecResult = (GHIDRA_CAST((&VStack_3e4)))->Vector::__add(&orbitSteer,&VStack_428); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Normalized(&orbitSteerDir); - speed = (GHIDRA_CAST((&this->_velocity)))->Vector::Length(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&orbitVelocity,&speed); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(vecResult); - this = projectile; - } - else { - (GHIDRA_CAST((&this->_velocity)))->Vector::operator__(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x468))))); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::Position(&tmpVecA); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&fromOrbitParent,vecResult); - (GHIDRA_CAST((&orbitParentTangent)))->Vector::Vector(-fromOrbitParent.y,fromOrbitParent.x); - if ((this->_projectileFlags & 0x1000) != 0) { - vecResult = (GHIDRA_CAST((&orbitParentTangent)))->Vector::__unm(&tmpVecA); - (GHIDRA_CAST((&orbitParentTangent)))->Vector::operator_assign(vecResult); - } - if (this->_orbitDistance <= 0.0) { - pEStack_34c = GHIDRA_CAST(0x3f000000); - ppEVar11 = &pEStack_34c; - } - else { - fVar19 = (GHIDRA_CAST((&fromOrbitParent)))->Vector::Length(); - pEStack_34c = GHIDRA_CAST((1.0 - fVar19 / this->_orbitDistance)); - fVar19 = Math::clamp(-1.0,1.0,(float)pEStack_34c); - pEStack_354 = GHIDRA_CAST((fVar19 * 0.5)); - ppEVar11 = &pEStack_354; - } - (GHIDRA_CAST((&fromOrbitParent)))->Vector::operator_mul_assign(GHIDRA_CAST(ppEVar11)); - vecResult = (GHIDRA_CAST((&fromOrbitParent)))->Vector::__add(&tmpVecA,&orbitParentTangent); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Normalized(&tmpVecB); - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecC,GHIDRA_CAST(&pEStack_34c)); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(vecResult); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::Velocity(&VStack_3a8); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(vecResult); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::Velocity(&VStack_408); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x468)))))))->Vector::operator_assign(vecResult); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::Position(&VStack_508); - (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(vecResult); - } - } - pEStack_364 = GHIDRA_CAST(&this->_velocity); - if ((this->_projectileFlags & 0xc0000) != 0) { - vecResult = &this->_velocity; - pEStack_374 = GHIDRA_CAST((GHIDRA_CAST((vecResult)))->Vector)::Length(); - (GHIDRA_CAST((&VStack_430)))->Vector::Vector(-(this->_velocity).y,(this->_velocity).x); - if ((this->_projectileFlags & 0x40000) != 0) { - vecResult2 = (GHIDRA_CAST((&VStack_430)))->Vector::__unm(&tmpVecA); - (GHIDRA_CAST((&VStack_430)))->Vector::operator_assign(vecResult2); - } - vecResult2 = (GHIDRA_CAST((&VStack_430)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_374)); - vecResult2 = (GHIDRA_CAST((vecResult2)))->Vector::__mul(&tmpVecB,&this->_curvingStrength); - vecResult2 = (GHIDRA_CAST((vecResult2)))->Vector::__mul(&tmpVecC,&this->_speedMultiplier); - (GHIDRA_CAST((vecResult)))->Vector::operator_add_assign(vecResult2); - (GHIDRA_CAST((vecResult)))->Vector::Resize((float)pEStack_374); - } - pEStack_364 = GHIDRA_CAST(&this->_velocity); - if ((this->_projectileFlags & 0x100000) != 0) { - uVar5 = 0; - sizeIndex = Game::GetNumPlayers(g_game); - if (0 < sizeIndex) { - do { - player = Game::GetPlayer(g_game,uVar5); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::Position(&tmpVecA); - (GHIDRA_CAST((vecResult)))->Vector::__sub(&toPlayer,&this->_pos); - (GHIDRA_CAST((&tmpVecC)))->Vector::Vector(0.0,1.0); - vecResult = (GHIDRA_CAST((&toPlayer)))->Vector::Normalized(&tmpVecB); - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((&tmpVecC)))->Vector)::Dot(vecResult); - if (((float)pEStack_34c < 0.05) && (-0.4 < (float)pEStack_34c)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pfVar10 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetTopLeftPos(); - if (*pfVar10 - 120.0 < (this->_pos).x) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pfVar10 = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetBottomRightPos(); - if ((this->_pos).x <= *pfVar10 + 120.0 && *pfVar10 + 120.0 != (this->_pos).x) { - vecResult = (GHIDRA_CAST((&tmpVecA)))->Vector::Vector(1.0,0.0); - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecB,GHIDRA_CAST(&pEStack_34c)); - pEStack_354 = GHIDRA_CAST(0x40000000); - (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_400,GHIDRA_CAST(&pEStack_354)); - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((&toPlayer)))->Vector)::Dot(&VStack_400); - if ((float)pEStack_34c <= 0.0) { - vecResult = (GHIDRA_CAST((&VStack_400)))->Vector::__unm(&flippedHorizontalVelocity); - } - else { - vecResult = &VStack_400; - } - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(vecResult); - projFlagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *GHIDRA_CAST(&this->_projectileFlags) = GHIDRA_UINT(this->_projectileFlags) & 0xffefffff; - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)) = projFlagsHigh; - break; - } - } - } - uVar5 = uVar5 + 1; - sizeIndex = Game::GetNumPlayers(g_game); - } while (GHIDRA_INT(uVar5) < sizeIndex); - } - } - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - if ((GHIDRA_UINT(fVar19) & 0x200) != 0) { - if (this->_spawnerEntity == 0) { -LAB_006592f6: - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Die(); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *puVar1 = *puVar1 & 0xfffffdff; - *GHIDRA_CAST(&this->_projectileFlags) = uVar5; - } - else { - vecResult = GHIDRA_CAST((GHIDRA_CAST(()))->Entity)::TargetPosition(); - bVar3 = (GHIDRA_CAST((vecResult)))->Vector::operator_ne(&g_vectorZero); - if (bVar3 == 0) goto LAB_006592f6; - (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::Position(&VStack_4c4); - pfVar10 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity)::TargetPosition(); - scratchVec.x = *pfVar10; - scratchVec.y = pfVar10[1]; - pVStack_384 = GHIDRA_CAST((GHIDRA_CAST((&scratchVec)))->Vector)::Length(); - (GHIDRA_CAST((&scratchVec)))->Vector::__div_assign(GHIDRA_CAST(&pVStack_384)); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&VStack_4cc,&VStack_4c4); - pEStack_358 = GHIDRA_CAST((GHIDRA_CAST((&VStack_4cc)))->Vector)::Length(); - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((&VStack_4cc)))->Vector)::Dot(&scratchVec); - player = pEStack_364; - if ((float)pEStack_34c < 0.0) { - pEStack_358 = GHIDRA_CAST(((float)pEStack_358 * -1.0)); - } - tractorSpeed = (GHIDRA_CAST((GHIDRA_CAST(pEStack_364))))->Vector::Length(); - if (((float)pEStack_358 < 0.0) || ((float)pVStack_384 < (float)pEStack_358)) - goto LAB_006592f6; - vecResult = Vector::operator_mul(&tmpVecA,GHIDRA_CAST(&pEStack_358),&scratchVec); - vecResult = (GHIDRA_CAST((&VStack_4c4)))->Vector::__add(&tmpVecB,vecResult); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(vecResult); - vecResult = Vector::operator_mul(&tractorVelocity,&tractorSpeed,&scratchVec); - (GHIDRA_CAST((GHIDRA_CAST(player))))->Vector::operator_assign(vecResult); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - } - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - if ((GHIDRA_UINT(fVar19) & 0x40000) != 0) { - (GHIDRA_CAST((GHIDRA_CAST((auStack_cc + 0x30)))))->RNG::game_constructor(this->_initSeed,8); - uStack_14 = 4; - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((auStack_cc + 0x30)))))->RNG)::RandomFloat(); - wiggleStrength = Math::lerp(2.0,5.0,(float)pEStack_34c,0); - fVar19 = (GHIDRA_CAST((GHIDRA_CAST((auStack_cc + 0x30)))))->RNG::RandomFloat(); - VStack_3dc.y = (this->_targetPosition).y; - VStack_3dc.x = (this->_targetPosition).x; - pEStack_34c = GHIDRA_CAST((this->_updateTime / 100.0 + fVar19)); - pEStack_360 = GHIDRA_CAST((GHIDRA_CAST((&VStack_3dc)))->Vector)::Length(); - (GHIDRA_CAST((&VStack_3dc)))->Vector::__div_assign(GHIDRA_CAST(&pEStack_360)); - (GHIDRA_CAST((&VStack_3dc)))->Vector::Rotated(&tmpVecB,90.0); - pVStack_3c4 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEStack_364))))->Vector)::Dot(&VStack_3dc); - (GHIDRA_CAST((&VStack_3dc)))->Vector::__mul(&VStack_4b4,GHIDRA_CAST(&pVStack_3c4)); - vecResult = (GHIDRA_CAST((&tmpVecB)))->Vector::__mul(&VStack_3a8,&wiggleStrength); - pEStack_354 = (Entity_Player *) - sinf_wrapper(((float)pEStack_34c + (float)pEStack_34c) * 3.1415927); - (GHIDRA_CAST((vecResult)))->Vector::__mul(&tmpVecA,GHIDRA_CAST(&pEStack_354)); - if ((float)pVStack_3c4 < (float)pEStack_360) { - vecResult = (GHIDRA_CAST((&VStack_3dc)))->Vector::__mul(&VStack_3a8,GHIDRA_CAST(&pEStack_360)); - pEStack_34c = GHIDRA_CAST(0x3bf5c28f); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::__mul(&VStack_408,GHIDRA_CAST(&pEStack_34c)); - (GHIDRA_CAST((&VStack_4b4)))->Vector::operator_add_assign(vecResult); - } - vecResult = (GHIDRA_CAST((&VStack_4b4)))->Vector::__add(&VStack_3a8,&tmpVecA); - (GHIDRA_CAST((GHIDRA_CAST(pEStack_364))))->Vector::operator_assign(vecResult); - uStack_14 = -1; - guard_check_icall(); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - if ((uVar5 & 0x200000) != 0) { - fVar19 = this->_updateTime * 3.1415927; - sineFactor = sinf_wrapper((fVar19 + fVar19) / 30.0); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&sineVelocityOffset,&sineFactor); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_add_assign(vecResult); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - pEStack_364 = GHIDRA_CAST(&this->_pos); - if ((uVar5 & 0x20) != 0) { - (GHIDRA_CAST((&VStack_474)))->Vector::Vector((this->_velocity).y,-(this->_velocity).x); - (GHIDRA_CAST((&VStack_474)))->Vector::Normalize(); - fVar19 = 1.0; - if (this->_spawnerType == 0x390) { - fVar19 = 2.0; - } - fVar19 = ((float)this->_wiggleFrameOffset + this->_updateTime) * fVar19 * 3.1415927; - fVar19 = (fVar19 + fVar19) / 30.0; - FUN_00417150(); - wiggleAmount = fVar19 * 3.0; - vecResult = (GHIDRA_CAST((&VStack_474)))->Vector::__mul(&wiggleOffset,&wiggleAmount); - (GHIDRA_CAST((GHIDRA_CAST(pEStack_364))))->Vector::operator_add_assign(vecResult); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - vecResult = &this->_velocity; - VStack_3a8.y = fVar19; - if ((uVar5 & 0x400000) != 0) { - (GHIDRA_CAST((GHIDRA_CAST((entityQuery + 0x1c)))))->Vector::Vector((this->_velocity).y,-vecResult->x); - (GHIDRA_CAST((GHIDRA_CAST((entityQuery + 0x1c)))))->Vector::Normalize(); - pEStack_34c = GHIDRA_CAST(0x40800000); - pEStack_354 = GHIDRA_CAST((((float)this->_wiggleFrameOffset + this->_updateTime) * 0.04)); - pfVar10 = GHIDRA_CAST(std)::min(); - pEStack_34c = GHIDRA_CAST((*pfVar10 + 3.0)); - fVar19 = ((float)this->_wiggleFrameOffset + this->_updateTime) * 3.1415927; - fVar19 = (fVar19 + fVar19) / 30.0; - FUN_00417150(); - megaWiggleAmount = fVar19 * (float)pEStack_34c; - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST((entityQuery + 0x1c)))))->Vector::__mul(&megaWiggleOffset,&megaWiggleAmount); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_add_assign(vecResult2); - VStack_3a8.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - } - if ((uVar5 & 0x800000) != 0) { - fVar19 = sqrtf(2.0); - pEStack_34c = GHIDRA_CAST((fVar19 * 30.0)); - fVar19 = sqrtf(2.0); - pEStack_34c = GHIDRA_CAST(GHIDRA_INT(((float)pEStack_34c / (fVar19 + 1.0)))); - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (sizeIndex == 1) { - fVar19 = 45.0; - vecResult2 = &sawtoothFirstVelocity; - } - else { - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetHitPointsLost(); - if (sizeIndex < 1) goto LAB_00659836; - player = GHIDRA_CAST((GHIDRA_INT(this->_updateTime) % 0x1e)); - if (player == pEStack_34c) { - fVar19 = -135.0; - vecResult2 = &sawtoothLeftVelocity; - } - else { - if (player != GHIDRA_CAST(0x0)) goto LAB_00659836; - fVar19 = 135.0; - vecResult2 = &sawtoothRightVelocity; - } - } - vecResult2 = (GHIDRA_CAST((vecResult)))->Vector::Rotated(vecResult2,fVar19); - (GHIDRA_CAST((vecResult)))->Vector::operator_assign(vecResult2); - } -LAB_00659836: - if ((this->_projectileFlags & 0x2000000) != 0) { - fVar19 = sqrtf(2.0); - pEStack_34c = GHIDRA_CAST((fVar19 * 15.0)); - fVar19 = sqrtf(2.0); - pEStack_34c = GHIDRA_CAST(GHIDRA_INT(((float)pEStack_34c / (fVar19 + 1.0)))); - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (sizeIndex == 1) { - fVar19 = 45.0; - vecResult2 = &triangleFirstVelocity; - } - else { - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetHitPointsLost(); - if (sizeIndex < 1) goto LAB_00659903; - player = GHIDRA_CAST((GHIDRA_INT(this->_updateTime) % 0xf)); - if (player == pEStack_34c) { - fVar19 = -90.0; - vecResult2 = &triangleLeftVelocity; - } - else { - if (player != GHIDRA_CAST(0x0)) goto LAB_00659903; - fVar19 = 90.0; - vecResult2 = &triangleRightVelocity; - } - } - vecResult2 = (GHIDRA_CAST((vecResult)))->Vector::Rotated(vecResult2,fVar19); - (GHIDRA_CAST((vecResult)))->Vector::operator_assign(vecResult2); - } -LAB_00659903: - if (((this->_projectileFlags & 0x4000000) != 0) && (GHIDRA_CAST(this->_parent) != GHIDRA_CAST(0x0))) { - vecResult2 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::Position(&VStack_3a8); - (GHIDRA_CAST((vecResult2)))->Vector::__sub(&VStack_408,&this->_pos); - fVar19 = (GHIDRA_CAST((vecResult)))->Vector::Length(); - vecResult2 = (GHIDRA_CAST((&VStack_408)))->Vector::Resized(&VStack_3a8,fVar19); - (GHIDRA_CAST((vecResult)))->Vector::operator_assign(vecResult2); - pEStack_354 = GHIDRA_CAST((GHIDRA_CAST((&VStack_408)))->Vector)::LengthSquared(); - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((vecResult)))->Vector)::LengthSquared(); - if ((float)pEStack_354 < (float)pEStack_34c) { -LAB_00653169: - this->Remove(); - ExceptionList = pvStack_1c; - return; - } - } - if ((this->_projectileFlags & 0x10000000000000) != 0) { - (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(&VStack_3a0,&this->_pos); - pEStack_35c = GHIDRA_CAST((GHIDRA_CAST((&VStack_3a0)))->Vector)::Length(); - if (10.0 <= (float)pEStack_35c) { - (GHIDRA_CAST((&VStack_3a0)))->Vector::__div_assign(GHIDRA_CAST(&pEStack_35c)); - bVar3 = 0; - vecResult2 = (GHIDRA_CAST((&VStack_3a0)))->Vector::__mul(&VStack_500,&this->_homingStrength); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity(vecResult2,bVar3); - if (this->_updateTime <= 150.0 && this->_updateTime != 150.0) { - this->_fallingSpeed = 0.0; - this->_height = -15.0; - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Die(); - } - } - if ((this->_projectileFlags & 0x8000000) != 0) { - accelerateFactor = Math::timescale_factor(this->_acceleration,this->_speedMultiplier); - (GHIDRA_CAST((vecResult)))->Vector::operator_mul_assign(&accelerateFactor); - if (this->_spawnerType == 0x197) { - pEStack_34c = GHIDRA_CAST((GHIDRA_CAST((vecResult)))->Vector)::Length(); - if (9.0 < (float)pEStack_34c) { - fStack_40c = 9.0 / (float)pEStack_34c; - pfVar10 = &fStack_40c; - goto LAB_00659b08; - } - } - else if ((this->_spawnerType == 0x378) && - (fStack_40c = (GHIDRA_CAST((vecResult)))->Vector::Length(), 10.0 < fStack_40c)) { - speedCapScale = 10.0 / fStack_40c; - pfVar10 = &speedCapScale; -LAB_00659b08: - (GHIDRA_CAST((vecResult)))->Vector::operator_mul_assign(pfVar10); - } - } - uVar5 = GHIDRA_UINT(this->_projectileFlags); - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - if ((uVar5 & 0x10000000) != 0) { - decelerateFactor = Math::timescale_factor(1.0 / this->_acceleration,this->_speedMultiplier); - (GHIDRA_CAST((vecResult)))->Vector::operator_mul_assign(&decelerateFactor); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - fVar19 = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - VStack_3a8.y = fVar19; - if ((GHIDRA_UINT(fVar19) & 0x20) != 0) { - pEStack_34c = GHIDRA_CAST((this->_updateTime / 20.0)); - pEStack_354 = GHIDRA_CAST(0x3f800000); - pfVar10 = GHIDRA_CAST(std)::min(); - pEStack_364 = GHIDRA_CAST(this->_speedMultiplier); - fVar19 = Math::lerp(1.0,this->_acceleration,*pfVar10,0); - accelerateExFactor = Math::timescale_factor(fVar19,(float)pEStack_364); - (GHIDRA_CAST((vecResult)))->Vector::operator_mul_assign(&accelerateExFactor); - VStack_3a8.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - uVar5 = GHIDRA_UINT(this->_projectileFlags); - } - if ((((uVar5 & 0x20000000) != 0) && (20.0 < this->_updateTime)) && - (((sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetHitPointsLost(), 0 < sizeIndex && - (sizeIndex = Isaac::Random(0x1e), sizeIndex == 0)) || (this->_spawnerType == 0x3e)))) { - (GHIDRA_CAST((GHIDRA_CAST(auStack_3c))))->Vector::Vector(-(this->_velocity).y,(this->_velocity).x); - (GHIDRA_CAST((&VStack_34)))->Vector::Vector((this->_velocity).y,-(this->_velocity).x); - forwardDirX = (this->_velocity).x; - pEStack_34c = GHIDRA_CAST(auStack_3c); - forwardDirY = (this->_velocity).y; - rng._shift1 = 0x40000; - rng._shift2 = 0x80000; - rng._shift3 = 0x200000; - pEStack_364 = GHIDRA_CAST(0x0); - do { - player = pEStack_34c; - pEStack_354 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEStack_34c))))->Vector)::LengthSquared(); - if (25.0 <= (float)pEStack_354) { - VStack_47c.y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x4)))); - vecResult = &VStack_47c; - VStack_47c.x = *GHIDRA_CAST(player); - } - else { - fStack_410 = 1.6; - vecResult = (GHIDRA_CAST((GHIDRA_CAST(player))))->Vector::__mul(&VStack_4bc,&fStack_410); - } - VStack_3a8.x = vecResult->x; - VStack_3a8.y = vecResult->y; - uVar5 = Random(); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&VStack_440,&this->_velocity); - Game::Spawn(g_game,this->_type,this->_variant,vecResult,&VStack_3a8,GHIDRA_CAST(0x0),0,uVar5); - player = GHIDRA_CAST(__RTDynamicCast()); - pEStack_354 = player; - FUN_004316b0(); - FUN_004b7070(); - pVStack_3d0 = GHIDRA_CAST((this->_height * 0.6)); - pEStack_378 = GHIDRA_CAST(0xc1b80000); - msvc::min(); - FUN_00450880(); - pEStack_378 = GHIDRA_CAST((this->_scale - 0.667)); - pVStack_3d0 = GHIDRA_CAST(0x3f800000); - msvc::max(); - FUN_004508a0(); - if (1.0 < this->_scale) { - player->_fireBlockCooldown = GHIDRA_INT(this->_fallingAccel); - random_float(); - } - else { - projFlagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *GHIDRA_CAST(&this->_projectileFlags) = GHIDRA_UINT(this->_projectileFlags) & 0xdfffffff; - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)) = projFlagsHigh; - player->_fireBlockCooldown = 0x3dcccccd; - player->_controlsCooldown = -0x3fc00000; - } - savedProjFlags = this->_projectileFlags; - *GHIDRA_CAST(((player->_bodySprite)._animDefaultName._buf + 8)) = - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - sizeIndex = *GHIDRA_CAST(player); - *GHIDRA_CAST(((player->_bodySprite)._animDefaultName._buf + 4)) = - GHIDRA_UINT((&CStack_108)[1]._tint[GHIDRA_INT(pEStack_364) + 1]) | GHIDRA_UINT(savedProjFlags) & 0xffd3ffff; - vfunc = *(code **)(sizeIndex + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Color(); - (*vfunc)(); - player = pEStack_354; - (GHIDRA_CAST((GHIDRA_CAST(pEStack_354))))->Entity::SetParent(GHIDRA_CAST(this->_parent)); - player->Update(); - pEStack_364 = GHIDRA_CAST((GHIDRA_INT(pEStack_364) + 1)); - pEStack_34c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEStack_34c)) + 0x8)))); - } while (GHIDRA_INT(pEStack_364) < 3); - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x24); - (GHIDRA_CAST((GHIDRA_CAST((auStack_160 + 4)))))->EntityRef::EntityRef(); - (*vfunc)(); - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - bVar3 = PlayerManager::AnyoneHasCollectible(playerManager,0x1a7); - if (bVar3 == 0) { -LAB_00659f8a: - isCircleProc = '\0'; - } - else { - (GHIDRA_CAST((&rng)))->RNG::game_constructor(this->_initSeed,0x2c); - uStack_14 = 5; - pEStack_368 = GHIDRA_CAST(0x1); - uVar5 = (GHIDRA_CAST((this_00)))->RNG::RandomInt(100); - isCircleProc = '\x01'; - if (0x20 < uVar5) goto LAB_00659f8a; - } - uStack_14 = -1; - if ((GHIDRA_UINT(pEStack_368) & 1) != 0) { - guard_check_icall(); - } - if (isCircleProc != '\0') { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QuerySublist(entityList,GHIDRA_CAST(entityQuery),7,8,3,1,0); - uStack_14 = 6; - player = GHIDRA_CAST(0x0); - pEStack_34c = GHIDRA_CAST(0x0); - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(entityQuery))))->EntityList::Size(); - if (sizeIndex != 0) { - do { - msvc::vector::operator_index(); - pEStack_368 = GHIDRA_CAST(__RTDynamicCast()); - fVar16 = (long double)(GHIDRA_CAST((GHIDRA_CAST(pEStack_368))))->Entity_Laser::Radius(); - pEStack_378 = GHIDRA_CAST((float)fVar16); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(pEStack_368))))->Entity::Position(&VStack_440); - pVStack_3d0 = GHIDRA_CAST((GHIDRA_CAST((&this->_pos)))->Vector)::DistanceSquared(vecResult); - if ((float)pVStack_3d0 < (float)pEStack_378 * (float)pEStack_378) { - this->Remove(); - player = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEStack_368))))->Entity)::SpawnerEntity(); - pEStack_360 = player; - if (player == GHIDRA_CAST(0x0)) { -LAB_0065a0e7: - (GHIDRA_CAST((&TStack_2e0)))->TearParams::constructor(); - other = extraout_EAX_00; - } - else { - bVar3 = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::is_player(); - if (bVar3 == 0) { - player = GHIDRA_CAST(0x0); - } - pEStack_360 = player; - if (player == GHIDRA_CAST(0x0)) goto LAB_0065a0e7; - tmpEntity = GHIDRA_CAST(0x0); - sizeIndex = Isaac::Random(2); - other = Entity_Player::GetTearHitParams - (player,&TStack_348,1,1.0,sizeIndex * 2 + -1,tmpEntity); - } - (GHIDRA_CAST((&spawnerTearParams)))->TearParams::copy(other); - uVar5 = Random(); - vecResult = (GHIDRA_CAST((&this->_velocity)))->Vector::__unm(&VStack_4bc); - Game::Spawn(g_game,2,0,&this->_pos,vecResult,GHIDRA_CAST(pEStack_360),0,uVar5); - this_01 = GHIDRA_CAST(__RTDynamicCast()); - SetHeight(GHIDRA_CAST(this_01),this->_height); - FUN_00444c70(); - this_01->SetCollisionDamage(); - (GHIDRA_CAST((this_01)))->Entity_Tear::SetTearFlags(g_tearFlagHoming); - (GHIDRA_CAST((this_01)))->Entity_Tear::SetScale(spawnerTearParams._tearScale); - set_falling_accel(GHIDRA_CAST(this_01),this->_fallingAccel); - (GHIDRA_CAST(()))->Color::Color(); - this_01->SetColor(); - (GHIDRA_CAST((GHIDRA_CAST(this_01))))->Entity::SetParent(GHIDRA_CAST(pEStack_360)); - this_01->Update(); - player = pEStack_34c; - } - player = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x1)))); - pEStack_34c = player; - puVar12 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(entityQuery))))->EntityList)::Size(); - } while (player < puVar12); - } - uStack_14 = -1; - (GHIDRA_CAST((entityQuery)))->EntityList_Query::~EntityList_Query(); - } - fVar17 = Math::timescale_factor(0.9,this->_speedMultiplier); - fVar19 = this->_speedMultiplier; - fVar17 = fVar19 * this->_fallingAccel + fVar19 * 0.1 + fVar17 * this->_fallingSpeed; - this->_fallingSpeed = fVar17; - fVar19 = fVar17 * fVar19 + this->_height; - this->_height = fVar19; - if (this->_variant == 0xf) { - FUN_00431290(); - FUN_004312b0(); - pEStack_378 = GHIDRA_CAST((fVar17 * 2.0)); - fVar16 = (long double)(GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Rotation(); - pEStack_378 = GHIDRA_CAST((float)(fVar16 + (long double)(float)pEStack_378)); - fVar19 = normalize_angle_degrees((float)pEStack_378); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar19); - fVar19 = this->_height; - } - pEStack_368 = GHIDRA_CAST(&this->_velocity); - if (isSideView != 0) { - if (this->_fallingAccel < 0.001) { - if (-10.0 < fVar19) { - fVar19 = this->_speedMultiplier * 0.5; - goto LAB_0065a376; - } - } - else { - fVar19 = this->_fallingAccel * this->_speedMultiplier; -LAB_0065a376: - (this->_velocity).y = fVar19 + (this->_velocity).y; - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - vecResult = &this->_pos; - Room::GetClampedPositionImpl(room,&VStack_3a8,vecResult,-600.0,-200.0,-200.0,-200.0); - bVar3 = (GHIDRA_CAST((vecResult)))->Vector::operator_ne(&VStack_3a8); - if (bVar3 != 0) { - vecResult2 = (GHIDRA_CAST((&VStack_3a8)))->Vector::__sub(&VStack_440,vecResult); - pEStack_378 = GHIDRA_CAST((GHIDRA_CAST((vecResult2)))->Vector)::Dot(GHIDRA_CAST(pEStack_368)); - if ((float)pEStack_378 < 0.0) { - this->Remove(); - } - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar3 = (GHIDRA_CAST((room)))->Room::IsBeastDungeon(); - if (((bVar3 != 0) && (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), 2 < sizeIndex)) && - (fVar19 = (this->_velocity).y, 0.0 < fVar19)) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_lava_line_y(); - if (fVar19 < (this->_pos).y) { - if ((this->_projectileFlags & 2) == 0) { - this->Remove(); - pEStack_368 = GHIDRA_CAST(0x42); - if ((this->_variant == 0xe) && (this->_spawnerType == 0x3b7)) { - play_sound_with_fart_seed(0x2bf,1.0,2,0,1.0); - pEStack_368 = GHIDRA_CAST(&DAT_00000043); - } - uVar5 = Random(); - tmpEntity = Game::Spawn(g_game,1000,0x10,vecResult,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_UINT(pEStack_368),uVar5); - tmpEntity->Update(); - } - else { - this->_dead = 1; - } - } - } - } - VStack_408.y = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - if ((this->_projectileFlags & 0x1000000) == 0) { - if ((this->_projectileFlags & 0x80000080) == 0x80000080) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - cVar4 = (GHIDRA_CAST((room)))->Room::HasSlowDown(); - if (cVar4 != '\0') goto LAB_0065a5c5; - } - else if ((GHIDRA_CAST(this->_parent) == GHIDRA_CAST(0x0)) || - (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::HasEntityFlags(0x20000000), bVar3 == 0)) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - tempEffects = GHIDRA_CAST(FUN_004360d0()); - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x42); - if (bVar3 == 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - tempEffects = GHIDRA_CAST(FUN_004360d0()); - bVar3 = (GHIDRA_CAST((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0xe8); - if (bVar3 == 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar5 = (GHIDRA_CAST((room)))->Room::GetBrokenWatchState(); - if (uVar5 != 1) goto LAB_0065a621; - } - } - goto LAB_0065a5c5; - } - } - else { -LAB_0065a5c5: - otherProjectile = projectile; - vfunc = *(code **)(*GHIDRA_CAST(this) + 0x3c); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x28,0x28,0x28); - FUN_004072e0(); - (*vfunc)(); - this = otherProjectile; - } -LAB_0065a621: - if (((this->_projectileFlags & 0x200000000) != 0) && - ((((this->_changeTimeout < 1 || - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks((float)this->_changeTimeout,0.0), - sizeIndex != 0)) && (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), 0 < sizeIndex)) && - ((GHIDRA_CAST((&this->_velocity)))->Vector::Resize(this->_changeVelocity), - (this->_changeFlags & 0x300000000) != 0x300000000)))) { - savedProjFlags = this->_projectileFlags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - *puVar1 = *puVar1 & 0xfffffffd; - *GHIDRA_CAST(&this->_projectileFlags) = GHIDRA_INT(savedProjFlags); - } - if ((this->_projectileFlags & 0x80000000000) != 0) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - VStack_3a0.x = (this->_pos).x; - VStack_3a0.y = (this->_pos).y; - sizeIndex = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(this->_pos); - if ((sizeIndex == 2) || (sizeIndex == 3)) { - fVar19 = -50.0; - } - else { - if (sizeIndex != 0) goto LAB_0065a73e; - fVar19 = -5.0; - } - if ((fVar19 < this->_height) && (2.0 < this->_fallingSpeed)) { - this->_height = fVar19; - this->_fallingSpeed = this->_fallingSpeed * -2.0; - } - } -LAB_0065a73e: - if ((this->_projectileFlags & 0x40000000000) != 0) { - pVStack_3d0 = &this->_pos; - VStack_3dc.x = g_vectorZero.x; - VStack_3dc.y = g_vectorZero.y; - uVar5 = 0; - fStack_410 = (float)(GHIDRA_UINT((this->_height < -50.0)) * 2 + 2); - pEStack_378 = GHIDRA_CAST(&this->_collisionPoints); - sizeIndex = FUN_0042f160(); - if (sizeIndex != 0) { - do { - vecResult = GHIDRA_CAST(std)::vector::operator__(); - (GHIDRA_CAST((pVStack_3d0)))->Vector::__add(&scratchVec,vecResult); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pos_00.y = scratchVec.y; - pos_00.x = scratchVec.x; - (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_00); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pos_01.y = scratchVec.y; - pos_01.x = scratchVec.x; - sizeIndex = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_01); - if (GHIDRA_INT(fStack_410) <= sizeIndex) { - vecResult = GHIDRA_CAST(std)::vector::operator__(); - (GHIDRA_CAST((&VStack_3dc)))->Vector::operator_add_assign(vecResult); - } - uVar5 = uVar5 + 1; - uVar9 = FUN_0042f160(); - } while (uVar5 < uVar9); - this = projectile; - } - bVar3 = (GHIDRA_CAST((&VStack_3dc)))->Vector::operator_ne(&g_vectorZero); - if (bVar3 != 0) { - (GHIDRA_CAST((&VStack_3dc)))->Vector::Normalize(); - vecResult = &this->_velocity; - pEStack_378 = (Entity_Player *) - (-VStack_3dc.x * vecResult->x - VStack_3dc.y * (this->_velocity).y); - if ((float)pEStack_378 < 0.0) { - vecResult2 = (GHIDRA_CAST((&VStack_3dc)))->Vector::__mul(&VStack_440,GHIDRA_CAST(&pEStack_378)); - pVStack_3d0 = GHIDRA_CAST(0x40000000); - vecResult2 = (GHIDRA_CAST((vecResult2)))->Vector::__mul(&VStack_4bc,GHIDRA_CAST(&pVStack_3d0)); - (GHIDRA_CAST((vecResult)))->Vector::operator_add_assign(vecResult2); - (GHIDRA_CAST((&this->_pos)))->Vector::operator_add_assign(vecResult); - } - } - } - if ((((this->_projectileFlags & 0x100000000) != 0) && - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), 0 < sizeIndex)) && - ((this->_changeTimeout < 1 || - (sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks((float)this->_changeTimeout,0.0), sizeIndex != 0) - ))) { - savedProjFlags = this->_projectileFlags; - projFlagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - projFlagsHigh = *GHIDRA_CAST((GHIDRA_INT(&this->_changeFlags) + 4)); - *GHIDRA_CAST(&this->_projectileFlags) = GHIDRA_INT(this->_changeFlags); - *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)) = projFlagsHigh; - *GHIDRA_CAST(&this->_changeFlags) = GHIDRA_INT(savedProjFlags); - *GHIDRA_CAST((GHIDRA_INT(&this->_changeFlags) + 4)) = projFlagsHigh; - } - update_height_collision(this); - sizeIndex = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetHitPointsLost(); - if ((0 < sizeIndex) && (sizeIndex = Isaac::Random(3), sizeIndex == 0)) { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - bVar3 = PlayerManager::AnyoneHasCollectible(playerManager,0x14f); - if (bVar3 != 0) { - uVar5 = 0; - pEStack_360 = GHIDRA_CAST(0x4e6e6b28); - pEStack_34c = GHIDRA_CAST(0x0); - sizeIndex = Game::GetNumPlayers(g_game); - if (sizeIndex != 0) { - do { - pEStack_368 = Game::GetPlayer(g_game,uVar5); - bVar3 = (GHIDRA_CAST((pEStack_368)))->Entity_Player::HasCollectible(0x14f,0); - if (bVar3 != 0) { - vecResult = (GHIDRA_CAST((GHIDRA_CAST(pEStack_368))))->Entity::Position(&VStack_440); - pEStack_378 = GHIDRA_CAST((GHIDRA_CAST((vecResult)))->Vector)::DistanceSquared(&this->_pos); - if ((float)pEStack_378 < (float)pEStack_360) { - pEStack_34c = pEStack_368; - pEStack_360 = pEStack_378; - } - } - uVar5 = uVar5 + 1; - uVar9 = Game::GetNumPlayers(g_game); - player = pEStack_34c; - } while (uVar5 < uVar9); - if ((pEStack_34c != GHIDRA_CAST(0x0)) && ((float)pEStack_360 < 6400.0)) { - pEStack_378 = GHIDRA_CAST(sqrtf((float)pEStack_360)); - vecResult = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::Position(&VStack_440); - vecResult = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&VStack_4bc,vecResult); - fVar19 = random_float(); - vecResult = (GHIDRA_CAST((vecResult)))->Vector::Resized(&VStack_500, - fVar19 * (80.0 - (float)pEStack_378) * 0.1 + 0.05); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(vecResult); - } - } - } - } - if ((-5.0 < this->_height) || ((this->_collidesWithGrid != 0 && (-50.0 <= this->_height)))) { - this->_dead = 1; - } - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - bVar3 = PlayerManager::AnyoneHasCollectible(playerManager,0x202); - if (bVar3 != 0) { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - fVar19 = PlayerManager::get_total_luck(playerManager); - VStack_47c.y = 7.00649e-44; - modemChance = 0x43 - GHIDRA_INT(fVar19); - piVar13 = GHIDRA_CAST(std)::max(); - sizeIndex = Isaac::Random(*piVar13); - if ((sizeIndex == 0) && (this->_dead == 0)) { - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x460)))))))->Vector::operator_assign(&this->_pos); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddEntityFlags(0x20); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - } - } - if ((this->_projectileFlags & 0x200000000000000) != 0) { - this->_entityCollisionClass = 0; - anm2 = &this->_sprite; - spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(anm2))))->Sprite)::Color(); - pCVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(anm2))))->Sprite)::Color(); - fVar19 = (GHIDRA_CAST((pCVar14)))->Color::A(); - VStack_3cc.y = fVar19 - *GHIDRA_CAST(VStack_3cc.y) * 0.1; - Font::SetLineHeightModifier(spriteColor,VStack_3cc.y); - pCVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(anm2))))->Sprite)::Color(); - VStack_3cc.y = (GHIDRA_CAST((pCVar14)))->Color::A(); - this = projectile; - if (VStack_3cc.y <= 0.0) { - projectile->Remove(); - } - } - if ((this->_projectileFlags & 0x10000000000) != 0) { - fVar19 = Math::lerp(this->_height,-50.0,0.2,0); - this->_height = fVar19; - this->_fallingSpeed = 0.0; - fVar19 = sinf_wrapper(this->_updateTime * 0.2); - sizeIndex = this->_parent; - (this->_posOffset).y = fVar19 * 2.0 + this->_height; - if (sizeIndex == 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Die(); - } - } -LAB_0065acd8: - FUN_00862590(); - ExceptionList = pvStack_1c; - return; -} - -// 0065b500 -void Entity_Projectile::update_height_collision() -{ - float fVar1; - int gridCollisionClass; - float offsetY; - Game *game; - int *roomConfigRoom; - - game = g_game; - fVar1 = this->_height; - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - (this->_posOffset).y = -15.0; - if (-5.1 < fVar1) { - this->_height = -5.1; - } - this->_entityCollisionClass = 4; - if (((this->_projectileFlags & 0x40003810) == 0 && (this->_projectileFlags & 0x40000000000) == 0 - ) || ((this->_projectileFlags & 2) != 0)) { - gridCollisionClass = 4; - } - else { - gridCollisionClass = 0; - } - this->_entityGridCollisionClass = gridCollisionClass; - roomConfigRoom = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 4)) + 0x10)); - if (((roomConfigRoom != GHIDRA_CAST(0x0)) && (roomConfigRoom[2] == 0x10)) && (*roomConfigRoom == 0x23) - ) { - this->_entityGridCollisionClass = 0; - } - } - else { - if (0.0 < this->_fallingAccel || this->_fallingAccel == 0.0) { - offsetY = fVar1; - } - else { - offsetY = fVar1 + 8.5; - if (offsetY <= 0.0) { - offsetY = 0.0; - } - offsetY = (fVar1 * 0.5 - 15.0) + offsetY * offsetY; - } - (this->_posOffset).y = offsetY; - if (-50.0 <= fVar1) { - this->_entityCollisionClass = 4; - if ((this->_projectileFlags & 0x40003810) == 0 && - (this->_projectileFlags & 0x40000000000) == 0) { - this->_entityGridCollisionClass = 4; - } - else { - this->_entityGridCollisionClass = 0; - } - } - else if ((this->_projectileFlags & 0x20000) == 0) { - this->_entityCollisionClass = 0; - } - } - if ((this->_flags & 0x20) != 0) { - this->_entityCollisionClass = 0; - } - return; -} - -// 0065c510 -void Entity_Projectile::Interpolate() -{ - uint32_t flagsLo; - float fVar1; - float fVar2; - float fVar3; - float fVar4; - float fVar5; - float perpY; - float perpX; - float distAlongSpawner; - uint32_t projectileFlagsHi; - int spawner; - - flagsLo = GHIDRA_UINT(this->_flags); - if ((flagsLo & 2) != 0) { - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = flagsLo & 0xfffffffd; - return; - } - (this->_preInterpolatePos).x = (this->_pos).x; - (this->_preInterpolatePos).y = (this->_pos).y; - fVar1 = this->_friction; - fVar2 = this->_speedMultiplier; - (this->_pos).x = fVar1 * (this->_velocity).x * fVar2 * 0.5 + (this->_pos).x; - (this->_pos).y = fVar1 * (this->_velocity).y * fVar2 * 0.5 + (this->_pos).y; - if (*(code **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x470))) != (code *)0x0) { - (**(code **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x470))))(this,1); - } - flagsLo = GHIDRA_UINT(this->_projectileFlags); - projectileFlagsHi = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - if ((flagsLo & 0x200000) != 0) { - fVar1 = this->_updateTime * 3.1415927; - fVar2 = sin((fVar1 + fVar1) / 30.0); - fVar1 = (this->_velocity).y; - (this->_pos).x = fVar2 * (this->_velocity).x * 0.5 + (this->_pos).x; - (this->_pos).y = fVar1 * fVar2 * 0.5 + (this->_pos).y; - flagsLo = GHIDRA_UINT(this->_projectileFlags); - projectileFlagsHi = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - if ((flagsLo & 0x20) != 0) { - perpX = (this->_velocity).y; - perpY = -(this->_velocity).x; - fVar1 = sqrtf(perpY * perpY + perpX * perpX); - if (0.0 < fVar1) { - perpX = (1.0 / fVar1) * perpX; - perpY = perpY * (1.0 / fVar1); - } - fVar1 = 1.0; - if (this->_spawnerType == 0x390) { - fVar1 = 2.0; - } - fVar1 = ((float)this->_wiggleFrameOffset + this->_updateTime) * fVar1 * 3.1415927; - fVar1 = cos((fVar1 + fVar1) / 30.0); - (this->_pos).x = perpX * fVar1 * 3.0 * 0.5 + (this->_pos).x; - (this->_pos).y = perpY * fVar1 * 3.0 * 0.5 + (this->_pos).y; - flagsLo = GHIDRA_UINT(this->_projectileFlags); - projectileFlagsHi = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - if ((flagsLo & 0x400000) != 0) { - perpX = (this->_velocity).y; - perpY = -(this->_velocity).x; - fVar1 = sqrtf(perpY * perpY + perpX * perpX); - if (0.0 < fVar1) { - perpX = perpX * (1.0 / fVar1); - perpY = perpY * (1.0 / fVar1); - } - fVar2 = (float)this->_wiggleFrameOffset + this->_updateTime; - fVar1 = fVar2 * 3.1415927; - fVar3 = cos((fVar1 + fVar1) / 30.0); - fVar2 = fVar2 * 0.04; - fVar1 = 4.0; - if (fVar2 <= 4.0) { - fVar1 = fVar2; - } - fVar3 = fVar3 * (fVar1 + 3.0); - (this->_pos).x = perpX * fVar3 * 0.5 + (this->_pos).x; - (this->_pos).y = perpY * fVar3 * 0.5 + (this->_pos).y; - projectileFlagsHi = *GHIDRA_CAST((GHIDRA_INT(&this->_projectileFlags) + 4)); - } - if (((projectileFlagsHi & 0x200) != 0) && (spawner = this->_spawnerEntity, spawner != 0)) { - fVar1 = *GHIDRA_CAST((spawner + 0x334)); - if ((fVar1 != g_vectorZero.x) || (*GHIDRA_CAST((spawner + 0x338)) != g_vectorZero.y)) { - fVar2 = *GHIDRA_CAST((spawner + 0x338)); - fVar3 = sqrtf(fVar2 * fVar2 + fVar1 * fVar1); - fVar1 = fVar1 / fVar3; - fVar5 = (this->_pos).x - *GHIDRA_CAST((spawner + 0x33c)); - fVar2 = fVar2 / fVar3; - fVar4 = (this->_pos).y - *GHIDRA_CAST((spawner + 0x340)); - distAlongSpawner = sqrtf(fVar4 * fVar4 + fVar5 * fVar5); - if (fVar4 * fVar2 + fVar5 * fVar1 < 0.0) { - distAlongSpawner = distAlongSpawner * -1.0; - } - fVar4 = (this->_velocity).y; - fVar5 = (this->_velocity).x; - fVar4 = sqrtf(fVar5 * fVar5 + fVar4 * fVar4); - if ((0.0 <= distAlongSpawner) && (distAlongSpawner <= fVar3)) { - fVar3 = *GHIDRA_CAST((spawner + 0x33c)); - (this->_pos).y = fVar2 * distAlongSpawner + *GHIDRA_CAST((spawner + 0x340)); - (this->_pos).x = fVar1 * distAlongSpawner + fVar3; - (this->_velocity).x = fVar4 * fVar1; - (this->_velocity).y = fVar4 * fVar2; - } - } - } - this->_isInterpolating = 1; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::CollideWithGrid(1); - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - (this->_posOffset).y = -15.0; - return; - } - if ((this->_projectileFlags & 0x400000000) == 0) { - fVar1 = this->_fallingSpeed * this->_speedMultiplier * 0.5; - } - else { - fVar1 = (-23.0 - this->_height) * 0.2; - } - fVar1 = fVar1 + this->_height; - if (this->_fallingAccel <= 0.0 && this->_fallingAccel != 0.0) { - fVar2 = fVar1 + 8.5; - if (fVar2 <= 0.0) { - fVar2 = 0.0; - } - fVar1 = (fVar1 * 0.5 - 15.0) + fVar2 * fVar2; - } - if ((this->_projectileFlags & 0x10000000000) != 0) { - fVar1 = sin((this->_speedMultiplier * 0.5 + this->_updateTime) * 0.2); - fVar1 = fVar1 + fVar1 + this->_height; - } - (this->_posOffset).y = fVar1; - return; -} - -// 0065cb60 -void Entity_Projectile::Render(Vector *offset) -{ - code *pcVar1; - uint8_t rngShift; - uint32_t rngState; - uint32_t uVar2; - double dVar3; - Vector local_20; - Vector local_18; - float pixelCoord; - float pixelScale; - uint32_t rngShift3; - float offsetX; - - if (this->_isRenderedAtGround != 0) { - (this->_posOffset).y = (this->_posOffset).y - this->_height; - } - rngShift3 = 0xc; - local_20.y = (float)((g_game->_frameCount / 0x1e) * 100 + 1); - if (((this->_flags & 0x20) == 0) || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x460)))) == g_vectorZero.x && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x464)))) == g_vectorZero.y)))) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); - } - else { - pixelScale = g_displayPixelRatio * g_screenPointScale; - pixelCoord = (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x460)))) + (this->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5; - dVar3 = floor((double)pixelCoord); - local_18.y = (float)dVar3 / pixelScale; - pixelCoord = (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x464)))) + (this->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * pixelScale + 0.5; - dVar3 = floor((double)pixelCoord); - pixelCoord = (float)dVar3; - rngState = GHIDRA_UINT(local_20.y) >> 5 ^ GHIDRA_UINT(local_20.y); - rngState = rngState << 0x15 ^ rngState; - local_20.y = (float)(rngState >> 0xc ^ rngState); - offsetX = offset->x; - (this->_renderPosition).y = pixelCoord / pixelScale + offset->y; - (this->_renderPosition).x = local_18.y + offsetX; - if (local_20.y == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - rngState = GHIDRA_UINT(local_20.y) >> 5 ^ GHIDRA_UINT(local_20.y); - local_18.y = (float)((double)GHIDRA_INT(local_20.y) + - __uint_to_double_fixup[-(GHIDRA_INT(local_20.y) >> 0x1f)]) * 2.3283062e-10 * 16.0; - rngState = rngState << 0x15 ^ rngState; - rngShift = (uint8_t)rngShift3; - rngState = rngState >> (rngShift & 0x1f) ^ rngState; - local_18.x = (float)((double)GHIDRA_INT(rngState) + __uint_to_double_fixup[-(GHIDRA_INT(rngState) >> 0x1f)]) * - 2.3283062e-10 * 16.0; - if (rngState == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - rngState = rngState >> 5 ^ rngState; - rngState = rngState << 0x15 ^ rngState; - rngState = rngState >> (rngShift & 0x1f) ^ rngState; - if (rngState == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar2 = rngState >> 5 ^ rngState; - local_20.y = (float)((double)GHIDRA_INT(rngState) + __uint_to_double_fixup[-(GHIDRA_INT(rngState) >> 0x1f)]) * - 2.3283062e-10 * 16.0; - uVar2 = uVar2 << 0x15 ^ uVar2; - uVar2 = uVar2 >> (rngShift & 0x1f) ^ uVar2; - local_20.x = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * - 2.3283062e-10 * 16.0; - ANM2::Render(&this->_sprite,&this->_renderPosition,&local_18,&local_20); - } - if (this->_isRenderedAtGround != 0) { - (this->_posOffset).y = this->_height + (this->_posOffset).y; - } - FUN_00862670(this,offset); - return; -} - -// 00675fc0 -void Entity_Projectile::SetHeight(float height) -{ - float heightOffsetY; - Game *game; - - this->_height = height; - heightOffsetY = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Tear::get_height_offset_y(height); - game = g_game; - (this->_posOffset).y = heightOffsetY; - if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && ((this->_posOffset).y = -18.0, -5.1 < height)) { - this->_height = -5.1; - } - return; -} - -// 0067a080 -void Entity_Projectile::Deflect(Entity *newSpawner, Vector *velocity) -{ - int *local_c [2]; - uint32_t *entityRef; - - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Tear::SetTearFlags((BitSet128)ZEXT816(0)); - entityRef = &this->_parent; - *GHIDRA_CAST(&this[1]._isInvicible) = 0; - this[1]._shrinkStatus1 = 0.0; - this[1]._shrinkStatus2 = 0.0; - this[1]._parent = 0; - (this->_velocity).x = velocity->x; - (this->_velocity).y = velocity->y; - if (*entityRef != 0) { - local_c[0] = entityRef; - msvc::multiset::erase(local_c); - } - *entityRef = 0; - entityRef = &this->_spawnerEntity; - if (this->_spawnerEntity != 0) { - local_c[0] = entityRef; - msvc::multiset::erase(local_c); - } - *entityRef = newSpawner; - if (newSpawner != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(entityRef); - } - this->_dead = 0; - if ((0.0 < this->_fallingAccel) && (0.0 < this->_fallingSpeed)) { - this->_fallingSpeed = -this->_fallingSpeed * 0.85; - } - return; -} - -// 006b82f0 -void Entity_Projectile::AddChangeFlags(uint64_t flags) -{ - uint32_t *changeFlagsHigh; - - *GHIDRA_CAST(&this->_changeFlags) = GHIDRA_UINT(this->_changeFlags) | GHIDRA_UINT(flags); - changeFlagsHigh = GHIDRA_CAST((GHIDRA_INT(&this->_changeFlags) + 4)); - *changeFlagsHigh = *changeFlagsHigh | (*GHIDRA_CAST((GHIDRA_CAST(&(flags)) + 0x4))); - return; -} - -// 0085e300 -long double Entity_Projectile::Acceleration() -{ - return (long double)this->_acceleration; -} - -// 0085e310 -uint64_t Entity_Projectile::ChangeFlags() -{ - return this->_changeFlags; -} - -// 0085e320 -void Entity_Projectile::AddScale(float param_2) -{ - this->_scale = param_2 + this->_scale; - return; -} - -// 0085e360 -long double Entity_Projectile::Damage() -{ - return (long double)this->_damage; -} diff --git a/generated-src/entity_ptr.cpp b/generated-src/entity_ptr.cpp deleted file mode 100644 index 7ea0df6..0000000 --- a/generated-src/entity_ptr.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "classes.h" - -// 0040c3a0 -uint32_t EntityPtr::Ref() -{ - uint32_t *in_ECX; - - return *in_ECX; -} - -// 004cf1d0 -void EntityPtr::Set(Entity *entity) -{ - Entity *newEntity; - - newEntity = entity; - if (*GHIDRA_CAST(this) != entity) { - if (*GHIDRA_CAST(this) != GHIDRA_CAST(0x0)) { - entity = GHIDRA_CAST(this); - msvc::multiset::erase(&entity); - } - *GHIDRA_CAST(this) = newEntity; - if (newEntity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(this); - } - } - return; -} - -// 006b5b50 -void EntityPtr::SetReference(EntityPtr *ptr, Entity *entity) -{ - EntityPtr *local_8; - - local_8 = ptr; - if (*GHIDRA_CAST(ptr) != 0) { - msvc::multiset::erase(&local_8); - } - *GHIDRA_CAST(ptr) = entity; - if (entity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(ptr); - } - return; -} - -// 00872050 -void EntityPtr::SetReference(Entity *entity) -{ - EntityPtr *selfKey; - - if (*GHIDRA_CAST(this) != 0) { - selfKey = this; - msvc::multiset::erase(&selfKey); - } - *GHIDRA_CAST(this) = entity; - if (entity != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(this); - } - return; -} - -// 00a0fe80 -EntityPtr * EntityPtr::clear() -{ - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x1)))) = 0; - *GHIDRA_CAST(this) = 0; - return this; -} diff --git a/generated-src/entity_ref.cpp b/generated-src/entity_ref.cpp deleted file mode 100644 index 1d146aa..0000000 --- a/generated-src/entity_ref.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "classes.h" - -// 00431310 -void EntityRef::constructor(Entity *entity) -{ - float copyX; - uint32_t weaknessBit; - float copyY; - uint32_t friendlyBit; - uint32_t charmedBit; - - if (entity == GHIDRA_CAST(0x0)) { - this->_type = 0; - this->_variant = 0; - this->_spawnerType = 0; - this->_spawnerVariant = 0; - copyX = g_vectorZero.x; - copyY = g_vectorZero.y; - } - else { - this->_type = entity->_type; - this->_variant = entity->_variant; - this->_spawnerType = entity->_spawnerType; - this->_spawnerVariant = entity->_spawnerVariant; - copyX = (entity->_pos).x; - copyY = (entity->_pos).y; - } - (this->_position).x = copyX; - (this->_position).y = copyY; - if (entity == GHIDRA_CAST(0x0)) { - copyX = g_vectorZero.x; - copyY = g_vectorZero.y; - } - else { - copyX = (entity->_velocity).x; - copyY = (entity->_velocity).y; - } - (this->_velocity).x = copyX; - (this->_velocity).y = copyY; - if ((entity == GHIDRA_CAST(0x0)) || ((entity->_flags & 0x100) == 0)) { - charmedBit = 0; - if (entity != GHIDRA_CAST(0x0)) goto LAB_004313dc; - charmedBit = 0; -LAB_004313f5: - friendlyBit = 0; - if (entity != GHIDRA_CAST(0x0)) goto LAB_004313fb; - } - else { - charmedBit = 1; -LAB_004313dc: - if ((entity->_flags & 0x20000000) == 0) goto LAB_004313f5; - friendlyBit = 2; -LAB_004313fb: - if ((entity->_flags & 0x40000000000000) != 0) { - weaknessBit = 4; - goto LAB_00431416; - } - } - weaknessBit = 0; -LAB_00431416: - this->_entity = entity; - this->_flags = weaknessBit | friendlyBit | charmedBit; - return; -} - -// 00435c70 -EntityRef::EntityRef() -{ - this->_type = 0; - this->_variant = 0; - this->_spawnerType = 0; - this->_spawnerVariant = 0; - (this->_position).x = g_vectorZero.x; - (this->_position).y = g_vectorZero.y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - this->_flags = 0; - this->_entity = (void *)0x0; - return this; -} - -// 00499960 -EntityRef * EntityRef::operator_(EntityRef *other) -{ - this->_type = other->_type; - this->_variant = other->_variant; - this->_spawnerType = other->_spawnerType; - this->_spawnerVariant = other->_spawnerVariant; - (this->_position).x = (other->_position).x; - (this->_position).y = (other->_position).y; - (this->_velocity).x = (other->_velocity).x; - (this->_velocity).y = (other->_velocity).y; - this->_flags = other->_flags; - this->_entity = other->_entity; - return this; -} - -// 004a2910 -uint32_t EntityRef::IsFriendly() -{ - return CONCAT31((uint3)(GHIDRA_UINT(this->_flags) >> 9),(char)(GHIDRA_UINT(this->_flags) >> 1)) & 0xffffff01; -} - -// 004bc670 -uint8_t EntityRef::IsCharmed() -{ - return (uint8_t)this->_flags & 1; -} diff --git a/generated-src/entity_slot.cpp b/generated-src/entity_slot.cpp deleted file mode 100644 index ce41894..0000000 --- a/generated-src/entity_slot.cpp +++ /dev/null @@ -1,2610 +0,0 @@ -#include "classes.h" - -// 0065d950 -void Entity_Slot::Update() -{ - Vector targetPos; - uint8_t *puVar1; - uint8_t bVar2; - char cVar3; - uint8_t isPrizeAnim; - uint16_t newSlotTimer; - int iVar4; - uint8_t *pbVar5; - uint32_t isPrizeAnim; - uint32_t newSlotTimer; - Entity *pEVar8; - Vector *tmpVec; - ItemPool *itemPool; - ItemPool *persistentData; - Entity_Pickup *pickup; - Level *level; - HUD *hud; - StringTable *stringTable; - uint32_t *minMaxResult; - EntityList *hud; - int *piVar9; - RNG *localRng; - ANM2 *pAVar10; - RNG *this_02; - Room *room; - ColorMod *color; - float *clampResult; - uint32_t *minResult; - PlayerManager *playerManager; - void *pvVar11; - uint32_t uVar12; - uint16_t *maxResult; - Entity_Effect *effect; - Vector *pVVar13; - AnimationState *slotAnimState; - short slotTimer; - char *animName; - ANM2 *pAVar14; - Entity_Slot *pEVar15; - Entity_Player *player; - Sprite *sprite; - RNG *pRVar16; - bool bVar17; - float fVar18; - float fVar19; - TypeDescriptor *pTVar20; - TypeDescriptor *pTVar21; - uint8_t unk2; - uint32_t uVar22; - Vector addOut; - Vector posOut; - Vector scratchVec; - uint64_t local_f8; - Vector local_f0; - Vector local_e8; - Vector local_e0; - Vector local_d8; - Vector local_d0; - Vector local_c8; - Vector local_c0; - Vector local_b8; - Vector local_b0; - Vector local_a8; - Vector local_a0; - Entity_Slot *savedSlot; - Color tmpColor; - char prizeAnimName [8]; - float choiceTable [2]; - Vector VStack_54; - uint8_t local_4c [20]; - uint32_t local_38; - RNG prizeRng; - uint32_t stackCookie; - uint8_t *puStack_20; - void *savedExceptionList; - uint8_t *puStack_18; - uint32_t ehState; - Game *game; - Manager *manager; - PersistentGameData *persistentData; - code *setColorFn; - - puStack_20 = local_4c + 0x48; - ehState = 0xffffffff; - puStack_18 = &LAB_00af768c; - savedExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((local_4c + 0x3c)); - ExceptionList = &savedExceptionList; - local_b0.y = 0.0; - local_e8.y = 0.0; - iVar4 = this->_variant; - savedSlot = this; - puVar1 = local_4c + 0x48; - if (iVar4 == 0x10) { - puVar1 = local_4c + 0x48; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x410)))) != 3) && - (puVar1 = local_4c + 0x48, *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x540)))) == 0)) { - iVar4 = ItemPool::GetCollectible(&g_game->_itemPool,0x17,(this->_dropRNG)._seed,0,0x206,0); - SetPrizeType(this,iVar4); - iVar4 = this->_variant; - puVar1 = puStack_20; - goto LAB_0065d9f6; - } - } - else { -LAB_0065d9f6: - puStack_20 = puVar1; - puVar1 = puStack_20; - if (((iVar4 == 0xc) && (1 < g_game->_frameCount - this->_spawnFrame)) && - (this->_visible = 1, (this->_sprite)._animState._animData != (void *)0x0)) { - bVar2 = AnimationState::IsEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST("Ground")); - manager = g_manager; - puVar1 = puStack_20; - if (bVar2 != 0) { - local_d0.y = 2.94273e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_d0.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_d0.y),1.0,2,0,1.0,0.0); - this = savedSlot; - puVar1 = puStack_20; - } - } - } - puStack_20 = puVar1; - isPrizeAnim = GHIDRA_UINT(this->_flags); - uVar12 = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - if ((isPrizeAnim & 4) != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x410)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x41c)))) = 0; - iVar4 = this->_variant; - *GHIDRA_CAST(&this->_flags) = isPrizeAnim & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = uVar12; - if (iVar4 == 0xb) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Appear"),0); - this->_visible = 1; - } - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x410)))) == 0) { - animName = (this->_sprite)._animState._animData; - if (animName == GHIDRA_CAST(0x0)) { - pbVar5 = &s_empty; - } - else { - pbVar5 = (GHIDRA_CAST((animName)))->msvc::string::c_str(); - } - animName = "Appear"; - do { - bVar2 = *pbVar5; - bVar17 = bVar2 < (uint8_t)*animName; - if (bVar2 != *animName) { -LAB_0065db20: - isPrizeAnim = -GHIDRA_UINT(bVar17) | 1; - goto LAB_0065db25; - } - if (bVar2 == 0) break; - bVar2 = pbVar5[1]; - bVar17 = bVar2 < (uint8_t)animName[1]; - if (bVar2 != animName[1]) goto LAB_0065db20; - pbVar5 = pbVar5 + 2; - animName = animName + 2; - } while (bVar2 != 0); - isPrizeAnim = 0; -LAB_0065db25: - if (isPrizeAnim != 0) { - slotTimer = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x41c)))); - if (slotTimer == 0) { - iVar4 = this->_variant; - isPrizeAnim = 3; - if ((((iVar4 == 4) || (iVar4 == 5)) || ((iVar4 == 7 || ((iVar4 == 9 || (iVar4 == 0xd)))))) - || (iVar4 == 0x12)) { - isPrizeAnim = 2; - } - newSlotTimer = Random(); - Game::Spawn(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),isPrizeAnim,newSlotTimer); - slotTimer = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x41c)))); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x41c)))) = slotTimer + 1; - if ((short)(slotTimer + 1) < 3) { - ExceptionList = savedExceptionList; - return; - } - this->_visible = 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x410)))) = 1; - ExceptionList = savedExceptionList; - return; - } - if ((this->_sprite)._loaded != 0) { - AnimationState::Update(&(this->_sprite)._animState); - AnimationState::Update(&(this->_sprite)._overlayAnimState); - } - bVar2 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty); - if (bVar2 == 0) { - ExceptionList = savedExceptionList; - return; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x410)))) = 1; - iVar4 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x548)))) + 0x488)); - ANM2::SetFrame(&this->_sprite,GHIDRA_CAST("Prize"),0); - if ((this->_sprite)._animState._animData == (void *)0x0) { - ExceptionList = savedExceptionList; - return; - } - AnimationState::SetLayerFrame(&(this->_sprite)._animState,1,(iVar4 / 100) % 10); - if ((this->_sprite)._animState._animData == (void *)0x0) { - ExceptionList = savedExceptionList; - return; - } - AnimationState::SetLayerFrame(&(this->_sprite)._animState,2,(iVar4 / 10) % 10); - if ((this->_sprite)._animState._animData == (void *)0x0) { - ExceptionList = savedExceptionList; - return; - } - AnimationState::SetLayerFrame(&(this->_sprite)._animState,3,iVar4 % 10); - ExceptionList = savedExceptionList; - return; - } - local_c8.y = 0.65; - if ((this->_variant == 0x12) && (g_game->_frameCount - this->_spawnFrame == 1)) { - isPrizeAnim = Random(); - pEVar8 = Game::Spawn(g_game,1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - isPrizeAnim = Random(); - setColorFn = *(code **)(*GHIDRA_CAST(pEVar8) + 0x3c); - fVar19 = (float)((double)GHIDRA_INT(isPrizeAnim) + __uint_to_double_fixup[-(GHIDRA_INT(isPrizeAnim) >> 0x1f)]) * - 2.3283064e-10 * 0.4 + 0.2; - fVar18 = fVar19 * g_vectorOne.x; - (pEVar8->_sprite)._scale.y = fVar19 * g_vectorOne.y; - (pEVar8->_sprite)._scale.x = fVar18; - (GHIDRA_CAST((&tmpColor)))->Color::Reset(); - (GHIDRA_CAST((&tmpColor)))->Color::SetTint(0.7,0.9,0.65,1.0); - (*setColorFn)(&tmpColor,0xffffffff,0xff,0,1); - pEVar8->Update(); - (GHIDRA_CAST((&tmpColor)))->Color::Reset(); - isPrizeAnim = Random(); - this = savedSlot; - Game::SpawnParticles - (g_game,&savedSlot->_pos,0x3f,isPrizeAnim % 3 + 1,2.0,GHIDRA_CAST(&tmpColor),100000.0,0); - } - local_e0.y = (float)this->_target; - if (GHIDRA_CAST(local_e0.y) == GHIDRA_CAST(0x0)) { - local_e0.y = (float)PlayerManager::GetPlayer(&g_game->_playerManager,0); - } - player = GHIDRA_CAST(local_e0.y); - local_d0.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::GetTrinketRNG(0x16); - local_e8.y = (float)(GHIDRA_CAST((player)))->Entity_Player::GetCollectibleRNG(0x2e); - if (((this->_targetPosition).x == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y) - ) { - (this->_targetPosition).x = (this->_pos).x; - (this->_targetPosition).y = (this->_pos).y; - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - } - pEVar15 = this; - if ((((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x410)))) == 3) && (iVar4 = this->_variant, iVar4 != 6)) && (iVar4 != 0xf) - ) && ((iVar4 != 8 && (iVar4 != 0xb)))) { - this->_friction = this->_friction * 0.8; -LAB_0065df30: - this->_entityGridCollisionClass = 5; - if (this->_variant == 10) { - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424)))) != 0) && - (iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424)))) + -1, *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424)))) = iVar4, iVar4 == 0)) - { - (GHIDRA_CAST((g_game->_room)))->Room::ShopRestockFull(); - } - goto LAB_0065df69; - } - } - else { - fVar18 = (this->_targetPosition).x; - fVar19 = (this->_pos).x; - (this->_velocity).y = (this->_targetPosition).y - (this->_pos).y; - (this->_velocity).x = fVar18 - fVar19; - this->_friction = this->_friction * 0.8; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x410)))) == 3) goto LAB_0065df30; -LAB_0065df69: - if ((this->_variant == 10) && - (bVar2 = ANM2::IsFinishedImpl(&this->_sprite,GHIDRA_CAST("WiggleEnd")), bVar2 != 0)) { - (GHIDRA_CAST((g_game->_room)))->Room::ShopRestockFull(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x420)))) = 0; - ANM2::Play(&this->_sprite,s_Idle,0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424)))) + 1; - if (4 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424))))) { - (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - pEVar15 = savedSlot; - if (((this->_dropRNG)._seed & 1U) == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x424)))) = 0; - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - spawn_break_drops(pEVar15); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Death"),0); - } - } - } - } - local_c0.y = (float)&DAT_00000005; - if (((pEVar15->_variant == 9) && (isPrizeAnim = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x424)))), isPrizeAnim != 0)) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x424)))) = isPrizeAnim - 1, isPrizeAnim % 5 == 0)) { - Room::get_random_pickup_position(g_game->_room,&local_a0,0,0); - local_c0.y = (float)g_game->_room; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->Room::GetGridIndex(&local_a0); - if ((isPrizeAnim < 0x1c0) && ((GHIDRA_CAST((GHIDRA_INT(local_c0.y) + 0x76c)))[isPrizeAnim] < 0x3b7)) { - (GHIDRA_CAST((GHIDRA_INT(local_c0.y) + 0x76c)))[isPrizeAnim] = 900; - } - isPrizeAnim = Random(); - Game::Spawn(g_game,4,3,&local_a0,&g_vectorZero,GHIDRA_CAST(pEVar15),0,isPrizeAnim); - } - slotTimer = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))); - if (0 < slotTimer) { - slotTimer = slotTimer + -1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))) = slotTimer; - if (((slotTimer == 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) == 2)) && (pEVar15->_variant == 1)) { - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("WiggleEnd"),0); - slotTimer = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))); - } - } - local_c0.y = 1.4013e-44; - local_a8.y = (float)&DAT_0000000f; - if (slotTimer == 0) { - bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,GHIDRA_CAST("WiggleEnd")); - if ((bVar2 != 0) && (pEVar15->_variant == 1)) { - ANM2::SetFrame(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(); - if (GHIDRA_UINT((pEVar15->_dropRNG)._seed) % 0x32 == 0) { - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - spawn_break_drops(pEVar15); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Death"),0); - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = 0; - bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x2e,0); - if ((bVar2 == 0) && - ((bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x4c,0), bVar2 == 0 || - ((GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(), ((pEVar15->_dropRNG)._seed & 3U) != 0)))) { - (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(); - local_a8.y = 2.94273e-44; - isPrizeAnim = GHIDRA_UINT((pEVar15->_dropRNG)._seed) % 0x15; - } - else { - (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(); - isPrizeAnim = GHIDRA_UINT((pEVar15->_dropRNG)._seed) % GHIDRA_UINT(local_a8.y); - } - isPrizeAnim = isPrizeAnim + 3; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = isPrizeAnim; - if (isPrizeAnim == 9) { - (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(); - if (GHIDRA_UINT((pEVar15->_dropRNG)._seed) % GHIDRA_UINT(local_c0.y) < 3) { - isPrizeAnim = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))); - goto LAB_0065e2a5; - } -LAB_0065e2c8: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = 0xb; - } - else { -LAB_0065e2a5: - bVar17 = false; - if (isPrizeAnim == 10) { - (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(); - if (4 < GHIDRA_UINT((pEVar15->_dropRNG)._seed) % GHIDRA_UINT(local_c0.y)) goto LAB_0065e2c8; - isPrizeAnim = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))); - bVar17 = isPrizeAnim == 10; - } - if ((9 < isPrizeAnim && !bVar17) && - ((GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(), GHIDRA_UINT((pEVar15->_dropRNG)._seed) % GHIDRA_UINT(local_c0.y) != 0 - )) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) + 1; - } - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 7) && - ((GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(), GHIDRA_UINT((pEVar15->_dropRNG)._seed) % 3 == 0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = 0xb; - } - if ((((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 6) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 5)) && - (bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x16,0), bVar2 != 0)) && - ((GHIDRA_CAST((GHIDRA_CAST(local_d0.y))))->RNG::Next(), GHIDRA_UINT(*GHIDRA_CAST(local_d0.y)) % 5 != 0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = 0xb; - } - if ((g_game->_difficulty == 1) && - ((GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(), ((pEVar15->_dropRNG)._seed & 1U) == 0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = 0; - } - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 9) && - (cVar3 = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 0x30))(0x12), - cVar3 != '\0')) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = 0xb; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 10) && - (cVar3 = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))) + 0x30))(0xb1), - cVar3 != '\0')) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) = 3; - } - } - switch(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414))))) { - case 3: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,0), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,0), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,0); - } - break; - case 4: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,2), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,2), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,2); - } - break; - case 5: - case 6: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,6), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,6), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,6); - } - break; - case 7: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,4), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,4), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,4); - } - break; - case 8: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,5), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,5), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,5); - } - break; - case 9: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,1), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,1), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,1); - } - break; - case 10: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,7), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,7), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,7); - } - break; - case 0xb: - case 0xc: - case 0xd: - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,3), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,3), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,3); - } - break; - default: - pRVar16 = &pEVar15->_dropRNG; - do { - (GHIDRA_CAST((pRVar16)))->RNG::Next(); - local_a8.y = (float)(pRVar16->_seed & 7); - (GHIDRA_CAST((pRVar16)))->RNG::Next(); - local_c0.y = (float)(pRVar16->_seed & 7); - (GHIDRA_CAST((pRVar16)))->RNG::Next(); - player = GHIDRA_CAST(local_e0.y); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))) = GHIDRA_CAST((pRVar16->_seed & 7)); - if (local_a8.y != local_c0.y) break; - } while (GHIDRA_CAST(local_c0.y) == (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4)))); - if ((((pEVar15->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,1,GHIDRA_INT(local_a8.y)), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,2,GHIDRA_INT(local_c0.y)), - (pEVar15->_sprite)._animState._animData != (void *)0x0)) { - AnimationState::SetLayerFrame(&(pEVar15->_sprite)._animState,3,(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_f8))) + 0x4)))); - } - manager = g_manager; - local_c0.y = 3.48923e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_c0.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c0.y),1.0,2,0,1.0,0.0); - pEVar15 = savedSlot; - } - } - } - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))) == 0) { - if (pEVar15->_variant == 0x10) { - local_c0.y = (float)&pEVar15->_sprite; - bVar2 = ANM2::IsFinishedImpl(GHIDRA_CAST(local_c0.y),GHIDRA_CAST("Wiggle")); - if (bVar2 == 0) { - sprite = GHIDRA_CAST(&pEVar15->_sprite); - } - else { - (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(); - isPrizeAnim = GHIDRA_UINT((pEVar15->_dropRNG)._seed) % 100; - bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x4c,0); - sprite = GHIDRA_CAST(local_c0.y); - if (bVar2 != 0) { - isPrizeAnim = isPrizeAnim - 5; - } - if (GHIDRA_INT(isPrizeAnim) < 0x19) { - ANM2::Play(GHIDRA_CAST(local_c0.y),GHIDRA_CAST("Prize"),0); - iVar4 = 0x10c; - } - else { - ANM2::Play(GHIDRA_CAST(local_c0.y),GHIDRA_CAST("NoPrize"),0); - iVar4 = 0x10b; - } - SoundEffects::PlayWithFartOverride(iVar4,1.0,2,0,1.0); - pEVar15 = savedSlot; - } - bVar2 = (GHIDRA_CAST((sprite)))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - newSlotTimer = (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::Next(); - isPrizeAnim = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x540)))); - tmpVec = GHIDRA_CAST(FUN_006653c0(&local_c0)); - pEVar8 = Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),isPrizeAnim,newSlotTimer); - pEVar8->Update(); - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - isPrizeAnim = EntityPtr::Ref(); - iVar4 = ItemPool::GetCollectible(itemPool,0x17,isPrizeAnim,0,0x206,0); - pEVar15 = savedSlot; - SetPrizeType(savedSlot,iVar4); - sprite = GHIDRA_CAST(&pEVar15->_sprite); - } - bVar2 = (GHIDRA_CAST((sprite)))->Sprite::IsEventTriggered("Explosion"); - if (bVar2 != 0) { - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - spawn_break_drops(pEVar15); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - ANM2::Play(GHIDRA_CAST(sprite),GHIDRA_CAST("Death"),0); - } - bVar2 = ANM2::IsFinishedImpl(GHIDRA_CAST(sprite),GHIDRA_CAST("Prize")); - if (bVar2 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) + 1; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) < 3) { - ANM2::Play(GHIDRA_CAST(sprite),GHIDRA_CAST("Regenerate"),0); - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 4; - ANM2::Play(GHIDRA_CAST(sprite),GHIDRA_CAST("OutOfPrizes"),0); - } - } - } - else if (pEVar15->_variant == 0x11) { - bVar2 = ANM2::IsPlaying(&pEVar15->_sprite,GHIDRA_CAST("Wiggle")); - if (bVar2 != 0) { - local_c0.y = 0.3; - iVar4 = Game::Difficulty(g_game); - if (iVar4 == 1) { - local_c0.y = 0.25; - } - bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x2e,0); - if (bVar2 != 0) { - local_c0.y = local_c0.y * 1.5; - } - local_a8.y = (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::RandomFloat(); - if (local_c0.y <= local_a8.y) { - animName = "NoPrize"; - } - else { - animName = "Prize"; - } - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST(animName),0); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - local_c0.y = (float)&pEVar15->_dropRNG; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::RandomInt(0x14); - if (isPrizeAnim == 0) { - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - spawn_break_drops(pEVar15); - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Death"),0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - } - else { - isPrizeAnim = (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::RandomInt(0x1e); - if (isPrizeAnim == 0) { - pEVar15->Remove(); - isPrizeAnim = Random(); - local_a8.y = (float)&pEVar15->_pos; - Game::Spawn(g_game,1000,1,GHIDRA_CAST(local_a8.y),&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - iVar4 = Game::GetDevilRoomDeals(g_game); - if (iVar4 < 1) { -LAB_0065eb25: - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - isPrizeAnim = pEVar15->_initSeed; - persistentData = GHIDRA_CAST(Game)::GetItemPool(g_game); - iVar4 = ItemPool::GetPoolForRoom(persistentData,0xf,savedSlot->_initSeed); - isPrizeAnim = ItemPool::GetCollectible(itemPool,iVar4,isPrizeAnim,0,0x21,0); - if (isPrizeAnim == 0) goto LAB_0065ed10; - } - else { - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - bVar2 = ItemPool::RemoveCollectible(itemPool,0x2a1,1,0); - if (bVar2 == 0) goto LAB_0065eb25; - isPrizeAnim = 0x2a1; - } - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - pickup = (Entity_Pickup *) - Game::Spawn(g_game,5,100,GHIDRA_CAST(local_a8.y),&g_vectorZero,GHIDRA_CAST(0x0),isPrizeAnim - ,newSlotTimer); - (GHIDRA_CAST((pickup)))->Entity_Pickup::SetAlternatePedestal(0xf); - pickup->Update(); - } - else { - iVar4 = (GHIDRA_CAST((player)))->Entity_Player::GetBrokenHearts(); - if (0 < iVar4) { - (GHIDRA_CAST((player)))->Entity_Player::AddBrokenHearts(-1); - Entity_Player::UseActiveItem(player,GHIDRA_CAST((GHIDRA_INT(&local_f8) + 6)),0x23,1,-1,0); - SoundEffects::PlayWithFartOverride(0x10c,1.0,2,0,1.0); - goto LAB_0065ed16; - } - isPrizeAnim = (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::RandomInt(2); - if ((isPrizeAnim == 0) && - ((bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x16,0), bVar2 == 0 || - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_d0.y))))->RNG::RandomInt(5), isPrizeAnim == 0)))) { - (GHIDRA_CAST((player)))->Entity_Player::AddSoulHearts(2,0); - iVar4 = 0x36; -LAB_0065ec99: - play_sound_with_fart_seed(iVar4,1.0,2,0,1.0); - (GHIDRA_CAST((player)))->Entity_Player::AnimateHappy(); - goto LAB_0065ed16; - } - isPrizeAnim = (GHIDRA_CAST((&pEVar15->_dropRNG)))->RNG::RandomInt(0x10); - if ((isPrizeAnim == 0) && - ((bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x16,0), bVar2 == 0 || - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_d0.y))))->RNG::RandomInt(5), isPrizeAnim == 0)))) { - (GHIDRA_CAST((player)))->Entity_Player::AddEternalHearts(1); - iVar4 = 0x10a; - goto LAB_0065ec99; - } - level = GHIDRA_CAST(Config)::GetCollectibles(); - Level::RemoveCurses(level,0xffffffff); - level = GHIDRA_CAST(Config)::GetCollectibles(); - Level::AddAngelRoomChance(level,0x3dcccccd); - hud = GHIDRA_CAST(Game)::GetHUD(g_game); - stringTable = GHIDRA_CAST(FUN_004253c0()); - pbVar5 = string_table_translate(stringTable,GHIDRA_CAST("#YOU_FEEL_BLESSED")); - HUD::show_fortune_text_impl(hud,pbVar5); - } -LAB_0065ed10: - pEVar15 = savedSlot; - } - } - } - } -LAB_0065ed16: - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) != 2) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))) != 0)) || - (((((iVar4 = pEVar15->_variant, iVar4 == 4 || - ((((iVar4 == 5 || (iVar4 == 7)) || (iVar4 == 9)) || ((iVar4 == 0xd || (iVar4 == 0x12)))))) - || (iVar4 == 0xe)) && - ((bVar2 = ANM2::IsPlaying(&pEVar15->_sprite,GHIDRA_CAST("PayPrize")), bVar2 != 0 && - (bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,&s_empty), bVar2 == 0)))) || - ((pEVar15->_variant == 6 || (pEVar15->_variant == 0xf)))))) { - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))); - if (iVar4 != 5) { - if (iVar4 == 2) { - iVar4 = pEVar15->_variant; - if (((((iVar4 == 1) || (iVar4 == 3)) || (iVar4 == 2)) || - ((iVar4 == 0x10 || (iVar4 == 0x11)))) && - (bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,&s_empty), bVar2 != 0)) { - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Wiggle"),0); - } - if (pEVar15->_variant == 0xe) { - tmpVec = &pEVar15->_pos; - local_a0.y = (float)tmpVec; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered(&DAT_00b64ba4); - if (bVar2 != 0) { - isPrizeAnim = Random(); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0xc,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),10,isPrizeAnim); - (GHIDRA_CAST((effect)))->Entity_Effect::FollowParent(GHIDRA_CAST(pEVar15)); - set_field_358(effect,-10.0); - tmpVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite)::Scale(); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetSpriteScale(tmpVec); - tmpVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity)::SpriteScale(); - pVVar13 = (GHIDRA_CAST((GHIDRA_CAST((local_4c + 0x10)))))->Vector::Vector(0.0,-20.0); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::Mul(&VStack_54,pVVar13); - FUN_004563c0(tmpVec); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::AddEntityFlags(0x100000000000); - effect->Update(); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(0.0); - pEVar15 = savedSlot; - tmpVec = GHIDRA_CAST(local_a0.y); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered(&DAT_00b1d534); - if (bVar2 != 0) { - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,0xf,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - } - } - } - else if (iVar4 == 3) { - iVar4 = pEVar15->_variant; - if (((iVar4 == 1) || (iVar4 == 2)) || - ((iVar4 == 3 || (((iVar4 == 0x13 || (iVar4 == 0x10)) || (iVar4 == 0x11)))))) { - slotAnimState = GHIDRA_CAST(Config)::GetPillEffects(); - bVar2 = AnimationState::IsLoopingAnimation(slotAnimState); - if ((bVar2 != 0) || (bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,&s_empty), bVar2 != 0) - ) { - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Broken"),0); - } - } - } - else if ((iVar4 == 4) && (pEVar15->_variant != 0x10)) { - pEVar15->_entityCollisionClass = 0; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Disappear"); - if (bVar2 != 0) { - pEVar15->_shadowSize = 0.0; - } - bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,&s_empty); - if (bVar2 != 0) { - pEVar15->Remove(); - } - } - goto LAB_00662654; - } - iVar4 = pEVar15->_variant; - if ((iVar4 != 6) && (iVar4 != 0xf)) { - if (iVar4 == 9) { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x424)))) = 0x1e; - } - bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,&s_empty); - if (bVar2 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - ANM2::Play(&pEVar15->_sprite,s_Idle,0); - } - } - goto LAB_00662654; - } - } - pAVar10 = GHIDRA_CAST(&pEVar15->_dropRNG); - newSlotTimer = 3; - local_c0.y = (float)pAVar10; - isPrizeAnim = EntityPtr::Ref(); - (GHIDRA_CAST((&prizeRng)))->RNG::game_constructor(isPrizeAnim,newSlotTimer); - ehState = 0; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x4c,0); - if (bVar2 == 0) { - local_a8.y = 1.4013e-45; - } - else { - local_a8.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::GetTrinketMultiplier(0x4c); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))) = GHIDRA_CAST(0x3); - minMaxResult = GHIDRA_CAST(std)::min(); - local_a8.y = (float)*minMaxResult; - } - switch(pEVar15->_variant) { - case 1: - (GHIDRA_CAST((prizeAnimName)))->msvc::string::string_from_cstr(GHIDRA_CAST("Prize")); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 1; - pAVar14 = GHIDRA_CAST(Config)::GetPillEffects(); - ANM2::GetAnimation(pAVar14,GHIDRA_CAST(local_4c)); - isPrizeAnim = FUN_0040c790(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))) = GHIDRA_CAST(CONCAT13(isPrizeAnim,(*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))))); - (GHIDRA_CAST((local_4c)))->msvc::string::_Tidy_deallocate(); - ehState = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(ehState))) + 0x1))) << 8; - (GHIDRA_CAST((prizeAnimName)))->msvc::string::_Tidy_deallocate(); - pEVar15 = savedSlot; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x7))) != '\0') { - switch(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x414))))) { - case 3: - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - if (isPrizeAnim == 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::AddPrettyFly(); - (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::AnimateHappy(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - } - else { - local_c8.y = (float)&pEVar15->_pos; - local_a0.x = g_vectorZero.x; - iVar4 = 0; - local_a0.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(&local_d8,isPrizeAnim); - local_e8.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_b8,&local_e8.y); - (GHIDRA_CAST((&local_a0)))->Vector::operator_assign(tmpVec); - local_a0.y = local_a0.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_b0.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_a0)))->Vector::__mul(&local_f0,&local_b0.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_c8.y))))->Vector::__add(&local_d0,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_c8.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - Game::Spawn(g_game,0xd,0,GHIDRA_CAST(local_c8.y),&local_a0,GHIDRA_CAST(0x0),0,isPrizeAnim); - (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::AnimateSad(); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x410)))) = 1; - pEVar15 = savedSlot; - } - break; - case 4: - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - HandleCollision(pEVar15,0x28,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - break; - case 5: - case 6: - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - HandleCollision(pEVar15,10,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - break; - case 7: - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - HandleCollision(pEVar15,0x1e,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - break; - case 8: - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - HandleCollision(pEVar15,0x46,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - break; - case 9: - case 10: - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - Game::ButterBeanFart(g_game,&pEVar15->_pos,9.0,GHIDRA_CAST(pEVar15),0,0); - pEVar15->Remove(); - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 9) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - uVar22 = 0; - pTVar21 = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - pTVar20 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - pEVar8 = Game::Spawn(g_game,5,100,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0x12,isPrizeAnim); - pickup = GHIDRA_CAST(__RTDynamicCast(pEVar8,uVar12,pTVar20,pTVar21,uVar22)); - } - else if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 10) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - uVar22 = 0; - pTVar21 = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - pTVar20 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - pEVar8 = Game::Spawn(g_game,5,100,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0xb1,isPrizeAnim); - pickup = GHIDRA_CAST(__RTDynamicCast(pEVar8,uVar12,pTVar20,pTVar21,uVar22)); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - ItemPool::RemoveCollectible(itemPool,0xb1,0,0); - } - else { - pickup = GHIDRA_CAST(0x0); - } - FUN_005b1990(1); - (GHIDRA_CAST((pickup)))->Entity_Pickup::SetAlternatePedestal(3); - pickup->Update(); - default: -switchD_0065eef5_default: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - break; - case 0xb: - case 0xc: - case 0xd: - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - local_e8.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - local_b0.y = 1.4013e-45; - minMaxResult = GHIDRA_CAST(FUN_0040cdc0()); - fVar18 = local_a8.y; - local_b0.y = (float)*minMaxResult; - if (GHIDRA_CAST(local_b0.y) == GHIDRA_CAST(0x0)) goto switchD_0065eef5_default; - do { - HandleCollision(pEVar15,0x14,0,fVar18,&prizeRng,&g_vectorZero,&g_vectorZero); - local_b0.y = (float)(GHIDRA_INT(&(GHIDRA_CAST((GHIDRA_INT(local_b0.y) + -0x114)))->_bitflags) + 3); - } while (GHIDRA_CAST(local_b0.y) != GHIDRA_CAST(0x0)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - local_b0.y = 0.0; - } - } - break; - case 2: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(100); - if (isPrizeAnim == 0) { - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - bVar2 = ItemPool::RemoveTrinket(itemPool,0x22); - if (bVar2 == 0) goto LAB_0065f619; - iVar4 = 0; - local_d0.x = g_vectorZero.x; - local_c8.y = (float)&savedSlot->_pos; - local_d0.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(&local_a0,isPrizeAnim); - local_e8.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_d8,&local_e8.y); - (GHIDRA_CAST((&local_d0)))->Vector::operator_assign(tmpVec); - local_d0.y = local_d0.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_b0.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_d0)))->Vector::__mul(&local_b8,&local_b0.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_c8.y))))->Vector::__add(&local_f0,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_c8.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = Random(); - Game::Spawn(g_game,5,0x15e,GHIDRA_CAST(local_c8.y),&local_d0,GHIDRA_CAST(0x0),0x22,isPrizeAnim); -LAB_0065f522: - pEVar15 = savedSlot; - } - else { -LAB_0065f619: - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(0xf); - if (isPrizeAnim == 0) { - local_d0.y = 1.89175e-43; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - if (isPrizeAnim == 0) { -LAB_0065f65e: - pEVar15 = savedSlot; - bVar2 = PersistentGameData::Unlocked - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x548)))),0x93); - local_d0.y = 1.89175e-43; - if (bVar2 != 0) { - local_d0.y = 1.66755e-43; - } - } - else { - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - bVar2 = ItemPool::is_collectible_available(itemPool,0x87,0); - if (bVar2 == 0) goto LAB_0065f65e; - pEVar15 = savedSlot; - } - Game::GetField26614(g_game); - cVar3 = DeathmatchManager::is_active(); - if (cVar3 != '\0') { - hud = GHIDRA_CAST(Game)::GetField26614(g_game); - piVar9 = GHIDRA_CAST((GHIDRA_CAST((hud)))->EntityList)::Size(); - cVar3 = (**(code **)(*piVar9 + 0x30))(local_d0.y); - if (cVar3 != '\0') goto LAB_0065f76e; - } - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - ItemPool::RemoveCollectible(itemPool,GHIDRA_INT(local_d0.y),0,0); - pEVar15->Remove(); - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - uVar22 = 0; - pTVar21 = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - pTVar20 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - pEVar8 = Game::Spawn(g_game,5,100,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_UINT(local_d0.y),isPrizeAnim); - pickup = GHIDRA_CAST(__RTDynamicCast(pEVar8,uVar12,pTVar20,pTVar21,uVar22)); - (GHIDRA_CAST((pickup)))->Entity_Pickup::SetAlternatePedestal(2); - pickup->Update(); - goto LAB_0065f522; - } -LAB_0065f76e: - fVar18 = local_e0.y; - if ((GHIDRA_CAST(local_e0.y) == GHIDRA_CAST(0x0)) || - (iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::GetHealthType(), iVar4 != 3)) { - bVar2 = Game::IsHardMode(); - if (bVar2 == 0) { - local_d8.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - local_a0.y = 1.4013e-45; - } - else { - local_f0.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - local_b8.y = 1.4013e-45; - } - minMaxResult = GHIDRA_CAST(FUN_0040cdc0()); - pAVar10 = GHIDRA_CAST(*minMaxResult); - local_c0.y = (float)pAVar10; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::HasCollectible(0x4b,0); - } - else { - local_c0.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::HasCollectible(0x4b,0); - if (bVar2 == 0) { -LAB_0065f7e9: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))) = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_f8))) + 0x4))) & 0xffffff)); - } - else { - newSlotTimer = 8; - isPrizeAnim = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST((local_4c + 8)))))->RNG::game_constructor(isPrizeAnim,newSlotTimer); - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),2); - local_e8.y = (float)(GHIDRA_UINT(local_b0.y) | 1); - local_b0.y = local_e8.y; - isPrizeAnim = (GHIDRA_CAST((localRng)))->RNG::RandomInt(4); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))) = GHIDRA_CAST(CONCAT13(1,(*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))))); - if (isPrizeAnim != 0) goto LAB_0065f7e9; - } - ehState = 0; - if ((GHIDRA_UINT(local_b0.y) & 1) != 0) { - guard_check_icall(); - } - pAVar10 = GHIDRA_CAST(local_c0.y); - bVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x7))); - } - pEVar15 = savedSlot; - fVar18 = local_a8.y; - if (bVar2 != 0) { - pAVar10 = GHIDRA_CAST(((pAVar10->_filename)._buf + 1)); - local_c0.y = (float)pAVar10; - } - if (pAVar10 == GHIDRA_CAST(0x0)) goto LAB_0065f522; - do { - HandleCollision(pEVar15,0x14,0,fVar18,&prizeRng,&g_vectorZero,&g_vectorZero); - local_c0.y = (float)(GHIDRA_INT(&(GHIDRA_CAST((GHIDRA_INT(local_c0.y) + -0x114)))->_bitflags) + 3); - } while (GHIDRA_CAST(local_c0.y) != GHIDRA_CAST(0x0)); - local_c0.y = 0.0; - } - if (pEVar15->_exists == 0) break; - SoundEffects::PlayWithFartOverride(0xaf,1.0,2,0,1.0); - isPrizeAnim = Random(); - pEVar8 = Game::Spawn(g_game,1000,2,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),3,isPrizeAnim); - tmpVec = (GHIDRA_CAST((&local_a0)))->Vector::Vector(0.0,-2.0); - FUN_004563c0(tmpVec); - set_field_358(pEVar8,5.0); - } -LAB_0065f5b0: - pEVar15 = savedSlot; - break; - case 3: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - iVar4 = Game::Difficulty(g_game); - if (iVar4 == 1) { - local_c8.y = 0.85; - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasCollectible(0x2e,0); - if ((bVar2 != 0) || - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x4c,0), bVar2 != 0 && - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(5), isPrizeAnim == 0)))) { - local_c8.y = local_c8.y * 0.46; - } - local_a0.y = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomFloat(); - if (local_c8.y <= local_a0.y) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(0x14); - if (isPrizeAnim == 0) { - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - spawn_break_drops(pEVar15); - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Death"),0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(0x1e); - if (isPrizeAnim == 0) { - pEVar15->Remove(); - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - uVar22 = 0; - pTVar21 = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - pTVar20 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - pEVar8 = Game::Spawn(g_game,5,100,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0x9e,isPrizeAnim) - ; - pickup = GHIDRA_CAST(__RTDynamicCast(pEVar8,uVar12,pTVar20,pTVar21,uVar22)); - (GHIDRA_CAST((pickup)))->Entity_Pickup::SetAlternatePedestal(1); - pickup->Update(); - goto LAB_0065f5b0; - } - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - if (isPrizeAnim == 0) goto LAB_0065facd; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - if ((isPrizeAnim != 0) || - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x16,0), bVar2 != 0 && - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_d0.y))))->RNG::RandomInt(5), isPrizeAnim != 0)))) { - local_b0.y = (float)&pEVar15->_pos; - local_b8.x = g_vectorZero.x; - iVar4 = 0; - local_b8.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(&local_f0,isPrizeAnim); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_e8,&local_a0.y); - (GHIDRA_CAST((&local_b8)))->Vector::operator_assign(tmpVec); - local_b8.y = local_b8.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(&local_c8,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&local_d0,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_b0.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - goto LAB_0065fc5e; - } - HandleCollision(pEVar15,10,3,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - } - } - else if (0.002 <= local_a0.y) { - Game::ShowFortune(g_game); - } - else { - FUN_0065d070(); - } - } - break; - case 4: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - if (isPrizeAnim == 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - if ((isPrizeAnim == 0) && - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x16,0), bVar2 == 0 || - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_d0.y))))->RNG::RandomInt(5), isPrizeAnim == 0)))) { - HandleCollision(pEVar15,10,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - if (isPrizeAnim == 0) { - HandleCollision(pEVar15,0x1e,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - } - else { - HandleCollision(pEVar15,0x28,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - } - } - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - if (isPrizeAnim == 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - if (isPrizeAnim != 0) { -LAB_0065facd: - HandleCollision(pEVar15,300,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - break; - } - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(5); - local_b0.y = (float)(isPrizeAnim + 0x16); - Game::GetPlayerManager(g_game); - cVar3 = FUN_0060d1c0(0x1f); - if (cVar3 == '\0') { - Game::GetPlayerManager(g_game); - cVar3 = FUN_0065cfe0(10); - if (cVar3 != '\0') goto LAB_0065fdc3; - } - else { -LAB_0065fdc3: - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - local_b0.y = (float)ItemPool::GetCollectible(itemPool,10,isPrizeAnim,0,0,0); - } - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - tmpVec = GHIDRA_CAST(FUN_006653c0(&local_a0)); - pAVar10 = GHIDRA_CAST(local_b0.y); - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - pAVar10 = GHIDRA_CAST(ItemPool)::GetCollectible(itemPool,10,newSlotTimer,0,0,0); - tmpVec = GHIDRA_CAST(FUN_006653c0(&local_a0)); - } - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),GHIDRA_UINT(pAVar10),isPrizeAnim); - pEVar15 = savedSlot; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x410)))) = 4; - ANM2::Play(&savedSlot->_sprite,GHIDRA_CAST("Teleport"),0); - level = GHIDRA_CAST(Config)::GetCollectibles(); - Level::SetStateFlag(level,3,1); - } - } - break; - case 5: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - local_b0.y = (float)&pEVar15->_pos; - local_b8.x = g_vectorZero.x; - iVar4 = 0; - local_b8.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(&local_f0,isPrizeAnim); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_e8,&local_a0.y); - (GHIDRA_CAST((&local_b8)))->Vector::operator_assign(tmpVec); - local_b8.y = local_b8.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(&local_c8,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&local_d0,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_b0.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - fVar18 = local_c0.y; - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::RandomInt(2); - if (isPrizeAnim == 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->RNG::RandomInt(2); - pEVar15 = savedSlot; - if (isPrizeAnim == 0) { - HandleCollision(savedSlot,0x46,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - } - else { - HandleCollision(savedSlot,300,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - } - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->RNG::RandomInt(4); - if (isPrizeAnim == 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->RNG::Next(); -LAB_0065fc5e: - Game::Spawn(g_game,5,0x15e,GHIDRA_CAST(local_b0.y),&local_b8,GHIDRA_CAST(0x0),0,isPrizeAnim); - goto LAB_0065f5b0; - } - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->RNG::Next(); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - newSlotTimer = ItemPool::GetCollectible(itemPool,0xb,newSlotTimer,0,0,0); - tmpVec = GHIDRA_CAST(FUN_006653c0(&local_a0)); - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),newSlotTimer,isPrizeAnim); - pEVar15 = savedSlot; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x410)))) = 4; - ANM2::Play(&savedSlot->_sprite,GHIDRA_CAST("Teleport"),0); - level = GHIDRA_CAST(Config)::GetCollectibles(); - Level::SetStateFlag(level,4,1); - } - } - break; - case 6: - case 0xf: - ANM2::Play(&pEVar15->_sprite,(&PTR_s_Shell1Prize_00b64c30)[*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41a))))],0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - if (((isPrizeAnim == 0) || - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasCollectible(0x2e,0), bVar2 != 0 && - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_e8.y))))->RNG::RandomInt(3), isPrizeAnim == 0)))) || - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x4c,0), bVar2 != 0 && - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_e8.y))))->RNG::RandomInt(0x14), isPrizeAnim == 0)))) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - local_d0.y = 1.4013e-45; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) == 0x14) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(2); - local_d0.y = (float)(isPrizeAnim + 2); - } - else if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))) != 100) { - local_a0.y = 2.8026e-45; - local_d8.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - clampResult = GHIDRA_CAST(FUN_0040cdc0()); - local_d0.y = *clampResult; - } - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))); - if (iVar4 == 0) { - (GHIDRA_CAST((&local_d8)))->Vector::Vector((float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41a)))) + -1) * 37.0,5.0); - fVar18 = local_e0.y; - if (GHIDRA_CAST(local_d0.y) != GHIDRA_CAST(0x0)) { - local_a0.y = (float)&pEVar15->_pos; - pRVar16 = GHIDRA_CAST(local_d0.y); - do { - pVVar13 = &g_vectorZero; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a0.y))))->Vector::__add(&local_b8,&local_d8); - (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::ThrowBlueSpider(tmpVec,pVVar13); - pRVar16 = GHIDRA_CAST((GHIDRA_INT(&pRVar16[-1]._shift3) + 3)); - } while (pRVar16 != GHIDRA_CAST(0x0)); - pEVar15 = savedSlot; - } - } - else if (iVar4 == 100) { - if (pEVar15->_variant == 0xf) { - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - isPrizeAnim = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x540)))); - tmpVec = GHIDRA_CAST(FUN_006653c0(local_4c + 0x10)); - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),isPrizeAnim,newSlotTimer); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - pEVar15 = savedSlot; - ItemPool::RemoveCollectible(itemPool,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x540)))),0,0); - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - tmpVec = GHIDRA_CAST(FUN_006653c0(local_4c + 0x10)); - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),9,isPrizeAnim); - pEVar15 = savedSlot; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 4; - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Teleport"),0); - } - else { - local_c8.y = 0.0; - if (iVar4 == 10) { - if (pEVar15->_variant != 0xf) goto LAB_00660ed1; - local_c8.y = (float)&DAT_00000006; - local_d0.y = 1.4013e-45; - } - else if (iVar4 == 300) { - local_d0.y = 1.4013e-45; - } - else { -LAB_00660ed1: - if (GHIDRA_CAST(local_d0.y) == GHIDRA_CAST(0x0)) goto LAB_0066113f; - } - local_e8.y = (float)&pEVar15->_pos; - do { - (GHIDRA_CAST((GHIDRA_CAST(&local_b8))))->EntityPtr::clear(); - (GHIDRA_CAST((GHIDRA_CAST(&local_f0))))->EntityPtr::clear(); - local_b0.y = 0.0; - do { - tmpVec = (GHIDRA_CAST((&local_c0)))->Vector::Vector((float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41a)))) + -1) * 4.0, - 4.0); - pVVar13 = MusicManager::RandomVector(&local_e0); - local_a0.y = 2.0; - pVVar13 = (GHIDRA_CAST((pVVar13)))->Vector::__mul(GHIDRA_CAST(&local_f8),&local_a0.y); - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__add(&addOut,pVVar13); - (GHIDRA_CAST((&local_b8)))->Vector::operator_assign(tmpVec); - tmpVec = (GHIDRA_CAST((&posOut)))->Vector::Vector((float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x41a)))) + -1) * 37.0 - ,5.0); - (GHIDRA_CAST((&local_f0)))->Vector::operator_assign(tmpVec); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(&scratchVec,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_e8.y))))->Vector::__add(&VStack_54,tmpVec); - pVVar13 = (GHIDRA_CAST((GHIDRA_CAST(local_e8.y))))->Vector::__add(GHIDRA_CAST((local_4c + 0x10)),&local_f0); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(pVVar13,tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - pEVar15 = savedSlot; - if (bVar2 != 0) break; - local_b0.y = (float)(GHIDRA_INT((GHIDRA_CAST(local_b0.y))->_buf) + 1); - } while (GHIDRA_UINT(local_b0.y) < GHIDRA_CAST(0xa)); - HandleCollision(savedSlot,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x414)))),local_c8.y,local_a8.y, - &prizeRng,&local_f0,&local_b8); - local_d0.y = (float)(GHIDRA_INT(&(GHIDRA_CAST((GHIDRA_INT(local_d0.y) + -0x10)))->_shift3) + 3); - } while (GHIDRA_CAST(local_d0.y) != GHIDRA_CAST(0x0)); - local_d0.y = 0.0; - } - } - else { - SoundEffects::PlayWithFartOverride(0xbb,1.0,2,0,1.0); - tmpVec = (GHIDRA_CAST((&local_f0)))->Vector::Vector((float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41a)))) + -1) * 4.0,4.0); - pVVar13 = MusicManager::RandomVector(&local_e8); - local_a0.y = 2.0; - pVVar13 = (GHIDRA_CAST((pVVar13)))->Vector::__mul(&local_b0,&local_a0.y); - (GHIDRA_CAST((tmpVec)))->Vector::__add(&local_b8,pVVar13); - pEVar15 = savedSlot; - (GHIDRA_CAST((&local_d8)))->Vector::Vector((float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x41a)))) + -1) * 37.0,5.0); - if (pEVar15->_variant == 0xf) { - local_a0.x = g_vectorZero.x; - local_a0.y = g_vectorZero.y; - tmpVec = (GHIDRA_CAST((&pEVar15->_pos)))->Vector::__add(&local_f0,&local_d8); - targetPos.y = local_a0.y; - targetPos.x = local_a0.x; - Entity_NPC::ThrowSpider(tmpVec,GHIDRA_CAST(0x0),targetPos,0,-30.0); - } - else { - local_a0.y = (float)&pEVar15->_pos; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_a0.y))))->Vector::__add(&local_f0,&local_d8); - Game::Spawn(g_game,0x12,0,tmpVec,&local_b8,GHIDRA_CAST(0x0),0,isPrizeAnim); - pEVar15 = savedSlot; - } - } - } -LAB_0066113f: - bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,&s_empty); - if (bVar2 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - ANM2::Play(&pEVar15->_sprite,s_Idle,0); - } - break; - case 7: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(8); - if ((isPrizeAnim != 0) && ((*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x418))) == '\0')) { - local_b0.y = (float)&pEVar15->_pos; - local_b8.x = g_vectorZero.x; - iVar4 = 0; - local_b8.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(GHIDRA_CAST((local_4c + 0x10)),isPrizeAnim); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&VStack_54,&local_a0.y); - (GHIDRA_CAST((&local_b8)))->Vector::operator_assign(tmpVec); - local_b8.y = local_b8.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(&scratchVec,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&posOut,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_b0.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(GHIDRA_CAST((local_4c + 0x10)),&local_a0.y); - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::RandomInt(3); - Game::Spawn(g_game,5,*GHIDRA_CAST((&DAT_00b62fd0 + newSlotTimer * 4)),GHIDRA_CAST(local_b0.y),tmpVec, - GHIDRA_CAST(0x0),0,isPrizeAnim); - goto LAB_0065f5b0; - } - local_b0.y = (float)&pEVar15->_pos; - local_b8.x = g_vectorZero.x; - iVar4 = 0; - local_b8.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(GHIDRA_CAST((local_4c + 0x10)),isPrizeAnim); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&VStack_54,&local_a0.y); - (GHIDRA_CAST((&local_b8)))->Vector::operator_assign(tmpVec); - local_b8.y = local_b8.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(&scratchVec,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&posOut,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_b0.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - pEVar15 = savedSlot; - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - pRVar16 = &savedSlot->_dropRNG; - if (((*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x418))) == '\0') && (isPrizeAnim = (GHIDRA_CAST((pRVar16)))->RNG::RandomInt(2), isPrizeAnim == 0)) { - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - bVar2 = ItemPool::RemoveTrinket(itemPool,0x13); - if (bVar2 == 0) goto LAB_0066148d; - isPrizeAnim = (GHIDRA_CAST((pRVar16)))->RNG::Next(); - Game::Spawn(g_game,5,0x15e,&pEVar15->_pos,&local_b8,GHIDRA_CAST(pEVar15),0x13,isPrizeAnim); - } - else { -LAB_0066148d: - local_a0.y = (float)(GHIDRA_CAST((pRVar16)))->RNG::Next(); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - isPrizeAnim = (GHIDRA_CAST((pRVar16)))->RNG::Next(); - isPrizeAnim = ItemPool::GetCollectible(itemPool,0xd,isPrizeAnim,0,0,0); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST((local_4c + 0x10)))))->Vector::Vector(0.0,80.0); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&VStack_54,tmpVec); - tmpVec = Room::FindFreePickupSpawnPosition(room,&scratchVec,tmpVec,0.0,0,0,0); - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),isPrizeAnim,GHIDRA_UINT(local_a0.y)); - pEVar15 = savedSlot; - } - (*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x418))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 4; - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Teleport"),0); - } - break; - case 8: - local_c8.y = (float)&pEVar15->_sprite; - slotAnimState = GHIDRA_CAST(FUN_0041e470()); - bVar2 = AnimationState::IsEventTriggered(slotAnimState,GHIDRA_CAST("CoinInsert")); - if (bVar2 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - isPrizeAnim = FUN_00424e60(0x14); - local_a8.y = (float)(isPrizeAnim % 1000); - PersistentGameData::IncreaseEventCounter(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x14,1) - ; - pAVar14 = GHIDRA_CAST((GHIDRA_INT(local_a8.y) + 1)); - local_a8.y = (float)pAVar14; - ANM2::SetFrame(GHIDRA_CAST(local_c8.y),GHIDRA_CAST("Prize"),0); - ANM2::SetLayerFrame(GHIDRA_CAST(local_c8.y),1,(GHIDRA_INT(pAVar14) / 100) % 10); - ANM2::SetLayerFrame(GHIDRA_CAST(local_c8.y),2,(GHIDRA_INT(pAVar14) / 10) % 10); - ANM2::SetLayerFrame(GHIDRA_CAST(local_c8.y),3,GHIDRA_INT((GHIDRA_INT(local_a8.y) + (GHIDRA_INT(pAVar14) / 10) * -10))); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(0x32); - fVar18 = local_e0.y; - if (isPrizeAnim == 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::DonateLuck(1); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::HasTrinket(0x55,0); - if ((bVar2 == 0) || (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3), isPrizeAnim != 0)) { -LAB_006616a8: - pEVar15 = savedSlot; - } - else { - local_a0.y = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomFloat(); - if (local_a0.y < 0.4) { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::GetTrinketMultiplier(0x55); - (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::AddCoins(iVar4); - goto LAB_006616a8; - } - if (local_a0.y < 0.8) { - unk2 = 0; - bVar2 = 0; - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::GetTrinketMultiplier(0x55); - (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::AddHearts(iVar4 * 2,bVar2,unk2); - goto LAB_006616a8; - } - if (local_a0.y < 0.95) { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::GetTrinketMultiplier(0x55); - (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::DonateLuck(iVar4); - goto LAB_006616a8; - } - local_a0.y = (float)(GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pEVar15 = savedSlot; - tmpVec = (GHIDRA_CAST((GHIDRA_CAST((local_4c + 0x10)))))->Vector::Vector(0.0,40.0); - tmpVec = (GHIDRA_CAST((&pEVar15->_pos)))->Vector::__add(&VStack_54,tmpVec); - tmpVec = Room::FindFreePickupSpawnPosition(room,&scratchVec,tmpVec,0.0,0,0,0); - Game::Spawn(g_game,6,4,tmpVec,&g_vectorZero,GHIDRA_CAST(pEVar15),0,GHIDRA_UINT(local_a0.y)); - pAVar10 = GHIDRA_CAST(&pEVar15->_dropRNG); - } - Game::DonateAngel(g_game,1); - Game::DonateGreed(g_game,1); - if (9 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x86); - } - if (0x13 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x97); - } - if (0x31 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x87); - } - if (99 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x98); - } - if (0x95 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x88); - } - if (199 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x99); - } - if (399 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x89); - } - if (599 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x9a); - } - if (899 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x3b); - } - if (0x3e6 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x8a); - } - if (999 < GHIDRA_INT(local_a8.y)) { - isPrizeAnim = Random(); - local_b0.y = (float)&pEVar15->_pos; - Game::Spawn(g_game,1000,1,GHIDRA_CAST(local_b0.y),&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Death"),0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - local_e8.y = (float)&DAT_0000000f; - do { - iVar4 = 0; - local_b8.x = g_vectorZero.x; - local_b8.y = g_vectorZero.y; - do { - tmpVec = MusicManager::RandomVector(GHIDRA_CAST((local_4c + 0x10))); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&VStack_54,&local_a0.y); - (GHIDRA_CAST((&local_b8)))->Vector::operator_assign(tmpVec); - local_b8.y = local_b8.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(&scratchVec,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&posOut,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_b0.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - pAVar10 = GHIDRA_CAST(local_c0.y); - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - Game::Spawn(g_game,5,0x14,GHIDRA_CAST(local_b0.y),&local_b8,GHIDRA_CAST(0x0),3,isPrizeAnim); - local_e8.y = (float)(GHIDRA_INT(&(GHIDRA_CAST((GHIDRA_INT(local_e8.y) + -0x114)))->_bitflags) + 3); - } while (GHIDRA_CAST(local_e8.y) != GHIDRA_CAST(0x0)); - Game::SetStateFlag(0x11,1); - } - pEVar15 = savedSlot; - if (GHIDRA_CAST(local_a8.y) == GHIDRA_CAST(0x3e7)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x42a)))) = 0; - newSlotTimer = 0x14; - } - else { - local_e8.y = 0.0; - local_b0.y = (float)(0xf - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x42a)))) / 10); - maxResult = GHIDRA_CAST(std)::max(); - newSlotTimer = *maxResult; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))) = newSlotTimer; - SoundEffects::PlayWithFartOverride(0x18,1.0,2,0,1.0); - iVar4 = Game::GetDonationModGreed(g_game); - local_d0.y = (float)(iVar4 * 3); - local_a0.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::GetTrinketMultiplier(0x55); - minResult = std_min_ptr(GHIDRA_CAST(&local_d0.y),GHIDRA_CAST(&local_a0.y)); - local_d0.y = (float)(GHIDRA_INT(local_d0.y) - *minResult); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) != 3) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3000); - if (isPrizeAnim < GHIDRA_UINT((GHIDRA_INT(local_d0.y) * 3))) { - bVar2 = 0; - pbVar5 = GHIDRA_CAST(FUN_0065d1f0()); - ANM2::Play(&pEVar15->_sprite,pbVar5,bVar2); - uVar12 = 0x12; -LAB_00661b4b: - Game::SetStateFlag(uVar12,1); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - } - } - } - break; - case 9: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x414)))); - if ((iVar4 == 1) || (iVar4 == 2)) { - local_c8.y = 1.4013e-44; - local_b0.y = 1.4013e-45; - if ((iVar4 == 1) || - ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x16,0), bVar2 != 0 && - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_d0.y))))->RNG::RandomInt(5), isPrizeAnim != 0)))) { - local_c8.y = (float)&DAT_00000014; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - local_b0.y = (float)(isPrizeAnim + 1); - if (GHIDRA_INT(local_b0.y) < 1) break; - } - fVar18 = local_a8.y; - do { - HandleCollision(pEVar15,local_c8.y,0,fVar18,&prizeRng,&g_vectorZero,&g_vectorZero); - local_b0.y = (float)(GHIDRA_INT(&(GHIDRA_CAST((GHIDRA_INT(local_b0.y) + -0x114)))->_bitflags) + 3); - } while (GHIDRA_CAST(local_b0.y) != GHIDRA_CAST(0x0)); - local_b0.y = 0.0; - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - newSlotTimer = ItemPool::GetCollectible(itemPool,0x19,newSlotTimer,0,0,0); - tmpVec = GHIDRA_CAST(FUN_006653c0(&local_a0)); - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),newSlotTimer,isPrizeAnim); - pEVar15 = savedSlot; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x410)))) = 4; - ANM2::Play(&savedSlot->_sprite,GHIDRA_CAST("Teleport"),0); - } - } - break; - case 10: - slotAnimState = GHIDRA_CAST(FUN_0041e470()); - bVar2 = AnimationState::IsEventTriggered(slotAnimState,GHIDRA_CAST("CoinInsert")); - if (bVar2 != 0) { - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - if (iVar4 == 0) { - isPrizeAnim = 4; -LAB_00662124: - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(isPrizeAnim); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))) = GHIDRA_CAST(CONCAT13(isPrizeAnim == 0,(*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))))); - } - else { - if (iVar4 == 1) { - isPrizeAnim = 3; - goto LAB_00662124; - } - if (iVar4 == 2) { - isPrizeAnim = 2; - goto LAB_00662124; - } - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(4); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))) = GHIDRA_CAST(CONCAT13(isPrizeAnim != 0,(*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x4))))); - } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x4c,0); - if (((bVar2 == 0) || (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(0x14), isPrizeAnim != 0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(&(local_f8)) + 0x7))) == '\0')) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) + 1; - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x424)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x424)))) + 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::HasTrinket(0x70,0); - if (bVar2 == 0) { - isPrizeAnim = 2; - } - else { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::GetTrinketMultiplier(0x70); - isPrizeAnim = iVar4 + 1; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x424)))) < 5) || - (isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(isPrizeAnim), isPrizeAnim != 0)) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((room)))->Room::ShopRestockFull(); - } - else { - isPrizeAnim = Random(); - Game::Spawn(g_game,1000,1,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - spawn_break_drops(pEVar15); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Death"),0); - } - } - newSlotTimer = 0xf; -LAB_00662215: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))) = newSlotTimer; - SoundEffects::PlayWithFartOverride(0x18,1.0,2,0,1.0); - } - break; - case 0xb: - local_c8.y = (float)&pEVar15->_sprite; - slotAnimState = GHIDRA_CAST(FUN_0041e470()); - bVar2 = AnimationState::IsEventTriggered(slotAnimState,GHIDRA_CAST("CoinInsert")); - if (bVar2 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - isPrizeAnim = FUN_00424e60(0x73); - local_a8.y = (float)(isPrizeAnim % 1000); - if ((*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x544))) != '\0') { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::GetPlayerType(); - if (iVar4 < 0x29) { - persistentData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))); - (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::GetPlayerType(); - iVar4 = FUN_00929b20(); - PersistentGameData::IncreaseEventCounter(persistentData,iVar4,1); - pEVar15 = savedSlot; - } - PersistentGameData::IncreaseEventCounter - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x73,1); - local_a8.y = (float)(GHIDRA_INT((GHIDRA_CAST(local_a8.y))->_buf) + 1); - } - fVar18 = local_a8.y; - ANM2::SetFrame(GHIDRA_CAST(local_c8.y),GHIDRA_CAST("Prize"),0); - ANM2::SetLayerFrame(GHIDRA_CAST(local_c8.y),1,(GHIDRA_INT(fVar18) / 100) % 10); - iVar4 = GHIDRA_INT(fVar18) / 10; - ANM2::SetLayerFrame(GHIDRA_CAST(local_c8.y),2,iVar4 % 10); - ANM2::SetLayerFrame(GHIDRA_CAST(local_c8.y),3,GHIDRA_INT((GHIDRA_INT(local_a8.y) + iVar4 * -10))); - pEVar15 = savedSlot; - if (1 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x548)))),0xf2); - } - if (0xd < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xf3); - } - if (0x20 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xf4); - } - if (0x43 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xf5); - } - if (GHIDRA_INT(local_a8.y) < 999) { - if (0x6e < GHIDRA_INT(local_a8.y)) goto LAB_00661da8; - } - else { - bVar2 = PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x113); - if (bVar2 != 0) { - isPrizeAnim = Random(); - uVar22 = 0; - pTVar21 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar20 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - pEVar8 = Game::Spawn(g_game,1000,0x68,&pEVar15->_pos,&g_vectorZero,GHIDRA_CAST(pEVar15),0, - isPrizeAnim); - effect = GHIDRA_CAST(__RTDynamicCast(pEVar8,uVar12,pTVar20,pTVar21,uVar22)); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x1c2); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST((local_4c + 0x10)))))->Vector::Vector(0.0,-80.0); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetPositionOffset(tmpVec); - effect->Update(); - pEVar15 = savedSlot; - } -LAB_00661da8: - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xf6); - } - if (0xe9 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xf7); - } - if (0x1b6 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xf8); - } - if (499 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x155); - } - if (0x299 < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xf9); - } - if (0x36e < GHIDRA_INT(local_a8.y)) { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xfa); - } - if (GHIDRA_INT(local_a8.y) < 1000) { - if (GHIDRA_CAST(local_a8.y) != GHIDRA_CAST(0x3e7)) goto LAB_00661fe0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42a)))) = 0; - newSlotTimer = 0x14; - } - else { - PersistentGameData::TryUnlock(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0xfb); - isPrizeAnim = Random(); - local_b0.y = (float)&pEVar15->_pos; - Game::Spawn(g_game,1000,1,GHIDRA_CAST(local_b0.y),&g_vectorZero,GHIDRA_CAST(0x0),0,isPrizeAnim); - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Death"),0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 3; - local_e8.y = 2.10195e-44; - do { - iVar4 = 0; - local_c8.x = g_vectorZero.x; - local_c8.y = g_vectorZero.y; - do { - tmpVec = MusicManager::RandomVector(GHIDRA_CAST((local_4c + 0x10))); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&VStack_54,&local_a0.y); - (GHIDRA_CAST((&local_c8)))->Vector::operator_assign(tmpVec); - local_c8.y = local_c8.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_c8)))->Vector::__mul(&scratchVec,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&posOut,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_b0.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - pAVar10 = GHIDRA_CAST(local_c0.y); - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - Game::Spawn(g_game,5,0x14,GHIDRA_CAST(local_b0.y),&local_c8,GHIDRA_CAST(0x0),3,isPrizeAnim); - local_e8.y = (float)(GHIDRA_INT(local_e8.y) + -1); - } while (local_e8.y != 0.0); - pEVar15 = savedSlot; -LAB_00661fe0: - local_e8.y = 0.0; - local_b0.y = (float)(0xf - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42a)))) / 10); - maxResult = GHIDRA_CAST(std)::max(); - newSlotTimer = *maxResult; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x41c)))) = newSlotTimer; - SoundEffects::PlayWithFartOverride(0x18,1.0,2,0,1.0); - local_a0.y = Entity_Player::GetGreedDonationJamChance - (GHIDRA_CAST(local_e0.y), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548))))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) != 3) { - local_d8.y = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomFloat(); - local_d8.y = local_d8.y * 100.0; - if (local_d8.y < local_a0.y) { - bVar2 = 0; - pbVar5 = GHIDRA_CAST(FUN_0065d1f0()); - ANM2::Play(&pEVar15->_sprite,pbVar5,bVar2); - uVar12 = 0x22; - goto LAB_00661b4b; - } - } - } - break; - default: - KAGE_LogMessage(1,GHIDRA_CAST("Slot type %d is not implemented!\n")); - break; - case 0xd: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(0x10); - if (isPrizeAnim == 0) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - isPrizeAnim = ItemPool::GetCollectible(itemPool,0xe,isPrizeAnim,0,0x25b,0); - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - tmpVec = GHIDRA_CAST(FUN_006653c0(&local_a0)); - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),isPrizeAnim,newSlotTimer); - pEVar15 = savedSlot; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x410)))) = 4; - ANM2::Play(&savedSlot->_sprite,GHIDRA_CAST("Teleport"),0); - level = GHIDRA_CAST(Config)::GetCollectibles(); - Level::SetStateFlag(level,3,1); - PersistentGameData::IncreaseEventCounter - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x1ef,1); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(8); - if (isPrizeAnim == 0) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - local_c8.y = (float)&pEVar15->_pos; - local_b8.x = g_vectorZero.x; - iVar4 = 0; - local_b8.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(&local_f0,isPrizeAnim); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_e8,&local_a0.y); - (GHIDRA_CAST((&local_b8)))->Vector::operator_assign(tmpVec); - local_b8.y = local_b8.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_b8)))->Vector::__mul(&local_b0,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_c8.y))))->Vector::__add(&local_d0,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_c8.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - fVar18 = local_c0.y; - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::RandomInt(10); - if (isPrizeAnim == 0) { - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - bVar2 = ItemPool::RemoveTrinket(itemPool,3); - if (bVar2 == 0) goto LAB_00660524; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->RNG::Next(); - fVar18 = 4.2039e-45; -LAB_006604ee: - tmpVec = &local_b8; - pAVar10 = GHIDRA_CAST(local_c8.y); -LAB_006604fd: - Game::Spawn(g_game,5,0x15e,GHIDRA_CAST(pAVar10),tmpVec,GHIDRA_CAST(0x0),GHIDRA_UINT(fVar18),isPrizeAnim); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x420)))) = 0; - pEVar15 = savedSlot; - } - else { -LAB_00660524: - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->RNG::RandomInt(10); - if (isPrizeAnim == 0) { - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - bVar2 = ItemPool::RemoveTrinket(itemPool,0x48); - if (bVar2 != 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->RNG::Next(); - fVar18 = 1.00893e-43; - goto LAB_006604ee; - } - } - pEVar15 = savedSlot; - HandleCollision(savedSlot,0x5a,0,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - } - } - else { - local_4c[0] = '\x01'; - local_4c[1] = '\0'; - local_4c[2] = '\0'; - local_4c[3] = '\0'; - local_4c[4] = '\x01'; - local_4c[5] = '\0'; - local_4c[6] = '\0'; - local_4c[7] = '\0'; - local_4c[8] = '\x01'; - local_4c[9] = '\0'; - local_4c[10] = '\0'; - local_4c[0xb] = '\0'; - local_4c[0xc] = '\x02'; - local_4c[0xd] = '\0'; - local_4c[0xe] = '\0'; - local_4c[0xf] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x10))) = 2; - local_38 = 3; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(6); - fVar18 = local_e0.y; - newSlotTimer = 0; - local_a0.y = *GHIDRA_CAST((local_4c + isPrizeAnim * 4)); - do { - iVar4 = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::GetActiveMaxCharge(newSlotTimer); - if (iVar4 == 0) { - if (0 < GHIDRA_INT(local_a0.y)) { - effect = Entity_Effect::CreateTimer - (&LAB_0065d930,GHIDRA_UINT((0x14 / (int64_t)GHIDRA_INT(local_a0.y))), - GHIDRA_UINT(local_a0.y),1); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetParent(GHIDRA_CAST(fVar18)); - effect->Update(); - } - break; - } - newSlotTimer = newSlotTimer + 1; - } while (newSlotTimer < 4); - (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity_Player::AnimateHappy(); - SoundEffects::PlayWithFartOverride(0xaa,1.0,2,0,1.0); - isPrizeAnim = Random(); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(fVar18))))->Entity::Position(&local_a0); - uVar22 = 0; - pTVar21 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar20 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar12 = 0; - pEVar8 = Game::Spawn(g_game,1000,0x31,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),1,isPrizeAnim); - pvVar11 = (void *)__RTDynamicCast(pEVar8,uVar12,pTVar20,pTVar21,uVar22); - tmpVec = (GHIDRA_CAST((&local_d8)))->Vector::Vector(0.0,-24.0); - FUN_004563c0(tmpVec); - set_field_358(pvVar11,1.0); - pEVar15 = savedSlot; -LAB_006606b2: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - } - } - } - break; - case 0xe: - pEVar15->Remove(); - PlayerManager::unlock_completion_mark(0xf); - guard_check_icall(); - ExceptionList = savedExceptionList; - return; - case 0x10: - case 0x11: - break; - case 0x12: - ANM2::Play(&pEVar15->_sprite,GHIDRA_CAST("Prize"),0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Prize"); - if (bVar2 != 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(0x18); - if (isPrizeAnim == 0) { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::Next(); - isPrizeAnim = ItemPool::GetCollectible(itemPool,0x1e,isPrizeAnim,0,0x1a,0); - newSlotTimer = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - tmpVec = GHIDRA_CAST(FUN_006653c0(&local_a0)); - Game::Spawn(g_game,5,100,tmpVec,&g_vectorZero,GHIDRA_CAST(0x0),isPrizeAnim,newSlotTimer); - pEVar15 = savedSlot; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x410)))) = 4; - ANM2::Play(&savedSlot->_sprite,GHIDRA_CAST("Teleport"),0); - level = GHIDRA_CAST(Config)::GetCollectibles(); - Level::SetStateFlag(level,3,1); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(4); - if (isPrizeAnim == 0) { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(6); - if (isPrizeAnim == 0) { - bVar2 = PersistentGameData::Unlocked - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x187); - if (bVar2 == 0) goto LAB_006608b1; - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - HandleCollision(pEVar15,10,0xb,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - } - else { - if ((2 < isPrizeAnim - 1) || - (bVar2 = PersistentGameData::Unlocked - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x548)))),0x19b), bVar2 == 0) - ) { -LAB_006608b1: - newSlotTimer = 7; - choiceTable[0] = 4.06377e-44; - choiceTable[1] = 1.31722e-43; - VStack_54.x = 9.94922e-44; - VStack_54.y = 1.76564e-43; - isPrizeAnim = EntityPtr::Ref(); - (GHIDRA_CAST((GHIDRA_CAST((local_4c + 8)))))->RNG::game_constructor(isPrizeAnim,newSlotTimer); - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 3; - local_b0.y = (float)(GHIDRA_CAST((this_02)))->RNG::RandomInt(8); - ehState = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(ehState))) + 0x1))) << 8; - guard_check_icall(); - if (GHIDRA_CAST(&DAT_00000004) <= GHIDRA_UINT(local_b0.y)) { -LAB_00660a66: - (GHIDRA_CAST((&tmpColor)))->Color::Color(); - fVar18 = local_e0.y; - Game::Fart(g_game,&pEVar15->_pos,85.0,GHIDRA_CAST(local_e0.y),1.0,0,color); - Game::ButterBeanFart(g_game,&pEVar15->_pos,120.0,GHIDRA_CAST(fVar18),0,0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x420)))) = 0; - pEVar15 = savedSlot; - break; - } - itemPool = GHIDRA_CAST(Game)::GetItemPool(g_game); - local_b8.y = choiceTable[GHIDRA_INT(local_b0.y)]; - bVar2 = ItemPool::RemoveTrinket(itemPool,GHIDRA_INT(local_b8.y)); - if (bVar2 == 0) goto LAB_00660a66; - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - local_b0.y = (float)&pEVar15->_pos; - local_f0.x = g_vectorZero.x; - iVar4 = 0; - local_f0.y = g_vectorZero.y; - do { - isPrizeAnim = (GHIDRA_CAST((&prizeRng)))->RNG::Next(); - tmpVec = RandomVector(&local_e8,isPrizeAnim); - local_a0.y = 5.0; - tmpVec = (GHIDRA_CAST((tmpVec)))->Vector::__mul(&local_c8,&local_a0.y); - (GHIDRA_CAST((&local_f0)))->Vector::operator_assign(tmpVec); - local_f0.y = local_f0.y * 0.2 + 3.0; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_d8.y = 7.0; - tmpVec = (GHIDRA_CAST((&local_f0)))->Vector::__mul(&local_d0,&local_d8.y); - tmpVec = (GHIDRA_CAST((GHIDRA_CAST(local_b0.y))))->Vector::__add(&local_a8,tmpVec); - bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_b0.y),tmpVec,1,0,0,0,GHIDRA_CAST(0x0)); - if (bVar2 != 0) break; - iVar4 = iVar4 + 1; - } while (iVar4 < 10); - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(local_c0.y))))->RNG::Next(); - tmpVec = &local_f0; - pAVar10 = GHIDRA_CAST(local_b0.y); - fVar18 = local_b8.y; - goto LAB_006604fd; - } - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - HandleCollision(pEVar15,10,0xc,local_a8.y,&prizeRng,&g_vectorZero,&g_vectorZero); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - } - } - else { - SoundEffects::PlayWithFartOverride(0xff,1.0,2,0,1.0); - pEVar8 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG)::RandomInt(2); - if (pEVar8 == GHIDRA_CAST(0x0)) { - tmpVec = &pEVar15->_pos; - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::AddBlueFlies(isPrizeAnim + 1,tmpVec,pEVar8); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x420)))) = 0; - } - else { - isPrizeAnim = (GHIDRA_CAST((GHIDRA_CAST(pAVar10))))->RNG::RandomInt(3); - fVar18 = local_e0.y; - iVar4 = isPrizeAnim + 1; - if (iVar4 < 1) goto LAB_006606b2; - local_a0.y = (float)&pEVar15->_pos; - do { - Entity_Player::ThrowBlueSpider - (GHIDRA_CAST(fVar18),GHIDRA_CAST(local_a0.y),&g_vectorZero); - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedSlot)) + 0x420)))) = 0; - pEVar15 = savedSlot; - } - } - } - } - break; - case 0x13: - slotAnimState = GHIDRA_CAST(FUN_0041e470()); - bVar2 = AnimationState::IsEventTriggered(slotAnimState,GHIDRA_CAST("CoinInsert")); - if (bVar2 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - FUN_00704b50(1); - iVar4 = FUN_0065d010(); - game = g_game; - if (iVar4 < 1) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42a)))) = 0; - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(game); - iVar4 = PlayerManager::GetNumCoopPlayers(playerManager); - if (iVar4 == 1) { - SoundEffects::PlayWithFartOverride(0x36,1.0,2,0,1.0); - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - PlayerManager::revive_player_ghosts(playerManager); - FUN_0065d040(1); - pvVar11 = (void *)FUN_0065d090(); - Player_stats_add(pvVar11,0xc,GHIDRA_CAST(local_e0.y),1.0); - } - else { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - isPrizeAnim = PlayerManager::GetNumCoopPlayers(playerManager); - if (isPrizeAnim < 2) { - SoundEffects::PlayWithFartOverride(0x10b,1.0,2,0,1.0); - } - else { - cVar3 = FUN_00423960(); - if (cVar3 == '\0') { - FUN_0065d060(); - uVar12 = (GHIDRA_CAST((GHIDRA_CAST(local_e0.y))))->Entity_Player::ControllerIndex(); -LAB_006623ad: - FUN_008ef840(uVar12); - pEVar15 = savedSlot; - } - else { - pvVar11 = (void *)FUN_00417920(); - (GHIDRA_CAST((pvVar11)))->InputManager::GetDeviceByPlayerEntity(GHIDRA_CAST(local_e0.y)); - cVar3 = FUN_0065d0a0(); - if (cVar3 != '\0') { - FUN_0065d060(); - uVar12 = FUN_00423970(); - goto LAB_006623ad; - } - } - FUN_0065d040(1); - } - } - FUN_0065d020(); - } - FUN_00665630(); - local_a0.y = 0.0; - local_d8.y = (float)(0xf - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42a)))) / 10); - maxResult = GHIDRA_CAST(std)::max(); - newSlotTimer = *maxResult; - goto LAB_00662215; - } - } - if ((((((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) == 2) && - (bVar2 = ANM2::IsFinishedImpl(&pEVar15->_sprite,&s_empty), bVar2 != 0)) && - (iVar4 = pEVar15->_variant, iVar4 != 1)) && ((iVar4 != 8 && (iVar4 != 10)))) && - (iVar4 != 0xb)) && (iVar4 != 0x13)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x410)))) = 1; - ANM2::Play(&pEVar15->_sprite,s_Idle,0); - } - ehState = 0xffffffff; - guard_check_icall(); -LAB_00662654: - if (((pEVar15->_variant == 6) || (pEVar15->_variant == 0xf)) && - ((bVar2 = ANM2::IsPlaying(&pEVar15->_sprite,GHIDRA_CAST("PayShuffle")), bVar2 != 0 && - (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&pEVar15->_sprite))))->Sprite::IsEventTriggered("Shuffle"), bVar2 != 0)))) { - fVar18 = random_float(); - local_a0.y = fVar18 * 0.1 + 1.0; - fVar18 = random_float(); - SoundEffects::PlayWithFartOverride(0xfc,fVar18 * 0.1 + 0.5,2,0,local_a0.y); - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x428)))) == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42a)))) = 0; - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42a)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42a)))) + 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x428)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x428)))) + -1; - } - (GHIDRA_CAST((GHIDRA_CAST(pEVar15))))->Entity::Update(); - ANM2::Update(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar15)) + 0x42c))))); - ExceptionList = savedExceptionList; - return; -} - -// 00663aa0 -void Entity_Slot::spawn_break_drops() -{ - Vector targetPos; - Vector targetPos_00; - uint8_t isTrinketHeld; - ColorMod *color; - uint32_t uVar1; - uint32_t uVar2; - Entity *spawnedPedestal; - Entity_Pickup *pedestal; - float randomCount; - RNG *tmpRng; - float fVar3; - Vector *slotPos; - RNG *dropRng; - int iVar4; - uint32_t uVar5; - Vector *velocity; - TypeDescriptor *pTVar6; - TypeDescriptor *pTVar7; - uint32_t subType; - uint32_t uVar8; - Vector keyVelocity; - Vector heartVelocity; - Vector pickupVelocity; - uint8_t local_90 [16]; - RNG velocityRng; - Vector local_70; - Vector local_68; - RNG *trinketOwnerRng; - Vector local_5c; - Vector local_54; - RNG *local_4c; - Color gibColor; - uint32_t dropTrinkets [6]; - Game *game; - - dropTrinkets[5] = __security_cookie ^ GHIDRA_UINT((dropTrinkets + 6)); - trinketOwnerRng = GHIDRA_CAST(0x0); - local_5c.y = (float)this; - PlayerManager::RandomTrinketOwner(&g_game->_playerManager,0x16,this->_initSeed,&trinketOwnerRng); - velocityRng._seed = this->_initSeed; - velocityRng._shift3 = 0x1d; - iVar4 = this->_variant; - velocityRng._shift1 = 1; - velocityRng._shift2 = 9; - if ((iVar4 == 5) || (iVar4 == 0xf)) { - targetPos.y = g_vectorZero.y; - targetPos.x = g_vectorZero.x; - Entity_NPC::ThrowSpider(&this->_pos,GHIDRA_CAST(this),targetPos,0,-30.0); - targetPos_00.y = g_vectorZero.y; - targetPos_00.x = g_vectorZero.x; - Entity_NPC::ThrowSpider(&this->_pos,GHIDRA_CAST(this),targetPos_00,0,-30.0); - } - else if (iVar4 == 0x12) { - slotPos = &this->_pos; - Isaac::GetRandomPickupVelocity(&local_5c,slotPos,1,&velocityRng); - spawn_small_maggot(slotPos,-10.0,&local_5c,-8.0); - Isaac::GetRandomPickupVelocity(&local_5c,slotPos,1,&velocityRng); - spawn_small_maggot(slotPos,-10.0,&local_5c,-8.0); - (GHIDRA_CAST((&gibColor)))->Color::Color(); - local_5c.y = 9.80909e-44; - spawn_gibs(slotPos,5,40.0,GHIDRA_CAST(&local_5c.y),GHIDRA_CAST(0x0),color,&g_vectorZero,1.0); - uVar1 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); - if (uVar1 == 0) { - uVar1 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_5c,slotPos,1,&velocityRng); - Game::Spawn(g_game,5,10,slotPos,&local_5c,GHIDRA_CAST(0x0),0xc,uVar1); - return; - } - } - else if (iVar4 == 10) { - dropRng = &this->_dropRNG; - local_5c.y = (float)dropRng; - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(4); - if (0 < GHIDRA_INT(uVar1)) { - do { - uVar2 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_54,&this->_pos,1,&velocityRng); - Game::Spawn(g_game,5,0x14,&this->_pos,&local_54,GHIDRA_CAST(0x0),0,uVar2); - uVar1 = uVar1 - 1; - dropRng = GHIDRA_CAST(local_5c.y); - } while (uVar1 != 0); - return; - } - } - else if (iVar4 == 2) { - dropRng = &this->_dropRNG; - local_4c = dropRng; - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(2); - local_54.y = (float)(uVar1 + 1); - if (0 < GHIDRA_INT(local_54.y)) { - do { - tmpRng = trinketOwnerRng; - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(2); - if ((uVar1 == 0) || - ((tmpRng != GHIDRA_CAST(0x0) && (uVar1 = (GHIDRA_CAST((tmpRng)))->RNG::RandomInt(5), uVar1 != 0)))) { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(4); - iVar4 = uVar1 + 1; - if (0 < iVar4) { - do { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_68,&this->_pos,1,&velocityRng); - Game::Spawn(g_game,5,0x14,&this->_pos,&local_68,GHIDRA_CAST(0x0),0,uVar1); - iVar4 = iVar4 + -1; - dropRng = local_4c; - } while (iVar4 != 0); - this = GHIDRA_CAST(local_5c.y); - } - } - else { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_70,&this->_pos,1,&velocityRng); - Game::Spawn(g_game,5,10,&this->_pos,&local_70,GHIDRA_CAST(0x0),0,uVar1); - dropRng = local_4c; - } - local_54.y = (float)(GHIDRA_INT(local_54.y) + -1); - } while (local_54.y != 0.0); - return; - } - } - else if (iVar4 == 0xc) { - (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::game_constructor(velocityRng._seed,0x1f); - uVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::RandomInt(100); - game = g_game; - if (uVar1 == 0) { - uVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::Next(); - uVar1 = ItemPool::GetCollectibleFromList - (&game->_itemPool,GHIDRA_CAST(&DAT_00b64be0),10,uVar1,0x1e,1,0); - uVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::Next(); - uVar8 = 0; - pTVar7 = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - pTVar6 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar5 = 0; - spawnedPedestal = - Game::Spawn(g_game,5,100,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),uVar1,uVar2); - pedestal = GHIDRA_CAST(__RTDynamicCast(spawnedPedestal,uVar5,pTVar6,pTVar7,uVar8)); - (GHIDRA_CAST((pedestal)))->Entity_Pickup::SetAlternatePedestal(9); - pedestal->Update(); - this->Remove(); - return; - } - uVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::RandomInt(4); - iVar4 = uVar1 + 1; - if (0 < iVar4) { - do { - uVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_5c,&this->_pos,1,&velocityRng); - Game::Spawn(g_game,5,0x46,&this->_pos,&local_5c,GHIDRA_CAST(0x0),0,uVar1); - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - return; - } - } - else if (iVar4 == 0x13) { - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 1)) != '\0') { - dropRng = &this->_dropRNG; - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(100); - if (0x20 < uVar1) { - slotPos = &this->_pos; - if (uVar1 < 0x42) { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_5c,slotPos,1,&velocityRng); - subType = 3; - } - else { - if (0x5e < uVar1) { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Game::Spawn(g_game,5,100,slotPos,&g_vectorZero,GHIDRA_CAST(0x0),0xb,uVar1); - return; - } - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_5c,slotPos,1,&velocityRng); - subType = 4; - } - uVar2 = 10; - goto LAB_00663f4c; - } - } - } - else { - dropRng = &this->_dropRNG; - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(5); - if (uVar1 == 0) { - slotPos = &this->_pos; - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(2); - if (uVar1 != 0) { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_5c,slotPos,1,&velocityRng); - local_54.x = local_5c.x * 0.4; - local_54.y = local_5c.y * 0.4; - Game::Spawn(g_game,5,0x46,slotPos,&local_54,GHIDRA_CAST(0x0),0,uVar1); - return; - } - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&local_5c,slotPos,1,&velocityRng); - subType = 0; - uVar2 = 0x15e; -LAB_00663f4c: - local_54.x = local_5c.x * 0.4; - local_54.y = local_5c.y * 0.4; - Game::Spawn(g_game,5,uVar2,&this->_pos,&local_54,GHIDRA_CAST(0x0),subType,uVar1); - return; - } - local_54.y = (GHIDRA_CAST((dropRng)))->RNG::RandomFloat(); - if (local_54.y < 0.01) { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Game::Spawn(g_game,5,0x32,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar1); - return; - } - local_54.y = (GHIDRA_CAST((dropRng)))->RNG::RandomFloat(); - if (local_54.y < 0.01) { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Game::Spawn(g_game,5,0x3c,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar1); - return; - } - (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::game_constructor(this->_initSeed,0x1b); - randomCount = (float)(GHIDRA_CAST((dropRng)))->RNG::RandomInt(4); - fVar3 = 2.8026e-45; - if (2 < GHIDRA_INT(randomCount)) { - fVar3 = randomCount; - } - local_68.y = fVar3; - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(3); - if ((uVar1 != 0) && - (isTrinketHeld = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x2a), - isTrinketHeld != 0)) { - local_68.y = (float)(GHIDRA_INT(fVar3) + 1); - } - dropTrinkets[0] = 0x2d; - dropTrinkets[1] = 0x2c; - dropTrinkets[2] = 0x22; - dropTrinkets[3] = 0x29; - dropTrinkets[4] = 0x24; - local_4c = GHIDRA_CAST(0x0); - do { - game = g_game; - uVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_90))))->RNG::Next(); - local_70.y = (float)PlayerManager::RandomTrinketOwner - (&game->_playerManager,dropTrinkets[GHIDRA_INT(local_4c)],uVar1, - GHIDRA_CAST(0x0)); - if (GHIDRA_CAST(local_70.y) != GHIDRA_CAST(0x0)) { - uVar1 = dropTrinkets[GHIDRA_INT(local_4c)]; - isTrinketHeld = (GHIDRA_CAST((GHIDRA_CAST(local_70.y))))->Entity_Player::HasTrinket(uVar1,0); - if ((isTrinketHeld != 0) && - (((uVar1 != 0x22 || - (isTrinketHeld = (GHIDRA_CAST((GHIDRA_CAST(local_70.y))))->Entity_Player::HasTrinket(0x16,0), - isTrinketHeld == 0)) || (uVar2 = Random(), uVar2 % 5 == 0)))) { - iVar4 = PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,uVar1); - local_54.y = 4.62428e-44; - if (iVar4 == 2) { - local_54.y = 9.24857e-44; - } - else if (2 < iVar4) { - local_54.y = 1.4013e-43; - } - tmpRng = (GHIDRA_CAST((GHIDRA_CAST(local_70.y))))->Entity_Player::GetTrinketRNG(uVar1); - fVar3 = (float)(GHIDRA_CAST((tmpRng)))->RNG::RandomInt(100); - if (GHIDRA_UINT(fVar3) < GHIDRA_UINT(local_54.y)) { - local_4c = GHIDRA_CAST(0xa); - switch(uVar1) { - case 0x22: - local_4c = GHIDRA_CAST(0xa); - break; - case 0x24: - local_4c = GHIDRA_CAST(0x1e); - break; - case 0x29: - local_4c = GHIDRA_CAST(0x28); - break; - case 0x2c: - local_4c = GHIDRA_CAST(0x46); - break; - case 0x2d: - local_4c = GHIDRA_CAST(0x12c); - } - slotPos = &this->_pos; - local_54.y = (float)slotPos; - Isaac::GetRandomPickupVelocity(&pickupVelocity,slotPos,1,&velocityRng); - tmpRng = (GHIDRA_CAST((GHIDRA_CAST(local_70.y))))->Entity_Player::GetTrinketRNG(uVar1); - uVar1 = (GHIDRA_CAST((tmpRng)))->RNG::Next(); - Game::Spawn(g_game,5,GHIDRA_UINT(local_4c),slotPos,&pickupVelocity,GHIDRA_CAST(0x0),0,uVar1); - goto LAB_00664266; - } - } - } - local_4c = GHIDRA_CAST((GHIDRA_INT(local_4c) + 1)); - } while (local_4c < 5); - local_54.y = (float)&this->_pos; -LAB_00664266: - slotPos = &this->_pos; - local_4c = GHIDRA_CAST(0x0); - if (0 < GHIDRA_INT(local_68.y)) { - tmpRng = trinketOwnerRng; - do { - (GHIDRA_CAST((dropRng)))->RNG::Next(); - local_70.y = (float)((double)dropRng->_seed + - __uint_to_double_fixup[-(dropRng->_seed >> 0x1f)]) * 2.3283062e-10; - if (0.35 <= local_70.y) { - if ((0.55 <= local_70.y) || - ((tmpRng != GHIDRA_CAST(0x0) && (uVar1 = (GHIDRA_CAST((tmpRng)))->RNG::RandomInt(5), uVar1 != 0)))) { - if (0.7 <= local_70.y) { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(GHIDRA_CAST((local_90 + 8)),slotPos,1,&velocityRng); - velocity = GHIDRA_CAST((local_90 + 8)); - uVar2 = 0x28; - } - else { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&keyVelocity,slotPos,1,&velocityRng); - velocity = &keyVelocity; - uVar2 = 0x1e; - } - Game::Spawn(g_game,5,uVar2,slotPos,velocity,GHIDRA_CAST(0x0),0,uVar1); - } - else { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&heartVelocity,slotPos,1,&velocityRng); - Game::Spawn(g_game,5,10,slotPos,&heartVelocity,GHIDRA_CAST(0x0),0,uVar1); - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(2); - if (uVar1 == 0) { - local_68.y = (float)(GHIDRA_INT(local_68.y) - 1); - } - } -LAB_00664483: - tmpRng = trinketOwnerRng; - } - else { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(3); - iVar4 = uVar1 + 1; - if (0 < iVar4) { - local_70.y = (float)(GHIDRA_INT(local_5c.y) + 0x33c); - do { - uVar1 = (GHIDRA_CAST((dropRng)))->RNG::Next(); - Isaac::GetRandomPickupVelocity(&pickupVelocity,GHIDRA_CAST(local_70.y),1,&velocityRng); - Game::Spawn(g_game,5,0x14,GHIDRA_CAST(local_70.y),&pickupVelocity,GHIDRA_CAST(0x0),0,uVar1); - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - slotPos = GHIDRA_CAST(local_54.y); - goto LAB_00664483; - } - slotPos = GHIDRA_CAST(local_54.y); - } - local_4c = GHIDRA_CAST((GHIDRA_INT(local_4c) + 1)); - if (GHIDRA_INT(local_68.y) <= GHIDRA_INT(local_4c)) { - return; - } - } while( true ); - } - } - return; -} - -// 00665370 -void Entity_Slot::Render(Vector *offset) -{ - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); - if ((((this->_variant == 6) || (this->_variant == 0xf)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x460)))) != 0)) && - ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x470))) != '\0')) { - ANM2::Render(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x42c)))),&this->_renderPosition,&g_vectorZero,&g_vectorZero); - } - return; -} - -// 00665500 -void Entity_Slot::SetPrizeType(int prizeType) -{ - uint32_t forcedCurses; - uint32_t preventedCurses; - uint32_t curses; - uint32_t debugCurses; - uint8_t isCurseOfBlind; - - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x540)))) = prizeType; - if (this->_variant == 0xf) { - debugCurses = g_game->_debugCurses; - curses = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - isCurseOfBlind = - (uint8_t)(~preventedCurses >> 6) & (uint8_t)((forcedCurses | debugCurses | curses) >> 6) & 1; - Entity_Pickup::load_collectible_gfx - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x42c)))),7,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x540)))),(this->_dropRNG)._seed, - isCurseOfBlind); - ANM2::LoadGraphics(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x42c)))),isCurseOfBlind); - return; - } - if (this->_variant == 0x10) { - debugCurses = g_game->_debugCurses; - curses = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - isCurseOfBlind = - (uint8_t)(~preventedCurses >> 6) & (uint8_t)((forcedCurses | debugCurses | curses) >> 6) & 1; - Entity_Pickup::load_collectible_gfx - (&this->_sprite,2,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x540)))),(this->_dropRNG)._seed,isCurseOfBlind); - ANM2::LoadGraphics(&this->_sprite,isCurseOfBlind); - } - return; -} diff --git a/generated-src/entity_tear.cpp b/generated-src/entity_tear.cpp deleted file mode 100644 index 3d37b6e..0000000 --- a/generated-src/entity_tear.cpp +++ /dev/null @@ -1,9656 +0,0 @@ -#include "classes.h" - -// 004177c0 -BitSet128 * Entity_Tear::TearFlags(BitSet128 *outFlags) -{ - uint32_t uVar1; - uint32_t uVar2; - uint64_t qVar3; - - uVar1 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - qVar3 = (this->_tearFlags)._h; - uVar2 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - *GHIDRA_CAST(&outFlags->_l) = GHIDRA_INT((this->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)) = uVar1; - *GHIDRA_CAST(&outFlags->_h) = GHIDRA_INT(qVar3); - *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)) = uVar2; - return outFlags; -} - -// 00431750 -long double Entity_Tear::Height() -{ - return (long double)this->_height; -} - -// 00435e50 -long double Entity_Tear::FallingAcceleration() -{ - return (long double)this->_fallingAccel; -} - -// 00456440 -long double Entity_Tear::FallingSpeed() -{ - return (long double)this->_fallingSpeed; -} - -// 004aade0 -int Entity_Tear::TearIndex() -{ - return this->_tearIdx; -} - -// 00557cd0 -long double Entity_Tear::Scale() -{ - return (long double)this->_fScale; -} - -// 0060ccb0 -long double Entity_Tear::BaseScale() -{ - return (long double)this->_baseScale; -} - -// 0060ccc0 -long double Entity_Tear::Rotation() -{ - return (long double)this->_rotation; -} - -// 0060ccd0 -void Entity_Tear::SetKnockbackMultiplier(float param_2) -{ - this->_knockbackMultiplier = param_2; - return; -} - -// 0060cd00 -void Entity_Tear::SetWaitFrames(int param_2) -{ - this->_waitFrames = param_2; - return; -} - -// 00665b00 -Entity_Player * Entity_Tear::GetRootPlayer() -{ - Entity_Player *nextSpawner; - Entity_Player *spawner; - - nextSpawner = GHIDRA_CAST(this->_spawnerEntity); - while (spawner = nextSpawner, spawner != GHIDRA_CAST(0x0)) { - this = GHIDRA_CAST(spawner); - nextSpawner = GHIDRA_CAST(spawner->_spawnerEntity); - } - if ((GHIDRA_CAST(this))->_type != 1) { - this = GHIDRA_CAST(0x0); - } - return GHIDRA_CAST(this); -} - -// 00665cf0 -void Entity_Tear::Constructor() -{ - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af776d; - local_10 = ExceptionList; - ExceptionList = &local_10; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); - *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Tear::vftable; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - (this->_continueVelocity).y = 0.0; - (this->_continueVelocity).x = 0.0; - (this->_hitList)._begin = (void *)0x0; - (this->_hitList)._end = (void *)0x0; - (this->_hitList)._capacity = (void *)0x0; - (this->_stickDiff).y = 0.0; - (this->_stickDiff).x = 0.0; - this->_linkPrev = 0; - this->_linkNext = 0; - this->_attachedEffect = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a4)))) = 0; - local_8 = 6; - ANM2::constructor(&this->_tearHaloANM2); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 7; - ANM2::constructor(&this->_tearEffectANM2); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),8); - ANM2::constructor(&this->_deadEyeANM2); - (this->_posDisplacement).y = 0.0; - (this->_posDisplacement).x = 0.0; - (this->_parentOffset).y = 0.0; - (this->_parentOffset).x = 0.0; - (this->_holdOffset).y = 0.0; - (this->_holdOffset).x = 0.0; - (this->_holdVelocity).y = 0.0; - (this->_holdVelocity).x = 0.0; - (this->_orbitVelocity).y = 0.0; - (this->_orbitVelocity).x = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x828)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x82c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x830)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x834)))) = 0; - ExceptionList = local_10; - return; -} - -// 006660a0 -void Entity_Tear::Init(int type, int variant, int subType, uint32_t initSeed) -{ - uint32_t uVar1; - LayerState *layer; - int iVar2; - char *pcVar3; - float heightOffsetY; - int *local_48; - std_string bulletAnm2Path; - std_string local_2c; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Game *game; - uint8_t *layerIndex; - uint32_t *linkPrevSlot; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af77c5; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT(&(&local_2c)[1]._size); - ExceptionList = &local_10; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Init(type,variant,subType,initSeed); - if (this->_config != (void *)0x0) { - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); - } - this->_entityGridCollisionClass = 4; - this->_collisionDamage = 3.5; - this->_baseDamage = 3.5; - uVar1 = Random(); - this->_fallingAccel = 0.0; - this->_height = -23.0; - this->_fallingSpeed = - ((float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * 2.3283064e-10 - - 0.5) * 0.2; - heightOffsetY = get_height_offset_y(this,-23.0); - game = g_game; - (this->_posOffset).y = heightOffsetY; - if (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) { - (this->_posOffset).y = -18.0; - } - this->_homingFriction = 0.85; - linkPrevSlot = &this->_linkPrev; - this->_fScale = 1.0; - this->_baseScale = 1.0; - this->_rotation = 0.0; - this->_scaleAnimNum = -1; - this->_knockbackMultiplier = 1.7; - this->_maxHitPoints = 0.0; - *GHIDRA_CAST(&(this->_tearFlags)._l) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0; - *GHIDRA_CAST(&(this->_tearFlags)._h) = 0; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0; - this->_waitFrames = 0; - (this->_continueVelocity).x = g_vectorZero.x; - (this->_continueVelocity).y = g_vectorZero.y; - (this->_hitList)._end = (this->_hitList)._begin; - (this->_posDisplacement).x = g_vectorZero.x; - (this->_posDisplacement).y = g_vectorZero.y; - (this->_parentOffset).x = g_vectorZero.x; - (this->_parentOffset).y = g_vectorZero.y; - this->_stickTarget = (void *)0x0; - (this->_stickDiff).x = g_vectorZero.x; - (this->_stickDiff).y = g_vectorZero.y; - this->_techZeroLaser = 0; - this->_techZeroTarget = 0; - this->_laserShotLaser = 0; - if (*linkPrevSlot != 0) { - local_48 = linkPrevSlot; - msvc::multiset::erase(&local_48); - *linkPrevSlot = 0; - } - if (this->_linkNext != 0) { - local_48 = &this->_linkNext; - msvc::multiset::erase(&local_48); - this->_linkNext = 0; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a8)))) = 0; - this->_deadEyeIntensity = 0.0; - this->_multidimensionalTouched = 0; - this->_prismTouched = 0; - this->_isFireSoundPending = 1; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x46b))) = 0; - this->_canTriggerStreakEnd = 1; - this->_isHovering = 0; - this->_isFireSoundMuted = 0; - (this->_holdOffset).x = g_vectorZero.x; - (this->_holdOffset).y = g_vectorZero.y; - this->_holdTimer = 0; - *GHIDRA_CAST(&this->_popBounceCount) = 0; - this->_hitCount = 0; - this->_deathFlags = 0; - uVar1 = g_graphicsManager_flags; - if (this->_variant == 0x25) { - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - iVar2 = 1; - if ((uVar1 & 4) == 0) { - iVar2 = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = iVar2; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - } - this->_orbitAngle = 0.0; - this->_orbitRadius = 0.0; - (this->_orbitVelocity).x = g_vectorZero.x; - (this->_orbitVelocity).y = g_vectorZero.y; - this->_tearRange = 260.0; - this->_tearIdx = -1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x828)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x82c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x830)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x834)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x838)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x83c)))) = 0x1e; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x840)))) = 0x3c75c28f; - game = g_game; - if (this->_variant == 0xd) { - local_48 = GHIDRA_CAST(&DAT_0000004f); - msvc::set::find_node(local_2c._buf + 0xc,&local_48); - if (((*GHIDRA_CAST((local_2c._capacity + 0xd)) != '\0') || - (0x4f < *GHIDRA_CAST((local_2c._capacity + 0x10)))) || - ((void *)local_2c._capacity == (game->_seedEffects)._seedEffects)) goto LAB_0066669b; - bulletAnm2Path._size = 0; - bulletAnm2Path._capacity = 0xf; - bulletAnm2Path._buf[0] = '\0'; - bulletAnm2Path._buf[1] = '\0'; - bulletAnm2Path._buf[2] = '\0'; - bulletAnm2Path._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(bulletAnm2Path._buf)) + 0x0))) = msvc::_Allocate(0x30); - bulletAnm2Path._size = 0x20; - bulletAnm2Path._capacity = 0x2f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(bulletAnm2Path._buf))) + 0x0))),"gfx/promo/gfuel/bullet tear.anm2",0x21); - local_8 = 0; - ANM2::Load(&this->_sprite,&bulletAnm2Path,1); - local_8 = 0xffffffff; - if (0xf < bulletAnm2Path._capacity) { - uVar1 = bulletAnm2Path._capacity + 1; - pcVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(bulletAnm2Path._buf))) + 0x0))); - if (0xfff < uVar1) { - pcVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(bulletAnm2Path._buf)) + 0x0))) + -4)); - uVar1 = bulletAnm2Path._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(bulletAnm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar3))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar3,uVar1); - } - layerIndex = GHIDRA_CAST(0x0); - } - else { - if (this->_variant != 0x17) goto LAB_0066669b; - local_48 = GHIDRA_CAST(&DAT_0000004f); - msvc::set::find_node(local_2c._buf + 0xc,&local_48); - if (((*GHIDRA_CAST((local_2c._capacity + 0xd)) != '\0') || - (0x4f < *GHIDRA_CAST((local_2c._capacity + 0x10)))) || - ((void *)local_2c._capacity == (game->_seedEffects)._seedEffects)) goto LAB_0066669b; - local_2c._size = 0; - local_2c._capacity = 0xf; - local_2c._buf[0] = '\0'; - local_2c._buf[1] = '\0'; - local_2c._buf[2] = '\0'; - local_2c._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c._buf)) + 0x0))) = msvc::_Allocate(0x20); - local_2c._size = 0x1c; - local_2c._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c._buf))) + 0x0))),"gfx/promo/gfuel/missile.anm2",0x1d); - local_8 = 1; - ANM2::Load(&this->_sprite,&local_2c,1); - local_8 = 0xffffffff; - if (0xf < local_2c._capacity) { - uVar1 = local_2c._capacity + 1; - pcVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_2c._buf))) + 0x0))); - if (0xfff < uVar1) { - pcVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c._buf)) + 0x0))) + -4)); - uVar1 = local_2c._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar3))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar3,uVar1); - } - local_2c._size = 0; - local_2c._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c._buf)) + 0x0))) & 0xffffff00; - layerIndex = GHIDRA_CAST(0x1); - } - uVar1 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&this->_sprite,layerIndex); - iVar2 = 1; - if ((uVar1 & 4) == 0) { - iVar2 = 6; - } - layer->_blendMode[4] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[2] = 1; - layer->_blendMode[1] = iVar2; - layer->_blendMode[0] = 0; -LAB_0066669b: - FUN_008629c0(this); - ExceptionList = local_10; - return; -} - -// 006666c0 -void Entity_Tear::ClearReferences() -{ - int *piVar1; - Entity_Tear *apEStack_c [2]; - int childType; - uint32_t *laserShotSlot; - uint32_t *refSlot; - - refSlot = &this->_techZeroLaser; - apEStack_c[0] = this; - if (GHIDRA_CAST(this->_techZeroLaser) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_techZeroLaser) + 0x28))(); - } - laserShotSlot = &this->_laserShotLaser; - if (GHIDRA_CAST(this->_laserShotLaser) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_laserShotLaser) + 0x28))(); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); - ANM2::Reset(&this->_tearHaloANM2); - ANM2::Reset(&this->_tearEffectANM2); - ANM2::Reset(&this->_deadEyeANM2); - if (this->_stickTarget != (void *)0x0) { - apEStack_c[0] = GHIDRA_CAST(&this->_stickTarget); - msvc::multiset::erase(apEStack_c); - } - this->_stickTarget = (void *)0x0; - if (*refSlot != 0) { - apEStack_c[0] = GHIDRA_CAST(refSlot); - msvc::multiset::erase(apEStack_c); - } - *refSlot = 0; - refSlot = &this->_techZeroTarget; - if (*refSlot != 0) { - apEStack_c[0] = GHIDRA_CAST(refSlot); - msvc::multiset::erase(apEStack_c); - } - *refSlot = 0; - if (*laserShotSlot != 0) { - apEStack_c[0] = GHIDRA_CAST(laserShotSlot); - msvc::multiset::erase(apEStack_c); - } - *laserShotSlot = 0; - refSlot = &this->_linkPrev; - if (*refSlot != 0) { - childType = this->_linkNext; - if (childType != 0) { - if (*GHIDRA_CAST((*refSlot + 0x28)) == 2) { - FUN_0067dac0(&this->_linkNext); - childType = this->_linkNext; - } - if (*GHIDRA_CAST((childType + 0x28)) == 2) { - FUN_0067dac0(refSlot); - } - } - } - if (*refSlot != 0) { - apEStack_c[0] = GHIDRA_CAST(refSlot); - msvc::multiset::erase(apEStack_c); - *refSlot = 0; - } - if (this->_linkNext != 0) { - apEStack_c[0] = GHIDRA_CAST(&this->_linkNext); - msvc::multiset::erase(apEStack_c); - this->_linkNext = 0; - } - if (GHIDRA_CAST(this->_attachedEffect) != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(this->_attachedEffect) + 0x28))(); - } - if ((((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagLudovico._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagLudovico._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4)))) != 0)) && - (piVar1 = GHIDRA_CAST(this->_child), piVar1 != GHIDRA_CAST(0x0))) { - childType = piVar1[10]; - while (childType == 2) { - (**(code **)(*piVar1 + 0x28))(); - piVar1 = GHIDRA_CAST(piVar1[0xf0]); - if (piVar1 == GHIDRA_CAST(0x0)) { - return; - } - childType = piVar1[10]; - } - } - return; -} - -// 006668c0 -void Entity_Tear::apply_wiggle(float strength) -{ - float fVar1; - float fVar2; - Vector wiggleDir; - - wiggleDir.x = (this->_velocity).y; - wiggleDir.y = -(this->_velocity).x; - fVar2 = wiggleDir.x * wiggleDir.x; - fVar1 = sqrtf(wiggleDir.y * wiggleDir.y + fVar2); - if (0.0 < fVar1) { - wiggleDir.x = (1.0 / fVar1) * wiggleDir.x; - wiggleDir.y = wiggleDir.y * (1.0 / fVar1); - } - fVar1 = (this->_velocity).x; - fVar1 = sqrtf(fVar1 * fVar1 + fVar2); - fVar1 = fVar1 * 0.5; - if (5.0 <= fVar1) { - fVar1 = 5.0; - } - if ((this->_tearIdx & 1) == 0) { - fVar2 = 0.0; - } - else { - fVar2 = 3.1415927; - } - fVar2 = cos(((float)(g_game->_frameCount - this->_spawnFrame) + 0.5) * 0.7 + fVar2); - fVar2 = fVar2 * fVar1 * strength; - (this->_pos).x = wiggleDir.x * fVar2 + (this->_pos).x; - (this->_pos).y = wiggleDir.y * fVar2 + (this->_pos).y; - return; -} - -// 00666ba0 -void Entity_Tear::update_wiggle() -{ - uint32_t frameParity; - float cosPhase; - float speed; - float in_XMM1_Da; - float dirX; - float fVar1; - float dirY; - - frameParity = g_manager->_framecount & 0x80000001; - if (GHIDRA_INT(frameParity) < 0) { - frameParity = (frameParity - 1 | 0xfffffffe) + 1; - } - dirY = (this->_velocity).y; - fVar1 = (float)(g_game->_frameCount - this->_spawnFrame) + (float)GHIDRA_INT(frameParity) * 0.5; - dirX = (this->_velocity).x; - if (ABS(dirX) <= ABS(dirY)) { - fVar1 = fVar1 * 0.2; - } - else { - fVar1 = -fVar1 * 0.2 + 1.5707964; - } - cosPhase = cos(fVar1); - fVar1 = sin(fVar1); - speed = sqrtf(dirX * dirX + dirY * dirY); - if (0.0 < speed) { - dirX = dirX * (1.0 / speed); - dirY = dirY * (1.0 / speed); - } - (this->_pos).x = cosPhase * dirY * 15.0 * in_XMM1_Da + cosPhase * dirX * 15.0 + (this->_pos).x; - (this->_pos).y = -dirX * fVar1 * 15.0 * in_XMM1_Da + fVar1 * dirY * 15.0 + (this->_pos).y; - return; -} - -// 00666d40 -void Entity_Tear::play_fire_sound() -{ - int iVar1; - uint8_t isSeedEffectActive; - uint32_t tearFlagsWord2; - Manager *manager; - float fVar2; - int soundId; - uint32_t local_10; - float dirY; - - iVar1 = this->_variant; - this->_isFireSoundPending = 0; - manager = g_manager; - if ((((iVar1 != 9) && (iVar1 != 0x2e)) && (this->_isFireSoundMuted == 0)) && (iVar1 != 0x28)) { - if (iVar1 == 0x32) { - soundId = 0xed; - seed_fart_sound_override(&soundId); - fVar2 = 1.2; - } - else { - if (((iVar1 == 0xd) || (iVar1 == 0x17)) && - (isSeedEffectActive = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f), - isSeedEffectActive != 0)) goto LAB_00666e14; - manager = g_manager; - soundId = 0x99; - seed_fart_sound_override(&soundId); - fVar2 = 1.0; - } - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,fVar2,0.0); - } -LAB_00666e14: - manager = g_manager; - local_10 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHorn._h)) + 0x4))); - tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h); - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagHorn._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHorn._l)) + 0x4)))) != 0) || - ((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagHorn._h)) != 0 || local_10 != 0)) { - soundId = 0x364; - seed_fart_sound_override(&soundId); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); - tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h); - } - local_10 = GHIDRA_UINT((this->_tearFlags)._l); - if (((local_10 & GHIDRA_UINT(g_tearFlagOrbit._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._l)) + 0x4)))) != 0) || - ((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagOrbit._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOrbit._h)) + 0x4)))) != 0)) { - if (this->_fallingSpeed < 0.0) { - this->_fallingSpeed = this->_fallingSpeed * 3.0; - } - this->_isHovering = 1; - } - tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h); - if (((local_10 & GHIDRA_UINT(g_tearFlagHydrobounce._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._l)) + 0x4)))) == 0) && - ((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagHydrobounce._h)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._h)) + 0x4)))) == 0)) { - if (((local_10 & GHIDRA_UINT(g_tearFlagBoomerang._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBoomerang._l)) + 0x4)))) != 0) || - ((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagBoomerang._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBoomerang._h)) + 0x4)))) != 0)) { - this->_fallingSpeed = this->_fallingSpeed * 0.5; - this->_fallingAccel = (this->_fallingAccel + 0.08) * 0.25 - 0.08; - } - } - else { - this->_isHovering = 0; - this->_fallingSpeed = this->_fallingSpeed - 15.0; - this->_fallingAccel = this->_fallingAccel + 3.0; - } - if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { - (this->_pos).y = (this->_pos).y - 4.0; - if ((0.0 < this->_fallingAccel) && - (fVar2 = (this->_velocity).y, fVar2 < ABS((this->_velocity).x))) { - (this->_velocity).y = this->_fallingSpeed * 0.5 + fVar2; - } - fVar2 = (this->_velocity).x; - if (ABS((this->_velocity).y) < ABS(fVar2)) { - dirY = (this->_velocity).y; - fVar2 = sqrtf(dirY * dirY + fVar2 * fVar2); - if (0.0 < fVar2) { - dirY = (this->_velocity).y * (1.0 / fVar2); - } - if ((0.0 < dirY) && (dirY < 0.05)) { - (this->_velocity).y = 0.0; - } - } - } - return; -} - -// 006670f0 -void Entity_Tear::Update() -{ - code *pcVar1; - void *pvVar2; - BitSet128 flags; - BitSet128 flags_00; - BitSet128 flags_01; - BitSet128 flags_02; - BitSet128 tearFlags; - BitSet128 flags_03; - Vector pos; - uint64_t qVar3; - uint8_t bVar4; - char cVar5; - BitSet128 *pBVar6; - int iVar7; - BitSet128 *pBVar8; - TemporaryEffects *playerEffects; - Room *room; - Seeds *seeds; - Entity_Familiar *familiar; - Vector *pVVar9; - uint32_t uVar10; - Entity *pEVar11; - EntityList *entityList; - int *piVar12; - uint32_t *puVar13; - Vector *pVVar14; - Entity_Laser *laser; - float *pfVar15; - void **ppvVar16; - Entity_Player *pEVar17; - uint32_t uVar18; - Entity_Knife *knife; - char *_Str1; - AnimationState *animState; - Color *playerEffects; - uint8_t *puVar19; - void *pvVar20; - LayerState *layer; - uint8_t *layerCount; - Entity_Effect *effect; - Sprite *sprite; - int tintedRockIdx; - PersistentGameData *persistentGameData; - GridEntity *gridEntity; - std_string *psVar21; - PlayerManager *playerManager; - RNG *laser; - TearParams *other; - TearParams *extraout_EAX; - Entity_Tear *spawnedTear; - Font *effect; - ANM2 *pAVar22; - uint8_t *puVar23; - uint8_t *layerIndex; - void *pvVar24; - Vector *pVVar25; - bool bVar26; - long double fVar27; - Room *pRVar28; - Room *pRVar29; - Entity_Projectile *pEVar30; - uint8_t extraout_var [12]; - uint8_t auVar31 [16]; - uint8_t extraout_var_00 [12]; - uint8_t extraout_var_01 [12]; - uint8_t extraout_var_02 [12]; - uint8_t extraout_var_03 [12]; - uint8_t extraout_var_04 [12]; - uint8_t extraout_var_05 [12]; - uint8_t extraout_var_06 [12]; - uint8_t extraout_var_07 [12]; - uint8_t extraout_var_08 [12]; - uint8_t extraout_var_09 [12]; - uint8_t extraout_var_10 [12]; - uint8_t auVar33 [12]; - uint8_t extraout_var_11 [12]; - uint8_t auVar32 [16]; - uint8_t extraout_var_12 [12]; - uint8_t extraout_var_13 [12]; - uint8_t extraout_var_14 [12]; - uint8_t extraout_var_15 [12]; - uint8_t extraout_var_16 [12]; - uint8_t extraout_var_17 [12]; - uint8_t extraout_var_18 [12]; - uint8_t extraout_var_19 [12]; - uint8_t extraout_var_20 [12]; - uint8_t extraout_var_21 [12]; - uint8_t extraout_var_22 [12]; - uint8_t extraout_var_23 [12]; - uint8_t extraout_var_24 [12]; - uint8_t extraout_var_25 [12]; - uint8_t extraout_var_26 [12]; - uint8_t extraout_var_27 [12]; - Color aCStackY_3c4c [128]; - BitSet128 *pBVar34; - BitSet128 *pBVar35; - int variant; - Vector *in_stack_ffffd9fc; - float fVar36; - TypeDescriptor *outResult; - uint8_t uVar37; - uint8_t uVar38; - uint16_t uVar39; - size_t _MaxCount; - uint32_t uVar40; - EntityRef local_25e8; - EntityRef local_25c0; - EntityRef local_2598; - EntityRef local_2570; - BitSet128 notBounce; - BitSet128 notSplit; - BitSet128 notLudovico; - BitSet128 notBone; - BitSet128 notAbsorb; - BitSet128 notHydrobounce; - BitSet128 notFetus; - BitSet128 hydrobounceMask3; - BitSet128 quadsplitMask; - BitSet128 lasershotMask2; - BitSet128 poisonMask; - BitSet128 ludovicoMask6; - BitSet128 explosiveMask4; - BitSet128 andResult2; - BitSet128 orResult4; - BitSet128 withQuadsplit; - BitSet128 ludovicoMask5; - BitSet128 hydrobounceMask2; - BitSet128 hydrobounceMask; - BitSet128 ludovicoMask4; - BitSet128 notLasershot2; - BitSet128 explosiveMask3; - BitSet128 andResult; - BitSet128 tearFlagsCopy; - BitSet128 notResult; - BitSet128 orResult3; - BitSet128 orResult2; - BitSet128 orResult; - BitSet128 withOrbit; - BitSet128 lasershotMask; - BitSet128 notLaser; - BitSet128 laserMask; - BitSet128 explosiveMask2; - BitSet128 bit76Mask; - BitSet128 explosiveMask; - BitSet128 ludovicoMask3; - BitSet128 mysteriousLiquidCreepMask; - BitSet128 notWait; - BitSet128 waitMask; - BitSet128 notLasershot; - BitSet128 ludovicoMask2; - BitSet128 notDetonate; - BitSet128 detonateMask; - BitSet128 ludovicoMask25; - BitSet128 tractorBeamMask3; - BitSet128 ludovicoMask24; - BitSet128 continuumMask2; - BitSet128 explosiveMask6; - BitSet128 fetusMask5; - BitSet128 fetusMask4; - BitSet128 popMask2; - BitSet128 chainMask2; - BitSet128 ludovicoMask23; - BitSet128 bit125Mask2; - BitSet128 andResult33; - BitSet128 notBit126; - BitSet128 andResult32; - BitSet128 andResult31; - BitSet128 bit126Mask; - BitSet128 continuumMask; - BitSet128 ludovicoMask22; - BitSet128 boogerMask3; - BitSet128 orResult14; - BitSet128 withSpectral; - BitSet128 andResult30; - BitSet128 andResult29; - BitSet128 andResult28; - BitSet128 andResult27; - BitSet128 andResult26; - BitSet128 notQuadsplit2; - BitSet128 notSplit2; - BitSet128 notLudovico2; - BitSet128 notBone2; - BitSet128 notAbsorb3; - BitSet128 notHydrobounce2; - BitSet128 sporeMask4; - BitSet128 stickyMask4; - BitSet128 sporeMask3; - BitSet128 boogerMask2; - BitSet128 stickyMask3; - BitSet128 homingMask5; - BitSet128 notTurnHorizontal; - BitSet128 turnHorizontalMask2; - BitSet128 bit125Mask; - BitSet128 bit127Mask; - BitSet128 flatMask3; - BitSet128 ludovicoMask21; - BitSet128 andResult25; - BitSet128 notExplosive2; - BitSet128 occultMask2; - BitSet128 shrinkMask2; - BitSet128 growMask2; - BitSet128 orResult13; - BitSet128 andResult24; - BitSet128 notBounce2; - BitSet128 flatMask2; - BitSet128 ludovicoMask20; - BitSet128 withShrink3; - BitSet128 notTractorBeam; - BitSet128 spectralMask3; - BitSet128 sporeMask2; - BitSet128 boogerMask; - BitSet128 stickyMask2; - BitSet128 spectralMask2; - BitSet128 ludovicoMask19; - BitSet128 notRerollRockWisp; - BitSet128 rerollRockWispMask; - BitSet128 ludovicoMask18; - BitSet128 andResult23; - BitSet128 withBounceWallsonly; - BitSet128 hydrobounceMask6; - BitSet128 ludovicoMask17; - BitSet128 hydrobounceMask7; - BitSet128 ludovicoMask16; - BitSet128 popMask; - BitSet128 boomerangMask6; - BitSet128 ludovicoMask15; - BitSet128 tractorBeamMask2; - BitSet128 notChain; - BitSet128 chainMask; - BitSet128 andResult22; - BitSet128 tearFlagsCopy5; - BitSet128 andResult21; - BitSet128 tearFlagsCopy4; - BitSet128 notAbsorb2; - BitSet128 hydrobounceMask5; - BitSet128 notResult9; - BitSet128 orResult12; - BitSet128 orResult11; - BitSet128 orResult10; - BitSet128 withQuadsplit2; - BitSet128 quadsplitMask2; - BitSet128 splitMask; - BitSet128 andResult20; - BitSet128 withOrbitAdvanced2; - BitSet128 ludovicoMask14; - BitSet128 absorbMask; - BitSet128 andResult19; - BitSet128 orResult9; - BitSet128 withLudovico2; - BitSet128 accelerateMask; - BitSet128 andResult18; - BitSet128 orResult8; - BitSet128 withLudovico; - BitSet128 decelerateMask; - BitSet128 glowMask; - BitSet128 hydrobounceMask4; - BitSet128 ludovicoMask13; - BitSet128 boomerangMask5; - BitSet128 flatMask; - BitSet128 sporeMask; - BitSet128 stickyMask; - BitSet128 ludovicoMask12; - BitSet128 pulseMask; - BitSet128 attractorMask2; - BitSet128 bigSpiralMask; - BitSet128 spiralMask; - BitSet128 wiggleMask; - BitSet128 andResult17; - BitSet128 orResult7; - BitSet128 withOrbit2; - BitSet128 boomerangMask4; - BitSet128 ludovicoMask11; - BitSet128 spectralMask; - BitSet128 fetusMask3; - BitSet128 ludovicoMask10; - BitSet128 shrinkMask; - BitSet128 ludovicoMask9; - BitSet128 growMask; - BitSet128 homingMask4; - BitSet128 boomerangMask3; - BitSet128 boomerangMask2; - BitSet128 fetusMask2; - BitSet128 ludovicoMask8; - BitSet128 occultMask; - BitSet128 homingMask2; - BitSet128 turnHorizontalMask; - BitSet128 homingMask; - BitSet128 homingMask3; - BitSet128 andResult16; - BitSet128 tearFlagsCopy3; - BitSet128 notResult8; - BitSet128 withAbsorb; - BitSet128 andResult15; - BitSet128 tearFlagsCopy2; - BitSet128 notResult7; - BitSet128 orResult6; - BitSet128 withBooger; - BitSet128 andResult14; - BitSet128 notResult6; - BitSet128 withShrink5; - BitSet128 fetusTechMask2; - BitSet128 andResult11; - BitSet128 notResult3; - BitSet128 withShrink2; - BitSet128 fetusBoneMask; - BitSet128 andResult12; - BitSet128 notResult4; - BitSet128 ludovicoMask; - BitSet128 fetusKnifeMask; - BitSet128 andResult13; - BitSet128 notResult5; - BitSet128 withShrink4; - BitSet128 fetusTechMask; - BitSet128 fetusSwordMask; - BitSet128 notFetusTechx; - BitSet128 andResult10; - BitSet128 notResult2; - BitSet128 orResult5; - BitSet128 withShrink; - BitSet128 fetusTechxMask; - BitSet128 fetusMask; - BitSet128 explosiveMask5; - BitSet128 boomerangMask; - BitSet128 orbitAdvancedMask; - BitSet128 tractorBeamMask; - BitSet128 ludovicoMask7; - BitSet128 andResult9; - BitSet128 withOrbitAdvanced; - BitSet128 squareMask; - BitSet128 attractorMask; - BitSet128 laserMask2; - BitSet128 burstsplitMask; - BitSet128 notExplosive; - BitSet128 andResult8; - BitSet128 andResult7; - BitSet128 andResult6; - BitSet128 andResult5; - BitSet128 andResult4; - BitSet128 andResult3; - BitSet128 notQuadsplit; - Vector local_16d8; - Vector local_16d0; - Vector local_16c8; - Vector local_16c0; - Vector nextPos3; - Vector entityVel; - Vector local_16a8 [2]; - Vector nextPos4; - Vector local_1690; - Vector local_1688; - Vector local_1680; - Vector entityPos5; - Vector local_1670; - Vector velPerpRight; - Vector VStack_1660; - Vector velPerpRight3; - Vector VStack_1650; - Vector velPerpRight2; - Vector VStack_1640; - Vector velPerpLeft2; - Vector VStack_1630; - Vector velPerpLeft; - Vector uniformScale4; - Vector local_1618; - Vector local_1610; - Vector randomDir; - Vector local_1600; - Vector local_15f8; - Vector local_15f0; - Vector local_15e8; - Vector uniformScale3; - Vector local_15d8; - Vector negated; - Vector local_15c8; - Vector local_15c0; - Vector local_15b8; - Vector VStack_15b0; - Vector VStack_15a8; - Vector VStack_15a0; - Vector local_1598; - Vector local_1590; - Vector local_1588; - uint32_t local_1580; - uint32_t uStack_157c; - uint32_t uStack_1578; - uint32_t uStack_1574; - BitSet128 bit126Flags; - BitSet128 bit125Flags; - Vector local_1550; - BitSet128 inheritedFlags; - Vector local_1538; - Vector nextPos2; - Vector local_1528; - Vector entityPos3; - Vector local_1518; - Vector local_1510; - Vector nextPos; - Vector local_1500; - Vector entityPos2; - Vector entityPos; - Vector local_14e8; - Vector uniformScale2; - Vector clampedPos2; - Vector local_14d0; - Vector uniformScale; - Vector clampedPos; - Vector local_14b8; - Vector entityPos25; - Vector parentPos10; - Vector local_14a0; - Vector clampedPos3; - Vector local_1490; - Vector local_1488; - Vector direction15; - Vector local_1478 [2]; - Vector entityPos24; - Vector local_1460; - Vector local_1458; - Vector local_1450; - Vector stickTargetPos; - Vector stickTargetVel; - Vector local_1438; - Vector perpDir2; - Vector local_1428; - Vector local_1420; - Vector targetPos6; - Vector local_1410; - Vector local_1408; - Vector targetPos5; - Vector local_13f8; - Vector angleDir8; - Vector parentVel2; - Vector local_13e0; - Vector parentVel; - Vector lerped; - Vector local_13c8 [2]; - Vector local_13b8; - Vector uniformScale13; - Vector spawnerPos; - Vector negated3; - Vector entityPos23; - Vector rotatedDir; - Vector local_1388; - Vector resized2; - Vector parentPos7; - Vector local_1370; - Vector direction14; - Vector local_1360; - Vector parentPos9; - Vector parentPos8; - Vector local_1348; - Vector direction13; - Vector randomDir5; - Vector entityPos22; - Vector local_1328; - Vector entityPos21; - Vector local_1318; - Vector local_1310; - Vector angleDir7; - Vector local_1300; - Vector randomDir4; - Vector parentPos6; - Vector parentPos5; - Vector local_12e0; - Vector local_12d8; - Vector local_12d0; - Vector cardinalDir; - Vector local_12c0; - Vector local_12b8; - Vector direction12; - Vector local_12a8; - Vector local_12a0; - Vector entityPos20; - Vector local_1290; - Vector local_1288; - Vector local_1280; - Vector entityVel4; - Vector local_1270; - Vector local_1268; - Vector entityVel3; - Vector entityPos19; - Vector local_1250; - Vector local_1248; - Vector entityPos18; - Vector local_1238; - Vector resized; - Vector entityPos17; - Vector parentPos4; - Vector entityPos16; - Vector local_1210; - Vector local_1208; - Vector angleDir6; - Vector entityPos15; - Vector local_11f0; - Vector local_11e8; - Vector uniformScale12; - Vector local_11d8; - Vector local_11d0; - Vector local_11c8; - Vector local_11c0; - Vector randomDir3; - Vector local_11b0; - Vector local_11a8; - Vector local_11a0; - Vector uniformScale11; - Vector local_1190; - Vector local_1188; - Vector local_1180; - Vector local_1178; - Vector randomDir2; - Vector local_1168; - Vector uniformScale10; - Vector local_1158; - Vector local_1150; - Vector local_1148; - Vector angleDir5; - Vector local_1138; - Vector local_1130; - Vector local_1128; - Vector local_1120; - Vector local_1118; - Vector local_1110; - Vector local_1108; - Vector direction11; - Vector local_10f8; - Vector local_10f0; - Vector local_10e8; - Vector local_10e0; - Vector local_10d8; - Vector parentPos3; - Vector parentPos2; - Vector parentPos; - Vector local_10b8 [2]; - Vector local_10a8; - Vector local_10a0; - Vector entityPos14; - Vector local_1090; - Vector local_1088; - Vector direction4; - Vector targetPos; - Vector entityPos8; - Vector local_1068; - Vector local_1060; - Vector entityPos7; - Vector local_1050; - Vector local_1048; - Vector entityPos6; - Vector local_1038; - Vector local_1030; - Vector local_1028; - Vector local_1020; - Vector angleDir4; - Vector local_1010; - Vector angleDir3; - Vector negated2; - Vector local_ff8; - Vector local_ff0; - Vector direction10; - Vector direction9; - Vector direction8; - Vector direction7; - Vector targetPos4; - Vector entityPos13; - Vector local_fb8; - Vector local_fb0; - Vector entityPos12; - Vector local_fa0; - Vector local_f98; - Vector local_f90; - Vector entityPos11; - Vector direction6; - Vector local_f78; - Vector entityPos10; - Vector entityPos9; - Vector targetPos3; - Vector direction5; - Vector local_f50; - Vector targetPos2; - Vector local_f40; - Vector local_f38; - Vector local_f30; - Vector uniformScale5; - Vector local_f20; - Vector local_f18; - Vector local_f10; - Vector uniformScale7; - Vector uniformScale6; - Vector angleDir2; - Vector local_ef0; - Vector local_ee8; - Vector local_ee0; - Vector uniformScale9; - Vector uniformScale8; - Vector local_ec8; - Vector angleDir; - Vector local_eb8; - Vector local_eb0; - Vector local_ea8; - Vector local_ea0; - Vector local_e98; - Vector orbitDir; - Vector perpDir; - Vector direction3; - Vector direction2; - Vector local_e70; - Vector entityVel2; - Vector entityPos4; - Vector local_e58; - Vector local_e50; - Vector direction; - Vector local_e40; - BitSet128 inheritedFlags3; - BitSet128 inheritedFlags2; - GridEntityDesc local_e18; - Vector particlePos; - Vector otherPushedPos; - Vector pushedPos; - Vector otherBouncedVel; - Vector bouncedVel; - Vector fromTarget; - Vector local_dc8; - Vector fetusTechFacing; - Vector facingDir; - Vector nullOffset; - Vector local_da8; - Vector local_da0; - Vector toTechZeroTarget; - Vector wrapDelta; - Vector local_d88; - Vector roomClampedPos; - uint8_t radiusQuery200 [16]; - uint8_t local_d68 [32]; - uint8_t popTearQuery [16]; - uint8_t radiusQuery [16]; - uint8_t aheadQuery2 [16]; - uint8_t fetusTechQuery [16]; - uint8_t local_d08 [32]; - Vector local_ce8; - Vector laserToTarget; - Vector local_cd8; - Vector particleDir; - Vector local_cc8; - Vector gridPos; - Vector local_cb8; - Vector local_cb0; - Vector local_ca8; - Vector local_ca0; - Vector local_c98; - Vector local_c90; - Vector local_c88; - uint8_t local_c80 [12]; - uint8_t aheadQuery [16]; - uint8_t deathmatchFamiliarQuery [16]; - uint8_t techZeroQuery [16]; - void *local_c44; - void *timescaleFactor; - void *local_c3c; - void *local_c38; - void *fromTargetLenSq; - void *local_c30; - void *local_c2c; - void *local_c28; - void *local_c24; - void *local_c20; - void *local_c1c; - void *local_c18; - void *local_c14; - void *local_c10; - void *local_c0c; - void *local_c08; - void *local_c04; - void *local_c00; - void *local_bfc; - void *local_bf8; - void *local_bf4; - void *local_bf0; - void *local_bec; - void *local_be8; - void *local_be4; - void *local_be0; - void *local_bdc; - void *local_bd8; - void *local_bd4; - void *local_bd0; - void *local_bcc; - void *local_bc8; - void *local_bc4; - void *local_bc0; - void *local_bbc; - void *local_bb8; - void *local_bb4; - void *local_bb0; - void *local_bac; - void *local_ba8; - void *local_ba4; - void *local_ba0; - void *pvStack_b9c; - void *local_b98; - Vector prevPos; - Vector local_b8c; - Vector fetusTechAimDir; - Vector local_b7c; - Vector local_b74; - Vector local_b6c; - Vector local_b64; - Vector local_b5c; - Vector shotVelocity; - void *redCreepTearScale; - void *redCreepBaseScale; - void *local_b44; - void *greenCreepTearScale; - void *greenCreepBaseScale; - void *relSpeed; - void *local_b34; - void *local_b30; - void *local_b2c; - void *local_b28; - void *local_b24; - void *local_b20; - void *local_b1c; - void *local_b18; - void *local_b14; - void *local_b10; - uint8_t *local_b0c; - void *local_b08; - void *local_b04; - void *local_b00; - void *local_afc; - Room *local_af8; - void *local_af4; - void *local_af0; - void *otherRelSpeed; - void *local_ae8; - void *local_ae4; - void *local_ae0; - void *local_adc; - void *local_ad8; - void *local_ad4; - void *local_ad0; - void *local_acc; - void *local_ac8; - void *local_ac4; - void *local_ac0; - void *local_abc; - void *local_ab8; - void *local_ab4; - void *local_ab0; - void *local_aac; - uint8_t *local_aa8; - void *local_aa4; - void *local_aa0; - void *local_a9c; - void *local_a98; - void *local_a94; - void *local_a90; - void *local_a8c; - void *local_a88; - void *local_a84; - void *local_a80; - Room *local_a7c; - void *local_a78; - Room *local_a74; - void *local_a70; - void *local_a6c; - void *local_a68; - void *local_a64; - void *local_a60; - void *local_a5c; - void *local_a58; - void *local_a54; - void *local_a50; - void *local_a4c; - void *local_a48; - void *local_a44; - void *local_a40; - void *local_a3c; - void *local_a38; - void *local_a34; - void *local_a30; - void *local_a2c; - void *local_a28; - uint8_t *local_a24; - void *bloodParticleScale; - void *bloodParticleDist; - void *minBloodParticles; - void *poofScaleSmall; - void *poofScaleLarge; - void *poofSizeScale; - void *tearSpeed; - void *defaultSplitSpeed; - void *local_a00; - void *local_9fc; - void *local_9f8; - void *local_9f4; - void *particleSpeed; - void *particleDist; - void *pvStack_9e8; - void *particleCount; - uint8_t local_9e0 [12]; - Vector wrappedPos; - Vector local_9cc; - Vector local_9c4; - Vector local_9bc; - Vector separation; - Vector quadsplitVel; - Vector splitVel; - Vector redCreepPos; - Vector greenCreepPos; - Vector local_98c; - Vector local_984; - void *local_97c; - Room *local_978; - void *halfOverlap; - void *bounceFactor; - uint8_t *local_96c; - void *local_968; - Vector separationDir; - void *local_95c; - Vector velDir; - Vector local_950; - void *local_948; - Entity *chainChild; - void *local_940; - void *local_93c; - void *local_938; - Vector fromTarget2; - void *local_92c; - void *local_928; - void *local_924; - void *bloodParticleCount; - Vector aimDir; - void *local_914; - void *local_910; - void *squareSpeedScale; - BitSet128 *tearFlagsPtr; - Room *local_904; - void *local_900; - Room *local_8fc; - Room *local_8f8; - Entity_Player *local_8f4; - void *pointSixConst; - void *local_8ec; - Vector *tearPos; - Room *local_8e4; - Entity_Player *local_8e0; - void *local_8dc; - Room *local_8d8; - float pointThreeConst; - Room *local_8d0; - Room *local_8cc; - ANM2 *local_8c8; - BitSet128 *local_8c4; - Room *local_8c0; - char local_8b9; - float halfConst; - Room *local_8b4; - Room *local_8b0; - Entity_Projectile *local_8ac; - float oneConst; - uint8_t local_8a1; - Room *local_8a0; - Room *local_89c; - Room *local_898; - float zeroConst; - Room *local_890; - Room *local_88c; - Room *local_888; - Entity_Tear *tear; - void *local_880; - Room *local_87c; - TearParams local_878; - TearParams local_810 [9]; - ColorMod local_514; - Color local_4e8 [4]; - Color local_438 [4]; - Color aCStack_388 [4]; - TearParams tearHitParams; - TearParams TStack_270; - uint8_t local_1d8 [68]; - std_string curAnimName; - Color splashColor; - uint8_t local_150 [44]; - Color CStack_124; - TearParams local_f8; - RNG local_8c; - uint8_t local_7c [88]; - uint32_t stackCookie; - uint8_t *puStack_20; - void *prevExceptionList; - uint8_t *puStack_18; - uint32_t ehState; - ColorMod *color; - float decayFactor; - Game *game; - - puStack_20 = local_7c + 0x78; - ehState = -1; - puStack_18 = &LAB_00af78c4; - prevExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((local_7c + 0x6c)); - ExceptionList = &prevExceptionList; - local_87c = GHIDRA_CAST(0x0); - local_8f8 = GHIDRA_CAST(0x0); - tear = this; - puVar19 = local_7c + 0x78; - if (this->_isFireSoundPending != 0) { - play_fire_sound(); - this->_isFireSoundPending = 0; - puVar19 = puStack_20; - } - puStack_20 = puVar19; - tearFlagsPtr = &this->_tearFlags; - pBVar6 = BitSet128::operator_and(&ludovicoMask,tearFlagsPtr,&g_tearFlagLudovico); - if ((((GHIDRA_INT(pBVar6->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar6->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar6->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar6->_h) + 4)) != 0)) && ((this->_subtype & 4) != 0) - ) && (this->_parent == 0)) goto LAB_006684e5; - room = GHIDRA_CAST(this->_spawnerEntity); - local_8d8 = GHIDRA_CAST(this); - if (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0)) { - do { - local_8d8 = room; - room = local_8d8->_gridEntities[0xe9]; - } while (local_8d8->_gridEntities[0xe9] != GHIDRA_CAST(0x0)); - } - pVVar9 = &this->_pos; - if (local_8d8->_gridEntities[1] != (void *)0x1) { - local_8d8 = GHIDRA_CAST(0x0); - } - tearPos = pVVar9; - decayFactor = (GHIDRA_CAST((g_game->_room)))->Room::GetTimeScale(pVVar9,GHIDRA_CAST(this)); - game = g_game; - local_8d0 = GHIDRA_CAST(&this->_speedMultiplier); - local_8ec = (void *)0x3f400000; - *GHIDRA_CAST(local_8d0) = decayFactor; - if (0 < *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x722c))) { - *GHIDRA_CAST(local_8d0) = decayFactor * 0.75; - } - if (0 < this->_holdTimer) { - iVar7 = this->_holdTimer + -1; - this->_holdTimer = iVar7; - if (iVar7 != 0) { - iVar7 = this->_parent; - if (iVar7 != 0) { - decayFactor = *GHIDRA_CAST((iVar7 + 0x340)); - fVar36 = (this->_holdOffset).y; - pVVar9->x = *GHIDRA_CAST((iVar7 + 0x33c)) + (this->_holdOffset).x; - (this->_pos).y = decayFactor + fVar36; - } - (this->_velocity).x = g_vectorZero.x; - (this->_velocity).y = g_vectorZero.y; - if ((this->_holdTimer / 0xf & 1U) == 0) { - decayFactor = this->_height + 0.5; - } - else { - decayFactor = this->_height - 0.5; - } - this->_height = decayFactor; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Projectile::SetHeight(decayFactor); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); - ExceptionList = prevExceptionList; - return; - } - (this->_velocity).x = (this->_holdVelocity).x; - (this->_velocity).y = (this->_holdVelocity).y; - } - pBVar6 = &this->_tearFlags; - pBVar8 = BitSet128::operator_and(&detonateMask,pBVar6,&g_tearFlagDetonate); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - local_890 = GHIDRA_CAST(0x40400000); - if ((bVar4 != 0) && (local_8d8 != GHIDRA_CAST(0x0))) { - playerEffects = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_8d8))))->Entity_Player)::GetEffects(); - bVar4 = (GHIDRA_CAST((playerEffects)))->TemporaryEffects::HasCollectibleEffect(0x89); - if (bVar4 != 0) { - (GHIDRA_CAST((&g_tearFlagDetonate)))->BitSet128::__bnot(¬Detonate); - FUN_005cd430(); - (GHIDRA_CAST((pBVar6)))->BitSet128::operator__(&g_tearFlagExplosive); - this->SetCollisionDamage(); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Die(); - this->_deathFlags = 0x40; - } - } - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((room)))->Room::is_type_16(); - pointSixConst = (void *)0x3f19999a; - if (((bVar4 != 0) && (-5.1 <= this->_height)) && (this->_tearRange * 0.6 < this->_updateTime)) { - pBVar8 = BitSet128::operator_and(&ludovicoMask2,pBVar6,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsZero(); - if (bVar4 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Die(); - this->_deathFlags = 0x40; - } - } - if ((this->_variant == 0xd) || (this->_variant == 0x17)) { - seeds = GHIDRA_CAST(Game)::GetSeeds(g_game); - bVar4 = Seeds::HasSeedEffect(seeds,0x4f); - if (bVar4 != 0) { - (GHIDRA_CAST((&g_tearFlagLasershot)))->BitSet128::__bnot(¬Lasershot); - FUN_005cd430(); - } - } - local_8dc = (void *)0x3f800000; - oneConst = (float)local_8dc; - pBVar6 = BitSet128::operator_and(&waitMask,pBVar6,&g_tearFlagWait); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - halfConst = 0.5; - if (bVar4 == 0) { - if (0 < this->_waitFrames) { - if (this->_parent != 0) { - iVar7 = (GHIDRA_CAST(()))->Entity::Type(); - pEVar11 = GHIDRA_CAST(this->_parent); - if (iVar7 != 1) { - iVar7 = (GHIDRA_CAST(()))->Entity::Type(); - if (iVar7 != 3) goto LAB_0066757c; - familiar = GHIDRA_CAST(FUN_00435de0()); - pEVar11 = GHIDRA_CAST((GHIDRA_CAST((familiar)))->Entity_Familiar)::Player(); - } - pEVar17 = (GHIDRA_CAST((pEVar11)))->Entity::ToPlayer(); - if ((pEVar17 != GHIDRA_CAST(0x0)) && - (iVar7 = (GHIDRA_CAST((pEVar17)))->Entity_Player::GetFireDirection(), iVar7 == -1)) { - this->_waitFrames = 1; - } - } -LAB_0066757c: - piVar12 = &this->_waitFrames; - *piVar12 = *piVar12 + -1; - iVar7 = this->_waitFrames; - if (*piVar12 == 0) { - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(&this->_continueVelocity); - (GHIDRA_CAST((&this->_continueVelocity)))->Vector::operator_assign(&g_vectorZero); - iVar7 = this->_waitFrames; - } - if ((iVar7 / 0xf & 1U) == 0) { - decayFactor = this->_height + halfConst; - } - else { - decayFactor = this->_height - halfConst; - } - this->_height = decayFactor; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Projectile::SetHeight(decayFactor); - } - } - else { - this->_waitFrames = 0x5a; - (GHIDRA_CAST((&g_tearFlagWait)))->BitSet128::__bnot(¬Wait); - FUN_005cd430(); - (GHIDRA_CAST((&this->_continueVelocity)))->Vector::operator_assign(&this->_velocity); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); - } - pBVar6 = &this->_tearFlags; - pBVar8 = BitSet128::operator_and - (&mysteriousLiquidCreepMask,pBVar6,&g_tearFlagMysteriousLiquidCreep); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - local_8fc = GHIDRA_CAST(0x41700000); - local_900 = (void *)0x3ecccccd; - if (bVar4 != 0) { - local_888 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_888)) + 0x1))),this->_dead != 0)); - pBVar8 = BitSet128::operator_and(&ludovicoMask3,pBVar6,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(5,this->_index); - local_888 = GHIDRA_CAST((GHIDRA_UINT(local_888) & 0xff)); - if (bVar4 != 0) { - local_888 = GHIDRA_CAST(0x1); - } - } - if (this->_dead != 0) { - pBVar8 = BitSet128::operator_and(&explosiveMask,pBVar6,&g_tearFlagExplosive); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) || (this->_variant == 4)) goto LAB_006677ce; - } - if ((char)local_888 != '\0') { - greenCreepPos.y = (this->_pos).y; - greenCreepPos.x = (this->_pos).x; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pVVar9 = (GHIDRA_CAST((room)))->Room::GetClampedPosition(&clampedPos,&greenCreepPos,15.0); - (GHIDRA_CAST((&greenCreepPos)))->Vector::operator_assign(pVVar9); - uVar10 = Random(); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - Game::Spawn(g_game,1000,0x35,&greenCreepPos,&g_vectorZero,GHIDRA_CAST(this->_spawnerEntity),0, - uVar10); - pEVar11 = GHIDRA_CAST(__RTDynamicCast()); - greenCreepBaseScale = (void *)0x3ecccccd; - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&uniformScale,GHIDRA_CAST(&greenCreepBaseScale)); - fVar27 = (long double)Scale(tear); - greenCreepTearScale = (void *)(float)fVar27; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_14d0,GHIDRA_CAST(&greenCreepTearScale)); - (GHIDRA_CAST((pEVar11)))->Entity::SetSpriteScale(pVVar9); - pEVar11->Update(); - pBVar6 = tearFlagsPtr; - this = tear; - } - } -LAB_006677ce: - pBVar8 = BitSet128::operator_and(&bit76Mask,pBVar6,GHIDRA_CAST(&DAT_00c346a0)); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (this->_dead != 0)) { - pBVar8 = BitSet128::operator_and(&explosiveMask2,pBVar6,&g_tearFlagExplosive); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if ((bVar4 == 0) && (this->_variant != 4)) { - redCreepPos.y = (this->_pos).y; - redCreepPos.x = (this->_pos).x; - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pVVar9 = (GHIDRA_CAST((room)))->Room::GetClampedPosition(&clampedPos2,&redCreepPos,15.0); - (GHIDRA_CAST((&redCreepPos)))->Vector::operator_assign(pVVar9); - uVar10 = Random(); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - Game::Spawn(g_game,1000,0x2e,&redCreepPos,&g_vectorZero,GHIDRA_CAST(this->_spawnerEntity),0, - uVar10); - pEVar11 = GHIDRA_CAST(__RTDynamicCast()); - redCreepBaseScale = (void *)0x3ecccccd; - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&uniformScale2,GHIDRA_CAST(&redCreepBaseScale)); - fVar27 = (long double)Scale(tear); - redCreepTearScale = (void *)(float)fVar27; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_14e8,GHIDRA_CAST(&redCreepTearScale)); - (GHIDRA_CAST((pEVar11)))->Entity::SetSpriteScale(pVVar9); - pEVar11->Update(); - pBVar6 = tearFlagsPtr; - } - } - pBVar6 = BitSet128::operator_and(&laserMask,pBVar6,&g_tearFlagLaser); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - this = tear; - zeroConst = 0.0; - pointThreeConst = 0.3; - if (bVar4 != 0) { - local_8b9 = '\0'; - if (tear->_techZeroTarget == 0) { - local_8a0 = GHIDRA_CAST(0x0); - local_8b0 = GHIDRA_CAST(0x47fd2000); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - in_stack_ffffd9fc = GHIDRA_CAST(0x6679c9); - EntityList::QueryRadius(entityList,GHIDRA_CAST(techZeroQuery),&this->_pos,350.0,4); - ehState = 0; - local_898 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(techZeroQuery))))->EntityList::Size(); - if (iVar7 != 0) { - do { - piVar12 = GHIDRA_CAST(std)::vector::operator_index(); - if (GHIDRA_CAST(*piVar12) != this) { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity::Type(); - if (iVar7 == 2) { - msvc::vector::operator_index(); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - local_904 = GHIDRA_CAST(__RTDynamicCast()); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_904))))->Entity::Position(&entityPos); - local_8e4 = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::DistanceSquared(&this->_pos); - if ((float)local_8e4 < (float)local_8b0) { - local_8a0 = local_904; - local_8b0 = local_8e4; - } - } - } - local_898 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_898)) + 0x1)))); - room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(techZeroQuery))))->EntityList)::Size(); - } while (local_898 < room); - if (((local_8a0 != GHIDRA_CAST(0x0)) && (local_8a0->_gridEntities[0x11a] != this)) && - (local_8d8 != GHIDRA_CAST(0x0))) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::Position(&entityPos2); - pVVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity)::PositionOffset(); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1500,pVVar14); - pVVar14 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&nextPos,&this->_velocity); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__add(&local_1510,&this->_posOffset); - (GHIDRA_CAST((pVVar9)))->Vector::__sub(&toTechZeroTarget,pVVar14); - if (this->_techZeroLaser == 0) { - pVVar9 = (GHIDRA_CAST((&local_1518)))->Vector::Vector(zeroConst,-15.0); - local_8e4 = GHIDRA_CAST((GHIDRA_CAST((&toTechZeroTarget)))->Vector)::GetAngleDegrees(); - in_stack_ffffd9fc = GHIDRA_CAST(0x3); - laser = Entity_Laser::ShootAngle - (10,&this->_pos,(float)local_8e4,3,pVVar9,GHIDRA_CAST(local_8d8),1); - if (laser == GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((&g_tearFlagLaser)))->BitSet128::__bnot(¬Laser); - FUN_005cd430(); - local_8b9 = '\0'; - (GHIDRA_CAST((GHIDRA_CAST(&this->_techZeroTarget))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - goto LAB_00667cb7; - } - pEVar11 = GHIDRA_CAST(0x0); - iVar7 = Isaac::Random(2); - Entity_Player::GetTearHitParams - (GHIDRA_CAST(local_8d8),&TStack_270,3,1.0,iVar7 * 2 + -1,pEVar11); - (**(code **)(*GHIDRA_CAST(laser) + 0x40))(); - (GHIDRA_CAST((laser)))->Entity_Laser::set_scale(TStack_270._tearScale); - FUN_00435cd0(); - in_stack_ffffd9fc = GHIDRA_CAST(g_tearFlagSpectral._l); - FUN_00456830(); - set_field_0x37c(); - (GHIDRA_CAST((GHIDRA_CAST(laser))))->Entity::SetParent(GHIDRA_CAST(this)); - FUN_00435f70(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_techZeroLaser))))->EntityPtr::SetReference(GHIDRA_CAST(laser)); - local_8b9 = '\x01'; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_techZeroTarget))))->EntityPtr::SetReference(GHIDRA_CAST(local_8a0)); - } - } -LAB_00667cb7: - ehState = -1; - (GHIDRA_CAST((techZeroQuery)))->EntityList_Query::~EntityList_Query(); - } - puVar13 = &this->_techZeroTarget; - local_8e4 = GHIDRA_CAST(&this->_techZeroLaser); - if ((this->_techZeroLaser != 0) && - (((this->_dead != 0 || (*puVar13 == 0)) || (cVar5 = (GHIDRA_CAST(()))->Entity::IsDead(), cVar5 != '\0')))) { - (**(code **)(*GHIDRA_CAST(this->_techZeroLaser) + 0x28))(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_techZeroLaser))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((GHIDRA_CAST(puVar13))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - if ((((this->_dead != 0) || ((*puVar13 != 0 && (cVar5 = (GHIDRA_CAST(()))->Entity::IsDead(), cVar5 != '\0')))) || - (*puVar13 == 0)) && (GHIDRA_CAST(this->_techZeroLaser) != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_techZeroLaser) + 0x28))(); - } - if ((this->_techZeroLaser != 0) && (GHIDRA_CAST(*puVar13) != GHIDRA_CAST(0x0))) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity::Position(&entityPos3); - pVVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this->_techZeroTarget))))->Entity)::PositionOffset(); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1528,pVVar14); - pVVar14 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&nextPos2,&this->_velocity); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__add(&local_1538,&this->_posOffset); - (GHIDRA_CAST((pVVar9)))->Vector::__sub(&laserToTarget,pVVar14); - local_89c = GHIDRA_CAST((GHIDRA_CAST((&laserToTarget)))->Vector)::Length(); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - room = GHIDRA_CAST(__RTDynamicCast()); - local_8b0 = room; - decayFactor = (GHIDRA_CAST((&laserToTarget)))->Vector::GetAngleDegrees(); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_NPC::SetAimAngle(decayFactor); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetMaxDistance((float)local_89c); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetTimeout(); - pVVar9 = (GHIDRA_CAST((tearPos)))->Vector::__add(&local_1550,&this->_posOffset); - this = tear; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1588,&tear->_velocity); - pVVar14 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_8b0))))->Entity)::PositionOffset(); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_1590,pVVar14); - room = local_8b0; - (GHIDRA_CAST((GHIDRA_CAST(local_8b0))))->Entity::SetPosition(pVVar9); - if (350.0 < (float)local_89c) { - (**(code **)(*GHIDRA_CAST(room) + 0x28))(); - } - if (local_8b9 != '\0') { - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - } - } - } - pBVar6 = BitSet128::operator_and(&lasershotMask,&this->_tearFlags,&g_tearFlagLasershot); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - local_8f4 = GHIDRA_CAST(0x41f00000); - if (bVar4 == 0) { - if (GHIDRA_CAST(this->_laserShotLaser) == GHIDRA_CAST(0x0)) goto LAB_00668237; - this->_visible = 1; - this->_entityCollisionClass = 4; - (**(code **)(*GHIDRA_CAST(this->_laserShotLaser) + 0x28))(); -LAB_00668224: - (GHIDRA_CAST((GHIDRA_CAST(&this->_laserShotLaser))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - } - else { - pVVar9 = &this->_continueVelocity; - if (this->_waitFrames < 1) { - pVVar9 = &this->_velocity; - } - shotVelocity.x = pVVar9->x; - shotVelocity.y = pVVar9->y; - if (this->_laserShotLaser == 0) { - local_8b0 = local_8d8; - if (local_8d8 == GHIDRA_CAST(0x0)) { - local_8b0 = GHIDRA_CAST(Game)::GetPlayer(g_game,0); - } - (GHIDRA_CAST((&this->_pos)))->Vector::operator__(&this->_velocity); - pVVar9 = (GHIDRA_CAST((&local_1598)))->Vector::Vector(zeroConst,this->_height); - local_8e4 = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::GetAngleDegrees(); - in_stack_ffffd9fc = GHIDRA_CAST(0x3e8); - room = GHIDRA_CAST(Entity_Laser)::ShootAngle - (3,&this->_pos,(float)local_8e4,1000,pVVar9,GHIDRA_CAST(local_8b0),1); - local_888 = room; - if (room != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetParent(GHIDRA_CAST(this)); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetMaxDistance(30.0); - (**(code **)(*GHIDRA_CAST(room) + 0x40))(); - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetColor(); - in_stack_ffffd9fc = GHIDRA_CAST(0xff); - (*pcVar1)(); - pBVar35 = &g_tearFlagContinuum; - pBVar34 = &g_tearFlagSplit; - pBVar8 = &g_tearFlagHydrobounce; - pBVar6 = BitSet128::operator_or(&withOrbit,&g_tearFlagBounce,&g_tearFlagOrbit); - pBVar6 = BitSet128::operator_or(&orResult,pBVar6,pBVar8); - pBVar6 = BitSet128::operator_or(&orResult2,pBVar6,pBVar34); - pBVar6 = BitSet128::operator_or(&orResult3,pBVar6,pBVar35); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result); - pBVar8 = TearFlags(this,&tearFlagsCopy); - BitSet128::operator_and(&andResult,pBVar8,pBVar6); - room = local_888; - FUN_00456830(); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::set_disable_init_sound(); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetMultidimensionalTouched(); - FUN_005cd5a0(); - decayFactor = (GHIDRA_CAST((&shotVelocity)))->Vector::GetAngleDegrees(); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_NPC::SetAimAngle(decayFactor); - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_laserShotLaser))))->EntityPtr::SetReference(GHIDRA_CAST(room)); - this->_visible = 0; - pBVar6 = BitSet128::operator_and(&explosiveMask3,&this->_tearFlags,&g_tearFlagExplosive); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - this->_entityCollisionClass = 0; - } - goto LAB_00668180; - } - (GHIDRA_CAST((&g_tearFlagLasershot)))->BitSet128::__bnot(¬Lasershot2); - FUN_005cd430(); - this->_visible = 1; - this->_entityCollisionClass = 4; - } - else { - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - room = GHIDRA_CAST(__RTDynamicCast()); - if (room != GHIDRA_CAST(0x0)) { -LAB_00668180: - local_8e4 = GHIDRA_CAST((GHIDRA_CAST((&shotVelocity)))->Vector)::GetAngleDegrees(); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Projectile::Damage(); - local_904 = GHIDRA_CAST((float)fVar27); - decayFactor = LerpAngleDeg((float)local_904,(float)local_8e4,halfConst); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_NPC::SetAimAngle(decayFactor); - if (this->_dead != 0) { - iVar7 = FUN_00579760(); - if (10 < iVar7) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetTimeout(); - } - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetVelocity(&this->_velocity); - goto LAB_00668224; - } - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetTimeout(); - } - } - } -LAB_00668237: - pVVar9 = &this->_pos; - pEVar17 = GHIDRA_CAST(this->_fallingSpeed); - local_8e0 = pEVar17; - pBVar6 = BitSet128::operator_and(&ludovicoMask4,&this->_tearFlags,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and(&hydrobounceMask,&this->_tearFlags,&g_tearFlagHydrobounce); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetRootParent(); - local_888 = GHIDRA_CAST((3.1415927 / (float)pEVar17)); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - local_8b0 = GHIDRA_CAST(sinf_wrapper((float)(iVar7 + -1) * (float)local_888)); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - decayFactor = sinf_wrapper((float)iVar7 * (float)local_888); - Math::abs(); - (this->_posOffset).y = decayFactor * this->_height; - room = local_8b0; - Math::abs(); - local_8e0 = GHIDRA_CAST(((this->_posOffset).y - (float)room * this->_height)); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - decayFactor = sinf_wrapper((float)iVar7 * (float)local_888); - if (decayFactor * (float)local_8b0 < zeroConst) { - this->_deathFlags = 4; - this->_dead = 1; - apply_death_flag_effects(this,GHIDRA_CAST(0x0)); - } - } - } - local_8e4 = GHIDRA_CAST(0xc1200000); - local_8cc = GHIDRA_CAST(0xc1a00000); - local_904 = GHIDRA_CAST(0x3e800000); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = ZEXT812(0xc1be0000); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0xc))) = 0; - local_8b0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - if ((this->_dead == 0) || (this->_variant == 9)) goto LAB_0066a370; - if (this->_variant == 0x28) { - rng_pair_init(&local_e18); - local_e18._type = GHIDRA_UINT(this->_subtype) >> 0x10; - local_e18._variant = this->_subtype & 0xffff; - local_e18._spawnSeed = this->_initSeed; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x40000); - local_e18._varData = GHIDRA_INT((bVar4 != 0)); - local_e18._state = GHIDRA_INT(this->_health); - Entity::DestroyRockGridAt(pVVar9,&local_e18,GHIDRA_CAST(this),this->_tearIdx); - if (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::is_player(); - if (bVar4 != 0) { - local_904 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity)::ToPlayer(); - if (local_904 != GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_904))))->Entity_Player::HasCollectible(0x248,0); - if (bVar4 != 0) { - iVar7 = Isaac::Random(3); - room = GHIDRA_CAST((iVar7 + 1)); - local_8e4 = room; - if (0 < GHIDRA_INT(room)) { - do { - local_8e4 = GHIDRA_CAST(Entity_Player)::AddWisp - (GHIDRA_CAST(local_904),0x25c,pVVar9,0,1); - if (local_8e4 != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(local_8e4))))->Entity::SetTargetPosition(*pVVar9); - (**(code **)(GHIDRA_INT(*GHIDRA_CAST(local_8e4)) + 0xc))(); - } - room = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(room[-1])) + 0x7897)))); - } while (room != GHIDRA_CAST(0x0)); - this = tear; - } - } - } - } - } -LAB_006684e5: - this->Remove(); - ExceptionList = prevExceptionList; - return; - } - local_888 = GHIDRA_CAST((GHIDRA_UINT(local_888) & 0xffffff00)); - pBVar6 = BitSet128::operator_and(&hydrobounceMask2,&this->_tearFlags,&g_tearFlagHydrobounce); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (this->_deathFlags == 4)) { - pBVar6 = BitSet128::operator_and(&ludovicoMask5,&this->_tearFlags,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - local_8c0 = local_8e4; - if (bVar4 == 0) { - pBVar8 = &g_tearFlagBurstsplit; - pBVar6 = BitSet128::operator_or(&withQuadsplit,&g_tearFlagExplosive,&g_tearFlagQuadsplit); - pBVar6 = BitSet128::operator_or(&orResult4,pBVar6,pBVar8); - pBVar6 = BitSet128::operator_and(&andResult2,&this->_tearFlags,pBVar6); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - room = local_8c0; - } - else { - room = local_8cc; - } - pRVar28 = GHIDRA_CAST(this->_fallingSpeed); - if (((float)room < (float)pRVar28) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x46e)))) == 0)) { - this->_fallingSpeed = (float)room; - pRVar28 = room; - } - if ((float)room < (float)pRVar28) goto LAB_0066863a; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x46e)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x46e)))) + 1; - this->_dead = 0; - in_stack_ffffd9fc = *GHIDRA_CAST(&(this->_tearFlags)._l); - qVar3 = (this->_tearFlags)._h; - local_888 = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_888)) + 0x1))),1)); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x1))) = (char)(qVar3 >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00)) + 0x0))) = *GHIDRA_CAST(&this->_tearFlags); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x2))) = (short)(qVar3 >> 0x10); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - tear_flags_area_apply - (pVVar9,GHIDRA_CAST(this),this->_size + 20.0,this->_collisionDamage * (float)local_904, - flags_00); - } -LAB_0066863a: - local_910 = (void *)0x3f800000; - auVar31 = ZEXT416(GHIDRA_UINT(oneConst)); - iVar7 = this->_variant; - local_8c8 = GHIDRA_CAST(0x0); - local_898 = GHIDRA_CAST(0x0); - local_88c = GHIDRA_CAST(0x0); - local_8c4 = GHIDRA_CAST(oneConst); - local_8a0 = GHIDRA_CAST(oneConst); - switch(iVar7) { - case 0: - case 3: - case 5: - case 6: - case 7: - case 10: - case 0xb: - case 0xe: - case 0x10: - case 0x13: - case 0x15: - case 0x18: - case 0x1a: - case 0x1b: - case 0x1f: - case 0x24: - case 0x29: - case 0x2d: - case 0x30: - if ((float)local_900 <= this->_fScale) { - if (0.8 <= this->_fScale) { - auVar31 = ZEXT416(GHIDRA_UINT(oneConst)); - if (this->_height <= -5.0) { - local_88c = GHIDRA_CAST(0x96); - local_8c8 = GHIDRA_CAST(0xc); - } - else { - local_88c = GHIDRA_CAST(0x102); - local_8c8 = GHIDRA_CAST(&DAT_0000000d); - } - break; - } - auVar31 = ZEXT816(0x3f59999a); - local_88c = GHIDRA_CAST(0x102); - local_8c8 = GHIDRA_CAST(&DAT_0000004f); - } - else { - auVar31 = ZEXT816(0x3f333333); - local_88c = GHIDRA_CAST(0x102); - local_8c8 = GHIDRA_CAST(&DAT_00000050); - } - goto LAB_00668f76; - case 1: - case 0xc: - case 0xf: - case 0x11: - case 0x19: - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x25: - case 0x26: - case 0x27: - local_8c8 = GHIDRA_CAST(&DAT_0000000b); - local_88c = GHIDRA_CAST(0x96); - goto LAB_00668f76; - case 2: - case 0x1e: - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((&splashColor)))->Color::operator_assign(color); - if (this->_variant == 0x1e) { - (GHIDRA_CAST((aCStack_388)))->Color::Color(); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::operator_assign(GHIDRA_CAST(&splashColor)); - color = GHIDRA_CAST(FUN_004072e0()); - (GHIDRA_CAST((&splashColor)))->Color::operator_assign(color); - } - local_8c0 = GHIDRA_CAST(this->_height); - decayFactor = random_float(); - in_stack_ffffd9fc = GHIDRA_CAST((decayFactor * (float)local_890 + 2.0)); - Game::SpawnParticles - (g_game,&this->_pos,0x23,8,(float)in_stack_ffffd9fc,GHIDRA_CAST(&splashColor), - (float)local_8c0,1); - local_8c8 = GHIDRA_CAST(0x61); - local_88c = GHIDRA_CAST(0xb5); - local_8c4 = GHIDRA_CAST(halfConst); - decayFactor = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * 0.2 + oneConst)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var; - local_8a0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - break; - case 8: - local_8c8 = GHIDRA_CAST(&DAT_00000014); - local_88c = GHIDRA_CAST(0x31); - local_8c4 = GHIDRA_CAST(pointThreeConst); - decayFactor = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * 0.1 + 0.95)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_01; - local_8a0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - break; - case 0xd: - case 0x17: - case 0x1c: - if ((iVar7 == 0xd) || (iVar7 == 0x17)) { - seeds = GHIDRA_CAST(Game)::GetSeeds(g_game); - bVar4 = Seeds::HasSeedEffect(seeds,0x4f); - if (bVar4 == 0) goto LAB_00668a9b; - iVar7 = Isaac::Random(5); - if ((iVar7 == 0) && ((this->_deathFlags & 1) != 0)) { - local_88c = GHIDRA_CAST(0x33f); - local_8c4 = GHIDRA_CAST(oneConst); - decayFactor = random_float(); - local_8c8 = GHIDRA_CAST(0x61); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * (float)pointSixConst + 0.8)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_03; - local_8a0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - break; - } - local_8c4 = GHIDRA_CAST(zeroConst); - } - else { -LAB_00668a9b: - local_8c0 = GHIDRA_CAST(this->_height); - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - decayFactor = random_float(); - local_8b4 = GHIDRA_CAST((decayFactor * (float)local_890 + 2.0)); - iVar7 = Isaac::Random(2); - in_stack_ffffd9fc = GHIDRA_CAST(local_8b4); - Game::SpawnParticles - (g_game,&this->_pos,0x56,iVar7 + 2,(float)local_8b4,color,(float)local_8c0,1); - local_8c4 = GHIDRA_CAST(pointThreeConst); - } - local_88c = GHIDRA_CAST(0x8a); - decayFactor = random_float(); - local_8c8 = GHIDRA_CAST(0x61); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * halfConst + 2.0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_04; - local_8a0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - break; - case 0x12: - local_8c0 = GHIDRA_CAST(this->_height); - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - decayFactor = random_float(); - local_8b4 = GHIDRA_CAST((decayFactor * (float)local_890 + 2.0)); - iVar7 = Isaac::Random(2); - iVar7 = iVar7 + 2; - uVar37 = SUB41(local_8c0,0); - uVar38 = (uint8_t)(GHIDRA_UINT(local_8c0) >> 8); - uVar39 = (uint16_t)(GHIDRA_UINT(local_8c0) >> 0x10); - variant = 0x55; - goto LAB_006689b3; - case 0x14: - local_8c0 = GHIDRA_CAST(this->_height); - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - decayFactor = random_float(); - local_8b4 = GHIDRA_CAST((decayFactor * (float)local_890 + 2.0)); - iVar7 = Isaac::Random(2); - iVar7 = iVar7 + 4; - uVar37 = SUB41(local_8c0,0); - uVar38 = (uint8_t)(GHIDRA_UINT(local_8c0) >> 8); - uVar39 = (uint16_t)(GHIDRA_UINT(local_8c0) >> 0x10); - variant = 0x62; -LAB_006689b3: - in_stack_ffffd9fc = GHIDRA_CAST(local_8b4); - Game::SpawnParticles - (g_game,&this->_pos,variant,iVar7,(float)local_8b4,color, - (float)CONCAT22(uVar39,CONCAT11(uVar38,uVar37)),1); - local_8c8 = GHIDRA_CAST(0x61); - local_88c = GHIDRA_CAST(0x8a); - local_8c4 = GHIDRA_CAST(pointThreeConst); - decayFactor = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * halfConst + 2.0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_02; - local_8a0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - break; - case 0x1d: - local_8c0 = GHIDRA_CAST(this->_height); - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - decayFactor = random_float(); - in_stack_ffffd9fc = GHIDRA_CAST((decayFactor * (float)local_890 + 2.0)); - Game::SpawnParticles - (g_game,&this->_pos,0x23,4,(float)in_stack_ffffd9fc,color,(float)local_8c0,1); - local_8c8 = GHIDRA_CAST(0x61); - local_88c = GHIDRA_CAST(0x8a); - local_8c4 = GHIDRA_CAST(pointThreeConst); - decayFactor = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * halfConst + (float)local_890)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_00; - local_8a0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - break; - case 0x2a: - local_88c = GHIDRA_CAST(0x1e7); - local_8c4 = GHIDRA_CAST(Math)::clamp(halfConst,oneConst,this->_fScale * 1.4); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(Math)::clamp(0.95,1.8,oneConst / this->_fScale); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_05; - local_8c8 = GHIDRA_CAST(0x91); - local_8a0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(pVVar9,-20.0); - if (bVar4 != 0) { - (GHIDRA_CAST((GHIDRA_CAST((local_150 + 0x2c)))))->Color::Color(); - in_stack_ffffd9fc = GHIDRA_CAST(0x8c); - (GHIDRA_CAST((GHIDRA_CAST((local_150 + 0x2c)))))->KColor::FromRGBA255(0x8c,0x7b,0x7b,0xff); - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((GHIDRA_CAST((local_150 + 0x2c)))))->Color::__mul(color); - pvStack_9e8 = (void *)0x10; - pvStack_b9c = (void *)0x1; - decayFactor = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * halfConst + oneConst)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_06; - particleCount = (void *)GHIDRA_INT((this->_fScale * 4.0 * (*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0))))); - msvc::max(); - piVar12 = GHIDRA_CAST(std)::min(); - local_89c = GHIDRA_CAST(*piVar12); - if (0 < GHIDRA_INT(local_89c)) { - do { - decayFactor = random_float(); - Vector::FromAngle(&particleDir,decayFactor * 360.0); - decayFactor = random_float(); - particleSpeed = (void *)(decayFactor * 2.0 + oneConst); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(random_float()); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_07; - particleDist = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - pVVar9 = (GHIDRA_CAST((&particleDir)))->Vector::__mul(&VStack_15a0,GHIDRA_CAST(&particleDist)); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&VStack_15a8,&this->_size); - (GHIDRA_CAST((&this->_pos)))->Vector::__add(&particlePos,pVVar9); - uVar10 = Random(); - pVVar9 = (GHIDRA_CAST((&particleDir)))->Vector::__mul(&VStack_15b0,GHIDRA_CAST(&particleSpeed)); - pEVar11 = Game::Spawn(g_game,1000,0x23,&particlePos,pVVar9,GHIDRA_CAST(0x0),1,uVar10); - (GHIDRA_CAST((pEVar11)))->Entity::SetPositionOffset(&this->_posOffset); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - pEVar11->SetColor(); - pEVar11->Update(); - local_89c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_89c[-1])) + 0x7897)))); - } while (local_89c != GHIDRA_CAST(0x0)); - local_89c = GHIDRA_CAST(0x0); - } - } - break; - case 0x2b: - case 0x2c: - local_8c0 = GHIDRA_CAST(this->_height); - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - decayFactor = random_float(); - local_8b4 = GHIDRA_CAST((decayFactor * (float)local_890 + 2.0)); - iVar7 = Isaac::Random(2); - in_stack_ffffd9fc = GHIDRA_CAST(local_8b4); - Game::SpawnParticles - (g_game,&this->_pos,0x56,iVar7 + 2,(float)local_8b4,color,(float)local_8c0,1); - local_88c = GHIDRA_CAST(0x8a); - decayFactor = random_float(); - local_8c8 = GHIDRA_CAST(0xc); - local_8a0 = GHIDRA_CAST((decayFactor * halfConst + 2.0)); - local_898 = GHIDRA_CAST(((this->_variant == 0x2c) + 0x14)); - auVar31 = ZEXT416(GHIDRA_UINT(pointThreeConst)); - goto LAB_00668f76; - case 0x2f: - local_88c = GHIDRA_CAST(0x31); - goto LAB_00668eec; - case 0x31: - local_88c = GHIDRA_CAST(0x86); -LAB_00668eec: - decayFactor = random_float(); - local_8c8 = GHIDRA_CAST(0xc); - local_898 = GHIDRA_CAST(0x16); - local_8a0 = GHIDRA_CAST((decayFactor * halfConst + 2.0)); - auVar31 = ZEXT416(GHIDRA_UINT(pointThreeConst)); - goto LAB_00668f76; - case 0x32: - local_88c = GHIDRA_CAST(0x1e); - decayFactor = random_float(); - local_8c8 = GHIDRA_CAST(0x2); - local_898 = GHIDRA_CAST(0x2); - local_8a0 = GHIDRA_CAST((decayFactor * halfConst + 1.5)); - auVar31 = ZEXT416(pointSixConst); -LAB_00668f76: - local_8c4 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - pVVar9 = &this->_pos; - pBVar6 = BitSet128::operator_and(&explosiveMask4,&this->_tearFlags,&g_tearFlagExplosive); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 == 0) || ((this->_subtype & 2) != 0)) { -LAB_00668fdf: - if (this->_variant == 4) goto LAB_00668fe9; - } - else { - pBVar6 = BitSet128::operator_and(&ludovicoMask6,&this->_tearFlags,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if ((bVar4 == 0) && ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x46e)))) < 2 && ((this->_deathFlags & 0x20) == 0)))) - goto LAB_00668fdf; -LAB_00668fe9: - local_8c8 = GHIDRA_CAST(0x1); - Game::BombTearflagEffects(g_game,pVVar9,60.0,this->_tearFlags,GHIDRA_CAST(this),1.0); - Game::GetField26614(g_game); - cVar5 = DeathmatchManager::is_active(); - if (cVar5 == '\0') { - local_89c = GHIDRA_CAST(this->_collisionDamage); - } - else { - local_89c = GHIDRA_CAST(0x420c0000); - } - if ((char)local_888 != '\0') { - local_89c = GHIDRA_CAST(((float)local_89c * halfConst)); - } - local_8b4 = GHIDRA_CAST(&DAT_00000004); - if (this->_variant == 4) { - local_8b4 = GHIDRA_CAST(0x40000004); - } - decayFactor = this->_size; - if (8.75 <= decayFactor) { - local_9fc = (void *)(decayFactor + (float)local_8f4); - local_a00 = (void *)0x42700000; - } - else { - local_9f4 = (void *)0x41f00000; - local_9f8 = (void *)((decayFactor * 60.0) / 8.75); - } - pfVar15 = GHIDRA_CAST(std)::max(); - local_910 = (void *)(*pfVar15 / 60.0); - in_stack_ffffd9fc = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - auVar31 = ZEXT416(local_89c); - Game::BombDamage(g_game,pVVar9,(float)local_89c,*pfVar15,1,GHIDRA_CAST(this),this->_tearFlags, - ZEXT48(local_8b4),0); - pBVar6 = BitSet128::operator_and(&poisonMask,&this->_tearFlags,&g_tearFlagPoison); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - uVar10 = Random(); - Game::Spawn(g_game,1000,7,pVVar9,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar10); - pEVar11 = GHIDRA_CAST(__RTDynamicCast()); - decayFactor = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(((decayFactor + oneConst) * (float)local_910)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_08; - pVVar9 = (GHIDRA_CAST((&local_15b8)))->Vector::Vector((*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0))),(*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0)))); - (GHIDRA_CAST((pEVar11)))->Entity::SetSpriteScale(pVVar9); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar11) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - pEVar11->Update(); - uVar10 = Random(); - pEVar11 = Game::Spawn(g_game,1000,2,tearPos,&g_vectorZero,GHIDRA_CAST(0x0),4,uVar10); - pcVar1 = *(code **)(*GHIDRA_CAST(pEVar11) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - pVVar9 = (GHIDRA_CAST((&local_15c0)))->Vector::Vector((float)local_910,(float)local_910 * (float)local_900); - (GHIDRA_CAST((pEVar11)))->Entity::SetSpriteScale(pVVar9); - set_field_358(pEVar11,-5.0); - pEVar11->Update(); - this = tear; - } - } - pBVar6 = &this->_tearFlags; - pBVar8 = BitSet128::operator_and(&lasershotMask2,pBVar6,&g_tearFlagLasershot); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (local_8c8 != GHIDRA_CAST(0x1))) { - local_8c8 = GHIDRA_CAST(0x0); - } - pBVar8 = local_8c4; - if (((char)local_888 != '\0') && (local_8c8 != GHIDRA_CAST(0x1))) { - pBVar8 = GHIDRA_CAST(((float)local_8c4 * halfConst)); - bVar26 = local_8c8 == GHIDRA_CAST(&DAT_0000000b); - local_8c8 = GHIDRA_CAST(&DAT_0000000e); - local_898 = GHIDRA_CAST(GHIDRA_UINT(bVar26)); - } - if (local_88c != GHIDRA_CAST(0x0)) { - auVar31 = ZEXT416(local_8a0); - in_stack_ffffd9fc = &this->_pos; - SoundEffects::PlayWithFartOverride2 - (GHIDRA_INT(local_88c),GHIDRA_INT(in_stack_ffffd9fc),2,0,(float)local_8a0,(float)pBVar8); - } - pBVar8 = BitSet128::operator_and(&quadsplitMask,pBVar6,&g_tearFlagQuadsplit); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - MusicManager::RandomVector(&quadsplitVel); - pVVar9 = &this->_velocity; - local_88c = GHIDRA_CAST(pVVar9); - local_8c0 = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::LengthSquared(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = ZEXT812(0x3dcccccd); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0xc))) = 0; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) <= (float)local_8c0) { - tearSpeed = (void *)(GHIDRA_CAST((pVVar9)))->Vector::Length(); - ppvVar16 = &tearSpeed; - } - else { - defaultSplitSpeed = (void *)0x41200000; - ppvVar16 = &defaultSplitSpeed; - } - (GHIDRA_CAST((&quadsplitVel)))->Vector::operator_mul_assign(GHIDRA_CAST(ppvVar16)); - local_8a0 = (void *)0x0; - do { - (GHIDRA_CAST((GHIDRA_CAST(&splitVel))))->EntityPtr::clear(); - if (local_8a0 < (void *)0x2) { - pVVar9 = &quadsplitVel; - } - else { - pVVar9 = (GHIDRA_CAST((&local_15c8)))->Vector::Vector(quadsplitVel.y,-quadsplitVel.x); - } - (GHIDRA_CAST((&splitVel)))->Vector::operator_assign(pVVar9); - if ((GHIDRA_UINT(local_8a0) & 1) != 0) { - pVVar9 = (GHIDRA_CAST((&splitVel)))->Vector::__unm(&negated); - (GHIDRA_CAST((&splitVel)))->Vector::operator_assign(pVVar9); - } - local_8b4 = GHIDRA_CAST(GetRootPlayer(this)); - local_8c0 = GHIDRA_CAST(this->_variant); - if (local_8c0 == (void *)0x32) { - local_8c0 = (void *)0x1; - } - uVar10 = Random(); - pEVar11 = GHIDRA_CAST(this->_spawnerEntity); - pVVar9 = (GHIDRA_CAST((tearPos)))->Vector::__sub(&local_15d8,GHIDRA_CAST(local_88c)); - spawnedTear = tear; - Game::Spawn(g_game,tear->_type,GHIDRA_UINT(local_8c0),pVVar9,&splitVel,pEVar11,0,uVar10); - room = GHIDRA_CAST(__RTDynamicCast()); - local_89c = room; - if (local_8b4 == GHIDRA_CAST(0x0)) { - pRVar28 = local_8b0; - } - else { - FUN_005cd770(); - pRVar28 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - pRVar28 = GHIDRA_CAST(((float)pRVar28 * halfConst)); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Projectile::SetHeight((float)pRVar28); - pBVar6 = BitSet128::operator_and - (&hydrobounceMask3,&spawnedTear->_tearFlags,&g_tearFlagHydrobounce); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pRVar28 = GHIDRA_CAST(spawnedTear->_fallingAccel); - } - else if (local_8b4 == GHIDRA_CAST(0x0)) { - pRVar28 = GHIDRA_CAST(zeroConst); - } - else { - FUN_0060d070(); - } - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Projectile::set_falling_accel((float)pRVar28); - Game::GetPlayer(g_game,0); - FUN_0060d060(); - local_8b4 = pRVar28; - if (zeroConst < (float)pRVar28) { - local_8b4 = GHIDRA_CAST(((float)pRVar28 * pointThreeConst)); - } - local_87c = GHIDRA_CAST((GHIDRA_CAST((&g_tearFlagFetus)))->BitSet128)::__bnot(¬Fetus); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((&g_tearFlagHydrobounce)))->BitSet128)::__bnot(¬Hydrobounce); - local_8c4 = (GHIDRA_CAST((&g_tearFlagAbsorb)))->BitSet128::__bnot(¬Absorb); - local_8c0 = GHIDRA_CAST((GHIDRA_CAST((&g_tearFlagBone)))->BitSet128)::__bnot(¬Bone); - pBVar6 = (GHIDRA_CAST((&g_tearFlagLudovico)))->BitSet128::__bnot(¬Ludovico); - pBVar8 = (GHIDRA_CAST((&g_tearFlagSplit)))->BitSet128::__bnot(¬Split); - pBVar34 = (GHIDRA_CAST((&g_tearFlagQuadsplit)))->BitSet128::__bnot(¬Quadsplit); - pBVar34 = BitSet128::operator_and(&andResult3,tearFlagsPtr,pBVar34); - pBVar8 = BitSet128::operator_and(&andResult4,pBVar34,pBVar8); - pBVar6 = BitSet128::operator_and(&andResult5,pBVar8,pBVar6); - pBVar6 = BitSet128::operator_and(&andResult6,pBVar6,GHIDRA_CAST(local_8c0)); - pBVar6 = BitSet128::operator_and(&andResult7,pBVar6,local_8c4); - pBVar6 = BitSet128::operator_and(&andResult8,pBVar6,GHIDRA_CAST(local_8ac)); - BitSet128::operator_and(&inheritedFlags3,pBVar6,GHIDRA_CAST(local_87c)); - if ((char)local_888 != '\0') { - (GHIDRA_CAST((&g_tearFlagExplosive)))->BitSet128::__bnot(¬Explosive); - FUN_005cd430(); - } - random_float(); - room = local_89c; - FUN_00444c70(); - this = tear; - (**(code **)(*GHIDRA_CAST(room) + 0x40))(); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(inheritedFlags3._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (uint32_t)inheritedFlags3._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (uint32_t)inheritedFlags3._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&((char)inheritedFlags3._h)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x5))) = (char)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(inheritedFlags3._h))) + 0x4))) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x6))) = (short)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(inheritedFlags3._h))) + 0x4))) >> 0x10); - SetTearFlags(GHIDRA_CAST(room),flags); - decayFactor = this->_fScale * (float)pointSixConst; - auVar31 = ZEXT416(GHIDRA_UINT(decayFactor)); - SetScale(GHIDRA_CAST(room),decayFactor); - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Color(); - in_stack_ffffd9fc = GHIDRA_CAST(0xff); - (*pcVar1)(); - room = local_89c; - (GHIDRA_CAST((GHIDRA_CAST(local_89c))))->Entity::SetParent(GHIDRA_CAST(this->_parent)); - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - local_8a0 = GHIDRA_CAST((GHIDRA_INT(local_8a0) + 1)); - } while (GHIDRA_INT(local_8a0) < 4); - pBVar6 = &this->_tearFlags; - } - pBVar8 = BitSet128::operator_and(&burstsplitMask,pBVar6,&g_tearFlagBurstsplit); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - fire_split_projectiles(this,(uint8_t)local_888); - } - pBVar6 = BitSet128::operator_and(&laserMask2,pBVar6,&g_tearFlagLaser); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && - (((this->_dead != 0 || (this->_techZeroTarget == 0)) && - (GHIDRA_CAST(this->_techZeroLaser) != GHIDRA_CAST(0x0))))) { - (**(code **)(*GHIDRA_CAST(this->_techZeroLaser) + 0x28))(); - } - pAVar22 = local_8c8; - if (local_8c8 != GHIDRA_CAST(0x0)) { - uVar10 = Random(); - Game::Spawn(g_game,1000,GHIDRA_UINT(pAVar22),&this->_pos,&g_vectorZero,GHIDRA_CAST(this),GHIDRA_UINT(local_898), - uVar10); - room = GHIDRA_CAST(__RTDynamicCast()); - local_88c = room; - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetPositionOffset(&this->_posOffset); - if (((local_8c8 != GHIDRA_CAST(0x1)) && (local_8c8 != GHIDRA_CAST(&DAT_0000004f))) && - (local_8c8 != GHIDRA_CAST(&DAT_00000050))) { - if (local_8c8 == GHIDRA_CAST(&DAT_0000000e)) { - poofSizeScale = (void *)((this->_size + 8.0) / 28.0); - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&uniformScale3,GHIDRA_CAST(&poofSizeScale)); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetSpriteScale(pVVar9); - pVVar9 = (GHIDRA_CAST((&local_15e8)))->Vector::Vector((this->_posOffset).x,zeroConst); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetPositionOffset(pVVar9); - } - else { - if (((local_8c8 == GHIDRA_CAST(&DAT_00000014)) || (this->_variant == 0xf)) || - (this->_variant == 0xe)) { - ppvVar16 = &poofScaleSmall; - poofScaleSmall = (void *)(this->_fScale * (float)local_900); - pVVar9 = &local_15f8; - } - else { - ppvVar16 = &poofScaleLarge; - poofScaleLarge = (void *)(this->_fScale * 0.8); - pVVar9 = &local_15f0; - } - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(pVVar9,GHIDRA_CAST(ppvVar16)); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetSpriteScale(pVVar9); - } - Isaac::Random(4); - FUN_0043eea0(); - } - auVar31 = ZEXT416(local_910); - if ((float)local_910 != oneConst) { - pVVar9 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(room))))->Entity)::SpriteScale(); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1600,GHIDRA_CAST(&local_910)); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetSpriteScale(pVVar9); - } - switch(this->_variant) { - case 3: - case 0x13: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT416(GHIDRA_UINT(pointThreeConst)); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::Color(); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 4: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0x55,0); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 5: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::Color(); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 6: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT816(0x3dcccccd); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::Color(); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 7: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::Color(); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - default: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Color(); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - room = local_88c; - break; - case 0x12: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT416(GHIDRA_UINT(oneConst)); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0x46,0xff); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 0x14: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT416(GHIDRA_UINT(oneConst)); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0xe6,0xe6,0); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 0x1a: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0,0,0); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 0x1b: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT416(GHIDRA_UINT(halfConst)); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x3f000000,0x3f000000,0x3f000000); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 0x1f: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT816(0x3dcccccd); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::Color(); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 0x26: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT416(GHIDRA_UINT(pointThreeConst)); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::Color(); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 0x2d: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - auVar31 = ZEXT416(GHIDRA_UINT(oneConst)); - (GHIDRA_CAST((0x3f800000)))->Color::Color(0x3f800000,0x3f19999a,0x3f47ae14,0x3f800000,0,0,0); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - break; - case 0x30: - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&tear->_sprite))))->Sprite::Color(); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::Color(); - FUN_004072e0(); - room = local_88c; - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - this = tear; - } - pEVar17 = GHIDRA_CAST(__RTDynamicCast()); - if ((pEVar17 != GHIDRA_CAST(0x0)) && - (bVar4 = (GHIDRA_CAST((pEVar17)))->Entity_Player::IsLocalPlayer(), bVar4 == 0)) { - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(room))))->Entity)::GetColor(); - (GHIDRA_CAST((GHIDRA_CAST(local_150))))->Color::operator_assign(color); - FUN_00417900(); - FUN_00925df0(); - local_87c = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - decayFactor = (GHIDRA_CAST((GHIDRA_CAST(local_150))))->Color::A(); - auVar31 = ZEXT416(local_87c); - Font::SetLineHeightModifier(GHIDRA_CAST(local_150),decayFactor * (float)local_87c); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (**(code **)(*GHIDRA_CAST(room) + 0x3c))(); - } - } - iVar7 = this->_variant; - if (((((((iVar7 == 0) || (iVar7 == 0x18)) || (iVar7 == 0x10)) || - ((iVar7 == 0x1b || (iVar7 == 0x21)))) || (iVar7 == 0x22)) || - ((iVar7 == 0x23 || (iVar7 == 0x24)))) || ((iVar7 == 0x25 || (iVar7 == 0x26)))) { - bloodParticleCount = (void *)Isaac::Random(5); - if (this->_variant == 0x1b) { - minBloodParticles = (void *)0x3; - piVar12 = GHIDRA_CAST(std)::max(); - bloodParticleCount = (void *)*piVar12; - } - local_8b4 = GHIDRA_CAST(GetRootPlayer(this)); - local_89c = GHIDRA_CAST(0x0); - if (0 < GHIDRA_INT(bloodParticleCount)) { - do { - uVar10 = Random(); - pVVar9 = MusicManager::RandomVector(&randomDir); - decayFactor = random_float(); - bloodParticleDist = (void *)(decayFactor * 24.0); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1610,GHIDRA_CAST(&bloodParticleDist)); - pVVar9 = (GHIDRA_CAST((tearPos)))->Vector::__add(&local_1618,pVVar9); - Game::Spawn(g_game,1000,7,pVVar9,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar10); - pEVar11 = GHIDRA_CAST(__RTDynamicCast()); - bloodParticleScale = (void *)0x3e99999a; - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&uniformScale4,GHIDRA_CAST(&bloodParticleScale)); - (GHIDRA_CAST((pEVar11)))->Entity::SetSpriteScale(pVVar9); - auVar31 = ZEXT416(GHIDRA_UINT(zeroConst)); - (GHIDRA_CAST((GHIDRA_CAST(local_7c))))->Color::Color(); - Font::SetLineHeightModifier(GHIDRA_CAST(local_7c),0.08); - this = tear; - if (tear->_variant == 0x1b) { -LAB_0066a2e0: - auVar31 = ZEXT416(GHIDRA_UINT(zeroConst)); - color = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - (GHIDRA_CAST((GHIDRA_CAST(local_7c))))->Color::operator_assign(color); - } - else if (local_8b4 == GHIDRA_CAST(0x0)) { -LAB_0066a2bc: - if ((this->_variant == 0x21) || (this->_variant == 0x22)) goto LAB_0066a2e0; - } - else { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_8b4))))->Entity_Player::HasCollectible(0x136,0); - if (bVar4 == 0) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_8b4))))->Entity_Player::HasCollectible(6,0); - if (bVar4 != 0) goto LAB_0066a2e0; - goto LAB_0066a2bc; - } - decayFactor = random_float(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * pointThreeConst + 0.2)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_09; - Font::SetLineHeightModifier(GHIDRA_CAST(local_7c),(*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0)))); - } - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - pEVar11->SetColor(); - pEVar11->Update(); - local_89c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_89c)) + 0x1)))); - } while (GHIDRA_INT(local_89c) < GHIDRA_INT(bloodParticleCount)); - } - } - if (this->_dead != 0) { - pBVar6 = BitSet128::operator_and(&attractorMask,&this->_tearFlags,&g_tearFlagAttractor); - (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - this->Remove(); - ExceptionList = prevExceptionList; - return; - } -LAB_0066a370: - pBVar6 = BitSet128::operator_and(&squareMask,&this->_tearFlags,&g_tearFlagSquare); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 == 0) || (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), iVar7 < 3)) goto LAB_0066a545; - if (local_8d8 == GHIDRA_CAST(0x0)) { - auVar33 = (uint8_t [12])0x0; - decayFactor = oneConst; - } - else { - decayFactor = get_tear_trinket_multiplier(GHIDRA_CAST(local_8d8),0x1e); - auVar33 = extraout_var_10; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * halfConst + halfConst)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = auVar33; - squareSpeedScale = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (iVar7 < 5) { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - if (iVar7 == 3) { - pVVar14 = (GHIDRA_CAST((&velPerpRight)))->Vector::Vector((this->_velocity).y,-(this->_velocity).x); - pVVar9 = &local_1670; - goto LAB_0066a52b; - } - goto LAB_0066a545; - } - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); - switch((iVar7 + -5) % 0x16) { - case 0: - pVVar9 = (GHIDRA_CAST((&velPerpLeft)))->Vector::Vector(-(this->_velocity).y,(this->_velocity).x); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__div(&VStack_1630,GHIDRA_CAST(&squareSpeedScale)); - break; - default: - goto LAB_0066a545; - case 7: - pVVar14 = (GHIDRA_CAST((&velPerpLeft2)))->Vector::Vector(-(this->_velocity).y,(this->_velocity).x); - pVVar9 = &VStack_1640; - goto LAB_0066a52b; - case 10: - pVVar9 = (GHIDRA_CAST((&velPerpRight2)))->Vector::Vector((this->_velocity).y,-(this->_velocity).x); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__div(&VStack_1650,GHIDRA_CAST(&squareSpeedScale)); - break; - case 0x13: - pVVar14 = (GHIDRA_CAST((&velPerpRight3)))->Vector::Vector((this->_velocity).y,-(this->_velocity).x); - pVVar9 = &VStack_1660; -LAB_0066a52b: - pVVar9 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(pVVar9,GHIDRA_CAST(&squareSpeedScale)); - } - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(pVVar9); -LAB_0066a545: - pBVar8 = &this->_tearFlags; - pBVar6 = BitSet128::operator_or(&withOrbitAdvanced,&g_tearFlagOrbit,&g_tearFlagOrbitAdvanced); - pBVar6 = BitSet128::operator_and(&andResult9,pBVar8,pBVar6); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (this->_target == 0)) { - local_8a0 = GHIDRA_CAST(this->_spawnerEntity); - if (local_8a0 == GHIDRA_CAST(0x0)) { - local_8a0 = GHIDRA_CAST(this->_parent); - } - pBVar6 = BitSet128::operator_and(&ludovicoMask7,pBVar8,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - if ((local_8a0 != GHIDRA_CAST(0x0)) || - (bVar4 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), bVar4 != 0)) { - pBVar6 = BitSet128::operator_and(&tractorBeamMask,pBVar8,&g_tearFlagTractorBeam); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and(&orbitAdvancedMask,pBVar8,&g_tearFlagOrbitAdvanced); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 == 0) && (this->_waitFrames < 2)) { - if ((this->_tearIdx & 1) == 0) { - local_8b4 = GHIDRA_CAST(oneConst); - } - else { - local_8b4 = GHIDRA_CAST(&DAT_bf800000); - } - (GHIDRA_CAST((GHIDRA_CAST(&local_98c))))->EntityPtr::clear(); - (GHIDRA_CAST((GHIDRA_CAST(&local_b6c))))->EntityPtr::clear(); - bVar4 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); - if (bVar4 == 0) { - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&nextPos3,&this->_velocity); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_16c0,&this->_targetPosition); - (GHIDRA_CAST((&local_98c)))->Vector::operator_assign(pVVar9); - pVVar9 = &this->_orbitVelocity; - pVVar14 = &g_vectorZero; - } - else { - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&nextPos4,&this->_velocity); - pVVar14 = GHIDRA_CAST(FUN_004172b0()); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(local_16a8,pVVar14); - (GHIDRA_CAST((&local_98c)))->Vector::operator_assign(pVVar9); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::Velocity(&entityVel); - pVVar9 = &local_b6c; - } - (GHIDRA_CAST((pVVar9)))->Vector::operator_assign(pVVar14); - bVar4 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); - if ((bVar4 != 0) && (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::is_player(), bVar4 != 0)) { - pVVar9 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity_Player)::GetAimDirection(); - local_a30 = (void *)0x42700000; - pVVar9 = Vector::operator_mul(&local_16c8,GHIDRA_CAST(&local_a30),pVVar9); - (GHIDRA_CAST((&local_98c)))->Vector::operator__(pVVar9); - } - local_928 = (void *)(GHIDRA_CAST((&local_98c)))->Vector::Length(); - auVar31 = ZEXT416(local_928); - if ((float)local_928 != zeroConst) { - (GHIDRA_CAST((&local_98c)))->Vector::__div(&local_c90,GHIDRA_CAST(&local_928)); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator__(&this->_orbitVelocity); - local_888 = GHIDRA_CAST(0x42f00000); - local_924 = (void *)0x3dcccccd; - pBVar6 = BitSet128::operator_and - (&boomerangMask,&this->_tearFlags,&g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - room = GHIDRA_CAST(0x42f00000); - } - else { - local_938 = (void *)assert_lerp_range(this->_height,-5.0,-24.0,0.05,1.5,1); - pBVar6 = BitSet128::operator_and - (&explosiveMask5,&this->_tearFlags,&g_tearFlagExplosive); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - local_a34 = (void *)0x3ecccccd; - pfVar15 = GHIDRA_CAST(std)::max(); - local_938 = (void *)*pfVar15; - } - local_888 = GHIDRA_CAST(((float)local_938 * 120.0)); - local_924 = (void *)((2.5 - (float)local_938) * (float)local_924); - room = local_888; - } - local_924 = (void *)(((float)room - (float)local_928) * (float)local_924); - decayFactor = (GHIDRA_CAST((&local_c90)))->Vector::GetAngleDegrees(); - local_87c = GHIDRA_CAST(((float)local_8b4 * 90.0)); - local_89c = GHIDRA_CAST((decayFactor + (float)local_87c)); - decayFactor = zeroConst; - FUN_00a155f0(); - decayFactor = Math::clamp(zeroConst,oneConst,decayFactor); - local_8ac = GHIDRA_CAST(pow(decayFactor,2.0)); - decayFactor = (GHIDRA_CAST((&this->_velocity)))->Vector::GetAngleDegrees(); - local_87c = GHIDRA_CAST(((float)local_89c - decayFactor)); - decayFactor = normalize_angle_degrees((float)local_87c); - local_87c = GHIDRA_CAST((decayFactor * (float)local_8ac)); - decayFactor = (GHIDRA_CAST((&this->_velocity)))->Vector::GetAngleDegrees(); - local_89c = GHIDRA_CAST((decayFactor + (float)local_87c)); - auVar31 = ZEXT416(local_89c); - Vector::FromAngle(&local_da0,(float)local_89c); - local_968 = (void *)(GHIDRA_CAST((&this->_velocity)))->Vector::Length(); - pVVar9 = (GHIDRA_CAST((&local_da0)))->Vector::__mul(&local_16d0,GHIDRA_CAST(&local_968)); - pVVar14 = (GHIDRA_CAST((&local_c90)))->Vector::__mul(&local_16d8,GHIDRA_CAST(&local_924)); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_e40,pVVar14); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::Normalized(&direction); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_e50,GHIDRA_CAST(&local_968)); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_e58,&local_b6c); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(pVVar9); - pVVar9 = &local_b6c; - pVVar14 = &this->_orbitVelocity; - goto LAB_0066aff6; - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(&local_9bc))))->EntityPtr::clear(); - (GHIDRA_CAST((GHIDRA_CAST(&local_c98))))->EntityPtr::clear(); - bVar4 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); - if (bVar4 == 0) { - (GHIDRA_CAST((&local_9bc)))->Vector::operator_assign(&this->_targetPosition); - pVVar9 = &g_vectorZero; - } - else { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::Position(&entityPos4); - (GHIDRA_CAST((&local_9bc)))->Vector::operator_assign(pVVar9); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::Velocity(&entityVel2); - Entity::get_friction(); - local_a38 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__div(&local_e70,GHIDRA_CAST(&local_a38)); - } - (GHIDRA_CAST((&local_c98)))->Vector::operator_assign(pVVar9); - if (this->_orbitRadius == zeroConst) { - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_b74,&local_9bc); - local_950.x = (this->_velocity).x; - local_950.y = (this->_velocity).y; - if (1 < this->_waitFrames) { - (GHIDRA_CAST((&local_950)))->Vector::operator_assign(&this->_continueVelocity); - } - pVVar9 = (GHIDRA_CAST((&local_b74)))->Vector::Normalized(&direction2); - pVVar14 = (GHIDRA_CAST((&local_950)))->Vector::Normalized(&direction3); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Dot(pVVar14); - if ((float)local_87c < 0.8) { - pVVar9 = (GHIDRA_CAST((&local_b74)))->Vector::Rotated(&perpDir,90.0); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Dot(&local_950); - local_8b4 = GHIDRA_CAST(&DAT_bf800000); - if (zeroConst <= (float)local_87c) { - local_8b4 = GHIDRA_CAST(0x3f800000); - } - decayFactor = (GHIDRA_CAST((&local_950)))->Vector::Length(); - decayFactor = decayFactor * (float)local_8b4; - pVVar9 = &local_b74; - } - else { - local_8b4 = GHIDRA_CAST(0x3f800000); - if ((this->_tearIdx & 1) == 0) { - local_8b4 = GHIDRA_CAST(&DAT_bf800000); - } - decayFactor = (GHIDRA_CAST((&local_950)))->Vector::Length(); - decayFactor = decayFactor * (float)local_8b4; - pVVar9 = &local_950; - } - this->_orbitRadius = decayFactor; - decayFactor = (GHIDRA_CAST((pVVar9)))->Vector::GetAngleDegrees(); - this->_orbitAngle = decayFactor; - } - local_93c = (void *)0x42b40000; - if (0 < this->_waitFrames) { - local_93c = (void *)0x41f00000; - } - pVVar9 = Vector::FromAngle(&orbitDir,this->_orbitAngle); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_e98,GHIDRA_CAST(&local_93c)); - (GHIDRA_CAST((&local_9bc)))->Vector::__add(&local_da8,pVVar9); - local_a3c = (void *)0x40a00000; - pvVar20 = (void *)this->_orbitRadius; - Math::abs(); - local_a40 = pvVar20; - puVar13 = GHIDRA_CAST(std)::max(); - local_8ac = GHIDRA_CAST(*puVar13); - local_a44 = (void *)0x40000000; - Vector::operator_mul(&local_ca0,GHIDRA_CAST(&local_a44),&local_c98); - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_ea0,&local_ca0); - pVVar9 = (GHIDRA_CAST((&local_da8)))->Vector::__sub(&local_ea8,pVVar9); - local_a48 = (void *)0x3f000000; - Vector::operator_mul(&local_b7c,GHIDRA_CAST(&local_a48),pVVar9); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&local_b7c)))->Vector)::Length(); - if ((float)local_8ac < (float)local_87c) { - (GHIDRA_CAST((&local_b7c)))->Vector::Resize((float)local_8ac); - } - pVVar9 = (GHIDRA_CAST((&local_ca0)))->Vector::__add(&local_eb0,&local_b7c); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__div(&local_eb8,&this->_friction); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(pVVar9); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = - GHIDRA_CAST(normalize_angle_degrees) - ((((this->_orbitRadius / (float)local_93c) * 180.0) / 3.1415927) - * this->_speedMultiplier + this->_orbitAngle); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_11; - this->_orbitAngle = (*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0))); - if (1 < this->_waitFrames) { - pVVar9 = Vector::FromAngle(&angleDir,(*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0)))); - auVar31 = ZEXT416(GHIDRA_UINT(this->_orbitRadius)); - Math::abs(); - local_a4c = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - in_stack_ffffd9fc = GHIDRA_CAST(0x66afed); - pVVar9 = Vector::operator_mul(&local_ec8,GHIDRA_CAST(&local_a4c),pVVar9); - pVVar14 = &this->_continueVelocity; -LAB_0066aff6: - (GHIDRA_CAST((pVVar14)))->Vector::operator_assign(pVVar9); - } - } - } - } - } - else { - bVar4 = is_not_familiar_spawned(this); - if ((bVar4 != 0) && (local_8a0 != GHIDRA_CAST(0x0))) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::Position(&entityPos5); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_ce8,pVVar9); - local_92c = (void *)(GHIDRA_CAST((&local_ce8)))->Vector::Length(); - if ((float)local_92c == zeroConst) { - local_92c = (void *)0x3dcccccd; - } - (GHIDRA_CAST((&local_ce8)))->Vector::__div(&local_b64,GHIDRA_CAST(&local_92c)); - local_a2c = (void *)((100.0 - (float)local_92c) * 0.01); - (GHIDRA_CAST((&local_b5c)))->Vector::Vector(local_b64.y,-local_b64.x); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&local_b5c)))->Vector)::Dot(&this->_velocity); - auVar31 = ZEXT416(GHIDRA_UINT(zeroConst)); - if ((float)local_87c < zeroConst) { - local_a24 = &DAT_bf800000; - (GHIDRA_CAST((&local_b5c)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_a24)); - } - local_a28 = (void *)0x3f800000; - pVVar9 = (GHIDRA_CAST((&local_b5c)))->Vector::__mul(&local_1680,GHIDRA_CAST(&local_a28)); - pVVar14 = (GHIDRA_CAST((&local_b64)))->Vector::__mul(&local_1688,GHIDRA_CAST(&local_a2c)); - bVar4 = 0; - in_stack_ffffd9fc = GHIDRA_CAST(0x66a724); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1690,pVVar14); - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(pVVar9,bVar4); - } - } - } - pBVar6 = BitSet128::operator_and(&fetusMask,&this->_tearFlags,&g_tearFlagFetus); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pBVar6 = BitSet128::operator_and(&homingMask,&this->_tearFlags,&g_tearFlagHoming); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pBVar6 = BitSet128::operator_and - (&turnHorizontalMask,&this->_tearFlags,&g_tearFlagTurnHorizontal); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) goto LAB_0066d04f; - } - if ((GHIDRA_CAST(this->_target) != GHIDRA_CAST(0x0)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_hitList))))->EntityList::HitListContains(GHIDRA_CAST(this->_target)), - bVar4 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - } - if (this->_target == 0) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,this->_index); - if (bVar4 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = ZEXT812(0x4e6e6b28); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0xc))) = 0; - local_8a0 = GHIDRA_CAST(0x0); - local_898 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - local_c30 = (void *)0x40a00000; - pVVar9 = Vector::operator_mul(&local_1030,GHIDRA_CAST(&local_c30),&this->_velocity); - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_1038,pVVar9); - in_stack_ffffd9fc = GHIDRA_CAST(0x66cbd8); - EntityList::QueryRadius(entityList,GHIDRA_CAST(aheadQuery),pVVar9,128.0,8); - ehState = 3; - local_888 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(aheadQuery))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - room = GHIDRA_CAST(*puVar13); - local_89c = room; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - if (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::IsDescendantOf(GHIDRA_CAST(room)); - if (bVar4 != 0) goto LAB_0066cdbc; - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::HasEntityFlags(0x20000010); - if (bVar4 == 0) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(&this->_hitList))))->EntityList::HitListContains(GHIDRA_CAST(room)); - if (bVar4 == 0) { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity::is_player(); - if (bVar4 != 0) { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity_Player::IsInvisible(); - if (bVar4 != 0) goto LAB_0066cdbc; - } - iVar7 = Isaac::Random(2); - if (iVar7 != 0) { - if (this->_entityGridCollisionClass == 4) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_89c))))->Entity::Position(&entityPos6); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - bVar4 = (GHIDRA_CAST((room)))->Room::CheckLine(&this->_pos,pVVar9,3,0,0,0,GHIDRA_CAST(0x0)); - if (bVar4 == 0) goto LAB_0066cdbc; - } - local_c2c = (void *)0x40a00000; - pVVar9 = Vector::operator_mul(&local_1048,GHIDRA_CAST(&local_c2c),&this->_velocity); - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_1050,pVVar9); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_89c))))->Entity::Position(&entityPos7); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(pVVar14); - decayFactor = random_float(); - pRVar28 = local_89c; - local_87c = GHIDRA_CAST((decayFactor * 128.0)); - local_8d0 = GHIDRA_CAST(((float)local_87c + (float)local_8ac)); - bVar4 = EntityList::HitListContains - (GHIDRA_CAST(&this->_hitList),GHIDRA_CAST(local_89c)); - room = local_8d0; - if (bVar4 != 0) { - room = GHIDRA_CAST(((float)local_8d0 + 1000.0)); - } - auVar31 = ZEXT416(room); - if ((float)room < (float)local_898) { - local_8a0 = pRVar28; - local_898 = room; - } - } - } - } - } -LAB_0066cdbc: - local_888 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_888)) + 0x1)))); - room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(aheadQuery))))->EntityList)::Size(); - } while (local_888 < room); - } - Game::GetField26614(g_game); - cVar5 = DeathmatchManager::is_active(); - if (cVar5 != '\0') { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - in_stack_ffffd9fc = GHIDRA_CAST(&DAT_00000043); - EntityList::QuerySublist - (entityList,GHIDRA_CAST(deathmatchFamiliarQuery),3,0x43,-1,1,0); - room = GHIDRA_CAST(0x0); - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),4); - local_888 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(deathmatchFamiliarQuery))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity::IsDescendantOf(GHIDRA_CAST(this->_spawnerEntity)); - if (bVar4 == 0) { - local_c28 = (void *)0x40a00000; - pVVar9 = Vector::operator_mul(&local_1060,GHIDRA_CAST(&local_c28),&this->_velocity); - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_1068,pVVar9); - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity::Position(&entityPos8); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(pVVar14); - decayFactor = random_float(); - room = local_888; - local_87c = GHIDRA_CAST((decayFactor * 128.0)); - local_8d0 = GHIDRA_CAST(((float)local_87c + (float)local_8ac)); - auVar31 = ZEXT416(local_898); - if ((float)local_8d0 < (float)local_898) { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - auVar31 = ZEXT416(local_8d0); - local_898 = local_8d0; - local_8a0 = GHIDRA_CAST(*puVar13); - } - } - room = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x1)))); - local_888 = room; - puVar19 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(deathmatchFamiliarQuery))))->EntityList)::Size(); - } while (room < puVar19); - } - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),3); - (GHIDRA_CAST((deathmatchFamiliarQuery)))->EntityList_Query::~EntityList_Query(); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(local_8a0)); - ehState = -1; - (GHIDRA_CAST((aheadQuery)))->EntityList_Query::~EntityList_Query(); - } - if (this->_target == 0) goto LAB_0066d04f; - } - pBVar6 = BitSet128::operator_and(&homingMask2,&this->_tearFlags,&g_tearFlagHoming); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Position(&targetPos); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&fromTarget,pVVar9); - pVVar9 = (GHIDRA_CAST((&fromTarget)))->Vector::Normalized(&direction4); - pVVar9 = Vector::operator_mul(&local_1088,&this->_speedMultiplier,pVVar9); - local_c24 = (void *)0x40000000; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1090,GHIDRA_CAST(&local_c24)); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator__(pVVar9); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(Math)::timescale_factor(this->_homingFriction,this->_speedMultiplier); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_14; - local_c20 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - (GHIDRA_CAST((&this->_velocity)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_c20)); - } - } - else { - local_88c = GHIDRA_CAST(GetRootPlayer(this)); - local_8c8 = &this->_sprite; - _empty_check_0x34(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0))) = GHIDRA_CAST((((*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) * 360.0) / (float)local_8fc + 90.0)); - local_8c4 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0))); - if (local_88c == GHIDRA_CAST(0x0)) { - local_8c0 = GHIDRA_CAST(zeroConst); - } - else { - FUN_00665c00(); - local_8c0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar32)) + 0x0))); - } - local_8a1 = '\0'; - pBVar6 = BitSet128::operator_and(&fetusTechxMask,&this->_tearFlags,&g_tearFlagFetusTechx); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - iVar7 = EntityPtr::Ref(); - if ((iVar7 == 0) && (this->_dead == 0)) { - uVar10 = Random(); - in_stack_ffffd9fc = GHIDRA_CAST(local_88c); - local_8a0 = GHIDRA_CAST(Game)::SpawnEx(g_game,7,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(local_88c),3 - ,uVar10,1); - if (local_8a0 == GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((&g_tearFlagFetusTechx)))->BitSet128::__bnot(¬FetusTechx); - FUN_005cd430(); - } - else { - if (local_88c != GHIDRA_CAST(0x0)) { - pcVar1 = *(code **)(*GHIDRA_CAST(local_8a0) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->Entity_Player::get_laser_color_copy(&local_514); - (*pcVar1)(); - } - (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::SetPositionOffset(&this->_posOffset); - (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::SetParent(GHIDRA_CAST(this)); - set_field_358(local_8a0,3000.0); - pBVar8 = &g_tearFlagFetus; - pBVar6 = BitSet128::operator_or(&withShrink,&g_tearFlagGrow,&g_tearFlagShrink); - pBVar6 = BitSet128::operator_or(&orResult5,pBVar6,pBVar8); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result2); - pBVar6 = BitSet128::operator_and(&andResult10,&this->_tearFlags,pBVar6); - in_stack_ffffd9fc = *GHIDRA_CAST(&pBVar6->_l); - FUN_00456830(); - (**(code **)(*GHIDRA_CAST(local_8a0) + 0x40))(); - (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity_Laser::SetTimeout(); - (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity_Laser::set_scale(this->_fScale * (float)local_8ec); - FUN_0060ce80(); - (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Entity::SetSpawnerEntity(GHIDRA_CAST(local_88c)); - (**(code **)(*GHIDRA_CAST(local_8a0) + 0xc))(); - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a4)))))))->EntityPtr::Set(GHIDRA_CAST(local_8a0)); - } - } - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - laser = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((laser)))->Entity_Laser::set_scale(this->_fScale * (float)local_8ec); - EntityPtr::Ref(); - FUN_0060ce80(); - } - } - pBVar6 = BitSet128::operator_and(&fetusSwordMask,&this->_tearFlags,&g_tearFlagFetusSword); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pBVar6 = BitSet128::operator_and(&fetusKnifeMask,&this->_tearFlags,&g_tearFlagFetusKnife); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pBVar6 = BitSet128::operator_and(&fetusBoneMask,&this->_tearFlags,&g_tearFlagFetusBone); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - local_87c = GHIDRA_CAST(&this->_attachedEffect); - iVar7 = EntityPtr::Ref(); - if ((iVar7 == 0) && (this->_dead == 0)) { - uVar10 = Random(); - in_stack_ffffd9fc = &g_vectorZero; - room = GHIDRA_CAST(Game)::Spawn(g_game,8,1,&this->_pos,&g_vectorZero,GHIDRA_CAST(local_88c),0, - uVar10); - local_8b4 = room; - if (room != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetParent(GHIDRA_CAST(this)); - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Color(); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - pBVar6 = BitSet128::operator_or(&withShrink2,&g_tearFlagGrow,&g_tearFlagShrink); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result3); - BitSet128::operator_and(&andResult11,&this->_tearFlags,pBVar6); - room = local_8b4; - FUN_005cd5c0(); - (**(code **)(*GHIDRA_CAST(room) + 0x40))(); - FUN_0060cf20(); - local_a68 = (void *)(this->_fScale * (float)pointSixConst); - pVVar9 = Vector::operator_mul(&uniformScale5,GHIDRA_CAST(&local_a68),&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetSpriteScale(pVVar9); - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - FUN_00651a10(); - } - } - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - this = tear; - pVVar9 = (GHIDRA_CAST((&local_f30)))->Vector::Vector(zeroConst,6.0); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_f38,&this->_fScale); - pVVar9 = (GHIDRA_CAST((&this->_posOffset)))->Vector::__add(&local_f40,pVVar9); - (GHIDRA_CAST((pEVar11)))->Entity::SetPositionOffset(pVVar9); - EntityPtr::Ref(); - FUN_005b15d0(); - EntityPtr::Ref(); - cVar5 = FUN_00665ba0(); - if (cVar5 == '\0') { - Vector::FromAngle(&facingDir,(float)local_8c4); - if (GHIDRA_CAST(this->_target) != GHIDRA_CAST(0x0)) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Position(&targetPos2); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_f50,&this->_pos); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::Normalized(&direction5); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Dot(&facingDir); - if (0.1 < (float)local_87c) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Position(&targetPos3); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(&this->_pos); - if ((float)local_87c < this->_fScale * 50.0) { - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - pfVar15 = GHIDRA_CAST((GHIDRA_CAST((pEVar11)))->Entity)::SpriteScale(); - local_a70 = (void *)0x3f000000; - local_a6c = (void *)(oneConst / (*pfVar15 * halfConst + halfConst)); - puVar13 = GHIDRA_CAST(std)::max(); - local_87c = GHIDRA_CAST(*puVar13); - decayFactor = random_float(); - in_stack_ffffd9fc = GHIDRA_CAST(0xfc); - SoundEffects::PlayWithFartOverride - (0xfc,oneConst,1,0,(decayFactor * 0.2 + 0.9) * (float)local_87c); - EntityPtr::Ref(); - FUN_00665bc0(); - knife = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((knife)))->Entity_Knife::SetAttackAnimation(); - local_8a1 = '\x01'; - goto LAB_0066b8aa; - } - } - } - } - local_8a1 = '\x01'; - } - } - } - else { - local_87c = GHIDRA_CAST(&this->_attachedEffect); - iVar7 = EntityPtr::Ref(); - if ((iVar7 == 0) && (this->_dead == 0)) { - uVar10 = Random(); - in_stack_ffffd9fc = &g_vectorZero; - room = GHIDRA_CAST(Game)::Spawn(g_game,8,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(local_88c),0, - uVar10); - local_8b4 = room; - if (room != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetParent(GHIDRA_CAST(this)); - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Color(); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - pBVar6 = BitSet128::operator_or(&withShrink3,&g_tearFlagGrow,&g_tearFlagShrink); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result4); - BitSet128::operator_and(&andResult12,&this->_tearFlags,pBVar6); - room = local_8b4; - FUN_005cd5c0(); - (**(code **)(*GHIDRA_CAST(room) + 0x40))(); - FUN_0060cf20(); - local_a60 = (void *)(this->_fScale * halfConst); - pVVar9 = Vector::operator_mul(&uniformScale6,GHIDRA_CAST(&local_a60),&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetSpriteScale(pVVar9); - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - FUN_00651a10(); - } - } - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - piVar12 = GHIDRA_CAST(EntityPtr)::Ref(); - (**(code **)(*piVar12 + 0x40))(); - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - local_a64 = (void *)(this->_fScale * halfConst); - pVVar9 = Vector::operator_mul(&uniformScale7,GHIDRA_CAST(&local_a64),&g_vectorOne); - (GHIDRA_CAST((pEVar11)))->Entity::SetSpriteScale(pVVar9); - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - this = tear; - pVVar9 = (GHIDRA_CAST((&local_f10)))->Vector::Vector(zeroConst,4.0); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_f18,&this->_fScale); - pVVar9 = (GHIDRA_CAST((&this->_posOffset)))->Vector::__add(&local_f20,pVVar9); - (GHIDRA_CAST((pEVar11)))->Entity::SetPositionOffset(pVVar9); - EntityPtr::Ref(); - FUN_005b15d0(); - } - } - } - else { - local_87c = GHIDRA_CAST(&this->_attachedEffect); - iVar7 = EntityPtr::Ref(); - if ((iVar7 == 0) && (this->_dead == 0)) { - uVar10 = 10; - pBVar6 = BitSet128::operator_and(&fetusTechMask,&this->_tearFlags,&g_tearFlagFetusTech); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - uVar10 = 0xb; - } - uVar18 = Random(); - in_stack_ffffd9fc = &g_vectorZero; - room = GHIDRA_CAST(Game)::Spawn(g_game,8,uVar10,&this->_pos,&g_vectorZero,GHIDRA_CAST(local_88c),0, - uVar18); - local_8b4 = room; - if (room == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(8,GHIDRA_CAST("BAD THINGS! \n")); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetParent(GHIDRA_CAST(this)); - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Color(); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - pBVar6 = BitSet128::operator_or(&withShrink4,&g_tearFlagGrow,&g_tearFlagShrink); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result5); - BitSet128::operator_and(&andResult13,&this->_tearFlags,pBVar6); - room = local_8b4; - FUN_005cd5c0(); - (**(code **)(*GHIDRA_CAST(room) + 0x40))(); - FUN_0060cf20(); - local_a50 = (void *)(this->_fScale * (float)pointSixConst); - pVVar9 = Vector::operator_mul(&uniformScale8,GHIDRA_CAST(&local_a50),&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetSpriteScale(pVVar9); - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - FUN_00651a10(); - EntityPtr::Ref(); - FUN_005b15d0(); - } - } - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - piVar12 = GHIDRA_CAST(EntityPtr)::Ref(); - (**(code **)(*piVar12 + 0x40))(); - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - local_a54 = (void *)(this->_fScale * (float)pointSixConst); - pVVar9 = Vector::operator_mul(&uniformScale9,GHIDRA_CAST(&local_a54),&g_vectorOne); - (GHIDRA_CAST((pEVar11)))->Entity::SetSpriteScale(pVVar9); - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - spawnedTear = tear; - pVVar9 = (GHIDRA_CAST((&local_ee0)))->Vector::Vector(zeroConst,6.0); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_ee8,&spawnedTear->_fScale); - pVVar9 = (GHIDRA_CAST((&spawnedTear->_posOffset)))->Vector::__add(&local_ef0,pVVar9); - (GHIDRA_CAST((pEVar11)))->Entity::SetPositionOffset(pVVar9); - pBVar6 = local_8c4; - Vector::FromAngle(&angleDir2,(float)local_8c4); - EntityPtr::Ref(); - FUN_0060ccf0(); - if ((float)pBVar6 <= 1.1) { - EntityPtr::Ref(); - cVar5 = FUN_00665bb0(); - if (cVar5 == '\0') { - EntityPtr::Ref(); - cVar5 = FUN_00665ba0(); - if (cVar5 == '\0') { - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - pfVar15 = GHIDRA_CAST((GHIDRA_CAST((pEVar11)))->Entity)::SpriteScale(); - local_a5c = (void *)0x3f000000; - local_a58 = (void *)(oneConst / (*pfVar15 * halfConst + halfConst)); - puVar13 = GHIDRA_CAST(std)::max(); - local_87c = GHIDRA_CAST(*puVar13); - decayFactor = random_float(); - in_stack_ffffd9fc = GHIDRA_CAST(0xfc); - SoundEffects::PlayWithFartOverride - (0xfc,oneConst,1,0,(decayFactor * 0.2 + 0.9) * (float)local_87c); - EntityPtr::Ref(); - FUN_00665bc0(); - knife = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((knife)))->Entity_Knife::SetAttackAnimation(); - } - } - else { - EntityPtr::Ref(); - EntityPtr::Ref(); - FUN_0060ccf0(); - FUN_00665be0(); - EntityPtr::Ref(); - EntityPtr::Ref(); - FUN_0060ccf0(); - FUN_00665bf0(); - } - } - else { - knife = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((knife)))->Entity_Knife::SpinAttack(1,0); - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - EntityPtr::Ref(); - FUN_00665be0(); - EntityPtr::Ref(); - FUN_00665bf0(); - } - } - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - knife = GHIDRA_CAST(EntityPtr)::Ref(); - cVar5 = (GHIDRA_CAST((knife)))->Entity_Knife::IsFlying(); - if (cVar5 == '\0') { - EntityPtr::Ref(); - cVar5 = FUN_00665ba0(); - if (cVar5 == '\0') { - EntityPtr::Ref(); - cVar5 = FUN_00665bb0(); - if (cVar5 == '\0') { - piVar12 = GHIDRA_CAST(EntityPtr)::Ref(); - (**(code **)(*piVar12 + 0x28))(); - } - } - } - } - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - cVar5 = (GHIDRA_CAST((pEVar11)))->Entity::Exists(); - if (cVar5 != '\0') { - _MaxCount = 4; - uVar37 = 0xe8; - uVar38 = 2; - uVar39 = 0xb6; - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((pEVar11)))->Entity::GetSprite(); - Config::GetPillEffects(); - _Str1 = GHIDRA_CAST(_string_holder_c_str()); - in_stack_ffffd9fc = GHIDRA_CAST(0x66b80b); - iVar7 = strncmp(_Str1,GHIDRA_CAST(CONCAT22(uVar39,CONCAT11(uVar38,uVar37))),_MaxCount); - if (iVar7 == 0) { - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - (GHIDRA_CAST((pEVar11)))->Entity::GetNullOffset(&nullOffset,&DAT_00b1d3b0); - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar7 = AnimationState::GetAnimationLength(animState); - local_8ac = GHIDRA_CAST((360.0 / (float)iVar7)); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&nullOffset)))->Vector)::GetAngleDegrees(); - normalize_angle_degrees((float)local_87c); - FUN_0040a740(); - } - else { - EntityPtr::Ref(); - FUN_005b15d0(); - } - } - } - this = tear; - } - } -LAB_0066b8aa: - pBVar6 = BitSet128::operator_and(&fetusTechMask2,&this->_tearFlags,&g_tearFlagFetusTech); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a8)))) < 1) { - Vector::FromAngle(&fetusTechFacing,(float)local_8c4); - local_8b4 = GHIDRA_CAST(0x0); - local_898 = GHIDRA_CAST(&DAT_bf800000); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - in_stack_ffffd9fc = GHIDRA_CAST(0x66bfad); - EntityList::QueryRadius(entityList,GHIDRA_CAST(fetusTechQuery),&this->_pos,140.0,8); - ehState = 1; - local_89c = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(fetusTechQuery))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - local_888 = GHIDRA_CAST(*puVar13); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_888))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_888))))->Entity::HasEntityFlags(0x20000010); - if (bVar4 == 0) { - if (this->_entityGridCollisionClass == 4) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_888))))->Entity::Position(&entityPos9); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - bVar4 = (GHIDRA_CAST((room)))->Room::CheckLine(&this->_pos,pVVar9,3,0,0,0,GHIDRA_CAST(0x0)); - if (bVar4 == 0) goto LAB_0066c0c5; - } - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_888))))->Entity::Position(&entityPos10); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_f78,&this->_pos); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::Normalized(&direction6); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Dot(&fetusTechFacing); - if ((float)local_898 < (float)local_87c) { - local_8b4 = local_888; - local_898 = local_87c; - } - } - } -LAB_0066c0c5: - local_89c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_89c)) + 0x1)))); - room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(fetusTechQuery))))->EntityList)::Size(); - } while (local_89c < room); - if ((0.85 < (float)local_898) && (local_8b4 != GHIDRA_CAST(0x0))) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a8)))) = 8; - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8b4))))->Entity::Position(&entityPos11); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_f90,&this->_pos); - (GHIDRA_CAST((pVVar9)))->Vector::Normalized(&fetusTechAimDir); - bVar4 = 1; - uVar37 = SUB41(local_88c,0); - uVar38 = (uint8_t)(GHIDRA_UINT(local_88c) >> 8); - uVar39 = (uint16_t)(GHIDRA_UINT(local_88c) >> 0x10); - pVVar9 = &this->_posOffset; - in_stack_ffffd9fc = GHIDRA_CAST(0x3); - decayFactor = (GHIDRA_CAST((&fetusTechAimDir)))->Vector::GetAngleDegrees(); - room = GHIDRA_CAST(Entity_Laser)::ShootAngle - (2,&this->_pos,decayFactor,GHIDRA_INT(in_stack_ffffd9fc),pVVar9, - GHIDRA_CAST(CONCAT22(uVar39,CONCAT11(uVar38,uVar37))),bVar4); - local_888 = room; - if (room != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetOneHit(); - FUN_00435f70(); - pBVar6 = BitSet128::operator_or(&withShrink5,&g_tearFlagGrow,&g_tearFlagShrink); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result6); - pBVar6 = BitSet128::operator_and(&andResult14,&this->_tearFlags,pBVar6); - in_stack_ffffd9fc = *GHIDRA_CAST(&pBVar6->_l); - FUN_00456830(); - local_a78 = (void *)0x1; - local_a74 = GHIDRA_CAST(GHIDRA_INT((20.0 - (float)local_8c0))); - local_87c = local_a74; - piVar12 = GHIDRA_CAST(std)::max(); - iVar7 = Isaac::Random(*piVar12); - if (iVar7 != 0) { - pBVar8 = &g_tearFlagSpore; - pBVar6 = BitSet128::operator_or(&withBooger,&g_tearFlagSticky,&g_tearFlagBooger); - pBVar6 = BitSet128::operator_or(&orResult6,pBVar6,pBVar8); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result7); - pBVar8 = TearFlags(GHIDRA_CAST(local_888),&tearFlagsCopy2); - pBVar6 = BitSet128::operator_and(&andResult15,pBVar8,pBVar6); - room = local_888; - in_stack_ffffd9fc = *GHIDRA_CAST(&pBVar6->_l); - FUN_00456830(); - } - local_a7c = local_87c; - local_a80 = (void *)0x1; - piVar12 = GHIDRA_CAST(std)::max(); - iVar7 = Isaac::Random(*piVar12); - if (iVar7 != 0) { - pBVar6 = BitSet128::operator_or(&withAbsorb,&g_tearFlagPop,&g_tearFlagAbsorb); - pBVar6 = (GHIDRA_CAST((pBVar6)))->BitSet128::__bnot(¬Result8); - pBVar8 = TearFlags(GHIDRA_CAST(local_888),&tearFlagsCopy3); - pBVar6 = BitSet128::operator_and(&andResult16,pBVar8,pBVar6); - room = local_888; - in_stack_ffffd9fc = *GHIDRA_CAST(&pBVar6->_l); - FUN_00456830(); - } - (**(code **)(*GHIDRA_CAST(room) + 0x40))(); - if ((fetusTechAimDir.y < -0.5) || (fetusTechAimDir.x < -0.5)) { - uVar37 = 0; - uVar39 = 0xc120; - } - else { - uVar37 = 0x80; - uVar39 = 0x453b; - } - set_field_358(room,(float)(GHIDRA_UINT(CONCAT21(uVar39,uVar37)) << 8)); - if (local_88c != GHIDRA_CAST(0x0)) { - Entity_Player::get_laser_color_copy - (GHIDRA_CAST(local_88c),GHIDRA_CAST(local_1d8)); - playerEffects = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); - decayFactor = (GHIDRA_CAST((playerEffects)))->Color::A(); - Font::SetLineHeightModifier(GHIDRA_CAST(local_1d8),decayFactor); - in_stack_ffffd9fc = GHIDRA_CAST(0xff); - (**(code **)(*GHIDRA_CAST(room) + 0x3c))(); - } - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::SetMaxDistance(140.0); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Laser::set_scale(this->_fScale * (float)local_8ec); - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - } - } - } - ehState = -1; - (GHIDRA_CAST((fetusTechQuery)))->EntityList_Query::~EntityList_Query(); - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4a8)))) + -1; - } - } - decayFactor = Math::clamp(zeroConst,2.0,this->_updateTime / 10.0); - decayFactor = pow(oneConst - decayFactor,2.0); - this->_friction = decayFactor * 0.1 + 0.9; - local_a84 = (void *)(this->_updateTime / 45.0); - local_a88 = (void *)0x3f800000; - puVar13 = GHIDRA_CAST(std)::min(); - local_898 = GHIDRA_CAST(*puVar13); - auVar31 = ZEXT416(local_898); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(8,this->_index); - if ((bVar4 != 0) && (this->_stickTarget == (void *)0x0)) { - (GHIDRA_CAST((&this->_hitList)))->msvc::vector::clear(0); - } - if ((this->_target == 0) && (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,this->_index), bVar4 != 0) - ) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = ZEXT812(0x4e6e6b28); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0xc))) = 0; - local_888 = GHIDRA_CAST(0x0); - local_8c0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - local_b44 = (void *)0x40a00000; - pVVar9 = Vector::operator_mul(&local_f98,GHIDRA_CAST(&local_b44),&this->_velocity); - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_fa0,pVVar9); - in_stack_ffffd9fc = GHIDRA_CAST(0x66c558); - EntityList::QueryRadius(entityList,GHIDRA_CAST(aheadQuery2),pVVar9,128.0,8); - ehState = 2; - local_8b4 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(aheadQuery2))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - room = GHIDRA_CAST(*puVar13); - local_89c = room; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar4 != 0) { - if (GHIDRA_CAST(this->_spawnerEntity) != GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::IsDescendantOf(GHIDRA_CAST(room)); - if (bVar4 != 0) goto LAB_0066c6d8; - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::HasEntityFlags(0x20000010); - if (bVar4 == 0) { - iVar7 = Isaac::Random(2); - if (iVar7 != 0) { - if (this->_entityGridCollisionClass == 4) { - room = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_89c))))->Entity::Position(&entityPos12); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - bVar4 = (GHIDRA_CAST((room)))->Room::CheckLine(&this->_pos,pVVar9,3,0,0,0,GHIDRA_CAST(0x0)); - if (bVar4 == 0) goto LAB_0066c6d8; - } - local_a8c = (void *)0x40a00000; - pVVar9 = Vector::operator_mul(&local_fb0,GHIDRA_CAST(&local_a8c),&this->_velocity); - pVVar9 = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_fb8,pVVar9); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_89c))))->Entity::Position(&entityPos13); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(pVVar14); - decayFactor = random_float(); - local_87c = GHIDRA_CAST((decayFactor * 128.0 + (float)local_8ac)); - auVar31 = ZEXT416(local_87c); - if ((float)local_87c < (float)local_8c0) { - local_888 = local_89c; - local_8c0 = local_87c; - } - } - } - } -LAB_0066c6d8: - puVar23 = &(*GHIDRA_CAST((GHIDRA_CAST((local_8b4)) + 0x1))); - local_8b4 = GHIDRA_CAST(puVar23); - puVar19 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(aheadQuery2))))->EntityList)::Size(); - } while (puVar23 < puVar19); - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(local_888)); - ehState = -1; - (GHIDRA_CAST((aheadQuery2)))->EntityList_Query::~EntityList_Query(); - } - if (GHIDRA_CAST(this->_target) != GHIDRA_CAST(0x0)) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::Position(&targetPos4); - (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&fromTarget2,pVVar9); - pVVar14 = &this->_velocity; - local_8ac = GHIDRA_CAST(pVVar14); - pVVar9 = (GHIDRA_CAST((&fromTarget2)))->Vector::Normalized(&direction7); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar14)))->Vector)::Dot(pVVar9); - local_c44 = (void *)(((float)local_87c * 0.1 + 1.35) * (float)local_898); - pVVar9 = (GHIDRA_CAST((pVVar14)))->Vector::Normalized(&direction8); - pVVar14 = (GHIDRA_CAST((&fromTarget2)))->Vector::Normalized(&direction9); - decayFactor = (GHIDRA_CAST((&fromTarget2)))->Vector::Length(); - local_a94 = (void *)0x0; - local_a90 = (void *)(0.08 - decayFactor * 0.0005); - decayFactor = (GHIDRA_CAST((pVVar9)))->Vector::Dot(pVVar14); - local_87c = GHIDRA_CAST((0.92 - decayFactor * 0.05)); - pfVar15 = GHIDRA_CAST(std)::max(); - local_a98 = (void *)((float)local_87c + *pfVar15); - local_a9c = (void *)0x3f7ae148; - pfVar15 = GHIDRA_CAST(std)::min(); - local_87c = GHIDRA_CAST(*pfVar15); - pVVar9 = (GHIDRA_CAST((&fromTarget2)))->Vector::Normalized(&direction10); - room = local_8d0; - pVVar9 = Vector::operator_mul(&local_ff0,GHIDRA_CAST(local_8d0),pVVar9); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_ff8,GHIDRA_CAST(&local_c44)); - pEVar30 = local_8ac; - (GHIDRA_CAST((GHIDRA_CAST(local_8ac))))->Vector::operator__(pVVar9); - timescaleFactor = (void *)Math::timescale_factor((float)local_87c,*GHIDRA_CAST(room)); - (GHIDRA_CAST((GHIDRA_CAST(pEVar30))))->Vector::operator_mul_assign(GHIDRA_CAST(×caleFactor)); - local_89c = (void *)0x40000000; - pBVar6 = BitSet128::operator_and(&homingMask3,tearFlagsPtr,&g_tearFlagHoming); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - local_89c = (void *)0x41400000; - } - local_89c = GHIDRA_CAST(((float)local_89c * *GHIDRA_CAST(room))); - pVVar9 = (GHIDRA_CAST((&fromTarget2)))->Vector::__unm(&negated2); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::GetAngleDegrees(); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar30))))->Vector)::GetAngleDegrees(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(approach_angle((float)local_8ac,(float)local_87c,(float)local_89c)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_12; - pVVar9 = Vector::FromAngle(&angleDir3,(*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0)))); - local_c3c = (void *)(GHIDRA_CAST((GHIDRA_CAST(pEVar30))))->Vector::Length(); - pVVar9 = Vector::operator_mul(&local_1010,GHIDRA_CAST(&local_c3c),pVVar9); - (GHIDRA_CAST((GHIDRA_CAST(pEVar30))))->Vector::operator_assign(pVVar9); - if ((local_8a1 != '\0') && - (bVar4 = (GHIDRA_CAST((&fromTarget2)))->Vector::operator_ne(&g_vectorZero), bVar4 != 0)) { - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar7 = AnimationState::GetAnimationLength(animState); - decayFactor = (float)iVar7; - local_8c0 = GHIDRA_CAST((360.0 / decayFactor)); - _empty_check_0x34(); - pVVar9 = Vector::FromAngle(&angleDir4,decayFactor * (float)local_8c0); - local_c38 = (void *)(*GHIDRA_CAST(local_8d0) * (float)local_8fc); - in_stack_ffffd9fc = GHIDRA_CAST(0x66ca43); - pVVar14 = Vector::operator_mul(&local_1020,GHIDRA_CAST(&local_c38),&fromTarget2); - fromTargetLenSq = (void *)(GHIDRA_CAST((&fromTarget2)))->Vector::LengthSquared(); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__div(&local_1028,GHIDRA_CAST(&fromTargetLenSq)); - (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_dc8,pVVar14); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&local_dc8)))->Vector)::GetAngleDegrees(); - decayFactor = normalize_angle_degrees((float)local_87c); - if (decayFactor < zeroConst) { - decayFactor = decayFactor + 360.0; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor / (float)local_8c0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_13; - FUN_0040a740(); - } - } - } -LAB_0066d04f: - pBVar6 = tearFlagsPtr; - pBVar8 = BitSet128::operator_and(&occultMask,tearFlagsPtr,&g_tearFlagOccult); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { -LAB_0066d2f2: - room = GHIDRA_CAST(tear); - } - else { - pBVar8 = BitSet128::operator_and(&ludovicoMask8,pBVar6,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsZero(); - if (bVar4 == 0) goto LAB_0066d2f2; - pBVar8 = BitSet128::operator_and(&fetusMask2,pBVar6,&g_tearFlagFetus); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsZero(); - room = local_8d8; - if ((bVar4 == 0) || (local_8d8 == GHIDRA_CAST(0x0))) goto LAB_0066d2f2; - (GHIDRA_CAST((GHIDRA_CAST(local_8d8))))->Entity_Player::ControllerIndex(); - aimDir.x = g_vectorZero.x; - aimDir.y = g_vectorZero.y; - pRVar28 = GHIDRA_CAST(g_vectorZero.y); - iVar7 = FUN_007826c0(); - if (iVar7 == 0) { - pVVar9 = GHIDRA_CAST(FUN_005cd7e0()); - (GHIDRA_CAST((&aimDir)))->Vector::operator_assign(pVVar9); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Player::GetMouseAimTarget(&aimDir,0); - } - else { - pEVar11 = GHIDRA_CAST(FUN_007826c0()); - pVVar9 = (GHIDRA_CAST((pEVar11)))->Entity::Position(&entityPos14); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_10a0,tearPos); - local_c1c = (void *)0x41200000; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__div(&local_10a8,GHIDRA_CAST(&local_c1c)); - (GHIDRA_CAST((&aimDir)))->Vector::operator_assign(pVVar9); - pRVar28 = GHIDRA_CAST((GHIDRA_CAST((&aimDir)))->Vector)::Length(); - local_87c = pRVar28; - if (oneConst < (float)pRVar28) { - (GHIDRA_CAST((&aimDir)))->Vector::Normalize(); - } - } - FUN_00436190(); - local_914 = (void *)((float)pRVar28 * (float)local_890); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Player::HasWeaponType(8); - if (bVar4 == 0) { - pBVar8 = BitSet128::operator_and(&boomerangMask2,pBVar6,&g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - local_914 = (void *)((float)local_914 * halfConst); - } - } - else { - local_914 = (void *)((float)local_914 * (float)local_900); - } - auVar31 = ZEXT416(GHIDRA_UINT(aimDir.x)); - if ((aimDir.x == zeroConst) && (auVar31 = ZEXT416(GHIDRA_UINT(aimDir.y)), aimDir.y == zeroConst)) { - pBVar8 = BitSet128::operator_and(&boomerangMask3,pBVar6,&g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pBVar8 = BitSet128::operator_and(&homingMask4,pBVar6,&g_tearFlagHoming); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - room = GHIDRA_CAST(tear); - if (bVar4 == 0) goto LAB_0066d2e6; - tear->_friction = 0.9; - } - else { - tear->_friction = 1.0; - room = GHIDRA_CAST(tear); - } - } - else { - (GHIDRA_CAST((&aimDir)))->Vector::Normalize(); - pVVar9 = (GHIDRA_CAST((&aimDir)))->Vector::__mul(local_10b8,GHIDRA_CAST(&local_914)); - room = GHIDRA_CAST(tear); - (GHIDRA_CAST((&tear->_velocity)))->Vector::operator_add_assign(pVVar9); -LAB_0066d2e6: - room->_gridEntities[0xd2] = (void *)0x3f4ccccd; - } - } - pBVar8 = BitSet128::operator_and(&growMask,pBVar6,&g_tearFlagGrow); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and(&ludovicoMask9,pBVar6,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - if (GHIDRA_INT(room->_gridEntities[0x105]) < 1) { - decayFactor = (GHIDRA_CAST((GHIDRA_CAST((room->_gridPaths + 0x20)))))->Vector::Length(); - local_87c = GHIDRA_CAST((decayFactor * 0.014)); - room->_gridEntities[0xd9] = (void *)((float)local_87c + (float)room->_gridEntities[0xd9]); - pvVar20 = (void *)((float)room->_gridEntities[0x100] + 0.01); - auVar31 = ZEXT416(pvVar20); - room->_gridEntities[0x100] = pvVar20; - } - } - else { - bVar4 = is_not_familiar_spawned(GHIDRA_CAST(room)); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(GHIDRA_CAST((room->_gridEntities + 0xc6))); - decayFactor = Math::clamp(oneConst,700.0,(float)local_87c); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor / 700.0 + oneConst)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_15; - room->_gridEntities[0xd9] = - (void *)((*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0))) * (float)room->_gridEntities[0x10c]); - local_8dc = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - } - } - pBVar6 = BitSet128::operator_and - (&shrinkMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagShrink); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and - (&ludovicoMask10,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - if (GHIDRA_INT(room->_gridEntities[0x105]) < 1) { - auVar31 = ZEXT416(room->_gridEntities[0xe0]); - if (4.0 < (float)room->_gridEntities[0xe0]) { - pBVar6 = BitSet128::operator_and - (&fetusMask3,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagFetus); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - pvVar20 = room->_gridEntities[0x10c]; - pvVar24 = room->_gridEntities[0xd9]; - if (bVar4 == 0) { - if ((float)pvVar20 / (float)local_890 < (float)pvVar24) { - decayFactor = 0.08; - } - else { - decayFactor = 0.03; - } - local_c0c = (void *)0x3dcccccd; - local_c10 = (void *)((float)pvVar24 - decayFactor * (float)pvVar20); - } - else { - if ((float)pvVar20 / (float)local_890 < (float)pvVar24) { - decayFactor = 0.022; - } - else { - decayFactor = 0.006; - } - local_c14 = (void *)0x3dcccccd; - local_c18 = (void *)((float)pvVar24 - decayFactor * (float)pvVar20); - } - pfVar15 = GHIDRA_CAST(std)::max(); - pvVar20 = (void *)*pfVar15; - room->_gridEntities[0xd9] = pvVar20; - pvVar20 = (void *)((float)pvVar20 / (float)room->_gridEntities[0x10c]); - FUN_00431260(); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = ZEXT812(0x3dcccccd); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0xc))) = 0; - local_8dc = pvVar20; - if ((float)room->_gridEntities[0xd9] <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0)))) { - *GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) = 1; - room->_gridEntities[0x114] = (void *)(GHIDRA_UINT(room->_gridEntities[0x114]) | 0x10); - } - } - } - } - else { - bVar4 = is_not_familiar_spawned(GHIDRA_CAST(room)); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos2); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(GHIDRA_CAST((room->_gridEntities + 0xc6))); - decayFactor = Math::clamp(zeroConst,900.0,(float)local_87c); - decayFactor = oneConst - decayFactor / 900.0; - local_8dc = (void *)(decayFactor * (float)local_8dc); - auVar31 = ZEXT416(local_8dc); - room->_gridEntities[0xd9] = (void *)(decayFactor * (float)room->_gridEntities[0x10c]); - } - } - } - pBVar6 = BitSet128::operator_and - (&spectralMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagSpectral); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if ((room->_gridEntities[2] == &DAT_00000004) || (room->_gridEntities[2] == &DAT_00000009)) { - pvVar20 = (void *)0x3; - } - else { - pvVar20 = (void *)0x0; - } - room->_gridEntities[0x58] = pvVar20; - pBVar6 = BitSet128::operator_and - (&ludovicoMask11,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - if (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x447)) == '\0') { - cVar5 = try_make_bridges(); - if (cVar5 != '\0') { - apply_death_flag_effects(GHIDRA_CAST(room),GHIDRA_CAST(0x0)); - *GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x447)) = 1; - } - } - else { - iVar7 = Isaac::Random(8); - if (iVar7 == 0) { - try_make_bridges(); - } - } - } - } - pBVar6 = BitSet128::operator_and - (&boomerangMask4,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (room->_gridEntities[0xe6] != (void *)0x0)) { - pBVar8 = &g_tearFlagOrbitAdvanced; - pBVar6 = BitSet128::operator_or(&withOrbit2,&g_tearFlagLudovico,&g_tearFlagOrbit); - pBVar6 = BitSet128::operator_or(&orResult7,pBVar6,pBVar8); - pBVar6 = BitSet128::operator_and(&andResult17,GHIDRA_CAST((room->_gridEntities + 0x101)),pBVar6) - ; - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos3); - pVVar14 = (GHIDRA_CAST((&local_10d8)))->Vector::Vector(zeroConst,2.0); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_10e0,pVVar14); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector::__sub(&local_ca8,pVVar9); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc4)))))->Vector::operator_ne(&g_vectorZero); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((&local_10e8)))->Vector::Vector(zeroConst,2.0); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc4)))))->Vector::__sub(&local_10f0,pVVar9); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector::__sub(&local_10f8,pVVar9); - (GHIDRA_CAST((&local_ca8)))->Vector::operator_assign(pVVar9); - } - local_87c = GHIDRA_CAST(GetRootPlayer(GHIDRA_CAST(room))); - local_c04 = (void *)0x41a00000; - local_c08 = (void *)(((float)room->_gridPaths[0x2d] - 60.0) * halfConst); - auVar31 = ZEXT416(local_c08); - puVar13 = GHIDRA_CAST(std)::max(); - local_8ac = GHIDRA_CAST(*puVar13); - if (local_87c == GHIDRA_CAST(0x0)) { - auVar31 = ZEXT416(GHIDRA_UINT(oneConst)); - } - else { - FUN_00436190(); - } - decayFactor = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) * 10.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(((decayFactor * decayFactor) / ((float)local_8ac + (float)local_8ac))); - local_c00 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - pVVar9 = (GHIDRA_CAST((&local_ca8)))->Vector::Normalized(&direction11); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1108,GHIDRA_CAST(&local_c00)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator__(pVVar9); - } - } - pBVar6 = BitSet128::operator_and - (&wiggleMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagWiggle); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if (local_8d8 == GHIDRA_CAST(0x0)) { - decayFactor = oneConst; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(get_tear_trinket_multiplier(GHIDRA_CAST(local_8d8),10)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_16; - local_bf8 = (void *)0x3f800000; - local_bfc = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - pfVar15 = GHIDRA_CAST(std)::max(); - decayFactor = *pfVar15; - } - apply_wiggle(GHIDRA_CAST(room),decayFactor); - } - pBVar6 = BitSet128::operator_and - (&spiralMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagSpiral); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if (local_8d8 == GHIDRA_CAST(0x0)) { - decayFactor = oneConst; - } - else { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(get_tear_trinket_multiplier(GHIDRA_CAST(local_8d8),0x1a)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_17; - local_bf0 = (void *)0x3f800000; - local_bf4 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - pfVar15 = GHIDRA_CAST(std)::max(); - decayFactor = *pfVar15; - } - apply_wiggle(GHIDRA_CAST(room),decayFactor); - } - pBVar6 = BitSet128::operator_and - (&bigSpiralMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagBigSpiral - ); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if (local_8d8 != GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(get_tear_trinket_multiplier(GHIDRA_CAST(local_8d8),0x2e)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_18; - local_be8 = (void *)0x3f800000; - local_bec = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - msvc::max(); - } - update_wiggle(GHIDRA_CAST(room)); - } - pBVar6 = BitSet128::operator_and - (&attractorMask2,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagAttractor); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = - GHIDRA_CAST(Math)::clamp(zeroConst,oneConst,((float)room->_gridEntities[0xe0] - 10.0) / 10.0); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_19; - local_87c = room->_gridEntities[0x115]; - local_8d0 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0))) * 20.0 * (*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0))))); - if (local_87c != GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = ZEXT812(0x41000000); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0xc))) = 0; - local_8d0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - local_be4 = (void *)0x40800000; - pVVar9 = Vector::operator_mul - (&local_1110,GHIDRA_CAST(&local_be4),GHIDRA_CAST((room->_gridEntities + 0xcf))); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector::__add(&local_1118,pVVar9); - in_stack_ffffd9fc = GHIDRA_CAST(0x66dae1); - Game::AttractEntities - (g_game,pVVar9,Entity_Effect::rift_attract_filter,local_87c,(float)local_8d0,250.0); - } - pBVar6 = GHIDRA_CAST((room->_gridEntities + 0x101)); - pBVar8 = BitSet128::operator_and(&pulseMask,pBVar6,&g_tearFlagPulse); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if (local_8d8 == GHIDRA_CAST(0x0)) { - decayFactor = oneConst; - } - else { - local_ba0 = (void *)get_tear_trinket_multiplier(GHIDRA_CAST(local_8d8),0x19); - local_be0 = (void *)0x3f800000; - pfVar15 = GHIDRA_CAST(std)::max(); - decayFactor = *pfVar15; - } - local_8d0 = GHIDRA_CAST((decayFactor * pointThreeConst)); - auVar31 = ZEXT416(local_8d0); - pBVar8 = BitSet128::operator_and(&ludovicoMask12,pBVar6,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(); - decayFactor = sinf_wrapper((float)iVar7 * 0.7); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(((decayFactor + 0.7) * (float)local_8d0 + (float)pointSixConst)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_21; - local_8dc = (void *)((float)local_8dc * (*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0)))); - } - else if ((room->_gridEntities[0xe6] != (void *)0x0) && (iVar7 = (GHIDRA_CAST(()))->Entity::Type(), iVar7 == 1)) { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(); - decayFactor = sinf_wrapper((float)iVar7 * 0.2); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST(((decayFactor + 0.2) * (float)local_8d0 + 1.1)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_20; - local_8dc = (void *)((float)local_8dc * (*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar31)) + 0x0)))); - } - } - local_8b4 = local_8dc; - pBVar8 = BitSet128::operator_and(&stickyMask,pBVar6,&g_tearFlagSticky); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pBVar8 = BitSet128::operator_and(&sporeMask,pBVar6,&g_tearFlagSpore); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) goto LAB_0066dc7d; - } - else { -LAB_0066dc7d: - if ((room->_gridEntities[0x115] != (void *)0x0) && (0 < GHIDRA_INT(room->_gridEntities[0x118]))) { - decayFactor = oneConst - (float)GHIDRA_INT(room->_gridEntities[0x118]) / 60.0; - local_8dc = (void *)((float)local_8dc + decayFactor + decayFactor); - auVar31 = ZEXT416(local_8dc); - } - } - local_8a0 = GHIDRA_CAST((room->_gridEntities + 9)); - (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Sprite::SetRotation(0.0); - local_87c = GHIDRA_CAST((room->_gridEntities + 0x167)); - local_8b9 = '\0'; - cVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_87c))))->Sprite::IsLoaded(); - if (cVar5 == '\0') { -LAB_0066dd14: - local_8a1 = 0; - } - else { - cVar5 = _has_flag_0x110(); - local_8a1 = 1; - if (cVar5 == '\0') goto LAB_0066dd14; - } - pBVar8 = BitSet128::operator_and(&flatMask,pBVar6,&g_tearFlagFlat); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (puVar19 = room->_gridEntities[2], puVar19 != &DAT_00000004)) { - if (local_8d8 == GHIDRA_CAST(0x0)) { - decayFactor = oneConst; - } - else { - local_bdc = (void *)get_tear_trinket_multiplier(GHIDRA_CAST(local_8d8),0x1b); - local_bd8 = (void *)0x3f800000; - pfVar15 = GHIDRA_CAST(std)::max(); - puVar19 = room->_gridEntities[2]; - decayFactor = *pfVar15; - } - decayFactor = decayFactor * halfConst + oneConst; - auVar31 = ZEXT416(GHIDRA_UINT(decayFactor)); - if (puVar19 == GHIDRA_CAST(0x32)) { - pVVar9 = (GHIDRA_CAST((&local_1120)))->Vector::Vector(decayFactor,oneConst); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xd4)))))->Vector::operator_assign(pVVar9); - } - else { - pVVar9 = (GHIDRA_CAST((&local_1128)))->Vector::Vector(oneConst,decayFactor); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xd4)))))->Vector::operator_assign(pVVar9); - local_8b9 = '\x01'; - } - } - if (((room->_gridEntities[2] == &DAT_0000000d) || (room->_gridEntities[2] == &DAT_00000017)) && - (bVar4 = Game::IsInTimedSet(g_game,0x4f), bVar4 != 0)) { - (GHIDRA_CAST((room->_gridEntities + 0xd4)))->x = 3.0; - } - puVar19 = room->_gridEntities[2]; - if ((puVar19 == &DAT_0000000e) || (puVar19 == &DAT_0000000f)) { - pBVar6 = BitSet128::operator_and(&boomerangMask5,pBVar6,&g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - puVar19 = room->_gridEntities[2]; - goto LAB_0066de6b; - } - decayFactor = (float)room->_gridEntities[0xe0] * 45.0; - auVar31 = ZEXT416(GHIDRA_UINT(decayFactor)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetRotation(decayFactor); - local_8b9 = '\0'; - } - else { -LAB_0066de6b: - if (((((puVar19 == &DAT_0000000b) || (puVar19 == GHIDRA_CAST(0xc))) || - ((puVar19 == &DAT_0000000d || - (((puVar19 == &DAT_0000000e || (puVar19 == &DAT_0000000f)) || (puVar19 == &DAT_00000017))) - ))) || ((puVar19 == &DAT_0000001f || (puVar19 == GHIDRA_CAST(0x21))))) || - ((puVar19 == GHIDRA_CAST(0x22) || - (((puVar19 == &DAT_00000014 || (puVar19 == &DAT_00000027)) || - ((puVar19 == GHIDRA_CAST(0x29) || - ((((puVar19 == &DAT_0000002b || (puVar19 == &DAT_0000002c)) || - (puVar19 == GHIDRA_CAST(0x2d))) || - ((puVar19 == &DAT_0000002f || (puVar19 == GHIDRA_CAST(0x31))))))))))))) { - local_8b9 = '\x01'; - } - } - if (room->_gridEntities[2] == (void *)0x32) { - decayFactor = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::Length(); - local_8d0 = GHIDRA_CAST((decayFactor + decayFactor)); - if ((GHIDRA_CAST((room->_gridEntities + 0xcf)))->x <= zeroConst && - zeroConst != (GHIDRA_CAST((room->_gridEntities + 0xcf)))->x) { - local_8d0 = GHIDRA_CAST(((float)local_8d0 * -1.0)); - } - animState = GHIDRA_CAST(Config)::GetPillEffects(); - iVar7 = AnimationState::GetAnimationLength(animState); - decayFactor = (float)iVar7; - local_8c0 = GHIDRA_CAST((360.0 / decayFactor)); - _empty_check_0x34(); - decayFactor = normalize_angle_degrees - (decayFactor * (float)local_8c0 + - (float)local_8d0 * (float)room->_gridEntities[0xde]); - if (decayFactor < zeroConst) { - decayFactor = decayFactor + 360.0; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor / (float)local_8c0)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_22; - FUN_0040a740(); - } - if ((local_8b9 != '\0') || (local_8a1 != 0)) { - local_9c4.x = (GHIDRA_CAST((room->_gridEntities + 0xcf)))->x; - local_8ac = GHIDRA_CAST((room->_gridEntities + 0xcf)); - local_9c4.y = (float)room->_gridEntities[0xd0]; - if (GHIDRA_INT(room->_gridEntities[0x105]) < 1) { - decayFactor = (GHIDRA_CAST((room->_gridEntities + 0xfd)))->x; - auVar31 = ZEXT416(GHIDRA_UINT(decayFactor)); - if (0.001 < decayFactor) { -LAB_0066e037: - pVVar9 = (GHIDRA_CAST((&local_1130)))->Vector::Vector(zeroConst,(float)local_8e0); - (GHIDRA_CAST((&local_9c4)))->Vector::operator_add_assign(pVVar9); - } - else { - pBVar6 = BitSet128::operator_and - (&ludovicoMask13,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and - (&hydrobounceMask4,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagHydrobounce); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) goto LAB_0066e037; - } - } - } - else { - (GHIDRA_CAST((&local_9c4)))->Vector::operator_assign(GHIDRA_CAST((room->_gridEntities + 0x106))); - } - local_89c = GHIDRA_CAST((GHIDRA_CAST((&local_9c4)))->Vector)::GetAngleDegrees(); - if (local_8b9 != '\0') { - auVar31 = ZEXT416(local_89c); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetRotation((float)local_89c); - } - if (local_8a1 != 0) { - layerIndex = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0x167)))))->Sprite::GetLayerCount(); - pRVar28 = local_87c; - if (iVar7 != 0) { - do { - layer = (GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Sprite::GetLayer(layerIndex); - if ((layer->_bitflags & 0x1000U) != 0) { - auVar31 = ZEXT416(local_89c); - layer->_rotation = (float)local_89c; - } - layerIndex = layerIndex + 1; - layerCount = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Sprite)::GetLayerCount(); - } while (layerIndex < layerCount); - room = GHIDRA_CAST(tear); - } - } - if (room->_gridEntities[2] == &DAT_00000017) { - seeds = GHIDRA_CAST(Game)::GetSeeds(g_game); - bVar4 = Seeds::HasSeedEffect(seeds,0x4f); - if (((bVar4 != 0) && - (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::GetIntervalTicks(2.0,zeroConst), iVar7 != 0)) && - (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14d)) != 0)) { - uVar10 = Random(); - local_bd4 = (void *)0x3e0f5c29; - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8ac))))->Vector::__mul(&local_1138,GHIDRA_CAST(&local_bd4)); - pVVar14 = Vector::FromAngle(&angleDir5,(float)local_89c); - local_bd0 = (void *)0x40a00000; - pVVar14 = Vector::operator_mul(&local_1148,GHIDRA_CAST(&local_bd0),pVVar14); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_1150,&tear->_fScale); - pVVar14 = (GHIDRA_CAST((tearPos)))->Vector::__sub(&local_1158,pVVar14); - effect = (Entity_Effect *) - Game::Spawn(g_game,1000,0x3b,pVVar14,pVVar9,GHIDRA_CAST(0x0),0,uVar10); - pcVar1 = *(code **)(*GHIDRA_CAST(effect) + 0x3c); - (GHIDRA_CAST((local_4e8)))->Color::Color(oneConst,oneConst,oneConst,0.3); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - decayFactor = random_float(); - (GHIDRA_CAST((effect)))->Entity_Effect::set_rotation(decayFactor * 10.0 + 2.0); - iVar7 = Isaac::Random(0xf); - (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(iVar7 + 0xf); - room = GHIDRA_CAST(tear); - local_bcc = (void *)(tear->_fScale * (float)local_900); - auVar31 = ZEXT416(local_bcc); - pVVar9 = Vector::operator_mul(&uniformScale10,GHIDRA_CAST(&local_bcc),&g_vectorOne); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetSpriteScale(pVVar9); - set_field_358(effect,-18.0); - (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetPositionOffset(&(GHIDRA_CAST(room))->_posOffset); - } - } - } - puVar19 = room->_gridEntities[2]; - if ((((puVar19 == &DAT_00000023) || (puVar19 == GHIDRA_CAST(0x25))) || - (puVar19 == GHIDRA_CAST(0x26))) && (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsFrame(2,0), bVar4 != 0)) - { - if (room->_gridEntities[2] == (void *)0x26) { - local_87c = GHIDRA_CAST(Random()); - local_bc8 = (void *)0x3e99999a; - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::__mul(&local_1168,GHIDRA_CAST(&local_bc8)) - ; - pVVar14 = MusicManager::RandomVector(&randomDir2); - local_bc4 = (void *)random_float(); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_1178,GHIDRA_CAST(&local_bc4)); - local_bc0 = (void *)0x40400000; - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_1180,GHIDRA_CAST(&local_bc0)); - pfVar15 = &tear->_fScale; - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_1188,pfVar15); - in_stack_ffffd9fc = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1190,pVVar14); - local_89c = GHIDRA_CAST(Game)::Spawn(g_game,1000,0x58,tearPos,in_stack_ffffd9fc,GHIDRA_CAST(0x0),0, - GHIDRA_UINT(local_87c)); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_89c))))->Entity)::GetSprite(); - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&uniformScale11,pfVar15); - local_bbc = (void *)0x3f4ccccd; - pVVar14 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_11a0,GHIDRA_CAST(&local_bbc)); - decayFactor = random_float(); - ppvVar16 = &local_bb4; - pVVar9 = &local_11a8; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * (float)pointSixConst + (float)pointSixConst)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_23; - local_bb4 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - else { - local_87c = GHIDRA_CAST(Random()); - local_bb0 = (void *)0x3e99999a; - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::__mul(&local_11b0,GHIDRA_CAST(&local_bb0)) - ; - pVVar14 = MusicManager::RandomVector(&randomDir3); - local_bac = (void *)random_float(); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_11c0,GHIDRA_CAST(&local_bac)); - local_ba8 = (void *)0x40400000; - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_11c8,GHIDRA_CAST(&local_ba8)); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_11d0,&tear->_fScale); - in_stack_ffffd9fc = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_11d8,pVVar14); - room = GHIDRA_CAST(Game)::Spawn(g_game,1000,0x6f,tearPos,in_stack_ffffd9fc,GHIDRA_CAST(0x0),0, - GHIDRA_UINT(local_87c)); - local_89c = room; - pAVar22 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(room))))->Entity)::GetSprite(); - decayFactor = random_float(); - set_PlaybackSpeed(pAVar22,decayFactor * (float)pointSixConst + halfConst); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(room))))->Entity)::GetSprite(); - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&uniformScale12,&tear->_fScale); - local_ba4 = (void *)0x3f000000; - pVVar14 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_11e8,GHIDRA_CAST(&local_ba4)); - decayFactor = random_float(); - ppvVar16 = &local_b98; - pVVar9 = &local_11f0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * (float)pointSixConst + (float)pointSixConst)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_24; - local_b98 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - pVVar9 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(pVVar9,GHIDRA_CAST(ppvVar16)); - (GHIDRA_CAST((sprite)))->Sprite::SetScale(pVVar9); - room = GHIDRA_CAST(tear); - pRVar28 = local_89c; - (GHIDRA_CAST((GHIDRA_CAST(local_89c))))->Entity::SetPositionOffset(&tear->_posOffset); - FUN_00440e90(); - sprite = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Entity)::GetSprite(); - color = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(room))->_sprite))))->Sprite)::Color(); - (GHIDRA_CAST((sprite)))->Sprite::SetColor(color); - (**(code **)(*GHIDRA_CAST(local_89c) + 0xc))(); - } - pBVar6 = BitSet128::operator_and - (&glowMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagGlow); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - in_stack_ffffd9fc = GHIDRA_CAST(0x66e65e); - EntityList::QueryRadius - (entityList,GHIDRA_CAST(local_d08),GHIDRA_CAST((room->_gridEntities + 0xc6)), - (float)room->_gridEntities[0xd3] * (float)local_890 + 100.0,0xffffffff); - ehState = 5; - local_888 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_d08))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - local_898 = GHIDRA_CAST(*puVar13); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar4 != 0) && - ((room->_gridEntities[0xe9] == GHIDRA_CAST(0x0) || - (bVar4 = (GHIDRA_CAST((room->_gridEntities[0xe9])))->Entity::IsDescendantOf(GHIDRA_CAST(local_898)), - bVar4 == 0)))) { - FUN_00417340(); - pvVar20 = (void *)((*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) + (float)room->_gridEntities[0xd3]); - local_89c = pvVar20; - FUN_00417340(); - decayFactor = (float)pvVar20 + (float)room->_gridEntities[0xd3] * 4.0; - local_89c = GHIDRA_CAST(((float)local_89c * (float)local_89c)); - local_8ac = GHIDRA_CAST((decayFactor * decayFactor)); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::Position(&entityPos15); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::DistanceSquared(GHIDRA_CAST((room->_gridEntities + 0xc6))) - ; - auVar31 = ZEXT416(local_8ac); - if (((float)local_87c < (float)local_8ac) && ((float)local_89c < (float)local_87c)) { - pcVar1 = *(code **)(GHIDRA_INT(*GHIDRA_CAST(local_898)) + 0x20); - (GHIDRA_CAST((&local_2570)))->EntityRef::constructor(GHIDRA_CAST(room)); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - (*pcVar1)(); - } - } - local_888 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_888)) + 0x1)))); - pRVar28 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_d08))))->EntityList)::Size(); - } while (local_888 < pRVar28); - } - ehState = -1; - (GHIDRA_CAST((local_d08)))->EntityList_Query::~EntityList_Query(); - } - pBVar8 = GHIDRA_CAST((room->_gridEntities + 0x101)); - pBVar6 = BitSet128::operator_and(&decelerateMask,pBVar8,&g_tearFlagDecelerate); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar34 = &g_tearFlagPop; - pBVar6 = BitSet128::operator_or(&withLudovico,&g_tearFlagAbsorb,&g_tearFlagLudovico); - pBVar6 = BitSet128::operator_or(&orResult8,pBVar6,pBVar34); - pBVar6 = BitSet128::operator_and(&andResult18,pBVar8,pBVar6); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - decayFactor = assert_lerp_range((float)room->_gridEntities[0xe0],zeroConst,10.0,oneConst,0.8,1 - ); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * (float)room->_gridEntities[0xd2])); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_25; - room->_gridEntities[0xd2] = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - } - pBVar6 = BitSet128::operator_and(&accelerateMask,pBVar8,&g_tearFlagAccelerate); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar34 = &g_tearFlagPop; - pBVar6 = BitSet128::operator_or(&withLudovico2,&g_tearFlagAbsorb,&g_tearFlagLudovico); - pBVar6 = BitSet128::operator_or(&orResult9,pBVar6,pBVar34); - pBVar6 = BitSet128::operator_and(&andResult19,pBVar8,pBVar6); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - local_87c = GHIDRA_CAST(assert_lerp_range((float)room->_gridEntities[0xe0],zeroConst,10.0,0.8,1.2, - 1)); - decayFactor = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::Length(); - local_b2c = (void *)(decayFactor * (float)local_87c); - local_b28 = (void *)0x41f00000; - pfVar15 = GHIDRA_CAST(std)::min(); - auVar31 = ZEXT416(GHIDRA_UINT(*pfVar15)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::Resize(*pfVar15); - } - } - pBVar6 = GHIDRA_CAST((room->_gridEntities + 0x101)); - pBVar8 = BitSet128::operator_and(&absorbMask,pBVar6,&g_tearFlagAbsorb); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar8 = BitSet128::operator_and(&ludovicoMask14,pBVar6,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsZero(); - if (bVar4 != 0) { - local_89c = GHIDRA_CAST(GetRootPlayer(GHIDRA_CAST(room))); - if (local_89c == GHIDRA_CAST(0x0)) { - local_8d8 = GHIDRA_CAST(0x40600000); - local_888 = GHIDRA_CAST(0x41200000); - local_aac = (void *)oneConst; - } - else { - FUN_005cd770(); - local_8b0 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - FUN_0060d040(); - local_8d8 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - FUN_005cd750(); - local_888 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - FUN_00436190(); - local_aac = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - pRVar29 = GHIDRA_CAST(((float)local_888 / 10.0)); - local_b34 = (void *)0x40400000; - pow_wrapper(); - pRVar28 = local_8d8; - local_87c = pRVar29; - FUN_00431260(); - local_bb8 = (void *)((float)local_87c * (float)pRVar28); - local_b30 = (void *)0x41200000; - msvc::min(); - pfVar15 = GHIDRA_CAST(std)::max(); - local_940 = (void *)*pfVar15; - auVar31 = ZEXT416(local_8b0); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Projectile::SetHeight((float)local_8b0); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Projectile::set_falling_accel(0.0); - FUN_00444c70(); - pBVar8 = BitSet128::operator_or(&withOrbitAdvanced2,&g_tearFlagOrbit,&g_tearFlagOrbitAdvanced) - ; - pBVar8 = BitSet128::operator_and(&andResult20,pBVar6,pBVar8); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsZero(); - if (bVar4 != 0) { - pvVar20 = (void *)((float)room->_gridEntities[0xd2] * 0.95); - auVar31 = ZEXT416(pvVar20); - room->_gridEntities[0xd2] = pvVar20; - } - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(); - if (10 < iVar7) { - if ((float)local_940 <= (GHIDRA_CAST((room->_gridEntities + 0xff)))->x) { -LAB_0066ebda: - pBVar6 = GHIDRA_CAST((room->_gridEntities + 0x101)); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = - GHIDRA_CAST(Math)::clamp(zeroConst,8.0,(GHIDRA_CAST((room->_gridEntities + 0xff)))->x * 5.0); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_26; - local_890 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(GHIDRA_INT((float)auVar31)))) + 0x0))); - pBVar8 = BitSet128::operator_and(&splitMask,pBVar6,&g_tearFlagSplit); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - local_890 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_890)) + 0x4)))); - } - pBVar8 = BitSet128::operator_and(&quadsplitMask2,pBVar6,&g_tearFlagQuadsplit); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - auVar31 = ZEXT416(GHIDRA_UINT(((float)GHIDRA_INT(local_890) * 1.5))); - local_890 = GHIDRA_CAST(GHIDRA_INT(((float)GHIDRA_INT(local_890) * 1.5))); - } - if (GHIDRA_INT(local_890) < 3) { - (GHIDRA_CAST((&g_tearFlagAbsorb)))->BitSet128::__bnot(¬Absorb2); - FUN_005cd430(); - FUN_00444c70(); - goto LAB_0066ef8a; - } - decayFactor = random_float(); - local_8ac = GHIDRA_CAST((decayFactor * 360.0)); - local_8e0 = GHIDRA_CAST((room->_gridEntities + 0xfb)); - local_8b0 = (void *)0x0; - local_87c = GHIDRA_CAST((360.0 / (float)GHIDRA_INT(local_890))); - while( true ) { - pBVar35 = &g_tearFlagFetus; - uVar37 = 0x50; - uVar38 = 0x4c; - uVar39 = 0xc3; - pBVar34 = &g_tearFlagAbsorb; - pBVar8 = BitSet128::operator_or(&withQuadsplit2,&g_tearFlagSplit,&g_tearFlagQuadsplit); - pBVar8 = BitSet128::operator_or(&orResult10,pBVar8,pBVar34); - pBVar8 = BitSet128::operator_or - (&orResult11,pBVar8, - GHIDRA_CAST(CONCAT22(uVar39,CONCAT11(uVar38,uVar37)))); - pBVar8 = BitSet128::operator_or(&orResult12,pBVar8,pBVar35); - pBVar8 = (GHIDRA_CAST((pBVar8)))->BitSet128::__bnot(¬Result9); - BitSet128::operator_and(&inheritedFlags,pBVar6,pBVar8); - uVar18 = Random(); - pEVar11 = room->_gridEntities[0xe9]; - pVVar9 = Vector::FromAngle(&angleDir6, - (float)GHIDRA_INT(local_8b0) * (float)local_87c + (float)local_8ac); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1208,GHIDRA_CAST(&local_aac)); - local_ab0 = (void *)0x41200000; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1210,GHIDRA_CAST(&local_ab0)); - uVar10 = tear->_variant; - if (uVar10 == 0x24) { - uVar10 = 1; - } - Game::Spawn(g_game,2,uVar10,tearPos,pVVar9,pEVar11,0,uVar18); - pRVar28 = GHIDRA_CAST(__RTDynamicCast()); - local_ab4 = (void *)0xc0c00000; - local_898 = pRVar28; - pfVar15 = GHIDRA_CAST(std)::min(); - (GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Entity_Projectile::SetHeight(*pfVar15); - room = GHIDRA_CAST(tear); - SetScale(GHIDRA_CAST(pRVar28),tear->_baseScale * halfConst); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(inheritedFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x0))) = (uint32_t)inheritedFlags._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x0))) = (char)(uint32_t)inheritedFlags._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x1))) = (char)(GHIDRA_UINT((uint32_t)inheritedFlags._h) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x2))) = (short)(GHIDRA_UINT((uint32_t)inheritedFlags._h) >> 0x10); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(inheritedFlags._h)) + 0x4))); - SetTearFlags(GHIDRA_CAST(pRVar28),flags_01); - auVar31 = ZEXT416(GHIDRA_UINT(((GHIDRA_CAST(room))->_collisionDamage * halfConst))); - (**(code **)(*GHIDRA_CAST(pRVar28) + 0x40))(); - pcVar1 = *(code **)(*GHIDRA_CAST(pRVar28) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::GetColor(); - in_stack_ffffd9fc = GHIDRA_CAST(0xff); - (*pcVar1)(); - FUN_0060cd70(); - FUN_0060cd90(); - pVVar9 = &(GHIDRA_CAST(room))->_pos; - (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::SetTargetPosition(*pVVar9); - pBVar6 = BitSet128::operator_and - (&hydrobounceMask5,&(GHIDRA_CAST(room))->_tearFlags, - &g_tearFlagHydrobounce); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - FallingSpeed(GHIDRA_CAST(local_898)); - FUN_00444c70(); - (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity_Projectile::set_falling_accel(3.0); - } - local_8b0 = GHIDRA_CAST((GHIDRA_INT(local_8b0) + 1)); - if (GHIDRA_INT(local_890) <= GHIDRA_INT(local_8b0)) break; - pBVar6 = &(GHIDRA_CAST(room))->_tearFlags; - } - (**(code **)(*GHIDRA_CAST(room) + 0x28))(); - } - else { - auVar31 = ZEXT416(GHIDRA_UINT(((float)local_888 * 5.0))); - local_aa4 = (void *)0x96; - local_aa0 = (void *)GHIDRA_INT(((float)local_888 * 5.0)); - msvc::min(); - local_aa8 = &DAT_00000050; - piVar12 = GHIDRA_CAST(std)::max(); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(); - if ((*piVar12 <= iVar7) || (cVar5 = Entity::CollidesWithGrid(), cVar5 != '\0')) - goto LAB_0066ebda; -LAB_0066ef8a: - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - } - if (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) == 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - in_stack_ffffd9fc = GHIDRA_CAST(0x66efd8); - EntityList::QueryRadius - (entityList,GHIDRA_CAST(radiusQuery),pVVar9, - (GHIDRA_CAST((room->_gridEntities + 0xff)))->x * (float)room->_gridEntities[0xd3] - * 4.0,4); - ehState = 6; - local_8b0 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(radiusQuery))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - local_890 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity)::ToTear(); - if (((local_890 != GHIDRA_CAST(0x0)) && (local_890 != room)) && - (cVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::IsDead(), cVar5 == '\0')) { - pBVar8 = &g_tearFlagLudovico; - pBVar6 = TearFlags(GHIDRA_CAST(local_890),&tearFlagsCopy4); - pBVar6 = BitSet128::operator_and(&andResult21,pBVar6,pBVar8); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - Game::GetField26614(g_game); - cVar5 = DeathmatchManager::is_active(); - if ((cVar5 == '\0') || - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::IsDescendantOf(room->_gridEntities[0xe9]), - bVar4 != 0)) { - FUN_00417340(); - local_ab8 = (void *)((*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) + (float)room->_gridEntities[0xd3]); - local_abc = (void *)0x40a00000; - puVar13 = GHIDRA_CAST(std)::max(); - local_87c = GHIDRA_CAST(*puVar13); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::Position(&entityPos16); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((pVVar14)))->Vector)::DistanceSquared(pVVar9); - pRVar28 = local_890; - auVar31 = ZEXT416(GHIDRA_UINT(((float)local_87c * (float)local_87c))); - if ((float)local_8ac <= (float)local_87c * (float)local_87c) { - fVar27 = (long double)Scale(GHIDRA_CAST(local_890)); - local_87c = GHIDRA_CAST((float)fVar27); - if ((GHIDRA_CAST((room->_gridEntities + 0xff)))->x <= (float)local_87c) { - pBVar8 = &g_tearFlagAbsorb; - pBVar6 = TearFlags(GHIDRA_CAST(pRVar28),&tearFlagsCopy5); - pBVar6 = BitSet128::operator_and(&andResult22,pBVar6,pBVar8); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 == 0) { - local_ad8 = (void *)0x3e4ccccd; - local_ad4 = (void *)(((float)local_888 * - (float)pRVar28->_gridEntities[0x100]) / 50.0); - msvc::max(); - local_adc = (void *)0x3f800000; - pfVar15 = GHIDRA_CAST(std)::min(); - local_ae0 = (void *)((float)pRVar28->_gridEntities[0x100] + *pfVar15); - pfVar15 = GHIDRA_CAST(std)::min(); - SetScale(GHIDRA_CAST(pRVar28),*pfVar15); - pcVar1 = *(code **)(*GHIDRA_CAST(pRVar28) + 0x40); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::CollisionDamage(); - local_ae4 = (void *)(float)fVar27; - pfVar15 = GHIDRA_CAST(std)::max(); - auVar31 = ZEXT416(GHIDRA_UINT(((float)local_8d8 + *pfVar15))); - (*pcVar1)(); - (**(code **)(*GHIDRA_CAST(room) + 0x28))(); - break; - } - } - local_ac4 = (void *)0x3e4ccccd; - local_ac0 = (void *)(((float)local_888 * (float)room->_gridEntities[0x100]) / - 50.0); - msvc::max(); - local_ac8 = (void *)0x3f800000; - pfVar15 = GHIDRA_CAST(std)::min(); - local_acc = (void *)((float)room->_gridEntities[0x100] + *pfVar15); - pfVar15 = GHIDRA_CAST(std)::min(); - SetScale(GHIDRA_CAST(room),*pfVar15); - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x40); - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::CollisionDamage(); - local_ad0 = (void *)(float)fVar27; - pfVar15 = GHIDRA_CAST(std)::max(); - auVar31 = ZEXT416(GHIDRA_UINT(((float)local_8d8 + *pfVar15))); - (*pcVar1)(); - (**(code **)(*GHIDRA_CAST(local_890) + 0x28))(); - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - } - } - } - } - local_8b0 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_8b0)) + 0x1)))); - pRVar28 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(radiusQuery))))->EntityList)::Size(); - } while (local_8b0 < pRVar28); - } - ehState = -1; - (GHIDRA_CAST((radiusQuery)))->EntityList_Query::~EntityList_Query(); - } - pBVar6 = GHIDRA_CAST((room->_gridEntities + 0x101)); - } - } - } - pBVar8 = BitSet128::operator_and(&chainMask,pBVar6,&g_tearFlagChain); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - iVar7 = EntityPtr::Ref(); - if (iVar7 == 0) { - if (8.0 < (float)room->_gridEntities[0xe0] || (float)room->_gridEntities[0xe0] == 8.0) { - (GHIDRA_CAST((&g_tearFlagChain)))->BitSet128::__bnot(¬Chain); - FUN_005cd430(); - } - else { - if (room->_gridEntities[0xe6] != GHIDRA_CAST(0x0)) { - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos4); - local_87c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector)::Distance(pVVar9); - if (10.0 < (float)local_87c) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0x11c)))))->EntityPtr::Set(room->_gridEntities[0xe6]); - goto LAB_0066f416; - } - } - iVar7 = find_nearest_linkable_tear(GHIDRA_CAST(room)); - if (iVar7 != 0) { - FUN_0067ae30(); - } - } - } -LAB_0066f416: - auVar31 = ZEXT416(room->_gridEntities[0xe0]); - if ((float)local_8fc < (float)room->_gridEntities[0xe0]) { - iVar7 = EntityPtr::Ref(); - if (iVar7 != 0) { - pEVar11 = GHIDRA_CAST(EntityPtr)::Ref(); - bVar4 = (GHIDRA_CAST((pEVar11)))->Entity::IsTear(); - if (bVar4 != 0) goto LAB_0066f4a9; - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsFrame(4,GHIDRA_INT((room->_bottomRightPos).y)); - if (((bVar4 != 0) && (iVar7 = FUN_0067adc0(), iVar7 < 5)) && - ((iVar7 = Isaac::Random(10), iVar7 == 0 && - (local_87c = GHIDRA_CAST(find_link_partner(GHIDRA_CAST(room))), local_87c != GHIDRA_CAST(0x0))))) - { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0x11c)))))->EntityPtr::Set(GHIDRA_CAST(local_87c)); - (GHIDRA_CAST((GHIDRA_CAST((local_87c->_gridEntities + 0x11d)))))->EntityPtr::Set(GHIDRA_CAST(room)); - } - } -LAB_0066f4a9: - apply_link_spring_forces(GHIDRA_CAST(room)); - } - pBVar8 = BitSet128::operator_and(&tractorBeamMask2,pBVar6,&g_tearFlagTractorBeam); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar8 = BitSet128::operator_and(&ludovicoMask15,pBVar6,&g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar8)))->BitSet128::IsZero(); - if ((((bVar4 != 0) && (room->_gridEntities[0xe6] != (void *)0x0)) && - (iVar7 = (GHIDRA_CAST(()))->Entity::Type(), iVar7 == 1)) && (room->_gridEntities[0x115] == (void *)0x0)) { - local_8e0 = GHIDRA_CAST(__RTDynamicCast()); - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - (GHIDRA_CAST((local_8e0)))->Entity_Player::GetTractorBeam(); - local_8ac = GHIDRA_CAST(__RTDynamicCast()); - if (local_8ac != GHIDRA_CAST(0x0)) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8e0))))->Entity::Position(&entityPos17); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector::__sub(&local_cb0,pVVar9); - local_96c = GHIDRA_CAST(0x3f800000); - pBVar6 = BitSet128::operator_and(&boomerangMask6,pBVar6,&g_tearFlagBoomerang); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && - (local_87c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector)::Dot(&local_cb0), - (float)local_87c < zeroConst)) { - local_96c = &DAT_bf800000; - } - local_87c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector)::Length(); - fVar27 = (long double)(GHIDRA_CAST((local_8ac)))->Entity_Projectile::Damage(); - Vector::FromAngle(&local_cb8,(float)fVar27); - auVar31 = ZEXT416(local_87c); - pVVar9 = (GHIDRA_CAST((&local_cb8)))->Vector::Resized(&resized,(float)local_87c); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1238,GHIDRA_CAST(&local_96c)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator_assign(pVVar9); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8e0))))->Entity::Position(&entityPos18); - local_ae8 = (void *)(GHIDRA_CAST((&local_cb0)))->Vector::Length(); - pVVar14 = (GHIDRA_CAST((&local_cb8)))->Vector::__mul(&local_1248,GHIDRA_CAST(&local_ae8)); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1250,pVVar14); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector::operator_assign(pVVar9); - } - } - } - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - outResult = GHIDRA_CAST(0x66f6d1); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::HasEntityFlags(0x80000); - if (bVar4 != 0) { - pvVar20 = room->_gridEntities[0xe0]; - auVar31 = ZEXT416(pvVar20); - if (5.0 <= (float)pvVar20) { - outResult = GHIDRA_CAST(0x66f72f); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::ClearEntityFlags(0x80000); - } - else { - decayFactor = assert_lerp_range((float)pvVar20,zeroConst,5.0,0.55,1.0,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) = GHIDRA_CAST((decayFactor * (float)room->_gridEntities[0xd2])); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x4))) = extraout_var_27; - room->_gridEntities[0xd2] = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))); - } - } - pBVar6 = BitSet128::operator_and - (&popMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagPop); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and - (&ludovicoMask16,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - outResult = GHIDRA_CAST(popTearQuery); - in_stack_ffffd9fc = GHIDRA_CAST(0x66f7b2); - EntityList::QueryRadius - (entityList,GHIDRA_CAST(outResult),pVVar9,(float)room->_gridEntities[0xd3] * 4.0 - ,4); - ehState = 7; - local_8b0 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(popTearQuery))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - local_898 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity)::ToTear(); - if ((local_898 != GHIDRA_CAST(0x0)) && - (decayFactor = (float)(GHIDRA_CAST((GHIDRA_CAST(local_898))))->PathFinder::GetGridIndex(), - GHIDRA_UINT(decayFactor) <= GHIDRA_UINT((room->_bottomRightPos).y))) { - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::Position(&entityPos19); - outResult = GHIDRA_CAST(0x66f832); - (GHIDRA_CAST((pVVar9)))->Vector::__sub(&separation,pVVar14); - FUN_00417340(); - local_8c0 = GHIDRA_CAST((((*GHIDRA_CAST((GHIDRA_CAST(&(auVar31)) + 0x0))) + (float)room->_gridEntities[0xd3]) * 0.9)); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&separation)))->Vector)::LengthSquared(); - auVar31 = ZEXT416(local_87c); - if ((float)local_87c <= (float)local_8c0 * (float)local_8c0) { - local_87c = GHIDRA_CAST((GHIDRA_CAST((&separation)))->Vector)::LengthSquared(); - auVar31 = ZEXT416(local_87c); - if ((float)local_87c != zeroConst) { - (GHIDRA_CAST((&separation)))->Vector::Normalized(&separationDir); - pVVar25 = GHIDRA_CAST((room->_gridEntities + 0xcf)); - local_8e0 = GHIDRA_CAST((GHIDRA_CAST((pVVar25)))->Vector)::Dot(&separationDir); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::Velocity(&entityVel3); - local_8d0 = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Dot(&separationDir); - relSpeed = (void *)((float)local_8d0 - (float)local_8e0); - bounceFactor = (void *)0x3f8ccccd; - pVVar9 = (GHIDRA_CAST((&separationDir)))->Vector::__mul(&local_1268,GHIDRA_CAST(&relSpeed)); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1270,GHIDRA_CAST(&bounceFactor)); - (GHIDRA_CAST((pVVar25)))->Vector::__add(&bouncedVel,pVVar9); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::Velocity(&entityVel4); - otherRelSpeed = (void *)((float)local_8e0 - (float)local_8d0); - auVar31 = ZEXT416(otherRelSpeed); - pVVar14 = (GHIDRA_CAST((&separationDir)))->Vector::__mul(&local_1280,GHIDRA_CAST(&otherRelSpeed)); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_1288,GHIDRA_CAST(&bounceFactor)); - (GHIDRA_CAST((pVVar9)))->Vector::__add(&otherBouncedVel,pVVar14); - decayFactor = (GHIDRA_CAST((&separation)))->Vector::Length(); - halfOverlap = (void *)(((float)local_8c0 - decayFactor) * 0.5); - pVVar9 = (GHIDRA_CAST((&separationDir)))->Vector::__mul(&local_1290,GHIDRA_CAST(&halfOverlap)); - (GHIDRA_CAST((tearPos)))->Vector::__add(&pushedPos,pVVar9); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::Position(&entityPos20); - pVVar14 = (GHIDRA_CAST((&separationDir)))->Vector::__mul(&local_12a0,GHIDRA_CAST(&halfOverlap)); - (GHIDRA_CAST((pVVar9)))->Vector::__sub(&otherPushedPos,pVVar14); - (GHIDRA_CAST((pVVar25)))->Vector::operator_assign(&bouncedVel); - (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::SetVelocity(&otherBouncedVel); - pVVar9 = tearPos; - (GHIDRA_CAST((tearPos)))->Vector::operator_assign(&pushedPos); - (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::SetPosition(&otherPushedPos); - room = GHIDRA_CAST(tear); - tear->_popBounceCount = tear->_popBounceCount + 1; - *GHIDRA_CAST((local_898->_gridEntities + 0x112)) = - *GHIDRA_CAST((local_898->_gridEntities + 0x112)) + 1; - outResult = GHIDRA_CAST(0x2); - in_stack_ffffd9fc = pVVar9; - SoundEffects::PlayWithFartOverride2(0x1ca,GHIDRA_INT(pVVar9),2,0,1.0,oneConst); - } - } - } - local_8b0 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_8b0)) + 0x1)))); - pRVar28 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(popTearQuery))))->EntityList)::Size(); - } while (local_8b0 < pRVar28); - } - ehState = -1; - room->_gridEntities[0xd2] = (void *)((float)room->_gridEntities[0xd2] * 0.96); - (GHIDRA_CAST((popTearQuery)))->EntityList_Query::~EntityList_Query(); - } - } - if (-5.0 < (float)room->_gridEntities[0xfb]) { -LAB_0066fb70: - pBVar6 = BitSet128::operator_and - (&ludovicoMask17,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 == 0) goto LAB_0066fc9b; - if ((room->_gridEntities[2] == &DAT_00000009) && - (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) == 0)) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator_assign(&g_vectorZero); - room->_gridEntities[0x58] = (void *)0x0; - room->_gridEntities[0x59] = (void *)0x0; - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetRotation(180.0); - outResult = GHIDRA_CAST(0x66fbea); - ANM2::Play(GHIDRA_CAST((room->_gridEntities + 9)),GHIDRA_CAST("Stuck"),0); - } - pBVar6 = BitSet128::operator_and - (&hydrobounceMask6,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagHydrobounce); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - (GHIDRA_CAST((room->_gridEntities + 0xfc)))->_entity = - (void *)((float)(GHIDRA_CAST((room->_gridEntities + 0xfc)))->_entity * -1.6); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity_Projectile::SetHeight(-5.0); - } - *GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) = 1; - room->_gridEntities[0x114] = (void *)(GHIDRA_UINT(room->_gridEntities[0x114]) | 4); - apply_death_flag_effects(GHIDRA_CAST(room),GHIDRA_CAST(0x0)); - if ((room->_gridEntities[0xe6] != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((room->_gridPaths + 0x1f)) != '\0') - ) { - pEVar17 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::ToPlayer(); - if (pEVar17 != GHIDRA_CAST(0x0)) { - outResult = GHIDRA_CAST(0x66fc84); - bVar4 = (GHIDRA_CAST((pEVar17)))->Entity_Player::HasCollectible(0x175,0); - if (bVar4 != 0) { - (GHIDRA_CAST((pEVar17)))->Entity_Player::ClearDeadEyeCharge(); - } - FUN_007cb4f0(); - } - } - goto LAB_00670391; - } - pBVar6 = BitSet128::operator_and - (&hydrobounceMask7,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagHydrobounce); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && - (-5.0 < (float)(GHIDRA_CAST((room->_gridEntities + 0xfc)))->_entity + - (float)room->_gridEntities[0xfb])) goto LAB_0066fb70; -LAB_0066fc9b: - pBVar6 = BitSet128::operator_or(&withBounceWallsonly,&g_tearFlagBounce,&g_tearFlagBounceWallsonly) - ; - outResult = GHIDRA_CAST(0x66fcc2); - pBVar6 = BitSet128::operator_and(&andResult23,GHIDRA_CAST((room->_gridEntities + 0x101)),pBVar6); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 == 0) && (room->_gridEntities[2] != (void *)0x2e)) { -LAB_0066fcf0: - pBVar6 = BitSet128::operator_and - (&ludovicoMask18,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && ((GHIDRA_UINT(room->_gridEntities[3]) & 2) != 0)) goto LAB_00670254; - pBVar6 = BitSet128::operator_and - (&rerollRockWispMask,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagRerollRockWisp); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pEVar30 = GHIDRA_CAST((GHIDRA_CAST((pRVar28)))->Room)::GetGridIndex(pVVar9); - local_8ac = pEVar30; - if (-1 < GHIDRA_INT(pEVar30)) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_8e0 = GHIDRA_CAST((GHIDRA_CAST((pRVar28)))->Room)::GetGridEntity(GHIDRA_UINT(pEVar30)); - if ((local_8e0 != GHIDRA_CAST(0x0)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_8e0))))->GridEntity::IsBreakableRock(), bVar4 != 0)) { - (GHIDRA_CAST((&g_tearFlagRerollRockWisp)))->BitSet128::__bnot(¬RerollRockWisp); - FUN_005cd430(); - FUN_00665b70(); - (GHIDRA_CAST((GHIDRA_CAST(local_8e0))))->GridEntity_Rock::UpdateNeighbors(); - local_87c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xee)))))->RNG)::RandomInt(6); - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - tintedRockIdx = (GHIDRA_CAST((pRVar28)))->Room::GetTintedRockIdx(); - local_890 = GHIDRA_CAST((GHIDRA_UINT((pEVar30 == GHIDRA_CAST(tintedRockIdx))) * 2 + 2)); - if ((pEVar30 == GHIDRA_CAST(tintedRockIdx)) && - (uVar10 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xee)))))->RNG::RandomInt(0x14), uVar10 == 0)) { - persistentGameData = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_manager))))->Room)::GetTopLeftPos(); - bVar4 = PersistentGameData::Unlocked(persistentGameData,0x143); - if (bVar4 != 0) { - local_890 = GHIDRA_CAST(0x16); - } - } - local_888 = GHIDRA_CAST(0x0); - switch(local_87c) { - case GHIDRA_CAST(0x0): - local_87c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xee)))))->RNG)::RandomFloat(); - local_890 = GHIDRA_CAST(&DAT_0000000e); - if ((float)pointSixConst <= (float)local_87c) { - if (0.8 <= (float)local_87c) { - if (0.95 <= (float)local_87c) { - if (0.97 <= (float)local_87c) { - local_888 = GHIDRA_CAST((((float)local_87c < 0.98) + 3)); - } - else { - local_888 = GHIDRA_CAST(&DAT_00000005); - } - } - else { - local_888 = GHIDRA_CAST(0x1); - } - } - else { - local_888 = GHIDRA_CAST(0x2); - } - } - break; - case GHIDRA_CAST(0x1): - local_890 = GHIDRA_CAST(&DAT_00000005); - break; - case GHIDRA_CAST(0x2): - local_890 = GHIDRA_CAST(&DAT_00000006); - break; - case GHIDRA_CAST(0x3): - local_890 = GHIDRA_CAST(0x3); - break; - case GHIDRA_CAST(0x4): - local_890 = GHIDRA_CAST(0xc); - } - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((pRVar28)))->Room::SetGridPath(GHIDRA_INT(pEVar30),0); - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar10 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xee)))))->RNG::Next(); - in_stack_ffffd9fc = GHIDRA_CAST(local_890); - outResult = GHIDRA_CAST(local_888); - (GHIDRA_CAST((pRVar28)))->Room::SpawnGridEntity(GHIDRA_INT(local_8ac),GHIDRA_UINT(local_890),GHIDRA_UINT(local_888),uVar10,0); - } - } - goto LAB_00670391; - } - if ((*GHIDRA_CAST((room->_gridEntities + 0x5b)) != 0) && (-60.0 < (float)room->_gridEntities[0xfb])) - { - pBVar6 = BitSet128::operator_and - (&ludovicoMask19,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if ((bVar4 == 0) || (room->_gridEntities[2] == &DAT_00000009)) goto LAB_0066ffc8; -LAB_00670079: - pBVar6 = BitSet128::operator_and - (&spectralMask2,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagSpectral); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if ((bVar4 == 0) && (room->_gridEntities[2] != &DAT_00000004)) goto LAB_00670391; - pBVar6 = BitSet128::operator_and - (&stickyMask2,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagSticky) - ; - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 == 0) { -LAB_00670113: - if (room->_gridEntities[0x115] != (void *)0x0) goto LAB_00670391; - } - else { - pBVar6 = BitSet128::operator_and - (&boogerMask,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagBooger - ); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 == 0) goto LAB_00670113; - pBVar6 = BitSet128::operator_and - (&sporeMask2,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagSpore) - ; - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 == 0) goto LAB_00670113; - } - game = g_game; - *GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) = 1; - room->_gridEntities[0x114] = (void *)(GHIDRA_UINT(room->_gridEntities[0x114]) | 1); - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(game)); - local_880 = (void *)pVVar9->x; - local_87c = GHIDRA_CAST(pVVar9->y); - outResult = GHIDRA_CAST(0x670165); - iVar7 = (GHIDRA_CAST((pRVar28)))->Room::GetGridCollisionAtPos(*pVVar9); - if (iVar7 == 4) { -LAB_006701a6: - room->_gridEntities[0x114] = (void *)(GHIDRA_UINT(room->_gridEntities[0x114]) | 2); - } - else { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_880 = (void *)pVVar9->x; - local_87c = GHIDRA_CAST(pVVar9->y); - outResult = GHIDRA_CAST(0x6701a1); - iVar7 = (GHIDRA_CAST((pRVar28)))->Room::GetGridCollisionAtPos(*pVVar9); - if (iVar7 == 5) goto LAB_006701a6; - } - apply_death_flag_effects(GHIDRA_CAST(room),GHIDRA_CAST(0x0)); - try_make_bridges(); - if (((room->_gridEntities[0xe6] != GHIDRA_CAST(0x0)) && - (*GHIDRA_CAST((room->_gridPaths + 0x1f)) != '\0')) && - (local_87c = GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity)::ToPlayer(), local_87c != GHIDRA_CAST(0x0)) - ) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - gridEntity = (GHIDRA_CAST((pRVar28)))->Room::GetGridEntityFromPos(pVVar9); - if ((gridEntity == GHIDRA_CAST(0x0)) || - ((iVar7 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar7 != 0xe && - (iVar7 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar7 != 0xc)))) { - pRVar28 = local_87c; - FUN_007cb4f0(); - outResult = GHIDRA_CAST(0x670240); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Entity_Player::HasCollectible(0x175,0); - if (bVar4 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Entity_Player::ClearDeadEyeCharge(); - } - } - } - goto LAB_00670391; - } -LAB_0066ffc8: - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_880 = (void *)pVVar9->x; - local_87c = GHIDRA_CAST(pVVar9->y); - outResult = GHIDRA_CAST(0x66ffff); - iVar7 = (GHIDRA_CAST((pRVar28)))->Room::GetGridCollisionAtPos(*pVVar9); - if (iVar7 != 4) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_880 = (void *)pVVar9->x; - local_87c = GHIDRA_CAST(pVVar9->y); - outResult = GHIDRA_CAST(0x67003b); - iVar7 = (GHIDRA_CAST((pRVar28)))->Room::GetGridCollisionAtPos(*pVVar9); - if (iVar7 == 5) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - iVar7 = (GHIDRA_CAST((pRVar28)))->Room::GetGridPathFromPos(pVVar9); - if (iVar7 < 3000) goto LAB_00670062; - } - goto LAB_00670391; - } -LAB_00670062: - if (*GHIDRA_CAST((room->_gridEntities + 0x5b)) == 0) goto LAB_00670391; - if (room->_gridEntities[2] != &DAT_00000009) goto LAB_00670079; -LAB_0067039b: - if (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) == 0) { - pRVar29 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pRVar28 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - outResult = GHIDRA_CAST(&DAT_bf800000); - in_stack_ffffd9fc = GHIDRA_CAST(pRVar28); - Room::GetClampedPositionImpl - (pRVar29,&roomClampedPos,GHIDRA_CAST(pRVar28),-1.0,-20.0,-40.0,(float)local_8cc); - bVar4 = (GHIDRA_CAST((&roomClampedPos)))->Vector::operator_ne(GHIDRA_CAST(pRVar28)); - if (bVar4 != 0) { - pRVar29 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - puVar13 = GHIDRA_CAST((GHIDRA_CAST((pRVar29)))->Room)::GetTopLeftPos(); - local_87c = GHIDRA_CAST(*puVar13); - local_8cc = GHIDRA_CAST(puVar13[1]); - pRVar29 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - puVar13 = GHIDRA_CAST((GHIDRA_CAST((pRVar29)))->Room)::GetBottomRightPos(); - local_8ac = GHIDRA_CAST(*puVar13); - local_8e0 = GHIDRA_CAST(puVar13[1]); - outResult = GHIDRA_CAST(0x670463); - ANM2::Play(GHIDRA_CAST((room->_gridEntities + 9)),GHIDRA_CAST("Stuck"),0); - if ((float)local_87c <= *GHIDRA_CAST(pRVar28)) { - if (*GHIDRA_CAST(pRVar28) <= (float)local_8ac) { - if ((float)local_8cc <= (float)room->_gridEntities[199]) { - if ((float)local_8e0 < (float)room->_gridEntities[199]) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::set_flip_x(zeroConst < (GHIDRA_CAST((room->_gridEntities + 0xcf)))->x); - set_byte_0x101(GHIDRA_CAST((room->_gridEntities + 9)),1); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::set_flip_x((GHIDRA_CAST((room->_gridEntities + 0xcf)))->x <= zeroConst && - zeroConst != (GHIDRA_CAST((room->_gridEntities + 0xcf)))->x); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetRotation(90.0); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetRotation(90.0); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::set_flip_x(1); - } - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator_assign(&g_vectorZero); - room->_gridEntities[0x58] = (void *)0x0; - room->_gridEntities[0x59] = (void *)0x0; - *GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) = 1; - room->_gridEntities[0x114] = (void *)(GHIDRA_UINT(room->_gridEntities[0x114]) | 3); - } - pRVar29 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pRVar29)))->Room)::GetGridIndex(GHIDRA_CAST(pRVar28)); - if (-1 < GHIDRA_INT(local_87c)) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((&local_2598)))->EntityRef::constructor(GHIDRA_CAST(room)); - outResult = GHIDRA_CAST(0x0); - in_stack_ffffd9fc = GHIDRA_CAST(local_87c); - Room::DestroyGridWithSource(pRVar28); - } - } - } - else { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((pRVar28)))->Room::IsBeastDungeon(); - if (bVar4 != 0) goto LAB_0066fcf0; -LAB_00670254: - pBVar6 = BitSet128::operator_and - (&spectralMask3,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagSpectral); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - puVar19 = &DAT_00000006; - if (bVar4 != 0) { - puVar19 = GHIDRA_CAST(0x3); - } - room->_gridEntities[0x58] = puVar19; - if (*GHIDRA_CAST((room->_gridEntities + 0x5b)) != 0) { - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xcf)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector::__sub(&local_12a8,pVVar9); - try_make_bridges(); - (GHIDRA_CAST((pVVar9)))->Vector::Normalize(); - local_af0 = (void *)(GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0x5c)))))->Vector::Length(); - (GHIDRA_CAST((pVVar9)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_af0)); - (GHIDRA_CAST((&g_tearFlagTractorBeam)))->BitSet128::__bnot(¬TractorBeam); - FUN_005cd430(); - (GHIDRA_CAST((room->_gridEntities + 0x108)))->msvc::vector::clear(0); - local_87c = GHIDRA_CAST(oneConst); - pRVar28 = GHIDRA_CAST(oneConst); - if (room->_gridEntities[0xe9] != GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((room->_gridEntities[0xe9])))->Entity::is_player(); - if (bVar4 == 0) { - pRVar28 = local_87c; - } - else { - (GHIDRA_CAST((room->_gridEntities[0xe9])))->Entity_Player::IsLocalPlayer(); - } - } - outResult = GHIDRA_CAST(0x2); - in_stack_ffffd9fc = GHIDRA_CAST(0x389); - SoundEffects::PlayWithFartOverride(0x389,(float)pRVar28,2,0,1.0); - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((pRVar28)))->Room::is_type_16(); - if (bVar4 != 0) { - (GHIDRA_CAST((&g_tearFlagBounce)))->BitSet128::__bnot(¬Bounce); - FUN_005cd430(); - } - } -LAB_00670391: - if (room->_gridEntities[2] == &DAT_00000009) goto LAB_0067039b; - } - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - if (((room->_gridEntities[2] == &DAT_0000002b) || (room->_gridEntities[2] == &DAT_0000002c)) && - ((*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) == 0 && - (local_8b0 = GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities[0xe9])))->Entity)::ToPlayer(), local_8b0 != GHIDRA_CAST(0x0))))) - { - (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_9cc,GHIDRA_CAST((room->_gridEntities + 0xcf))); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator_ne(&g_vectorZero); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::Normalized(&direction12); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_12b8,GHIDRA_CAST((room->_gridEntities + 0xd3))); - (GHIDRA_CAST((&local_9cc)))->Vector::operator_add_assign(pVVar9); - } - local_890 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - uVar10 = (GHIDRA_CAST((local_890)))->Room::GetGridIndex(&local_9cc); - if (-1 < GHIDRA_INT(uVar10)) { - local_88c = GHIDRA_CAST((GHIDRA_CAST((local_890)))->Room)::GetGridEntity(uVar10); - pos.y = local_9cc.y; - pos.x = local_9cc.x; - local_8cc = GHIDRA_CAST((GHIDRA_CAST((local_890)))->Room)::GetGridCollisionAtPos(pos); - local_898 = room->_gridEntities[0x58]; - if (local_88c != GHIDRA_CAST(0x0)) { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity::GetType(); - if ((iVar7 == 0x10) && (local_8cc == GHIDRA_CAST(&DAT_00000004))) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity_Door::IsLocked(); - if ((bVar4 == 0) || (cVar5 = FUN_00436000(), cVar5 != '\0')) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity_Door::IsRoomType(7); - if ((bVar4 == 0) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity_Door::IsRoomType(8), bVar4 == 0)) { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->EntityList::Size(); - if (iVar7 == 2) goto LAB_006708cc; - (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity_Door::Open(); - } - else { - pcVar1 = *(code **)(*GHIDRA_CAST(local_88c) + 0x14); - (GHIDRA_CAST((&local_25e8)))->EntityRef::EntityRef(); - (*pcVar1)(); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity_Door::TryUnlock(GHIDRA_CAST(local_8b0),1); - } -LAB_00670792: - if (local_898 == GHIDRA_CAST(&DAT_00000004)) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::Die(); - } - } - else { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity::GetType(); - if (iVar7 == 0xb) { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->EntityList::Size(); - if (iVar7 == 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity_Lock::try_unlock(GHIDRA_CAST(local_8b0),1) - ; - goto LAB_00670792; - } - } - else if ((((local_8cc == GHIDRA_CAST(0x3)) || (local_8cc == GHIDRA_CAST(0x2))) && - (iVar7 = FUN_00499db0(), iVar7 == 3)) && - ((local_898 == GHIDRA_CAST(&DAT_00000004) || (iVar7 = Isaac::Random(8), iVar7 == 0)))) - { - pcVar1 = *(code **)(*GHIDRA_CAST(local_88c) + 0x14); - (GHIDRA_CAST((&local_25c0)))->EntityRef::constructor(GHIDRA_CAST(room)); - cVar5 = (*pcVar1)(); - if (cVar5 != '\0') { - if (local_898 == GHIDRA_CAST(&DAT_00000004)) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::Die(); - } - (GHIDRA_CAST((GHIDRA_CAST(local_88c))))->GridEntity::Position(&gridPos); - pVVar9 = (GHIDRA_CAST((&gridPos)))->Vector::__sub(&local_12c0,GHIDRA_CAST((room->_gridEntities + 0xc6))); - pVVar9 = Vector::ToCardinal(&cardinalDir,pVVar9); - local_af4 = (void *)0x42200000; - pVVar9 = Vector::operator_mul(&local_12d0,GHIDRA_CAST(&local_af4),pVVar9); - pVVar9 = (GHIDRA_CAST((&gridPos)))->Vector::__add(&local_12d8,pVVar9); - uVar10 = (GHIDRA_CAST((local_890)))->Room::GetGridIndex(pVVar9); - if (-1 < GHIDRA_INT(uVar10)) { - pRVar28 = local_88c; - gridEntity = (GHIDRA_CAST((local_890)))->Room::GetGridEntity(uVar10); - (GHIDRA_CAST((local_890)))->Room::TryMakeBridge(gridEntity,GHIDRA_CAST(pRVar28)); - } - } - } - } - } - } -LAB_006708cc: - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - entityList = GHIDRA_CAST(FUN_00428a60()); - outResult = GHIDRA_CAST((local_d08 + 0x10)); - in_stack_ffffd9fc = GHIDRA_CAST(0x6708f0); - EntityList::QueryRadius(entityList,GHIDRA_CAST(outResult),pVVar9,24.0,0x10); - ehState = 8; - iVar7 = (GHIDRA_CAST((GHIDRA_CAST((local_d08 + 0x10)))))->EntityList::Size(); - pRVar28 = local_8b0; - if (iVar7 != 0) { - uVar10 = 0; - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - local_890 = GHIDRA_CAST(*puVar13); - if (local_890 != GHIDRA_CAST(0x0)) { - cVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::is_pickup(); - if ((cVar5 == '\0') || - (((iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::Variant(), iVar7 != 0x3c && - (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::Variant(), iVar7 != 0x35)) && - (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::Variant(), iVar7 != 0x37)))) { - cVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::is_slot(); - if ((cVar5 != '\0') && (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity::Variant(), iVar7 == 7)) { - Entity::ForceCollide(GHIDRA_CAST(pRVar28),GHIDRA_CAST(local_890),1); - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_890))))->Entity_Pickup::TryOpenChest(GHIDRA_CAST(pRVar28)); - } - } - uVar10 = uVar10 + 1; - uVar18 = (GHIDRA_CAST((GHIDRA_CAST((local_d08 + 0x10)))))->EntityList::Size(); - } while (uVar10 < uVar18); - pVVar9 = &tear->_pos; - room = GHIDRA_CAST(tear); - } - ehState = -1; - (GHIDRA_CAST((local_d08 + 0x10)))->EntityList_Query::~EntityList_Query(); - } - pBVar6 = BitSet128::operator_and - (&ludovicoMask20,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagLudovico - ); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - local_888 = GHIDRA_CAST((GHIDRA_UINT(room->_gridEntities[3]) >> 1 & 0xffffff01)); - local_8a1 = is_not_familiar_spawned(GHIDRA_CAST(room)); - if ((char)local_888 == '\0') { - decayFactor = 0.7; - } - else { - decayFactor = 0.98; - } - pRVar28 = GHIDRA_CAST((decayFactor * (float)room->_gridEntities[0xd2])); - room->_gridEntities[0xd2] = pRVar28; - local_890 = GHIDRA_CAST(GetRootPlayer(GHIDRA_CAST(room))); - if (local_890 == GHIDRA_CAST(0x0)) { - pRVar28 = GHIDRA_CAST(0x41200000); - } - else { - FUN_005cd750(); - } - local_8cc = pRVar28; - pBVar6 = BitSet128::operator_and - (&flatMask2,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagFlat); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if (local_890 == GHIDRA_CAST(0x0)) { - outResult = GHIDRA_CAST(0x670aac); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(0x0))))->Entity_Player::HasTrinket(0xc,0); - if (bVar4 != 0) goto LAB_00670ae2; - } - pVVar14 = (GHIDRA_CAST((&local_12e0)))->Vector::Vector(oneConst,oneConst); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xd4)))))->Vector::operator_assign(pVVar14); - FUN_00665a50(); - } -LAB_00670ae2: - if ((room->_gridEntities[0xe6] != GHIDRA_CAST(0x0)) && - (bVar4 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::IsFamiliar(), bVar4 != 0)) { - local_8dc = (void *)((float)local_8dc * (float)local_8ec); - } - local_8b0 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector)::Length(); - if ((char)local_888 != '\0') { - decayFactor = assert_lerp_range((float)local_8b0,10.0,20.0,0.9,2.0,1); - local_8dc = (void *)(decayFactor * (float)local_8dc); - } - local_89c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(room))))->Entity)::GetIntervalTicks((float)local_8cc,zeroConst); - if (local_89c != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((room->_gridEntities + 0x108)))->msvc::vector::clear(0); - try_make_bridges(); - if (local_890 != GHIDRA_CAST(0x0)) { - pEVar11 = room->_gridEntities[0xe9]; - iVar7 = Isaac::Random(2); - pRVar28 = local_890; - Entity_Player::GetTearHitParams - (GHIDRA_CAST(local_890),&local_f8,8,1.0,iVar7 * 2 + -1,pEVar11); - room->_gridEntities[0x118] = (void *)0x0; - if (room->_gridEntities[2] != (void *)local_f8._tearVariant) { - room->_gridEntities[2] = (void *)local_f8._tearVariant; - cVar5 = FUN_00665cc0(); - if (cVar5 != '\0') { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::LoadEntityConfig(); - room->_gridEntities[0x58] = (void *)0x0; - if (room->_gridEntities[0xc3] != (void *)0x0) { - ANM2::Load(GHIDRA_CAST((room->_gridEntities + 9)), - GHIDRA_CAST((GHIDRA_INT(room->_gridEntities[0xc3]) + 0x74)),1); - bVar4 = 0; - psVar21 = (std_string *) - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::GetDefaultAnimationName(); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::Play(psVar21,bVar4); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetRotation(0.0); - ResetSpriteScale(GHIDRA_CAST(room)); - } - } - } - if ((char)local_888 != '\0') { - if (10.0 < (float)local_8b0) { - decayFactor = assert_lerp_range((float)local_8b0,10.0,20.0,oneConst,6.0,1); - local_f8._tearDamage = decayFactor * local_f8._tearDamage; - decayFactor = assert_lerp_range((float)local_8b0,10.0,(float)local_8fc,zeroConst,6.0,1); - local_f8._tearDamage = decayFactor + local_f8._tearDamage; - } - (GHIDRA_CAST((&local_f8._flags)))->BitSet128::operator__(&g_tearFlagSpectral); - } - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - room->_gridEntities[0xd9] = (void *)local_f8._tearDamage; - (*pcVar1)(); - pBVar8 = &g_tearFlagLudovico; - pBVar6 = (GHIDRA_CAST((&g_tearFlagBounce)))->BitSet128::__bnot(¬Bounce2); - pBVar6 = BitSet128::operator_and(&andResult24,&local_f8._flags,pBVar6); - pBVar6 = BitSet128::operator_or(&orResult13,pBVar6,pBVar8); - pRVar29 = *GHIDRA_CAST(&pBVar6->_l); - outResult = *GHIDRA_CAST((GHIDRA_INT(&pBVar6->_l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_02._h)) + 0x1))) = (char)(pBVar6->_h >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_02)) + 0x0))) = *GHIDRA_CAST(pBVar6); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_02._h)) + 0x2))) = (short)(pBVar6->_h >> 0x10); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_02._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&pBVar6->_h) + 4)); - in_stack_ffffd9fc = GHIDRA_CAST(pRVar29); - SetTearFlags(GHIDRA_CAST(room),flags_02); - if (local_8a1 != 0) { - pBVar6 = BitSet128::operator_and - (&growMask2,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagGrow) - ; - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos5); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(GHIDRA_CAST((room->_gridEntities + 0xc6))); - decayFactor = Math::clamp(oneConst,700.0,(float)local_87c); - pRVar29 = GHIDRA_CAST(((decayFactor / 700.0 + oneConst) * (float)room->_gridEntities[0xd9])); - room->_gridEntities[0xd9] = pRVar29; - } - pBVar6 = BitSet128::operator_and - (&shrinkMask2,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagShrink); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos6); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(GHIDRA_CAST((room->_gridEntities + 0xc6))); - decayFactor = Math::clamp(zeroConst,700.0,(float)local_87c); - pRVar29 = GHIDRA_CAST((decayFactor / 900.0)); - room->_gridEntities[0xd9] = - (void *)((oneConst - (float)pRVar29) * (float)room->_gridEntities[0xd9]); - } - pRVar28 = local_890; - } - pBVar6 = BitSet128::operator_and - (&occultMask2,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagOccult); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (((bVar4 == 0) || - (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Entity_Player::GetFireDirection(), iVar7 == -1)) || - (GHIDRA_INT(local_89c) < 1)) { - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - } - else { - do { - pVVar9 = MusicManager::RandomVector(&randomDir4); - FUN_00436190(); - pRVar29 = GHIDRA_CAST(((float)pRVar29 * 10.0)); - local_af8 = pRVar29; - pVVar14 = Vector::operator_mul(&local_1300,GHIDRA_CAST(&local_af8),pVVar9); - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - outResult = GHIDRA_CAST(&DAT_00000007); - in_stack_ffffd9fc = GHIDRA_CAST(pVVar14->y); - Entity_Player::FireTear(GHIDRA_CAST(local_890),pVVar9,*pVVar14,7,GHIDRA_CAST(room),1.0) - ; - local_89c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_89c[-1])) + 0x7897)))); - } while (local_89c != GHIDRA_CAST(0x0)); - local_89c = GHIDRA_CAST(0x0); - } - } - } - if (local_8a1 == 0) { - if (((room->_gridEntities[0xe6] != (void *)0x0) && (iVar7 = (GHIDRA_CAST(()))->Entity::Type(), iVar7 == 2)) && - (pvVar20 = (void *)(GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Variant(), - room->_gridEntities[2] != pvVar20)) { - room->_gridEntities[2] = pvVar20; - cVar5 = FUN_00665cc0(); - if (cVar5 != '\0') { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::LoadEntityConfig(); - if (room->_gridEntities[0xc3] != (void *)0x0) { - ANM2::Load(GHIDRA_CAST((room->_gridEntities + 9)), - GHIDRA_CAST((GHIDRA_INT(room->_gridEntities[0xc3]) + 0x74)),1); - bVar4 = 0; - psVar21 = (std_string *) - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::GetDefaultAnimationName(); - outResult = GHIDRA_CAST(0x6715e3); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::Play(psVar21,bVar4); - ResetSpriteScale(GHIDRA_CAST(room)); - } - } - } - puVar19 = room->_gridEntities[2]; - if (((puVar19 == &DAT_00000005) || (puVar19 == &DAT_00000006)) || - ((puVar19 == &DAT_00000007 || - (((puVar19 == &DAT_00000014 || (puVar19 == GHIDRA_CAST(0x21))) || - (puVar19 == GHIDRA_CAST(0x22))))))) { -LAB_0067162f: - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetRotation((float)room->_gridEntities[0x10d]); - } - else { - pBVar6 = BitSet128::operator_and - (&flatMask3,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagFlat); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) goto LAB_0067162f; - } - if ((GHIDRA_UINT(room->_gridEntities[3]) & 1) != 0) { - if (room->_gridEntities[0xe6] != GHIDRA_CAST(0x0)) { - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos7); - pVVar25 = GHIDRA_CAST((room->_gridPaths + 0x22)); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::FrameCount(); - iVar7 = iVar7 + tear->_index * 0x32; - decayFactor = sinf_wrapper((float)((double)iVar7 + - __uint_to_double_fixup[-(iVar7 >> 0x1f)]) * 0.08); - local_87c = GHIDRA_CAST((decayFactor * halfConst + oneConst)); - decayFactor = (GHIDRA_CAST((pVVar25)))->Vector::Length(); - pVVar14 = (GHIDRA_CAST((pVVar25)))->Vector::Resized(&resized2,decayFactor * (float)local_87c); - pVVar14 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1388,pVVar14); - pVVar9 = tearPos; - (GHIDRA_CAST((tearPos)))->Vector::operator_assign(pVVar14); - outResult = GHIDRA_CAST(0x67174f); - pVVar14 = (GHIDRA_CAST((pVVar25)))->Vector::Rotated(&rotatedDir, - ((float)(GHIDRA_UINT(tear->_index) % 10) + 0.0) * 0.1 - 4.0); - (GHIDRA_CAST((pVVar25)))->Vector::operator_assign(pVVar14); - room = GHIDRA_CAST(tear); - } - } - if (room->_gridEntities[0xe6] == (void *)0x0) { - (**(code **)(*GHIDRA_CAST(room) + 0x28))(); - } - } - else { - FUN_00424510(); - ehState = 9; - for (chainChild = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(room))))->Entity)::Child(); chainChild != GHIDRA_CAST(0x0); - chainChild = GHIDRA_CAST((GHIDRA_CAST((chainChild)))->Entity)::Child()) { - msvc::vector::push_back(); - } - local_8ec = (void *)0x0; - iVar7 = (GHIDRA_CAST((local_9e0)))->msvc::vector::size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(FUN_0042c810()); - local_898 = GHIDRA_CAST(*puVar13); - (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::SetVelocity(GHIDRA_CAST((room->_gridEntities + 0xcf))); - local_8b0 = GHIDRA_CAST(((float)((double)GHIDRA_INT(local_8ec) + - __uint_to_double_fixup[-(GHIDRA_INT(local_8ec) >> 0x1f)]) * 360.0)); - iVar7 = (GHIDRA_CAST((local_9e0)))->msvc::vector::size(); - local_8b0 = GHIDRA_CAST(((float)local_8b0 / - (float)((double)iVar7 + __uint_to_double_fixup[-(iVar7 >> 0x1f)]))); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(); - local_8cc = GHIDRA_CAST(((float)iVar7 * 5.0 + (float)local_8b0)); - local_948 = (void *)((float)room->_gridEntities[0xd3] + (float)room->_gridEntities[0xd3]); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::FrameCount(); - if (iVar7 < 0x32) { - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::FrameCount(); - local_948 = (void *)(((float)iVar7 / 50.0) * (float)local_948); - } - pVVar14 = Vector::FromAngle(&angleDir7,(float)local_8cc); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_1310,GHIDRA_CAST(&local_948)); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_1318,pVVar14); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::Position(&entityPos21); - bVar4 = 0; - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_1328,pVVar14); - pRVar28 = local_898; - (GHIDRA_CAST((GHIDRA_CAST(local_898))))->Entity::AddVelocity_divided(pVVar9,bVar4); - fVar27 = (long double)Scale(GHIDRA_CAST(room)); - SetScale(GHIDRA_CAST(pRVar28),(float)(fVar27 * (long double)0.5)); - pcVar1 = *(code **)(*GHIDRA_CAST(pRVar28) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::GetColor(); - outResult = GHIDRA_CAST(0xff); - in_stack_ffffd9fc = GHIDRA_CAST(0xffffffff); - (*pcVar1)(); - pBVar6 = (GHIDRA_CAST((&g_tearFlagExplosive)))->BitSet128::__bnot(¬Explosive2); - pBVar6 = BitSet128::operator_and - (&andResult25,GHIDRA_CAST((room->_gridEntities + 0x101)),pBVar6); - pRVar28 = local_898; - SetTearFlags(GHIDRA_CAST(local_898),*pBVar6); - FUN_0044bfa0(); - (**(code **)(*GHIDRA_CAST(pRVar28) + 0x40))(); - normalize_angle_degrees((float)local_8cc + 90.0); - FUN_004aadb0(); - pvVar24 = (void *)(GHIDRA_INT(local_8ec) + 1); - local_8ec = pvVar24; - pvVar20 = (void *)(GHIDRA_CAST((local_9e0)))->msvc::vector::size(); - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - } while (pvVar24 < pvVar20); - } - if (room->_gridEntities[0xe6] != GHIDRA_CAST(0x0)) { - bVar4 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::IsFamiliar(); - if (bVar4 != 0) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - outResult = GHIDRA_CAST((local_d68 + 0x10)); - in_stack_ffffd9fc = GHIDRA_CAST(0x67126f); - EntityList::QueryRadius - (entityList,GHIDRA_CAST(outResult),GHIDRA_CAST((room->_gridEntities + 0xc6)), - 24.0,4); - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),10); - local_8b0 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST((local_d68 + 0x10)))))->EntityList::Size(); - if (iVar7 != 0) { - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - local_8cc = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar13))))->Entity)::ToTear(); - if ((local_8cc != GHIDRA_CAST(0x0)) && (local_8cc != room)) { - pBVar6 = BitSet128::operator_and - (&ludovicoMask21,GHIDRA_CAST((local_8cc->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && - (bVar4 = is_not_familiar_spawned(GHIDRA_CAST(local_8cc)), bVar4 != 0)) { - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_8cc))))->Entity::Position(&entityPos22); - outResult = GHIDRA_CAST(0x671317); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc6)))))->Vector::__sub(&local_984,pVVar9); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&local_984)))->Vector)::Length(); - if (24.0 <= (float)local_87c) { - local_978 = GHIDRA_CAST(zeroConst); - } - else { - decayFactor = (GHIDRA_CAST((&local_984)))->Vector::Length(); - local_87c = GHIDRA_CAST((4.0 / (decayFactor + 1.0))); - local_978 = local_87c; - } - bVar4 = (GHIDRA_CAST((&local_984)))->Vector::operator_eq(&g_vectorZero); - if (bVar4 != 0) { - pVVar9 = MusicManager::RandomVector(&randomDir5); - (GHIDRA_CAST((&local_984)))->Vector::operator_assign(pVVar9); - } - if (zeroConst < (float)local_978) { - pVVar9 = (GHIDRA_CAST((&local_984)))->Vector::Normalized(&direction13); - bVar4 = 0; - in_stack_ffffd9fc = GHIDRA_CAST(0x6713d7); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__mul(&local_1348,GHIDRA_CAST(&local_978)); - outResult = GHIDRA_CAST(0x6713df); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::AddVelocity_divided(pVVar9,bVar4); - } - } - } - local_8b0 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_8b0)) + 0x1)))); - pRVar28 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((local_d68 + 0x10)))))->EntityList)::Size(); - } while (local_8b0 < pRVar28); - } - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),9); - (GHIDRA_CAST((local_d68 + 0x10)))->EntityList_Query::~EntityList_Query(); - } - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - pVVar14 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos8); - local_87c = GHIDRA_CAST((GHIDRA_CAST((pVVar14)))->Vector)::DistanceSquared(pVVar9); - if ((char)local_888 != '\0') { - if ((float)local_87c <= 1600.0) { - ehState = -1; - room->_gridEntities[0xd2] = (void *)((float)room->_gridEntities[0xd2] * 0.9); - FID_conflict__Tidy(local_9e0); - } - else { - pVVar14 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos9); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__sub(&local_1360,pVVar9); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::Normalized(&direction14); - bVar4 = 0; - local_afc = (void *)0x3dcccccd; - in_stack_ffffd9fc = GHIDRA_CAST(0x6714a7); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__mul(&local_1370,GHIDRA_CAST(&local_afc)); - outResult = GHIDRA_CAST(0x6714af); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::AddVelocity_divided(pVVar14,bVar4); - ehState = -1; - FID_conflict__Tidy(local_9e0); - } - goto LAB_0067176f; - } - bVar4 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::is_player(); - if (bVar4 != 0) { - outResult = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - pEVar17 = GHIDRA_CAST(__RTDynamicCast()); - bVar4 = (GHIDRA_CAST((pEVar17)))->Entity_Player::HasWeaponType(8); - if (bVar4 == 0) { - pRVar28 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(room))))->Entity)::Child(); - while (pRVar28 != GHIDRA_CAST(0x0)) { - local_87c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pRVar28))))->Entity)::Child(); - (**(code **)(*GHIDRA_CAST(pRVar28) + 0x28))(); - pRVar28 = local_87c; - } - } - } - } - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - ehState = -1; - FID_conflict__Tidy(local_9e0); - } - } -LAB_0067176f: - Game::GetField26614(g_game); - cVar5 = DeathmatchManager::is_active(); - if (cVar5 == '\0') { -LAB_006717e1: - local_8a1 = '\0'; - } - else { - playerManager = GHIDRA_CAST(Game)::GetPlayerManager(g_game); - bVar4 = PlayerManager::AnyoneHasCollectible(playerManager,0x1a7); - if (bVar4 == 0) goto LAB_006717e1; - outResult = GHIDRA_CAST(0x6717b0); - (GHIDRA_CAST((&local_8c)))->RNG::game_constructor(GHIDRA_UINT(room->_gridEntities[0xf2]),0x2c); - ehState = 0xb; - local_8f8 = GHIDRA_CAST((GHIDRA_UINT(local_8f8) | 1)); - local_87c = local_8f8; - uVar10 = (GHIDRA_CAST((laser)))->RNG::RandomInt(100); - local_8a1 = '\x01'; - if (0x20 < uVar10) goto LAB_006717e1; - } - ehState = -1; - if ((GHIDRA_UINT(local_8f8) & 1) != 0) { - guard_check_icall(); - } - if (local_8a1 != '\0') { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - outResult = GHIDRA_CAST(0x3); - in_stack_ffffd9fc = GHIDRA_CAST(&DAT_00000008); - EntityList::QuerySublist(entityList,GHIDRA_CAST(local_d68),7,8,3,1,0); - ehState = 0xc; - local_8f8 = GHIDRA_CAST(0x0); - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_d68))))->EntityList::Size(); - if (iVar7 != 0) { - while( true ) { - msvc::vector::operator_index(); - outResult = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - in_stack_ffffd9fc = GHIDRA_CAST(0x0); - local_8cc = GHIDRA_CAST(__RTDynamicCast()); - local_888 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_8cc))))->Entity)::SpawnerEntity(); - if ((local_888 != GHIDRA_CAST(0x0)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_888))))->Entity::is_player(), bVar4 == 0)) { - local_888 = GHIDRA_CAST(0x0); - } - if (room->_gridEntities[0xe9] != local_888) { - fVar27 = (long double)(GHIDRA_CAST((GHIDRA_CAST(local_8cc))))->Entity_Laser::Radius(); - local_87c = GHIDRA_CAST((float)fVar27); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_8cc))))->Entity::Position(&entityPos23); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::DistanceSquared(pVVar14); - if ((float)local_8ac < (float)local_87c * (float)local_87c) { - (**(code **)(*GHIDRA_CAST(room) + 0x28))(); - pRVar28 = local_888; - if (local_888 == GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((&local_878)))->TearParams::constructor(); - other = extraout_EAX; - } - else { - pEVar11 = GHIDRA_CAST(0x0); - iVar7 = Isaac::Random(2); - other = Entity_Player::GetTearHitParams - (GHIDRA_CAST(pRVar28),local_810,1,1.0,iVar7 * 2 + -1,pEVar11); - } - (GHIDRA_CAST((&tearHitParams)))->TearParams::copy(other); - uVar10 = Random(); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::__unm(&negated3); - Game::Spawn(g_game,2,0,GHIDRA_CAST((room->_gridEntities + 0xc6)),pVVar9,GHIDRA_CAST(local_888) - ,0,uVar10); - spawnedTear = GHIDRA_CAST(__RTDynamicCast()); - Entity_Projectile::SetHeight - (GHIDRA_CAST(spawnedTear),(float)room->_gridEntities[0xfb]); - FUN_00444c70(); - spawnedTear->SetCollisionDamage(); - SetTearFlags(spawnedTear,g_tearFlagHoming); - SetScale(spawnedTear,tearHitParams._tearScale); - Entity_Projectile::set_falling_accel - (GHIDRA_CAST(spawnedTear),(GHIDRA_CAST((room->_gridEntities + 0xfd)))->x) - ; - (GHIDRA_CAST(()))->Color::Color(); - outResult = GHIDRA_CAST(0x0); - in_stack_ffffd9fc = GHIDRA_CAST(0xff); - spawnedTear->SetColor(); - (GHIDRA_CAST((GHIDRA_CAST(spawnedTear))))->Entity::SetParent(GHIDRA_CAST(local_888)); - spawnedTear->Update(); - } - } - puVar23 = &(*GHIDRA_CAST((GHIDRA_CAST((local_8f8)) + 0x1))); - local_8f8 = GHIDRA_CAST(puVar23); - puVar19 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_d68))))->EntityList)::Size(); - if (puVar19 <= puVar23) break; - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - } - } - ehState = -1; - (GHIDRA_CAST((local_d68)))->EntityList_Query::~EntityList_Query(); - } - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xff)); - pVVar9->x = (float)local_8dc * (float)room->_gridEntities[0x100]; - local_b00 = (void *)0x3c23d70a; - local_8c0 = GHIDRA_CAST(pVVar9); - pfVar15 = GHIDRA_CAST(std)::max(); - pVVar9->x = *pfVar15; - ResetSpriteScale(GHIDRA_CAST(room)); - if (room->_gridEntities[2] == (void *)0x2e) { - pEVar30 = room->_gridEntities[0x10c]; - local_8ac = pEVar30; - if (room->_gridEntities[0xe9] != GHIDRA_CAST(0x0)) { - local_87c = GHIDRA_CAST(((float)pEVar30 * (float)pointSixConst)); - pVVar9 = (GHIDRA_CAST((room->_gridEntities[0xe9])))->Entity::Position(&spawnerPos); - local_8cc = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::Distance(GHIDRA_CAST((room->_gridEntities + 0xc6))); - pEVar30 = (Entity_Projectile *) - assert_lerp_range((float)local_8cc,zeroConst,160.0,(float)local_8ac,(float)local_87c - ,1); - } - room->_gridEntities[0xd9] = pEVar30; - local_97c = (void *)Math::clamp(pointThreeConst,oneConst, - (float)room->_gridEntities[0xe0] / (float)local_8fc); - outResult = GHIDRA_CAST(0x671bef); - pVVar9 = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&uniformScale13,GHIDRA_CAST(&local_97c)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetScale(pVVar9); - effect = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite)::Color(); - decayFactor = Math::clamp(zeroConst,(float)pointSixConst, - (float)room->_gridEntities[0xe0] / (float)local_8f4); - Font::SetLineHeightModifier(effect,oneConst - decayFactor); - local_b04 = (void *)0x3f19999a; - pfVar15 = GHIDRA_CAST(std)::max(); - room->_gridEntities[0xd3] = - (void *)(*GHIDRA_CAST((GHIDRA_INT(room->_gridEntities[0xc3]) + 0x38)) * *pfVar15 * 5.0); - } - bVar4 = Game::IsInTimedSet(g_game,0x25); - if (bVar4 != 0) { - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - outResult = GHIDRA_CAST(0x0); - in_stack_ffffd9fc = GHIDRA_CAST(0x3f800000); - color = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::SetColor(color); - } - prevPos.y = (float)room->_gridEntities[199]; - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - prevPos.x = pVVar9->x; - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::Update(); - pBVar6 = BitSet128::operator_and - (&bit127Mask,GHIDRA_CAST((room->_gridEntities + 0x101)), - GHIDRA_CAST(&DAT_00c346d0)); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - if (room->_gridEntities[0xe6] != (void *)0x0) { - pBVar6 = BitSet128::operator_and - (&bit125Mask,GHIDRA_CAST((room->_gridEntities + 0x101)), - GHIDRA_CAST(&DAT_00c346b0)); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (((bVar4 == 0) || (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(), iVar7 < 1)) || - ((0 < room->_gridPaths[0x34] && - (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::GetIntervalTicks((float)room->_gridPaths[0x34],zeroConst), - iVar7 == 0)))) { - local_8f4 = GHIDRA_CAST((room->_gridEntities + 0xcf)); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_13b8,GHIDRA_CAST(local_8f4)); - pVVar14 = GHIDRA_CAST(FUN_004172b0()); - (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_cc8,pVVar14); - local_95c = (void *)(GHIDRA_CAST((&local_cc8)))->Vector::Length(); - if ((float)local_95c != zeroConst) { - (GHIDRA_CAST((&local_cc8)))->Vector::__div(&local_c88,GHIDRA_CAST(&local_95c)); - decayFactor = (GHIDRA_CAST((&local_c88)))->Vector::GetAngleDegrees(); - room->_gridPaths[0x35] = GHIDRA_INT(decayFactor); - (GHIDRA_CAST((GHIDRA_CAST(local_8f4))))->Vector::operator__(GHIDRA_CAST((room->_gridEntities + 0xc4))); - bVar4 = 0; - local_b08 = (void *)((50.0 - (float)local_95c) * 0.1); - pVVar9 = (GHIDRA_CAST((&local_c88)))->Vector::__mul(local_13c8,GHIDRA_CAST(&local_b08)); - pVVar9 = vector_lerp(&lerped,GHIDRA_CAST(local_8f4),pVVar9,bVar4,pointThreeConst); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(tear->_parent))))->Entity::Velocity(&parentVel); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_13e0,pVVar14); - (GHIDRA_CAST((GHIDRA_CAST(local_8f4))))->Vector::operator_assign(pVVar9); - pVVar9 = (GHIDRA_CAST((GHIDRA_CAST(tear->_parent))))->Entity::Velocity(&parentVel2); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xc4)))))->Vector::operator_assign(pVVar9); - room = GHIDRA_CAST(tear); - } - pvVar20 = (void *)Math::lerp((float)room->_gridEntities[0xfb],-23.0,(float)local_900,0); - room->_gridEntities[0xfb] = pvVar20; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsFrame(8,0); - if (bVar4 != 0) { - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((local_438)))->Color::Color(oneConst,oneConst,oneConst,0.35,0.45,0.5); - (GHIDRA_CAST((aCStackY_3c4c + 0x81)))->Color::operator_assign(&tear->_color); - FUN_004072e0(); - (*pcVar1)(); - } - goto LAB_00673502; - } - } - outResult = GHIDRA_CAST(Vector)::FromAngle(&angleDir8,(float)room->_gridPaths[0x35]); - in_stack_ffffd9fc = GHIDRA_CAST(0x67201c); - pVVar14 = Vector::operator_mul - (&local_13f8,GHIDRA_CAST((room->_gridPaths + 0x33)),GHIDRA_CAST(outResult)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator_assign(pVVar14); - room->_gridPaths[0x35] = 0x3c75c28f; - } - if (room->_gridEntities[0xe8] != (void *)0x0) { - pBVar6 = BitSet128::operator_and - (&turnHorizontalMask2,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagTurnHorizontal); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::Normalized(&velDir); - pVVar14 = (GHIDRA_CAST((room->_gridEntities[0xe8])))->Entity::Position(&targetPos5); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__sub(&local_1408,&prevPos); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__sub(&local_1410,GHIDRA_CAST((room->_gridEntities + 0xcf))); - (GHIDRA_CAST((pVVar14)))->Vector::Normalized(&local_d88); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((&local_d88)))->Vector)::Dot(&velDir); - pVVar14 = (GHIDRA_CAST((room->_gridEntities[0xe8])))->Entity::Position(&targetPos6); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__sub(&local_1420,pVVar9); - outResult = GHIDRA_CAST(0x672114); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__sub(&local_1428,GHIDRA_CAST((room->_gridEntities + 0xcf))); - (GHIDRA_CAST((pVVar14)))->Vector::Normalized(&local_cd8); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&local_cd8)))->Vector)::Dot(&velDir); - if ((zeroConst < (float)local_87c) || - (((float)local_8ac <= zeroConst && ((float)local_87c < -0.1)))) { - if (((float)local_87c < -0.1) && ((float)local_8ac < -0.1)) { - pBVar6 = BitSet128::operator_and - (&homingMask5,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagHoming); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetTarget(GHIDRA_CAST(0x0)); - } - } - } - else { - pVVar14 = (GHIDRA_CAST((&velDir)))->Vector::Rotated(&perpDir2,90.0); - (GHIDRA_CAST((&velDir)))->Vector::operator_assign(pVVar14); - local_87c = GHIDRA_CAST((GHIDRA_CAST((&velDir)))->Vector)::Dot(&local_cd8); - if ((float)local_87c < zeroConst) { - local_b0c = &DAT_bf800000; - (GHIDRA_CAST((&velDir)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_b0c)); - } - local_b10 = (void *)(GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::Length(); - outResult = GHIDRA_CAST(0x672206); - pVVar14 = (GHIDRA_CAST((&velDir)))->Vector::__mul(&local_1438,GHIDRA_CAST(&local_b10)); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator_assign(pVVar14); - (GHIDRA_CAST((&g_tearFlagTurnHorizontal)))->BitSet128::__bnot(¬TurnHorizontal); - FUN_005cd430(); - } - } - } - pBVar6 = BitSet128::operator_and - (&stickyMask3,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagSticky); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - pBVar6 = BitSet128::operator_and - (&boogerMask2,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagBooger); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) goto LAB_006722d8; - pBVar6 = BitSet128::operator_and - (&sporeMask3,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagSpore); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) goto LAB_006722d8; - } - else { -LAB_006722d8: - local_8b0 = GHIDRA_CAST((room->_gridEntities + 0x115)); - if (room->_gridEntities[0x115] == (void *)0x0) { - if (((room->_gridEntities[2] == (void *)0x1a) || (room->_gridEntities[2] == (void *)0x30)) && - (bVar4 = ANM2::IsPlaying(GHIDRA_CAST((room->_gridEntities + 9)),&s_empty), bVar4 == 0)) { - pAVar22 = GHIDRA_CAST(Config)::GetPillEffects(); - psVar21 = ANM2::GetAnimation(pAVar22,GHIDRA_CAST((local_1d8 + 0x2c))); - ehState = 0x10; - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::Play(psVar21,0); - ehState = -1; - (GHIDRA_CAST((local_1d8 + 0x2c)))->msvc::string::_Tidy_deallocate(); - } - } - else { - cVar5 = (GHIDRA_CAST(()))->Entity::Visible(); - if ((cVar5 == '\0') || - (iVar7 = (GHIDRA_CAST((room->_gridEntities[0x115])))->Entity::EntityCollisionClass(), iVar7 == 0)) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0x115)))))->EntityPtr::SetReference(GHIDRA_CAST(0x0)); - (GHIDRA_CAST((room->_gridEntities + 0x108)))->msvc::vector::clear(0); - if ((room->_gridEntities[2] == (void *)0x1a) || (room->_gridEntities[2] == (void *)0x30)) { - pAVar22 = GHIDRA_CAST(Config)::GetPillEffects(); - psVar21 = ANM2::GetAnimation(pAVar22,&curAnimName); - ehState = 0xd; - outResult = GHIDRA_CAST(0x6723d6); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::Play(psVar21,0); - ehState = -1; - (GHIDRA_CAST((curAnimName._buf)))->msvc::string::_Tidy_deallocate(); - } - } - else { - pVVar14 = (GHIDRA_CAST((room->_gridEntities[0x115])))->Entity::Velocity(&stickTargetVel); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::operator_assign(pVVar14); - pVVar14 = (GHIDRA_CAST((room->_gridEntities[0x115])))->Entity::Position(&stickTargetPos); - outResult = GHIDRA_CAST(0x672353); - pVVar14 = (GHIDRA_CAST((pVVar14)))->Vector::__add(&local_1450,GHIDRA_CAST((room->_gridEntities + 0x116))); - (GHIDRA_CAST((pVVar9)))->Vector::operator_assign(pVVar14); - if (((room->_gridEntities[2] == (void *)0x1a) || (room->_gridEntities[2] == (void *)0x30)) - && (bVar4 = ANM2::IsPlaying(GHIDRA_CAST((room->_gridEntities + 9)),&s_empty), bVar4 != 0)) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 9)))))->Sprite::Stop(); - } - } - room->_gridEntities[0x118] = (void *)(GHIDRA_INT(room->_gridEntities[0x118]) + -1); - if (GHIDRA_INT(room->_gridEntities[0x118]) < 1) { - *GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) = 1; - room->_gridEntities[0x114] = (void *)(GHIDRA_UINT(room->_gridEntities[0x114]) | 0x40); - (GHIDRA_CAST((room->_gridEntities + 0xff)))->x = - (float)local_8b4 * (float)room->_gridEntities[0x100]; - local_b14 = (void *)0x3c23d70a; - pfVar15 = GHIDRA_CAST(std)::max(); - (GHIDRA_CAST((room->_gridEntities + 0xff)))->x = *pfVar15; - ResetSpriteScale(GHIDRA_CAST(room)); - pBVar6 = BitSet128::operator_and - (&stickyMask4,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagSticky); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - uVar37 = 0x83; - uVar38 = 0x24; - uVar39 = 0x67; - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0x101)))))->BitSet128::operator__(&g_tearFlagExplosive); - room->_gridEntities[0x114] = (void *)(GHIDRA_UINT(room->_gridEntities[0x114]) | 0x20); - room->_gridEntities[0xd9] = (void *)((float)room->_gridEntities[0xd9] + 60.0); - local_8f4 = GetRootPlayer(GHIDRA_CAST(room)); - if (local_8f4 != GHIDRA_CAST(0x0)) { - uVar40 = 0; - FUN_00435bc0(); - Entity_Player::GetBombVariant(); - FUN_00435bc0(); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = GHIDRA_CAST(outResult); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = GHIDRA_CAST(in_stack_ffffd9fc); - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = uVar37; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x1))) = uVar38; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x2))) = uVar39; - (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = uVar40; - decayFactor = (GHIDRA_CAST((local_8f4)))->Entity_Player::check_bomb_tearflags(tearFlags); - if (1.5 <= decayFactor) { - room->_gridEntities[0xd9] = (void *)((float)room->_gridEntities[0xd9] + 50.0); - } - } - } - pBVar6 = BitSet128::operator_and - (&sporeMask4,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagSpore) - ; - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - pRVar29 = GHIDRA_CAST(GetRootPlayer(GHIDRA_CAST(room))); - color = GHIDRA_CAST((GHIDRA_CAST(()))->Color)::Color(); - pRVar28 = room; - if (pRVar29 != GHIDRA_CAST(0x0)) { - pRVar28 = pRVar29; - } - pVVar9 = GHIDRA_CAST((room->_gridEntities + 0xc6)); - Game::Fart(g_game,pVVar9,85.0,GHIDRA_CAST(pRVar28),1.0,0,color); - if (room->_gridEntities[0x115] != (void *)0x0) { - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::HasEntityFlags(0x80000000000); - if (bVar4 == 0) { - iVar7 = Isaac::Random(3); - local_8ec = (void *)(iVar7 + 2); - } - else { - local_8ec = (void *)Isaac::Random(2); - } - decayFactor = random_float(); - local_87c = GHIDRA_CAST((decayFactor * 360.0)); - FUN_00424510(); - ehState = 0xe; - FUN_00431620(); - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - entityList = GHIDRA_CAST(FUN_00428a60()); - EntityList::QueryRadius(entityList,GHIDRA_CAST(radiusQuery200),pVVar9,200.0,8); - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),0xf); - local_8f8 = GHIDRA_CAST(0x0); - if (0 < GHIDRA_INT(local_8ec)) { - local_8e0 = GHIDRA_CAST((room->_gridEntities + 0xcf)); - do { - pvVar20 = local_8ec; - decayFactor = random_float(); - Vector::FromAngle(&local_b8c, - ((decayFactor * 0.8 + ((float)GHIDRA_INT(local_8f8) - (float)local_900)) - * 360.0) / (float)GHIDRA_INT(pvVar20) + (float)local_87c); - local_8fc = GHIDRA_CAST(0x0); - local_8f4 = (void *)0x4e6e6b28; - local_8ac = (void *)0x0; - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(radiusQuery200))))->EntityList::Size(); - if (iVar7 != 0) { - pEVar30 = local_8ac; - do { - puVar13 = GHIDRA_CAST(std)::vector::operator_index(); - room = GHIDRA_CAST(*puVar13); - local_8cc = room; - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (((bVar4 != 0) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::HasEntityFlags(0x20000000), bVar4 == 0)) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_c80))))->EntityList::HitListContains(GHIDRA_CAST(room)), - bVar4 == 0)) { - local_b18 = (void *)0x43480000; - pVVar9 = Vector::operator_mul(&local_1458,GHIDRA_CAST(&local_b18),&local_b8c); - pVVar9 = (GHIDRA_CAST((tearPos)))->Vector::__add(&local_1460,pVVar9); - pVVar14 = (GHIDRA_CAST((GHIDRA_CAST(local_8cc))))->Entity::Position(&entityPos24); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((pVVar9)))->Vector)::DistanceSquared(pVVar14); - if ((float)local_8ac < (float)local_8f4) { - local_8fc = local_8cc; - local_8f4 = GHIDRA_CAST(local_8ac); - } - } - room = local_8fc; - pEVar30 = GHIDRA_CAST((GHIDRA_INT(pEVar30) + 1)); - pvVar20 = (void *)(GHIDRA_CAST((GHIDRA_CAST(radiusQuery200))))->EntityList::Size(); - spawnedTear = tear; - } while (pEVar30 < pvVar20); - if (room != GHIDRA_CAST(0x0)) { - FUN_00431620(); - pVVar9 = GHIDRA_CAST(FUN_006b6e40()); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(local_1478,&spawnedTear->_pos); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::Normalized(&direction15); - (GHIDRA_CAST((&local_b8c)))->Vector::operator_assign(pVVar9); - } - } - uVar10 = Random(); - local_8ac = GHIDRA_CAST(tear->_spawnerEntity); - decayFactor = random_float(); - local_b1c = (void *)(decayFactor * 4.0 + 8.0); - pVVar9 = (GHIDRA_CAST((&local_b8c)))->Vector::__mul(&local_1488,GHIDRA_CAST(&local_b1c)); - pVVar14 = (GHIDRA_CAST((tearPos)))->Vector::__sub(&local_1490,GHIDRA_CAST(local_8e0)); - local_8d0 = GHIDRA_CAST(Game)::Spawn(g_game,tear->_type,tear->_variant,pVVar14,pVVar9, - GHIDRA_CAST(local_8ac),0,uVar10); - (GHIDRA_CAST((GHIDRA_CAST(local_8d0))))->Entity_Projectile::SetHeight(-23.75); - local_8cc = GHIDRA_CAST((GHIDRA_CAST((&g_tearFlagHydrobounce)))->BitSet128)::__bnot(¬Hydrobounce2); - local_8f4 = GHIDRA_CAST((GHIDRA_CAST((&g_tearFlagAbsorb)))->BitSet128)::__bnot(¬Absorb3); - local_8ac = GHIDRA_CAST((GHIDRA_CAST((&g_tearFlagBone)))->BitSet128)::__bnot(¬Bone2); - pBVar6 = (GHIDRA_CAST((&g_tearFlagLudovico)))->BitSet128::__bnot(¬Ludovico2); - pBVar8 = (GHIDRA_CAST((&g_tearFlagSplit)))->BitSet128::__bnot(¬Split2); - pBVar34 = (GHIDRA_CAST((&g_tearFlagQuadsplit)))->BitSet128::__bnot(¬Quadsplit2); - pBVar34 = BitSet128::operator_and(&andResult26,tearFlagsPtr,pBVar34); - pBVar8 = BitSet128::operator_and(&andResult27,pBVar34,pBVar8); - pBVar6 = BitSet128::operator_and(&andResult28,pBVar8,pBVar6); - pBVar6 = BitSet128::operator_and(&andResult29,pBVar6,GHIDRA_CAST(local_8ac)); - pBVar6 = BitSet128::operator_and(&andResult30,pBVar6,GHIDRA_CAST(local_8f4)); - BitSet128::operator_and(&inheritedFlags2,pBVar6,GHIDRA_CAST(local_8cc)); - pBVar8 = &g_tearFlagHoming; - pBVar6 = BitSet128::operator_or - (&withSpectral,&g_tearFlagPiercing,&g_tearFlagSpectral); - pBVar6 = BitSet128::operator_or(&orResult14,pBVar6,pBVar8); - (GHIDRA_CAST((&inheritedFlags2)))->BitSet128::operator__(pBVar6); - room = local_8d0; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(inheritedFlags2._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._l)) + 0x0))) = (uint32_t)inheritedFlags2._l; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._h)) + 0x0))) = (char)(uint32_t)inheritedFlags2._h; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._h)) + 0x1))) = (char)(GHIDRA_UINT((uint32_t)inheritedFlags2._h) >> 8); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._h)) + 0x2))) = (short)(GHIDRA_UINT((uint32_t)inheritedFlags2._h) >> 0x10); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(inheritedFlags2._h)) + 0x4))); - SetTearFlags(GHIDRA_CAST(local_8d0),flags_03); - SetScale(GHIDRA_CAST(room),*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_8c0)) + 0x0)))) * 0.2); - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST((GHIDRA_CAST(local_8a0))))->Sprite::Color(); - (*pcVar1)(); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::SetParent(GHIDRA_CAST(tear->_parent)); - FUN_00431620(); - (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::AddEntityFlags(0x80000000000); - (**(code **)(*GHIDRA_CAST(room) + 0xc))(); - local_8f8 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_8f8)) + 0x1)))); - } while (GHIDRA_INT(local_8f8) < GHIDRA_INT(local_8ec)); - pVVar9 = tearPos; - room = GHIDRA_CAST(tear); - } - (GHIDRA_CAST((radiusQuery200)))->EntityList_Query::~EntityList_Query(); - ehState = -1; - FID_conflict__Tidy(local_c80); - } - } - } - } - } - pBVar6 = BitSet128::operator_and - (&boogerMask3,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagBooger); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (((bVar4 != 0) && - (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsFrame(0x1e,GHIDRA_INT((room->_bottomRightPos).y)), bVar4 != 0)) && - ((room->_gridEntities[0x115] != GHIDRA_CAST(0x0) && - (bVar4 = (GHIDRA_CAST((room->_gridEntities[0x115])))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar4 != 0)))) { - FUN_00665a90(); - } - pBVar6 = BitSet128::operator_and - (&ludovicoMask22,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagLudovico - ); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (bVar4 = is_not_familiar_spawned(GHIDRA_CAST(room)), bVar4 != 0)) { - pBVar6 = BitSet128::operator_and - (&continuumMask,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagContinuum); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - pVVar14 = (GHIDRA_CAST((pRVar28)))->Room::GetClampedPosition(&clampedPos3,pVVar9,0.0); - (GHIDRA_CAST((pVVar9)))->Vector::operator_assign(pVVar14); - } - } - pBVar6 = BitSet128::operator_and - (&bit126Mask,GHIDRA_CAST((room->_gridEntities + 0x101)), - GHIDRA_CAST(&DAT_00c346c0)); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && - (((room->_gridPaths[0x34] < 1 || - (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::GetIntervalTicks((float)room->_gridPaths[0x34],zeroConst), - iVar7 != 0)) && (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(), 0 < iVar7)))) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector::Resize((float)room->_gridPaths[0x33]); - (*GHIDRA_CAST((GHIDRA_CAST(&(bit125Flags._l)) + 0x0))) = _DAT_00c346b0; - (*GHIDRA_CAST((GHIDRA_CAST(&(bit125Flags._l)) + 0x4))) = uRam00c346b4; - (*GHIDRA_CAST((GHIDRA_CAST(&(bit125Flags._h)) + 0x0))) = uRam00c346b8; - (*GHIDRA_CAST((GHIDRA_CAST(&(bit125Flags._h)) + 0x4))) = uRam00c346bc; - pBVar6 = BitSet128::operator_and - (&andResult31,GHIDRA_CAST((room->_gridPaths + 0x2f)),&bit125Flags); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(bit126Flags._l)) + 0x0))) = _DAT_00c346c0; - (*GHIDRA_CAST((GHIDRA_CAST(&(bit126Flags._l)) + 0x4))) = uRam00c346c4; - (*GHIDRA_CAST((GHIDRA_CAST(&(bit126Flags._h)) + 0x0))) = uRam00c346c8; - (*GHIDRA_CAST((GHIDRA_CAST(&(bit126Flags._h)) + 0x4))) = uRam00c346cc; - pBVar6 = BitSet128::operator_and - (&andResult32,GHIDRA_CAST((room->_gridPaths + 0x2f)),&bit126Flags); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 != 0) goto LAB_00672d53; - } - pBVar6 = (GHIDRA_CAST((GHIDRA_CAST(&DAT_00c346c0))))->BitSet128::__bnot(¬Bit126); - pBVar6 = BitSet128::operator_and(&andResult33,GHIDRA_CAST((room->_gridEntities + 0x101)),pBVar6) - ; - pvVar20 = *(void **)(GHIDRA_INT(&pBVar6->_l) + 4); - pvVar24 = *(void **)&pBVar6->_h; - pvVar2 = *(void **)(GHIDRA_INT(&pBVar6->_h) + 4); - room->_gridEntities[0x101] = *(void **)&pBVar6->_l; - room->_gridEntities[0x102] = pvVar20; - room->_gridEntities[0x103] = pvVar24; - room->_gridEntities[0x104] = pvVar2; - } -LAB_00672d53: - pBVar6 = BitSet128::operator_and - (&bit125Mask2,GHIDRA_CAST((room->_gridEntities + 0x101)), - GHIDRA_CAST(&DAT_00c346b0)); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (((bVar4 != 0) && (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(), 0 < iVar7)) && - ((room->_gridPaths[0x34] < 1 || - (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::GetIntervalTicks((float)room->_gridPaths[0x34],zeroConst), - iVar7 != 0)))) { - (GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0x101)))))->BitSet128::IsNonZero(); - pvVar20 = (void *)room->_gridPaths[0x30]; - pvVar24 = (void *)room->_gridPaths[0x31]; - pvVar2 = (void *)room->_gridPaths[0x32]; - room->_gridEntities[0x101] = (void *)room->_gridPaths[0x2f]; - room->_gridEntities[0x102] = pvVar20; - room->_gridEntities[0x103] = pvVar24; - room->_gridEntities[0x104] = pvVar2; - FUN_00435bc0(); - room->_gridPaths[0x2f] = local_1580; - room->_gridPaths[0x30] = uStack_157c; - room->_gridPaths[0x31] = uStack_1578; - room->_gridPaths[0x32] = uStack_1574; - } - pVVar14 = (GHIDRA_CAST((pVVar9)))->Vector::__sub(&local_14a0,&prevPos); - (GHIDRA_CAST((GHIDRA_CAST((room->_gridPaths + 0x20)))))->Vector::operator_assign(pVVar14); - if (GHIDRA_INT(room->_gridEntities[0x105]) < 1) { - pBVar6 = BitSet128::operator_and - (&ludovicoMask23,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagLudovico); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (((bVar4 != 0) && (*GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) == 0)) && - (room->_gridEntities[0x115] == (void *)0x0)) { - pBVar6 = BitSet128::operator_and - (&chainMask2,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagChain); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and - (&popMask2,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagPop); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if (((bVar4 != 0) || (8 < *GHIDRA_CAST((room->_gridEntities + 0x112)))) || - (local_87c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST((room->_gridEntities + 0xcf)))))->Vector)::LengthSquared(), - (float)local_87c < 0.01)) { - pBVar6 = BitSet128::operator_and - (&fetusMask4,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagFetus); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - decayFactor = Math::timescale_factor(0.9,(float)room->_gridEntities[0xde]); - pvVar20 = room->_gridEntities[0xde]; - pvVar24 = (void *)((float)pvVar20 * 0.1 + - decayFactor * - (float)(GHIDRA_CAST((room->_gridEntities + 0xfc)))->_entity + - (float)pvVar20 * (GHIDRA_CAST((room->_gridEntities + 0xfd)))->x); - } - else if ((float)room->_gridEntities[0xe0] <= - (float)room->_gridPaths[0x2d] * (float)local_904) { - pvVar20 = room->_gridEntities[0xde]; - pvVar24 = (void *)zeroConst; - } - else { - local_b20 = (void *)((GHIDRA_CAST((room->_gridEntities + 0xfd)))->x + 0.2); - local_b24 = (void *)0x0; - local_87c = (GHIDRA_CAST((room->_gridEntities + 0xfc)))->_entity; - decayFactor = Math::timescale_factor(0.9,(float)room->_gridEntities[0xde]); - local_87c = GHIDRA_CAST((decayFactor * (float)local_87c)); - pfVar15 = GHIDRA_CAST(std)::max(); - pvVar20 = room->_gridEntities[0xde]; - pvVar24 = (void *)((float)pvVar20 * *pfVar15 + (float)local_87c); - } - (GHIDRA_CAST((room->_gridEntities + 0xfc)))->_entity = pvVar24; - Entity_Projectile::SetHeight - (GHIDRA_CAST(room), - (float)pvVar20 * (float)pvVar24 + (float)room->_gridEntities[0xfb]); - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((pRVar28)))->Room::is_type_16(); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and - (&fetusMask5,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagFetus); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - decayFactor = (GHIDRA_CAST((room->_gridEntities + 0xfd)))->x; - if (decayFactor < 0.001) { - if ((float)room->_gridEntities[0xfb] <= (float)local_8e4) goto LAB_0067308c; - pvVar20 = (void *)((float)room->_gridEntities[0xd0] + halfConst); - } - else { - pvVar20 = (void *)(decayFactor + (float)room->_gridEntities[0xd0]); - } - room->_gridEntities[0xd0] = pvVar20; - } -LAB_0067308c: - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((pRVar28)))->Room::IsBeastDungeon(); - if (((bVar4 != 0) && (iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(), 2 < iVar7)) && - (pvVar20 = room->_gridEntities[0xd0], zeroConst < (float)pvVar20)) { - Level::GetCurrentRoom(GHIDRA_CAST(g_game)); - Room::get_lava_line_y(); - if ((float)pvVar20 < (float)room->_gridEntities[199]) { - pBVar6 = BitSet128::operator_and - (&explosiveMask6,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagExplosive); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) { - (**(code **)(*GHIDRA_CAST(room) + 0x28))(); - uVar10 = Random(); - pEVar11 = Game::Spawn(g_game,1000,0x10,pVVar9,&g_vectorZero,GHIDRA_CAST(0x0),0x42, - uVar10); - pEVar11->Update(); - } - else { - *GHIDRA_CAST((GHIDRA_CAST(room->_gridEntities) + 0x14f)) = 1; - } - } - } - } - } - } - } - } - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((pRVar28)))->Room::is_type_16(); - if (bVar4 != 0) { - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - bVar4 = (GHIDRA_CAST((pRVar28)))->Room::IsPositionInRoom(pVVar9,-256.0); - if (bVar4 == 0) { - (**(code **)(*GHIDRA_CAST(room) + 0x28))(); - } - } - pBVar6 = BitSet128::operator_and - (&continuumMask2,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagContinuum); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if (bVar4 == 0) goto LAB_006734ab; - pBVar6 = BitSet128::operator_and - (&ludovicoMask24,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagLudovico - ); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsZero(); - if ((bVar4 == 0) && (bVar4 = is_not_familiar_spawned(GHIDRA_CAST(room)), bVar4 == 0)) - goto LAB_006734ab; - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - (GHIDRA_CAST((pRVar28)))->Room::ScreenWrapPosition(&wrappedPos,pVVar9,-100.0); - (GHIDRA_CAST((&wrappedPos)))->Vector::__sub(&wrapDelta,pVVar9); - bVar4 = (GHIDRA_CAST((pVVar9)))->Vector::operator_ne(&wrappedPos); - if (bVar4 != 0) { - pBVar6 = BitSet128::operator_and - (&tractorBeamMask3,GHIDRA_CAST((room->_gridEntities + 0x101)), - &g_tearFlagTractorBeam); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (room->_gridEntities[0xe6] != GHIDRA_CAST(0x0))) { - pVVar14 = (GHIDRA_CAST((room->_gridEntities[0xe6])))->Entity::Position(&parentPos10); - (GHIDRA_CAST((&wrappedPos)))->Vector::operator_assign(pVVar14); - } - } - (GHIDRA_CAST((pVVar9)))->Vector::operator_assign(&wrappedPos); - pBVar6 = BitSet128::operator_and - (&ludovicoMask25,GHIDRA_CAST((room->_gridEntities + 0x101)),&g_tearFlagLudovico - ); - bVar4 = (GHIDRA_CAST((pBVar6)))->BitSet128::IsNonZero(); - if ((bVar4 != 0) && (bVar4 = is_not_familiar_spawned(GHIDRA_CAST(room)), bVar4 != 0)) { - for (pEVar11 = room->_gridEntities[0xe7]; pEVar11 != GHIDRA_CAST(0x0); - pEVar11 = GHIDRA_CAST((GHIDRA_CAST((pEVar11)))->Entity)::Child()) { - pVVar9 = (GHIDRA_CAST((pEVar11)))->Entity::Position(&entityPos25); - pVVar9 = (GHIDRA_CAST((pVVar9)))->Vector::__add(&local_14b8,&wrapDelta); - (GHIDRA_CAST((pEVar11)))->Entity::SetPosition(pVVar9); - } - } - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::IsFrame(2,GHIDRA_INT((room->_bottomRightPos).y)); - if (bVar4 == 0) goto LAB_006734ab; - iVar7 = (GHIDRA_CAST((GHIDRA_CAST(room))))->Entity::FrameCount(); - (GHIDRA_CAST((GHIDRA_CAST((local_7c + 0x2c)))))->Color::Color(); - switch((iVar7 / 2) % 9) { - case 0: - decayFactor = 0.33; - goto LAB_00673484; - case 1: - decayFactor = 0.66; - goto LAB_00673484; - case 2: - decayFactor = 1.0; - goto LAB_00673484; - case 3: - uVar37 = 0xc3; - uVar38 = 0xf5; - uVar39 = 0x3f28; - decayFactor = 0.66; - fVar36 = 0.66; - break; - case 4: - uVar37 = 0xc3; - uVar38 = 0xf5; - uVar39 = 0x3ea8; - decayFactor = 0.33; - fVar36 = 0.33; - break; - case 5: - (GHIDRA_CAST((GHIDRA_CAST((local_7c + 0x2c)))))->Color::SetTint(0.0,0.0,0.0,1.0); - goto LAB_00673493; - case 6: - uVar37 = 0xc3; - uVar38 = 0xf5; - uVar39 = 0x3ea8; - decayFactor = 0.0; - fVar36 = 0.33; - break; - case 7: - uVar37 = 0xc3; - uVar38 = 0xf5; - uVar39 = 0x3f28; - decayFactor = 0.0; - fVar36 = 0.66; - break; - case 8: - decayFactor = 0.0; -LAB_00673484: - uVar39 = 0x3f80; - uVar38 = 0; - uVar37 = 0; - fVar36 = 1.0; - break; - default: - goto LAB_00673493; - } - (GHIDRA_CAST((GHIDRA_CAST((local_7c + 0x2c)))))->Color::SetColorize(fVar36,decayFactor, - (float)CONCAT22(uVar39,CONCAT11(uVar38,uVar37)),1.0); -LAB_00673493: - (**(code **)(*GHIDRA_CAST(room) + 0x3c))(); -LAB_006734ab: - pRVar28 = GHIDRA_CAST(Level)::GetCurrentRoom(GHIDRA_CAST(g_game)); - cVar5 = (GHIDRA_CAST((pRVar28)))->Room::HasSlowDown(); - if (cVar5 != '\0') { - pcVar1 = *(code **)(*GHIDRA_CAST(room) + 0x3c); - (GHIDRA_CAST(()))->Color::Color(); - (*pcVar1)(); - } -LAB_00673502: - FUN_00862aa0(); - ExceptionList = prevExceptionList; - return; -} - -// 00676020 -float Entity_Tear::get_height_offset_y(float height) -{ - int iVar1; - uint8_t isGFuel; - float heightAboveFloor; - - iVar1 = this->_variant; - if ((iVar1 != 0x2e) && - (((iVar1 != 0x2f && (iVar1 != 0x31)) || - ((0.001 < this->_fallingAccel && (this->_isHovering == 0)))))) { - if ((((iVar1 == 0xd) || (iVar1 == 0x17)) && - (isGFuel = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f), isGFuel != 0)) && - ((this->_fallingAccel <= 0.001 || (this->_isHovering != 0)))) { - return -12.0; - } - if ((this->_fallingAccel <= 0.001) || (this->_isHovering != 0)) { - heightAboveFloor = this->_height + 8.5; - if (heightAboveFloor <= 0.0) { - heightAboveFloor = 0.0; - } - height = (this->_height * 0.4 - 15.0) + heightAboveFloor * heightAboveFloor; - } - return height; - } - return -8.0; -} - -// 00676120 -void Entity_Tear::SetScale(float scale) -{ - if (scale <= 0.01) { - scale = 0.01; - } - this->_baseScale = scale; - this->_fScale = scale; - ResetSpriteScale(this); - return; -} - -// 00676150 -void Entity_Tear::SetTearFlags(BitSet128 flags) -{ - uint8_t bVar1; - BitSet128 *maskedFlags; - LayerState *layer; - uint8_t *pbVar2; - int blendDst; - char *freeBlock; - uint8_t *expectedNameCh; - uint32_t uVar3; - bool bVar4; - uint8_t *pbVar5; - uint8_t *layerIdx; - std_string anm2Path; - uint32_t local_58 [5]; - uint8_t local_44 [12]; - float local_38; - float fStack_34; - float local_30; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - int *anmBitflags; - - puStack_20 = local_44 + 0x40; - local_14 = 0xffffffff; - puStack_18 = &LAB_00af7975; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_44 + 0x34)); - ExceptionList = &local_1c; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagGlow); - if (((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - ((this->_tearHaloANM2)._loaded == 0)) { - fStack_34 = 0.0; - local_30 = 2.10195e-44; - local_44[0] = '\0'; - local_44[1] = '\0'; - local_44[2] = '\0'; - local_44[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) = msvc::_Allocate(0x20); - fStack_34 = 2.38221e-44; - local_30 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))),"gfx/TearHalo.anm2",0x12); - local_14 = 0; - ANM2::Load(&this->_tearHaloANM2,GHIDRA_CAST(local_44),1); - local_14 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_30)) { - uVar3 = GHIDRA_INT(local_30) + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))); - if (0xfff < uVar3) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + -4)); - uVar3 = GHIDRA_INT(local_30) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar3); - } - ANM2::Play(&this->_tearHaloANM2,s_Idle,0); - } - if ((this->_tearEffectANM2)._loaded != 0) goto LAB_00676b9b; - maskedFlags = BitSet128::operator_and(GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagHorn); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { - fStack_34 = 0.0; - local_30 = 2.10195e-44; - local_44[0] = '\0'; - local_44[1] = '\0'; - local_44[2] = '\0'; - local_44[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) = msvc::_Allocate(0x20); - fStack_34 = 4.06377e-44; - local_30 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))),"gfx/LittleHornTearEffect.anm2",0x1e); - local_14 = 1; - ANM2::Load(&this->_tearEffectANM2,GHIDRA_CAST(local_44),1); - local_14 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_30)) { - uVar3 = GHIDRA_INT(local_30) + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))); - if (0xfff < uVar3) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + -4)); - uVar3 = GHIDRA_INT(local_30) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar3); - } - layerIdx = GHIDRA_CAST(0x0); - if ((this->_tearEffectANM2)._layerCount != 0) { - do { - uVar3 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&this->_tearEffectANM2,layerIdx); - blendDst = 1; - if ((uVar3 & 4) == 0) { - blendDst = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = blendDst; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - layerIdx = layerIdx + 1; - } while (layerIdx < GHIDRA_CAST((this->_tearEffectANM2)._layerCount)); - } - pbVar5 = (this->_tearEffectANM2)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar5 = *GHIDRA_CAST(pbVar5); - } - pbVar2 = s_Idle; - do { - bVar1 = *pbVar5; - bVar4 = bVar1 < *pbVar2; - if (bVar1 != *pbVar2) { -LAB_00676b65: - uVar3 = -GHIDRA_UINT(bVar4) | 1; - goto LAB_00676b6a; - } - if (bVar1 == 0) break; - bVar1 = pbVar5[1]; - bVar4 = bVar1 < pbVar2[1]; - if (bVar1 != pbVar2[1]) goto LAB_00676b65; - pbVar5 = pbVar5 + 2; - pbVar2 = pbVar2 + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_00676b6a: - if ((uVar3 == 0) && - ((*GHIDRA_CAST((GHIDRA_INT((this->_tearEffectANM2)._animState._animData) + 0x34)) == '\0' || - ((this->_tearEffectANM2)._animState._isPlaying != 0)))) goto LAB_00676b9b; - } - bVar1 = ANM2::SetAnimation(&this->_tearEffectANM2,s_Idle,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_tearEffectANM2)._animState); - (this->_tearEffectANM2)._animState._isPlaying = 1; - } - goto LAB_00676b9b; - } - maskedFlags = BitSet128::operator_and(GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagRift); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagLightFromHeaven); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - maskedFlags = BitSet128::operator_and(GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagJacobs); - if ((GHIDRA_INT(maskedFlags->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) && - (GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) == 0)) { - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagMysteriousLiquidCreep - ); - bVar1 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (bVar1 != 0) { - fStack_34 = 0.0; - local_30 = 2.10195e-44; - local_44[0] = '\0'; - local_44[1] = '\0'; - local_44[2] = '\0'; - local_44[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) = msvc::_Allocate(0x20); - fStack_34 = 4.06377e-44; - local_30 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))),"gfx/MysteriousTearEffect.anm2",0x1e); - local_14 = 5; - ANM2::Load(&this->_tearEffectANM2,GHIDRA_CAST(local_44),1); - local_14 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_30)) { - uVar3 = GHIDRA_INT(local_30) + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))); - if (0xfff < uVar3) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + -4)); - uVar3 = GHIDRA_INT(local_30) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar3); - } - anmBitflags = &(this->_tearEffectANM2)._bitflags; - *anmBitflags = *anmBitflags | 0x3000; - layer = ANM2::GetLayer(&this->_tearEffectANM2,GHIDRA_CAST(0x0)); - pbVar5 = GHIDRA_CAST(0x1); - layer->_bitflags = 0x1000; - goto LAB_00676426; - } - maskedFlags = BitSet128::operator_and(GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagBurn); - bVar1 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (bVar1 == 0) { - maskedFlags = BitSet128::operator_and - (GHIDRA_CAST((local_44 + 4)),&flags,&g_tearFlagDarkMatter); - bVar1 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); - if (bVar1 == 0) goto LAB_00676b9b; - (GHIDRA_CAST((anm2Path._buf)))->msvc::string::string_from_cstr(GHIDRA_CAST("gfx/DarkMatterTearEffect.anm2")); - local_14 = 7; - ANM2::Load(&this->_tearEffectANM2,&anm2Path,1); - local_14 = 0xffffffff; - (GHIDRA_CAST((anm2Path._buf)))->msvc::string::_Tidy_deallocate(); - } - else { - fStack_34 = 0.0; - local_30 = 2.10195e-44; - local_44[0] = '\0'; - local_44[1] = '\0'; - local_44[2] = '\0'; - local_44[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) = msvc::_Allocate(0x20); - fStack_34 = 3.78351e-44; - local_30 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))),"gfx/FireMindTearEffect.anm2",0x1c); - local_14 = 6; - ANM2::Load(&this->_tearEffectANM2,GHIDRA_CAST(local_44),1); - local_14 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_30)) { - uVar3 = GHIDRA_INT(local_30) + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))); - if (0xfff < uVar3) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + -4)); - uVar3 = GHIDRA_INT(local_30) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar3); - } - } - anmBitflags = &(this->_tearEffectANM2)._bitflags; - *anmBitflags = *anmBitflags | 0x3000; - layer = ANM2::GetLayer(&this->_tearEffectANM2,GHIDRA_CAST(0x0)); - layer->_bitflags = 0x1000; - } - else { - fStack_34 = 0.0; - local_30 = 2.10195e-44; - local_44[0] = '\0'; - local_44[1] = '\0'; - local_44[2] = '\0'; - local_44[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) = msvc::_Allocate(0x20); - fStack_34 = 4.34403e-44; - local_30 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))),"gfx/JacobsLadderTearEffect.anm2",0x20); - local_14 = 4; - ANM2::Load(&this->_tearEffectANM2,GHIDRA_CAST(local_44),1); - local_14 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_30)) { - uVar3 = GHIDRA_INT(local_30) + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))); - if (0xfff < uVar3) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + -4)); - uVar3 = GHIDRA_INT(local_30) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar3); - } - pbVar5 = GHIDRA_CAST(0x0); -LAB_00676426: - uVar3 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&this->_tearEffectANM2,pbVar5); - blendDst = 1; - if ((uVar3 & 4) == 0) { - blendDst = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = blendDst; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - } - ANM2::Play(&this->_tearEffectANM2,s_Idle,0); - goto LAB_00676b9b; - } - fStack_34 = 0.0; - local_30 = 2.10195e-44; - local_44[0] = '\0'; - local_44[1] = '\0'; - local_44[2] = '\0'; - local_44[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) = msvc::_Allocate(0x20); - fStack_34 = 3.92364e-44; - local_30 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))),"gfx/HolyLightTearEffect.anm2",0x1d); - local_14 = 3; - ANM2::Load(&this->_tearEffectANM2,GHIDRA_CAST(local_44),1); - local_14 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_30)) { - uVar3 = GHIDRA_INT(local_30) + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))); - if (0xfff < uVar3) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + -4)); - uVar3 = GHIDRA_INT(local_30) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar3); - } - uVar3 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&this->_tearEffectANM2,GHIDRA_CAST(0x0)); - blendDst = 1; - if ((uVar3 & 4) == 0) { - blendDst = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = blendDst; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - pbVar5 = (this->_tearEffectANM2)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - pbVar2 = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar2 = *GHIDRA_CAST(pbVar5); - } - expectedNameCh = s_Idle; - do { - bVar1 = *pbVar2; - bVar4 = bVar1 < *expectedNameCh; - if (bVar1 != *expectedNameCh) goto LAB_006767e0; - if (bVar1 == 0) break; - bVar1 = pbVar2[1]; - bVar4 = bVar1 < expectedNameCh[1]; - if (bVar1 != expectedNameCh[1]) goto LAB_006767e0; - pbVar2 = pbVar2 + 2; - expectedNameCh = expectedNameCh + 2; - } while (bVar1 != 0); -LAB_006767dc: - uVar3 = 0; - goto LAB_006767e5; - } - } - else { - fStack_34 = 0.0; - local_30 = 2.10195e-44; - local_44[0] = '\0'; - local_44[1] = '\0'; - local_44[2] = '\0'; - local_44[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) = msvc::_Allocate(0x20); - fStack_34 = 4.06377e-44; - local_30 = 4.34403e-44; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))),"gfx/LittleHornTearEffect.anm2",0x1e); - local_14 = 2; - ANM2::Load(&this->_tearEffectANM2,GHIDRA_CAST(local_44),1); - local_14 = 0xffffffff; - if (0xf < GHIDRA_UINT(local_30)) { - uVar3 = GHIDRA_INT(local_30) + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_44))) + 0x0))); - if (0xfff < uVar3) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + -4)); - uVar3 = GHIDRA_INT(local_30) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_44)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar3); - } - layerIdx = GHIDRA_CAST(0x0); - if ((this->_tearEffectANM2)._layerCount != 0) { - do { - uVar3 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&this->_tearEffectANM2,layerIdx); - local_38 = 0.0; - fStack_34 = 0.0; - blendDst = 1; - layer->_blendMode[0] = 0; - if ((uVar3 & 4) == 0) { - blendDst = 6; - } - layer->_blendMode[2] = 1; - layer->_blendMode[1] = blendDst; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - local_30 = 0.0; - layer = ANM2::GetLayer(&this->_tearEffectANM2,layerIdx); - if (&layer->_color != GHIDRA_CAST(local_58)) { - (layer->_color)._tint[0] = 1.0; - (layer->_color)._tint[1] = 0.7; - (layer->_color)._tint[2] = 0.7; - (layer->_color)._tint[3] = 1.0; - (layer->_color)._colorize[0] = 0.0; - (layer->_color)._colorize[1] = 0.0; - (layer->_color)._colorize[2] = 0.0; - (layer->_color)._colorize[3] = 0.0; - (layer->_color)._offset[0] = local_38; - (layer->_color)._offset[1] = fStack_34; - (layer->_color)._offset[2] = local_30; - } - layerIdx = layerIdx + 1; - } while (layerIdx < GHIDRA_CAST((this->_tearEffectANM2)._layerCount)); - } - pbVar5 = (this->_tearEffectANM2)._animState._animData; - if (pbVar5 != GHIDRA_CAST(0x0)) { - pbVar2 = pbVar5; - if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { - pbVar2 = *GHIDRA_CAST(pbVar5); - } - expectedNameCh = s_Idle; - do { - bVar1 = *pbVar2; - bVar4 = bVar1 < *expectedNameCh; - if (bVar1 != *expectedNameCh) goto LAB_006767e0; - if (bVar1 == 0) goto LAB_006767dc; - bVar1 = pbVar2[1]; - bVar4 = bVar1 < expectedNameCh[1]; - if (bVar1 != expectedNameCh[1]) goto LAB_006767e0; - pbVar2 = pbVar2 + 2; - expectedNameCh = expectedNameCh + 2; - } while (bVar1 != 0); - uVar3 = 0; -LAB_006767e5: - if ((uVar3 == 0) && - ((pbVar5[0x34] == 0 || ((this->_tearEffectANM2)._animState._isPlaying != 0)))) - goto LAB_00676b9b; - } - } - bVar1 = ANM2::SetAnimation(&this->_tearEffectANM2,s_Idle,1); - if (bVar1 != 0) { - AnimationState::Rewind(&(this->_tearEffectANM2)._animState); - (this->_tearEffectANM2)._animState._isPlaying = 1; - } -LAB_00676b9b: - *GHIDRA_CAST(&(this->_tearFlags)._l) = (uint32_t)flags._l; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))); - *GHIDRA_CAST(&(this->_tearFlags)._h) = (uint32_t)flags._h; - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))); - ExceptionList = local_1c; - return; -LAB_006767e0: - uVar3 = -GHIDRA_UINT(bVar4) | 1; - goto LAB_006767e5; -} - -// 00676be0 -void Entity_Tear::apply_death_flag_effects(Entity *target) -{ - uint32_t *puVar1; - float fVar2; - BitSet128 flags; - BitSet128 flags_00; - uint8_t bVar3; - uint32_t uVar4; - BitSet128 *pBVar5; - int iVar6; - BitSet128 *pBVar7; - Entity *spawned; - Entity_Tear *childTear; - BitSet128 **childScalePtr; - BitSet128 *pBVar8; - uint32_t seed; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - char *ptr; - float fVar9; - uint32_t uVar10; - TypeDescriptor *pTVar11; - TypeDescriptor *pTVar12; - uint32_t uVar13; - BitSet128 local_110; - BitSet128 local_100; - BitSet128 local_f0; - BitSet128 local_e0; - BitSet128 local_d0; - BitSet128 local_c0; - BitSet128 local_b0; - Vector local_a0; - Vector local_98; - BitSet128 *tearFlags; - Vector local_8c; - BitSet128 childFlags; - BitSet128 *local_74; - Entity *local_70; - float alphaMultiplier; - Entity_Tear *local_68; - BitSet128 *local_64; - Entity_Tear *local_60; - char isDeadRising; - char *spritesheetPath [2]; - BitSet128 local_50; - ColorMod color; - void *local_10; - uint8_t *puStack_c; - float local_8; - float childScale; - Game *game; - Manager *manager; - - local_8 = -NAN; - puStack_c = &LAB_00af79ad; - local_10 = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((&color)[1]._colorize); - ExceptionList = &local_10; - local_70 = target; - local_a0.y = (float)this; - if ((this->_dead == 0) || - (((pBVar5 = BitSet128::operator_and(&childFlags,&this->_tearFlags,&g_tearFlagHydrobounce), - GHIDRA_INT(pBVar5->_l) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)) == 0 && - (GHIDRA_INT(pBVar5->_h) == 0 && *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)) == 0)) || - (isDeadRising = '\x01', 0.0 < this->_fallingSpeed || this->_fallingSpeed == 0.0)))) { - isDeadRising = '\0'; - } - alphaMultiplier = 1.0; - iVar6 = __RTDynamicCast(this->_spawnerEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0,uVar4); - if (((iVar6 != 0) && (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1)))) && - (bVar3 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),*GHIDRA_CAST((iVar6 + 0x1618))), - bVar3 == 0)) { - if ((g_game == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - alphaMultiplier = (float)(g_manager->_optionsConfig)._onlinePlayerOpacity * 0.09 + 0.1; - } - else { - alphaMultiplier = 1.0; - } - } - fVar9 = 1.0; - pBVar5 = &this->_tearFlags; - tearFlags = pBVar5; - pBVar7 = BitSet128::operator_and(&childFlags,pBVar5,&g_tearFlagSplit); - if ((((GHIDRA_INT(pBVar7->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar7->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_h) + 4)) != 0)) && - (fVar9 < this->_collisionDamage)) && - ((this->_height <= -5.0 && this->_height != -5.0 || (isDeadRising != '\0')))) { - local_68 = GHIDRA_CAST(0x0); - local_74 = GHIDRA_CAST(0x3c23d70a); - do { - fVar9 = (this->_velocity).x; - local_8c.x = (this->_velocity).y; - local_8c.y = -fVar9; - if (local_68 == GHIDRA_CAST(0x1)) { - local_8c.x = -local_8c.x; - local_8c.y = fVar9; - } - uVar4 = Random(); - local_98.x = (this->_pos).x - (this->_velocity).x; - local_98.y = (this->_pos).y - (this->_velocity).y; - uVar13 = 0; - pTVar12 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; - pTVar11 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar10 = 0; - spawned = Game::Spawn(g_game,2,0,&local_98,&local_8c,GHIDRA_CAST(this->_spawnerEntity),0,uVar4); - childTear = GHIDRA_CAST(__RTDynamicCast(spawned,uVar10,pTVar11,pTVar12,uVar13)); - local_60 = childTear; - if (isDeadRising == '\0') { - local_64 = GHIDRA_CAST((this->_height / 1.5)); - childTear->_height = (float)local_64; - fVar9 = get_height_offset_y(childTear,(float)local_64); - game = g_game; - (childTear->_posOffset).y = fVar9; - if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && - ((childTear->_posOffset).y = -18.0, -5.1 < (float)local_64)) { - childTear->_height = -5.1; - } - childTear->_fallingSpeed = this->_fallingSpeed; - fVar9 = this->_collisionDamage * 0.5; - } - else { - childTear->_height = -5.1; - fVar9 = get_height_offset_y(childTear,-5.1); - game = g_game; - (childTear->_posOffset).y = fVar9; - if (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) { - (childTear->_posOffset).y = -18.0; - } - childTear->_fallingSpeed = this->_fallingSpeed; - childTear->_fallingAccel = 2.0; - fVar9 = this->_collisionDamage * 0.25; - } - childTear->SetCollisionDamage(fVar9); - local_64 = GHIDRA_CAST((this->_fScale * 0.5)); - childScalePtr = &local_64; - if ((float)local_64 <= 0.01) { - childScalePtr = &local_74; - } - childScale = (float)*childScalePtr; - childTear->_baseScale = childScale; - childTear->_fScale = childScale; - ResetSpriteScale(childTear); - local_64 = (GHIDRA_CAST((&g_tearFlagFetus)))->BitSet128::__bnot(&local_110); - pBVar5 = (GHIDRA_CAST((&g_tearFlagHydrobounce)))->BitSet128::__bnot(&local_50); - pBVar7 = (GHIDRA_CAST((&g_tearFlagAbsorb)))->BitSet128::__bnot(&local_c0); - pBVar8 = (GHIDRA_CAST((&g_tearFlagLudovico)))->BitSet128::__bnot(&local_d0); - pBVar8 = BitSet128::operator_and(&local_e0,tearFlags,pBVar8); - pBVar7 = BitSet128::operator_and(&local_f0,pBVar8,pBVar7); - pBVar5 = BitSet128::operator_and(&local_100,pBVar7,pBVar5); - BitSet128::operator_and(&childFlags,pBVar5,local_64); - if (isDeadRising != '\0') { - pBVar5 = (GHIDRA_CAST((&g_tearFlagExplosive)))->BitSet128::__bnot(&local_b0); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x0))) = GHIDRA_UINT(childFlags._l) & GHIDRA_UINT(pBVar5->_l); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x0))) = GHIDRA_UINT(childFlags._h) & GHIDRA_UINT(pBVar5->_h); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)); - } - childTear = local_60; - this = GHIDRA_CAST(local_a0.y); - color._tint[0] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[0]; - color._tint[1] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[1]; - color._tint[2] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[2]; - color._offset[2] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._offset[2]; - color._colorize[0] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[0]; - color._colorize[1] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[1]; - color._colorize[2] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[2]; - color._colorize[3] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[3]; - color._tint[3] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[3] * alphaMultiplier; - (*GHIDRA_CAST((GHIDRA_CAST(&(color._offset)) + 0x0))) = *GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._offset); - local_60->SetColor(&color,0xffffffff,0xff,0,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = GHIDRA_UINT(childFlags._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = GHIDRA_UINT(childFlags._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x4))); - SetTearFlags(childTear,flags); - local_64 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3bc)); - if (childTear->_parent != 0) { - local_60 = GHIDRA_CAST(&childTear->_parent); - msvc::multiset::erase(&local_60); - } - childTear->_parent = local_64; - if (local_64 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&childTear->_parent); - } - childTear->Update(); - local_68 = GHIDRA_CAST((GHIDRA_INT(local_68) + 1)); - } while (GHIDRA_INT(local_68) < 2); - pBVar5 = GHIDRA_CAST((GHIDRA_INT(this) + 0x428)); - } - fVar9 = -5.0; - pBVar7 = BitSet128::operator_and(&local_b0,pBVar5,&g_tearFlagBone); - if (((GHIDRA_INT(pBVar7->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar7->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_h) + 4)) != 0)) && - (this->_height <= fVar9 && fVar9 != this->_height)) { - local_64 = GHIDRA_CAST(0x0); - do { - uVar4 = Random(); - fVar9 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_60 = GHIDRA_CAST((fVar9 + fVar9)); - local_68 = GHIDRA_CAST(sin((float)local_60)); - fVar9 = (this->_velocity).y; - fVar2 = (this->_velocity).x; - local_74 = GHIDRA_CAST(sqrtf(fVar2 * fVar2 + fVar9 * fVar9)); - local_98.x = cos((float)local_60); - local_98.x = local_98.x * (float)local_74; - uVar4 = this->_variant; - local_98.y = (float)local_68 * (float)local_74; - if (uVar4 == 0x32) { - uVar4 = 0x1d; - } - seed = Random(); - local_8c.x = (this->_pos).x - (this->_velocity).x; - local_8c.y = (this->_pos).y - (this->_velocity).y; - uVar13 = 0; - pTVar12 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; - pTVar11 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar10 = 0; - spawned = Game::Spawn(g_game,2,uVar4,&local_8c,&local_98,GHIDRA_CAST(this->_spawnerEntity),0,seed - ); - childTear = GHIDRA_CAST(__RTDynamicCast(spawned,uVar10,pTVar11,pTVar12,uVar13)); - local_68 = childTear; - if (uVar4 == 0x1d) { - spritesheetPath[0] = msvc::_Allocate(0x20); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50._h)) + 0x0))) = 0x18; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_50._h)) + 0x4))) = 0x1f; - builtin_strncpy(spritesheetPath[0],"gfx/tears_brokenbone.png",0x19); - local_8 = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(&childTear->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST(spritesheetPath)); - local_8 = -NAN; - bVar3 = extraout_CL; - if (0xf < (*GHIDRA_CAST((GHIDRA_CAST(&(local_50._h)) + 0x4)))) { - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_50._h)) + 0x4))) + 1; - ptr = spritesheetPath[0]; - if (0xfff < uVar4) { - ptr = *GHIDRA_CAST((spritesheetPath[0] + -4)); - uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_50._h)) + 0x4))) + 0x24; - if (GHIDRA_CAST(0x1f) < spritesheetPath[0] + (-4 - GHIDRA_INT(ptr))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,uVar4); - bVar3 = extraout_CL_00; - } - ANM2::LoadGraphics(&childTear->_sprite,bVar3); - } - local_60 = GHIDRA_CAST(this->_height); - childTear->_height = (float)local_60; - fVar9 = get_height_offset_y(childTear,(float)local_60); - game = g_game; - (childTear->_posOffset).y = fVar9; - if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && - ((childTear->_posOffset).y = -18.0, -5.1 < (float)local_60)) { - childTear->_height = -5.1; - } - childTear->_fallingSpeed = this->_fallingSpeed; - childTear->SetCollisionDamage(this->_collisionDamage * 0.5); - pBVar5 = (GHIDRA_CAST((&g_tearFlagFetus)))->BitSet128::__bnot(&local_b0); - pBVar7 = (GHIDRA_CAST((&g_tearFlagBone)))->BitSet128::__bnot(&local_100); - pBVar8 = (GHIDRA_CAST((&g_tearFlagLudovico)))->BitSet128::__bnot(&local_f0); - pBVar8 = BitSet128::operator_and(&local_e0,tearFlags,pBVar8); - pBVar7 = BitSet128::operator_and(&local_d0,pBVar8,pBVar7); - BitSet128::operator_and(&childFlags,pBVar7,pBVar5); - if (isDeadRising != '\0') { - pBVar5 = (GHIDRA_CAST((&g_tearFlagExplosive)))->BitSet128::__bnot(&local_c0); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x0))) = GHIDRA_UINT(childFlags._l) & GHIDRA_UINT(pBVar5->_l); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x0))) = GHIDRA_UINT(childFlags._h) & GHIDRA_UINT(pBVar5->_h); - (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)); - } - childTear = local_68; - this = GHIDRA_CAST(local_a0.y); - color._tint[0] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[0]; - color._tint[1] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[1]; - color._tint[2] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[2]; - color._offset[2] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._offset[2]; - color._colorize[0] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[0]; - color._colorize[1] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[1]; - color._colorize[2] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[2]; - color._colorize[3] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._colorize[3]; - color._tint[3] = ((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._tint[3] * alphaMultiplier; - (*GHIDRA_CAST((GHIDRA_CAST(&(color._offset)) + 0x0))) = *GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_a0.y) + 0x48)))->_color)._offset); - local_68->SetColor(&color,0xffffffff,0xff,0,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._l)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x0))) = GHIDRA_UINT(childFlags._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x0))) = GHIDRA_UINT(childFlags._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(childFlags._h)) + 0x4))); - SetTearFlags(childTear,flags_00); - local_74 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3bc)); - if (childTear->_parent != 0) { - local_60 = GHIDRA_CAST(&childTear->_parent); - msvc::multiset::erase(&local_60); - } - childTear->_parent = local_74; - if (local_74 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(&childTear->_parent); - } - childTear->Update(); - local_64 = GHIDRA_CAST((GHIDRA_INT(&local_64->_l) + 1)); - } while (GHIDRA_INT(local_64) < 2); - pBVar5 = GHIDRA_CAST((GHIDRA_INT(this) + 0x428)); - } - pBVar7 = BitSet128::operator_and(&local_b0,pBVar5,&g_tearFlagJacobs); - if (((GHIDRA_INT(pBVar7->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar7->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_h) + 4)) != 0)) && - (this->_height <= -5.0 && this->_height != -5.0)) { - spawned = spawn_chain_lightning - (&this->_pos,*pBVar5,GHIDRA_CAST(this->_spawnerEntity), - this->_collisionDamage * 0.5); - if (local_70 != GHIDRA_CAST(0x0)) { - if (spawned->_target != 0) { - local_60 = GHIDRA_CAST(&spawned->_target); - msvc::multiset::erase(&local_60); - } - spawned->_target = local_70; - msvc::multiset::insert(&spawned->_target); - } - color._tint[0] = (spawned->_sprite)._color._tint[0]; - color._tint[1] = (spawned->_sprite)._color._tint[1]; - color._tint[2] = (spawned->_sprite)._color._tint[2]; - color._colorize[0] = (spawned->_sprite)._color._colorize[0]; - color._colorize[1] = (spawned->_sprite)._color._colorize[1]; - color._colorize[2] = (spawned->_sprite)._color._colorize[2]; - color._colorize[3] = (spawned->_sprite)._color._colorize[3]; - color._tint[3] = (spawned->_sprite)._color._tint[3] * alphaMultiplier; - (*GHIDRA_CAST((GHIDRA_CAST(&(color._offset)) + 0x0))) = *GHIDRA_CAST((spawned->_sprite)._color._offset); - color._offset[2] = (spawned->_sprite)._color._offset[2]; - spawned->SetColor(&color,0xffffffff,0xff,0,1); - spawned->Update(); - pBVar5 = &this->_tearFlags; - } - pBVar7 = BitSet128::operator_and(&local_b0,pBVar5,&g_tearFlagRift); - if ((GHIDRA_INT(pBVar7->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_l) + 4)) != 0) || - (GHIDRA_INT(pBVar7->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_h) + 4)) != 0)) { - pBVar7 = (GHIDRA_CAST((&g_tearFlagRift)))->BitSet128::__bnot(&local_b0); - *GHIDRA_CAST(&pBVar5->_l) = GHIDRA_UINT(pBVar5->_l) & GHIDRA_UINT(pBVar7->_l); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&pBVar5->_l) + 4)); - *puVar1 = *puVar1 & *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_l) + 4)); - *GHIDRA_CAST(&pBVar5->_h) = GHIDRA_UINT(pBVar5->_h) & GHIDRA_UINT(pBVar7->_h); - puVar1 = GHIDRA_CAST((GHIDRA_INT(&pBVar5->_h) + 4)); - *puVar1 = *puVar1 & *GHIDRA_CAST((GHIDRA_INT(&pBVar7->_h) + 4)); - game = g_game; - bVar3 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&this->_pos,-10.0); - if (bVar3 != 0) { - local_60 = GHIDRA_CAST((this->_collisionDamage * 0.5)); - Room::GetClampedPositionImpl(game->_room,&local_a0,&this->_pos,0.0,0.0,0.0,0.0); - uVar4 = Random(); - spawned = Game::Spawn(g_game,1000,0xb4,&local_a0,&g_vectorZero,GHIDRA_CAST(this->_spawnerEntity), - 0,uVar4); - fVar9 = this->_fScale * g_vectorOne.x; - iVar6 = *GHIDRA_CAST(spawned); - (spawned->_sprite)._scale.y = this->_fScale * g_vectorOne.y; - (spawned->_sprite)._scale.x = fVar9; - (**(code **)(iVar6 + 0x40))(local_60); - uVar10 = 0x3c; - iVar6 = *GHIDRA_CAST(spawned); - if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { - uVar10 = 0x1e; - } - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 4)) = uVar10; - *GHIDRA_CAST((spawned[1]._sprite._filename._buf + 8)) = uVar10; - (**(code **)(iVar6 + 0xc))(); - manager = g_manager; - local_70 = GHIDRA_CAST(0x440); - seed_fart_sound_override(GHIDRA_CAST(&local_70)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_70),0.5,2,0,1.0,0.0); - } - } - ExceptionList = local_10; - return; -} - -// 00677780 -void Entity_Tear::ResetSpriteScale() -{ - float *scaleThreshold; - uint32_t startFrame; - void *animData; - int iVar1; - LayerState *layer; - char *format; - int scaleAnimBase; - uint8_t *layerIndex; - uint32_t uVar2; - float fVar3; - float fVar4; - float fVar5; - float local_4c; - float local_48; - float sizeMultiX; - float local_40; - float layerSizeY; - uint8_t local_38 [8]; - void *seedEffectNode; - uint8_t animName [32]; - uint32_t local_c; - Game *game; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_4c); - local_4c = 1.0; - iVar1 = this->_variant; - scaleAnimBase = iVar1 * 100; - local_48 = (float)scaleAnimBase; - switch(iVar1) { - case 0: - case 1: - case 2: - case 3: - case 10: - case 0xb: - case 0xc: - case 0xd: - case 0xe: - case 0xf: - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - case 0x18: - case 0x19: - case 0x1a: - case 0x1b: - case 0x1c: - case 0x1d: - case 0x1e: - case 0x1f: - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - case 0x29: - case 0x30: - uVar2 = 1; - scaleThreshold = GHIDRA_CAST(&DAT_00b64e30); - do { - if (this->_fScale <= *scaleThreshold + 0.05) break; - uVar2 = uVar2 + 1; - scaleThreshold = scaleThreshold + 1; - } while (uVar2 < 0xd); - if (this->_scaleAnimNum != scaleAnimBase + uVar2) { - if (((((iVar1 == 1) || (iVar1 == 0xc)) || (iVar1 == 0xf)) || - ((iVar1 == 0x11 || (iVar1 == 0x22)))) || (iVar1 == 0x19)) { - format = "BloodTear%d"; - } - else if ((iVar1 == 2) || (iVar1 == 0x1e)) { - format = "Tooth%dMove"; - } - else if (iVar1 == 0x14) { - format = "Rotate%d"; - } - else if ((((iVar1 == 0x16) || (iVar1 == 0x1a)) || (iVar1 == 0x1b)) || - (((iVar1 == 0x1c || (iVar1 == 0x1d)) || (iVar1 == 0x30)))) { - format = "Stone%dMove"; - } - else { - format = "RegularTear%d"; - } - sprintf_s(animName,0x20,GHIDRA_CAST(format)); - ANM2::Play(&this->_sprite,animName,0); - this->_scaleAnimNum = scaleAnimBase + uVar2; - } - if (GHIDRA_INT(uVar2) < 0xd) { - if ((((GHIDRA_UINT(g_tearFlagGrow._l) | GHIDRA_UINT(g_tearFlagLudovico._l)) & GHIDRA_UINT((this->_tearFlags)._l)) - == 0 && (((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4)))) & - *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4))) == 0) && - (((GHIDRA_UINT(g_tearFlagGrow._h) | GHIDRA_UINT(g_tearFlagLudovico._h)) & GHIDRA_UINT((this->_tearFlags)._h)) == - 0 && (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & - ((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4))))) == 0)) { - local_4c = 1.0; - fVar3 = 1.0; - } - else { - local_4c = this->_fScale / *GHIDRA_CAST((&DAT_00b64e2c + uVar2 * 4)); - fVar3 = local_4c; - } - } - else { - local_4c = this->_fScale / 2.75; - fVar3 = local_4c; - } - break; - default: - if (this->_scaleAnimNum != scaleAnimBase) { - ANM2::Play(&this->_sprite,s_Idle,0); - this->_scaleAnimNum = scaleAnimBase; - } - case 0x28: -switchD_006777c1_caseD_28: - fVar3 = 1.0; - break; - case 5: - case 6: - case 7: - if (this->_scaleAnimNum != scaleAnimBase) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("MoveHori"),0); - this->_scaleAnimNum = scaleAnimBase; - } - local_4c = this->_fScale / 2.75; - fVar3 = (this->_velocity).x + 0.0; - fVar4 = this->_fallingSpeed + (this->_velocity).y; - if (0 < this->_waitFrames) { - fVar3 = (this->_continueVelocity).x; - fVar4 = (this->_continueVelocity).y; - } - fVar3 = atan2f(fVar4,fVar3); - (this->_sprite)._rotation = fVar3 * 57.295776; - fVar3 = local_4c; - break; - case 8: - case 0x2a: - local_4c = this->_fScale; - iVar1 = 0; - do { - if (local_4c <= (float)(&DAT_00b64e90)[iVar1]) break; - iVar1 = iVar1 + 1; - } while (iVar1 < 5); - sprintf(animName,GHIDRA_CAST("Rotate%d")); - if (((this->_sprite)._animState._animData == (void *)0x0) || - ((this->_sprite)._animState._isPlaying == 0)) { - ANM2::Play(&this->_sprite,animName,0); - animData = (this->_sprite)._animState._animData; - if ((animData == (void *)0x0) || (uVar2 = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x30)), uVar2 == 0)) { - startFrame = 0; - } - else { - startFrame = Random(); - startFrame = startFrame % uVar2; - animData = (this->_sprite)._animState._animData; - } - if (animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(startFrame)); - } - } - else { - ANM2::SetAnimation(&this->_sprite,animName,0); - } - fVar3 = local_4c; - if (this->_variant == 8) { - this->_fScale = this->_fScale + this->_fScale; - } - break; - case 9: - if (this->_dead == 0) { - if (this->_scaleAnimNum != scaleAnimBase) { - ANM2::Play(&this->_sprite,GHIDRA_CAST("Rotate"),0); - this->_scaleAnimNum = scaleAnimBase; - } - (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; - } - goto switchD_006777c1_caseD_28; - case 0x2e: - ANM2::Play(&this->_sprite,GHIDRA_CAST("Flickering"),0); - uVar2 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - iVar1 = 1; - if ((uVar2 & 4) == 0) { - iVar1 = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = iVar1; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - goto switchD_006777c1_caseD_28; - case 0x2f: - case 0x31: - ANM2::Play(&this->_sprite,s_Idle,0); - local_4c = this->_fScale; - fVar3 = local_4c; - break; - case 0x32: - uVar2 = 0; - fVar3 = this->_fScale + 0.25; - this->_fScale = fVar3; - do { - if (fVar3 <= (float)(&DAT_00b64e70)[uVar2]) break; - uVar2 = uVar2 + 1; - } while (GHIDRA_INT(uVar2) < 4); - if (this->_scaleAnimNum != uVar2 + scaleAnimBase) { - this->_scaleAnimNum = uVar2 + scaleAnimBase; - sprintf(animName,GHIDRA_CAST("Rotate%d")); - if (this->_scaleAnimNum / 100 == GHIDRA_INT(local_48) / 100) { - iVar1 = ANM2::GetFrame(&this->_sprite); - ANM2::Play(&this->_sprite,animName,0); - if (iVar1 < 0) goto LAB_00677c46; - } - else { - ANM2::Play(&this->_sprite,animName,0); -LAB_00677c46: - animData = (this->_sprite)._animState._animData; - if (animData == (void *)0x0) { - iVar1 = 0; - } - else { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x30)); - } - iVar1 = Isaac::Random(iVar1); - } - if (((this->_sprite)._animState._animData != (void *)0x0) && - (AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)iVar1), - (this->_sprite)._animState._animData != (void *)0x0)) { - (this->_sprite)._animState._isPlaying = 0; - } - } - if (uVar2 < 5) { - local_4c = this->_fScale / (float)(&DAT_00b64e70)[uVar2]; - fVar3 = local_4c; - } - else { - local_4c = this->_fScale / 2.25; - fVar3 = local_4c; - } - } - game = g_game; - fVar4 = (this->_sizeMulti).x; - fVar5 = (this->_sizeMulti).y; - uVar2 = this->_variant; - local_48 = fVar5; - sizeMultiX = fVar4; - if (uVar2 < 0x33) { - if ((uVar2 == 0xd) || (uVar2 == 0x17)) { - local_40 = 1.10703e-43; - msvc::set::find_node(local_38,&local_40); - if ((*GHIDRA_CAST((GHIDRA_CAST(seedEffectNode) + 0xd)) == '\0') && - ((*GHIDRA_CAST((GHIDRA_CAST(seedEffectNode) + 0x10)) < 0x50 && - (seedEffectNode != (game->_seedEffects)._seedEffects)))) { - fVar4 = fVar4 / 3.0; - sizeMultiX = fVar4; - } - } - layerIndex = GHIDRA_CAST(0x0); - if ((this->_sprite)._layerCount != 0) { - do { - local_40 = fVar3 * g_vectorOne.x * fVar4; - layerSizeY = fVar3 * g_vectorOne.y * fVar5; - layer = ANM2::GetLayer(&this->_sprite,layerIndex); - layerIndex = layerIndex + 1; - (layer->_size).x = local_40; - (layer->_size).y = layerSizeY; - fVar4 = sizeMultiX; - fVar5 = local_48; - fVar3 = local_4c; - } while (layerIndex < GHIDRA_CAST((this->_sprite)._layerCount)); - } - } - else { - layerIndex = GHIDRA_CAST(0x0); - if ((this->_sprite)._layerCount != 0) { - do { - local_40 = this->_fScale * g_vectorOne.y * local_48; - local_4c = this->_fScale * g_vectorOne.x * sizeMultiX; - layer = ANM2::GetLayer(&this->_sprite,layerIndex); - layerIndex = layerIndex + 1; - (layer->_size).x = local_4c; - (layer->_size).y = local_40; - fVar4 = sizeMultiX; - fVar5 = local_48; - } while (layerIndex < GHIDRA_CAST((this->_sprite)._layerCount)); - } - } - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagGlow._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlow._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagGlow._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlow._h)) + 0x4)))) != 0)) { - fVar3 = this->_fScale * 0.45; - (this->_tearHaloANM2)._scale.y = fVar3 * fVar5; - (this->_tearHaloANM2)._scale.x = fVar3 * fVar4; - if ((this->_tearHaloANM2)._loaded != 0) { - AnimationState::Update(&(this->_tearHaloANM2)._animState); - AnimationState::Update(&(this->_tearHaloANM2)._overlayAnimState); - } - } - if ((this->_tearEffectANM2)._loaded != 0) { - fVar3 = this->_fScale * 0.45; - (this->_tearEffectANM2)._scale.y = fVar3 * local_48; - (this->_tearEffectANM2)._scale.x = fVar3 * sizeMultiX; - AnimationState::Update(&(this->_tearEffectANM2)._animState); - AnimationState::Update(&(this->_tearEffectANM2)._overlayAnimState); - } - if (this->_deadEyeIntensity != 0.0) { - fVar3 = this->_fScale * 0.45; - (this->_deadEyeANM2)._scale.y = fVar3 * local_48; - (this->_deadEyeANM2)._scale.x = fVar3 * sizeMultiX; - if ((this->_deadEyeANM2)._loaded != 0) { - AnimationState::Update(&(this->_deadEyeANM2)._animState); - AnimationState::Update(&(this->_deadEyeANM2)._overlayAnimState); - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetSize(*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)) * this->_fScale, - this->_sizeMulti,*GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x48))); - this->_shadowSize = - *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x24)) * this->_fScale * (sizeMultiX + local_48) * 0.5; - return; -} - -// 00678060 -uint8_t Entity_Tear::is_not_familiar_spawned() -{ - if ((this->_parent == 0) || (*GHIDRA_CAST((this->_parent + 0x28)) != 2)) { - return 1; - } - return 0; -} - -// 00678080 -void Entity_Tear::fire_split_projectiles(uint8_t isHalved) -{ - uint32_t *puVar1; - double dVar2; - Entity_Player *pEVar3; - code *pcVar4; - BitSet128 flags; - uint64_t qVar5; - uint8_t isOwned; - uint32_t uVar6; - Entity_Tear *childShot; - Entity_Bomb *childBomb; - uint32_t uVar7; - Entity_Laser *techXLaser; - Entity *spawned; - uint32_t uVar8; - int iVar9; - uint32_t uVar10; - uint32_t uVar11; - float fVar12; - float fVar13; - float fVar14; - Entity_Player *player; - uint32_t splitCount; - float shotSpeed; - Vector bombVelocity; - Vector bombPos; - Vector techXVelocity; - Vector laserDirection; - Vector tearVelocity; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t uStack_18; - uint32_t uStack_14; - Game *game; - - player = GHIDRA_CAST(0x0); - pEVar3 = GHIDRA_CAST(this->_parent); - if (pEVar3 == GHIDRA_CAST(0x0)) { -LAB_006780c0: - splitCount = 6; - if (player == GHIDRA_CAST(0x0)) goto LAB_00678128; - } - else { - if (pEVar3->_type != 1) { - if (pEVar3->_type == 3) { - player = *GHIDRA_CAST(&pEVar3->_isControlsEnabled); - } - goto LAB_006780c0; - } - player = pEVar3; - } - isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xe5,0); - if ((isOwned == 0) && (isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18b,0), isOwned == 0)) { - isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x76,0); - if (isOwned != 0) { - splitCount = 4; - goto LAB_00678128; - } - splitCount = 6; - isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x34,0); - if (isOwned == 0) goto LAB_00678128; - } - splitCount = 3; -LAB_00678128: - uVar6 = Random(); - splitCount = splitCount + uVar6 % splitCount; - if (isHalved != 0) { - splitCount = (splitCount + 1) / 2; - } - shotSpeed = 1.0; - if (player != GHIDRA_CAST(0x0)) { - shotSpeed = player->_shotspeed; - } - if (splitCount != 0) { - do { - if (player == GHIDRA_CAST(0x0)) { -LAB_00678885: - uVar6 = Random(); - spawned = GHIDRA_CAST(this->_spawnerEntity); - uVar7 = Random(); - fVar12 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 360.0 * 0.017453292; - fVar13 = cos(fVar12); - fVar12 = sin(fVar12); - tearVelocity.x = fVar13 * shotSpeed * 10.0 - fVar12 * 0.0; - tearVelocity.y = fVar12 * shotSpeed * 10.0 + fVar13 * 0.0; - spawned = Game::SpawnEx(g_game,2,1,&this->_pos,&tearVelocity,spawned,0,uVar6,0); - childShot = (Entity_Tear *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor,0); - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80008) && - (_Init_thread_header(&DAT_00c80008), DAT_00c80008 == -1)) { - DAT_00c80010 = GHIDRA_UINT(g_tearFlagSpore._l) | GHIDRA_UINT(g_tearFlagOccult._l) | - GHIDRA_UINT(g_tearFlagBait._l) | GHIDRA_UINT(g_tearFlagMagnetize._l) | - GHIDRA_UINT(g_tearFlagIce._l) | GHIDRA_UINT(g_tearFlagPunch._l) | - GHIDRA_UINT(g_tearFlagCreepTrail._l) | GHIDRA_UINT(g_tearFlagHydrobounce._l) | - GHIDRA_UINT(g_tearFlagLasershot._l) | GHIDRA_UINT(g_tearFlagLaser._l) | - GHIDRA_UINT(g_tearFlagHorn._l) | GHIDRA_UINT(g_tearFlagJacobs._l) | - GHIDRA_UINT(g_tearFlagNeedle._l) | GHIDRA_UINT(g_tearFlagMidas._l) | - GHIDRA_UINT(g_tearFlagBelial._l) | GHIDRA_UINT(g_tearFlagAcid._l) | - GHIDRA_UINT(g_tearFlagEgg._l) | GHIDRA_UINT(g_tearFlagBooger._l) | - GHIDRA_UINT(g_tearFlagPermanentConfusion._l) | GHIDRA_UINT(g_tearFlagBigSpiral._l) | - GHIDRA_UINT(g_tearFlagGreedCoin._l) | GHIDRA_UINT(g_tearFlagGodsFlesh._l) | - GHIDRA_UINT(g_tearFlagBlackHpDrop._l) | GHIDRA_UINT(g_tearFlagCoinDrop._l) | - GHIDRA_UINT(g_tearFlagLightFromHeaven._l) | GHIDRA_UINT(g_tearFlagContinuum._l) | - GHIDRA_UINT(g_tearFlagSticky._l) | GHIDRA_UINT(g_tearFlagMysteriousLiquidCreep._l) | - GHIDRA_UINT(g_tearFlagGish._l) | GHIDRA_UINT(g_tearFlagGlow._l) | - GHIDRA_UINT(g_tearFlagSquare._l) | GHIDRA_UINT(g_tearFlagFlat._l) | - GHIDRA_UINT(g_tearFlagSpiral._l) | GHIDRA_UINT(g_tearFlagPulse._l) | - GHIDRA_UINT(g_tearFlagKnockback._l) | GHIDRA_UINT(g_tearFlagAttractor._l) | - GHIDRA_UINT(g_tearFlagBurn._l) | GHIDRA_UINT(g_tearFlagShrink._l) | - GHIDRA_UINT(g_tearFlagFear._l) | GHIDRA_UINT(g_tearFlagBounce._l) | - GHIDRA_UINT(g_tearFlagHpDrop._l) | GHIDRA_UINT(g_tearFlagConfusion._l) | - GHIDRA_UINT(g_tearFlagCharm._l) | GHIDRA_UINT(g_tearFlagMulligan._l) | - GHIDRA_UINT(g_tearFlagWiggle._l) | GHIDRA_UINT(g_tearFlagPersistent._l) | - GHIDRA_UINT(g_tearFlagGrow._l) | GHIDRA_UINT(g_tearFlagFreeze._l) | - GHIDRA_UINT(g_tearFlagPoison._l) | GHIDRA_UINT(g_tearFlagSlow._l) | - GHIDRA_UINT(g_tearFlagHoming._l) | GHIDRA_UINT(g_tearFlagSpectral._l) | - GHIDRA_UINT(g_tearFlagPiercing._l); - DAT_00c80014 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpore._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBait._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMagnetize._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPunch._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCreepTrail._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLasershot._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLaser._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHorn._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagJacobs._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagNeedle._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMidas._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBelial._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAcid._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagEgg._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBooger._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPermanentConfusion._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBigSpiral._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGreedCoin._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGodsFlesh._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBlackHpDrop._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCoinDrop._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLightFromHeaven._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagContinuum._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSticky._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMysteriousLiquidCreep._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGish._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlow._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSquare._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFlat._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpiral._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPulse._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagKnockback._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAttractor._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFear._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMulligan._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWiggle._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPersistent._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._l)) + 0x4))); - DAT_00c80018 = GHIDRA_UINT(g_tearFlagSpore._h) | GHIDRA_UINT(g_tearFlagOccult._h) | - GHIDRA_UINT(g_tearFlagBait._h) | GHIDRA_UINT(g_tearFlagMagnetize._h) | - GHIDRA_UINT(g_tearFlagIce._h) | GHIDRA_UINT(g_tearFlagPunch._h) | - GHIDRA_UINT(g_tearFlagCreepTrail._h) | GHIDRA_UINT(g_tearFlagHydrobounce._h) | - GHIDRA_UINT(g_tearFlagLasershot._h) | GHIDRA_UINT(g_tearFlagLaser._h) | - GHIDRA_UINT(g_tearFlagHorn._h) | GHIDRA_UINT(g_tearFlagJacobs._h) | - GHIDRA_UINT(g_tearFlagNeedle._h) | GHIDRA_UINT(g_tearFlagMidas._h) | - GHIDRA_UINT(g_tearFlagBelial._h) | GHIDRA_UINT(g_tearFlagAcid._h) | - GHIDRA_UINT(g_tearFlagEgg._h) | GHIDRA_UINT(g_tearFlagBooger._h) | - GHIDRA_UINT(g_tearFlagPermanentConfusion._h) | GHIDRA_UINT(g_tearFlagBigSpiral._h) | - GHIDRA_UINT(g_tearFlagGreedCoin._h) | GHIDRA_UINT(g_tearFlagGodsFlesh._h) | - GHIDRA_UINT(g_tearFlagBlackHpDrop._h) | GHIDRA_UINT(g_tearFlagCoinDrop._h) | - GHIDRA_UINT(g_tearFlagLightFromHeaven._h) | GHIDRA_UINT(g_tearFlagContinuum._h) | - GHIDRA_UINT(g_tearFlagSticky._h) | GHIDRA_UINT(g_tearFlagMysteriousLiquidCreep._h) | - GHIDRA_UINT(g_tearFlagGish._h) | GHIDRA_UINT(g_tearFlagGlow._h) | - GHIDRA_UINT(g_tearFlagSquare._h) | GHIDRA_UINT(g_tearFlagFlat._h) | - GHIDRA_UINT(g_tearFlagSpiral._h) | GHIDRA_UINT(g_tearFlagPulse._h) | - GHIDRA_UINT(g_tearFlagKnockback._h) | GHIDRA_UINT(g_tearFlagAttractor._h) | - GHIDRA_UINT(g_tearFlagBurn._h) | GHIDRA_UINT(g_tearFlagShrink._h) | - GHIDRA_UINT(g_tearFlagFear._h) | GHIDRA_UINT(g_tearFlagBounce._h) | - GHIDRA_UINT(g_tearFlagHpDrop._h) | GHIDRA_UINT(g_tearFlagConfusion._h) | - GHIDRA_UINT(g_tearFlagCharm._h) | GHIDRA_UINT(g_tearFlagMulligan._h) | - GHIDRA_UINT(g_tearFlagWiggle._h) | GHIDRA_UINT(g_tearFlagPersistent._h) | - GHIDRA_UINT(g_tearFlagGrow._h) | GHIDRA_UINT(g_tearFlagFreeze._h) | - GHIDRA_UINT(g_tearFlagPoison._h) | GHIDRA_UINT(g_tearFlagSlow._h) | - GHIDRA_UINT(g_tearFlagHoming._h) | GHIDRA_UINT(g_tearFlagSpectral._h) | - GHIDRA_UINT(g_tearFlagPiercing._h); - DAT_00c8001c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpore._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagOccult._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBait._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMagnetize._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPunch._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCreepTrail._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLasershot._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLaser._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHorn._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagJacobs._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagNeedle._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMidas._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBelial._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAcid._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagEgg._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBooger._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPermanentConfusion._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBigSpiral._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGreedCoin._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGodsFlesh._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBlackHpDrop._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCoinDrop._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLightFromHeaven._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagContinuum._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSticky._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMysteriousLiquidCreep._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGish._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlow._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSquare._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFlat._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpiral._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPulse._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagKnockback._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAttractor._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFear._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBounce._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMulligan._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWiggle._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPersistent._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGrow._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))) | - (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._h)) + 0x4))); - _Init_thread_footer(&DAT_00c80008); - } - uStack_1c = DAT_00c80014 & *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - uStack_20 = DAT_00c80010 & GHIDRA_UINT((this->_tearFlags)._l); - uStack_14 = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & DAT_00c8001c; - uStack_18 = DAT_00c80018 & GHIDRA_UINT((this->_tearFlags)._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = uStack_1c; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = uStack_20; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uStack_18; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_14; - SetTearFlags(childShot,flags); - uVar6 = Random(); - (**(code **)(*GHIDRA_CAST(childShot) + 0x40)) - ((this->_collisionDamage / 1.5) * - ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 0.75)); - fVar12 = fVar13 * this->_fScale * 0.55; - if (fVar12 <= 0.01) { - fVar12 = 0.01; - } - childShot->_baseScale = fVar12; - childShot->_fScale = fVar12; - ResetSpriteScale(childShot); - fVar12 = -6.0; - if (this->_height <= -6.0) { - fVar12 = this->_height; - } - childShot->_height = fVar12; - fVar13 = get_height_offset_y(childShot,fVar12); - game = g_game; - (childShot->_posOffset).y = fVar13; - if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && - ((childShot->_posOffset).y = -18.0, -5.1 < fVar12)) { - childShot->_height = -5.1; - } - uVar6 = Random(); - childShot->_fallingAccel = 1.3; - childShot->_fallingSpeed = - ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 0.75 + 0.5) * (float)this * 0.5; - childShot->SetColor(&(this->_sprite)._color,0xffffffff,0xff,0,1); - childShot->_prismTouched = this->_prismTouched; - childShot->_multidimensionalTouched = this->_multidimensionalTouched; -LAB_00678b68: - childShot->Update(); - } - else { - isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x76,0); - if (isOwned != 0) { - uVar6 = Random(); - childShot = (Entity_Tear *) - Entity_Player::FireDelayedBrimstone - (player,(float)((double)GHIDRA_INT(uVar6) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 360.0,GHIDRA_CAST(player)); - (childShot->_pos).x = (this->_pos).x; - (childShot->_pos).y = (this->_pos).y; - iVar9 = *GHIDRA_CAST(childShot); - *GHIDRA_CAST(&(childShot->_tearHaloANM2)._animState._layerFrames) = 1; - (**(code **)(iVar9 + 0x3c))(&(this->_sprite)._color,0xffffffff,0xff,0,1); - *GHIDRA_CAST(&(childShot->_tearHaloANM2)._overlayAnimState._currentlyTriggeredEvents) = - this->_prismTouched; - *GHIDRA_CAST(&(childShot->_tearHaloANM2)._overlayAnimState._animData) = - this->_multidimensionalTouched; - goto LAB_00678b68; - } - isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x34,0); - if (isOwned == 0) { - isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18b,0); - if (isOwned == 0) { - isOwned = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x44,0); - if (isOwned == 0) goto LAB_00678885; - uVar6 = Random(); - fVar12 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 360.0 * 0.017453292; - fVar13 = cos(fVar12); - laserDirection.y = sin(fVar12); - laserDirection.x = fVar13 - laserDirection.y * 0.0; - laserDirection.y = fVar13 * 0.0 + laserDirection.y; - childShot = (Entity_Tear *) - Entity_Player::FireTechLaser - (player,&this->_pos,1,&laserDirection,0,0,GHIDRA_CAST(0x0),1.0); - childShot->SetCollisionDamage(childShot->_collisionDamage / 1.5); - (childShot->_pos).x = (this->_pos).x; - (childShot->_pos).y = (this->_pos).y; - iVar9 = *GHIDRA_CAST(childShot); - *GHIDRA_CAST(&(childShot->_tearHaloANM2)._animState._layerFrames) = 1; - (**(code **)(iVar9 + 0x3c))(&(this->_sprite)._color,0xffffffff,0xff,0,1); - *GHIDRA_CAST(&(childShot->_tearHaloANM2)._overlayAnimState._currentlyTriggeredEvents) = - this->_prismTouched; - *GHIDRA_CAST(&(childShot->_tearHaloANM2)._overlayAnimState._animData) = - this->_multidimensionalTouched; - goto LAB_00678b68; - } - uVar6 = Random(); - dVar2 = __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]; - fVar12 = player->_shotspeed * 10.0; - uVar7 = Random(); - fVar13 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 360.0 * 0.017453292; - fVar14 = cos(fVar13); - fVar13 = sin(fVar13); - techXVelocity.y = fVar13 * fVar12 + fVar14 * 0.0; - techXVelocity.x = fVar14 * fVar12 - fVar13 * 0.0; - techXLaser = Entity_Player::FireTechXLaser - (player,&this->_pos,&techXVelocity, - (float)((double)GHIDRA_INT(uVar6) + dVar2) * 2.3283064e-10 * 60.0 + 20.0, - GHIDRA_CAST(0x0),1.0); - techXLaser->_prismTouched = this->_prismTouched; - techXLaser->_multidimensionalTouched = this->_multidimensionalTouched; - techXLaser->Update(); - } - else { - uVar6 = Random(); - fVar12 = ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 4.0 + 3.0) * player->_shotspeed; - uVar6 = Random(); - fVar13 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 360.0 * 0.017453292; - fVar14 = cos(fVar13); - fVar13 = sin(fVar13); - bombVelocity.x = fVar12 * fVar14 - fVar13 * 0.0; - bombVelocity.y = fVar12 * fVar13 + fVar14 * 0.0; - uVar6 = Random(); - fVar12 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - fVar12 = fVar12 + fVar12; - uVar6 = Random(); - fVar13 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10; - fVar14 = cos(fVar12); - bombPos.x = fVar14 * fVar13 * 10.0 + (this->_pos).x; - fVar12 = sin(fVar12); - bombPos.y = fVar12 * fVar13 * 10.0 + (this->_pos).y; - childBomb = (GHIDRA_CAST((player)))->Entity_Player::FireBomb(&bombPos,&bombVelocity,GHIDRA_CAST(0x0)); - childBomb->SetColor(&(this->_sprite)._color,0xffffffff,0xff,0,1); - childBomb->_prismTouched = this->_prismTouched; - if (this->_canTriggerStreakEnd == 0) { - uVar6 = *GHIDRA_CAST((GHIDRA_INT(&(childBomb->_tearFlags)._l) + 4)); - qVar5 = (childBomb->_tearFlags)._h; - uVar7 = *GHIDRA_CAST((GHIDRA_INT(&(childBomb->_tearFlags)._h) + 4)); - uVar11 = ~GHIDRA_UINT(g_tearFlagSadBomb._h); - uVar10 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSadBomb._h)) + 0x4))); - uVar8 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSadBomb._l)) + 0x4))); - *GHIDRA_CAST(&(childBomb->_tearFlags)._l) = - ~GHIDRA_UINT(g_tearFlagSadBomb._l) & GHIDRA_UINT((childBomb->_tearFlags)._l); - *GHIDRA_CAST((GHIDRA_INT(&(childBomb->_tearFlags)._l) + 4)) = uVar8 & uVar6; - *GHIDRA_CAST(&(childBomb->_tearFlags)._h) = uVar11 & GHIDRA_UINT(qVar5); - *GHIDRA_CAST((GHIDRA_INT(&(childBomb->_tearFlags)._h) + 4)) = uVar10 & uVar7; - } - childBomb->_loadCostumes = 1; - childBomb->_scale = childBomb->_scale * 0.5; - childBomb->_explosionDamage = childBomb->_explosionDamage * 0.5; - childBomb->_radiusMultiplier = childBomb->_radiusMultiplier * 0.65; - (GHIDRA_CAST((GHIDRA_CAST(childBomb))))->Entity::SetSize(childBomb->_size * 0.5, - (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); - if ((childBomb->_variant != 0x13) && (childBomb->_variant != 0x14)) { - uVar6 = Random(); - childBomb->_fallSpeed = - -3.0 - (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) - * 2.3283064e-10 * 5.0; - uVar6 = (childBomb->_dropRNG)._seed; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = (childBomb->_dropRNG)._seed; - if (uVar6 == 0) { - pcVar4 = (code *)swi(3); - (*pcVar4)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)(childBomb->_dropRNG)._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)(childBomb->_dropRNG)._shift2 & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)(childBomb->_dropRNG)._shift3 & 0x1f) ^ uVar6; - (childBomb->_dropRNG)._seed = uVar6; - (childBomb->_posOffset).x = 0.0; - iVar9 = uVar6 % 0xe + 10; - (childBomb->_posOffset).y = -3.0; - childBomb->_explosionCountdown1 = iVar9; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((childBomb)) + 0x414)))) = iVar9; - } - *GHIDRA_CAST(&childBomb->_flags) = GHIDRA_UINT(childBomb->_flags) | 0x4000000; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&childBomb->_flags) + 4)); - *puVar1 = *puVar1 | 0x400; - } - } - splitCount = splitCount - 1; - } while (splitCount != 0); - } - return; -} - -// 006790c0 -void Entity_Tear::Render(Vector *offset) -{ - Vector *position; - float fVar1; - uint8_t isLocalPlayer; - Entity_Player *spawnerPlayer; - float fVar2; - float fVar3; - double dVar4; - double dVar5; - ColorMod remoteColor; - float savedTintR; - float savedTintG; - float savedTintB; - float savedTintA; - float savedColorizeR; - float savedColorizeG; - float savedColorizeB; - float savedColorizeA; - uint32_t auStack_6c [26]; - uint64_t savedOffsetXY; - ColorMod *spriteColor; - - if ((this->_exists != 0) && (this->_visible != 0)) { - fVar3 = g_displayPixelRatio * g_screenPointScale; - dVar4 = floor((double)(((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * fVar3 + 0.5)); - dVar5 = floor((double)(((((this->_pos).y + (this->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * fVar3 + 0.5)); - position = &this->_renderPosition; - fVar1 = offset->y; - position->x = (float)dVar4 / fVar3 + offset->x; - (this->_renderPosition).y = (float)dVar5 / fVar3 + fVar1; - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagGlow._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlow._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagGlow._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGlow._h)) + 0x4)))) != 0)) { - ANM2::Render(&this->_tearHaloANM2,position,&g_vectorZero,&g_vectorZero); - } - if (((this->_tearEffectANM2)._loaded != 0) && - ((GHIDRA_UINT((this->_tearEffectANM2)._bitflags) >> 0xd & 1) != 0)) { - ANM2::Render(&this->_tearEffectANM2,position,&g_vectorZero,&g_vectorZero); - } - spawnerPlayer = - (Entity_Player *) - __RTDynamicCast(this->_spawnerEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor); - savedTintR = (this->_sprite)._color._tint[0]; - savedTintG = (this->_sprite)._color._tint[1]; - savedTintB = (this->_sprite)._color._tint[2]; - savedTintA = (this->_sprite)._color._tint[3]; - spriteColor = &(this->_sprite)._color; - fVar1 = (this->_sprite)._color._offset[2]; - savedColorizeR = (this->_sprite)._color._colorize[0]; - savedColorizeG = (this->_sprite)._color._colorize[1]; - savedColorizeB = (this->_sprite)._color._colorize[2]; - savedColorizeA = (this->_sprite)._color._colorize[3]; - savedOffsetXY = *GHIDRA_CAST((this->_sprite)._color._offset); - if ((spawnerPlayer != GHIDRA_CAST(0x0)) && - (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1)))) { - isLocalPlayer = - NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager),spawnerPlayer->_controllerIndex) - ; - if (isLocalPlayer == 0) { - remoteColor._colorize[0] = (this->_sprite)._color._colorize[0]; - remoteColor._colorize[1] = (this->_sprite)._color._colorize[1]; - remoteColor._colorize[2] = (this->_sprite)._color._colorize[2]; - remoteColor._colorize[3] = (this->_sprite)._color._colorize[3]; - remoteColor._tint[0] = spriteColor->_tint[0]; - remoteColor._tint[1] = (this->_sprite)._color._tint[1]; - remoteColor._tint[2] = (this->_sprite)._color._tint[2]; - fVar3 = (this->_sprite)._color._tint[3]; - remoteColor._offset[2] = (this->_sprite)._color._offset[2]; - fVar2 = (this->_sprite)._color._offset[0]; - remoteColor._offset[1] = (this->_sprite)._color._offset[1]; - remoteColor._tint[3] = fVar3; - remoteColor._offset[0] = fVar2; - FUN_00925df0(); - remoteColor._tint[3] = fVar2 * fVar3; - (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(&remoteColor); - } - } - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); - if (spriteColor != GHIDRA_CAST(auStack_6c)) { - spriteColor->_tint[0] = savedTintR; - (this->_sprite)._color._tint[1] = savedTintG; - (this->_sprite)._color._tint[2] = savedTintB; - (this->_sprite)._color._tint[3] = savedTintA; - (this->_sprite)._color._colorize[0] = savedColorizeR; - (this->_sprite)._color._colorize[1] = savedColorizeG; - (this->_sprite)._color._colorize[2] = savedColorizeB; - (this->_sprite)._color._colorize[3] = savedColorizeA; - *GHIDRA_CAST((this->_sprite)._color._offset) = savedOffsetXY; - (this->_sprite)._color._offset[2] = fVar1; - } - if (((this->_tearEffectANM2)._loaded != 0) && - ((GHIDRA_UINT((this->_tearEffectANM2)._bitflags) >> 0xd & 1) == 0)) { - ANM2::Render(&this->_tearEffectANM2,position,&g_vectorZero,&g_vectorZero); - } - if (this->_deadEyeIntensity != 0.0) { - ANM2::Render(&this->_deadEyeANM2,position,&g_vectorZero,&g_vectorZero); - } - FUN_00862b80(this,offset); - } - return; -} - -// 00679400 -void Entity_Tear::Interpolate() -{ - uint8_t isFlagSet; - int iVar1; - int playerLaser; - Vector *pVVar2; - int extraout_EDX; - uint32_t uVar3; - Entity_Player *player; - Game *game; - float fVar4; - uint8_t *puVar5; - float fVar6; - float fVar7; - Vector local_34; - uint8_t *local_2c; - float local_28; - Vector local_24; - Entity_Tear *local_1c; - uint8_t auStack_18 [8]; - uint32_t uStack_10; - uint32_t uStack_c; - Entity_Player *nextSpawner; - Entity_Player *spawner; - Entity_Tear *tear; - uint32_t tearFlagsLo; - - if (0 < this->_holdTimer) { - iVar1 = this->_parent; - if (iVar1 == 0) { - return; - } - fVar4 = *GHIDRA_CAST((iVar1 + 0x340)); - fVar7 = (this->_holdOffset).y; - (this->_pos).x = *GHIDRA_CAST((iVar1 + 0x33c)) + (this->_holdOffset).x; - (this->_pos).y = fVar4 + fVar7; - return; - } - uVar3 = GHIDRA_UINT((this->_tearFlags)._h); - local_2c = GHIDRA_CAST((uVar3 & GHIDRA_UINT(g_tearFlagTractorBeam._h))); - tearFlagsLo = GHIDRA_UINT((this->_tearFlags)._l); - local_34.x = (float)(*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagTractorBeam._h)) + 0x4)))); - local_1c = this; - if (((tearFlagsLo & GHIDRA_UINT(g_tearFlagTractorBeam._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagTractorBeam._l)) + 0x4)))) != 0) || - (local_2c != GHIDRA_CAST(0x0) || local_34.x != 0.0)) { - if ((((tearFlagsLo & GHIDRA_UINT(g_tearFlagLudovico._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4)))) == 0) && - ((((uVar3 & GHIDRA_UINT(g_tearFlagLudovico._h)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4)))) == 0 && - (iVar1 = this->_parent, iVar1 != 0)) && (*GHIDRA_CAST((iVar1 + 0x28)) == 1)))) && - (this->_stickTarget == (void *)0x0)) { - iVar1 = __RTDynamicCast(iVar1,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0); - playerLaser = __RTDynamicCast(*GHIDRA_CAST((iVar1 + 0x1430)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor,0); - if (playerLaser != 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_18)) + 0x0))) = GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagBoomerang._l); - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_18)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBoomerang._l)) + 0x4))) - ; - fVar4 = (this->_pos).x - *GHIDRA_CAST((iVar1 + 0x33c)); - fVar7 = (this->_pos).y - *GHIDRA_CAST((iVar1 + 0x340)); - uStack_10 = GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagBoomerang._h); - uStack_c = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBoomerang._h)) + 0x4))); - local_2c = GHIDRA_CAST(0x3f800000); - local_28 = fVar7; - local_24.x = fVar4; - isFlagSet = (GHIDRA_CAST((GHIDRA_CAST(auStack_18))))->BitSet128::IsNonZero(); - if ((isFlagSet != 0) && (fVar7 * (this->_velocity).y + fVar4 * (this->_velocity).x < 0.0)) { - local_2c = &DAT_bf800000; - } - local_34.x = *GHIDRA_CAST((extraout_EDX + 0x41c)) * 0.017453292; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_18)) + 0x0))) = cos(local_34.x); - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_18)) + 0x4))) = sin(local_34.x); - fVar4 = (this->_velocity).y; - fVar7 = (this->_velocity).x; - fVar4 = sqrtf(fVar7 * fVar7 + fVar4 * fVar4); - pVVar2 = (GHIDRA_CAST((GHIDRA_CAST(auStack_18))))->Vector::Resized(&local_34,fVar4); - fVar4 = pVVar2->y; - (this->_velocity).x = (float)local_2c * pVVar2->x; - (this->_velocity).y = (float)local_2c * fVar4; - fVar7 = sqrtf(local_28 * local_28 + local_24.x * local_24.x); - fVar4 = *GHIDRA_CAST((iVar1 + 0x33c)); - (this->_pos).y = fVar7 * (*GHIDRA_CAST((GHIDRA_CAST(&((float)auStack_18)) + 0x4))) + *GHIDRA_CAST((iVar1 + 0x340)); - (this->_pos).x = fVar7 * (*GHIDRA_CAST((GHIDRA_CAST(&((float)auStack_18)) + 0x0))) + fVar4; - } - } - } - uVar3 = GHIDRA_UINT((this->_tearFlags)._h); - local_24.x = (float)(uVar3 & GHIDRA_UINT(g_tearFlagLaser._h)); - local_34.x = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - local_28 = (float)(GHIDRA_UINT(local_34.x) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLaser._h)) + 0x4)))); - if (((!((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagLaser._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLaser._l)) + 0x4)))) == 0)) || - (!(local_24.x == 0.0 && local_28 == 0.0))) && - ((this->_techZeroLaser != 0 && (this->_techZeroTarget != 0)))) { - playerLaser = __RTDynamicCast(this->_techZeroLaser,0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor,0); - iVar1 = this->_techZeroTarget; - local_28 = (*GHIDRA_CAST((iVar1 + 0x33c)) + *GHIDRA_CAST((iVar1 + 0x34c))) - - ((this->_velocity).x + (this->_pos).x + (this->_posOffset).x); - local_24.x = (*GHIDRA_CAST((iVar1 + 0x340)) + *GHIDRA_CAST((iVar1 + 0x350))) - - ((this->_velocity).y + (this->_pos).y + (this->_posOffset).y); - fVar4 = atan2f(local_24.x,local_28); - fVar4 = fVar4 * 57.295776; - *GHIDRA_CAST((playerLaser + 0x420)) = *GHIDRA_CAST((playerLaser + 0x41c)); - *GHIDRA_CAST((playerLaser + 0x418)) = fVar4; - *GHIDRA_CAST((playerLaser + 0x41c)) = fVar4; - *GHIDRA_CAST((playerLaser + 0xec)) = fVar4 - 90.0; - fVar4 = sqrtf(local_24.x * local_24.x + local_28 * local_28); - *GHIDRA_CAST((playerLaser + 0x4d0)) = fVar4; - fVar4 = (this->_posOffset).y; - fVar7 = (this->_pos).y; - fVar6 = (this->_velocity).y; - *GHIDRA_CAST((playerLaser + 0x33c)) = - ((this->_posOffset).x + (this->_pos).x + (this->_velocity).x) - - *GHIDRA_CAST((playerLaser + 0x34c)); - *GHIDRA_CAST((playerLaser + 0x340)) = (fVar4 + fVar7 + fVar6) - *GHIDRA_CAST((playerLaser + 0x350)); - uVar3 = GHIDRA_UINT((this->_tearFlags)._h); - local_34.x = *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - } - tear = local_1c; - local_24.x = (float)(uVar3 & GHIDRA_UINT(g_tearFlagLudovico._h)); - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagLudovico._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4)))) == 0) && - (local_24.x == 0.0 && (GHIDRA_UINT(local_34.x) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4)))) == 0)) { - nextSpawner = GHIDRA_CAST(this->_spawnerEntity); - player = GHIDRA_CAST(this); - while (spawner = nextSpawner, spawner != GHIDRA_CAST(0x0)) { - player = spawner; - nextSpawner = GHIDRA_CAST(spawner->_spawnerEntity); - } - if (player->_type != 1) { - player = GHIDRA_CAST(0x0); - } - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagWiggle._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWiggle._l)) + 0x4)))) != 0) || - ((uVar3 & GHIDRA_UINT(g_tearFlagWiggle._h)) != 0 || - (GHIDRA_UINT(local_34.x) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagWiggle._h)) + 0x4)))) != 0)) { - if (player == GHIDRA_CAST(0x0)) { - fVar4 = 1.0; - } - else { - fVar4 = get_tear_trinket_multiplier(player,10); - if (fVar4 <= 1.0) { - fVar4 = 1.0; - } - } - apply_wiggle(tear,fVar4); - } - local_1c = (Entity_Tear *) - (*GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpiral._h)) + 0x4)))); - if (((GHIDRA_UINT((tear->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagSpiral._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpiral._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((tear->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagSpiral._h)) != 0 || - local_1c != GHIDRA_CAST(0x0))) { - if (player == GHIDRA_CAST(0x0)) { - fVar4 = 1.0; - } - else { - playerLaser = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0xb); - iVar1 = 1; - if (1 < playerLaser) { - iVar1 = playerLaser; - } - fVar4 = (float)iVar1; - if (fVar4 <= 1.0) { - fVar4 = 1.0; - } - } - apply_wiggle(tear,fVar4); - } - local_1c = (Entity_Tear *) - (*GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBigSpiral._h)) + 0x4)))); - if (((GHIDRA_UINT((tear->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagBigSpiral._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBigSpiral._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((tear->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagBigSpiral._h)) != 0 || - local_1c != GHIDRA_CAST(0x0))) { - if (player != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x60); - } - update_wiggle(tear); - } - (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Interpolate(); - this = tear; - } - else { - if ((this->_subtype & 2) != 0) { - uVar3 = GHIDRA_UINT(this->_flags); - if ((uVar3 & 2) != 0) { - *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)); - *GHIDRA_CAST(&this->_flags) = uVar3 & 0xfffffffd; - return; - } - } - pVVar2 = &this->_pos; - (this->_preInterpolatePos).x = (this->_pos).x; - (this->_preInterpolatePos).y = (this->_pos).y; - fVar4 = this->_friction; - fVar7 = (this->_velocity).y; - fVar6 = this->_speedMultiplier; - puVar5 = GHIDRA_CAST((fVar4 * (this->_velocity).x * fVar6 * 0.5 + pVVar2->x)); - pVVar2->x = (float)puVar5; - (this->_pos).y = fVar7 * fVar4 * fVar6 * 0.5 + (this->_pos).y; - this->_isInterpolating = 1; - local_34.x = (float)this->_parent; - if ((local_34.x == 0.0) || (*GHIDRA_CAST((GHIDRA_CAST(local_34.x) + 0x28)) != 2)) { - local_1c = GHIDRA_CAST((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagContinuum._h))); - local_24.x = (float)(*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagContinuum._h)) + 0x4))) - ); - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagContinuum._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagContinuum._l)) + 0x4)))) == 0) && - (local_1c == GHIDRA_CAST(0x0) && local_24.x == 0.0)) { - Room::GetClampedPositionImpl(g_game->_room,GHIDRA_CAST(auStack_18),pVVar2,0.0,0.0,0.0,0.0); - pVVar2->x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)auStack_18)) + 0x0))); - (this->_pos).y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)auStack_18)) + 0x4))); - local_34.x = (float)this->_parent; - puVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(auStack_18))) + 0x4))); - } - if ((local_34.x != 0.0) && (*GHIDRA_CAST((GHIDRA_CAST(local_34.x) + 0x28)) == 2)) goto LAB_00679c17; - } - else { -LAB_00679c17: - if ((this->_subtype & 1) != 0) { - local_1c = (Entity_Tear *) - ((((float)(GHIDRA_UINT(this->_index) % 10) + 0.0) * 0.1 * 0.5 + 2.0) * 0.017453292); - local_2c = GHIDRA_CAST(cos((float)local_1c)); - fVar6 = sin((float)local_1c); - fVar4 = (this->_parentOffset).x; - fVar7 = (this->_parentOffset).y; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_18)) + 0x4))) = (float)local_2c * fVar7 + fVar6 * fVar4; - local_28 = *GHIDRA_CAST((GHIDRA_CAST(local_34.x) + 0x33c)); - local_34.x = *GHIDRA_CAST((GHIDRA_CAST(local_34.x) + 0x340)); - local_1c = GHIDRA_CAST(((float)local_2c * fVar4 - fVar6 * fVar7)); - iVar1 = this->_index * 0x32; - local_2c = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(auStack_18))) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_18)) + 0x0))) = local_1c; - local_24.x = sin(((float)(g_game->_frameCount - this->_spawnFrame) + 0.5 + - (float)((double)iVar1 + __uint_to_double_fixup[-(iVar1 >> 0x1f)])) * 0.08); - fVar4 = sqrtf((float)local_1c * (float)local_1c + (float)local_2c * (float)local_2c); - pVVar2 = (GHIDRA_CAST((GHIDRA_CAST(auStack_18))))->Vector::Resized(&local_24,fVar4 * (local_24.x * 0.5 + 1.0)); - puVar5 = GHIDRA_CAST((local_28 + pVVar2->x)); - fVar4 = pVVar2->y; - (this->_pos).x = (float)puVar5; - (this->_pos).y = local_34.x + fVar4; - } - } - if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagHydrobounce._l)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._l)) + 0x4)))) != 0) || - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagHydrobounce._h)) != 0 || - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHydrobounce._h)) + 0x4)))) != 0)) { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetRootParent(); - game = g_game; - fVar4 = sin(((float)(g_game->_frameCount - this->_spawnFrame) + 0.5) * - (3.1415927 / (float)puVar5)); - (this->_posOffset).y = ABS(fVar4) * this->_height; - goto LAB_00679a3a; - } - } - game = g_game; -LAB_00679a3a: - if (this->_waitFrames < 1) { - local_1c = (Entity_Tear *) - (*GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4)))); - if ((((GHIDRA_UINT(g_tearFlagLudovico._l) & GHIDRA_UINT((this->_tearFlags)._l)) == 0 && - ((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4))) == 0) && - ((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagLudovico._h)) == 0 && - local_1c == GHIDRA_CAST(0x0))) && (this->_dead == 0)) { - if (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) { - (this->_posOffset).y = -18.0; - return; - } - fVar4 = get_height_offset_y(this,this->_fallingSpeed * this->_speedMultiplier * 0.5 + - this->_height); - (this->_posOffset).y = fVar4; - } - } - return; -} - -// 00679e80 -void Entity_Tear::SetDeadEyeIntensity(float intensity) -{ - LayerState *effectLayer; - char *ptr; - int blendMode; - uint32_t uVar1; - ColorMod *effectColor; - uint32_t local_68 [11]; - std_string anm2Path; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - - puStack_20 = GHIDRA_CAST((local_68 + 0x19)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00af33dd; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_68 + 0x16)); - ExceptionList = &local_1c; - this->_deadEyeIntensity = intensity; - if ((intensity != 0.0) && ((this->_deadEyeANM2)._loaded == 0)) { - anm2Path._size = 0; - anm2Path._capacity = 0xf; - anm2Path._buf[0] = '\0'; - anm2Path._buf[1] = '\0'; - anm2Path._buf[2] = '\0'; - anm2Path._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20); - anm2Path._size = 0x1a; - anm2Path._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))),"gfx/DeadEyeTearEffect.anm2",0x1b); - local_14 = 0; - ANM2::Load(&this->_deadEyeANM2,&anm2Path,1); - local_14 = 0xffffffff; - if (0xf < anm2Path._capacity) { - uVar1 = anm2Path._capacity + 1; - ptr = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))); - if (0xfff < uVar1) { - ptr = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + -4)); - uVar1 = anm2Path._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(ptr,uVar1); - } - uVar1 = g_graphicsManager_flags; - effectLayer = ANM2::GetLayer(&this->_deadEyeANM2,GHIDRA_CAST(0x0)); - blendMode = 1; - if ((uVar1 & 4) == 0) { - blendMode = 6; - } - effectLayer->_blendMode[1] = blendMode; - effectLayer->_blendMode[0] = 0; - effectLayer->_blendMode[2] = 1; - effectLayer->_blendMode[3] = 1; - effectLayer->_blendMode[4] = 1; - ANM2::Play(&this->_deadEyeANM2,s_Idle,0); - effectColor = &(this->_deadEyeANM2)._color; - if (effectColor != GHIDRA_CAST(local_68)) { - (this->_deadEyeANM2)._color._colorize[0] = 0.0; - (this->_deadEyeANM2)._color._colorize[1] = 0.0; - (this->_deadEyeANM2)._color._colorize[2] = 0.0; - (this->_deadEyeANM2)._color._colorize[3] = 0.0; - effectColor->_tint[0] = 1.0; - (this->_deadEyeANM2)._color._tint[1] = 1.0; - (this->_deadEyeANM2)._color._tint[2] = 1.0; - (this->_deadEyeANM2)._color._tint[3] = intensity; - (this->_deadEyeANM2)._color._offset[0] = 0.0; - (this->_deadEyeANM2)._color._offset[1] = 0.0; - (this->_deadEyeANM2)._color._offset[2] = 0.0; - } - } - ExceptionList = local_1c; - return; -} - -// 0067a190 -Entity_Tear * Entity_Tear::MakeMultidimensionalCopy(Entity *spawner) -{ - BitSet128 flags; - Entity *spawned; - Entity_Tear *copy; - uint32_t variant; - float fVar1; - uint32_t uStack_28; - uint32_t uStack_20; - uint32_t uStack_1c; - uint32_t uStack_18; - uint32_t uStack_14; - Game *game; - uint32_t *refSlot; - - variant = this->_variant; - if (((variant != 0x23) && (variant != 0x25)) && (variant != 0x26)) { - variant = 0x15; - } - spawned = Game::SpawnEx(g_game,2,variant,&this->_pos,&this->_velocity,spawner,this->_subtype, - (this->_dropRNG)._seed,0); - copy = (Entity_Tear *) - __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor,0); - uStack_28 = GHIDRA_CAST(this->_height); - copy->_height = (float)uStack_28; - fVar1 = get_height_offset_y(copy,(float)uStack_28); - game = g_game; - (copy->_posOffset).y = fVar1; - if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && - ((copy->_posOffset).y = -18.0, -5.1 < (float)uStack_28)) { - copy->_height = -5.1; - } - copy->_fallingSpeed = this->_fallingSpeed; - copy->_fallingAccel = this->_fallingAccel; - copy->_homingFriction = this->_homingFriction; - copy->_tearRange = this->_tearRange; - fVar1 = this->_fScale; - if (fVar1 <= 0.01) { - fVar1 = 0.01; - } - copy->_baseScale = fVar1; - copy->_fScale = fVar1; - ResetSpriteScale(copy); - uStack_1c = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._l) + 4)); - uStack_20 = ~GHIDRA_UINT(g_tearFlagLudovico._l) & GHIDRA_UINT((this->_tearFlags)._l); - uStack_14 = ~(*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4))) & *GHIDRA_CAST((GHIDRA_INT(&(this->_tearFlags)._h) + 4)); - uStack_18 = ~GHIDRA_UINT(g_tearFlagLudovico._h) & GHIDRA_UINT((this->_tearFlags)._h); - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = uStack_1c; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = uStack_20; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uStack_18; - (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_14; - SetTearFlags(copy,flags); - copy->_waitFrames = this->_waitFrames; - copy->_tearIdx = this->_tearIdx; - copy->SetCollisionDamage(this->_collisionDamage); - copy->_rotation = this->_rotation; - copy->_knockbackMultiplier = this->_knockbackMultiplier; - SetDeadEyeIntensity(copy,this->_deadEyeIntensity); - copy->_multidimensionalTouched = this->_multidimensionalTouched; - (copy->_continueVelocity).x = (this->_continueVelocity).x; - (copy->_continueVelocity).y = (this->_continueVelocity).y; - uStack_28 = GHIDRA_CAST(this->_parent); - refSlot = ©->_parent; - if (*refSlot != 0) { - msvc::multiset::erase(GHIDRA_INT(register0x00000010) + -0x2c); - } - *refSlot = uStack_28; - if (uStack_28 != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(refSlot); - } - refSlot = ©->_spawnerEntity; - if (copy->_spawnerEntity != 0) { - uStack_28 = GHIDRA_CAST(refSlot); - msvc::multiset::erase(&uStack_28); - } - *refSlot = spawner; - if (spawner != GHIDRA_CAST(0x0)) { - msvc::multiset::insert(refSlot); - } - return copy; -} - -// 0067a400 -void Entity_Tear::ChangeVariant(int variant) -{ - uint8_t isGfuelSeed; - LayerState *layer; - int blendSrc; - char *freeBlock; - uint32_t uVar1; - std_string bulletAnmPath; - std_string missileAnmPath; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - float savedCollisionDamage; - int savedGridCollisionClass; - float savedScale; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00af79f5; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - ExceptionList = &local_1c; - savedGridCollisionClass = this->_entityGridCollisionClass; - savedCollisionDamage = this->_collisionDamage; - this->_variant = variant; - savedScale = this->_fScale; - this->LoadEntityConfig(local_24); - if (this->_config != (void *)0x0) { - ANM2::Load(&this->_sprite,GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); - if (this->_variant == 0xd) { - isGfuelSeed = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f); - if (isGfuelSeed != 0) { - bulletAnmPath._size = 0; - bulletAnmPath._capacity = 0xf; - bulletAnmPath._buf[0] = '\0'; - bulletAnmPath._buf[1] = '\0'; - bulletAnmPath._buf[2] = '\0'; - bulletAnmPath._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(bulletAnmPath._buf)) + 0x0))) = msvc::_Allocate(0x30); - bulletAnmPath._size = 0x20; - bulletAnmPath._capacity = 0x2f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(bulletAnmPath._buf))) + 0x0))),"gfx/promo/gfuel/bullet tear.anm2",0x21); - local_14 = 0; - ANM2::Load(&this->_sprite,&bulletAnmPath,1); - local_14 = 0xffffffff; - if (0xf < bulletAnmPath._capacity) { - uVar1 = bulletAnmPath._capacity + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(bulletAnmPath._buf))) + 0x0))); - if (0xfff < uVar1) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(bulletAnmPath._buf)) + 0x0))) + -4)); - uVar1 = bulletAnmPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(bulletAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar1); - } - uVar1 = g_graphicsManager_flags; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x0)); - blendSrc = 1; - if ((uVar1 & 4) == 0) { - blendSrc = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = blendSrc; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - } - } - else if (this->_variant == 0x17) { - isGfuelSeed = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f); - if (isGfuelSeed != 0) { - missileAnmPath._size = 0; - missileAnmPath._capacity = 0xf; - missileAnmPath._buf[0] = '\0'; - missileAnmPath._buf[1] = '\0'; - missileAnmPath._buf[2] = '\0'; - missileAnmPath._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(missileAnmPath._buf)) + 0x0))) = msvc::_Allocate(0x20); - missileAnmPath._size = 0x1c; - missileAnmPath._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(missileAnmPath._buf))) + 0x0))),"gfx/promo/gfuel/missile.anm2",0x1d); - local_14 = 1; - ANM2::Load(&this->_sprite,&missileAnmPath,1); - local_14 = 0xffffffff; - if (0xf < missileAnmPath._capacity) { - uVar1 = missileAnmPath._capacity + 1; - freeBlock = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(missileAnmPath._buf))) + 0x0))); - if (0xfff < uVar1) { - freeBlock = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(missileAnmPath._buf)) + 0x0))) + -4)); - uVar1 = missileAnmPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(missileAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar1); - } - uVar1 = g_graphicsManager_flags; - missileAnmPath._size = 0; - missileAnmPath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(missileAnmPath._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(missileAnmPath._buf)) + 0x0))) & 0xffffff00; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - blendSrc = 1; - if ((uVar1 & 4) == 0) { - blendSrc = 6; - } - layer->_blendMode[1] = blendSrc; - layer->_blendMode[0] = 0; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST(0x1)); - layer->_bitflags = layer->_bitflags | 1; - } - } - } - this->_fScale = savedScale; - ResetSpriteScale(this); - this->_collisionDamage = savedCollisionDamage; - this->_entityGridCollisionClass = savedGridCollisionClass; - ExceptionList = local_1c; - return; -} - -// 0067a770 -int Entity_Tear::find_nearest_linkable_tear() -{ - int iVar1; - int tearsData; - uint64_t *allocCounter; - int iVar2; - int nearestTear; - uint32_t uVar3; - float fVar4; - float dx; - EntityList_EL local_2c; - float nearestDist; - int nearestTearSaved; - int selfTear; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - uint64_t oldAllocated; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af7a20; - local_10 = ExceptionList; - ExceptionList = &local_10; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&local_2c,2,-1,-1,0,0); - nearestTear = 0; - uVar3 = 0; - nearestDist = 40.0; - nearestTearSaved = 0; - if (local_2c._size != 0) { - tearsData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x4))); - iVar2 = selfTear; - do { - iVar1 = *GHIDRA_CAST((tearsData + uVar3 * 4)); - if (iVar1 != iVar2) { - if (((((*GHIDRA_CAST((iVar1 + 0x428)) & GHIDRA_UINT(g_tearFlagChain._l)) == 0 && - (*GHIDRA_CAST((iVar1 + 0x42c)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagChain._l)) + 0x4)))) == 0) && - ((*GHIDRA_CAST((iVar1 + 0x430)) & GHIDRA_UINT(g_tearFlagChain._h)) == 0 && - (*GHIDRA_CAST((iVar1 + 0x434)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagChain._h)) + 0x4)))) == 0)) || - ((*GHIDRA_CAST((iVar1 + 0x494)) != 0 && (*GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 0x494)) + 0x28)) == 2)))) || - (fVar4 = *GHIDRA_CAST((selfTear + 0x340)) - *GHIDRA_CAST((iVar1 + 0x340)), - dx = *GHIDRA_CAST((selfTear + 0x33c)) - *GHIDRA_CAST((iVar1 + 0x33c)), - fVar4 = sqrtf(fVar4 * fVar4 + dx * dx), nearestDist <= fVar4)) { - tearsData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x4))); - iVar2 = selfTear; - nearestTear = nearestTearSaved; - } - else { - tearsData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x4))); - iVar2 = selfTear; - nearestTear = iVar1; - nearestDist = fVar4; - nearestTearSaved = iVar1; - } - } - uVar3 = uVar3 + 1; - } while (uVar3 < GHIDRA_UINT(local_2c._size)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x4))) != 0) { - uVar3 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x4))) + -4)); - oldAllocated = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar3; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar3)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_2c)) + 0x4))) + -4))); - } - } - ExceptionList = local_10; - return nearestTear; -} - -// 0067a8f0 -Entity_Tear * Entity_Tear::find_link_partner() -{ - uint32_t uVar1; - bool bVar2; - bool bVar3; - uint64_t qVar4; - int tearData; - uint64_t *allocatedBytes; - Entity_Tear *chainTear; - Entity_Tear *partner; - bool isNotSelf; - float fVar5; - float dx; - EntityList_EL local_30; - float nearestDistance; - uint32_t i; - Entity_Tear *nearestTear; - Entity_Tear *self; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00af4e20; - local_10 = ExceptionList; - ExceptionList = &local_10; - self = this; - EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&local_30,2,-1,-1,0,0); - partner = GHIDRA_CAST(0x0); - nearestDistance = 20.0; - nearestTear = GHIDRA_CAST(0x0); - i = 0; - if (local_30._size != 0) { - tearData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))); - do { - chainTear = *GHIDRA_CAST((tearData + i * 4)); - if (chainTear != this) { - this = self; - if ((((GHIDRA_UINT((chainTear->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagChain._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(chainTear->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagChain._l)) + 0x4)))) == 0) && - ((GHIDRA_UINT((chainTear->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagChain._h)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(chainTear->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagChain._h)) + 0x4)))) == 0)) || - (chainTear->_linkNext != 0)) { - tearData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))); - } - else { - bVar3 = true; - do { - if (chainTear == GHIDRA_CAST(0x0)) goto LAB_0067aa2a; - if (((GHIDRA_UINT((chainTear->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagChain._l)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(chainTear->_tearFlags)._l) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagChain._l)) + 0x4)))) == 0) - && (bVar2 = bVar3, - (GHIDRA_UINT((chainTear->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagChain._h)) == 0 && - (*GHIDRA_CAST((GHIDRA_INT(&(chainTear->_tearFlags)._h) + 4)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagChain._h)) + 0x4)))) == 0) - ) break; - isNotSelf = chainTear != self; - chainTear = GHIDRA_CAST(chainTear->_linkPrev); - bVar2 = false; - if (isNotSelf) { - bVar2 = bVar3; - } - if ((chainTear == GHIDRA_CAST(0x0)) || (chainTear->_type != 2)) { - chainTear = GHIDRA_CAST(0x0); - } - bVar3 = bVar2; - } while (bVar2); - if (bVar2) { -LAB_0067aa2a: - partner = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))) + i * 4)); - fVar5 = (self->_pos).y - (partner->_pos).y; - dx = (self->_pos).x - (partner->_pos).x; - fVar5 = sqrtf(fVar5 * fVar5 + dx * dx); - if (fVar5 < nearestDistance) { - tearData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))); - nearestDistance = fVar5; - nearestTear = partner; - goto LAB_0067aa8b; - } - } - tearData = (*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))); - partner = nearestTear; - } - } -LAB_0067aa8b: - i = i + 1; - } while (i < GHIDRA_UINT(local_30._size)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))) != 0) { - uVar1 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))) + -4)); - qVar4 = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar1; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar4) < uVar1)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))) + -4))); - } - } - ExceptionList = local_10; - return partner; -} - -// 0067aaf0 -void Entity_Tear::apply_link_spring_forces() -{ - float dist; - float dirY; - float dirX; - float springX; - float springY; - int frameCount; - int linkedTear; - float speedMultiplier; - - frameCount = g_game->_frameCount; - if (0 < frameCount - this->_spawnFrame) { - linkedTear = this->_linkPrev; - springY = 0.0; - springX = 0.0; - if ((linkedTear != 0) && (0 < frameCount - *GHIDRA_CAST((linkedTear + 0x328)))) { - dirY = (this->_prevPosition).y - *GHIDRA_CAST((linkedTear + 0x390)); - dirX = (this->_prevPosition).x - *GHIDRA_CAST((linkedTear + 0x38c)); - dist = sqrtf(dirY * dirY + dirX * dirX); - if (0.0 < dist) { - dirX = dirX * (1.0 / dist); - dirY = dirY * (1.0 / dist); - } - speedMultiplier = this->_speedMultiplier; - springX = (0.0 - ((dist - 10.0) * dirX * 0.3) / speedMultiplier) - - (((this->_prevVelocity).x - *GHIDRA_CAST((linkedTear + 0x394))) * 0.3) / speedMultiplier - ; - springY = (0.0 - ((dist - 10.0) * dirY * 0.3) / speedMultiplier) - - (((this->_prevVelocity).y - *GHIDRA_CAST((linkedTear + 0x398))) * 0.3) / speedMultiplier - ; - } - linkedTear = this->_linkNext; - if ((linkedTear != 0) && (0 < frameCount - *GHIDRA_CAST((linkedTear + 0x328)))) { - dirY = (this->_prevPosition).y - *GHIDRA_CAST((linkedTear + 0x390)); - dirX = (this->_prevPosition).x - *GHIDRA_CAST((linkedTear + 0x38c)); - dist = sqrtf(dirY * dirY + dirX * dirX); - if (0.0 < dist) { - dirY = dirY * (1.0 / dist); - dirX = dirX * (1.0 / dist); - } - speedMultiplier = this->_speedMultiplier; - springX = (springX - ((dist - 10.0) * dirX * 0.3) / speedMultiplier) - - (((this->_prevVelocity).x - *GHIDRA_CAST((linkedTear + 0x394))) * 0.3) / speedMultiplier - ; - springY = (springY - ((dist - 10.0) * dirY * 0.3) / speedMultiplier) - - (((this->_prevVelocity).y - *GHIDRA_CAST((linkedTear + 0x398))) * 0.3) / speedMultiplier - ; - } - if ((springX != g_vectorZero.x) || (springY != g_vectorZero.y)) { - dist = this->_speedMultiplier; - (this->_velocity).x = springX * dist + (this->_velocity).x; - (this->_velocity).y = dist * springY + (this->_velocity).y; - } - this->_friction = this->_friction * 0.95; - } - return; -} - -// 0067d560 -uint8_t Entity_Tear::try_make_bridges(float *param_1) -{ - GridEntity *rock; - Room *this; - char cVar1; - uint32_t uVar2; - BitSet128 *maskedFlags; - int iVar3; - GridEntity *pit; - Entity *in_ECX; - void *collisionPoints; - int iVar4; - int iVar5; - uint32_t uVar6; - Entity *pEVar7; - float dirX; - float dirY; - EntityRef tearRef; - BitSet128 local_58; - BitSet128 local_48; - BitSet128 local_38; - int *local_28; - int *local_24; - int rockDamage; - void *local_1c; - Entity *local_18; - uint8_t isHitSolid; - char isRockDestroyed; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - float velX; - float velY; - code *virtualFn; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af7a8d; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - local_18 = in_ECX; - maskedFlags = BitSet128::operator_and - (&local_48,GHIDRA_CAST(&in_ECX[1]._pendingDamageFlags), - &g_tearFlagNoGridDamage); - if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || - (local_28 = GHIDRA_CAST((GHIDRA_UINT(maskedFlags->_h) | *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)))), - local_28 != GHIDRA_CAST(0x0))) { - ExceptionList = local_10; - return 0; - } - isHitSolid = 0; - isRockDestroyed = '\0'; - rockDamage = (10.0 < in_ECX->_collisionDamage) + 1; - local_24 = local_28; - local_28 = operator_new(0x14); - *local_28 = GHIDRA_INT(local_28); - local_28[1] = GHIDRA_INT(local_28); - local_28[2] = GHIDRA_INT(local_28); - *GHIDRA_CAST((local_28 + 3)) = 0x101; - local_8 = 0; - uVar6 = 0; - collisionPoints = (in_ECX->_collisionPoints)._begin; - if (GHIDRA_INT((in_ECX->_collisionPoints)._end) - GHIDRA_INT(collisionPoints) >> 3 != 0) { - do { - local_1c = g_game->_room; - iVar4 = GHIDRA_INT((((*param_1 + *GHIDRA_CAST((GHIDRA_CAST(collisionPoints) + uVar6 * 8))) - 40.0) / 40.0 + 0.5)) - ; - iVar3 = GHIDRA_INT((((*GHIDRA_CAST((GHIDRA_CAST(collisionPoints) + uVar6 * 8 + 4)) + param_1[1]) - 120.0) / 40.0 - + 0.5)); - if ((((-1 < iVar4) && (iVar4 < *GHIDRA_CAST((GHIDRA_CAST(local_1c) + 0xc)))) && (-1 < iVar3)) && - ((in_ECX = local_18, iVar3 < *GHIDRA_CAST((GHIDRA_CAST(local_1c) + 0x10)) && - (local_1c = (void *)(iVar3 * *GHIDRA_CAST((GHIDRA_CAST(local_1c) + 0xc)) + iVar4), -1 < GHIDRA_INT(local_1c)))) - ) { - msvc::set::insert(&local_38._h,&local_1c); - } - uVar6 = uVar6 + 1; - collisionPoints = (in_ECX->_collisionPoints)._begin; - } while (uVar6 < GHIDRA_UINT((GHIDRA_INT((in_ECX->_collisionPoints)._end) - GHIDRA_INT(collisionPoints) >> 3))); - } - param_1 = GHIDRA_CAST(*local_28); - if (param_1 != GHIDRA_CAST(local_28)) { - pEVar7 = local_18; - do { - if (((GHIDRA_UINT(param_1[4]) < 0x1c0) && - (rock = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + GHIDRA_INT(param_1[4]) * 4 + 0x24)), - rock != GHIDRA_CAST(0x0))) && - ((rock->_collisionClass != 1 && - ((rock->_collisionClass != 0 && (isHitSolid = 1, isRockDestroyed == '\0')))))) { - cVar1 = rock->CanTakeDamageFromTearEffects(uVar2); - if ((cVar1 != '\0') && - (((maskedFlags = BitSet128::operator_and - (&local_38,GHIDRA_CAST(&pEVar7[1]._pendingDamageFlags), - &g_tearFlagAcid), - GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0 || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) || - (((maskedFlags = BitSet128::operator_and - (&local_58,GHIDRA_CAST(&pEVar7[1]._pendingDamageFlags), - &g_tearFlagRock), - GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0 || - (GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) && - (uVar6 = Random(), - (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283064e-10 < pEVar7->_collisionDamage * 0.1)))))) { - virtualFn = *(code **)(*GHIDRA_CAST(rock) + 0x14); - (GHIDRA_CAST((&tearRef)))->EntityRef::constructor(local_18); - cVar1 = (*virtualFn)(0,&tearRef); - if (cVar1 != '\0') { - isRockDestroyed = '\x01'; - velX = (local_18->_velocity).x; - velY = (local_18->_velocity).y; - if (ABS(velX) <= ABS(velY)) { - dirX = 0.0; - if (0.0 <= velY) { - dirY = 1.0; - } - else { - dirY = (float)&DAT_bf800000; - } - } - else { - dirY = 0.0; - if (0.0 <= velX) { - dirX = 1.0; - } - else { - dirX = (float)&DAT_bf800000; - } - } - if ((dirX != g_vectorZero.x) || (dirY != g_vectorZero.y)) { - this = g_game->_room; - iVar3 = this->_gridWidth; - iVar5 = GHIDRA_INT(((((float)(rock->_gridIndex % iVar3) * 40.0 + 40.0 + dirX * 40.0) - 40.0) - / 40.0 + 0.5)); - iVar4 = GHIDRA_INT(((((float)(rock->_gridIndex / iVar3) * 40.0 + 120.0 + dirY * 40.0) - - 120.0) / 40.0 + 0.5)); - if (((-1 < iVar5) && - (((iVar5 < iVar3 && (-1 < iVar4)) && (iVar4 < this->_gridHeight)))) && - (iVar5 = iVar3 * iVar4 + iVar5, -1 < iVar5)) { - if (iVar5 < 0x1c0) { - pit = this->_gridEntities[iVar5]; - } - else { - pit = GHIDRA_CAST(0x0); - } - this->Room::TryMakeBridge(pit,rock); - } - } - } - pEVar7 = local_18; - } - if (isRockDestroyed == '\0') { - virtualFn = *(code **)(*GHIDRA_CAST(rock) + 0x10); - (GHIDRA_CAST((&tearRef)))->EntityRef::constructor(local_18); - (*virtualFn)(rockDamage,&tearRef); - pEVar7 = local_18; - } - } - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)¶m_1); - } while (param_1 != GHIDRA_CAST(local_28)); - } - FID_conflict__Erase_tree_>_> - (&local_28,(fuzzer_allocator_> *)&local_28, - (_Tree_node *)local_28[1]); - operator_delete(local_28,0x14); - ExceptionList = local_10; - return isHitSolid; -} - -// 006b5320 -void Entity_Tear::reroll_hit_entity(int unused) -{ - code *pcVar1; - Game *pGVar2; - int64_t lVar3; - int64_t lVar4; - char isBanned; - uint8_t isErased; - Vector *foundPos; - Entity *tmpEntity; - uint32_t uVar5; - uint32_t uVar6; - int *piVar7; - int unusedArg; - void *pvVar8; - uint32_t uVar9; - int iVar10; - PlayerManager *playerManager; - bool bVar11; - float dy; - float dx; - uint64_t timeNs; - uint8_t auStack_c4 [4]; - uint32_t spawnSubType; - uint32_t local_bc; - int *local_b8; - Vector newPos; - int *local_ac; - Entity *local_a8; - Game *local_a4; - uint32_t local_a0; - uint32_t spawnType; - uint32_t spawnVariant; - uint32_t spawnSeed; - int local_90 [3]; - Entity_Tear *hitEntity; - int procKeyType; - int procKeyVariant; - Vector freeTilePos [2]; - uint64_t rngShifts; - uint32_t local_60; - uint8_t local_5c [8]; - int local_54; - Vector randomPos; - ColorMod poofColor; - RNG cardRng; - uint32_t local_c; - uint32_t *spawnerPtr; - ColorMod *spriteColor; - - local_c = __security_cookie ^ GHIDRA_UINT(auStack_c4); - iVar10 = 0x20; - hitEntity = this; - do { - newPos.x = g_vectorZero.x; - newPos.y = g_vectorZero.y; - foundPos = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&randomPos,0.0); - newPos.x = foundPos->x; - newPos.y = foundPos->y; - foundPos = (GHIDRA_CAST((g_game->_room)))->Room::FindFreeTilePosition(freeTilePos,&newPos,0.0); - newPos.x = foundPos->x; - newPos.y = foundPos->y; - dx = newPos.x - (this->_pos).x; - dy = newPos.y - (this->_pos).y; - if ((400.0 < dy * dy + dx * dx) && - (tmpEntity = Game::GetNearestTargetPlayer(&newPos,GHIDRA_CAST(this),0,0,(void *)0x0,5000.0), - dx = (tmpEntity->_pos).x - newPos.x, dy = (tmpEntity->_pos).y - newPos.y, - 6400.0 < dy * dy + dx * dx)) break; - iVar10 = iVar10 + -1; - newPos.x = g_vectorZero.x; - newPos.y = g_vectorZero.y; - } while (-1 < iVar10); - if ((newPos.x == g_vectorZero.x) && (newPos.y == g_vectorZero.y)) { - return; - } - uVar5 = Random(); - poofColor._colorize[0] = 0.0; - poofColor._colorize[1] = 0.0; - poofColor._colorize[2] = 0.0; - poofColor._colorize[3] = 0.0; - poofColor._tint[0] = 1.0; - poofColor._tint[1] = 1.0; - poofColor._tint[2] = 1.0; - poofColor._tint[3] = 1.0; - poofColor._offset[0] = 0.2509804; - poofColor._offset[1] = 0.34901962; - poofColor._offset[2] = 0.5019608; - tmpEntity = Game::SpawnEx(g_game,1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5,0); - spriteColor = &(tmpEntity->_sprite)._color; - if (spriteColor != &poofColor) { - spriteColor->_tint[0] = 1.0; - (tmpEntity->_sprite)._color._tint[1] = 1.0; - (tmpEntity->_sprite)._color._tint[2] = 1.0; - (tmpEntity->_sprite)._color._tint[3] = 1.0; - (tmpEntity->_sprite)._color._colorize[0] = 0.0; - (tmpEntity->_sprite)._color._colorize[1] = 0.0; - (tmpEntity->_sprite)._color._colorize[2] = 0.0; - (tmpEntity->_sprite)._color._colorize[3] = 0.0; - *GHIDRA_CAST((tmpEntity->_sprite)._color._offset) = - CONCAT44(poofColor._offset[1],poofColor._offset[0]); - (tmpEntity->_sprite)._color._offset[2] = poofColor._offset[2]; - } - spawnSeed = Random(); - local_a4 = g_game; - spawnSubType = 0; - spawnVariant = 0xf; - spawnType = 1000; - lua_callback_run_pre_entity_spawn - (GHIDRA_CAST(&spawnType),GHIDRA_CAST(&spawnVariant),&newPos,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_CAST(&spawnSubType),&spawnSeed); - uVar5 = spawnVariant; - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { -LAB_006b57d9: - local_bc = spawnSubType; - } - else { - piVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_deathmatchManager))) + 0xc)))); - local_b8 = piVar7; - uVar6 = Random(); - uVar9 = spawnSubType; - rngShifts = 0x900000005; - local_a8 = GHIDRA_CAST(0x7); - local_60 = 7; - if (spawnType != 5) goto LAB_006b57d9; - if (uVar5 < 0x12d) { - if (uVar5 == 300) { - while ((local_bc = spawnSubType, spawnSubType == 0 || - (isBanned = (**(code **)(*piVar7 + 0x24))(spawnSubType), isBanned != '\0'))) { - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)rngShifts & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)local_a8 & 0x1f) ^ uVar6; - iVar10 = ItemPool::GetCardEx(uVar6,0x19,10,10,1); - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._shift3 = 7; - cardRng._seed = uVar6; - spawnSubType = lua_callback_run_get_card(&cardRng,iVar10,1,1,0); - } - } - else { - if (uVar5 == 0x46) { - local_a0 = spawnSubType >> 0xb; - do { - local_bc = spawnSubType; - if (spawnSubType != 0) { - pcVar1 = *(code **)(*piVar7 + 0x28); - iVar10 = ItemPool::GetPillEffect(&g_game->_itemPool,spawnSubType,GHIDRA_CAST(0x0)) - ; - isBanned = (*pcVar1)(iVar10); - if (isBanned == '\0') goto LAB_006b57e1; - piVar7 = local_b8; - } - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)rngShifts & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)local_a8 & 0x1f) ^ uVar6; - spawnSubType = ItemPool::GetPill(uVar6); - spawnSubType = spawnSubType | (local_a0 & 1) << 0xb; - } while( true ); - } - if (uVar5 != 100) goto LAB_006b57d9; - local_bc = spawnSubType; - if (spawnSubType == 0x19) { -LAB_006b5635: - bVar11 = false; - } - else { - local_a0 = spawnSubType; - msvc::set::find_node(local_5c,&local_a0); - if (((*GHIDRA_CAST((local_54 + 0xd)) == '\0') && (*GHIDRA_CAST((local_54 + 0x10)) <= GHIDRA_INT(uVar9))) && - (local_54 != piVar7[8])) goto LAB_006b5635; - bVar11 = true; - } - if ((uVar9 == 0) || (bVar11)) { - spawnSubType = (**(code **)(*piVar7 + 0x84))(0); - local_bc = spawnSubType; - } - } - } - else { - if (uVar5 != 0x15e) goto LAB_006b57d9; - while ((local_bc = spawnSubType, spawnSubType == 0 || - (isBanned = (**(code **)(*piVar7 + 0x2c))(spawnSubType), isBanned != '\0'))) { - spawnSubType = ItemPool::GetTrinket(&g_game->_itemPool,0); - } - } - } -LAB_006b57e1: - local_a8 = (GHIDRA_CAST((local_a4->_entityFactory)))->EntityFactory::Create(spawnType,0); - if (local_a8 == GHIDRA_CAST(0x0)) goto LAB_006b5ab6; - timeNs = GetTimeNs(); - tmpEntity = local_a8; - uVar5 = GHIDRA_UINT((timeNs >> 0x20)); - lVar3 = (timeNs & 0xffffffff) * 0x431bde82; - local_ac = GHIDRA_CAST(((uint64_t)lVar3 >> 0x20)); - lVar4 = (uint64_t)uVar5 * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - local_90[0] = GHIDRA_INT((lVar4 + lVar3)); - lVar3 = (uint64_t)uVar5 * 0x431bde82 + - (uint64_t) - CONCAT14(CARRY4(GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)), - GHIDRA_INT(local_ac) + GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar3),GHIDRA_UINT(lVar4)))), - GHIDRA_INT(((uint64_t)(lVar4 + lVar3) >> 0x20))); - local_90[2] = GHIDRA_INT(((uint64_t)lVar3 >> 0x20)); - spawnerPtr = &local_a8->_spawnerEntity; - local_b8 = GHIDRA_CAST((GHIDRA_UINT(lVar3) >> 0x12 | local_90[2] * 0x4000)); - local_90[2] = GHIDRA_UINT(local_90[2]) >> 0x12; - local_a8->_spawnerType = 0; - local_a8->_spawnerVariant = 0; - if (*spawnerPtr != 0) { - local_ac = spawnerPtr; - msvc::multiset::erase(&local_ac); - } - iVar10 = *GHIDRA_CAST(tmpEntity); - *spawnerPtr = 0; - (tmpEntity->_pos).x = newPos.x; - (tmpEntity->_pos).y = newPos.y; - (tmpEntity->_velocity).x = g_vectorZero.x; - (tmpEntity->_velocity).y = g_vectorZero.y; - (**(code **)(iVar10 + 4))(spawnType,spawnVariant,local_bc,spawnSeed); - pGVar2 = local_a4; - pvVar8 = local_a4->_room; - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x1214)); - *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x1214)) = iVar10 + 1; - tmpEntity->_index = iVar10; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar8) + 0x1218)))))->EntityList::AddEntity(tmpEntity); - isErased = Game::ShouldEraseEnemy(tmpEntity); - if (isErased != 0) { - Entity::RemoveWithPoof(tmpEntity,unusedArg); - } - if ((tmpEntity->_exists != 0) && - ((pGVar2->_proceduralItemManager)._proceduralItems._begin != - (pGVar2->_proceduralItemManager)._proceduralItems._end)) { - procKeyVariant = tmpEntity->_variant; - procKeyType = tmpEntity->_type; - msvc::map::find(&local_a4,&procKeyType); - pGVar2 = (pGVar2->_proceduralItemManager)._spawnTriggerTargets._head; - if (local_a4 == pGVar2) { - local_90[0] = tmpEntity->_type; - local_90[1] = 0xffffffff; - piVar7 = GHIDRA_CAST(std)::map::find(&local_bc,local_90); - local_a4 = GHIDRA_CAST(*piVar7); - if (local_a4 == pGVar2) goto LAB_006b5a32; - } - uVar5 = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - pvVar8 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar8) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar8 = (playerManager->_playerList)._end; - } - piVar7 = (playerManager->_playerList)._begin; - if (uVar5 < GHIDRA_UINT((GHIDRA_INT(pvVar8) - GHIDRA_INT(piVar7) >> 2))) { - piVar7 = piVar7 + uVar5; - } - trigger_set_dispatch((void *)(*piVar7 + 0x1fc8),6,tmpEntity,&newPos,&g_vectorZero); - uVar5 = uVar5 + 1; - playerManager = &g_game->_playerManager; - } while (uVar5 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } -LAB_006b5a32: - timeNs = GetTimeNs(); - uVar9 = GHIDRA_UINT((timeNs >> 0x20)); - lVar3 = (timeNs & 0xffffffff) * 0x431bde82; - lVar4 = (uint64_t)uVar9 * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); - uVar6 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20)); - uVar5 = GHIDRA_INT(((uint64_t)lVar3 >> 0x20)) + GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar3),GHIDRA_UINT(lVar4))); - lVar3 = (uint64_t)uVar9 * 0x431bde82 + (uint64_t)CONCAT14(CARRY4(uVar6,uVar5),uVar6 + uVar5); - uVar6 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20)); - uVar5 = GHIDRA_UINT(lVar3) >> 0x12 | uVar6 * 0x4000; - uVar9 = uVar5 - GHIDRA_INT(local_b8); - bVar11 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar9); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar9; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = - (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + (((uVar6 >> 0x12) - local_90[2]) - GHIDRA_UINT((uVar5 < local_b8))) + - GHIDRA_UINT(bVar11); -LAB_006b5ab6: - spriteColor = &(local_a8->_sprite)._color; - if (spriteColor != &poofColor) { - (local_a8->_sprite)._color._colorize[0] = 0.0; - (local_a8->_sprite)._color._colorize[1] = 0.0; - (local_a8->_sprite)._color._colorize[2] = 0.0; - (local_a8->_sprite)._color._colorize[3] = 0.0; - (local_a8->_sprite)._color._offset[0] = 0.2509804; - (local_a8->_sprite)._color._offset[1] = 0.34901962; - spriteColor->_tint[0] = 1.0; - (local_a8->_sprite)._color._tint[1] = 1.0; - (local_a8->_sprite)._color._tint[2] = 1.0; - (local_a8->_sprite)._color._tint[3] = 1.0; - (local_a8->_sprite)._color._offset[2] = 0.5019608; - } - (hitEntity->_pos).x = newPos.x; - (hitEntity->_pos).y = newPos.y; - return; -} - -// 0085dd60 -long double Entity_Tear::BaseDamage() -{ - return (long double)this->_baseDamage; -} - -// 0085dd70 -void Entity_Tear::SetParentOffset(Vector *offset) -{ - (this->_parentOffset).x = offset->x; - (this->_parentOffset).y = offset->y; - return; -} - -// 0085dd90 -Vector * Entity_Tear::PosDisplacement() -{ - return &this->_posDisplacement; -} diff --git a/generated-src/entity_text.cpp b/generated-src/entity_text.cpp deleted file mode 100644 index 2589479..0000000 --- a/generated-src/entity_text.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include "classes.h" - -// 005ccd80 -void Entity_Text::Update() -{ - int iVar1; - uint32_t timer; - uint32_t uVar2; - float fVar3; - float velY; - Game *game; - - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)); - if (iVar1 == 0) { - fVar3 = 1.0 - (float)*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)) / (float)*GHIDRA_CAST((GHIDRA_CAST(this) + 0x414)); - fVar3 = fVar3 * fVar3; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x524)) = fVar3; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x34c)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x350)) = (1.0 - fVar3) * -50.0; - } - else if (iVar1 == 1) { - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)); - if (iVar1 == 0) { - sprintf_s(GHIDRA_CAST((GHIDRA_INT(this) + 0x418)),0x100,&DAT_00b62fe0); - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)); - } - game = g_game; - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x414)) - iVar1; - if (10 < iVar1) { - iVar1 = 10; - } - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x524)) = (float)iVar1 / 10.0; - fVar3 = sin((float)(game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x328))) * 0.2); - if ((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x20)) & 1) == 0) { - fVar3 = fVar3 * 15.0; - } - else { - fVar3 = fVar3 * -15.0; - } - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x34c)) = fVar3; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x350)) = 0; - } - else if (iVar1 == 2) { - timer = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)); - if (timer == 0) { - sprintf_s(GHIDRA_CAST((GHIDRA_INT(this) + 0x418)),0x100,s__d); - timer = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)); - } - uVar2 = 0x3f800000; - if ((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x414)) + -0xf <= GHIDRA_INT(timer)) && ((timer & 1) != 0)) { - uVar2 = 0; - } - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x518)) = 0x3f800000; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x51c)) = 0x3f800000; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x520)) = 0x3f800000; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x524)) = uVar2; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x528)) = 0; - } - fVar3 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x36c)) * *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)); - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)) = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)) + 1; - velY = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x36c)) * *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)); - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x36c)) = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x368)); - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)) = fVar3; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) = velY; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x33c)) = fVar3 + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x33c)); - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340)) = velY + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340)); - if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x414)) < *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410))) { - this->Remove(); - } - return; -} - -// 005ccfc0 -void Entity_Text::Render(Vector *offset) -{ - void *font = this; - uint8_t *str; - Vector pos; - Vector scale; - uint8_t isPaused; - uint32_t flickerPhase; - Font *font; - float fVar1; - double dVar2; - uint32_t fontSettings; - uint32_t local_3c; - uint32_t local_38; - uint32_t local_34; - uint32_t local_30; - uint32_t local_2c; - uint32_t local_28; - float screenY; - float worldY; - int textWidth; - float pixelScale; - float screenX; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af5fe5; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (*GHIDRA_CAST((GHIDRA_CAST(font) + 0x172)) != '\0') { - str = GHIDRA_CAST((GHIDRA_INT(font) + 0x418)); - font = &g_manager->_font6_PFTempestaSevenCondensed; - textWidth = Font::get_string_width_n(font,str,-1); - worldY = *GHIDRA_CAST((GHIDRA_CAST(font) + 0x340)) + *GHIDRA_CAST((GHIDRA_CAST(font) + 0x350)); - screenY = (g_screenHeight - 182.0) * 0.5; - pixelScale = g_displayPixelRatio * g_screenPointScale; - screenX = (((*GHIDRA_CAST((GHIDRA_CAST(font) + 0x34c)) + *GHIDRA_CAST((GHIDRA_CAST(font) + 0x33c))) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5; - dVar2 = floor((double)screenX); - screenX = (float)dVar2 / pixelScale; - screenY = ((worldY - 140.0) * 0.65 + screenY) * pixelScale + 0.5; - dVar2 = floor((double)screenY); - screenY = (float)dVar2; - screenX = screenX + offset->x; - fVar1 = offset->y; - *GHIDRA_CAST((GHIDRA_CAST(font) + 0x1a4)) = screenX; - *GHIDRA_CAST((GHIDRA_CAST(font) + 0x1a8)) = screenY / pixelScale + fVar1; - if (*GHIDRA_CAST((GHIDRA_CAST(font) + 0x2c)) == 2) { - isPaused = Game::IsPaused(g_game); - if (isPaused == 0) { - flickerPhase = g_manager->_framecount + 1U & 0x80000001; - if (GHIDRA_INT(flickerPhase) < 0) { - flickerPhase = (flickerPhase - 1 | 0xfffffffe) + 1; - } - } - else { - flickerPhase = 0; - } - fontSettings = 0; - local_3c = 0xffff; - local_38 = 0; - local_34 = 0x3f800000; - local_30 = 0xffffffff; - local_2c = 0; - local_28 = 0; - fVar1 = ((float)GHIDRA_INT((flickerPhase + *GHIDRA_CAST((GHIDRA_CAST(font) + 0x410)) * 2)) * 0.5 - 0.0) * 0.25; - if (fVar1 <= 0.0) { - fVar1 = 0.0; - } - if (1.0 <= fVar1) { - fVar1 = 1.0; - } - fVar1 = 4.0 - fVar1 * 2.5; - local_8 = 0; - pos.y = *GHIDRA_CAST((GHIDRA_CAST(font) + 0x1a8)) - fVar1 * 4.0; - pos.x = screenX - (float)textWidth * 0.5 * fVar1; - scale.y = fVar1; - scale.x = fVar1; - Font::DrawString(font,str,pos,scale,GHIDRA_CAST((GHIDRA_INT(font) + 0x518)), - GHIDRA_CAST(&fontSettings)); - ExceptionList = local_10; - return; - } - fontSettings = 0; - local_3c = 0xffff; - local_38 = 0; - local_34 = 0x3f800000; - local_30 = 0xffffffff; - local_2c = 0; - local_28 = 0; - local_8 = 1; - Font::DrawString(font,str,GHIDRA_CAST((GHIDRA_INT(font) + 0x518)),&fontSettings, - screenX - (float)textWidth * 0.5,*GHIDRA_CAST((GHIDRA_CAST(font) + 0x1a8))); - } - ExceptionList = local_10; - return; -} - -// 005cd2e0 -void Entity_Text::Interpolate() -{ - float wobble; - - if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)) == 1) { - wobble = sin(((float)(g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x328))) + 0.5) * 0.2); - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x350)) = 0; - if ((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x20)) & 1) == 0) { - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x34c)) = wobble * 15.0; - this->Entity::Interpolate(); - return; - } - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x34c)) = wobble * -15.0; - } - this->Entity::Interpolate(); - return; -} diff --git a/generated-src/grid_entity.cpp b/generated-src/grid_entity.cpp index 739febd..ae583f4 100644 --- a/generated-src/grid_entity.cpp +++ b/generated-src/grid_entity.cpp @@ -256,7 +256,7 @@ void GridEntity::trigger_output(GridEntity *gridEntity) } else if (iVar1 == 2) { if ((gridEntity->_varData != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0xc)))) == 1)) { - source = (GHIDRA_CAST((&destroySource)))->EntityRef::EntityRef(); + source = EntityRef::EntityRef(&destroySource); gridEntity->Destroy(1,source); return; } diff --git a/generated-src/grid_entity_decoration.cpp b/generated-src/grid_entity_decoration.cpp index fd2d02d..97a39e7 100644 --- a/generated-src/grid_entity_decoration.cpp +++ b/generated-src/grid_entity_decoration.cpp @@ -79,9 +79,9 @@ void GridEntity_Decoration::Update() (GHIDRA_CAST((sprite)))->Sprite::GetTexel(&texelR,sampleX,sampleY,decoRenderX,decoRenderY,0x3c23d70a, 0xffffffff); if (0.0 < texelA) { - (GHIDRA_CAST((player)))->Entity_Player::is_footstep_triggered(-1); + Entity_Player::is_footstep_triggered(player,-1); if (player->_canFly == 0) { - isSecondFoot = (GHIDRA_CAST((player)))->Entity_Player::is_footstep_triggered(0); + isSecondFoot = Entity_Player::is_footstep_triggered(player,0); if (isSecondFoot == 0) { (player->_footprintColor1)._offset[0] = texelR; (player->_footprintColor1)._offset[1] = texelG; diff --git a/generated-src/grid_entity_door.cpp b/generated-src/grid_entity_door.cpp index acfe381..18e4b44 100644 --- a/generated-src/grid_entity_door.cpp +++ b/generated-src/grid_entity_door.cpp @@ -325,7 +325,7 @@ LAB_0070c9b8: local_88._colorize[3] = g_vectorZero.y; local_88._offset[0] = 0.0; local_88._offset[1] = 0.0; - player->TakeDamage(0x3f800000,0x10010000,0,&local_88); + (**(code **)(*GHIDRA_CAST(player) + 0x20))(0x3f800000,0x10010000,0,&local_88); } } } @@ -2036,7 +2036,7 @@ LAB_0070f79f: (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) == 5)) && (padlockOwner = PlayerManager::FirstTrinketOwner(&game->_playerManager,0x88), padlockOwner != GHIDRA_CAST(0x0))) { - doorVariant = (GHIDRA_CAST((padlockOwner)))->Entity_Player::GetTrinketMultiplier(0x88); + doorVariant = Entity_Player::GetTrinketMultiplier(padlockOwner,0x88); if (doorVariant == 2) { if ((this->_doorFlags & 9) != 0) { return 1; @@ -2185,11 +2185,11 @@ uint8_t GridEntity_Door::TryBlowOpen(uint8_t isFromExplosion, Entity *source) if (source == GHIDRA_CAST(0x0)) { return 1; } - player = GHIDRA_CAST((GHIDRA_CAST((source)))->Entity)::GetPlayerAncestor(); + player = GHIDRA_CAST(Entity)::GetPlayerAncestor(source); if (player == GHIDRA_CAST(0x0)) { return 1; } - (GHIDRA_CAST((player)))->Entity_Player::DonateLuck(-7); + Entity_Player::DonateLuck(player,-7); return 1; } iVar5 = get_secret_exit_kind(this); @@ -2284,7 +2284,7 @@ LAB_0070ffae: (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) == 5)) && (player = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0x88), player != GHIDRA_CAST(0x0))) { - iVar5 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x88); + iVar5 = Entity_Player::GetTrinketMultiplier(player,0x88); if (iVar5 == 2) { if ((this->_doorFlags & 9) != 0) goto LAB_00710063; iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))); @@ -2439,7 +2439,7 @@ uint8_t GridEntity_Door::TryUnlock(Entity_Player *player, uint8_t isForce) return 0; } if (local_64 != 0.0) { - (GHIDRA_CAST((trinketHolder)))->Entity_Player::TryRemoveTrinket(GHIDRA_UINT(local_64)); + Entity_Player::TryRemoveTrinket(trinketHolder,GHIDRA_UINT(local_64)); } manager = g_manager; local_60 = 8; @@ -2489,12 +2489,12 @@ LAB_007106c5: return 0; } } - iVar2 = (GHIDRA_CAST((player)))->Entity_Player::GetHealthType(); - if ((iVar2 != 2) && (bVar1 = (GHIDRA_CAST((trinketHolder)))->Entity_Player::HasInstantDeathCurse(), bVar1 == 0)) { + iVar2 = Entity_Player::GetHealthType(player); + if ((iVar2 != 2) && (bVar1 = Entity_Player::HasInstantDeathCurse(trinketHolder), bVar1 == 0)) { in_stack_ffffff80 = 0x7106fd; bVar1 = Seeds::HasSeedEffect(&g_game->_seedEffects,0x49); if (bVar1 == 0) { - (GHIDRA_CAST((GHIDRA_CAST(&local_34))))->EntityRef::EntityRef(); + EntityRef::EntityRef(GHIDRA_CAST(&local_34)); takeDamage = *(code **)(*GHIDRA_CAST(player) + 0x20); local_34._tint[0] = 0.0; local_34._tint[1] = 1.40172e-41; @@ -2539,13 +2539,13 @@ LAB_007106c5: VStack_3c.y = particleVelocity.y * 0.2; particle = Game::SpawnEx(g_game,1000,5,&particlePos,&VStack_3c,GHIDRA_CAST(0x0),0, in_stack_ffffff80,0); - particle->Update(); + (**(code **)(*GHIDRA_CAST(particle) + 0xc))(); local_60 = uVar5; } else { particle = Game::SpawnEx(g_game,1000,5,&particlePos,&particleVelocity,GHIDRA_CAST(0x0), 99,in_stack_ffffff80,0); - particle->Update(); + (**(code **)(*GHIDRA_CAST(particle) + 0xc))(); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(particle[1])) + 0x4)))) = 0xc1000000; } local_60 = local_60 + 1; @@ -2577,7 +2577,7 @@ LAB_007109b9: bVar7 = false; if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) == 1) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) == 2)) { in_stack_ffffff80 = 0x96; - bVar1 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x96,0); + bVar1 = Entity_Player::HasTrinket(player,0x96,0); if (bVar1 != 0) { isForce = 1; bVar7 = true; @@ -2585,7 +2585,7 @@ LAB_007109b9: } if (g_game->_stage == 9) { in_stack_ffffff80 = 0x71051b; - iVar2 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0xaf); + iVar2 = Entity_Player::GetTrinketMultiplier(player,0xaf); if (iVar2 < 2) goto LAB_00710a08; isForce = 1; } @@ -2612,7 +2612,7 @@ LAB_00710a08: if ((this->_doorFlags & 1) == 0) { if (this->_targetRoomType == 2) { in_stack_ffffff80 = 0x53; - bVar1 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x53,0); + bVar1 = Entity_Player::HasTrinket(player,0x53,0); if (bVar1 != 0) goto LAB_00710af5; } } @@ -2623,10 +2623,10 @@ LAB_00710a08: } if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) == 1) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) == 2)) { in_stack_ffffff80 = 0x710ade; - iVar2 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x13); + iVar2 = Entity_Player::GetTrinketMultiplier(player,0x13); if (2 < iVar2) goto LAB_00710af5; } - bVar1 = (GHIDRA_CAST((player)))->Entity_Player::TryUseKey(); + bVar1 = Entity_Player::TryUseKey(player); if (bVar1 == 0) { return 0; } @@ -2639,7 +2639,7 @@ LAB_00710af5: } else if (isForce == 0) { in_stack_ffffff80 = 0x710b0b; - (GHIDRA_CAST((player)))->Entity_Player::AddCoins(-1); + Entity_Player::AddCoins(player,-1); goto LAB_00710b1b; } this->_isUnlockedByPlayer = 1; diff --git a/generated-src/grid_entity_fire.cpp b/generated-src/grid_entity_fire.cpp index 5e84b93..2701844 100644 --- a/generated-src/grid_entity_fire.cpp +++ b/generated-src/grid_entity_fire.cpp @@ -462,7 +462,7 @@ LAB_0067e2c6: local_38.y = dirToPlayer->y * 25.0 + local_38.y; fVar8 = sqrtf(fVar8 * fVar8 + deltaX * deltaX); if (((fVar8 < 160.0) && - (bVar1 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&local_38,&local_30,3,0,0,0,GHIDRA_CAST(0x0)), + (bVar1 = Room::CheckLine(g_game->_room,&local_38,&local_30,3,0,0,0,GHIDRA_CAST(0x0)), bVar1 != 0)) && (uVar2 = Random(), uVar2 % 0xf == 0)) { uVar2 = Random(); dirToPlayer = (GHIDRA_CAST((&local_40)))->Vector::Normalized(&normalized); diff --git a/generated-src/grid_entity_lock.cpp b/generated-src/grid_entity_lock.cpp index fb3dca2..9477420 100644 --- a/generated-src/grid_entity_lock.cpp +++ b/generated-src/grid_entity_lock.cpp @@ -160,9 +160,9 @@ void GridEntity_Lock::try_unlock(Entity_Player *player, uint8_t isForce) if (isForce == 0) { soundId[0] = this; if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x154))) == '\0') { - paperClipMultiplier = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x13); + paperClipMultiplier = Entity_Player::GetTrinketMultiplier(player,0x13); if ((paperClipMultiplier < 2) && - (isKeyUsed = (GHIDRA_CAST((player)))->Entity_Player::TryUseKey(), isKeyUsed == 0)) { + (isKeyUsed = Entity_Player::TryUseKey(player), isKeyUsed == 0)) { return; } } @@ -170,7 +170,7 @@ void GridEntity_Lock::try_unlock(Entity_Player *player, uint8_t isForce) if (player->_numCoins < 1) { return; } - (GHIDRA_CAST((player)))->Entity_Player::AddCoins(-1); + Entity_Player::AddCoins(player,-1); } } manager = g_manager; @@ -248,7 +248,7 @@ void GridEntity_Lock::break_open(Entity_Player *player) do { player = GHIDRA_CAST(*playerIt); if ((player->_variant == 0) && - (bVar1 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x16,0), bVar1 != 0)) goto LAB_00711d1a; + (bVar1 = Entity_Player::HasTrinket(player,0x16,0), bVar1 != 0)) goto LAB_00711d1a; playerIt = playerIt + 1; } while (playerIt != (game->_playerManager)._playerList._end); } diff --git a/generated-src/grid_entity_pit.cpp b/generated-src/grid_entity_pit.cpp index 30fb0a5..7b644dd 100644 --- a/generated-src/grid_entity_pit.cpp +++ b/generated-src/grid_entity_pit.cpp @@ -275,7 +275,7 @@ LAB_00712ec3: iVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar13) + 0x1214)); *GHIDRA_CAST((GHIDRA_CAST(pvVar13) + 0x1214)) = iVar11 + 1; pEVar5->_index = iVar11; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar13) + 0x1218)))))->EntityList::AddEntity(pEVar5); + EntityList::AddEntity(GHIDRA_CAST((GHIDRA_INT(pvVar13) + 0x1218)),pEVar5); bVar6 = Game::ShouldEraseEnemy(pEVar5); if (bVar6 != 0) { Entity::RemoveWithPoof(pEVar5,unusedArg_00); @@ -523,7 +523,7 @@ LAB_00712860: iVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar13) + 0x1214)); *GHIDRA_CAST((GHIDRA_CAST(pvVar13) + 0x1214)) = iVar11 + 1; pEVar5->_index = iVar11; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar13) + 0x1218)))))->EntityList::AddEntity(pEVar5); + EntityList::AddEntity(GHIDRA_CAST((GHIDRA_INT(pvVar13) + 0x1218)),pEVar5); bVar6 = Game::ShouldEraseEnemy(pEVar5); if (bVar6 != 0) { Entity::RemoveWithPoof(pEVar5,unusedArg); @@ -1214,9 +1214,9 @@ void GridEntity_Pit::guard_check_icall() iVar2 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); (player->_pos).x = (float)(iVar4 % iVar2) * 40.0 + 40.0; (player->_pos).y = (float)(iVar4 / iVar2) * 40.0 + 120.0; - isMegaMush = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271); + isMegaMush = TemporaryEffects::HasCollectibleEffect(&player->_temporaryeffects,0x271); if (isMegaMush == 0) { - (GHIDRA_CAST((player)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("FallIn")); + Entity_Player::PlayExtraAnimation(player,GHIDRA_CAST("FallIn")); game = g_game; player->_isControlsEnabled = 0; player->_entityCollisionClass = 0; diff --git a/generated-src/grid_entity_poop.cpp b/generated-src/grid_entity_poop.cpp index ae7b23a..53ba818 100644 --- a/generated-src/grid_entity_poop.cpp +++ b/generated-src/grid_entity_poop.cpp @@ -343,9 +343,9 @@ LAB_00714c16: iStack_60 = 0x3f800000; local_5c = 0; switchD_00714d3f_caseD_2: - bVar1 = (GHIDRA_CAST((player)))->Entity_Player::is_footstep_triggered(-1); + bVar1 = Entity_Player::is_footstep_triggered(player,-1); if ((bVar1 != 0) && (player->_canFly == 0)) { - bVar1 = (GHIDRA_CAST((player)))->Entity_Player::is_footstep_triggered(0); + bVar1 = Entity_Player::is_footstep_triggered(player,0); if (bVar1 == 0) { (player->_footprintColor1)._offset[0] = footprintR; (player->_footprintColor1)._offset[1] = fStack_68; @@ -442,7 +442,7 @@ LAB_00714fce: player->_hallowedGroundCountdown = iVar5; if (0 < prevHolyAura != 0 < iVar5) { player->_cacheFlags = player->_cacheFlags | 99; - (GHIDRA_CAST((player)))->Entity_Player::EvaluateItems(); + Entity_Player::EvaluateItems(player); } } playerManager = &g_game->_playerManager; @@ -1197,8 +1197,8 @@ switchD_0071688e_default: fVar2 = sin((float)local_68); local_74.y = fVar2 * 0.5 * local_6c; pEVar1 = Game::Spawn(g_game,1000,0x3a,position,&local_74,GHIDRA_CAST(0x0),0,rngResult); - pEVar1->SetColor(&gibColor,0xffffffff,0xff,0,1); - pEVar1->Update(); + (**(code **)(*GHIDRA_CAST(pEVar1) + 0x3c))(&gibColor,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(pEVar1) + 0xc))(); count = count + -1; if (count == 0) { return; @@ -1391,7 +1391,7 @@ GridEntity_Poop * GridEntity_Poop::get_giga_part(int variant, uint8_t isCreate) } if (isCreate != 0) { if ((pGVar4 != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar4)) + 0x4)))) == 0xe)) { - (GHIDRA_CAST((this_00)))->Room::RemoveGridEntity(uVar3,0,1); + Room::RemoveGridEntity(this_00,uVar3,0,1); } uVar5 = Random(); if ((GHIDRA_INT(uVar3) < 0) || (0x1bf < GHIDRA_INT(uVar3))) { diff --git a/generated-src/grid_entity_pressure_plate.cpp b/generated-src/grid_entity_pressure_plate.cpp index f884e28..c9f8571 100644 --- a/generated-src/grid_entity_pressure_plate.cpp +++ b/generated-src/grid_entity_pressure_plate.cpp @@ -69,7 +69,7 @@ void GridEntity_PressurePlate::update_press() if (((iVar4 == 1) && (presser->_isCoopGhost != 0)) || ((presser->_dead == 0 && ((((iVar4 == 1 && (presser->_isCoopGhost == 0)) && - (bVar1 = (GHIDRA_CAST((presser)))->Entity_Player::IsHologram(), bVar1 == 0)) || + (bVar1 = Entity_Player::IsHologram(presser), bVar1 == 0)) || (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (iVar4 != 1)) && ((iVar4 - 10U < 0x3de && ((iVar4 == 0x36d || (iVar4 == 0x35)))))))))))) { manager = g_manager; @@ -427,8 +427,8 @@ void GridEntity_PressurePlate::update_greed_button() } if ((fVar7 < 625.0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) == 0)) { if (0 < waveTimer) { - iVar5 = (GHIDRA_CAST((player)))->Entity_Player::GetHealthType(); - if ((iVar5 == 2) || (bVar3 = (GHIDRA_CAST((this_00)))->Entity_Player::HasInstantDeathCurse(), bVar3 != 0)) + iVar5 = Entity_Player::GetHealthType(player); + if ((iVar5 == 2) || (bVar3 = Entity_Player::HasInstantDeathCurse(this_00), bVar3 != 0)) { game->_levelStateFlags = game->_levelStateFlags | 0x800; } @@ -443,7 +443,7 @@ void GridEntity_PressurePlate::update_greed_button() damageSource._velocity.y = g_vectorZero.y; damageSource._flags = 0; damageSource._entity = (void *)0x0; - player->TakeDamage(0x3f800000,0x10000080,0,&damageSource,0x1e); + (**(code **)(*GHIDRA_CAST(player) + 0x20))(0x3f800000,0x10000080,0,&damageSource,0x1e); game = g_game; } } @@ -500,7 +500,7 @@ LAB_00983c85: ((this->_sprite)._animState._isPlaying == 0)) { if (iVar5 == 1) { if (waveTimer < 1) { - (GHIDRA_CAST((game->_room)))->Room::SpawnGreedModeWave(0); + Room::SpawnGreedModeWave(game->_room,0); uVar4 = 0; playerManager = &g_game->_playerManager; if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - @@ -516,9 +516,9 @@ LAB_00983c85: playerSlot = playerSlot + uVar4; } player = GHIDRA_CAST(*playerSlot); - bVar3 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(299,0); - if (((bVar3 != 0) || (iVar5 = (GHIDRA_CAST((player)))->Entity_Player::GetZodiacEffect(), iVar5 == 299)) && - (bVar3 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(299), + bVar3 = Entity_Player::HasCollectible(player,299,0); + if (((bVar3 != 0) || (iVar5 = Entity_Player::GetZodiacEffect(player), iVar5 == 299)) && + (bVar3 = TemporaryEffects::HasCollectibleEffect(&player->_temporaryeffects,299), bVar3 == 0)) { player->_taurusSpeedBonus = 0.0; flashColor._colorize[0] = 0.0; @@ -532,7 +532,7 @@ LAB_00983c85: flashColor._tint[1] = 1.0; flashColor._tint[2] = 1.0; flashColor._tint[3] = 1.0; - player->SetColor(&flashColor,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(player) + 0x3c))(&flashColor,0xffffffff,0xff,0,1); pvVar6 = (g_manager->_itemConfig)._collectibles._begin; if ((0x4ac < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) & 0xfffffffcU))) && (iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x4ac)), iVar5 != 0) @@ -541,7 +541,7 @@ LAB_00983c85: effectEntry[1] = 0; uStack_64 = 0; effectEntry[0] = iVar5; - (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::AddEffect(effectEntry,1,1); + TemporaryEffects::AddEffect(&player->_temporaryeffects,effectEntry,1,1); } } uVar4 = uVar4 + 1; @@ -648,7 +648,7 @@ void GridEntity_PressurePlate::Reward() if (uVar8 < 0xe) { ExceptionList = &local_1c; puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - (GHIDRA_CAST((g_game->_room)))->Room::TriggerOutput(uVar8 - 10); + Room::TriggerOutput(g_game->_room,uVar8 - 10); ExceptionList = local_1c; return; } @@ -684,7 +684,7 @@ void GridEntity_PressurePlate::Reward() Game::ShakeScreen(g_game,0xf); timerEffect = Entity_Effect::CreateTimer (pressure_plate_kill_enemies_timer_callback,1,0xffffffff,0); - (GHIDRA_CAST((GHIDRA_CAST(timerEffect))))->Entity::SetParent(GHIDRA_CAST(player)); + Entity::SetParent(GHIDRA_CAST(timerEffect),GHIDRA_CAST(player)); ExceptionList = local_1c; return; } @@ -730,8 +730,8 @@ void GridEntity_PressurePlate::Reward() if (isTrapDoorAllowed != 0) { room = g_game->_room; uVar8 = (GHIDRA_CAST((&rng)))->RNG::Next(); - targetRoomType = (GHIDRA_CAST((g_game->_room)))->Room::GetGridIndex(&local_4c); - (GHIDRA_CAST((room)))->Room::SpawnGridEntity(targetRoomType,0x11,0,uVar8,0); + targetRoomType = Room::GetGridIndex(g_game->_room,&local_4c); + Room::SpawnGridEntity(room,targetRoomType,0x11,0,uVar8,0); ExceptionList = local_1c; return; } @@ -741,7 +741,7 @@ void GridEntity_PressurePlate::Reward() pvVar6 = g_game->_room; local_30 = pvVar6; local_38 = (void *)(GHIDRA_CAST((&rng)))->RNG::Next(); - uVar8 = (GHIDRA_CAST((g_game->_room)))->Room::GetGridIndex(&local_4c); + uVar8 = Room::GetGridIndex(g_game->_room,&local_4c); if ((GHIDRA_INT(uVar8) < 0) || (0x1bf < GHIDRA_INT(uVar8))) { KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); } @@ -892,7 +892,7 @@ void GridEntity_PressurePlate::Reward() pos_03.y = local_58.y; pos_03.x = local_58.x; local_38 = (void *)local_58.y; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_03); + targetRoomType = Room::GetGridCollisionAtPos(room,pos_03); if (targetRoomType == 0) { LAB_00984f49: local_58.x = local_4c.x + 0.0; @@ -900,13 +900,13 @@ LAB_00984f49: pos_05.y = local_58.y; pos_05.x = local_58.x; local_38 = (void *)local_58.x; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_05); + targetRoomType = Room::GetGridCollisionAtPos(room,pos_05); if (targetRoomType == 0) goto LAB_00984fe7; local_58.y = local_4c.y - 40.0; local_58.x = (float)local_38; pos_06.y = local_58.y; pos_06.x = (float)local_38; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_06); + targetRoomType = Room::GetGridCollisionAtPos(room,pos_06); if (targetRoomType == 0) goto LAB_00984fe7; } else { @@ -914,7 +914,7 @@ LAB_00984f49: local_58.y = (float)local_38; pos_04.y = (float)local_38; pos_04.x = local_58.x; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_04); + targetRoomType = Room::GetGridCollisionAtPos(room,pos_04); if (targetRoomType == 0) goto LAB_00984f49; } tmpPos = Room::GetCenterPos(&local_60); @@ -933,7 +933,7 @@ LAB_00984fe7: pos.y = local_58.y; pos.x = local_58.x; local_38 = (void *)local_58.y; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos); + targetRoomType = Room::GetGridCollisionAtPos(room,pos); if (targetRoomType == 0) { LAB_00984de5: local_58.x = local_4c.x + 0.0; @@ -941,13 +941,13 @@ LAB_00984de5: pos_01.y = local_58.y; pos_01.x = local_58.x; local_38 = (void *)local_58.x; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_01); + targetRoomType = Room::GetGridCollisionAtPos(room,pos_01); if (targetRoomType == 0) goto LAB_00984e83; local_58.y = local_4c.y - 40.0; local_58.x = (float)local_38; pos_02.y = local_58.y; pos_02.x = (float)local_38; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_02); + targetRoomType = Room::GetGridCollisionAtPos(room,pos_02); if (targetRoomType == 0) goto LAB_00984e83; } else { @@ -955,7 +955,7 @@ LAB_00984de5: local_58.y = (float)local_38; pos_00.y = (float)local_38; pos_00.x = local_58.x; - targetRoomType = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(pos_00); + targetRoomType = Room::GetGridCollisionAtPos(room,pos_00); if (targetRoomType == 0) goto LAB_00984de5; } tmpPos = Room::GetCenterPos(&local_60); @@ -973,7 +973,7 @@ LAB_00984e83: pvVar6 = g_game->_room; local_30 = pvVar6; local_38 = (void *)(GHIDRA_CAST((&rng)))->RNG::Next(); - uVar8 = (GHIDRA_CAST((g_game->_room)))->Room::GetGridIndex(&local_4c); + uVar8 = Room::GetGridIndex(g_game->_room,&local_4c); if ((GHIDRA_INT(uVar8) < 0) || (0x1bf < GHIDRA_INT(uVar8))) { KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); } diff --git a/generated-src/grid_entity_rock.cpp b/generated-src/grid_entity_rock.cpp index 003abe7..811cdd3 100644 --- a/generated-src/grid_entity_rock.cpp +++ b/generated-src/grid_entity_rock.cpp @@ -106,7 +106,7 @@ LAB_0071905d: if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { pEVar3 = GHIDRA_CAST(FUN_0090b0e0(uVar2)); local_50[3] = GHIDRA_CAST(0x0); - bVar1 = (GHIDRA_CAST((pEVar3)))->Entity_Player::HasTrinket(0x3e,0); + bVar1 = Entity_Player::HasTrinket(pEVar3,0x3e,0); if (bVar1 == 0) goto LAB_007191ab; } iVar6 = 300; @@ -204,7 +204,7 @@ LAB_0071926c: spawnPos.x = (float)(this->_gridIndex % iVar4) * 40.0 + 40.0; spawnPos.y = (float)(this->_gridIndex / iVar4) * 40.0 + 120.0; Game::Spawn(g_game,1000,0xf,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar2); - sourceRef = (GHIDRA_CAST((GHIDRA_CAST((local_90 + 4)))))->EntityRef::EntityRef(); + sourceRef = EntityRef::EntityRef(GHIDRA_CAST((local_90 + 4))); (*extraout_EDX_00)(1,sourceRef); game = g_game; } @@ -253,7 +253,7 @@ LAB_0071926c: else { iVar6 = iVar4 * room->_gridWidth + iVar6; } - uVar8 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); + uVar8 = Room::GetGridCollision(room,iVar6); if ((uVar8 == 0) && (fVar9 = (local_50[3]->_pos).x - (float)local_50[0], fVar10 = (local_50[3]->_pos).y - (float)local_50[1], @@ -266,7 +266,7 @@ LAB_0071926c: uVar2 = uVar2 + 1; } while (uVar2 < 4); if ((spawnPos.x == g_vectorZero.x) && (spawnPos.y == g_vectorZero.y)) goto LAB_00719576; - (GHIDRA_CAST((local_50[3])))->Entity_Player::AddBlueSpider(&spawnPos); + Entity_Player::AddBlueSpider(local_50[3],&spawnPos); } } } @@ -275,7 +275,7 @@ LAB_0071926c: iVar4 = this->_frameCnt; this->_frameCnt = iVar4 + -1; if (0 < iVar4) goto LAB_00719576; - sourceRef = (GHIDRA_CAST((GHIDRA_CAST((local_90 + 4)))))->EntityRef::EntityRef(); + sourceRef = EntityRef::EntityRef(GHIDRA_CAST((local_90 + 4))); (*extraout_EDX)(0,sourceRef); } game = g_game; @@ -808,11 +808,11 @@ void GridEntity_Rock::guard_check_icall() uVar2 = GHIDRA_UINT(this->_gridIndex) / GHIDRA_UINT(currentRoom->_gridWidth); uVar3 = GHIDRA_UINT(this->_gridIndex) % GHIDRA_UINT(currentRoom->_gridWidth); nextColumn = uVar3 + 1; - neighborIndices[0] = (GHIDRA_CAST((currentRoom)))->Room::GetGridIndexByTile(nextColumn,uVar2); + neighborIndices[0] = Room::GetGridIndexByTile(currentRoom,nextColumn,uVar2); nextRow = uVar2 + 1; - neighborIndices[1] = (GHIDRA_CAST((currentRoom)))->Room::GetGridIndexByTile(uVar3,nextRow); + neighborIndices[1] = Room::GetGridIndexByTile(currentRoom,uVar3,nextRow); room = currentRoom; - neighborIndices[2] = (GHIDRA_CAST((currentRoom)))->Room::GetGridIndexByTile(nextColumn,nextRow); + neighborIndices[2] = Room::GetGridIndexByTile(currentRoom,nextColumn,nextRow); uVar2 = 0; neighborRocks[0] = GHIDRA_CAST(0x0); uVar3 = 0; @@ -1280,7 +1280,7 @@ void GridEntity_Rock::TrySpawnWorms() local_14 = trig * 20.0 + rockY; worm = Game::Spawn(g_game,1000,0x3f,GHIDRA_CAST((local_20 + 8)),&g_vectorZero,GHIDRA_CAST(0x0),0, seed); - worm->Update(); + (**(code **)(*GHIDRA_CAST(worm) + 0xc))(); wormCount = wormCount - 1; } while (wormCount != 0); } @@ -1348,7 +1348,7 @@ uint8_t GridEntity_Rock::TrySpawnLadder() do { player = GHIDRA_CAST(*playerIt); if ((player->_variant == 0) && - (isHasStudFinder = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0x4a,0), isHasStudFinder != 0)) { + (isHasStudFinder = Entity_Player::HasTrinket(player,0x4a,0), isHasStudFinder != 0)) { pvVar3 = (player->_trinketRNGs)._end; if (GHIDRA_INT(pvVar3) - GHIDRA_INT((player->_trinketRNGs)._begin) >> 4 < 0x4b) { KAGE_LogMessage(0x10,GHIDRA_CAST("Trinket ID out of bounds!\n")); @@ -1395,7 +1395,7 @@ LAB_0071b300: KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); } if ((uVar2 < 0x1c0) && - (gridCollision = (GHIDRA_CAST((room)))->Room::GetGridCollision(uVar2), GHIDRA_INT(gridCollision) < 1)) { + (gridCollision = Room::GetGridCollision(room,uVar2), GHIDRA_INT(gridCollision) < 1)) { stairs = operator_new(0x154); local_8 = 0x11; if (stairs == GHIDRA_CAST(0x0)) { diff --git a/generated-src/grid_entity_trap_door.cpp b/generated-src/grid_entity_trap_door.cpp index 802b10c..0deeeea 100644 --- a/generated-src/grid_entity_trap_door.cpp +++ b/generated-src/grid_entity_trap_door.cpp @@ -515,7 +515,7 @@ void GridEntity_TrapDoor::Update() if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && (_Init_thread_header(), g_invalidRoomDescriptorGuard == -1)) { (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); + RoomDescriptor::constructor(&g_roomDescriptorDummy); _atexit(FUN_00b15b30); local_8 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8)); _Init_thread_footer(&g_invalidRoomDescriptorGuard); @@ -957,7 +957,7 @@ LAB_007208e8: } pEVar6 = GHIDRA_CAST(*playerSlot); if (pEVar6->_variant == 0) { - (GHIDRA_CAST((pEVar6)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Trapdoor")); + Entity_Player::PlayExtraAnimation(pEVar6,GHIDRA_CAST("Trapdoor")); game = g_game; iVar15 = savedTrapDoor->_gridIndex; iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); @@ -1055,7 +1055,7 @@ LAB_00720d35: do { local_4c.y = (float)Game::GetPlayer(game,preventedCurses); if ((GHIDRA_CAST(local_4c.y))->_variant == 0) { - (GHIDRA_CAST((GHIDRA_CAST(local_4c.y))))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Trapdoor")); + Entity_Player::PlayExtraAnimation(GHIDRA_CAST(local_4c.y),GHIDRA_CAST("Trapdoor")); game = g_game; iVar15 = trapDoor->_gridIndex; iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); @@ -1085,7 +1085,7 @@ LAB_00720e0b: } } LAB_00720b0f: - (GHIDRA_CAST((pEVar6)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Trapdoor")); + Entity_Player::PlayExtraAnimation(pEVar6,GHIDRA_CAST("Trapdoor")); game = g_game; iVar15 = trapDoor->_gridIndex; iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); diff --git a/generated-src/grid_entity_wall.cpp b/generated-src/grid_entity_wall.cpp index 8362e85..c658e3c 100644 --- a/generated-src/grid_entity_wall.cpp +++ b/generated-src/grid_entity_wall.cpp @@ -136,7 +136,7 @@ void GridEntity_Wall::guard_check_icall() else { local_34.x = (float)(this->_gridIndex % room->_gridWidth) * 40.0 + 40.0 + 0.0; local_34.y = ((float)(this->_gridIndex / room->_gridWidth) * 40.0 + 120.0) - 40.0; - (GHIDRA_CAST((room)))->Room::GetGridEntityFromPos(&local_34); + Room::GetGridEntityFromPos(room,&local_34); Random(); sprintf_s(animNameBuf,0x1f,&DAT_00b69520); anim = GHIDRA_CAST(animNameBuf); diff --git a/generated-src/grid_entity_web.cpp b/generated-src/grid_entity_web.cpp index 58b8435..a2d4f9e 100644 --- a/generated-src/grid_entity_web.cpp +++ b/generated-src/grid_entity_web.cpp @@ -168,10 +168,10 @@ void GridEntity_Web::Update() player = GHIDRA_CAST(*puVar4); iVar1 = player->_entityGridCollisionClass; if ((((iVar1 != 0) && (iVar1 != 3)) && (iVar1 != 1)) && (iVar1 != 2)) { - isHasEvilCharm = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x278,0); + isHasEvilCharm = Entity_Player::HasCollectible(player,0x278,0); if ((isHasEvilCharm != 0) || (isHasEvilCharm = - (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x278), + TemporaryEffects::HasCollectibleEffect(&player->_temporaryeffects,0x278), isHasEvilCharm != 0)) { if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 10) goto LAB_007219cb; (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x26d4))) = (*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x26d4))) != '\0'; @@ -206,7 +206,7 @@ void GridEntity_Web::Update() color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)auVar2)) + 0x1c))); color._offset[1] = 0.15686275; color._offset[2] = 0.15686275; - (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::AddSlowing(&sourceRef,4,0.75,color,0); + Entity::AddSlowing(GHIDRA_CAST(player),&sourceRef,4,0.75,color,0); } } LAB_007219cb: diff --git a/generated-src/history.cpp b/generated-src/history.cpp deleted file mode 100644 index b67b33e..0000000 --- a/generated-src/history.cpp +++ /dev/null @@ -1,245 +0,0 @@ -#include "classes.h" - -// 00721a70 -void History::AddHistoryItem(void *historyItem) -{ - int iVar1; - int iVar2; - int *item; - int iVar3; - int *itemsBegin; - int *itemsEnd; - void **itemsEndPtr; - - if (this->_isLocked != 0) { - return; - } - itemsBegin = (this->_historyItems)._begin; - itemsEnd = (this->_historyItems)._end; - item = itemsBegin; - if (itemsBegin != itemsEnd) { - do { - item = item + 7; - } while (item != itemsEnd); - item = itemsBegin; - if (*GHIDRA_CAST(historyItem) < itemsEnd[-7]) { - do { - if (*GHIDRA_CAST(historyItem) < *item) { - FUN_00722250(&historyItem,item,historyItem); - iVar3 = (GHIDRA_INT(item) - GHIDRA_INT(itemsBegin)) / 0x1c + (GHIDRA_INT(item) - GHIDRA_INT(itemsBegin) >> 0x1f); - iVar2 = iVar3; - goto LAB_00721b3f; - } - item = item + 7; - } while (item != itemsEnd); - goto LAB_00721b4c; - } - } - if (itemsEnd == (this->_historyItems)._capacity) { - msvc::vector<28byte>::_Emplace_reallocate(itemsEnd,historyItem); - } - else { - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(historyItem) + 4)); - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(historyItem) + 8)); - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(historyItem) + 0xc)); - *itemsEnd = *GHIDRA_CAST(historyItem); - itemsEnd[1] = iVar2; - itemsEnd[2] = iVar3; - itemsEnd[3] = iVar1; - *GHIDRA_CAST((itemsEnd + 4)) = *GHIDRA_CAST((GHIDRA_CAST(historyItem) + 0x10)); - itemsEnd[6] = *GHIDRA_CAST((GHIDRA_CAST(historyItem) + 0x18)); - itemsEndPtr = &(this->_historyItems)._end; - *itemsEndPtr = (void *)(GHIDRA_INT(*itemsEndPtr) + 0x1c); - } - iVar2 = GHIDRA_INT((this->_historyItems)._end) - GHIDRA_INT((this->_historyItems)._begin); - iVar3 = iVar2 / 0x1c + (iVar2 >> 0x1f); - iVar2 = iVar3 + -1; -LAB_00721b3f: - FUN_00722020(iVar2 - (iVar3 >> 0x1f)); -LAB_00721b4c: - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - return; -} - -// 00721c00 -uint8_t History::RemoveHistoryItemByIndex(int index) -{ - void *historyBegin; - int removedIndex; - - removedIndex = index; - if (this->_isLocked == 0) { - historyBegin = (this->_historyItems)._begin; - if (index < (GHIDRA_INT((this->_historyItems)._end) - GHIDRA_INT(historyBegin)) / 0x1c) { - msvc::vector::erase(&index,(void *)(GHIDRA_INT(historyBegin) + index * 0x1c)); - remove_index_refs(this,removedIndex); - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - return 1; - } - } - return 0; -} - -// 00721c80 -void History::merge(void *other) -{ - void **ppvVar1; - int iVar2; - int iVar3; - int iVar4; - uint32_t size; - int *oldItem; - int *oldItem; - uint8_t oldBegin [16]; - void *oldCapacity; - History *history; - int *oldEnd; - int *otherEnd; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - - puStack_20 = oldBegin + 0x3c; - puStack_18 = &LAB_00afcd4d; - local_1c = ExceptionList; - ExceptionList = &local_1c; - if (this->_isLocked == 0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0x0))) = GHIDRA_CAST(0x0); - oldCapacity = (void *)0x0; - local_14 = 0; - oldEnd = GHIDRA_CAST(0x0); - if (GHIDRA_CAST(oldBegin) != this) { - (*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0x0))) = (this->_historyItems)._begin; - oldCapacity = (this->_historyItems)._capacity; - (this->_historyItems)._begin = (void *)0x0; - oldEnd = (this->_historyItems)._end; - (this->_historyItems)._end = (void *)0x0; - (this->_historyItems)._capacity = (void *)0x0; - } - oldItem = *GHIDRA_CAST(other); - otherEnd = *GHIDRA_CAST((GHIDRA_CAST(other) + 4)); - oldItem = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(oldBegin))) + 0x0))); - (*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0x4))) = oldEnd; - (*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0x8))) = oldCapacity; - history = this; - while( true ) { - while (oldItem != oldEnd) { - if ((oldItem != otherEnd) && (*oldItem < *oldItem)) goto LAB_00721d9e; - (*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) = (this->_historyItems)._end; - if ((*GHIDRA_CAST((GHIDRA_CAST(&((void *)oldBegin)) + 0xc))) == (this->_historyItems)._capacity) { - msvc::vector<28byte>::_Emplace_reallocate((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))),oldItem); - oldItem = oldItem + 7; - this = history; - } - else { - iVar2 = oldItem[1]; - iVar3 = oldItem[2]; - iVar4 = oldItem[3]; - *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(oldBegin))) + 0xc))) = *oldItem; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 4)) = iVar2; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 8)) = iVar3; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0xc)) = iVar4; - iVar2 = oldItem[5]; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0x10)) = oldItem[4]; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0x14)) = iVar2; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0x18)) = oldItem[6]; - ppvVar1 = &(this->_historyItems)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x1c); - oldItem = oldItem + 7; - } - } - if (oldItem == otherEnd) break; -LAB_00721d9e: - (*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) = (this->_historyItems)._end; - if ((*GHIDRA_CAST((GHIDRA_CAST(&((void *)oldBegin)) + 0xc))) == (this->_historyItems)._capacity) { - msvc::vector<28byte>::_Emplace_reallocate((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))),oldItem); - oldItem = oldItem + 7; - this = history; - } - else { - iVar2 = oldItem[1]; - iVar3 = oldItem[2]; - iVar4 = oldItem[3]; - *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(oldBegin))) + 0xc))) = *oldItem; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 4)) = iVar2; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 8)) = iVar3; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0xc)) = iVar4; - iVar2 = oldItem[5]; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0x10)) = oldItem[4]; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0x14)) = iVar2; - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0xc))) + 0x18)) = oldItem[6]; - ppvVar1 = &(this->_historyItems)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 0x1c); - oldItem = oldItem + 7; - } - } - HUD::mark_all_slots_dirty(&g_game->_hud,0,0); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(oldBegin))) + 0x0))) != GHIDRA_CAST(0x0)) { - size = ((GHIDRA_INT(oldCapacity) - (*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0x0)))) / 0x1c) * 0x1c; - oldItem = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(oldBegin))) + 0x0))); - if (0xfff < size) { - oldItem = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0x0))) + -4)); - size = size + 0x23; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(oldBegin)) + 0x0))) + (-4 - GHIDRA_INT(oldItem))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(oldItem,size); - } - } - ExceptionList = local_1c; - return; -} - -// 007220a0 -void History::remove_index_refs(int index) -{ - History *slot; - History *compactSlot; - int iVar1; - int iVar2; - int iVar3; - int firstFreeSlot; - void *storedIndex; - - compactSlot = this + 1; - slot = compactSlot; - iVar3 = 0x10; - do { - iVar1 = iVar3; - storedIndex = (slot->_historyItems)._begin; - if (storedIndex == (void *)index) { - (slot->_historyItems)._begin = (void *)0xffffffff; - } - else if (index < GHIDRA_INT(storedIndex)) { - (slot->_historyItems)._begin = (void *)(GHIDRA_INT(storedIndex) + -1); - } - slot = GHIDRA_CAST(&(slot->_historyItems)._end); - iVar3 = iVar1 + -1; - } while (iVar3 != 0); - firstFreeSlot = -1; - iVar3 = 0; - iVar1 = iVar1 + -5; - do { - storedIndex = (compactSlot->_historyItems)._begin; - iVar2 = iVar1; - if (GHIDRA_INT(storedIndex) < 0) { - if (firstFreeSlot < 0) { - iVar2 = (-0x14 - GHIDRA_INT(this)) + GHIDRA_INT(compactSlot); - firstFreeSlot = iVar3; - } - } - else if (-1 < firstFreeSlot) { - firstFreeSlot = firstFreeSlot + 1; - iVar2 = iVar1 + 4; - (compactSlot->_historyItems)._begin = *(void **)(GHIDRA_INT(&this[1]._historyItems._begin) + iVar1); - *(void **)(GHIDRA_INT(&this[1]._historyItems._begin) + iVar1) = storedIndex; - } - iVar3 = iVar3 + 1; - compactSlot = GHIDRA_CAST(&(compactSlot->_historyItems)._end); - iVar1 = iVar2; - } while (iVar3 < 0x10); - return; -} diff --git a/generated-src/homing_laser.cpp b/generated-src/homing_laser.cpp index 18a6979..75b3729 100644 --- a/generated-src/homing_laser.cpp +++ b/generated-src/homing_laser.cpp @@ -193,7 +193,7 @@ void HomingLaser::build_bezier_path(int homingType, Entity *source) do { local_44 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_2c) + 0x125c)) + entityIndex * 4)); local_24 = local_44; - bVar2 = (GHIDRA_CAST((local_44)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); + bVar2 = Entity::IsVulnerableEnemy(local_44,GHIDRA_CAST(0x0)); if ((((bVar2 == 0) || ((local_44->_flags & 0x20000010) != 0)) || (local_44 == source)) || ((homingType == 4 && (local_44->_type == source->_type)))) { local_25 = '\0'; @@ -203,7 +203,7 @@ void HomingLaser::build_bezier_path(int homingType, Entity *source) } if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (local_44->_type != 3)) || ((local_44->_variant != 0x43 || - (bVar2 = (GHIDRA_CAST((local_44)))->Entity::IsDescendantOf(GHIDRA_CAST(source->_spawnerEntity)), bVar2 != 0)) + (bVar2 = Entity::IsDescendantOf(local_44,GHIDRA_CAST(source->_spawnerEntity)), bVar2 != 0)) )) { isEnemyFamiliar = false; } @@ -788,7 +788,7 @@ LAB_0099d600: *GHIDRA_CAST((puVar5 + 4)) = CONCAT44(fVar8,fVar6); *(void **)(GHIDRA_CAST(fVar7) + 4) = (void *)(GHIDRA_INT(*(void **)(GHIDRA_CAST(fVar7) + 4)) + 0x18); } - bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&local_a4,0.0); + bVar2 = Room::IsPositionInRoom(g_game->_room,&local_a4,0.0); if (bVar2 == 0) break; pEVar11 = local_3c; pEVar13 = local_40; @@ -1757,7 +1757,7 @@ void HomingLaser::build_wiggle_bezier() } local_44.x = -dirX; local_44.y = -dirY; - endPoint = (GHIDRA_CAST((GHIDRA_CAST(*in_ECX))))->Entity_Laser::calc_end_point(&local_4c,&startPos,&local_44); + endPoint = Entity_Laser::calc_end_point(GHIDRA_CAST(*in_ECX),&local_4c,&startPos,&local_44); fVar2 = endPoint->x; in_ECX[3] = fVar2; fVar3 = endPoint->y; @@ -1826,7 +1826,7 @@ uint8_t HomingLaser::clip_samples_to_grid(Vector *pos, int gridCollisionClass) else { gridIndex = *GHIDRA_CAST((GHIDRA_CAST(local_24.x) + 0xc)) * gridIndex + GHIDRA_INT(fVar3); } - (GHIDRA_CAST((GHIDRA_CAST(local_24.x))))->Room::GetGridCollision(gridIndex); + Room::GetGridCollision(GHIDRA_CAST(local_24.x),gridIndex); isBlocked = FUN_0070be60(); fVar3 = local_1c.x; if (isBlocked != '\0') { @@ -2214,8 +2214,8 @@ LAB_009a1371: } else { candidate = *GHIDRA_CAST((candidateData + candidateIndex * 4)); - ancestor = (GHIDRA_CAST((param_5)))->Entity::GetPlayerAncestor(); - bVar2 = (GHIDRA_CAST((candidate)))->Entity::IsDescendantOf(ancestor); + ancestor = Entity::GetPlayerAncestor(param_5); + bVar2 = Entity::IsDescendantOf(candidate,ancestor); if (bVar2 == 0) { in_ECX = homingLaser; goto LAB_009a1371; diff --git a/generated-src/input_manager.cpp b/generated-src/input_manager.cpp index af38eff..c8939e2 100644 --- a/generated-src/input_manager.cpp +++ b/generated-src/input_manager.cpp @@ -41,7 +41,7 @@ void * InputManager::GetDeviceByPlayerEntity(Entity_Player *player) } devicePlayer = GHIDRA_CAST(0x0); LAB_0090ad07: - mainTwin = (GHIDRA_CAST((player)))->Entity_Player::GetMainTwin(); + mainTwin = Entity_Player::GetMainTwin(player); if ((devicePlayer == mainTwin) || (deviceId == *GHIDRA_CAST((extraout_ECX + 0x1618)))) { return pvVar1; } diff --git a/generated-src/isaac_repentance_plus/weapon.cpp b/generated-src/isaac_repentance_plus/weapon.cpp index 43b55fe..d86cd29 100644 --- a/generated-src/isaac_repentance_plus/weapon.cpp +++ b/generated-src/isaac_repentance_plus/weapon.cpp @@ -24,7 +24,7 @@ IsaacRepentancePlus::Weapon::~Weapon() } else if (ownerPlayer != GHIDRA_CAST(0x0)) { local_14 = this; - ::(GHIDRA_CAST((ownerPlayer)))->Entity_Player::stop_costume_item_anims(); + ::Entity_Player::stop_costume_item_anims(ownerPlayer); } technology2LaserRef = &this->_technology2Laser; if (*technology2LaserRef != 0) { diff --git a/generated-src/item_overlay.cpp b/generated-src/item_overlay.cpp index fa74f42..c2a2289 100644 --- a/generated-src/item_overlay.cpp +++ b/generated-src/item_overlay.cpp @@ -169,7 +169,7 @@ LAB_009accdf: playerSlot = playerSlot + playerIndex; } if ((GHIDRA_CAST(*playerSlot))->_playerType != 0x28) { - iVar2 = (GHIDRA_CAST((GHIDRA_CAST(*playerSlot))))->Entity_Player::GetHealthType(); + iVar2 = Entity_Player::GetHealthType(GHIDRA_CAST(*playerSlot)); if ((iVar2 == 1) || (iVar2 == 2)) { iVar2 = player->_maxHearts; } @@ -177,16 +177,16 @@ LAB_009accdf: iVar2 = player->_maxHearts + player->_boneHearts * 2; } if (iVar2 < 1) { - (GHIDRA_CAST((player)))->Entity_Player::AddSoulHearts(6,0); + Entity_Player::AddSoulHearts(player,6,0); } else { - healthType = (GHIDRA_CAST((player)))->Entity_Player::GetHealthType(); + healthType = Entity_Player::GetHealthType(player); iVar2 = extraout_EDX; if ((healthType != 1) && (healthType != 2)) { iVar2 = extraout_EDX + heartPlayer->_boneHearts * 2; } if (iVar2 <= heartPlayer->_redHearts) goto LAB_009ace00; - (GHIDRA_CAST((heartPlayer)))->Entity_Player::SetFullHearts(); + Entity_Player::SetFullHearts(heartPlayer); } manager = g_manager; if (unk == 0) { @@ -217,7 +217,7 @@ LAB_009ace00: _unk = 0x51; seed_fart_sound_override(GHIDRA_CAST(&unk)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(_unk,1.0,2,0,1.0,0.0); - (GHIDRA_CAST((g_game->_room)))->Room::PlayMusic(); + Room::PlayMusic(g_game->_room); MusicManager::EnableLayer(&g_manager->_musicManager,0,1); return; } @@ -239,7 +239,7 @@ LAB_009ace00: if (((roomDesc != GHIDRA_CAST(0x0)) && (game->_stage == 0xd)) && ((game->_stageType == 0 && ((*roomDesc == 0x23 && (roomDesc[4] == 2)))))) { Level::SetStage(GHIDRA_CAST(game),0xd,1); - (GHIDRA_CAST((g_game->_room)))->Room::reload_backdrop(); + Room::reload_backdrop(g_game->_room); return; } } diff --git a/generated-src/kage_filesys_file_manager.cpp b/generated-src/kage_filesys_file_manager.cpp index 7ae7519..fb8ad4a 100644 --- a/generated-src/kage_filesys_file_manager.cpp +++ b/generated-src/kage_filesys_file_manager.cpp @@ -8,8 +8,8 @@ bool KAGE_Filesys_FileManager::OpenRead(int param_2, int param_3) int totalCharge; if (-1 < param_3) { - iVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::GetActiveMaxCharge(param_3); - totalCharge = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::GetTotalActiveCharge(param_3); + iVar1 = Entity_Player::GetActiveMaxCharge(GHIDRA_CAST(this),param_3); + totalCharge = Entity_Player::GetTotalActiveCharge(GHIDRA_CAST(this),param_3); if (totalCharge < iVar1) { return false; } @@ -27,7 +27,7 @@ bool KAGE_Filesys_FileManager::OpenRead(int param_2, int param_3) case 0x27b: iVar1 = FUN_005c92f0(); if (iVar1 != 0) { - iVar1 = (GHIDRA_CAST((g_game->_room)))->Room::GetGridCollisionAtPos(*GHIDRA_CAST((iVar1 + 0x33c))); + iVar1 = Room::GetGridCollisionAtPos(g_game->_room,*GHIDRA_CAST((iVar1 + 0x33c))); if ((*GHIDRA_CAST((GHIDRA_CAST(&(this[0x725])) + 0x1))) != '\0') { return iVar1 != 4; } @@ -40,7 +40,7 @@ bool KAGE_Filesys_FileManager::OpenRead(int param_2, int param_3) } break; case 0x282: - iVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::GetEffectiveMaxHearts(); + iVar1 = Entity_Player::GetEffectiveMaxHearts(GHIDRA_CAST(this)); return 0 < iVar1 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x66e])) + 0x2)))); case 0x2c5: if ((*GHIDRA_CAST((this + 0xa64)) == 0) && @@ -50,7 +50,7 @@ bool KAGE_Filesys_FileManager::OpenRead(int param_2, int param_3) } break; case 0x2ca: - isHasFlags = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x600000000000000); + isHasFlags = Entity::HasEntityFlags(GHIDRA_CAST(this),0x600000000000000); if ((isHasFlags == 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[0x11a])) + 0x2)))) == 0.0)) { return true; } diff --git a/generated-src/npc_helper.cpp b/generated-src/npc_helper.cpp index 4894c33..01621b9 100644 --- a/generated-src/npc_helper.cpp +++ b/generated-src/npc_helper.cpp @@ -23,7 +23,7 @@ void NpcHelper::the_lamb_pattern(Entity_NPC *npc, int pattern, int frame) params.Scale = 1.8; params.FallingAccelModifier = -0.06; params.FallingSpeedModifier = -2.0; - target = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(npc); dirX = (target->_pos).x - (npc->_pos).x; dirY = (target->_pos).y - (npc->_pos).y; fVar2 = sqrtf(dirX * dirX + dirY * dirY); @@ -480,7 +480,7 @@ Vector * NpcHelper::colostomia_pick_target(Entity_NPC *npc, Vector *outTarget, u } while (uVar4 < GHIDRA_UINT(effects._size)); outTarget = local_718; } - playerTarget = (GHIDRA_CAST((local_720)))->Entity_NPC::GetPlayerTarget(); + playerTarget = Entity_NPC::GetPlayerTarget(local_720); game = g_game; local_718 = GHIDRA_CAST((playerTarget->_pos).x); local_720 = GHIDRA_CAST((playerTarget->_pos).y); @@ -606,7 +606,7 @@ void NpcHelper::colostomia_pick_dive_target(Entity_NPC *npc) npcLocal = npc; do { room = *roomRef; - candidatePos = (GHIDRA_CAST((room)))->Room::GetRandomPosition(&randomPos,0.0); + candidatePos = Room::GetRandomPosition(room,&randomPos,0.0); candidatePos = Room::FindFreePickupSpawnPosition(room,&freePos,candidatePos,0.0,0,0,0); pEVar7 = npcLocal; fVar10 = candidatePos->x; @@ -621,7 +621,7 @@ void NpcHelper::colostomia_pick_dive_target(Entity_NPC *npc) fVar9 = (nearestPlayer->_pos).x - diveTarget->x; local_24 = GHIDRA_CAST(sqrtf(fVar10 * fVar10 + fVar9 * fVar9)); roomSlot = &g_game->_room; - bVar1 = (GHIDRA_CAST((*roomSlot)))->Room::IsPositionInRoom(diveTarget,60.0); + bVar1 = Room::IsPositionInRoom(*roomSlot,diveTarget,60.0); if (bVar1 != 0) { room = *roomSlot; iVar6 = GHIDRA_INT(((diveTarget->x - 40.0) / 40.0 + 0.5)); @@ -633,7 +633,7 @@ void NpcHelper::colostomia_pick_dive_target(Entity_NPC *npc) else { iVar6 = room->_gridWidth * iVar4 + iVar6; } - uVar2 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar6); + uVar2 = Room::GetGridCollision(room,iVar6); pEVar7 = npcLocal; if ((((uVar2 == 0) && (80.0 <= (float)local_20)) && (((float)local_20 <= 200.0 && (120.0 < (float)local_24)))) && @@ -743,7 +743,7 @@ void NpcHelper::delirium_remove_minions(int type, int variant, Entity *self, Ent do { tmpEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x125c)) + npcIdx * 4)); if ((tmpEntity == self) || - (cVar4 = tmpEntity->IsBoss(uVar5), cVar4 == '\0')) { + (cVar4 = (**(code **)(*GHIDRA_CAST(tmpEntity) + 0x4c))(uVar5), cVar4 == '\0')) { LAB_004a62c2: if (other != GHIDRA_CAST(0x0)) { iVar6 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x125c)); @@ -902,7 +902,7 @@ void NpcHelper::delirium_spawn_form_parts(Entity_NPC *npc, float maxHealth) if (npc->_type == 0x13) { uVar5 = Random(); segmentCount = uVar5 % 6 + 4; - target = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(npc); dirY = (npc->_pos).x - (target->_pos).x; local_c = (void *)((npc->_pos).y - (target->_pos).y); fVar8 = sqrtf(dirY * dirY + (float)local_c * (float)local_c); @@ -1055,7 +1055,7 @@ LAB_004a8abb: ((animData[0x34] != 0 && ((pEVar6->_sprite)._animState._isPlaying == 0)))) goto LAB_004a8acc; } - pEVar6->Update(); + (**(code **)(*GHIDRA_CAST(pEVar6) + 0xc))(); segmentIndex = (float)(GHIDRA_INT(segmentIndex) + 1); npc = local_24; pEVar6 = formNpc; @@ -1337,7 +1337,7 @@ LAB_004a912d: case 10: burstCount = 1; fireInterval = 0x12; - target = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(npc); local_158 = (target->_pos).y - (npc->_pos).y; local_164 = (target->_pos).x - (npc->_pos).x; fVar8 = sqrtf(local_158 * local_158 + local_164 * local_164); @@ -2024,7 +2024,7 @@ void NpcHelper::gideon_spawn_stairs(Entity_NPC *npc) __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U); if (g_invalidRoomDescriptorGuard == -1) { local_8 = 0; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); + RoomDescriptor::constructor(&g_roomDescriptorDummy); _atexit(FUN_00b15b30); local_8 = 0xffffffff; _Init_thread_footer(&g_invalidRoomDescriptorGuard); @@ -2064,7 +2064,7 @@ void NpcHelper::gideon_spawn_stairs(Entity_NPC *npc) } pRVar2 = local_18; if (uVar3 < 0x1c0) { - gridCollision = (GHIDRA_CAST((local_18)))->Room::GetGridCollision(uVar3); + gridCollision = Room::GetGridCollision(local_18,uVar3); if (GHIDRA_INT(gridCollision) < 1) { stairs = operator_new(0x154); local_8 = 0x12; @@ -2601,7 +2601,7 @@ void NpcHelper::gideon_spawn_wave() while (local_50 == puVar4) { local_84.y = (float)&local_4c->_roomConfig; local_60 = 0; - local_9c.y = (float)(GHIDRA_CAST((room)))->Room::GetRoomShape(); + local_9c.y = (float)Room::GetRoomShape(room); if (local_4c->_challenge == 0x2c) { stageType = Level::GetRoomStageType(GHIDRA_CAST(local_4c),local_4c->_currentRoomIdx); uVar5 = local_4c->_stage; @@ -2670,7 +2670,7 @@ LAB_004b1ace: spawnVariant = spawnVariant >> ((uint8_t)local_90 & 0x1f) ^ spawnVariant; spawnVariant = spawnVariant << ((uint8_t)((uint64_t)local_90 >> 0x20) & 0x1f) ^ spawnVariant; spawnVariant = spawnVariant >> ((uint8_t)local_5c & 0x1f) ^ spawnVariant; - (GHIDRA_CAST((room)))->Room::TransformEntry(&spawnEntry,uVar5,spawnVariant); + Room::TransformEntry(room,&spawnEntry,uVar5,spawnVariant); if (GHIDRA_INT(spawnEntry) < 1000) { if ((spawnEntry == 0x339) && (pitCount < 6)) { local_50 = entriesBegin; @@ -2712,7 +2712,7 @@ LAB_004b1ccf: do { local_84.x = (float)(GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(local_4c) + -4))) % room->_gridWidth) * 40.0 + 40.0; local_84.y = (float)(GHIDRA_INT(*GHIDRA_CAST((GHIDRA_CAST(local_4c) + -4))) / room->_gridWidth) * 40.0 + 120.0; - (GHIDRA_CAST((room)))->Room::FindFreeTilePosition(&local_9c,&local_84,0.0); + Room::FindFreeTilePosition(room,&local_9c,&local_84,0.0); if (spawnVariant == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); @@ -3010,7 +3010,7 @@ LAB_004b3c68: *GHIDRA_CAST((afterimage + 1)) = 0; afterimage->_health = 0.0; afterimage->_maxHitPoints = 0.0; - afterimage->Update(); + (**(code **)(*GHIDRA_CAST(afterimage) + 0xc))(); ExceptionList = local_10; return afterimage; } @@ -3190,7 +3190,7 @@ LAB_004b42a6: *GHIDRA_CAST(&npcLocal->_stateFrame) = 0xffff; npcLocal->_state = uVar2; if (uVar2 == 7) { - (GHIDRA_CAST((npcLocal)))->Entity_NPC::ClearDequeRefs(); + Entity_NPC::ClearDequeRefs(npcLocal); if (pEVar1->_child != 0) { local_38 = &pEVar1->_child; msvc::multiset::erase(&local_38); @@ -3634,7 +3634,7 @@ void NpcHelper::hornfel_remove_doors() scratchVec.x = *GHIDRA_CAST((*hornfelDoorIter + 0x33c)); scratchVec.y = *GHIDRA_CAST((*hornfelDoorIter + 0x340)); pEVar4 = Game::Spawn(g_game,1000,0xf,&scratchVec,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3); - pEVar4->SetColor(&local_40,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(pEVar4) + 0x3c))(&local_40,0xffffffff,0xff,0,1); (**(code **)(*GHIDRA_CAST(*hornfelDoorIter) + 0x28))(); hornfelDoorIter = local_44; local_44 = piVar6; @@ -4057,7 +4057,7 @@ LAB_004b8213: local_58.y = (float)npc->_minecart; if (GHIDRA_CAST(local_58.y) != GHIDRA_CAST(0x0)) { FUN_004cf0f0(1); - (GHIDRA_CAST((GHIDRA_CAST(local_58.y))))->Entity_NPC::SetMinecartPosVel(&pEVar5->_targetPosition,&local_50); + Entity_NPC::SetMinecartPosVel(GHIDRA_CAST(local_58.y),&pEVar5->_targetPosition,&local_50); fVar8 = (GHIDRA_CAST((GHIDRA_INT(local_58.y) + 0x33c)))->y; (npc->_pos).x = (GHIDRA_CAST((GHIDRA_INT(local_58.y) + 0x33c)))->x; (npc->_pos).y = fVar8; @@ -4306,7 +4306,7 @@ void NpcHelper::hornfel_ride_minecart(Entity_NPC *linkedNpc) if ('\0' < *GHIDRA_CAST((GHIDRA_INT(&linkedNpc->_projectileDelay) + 2))) { ExceptionList = &local_10; hornfel_get_rail_direction(linkedNpc,&scratchVec); - (GHIDRA_CAST((minecart)))->Entity_NPC::SetMinecartPosVel(&linkedNpc->_targetPosition,&scratchVec); + Entity_NPC::SetMinecartPosVel(minecart,&linkedNpc->_targetPosition,&scratchVec); fVar4 = (minecart->_pos).x; fVar6 = (minecart->_pos).y; pcVar1 = GHIDRA_CAST((GHIDRA_INT(&linkedNpc->_projectileDelay) + 2)); @@ -4495,7 +4495,7 @@ LAB_004b8df1: rng._shift2 = 9; rng._shift3 = 7; uVar1 = (GHIDRA_CAST((GHIDRA_CAST(&picker))))->WeightedOutcomePicker::PickOutcome(rng); - target = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(npc); local_28 = GHIDRA_CAST(((target->_pos).x - (npc->_pos).x)); targetDirY = (target->_pos).y - (npc->_pos).y; targetDist = sqrtf((float)local_28 * (float)local_28 + targetDirY * targetDirY); @@ -4848,7 +4848,7 @@ int NpcHelper::hornfel_next_rail_index(Entity_NPC *npc) } nextPos.x = (float)directionSign * 40.0 + (npc->_targetPosition).x; nextPos.y = (npc->_targetPosition).y + 0.0; - iVar1 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&nextPos); + iVar1 = Room::GetGridIndex(room,&nextPos); return iVar1; } if (GHIDRA_INT(railDirection) < 0) { @@ -4859,7 +4859,7 @@ int NpcHelper::hornfel_next_rail_index(Entity_NPC *npc) } nextPos.x = (npc->_targetPosition).x + 0.0; nextPos.y = (float)directionSign * 40.0 + (npc->_targetPosition).y; - iVar1 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&nextPos); + iVar1 = Room::GetGridIndex(room,&nextPos); return iVar1; } } @@ -4982,7 +4982,7 @@ void NpcHelper::hornfel_room_controller(Entity_Effect *effect) } if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 4)) + 0x44)) & 1) != 0) { hornfel_remove_doors(); - effect->Remove(); + (**(code **)(*GHIDRA_CAST(effect) + 0x28))(); } roomWidth = *GHIDRA_CAST((GHIDRA_CAST(room) + 0x12cc)) + *GHIDRA_CAST((GHIDRA_CAST(room) + 0x12c8)); iVar4 = 0; @@ -5017,7 +5017,7 @@ void NpcHelper::hornfel_room_controller(Entity_Effect *effect) *GHIDRA_CAST(&cart->_flags) = GHIDRA_UINT(cart->_flags) & 0xfffffffb; *GHIDRA_CAST((GHIDRA_INT(&cart->_flags) + 4)) = uVar1; cart->_spawnerType = 0x38a; - (GHIDRA_CAST((cart)))->Entity::GiveMinecart(&npc->_targetPosition,&railDirection); + Entity::GiveMinecart(cart,&npc->_targetPosition,&railDirection); hornfel_claim_target(npc,cart); } } @@ -5061,7 +5061,7 @@ uint8_t NpcHelper::horny_boys_pick_position(Entity_NPC *npc) (npc->_targetPosition).x = g_vectorZero.x; (npc->_targetPosition).y = g_vectorZero.y; do { - (GHIDRA_CAST((game->_room)))->Room::GetRandomPosition(&candidatePos,20.0); + Room::GetRandomPosition(game->_room,&candidatePos,20.0); room = g_game->_room; gridX = GHIDRA_INT(((candidatePos.x - 40.0) / 40.0 + 0.5)); iVar1 = GHIDRA_INT(((candidatePos.y - 120.0) / 40.0 + 0.5)); @@ -5375,7 +5375,7 @@ void NpcHelper::horny_boys_render(Entity_NPC *npc, Vector *offset) void *animData; float offsetY; - (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::Render(offset); + Entity::Render(GHIDRA_CAST(npc),offset); renderScale = g_displayPixelRatio * g_screenPointScale; dVar2 = floor((double)(((((npc->_posOffset).x + (npc->_pos).x) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * renderScale + 0.5)); @@ -5469,7 +5469,7 @@ void NpcHelper::minecart_break(Entity_NPC *minecart) Manager *manager; local_14 = (float)(__security_cookie ^ GHIDRA_UINT(((&particleColor)[1]._tint + 1))); - minecart->Remove(); + (**(code **)(*GHIDRA_CAST(minecart) + 0x28))(); manager = g_manager; local_44 = GHIDRA_CAST(0x1e1); seed_fart_sound_override(GHIDRA_CAST(&local_44)); @@ -5595,7 +5595,7 @@ void NpcHelper::moms_heart_attack_pattern(Entity_NPC *npc, int pattern, int stat projParams.Scale = 1.5; projParams.FallingAccelModifier = -0.06; projParams.FallingSpeedModifier = -2.0; - target = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(npc); local_f4 = (target->_pos).x - (npc->_pos).x; local_e4 = (target->_pos).y - (npc->_pos).y; fVar3 = sqrtf(local_e4 * local_e4 + local_f4 * local_f4); @@ -5799,7 +5799,7 @@ void NpcHelper::moms_heart_attack_pattern(Entity_NPC *npc, int pattern, int stat laser->_rotationDegrees = local_d0.x; laser->_rotationSpd = rotationSpeed; laser->_timeout = iVar1 + GHIDRA_INT(local_f4) + 1; - laser->Update(); + (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); local_f0 = (float)(GHIDRA_INT(local_f0) + 1); } while (GHIDRA_INT(local_f0) < 4); return; @@ -6015,7 +6015,7 @@ LAB_004d358e: laser->_rotationDegrees = fVar5; laser->_rotationSpd = fVar3; laser->_timeout = GHIDRA_INT(local_d4); - laser->Update(); + (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); iVar1 = iVar1 + 1; } while (iVar1 < 2); return; @@ -6184,7 +6184,7 @@ Entity_NPC * NpcHelper::gaper_l2_spawn_maggot(Vector *origin, float yOffset, Vec else { (maggot->_posOffset).y = yOffset; } - maggot->Update(); + (**(code **)(*GHIDRA_CAST(maggot) + 0xc))(); fVar3 = (maggot->_velocity).x; dirY = (maggot->_velocity).y; seed = maggot->_initSeed; @@ -6254,8 +6254,8 @@ void NpcHelper::twitchy_jump_target(Vector *outTarget, Entity_NPC *npc) Room *room; room = g_game->_room; - (GHIDRA_CAST((npc)))->Entity_NPC::CalcTargetPosition(outTarget,0.0); - playerTarget = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + Entity_NPC::CalcTargetPosition(npc,outTarget,0.0); + playerTarget = Entity_NPC::GetPlayerTarget(npc); local_8 = (playerTarget->_velocity).y; fVar2 = (npc->_pos).x - (playerTarget->_pos).x; local_c = (playerTarget->_velocity).x; @@ -6316,9 +6316,9 @@ void NpcHelper::twitchy_jump_target(Vector *outTarget, Entity_NPC *npc) else { gridIndex = room->_gridWidth * gridRow + gridIndex; } - gridCollision = (GHIDRA_CAST((room)))->Room::GetGridCollision(gridIndex); + gridCollision = Room::GetGridCollision(room,gridIndex); if (0 < GHIDRA_INT(gridCollision)) { - resultPos = (GHIDRA_CAST((room)))->Room::FindFreeTilePosition(&scratchVec,outTarget,64.0); + resultPos = Room::FindFreeTilePosition(room,&scratchVec,outTarget,64.0); outTarget->x = resultPos->x; outTarget->y = resultPos->y; } @@ -6380,7 +6380,7 @@ void NpcHelper::gutted_fatty_burst_projectiles(Entity *timer) Entity_Projectile::apply_spawn_flags (pEVar1,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(timer[1])) + 0x40)))), *GHIDRA_CAST((timer[1]._sprite._animDefaultName._buf + 8)),timer->_flags,GHIDRA_CAST(0x0)); - pEVar1->Update(); + (**(code **)(*GHIDRA_CAST(pEVar1) + 0xc))(); projectilesLeft = projectilesLeft + -1; } while (projectilesLeft != 0); projectilesLeft = 2; @@ -6421,7 +6421,7 @@ void NpcHelper::gutted_fatty_burst_projectiles(Entity *timer) Entity_Projectile::apply_spawn_flags (pEVar1,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(timer[1])) + 0x40)))), *GHIDRA_CAST((timer[1]._sprite._animDefaultName._buf + 8)),timer->_flags,GHIDRA_CAST(0x0)); - pEVar1->Update(); + (**(code **)(*GHIDRA_CAST(pEVar1) + 0xc))(); projectilesLeft = projectilesLeft + -1; } while (projectilesLeft != 0); return; @@ -6445,7 +6445,7 @@ uint8_t NpcHelper::candler_is_free_cell(Vector *position) else { gridY = room->_gridWidth * gridY + gridY; } - uVar1 = (GHIDRA_CAST((room)))->Room::GetGridCollision(gridY); + uVar1 = Room::GetGridCollision(room,gridY); if (((((uVar1 == 0) && (gridY = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)), -1 < gridY)) && ((gridY < room->_gridWidth && ((gridY = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)), -1 < gridY && @@ -6506,7 +6506,7 @@ uint8_t NpcHelper::whipper_is_target(Entity_NPC *npc, Entity *entity) } return 0; } - bVar2 = (GHIDRA_CAST((entity)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); + bVar2 = Entity::IsVulnerableEnemy(entity,GHIDRA_CAST(0x0)); if (bVar2 != 0) { return 1; } @@ -6776,7 +6776,7 @@ LAB_0052926a: if (uVar7 < 0x12d) { if (uVar7 == 300) { while ((local_124 = local_114, local_114 == 0.0 || - (cVar6 = pEVar11->Kill(), cVar6 != '\0'))) { + (cVar6 = (**(code **)(*GHIDRA_CAST(pEVar11) + 0x24))(), cVar6 != '\0'))) { if (uVar8 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); fnPtr = (code *)swi(3); @@ -6841,7 +6841,7 @@ LAB_005290ba: else { if (uVar7 != 0x15e) goto LAB_0052926a; while ((local_124 = local_114, local_114 == 0.0 || - (cVar6 = pEVar11->guard_check_icall(), cVar6 != '\0'))) { + (cVar6 = (**(code **)(*GHIDRA_CAST(pEVar11) + 0x2c))(), cVar6 != '\0'))) { local_114 = (float)ItemPool::GetTrinket(&g_game->_itemPool,0); } } @@ -6883,7 +6883,7 @@ LAB_00529272: iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)); *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)) = iVar10 + 1; pEVar11->_index = iVar10; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x1218)))))->EntityList::AddEntity(pEVar11); + EntityList::AddEntity(GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x1218)),pEVar11); isErased = Game::ShouldEraseEnemy(pEVar11); if (isErased != 0) { Entity::RemoveWithPoof(pEVar11,unusedArg); @@ -6952,7 +6952,7 @@ LAB_00529568: *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_120[1])) + 0x4)))) = iVar10; uVar7 = Random(); pEVar11 = Game::Spawn(g_game,1000,2,&spawnPos,bloodVel,GHIDRA_CAST(0x0),1,uVar7); - pEVar11->SetColor(&DAT_00c5c800,0xffffffff,0xff); + (**(code **)(*GHIDRA_CAST(pEVar11) + 0x3c))(&DAT_00c5c800,0xffffffff,0xff); (pEVar11->_sprite)._offset.x = 0.0; (pEVar11->_sprite)._offset.y = -5.0; pEVar11->_renderDepthOffset = 10.0; @@ -7108,7 +7108,7 @@ LAB_00529a2e: iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)); *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)) = iVar10 + 1; pEVar11->_index = iVar10; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x1218)))))->EntityList::AddEntity(pEVar11); + EntityList::AddEntity(GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x1218)),pEVar11); isErased = Game::ShouldEraseEnemy(pEVar11); if (isErased != 0) { Entity::RemoveWithPoof(pEVar11,unusedArg_00); @@ -7171,7 +7171,7 @@ LAB_00529ca4: (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + (((uVar14 >> 0x12) - uStack_cc) - GHIDRA_UINT((uVar8 < uVar7))) + GHIDRA_UINT(bVar15); } - pEVar11->SetColor(&DAT_00c5c800,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(pEVar11) + 0x3c))(&DAT_00c5c800,0xffffffff,0xff,0,1); spriteColor = &(pEVar11->_sprite)._color; if (&pEVar11->_splatColor != spriteColor) { fVar16 = (pEVar11->_sprite)._color._tint[1]; @@ -7192,7 +7192,7 @@ LAB_00529ca4: *GHIDRA_CAST((pEVar11->_sprite)._color._offset); (pEVar11->_splatColor)._offset[2] = (pEVar11->_sprite)._color._offset[2]; } - pEVar11->Update(); + (**(code **)(*GHIDRA_CAST(pEVar11) + 0xc))(); local_11c = GHIDRA_CAST((GHIDRA_INT(local_11c) + -1)); } while( true ); } @@ -7276,7 +7276,7 @@ void NpcHelper::leper_flesh_ai(Entity_NPC *npc) if (npc->_state != 0) { if (npc->_state == 4) { npc->_friction = npc->_friction * 0.95; - pVVar3 = (GHIDRA_CAST((npc)))->Entity_NPC::CalcTargetPosition(&local_d4,0.0); + pVVar3 = Entity_NPC::CalcTargetPosition(npc,&local_d4,0.0); local_c8 = GHIDRA_CAST((pVVar3->y - (npc->_pos).y)); local_c4 = pVVar3->x - (npc->_pos).x; fVar8 = sqrtf((float)local_c8 * (float)local_c8 + local_c4 * local_c4); @@ -7285,7 +7285,7 @@ void NpcHelper::leper_flesh_ai(Entity_NPC *npc) local_c8 = GHIDRA_CAST(((float)local_c8 * (1.0 / fVar8))); } if (npc->_controllerID != -1) { - pVVar3 = (GHIDRA_CAST((npc)))->Entity_NPC::GetControllerInput(&local_d4,0.0); + pVVar3 = Entity_NPC::GetControllerInput(npc,&local_d4,0.0); local_c4 = pVVar3->x; local_c8 = GHIDRA_CAST(pVVar3->y); } @@ -7363,14 +7363,14 @@ LAB_005489bd: (npc->_sprite)._flipX = ~((uint8_t)(uVar4 >> (SUB41(local_c4,0) & 0x1f)) ^ (uint8_t)uVar4) & 1; npc->_isKillOnTouch = 1; LAB_00548a4b: - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::IsFrame(10,0); + bVar2 = Entity::IsFrame(GHIDRA_CAST(npc),10,0); if (bVar2 != 0) { uVar4 = Random(); Entity_NPC::MakeSplat (npc,(float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 0.4 + 0.4); } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::IsFrame(6,0); + bVar2 = Entity::IsFrame(GHIDRA_CAST(npc),6,0); local_f0 = 0.3; uStack_ec = 0; uStack_e8 = 0; @@ -7420,10 +7420,10 @@ LAB_00548a4b: local_fc = g_vectorZero.y; local_f8 = 0; local_f4 = 0; - npc->Kill(&sourceRef); + (**(code **)(*GHIDRA_CAST(npc) + 0x24))(&sourceRef); } if ((npc->_dead != 0) && ((npc->_flags & 0x1000000) == 0)) { - pEVar7 = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + pEVar7 = Entity_NPC::GetPlayerTarget(npc); local_c8 = GHIDRA_CAST((pEVar7->_velocity).x); fVar8 = (npc->_pos).y - (pEVar7->_pos).y; local_c4 = (pEVar7->_velocity).y; @@ -7503,11 +7503,11 @@ void NpcHelper::bulb_player_collision(Entity_NPC *npc, Entity *collider) } damageSource._flags = uVar1 | uVar2 | GHIDRA_UINT(local_3c.x); damageSource._entity = npc; - collider->TakeDamage(0x3f800000,0,0,&damageSource,0x1e); + (**(code **)(*GHIDRA_CAST(collider) + 0x20))(0x3f800000,0,0,&damageSource,0x1e); } else { - sourceRef = (GHIDRA_CAST((&damageSource)))->EntityRef::EntityRef(); - collider->TakeDamage(0x41200000,0,0,sourceRef,0x1e); + sourceRef = EntityRef::EntityRef(&damageSource); + (**(code **)(*GHIDRA_CAST(collider) + 0x20))(0x41200000,0,0,sourceRef,0x1e); } npc->_state = 6; fVar5 = -(npc->_v1).x; @@ -7539,8 +7539,8 @@ void NpcHelper::bulb_player_collision(Entity_NPC *npc, Entity *collider) fVar3 = npc->_speedMultiplier; (npc->_velocity).x = proceduralIdx * 16.0 * fVar3 + (npc->_velocity).x; (npc->_velocity).y = fVar5 * 16.0 * fVar3 + (npc->_velocity).y; - (GHIDRA_CAST((GHIDRA_CAST(collider))))->Entity_Player::PlayExtraAnimation(&DAT_00b1d3b0); - (GHIDRA_CAST((GHIDRA_CAST(collider))))->Entity_Player::ResetItemState(); + Entity_Player::PlayExtraAnimation(GHIDRA_CAST(collider),&DAT_00b1d3b0); + Entity_Player::ResetItemState(GHIDRA_CAST(collider)); uVar2 = 0; game = g_game; do { @@ -7588,7 +7588,7 @@ LAB_0054cfd6: } if (((itemConfig != 0) && (0 < GHIDRA_INT(local_3c.x))) && ((uVar2 < 4 && (0 < GHIDRA_INT(collider[5]._sprite._championColor._colorize[uVar2 * 8 + 3]))))) { - chargeChange = (GHIDRA_CAST((GHIDRA_CAST(collider))))->Entity_Player::GetActiveMaxCharge(uVar2); + chargeChange = Entity_Player::GetActiveMaxCharge(GHIDRA_CAST(collider),uVar2); if (chargeChange == 1) { chargeChange = -1000; } @@ -8000,7 +8000,7 @@ void NpcHelper::willo_attack(Entity_NPC *npc) local_bc = 2.14399e-43; seed_fart_sound_override(GHIDRA_CAST(&local_bc)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_bc),1.0,2,0,local_b8,0.0); - target = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(npc); (GHIDRA_CAST((&projParams)))->ProjectileParams::ProjectileParams(); local_bc = ((target->_pos).x + (target->_velocity).x) - (npc->_pos).x; local_b8 = ((target->_pos).y + (target->_velocity).y) - (npc->_pos).y; @@ -8220,7 +8220,7 @@ void NpcHelper::bubbles_death_geyser_tick(Entity *owner) Entity_Projectile::apply_spawn_flags (projectile,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(owner[1])) + 0x40)))), *GHIDRA_CAST((owner[1]._sprite._animDefaultName._buf + 8)),owner->_flags,GHIDRA_CAST(0x0)); - projectile->Update(); + (**(code **)(*GHIDRA_CAST(projectile) + 0xc))(); lowShotsLeft = lowShotsLeft + -1; } while (lowShotsLeft != 0); highShotsLeft = 2; @@ -8262,7 +8262,7 @@ void NpcHelper::bubbles_death_geyser_tick(Entity *owner) Entity_Projectile::apply_spawn_flags (projectile,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(owner[1])) + 0x40)))), *GHIDRA_CAST((owner[1]._sprite._animDefaultName._buf + 8)),owner->_flags,GHIDRA_CAST(0x0)); - projectile->Update(); + (**(code **)(*GHIDRA_CAST(projectile) + 0xc))(); highShotsLeft = highShotsLeft + -1; } while (highShotsLeft != 0); return; @@ -8294,7 +8294,7 @@ uint8_t NpcHelper::polty_is_target_liftable(Entity_NPC *npc) return 0; } room = g_game->_room; - local_AL_113 = (GHIDRA_CAST((room)))->Room::CanPickupGridEntity(npc->_i2); + local_AL_113 = Room::CanPickupGridEntity(room,npc->_i2); if (local_AL_113 == 0) { return 0; } @@ -8409,21 +8409,22 @@ void NpcHelper::mother_spawn_parts() npc->_isInvicible = 1; *GHIDRA_CAST(&npc->_flags) = GHIDRA_UINT(npc->_flags) & 0xfffffffb | 0x80100011; *GHIDRA_CAST((GHIDRA_INT(&npc->_flags) + 4)) = uVar1; - (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::SetVisibleFlag(0); + Entity::SetVisibleFlag(GHIDRA_CAST(npc),0); if (npc->_parent != 0) { local_14 = GHIDRA_CAST(&npc->_parent); msvc::multiset::erase(&local_14); } npc->_parent = in_ECX; msvc::multiset::insert(&npc->_parent); - npc->Update(); + (**(code **)(*GHIDRA_CAST(npc) + 0xc))(); part2Pos.x = DAT_00c33d44 + (in_ECX->_pos).x; part2Pos.y = DAT_00c33d48 + (in_ECX->_pos).y; part2 = Game::Spawn(g_game,0x390,0,&part2Pos,&g_vectorZero,in_ECX,2,in_ECX->_initSeed); local_20 = -g_vectorOne.x; local_1c = GHIDRA_CAST(-g_vectorOne.y); local_14 = part2; - (GHIDRA_CAST((part2)))->Entity::SetSize(70.0,(Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); + Entity::SetSize(part2,70.0,(Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1 + ); offsetY = (in_ECX->_posOffset).y - DAT_00c33d48; (part2->_posOffset).x = (in_ECX->_posOffset).x - DAT_00c33d44; (part2->_posOffset).y = offsetY; @@ -8436,13 +8437,14 @@ void NpcHelper::mother_spawn_parts() flags = part2->_flags; *GHIDRA_CAST((GHIDRA_INT(&part2->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&part2->_flags) + 4)); *GHIDRA_CAST(&part2->_flags) = GHIDRA_UINT(flags) & 0xfffffffb | 0x80000000; - part2->Update(); + (**(code **)(*GHIDRA_CAST(part2) + 0xc))(); part3Pos.x = DAT_00c33d4c + (in_ECX->_pos).x; part3Pos.y = DAT_00c33d50 + (in_ECX->_pos).y; part2 = Game::Spawn(g_game,0x390,0,&part3Pos,&g_vectorZero,in_ECX,3,in_ECX->_initSeed); local_20 = -g_vectorOne.x; local_1c = GHIDRA_CAST(-g_vectorOne.y); - (GHIDRA_CAST((part2)))->Entity::SetSize(70.0,(Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); + Entity::SetSize(part2,70.0,(Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1 + ); offsetY = (in_ECX->_posOffset).y - DAT_00c33d50; (part2->_posOffset).x = (in_ECX->_posOffset).x - DAT_00c33d4c; (part2->_posOffset).y = offsetY; @@ -8455,7 +8457,7 @@ void NpcHelper::mother_spawn_parts() flags = part2->_flags; *GHIDRA_CAST((GHIDRA_INT(&part2->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&part2->_flags) + 4)); *GHIDRA_CAST(&part2->_flags) = GHIDRA_UINT(flags) & 0xfffffffb | 0x80000000; - part2->Update(); + (**(code **)(*GHIDRA_CAST(part2) + 0xc))(); local_18 = GHIDRA_CAST(0x0); msvc::deque::resize(3,&local_18); uVar2 = in_ECX[2]._dropRNG._seed; @@ -8544,8 +8546,8 @@ void NpcHelper::mother_2_slam_burst(float *param_1) (spawnedEffect->_posOffset).y = -10.0 - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 20.0; - spawnedEffect->SetColor(&g_colorGreenSplat,0xffffffff,0xff,0,1); - spawnedEffect->Update(); + (**(code **)(*GHIDRA_CAST(spawnedEffect) + 0x3c))(&g_colorGreenSplat,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(spawnedEffect) + 0xc))(); local_18 = param_1[1]; backDirX = *param_1; fVar4 = sqrtf(local_18 * local_18 + backDirX * backDirX); @@ -8577,7 +8579,7 @@ void NpcHelper::mother_2_slam_burst(float *param_1) local_34.x = local_24 * local_1c; local_34.y = local_24 * local_20; spawnedEffect = Game::Spawn(g_game,1000,4,&local_3c,&local_34,GHIDRA_CAST(0x0),0,rngResult); - spawnedEffect->Update(); + (**(code **)(*GHIDRA_CAST(spawnedEffect) + 0xc))(); iVar2 = iVar3 + -1; } while (iVar2 != 0); iVar3 = iVar3 + 0xb; @@ -8617,7 +8619,7 @@ void NpcHelper::mother_2_slam_burst(float *param_1) (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 360.0; (**(code **)(iVar2 + 0x3c))(&g_colorGreenSplat,0xffffffff,0xff,0,1); - spawnedEffect->Update(); + (**(code **)(*GHIDRA_CAST(spawnedEffect) + 0xc))(); iVar3 = iVar3 + -1; } while (iVar3 != 0); return; @@ -8711,7 +8713,7 @@ void NpcHelper::mother_render(Entity_NPC *npc, Vector *offset) } } else { - (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::Render(offset); + Entity::Render(GHIDRA_CAST(npc),offset); } return; } @@ -8753,7 +8755,7 @@ Entity * NpcHelper::clutch_find_farthest_orbital(Entity_NPC *clutch, int unused) if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (tmpEntity->_type == 1)) || (tmpEntity->_type - 10U < 0x3de)) { local_24 = *GHIDRA_CAST((GHIDRA_INT(&tmpEntity->_flags) + 4)); - isClutchFriendly = (GHIDRA_CAST((GHIDRA_CAST(clutch))))->Entity::IsFriendly(); + isClutchFriendly = Entity::IsFriendly(GHIDRA_CAST(clutch)); if (((extraout_DL == isClutchFriendly) && (GHIDRA_CAST(tmpEntity->_parent) == clutch)) && ((tmpEntity != GHIDRA_CAST(clutch->_child) && ((tmpEntity[2]._updateTime != 1.38729e-43 && @@ -8843,7 +8845,7 @@ void NpcHelper::clutch_spawn_fire(Entity_NPC *npc, Entity *target) addFlagsFn = *(code **)(*GHIDRA_CAST(target) + 0x24); local_54 = npc; local_24 = uVar5; - (GHIDRA_CAST((GHIDRA_CAST(local_4c))))->EntityRef::constructor(GHIDRA_CAST(npc)); + EntityRef::constructor(GHIDRA_CAST(local_4c),GHIDRA_CAST(npc)); (*addFlagsFn)(local_4c,uVar5); uVar5 = Random(); local_64.x = (local_58->_pos).x; @@ -8935,7 +8937,7 @@ LAB_00572e7c: } while (pbVar6 < GHIDRA_CAST((local_50->_sprite)._layerCount)); npc = local_54; } - local_50->Update(); + (**(code **)(*GHIDRA_CAST(local_50) + 0xc))(); local_50 = GHIDRA_CAST(0x2); do { uVar5 = Random(); @@ -9189,7 +9191,7 @@ LAB_00575ed0: pLVar1->_visible = 0; } } - (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::Render(offset); + Entity::Render(GHIDRA_CAST(npc),offset); return; } @@ -9239,7 +9241,7 @@ void NpcHelper::raglich_pick_target_pos(Entity_NPC *npc, float speed) local_24.y = local_24.y * 40.0; local_c.x = clampedPos.x + local_14.y; local_c.y = clampedPos.y + local_24.y; - isInRoom = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(&local_c,0.0); + isInRoom = Room::IsPositionInRoom(room,&local_c,0.0); if (isInRoom == 0) { direction = (GHIDRA_INT((short)npc->_i1) - GHIDRA_INT(*GHIDRA_CAST((GHIDRA_INT(&npc->_i1) + 2)))) + 4U & 0x80000003; if (GHIDRA_INT(direction) < 0) { @@ -9265,18 +9267,18 @@ void NpcHelper::raglich_pick_target_pos(Entity_NPC *npc, float speed) probePos.y = clampedPos.y - local_1c.y * 40.0; local_1c.y = probePos.y; local_c.y = probePos.x; - isInRoom = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(&probePos,0.0); + isInRoom = Room::IsPositionInRoom(room,&probePos,0.0); if (isInRoom == 0) goto LAB_00576404; probePos.x = local_c.y - local_14.y; probePos.y = local_1c.y - local_24.y; - isInRoom = (GHIDRA_CAST((room)))->Room::IsPositionInRoom(&probePos,0.0); + isInRoom = Room::IsPositionInRoom(room,&probePos,0.0); if (isInRoom != 0) goto LAB_00576404; direction = (short)npc->_i1 + 4 + GHIDRA_INT(*GHIDRA_CAST((GHIDRA_INT(&npc->_i1) + 2))) & 0x80000003; if (GHIDRA_INT(direction) < 0) { direction = (direction - 1 | 0xfffffffc) + 1; } *GHIDRA_CAST(&npc->_i1) = (short)direction; - iVar3 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&clampedPos); + iVar3 = Room::GetGridIndex(room,&clampedPos); row = iVar3 / room->_gridWidth; iVar3 = iVar3 % room->_gridWidth; } @@ -9341,11 +9343,11 @@ void NpcHelper::raglich_slam_spawn_grid(Entity_NPC *npc) posY = (npc->_pos).y; (npc->_velocity).x = (npc->_targetPosition).x - (npc->_pos).x; (npc->_velocity).y = targetY - posY; - (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::GetNullOffset(&slamOffset,&DAT_00b1d3b0); + Entity::GetNullOffset(GHIDRA_CAST(npc),&slamOffset,&DAT_00b1d3b0); if ((slamOffset.x != g_vectorZero.x) || (slamOffset.y != g_vectorZero.y)) { if (npc->_i1 == 0) { npc->_i1 = 1; - (GHIDRA_CAST((npc)))->Entity_NPC::PlaySound(0x34,1.0,2,0,1.0); + Entity_NPC::PlaySound(npc,0x34,1.0,2,0,1.0); Game::ShakeScreen(g_game,0xe); } local_68.x = slamOffset.x + (npc->_pos).x; @@ -9430,7 +9432,7 @@ void NpcHelper::raglich_slam_spawn_grid(Entity_NPC *npc) } if (((npc->_sprite)._animState._animData == (void *)0x0) || ((npc->_sprite)._animState._isPlaying == 0)) { - npc->Remove(uVar2); + (**(code **)(*GHIDRA_CAST(npc) + 0x28))(uVar2); ExceptionList = local_10; return; } @@ -9601,7 +9603,7 @@ Entity_Laser * NpcHelper::ReapCreep_ThinLaser(Entity_NPC *npc, float startAngle, pEVar1->_rotationSpd = (float)rotationSpeed; pEVar1->_renderDepthOffset = 1000.0; pEVar1->_rotationDegrees = savedEndAngle - savedStartAngle; - pEVar1->Update(); + (**(code **)(*GHIDRA_CAST(pEVar1) + 0xc))(); return pEVar1; } @@ -9770,7 +9772,7 @@ void NpcHelper::scourge_chain_shoot() } local_e8 = *GHIDRA_CAST((chainEnd + 0x33c)) - local_e8; local_ec = *GHIDRA_CAST((chainEnd + 0x340)) - local_ec; - pEVar1 = (GHIDRA_CAST((in_ECX)))->Entity_NPC::GetPlayerTarget(); + pEVar1 = Entity_NPC::GetPlayerTarget(in_ECX); local_c8 = local_e8 - childChainOffsetX; local_cc = (pEVar1->_pos).y - (in_ECX->_pos).y; local_dc = (pEVar1->_pos).x - (in_ECX->_pos).x; @@ -9877,7 +9879,7 @@ void NpcHelper::scourge_chain_shoot() effectPos.y = local_c8 * 4.0 + shootPos.y; rngResult = Random(); pEVar1 = Game::Spawn(g_game,1000,2,&effectPos,&g_vectorZero,GHIDRA_CAST(0x0),1,rngResult); - pEVar1->SetColor(&g_colorGreenSplat,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(pEVar1) + 0x3c))(&g_colorGreenSplat,0xffffffff,0xff,0,1); (pEVar1->_sprite)._offset.x = 0.0; (pEVar1->_sprite)._offset.y = -20.0; pEVar1->_renderDepthOffset = 10.0; @@ -10060,7 +10062,7 @@ void NpcHelper::siren_charm_familiar(Entity_NPC *npc, Entity_Familiar *familiar) if ((void *)local_14.y != (void *)0x0) { msvc::multiset::insert(refSlot); } - familiar->Update(); + (**(code **)(*GHIDRA_CAST(familiar) + 0xc))(); seed = Random(); local_1c.x = (pEVar3->_velocity).x; local_1c.y = (pEVar3->_velocity).y; @@ -10100,7 +10102,7 @@ void NpcHelper::siren_charm_familiar(Entity_NPC *npc, Entity_Familiar *familiar) if (pvVar1 != (void *)0x0) { msvc::multiset::insert(refSlot); } - secondEffect->Update(); + (**(code **)(*GHIDRA_CAST(secondEffect) + 0xc))(); } return; } @@ -10205,7 +10207,7 @@ int NpcHelper::siren_charmed_count(Entity_NPC *npc) familiar = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_24)) + 0x4))) + uVar2 * 4)); if ((((familiar != GHIDRA_CAST(0x0)) && (familiar->_type == 3)) && ((familiar->_flags & 0x100) != 0)) && - ((isDetached = (GHIDRA_CAST((familiar)))->Entity_Familiar::is_detached_from_follow(), uVar2 = extraout_EDX, + ((isDetached = Entity_Familiar::is_detached_from_follow(familiar), uVar2 = extraout_EDX, isDetached != 0 && (*(void **)(extraout_ECX + 0x410) == siren->_sirenPlayerEntity)))) { count = count + 1; } @@ -10589,7 +10591,7 @@ void NpcHelper::siren_familiar_orbit(Entity_NPC *siren, Entity_Familiar *familia if (chainFamiliar != GHIDRA_CAST(0x0)) { chainType = chainFamiliar->_type; while (chainType == 3) { - isDetached = (GHIDRA_CAST((chainFamiliar)))->Entity_Familiar::is_detached_from_follow(); + isDetached = Entity_Familiar::is_detached_from_follow(chainFamiliar); if (isDetached != 0) { detachedAheadCount = detachedAheadCount + 1; } @@ -10603,7 +10605,7 @@ void NpcHelper::siren_familiar_orbit(Entity_NPC *siren, Entity_Familiar *familia if (chainFamiliar != GHIDRA_CAST(0x0)) { chainType = chainFamiliar->_type; while (chainType == 3) { - isDetached = (GHIDRA_CAST((chainFamiliar)))->Entity_Familiar::is_detached_from_follow(); + isDetached = Entity_Familiar::is_detached_from_follow(chainFamiliar); orbitSlot = extraout_EDX_00; if (isDetached != 0) { orbitSlot = extraout_EDX_00 + 1; @@ -11127,7 +11129,7 @@ void NpcHelper::UltraGreed_Heal(Entity_NPC *npc, int amount) uStack_18 = 0; local_10 = flashIntensity * 0.84; local_c = flashIntensity * 0.0; - npc->SetColor(&healColor,healStacks,0xff,1,1); + (**(code **)(*GHIDRA_CAST(npc) + 0x3c))(&healColor,healStacks,0xff,1,1); return; } @@ -11243,7 +11245,7 @@ void NpcHelper::UltraGreed_Smash(Entity_NPC *npc, Vector position) local_24 = __security_cookie ^ GHIDRA_UINT(((&explosionColor)[1]._colorize + 1)); ExceptionList = &local_1c; boss = npc; - (GHIDRA_CAST((npc)))->Entity_NPC::CreateGoldParticles(0x1e); + Entity_NPC::CreateGoldParticles(npc,0x1e); manager = g_manager; local_80 = 1.93379e-43; seed_fart_sound_override(GHIDRA_CAST(&local_80)); @@ -11685,7 +11687,7 @@ float NpcHelper::visage_score_position(Entity_NPC *npc, Vector *position) float local_1c; float local_18; - pEVar2 = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + pEVar2 = Entity_NPC::GetPlayerTarget(npc); iVar1 = npc->_child; if (iVar1 == 0) { fVar3 = (pEVar2->_pos).y - position->y; @@ -11888,7 +11890,7 @@ LAB_005ab33c: fVar3 = 1000.0; } laser->_renderDepthOffset = fVar3; - laser->Update(); + (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); return; } @@ -12075,9 +12077,9 @@ uint8_t NpcHelper::visage_handle_collision(Entity_NPC *npc, Entity *collider, in if (((npc->_state != 0x76) || (collider->_type != 0x387)) || (collider->_variant != 0x14)) { return 0xff; } - (GHIDRA_CAST((npc)))->Entity_NPC::PlaySound(0xb9,1.0,2,0,(float)npc->_stateFrame * 0.15 + 1.0); + Entity_NPC::PlaySound(npc,0xb9,1.0,2,0,(float)npc->_stateFrame * 0.15 + 1.0); npc->_stateFrame = npc->_stateFrame + 1; - collider->Remove(); + (**(code **)(*GHIDRA_CAST(collider) + 0x28))(); local_34 = 0x3f800000; uStack_30 = 0x3f800000; uStack_2c = 0x3f800000; @@ -12089,7 +12091,7 @@ uint8_t NpcHelper::visage_handle_collision(Entity_NPC *npc, Entity *collider, in uStack_20 = 0; uStack_1c = 0; uStack_18 = 0; - npc->SetColor(&local_34,10,0xff,1,1); + (**(code **)(*GHIDRA_CAST(npc) + 0x3c))(&local_34,10,0xff,1,1); healCap = npc->_maxHitPoints * 0.4; newHealth = npc->_maxHitPoints * 0.025 + npc->_health; if (healCap <= newHealth) { @@ -12116,7 +12118,7 @@ uint8_t NpcHelper::visage_handle_collision(Entity_NPC *npc, Entity *collider, in return 0xff; } if ((npc->_state == 0x6a) || (npc->_state == 0x6d)) { - collider->Remove(); + (**(code **)(*GHIDRA_CAST(collider) + 0x28))(); local_34 = 0x3f800000; uStack_30 = 0x3f800000; uStack_2c = 0x3f800000; @@ -12128,7 +12130,7 @@ uint8_t NpcHelper::visage_handle_collision(Entity_NPC *npc, Entity *collider, in uStack_20 = 0; uStack_1c = 0; uStack_18 = 0; - npc->SetColor(&local_34,10,0xff,1,1); + (**(code **)(*GHIDRA_CAST(npc) + 0x3c))(&local_34,10,0xff,1,1); visage_start_charge(npc); return 0xff; } @@ -12166,7 +12168,7 @@ uint8_t NpcHelper::visage_handle_collision(Entity_NPC *npc, Entity *collider, in } iVar2 = 0x8a; } - (GHIDRA_CAST((npc)))->Entity_NPC::PlaySound(iVar2,1.0,2,0,1.0); + Entity_NPC::PlaySound(npc,iVar2,1.0,2,0,1.0); LAB_005adfbb: targetRef = GHIDRA_CAST(FUN_005acc70()); if ((collider == targetRef) && (collider[2]._preInterpolatePos.x == 1.48538e-43)) { @@ -12197,7 +12199,7 @@ Entity * NpcHelper::wormwood_spawn_splash(Entity_NPC *npc) seed = Random(); splash = Game::Spawn(g_game,1000,0x84,&npc->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed); - splash->Update(); + (**(code **)(*GHIDRA_CAST(splash) + 0xc))(); manager = g_manager; soundId = 0x1da; seed_fart_sound_override(&soundId); @@ -12215,11 +12217,11 @@ uint8_t NpcHelper::is_target_valid(Entity *target) if (target->_type != 1) { return 0; } - bVar1 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity_Player::IsInvisible(); + bVar1 = Entity_Player::IsInvisible(GHIDRA_CAST(target)); isTargetable = bVar1 == 0; } else { - bVar1 = (GHIDRA_CAST((target)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); + bVar1 = Entity::IsVulnerableEnemy(target,GHIDRA_CAST(0x0)); if (bVar1 == 0) { return 0; } @@ -12372,11 +12374,11 @@ void NpcHelper::ChampionDrop(Entity_NPC *npc) return; } nearestPlayer = Game::GetNearestPlayer(g_game,&npc->_pos); - (GHIDRA_CAST((nearestPlayer)))->Entity_Player::AddBlueFlies(3,&npc->_pos,GHIDRA_CAST(0x0)); + Entity_Player::AddBlueFlies(nearestPlayer,3,&npc->_pos,GHIDRA_CAST(0x0)); return; case 5: dropVariant = 0x28; - if (((!isIceFrozen) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::HasEntityFlags(0x1000000), bVar2 == 0)) && + if (((!isIceFrozen) && (bVar2 = Entity::HasEntityFlags(GHIDRA_CAST(npc),0x1000000), bVar2 == 0)) && ((dropDir = &npc->_pos, 0x1e < g_game->_frameCount - npc->_spawnFrame || (nearestPlayer = Game::GetNearestPlayer(g_game,dropDir), fVar3 = (npc->_pos).y - (nearestPlayer->_pos).y, @@ -12412,7 +12414,7 @@ void NpcHelper::ChampionDrop(Entity_NPC *npc) case 0xd: dropVariant = 10; local_130 = GHIDRA_CAST(0x2); - if (((!isIceFrozen) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::HasEntityFlags(0x1000000), bVar2 == 0)) && + if (((!isIceFrozen) && (bVar2 = Entity::HasEntityFlags(GHIDRA_CAST(npc),0x1000000), bVar2 == 0)) && ((dropDir = &npc->_pos, 0x1e < g_game->_frameCount - npc->_spawnFrame || (nearestPlayer = Game::GetNearestPlayer(g_game,dropDir), fVar3 = (npc->_pos).y - (nearestPlayer->_pos).y, @@ -12469,7 +12471,7 @@ void NpcHelper::ChampionDrop(Entity_NPC *npc) if (!isIceFrozen) { uVar5 = Random(); spawned = Game::SpawnEx(g_game,0x12,0,&npc->_pos,&g_vectorZero,GHIDRA_CAST(npc),0,uVar5,0); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::HasEntityFlags(0x1000000); + bVar2 = Entity::HasEntityFlags(GHIDRA_CAST(npc),0x1000000); if (bVar2 != 0) { *GHIDRA_CAST(&spawned->_flags) = GHIDRA_UINT(spawned->_flags) & 0xfeffffff; *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); @@ -12496,7 +12498,7 @@ void NpcHelper::ChampionDrop(Entity_NPC *npc) } sourceRef._flags = uVar6 | uVar5 | GHIDRA_UINT(local_120); sourceRef._entity = npc; - (GHIDRA_CAST((spawned)))->Entity::AddShrink(&sourceRef,0x96,0,0); + Entity::AddShrink(spawned,&sourceRef,0x96,0,0); if (0 < spawned->_shrinkCountdown) { flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); *GHIDRA_CAST(&spawned->_flags) = GHIDRA_UINT(spawned->_flags) | 0x1000000; @@ -12602,7 +12604,7 @@ void NpcHelper::ChampionDrop(Entity_NPC *npc) } nearestPlayer = Game::GetNearestPlayer(g_game,&npc->_pos); uVar5 = (GHIDRA_CAST((GHIDRA_CAST(local_11c.x))))->RNG::RandomInt(3); - (GHIDRA_CAST((nearestPlayer)))->Entity_Player::AddBlueFlies(uVar5 + 4,&npc->_pos,GHIDRA_CAST(0x0)); + Entity_Player::AddBlueFlies(nearestPlayer,uVar5 + 4,&npc->_pos,GHIDRA_CAST(0x0)); return; case 0x16: if (isDropping == '\0') { @@ -12718,7 +12720,7 @@ LAB_006c0128: local_130 = GHIDRA_CAST((GHIDRA_INT(&local_130->x) + 1)); } while (local_130 < GHIDRA_CAST(0x7)); if ((char)local_12c == '\0') { - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::HasEntityFlags(0x1000000); + bVar2 = Entity::HasEntityFlags(GHIDRA_CAST(npc),0x1000000); if ((bVar2 == 0) && ((dropDir = &npc->_pos, 0x1e < g_game->_frameCount - npc->_spawnFrame || (nearestPlayer = Game::GetNearestPlayer(g_game,dropDir), @@ -12729,7 +12731,7 @@ LAB_006c0128: uVar5 = Random(); Game::SpawnEx(g_game,1000,1,dropDir,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5,0); } - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::HasEntityFlags(0x1000000); + bVar2 = Entity::HasEntityFlags(GHIDRA_CAST(npc),0x1000000); if ((bVar2 == 0) && ((dropDir = &npc->_pos, 0x1e < g_game->_frameCount - npc->_spawnFrame || (nearestPlayer = Game::GetNearestPlayer(g_game,dropDir), @@ -12758,9 +12760,9 @@ LAB_006c0128: } local_114.x = (float)local_120; local_114.y = local_138; - uVar5 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar4); + uVar5 = Room::GetGridCollision(room,iVar4); if (0 < GHIDRA_INT(uVar5)) { - dropDir = (GHIDRA_CAST((room)))->Room::FindFreeTilePosition(GHIDRA_CAST(&local_c8),&local_114,40.0); + dropDir = Room::FindFreeTilePosition(room,GHIDRA_CAST(&local_c8),&local_114,40.0); local_120 = GHIDRA_CAST(dropDir->x); local_138 = dropDir->y; } @@ -12809,7 +12811,7 @@ LAB_006c0128: local_12c = GHIDRA_CAST(dropCount); do { if (glyphOwner != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((glyphOwner)))->Entity_Player::GetGlyphOfBalanceDrop(GHIDRA_CAST(&dropVariant),GHIDRA_CAST(&local_130)); + Entity_Player::GetGlyphOfBalanceDrop(glyphOwner,GHIDRA_CAST(&dropVariant),GHIDRA_CAST(&local_130)); uVar5 = dropVariant; } if (uVar5 != 0) { @@ -12900,9 +12902,9 @@ void NpcHelper::fireplace_moveable_update(Entity_NPC *npc) else { isIgnoreDamage = '\0'; if ((0.2 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x7240))) && - (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::IsFrame(5,npc->_index), bVar1 != 0)) { - damageSource = (GHIDRA_CAST((&damageSourceRef)))->EntityRef::EntityRef(); - npc->TakeDamage(0x3f800000,0,0,damageSource,0x1e); + (bVar1 = Entity::IsFrame(GHIDRA_CAST(npc),5,npc->_index), bVar1 != 0)) { + damageSource = EntityRef::EntityRef(&damageSourceRef); + (**(code **)(*GHIDRA_CAST(npc) + 0x20))(0x3f800000,0,0,damageSource,0x1e); } } iVar3 = npc->_state; @@ -12916,7 +12918,7 @@ void NpcHelper::fireplace_moveable_update(Entity_NPC *npc) npc->_health = fVar4; if (((npc->_sprite)._animState._animData == (void *)0x0) || ((npc->_sprite)._animState._isPlaying == 0)) { - npc->Remove(); + (**(code **)(*GHIDRA_CAST(npc) + 0x28))(); } } goto LAB_006d1556; @@ -13007,10 +13009,10 @@ LAB_006d114a: } } if (((npc->_spawnerType == 0x3b7) && - (iVar3 = (GHIDRA_CAST((GHIDRA_CAST(npc))))->Entity::GetIntervalTicks(30.0,0.0), iVar3 != 0)) && + (iVar3 = Entity::GetIntervalTicks(GHIDRA_CAST(npc),30.0,0.0), iVar3 != 0)) && (uVar2 = Random(), (uVar2 & 3) == 0)) { - damageSource = (GHIDRA_CAST((&damageSourceRef)))->EntityRef::EntityRef(); - npc->TakeDamage(0x3f800000,0x20000,0,damageSource,0x1e); + damageSource = EntityRef::EntityRef(&damageSourceRef); + (**(code **)(*GHIDRA_CAST(npc) + 0x20))(0x3f800000,0x20000,0,damageSource,0x1e); } if (npc->_pendingDamage <= 0.0) goto LAB_006d1556; if ((npc->_pendingDamageFlags & 4) == 0) { diff --git a/generated-src/online_chat.cpp b/generated-src/online_chat.cpp index 13ea921..9634725 100644 --- a/generated-src/online_chat.cpp +++ b/generated-src/online_chat.cpp @@ -109,7 +109,7 @@ LAB_0091d341: local_58._blue = *GHIDRA_CAST((iVar3 + 0x5e4)); } else { - (GHIDRA_CAST((GHIDRA_CAST(&g_game->_playerManager))))->Entity_Familiar::GetPlayerSlot(&local_58,player); + Entity_Familiar::GetPlayerSlot(GHIDRA_CAST(&g_game->_playerManager),&local_58,player); iVar3 = *GHIDRA_CAST(this); } drawFont = font; diff --git a/generated-src/path_finder.cpp b/generated-src/path_finder.cpp index 3fb101b..0f7b629 100644 --- a/generated-src/path_finder.cpp +++ b/generated-src/path_finder.cpp @@ -104,7 +104,7 @@ uint8_t PathFinder::is_entity_friendly() if (((*GHIDRA_CAST((iVar1 + 0x168)) & 0x100) == 0) && (entityType = *GHIDRA_CAST((iVar1 + 0x28)), entityType != 0x322)) { if ((*GHIDRA_CAST((iVar1 + 0x3c4)) != GHIDRA_CAST(0x0)) && - (isTargetFriendly = (GHIDRA_CAST((*GHIDRA_CAST((iVar1 + 0x3c4)))))->Entity::HasEntityFlags(0x10000000000000), + (isTargetFriendly = Entity::HasEntityFlags(*GHIDRA_CAST((iVar1 + 0x3c4)),0x10000000000000), isTargetFriendly != 0)) { return 1; } @@ -183,7 +183,7 @@ void PathFinder::EvadeTarget(Vector *targetPos, uint8_t isIgnoreStatusEffects) npc = (Entity_NPC *) __RTDynamicCast(*GHIDRA_CAST(this),0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor ,&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0,uVar4); - playerTarget = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + playerTarget = Entity_NPC::GetPlayerTarget(npc); scratchPos.x = (playerTarget->_pos).x; scratchPos.y = (playerTarget->_pos).y; FindGridPath(this,&scratchPos,1.079,0,1); @@ -209,7 +209,7 @@ void PathFinder::EvadeTarget(Vector *targetPos, uint8_t isIgnoreStatusEffects) (GHIDRA_INT(pfVar1) + g_game->_frameCount) % 0xe == 0)) { scratchPos.x = *local_38; scratchPos.y = local_38[1]; - bVar3 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&scratchPos,targetPos,1,0,0,0,GHIDRA_CAST(0x0)); + bVar3 = Room::CheckLine(g_game->_room,&scratchPos,targetPos,1,0,0,0,GHIDRA_CAST(0x0)); if (bVar3 == 0) { fVar9 = 170.0; } @@ -366,16 +366,16 @@ LAB_007e4e8c: local_38 = GHIDRA_CAST(scratchPos.y); local_2c = scratchPos.x; local_28 = pRVar11; - uVar4 = (GHIDRA_CAST((pRVar11)))->Room::GetGridCollision(iVar8); + uVar4 = Room::GetGridCollision(pRVar11,iVar8); if (uVar4 == 0) { npcPos.x = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x33c)); npcPos.y = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x340)); - bVar3 = (GHIDRA_CAST((pRVar11)))->Room::CheckLine(&npcPos,&scratchPos,1,0,(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x738))),0, + bVar3 = Room::CheckLine(pRVar11,&npcPos,&scratchPos,1,0,(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x738))),0, GHIDRA_CAST(0x0)); if (bVar3 != 0) { npcPosCopy.x = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x33c)); npcPosCopy.y = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x340)); - bVar3 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(targetPos,&npcPosCopy,1,0,(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x738))),0, + bVar3 = Room::CheckLine(g_game->_room,targetPos,&npcPosCopy,1,0,(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x738))),0, GHIDRA_CAST(0x0)); if ((bVar3 == 0) || (20.0 <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x4)))))) { local_44 = *GHIDRA_CAST((this + 1)); @@ -420,7 +420,8 @@ LAB_007e4e8c: targetPos_00 = local_3c; fVar9 = local_3c->x; if (iVar6 % 10 == 0) { - bVar3 = (GHIDRA_CAST((game->_room)))->Room::CheckLine(targetPos,local_3c,1,0,(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x738))),0,GHIDRA_CAST(0x0)); + bVar3 = Room::CheckLine(game->_room,targetPos,local_3c,1,0,(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x738))),0,GHIDRA_CAST(0x0) + ); if ((bVar3 == 0) || (20.0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x4)))) || *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(this[1])) + 0x4)))) == 20.0)) { fVar10 = targetPos->x - local_3c->x; @@ -504,15 +505,15 @@ void PathFinder::MoveRandomlyAxisAligned(float speed, uint8_t isIgnoreStatusEffe npc = (Entity_NPC *) __RTDynamicCast(iVar8,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - (GHIDRA_CAST((npc)))->Entity_NPC::CalcTargetPosition(&scratchVec,0.0); + Entity_NPC::CalcTargetPosition(npc,&scratchVec,0.0); if (((*GHIDRA_CAST((*GHIDRA_CAST(this) + 0x168)) & 0x20000000) != 0) && - ((playerTarget = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(), playerTarget->_type == 1 && + ((playerTarget = Entity_NPC::GetPlayerTarget(npc), playerTarget->_type == 1 && (scratchVec.x = (npc->_pos).x - scratchVec.x, scratchVec.y = (npc->_pos).y - scratchVec.y, scratchVec.y * scratchVec.y + scratchVec.x * scratchVec.x < 1600.0)))) { *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x36c)) = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x36c)) * 0.8; return; } - pVVar2 = (GHIDRA_CAST((npc)))->Entity_NPC::CalcTargetPosition(&scratchVec,0.0); + pVVar2 = Entity_NPC::CalcTargetPosition(npc,&scratchVec,0.0); FindGridPath(this,pVVar2,speed,0,1); scratchVec.y = (npc->_velocity).y; scratchVec.x = (npc->_velocity).x; @@ -721,7 +722,7 @@ LAB_007e5b55: } while (GHIDRA_INT(uVar4) < iVar8); } else { - playerTarget = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + playerTarget = Entity_NPC::GetPlayerTarget(npc); fVar14 = (playerTarget->_pos).x - *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x33c)); fVar12 = (playerTarget->_pos).y - *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x340)); uVar7 = uVar4; @@ -783,7 +784,7 @@ LAB_007e5b55: ((*GHIDRA_CAST((*GHIDRA_CAST(this) + 0x168)) & 0x1000800) != 0)) && (-1 < GHIDRA_INT(uVar3))) { if ((*GHIDRA_CAST((*GHIDRA_CAST(this) + 0x168)) & 0x1000800) != 0) { pVVar2 = Isaac::GetAxisAlignedUnitVectorFromDir(&chosenDirVec,uVar3); - playerTarget = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + playerTarget = Entity_NPC::GetPlayerTarget(npc); fVar14 = (playerTarget->_pos).y - *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x340)); toPlayerDirX = (playerTarget->_pos).x - *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x33c)); fVar12 = sqrtf(fVar14 * fVar14 + toPlayerDirX * toPlayerDirX); @@ -863,7 +864,7 @@ LAB_007e5e93: else { iVar8 = gridRoom->_gridWidth * iVar10 + iVar8; } - uVar6 = (GHIDRA_CAST((gridRoom)))->Room::GetGridCollision(iVar8); + uVar6 = Room::GetGridCollision(gridRoom,iVar8); if (uVar6 != 4) goto LAB_007e5ee3; } } @@ -996,7 +997,7 @@ uint8_t PathFinder::MoveRandomly(uint8_t isIgnoreStatusEffects) bVar1 = 1; iVar5 = 0; fVar4 = 0.5; - targetPos = (GHIDRA_CAST((npc)))->Entity_NPC::CalcTargetPosition(&local_10,0.0); + targetPos = Entity_NPC::CalcTargetPosition(npc,&local_10,0.0); FindGridPath(this,targetPos,fVar4,iVar5,bVar1); return 1; } @@ -1004,7 +1005,7 @@ uint8_t PathFinder::MoveRandomly(uint8_t isIgnoreStatusEffects) npc = (Entity_NPC *) __RTDynamicCast(iVar5,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - target = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(npc); local_10.x = (target->_pos).x; local_10.y = (target->_pos).y; EvadeTarget(this,&local_10,0); @@ -1025,7 +1026,7 @@ uint8_t PathFinder::MoveRandomly(uint8_t isIgnoreStatusEffects) local_10.x = fVar2 * 40.0 + local_10.x; pos.y = local_10.x; pos.x = fVar4; - iVar5 = (GHIDRA_CAST((g_game->_room)))->Room::GetGridCollisionAtPos(pos); + iVar5 = Room::GetGridCollisionAtPos(g_game->_room,pos); if (iVar5 == 0) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = fVar4; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x8)))) = local_10.x; @@ -1091,7 +1092,7 @@ void PathFinder::MoveRandomlyBoss(uint8_t isIgnoreStatusEffects) bVar1 = 1; iVar7 = 0; fVar6 = 0.5; - pVVar2 = (GHIDRA_CAST((npc)))->Entity_NPC::CalcTargetPosition(&local_10,0.0); + pVVar2 = Entity_NPC::CalcTargetPosition(npc,&local_10,0.0); FindGridPath(this,pVVar2,fVar6,iVar7,bVar1); return; } @@ -1099,7 +1100,7 @@ void PathFinder::MoveRandomlyBoss(uint8_t isIgnoreStatusEffects) npc = (Entity_NPC *) __RTDynamicCast(iVar7,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - playerTarget = (GHIDRA_CAST((npc)))->Entity_NPC::GetPlayerTarget(); + playerTarget = Entity_NPC::GetPlayerTarget(npc); local_10.x = (playerTarget->_pos).x; local_10.y = (playerTarget->_pos).y; EvadeTarget(this,&local_10,0); @@ -1131,7 +1132,7 @@ void PathFinder::MoveRandomlyBoss(uint8_t isIgnoreStatusEffects) } local_10.x = (GHIDRA_CAST((iVar7 + 0x33c)))->x; local_10.y = *GHIDRA_CAST((iVar7 + 0x340)); - iVar7 = (GHIDRA_CAST((g_game->_room)))->Room::GetGridCollisionAtPos(*GHIDRA_CAST((iVar7 + 0x33c))); + iVar7 = Room::GetGridCollisionAtPos(g_game->_room,*GHIDRA_CAST((iVar7 + 0x33c))); if (iVar7 == 0) { uVar3 = Random(); if (uVar3 % 0x1e == 0) { @@ -1147,7 +1148,7 @@ void PathFinder::MoveRandomlyBoss(uint8_t isIgnoreStatusEffects) } } if (((*GHIDRA_CAST(this))->_collidesWithGrid != 0) && - (bVar1 = (GHIDRA_CAST((*GHIDRA_CAST(this))))->Entity::IsFrame(5,0), bVar1 != 0)) { + (bVar1 = Entity::IsFrame(*GHIDRA_CAST(this),5,0), bVar1 != 0)) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) ^ 0x80000000; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x10)))) ^ 0x80000000; } @@ -1166,7 +1167,7 @@ void PathFinder::MoveRandomlyBoss(uint8_t isIgnoreStatusEffects) else { iVar7 = room->_gridWidth * gridY + iVar7; } - uVar3 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar7); + uVar3 = Room::GetGridCollision(room,iVar7); if ((uVar3 == 0) || (triesLeft < 1)) break; uVar3 = Random(); local_18.x = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * @@ -1238,7 +1239,7 @@ void PathFinder::update_chase_movement() local_20.y = (float)pEVar1; if (pEVar1->_controllerID != -1) { pEVar1->_friction = pEVar1->_friction * 0.6; - controllerInput = (GHIDRA_CAST((pEVar1)))->Entity_NPC::GetControllerInput(&local_20,0.0); + controllerInput = Entity_NPC::GetControllerInput(pEVar1,&local_20,0.0); fVar3 = pEVar1->_speedMultiplier; fVar4 = controllerInput->y; (pEVar1->_velocity).x = controllerInput->x * 1.2 * 1.25 * fVar3 + (pEVar1->_velocity).x; @@ -1259,13 +1260,13 @@ void PathFinder::update_chase_movement() if ((npcFlags & 0x200) == 0) { if ((npcFlags & 0x100) == 0) { if ((npcFlags & 0x1000800) == 0) goto LAB_007e6de9; - target = (GHIDRA_CAST((GHIDRA_CAST(fVar3))))->Entity_NPC::GetPlayerTarget(); + target = Entity_NPC::GetPlayerTarget(GHIDRA_CAST(fVar3)); fVar4 = (GHIDRA_CAST((GHIDRA_INT(fVar3) + 0x33c)))->x - (target->_pos).x; fVar3 = (GHIDRA_CAST((GHIDRA_INT(fVar3) + 0x33c)))->y - (target->_pos).y; } else { - local_20.y = (float)(GHIDRA_CAST((GHIDRA_CAST(fVar3))))->Entity_NPC::GetPlayerTarget(); - isFrame = (GHIDRA_CAST((GHIDRA_CAST(fVar3))))->Entity::IsFrame(5,*GHIDRA_CAST((GHIDRA_CAST(fVar3) + 0x20))); + local_20.y = (float)Entity_NPC::GetPlayerTarget(GHIDRA_CAST(fVar3)); + isFrame = Entity::IsFrame(GHIDRA_CAST(fVar3),5,*GHIDRA_CAST((GHIDRA_CAST(fVar3) + 0x20))); if (isFrame == 0) goto LAB_007e6de9; Reset(in_ECX); local_20.x = (GHIDRA_CAST((GHIDRA_INT(local_20.y) + 0x33c)))->x; diff --git a/generated-src/queue_item_data.cpp b/generated-src/queue_item_data.cpp deleted file mode 100644 index 93c6dc3..0000000 --- a/generated-src/queue_item_data.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "classes.h" - -// 007538f0 -uint8_t QueueItemData::Touched() -{ - int in_ECX; - - return *GHIDRA_CAST((in_ECX + 8)) & 1; -} diff --git a/generated-src/room.cpp b/generated-src/room.cpp deleted file mode 100644 index edf2dda..0000000 --- a/generated-src/room.cpp +++ /dev/null @@ -1,29637 +0,0 @@ -#include "classes.h" - -// 0040c2e0 -int Room::GetGridHeight() -{ - return this->_gridHeight; -} - -// 00417930 -Room * Room::init_render_buffers() -{ - char isLastRef; - void *pvVar1; - uint32_t firstSubList; - int iVar2; - float fVar3; - uint8_t shadowImage [4]; - void **local_18; - Room *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - void **mapHeadSlot; - - local_8 = 0xffffffff; - puStack_c = &LAB_00af151b; - local_10 = ExceptionList; - ExceptionList = &local_10; - *GHIDRA_CAST(&(this->_bottomRightPos).y) = 0; - this->_gridEntities[1] = (void *)0x4000; - this->_gridEntities[2] = (void *)0x0; - local_14 = this; - pvVar1 = operator_new_tracked(0x10000); - this->_gridEntities[0] = pvVar1; - local_8 = 0; - *GHIDRA_CAST((this->_gridEntities + 3)) = 0; - this->_gridEntities[5] = (void *)0x100; - this->_gridEntities[6] = (void *)0x0; - pvVar1 = operator_new_tracked(0x400); - this->_gridEntities[4] = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - *GHIDRA_CAST((this->_gridEntities + 7)) = 0; - this->_gridEntities[9] = (void *)0x800; - this->_gridEntities[10] = (void *)0x0; - pvVar1 = operator_new_tracked(0x2000); - this->_gridEntities[8] = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 2; - *GHIDRA_CAST((this->_gridEntities + 0xb)) = 0; - this->_gridEntities[0xd] = (void *)0x4000; - this->_gridEntities[0xe] = (void *)0x0; - pvVar1 = operator_new_tracked(0x10000); - this->_gridEntities[0xc] = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 3; - *GHIDRA_CAST((this->_gridEntities + 0xf)) = 0; - this->_gridEntities[0x11] = (void *)0x4000; - this->_gridEntities[0x12] = (void *)0x0; - pvVar1 = operator_new_tracked(0x10000); - this->_gridEntities[0x10] = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 4; - *GHIDRA_CAST((this->_gridEntities + 0x13)) = 0; - this->_gridEntities[0x15] = (void *)0x4000; - this->_gridEntities[0x16] = (void *)0x0; - pvVar1 = operator_new_tracked(0x10000); - this->_gridEntities[0x14] = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 5; - *GHIDRA_CAST((this->_gridEntities + 0x17)) = 0; - this->_gridEntities[0x19] = (void *)0x8000; - this->_gridEntities[0x1a] = (void *)0x0; - pvVar1 = operator_new_tracked(0x20000); - this->_gridEntities[0x18] = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 6; - *GHIDRA_CAST((this->_gridEntities + 0x1b)) = 0; - this->_gridEntities[0x1d] = (void *)0x100; - this->_gridEntities[0x1e] = (void *)0x0; - pvVar1 = operator_new_tracked(0x400); - this->_gridEntities[0x1c] = pvVar1; - this->_gridEntities[0x28] = (void *)0x0; - this->_gridEntities[0x29] = (void *)0x0; - this->_gridEntities[0x2a] = (void *)0x0; - this->_gridEntities[0x2b] = (void *)0x0; - this->_gridEntities[0x2d] = (void *)0x0; - this->_gridEntities[0x2e] = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 9; - mapHeadSlot = this->_gridEntities + 0x2f; - *mapHeadSlot = (void *)0x0; - this->_gridEntities[0x30] = (void *)0x0; - local_18 = mapHeadSlot; - pvVar1 = operator_new(0x2c); - *(void **)pvVar1 = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 4) = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 8) = pvVar1; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)) = 0x101; - *mapHeadSlot = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 10; - local_18 = this->_gridEntities + 0x35; - this->_gridEntities[0x34] = (void *)0x1; - this->_gridEntities[0x31] = (void *)0x0; - *GHIDRA_CAST((this->_gridEntities + 0x32)) = 0; - this->_gridEntities[0x33] = (void *)0xfedcba76; - _eh_vector_constructor_iterator_ - (local_18,0x18,0x20,FUN_00417710,GHIDRA_CAST<_func_void_void_ptr *>(&LAB_004177b0)); - this->_gridEntities[0xf5] = (void *)0x0; - this->_gridEntities[0xf6] = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xc; - if (local_18 == (void *)0x0) { - firstSubList = 0; - } - else { - firstSubList = FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - *GHIDRA_CAST(this) = firstSubList; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xd; - if (local_18 == (void *)0x0) { - firstSubList = 0; - } - else { - firstSubList = FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = firstSubList; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xe; - if (local_18 == (void *)0x0) { - iVar2 = 0; - } - else { - iVar2 = FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - this->_roomType = iVar2; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xf; - if (local_18 == (void *)0x0) { - iVar2 = 0; - } - else { - iVar2 = FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - this->_gridWidth = iVar2; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x10; - if (local_18 == (void *)0x0) { - iVar2 = 0; - } - else { - iVar2 = FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - this->_gridHeight = iVar2; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x11; - if (local_18 == (void *)0x0) { - fVar3 = 0.0; - } - else { - fVar3 = (float)FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - (this->_topLeftPos).x = fVar3; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x12; - if (local_18 == (void *)0x0) { - fVar3 = 0.0; - } - else { - fVar3 = (float)FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - (this->_topLeftPos).y = fVar3; - local_18 = operator_new(0x24); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x13; - if (local_18 == (void **)0x0) { - fVar3 = 0.0; - } - else { - fVar3 = (float)FUN_0041b9f0(this,0x44340000); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0xb; - (this->_bottomRightPos).x = fVar3; - pvVar1 = Manager::LoadImage(shadowImage,GHIDRA_CAST("gfx/shadow.png")); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x14; - (GHIDRA_CAST((this->_gridEntities + 0x2d)))->KAGE::SmartPointer::operator_assign(pvVar1); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0x15; - if (local_18 != (void **)0x0) { - isLastRef = (**(code **)(GHIDRA_INT(*local_18) + 0xc))(); - if ((isLastRef != '\0') && (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(shadowImage); - } - } - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),0xb); - this->_gridEntities[0x2c] = (void *)0x0; - (GHIDRA_CAST((GHIDRA_CAST(this))))->EntityList::Reset(); - ExceptionList = local_10; - return this; -} - -// 00421800 -Vector * Room::GetTopLeftPos() -{ - return &this->_topLeftPos; -} - -// 00428a50 -EntityList * Room::GetEntities() -{ - return GHIDRA_CAST(&(this->_entityList)._updateEL); -} - -// 0042a270 -int Room::GetRoomShape() -{ - int roomData; - - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 0) || - (roomData = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)), roomData == 0)) { - return 1; - } - return *GHIDRA_CAST((roomData + 0x48)); -} - -// 0042a290 -uint8_t Room::SetGridPath(int gridIndex, int value) -{ - if (GHIDRA_UINT(gridIndex) < 0x1c0) { - this->_gridPaths[gridIndex] = value; - return 1; - } - return 0; -} - -// 0042cc70 -Vector * Room::GetBottomRightPos() -{ - return &this->_bottomRightPos; -} - -// 0042d030 -Vector * Room::GetRenderScrollOffset() -{ - return &this->_renderScrollOffset; -} - -// 00436020 -GridEntity_Door * Room::GetDoor(int slot) -{ - if (slot + 1U < 9) { - return this->_doors[slot]; - } - return GHIDRA_CAST(0x0); -} - -// 00436050 -uint32_t Room::GetSpawnSeed() -{ - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 0) { - return 0; - } - return *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x5c)); -} - -// 00436060 -GridEntity * Room::GetGridEntity(uint32_t idx) -{ - if (idx < 0x1c0) { - return this->_gridEntities[idx]; - } - return GHIDRA_CAST(0x0); -} - -// 00436080 -uint8_t Room::IsClear() -{ - return *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) & 1; -} - -// 00436090 -Vector * Room::GetClampedPosition(Vector *outPos, Vector *position, float margin) -{ - GetClampedPositionImpl(this,outPos,position,margin,margin,margin,margin); - return outPos; -} - -// 004360c0 -int Room::GetTintedRockIdx() -{ - return this->_tintedRockIdx; -} - -// 0043ef20 -int Room::GetBossID() -{ - return this->_bossId; -} - -// 004565c0 -int Room::GetGridPath(int gridIndex) -{ - if (GHIDRA_UINT(gridIndex) < 0x1c0) { - return this->_gridPaths[gridIndex]; - } - return 0; -} - -// 00456620 -GridEntity * Room::GetGridEntityFromPos(Vector *pos) -{ - uint32_t gridIndex; - int gridY; - int gridX; - - gridX = GHIDRA_INT(((pos->x - 40.0) / 40.0 + 0.5)); - if ((((gridX < 0) || (this->_gridWidth <= gridX)) || - (gridY = GHIDRA_INT(((pos->y - 120.0) / 40.0 + 0.5)), gridY < 0)) || - ((this->_gridHeight <= gridY || - (gridIndex = this->_gridWidth * gridY + gridX, 0x1bf < gridIndex)))) { - return GHIDRA_CAST(0x0); - } - return this->_gridEntities[gridIndex]; -} - -// 004566a0 -int Room::GetGridSize() -{ - return this->_gridHeight * this->_gridWidth; -} - -// 004566b0 -int Room::GetAliveEnemiesCount() -{ - int aliveCount; - int enemyCount; - - enemyCount = this->_aliveEnemyCount + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x12c4)))); - aliveCount = 0; - if (0 < enemyCount) { - aliveCount = enemyCount; - } - return aliveCount; -} - -// 004566d0 -int Room::GetAliveBossesCount() -{ - int clampedCount; - int bossCount; - - bossCount = this->_aliveBossCount + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x12cc)))); - clampedCount = 0; - if (0 < bossCount) { - clampedCount = bossCount; - } - return clampedCount; -} - -// 004566f0 -void Room::EmitBloodFromWalls(int duration, int count) -{ - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7214)))) = duration; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7218)))) = count; - return; -} - -// 00456710 -bool Room::HasSlowDown() -{ - return 0 < this->_slowdownDuration; -} - -// 00456720 -void Room::SetSlowDown(int duration) -{ - int *longerDuration; - - longerDuration = &duration; - if (duration <= this->_slowdownDuration) { - longerDuration = &this->_slowdownDuration; - } - this->_slowdownDuration = *longerDuration; - return; -} - -// 004aae80 -uint32_t Room::GetDecorationSeed() -{ - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 0) { - return 0; - } - return *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); -} - -// 004aae90 -void Room::SetClear(uint8_t isClear) -{ - uint32_t newFlags; - uint32_t oldFlags; - - oldFlags = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)); - newFlags = oldFlags | 1; - if (isClear == 0) { - newFlags = oldFlags & 0xfffffffe; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) = newFlags; - return; -} - -// 004aaeb0 -void Room::SetSacrificeDone(uint8_t isDone) -{ - uint32_t newDescFlags; - uint32_t descFlags; - - descFlags = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)); - newDescFlags = descFlags | 4; - if (isDone == 0) { - newDescFlags = descFlags & 0xfffffffb; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) = newDescFlags; - return; -} - -// 004cdd20 -int Room::GetBackdropType() -{ - return this->_backdropType; -} - -// 004cdd80 -uint8_t Room::RaiseGridPathAtPos(Vector *pos, int pathValue) -{ - int gridY; - int iVar1; - uint32_t gridIndex; - - iVar1 = GHIDRA_INT(((pos->x - 40.0) / 40.0 + 0.5)); - if ((((iVar1 < 0) || (this->_gridWidth <= iVar1)) || - (gridY = GHIDRA_INT(((pos->y - 120.0) / 40.0 + 0.5)), gridY < 0)) || - (((this->_gridHeight <= gridY || - (gridIndex = this->_gridWidth * gridY + iVar1, 0x1bf < gridIndex)) || (0x3b6 < pathValue)))) - { - return 0; - } - iVar1 = this->_gridPaths[gridIndex] % 1000; - if (iVar1 < pathValue) { - this->_gridPaths[gridIndex] = (this->_gridPaths[gridIndex] - iVar1) + pathValue; - } - return 1; -} - -// 004d7780 -uint8_t Room::HasTriggerPressurePlates() -{ - return this->_hasTriggerPressurePlates; -} - -// 00505c40 -uint8_t Room::HasWaterPits() -{ - return (uint8_t)(*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 5) & 1; -} - -// 00505c50 -Vector * Room::GetWaterCurrent(Vector *outResult) -{ - float currentY; - - currentY = (this->_waterCurrent).y; - outResult->x = (this->_waterCurrent).x; - outResult->y = currentY; - return outResult; -} - -// 005784d0 -void Room::StopRain() -{ - this->_isRainStopped = 1; - return; -} - -// 00589f90 -uint8_t Room::CanSpawnObstacleAtPos(Vector *position, uint8_t isForce) -{ - uint8_t bVar1; - int gridY; - int gridX; - - gridX = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - if ((((gridX < 0) || (this->_gridWidth <= gridX)) || - (gridY = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)), gridY < 0)) || - (this->_gridHeight <= gridY)) { - bVar1 = CanSpawnObstacleAtPosition(this,-1,isForce); - return bVar1; - } - bVar1 = CanSpawnObstacleAtPosition(this,this->_gridWidth * gridY + gridX,isForce); - return bVar1; -} - -// 00592270 -int Room::get_beast_arena() -{ - int in_ECX; - - return in_ECX + 0x776c; -} - -// 0059e250 -uint8_t Room::IsDoorSlotAllowed(int slot) -{ - if (GHIDRA_UINT(slot) < 8) { - return (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x38 + (GHIDRA_UINT(slot) >> 5) * 4)) & - 1 << ((uint8_t)slot & 0x1f)) != 0; - } - return 0; -} - -// 005b16c0 -void Room::InvalidatePickupVision() -{ - this->_isPickupVisionInvalid = 1; - return; -} - -// 005cd650 -uint8_t Room::IsSacrificeDone() -{ - return (uint8_t)(*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 2) & 1; -} - -// 005cd660 -uint8_t Room::is_deaths_list_done() -{ - int in_ECX; - - return *GHIDRA_CAST((in_ECX + 0x1bbc)); -} - -// 005cd670 -uint8_t Room::has_exorcist() -{ - int in_ECX; - - return *GHIDRA_CAST((in_ECX + 0x7768)); -} - -// 00652ab0 -Vector * Room::ScreenWrapPosition(Vector *outPosition, Vector *position, float margin) -{ - ScreenWrapPositionImpl(this,outPosition,position,margin,margin,margin,margin); - return outPosition; -} - -// 0065cef0 -uint8_t Room::IsFirstVisit() -{ - int in_ECX; - - return *GHIDRA_CAST((in_ECX + 1)); -} - -// 006b83d0 -uint8_t Room::IsInitialized() -{ - return *GHIDRA_CAST(this); -} - -// 006b83e0 -Vector * Room::GetRenderSurfaceTopLeft() -{ - return &this->_renderSurfaceTopLeft; -} - -// 006b83f0 -uint8_t Room::IsFirstEnemyDead() -{ - return this->_isFirstEnemyDead; -} - -// 006b8400 -void Room::SetFirstEnemyDead(uint8_t param_2) -{ - this->_isFirstEnemyDead = param_2; - return; -} - -// 006b8410 -uint8_t Room::has_room_config_flag(uint32_t mask) -{ - int roomConfig; - - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 0) || - (roomConfig = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)), roomConfig == 0)) { - return 0; - } - return (*GHIDRA_CAST((roomConfig + 0x4c)) & mask) != 0; -} - -// 0070c560 -uint8_t Room::IsAmbushDone() -{ - return (uint8_t)(*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 3) & 1; -} - -// 007120c0 -long double Room::GetLavaIntensity() -{ - return (long double)this->_lavaIntensity; -} - -// 007537c0 -void Room::SetRedHeartDamage() -{ - this->_redHeartDamage = 1; - return; -} - -// 007537d0 -void Room::SetCardAgainstHumanity() -{ - int in_ECX; - - *GHIDRA_CAST((in_ECX + 0x11f4)) = 1; - return; -} - -// 007537e0 -int Room::GetDeliriumDistance() -{ - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 0) { - return 0; - } - return *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xb0)); -} - -// 007e91a0 -uint8_t Room::GetRedHeartDamage() -{ - return this->_redHeartDamage; -} - -// 007e91b0 -void Room::SetFloorColor(float param_2, float param_3, float param_4, float param_5, float param_6, float param_7, float param_8, float param_9, uint64_t param_10, float param_11) -{ - if (&this->_floorColor != GHIDRA_CAST(¶m_2)) { - (this->_floorColor)._tint[0] = param_2; - (this->_floorColor)._tint[1] = param_3; - (this->_floorColor)._tint[2] = param_4; - (this->_floorColor)._tint[3] = param_5; - (this->_floorColor)._colorize[0] = param_6; - (this->_floorColor)._colorize[1] = param_7; - (this->_floorColor)._colorize[2] = param_8; - (this->_floorColor)._colorize[3] = param_9; - *GHIDRA_CAST((this->_floorColor)._offset) = param_10; - (this->_floorColor)._offset[2] = param_11; - } - return; -} - -// 007e91f0 -void Room::SetWallColor(ColorMod color) -{ - if (&this->_wallColor != &color) { - (this->_wallColor)._tint[0] = color._tint[0]; - (this->_wallColor)._tint[1] = color._tint[1]; - (this->_wallColor)._tint[2] = color._tint[2]; - (this->_wallColor)._tint[3] = color._tint[3]; - (this->_wallColor)._colorize[0] = color._colorize[0]; - (this->_wallColor)._colorize[1] = color._colorize[1]; - (this->_wallColor)._colorize[2] = color._colorize[2]; - (this->_wallColor)._colorize[3] = color._colorize[3]; - *GHIDRA_CAST((this->_wallColor)._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(color._offset)) + 0x0))); - (this->_wallColor)._offset[2] = color._offset[2]; - } - return; -} - -// 007e9400 -Room * Room::constructor() -{ - int *dequeProxy; - void *pvVar1; - uint32_t *puVar2; - uint8_t *extraout_EAX; - int entriesLeft; - uint32_t *puVar3; - uint32_t uVar4; - float fVar5; - void *redirectedPath [4]; - uint32_t redirectedPathSize; - uint32_t redirectedPathCapacity; - std_string backdropsPath; - uint32_t stackCookie; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - void *local_14; - uint8_t *gridIndexSet; - std_deque *shopItemDeque; - - puStack_20 = GHIDRA_CAST((redirectedPath + 0x14)); - local_14 = (void *)0xffffffff; - puStack_18 = &LAB_00b00d42; - local_1c = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((redirectedPath + 0x11)); - ExceptionList = &local_1c; - *GHIDRA_CAST(this) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - this->_roomType = 0; - (this->_topLeftPos).y = 0.0; - (this->_topLeftPos).x = 0.0; - (this->_bottomRightPos).y = 0.0; - (this->_bottomRightPos).x = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x11f6))) = 1; - (this->_renderSurfaceTopLeft).y = 0.0; - (this->_renderSurfaceTopLeft).x = 0.0; - (this->_renderScrollOffset).y = 0.0; - (this->_renderScrollOffset).x = 0.0; - init_render_buffers(GHIDRA_CAST(&this->_entityList),stackCookie); - local_14 = (void *)0x0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x4)))) = 0; - *GHIDRA_CAST(&this->_fxLayers) = 0; - (this->_fxLayers)._loaded = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x10)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x14)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x18)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x1c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x20)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x24)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x28)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x2c)))) = 0; - FXParams::FXParams(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x38))))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 3; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x84)))) = 0x3f800000; - entriesLeft = 10; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x88)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x8c)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x90)))) = 0x3f800000; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x94)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x98)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x9c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xa0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xa4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xa8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xac)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xb4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xb0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xbc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xb8)))) = 0; - puVar2 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0xc0)))); - do { - *puVar2 = 0; - puVar2[4] = 0; - puVar2[5] = 0; - puVar2[6] = 0x3f800000; - puVar2[7] = 0; - puVar2[8] = 0x3f800000; - puVar2[9] = 0; - *GHIDRA_CAST((puVar2 + 0xc)) = 0; - *GHIDRA_CAST((puVar2 + 1)) = 0; - puVar2[0xb] = 0; - puVar2[10] = 0; - puVar2[3] = 0; - entriesLeft = entriesLeft + -1; - puVar2 = puVar2 + 0xd; - } while (entriesLeft != 0); - _eh_vector_constructor_iterator_ - (&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x2c8))),0x114,2,ANM2::constructor,ANM2::~ANM2); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x4f4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers))) + 0x4f0)))) = 0; - FXParams::FXParams(&(this->_fxLayers)._fxParams); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1bb8)))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 5; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1bc4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1bc0)))) = 0; - Backdrop::constructor(GHIDRA_CAST(&this->_backdrop)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 6; - ANM2::constructor(&this->_lightSprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 7; - ANM2::constructor(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6f54))))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 8; - shopItemDeque = &this->_shopItemDeque; - shopItemDeque->_proxy = (void *)0x0; - (this->_shopItemDeque)._map = (void *)0x0; - (this->_shopItemDeque)._mapSize = 0; - (this->_shopItemDeque)._offset = 0; - (this->_shopItemDeque)._size = 0; - dequeProxy = operator_new(8); - dequeProxy[1] = 0; - shopItemDeque->_proxy = dequeProxy; - *dequeProxy = GHIDRA_INT(shopItemDeque); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 9; - entriesLeft = 2; - puVar2 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70c4)))); - do { - *puVar2 = 0xc3160000; - puVar2[1] = 0; - puVar2[2] = 0; - puVar2[3] = 0x3c23d70a; - puVar2[4] = 0x3dcccccd; - puVar2[5] = 0; - puVar2[6] = 5; - entriesLeft = entriesLeft + -1; - puVar2 = puVar2 + 7; - } while (entriesLeft != 0); - ANM2::constructor(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7100))))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 10; - gridIndexSet = this->_pendingGridRemovals; - gridIndexSet[0] = 0; - gridIndexSet[1] = 0; - gridIndexSet[2] = 0; - gridIndexSet[3] = 0; - this->_pendingGridRemovals[4] = 0; - this->_pendingGridRemovals[5] = 0; - this->_pendingGridRemovals[6] = 0; - this->_pendingGridRemovals[7] = 0; - pvVar1 = operator_new(0x14); - *(void **)pvVar1 = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 4) = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 8) = pvVar1; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)) = 0x101; - *(void **)gridIndexSet = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xb; - (GHIDRA_CAST((&this->_waterColor)))->KColor::SetFromARGB(0xffffffff); - (GHIDRA_CAST((&this->_waterColorMultiplier)))->KColor::SetFromARGB(0xffffffff); - (GHIDRA_CAST((&this->_waterLerpTargetColor)))->KColor::SetFromARGB(0xffffffff); - (GHIDRA_CAST((&this->_waterLerpTargetColorMult)))->KColor::SetFromARGB(0xffffffff); - (this->_floorColor)._tint[0] = 1.0; - (this->_floorColor)._tint[1] = 1.0; - (this->_floorColor)._tint[2] = 1.0; - (this->_floorColor)._tint[3] = 1.0; - (this->_floorColor)._colorize[0] = 0.0; - (this->_floorColor)._colorize[1] = 0.0; - (this->_floorColor)._colorize[2] = 0.0; - (this->_floorColor)._colorize[3] = 0.0; - (this->_floorColor)._offset[0] = 0.0; - (this->_floorColor)._offset[1] = 0.0; - (this->_floorColor)._offset[2] = 0.0; - (this->_wallColor)._tint[0] = 1.0; - (this->_wallColor)._tint[1] = 1.0; - (this->_wallColor)._tint[2] = 1.0; - (this->_wallColor)._tint[3] = 1.0; - (this->_wallColor)._colorize[0] = 0.0; - (this->_wallColor)._colorize[1] = 0.0; - (this->_wallColor)._colorize[2] = 0.0; - (this->_wallColor)._colorize[3] = 0.0; - (this->_wallColor)._offset[0] = 0.0; - (this->_wallColor)._offset[1] = 0.0; - (this->_wallColor)._offset[2] = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7304)))) = 0; - pvVar1 = operator_new(0x20); - *(void **)pvVar1 = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 4) = pvVar1; - *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300))) = pvVar1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xc; - gridIndexSet = this->_litGridIndices; - gridIndexSet[0] = 0; - gridIndexSet[1] = 0; - gridIndexSet[2] = 0; - gridIndexSet[3] = 0; - this->_litGridIndices[4] = 0; - this->_litGridIndices[5] = 0; - this->_litGridIndices[6] = 0; - this->_litGridIndices[7] = 0; - pvVar1 = operator_new(0x14); - *(void **)pvVar1 = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 4) = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 8) = pvVar1; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)) = 0x101; - *(void **)gridIndexSet = pvVar1; - (this->_temporaryEffects)._effects._begin = (void *)0x0; - (this->_temporaryEffects)._effects._end = (void *)0x0; - (this->_temporaryEffects)._effects._capacity = (void *)0x0; - (this->_temporaryEffects)._cacheFlags = 0; - (this->_temporaryEffects)._shouldEvaluateCache = 0; - (this->_temporaryEffects)._disabled = 0; - (this->_temporaryEffects)._player = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xe; - _eh_vector_constructor_iterator_(this->_outputGroupGridIndices,8,10,FUN_005cbe20,FUN_00424420); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xf; - _eh_vector_constructor_iterator_ - (this->_outputGroupCallbacks,0xc,10,FUN_00424510,FID_conflict__Tidy); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x10; - entriesLeft = 4; - puVar2 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7408)))); - puVar3 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x73f4)))); - do { - puVar2[-4] = 0; - *puVar3 = 0; - puVar2[-2] = 0; - puVar2[-3] = 0; - *puVar2 = 0; - puVar2[-1] = 0; - entriesLeft = entriesLeft + -1; - puVar2 = puVar2 + 6; - puVar3 = puVar3 + 6; - } while (entriesLeft != 0); - (this->_waterCurrent).y = 0.0; - (this->_waterCurrent).x = 0.0; - (this->_railManager)._room = this; - ANM2::constructor(&(this->_railManager)._sprite); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x11; - _eh_vector_constructor_iterator_(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7744))),4,8,FUN_0042a020,FUN_00579700); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x12; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x776c)))) = this; - ANM2::constructor(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7770))))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7884))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7888)))) = 0; - this->_beastBlastForce = 0.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7890)))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x13; - memset(this->_gridEntities,0,0x720); - init_room_render_surfaces(); - builtin_strncpy(backdropsPath._buf + 8,"s.xml",6); - backdropsPath._capacity = 0xf; - backdropsPath._size = 0xd; - builtin_strncpy(backdropsPath._buf,"backdrop",8); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x14; - ModManager::TryRedirectPath - (GHIDRA_CAST(&g_manager->_modManager),GHIDRA_CAST(redirectedPath),&backdropsPath); - local_14 = (void *)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),0x15); - gridIndexSet = extraout_EAX; - if (0xf < *GHIDRA_CAST((extraout_EAX + 0x14))) { - gridIndexSet = *GHIDRA_CAST(extraout_EAX); - } - Backdrop::LoadConfig(GHIDRA_CAST(&this->_backdrop),gridIndexSet); - if (0xf < redirectedPathCapacity) { - uVar4 = redirectedPathCapacity + 1; - pvVar1 = redirectedPath[0]; - if (0xfff < uVar4) { - pvVar1 = *(void **)(GHIDRA_INT(redirectedPath[0]) + -4); - uVar4 = redirectedPathCapacity + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedPath[0]) + (-4 - GHIDRA_INT(pvVar1))))) goto LAB_007e9af3; - } - operator_delete(pvVar1,uVar4); - } - redirectedPathSize = 0; - redirectedPathCapacity = 0xf; - redirectedPath[0] = (void *)(GHIDRA_UINT(redirectedPath[0]) & 0xffffff00); - if (0xf < backdropsPath._capacity) { - uVar4 = backdropsPath._capacity + 1; - pvVar1 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)backdropsPath._buf)) + 0x0))); - if (0xfff < uVar4) { - pvVar1 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(backdropsPath._buf)) + 0x0))) + -4); - uVar4 = backdropsPath._capacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(backdropsPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar1))))) { -LAB_007e9af3: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar1,uVar4); - } - this->_Camera = (void *)0x0; - fVar5 = g_screenHeight - 182.0; - (this->_renderSurfaceTopLeft).x = (g_screenWidth - 338.0) * 0.5 - 52.0; - (this->_renderSurfaceTopLeft).y = fVar5 * 0.5 - 52.0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7084)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7088)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x708c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7090)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7094)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7098)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x709c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70a0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70a4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70a8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70ac)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70b0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70b4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70b8)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70bc)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x70c0)))) = 0; - ExceptionList = local_1c; - return this; -} - -// 007e9ba0 -Room::~Room() -{ - uint8_t *gridIndexSet; - uint32_t uVar2; - uint64_t *allocCounter; - void **gridEntitySlot; - int iVar3; - Room *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint64_t allocatedBytes; - void *freeBlock; - ANM2 *railSprite; - uint8_t *refSlot; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b00d70; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - gridEntitySlot = this->_gridEntities; - iVar3 = 0x1c0; - local_14 = this; - do { - if (*gridEntitySlot != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(*gridEntitySlot))(1,uVar2); - } - gridEntitySlot = gridEntitySlot + 1; - iVar3 = iVar3 + -1; - } while (iVar3 != 0); - if (this->_Camera != (void *)0x0) { - FUN_007ea0c0(this->_Camera); - } - local_8 = 0; - ANM2::Reset(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7770))))); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77c8)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77c8)))) = 0; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77cc)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77cc)))) = 0; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77a8)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77a8)))) = 0; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77ac)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x77ac)))) = 0; - } - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7788))))))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7770))))))->msvc::string::_Tidy_deallocate(); - local_8 = 0xffffffff; - _eh_vector_destructor_iterator_(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7744))),4,8,FUN_00579700); - railSprite = &(this->_railManager)._sprite; - local_8 = 5; - ANM2::Reset(railSprite); - freeBlock = (this->_railManager)._sprite._overlayAnimState._layerFrames; - if (freeBlock != (void *)0x0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(GHIDRA_INT(freeBlock) + -4)); - (this->_railManager)._sprite._overlayAnimState._layerFrames = (void *)0x0; - } - freeBlock = (this->_railManager)._sprite._overlayAnimState._nullLayerFrames; - if (freeBlock != (void *)0x0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(GHIDRA_INT(freeBlock) + -4)); - (this->_railManager)._sprite._overlayAnimState._nullLayerFrames = (void *)0x0; - } - freeBlock = (this->_railManager)._sprite._animState._layerFrames; - if (freeBlock != (void *)0x0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(GHIDRA_INT(freeBlock) + -4)); - (this->_railManager)._sprite._animState._layerFrames = (void *)0x0; - } - freeBlock = (this->_railManager)._sprite._animState._nullLayerFrames; - if (freeBlock != (void *)0x0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((GHIDRA_CAST(freeBlock) + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(GHIDRA_INT(freeBlock) + -4)); - (this->_railManager)._sprite._animState._nullLayerFrames = (void *)0x0; - } - (GHIDRA_CAST(((this->_railManager)._sprite._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(railSprite))))->msvc::string::_Tidy_deallocate(); - local_8 = 0xffffffff; - _eh_vector_destructor_iterator_(this->_outputGroupCallbacks,0xc,10,FID_conflict__Tidy); - _eh_vector_destructor_iterator_(this->_outputGroupGridIndices,8,10,FUN_00424420); - FUN_004b3950(); - gridIndexSet = this->_litGridIndices; - FID_conflict__Erase_tree_>_> - (gridIndexSet,(fuzzer_allocator_> *)gridIndexSet, - *(_Tree_node **)(*GHIDRA_CAST(this->_litGridIndices) + 4)); - operator_delete(*(void **)gridIndexSet,0x14); - FUN_00827f30(); - gridIndexSet = this->_pendingGridRemovals; - FID_conflict__Erase_tree_>_> - (gridIndexSet,(fuzzer_allocator_> *)gridIndexSet, - *(_Tree_node **)(*GHIDRA_CAST(this->_pendingGridRemovals) + 4)); - operator_delete(*(void **)gridIndexSet,0x14); - local_8 = 10; - ANM2::Reset(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7100))))); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7158)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7158)))) = 0; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x715c)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x715c)))) = 0; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7138)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7138)))) = 0; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x713c)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x713c)))) = 0; - } - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7118))))))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7100))))))->msvc::string::_Tidy_deallocate(); - msvc::deque::_Tidy(); - freeBlock = (this->_shopItemDeque)._proxy; - (this->_shopItemDeque)._proxy = (void *)0x0; - operator_delete(freeBlock,8); - local_8 = 0xf; - ANM2::Reset(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6f54))))); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6fac)))); - if (iVar3 != 0) { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - uVar2 = *GHIDRA_CAST((iVar3 + -4)); - allocatedBytes = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(allocatedBytes) < uVar2)); - free((void *)(iVar3 + -4)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6fac)))) = 0; - } - if (*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6fb0))) != (void *)0x0) { - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),0x11); - tracked_alloc(1,*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6fb0))),0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6fb0)))) = 0; - } - AnimationState::~AnimationState(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6f84))))); - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6f6c))))))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6f54))))))->msvc::string::_Tidy_deallocate(); - local_8 = 0x12; - ANM2::Reset(&this->_lightSprite); - AnimationState::~AnimationState(&(this->_lightSprite)._overlayAnimState); - AnimationState::~AnimationState(&(this->_lightSprite)._animState); - (GHIDRA_CAST(((this->_lightSprite)._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->msvc::string::_Tidy_deallocate(); - Backdrop::destructor(GHIDRA_CAST(&this->_backdrop)); - refSlot = &(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1bb8))); - if (*GHIDRA_CAST(refSlot) != 0) { - local_14 = GHIDRA_CAST(refSlot); - msvc::multiset::erase(&local_14); - *GHIDRA_CAST(refSlot) = 0; - } - FXLayers::destructor(&this->_fxLayers); - FUN_00417e50(); - ExceptionList = local_10; - return; -} - -// 007ea190 -uint8_t Room::is_type_16() -{ - return this->_roomType == 0x10; -} - -// 007ea1a0 -void Room::TriggerEffectRemoved(ItemConfig_Item *item, int unused) -{ - int iVar1; - uint32_t i; - float musicPitch; - Game *game; - Manager *manager; - void *room; - - manager = g_manager; - game = g_game; - iVar1 = item->type; - if (((iVar1 != 1) && (iVar1 != 3)) && (iVar1 != 4)) { - return; - } - iVar1 = item->id; - if (iVar1 != 0x42) { - if (iVar1 == 0x1de) { - i = 0; - room = g_game->_room; - if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) == 0) { - return; - } - do { - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + i * 4)); - if (((1 < *GHIDRA_CAST(&game->_deathmatchManager)) && (*GHIDRA_CAST((iVar1 + 0x28)) == 1)) || - ((*GHIDRA_CAST((iVar1 + 0x28)) - 10U < 0x3de || (*GHIDRA_CAST((iVar1 + 0x28)) == 1000)))) { - *GHIDRA_CAST((iVar1 + 0x31c)) = 0; - } - i = i + 1; - } while (i < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); - return; - } - if (iVar1 != 0x2a5) { - return; - } - } - musicPitch = time_scale_update(this); - (manager->_musicManager)._targetPitch = musicPitch; - return; -} - -// 007ea260 -void Room::SetPauseTimer(int Duration) -{ - uint32_t i; - int entity; - int entityType; - - i = 0; - if ((this->_entityList)._updateEL._size != 0) { - do { - entity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))) + i * 4)); - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((entity + 0x28)) == 1)) || - (entityType = *GHIDRA_CAST((entity + 0x28)), entityType - 10U < 0x3de)) || - ((entityType == 9 || (entityType == 1000)))) { - *GHIDRA_CAST((entity + 0x31c)) = Duration; - } - i = i + 1; - } while (i < GHIDRA_UINT((this->_entityList)._updateEL._size)); - } - return; -} - -// 007ea2d0 -float Room::time_scale_update() -{ - uint8_t isHasEffect; - void *pvVar1; - Entity_Player *stopWatchOwner; - int gFuelCount; - int extraGFuel; - float easeFraction; - float timeScale; - - timeScale = 1.0; - pvVar1 = (GHIDRA_CAST((&this->_temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x2a5); - if (pvVar1 != (void *)0x0) { - easeFraction = ((float)*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 8)) - 0.0) / 90.0; - if (easeFraction <= 0.0) { - easeFraction = 0.0; - } - if (1.0 <= easeFraction) { - easeFraction = 1.0; - } - timeScale = 1.0 - easeFraction * 0.8; - if (timeScale <= 0.5) { - timeScale = 0.5; - } - goto LAB_007ea3b4; - } - isHasEffect = (GHIDRA_CAST((&this->_temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xe8); - if ((isHasEffect == 0) && - (isHasEffect = (GHIDRA_CAST((&this->_temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x42), - isHasEffect == 0)) { - if (g_game->_challenge != 0x16) { - if (this->_brokenWatchState == 1) goto LAB_007ea3a7; - if (this->_brokenWatchState != 2) { - stopWatchOwner = - PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xe8,GHIDRA_CAST(&g_game->_playerManager),1); - if (stopWatchOwner != GHIDRA_CAST(0x0)) { - timeScale = 0.9; - } - goto LAB_007ea3b4; - } - } - timeScale = 1.43; - } - else { -LAB_007ea3a7: - timeScale = 0.7; - } -LAB_007ea3b4: - gFuelCount = PlayerManager::GetGFuelCount(); - extraGFuel = 0; - if (0 < gFuelCount + -1) { - extraGFuel = gFuelCount + -1; - } - return (float)extraGFuel * 0.1 + timeScale; -} - -// 007ea3e0 -float Room::GetTimeScale(Vector *unusedPosition, Entity *entity) -{ - uint8_t isAstralProjection; - Entity_Player *player; - int gFuelCount; - void *astralEffect; - int extraGFuel; - float velocityY; - float timeScale; - uint32_t seedKey; - Room *room; - uint8_t local_14 [8]; - void *seedNode; - Game *game; - float velocityY; - - timeScale = 1.0; - room = this; - if ((entity == GHIDRA_CAST(0x0)) || (entity->_type != 1)) { - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xe8,GHIDRA_CAST(&g_game->_playerManager),1); - game = g_game; - if (player != GHIDRA_CAST(0x0)) { - timeScale = 0.8; - } - seedKey = 0x4d; - msvc::set::find_node(local_14,&seedKey); - if (((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x4e)) && - (seedNode != (game->_seedEffects)._seedEffects)) { - player = Game::GetPlayer(game,0); - velocityY = (player->_velocity).x; - velocityY = (player->_velocity).y; - timeScale = sqrtf(velocityY * velocityY + velocityY * velocityY); - timeScale = timeScale / 4.2; - if (timeScale <= 0.02) { - timeScale = 0.02; - } - if (1.75 <= timeScale) { - timeScale = 1.75; - } - } - } - gFuelCount = PlayerManager::GetGFuelCount(); - extraGFuel = 0; - if (0 < gFuelCount + -1) { - extraGFuel = gFuelCount + -1; - } - timeScale = (float)extraGFuel * 0.1 + timeScale; - astralEffect = (GHIDRA_CAST((&room->_temporaryEffects)))->TemporaryEffects::GetCollectibleEffect(0x2a5); - if (astralEffect != (void *)0x0) { - if ((entity == GHIDRA_CAST(0x0)) || (entity->_type != 1)) { - velocityY = ((float)*GHIDRA_CAST((GHIDRA_CAST(astralEffect) + 8)) - 0.0) / 90.0; - if (velocityY <= 0.0) { - velocityY = 0.0; - } - if (1.0 <= velocityY) { - velocityY = 1.0; - } - timeScale = (1.0 - velocityY) * timeScale; - if (timeScale <= 0.02) { - timeScale = 0.02; - } - } - else { - isAstralProjection = (GHIDRA_CAST((GHIDRA_CAST(entity))))->Entity_Player::HasCollectible(0x2a5,0); - if (isAstralProjection != 0) { - velocityY = ((float)*GHIDRA_CAST((GHIDRA_CAST(astralEffect) + 8)) - 0.0) / 90.0; - if (velocityY <= 0.0) { - velocityY = 0.0; - } - if (1.0 <= velocityY) { - velocityY = 1.0; - } - timeScale = timeScale * (velocityY + 1.0); - } - } - } - if ((g_game->_challenge == 0x16) || (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1210)) == 2)) { - timeScale = timeScale * 1.43; - } - return timeScale; -} - -// 007eb1b0 -void Room::PlayMusic() -{ - int roomType; - code *pcVar2; - uint8_t bVar3; - uint32_t uVar4; - uint32_t uVar5; - Game *game; - float musicPitch; - uint64_t uVar6; - int unusedInt; - uint8_t unusedBool; - uint32_t stageType; - int jingleId; - float local_c; - uint32_t stage; - uint32_t currentMusic; - Manager *manager; - MusicManager *musicManager; - int roomType; - - stage = g_game->_stage; - stageType = g_game->_stageType; - if (g_game->_challenge == 0x2c) { - stageType = Level::GetRoomStageType(GHIDRA_CAST(g_game),g_game->_currentRoomIdx); - } - game = g_game; - roomType = this->_roomType; - jingleId = 0; - if (g_game->_challenge == 0x2d) { - local_c = (float)g_game->_dungeonPlacementSeed; - if (stage - 1 < 0xb) { - if (local_c == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = GHIDRA_UINT(local_c) >> 2 ^ GHIDRA_UINT(local_c); - uVar4 = uVar4 << 7 ^ uVar4; - local_c = (float)(uVar4 >> 9 ^ uVar4); - stage = GHIDRA_UINT(local_c) % 0xb + 1; - } - if (local_c == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = GHIDRA_UINT(local_c) >> 2 ^ GHIDRA_UINT(local_c); - uVar4 = uVar4 << 7 ^ uVar4; - stageType = (uVar4 >> 9 ^ uVar4) % 5; - if (stageType == 3) { - stageType = 4; - } - } - local_c = 0.08; - unusedInt = 0x7eb2f9; - uVar4 = RoomConfig::GetStageID(stage,stageType,-1); - if (roomType == 5) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) & 1) == 0) { - switch(this->_bossId) { - case 6: - uVar6 = CONCAT44(uVar4,0x14); - break; - default: -switchD_007eb334_caseD_7: - uVar6 = FUN_008206e0(); - break; - case 8: - case 0x19: - uVar6 = CONCAT44(uVar4,0x15); - break; - case 0x18: - case 0x37: -switchD_007eb334_caseD_18: - uVar6 = CONCAT44(uVar4,0x21); - break; - case 0x27: - uVar6 = CONCAT44(uVar4,0x16); - break; - case 0x28: - case 0x3f: - uVar6 = CONCAT44(uVar4,0x19); - break; - case 0x36: - uVar6 = CONCAT44(uVar4,0x18); - break; - case 0x3e: - uVar6 = CONCAT44(uVar4,0x1c); - break; - case 0x46: - uVar6 = CONCAT44(uVar4,0x67); - break; - case 0x58: - uVar6 = CONCAT44(uVar4,0x2b); - } - } - else { - uVar6 = CONCAT44(uVar4,0x25); - } - } - else if ((roomType == 6) || (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x7228)) != '\0')) { - uVar6 = CONCAT44(uVar4,0x26 - GHIDRA_UINT(((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) & 1) != 0))); - } - else if (roomType == 2) { - uVar6 = CONCAT44(uVar4,0x23); - } - else if (roomType == 0xc) { - uVar6 = CONCAT44(uVar4,0x1e); - } - else if (roomType == 0xf) { - uVar6 = CONCAT44(uVar4,0x22); - } - else if (roomType == 9) { - uVar6 = CONCAT44(uVar4,0x24); - } - else { - if (roomType == 0xe) goto switchD_007eb334_caseD_18; - if (roomType == 7) { - uVar6 = CONCAT44(uVar4,0x1f); - } - else if (roomType == 8) { - uVar6 = CONCAT44(uVar4,0x20); - } - else if (roomType == 0x1d) { - uVar6 = CONCAT44(uVar4,0x33); - } - else if (roomType == 0xb) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 3 & 1) == 0) { -LAB_007eb438: - if (game->_currentRoomIdx == -0xb) { - uVar6 = CONCAT44(uVar4,0x25); - } - else if (roomType == 0x18) { - uVar6 = CONCAT44(uVar4,0x32); - } - else if (((roomType == 0x10) && - (roomType = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)), roomType != 0)) && - (*GHIDRA_CAST((roomType + 0x10)) == 4)) { - uVar6 = CONCAT44(uVar4,0x2d); - } - else if ((stage == 0xd) && (stageType == 1)) { - if (((uint8_t)*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) & 5) == 4) { - local_c = 1.0; - uVar6 = CONCAT44(uVar4,0x2c); - } - else { - uVar6 = CONCAT44(uVar4,*(uint32_t *) - (game->_ventricleRazorPortals + uVar4 * 0xc4 + 0x654)); - } - } - else { - if (roomType == 0x10) { - roomType = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if ((roomType != 0) && ((roomType = *GHIDRA_CAST((roomType + 0x10)), roomType == 2 || (roomType == 3)))) - goto switchD_007eb334_caseD_7; - } - else if ((roomType == 4) && ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1))) != '\0')) { - uVar5 = Random(); - jingleId = (uVar5 & 3) + 0x57; - game = g_game; - } - uVar6 = CONCAT44(uVar4,*(uint32_t *) - (game->_ventricleRazorPortals + uVar4 * 0xc4 + 0x654)); - } - } - else { - uVar6 = CONCAT44(uVar4,0x25); - } - } - else { - if (roomType != 0x1b) goto LAB_007eb438; - uVar6 = CONCAT44(uVar4,0x25); - } - } - uVar5 = GHIDRA_UINT(uVar6); - if ((((game->_difficulty != 2) && (game->_difficulty != 3)) && (stage == 9)) && (roomType != 5)) { - uVar5 = *GHIDRA_CAST((game->_ventricleRazorPortals + GHIDRA_INT(((uint64_t)uVar6 >> 0x20)) * 0xc4 + 0x654)) - ; - jingleId = 0; - } - unusedBool = 0x50; - bVar3 = Level::IsMausoleumHeartStage(GHIDRA_CAST(game)); - if (bVar3 != 0) { - if (g_game->_currentRoomIdx != -10) { - local_c = 1.0; - } - uVar5 = 0; - jingleId = 0; - if (g_game->_currentRoomIdx != -10) { - uVar5 = 0x34; - } - } - if (g_game->_currentDimensionIdx == 2) { - uVar5 = 0x45; - jingleId = 0; - } - else { - unusedBool = 0x9e; - bVar3 = Level::HasMirrorDimension(GHIDRA_CAST(g_game)); - if (((bVar3 == 0) || (g_game->_currentDimensionIdx != 1)) || - ((roomType == 5 || ((roomType == 6 || (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x7228)) != '\0')))))) { - unusedBool = 0xdf; - bVar3 = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)); - if ((bVar3 == 0) || (g_game->_currentDimensionIdx != 1)) { - if (((0 < g_game->_stage) && (g_game->_stage < 7)) && - ((g_game->_gameStateFlags & 0x1000000000000) != 0)) { - uVar5 = 0x76; - jingleId = 0; - } - } - else { - jingleId = 0; - uVar5 = (g_game->_levelStateFlags & 0x400000U | 0x1d000000) >> 0x16; - } - } - else { - uVar5 = (uVar4 == 0x1c) + 0x72; - jingleId = 0; - } - } - manager = g_manager; - uVar4 = (g_manager->_musicManager)._queuedMusicID; - musicManager = &g_manager->_musicManager; - currentMusic = (g_manager->_musicManager)._currentMusicID; - if (uVar4 == 0) { - uVar4 = currentMusic; - } - if (currentMusic == 0x68) { - if (uVar5 == 0x72) { -LAB_007eb66b: - local_c = 0.008; - goto LAB_007eb678; - } - } - else if (currentMusic == 0x72) { - if (uVar5 == 0x68) goto LAB_007eb66b; - } - else { -LAB_007eb678: - if (currentMusic == 0x41) { - local_c = 0.01; - } - else if (currentMusic == 0x2d) { - local_c = 1.0; - } - else if ((currentMusic == 0x5f) || (currentMusic == 0x40)) { - if ((-1 < GHIDRA_INT(uVar5)) && - (GHIDRA_INT(uVar5) < - (GHIDRA_INT((g_manager->_musicManager)._entries._end) - - GHIDRA_INT((g_manager->_musicManager)._entries._begin)) / 0x60)) { - (g_manager->_musicManager)._queuedMusicID = uVar5; - } - goto LAB_007eb7d5; - } - } - if (jingleId == 0) { - if (((uVar4 == 0) && (currentMusic != uVar5)) || (uVar4 != uVar5)) { - if (uVar5 == 0) { - musicManager->_channels[musicManager->_currentChannel]._targetVolume = 0.0; - musicManager->_channels[musicManager->_currentChannel]._fadeRate = 0.08; - (manager->_musicManager)._queuedMusicID = 0; - } - else if (local_c < 1.0) { - MusicManager::Crossfade(musicManager,uVar5,local_c); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(musicManager))))->Music::Play(uVar5,(g_manager->_optionsConfig)._musicVolume); - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x2a304)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x2a320)))) = 0xffffff9c; - } - } - else { - (GHIDRA_CAST((GHIDRA_CAST(musicManager))))->Music::PlayJingle(jingleId,unusedInt,unusedBool); - if ((uVar5 != 0) && (((uVar4 == 0 && (currentMusic != uVar5)) || (uVar4 != uVar5)))) { - if (local_c < 1.0) { - MusicManager::Crossfade(musicManager,uVar5,local_c); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(musicManager))))->Music::Play(uVar5,(g_manager->_optionsConfig)._musicVolume); - } - } - } -LAB_007eb7d5: - musicPitch = time_scale_update(this); - (g_manager->_musicManager)._targetPitch = musicPitch; - return; -} - -// 007ebca0 -uint8_t Room::SpawnGridEntity(int GridIndex, uint32_t Type, uint32_t Variant, uint32_t Seed, int VarData) -{ - uint32_t uVar1; - GridEntity *gridEntity; - bool bVar2; - bool bVar3; - int gridPath; - - if ((GridIndex < 0) || (0x1bf < GridIndex)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if (GHIDRA_UINT(GridIndex) < 0x1c0) { - if ((((Type == 0x11) || (Type == 0x12)) || (Type == 0x14)) || (Type == 0x17)) { - uVar1 = GetGridCollision(this,GridIndex); - bVar3 = false; - bVar2 = uVar1 == 0; - } - else { - gridPath = this->_gridPaths[GridIndex]; - bVar3 = SBORROW4(gridPath,900); - uVar1 = gridPath - 900; - bVar2 = gridPath == 900; - } - if (bVar2 || bVar3 != GHIDRA_INT(uVar1) < 0) { - gridEntity = Isaac::CreateGridEntity(Type,GridIndex); - if (gridEntity != GHIDRA_CAST(0x0)) { - if (this->_gridEntities[GridIndex] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[GridIndex]))(1); - } - this->_gridEntities[GridIndex] = gridEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = Variant; - gridEntity->_varData = VarData; - (GHIDRA_CAST((gridEntity)))->GridEntity::Init(Seed); - return 1; - } - } - } - return 0; -} - -// 007ebd50 -uint8_t Room::SpawnGridEntityDesc(int GridIndex, GridEntityDesc *Desc) -{ - int iVar1; - int iVar2; - int iVar3; - uint8_t bVar4; - undefined3 uVar5; - uint32_t uVar6; - GridEntity *gridEntity; - bool bVar7; - bool bVar8; - Game *game; - - if ((GridIndex < 0) || (0x1bf < GridIndex)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - iVar1 = Desc->_type; - if ((((iVar1 == 0x11) || (iVar1 == 0x12)) || (iVar1 == 0x14)) || (iVar1 == 0x17)) { - uVar6 = GetGridCollision(this,GridIndex); - bVar8 = false; - bVar7 = uVar6 == 0; - } - else { - iVar2 = this->_gridPaths[GridIndex]; - bVar8 = SBORROW4(iVar2,900); - uVar6 = iVar2 - 900; - bVar7 = iVar2 == 900; - } - if (bVar7 || bVar8 != GHIDRA_INT(uVar6) < 0) { - gridEntity = Isaac::CreateGridEntity(iVar1,GridIndex); - if (gridEntity != GHIDRA_CAST(0x0)) { - if (this->_gridEntities[GridIndex] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[GridIndex]))(1); - } - this->_gridEntities[GridIndex] = gridEntity; - iVar1 = Desc->_variant; - iVar2 = Desc->_state; - iVar3 = Desc->_spawnCount; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) = Desc->_type; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = iVar1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0xc)))) = iVar2; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) = iVar3; - iVar1 = Desc->_spawnSeed; - iVar2 = Desc->_varData; - bVar4 = Desc->_initialized; - uVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((Desc)) + 0x19)))); - iVar3 = Desc->_variableSeed; - gridEntity->_collisionClass = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x14)))) = iVar1; - gridEntity->_varData = iVar2; - (*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x1c))) = bVar4; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x1d)))) = uVar5; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x20)))) = iVar3; - gridEntity->BeginBatches(); - game = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) + 1; - (*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x1c))) = 1; - gridEntity->_spawnFrame = game->_frameCount; - return 1; - } - } - return 0; -} - -// 007ec080 -int Room::GetSeededCollectible(uint32_t Seed, uint8_t NoDecrease) -{ - int collectibleId; - - collectibleId = - ItemPool::GetSeededCollectible(Seed,NoDecrease,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4))))); - return collectibleId; -} - -// 007ec100 -void Room::TransformEntry(void *entry, uint32_t gridIndex, uint32_t seed) -{ - code *pcVar1; - uint8_t bVar2; - uint32_t uVar3; - int iVar4; - uint32_t uVar5; - uint32_t preventedCurses; - ChallengeParam *challengeParams; - uint32_t uVar6; - uint16_t uVar7; - Game *game; - int endStage; - Game *curGame; - short sVar8; - Manager *extraout_EDX; - Manager *manager; - uint32_t uVar9; - char cVar12; - uint32_t uVar10; - uint32_t uVar11; - uint16_t *puVar13; - int *entityType; - bool bVar14; - RNG slotRng; - uint32_t gridX; - uint16_t *variantPtr; - int *entryPtr; - uint32_t local_58; - int *local_54; - RNG rng; - uint32_t local_40; - Room *room; - char isBurningBasement; - char isFloodedCaves; - char isScarredWomb; - char local_33; - char local_32; - char local_31; - uint16_t *local_30; - RNG lockedCardRng; - RNG cardRng; - uint32_t local_c; - uint8_t auStack_8 [4]; - void *cardConfigs; - uint16_t *subTypePtr; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - uVar7 = 1; - entryPtr = entry; - local_58 = seed; - rng._seed = seed; - rng._shift1 = 1; - rng._shift2 = 0x15; - rng._shift3 = 0x14; - room = this; - if (*GHIDRA_CAST(entry) == 0x578) { - *GHIDRA_CAST(entry) = 0x21; - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - rng._seed = seed >> 1 ^ seed; - rng._seed = rng._seed << 0x15 ^ rng._seed; - rng._seed = GHIDRA_UINT(rng._seed) >> 0x14 ^ rng._seed; - uVar7 = (uint16_t)(rng._seed == (GHIDRA_UINT(rng._seed) / 0x28) * 0x28); -LAB_007ec1a6: - *GHIDRA_CAST((GHIDRA_CAST(entry) + 4)) = uVar7; - } - else if (*GHIDRA_CAST(entry) == 0x582) { - *GHIDRA_CAST(entry) = 0x21; - goto LAB_007ec1a6; - } - local_40 = *GHIDRA_CAST(entry); - local_30 = GHIDRA_CAST((GHIDRA_INT(entry) + 6)); - puVar13 = GHIDRA_CAST((GHIDRA_INT(entry) + 4)); - variantPtr = puVar13; - local_33 = LuaEngine::Callback_PreEntitySpawn(&local_40,puVar13,local_30,gridIndex,seed); - *GHIDRA_CAST(entry) = local_40; - if ((local_40 == 5) && (*puVar13 == 0x12d)) { - *puVar13 = 300; - uVar3 = (GHIDRA_CAST((&rng)))->RNG::Next(); - iVar4 = ItemPool::GetCardEx(uVar3,0,1,0,1); - cardRng._shift3 = 7; - cardRng._shift1 = 5; - cardRng._shift2 = 9; - cardRng._seed = uVar3; - iVar4 = lua_callback_run_get_card(&cardRng,iVar4,0,1,1); - *GHIDRA_CAST((GHIDRA_CAST(entry) + 6)) = (short)iVar4; - } - manager = g_manager; - game = g_game; - if (local_33 != '\0') { - return; - } - if (*GHIDRA_CAST(entry) == 5) { - local_40 = (GHIDRA_CAST((&rng)))->RNG::Next(); - subTypePtr = local_30; - game = g_game; - uVar7 = *puVar13; - if (uVar7 == 0x28) { - if (*local_30 == 4) { - bVar14 = (manager->_persistentGameData)._achievements[0xe2] == 0; - goto LAB_007ec3d4; - } - } - else if (uVar7 == 10) { - if (*local_30 == 7) { - bVar14 = (manager->_persistentGameData)._achievements[0xe0] == 0; -LAB_007ec3d4: - if (bVar14) { - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *local_30 = 0; - } - goto LAB_007ec4c4; - } - } - else { - uVar7 = *local_30; - if (uVar7 == 8) { - if ((manager->_persistentGameData)._achievements[0x21] == 0) { - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *local_30 = 3; - } - goto LAB_007ec4c4; - } - } - else if (uVar7 == 9) { - if ((manager->_persistentGameData)._achievements[0x148] == 0) { - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))); - puVar13 = local_30; - goto LAB_007ec308; - } - } - else { - if (uVar7 == 0xb) { - bVar2 = (manager->_persistentGameData)._achievements[0x187]; - } - else { - if (uVar7 != 0xc) goto LAB_007ec4be; - bVar2 = (manager->_persistentGameData)._achievements[0x19b]; - } - if (bVar2 == 0) { - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *local_30 = 2; - } - goto LAB_007ec4c4; - } - } - } - } - else { - if (uVar7 == 0x14) { - if (*local_30 == 5) { - bVar14 = (manager->_persistentGameData)._achievements[0xf2] == 0; - } - else if (*local_30 == 6) { - bVar14 = (manager->_persistentGameData)._achievements[0xf0] == 0; - } - else { - if (*local_30 != 7) goto LAB_007ec4be; - bVar14 = (manager->_persistentGameData)._achievements[0x265] == 0; - } - goto LAB_007ec3d4; - } - if (uVar7 == 0x1e) { - if (*local_30 == 4) { - bVar14 = (manager->_persistentGameData)._achievements[0x14d] == 0; - goto LAB_007ec3d4; - } - } - else if (uVar7 == 300) { - uVar7 = *local_30; - if ((((uVar7 != 0) && - (cardConfigs = (g_manager->_itemConfig)._cards._begin, - GHIDRA_INT(GHIDRA_UINT(uVar7)) < GHIDRA_INT((g_manager->_itemConfig)._cards._end) - GHIDRA_INT(cardConfigs) >> 2)) - && (iVar4 = *GHIDRA_CAST((GHIDRA_CAST(cardConfigs) + GHIDRA_UINT(uVar7) * 4)), iVar4 != 0)) && - (iVar4 = *GHIDRA_CAST((iVar4 + 4)), -1 < iVar4)) { - bVar2 = PersistentGameData::Unlocked(&manager->_persistentGameData,iVar4); - uVar3 = local_40; - if (bVar2 == 0) { - iVar4 = ItemPool::GetCardEx(local_40,0x19,10,10,1); - lockedCardRng._shift3 = 7; - lockedCardRng._seed = uVar3; - lockedCardRng._shift1 = 5; - lockedCardRng._shift2 = 9; - iVar4 = lua_callback_run_get_card(&lockedCardRng,iVar4,1,1,0); - *subTypePtr = (uint16_t)iVar4; - } - } - } - else if (uVar7 == 0x45) { - if (*local_30 == 2) { - bVar14 = (manager->_persistentGameData)._achievements[0x25c] == 0; - goto LAB_007ec3d4; - } - } - else if (uVar7 == 0x5a) { - if (*local_30 == 4) { - bVar14 = (manager->_persistentGameData)._achievements[0x267] == 0; - goto LAB_007ec3d4; - } - } - else { - if (uVar7 == 0x38) { - bVar2 = (manager->_persistentGameData)._achievements[0x261]; - } - else { - if (uVar7 != 0x3a) { - if ((uVar7 == 0x39) && ((manager->_persistentGameData)._achievements[0x259] == 0)) { - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *puVar13 = 0x3c; - } - goto LAB_007ec4c4; - } - goto LAB_007ec4be; - } - bVar2 = (manager->_persistentGameData)._achievements[0x263]; - } - if (bVar2 == 0) { - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *puVar13 = 0x32; - } - goto LAB_007ec4c4; - } - } - } -LAB_007ec4be: - game = g_game; - } - else { - if (*GHIDRA_CAST(entry) != 6) goto LAB_007ec4be; - uVar7 = *puVar13; - if (uVar7 != 0xf) { - if (uVar7 == 0x12) { - if ((g_manager->_persistentGameData)._achievements[0x266] == 0) { - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *puVar13 = 7; - } - goto LAB_007ec4c4; - } - } - else if (uVar7 == 0x11) { - if ((g_manager->_persistentGameData)._achievements[0x268] == 0) { - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *GHIDRA_CAST(entry) = 5; - *puVar13 = 10; - *GHIDRA_CAST((GHIDRA_CAST(entry) + 6)) = 3; - } - goto LAB_007ec4c4; - } - } - else if (uVar7 == 0x10) { - if ((g_manager->_persistentGameData)._achievements[0x25f] == 0) { - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))); -LAB_007ec308: - game = g_game; - if (((iVar4 != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *puVar13 = 1; - } - goto LAB_007ec4c4; - } - } - else if (uVar7 == 0xe) { - Game::GetPlayer(g_game,0); - iVar4 = FUN_00929b00(); - manager = g_manager; - if ((iVar4 != 0) && (-1 < *GHIDRA_CAST((iVar4 + 0x7c)))) { - bVar2 = PersistentGameData::Unlocked - (&g_manager->_persistentGameData,*GHIDRA_CAST((iVar4 + 0x7c))); - manager = extraout_EDX; - if (bVar2 == 0) goto LAB_007ec4be; - } - game = g_game; - if (((manager->_persistentGameData)._achievements[0x1b2] == 0) && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) { - *GHIDRA_CAST(entry) = 0x11; - *GHIDRA_CAST((GHIDRA_CAST(entry) + 4)) = 0; - } - else { - *GHIDRA_CAST(entry) = 5; - *GHIDRA_CAST((GHIDRA_CAST(entry) + 4)) = 0x2b00064; - } - goto LAB_007ec4c4; - } - goto LAB_007ec4be; - } - if ((g_manager->_persistentGameData)._achievements[0x260] != 0) goto LAB_007ec4be; - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) { - *puVar13 = 5; - } - } -LAB_007ec4c4: - uVar3 = game->_debugCurses; - uVar6 = game->_stage; - uVar10 = game->_curses; - uVar5 = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - game = g_game; - uVar11 = uVar6 + 1; - if ((~preventedCurses & (uVar5 | uVar3 | uVar10) & 2) == 0) { - uVar11 = uVar6; - } - iVar4 = g_game->_difficulty; - if ((iVar4 == 2) || (local_40 = uVar11, iVar4 == 3)) { - if (GHIDRA_INT(uVar11) < 5) { - local_40 = uVar11 * 2 - 1; - } - else { - local_40 = 0; - if (uVar11 == 5) { - local_40 = 10; - } - } - } - uVar3 = local_40; - local_30 = GHIDRA_CAST(g_game->_stageType); - if ((g_game->_challenge == 0) && ((g_game->_dailyChallenge)._id == 0)) { -LAB_007ec7f3: - local_32 = '\x01'; - } - else { - challengeParams = Game::GetChallengeParams(g_game); - local_32 = '\0'; - if (challengeParams->_pathType == 1) goto LAB_007ec7f3; - } - if ((game->_challenge == 0) && ((game->_dailyChallenge)._id == 0)) { -LAB_007ec81d: - local_31 = '\0'; - } - else { - challengeParams = Game::GetChallengeParams(game); - local_31 = '\x01'; - if (challengeParams->_pathType != 1) goto LAB_007ec81d; - } - entityType = entryPtr; - if ((iVar4 == 2) || (iVar4 == 3)) { - if ((*entryPtr == 9000) && - ((game->_currentRoomIdx == -0xc && - (bVar2 = Level::IsNextStageAvailable(GHIDRA_CAST(game)), bVar2 == 0)))) goto LAB_007ec9c4; - goto LAB_007ec9e3; - } - if (*entryPtr != 9000) goto LAB_007ec8f4; - if (((game->_stage < 1) || (6 < game->_stage)) || ((game->_gameStateFlags & 0x1000000000000) == 0) - ) { - if ((uVar3 == 0xb) && (room->_roomType == 3)) { - challengeParams = Game::GetChallengeParams(game); - curGame = g_game; - iVar4 = 0xc; - if ((challengeParams->_endStage != 0xc) && - (((game->_challenge != 0 || ((game->_dailyChallenge)._id != 0)) || - (((g_manager->_persistentGameData)._achievements[0x140] == 0 && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (game->_isDebug == 0)))))))) { - iVar4 = 0xb; - } - endStage = iVar4; - if (challengeParams->_isPathTypeSet != 0) { - endStage = challengeParams->_endStage; - if (challengeParams->_endStage == 0) { - endStage = iVar4; - } - if (challengeParams->_pathType == 3) goto LAB_007ec8f4; - } - if (endStage < 0xc) goto LAB_007ec8f4; - *GHIDRA_CAST((entityType + 1)) = 1; - } - else { -LAB_007ec8f4: - if (*entityType == 9000) { - if ((room->_roomType == 3) && - (bVar2 = Level::IsNextStageAvailable(GHIDRA_CAST(game)), bVar2 == 0)) { -LAB_007ec9c4: - curGame = g_game; - *entityType = 0x238c; - *GHIDRA_CAST((entityType + 1)) = 3; - goto LAB_007ec9e6; - } - if ((*entityType == 9000) && - ((room->_roomType == 0xf || - ((((room->_roomType == 3 && ((uVar3 == 8 || (uVar3 == 9)))) && - (((uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(2), uVar6 == 0 && (local_32 != '\0')) || - (local_31 != '\0')))) || - (((9 < GHIDRA_INT(uVar3) && (local_30 != GHIDRA_CAST(0x0))) || (g_game->_currentRoomIdx == -0xc)) - )))))) { - bVar2 = Level::IsNextStageAvailable(GHIDRA_CAST(g_game)); - if (bVar2 == 0) goto LAB_007ec9c4; - bVar2 = Level::IsStageWithinEnd(10,1); - if (bVar2 != 0) goto LAB_007ec98c; - } - } -LAB_007ec9e3: - curGame = g_game; - } - } - else { -LAB_007ec98c: - curGame = g_game; - *entityType = 999; - *GHIDRA_CAST((entityType + 1)) = 0x27; - } -LAB_007ec9e6: - puVar13 = GHIDRA_CAST((entityType + 1)); - if (((room->_roomType == 4) && ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)) >> 0xb & 1) != 0)) && - ((*entityType == 5 && ((*puVar13 == 100 && (*GHIDRA_CAST((GHIDRA_CAST(entityType) + 6)) == 0)))))) { - *puVar13 = 0x96; - } - if (*entityType == 6) { - slotRng._seed = local_58; - slotRng._shift3 = 0xd; - slotRng._shift1 = 0xb; - slotRng._shift2 = 0x11; - if (*puVar13 == 6) { - if ((((g_manager->_persistentGameData)._achievements[0x260] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (curGame != GHIDRA_CAST(0x0))) && - (((curGame->_dailyChallenge)._id != 0 || (curGame->_isDebug != 0)))))) && - (0 < curGame->_devilRoomDeals)) { - uVar6 = (GHIDRA_CAST((&slotRng)))->RNG::RandomInt(4); - if (uVar6 == 0) { - uVar7 = 0xf; - goto LAB_007ecad2; - } - goto LAB_007ecad5; - } - } - else if ((*puVar13 == 4) && - (((g_manager->_persistentGameData)._achievements[0x266] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (curGame != GHIDRA_CAST(0x0))) && - (((curGame->_dailyChallenge)._id != 0 || (curGame->_isDebug != 0)))))))) { - uVar6 = (GHIDRA_CAST((&slotRng)))->RNG::RandomInt(0xf); - if (uVar6 == 0) { - uVar7 = 0x12; -LAB_007ecad2: - *puVar13 = uVar7; - } -LAB_007ecad5: - curGame = g_game; - } - } - if (*entityType - 1U < 999) { - local_54 = GHIDRA_CAST(GHIDRA_UINT(*puVar13)); - Entity_NPC::Redirect(entityType,GHIDRA_CAST(&local_54)); - curGame = g_game; - *puVar13 = (uint16_t)local_54; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) == 0) || - (iVar4 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x10)), iVar4 == 0)) { - bVar2 = 0; - } - else { - bVar2 = (uint8_t)*GHIDRA_CAST((iVar4 + 0x4c)) & 1; - } - if (bVar2 != 0) { - return; - } - if (room->_roomType == 0x1b) { - return; - } - local_30 = GHIDRA_CAST(curGame->_stageType); - if ((((uVar3 != 3) && (uVar3 != 4)) || (local_30 == GHIDRA_CAST(0x4))) || - (local_33 = '\x01', local_30 == GHIDRA_CAST(0x5))) { - local_33 = '\0'; - } - if ((local_30 == GHIDRA_CAST(0x2)) && ((uVar3 == 1 || (uVar3 == 2)))) { - uVar9 = 0x100; - isBurningBasement = '\x01'; -LAB_007ecb70: - if ((uVar3 != 3) && (uVar3 != 4)) goto LAB_007ecb80; - isFloodedCaves = '\x01'; -LAB_007ecb89: - if ((uVar3 != 5) && (uVar3 != 6)) goto LAB_007ecb99; - local_31 = '\x01'; -LAB_007ecba2: - if ((uVar3 != 7) && (uVar3 != 8)) goto LAB_007ecbb2; - isScarredWomb = '\x01'; - } - else { - uVar9 = 0; - isBurningBasement = '\0'; - if (local_30 == GHIDRA_CAST(0x2)) goto LAB_007ecb70; -LAB_007ecb80: - isFloodedCaves = '\0'; - if (local_30 == GHIDRA_CAST(0x2)) goto LAB_007ecb89; -LAB_007ecb99: - local_31 = '\0'; - if (local_30 == GHIDRA_CAST(0x2)) goto LAB_007ecba2; -LAB_007ecbb2: - isScarredWomb = '\0'; - } - if (((g_manager->_persistentGameData)._achievements[0x15c] == 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || - (((curGame->_dailyChallenge)._id == 0 && (curGame->_isDebug == 0)))))) { - sVar8 = (short)(GHIDRA_UINT(uVar9) >> 8) << 8; - } - else { - sVar8 = (short)CONCAT31((int3)(GHIDRA_UINT(uVar9) >> 8),1); - } - iVar4 = *entityType; - local_32 = (char)sVar8; - if (0x12e < iVar4) goto switchD_007ecc0d_caseD_b; - if (iVar4 == 0x12e) { - if ((curGame->_dailyChallenge)._specialDailyId != 7) { - if (curGame->_challenge != 0x20) goto switchD_007ecc0d_caseD_b; - } - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5); - if (uVar6 == 0) { - *puVar13 = 10; - return; - } - goto switchD_007ecc0d_caseD_b; - } - cVar12 = (char)((uint16_t)sVar8 >> 8); - switch(iVar4) { - case 10: - goto LAB_007ecc16; - case 0xc: - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x3c); - if (uVar6 == 0) { - *entityType = 0x32c; - *puVar13 = 0; - return; - } - break; - case 0x16: - bVar14 = isFloodedCaves == '\0'; - goto LAB_007ecc9f; - case 0x17: - if ((isFloodedCaves != '\0') && (uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(2), uVar6 == 0)) { - *entityType = 0x17; - *puVar13 = 1; - return; - } - break; - case 0x18: - cVar12 = local_31; - goto LAB_007eccd6; - case 0x19: - cVar12 = isFloodedCaves; -LAB_007eccd6: - if (cVar12 != '\0') { - uVar6 = 2; -LAB_007eccde: - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(uVar6); - if (uVar6 == 0) goto LAB_007ecc2f; - } - break; - case 0x1b: - if (((local_33 != '\0') && (uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5), uVar6 == 0)) && (local_32 != '\0')) - { - *entityType = 300; - *puVar13 = 0; - return; - } - break; - case 0x1d: - if (((*puVar13 == 0) && (cVar12 != '\0')) && (uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5), uVar6 < 3)) { - *entityType = 0x36; - *puVar13 = 0; - return; - } - break; - case 0x23: - uVar6 = 0xf; - goto LAB_007eccde; - case 0x27: - if (((*puVar13 != 2) && (isScarredWomb != '\0')) && (uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(2), uVar6 == 0) - ) { - *puVar13 = 3; - return; - } - break; - case 0x28: - case 0x3a: - bVar14 = isScarredWomb == '\0'; - goto LAB_007ecc9f; - case 0x29: - if (*puVar13 == 0) { - uVar6 = 0x3c; - goto LAB_007eccde; - } - break; - case 0x55: - if (((local_30 == GHIDRA_CAST(0x4)) || (local_30 == GHIDRA_CAST(0x5))) && - ((uVar3 == 1 || (uVar3 == 2)))) { - *entityType = 0x32e; - *puVar13 = 0; - return; - } - goto LAB_007ecf5d; - case 0xd0: - if (((local_32 != '\0') && (*puVar13 == 1)) && (uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(10), uVar6 == 0)) { - *entityType = 0x12e; - *puVar13 = 0; - return; - } - cVar12 = isBurningBasement; -LAB_007ecc16: - if (cVar12 != '\0') { - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5); - bVar14 = uVar6 < 3; -LAB_007ecc29: - if (bVar14) { -LAB_007ecc2f: - *puVar13 = 2; - return; - } - } - break; - case 0xd4: - case 0xdc: - bVar14 = local_31 == '\0'; -LAB_007ecc9f: - if (!bVar14) { - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(2); - if (uVar6 == 0) { -LAB_007eccb7: - *puVar13 = 1; - return; - } - } - break; - case 0xe2: - if (cVar12 == '\0') break; - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5); - bVar14 = uVar6 < 2; - goto LAB_007ecc29; - case 0xe7: - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5); - if (uVar6 == 0) { - if (local_32 != '\0') { - local_58 = gridIndex / GHIDRA_UINT(room->_gridWidth); - gridX = gridIndex % GHIDRA_UINT(room->_gridWidth); - local_54 = room->_doorGridPositions; - uVar3 = 0; - do { - puVar13 = variantPtr; - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x18 + (uVar3 >> 5) * 4)) & - 1 << ((uint8_t)uVar3 & 0x1f)) != 0) && - (uVar6 = *local_54 / room->_gridWidth - local_58, - uVar5 = *local_54 % room->_gridWidth - gridX, uVar10 = GHIDRA_INT(uVar6) >> 0x1f, - uVar11 = GHIDRA_INT(uVar5) >> 0x1f, - GHIDRA_INT((((uVar6 ^ uVar10) - uVar10) + ((uVar5 ^ uVar11) - uVar11))) < 4)) { - entityType = entryPtr; - uVar3 = local_40; - goto switchD_007ecc0d_caseD_b; - } - uVar3 = uVar3 + 1; - local_54 = local_54 + 1; - } while (GHIDRA_INT(uVar3) < 8); - goto LAB_007eccb7; - } - } - } -switchD_007ecc0d_caseD_b: -LAB_007ecf5d: - local_32 = '\0'; - local_33 = '\0'; - local_31 = '\0'; - if (*puVar13 == 0) { - switch(*entityType) { - case 0xe: - case 0x10: - case 0x18: - case 0x1a: - case 0x1b: -switchD_007ecf80_caseD_e: - local_32 = '\x01'; - break; - case 0x19: - if (2 < GHIDRA_INT(uVar3)) goto switchD_007ecf80_caseD_e; - break; - case 0x1d: - case 0x1e: - case 0x26: - case 0x2a: - case 0x39: - case 0x3d: - case 0x58: - local_31 = '\x01'; - break; - case 0x27: - if (((uVar3 == 7) || (uVar3 == 8)) && (local_30 == GHIDRA_CAST(0x1))) { - local_31 = '\x01'; - } - break; - case 0x29: - case 0x37: - case 0x3c: - local_33 = '\x01'; - } - } - switch(*entityType) { - case 0xf: - case 0x10: - case 0x1a: - case 0x1e: - case 0x27: - case 0x37: - case 0x58: - uVar3 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(100); - if (uVar3 == 0) { - *puVar13 = 2; - } - } - if (local_33 == '\0') { - if ((local_32 == '\0') && (local_31 == '\0')) goto LAB_007ed028; - uVar3 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x15); - if (uVar3 != 0) goto LAB_007ecffe; - } - else { -LAB_007ecffe: - if (((local_31 != '\0') || (uVar3 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x19), uVar3 != 0)) && - (uVar3 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(100), uVar3 != 0)) goto LAB_007ed028; - } - *puVar13 = 1; -LAB_007ed028: - if (((*entityType == 0x19) && (*puVar13 == 3)) && (*GHIDRA_CAST((GHIDRA_CAST(entityType) + 6)) == 100)) { - uVar3 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(2); - *GHIDRA_CAST((GHIDRA_CAST(entityType) + 6)) = (short)uVar3; - } - return; -} - -// 007ed2a0 -uint8_t Room::IsPersistentRoomEntity(int type, int variant, int subType) -{ - if ((((type != 0x2a) && (type != 0xeb)) && (type != 0xec)) && ((type != 0xca && (type != 0xcb)))) - { - if (type == 0x2c) { - if (variant == 0) { - return 0; - } - } - else if ((((type != 0xda) && (type != 0x324)) && - ((type != 0x329 && (((type != 0x36d && (type != 0x37d)) && (type != 0x354)))))) && - (type != 0x3c5)) { - return 0; - } - } - return 1; -} - -// 007ed310 -uint8_t Room::SpawnEntry(uint32_t gridIndex, void *entry, uint32_t seed, Entity **outEntity, uint8_t isRespawn) -{ - Room *gridEntity = this; - int *piVar1; - code *pcVar2; - uint8_t bVar3; - uint16_t newVariant; - uint32_t uVar4; - int iVar5; - Entity_Player *itemOwner; - void *extraout_EAX; - void *state; - int iVar6; - uint32_t local_EAX_3229; - Entity *pEVar7; - GridEntity *gridEntity; - uint8_t unused; - uint8_t unused_00; - Manager *extraout_ECX; - Manager *extraout_ECX_00; - Manager *extraout_ECX_01; - Manager *pMVar8; - int extraout_ECX_02; - int extraout_ECX_03; - uint32_t extraout_EDX; - Room *pRVar9; - Game *game; - Entity **gridVariant; - float fVar10; - float fVar11; - float fVar12; - float fVar13; - EntityRef entityRef; - float ellipseCenterX; - Vector local_7c; - Vector local_74; - PlayerManager *local_6c; - RNG tmpRng; - float local_58; - uint32_t local_54; - RNG rng; - float local_40; - float local_3c; - float gridIndexLocal; - uint8_t local_31; - Entity *local_30; - Entity **local_2c; - Manager *local_28; - Room *room; - uint64_t entryLocal; - uint32_t entryWeight; - uint32_t local_14; - bool isUnlocked; - short *poopCount; - - local_14 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - local_2c = outEntity; - rng._shift1 = 5; - rng._shift2 = 9; - entryLocal = *GHIDRA_CAST(entry); - entryWeight = *GHIDRA_CAST((GHIDRA_CAST(entry) + 8)); - local_30 = GHIDRA_CAST(seed); - rng._seed = seed; - local_28 = GHIDRA_CAST(&DAT_00000007); - rng._shift3 = GHIDRA_INT(&DAT_00000007); - gridIndexLocal = (float)gridIndex; - local_54 = seed; - room = gridEntity; - TransformEntry(gridEntity,&entryLocal,gridIndex,seed); - if (((g_game->_currentRoomIdx == -0xc) && (GHIDRA_UINT(entryLocal) == 5)) && ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) == 100)) - goto LAB_007ed567; - bVar3 = Level::HasMirrorDimension(GHIDRA_CAST(g_game)); - if ((((bVar3 != 0) && (isRespawn == 0)) && - ((g_game->_currentDimensionIdx == 1 && (GHIDRA_UINT(entryLocal) == 5)))) && - ((iVar5 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x10)), *GHIDRA_CAST((iVar5 + 8)) != 4 || - (*GHIDRA_CAST((iVar5 + 0x10)) != 0x22)))) goto LAB_007ed567; - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))); - if ((iVar5 == 0) || (*GHIDRA_CAST((iVar5 + 0x10)) == 0)) { - bVar3 = 0; - } - else { - bVar3 = (uint8_t)(*GHIDRA_CAST((*GHIDRA_CAST((iVar5 + 0x10)) + 0x4c)) >> 3) & 1; - } - iVar6 = GHIDRA_UINT(entryLocal); - if (bVar3 != 0) { - if (GHIDRA_UINT(entryLocal) == 1000) { - if ((float)room->_tintedRockIdx != gridIndexLocal) goto LAB_007ed444; - } - else if ((GHIDRA_UINT(entryLocal) == 0x3e9) || (GHIDRA_UINT(entryLocal) == 0x3ea)) { -LAB_007ed444: - if ((g_game->_stageType == 2) && (*GHIDRA_CAST((*GHIDRA_CAST((iVar5 + 0x10)) + 8)) == 1)) { - if (local_54 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar4 = GHIDRA_UINT(local_30) >> ((uint8_t)rng._shift1 & 0x1f) ^ GHIDRA_UINT(local_30); - uVar4 = uVar4 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar4; - rng._seed = uVar4 >> ((uint8_t)local_28 & 0x1f) ^ uVar4; - local_30 = GHIDRA_CAST(rng._seed); - if (GHIDRA_UINT(rng._seed) % 10 == 0) { - iVar5 = g_game->_stage; - if ((iVar5 == 1) || (iVar5 == 2)) { - entryLocal = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))),0x21); - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x28); - iVar6 = GHIDRA_UINT(entryLocal); - entryLocal = (uint64_t)CONCAT14(uVar4 == 0,GHIDRA_UINT(entryLocal)); - local_28 = GHIDRA_CAST(rng._shift3); - local_30 = GHIDRA_CAST(rng._seed); - } - else if ((iVar5 == 3) || (iVar5 == 4)) { - entryLocal = 3000; - iVar6 = 3000; - } - else if ((iVar5 == 5) || (iVar5 == 6)) { - entryLocal = 0x78a; - iVar6 = 0x78a; - } - else if ((iVar5 == 7) || (iVar5 == 8)) { - entryLocal = 0x5d2; - iVar6 = 0x5d2; - } - } - } - } - } - pMVar8 = GHIDRA_CAST(room); - if (((room->_roomType == 2) && (**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) < 0)) && (iVar6 == 6)) { - if ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) == 8) goto LAB_007ed567; -LAB_007ed9e7: - bVar3 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)); - local_54 = CONCAT31((int3)(GHIDRA_UINT(pMVar8) >> 8),bVar3) & 0xffffff01; - if ((((bVar3 & 1) == 0) && (room->_roomType == 5)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)) & 0x10000) != 0)) { - local_54 = GHIDRA_UINT((iVar6 != 0x38f)); - } - if (iVar6 == 5) { - bVar3 = Level::IsMausoleumHeartStage(GHIDRA_CAST(g_game)); - if (bVar3 != 0) goto LAB_007ed567; - iVar6 = GHIDRA_UINT(entryLocal); - } - game = g_game; - if ((iVar6 == 0x3c5) && ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)) >> 2 & 1) != 0)) - goto LAB_007ed567; - if ((char)local_54 != '\0') { - bVar3 = IsPersistentRoomEntity(iVar6,(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),local_54); - if (((bVar3 == 0) && (bVar3 = Game::IsInTimedSet(game,0x19), bVar3 == 0)) && - ((bVar3 = Game::IsInTimedSet(game,0x20), bVar3 == 0 && (isRespawn == 0)))) { - bVar3 = entity_type_is_saved(iVar6,(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x6))),0,1); - if (bVar3 == 0) goto LAB_007ed567; - } - } - (GHIDRA_CAST((&entityRef)))->EntityRef::EntityRef(); - pRVar9 = room; - fVar13 = gridIndexLocal; - if ((GHIDRA_UINT(gridIndexLocal) < 0x1c0) && (room->_gridEntities[GHIDRA_INT(gridIndexLocal)] != GHIDRA_CAST(0x0))) - { - (**(code **)(*GHIDRA_CAST(room->_gridEntities[GHIDRA_INT(gridIndexLocal)]) + 0x14))(1); - } - local_74.x = (float)(GHIDRA_INT(fVar13) % pRVar9->_gridWidth) * 40.0 + 40.0; - local_74.y = (float)(GHIDRA_INT(fVar13) / pRVar9->_gridWidth) * 40.0 + 120.0; - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - local_30 = Game::Spawn(g_game,GHIDRA_UINT(entryLocal),(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),&local_74,&g_vectorZero, - GHIDRA_CAST(0x0),(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x6))),uVar4); - local_30->_spawnGridIndex = GHIDRA_INT(fVar13); - if (local_30->_type == 5) { - iVar5 = __RTDynamicCast(local_30,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor); - if (iVar5 != 0) { - *GHIDRA_CAST((iVar5 + 0x544)) = 0; - if (((*GHIDRA_CAST((iVar5 + 0x28)) == 5) && (*GHIDRA_CAST((iVar5 + 0x2c)) == 100)) && - ((*GHIDRA_CAST((iVar5 + 0x30)) == 0x272 || (*GHIDRA_CAST((iVar5 + 0x30)) == 0x273)))) { - *GHIDRA_CAST((iVar5 + 0x5c0)) = 0; - } - itemOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x2c7,GHIDRA_CAST(&g_game->_playerManager),1); - if ((itemOwner != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST((iVar5 + 0x173)) == '\0')) { - bVar3 = Entity_Pickup::CanRerollVariant(*GHIDRA_CAST((iVar5 + 0x2c)),*GHIDRA_CAST((iVar5 + 0x30))); - if ((bVar3 != 0) && - (((bVar3 = Entity_Pickup::IsChest(*GHIDRA_CAST((iVar5 + 0x2c))), bVar3 == 0 || - (*GHIDRA_CAST((iVar5 + 0x30)) != 0)) && (extraout_ECX_02 == 100)))) { - local_7c.y = (float)operator_new(0x78); - if (GHIDRA_CAST(local_7c.y) == GHIDRA_CAST(0x0)) { - state = (void *)0x0; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_7c.y))))->EntitySaveState::constructor(); - state = extraout_EAX; - } - piVar1 = GHIDRA_CAST((iVar5 + 0x5c8)); - (GHIDRA_CAST((piVar1)))->EntitySaveStateRef::Set(state); - tmpRng._shift1 = 5; - tmpRng._shift2 = 0xf; - *GHIDRA_CAST(*piVar1) = *GHIDRA_CAST((iVar5 + 0x28)); - *GHIDRA_CAST((*piVar1 + 4)) = *GHIDRA_CAST((iVar5 + 0x2c)); - tmpRng._seed = *GHIDRA_CAST((iVar5 + 0x3ec)); - tmpRng._shift3 = 0x11; - uVar4 = (GHIDRA_CAST((&tmpRng)))->RNG::Next(); - *GHIDRA_CAST((*piVar1 + 0x34)) = uVar4; - iVar6 = ItemPool::GetSeededCollectible - (*GHIDRA_CAST((*piVar1 + 0x34)),1, - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4))); - *GHIDRA_CAST((*piVar1 + 8)) = iVar6; - pRVar9 = room; - } - } - ANM2::Reset(GHIDRA_CAST((iVar5 + 0x5d0))); - } - fVar13 = gridIndexLocal; - } - bVar3 = entity_type_is_saved(GHIDRA_UINT(entryLocal),(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x6))),0,0) - ; - if (bVar3 != 0) { - local_3c = fVar13; - msvc::set::insert(&local_7c,&local_3c); - } - iVar5 = pRVar9->_roomType; - if (iVar5 == 0x11) { -LAB_007edd85: - if ((GHIDRA_UINT(entryLocal) == 5) && (((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) == 100 && (local_30->_type == 5)))) { - local_30[1]._sprite._color._offset[2] = 1.4013e-45; - } - } - else if (iVar5 == 4) { - iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar9)) + 0x4)))) + 0x10)) + 0x10)); - if (((iVar5 == 1) || (iVar5 == 3)) || (bVar3 = Level::IsAltPath(GHIDRA_CAST(g_game)), bVar3 != 0)) - goto LAB_007edd85; - } - else if ((iVar5 == 0x18) || (iVar5 == 0xf)) goto LAB_007edd85; - pEVar7 = local_30; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - KAGE_LogMessage(1,GHIDRA_CAST("[Frame %d] ")); - } - KAGE_LogMessage(1,GHIDRA_CAST("Spawn Entity with Type(%d), Variant(%d), Pos(%.2f,%.2f)\n")); - if (local_2c != GHIDRA_CAST(0x0)) { - *local_2c = pEVar7; - return 1; - } - goto LAB_007ee699; - } - if (iVar6 == 1000) { - if ((float)room->_tintedRockIdx != gridIndexLocal) goto LAB_007ed5aa; - goto LAB_007ed926; - } - if ((iVar6 == 0x3e9) || (iVar6 == 0x3ea)) { -LAB_007ed5aa: - if (room->_roomType != 0x10) { - local_3c = 2.66247e-44; - local_6c = &g_game->_playerManager; - tmpRng._shift1 = 1; - tmpRng._shift2 = 5; - if (local_54 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar4 = local_54 >> 1 ^ local_54; - uVar4 = uVar4 << 5 ^ uVar4; - uVar4 = uVar4 >> 0x13 ^ uVar4; - itemOwner = PlayerManager::RandomCollectibleOwner(local_6c,0x240,uVar4,GHIDRA_CAST(0x0)); - pMVar8 = extraout_ECX; - if (itemOwner != GHIDRA_CAST(0x0)) { - local_3c = itemOwner->_luck * 0.005 + 0.0625; - if (0.1 <= local_3c) { - local_3c = 0.1; - } - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar4 = uVar4 >> ((uint8_t)tmpRng._shift1 & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)tmpRng._shift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> 0x13 ^ uVar4; - pMVar8 = GHIDRA_CAST(0x0); - if ((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10 <= local_3c) { - iVar6 = 0x5dc; - entryLocal = 0x5dc; - goto LAB_007ed926; - } - } - iVar6 = GHIDRA_UINT(entryLocal); - } - } - if (iVar6 == 0x514) { - if (local_30 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar4 = GHIDRA_UINT(local_30) >> ((uint8_t)rng._shift1 & 0x1f) ^ GHIDRA_UINT(local_30); - uVar4 = uVar4 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar4; - rng._seed = uVar4 >> ((uint8_t)local_28 & 0x1f) ^ uVar4; - pMVar8 = GHIDRA_CAST(((GHIDRA_UINT(rng._seed) / 10) * 10)); - local_30 = GHIDRA_CAST(rng._seed); - if (GHIDRA_UINT(rng._seed) % 10 != 0) goto LAB_007ed72b; - iVar6 = 0x124; - (*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) = 0; -LAB_007ed9e4: - entryLocal = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))),iVar6); - goto LAB_007ed9e7; - } -LAB_007ed72b: - if (iVar6 != 9000) { - if (iVar6 != 999) goto LAB_007ed79c; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) == 0x27) goto LAB_007ed746; -LAB_007ed9df: - iVar6 = 1000; - goto LAB_007ed9e4; - } -LAB_007ed746: - bVar3 = Level::IsNextStageAvailable(GHIDRA_CAST(g_game)); - if ((((bVar3 == 0) && (iVar5 = room->_roomType, iVar5 != 3)) && - ((iVar5 != 0x1b && (g_game->_currentRoomIdx != -0xc)))) && - ((iVar5 != 5 || (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x10)) + 0x10)) != 0x58)))) { - iVar6 = 0x794; - entryLocal = 0x794; - pMVar8 = extraout_ECX_00; - goto LAB_007ed926; - } - pMVar8 = extraout_ECX_00; - iVar6 = GHIDRA_UINT(entryLocal); -LAB_007ed79c: - if (iVar6 == 9000) { -LAB_007ed7b7: - bVar3 = Level::HasMirrorDimension(GHIDRA_CAST(g_game)); - if ((bVar3 != 0) && (g_game->_currentDimensionIdx == 1)) { - iVar6 = 0; - entryLocal = 0; - pMVar8 = extraout_ECX_01; - goto LAB_007ed926; - } - pMVar8 = extraout_ECX_01; - iVar6 = GHIDRA_UINT(entryLocal); - } - else if (iVar6 == 999) { - if ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) != 0x27) goto LAB_007ed9df; - goto LAB_007ed7b7; - } - if (iVar6 == 0x11) { - if ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) == 0) { - if (local_30 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar4 = GHIDRA_UINT(local_30) >> ((uint8_t)rng._shift1 & 0x1f) ^ GHIDRA_UINT(local_30); - uVar4 = uVar4 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar4; - rng._seed = uVar4 >> ((uint8_t)local_28 & 0x1f) ^ uVar4; - pMVar8 = local_28; - local_30 = GHIDRA_CAST(rng._seed); - if (((rng._seed & 3U) != 0) || - ((pMVar8 = g_manager, (g_manager->_persistentGameData)._achievements[0xf7] == 0 && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))))) goto LAB_007ed870; - newVariant = 3; -LAB_007ed8ea: - (*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x0))) = CONCAT24(newVariant,GHIDRA_UINT(entryLocal)); - rng._seed = GHIDRA_INT(local_30); - } - else { -LAB_007ed870: - if ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))) == 1) { - if (local_30 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar4 = GHIDRA_UINT(local_30) >> ((uint8_t)rng._shift1 & 0x1f) ^ GHIDRA_UINT(local_30); - uVar4 = uVar4 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar4; - rng._seed = uVar4 >> ((uint8_t)local_28 & 0x1f) ^ uVar4; - pMVar8 = local_28; - local_30 = GHIDRA_CAST(rng._seed); - if (((rng._seed & 3U) == 0) && - (((g_manager->_persistentGameData)._achievements[0xf3] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - newVariant = 4; - goto LAB_007ed8ea; - } - } - } - } - if (iVar6 == 5000) { - if ((**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_bossPool))) + 0x8ac)))) & 0x1000000) != 0) { - iVar6 = 1000; - entryLocal = 0x10000000003e8; - } -LAB_007ed926: - if (isRespawn != 0) goto LAB_007ed567; - } - else if ((iVar6 < 1) || (999 < iVar6)) goto LAB_007ed926; - game = g_game; - if (iVar6 == 0x3ca) goto LAB_007ee699; - if (iVar6 == 0x3c9) { - uVar4 = GHIDRA_UINT(gridIndexLocal) / GHIDRA_UINT(room->_gridWidth); - local_EAX_3229 = GHIDRA_UINT(gridIndexLocal) % GHIDRA_UINT(room->_gridWidth); - add_trigger_output_cell(room,(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),local_EAX_3229 - 1,uVar4); - add_trigger_output_cell(room,(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),local_EAX_3229 + 1,uVar4); - add_trigger_output_cell(room,(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),local_EAX_3229,uVar4 - 1); - add_trigger_output_cell(room,(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x4))),local_EAX_3229,uVar4 + 1); - return 1; - } - if (iVar6 == 6000) { - (room->_railManager)._sprite._filename._buf[GHIDRA_INT(gridIndexLocal) + -0x1c0] = (*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))); - return 1; - } - if ((0 < iVar6) && (iVar6 < 1000)) { - if (iVar6 != 999) goto LAB_007ed9e7; - goto LAB_007ed9df; - } - if (iVar6 == 0x1771) { - iVar6 = 3000; - (room->_railManager)._sprite._filename._buf[GHIDRA_INT(gridIndexLocal) + -0x1c0] = (*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x4))); - entryLocal = CONCAT26((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x6))),3000); - } - if (room->_gridEntities[GHIDRA_INT(gridIndexLocal)] != (void *)0x0) goto LAB_007ed567; - local_2c = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(GHIDRA_UINT(entryLocal)))) + 0x4))); - local_6c = GHIDRA_CAST(0x0); - local_31 = has_room_config_flag(room,2); - local_3c = 2.8026e-45; - pRVar9 = room; - if (iVar6 < 0x515) { - if (iVar6 == 0x514) { - iVar5 = 0xc; - local_28 = GHIDRA_CAST(0xc); - gridVariant = GHIDRA_CAST(extraout_EDX); - goto LAB_007ee65c; - } - switch(iVar6) { - case 1000: - if ((local_31 != 0) || ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x6))) != 0)) { - iVar5 = 2; - local_28 = GHIDRA_CAST(0x2); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - } - if (((g_manager->_persistentGameData)._achievements[0x264] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (game != GHIDRA_CAST(0x0))) && - (((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))) { - tmpRng._shift1 = 3; - tmpRng._shift2 = 3; - tmpRng._seed = *GHIDRA_CAST((*GHIDRA_CAST((extraout_ECX_03 + 4)) + 0x58)); - tmpRng._shift3 = 0x1a; - uVar4 = (GHIDRA_CAST((&tmpRng)))->RNG::RandomInt(10); - if (uVar4 == 0) { - local_74.y = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - pRVar9 = room; - local_30 = GHIDRA_CAST((float)room->_gridHeight); - local_74.y = local_74.y * (float)local_30; - ellipseCenterX = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - ellipseCenterX = ellipseCenterX * (float)pRVar9->_gridWidth; - local_28 = GHIDRA_CAST(0x3fa00000); - local_30 = GHIDRA_CAST(0x3e99999a); - uVar4 = Game::GetStageID(g_game,unused); - if ((uVar4 == 0x1d) || (uVar4 = Game::GetStageID(g_game,unused_00), uVar4 == 0x1e)) { - local_28 = GHIDRA_CAST(0x3fe66666); - local_30 = GHIDRA_CAST(0x3f000000); - } - local_58 = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - local_40 = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - local_7c.y = (local_58 + local_40) * (float)local_30 + 0.3; - local_40 = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - local_58 = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - local_30 = GHIDRA_CAST(((local_40 + local_58) * (float)local_28 + 0.5)); - fVar13 = (GHIDRA_CAST((&tmpRng)))->RNG::RandomFloat(); - uVar4 = pRVar9->_gridWidth; - local_EAX_3229 = GHIDRA_UINT(gridIndexLocal) / uVar4; - uVar4 = GHIDRA_UINT(gridIndexLocal) % uVar4; - local_40 = -(fVar13 * 360.0) * 0.017453292; - local_58 = cos(local_40); - fVar13 = sin(local_40); - fVar12 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - - ellipseCenterX; - fVar10 = (float)((double)GHIDRA_INT(local_EAX_3229) + - __uint_to_double_fixup[-(GHIDRA_INT(local_EAX_3229) >> 0x1f)]) - local_74.y; - fVar11 = (fVar12 * local_58 - fVar13 * fVar10) / (float)local_30; - fVar13 = (fVar12 * fVar13 + local_58 * fVar10) / local_7c.y; - local_31 = fVar13 * fVar13 + fVar11 * fVar11 <= 1.0; - } - } - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x3e9); - pRVar9 = room; - if ((float)room->_tintedRockIdx == gridIndexLocal) { - local_28 = GHIDRA_CAST(0x4); - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x14); - if ((uVar4 == 0) && - (((g_manager->_persistentGameData)._achievements[0x143] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - iVar5 = 0x16; - local_28 = GHIDRA_CAST(0x16); - } - else { - iVar5 = 4; - } - } - else { - if (9 < GHIDRA_INT(uVar4)) { - gridVariant = local_2c; - if (local_31 == 0) { - iVar5 = GHIDRA_UINT((GHIDRA_INT(uVar4) < 0x10)) * 4 + 2; - local_28 = GHIDRA_CAST(iVar5); - } - else { - iVar5 = 0x1b; - local_28 = GHIDRA_CAST(0x1b); - } - break; - } - iVar5 = 5; - local_28 = GHIDRA_CAST(0x5); - } - goto LAB_007ee659; - case 0x3e9: - iVar5 = 5; - local_28 = GHIDRA_CAST(0x5); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0x3ea: - iVar5 = 6; - local_28 = GHIDRA_CAST(0x6); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0x3eb: - iVar5 = 4; - local_28 = GHIDRA_CAST(0x4); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0x3ec: - iVar5 = 0x16; - local_28 = GHIDRA_CAST(0x16); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - default: - goto switchD_007ede2a_caseD_3ed; - case 0x3f0: - iVar5 = 0x1a; - local_28 = GHIDRA_CAST(0x1a); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0x3f1: - iVar5 = 2; - local_28 = GHIDRA_CAST(0x2); - gridVariant = GHIDRA_CAST(10000); - break; - case 0x3f2: - iVar5 = 0x19; - local_28 = GHIDRA_CAST(0x19); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0x3f3: - if (((g_manager->_persistentGameData)._achievements[0x264] == 0) && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (game == GHIDRA_CAST(0x0))) || - (((game->_dailyChallenge)._id == 0 && (game->_isDebug == 0)))))) { - isUnlocked = false; - } - else { - isUnlocked = true; - } - iVar5 = 0x1b; - if (!isUnlocked) { - iVar5 = 2; - } - gridVariant = GHIDRA_CAST(extraout_EDX); - local_28 = GHIDRA_CAST(iVar5); - } - goto LAB_007ee65c; - } - if (0x76c < iVar6) { - if (4000 < iVar6) { - if (iVar6 < 0x17d5) { - if (iVar6 == 0x17d4) { - iVar5 = 0x17; - local_28 = GHIDRA_CAST(0x17); - gridVariant = GHIDRA_CAST(extraout_EDX); - } - else { - if (0x1389 < iVar6) { - if (iVar6 == 0x1771) goto switchD_007ee4c1_caseD_bb8; - goto switchD_007ede2a_caseD_3ed; - } - if (iVar6 == 0x1389) { - iVar5 = 0x15; - local_28 = GHIDRA_CAST(0x15); - gridVariant = GHIDRA_CAST(1); - } - else if (iVar6 == 0x1194) { - iVar5 = 0x14; - local_28 = GHIDRA_CAST(0x14); - gridVariant = GHIDRA_CAST(extraout_EDX); - } - else { - if (iVar6 != 5000) goto switchD_007ede2a_caseD_3ed; - iVar5 = 0x15; - local_28 = GHIDRA_CAST(0x15); - gridVariant = GHIDRA_CAST(0); - } - } - } - else if (iVar6 == 9000) { - iVar5 = 0x11; - local_28 = GHIDRA_CAST(0x11); - gridVariant = GHIDRA_CAST(0); - local_6c = GHIDRA_CAST(extraout_EDX); - } - else if (iVar6 == 0x238c) { - iVar5 = 0x12; - local_28 = GHIDRA_CAST(0x12); - gridVariant = GHIDRA_CAST(extraout_EDX); - } - else { - if (iVar6 != 10000) goto switchD_007ede2a_caseD_3ed; - iVar5 = 0x13; - local_28 = GHIDRA_CAST(0x13); - gridVariant = GHIDRA_CAST(extraout_EDX); - } - goto LAB_007ee65c; - } - if (iVar6 == 4000) { - iVar5 = 0xb; - local_28 = GHIDRA_CAST(0xb); - gridVariant = GHIDRA_CAST(extraout_EDX); - goto LAB_007ee65c; - } - if (iVar6 < 2000) { - if (iVar6 == 1999) { - iVar5 = 0xf; - local_28 = GHIDRA_CAST(0xf); - gridVariant = GHIDRA_CAST(extraout_EDX); - } - else { - switch(iVar6) { - case 0x76d: - iVar5 = 0x18; - local_28 = GHIDRA_CAST(0x18); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - default: - goto switchD_007ede2a_caseD_3ed; - case 0x78a: - iVar5 = 8; - local_28 = GHIDRA_CAST(0x8); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0x78b: - iVar5 = 9; - local_28 = GHIDRA_CAST(0x9); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0x794: - iVar5 = 10; - local_28 = GHIDRA_CAST(0xa); - gridVariant = GHIDRA_CAST(extraout_EDX); - } - } - goto LAB_007ee65c; - } - switch(iVar6) { - case 3000: - case 0xbba: -switchD_007ee4c1_caseD_bb8: - gridVariant = GHIDRA_CAST(extraout_EDX); - goto LAB_007ee5d9; - case 0xbb9: - local_28 = GHIDRA_CAST(0x7); - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - local_7c.x = (float)(GHIDRA_INT(gridIndexLocal) % room->_gridWidth) * 40.0 + 40.0; - local_7c.y = (float)(GHIDRA_INT(gridIndexLocal) / room->_gridWidth) * 40.0 + 120.0; - pEVar7 = Game::Spawn(g_game,1000,0xc0,&local_7c,&g_vectorZero,GHIDRA_CAST(0x0), - (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entryLocal))) + 0x6))),uVar4); - pEVar7->Update(); - iVar5 = 7; - piVar1 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x54)); - *piVar1 = *piVar1 + 1; - pRVar9 = room; - gridVariant = local_2c; - break; - default: -switchD_007ede2a_caseD_3ed: - iVar5 = 1; - local_28 = GHIDRA_CAST(0x1); - gridVariant = GHIDRA_CAST(extraout_EDX); - break; - case 0xbc1: - gridVariant = GHIDRA_CAST(0x80); -LAB_007ee5d9: - iVar5 = 7; - local_28 = GHIDRA_CAST(0x7); - piVar1 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x54)); - *piVar1 = *piVar1 + 1; - } - goto LAB_007ee65c; - } - if (iVar6 == 0x76c) { - iVar5 = 3; - local_28 = GHIDRA_CAST(0x3); - gridVariant = GHIDRA_CAST(extraout_EDX); - goto LAB_007ee65c; - } - switch(iVar6) { - case 0x578: - iVar5 = 0xd; - local_28 = GHIDRA_CAST(0xd); - gridVariant = GHIDRA_CAST(0); - goto LAB_007ee65c; - default: - goto switchD_007ede2a_caseD_3ed; - case 0x582: - iVar5 = 0xd; - local_28 = GHIDRA_CAST(0xd); - gridVariant = GHIDRA_CAST(1); - goto LAB_007ee65c; - case 0x5d2: - local_2c = GHIDRA_CAST(0x1); - break; - case 0x5d6: - local_2c = GHIDRA_CAST(0x4); - break; - case 0x5d7: - local_2c = GHIDRA_CAST(0x2); - break; - case 0x5d8: - local_2c = GHIDRA_CAST(0x3); - break; - case 0x5d9: - local_2c = GHIDRA_CAST(0x5); - break; - case 0x5da: - local_2c = GHIDRA_CAST(0x6); - break; - case 0x5db: - local_2c = GHIDRA_CAST(0x7); - break; - case 0x5dc: - local_2c = GHIDRA_CAST(0x0); - break; - case 0x5dd: - local_2c = GHIDRA_CAST(0xb); - } - iVar5 = 0xe; - local_28 = GHIDRA_CAST(0xe); - if ((local_31 == 0) && ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x6))) == 0)) { - if (local_2c == GHIDRA_CAST(0x0)) { - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x28); - if (uVar4 == 0) { - local_2c = GHIDRA_CAST(0x2); - goto LAB_007ee333; - } - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(100); - if (uVar4 == 0) { - game = g_game; - pEVar7 = GHIDRA_CAST(rng._seed); - if (((g_manager->_persistentGameData)._achievements[0x25d] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) { - local_2c = GHIDRA_CAST(0xb); - } - goto LAB_007ee378; - } - goto switchD_007ee34a_caseD_3; - } - if (local_2c == GHIDRA_CAST(0x2)) { -LAB_007ee333: - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(0x28); - switch(uVar4) { - case 1: - case 2: - local_2c = GHIDRA_CAST(0x3); - default: -switchD_007ee34a_caseD_3: - pEVar7 = GHIDRA_CAST(rng._seed); - game = g_game; - break; - case 5: - case 6: - case 7: - local_2c = GHIDRA_CAST(0x4); - pEVar7 = GHIDRA_CAST(rng._seed); - game = g_game; - } - } - else { - pEVar7 = local_30; - } -LAB_007ee378: - itemOwner = PlayerManager::FirstTrinketOwner(&game->_playerManager,0x5b); - if (itemOwner == GHIDRA_CAST(0x0)) { - iVar5 = 0xe; - poopCount = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x50)); - *poopCount = *poopCount + 1; - pRVar9 = room; - gridVariant = local_2c; - } - else { - tmpRng._shift3 = 0x19; - uVar4 = 0x21; - tmpRng._shift1 = 2; - tmpRng._shift2 = 7; - tmpRng._seed = GHIDRA_INT(pEVar7); - iVar5 = (GHIDRA_CAST((itemOwner)))->Entity_Player::GetTrinketMultiplier(0x5b); - if (iVar5 == 2) { - uVar4 = 0x42; - } - else if (iVar5 == 3) { - uVar4 = 100; - } - local_EAX_3229 = (GHIDRA_CAST((&tmpRng)))->RNG::RandomInt(100); - gridVariant = local_2c; - if (local_EAX_3229 < uVar4) { - gridVariant = GHIDRA_CAST(0x5); - } - iVar5 = 0xe; - poopCount = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x50)); - *poopCount = *poopCount + 1; - pRVar9 = room; - } - } - else { -LAB_007ee659: - gridVariant = local_2c; - } -LAB_007ee65c: - gridEntity = Isaac::CreateGridEntity(iVar5,GHIDRA_UINT(gridIndexLocal)); - if (gridEntity == GHIDRA_CAST(0x0)) { -LAB_007ed567: - bVar3 = 0; - } - else { - pRVar9->_gridEntities[GHIDRA_INT(gridIndexLocal)] = gridEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = gridVariant; - gridEntity->_varData = GHIDRA_INT(local_6c); - if (local_28 == GHIDRA_CAST(0x17)) { - fVar13 = 0.0; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(entryLocal)) + 0x6))) != 0) { - fVar13 = local_3c; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0xc)))) = fVar13; - } - (GHIDRA_CAST((gridEntity)))->GridEntity::Init(local_54); -LAB_007ee699: - bVar3 = 1; - } - return bVar3; -} - -// 007ee7e0 -uint8_t Room::make_wall(int x, int y) -{ - uint32_t uVar1; - GridEntity *gridEntity; - uint32_t Seed; - uint32_t uVar2; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int roomData; - int roomSubtype; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b00ebb; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - uVar2 = this->_gridWidth * y + x; - if ((GHIDRA_INT(uVar2) < 0) || (this->_gridHeight * this->_gridWidth <= GHIDRA_INT(uVar2))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("make_wall index out of bounds\n")); - } - if (this->_gridEntities[uVar2] != (void *)0x0) { - ExceptionList = local_10; - return 0; - } - if (this->_roomType == 0x10) { - roomData = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - roomSubtype = *GHIDRA_CAST((roomData + 0x10)); - if ((roomSubtype != 2) && (roomSubtype != 3)) { - if (y == 0) { - if (x == 2) { - uVar1 = Random(); - if ((GHIDRA_INT(uVar2) < 0) || (0x1bf < GHIDRA_INT(uVar2))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if (0x1bf < uVar2) { - ExceptionList = local_10; - return 0; - } - if (900 < this->_gridPaths[uVar2]) { - ExceptionList = local_10; - return 0; - } - gridEntity = operator_new(0x154); - local_8 = 0; - if (gridEntity == GHIDRA_CAST(0x0)) { - gridEntity = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((gridEntity)))->GridEntity::GridEntity(); - *GHIDRA_CAST(gridEntity) = IsaacRepentancePlus::GridEntity_Decoration::vftable; - } - local_8 = 0xffffffff; - if (gridEntity == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return 0; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) = 1; - gridEntity->_gridIndex = uVar2; - if (this->_gridEntities[uVar2] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[uVar2]))(1); - } - this->_gridEntities[uVar2] = gridEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = 10; - gridEntity->_varData = 0; - (GHIDRA_CAST((gridEntity)))->GridEntity::Init(uVar1); - ExceptionList = local_10; - return 0; - } - } - else if ((((y == 3) || (y == 4)) && (x == 0xe)) && (*GHIDRA_CAST((roomData + 0xc)) == 1)) { - Seed = Random(); - if (((GHIDRA_INT(uVar2) < 0) || (0x1bf < GHIDRA_INT(uVar2))) && - ((KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")), GHIDRA_INT(uVar2) < 0 - || (0x1bf < GHIDRA_INT(uVar2))))) { - (**(code **)(iRam00000000 + 4))(uVar1); - ExceptionList = local_10; - return 0; - } - if (this->_gridPaths[uVar2] < 0x385) { - gridEntity = operator_new(0x154); - local_8 = 0x29; - if (gridEntity == GHIDRA_CAST(0x0)) { - gridEntity = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((gridEntity)))->GridEntity::GridEntity(); - *GHIDRA_CAST(gridEntity) = IsaacRepentancePlus::GridEntity_Gravity::vftable; - } - local_8 = 0xffffffff; - if (gridEntity != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) = 0x13; - gridEntity->_gridIndex = uVar2; - if (this->_gridEntities[uVar2] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[uVar2]))(1); - } - this->_gridEntities[uVar2] = gridEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = 0; - gridEntity->_varData = 0; - (GHIDRA_CAST((gridEntity)))->GridEntity::Init(Seed); - } - } - (**(code **)(*GHIDRA_CAST(this->_gridEntities[uVar2]) + 4))(); - ExceptionList = local_10; - return 0; - } - } - } - gridEntity = operator_new(0x154); - local_8 = 0x33; - if (gridEntity == GHIDRA_CAST(0x0)) { - gridEntity = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((gridEntity)))->GridEntity::GridEntity(); - *GHIDRA_CAST(gridEntity) = IsaacRepentancePlus::GridEntity_Wall::vftable; - } - local_8 = 0xffffffff; - if (gridEntity == GHIDRA_CAST(0x0)) { - ExceptionList = local_10; - return 0; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) = 0xf; - gridEntity->_gridIndex = uVar2; - this->_gridEntities[uVar2] = gridEntity; - uVar2 = Random(); - (GHIDRA_CAST((gridEntity)))->GridEntity::Init(uVar2); - ExceptionList = local_10; - return 1; -} - -// 007eea90 -void Room::MakeDoor(int slot) -{ - int iVar1; - uint32_t uVar2; - int *piVar3; - GridEntity *newDoor; - int doorAngles [5]; - void *local_10; - uint8_t *puStack_c; - int local_8; - Game *game; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b00f0d; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((doorAngles + 8)); - ExceptionList = &local_10; - if (this->_doors[slot] == (void *)0x0) { - iVar1 = this->_doorGridPositions[slot]; - doorAngles[4] = uVar2; - if (iVar1 < 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("invalid GridIndex while spawning door (slot %d)")); - } - piVar3 = GHIDRA_CAST(__RTDynamicCast(this->_gridEntities[iVar1],0, - &IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Door::RTTI_Type_Descriptor,0, - uVar2)); - if (piVar3 == GHIDRA_CAST(0x0)) { - newDoor = operator_new(0x404); - local_8 = 2; - if (newDoor == GHIDRA_CAST(0x0)) { - newDoor = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((newDoor)))->GridEntity::GridEntity(); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 3; - *GHIDRA_CAST(newDoor) = IsaacRepentancePlus::GridEntity_Door::vftable; - ANM2::constructor(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(newDoor[1])) + 0x14))))); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),4); - ANM2::constructor(GHIDRA_CAST((newDoor[1]._sprite._championColor._colorize + 1))); - newDoor[2]._sprite._color._colorize[1] = 0.0; - newDoor[2]._sprite._color._offset[1] = 0.0; - newDoor[2]._sprite._color._offset[2] = 2.10195e-44; - *GHIDRA_CAST((newDoor[2]._sprite._color._colorize + 1)) = 0; - newDoor[2]._sprite._championColor._tint[0] = 0.0; - newDoor[2]._sprite._championColor._colorize[0] = 0.0; - newDoor[2]._sprite._championColor._colorize[1] = 2.10195e-44; - *GHIDRA_CAST(newDoor[2]._sprite._championColor._tint) = 0; - newDoor[2]._sprite._championColor._colorize[2] = 0.0; - newDoor[2]._sprite._championColor._offset[2] = 0.0; - newDoor[2]._sprite._flipX = 0xf; - newDoor[2]._sprite._flipY = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(newDoor[2]._sprite)) + 0x102)))) = 0; - *GHIDRA_CAST((newDoor[2]._sprite._championColor._colorize + 2)) = 0; - newDoor[2]._sprite._playbackSpeed = 0.0; - *GHIDRA_CAST((newDoor + 3)) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(newDoor[3])) + 0x4)))) = 0xf; - *GHIDRA_CAST(&newDoor[2]._sprite._playbackSpeed) = 0; - } - local_8 = 0xffffffff; - if (newDoor != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((newDoor)) + 0x4)))) = 0x10; - newDoor->_gridIndex = iVar1; - } - piVar3 = GHIDRA_CAST(__RTDynamicCast(newDoor,0, - &IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Door::RTTI_Type_Descriptor,0, - uVar2)); - piVar3[2] = 0; - piVar3[3] = 0; - if (this->_gridEntities[iVar1] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[iVar1]))(1); - } - this->_gridEntities[iVar1] = piVar3; - } - uVar2 = Random(); - piVar3[5] = uVar2; - piVar3[0xf] = 0; - (**(code **)(*piVar3 + 0x20))(); - game = g_game; - piVar3[4] = piVar3[4] + 1; - *GHIDRA_CAST((piVar3 + 7)) = 1; - piVar3[10] = game->_frameCount; - uVar2 = slot & 0x80000003; - if (GHIDRA_INT(uVar2) < 0) { - uVar2 = (uVar2 - 1 | 0xfffffffc) + 1; - } - doorAngles[0] = -0x3d4c0000; - doorAngles[1] = 0; - doorAngles[2] = 0x42b40000; - doorAngles[3] = 0x43340000; - piVar3[0x59] = uVar2; - iVar1 = doorAngles[uVar2]; - piVar3[0x39] = iVar1; - piVar3[200] = iVar1; - piVar3[0x83] = iVar1; - piVar3[0x56] = slot; - this->_doors[slot] = piVar3; - } - ExceptionList = local_10; - return; -} - -// 007eece0 -int Room::GetRoomConfigStage() -{ - int *roomConfig; - - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 0) || - (roomConfig = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)), roomConfig == GHIDRA_CAST(0x0))) { - KAGE_LogMessage(4,GHIDRA_CAST("Room stage config is missing, returning a default one (SPECIAL)!\n")); - return 0; - } - return *roomConfig; -} - -// 007efa50 -void Room::on_leave() -{ - void *pvVar1; - Entity_Pickup *pickup; - uint8_t bVar2; - char isReleased; - uint32_t stackCookie; - int gridSaveOffset; - void **gridEntitySlot; - int gridIndex; - uint32_t childSaveState; - uint32_t local_120; - uint32_t local_11c; - uint32_t local_118; - uint32_t local_114; - uint32_t uStack_110; - uint32_t uStack_10c; - uint32_t uStack_108; - uint32_t local_104; - uint32_t local_100; - Vector childSavedTargetPos; - uint32_t childExtraData; - int *childExtraDataRefCount; - uint32_t childLinkedSaveState; - int *childLinkedSaveStateRefCount; - uint32_t saveState; - uint32_t local_a8; - uint32_t local_a4; - uint32_t local_a0; - uint32_t local_9c; - uint32_t uStack_98; - uint32_t uStack_94; - uint32_t uStack_90; - uint32_t local_8c; - uint32_t local_88; - Vector savedTargetPos; - uint32_t extraData; - int *extraDataRefCount; - uint32_t linkedSaveState; - int *linkedSaveStateRefCount; - GridEntityDesc emptyGridDesc; - uint32_t local_14; - void *prevExceptionList; - uint8_t *puStack_c; - uint32_t ehState; - short *clearCount; - uint32_t descInitialized; - uint32_t descSpawnCount; - uint32_t descSpawnSeed; - uint32_t descState; - uint32_t descVarData; - uint32_t descVariableSeed; - uint32_t descVariant; - Game *game; - uint32_t *gridSaveSlot; - int gridSaveStates; - bool isPairedPickup; - EntitySaveState *savedEntitiesEnd; - - ehState = 0xffffffff; - puStack_c = &LAB_00b00fab; - prevExceptionList = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &prevExceptionList; - if (0 < this->_shopRestockTimer) { - this->_shopRestockTimer = -1; - ShopRestockPartial(this); - } - game = g_game; - if ((g_game->_currentRoomIdx != -3) && - (gridIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))), *GHIDRA_CAST((gridIndex + 0x40)) != 0)) { - if ((this->_roomClearDelay - 1U < 8) && ((*GHIDRA_CAST((gridIndex + 0x44)) & 1) == 0)) { - this->_roomClearDelay = 0; - *GHIDRA_CAST((gridIndex + 0x44)) = *GHIDRA_CAST((gridIndex + 0x44)) | 1; - clearCount = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x4a)); - *clearCount = *clearCount + 1; - gridIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - ScoreSheet::add_cleared_room - (GHIDRA_CAST(&game->_scoreSheet),this->_roomType, - *GHIDRA_CAST((*GHIDRA_CAST((gridIndex + 0x10)) + 0x48)),GHIDRA_UINT(*GHIDRA_CAST((gridIndex + 0x4a))), - (uint8_t)(*GHIDRA_CAST((gridIndex + 0x44)) >> 10) & 1); - game = g_game; - bVar2 = Game::IsGreedMode(g_game); - if ((bVar2 == 0) || (this->_roomType != 1)) { - PlayerManager::trigger_room_clear(&game->_playerManager); - } - SpawnClearAward(this); - game = g_game; - bVar2 = Game::IsGreedMode(g_game); - if ((bVar2 != 0) && (this->_roomType == 1)) { - game->_greedLastBeatenWave = game->_greedModeWave; - } - } - FUN_00571170(stackCookie); - gridIndex = 0; - if (0 < this->_gridWidth * this->_gridHeight) { - gridSaveOffset = 0; - gridEntitySlot = this->_gridEntities; - do { - pvVar1 = *gridEntitySlot; - if (pvVar1 == (void *)0x0) { - emptyGridDesc._type = 0; - emptyGridDesc._variant = 0; - emptyGridDesc._state = 0; - gridSaveStates = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x68)); - emptyGridDesc._spawnCount = 0; - emptyGridDesc._spawnSeed = 0x16a9de81; - emptyGridDesc._varData = 0; - gridSaveSlot = GHIDRA_CAST((gridSaveStates + gridSaveOffset)); - *gridSaveSlot = 0; - gridSaveSlot[1] = 0; - gridSaveSlot[2] = 0; - gridSaveSlot[3] = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(emptyGridDesc)) + 0x18))) = (*GHIDRA_CAST((GHIDRA_CAST(&(emptyGridDesc)) + 0x18))) & 0xffffff00; - emptyGridDesc._variableSeed = 0x16a9de81; - gridSaveSlot = GHIDRA_CAST((gridSaveStates + 0x10 + gridSaveOffset)); - *gridSaveSlot = 0x16a9de81; - gridSaveSlot[1] = 0; - gridSaveSlot[2] = (*GHIDRA_CAST((GHIDRA_CAST(&(emptyGridDesc)) + 0x18))); - gridSaveSlot[3] = 0x16a9de81; - } - else { - descVariant = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 8)); - descState = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)); - descSpawnCount = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x10)); - descSpawnSeed = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x14)); - descVarData = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x18)); - descInitialized = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1c)); - descVariableSeed = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x20)); - gridSaveStates = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x68)); - gridSaveSlot = GHIDRA_CAST((gridSaveStates + gridSaveOffset)); - *gridSaveSlot = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)); - gridSaveSlot[1] = descVariant; - gridSaveSlot[2] = descState; - gridSaveSlot[3] = descSpawnCount; - gridSaveSlot = GHIDRA_CAST((gridSaveStates + 0x10 + gridSaveOffset)); - *gridSaveSlot = descSpawnSeed; - gridSaveSlot[1] = descVarData; - gridSaveSlot[2] = descInitialized; - gridSaveSlot[3] = descVariableSeed; - } - gridIndex = gridIndex + 1; - gridEntitySlot = gridEntitySlot + 1; - gridSaveOffset = gridSaveOffset + 0x20; - } while (gridIndex < this->_gridWidth * this->_gridHeight); - } - local_14 = 0; - if ((this->_entityList)._updateEL._size != 0) { - do { - pickup = *(Entity_Pickup **) - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))) + local_14 * 4); - local_9c = 0; - uStack_98 = 0; - uStack_94 = 0xffffffff; - uStack_90 = 0xffffffff; - saveState = 0; - savedTargetPos.x = g_vectorZero.x; - savedTargetPos.y = g_vectorZero.y; - local_a8 = 0; - local_a4 = 0; - local_a0 = 0; - local_8c = 0; - local_88 = 0; - extraData = 0; - extraDataRefCount = GHIDRA_CAST(0x0); - linkedSaveState = 0; - linkedSaveStateRefCount = GHIDRA_CAST(0x0); - ehState = 0; - if ((pickup->_type == 0x3c5) && (pickup->_variant == 0)) { - isPairedPickup = true; - } - else { - isPairedPickup = false; - } - if (isPairedPickup) { - local_114 = 0; - uStack_110 = 0; - uStack_10c = 0xffffffff; - uStack_108 = 0xffffffff; - childSaveState = 0; - childSavedTargetPos.x = g_vectorZero.x; - childSavedTargetPos.y = g_vectorZero.y; - local_120 = 0; - local_11c = 0; - local_118 = 0; - local_104 = 0; - local_100 = 0; - childExtraData = 0; - childExtraDataRefCount = GHIDRA_CAST(0x0); - childLinkedSaveState = 0; - childLinkedSaveStateRefCount = GHIDRA_CAST(0x0); - ehState = 1; - if (GHIDRA_CAST(pickup->_child) != GHIDRA_CAST(0x0)) { - bVar2 = Entity_Pickup::CanFlip - (this,GHIDRA_CAST(pickup->_child), - GHIDRA_CAST(&childSaveState),1); - if (bVar2 != 0) { - bVar2 = Entity_Pickup::CanFlip(this,pickup,GHIDRA_CAST(&saveState),0); - if (bVar2 != 0) { - gridIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - savedEntitiesEnd = *GHIDRA_CAST((gridIndex + 0x78)); - if (savedEntitiesEnd == *GHIDRA_CAST((gridIndex + 0x7c))) { - msvc::vector::_Emplace_reallocate(savedEntitiesEnd,&saveState); - } - else { - (GHIDRA_CAST((savedEntitiesEnd)))->EntitySaveState::copy(&saveState); - *GHIDRA_CAST((gridIndex + 0x78)) = *GHIDRA_CAST((gridIndex + 0x78)) + 0x78; - } - gridIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - savedEntitiesEnd = *GHIDRA_CAST((gridIndex + 0x78)); - if (savedEntitiesEnd == *GHIDRA_CAST((gridIndex + 0x7c))) { - msvc::vector::_Emplace_reallocate - (savedEntitiesEnd,&childSaveState); - } - else { - (GHIDRA_CAST((savedEntitiesEnd)))->EntitySaveState::copy(&childSaveState); - *GHIDRA_CAST((gridIndex + 0x78)) = *GHIDRA_CAST((gridIndex + 0x78)) + 0x78; - } - } - } - } - (*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x0))) = 2; - if (childLinkedSaveStateRefCount != GHIDRA_CAST(0x0)) { - isReleased = (**(code **)(*childLinkedSaveStateRefCount + 0xc))(); - if ((isReleased != '\0') && (g_entitySaveStateReleaseFn != (void *)0x0)) { - (*g_entitySaveStateReleaseFn)(&childLinkedSaveState); - } - } - ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),3); - if (childExtraDataRefCount != GHIDRA_CAST(0x0)) { - isReleased = (**(code **)(*childExtraDataRefCount + 0xc))(); - if ((isReleased != '\0') && (g_entitySaveStateExtraDataReleaseFn != (void *)0x0)) { - (*g_entitySaveStateExtraDataReleaseFn)(&childExtraData); - } - } - } - else { - bVar2 = Entity_Pickup::CanFlip(this,pickup,GHIDRA_CAST(&saveState),0); - if (bVar2 != 0) { - gridIndex = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - savedEntitiesEnd = *GHIDRA_CAST((gridIndex + 0x78)); - if (savedEntitiesEnd == *GHIDRA_CAST((gridIndex + 0x7c))) { - msvc::vector::_Emplace_reallocate(savedEntitiesEnd,&saveState); - } - else { - (GHIDRA_CAST((savedEntitiesEnd)))->EntitySaveState::copy(&saveState); - *GHIDRA_CAST((gridIndex + 0x78)) = *GHIDRA_CAST((gridIndex + 0x78)) + 0x78; - } - } - } - ehState = 4; - if (linkedSaveStateRefCount != GHIDRA_CAST(0x0)) { - isReleased = (**(code **)(*linkedSaveStateRefCount + 0xc))(); - if ((isReleased != '\0') && (g_entitySaveStateReleaseFn != (void *)0x0)) { - (*g_entitySaveStateReleaseFn)(&linkedSaveState); - } - } - ehState = 5; - if (extraDataRefCount != GHIDRA_CAST(0x0)) { - isReleased = (**(code **)(*extraDataRefCount + 0xc))(); - if ((isReleased != '\0') && (g_entitySaveStateExtraDataReleaseFn != (void *)0x0)) { - (*g_entitySaveStateExtraDataReleaseFn)(&extraData); - } - } - local_14 = local_14 + 1; - } while (local_14 < GHIDRA_UINT((this->_entityList)._updateEL._size)); - } - } - ExceptionList = prevExceptionList; - return; -} - -// 007eff50 -void Room::RestoreState() -{ - void *pvVar1; - Entity_Pickup *pickup; - int iVar2; - void *owner; - int gridX; - uint32_t uVar3; - uint32_t *saveState; - uint32_t *saveState_00; - int iVar4; - Vector *pickupPos; - int roomDesc; - Vector minecartDir; - Vector minecartPos; - uint32_t *linkedGridEntity; - float minecartAngle; - - g_pickupIgnoreModifiers = g_pickupIgnoreModifiers + 1; - roomDesc = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - saveState_00 = *GHIDRA_CAST((roomDesc + 0x74)); - if (saveState_00 != *GHIDRA_CAST((roomDesc + 0x78))) { - pickupPos = GHIDRA_CAST((saveState_00 + 10)); - do { - if ((*saveState_00 == 0x3c5) && (saveState_00[1] == 0)) { - pickupPos = pickupPos + 0xf; - saveState = saveState_00 + 0x1e; - pickup = (Entity_Pickup *) - Game::SpawnEx(g_game,*saveState,saveState_00[0x1f],pickupPos,&g_vectorZero, - GHIDRA_CAST(0x0),saveState_00[0x20],saveState_00[0x2b],0); - Entity_Pickup::RestoreState(this,pickup,saveState); - minecartAngle = (float)saveState_00[0x14]; - minecartDir.x = cos(minecartAngle * 0.017453292); - minecartDir.y = sin(minecartAngle * 0.017453292); - minecartPos.x = (float)(GHIDRA_INT((short)saveState_00[8]) % this->_gridWidth) * 40.0 + 40.0; - minecartPos.y = (float)(GHIDRA_INT((short)saveState_00[8]) / this->_gridWidth) * 40.0 + 120.0; - (GHIDRA_CAST((GHIDRA_CAST(pickup))))->Entity::GiveMinecart(&minecartPos,&minecartDir); - saveState_00 = saveState; - } - else { - pickup = (Entity_Pickup *) - Game::SpawnEx(g_game,*saveState_00,saveState_00[1],pickupPos,&g_vectorZero, - GHIDRA_CAST(0x0),saveState_00[2],saveState_00[0xd],0); - Entity_Pickup::RestoreState(this,pickup,saveState_00); - } - roomDesc = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - saveState_00 = saveState_00 + 0x1e; - pickupPos = pickupPos + 0xf; - } while (saveState_00 != *GHIDRA_CAST((roomDesc + 0x78))); - } - pvVar1 = *(void **)(roomDesc + 0x78); - owner = *(void **)(roomDesc + 0x74); - if (owner != pvVar1) { - do { - invoke_pending_callbacks(owner); - owner = (void *)(GHIDRA_INT(owner) + 0x78); - } while (owner != pvVar1); - owner = *(void **)(roomDesc + 0x74); - } - iVar4 = g_pickupIgnoreModifiers; - *(void **)(roomDesc + 0x78) = owner; - if (((**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) != -10) || (g_game->_stage != 8)) || - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x11)) & 1) == 0)) { - g_pickupIgnoreModifiers = iVar4 + -1; - return; - } - iVar4 = 1; - if (1 < this->_gridHeight + -1) { - do { - iVar2 = this->_gridWidth; - gridX = 1; - if (1 < iVar2 + -1) { - do { - if ((((-1 < gridX) && (gridX < iVar2)) && - ((-1 < iVar4 && - ((iVar4 < this->_gridHeight && (iVar2 = iVar2 * iVar4 + gridX, -1 < iVar2)))))) && - ((pvVar1 = this->_gridEntities[iVar2], pvVar1 != (void *)0x0 && - ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)) == 0xf && - (uVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x24)), uVar3 < 0x1c0)) && - (linkedGridEntity = this->_gridEntities[uVar3], - linkedGridEntity != GHIDRA_CAST(0x0))) && (linkedGridEntity[1] != 1)))))) { - this->_gridPaths[uVar3] = 900; - this->_gridEntities[uVar3] = (void *)0x0; - (**(code **)*linkedGridEntity)(1); - } - iVar2 = this->_gridWidth; - gridX = gridX + 1; - } while (gridX < iVar2 + -1); - } - iVar4 = iVar4 + 1; - } while (iVar4 < this->_gridHeight + -1); - } - uVar3 = 0; - do { - RemoveDoor(this,uVar3); - uVar3 = uVar3 + 1; - } while (uVar3 < 8); - g_pickupIgnoreModifiers = g_pickupIgnoreModifiers + -1; - return; -} - -// 007f01c0 -void Room::update_door_transitions() -{ - GridEntity_Door *this_00; - Entity_Player *player; - uint32_t direction; - RoomDescriptor *roomDesc; - uint32_t uVar1; - Game *this_01; - uint32_t uVar2; - bool isDoorPassable; - float velocityY; - float fVar4; - float fVar5; - float fVar6; - int iVar7; - uint32_t playerIndex; - void **doorSlot; - float doorOffsets [8]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - float local_14; - Game *game; - float playerX; - float playerY; - int *roomConfig; - int targetRoomIdx; - int transitionAnim; - float velocityY; - - puStack_20 = GHIDRA_CAST((doorOffsets + 0x10)); - local_14 = -NAN; - puStack_18 = &LAB_00b00ff1; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((doorOffsets + 0xd)); - ExceptionList = &local_1c; - if (((*GHIDRA_CAST(&g_game->_roomTransition) == 0) && - (((roomConfig = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)), roomConfig == GHIDRA_CAST(0x0) || - (roomConfig[2] != 0x10)) || (*roomConfig != 0x23)))) && - (playerIndex = 0, - GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0)) { - do { - player = Game::GetPlayer(g_game,playerIndex); - if (player->_variant == 0) { - playerX = (player->_pos).x; - uVar2 = 0; - playerY = (player->_pos).y; - doorSlot = this->_doors; - do { - this_00 = *doorSlot; - direction = uVar2 & 3; - doorOffsets[0] = -18.0; - doorOffsets[1] = 0.0; - doorOffsets[2] = 0.0; - doorOffsets[3] = -18.0; - doorOffsets[4] = 18.0; - doorOffsets[5] = 0.0; - doorOffsets[6] = 0.0; - doorOffsets[7] = 18.0; - if (this_00 != GHIDRA_CAST(0x0)) { - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - velocityY = (float)(this_00->_gridIndex / iVar7) * 40.0 + 120.0 + - doorOffsets[direction * 2 + 1]; - fVar5 = (float)(this_00->_gridIndex % iVar7) * 40.0 + 40.0 + doorOffsets[direction * 2]; - fVar4 = velocityY - playerY; - fVar6 = fVar5 - playerX; - fVar4 = sqrtf(fVar4 * fVar4 + fVar6 * fVar6); - uVar1 = player->_moveDirection; - if (player->_playerType == 0x23) { - fVar6 = (player->_velocity).x; - velocityY = (player->_velocity).y; - if (4.0 < fVar6 * fVar6 + velocityY * velocityY) { - if (ABS(fVar6) <= ABS(velocityY)) { - uVar1 = GHIDRA_UINT((0.0 <= velocityY)) * 2 + 1; - } - else { - uVar1 = 2; - if (fVar6 < 0.0) { - uVar1 = 0; - } - } - iVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))); - if (((iVar7 == 1) || (iVar7 == 4)) || - ((iVar7 == 3 || ((iVar7 == 2 || (iVar7 == 5)))))) { - fVar5 = fVar5 - (playerX + fVar6 + fVar6); - velocityY = velocityY - (playerY + velocityY + velocityY); - fVar4 = sqrtf(velocityY * velocityY + fVar5 * fVar5); - } - } - } - if ((this_00->_doorFlags & 0x10) == 0) { - isDoorPassable = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0xc)))) == 2; - } - else { - isDoorPassable = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0xc)))) != 2; - } - if ((isDoorPassable) && (fVar4 < 25.0)) { - Game::save_rewind_state(uVar2); - game = g_game; - if (GHIDRA_INT(uVar2) < 0) { - uVar1 = 0xffffffff; - } - else { - uVar1 = uVar2; - if (6 < GHIDRA_INT(uVar2)) { - uVar1 = 7; - } - } - g_game->_leaveDoor = uVar1; - this_01 = game; - if (*GHIDRA_CAST((GHIDRA_INT(this->_doors[uVar2]) + 0x394)) == -1) { - if (*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard - ) { - _Init_thread_header(&g_invalidRoomDescriptorGuard); - if (g_invalidRoomDescriptorGuard == -1) { - local_14 = 0.0; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); - _atexit(FUN_00b15b30); - local_14 = -NAN; - _Init_thread_footer(&g_invalidRoomDescriptorGuard); - } - this_01 = g_game; - } - roomDesc = &g_roomDescriptorDummy; - if (GHIDRA_UINT(game->_currentDimensionIdx) < 3) { - roomDesc = game->_roomList + 0x1fb; - } - if (roomDesc->Data == (void *)0x0) { - iVar7 = *GHIDRA_CAST((GHIDRA_INT(this->_doors[uVar2]) + 0x160)); - Level::InitializeDevilAngelRoom(GHIDRA_CAST(this_01),iVar7 == 0xf,iVar7 != 0xf); - this_01 = g_game; - *GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)) = - *GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)); - if (iVar7 == 0xf) { - *GHIDRA_CAST(&this_01->_gameStateFlags) = GHIDRA_UINT(this_01->_gameStateFlags) | 1; - } - else { - *GHIDRA_CAST(&this_01->_gameStateFlags) = GHIDRA_UINT(this_01->_gameStateFlags) | 0x20; - } - } - } - iVar7 = -1; - targetRoomIdx = *GHIDRA_CAST((GHIDRA_INT(this->_doors[uVar2]) + 0x394)); - if (targetRoomIdx < -99) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(this_01),targetRoomIdx,-1); - transitionAnim = 0x12; - iVar7 = roomDesc->Dimension; - if (*GHIDRA_CAST((GHIDRA_INT(this->_doors[uVar2]) + 0x394)) != -100) { - transitionAnim = 0; - } - targetRoomIdx = roomDesc->GridIndex; - this_01 = g_game; - } - else { - transitionAnim = 0; - } - Game::StartRoomTransition(this_01,targetRoomIdx,direction,transitionAnim,player,iVar7) - ; - g_game->_isPocketItemRewindSaved = 0; - ExceptionList = local_1c; - return; - } - iVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))); - if (((((iVar7 == 1) || (iVar7 == 4)) || (iVar7 == 3)) || ((iVar7 == 2 || (iVar7 == 5)))) - && (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) & 1) != 0 && - ((fVar4 < 60.0 && (uVar1 == direction)))))) { - (GHIDRA_CAST((this_00)))->GridEntity_Door::TryUnlock(player,0); - } - } - game = g_game; - uVar2 = uVar2 + 1; - doorSlot = doorSlot + 1; - } while (uVar2 < 8); - if (this->_roomType == 0x10) { - if ((playerY < 120.0) || (((playerY < 110.0 && (100.0 < playerX)) && (playerX < 140.0)))) - { - transitionAnim = 2; - iVar7 = g_game->_enterDoor; - targetRoomIdx = g_game->_dungeonReturnRoomIndex; -LAB_007f070c: - Game::StartRoomTransition(game,targetRoomIdx,iVar7,transitionAnim,player,-1); - ExceptionList = local_1c; - return; - } - if ((this->_bottomRightPos).x + 20.0 < playerX) { - transitionAnim = 0; - iVar7 = 2; - if (**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == -0xe) { - targetRoomIdx = -0xf; - g_game->_leaveDoor = 2; - } - else { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))))[4] + 0x38)); - g_game->_leaveDoor = 2; - if ((uVar2 >> 2 & 1) == 0) { - targetRoomIdx = -2; - } - else { - targetRoomIdx = -6; - } - } - goto LAB_007f070c; - } - if (playerX < 0.0) { - transitionAnim = 0; - iVar7 = 0; - g_game->_leaveDoor = 0; - targetRoomIdx = -2; - goto LAB_007f070c; - } - if ((this->_bottomRightPos).y + 20.0 < playerY) { - transitionAnim = 0; - iVar7 = 3; - g_game->_leaveDoor = 3; - targetRoomIdx = -2; - goto LAB_007f070c; - } - } - } - playerIndex = playerIndex + 1; - } while (playerIndex < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - ExceptionList = local_1c; - return; -} - -// 007f0780 -int Room::GetGridCollisionAtPos(Vector pos) -{ - uint32_t collision; - int gridY; - int gridX; - - gridX = GHIDRA_INT(((pos.x - 40.0) / 40.0 + 0.5)); - gridY = GHIDRA_INT(((pos.y - 120.0) / 40.0 + 0.5)); - if ((((gridX < 0) || (this->_gridWidth <= gridX)) || (gridY < 0)) || (this->_gridHeight <= gridY)) - { - collision = GetGridCollision(this,-1); - return collision; - } - collision = GetGridCollision(this,this->_gridWidth * gridY + gridX); - return collision; -} - -// 007f0800 -uint32_t Room::GetGridCollision(int index) -{ - int gridPath; - int *roomData; - - roomData = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if (((roomData != GHIDRA_CAST(0x0)) && (roomData[2] == 0x10)) && (*roomData == 0x23)) { - return 0; - } - if (index < 0) { - return 4; - } - if (this->_gridEntities[index] != (void *)0x0) { - return *GHIDRA_CAST((GHIDRA_INT(this->_gridEntities[index]) + 0x3c)); - } - gridPath = this->_gridPaths[index]; - if (gridPath < 3000) { - if (gridPath < 1000) { - return 0; - } - } - else if (gridPath < 4000) { - return 1; - } - return 3; -} - -// 007f0b40 -Vector * Room::GetLaserTarget(Vector *outTarget, Vector *position, Vector *direction) -{ - int index; - uint32_t gridCollision; - Vector *result; - int gridX; - int gridY; - float tStep; - float fVar1; - float deltaY; - float deltaX; - float traveled; - int cellX; - int cellY; - float currentX; - float currentY; - Vector hitPos; - Vector endPos; - int stepX; - int stepY; - int xBoundarySide; - int yBoundarySide; - - outTarget->y = 0.0; - currentX = position->x; - hitPos.x = currentX; - currentY = position->y; - outTarget->x = 0.0; - endPos.x = direction->x * 10000.0 + position->x; - gridX = GHIDRA_INT(((currentX - 40.0) / 40.0 + 0.5)); - hitPos.y = currentY; - endPos.y = direction->y * 10000.0 + currentY; - deltaX = endPos.x - position->x; - deltaY = endPos.y - currentY; - xBoundarySide = GHIDRA_UINT((0.0 < deltaX)) * 2; - stepX = xBoundarySide + -1; - gridY = GHIDRA_INT(((currentY - 120.0) / 40.0 + 0.5)); - yBoundarySide = GHIDRA_UINT((0.0 < deltaY)) * 2; - stepY = yBoundarySide + -1; - traveled = 0.0; - if ((deltaX != g_vectorZero.x) || (fVar1 = 0.0, deltaY != g_vectorZero.y)) { - cellY = gridY * 0x28; - cellX = gridX * 0x28; - do { - if ((((gridX < 0) || (this->_gridWidth <= gridX)) || (gridY < 0)) || - (this->_gridHeight <= gridY)) { - index = -1; - } - else { - index = this->_gridWidth * gridY + gridX; - } - hitPos.x = currentX; - hitPos.y = currentY; - gridCollision = GetGridCollision(this,index); - if (((gridCollision == 2) || (gridCollision == 3)) || - ((gridCollision == 4 || (gridCollision == 5)))) { - fVar1 = traveled; - break; - } - if (deltaX == 0.0) { - fVar1 = INFINITY; - } - else { - fVar1 = ((float)(cellX + (xBoundarySide + 1) * 0x14) - currentX) / deltaX; - } - if (deltaY == 0.0) { - tStep = INFINITY; - } - else { - tStep = ((float)(cellY + (yBoundarySide + 5) * 0x14) - currentY) / deltaY; - } - if (tStep <= fVar1) { - gridY = gridY + stepY; - cellY = cellY + stepY * 0x28; - } - else { - gridX = gridX + stepX; - cellX = cellX + stepX * 0x28; - tStep = fVar1; - } - traveled = tStep + traveled; - currentY = deltaY * traveled + position->y; - currentX = deltaX * traveled + position->x; - hitPos.y = currentY; - hitPos.x = currentX; - fVar1 = traveled; - } while (traveled < 1.0); - } - result = &endPos; - if (fVar1 < 1.0) { - result = &hitPos; - } - outTarget->x = result->x; - outTarget->y = result->y; - return outTarget; -} - -// 007f0df0 -uint8_t Room::CheckLine(Vector *pos1, Vector *pos2, int mode, int gridPathThreshold, uint8_t isIgnoreWalls, uint8_t isIgnoreCrushable, Vector *outPos) -{ - uint8_t isCrushable; - int iVar1; - int gridIndex; - uint32_t uVar2; - int collisionClass; - int gridIndex; - GridEntity *this_00; - uint32_t cornerGridIndex; - GridEntity *this_01; - GridEntity *gridEntity; - float curY; - float curX; - float cellSize; - float curStepX; - float curStepY; - float roundBias; - int blockedPathCount; - float posY; - float posX; - float stepX; - float stepY; - Vector *savedOutPos; - uint32_t startGridIndex; - int *local_38; - float traveled; - float lineLength; - float cornerOffsets [8]; - uint32_t local_c; - - local_c = __security_cookie ^ GHIDRA_UINT(&blockedPathCount); - posX = pos1->x; - posY = pos1->y; - stepX = posX - pos2->x; - stepY = posY - pos2->y; - savedOutPos = outPos; - lineLength = sqrtf(stepY * stepY + stepX * stepX); - traveled = 0.0; - if (0.0 < lineLength) { - cellSize = 40.0; - roundBias = 0.5; - curStepX = (stepX / lineLength) * 10.0; - curStepY = (stepY / lineLength) * 10.0; - gridIndex = GHIDRA_INT(((posX - 40.0) / 40.0 + 0.5)); - if ((((gridIndex < 0) || (this->_gridWidth <= gridIndex)) || - (iVar1 = GHIDRA_INT(((posY - 120.0) / 40.0 + 0.5)), iVar1 < 0)) || (this->_gridHeight <= iVar1)) { - startGridIndex = 0xffffffff; - } - else { - startGridIndex = this->_gridWidth * iVar1 + gridIndex; - } - blockedPathCount = 0; - curY = posY; - curX = posX; - stepX = curStepX; - stepY = curStepY; - if (0.0 < lineLength) { - do { - curX = curX - curStepX; - curY = curY - curStepY; - posY = curY; - posX = curX; - if ((mode == 0) || (mode == 3)) { - uVar2 = 0; - cornerOffsets[0] = -5.0; - cornerOffsets[1] = -5.0; - cornerOffsets[2] = -5.0; - cornerOffsets[3] = 5.0; - local_38 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - cornerOffsets[4] = 5.0; - cornerOffsets[5] = 5.0; - cornerOffsets[6] = 5.0; - cornerOffsets[7] = -5.0; - do { - iVar1 = GHIDRA_INT((((curX + cornerOffsets[uVar2 * 2]) - cellSize) / cellSize + roundBias)); - gridIndex = GHIDRA_INT((((curY + cornerOffsets[uVar2 * 2 + 1]) - 120.0) / cellSize + roundBias)); - if (((iVar1 < 0) || (this->_gridWidth <= iVar1)) || - ((gridIndex < 0 || (this->_gridHeight <= gridIndex)))) { - gridIndex = -1; - } - else { - gridIndex = gridIndex * this->_gridWidth + iVar1; - } - if (((local_38 == GHIDRA_CAST(0x0)) || (local_38[2] != 0x10)) || (*local_38 != 0x23)) { - if (gridIndex < 0) { - collisionClass = 4; - } - else if (this->_gridEntities[gridIndex] == (void *)0x0) { - if (this->_gridPaths[gridIndex] - 3000U < 1000) { - collisionClass = 1; - } - else { - collisionClass = 0; - if (999 < this->_gridPaths[gridIndex]) { - collisionClass = 3; - } - } - } - else { - collisionClass = *GHIDRA_CAST((GHIDRA_INT(this->_gridEntities[gridIndex]) + 0x3c)); - } - } - else { - collisionClass = 0; - } - if ((mode != 3) || (collisionClass != 1)) { - if (collisionClass == 0) { - if (((iVar1 < 0) || ((this->_gridWidth <= iVar1 || (gridIndex < 0)))) || - (this->_gridHeight <= gridIndex)) { - cornerGridIndex = 0xffffffff; - } - else { - cornerGridIndex = gridIndex * this->_gridWidth + iVar1; - } - if (cornerGridIndex != startGridIndex) { - if (cornerGridIndex < 0x1c0) { - gridIndex = this->_gridPaths[cornerGridIndex]; - } - else { - gridIndex = 0; - } - if ((mode == 0) && (gridPathThreshold < gridIndex)) { - blockedPathCount = blockedPathCount + 1; - } - } - } - else if (((isIgnoreCrushable == 0) || (iVar1 < 0)) || - ((this->_gridWidth <= iVar1 || - (((((gridIndex < 0 || (this->_gridHeight <= gridIndex)) || - (cornerGridIndex = gridIndex * this->_gridWidth + iVar1, - 0x1bf < cornerGridIndex)) || - (this->_gridEntities[cornerGridIndex] == GHIDRA_CAST(0x0))) || - ((isCrushable = GridEntity::IsEasyCrushableOrWalkable - (this->_gridEntities[cornerGridIndex]), - isCrushable == 0 && - (isCrushable = (GHIDRA_CAST((this_01)))->GridEntity::IsDangerousCrushableOrWalkable(), - isCrushable == 0)))))))) goto LAB_007f114d; - } - uVar2 = uVar2 + 1; - } while (uVar2 < 4); - } - else { - gridIndex = GHIDRA_INT(((curX - cellSize) / cellSize + roundBias)); - iVar1 = GHIDRA_INT(((curY - 120.0) / cellSize + roundBias)); - if ((((gridIndex < 0) || (this->_gridWidth <= gridIndex)) || (iVar1 < 0)) || - (this->_gridHeight <= iVar1)) { - gridIndex = -1; - } - else { - gridIndex = this->_gridWidth * iVar1 + gridIndex; - } - local_38 = GHIDRA_CAST(GetGridCollision(this,gridIndex)); - if (mode == 1) { - if (local_38 != GHIDRA_CAST(0x0)) { - if (savedOutPos == GHIDRA_CAST(0x0)) { - return 0; - } - savedOutPos->x = stepX + posX; - savedOutPos->y = posY + stepY; - return 0; - } - if (((gridIndex < 0) || (this->_gridWidth <= gridIndex)) || - ((iVar1 < 0 || (this->_gridHeight <= iVar1)))) { - uVar2 = 0xffffffff; - } - else { - uVar2 = this->_gridWidth * iVar1 + gridIndex; - } - if (uVar2 != startGridIndex) { - if (uVar2 < 0x1c0) { - gridIndex = this->_gridPaths[uVar2]; - } - else { - gridIndex = 0; - } - iVar1 = blockedPathCount + 1; - if (gridIndex <= gridPathThreshold) { - iVar1 = blockedPathCount; - } - blockedPathCount = iVar1; - } - } - else if (mode == 2) { - if (((gridIndex < 0) || (this->_gridWidth <= gridIndex)) || - ((iVar1 < 0 || - ((this->_gridHeight <= iVar1 || - (uVar2 = this->_gridWidth * iVar1 + gridIndex, 0x1bf < uVar2)))))) { - gridEntity = GHIDRA_CAST(0x0); - } - else { - gridEntity = this->_gridEntities[uVar2]; - } - if (local_38 == GHIDRA_CAST(0x0)) { - if (gridEntity != GHIDRA_CAST(0x0)) goto LAB_007f1093; - } - else if (gridEntity == GHIDRA_CAST(0x0)) { -LAB_007f10ca: - if (local_38 == GHIDRA_CAST(&DAT_00000004)) goto LAB_007f104c; - if (gridEntity != GHIDRA_CAST(0x0)) goto LAB_007f10d7; - } - else { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) == 3) goto LAB_007f104c; -LAB_007f1093: - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) != 0xb) || - (isCrushable = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x88), - isCrushable == 0)) { - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) != 0x10) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) != 0xf || (isIgnoreWalls == 0)))) - goto LAB_007f10ca; -LAB_007f10d7: - isCrushable = (GHIDRA_CAST((gridEntity)))->GridEntity::IsEasyCrushableOrWalkable(); - if (((isCrushable != 0) || - (isCrushable = (GHIDRA_CAST((this_00)))->GridEntity::IsDangerousCrushableOrWalkable(), - isCrushable != 0)) && (isIgnoreCrushable != 0)) { -LAB_007f104c: - if (savedOutPos == GHIDRA_CAST(0x0)) { - return 0; - } - savedOutPos->x = posX + stepX; - savedOutPos->y = posY + stepY; - return 0; - } - } - } - } - cellSize = 40.0; - roundBias = 0.5; - curY = posY; - curX = posX; - curStepX = stepX; - curStepY = stepY; - } - traveled = traveled + 10.0; - } while (traveled < lineLength); - if (8 < blockedPathCount) { -LAB_007f114d: - if (savedOutPos != GHIDRA_CAST(0x0)) { - savedOutPos->y = curY + curStepY; - savedOutPos->x = curX + curStepX; - } - return 0; - } - outPos = savedOutPos; - } - } - if (outPos != GHIDRA_CAST(0x0)) { - outPos->x = pos2->x; - outPos->y = pos2->y; - } - return 1; -} - -// 007f1380 -void Room::LoadBackdropGraphics() -{ - uint8_t *puVar1; - uint8_t bVar2; - char cVar3; - uint32_t uVar4; - uint32_t voidRoomStage; - uint8_t *extraout_EAX; - uint8_t *path; - char *pcVar5; - void *pvVar6; - uint32_t *puVar7; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint8_t extraout_CL_01; - uint8_t extraout_CL_02; - int iVar8; - uint32_t voidRoomStageType; - uint32_t extraout_ECX; - uint32_t extraout_ECX_00; - uint32_t extraout_ECX_01; - uint32_t extraout_ECX_02; - uint32_t uVar9; - uint32_t extraout_ECX_03; - uint32_t extraout_ECX_04; - Game *extraout_EDX; - Game *game; - uint32_t uVar10; - uint32_t local_74 [4]; - uint32_t stageType; - uint64_t local_60; - uint8_t local_58 [8]; - char local_50 [8]; - uint32_t pathSize; - uint32_t pathCapacity; - std_string local_40; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - code *clearFn; - int *descriptor; - - puStack_20 = local_58 + 0x54; - local_14 = -1; - puStack_18 = &LAB_00b010d5; - local_1c = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((local_58 + 0x48)); - ExceptionList = &local_1c; - uVar10 = g_game->_stage; - local_74[0] = g_game->_stageType; - local_74[2] = uVar10; - local_74[3] = uVar10; - stageType = local_74[0]; - local_24 = uVar4; - puVar1 = local_58 + 0x54; - if (g_game->_challenge == 0x2c) { - stageType = Level::GetRoomStageType(GHIDRA_CAST(g_game),g_game->_currentRoomIdx); - puVar1 = puStack_20; - } - puStack_20 = puVar1; - local_60 = CONCAT44(this->_roomType,(uint32_t)local_60); - local_74[0] = stageType; - if (this->_bossId == 0x37) { - uVar10 = 0x12; - goto LAB_007f17bc; - } - iVar8 = g_game->_currentRoomIdx; - if (iVar8 == -8) { - uVar10 = 0x1b; - goto LAB_007f17bc; - } - if (iVar8 == -0x10) { - uVar10 = 0xd; - goto LAB_007f17bc; - } - if (iVar8 == -0x13) { - uVar10 = 0x3d; - goto LAB_007f17bc; - } - if (iVar8 == -0x14) { - uVar10 = 0x3e; - goto LAB_007f17bc; - } - switch(this->_roomType) { - case 2: - uVar10 = 0x14; - if (iVar8 == -0xd) { - uVar10 = 0x17; - } - goto LAB_007f1670; - case 3: - uVar10 = 0x1a; - break; - default: - if (iVar8 == -0x11) { - Level::boss_count_adjust(GHIDRA_CAST((local_74 + 2)),GHIDRA_CAST(local_74)); - local_74[3] = local_74[2]; - stageType = local_74[0]; - game = extraout_EDX; - uVar10 = local_74[2]; - } - else { - game = g_game; - } - local_74[0] = stageType; - if (game->_challenge == 0x2d) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x8))) = game->_dungeonPlacementSeed; - local_40._capacity = 7; - local_40._buf[0xc] = '\x02'; - local_40._buf[0xd] = '\0'; - local_40._buf[0xe] = '\0'; - local_40._buf[0xf] = '\0'; - local_40._size = 7; - if (uVar10 - 1 < 0xb) { - uVar10 = (GHIDRA_CAST((GHIDRA_CAST((local_40._buf + 8)))))->RNG::RandomInt(0xb); - uVar10 = uVar10 + 1; - local_74[3] = uVar10; - } - stageType = (GHIDRA_CAST((GHIDRA_CAST((local_40._buf + 8)))))->RNG::RandomInt(5); - if (stageType == 3) { - stageType = 4; - } - } - local_74[2] = RoomConfig::GetStageID(uVar10,stageType,-1); - if (uVar10 == 0xc) { - uVar10 = **GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if (uVar10 != 0) { - local_74[2] = uVar10; - } - } - if (local_74[2] == 0x1a) { - local_40._buf[0xc] = '\x01'; - local_40._buf[0xd] = '\0'; - local_40._buf[0xe] = '\0'; - local_40._buf[0xf] = '\0'; - local_40._size = 0x15; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x8))) = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); - local_40._capacity = 0x14; - uVar10 = (GHIDRA_CAST((GHIDRA_CAST((local_40._buf + 8)))))->RNG::RandomInt(0x11); - uVar10 = uVar10 + 1; - goto LAB_007f1670; - } - if (local_74[2] == 0x23) { - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - uVar10 = *GHIDRA_CAST((*GHIDRA_CAST((iVar8 + 0x10)) + 0x10)); - if (uVar10 == 0) { - uVar10 = 0x31; - } - else if (uVar10 == 2) { - uVar10 = 0x33; - } - else { - if (9 < uVar10) { - uVar10 = *GHIDRA_CAST((iVar8 + 0x44)) >> 10 & 1 | 0x34; - goto LAB_007f1670; - } - if (uVar10 == 3) { - if ((*GHIDRA_CAST((iVar8 + 0x44)) >> 2 & 1) != 0) goto LAB_007f16cb; - } - else if (uVar10 == 9) { -LAB_007f16cb: - uVar10 = 0x36; - break; - } -switchD_007f145f_caseD_1d: - uVar10 = 0x32; - } - break; - } - uVar10 = *GHIDRA_CAST((g_game->_ventricleRazorPortals + local_74[2] * 0xc4 + 0x658)); - if ((((local_74[2] == 0x18) || (local_74[2] == 0x19)) && - (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 8)) == 5)) && - (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 8)) == g_game->_lastBossRoomListIdx)) { - uVar10 = 0x1c; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) == GHIDRA_CAST(0x4)) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 0xb & 1) != 0) - goto switchD_007f145f_caseD_a; - } - else if (((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) == GHIDRA_CAST(0x5)) && - (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10)) == 0x5a)) { - uVar10 = 10; - break; - } - if (uVar10 == 0x21) { - bVar2 = Level::IsMausoleumHeartStage(GHIDRA_CAST(g_game)); - if (bVar2 != 0) { - uVar10 = 0x27; - break; - } - goto LAB_007f1679; - } - goto LAB_007f1778; - case 7: -switchD_007f145f_caseD_7: - uVar10 = 0x17; - break; - case 8: - uVar10 = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10)); -LAB_007f1670: - if (uVar10 == 0x21) { -LAB_007f1679: - if ((this->_bossId == 0x4e) || (this->_secondBossID == 0x4e)) { - uVar10 = 0x2a; - } - else if (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xb4)) < 1) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)) & 1) == 0) { - uVar10 = 0x28; - } - } - else { - uVar10 = 0x29; - } - } - else { -LAB_007f1778: - if (uVar10 == 0x22) { - descriptor = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - if (*GHIDRA_CAST((descriptor[4] + 8)) == 5) { - if (*GHIDRA_CAST((descriptor[4] + 0x10)) == 0x57) { - uVar10 = 0x2b; - } - } - else if ((descriptor[0x11] & 0x1000U) == 0) { - if (((*GHIDRA_CAST((descriptor + 0x16)) & 1) == 0) && (*descriptor != g_game->_startingRoomIdx) - ) { - uVar10 = 0x2b; - } - } - else { - uVar10 = 0x2c; - } - } - } - break; - case 9: - uVar10 = 0x19; - break; - case 10: - case 0xb: - case 0xe: - case 0x11: - case 0x16: -switchD_007f145f_caseD_a: - uVar10 = 0xe; - break; - case 0xc: - uVar10 = 0x13; - break; - case 0xd: - uVar10 = 0x1e; - break; - case 0xf: - uVar10 = 0xf; - break; - case 0x10: - switch(*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10))) { - case 1: - uVar10 = 0x37; - break; - case 2: - case 3: - uVar10 = 0x38; - break; - case 4: - uVar10 = 0x39; - break; - default: - uVar10 = 0x1d; - } - break; - case 0x12: - uVar10 = 0x15; - break; - case 0x13: - uVar10 = 0x16; - break; - case 0x14: - uVar10 = 0x11; - break; - case 0x15: - uVar10 = 0x18; - break; - case 0x18: - uVar10 = 0x23; - break; - case 0x1b: - iVar8 = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10)); - if (iVar8 == 1) { - uVar10 = 0x24; - } - else { - if (iVar8 != 3) goto switchD_007f145f_caseD_7; - uVar10 = 0x26; - } - break; - case 0x1d: - goto switchD_007f145f_caseD_1d; - } -LAB_007f17bc: - bVar2 = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)); - if ((bVar2 == 0) || (g_game->_currentDimensionIdx != 1)) { -LAB_007f187c: - if (g_game->_currentDimensionIdx != 2) goto LAB_007f17ef; - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - uVar10 = 0x3c; - if (*GHIDRA_CAST((*GHIDRA_CAST((iVar8 + 0x10)) + 0x10)) == 0x21) { - uVar10 = 0x35; - } - } - else { - if (uVar10 == 0x20) { - uVar10 = 0x3a; - } - else { - if (uVar10 != 0x2e) goto LAB_007f187c; - uVar10 = 0x3b; - } -LAB_007f17ef: - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - } - uVar9 = *GHIDRA_CAST((iVar8 + 0x58)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6b00)))) = uVar9; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6af0)))) = uVar9; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6af4)))) = 0x900000005; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6afc)))) = 7; - Backdrop::Init(GHIDRA_CAST(&this->_backdrop),uVar10,0); - if (local_74[3] == 0xc) { - iVar8 = **GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if ((g_game == GHIDRA_CAST(0x0)) || ((g_game->_difficulty != 2 && (g_game->_difficulty != 3)))) { - if (iVar8 == 0) goto LAB_007f1979; - if (iVar8 == 0x23) { - voidRoomStage = 0xd; - goto LAB_007f1971; - } - if (iVar8 < 0x1b) { - if (0xc < iVar8) { - if (iVar8 == 0xd) { - voidRoomStage = 9; - } - else { - voidRoomStageType = iVar8 - 0xe; - if (voidRoomStageType < 4) { - voidRoomStage = GHIDRA_INT(voidRoomStageType) / 2 + 10; - voidRoomStageType = voidRoomStageType & 0x80000001; - if (GHIDRA_INT(voidRoomStageType) < 0) { - voidRoomStageType = (voidRoomStageType - 1 | 0xfffffffe) + 1; - } - goto LAB_007f1961; - } - if (iVar8 != 0x1a) goto LAB_007f1979; - voidRoomStage = 0xc; - } - goto LAB_007f1971; - } - voidRoomStageType = (iVar8 + -1) % 3; - voidRoomStage = ((iVar8 + -1) / 3) * 2 + 1; - } - else { - voidRoomStage = (GHIDRA_INT((iVar8 - 0x1bU)) / 2) * 2 + 1; - voidRoomStageType = iVar8 - 0x1bU & 0x80000001; - if (GHIDRA_INT(voidRoomStageType) < 0) { - voidRoomStageType = (voidRoomStageType - 1 | 0xfffffffe) + 1; - } - voidRoomStageType = voidRoomStageType + 4; - } -LAB_007f1961: - if (voidRoomStage == 0) goto LAB_007f1979; - } - else { - if (iVar8 == 0x18) { - voidRoomStage = 6; - } - else { - if (iVar8 != 0x19) { - if (iVar8 < 0x1b) { - if (0xc < iVar8) goto LAB_007f1979; - voidRoomStageType = (iVar8 + -1) % 3; - voidRoomStage = (iVar8 + -1) / 3 + 1; - } - else { - voidRoomStage = (iVar8 + -0x1b) / 2 + 1; - voidRoomStageType = (iVar8 + -0x1b) % 2 + 4; - } - goto LAB_007f1961; - } - voidRoomStage = 7; - } -LAB_007f1971: - voidRoomStageType = 0; - } - local_74[3] = voidRoomStage; - stageType = voidRoomStageType; - } -LAB_007f1979: - if ((this->_roomType == 0x10) || (uVar10 == 0x12)) { - FXLayers::clear(uVar4); - uVar9 = extraout_ECX_02; - if (uVar10 != 0x12) goto LAB_007f1a86; - } - else { - pathCapacity = 0xf; - pathSize = 0xc; - local_58[0] = 'f'; - local_58[1] = 'x'; - local_58[2] = 'l'; - local_58[3] = 'a'; - local_58[4] = 'y'; - local_58[5] = 'e'; - local_58[6] = 'r'; - local_58[7] = 's'; - builtin_strncpy(local_50,".xml",5); - local_14 = 0; - ModManager::TryRedirectPath - (GHIDRA_CAST(&g_manager->_modManager),&local_40,GHIDRA_CAST(local_58)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - path = extraout_EAX; - if (0xf < *GHIDRA_CAST((extraout_EAX + 0x14))) { - path = *GHIDRA_CAST(extraout_EAX); - } - FXLayers::LoadConfig(&this->_fxLayers,path,local_74[3],stageType); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - uVar9 = extraout_ECX; - if (0xf < local_40._capacity) { - uVar4 = local_40._capacity + 1; - pcVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_40._buf))) + 0x0))); - if (0xfff < uVar4) { - pcVar5 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x0))) + -4)); - uVar4 = local_40._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar5))))) goto LAB_007f1a64; - } - operator_delete(pcVar5,uVar4); - uVar9 = extraout_ECX_00; - } - local_14 = -1; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0xc))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0xc))) & 0xffffffff; - local_40._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x0))) & 0xffffff00; - if (0xf < pathCapacity) { - uVar4 = pathCapacity + 1; - pvVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_58)) + 0x0))); - if (0xfff < uVar4) { - pvVar6 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x0))) + -4); - uVar4 = pathCapacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x0))) + (-4 - GHIDRA_INT(pvVar6))))) { -LAB_007f1a64: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar6,uVar4); - uVar9 = extraout_ECX_01; - } -LAB_007f1a86: - if (uVar10 != 0x1c) goto LAB_007f1c03; - } - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0xc))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0xc))) & 0xffffffff; - local_40._capacity = 0xf; - local_40._buf[0] = '\0'; - local_40._buf[1] = '\0'; - local_40._buf[2] = '\0'; - local_40._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x0))) = msvc::_Allocate(0x20); - local_40._size = 0x1b; - local_40._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_40._buf))) + 0x0))),"gfx/Effect_SatanRadial.anm2",0x1c); - local_14 = 2; - ANM2::Load(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7100)))),&local_40,0); - local_14 = -1; - bVar2 = extraout_CL; - if (0xf < local_40._capacity) { - uVar4 = local_40._capacity + 1; - pcVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_40._buf))) + 0x0))); - if (0xfff < uVar4) { - pcVar5 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x0))) + -4)); - uVar4 = local_40._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar5))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar5,uVar4); - bVar2 = extraout_CL_00; - } - if (uVar10 == 0x1c) { - pcVar5 = msvc::_Allocate(0x20); - pathSize = 0x1f; - pathCapacity = 0x1f; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x0))) = pcVar5; - builtin_strncpy(pcVar5,"gfx/satan_radial_ultragreed.png",0x20); - local_14 = 3; - (GHIDRA_CAST((GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7100)))))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST(local_58)); - local_14 = -1; - bVar2 = extraout_CL_01; - if (0xf < pathCapacity) { - uVar10 = pathCapacity + 1; - pvVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_58)) + 0x0))); - if (0xfff < uVar10) { - pvVar6 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x0))) + -4); - uVar10 = pathCapacity + 0x24; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x0))) + (-4 - GHIDRA_INT(pvVar6))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar6,uVar10); - bVar2 = extraout_CL_02; - } - } - ANM2::LoadGraphics(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7100)))),bVar2); - uVar9 = extraout_ECX_03; -LAB_007f1c03: - KAGE::SmartPointer::reset(uVar9); - if (((char)this->_gridPaths[this->_backdropType * 0x4f + 0x589] == '\0') && - (0 < this->_gridPaths[this->_backdropType * 0x4f + 0x585])) { - iVar8 = this->_backdropType; - if ((iVar8 == 0x34) || (iVar8 == 0x35)) { - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10)) == 10) { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_closet_L.png")); - local_14 = 4; - FUN_008283d0(pvVar6); - local_14 = 5; - } - else { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_closet_R.png")); - local_14 = 6; - FUN_008283d0(pvVar6); - local_14 = 7; - } - if ((((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) != GHIDRA_CAST(0x0)) && - (cVar3 = (**(code **)(*(*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) + 0xc))(), cVar3 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(&local_60); - } - local_14 = -1; - } - else { - switch(*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48))) { - default: - if (iVar8 == 0xb) { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_utero.png")); - local_14 = 8; - } - else { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading.png")); - local_14 = 9; - } - break; - case 2: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_ih.png")); - local_14 = 0x15; - break; - case 3: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_iv.png")); - local_14 = 0x14; - break; - case 4: - if (iVar8 == 0xb) { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_1x2_utero.png")); - local_14 = 0xc; - } - else { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_1x2.png")); - local_14 = 0xd; - } - break; - case 5: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_iiv.png")); - local_14 = 0x16; - break; - case 6: - if (iVar8 == 0xb) { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_2x1_utero.png")); - local_14 = 10; - } - else { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_2x1.png")); - local_14 = 0xb; - } - break; - case 7: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_iih.png")); - local_14 = 0x17; - break; - case 8: - if (iVar8 == 0xb) { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_2x2_utero.png")); - local_14 = 0xe; - } - else { - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_2x2.png")); - local_14 = 0xf; - } - break; - case 9: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_ltl.png")); - local_14 = 0x10; - break; - case 10: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_ltr.png")); - local_14 = 0x11; - break; - case 0xb: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_lbl.png")); - local_14 = 0x12; - break; - case 0xc: - pvVar6 = Manager::LoadImage(&local_60,GHIDRA_CAST("gfx/backdrop/shading_lbr.png")); - local_14 = 0x13; - } - FUN_008283d0(pvVar6); - local_14 = -1; - TexturePtr::release(); - } - } - if (DAT_00c797bc != GHIDRA_CAST(0x0)) { - local_60 = 0; - msvc::vector::resize(&local_60); - puVar7 = msvc::deque::back(); - if (GHIDRA_CAST((puVar7 + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((puVar7 + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *puVar7 = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c797ec,0); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - local_40._buf[8] = (uint8_t)g_graphicsManager_blendMode[0]; - local_40._buf[9] = (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[0])) + 0x1))); - local_40._buf[10] = (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[0])) + 0x2))); - local_40._buf[0xb] = (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[0])) + 0x3))); - local_40._buf[0xc] = (uint8_t)g_graphicsManager_blendMode[1]; - local_40._buf[0xd] = (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[1])) + 0x1))); - local_40._buf[0xe] = (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[1])) + 0x2))); - local_40._buf[0xf] = (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[1])) + 0x3))); - local_40._size = g_graphicsManager_blendMode[2]; - local_40._capacity = g_graphicsManager_blendMode[3]; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) = GHIDRA_CAST(g_graphicsManager_blendMode[4]); - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[2] = 0; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 0; - clearFn = *(code **)(*DAT_00c797bc + 0x20); - (GHIDRA_CAST((GHIDRA_CAST((local_58 + 4)))))->KColor::SetFromARGB(0xffffffff); - local_74[2] = 0; - local_74[1] = 0; - (*clearFn)(local_74 + 1,extraout_ECX_04); - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[0])) + 0x0))) = local_40._buf[8]; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[0])) + 0x1))) = local_40._buf[9]; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[0])) + 0x2))) = local_40._buf[10]; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[0])) + 0x3))) = local_40._buf[0xb]; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[1])) + 0x0))) = local_40._buf[0xc]; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[1])) + 0x1))) = local_40._buf[0xd]; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[1])) + 0x2))) = local_40._buf[0xe]; - (*GHIDRA_CAST((GHIDRA_CAST(&(g_graphicsManager_blendMode[1])) + 0x3))) = local_40._buf[0xf]; - g_graphicsManager_blendMode[2] = local_40._size; - g_graphicsManager_blendMode[3] = local_40._capacity; - g_graphicsManager_blendMode[4] = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_60))) + 0x4))); - _glfw_context_reset(1); - pop_render_target(); - } - ExceptionList = local_1c; - return; -} - -// 007f2070 -void Room::reload_backdrop() -{ - float colorRed; - float colorGreen; - float colorAmount; - float colorBlue; - float colorGreen; - float colorRed; - Game *game; - float targetBrightness; - float targetContrast; - - LoadBackdropGraphics(this); - game = g_game; - colorRed = *GHIDRA_CAST(&(this->_fxLayers)._fxParams); - colorGreen = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers)._fxParams)) + 0x4)))); - colorBlue = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers)._fxParams)) + 0x8)))); - colorAmount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers)._fxParams)) + 0xc)))); - colorRed = (this->_fxLayers)._fxParams.brightness; - colorGreen = (this->_fxLayers)._fxParams.contrast; - targetBrightness = (this->_fxLayers)._fxParams.brightness; - targetContrast = (this->_fxLayers)._fxParams.contrast; - (g_game->_targetColorModifier)._red = colorRed; - (game->_targetColorModifier)._green = colorGreen; - (game->_targetColorModifier)._blue = colorBlue; - (game->_targetColorModifier)._amount = colorAmount; - (game->_currentColorModifier)._red = colorRed; - (game->_currentColorModifier)._green = colorGreen; - (game->_currentColorModifier)._blue = colorBlue; - (game->_currentColorModifier)._amount = colorAmount; - (game->_targetColorModifier)._brightness = targetBrightness; - (game->_targetColorModifier)._contrast = targetContrast; - (game->_currentColorModifier)._brightness = colorRed; - (game->_currentColorModifier)._contrast = colorGreen; - game->_shouldLerpColorModState = 0; - return; -} - -// 007f2390 -void Room::update_bounds(uint8_t isFromGridSize) -{ - int iVar1; - int iVar2; - void *openRows; - int iVar3; - int iVar4; - bool isColumnAllWall; - int iVar5; - int iVar6; - int iVar7; - uint64_t *allocCounter; - float topLeftX; - float topLeftY; - int scanRow; - int lastColumn; - int leftColumn; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - uint32_t allocSize; - uint64_t oldAllocated; - int *roomConfig; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00b01100; - local_10 = ExceptionList; - roomConfig = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if (((roomConfig != GHIDRA_CAST(0x0)) && (roomConfig[2] == 0x10)) && (*roomConfig == 0x23)) { - (this->_topLeftPos).x = -49.230774; - (this->_topLeftPos).y = 72.30768; - (this->_bottomRightPos).x = 689.2308; - (this->_bottomRightPos).y = 487.69232; - return; - } - if (isFromGridSize != 0) { - iVar1 = this->_gridWidth; - if ((iVar1 < 2) || (this->_gridHeight < 2)) { - iVar2 = -1; - } - else { - iVar2 = iVar1 + 1; - } - topLeftX = ((float)(iVar2 % iVar1) * 40.0 + 40.0) - 20.0; - topLeftY = ((float)(iVar2 / iVar1) * 40.0 + 120.0) - 20.0; - (this->_topLeftPos).x = topLeftX; - (this->_topLeftPos).y = topLeftY; - iVar2 = this->_gridHeight; - (this->_bottomRightPos).x = (float)(iVar1 + -2) * 40.0 + topLeftX; - (this->_bottomRightPos).y = (float)(iVar2 + -2) * 40.0 + topLeftY; - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)); - if (((iVar1 != 2) && (iVar1 != 3)) && ((iVar1 != 5 && (iVar1 != 7)))) { - return; - } - iVar1 = iVar1 * 0x20; - iVar5 = *GHIDRA_CAST((&DAT_00c35b80 + iVar1)); - iVar2 = *GHIDRA_CAST((&DAT_00c35b98 + iVar1)); - iVar6 = *GHIDRA_CAST((&DAT_00c35b84 + iVar1)); - iVar1 = *GHIDRA_CAST((&DAT_00c35b9c + iVar1)); - if ((((iVar5 < 0) || (iVar4 = this->_gridWidth, iVar4 <= iVar5)) || (iVar6 < 0)) || - (this->_gridHeight <= iVar6)) { - iVar4 = this->_gridWidth; - iVar5 = -1; - } - else { - iVar5 = iVar6 * iVar4 + iVar5; - } - (this->_topLeftPos).x = ((float)(iVar5 % iVar4) * 40.0 + 40.0) - 20.0; - (this->_topLeftPos).y = ((float)(iVar5 / iVar4) * 40.0 + 120.0) - 20.0; - if (((iVar2 < 0) || (iVar6 = this->_gridWidth, iVar6 <= iVar2)) || - ((iVar1 < 0 || (this->_gridHeight <= iVar1)))) { - iVar6 = this->_gridWidth; - iVar2 = -1; - } - else { - iVar2 = iVar6 * iVar1 + iVar2; - } - iVar5 = iVar2 / iVar6; - iVar2 = iVar2 % iVar6; - goto LAB_007f27c1; - } - ExceptionList = &local_10; - openRows = tracked_alloc(0,(void *)0x0,(uint64_t)GHIDRA_UINT(this->_gridHeight)); - iVar1 = this->_gridHeight; - iVar2 = 0; - if (0 < iVar1) { - do { - *GHIDRA_CAST((iVar2 + GHIDRA_INT(openRows))) = 1; - iVar2 = iVar2 + 1; - iVar1 = this->_gridHeight; - } while (iVar2 < iVar1); - } - iVar2 = this->_gridWidth + -2; - leftColumn = 1; - iVar1 = iVar1 + -2; - scanRow = 1; - iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)); - if (((iVar5 == 2) || (iVar5 == 3)) || (iVar5 == 5)) { -LAB_007f25e2: - iVar5 = iVar5 * 0x20; - iVar6 = *GHIDRA_CAST((&DAT_00c35b80 + iVar5)); - scanRow = *GHIDRA_CAST((&DAT_00c35b84 + iVar5)); - iVar2 = *GHIDRA_CAST((&DAT_00c35b98 + iVar5)); - iVar1 = *GHIDRA_CAST((&DAT_00c35b9c + iVar5)); - iVar4 = iVar6; - lastColumn = iVar2; - } - else { - iVar6 = leftColumn; - iVar4 = leftColumn; - lastColumn = iVar2; - if (iVar5 == 7) goto LAB_007f25e2; - } - while( true ) { - iVar5 = scanRow; - iVar7 = iVar1; - if (lastColumn < iVar6) break; - isColumnAllWall = true; - if (iVar1 < scanRow) { -LAB_007f2673: - leftColumn = iVar4 + 1; - if (iVar6 != iVar4) { - leftColumn = iVar4; - } - iVar5 = iVar6 + -1; - if (iVar2 != lastColumn) { - iVar5 = iVar2; - } - } - else { - do { - if (((iVar6 < 0) || (this->_gridWidth <= iVar6)) || - ((iVar5 < 0 || - ((((this->_gridHeight <= iVar5 || (iVar7 = this->_gridWidth * iVar5 + iVar6, iVar7 < 0)) - || (this->_gridEntities[iVar7] == (void *)0x0)) || - ((iVar7 = *GHIDRA_CAST((GHIDRA_INT(this->_gridEntities[iVar7]) + 4)), iVar7 != 0xf && - (iVar7 != 0x10)))))))) { - isColumnAllWall = false; - *GHIDRA_CAST((iVar5 + GHIDRA_INT(openRows))) = 0; - } - iVar5 = iVar5 + 1; - } while (iVar5 <= iVar1); - if (isColumnAllWall) goto LAB_007f2673; - iVar5 = lastColumn; - leftColumn = iVar4; - } - iVar2 = iVar5; - iVar6 = iVar6 + 1; - iVar4 = leftColumn; - } - for (; scanRow <= iVar1; scanRow = scanRow + 1) { - if (*GHIDRA_CAST((scanRow + GHIDRA_INT(openRows))) == '\0') { - iVar6 = iVar1; - } - else { - iVar3 = iVar5 + 1; - if (scanRow != iVar5) { - iVar3 = iVar5; - } - iVar6 = scanRow + -1; - if (iVar7 != iVar1) { - iVar6 = iVar7; - } - iVar5 = iVar3; - } - iVar7 = iVar6; - } - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (openRows != (void *)0x0) { - allocSize = *GHIDRA_CAST((GHIDRA_CAST(openRows) + -4)); - oldAllocated = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - allocSize; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < allocSize)); - free(GHIDRA_CAST((GHIDRA_INT(openRows) + -4))); - } - if (((iVar4 < 0) || (this->_gridWidth <= iVar4)) || ((iVar5 < 0 || (this->_gridHeight <= iVar5)))) - { - iVar4 = -1; - } - else { - iVar4 = this->_gridWidth * iVar5 + iVar4; - } - iVar1 = this->_gridWidth; - (this->_topLeftPos).x = ((float)(iVar4 % iVar1) * 40.0 + 40.0) - 20.0; - (this->_topLeftPos).y = ((float)(iVar4 / iVar1) * 40.0 + 120.0) - 20.0; - if ((((iVar2 < 0) || (iVar1 = this->_gridWidth, iVar1 <= iVar2)) || (iVar7 < 0)) || - (this->_gridHeight <= iVar7)) { - iVar1 = this->_gridWidth; - iVar2 = -1; - } - else { - iVar2 = iVar1 * iVar7 + iVar2; - } - iVar5 = iVar2 / iVar1; - iVar2 = iVar2 % iVar1; -LAB_007f27c1: - (this->_bottomRightPos).y = (float)iVar5 * 40.0 + 120.0 + 20.0; - (this->_bottomRightPos).x = (float)iVar2 * 40.0 + 40.0 + 20.0; - ExceptionList = local_10; - return; -} - -// 007f2800 -void Room::Init(RoomConfig_Room *config, RoomDescriptor *descriptor) -{ - ANM2 *pickup; - uint32_t *puVar1; - code *pcVar2; - uint16_t uVar3; - RoomConfig_Room *pRVar4; - uint8_t bVar5; - char cVar6; - uint32_t uVar7; - LayerState *layer; - int iVar8; - float fVar9; - EntityConfig_Entity *entityConfigEntry; - uint32_t *puVar10; - GridEntity *gridEntity; - Entity_Player *player; - EntityList_EL *queryResult; - uint32_t uVar11; - Entity *spawned; - RoomDescriptor *roomDesc; - uint8_t *puVar12; - float *extraout_EAX; - Vector *spawnPos; - uint32_t uVar13; - uint32_t preventedCurses; - Game *pGVar14; - uint32_t separatorSegment; - uint32_t nameSegment; - wchar_t *******title; - ColorMod *other; - void *extraout_EAX_00; - uint8_t bVar15; - char *pcVar16; - int iVar17; - int extraout_ECX; - uint32_t extraout_ECX_00; - Entity_Player *firstPlayer; - int *piVar18; - std_string *playerName; - void *textData; - uint32_t extraout_ECX_01; - PlayerManager *playerManager; - uint32_t uVar19; - short *spawnEntry; - std_string *nameCursor; - uint8_t *charCursor; - Game *pGVar20; - Game *pGVar21; - void **ppvVar22; - uint32_t *puVar23; - uint8_t *pbVar24; - Room *currentRoom; - bool isLess; - float fVar25; - Vector diceFloorCenter; - Vector carpetCenter; - Vector seedItemCenter; - Vector startRoomCenter; - Vector lunaCenter; - Vector isaacsTombCenter; - Vector randomPos; - Vector enterPos; - ColorMod ascentWallColor; - ColorMod seedWallColor; - ColorMod seedFloorColor; - ColorMod ascentFloorColor; - uint8_t findResult [8]; - int foundNode; - uint8_t collectibleList [20]; - uint64_t lunaRngShifts; - uint64_t diceFloorRngShifts; - uint64_t isaacsTombRngShifts; - uint32_t *roomTypeBits [5]; - uint64_t greedRngShifts; - RNG placementRng; - uint64_t firstVisitRngShifts; - Vector tinyFlyPos; - Vector effect33Pos; - Vector effect63Pos; - Vector effect63PosB; - Vector effect64Pos; - Vector centerSpawnPos; - Vector effect87Pos; - char *rayTexturePaths [2]; - uint8_t rayImage [4]; - int *rayImageRefCount; - Vector oldChestPos; - Vector freePickupPos; - Vector effect82Pos; - Vector effect65PosB; - Vector firstPortalPos; - Vector secondPortalPosAlt; - Vector secondPortalPos; - Vector effect156Pos; - Vector collectiblePos; - Vector leftItemPos; - Vector effect65Pos; - uint64_t seedItemRngShifts; - uint64_t spawnRngShifts; - uint32_t spawnRngShift3; - uint8_t isPickupListOwned; - Game *pickupListData; - int pickupListCapacity; - uint32_t pickupListSize; - RNG spawnRng; - Vector effect158Pos; - uint64_t uStack_5c0; - Vector seedItemPos; - RNG decorationRng; - void *collectiblesBegin; - Game *collectiblesEnd; - Game *collectiblesCapacity; - float fStack_590; - float fStack_58c; - RNG ambientRng; - char isHasRaglich; - Vector VStack_574; - char isHasDump; - char isHasHeretic; - char isHasWater; - Room *room; - RoomConfig_Room *roomConfig; - Game *pGStack_560; - void **ppvStack_55c; - uint8_t bStack_555; - Game *pGStack_554; - Game *pGStack_550; - Game *pGStack_54c; - char cStack_545; - Game *local_544; - Game *local_540 [73]; - uint8_t auStack_41c [24]; - uint8_t auStack_404 [24]; - uint8_t auStack_3ec [24]; - uint8_t auStack_3d4 [24]; - uint8_t auStack_3bc [24]; - uint8_t auStack_3a4 [24]; - uint8_t auStack_38c [24]; - uint8_t auStack_374 [24]; - uint8_t auStack_35c [24]; - uint8_t auStack_344 [28]; - uint64_t floodRngShifts; - uint64_t uStack_318; - std_string versusText; - RNG rayRng; - wchar_t *******titleText [4]; - uint32_t titleSize; - uint32_t titleCapacity; - int scoreRoomType; - int scoreFlag; - Game *scoreValue; - std_string lightGradientPath; - std_string spotLightPath; - std_string minibossName; - uint32_t portalTypes [4]; - uint8_t twinNameWide [128]; - uint8_t playerNameWide [128]; - uint8_t soloPlayerNameWide [128]; - uint8_t minibossNameWide [128]; - uint8_t versusWide [68]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t uStack_14; - int listIndex; - Manager *manager; - Entity_Pickup *pickup; - void *pillRngs; - - puStack_20 = versusWide + 100; - uStack_14 = 0xffffffff; - puStack_18 = &LAB_00b01279; - local_1c = ExceptionList; - uVar7 = __security_cookie ^ GHIDRA_UINT((versusWide + 0x58)); - ExceptionList = &local_1c; - roomConfig = config; - room = this; - local_24 = uVar7; - (GHIDRA_CAST((&this->_temporaryEffects)))->TemporaryEffects::ClearEffects(0); - puVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300)))); - *GHIDRA_CAST(puVar10[1]) = 0; - puVar10 = GHIDRA_CAST(*puVar10); - while (puVar10 != GHIDRA_CAST(0x0)) { - puVar1 = GHIDRA_CAST(*puVar10); - operator_delete(puVar10,0x20); - puVar10 = puVar1; - } - local_544 = GHIDRA_CAST(0xa); - *GHIDRA_CAST(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300))))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300)))); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300)))) + 4)) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300)))); - local_540[0] = GHIDRA_CAST(this->_outputGroupCallbacks); - pbVar24 = this->_outputGroupGridIndices; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7304)))) = 0; - do { - iVar17 = *GHIDRA_CAST(pbVar24); - FID_conflict__Erase_tree_>_> - (pbVar24,(fuzzer_allocator_> *)pbVar24, - *(_Tree_node **)(iVar17 + 4)); - *GHIDRA_CAST((iVar17 + 4)) = iVar17; - *GHIDRA_CAST(iVar17) = iVar17; - *GHIDRA_CAST((iVar17 + 8)) = iVar17; - pbVar24[4] = 0; - pbVar24[5] = 0; - pbVar24[6] = 0; - pbVar24[7] = 0; - pbVar24 = pbVar24 + 8; - *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 4)) = local_540[0]->_stage; - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0xc)); - local_544 = GHIDRA_CAST((GHIDRA_INT(&local_544[-1]._console) + 3)); - } while (local_544 != GHIDRA_CAST(0x0)); - FUN_00429f50(uVar7); - FUN_00429f50(); - currentRoom = room; - puVar12 = &(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x1bb8))); - (room->_waterCurrent).x = g_vectorZero.x; - (room->_waterCurrent).y = g_vectorZero.y; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x73f0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7764)))) = 0; - room->_lavaIntensity = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7769))) = 0; - room->_isPickupVisionInvalid = 0; - (*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x11f6))) = 1; - currentRoom->_isFirstEnemyDead = 0; - currentRoom->_pacifist = 0; - if (*GHIDRA_CAST(puVar12) != 0) { - local_544 = GHIDRA_CAST(puVar12); - msvc::multiset::erase(&local_544); - *GHIDRA_CAST(puVar12) = 0; - } - pGVar20 = g_game; - (*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1bbc))) = 0; - iVar17 = *GHIDRA_CAST(currentRoom->_pendingGridRemovals); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1bc0)))) = g_vectorZero.x; - fVar25 = g_vectorZero.y; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x7214)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x7218)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x70fc)))) = 0; - currentRoom->_slowdownDuration = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x7230)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x721c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1bc4)))) = fVar25; - currentRoom->_enterFrame = pGVar20->_frameCount; - FID_conflict__Erase_tree_>_> - (currentRoom->_pendingGridRemovals, - (fuzzer_allocator_> *) - currentRoom->_pendingGridRemovals,*(_Tree_node **)(iVar17 + 4)); - *GHIDRA_CAST((iVar17 + 4)) = iVar17; - *GHIDRA_CAST(iVar17) = iVar17; - *GHIDRA_CAST((iVar17 + 8)) = iVar17; - manager = g_manager; - currentRoom->_pendingGridRemovals[4] = 0; - currentRoom->_pendingGridRemovals[5] = 0; - currentRoom->_pendingGridRemovals[6] = 0; - currentRoom->_pendingGridRemovals[7] = 0; - piVar18 = (manager->_entityConfig)._entities._head; - local_540[0] = GHIDRA_CAST(*piVar18); - if (local_540[0] != GHIDRA_CAST(piVar18)) { - do { - *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 200)) = 0; - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)local_540); - } while (local_540[0] != (manager->_entityConfig)._entities._head); - } - pRVar4 = roomConfig; - currentRoom = room; - (*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x11f5))) = 1; - KAGE_LogMessage(1,GHIDRA_CAST("Room %d.%d(%s)\n")); - ItemPool::ResetRoomBlacklist(&g_game->_itemPool); - FUN_007eb010(); - currentRoom->_gridWidth = pRVar4->Width + 2; - bVar5 = (currentRoom->_lightSprite)._loaded; - currentRoom->_gridHeight = pRVar4->Height + 2; - if (bVar5 == 0) { - pickup = ¤tRoom->_lightSprite; - lightGradientPath._size = 0; - lightGradientPath._capacity = 0xf; - lightGradientPath._buf[0] = '\0'; - lightGradientPath._buf[1] = '\0'; - lightGradientPath._buf[2] = '\0'; - lightGradientPath._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(lightGradientPath._buf)) + 0x0))) = msvc::_Allocate(0x20); - lightGradientPath._size = 0x16; - lightGradientPath._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(lightGradientPath._buf))) + 0x0))),"gfx/LightGradient.anm2",0x17); - uStack_14 = 0; - ANM2::Load(pickup,&lightGradientPath,1); - uStack_14 = 0xffffffff; - if (0xf < lightGradientPath._capacity) { - uVar7 = lightGradientPath._capacity + 1; - pcVar16 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(lightGradientPath._buf))) + 0x0))); - if (0xfff < uVar7) { - pcVar16 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(lightGradientPath._buf)) + 0x0))) + -4)); - uVar7 = lightGradientPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(lightGradientPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar16))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar16,uVar7); - } - lightGradientPath._size = 0; - lightGradientPath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(lightGradientPath._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(lightGradientPath._buf)) + 0x0))) & 0xffffff00; - layer = ANM2::GetLayer(pickup,GHIDRA_CAST(0x0)); - layer->_minFilterMode = 1; - layer = ANM2::GetLayer(pickup,GHIDRA_CAST(0x0)); - pGStack_54c = GHIDRA_CAST(&(currentRoom->_lightSprite)._animDefaultName); - layer->_magFilterMode = 1; - if (0xf < (currentRoom->_lightSprite)._animDefaultName._capacity) { - pGStack_54c = *GHIDRA_CAST((GHIDRA_CAST(pGStack_54c))->_buf); - } - pbVar24 = (currentRoom->_lightSprite)._animState._animData; - if (pbVar24 == GHIDRA_CAST(0x0)) { -LAB_007f2c5c: - bVar5 = ANM2::SetAnimation(pickup,GHIDRA_CAST(pGStack_54c),1); - if (bVar5 != 0) { - AnimationState::Rewind(&(currentRoom->_lightSprite)._animState); - (currentRoom->_lightSprite)._animState._isPlaying = 1; - } - } - else { - if (0xf < *GHIDRA_CAST((pbVar24 + 0x14))) { - pbVar24 = *GHIDRA_CAST(pbVar24); - } - pGVar20 = pGStack_54c; - do { - bVar5 = *pbVar24; - bVar15 = (uint8_t)pGVar20->_stage; - isLess = bVar5 < bVar15; - if (bVar5 != bVar15) { -LAB_007f2c44: - uVar7 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007f2c49; - } - if (bVar5 == 0) break; - bVar5 = pbVar24[1]; - bVar15 = *GHIDRA_CAST((GHIDRA_INT(&pGVar20->_stage) + 1)); - isLess = bVar5 < bVar15; - if (bVar5 != bVar15) goto LAB_007f2c44; - pbVar24 = pbVar24 + 2; - pGVar20 = GHIDRA_CAST((GHIDRA_INT(&pGVar20->_stage) + 2)); - } while (bVar5 != 0); - uVar7 = 0; -LAB_007f2c49: - if ((uVar7 != 0) || - ((*GHIDRA_CAST((GHIDRA_INT((currentRoom->_lightSprite)._animState._animData) + 0x34)) != '\0' && - ((currentRoom->_lightSprite)._animState._isPlaying == 0)))) goto LAB_007f2c5c; - } - layer = ANM2::GetLayer(¤tRoom->_lightSprite,GHIDRA_CAST(0x0)); - layer->_blendMode[0] = DAT_00c354ac; - layer->_blendMode[1] = DAT_00c354b0; - layer->_blendMode[2] = DAT_00c354b4; - layer->_blendMode[3] = DAT_00c354b8; - layer->_blendMode[4] = DAT_00c354bc; - } - if ((*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x705d))) == '\0') { - puVar12 = &(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f54))); - spotLightPath._size = 0; - spotLightPath._capacity = 0xf; - spotLightPath._buf[0] = '\0'; - spotLightPath._buf[1] = '\0'; - spotLightPath._buf[2] = '\0'; - spotLightPath._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(spotLightPath._buf)) + 0x0))) = msvc::_Allocate(0x20); - spotLightPath._size = 0x12; - spotLightPath._capacity = 0x1f; - builtin_strncpy((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spotLightPath._buf))) + 0x0))),"gfx/SpotLight.anm2",0x13); - uStack_14 = 1; - ANM2::Load(GHIDRA_CAST(puVar12),&spotLightPath,1); - uStack_14 = 0xffffffff; - if (0xf < spotLightPath._capacity) { - uVar7 = spotLightPath._capacity + 1; - pcVar16 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(spotLightPath._buf))) + 0x0))); - if (0xfff < uVar7) { - pcVar16 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(spotLightPath._buf)) + 0x0))) + -4)); - uVar7 = spotLightPath._capacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(spotLightPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar16))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pcVar16,uVar7); - } - spotLightPath._size = 0; - spotLightPath._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(spotLightPath._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(spotLightPath._buf)) + 0x0))) & 0xffffff00; - layer = ANM2::GetLayer(GHIDRA_CAST(puVar12),GHIDRA_CAST(0x0)); - layer->_minFilterMode = 1; - layer = ANM2::GetLayer(GHIDRA_CAST(puVar12),GHIDRA_CAST(0x0)); - pGStack_54c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f6c)))); - layer->_magFilterMode = 1; - if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f80))))) { - pGStack_54c = *GHIDRA_CAST(pGStack_54c); - } - pbVar24 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f88)))); - if (pbVar24 != GHIDRA_CAST(0x0)) { - if (0xf < *GHIDRA_CAST((pbVar24 + 0x14))) { - pbVar24 = *GHIDRA_CAST(pbVar24); - } - pGVar20 = pGStack_54c; - do { - bVar5 = *pbVar24; - bVar15 = (uint8_t)pGVar20->_stage; - isLess = bVar5 < bVar15; - if (bVar5 != bVar15) { -LAB_007f2e20: - uVar7 = -GHIDRA_UINT(isLess) | 1; - goto LAB_007f2e25; - } - if (bVar5 == 0) break; - bVar5 = pbVar24[1]; - bVar15 = *GHIDRA_CAST((GHIDRA_INT(&pGVar20->_stage) + 1)); - isLess = bVar5 < bVar15; - if (bVar5 != bVar15) goto LAB_007f2e20; - pbVar24 = pbVar24 + 2; - pGVar20 = GHIDRA_CAST((GHIDRA_INT(&pGVar20->_stage) + 2)); - } while (bVar5 != 0); - uVar7 = 0; -LAB_007f2e25: - if ((uVar7 == 0) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f88)))) + 0x34)) == '\0' || - ((*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f98))) != '\0')))) goto LAB_007f2e57; - } - bVar5 = ANM2::SetAnimation(GHIDRA_CAST(puVar12),GHIDRA_CAST(pGStack_54c),1); - if (bVar5 != 0) { - AnimationState::Rewind(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f84))))); - (*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x6f98))) = 1; - } - } -LAB_007f2e57: - piVar18 = currentRoom->_doorGridPositions; - iVar17 = 0; - do { - iVar8 = room_shape_get_door_grid_index - (iVar17,currentRoom->_gridWidth,currentRoom->_gridHeight, - *GHIDRA_CAST((GHIDRA_CAST(descriptor->Data) + 0x48))); - iVar17 = extraout_ECX + 1; - *piVar18 = iVar8; - piVar18 = piVar18 + 1; - } while (iVar17 < 8); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) = descriptor; - currentRoom->_roomType = *GHIDRA_CAST((GHIDRA_CAST(descriptor->Data) + 8)); - currentRoom->_bossId = 0; - currentRoom->_secondBossID = 0; - func_0x009e2830(); - (GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x776c))))))->BeastArena::init(); - fVar25 = 0.0; - if (currentRoom->_roomType == 5) { - pGVar20 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - local_540[0] = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar20)) + 0x10)))) + 0x44)) - 1)); - pGStack_554 = pGVar20; - if (-1 < GHIDRA_INT(local_540[0])) { - VStack_574.y = (float)&g_manager->_entityConfig; - pGStack_54c = GHIDRA_CAST((GHIDRA_INT(local_540[0]) * 0x10)); - do { - fStack_58c = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar20)) + 0x10)))); - iVar17 = -1; - iVar8 = 0; - local_544 = *GHIDRA_CAST((GHIDRA_CAST(fStack_58c) + 0x40)); - pbVar24 = &local_544->_bossChallenge; - if (pbVar24[GHIDRA_INT(pGStack_54c)] == 0) { - fVar9 = fStack_58c; - } - else { - local_544 = *GHIDRA_CAST((GHIDRA_INT(&local_544->_stageType) + GHIDRA_INT(pGStack_54c))); - do { - fVar9 = (float)local_544->_roomList[0]._doors[iVar8 * 3 + -10]; - if (fVar25 < fVar9) { - iVar17 = iVar8; - fVar25 = fVar9; - } - iVar8 = iVar8 + 1; - } while (iVar8 < GHIDRA_INT(GHIDRA_UINT(pbVar24[GHIDRA_INT(pGStack_54c)]))); - fVar25 = 0.0; - fVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGStack_554)) + 0x10)))); - currentRoom = room; - } - iVar8 = *GHIDRA_CAST((GHIDRA_INT(pGStack_54c->_roomList[0]._doors) + *GHIDRA_CAST((GHIDRA_CAST(fVar9) + 0x40)) + -0x2c - )); - entityConfigEntry = - EntityConfig::GetEntity - (GHIDRA_CAST(VStack_574.y),*GHIDRA_CAST((iVar8 + iVar17 * 0xc)), - GHIDRA_UINT(*GHIDRA_CAST((iVar8 + 4 + iVar17 * 0xc))), - GHIDRA_UINT(*GHIDRA_CAST((iVar8 + 6 + iVar17 * 0xc)))); - if ((entityConfigEntry != GHIDRA_CAST(0x0)) && - (iVar17 = entityConfigEntry->bossID, iVar17 != 0)) { - if (currentRoom->_bossId == 0) { - currentRoom->_bossId = iVar17; - } - else if (iVar17 != currentRoom->_bossId) { - currentRoom->_secondBossID = iVar17; - } - } - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + -1)); - pGVar20 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - pGStack_54c = GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST(&(pGStack_54c[-1])) + 0x68d64))) + 8)); - } while (-1 < GHIDRA_INT(local_540[0])); - } - } - pGVar20 = g_game; - uVar7 = GHIDRA_UINT(descriptor->Flags) >> 4; - (*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x7228))) = (uint8_t)uVar7 & 1; - if (((pGVar20->_dailyChallenge)._specialDailyId == 0x11) && ((uVar7 & 1) != 0)) { - uVar11 = *GHIDRA_CAST((GHIDRA_INT(&pGVar20->_gameStateFlags) + 4)); - *GHIDRA_CAST(&pGVar20->_gameStateFlags) = GHIDRA_UINT(pGVar20->_gameStateFlags) | 0x20000000; - *GHIDRA_CAST((GHIDRA_INT(&pGVar20->_gameStateFlags) + 4)) = uVar11; - } - currentRoom->_hasTriggerPressurePlates = 0; - update_bounds(currentRoom,1); - manager = g_manager; - pGVar20 = g_game; - if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) { - switch(g_game->_stage) { - case 1: - currentRoom->_shopLevel = 1; - break; - case 2: -LAB_007f30fb: - currentRoom->_shopLevel = 2; - break; - case 3: -LAB_007f3107: - currentRoom->_shopLevel = 3; - break; - case 4: -LAB_007f3113: - currentRoom->_shopLevel = 4; - break; - case 5: - goto LAB_007f311f; - case 6: - currentRoom->_shopLevel = GHIDRA_UINT((currentRoom->_roomType == 1)) * 4 + 1; - } - } - else { - currentRoom->_shopLevel = 1; - if (((manager->_persistentGameData)._achievements[0x9a] == 0) && - ((iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((manager)) + 0x8)))), iVar17 != 2 || - (((pGVar20->_dailyChallenge)._id == 0 && (pGVar20->_isDebug == 0)))))) { - if (((manager->_persistentGameData)._achievements[0x99] != 0) || - ((iVar17 == 2 && (((pGVar20->_dailyChallenge)._id != 0 || (pGVar20->_isDebug != 0)))))) - goto LAB_007f3113; - if (((manager->_persistentGameData)._achievements[0x98] != 0) || - ((iVar17 == 2 && (((pGVar20->_dailyChallenge)._id != 0 || (pGVar20->_isDebug != 0)))))) - goto LAB_007f3107; - if (((manager->_persistentGameData)._achievements[0x97] != 0) || - ((iVar17 == 2 && (((pGVar20->_dailyChallenge)._id != 0 || (pGVar20->_isDebug != 0)))))) - goto LAB_007f30fb; - } - else { -LAB_007f311f: - currentRoom->_shopLevel = 5; - } - } - currentRoom->_shopRestockTimer = -1; - msvc::deque::_Tidy(); - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - KAGE_LogMessage(1,GHIDRA_CAST("[Frame %d] ")); - } - spawnRngShifts = 0x700000002; - pGVar20 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x5c)); - local_544 = GHIDRA_CAST(&DAT_00000007); - spawnRngShift3 = 7; - pGStack_560 = pGVar20; - KAGE_LogMessage(1,GHIDRA_CAST("SpawnRNG seed: %u\n")); - isHasWater = '\0'; - bStack_555 = 0; - cStack_545 = '\0'; - isHasDump = '\0'; - isHasHeretic = '\0'; - isHasRaglich = '\0'; - local_540[0] = GHIDRA_CAST(0x0); - if (roomConfig->SpawnCount != 0) { - pGStack_550 = GHIDRA_CAST(0x0); - do { - if (pGVar20 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(pGVar20) >> ((uint8_t)spawnRngShifts & 0x1f) ^ GHIDRA_UINT(pGVar20); - uVar7 = uVar7 << ((uint8_t)((uint64_t)spawnRngShifts >> 0x20) & 0x1f) ^ uVar7; - pGVar20 = GHIDRA_CAST((uVar7 >> ((uint8_t)local_544 & 0x1f) ^ uVar7)); - textData = (void *)(GHIDRA_INT(roomConfig->Spawns) + GHIDRA_INT(pGStack_550)); - pGStack_554 = pGVar20; - if (*GHIDRA_CAST((GHIDRA_CAST(textData) + 8)) != '\0') { - puVar10 = (GHIDRA_CAST((textData)))->Spawn::PickEntry((float)((double)GHIDRA_INT(pGVar20) + - __uint_to_double_fixup[-(GHIDRA_INT(pGVar20) >> 0x1f)]) - * 2.3283062e-10); - switch(*puVar10) { - case 0x339: - case 0x38b: - isHasWater = '\x01'; - break; - case 0x33d: -switchD_007f32bc_caseD_33d: - bStack_555 = 1; - break; - case 0x36c: - case 0x396: -switchD_007f32bc_caseD_36c: - isHasDump = '\x01'; - case 0x372: - puVar23 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - *puVar23 = *puVar23 | 0x1000; - break; - case 0x389: - isHasHeretic = '\x01'; - break; - case 0x397: - isHasRaglich = '\x01'; - break; - case 0x3ca: - switch(*GHIDRA_CAST((puVar10 + 1))) { - case 0: - puVar23 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - *puVar23 = *puVar23 | 0x200; - break; - case 1: - uVar7 = GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(puVar10) + 6))); - if (uVar7 == 0x14) goto switchD_007f32bc_caseD_33d; - if (uVar7 == 0xb) { - cStack_545 = '\x01'; - } - else { - if (uVar7 == 10) goto switchD_007f32bc_caseD_36c; - if (uVar7 < 4) { - (currentRoom->_waterCurrent).x = *GHIDRA_CAST((&DAT_00c5d0e8 + uVar7 * 8)); - (currentRoom->_waterCurrent).y = *GHIDRA_CAST((&DAT_00c5d0ec + uVar7 * 8)); - } - } - break; - case 3: - puVar23 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - *puVar23 = *puVar23 | 0x2000; - break; - case 4: - iVar17 = currentRoom->_gridWidth; - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(roomConfig->Spawns) + GHIDRA_INT(pGStack_550))) + 1 + - (*GHIDRA_CAST((GHIDRA_CAST(pGStack_550) + 2 + GHIDRA_INT(roomConfig->Spawns))) + 1) * iVar17; - fStack_590 = (float)(iVar8 % iVar17) * 40.0 + 40.0; - fStack_58c = (float)(iVar8 / iVar17) * 40.0 + 120.0; - FUN_00429f90(&fStack_590); - FUN_00429f90(&fStack_590); - pGVar20 = pGStack_554; - currentRoom = room; - } - } - } - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(pGStack_550) + 0x10)); - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 1)); - } while (local_540[0] < GHIDRA_UINT((uint16_t)roomConfig->SpawnCount)); - } - LoadBackdropGraphics(currentRoom); - pGVar20 = g_game; - iVar17 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1d18)); - if ((iVar17 == 6) || (iVar17 == 0x2c)) { -LAB_007f34f1: - fVar25 = 1.0; - } - else { - if ((iVar17 == 0xc) && (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x10)) + 8)) == 1)) { - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x58)); - floodRngShifts = 0x1300000001; - local_540[0] = GHIDRA_CAST(0x3); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 1 ^ uVar7; - uVar7 = uVar7 << 0x13 ^ uVar7; - if ((uVar7 >> 3 ^ uVar7) % 5 == 0) goto LAB_007f34f1; - } - fVar25 = 0.0; - } - currentRoom->_waterAmount = fVar25; - currentRoom->_waterLerpColorDuration = -1; - currentRoom->_waterLerpColorCountdown = -1; - uVar7 = Game::GetStageID(pGVar20,(uint8_t)pGVar20); - if (((uVar7 == 0x1b) || (uVar7 == 0x1c)) && (currentRoom->_roomType != 0x1b)) { - currentRoom->_waterAmount = 1.0; - } - local_540[0] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - if (((*GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) >> 8 & 1) != 0) || (cStack_545 != '\0')) { - currentRoom->_waterAmount = 1.0; - } - iVar17 = currentRoom->_backdropType; - if (((iVar17 == 0x10) || (iVar17 == 0x23)) || - ((currentRoom->_roomType == 0x10 || - ((isHasDump != '\0' && ((*GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) >> 8 & 1) == 0)))))) { - currentRoom->_waterAmount = 0.0; - } - if (0.0 < currentRoom->_waterAmount) { - currentRoom->_lavaIntensity = 0.0; - } - if (*GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x40)) == 0) { - (*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1))) = 1; - uVar7 = *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x58)); - firstVisitRngShifts = 0x900000005; - local_544 = GHIDRA_CAST(0x7); - if ((iVar17 == 6) && ((g_manager->_optionsConfig)._enableWaterSurface == 0)) { - *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) = *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) | 0x20; - } - else { - cVar6 = (char)currentRoom->_gridPaths[currentRoom->_backdropType * 0x4f + 0x5ba]; - if (cVar6 == '\x02') { -LAB_007f3658: - cStack_545 = '\x01'; - } - else { - if (cVar6 == '\x01') { - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 5 ^ uVar7; - uVar7 = uVar7 << 9 ^ uVar7; - uVar7 = uVar7 >> 7 ^ uVar7; - if ((uVar7 & 1) == 0) goto LAB_007f3658; - } - cStack_545 = '\0'; - } - uVar19 = *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) | 0x20; - if (cStack_545 == '\0') { - uVar19 = *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) & 0xffffffdf; - } - *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) = uVar19; - } - local_540[0] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 5 ^ uVar7; - uVar19 = uVar7 << 9 ^ uVar7; - local_544 = GHIDRA_CAST((CONCAT31((uint3)(uVar19 >> 0xf),~(uint8_t)(uVar19 >> 7) ^ (uint8_t)uVar7) & - 0xffffff01)); - uVar7 = *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) | 0x40; - if ((char)local_544 == '\0') { - uVar7 = *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) & 0xffffffbf; - } - *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x44)) = uVar7; - pGVar20 = g_game; - if ((((currentRoom->_roomType == 2) && - (g_game->_shopVisits = g_game->_shopVisits + 1, 5 < pGVar20->_shopVisits)) && - (iVar17 = pGVar20->_difficulty, iVar17 != 2)) && (iVar17 != 3)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x17b); - } - iVar17 = currentRoom->_backdropType; - if (iVar17 == 0x20) { - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - if ((uVar7 >> 5 & 1) == 0) goto LAB_007f3755; - if ((uVar7 >> 9 & 1) != 0) { - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)) = uVar7 & 0xffffffdf; - iVar17 = currentRoom->_backdropType; - goto LAB_007f3755; - } - } - else { -LAB_007f3755: - if ((iVar17 == 0x3a) || (iVar17 == 0x3b)) { - if ((g_game->_levelStateFlags & 0x400000U) != 0) { - bStack_555 = 0; - isHasWater = '\x01'; - } - puVar23 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - *puVar23 = *puVar23 | 0x2000; - } - } - if (isHasWater != '\0') { - puVar23 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - *puVar23 = *puVar23 | 0x20; - } - if (bStack_555 != 0) { - puVar23 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - *puVar23 = *puVar23 & 0xffffffdf; - } - if (currentRoom->_backdropType == 0x2e) { - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - if ((uVar7 >> 5 & 1) != 0) { - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)) = uVar7 | 0x1000; - } - } - } - memset(currentRoom->_gridPaths,0,0xa80); - currentRoom->_roomClearDelay = 0; - pGStack_54c = GHIDRA_CAST(0x0); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x54)) = 0; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x50)) = 0; - if (0 < currentRoom->_gridHeight * currentRoom->_gridWidth) { - pGStack_550 = GHIDRA_CAST(currentRoom->_gridEntities); - local_540[0] = GHIDRA_CAST(0x0); - do { - pGVar20 = local_540[0]; - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - if (*GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x68)) + GHIDRA_INT(local_540[0]))) != 0) { - if (*GHIDRA_CAST(pGStack_550) != GHIDRA_CAST(0x0)) { - (**(code **)**GHIDRA_CAST(pGStack_550))(1); - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - } - local_544 = GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x68)) + GHIDRA_INT(pGVar20))); - if (local_544->_stage != 0) { - gridEntity = Isaac::CreateGridEntity(local_544->_stage,GHIDRA_UINT(pGStack_54c)); - *GHIDRA_CAST(pGStack_550) = gridEntity; - iVar17 = local_544->_stageType; - bVar5 = local_544->_bossChallenge; - bVar15 = local_544->_devilRoomDisabled; - uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_544)) + 0xa)))); - iVar8 = local_544->_curses; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x4)))) = local_544->_stage; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = iVar17; - (*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0xc))) = bVar5; - (*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0xd))) = bVar15; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0xe)))) = uVar3; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) = iVar8; - uVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_544)) + 0x10)))); - iVar17 = local_544->_roomList[0].GridIndex; - iVar8 = local_544->_roomList[0].SafeGridIndex; - listIndex = local_544->_roomList[0].ListIndex; - gridEntity->_collisionClass = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x14)))) = uVar11; - gridEntity->_varData = iVar17; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x1c)))) = iVar8; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x20)))) = listIndex; - gridEntity->BeginBatches(); - pGVar20 = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) + 1; - (*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x1c))) = 1; - gridEntity->_spawnFrame = pGVar20->_frameCount; - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - pGVar20 = local_540[0]; - } - iVar8 = *GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x68)) + GHIDRA_INT(pGVar20))); - if (iVar8 == 7) { - *GHIDRA_CAST((iVar17 + 0x54)) = *GHIDRA_CAST((iVar17 + 0x54)) + 1; - } - else if (iVar8 == 0xe) { - *GHIDRA_CAST((iVar17 + 0x50)) = *GHIDRA_CAST((iVar17 + 0x50)) + 1; - } - } - local_540[0] = GHIDRA_CAST((GHIDRA_INT(pGVar20) + 0x20)); - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(pGStack_550) + 4)); - pGStack_54c = GHIDRA_CAST((GHIDRA_INT(&pGStack_54c->_stage) + 1)); - } while (GHIDRA_INT(pGStack_54c) < currentRoom->_gridHeight * currentRoom->_gridWidth); - } - if ((0 < *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x54))) && (currentRoom->_backdropType == 0x22) - ) { - currentRoom->_waterAmount = 0.0; - } - spawnRng._seed = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x5c)); - spawnRng._shift3 = 9; - spawnRng._shift1 = 2; - spawnRng._shift2 = 0x15; - if ((g_game->_difficulty == 1) || (uVar7 = 1, g_game->_difficulty == 3)) { - uVar7 = 2; - } - uVar7 = (GHIDRA_CAST((&spawnRng)))->RNG::RandomInt(uVar7); - if (uVar7 == 0) { - if (spawnRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(spawnRng._seed) >> ((uint8_t)spawnRng._shift1 & 0x1f) ^ spawnRng._seed; - uVar7 = uVar7 << ((uint8_t)spawnRng._shift2 & 0x1f) ^ uVar7; - iVar17 = GetRandomTileIndex(currentRoom,uVar7 >> ((uint8_t)spawnRng._shift3 & 0x1f) ^ uVar7); - } - else { - iVar17 = -1; - } - currentRoom->_tintedRockIdx = iVar17; - local_540[0] = GHIDRA_CAST(0x0); - if (roomConfig->SpawnCount != 0) { - fStack_58c = 0.0; - pGVar20 = pGStack_560; - do { - if (pGVar20 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(pGVar20) >> ((uint8_t)spawnRngShifts & 0x1f) ^ GHIDRA_UINT(pGVar20); - uVar7 = uVar7 << ((uint8_t)((uint64_t)spawnRngShifts >> 0x20) & 0x1f) ^ uVar7; - pGVar20 = GHIDRA_CAST((uVar7 >> ((uint8_t)spawnRngShift3 & 0x1f) ^ uVar7)); - spawnEntry = GHIDRA_CAST((GHIDRA_INT(fStack_58c) + GHIDRA_INT(roomConfig->Spawns))); - pGStack_54c = GHIDRA_CAST((*spawnEntry + 1 + (spawnEntry[1] + 1) * currentRoom->_gridWidth)); - pGStack_560 = pGVar20; - if ((char)spawnEntry[4] != '\0') { - local_544 = (GHIDRA_CAST((spawnEntry)))->Spawn::PickEntry((float)((double)GHIDRA_INT(pGVar20) + - __uint_to_double_fixup[-(GHIDRA_INT(pGVar20) >> 0x1f)]) * - 2.3283062e-10); - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - msvc::set::find_node(findResult,&pGStack_54c); - pGVar20 = pGStack_560; - if ((*GHIDRA_CAST((foundNode + 0xd)) != '\0') || - (iVar8 = foundNode, GHIDRA_INT(pGStack_54c) < *GHIDRA_CAST((foundNode + 0x10)))) { - iVar8 = *GHIDRA_CAST((iVar17 + 0x80)); - } - if (iVar8 == *GHIDRA_CAST((iVar17 + 0x80))) { - SpawnEntry(currentRoom,GHIDRA_UINT(pGStack_54c),local_544,GHIDRA_UINT(pGStack_560),GHIDRA_CAST(0x0),0); - } - } - fStack_58c = (float)(GHIDRA_INT(fStack_58c) + 0x10); - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 1)); - } while (local_540[0] < GHIDRA_UINT((uint16_t)roomConfig->SpawnCount)); - } - if (roomConfig->Type == 4) { - pGVar21 = GHIDRA_CAST(0x0); - collectiblesBegin = (void *)0x0; - pGVar20 = GHIDRA_CAST(0x0); - pGStack_550 = GHIDRA_CAST(0x0); - collectiblesEnd = GHIDRA_CAST(0x0); - local_544 = GHIDRA_CAST(0x0); - collectiblesCapacity = GHIDRA_CAST(0x0); - uStack_14 = 2; - local_540[0] = GHIDRA_CAST(0x0); - if ((currentRoom->_entityList)._updateEL._size != 0) { - do { - pGVar14 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((currentRoom->_entityList)._updateEL)) + 0x4)))) + - GHIDRA_INT(local_540[0]) * 4)); - if (pGVar14->_roomList[0].OverrideData == &DAT_00000005) { - if (pGVar14->_roomList[0].AllowedDoors == 100) { - pGStack_554 = pGVar14; - if (pGVar21 == pGVar20) { - msvc::vector::_Emplace_reallocate(pGVar21,&pGStack_554); - pGVar20 = collectiblesCapacity; - pGVar21 = collectiblesEnd; - } - else { - pGVar21->_stage = GHIDRA_INT(pGVar14); - collectiblesEnd = GHIDRA_CAST(&pGVar21->_stageType); - pGVar21 = collectiblesEnd; - } - } - } - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 1)); - } while (local_540[0] < GHIDRA_UINT((currentRoom->_entityList)._updateEL._size)); - pGStack_550 = pGVar21; - local_544 = pGVar20; - } - pGVar20 = pGStack_550; - cStack_545 = '\0'; - if (((g_game->_stage == 10) && - ((((g_game->_stageType == 0 && - (player = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0xa1), - player != GHIDRA_CAST(0x0))) && - (iVar17 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0xa1), 1 < iVar17)) || - (((g_game->_stage == 10 && (g_game->_stageType == 1)) && - ((player = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0x9b), - player != GHIDRA_CAST(0x0) && - (iVar17 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x9b), 1 < iVar17)))))))) || - (((g_game->_stage == 7 || (g_game->_stage == 8)) && - ((player = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0x6f), - player != GHIDRA_CAST(0x0) && - (iVar17 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x6f), 1 < iVar17)))))) { - cStack_545 = '\x01'; - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x19e,GHIDRA_CAST(&g_game->_playerManager),1); - if (((player == GHIDRA_CAST(0x0)) && (cStack_545 == '\0')) && - ((*GHIDRA_CAST(&g_game->_roomTransition) == 0 || (((g_game->_roomTransition)._flags & 1) == 0)))) { - cStack_545 = '\0'; - } - else { - cStack_545 = '\x01'; - } - if ((((g_game->_stageType == 4) || (g_game->_stageType == 5)) || - (((bVar5 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0xbb), bVar5 != 0 && - (g_game->_stage != 9)) && - ((((roomConfig->Subtype != 1 && (roomConfig->Subtype != 3)) || (cStack_545 == '\0')) || - ((g_game->_stageType == 4 || (g_game->_stageType == 5)))))))) && - ((g_game->_stage < 1 || - ((6 < g_game->_stage || (bVar5 = Game::GetStateFlag(g_game,0x30), bVar5 == 0)))))) { - textData = collectiblesBegin; - if ((1 < GHIDRA_UINT((GHIDRA_INT(pGVar20) - GHIDRA_INT(collectiblesBegin) >> 2))) && - ((g_game->_dailyChallenge)._id == 0)) { - if ((g_game->_stageType == 4) || (g_game->_stageType == 5)) { - bVar5 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0xbb); - if (bVar5 != 0) { - uStack_318 = 0x500000009; - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x5c)); - local_540[0] = GHIDRA_CAST(0x19); - pGStack_554 = GHIDRA_CAST(&g_game->_playerManager); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 9 ^ uVar7; - uVar7 = uVar7 << 5 ^ uVar7; - iVar17 = PlayerManager::GetTrinketMultiplier(GHIDRA_CAST(pGStack_554),0xbb); - if (GHIDRA_INT(((uVar7 >> 0x19 ^ uVar7) & 1)) < iVar17) goto LAB_007f3e30; - textData = collectiblesBegin; - } - } - pickup = *GHIDRA_CAST((GHIDRA_CAST(textData) + 4)); - bVar5 = pickup->_isForceBlind; - pickup->_isForceBlind = 1; - if (((pickup->_variant == 100) && (pickup->_subtype != 0)) && (bVar5 != 1)) { - (GHIDRA_CAST((pickup)))->Entity_Pickup::UpdateSprite(0); - } - } - } - else { -LAB_007f3e30: - textData = collectiblesBegin; - } - pGVar20 = g_game; - if (((g_game->_stageType == 4) || (g_game->_stageType == 5)) && - ((2 < GHIDRA_UINT((GHIDRA_INT(pGStack_550) - GHIDRA_INT(textData) >> 2)) && - ((roomConfig->Subtype == 0 || (roomConfig->Subtype == 2)))))) { - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(textData) + 8)) + 0x528)) = 0; - } - iVar17 = pGVar20->_difficulty; - if (((iVar17 == 2) || (iVar17 == 3)) && - (descriptor->GridIndex != pGVar20->_greedModeTreasureRoomIdx)) { - uVar19 = 0; - uVar7 = GHIDRA_INT(pGStack_550) - GHIDRA_INT(textData) >> 2; - if (uVar7 != 0) { - do { - iVar17 = uVar19 * 4; - uVar19 = uVar19 + 1; - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(textData) + iVar17)) + 0x588)) = 0; - } while (uVar19 < uVar7); - } - } - uStack_14 = 0xffffffff; - if (textData != (void *)0x0) { - deallocate(textData,GHIDRA_INT(local_544) - GHIDRA_INT(textData) >> 2); - collectiblesBegin = (void *)0x0; - collectiblesEnd = GHIDRA_CAST(0x0); - collectiblesCapacity = GHIDRA_CAST(0x0); - } - } - hold_trigger_output_entities(currentRoom); - uVar7 = 0; - do { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x18 + (uVar7 >> 5) * 4)) & - 1 << ((uint8_t)uVar7 & 0x1f)) != 0) { - MakeDoor(currentRoom,uVar7); - } - uVar7 = uVar7 + 1; - } while (GHIDRA_INT(uVar7) < 8); - TrySpawnMegaSatanRoomDoor(currentRoom,0); - TrySpawnSpecialQuestDoor(currentRoom); - if ((g_game->_challenge == 0x1f) && (g_game->_currentRoomIdx == -7)) { - MakeDoor(currentRoom,3); - *GHIDRA_CAST((GHIDRA_INT(currentRoom->_doors[3]) + 0x394)) = g_game->_startingRoomIdx; - GridEntity_Door::SetRoomTypes - (currentRoom->_doors[3],*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x10)) + 8)) - ,1); - } - make_walls(currentRoom); - pGVar21 = g_game; - uVar7 = 0xffffffff; - pGVar20 = GHIDRA_CAST(&DAT_00000005); - currentRoom->_dungeonRockIdx = -1; - placementRng._shift1 = 5; - placementRng._shift2 = 9; - placementRng._seed = pGVar21->_dungeonPlacementSeed; - placementRng._shift3 = 7; - local_540[0] = GHIDRA_CAST(0x0); - do { - if (-1 < GHIDRA_INT(uVar7)) break; - uVar7 = (GHIDRA_CAST((&placementRng)))->RNG::RandomInt(g_game->_nbRooms); - textData = g_game->_roomList[uVar7].Data; - if ((textData != (void *)0x0) && - (((iVar17 = *GHIDRA_CAST((GHIDRA_CAST(textData) + 8)), iVar17 == 5 || (iVar17 == 0xb)) || (iVar17 == 6)))) - { - uVar7 = 0xffffffff; - } - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 1)); - } while (local_540[0] < 3); - if (uVar7 == *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 8))) { - uVar7 = currentRoom->_dungeonRockIdx; - uVar19 = 0; - do { - if (-1 < GHIDRA_INT(uVar7)) break; - uVar7 = (GHIDRA_CAST((&placementRng)))->RNG::RandomInt(currentRoom->_gridHeight * currentRoom->_gridWidth); - currentRoom->_dungeonRockIdx = uVar7; - if (((((0x1bf < uVar7) || (currentRoom->_gridEntities[uVar7] == (void *)0x0)) || - (iVar17 = *GHIDRA_CAST((GHIDRA_INT(currentRoom->_gridEntities[uVar7]) + 4)), iVar17 == 0xf)) || - ((iVar17 == 3 || (iVar17 == 0x16)))) || (iVar17 == 5)) { - currentRoom->_dungeonRockIdx = -1; - uVar7 = 0xffffffff; - } - uVar19 = uVar19 + 1; - } while (uVar19 < 10); - } - if (currentRoom->_roomType == 0x10) { - isPickupListOwned = 0; - pickupListData = GHIDRA_CAST(0x0); - pickupListCapacity = 0; - pickupListSize = 0; - uStack_14 = 3; - queryResult = EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)), - GHIDRA_CAST(collectibleList),5,100,-1,0,0); - isPickupListOwned = 1; - pickupListData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((queryResult)) + 0x4)))); - pickupListCapacity = queryResult->_capacity; - pickupListSize = queryResult->_size; - local_544 = pickupListData; - local_540[0] = GHIDRA_CAST(pickupListSize); - if (collectibleList[0] == '\0') { - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 4; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)collectibleList)) + 0x4))),0); - uStack_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x1))),3); - } - pGVar21 = local_540[0]; - uVar7 = 0; - if (local_540[0] != GHIDRA_CAST(0x0)) { - do { - iVar17 = __RTDynamicCast(local_544->_roomList[0]._doors[uVar7 - 0xc],0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor,0); - uVar7 = uVar7 + 1; - pGVar20 = GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x33c)) + 10.0)); - *GHIDRA_CAST((iVar17 + 0x33c)) = pGVar20; - *GHIDRA_CAST((iVar17 + 0x340)) = *GHIDRA_CAST((iVar17 + 0x340)) + 30.0; - } while (uVar7 < pGVar21); - currentRoom = room; - } - pGStack_54c = GHIDRA_CAST(0x0); - if (0 < currentRoom->_gridHeight * currentRoom->_gridWidth) { - ppvStack_55c = currentRoom->_gridEntities; - do { - pGVar21 = pGStack_54c; - if (*ppvStack_55c == (void *)0x0) { - local_540[0] = GHIDRA_CAST(Random()); - if ((GHIDRA_INT(pGVar21) < 0) || (0x1bf < GHIDRA_INT(pGVar21))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if ((pGVar21 < GHIDRA_CAST(0x1c0)) && (GHIDRA_INT(ppvStack_55c[0x1d2]) < 0x385)) { - gridEntity = Isaac::CreateGridEntity(0x13,GHIDRA_UINT(pGVar21)); - if (gridEntity != GHIDRA_CAST(0x0)) { - if (*ppvStack_55c != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(*ppvStack_55c))(1); - } - *ppvStack_55c = gridEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x14)))) = local_540[0]; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = 0; - gridEntity->_varData = 0; - gridEntity->_collisionClass = 0; - gridEntity->BeginBatches(); - pGVar21 = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) + 1; - (*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x1c))) = 1; - gridEntity->_spawnFrame = pGVar21->_frameCount; - } - pGVar21 = pGStack_54c; - } - } - ppvStack_55c = ppvStack_55c + 1; - pGStack_54c = GHIDRA_CAST((GHIDRA_INT(&pGVar21->_stage) + 1)); - } while (GHIDRA_INT(pGStack_54c) < currentRoom->_gridHeight * currentRoom->_gridWidth); - } - uStack_14 = 0xffffffff; - } - else { - iVar17 = currentRoom->_backdropType; - if (((iVar17 != 0x12) && (iVar17 != 0x10)) && (iVar17 != 0x23)) { - if ((g_game->_stageType == 4) || (g_game->_stageType == 5)) { - iVar17 = g_game->_stage + 1; - } - else { - iVar17 = g_game->_stage; - } - if (((iVar17 != 1) || (g_game->_startingRoomIdx != g_game->_currentRoomIdx)) && - (currentRoom->_gridPaths[currentRoom->_backdropType * 0x4f + 0x58e] != 0)) { - pGVar20 = GHIDRA_CAST(&DAT_00000005); - uStack_5c0 = 0x900000005; - uVar7 = ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))))[0x16] & 0x7fffffffU) + - **GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - pGStack_560 = GHIDRA_CAST(&DAT_00000007); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 5 ^ uVar7; - uVar7 = uVar7 << 9 ^ uVar7; - uVar7 = uVar7 >> 7 ^ uVar7; - local_540[0] = GHIDRA_CAST((uVar7 & 3)); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 5 ^ uVar7; - uVar7 = uVar7 << 9 ^ uVar7; - ppvVar22 = (void **)(uVar7 >> 7 ^ uVar7); - bStack_555 = roomConfig->Width; - pGStack_550 = GHIDRA_CAST((GHIDRA_UINT(ppvVar22) % 5 + GHIDRA_INT(local_540[0]))); - if (0xd < bStack_555 != 7 < roomConfig->Height) { - if (ppvVar22 == (void **)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(ppvVar22) >> 5 ^ GHIDRA_UINT(ppvVar22); - uVar7 = uVar7 << 9 ^ uVar7; - ppvVar22 = (void **)(uVar7 >> 7 ^ uVar7); - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(pGStack_550->_roomList[0]._doors) + (GHIDRA_UINT(ppvVar22) % 9 - 0x30) - )); - } - pGVar21 = pGStack_550; - if ((0xd < bStack_555) && (7 < roomConfig->Height)) { - if (ppvVar22 == (void **)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(ppvVar22) >> 5 ^ GHIDRA_UINT(ppvVar22); - uVar7 = uVar7 << 9 ^ uVar7; - uVar7 = uVar7 >> 7 ^ uVar7; - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(pGStack_550->_roomList[0]._doors) + (uVar7 % 9 - 0x30))); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 5 ^ uVar7; - uVar7 = uVar7 << 9 ^ uVar7; - ppvVar22 = (void **)(uVar7 >> 7 ^ uVar7); - pGVar21 = GHIDRA_CAST((GHIDRA_INT(pGStack_550->_roomList[0]._doors) + (GHIDRA_UINT(ppvVar22) % 0x12 - 0x30))) - ; - ppvStack_55c = ppvVar22; - } - local_544 = GHIDRA_CAST((GHIDRA_INT(pGVar21) * 2)); - pGStack_54c = GHIDRA_CAST(0x0); - if (pGVar21 != GHIDRA_CAST(0x0)) { - do { - if (ppvVar22 == (void **)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(ppvVar22) >> ((uint8_t)uStack_5c0 & 0x1f) ^ GHIDRA_UINT(ppvVar22); - uVar7 = uVar7 << ((uint8_t)((uint64_t)uStack_5c0 >> 0x20) & 0x1f) ^ uVar7; - ppvVar22 = (void **)(uVar7 >> ((uint8_t)pGStack_560 & 0x1f) ^ uVar7); - ppvStack_55c = ppvVar22; - pGStack_550 = GHIDRA_CAST(GetRandomTileIndex(currentRoom,GHIDRA_UINT(ppvVar22))); - if (currentRoom->_gridEntities[GHIDRA_INT(pGStack_550)] == (void *)0x0) { - local_540[0] = GHIDRA_CAST(Random()); - if ((GHIDRA_INT(pGStack_550) < 0) || (0x1bf < GHIDRA_INT(pGStack_550))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if ((pGStack_550 < GHIDRA_CAST(0x1c0)) && - (currentRoom->_gridPaths[GHIDRA_INT(pGStack_550)] < 0x385)) { - gridEntity = Isaac::CreateGridEntity(1,GHIDRA_UINT(pGStack_550)); - if (gridEntity != GHIDRA_CAST(0x0)) { - if (currentRoom->_gridEntities[GHIDRA_INT(pGStack_550)] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(currentRoom->_gridEntities[GHIDRA_INT(pGStack_550)]))(1); - } - currentRoom->_gridEntities[GHIDRA_INT(pGStack_550)] = gridEntity; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x14)))) = local_540[0]; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x8)))) = 0; - gridEntity->_varData = 0; - gridEntity->_collisionClass = 0; - gridEntity->BeginBatches(); - pGVar21 = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x10)))) + 1; - (*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0x1c))) = 1; - gridEntity->_spawnFrame = pGVar21->_frameCount; - } - ppvVar22 = ppvStack_55c; - } - pGStack_54c = GHIDRA_CAST((GHIDRA_INT(&pGStack_54c->_stage) + 1)); - } - pGStack_54c = GHIDRA_CAST((GHIDRA_INT(&pGStack_54c->_stage) + 1)); - } while (pGStack_54c < local_544); - } - } - } - } - if (((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) && (roomConfig->Type == 1)) { - pGVar20 = GHIDRA_CAST(&DAT_00000005); - greedRngShifts = 0x900000005; - local_544 = GHIDRA_CAST(&DAT_00000007); - iVar17 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)) / 2; - if (((iVar17 < 0) || (currentRoom->_gridWidth <= iVar17)) || (currentRoom->_gridHeight < 5)) { - local_540[0] = GHIDRA_CAST(0xffffffff); - } - else { - local_540[0] = GHIDRA_CAST((iVar17 + currentRoom->_gridWidth * 4)); - } - pGStack_54c = GHIDRA_CAST(0x0); - pGVar21 = GHIDRA_CAST(((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x58)) & 0x7fffffff) + - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 8)))); - while( true ) { - if (pGVar21 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(pGVar21) >> ((uint8_t)greedRngShifts & 0x1f) ^ GHIDRA_UINT(pGVar21); - uVar7 = uVar7 << ((uint8_t)((uint64_t)greedRngShifts >> 0x20) & 0x1f) ^ uVar7; - pGStack_550 = GHIDRA_CAST((uVar7 >> ((uint8_t)local_544 & 0x1f) ^ uVar7)); - if (GHIDRA_INT((GHIDRA_UINT(pGStack_550) % 5 + 3)) <= GHIDRA_INT(pGStack_54c)) break; - VStack_574.x = (float)(GHIDRA_INT(local_540[0]) % currentRoom->_gridWidth) * 40.0 + 40.0; - VStack_574.y = (float)(GHIDRA_INT(local_540[0]) / currentRoom->_gridWidth) * 40.0 + 120.0; - FindFreePickupSpawnPosition(currentRoom,&freePickupPos,&VStack_574,0.0,0,0,0); - iVar8 = GHIDRA_INT(((freePickupPos.x - 40.0) / 40.0 + 0.5)); - pGVar20 = GHIDRA_CAST(((freePickupPos.y - 120.0) / 40.0 + 0.5)); - iVar17 = GHIDRA_INT((float)pGVar20); - if (((iVar8 < 0) || (currentRoom->_gridWidth <= iVar8)) || - ((iVar17 < 0 || (currentRoom->_gridHeight <= iVar17)))) { - uVar7 = 0xffffffff; - } - else { - uVar7 = currentRoom->_gridWidth * iVar17 + iVar8; - } - if (currentRoom->_gridEntities[uVar7] == (void *)0x0) { - if (pGStack_550 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar19 = GHIDRA_UINT(pGStack_550) >> ((uint8_t)greedRngShifts & 0x1f) ^ GHIDRA_UINT(pGStack_550); - uVar19 = uVar19 << ((uint8_t)((uint64_t)greedRngShifts >> 0x20) & 0x1f) ^ uVar19; - pGStack_550 = GHIDRA_CAST((uVar19 >> ((uint8_t)local_544 & 0x1f) ^ uVar19)); - if ((GHIDRA_INT(uVar7) < 0) || (0x1bf < GHIDRA_INT(uVar7))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if (((uVar7 < 0x1c0) && (currentRoom->_gridPaths[uVar7] < 0x385)) && - (pGStack_554 = GHIDRA_CAST(Isaac)::CreateGridEntity(1,uVar7), pGStack_554 != GHIDRA_CAST(0x0))) { - if (currentRoom->_gridEntities[uVar7] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(currentRoom->_gridEntities[uVar7]))(1); - } - currentRoom->_gridEntities[uVar7] = pGStack_554; - pGStack_554->_roomList[0].GridIndex = GHIDRA_INT(pGStack_550); - textData = (GHIDRA_CAST(&pGStack_554->_stage))->_begin; - *(void **)&pGStack_554->_bossChallenge = (void *)0xa; - pGStack_554->_roomList[0].SafeGridIndex = 0; - pGStack_554->_roomList[0]._doors[3] = 0; - (**(code **)(GHIDRA_CAST(textData) + 0x20))(); - pGVar21 = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGStack_554)) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGStack_554)) + 0x10)))) + 1; - *GHIDRA_CAST(&pGStack_554->_roomList[0].ListIndex) = 1; - pGStack_554->_roomList[0].OverrideData = (void *)pGVar21->_frameCount; - } - currentRoom->_gridPaths[uVar7] = 900; - } - pGStack_54c = GHIDRA_CAST((GHIDRA_INT(&pGStack_54c->_stage) + 1)); - pGVar21 = pGStack_550; - } - } - local_540[0] = GHIDRA_CAST(0x0); - if (0 < currentRoom->_gridHeight * currentRoom->_gridWidth) { - ppvVar22 = currentRoom->_gridEntities; - do { - if (*ppvVar22 != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*ppvVar22) + 4))(); - } - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 1)); - ppvVar22 = ppvVar22 + 1; - } while (GHIDRA_INT(local_540[0]) < currentRoom->_gridHeight * currentRoom->_gridWidth); - } - attach_minecarts(); - if ((isHasHeretic != '\0') || (isHasRaglich != '\0')) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c82660) && - (_Init_thread_header(&DAT_00c82660), DAT_00c82660 == -1)) { - _atexit(FUN_00b16540); - _Init_thread_footer(&DAT_00c82660); - } - uVar7 = 0; - _DAT_00c82668 = DAT_00c82664; - if ((currentRoom->_entityList)._updateEL._size != 0) { - do { - iVar17 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((currentRoom->_entityList)._updateEL)) + 0x4)))) + uVar7 * 4)); - if ((*GHIDRA_CAST((iVar17 + 0x28)) == 0x21) && (*GHIDRA_CAST((iVar17 + 0x2c)) == 3)) { - uVar11 = 0x397; - *GHIDRA_CAST((iVar17 + 0x380)) = 0x3f800000; - if (isHasHeretic != '\0') { - uVar11 = 0x389; - } - *GHIDRA_CAST((iVar17 + 0x38)) = 0; - *GHIDRA_CAST((iVar17 + 0x16c)) = *GHIDRA_CAST((iVar17 + 0x16c)) | 0x400; - *GHIDRA_CAST((iVar17 + 0x34)) = uVar11; - *GHIDRA_CAST((iVar17 + 0x168)) = *GHIDRA_CAST((iVar17 + 0x168)); - } - uVar7 = uVar7 + 1; - } while (uVar7 < GHIDRA_UINT((currentRoom->_entityList)._updateEL._size)); - } - } - RestoreState(currentRoom); - puVar23 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x88)); - if (puVar23 != *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x8c))) { - do { - spawned = Game::Spawn(g_game,*puVar23,puVar23[1],GHIDRA_CAST((puVar23 + 10)),&g_vectorZero, - GHIDRA_CAST(0x0),puVar23[2],puVar23[0xd]); - pGVar20 = GHIDRA_CAST(((float)puVar23[3] * g_vectorOne.x)); - iVar17 = *GHIDRA_CAST(spawned); - (spawned->_sprite)._scale.y = (float)puVar23[3] * g_vectorOne.y; - (spawned->_sprite)._scale.x = (float)pGVar20; - (**(code **)(iVar17 + 0xc))(); - puVar23 = puVar23 + 0x1e; - } while (puVar23 != *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x8c))); - } - local_540[0] = GHIDRA_CAST(0x0); - pGStack_54c = GHIDRA_CAST(0x18378); - do { - pGVar21 = local_540[0]; - local_544 = g_game; - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game), - *GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST(&(pGStack_54c[-1])) + 0x68d68))) + - GHIDRA_INT((g_game->_roomList[0]._doors + -7)))),-1); - if (roomDesc == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4))))) { - uVar7 = Random(); - pGVar21 = local_540[0]; - iVar17 = *GHIDRA_CAST((GHIDRA_INT(local_544->_roomList[0]._doors) + GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGStack_54c[-1])) + 0x68d50)))))); - effect82Pos.x = (float)(iVar17 % currentRoom->_gridWidth) * 40.0 + 40.0; - pGVar20 = GHIDRA_CAST(((float)(iVar17 / currentRoom->_gridWidth) * 40.0 + 120.0)); - effect82Pos.y = (float)pGVar20; - Game::Spawn(g_game,1000,0x52,&effect82Pos,&g_vectorZero,GHIDRA_CAST(0x0),GHIDRA_UINT(local_540[0]),uVar7 - ); - } - local_540[0] = GHIDRA_CAST((GHIDRA_INT(pGVar21) + 1)); - pGStack_54c = GHIDRA_CAST(&pGStack_54c->_curses); - } while (GHIDRA_INT(pGStack_54c) < 0x18390); - if ((*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1))) != '\0') { - pGVar21 = g_game; - if ((g_game->_currentRoomIdx == g_game->_startingRoomIdx) && (g_game->_stage != 0xd)) { - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x294,GHIDRA_CAST(&g_game->_playerManager),1); - if ((player != GHIDRA_CAST(0x0)) && - ((g_game->_difficulty != 2 && (g_game->_difficulty != 3)))) { - cStack_545 = '\0'; - FUN_00737c10(0x1f,&cStack_545,extraout_ECX_00); - pGVar21 = g_game; - uStack_14 = 6; - local_540[0] = GHIDRA_CAST(0x0); - if (0 < g_game->_nbRooms) { - local_544 = GHIDRA_CAST(&g_game->_roomList[0].Group); - do { - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_544[-1])) + 0x68cd8)))) != 0) && (local_544->_stage < 0)) { - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_544[-1])) + 0x68cd8)))) + 8)); - roomTypeBits[0][uVar7 >> 5] = roomTypeBits[0][uVar7 >> 5] | 1 << ((uint8_t)uVar7 & 0x1f); - } - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 1)); - local_544 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_544->_roomList[0])) + 0xa4)))); - } while (GHIDRA_INT(local_540[0]) < pGVar21->_nbRooms); - currentRoom = room; - } - local_540[0] = GHIDRA_CAST(*roomTypeBits[0]); - if ((GHIDRA_UINT(local_540[0]) & 0x10) != 0) { - portalTypes[0] = 0; - } - pGStack_550 = GHIDRA_CAST(GHIDRA_UINT(((GHIDRA_UINT(local_540[0]) & 0x10) != 0))); - if ((GHIDRA_UINT(local_540[0]) & 0x20) != 0) { - portalTypes[GHIDRA_INT(pGStack_550)] = 1; - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(&pGStack_550->_stage) + 1)); - } - if ((char)local_540[0] < '\0') { - portalTypes[GHIDRA_INT(pGStack_550)] = 2; - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(&pGStack_550->_stage) + 1)); - } - if ((GHIDRA_UINT(local_540[0]) & 4) != 0) { - portalTypes[GHIDRA_INT(pGStack_550)] = 3; - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(&pGStack_550->_stage) + 1)); - } - if (pGStack_550 != GHIDRA_CAST(0x0)) { - iVar17 = 0; - decorationRng._shift1 = 9; - decorationRng._shift2 = 5; - decorationRng._seed = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x58)); - ppvStack_55c = (void **)0x19; - decorationRng._shift3 = 0x19; - pGStack_560 = GHIDRA_CAST(decorationRng._seed); - if (0 < GHIDRA_INT((GHIDRA_INT(&pGStack_550[-1]._console) + 3))) { - pGVar20 = pGStack_550 + -1; - do { - uVar19 = (GHIDRA_CAST((&decorationRng)))->RNG::RandomInt(GHIDRA_INT(pGStack_550) - iVar17); - uVar7 = portalTypes[iVar17]; - iVar8 = uVar19 + iVar17; - portalTypes[iVar17] = portalTypes[iVar8]; - iVar17 = iVar17 + 1; - portalTypes[iVar8] = uVar7; - } while (iVar17 < GHIDRA_INT((GHIDRA_INT(&pGVar20->_console) + 3))); - ppvStack_55c = (void **)decorationRng._shift3; - pGStack_560 = GHIDRA_CAST(decorationRng._seed); - currentRoom = room; - } - pGStack_54c = GHIDRA_CAST(currentRoom->_gridWidth); - pGStack_554 = GHIDRA_CAST((GHIDRA_INT(pGStack_54c) / 2)); - VStack_574.y = (float)(currentRoom->_gridHeight / 2 + -1); - decorationRng._seed = GHIDRA_INT(pGStack_560); - decorationRng._shift3 = GHIDRA_INT(ppvStack_55c); - if (pGStack_550 < GHIDRA_CAST(0x3)) { - if (pGStack_560 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pGStack_54c = GHIDRA_CAST(currentRoom->_gridWidth); - if (pGStack_560 == GHIDRA_CAST(0x0)) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - uVar7 = GHIDRA_UINT(pGStack_560) >> ((uint8_t)decorationRng._shift1 & 0x1f) ^ GHIDRA_UINT(pGStack_560); - uVar7 = uVar7 << ((uint8_t)decorationRng._shift2 & 0x1f) ^ uVar7; - local_540[0] = GHIDRA_CAST((uVar7 >> ((uint8_t)ppvStack_55c & 0x1f) ^ uVar7)); - puVar12 = (uint8_t *) - (GHIDRA_INT(&((GHIDRA_CAST((GHIDRA_INT(VStack_574.y) + -0x38)))->_edenHair)._capacity) + - 3); - if ((((GHIDRA_INT(pGStack_554) < 0) || (GHIDRA_INT(pGStack_54c) <= GHIDRA_INT(pGStack_554))) || - (GHIDRA_INT(puVar12) < 0)) || (currentRoom->_gridHeight <= GHIDRA_INT(puVar12))) { - iVar17 = -1; - } - else { - iVar17 = GHIDRA_INT(pGStack_554->_roomList[0]._doors) + - GHIDRA_INT(puVar12) * GHIDRA_INT(pGStack_54c) + -0x30; - } - spawnPos = &secondPortalPos; - secondPortalPos.x = (float)(iVar17 % GHIDRA_INT(pGStack_54c)) * 40.0 + 40.0; - pGVar20 = GHIDRA_CAST(((float)(iVar17 / GHIDRA_INT(pGStack_54c)) * 40.0 + 120.0)); - portalTypes[1] = portalTypes[0]; - secondPortalPos.y = (float)pGVar20; - } - else { - if (pGStack_560 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pGStack_54c = GHIDRA_CAST(currentRoom->_gridWidth); - if (pGStack_560 == GHIDRA_CAST(0x0)) { - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - } - fVar25 = VStack_574.y; - uVar7 = GHIDRA_UINT(pGStack_560) >> ((uint8_t)decorationRng._shift1 & 0x1f) ^ GHIDRA_UINT(pGStack_560); - uVar7 = uVar7 << ((uint8_t)decorationRng._shift2 & 0x1f) ^ uVar7; - fStack_58c = (float)(uVar7 >> ((uint8_t)ppvStack_55c & 0x1f) ^ uVar7); - puVar12 = GHIDRA_CAST((GHIDRA_INT(&pGStack_554[-1]._console) + 2)); - if (((GHIDRA_INT(puVar12) < 0) || (GHIDRA_INT(pGStack_54c) <= GHIDRA_INT(puVar12))) || - ((GHIDRA_INT(VStack_574.y) < 0 || (currentRoom->_gridHeight <= GHIDRA_INT(VStack_574.y))))) { - puVar12 = GHIDRA_CAST(0xffffffff); - } - else { - puVar12 = puVar12 + GHIDRA_INT(VStack_574.y) * GHIDRA_INT(pGStack_54c); - } - firstPortalPos.x = (float)(GHIDRA_INT(puVar12) % GHIDRA_INT(pGStack_54c)) * 40.0 + 40.0; - firstPortalPos.y = (float)(GHIDRA_INT(puVar12) / GHIDRA_INT(pGStack_54c)) * 40.0 + 120.0; - Game::Spawn(g_game,1000,0xa1,&firstPortalPos,&g_vectorZero,GHIDRA_CAST(0x0),portalTypes[0], - GHIDRA_UINT(fStack_58c)); - if (fStack_58c == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(fStack_58c) >> ((uint8_t)decorationRng._shift1 & 0x1f) ^ GHIDRA_UINT(fStack_58c); - uVar7 = uVar7 << ((uint8_t)decorationRng._shift2 & 0x1f) ^ uVar7; - local_540[0] = GHIDRA_CAST((uVar7 >> ((uint8_t)ppvStack_55c & 0x1f) ^ uVar7)); - puVar12 = GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(&pGStack_554->_stage))->_begin) + 2)); - if (((GHIDRA_INT(puVar12) < 0) || (iVar17 = currentRoom->_gridWidth, iVar17 <= GHIDRA_INT(puVar12))) - || ((GHIDRA_INT(fVar25) < 0 || (currentRoom->_gridHeight <= GHIDRA_INT(fVar25))))) { - iVar17 = currentRoom->_gridWidth; - puVar12 = GHIDRA_CAST(0xffffffff); - } - else { - puVar12 = puVar12 + GHIDRA_INT(fVar25) * iVar17; - } - spawnPos = &secondPortalPosAlt; - secondPortalPosAlt.x = (float)(GHIDRA_INT(puVar12) % iVar17) * 40.0 + 40.0; - pGVar20 = GHIDRA_CAST(((float)(GHIDRA_INT(puVar12) / iVar17) * 40.0 + 120.0)); - secondPortalPosAlt.y = (float)pGVar20; - } - Game::Spawn(g_game,1000,0xa1,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),portalTypes[1], - GHIDRA_UINT(local_540[0])); - } - uStack_14 = 0xffffffff; - FID_conflict__Tidy(roomTypeBits); - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x24a,GHIDRA_CAST(&g_game->_playerManager),1); - if (player != GHIDRA_CAST(0x0)) { - uVar7 = Random(); - iVar17 = currentRoom->_gridWidth; - if ((iVar17 < 0xb) || (currentRoom->_gridHeight < 2)) { - iVar8 = -1; - } - else { - iVar8 = iVar17 + 10; - } - effect156Pos.x = (float)(iVar8 % iVar17) * 40.0 + 40.0; - effect156Pos.y = (float)(iVar8 / iVar17) * 40.0 + 120.0; - spawned = Game::Spawn(g_game,1000,0x9c,&effect156Pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); - Game::GetPlayer(g_game,0); - (GHIDRA_CAST((firstPlayer)))->Entity_Player::GetEnterPosition(&enterPos); - iVar8 = GHIDRA_INT(((*extraout_EAX - 40.0) / 40.0 + 0.5)); - iVar17 = GHIDRA_INT(((extraout_EAX[1] - 120.0) / 40.0 + 0.5)); - if ((((iVar8 < 0) || (currentRoom->_gridWidth <= iVar8)) || (iVar17 < 0)) || - (currentRoom->_gridHeight <= iVar17)) { - uVar7 = 0xffffffff; - } - else { - uVar7 = iVar17 * currentRoom->_gridWidth + iVar8; - } - pGVar20 = GHIDRA_CAST((((spawned->_pos).x - 40.0) / 40.0 + 0.5)); - iVar8 = GHIDRA_INT((float)pGVar20); - iVar17 = GHIDRA_INT((((spawned->_pos).y - 120.0) / 40.0 + 0.5)); - if (((iVar8 < 0) || (currentRoom->_gridWidth <= iVar8)) || - ((iVar17 < 0 || (currentRoom->_gridHeight <= iVar17)))) { - uVar19 = 0xffffffff; - } - else { - uVar19 = iVar17 * currentRoom->_gridWidth + iVar8; - } - is_obstacle_path_valid(currentRoom,uVar7,uVar19,7); - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x2bd,GHIDRA_CAST(&g_game->_playerManager),1); - if (player != GHIDRA_CAST(0x0)) { - isaacsTombRngShifts = 0x1500000009; - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x58)); - local_540[0] = GHIDRA_CAST(0x10); - spawnPos = GetCenterPos(&isaacsTombCenter); - oldChestPos.x = spawnPos->x + 0.0; - pGVar20 = GHIDRA_CAST((spawnPos->y - 40.0)); - oldChestPos.y = (float)pGVar20; - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> ((uint8_t)isaacsTombRngShifts & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)((uint64_t)isaacsTombRngShifts >> 0x20) & 0x1f) ^ uVar7; - Game::Spawn(g_game,5,0x37,&oldChestPos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar7 >> ((uint8_t)local_540[0] & 0x1f) ^ uVar7); - } - pGVar21 = g_game; - bVar5 = Seeds::HasSeedEffect(&g_game->_seedEffects,0x4f); - if (bVar5 != 0) { - seedItemRngShifts = 0x1500000009; - local_540[0] = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x58)); - local_544 = GHIDRA_CAST(0x10); - spawnPos = GetCenterPos(&seedItemCenter); - seedItemPos.x = spawnPos->x + 0.0; - pGVar20 = GHIDRA_CAST((spawnPos->y - 40.0)); - uVar7 = pGVar21->_debugCurses; - uVar19 = g_game->_curses; - seedItemPos.y = (float)pGVar20; - uVar13 = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - bVar15 = (uint8_t)local_544; - bVar5 = (uint8_t)((uint64_t)seedItemRngShifts >> 0x20); - if ((~preventedCurses & (uVar13 | uVar7 | uVar19) & 2) == 0) { - if (local_540[0] == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = GHIDRA_UINT(local_540[0]) >> ((uint8_t)seedItemRngShifts & 0x1f) ^ GHIDRA_UINT(local_540[0]); - uVar7 = uVar7 << (bVar5 & 0x1f) ^ uVar7; - uVar7 = uVar7 >> (bVar15 & 0x1f) ^ uVar7; - spawnPos = &seedItemPos; - } - else { - if (local_540[0] == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - collectiblePos.x = seedItemPos.x - -40.0; - collectiblePos.y = seedItemPos.y - 0.0; - uVar7 = GHIDRA_UINT(local_540[0]) >> ((uint8_t)seedItemRngShifts & 0x1f) ^ GHIDRA_UINT(local_540[0]); - uVar7 = uVar7 << (bVar5 & 0x1f) ^ uVar7; - uVar7 = uVar7 >> (bVar15 & 0x1f) ^ uVar7; - Game::Spawn(g_game,5,100,&collectiblePos,&g_vectorZero,GHIDRA_CAST(0x0),0xffffffff,uVar7); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - leftItemPos.x = seedItemPos.x - 40.0; - pGVar20 = GHIDRA_CAST((seedItemPos.y + 0.0)); - uVar7 = uVar7 >> ((uint8_t)seedItemRngShifts & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)((uint64_t)seedItemRngShifts >> 0x20) & 0x1f) ^ uVar7; - uVar7 = uVar7 >> (bVar15 & 0x1f) ^ uVar7; - spawnPos = &leftItemPos; - leftItemPos.y = (float)pGVar20; - } - Game::Spawn(g_game,5,100,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0xffffffff,uVar7); - pGVar21 = g_game; - currentRoom = room; - } - } - if ((((*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1))) != '\0') && - ((currentRoom->_roomType == 7 || (currentRoom->_roomType == 8)))) && - (player = PlayerManager::FirstCollectibleOwner - (&pGVar21->_playerManager,0x24d,GHIDRA_CAST(&pGVar21->_playerManager),1), - player != GHIDRA_CAST(0x0))) { - pGVar20 = GHIDRA_CAST(&DAT_00000009); - lunaRngShifts = 0xb00000009; - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x58)); - local_540[0] = GHIDRA_CAST(0x13); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> 9 ^ uVar7; - uVar7 = uVar7 << 0xb ^ uVar7; - spawnPos = GetCenterPos(&lunaCenter); - Game::Spawn(g_game,1000,0x27,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7 >> 0x13 ^ uVar7); - } - } - if (((currentRoom->_roomType == 0xe) && - (player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x2b4,GHIDRA_CAST(&g_game->_playerManager),1), - player != GHIDRA_CAST(0x0))) && ((*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1))) != '\0')) { - spawn_sanguine_bond_spikes(currentRoom,1); - } - if (((g_game->_stage == 1) && ((g_game->_levelStateFlags & 0x10000U) != 0)) && - ((g_game->_currentRoomIdx == g_game->_startingRoomIdx && - ((*GHIDRA_CAST((GHIDRA_INT((g_game->_itemPool)._removedCollectibles._begin) + 0x44)) & 0x40) == 0)))) { - uVar7 = Random(); - spawnPos = GetCenterPos(&startRoomCenter); - Game::Spawn(g_game,1000,0x73,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - pGVar14 = g_game; - pGVar21 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - if (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar21)) + 0x10)))) + 8)) == 0xe) { - FUN_004d72b0(6,1); - pGVar21 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - } - pGStack_550 = pGVar21; - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar21)) + 0x10)))) + 8)) == 4) && (pGVar21->_roomList[0]._doors[4] == 0)) - && ((GHIDRA_CAST(&pGVar21->_curses))->_controllerIndex == 0)) { - piVar18 = &pGVar14->_treasureRoomsVisited; - *piVar18 = *piVar18 + 1; - pGStack_550 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - } - VStack_574.y = (float)pGStack_550; - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGStack_550)) + 0x10)))) + 8)) == 0x18) && - (pGStack_554 = pGStack_550, pGStack_550->_roomList[0]._doors[4] == 0)) && - ((GHIDRA_CAST(&pGStack_550->_curses))->_controllerIndex == 0)) { - piVar18 = &pGVar14->_planetariumsVisited; - *piVar18 = *piVar18 + 1; - VStack_574.y = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - } - local_540[0] = pGStack_550; - if ((((GHIDRA_CAST(VStack_574.y))->_roomList[0]._doors[4] == 0) && (currentRoom->_roomType == 0x10)) && - (pGStack_554 = GHIDRA_CAST(0x1), 1 < currentRoom->_gridHeight)) { - do { - iVar17 = currentRoom->_gridWidth; - local_544 = GHIDRA_CAST(0x1); - pGVar21 = pGStack_554; - if (1 < iVar17) { - do { - if (((-1 < GHIDRA_INT(local_544)) && (GHIDRA_INT(local_544) < iVar17)) && - ((-1 < GHIDRA_INT(pGVar21) && (GHIDRA_INT(pGVar21) < currentRoom->_gridHeight)))) { - iVar17 = iVar17 * GHIDRA_INT(pGVar21); - roomDesc = local_544->_roomList; - uVar7 = GHIDRA_INT(roomDesc->_doors) + iVar17 + -0x30; - if (uVar7 < 0x1c0) { - if ((currentRoom->_gridEntities[GHIDRA_INT(roomDesc->_doors) + iVar17 + -0x30] != (void *)0x0 - ) && ((iVar8 = *GHIDRA_CAST((GHIDRA_INT(currentRoom->_gridEntities) - [GHIDRA_INT(roomDesc->_doors) + iVar17 + -0x30] + 4)), - iVar8 == 3 || (iVar8 == 0x18)))) { - if ((-1 < GHIDRA_INT(uVar7)) && (GHIDRA_INT(uVar7) < 0x1c0)) { - textData = currentRoom->_gridEntities[GHIDRA_INT(roomDesc->_doors) + iVar17 + -0x30]; - currentRoom->_gridEntities[GHIDRA_INT(roomDesc[2]._doors) + iVar17 + 0x32] = (void *)0x0; - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(textData) + 4)); - } - local_540[0] = GHIDRA_CAST(GHIDRA_UINT((iVar8 == 0x18))); - if (((((iVar8 == 0x18) && - (pGStack_54c = GHIDRA_CAST((GHIDRA_INT(&local_544[-1]._console) + 3)), - -1 < GHIDRA_INT(pGStack_54c))) && (GHIDRA_INT(pGStack_54c) < currentRoom->_gridWidth)) && - ((GHIDRA_INT(pGStack_554) < currentRoom->_gridHeight && - (piVar18 = GHIDRA_CAST((GHIDRA_INT(&pGStack_54c->_stage) + - currentRoom->_gridWidth * GHIDRA_INT(pGStack_554))), - -1 < GHIDRA_INT(piVar18))))) && - ((textData = currentRoom->_gridEntities[GHIDRA_INT(piVar18)], textData != (void *)0x0 && - ((*GHIDRA_CAST((GHIDRA_CAST(textData) + 4)) == 0xf && (*GHIDRA_CAST((GHIDRA_CAST(textData) + 8)) == 1)))))) - { - local_540[0] = GHIDRA_CAST(0x2); - } - iVar8 = 0; - uVar19 = Random(); - SpawnGridEntity(currentRoom,uVar7,0xf,GHIDRA_UINT(local_540[0]),uVar19,iVar8); - (**(code **)(*GHIDRA_CAST(currentRoom->_gridEntities) - [GHIDRA_INT(roomDesc->_doors) + iVar17 + -0x30] + 4))(); - pGVar21 = pGStack_554; - } - } - } - iVar17 = currentRoom->_gridWidth; - local_544 = GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(&local_544->_stage))->_begin) + 1)); - } while (GHIDRA_INT(local_544) < iVar17); - } - pGStack_554 = GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(&pGVar21->_stage))->_begin) + 1)); - } while (GHIDRA_INT(pGStack_554) < currentRoom->_gridHeight); - VStack_574.y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - } - pGVar21 = g_game; - if ((0 < g_game->_stage) && (g_game->_stage < 7)) { - bVar5 = Game::GetStateFlag(g_game,0x30); - if (bVar5 == 0) goto LAB_007f58b8; - goto LAB_007f5974; - } -LAB_007f58b8: - iVar17 = currentRoom->_bossId; - if ((iVar17 == 6) || (iVar17 == 0x59)) { - if ((pGVar21->_challenge == 0x1f) && - (pGVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))), (pGVar14->_roomList[0]._doors[5] & 1) != 0)) - goto LAB_007f58e2; -LAB_007f5944: - iVar17 = 0; - do { - RemoveDoor(g_game->_room,iVar17); - iVar17 = iVar17 + 1; - } while (iVar17 < 8); - pGVar21 = g_game; - currentRoom = room; - } - else { - pGVar14 = GHIDRA_CAST(VStack_574.y); -LAB_007f58e2: - if (iVar17 == 0x37) { - if (pGVar21->_challenge == 0x1f) goto LAB_007f58f7; - goto LAB_007f5944; - } - if (iVar17 == 0x3e) goto LAB_007f5944; -LAB_007f58f7: - if ((currentRoom->_roomType == 5) && (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar14)) + 0x10)))) + 0x10)) == 0x59)) { - bVar5 = Level::IsPreAscent(GHIDRA_CAST(pGVar21)); - if (bVar5 != 0) goto LAB_007f5944; - pGVar21 = g_game; - } - bVar5 = Game::IsInTimedSet(pGVar21,0x47); - if (bVar5 != 0) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(pGVar21),pGVar21->_currentRoomIdx,-1); - pGVar21 = g_game; - if (roomDesc->ListIndex == g_game->_lastBossRoomListIdx) goto LAB_007f5944; - } - } -LAB_007f5974: - local_540[0] = GHIDRA_CAST(pGVar21->_stageType); - iVar17 = pGVar21->_stage; - if ((pGVar21->_difficulty == 2) || (pGStack_560 = GHIDRA_CAST(iVar17), pGVar21->_difficulty == 3)) { - if (iVar17 < 5) { - iVar17 = iVar17 * 2 + -1; - pGStack_560 = GHIDRA_CAST(iVar17); - } - else { - pGStack_560 = GHIDRA_CAST(0x0); - if (iVar17 == 5) { - pGStack_560 = GHIDRA_CAST(0xa); - } - } - } - pGStack_54c = GHIDRA_CAST(Game)::GetStageID(pGVar21,(uint8_t)iVar17); - currentRoom->_brokenWatchState = 0; - *GHIDRA_CAST(currentRoom) = 1; - if (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x40)) == 0) { - iVar17 = roomConfig->Type; - if (iVar17 != 5) { - if (iVar17 == 9) { - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,9,1); - } - else { - if (((iVar17 == 0x12) || (iVar17 == 0x13)) && (g_game->_currentRoomIdx != -0xc)) { - pGVar20 = GHIDRA_CAST(Random()); - spawnPos = GetCenterPos(&carpetCenter); - uVar7 = 0; - uVar19 = 0x4a; - } - else { - if (iVar17 != 0x15) goto LAB_007f5b02; - uVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x5c)); - diceFloorRngShifts = 0x900000005; - local_544 = GHIDRA_CAST(&DAT_00000007); - pGStack_554 = GHIDRA_CAST(Random()); - if (uVar7 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar7 = uVar7 >> ((uint8_t)diceFloorRngShifts & 0x1f) ^ uVar7; - uVar7 = uVar7 << ((uint8_t)((uint64_t)diceFloorRngShifts >> 0x20) & 0x1f) ^ uVar7; - uVar7 = (uVar7 >> ((uint8_t)local_544 & 0x1f) ^ uVar7) % 6; - spawnPos = GetCenterPos(&diceFloorCenter); - uVar19 = 0x4c; - pGVar20 = pGStack_554; - } - spawned = Game::Spawn(g_game,1000,uVar19,spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),uVar7, - GHIDRA_UINT(pGVar20)); - spawned->Update(); - } - } -LAB_007f5b02: - pGVar20 = GHIDRA_CAST(&DAT_00000005); - ambientRng._shift1 = 5; - ambientRng._shift2 = 9; - ambientRng._seed = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x5c)); - local_544 = GHIDRA_CAST(&DAT_00000007); - ambientRng._shift3 = 7; - if (currentRoom->_backdropType == 0x23) { - if (ambientRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - ambientRng._seed = GHIDRA_UINT(ambientRng._seed) >> 5 ^ ambientRng._seed; - ambientRng._seed = ambientRng._seed << 9 ^ ambientRng._seed; - ambientRng._seed = GHIDRA_UINT(ambientRng._seed) >> 7 ^ ambientRng._seed; - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(GHIDRA_UINT(ambientRng._seed) % 0x32 + 1); - if (0 < GHIDRA_INT(uVar7)) { - do { - uVar19 = Random(); - local_544 = GHIDRA_CAST((((currentRoom->_bottomRightPos).y - (currentRoom->_topLeftPos).y) * - (float)((double)GHIDRA_INT(uVar19) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).y)); - uVar19 = Random(); - effect65Pos.x = - ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).x; - effect65Pos.y = (float)local_544; - pGVar20 = local_544; - uVar19 = Random(); - spawned = Game::Spawn(g_game,1000,0x41,&effect65Pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar19); - spawned->Update(); - uVar7 = uVar7 - 1; - } while (uVar7 != 0); - } - } - else { - if (ambientRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - ambientRng._seed = GHIDRA_UINT(ambientRng._seed) >> 5 ^ ambientRng._seed; - ambientRng._seed = ambientRng._seed << 9 ^ ambientRng._seed; - ambientRng._seed = GHIDRA_UINT(ambientRng._seed) >> 7 ^ ambientRng._seed; - if ((((ambientRng._seed & 1U) != 0) && (pGStack_54c != GHIDRA_CAST(0xd))) && - (currentRoom->_roomType != 8)) { - uVar7 = g_game->_debugCurses; - uVar19 = g_game->_curses; - uVar13 = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - currentRoom = room; - if (((((~preventedCurses & (uVar13 | uVar7 | uVar19) & 1) == 0) || - ((room->_roomType != 5 && (room->_roomType != 6)))) && (pGStack_54c != GHIDRA_CAST(0x1c))) - && ((bVar5 = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)), bVar5 == 0 || - (g_game->_currentDimensionIdx != 1)))) goto LAB_007f68b5; - } - if ((currentRoom->_bossId != 0x37) && (currentRoom->_roomType != 0x10)) { - iVar17 = 0; - fStack_58c = 0.0; - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x94,GHIDRA_CAST(&g_game->_playerManager),1); - if ((((player != GHIDRA_CAST(0x0)) || - (player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xea,GHIDRA_CAST(&g_game->_playerManager),1), - player != GHIDRA_CAST(0x0))) || (currentRoom->_roomType == 8)) || - ((bVar5 = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)), bVar5 != 0 && - (g_game->_currentDimensionIdx == 1)))) { - iVar17 = 1; - fStack_58c = 1.4013e-45; - } - local_544 = GHIDRA_CAST(((iVar17 + 1) * 0xf)); - ppvStack_55c = (void **)GHIDRA_UINT((**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) == g_game->_startingRoomIdx - )); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(GHIDRA_UINT(local_544)); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7 + 1); - VStack_574.y = (float)(uVar7 >> ((uint8_t)ppvStack_55c & 0x1f)); - uVar7 = (GHIDRA_INT(fStack_58c) + 1) * 10; - uVar19 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7); - uVar19 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar19 + 1); - pGStack_550 = GHIDRA_CAST((uVar19 >> ((uint8_t)ppvStack_55c & 0x1f))); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7 + 1); - uVar19 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt((GHIDRA_INT(fStack_58c) + 2) * 10); - uVar19 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar19 + 1); - (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar19 + 1); - pGStack_554 = GHIDRA_CAST((uVar7 >> ((uint8_t)ppvStack_55c & 0x1f))); - if (currentRoom->_gridPaths[currentRoom->_backdropType * 0x4f + 0x585] == 0) { - pGStack_554 = GHIDRA_CAST(0x0); - } - if (pGStack_560 == GHIDRA_CAST(0x9)) { - pGVar21 = GHIDRA_CAST(&DAT_00000005); - if (5 < GHIDRA_INT(pGStack_550)) { - pGVar21 = pGStack_550; - } - pGStack_550 = pGVar21; - } - if (pGStack_54c == GHIDRA_CAST(0x1c)) { - pGStack_550 = GHIDRA_CAST((GHIDRA_INT(pGStack_550) * 2)); - pGStack_554 = GHIDRA_CAST((GHIDRA_INT(pGStack_554) * 3)); - VStack_574.y = (float)(GHIDRA_INT(VStack_574.y) * 2); - } - if (0 < GHIDRA_INT(VStack_574.y)) { - pGVar21 = GHIDRA_CAST(VStack_574.y); - do { - uVar7 = Random(); - VStack_574.y = ((currentRoom->_bottomRightPos).y - (currentRoom->_topLeftPos).y) * - (float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 + - (currentRoom->_topLeftPos).y; - uVar7 = Random(); - tinyFlyPos.x = ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 + - (currentRoom->_topLeftPos).x; - tinyFlyPos.y = VStack_574.y; - pGVar20 = GHIDRA_CAST(VStack_574.y); - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0x15,&tinyFlyPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - spawned->Update(); - pGVar21 = GHIDRA_CAST((GHIDRA_INT(&pGVar21[-1]._console) + 3)); - } while (pGVar21 != GHIDRA_CAST(0x0)); - } - if (0 < GHIDRA_INT(pGStack_550)) { - pGVar21 = pGStack_550; - do { - uVar7 = Random(); - VStack_574.y = ((currentRoom->_bottomRightPos).y - (currentRoom->_topLeftPos).y) * - (float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 + - (currentRoom->_topLeftPos).y; - uVar7 = Random(); - effect33Pos.x = - ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).x; - effect33Pos.y = VStack_574.y; - pGVar20 = GHIDRA_CAST(VStack_574.y); - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0x21,&effect33Pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7) - ; - spawned->Update(); - pGVar21 = GHIDRA_CAST((GHIDRA_INT(&pGVar21[-1]._console) + 3)); - } while (pGVar21 != GHIDRA_CAST(0x0)); - } - pGVar21 = pGStack_554; - if (0 < GHIDRA_INT(pGStack_554)) { - do { - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0x44,&g_vectorOne,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7) - ; - spawned->Update(); - pGVar21 = GHIDRA_CAST((GHIDRA_INT(&pGVar21[-1]._console) + 3)); - } while (pGVar21 != GHIDRA_CAST(0x0)); - } - pGVar21 = pGStack_560; - if (((pGStack_560 == GHIDRA_CAST(0x3)) || (pGStack_560 == GHIDRA_CAST(0x4))) || - ((pGStack_560 == GHIDRA_CAST(0x7) || - ((pGStack_560 == GHIDRA_CAST(0x8) || (pGStack_560 == GHIDRA_CAST(0x9))))))) { - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(GHIDRA_UINT(local_544)); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7 + 1); - pGVar14 = GHIDRA_CAST((uVar7 >> ((uint8_t)ppvStack_55c & 0x1f))); - pGStack_554 = pGVar14; - if ((pGVar21 == GHIDRA_CAST(0x9)) && (pGStack_554 = GHIDRA_CAST(&DAT_00000005), 5 < GHIDRA_INT(pGVar14))) { - pGStack_554 = pGVar14; - } - if (0 < GHIDRA_INT(pGStack_554)) { - do { - iVar17 = 0; - do { - uVar7 = Random(); - VStack_574.y = ((currentRoom->_bottomRightPos).y - (currentRoom->_topLeftPos).y) * - (float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 - + (currentRoom->_topLeftPos).y; - uVar7 = Random(); - effect63Pos.y = VStack_574.y; - effect63Pos.x = - ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).x; - pGVar20 = GHIDRA_CAST(((VStack_574.y - 120.0) / 40.0 + 0.5)); - listIndex = GHIDRA_INT((float)pGVar20); - iVar8 = GHIDRA_INT(((effect63Pos.x - 40.0) / 40.0 + 0.5)); - if ((((iVar8 < 0) || (currentRoom->_gridWidth <= iVar8)) || (listIndex < 0)) || - (currentRoom->_gridHeight <= listIndex)) { - iVar8 = -1; - } - else { - iVar8 = currentRoom->_gridWidth * listIndex + iVar8; - } - uVar7 = GetGridCollision(currentRoom,iVar8); - if (uVar7 == 0) { - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0x3f,&effect63Pos,&g_vectorZero,GHIDRA_CAST(0x0),1, - uVar7); - spawned->Update(); - break; - } - iVar17 = iVar17 + 1; - } while (iVar17 < 10); - pGStack_554 = GHIDRA_CAST((GHIDRA_INT(&pGStack_554[-1]._console) + 3)); - } while (pGStack_554 != GHIDRA_CAST(0x0)); - pGStack_554 = GHIDRA_CAST(0x0); - pGVar21 = pGStack_560; - } - } - if (pGVar21 == GHIDRA_CAST(0xa)) { - if (local_540[0] == GHIDRA_CAST(0x0)) { - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(GHIDRA_UINT(local_544)); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7 + 1); - local_544 = GHIDRA_CAST((uVar7 >> ((uint8_t)ppvStack_55c & 0x1f))); - if (0 < GHIDRA_INT(local_544)) { - do { - iVar17 = 10; - do { - uVar7 = Random(); - pGStack_554 = GHIDRA_CAST((((currentRoom->_bottomRightPos).y - - (currentRoom->_topLeftPos).y) * - (float)((double)GHIDRA_INT(uVar7) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).y)); - uVar7 = Random(); - effect63PosB.x = - ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).x; - effect63PosB.y = (float)pGStack_554; - pGVar20 = pGStack_554; - uVar7 = Random(); - spawned = Game::Spawn(g_game,1000,0x3f,&effect63PosB,&g_vectorZero,GHIDRA_CAST(0x0),2 - ,uVar7); - spawned->Update(); - iVar17 = iVar17 + -1; - } while (iVar17 != 0); - local_544 = GHIDRA_CAST((GHIDRA_INT(&local_544[-1]._console) + 3)); - } while (local_544 != GHIDRA_CAST(0x0)); - local_544 = GHIDRA_CAST(0x0); - } - } -LAB_007f64de: - if (roomConfig->Type == 7) goto LAB_007f6518; - uVar7 = g_game->_debugCurses; - uVar19 = g_game->_curses; - uVar13 = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - currentRoom = room; - if ((~preventedCurses & (uVar13 | uVar7 | uVar19) & 1) != 0) goto LAB_007f6518; - } - else { - if (((pGVar21 == GHIDRA_CAST(0x3)) || (pGVar21 == GHIDRA_CAST(0x5))) || (pGVar21 == GHIDRA_CAST(0x6))) { - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(GHIDRA_UINT(local_544)); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7 + 1); - uVar7 = uVar7 >> ((uint8_t)ppvStack_55c & 0x1f); - if (0 < GHIDRA_INT(uVar7)) { - do { - uVar19 = Random(); - local_544 = GHIDRA_CAST((((currentRoom->_bottomRightPos).y - - (currentRoom->_topLeftPos).y) * - (float)((double)GHIDRA_INT(uVar19) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).y)); - uVar19 = Random(); - effect64Pos.x = - ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).x; - effect64Pos.y = (float)local_544; - pGVar20 = local_544; - uVar19 = Random(); - spawned = Game::Spawn(g_game,1000,0x40,&effect64Pos,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar19); - spawned->Update(); - uVar7 = uVar7 - 1; - } while (uVar7 != 0); - } - pGVar21 = pGStack_560; - } - if ((pGVar21 != GHIDRA_CAST(0xb)) || (local_540[0] != GHIDRA_CAST(0x0))) goto LAB_007f64de; -LAB_007f6518: - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)) >> 9 & 1) == 0) { - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(GHIDRA_INT(fStack_58c) * 0x14 + 0x32); - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(uVar7 + 1); - uVar7 = uVar7 >> ((uint8_t)ppvStack_55c & 0x1f); - if (0 < GHIDRA_INT(uVar7)) { - do { - uVar19 = Random(); - local_544 = GHIDRA_CAST((((currentRoom->_bottomRightPos).y - - (currentRoom->_topLeftPos).y) * - (float)((double)GHIDRA_INT(uVar19) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).y)); - uVar19 = Random(); - effect65PosB.x = - ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).x; - effect65PosB.y = (float)local_544; - pGVar20 = local_544; - uVar19 = Random(); - spawned = Game::Spawn(g_game,1000,0x41,&effect65PosB,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar19); - spawned->Update(); - uVar7 = uVar7 - 1; - } while (uVar7 != 0); - } - } - } - if ((pGStack_54c == GHIDRA_CAST(0x1b)) && - (pGVar20 = GHIDRA_CAST(currentRoom->_waterAmount), 0.0 < (float)pGVar20)) { - if (ambientRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - ambientRng._seed = - GHIDRA_UINT(ambientRng._seed) >> ((uint8_t)ambientRng._shift1 & 0x1f) ^ ambientRng._seed; - ambientRng._seed = - ambientRng._seed << ((uint8_t)ambientRng._shift2 & 0x1f) ^ ambientRng._seed; - ambientRng._seed = - GHIDRA_UINT(ambientRng._seed) >> ((uint8_t)ambientRng._shift3 & 0x1f) ^ ambientRng._seed; - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt(GHIDRA_UINT(ambientRng._seed) % 0xf + 1); - uVar7 = uVar7 >> ((uint8_t)ppvStack_55c & 0x1f); - if (0 < GHIDRA_INT(uVar7)) { - do { - uVar19 = Random(); - local_544 = GHIDRA_CAST((((currentRoom->_bottomRightPos).y - (currentRoom->_topLeftPos).y) - * (float)((double)GHIDRA_INT(uVar19) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).y)); - uVar19 = Random(); - effect158Pos.x = - ((currentRoom->_bottomRightPos).x - (currentRoom->_topLeftPos).x) * - (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (currentRoom->_topLeftPos).x; - effect158Pos.y = (float)local_544; - pGVar20 = local_544; - bVar5 = IsPositionInRoom(currentRoom,&effect158Pos,0.0); - if (bVar5 != 0) { - iVar8 = GHIDRA_INT(((effect158Pos.x - 40.0) / 40.0 + 0.5)); - pGVar20 = GHIDRA_CAST(((effect158Pos.y - 120.0) / 40.0 + 0.5)); - iVar17 = GHIDRA_INT((float)pGVar20); - if ((((iVar8 < 0) || (currentRoom->_gridWidth <= iVar8)) || (iVar17 < 0)) || - (currentRoom->_gridHeight <= iVar17)) { - iVar8 = -1; - } - else { - iVar8 = iVar17 * currentRoom->_gridWidth + iVar8; - } - uVar19 = GetGridCollision(currentRoom,iVar8); - if (GHIDRA_INT(uVar19) < 2) { - uVar19 = Random(); - spawned = Game::Spawn(g_game,1000,0x9e,&effect158Pos,&g_vectorZero,GHIDRA_CAST(0x0),0 - ,uVar19); - spawned->Update(); - } - } - uVar7 = uVar7 - 1; - } while (uVar7 != 0); - } - if (ambientRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - ambientRng._seed = - GHIDRA_UINT(ambientRng._seed) >> ((uint8_t)ambientRng._shift1 & 0x1f) ^ ambientRng._seed; - ambientRng._seed = - ambientRng._seed << ((uint8_t)ambientRng._shift2 & 0x1f) ^ ambientRng._seed; - ambientRng._seed = - GHIDRA_UINT(ambientRng._seed) >> ((uint8_t)ambientRng._shift3 & 0x1f) ^ ambientRng._seed; - uVar7 = (GHIDRA_CAST((&ambientRng)))->RNG::RandomInt((ambientRng._seed & 3U) + 1); - uVar7 = uVar7 >> ((uint8_t)ppvStack_55c & 0x1f); - if (0 < GHIDRA_INT(uVar7)) { - do { - uVar19 = Random(); - spawned = Game::Spawn(g_game,1000,0x9f,&g_vectorZero,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar19); - spawned->Update(); - uVar7 = uVar7 - 1; - } while (uVar7 != 0); - } - } - } - } - } -LAB_007f68b5: - pGVar21 = g_game; - if ((g_game->_challenge == 0x1f) && - ((g_game->_currentRoomIdx == g_game->_startingRoomIdx || (g_game->_currentRoomIdx == -2)))) { - GetCenterPos(¢erSpawnPos); - if (pGVar21->_stage == 1) { - uVar7 = Random(); - uVar13 = 0x172; - uVar19 = 5; - } - else { - if ((*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1))) == '\0') goto LAB_007f6941; - uVar7 = Random(); - uVar13 = 0x27; - uVar19 = 1000; - } - Game::Spawn(g_game,uVar19,uVar13,¢erSpawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - pGVar21 = g_game; - } -LAB_007f6941: - if (pGVar21->_isRestoringGlowingHourglassState == 0) { - piVar18 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x40)); - *piVar18 = *piVar18 + 1; - local_544 = GHIDRA_CAST(&pGVar21->_scoreSheet); - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - pGStack_554 = GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x44)) >> 10 & 0xffffff01)); - pGStack_54c = *GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x10)) + 0x48)); - if (*GHIDRA_CAST((iVar17 + 0x40)) == 1) { - bVar5 = Game::GetStateFlag(pGVar21,0x30); - pGVar14 = local_544; - ScoreSheet::find_stage_entry - (GHIDRA_CAST(local_544),pGVar21->_stage,pGVar21->_stageType,bVar5); - if (0.0 < (float)pGVar20) { - scoreRoomType = currentRoom->_roomType; - scoreFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(scoreFlag)) + 0x1))),(char)pGStack_554); - scoreValue = pGVar20; - local_544 = GHIDRA_CAST(FUN_009e6740(pGStack_54c)); - if (0 < GHIDRA_INT(local_544)) { - do { - piVar18 = GHIDRA_CAST(pGVar14->_roomList[0].DecorationSeed); - if (piVar18 == GHIDRA_CAST(pGVar14->_roomList[0].SpawnSeed)) { - msvc::vector<12byte>::_Emplace_reallocate(piVar18,&scoreRoomType); - } - else { - *piVar18 = scoreRoomType; - piVar18[1] = scoreFlag; - piVar18[2] = GHIDRA_INT(scoreValue); - piVar18 = &pGVar14->_roomList[0].DecorationSeed; - *piVar18 = *piVar18 + 0xc; - } - local_544 = GHIDRA_CAST((GHIDRA_INT(&local_544[-1]._console) + 3)); - } while (local_544 != GHIDRA_CAST(0x0)); - } - } - } - } - if (((pGStack_560 == GHIDRA_CAST(0x1)) || (pGStack_560 == GHIDRA_CAST(0x2))) && - (local_540[0] == GHIDRA_CAST(0x2))) { - local_540[0] = GHIDRA_CAST(0xa); - do { - uVar7 = Random(); - spawnPos = GetRandomPosition(currentRoom,&randomPos,0.0); - effect87Pos.x = spawnPos->x - 0.0; - effect87Pos.y = spawnPos->y - 100.0; - spawned = Game::Spawn(g_game,1000,0x57,&effect87Pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - spawned->Update(); - local_540[0] = GHIDRA_CAST((GHIDRA_INT(local_540[0]) + -1)); - } while (local_540[0] != GHIDRA_CAST(0x0)); - } - pGVar20 = g_game; - iVar8 = currentRoom->_aliveEnemyCount + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x12c4)))); - iVar17 = 0; - if (0 < iVar8) { - iVar17 = iVar8; - } - if ((((iVar17 < 1) && (currentRoom->_roomClearDelay == 0)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)) & 1) == 0)) && - (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { - puVar23 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)); - *puVar23 = *puVar23 | 1; - } - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))); - if ((*GHIDRA_CAST((iVar17 + 0x44)) & 1) == 0) { - if (roomConfig->Type == 6) { - titleSize = 0; - titleCapacity = 7; - titleText[0] = GHIDRA_CAST(0x0); - uStack_14 = 7; - uVar7 = roomConfig->Subtype; - if (uVar7 < 0x10) { - if (*GHIDRA_CAST((GHIDRA_INT((pGVar20->_itemPool)._pools) + uVar7 * 0x1c + -0x1c0)) == 0) { - pbVar24 = &s_empty; - } - else { - piVar18 = GHIDRA_CAST((GHIDRA_INT((pGVar20->_itemPool)._pools) + uVar7 * 0x1c + -0x1d0)); - if (0xf < *GHIDRA_CAST((GHIDRA_INT((pGVar20->_itemPool)._pools) + uVar7 * 0x1c + -0x1bc))) { - piVar18 = GHIDRA_CAST(*piVar18); - } - pbVar24 = GHIDRA_CAST(FUN_00958840(&g_manager->_stringTable,"Minibosses", - *GHIDRA_CAST(&g_manager->_stringTable),piVar18)); - } - (GHIDRA_CAST((minibossName._buf)))->msvc::string::string_from_cstr(pbVar24); - } - else { - minibossName._size = 0; - minibossName._buf[0] = '\0'; - minibossName._buf[1] = '\0'; - minibossName._buf[2] = '\0'; - minibossName._buf[3] = '\0'; - minibossName._capacity = 0xf; - (GHIDRA_CAST((minibossName._buf)))->msvc::string::assign(&s_empty,0); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 8; - pbVar24 = string_table_translate(&g_manager->_stringTable,&DAT_00b6c580); - (GHIDRA_CAST((versusText._buf)))->msvc::string::string_from_cstr(pbVar24); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 9; - playerName = &versusText; - if ((versusText._capacity < 0x10) || - (playerName = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(versusText._buf))) + 0x0))), (*GHIDRA_CAST((GHIDRA_CAST(&(versusText._buf)) + 0x0))) != 0)) { - nameCursor = playerName; - do { - pcVar16 = nameCursor->_buf; - nameCursor = GHIDRA_CAST((nameCursor->_buf + 1)); - } while (*pcVar16 != 0); - iVar17 = GHIDRA_INT(nameCursor) - GHIDRA_INT((playerName->_buf + 1)); - } - else { - iVar17 = 0; - } - text_convert_encoding(GHIDRA_CAST(playerName),iVar17,0,versusWide,0x20,1); - playerName = &minibossName; - if ((minibossName._capacity < 0x10) || - (playerName = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(minibossName._buf))) + 0x0))), (*GHIDRA_CAST((GHIDRA_CAST(&(minibossName._buf)) + 0x0))) != 0)) { - nameCursor = playerName; - do { - pcVar16 = nameCursor->_buf; - nameCursor = GHIDRA_CAST((nameCursor->_buf + 1)); - } while (*pcVar16 != 0); - iVar17 = GHIDRA_INT(nameCursor) - GHIDRA_INT((playerName->_buf + 1)); - } - else { - iVar17 = 0; - } - text_convert_encoding(GHIDRA_CAST(playerName),iVar17,0,minibossNameWide,0x40,1); - player = Game::GetPlayer(g_game,0); - if ((((player->_twinPlayer == 0) || - (player = Game::GetPlayer(g_game,0), player->_playerType == 0x23)) || - (player = Game::GetPlayer(g_game,0), player->_playerType == 0x1d)) || - (player = Game::GetPlayer(g_game,0), player->_playerType == 0x26)) { - player = Game::GetPlayer(g_game,0); - playerName = &player->_name; - if (0xf < (player->_name)._capacity) { - playerName = *GHIDRA_CAST(playerName->_buf); - } - if (playerName == GHIDRA_CAST(0x0)) { - iVar17 = 0; - } - else { - nameCursor = playerName; - do { - pcVar16 = nameCursor->_buf; - nameCursor = GHIDRA_CAST((nameCursor->_buf + 1)); - } while (*pcVar16 != '\0'); - iVar17 = GHIDRA_INT(nameCursor) - GHIDRA_INT((playerName->_buf + 1)); - } - text_convert_encoding(GHIDRA_CAST(playerName),iVar17,0,soloPlayerNameWide,0x40,1); - local_544 = GHIDRA_CAST(FUN_00828050(minibossNameWide)); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x16; - local_540[0] = GHIDRA_CAST(FUN_00828050(&DAT_00b6c57c)); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x17; - uVar11 = FUN_00828050(versusWide); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x18; - separatorSegment = FUN_00828050(&DAT_00b6c57c); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x19; - nameSegment = FUN_00828050(soloPlayerNameWide); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x1a; - FUN_008284d0(local_540[0],nameSegment,separatorSegment); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x1b; - FUN_008284d0(local_540[0],auStack_41c,uVar11); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x1c; - FUN_008284d0(local_540[0],auStack_38c,local_540[0]); - uStack_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x1))),0x1d); - FUN_008284d0(local_540[0],auStack_35c,local_544); - bVar5 = 0xcb; - FUN_00828010(auStack_344); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - } - else { - player = Game::GetPlayer(g_game,0); - playerName = &player->_name; - if (0xf < (player->_name)._capacity) { - playerName = *GHIDRA_CAST(playerName->_buf); - } - if (playerName == GHIDRA_CAST(0x0)) { - iVar17 = 0; - } - else { - nameCursor = playerName; - do { - pcVar16 = nameCursor->_buf; - nameCursor = GHIDRA_CAST((nameCursor->_buf + 1)); - } while (*pcVar16 != '\0'); - iVar17 = GHIDRA_INT(nameCursor) - GHIDRA_INT((playerName->_buf + 1)); - } - text_convert_encoding(GHIDRA_CAST(playerName),iVar17,0,playerNameWide,0x40,1); - player = Game::GetPlayer(g_game,0); - pbVar24 = GHIDRA_CAST((player->_twinPlayer + 0x13c4)); - if (0xf < *GHIDRA_CAST((player->_twinPlayer + 0x13d8))) { - pbVar24 = *GHIDRA_CAST(pbVar24); - } - if (pbVar24 == GHIDRA_CAST(0x0)) { - iVar17 = 0; - } - else { - charCursor = pbVar24; - do { - bVar5 = *charCursor; - charCursor = charCursor + 1; - } while (bVar5 != 0); - iVar17 = GHIDRA_INT(charCursor) - GHIDRA_INT((pbVar24 + 1)); - } - text_convert_encoding(pbVar24,iVar17,0,twinNameWide,0x40,1); - pGStack_54c = GHIDRA_CAST(FUN_00828050(minibossNameWide)); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 10; - pGStack_554 = GHIDRA_CAST(FUN_00828050(&DAT_00b6c57c)); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0xb; - local_544 = GHIDRA_CAST(FUN_00828050(versusWide)); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0xc; - local_540[0] = GHIDRA_CAST(FUN_00828050(&DAT_00b6c57c)); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0xd; - uVar11 = FUN_00828050(twinNameWide); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0xe; - separatorSegment = FUN_00828050(&DAT_00b6c518); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0xf; - nameSegment = FUN_00828050(playerNameWide); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x10; - FUN_008284d0(local_540[0],nameSegment,separatorSegment); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x11; - FUN_008284d0(local_540[0],auStack_3a4,uVar11); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x12; - FUN_008284d0(local_540[0],auStack_374,local_540[0]); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x13; - FUN_008284d0(local_540[0],auStack_3bc,local_544); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 0x14; - FUN_008284d0(local_540[0],auStack_3d4,pGStack_554); - uStack_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x1))),0x15); - FUN_008284d0(local_540[0],auStack_3ec,pGStack_54c); - bVar5 = 0xf5; - FUN_00828010(auStack_404); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - FUN_00828ab0(); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x0))) = 9; - bVar15 = 0x32; - FUN_00828ab0(); - title = GHIDRA_CAST(titleText); - if (7 < titleCapacity) { - title = titleText[0]; - } - HUD::ShowStackedItemTextCustomUTF16(&g_game->_hud,GHIDRA_CAST(title),L"",bVar5,bVar15); - (GHIDRA_CAST((versusText._buf)))->msvc::string::_Tidy_deallocate(); - uStack_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_14)) + 0x1))),7); - if (0xf < minibossName._capacity) { - uVar7 = minibossName._capacity + 1; - textData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)minibossName._buf)) + 0x0))); - if (0xfff < uVar7) { - textData = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(minibossName._buf)) + 0x0))) + -4); - uVar7 = minibossName._capacity + 0x24; - if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(minibossName._buf)) + 0x0))) - GHIDRA_INT(textData)) - 4U) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(textData,uVar7); - } - uStack_14 = 0xffffffff; - minibossName._size = 0; - minibossName._capacity = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(minibossName._buf)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(minibossName._buf)) + 0x0))) & 0xffffff00; - if (7 < titleCapacity) { - FUN_00828a70(titleText[0],titleCapacity + 1); - } - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))); - currentRoom = room; - } - if ((*GHIDRA_CAST((iVar17 + 0x44)) & 1) != 0) goto LAB_007f71f4; - } - else { -LAB_007f71f4: - (*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x1bbc))) = 1; - } - currentRoom->_redHeartDamage = 0; - init_rain(currentRoom); - pGVar20 = g_game; - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)) >> 10 & 1) == 0) || - (currentRoom->_backdropType == 0x35)) { - if (currentRoom->_roomType == 0x1d) { - (currentRoom->_floorColor)._colorize[0] = 1.0; - (currentRoom->_floorColor)._colorize[1] = 0.7; - (currentRoom->_floorColor)._colorize[2] = 0.7; - (currentRoom->_floorColor)._colorize[3] = 0.6; - (currentRoom->_wallColor)._colorize[0] = 1.0; - (currentRoom->_wallColor)._colorize[1] = 0.4; - (currentRoom->_wallColor)._colorize[2] = 0.4; - (currentRoom->_wallColor)._colorize[3] = 0.6; - } - else { - if (((g_game->_stage < 1) || (6 < g_game->_stage)) || - (bVar5 = Game::GetStateFlag(g_game,0x30), bVar5 == 0)) { - if ((currentRoom->_backdropType != 6) || - (bVar5 = Seeds::HasSeedEffect(&pGVar20->_seedEffects,0x4f), bVar5 == 0)) - goto LAB_007f7445; - seedFloorColor._tint[0] = 1.0; - seedFloorColor._tint[1] = 1.0; - seedFloorColor._tint[2] = 1.0; - seedFloorColor._tint[3] = 1.0; - seedFloorColor._offset[0] = 0.0; - seedFloorColor._colorize[0] = 1.0; - seedFloorColor._colorize[1] = 1.0; - seedFloorColor._colorize[2] = 1.0; - seedFloorColor._colorize[3] = (float)&DAT_bf800000; - seedFloorColor._offset[1] = 0.0; - seedFloorColor._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(¤tRoom->_floorColor))))->Color::operator_assign(&seedFloorColor); - other = &seedWallColor; - seedWallColor._tint[0] = 1.0; - seedWallColor._tint[1] = 1.0; - seedWallColor._tint[2] = 1.0; - seedWallColor._tint[3] = 1.0; - seedWallColor._offset[0] = 0.0; - seedWallColor._colorize[0] = 1.0; - seedWallColor._colorize[1] = 1.0; - seedWallColor._colorize[2] = 1.0; - seedWallColor._colorize[3] = (float)&DAT_bf800000; - seedWallColor._offset[1] = 0.0; - seedWallColor._offset[2] = 0.0; - } - else { - ascentFloorColor._tint[0] = 1.0; - ascentFloorColor._tint[1] = 1.0; - ascentFloorColor._tint[2] = 1.0; - ascentFloorColor._tint[3] = 1.0; - ascentFloorColor._offset[0] = 0.076400004; - ascentFloorColor._colorize[0] = 1.2; - ascentFloorColor._colorize[1] = 1.2; - ascentFloorColor._colorize[2] = 1.2; - ascentFloorColor._colorize[3] = 0.6; - ascentFloorColor._offset[1] = -0.0216; - ascentFloorColor._offset[2] = -0.0884; - (GHIDRA_CAST((GHIDRA_CAST(¤tRoom->_floorColor))))->Color::operator_assign(&ascentFloorColor); - other = &ascentWallColor; - ascentWallColor._tint[0] = 1.0; - ascentWallColor._tint[1] = 1.0; - ascentWallColor._tint[2] = 1.0; - ascentWallColor._tint[3] = 1.0; - ascentWallColor._offset[0] = 0.076400004; - ascentWallColor._colorize[0] = 1.2; - ascentWallColor._colorize[1] = 1.2; - ascentWallColor._colorize[2] = 1.2; - ascentWallColor._colorize[3] = 0.6; - ascentWallColor._offset[1] = -0.0216; - ascentWallColor._offset[2] = -0.0884; - } - (GHIDRA_CAST((GHIDRA_CAST(¤tRoom->_wallColor))))->Color::operator_assign(other); - } - } - else { - (currentRoom->_floorColor)._colorize[0] = 1.0; - (currentRoom->_floorColor)._colorize[1] = 0.0; - (currentRoom->_floorColor)._colorize[2] = 0.0; - (currentRoom->_floorColor)._colorize[3] = 0.3; - (currentRoom->_wallColor)._colorize[0] = 1.0; - (currentRoom->_wallColor)._colorize[1] = 0.2; - (currentRoom->_wallColor)._colorize[2] = 0.2; - (currentRoom->_wallColor)._colorize[3] = 0.8; - } -LAB_007f7445: - cVar6 = FUN_008242f0(); - if (cVar6 != '\0') { - rayTexturePaths[0] = "gfx/backdrop/fx_ray_3.png"; - rayTexturePaths[1] = "gfx/backdrop/fx_ray_4.png"; - if (DAT_00c79834 != GHIDRA_CAST(0x0)) { - KAGE::SmartPointer::reset(extraout_ECX_01); - } - rayRng._shift1 = 1; - rayRng._shift2 = 0x1b; - rayRng._seed = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x58)); - rayRng._shift3 = 0x1b; - uVar7 = (GHIDRA_CAST((&rayRng)))->RNG::RandomInt(2); - textData = Manager::LoadImage(rayImage,GHIDRA_CAST(rayTexturePaths[uVar7])); - uStack_14 = 0x1e; - FUN_008283d0(textData); - uStack_14 = 0x1f; - if (((rayImageRefCount != GHIDRA_CAST(0x0)) && - (cVar6 = (**(code **)(*rayImageRefCount + 0xc))(), cVar6 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(rayImage); - } - piVar18 = DAT_00c79834; - uStack_14 = 0xffffffff; - if ((DAT_00c79834[0xc] != 1) || (DAT_00c79834[0xd] != 1)) { - (**(code **)(*DAT_00c79834 + 0x44))(1,1); - piVar18[0xc] = 1; - piVar18[0xd] = 1; - } - } - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x4)))) + 0x44)) & 0x10000) != 0) && - (currentRoom->_bossId == 0x57)) { - currentRoom->_bossId = 0; - } - FUN_00823540(); - bVar5 = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)); - if ((bVar5 == 0) || (g_game->_currentDimensionIdx != 1)) { - if (currentRoom->_roomType != 8) goto LAB_007f760e; - (currentRoom->_floorColor)._colorize[0] = 1.0; - (currentRoom->_floorColor)._colorize[1] = 0.9; - (currentRoom->_floorColor)._colorize[2] = 0.8; - (currentRoom->_wallColor)._colorize[0] = 1.0; - (currentRoom->_wallColor)._colorize[1] = 0.9; - (currentRoom->_wallColor)._colorize[2] = 0.8; - } - else { - (currentRoom->_floorColor)._colorize[0] = 0.9; - (currentRoom->_floorColor)._colorize[1] = 0.8; - (currentRoom->_floorColor)._colorize[2] = 1.0; - (currentRoom->_wallColor)._colorize[0] = 0.9; - (currentRoom->_wallColor)._colorize[1] = 0.8; - (currentRoom->_wallColor)._colorize[2] = 1.0; - } - (currentRoom->_wallColor)._colorize[3] = 0.5; - (currentRoom->_floorColor)._colorize[3] = 0.4; -LAB_007f760e: - update_bounds(currentRoom,0); - if (currentRoom->_Camera != (void *)0x0) { - FUN_007ea0c0(currentRoom->_Camera); - } - local_540[0] = operator_new(0x94); - uStack_14 = 0x20; - if (local_540[0] == GHIDRA_CAST(0x0)) { - textData = (void *)0x0; - } - else { - (GHIDRA_CAST((GHIDRA_CAST(local_540[0]))))->Camera::constructor(currentRoom); - textData = extraout_EAX_00; - } - uStack_14 = 0xffffffff; - currentRoom->_Camera = textData; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x70d8)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x70dc)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x70f4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((currentRoom)) + 0x70f8)))); - Backdrop::load_details(GHIDRA_CAST(¤tRoom->_backdrop)); - TextureCache::Purge(); - textData = g_luaEngine; - local_540[0] = g_luaEngine; - lua_gc(*GHIDRA_CAST((GHIDRA_CAST(g_luaEngine) + 0x18)),2,0); - lua_gc(*GHIDRA_CAST((GHIDRA_CAST(textData) + 0x18)),4,0); - lua_gc(GHIDRA_INT(*GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x18))),3,0); - KAGE_LogMessage(1,GHIDRA_CAST("Lua mem usage: %d KB and %d bytes\n")); - if (((room->_bossId == 0x3e) && (g_game->_difficulty == 3)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)) & 1) != 0)) { - TurnGold(room); - } - manager = g_manager; - pGVar20 = g_game; - if ((g_game->_levelStateFlags & 0x1000000U) != 0) { - currentRoom = g_game->_room; - currentRoom->_brokenWatchState = 1; - fVar25 = time_scale_update(currentRoom); - pGVar20 = g_game; - (manager->_musicManager)._targetPitch = fVar25; - iVar17 = *GHIDRA_CAST((GHIDRA_CAST(pGVar20->_room) + 0x722c)); - if (iVar17 < 0x7fffffff) { - iVar17 = 0x7fffffff; - } - *GHIDRA_CAST((GHIDRA_CAST(pGVar20->_room) + 0x722c)) = iVar17; - } - manager = g_manager; - if ((pGVar20->_levelStateFlags & 0x2000000U) != 0) { - currentRoom = pGVar20->_room; - currentRoom->_brokenWatchState = 2; - fVar25 = time_scale_update(currentRoom); - pGVar20 = g_game; - playerManager = &g_game->_playerManager; - (manager->_musicManager)._targetPitch = fVar25; - uVar7 = 0; - if (GHIDRA_INT((pGVar20->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) - >> 2 != 0) { - do { - player = PlayerManager::GetPlayer(playerManager,uVar7); - if (player->_variant == 0) { - local_540[0] = GHIDRA_CAST(PlayerManager)::GetPlayer(&g_game->_playerManager,uVar7); - player = PlayerManager::GetPlayer(&g_game->_playerManager,uVar7); - textData = (player->_pillRNGs)._end; - if (GHIDRA_INT((GHIDRA_INT(textData) - GHIDRA_INT((player->_pillRNGs)._begin) & 0xfffffff0U)) < 0x2a1) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Pill ID out of bounds!\n")); - textData = (player->_pillRNGs)._end; - } - pillRngs = (player->_pillRNGs)._begin; - uVar19 = (GHIDRA_INT(textData) - GHIDRA_INT(pillRngs) >> 4) - 1; - if (0x2a < uVar19) { - uVar19 = 0x2a; - } - uVar19 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pillRngs) + uVar19 * 0x10)))))->RNG::RandomInt(2); - *GHIDRA_CAST((GHIDRA_INT(local_540[0]) + 0x18e8)) = (uVar19 + 2) * 900; - player = PlayerManager::GetPlayer(&g_game->_playerManager,uVar7); - (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::AddCollectibleEffect(0x1c,0,1); - } - uVar7 = uVar7 + 1; - playerManager = &g_game->_playerManager; - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - ExceptionList = local_1c; - return; -} - -// 007f79d0 -Vector * Room::GetDoorSlotPosition(Vector *outPosition, int doorSlot) -{ - int gridIndex; - int gridWidth; - float zeroY; - - zeroY = g_vectorZero.y; - if (GHIDRA_UINT(doorSlot) < 8) { - gridIndex = this->_doorGridPositions[doorSlot]; - gridWidth = this->_gridWidth; - outPosition->x = (float)(gridIndex % gridWidth) * 40.0 + 40.0; - outPosition->y = (float)(gridIndex / gridWidth) * 40.0 + 120.0; - return outPosition; - } - outPosition->x = g_vectorZero.x; - outPosition->y = zeroY; - return outPosition; -} - -// 007f7a40 -uint8_t Room::TrySpawnSecretExit(uint8_t isAnimate, uint8_t isForce) -{ - Room *door = this; - int iVar1; - code *pcVar2; - bool bVar3; - Room *pRVar4; - uint8_t bVar5; - ChallengeParam *challengeParams; - uint32_t forcedCurses; - uint32_t preventedCurses; - RoomDescriptor *currentRoomDesc; - float fVar6; - int iVar7; - Entity_Player *player; - Vector *doorDir; - Entity *particle; - void *doorEntity; - uint32_t preventedCurses; - uint32_t uVar9; - int particleTimeout; - Game *game; - float rotationSign; - uint8_t local_4c [8]; - float local_44; - Vector particleVelocity; - float perpDirY; - ChallengeParam *local_34; - RoomDescriptor *local_30; - float local_2c; - float local_28; - float local_24; - float local_20; - float local_1c; - Room *local_18; - char isAltPathUnlocked; - GridEntity_Door *door; - - local_24 = 0.0; - local_18 = door; - if (isForce == 0) { - if (g_game->_challenge == 0x2c) { - return 0; - } - if (((door->_roomType == 5) && - (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x10)) + 0x10)) == 0x59)) && - (bVar5 = Level::IsPreAscent(GHIDRA_CAST(g_game)), bVar5 != 0)) { - return 0; - } - if (((0 < g_game->_stage) && (g_game->_stage < 7)) && - ((g_game->_gameStateFlags & 0x1000000000000) != 0)) { - return 0; - } - } - game = g_game; - challengeParams = Game::GetChallengeParams(g_game); - if ((challengeParams->_pathType == 3) || - ((((g_manager->_persistentGameData)._achievements[0x27b] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (game != GHIDRA_CAST(0x0))) && - (((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))) && - ((game->_challenge == 0 && ((game->_dailyChallenge)._id == 0)))))) { - isAltPathUnlocked = '\x01'; - } - else { - isAltPathUnlocked = '\0'; - } - if (game->_stage == 6) { -LAB_007f7b57: - bVar3 = true; - } - else { - if (game->_stage == 5) { - preventedCurses = game->_debugCurses; - uVar9 = game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - door = local_18; - game = g_game; - if ((~preventedCurses & (forcedCurses | preventedCurses | uVar9) & 2) != 0) goto LAB_007f7b57; - } - bVar3 = false; - } - if ((((isAltPathUnlocked == '\0') || (!bVar3)) || - (game->_currentRoomIdx != game->_startingRoomIdx)) || - ((game->_stageType == 4 || (game->_stageType == 5)))) { - if (isForce == 0) { - currentRoomDesc = Level::GetRoomByIdx(GHIDRA_CAST(game),game->_currentRoomIdx,-1); - game = g_game; - if (currentRoomDesc->ListIndex != g_game->_lastBossRoomListIdx) goto LAB_007f817f; - } - local_34 = Game::GetChallengeParams(game); - if (((isForce != 0) || - ((((game->_challenge == 0 && ((game->_dailyChallenge)._id == 0)) || - (local_34->_pathType == 2)) && - (((g_manager->_persistentGameData)._achievements[0x197] != 0 || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))))))) && - ((local_30 = GHIDRA_CAST(Level)::get_secret_exit_kind(GHIDRA_CAST(game)), - local_30 != GHIDRA_CAST(0x0) && - (((isForce != 0 || (local_30 != GHIDRA_CAST(0x4))) || - (bVar5 = Level::IsMausoleumHeartStage(GHIDRA_CAST(game)), bVar5 == 0)))))) { - pRVar4 = local_18; - local_20 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))); - local_2c = *GHIDRA_CAST((GHIDRA_CAST(local_20) + 0x5c)); - local_4c = (uint8_t [8])0x900000002; - local_28 = 2.10195e-44; - if (local_2c == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar5 = (*pcVar2)(); - return bVar5; - } - preventedCurses = GHIDRA_UINT(local_2c) >> 2 ^ GHIDRA_UINT(local_2c); - local_1c = 0.0; - preventedCurses = preventedCurses << 9 ^ preventedCurses; - local_2c = *GHIDRA_CAST((GHIDRA_CAST(local_20) + 0x10)); - preventedCurses = (preventedCurses >> 0xf ^ preventedCurses) & 7; - fVar6 = local_24; - do { - uVar9 = 1 << ((uint8_t)preventedCurses & 0x1f); - if ((((*GHIDRA_CAST((GHIDRA_CAST(local_2c) + 0x38 + (preventedCurses >> 5) * 4)) & uVar9) == 0) || - (local_18->_doors[preventedCurses] != (void *)0x0)) || - (fVar6 = (float)(GHIDRA_UINT(fVar6) | 1), - (*GHIDRA_CAST((GHIDRA_CAST(local_20) + 0x18 + (preventedCurses >> 5) * 4)) & uVar9) != 0)) { - bVar3 = false; - } - else { - bVar3 = true; - } - if ((GHIDRA_UINT(fVar6) & 1) != 0) { - fVar6 = 0.0; - } - if (bVar3) break; - preventedCurses = preventedCurses + 1 & 0x80000007; - if (GHIDRA_INT(preventedCurses) < 0) { - preventedCurses = (preventedCurses - 1 | 0xfffffff8) + 1; - } - local_1c = (float)(GHIDRA_INT(local_1c) + 1); - } while (GHIDRA_INT(local_1c) < 8); - if (-1 < GHIDRA_INT(preventedCurses)) { - local_30 = Level::get_secret_exit_room(GHIDRA_CAST(g_game),GHIDRA_INT(local_30)); - doorEntity = pRVar4->_doors[preventedCurses]; - local_18 = GHIDRA_CAST((pRVar4->_doors + preventedCurses)); - if (doorEntity == (void *)0x0) { - MakeDoor(pRVar4,preventedCurses); - doorEntity = *(void **)local_18; - } - pRVar4 = local_18; - *GHIDRA_CAST((GHIDRA_CAST(doorEntity) + 0x394)) = 0xfffffff6; - GridEntity_Door::SetRoomTypes - (*GHIDRA_CAST(local_18),1,*GHIDRA_CAST((GHIDRA_CAST(local_30->Data) + 8))); - if (local_34->_pathType == 2) { - door = *GHIDRA_CAST(pRVar4); - local_34 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x8)))); - if ((local_34 != GHIDRA_CAST(&DAT_00000008)) && - (iVar7 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(), iVar7 != 4)) { - if ((local_34 == GHIDRA_CAST(0x1)) || - ((local_34 == GHIDRA_CAST(&DAT_00000004) || (local_34 == GHIDRA_CAST(0x2))) - )) { - bVar5 = 1; - player = Game::GetPlayer(g_game,0); - (GHIDRA_CAST((door)))->GridEntity_Door::TryUnlock(player,bVar5); - } - else { - bVar5 = 1; - player = Game::GetPlayer(g_game,0); - (GHIDRA_CAST((door)))->GridEntity_Door::TryUnlock(player,bVar5); - (GHIDRA_CAST((door)))->GridEntity_Door::Open(); - (GHIDRA_CAST((door)))->GridEntity_Door::TryBlowOpen(0,GHIDRA_CAST(0x0)); - } - } - } - if (isAnimate != 0) { - preventedCurses = preventedCurses & 0x80000003; - if (GHIDRA_INT(preventedCurses) < 0) { - preventedCurses = (preventedCurses - 1 | 0xfffffffc) + 1; - } - doorDir = Isaac::GetAxisAlignedUnitVectorFromDir(GHIDRA_CAST((local_4c + 4)),preventedCurses); - local_1c = -doorDir->x; - local_20 = -doorDir->y; - local_34 = GHIDRA_CAST(cos(1.5707964)); - fVar6 = sin(1.5707964); - local_30 = GHIDRA_CAST((local_1c * (float)local_34 - local_20 * fVar6)); - perpDirY = local_1c * fVar6 + local_20 * (float)local_34; - preventedCurses = Random(); - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - local_28 = (float)(*GHIDRA_CAST((GHIDRA_INT(*(void **))local_18 + 0x24)) % iVar7) * 40.0 + 40.0; - local_2c = (float)(*GHIDRA_CAST((GHIDRA_INT(*(void **))local_18 + 0x24)) / iVar7) * 40.0 + 120.0; - for (iVar7 = (preventedCurses & 3) + 5; iVar7 != 0; iVar7 = iVar7 + -1) { - preventedCurses = Random(); - uVar9 = Random(); - local_34 = (ChallengeParam *) - ((float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) - * 2.3283064e-10); - uVar9 = Random(); - fVar6 = (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10; - fVar6 = (fVar6 + fVar6) - 1.0; - particleVelocity.x = (float)local_34 * local_1c * 5.0 + (float)local_30 * fVar6; - particleVelocity.y = (float)local_34 * local_20 * 5.0 + perpDirY * fVar6; - uVar9 = Random(); - fVar6 = (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_18 = GHIDRA_CAST((fVar6 + fVar6)); - uVar9 = Random(); - local_24 = (float)((double)GHIDRA_INT(uVar9) + __uint_to_double_fixup[-(GHIDRA_INT(uVar9) >> 0x1f)]) * - 2.3283064e-10; - fVar6 = cos((float)local_18); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_4c)) + 0x4))) = fVar6 * local_24 * 20.0 + local_28; - fVar6 = sin((float)local_18); - local_44 = fVar6 * local_24 * 20.0 + local_2c; - particle = Game::Spawn(g_game,1000,0x3b,GHIDRA_CAST((local_4c + 4)),&particleVelocity, - GHIDRA_CAST(0x0),0,preventedCurses); - local_34 = GHIDRA_CAST((particle->_pos).x); - local_24 = (particle->_pos).y; - preventedCurses = Random(); - if (((float)((double)GHIDRA_INT(preventedCurses) + __uint_to_double_fixup[-(GHIDRA_INT(preventedCurses) >> 0x1f)]) * - 2.3283064e-10 * 10.0 + 2.0) * - (float)(((float)local_34 - local_28) * local_1c + (local_24 - local_2c) * local_20 < - 0.0) == 0.0) { - rotationSign = 1.0; - } - else { - rotationSign = (float)&DAT_bf800000; - } - *GHIDRA_CAST((particle[1]._sprite._animDefaultName._buf + 4)) = rotationSign; - preventedCurses = Random(); - iVar1 = *GHIDRA_CAST(particle); - particleTimeout = preventedCurses % 10 + 0x1e; - *GHIDRA_CAST((particle[1]._sprite._filename._buf + 4)) = particleTimeout; - *GHIDRA_CAST((particle[1]._sprite._filename._buf + 8)) = particleTimeout; - (**(code **)(iVar1 + 0xc))(); - } - } - return 1; - } - } - } - else if (door->_doors[1] == (void *)0x0) { - MakeDoor(door,1); - currentRoomDesc = Level::get_secret_exit_room(GHIDRA_CAST(g_game),3); - *GHIDRA_CAST((GHIDRA_INT(door->_doors[1]) + 0x394)) = 0xfffffff6; - GridEntity_Door::SetRoomTypes - (door->_doors[1],*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x10)) + 8)), - *GHIDRA_CAST((GHIDRA_CAST(currentRoomDesc->Data) + 8))); - return 1; - } -LAB_007f817f: - return 0; -} - -// 007f8190 -uint8_t Room::TrySpawnSecretShop(uint8_t isForce) -{ - Entity_Player *memberCardOwner; - uint32_t uVar1; - GridEntity *stairs; - uint32_t index; - undefined3 in_stack_00000005; - Vector spawnPos; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int gridWidth; - Manager *manager; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b012c7; - local_10 = ExceptionList; - ExceptionList = &local_10; - if (isForce == 0) { - if (this->_roomType == 2) { - memberCardOwner = - PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x25a,GHIDRA_CAST(&g_game->_playerManager),1); - if ((memberCardOwner != GHIDRA_CAST(0x0)) || (**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) < 0)) - goto LAB_007f8201; - } - ExceptionList = local_10; - return 0; - } -LAB_007f8201: - manager = g_manager; - gridWidth = this->_gridWidth; - if ((gridWidth < 0xb) || (this->_gridHeight < 2)) { - index = 0xffffffff; - } - else { - index = gridWidth + 10; - } - if (*GHIDRA_CAST(((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))))[4] + 0x48)) == 6) { - if ((gridWidth < 0x15) || (this->_gridHeight < 3)) { - index = 0xffffffff; - } - else { - index = (gridWidth + 10) * 2; - } - } - if (**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) < 0) { - uVar1 = Random(); - spawnPos.x = (float)(GHIDRA_INT(index) % this->_gridWidth) * 40.0 + 40.0; - spawnPos.y = (float)(GHIDRA_INT(index) / this->_gridWidth) * 40.0 + 120.0; - Game::SpawnEx(g_game,1000,0x9c,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar1,0); - } - else { - _isForce = 0x394; - seed_fart_sound_override(GHIDRA_CAST(&isForce)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(_isForce,1.0,2,0,1.0,0.0); - _isForce = Random(); - if ((GHIDRA_INT(index) < 0) || (0x1bf < GHIDRA_INT(index))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if (index < 0x1c0) { - uVar1 = GetGridCollision(this,index); - if (GHIDRA_INT(uVar1) < 1) { - stairs = operator_new(0x154); - local_8 = 0x11; - spawnPos.y = (float)stairs; - if (stairs == GHIDRA_CAST(0x0)) { - stairs = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((stairs)))->GridEntity::GridEntity(); - *GHIDRA_CAST(stairs) = IsaacRepentancePlus::GridEntity_Stairs::vftable; - } - local_8 = 0xffffffff; - if (stairs != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((stairs)) + 0x4)))) = 0x12; - stairs->_gridIndex = index; - if (this->_gridEntities[index] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[index]))(1); - } - this->_gridEntities[index] = stairs; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((stairs)) + 0x8)))) = 2; - stairs->_varData = 0; - (GHIDRA_CAST((stairs)))->GridEntity::Init(_isForce); - } - } - } - } - ExceptionList = local_10; - return 1; -} - -// 007f83b0 -uint8_t Room::TrySpawnDevilRoomDoor(uint8_t isAnimate, uint8_t isForce) -{ - code *pcVar1; - uint8_t *puVar2; - uint8_t bVar3; - uint32_t uVar4; - RoomDescriptor *roomDesc; - Entity_Player *dualityOwner; - void **TargetRoomType; - Vector *doorDir; - Entity *dustEffect; - int *piVar5; - int iVar6; - GridEntity_Door *door; - uint32_t devilRollSeed; - int iVar7; - void *ptr; - Room *room; - Game *game; - float angleSin; - float fVar8; - uint32_t uVar9; - TypeDescriptor *pTVar10; - TypeDescriptor *pTVar11; - uint32_t uVar12; - uint8_t local_84 [12]; - int local_78; - Vector local_74; - Vector local_6c; - uint32_t local_64; - float local_60; - uint64_t local_58; - int *freeSlotsCapacity; - float local_4c; - uint8_t *local_48; - uint8_t *local_44; - uint32_t local_40; - uint8_t *local_3c; - void **local_38; - Room *savedRoom; - char isAngelDoorPlaced; - void **local_2c; - float local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - Game *flagsGame; - Manager *manager; - - puStack_20 = local_84 + 0x80; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b01315; - local_1c = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((local_84 + 0x74)); - ExceptionList = &local_1c; - savedRoom = this; - local_24 = uVar4; - puVar2 = local_84 + 0x80; - if (isForce == 0) { - bVar3 = Level::CanSpawnDevilRoom(GHIDRA_CAST(g_game)); - if (bVar3 == 0) { - ExceptionList = local_1c; - return 0; - } - puVar2 = puStack_20; - } - puStack_20 = puVar2; - isAngelDoorPlaced = '\0'; - if ((isForce == 0) && - (roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,-1), - roomDesc->ListIndex != g_game->_lastBossRoomListIdx)) { - ExceptionList = local_1c; - return 0; - } - local_48 = GHIDRA_CAST(GetDevilRoomChance(this)); - if (isForce == 0) { - local_28 = (float)(g_game->_devilAngelRoomRNG)._seed; - local_58 = 0x1500000002; - local_3c = GHIDRA_CAST(0x9); - if (local_28 == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - bVar3 = (*pcVar1)(); - return bVar3; - } - devilRollSeed = GHIDRA_UINT(local_28) >> 2 ^ GHIDRA_UINT(local_28); - devilRollSeed = devilRollSeed << 0x15 ^ devilRollSeed; - devilRollSeed = devilRollSeed >> 9 ^ devilRollSeed; - if (((float)local_48 <= - (float)((double)GHIDRA_INT(devilRollSeed) + __uint_to_double_fixup[-(GHIDRA_INT(devilRollSeed) >> 0x1f)]) - * 2.3283062e-10) && ((float)local_48 < 1.0)) { - g_game->_devilRoomDisabled = 1; - ExceptionList = local_1c; - return 0; - } - } - dualityOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1f2,GHIDRA_CAST(&g_game->_playerManager),1); - game = g_game; - if (dualityOwner != GHIDRA_CAST(0x0)) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && - (_Init_thread_header(&g_invalidRoomDescriptorGuard,uVar4), g_invalidRoomDescriptorGuard == -1 - )) { - local_14 = 0; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); - _atexit(FUN_00b15b30); - local_14 = 0xffffffff; - _Init_thread_footer(&g_invalidRoomDescriptorGuard); - } - roomDesc = &g_roomDescriptorDummy; - if (GHIDRA_UINT(game->_currentDimensionIdx) < 3) { - roomDesc = game->_roomList + 0x1fb; - } - if (roomDesc->Data == (void *)0x0) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_84)) + 0x4))) = 2; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_84)) + 0x8))) = 5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_84)) + 0x0))) = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); - local_78 = 0x15; - local_28 = (float)(GHIDRA_CAST((GHIDRA_CAST(local_84))))->RNG::RandomInt(8); - local_58 = 0; - freeSlotsCapacity = GHIDRA_CAST(0x0); - local_14 = 1; - msvc::vector::_Reallocate(4); - local_2c = (void **)0x0; - piVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x4))); - do { - room = savedRoom; - local_48 = GHIDRA_CAST((GHIDRA_INT(local_28) + GHIDRA_INT(local_2c) & 0x80000007)); - if (GHIDRA_INT(local_48) < 0) { - local_48 = GHIDRA_CAST(((GHIDRA_UINT((local_48 + -1)) | 0xfffffff8) + 1)); - } - local_3c = local_48; - if (((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedRoom)) + 0x4)))) + 0x10)) + 0x38 + - (GHIDRA_UINT(local_48) >> 5) * 4)) & 1 << ((uint8_t)local_48 & 0x1f)) != 0) && - (savedRoom->_doors[GHIDRA_INT(local_48)] == (void *)0x0)) { - if (piVar5 == freeSlotsCapacity) { - msvc::vector::_Emplace_reallocate(piVar5,&local_48); - piVar5 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_58)) + 0x4))); - } - else { - *piVar5 = GHIDRA_INT(local_48); - local_58 = CONCAT44(piVar5 + 1,GHIDRA_CAST(local_58)); - piVar5 = piVar5 + 1; - } - } - local_2c = (void **)(GHIDRA_INT(local_2c) + 1); - } while (GHIDRA_INT(local_2c) < 8); - if (1 < GHIDRA_UINT((GHIDRA_INT(piVar5) - GHIDRA_INT(GHIDRA_CAST(local_58)) >> 2))) { - RNG::Shuffle(GHIDRA_CAST(local_84),GHIDRA_CAST(local_58),piVar5); - local_40 = 0; - do { - uVar4 = *GHIDRA_CAST((GHIDRA_INT(GHIDRA_CAST(local_58)) + local_40 * 4)); - local_38 = room->_doors + uVar4; - if (room->_doors[uVar4] == (void *)0x0) { - MakeDoor(room,uVar4); - } - if ((local_40 == 0) || (isAngelDoorPlaced != '\0')) { - TargetRoomType = (void **)0xe; - local_2c = (void **)0xe; - if (isAngelDoorPlaced == '\0') goto LAB_007f86a4; - } - else { - local_2c = (void **)0xf; -LAB_007f86a4: - bVar3 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,7); - if (bVar3 == 0) { - TargetRoomType = local_2c; - if (local_2c != (void **)0xf) goto LAB_007f86ce; - } - else { - TargetRoomType = (void **)2.10195e-44; - } - isAngelDoorPlaced = '\x01'; - } -LAB_007f86ce: - (GHIDRA_CAST((*local_38)))->GridEntity_Door::SetRoomTypes(1,GHIDRA_INT(TargetRoomType)); - *GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x394)) = 0xffffffff; - (GHIDRA_CAST((*local_38)))->GridEntity_Door::Open(); - if (isAnimate != 0) { - uVar4 = uVar4 & 0x80000003; - if (GHIDRA_INT(uVar4) < 0) { - uVar4 = (uVar4 - 1 | 0xfffffffc) + 1; - } - doorDir = Isaac::GetAxisAlignedUnitVectorFromDir(GHIDRA_CAST((local_84 + 8)),uVar4); - local_2c = (void **)-doorDir->x; - local_3c = GHIDRA_CAST((GHIDRA_UINT(doorDir->y) ^ 0x80000000)); - uVar4 = Random(); - local_28 = 0.0; - local_4c = (float)((uVar4 & 3) + 5); - if (local_4c != 0.0) { - local_48 = GHIDRA_CAST((GHIDRA_UINT(local_2c) ^ 0x80000000)); - do { - local_64 = Random(); - uVar4 = Random(); - local_44 = (uint8_t *) - ((float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * - 5.0); - uVar4 = Random(); - fVar8 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - * 2.3283064e-10; - fVar8 = (fVar8 + fVar8) - 1.0; - local_6c.x = fVar8 * (float)local_3c + (float)local_2c * (float)local_44; - local_6c.y = fVar8 * (float)local_48 + (float)local_3c * (float)local_44; - iVar7 = *GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x24)); - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - uVar4 = Random(); - local_60 = (float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * - 3.14; - local_60 = local_60 + local_60; - uVar4 = Random(); - local_44 = (uint8_t *) - ((float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * - 20.0); - fVar8 = cos(local_60); - local_74.x = fVar8 * (float)local_44 + (float)(iVar7 % iVar6) * 40.0 + 40.0; - angleSin = sin(local_60); - fVar8 = local_28; - uVar12 = 0; - pTVar11 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - pTVar10 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - local_74.y = angleSin * (float)local_44 + (float)(iVar7 / iVar6) * 40.0 + 120.0; - uVar9 = 0; - dustEffect = Game::Spawn(g_game,1000,0x3b,&local_74,&local_6c,GHIDRA_CAST(0x0), - GHIDRA_UINT((local_28 == 0.0)),local_64); - piVar5 = GHIDRA_CAST(__RTDynamicCast(dustEffect,uVar9,pTVar10,pTVar11,uVar12)); - local_44 = GHIDRA_CAST(0x3f800000); - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - if (((float)piVar5[0xd0] - - ((float)(*GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x24)) / iVar7) * 40.0 + 120.0)) * - (float)local_48 + - ((float)piVar5[0xcf] - - ((float)(*GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x24)) % iVar7) * 40.0 + 40.0)) * - (float)local_3c < 0.0) { - local_44 = &DAT_bf800000; - } - uVar4 = Random(); - piVar5[0x11d] = - GHIDRA_INT((((float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * - 10.0 + 2.0) * (float)local_44)); - uVar4 = Random(); - iVar7 = uVar4 % 10 + 0x1e; - piVar5[0x117] = iVar7; - piVar5[0x118] = iVar7; - (**(code **)(*piVar5 + 0xc))(); - local_28 = (float)(GHIDRA_INT(fVar8) + 1); - room = savedRoom; - } while (GHIDRA_INT(local_28) < GHIDRA_INT(local_4c)); - } - } - manager = g_manager; - local_40 = local_40 + 1; - } while (local_40 < 2); - if (isAnimate != 0) { - local_28 = 4.48416e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_28)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_28),1.0,2,0,1.0,0.0); - manager = g_manager; - local_28 = 3.22299e-44; - seed_fart_sound_override(GHIDRA_CAST(&local_28)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_28),1.0,2,0,1.0,0.0); - } - if ((g_game->_stageType == 4) || (g_game->_stageType == 5)) { - iVar7 = g_game->_stage + 1; - } - else { - iVar7 = g_game->_stage; - } - if (iVar7 < 1) { - iVar7 = 0; - } - iVar6 = 0xd; - if (iVar7 < 0xd) { - iVar6 = iVar7; - } - g_game->_lastDevilRoomStage = iVar6; - if (GHIDRA_CAST(local_58) != (void *)0x0) { - uVar4 = GHIDRA_INT(freeSlotsCapacity) - GHIDRA_INT(GHIDRA_CAST(local_58)) & 0xfffffffc; - ptr = GHIDRA_CAST(local_58); - if (0xfff < uVar4) { - ptr = *(void **)(GHIDRA_INT(GHIDRA_CAST(local_58)) + -4); - uVar4 = uVar4 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(GHIDRA_CAST(local_58)) + (-4 - GHIDRA_INT(ptr))))) goto LAB_007f8b59; - } - operator_delete(ptr,uVar4); - } - ExceptionList = local_1c; - return 1; - } - local_14 = 0xffffffff; - if (GHIDRA_CAST(local_58) != GHIDRA_CAST(0x0)) { - uVar4 = GHIDRA_INT(freeSlotsCapacity) - GHIDRA_INT(GHIDRA_CAST(local_58)) & 0xfffffffc; - piVar5 = GHIDRA_CAST(local_58); - if (0xfff < uVar4) { - piVar5 = GHIDRA_CAST((GHIDRA_CAST(local_58))[-1]); - uVar4 = uVar4 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(GHIDRA_CAST(local_58)) + (-4 - GHIDRA_INT(piVar5))))) { -LAB_007f8b59: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(piVar5,uVar4); - local_58 = 0; - freeSlotsCapacity = GHIDRA_CAST(0x0); - } - } - } - game = g_game; - bVar3 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,7); - Level::InitializeDevilAngelRoom(GHIDRA_CAST(game),bVar3 != 0,0); - game = g_game; - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && - (_Init_thread_header(&g_invalidRoomDescriptorGuard), g_invalidRoomDescriptorGuard == -1)) { - local_14 = 2; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); - _atexit(FUN_00b15b30); - local_14 = 0xffffffff; - _Init_thread_footer(&g_invalidRoomDescriptorGuard); - } - flagsGame = g_game; - if (GHIDRA_UINT(game->_currentDimensionIdx) < 3) { - roomDesc = game->_roomList + 0x1fb; - } - else { - roomDesc = &g_roomDescriptorDummy; - } - local_2c = &roomDesc->Data; - fVar8 = (float)g_game->_enterDoor; - if ((((g_game->_lastRoomIdx != -1) || (GHIDRA_INT(fVar8) < 0)) || - ((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedRoom)) + 0x4)))) + 0x10)) + 0x38 + (GHIDRA_UINT(fVar8) >> 5) * 4)) & - 1 << (SUB41(fVar8,0) & 0x1f)) == 0)) || (savedRoom->_doors[GHIDRA_INT(fVar8)] != (void *)0x0)) { - local_38 = *(void ***)&(*GHIDRA_CAST((GHIDRA_CAST((savedRoom)) + 0x4))); - local_4c = *GHIDRA_CAST((GHIDRA_CAST(local_38) + 0x58)); - local_58 = 0x500000002; - local_64 = 0x15; - if (local_4c == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - bVar3 = (*pcVar1)(); - return bVar3; - } - uVar4 = GHIDRA_UINT(local_4c) >> 2 ^ GHIDRA_UINT(local_4c); - uVar4 = uVar4 << 5 ^ uVar4; - local_40 = (uVar4 >> 0x15 ^ uVar4) & 7; - if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) { - local_40 = 4; - } - local_28 = 0.0; - do { - local_4c = (float)(GHIDRA_INT(local_28) + local_40 & 0x80000007); - if (GHIDRA_INT(local_4c) < 0) { - local_4c = (float)((GHIDRA_INT(local_4c) - 1U | 0xfffffff8) + 1); - } - uVar4 = GHIDRA_INT(local_4c) + 2U & 0x80000003; - if (GHIDRA_INT(uVar4) < 0) { - uVar4 = (uVar4 - 1 | 0xfffffffc) + 1; - } - if ((((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_38) + 0x10)) + 0x38 + (GHIDRA_UINT(local_4c) >> 5) * 4)) & - 1 << (SUB41(local_4c,0) & 0x1f)) != 0) && - ((*GHIDRA_CAST((GHIDRA_INT(*local_2c) + (uVar4 >> 5) * 4 + 0x38)) & 1 << ((uint8_t)uVar4 & 0x1f)) != 0)) - && (savedRoom->_doors[GHIDRA_INT(local_4c)] == (void *)0x0)) { - fVar8 = local_4c; - if (-1 < GHIDRA_INT(local_4c)) goto LAB_007f8d89; - break; - } - local_28 = (float)(GHIDRA_INT(local_28) + 1); - } while (GHIDRA_INT(local_28) < 8); - local_28 = 0.0; - while( true ) { - fVar8 = (float)(local_40 + GHIDRA_INT(local_28) & 0x80000007); - if (GHIDRA_INT(fVar8) < 0) { - fVar8 = (float)((GHIDRA_INT(fVar8) - 1U | 0xfffffff8) + 1); - } - if (((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_38) + 0x10)) + 0x38 + (GHIDRA_UINT(fVar8) >> 5) * 4)) & - 1 << (SUB41(fVar8,0) & 0x1f)) != 0) && (savedRoom->_doors[GHIDRA_INT(fVar8)] == (void *)0x0)) - break; - local_28 = (float)(GHIDRA_INT(local_28) + 1); - if (7 < GHIDRA_INT(local_28)) { - ExceptionList = local_1c; - return 0; - } - } - if (GHIDRA_INT(fVar8) < 0) { - ExceptionList = local_1c; - return 0; - } - } -LAB_007f8d89: - local_2c = *(void ***)(GHIDRA_INT(*local_2c) + 8); - if (local_2c == (void **)0xe) { - *GHIDRA_CAST(&g_game->_gameStateFlags) = GHIDRA_UINT(g_game->_gameStateFlags) | 0x20; - } - else { - if (local_2c != (void **)0xf) goto LAB_007f8dc6; - *GHIDRA_CAST(&g_game->_gameStateFlags) = GHIDRA_UINT(g_game->_gameStateFlags) | 1; - } - *GHIDRA_CAST((GHIDRA_INT(&flagsGame->_gameStateFlags) + 4)) = - *GHIDRA_CAST((GHIDRA_INT(&flagsGame->_gameStateFlags) + 4)); -LAB_007f8dc6: - door = savedRoom->_doors[GHIDRA_INT(fVar8)]; - local_38 = savedRoom->_doors + GHIDRA_INT(fVar8); - if (door == GHIDRA_CAST(0x0)) { - MakeDoor(savedRoom,GHIDRA_INT(fVar8)); - door = *local_38; - } - (GHIDRA_CAST((door)))->GridEntity_Door::SetRoomTypes(1,GHIDRA_INT(local_2c)); - *GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x394)) = 0xffffffff; - (GHIDRA_CAST((*local_38)))->GridEntity_Door::Open(); - game = g_game; - if ((g_game->_stageType == 4) || (g_game->_stageType == 5)) { - iVar7 = g_game->_stage + 1; - } - else { - iVar7 = g_game->_stage; - } - if (iVar7 < 1) { - iVar7 = 0; - } - iVar6 = 0xd; - if (iVar7 < 0xd) { - iVar6 = iVar7; - } - g_game->_lastDevilRoomStage = iVar6; - manager = g_manager; - if (isAnimate != 0) { - local_28 = 4.48416e-43; - if (local_2c != (void **)0xe) { - local_28 = 3.22299e-44; - } - seed_fart_sound_override(GHIDRA_CAST(&local_28)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_28),1.0,2,0,1.0,0.0); - uVar4 = GHIDRA_UINT(fVar8) & 0x80000003; - if (GHIDRA_INT(uVar4) < 0) { - uVar4 = (uVar4 - 1 | 0xfffffffc) + 1; - } - doorDir = Isaac::GetAxisAlignedUnitVectorFromDir(GHIDRA_CAST((local_84 + 8)),uVar4); - local_28 = -doorDir->x; - local_44 = GHIDRA_CAST((GHIDRA_UINT(doorDir->y) ^ 0x80000000)); - uVar4 = Random(); - local_40 = (uVar4 & 3) + 5; - if (local_40 != 0) { - local_60 = -local_28; - local_2c = (void **)GHIDRA_UINT((local_2c == (void **)0xe)); - do { - local_64 = Random(); - uVar4 = Random(); - local_4c = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 5.0; - uVar4 = Random(); - fVar8 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10; - fVar8 = (fVar8 + fVar8) - 1.0; - local_74.x = local_4c * local_28 + fVar8 * (float)local_44; - local_74.y = local_60 * fVar8 + local_4c * (float)local_44; - iVar7 = *GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x24)); - iVar6 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - uVar4 = Random(); - fVar8 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_3c = GHIDRA_CAST((fVar8 + fVar8)); - uVar4 = Random(); - local_48 = (uint8_t *) - ((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 20.0); - fVar8 = cos((float)local_3c); - local_6c.x = fVar8 * (float)local_48 + (float)(iVar7 % iVar6) * 40.0 + 40.0; - fVar8 = sin((float)local_3c); - uVar12 = 0; - pTVar11 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; - local_6c.y = fVar8 * (float)local_48 + (float)(iVar7 / iVar6) * 40.0 + 120.0; - pTVar10 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar9 = 0; - dustEffect = Game::Spawn(g_game,1000,0x3b,&local_6c,&local_74,GHIDRA_CAST(0x0),GHIDRA_UINT(local_2c), - local_64); - piVar5 = GHIDRA_CAST(__RTDynamicCast(dustEffect,uVar9,pTVar10,pTVar11,uVar12)); - local_3c = GHIDRA_CAST(0x3f800000); - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - if (((float)piVar5[0xcf] - ((float)(*GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x24)) % iVar7) * 40.0 + 40.0)) - * (float)local_44 + - ((float)piVar5[0xd0] - ((float)(*GHIDRA_CAST((GHIDRA_INT(*local_38) + 0x24)) / iVar7) * 40.0 + 120.0) - ) * local_60 < 0.0) { - local_3c = &DAT_bf800000; - } - uVar4 = Random(); - piVar5[0x11d] = - GHIDRA_INT((((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 * 10.0 + 2.0) * (float)local_3c)); - uVar4 = Random(); - iVar7 = uVar4 % 10 + 0x1e; - piVar5[0x117] = iVar7; - piVar5[0x118] = iVar7; - (**(code **)(*piVar5 + 0xc))(); - local_40 = local_40 - 1; - } while (local_40 != 0); - } - game = g_game; - } - uVar4 = (game->_devilAngelRoomRNG)._seed; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar4 = (game->_devilAngelRoomRNG)._seed; - if (uVar4 == 0) { - pcVar1 = (code *)swi(3); - bVar3 = (*pcVar1)(); - return bVar3; - } - } - uVar4 = uVar4 >> ((uint8_t)(game->_devilAngelRoomRNG)._shift1 & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)(game->_devilAngelRoomRNG)._shift2 & 0x1f) ^ uVar4; - (game->_devilAngelRoomRNG)._seed = - uVar4 >> ((uint8_t)(game->_devilAngelRoomRNG)._shift3 & 0x1f) ^ uVar4; - ExceptionList = local_1c; - return 1; -} - -// 007f92b0 -float Room::GetDevilRoomChance() -{ - uint8_t isHasEffect; - Entity_Player *owner; - int iVar1; - RoomDescriptor *currentRoom; - int iVar2; - float chance; - Game *game; - - chance = 0.01; - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x33,GHIDRA_CAST(&g_game->_playerManager),1); - if (owner != GHIDRA_CAST(0x0)) { - chance = 0.11; - } - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x104,GHIDRA_CAST(&g_game->_playerManager),1); - if (owner != GHIDRA_CAST(0x0)) { - chance = chance + 0.15; - } - iVar1 = PlayerManager::GetNumCollectibles(&g_game->_playerManager,0x33); - if (1 < iVar1) { - chance = chance + 0.05; - } - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x22,GHIDRA_CAST(&g_game->_playerManager),1); - if ((owner != GHIDRA_CAST(0x0)) || - (owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x3b,GHIDRA_CAST(&g_game->_playerManager),1), - owner != GHIDRA_CAST(0x0))) { - chance = chance + 0.125; - } - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x4e,GHIDRA_CAST(&g_game->_playerManager),1); - if (owner != GHIDRA_CAST(0x0)) { - chance = chance + 0.175; - } - if ((g_game->_levelStateFlags & 1) != 0) { - chance = chance + 0.35; - } - currentRoom = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,-1); - if ((g_game->_lastBossRoomListIdx == currentRoom->ListIndex) && - (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x120c)) != '\0')) { - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x259,GHIDRA_CAST(&g_game->_playerManager),1); - if (owner != GHIDRA_CAST(0x0)) { - chance = chance + 0.15; - } - } - else { - chance = chance + 0.35; - } - if ((g_game->_levelStateFlags & 4) == 0) { - chance = chance + 0.99; - } - else { - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x259,GHIDRA_CAST(&g_game->_playerManager),1); - if (owner != GHIDRA_CAST(0x0)) { - chance = chance + 0.4; - } - } - if ((g_game->_levelStateFlags & 0x40) != 0) { - chance = chance + 0.1; - } - owner = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0xae); - if (owner != GHIDRA_CAST(0x0)) { - iVar1 = (GHIDRA_CAST((owner)))->Entity_Player::GetTrinketMultiplier(0xae); - if (iVar1 == 1) { - chance = chance + 0.1; - } - else if (iVar1 == 2) { - chance = chance + 0.15; - } - else if (iVar1 == 3) { - chance = chance + 0.2; - } - } - owner = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,7); - if (owner != GHIDRA_CAST(0x0)) { - iVar1 = (GHIDRA_CAST((owner)))->Entity_Player::GetTrinketMultiplier(7); - if (iVar1 == 2) { - chance = chance + 0.05; - } - else if (iVar1 == 3) { - chance = chance + 0.1; - } - } - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x29d,GHIDRA_CAST(&g_game->_playerManager),1); - game = g_game; - if (owner != GHIDRA_CAST(0x0)) { - chance = chance + 0.069; - } - iVar2 = FUN_0041b770(0x124); - iVar1 = game->_lastDevilRoomStage; - chance = (float)((double)iVar2 + __uint_to_double_fixup[-(iVar2 >> 0x1f)]) * 0.1 + chance; - if (iVar1 != 0) { - if ((game->_stageType == 4) || (game->_stageType == 5)) { - iVar2 = game->_stage + 1; - } - else { - iVar2 = game->_stage; - } - if ((iVar2 == iVar1) || (iVar2 - iVar1 == 1)) { - chance = chance * 0.25; - } - else if (iVar2 - iVar1 == 2) { - chance = chance * 0.5; - } - } - if (game->_devilRoomDisabled != 0) { - chance = 0.0; - } - owner = PlayerManager::FirstCollectibleOwner - (&game->_playerManager,0xd7,GHIDRA_CAST(&game->_playerManager),1); - if ((owner != GHIDRA_CAST(0x0)) || - (isHasEffect = (GHIDRA_CAST((&this->_temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0xd7), - isHasEffect != 0)) { - chance = 66.6; - } - if (((g_game->_dailyChallenge)._specialDailyId == 0x11) && - ((g_game->_gameStateFlags & 0x20000000) == 0)) { - chance = 1.0; - } - owner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,499,GHIDRA_CAST(&g_game->_playerManager),1); - if (owner != GHIDRA_CAST(0x0)) { - chance = 1.0; - } - iVar1 = g_game->_difficulty; - if (((iVar1 == 2) || (iVar1 == 3)) && - (chance = 1.0, GHIDRA_UINT(g_game->_greedModeWave) < (iVar1 == 3) + 0xb)) { - chance = 0.0; - } - return chance; -} - -// 007f9960 -uint8_t Room::TrySpawnBossRushDoor(uint8_t isIgnoreTime, uint8_t isForce) -{ - uint32_t *puVar1; - int iVar2; - code *pcVar3; - uint8_t bVar4; - RoomDescriptor *currentRoom; - uint32_t forcedCurses; - uint32_t preventedCurses; - Entity_Player *shovelOwner; - void **doorSlot; - GridEntity_Door *this_00; - Game *game; - uint32_t uVar5; - uint32_t uVar6; - float dy; - float dx; - uint32_t entityIndex; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - int *entity; - int gridWidth; - int updateList; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00b01359; - local_10 = ExceptionList; - ExceptionList = &local_10; - if ((isForce != 0) || - (((((g_game->_challenge != 0x2c && - (((this->_roomType != 5 || - (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10)) != 0x59)) || - (bVar4 = Level::IsPreAscent(GHIDRA_CAST(g_game)), bVar4 == 0)))) && - (((g_game->_stage < 1 || (6 < g_game->_stage)) || - ((g_game->_gameStateFlags & 0x1000000000000) == 0)))) && - ((g_game->_currentDimensionIdx == 0 && - (currentRoom = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,-1), - currentRoom->ListIndex == g_game->_lastBossRoomListIdx)))) && - (bVar4 = Level::IsMausoleumHeartStage(GHIDRA_CAST(g_game)), bVar4 == 0)))) { - uVar6 = g_game->_debugCurses; - uVar5 = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - updateList = g_game->_stage; - if ((~preventedCurses & (forcedCurses | uVar6 | uVar5) & 2) != 0) { - updateList = updateList + 1; - } - if ((isForce != 0) || (updateList == 6)) { - updateList = 0; - doorSlot = this->_doors; - do { - if ((*doorSlot != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_INT(*doorSlot) + 0x394)) == -5)) { - ExceptionList = local_10; - return 0; - } - updateList = updateList + 1; - doorSlot = doorSlot + 1; - } while (updateList < 8); - shovelOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x226,GHIDRA_CAST(&g_game->_playerManager),1); - if (shovelOwner != GHIDRA_CAST(0x0)) { - isIgnoreTime = 1; - } - KAGE_LogMessage(1,GHIDRA_CAST("Mom clear time: %d\n")); - KAGE_LogMessage(1,GHIDRA_CAST("Par time: %d\n")); - if (((g_game->_timeCounter <= g_game->_bossRushParTime) || (isIgnoreTime != 0)) || - (isForce != 0)) { - KAGE_LogMessage(1,GHIDRA_CAST("Spawning boss rush door\n")); - uVar6 = g_game->_enterDoor; - if (((g_game->_lastRoomIdx != -5) || (GHIDRA_INT(uVar6) < 0)) || - (this->_doors[uVar6] != (void *)0x0)) { - uVar5 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - bVar4 = (*pcVar3)(); - return bVar4; - } - uVar5 = uVar5 >> 1 ^ uVar5; - updateList = 0; - uVar5 = uVar5 << 0xb ^ uVar5; - do { - uVar6 = updateList + ((uVar5 >> 0x10 ^ uVar5) & 7) & 0x80000007; - if (GHIDRA_INT(uVar6) < 0) { - uVar6 = (uVar6 - 1 | 0xfffffff8) + 1; - } - } while ((((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x38 + (uVar6 >> 5) * 4)) - & 1 << ((uint8_t)uVar6 & 0x1f)) == 0) || (this->_doors[uVar6] != (void *)0x0)) && - (updateList = updateList + 1, updateList < 8)); - if (GHIDRA_INT(uVar6) < 0) { - ExceptionList = local_10; - return 0; - } - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && - (_Init_thread_header(&g_invalidRoomDescriptorGuard), g_invalidRoomDescriptorGuard == -1)) - { - uStack_8 = 0; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); - _atexit(FUN_00b15b30); - uStack_8 = 0xffffffff; - _Init_thread_footer(&g_invalidRoomDescriptorGuard); - } - this_00 = this->_doors[uVar6]; - if (this_00 == GHIDRA_CAST(0x0)) { - MakeDoor(this,uVar6); - this_00 = this->_doors[uVar6]; - } - GridEntity_Door::SetRoomTypes - (this_00,*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 8)),0x11); - *GHIDRA_CAST((GHIDRA_INT(this->_doors[uVar6]) + 0x394)) = 0xfffffffb; - (GHIDRA_CAST((this->_doors[uVar6])))->GridEntity_Door::Open(); - (GHIDRA_CAST((this->_doors[uVar6])))->GridEntity_Door::SpawnDust(); - game = g_game; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)); - *puVar1 = *puVar1 | 0x40; - *GHIDRA_CAST(&game->_gameStateFlags) = GHIDRA_INT(game->_gameStateFlags); - if (isIgnoreTime != 0) { - updateList = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))); - uVar5 = (this->_entityList)._updateEL._size; - uStack_8 = 1; - entityIndex = 0; - if (uVar5 != 0) { - do { - entity = *GHIDRA_CAST((updateList + entityIndex * 4)); - if ((entity[10] == 0x2d) && (entity[0xb] == 0)) { - iVar2 = *GHIDRA_CAST((GHIDRA_INT(this->_doors[uVar6]) + 0x24)); - gridWidth = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - dx = ((float)(iVar2 % gridWidth) * 40.0 + 40.0) - (float)entity[0xcf]; - dy = ((float)(iVar2 / gridWidth) * 40.0 + 120.0) - (float)entity[0xd0]; - if (dy * dy + dx * dx < 2500.0) { - (**(code **)(*entity + 0x28))(); - } - game = g_game; - } - entityIndex = entityIndex + 1; - } while (entityIndex < uVar5); - } - } - ExceptionList = local_10; - return 1; - } - KAGE_LogMessage(1,GHIDRA_CAST("Did not meet par time, did not spawn boss rush door.\n")); - } - } - ExceptionList = local_10; - return 0; -} - -// 007f9df0 -uint8_t Room::TrySpawnMegaSatanRoomDoor(uint8_t isForce) -{ - char isChallengeOrDaily; - char extraout_DL; - Game *game; - - game = g_game; - Game::GetChallengeParams(g_game); - if (isForce == 0) { - if (game->_currentRoomIdx != game->_startingRoomIdx) { - return 0; - } - if (game->_stage != 0xb) { - return 0; - } - if (game->_currentDimensionIdx != 0) { - return 0; - } - if ((g_manager->_persistentGameData)._achievements[0x9b] == 0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2) { - return 0; - } - if (((game->_dailyChallenge)._id == 0) && (game->_isDebug == 0)) { - return 0; - } - } - isChallengeOrDaily = Game::IsChallengeOrDaily(game); - if ((isChallengeOrDaily != '\0') && (extraout_DL == '\0')) { - return 0; - } - } - KAGE_LogMessage(1,GHIDRA_CAST("Spawning Mega Satan door\n")); - if (this->_doors[1] == (void *)0x0) { - MakeDoor(this,1); - *GHIDRA_CAST((GHIDRA_INT(this->_doors[1]) + 0x394)) = 0xfffffff9; - GridEntity_Door::SetRoomTypes - (this->_doors[1],*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 8)),5); - return 1; - } - KAGE_LogMessage(1,GHIDRA_CAST("[warn] no space for Mega Satan door\n")); - return 0; -} - -// 007f9ee0 -void Room::clear_reward_position(Vector *position) -{ - int gridY; - uint32_t gridCollision; - Vector *freePos; - int iVar1; - int gridIndex; - GridEntity *pit; - GridEntity *local_3c; - Vector local_38; - uint32_t local_30; - uint32_t local_2c; - uint32_t local_28; - uint32_t local_24; - float local_20; - float local_1c; - float local_18; - float local_14; - uint32_t local_10; - uint32_t local_c; - int *gridEntity; - - iVar1 = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - if ((((iVar1 < 0) || (this->_gridWidth <= iVar1)) || - (gridY = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)), gridY < 0)) || - (this->_gridHeight <= gridY)) { - gridIndex = -1; -LAB_007f9f79: - pit = GHIDRA_CAST(0x0); -LAB_007f9f7f: - local_30 = 0; - local_2c = 0; - local_28 = 0; - local_24 = 0; - local_20 = g_vectorZero.x; - local_1c = g_vectorZero.y; - local_18 = g_vectorZero.x; - local_14 = g_vectorZero.y; - local_10 = 0; - local_c = 0; - if ((GHIDRA_UINT(gridIndex) < GHIDRA_CAST(0x1c0)) && - (gridEntity = this->_gridEntities[gridIndex], gridEntity != GHIDRA_CAST(0x0))) { - if (gridEntity[1] == 5) { - gridEntity[1] = 2; - } - (**(code **)(*gridEntity + 0x14))(1,&local_30); - } - if (pit == GHIDRA_CAST(0x0)) goto LAB_007fa044; - } - else { - gridIndex = this->_gridWidth * gridY + iVar1; - if (0x1bf < GHIDRA_UINT(gridIndex)) goto LAB_007f9f79; - pit = this->_gridEntities[gridIndex]; - local_3c = pit; - if ((pit == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pit)) + 0x4)))) != 7)) goto LAB_007f9f7f; - TryMakeBridge(this,pit,GHIDRA_CAST(0x0)); - pit = local_3c; - } - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pit)) + 0x4)))) == 0xe) && - (local_3c = GHIDRA_CAST(gridIndex), GHIDRA_UINT(gridIndex) < GHIDRA_CAST(0x1c0))) && - ((this->_gridEntities[gridIndex] != (void *)0x0 && - (*GHIDRA_CAST((GHIDRA_INT(this->_gridEntities[gridIndex]) + 4)) != 1)))) { - this->_gridPaths[gridIndex] = 900; - msvc::set::insert(&local_38,&local_3c); - } -LAB_007fa044: - iVar1 = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - gridY = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)); - if ((((iVar1 < 0) || (this->_gridWidth <= iVar1)) || (gridY < 0)) || (this->_gridHeight <= gridY)) - { - iVar1 = -1; - } - else { - iVar1 = this->_gridWidth * gridY + iVar1; - } - gridCollision = GetGridCollision(this,iVar1); - if (gridCollision != 0) { - freePos = FindFreePickupSpawnPosition(this,&local_38,position,0.0,0,0,0); - position->x = freePos->x; - position->y = freePos->y; - } - return; -} - -// 007fa0e0 -void Room::clear_grid_for_pickup(int *gridIndex) -{ - uint32_t gridCollision; - Vector *freePos; - int gridY; - int gridX; - float index; - Vector local_40; - Vector VStack_38; - uint32_t destroySource; - uint32_t local_2c; - uint32_t local_28; - uint32_t local_24; - float local_20; - float local_1c; - float local_18; - float local_14; - uint32_t local_10; - uint32_t local_c; - int *gridEntity; - void *poopGrid; - - destroySource = 0; - local_2c = 0; - local_28 = 0; - local_24 = 0; - local_20 = g_vectorZero.x; - local_1c = g_vectorZero.y; - local_18 = g_vectorZero.x; - local_14 = g_vectorZero.y; - local_10 = 0; - local_c = 0; - if ((GHIDRA_UINT(*gridIndex) < 0x1c0) && - (gridEntity = this->_gridEntities[*gridIndex], gridEntity != GHIDRA_CAST(0x0))) { - if (gridEntity[1] == 5) { - gridEntity[1] = 2; - } - (**(code **)(*gridEntity + 0x14))(1,&destroySource); - } - index = (float)*gridIndex; - if ((((GHIDRA_UINT(index) < 0x1c0) && - (poopGrid = this->_gridEntities[GHIDRA_INT(index)], poopGrid != (void *)0x0)) && - (*GHIDRA_CAST((GHIDRA_CAST(poopGrid) + 4)) == 0xe)) && - ((local_40.x = index, poopGrid != (void *)0x0 && (*GHIDRA_CAST((GHIDRA_CAST(poopGrid) + 4)) != 1)))) { - this->_gridPaths[GHIDRA_INT(index)] = 900; - msvc::set::insert(&VStack_38,&local_40); - index = (float)*gridIndex; - } - gridCollision = GetGridCollision(this,GHIDRA_INT(index)); - if (gridCollision != 0) { - local_40.x = (float)(GHIDRA_INT(index) % this->_gridWidth) * 40.0 + 40.0; - local_40.y = (float)(GHIDRA_INT(index) / this->_gridWidth) * 40.0 + 120.0; - freePos = FindFreePickupSpawnPosition(this,&VStack_38,&local_40,0.0,0,0,0); - gridX = GHIDRA_INT(((freePos->x - 40.0) / 40.0 + 0.5)); - if (((-1 < gridX) && (gridX < this->_gridWidth)) && - ((gridY = GHIDRA_INT(((freePos->y - 120.0) / 40.0 + 0.5)), -1 < gridY && (gridY < this->_gridHeight) - ))) { - *gridIndex = this->_gridWidth * gridY + gridX; - return; - } - *gridIndex = -1; - } - return; -} - -// 007fa360 -void Room::remove_grid_entity_for_spawn(int *gridIndex) -{ - int *piVar1; - uint32_t uVar2; - int iVar3; - int npcGridIndex; - void *listData; - Vector *freePos; - int iVar4; - float npcIndex; - float neighborY; - uint32_t neighborDestroyRef; - uint32_t local_80; - uint32_t local_7c; - uint32_t local_78; - float local_74; - float local_70; - float local_6c; - float local_68; - uint32_t local_64; - uint32_t local_60; - uint32_t destroyRef; - uint32_t local_58; - uint32_t local_54; - uint32_t local_50; - float local_4c; - float local_48; - float local_44; - float local_40; - uint32_t local_3c; - uint32_t local_38; - uint8_t local_34 [8]; - Vector local_2c; - Vector local_24; - int rowsLeft; - int dx; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *gridEntity; - GridEntity_Pit *neighborGrid; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0138d; - local_10 = ExceptionList; - uVar2 = __security_cookie ^ GHIDRA_UINT((local_34 + 0x30)); - ExceptionList = &local_10; - if (-1 < *gridIndex) { - gridEntity = this->_gridEntities[*gridIndex]; - if (gridEntity != GHIDRA_CAST(0x0)) { - if (gridEntity[1] == 7) { - this->_gridPaths[gridEntity[9]] = 0; - this->_gridEntities[gridEntity[9]] = (void *)0x0; - (**(code **)*gridEntity)(1); - local_24.y = (float)(*gridIndex % this->_gridWidth); - dx = -1; - local_2c.y = (float)(*gridIndex / this->_gridWidth - 1); - do { - npcGridIndex = dx + GHIDRA_INT(local_24.y); - rowsLeft = 3; - iVar4 = dx; - npcIndex = local_2c.y; - do { - if (((-1 < npcGridIndex) && (npcGridIndex < this->_gridWidth)) && - ((-1 < GHIDRA_INT(npcIndex) && - ((GHIDRA_INT(npcIndex) < this->_gridHeight && - (iVar3 = this->_gridWidth * GHIDRA_INT(npcIndex) + iVar4 + GHIDRA_INT(local_24.y), -1 < iVar3)))) - )) { - piVar1 = this->_gridEntities[iVar3]; - if ((piVar1 != GHIDRA_CAST(0x0)) && (piVar1[1] == 7)) { - (**(code **)(*piVar1 + 4))(); - } - iVar4 = dx; - } - npcIndex = (float)(GHIDRA_INT(npcIndex) + 1); - rowsLeft = rowsLeft + -1; - } while (rowsLeft != 0); - dx = iVar4 + 1; - } while (dx < 2); - rowsLeft = 0; - } - else { - if (gridEntity[1] == 0xe) { - EntityList::QuerySublist(&this->_entityList,GHIDRA_CAST(local_34),0x60,-1,-1,0,0); - npcIndex = 0.0; - local_8 = 0; - if (local_2c.y != 0.0) { - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_34)) + 0x4))); - do { - piVar1 = *GHIDRA_CAST((GHIDRA_CAST(listData) + GHIDRA_INT(npcIndex) * 4)); - if (piVar1[0xef] == 0) { - npcGridIndex = GHIDRA_INT((((float)piVar1[0xcd] - 40.0) / 40.0 + 0.5)); - iVar4 = GHIDRA_INT((((float)piVar1[0xce] - 120.0) / 40.0 + 0.5)); - if ((((npcGridIndex < 0) || (this->_gridWidth <= npcGridIndex)) || (iVar4 < 0)) || - (this->_gridHeight <= iVar4)) { - npcGridIndex = -1; - } - else { - npcGridIndex = this->_gridWidth * iVar4 + npcGridIndex; - } - if (npcGridIndex == *gridIndex) { - piVar1[0x2d9] = 0x10; - (**(code **)(*piVar1 + 0xc))(); - } - listData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_34)) + 0x4))); - } - npcIndex = (float)(GHIDRA_INT(npcIndex) + 1); - } while (GHIDRA_UINT(npcIndex) < GHIDRA_UINT(local_2c.y)); - } - if (local_34[0] == '\0') { - local_8 = 1; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_34)) + 0x4))),0); - } - } - local_8 = 0xffffffff; - destroyRef = 0; - local_58 = 0; - local_54 = 0; - local_50 = 0; - local_4c = g_vectorZero.x; - local_48 = g_vectorZero.y; - local_44 = g_vectorZero.x; - local_40 = g_vectorZero.y; - local_3c = 0; - local_38 = 0; - if ((GHIDRA_UINT(*gridIndex) < 0x1c0) && - (piVar1 = this->_gridEntities[*gridIndex], piVar1 != GHIDRA_CAST(0x0))) { - if (piVar1[1] == 5) { - piVar1[1] = 2; - } - (**(code **)(*piVar1 + 0x14))(1,&destroyRef,uVar2); - } - } - } - npcGridIndex = *gridIndex; - uVar2 = GetGridCollision(this,npcGridIndex); - if (uVar2 != 0) { - local_2c.x = (float)(npcGridIndex % this->_gridWidth) * 40.0 + 40.0; - local_2c.y = (float)(npcGridIndex / this->_gridWidth) * 40.0 + 120.0; - freePos = FindFreePickupSpawnPosition(this,&local_24,&local_2c,0.0,0,0,0); - npcGridIndex = GHIDRA_INT(((freePos->x - 40.0) / 40.0 + 0.5)); - iVar4 = GHIDRA_INT(((freePos->y - 120.0) / 40.0 + 0.5)); - if ((((npcGridIndex < 0) || (this->_gridWidth <= npcGridIndex)) || (iVar4 < 0)) || - (this->_gridHeight <= iVar4)) { - npcGridIndex = -1; - } - else { - npcGridIndex = this->_gridWidth * iVar4 + npcGridIndex; - } - *gridIndex = npcGridIndex; - } - iVar4 = npcGridIndex / this->_gridWidth; - npcGridIndex = npcGridIndex % this->_gridWidth; - npcIndex = (float)(npcGridIndex + 1); - npcGridIndex = npcGridIndex + -1; - if (npcGridIndex <= GHIDRA_INT(npcIndex)) { - neighborY = (float)(iVar4 + -1); - local_2c.y = npcIndex; - local_24.y = neighborY; - do { - if (GHIDRA_INT(neighborY) <= iVar4 + 1) { - do { - if (((npcGridIndex < 0) || (this->_gridWidth <= npcGridIndex)) || - ((GHIDRA_INT(neighborY) < 0 || (this->_gridHeight <= GHIDRA_INT(neighborY))))) { - uVar2 = 0xffffffff; - } - else { - uVar2 = this->_gridWidth * GHIDRA_INT(neighborY) + npcGridIndex; - } - neighborGrid = this->_gridEntities[uVar2]; - if ((neighborGrid != GHIDRA_CAST(0x0)) && - ((((piVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)), piVar1 == GHIDRA_CAST(0x0) || - (piVar1[2] != 0x10)) || (*piVar1 != 0x23)) && - ((GHIDRA_INT(uVar2) < 0 || (neighborGrid->_collisionClass != 0)))))) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((neighborGrid)) + 0x4)))) == 7) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((neighborGrid)) + 0xc)))) == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((neighborGrid)) + 0xc)))) = 2; - (GHIDRA_CAST((neighborGrid)))->GridEntity_Pit::UpdateCollision(); - } - } - else { - neighborDestroyRef = 0; - local_80 = 0; - local_7c = 0; - local_78 = 0; - local_74 = g_vectorZero.x; - local_70 = g_vectorZero.y; - local_6c = g_vectorZero.x; - local_68 = g_vectorZero.y; - local_64 = 0; - local_60 = 0; - if (uVar2 < 0x1c0) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((neighborGrid)) + 0x4)))) == 5) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((neighborGrid)) + 0x4)))) = 2; - } - neighborGrid->Destroy(1,&neighborDestroyRef); - } - } - } - neighborY = (float)(GHIDRA_INT(neighborY) + 1); - } while (GHIDRA_INT(neighborY) <= iVar4 + 1); - npcIndex = local_2c.y; - neighborY = local_24.y; - } - npcGridIndex = npcGridIndex + 1; - } while (npcGridIndex <= GHIDRA_INT(npcIndex)); - } - } - ExceptionList = local_10; - return; -} - -// 007fb250 -void Room::SpawnClearAward() -{ - Room *itemPool = this; - uint8_t *flagsHigh; - code *pcVar2; - bool bVar3; - Vector VVar4; - char cVar5; - uint8_t bVar6; - uint32_t uVar7; - Entity_Player *pEVar8; - int iVar9; - Entity_Player *pEVar10; - RNG *this_00; - Entity_Pickup *spawned; - undefined3 extraout_var; - ChallengeParam *challengeParams; - RoomDescriptor *roomDesc; - Vector *targetPos; - Entity *spawnedEntity; - uint8_t *lobbyEntry; - int extraout_ECX; - PlayerManager *playerManager; - int *piVar11; - void *trinketRngEnd; - uint32_t uVar12; - int iVar13; - float fVar14; - PersistentGameData *persistentData; - Room *roomAlias; - Game *game; - float fVar15; - float fVar16; - Vector cantrippedCardPos; - Vector leftItemPos; - Vector rightItemPos; - Vector local_e0; - Vector local_d8; - Vector tmpPos; - Vector local_c8; - Vector local_c0; - Entity_Player *local_b8; - float local_b4; - RNG awardRng; - Vector spawnPos; - uint8_t local_95; - float local_94; - Entity_Player *local_90; - Room *room; - Entity_Player *local_88; - uint8_t local_81; - Vector rewardPos; - Entity_Player *local_78; - char isShopItems; - Entity_Player *local_70; - bool local_6a; - bool local_69; - Entity_Player *local_68; - float playerColor; - float local_60; - float local_5c; - uint32_t local_58; - uint32_t local_54; - uint32_t uStack_50; - uint32_t uStack_4c; - uint32_t uStack_48; - uint32_t local_44; - uint32_t local_40; - uint32_t local_3c; - RNG local_38; - KColor local_28; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - TypeDescriptor *castDstType; - uint32_t castIsReference; - uint32_t castOffset; - TypeDescriptor *castSrcType; - uint32_t *flagsHigh; - ItemPool *itemPool; - Manager *manager; - uint64_t oldFlags; - void *trinketRngBegin; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b013bd; - local_10 = ExceptionList; - uVar7 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - awardRng._shift1 = 5; - awardRng._shift2 = 9; - awardRng._seed = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4)))) + 0x60)); - local_c0.y = 9.80909e-45; - awardRng._shift3 = 7; - room = itemPool; - local_14 = uVar7; - GetCenterPos(&rewardPos); - cVar5 = FUN_00866220(&awardRng,&rewardPos,uVar7); - if (cVar5 != '\0') { - ExceptionList = local_10; - return; - } - local_94 = (float)FUN_00823ec0(); - fVar16 = 40.0; - spawnPos.x = rewardPos.x + 0.0; - local_e0.y = rewardPos.y + 80.0; - local_b4 = 0.0; - leftItemPos.x = spawnPos.x - 40.0; - leftItemPos.y = local_e0.y + 0.0; - rightItemPos.x = spawnPos.x + 40.0; - isShopItems = '\0'; - local_70 = GHIDRA_CAST(0xffffffff); - local_d8.x = spawnPos.x - 80.0; - local_c8.y = leftItemPos.y; - local_c8.x = spawnPos.x + 80.0; - fVar15 = rewardPos.y; - rightItemPos.y = leftItemPos.y; - local_d8.y = leftItemPos.y; - local_b8 = GHIDRA_CAST(local_e0.y); - spawnPos.y = local_e0.y; - local_88 = GHIDRA_CAST(spawnPos.x); - pEVar8 = PlayerManager::FirstPlayerByType(&g_game->_playerManager,0x21); - if (pEVar8 == GHIDRA_CAST(0x0)) { - if (((g_game->_levelStateFlags & 0x20000U) != 0) && (itemPool->_roomType == 5)) { - local_70 = GHIDRA_CAST(0xfffffffe); - local_b8 = GHIDRA_CAST((fVar15 + fVar16)); - spawnPos.y = (float)local_b8; - goto LAB_007fb3f3; - } - } - else { -LAB_007fb3f3: - isShopItems = '\x01'; - } - if ((g_game->_difficulty != 2) && (g_game->_difficulty != 3)) { - piVar11 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4)))) + 0x10)); - if ((piVar11 != GHIDRA_CAST(0x0)) && ((piVar11[2] == 0x10 && (*piVar11 == 0x23)))) { - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,1,1); - PlayerManager::unlock_completion_mark(0xe); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x1ec,1); - Game::End(g_game,0xe); - goto switchD_007fd7f9_caseD_3; - } - iVar9 = itemPool->_roomType; - if ((iVar9 != 5) && (iVar9 != 0x11)) { - if ((iVar9 == 0x10) || - ((bVar6 = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)), bVar6 != 0 && - (g_game->_currentDimensionIdx == 1)))) goto switchD_007fd7f9_caseD_3; - pEVar8 = GHIDRA_CAST(RoomClear_PickVariant(&awardRng,0)); - local_90 = GHIDRA_CAST(0x0); - local_b8 = GHIDRA_CAST(0x0); - local_68 = GHIDRA_CAST(0x1); - local_88 = pEVar8; - local_78 = pEVar8; - bVar6 = PlayerManager::AnyoneHasCollectible(&g_game->_playerManager,0xf1); - if ((bVar6 != 0) && (pEVar8 != GHIDRA_CAST(0x15e))) { - iVar9 = PlayerManager::GetNumCollectibles(&g_game->_playerManager,0xf1); - local_68 = GHIDRA_CAST((iVar9 + 1)); - local_70 = GHIDRA_CAST((GHIDRA_CAST((&awardRng)))->RNG)::RandomFloat(); - fVar15 = pow(0.666,(float)GHIDRA_INT((GHIDRA_INT(local_68) - 1))); - if ((float)local_70 < fVar15 * 0.5) { - local_68 = GHIDRA_CAST(0x0); - } - } - if ((g_game->_difficulty == 1) && (pEVar8 == GHIDRA_CAST(0xa))) { - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(100); - local_68 = GHIDRA_CAST((GHIDRA_UINT(local_68) & -GHIDRA_UINT((uVar7 < 0x42)))); - } - bVar6 = Entity_Pickup::IsChest(GHIDRA_INT(pEVar8)); - if (bVar6 == 0) { - pEVar10 = PlayerManager::RandomCollectibleOwner - (&g_game->_playerManager,0x1d0,awardRng._seed,GHIDRA_CAST(0x0)); - if (pEVar10 != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((pEVar10)))->Entity_Player::GetGlyphOfBalanceDrop(GHIDRA_CAST(&local_88),GHIDRA_CAST(&local_b8)); - local_78 = local_88; - local_90 = local_b8; - pEVar8 = local_88; - } - } - if ((**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4)))) == -0x10) && - (pEVar10 = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0x96), - pEVar10 != GHIDRA_CAST(0x0))) { - iVar9 = (GHIDRA_CAST((pEVar10)))->Entity_Player::GetTrinketMultiplier(0x96); - local_68 = GHIDRA_CAST((iVar9 * GHIDRA_INT(local_68))); - } - bVar6 = PlayerManager::AnyoneHasCollectible(&g_game->_playerManager,0x202); - if ((((bVar6 == 0) || (uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(4), uVar7 != 0)) || - (GHIDRA_INT(local_68) < 1)) || - (((pEVar8 != GHIDRA_CAST(&DAT_00000014) && (pEVar8 != GHIDRA_CAST(0xa))) && - ((pEVar8 != GHIDRA_CAST(0x1e) && - ((pEVar8 != GHIDRA_CAST(0x45) && (pEVar8 != GHIDRA_CAST(0x28))))))))) { - local_6a = false; - } - else { - local_6a = true; - } - if ((((pEVar8 == GHIDRA_CAST(&DAT_00000014)) || (pEVar8 == GHIDRA_CAST(0x0))) || - (local_68 == GHIDRA_CAST(0x0))) && - (pEVar10 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1a0,GHIDRA_CAST(&g_game->_playerManager),0), - pEVar10 != GHIDRA_CAST(0x0))) { - pEVar8 = GHIDRA_CAST(&DAT_00000014); - local_78 = GHIDRA_CAST(&DAT_00000014); - (GHIDRA_CAST((&local_38)))->RNG::game_constructor(awardRng._seed,0x13); - uVar7 = (GHIDRA_CAST((this_00)))->RNG::RandomInt(3); - uVar7 = uVar7 + GHIDRA_INT(local_68); - local_68 = GHIDRA_CAST(1); - if (1 < uVar7) { - local_68 = GHIDRA_CAST(uVar7); - } -LAB_007fb6b7: - bVar6 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x54); - if ((bVar6 != 0) && - (local_88 = (Entity_Player *) - PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,0x54), - 1 < GHIDRA_INT(local_88))) { - local_70 = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0x54); - trinketRngEnd = (local_70->_trinketRNGs)._end; - if (GHIDRA_INT((GHIDRA_INT(trinketRngEnd) - GHIDRA_INT((local_70->_trinketRNGs)._begin) & 0xfffffff0U)) < 0x541 - ) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Trinket ID out of bounds!\n")); - trinketRngEnd = (local_70->_trinketRNGs)._end; - } - trinketRngBegin = (local_70->_trinketRNGs)._begin; - uVar7 = (GHIDRA_INT(trinketRngEnd) - GHIDRA_INT(trinketRngBegin) >> 4) - 1; - if (0x54 < uVar7) { - uVar7 = 0x54; - } - local_70 = GHIDRA_CAST((uVar7 * 0x10 + GHIDRA_INT(trinketRngBegin))); - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_70))))->RNG::RandomInt(10000); - uVar12 = 0x29a; - if (2 < GHIDRA_INT(local_88)) { - uVar12 = 0x514; - } - if (uVar7 < uVar12) { - local_28._red = 5.60519e-45; - local_28._green = 2.8026e-45; - local_28._blue = 4.2039e-45; - local_28._alpha = 7.00649e-45; - local_28._unk = 7; - uVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_70))))->RNG::RandomInt(5); - local_90 = GHIDRA_CAST((&local_28._red)[uVar7]); - } - } - } - else if (pEVar8 == GHIDRA_CAST(&DAT_00000014)) goto LAB_007fb6b7; - local_94 = 0.0; - pEVar10 = local_68; - if (0 < GHIDRA_INT(local_68)) { - do { - if (pEVar8 != GHIDRA_CAST(0x0)) { - FindFreePickupSpawnPosition(itemPool,&spawnPos,&rewardPos,0.0,0,0,0); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - spawned = (Entity_Pickup *) - Game::Spawn(g_game,5,GHIDRA_UINT(pEVar8),&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_UINT(local_90),uVar7); - bVar6 = Entity_Pickup::IsChest(spawned->_variant); - if (bVar6 == 0) { - local_90 = GHIDRA_CAST(spawned->_subtype); - } - if ((spawned->_type == 5) && ((extraout_ECX == 0x34 || (extraout_ECX == 0x36)))) { - bVar6 = 0; - iVar9 = GetGridIndex(itemPool,&spawnPos); - bVar6 = CanSpawnObstacleAtPosition(itemPool,iVar9,bVar6); - if (bVar6 == 0) { - Entity_Pickup::Morph(spawned,5,0x32,1,0,0,0); - local_90 = GHIDRA_CAST(0x1); - } - } - if ((local_6a != false) && (local_94 == 0.0)) { - oldFlags = spawned->_flags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); - *flagsHigh = *flagsHigh | 0x100; - *GHIDRA_CAST(&spawned->_flags) = GHIDRA_INT(oldFlags); - } - pEVar8 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x29e,GHIDRA_CAST(&g_game->_playerManager),1); - if (pEVar8 != GHIDRA_CAST(0x0)) { - spawn_options_alternative(itemPool,spawned); - } - pEVar10 = local_68; - pEVar8 = local_78; - } - local_94 = (float)(GHIDRA_INT(local_94) + 1); - } while (GHIDRA_INT(local_94) < GHIDRA_INT(pEVar10)); - } - bVar6 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x8f); - game = g_game; - if (bVar6 != 0) { - iVar9 = PlayerManager::GetTrinketMultiplier(&g_game->_playerManager,0x8f); - fVar16 = (float)iVar9; - fVar15 = PlayerManager::get_total_luck(&game->_playerManager); - local_70 = GHIDRA_CAST(((fVar15 * 0.03 + 0.2) * fVar16)); - local_88 = GHIDRA_CAST((GHIDRA_CAST((&awardRng)))->RNG)::RandomFloat(); - itemPool = room; - pEVar8 = local_70; - if (0.33 <= (float)local_70) { - pEVar8 = GHIDRA_CAST(0x3ea8f5c3); - } - if ((float)local_88 < (float)pEVar8) { - FindFreePickupSpawnPosition(room,&tmpPos,&rewardPos,0.0,0,0,0); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - spawned = (Entity_Pickup *) - Game::Spawn(g_game,5,0x5a,&tmpPos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); - bVar6 = PlayerManager::AnyoneHasCollectible(&g_game->_playerManager,0x29e); - if (bVar6 != 0) { - spawn_options_alternative(itemPool,spawned); - } - } - } - bVar6 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0xb1); - if ((bVar6 != 0) && (itemPool->_roomType == 0xb)) { - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4)))) + 0x10)) + 0x10)) == 1) { - FindFreePickupSpawnPosition(itemPool,&tmpPos,&rewardPos,0.0,0,0,0); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - targetPos = &tmpPos; - uVar12 = 100; - } - else { - FindFreePickupSpawnPosition(itemPool,&local_c8,&rewardPos,0.0,0,0,0); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - targetPos = &local_c8; - uVar12 = 0x32; - } - Game::Spawn(g_game,5,uVar12,targetPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - uVar7 = 0; - playerManager = &g_game->_playerManager; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - do { - local_88 = PlayerManager::GetPlayer(playerManager,uVar7); - local_70 = GHIDRA_CAST((GHIDRA_CAST((local_88)))->Entity_Player)::GetTrinketMultiplier(0xb1); - if (1 < GHIDRA_INT(local_70)) { - (GHIDRA_CAST((local_88)))->Entity_Player::add_random_stat_up(&awardRng); - } - if (2 < GHIDRA_INT(local_70)) { - (GHIDRA_CAST((local_88)))->Entity_Player::add_random_stat_up(&awardRng); - } - uVar7 = uVar7 + 1; - playerManager = &g_game->_playerManager; - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - if (g_game->_challenge == 0x2b) { - FindFreePickupSpawnPosition(itemPool,&cantrippedCardPos,&rewardPos,0.0,0,0,0); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - Game::Spawn(g_game,5,300,&cantrippedCardPos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); - } - goto switchD_007fd7f9_caseD_3; - } - pEVar8 = GHIDRA_CAST(g_game->_stage); - local_78 = GHIDRA_CAST(g_game->_stageType); - local_68 = pEVar8; - local_90 = pEVar8; - if (g_game->_currentRoomIdx == -0x11) { - Level::boss_count_adjust(GHIDRA_CAST(&local_90),GHIDRA_CAST(&local_78)); - pEVar8 = local_90; -LAB_007fbbc4: - local_68 = pEVar8; - } - else { - uVar7 = Level::filter_curses(GHIDRA_CAST(g_game),2); - if (((uVar7 != 0) && (GHIDRA_INT(pEVar8) < 8)) || (g_game->_challenge == 0x2c)) { - pEVar8 = GHIDRA_CAST((&(*GHIDRA_CAST((GHIDRA_CAST((pEVar8)) + 0x0))) + 1)); - goto LAB_007fbbc4; - } - } - local_90 = GHIDRA_CAST(Game)::GetChallengeParams(g_game); - local_95 = Level::IsStageWithinEnd(10,0); - local_81 = Level::IsStageWithinEnd(10,1); - iVar9 = CONCAT31(extraout_var,local_81); - if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) { -LAB_007fbc83: - local_69 = false; - } - else { - challengeParams = Game::GetChallengeParams(g_game); - iVar9 = 0xc; - if (challengeParams->_endStage != 0xc) { - if ((g_game->_challenge == 0) && ((g_game->_dailyChallenge)._id == 0)) { - itemPool = room; - if (((g_manager->_persistentGameData)._achievements[0x140] != 0) || - ((pEVar8 = local_68, *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game->_isDebug != 0)))) - goto LAB_007fbc61; - } - iVar9 = 0xb; - } -LAB_007fbc61: - iVar13 = iVar9; - if (challengeParams->_isPathTypeSet != 0) { - iVar13 = challengeParams->_endStage; - if (challengeParams->_endStage == 0) { - iVar13 = iVar9; - } - if (challengeParams->_pathType == 3) goto LAB_007fbc83; - } - local_69 = 0xb < iVar13; - } - local_78 = GHIDRA_CAST(CONCAT31((int3)(GHIDRA_UINT(iVar9) >> 8),1)); - if (*GHIDRA_CAST((GHIDRA_INT(&(local_90->_sprite)._animState._animData) + 3)) != 0) { - local_78 = GHIDRA_CAST(GHIDRA_UINT((GHIDRA_INT(pEVar8) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_90)) + 0x40))))))); - } - if (itemPool->_roomType == 0x11) { - PlayerManager::unlock_completion_mark(3); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x6f,1); - game = g_game; - oldFlags = g_game->_gameStateFlags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)); - *flagsHigh = *flagsHigh | 2; - *GHIDRA_CAST(&game->_gameStateFlags) = GHIDRA_INT(oldFlags); - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4)))) == 0) || - (iVar9 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4)))) + 0x10)), iVar9 == 0)) - goto switchD_007fbd6e_caseD_e79; - uVar7 = *GHIDRA_CAST((iVar9 + 0xc)); - if (uVar7 < 0xeb6) { - if (uVar7 != 0xeb5) { - if (0xcc2 < uVar7) { - switch(uVar7) { - case 0xe78: - case 0xe7b: - case 0xe7e: - case 0xe82: - case 0xeb0: - goto switchD_007fbd6e_caseD_e78; - default: - goto switchD_007fbd6e_caseD_e79; - } - } - if (uVar7 != 0xcc2) { - if (uVar7 < 0x7ea) { - if (((uVar7 == 0x7e9) || (uVar7 == 0x421)) || (uVar7 == 0x43f)) - goto switchD_007fbd6e_caseD_e78; - } - else if ((uVar7 == 0x810) || (uVar7 == 0xcc1)) goto switchD_007fbd6e_caseD_e78; - goto switchD_007fbd6e_caseD_e79; - } - } -switchD_007fbd6e_caseD_e78: - FUN_007fa7d0(); - } - else { - if (0x1436 < uVar7) { - switch(uVar7) { - case 0x143c: - case 0x143d: - case 0x1466: - case 0x146d: - case 0x14f1: - goto switchD_007fbd6e_caseD_e78; - default: - goto switchD_007fbd6e_caseD_e79; - } - } - if (uVar7 == 0x1436) goto switchD_007fbd6e_caseD_e78; - if (uVar7 < 0xfca) { - if (((uVar7 == 0xfc9) || (uVar7 == 0xeeb)) || (uVar7 == 0xfb6)) - goto switchD_007fbd6e_caseD_e78; - } - else if ((uVar7 == 0x13ef) || (uVar7 == 0x1418)) goto switchD_007fbd6e_caseD_e78; - } -switchD_007fbd6e_caseD_e79: - bVar6 = IsCurrentRoomLastBoss(itemPool); - if ((bVar6 == 0) && ((g_game->_currentRoomIdx != -10 || (itemPool->_roomType != 5)))) { - local_6a = false; - } - else { - local_6a = true; - } - if (g_game->_challenge == 0x2c) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx, - g_game->_currentDimensionIdx); - local_6a = *GHIDRA_CAST((GHIDRA_CAST(roomDesc->Data) + 8)) == 5; - } - game = g_game; - bVar6 = PlayerManager::IsCoopPlay(&g_game->_playerManager); - if ((bVar6 != 0) && (local_6a != false)) { - PlayerManager::revive_player_ghosts(&game->_playerManager); - } - if ((g_game->_currentRoomIdx == -10) && (itemPool->_roomType == 5)) { - if (local_68 == GHIDRA_CAST(0x6)) { - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,1,1); - PlayerManager::unlock_completion_mark(0); - } - else if (local_68 == GHIDRA_CAST(0x8)) { - PlayerManager::unlock_completion_mark(0xd); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x1eb,1); - if (*GHIDRA_CAST((GHIDRA_INT(&(local_90->_sprite)._animState._animData) + 3)) != 0) { - clear_reward_position(itemPool,&rewardPos); - goto LAB_007fbea9; - } - clear_reward_position(itemPool,&rewardPos); - (g_manager->_achievementOverlay)._isPopupBlocked = 1; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - Game::Spawn(g_game,5,0x154,&rewardPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - if ((((char)local_78 != '\0') && (local_69 != false)) && - (1 < GHIDRA_UINT((g_manager->_persistentGameData)._eventCounters[0x1eb]))) { - spawnPos.x = rewardPos.x + 0.0; - spawnPos.y = rewardPos.y + 40.0; - targetPos = FindFreePickupSpawnPosition(itemPool,&tmpPos,&spawnPos,80.0,1,0,0); - local_88 = GHIDRA_CAST(GetGridIndex(itemPool,targetPos)); - remove_grid_entity_for_spawn(itemPool,GHIDRA_CAST(&local_88)); - uVar7 = Random(); - SpawnGridEntity(itemPool,GHIDRA_INT(local_88),0x11,0,uVar7,1); - } - } - goto LAB_007fd75c; - } - if ((GHIDRA_INT(local_68) < 8) && (local_68 != GHIDRA_CAST(0x6))) { -LAB_007fcf52: - if (local_6a != false) { - if ((char)local_78 == '\0') { - clear_reward_position(itemPool,&rewardPos); - uVar7 = Random(); - Game::Spawn(g_game,5,0x172,&rewardPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - else { - uVar7 = Level::filter_curses(GHIDRA_CAST(g_game),2); - local_95 = uVar7 != 0; - if ((local_90->_sprite)._animState._layerFrames == (void *)0x3) { - cVar5 = FUN_007ed240(); - local_81 = 1; - if (cVar5 == '\0') goto LAB_007fcf96; - } - else { -LAB_007fcf96: - local_81 = 0; - } - game = g_game; - challengeParams = Game::GetChallengeParams(g_game); - if ((challengeParams->_pathType == 2) && - (((bVar6 = Level::IsAltPath(GHIDRA_CAST(game)), bVar6 == 0 || (local_95 != 0)) || - ((local_68 != GHIDRA_CAST(0x1) && - (((local_68 != GHIDRA_CAST(0x3) && (local_68 != GHIDRA_CAST(0x5))) && - (local_68 != GHIDRA_CAST(0x7))))))))) { - bVar3 = true; - } - else { - bVar3 = false; - } - if ((g_game->_challenge == 0x2c) || ((local_81 == 0 && (!bVar3)))) { - remove_grid_entity_for_spawn(itemPool,GHIDRA_CAST(&local_94)); - uVar7 = Random(); - SpawnGridEntity(itemPool,GHIDRA_INT(local_94),0x11,0,uVar7,0); - } - } - } -LAB_007fd052: - if ((itemPool->_bossId == 0x26) && - (bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,0xb5,1), bVar6 != 0)) { - uVar7 = 0xb5; -LAB_007fd2ec: - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar7,0,0); - } - else { - if ((itemPool->_bossId == 0x16) && - (bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,0x82,1), bVar6 != 0)) { - uVar7 = 0x82; - goto LAB_007fd2ec; - } - if ((itemPool->_bossId == 0x15) && - (bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,0x60,1), bVar6 != 0)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x19); - uVar7 = 0x60; - goto LAB_007fd2ec; - } - if ((itemPool->_bossId == 0x13) && - (bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,99,1), bVar6 != 0)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x17); - uVar7 = 99; - goto LAB_007fd2ec; - } - if ((itemPool->_bossId == 0x14) && - ((bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,0x32,1), bVar6 != 0 || - (bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,100,1), bVar6 != 0)))) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x18); - bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,100,1); - if ((bVar6 == 0) || (uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(6), uVar7 == 0)) { - uVar7 = 0x32; - } - else { - uVar7 = 100; - } - goto LAB_007fd2ec; - } - iVar9 = itemPool->_bossId; - if ((((8 < iVar9) && (iVar9 < 0xd)) || (iVar9 == 0x26)) || (iVar9 == 0x16)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,7); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(2); - uVar7 = (-GHIDRA_UINT((uVar7 != 0)) & 0x86) + 0x49; - pEVar8 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x49,GHIDRA_CAST(&g_game->_playerManager),1); - if (pEVar8 == GHIDRA_CAST(0x0)) { - pEVar8 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xcf,GHIDRA_CAST(&g_game->_playerManager),1); - if (pEVar8 != GHIDRA_CAST(0x0)) { - uVar7 = 0xcf; - } - } - else { - uVar7 = 0x49; - } - goto LAB_007fd2ec; - } - if ((itemPool->_roomType == 0x11) && - (pEVar8 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x226,GHIDRA_CAST(&g_game->_playerManager),1), - pEVar8 != GHIDRA_CAST(0x0))) { - uVar7 = 0x227; - goto LAB_007fd2ec; - } - if ((itemPool->_bossId == 0x54) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x73f0)))) == -1)) { - bVar6 = ItemPool::is_collectible_available(&g_game->_itemPool,0x28a,1); - manager = g_manager; - if (bVar6 != 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x73f0)))) = 0; - PersistentGameData::TryUnlock(&manager->_persistentGameData,0x19a); - uVar7 = 0x28a; - goto LAB_007fd2ec; - } - } - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - uVar7 = ItemPool::GetSeededCollectible(uVar7,0,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4))))); - } - if (g_game->_challenge == 0x2b) { - spawnPos.x = (float)local_88; - spawnPos.y = (float)local_b8; - clear_reward_position(itemPool,&spawnPos); - g_pickupIgnoreModifiers = g_pickupIgnoreModifiers + 1; - FUN_007fa2a0(&spawnPos); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = Game::Spawn(g_game,5,100,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0xfb,uVar7); - spawned = (Entity_Pickup *) - __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType,castIsReference); - if (isShopItems != '\0') { - (GHIDRA_CAST((spawned)))->Entity_Pickup::MakeShopItem(-2); - } - g_pickupIgnoreModifiers = g_pickupIgnoreModifiers + -1; - spawned->_coopDuplicateIndex = 0; - } - else { - local_b4 = 0.0; - local_94 = 0.0; - local_69 = (bool)pick_special_clear_award(itemPool,GHIDRA_CAST(&local_b4),GHIDRA_CAST(&local_94),&awardRng) - ; - local_c0.x = (float)local_88; - local_c0.y = (float)local_b8; - pEVar8 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xf9,GHIDRA_CAST(&g_game->_playerManager),1); - if ((pEVar8 == GHIDRA_CAST(0x0)) || (local_69 == false)) { - pEVar8 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xf9,GHIDRA_CAST(&g_game->_playerManager),1); - if ((pEVar8 != GHIDRA_CAST(0x0)) != local_69) { - local_c0.x = leftItemPos.x; - local_c0.y = leftItemPos.y; - } - } - else { - local_c0.x = (float)local_88; - local_c0.y = local_e0.y; - } - clear_reward_position(itemPool,&local_c0); - FUN_007fa2a0(&local_c0); - uVar12 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = Game::Spawn(g_game,5,100,&local_c0,&g_vectorZero,GHIDRA_CAST(0x0),uVar7,uVar12) - ; - pEVar8 = (Entity_Player *) - __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType,castIsReference); - local_70 = pEVar8; - if (isShopItems != '\0') { - (GHIDRA_CAST((GHIDRA_CAST(pEVar8))))->Entity_Pickup::MakeShopItem(-2); - } - playerManager = &g_game->_playerManager; - (pEVar8->_crownOfLightSprite)._overlayAnimState._layerFrames = (void *)0x0; - iVar9 = -1; - pEVar8 = PlayerManager::FirstCollectibleOwner(playerManager,0xf9,GHIDRA_CAST(playerManager),1); - if (pEVar8 != GHIDRA_CAST(0x0)) { - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - uVar7 = ItemPool::GetSeededCollectible(uVar7,0,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((itemPool)) + 0x4))))); - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar7,0,0); - targetPos = &local_d8; - if (local_69 == false) { - targetPos = &rightItemPos; - } - local_c0.x = (float)targetPos->x; - local_c0.y = targetPos->y; - clear_reward_position(room,&local_c0); - FUN_007fa2a0(&local_c0); - uVar12 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = - Game::Spawn(g_game,5,100,&local_c0,&g_vectorZero,GHIDRA_CAST(0x0),uVar7,uVar12); - spawned = (Entity_Pickup *) - __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType,castIsReference - ); - if (isShopItems != '\0') { - (GHIDRA_CAST((spawned)))->Entity_Pickup::MakeShopItem(-2); - } - iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Entity_Pickup::AssignOptionsIndex(); - spawned->_coopDuplicateIndex = 0; - spawned->_optionsPickupIndex = iVar9; - itemPool = room; - } - if (local_69 != false) { - pEVar8 = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0xf9,GHIDRA_CAST(&g_game->_playerManager),1); - targetPos = &local_c8; - if (pEVar8 == GHIDRA_CAST(0x0)) { - targetPos = &rightItemPos; - } - local_c0.x = (float)targetPos->x; - local_c0.y = targetPos->y; - if (local_b4 != 0.0) { - ItemPool::RemoveCollectible(&g_game->_itemPool,GHIDRA_INT(local_b4),0,0); - clear_reward_position(itemPool,&local_c0); - FUN_007fa2a0(&local_c0); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = - Game::Spawn(g_game,5,100,&local_c0,&g_vectorZero,GHIDRA_CAST(0x0),GHIDRA_UINT(local_b4),uVar7 - ); - spawned = (Entity_Pickup *) - __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType, - castIsReference); - if (isShopItems != '\0') { - (GHIDRA_CAST((spawned)))->Entity_Pickup::MakeShopItem(-2); - } - if (iVar9 == -1) { - iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Entity_Pickup::AssignOptionsIndex(); - } - spawned->_optionsPickupIndex = iVar9; - spawned->_coopDuplicateIndex = 0; - } - fVar15 = local_94; - if (local_94 != 0.0) { - uVar7 = Random(); - targetPos = &local_c0; - uVar12 = 0x15e; - goto LAB_007fd74c; - } - } - } - } - else { - if (((local_68 == GHIDRA_CAST(0x8)) || (local_68 == GHIDRA_CAST(0x6))) && - (local_6a == false)) goto LAB_007fd052; - if ((itemPool->_roomType == 0x11) || ((g_game->_challenge == 0x2c && (GHIDRA_INT(local_68) < 8)))) - goto LAB_007fcf52; - if (itemPool->_bossId == 0x37) { - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x1a,1); - FUN_0092a5e0(0x37); - PlayerManager::unlock_completion_mark(6); - if ((uint8_t)(local_90->_sprite)._animDefaultName._capacity == 0) { - if (((char)local_78 == '\0') || (local_69 == false)) { - Game::End(g_game,8); - } - else { - (g_manager->_achievementOverlay)._isPopupBlocked = 1; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - Game::Spawn(g_game,5,0x154,&rewardPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - targetPos = FindFreePickupSpawnPosition(itemPool,&tmpPos,&rewardPos,80.0,1,0,0); - local_88 = GHIDRA_CAST(GetGridIndex(itemPool,targetPos)); - remove_grid_entity_for_spawn(itemPool,GHIDRA_CAST(&local_88)); - uVar7 = Random(); - SpawnGridEntity(itemPool,GHIDRA_INT(local_88),0x11,0,uVar7,1); - } - goto LAB_007fd75c; - } - clear_reward_position(itemPool,&rewardPos); - uVar7 = Random(); - fVar15 = 0.0; - targetPos = &rewardPos; - uVar12 = 0x172; -LAB_007fd74c: - Game::Spawn(g_game,5,uVar12,targetPos,&g_vectorZero,GHIDRA_CAST(0x0),GHIDRA_UINT(fVar15),uVar7); - } - else { - if (local_68 == GHIDRA_CAST(0x6)) { - if (((g_manager->_persistentGameData)._achievements[4] == 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) { - if (*GHIDRA_CAST((GHIDRA_INT(&(local_90->_sprite)._animState._animData) + 3)) != 0) { - if ((char)local_78 == '\0') goto LAB_007fc202; - if (((uint8_t)(local_90->_sprite)._animDefaultName._capacity != 0) || - (6 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_90)) + 0x40)))))) goto LAB_007fc1ca; - } - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,4); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,5); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,6); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x281); - Game::End(g_game,2); - goto LAB_007fd75c; - } - if ((char)local_78 == '\0') { -LAB_007fc202: - clear_reward_position(itemPool,&rewardPos); - uVar7 = Random(); - Game::Spawn(g_game,5,0x172,&rewardPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - else { -LAB_007fc1ca: - if ((*GHIDRA_CAST((GHIDRA_INT(&(local_90->_sprite)._animState._animData) + 3)) == 0) || - ((local_90->_sprite)._animState._layerFrames != (void *)0x3)) { - remove_grid_entity_for_spawn(itemPool,GHIDRA_CAST(&local_94)); - uVar7 = Random(); - SpawnGridEntity(itemPool,GHIDRA_INT(local_94),0x11,0,uVar7,0); - } - } - game = g_game; - local_d8.x = 320.0; - local_d8.y = 360.0; - challengeParams = Game::GetChallengeParams(g_game); - roomAlias = room; - if ((challengeParams->_pathType == 3) || - ((((g_manager->_persistentGameData)._achievements[0x39] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (game != GHIDRA_CAST(0x0))) && - (((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))) && (local_81 != 0)) - )) { - bVar6 = 1; - if (challengeParams->_pathType != 3) goto LAB_007fc299; -LAB_007fc2d1: - bVar3 = true; - } - else { - bVar6 = 0; -LAB_007fc299: - if ((((g_manager->_persistentGameData)._achievements[0x4e] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) && - (local_95 != 0)) goto LAB_007fc2d1; - bVar3 = false; - } - if (bVar6 == 0) { - if (bVar3) goto LAB_007fc47e; - bVar6 = 0; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - uVar7 = GetSeededCollectible(itemPool,uVar7,bVar6); - roomAlias = room; - clear_reward_position(room,&local_d8); - uVar12 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - spawned = (Entity_Pickup *) - Game::Spawn(g_game,5,100,&local_d8,&g_vectorZero,GHIDRA_CAST(0x0),uVar7,uVar12); - if (isShopItems != '\0') { - (GHIDRA_CAST((spawned)))->Entity_Pickup::MakeShopItem(GHIDRA_INT(local_70)); - } - spawned->_coopDuplicateIndex = 0; - } - else if (!bVar3) { -LAB_007fc47e: - uVar12 = (bVar6 ^ 1) + 0x147; - clear_reward_position(room,&local_d8); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - spawnedEntity = - Game::Spawn(g_game,5,100,&local_d8,&g_vectorZero,GHIDRA_CAST(0x0),uVar12,uVar7); - itemPool = &g_game->_itemPool; - spawnedEntity[1]._colorParams._end = (void *)0x0; - spawnedEntity[1]._collisionPoints._begin = (void *)0x0; - ItemPool::RemoveCollectible(itemPool,uVar12,0,0); - } - else { - clear_reward_position(itemPool,&leftItemPos); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = - Game::Spawn(g_game,5,100,&leftItemPos,&g_vectorZero,GHIDRA_CAST(0x0),0x147,uVar7); - spawned = (Entity_Pickup *) - __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType, - castIsReference); - ItemPool::RemoveCollectible(&g_game->_itemPool,0x147,0,0); - iVar9 = (GHIDRA_CAST((spawned)))->Entity_Pickup::AssignOptionsIndex(); - spawned->_cycleCollectibleCount = 0; - spawned->_coopDuplicateIndex = 0; - clear_reward_position(room,&rightItemPos); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = - Game::Spawn(g_game,5,100,&rightItemPos,&g_vectorZero,GHIDRA_CAST(0x0),0x148,uVar7); - iVar13 = __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType, - castIsReference); - ItemPool::RemoveCollectible(&g_game->_itemPool,0x148,0,0); - *GHIDRA_CAST((iVar13 + 0x528)) = iVar9; - *GHIDRA_CAST((iVar13 + 0x5c0)) = 0; - *GHIDRA_CAST((iVar13 + 0x588)) = 0; - roomAlias = room; - } - if (((char)local_78 != '\0') && (local_69 != false)) { - local_94 = 0.0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - uVar7 = 0; - do { - pEVar8 = Game::GetPlayer(g_game,uVar7); - if (pEVar8->_variant == 0) { - iVar9 = 0; - piVar11 = (pEVar8->_collectibleCounts)._begin; - for (iVar13 = GHIDRA_INT((pEVar8->_collectibleCounts)._end) - GHIDRA_INT(piVar11) >> 2; - iVar13 != 0; iVar13 = iVar13 + -1) { - iVar9 = iVar9 + *piVar11; - piVar11 = piVar11 + 1; - } - fVar15 = pEVar8->_damage; - if (pEVar8->_damage <= local_b4) { - fVar15 = local_b4; - } - local_94 = (float)(GHIDRA_INT(local_94) + iVar9); - local_b4 = fVar15; - } - uVar7 = uVar7 + 1; - } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - roomAlias = room; - } - fVar15 = local_94; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(0x14); - if ((uVar7 == 0) && ((0x13 < GHIDRA_INT(fVar15) || (100.0 < local_b4)))) { - targetPos = FindFreePickupSpawnPosition(roomAlias,&tmpPos,&rewardPos,80.0,1,0,0); - local_70 = GHIDRA_CAST(GetGridIndex(roomAlias,targetPos)); - remove_grid_entity_for_spawn(roomAlias,GHIDRA_CAST(&local_70)); - uVar7 = Random(); - SpawnGridEntity(roomAlias,GHIDRA_INT(local_70),0x11,0,uVar7,1); - } - } - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,4); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,5); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,6); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x281); - goto LAB_007fd75c; - } - if ((local_68 == GHIDRA_CAST(0x8)) || (local_68 == GHIDRA_CAST(0x9))) { - if (((((g_manager->_persistentGameData)._achievements[0x22] == 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) || - (local_68 != GHIDRA_CAST(0x8))) && - ((((g_manager->_persistentGameData)._eventCounters[0x9e] == 0 || - (local_68 != GHIDRA_CAST(0x9))) && - ((*GHIDRA_CAST((GHIDRA_INT(&(local_90->_sprite)._animState._animData) + 3)) == 0 || - (((uint8_t)(local_90->_sprite)._animDefaultName._capacity == 0 && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_90)) + 0x40)))) <= GHIDRA_INT(local_68))))))))) { - clear_reward_position(itemPool,&rewardPos); - if ((char)local_78 == '\0') goto LAB_007fce68; - (g_manager->_achievementOverlay)._isPopupBlocked = 1; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - uVar12 = 0x154; -LAB_007fce80: - Game::Spawn(g_game,5,uVar12,&rewardPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - else { - if ((char)local_78 == '\0') { - clear_reward_position(itemPool,&rewardPos); -LAB_007fce68: - uVar7 = Random(); - uVar12 = 0x172; - goto LAB_007fce80; - } - if (local_95 != 0) { - targetPos = GetCenterPos(&tmpPos); - spawnPos.y = 280.0; - spawnPos.x = targetPos->x - 40.0; - local_70 = GHIDRA_CAST(GetGridIndex(itemPool,&spawnPos)); - remove_grid_entity_for_spawn(itemPool,GHIDRA_CAST(&local_70)); - uVar7 = Random(); - SpawnGridEntity(itemPool,GHIDRA_INT(local_70),0x11,0,uVar7,0); - } - if (local_81 != 0) { - targetPos = GetCenterPos(&tmpPos); - spawnPos.y = 280.0; - spawnPos.x = targetPos->x + 40.0; - local_70 = GHIDRA_CAST(GetGridIndex(itemPool,&spawnPos)); - clear_grid_for_pickup(itemPool,GHIDRA_CAST(&local_70)); - uVar7 = Random(); - targetPos = GetGridPosition(room,&tmpPos,GHIDRA_INT(local_70)); - Game::Spawn(g_game,1000,0x27,targetPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - itemPool = room; - } - } - if (local_68 == GHIDRA_CAST(0x8)) { - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,1,1); - PlayerManager::unlock_completion_mark(0); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(10); - if ((((uVar7 == 0) && ((char)local_78 != '\0')) && (local_69 != false)) && - (challengeParams = Game::GetChallengeParams(g_game), - challengeParams->_endStage != 0xc)) { - targetPos = &local_c8; - goto LAB_007fca07; - } - } - else if (local_68 == GHIDRA_CAST(0x9)) { - PlayerManager::unlock_completion_mark(9); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x9e,1); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x140); - Game::SetStateFlag(0x28,1); - } - } - else if (local_68 == GHIDRA_CAST(0xb)) { - if (g_game->_stageType == 0) { - PlayerManager::unlock_completion_mark(5); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x19,1); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x15c); - if (g_game->_timeCounter < 36000) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x146); - } - bVar6 = Game::GetStateFlag(g_game,0x29); - if (bVar6 == 0) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x147); - } - if (0 < g_game->_victoryLap) { - bVar6 = Game::AchievementUnlocksDisallowed(g_game); - FUN_009299e0(bVar6); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x141); - manager = g_manager; - KAGE_LogMessage(1,GHIDRA_CAST("Setting PersistentGameData ReadOnly to %s\n")); - (*GHIDRA_CAST((GHIDRA_CAST(&((manager->_persistentGameData))) + 0x1))) = 1; - } - if (1 < g_game->_victoryLap) { - bVar6 = Game::AchievementUnlocksDisallowed(g_game); - FUN_009299e0(bVar6); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x168); - manager = g_manager; - KAGE_LogMessage(1,GHIDRA_CAST("Setting PersistentGameData ReadOnly to %s\n")); - (*GHIDRA_CAST((GHIDRA_CAST(&((manager->_persistentGameData))) + 0x1))) = 1; - } - if (2 < g_game->_victoryLap) { - bVar6 = Game::AchievementUnlocksDisallowed(g_game); - FUN_009299e0(bVar6); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x151); - manager = g_manager; - KAGE_LogMessage(1,GHIDRA_CAST("Setting PersistentGameData ReadOnly to %s\n")); - (*GHIDRA_CAST((GHIDRA_CAST(&((manager->_persistentGameData))) + 0x1))) = 1; - } - game = g_game; - if (((g_game->_challenge == 0) && ((g_game->_dailyChallenge)._id == 0)) && - (bVar6 = Game::IsGreedMode(g_game), bVar6 == 0)) { - if ((g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) || - (uVar7 = PlayerManager::count_main_players(&game->_playerManager), uVar7 < 2)) { - GenericPrompt::Show(&game->_genericPrompt,0); - } - else { - GenericPrompt::Show(&game->_genericPrompt,1); - online_vote_start(game,1,2); - } - } - itemPool = room; - } - else { - PlayerManager::unlock_completion_mark(4); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x18,1); - } - challengeParams = Game::GetChallengeParams(g_game); - if (challengeParams->_endStage == 0xc) { -LAB_007fc9db: - if ((char)local_78 == '\0') goto LAB_007fd75c; - } - else { - clear_reward_position(itemPool,&rewardPos); - if ((char)local_78 == '\0') { -LAB_007fbea9: - uVar7 = Random(); - fVar15 = 0.0; - targetPos = &rewardPos; - uVar12 = 0x172; - goto LAB_007fd74c; - } - (g_manager->_achievementOverlay)._isPopupBlocked = 1; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - Game::Spawn(g_game,5,0x154,&rewardPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - } - if (local_69 != false) { - targetPos = &tmpPos; -LAB_007fca07: - targetPos = FindFreePickupSpawnPosition(itemPool,targetPos,&rewardPos,80.0,1,0,0); - local_70 = GHIDRA_CAST(GetGridIndex(itemPool,targetPos)); - remove_grid_entity_for_spawn(itemPool,GHIDRA_CAST(&local_70)); - uVar7 = Random(); - SpawnGridEntity(itemPool,GHIDRA_INT(local_70),0x11,0,uVar7,1); - } - } - else if (local_68 == GHIDRA_CAST(0xa)) { - if (g_game->_stageType == 0) { - PlayerManager::unlock_completion_mark(2); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,3); - iVar9 = 0xd; - } - else { - PlayerManager::unlock_completion_mark(1); - iVar9 = 0xb; - } - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,iVar9,1); - clear_reward_position(itemPool,&rewardPos); - if ((char)local_78 == '\0') { - uVar7 = Random(); - uVar12 = 0x172; - } - else { - (g_manager->_achievementOverlay)._isPopupBlocked = 1; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - uVar12 = 0x154; - } - Game::Spawn(g_game,5,uVar12,&rewardPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - challengeParams = Game::GetChallengeParams(g_game); - if ((challengeParams->_endStage != 0xc) && - (uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(100), uVar7 < 0xf)) goto LAB_007fc9db; - } - else if (local_68 == GHIDRA_CAST(0xc)) { - if (itemPool->_bossId == 0x46) { - PlayerManager::unlock_completion_mark(0xc); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x152); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x165); - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0xbb,1); - clear_reward_position(itemPool,&rewardPos); - if ((char)local_78 != '\0') { - (g_manager->_achievementOverlay)._isPopupBlocked = 1; - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - fVar15 = 0.0; - targetPos = &rewardPos; - uVar12 = 0x154; - goto LAB_007fd74c; - } - goto LAB_007fbea9; - } - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(0x11); - game = g_game; - if (uVar7 == 0x10) { - uVar7 = 0x19; - } - uVar12 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - uVar7 = ItemPool::GetCollectible(&game->_itemPool,uVar7,uVar12,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar7,0,0); - bVar6 = PlayerManager::AnyoneHasCollectible(&g_game->_playerManager,0xf9); - targetPos = &leftItemPos; - if (bVar6 == 0) { - targetPos = &spawnPos; - } - local_e0.x = targetPos->x; - local_e0.y = targetPos->y; - clear_reward_position(room,&local_e0); - uVar12 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = - Game::Spawn(g_game,5,100,&local_e0,&g_vectorZero,GHIDRA_CAST(0x0),uVar7,uVar12); - local_70 = (Entity_Player *) - __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType, - castIsReference); - playerManager = &g_game->_playerManager; - (local_70->_crownOfLightSprite)._overlayAnimState._layerFrames = (void *)0x0; - bVar6 = PlayerManager::AnyoneHasCollectible(playerManager,0xf9); - if (bVar6 != 0) { - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::RandomInt(0x11); - game = g_game; - if (uVar7 == 0x10) { - uVar7 = 0x19; - } - uVar12 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - uVar7 = ItemPool::GetCollectible(&game->_itemPool,uVar7,uVar12,0,0,0); - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar7,0,0); - clear_reward_position(room,&rightItemPos); - uVar12 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - castIsReference = 0; - castDstType = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - castSrcType = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - castOffset = 0; - spawnedEntity = - Game::Spawn(g_game,5,100,&rightItemPos,&g_vectorZero,GHIDRA_CAST(0x0),uVar7,uVar12); - iVar9 = __RTDynamicCast(spawnedEntity,castOffset,castSrcType,castDstType,castIsReference - ); - iVar13 = (GHIDRA_CAST((GHIDRA_CAST(local_70))))->Entity_Pickup::AssignOptionsIndex(); - *GHIDRA_CAST((iVar9 + 0x528)) = iVar13; - *GHIDRA_CAST((iVar9 + 0x588)) = 0; - } - } - } - } -LAB_007fd75c: - manager = g_manager; - persistentData = &g_manager->_persistentGameData; - if ((*GHIDRA_CAST((GHIDRA_CAST(&((g_manager->_persistentGameData))) + 0x1))) == '\0') { - piVar11 = (g_manager->_persistentGameData)._cutsceneCounters + GHIDRA_INT(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_68[-1])) + 0x2eca)))) - ; - *piVar11 = *piVar11 + 1; - uVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_persistentGameData))) + 0xdd0)))); - *GHIDRA_CAST(persistentData) = 1; - if (0x27 < uVar7) { - PersistentGameData::TryUnlock(persistentData,0x10); - } - if (0x1d < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_persistentGameData))) + 0xdd8))))) { - PersistentGameData::TryUnlock(persistentData,0x11); - } - if (0x13 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((manager->_persistentGameData))) + 0xde0))))) { - PersistentGameData::TryUnlock(persistentData,0x12); - } - } - pEVar8 = local_68; - if (local_68 == GHIDRA_CAST(0x2)) { - iVar9 = 0xd; -LAB_007fd7ca: - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,iVar9); - } - else { - if (local_68 == GHIDRA_CAST(0x4)) { - iVar9 = 0xe; - goto LAB_007fd7ca; - } - if (local_68 == GHIDRA_CAST(0xb)) { - iVar9 = 0x9b; - goto LAB_007fd7ca; - } - } - if (local_6a != false) { - iVar9 = g_game->_lastLevelWithDamage; - switch(pEVar8) { - case GHIDRA_CAST(0x2): - if (iVar9 < 1) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x25); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x15f); - } - break; - case GHIDRA_CAST(0x4): - if (iVar9 < 3) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x26); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x16d); - } - break; - case GHIDRA_CAST(0x6): - if (iVar9 < 5) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x27); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x170); - } - break; - case GHIDRA_CAST(0x8): - if (iVar9 < 7) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x28); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x176); - } - break; - case GHIDRA_CAST(0xb): - if (iVar9 < 0xb) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x53); - } - } - } - goto switchD_007fd7f9_caseD_3; - } - if (itemPool->_roomType != 1) { - if ((itemPool->_roomType == 5) && (itemPool->_bossId == 0x3e)) { - MusicManager::Crossfade(&g_manager->_musicManager,0x25,0.08); - EntityList::QuerySublist(&itemPool->_entityList,GHIDRA_CAST(&local_38),0x196,0,-1,0,0); - local_8 = 0; - local_b4 = g_vectorZero.x; - local_90 = GHIDRA_CAST(g_vectorZero.y); - if (local_38._shift3 != 0) { - targetPos = GHIDRA_CAST((*GHIDRA_CAST(local_38._shift1) + 0x33c)); - local_b4 = targetPos->x; - local_90 = *GHIDRA_CAST((*GHIDRA_CAST(local_38._shift1) + 0x340)); - local_c8 = *targetPos; - uVar7 = GetGridIndex(itemPool,&local_c8); - if (uVar7 < 0x1c0) { - itemPool->_gridPaths[uVar7] = 1000; - } - } - game = g_game; - if (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) { - local_b8 = GHIDRA_CAST(0x1); - } - else { - local_b8 = GHIDRA_CAST(PlayerManager)::count_main_players(&g_game->_playerManager); - if (local_b8 == GHIDRA_CAST(0x0)) { -LAB_007fdb1d: - local_d8.x = rewardPos.x; - local_d8.y = rewardPos.y; - if ((local_b4 != g_vectorZero.x) || ((float)local_90 != g_vectorZero.y)) { - tmpPos.x = local_b4 + 0.0; - tmpPos.y = (float)local_90 + 40.0; - GetClampedPositionImpl(itemPool,&local_c8,&tmpPos,40.0,40.0,40.0,40.0); - local_d8.y = local_c8.y; - local_d8.x = local_c8.x; - if (local_c8.y - (float)local_90 < 20.0) { - if (0.0 <= rewardPos.x - local_c8.x) { - local_d8.x = 40.0; - } - else { - local_d8.x = -40.0; - } - local_d8.x = local_c8.x + local_d8.x; - } - } - clear_reward_position(itemPool,&local_d8); - uVar7 = (GHIDRA_CAST((&awardRng)))->RNG::Next(); - Game::Spawn(g_game,5,0x154,&local_d8,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); - PlayerManager::unlock_completion_mark(7); - if (g_game->_difficulty == 3) { - PlayerManager::unlock_completion_mark(0xb); - } - if ((char)local_38._seed == '\0') { - local_8 = 1; - tracked_alloc(1,(void *)local_38._shift1,0); - } - goto switchD_007fd7f9_caseD_3; - } - } - local_78 = GHIDRA_CAST(0x0); - do { - local_88 = PlayerManager::get_main_player(&game->_playerManager,GHIDRA_INT(local_78)); - if (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) { -LAB_007fdd45: - local_94 = (local_88->_pos).x; - local_68 = GHIDRA_CAST((local_88->_pos).y); - uVar7 = Random(); - fVar15 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_e0.y = fVar15 + fVar15; - local_70 = GHIDRA_CAST(sin(local_e0.y)); - fVar15 = cos(local_e0.y); - tmpPos.x = fVar15 * 80.0 + local_94; - tmpPos.y = (float)local_70 * 80.0 + (float)local_68; - GetClampedPositionImpl(itemPool,&spawnPos,&tmpPos,40.0,40.0,40.0,40.0); - if ((ABS(spawnPos.x - local_b4) < 20.0) && (spawnPos.y < (float)local_90)) { - if (0.0 <= rewardPos.x - spawnPos.x) { - fVar15 = 40.0; - } - else { - fVar15 = -40.0; - } - spawnPos.x = fVar15 + spawnPos.x; - } - clear_reward_position(itemPool,&spawnPos); - pEVar8 = GHIDRA_CAST(0x0); - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - pEVar8 = local_88; - } - if (awardRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - awardRng._seed = GHIDRA_UINT(awardRng._seed) >> ((uint8_t)awardRng._shift1 & 0x1f) ^ awardRng._seed; - awardRng._seed = awardRng._seed << ((uint8_t)awardRng._shift2 & 0x1f) ^ awardRng._seed; - awardRng._seed = GHIDRA_UINT(awardRng._seed) >> (SUB41(local_c0.y,0) & 0x1f) ^ awardRng._seed; - spawnedEntity = - Game::Spawn(g_game,6,0xb,&spawnPos,&g_vectorZero,GHIDRA_CAST(pEVar8),0,awardRng._seed); - *GHIDRA_CAST(&spawnedEntity->_flags) = GHIDRA_UINT(spawnedEntity->_flags) | 4; - *GHIDRA_CAST((GHIDRA_INT(&spawnedEntity->_flags) + 4)) = - *GHIDRA_CAST((GHIDRA_INT(&spawnedEntity->_flags) + 4)); - if (GHIDRA_CAST(0x1) < local_b8) { - iVar9 = 0; - piVar11 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0x60)))); - do { - if (*piVar11 == local_88->_controllerIndex) goto LAB_007fdf6a; - iVar9 = iVar9 + 1; - piVar11 = piVar11 + 1; - } while (iVar9 < 4); - iVar9 = 5; -LAB_007fdf6a: - PlayerManager::GetPlayerColorValue(&local_28,iVar9); - local_44 = 0; - local_54 = 0; - uStack_50 = 0; - uStack_4c = 0; - uStack_48 = 0; - playerColor = local_28._red; - local_60 = local_28._green; - local_40 = 0; - local_3c = 0; - local_5c = local_28._blue; - local_58 = 0x3f800000; - spawnedEntity->SetColor(&playerColor,0xffffffff,0xff,0,1); - } - spawnedEntity->Update(); - itemPool = room; - } - else { - local_6a = false; - local_e0.y = (float)FUN_0090b010(local_88->_controllerIndex); - if (GHIDRA_CAST(local_e0.y) != GHIDRA_CAST(0x0)) { - local_70 = (g_manager->_lobbyMembers)._begin; - local_94 = (float)((GHIDRA_INT((g_manager->_lobbyMembers)._end) - GHIDRA_INT(local_70)) / 0x14); - if (local_94 != 0.0) { - lobbyEntry = &(*GHIDRA_CAST((GHIDRA_CAST((local_70)) + 0x8))); - fVar15 = ((GHIDRA_CAST(local_e0.y))->_sizeMulti).x; - do { - if (fVar15 == 0.0) { - local_c8.x = 0.0; - local_c8.y = 0.0; - VVar4 = local_c8; - local_c8.x = 0.0; - local_70 = GHIDRA_CAST(0x0); - fVar16 = local_c8.x; - local_c8 = VVar4; - } - else { - local_70 = *GHIDRA_CAST((GHIDRA_CAST(fVar15) + 0xc)); - fVar16 = *GHIDRA_CAST((GHIDRA_CAST(fVar15) + 8)); - } - iVar9 = *GHIDRA_CAST((lobbyEntry + -4)); - if (iVar9 == 0) { - local_c8.x = 0.0; - local_c8.y = 0.0; - VVar4 = local_c8; - local_c8.y = 0.0; - local_c8.x = 0.0; - pEVar8 = GHIDRA_CAST(local_c8.y); - fVar14 = local_c8.x; - local_c8 = VVar4; - } - else { - pEVar8 = *GHIDRA_CAST((iVar9 + 0xc)); - fVar14 = *GHIDRA_CAST((iVar9 + 8)); - } - if ((fVar16 == fVar14) && (local_70 == pEVar8)) { - local_6a = (bool)(*lobbyEntry & 1); - } - lobbyEntry = lobbyEntry + 0x14; - local_94 = (float)(GHIDRA_INT(local_94) - 1); - } while (local_94 != 0.0); - local_94 = 0.0; - itemPool = room; - if (local_6a != false) goto LAB_007fdd45; - } - } - } - local_78 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_78)) + 0x1)))); - if (local_b8 <= local_78) goto LAB_007fdb1d; - game = g_game; - } while( true ); - } - goto switchD_007fd7f9_caseD_3; - } - switch((g_manager->_musicManager)._currentMusicID) { - case 9: - fVar15 = (g_manager->_optionsConfig)._musicVolume; - iVar9 = 0x53; - break; - default: - flagsHigh = &(g_manager->_musicManager)._channels[(g_manager->_musicManager)._currentChannel]. - field_0x16c; - *GHIDRA_CAST(flagsHigh) = *GHIDRA_CAST(flagsHigh) & 0xfffffffe; - goto switchD_007fd7f9_caseD_3; - case 0x17: - MusicManager::Crossfade(&g_manager->_musicManager,0x25,0.08); - goto switchD_007fd7f9_caseD_3; - case 0x1a: - fVar15 = (g_manager->_optionsConfig)._musicVolume; - iVar9 = 0x61; - break; - case 0x26: - (GHIDRA_CAST((GHIDRA_CAST(&g_manager->_musicManager))))->Music::Play(0x5c,(g_manager->_optionsConfig)._musicVolume); - if (0x23 < (GHIDRA_INT((g_manager->_musicManager)._entries._end) - - GHIDRA_INT((g_manager->_musicManager)._entries._begin)) / 0x60) { - (g_manager->_musicManager)._queuedMusicID = 0x23; - } - goto switchD_007fd7f9_caseD_3; - case 0x29: - fVar15 = (g_manager->_optionsConfig)._musicVolume; - iVar9 = 0x2a; - } - (GHIDRA_CAST((GHIDRA_CAST(&g_manager->_musicManager))))->Music::Play(iVar9,fVar15); - if (0x25 < (GHIDRA_INT((g_manager->_musicManager)._entries._end) - - GHIDRA_INT((g_manager->_musicManager)._entries._begin)) / 0x60) { - (g_manager->_musicManager)._queuedMusicID = 0x25; - } -switchD_007fd7f9_caseD_3: - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x60)) = awardRng._seed; - ExceptionList = local_10; - return; -} - -// 007fe220 -void Room::card_against_humanity_fill() -{ - Room *playerManager = this; - code *pcVar1; - GridEntity *pGVar2; - ANM2 *pAVar3; - uint8_t bVar4; - Entity_Player *pEVar5; - Entity *spawnedEffect; - uint32_t uVar6; - ItemConfig_Item *item; - void *pvVar7; - Game *pGVar8; - GridEntity *pGVar9; - int iVar10; - PlayerManager *playerManager; - int iVar11; - uint32_t pickIdx; - int *piVar12; - uint32_t *puVar13; - uint32_t pickIdx; - uint32_t *cardRng; - int iVar15; - uint32_t *puVar16; - Room *pRVar17; - float fVar18; - uint8_t local_5c [8]; - void *local_54; - uint32_t *local_50; - uint32_t *freeCellsEnd; - uint32_t *local_48; - Vector local_44; - void *occupiedCells; - uint32_t occupiedCellsSize; - GridEntity *local_34; - uint32_t local_30; - uint32_t meconiumRoll; - uint32_t *local_28; - uint32_t *freeCellsCapEnd; - Game *local_20; - uint32_t *freeCells; - Room *local_18; - char isMeconiumBackupCounts; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int roomShape; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b01417; - local_10 = ExceptionList; - ExceptionList = &local_10; - (*GHIDRA_CAST((GHIDRA_CAST((playerManager)) + 0x11f4))) = 0; - occupiedCells = (void *)0x0; - occupiedCellsSize = 0; - local_18 = playerManager; - occupiedCells = operator_new(0x14); - *(void **)occupiedCells = occupiedCells; - *(void **)(GHIDRA_CAST(occupiedCells) + 4) = occupiedCells; - *(void **)(GHIDRA_CAST(occupiedCells) + 8) = occupiedCells; - *GHIDRA_CAST((GHIDRA_CAST(occupiedCells) + 0xc)) = 0x101; - pickIdx = 0; - local_8 = 0; - if ((playerManager->_entityList)._updateEL._size != 0) { - do { - iVar10 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((playerManager->_entityList)._updateEL)) + 0x4)))) + pickIdx * 4)); - if ((((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((iVar10 + 0x28)) == 1)) || - (iVar11 = *GHIDRA_CAST((iVar10 + 0x28)), iVar11 - 10U < 0x3de)) || - ((iVar11 == 1 || (iVar11 == 6)))) || (iVar11 == 5)) || (iVar11 == 4)) { - iVar11 = GHIDRA_INT(((*GHIDRA_CAST((iVar10 + 0x33c)) - 40.0) / 40.0 + 0.5)); - iVar10 = GHIDRA_INT(((*GHIDRA_CAST((iVar10 + 0x340)) - 120.0) / 40.0 + 0.5)); - if (((iVar11 < 0) || (iVar15 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)), iVar15 <= iVar11)) || - ((iVar10 < 0 || (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x10)) <= iVar10)))) { - local_28 = GHIDRA_CAST(0xffffffff); - } - else { - local_28 = GHIDRA_CAST((iVar15 * iVar10 + iVar11)); - } - msvc::set::insert(&local_44,&local_28); - } - pickIdx = pickIdx + 1; - } while (pickIdx < GHIDRA_UINT((playerManager->_entityList)._updateEL._size)); - } - pGVar8 = g_game; - piVar12 = (g_game->_playerManager)._playerList._begin; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT(piVar12) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - piVar12 = (pGVar8->_playerManager)._playerList._begin; - } - iVar10 = *piVar12; - iVar11 = *GHIDRA_CAST((iVar10 + 0x1798)); - if (iVar11 - *GHIDRA_CAST((iVar10 + 0x1794)) >> 4 < 0x2e) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Card ID out of bounds!\n")); - iVar11 = *GHIDRA_CAST((iVar10 + 0x1798)); - } - pickIdx = (iVar11 - *GHIDRA_CAST((iVar10 + 0x1794)) >> 4) - 1; - if (0x2d < pickIdx) { - pickIdx = 0x2d; - } - cardRng = GHIDRA_CAST((pickIdx * 0x10 + *GHIDRA_CAST((iVar10 + 0x1794)))); - pickIdx = *cardRng; - local_28 = cardRng; - if (pickIdx == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pickIdx = *cardRng; - if (pickIdx == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - pickIdx = pickIdx >> ((uint8_t)cardRng[1] & 0x1f) ^ pickIdx; - pickIdx = pickIdx << ((uint8_t)cardRng[2] & 0x1f) ^ pickIdx; - pickIdx = pickIdx >> ((uint8_t)cardRng[3] & 0x1f) ^ pickIdx; - *cardRng = pickIdx; - if ((pickIdx & 7) == 0) { - pickIdx = Random(); - pEVar5 = Game::GetRandomPlayer(g_game,&g_vectorZero,9999999.0); - local_44.x = (pEVar5->_pos).x; - local_44.y = (pEVar5->_pos).y; - spawnedEffect = Game::Spawn(g_game,1000,0x21,&local_44,&g_vectorZero,GHIDRA_CAST(0x0),0,pickIdx); - spawnedEffect->Update(); - } - freeCells = GHIDRA_CAST(0x0); - local_50 = GHIDRA_CAST(0x0); - freeCellsEnd = GHIDRA_CAST(0x0); - freeCellsCapEnd = GHIDRA_CAST(0x0); - local_48 = GHIDRA_CAST(0x0); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - iVar10 = playerManager->_gridWidth; - pickIdx = (playerManager->_gridHeight * iVar10) / 2; - if (pickIdx != 0) { - if (0x3fffffff < pickIdx) { - /* WARNING: Subroutine does not return */ - msvc::_Xlen(); - } - msvc::vector::_Reallocate(pickIdx); - iVar10 = playerManager->_gridWidth; - freeCellsCapEnd = local_48; - freeCells = local_50; - } - iVar11 = 1; - local_50 = freeCells; - local_48 = freeCellsCapEnd; - if (1 < iVar10) { - do { - iVar10 = playerManager->_gridHeight; - iVar15 = 1; - if (1 < iVar10) { - do { - roomShape = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_18)) + 0x4)))) + 0x10)) + 0x48)); - if (roomShape == 0xb) { - if (local_18->_gridWidth / 2 <= iVar11) goto LAB_007fe72c; -joined_r0x007fe6ae: - if (iVar15 <= iVar10 / 2) goto LAB_007fe72c; - } - else { - if (roomShape == 0xc) { - if (local_18->_gridWidth / 2 < iVar11) goto joined_r0x007fe6ae; - } - else if (roomShape == 9) { - if (iVar11 < local_18->_gridWidth / 2) { -joined_r0x007fe6d3: - if (iVar15 < iVar10 / 2) goto LAB_007fe51b; - } - } - else if (roomShape == 10) { - if (local_18->_gridWidth / 2 < iVar11) goto joined_r0x007fe6d3; - } - else if ((((roomShape == 2) || (roomShape == 7)) && (2 < iVar15 - 3U)) || - (((roomShape == 3 || (roomShape == 5)) && (4 < iVar11 - 5U)))) - goto LAB_007fe51b; -LAB_007fe72c: - pvVar7 = g_game->_room; - if (((iVar11 < 0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0xc)) <= iVar11)) || - ((iVar15 < 0 || (*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x10)) <= iVar15)))) { - local_20 = GHIDRA_CAST(0xffffffff); - } - else { - local_20 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0xc)) * iVar15 + iVar11)); - if (((local_20 < GHIDRA_CAST(0x1c0)) && - (iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + GHIDRA_INT(local_20) * 4 + 0x24)), iVar10 != 0)) && - (*GHIDRA_CAST((iVar10 + 4)) != 1)) goto LAB_007fe51b; - } - pGVar8 = local_20; - msvc::set::find_node(local_5c,&local_20); - if ((*GHIDRA_CAST((GHIDRA_CAST(local_54) + 0xd)) != '\0') || - (pvVar7 = local_54, GHIDRA_INT(pGVar8) < *GHIDRA_CAST((GHIDRA_CAST(local_54) + 0x10)))) { - pvVar7 = occupiedCells; - } - if (pvVar7 == occupiedCells) { - if (freeCellsEnd == freeCellsCapEnd) { - msvc::vector::_Emplace_reallocate(freeCellsEnd,&local_20); - freeCellsCapEnd = local_48; - (*GHIDRA_CAST((GHIDRA_CAST((local_18)) + 0x11f4))) = 1; - } - else { - *freeCellsEnd = pGVar8; - freeCellsEnd = freeCellsEnd + 1; - (*GHIDRA_CAST((GHIDRA_CAST((local_18)) + 0x11f4))) = 1; - } - } - } -LAB_007fe51b: - iVar10 = local_18->_gridHeight; - iVar15 = iVar15 + 1; - } while (iVar15 < iVar10); - } - iVar11 = iVar11 + 1; - playerManager = local_18; - } while (iVar11 < local_18->_gridWidth); - freeCells = local_50; - } - puVar13 = freeCellsEnd; - local_50 = freeCells; - if (freeCells != freeCellsEnd) { - do { - cardRng = local_28; - pickIdx = *local_28; - if (pickIdx == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pickIdx = *cardRng; - if (pickIdx == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - pickIdx = pickIdx >> ((uint8_t)cardRng[1] & 0x1f) ^ pickIdx; - pickIdx = pickIdx << ((uint8_t)cardRng[2] & 0x1f) ^ pickIdx; - pickIdx = pickIdx >> ((uint8_t)cardRng[3] & 0x1f) ^ pickIdx; - *cardRng = pickIdx; - if ((pickIdx & 3) == 0) break; - local_18 = GHIDRA_CAST(0x0); - if (pickIdx == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pickIdx = *cardRng; - if (pickIdx == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - pickIdx = pickIdx >> ((uint8_t)cardRng[1] & 0x1f) ^ pickIdx; - pickIdx = pickIdx << ((uint8_t)cardRng[2] & 0x1f) ^ pickIdx; - pickIdx = pickIdx >> ((uint8_t)cardRng[3] & 0x1f) ^ pickIdx; - *cardRng = pickIdx; - uVar6 = pickIdx; - if (pickIdx == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = *cardRng; - } - if (uVar6 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)cardRng[1] & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)cardRng[2] & 0x1f) ^ uVar6; - uVar6 = uVar6 >> ((uint8_t)cardRng[3] & 0x1f) ^ uVar6; - *cardRng = uVar6; - meconiumRoll = uVar6; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = *cardRng; - } - if (uVar6 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)cardRng[1] & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)cardRng[2] & 0x1f) ^ uVar6; - local_30 = uVar6 >> ((uint8_t)cardRng[3] & 0x1f) ^ uVar6; - playerManager = &g_game->_playerManager; - *cardRng = local_30; - pEVar5 = PlayerManager::FirstCollectibleOwner(playerManager,0x21f,GHIDRA_CAST(playerManager),1); - pGVar8 = g_game; - local_20 = g_game; - if (pEVar5 == GHIDRA_CAST(0x0)) { - pvVar7 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar7) >> 2 < 0x220) { - item = GHIDRA_CAST(0x0); - } - else { - item = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x87c)); - } - bVar4 = PlayerManager::HasTemporaryEffect(&g_game->_playerManager,item); - if (bVar4 != 0) goto LAB_007fe7f7; - } - else { -LAB_007fe7f7: - if (pickIdx % 100 < 0x21) { - local_18 = GHIDRA_CAST(&DAT_00000006); - } - } - pvVar7 = (g_manager->_itemConfig)._trinkets._begin; - if (((GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(pvVar7) >> 2 < 0x5c) || - (iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x16c)), iVar10 == 0)) || - (isMeconiumBackupCounts = '\x01', (*GHIDRA_CAST((iVar10 + 0xb8)) & 0x80000000) == 0)) { - isMeconiumBackupCounts = '\0'; - } - puVar16 = (pGVar8->_playerManager)._playerList._begin; - if (puVar16 != (pGVar8->_playerManager)._playerList._end) { - do { - pEVar5 = GHIDRA_CAST(*puVar16); - if (pEVar5->_variant == 0) { - bVar4 = (GHIDRA_CAST((pEVar5)))->Entity_Player::HasTrinket(0x5b,0); - if (bVar4 == 0) { - if (((isMeconiumBackupCounts == '\0') || - (pEVar5->_backupPlayer == GHIDRA_CAST(0x0))) || - (bVar4 = (GHIDRA_CAST((pEVar5->_backupPlayer)))->Entity_Player::HasTrinket(0x5b,0), bVar4 == 0)) { - pGVar8 = local_20; - goto LAB_007fe8a2; - } - pEVar5 = pEVar5->_backupPlayer; - } - if (pEVar5 != GHIDRA_CAST(0x0)) { - if (meconiumRoll % 100 < 0x21) { - local_18 = GHIDRA_CAST(&DAT_00000005); - } - pGVar8 = g_game; - goto LAB_007fe8b6; - } - break; - } -LAB_007fe8a2: - puVar16 = puVar16 + 1; - } while (puVar16 != (pGVar8->_playerManager)._playerList._end); - pGVar8 = g_game; - } -LAB_007fe8b6: - pRVar17 = local_18; - pEVar5 = PlayerManager::FirstCollectibleOwner - (&pGVar8->_playerManager,0xca,GHIDRA_CAST(&pGVar8->_playerManager),1); - cardRng = local_28; - if (pEVar5 != GHIDRA_CAST(0x0)) { - fVar18 = 0.0; - for (piVar12 = (g_game->_playerManager)._playerList._begin; - piVar12 != (g_game->_playerManager)._playerList._end; piVar12 = piVar12 + 1) { - iVar10 = *piVar12; - if ((*GHIDRA_CAST((iVar10 + 0x2c)) == 0) && (*GHIDRA_CAST((iVar10 + 0x20a9)) == '\0')) { - fVar18 = fVar18 + *GHIDRA_CAST((iVar10 + 0x156c)); - } - } - if (GHIDRA_INT((GHIDRA_INT((fVar18 * -5.0)) + (local_30 / 100) * -100 + local_30)) < 0xb) { - pRVar17 = GHIDRA_CAST(0x3); - } - local_18 = pRVar17; - } - uVar6 = GHIDRA_INT(puVar13) - GHIDRA_INT(freeCells) >> 2; - pickIdx = *local_28; - if (pickIdx == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pickIdx = *cardRng; - if (pickIdx == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - pickIdx = pickIdx >> ((uint8_t)cardRng[1] & 0x1f) ^ pickIdx; - pickIdx = pickIdx << ((uint8_t)cardRng[2] & 0x1f) ^ pickIdx; - pickIdx = pickIdx >> ((uint8_t)cardRng[3] & 0x1f) ^ pickIdx; - pickIdx = 0; - *cardRng = pickIdx; - if (uVar6 != 0) { - pickIdx = pickIdx % uVar6; - } - pickIdx = freeCells[pickIdx]; - puVar16 = freeCells + pickIdx; - memmove(puVar16,puVar16 + 1,GHIDRA_INT(puVar13) - GHIDRA_INT((puVar16 + 1))); - cardRng = local_28; - puVar13 = puVar13 + -1; - uVar6 = *local_28; - local_20 = g_game->_room; - freeCellsEnd = puVar13; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar6 = *cardRng; - if (uVar6 == 0) { - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - } - uVar6 = uVar6 >> ((uint8_t)cardRng[1] & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)cardRng[2] & 0x1f) ^ uVar6; - local_30 = uVar6 >> ((uint8_t)cardRng[3] & 0x1f) ^ uVar6; - *cardRng = local_30; - if ((GHIDRA_INT(pickIdx) < 0) || (0x1bf < GHIDRA_INT(pickIdx))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if ((pickIdx < 0x1c0) && (local_20->_roomMap[pickIdx - 0x5cdc] < 0x385)) { - pGVar9 = operator_new(0x19c); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 9; - local_34 = pGVar9; - if (pGVar9 == GHIDRA_CAST(0x0)) { - pGVar9 = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((pGVar9)))->GridEntity::GridEntity(); - *GHIDRA_CAST(pGVar9) = IsaacRepentancePlus::GridEntity_Poop::vftable; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar9[1])) + 0x4)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar9[1])) + 0x14)))) = 0; - pGVar9[1]._varData = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(pGVar9[1])) + 0x4))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar9[1])) + 0x20)))) = 0; - pGVar9[1]._gridIndex = 0; - pGVar9[1]._spawnFrame = 0; - pGVar9[1]._rng._seed = 0; - fVar18 = g_vectorZero.y; - pGVar9[1]._rng._shift1 = GHIDRA_INT(g_vectorZero.x); - pGVar9[1]._rng._shift2 = GHIDRA_INT(fVar18); - fVar18 = g_vectorZero.y; - pGVar9[1]._rng._shift3 = GHIDRA_INT(g_vectorZero.x); - pGVar9[1]._collisionClass = GHIDRA_INT(fVar18); - pGVar2 = pGVar9 + 1; - (pGVar2->_sprite)._filename._buf[0] = '\0'; - (pGVar2->_sprite)._filename._buf[1] = '\0'; - (pGVar2->_sprite)._filename._buf[2] = '\0'; - (pGVar2->_sprite)._filename._buf[3] = '\0'; - pAVar3 = &pGVar9[1]._sprite; - (pAVar3->_filename)._buf[4] = '\0'; - (pAVar3->_filename)._buf[5] = '\0'; - (pAVar3->_filename)._buf[6] = '\0'; - (pAVar3->_filename)._buf[7] = '\0'; - } - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - if (pGVar9 != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar9)) + 0x4)))) = 0xe; - pGVar9->_gridIndex = pickIdx; - if (GHIDRA_CAST(local_20->_roomMap[pickIdx - 0x5eae]) != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(local_20->_roomMap[pickIdx - 0x5eae]))(1); - } - local_20->_roomMap[pickIdx - 0x5eae] = GHIDRA_INT(pGVar9); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar9)) + 0x8)))) = local_18; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar9)) + 0x14)))) = local_30; - pGVar9->_varData = 0; - pGVar9->_collisionClass = 0; - pGVar9->BeginBatches(); - pGVar8 = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar9)) + 0x10)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar9)) + 0x10)))) + 1; - (*GHIDRA_CAST((GHIDRA_CAST((pGVar9)) + 0x1c))) = 1; - pGVar9->_spawnFrame = pGVar8->_frameCount; - } - } - } while (freeCells != puVar13); - } - if (freeCells != GHIDRA_CAST(0x0)) { - pickIdx = GHIDRA_INT(freeCellsCapEnd) - GHIDRA_INT(freeCells) & 0xfffffffc; - puVar13 = freeCells; - if (0xfff < pickIdx) { - puVar13 = GHIDRA_CAST(freeCells[-1]); - pickIdx = pickIdx + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(freeCells) + (-4 - GHIDRA_INT(puVar13))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(puVar13,pickIdx); - } - FID_conflict__Erase_tree_>_> - (&occupiedCells,(fuzzer_allocator_> *)&occupiedCells - ,*(_Tree_node **)(GHIDRA_INT(occupiedCells) + 4)); - operator_delete(occupiedCells,0x14); - ExceptionList = local_10; - return; -} - -// 007fec00 -void Room::TriggerBossDeath(Entity *entity) -{ - void *pvVar1; - uint8_t bVar2; - uint8_t isFiligreeFeathersOwned; - RoomDescriptor *returnRoom; - uint32_t uVar3; - RNG *this_00; - uint32_t uVar4; - int *node; - uint3 extraout_var; - Entity_Player *player; - Vector *pVVar5; - uint32_t uVar6; - float fVar7; - float extraout_ECX; - ItemOverlay *itemOverlay; - int iVar8; - int *piVar9; - Game *game; - int iVar10; - code *pcVar11; - int bossType; - bool bVar12; - Vector *position; - EntityRef damageSource; - uint8_t auStack_b0 [12]; - Entity *bossEntity; - uint8_t auStack_a0 [12]; - int iStack_94; - uint8_t auStack_90 [12]; - int iStack_84; - Vector VStack_80; - Vector VStack_78; - Vector VStack_70; - Vector VStack_68; - Vector VStack_60; - Vector VStack_58; - Vector VStack_50; - RNG rng; - Vector VStack_38; - Room *local_30; - Vector VStack_2c; - uint8_t bStack_23; - uint8_t bStack_22; - char local_21; - int iStack_20; - RNG subRng; - uint32_t local_c; - uint8_t auStack_8 [4]; - bool isAngelSpawnRoom; - int *nodeEntityType; - - local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); - bossEntity = entity; - if (entity->_type == 0x19b) { - if (entity->_variant == 1) { - return; - } - if (entity->_variant == 2) { - return; - } - } - if (((g_game->_difficulty != 2) && (g_game->_difficulty != 3)) || - (local_21 = '\x01', this->_roomType != 1)) { - local_21 = '\0'; - } - uVar4 = GHIDRA_UINT(entity->_flags); - if ((uVar4 & 0x80100000) != 0) { - return; - } - *GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)) = *GHIDRA_CAST((GHIDRA_INT(&entity->_flags) + 4)); - *GHIDRA_CAST(&entity->_flags) = uVar4 | 0x100000; - if ((uVar4 & 0x20000000) != 0) { - return; - } - local_30 = this; - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - KAGE_LogMessage(1,GHIDRA_CAST("[Frame %d] ")); - } - KAGE_LogMessage(1,GHIDRA_CAST("TriggerBossDeath: %d bosses remaining.\n")); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7224)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7224)))) + -1; - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7224))))) goto LAB_00800060; - bossType = entity->_type; - VStack_58.y = (float)entity->_variant; - VStack_38.y = (float)entity->_subtype; - if ((g_game->_ambush)._isActive == 0) { - uVar4 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x4)))) + 100)); - } - else { - uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x265f4)))); - } - rng._shift1 = 4; - rng._shift2 = 3; - rng._shift3 = 0x11; - VStack_68.y = (float)bossType; - rng._seed = uVar4; - if (((((GHIDRA_CAST(bossType) != GHIDRA_CAST(0x2e)) && (GHIDRA_CAST(bossType) != GHIDRA_CAST(&DAT_0000002f))) - && ((GHIDRA_CAST(bossType) != GHIDRA_CAST(0x30) && - ((GHIDRA_CAST(bossType) != GHIDRA_CAST(0x31) && (GHIDRA_CAST(bossType) != GHIDRA_CAST(0x32))))))) && - (GHIDRA_CAST(bossType) != GHIDRA_CAST(&DAT_00000033))) && (GHIDRA_CAST(bossType) != GHIDRA_CAST(0x34))) { - if (GHIDRA_CAST(bossType) == GHIDRA_CAST(0x51)) { - bVar12 = VStack_58.y == 1.4013e-45; -LAB_007fed8f: - if (bVar12) goto LAB_007ff7d4; - } - else if (GHIDRA_CAST(bossType) == GHIDRA_CAST(0x26)) { - bVar12 = VStack_58.y == 2.8026e-45; - goto LAB_007fed8f; - } - if ((local_30->_roomType == 0x10) && - ((iVar10 = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x4)))) + 0x10)) + 0x10)), iVar10 == 2 || - (iVar10 == 3)))) { - if ((GHIDRA_CAST(bossType) == GHIDRA_CAST(0x38f)) && (iVar10 == 3)) { - returnRoom = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_dungeonReturnRoomIndex,-1); - if ((returnRoom->Data != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(returnRoom->Data) + 8)) == 5)) { - returnRoom->Flags = returnRoom->Flags | 0x10000; - } - } - } - else { - KAGE_LogMessage(1,GHIDRA_CAST("deathspawn_boss, color idx %d\n")); - VStack_80.x = (entity->_pos).x; - VStack_80.y = (entity->_pos).y; - VStack_50.y = (float)local_30->_roomType; - if (((GHIDRA_CAST(VStack_50.y) == &DAT_00000005) || - ((((GHIDRA_CAST(VStack_50.y) == &DAT_0000000f || - (iVar10 = (g_manager->_musicManager)._currentMusicID, iVar10 == 9)) || (iVar10 == 0x1a) - ) || (iVar10 == 0x29)))) && - (((((g_game->_ambush)._isActive == 0 && - ((bVar2 = Game::IsGreedMode(g_game), bVar2 == 0 || ((code *)VStack_50.y != (code *)0x1)) - )) && (uVar6 = GetBossVictoryJingle(local_30), uVar6 != 0)) && - (((g_manager->_musicManager)._currentMusicID != uVar6 && - ((GHIDRA_CAST((GHIDRA_CAST(&g_manager->_musicManager))))->Music::Play(uVar6, - (g_manager->_optionsConfig)._musicVolume), - 0x25 < (GHIDRA_INT((g_manager->_musicManager)._entries._end) - - GHIDRA_INT((g_manager->_musicManager)._entries._begin)) / 0x60)))))) { - (g_manager->_musicManager)._queuedMusicID = 0x25; - } - if ((local_30->_roomType == 5) || (local_30->_roomType == 0x11)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_90)) + 0x0))) = (GHIDRA_CAST((&rng)))->RNG::Next(); - VStack_78.y = (float)entity->_initSeed; - VStack_70.y = 9.80909e-45; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_90)) + 0x4))) = 0x900000002; - iStack_84 = 0xf; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_b0)) + 0x0))) = 0xd00000003; - VStack_50.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)auStack_90)) + 0x0))); - if (local_30->_roomType == 0x11) { - VStack_60.y = 1.4013e-45; - if (((g_manager->_persistentGameData)._achievements[0x21] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) { - uVar4 = (GHIDRA_CAST((GHIDRA_CAST(auStack_90))))->RNG::RandomInt(2); - VStack_60.y = (float)(1 - uVar4); - VStack_50.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)auStack_90)) + 0x0))); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_90)) + 0x0))) = VStack_50.y; - bVar2 = Game::IsHardMode(); - if (bVar2 == 0) { - fVar7 = VStack_60.y; - goto LAB_007feffd; - } -LAB_007fef9b: - uVar4 = (GHIDRA_CAST((GHIDRA_CAST(auStack_90))))->RNG::RandomInt(2); - fVar7 = (float)(GHIDRA_INT(VStack_60.y) - uVar4); - pcVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&((code *)auStack_90)) + 0x0))); - VStack_60.y = fVar7; - } - else { - if (((g_manager->_persistentGameData)._achievements[0x21] == 0) && - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST(0x0))) || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) { - VStack_60.y = 2.8026e-45; - } - else { - VStack_60.y = 1.4013e-45; - } - bVar2 = Game::IsHardMode(); - fVar7 = extraout_ECX; - if (bVar2 != 0) goto LAB_007fef9b; -LAB_007feffd: - pcVar11 = (code *)VStack_50.y; - } - uVar4 = rng._seed; - if (0 < GHIDRA_INT(fVar7)) { - do { - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar4; - bVar2 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x16); - if ((bVar2 == 0) || (uVar4 == (uVar4 / 5) * 5)) { - if (pcVar11 == (code *)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar6 = GHIDRA_UINT(pcVar11) >> (auStack_90[4] & 0x1f) ^ GHIDRA_UINT(pcVar11); - uVar6 = uVar6 << (auStack_90[8] & 0x1f) ^ uVar6; - pcVar11 = (code *)(uVar6 >> ((uint8_t)iStack_84 & 0x1f) ^ uVar6); - if (VStack_78.y == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar6 = GHIDRA_UINT(VStack_78.y) >> (auStack_b0[0] & 0x1f) ^ GHIDRA_UINT(VStack_78.y); - subRng._shift1 = 3; - subRng._shift2 = 1; - uVar6 = uVar6 << (auStack_b0[4] & 0x1f) ^ uVar6; - VStack_78.y = (float)(uVar6 >> (SUB41(VStack_70.y,0) & 0x1f) ^ uVar6); - VStack_50.y = 1.96182e-44; - if (VStack_78.y == 0.0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar6 = GHIDRA_UINT(VStack_78.y) >> 3 ^ GHIDRA_UINT(VStack_78.y); - uVar6 = uVar6 << 1 ^ uVar6; - uVar6 = uVar6 >> 0xe ^ uVar6; - fVar7 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * - 2.3283062e-10 * 3.14; - VStack_50.y = fVar7 + fVar7; - VStack_2c.x = cos(VStack_50.y); - VStack_2c.x = VStack_2c.x * 7.0; - VStack_2c.y = sin(VStack_50.y); - VStack_2c.y = VStack_2c.y * 7.0; - pVVar5 = FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_a0 + 8)),&VStack_80,0.0,0,0,0); - Game::Spawn(g_game,5,10,pVVar5,&VStack_2c,entity,0,GHIDRA_UINT(pcVar11)); - } - VStack_60.y = (float)(GHIDRA_INT(VStack_60.y) + -1); - } while (VStack_60.y != 0.0); - VStack_60.y = 0.0; - rng._seed = uVar4; - } - } - if ((GHIDRA_CAST(VStack_38.y) != GHIDRA_CAST(0x0)) && (local_21 == '\0')) { - uVar4 = 0; - iVar10 = *GHIDRA_CAST(entity[3]._sprite._filename._buf); - switch(VStack_68.y) { - case 2.66247e-44: - if ((VStack_58.y == 0.0) && (iVar10 == 1)) goto DAT_007ff20d; - break; - case 6.30584e-44: -DAT_007ff20d: - uVar4 = 3; - break; - case 8.82818e-44: - if ((VStack_58.y == 0.0) && (iVar10 == 0)) { - uVar4 = 3; - } - break; - case 1.10703e-43: - if (((VStack_58.y == 0.0) || (VStack_58.y == 1.4013e-44)) && (iVar10 == 1)) { - uVar4 = 3; - } - break; - case 1.38729e-43: - if (iVar10 == 0) { - uVar4 = 3; - } - } - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - bVar2 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x16); - if ((bVar2 == 0) || (uVar6 == (uVar6 / 5) * 5)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_90)) + 0x0))) = entity->_initSeed; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_90)) + 0x4))) = 0x500000003; - iStack_84 = 0x16; - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar3 = (GHIDRA_CAST((GHIDRA_CAST(auStack_90))))->RNG::Next(); - pVVar5 = RandomVector(GHIDRA_CAST((auStack_b0 + 4)),uVar3); - VStack_78.y = pVVar5->y * 7.0; - VStack_78.x = pVVar5->x * 7.0; - pVVar5 = FindFreePickupSpawnPosition(g_game->_room,&VStack_60,&VStack_80,0.0,0,0,0); - Game::Spawn(g_game,5,10,pVVar5,&VStack_78,entity,uVar4,uVar6); - } - uVar4 = rng._seed; - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x4)))) + 8)) == g_game->_lastBossRoomListIdx) && - (player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x24c,GHIDRA_CAST(&g_game->_playerManager),1), - player != GHIDRA_CAST(0x0))) { - uVar6 = 0; - VStack_70.y = 3.50325e-44; - pvVar1 = g_game->_room; - subRng._shift1 = 5; - subRng._shift2 = 0x1b; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1264)) != 0) { - do { - VStack_68.y = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x125c)) + uVar6 * 4)); - bVar2 = (GHIDRA_CAST((GHIDRA_CAST(VStack_68.y))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if (bVar2 != 0) { - VStack_50.y = *GHIDRA_CAST((*GHIDRA_CAST(VStack_68.y) + 0x20)); - VStack_38.y = (float)&g_game->_playerManager; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)subRng._shift1 & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)subRng._shift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (SUB41(VStack_70.y,0) & 0x1f) ^ uVar4; - player = PlayerManager::RandomCollectibleOwner - (GHIDRA_CAST(VStack_38.y),0x24c,uVar4,GHIDRA_CAST(0x0)); - (GHIDRA_CAST((&damageSource)))->EntityRef::constructor(GHIDRA_CAST(player)); - (*(code *)VStack_50.y)(0x42c80000,0,0,&damageSource,0x1e); - } - uVar6 = uVar6 + 1; - } while (uVar6 < *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1264))); - entity = bossEntity; - } - uVar4 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - player = Game::GetPlayer(g_game,uVar4); - (GHIDRA_CAST((player)))->Entity_Player::SetFullHearts(); - (GHIDRA_CAST((player)))->Entity_Player::FullCharge(-1,0,0); - bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x24c,0); - if (((bVar2 != 0) && - (pvVar1 = (g_manager->_itemConfig)._nullItems._begin, - 0xe0 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) & - 0xfffffffcU)))) && - (pcVar11 = *(code **)(GHIDRA_CAST(pvVar1) + 0xe0), pcVar11 != (code *)0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_90)) + 0x4))) = (uint64_t)*GHIDRA_CAST((pcVar11 + 0x78)) << 0x20; - iStack_84 = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_90)) + 0x0))) = pcVar11; - (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::AddEffect(auStack_90,1,1); - } - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - Level::RemoveCurses(GHIDRA_CAST(g_game),0xffffffff); - Level::ShowMap(GHIDRA_CAST(g_game)); - itemOverlay = &g_game->_itemOverlay; - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x745c)) = 1; - (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(5,0,GHIDRA_CAST(0x0)); - } - if ((entity->_type == 0x38a) && (entity->_dead != 0)) { - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x222); - game = g_game; - iStack_20 = 0x100; - subRng._seed = 0xdc; - subRng._shift1 = 0x13; - subRng._shift2 = 0x89; - subRng._shift3 = 0x286; - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar4 = ItemPool::GetCollectibleFromList(&game->_itemPool,&iStack_20,5,uVar4,0,0,0); - if ((uVar4 == 0) || (uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(7), uVar6 != 0)) { - (GHIDRA_CAST((&subRng)))->RNG::game_constructor(entity->_initSeed,0x17); - iVar10 = 3; - do { - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar6 = (GHIDRA_CAST((&subRng)))->RNG::Next(); - pVVar5 = RandomVector(&VStack_58,uVar6); - VStack_38.y = (entity->_pos).y; - VStack_38.x = (entity->_pos).x; - VStack_80.y = pVVar5->y * 7.0; - VStack_80.x = pVVar5->x * 7.0; - Game::Spawn(g_game,5,0x28,&VStack_38,&VStack_80,entity,0,uVar4); - iVar10 = iVar10 + -1; - } while (iVar10 != 0); - } - else { - VStack_80.y = (entity->_pos).y; - VStack_80.x = (entity->_pos).x; - FindFreePickupSpawnPosition(g_game->_room,&VStack_50,&VStack_80,0.0,0,0,0); - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - Game::Spawn(g_game,5,100,&VStack_50,&g_vectorZero,entity,uVar4,uVar6); - pvVar1 = (g_game->_itemPool)._removedCollectibles._begin; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + (uVar4 >> 5) * 4)) = - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + (uVar4 >> 5) * 4)) | 1 << (uVar4 & 0x1f); - } - } - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x4)))) + 8)) == g_game->_lastBossRoomListIdx) && - (1 < g_game->_stagesWithoutDamage)) && - (((g_game->_levelStateFlags & 0x20) == 0 && - (bVar2 = Game::GetStateFlag(g_game,0x2d), bVar2 == 0)))) { - Game::SetStateFlag(0x2d,1); - (GHIDRA_CAST((&subRng)))->RNG::game_constructor(entity->_initSeed,0x18); - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar6 = (GHIDRA_CAST((&subRng)))->RNG::Next(); - pVVar5 = RandomVector(GHIDRA_CAST((auStack_90 + 8)),uVar6); - VStack_68.y = (entity->_pos).y; - VStack_68.x = (entity->_pos).x; - VStack_70.y = pVVar5->y * 7.0; - VStack_70.x = pVVar5->x * 7.0; - Game::Spawn(g_game,5,0x15e,&VStack_68,&VStack_70,entity,0x91,uVar4); - } - iVar10 = (GHIDRA_CAST((entity)))->Entity::GetBossID(); - FUN_0092a5e0(iVar10); - if (entity->_type == 0x38c) { - PersistentGameData::IncreaseEventCounter(&g_manager->_persistentGameData,0x1ed,1); - } - } - goto LAB_00800032; - } -LAB_007ff7d4: - if ((((local_30->_roomType == 6) || ((*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x7228))) != '\0')) || - ((local_30->_roomType == 5 && (bVar2 = Game::IsGreedMode(g_game), bVar2 != 0)))) && - ((uVar4 = GetBossVictoryJingle(local_30), uVar4 != 0 && - ((GHIDRA_CAST((GHIDRA_CAST(&g_manager->_musicManager))))->Music::Play(uVar4,(g_manager->_optionsConfig)._musicVolume), - 0x25 < (GHIDRA_INT((g_manager->_musicManager)._entries._end) - - GHIDRA_INT((g_manager->_musicManager)._entries._begin)) / 0x60)))) { - (g_manager->_musicManager)._queuedMusicID = 0x25; - } - if (local_21 != '\0') goto LAB_007fffcd; - if (GHIDRA_CAST(bossType) == GHIDRA_CAST(0x2e)) { - if (VStack_58.y != 2.8026e-45) goto LAB_007ffad3; - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - pVVar5 = FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_90 + 8)),&VStack_2c,0.0,0,0,0); - Game::Spawn(g_game,5,0x15e,pVVar5,&g_vectorZero,entity,0x3d,uVar4); - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x4d); - bossType = GHIDRA_INT(VStack_68.y); - goto LAB_00800005; - } - if (GHIDRA_CAST(bossType) != GHIDRA_CAST(0x26)) { - if ((GHIDRA_CAST(bossType) != GHIDRA_CAST(0x51)) || (VStack_58.y != 1.4013e-45)) goto LAB_007ffad3; - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - FindFreePickupSpawnPosition(g_game->_room,&VStack_58,&VStack_2c,0.0,0,0,0); - uVar4 = 0x84; - bVar2 = ItemPool::is_collectible_available(&g_game->_itemPool,0x125,1); - if ((bVar2 != 0) && (uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(2), uVar6 != 0)) { - uVar4 = 0x125; - } - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - Game::Spawn(g_game,5,100,&VStack_58,&g_vectorZero,entity,uVar4,uVar6); - ItemPool::RemoveCollectible(&g_game->_itemPool,uVar4,0,0); - goto LAB_0080001f; - } - if (VStack_58.y == 2.8026e-45) { - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(4); - if (((uVar4 == 0) && - (bVar2 = ItemPool::is_collectible_available(&g_game->_itemPool,0x261,0), bVar2 != 0)) && - (bVar2 = ItemPool::RemoveCollectible(&g_game->_itemPool,0x261,0,0), bVar2 != 0)) { - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - FindFreePickupSpawnPosition(g_game->_room,&VStack_78,&VStack_2c,0.0,0,0,0); - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar3 = 0x261; - pVVar5 = &VStack_78; - uVar6 = 100; - } - else { - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - FindFreePickupSpawnPosition(g_game->_room,&VStack_60,&VStack_2c,0.0,0,0,0); - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar3 = 0; - pVVar5 = &VStack_60; - uVar6 = 0x1e; - } - Game::Spawn(g_game,5,uVar6,pVVar5,&g_vectorZero,entity,uVar3,uVar4); - goto LAB_00800005; - } -LAB_007ffad3: - uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(4); - if ((uVar4 != 0) && ((uVar4 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(7), uVar4 != 0 || (VStack_58.y != 1.4013e-45)))) - goto LAB_007ffaf7; - switch(bossType) { - case 0x2e: - uVar4 = 0x2a; - uVar6 = 0x8c; - break; - case 0x2f: - uVar4 = 0xd; - uVar6 = 0x2d; - break; - case 0x30: - uVar4 = 0x25; - uVar6 = 0x6a; - break; - case 0x31: - uVar4 = 0xf; - uVar6 = 0x81; - break; - case 0x32: - if ((VStack_58.y == 1.4013e-45) && - (((g_manager->_persistentGameData)._achievements[10] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - uVar4 = 0x4a; - } - else { - uVar4 = 0x40; - } - goto code_r0x007ffbb6; - case 0x33: - uVar4 = (-GHIDRA_UINT((GHIDRA_UINT(VStack_58.y) % 10 != 1)) & 0xffffffb1) + 0x80; - goto code_r0x007ffbb6; - case 0x34: - uVar4 = 0x41; - uVar6 = 0x51; - break; - default: - goto LAB_007ffaf7; - } - if (VStack_58.y == 1.4013e-45) { - uVar4 = uVar6; - } -code_r0x007ffbb6: - bVar2 = ItemPool::is_collectible_available(&g_game->_itemPool,uVar4,0); - if (bVar2 != 0) { - bVar2 = ItemPool::RemoveCollectible(&g_game->_itemPool,uVar4,0,0); - if (bVar2 != 0) { - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - FindFreePickupSpawnPosition(g_game->_room,GHIDRA_CAST((auStack_b0 + 4)),&VStack_2c,0.0,0,0,0); - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - pVVar5 = &g_vectorZero; - position = GHIDRA_CAST((auStack_b0 + 4)); - uVar3 = 100; - goto code_r0x007fffc0; - } -LAB_007ffaf7: - if (GHIDRA_CAST((GHIDRA_INT(&((GHIDRA_CAST((bossType + -0x410)))->_dropRNG)._shift1) + 2)) < - &DAT_00000007) goto code_r0x007ffb03; - goto LAB_007fffcd; - } -code_r0x007ffb03: - switch((&PTR_DAT_008004c0)[GHIDRA_INT((GHIDRA_INT(&((GHIDRA_CAST((bossType + -0x410)))->_dropRNG)._shift1) + 2))]) - { - case GHIDRA_CAST(0x7ffc4e): - uVar3 = 0x46; - break; - case GHIDRA_CAST(0x7ffc58): - uVar3 = 10; -code_r0x007ffe1d: - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_a0)) + 0x0))) = entity->_initSeed; - iStack_94 = 0x1d; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_a0)) + 0x4))) = 3; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_a0)) + 0x8))) = 3; - uVar4 = (GHIDRA_CAST((GHIDRA_CAST(auStack_a0))))->RNG::Next(); - pVVar5 = RandomVector(GHIDRA_CAST((auStack_90 + 8)),uVar4); - VStack_70.y = pVVar5->y * 5.0; - VStack_70.x = pVVar5->x * 5.0; - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - VStack_2c.x = (entity->_pos).x; - VStack_2c.y = (entity->_pos).y; - Game::Spawn(g_game,5,uVar3,&VStack_2c,&VStack_70,entity,0,uVar4); - VStack_38.y = (float)(GHIDRA_CAST((&rng)))->RNG::Next(); - if (((uVar3 != 10) || - (bVar2 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x16), bVar2 == 0)) || - ((GHIDRA_UINT(VStack_38.y) & 1) == 0)) { - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - VStack_38.x = VStack_70.x * -1.0; - VStack_68.x = (entity->_pos).x; - VStack_68.y = (entity->_pos).y; - uVar4 = 0; - pVVar5 = &VStack_38; - VStack_38.y = VStack_70.y * -1.0; - position = &VStack_68; - goto code_r0x007fffc0; - } - goto LAB_007fffcd; - case GHIDRA_CAST(0x7ffc62): - uVar4 = entity->_initSeed; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_a0)) + 0x4))) = 3; - (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_a0)) + 0x8))) = 3; - VStack_38.y = (float)&DAT_0000001d; - uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5); - VStack_60.y = (float)(uVar6 + 4); - if (0 < GHIDRA_INT(VStack_60.y)) { - uVar6 = rng._seed; - do { - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar4 = uVar4 >> (auStack_a0[4] & 0x1f) ^ uVar4; - subRng._shift1 = 3; - subRng._shift2 = 1; - uVar4 = uVar4 << (auStack_a0[8] & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (SUB41(VStack_38.y,0) & 0x1f) ^ uVar4; - VStack_70.y = 1.96182e-44; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar3 = uVar4 >> 3 ^ uVar4; - uVar3 = uVar3 << 1 ^ uVar3; - uVar3 = uVar3 >> 0xe ^ uVar3; - fVar7 = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283062e-10 * 3.14; - VStack_50.y = fVar7 + fVar7; - uVar3 = Random(); - VStack_78.y = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * - 2.3283064e-10 * 5.0 + 2.0; - VStack_2c.x = cos(VStack_50.y); - VStack_2c.x = VStack_2c.x * VStack_78.y; - VStack_2c.y = sin(VStack_50.y); - VStack_2c.y = VStack_2c.y * VStack_78.y; - if (uVar6 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar11 = (code *)swi(3); - (*pcVar11)(); - return; - } - uVar6 = uVar6 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar6; - uVar6 = uVar6 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar6; - VStack_80.y = (entity->_pos).y; - uVar6 = uVar6 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar6; - VStack_80.x = (entity->_pos).x; - Game::Spawn(g_game,5,0x14,&VStack_80,&VStack_2c,entity,0,uVar6); - VStack_60.y = (float)(GHIDRA_INT(VStack_60.y) + -1); - } while (VStack_60.y != 0.0); - VStack_60.y = 0.0; - bossType = GHIDRA_INT(VStack_68.y); - } - goto LAB_007fffcd; - case GHIDRA_CAST(0x7ffe18): - uVar3 = 0x28; - goto code_r0x007ffe1d; - case GHIDRA_CAST(0x7fff34): - uVar3 = 300; - break; - case GHIDRA_CAST(0x7fff3b): - uVar3 = 0x1e; - break; - case GHIDRA_CAST(0x7fff97): - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - VStack_50.x = (entity->_pos).x; - VStack_50.y = (entity->_pos).y; - uVar4 = 3; - pVVar5 = &g_vectorZero; - position = &VStack_50; - uVar3 = 0x28; - goto code_r0x007fffc0; - } - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - FindFreePickupSpawnPosition(g_game->_room,GHIDRA_CAST((auStack_a0 + 8)),&VStack_2c,0.0,0,0,0); - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar4 = 0; - pVVar5 = &g_vectorZero; - position = GHIDRA_CAST((auStack_a0 + 8)); -code_r0x007fffc0: - Game::Spawn(g_game,5,uVar3,position,pVVar5,entity,uVar4,uVar6); -LAB_007fffcd: - if ((bossType < 0x2e) || (0x34 < bossType)) { - fVar7 = VStack_58.y; - if (bossType != 0x26) goto LAB_00800015; - if (VStack_58.y == 2.8026e-45) goto LAB_00800005; - } - else if ((bossType == 0x2e) && (VStack_58.y == 2.8026e-45)) { -LAB_00800005: - fVar7 = VStack_58.y; - FUN_0092a520(6); -LAB_00800015: - if ((GHIDRA_CAST(bossType) == GHIDRA_CAST(0x51)) && (fVar7 == 1.4013e-45)) { -LAB_0080001f: - PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x8f); - } - } - else { - FUN_0092a520(bossType + -0x2e); - } -LAB_00800032: - this = local_30; - if ((g_game->_ambush)._isActive == 0) { - (GHIDRA_CAST((&subRng)))->RNG::game_constructor(*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_30)) + 0x4)))) + 100)),4); - uVar4 = (GHIDRA_CAST((this_00)))->RNG::Next(); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 100)) = uVar4; - } -LAB_00800060: - if ((entity->_type == 0x10f) || (entity->_type == 0x110)) { - bVar12 = true; - } - else { - bVar12 = false; - } - iVar10 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)); - if (((iVar10 == 0xf) || (iVar10 == 0xd)) || (iVar10 == 8)) { - isAngelSpawnRoom = true; - } - else { - isAngelSpawnRoom = false; - } - if (!bVar12) { - return; - } - if (!isAngelSpawnRoom) { - return; - } - piVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7300)))); - node = GHIDRA_CAST(*piVar9); - if (node != piVar9) { - iVar10 = 0; - do { - nodeEntityType = node + 4; - node = GHIDRA_CAST(*node); - iVar8 = iVar10 + 1; - if (*nodeEntityType != entity->_type) { - iVar8 = iVar10; - } - iVar10 = iVar8; - } while (node != piVar9); - this = local_30; - if (iVar8 != 0) { - return; - } - } - (GHIDRA_CAST((&rng)))->RNG::game_constructor(entity->_initSeed,0x1e); - game = g_game; - iVar10 = entity->_type; - if (iVar10 == 0x10f) { - bVar2 = Game::GetStateFlag(g_game,0x32); - if (bVar2 == 0) { - Game::SetStateFlag(0x32,1); - game = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x2675c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x2675c)))) + 1; - iVar10 = entity->_type; - goto LAB_00800123; - } - } - else { -LAB_00800123: - if ((iVar10 == 0x110) && (bVar2 = Game::GetStateFlag(game,0x33), bVar2 == 0)) { - Game::SetStateFlag(0x33,1); - game = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x2675c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x2675c)))) + 1; - } - } - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - FindFreePickupSpawnPosition(game->_room,&VStack_38,&VStack_2c,0.0,0,0,0); - bStack_23 = PlayerManager::AnyoneHasCollectible(&g_game->_playerManager,0xee); - bStack_22 = PlayerManager::AnyoneHasCollectible(&g_game->_playerManager,0xef); - iVar10 = (this->_entityList)._updateEL._size; - VStack_68.y = (float)(GHIDRA_UINT(extraout_var) << 8); - local_21 = '\0'; - if (iVar10 != 0) { - piVar9 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))); - do { - iVar8 = *piVar9; - if ((*GHIDRA_CAST((iVar8 + 0x28)) == 5) && (*GHIDRA_CAST((iVar8 + 0x2c)) == 100)) { - if (*GHIDRA_CAST((iVar8 + 0x30)) == 0xee) { - local_21 = '\x01'; - } - else { - VStack_68.y = (float)(GHIDRA_UINT(VStack_68.y) & 0xff); - if (*GHIDRA_CAST((iVar8 + 0x30)) == 0xef) { - VStack_68.y = 1.4013e-45; - } - } - } - piVar9 = piVar9 + 1; - iVar10 = iVar10 + -1; - } while (iVar10 != 0); - entity = bossEntity; - } - bVar2 = bStack_22; - if (((bStack_23 == 0) && (local_21 == '\0')) && - ((isFiligreeFeathersOwned = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x7b), - bVar2 = bStack_22, isFiligreeFeathersOwned == 0 || (bStack_22 != 0)))) { - bStack_22 = '\x01'; - } - else { - bStack_22 = '\0'; - } - if (((bVar2 == 0) && ((*GHIDRA_CAST((GHIDRA_CAST(&(VStack_68.y)) + 0x0))) == '\0')) && - ((bVar2 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x7b), bVar2 == 0 || - (bStack_23 != 0)))) { - bStack_23 = '\x01'; - } - else { - bStack_23 = '\0'; - } - if (entity->_type == 0x10f) { - if (bStack_22 == '\0') { -LAB_008002a5: - bVar2 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0x7b); - game = g_game; - if (bVar2 == 0) { - uVar4 = 0; - } - else { - uVar4 = (GHIDRA_CAST((&rng)))->RNG::Next(); - uVar4 = ItemPool::GetCollectible(&game->_itemPool,4,uVar4,0,0,0); - player = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0x7b); - if (player != GHIDRA_CAST(0x0)) { - iVar10 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x7b); - if (iVar10 == 2) { - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - Game::Spawn(g_game,5,10,&VStack_38,&g_vectorZero,entity,8,uVar6); - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - pVVar5 = FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_90 + 8)),&VStack_2c,0.0,0,0,0); - VStack_38.x = pVVar5->x; - VStack_38.y = pVVar5->y; - } - else if (iVar10 == 3) { - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - Game::Spawn(g_game,5,10,&VStack_38,&g_vectorZero,entity,3,uVar6); - VStack_2c.y = (entity->_pos).y; - VStack_2c.x = (entity->_pos).x; - pVVar5 = FindFreePickupSpawnPosition - (g_game->_room,GHIDRA_CAST((auStack_90 + 8)),&VStack_2c,0.0,0,0,0); - VStack_38.x = pVVar5->x; - VStack_38.y = pVVar5->y; - } - } - } - if (bStack_22 == '\0') { - if (bStack_23 == '\0') { - if (uVar4 == 0) { - return; - } - goto LAB_0080041c; - } - goto LAB_0080029b; - } - } - uVar4 = 0xee; - } - else { - if ((entity->_type != 0x110) || (bStack_23 == '\0')) goto LAB_008002a5; -LAB_0080029b: - uVar4 = 0xef; - } -LAB_0080041c: - uVar6 = (GHIDRA_CAST((&rng)))->RNG::Next(); - Game::Spawn(g_game,5,100,&VStack_38,&g_vectorZero,entity,uVar4,uVar6); - return; -} - -// 00800500 -void Room::update_ambient_sounds() -{ - Room *sfxManager = this; - uint8_t bVar1; - LayerState *layer; - float *pfVar2; - int iVar3; - void *playerListEnd; - SoundEffects *sfxManager; - Game *game; - PlayerManager *playerManager; - int *piVar4; - uint32_t playerIdx; - int iVar5; - void **ppvVar6; - float fVar7; - float fVar8; - float fVar9; - float fVar10; - float flyBuzzPitch; - float avgPlayerVelY; - float avgPlayerVelX; - float sfxA3Volume; - float local_6c; - float portalVolume; - float minecartVolume; - float flyBuzzVolume; - float sfx1d9Volume; - int flyCount; - float fireVolume; - float visFattyLaserVolume; - float ballAndChainVolume; - float sfx217Volume; - float sfx22eVolume; - float dogmaVolume; - float dogmaAngelVolume; - float dogmaAngelPitch; - float sfx264Volume; - float local_24; - float laserLoopVolume; - float sfx1dcVolume; - float local_18; - float local_14; - Vector playersCenter; - Manager *manager; - - players_center_position(&g_game->_playerManager,&playersCenter,1); - if (g_manager->_framecount == DAT_00c5c4d8) { - avgPlayerVelX = DAT_00c94374; - avgPlayerVelY = DAT_00c94378; - } - else { - playerManager = &g_game->_playerManager; - local_6c = 0.0; - fVar9 = 0.0; - fVar10 = 0.0; - playerIdx = 0; - avgPlayerVelY = 0.0; - avgPlayerVelX = 0.0; - fVar8 = (float)0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - playerListEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (playerManager->_playerList)._end; - fVar9 = avgPlayerVelY; - fVar10 = avgPlayerVelX; - } - piVar4 = (playerManager->_playerList)._begin; - if (playerIdx < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(piVar4) >> 2))) { - piVar4 = piVar4 + playerIdx; - } - iVar3 = *piVar4; - if (*GHIDRA_CAST((iVar3 + 0x2c)) == 0) { - if (*GHIDRA_CAST((iVar3 + 0x13c0)) == 0x23) goto LAB_0080060f; - if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && - (bVar1 = NetplayManager::IsIdxLocalPlayer - (GHIDRA_CAST(&g_manager->_netplayManager), - *GHIDRA_CAST((iVar3 + 0x1618))), bVar1 == 0)) { - fVar9 = avgPlayerVelY; - fVar10 = avgPlayerVelX; - goto LAB_0080060f; - } - fVar10 = *GHIDRA_CAST((iVar3 + 0x360)) + avgPlayerVelX; - fVar9 = *GHIDRA_CAST((iVar3 + 0x364)) + avgPlayerVelY; - local_6c = (float)(GHIDRA_INT(local_6c) + 1); - avgPlayerVelY = fVar9; - avgPlayerVelX = fVar10; - } - else { -LAB_0080060f: - } - playerIdx = playerIdx + 1; - playerManager = &g_game->_playerManager; - fVar8 = local_6c; - } while (playerIdx < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - DAT_00c5c4d8 = g_manager->_framecount; - if (GHIDRA_INT(fVar8) < 1) { - avgPlayerVelY = g_vectorZero.y; - avgPlayerVelX = g_vectorZero.x; - } - else { - avgPlayerVelY = fVar9 / (float)GHIDRA_INT(fVar8); - avgPlayerVelX = fVar10 / (float)GHIDRA_INT(fVar8); - } - } - fireVolume = 0.0; - flyBuzzVolume = 0.0; - flyBuzzPitch = 0.0; - laserLoopVolume = 0.0; - visFattyLaserVolume = 0.0; - sfxA3Volume = 0.0; - sfx1d9Volume = 0.0; - sfx1dcVolume = 0.0; - local_6c = 0.0; - portalVolume = 0.0; - minecartVolume = 0.0; - sfx217Volume = 0.0; - sfx22eVolume = 0.0; - dogmaAngelVolume = 0.0; - dogmaAngelPitch = 0.0; - dogmaVolume = 0.0; - ballAndChainVolume = 0.0; - sfx264Volume = 0.0; - DAT_00c94374 = avgPlayerVelX; - DAT_00c94378 = avgPlayerVelY; - bVar1 = Game::IsPaused(g_game); - if ((bVar1 != 0) && (*GHIDRA_CAST(&g_game->_roomTransition) == 0)) goto LAB_00801544; - flyCount = 0; - local_24 = 0.0; - game = g_game; - fVar8 = playersCenter.y; - fVar9 = playersCenter.x; - if ((sfxManager->_entityList)._updateEL._size == 0) { -LAB_00801137: - local_24 = 1.0; - } - else { - do { - iVar3 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((sfxManager->_entityList)._updateEL)) + 0x4)))) + GHIDRA_INT(local_24) * 4)); - if (((*GHIDRA_CAST(&game->_deathmatchManager) < 2) || (iVar5 = 1, *GHIDRA_CAST((iVar3 + 0x28)) != 1)) && - (iVar5 = *GHIDRA_CAST((iVar3 + 0x28)), 0x3dd < iVar5 - 10U)) { - if (iVar5 != 7) { - if (iVar5 == 1000) { - if (*GHIDRA_CAST((iVar3 + 0x2c)) == 0xa8) { - fVar10 = 1.0; - if (1.0 <= sfxA3Volume) { - fVar10 = sfxA3Volume; - } - sfxA3Volume = fVar10; - } - else if (*GHIDRA_CAST((iVar3 + 0x2c)) == 0xb2) { - fVar10 = *GHIDRA_CAST((iVar3 + 0x478)) * 1.6; - if (fVar10 <= sfx217Volume) { - fVar10 = sfx217Volume; - } - sfx217Volume = fVar10; - } - else { - if (*GHIDRA_CAST((iVar3 + 0x2c)) == 0xb4) { - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 450.0; - portalVolume = fVar8 * fVar8 * 0.2 * *GHIDRA_CAST((iVar3 + 0xe4)) + portalVolume; - goto LAB_008008f0; - } - if (((*GHIDRA_CAST((iVar3 + 0x2c)) == 0xab) && (*GHIDRA_CAST((iVar3 + 0x30)) == 0)) && - (*GHIDRA_CAST((iVar3 + 0x450)) == 1)) { - if (*GHIDRA_CAST((iVar3 + 0x7c)) == 0) goto switchD_00800885_caseD_f; - if (*GHIDRA_CAST((*GHIDRA_CAST((iVar3 + 0x7c)) + 0x34)) != '\0') { - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 2000.0; - sfx22eVolume = fVar8 * fVar8 + sfx22eVolume; - goto LAB_008008f0; - } - } - if ((*GHIDRA_CAST((iVar3 + 0x2c)) == 0xc1) && (*GHIDRA_CAST((iVar3 + 0x30)) == 0)) { - if (*GHIDRA_CAST((iVar3 + 0x45c)) - 1U < 0x59) { - local_18 = 1.0; - local_14 = (float)(0x5a - *GHIDRA_CAST((iVar3 + 0x45c))) / 30.0; - pfVar2 = &local_14; - if (1.0 <= local_14) { - pfVar2 = &local_18; - } - fVar10 = *pfVar2; - if (fVar10 <= sfx264Volume) { - fVar10 = sfx264Volume; - } - sfx264Volume = fVar10; - } - } - } - } - goto switchD_00800885_caseD_f; - } - if (*GHIDRA_CAST((iVar3 + 0x2c)) != 6) { - if (*GHIDRA_CAST((iVar3 + 0x2c)) != 0xf) goto switchD_00800885_caseD_f; - } - if (*GHIDRA_CAST((iVar3 + 0x458)) != 0) { - laserLoopVolume = 1.2; - } - goto LAB_00801103; - } - if (iVar3 == 0) goto switchD_00800885_caseD_f; - if ((*GHIDRA_CAST(&game->_deathmatchManager) < 2) || (iVar5 != 1)) { - if (0x3dd < iVar5 - 10U) goto switchD_00800885_caseD_f; - } - if (*GHIDRA_CAST((iVar3 + 0x173)) != '\0') goto switchD_00800885_caseD_f; - if (0 < *GHIDRA_CAST((iVar3 + 0xc74))) goto switchD_00800885_caseD_f; - if (*GHIDRA_CAST((iVar3 + 0x39c)) <= 0.0) goto switchD_00800885_caseD_f; - if (0 < *GHIDRA_CAST((iVar3 + 0x31c))) goto switchD_00800885_caseD_f; - if ((*GHIDRA_CAST((iVar3 + 0x168)) & 0x20) != 0 || (*GHIDRA_CAST((iVar3 + 0x16c)) & 0x2000000) != 0) - goto switchD_00800885_caseD_f; - if (iVar5 != 0x3c5) { - fVar10 = ABS(*GHIDRA_CAST((iVar3 + 0x340)) - fVar8); - fVar7 = ABS(*GHIDRA_CAST((iVar3 + 0x33c)) - fVar9); - if (fVar10 <= fVar7) { - fVar10 = fVar7; - } - if (fVar10 <= 450.0) { - if (iVar5 < 0x11a) { - if (iVar5 == 0x119) { -switchD_00800885_caseD_d: - fVar10 = *GHIDRA_CAST((iVar3 + 0x33c)); - fVar7 = *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - fVar10; - flyCount = flyCount + 1; - fVar8 = fVar8 - fVar7; - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 450.0; - fVar8 = fVar8 * fVar8; - if (iVar5 == 0x128) { - fVar8 = fVar8 * 0.05; - } - else { - fVar8 = fVar8 * 0.35; - } - flyBuzzVolume = fVar8 + flyBuzzVolume; - fVar10 = fVar10 - playersCenter.x; - if (1.5 <= flyBuzzVolume) { - flyBuzzVolume = 1.5; - } - fVar7 = fVar7 - playersCenter.y; - fVar8 = sqrtf(fVar10 * fVar10 + fVar7 * fVar7); - if (0.0 < fVar8) { - fVar7 = fVar7 * (1.0 / fVar8); - fVar10 = fVar10 * (1.0 / fVar8); - } - flyBuzzPitch = flyBuzzPitch + - (fVar7 * avgPlayerVelY + fVar10 * avgPlayerVelX + 100.0) / - (*GHIDRA_CAST((iVar3 + 0x364)) * fVar7 + *GHIDRA_CAST((iVar3 + 0x360)) * fVar10 - + 100.0); - game = g_game; - fVar8 = playersCenter.y; - fVar9 = playersCenter.x; - goto LAB_00801103; - } - switch(iVar5) { - case 0xd: - case 0xe: - case 0x12: - case 0x19: - case 0x3d: - case 0x50: - case 0xd6: - case 0xde: - case 0xf9: - case 0x100: - goto switchD_00800885_caseD_d; - case 0x21: - if (*GHIDRA_CAST((iVar3 + 0x188)) != 0) { - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 450.0; - fireVolume = fVar8 * fVar8 * 0.6 + fireVolume; - goto LAB_008008f0; - } - } - } - else { - if (0x364 < iVar5) goto code_r0x008009bf; - if (iVar5 == 0x364) goto switchD_00800885_caseD_d; - if (iVar5 < 0x329) { - if ((iVar5 == 0x328) || (iVar5 == 0x128)) goto switchD_00800885_caseD_d; - if (iVar5 == 0x132) { - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 450.0; - portalVolume = fVar8 * fVar8 * 0.6 + portalVolume; - goto LAB_008008f0; - } - } - else if ((iVar5 == 0x333) || (iVar5 == 0x346)) goto switchD_00800885_caseD_d; - } - } - goto switchD_00800885_caseD_f; - } -code_r0x008009bf: - switch(iVar5) { - case 0x376: - if ((*GHIDRA_CAST((iVar3 + 0x2c)) == 0) && (iVar3 = *GHIDRA_CAST((iVar3 + 0xbec)), iVar3 != 0)) { - if (*GHIDRA_CAST((iVar3 + 0x28)) == 7) { - fVar10 = *GHIDRA_CAST((iVar3 + 0xe4)) * 0.5; - if (fVar10 <= visFattyLaserVolume) { - fVar10 = visFattyLaserVolume; - } - visFattyLaserVolume = fVar10; - } - goto LAB_00801103; - } - break; - case 0x37d: - if ((*GHIDRA_CAST((iVar3 + 0x334)) != g_vectorZero.x) || - (*GHIDRA_CAST((iVar3 + 0x338)) != g_vectorZero.y)) { - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 1200.0; - ballAndChainVolume = fVar8 * fVar8 * 0.4 + ballAndChainVolume; - goto LAB_008008f0; - } - break; - case 0x3b6: - if (*GHIDRA_CAST((iVar3 + 0x2c)) == 0) { - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - layer = ANM2::GetLayer(GHIDRA_CAST((iVar3 + 0x48)),GHIDRA_CAST(0x0)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar9 = 1.0 - fVar8 / 1500.0; - fVar8 = 0.0; - if (0.0 <= fVar9) { - fVar8 = fVar9; - } - fVar9 = (layer->_color)._colorize[2]; - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - dogmaVolume = fVar9 * fVar8 * fVar8 + dogmaVolume; - if (dogmaVolume <= 0.02) { - dogmaVolume = 0.02; - } - } - else { - if ((*GHIDRA_CAST((iVar3 + 0x2c)) != 2) || (*GHIDRA_CAST((iVar3 + 0xb64)) != 10)) break; - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - local_14 = *GHIDRA_CAST((iVar3 + 0x360)); - fVar9 = 1.0 - fVar8 / 450.0; - fVar8 = 0.0; - if (0.0 <= fVar9) { - fVar8 = fVar9; - } - local_18 = *GHIDRA_CAST((iVar3 + 0x364)); - fVar9 = sqrtf(local_14 * local_14 + local_18 * local_18); - fVar9 = fVar9 * 0.125; - if (1.0 <= fVar9) { - fVar9 = 1.0; - } - fVar10 = *GHIDRA_CAST((iVar3 + 0x33c)) - playersCenter.x; - dogmaAngelVolume = fVar9 * fVar8 * fVar8 + dogmaAngelVolume; - fVar8 = *GHIDRA_CAST((iVar3 + 0x340)) - playersCenter.y; - fVar9 = sqrtf(fVar10 * fVar10 + fVar8 * fVar8); - if (0.0 < fVar9) { - fVar8 = fVar8 * (1.0 / fVar9); - fVar10 = fVar10 * (1.0 / fVar9); - } - dogmaAngelPitch = - (fVar8 * avgPlayerVelY + fVar10 * avgPlayerVelX + 100.0) / - (local_18 * fVar8 + local_14 * fVar10 + 100.0) + dogmaAngelPitch; - } - goto LAB_008008f0; - case 0x3b7: - if ((*GHIDRA_CAST((iVar3 + 0x2c)) == 0xb) || (*GHIDRA_CAST((iVar3 + 0x2c)) == 0x15)) - goto switchD_00800885_caseD_d; - break; - case 0x3c5: - fVar8 = fVar8 - *GHIDRA_CAST((iVar3 + 0x340)); - fVar9 = fVar9 - *GHIDRA_CAST((iVar3 + 0x33c)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar9 = 1.0 - fVar8 / 1200.0; - fVar8 = sqrtf(*GHIDRA_CAST((iVar3 + 0x364)) * *GHIDRA_CAST((iVar3 + 0x364)) + - *GHIDRA_CAST((iVar3 + 0x360)) * *GHIDRA_CAST((iVar3 + 0x360))); - fVar8 = fVar8 / 30.0; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - if (1.0 <= fVar8) { - fVar8 = 1.0; - } - minecartVolume = fVar8 * fVar9 * fVar9 + minecartVolume; -LAB_008008f0: - game = g_game; - fVar8 = playersCenter.y; - fVar9 = playersCenter.x; - } -switchD_00800885_caseD_f: -LAB_00801103: - local_24 = (float)(GHIDRA_INT(local_24) + 1); - } while (GHIDRA_UINT(local_24) < GHIDRA_UINT((sfxManager->_entityList)._updateEL._size)); - if (flyCount == 0) goto LAB_00801137; - local_24 = flyBuzzPitch / (float)flyCount; - } - fVar8 = sin((float)game->_frameCount / 53.0); - game = g_game; - fVar9 = sin((float)g_game->_frameCount / 61.0); - fVar10 = sin((float)game->_frameCount / 23.0); - flyBuzzPitch = (fVar8 + fVar9 + fVar10) * 0.02 + local_24; - if (0 < sfxManager->_numRainSpawners) { - pfVar2 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x73f4)))); - local_24 = (float)sfxManager->_numRainSpawners; - do { - fVar8 = sqrtf((pfVar2[1] - playersCenter.y) * (pfVar2[1] - playersCenter.y) + - (*pfVar2 - playersCenter.x) * (*pfVar2 - playersCenter.x)); - pfVar2 = pfVar2 + 6; - local_24 = (float)(GHIDRA_INT(local_24) + -1); - fVar8 = 1.0 - fVar8 / 900.0; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - sfx1d9Volume = sfxManager->_rainIntensity * fVar8 * fVar8 * 0.6 + sfx1d9Volume; - } while (local_24 != 0.0); - if (1.0 <= sfx1d9Volume) { - sfx1d9Volume = 1.0; - } - } - game = g_game; - if (((sfxManager->_waterCurrent).x != g_vectorZero.x) || ((sfxManager->_waterCurrent).y != g_vectorZero.y)) { - sfx1dcVolume = 1.0; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x4)))); - piVar4 = *GHIDRA_CAST((iVar3 + 0x10)); - if (((piVar4 == GHIDRA_CAST(0x0)) || (piVar4[2] != 0x10)) || (*piVar4 != 0x23)) { - if (sfxManager->_backdropType != 0x20) goto LAB_0080141b; - if (((*GHIDRA_CAST((iVar3 + 0x44)) >> 5 & 1) != 0) && (0 < *GHIDRA_CAST((iVar3 + 0x54)))) { - local_24 = (float)(sfxManager->_gridHeight * sfxManager->_gridWidth); - if (0 < GHIDRA_INT(local_24)) { - ppvVar6 = sfxManager->_gridEntities; - do { - playerListEnd = *ppvVar6; - if ((playerListEnd != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(playerListEnd) + 4)) == 7)) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - fVar8 = ((float)(*GHIDRA_CAST((GHIDRA_CAST(playerListEnd) + 0x24)) / iVar3) * 40.0 + 120.0) - - playersCenter.y; - fVar9 = ((float)(*GHIDRA_CAST((GHIDRA_CAST(playerListEnd) + 0x24)) % iVar3) * 40.0 + 40.0) - - playersCenter.x; - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 900.0; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - local_6c = fVar8 * fVar8 * 0.1 + local_6c; - } - ppvVar6 = ppvVar6 + 1; - local_24 = (float)(GHIDRA_INT(local_24) + -1); - } while (local_24 != 0.0); - } - local_6c = local_6c * sfxManager->_lavaIntensity; - if (1.0 <= local_6c) { - local_6c = 1.0; - } - } - } - else { - fVar8 = 1.0 - (((sfxManager->_bottomRightPos).y - 30.0) - playersCenter.y) / 900.0; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - local_6c = fVar8 * fVar8 + 0.0; - if (1.0 <= local_6c) { - local_6c = 1.0; - } -LAB_0080141b: - if (((sfxManager->_backdropType == 9) && ((*GHIDRA_CAST((iVar3 + 0x44)) >> 5 & 1) != 0)) && - (0 < *GHIDRA_CAST((iVar3 + 0x54)))) { - local_24 = (float)(sfxManager->_gridHeight * sfxManager->_gridWidth); - if (0 < GHIDRA_INT(local_24)) { - ppvVar6 = sfxManager->_gridEntities; - do { - playerListEnd = *ppvVar6; - if ((playerListEnd != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(playerListEnd) + 4)) == 7)) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - fVar8 = ((float)(*GHIDRA_CAST((GHIDRA_CAST(playerListEnd) + 0x24)) / iVar3) * 40.0 + 120.0) - - playersCenter.y; - fVar9 = ((float)(*GHIDRA_CAST((GHIDRA_CAST(playerListEnd) + 0x24)) % iVar3) * 40.0 + 40.0) - - playersCenter.x; - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - fVar8 = 1.0 - fVar8 / 900.0; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - sfxA3Volume = fVar8 * fVar8 * 0.1 + sfxA3Volume; - } - ppvVar6 = ppvVar6 + 1; - local_24 = (float)(GHIDRA_INT(local_24) + -1); - } while (local_24 != 0.0); - } - if (1.0 <= sfxA3Volume) { - sfxA3Volume = 1.0; - } - } - } - if (2.0 <= minecartVolume) { - minecartVolume = 2.0; - } -LAB_00801544: - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7084)))); - if (0.5 < ABS(fVar8 - fireVolume)) { - if (fireVolume <= fVar8) { - fireVolume = fVar8 - 0.5; - } - else { - fireVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7084)))) = fireVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x10d,fireVolume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7088)))); - if (0.5 < ABS(fVar8 - flyBuzzVolume)) { - if (flyBuzzVolume <= fVar8) { - flyBuzzVolume = fVar8 - 0.5; - } - else { - flyBuzzVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7088)))) = flyBuzzVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,4,flyBuzzVolume,flyBuzzPitch); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x708c)))); - if (0.5 < ABS(fVar8 - laserLoopVolume)) { - if (laserLoopVolume <= fVar8) { - laserLoopVolume = fVar8 - 0.5; - } - else { - laserLoopVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x708c)))) = laserLoopVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x117,laserLoopVolume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7094)))); - if (0.5 < ABS(fVar8 - visFattyLaserVolume)) { - if (visFattyLaserVolume <= fVar8) { - visFattyLaserVolume = fVar8 - 0.5; - } - else { - visFattyLaserVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7094)))) = visFattyLaserVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x119,visFattyLaserVolume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7090)))); - if (0.03 < ABS(fVar8 - sfxA3Volume)) { - if (sfxA3Volume <= fVar8) { - sfxA3Volume = fVar8 - 0.03; - } - else { - sfxA3Volume = fVar8 + 0.03; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7090)))) = sfxA3Volume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0xa3,sfxA3Volume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7098)))); - if (0.03 < ABS(fVar8 - sfx1d9Volume)) { - if (sfx1d9Volume <= fVar8) { - sfx1d9Volume = fVar8 - 0.03; - } - else { - sfx1d9Volume = fVar8 + 0.03; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x7098)))) = sfx1d9Volume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x1d9,sfx1d9Volume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70a0)))); - if (0.03 < ABS(fVar8 - sfx1dcVolume)) { - if (sfx1dcVolume <= fVar8) { - sfx1dcVolume = fVar8 - 0.03; - } - else { - sfx1dcVolume = fVar8 + 0.03; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70a0)))) = sfx1dcVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x1dc,sfx1dcVolume * 0.8,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x709c)))); - if (0.03 < ABS(fVar8 - local_6c)) { - if (local_6c <= fVar8) { - local_6c = fVar8 - 0.03; - } - else { - local_6c = fVar8 + 0.03; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x709c)))) = local_6c; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x1e0,local_6c,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70a4)))); - if (0.5 < ABS(fVar8 - portalVolume)) { - if (portalVolume <= fVar8) { - portalVolume = fVar8 - 0.5; - } - else { - portalVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70a4)))) = portalVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0xa1,portalVolume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70a8)))); - if (0.5 < ABS(fVar8 - minecartVolume)) { - if (minecartVolume <= fVar8) { - minecartVolume = fVar8 - 0.5; - } - else { - minecartVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70a8)))) = minecartVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x1f9,minecartVolume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70bc)))); - if (0.5 < ABS(fVar8 - ballAndChainVolume)) { - if (ballAndChainVolume <= fVar8) { - ballAndChainVolume = fVar8 - 0.5; - } - else { - ballAndChainVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70bc)))) = ballAndChainVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x244,ballAndChainVolume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70ac)))); - if (0.5 < ABS(fVar8 - sfx217Volume)) { - if (sfx217Volume <= fVar8) { - sfx217Volume = fVar8 - 0.5; - } - else { - sfx217Volume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70ac)))) = sfx217Volume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x217,sfx217Volume,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70b0)))); - if (0.5 < ABS(fVar8 - sfx22eVolume)) { - if (sfx22eVolume <= fVar8) { - sfx22eVolume = fVar8 - 0.5; - } - else { - sfx22eVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70b0)))) = sfx22eVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x22e,sfx22eVolume * 1.3,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70b8)))); - if (0.5 < ABS(fVar8 - dogmaVolume)) { - if (dogmaVolume <= fVar8) { - dogmaVolume = fVar8 - 0.5; - } - else { - dogmaVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70b8)))) = dogmaVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x229,dogmaVolume * 1.5,1.0); - manager = g_manager; - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70b4)))); - if (0.5 < ABS(fVar8 - dogmaAngelVolume)) { - if (dogmaAngelVolume <= fVar8) { - dogmaAngelVolume = fVar8 - 0.5; - } - else { - dogmaAngelVolume = fVar8 + 0.5; - } - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70b4)))) = dogmaAngelVolume; - SFXManager::SetAmbientSound(&manager->_sfxManager,0x22b,dogmaAngelVolume * 1.5,dogmaAngelPitch); - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70c0)))); - if (0.5 < ABS(fVar8 - sfx264Volume)) { - if (sfx264Volume <= fVar8) { - sfx264Volume = fVar8 - 0.5; - } - else { - sfx264Volume = fVar8 + 0.5; - } - } - sfxManager = &g_manager->_sfxManager; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x70c0)))) = sfx264Volume; - SFXManager::SetAmbientSound(sfxManager,0x264,sfx264Volume,1.0); - if (-1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x72fc))))) { - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x72fc)))) + 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x72fc)))) = iVar3; - if (iVar3 == 10) { - (GHIDRA_CAST((&g_manager->_sfxManager)))->SoundEffects::Play(0x1cc,1.0,2,0,1.0,0.0); - return; - } - if (10 < iVar3) { - bVar1 = SFXManager::IsPlaying(&g_manager->_sfxManager,0x1cc); - if (bVar1 == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x72fc)))) = 0xffffffff; - } - else { - iVar3 = g_game->_currentRoomIdx; - local_14 = (float)g_game->_startingRoomIdx; - if (-1 < iVar3) { - fVar8 = (float)(GHIDRA_INT(local_14) / 0xd - iVar3 / 0xd); - fVar9 = (float)(((iVar3 / 0xd - GHIDRA_INT(local_14) / 0xd) * 0xd - iVar3) + GHIDRA_INT(local_14)); - fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); - if (0.0 < fVar8) { - fVar9 = fVar9 * (1.0 / fVar8); - } - fVar8 = (float)(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sfxManager)) + 0x72fc)))) + -10) / 60.0; - if (fVar8 <= 0.0) { - fVar8 = 0.0; - } - if (1.0 <= fVar8) { - fVar8 = 1.0; - } - SFXManager::adjust_pan(&g_manager->_sfxManager,0x1cc,fVar8 * fVar9); - return; - } - } - } - } - return; -} - -// 00801ee0 -void Room::UpdateGreedWave() -{ - Room *game = this; - int iVar1; - Entity_Player *player; - Entity *spawned; - int enemyCount; - Game *game; - int greedWaveTimer; - uint32_t uVar2; - Vector local_10; - uint32_t *descriptorFlags; - uint32_t flagsHigh; - Manager *manager; - float *playerY; - - game = g_game; - if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) { - if (0 < game->_greedWaveTimer) { - greedWaveTimer = game->_greedWaveTimer + -1; - game->_greedWaveTimer = greedWaveTimer; - enemyCount = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x12c4)))) + game->_aliveEnemyCount; - iVar1 = 0; - if (0 < enemyCount) { - iVar1 = enemyCount; - } - if ((iVar1 < 1) && (0x13 < greedWaveTimer)) { - game->_greedLastBeatenWave = game->_greedModeWave; - game->_greedWaveTimer = 0x13; - } - else if (greedWaveTimer == 0) { - SpawnGreedModeWave(game,1); - game = g_game; - } - } - if ((((game->_stage == 7) && (game->_roomType == 5)) && - ((game->_levelStateFlags & 0x1000U) == 0)) && - (uVar2 = 0, - GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((game->_playerManager)._playerList._begin) - >> 2 != 0)) { - while( true ) { - player = Game::GetPlayer(game,uVar2); - playerY = &(player->_pos).y; - if (*playerY <= 320.0 && *playerY != 320.0) break; - uVar2 = uVar2 + 1; - game = g_game; - if (GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)) <= uVar2) { - return; - } - } - if (player != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(&g_manager->_musicManager))))->Music::Play(9,(g_manager->_optionsConfig)._musicVolume); - descriptorFlags = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x4)))) + 0x44)); - *descriptorFlags = *descriptorFlags & 0xffffffbf; - g_game->_levelStateFlags = g_game->_levelStateFlags | 0x1000; - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x4)))) + 0x10)) + 0xc)) == 0) { - uVar2 = Random(); - local_10.x = (player->_pos).x; - local_10.y = (player->_pos).y; - spawned = Game::SpawnEx(g_game,0x14,0,&local_10,&g_vectorZero,GHIDRA_CAST(0x0),0xffffffff, - uVar2,0); - flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); - iVar1 = *GHIDRA_CAST(spawned); - *GHIDRA_CAST(&spawned->_flags) = GHIDRA_UINT(spawned->_flags) & 0xfffffffb; - *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)) = flagsHigh; - (**(code **)(iVar1 + 0xc))(); - } - TriggerOutput(game,0); - manager = g_manager; - local_10.x = 2.66247e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_10)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10.x),1.0,2,0,1.0,0.0); - } - } - } - return; -} - -// 008020d0 -void Room::update_deaths_list() -{ - code *pcVar1; - uint8_t bVar2; - Entity_Player *player; - uint32_t *playerSlot; - uint32_t uVar3; - Entity *rootParent; - Vector *freePos; - Entity *rewardPickup; - Room *in_ECX; - void *playersEnd; - PlayerManager *playerManager; - RNG rng; - Vector freePosOut; - Vector playerPos; - Vector markerPos; - uint32_t pickupVariant; - uint32_t variantRoll; - int *local_1c; - int *local_18; - Entity *local_14; - Room *savedRoom; - uint32_t playerIndex; - int rngShift3; - int candidate; - uint8_t *markedEnemyRef; - Entity *nextParent; - Room *room; - - savedRoom = in_ECX; - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x212,GHIDRA_CAST(&g_game->_playerManager),1); - markedEnemyRef = &(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1bb8))); - if (player == GHIDRA_CAST(0x0)) { - (*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1bbc))) = 1; - } - else if ((*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1bbc))) == '\0') { - if ((*GHIDRA_CAST(markedEnemyRef) == 0) && (uVar3 = 0, (in_ECX->_entityList)._updateEL._size != 0)) { - do { - rewardPickup = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((in_ECX->_entityList)._updateEL)) + 0x4)))) + uVar3 * 4)); - bVar2 = (GHIDRA_CAST((rewardPickup)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); - if ((bVar2 != 0) && - ((((rewardPickup->_flags & 0x20000000) == 0 && - ((rewardPickup->_flags & 0x40000000000) == 0)) && (rewardPickup->_type != 0x322)))) { - bVar2 = (GHIDRA_CAST((rewardPickup)))->Entity::DoesEntityShareStatus(); - if ((bVar2 != 0) && - (nextParent = GHIDRA_CAST(rewardPickup->_parent), - GHIDRA_CAST(rewardPickup->_parent) != GHIDRA_CAST(0x0))) { - do { - rootParent = nextParent; - nextParent = GHIDRA_CAST(rootParent->_parent); - } while (nextParent != GHIDRA_CAST(0x0)); - if (rootParent != rewardPickup) goto LAB_008022c4; - } - markedEnemyRef = &(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1bb8))); - candidate = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((in_ECX->_entityList)._updateEL)) + 0x4)))) + uVar3 * 4)); - if (*GHIDRA_CAST(markedEnemyRef) != candidate) { - if (*GHIDRA_CAST(markedEnemyRef) != 0) { - local_18 = GHIDRA_CAST(markedEnemyRef); - msvc::multiset::erase(&local_18); - } - *GHIDRA_CAST(markedEnemyRef) = candidate; - if (candidate != 0) { - msvc::multiset::insert(markedEnemyRef); - } - } - uVar3 = Random(); - markerPos.x = *GHIDRA_CAST((*GHIDRA_CAST(markedEnemyRef) + 0x33c)); - markerPos.y = *GHIDRA_CAST((*GHIDRA_CAST(markedEnemyRef) + 0x340)); - local_14 = Game::Spawn(g_game,1000,0x6d,&markerPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3); - candidate = *GHIDRA_CAST(markedEnemyRef); - playerSlot = &local_14->_target; - if (local_14->_target != 0) { - local_1c = playerSlot; - msvc::multiset::erase(&local_1c); - } - *playerSlot = candidate; - if (candidate != 0) { - msvc::multiset::insert(playerSlot); - } - local_14->Update(); - break; - } -LAB_008022c4: - uVar3 = uVar3 + 1; - } while (uVar3 < GHIDRA_UINT((in_ECX->_entityList)._updateEL._size)); - } - goto LAB_0080212a; - } - if (*GHIDRA_CAST(markedEnemyRef) != 0) { - local_1c = GHIDRA_CAST(markedEnemyRef); - msvc::multiset::erase(&local_1c); - *GHIDRA_CAST(markedEnemyRef) = 0; - } -LAB_0080212a: - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x4)))) + 0x44)) & 1) != 0) && ((*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1bbc))) == '\0')) { - playerManager = &g_game->_playerManager; - uVar3 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x4)))) + 0x60)); - rng._shift1 = 1; - rng._shift2 = 0x1b; - rngShift3 = 0x1b; - rng._shift3 = 0x1b; - playerIndex = 0; - rng._seed = uVar3; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> - 2 != 0) { - do { - playersEnd = (playerManager->_playerList)._end; - if (GHIDRA_INT(playersEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playersEnd = (playerManager->_playerList)._end; - } - playerSlot = (playerManager->_playerList)._begin; - if (playerIndex < GHIDRA_UINT((GHIDRA_INT(playersEnd) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + playerIndex; - } - player = GHIDRA_CAST(*playerSlot); - if (player->_variant == 0) { - bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x212,0); - room = savedRoom; - if (bVar2 != 0) { - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = uVar3 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar3; - rng._seed = uVar3 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar3; - if ((rng._seed & 3U) == 0) { - (GHIDRA_CAST((player)))->Entity_Player::add_random_stat_up(&rng); - rngShift3 = rng._shift3; - in_ECX = savedRoom; - uVar3 = rng._seed; - } - else { - if (rng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - variantRoll = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed; - variantRoll = variantRoll << ((uint8_t)rng._shift2 & 0x1f) ^ variantRoll; - variantRoll = variantRoll >> ((uint8_t)rngShift3 & 0x1f) ^ variantRoll; - pickupVariant = *GHIDRA_CAST((&DAT_00b6c9c0 + (variantRoll % 5) * 4)); - local_14 = GHIDRA_CAST(0x0); - if (pickupVariant == 0x14) { - local_14 = GHIDRA_CAST(0x2); - } - else if (pickupVariant == 10) { - local_14 = GHIDRA_CAST(0x3); - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedRoom)) + 0x1bc0)))) == g_vectorZero.x) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedRoom)) + 0x1bc4)))) == g_vectorZero.y)) { - playerPos.y = (player->_pos).y; - playerPos.x = (player->_pos).x; - freePos = FindFreePickupSpawnPosition(savedRoom,&freePosOut,&playerPos,40.0,0,0,0); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x1bc0)))) = freePos->x; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x1bc4)))) = freePos->y; - } - if (variantRoll == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = variantRoll >> ((uint8_t)rng._shift1 & 0x1f) ^ variantRoll; - uVar3 = uVar3 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar3; - rng._seed = uVar3; - rewardPickup = Game::Spawn(g_game,5,pickupVariant,GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x1bc0)))), - &g_vectorZero,GHIDRA_CAST(player),GHIDRA_UINT(local_14),uVar3); - rewardPickup->Update(); - in_ECX = room; - } - } - } - playerManager = &g_game->_playerManager; - playerIndex = playerIndex + 1; - } while (playerIndex < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - (*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x1bbc))) = 1; - } - return; -} - -// 008024f0 -void Room::update_pressure_plates() -{ - uint32_t *puVar1; - int iVar2; - Entity_NPC *fireplace; - int remaining; - int plateCount; - void **gridSlot; - int iVar3; - uint32_t i; - void *gridEntity; - bool isRewardPlatePressed; - - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 1 & 1) == 0) { - isRewardPlatePressed = false; - remaining = this->_gridHeight * this->_gridWidth; - plateCount = 0; - iVar3 = 0; - if (0 < remaining) { - gridSlot = this->_gridEntities; - plateCount = 0; - do { - gridEntity = *gridSlot; - if ((gridEntity != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)) == 0x14)) { - if (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 8)) == 0) { - plateCount = plateCount + 1; - iVar2 = iVar3 + 1; - if (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xc)) != 0) { - iVar2 = iVar3; - } - iVar3 = iVar2; - } - else if ((*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 8)) == 9) && (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xc)) != 0)) { - isRewardPlatePressed = true; - } - } - gridSlot = gridSlot + 1; - remaining = remaining + -1; - } while (remaining != 0); - } - this->_hasTriggerPressurePlates = plateCount != 0; - if (((plateCount != 0) || (isRewardPlatePressed)) && (iVar3 == 0)) { - puVar1 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)); - *puVar1 = *puVar1 | 2; - i = 0; - if ((this->_entityList)._updateEL._size != 0) { - do { - iVar3 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))) + i * 4)); - if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((iVar3 + 0x28)) == 1)) || - (*GHIDRA_CAST((iVar3 + 0x28)) - 10U < 0x3de)) && - (fireplace = (Entity_NPC *) - __RTDynamicCast(iVar3,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor - ,&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0) - , fireplace->_type == 0x21)) { - iVar3 = fireplace->_variant; - if (iVar3 == 1) { - (GHIDRA_CAST((fireplace)))->Entity_NPC::Morph(0x21,0,fireplace->_subtype,-1); - fireplace->_state = 0; - fireplace->Update(); - iVar3 = fireplace->_variant; - } - if (iVar3 == 3) { - (GHIDRA_CAST((fireplace)))->Entity_NPC::Morph(fireplace->_type,2,fireplace->_subtype,-1); - fireplace->_state = 0; - fireplace->Update(); - } - } - i = i + 1; - } while (i < GHIDRA_UINT((this->_entityList)._updateEL._size)); - } - } - } - return; -} - -// 00802670 -void Room::update_door_targets() -{ - Room *door = this; - int idx; - int TargetRoomType; - RoomDescriptor *pRVar1; - uint32_t slot; - int slotOffset; - GridEntity_Door *door; - - slot = 0; - slotOffset = 0x1c; - do { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x18 + (slot >> 5) * 4)) & 1 << ((uint8_t)slot & 0x1f)) != - 0) { - MakeDoor(door,slot); - door = *GHIDRA_CAST((GHIDRA_CAST(door->_gridEntities) + slotOffset + 0x6e4)); - idx = *GHIDRA_CAST((slotOffset + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))))); - if (-1 < idx) { - pRVar1 = Level::GetRoomByIdx(GHIDRA_CAST(g_game),idx,-1); - if ((pRVar1->Data != (void *)0x0) && (door != GHIDRA_CAST(0x0))) { - pRVar1 = Level::GetRoomByIdx(GHIDRA_CAST(g_game),idx,-1); - TargetRoomType = *GHIDRA_CAST((GHIDRA_CAST(pRVar1->Data) + 8)); - door->_targetRoomIdx = idx; - GridEntity_Door::SetRoomTypes - (door,*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x10)) + 8)),TargetRoomType); - door->_slot = slot; - } - } - } - slotOffset = slotOffset + 4; - slot = slot + 1; - } while (slotOffset < 0x3c); - Game::UpdateVisibility(g_game); - return; -} - -// 00802980 -void Room::Update() -{ - uint32_t *puVar1; - std_vector *psVar2; - uint8_t *puVar3; - int iVar4; - int iVar5; - int iVar6; - int iVar7; - int iVar8; - int iVar9; - int iVar10; - int iVar11; - GridEntity_Door *this_00; - code *pcVar12; - ColorMod color; - RNG rng; - uint64_t qVar13; - float fVar14; - Level *this_01; - uint8_t bVar15; - Entity_Player *player; - int iVar17; - float fVar18; - uint32_t uVar19; - Entity_Pickup *pEVar20; - uint32_t uVar21; - char cVar16; - Game *pGVar22; - Vector *pVVar23; - void *pvVar24; - uint8_t *pbVar25; - Vector *pVVar26; - std_vector *psVar27; - int *piVar28; - GridEntity_Pit *this_02; - Entity_NPC *this_03; - int iVar29; - short sVar30; - void *pvVar31; - uint8_t *pbVar32; - uint32_t clearDelay; - int iVar33; - uint64_t *allocatedBytes; - uint32_t *puVar34; - float *pfVar35; - void **ppvVar36; - PlayerManager *playerManager; - Entity *pEVar37; - int *gridOccupiedIter; - float *segmentedListEnd; - Entity *listedEntity; - bool bVar38; - Game *pGVar39; - float fVar40; - Color aCStackY_2148 [128]; - uint32_t in_stack_fffff4f4; - uint32_t in_stack_fffff4f8; - Entity *in_stack_fffff4fc; - Vector *in_stack_fffff500; - uint8_t isAllowPits; - uint8_t isAvoidDoors; - EntityRef slowSource; - uint8_t local_a90 [12]; - int local_a84; - uint64_t myosotisRngShifts; - uint32_t myosotisRngShift3; - uint8_t local_a70 [16]; - Vector local_a60; - uint8_t local_a58 [24]; - Vector local_a40; - Vector local_a38; - Vector local_a30; - Vector local_a28; - Vector local_a20; - Vector local_a18; - void *local_a10; - float *local_a0c; - float *local_a08; - Vector local_a04; - uint8_t local_9f8 [12]; - void *local_9ec; - Vector local_9e8; - Vector local_9e0; - char isAnyGenesisOutcome; - Vector local_9d4; - Level *local_9cc; - Vector local_9c8; - RNG *local_9c0; - Game *local_9bc; - std_vector local_9b8; - ItemPool *local_9ac; - Entity *local_9a8; - Game *local_9a4; - Game *local_9a0; - Entity *local_99c; - int gridOccupied [448]; - int pairOffsets [3]; - int aiStack_28c [5]; - float local_278; - uint32_t uStack_274; - uint32_t uStack_270; - int iStack_26c; - int local_268; - int iStack_264; - int iStack_260; - int iStack_25c; - int local_258; - int iStack_254; - uint32_t uStack_250; - uint32_t uStack_24c; - uint32_t local_248; - char acStack_244 [48]; - void *pvStack_214; - void *pvStack_210; - void *pvStack_20c; - void *local_208; - float fStack_204; - uint32_t uStack_200; - int iStack_1fc; - int cornerTopLeft; - int cornerTopRight; - int cornerBottomLeft; - int cornerBottomRight; - int local_1e8 [113]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - float local_14; - RNG *genesisRng; - Manager *manager; - - pGVar22 = g_game; - puStack_20 = GHIDRA_CAST((local_1e8 + 0x79)); - local_14 = -NAN; - puStack_18 = &LAB_00b014a8; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((local_1e8 + 0x76)); - ExceptionList = &local_1c; - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7220))) = 0; - manager = g_manager; - local_9cc = GHIDRA_CAST(this); - piVar28 = local_1e8 + 0x79; - if (*GHIDRA_CAST(this) != '\0') { - piVar28 = local_1e8 + 0x79; - if (pGVar22->_frameCount - this->_enterFrame == 1) { - piVar28 = local_1e8 + 0x79; - if (this->_roomType == 5) { - piVar28 = local_1e8 + 0x79; - if (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x40)) == 1) { - if ((((pGVar22->_difficulty == 2) || (pGVar22->_difficulty == 3)) && - (pGVar22->_stage == 7)) && - (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10)) == 0)) { - piVar28 = local_1e8 + 0x79; - if ((pGVar22->_levelStateFlags & 0x1000U) == 0) goto LAB_00802a8d; - } - piVar28 = local_1e8 + 0x79; - if (this->_bossId != 0) { - local_9b8._capacity = GHIDRA_CAST(0xbe); - seed_fart_sound_override(GHIDRA_CAST(&local_9b8._capacity)); - in_stack_fffff500 = GHIDRA_CAST(0x3f800000); - in_stack_fffff4f8 = 0x802a87; - in_stack_fffff4fc = local_9b8._capacity; - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_9b8._capacity),1.0,2,0,1.0,0.0); - pGVar22 = g_game; - piVar28 = GHIDRA_CAST(puStack_20); - } - } - } -LAB_00802a8d: - puStack_20 = GHIDRA_CAST(piVar28); - piVar28 = GHIDRA_CAST(puStack_20); - if ((pGVar22->_levelStateFlags & 0x80000U) == 0) { - pGVar22->_levelStateFlags = pGVar22->_levelStateFlags | 0x80000; - iVar17 = this->_gridWidth; - iVar33 = this->_gridHeight; - if ((iVar17 < 2) || (iVar33 < 2)) { - cornerTopLeft = -1; - } - else { - cornerTopLeft = iVar17 + 1; - } - local_9a4 = GHIDRA_CAST((iVar17 + -2)); - if (((GHIDRA_INT(local_9a4) < 0) || (iVar17 <= GHIDRA_INT(local_9a4))) || (iVar33 < 2)) { - cornerTopRight = -1; - if (1 < this->_gridWidth) goto LAB_00802b01; -LAB_00802b10: - cornerBottomLeft = -1; - } - else { - cornerTopRight = iVar17 + GHIDRA_INT(local_9a4); -LAB_00802b01: - iVar17 = iVar33 + -2; - if ((iVar17 < 0) || (iVar33 <= iVar17)) goto LAB_00802b10; - cornerBottomLeft = iVar17 * this->_gridWidth + 1; - } - iVar17 = iVar33 + -2; - if ((((GHIDRA_INT(local_9a4) < 0) || (iVar29 = this->_gridWidth, iVar29 <= GHIDRA_INT(local_9a4))) || - (iVar17 < 0)) || (iVar33 <= iVar17)) { - cornerBottomRight = -1; - } - else { - cornerBottomRight = iVar17 * iVar29 + iVar29 + -2; - } - if ((pGVar22->_myosotisPickups)._begin != (pGVar22->_myosotisPickups)._end) { - FUN_00752830(); - local_14 = 0.0; - player = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0x89); - pfVar35 = GHIDRA_CAST(&DAT_00000004); - if (player != GHIDRA_CAST(0x0)) { - iVar17 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x89); - if (iVar17 == 2) { - pfVar35 = GHIDRA_CAST(&DAT_00000006); - } - else if (iVar17 == 3) { - pfVar35 = GHIDRA_CAST(&DAT_00000008); - } - } - myosotisRngShifts = 0x900000001; - local_9b8._end = (void *)((GHIDRA_INT(local_a0c) - GHIDRA_INT(local_a10)) / 0x78); - if (pfVar35 < local_9b8._end) { - local_9b8._end = pfVar35; - } - local_9a4 = GHIDRA_CAST(0x0); - local_9bc = GHIDRA_CAST(&DAT_0000001d); - myosotisRngShift3 = 0x1d; - if (0 < GHIDRA_INT(local_9b8._end)) { - local_99c = GHIDRA_CAST(0x0); - local_9a8 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); - do { - fVar18 = (float)(GHIDRA_INT(local_9b8._end) - GHIDRA_INT(local_9a4)); - if (local_9a8 == GHIDRA_CAST(0x0)) { - local_9a8 = GHIDRA_CAST(fVar18); - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - uVar19 = GHIDRA_UINT(local_9a8) >> ((uint8_t)myosotisRngShifts & 0x1f) ^ GHIDRA_UINT(local_9a8); - uVar19 = uVar19 << (SUB81(myosotisRngShifts,4) & 0x1f) ^ uVar19; - local_9c0 = GHIDRA_CAST((uVar19 >> ((uint8_t)local_9bc & 0x1f) ^ uVar19)); - uVar19 = 0; - if (fVar18 != 0.0) { - uVar19 = GHIDRA_UINT(local_9c0) % GHIDRA_UINT(fVar18); - } - local_9a8 = GHIDRA_CAST(fVar18); - if (GHIDRA_CAST((uVar19 + GHIDRA_INT(local_9a4))) != local_9a4) { - EntitySaveState::copy - (GHIDRA_CAST(&uStack_270), - (void *)(GHIDRA_INT(local_a10) + GHIDRA_INT((&local_99c->_sprite + -1)) + 0xcc)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - FUN_004d3230(); - FUN_004d3230(); - local_14 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8); - invoke_pending_callbacks(&uStack_270); - this = GHIDRA_CAST(local_9cc); - } - local_9b8._begin = (void *)(GHIDRA_INT(local_a10) + GHIDRA_INT(local_99c)); - if (local_9c0 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - uVar19 = GHIDRA_UINT(local_9c0) >> ((uint8_t)myosotisRngShifts & 0x1f) ^ GHIDRA_UINT(local_9c0); - uVar19 = uVar19 << (SUB81(myosotisRngShifts,4) & 0x1f) ^ uVar19; - local_9a8 = GHIDRA_CAST((uVar19 >> ((uint8_t)local_9bc & 0x1f) ^ uVar19)); - uVar19 = (GHIDRA_CAST(local_9b8._begin))->_roomList[0]._doors[1]; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar21)) + 0x0))) = (GHIDRA_CAST(local_9b8._begin))->_bossChallenge; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar21)) + 0x1))) = (GHIDRA_CAST(local_9b8._begin))->_devilRoomDisabled; - (*GHIDRA_CAST((GHIDRA_CAST(&(uVar21)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_9b8._begin)))) + 0xa)))); - local_a38.x = (float)(local_1e8[(GHIDRA_UINT(local_9a8) & 3) - 4] % (GHIDRA_CAST(this))->_curses) - * 40.0 + 40.0; - local_a38.y = (float)(local_1e8[(GHIDRA_UINT(local_9a8) & 3) - 4] / (GHIDRA_CAST(this))->_curses) - * 40.0 + 120.0; - in_stack_fffff500 = - FindFreePickupSpawnPosition(GHIDRA_CAST(local_9cc),&local_a60,&local_a38,24.0,0,0,0); - pvVar31 = local_9b8._begin; - in_stack_fffff4fc = *GHIDRA_CAST((GHIDRA_CAST(local_9b8._begin) + 4)); - in_stack_fffff4f8 = *GHIDRA_CAST(local_9b8._begin); - in_stack_fffff4f4 = 0x802dc9; - pEVar20 = (Entity_Pickup *) - Game::Spawn(g_game,in_stack_fffff4f8,GHIDRA_UINT(in_stack_fffff4fc), - in_stack_fffff500,&g_vectorZero,GHIDRA_CAST(0x0),uVar21,uVar19); - this = GHIDRA_CAST(local_9cc); - Entity_Pickup::RestoreState(GHIDRA_CAST(local_9cc),pEVar20,pvVar31); - local_99c = GHIDRA_CAST(&(local_99c->_sprite)._animState); - local_9a4 = GHIDRA_CAST((GHIDRA_INT(local_9a4) + 1)); - pEVar20->_spawnGridIndex = -1; - } while (GHIDRA_INT(local_9a4) < GHIDRA_INT(local_9b8._end)); - } - local_14 = -NAN; - msvc::vector::_Tidy(); - pGVar22 = g_game; - piVar28 = GHIDRA_CAST(puStack_20); - } - } - } - } - puStack_20 = GHIDRA_CAST(piVar28); - iVar17 = (GHIDRA_CAST(this))->_roomList[0xa6].GridIndex; - if (-1 < iVar17) { - if ((iVar17 == 0) && (pGVar22->_currentRoomIdx == -0xc)) { - player = Game::GetPlayer(pGVar22,0); - pvVar31 = (player->_collectibleRNGs)._end; - if (GHIDRA_INT(pvVar31) - GHIDRA_INT((player->_collectibleRNGs)._begin) >> 4 < 0x26f) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Collectible ID out of bounds!\n")); - pvVar31 = (player->_collectibleRNGs)._end; - } - pvVar24 = (player->_collectibleRNGs)._begin; - uVar21 = (GHIDRA_INT(pvVar31) - GHIDRA_INT(pvVar24) >> 4) - 1; - uVar19 = 0x26e; - if (uVar21 < 0x26e) { - uVar19 = uVar21; - } - local_9c0 = GHIDRA_CAST((uVar19 * 0x10 + GHIDRA_INT(pvVar24))); - local_9bc = g_game; - local_9a8 = GHIDRA_CAST((GHIDRA_CAST((local_9c0)))->RNG)::Next(); - pvVar31 = (void *)0x0; - pGVar22 = GHIDRA_CAST(0x0); - local_9ec = (void *)0x0; - pfVar35 = GHIDRA_CAST(0x0); - local_9a0 = GHIDRA_CAST(0x0); - local_9e8.x = 0.0; - local_9e8.y = 0.0; - local_14 = 2.8026e-45; - isAnyGenesisOutcome = '\0'; - fVar18 = 0.0; - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_9bc)) + 0x1af30)))); - do { - if (0 < *GHIDRA_CAST(local_99c)) { - local_9a4 = GHIDRA_CAST(GHIDRA_INT(*GHIDRA_CAST(local_99c))); - uVar21 = GHIDRA_INT(pfVar35) - GHIDRA_INT(pvVar31) >> 3; - uVar19 = 0; - if (uVar21 != 0) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar31) + uVar19 * 8)) == fVar18) { - piVar28 = GHIDRA_CAST((GHIDRA_INT(pvVar31) + uVar19 * 8 + 4)); - *piVar28 = GHIDRA_INT((*piVar28 + GHIDRA_INT(local_9a4))); - if (*piVar28 < 0) { - *GHIDRA_CAST((GHIDRA_CAST(pvVar31) + uVar19 * 8 + 4)) = 0; - } - goto LAB_00802f53; - } - uVar19 = uVar19 + 1; - } while (uVar19 < uVar21); - } - if (GHIDRA_INT(local_9a4) < 1) { -LAB_00802f53: - } - else { - local_a30.x = fVar18; - local_a30.y = (float)local_9a4; - if (GHIDRA_CAST(pfVar35) != local_9a0) { - *pfVar35 = fVar18; - pfVar35[1] = (float)local_9a4; - pfVar35 = pfVar35 + 2; - local_9e8.x = (float)pfVar35; - goto LAB_00802f53; - } - msvc::vector<8byte>::_Emplace_reallocate(); - local_9a0 = GHIDRA_CAST(local_9e8.y); - pvVar31 = local_9ec; - pfVar35 = GHIDRA_CAST(local_9e8.x); - } - isAnyGenesisOutcome = '\x01'; - pGVar22 = local_9a0; - } - this = GHIDRA_CAST(local_9cc); - fVar18 = (float)(GHIDRA_INT(fVar18) + 1); - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_99c)) + 0x2)))); - } while (GHIDRA_UINT(fVar18) < 0x1f); - if (isAnyGenesisOutcome == '\0') { - local_14 = -NAN; - if (pvVar31 == (void *)0x0) goto LAB_008030f1; - uVar19 = (GHIDRA_INT(pGVar22) - GHIDRA_INT(pvVar31) >> 3) * 8; - pvVar24 = pvVar31; - if (0xfff < uVar19) { - pvVar24 = *(void **)(GHIDRA_CAST(pvVar31) + -4); - uVar19 = uVar19 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvVar31) + (-4 - GHIDRA_INT(pvVar24))))) goto LAB_008030be; - } - operator_delete(pvVar24,uVar19); - local_9ec = (void *)0x0; - local_9e8.x = 0.0; - local_9e8.y = 0.0; - (GHIDRA_CAST(this))->_roomList[0xa6].GridIndex = 0x3c; - } - else { - in_stack_fffff500 = GHIDRA_CAST(0x803072); - rng._shift1 = 5; - rng._seed = GHIDRA_INT(local_9a8); - rng._shift2 = 9; - rng._shift3 = 7; - listedEntity = (Entity *) - (GHIDRA_CAST((GHIDRA_CAST(&local_9ec))))->WeightedOutcomePicker::PickOutcome(rng); - *GHIDRA_CAST((GHIDRA_CAST((&local_9bc->_itemPool + 1)) + GHIDRA_INT(listedEntity) * 2 + 0x4c)) = - *GHIDRA_CAST((GHIDRA_CAST((&local_9bc->_itemPool + 1)) + GHIDRA_INT(listedEntity) * 2 + 0x4c)) + -1; - local_14 = -NAN; - local_9a8 = listedEntity; - if (local_9ec != (void *)0x0) { - uVar19 = GHIDRA_INT(local_9e8.y) - GHIDRA_INT(local_9ec) & 0xfffffff8; - pvVar31 = local_9ec; - if (0xfff < uVar19) { - pvVar31 = *(void **)(GHIDRA_CAST(local_9ec) + -4); - uVar19 = uVar19 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_9ec) + (-4 - GHIDRA_INT(pvVar31))))) { -LAB_008030be: - local_14 = -NAN; - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar31,uVar19); - local_9ec = (void *)0x0; - local_9e8.x = 0.0; - local_9e8.y = 0.0; - } - if (listedEntity == GHIDRA_CAST(0xffffffff)) { -LAB_008030f1: - (GHIDRA_CAST(this))->_roomList[0xa6].GridIndex = 0x3c; - } - else { - iVar17 = (GHIDRA_CAST(this))->_stageType; - local_99c = GHIDRA_CAST(0x0); - if (*GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x10)) + 0x44)) != 0) { - local_9a4 = GHIDRA_CAST(0x0); - do { - genesisRng = local_9c0; - local_9bc = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x10)) + 0x40)) + GHIDRA_INT(local_9a4))); - if (((local_9bc->_bossChallenge == 1) && - (piVar28 = GHIDRA_CAST(local_9bc->_stageType), *piVar28 == 5)) && - (((short)piVar28[1] == 100 && (*GHIDRA_CAST((GHIDRA_CAST(piVar28) + 6)) == 0)))) { - iVar17 = (short)local_9bc->_stage + 1 + - (*GHIDRA_CAST((GHIDRA_INT(&local_9bc->_stage) + 2)) + 1) * (GHIDRA_CAST(this))->_curses; - local_9ac = &g_game->_itemPool; - uVar19 = local_9c0->_seed; - local_a04.x = (float)(iVar17 % (GHIDRA_CAST(this))->_curses) * 40.0 + 40.0; - local_a04.y = (float)(iVar17 / (GHIDRA_CAST(this))->_curses) * 40.0 + 120.0; - if (uVar19 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar19 = genesisRng->_seed; - if (uVar19 == 0) { - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - } - uVar19 = uVar19 >> ((uint8_t)genesisRng->_shift1 & 0x1f) ^ uVar19; - uVar19 = uVar19 << ((uint8_t)genesisRng->_shift2 & 0x1f) ^ uVar19; - uVar19 = uVar19 >> ((uint8_t)genesisRng->_shift3 & 0x1f) ^ uVar19; - genesisRng->_seed = uVar19; - local_9ac = (ItemPool *) - ItemPool::GetCollectible(local_9ac,GHIDRA_INT(local_9a8),uVar19,0,0,0); - uVar19 = genesisRng->_seed; - if (uVar19 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar19 = genesisRng->_seed; - if (uVar19 == 0) { - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - } - pGVar22 = g_game; - uVar19 = uVar19 >> ((uint8_t)genesisRng->_shift1 & 0x1f) ^ uVar19; - uVar19 = uVar19 << ((uint8_t)genesisRng->_shift2 & 0x1f) ^ uVar19; - uVar19 = uVar19 >> ((uint8_t)genesisRng->_shift3 & 0x1f) ^ uVar19; - genesisRng->_seed = uVar19; - in_stack_fffff500 = &local_a04; - in_stack_fffff4fc = GHIDRA_CAST(0x64); - in_stack_fffff4f8 = 5; - in_stack_fffff4f4 = 0x803273; - listedEntity = Game::Spawn(pGVar22,5,100,in_stack_fffff500,&g_vectorZero, - GHIDRA_CAST(0x0),GHIDRA_UINT(local_9ac),uVar19); - if ((listedEntity == GHIDRA_CAST(0x0)) || (listedEntity->_type != 5)) { - listedEntity = GHIDRA_CAST(0x0); - } - sVar30 = *GHIDRA_CAST((GHIDRA_INT(&local_9bc->_stage) + 2)); - iVar33 = local_9bc->_stage; - iVar17 = (GHIDRA_CAST(this))->_curses; - *GHIDRA_CAST(&listedEntity->_flags) = GHIDRA_UINT(listedEntity->_flags) | 0x40000; - listedEntity->_spawnGridIndex = (short)iVar33 + 1 + (sVar30 + 1) * iVar17; - *GHIDRA_CAST((GHIDRA_INT(&listedEntity->_flags) + 4)) = - *GHIDRA_CAST((GHIDRA_INT(&listedEntity->_flags) + 4)); - if (((char)(GHIDRA_CAST(this))->_stage != '\0') && - (4 < g_game->_frameCount - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))))) - { - uVar19 = Random(); - in_stack_fffff500 = &local_a04; - in_stack_fffff4fc = GHIDRA_CAST(&DAT_0000000f); - in_stack_fffff4f8 = 1000; - in_stack_fffff4f4 = 0x8032f5; - Game::Spawn(g_game,1000,0xf,in_stack_fffff500,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar19 - ); - } - } - iVar17 = (GHIDRA_CAST(this))->_stageType; - local_9a4 = GHIDRA_CAST((GHIDRA_INT(local_9a4) + 0x10)); - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_99c)) + 0x1)))); - } while (local_99c < GHIDRA_CAST(GHIDRA_UINT(*GHIDRA_CAST((*GHIDRA_CAST((iVar17 + 0x10)) + 0x44))))); - } - } - } - } - (GHIDRA_CAST(this))->_roomList[0xa6].GridIndex = (GHIDRA_CAST(this))->_roomList[0xa6].GridIndex + -1; - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x28d,GHIDRA_CAST(&g_game->_playerManager),1); - *GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0xa6].SafeGridIndex) = player != GHIDRA_CAST(0x0); - bVar15 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x9f].Group),0x2a5); - manager = g_manager; - if (bVar15 != 0) { - fVar18 = time_scale_update(this); - (manager->_musicManager)._targetPitch = fVar18; - } - if (*GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_roomList[0xa0].Dimension) + 1)) == '\0') { - for (piVar28 = GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0xa0].GridIndex); - piVar28 != GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0xa0].SafeGridIndex); piVar28 = piVar28 + 4) { - if ((*GHIDRA_CAST(*piVar28) == 0) && ((GHIDRA_CAST(*piVar28))[1] == 0x40)) { - Game::start_poop_cloud_screen_effect - (GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x1e].SavedEntities),GHIDRA_CAST(&DAT_00c5d108) - ); - break; - } - } - } - if (*GHIDRA_CAST((GHIDRA_CAST(this))->_stageType) == -0x14) { - in_stack_fffff500 = GHIDRA_CAST(0x3e8); - in_stack_fffff4fc = GHIDRA_CAST(local_a90); - in_stack_fffff4f8 = 0x8033e4; - EntityList::QuerySublist - (GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x19].Dimension), - GHIDRA_CAST(in_stack_fffff4fc),1000,0xa1,-1,0,0); - local_14 = 4.2039e-45; - if (local_a84 == 0) { - isAvoidDoors = 0; - isAllowPits = 0; - bVar15 = 1; - fVar18 = 40.0; - pVVar23 = GetCenterPos(GHIDRA_CAST((local_a70 + 8))); - FindFreePickupSpawnPosition(this,&local_a18,pVVar23,fVar18,bVar15,isAllowPits,isAvoidDoors); - uVar19 = Random(); - in_stack_fffff500 = &local_a18; - in_stack_fffff4fc = GHIDRA_CAST(0xa1); - in_stack_fffff4f8 = 1000; - in_stack_fffff4f4 = 0x803455; - Game::Spawn(g_game,1000,0xa1,in_stack_fffff500,&g_vectorZero,GHIDRA_CAST(0x0), - g_game->_lastRoomIdx + 1000,uVar19); - } - else { - *GHIDRA_CAST((*(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_a90))) + 0x4))) + 0x30)) = g_game->_lastRoomIdx + 1000; - } - if ((*GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_stage) + 1)) != '\0') && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))) == g_game->_frameCount)) { - uVar19 = *GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0x5c)); - local_9a4 = GHIDRA_CAST(&DAT_00000007); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x8))) = &DAT_00000007; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x0))) = (void *)0x5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x4))) = (void *)0x9; - FindFreePickupSpawnPosition(this,&local_9e0,GHIDRA_CAST((GHIDRA_CAST(this))->_roomList),0.0,1,0,0); - if (uVar19 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - uVar19 = uVar19 >> (local_9f8[0] & 0x1f) ^ uVar19; - uVar19 = uVar19 << (local_9f8[4] & 0x1f) ^ uVar19; - uVar19 = uVar19 >> ((uint8_t)local_9a4 & 0x1f) ^ uVar19; - uVar21 = uVar19 % 100; - local_9a0 = GHIDRA_CAST(0x32); - if (uVar21 < 4) { - local_9a0 = GHIDRA_CAST(0x35); - } - else if (uVar21 < 9) { - local_9a0 = GHIDRA_CAST(0x34); - } - else if (uVar21 < 0x13) { - local_9a0 = GHIDRA_CAST(&DAT_00000033); - } - else if (uVar21 < 0x1d) { - local_9a0 = GHIDRA_CAST(0x168); - } - else if (uVar21 < 0x36) { - local_9a0 = GHIDRA_CAST(&DAT_0000003c); - } - uVar21 = Random(); - in_stack_fffff4f4 = 0x8035a6; - Game::Spawn(g_game,5,GHIDRA_UINT(local_9a0),&local_9e0,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar21); - in_stack_fffff500 = &local_a28; - local_a28.x = (float)(GHIDRA_CAST(this))->_roomList[0].ListIndex + 0.0; - local_a28.y = (float)(GHIDRA_CAST(this))->_roomList[0].Dimension + 32.0; - in_stack_fffff4fc = GHIDRA_CAST(local_a70); - in_stack_fffff4f8 = 0x8035f2; - pVVar23 = FindFreePickupSpawnPosition - (this,GHIDRA_CAST(in_stack_fffff4fc),in_stack_fffff500,0.0,1,0,0); - local_9e0.x = pVVar23->x; - local_9e0.y = pVVar23->y; - if (uVar19 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - uVar19 = uVar19 >> (local_9f8[0] & 0x1f) ^ uVar19; - uVar19 = uVar19 << (local_9f8[4] & 0x1f) ^ uVar19; - listedEntity = GHIDRA_CAST((uVar19 >> ((uint8_t)local_9a4 & 0x1f) ^ uVar19)); - uVar19 = GHIDRA_UINT(listedEntity) % 100; - local_9a8 = listedEntity; - if (uVar19 < 0x19) { - uVar19 = Random(); - uVar21 = 0x31; -LAB_0080366d: - in_stack_fffff4fc = GHIDRA_CAST(0x12c); -LAB_0080377c: - in_stack_fffff500 = &local_9e0; - in_stack_fffff4f8 = 5; - in_stack_fffff4f4 = 0x803789; - Game::Spawn(g_game,5,GHIDRA_UINT(in_stack_fffff4fc),in_stack_fffff500,&g_vectorZero,GHIDRA_CAST(0x0), - uVar21,uVar19); - } - else if (uVar19 < 0x32) { - if (((g_manager->_persistentGameData)._achievements[0x168] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) { - uVar19 = Random(); - uVar21 = 0x7a; - in_stack_fffff4fc = GHIDRA_CAST(0x15e); - goto LAB_0080377c; - } - } - else if (uVar19 < 0x3c) { - if (((g_manager->_persistentGameData)._achievements[0x273] != 0) || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))) { - uVar19 = Random(); - uVar21 = 0x5a; - goto LAB_0080366d; - } - } - else if ((uVar19 < 0x3d) && - (((g_manager->_persistentGameData)._achievements[0x16e] != 0 || - (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && (g_game != GHIDRA_CAST(0x0))) && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))) { - uVar19 = Random(); - uVar21 = 0x20b; - in_stack_fffff4fc = GHIDRA_CAST(0x64); - goto LAB_0080377c; - } - if (listedEntity == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - uVar19 = GHIDRA_UINT(listedEntity) >> (local_9f8[0] & 0x1f) ^ GHIDRA_UINT(listedEntity); - uVar19 = uVar19 << (local_9f8[4] & 0x1f) ^ uVar19; - if (((uVar19 >> ((uint8_t)local_9a4 & 0x1f) ^ uVar19) & 3) == 0) { - local_a40.y = (float)(GHIDRA_CAST(this))->_roomList[0].Dimension; - local_a40.x = (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex; - FindFreePickupSpawnPosition(this,GHIDRA_CAST((local_a58 + 0x10)),&local_a40,0.0,1,0,0); - uVar19 = Random(); - in_stack_fffff500 = GHIDRA_CAST((local_a58 + 0x10)); - in_stack_fffff4fc = GHIDRA_CAST(0x5a); - in_stack_fffff4f8 = 5; - in_stack_fffff4f4 = 0x803822; - Game::Spawn(g_game,5,0x5a,in_stack_fffff500,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar19); - } - } - local_14 = -NAN; - if (local_a90[0] == '\0') { - local_14 = 5.60519e-45; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_a90)) + 0x4))),0); - local_14 = -NAN; - } - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c82670) && - (_Init_thread_header(), DAT_00c82670 == -1)) { - _atexit(FUN_00b16550); - _Init_thread_footer(); - } - if (DAT_00c82674 != DAT_00c82678) { - DAT_00c82678 = DAT_00c82674; - } - if (((char)(GHIDRA_CAST(this))->_stage != '\0') && - (g_game->_frameCount == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))))) { - if ((g_game->_challenge == 0x28) && - (local_9a4 = GHIDRA_CAST(0x0), (GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed != 0)) { - do { - pGVar22 = *GHIDRA_CAST((*GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x19].PoopCount) + - GHIDRA_INT(local_9a4) * 4)); - if ((pGVar22 == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || - (pGVar22->_roomList[0].OverrideData != (void *)0x1)) && - (0x3dd < GHIDRA_INT(pGVar22->_roomList[0].OverrideData) - 10U)))) { - local_9bc = GHIDRA_CAST(0x0); - } - else { - local_9bc = pGVar22; - if ((((((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar22->_roomList[1])) + 0x9c)))) & 0x20000000) == 0) && - (cVar16 = (**(code **)(pGVar22->_stage + 0x48))(), cVar16 != '\0')) && - ((-1 < pGVar22->_roomList[4]._doors[7] && - ((pvVar31 = pGVar22->_roomList[0].OverrideData, pvVar31 != (void *)0x2d && - (pvVar31 != (void *)0x54)))))) && (pvVar31 != (void *)0x112)) && - ((pvVar31 != (void *)0x113 && - ((pvVar31 != (void *)0x4e || (pGVar22->_roomList[0].AllowedDoors != 10)))))) { - if (DAT_00c82678 == DAT_00c8267c) { - msvc::vector::_Emplace_reallocate(); - } - else { - *DAT_00c82678 = pGVar22; - DAT_00c82678 = DAT_00c82678 + 1; - } - } - } - local_9a4 = GHIDRA_CAST((GHIDRA_INT(local_9a4) + 1)); - } while (local_9a4 < GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed)); - } - local_9a8 = GHIDRA_CAST(PlayerManager)::GetGFuelCount(); - if ((3 < GHIDRA_INT(local_9a8)) && - (local_9b8._begin = GHIDRA_CAST(0x0), (GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed != 0)) { - do { - pGVar22 = *GHIDRA_CAST((*GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x19].PoopCount) + - GHIDRA_INT(local_9b8._begin) * 4)); - if ((pGVar22 == GHIDRA_CAST(0x0)) || - (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (*GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x28)) != 1)) && - (0x3dd < *GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x28)) - 10U)))) { - local_9a4 = GHIDRA_CAST(0x0); - } - else { - local_9a4 = pGVar22; - if ((((*GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x168)) & 0x20000000) == 0) && - (cVar16 = (**(code **)(pGVar22->_stage + 0x48))(), cVar16 != '\0')) && - ((-1 < *GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x32c)) && - (cVar16 = (**(code **)(pGVar22->_stage + 0x4c))(), cVar16 == '\0')))) { - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_9a8[-1])) + 0x40d)))); - do { - uVar19 = *GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x3dc)); - if (uVar19 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar19 = *GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x3dc)); - if (uVar19 == 0) { - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - } - uVar19 = uVar19 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x3e0)) & 0x1f) ^ uVar19; - uVar19 = uVar19 << ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x3e4)) & 0x1f) ^ uVar19; - uVar19 = uVar19 >> ((uint8_t)*GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 1000)) & 0x1f) ^ uVar19; - *GHIDRA_CAST((GHIDRA_CAST(pGVar22) + 0x3dc)) = uVar19; - if ((uVar19 & 1) == 0) { - if (DAT_00c82678 == DAT_00c8267c) { - msvc::vector::_Emplace_reallocate(); - pGVar22 = local_9a4; - } - else { - *DAT_00c82678 = pGVar22; - DAT_00c82678 = DAT_00c82678 + 1; - } - } - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_99c[-1])) + 0x40f)))); - } while (0 < GHIDRA_INT(local_99c)); - } - } - local_9b8._begin = (void *)(GHIDRA_INT(local_9b8._begin) + 1); - } while (local_9b8._begin < GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed)); - } - } - iVar17 = (GHIDRA_CAST(this))->_roomList[0x9f].DisplayFlags; - if (0 < iVar17) { - (GHIDRA_CAST(this))->_roomList[0x9f].DisplayFlags = iVar17 + -1; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x94)))) != 0) { - pGVar22 = (GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._capacity; - local_9b8._begin = (void *)pGVar22->_stage; - if (local_9b8._begin != pGVar22) { - do { - iVar17 = *GHIDRA_CAST((GHIDRA_CAST(local_9b8._begin) + 0x10)); - if (((-1 < iVar17) && - (iVar17 < *GHIDRA_CAST(&(GHIDRA_CAST(this))->_isHeartPicked) * (GHIDRA_CAST(this))->_curses)) && - (GHIDRA_CAST((GHIDRA_CAST(this))->_roomMap[iVar17 + -0x5eae]) != GHIDRA_CAST(0x0))) { - (*(code *)**GHIDRA_CAST((GHIDRA_CAST(this))->_roomMap[iVar17 + -0x5eae]))(); - (GHIDRA_CAST(this))->_roomMap[iVar17 + -0x5eae] = 0; - } - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_9b8); - pGVar22 = (GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._capacity; - } while (local_9b8._begin != pGVar22); - } - ppvVar36 = &(GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._capacity; - FID_conflict__Erase_tree_>_> - (ppvVar36,(fuzzer_allocator_> *)ppvVar36, - (_Tree_node *)pGVar22->_stageType); - pGVar22->_stageType = GHIDRA_INT(pGVar22); - pGVar22->_stage = GHIDRA_INT(pGVar22); - *GHIDRA_CAST(&pGVar22->_bossChallenge) = pGVar22; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x94)))) = 0; - } - iVar17 = *GHIDRA_CAST(&(GHIDRA_CAST(this))->_isHeartPicked); - iVar33 = (GHIDRA_CAST(this))->_curses; - local_99c = GHIDRA_CAST(0x0); - if (0 < iVar17 * iVar33) { - ppvVar36 = &(GHIDRA_CAST(this))->_roomList[0].Data; - do { - if (*ppvVar36 != GHIDRA_CAST(0x0)) { - (**(code **)(*GHIDRA_CAST(*ppvVar36) + 8))(); - } - iVar33 = (GHIDRA_CAST(this))->_curses; - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_99c)) + 0x1)))); - ppvVar36 = ppvVar36 + 1; - } while (GHIDRA_INT(local_99c) < iVar33 * *GHIDRA_CAST(&(GHIDRA_CAST(this))->_isHeartPicked)); - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar17)) + 0x0))) = (GHIDRA_CAST(this))->_isHeartPicked; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar17)) + 0x1))) = (GHIDRA_CAST(this))->_isCanSeeEverything; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar17)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x12)))); - } - local_9ac = GHIDRA_CAST(0x3); - local_9c0 = (void *)0x3e8; - if ((g_game->_frameCount % 3 == 0) && (local_9b8._end = GHIDRA_CAST(0x0), 0 < iVar33 * iVar17)) { - local_99c = GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x13].DeliriumDistance); - piVar28 = (GHIDRA_CAST(this))->_roomList[10]._doors + 3; - local_9b8._end = GHIDRA_CAST(0x0); - do { - iVar17 = *piVar28; - iVar33 = iVar17 % 1000; - if (iVar17 == 3999) { - *piVar28 = 900; - } - else if (iVar33 < 0x385) { - if (100 < iVar33) { - iVar33 = 100; - } - *piVar28 = iVar17 - iVar33; - } - if ((uint16_t)(*GHIDRA_CAST(local_99c) - 1U) < 99) { - iVar17 = *GHIDRA_CAST(local_99c) + -1; - local_9d4.y = 0.0; - sVar30 = 0; - if (0 < iVar17) { - sVar30 = (short)iVar17; - } - *GHIDRA_CAST(local_99c) = sVar30; - } - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_99c)) + 0x2)))); - local_9b8._end = (void *)(GHIDRA_INT(local_9b8._end) + 1); - piVar28 = piVar28 + 1; - } while (GHIDRA_INT(local_9b8._end) < - *GHIDRA_CAST(&(GHIDRA_CAST(this))->_isHeartPicked) * (GHIDRA_CAST(this))->_curses); - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x226,GHIDRA_CAST(&g_game->_playerManager),1); - if ((((player != GHIDRA_CAST(0x0)) && ((char)(GHIDRA_CAST(this))->_stage != '\0')) && - (g_game->_frameCount - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))) == 4)) && - ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x11 && - ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) >> 3 & 1) == 0)))) { - in_stack_fffff500 = GHIDRA_CAST(&DAT_00000005); - in_stack_fffff4fc = GHIDRA_CAST(local_a58); - in_stack_fffff4f8 = 0x803d67; - EntityList::QuerySublist - (GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x19].Dimension), - GHIDRA_CAST(in_stack_fffff4fc),5,100,-1,0,0); - local_14 = 7.00649e-45; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_a58)) + 0xc))) == 0) { - (GHIDRA_CAST((&g_game->_ambush)))->Ambush::StartChallenge(); - } - local_14 = -NAN; - if (local_a58[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_a58)) + 0x4))) != 0) { - uVar19 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_a58)) + 0x4))) + -4)); - qVar13 = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar19; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar13) < uVar19)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(local_a58)) + 0x4))) + -4)); - } - local_14 = -NAN; - } - } - if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x8)))) == 0xb) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x8)))) == 0x11) - ) && ((g_game->_ambush)._isActive != 0)) { - (GHIDRA_CAST((&g_game->_ambush)))->Ambush::Update(); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0xa0))) != '\0') { - card_against_humanity_fill(this); - } - pvVar24 = (void *)((GHIDRA_CAST(this))->_roomList[0x1a].SafeGridIndex + - (GHIDRA_CAST(this))->_roomList[0x1a].ListIndex); - pvVar31 = (void *)0x0; - if (0 < GHIDRA_INT(pvVar24)) { - pvVar31 = pvVar24; - } - if ((GHIDRA_INT(pvVar31) < 1) && (0 < GHIDRA_INT((GHIDRA_CAST(this))->_roomList[0x9e].RestrictedGridIndexes._head))) - { - if (g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) { - KAGE_LogMessage(1,GHIDRA_CAST("[Frame %d] ")); - } - KAGE_LogMessage(1,GHIDRA_CAST("[warn] last boss died without triggering the deathspawn.\n")); - } - (GHIDRA_CAST(this))->_roomList[0x9e].RestrictedGridIndexes._head = pvVar31; - (GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x19].Dimension))))->EntityList::Update(0); - (GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x1e].SavedEntities))))->Camera::Update(0); - if (*GHIDRA_CAST((GHIDRA_INT((GHIDRA_CAST(this))->_roomList[0x28]._doors) + 0x1d)) != '\0') { - AnimationState::Update(GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x27].AllowedDoors)); - AnimationState::Update(GHIDRA_CAST(((GHIDRA_CAST(this))->_roomList[0x27]._doors + 7))); - } - if ((GHIDRA_CAST(this))->_roomList[0x28].Flags == 0x1a) { - pbVar25 = GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0x27]._doors[0]); - if (pbVar25 != GHIDRA_CAST(0x0)) { - if (0xf < *GHIDRA_CAST((pbVar25 + 0x14))) { - pbVar25 = *GHIDRA_CAST(pbVar25); - } - pbVar32 = s_Idle; - do { - bVar15 = *pbVar25; - bVar38 = bVar15 < *pbVar32; - if (bVar15 != *pbVar32) { -LAB_00803ee0: - uVar19 = -GHIDRA_UINT(bVar38) | 1; - goto LAB_00803ee5; - } - if (bVar15 == 0) break; - bVar15 = pbVar25[1]; - bVar38 = bVar15 < pbVar32[1]; - if (bVar15 != pbVar32[1]) goto LAB_00803ee0; - pbVar25 = pbVar25 + 2; - pbVar32 = pbVar32 + 2; - } while (bVar15 != 0); - uVar19 = 0; -LAB_00803ee5: - if ((uVar19 == 0) && - ((*GHIDRA_CAST(((GHIDRA_CAST(this))->_roomList[0x27]._doors[0] + 0x34)) == '\0' || - ((char)(GHIDRA_CAST(this))->_roomList[0x27]._doors[4] != '\0')))) goto LAB_00803f16; - } - bVar15 = ANM2::SetAnimation(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x26])) + 0xa0)))),s_Idle,1); - if (bVar15 != 0) { - AnimationState::Rewind(GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x27].AllowedDoors)); - *GHIDRA_CAST(((GHIDRA_CAST(this))->_roomList[0x27]._doors + 4)) = 1; - } - } -LAB_00803f16: - (GHIDRA_CAST((&(GHIDRA_CAST(this))->_roomList[0xa6].ListIndex)))->BeastArena::update(); - if (((char)(GHIDRA_CAST(this))->_stage != '\0') && - (g_game->_frameCount - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))) == 1)) { - Level::UpdateBackwardsPathStages(GHIDRA_CAST(this)); - } - if (*GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_roomList[0xa0].Dimension) + 1)) == '\0') { - for (piVar28 = GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0xa0].GridIndex); - piVar28 != GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0xa0].SafeGridIndex); piVar28 = piVar28 + 4) { - iVar17 = *GHIDRA_CAST(*piVar28); - if ((((iVar17 == 1) || (iVar17 == 3)) || (iVar17 == 4)) && ((GHIDRA_CAST(*piVar28))[1] == 0x1e1)) { - uVar19 = Random(); - manager = g_manager; - if (uVar19 % 10 == 0) { - uVar19 = Random(); - if ((uVar19 & 1) == 0) { - uVar19 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * 0.1 + 0.2; - } - else { - uVar19 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * 0.5 + 1.5; - } - (manager->_musicManager)._pitch = fVar18; - (manager->_musicManager)._targetPitch = fVar18; - (GHIDRA_CAST((GHIDRA_CAST(((manager->_musicManager)._channels + - (manager->_musicManager)._currentChannel)))))->Music::SetPitchAll(fVar18); - manager = g_manager; - uVar19 = Random(); - if ((uVar19 & 3) == 0) { - uVar19 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * 0.7 + 0.3; - } - else { - fVar18 = 1.0; - } - fVar18 = fVar18 * (g_manager->_optionsConfig)._musicVolume; - (manager->_musicManager)._channels[(manager->_musicManager)._currentChannel]._targetVolume - = fVar18; - (manager->_musicManager)._channels[(manager->_musicManager)._currentChannel]._volume = - fVar18; - } - else { - iVar17 = (g_manager->_musicManager)._currentChannel; - (g_manager->_musicManager)._pitch = 1.0; - (manager->_musicManager)._targetPitch = 1.0; - (GHIDRA_CAST((GHIDRA_CAST(((manager->_musicManager)._channels + iVar17)))))->Music::SetPitchAll(1.0); - } - break; - } - } - } - (GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x9f].Group))))->TemporaryEffects::Update(); - update_deaths_list(); - pvVar31 = (void *)(GHIDRA_CAST(this))->_stageType; - local_9c8.y = (float)pvVar31; - if (((*GHIDRA_CAST((GHIDRA_CAST(pvVar31) + 0x44)) & 1) == 0) && ((g_game->_ambush)._isActive == 0)) { - iVar33 = (GHIDRA_CAST(this))->_roomList[0x19].Group + (GHIDRA_CAST(this))->_roomList[0x1a].GridIndex; - iVar17 = 0; - if (0 < iVar33) { - iVar17 = iVar33; - } - if (((iVar17 < 1) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x98)))) < 1)) && - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x98)))) < 1)) { - TriggerOutput(this,9); - pvVar31 = (void *)(GHIDRA_CAST(this))->_stageType; - } - } - pGVar22 = g_game; - if ((g_game->_ambush)._isActive == 0) { - iVar33 = (GHIDRA_CAST(this))->_roomList[0x19].Group + (GHIDRA_CAST(this))->_roomList[0x1a].GridIndex; - iVar17 = 0; - if (0 < iVar33) { - iVar17 = iVar33; - } - if ((0 < iVar17) || (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x98)))))) - goto LAB_00804293; - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x98)))); - if (iVar17 < 1) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x8)))) == 0x10) { - iVar17 = *GHIDRA_CAST((*GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0x10)) + 0x10)); - if (iVar17 != 2) { - if (iVar17 != 3) goto LAB_00804212; - in_stack_fffff500 = GHIDRA_CAST(g_game->_dungeonReturnRoomIndex); - g_game->_enterDoor = -1; - in_stack_fffff4fc = GHIDRA_CAST(0x80420d); - Game::StartRoomTransition(pGVar22,GHIDRA_INT(in_stack_fffff500),-1,0,GHIDRA_CAST(0x0),-1); - } - } - else { -LAB_00804212: - iVar17 = g_game->_stage; - if ((iVar17 != 0xd) && - (((iVar17 < 1 || (6 < iVar17)) || ((g_game->_gameStateFlags & 0x1000000000000) == 0)))) { - puVar3 = &(g_manager->_musicManager)._channels[(g_manager->_musicManager)._currentChannel] - (*GHIDRA_CAST((GHIDRA_CAST(&()) + 0x16c))); - *GHIDRA_CAST(puVar3) = *GHIDRA_CAST(puVar3) & 0xfffffffe; - } - puVar34 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[9])) + 0x98)))); - local_99c = GHIDRA_CAST(&DAT_00000008); - do { - if (GHIDRA_CAST(*puVar34) != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((GHIDRA_CAST(*puVar34))))->GridEntity_Door::Open(); - } - puVar34 = puVar34 + 1; - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_99c[-1])) + 0x40f)))); - } while (local_99c != GHIDRA_CAST(0x0)); - if ((*GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0x44)) & 9) == 0) { - TriggerClear(this,0); - } - } - } - else { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x98)))) = iVar17 + -1; - } - } - else { -LAB_00804293: - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x8)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x98)))) = 10; - if (iVar17 == 0x10) { - clearDelay = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x98)))); - if (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar31) + 0x10)) + 0x10)) == 3) { - clearDelay = 0x14; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x98)))) = clearDelay; - } - } - puVar34 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[9])) + 0x98)))); - local_99c = GHIDRA_CAST(&DAT_00000008); - do { - this_00 = GHIDRA_CAST(*puVar34); - if ((this_00 != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0xc)))) == 5)) { - (GHIDRA_CAST((this_00)))->GridEntity_Door::Open(); - } - puVar34 = puVar34 + 1; - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_99c[-1])) + 0x40f)))); - } while (local_99c != GHIDRA_CAST(0x0)); - update_pressure_plates(this); - update_door_transitions(this); - local_9a0 = g_game; - local_9c8.y = (float)g_game->_stageType; - iVar17 = g_game->_stage; - if ((g_game->_difficulty == 2) || (iVar33 = iVar17, g_game->_difficulty == 3)) { - if (iVar17 < 5) { - iVar33 = iVar17 * 2 + -1; - } - else { - iVar33 = 0; - if (iVar17 == 5) { - iVar33 = 10; - } - } - local_9c8.y = 0.0; - } - if (((((iVar33 == 3) || (iVar33 == 4)) && (GHIDRA_CAST(local_9c8.y) == GHIDRA_CAST(0x0))) || - (((iVar33 == 7 || (iVar33 == 8)) && (GHIDRA_CAST(local_9c8.y) == GHIDRA_CAST(0x0))))) || - (((iVar33 == 5 || (iVar33 == 6)) && (GHIDRA_CAST(local_9c8.y) == GHIDRA_CAST(0x2))))) { - uVar19 = Random(); - if (uVar19 % 0x1e != 0) { - local_9a0 = g_game; - goto LAB_0080439a; - } -LAB_00804511: - uVar19 = Random(); - uVar21 = Random(); - local_a20.y = -10.0; - in_stack_fffff500 = &local_a20; - in_stack_fffff4fc = GHIDRA_CAST(0x29); - in_stack_fffff4f8 = 1000; - local_a20.x = ((float)(GHIDRA_CAST(this))->_roomList[0].ListIndex - - (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex) * - (float)((double)GHIDRA_INT(uVar21) + __uint_to_double_fixup[-(GHIDRA_INT(uVar21) >> 0x1f)]) * - 2.3283064e-10 + (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex; - in_stack_fffff4f4 = 0x804585; - listedEntity = Game::Spawn(g_game,1000,0x29,in_stack_fffff500,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar19); - listedEntity->Update(); - } - else { -LAB_0080439a: - if (((iVar33 == 3) || (iVar33 == 4)) && (GHIDRA_CAST(local_9c8.y) == GHIDRA_CAST(0x2))) { - g_game = local_9a0; - uVar19 = Random(); - if (uVar19 % 6 == 0) goto LAB_00804511; - local_9a0 = g_game; - } - if (((iVar33 == 7) || (iVar33 == 8)) && (GHIDRA_CAST(local_9c8.y) == GHIDRA_CAST(0x2))) { - g_game = local_9a0; - uVar19 = Random(); - if ((uVar19 & 7) == 0) goto LAB_00804511; - local_9a0 = g_game; - } - g_game = local_9a0; - if ((iVar33 == 1) || (iVar33 == 2)) { - if (GHIDRA_CAST(local_9c8.y) == &DAT_00000004) { - uVar19 = Random(); - if ((uVar19 & 3) == 0) goto LAB_00804511; - local_9a0 = g_game; - } - g_game = local_9a0; - if ((iVar33 == 1) || (iVar33 == 2)) { - if (GHIDRA_CAST(local_9c8.y) == &DAT_00000005) { - uVar19 = Random(); - if ((uVar19 & 3) == 0) goto LAB_00804511; - local_9a0 = g_game; - } - g_game = local_9a0; - if ((((iVar33 == 1) || (iVar33 == 2)) && (GHIDRA_CAST(local_9c8.y) == GHIDRA_CAST(0x2))) - && (uVar19 = Random(), uVar19 % 0x14 == 0)) { - uVar19 = Random(); - uVar21 = Random(); - local_9c8.y = -10.0; - in_stack_fffff500 = &local_9c8; - in_stack_fffff4fc = GHIDRA_CAST(0x57); - in_stack_fffff4f8 = 1000; - local_9c8.x = ((float)(GHIDRA_CAST(this))->_roomList[0].ListIndex - - (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex) * - (float)((double)GHIDRA_INT(uVar21) + __uint_to_double_fixup[-(GHIDRA_INT(uVar21) >> 0x1f)] - ) * 2.3283064e-10 + (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex; - in_stack_fffff4f4 = 0x8044ff; - listedEntity = Game::Spawn(g_game,1000,0x57,in_stack_fffff500,&g_vectorZero,GHIDRA_CAST(0x0), - 0,uVar19); - listedEntity->Update(); - } - } - } - } - pGVar22 = g_game; - if (g_game->_challenge == 0x2c) { - uVar19 = Level::GetRoomStageType(GHIDRA_CAST(g_game),g_game->_currentRoomIdx); - } - else { - if (g_game->_currentDimensionIdx == 2) goto LAB_008046e2; - uVar19 = g_game->_stageType; - } - pGVar39 = g_game; - uVar19 = RoomConfig::GetStageID(pGVar22->_stage,uVar19,-1); - if (uVar19 == 0x1b) { - uVar19 = pGVar39->_frameCount & 0x80000003; - bVar38 = uVar19 == 0; - if (GHIDRA_INT(uVar19) < 0) { - bVar38 = (uVar19 - 1 | 0xfffffffc) == 0xffffffff; - } - if ((bVar38) && (uVar19 = Random(), uVar19 % 100 == 0)) { - uVar19 = Random(); - g_game->_lightningIntensity = - (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * 0.6 + 1.3; - uVar19 = Random(); - manager = g_manager; - local_99c = GHIDRA_CAST(0x1d8); - local_9a8 = (Entity *) - ((float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * 0.2 + 0.9); - seed_fart_sound_override(GHIDRA_CAST(&local_99c)); - in_stack_fffff500 = GHIDRA_CAST(0x3f800000); - in_stack_fffff4f8 = 0x8046e2; - in_stack_fffff4fc = local_99c; - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_99c),1.0,0x5a,0,(float)local_9a8,0.0); - } - } -LAB_008046e2: - update_ambient_spawns(this); - update_ambient_effects(this); - update_water_current(this); - bVar15 = Level::IsMausoleumHeartStage(GHIDRA_CAST(g_game)); - pGVar22 = g_game; - if (bVar15 != 0) { - if ((*GHIDRA_CAST(g_game->_room) == '\0') || - (g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)) < 2)) { - g_game->_darknessModifier = 1.0; - } - pGVar22->_darknessStrength = 1.0; - pGVar22->_darknessTimeout = 10; - } - piVar28 = *GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0x10)); - if (((piVar28 != GHIDRA_CAST(0x0)) && (piVar28[2] == 0x10)) && (*piVar28 == 0x23)) { - pGVar39 = GHIDRA_CAST(((float)(GHIDRA_CAST(this))->_roomList[0].Dimension - 30.0)); - local_9a0 = pGVar39; - if ((char)(GHIDRA_CAST(this))->_stage != '\0') { - uVar19 = pGVar22->_frameCount - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))) & - 0x80000003; - bVar38 = uVar19 == 0; - if (GHIDRA_INT(uVar19) < 0) { - bVar38 = (uVar19 - 1 | 0xfffffffc) == 0xffffffff; - } - if (bVar38) { - playerManager = &pGVar22->_playerManager; - if (GHIDRA_INT((pGVar22->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { - uVar19 = 0; - pGVar22 = g_game; - do { - pvVar31 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar31) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar31 = (playerManager->_playerList)._end; - pGVar22 = g_game; - pGVar39 = local_9a0; - } - pfVar35 = (playerManager->_playerList)._begin; - if (uVar19 < GHIDRA_UINT((GHIDRA_INT(pvVar31) - GHIDRA_INT(pfVar35) >> 2))) { - pfVar35 = pfVar35 + uVar19; - } - local_9a8 = GHIDRA_CAST(*pfVar35); - if ((float)pGVar39 <= (local_9a8->_pos).y + local_9a8->_size) { - if (local_9a8->_entityCollisionClass != 0) { - bVar15 = 0; - slowSource._position.x = g_vectorZero.x; - slowSource._velocity.x = g_vectorZero.x; - slowSource._type = 0; - slowSource._variant = 0; - slowSource._spawnerType = 0; - slowSource._spawnerVariant = 0; - slowSource._position.y = g_vectorZero.y; - slowSource._velocity.y = g_vectorZero.y; - slowSource._flags = 0; - slowSource._entity = (void *)0x0; - (GHIDRA_CAST((aCStackY_2148 + 0x81)))->Color::Reset(); - listedEntity = local_9a8; - color._tint[2] = 1.3; - color._tint[0] = 1.0; - color._tint[1] = 1.0; - color._tint[3] = 1.0; - color._colorize[0] = (float)in_stack_fffff4f4; - color._colorize[1] = (float)in_stack_fffff4f8; - color._colorize[2] = (float)in_stack_fffff4fc; - color._colorize[3] = (float)in_stack_fffff500; - color._offset[0] = 0.15686275; - color._offset[1] = 0.15686275; - color._offset[2] = 0.15686275; - (GHIDRA_CAST((local_9a8)))->Entity::AddSlowing(&slowSource,4,0.6,color,bVar15); - in_stack_fffff500 = GHIDRA_CAST(0x3f800000); - in_stack_fffff4fc = GHIDRA_CAST(0x804968); - listedEntity->TakeDamage(); - pGVar22 = g_game; - pGVar39 = local_9a0; - } - } - playerManager = &pGVar22->_playerManager; - uVar19 = uVar19 + 1; - } while (uVar19 < GHIDRA_UINT((GHIDRA_INT((pGVar22->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - this = GHIDRA_CAST(local_9cc); - } - } - } - uVar19 = Random(); - if ((uVar19 & 1) == 0) { - uVar19 = Random(); - local_9a8 = (Entity *) - ((float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * -2.8799999); - uVar19 = Random(); - local_a20.x = ((float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 - 0.5) * 0.4; - local_a20.y = (float)local_9a8; - uVar19 = Random(); - fVar18 = (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex + 40.0; - local_9a0 = GHIDRA_CAST((((float)local_9a0 - fVar18) * - (float)((double)GHIDRA_INT(uVar19) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * 2.3283064e-10 + - fVar18)); - uVar19 = Random(); - local_a40.y = (float)local_9a0; - local_a40.x = ((GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0].ListIndex))->x - - (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex) * - (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 + (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex; - uVar19 = Random(); - listedEntity = Game::Spawn(g_game,1000,0x42,&local_a40,&local_a20,GHIDRA_CAST(0x0),10,uVar19); - uVar19 = Random(); - fVar40 = (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * 1.2 + 0.8; - fVar18 = fVar40 * g_vectorOne.x; - (listedEntity->_sprite)._scale.y = fVar40 * g_vectorOne.y; - (listedEntity->_sprite)._scale.x = fVar18; - uVar19 = Random(); - if (uVar19 % GHIDRA_UINT(local_9ac) == 0) { - listedEntity->_renderDepthOffset = 80.0; - } - else { - listedEntity->_sortingLayer = 1; - fVar18 = (listedEntity->_sprite)._scale.x; - fVar40 = (listedEntity->_sprite)._scale.y; - (listedEntity->_sprite)._color._tint[3] = 0.6; - (listedEntity->_sprite)._scale.x = fVar18 * 0.6; - (listedEntity->_sprite)._scale.y = fVar40 * 0.6; - } - listedEntity->Update(); - } - } - iVar17 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9c])) + 0xa4)))); - if (iVar17 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9c])) + 0xa8))))) { - fVar18 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9c])) + 0xa0)))); - fVar40 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9c])) + 0x98)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9c])) + 0xa4)))) = iVar17 + 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9c])) + 0x98)))) = fVar18 + fVar40; - } - iVar17 = (GHIDRA_CAST(this))->_roomList[0x9d].ListIndex; - if (iVar17 < (GHIDRA_CAST(this))->_roomList[0x9d].Dimension) { - (GHIDRA_CAST(this))->_roomList[0x9c].Group = - GHIDRA_INT(((float)(GHIDRA_CAST(this))->_roomList[0x9d].SafeGridIndex + - (float)(GHIDRA_CAST(this))->_roomList[0x9c].Group)); - (GHIDRA_CAST(this))->_roomList[0x9d].ListIndex = iVar17 + 1; - } - pvVar31 = (GHIDRA_CAST(this))->_roomList[0x9e].SavedGridEntities._capacity; - if (0 < GHIDRA_INT(pvVar31)) { - psVar2 = &(GHIDRA_CAST(this))->_roomList[0x9e].SavedEntities; - local_9bc = GHIDRA_CAST(((float)(GHIDRA_CAST(this))->_roomList[0].Dimension - - (float)(GHIDRA_CAST(this))->_roomList[0].SafeGridIndex)); - local_9a4 = GHIDRA_CAST(((float)(GHIDRA_CAST(this))->_roomList[0].ListIndex - - (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex)); - (GHIDRA_CAST(this))->_roomList[0x9e].SavedGridEntities._capacity = (void *)(GHIDRA_INT(pvVar31) + -1); - local_9b8._begin = GHIDRA_CAST(0x20); - psVar27 = &local_9b8; - if (GHIDRA_INT(psVar2->_begin) < 0x20) { - psVar27 = psVar2; - } - local_9b8._capacity = GHIDRA_CAST(0x0); - if (0 < GHIDRA_INT(psVar27->_begin)) { - local_9ac = GHIDRA_CAST(((float)local_9a4 + (float)local_9a4)); - local_9a8 = GHIDRA_CAST(((float)local_9bc + (float)local_9bc + (float)local_9ac)); - do { - uVar19 = Random(); - local_99c = (Entity *) - ((float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * (float)local_9a8); - if ((float)local_9a4 <= (float)local_99c) { - if ((float)local_9a4 + (float)local_9bc <= (float)local_99c) { - if ((float)local_9bc + (float)local_9ac <= (float)local_99c) { - uVar19 = Random(); - uVar21 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar21) + __uint_to_double_fixup[-(GHIDRA_INT(uVar21) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - local_9b8._end = (void *)(fVar18 + fVar18); - local_9a0 = GHIDRA_CAST(sin((float)local_9b8._end)); - local_9c8.x = cos((float)local_9b8._end); - pVVar23 = &local_9c8; - local_9c8.y = (float)local_9a0 * 5.0; - local_9c8.x = local_9c8.x * 5.0; - local_a18.x = (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex; - pVVar26 = &local_a18; - local_a18.y = (((float)local_99c + (float)(GHIDRA_CAST(this))->_roomList[0].SafeGridIndex) - - (float)local_9ac) - (float)local_9bc; - } - else { - uVar19 = Random(); - uVar21 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar21) + __uint_to_double_fixup[-(GHIDRA_INT(uVar21) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - local_9b8._end = (void *)(fVar18 + fVar18); - local_9a0 = GHIDRA_CAST(sin((float)local_9b8._end)); - fVar18 = cos((float)local_9b8._end); - pVVar23 = &local_9e0; - local_9e0.y = (float)local_9a0 * 5.0; - local_9e0.x = fVar18 * 5.0; - local_9d4.y = (float)(GHIDRA_CAST(this))->_roomList[0].Dimension; - pVVar26 = &local_9d4; - local_9d4.x = (((float)local_99c + (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex) - - (float)local_9a4) - (float)local_9bc; - } - } - else { - uVar19 = Random(); - uVar21 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar21) + __uint_to_double_fixup[-(GHIDRA_INT(uVar21) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_9b8._end = (void *)(fVar18 + fVar18); - local_9a0 = GHIDRA_CAST(sin((float)local_9b8._end)); - local_a38.x = cos((float)local_9b8._end); - pVVar23 = &local_a38; - local_a38.y = (float)local_9a0 * 5.0; - local_a38.x = local_a38.x * 5.0; - local_a04.x = (float)(GHIDRA_CAST(this))->_roomList[0].ListIndex; - local_a04.y = ((float)local_99c + (float)(GHIDRA_CAST(this))->_roomList[0].SafeGridIndex) - - (float)local_9a4; - pVVar26 = &local_a04; - } - } - else { - uVar19 = Random(); - uVar21 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar21) + __uint_to_double_fixup[-(GHIDRA_INT(uVar21) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_9b8._end = (void *)(fVar18 + fVar18); - local_9a0 = GHIDRA_CAST(sin((float)local_9b8._end)); - local_a28.x = cos((float)local_9b8._end); - pVVar23 = &local_a28; - local_a28.y = (float)local_9a0 * 5.0; - local_a28.x = local_a28.x * 5.0; - local_a30.x = (float)local_99c + (float)(GHIDRA_CAST(this))->_roomList[0].GridIndex; - local_a30.y = (float)(GHIDRA_CAST(this))->_roomList[0].SafeGridIndex; - pVVar26 = &local_a30; - } - listedEntity = Game::Spawn(g_game,1000,5,pVVar26,pVVar23,GHIDRA_CAST(0x0),0,uVar19); - iVar17 = (GHIDRA_CAST(this))->_roomList[0x28].Flags; - if (((iVar17 == 0x22) || (iVar17 == 0x2b)) || (iVar17 == 0x2c)) { - listedEntity->SetColor(); - fVar14 = g_colorGreenSplat._tint[3]; - fVar40 = g_colorGreenSplat._tint[2]; - fVar18 = g_colorGreenSplat._tint[1]; - if (&listedEntity->_splatColor != &g_colorGreenSplat) { - (listedEntity->_splatColor)._tint[0] = g_colorGreenSplat._tint[0]; - (listedEntity->_splatColor)._tint[1] = fVar18; - (listedEntity->_splatColor)._tint[2] = fVar40; - (listedEntity->_splatColor)._tint[3] = fVar14; - fVar14 = g_colorGreenSplat._colorize[3]; - fVar40 = g_colorGreenSplat._colorize[2]; - fVar18 = g_colorGreenSplat._colorize[1]; - (listedEntity->_splatColor)._colorize[0] = g_colorGreenSplat._colorize[0]; - (listedEntity->_splatColor)._colorize[1] = fVar18; - (listedEntity->_splatColor)._colorize[2] = fVar40; - (listedEntity->_splatColor)._colorize[3] = fVar14; - *GHIDRA_CAST((listedEntity->_splatColor)._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_colorGreenSplat._offset)) + 0x0))); - (listedEntity->_splatColor)._offset[2] = g_colorGreenSplat._offset[2]; - } - } - listedEntity->Update(); - psVar2 = &(GHIDRA_CAST(this))->_roomList[0x9e].SavedEntities; - local_9b8._capacity = (void *)(GHIDRA_INT(local_9b8._capacity) + 1); - psVar27 = &local_9b8; - if (GHIDRA_INT(psVar2->_begin) < 0x20) { - psVar27 = psVar2; - } - } while (GHIDRA_INT(local_9b8._capacity) < GHIDRA_INT(psVar27->_begin)); - } - } - bVar15 = TemporaryEffects::HasCollectibleEffect - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)),0x123); - if ((bVar15 != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x8)))) != 0x10)) { - fVar18 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x9c)))) + 0.1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x9c)))) = fVar18; - if ((0.89 < fVar18) && - ((fVar18 < 0.91 && - (puVar1 = GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0x44)), *puVar1 = *puVar1 | 0x100, - (*GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0x44)) >> 5 & 1) != 0)))) { - iVar17 = (GHIDRA_CAST(this))->_curses; - local_99c = GHIDRA_CAST(0x1); - if (1 < iVar17 + -1) { - do { - iVar33 = *GHIDRA_CAST(&(GHIDRA_CAST(this))->_isHeartPicked); - local_9b8._capacity = GHIDRA_CAST(0x1); - if (1 < iVar33 + -1) { - do { - if ((((GHIDRA_INT(local_99c) < 0) || - (iVar17 = (GHIDRA_CAST(this))->_curses, iVar17 <= GHIDRA_INT(local_99c))) || - (GHIDRA_INT(local_9b8._capacity) < 0)) || (iVar33 <= GHIDRA_INT(local_9b8._capacity))) { - iVar17 = (GHIDRA_CAST(this))->_curses; - } - else if (((-1 < GHIDRA_INT((&(local_99c->_sprite)._filename + -3)) + - GHIDRA_INT(local_9b8._capacity) * iVar17) && - (local_9ac = (ItemPool *) - (GHIDRA_CAST(this))->_roomList[0]._doors - [GHIDRA_INT(((local_99c->_sprite)._filename._buf + - GHIDRA_INT(local_9b8._capacity) * iVar17 + -0x4b))], - local_9ac != GHIDRA_CAST(0x0))) && - (*GHIDRA_CAST((GHIDRA_CAST(local_9ac) + 4)) == 9.80909e-45)) { - piVar28 = GHIDRA_CAST(__RTDynamicCast()); - (**(code **)(*piVar28 + 0x20))(); - (**(code **)(*piVar28 + 4))(); - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar33)) + 0x0))) = (GHIDRA_CAST(this))->_isHeartPicked; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar33)) + 0x1))) = (GHIDRA_CAST(this))->_isCanSeeEverything; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar33)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x12)))); - iVar17 = (GHIDRA_CAST(this))->_curses; - } - local_9b8._capacity = &(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(local_9b8._capacity)))) + 0x1))); - } while (GHIDRA_INT(local_9b8._capacity) < iVar33 + -1); - } - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_99c)) + 0x1)))); - } while (GHIDRA_INT(local_99c) < iVar17 + -1); - } - } - if (1.0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x9c))))) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x9c)))) = 0x3f800000; - } - } - if ((0.0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x9e])) + 0x9c))))) && - (fVar18 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0xa5])) + 0x94)))), 0.0 < fVar18)) { - fVar40 = fVar18 * 0.92; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0xa5])) + 0x94)))) = fVar40; - if ((fVar40 < 0.2) && (0.2 <= fVar18)) { - iVar17 = (GHIDRA_CAST(this))->_curses; - local_99c = GHIDRA_CAST(0x1); - if (1 < iVar17 + -1) { - do { - iVar29 = *GHIDRA_CAST(&(GHIDRA_CAST(this))->_isHeartPicked); - iVar33 = 1; - if (1 < iVar29 + -1) { - do { - if ((((GHIDRA_INT(local_99c) < 0) || - (iVar17 = (GHIDRA_CAST(this))->_curses, iVar17 <= GHIDRA_INT(local_99c))) || (iVar33 < 0)) - || (iVar29 <= iVar33)) { - iVar17 = (GHIDRA_CAST(this))->_curses; - } - else if (((-1 < GHIDRA_INT((&(local_99c->_sprite)._filename + -3)) + iVar33 * iVar17) && - (local_9ac = (ItemPool *) - (GHIDRA_CAST(this))->_roomList[0]._doors - [GHIDRA_INT(((local_99c->_sprite)._filename._buf + - iVar33 * iVar17 + -0x4b))], local_9ac != GHIDRA_CAST(0x0))) - && (*GHIDRA_CAST((GHIDRA_CAST(local_9ac) + 4)) == 9.80909e-45)) { - this_02 = GHIDRA_CAST(__RTDynamicCast()); - (GHIDRA_CAST((this_02)))->GridEntity_Pit::UpdateCollision(); - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar29)) + 0x0))) = (GHIDRA_CAST(this))->_isHeartPicked; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar29)) + 0x1))) = (GHIDRA_CAST(this))->_isCanSeeEverything; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar29)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x12)))); - iVar17 = (GHIDRA_CAST(this))->_curses; - } - iVar33 = iVar33 + 1; - } while (iVar33 < iVar29 + -1); - } - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_99c)) + 0x1)))); - } while (GHIDRA_INT(local_99c) < iVar17 + -1); - fVar40 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0xa5])) + 0x94)))); - } - } - if (fVar40 < 0.001) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0xa5])) + 0x94)))) = 0; - } - FUN_00823540(); - } - if ((((g_game->_levelStateFlags & 0x4000U) != 0) && - ((*GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0x44)) & 0x4000) == 0)) && - (((char)(GHIDRA_CAST(this))->_stage != '\0' && - ((g_game->_frameCount - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))) == 1 && - (bVar15 = Game::IsPaused(g_game), bVar15 == 0)))))) { - MamaMegaExplosion(this,&g_vectorZero,GHIDRA_CAST(0x0)); - } - pvVar31 = (GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._begin; - if (0 < GHIDRA_INT(pvVar31)) { - (GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._begin = (void *)(GHIDRA_INT(pvVar31) + -1); - } - UpdateGreedWave(this); - update_ambient_sounds(this); - iVar17 = (GHIDRA_CAST(this))->_roomList[0x9c]._doors[7]; - if ((0 < iVar17) && - (iVar17 = iVar17 + -1, (GHIDRA_CAST(this))->_roomList[0x9c]._doors[7] = iVar17, iVar17 < 1)) { - (GHIDRA_CAST(this))->_roomList[0x9c]._doors[7] = -1; - ShopRestockPartial(this); - } - if ((((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x8)))) == 2) && - (player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x209,GHIDRA_CAST(&g_game->_playerManager),1), - player != GHIDRA_CAST(0x0))) && ((char)(GHIDRA_CAST(this))->_stage != '\0')) && - (1 < g_game->_frameCount - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(this))->_roomList[0x18])) + 0x9c)))))) { - iVar17 = (GHIDRA_CAST(this))->_stageType; - sVar30 = *GHIDRA_CAST((iVar17 + 0xac)); - if ((0 < sVar30) && ((sVar30 <= *GHIDRA_CAST((iVar17 + 0xae)) || (*GHIDRA_CAST((iVar17 + 0xae)) == -1))) - ) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a58)) + 0x0))) = *GHIDRA_CAST((iVar17 + 0x58)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a58)) + 0xc))) = 0x1b; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_a58)) + 0x4))) = 0x1b00000001; - uVar19 = (GHIDRA_CAST((GHIDRA_CAST(local_a58))))->RNG::RandomInt(GHIDRA_INT(sVar30)); - *GHIDRA_CAST(((GHIDRA_CAST(this))->_stageType + 0xae)) = (short)uVar19; - } - } - pvVar31 = (GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._end; - if (0 < GHIDRA_INT(pvVar31)) { - if (GHIDRA_INT(pvVar31) % 5 == 0) { - get_random_pickup_position(g_game->_room,GHIDRA_CAST((local_a58 + 0x10)),0,0); - uVar19 = Random(); - Game::Spawn(g_game,4,3,GHIDRA_CAST((local_a58 + 0x10)),&g_vectorZero,GHIDRA_CAST(0x0),0,uVar19); - __RTDynamicCast(); - pvVar31 = (GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._end; - } - (GHIDRA_CAST(this))->_roomList[0x9e].SavedEffects._end = (void *)(GHIDRA_INT(pvVar31) + -1); - } - if (*GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0xa7].SavedEntities._end) != '\0') { - uVar19 = 0; - if ((GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed != 0) { - do { - pEVar20 = *(Entity_Pickup **) - (*GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x19].PoopCount) + uVar19 * 4); - iVar17 = pEVar20->_type; - if (iVar17 == 5) { - (GHIDRA_CAST((pEVar20)))->Entity_Pickup::UpdateLootPreview(); - } - else if ((((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar17 == 1)) || - (iVar17 - 10U < 0x3de)) && - (this_03 = GHIDRA_CAST(__RTDynamicCast()), this_03 != GHIDRA_CAST(0x0))) { - (GHIDRA_CAST((this_03)))->Entity_NPC::UpdatePickupGhosts(); - } - uVar19 = uVar19 + 1; - } while (uVar19 < GHIDRA_UINT((GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed)); - } - *GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0xa7].SavedEntities._end) = 0; - } - if (*GHIDRA_CAST((GHIDRA_INT(&(GHIDRA_CAST(this))->_roomList[0xa6].SafeGridIndex) + 1)) != '\0') { - g_pickupIgnoreModifiers = g_pickupIgnoreModifiers + 1; - local_9ec = (void *)0x0; - local_9e8.x = 0.0; - local_9b8._end = GHIDRA_CAST(0x0); - local_9e8.y = 0.0; - local_14 = 9.80909e-45; - memset(local_1e8,0,0x1c0); - local_9a8 = GHIDRA_CAST((*GHIDRA_CAST(&(GHIDRA_CAST(this))->_isHeartPicked) * (GHIDRA_CAST(this))->_curses)); - iVar17 = 0; - if (0 < GHIDRA_INT(local_9a8)) { - do { - uVar19 = GetGridCollision(this,iVar17); - *GHIDRA_CAST((GHIDRA_CAST(local_1e8) + iVar17)) = -(uVar19 != 0); - iVar17 = iVar17 + 1; - } while (iVar17 < GHIDRA_INT(local_9a8)); - } - local_9b8._capacity = GHIDRA_CAST(0x0); - if ((GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed != 0) { - do { - pfVar35 = *(float **) - (*GHIDRA_CAST(&(GHIDRA_CAST(this))->_roomList[0x19].PoopCount) + - GHIDRA_INT(local_9b8._capacity) * 4); - if ((pfVar35 == GHIDRA_CAST(0x0)) || (pfVar35[10] != 7.00649e-45)) { - local_9ac = GHIDRA_CAST(0x0); - } - else { - local_9ac = GHIDRA_CAST(pfVar35); - if (pfVar35[0xb] == 1.4013e-43) { - iVar33 = GHIDRA_INT(((pfVar35[0xcf] - 40.0) / 40.0 + 0.5)); - iVar17 = GHIDRA_INT(((pfVar35[0xd0] - 120.0) / 40.0 + 0.5)); - if ((((-1 < iVar33) && (iVar33 < (GHIDRA_CAST(this))->_curses)) && (-1 < iVar17)) && - (((*GHIDRA_CAST((GHIDRA_CAST(&(iVar4)) + 0x0))) = (GHIDRA_CAST(this))->_isHeartPicked, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar4)) + 0x1))) = (GHIDRA_CAST(this))->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar4)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this)))) + 0x12)))), iVar17 < iVar4 && - (iVar33 = iVar17 * (GHIDRA_CAST(this))->_curses + iVar33, -1 < iVar33)))) { - *GHIDRA_CAST((GHIDRA_CAST(local_1e8) + iVar33)) = 1; - } - if (((*GHIDRA_CAST((GHIDRA_CAST(pfVar35) + 0x173)) == '\0') && (pfVar35[0x14d] == 0.0)) && - (((GHIDRA_UINT(pfVar35[0x5a]) & 0x80000) != 0 && - (cVar16 = ItemConfig::collectible_has_tags(), cVar16 == '\0')))) { - pfVar35[0x5a] = (float)(GHIDRA_UINT(pfVar35[0x5a]) & 0xfff7ffff); - pfVar35[0x5b] = pfVar35[0x5b]; - if ((void *)local_9e8.x == local_9b8._end) { - msvc::vector::_Emplace_reallocate(); - local_9b8._end = (void *)local_9e8.y; - } - else { - *GHIDRA_CAST(local_9e8.x) = pfVar35; - local_9e8.x = (float)(GHIDRA_INT(local_9e8.x) + 4); - } - } - } - } - local_9b8._capacity = (void *)(GHIDRA_INT(local_9b8._capacity) + 1); - } while (local_9b8._capacity < GHIDRA_CAST((GHIDRA_CAST(this))->_roomList[0x19].DecorationSeed)); - } - local_9e0.x = 0.0; - local_9e0.y = 0.0; - local_9e0.x = (float)operator_new(0x18); - this_01 = local_9cc; - *GHIDRA_CAST(local_9e0.x) = local_9e0.x; - *GHIDRA_CAST((GHIDRA_CAST(local_9e0.x) + 4)) = local_9e0.x; - *GHIDRA_CAST((GHIDRA_CAST(local_9e0.x) + 8)) = local_9e0.x; - *GHIDRA_CAST((GHIDRA_CAST(local_9e0.x) + 0xc)) = 0x101; - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),8); - pairOffsets[0] = -1; - pairOffsets[1] = 0; - pairOffsets[2] = 1; - aiStack_28c[0] = 0; - local_9a4 = GHIDRA_CAST(0x0); - aiStack_28c[1] = 0; - aiStack_28c[2] = 0xffffffff; - aiStack_28c[3] = 0; - aiStack_28c[4] = 1; - local_9a0 = GHIDRA_CAST((GHIDRA_INT(local_9e8.x) - GHIDRA_INT(local_9ec) >> 2)); - local_278 = -NAN; - uStack_274 = 0xffffffff; - uStack_270 = 1; - iStack_26c = 1; - local_9bc = GHIDRA_CAST(0xffffffff); - local_268 = -1; - iStack_264 = 1; - iStack_260 = 1; - iStack_25c = -1; - local_258 = 1; - iStack_254 = -1; - uStack_250 = 0xffffffff; - uStack_24c = 1; - local_99c = GHIDRA_CAST(aiStack_28c); - local_248 = 1; - acStack_244[0] = '\x01'; - acStack_244[1] = '\0'; - acStack_244[2] = '\0'; - acStack_244[3] = '\0'; - acStack_244[4] = -1; - acStack_244[5] = -1; - acStack_244[6] = -1; - acStack_244[7] = -1; - acStack_244[8] = -1; - acStack_244[9] = -1; - acStack_244[10] = -1; - acStack_244[0xb] = -1; - acStack_244[0xc] = -1; - acStack_244[0xd] = -1; - acStack_244[0xe] = -1; - acStack_244[0xf] = -1; - acStack_244[0x10] = '\0'; - acStack_244[0x11] = '\0'; - acStack_244[0x12] = '\0'; - acStack_244[0x13] = '\0'; - acStack_244[0x14] = '\0'; - acStack_244[0x15] = '\0'; - acStack_244[0x16] = '\0'; - acStack_244[0x17] = '\0'; - acStack_244[0x18] = '\0'; - acStack_244[0x19] = '\0'; - acStack_244[0x1a] = '\0'; - acStack_244[0x1b] = '\0'; - acStack_244[0x1c] = '\0'; - acStack_244[0x1d] = '\0'; - acStack_244[0x1e] = '\0'; - acStack_244[0x1f] = '\0'; - acStack_244[0x20] = '\0'; - acStack_244[0x21] = '\0'; - acStack_244[0x22] = '\0'; - acStack_244[0x23] = '\0'; - acStack_244[0x24] = '\x01'; - acStack_244[0x25] = '\0'; - acStack_244[0x26] = '\0'; - acStack_244[0x27] = '\0'; - acStack_244[0x28] = '\0'; - acStack_244[0x29] = '\0'; - acStack_244[0x2a] = '\0'; - acStack_244[0x2b] = '\0'; - acStack_244[0x2c] = '\0'; - acStack_244[0x2d] = '\0'; - acStack_244[0x2e] = '\0'; - acStack_244[0x2f] = '\0'; - pvStack_214 = (void *)0xffffffff; - pvStack_210 = (void *)0x0; - pvStack_20c = (void *)0x0; - local_208 = (void *)0x0; - fStack_204 = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_200)) + 0x0))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_200)) + 0x1))) = 0; - iStack_1fc = 1; - pGVar22 = local_9a0; -LAB_008058a0: - local_9b8._begin = GHIDRA_CAST(0x0); - piVar28 = local_1e8; - gridOccupiedIter = gridOccupied; - for (iVar17 = 0x70; iVar17 != 0; iVar17 = iVar17 + -1) { - *gridOccupiedIter = *piVar28; - piVar28 = piVar28 + 1; - gridOccupiedIter = gridOccupiedIter + 1; - } - pGVar39 = GHIDRA_CAST(0x0); - local_9c8.y = local_9e0.x; - if (pGVar22 != GHIDRA_CAST(0x0)) { - listedEntity = GHIDRA_CAST(local_9cc->_curses); - local_9a8 = listedEntity; - do { - iVar17 = *GHIDRA_CAST((GHIDRA_CAST(local_9ec) + GHIDRA_INT(local_9b8._begin) * 4)); - fVar18 = *GHIDRA_CAST((iVar17 + 0x33c)); - fVar40 = *GHIDRA_CAST((iVar17 + 0x340)); - iVar33 = GHIDRA_INT(((fVar18 - 40.0) / 40.0 + 0.5)); - iVar17 = GHIDRA_INT(((fVar40 - 120.0) / 40.0 + 0.5)); - if ((((iVar33 < 0) || (GHIDRA_INT(listedEntity) <= iVar33)) || (iVar17 < 0)) || - ((*GHIDRA_CAST((GHIDRA_CAST(&(iVar5)) + 0x0))) = local_9cc->_isHeartPicked, (*GHIDRA_CAST((GHIDRA_CAST(&(iVar5)) + 0x1))) = local_9cc->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar5)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_9cc)) + 0x12)))), iVar5 <= iVar17)) { - iVar33 = -1; - } - else { - iVar33 = GHIDRA_INT(listedEntity) * iVar17 + iVar33; - } - local_9ac = GHIDRA_CAST((iVar33 / GHIDRA_INT(listedEntity))); - local_9b8._capacity = (void *)(iVar33 % GHIDRA_INT(listedEntity)); - if (((float)GHIDRA_INT(local_9b8._capacity) * 40.0 + 40.0 == fVar18) && - ((float)GHIDRA_INT(local_9ac) * 40.0 + 120.0 == fVar40)) { - iVar17 = GHIDRA_INT(local_99c[-1]._luaBridgeRef) + GHIDRA_INT(local_9ac); - iVar29 = GHIDRA_INT((&((GHIDRA_CAST(local_9b8._capacity))->_sprite)._filename + -3)) + - GHIDRA_INT(local_99c[-1]._scoreMultiplier); - if (((iVar29 < 0) || ((GHIDRA_INT(listedEntity) <= iVar29 || (iVar17 < 0)))) || - ((*GHIDRA_CAST((GHIDRA_CAST(&(iVar6)) + 0x0))) = local_9cc->_isHeartPicked, (*GHIDRA_CAST((GHIDRA_CAST(&(iVar6)) + 0x1))) = local_9cc->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar6)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_9cc)) + 0x12)))), iVar6 <= iVar17)) { - iVar29 = -1; - } - else { - iVar29 = iVar17 * GHIDRA_INT(listedEntity) + iVar29; - } - iVar17 = *GHIDRA_CAST(local_99c) + GHIDRA_INT(local_9ac); - local_9ac = (ItemPool *) - (GHIDRA_INT((&((GHIDRA_CAST(local_9b8._capacity))->_sprite)._filename + -3)) + - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_99c[-1])) + 0x40c))))); - if ((((GHIDRA_INT(local_9ac) < 0) || (GHIDRA_INT(listedEntity) <= GHIDRA_INT(local_9ac))) || (iVar17 < 0)) || - ((*GHIDRA_CAST((GHIDRA_CAST(&(iVar7)) + 0x0))) = local_9cc->_isHeartPicked, (*GHIDRA_CAST((GHIDRA_CAST(&(iVar7)) + 0x1))) = local_9cc->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar7)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_9cc)) + 0x12)))), iVar7 <= iVar17)) { - pfVar35 = GHIDRA_CAST(0xffffffff); - } - else { - pfVar35 = GHIDRA_CAST((GHIDRA_INT(listedEntity) * iVar17 + GHIDRA_INT(local_9ac))); - } - if (((iVar29 < 0) || (GHIDRA_INT(pfVar35) < 0)) || - ((gridOccupied[iVar29] != 0 || (gridOccupied[GHIDRA_INT(pfVar35)] != 0)))) goto LAB_00805bb8; - gridOccupied[iVar29] = 1; - gridOccupied[GHIDRA_INT(pfVar35)] = 1; - gridOccupied[iVar33] = 0; - listedEntity = local_9a8; - } - local_9b8._begin = (void *)(GHIDRA_INT(local_9b8._begin) + 1); - pGVar39 = local_9a0; - if (local_9a0 <= local_9b8._begin) break; - } while( true ); - } - local_9bc = local_9a4; - if (pGVar39 == GHIDRA_CAST(0x0)) goto LAB_0080603d; -LAB_00805a6e: - local_9a0 = GHIDRA_CAST(0x0); - do { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x0))) = (void *)0x3; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x4))) = (void *)0x3; - local_9b8._begin = *(void **)(GHIDRA_CAST(local_9ec) + GHIDRA_INT(local_9a0) * 4); - local_9a4 = GHIDRA_CAST(&DAT_0000001d); - local_9a8 = GHIDRA_CAST((GHIDRA_CAST(local_9b8._begin))->_roomList[5].VisitedCount); - if (local_9a8 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - uVar19 = GHIDRA_UINT(local_9a8) >> 3 ^ GHIDRA_UINT(local_9a8); - uVar19 = uVar19 << 3 ^ uVar19; - local_9ac = GHIDRA_CAST((uVar19 >> 0x1d ^ uVar19)); - if (local_9ac == (void *)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - local_a04.x = *GHIDRA_CAST(&(GHIDRA_CAST(local_9b8._begin))->_roomList[4].TotalMoneySpent); - local_a04.y = (float)(GHIDRA_CAST(local_9b8._begin))->_roomList[4].GreedSubType; - uVar19 = uVar19 >> 3 ^ GHIDRA_UINT(local_9ac); - uVar19 = uVar19 << 3 ^ uVar19; - local_9ac = GHIDRA_CAST((uVar19 >> 0x1d ^ uVar19)); - iVar17 = GHIDRA_INT(((local_a04.x - 40.0) / 40.0 + 0.5)); - iVar33 = GHIDRA_INT(((local_a04.y - 120.0) / 40.0 + 0.5)); - if (((iVar17 < 0) || (this_01->_curses <= iVar17)) || - ((iVar33 < 0 || - ((*GHIDRA_CAST((GHIDRA_CAST(&(iVar8)) + 0x0))) = this_01->_isHeartPicked, (*GHIDRA_CAST((GHIDRA_CAST(&(iVar8)) + 0x1))) = this_01->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar8)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_01)) + 0x12)))), iVar8 <= iVar33)))) { - uVar19 = 0xffffffff; - } - else { - uVar19 = iVar33 * this_01->_curses + iVar17; - } - local_9d4.y = 0.0; - local_9d4.x = 0.0; - if (((GHIDRA_INT(local_9bc) < 0) || - ((float)(GHIDRA_INT(uVar19) % this_01->_curses) * 40.0 + 40.0 != local_a04.x)) || - ((float)(GHIDRA_INT(uVar19) / this_01->_curses) * 40.0 + 120.0 != local_a04.y)) { - pVVar23 = FindFreePickupSpawnPosition - (GHIDRA_CAST(this_01),GHIDRA_CAST(local_a70),&local_a04,60.0,0,0,0); - local_9b8._capacity = (void *)pVVar23->x; - local_99c = GHIDRA_CAST(pVVar23->y); - iVar33 = GHIDRA_INT((((float)local_9b8._capacity - 40.0) / 40.0 + 0.5)); - iVar17 = GHIDRA_INT((((float)local_99c - 120.0) / 40.0 + 0.5)); - if (((-1 < iVar33) && (iVar33 < this_01->_curses)) && - ((-1 < iVar17 && - (((*GHIDRA_CAST((GHIDRA_CAST(&(iVar9)) + 0x0))) = this_01->_isHeartPicked, (*GHIDRA_CAST((GHIDRA_CAST(&(iVar9)) + 0x1))) = this_01->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar9)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_01)) + 0x12)))), iVar17 < iVar9 && - (local_9a8 = GHIDRA_CAST((iVar17 * this_01->_curses + iVar33)), local_9a8 < 0x1c0)))))) { - iVar17 = this_01->_roomMap[GHIDRA_INT(local_9a8) - 0x5cdc] % GHIDRA_INT(local_9c0); - if (iVar17 < 900) { - this_01->_roomMap[GHIDRA_INT(local_9a8) - 0x5cdc] = - (this_01->_roomMap[GHIDRA_INT(local_9a8) - 0x5cdc] - iVar17) + 900; - } - } - pVVar23 = FindFreePickupSpawnPosition - (GHIDRA_CAST(this_01),GHIDRA_CAST((local_a70 + 8)),&local_a04,60.0,1,0,0); - local_9d4.x = pVVar23->x; - local_9d4.y = pVVar23->y; - } - else { - local_99c = GHIDRA_CAST(((float)pairOffsets[GHIDRA_INT(local_9bc) * 4 + 1] * 40.0 + local_a04.y)); - local_9d4.y = (float)aiStack_28c[GHIDRA_INT(local_9bc) * 4] * 40.0 + local_a04.y; - local_9b8._capacity = - GHIDRA_CAST(((float)pairOffsets[GHIDRA_INT(local_9bc) * 4] * 40.0 + local_a04.x)); - local_9d4.x = (float)pairOffsets[GHIDRA_INT(local_9bc) * 4 + 2] * 40.0 + local_a04.x; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_01)) + 0x8)))) == 0x10) { - local_9d4.y = local_9d4.y + 30.0; - local_99c = GHIDRA_CAST(((float)local_99c + 30.0)); - } - if (local_9ac == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - uVar21 = GHIDRA_UINT(local_9ac) >> (local_9f8[0] & 0x1f) ^ GHIDRA_UINT(local_9ac); - uVar21 = uVar21 << (local_9f8[4] & 0x1f) ^ uVar21; - local_9a4 = GHIDRA_CAST(Game)::Spawn(g_game,GHIDRA_UINT((GHIDRA_CAST((GHIDRA_INT(local_9b8._begin) + 0x14)) - )->OverrideData), - (GHIDRA_CAST((GHIDRA_INT(local_9b8._begin) + 0x14)))-> - AllowedDoors,&local_9d4,&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar21 >> ((uint8_t)local_9a4 & 0x1f) ^ uVar21); - iVar17 = (GHIDRA_CAST((local_9b8._begin)))->Entity_Pickup::GetAlternatePedestal(); - (GHIDRA_CAST((GHIDRA_CAST(local_9a4))))->Entity_Pickup::SetAlternatePedestal(iVar17); - pvVar31 = local_9b8._begin; - if (-1 < GHIDRA_INT(uVar19)) { - if (0x1bf < uVar19) { - FUN_00aef86f(); - pcVar12 = (code *)swi(3); - (*pcVar12)(); - return; - } - *GHIDRA_CAST((GHIDRA_CAST(local_1e8) + uVar19)) = 0; - } - iVar17 = GHIDRA_INT(((local_9d4.x - 40.0) / 40.0 + 0.5)); - iVar33 = GHIDRA_INT(((local_9d4.y - 120.0) / 40.0 + 0.5)); - if ((((iVar17 < 0) || (this_01->_curses <= iVar17)) || (iVar33 < 0)) || - ((*GHIDRA_CAST((GHIDRA_CAST(&(iVar10)) + 0x0))) = this_01->_isHeartPicked, (*GHIDRA_CAST((GHIDRA_CAST(&(iVar10)) + 0x1))) = this_01->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar10)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_01)) + 0x12)))), iVar10 <= iVar33)) { - iVar17 = -1; - } - else { - iVar17 = iVar33 * this_01->_curses + iVar17; - } - iVar29 = GHIDRA_INT((((float)local_9b8._capacity - 40.0) / 40.0 + 0.5)); - iVar33 = GHIDRA_INT((((float)local_99c - 120.0) / 40.0 + 0.5)); - if (((iVar29 < 0) || (this_01->_curses <= iVar29)) || - ((iVar33 < 0 || - ((*GHIDRA_CAST((GHIDRA_CAST(&(iVar11)) + 0x0))) = this_01->_isHeartPicked, (*GHIDRA_CAST((GHIDRA_CAST(&(iVar11)) + 0x1))) = this_01->_isCanSeeEverything, - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar11)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_01)) + 0x12)))), iVar11 <= iVar33)))) { - iVar29 = -1; - } - else { - iVar29 = iVar33 * this_01->_curses + iVar29; - } - if (-1 < iVar17) { - *GHIDRA_CAST((GHIDRA_CAST(local_1e8) + iVar17)) = 1; - } - if (-1 < iVar29) { - *GHIDRA_CAST((GHIDRA_CAST(local_1e8) + iVar29)) = 1; - } - *(void **)&(GHIDRA_CAST((GHIDRA_INT(local_9b8._begin) + 0x14)))[4].TotalMoneySpent = - local_9b8._capacity; - (GHIDRA_CAST((GHIDRA_INT(local_9b8._begin) + 0x14)))[4].GreedSubType = GHIDRA_INT(local_99c); - (GHIDRA_CAST((GHIDRA_INT(local_9b8._begin) + 0x14)))[4].VisitedCount = GHIDRA_INT(local_9b8._capacity); - (GHIDRA_CAST((GHIDRA_INT(local_9b8._begin) + 0x14)))[4].Flags = GHIDRA_INT(local_99c); - fVar18 = (float)(GHIDRA_CAST((GHIDRA_INT(local_9b8._begin) + 0x14)))[7].Dimension; - if (0 < GHIDRA_INT(fVar18)) { - local_9a8 = GHIDRA_CAST(fVar18); - msvc::set::find_node(); - if ((*GHIDRA_CAST((GHIDRA_CAST(local_a08) + 0xd)) != '\0') || - (pfVar35 = local_a08, - (GHIDRA_CAST((GHIDRA_INT(pvVar31) + 0x14)))[7].Dimension < *GHIDRA_CAST((GHIDRA_CAST(local_a08) + 0x10))) - ) { - pfVar35 = GHIDRA_CAST(local_9e0.x); - } - if (pfVar35 == GHIDRA_CAST(local_9e0.x)) { - local_a18.y = (float)(GHIDRA_CAST((GHIDRA_CAST(local_9a4))))->Entity_Pickup::AssignOptionsIndex(); - local_a18.x = (float)(GHIDRA_CAST((GHIDRA_INT(pvVar31) + 0x14)))[7].Dimension; - std_map_int_insert(&local_9e0,&local_a60,GHIDRA_CAST(&local_a18)); - } - else { - local_9a4->_roomList[7].Dimension = *GHIDRA_CAST((GHIDRA_CAST(pfVar35) + 0x14)); - } - } - local_9a0 = GHIDRA_CAST((GHIDRA_INT(&local_9a0->_stage) + 1)); - } while (local_9a0 < GHIDRA_CAST((GHIDRA_INT(local_9e8.x) - GHIDRA_INT(local_9ec) >> 2))); -LAB_0080603d: - g_pickupIgnoreModifiers = g_pickupIgnoreModifiers + -1; - *GHIDRA_CAST((GHIDRA_INT(&this_01->_roomList[0xa6].SafeGridIndex) + 1)) = 0; - FID_conflict__Erase_tree_>_> - (&local_9e0,(fuzzer_allocator_> *)&local_9e0, - *(_Tree_node **)(GHIDRA_INT(local_9e0.x) + 4)); - operator_delete((void *)local_9e0.x,0x18); - local_14 = -NAN; - if (local_9ec != (void *)0x0) { - deallocate(local_9ec,GHIDRA_INT(local_9b8._end) - GHIDRA_INT(local_9ec) >> 2); - } - } - if (DAT_00c82674 != DAT_00c82678) { - segmentedListEnd = GHIDRA_CAST(0x0); - local_a10 = (void *)0x0; - pfVar35 = GHIDRA_CAST(0x0); - local_9c8.y = 0.0; - local_a0c = GHIDRA_CAST(0x0); - local_9a4 = GHIDRA_CAST(0x0); - local_a08 = GHIDRA_CAST(0x0); - local_14 = 1.26117e-44; - local_9c0 = (void *)0x0; - puVar34 = DAT_00c82674; - if (GHIDRA_INT(DAT_00c82678) - GHIDRA_INT(DAT_00c82674) >> 2 != 0) { - do { - fVar18 = (float)puVar34[GHIDRA_INT(local_9c0)]; - iVar17 = *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x28)); - if (((iVar17 == 0x1c) || (iVar17 == 0x13)) || (iVar17 == 0xef)) { -LAB_008060ff: - if (segmentedListEnd == pfVar35) { - local_9a8 = GHIDRA_CAST(fVar18); - msvc::vector::_Emplace_reallocate(); - pfVar35 = local_a08; - } - else { - *segmentedListEnd = fVar18; - local_a0c = segmentedListEnd + 1; - } - *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x16c)) = *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x16c)) | 0x4000; - *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x168)) = *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x168)); - puVar34 = DAT_00c82674; - segmentedListEnd = local_a0c; - } - else if (iVar17 == 0x59) goto LAB_008060ff; - local_9c0 = GHIDRA_CAST((GHIDRA_INT(local_9c0) + 1)); - } while (local_9c0 < (void *)(GHIDRA_INT(DAT_00c82678) - GHIDRA_INT(puVar34) >> 2)); - local_9c8.y = (float)segmentedListEnd; - local_9a4 = GHIDRA_CAST(pfVar35); - } - local_9a8 = GHIDRA_CAST(0x0); - pfVar35 = GHIDRA_CAST(local_9c8.y); - if (GHIDRA_INT(DAT_00c82678) - GHIDRA_INT(puVar34) >> 2 != 0) { - do { - listedEntity = GHIDRA_CAST(puVar34[GHIDRA_INT(local_9a8)]); - local_9b8._begin = (void *)listedEntity->_variant; - local_99c = GHIDRA_CAST((listedEntity->_pos).x); - local_9a0 = GHIDRA_CAST((listedEntity->_pos).y); - local_9bc = GHIDRA_CAST(listedEntity->_type); - local_9b8._end = (void *)listedEntity->_subtype; - local_9cc = GHIDRA_CAST(listedEntity->_initSeed); - local_9d4.y = (float)listedEntity; - if ((listedEntity->_flags & 0x400000000000) == 0) { - if (((((local_9bc == GHIDRA_CAST(0x4e)) || (local_9bc == GHIDRA_CAST(0x24))) || - ((local_9bc == GHIDRA_CAST(0x10a) || - ((local_9bc == GHIDRA_CAST(0x54) || (local_9bc == GHIDRA_CAST(0x106))))))) || - (local_9bc == GHIDRA_CAST(0x107))) || (local_9bc == GHIDRA_CAST(&DAT_00000065))) { - local_a38.x = (float)local_99c - 60.0; - local_a38.y = (float)local_9a0 - 0.0; - pVVar23 = random_position_away_from_players - (GHIDRA_CAST((local_a58 + 0x10)),&local_a38,listedEntity->_size,0.0); - local_9b8._capacity = - Game::Spawn(g_game,GHIDRA_UINT(local_9bc),GHIDRA_UINT(local_9b8._begin),pVVar23,&g_vectorZero, - GHIDRA_CAST(0x0),GHIDRA_UINT(local_9b8._end),GHIDRA_UINT(local_9cc)); - pVVar23 = &local_a04; - local_a04.x = (float)local_99c + 60.0; - pVVar26 = &local_9e0; - local_a04.y = (float)local_9a0 + 0.0; -LAB_008067bb: - pVVar23 = random_position_away_from_players(pVVar26,pVVar23,listedEntity->_size,0.0); - (listedEntity->_pos).x = pVVar23->x; - (listedEntity->_pos).y = pVVar23->y; - pEVar37 = local_9b8._capacity; - } - else { - if (local_9bc == GHIDRA_CAST(0x66)) { - local_a20.x = (float)local_99c + 0.0; - local_a20.y = (float)local_9a0 + 30.0; - pVVar23 = random_position_away_from_players - (GHIDRA_CAST(local_a70),&local_a20,listedEntity->_size,0.0); - local_9b8._capacity = - Game::Spawn(g_game,GHIDRA_UINT(local_9bc),GHIDRA_UINT(local_9b8._begin),pVVar23,&g_vectorZero, - GHIDRA_CAST(0x0),GHIDRA_UINT(local_9b8._end),GHIDRA_UINT(local_9cc)); - pVVar23 = &local_a40; - pVVar26 = GHIDRA_CAST((local_a70 + 8)); - local_a40.x = (float)local_99c - 0.0; - local_a40.y = (float)local_9a0 - 30.0; - goto LAB_008067bb; - } - local_9c0 = GHIDRA_CAST(listedEntity->_size); - if (listedEntity->_entityGridCollisionClass == 5) { - uVar19 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - local_9d4.y = fVar18 + fVar18; - fVar18 = cos(local_9d4.y); - local_a28.x = fVar18 * 20.0 + (float)local_99c; - fVar18 = sin(local_9d4.y); - pVVar23 = &local_a28; - pVVar26 = &local_a60; - local_a28.y = fVar18 * 20.0 + (float)local_9a0; - } - else { - uVar19 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - local_9d4.y = fVar18 + fVar18; - fVar18 = cos(local_9d4.y); - local_a30.x = fVar18 * 20.0 + (float)local_99c; - fVar18 = sin(local_9d4.y); - pVVar23 = &local_a30; - pVVar26 = &local_9e8; - local_a30.y = fVar18 * 20.0 + (float)local_9a0; - } - pVVar23 = random_position_away_from_players(pVVar26,pVVar23,(float)local_9c0,0.0); - pEVar37 = Game::Spawn(g_game,GHIDRA_UINT(local_9bc),GHIDRA_UINT(local_9b8._begin),pVVar23, - &g_vectorZero,GHIDRA_CAST(0x0),GHIDRA_UINT(local_9b8._end),GHIDRA_UINT(local_9cc)); - } - if (pEVar37 != GHIDRA_CAST(0x0)) { - qVar13 = pEVar37->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&pEVar37->_flags) + 4)); - *puVar1 = *puVar1 | 0x80; - *GHIDRA_CAST(&pEVar37->_flags) = GHIDRA_INT(qVar13); - pEVar37->_spawnGridIndex = listedEntity->_spawnGridIndex; - } - } - else { - uVar19 = Random(); - fVar18 = (float)((double)GHIDRA_INT(uVar19) + __uint_to_double_fixup[-(GHIDRA_INT(uVar19) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_9c0 = GHIDRA_CAST((fVar18 + fVar18)); - local_9ac = GHIDRA_CAST(sin((float)local_9c0)); - fVar18 = cos((float)local_9c0); - if (listedEntity->_child == 0) { - pEVar37 = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x0))) = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x4))) = (void *)0x0; - local_9b8._capacity = GHIDRA_CAST(0x0); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x8))) = GHIDRA_CAST(0x0); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),10); - local_9a0 = GHIDRA_CAST(((float)local_9a0 + (float)local_9ac * 40.0)); - local_9c0 = GHIDRA_CAST((fVar18 * 40.0 + (float)local_99c)); - listedEntity = GHIDRA_CAST(local_9d4.y); - do { - local_a18.x = (float)local_9c0; - local_a18.y = (float)local_9a0; - local_9d4.y = (float)Game::Spawn(g_game,GHIDRA_UINT(local_9bc),GHIDRA_UINT(local_9b8._begin), - &local_a18,&g_vectorZero,GHIDRA_CAST(0x0), - GHIDRA_UINT(local_9b8._end),GHIDRA_UINT(local_9cc)); - if (pEVar37 == local_9b8._capacity) { - msvc::vector::_Emplace_reallocate(); - local_9b8._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_9f8)) + 0x8))); - pEVar37 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_9f8))) + 0x4))); - } - else { - *GHIDRA_CAST(pEVar37) = local_9d4.y; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x4))) = &(*GHIDRA_CAST((GHIDRA_CAST((pEVar37)) + 0x4))); - pEVar37 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar37)) + 0x4)))); - } - listedEntity = GHIDRA_CAST(listedEntity->_parent); - } while ((listedEntity != GHIDRA_CAST(0x0)) && - (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (listedEntity->_type == 1)) || - (listedEntity->_type - 10U < 0x3de)))); - pvVar31 = (void *)(GHIDRA_INT(pEVar37) - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x0))) >> 2); - local_9d4.y = 0.0; - if (pvVar31 != (void *)0x0) { - pvVar24 = (void *)0x0; - do { - (**(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x0))) + pvVar24 * 4)) + 0xc))(); - pvVar24 = (void *)(GHIDRA_INT(pvVar24) + 1); - } while (pvVar24 < pvVar31); - local_9c0 = (void *)0x0; - local_9ac = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_9f8))) + 0x0))); - pfVar35 = GHIDRA_CAST(local_9c8.y); - do { - fVar18 = *GHIDRA_CAST(local_9ac); - *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x16c)) = *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x16c)) | 0x4080; - *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x168)) = *GHIDRA_CAST((GHIDRA_CAST(fVar18) + 0x168)); - if (GHIDRA_CAST(pfVar35) == local_9a4) { - msvc::vector::_Emplace_reallocate(); - local_9a4 = GHIDRA_CAST(local_a08); - } - else { - *pfVar35 = *GHIDRA_CAST(local_9ac); - local_a0c = pfVar35 + 1; - } - local_9ac = GHIDRA_CAST((GHIDRA_INT(local_9ac) + 4)); - local_9c0 = GHIDRA_CAST((GHIDRA_INT(local_9c0) + 1)); - pfVar35 = local_a0c; - } while (local_9c0 < pvVar31); - local_9c8.y = (float)local_a0c; - } - pfVar35 = GHIDRA_CAST(local_9c8.y); - local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),9); - if ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_9f8))) + 0x0))) != GHIDRA_CAST(0x0)) { - deallocate((*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_9f8)) + 0x0))),GHIDRA_INT(local_9b8._capacity) - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x0))) >> 2); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x0))) = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x4))) = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_9f8)) + 0x8))) = GHIDRA_CAST(0x0); - } - } - } - local_9a8 = GHIDRA_CAST((GHIDRA_INT(local_9a8) + 1)); - puVar34 = DAT_00c82674; - } while (local_9a8 < GHIDRA_UINT((GHIDRA_INT(DAT_00c82678) - GHIDRA_INT(DAT_00c82674) >> 2))); - } - uVar19 = 0; - uVar21 = GHIDRA_INT(pfVar35) - GHIDRA_INT(local_a10) >> 2; - if (uVar21 != 0) { - do { - iVar17 = *GHIDRA_CAST((GHIDRA_CAST(local_a10) + uVar19 * 4)); - uVar19 = uVar19 + 1; - *GHIDRA_CAST((iVar17 + 0x16c)) = *GHIDRA_CAST((iVar17 + 0x16c)) & 0xffffbfff; - *GHIDRA_CAST((iVar17 + 0x168)) = *GHIDRA_CAST((iVar17 + 0x168)); - } while (uVar19 < uVar21); - } - if (local_a10 != (void *)0x0) { - deallocate(local_a10,GHIDRA_INT(local_9a4) - GHIDRA_INT(local_a10) >> 2); - } - } - ExceptionList = local_1c; - return; -LAB_00805bb8: - local_99c = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_99c)) + 0x10)))); - local_9a4 = GHIDRA_CAST((GHIDRA_INT(&local_9a4->_stage) + 1)); - if (GHIDRA_CAST(&DAT_00000009) < local_9a4) goto LAB_00805a6e; - pGVar22 = local_9a0; - goto LAB_008058a0; -} - -// 008068f0 -void Room::TriggerClear(uint8_t playSound) -{ - uint8_t bVar1; - ChallengeParam *challengeParams; - RoomDescriptor *roomDesc; - uint32_t forcedCurses; - uint32_t preventedCurses; - int iVar2; - int unusedArg; - Game *game; - undefined3 in_stack_00000005; - short *clearCount; - uint32_t curses; - uint32_t debugCurses; - int descriptor; - uint32_t *descriptorFlags; - Manager *manager; - uint32_t *scoreSheet; - - scoreSheet = &g_game->_scoreSheet; - descriptorFlags = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)); - *descriptorFlags = *descriptorFlags | 1; - clearCount = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x4a)); - *clearCount = *clearCount + 1; - descriptor = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - ScoreSheet::add_cleared_room - (GHIDRA_CAST(scoreSheet),this->_roomType,*GHIDRA_CAST((*GHIDRA_CAST((descriptor + 0x10)) + 0x48)), - GHIDRA_UINT(*GHIDRA_CAST((descriptor + 0x4a))),(uint8_t)(*GHIDRA_CAST((descriptor + 0x44)) >> 10) & 1); - game = g_game; - if ((((g_game->_challenge == 0x1f) || - (challengeParams = Game::GetChallengeParams(g_game), challengeParams->_pathType == 3)) || - (challengeParams->_endStage == 0xd)) && - (roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(game),game->_currentRoomIdx,-1), game = g_game, - roomDesc->ListIndex == g_game->_lastBossRoomListIdx)) { - debugCurses = g_game->_debugCurses; - descriptor = g_game->_stage; - curses = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - iVar2 = descriptor + 1; - if ((~preventedCurses & (forcedCurses | debugCurses | curses) & 2) == 0) { - iVar2 = descriptor; - } - if (iVar2 == 6) { - update_door_targets(this); - } - game = g_game; - } - if ((game->_difficulty != 2) && (game->_difficulty != 3)) { - TrySpawnSecretExit(this,1,0); - } - TrySpawnDevilRoomDoor(this,1,0); - manager = g_manager; - if (playSound == 0) { - _playSound = 0x24; - seed_fart_sound_override(GHIDRA_CAST(&playSound)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(_playSound,1.0,2,0,1.0,0.0); - } - game = g_game; - if ((g_game->_difficulty != 2) && (g_game->_difficulty != 3)) { - TrySpawnBossRushDoor(this,0,0); - TrySpawnBlueWombDoor(this,1,0,0); - TrySpawnTheVoidDoor(this,0); - manager = g_manager; - game = g_game; - if (((((*GHIDRA_CAST(&g_game->_seedEffects) == '\0') && - (((bVar1 = Seeds::AchievementUnlocksDisallowed(&g_game->_seedEffects), bVar1 == 0 && - (bVar1 = Manager::IsGameplayInputActive(unusedArg), bVar1 == 0)) && - (game->_isRerun == 0)))) || (manager->_netplayManager != *GHIDRA_CAST((manager + 1)))) && - ((((manager->_persistentGameData)._eventCounters[0x19] != 0 && - ((game->_levelStateFlags & 0x10000U) == 0)) && - ((roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(game),game->_currentRoomIdx,-1), game = g_game, - roomDesc->ListIndex == g_game->_lastBossRoomListIdx && - ((g_game->_stage == 1 && (g_game->_stageType != 4)))))))) && - ((g_game->_stageType != 5 && (g_game->_frameCount < 0x709)))) { - g_game->_levelStateFlags = g_game->_levelStateFlags | 0x10000; - manager = g_manager; - _playSound = 0x5a; - seed_fart_sound_override(GHIDRA_CAST(&playSound)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(_playSound,1.0,2,0,1.0,0.0); - game = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x72fc)))) = 0; - } - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 7 & 1) == 0) { - if (((game->_difficulty != 2) && (game->_difficulty != 3)) || (this->_roomType != 1)) { - PlayerManager::trigger_room_clear(&game->_playerManager); - } - SpawnClearAward(this); - game = g_game; - } - descriptor = game->_difficulty; - if ((descriptor == 2) || (descriptor == 3)) { - if (this->_roomType == 1) { - iVar2 = game->_greedModeWave; - game->_greedLastBeatenWave = iVar2; - bVar1 = PlayerManager::IsCoopPlay(&game->_playerManager); - if ((bVar1 == 0) || (iVar2 != (descriptor == 3) + 10)) goto LAB_00806c0a; - } - else if (((this->_roomType != 5) || (this->_bossId != 0x3e)) || - (bVar1 = PlayerManager::IsCoopPlay(&game->_playerManager), bVar1 == 0)) - goto LAB_00806c0a; - PlayerManager::revive_player_ghosts(&game->_playerManager); - } -LAB_00806c0a: - Game::save_rewind_state(-1); - return; -} - -// 0080bd20 -void Room::render_player_light(Entity_Player *player, Vector *offset) -{ - void *pvVar1; - int iVar2; - Room *pRVar3; - code *pcVar4; - uint8_t bVar5; - Vector *pVVar6; - uint32_t uVar7; - LayerState *layer; - ANM2 *lightSprite; - float fVar8; - float fVar9; - float fVar10; - float fVar11; - double dVar12; - uint32_t local_88 [8]; - uint32_t local_68; - uint32_t uStack_64; - uint32_t local_60; - ColorMod color; - RNG rng; - float renderOffsetX; - Room *local_1c; - Vector renderPos; - float local_10; - Vector local_c; - ColorMod *lightColor; - int minecart; - - rng._seed = g_game->_frameCount + player->_initSeed; - minecart = player->_minecart; - rng._shift3 = 0x19; - rng._shift1 = 5; - rng._shift2 = 0x1b; - renderOffsetX = offset->x; - fVar8 = offset->y; - local_1c = this; - if (minecart == 0) { - fVar9 = g_vectorZero.x; - fVar10 = g_vectorZero.y; - } - else { - if ((*GHIDRA_CAST((minecart + 0x7c)) == 0) || - (pVVar6 = AnimationState::GetNullFrameById(GHIDRA_CAST((minecart + 0x78)),0), - pVVar6 == GHIDRA_CAST(0x0))) { - pVVar6 = &g_vectorZero; - } - fVar9 = pVVar6->x; - fVar10 = pVVar6->y; - } - minecart = player->_type; - renderOffsetX = renderOffsetX + fVar9; - fVar8 = fVar8 + fVar10; - if (minecart == 1) { - local_c.y = g_displayPixelRatio * g_screenPointScale; - local_10 = ((g_screenWidth - 338.0) * 0.5 + ((player->_pos).x - 60.0) * 0.65) * local_c.y + 0.5; - dVar12 = floor((double)local_10); - local_10 = (float)dVar12 / local_c.y; - renderPos.y = ((g_screenHeight - 182.0) * 0.5 + ((player->_pos).y - 140.0) * 0.65) * local_c.y + - 0.5; - dVar12 = floor((double)renderPos.y); - renderPos.x = local_10 + renderOffsetX; - offset = GHIDRA_CAST((fVar8 + (float)dVar12 / local_c.y)); - renderPos.y = (float)offset; - local_10 = renderPos.x; - minecart = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::GetNullEffectNum(0x4a); - local_c.y = (float)minecart; - if (4.0 <= local_c.y) { - local_c.y = 4.0; - } - bVar5 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasNullEffect(0x4a); - uVar7 = g_graphicsManager_flags; - if (bVar5 != 0) { - lightSprite = &this->_lightSprite; - layer = ANM2::GetLayer(lightSprite,GHIDRA_CAST(0x0)); - color._tint[0] = 0.4; - color._colorize[0] = 0.0; - color._colorize[1] = 0.0; - color._colorize[2] = 0.0; - color._colorize[3] = 0.0; - minecart = 1; - if ((uVar7 & 4) == 0) { - minecart = 6; - } - layer->_blendMode[1] = minecart; - layer->_blendMode[0] = 0; - layer->_blendMode[2] = 1; - color._tint[3] = local_c.y * 0.07 + 0.2; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - color._tint[1] = 0.6; - color._tint[2] = 1.0; - color._offset[0] = 0.0; - color._offset[1] = 0.0; - color._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(lightSprite))))->Sprite::SetColor(&color); - fVar9 = local_c.y * 0.5 + 1.0; - fVar8 = fVar9 * g_vectorOne.x; - (local_1c->_lightSprite)._scale.y = fVar9 * g_vectorOne.y; - (local_1c->_lightSprite)._scale.x = fVar8; - ANM2::Render(lightSprite,&renderPos,&g_vectorZero,&g_vectorZero); - uVar7 = g_graphicsManager_flags; - layer = ANM2::GetLayer(lightSprite,GHIDRA_CAST(0x0)); - minecart = 1; - offset = GHIDRA_CAST(renderPos.y); - if ((uVar7 & 4) == 0) { - minecart = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = minecart; - layer->_blendMode[2] = 7; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 7; - local_10 = renderPos.x; - this = local_1c; - } - uVar7 = g_graphicsManager_flags; - if (player->_babySkin == 0x42) { - lightSprite = &this->_lightSprite; - layer = ANM2::GetLayer(lightSprite,GHIDRA_CAST(0x0)); - color._offset[0] = 0.0; - color._offset[1] = 0.0; - minecart = 1; - color._offset[2] = 0.0; - if ((uVar7 & 4) == 0) { - minecart = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = minecart; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - color._colorize[0] = 0.0; - color._colorize[1] = 0.0; - color._colorize[2] = 0.0; - color._colorize[3] = 0.0; - color._tint[0] = 1.0; - color._tint[1] = 1.0; - color._tint[2] = 0.9; - color._tint[3] = 1.0; - (GHIDRA_CAST((GHIDRA_CAST(lightSprite))))->Sprite::SetColor(&color); - fVar8 = g_vectorOne.y * 2.0; - (local_1c->_lightSprite)._scale.x = g_vectorOne.x * 2.0; - (local_1c->_lightSprite)._scale.y = fVar8; - ANM2::Render(lightSprite,&renderPos,&g_vectorZero,&g_vectorZero); - uVar7 = g_graphicsManager_flags; - layer = ANM2::GetLayer(lightSprite,GHIDRA_CAST(0x0)); - minecart = 1; - offset = GHIDRA_CAST(renderPos.y); - if ((uVar7 & 4) == 0) { - minecart = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = minecart; - layer->_blendMode[2] = 7; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 7; - local_10 = renderPos.x; - } - pvVar1 = (g_manager->_itemConfig)._collectibles._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU)) < 0x401) - { - local_c.y = 0.0; - } - else { - local_c.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x400)); - } - minecart = player->_playerCostumeMap[0]._index; - if (((minecart < 0) || - (*GHIDRA_CAST((minecart * 0x130 + 0x114 + GHIDRA_INT((player->_costumeSpriteDescs)._begin))) != - local_c.y)) && - (bVar5 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x101,0), pRVar3 = local_1c, bVar5 == 0)) { - pvVar1 = (g_manager->_itemConfig)._nullItems._begin; - if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU)) < 0xe1) { - minecart = 0; - } - else { - minecart = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xe0)); - } - iVar2 = player->_playerCostumeMap[0]._index; - if ((iVar2 < 0) || - (*GHIDRA_CAST((iVar2 * 0x130 + 0x114 + GHIDRA_INT((player->_costumeSpriteDescs)._begin))) != minecart)) - { - return; - } - color._offset[0] = 0.0; - color._colorize[0] = 0.0; - color._colorize[1] = 0.0; - color._colorize[2] = 0.0; - color._colorize[3] = 0.0; - color._tint[0] = 1.0; - color._tint[1] = 0.8; - color._tint[2] = 0.7; - color._tint[3] = 0.7; - color._offset[1] = 0.0; - color._offset[2] = 0.0; - (GHIDRA_CAST((GHIDRA_CAST(&local_1c->_lightSprite))))->Sprite::SetColor(&color); - (pRVar3->_lightSprite)._scale.x = g_vectorOne.x; - (pRVar3->_lightSprite)._scale.y = g_vectorOne.y; - uVar7 = (GHIDRA_CAST((&rng)))->RNG::Next(); - pVVar6 = RandomVector(&local_c,uVar7); - fVar9 = (GHIDRA_CAST((&rng)))->RNG::RandomFloat(); - fVar8 = (fVar9 + fVar9) * pVVar6->y; - renderPos.x = (fVar9 + fVar9) * pVVar6->x; - } - else { - pRVar3 = local_1c; - local_68 = 0; - uStack_64 = 0; - lightColor = &(local_1c->_lightSprite)._color; - local_60 = 0; - if (lightColor != GHIDRA_CAST(local_88)) { - (local_1c->_lightSprite)._color._colorize[0] = 0.0; - (local_1c->_lightSprite)._color._colorize[1] = 0.0; - (local_1c->_lightSprite)._color._colorize[2] = 0.0; - (local_1c->_lightSprite)._color._colorize[3] = 0.0; - (local_1c->_lightSprite)._color._offset[0] = 0.0; - (local_1c->_lightSprite)._color._offset[1] = 0.0; - lightColor->_tint[0] = 1.0; - (local_1c->_lightSprite)._color._tint[1] = 0.6; - (local_1c->_lightSprite)._color._tint[2] = 0.4; - (local_1c->_lightSprite)._color._tint[3] = 0.7; - (local_1c->_lightSprite)._color._offset[2] = 0.0; - } - (local_1c->_lightSprite)._scale.x = g_vectorOne.x; - (local_1c->_lightSprite)._scale.y = g_vectorOne.y; - uVar7 = (GHIDRA_CAST((&rng)))->RNG::Next(); - pVVar6 = RandomVector(&local_c,uVar7); - if (rng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar4 = (code *)swi(3); - (*pcVar4)(); - return; - } - uVar7 = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed; - uVar7 = uVar7 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar7; - uVar7 = uVar7 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar7; - renderPos.x = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283062e-10; - renderPos.x = renderPos.x + renderPos.x; - fVar8 = renderPos.x * pVVar6->y; - renderPos.x = renderPos.x * pVVar6->x; - } - lightSprite = &pRVar3->_lightSprite; - renderPos.y = fVar8 + (float)offset; - renderPos.x = renderPos.x + local_10; - } - else if (minecart == 9) { - if ((g_manager->_optionsConfig)._enableBulletVisibility == 0) { - return; - } - fVar9 = sin((float)g_game->_frameCount * 0.8); - color._offset[0] = 0.0; - color._offset[1] = 0.0; - color._colorize[0] = 0.0; - color._colorize[1] = 0.0; - color._colorize[2] = 0.0; - color._colorize[3] = 0.0; - color._offset[2] = 0.0; - fVar10 = (fVar9 * 0.5 + 0.5) * 0.20000002 + 0.1; - color._tint[0] = 1.0; - color._tint[1] = 1.0; - color._tint[2] = 1.0; - color._tint[3] = 0.4; - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(&color); - fVar9 = g_displayPixelRatio; - fVar11 = fVar10 * g_vectorOne.x; - (this->_lightSprite)._scale.y = fVar10 * g_vectorOne.y; - (this->_lightSprite)._scale.x = fVar11; - fVar9 = fVar9 * g_screenPointScale; - local_c.y = ((((player->_pos).x + (player->_posOffset).x) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * fVar9 + 0.5; - dVar12 = floor((double)local_c.y); - renderPos.x = (float)dVar12 / fVar9 + renderOffsetX; - local_c.y = ((((player->_pos).y + (player->_posOffset).y) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5) * fVar9 + 0.5; - dVar12 = floor((double)local_c.y); - local_c.y = (float)dVar12; - lightSprite = &this->_lightSprite; - renderPos.y = local_c.y / fVar9 + fVar8; - } - else { - if (minecart != 0x328) { - return; - } - if (player->_visible == 0) { - return; - } - local_1c = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - dVar12 = floor((double)(((((player->_pos).x + 0.0) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_1c + 0.5)); - fVar9 = (float)dVar12 / (float)local_1c; - local_c.y = ((((player->_pos).y - 16.0) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - (float)local_1c + 0.5; - dVar12 = floor((double)local_c.y); - local_c.y = (float)dVar12; - fVar9 = fVar9 + renderOffsetX; - fVar10 = local_c.y / (float)local_1c; - color._offset[0] = 0.0; - color._offset[1] = 0.0; - color._offset[2] = 0.0; - color._colorize[0] = 0.0; - color._colorize[1] = 0.0; - color._colorize[2] = 0.0; - color._colorize[3] = 0.0; - color._tint[0] = 0.6; - color._tint[1] = 0.4; - color._tint[2] = 0.2; - color._tint[3] = 0.7; - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(&color); - uVar7 = (GHIDRA_CAST((&rng)))->RNG::Next(); - pVVar6 = RandomVector(&local_c,uVar7); - if (rng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar4 = (code *)swi(3); - (*pcVar4)(); - return; - } - uVar7 = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed; - uVar7 = uVar7 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar7; - lightSprite = &this->_lightSprite; - uVar7 = uVar7 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar7; - fVar11 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * - 2.3283062e-10; - renderPos.y = fVar11 * pVVar6->y + fVar8 + fVar10; - renderPos.x = fVar11 * pVVar6->x + fVar9; - fVar8 = g_vectorOne.y * 0.5; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.5; - (this->_lightSprite)._scale.y = fVar8; - } - ANM2::Render(lightSprite,&renderPos,&g_vectorZero,&g_vectorZero); - return; -} - -// 0080c810 -void Room::render_grid_entity_light(GridEntity *param_2, float *param_3) -{ - int *piVar1; - uint8_t isLastBoss; - int iVar2; - ColorMod *color; - ColorMod *color_00; - ColorMod *color_01; - ColorMod *color_02; - int frame; - ColorMod *color_03; - ColorMod *color_04; - RoomDescriptor *roomDesc; - ColorMod *color_05; - ColorMod *color_06; - ColorMod *color_07; - ColorMod *tmpColor; - ColorMod *color_08; - ColorMod *color_09; - void *layerFrame; - ColorMod *color_10; - uint32_t uVar3; - Vector *randomDir; - LayerState *layer; - ColorMod *color_11; - Vector *pVVar4; - uint8_t unused; - uint8_t unused_00; - uint8_t unused_01; - Game *game; - float b; - float fVar5; - double dVar6; - float fVar7; - Color local_68; - RNG local_3c; - Vector gridPos; - Vector local_20; - Vector local_18; - float *local_10; - Vector local_c; - GridEntity *gridEntity; - ANM2 *lightSprite; - - gridEntity = param_2; - game = g_game; - local_3c._shift1 = 5; - local_3c._shift2 = 0x1b; - local_10 = GHIDRA_CAST(g_game->_frameCount); - local_3c._seed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x14)))) + GHIDRA_INT(local_10); - local_3c._shift3 = 0x19; - local_20.y = (float)this; - iVar2 = Level::get_secret_exit_kind(GHIDRA_CAST(g_game)); - switch(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x4))))) { - case 7: - iVar2 = this->_backdropType; - if (iVar2 == 0x20) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 5 & 1) != 0) { - fVar5 = sin((float)GHIDRA_INT(local_10) * 0.1); - local_20.y = fVar5 * 0.2 + 0.8; - local_c.y = (local_20.y * 0.1 + 0.9) * this->_lavaIntensity; - if (1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0xc))))) { - local_c.y = local_c.y * 0.5; - } - if (local_c.y <= 0.0) { - return; - } - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - fVar5 = g_displayPixelRatio * g_screenPointScale; - local_10 = GHIDRA_CAST((((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * fVar5 + - 0.5)); - dVar6 = floor((double)(float)local_10); - local_18.y = (float)dVar6 / fVar5; - local_10 = GHIDRA_CAST((((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * fVar5 + - 0.5)); - dVar6 = floor((double)(float)local_10); - local_10 = GHIDRA_CAST((float)dVar6); - local_18.x = local_18.y + *param_3; - local_18.y = (float)local_10 / fVar5 + param_3[1]; - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,local_20.y * 0.35,0.0,local_c.y); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color); - pVVar4 = &local_18; - fVar5 = g_vectorOne.y * 0.8; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.8; - (this->_lightSprite)._scale.y = fVar5; - goto LAB_0080e2d3; - } - } - else if (((iVar2 == 0x3a) || (iVar2 == 0x3b)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 5 & 1) != 0)) goto LAB_0080cac5; - isLastBoss = Seeds::HasSeedEffect(&game->_seedEffects,0x4f); - if (isLastBoss == 0) { - return; - } - uVar3 = Game::GetStageID(game,unused); - if (uVar3 != 6) { - return; - } - if (this->_waterAmount <= 0.5) { - return; - } - game = g_game; -LAB_0080cac5: - fVar5 = sin((float)game->_frameCount * 0.1); - local_c.y = fVar5 * 0.2 + 0.8; - param_2 = GHIDRA_CAST(this->_lavaIntensity); - isLastBoss = Seeds::HasSeedEffect(&game->_seedEffects,0x4f); - if ((isLastBoss != 0) && (uVar3 = Game::GetStageID(game,unused_00), uVar3 == 6)) { - param_2 = GHIDRA_CAST(0x3f800000); - } - param_2 = GHIDRA_CAST(((local_c.y * 0.1 + 0.9) * (float)param_2)); - if (1 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gridEntity)) + 0xc))))) { - param_2 = GHIDRA_CAST(((float)param_2 * 0.5)); - } - if ((float)param_2 <= 0.0) { - return; - } - pVVar4 = (GHIDRA_CAST((gridEntity)))->GridEntity::Position(&gridPos); - local_10 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)local_10 + 0.5 - ; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)local_10; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)local_10 + - 0.5; - dVar6 = floor((double)local_20.y); - local_20.x = local_18.y + *param_3; - local_20.y = (float)dVar6 / (float)local_10 + param_3[1]; - layer = ANM2::GetLayer(&this->_lightSprite,GHIDRA_CAST(0x0)); - game = g_game; - layer->_blendMode[0] = DAT_00c35b6c; - layer->_blendMode[1] = DAT_00c35b70; - layer->_blendMode[2] = DAT_00c35b74; - layer->_blendMode[3] = DAT_00c35b78; - layer->_blendMode[4] = DAT_00c35b7c; - isLastBoss = Seeds::HasSeedEffect(&game->_seedEffects,0x4f); - if ((isLastBoss == 0) || (uVar3 = Game::GetStageID(game,unused_01), uVar3 != 6)) { - b = 0.0; - fVar5 = 0.0; - fVar7 = local_c.y * 0.4 + 0.6; - } - else { - fVar5 = local_c.y * 0.3 + 0.4; - b = local_c.y * 0.4 + 0.6; - fVar7 = 0.0; - } - (GHIDRA_CAST((&local_68)))->Color::Color(fVar7,fVar5,b,(float)param_2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_00); - fVar5 = g_vectorOne.y * 0.8; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.8; - (this->_lightSprite)._scale.y = fVar5; - ANM2::Render(&this->_lightSprite,&local_20,&g_vectorZero,&g_vectorZero); - layer = ANM2::GetLayer(&this->_lightSprite,GHIDRA_CAST(0x0)); - layer->_blendMode[0] = DAT_00c354ac; - layer->_blendMode[1] = DAT_00c354b0; - layer->_blendMode[2] = DAT_00c354b4; - layer->_blendMode[3] = DAT_00c354b8; - layer->_blendMode[4] = DAT_00c354bc; - return; - default: - goto switchD_0080c86a_caseD_8; - case 0x10: - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(param_2[1])) + 0xc)))) == 0x1b) { - if (iVar2 == 2) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x8)))) == 8) { - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,0.5,0.2,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_01); - (this->_lightSprite)._scale.x = g_vectorOne.x; - (this->_lightSprite)._scale.y = g_vectorOne.y; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 - + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - (float)param_2 + 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - else { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0xc)))) != 4) { - return; - } - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,0.5,0.2,0.5); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_02); - fVar5 = g_vectorOne.y * 0.5; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.5; - (this->_lightSprite)._scale.y = fVar5; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 - + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - (float)param_2 + 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - } - else { - if (iVar2 != 3) { - return; - } - iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x8)))); - if (iVar2 == 1) { - return; - } - isLastBoss = ANM2::IsPlaying(¶m_2->_sprite,GHIDRA_CAST("KeyOpen")); - if ((isLastBoss != 0) && (frame = ANM2::GetFrame(¶m_2->_sprite), frame < 0x13)) { - return; - } - if (iVar2 != 8) { - return; - } - (GHIDRA_CAST((&local_68)))->Color::Color(0.8,0.1,1.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_03); - (this->_lightSprite)._scale.x = g_vectorOne.x; - (this->_lightSprite)._scale.y = g_vectorOne.y; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)param_2 - + 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - } - else if ((game->_currentRoomIdx == -10) && (iVar2 == 4)) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x8)))) != 8) { - return; - } - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,0.2,0.2,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_04); - (this->_lightSprite)._scale.x = g_vectorOne.x; - (this->_lightSprite)._scale.y = g_vectorOne.y; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - else { - piVar1 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 4)) + 0x10)); - if ((piVar1 == GHIDRA_CAST(0x0)) || (*piVar1 != 0x23)) { - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(game),GHIDRA_INT(param_2[2]._sprite._color._tint[1]),-1); - if ((roomDesc->Flags & 0x40000U) == 0) { - if (((GHIDRA_UINT(param_2[2]._sprite._color._colorize[0]) >> 5 & 1) == 0) || - (g_game->_currentDimensionIdx != 1)) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(param_2[1])) + 0xc)))) != 0xf) { - return; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x8)))) != 8) { - return; - } - (GHIDRA_CAST((&local_68)))->Color::Color(0.92,0.95,1.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_07); - (this->_lightSprite)._scale.x = g_vectorOne.x; - (this->_lightSprite)._scale.y = g_vectorOne.y; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * - (float)param_2 + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - (float)param_2 + 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - else { - layer = ANM2::GetLayer(¶m_2->_sprite,&DAT_00000005); - if (layer->_visible == 0) { - return; - } - layer = ANM2::GetLayer(¶m_2->_sprite,&DAT_00000005); - if ((layer->_color)._tint[3] <= 0.0) { - return; - } - layer = ANM2::GetLayer(¶m_2->_sprite,&DAT_00000005); - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,0.95,0.9,(layer->_color)._tint[3]); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_06); - (this->_lightSprite)._scale.x = g_vectorOne.x; - (this->_lightSprite)._scale.y = g_vectorOne.y; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * - (float)param_2 + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - (float)param_2 + 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - } - else { - (GHIDRA_CAST((&local_68)))->Color::Color(0.3,0.6,1.0,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_05); - fVar5 = g_vectorOne.y * 0.7; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.7; - (this->_lightSprite)._scale.y = fVar5; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 - + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * - (float)param_2 + 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - } - else { - layer = ANM2::GetLayer(¶m_2->_sprite,GHIDRA_CAST(0x3)); - if (layer->_visible == 0) { - return; - } - layer = ANM2::GetLayer(¶m_2->_sprite,GHIDRA_CAST(0x3)); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(&layer->_color); - (this->_lightSprite)._scale.x = g_vectorOne.x; - (this->_lightSprite)._scale.y = g_vectorOne.y; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)param_2 - + 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - } - break; - case 0x11: - if ((this->_roomType != 0x1b) || (iVar2 != 2)) { - isLastBoss = IsCurrentRoomLastBoss(this); - if (isLastBoss == 0) { - return; - } - isLastBoss = Level::IsMausoleumHeartStage(GHIDRA_CAST(g_game)); - if (isLastBoss == 0) { - return; - } - lightSprite = &this->_lightSprite; - layer = ANM2::GetLayer(lightSprite,GHIDRA_CAST(0x0)); - local_3c._seed = layer->_blendMode[0]; - local_3c._shift1 = layer->_blendMode[1]; - local_3c._shift2 = layer->_blendMode[2]; - local_3c._shift3 = layer->_blendMode[3]; - iVar2 = layer->_blendMode[4]; - layer = ANM2::GetLayer(lightSprite,GHIDRA_CAST(0x0)); - layer->_blendMode[0] = DAT_00c35b6c; - layer->_blendMode[1] = DAT_00c35b70; - layer->_blendMode[2] = DAT_00c35b74; - layer->_blendMode[3] = DAT_00c35b78; - layer->_blendMode[4] = DAT_00c35b7c; - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,0.5,0.5,2.0); - (GHIDRA_CAST((GHIDRA_CAST(lightSprite))))->Sprite::SetColor(color_11); - ((GHIDRA_CAST((GHIDRA_INT(local_20.y) + 0x6e40)))->_scale).x = 1.2; - ((GHIDRA_CAST((GHIDRA_INT(local_20.y) + 0x6e40)))->_scale).y = 0.75; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - fVar5 = g_displayPixelRatio * g_screenPointScale; - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * fVar5 + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / fVar5; - local_20.y = ((g_screenHeight - 182.0) * 0.5 + (pVVar4->y - 140.0) * 0.65) * fVar5 + 0.5; - dVar6 = floor((double)local_20.y); - local_20.x = local_18.y + *param_3; - local_20.y = (float)dVar6 / fVar5 + param_3[1]; - ANM2::Render(lightSprite,&local_20,&g_vectorZero,&g_vectorZero); - layer = ANM2::GetLayer(lightSprite,GHIDRA_CAST(0x0)); - layer->_blendMode[1] = local_3c._shift1; - layer->_blendMode[0] = local_3c._seed; - layer->_blendMode[2] = local_3c._shift2; - layer->_blendMode[3] = local_3c._shift3; - layer->_blendMode[4] = iVar2; - return; - } - layerFrame = ANM2::GetLayerFrame(¶m_2->_sprite,0); - if (layerFrame == (void *)0x0) { - return; - } - if (*GHIDRA_CAST((GHIDRA_CAST(layerFrame) + 0xc)) == '\0') { - return; - } - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,0.8,0.2,1.0); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_10); - (this->_lightSprite)._scale.x = g_vectorOne.x; - (this->_lightSprite)._scale.y = g_vectorOne.y; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - fVar5 = g_displayPixelRatio * g_screenPointScale; - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * fVar5 + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / fVar5; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * fVar5 + 0.5; - dVar6 = floor((double)local_20.y); - local_20.y = (float)dVar6 / fVar5; - fVar5 = *param_3; - local_10 = GHIDRA_CAST(param_3[1]); - uVar3 = (GHIDRA_CAST((&local_3c)))->RNG::Next(); - randomDir = RandomVector(&local_c,uVar3); - fVar7 = (GHIDRA_CAST((&local_3c)))->RNG::RandomFloat(); - pVVar4 = &local_18; - local_18.x = local_18.y + fVar5 + 0.0 + fVar7 * randomDir->x * 3.0; - local_18.y = fVar7 * randomDir->y * 3.0 + ((local_20.y + (float)local_10) - 14.0); - goto LAB_0080e2d3; - case 0x14: - iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0xc)))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x8)))) == 9) { - if (iVar2 == 0) { - fVar5 = 1.0; - } - else { - fVar5 = 0.25; - } - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,0.4,0.4,fVar5); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(tmpColor); - fVar5 = g_vectorOne.y * 0.5; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.5; - (this->_lightSprite)._scale.y = fVar5; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - else if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((param_2)) + 0x8)))) == 3) { - if (iVar2 == 0) { - fVar5 = 1.0; - } - else { - fVar5 = 0.25; - } - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,1.0,0.0,fVar5); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_08); - fVar5 = g_vectorOne.y * 0.5; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.5; - (this->_lightSprite)._scale.y = fVar5; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - else { - if (iVar2 != 0) { - return; - } - (GHIDRA_CAST((&local_68)))->Color::Color(1.0,1.0,1.0,0.2); - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(color_09); - fVar5 = g_vectorOne.y * 0.5; - (this->_lightSprite)._scale.x = g_vectorOne.x * 0.5; - (this->_lightSprite)._scale.y = fVar5; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - param_2 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / (float)param_2; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)param_2 + - 0.5; - dVar6 = floor((double)local_20.y); - fVar5 = (float)dVar6; - } - break; - case 0x17: - if ((param_2->_sprite)._animState._animData == (void *)0x0) { - return; - } - local_10 = AnimationState::GetNullFrameById(&(param_2->_sprite)._animState,0); - if (local_10 == GHIDRA_CAST(0x0)) { - return; - } - if (*GHIDRA_CAST((local_10 + 3)) == '\0') { - return; - } - (GHIDRA_CAST((GHIDRA_CAST(&this->_lightSprite))))->Sprite::SetColor(GHIDRA_CAST((local_10 + 6))); - (this->_lightSprite)._scale.x = local_10[4]; - (this->_lightSprite)._scale.y = local_10[5]; - pVVar4 = (GHIDRA_CAST((param_2)))->GridEntity::Position(&gridPos); - fVar5 = g_displayPixelRatio * g_screenPointScale; - local_20.y = ((g_screenWidth - 338.0) * 0.5 + (pVVar4->x - 60.0) * 0.65) * fVar5 + 0.5; - dVar6 = floor((double)local_20.y); - local_18.y = (float)dVar6 / fVar5; - local_20.y = ((pVVar4->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * fVar5 + 0.5; - dVar6 = floor((double)local_20.y); - local_20.x = local_18.y + *param_3 + *local_10; - local_20.y = (float)dVar6 / fVar5 + param_3[1] + local_10[1]; - goto LAB_0080e2c3; - } - local_20.x = local_18.y + *param_3; - local_20.y = fVar5 / (float)param_2 + param_3[1]; -LAB_0080e2c3: - pVVar4 = &local_20; -LAB_0080e2d3: - ANM2::Render(&this->_lightSprite,pVVar4,&g_vectorZero,&g_vectorZero); -switchD_0080c86a_caseD_8: - return; -} - -// 0080e320 -uint8_t Room::pick_special_clear_award(int *outCollectible, uint32_t *outTrinket, RNG *rng) -{ - code *pcVar1; - uint8_t bVar2; - uint32_t uVar3; - int collectibleId; - uint32_t trinketChoices [12]; - Game *game; - int *numAvailableTrinkets; - void *trinketPool; - - trinketChoices[0xb] = __security_cookie ^ GHIDRA_UINT((trinketChoices + 0xc)); - *outCollectible = 0; - *outTrinket = 0; - if ((this->_roomType != 5) && (this->_secondBossID != 0)) { - return 0; - } - uVar3 = rng->_seed; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - uVar3 = rng->_seed; - if (uVar3 == 0) { - pcVar1 = (code *)swi(3); - bVar2 = (*pcVar1)(); - return bVar2; - } - } - uVar3 = uVar3 >> ((uint8_t)rng->_shift1 & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)rng->_shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)rng->_shift3 & 0x1f) ^ uVar3; - rng->_seed = uVar3; - if (uVar3 % 100 != 0) goto switchD_0080e3e0_caseD_5; - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) & 0x10000) != 0) { -switchD_0080e3e0_caseD_56: - *outCollectible = 0x27f; - collectibleId = 0x27f; - goto LAB_0080e7b8; - } - switch(this->_bossId) { - case 1: - *outCollectible = 0x56; - collectibleId = 0x56; - break; - case 2: - case 7: - case 0x1a: - case 0x25: - trinketChoices[0] = 0xc; - trinketChoices[1] = 0x1a; - trinketChoices[2] = 9; - trinketChoices[3] = 0xb; - trinketChoices[4] = 0x1b; - trinketChoices[5] = 10; - trinketChoices[6] = 0x40; - trinketChoices[7] = 0x41; - trinketChoices[8] = 0x60; - trinketChoices[9] = 0x90; - trinketChoices[10] = 0x42; - uVar3 = (GHIDRA_CAST((rng)))->RNG::RandomInt(0xb); - *outTrinket = trinketChoices[uVar3]; - goto switchD_0080e3e0_caseD_5; - case 3: - *outCollectible = 0x58; - collectibleId = 0x58; - break; - case 4: - case 0x1c: - case 0x31: - case 0x38: - *outCollectible = 0x180; - collectibleId = 0x180; - break; - case 5: - *outCollectible = 0xe5; - collectibleId = 0xe5; - break; - default: - goto switchD_0080e3e0_caseD_5; - case 9: - *outTrinket = 0x73; - goto switchD_0080e3e0_caseD_5; - case 10: - *outTrinket = 0x72; - goto switchD_0080e3e0_caseD_5; - case 0xb: - *outTrinket = 0x71; - goto switchD_0080e3e0_caseD_5; - case 0xc: - *outTrinket = 0x74; - goto switchD_0080e3e0_caseD_5; - case 0xd: - *outCollectible = 10; - collectibleId = 10; - break; - case 0xe: - *outCollectible = 0x242; - collectibleId = 0x242; - break; - case 0xf: - *outCollectible = 0x57; - collectibleId = 0x57; - break; - case 0x10: - *outCollectible = 0x219; - collectibleId = 0x219; - break; - case 0x11: - *outCollectible = 0x13e; - collectibleId = 0x13e; - break; - case 0x12: - *outCollectible = 0x20d; - collectibleId = 0x20d; - break; - case 0x17: - *outCollectible = 0x286; - collectibleId = 0x286; - break; - case 0x1b: - *outCollectible = 0x2ab; - collectibleId = 0x2ab; - break; - case 0x1d: - *outCollectible = 0x94; - collectibleId = 0x94; - break; - case 0x1e: - *outCollectible = 0x9b; - collectibleId = 0x9b; - break; - case 0x1f: - *outCollectible = 0x1b3; - collectibleId = 0x1b3; - break; - case 0x20: - *outCollectible = 0x264; - collectibleId = 0x264; - break; - case 0x21: - *outCollectible = 0x285; - collectibleId = 0x285; - break; - case 0x22: - *outCollectible = 0xd3; - collectibleId = 0xd3; - break; - case 0x23: - *outCollectible = 0xf2; - collectibleId = 0xf2; - break; - case 0x24: - *outCollectible = 0x10a; - collectibleId = 0x10a; - break; - case 0x26: - *outTrinket = 0x75; - goto switchD_0080e3e0_caseD_5; - case 0x29: - *outCollectible = 0xaa; - collectibleId = 0xaa; - break; - case 0x2a: - *outCollectible = 0x59; - collectibleId = 0x59; - break; - case 0x2b: - *outCollectible = 0x115; - collectibleId = 0x115; - break; - case 0x2c: - *outCollectible = 0x24; - collectibleId = 0x24; - break; - case 0x2d: - *outCollectible = 0x171; - collectibleId = 0x171; - break; - case 0x2e: - *outCollectible = 0x177; - collectibleId = 0x177; - break; - case 0x2f: - *outCollectible = 0x13a; - collectibleId = 0x13a; - break; - case 0x30: - *outCollectible = 0x262; - collectibleId = 0x262; - break; - case 0x32: - *outCollectible = 0x103; - collectibleId = 0x103; - break; - case 0x33: - *outCollectible = 0x23c; - collectibleId = 0x23c; - break; - case 0x34: - *outCollectible = 0x292; - collectibleId = 0x292; - break; - case 0x35: - *outCollectible = 0xa7; - collectibleId = 0xa7; - break; - case 0x39: - *outCollectible = 0x2aa; - collectibleId = 0x2aa; - break; - case 0x3a: - *outCollectible = 0x240; - collectibleId = 0x240; - break; - case 0x3b: - *outCollectible = 0x221; - collectibleId = 0x221; - break; - case 0x3c: - case 0x45: - *outCollectible = 0x1f7; - collectibleId = 0x1f7; - break; - case 0x3d: - *outCollectible = 0x120; - collectibleId = 0x120; - break; - case 0x40: - *outCollectible = 0x2a8; - collectibleId = 0x2a8; - break; - case 0x41: - *outCollectible = 0x17a; - collectibleId = 0x17a; - break; - case 0x42: - *outCollectible = 0x225; - collectibleId = 0x225; - break; - case 0x43: - *outCollectible = 3; - collectibleId = 3; - break; - case 0x44: - *outCollectible = 0xe1; - collectibleId = 0xe1; - break; - case 0x48: - *outCollectible = 0x1d9; - collectibleId = 0x1d9; - break; - case 0x49: - *outCollectible = 0x1c5; - collectibleId = 0x1c5; - break; - case 0x4a: - *outCollectible = 0x166; - collectibleId = 0x166; - break; - case 0x4b: - *outCollectible = 0x134; - collectibleId = 0x134; - break; - case 0x4c: - *outCollectible = 0x10e; - collectibleId = 0x10e; - break; - case 0x4d: - *outCollectible = 0x1d5; - collectibleId = 0x1d5; - break; - case 0x4e: - *outCollectible = 0x2a4; - collectibleId = 0x2a4; - break; - case 0x4f: - *outTrinket = 0x8d; - goto switchD_0080e3e0_caseD_5; - case 0x50: - *outCollectible = 0x297; - collectibleId = 0x297; - break; - case 0x51: - *outCollectible = 0xd8; - collectibleId = 0xd8; - break; - case 0x52: - *outCollectible = 0x100; - collectibleId = 0x100; - break; - case 0x53: - *outCollectible = 0xd2; - collectibleId = 0xd2; - break; - case 0x55: - *outCollectible = 0x282; - collectibleId = 0x282; - break; - case 0x56: - *outCollectible = 0x2d9; - collectibleId = 0x2d9; - break; - case 0x57: - goto switchD_0080e3e0_caseD_56; - case 0x5b: - *outCollectible = 0x108; - collectibleId = 0x108; - break; - case 0x5c: - *outCollectible = 0x123; - collectibleId = 0x123; - break; - case 0x5d: - *outCollectible = 0x268; - collectibleId = 0x268; - break; - case 0x5f: - *outCollectible = 0xd1; - collectibleId = 0xd1; - break; - case 0x60: - *outCollectible = 0x281; - collectibleId = 0x281; - break; - case 0x61: - *outCollectible = 0x1f8; - collectibleId = 0x1f8; - break; - case 0x65: - *outTrinket = 0xb7; -switchD_0080e3e0_caseD_5: - collectibleId = *outCollectible; - if (collectibleId == 0) goto LAB_0080e7d5; - break; - case 0x66: - *outCollectible = 0x2a5; - collectibleId = 0x2a5; - } -LAB_0080e7b8: - bVar2 = ItemPool::is_collectible_available(&g_game->_itemPool,collectibleId,0); - if (bVar2 == 0) { - *outCollectible = 0; - } -LAB_0080e7d5: - game = g_game; - uVar3 = *outTrinket; - if (uVar3 != 0) { - if ((((GHIDRA_INT(uVar3) < 1) || - (trinketPool = (g_game->_itemPool)._trinketPoolItems._begin, - GHIDRA_INT((g_game->_itemPool)._trinketPoolItems._end) - GHIDRA_INT(trinketPool) >> 3 <= GHIDRA_INT(uVar3))) || - (*GHIDRA_CAST((GHIDRA_CAST(trinketPool) + uVar3 * 8 + 4)) == '\0')) || - (*GHIDRA_CAST((GHIDRA_CAST(trinketPool) + uVar3 * 8 + 5)) == '\0')) { - *outTrinket = 0; - } - else { - *GHIDRA_CAST((GHIDRA_CAST(trinketPool) + uVar3 * 8 + 4)) = 0; - numAvailableTrinkets = &(game->_itemPool)._numAvailableTrinkets; - *numAvailableTrinkets = *numAvailableTrinkets + -1; - } - } - if ((*outCollectible == 0) && (*outTrinket == 0)) { - return 0; - } - return 1; -} - -// 0080ea80 -void Room::render_lighting() -{ - ColorMod *pCVar1; - int iVar2; - uint32_t uVar3; - Room *beamAnim; - uint8_t bVar4; - uint32_t *targetEntry; - void *quad; - Vector *centerPos; - uint32_t forcedCurses; - uint32_t preventedCurses; - AnimationState *beamAnim; - uint32_t uVar5; - void **gridEntitySlot; - float fVar6; - double dVar7; - Vector local_118; - float local_110; - Room *room; - float darkness; - float local_ec; - Vector renderOffset; - KColor ambientColor; - float baseBlue; - float baseGreen; - Vector local_b4; - uint32_t local_ac [8]; - uint32_t local_8c; - uint32_t uStack_88; - uint32_t local_84; - uint8_t local_80 [124]; - Room *thisRoom; - - renderOffset.x = 0.0; - renderOffset.y = 0.0; - room = this; - msvc::vector::resize(&renderOffset); - targetEntry = msvc::deque::back(); - if (GHIDRA_CAST((targetEntry + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((targetEntry + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *targetEntry = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c797b4,0); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - render_entity_light_masks(); - _glfw_context_reset(); - pop_render_target(); - local_b4.x = (float)g_game->_stage; - local_ec = (float)g_game->_stageType; - if ((g_manager->_optionsConfig)._enableLighting == 0) goto LAB_0080f1ce; - if (g_game->_darknessModifier <= 0.0) { - Seeds::GetForcedCurses(); - Seeds::GetPreventedCurses(); - } - local_118.x = 0.0; - local_118.y = 0.0; - msvc::vector::resize(&local_118); - targetEntry = msvc::deque::back(); - if (GHIDRA_CAST((targetEntry + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((targetEntry + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *targetEntry = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c797cc,1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - ambientColor._red = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b5c)))); - local_118.x = (float)g_currentShader; - ambientColor._unk = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b6c)))); - baseGreen = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b60)))); - baseBlue = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b64)))); - ambientColor._alpha = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b68)))); - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 9 & 1) != 0) { - ambientColor._red = 0.0; - ambientColor._alpha = 1.0; - baseBlue = 0.0; - baseGreen = 0.0; - ambientColor._unk = 0; - } - local_110 = ambientColor._red; - ambientColor._green = baseGreen; - ambientColor._blue = baseBlue; - quad = render_quad_set_uniform_color(local_80,0.0,0.0,DAT_00c7997c,DAT_00c79980,&ambientColor); - render_color_shader_pass(quad); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[2] = 1; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 1; - renderOffset.y = (this->_renderScrollOffset).y + (g_game->_screenShakeOffset).y; - renderOffset.x = (this->_renderScrollOffset).x + (g_game->_screenShakeOffset).x; - if (this->_backdropType == 0x39) { - BeastArena::render_light(); - } - else if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 9 & 1) == 0) { - uVar5 = g_game->_debugCurses; - uVar3 = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - this = room; - if ((~preventedCurses & (forcedCurses | uVar5 | uVar3) & 1) == 0) { - darkness = g_game->_darknessStrength * g_game->_darknessModifier; - } - else { - darkness = 1.0; - } - if ((((room->_roomType == 8) || (room->_roomType == 0x1d)) || - ((bVar4 = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)), bVar4 != 0 && - (g_game->_currentDimensionIdx == 1)))) || - (bVar4 = is_pre_ascent_mom_room(this), bVar4 != 0)) { - fVar6 = darkness + 0.6; - if (1.0 <= darkness + 0.6) { - fVar6 = 1.0; - } - } - else { - fVar6 = darkness; - } - if (((local_b4.x == 1.82169e-44) && (local_ec == 1.4013e-45)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 2 & 1) == 0)) { - fVar6 = 1.0; - } - fVar6 = fVar6 - g_game->_lightningIntensity; - ambientColor._alpha = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b7c)))); - if (fVar6 <= 0.0) { - fVar6 = 0.0; - } - ambientColor._unk = 0; - ambientColor._blue = - (baseBlue - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b78))))) * fVar6 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b78)))); - ambientColor._green = - (baseGreen - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b74))))) * fVar6 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b74)))); - ambientColor._red = - (local_110 - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b70))))) * fVar6 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b70)))); - if (((void *)local_118.x != (void *)0x0) && ((*GHIDRA_CAST((GHIDRA_CAST(local_118.x) + 4)) & 1) != 0)) { - g_currentShader = (void *)local_118.x; - } - render_color_quad_list(&this->_fxLayers,&ambientColor); - } - iVar2 = *GHIDRA_CAST(this->_litGridIndices); - FID_conflict__Erase_tree_>_> - (this->_litGridIndices, - (fuzzer_allocator_> *)this->_litGridIndices, - *(_Tree_node **)(iVar2 + 4)); - beamAnim = room; - *GHIDRA_CAST((iVar2 + 4)) = iVar2; - *GHIDRA_CAST(iVar2) = iVar2; - *GHIDRA_CAST((iVar2 + 8)) = iVar2; - uVar5 = 0; - this->_litGridIndices[4] = 0; - this->_litGridIndices[5] = 0; - this->_litGridIndices[6] = 0; - this->_litGridIndices[7] = 0; - if ((room->_entityList)._updateEL._size != 0) { - do { - Game::Render(GHIDRA_CAST(beamAnim), - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((beamAnim->_entityList)._updateEL)) + 0x4)))) + uVar5 * 4)), - &renderOffset); - uVar5 = uVar5 + 1; - } while (uVar5 < GHIDRA_UINT((beamAnim->_entityList)._updateEL._size)); - } - local_110 = (float)(beamAnim->_gridHeight * beamAnim->_gridWidth); - if (0 < GHIDRA_INT(local_110)) { - gridEntitySlot = beamAnim->_gridEntities; - do { - if (*gridEntitySlot != (void *)0x0) { - render_grid_entity_light(beamAnim,*gridEntitySlot,&renderOffset); - } - gridEntitySlot = gridEntitySlot + 1; - local_110 = (float)(GHIDRA_INT(local_110) + -1); - } while (local_110 != 0.0); - } - if (((beamAnim->_roomType == 5) && - (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((beamAnim)) + 0x4)))) + 0x10)) + 0x10)) == 0x59)) && - (bVar4 = Level::IsPreAscent(GHIDRA_CAST(g_game)), bVar4 != 0)) { - centerPos = GetCenterPos(&local_b4); - local_110 = g_displayPixelRatio * g_screenPointScale; - fVar6 = ((g_screenWidth - 338.0) * 0.5 + (centerPos->x - 60.0) * 0.65) * local_110 + 0.5; - local_118.x = fVar6; - dVar7 = floor((double)fVar6); - local_ec = (float)dVar7 / local_110; - local_118.x = ((centerPos->y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * local_110 + 0.5 - ; - dVar7 = floor((double)local_118.x); - pCVar1 = &(beamAnim->_lightSprite)._color; - (beamAnim->_lightSprite)._scale.x = g_vectorOne.x; - (beamAnim->_lightSprite)._scale.y = g_vectorOne.y; - local_8c = 0; - uStack_88 = 0; - local_84 = 0; - if (pCVar1 != GHIDRA_CAST(local_ac)) { - pCVar1->_tint[0] = 1.0; - (beamAnim->_lightSprite)._color._tint[1] = 1.0; - (beamAnim->_lightSprite)._color._tint[2] = 1.0; - (beamAnim->_lightSprite)._color._tint[3] = 1.0; - (beamAnim->_lightSprite)._color._offset[0] = 0.0; - (beamAnim->_lightSprite)._color._offset[1] = 0.0; - (beamAnim->_lightSprite)._color._colorize[0] = 0.0; - (beamAnim->_lightSprite)._color._colorize[1] = 0.0; - (beamAnim->_lightSprite)._color._colorize[2] = 0.0; - (beamAnim->_lightSprite)._color._colorize[3] = 0.0; - (beamAnim->_lightSprite)._color._offset[2] = 0.0; - } - local_118.y = renderOffset.y + (float)dVar7 / local_110; - local_118.x = renderOffset.x + local_ec; - if ((beamAnim->_lightSprite)._loaded != 0) { - if ((beamAnim->_lightSprite)._overlayRenderFirst == 0) { - AnimationState::Render - (&(beamAnim->_lightSprite)._animState,&local_118,&g_vectorZero,&g_vectorZero); - beamAnim = &(beamAnim->_lightSprite)._overlayAnimState; - } - else { - AnimationState::Render - (&(beamAnim->_lightSprite)._overlayAnimState,&local_118,&g_vectorZero,&g_vectorZero - ); - beamAnim = &(beamAnim->_lightSprite)._animState; - } - AnimationState::Render(beamAnim,&local_118,&g_vectorZero,&g_vectorZero); - } - } - this = beamAnim; - if ((g_manager->_optionsConfig)._enableCaustics != 0) { - if (g_game->_darknessModifier <= 0.0) { - uVar5 = g_game->_debugCurses; - uVar3 = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - this = room; - if ((~preventedCurses & (forcedCurses | uVar5 | uVar3) & 1) == 0) goto LAB_0080f17b; - } - render_water(this,1); - } -LAB_0080f17b: - _glfw_context_reset(); - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - targetEntry = msvc::deque::back(); - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget((void *)*targetEntry,*GHIDRA_CAST((targetEntry + 1))); - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } -LAB_0080f1ce: - render_darkness_overlay(this); - if ((*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x11f6))) == '\x01') { - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x11f6))) = 0; - render_lava_pit_mask(this); - } - render_water(this); - return; -} - -// 0080f200 -void Room::Render() -{ - Room *rock = this; - std_set *psVar1; - code *pcVar2; - RoomDescriptor *pRVar3; - uint8_t bVar4; - char cVar5; - uint32_t uVar6; - uint32_t *stageType; - void *pvVar8; - uint32_t forcedCurses; - uint32_t preventedCurses; - LayerState *layer; - int *extraout_EAX; - int *extraout_EAX_00; - ColorMod *color; - int *piVar9; - int *extraout_EAX_01; - ColorMod *color_00; - int iVar10; - Game *pGVar11; - ColorMod *color_01; - int *extraout_EAX_02; - int *extraout_EAX_03; - int *extraout_EAX_04; - ColorMod *color_02; - uint8_t *shader; - ColorMod *color_03; - KColor *input; - float *pfVar12; - AnimationState *this_00; - int unusedArg; - KColor *color_04; - int unused; - int unusedArg_00; - int unusedArg_01; - KColor *color_05; - int unused_00; - int unusedArg_02; - int iVar13; - int iVar14; - KColor *color_06; - int unusedArg_03; - int unusedArg_04; - KColor *color_07; - int unusedArg_05; - KColor *color_08; - KColor *color_09; - int *extraout_ECX; - int *extraout_ECX_00; - int unused_01; - int unused_02; - int extraout_ECX_01; - KColor *color_10; - int unused_03; - int unused_04; - int unused_05; - int extraout_ECX_02; - KColor *color_11; - int unused_06; - int unused_07; - int extraout_ECX_03; - KColor *blackChannel; - void **ppvVar15; - short *this_01; - Room *room; - bool bVar16; - float fVar17; - float backdropY; - Game *pGVar18; - float backdropX; - double dVar19; - Vector *pVVar20; - void *pvVar21; - uint8_t auStack_2d2 [2]; - uint8_t screenQuad [112]; - Color nightLightColor; - Vector renderOffset; - Vector local_224; - Vector local_21c; - Game *local_214; - Game *local_210; - Game *local_20c; - uint8_t isDataminer; - char isMineshaftDimension; - char isBeastWaterSurface; - Game *local_204; - Game *local_200; - Vector local_1f8; - Game *local_1f0; - char isWaterSurface; - Game *local_1e4; - Game *local_1e0; - char isRenderingToScreen; - Game *local_1d4; - std_string stageName; - uint8_t local_1b8 [28]; - float fStack_19c; - float fStack_198; - float fStack_194; - float local_190; - Color shaderColor; - uint8_t *roomTypeNames; - char *local_15c; - uint8_t *local_158; - char *local_154; - char *local_150; - uint8_t *local_14c; - char *local_148; - char *local_144; - char *local_140; - char *local_13c; - char *local_138; - char *local_134; - char *local_130; - char *local_12c; - char *local_128; - char *local_124; - char *local_120; - char *local_11c; - char *local_118; - char *local_114; - char *local_110; - uint8_t *local_10c; - char *local_108; - uint8_t *local_104; - char *local_100; - char *local_fc; - char *local_f8; - char *local_f4; - uint8_t *local_f0; - char *local_ec; - KColor local_e8; - Game *local_d0; - Game *pGStack_cc; - Game *pGStack_c8; - Vector VStack_c4; - uint8_t local_bc [16]; - Game *local_ac; - uint8_t debugText [132]; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint32_t curses; - Manager *manager; - GridEntity_Rock *rock; - float stageType; - - pGVar18 = g_game; - puStack_20 = debugText + 0xa4; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0154b; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT((debugText + 0x98)); - ExceptionList = &local_1c; - local_210 = GHIDRA_CAST(0x4e); - local_200 = GHIDRA_CAST(rock); - msvc::set::find_node(); - DAT_00c79a4c = 1.0; - if (((*GHIDRA_CAST((GHIDRA_CAST(local_1f8.y) + 0xd)) != '\0') || (0x4e < *GHIDRA_CAST((GHIDRA_CAST(local_1f8.y) + 0x10)))) || - ((void *)local_1f8.y == (pGVar18->_seedEffects)._seedEffects)) { - iVar14 = pGVar18->_pixelationTimer; - if (iVar14 < 1) { - DAT_00c79a4c = 0.0; - } - else if (pGVar18->_pixelationDuration + -0xf < iVar14) { - DAT_00c79a4c = (float)(pGVar18->_pixelationDuration - iVar14) / 15.0; - } - else if (iVar14 < 0xf) { - DAT_00c79a4c = (float)iVar14 / 15.0; - } - } - isDataminer = (GHIDRA_CAST((&rock->_temporaryEffects)))->TemporaryEffects::HasCollectibleEffect(0x1e1); - if (isDataminer != 0) { - DAT_00c7977f = 1; - } - if ((rock->_backdropType == 0xb) && - ((g_manager->_optionsConfig)._getsSetToEnableWaterSurface != 0)) { - local_20c = GHIDRA_CAST(pGVar18->_dizzyIntensity); - isWaterSurface = '\x01'; - } - else { - local_20c = GHIDRA_CAST(pGVar18->_dizzyIntensity); - isWaterSurface = '\0'; - if ((rock->_backdropType == 0x39) && - (isWaterSurface = '\0', (g_manager->_optionsConfig)._getsSetToEnableWaterSurface != 0)) { - isBeastWaterSurface = '\x01'; - isWaterSurface = '\0'; - goto LAB_0080f352; - } - } - isBeastWaterSurface = '\0'; -LAB_0080f352: - local_210 = local_20c; - if (((pGVar18->_currentDimensionIdx == 1) && - ((pGVar18->_stageType == 4 || (pGVar18->_stageType == 5)))) && - ((pGVar18->_stage == 2 || - ((pGVar18->_stage == 1 && (uVar6 = Level::GetCurses(GHIDRA_CAST(pGVar18)), (uVar6 & 2) != 0)))))) - { - isMineshaftDimension = '\x01'; - local_1f8.x = 0.0; - local_1f8.y = 0.0; - msvc::vector::resize(&local_1f8); - stageType = msvc::deque::back(); - if (GHIDRA_CAST((stageType + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((stageType + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *stageType = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c79854,1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - isRenderingToScreen = '\0'; - } - else { - isMineshaftDimension = '\0'; - isRenderingToScreen = '\x01'; - } - if (0.0 < (float)local_20c) { - local_1f8.x = 0.0; - local_1f8.y = 0.0; - msvc::vector::resize(&local_1f8); - stageType = msvc::deque::back(); - if (GHIDRA_CAST((stageType + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((stageType + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *stageType = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c797fc,1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - isRenderingToScreen = '\0'; - } - if (((g_manager->_optionsConfig)._enableShockwave != 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70d8)))) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70dc)))) || - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70f4)))) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70f8)))))))) { - local_1f8.x = 0.0; - local_1f8.y = 0.0; - msvc::vector::resize(&local_1f8); - stageType = msvc::deque::back(); - if (GHIDRA_CAST((stageType + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((stageType + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *stageType = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c797d4,1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - isRenderingToScreen = '\0'; - } - if (isWaterSurface != '\0') { - local_1f8.x = 0.0; - local_1f8.y = 0.0; - msvc::vector::resize(&local_1f8); - stageType = msvc::deque::back(); - if (GHIDRA_CAST((stageType + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((stageType + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *stageType = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c797e4,1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - isRenderingToScreen = '\0'; - } - if (isBeastWaterSurface != '\0') { - local_1f8.x = 0.0; - local_1f8.y = 0.0; - msvc::vector::resize(&local_1f8); - stageType = msvc::deque::back(); - if (GHIDRA_CAST((stageType + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((stageType + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *stageType = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c7984c,1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - isRenderingToScreen = '\0'; - } - if (rock->_backdropType == 0x39) { - render_beast_arena_background(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x776c))),0); - } - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - local_1f8.y = (float)&rock->_fxLayers; - FXLayers::render_behind_layers(); - stageType = 2.0; - if (isRenderingToScreen != '\0') { - if (rock->_backdropType == 0x1c) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x18))) = 0.2784314; - fStack_19c = 0.18039216; - fStack_198 = 0.101960786; - fStack_194 = 1.0; - local_190 = 0.0; - backdropX = (rock->_renderSurfaceTopLeft).x + (g_game->_screenShakeOffset).x + - (rock->_renderScrollOffset).x; - backdropY = (rock->_renderSurfaceTopLeft).y + (g_game->_screenShakeOffset).y + - (rock->_renderScrollOffset).y; - fVar17 = (float)rock->_gridWidth - 2.0; - stageType = (float)rock->_gridHeight - 2.0; -LAB_0080f949: - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0xc))) = fVar17 * 26.0; - local_ac = GHIDRA_CAST((stageType * 26.0)); - VStack_c4.y = backdropY + 52.0; - VStack_c4.x = backdropX + 52.0; - render_quad_set_rect - (screenQuad,&VStack_c4,GHIDRA_CAST((local_bc + 0xc)),GHIDRA_CAST((local_1b8 + 0x18))); - render_color_shader_pass(screenQuad); - } - else { - (GHIDRA_CAST((&local_e8)))->KColor::SetFromARGB(0xff000000); - Color::apply_to_kcolor(GHIDRA_CAST((local_1b8 + 0x18)),&rock->_floorColor,input); - (GHIDRA_CAST((&local_e8)))->KColor::SetFromARGB(0xff000000); - pfVar12 = GHIDRA_CAST((local_1b8 + 0x18)); - uVar6 = 0xc; - blackChannel = &local_e8; - do { - if (*pfVar12 != blackChannel->_red) { - fVar17 = (float)rock->_gridWidth - stageType; - backdropX = (g_game->_screenShakeOffset).x + (rock->_renderSurfaceTopLeft).x + - (rock->_renderScrollOffset).x; - backdropY = (g_game->_screenShakeOffset).y + (rock->_renderSurfaceTopLeft).y + - (rock->_renderScrollOffset).y; - stageType = (float)rock->_gridHeight - stageType; - goto LAB_0080f949; - } - pfVar12 = pfVar12 + 1; - blackChannel = GHIDRA_CAST(&blackChannel->_green); - bVar16 = 3 < uVar6; - uVar6 = uVar6 - 4; - } while (bVar16); - } - } - if (((g_manager->_optionsConfig)._enableShockwave == 0) && - ((local_1d4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70d8)))), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70d8)))) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70dc)))) || - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70f4)))) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x70f8)))))))) { - local_1f0 = GHIDRA_CAST(0x2); - do { - local_1e4 = *GHIDRA_CAST(local_1d4); - local_204 = *GHIDRA_CAST((GHIDRA_CAST(local_1d4) + 4)); - pGVar18 = local_1d4; - if ((GHIDRA_INT(local_1e4) < GHIDRA_INT(local_204)) && - (((rock->_backdropType == 0x12 || (rock->_backdropType == 0x1c)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x4)))) + 0x44)) & 1) == 0)))) { - pvVar8 = ANM2::GetAnimationData(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7100)))),s_Idle); - local_1e4 = GHIDRA_CAST(GHIDRA_INT(((float)*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x30)) * - ((float)GHIDRA_INT(local_1e4) / (float)GHIDRA_INT(local_204))))); - bVar4 = ANM2::SetAnimation(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7100)))),s_Idle,1); - if (((bVar4 != 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7134)))) != 0)) && - (AnimationState::SetFrameFloat - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7130)))),(float)GHIDRA_INT(local_1e4)), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7134)))) != 0)) { - (*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7144))) = 0; - } - pGVar18 = local_1d4; - pfVar12 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + -0x14)); - local_204 = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(local_1d4) + -0x10)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5)); - local_1d4 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_1e4 = GHIDRA_CAST((((*pfVar12 - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * - (float)local_1d4 + 0.5)); - dVar19 = floor((double)(float)local_1e4); - local_1e0 = GHIDRA_CAST(((float)dVar19 / (float)local_1d4)); - local_1e4 = GHIDRA_CAST(((float)local_204 * (float)local_1d4 + 0.5)); - dVar19 = floor((double)(float)local_1e4); - local_1e4 = GHIDRA_CAST((float)dVar19); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0xc))) = (float)local_1e0 + (rock->_renderScrollOffset).x; - local_ac = GHIDRA_CAST(((float)local_1e4 / (float)local_1d4 + (rock->_renderScrollOffset).y)); - if ((*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7209))) != '\0') { - if ((*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7170))) == '\0') { - AnimationState::Render - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7130)))),GHIDRA_CAST((local_bc + 0xc)), - &g_vectorZero,&g_vectorZero); - this_00 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7150)))); - } - else { - AnimationState::Render - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7150)))),GHIDRA_CAST((local_bc + 0xc)), - &g_vectorZero,&g_vectorZero); - this_00 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x7130)))); - } - AnimationState::Render(this_00,GHIDRA_CAST((local_bc + 0xc)),&g_vectorZero,&g_vectorZero); - } - } - local_1d4 = GHIDRA_CAST((GHIDRA_INT(pGVar18) + 0x1c)); - local_1f0 = GHIDRA_CAST((GHIDRA_INT(local_1f0) + -1)); - } while (local_1f0 != GHIDRA_CAST(0x0)); - local_1f0 = GHIDRA_CAST(0x0); - } - local_1e4 = GHIDRA_CAST(g_graphicsManager_blendMode[4]); - local_e8._red = (float)g_graphicsManager_blendMode[0]; - local_e8._green = (float)g_graphicsManager_blendMode[1]; - local_e8._blue = (float)g_graphicsManager_blendMode[2]; - local_e8._alpha = (float)g_graphicsManager_blendMode[3]; - if ((rock->_waterAmount <= 0.0) || ((g_manager->_optionsConfig)._enableWaterSurface == 0)) { - isRenderingToScreen = '\0'; - } - else { - isRenderingToScreen = '\x01'; - } - pGVar18 = GHIDRA_CAST(&rock->_renderScrollOffset); - renderOffset.y = - (rock->_renderSurfaceTopLeft).y + (g_game->_screenShakeOffset).y + - (rock->_renderScrollOffset).y; - renderOffset.x = - (g_game->_screenShakeOffset).x + (rock->_renderSurfaceTopLeft).x + (GHIDRA_CAST(pGVar18))->x; - local_204 = pGVar18; - if (isRenderingToScreen == '\0') { - local_1f0 = GHIDRA_CAST(&rock->_entityList); - (rock->_entityList)._renderCursor = 0; - (rock->_entityList)._renderMode = 1; - if (rock->_roomType == 0x10) { - local_1d4 = GHIDRA_CAST(0x0); - if (0 < rock->_gridHeight * rock->_gridWidth) { - local_1e0 = GHIDRA_CAST(rock->_gridEntities); - do { - if (*GHIDRA_CAST(local_1e0) != GHIDRA_CAST(0x0)) { - (**(code **)(**GHIDRA_CAST(local_1e0) + 0xc))(); - } - local_1e0 = GHIDRA_CAST((GHIDRA_INT(local_1e0) + 4)); - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - } while (GHIDRA_INT(local_1d4) < rock->_gridHeight * rock->_gridWidth); - } - } - else { - Backdrop::RenderFloor - (&renderOffset,(rock->_floorColor)._tint[0],(rock->_floorColor)._tint[1], - (rock->_floorColor)._tint[2],(rock->_floorColor)._tint[3], - (rock->_floorColor)._colorize[0],(rock->_floorColor)._colorize[1], - (rock->_floorColor)._colorize[2],(rock->_floorColor)._colorize[3], - (rock->_floorColor)._offset[0]); - if ((*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x1be8))) != '\0') { - Backdrop::render_floor_surface - (&renderOffset,(rock->_floorColor)._tint[0],(rock->_floorColor)._tint[1], - (rock->_floorColor)._tint[2],(rock->_floorColor)._tint[3], - (rock->_floorColor)._colorize[0],(rock->_floorColor)._colorize[1], - (rock->_floorColor)._colorize[2],(rock->_floorColor)._colorize[3], - (rock->_floorColor)._offset[0]); - } - FXLayers::render_veins(); - local_1d4 = GHIDRA_CAST(0x0); - if (0 < rock->_gridHeight * rock->_gridWidth) { - local_1e0 = GHIDRA_CAST(rock->_gridEntities); - do { - piVar9 = *GHIDRA_CAST(local_1e0); - if ((piVar9 != GHIDRA_CAST(0x0)) && (piVar9[1] == 1)) { - (**(code **)(*piVar9 + 0xc))(); - } - local_1e0 = GHIDRA_CAST((GHIDRA_INT(local_1e0) + 4)); - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - } while (GHIDRA_INT(local_1d4) < rock->_gridHeight * rock->_gridWidth); - } - } - (GHIDRA_CAST((&rock->_entityList)))->EntityList::render_up_to(5000,GHIDRA_CAST(pGVar18)); - if (rock->_backdropType == 0x39) { - render_beast_arena_background(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x776c))),1); - } - } - else { - render_water_shader(rock,&renderOffset); - local_1f0 = GHIDRA_CAST(&rock->_entityList); - (rock->_entityList)._renderCursor = 0; - (rock->_entityList)._renderMode = 3; - (GHIDRA_CAST((GHIDRA_CAST(local_1f0))))->EntityList::render_up_to(5000,GHIDRA_CAST(pGVar18)); - } - if (rock->_roomType != 0x10) { - Backdrop::RenderWalls(GHIDRA_CAST(&rock->_backdrop),&renderOffset,rock->_wallColor); - if (((g_manager->_optionsConfig)._enableCaustics != 0) && (g_game->_darknessModifier <= 0.0)) { - uVar6 = g_game->_debugCurses; - curses = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - if ((~preventedCurses & (forcedCurses | uVar6 | curses) & 1) == 0) { - set_blend_mode(&DAT_00c798e0,2); - rock = GHIDRA_CAST(local_200); - render_water(GHIDRA_CAST(local_200),0); - g_graphicsManager_blendMode[0] = GHIDRA_INT(local_e8._red); - g_graphicsManager_blendMode[1] = GHIDRA_INT(local_e8._green); - g_graphicsManager_blendMode[2] = GHIDRA_INT(local_e8._blue); - g_graphicsManager_blendMode[3] = GHIDRA_INT(local_e8._alpha); - g_graphicsManager_blendMode[4] = GHIDRA_INT(local_1e4); - pGVar18 = GHIDRA_CAST(&(GHIDRA_CAST(rock))->_roomList[0x18].DeliriumDistance); - } - else { - rock = GHIDRA_CAST(local_200); - pGVar18 = local_204; - } - } - if (isRenderingToScreen == '\0') { - local_1e4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(rock))->_roomList[0xa1])) + 0x9c)))); - (GHIDRA_CAST((GHIDRA_CAST(local_1e4))))->RailManager::Render(GHIDRA_CAST(pGVar18)); - local_1d4 = GHIDRA_CAST(0x0); - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(rock)))) + 0x10)))) * (GHIDRA_CAST(rock))->_curses) { - local_1e0 = GHIDRA_CAST(&(GHIDRA_CAST(rock))->_roomList[0].Data); - do { - piVar9 = *GHIDRA_CAST(local_1e0); - if ((piVar9 != GHIDRA_CAST(0x0)) && - ((iVar14 = piVar9[1], iVar14 == 7 || - ((iVar14 != 0x10 && - (((iVar14 == 0x11 || (iVar14 == 0x12)) || ((iVar14 == 0xe && (piVar9[3] == 1000)))))) - )))) { - (**(code **)(*piVar9 + 0xc))(); - } - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - local_1e0 = GHIDRA_CAST((GHIDRA_INT(local_1e0) + 4)); - } while (GHIDRA_INT(local_1d4) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(rock)))) + 0x10)))) * (GHIDRA_CAST(rock))->_curses); - } - if (((GHIDRA_CAST(rock))->_roomList[0x28].Flags == 0x20) && - ((*GHIDRA_CAST(((GHIDRA_CAST(rock))->_stageType + 0x44)) >> 5 & 1) != 0)) { - render_water_overlay(rock,&renderOffset); - local_1d4 = GHIDRA_CAST(0x0); - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(rock)))) + 0x10)))) * (GHIDRA_CAST(rock))->_curses) { - local_1e0 = GHIDRA_CAST(&(GHIDRA_CAST(rock))->_roomList[0].Data); - do { - pvVar8 = *(void **)local_1e0; - if ((pvVar8 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 4)) == 7)) { - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(pvVar8) + 0x40)),GHIDRA_CAST(0x0)); - layer->_visible = 0; - (**(code **)(**GHIDRA_CAST(local_1e0) + 0xc))(); - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(*(void **))local_1e0 + 0x40)),GHIDRA_CAST(0x0)); - layer->_visible = 1; - } - local_1e0 = GHIDRA_CAST((GHIDRA_INT(local_1e0) + 4)); - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - } while (GHIDRA_INT(local_1d4) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(rock)))) + 0x10)))) * (GHIDRA_CAST(rock))->_curses); - } - } - render_pit_rails(GHIDRA_CAST(local_1e4)); - } - } - pVVar20 = GHIDRA_CAST(0x2710); - (GHIDRA_CAST((GHIDRA_CAST(local_1f0))))->EntityList::render_up_to(10000,GHIDRA_CAST(pGVar18)); - if (isBeastWaterSurface != '\0') { - _glfw_context_reset(); - pop_render_target(); - (GHIDRA_CAST((local_1b8 + 0x18)))->BlendMode::SetMode(1,unusedArg); - g_graphicsManager_blendMode[0] = *extraout_EAX; - g_graphicsManager_blendMode[1] = extraout_EAX[1]; - g_graphicsManager_blendMode[2] = extraout_EAX[2]; - g_graphicsManager_blendMode[3] = extraout_EAX[3]; - g_graphicsManager_blendMode[4] = extraout_EAX[4]; - shaderColor._colorize[2] = 0.0; - shaderColor._tint[2] = 0.0; - shaderColor._colorize[1] = 0.0; - shaderColor._tint[3] = 0.0; - shaderColor._offset[0] = 1.0; - shaderColor._colorize[0] = 1.0; - shaderColor._offset[1] = 1.0; - shaderColor._colorize[3] = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(shaderColor._offset[2])) + 0x0))) = 0; - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - render_quad_set_uniform_color(screenQuad,0.0,0.0,g_screenWidth,g_screenHeight,color_04); - pGVar18 = g_game; - shader = &DAT_00c79618; - if ((DAT_00c7961c & 1) == 0) { - shader = g_currentShader; - } - local_21c.y = (float)((double)DAT_00c7984c[7] + - __uint_to_double_fixup[-(DAT_00c7984c[7] >> 0x1f)]); - local_224.y = (float)((double)DAT_00c7984c[6] + - __uint_to_double_fixup[-(DAT_00c7984c[6] >> 0x1f)]); - VStack_c4.y = local_224.y / (g_screenPointScale * 1024.0); - local_ac = GHIDRA_CAST((local_21c.y / (g_screenPointScale * 1024.0))); - local_1d4 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_1e0 = GHIDRA_CAST(((g_screenHeight - 182.0) * 0.5)); - local_1e4 = GHIDRA_CAST(((((float)local_200->_roomList[0].GridIndex - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_1d4 + 0.5)); - g_currentShader = shader; - dVar19 = floor((double)(float)local_1e4); - local_214 = GHIDRA_CAST((float)dVar19); - local_1e4 = GHIDRA_CAST(((((float)local_200->_roomList[0].SafeGridIndex - 140.0) * 0.65 + - (float)local_1e0) * (float)local_1d4 + 0.5)); - iVar14 = GHIDRA_INT(((uint64_t)(double)(float)local_1e4 >> 0x20)); - dVar19 = floor((double)(float)local_1e4); - local_1e4 = GHIDRA_CAST((float)dVar19); - VStack_c4.x = (((float)local_204->_stage + (pGVar18->_screenShakeOffset).x + - (float)local_214 / (float)local_1d4) * g_screenPointScale) / local_224.y; - pGStack_cc = GHIDRA_CAST(VStack_c4.y); - VStack_c4.y = (((pGVar18->_screenShakeOffset).y + (float)local_204->_stageType + - (float)local_1e4 / (float)local_1d4) * g_screenPointScale) / local_21c.y; - pGStack_c8 = local_ac; - local_ac = GHIDRA_CAST(((float)(pGVar18->_frameCount % 0x3c) / 60.0)); - (GHIDRA_CAST((shader)))->Shader::set_uniform(GHIDRA_CAST("Ratio"),0xb,&pGStack_cc,iVar14); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Amount"),8,&local_ac,unused); - (**(code **)(*DAT_00c7984c + 0x14))(shaderColor._tint + 2); - pVVar20 = GHIDRA_CAST(0x81049f); - shader_cache_find(unusedArg_00); - } - pGVar18 = local_200; - if (local_200->_roomList[0x28].Flags == 0x39) { - pVVar20 = GHIDRA_CAST(0x8104bb); - render_beast_arena_background(&local_200->_roomList[0xa6].ListIndex,2); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar14)) + 0x0))) = pGVar18->_bossChallenge; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar14)) + 0x1))) = pGVar18->_devilRoomDisabled; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar14)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar18)) + 0xa)))); - if (iVar14 != 0x10) { - local_1d4 = GHIDRA_CAST(0x0); - if (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar18)) + 0x10)))) * pGVar18->_curses) { - ppvVar15 = &pGVar18->_roomList[0].Data; - do { - piVar9 = *ppvVar15; - if ((piVar9 != GHIDRA_CAST(0x0)) && (piVar9[1] == 0x10)) { - pVVar20 = GHIDRA_CAST(0x8104fa); - (**(code **)(*piVar9 + 0xc))(); - } - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - ppvVar15 = ppvVar15 + 1; - } while (GHIDRA_INT(local_1d4) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar18)) + 0x10)))) * pGVar18->_curses); - } - piVar9 = DAT_00c797bc; - if (DAT_00c797bc != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((local_1b8 + 0x18)))->BlendMode::SetMode(1,GHIDRA_INT(local_1d4)); - g_graphicsManager_blendMode[0] = *extraout_EAX_00; - g_graphicsManager_blendMode[1] = extraout_EAX_00[1]; - g_graphicsManager_blendMode[2] = extraout_EAX_00[2]; - g_graphicsManager_blendMode[3] = extraout_EAX_00[3]; - g_graphicsManager_blendMode[4] = extraout_EAX_00[4]; - pcVar2 = *(code **)(*piVar9 + 0x20); - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - pVVar20 = &renderOffset; - (*pcVar2)(); - } - shader_stack_push(0); - pvVar8 = (void *)0x8105a3; - (GHIDRA_CAST((&shaderColor)))->Color::Color(); - (GHIDRA_CAST((auStack_2d2 + -10)))->KAGE::SmartPointer::operator_assign(&DAT_00c797b4); - apply_sprite_shader_params(color,1,pVVar20,pvVar8); - local_190 = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x18))) = 1.0; - fStack_19c = 1.0; - fStack_198 = 1.0; - fStack_194 = 0.24; - (**(code **)(*DAT_00c797b4 + 0x20))(); - piVar9 = GHIDRA_CAST(FUN_00684fc0()); - pvVar8 = (void *)*piVar9; - if ((pvVar8 != (void *)0x0) && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 4)) & 1) != 0)) { - g_currentShader = pvVar8; - } - DAT_00c79770 = DAT_00c79770 + -1; - if (DAT_00c79770 == 0) { - DAT_00c7976c = 0; - } - } - FXLayers::render_background_layers(); - if (isWaterSurface != '\0') { - _glfw_context_reset(); - pop_render_target(); - (GHIDRA_CAST((local_1b8 + 0x18)))->BlendMode::SetMode(1,unusedArg_01); - g_graphicsManager_blendMode[0] = *extraout_EAX_01; - g_graphicsManager_blendMode[1] = extraout_EAX_01[1]; - g_graphicsManager_blendMode[2] = extraout_EAX_01[2]; - g_graphicsManager_blendMode[3] = extraout_EAX_01[3]; - g_graphicsManager_blendMode[4] = extraout_EAX_01[4]; - shaderColor._colorize[2] = 0.0; - shaderColor._tint[2] = 0.0; - shaderColor._colorize[1] = 0.0; - shaderColor._tint[3] = 0.0; - shaderColor._offset[0] = 1.0; - shaderColor._colorize[0] = 1.0; - shaderColor._offset[1] = 1.0; - shaderColor._colorize[3] = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(shaderColor._offset[2])) + 0x0))) = 0; - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - render_quad_set_uniform_color(screenQuad,0.0,0.0,g_screenWidth,g_screenHeight,color_05); - pGVar18 = g_game; - shader = &DAT_00c79578; - if ((DAT_00c7957c & 1) == 0) { - shader = g_currentShader; - } - local_214 = GHIDRA_CAST((float)((double)DAT_00c797e4[7] + - __uint_to_double_fixup[-(DAT_00c797e4[7] >> 0x1f)])); - local_224.y = (float)((double)DAT_00c797e4[6] + - __uint_to_double_fixup[-(DAT_00c797e4[6] >> 0x1f)]); - local_1e4 = GHIDRA_CAST((local_224.y / (g_screenPointScale * 1024.0))); - local_1e0 = GHIDRA_CAST(((float)local_214 / (g_screenPointScale * 1024.0))); - local_1d4 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - VStack_c4.y = (g_screenHeight - 182.0) * 0.5; - local_ac = GHIDRA_CAST(((((float)local_200->_roomList[0].GridIndex - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_1d4 + 0.5)); - g_currentShader = shader; - dVar19 = floor((double)(float)local_ac); - local_21c.y = (float)dVar19; - local_ac = GHIDRA_CAST(((((float)local_200->_roomList[0].SafeGridIndex - 140.0) * 0.65 + VStack_c4.y - ) * (float)local_1d4 + 0.5)); - iVar14 = GHIDRA_INT(((uint64_t)(double)(float)local_ac >> 0x20)); - dVar19 = floor((double)(float)local_ac); - VStack_c4.x = (((pGVar18->_screenShakeOffset).x + (float)local_204->_stage + - local_21c.y / (float)local_1d4) * g_screenPointScale) / local_224.y; - pGStack_cc = local_1e4; - VStack_c4.y = (((pGVar18->_screenShakeOffset).y + (float)local_204->_stageType + - (float)dVar19 / (float)local_1d4) * g_screenPointScale) / (float)local_214; - pGStack_c8 = local_1e0; - local_ac = GHIDRA_CAST(((float)(pGVar18->_frameCount % 0x3c) / 60.0)); - (GHIDRA_CAST((shader)))->Shader::set_uniform(GHIDRA_CAST("Ratio"),0xb,&pGStack_cc,iVar14); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Amount"),8,&local_ac,unused_00); - (**(code **)(*DAT_00c797e4 + 0x14))(shaderColor._tint + 2); - shader_cache_find(unusedArg_02); - pGVar18 = local_200; - } - (GHIDRA_CAST((&shaderColor)))->Color::Color(); - (GHIDRA_CAST((GHIDRA_CAST((pGVar18->_roomList[0x99]._doors + 6)))))->Sprite::SetColor(color_00); - iVar14 = *GHIDRA_CAST(&pGVar18->_roomList[0x9f].ShopItemIdx); - this_01 = &pGVar18->_roomList[0x9f].ShopItemIdx; - FID_conflict__Erase_tree_>_> - (this_01,(fuzzer_allocator_> *)this_01, - *(_Tree_node **)(iVar14 + 4)); - room = GHIDRA_CAST(local_200); - *GHIDRA_CAST((iVar14 + 4)) = iVar14; - *GHIDRA_CAST(iVar14) = iVar14; - *GHIDRA_CAST((iVar14 + 8)) = iVar14; - pGVar18->_roomList[0x9f].DeliriumDistance = 0; - local_1d4 = GHIDRA_CAST(0x0); - pRVar3 = local_200->_roomList; - if (local_200->_roomList[0x19].DecorationSeed != 0) { - do { - render_player_light(room,*(Entity_Player **) - (*GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x19].PoopCount) + - GHIDRA_INT(local_1d4) * 4),GHIDRA_CAST(&pRVar3[0x18].DeliriumDistance)); - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - } while (local_1d4 < GHIDRA_UINT((GHIDRA_CAST(room))->_roomList[0x19].DecorationSeed)); - } - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar10)) + 0x0))) = (GHIDRA_CAST(room))->_bossChallenge; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar10)) + 0x1))) = (GHIDRA_CAST(room))->_devilRoomDisabled; - (*GHIDRA_CAST((GHIDRA_CAST(&(iVar10)) + 0x2))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(room)))) + 0xa)))); - if (iVar10 != 0x10) { - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(room)))) + 0x10)))); - iVar14 = (GHIDRA_CAST(room))->_curses; - local_1d4 = GHIDRA_CAST(0x0); - if (0 < iVar10 * iVar14) { - local_1e0 = GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0].Data); - do { - local_ac = *GHIDRA_CAST(local_1e0); - if ((((((local_ac != GHIDRA_CAST(0x0)) && - (stageType = (float)local_ac->_stageType, stageType != 1.4013e-45)) && - (stageType != 9.80909e-45)) && - ((stageType != 2.24208e-44 && (stageType != 2.38221e-44)))) && - ((stageType != 2.52234e-44 && - ((stageType != 1.96182e-44 || (local_ac->_curses != 1000)))))) && - ((isRenderingToScreen == '\0' || - ((**(code **)(local_ac->_stage + 0x18))(), (GHIDRA_UINT(VStack_c4.x) & 2) == 0)))) { - (**(code **)(local_ac->_stage + 0xc))(); - } - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(room)))) + 0x10)))); - iVar14 = (GHIDRA_CAST(room))->_curses; - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - local_1e0 = GHIDRA_CAST((GHIDRA_INT(local_1e0) + 4)); - } while (GHIDRA_INT(local_1d4) < iVar10 * iVar14); - } - local_1e0 = GHIDRA_CAST(0x2710); - local_1d4 = GHIDRA_CAST(0x0); - if (0 < iVar10) { - VStack_c4.y = 10000.0; - do { - if (((iVar14 < 1) || (GHIDRA_INT(local_1d4) < 0)) || (iVar10 <= GHIDRA_INT(local_1d4))) { - iVar10 = -1; - } - else { - iVar10 = GHIDRA_INT(local_1d4) * iVar14; - } - local_ac = GHIDRA_CAST((((float)(iVar10 / iVar14) * 40.0 + 120.0 + 20.0) * 100.0 + 10030.0 + 0.5 - )); - dVar19 = floor((double)(float)local_ac); - local_ac = GHIDRA_CAST((float)dVar19); - local_1e0 = GHIDRA_CAST(__ftoui3()); - EntityList::render_up_to - (GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x19].Dimension),GHIDRA_UINT(local_1e0), - GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance)); - iVar14 = (GHIDRA_CAST(room))->_curses; - iVar10 = 0; - if (0 < iVar14) { - do { - if (((((-1 < iVar10) && (iVar10 < iVar14)) && - ((-1 < GHIDRA_INT(local_1d4) && - ((GHIDRA_INT(local_1d4) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(room)))) + 0x10)))) && - (iVar13 = GHIDRA_INT(local_1d4) * iVar14 + iVar10, -1 < iVar13)))))) && - (rock = GHIDRA_CAST((GHIDRA_CAST(room))->_roomMap[iVar13 + -0x5eae]), - rock != GHIDRA_CAST(0x0))) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x4)))) == 0x18)) { - GridEntity_Rock::RenderTop - (rock,GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance)); - iVar14 = (GHIDRA_CAST(room))->_curses; - } - iVar10 = iVar10 + 1; - } while (iVar10 < iVar14); - } - iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(room)))) + 0x10)))); - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 1)); - } while (GHIDRA_INT(local_1d4) < iVar10); - } - EntityList::render_up_to - (GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x19].Dimension), - GHIDRA_UINT(&local_1e0->_roomList[0x1b].Dimension), - GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance)); - } - if (isRenderingToScreen != '\0') { - (GHIDRA_CAST(room))->_roomList[0x19].DeliriumDistance = 1; - } - pVVar20 = GHIDRA_CAST(0xffffffff); - EntityList::render_up_to - (GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x19].Dimension),0xffffffff, - GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance)); - pGVar18 = local_1f0; - uVar6 = 0; - pGVar11 = GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x19].Dimension); - if (*GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x19].ShopItemIdx) != 0) { - do { - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(pGVar18) + 0x50))))) + 0x4)))) + - uVar6 * 4)) + 0x1c))(); - uVar6 = uVar6 + 1; - } while (uVar6 < GHIDRA_UINT(*GHIDRA_CAST((GHIDRA_CAST(pGVar18) + 0xa0)))); - pGVar11 = local_1f0; - room = GHIDRA_CAST(local_200); - } - pGVar18 = g_game; - (GHIDRA_CAST(pGVar11))->_renderMode = 0; - local_1d4 = GHIDRA_CAST(0x0); - if (GHIDRA_INT((pGVar18->_playerManager)._extraPlayers._end) - - GHIDRA_INT((pGVar18->_playerManager)._extraPlayers._begin) >> 2 != 0) { - do { - pVVar20 = GHIDRA_CAST(0x810d10); - (**(code **)(**GHIDRA_CAST((GHIDRA_INT((pGVar18->_playerManager)._extraPlayers._begin) + - GHIDRA_INT(local_1d4) * 4)) + 0x14))(); - local_1d4 = GHIDRA_CAST((GHIDRA_INT(&local_1d4->_stage) + 1)); - pGVar18 = g_game; - } while (local_1d4 < - (uint8_t *) - (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - - GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) >> 2)); - room = GHIDRA_CAST(local_200); - } - local_1f0 = GHIDRA_CAST(0x0); - if (GHIDRA_INT((pGVar18->_playerManager)._playerList._end) - - GHIDRA_INT((pGVar18->_playerManager)._playerList._begin) >> 2 != 0) { - do { - pvVar8 = (pGVar18->_playerManager)._playerList._end; - stageType = (pGVar18->_playerManager)._playerList._begin; - if (GHIDRA_INT(pvVar8) - GHIDRA_INT(stageType) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar8 = (pGVar18->_playerManager)._playerList._end; - stageType = (pGVar18->_playerManager)._playerList._begin; - } - pGVar18 = local_1f0; - if (local_1f0 < GHIDRA_CAST((GHIDRA_INT(pvVar8) - GHIDRA_INT(stageType) >> 2))) { - stageType = stageType + GHIDRA_INT(local_1f0); - } - pVVar20 = GHIDRA_CAST(0x1a9); - bVar4 = (GHIDRA_CAST((GHIDRA_CAST(*stageType))))->Entity_Player::HasCollectible(0x1a9,0); - if (bVar4 != 0) { - local_ac = g_game; - pvVar8 = (g_game->_playerManager)._playerList._end; - piVar9 = (g_game->_playerManager)._playerList._begin; - if (GHIDRA_INT(pvVar8) - GHIDRA_INT(piVar9) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar8 = (local_ac->_playerManager)._playerList._end; - piVar9 = (local_ac->_playerManager)._playerList._begin; - } - if (pGVar18 < GHIDRA_CAST((GHIDRA_INT(pvVar8) - GHIDRA_INT(piVar9) >> 2))) { - piVar9 = piVar9 + GHIDRA_INT(pGVar18); - } - (GHIDRA_CAST(room))->_roomList[0x9b].SavedEntities._capacity = - (void *)(*GHIDRA_CAST((*piVar9 + 0x1ae4)) - 90.0); - (GHIDRA_CAST((&nightLightColor)))->Color::Reset(); - psVar1 = &(GHIDRA_CAST(room))->_roomList[0x9b].RestrictedGridIndexes; - nightLightColor._offset[0] = 0.0; - nightLightColor._offset[1] = 0.0; - nightLightColor._offset[2] = 0.0; - if (GHIDRA_CAST(psVar1) != &nightLightColor) { - psVar1->_head = (void *)0x3f800000; - (GHIDRA_CAST(room))->_roomList[0x9b].RestrictedGridIndexes._size = 0x3f800000; - (GHIDRA_CAST(room))->_roomList[0x9b].SavedEffects._begin = (void *)0x3f800000; - (GHIDRA_CAST(room))->_roomList[0x9b].SavedEffects._end = (void *)0x3e4ccccd; - (GHIDRA_CAST(room))->_roomList[0x9b].SavedEffects._capacity = - (void *)nightLightColor._colorize[0]; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x9b])) + 0x94)))) = nightLightColor._colorize[1]; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x9b])) + 0x98)))) = nightLightColor._colorize[2]; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x9b])) + 0x9c)))) = nightLightColor._colorize[3]; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x9b])) + 0xa0)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x9b])) + 0xa8)))) = 0; - } - uVar6 = g_graphicsManager_flags; - layer = ANM2::GetLayer(GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x9a].SavedEffects._capacity), - GHIDRA_CAST(0x0)); - pGVar18 = g_game; - iVar14 = 1; - if ((uVar6 & 4) == 0) { - iVar14 = 6; - } - layer->_blendMode[0] = 0; - layer->_blendMode[1] = iVar14; - layer->_blendMode[2] = 1; - layer->_blendMode[3] = 1; - layer->_blendMode[4] = 1; - pvVar8 = (pGVar18->_playerManager)._playerList._end; - piVar9 = (pGVar18->_playerManager)._playerList._begin; - if (GHIDRA_INT(pvVar8) - GHIDRA_INT(piVar9) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar8 = (pGVar18->_playerManager)._playerList._end; - piVar9 = (pGVar18->_playerManager)._playerList._begin; - } - pGVar18 = local_1f0; - if (local_1f0 < GHIDRA_CAST((GHIDRA_INT(pvVar8) - GHIDRA_INT(piVar9) >> 2))) { - piVar9 = piVar9 + GHIDRA_INT(local_1f0); - } - local_1d4 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - VStack_c4.y = (*GHIDRA_CAST((*piVar9 + 0x340)) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5; - local_ac = GHIDRA_CAST(((float)local_1d4 * - ((*GHIDRA_CAST((*piVar9 + 0x33c)) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) + 0.5)); - dVar19 = floor((double)(float)local_ac); - local_21c.y = (float)dVar19 / (float)local_1d4; - local_ac = GHIDRA_CAST(((float)local_1d4 * VStack_c4.y + 0.5)); - dVar19 = floor((double)(float)local_ac); - local_ac = GHIDRA_CAST((float)dVar19); - pVVar20 = &g_vectorZero; - local_224.x = local_21c.y + (GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance))->x - ; - local_224.y = (float)local_ac / (float)local_1d4 + - (float)(GHIDRA_CAST(room))->_roomList[0x18].Group; - ANM2::Render(GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x9a].SavedEffects._capacity),&local_224, - &g_vectorZero,&g_vectorZero); - } - local_1f0 = GHIDRA_CAST((GHIDRA_INT(&pGVar18->_stage) + 1)); - pGVar18 = g_game; - } while (local_1f0 < - (uint8_t *) - (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)); - } - if ((GHIDRA_UINT(pGVar18->_debugFlags) >> 1 & 1) != 0) { - pVVar20 = GHIDRA_CAST(0x8110b2); - render_debug_grid_values(room,GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance)); - pGVar18 = g_game; - } - if ((GHIDRA_UINT(pGVar18->_debugFlags) >> 10 & 1) != 0) { - pVVar20 = GHIDRA_CAST(0x8110d3); - render_debug_grid_indices(room,GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance)); - pGVar18 = g_game; - } - shader = &g_shaders; - if ((DAT_00c7911c & 1) == 0) { - shader = g_currentShader; - } - g_currentShader = shader; - if ((g_manager->_optionsConfig)._enableLighting != 0) { - if (pGVar18->_darknessModifier <= 0.0) { - Seeds::GetForcedCurses(); - Seeds::GetPreventedCurses(); - } - fVar17 = GetLightingAlpha(room); - stageType = g_game->_lightningIntensity; - if (stageType <= 0.0) { - stageType = 0.0; - } - if (1.0 <= stageType) { - stageType = 1.0; - } - local_ac = GHIDRA_CAST((fVar17 - stageType * 0.2)); - if (0.0 < (float)local_ac) { - VStack_c4.y = (float)g_graphicsManager_blendMode[4]; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x18))) = g_graphicsManager_blendMode[0]; - fStack_19c = (float)g_graphicsManager_blendMode[1]; - fStack_198 = (float)g_graphicsManager_blendMode[2]; - fStack_194 = (float)g_graphicsManager_blendMode[3]; - g_graphicsManager_blendMode[4] = 7; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 4; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 8; - pvVar8 = (void *)0x8111a8; - (GHIDRA_CAST((&shaderColor)))->Color::Color(); - (GHIDRA_CAST((auStack_2d2 + -10)))->KAGE::SmartPointer::operator_assign(&DAT_00c797cc); - apply_sprite_shader_params(color_01,1,pVVar20,pvVar8); - local_e8._unk = 0; - local_e8._red = 1.0; - local_e8._green = 1.0; - pcVar2 = *(code **)(*DAT_00c797cc + 0x1c); - local_e8._blue = 1.0; - local_e8._alpha = (float)local_ac; - (GHIDRA_CAST((GHIDRA_CAST(local_bc))))->KColor::SetFromARGB(0xffffffff); - render_quad_set_uniform_color(&local_158,0.0,0.0,g_screenWidth,g_screenHeight,color_06); - (*pcVar2)(); - if (0.0 < g_game->_lightningIntensity) { - pGVar18 = GHIDRA_CAST((g_game->_lightningIntensity * 0.5)); - if ((float)pGVar18 <= 0.0) { - pGVar18 = GHIDRA_CAST(0x0); - } - if (0.5 <= (float)pGVar18) { - pGVar18 = GHIDRA_CAST(0x3f000000); - } - (GHIDRA_CAST((&local_e8)))->BlendMode::SetMode(2,unusedArg_03); - g_graphicsManager_blendMode[0] = *extraout_EAX_02; - g_graphicsManager_blendMode[1] = extraout_EAX_02[1]; - g_graphicsManager_blendMode[2] = extraout_EAX_02[2]; - g_graphicsManager_blendMode[3] = extraout_EAX_02[3]; - g_graphicsManager_blendMode[4] = extraout_EAX_02[4]; - local_e8._red = (float)pGVar18 * 0.85; - local_e8._green = (float)pGVar18 * 0.9; - local_e8._unk = 0; - local_e8._blue = (float)pGVar18; - local_e8._alpha = (float)pGVar18; - render_color_quad_list((void *)local_1f8.y,&local_e8); - } - g_graphicsManager_blendMode[0] = (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x18))); - g_graphicsManager_blendMode[1] = GHIDRA_INT(fStack_19c); - g_graphicsManager_blendMode[2] = GHIDRA_INT(fStack_198); - g_graphicsManager_blendMode[3] = GHIDRA_INT(fStack_194); - g_graphicsManager_blendMode[4] = GHIDRA_INT(VStack_c4.y); - room = GHIDRA_CAST(local_200); - } - } - if ((GHIDRA_CAST(room))->_roomList[0x28].Flags == 0x39) { - render_beast_arena_background(&(GHIDRA_CAST(room))->_roomList[0xa6].ListIndex,3); - } - FXLayers::Render(GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x1e].SavedEntities)); - cVar5 = FUN_008242f0(); - if (cVar5 != '\0') { - local_1f8.y = (float)g_graphicsManager_blendMode[4]; - local_e8._red = (float)g_graphicsManager_blendMode[0]; - local_e8._green = (float)g_graphicsManager_blendMode[1]; - local_e8._blue = (float)g_graphicsManager_blendMode[2]; - local_e8._alpha = (float)g_graphicsManager_blendMode[3]; - (GHIDRA_CAST((local_1b8 + 0x18)))->BlendMode::SetMode(2,unusedArg_04); - g_graphicsManager_blendMode[0] = *extraout_EAX_03; - g_graphicsManager_blendMode[1] = extraout_EAX_03[1]; - g_graphicsManager_blendMode[2] = extraout_EAX_03[2]; - g_graphicsManager_blendMode[3] = extraout_EAX_03[3]; - g_graphicsManager_blendMode[4] = extraout_EAX_03[4]; - pcVar2 = *(code **)(*DAT_00c79824 + 0x1c); - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - render_quad_set_uniform_color(&local_158,0.0,0.0,g_screenWidth,g_screenHeight,color_07); - (*pcVar2)(); - g_graphicsManager_blendMode[0] = GHIDRA_INT(local_e8._red); - g_graphicsManager_blendMode[1] = GHIDRA_INT(local_e8._green); - g_graphicsManager_blendMode[2] = GHIDRA_INT(local_e8._blue); - g_graphicsManager_blendMode[3] = GHIDRA_INT(local_e8._alpha); - g_graphicsManager_blendMode[4] = GHIDRA_INT(local_1f8.y); - room = GHIDRA_CAST(local_200); - } - if (((g_manager->_optionsConfig)._enableShockwave != 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x9c])) + 0xa4)))) < - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x9c])) + 0xa8)))) || - ((GHIDRA_CAST(room))->_roomList[0x9d].ListIndex < (GHIDRA_CAST(room))->_roomList[0x9d].Dimension)))) { - _glfw_context_reset(); - pop_render_target(); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - (GHIDRA_CAST((local_1b8 + 0x18)))->BlendMode::SetMode(1,unusedArg_05); - pGVar18 = GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance); - g_graphicsManager_blendMode[0] = *extraout_EAX_04; - g_graphicsManager_blendMode[1] = extraout_EAX_04[1]; - g_graphicsManager_blendMode[2] = extraout_EAX_04[2]; - g_graphicsManager_blendMode[3] = extraout_EAX_04[3]; - g_graphicsManager_blendMode[4] = extraout_EAX_04[4]; - if ((GHIDRA_CAST(room))->_roomList[0x28].Flags == 0x1c) { - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x18))) = 0.2784314; - fStack_19c = 0.18039216; - fStack_198 = 0.101960786; - fStack_194 = 1.0; - local_1f8.x = ((float)(GHIDRA_CAST(room))->_curses - 2.0) * 26.0; - local_190 = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0xc))) = - (g_game->_screenShakeOffset).x + - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((GHIDRA_CAST(room))->_roomList[0x18])) + 0xa8)))))->x + (GHIDRA_CAST(pGVar18))->x + - 52.0; - local_ac = GHIDRA_CAST(((g_game->_screenShakeOffset).y + - *GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].ShopItemIdx) + - (float)(GHIDRA_CAST(room))->_roomList[0x18].Group + 52.0)); - local_1f8.y = ((float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(room)))) + 0x10)))) - 2.0) * 26.0; - render_quad_set_rect - (screenQuad,GHIDRA_CAST((local_bc + 0xc)),&local_1f8,GHIDRA_CAST((local_1b8 + 0x18))); - pvVar8 = (void *)0x811600; - render_color_shader_pass(screenQuad); - if ((g_manager->_optionsConfig)._enableLighting != 0) { - if (g_game->_darknessModifier <= 0.0) { - Seeds::GetForcedCurses(); - Seeds::GetPreventedCurses(); - } - local_ac = GHIDRA_CAST(g_graphicsManager_blendMode[4]); - local_e8._red = (float)g_graphicsManager_blendMode[0]; - local_e8._green = (float)g_graphicsManager_blendMode[1]; - local_e8._blue = (float)g_graphicsManager_blendMode[2]; - local_e8._alpha = (float)g_graphicsManager_blendMode[3]; - g_graphicsManager_blendMode[4] = 7; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 4; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 8; - local_1f8.y = GetLightingAlpha(room); - pvVar21 = (void *)0x81167b; - (GHIDRA_CAST((GHIDRA_CAST(local_1b8))))->Color::Color(); - (GHIDRA_CAST((auStack_2d2 + -10)))->KAGE::SmartPointer::operator_assign(&DAT_00c797cc); - apply_sprite_shader_params(color_02,1,pvVar8,pvVar21); - VStack_c4.y = 0.0; - local_d0 = GHIDRA_CAST(local_1f8.y); - pGStack_cc = GHIDRA_CAST(local_1f8.y); - pGStack_c8 = GHIDRA_CAST(local_1f8.y); - VStack_c4.x = local_1f8.y; - pcVar2 = *(code **)(*DAT_00c797cc + 0x1c); - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - render_quad_set_uniform_color(screenQuad,0.0,0.0,g_screenWidth,g_screenHeight,color_08); - (*pcVar2)(); - g_graphicsManager_blendMode[1] = GHIDRA_INT(local_e8._green); - g_graphicsManager_blendMode[0] = GHIDRA_INT(local_e8._red); - g_graphicsManager_blendMode[2] = GHIDRA_INT(local_e8._blue); - g_graphicsManager_blendMode[3] = GHIDRA_INT(local_e8._alpha); - g_graphicsManager_blendMode[4] = GHIDRA_INT(local_ac); - pGVar18 = local_204; - room = GHIDRA_CAST(local_200); - } - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)) & 1) == 0) { - local_1d4 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70d8)))); - local_204 = GHIDRA_CAST(0x2); - do { - local_1f8.y = *GHIDRA_CAST(local_1d4); - local_ac = *GHIDRA_CAST((GHIDRA_CAST(local_1d4) + 4)); - if ((GHIDRA_INT(local_1f8.y) < GHIDRA_INT(local_ac)) && - ((room->_backdropType == 0x12 || (room->_backdropType == 0x1c)))) { - pvVar8 = ANM2::GetAnimationData(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7100)))),s_Idle); - local_1f8.y = (float)GHIDRA_INT(((float)*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x30)) * - ((float)GHIDRA_INT(local_1f8.y) / (float)GHIDRA_INT(local_ac)))); - bVar4 = ANM2::SetAnimation(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7100)))),s_Idle,1); - if ((bVar4 != 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7134)))) != 0 && - (AnimationState::SetFrameFloat - (GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7130)))),(float)GHIDRA_INT(local_1f8.y)), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7134)))) != 0)))) { - (*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7144))) = 0; - } - local_ac = GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(local_1d4) + -0x10)) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5)); - local_1f0 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_1f8.y = (float)local_1f0 * - ((*GHIDRA_CAST((GHIDRA_CAST(local_1d4) + -0x14)) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) + 0.5; - dVar19 = floor((double)local_1f8.y); - VStack_c4.y = (float)dVar19 / (float)local_1f0; - local_1f8.y = (float)local_1f0 * (float)local_ac + 0.5; - dVar19 = floor((double)local_1f8.y); - local_21c.x = VStack_c4.y + (float)pGVar18->_stage; - local_21c.y = (float)dVar19 / (float)local_1f0 + (float)pGVar18->_stageType; - local_1f8.y = (float)(float)dVar19; - ANM2::Render(GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7100)))),&local_21c,&g_vectorZero,&g_vectorZero); - } - local_1d4 = GHIDRA_CAST((GHIDRA_INT(local_1d4) + 0x1c)); - local_204 = GHIDRA_CAST((GHIDRA_INT(local_204) + -1)); - } while (local_204 != GHIDRA_CAST(0x0)); - } - shaderColor._colorize[2] = 0.0; - shaderColor._tint[2] = 0.0; - shaderColor._colorize[1] = 0.0; - shaderColor._tint[3] = 0.0; - shaderColor._offset[0] = 1.0; - shaderColor._colorize[0] = 1.0; - shaderColor._offset[1] = 1.0; - shaderColor._colorize[3] = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(shaderColor._offset[2])) + 0x0))) = 0; - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - pGVar18 = GHIDRA_CAST(0x0); - pvVar8 = (void *)g_screenHeight; - render_quad_set_uniform_color(&local_158,0.0,0.0,g_screenWidth,g_screenHeight,color_09); - local_204 = GHIDRA_CAST(0xc3160000); - shader = &DAT_00c79488; - if ((DAT_00c7948c & 1) == 0) { - shader = g_currentShader; - } - local_1d4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70cc)))); - local_1f8.y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70d8)))); - local_1f0 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70e8)))); - g_currentShader = shader; - local_200 = local_204; - local_1e4 = pGVar18; - local_1e0 = pGVar18; - stageType = pow((float)GHIDRA_INT(local_1f8.y) / (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70dc)))),0.4); - iVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70f4)))); - local_ac = GHIDRA_CAST(((1.0 - stageType) * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70d0)))))); - pvVar21 = (void *)0x811b03; - stageType = pow((float)iVar14 / (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70f8)))),0.4); - VStack_c4.y = (1.0 - stageType) * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70ec)))); - local_21c.y = 0.66015625 / - ((g_screenPointScale * 520.0) / - (float)((double)DAT_00c797d4[6] + - __uint_to_double_fixup[-(DAT_00c797d4[6] >> 0x1f)])); - local_224.y = 0.35546875 / - ((g_screenPointScale * 280.0) / - (float)((double)DAT_00c797d4[7] + - __uint_to_double_fixup[-(DAT_00c797d4[7] >> 0x1f)])); - if ((*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7220))) != '\0') { - local_1d4 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70d4)))) * 0.5 + (float)local_1d4)); - local_1f0 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70f0)))) * 0.5 + (float)local_1f0)); - } - piVar9 = DAT_00c797d4; - if (GHIDRA_INT(local_1f8.y) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70dc))))) { - (GHIDRA_CAST((auStack_2d2 + -10)))->KAGE::SmartPointer::operator_assign(&DAT_00c797d4); - pVVar20 = compute_overlay_texcoords - (room,&local_1f8,GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70c4)))),pvVar8,pvVar21); - iVar14 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70f4)))); - local_204 = GHIDRA_CAST(pVVar20->x); - local_1e0 = GHIDRA_CAST(pVVar20->y); - piVar9 = extraout_ECX; - } - if (iVar14 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70f8))))) { - (GHIDRA_CAST((auStack_2d2 + -10)))->KAGE::SmartPointer::operator_assign(&DAT_00c797d4); - pVVar20 = compute_overlay_texcoords - (room,&local_1f8,GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x70e0)))),pvVar8,pvVar21); - local_200 = GHIDRA_CAST(pVVar20->x); - local_1e4 = GHIDRA_CAST(pVVar20->y); - piVar9 = extraout_ECX_00; - } - local_e8._green = (float)local_204; - local_e8._blue = (float)local_1e0; - local_e8._unk = GHIDRA_INT(local_ac); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0x4))) = local_200; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0x8))) = local_1e4; - local_ac = GHIDRA_CAST(VStack_c4.y); - local_e8._alpha = (float)local_1d4; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0xc))) = local_1f0; - local_1f8.x = local_21c.y; - local_1f8.y = local_224.y; - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Shockwave1"),0xb,&local_e8._green,GHIDRA_INT(piVar9)); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Shockwave2"),0xb,local_bc + 4,unused_01); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Ratio"),9,&local_1f8,unused_02); - (**(code **)(*DAT_00c797d4 + 0x14))(shaderColor._tint + 2); - set_blend_mode(&DAT_00c798e0,1); - } - if (isDataminer != 0) { - DAT_00c7977f = 0; - } - FXLayers::render_overlay_layers(); - local_204 = GHIDRA_CAST(0x258); - iVar14 = extraout_ECX_01; - if (0.0 < (float)local_20c) { - _glfw_context_reset(); - pop_render_target(); - set_blend_mode(&DAT_00c798e0,1); - shaderColor._colorize[2] = 0.0; - shaderColor._tint[2] = 0.0; - shaderColor._colorize[1] = 0.0; - shaderColor._tint[3] = 0.0; - shaderColor._offset[0] = 1.0; - shaderColor._colorize[0] = 1.0; - shaderColor._offset[1] = 1.0; - shaderColor._colorize[3] = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(shaderColor._offset[2])) + 0x0))) = 0; - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - render_quad_set_uniform_color(&local_158,0.0,0.0,g_screenWidth,g_screenHeight,color_10); - local_1e0 = GHIDRA_CAST(&DAT_00c795c8); - if ((DAT_00c795cc & 1) == 0) { - local_1e0 = g_currentShader; - } - local_224.y = (float)((double)DAT_00c797fc[7] + - __uint_to_double_fixup[-(DAT_00c797fc[7] >> 0x1f)]); - local_20c = GHIDRA_CAST(((float)((double)DAT_00c797fc[5] + - __uint_to_double_fixup[-(DAT_00c797fc[5] >> 0x1f)]) / local_224.y)); - local_21c.y = (float)((double)DAT_00c797fc[6] + - __uint_to_double_fixup[-(DAT_00c797fc[6] >> 0x1f)]); - local_214 = GHIDRA_CAST(((float)((double)DAT_00c797fc[4] + - __uint_to_double_fixup[-(DAT_00c797fc[4] >> 0x1f)]) / local_21c.y)); - local_1d4 = GHIDRA_CAST((local_21c.y / (g_screenPointScale * 1024.0))); - local_1f0 = GHIDRA_CAST((local_224.y / (g_screenPointScale * 1024.0))); - local_ac = GHIDRA_CAST(((g_screenHeight - 182.0) * 0.5)); - local_1e4 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_1f8.y = (((float)(GHIDRA_CAST(room))->_roomList[0].GridIndex - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_1e4 + 0.5; - g_currentShader = local_1e0; - dVar19 = floor((double)local_1f8.y); - VStack_c4.y = (float)dVar19; - stageType = (((float)(GHIDRA_CAST(room))->_roomList[0].SafeGridIndex - 140.0) * 0.65 + - (float)local_ac) * (float)local_1e4 + 0.5; - local_1f8.y = stageType; - dVar19 = floor((double)stageType); - local_1f8.y = (float)dVar19; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0xc))) = local_214; - local_e8._alpha = - (((g_game->_screenShakeOffset).x + - (GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance))->x + - VStack_c4.y / (float)local_1e4) * g_screenPointScale) / local_21c.y; - local_ac = local_20c; - local_e8._unk = - GHIDRA_INT(((((float)(GHIDRA_CAST(room))->_roomList[0x18].Group + (g_game->_screenShakeOffset).y + - (float)dVar19 / (float)local_1e4) * g_screenPointScale) / local_224.y)); - local_e8._green = (float)local_1d4; - local_e8._blue = (float)local_1f0; - bVar4 = Game::IsPaused(g_game); - if (bVar4 == 0) { - uVar6 = g_manager->_framecount + 1U & 0x80000001; - if (GHIDRA_INT(uVar6) < 0) { - uVar6 = (uVar6 - 1 | 0xfffffffe) + 1; - } - } - else { - uVar6 = 0; - } - local_1f8.y = (float)((float)GHIDRA_INT((uVar6 + (g_game->_frameCount % GHIDRA_INT(local_204)) * 2)) / 120.0); - (GHIDRA_CAST((local_1e0)))->Shader::set_uniform(GHIDRA_CAST("TextureSize"),9,local_bc + 0xc,uVar6); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Ratio"),0xb,&local_e8._green,unused_03); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(&DAT_00b6837c,8,&local_1f8.y,unused_04); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Amount"),8,&local_210,unused_05); - (**(code **)(*DAT_00c797fc + 0x14))(shaderColor._tint + 2); - iVar14 = extraout_ECX_02; - } - if (isMineshaftDimension != '\0') { - _glfw_context_reset(); - pop_render_target(); - set_blend_mode(&DAT_00c798e0,1); - shaderColor._colorize[2] = 1.0; - shaderColor._tint[2] = 1.0; - shaderColor._colorize[1] = 0.0; - shaderColor._tint[3] = 0.0; - shaderColor._offset[0] = 0.0; - shaderColor._colorize[0] = 0.0; - shaderColor._offset[1] = 1.0; - shaderColor._colorize[3] = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(shaderColor._offset[2])) + 0x0))) = 0; - (GHIDRA_CAST((GHIDRA_CAST((local_1b8 + 0x18)))))->KColor::SetFromARGB(0xffffffff); - pvVar8 = (void *)g_screenHeight; - render_quad_set_uniform_color(screenQuad,0.0,0.0,g_screenWidth,g_screenHeight,color_11); - if ((g_manager->_optionsConfig)._getsSetToEnableWaterSurface == 0) { - shader = &g_shaders; - if ((DAT_00c7911c & 1) == 0) { - shader = g_currentShader; - } - pvVar21 = (void *)0x8125f0; - g_currentShader = shader; - (GHIDRA_CAST((GHIDRA_CAST(local_1b8))))->Color::Color(); - (GHIDRA_CAST((auStack_2d2 + -10)))->KAGE::SmartPointer::operator_assign(&DAT_00c79854); - apply_sprite_shader_params(color_03,1,pvVar8,pvVar21); - } - else { - local_1f0 = GHIDRA_CAST(&DAT_00c79668); - if ((DAT_00c7966c & 1) == 0) { - local_1f0 = g_currentShader; - } - local_224.y = (float)((double)DAT_00c79854[7] + - __uint_to_double_fixup[-(DAT_00c79854[7] >> 0x1f)]); - local_1e4 = GHIDRA_CAST(((float)((double)DAT_00c79854[5] + - __uint_to_double_fixup[-(DAT_00c79854[5] >> 0x1f)]) / local_224.y)) - ; - local_21c.y = (float)((double)DAT_00c79854[6] + - __uint_to_double_fixup[-(DAT_00c79854[6] >> 0x1f)]); - local_214 = GHIDRA_CAST(((float)((double)DAT_00c79854[4] + - __uint_to_double_fixup[-(DAT_00c79854[4] >> 0x1f)]) / local_21c.y)) - ; - local_20c = GHIDRA_CAST((local_21c.y / (g_screenPointScale * 1024.0))); - local_1d4 = GHIDRA_CAST((local_224.y / (g_screenPointScale * 1024.0))); - local_210 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); - local_ac = GHIDRA_CAST(((g_screenHeight - 182.0) * 0.5)); - local_1f8.y = (((float)(GHIDRA_CAST(room))->_roomList[0].GridIndex - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * (float)local_210 + 0.5; - g_currentShader = local_1f0; - dVar19 = floor((double)local_1f8.y); - VStack_c4.y = (float)dVar19; - stageType = (((float)(GHIDRA_CAST(room))->_roomList[0].SafeGridIndex - 140.0) * 0.65 + - (float)local_ac) * (float)local_210 + 0.5; - local_1f8.y = stageType; - dVar19 = floor((double)stageType); - local_1f8.y = (float)dVar19; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_bc)) + 0xc))) = local_214; - local_e8._alpha = - (((g_game->_screenShakeOffset).x + - (GHIDRA_CAST(&(GHIDRA_CAST(room))->_roomList[0x18].DeliriumDistance))->x + - VStack_c4.y / (float)local_210) * g_screenPointScale) / local_21c.y; - local_ac = local_1e4; - local_e8._unk = - GHIDRA_INT(((((float)(GHIDRA_CAST(room))->_roomList[0x18].Group + (g_game->_screenShakeOffset).y + - (float)dVar19 / (float)local_210) * g_screenPointScale) / local_224.y)); - local_e8._green = (float)local_20c; - local_e8._blue = (float)local_1d4; - bVar4 = Game::IsPaused(g_game); - if (bVar4 == 0) { - uVar6 = g_manager->_framecount + 1U & 0x80000001; - if (GHIDRA_INT(uVar6) < 0) { - uVar6 = (uVar6 - 1 | 0xfffffffe) + 1; - } - } - else { - uVar6 = 0; - } - local_1f8.y = (float)((float)GHIDRA_INT((uVar6 + (g_game->_frameCount % 600) * 2)) / 120.0); - (GHIDRA_CAST((local_1f0)))->Shader::set_uniform(GHIDRA_CAST("TextureSize"),9,local_bc + 0xc,uVar6); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("Ratio"),0xb,&local_e8._green,unused_06); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(&DAT_00b6837c,8,&local_1f8.y,unused_07); - } - (**(code **)(*DAT_00c79854 + 0x14))(shaderColor._tint + 2); - iVar14 = extraout_ECX_03; - } - DAT_00c79a4c = 0.0; - shader_cache_find(iVar14); - if ((GHIDRA_UINT(g_game->_debugFlags) >> 4 & 1) != 0) { - roomTypeNames = &DAT_00b6c690; - local_15c = "Default"; - local_158 = &DAT_00b6c688; - local_154 = "Error"; - local_150 = "Treasure"; - local_14c = &DAT_00b6c734; - local_148 = "Miniboss"; - local_144 = "Secret"; - local_140 = "SSecret"; - local_13c = "Arcade"; - local_138 = "Curse"; - local_134 = "Ambush"; - local_130 = "Library"; - local_12c = "Sacrifice"; - local_128 = "Devil"; - local_124 = "Angel"; - local_120 = "Dungeon"; - local_11c = "Bossrush"; - local_118 = "Isaac"; - local_114 = "Barren"; - local_110 = "Chest"; - local_10c = &DAT_00b6c74c; - local_108 = "Market"; - local_104 = &DAT_00b6c75c; - local_100 = "Planetarium"; - local_fc = "TeleEntrance"; - local_f8 = "TeleExit"; - local_f4 = "SecretExit"; - local_f0 = &DAT_00b634c0; - local_ec = "USecret"; - RoomConfigStage::GetDisplayName - ((RoomConfig_Stage *) - (g_game->_ventricleRazorPortals + - **GHIDRA_CAST(((GHIDRA_CAST(room))->_stageType + 0x10)) * 0xc4 + 0x598),&stageName,0); - local_14 = 0; - local_1f8.y = *GHIDRA_CAST(((GHIDRA_CAST(room))->_stageType + 0xb4)); - sprintf_s(debugText,0x80,GHIDRA_CAST("%s %s %d %s (group %d)")); - manager = g_manager; - uVar6 = Font::get_string_width_n(&g_manager->_font5_terminus8,debugText,-1); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x10))) = 0.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x14))) = 9.18341e-41; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_1b8)) + 0x18))) = 0.0; - fStack_19c = 1.0; - fStack_198 = -NAN; - fStack_194 = 0.0; - local_190 = 0.0; - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); - Font::DrawString(&manager->_font5_terminus8,debugText,GHIDRA_CAST(&DAT_00c5d134),local_1b8 + 0x10, - g_screenWidth * 0.5 - ((float)(uVar6 >> 1) + 0.0),g_screenHeight - 12.0); - (GHIDRA_CAST((stageName._buf)))->msvc::string::_Tidy_deallocate(); - } - ExceptionList = local_1c; - return; -} - -// 008128f0 -void Room::render_debug_grid_values(Vector *offset) -{ - KColor color; - void *glyphs; - int gridWidth; - int gridIndex; - double dVar1; - float quad [28]; - uint8_t glyphList [16]; - uint32_t local_80; - uint32_t local_7c; - KColor drawColor; - float screenY; - float local_60; - float drawX; - uint8_t valueText [64]; - uint32_t local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Manager *manager; - - puStack_c = &LAB_00b01598; - local_10 = ExceptionList; - local_18 = __security_cookie ^ GHIDRA_UINT((valueText + 0x54)); - ExceptionList = &local_10; - gridIndex = 0; - gridWidth = this->_gridWidth; - if (0 < this->_gridHeight * gridWidth) { - do { - local_8 = 0xffffffff; - local_60 = g_displayPixelRatio * g_screenPointScale; - screenY = (((float)(gridIndex / gridWidth) * 40.0 + 120.0) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - drawX = ((((float)(gridIndex % gridWidth) * 40.0 + 40.0) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_60 + 0.5; - dVar1 = floor((double)drawX); - drawX = (float)dVar1 / local_60; - screenY = screenY * local_60 + 0.5; - dVar1 = floor((double)screenY); - screenY = (float)dVar1; - drawColor._unk = 0; - local_60 = screenY / local_60 + offset->y; - drawX = drawX + offset->x; - drawColor._red = 1.0; - drawColor._green = 1.0; - drawColor._blue = 0.0; - drawColor._alpha = 0.2; - render_quad_set_uniform_color - (quad,drawX - 13.0,local_60 - 13.0,drawX + 13.0,local_60 + 13.0,&drawColor); - render_quad_draw_color_shader(quad,1.0); - sprintf_s(valueText,0x40,s__d); - manager = g_manager; - local_80 = 0; - local_7c = 0xffff; - drawColor._red = 0.0; - drawColor._green = 1.0; - drawColor._blue = -NAN; - drawColor._alpha = 0.0; - drawColor._unk = 0; - local_8 = 0; - drawX = drawX - 12.0; - local_60 = local_60 - 10.0; - glyphs = Font::measure_string - (&g_manager->_font6_PFTempestaSevenCondensed,glyphList,valueText,&local_80, - &g_vectorOne); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - color._alpha = 0.2; - color._red = 1.0; - color._green = 1.0; - color._blue = 0.0; - color._unk = 0; - Font::render_glyph_quads - (&manager->_font6_PFTempestaSevenCondensed,glyphs,drawX,local_60,1.0,1.0,color, - &local_80); - msvc::vector<12byte>::clear(); - msvc::vector<12byte>::_Tidy(); - gridIndex = gridIndex + 1; - gridWidth = this->_gridWidth; - } while (gridIndex < this->_gridHeight * gridWidth); - } - ExceptionList = local_10; - return; -} - -// 00812c10 -int Room::GetGridPathFromPos(Vector *position) -{ - uint32_t gridIndex; - int gridY; - int gridX; - - gridX = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - if ((((gridX < 0) || (this->_gridWidth <= gridX)) || - (gridY = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)), gridY < 0)) || - ((this->_gridHeight <= gridY || - (gridIndex = this->_gridWidth * gridY + gridX, 0x1bf < gridIndex)))) { - return 0; - } - return this->_gridPaths[gridIndex]; -} - -// 00812c90 -int Room::GetGridIndex(Vector *pos) -{ - int gridY; - int gridX; - - gridX = GHIDRA_INT(((pos->x - 40.0) / 40.0 + 0.5)); - if ((((gridX < 0) || (this->_gridWidth <= gridX)) || - (gridY = GHIDRA_INT(((pos->y - 120.0) / 40.0 + 0.5)), gridY < 0)) || (this->_gridHeight <= gridY)) { - return -1; - } - return this->_gridWidth * gridY + gridX; -} - -// 00812d00 -Vector * Room::GetCenterPos(Vector *outPos) -{ - int iVar1; - uint32_t centerGridIndex; - void *room; - - room = g_game->_room; - if ((*GHIDRA_CAST((GHIDRA_CAST(room) + 4)) == 0) || - (iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 4)) + 0x10)), iVar1 == 0)) { -switchD_00812d27_default: - outPos->x = (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1c)) - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x14))) * 0.5 + - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x14)); - outPos->y = (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x20)) - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x18))) * 0.5 + - *GHIDRA_CAST((GHIDRA_CAST(room) + 0x18)); - return outPos; - } - switch(*GHIDRA_CAST((iVar1 + 0x48))) { - case 9: - centerGridIndex = 0x148; - break; - case 10: - centerGridIndex = 0x13b; - break; - case 0xb: - centerGridIndex = 0x84; - break; - case 0xc: - centerGridIndex = 0x77; - break; - default: - goto switchD_00812d27_default; - } - iVar1 = *GHIDRA_CAST((GHIDRA_CAST(room) + 0xc)); - outPos->x = (float)GHIDRA_INT(((int64_t)(uint64_t)centerGridIndex % (int64_t)iVar1)) * 40.0 + 40.0; - outPos->y = (float)GHIDRA_INT(((int64_t)(uint64_t)centerGridIndex / (int64_t)iVar1)) * 40.0 + 120.0; - return outPos; -} - -// 00812de0 -int Room::GetClampedGridIndex(Vector *position) -{ - int iVar1; - int iVar2; - int column; - int row; - - iVar2 = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - column = 0; - if (0 < iVar2) { - column = iVar2; - } - iVar2 = this->_gridHeight + -1; - row = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)); - iVar1 = 0; - if (0 < row) { - iVar1 = row; - } - if (iVar1 < iVar2) { - iVar2 = iVar1; - } - iVar1 = this->_gridWidth + -1; - if (column < iVar1) { - iVar1 = column; - } - return iVar2 * this->_gridWidth + iVar1; -} - -// 00812e60 -int Room::GetGridIndexByTile(int GridRow, int GridColumn) -{ - if ((((GridRow < 0) || (this->_gridWidth <= GridRow)) || (GridColumn < 0)) || - (this->_gridHeight <= GridColumn)) { - return -1; - } - return this->_gridWidth * GridColumn + GridRow; -} - -// 00812f00 -Vector * Room::GetGridPosition(Vector *outPos, int gridIndex) -{ - int gridWidth; - - gridWidth = this->_gridWidth; - outPos->x = (float)(gridIndex % gridWidth) * 40.0 + 40.0; - outPos->y = (float)(gridIndex / gridWidth) * 40.0 + 120.0; - return outPos; -} - -// 00813360 -uint8_t Room::IsPositionInRoom(Vector *position, float margin) -{ - Vector clampedPos; - - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)) - 9U < 4) { - GetClampedPositionImpl(this,&clampedPos,position,margin,margin,margin,margin); - if ((clampedPos.x == position->x) && (clampedPos.y == position->y)) { - return 1; - } - } - else if ((((margin + (this->_topLeftPos).x <= position->x) && - (position->x <= (this->_bottomRightPos).x - margin)) && - (margin + (this->_topLeftPos).y <= position->y)) && - (position->y <= (this->_bottomRightPos).y - margin)) { - return 1; - } - return 0; -} - -// 00813b30 -uint8_t Room::DamageGridWithSource(int gridIndex, int damage, EntityRef *source) -{ - uint8_t isDamaged; - - if ((GHIDRA_UINT(gridIndex) < 0x1c0) && (this->_gridEntities[gridIndex] != GHIDRA_CAST(0x0))) { - isDamaged = (**(code **)(*GHIDRA_CAST(this->_gridEntities[gridIndex]) + 0x10))(damage,source); - return isDamaged; - } - return 0; -} - -// 00813b60 -uint8_t Room::DamageGrid(int gridIndex, int damage) -{ - uint8_t bVar1; - EntityRef damageSource; - - damageSource._type = 0; - damageSource._variant = 0; - damageSource._spawnerType = 0; - damageSource._spawnerVariant = 0; - damageSource._position.x = g_vectorZero.x; - damageSource._position.y = g_vectorZero.y; - damageSource._velocity.x = g_vectorZero.x; - damageSource._velocity.y = g_vectorZero.y; - damageSource._flags = 0; - damageSource._entity = (void *)0x0; - if ((GHIDRA_UINT(gridIndex) < 0x1c0) && (this->_gridEntities[gridIndex] != GHIDRA_CAST(0x0))) { - bVar1 = (**(code **)(*GHIDRA_CAST(this->_gridEntities[gridIndex]) + 0x10))(damage,&damageSource); - return bVar1; - } - return 0; -} - -// 00813c40 -uint8_t Room::DestroyGrid(int gridIdx, uint8_t isImmediate, uint8_t isDefuseBombRock) -{ - uint8_t bVar1; - undefined3 in_stack_00000009; - EntityRef source; - int *gridEntity; - - source._type = 0; - source._variant = 0; - source._spawnerType = 0; - source._spawnerVariant = 0; - source._position.x = g_vectorZero.x; - source._position.y = g_vectorZero.y; - source._velocity.x = g_vectorZero.x; - source._velocity.y = g_vectorZero.y; - source._flags = 0; - source._entity = (void *)0x0; - if ((0x1bf < GHIDRA_UINT(gridIdx)) || - (gridEntity = this->_gridEntities[gridIdx], gridEntity == GHIDRA_CAST(0x0))) { - return 0; - } - if ((isDefuseBombRock != 0) && (gridEntity[1] == 5)) { - gridEntity[1] = 2; - } - bVar1 = (**(code **)(*gridEntity + 0x14))(_isImmediate,&source); - return bVar1; -} - -// 00813ce0 -int Room::GetFrameCount() -{ - if (*GHIDRA_CAST(this) == '\0') { - return -1; - } - return g_game->_frameCount - this->_enterFrame; -} - -// 00813d00 -int Room::greed_shop_slot_type(uint32_t seed) -{ - switch(seed % 10) { - case 0: - return 3; - case 1: - return 1; - case 2: - return 0; - case 3: - return 4; - case 4: - return 8; - case 5: - return 10; - case 6: - return 5; - case 7: - return 2; - case 8: - return 6; - case 9: - return 0xb; - default: - return -1; - } -} - -// 00813d90 -void Room::init_shop_item_slots() -{ - code *pcVar1; - uint8_t bVar2; - uint32_t uVar3; - uint8_t shift2; - uint8_t shift3; - uint16_t uVar4; - uint32_t allocSize; - int iVar5; - int *piVar6; - int *piVar7; - int slotOffset; - uint32_t local_38; - RNG shopRng; - int *slotTypes; - int *slotTypesEnd; - int *slotTypesCapacity; - int *local_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int *slotTypesCapacityCopy; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b015f5; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - shopRng._shift1 = 5; - shopRng._shift2 = 9; - local_38 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x60)); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xa4)) = 0; - iVar5 = this->_roomType; - local_18 = GHIDRA_CAST(0x7); - shopRng._shift3 = 7; - shopRng._seed = local_38; - if (((iVar5 == 0xe) || (iVar5 == 0x16)) || - (slotOffset = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))), (*GHIDRA_CAST((slotOffset + 0x44)) >> 0xb & 1) != 0)) { - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x94)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x96)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x98)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9a)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9c)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9e)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xa0)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xa2)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xac)) = 0; - if (local_38 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - shopRng._seed = local_38 >> 5 ^ local_38; - shopRng._seed = shopRng._seed << 9 ^ shopRng._seed; - shopRng._seed = GHIDRA_UINT(shopRng._seed) >> 7 ^ shopRng._seed; - if (shopRng._seed == (GHIDRA_UINT(shopRng._seed) / 3) * 3) { -LAB_00814851: - uVar4 = 0xffff; - uVar3 = shopRng._seed; - } - else { - if (shopRng._seed == 0) { - shopRng._seed = local_38; - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - shopRng._seed = GHIDRA_UINT(shopRng._seed) >> 5 ^ shopRng._seed; - shopRng._seed = shopRng._seed << 9 ^ shopRng._seed; - uVar3 = GHIDRA_UINT(shopRng._seed) >> 7 ^ shopRng._seed; - uVar4 = (uint16_t)(uVar3 % 6); - } -LAB_00814854: - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xae)) = uVar4; - } - else { - if (iVar5 == 0xf) { - slotTypes = GHIDRA_CAST(0x0); - slotTypesEnd = GHIDRA_CAST(0x0); - slotTypesCapacity = GHIDRA_CAST(0x0); - local_8 = 0; - local_18 = GHIDRA_CAST(0x8); - msvc::vector::_Emplace_reallocate(0,&local_18); - local_18 = GHIDRA_CAST(0x4); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 4; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x4); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 4; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x3); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 3; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x3); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 3; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x13); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 0x13; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x13); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 0x13; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x14); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 0x14; - slotTypesEnd = slotTypesEnd + 1; - } - piVar7 = slotTypesEnd; - piVar6 = slotTypes; - RNG::Shuffle(&shopRng,slotTypes,slotTypesEnd); - piVar7 = GHIDRA_CAST((GHIDRA_INT(piVar7) - GHIDRA_INT(piVar6) >> 2)); - iVar5 = 0; - local_18 = GHIDRA_CAST(&DAT_00000008); - if (GHIDRA_INT(piVar7) < 8) { - local_18 = piVar7; - } - if (0 < GHIDRA_INT(local_18)) { - slotOffset = 0x94; - do { - piVar7 = piVar6 + iVar5; - iVar5 = iVar5 + 1; - *GHIDRA_CAST((slotOffset + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))))) = (short)*piVar7; - slotOffset = slotOffset + 2; - } while (iVar5 < GHIDRA_INT(local_18)); - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x96)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xac)) = 0; - if (shopRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = GHIDRA_UINT(shopRng._seed) >> ((uint8_t)shopRng._shift1 & 0x1f) ^ shopRng._seed; - uVar3 = uVar3 << ((uint8_t)shopRng._shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)shopRng._shift3 & 0x1f) ^ uVar3; - if (uVar3 % 3 == 0) { - uVar4 = 0xffff; - } - else { - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = uVar3 >> ((uint8_t)shopRng._shift1 & 0x1f) ^ uVar3; - uVar3 = uVar3 << ((uint8_t)shopRng._shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> ((uint8_t)shopRng._shift3 & 0x1f) ^ uVar3; - uVar4 = (uint16_t)(uVar3 % 6); - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xae)) = uVar4; - if (slotTypes != GHIDRA_CAST(0x0)) { - allocSize = GHIDRA_INT(slotTypesCapacity) - GHIDRA_INT(slotTypes) & 0xfffffffc; - piVar6 = slotTypes; - if (0xfff < allocSize) { - piVar6 = GHIDRA_CAST(slotTypes[-1]); - allocSize = allocSize + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(slotTypes) + (-4 - GHIDRA_INT(piVar6))))) goto LAB_00814776; - } - operator_delete(piVar6,allocSize); - } - goto LAB_0081485e; - } - if ((iVar5 == 2) && (*GHIDRA_CAST((*GHIDRA_CAST((slotOffset + 0x10)) + 0x10)) - 100U < 0x14)) { - slotTypes = GHIDRA_CAST(0x0); - slotTypesEnd = GHIDRA_CAST(0x0); - slotTypesCapacity = GHIDRA_CAST(0x0); - local_8 = 1; - local_18 = GHIDRA_CAST(0xb); - msvc::vector::_Emplace_reallocate(0,&local_18); - local_18 = GHIDRA_CAST(0x3); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 3; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x1); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 1; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x6); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 6; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x5); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 5; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x2); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 2; - slotTypesEnd = slotTypesEnd + 1; - } - slotTypesCapacityCopy = slotTypesCapacity; - piVar7 = slotTypesEnd; - RNG::Shuffle(&shopRng,slotTypes,slotTypesEnd); - piVar6 = slotTypes; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x94)) = (short)*slotTypes; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x96)) = (short)slotTypes[1]; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x98)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9a)) = 9; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9c)) = 10; - *slotTypes = 8; - slotTypes[1] = 10; - RNG::Shuffle(&shopRng,slotTypes,piVar7); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9e)) = (short)*piVar6; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xa0)) = (short)piVar6[1]; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xa2)) = 10; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xac)) = 0; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::RandomInt(3); - if (uVar3 == 0) { - uVar4 = 0xffff; - } - else { - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::RandomInt(8); - uVar4 = (uint16_t)uVar3; - } - uVar3 = GHIDRA_INT(slotTypesCapacityCopy) - GHIDRA_INT(piVar6) & 0xfffffffc; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xae)) = uVar4; - piVar7 = piVar6; - if (0xfff < uVar3) { - piVar7 = GHIDRA_CAST(piVar6[-1]); - uVar3 = uVar3 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(piVar6) + (-4 - GHIDRA_INT(piVar7))))) goto LAB_00814776; - } - operator_delete(piVar7,uVar3); - uVar3 = shopRng._seed; - goto LAB_0081485e; - } - if (g_game->_currentRoomIdx == -0xd) { - slotTypes = GHIDRA_CAST(0x0); - slotTypesEnd = GHIDRA_CAST(0x0); - slotTypesCapacity = GHIDRA_CAST(0x0); - local_8 = 2; - local_18 = GHIDRA_CAST(0x8); - msvc::vector::_Emplace_reallocate(0,&local_18); - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::RandomInt(2); - local_18 = GHIDRA_CAST((0xd - GHIDRA_UINT((uVar3 != 0)))); - if (slotTypesEnd == slotTypesCapacity) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = GHIDRA_INT(local_18); - slotTypesEnd = slotTypesEnd + 1; - } - piVar7 = slotTypesCapacity; - piVar6 = slotTypesEnd; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::RandomInt(8); - local_18 = GHIDRA_CAST(((-GHIDRA_UINT((uVar3 != 0)) & 0xfffffffb) + 0xe)); - if (piVar6 == piVar7) { - msvc::vector::_Emplace_reallocate(piVar6,&local_18); - piVar7 = slotTypesCapacity; - } - else { - *piVar6 = GHIDRA_INT(local_18); - slotTypesEnd = piVar6 + 1; - } - local_18 = GHIDRA_CAST(0xb); - if (slotTypesEnd == piVar7) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - piVar7 = slotTypesCapacity; - } - else { - *slotTypesEnd = 0xb; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0xb); - if (slotTypesEnd == piVar7) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - piVar7 = slotTypesCapacity; - } - else { - *slotTypesEnd = 0xb; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0xf); - if (slotTypesEnd == piVar7) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - piVar7 = slotTypesCapacity; - } - else { - *slotTypesEnd = 0xf; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x6); - if (slotTypesEnd == piVar7) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - piVar7 = slotTypesCapacity; - } - else { - *slotTypesEnd = 6; - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST(0x10); - if (slotTypesEnd == piVar7) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - } - else { - *slotTypesEnd = 0x10; - slotTypesEnd = slotTypesEnd + 1; - } - piVar7 = slotTypesEnd; - piVar6 = slotTypes; - RNG::Shuffle(&shopRng,slotTypes,slotTypesEnd); - piVar7 = GHIDRA_CAST((GHIDRA_INT(piVar7) - GHIDRA_INT(piVar6) >> 2)); - iVar5 = 0; - local_18 = GHIDRA_CAST(&DAT_00000008); - if (GHIDRA_INT(piVar7) < 8) { - local_18 = piVar7; - } - if (0 < GHIDRA_INT(local_18)) { - slotOffset = 0x94; - do { - piVar7 = piVar6 + iVar5; - iVar5 = iVar5 + 1; - *GHIDRA_CAST((slotOffset + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))))) = (short)*piVar7; - slotOffset = slotOffset + 2; - } while (iVar5 < GHIDRA_INT(local_18)); - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xac)) = 0; - if (shopRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - shopRng._seed = GHIDRA_UINT(shopRng._seed) >> ((uint8_t)shopRng._shift1 & 0x1f) ^ shopRng._seed; - shopRng._seed = shopRng._seed << ((uint8_t)shopRng._shift2 & 0x1f) ^ shopRng._seed; - shopRng._seed = GHIDRA_UINT(shopRng._seed) >> ((uint8_t)shopRng._shift3 & 0x1f) ^ shopRng._seed; - if (GHIDRA_UINT(shopRng._seed) % 3 == 0) { - uVar4 = 0xffff; - } - else { - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::RandomInt(8); - uVar4 = (uint16_t)uVar3; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xae)) = uVar4; - uVar3 = shopRng._seed; - if (slotTypes == GHIDRA_CAST(0x0)) goto LAB_0081485e; - allocSize = GHIDRA_INT(slotTypesCapacity) - GHIDRA_INT(slotTypes) & 0xfffffffc; - piVar6 = slotTypes; - if (0xfff < allocSize) { - piVar6 = GHIDRA_CAST(slotTypes[-1]); - iVar5 = GHIDRA_INT(slotTypes) - GHIDRA_INT(piVar6); -joined_r0x00814770: - allocSize = allocSize + 0x23; - if (0x1f < iVar5 - 4U) { -LAB_00814776: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - } - else { - bVar2 = Game::IsGreedMode(g_game); - if ((bVar2 != 0) || - (((iVar5 == 2 && (uVar3 = *GHIDRA_CAST((*GHIDRA_CAST((slotOffset + 0x10)) + 0x10)), 99 < uVar3)) && - (uVar3 < 0x78)))) { - *GHIDRA_CAST((slotOffset + 0x94)) = 3; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x96)) = 0; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x98)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9a)) = 9; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::Next(); - iVar5 = greed_shop_slot_type(uVar3); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9c)) = (short)iVar5; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::Next(); - iVar5 = greed_shop_slot_type(uVar3); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x9e)) = (short)iVar5; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::Next(); - iVar5 = greed_shop_slot_type(uVar3); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xa0)) = (short)iVar5; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::Next(); - iVar5 = greed_shop_slot_type(uVar3); - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xa2)) = (short)iVar5; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xac)) = 0; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::RandomInt(3); - if (uVar3 == 0) goto LAB_00814851; - uVar3 = (GHIDRA_CAST((&shopRng)))->RNG::RandomInt(8); - uVar4 = (uint16_t)uVar3; - uVar3 = shopRng._seed; - goto LAB_00814854; - } - slotTypes = GHIDRA_CAST(0x0); - piVar6 = GHIDRA_CAST(0x0); - slotTypesEnd = GHIDRA_CAST(0x0); - slotTypesCapacity = GHIDRA_CAST(0x0); - local_8 = 3; - local_18 = GHIDRA_CAST(0x0); - do { - if (slotTypesEnd == piVar6) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_18); - piVar6 = slotTypesCapacity; - } - else { - *slotTypesEnd = GHIDRA_INT(local_18); - slotTypesEnd = slotTypesEnd + 1; - } - local_18 = GHIDRA_CAST((GHIDRA_INT(local_18) + 1)); - } while (GHIDRA_INT(local_18) < 8); - local_18 = piVar6; - if (3 < this->_shopLevel) { - local_38 = 8; - if (slotTypesEnd == piVar6) { - msvc::vector::_Emplace_reallocate(slotTypesEnd,&local_38); - local_18 = slotTypesCapacity; - } - else { - *slotTypesEnd = 8; - slotTypesEnd = slotTypesEnd + 1; - } - } - piVar7 = slotTypesEnd; - piVar6 = slotTypes; - RNG::Shuffle(&shopRng,slotTypes,slotTypesEnd); - uVar3 = GHIDRA_INT(piVar7) - GHIDRA_INT(piVar6) >> 2; - iVar5 = 0; - local_38 = 8; - if (GHIDRA_INT(uVar3) < 8) { - local_38 = uVar3; - } - if (0 < GHIDRA_INT(local_38)) { - slotOffset = 0x94; - do { - piVar7 = piVar6 + iVar5; - iVar5 = iVar5 + 1; - *GHIDRA_CAST((slotOffset + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))))) = (short)*piVar7; - slotOffset = slotOffset + 2; - } while (iVar5 < GHIDRA_INT(local_38)); - } - if (shopRng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - bVar2 = (uint8_t)shopRng._shift1; - uVar3 = GHIDRA_UINT(shopRng._seed) >> (bVar2 & 0x1f) ^ shopRng._seed; - shift2 = (uint8_t)shopRng._shift2; - uVar3 = uVar3 << (shift2 & 0x1f) ^ uVar3; - shift3 = (uint8_t)shopRng._shift3; - uVar3 = uVar3 >> (shift3 & 0x1f) ^ uVar3; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x94 + (uVar3 & 1) * 2)) = 8; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xac)) = 0; - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = uVar3 >> (bVar2 & 0x1f) ^ uVar3; - uVar3 = uVar3 << (shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> (shift3 & 0x1f) ^ uVar3; - if (uVar3 % 3 == 0) { - uVar4 = 0xffff; - } - else { - if (uVar3 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar3 = uVar3 >> (bVar2 & 0x1f) ^ uVar3; - uVar3 = uVar3 << (shift2 & 0x1f) ^ uVar3; - uVar3 = uVar3 >> (shift3 & 0x1f) ^ uVar3; - uVar4 = (uint16_t)(uVar3 % 6); - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0xae)) = uVar4; - if (slotTypes == GHIDRA_CAST(0x0)) goto LAB_0081485e; - allocSize = GHIDRA_INT(local_18) - GHIDRA_INT(slotTypes) & 0xfffffffc; - piVar6 = slotTypes; - if (0xfff < allocSize) { - piVar6 = GHIDRA_CAST(slotTypes[-1]); - iVar5 = GHIDRA_INT(slotTypes) - GHIDRA_INT(piVar6); - goto joined_r0x00814770; - } - } - operator_delete(piVar6,allocSize); - } -LAB_0081485e: - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x60)) = uVar3; - ExceptionList = local_10; - return; -} - -// 00814980 -int Room::shop_ware_roll(uint32_t *param_1, uint32_t *param_2, int *param_3, uint32_t param_4) -{ - short *psVar1; - uint16_t *puVar2; - uint32_t uVar3; - uint32_t uVar4; - int shopItemId; - int iVar5; - Room *in_ECX; - - if (*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x4)))) + 0xac)) < 0) { - init_shop_item_slots(in_ECX); - } - uVar3 = (in_ECX->_shopItemDeque)._size; - if (uVar3 == 0) { - shopItemId = GHIDRA_INT(*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x4)))) + 0xac))); - } - else { - uVar4 = (in_ECX->_shopItemDeque)._offset; - shopItemId = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT((in_ECX->_shopItemDeque)._map) + - (uVar4 >> 1 & (in_ECX->_shopItemDeque)._mapSize - 1) * 4)) + 4 + - (uVar4 & 1) * 8)); - } - pickup_roll_random_variant(in_ECX,shopItemId,GHIDRA_CAST(param_1),param_2,param_4); - iVar5 = GetShopItemPrice(in_ECX,*param_1,*param_2,shopItemId,GHIDRA_CAST(0x0)); - *param_3 = iVar5; - iVar5 = _Room::ResolveHeartSubType(shopItemId,iVar5,0); - *param_3 = iVar5; - if (uVar3 == 0) { - psVar1 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x4)))) + 0xac)); - *psVar1 = *psVar1 + 1; - puVar2 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x4)))) + 0xac)); - *puVar2 = *puVar2 & 7; - } - return shopItemId; -} - -// 008151e0 -int Room::GetShopItemPrice(uint32_t variant, int subType, int shopItemId, Entity_Player *player) -{ - code *pcVar1; - uint8_t bVar2; - uint8_t isNullEffectActive; - Entity_Player *foundPlayer; - int iVar3; - uint32_t coinFlip; - uint32_t uVar4; - ItemConfig_Item *collectibleConfig; - int extraout_ECX; - char isPoundOfFlesh; - uint32_t unaff_EBX; - undefined3 uVar5; - RNG priceRng; - uint32_t local_38; - PlayerManager *playerManager; - Entity_Player *bargainOwner; - uint32_t seed; - Room *room; - uint32_t local_24; - Entity_Player *local_20; - char isKeeperPricing; - RNG bargainRng; - uint32_t local_8; - short shopSlotType; - - local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - local_20 = player; - priceRng._shift1 = 5; - priceRng._shift2 = 9; - priceRng._seed = subType + variant | *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)) & 0xfffff800; - local_38 = 7; - priceRng._shift3 = 7; - uVar5 = (undefined3)(GHIDRA_UINT(unaff_EBX) >> 8); - seed = priceRng._seed; - room = this; - if (player == GHIDRA_CAST(0x0)) { - bargainOwner = PlayerManager::FirstTrinketOwner(&g_game->_playerManager,0xab); - foundPlayer = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x2a0,GHIDRA_CAST(&g_game->_playerManager),1); - uVar4 = CONCAT31(uVar5,foundPlayer != GHIDRA_CAST(0x0)); - playerManager = &g_game->_playerManager; - local_24 = uVar4; - foundPlayer = PlayerManager::FirstPlayerByType(playerManager,0xe); - if (foundPlayer != GHIDRA_CAST(0x0)) goto LAB_00815375; - foundPlayer = PlayerManager::FirstPlayerByType(playerManager,0x21); - if (foundPlayer != GHIDRA_CAST(0x0)) goto LAB_00815375; - if ((bargainOwner != GHIDRA_CAST(0x0)) && - (bVar2 = (GHIDRA_CAST((bargainOwner)))->Entity_Player::HasTrinket(0xab,0), bVar2 != 0)) { - iVar3 = (GHIDRA_CAST((bargainOwner)))->Entity_Player::GetTrinketMultiplier(0xab); - if (iVar3 < 2) { - bargainRng._seed = seed; - bargainRng._shift1 = 0xf; - bargainRng._shift2 = 1; - bargainRng._shift3 = 0x1d; - coinFlip = (GHIDRA_CAST((&bargainRng)))->RNG::RandomInt(2); - if (coinFlip != 0) goto LAB_008152fc; - } - goto LAB_00815375; - } -LAB_008152fc: - isKeeperPricing = '\0'; - } - else { - bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x2a0,0); - uVar4 = CONCAT31(uVar5,bVar2); - local_24 = uVar4; - if ((local_20->_playerType != 0xe) && (local_20->_playerType != 0x21)) { - bVar2 = (GHIDRA_CAST((local_20)))->Entity_Player::HasTrinket(0xab,0); - if (bVar2 == 0) goto LAB_008152fc; - iVar3 = (GHIDRA_CAST((local_20)))->Entity_Player::GetTrinketMultiplier(0xab); - if (iVar3 < 2) { - bargainRng._seed = seed; - bargainRng._shift1 = 0xf; - bargainRng._shift2 = 1; - bargainRng._shift3 = 0x1d; - coinFlip = (GHIDRA_CAST((&bargainRng)))->RNG::RandomInt(2); - if (coinFlip != 0) { - isKeeperPricing = '\0'; - goto LAB_00815377; - } - } - } -LAB_00815375: - isKeeperPricing = '\x01'; - } -LAB_00815377: - isPoundOfFlesh = (char)uVar4; - if (g_game->_currentRoomIdx == -0xd) { - if (300 < variant) { - if (variant != 0x15e) { - return 5; - } - if ((isPoundOfFlesh == '\0') || (isKeeperPricing != '\0')) { - return 0xf; - } - return -5; - } - if (variant == 300) { - if ((isPoundOfFlesh == '\0') || (isKeeperPricing != '\0')) { - return 6; - } - return -5; - } - if (variant == 10) { - if ((isPoundOfFlesh != '\0') && (isKeeperPricing == '\0')) { - return -5; - } - if (subType == 4) { - return 0xf; - } - if ((subType == 0xb) || (subType == 6)) { - return 8; - } - if (subType == 3) { - return 6; - } - return 5; - } - if (variant != 100) { - return 5; - } - if ((isPoundOfFlesh != '\0') && (isKeeperPricing == '\0')) { - uVar4 = (GHIDRA_CAST((&priceRng)))->RNG::RandomInt(2); - return -1 - GHIDRA_UINT((uVar4 != 0)); - } - iVar3 = 0x1e; - if ((-1 < shopItemId) && (GHIDRA_UINT(shopItemId) < 8)) { - shopSlotType = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x94 + shopItemId * 2)); - if ((shopSlotType == 0xc) || (shopSlotType == 0xd)) { - iVar3 = 0x32; - } - else if (shopSlotType == 0xe) { - uVar4 = (GHIDRA_CAST((&priceRng)))->RNG::RandomInt(0x50); - return uVar4 + 0x14; - } - } - uVar4 = (GHIDRA_CAST((&priceRng)))->RNG::RandomInt(iVar3 - 0xe); - return uVar4 + 0xf; - } - iVar3 = room->_roomType; - if (((((iVar3 != 0xe) && (iVar3 != 0x16)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)) >> 0xb & 1) == 0)) && - ((iVar3 != 5 || - (((g_game->_levelStateFlags & 0x20000U) == 0 && - (foundPlayer = PlayerManager::FirstPlayerByType(&g_game->_playerManager,0x21), - foundPlayer == GHIDRA_CAST(0x0))))))) && (shopItemId != -2)) { - if (variant == 10) { - if ((subType == 1) || (subType == 2)) { - if ((isPoundOfFlesh == '\0') || (isKeeperPricing != '\0')) { - return 3; - } - return -5; - } - } - else if (variant == 0x28) { - if (subType == 4) { -LAB_008155cf: - if ((isPoundOfFlesh == '\0') || (isKeeperPricing != '\0')) { - return 10; - } - return -5; - } - } - else if (variant == 0x1e) { - if (subType == 2) goto LAB_008155cf; - } - else if (variant == 100) { - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,subType); - if ((isPoundOfFlesh != '\0') && (isKeeperPricing == '\0')) { - if (collectibleConfig == GHIDRA_CAST(0x0)) { - return -1; - } - return -GHIDRA_INT(collectibleConfig->devilprice); - } - if (collectibleConfig == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Room::GetShopItemPrice: no config for collectible %d.\n")); - return 0xf; - } - iVar3 = GHIDRA_INT(collectibleConfig->shopPrice); - if (room->_roomType != 0xf) { - return iVar3; - } - if (iVar3 != 0xf) { - return iVar3; - } - if (collectibleConfig->devilprice == 2) { - return 0x1e; - } - return 0xf; - } - if ((isPoundOfFlesh == '\0') || (isKeeperPricing != '\0')) { - return GHIDRA_UINT((variant == 0x45)) * 2 + 5; - } - return -5; - } - if (local_20 == GHIDRA_CAST(0x0)) { - bVar2 = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0xad); - } - else { - bVar2 = (GHIDRA_CAST((local_20)))->Entity_Player::HasTrinket(0xad,0); - if (((bVar2 == 0) && (iVar3 = (GHIDRA_CAST((local_20)))->Entity_Player::GetHealthType(), iVar3 != 2)) && - (*GHIDRA_CAST((extraout_ECX + 0x13c0)) != 0x27)) { - isNullEffectActive = - (GHIDRA_CAST((GHIDRA_CAST((extraout_ECX + 0x1508)))))->TemporaryEffects::HasNullEffect(0x70); - bVar2 = 0; - if (isNullEffectActive == 0) goto LAB_008156ef; - } - bVar2 = 1; - } -LAB_008156ef: - if ((isKeeperPricing != '\0') && (local_24 = uVar4 & 0xff, bVar2 == 0)) { - local_24 = 1; - } - if (variant == 100) { - collectibleConfig = ItemConfig::GetCollectible(&g_manager->_itemConfig,subType); - if (collectibleConfig == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] Room::GetShopItemPrice: no config for collectible %d.\n")); - if (seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - iVar3 = (*pcVar1)(); - return iVar3; - } - uVar4 = seed >> ((uint8_t)priceRng._shift1 & 0x1f) ^ seed; - uVar4 = uVar4 << ((uint8_t)priceRng._shift2 & 0x1f) ^ uVar4; - uVar4 = ~(uVar4 >> ((uint8_t)local_38 & 0x1f) ^ uVar4) | 0xfffffffe; - } - else { - uVar4 = (collectibleConfig->devilprice < 2) - 2; - } - if ((char)local_24 != '\0') { - iVar3 = 0xf; - if (uVar4 == 0xfffffffe) { - iVar3 = 0x1e; - } - return iVar3; - } - if ((collectibleConfig != GHIDRA_CAST(0x0)) && - (bVar2 = (GHIDRA_CAST((collectibleConfig)))->Item::HasTags(0x200000000), bVar2 != 0)) { - uVar4 = 0xfffffff6; - } - } - else { - uVar4 = 0xfffffffb; - if ((char)local_24 != '\0') { - return 5; - } - } - return uVar4; -} - -// 00815800 -void Room::TriggerRestock(int grid_idx, int shop_idx) -{ - int iVar1; - uint32_t uVar2; - void *pvVar3; - uint32_t uVar4; - uint32_t *dequeSize; - uint32_t mapSize; - - this->_shopRestockTimer = 0x1e; - uVar4 = (this->_shopItemDeque)._size; - uVar2 = (this->_shopItemDeque)._offset; - if (((uVar2 + uVar4 & 1) == 0) && ((this->_shopItemDeque)._mapSize <= uVar4 + 2 >> 1)) { - msvc::deque::_Growmap(uVar4); - uVar2 = (this->_shopItemDeque)._offset; - uVar4 = (this->_shopItemDeque)._size; - } - mapSize = (this->_shopItemDeque)._mapSize; - uVar2 = mapSize * 2 - 1 & uVar2; - uVar4 = uVar4 + uVar2; - (this->_shopItemDeque)._offset = uVar2; - uVar2 = mapSize - 1 & uVar4 >> 1; - pvVar3 = (this->_shopItemDeque)._map; - iVar1 = uVar2 * 4; - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + uVar2 * 4)) == 0) { - pvVar3 = operator_new(0x10); - *(void **)(iVar1 + GHIDRA_INT((this->_shopItemDeque)._map)) = pvVar3; - pvVar3 = (this->_shopItemDeque)._map; - } - iVar1 = *GHIDRA_CAST((iVar1 + GHIDRA_INT(pvVar3))); - uVar4 = uVar4 & 1; - *GHIDRA_CAST((iVar1 + uVar4 * 8)) = grid_idx; - *GHIDRA_CAST((iVar1 + 4 + uVar4 * 8)) = shop_idx; - dequeSize = &(this->_shopItemDeque)._size; - *dequeSize = *dequeSize + 1; - return; -} - -// 008158a0 -void Room::ShopRestockPartial() -{ - code *pcVar1; - Entity *pEVar2; - uint32_t uVar3; - uint32_t blockSlot; - uint32_t spawnSeed; - Vector spawnPos; - uint32_t xorshiftShift; - int dequeBlock; - uint32_t *dequeCounter; - char restockCount; - int shopItemIdx; - - if (this->_roomType != 2) { - KAGE_LogMessage(1,GHIDRA_CAST("[warn] restock disabled for room type %d.\n")); - return; - } - spawnSeed = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x5c)); - xorshiftShift = 7; - if ((this->_shopItemDeque)._size != 0) { - while( true ) { - uVar3 = (this->_shopItemDeque)._offset; - blockSlot = uVar3 & 1; - dequeBlock = *GHIDRA_CAST((GHIDRA_INT((this->_shopItemDeque)._map) + - (uVar3 >> 1 & (this->_shopItemDeque)._mapSize - 1) * 4)); - shopItemIdx = *GHIDRA_CAST((dequeBlock + 4 + blockSlot * 8)); - uVar3 = *GHIDRA_CAST((dequeBlock + blockSlot * 8)); - if (-1 < shopItemIdx) { - restockCount = *GHIDRA_CAST((shopItemIdx + 0xa4 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))))); - if (restockCount != -1) { - *GHIDRA_CAST((shopItemIdx + 0xa4 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))))) = restockCount + '\x01'; - } - } - spawnPos.x = (float)(GHIDRA_INT(uVar3) % this->_gridWidth) * 40.0 + 40.0; - spawnPos.y = (float)(GHIDRA_INT(uVar3) / this->_gridWidth) * 40.0 + 120.0; - if ((uVar3 < 0x1c0) && (this->_gridEntities[uVar3] != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_gridEntities[uVar3]) + 0x14))(1); - } - if (spawnSeed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - spawnSeed = spawnSeed >> 2 ^ spawnSeed; - spawnSeed = spawnSeed << 7 ^ spawnSeed; - spawnSeed = spawnSeed >> ((uint8_t)xorshiftShift & 0x1f) ^ spawnSeed; - pEVar2 = Game::Spawn(g_game,5,0x96,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,spawnSeed); - pEVar2->_spawnGridIndex = uVar3; - uVar3 = Random(); - Game::Spawn(g_game,1000,0xf,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3); - KAGE_LogMessage(1,GHIDRA_CAST("Spawn shop pickup (restock), Pos(%.2f,%.2f)\n")); - dequeCounter = &(this->_shopItemDeque)._size; - *dequeCounter = *dequeCounter - 1; - if (*dequeCounter == 0) break; - dequeCounter = &(this->_shopItemDeque)._offset; - *dequeCounter = *dequeCounter + 1; - } - (this->_shopItemDeque)._offset = 0; - } - if (spawnSeed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - spawnSeed = spawnSeed >> 2 ^ spawnSeed; - spawnSeed = spawnSeed << 7 ^ spawnSeed; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x5c)) = spawnSeed >> ((uint8_t)xorshiftShift & 0x1f) ^ spawnSeed - ; - return; -} - -// 00815ae0 -void Room::ShopRestockFull() -{ - code *pcVar1; - uint32_t uVar2; - Entity_Player *player; - int *pickup; - uint64_t *pickedEntry; - uint32_t nextSeed; - Entity *spawned; - int iVar3; - short *spawnEntry; - uint64_t *allocatedBytes; - uint32_t uVar4; - uint32_t uVar5; - float dy; - float dx; - EntityList_EL shopPickups; - EntityList_EL roomPickups; - Vector freePos; - uint32_t spawnRngShift3; - uint32_t gridIndex; - uint32_t rngShift3; - uint32_t spawnIndex; - Room *room; - uint32_t spawnSeed; - Vector spawnPos; - uint32_t uStack_24; - uint64_t entry; - uint32_t uStack_18; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - uint64_t prevAllocatedBytes; - short spawnX; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00b01635; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - room = this; - if ((this->_roomType == 2) || (this->_roomType == 0x16)) { - this->_shopRestockTimer = -1; - msvc::deque::_Tidy(local_14); - init_shop_item_slots(this); - spawnSeed = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x5c)); - rngShift3 = 7; - KAGE_LogMessage(1,GHIDRA_CAST("SpawnRNG seed: %u\n")); - EntityList::QuerySublist(&this->_entityList,&shopPickups,5,-1,-1,0,0); - uVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&(shopPickups)) + 0x4))); - uStack_8 = 0; - uVar4 = 0; - if (shopPickups._size != 0) { - do { - pickup = GHIDRA_CAST(__RTDynamicCast(*GHIDRA_CAST((uVar2 + uVar4 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor)); - if (pickup[0x14d] != 0) { - (**(code **)(*pickup + 0x28))(); - } - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT(shopPickups._size)); - this = room; - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - spawnIndex = 0; - if (*GHIDRA_CAST((*GHIDRA_CAST((iVar3 + 0x10)) + 0x44)) != 0) { - uStack_24 = 0; - uVar4 = spawnSeed; - do { - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> 2 ^ uVar4; - uVar4 = uVar4 << 7 ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar4; - spawnEntry = GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((iVar3 + 0x10)) + 0x40)) + uStack_24)); - spawnX = *spawnEntry; - iVar3 = (spawnEntry[1] + 1) * this->_gridWidth; - uVar5 = spawnX + 1 + iVar3; - gridIndex = uVar5; - spawnSeed = uVar4; - if ((char)spawnEntry[4] != '\0') { - pickedEntry = (GHIDRA_CAST((spawnEntry)))->Spawn::PickEntry((float)((double)GHIDRA_INT(uVar4) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10); - entry = *pickedEntry; - uStack_18 = *GHIDRA_CAST((pickedEntry + 1)); - spawnRngShift3 = 7; - TransformEntry(this,&entry,uVar5,uVar4); - if ((GHIDRA_UINT(entry) == 5) && ((*GHIDRA_CAST((GHIDRA_CAST(&(entry)) + 0x4))) == 0x96)) { - spawnPos.x = (float)(GHIDRA_INT(uVar5) % this->_gridWidth) * 40.0 + 40.0; - spawnPos.y = (float)(GHIDRA_INT(uVar5) / this->_gridWidth) * 40.0 + 120.0; - if ((uVar5 < 0x1c0) && (this->_gridEntities[iVar3 + spawnX + 1] != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(this->_gridEntities[iVar3 + spawnX + 1]) + 0x14))(1); - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&roomPickups,5,-1,-1,1,0); - uVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&(roomPickups)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x0))) = 1; - uVar4 = 0; - if (roomPickups._size != 0) { - do { - iVar3 = __RTDynamicCast(*GHIDRA_CAST((uVar2 + uVar4 * 4)),0, - &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor); - if ((iVar3 != 0) && - (dx = spawnPos.x - *GHIDRA_CAST((iVar3 + 0x33c)), - dy = spawnPos.y - *GHIDRA_CAST((iVar3 + 0x340)), dy * dy + dx * dx < 900.0)) { - FindFreePickupSpawnPosition(g_game->_room,&freePos,&spawnPos,10.0,0,0,0); - *GHIDRA_CAST((iVar3 + 0x33c)) = freePos.x; - *GHIDRA_CAST((iVar3 + 0x340)) = freePos.y; - *GHIDRA_CAST((iVar3 + 0x334)) = freePos.x; - *GHIDRA_CAST((iVar3 + 0x338)) = freePos.y; - *GHIDRA_CAST((iVar3 + 0x544)) = 0x14; - } - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT(roomPickups._size)); - uVar5 = gridIndex; - } - uStack_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(uStack_8))) + 0x1))) << 8; - if ((*GHIDRA_CAST((GHIDRA_CAST(&(roomPickups)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if (uVar2 != 0) { - uVar4 = *GHIDRA_CAST((uVar2 + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar4)); - free((void *)(uVar2 + -4)); - } - uStack_8 = uStack_8 & 0xffffff00; - } - uVar4 = spawnSeed; - if (spawnSeed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - nextSeed = spawnSeed >> 5 ^ spawnSeed; - nextSeed = nextSeed << 9 ^ nextSeed; - spawned = Game::Spawn(g_game,GHIDRA_UINT(entry),(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entry))) + 0x4))),&spawnPos,&g_vectorZero, - GHIDRA_CAST(0x0),(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(entry))) + 0x6))), - nextSeed >> ((uint8_t)spawnRngShift3 & 0x1f) ^ nextSeed); - spawned->_spawnGridIndex = uVar5; - uVar5 = Random(); - Game::Spawn(g_game,1000,0xf,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar5); - KAGE_LogMessage(1,GHIDRA_CAST("Spawn Entity with Type(%d), Variant(%d), Pos(%.2f,%.2f)\n")); - this = room; - } - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - uStack_24 = uStack_24 + 0x10; - spawnIndex = spawnIndex + 1; - } while (spawnIndex < *GHIDRA_CAST((*GHIDRA_CAST((iVar3 + 0x10)) + 0x44))); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(shopPickups)) + 0x0))) == '\0') { - if (g_mainHeap == (void *)0x0) { - allocatedBytes = &g_allocatedBytesNoHeap; - } - else { - allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&(shopPickups)) + 0x4))) != 0) { - uVar4 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(shopPickups)) + 0x4))) + -4)); - prevAllocatedBytes = *allocatedBytes; - *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar4; - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar4)); - free(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(shopPickups)) + 0x4))) + -4))); - } - } - } - else { - player = Game::GetPlayer(g_game,0); - Entity_Player::UseActiveItem(player,GHIDRA_CAST((GHIDRA_INT(&uStack_24) + 2)),0x69,1,-1,0); - } - ExceptionList = local_10; - return; -} - -// 00816000 -void Room::ShopReshuffle(uint8_t isKeepCollectibleIdx, uint8_t isReselectSaleItem) -{ - code *pcVar1; - int *begin; - uint32_t uVar2; - short *shopSlot; - int *shuffledCursor; - uint32_t slotCount; - uint16_t *shopSlotOut; - int *end; - int iVar3; - RNG rng; - int swappedValue; - int *shuffledSlot; - short *local_1c; - Room *room; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0166d; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - rng._shift1 = 5; - rng._shift2 = 9; - rng._seed = *GHIDRA_CAST((iVar3 + 0x60)); - rng._shift3 = 7; - local_1c = GHIDRA_CAST((iVar3 + 0xa4)); - room = this; - begin = msvc::_Allocate(0x20); - end = begin; - for (shopSlot = GHIDRA_CAST((iVar3 + 0x94)); shopSlot != local_1c; shopSlot = shopSlot + 1) { - *end = GHIDRA_INT(*shopSlot); - end = end + 1; - } - local_8 = 0; - RNG::Shuffle(&rng,begin,end); - if (isKeepCollectibleIdx != 0) { - local_1c = GHIDRA_CAST(0x94); - shuffledSlot = begin; - do { - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + GHIDRA_INT(local_1c))) == 8) && - (swappedValue = *shuffledSlot, swappedValue != 8)) { - uVar2 = 0; - slotCount = GHIDRA_INT(end) - GHIDRA_INT(begin) >> 2; - if (slotCount != 0) { - shopSlot = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x94)); - do { - if ((*shopSlot != 8) && (begin[uVar2] == 8)) { - *shuffledSlot = 8; - begin[uVar2] = swappedValue; - break; - } - uVar2 = uVar2 + 1; - shopSlot = shopSlot + 1; - } while (uVar2 < slotCount); - } - } - shuffledSlot = shuffledSlot + 1; - local_1c = local_1c + 1; - } while (local_1c < GHIDRA_CAST(0xa4)); - } - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))); - shuffledCursor = begin; - shopSlotOut = GHIDRA_CAST((iVar3 + 0x94)); - if (begin != end) { - do { - iVar3 = *shuffledCursor; - shuffledCursor = shuffledCursor + 1; - *shopSlotOut = (short)iVar3; - shopSlotOut = shopSlotOut + 1; - } while (shuffledCursor != end); - iVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))); - } - uVar2 = rng._seed; - if (isReselectSaleItem != 0) { - if (rng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar2 = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed; - uVar2 = uVar2 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar2; - uVar2 = uVar2 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar2; - if (uVar2 == (uVar2 / 3) * 3) { - *GHIDRA_CAST((iVar3 + 0xae)) = 0xffff; - } - else { - if (uVar2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar2 = uVar2 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar2; - uVar2 = uVar2 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar2; - uVar2 = uVar2 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar2; - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0xae)) = (uint16_t)uVar2 & 7; - } - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x60)) = uVar2; - if (begin != GHIDRA_CAST(0x0)) { - operator_delete(begin,0x20); - } - ExceptionList = local_10; - return; -} - -// 008167e0 -void Room::RemoveDoor(int doorSlot) -{ - uint32_t uVar1; - int gridIdx; - GridEntity *wall; - int gridIdx; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b016b7; - local_10 = ExceptionList; - uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - if ((GHIDRA_UINT(doorSlot) < 8) && (this->_doors[doorSlot] != (void *)0x0)) { - gridIdx = this->_doorGridPositions[doorSlot]; - if (gridIdx < 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("invalid GridIndex while removing door (slot %d)")); - } - if (gridIdx < 1) { - gridIdx = 0; - } - gridIdx = 0x1bf; - if (gridIdx < 0x1bf) { - gridIdx = gridIdx; - } - gridIdx = __RTDynamicCast(this->_gridEntities[gridIdx],0, - &IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Door::RTTI_Type_Descriptor,0,uVar1); - if (gridIdx != 0) { - if (this->_gridEntities[gridIdx] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[gridIdx]))(1); - } - this->_gridEntities[gridIdx] = (void *)0x0; - } - this->_doors[doorSlot] = (void *)0x0; - wall = operator_new(0x154); - local_8 = 5; - if (wall == GHIDRA_CAST(0x0)) { - wall = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((wall)))->GridEntity::GridEntity(); - *GHIDRA_CAST(wall) = IsaacRepentancePlus::GridEntity_Wall::vftable; - } - local_8 = 0xffffffff; - if (wall != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((wall)) + 0x4)))) = 0xf; - wall->_gridIndex = gridIdx; - this->_gridEntities[gridIdx] = wall; - uVar1 = Random(); - (GHIDRA_CAST((wall)))->GridEntity::Init(uVar1); - } - } - ExceptionList = local_10; - return; -} - -// 00816910 -void Room::SpawnGreedModeWave(uint8_t unusedBool) -{ - int *piVar1; - code *pcVar2; - char cVar3; - uint32_t uVar4; - float bossWave; - Entity *spawned; - Entity_Pickup *coin; - uint32_t rngResult; - uint32_t *playerSlot; - Vector *freePos; - uint64_t *pickedEntry; - EntityConfig_Entity *entityConfig; - uint8_t rngShiftLeft; - MusicManager *musicManager; - uint32_t extraout_ECX; - int iVar5; - void *pvVar6; - uint32_t extraout_ECX_00; - int iVar7; - void **doorSlot; - float bossWave; - PlayerManager *playerManager; - int spawnX; - uint32_t uVar9; - uint32_t *puVar10; - uint32_t rngResult; - Room *pRVar12; - Room *door; - bool bVar13; - uint32_t uVar14; - TypeDescriptor *pTVar15; - TypeDescriptor *pTVar16; - uint32_t uVar17; - EntityRef destroySource; - Vector coinPos; - Vector VStack_a8; - float local_a0; - float local_9c; - void *championCandidates; - uint32_t *championCandidatesEnd; - uint32_t *championCandidatesCapacity; - uint64_t rngShifts; - uint32_t local_80; - uint32_t local_7c; - uint32_t rngState; - Vector VStack_74; - Room *savedRoom; - uint32_t local_68; - uint32_t local_64; - RoomConfig_Room *local_60; - uint32_t local_5c; - uint32_t local_58; - uint32_t local_54; - uint64_t spawnEntry; - uint32_t uStack_48; - ColorMod particleColor; - uint32_t stackCookie; - void *savedExceptionList; - uint8_t *puStack_c; - int ehState; - GridEntity_Door *door; - Game *game; - Manager *manager; - RoomConfig_Room *waveRoom; - - ehState = -1; - puStack_c = &LAB_00b016f0; - savedExceptionList = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT(((&particleColor)[1]._colorize + 1)); - ExceptionList = &savedExceptionList; - iVar7 = 8; - local_5c = 3; - iVar5 = g_game->_stage; - if (g_game->_difficulty == 2) { - if (iVar5 == 3) { - iVar7 = 7; - } - else if (iVar5 == 4) { - iVar7 = 6; - } - if (((g_manager->_persistentGameData)._achievements[0xf6] == 0) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || - (((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) { - bVar13 = false; - } - else { - bVar13 = true; - } - local_58 = iVar7 + -1; - if (!bVar13) { - local_58 = iVar7; - } - local_68 = 0x19; - if (!bVar13) { - local_68 = 0x1c; - } - } - else { - if (iVar5 == 1) { - local_58 = 9; - } - else if (iVar5 == 2) { - local_58 = 7; - } - else if (iVar5 == 3) { - local_58 = 5; - } - else { - local_58 = (iVar5 == 4) + 3; - } - local_68 = 0xf; - local_5c = 0; - } - doorSlot = this->_doors; - puVar10 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)); - *puVar10 = *puVar10 & 0xfffffffe; - local_64 = 8; - savedRoom = this; - stackCookie = uVar4; - do { - door = *doorSlot; - if (door != GHIDRA_CAST(0x0)) { - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0xc)))) != 1) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0xc)))) = 1; - (GHIDRA_CAST((door)))->GridEntity_Door::UpdateAnimation(); - iVar7 = door->_currentRoomType; - if (((((iVar7 == 7) || (iVar5 = door->_targetRoomType, iVar5 == 7)) || (iVar7 == 8)) || - ((iVar5 == 8 || (iVar7 == 0x1d)))) || (iVar5 == 0x1d)) { - (GHIDRA_CAST(((door->_openAnimation)._buf)))->msvc::string::assign(s_Open,4); - } - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((*doorSlot))) + 0x8)))) == 8) { - (GHIDRA_CAST((*doorSlot)))->GridEntity_Door::Bar(uVar4); - } - } - game = g_game; - doorSlot = doorSlot + 1; - local_64 = local_64 + -1; - } while (local_64 != 0); - local_7c = RoomConfig::GetStageID(g_game->_stage,g_game->_stageType,-1); - iVar7 = game->_greedModeWave; - VStack_74.y = (float)&game->_roomConfig; - local_60 = GHIDRA_CAST(0x1); - bossWave = (float)(iVar7 + 1); - local_54 = 10; - uVar4 = -GHIDRA_UINT((bossWave != 0.0)) & GHIDRA_UINT(bossWave); - if (uVar4 < 0xc) { - game->_greedModeWave = uVar4; - if (uVar4 - 1 < 0xc) goto LAB_00816b00; - rngState = 0; - } - else { - game->_greedModeWave = 0xc; - uVar4 = 0xc; -LAB_00816b00: - rngState = game->_greedWaveSeeds[uVar4 - 1]; - } - local_64 = 0x1b; - local_80 = 0x1b; - rngShifts = 0x1b00000001; - local_9c = (float)((game->_difficulty == 3) + 9); - VStack_a8.y = (float)((-GHIDRA_UINT((GHIDRA_UINT(bossWave) < GHIDRA_UINT(local_9c))) & 6) + 5); - if (game->_difficulty == 2) { - switch(iVar7) { - case 0: - case 1: - case 2: - case 8: - goto switchD_00816b56_caseD_0; - case 3: - case 4: - case 5: - case 9: - goto switchD_00816b56_caseD_3; - case 6: - case 7: - case 10: - goto switchD_00816b56_caseD_6; - } - } - else { - switch(iVar7) { - case 0: - case 1: - case 2: - case 9: -switchD_00816b56_caseD_0: - local_60 = GHIDRA_CAST(0x1); - local_54 = 1; - break; - case 3: - case 4: - case 5: - case 10: -switchD_00816b56_caseD_3: - local_60 = GHIDRA_CAST(0x5); - local_54 = 5; - break; - case 6: - case 7: - case 8: - case 0xb: -switchD_00816b56_caseD_6: - local_60 = GHIDRA_CAST(0xa); - local_54 = 10; - } - } - if (GHIDRA_UINT(bossWave) < GHIDRA_UINT(local_9c)) { - savedRoom->_greedWaveTimer = (local_58 + iVar7) * 0x1e; - local_5c = game->_difficulty; - local_58 = (local_5c == 2) + 1; - } - else { - savedRoom->_greedWaveTimer = ((iVar7 + -6) * local_5c + local_68) * 0x1e; - local_5c = game->_difficulty; - local_58 = (local_5c == 2) + 3; - } - if (local_5c == 3) { - if (bossWave != 1.26117e-44) { - if (bossWave == 1.54143e-44) { - local_58 = local_58 + 3; - } - goto LAB_00816c08; - } - local_58 = local_58 + 1; -LAB_00816c3e: - savedRoom->_greedWaveTimer = -1; - local_5c = game->_difficulty; - } - else { -LAB_00816c08: - if (((bossWave == (float)((local_5c == 3) + 8)) || (bossWave == (float)((local_5c == 3) + 10))) || - ((local_5c == 3) + 0xb <= GHIDRA_UINT(bossWave))) goto LAB_00816c3e; - } - bossWave = (float)((local_5c == 3) + 0xb); - local_68 = 0; - if (bossWave != bossWave) { - local_68 = local_58; - } - local_a0 = bossWave; - if (GHIDRA_UINT(bossWave) < GHIDRA_UINT(local_9c)) { - if (local_7c == 0x18) { - MusicManager::Crossfade(&g_manager->_musicManager,0x26,0.08); - } - else { - MusicManager::EnableLayer(&g_manager->_musicManager,0,0); - } - } - else { - musicManager = &g_manager->_musicManager; - if (bossWave == bossWave) { - MusicManager::Crossfade(musicManager,0x17,0.08); - } - else if ((game->_stageType == 4) || (game->_stageType == 5)) { - MusicManager::Crossfade(musicManager,0x29,0.08); - } - else { - iVar7 = 9; - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedRoom)) + 0x4)))) + 0x44)) >> 6 & 1) != 0) { - iVar7 = 0x1a; - } - MusicManager::Crossfade(musicManager,iVar7,0.08); - } - } - game = g_game; - local_58 = local_68; - if (local_68 != 0) { - if ((g_game->_levelStateFlags & 0x800U) != 0) { - local_58 = local_68 - 1; - g_game->_levelStateFlags = g_game->_levelStateFlags & 0xfffff7ff; - } - } - iVar7 = game->_greedWavesClearedWithoutRedHeartDamage; - if ((0 < iVar7) && (iVar7 == (iVar7 / 3) * 3)) { - local_58 = local_58 + 1; - } - piVar1 = &game->_greedWavesClearedWithoutRedHeartDamage; - *piVar1 = *piVar1 + 1; - manager = g_manager; - local_68 = 0x367; - seed_fart_sound_override(GHIDRA_CAST(&local_68)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_68,1.0,3,0,1.0,0.0); - door = savedRoom; - local_9c = 0.0; - local_5c = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((savedRoom)) + 0x4)))) + 0x10)) + 0x48)); - if (rngState == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = rngState >> ((uint8_t)rngShifts & 0x1f) ^ rngState; - uVar4 = uVar4 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)local_64 & 0x1f) ^ uVar4; - local_60 = RoomConfig::GetRandomRoom - (GHIDRA_CAST(VStack_74.y),uVar4,0,local_7c,GHIDRA_INT(VStack_a8.y),local_5c,0,-1, - GHIDRA_INT(local_60),local_54,GHIDRA_CAST(&local_9c),0xffffffff,-1); - if (local_60 == GHIDRA_CAST(0x0)) { - KAGE_LogMessage(1,GHIDRA_CAST("Did not find wave level %d (greed mode).\n")); - ExceptionList = savedExceptionList; - return; - } - KAGE_LogMessage(1,GHIDRA_CAST("Spawning greed mode wave from room variant %d.\n")); - if (GHIDRA_UINT(g_game->_greedLastPaidWave) < GHIDRA_UINT(bossWave)) { - PlayerManager::trigger_room_clear(&g_game->_playerManager); - uVar9 = local_64; - VStack_74.y = (float)g_game->_room; - iVar5 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(VStack_74.y)))) + 0xc)))); - iVar7 = iVar5 / 2; - if (((iVar7 < 0) || (iVar5 <= iVar7)) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(VStack_74.y)))) + 0x10)))) < 5)) - { - iVar7 = -1; - } - else { - iVar7 = iVar7 + iVar5 * 4; - } - VStack_a8.x = (float)(iVar7 % iVar5) * 40.0 + 40.0; - VStack_a8.y = (float)(iVar7 / iVar5) * 40.0 + 120.0; - if (0 < GHIDRA_INT(local_58)) { - rngResult = local_58; - do { - FindFreePickupSpawnPosition(g_game->_room,&coinPos,&VStack_a8,0.0,0,0,0); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - uVar17 = 0; - pTVar16 = &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor; - pTVar15 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; - uVar4 = uVar4 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar4; - uVar14 = 0; - uVar4 = uVar4 >> ((uint8_t)uVar9 & 0x1f) ^ uVar4; - spawned = Game::Spawn(g_game,5,0x14,&coinPos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar4); - coin = GHIDRA_CAST(__RTDynamicCast(spawned,uVar14,pTVar15,pTVar16,uVar17)); - if (coin != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((coin)))->Entity_Pickup::AppearFast(); - } - particleColor._tint[0] = 1.0; - particleColor._tint[1] = 1.0; - particleColor._tint[2] = 1.0; - particleColor._tint[3] = 1.0; - particleColor._offset[0] = 0.0; - particleColor._offset[1] = 0.0; - particleColor._colorize[0] = 0.0; - particleColor._colorize[1] = 0.0; - particleColor._colorize[2] = 0.0; - particleColor._colorize[3] = 0.0; - particleColor._offset[2] = 0.0; - rngResult = Random(); - VStack_74.y = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * - 3.0 + 2.0; - rngResult = Random(); - Game::SpawnParticles - (g_game,&coinPos,0x5f,rngResult % 3 + 5,VStack_74.y,&particleColor,100000.0,0); - rngResult = rngResult - 1; - } while (rngResult != 0); - bossWave = local_a0; - door = savedRoom; - } - game = g_game; - local_5c = 0; - g_game->_greedLastPaidWave = GHIDRA_INT(bossWave); - playerManager = &game->_playerManager; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 - != 0) { - do { - pvVar6 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (playerManager->_playerList)._end; - } - playerSlot = (playerManager->_playerList)._begin; - if (local_5c < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) { - playerSlot = playerSlot + local_5c; - } - (GHIDRA_CAST((GHIDRA_CAST(*playerSlot))))->Entity_Player::spawn_locusts(); - playerManager = &g_game->_playerManager; - local_5c = local_5c + 1; - } while (local_5c < - GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - } - } - waveRoom = local_60; - *GHIDRA_CAST(door) = 0; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)local_64 & 0x1f) ^ uVar4; - uVar9 = local_64; - local_58 = uVar4; - if (door->_gridWidth != local_60->Width + 2) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Greed Mode wave does not match room size\n")); - uVar9 = extraout_ECX; - } - local_68 = 0; - if (waveRoom->SpawnCount != 0) { - local_5c = 0; - pRVar12 = door; - do { - door = savedRoom; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - iVar7 = pRVar12->_gridWidth; - uVar4 = uVar4 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)local_64 & 0x1f) ^ uVar4; - destroySource._type = 0; - destroySource._variant = 0; - destroySource._spawnerType = 0; - destroySource._spawnerVariant = 0; - destroySource._flags = 0; - destroySource._entity = (void *)0x0; - spawnX = GHIDRA_INT(*GHIDRA_CAST((local_5c + GHIDRA_INT(local_60->Spawns)))); - iVar5 = (*GHIDRA_CAST((local_5c + 2 + GHIDRA_INT(local_60->Spawns))) + 1) * iVar7; - local_a0 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10; - uVar9 = spawnX + iVar5 + 1; - destroySource._position.x = g_vectorZero.x; - destroySource._velocity.x = g_vectorZero.x; - destroySource._position.y = g_vectorZero.y; - destroySource._velocity.y = g_vectorZero.y; - VStack_74.x = (float)(GHIDRA_INT(uVar9) % iVar7) * 40.0 + 40.0; - VStack_74.y = (float)(GHIDRA_INT(uVar9) / iVar7) * 40.0 + 120.0; - if ((uVar9 < 0x1c0) && (savedRoom->_gridEntities[iVar5 + spawnX + 1] != GHIDRA_CAST(0x0))) { - (**(code **)(*GHIDRA_CAST(savedRoom->_gridEntities[iVar5 + spawnX + 1]) + 0x14))(1,&destroySource) - ; - } - piVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x10)); - if (((piVar1 != GHIDRA_CAST(0x0)) && (piVar1[2] == 0x10)) && (*piVar1 == 0x23)) goto LAB_00817335; - if (GHIDRA_INT(uVar9) < 0) { -LAB_008172a7: - freePos = FindFreePickupSpawnPosition(g_game->_room,&VStack_a8,&VStack_74,0.0,0,0,0); - VStack_74.x = freePos->x; - VStack_74.y = freePos->y; - iVar7 = GHIDRA_INT(((VStack_74.x - 40.0) / 40.0 + 0.5)); - iVar5 = GHIDRA_INT(((VStack_74.y - 120.0) / 40.0 + 0.5)); - if ((((iVar7 < 0) || (door->_gridWidth <= iVar7)) || (iVar5 < 0)) || - (door->_gridHeight <= iVar5)) { - uVar9 = 0xffffffff; - } - else { - uVar9 = iVar5 * door->_gridWidth + iVar7; - } - } - else if (door->_gridEntities[iVar5 + spawnX + 1] == (void *)0x0) { - if ((door->_gridPaths[iVar5 + spawnX + 1] - 3000U < 1000) || - (999 < door->_gridPaths[iVar5 + spawnX + 1])) goto LAB_008172a7; - } - else if (*GHIDRA_CAST((GHIDRA_INT(door->_gridEntities[iVar5 + spawnX + 1]) + 0x3c)) != 0) - goto LAB_008172a7; -LAB_00817335: - pvVar6 = (void *)(local_5c + GHIDRA_INT(local_60->Spawns)); - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 8)) != '\0') { - pickedEntry = (GHIDRA_CAST((pvVar6)))->Spawn::PickEntry(local_a0); - spawnEntry = *pickedEntry; - uStack_48 = *GHIDRA_CAST((pickedEntry + 1)); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - rngState = uVar4 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar4; - local_7c = rngState >> ((uint8_t)local_64 & 0x1f); - uVar4 = local_7c ^ rngState; - TransformEntry(door,&spawnEntry,uVar9,uVar4); - if (0 < GHIDRA_INT(spawnEntry)) { - if (GHIDRA_INT(spawnEntry) < 1000) { - rngShiftLeft = (uint8_t)((uint64_t)rngShifts >> 0x20); - if (GHIDRA_INT(spawnEntry) == 999) { - spawnEntry = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(spawnEntry)) + 0x4))),1000); - if (local_7c == rngState) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - uVar4 = uVar4 << (rngShiftLeft & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)local_64 & 0x1f) ^ uVar4; - spawned = Game::Spawn(g_game,1000,(*GHIDRA_CAST((GHIDRA_CAST(&(spawnEntry)) + 0x4))) & 0xffff,&VStack_74,&g_vectorZero, - GHIDRA_CAST(0x0),(*GHIDRA_CAST((GHIDRA_CAST(&(spawnEntry)) + 0x4))) >> 0x10,uVar4); - spawned->Update(); - spawned->_spawnGridIndex = uVar9; - door = savedRoom; - } - else { - if (local_7c == rngState) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - uVar4 = uVar4 << (rngShiftLeft & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)local_64 & 0x1f) ^ uVar4; - iVar7 = spawn_enemy_spawner_effect - (GHIDRA_INT(spawnEntry),(*GHIDRA_CAST((GHIDRA_CAST(&(spawnEntry)) + 0x4))),&VStack_74,local_64,0, - (*GHIDRA_CAST((GHIDRA_CAST(&(spawnEntry)) + 0x6))),uVar4,local_64,uVar9); - game = g_game; - *GHIDRA_CAST((iVar7 + 0x354)) = 0x3e9; - if ((((game != GHIDRA_CAST(0x0)) && (1 < *GHIDRA_CAST(&game->_deathmatchManager))) && - (GHIDRA_INT(spawnEntry) == 1)) || (GHIDRA_INT(spawnEntry) - 10U < 0x3de)) { - *GHIDRA_CAST((iVar7 + 0x16c)) = *GHIDRA_CAST((iVar7 + 0x16c)) | 0x80; - *GHIDRA_CAST((iVar7 + 0x168)) = *GHIDRA_CAST((iVar7 + 0x168)); - } - } - } - else { - SpawnEntry(door,uVar9,&spawnEntry,uVar4,GHIDRA_CAST(0x0),0); - } - } - } - uVar9 = local_68 + 1; - local_5c = local_5c + 0x10; - pRVar12 = door; - local_68 = uVar9; - } while (uVar9 < (uint16_t)local_60->SpawnCount); - local_58 = uVar4; - } - if (g_game->_difficulty != 3) goto LAB_008177a4; - championCandidates = (void *)0x0; - championCandidatesEnd = GHIDRA_CAST(0x0); - championCandidatesCapacity = GHIDRA_CAST(0x0); - ehState = 0; - FUN_005cbed0(uVar9); - uVar9 = extraout_ECX_00 & 0xffffff00; - puVar10 = championCandidatesEnd; - local_54 = uVar9; - if ((door->_entityList)._updateEL._size == 0) { -LAB_008176d1: - uVar9 = GHIDRA_INT(puVar10) - GHIDRA_INT(championCandidates) >> 2; - if (uVar9 != 0) { - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - uVar4 = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - rngShiftLeft = (uint8_t)((uint64_t)rngShifts >> 0x20); - uVar4 = uVar4 << (rngShiftLeft & 0x1f) ^ uVar4; - uVar4 = uVar4 >> ((uint8_t)local_64 & 0x1f) ^ uVar4; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - (*pcVar2)(); - return; - } - rngResult = uVar4 >> ((uint8_t)rngShifts & 0x1f) ^ uVar4; - rngResult = rngResult << (rngShiftLeft & 0x1f) ^ rngResult; - Entity_NPC::MakeChampion - (*GHIDRA_CAST((GHIDRA_CAST(championCandidates) + (uVar4 % uVar9) * 4)), - rngResult >> ((uint8_t)local_64 & 0x1f) ^ rngResult,-1,0); - } - } - else { - uVar4 = 0; - do { - piVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((door->_entityList)._updateEL)) + 0x4)))) + uVar4 * 4)); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (piVar1[10] != 1)) { - iVar7 = piVar1[10]; - if ((0x3dd < iVar7 - 10U) || (((iVar7 == 0x21 || (iVar7 == 0x11)) || (iVar7 == 0x124)))) - goto LAB_008176b6; - if (iVar7 == 0x375) { - bVar13 = piVar1[0xb] == 10; - } - else { - if ((iVar7 == 0x3c0) || (iVar7 == 0x3c5)) goto LAB_008176b6; - bVar13 = iVar7 == 0xf5; - } - uVar9 = local_54; - if (!bVar13) goto LAB_008175f1; - } - else { -LAB_008175f1: - if (*GHIDRA_CAST((GHIDRA_CAST(piVar1) + 0x173)) == '\0') { - cVar3 = (**(code **)(*piVar1 + 0x4c))(); - if ((cVar3 == '\0') && - (iVar7 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((door->_entityList)._updateEL)) + 0x4)))) + uVar4 * 4)), - g_game->_frameCount == *GHIDRA_CAST((iVar7 + 0x328)))) { - local_5c = __RTDynamicCast(iVar7,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0); - entityConfig = EntityConfig::GetEntity - (&g_manager->_entityConfig,*GHIDRA_CAST((local_5c + 0x28)), - *GHIDRA_CAST((local_5c + 0x2c)),*GHIDRA_CAST((local_5c + 0x30))); - if ((entityConfig != GHIDRA_CAST(0x0)) && (entityConfig->canBeChampion != 0)) - { - if (puVar10 == championCandidatesCapacity) { - msvc::vector::_Emplace_reallocate(puVar10,&local_5c); - } - else { - *puVar10 = local_5c; - championCandidatesEnd = puVar10 + 1; - } - local_54 = local_54 & 0xff; - if (*GHIDRA_CAST((local_5c + 0xc63)) != '\0') { - local_54 = 1; - } - uVar9 = local_54; - puVar10 = championCandidatesEnd; - goto LAB_008176b9; - } - } -LAB_008176b6: - uVar9 = local_54; - } - } -LAB_008176b9: - uVar4 = uVar4 + 1; - } while (uVar4 < GHIDRA_UINT((door->_entityList)._updateEL._size)); - uVar4 = local_58; - if ((char)uVar9 == '\0') goto LAB_008176d1; - } - if (championCandidates != (void *)0x0) { - uVar4 = GHIDRA_INT(championCandidatesCapacity) - GHIDRA_INT(championCandidates) & 0xfffffffc; - pvVar6 = championCandidates; - if (0xfff < uVar4) { - pvVar6 = *(void **)(GHIDRA_CAST(championCandidates) + -4); - uVar4 = uVar4 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(championCandidates) + (-4 - GHIDRA_INT(pvVar6))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pvVar6,uVar4); - } -LAB_008177a4: - *GHIDRA_CAST(door) = 1; - ExceptionList = savedExceptionList; - return; -} - -// 00817830 -void Room::render_water(int pass) -{ - uint32_t stageId; - Vector *pVVar1; - uint32_t *quadCursor; - Vector *pVVar2; - Vector *pVVar3; - int *texture; - Vector *topLeft; - int iVar4; - float *srcQuadCursor; - uint32_t *quadDst; - double dVar5; - uint8_t auStackY_8b4 [128]; - uint8_t bVar6; - DestinationQuad *color; - void *pvVar7; - float edgeMargin; - Vector local_814; - Vector waveScroll; - Vector renderOffset; - Vector waveRotation; - Vector local_7f4; - Vector local_7ec; - Vector local_7e4; - Vector local_7dc; - Vector local_7d4; - Vector local_7cc; - Vector local_7c4; - Vector local_7bc; - Vector local_7b4; - float topLeftY; - float topLeftX; - Vector local_7a4; - float local_79c; - float bottomRightY; - float bottomRightX; - Vector local_790; - Vector local_788; - Vector local_780; - Vector local_778; - Vector local_770; - Vector local_768; - Vector local_760; - Vector local_758; - Vector local_750; - Vector local_748; - Vector local_740; - Vector local_738; - Vector local_730; - Vector local_728; - Vector local_720; - Vector local_718; - Vector local_710; - Vector local_708; - DestinationQuad tmpQuad; - uint32_t tmpQuadFlag; - Vector local_6d0; - char isFloodRoom; - Vector local_6c4; - KColor whiteColorA [2]; - KColor whiteColorC; - KColor whiteColorB [2]; - uint8_t tileQuad [112]; - uint8_t tileQuad2 [112]; - uint8_t roomAreaDesc [176]; - Color waterColor; - float srcQuad0TopLeftX; - float srcQuad0TopLeftY; - float srcQuad0TopRightX; - float srcQuad0TopRightY; - float srcQuad0BottomLeftX; - float srcQuad0BottomLeftY; - float srcQuad0BottomRightX; - float srcQuad0BottomRightY; - uint32_t srcQuad0Flag; - float srcQuad1TopLeftX; - float srcQuad1TopLeftY; - float srcQuad1TopRightX; - float srcQuad1TopRightY; - float srcQuad1BottomLeftX; - float srcQuad1BottomLeftY; - float srcQuad1BottomRightX; - float srcQuad1BottomRightY; - uint32_t srcQuad1Flag; - float srcQuad2TopLeftX; - float srcQuad2TopLeftY; - float srcQuad2TopRightX; - float srcQuad2TopRightY; - float srcQuad2BottomLeftX; - float srcQuad2BottomLeftY; - float srcQuad2BottomRightX; - float srcQuad2BottomRightY; - uint32_t srcQuad2Flag; - float srcQuad3TopLeftX; - float srcQuad3TopLeftY; - float srcQuad3TopRightX; - float srcQuad3TopRightY; - float srcQuad3BottomLeftX; - float srcQuad3BottomLeftY; - float srcQuad3BottomRightX; - float srcQuad3BottomRightY; - uint32_t srcQuad3Flag; - float srcQuad4TopLeftX; - float srcQuad4TopLeftY; - float srcQuad4TopRightX; - float srcQuad4TopRightY; - float srcQuad4BottomLeftX; - float srcQuad4BottomLeftY; - float srcQuad4BottomRightX; - float srcQuad4BottomRightY; - uint32_t srcQuad4Flag; - float srcQuad5TopLeftX; - float srcQuad5TopLeftY; - float srcQuad5TopRightX; - float srcQuad5TopRightY; - float srcQuad5BottomLeftX; - float srcQuad5BottomLeftY; - float srcQuad5BottomRightX; - float srcQuad5BottomRightY; - uint32_t srcQuad5Flag; - float srcQuad6TopLeftX; - float srcQuad6TopLeftY; - float srcQuad6TopRightX; - float srcQuad6TopRightY; - float srcQuad6BottomLeftX; - float srcQuad6BottomLeftY; - float srcQuad6BottomRightX; - float srcQuad6BottomRightY; - uint32_t srcQuad6Flag; - float srcQuad7TopLeftX; - float srcQuad7TopLeftY; - float srcQuad7TopRightX; - float srcQuad7TopRightY; - float srcQuad7BottomLeftX; - float srcQuad7BottomLeftY; - float srcQuad7BottomRightX; - float srcQuad7BottomRightY; - uint32_t srcQuad7Flag; - float srcQuad8TopLeftX; - float srcQuad8TopLeftY; - float srcQuad8TopRightX; - float srcQuad8TopRightY; - float srcQuad8BottomLeftX; - float srcQuad8BottomLeftY; - float srcQuad8BottomRightX; - float srcQuad8BottomRightY; - uint32_t srcQuad8Flag; - float srcQuad9TopLeftX; - float srcQuad9TopLeftY; - float srcQuad9TopRightX; - float srcQuad9TopRightY; - float srcQuad9BottomLeftX; - float srcQuad9BottomLeftY; - float srcQuad9BottomRightX; - float srcQuad9BottomRightY; - uint32_t srcQuad9Flag; - float srcQuad10TopLeftX; - float srcQuad10TopLeftY; - float srcQuad10TopRightX; - float srcQuad10TopRightY; - float srcQuad10BottomLeftX; - float srcQuad10BottomLeftY; - float srcQuad10BottomRightX; - float srcQuad10BottomRightY; - uint32_t srcQuad10Flag; - float srcQuad11TopLeftX; - float srcQuad11TopLeftY; - float srcQuad11TopRightX; - float srcQuad11TopRightY; - float srcQuad11BottomLeftX; - float srcQuad11BottomLeftY; - float srcQuad11BottomRightX; - float srcQuad11BottomRightY; - uint32_t srcQuad11Flag; - uint32_t edgeQuad0 [28]; - uint32_t edgeQuad1 [28]; - uint32_t edgeQuad2 [28]; - uint32_t edgeQuad3 [28]; - uint32_t edgeQuad4 [28]; - uint32_t edgeQuad5 [29]; - uint32_t stackCookie; - float room; - code *drawFn; - - stackCookie = __security_cookie ^ GHIDRA_UINT(&edgeMargin); - local_7dc.x = (float)this; - stageId = Game::GetStageID(g_game,0); - if (this->_gridPaths[this->_backdropType * 0x4f + 0x585] == 0) { - return; - } - if (((((stageId == 4) || (stageId == 5)) || (stageId == 6)) || - ((stageId == 0x1b || (stageId == 0x1c)))) && - ((-1 < *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x54)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 5 & 1) != 0)))) { - isFloodRoom = '\x01'; - } - else { - isFloodRoom = '\0'; - } - if ((this->_waterAmount <= 0.0) && (isFloodRoom == '\0')) { - return; - } - bottomRightX = (this->_bottomRightPos).x; - topLeftX = (this->_topLeftPos).x; - renderOffset.x = (g_game->_screenShakeOffset).x + (this->_renderScrollOffset).x; - renderOffset.y = (g_game->_screenShakeOffset).y + (this->_renderScrollOffset).y; - topLeftY = (this->_topLeftPos).y; - bottomRightY = (this->_bottomRightPos).y; - local_708.x = bottomRightY - topLeftY; - local_79c = bottomRightX - topLeftX; - local_7ec.x = local_79c + local_79c + local_708.x + local_708.x; - local_7f4.x = (float)((double)*GHIDRA_CAST((DAT_00c797c4 + 0x10)) + - __uint_to_double_fixup[-(*GHIDRA_CAST((DAT_00c797c4 + 0x10)) >> 0x1f)]); - local_814.x = local_7ec.x / local_7f4.x + 0.5; - dVar5 = floor((double)local_814.x); - local_7b4.x = ((float)dVar5 * local_7f4.x) / local_7ec.x; - local_778.x = local_7b4.x * local_708.x; - edgeMargin = local_7b4.x * 50.0; - local_7b4.x = local_7b4.x * local_79c; - local_7ec.x = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b70)))); - local_7f4.x = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b74)))); - local_814.x = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x1b78)))); - (GHIDRA_CAST((&waterColor)))->Color::Reset(); - (GHIDRA_CAST((&waterColor)))->Color::SetTint(local_7ec.x,local_7f4.x,local_814.x,1.0); - if (this->_backdropType == 0x2c) { - waterColor._tint[0] = 1.0; - waterColor._tint[1] = 0.3; - waterColor._tint[2] = 0.3; - } - if (isFloodRoom == '\0') { - waterColor._tint[3] = 0.0; - } - else { - waterColor._tint[3] = (float)*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x54)) / 30.0; - if (waterColor._tint[3] <= 0.0) { - waterColor._tint[3] = 0.0; - } - if (1.0 <= waterColor._tint[3]) { - waterColor._tint[3] = 1.0; - } - } - if (0.0 < this->_waterAmount) { - waterColor._tint[3] = waterColor._tint[3] + (1.0 - waterColor._tint[3]) * this->_waterAmount; - } - waveRotation.x = (float)g_game->_frameCount * 0.01; - waveScroll.x = (float)g_game->_frameCount * 0.5; - local_7a4.x = waveScroll.x * 0.1; - shader_cache_find(0xb1a5b0); - if (3 < *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)) - 9U) { - local_7f4.x = local_7a4.x + edgeMargin; - local_814.x = waveScroll.x + local_778.x; - FUN_00a110e0(); - local_7ec.x = local_7b4.x + local_778.x; - FUN_00a110e0(); - local_7e4.x = local_778.x + local_778.x; - local_7dc.x = local_7e4.x + local_7b4.x; - FUN_00a110e0(); - local_814.x = local_7b4.x + local_7b4.x + local_7e4.x; - FUN_00a110e0(); - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(local_778.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6d0,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_750)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(0.0,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_718,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(waveScroll.x,0.0); - local_7e4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_778.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_738,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_740)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(0.0,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_770,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_768)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_760,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7e4.x); - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Vector(local_7ec.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6c4,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(local_778.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_710,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_718)))->Vector::Vector(waveScroll.x,0.0); - local_7e4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7ec.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_730,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_738)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_740,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_748)))->Vector::Vector(local_778.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_780,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_770)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_768,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7e4.x); - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Vector(local_7dc.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6c4,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(local_7ec.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_710,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_718)))->Vector::Vector(waveScroll.x,0.0); - local_7e4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7dc.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_730,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_738)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_740,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_748)))->Vector::Vector(local_7ec.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_780,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_770)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_768,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7e4.x); - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Vector(local_814.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6c4,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(local_7dc.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_710,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_718)))->Vector::Vector(waveScroll.x,0.0); - local_7ec.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_814.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_730,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_738)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_740,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_748)))->Vector::Vector(local_7dc.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_780,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_770)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_768,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7ec.x); - (GHIDRA_CAST((GHIDRA_CAST(&tmpQuad))))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(topLeftX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(topLeftX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - local_7f4.x = topLeftY - edgeMargin; - local_7ec.x = topLeftX - edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7ec.x,local_7f4.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - local_7dc.x = bottomRightY + edgeMargin; - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7ec.x,local_7dc.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - set_quad_corner_colors(edgeQuad0,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),GHIDRA_CAST(&tmpQuad)); - (GHIDRA_CAST((whiteColorB)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(bottomRightX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(topLeftX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - local_7e4.x = bottomRightX + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7e4.x,local_7f4.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7ec.x,local_7f4.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - set_quad_corner_colors(edgeQuad1,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorB); - (GHIDRA_CAST((&whiteColorC)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(bottomRightX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(bottomRightX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7e4.x,local_7dc.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7e4.x,local_7f4.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - set_quad_corner_colors(edgeQuad2,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),&whiteColorC); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(topLeftX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(bottomRightX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7ec.x,local_7dc.x); - pVVar1 = Isaac::GetRenderPosition(&local_728,pVVar1,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_730,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7e4.x,local_7dc.x); - pVVar1 = Isaac::GetRenderPosition(&local_740,pVVar1,bVar6); - topLeft = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,&renderOffset); - pVVar1 = GHIDRA_CAST(local_814.x); - set_quad_corner_colors(edgeQuad3,topLeft,pVVar3,pVVar2,GHIDRA_CAST(local_814.x),whiteColorA + 1); - pvVar7 = (void *)0x81de65; - FUN_00682260(); - (GHIDRA_CAST((auStackY_8b4 + 0x8c)))->KAGE::SmartPointer::operator_assign(&DAT_00c797c4); - apply_sprite_shader_params(GHIDRA_CAST(&waterColor),1,pVVar1,pvVar7); - local_7ec.x = (float)&srcQuad0TopLeftX; - local_7f4.x = 0.0; - do { - texture = GHIDRA_CAST(EntityPtr)::Ref(); - drawFn = *(code **)(*texture + 0x14); - FUN_00407220(); - (*drawFn)(local_7ec.x); - local_7ec.x = (float)(GHIDRA_INT(local_7ec.x) + 0x24); - local_7f4.x = (float)(GHIDRA_INT(local_7f4.x) + 1); - } while (GHIDRA_INT(local_7f4.x) < 8); - goto LAB_0081deea; - } - GetLRoomAreaDesc(this,roomAreaDesc); - srcQuadCursor = &srcQuad0TopLeftX; - local_814.x = 1.68156e-44; - do { - local_814.x = (float)(GHIDRA_INT(&(GHIDRA_CAST((GHIDRA_INT(local_814.x) + -8)))->y) + 3); - FUN_00a10690(); - *GHIDRA_CAST((srcQuadCursor + 8)) = 0; - srcQuadCursor = srcQuadCursor + 9; - } while (GHIDRA_CAST(local_814.x) != GHIDRA_CAST(0x0)); - quadCursor = edgeQuad0; - iVar4 = 6; - do { - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - pVVar1 = GHIDRA_CAST(0x817bbd); - (GHIDRA_CAST((quadCursor)))->ColorQuad::ColorQuad(whiteColorA); - room = local_7dc.x; - quadCursor = quadCursor + 0x1c; - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - if ((*GHIDRA_CAST((GHIDRA_CAST(local_7dc.x) + 4)) == 0) || - (iVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_7dc.x) + 4)) + 0x10)), iVar4 == 0)) { -LAB_0081a975: - iVar4 = GetRoomShape(GHIDRA_CAST(local_7dc.x)); - if (iVar4 == 0xb) { - local_790.x = local_778.x * 0.5; - local_7c4.x = local_7a4.x + edgeMargin; - local_814.x = local_790.x + waveScroll.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_7dc.x = local_790.x + local_7b4.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_814.x = local_778.x * 1.5; - local_7e4.x = local_814.x + local_7b4.x; - local_7ec.x = waveScroll.x + local_7b4.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_7f4.x = local_7b4.x * 1.5; - local_788.x = local_7f4.x + local_814.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_778.x = local_778.x + local_778.x; - local_7ec.x = local_7f4.x + local_778.x; - local_7f4.x = local_7f4.x + waveScroll.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_7b4.x = local_7b4.x + local_7b4.x + local_778.x; - FUN_00a110e0(); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_750)))->Vector::Vector(local_790.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_758,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_710)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_720)))->Vector::Vector(0.0,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_728,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_730)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_738,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_790.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_748,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_770,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_768)))->Vector::Vector(0.0,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_760,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_7d4)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7cc,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_750)))->Vector::Vector(local_7dc.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_758,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_710)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_790.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_728,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_730)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_738,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_7dc.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_748,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_770,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_768)))->Vector::Vector(local_790.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_760,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_7d4)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7cc,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_750)))->Vector::Vector(local_7e4.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_758,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_710)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7dc.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_728,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_730)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_738,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_7e4.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_748,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_770,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_768)))->Vector::Vector(local_7dc.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_760,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_7d4)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7cc,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Vector(local_788.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_750,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_758)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_710,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_718)))->Vector::Vector(local_7e4.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_720,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_730,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_788.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_740,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_748)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_780,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_770)))->Vector::Vector(local_7e4.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_768,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_760)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7d4,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_7a4)))->Vector::Vector(local_7ec.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_750,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_758)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_710,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_718)))->Vector::Vector(local_788.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_720,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_730,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7ec.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_740,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_748)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_780,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_770)))->Vector::Vector(local_788.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_768,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_760)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7d4,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(local_7b4.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_750,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_758)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_710,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_718)))->Vector::Vector(local_7ec.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_720,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_730,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7b4.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_740,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_748)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_780,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_770)))->Vector::Vector(local_7ec.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_768,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_760)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7d4,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(topLeftX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_750,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,&renderOffset); - local_708.x = local_708.x * 0.5 + topLeftY; - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(topLeftX,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_718,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,&renderOffset); - local_7f4.x = topLeftY - edgeMargin; - local_7e4.x = topLeftX - edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7e4.x,local_7f4.x); - pVVar2 = Isaac::GetRenderPosition(&local_730,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_738,&renderOffset); - local_788.x = local_708.x + edgeMargin; - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_7e4.x,local_788.x); - pVVar3 = Isaac::GetRenderPosition(&local_748,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_780,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA + 1); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(bottomRightX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_750,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(topLeftX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_718,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,&renderOffset); - local_7ec.x = bottomRightX + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7ec.x,local_7f4.x); - pVVar2 = Isaac::GetRenderPosition(&local_730,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_738,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_7e4.x,local_7f4.x); - pVVar3 = Isaac::GetRenderPosition(&local_748,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_780,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_770)))->Vector::Vector(bottomRightX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_768,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_760,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Vector(bottomRightX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_7cc,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_7bc,&renderOffset); - local_7dc.x = bottomRightY + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_7c4)))->Vector::Vector(local_7ec.x,local_7dc.x); - pVVar2 = Isaac::GetRenderPosition(&local_790,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7b4,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_7a4)))->Vector::Vector(local_7ec.x,local_7f4.x); - pVVar3 = Isaac::GetRenderPosition(&local_778,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&waveRotation,&renderOffset); - set_quad_corner_colors(tileQuad2,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA + 1); - FUN_00a11060(); - (GHIDRA_CAST((&whiteColorC)))->KColor::SetFromARGB(0xffffffff); - local_79c = local_79c * 0.5 + topLeftX; - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(local_79c,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_750,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(bottomRightX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_718,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,&renderOffset); - local_7f4.x = local_79c - edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7f4.x,local_7dc.x); - pVVar2 = Isaac::GetRenderPosition(&local_730,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_738,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_7ec.x,local_7dc.x); - pVVar3 = Isaac::GetRenderPosition(&local_748,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_780,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),&whiteColorC); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorB)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(local_79c,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_750,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_79c,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_718,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,&renderOffset); - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7f4.x,local_788.x); - pVVar2 = Isaac::GetRenderPosition(&local_730,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_738,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_7f4.x,local_7dc.x); - pVVar3 = Isaac::GetRenderPosition(&local_748,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_780,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorB); - FUN_00a11060(); - (GHIDRA_CAST((GHIDRA_CAST(&tmpQuad))))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(topLeftX,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_750,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_79c,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_718,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_720,&renderOffset); - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7e4.x,local_788.x); - pVVar2 = Isaac::GetRenderPosition(&local_730,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_738,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_7f4.x,local_788.x); - pVVar3 = Isaac::GetRenderPosition(&local_748,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_780,&renderOffset); - color = &tmpQuad; - } - else { - iVar4 = GetRoomShape(GHIDRA_CAST(room)); - if (iVar4 != 0xc) goto LAB_0081d167; - local_7c4.x = local_7a4.x + edgeMargin; - local_814.x = waveScroll.x + local_778.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_7ec.x = local_7b4.x + local_778.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_814.x = local_778.x * 1.5; - local_7dc.x = local_814.x + local_7b4.x; - local_788.x = waveScroll.x + local_7b4.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_7f4.x = local_7b4.x * 1.5; - local_7e4.x = local_7f4.x + local_814.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_790.x = local_778.x + local_778.x; - local_788.x = local_7f4.x + local_790.x; - local_7f4.x = local_7f4.x + waveScroll.x; - FUN_00a110e0(); - FUN_00a112a0(); - local_7b4.x = local_7b4.x + local_7b4.x + local_790.x; - FUN_00a110e0(); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_6d0)))->Vector::Vector(local_778.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_750,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_758)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_710,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_718)))->Vector::Vector(0.0,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_720,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_730,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_778.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_740,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_748)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_780,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_770)))->Vector::Vector(0.0,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_768,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_760)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_7d4,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Vector(local_7ec.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6d0,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_750)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_778.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_718,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_7ec.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_738,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_740)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(local_778.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_770,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_768)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_760,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Vector(local_7dc.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6d0,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_750)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_7ec.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_718,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_7dc.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_738,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_740)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(local_7ec.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_770,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_768)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_760,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_7a4)))->Vector::Vector(local_7e4.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6d0,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_750)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_7dc.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_718,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_7e4.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_738,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_740)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(local_7dc.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_770,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_768)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_760,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_778)))->Vector::Vector(local_788.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6d0,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_750)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_7e4.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_718,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_788.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_738,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_740)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(local_7e4.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_770,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_768)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_760,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(local_7b4.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_6d0,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_750)))->Vector::Vector(waveScroll.x,0.0); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_758,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_788.x,edgeMargin); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_718,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(waveScroll.x,0.0); - local_7f4.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,pVVar2); - pVVar1 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_7b4.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::Rotated(&local_738,waveRotation.x); - pVVar2 = (GHIDRA_CAST((&local_740)))->Vector::Vector(waveScroll.x,0.0); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,pVVar2); - pVVar2 = (GHIDRA_CAST((&local_780)))->Vector::Vector(local_788.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::Rotated(&local_770,waveRotation.x); - pVVar3 = (GHIDRA_CAST((&local_768)))->Vector::Vector(waveScroll.x,0.0); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_760,pVVar3); - FUN_00a11130(pVVar2,pVVar1,local_7f4.x); - FUN_00a112a0(); - (GHIDRA_CAST((GHIDRA_CAST(&tmpQuad))))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(topLeftX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(topLeftX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - local_7f4.x = topLeftY - edgeMargin; - local_7e4.x = topLeftX - edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7e4.x,local_7f4.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - local_788.x = bottomRightY + edgeMargin; - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7e4.x,local_788.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),GHIDRA_CAST(&tmpQuad)) - ; - FUN_00a11060(); - (GHIDRA_CAST((whiteColorB)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(bottomRightX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(topLeftX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - local_7ec.x = bottomRightX + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7ec.x,local_7f4.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7e4.x,local_7f4.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorB); - FUN_00a11060(); - (GHIDRA_CAST((GHIDRA_CAST(&tmpQuad))))->KColor::SetFromARGB(0xffffffff); - local_708.x = local_708.x * 0.5 + topLeftY; - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_780)))->Vector::Vector(bottomRightX,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_770,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_768,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_760)))->Vector::Vector(bottomRightX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_7d4,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_7cc,&renderOffset); - local_7dc.x = local_708.x + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_7bc)))->Vector::Vector(local_7ec.x,local_7dc.x); - pVVar2 = Isaac::GetRenderPosition(&local_7c4,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_790,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_7b4)))->Vector::Vector(local_7ec.x,local_7f4.x); - pVVar3 = Isaac::GetRenderPosition(&local_7a4,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_778,&renderOffset); - set_quad_corner_colors - (tileQuad2,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),GHIDRA_CAST(&tmpQuad)); - FUN_00a11060(); - (GHIDRA_CAST((&whiteColorC)))->KColor::SetFromARGB(0xffffffff); - local_79c = local_79c * 0.5 + topLeftX; - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(local_79c,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(bottomRightX,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - local_7f4.x = local_79c + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7f4.x,local_7dc.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7ec.x,local_7dc.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),&whiteColorC); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(local_79c,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(local_79c,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7f4.x,local_788.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7f4.x,local_7dc.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA + 1); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_6c4)))->Vector::Vector(topLeftX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_6d0,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_750,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_758)))->Vector::Vector(local_79c,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_710,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_718,&renderOffset); - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_720)))->Vector::Vector(local_7e4.x,local_788.x); - pVVar2 = Isaac::GetRenderPosition(&local_728,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_730,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_738)))->Vector::Vector(local_7f4.x,local_788.x); - pVVar3 = Isaac::GetRenderPosition(&local_740,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_748,&renderOffset); - color = GHIDRA_CAST(whiteColorA); - } -LAB_0081d14b: - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),GHIDRA_CAST(color)); - pVVar1 = GHIDRA_CAST(0x81d167); - FUN_00a11060(); - } - else { - if (*GHIDRA_CAST((iVar4 + 0x48)) != 9) { - if (*GHIDRA_CAST((iVar4 + 0x48)) != 10) goto LAB_0081a975; - local_7c4.x = local_7a4.x + edgeMargin; - local_814.x = waveScroll.x + local_778.x; - FUN_00a10690(); - srcQuad0TopLeftX = tmpQuad._topLeft.x; - srcQuad0TopLeftY = tmpQuad._topLeft.y; - srcQuad0TopRightX = tmpQuad._topRight.x; - srcQuad0TopRightY = tmpQuad._topRight.y; - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad0Flag = tmpQuadFlag; - srcQuad0BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad0BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad0BottomRightX = tmpQuad._bottomRight.x; - srcQuad0BottomRightY = tmpQuad._bottomRight.y; - local_7ec.x = local_7b4.x * 0.5; - local_7dc.x = local_7ec.x + local_778.x; - FUN_00a10690(); - srcQuad1TopLeftX = tmpQuad._topLeft.x; - srcQuad1TopLeftY = tmpQuad._topLeft.y; - srcQuad1TopRightX = tmpQuad._topRight.x; - srcQuad1TopRightY = tmpQuad._topRight.y; - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad1BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad1BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad1BottomRightX = tmpQuad._bottomRight.x; - srcQuad1BottomRightY = tmpQuad._bottomRight.y; - srcQuad1Flag = tmpQuadFlag; - local_7f4.x = local_778.x * 1.5; - local_7e4.x = local_7f4.x + local_7ec.x; - local_7ec.x = local_7ec.x + waveScroll.x; - FUN_00a10690(); - local_788.x = local_7f4.x + local_7b4.x; - srcQuad2TopLeftX = tmpQuad._topLeft.x; - srcQuad2TopLeftY = tmpQuad._topLeft.y; - srcQuad2TopRightX = tmpQuad._topRight.x; - srcQuad2TopRightY = tmpQuad._topRight.y; - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad2BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad2BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad2BottomRightX = tmpQuad._bottomRight.x; - srcQuad2BottomRightY = tmpQuad._bottomRight.y; - srcQuad2Flag = tmpQuadFlag; - FUN_00a10690(); - srcQuad3TopLeftX = tmpQuad._topLeft.x; - srcQuad3TopLeftY = tmpQuad._topLeft.y; - srcQuad3TopRightX = tmpQuad._topRight.x; - srcQuad3TopRightY = tmpQuad._topRight.y; - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad3Flag = tmpQuadFlag; - srcQuad3BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad3BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad3BottomRightX = tmpQuad._bottomRight.x; - srcQuad3BottomRightY = tmpQuad._bottomRight.y; - local_814.x = local_778.x + local_778.x; - local_790.x = local_814.x + local_7b4.x; - FUN_00a10690(); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad4Flag = tmpQuadFlag; - srcQuad4TopLeftX = tmpQuad._topLeft.x; - srcQuad4TopLeftY = tmpQuad._topLeft.y; - srcQuad4TopRightX = tmpQuad._topRight.x; - srcQuad4TopRightY = tmpQuad._topRight.y; - local_7f4.x = local_7b4.x + local_7b4.x + local_814.x; - srcQuad4BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad4BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad4BottomRightX = tmpQuad._bottomRight.x; - srcQuad4BottomRightY = tmpQuad._bottomRight.y; - FUN_00a10690(); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad5TopLeftX = tmpQuad._topLeft.x; - srcQuad5TopLeftY = tmpQuad._topLeft.y; - srcQuad5TopRightX = tmpQuad._topRight.x; - srcQuad5TopRightY = tmpQuad._topRight.y; - srcQuad5Flag = tmpQuadFlag; - srcQuad5BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad5BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad5BottomRightX = tmpQuad._bottomRight.x; - srcQuad5BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_778.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = 0.0; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_778.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7b4.y = pVVar1->y + 0.0; - local_7b4.x = waveScroll.x + pVVar1->x; - local_814.x = 0.0; - local_814.y = 0.0; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7a4.y = pVVar1->y + 0.0; - local_7a4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7a4,&local_7b4,&local_7c4,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad6TopLeftX = tmpQuad._topLeft.x; - srcQuad6TopLeftY = tmpQuad._topLeft.y; - srcQuad6TopRightX = tmpQuad._topRight.x; - srcQuad6TopRightY = tmpQuad._topRight.y; - srcQuad6Flag = tmpQuadFlag; - srcQuad6BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad6BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad6BottomRightX = tmpQuad._bottomRight.x; - srcQuad6BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_7dc.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_778.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_7dc.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7b4.y = pVVar1->y + 0.0; - local_7b4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_778.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7a4.y = pVVar1->y + 0.0; - local_7a4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7a4,&local_7b4,&local_7c4,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad7TopLeftX = tmpQuad._topLeft.x; - srcQuad7TopLeftY = tmpQuad._topLeft.y; - srcQuad7TopRightX = tmpQuad._topRight.x; - srcQuad7TopRightY = tmpQuad._topRight.y; - srcQuad7Flag = tmpQuadFlag; - srcQuad7BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad7BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad7BottomRightX = tmpQuad._bottomRight.x; - srcQuad7BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_7e4.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_7dc.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_7e4.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7b4.y = pVVar1->y + 0.0; - local_7b4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_7dc.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7a4.y = pVVar1->y + 0.0; - local_7a4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7a4,&local_7b4,&local_7c4,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad8TopLeftX = tmpQuad._topLeft.x; - srcQuad8TopLeftY = tmpQuad._topLeft.y; - srcQuad8TopRightX = tmpQuad._topRight.x; - srcQuad8TopRightY = tmpQuad._topRight.y; - srcQuad8Flag = tmpQuadFlag; - srcQuad8BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad8BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad8BottomRightX = tmpQuad._bottomRight.x; - srcQuad8BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_788.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_7e4.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7dc.y = pVVar1->y + 0.0; - local_7dc.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_788.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_7e4.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7b4.y = pVVar1->y + 0.0; - local_7b4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7b4,&local_7c4,&local_7dc,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad9TopLeftX = tmpQuad._topLeft.x; - srcQuad9TopLeftY = tmpQuad._topLeft.y; - srcQuad9TopRightX = tmpQuad._topRight.x; - srcQuad9TopRightY = tmpQuad._topRight.y; - srcQuad9Flag = tmpQuadFlag; - srcQuad9BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad9BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad9BottomRightX = tmpQuad._bottomRight.x; - srcQuad9BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_790.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_788.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7dc.y = pVVar1->y + 0.0; - local_7dc.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_790.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7e4.y = pVVar1->y + 0.0; - local_7e4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_788.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7c4,&local_7e4,&local_7dc,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad10TopLeftX = tmpQuad._topLeft.x; - srcQuad10TopLeftY = tmpQuad._topLeft.y; - srcQuad10TopRightX = tmpQuad._topRight.x; - srcQuad10TopRightY = tmpQuad._topRight.y; - srcQuad10BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad10BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad10BottomRightX = tmpQuad._bottomRight.x; - srcQuad10BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_7f4.x; - local_7d4.y = edgeMargin; - srcQuad10Flag = tmpQuadFlag; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_790.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7dc.y = pVVar1->y + 0.0; - local_7dc.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_7f4.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7e4.y = pVVar1->y + 0.0; - local_7e4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_790.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_788.y = pVVar1->y + 0.0; - local_788.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_788,&local_7e4,&local_7dc,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad11TopLeftX = tmpQuad._topLeft.x; - srcQuad11TopLeftY = tmpQuad._topLeft.y; - srcQuad11TopRightX = tmpQuad._topRight.x; - srcQuad11TopRightY = tmpQuad._topRight.y; - srcQuad11Flag = tmpQuadFlag; - srcQuad11BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad11BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad11BottomRightX = tmpQuad._bottomRight.x; - srcQuad11BottomRightY = tmpQuad._bottomRight.y; - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = topLeftX; - local_7d4.y = topLeftY; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_7f4.x = renderOffset.x + pVVar1->x; - local_7f4.y = renderOffset.y + pVVar1->y; - local_7cc.x = topLeftX; - local_7cc.y = bottomRightY; - pVVar1 = Isaac::GetRenderPosition(&local_770,&local_7cc,1); - local_7dc.x = renderOffset.x + pVVar1->x; - local_7dc.y = renderOffset.y + pVVar1->y; - local_7bc.x = topLeftX - edgeMargin; - local_7ec.x = topLeftY - edgeMargin; - local_7bc.y = local_7ec.x; - local_788.x = local_7bc.x; - pVVar1 = Isaac::GetRenderPosition(&local_768,&local_7bc,1); - local_7e4.x = renderOffset.x + pVVar1->x; - local_7e4.y = renderOffset.y + pVVar1->y; - local_814.x = local_788.x; - local_814.y = bottomRightY + edgeMargin; - local_7c4.x = local_814.y; - pVVar1 = Isaac::GetRenderPosition(&local_760,&local_814,1); - local_790.y = renderOffset.y + pVVar1->y; - local_790.x = renderOffset.x + pVVar1->x; - quadCursor = set_quad_corner_colors - (tileQuad2,&local_790,&local_7e4,&local_7dc,&local_7f4,whiteColorA); - quadDst = edgeQuad0; - for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { - *quadDst = *quadCursor; - quadCursor = quadCursor + 1; - quadDst = quadDst + 1; - } - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = local_79c * 0.5 + topLeftX; - local_7d4.y = topLeftY; - local_79c = local_7d4.x; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_770,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_768)))->Vector::Vector(topLeftX,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_760,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_7cc,&renderOffset); - local_7dc.x = local_79c + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_7bc)))->Vector::Vector(local_7dc.x,local_7ec.x); - pVVar2 = Isaac::GetRenderPosition(&local_7f4,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_790,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_7b4)))->Vector::Vector(local_788.x,local_7ec.x); - pVVar3 = Isaac::GetRenderPosition(&local_7a4,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_778,&renderOffset); - set_quad_corner_colors(tileQuad2,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - local_708.x = local_708.x * 0.5 + topLeftY; - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&waveRotation)))->Vector::Vector(local_79c,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&waveScroll,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_748,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_740)))->Vector::Vector(local_79c,topLeftY); - pVVar1 = Isaac::GetRenderPosition(&local_738,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_730,&renderOffset); - local_7e4.x = local_708.x - edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_728)))->Vector::Vector(local_7dc.x,local_7e4.x); - pVVar2 = Isaac::GetRenderPosition(&local_720,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_718,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_710)))->Vector::Vector(local_7dc.x,local_7ec.x); - pVVar3 = Isaac::GetRenderPosition(&local_758,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_750,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA + 1); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_750)))->Vector::Vector(bottomRightX,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_758,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_710,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_718)))->Vector::Vector(local_79c,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_720,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,&renderOffset); - local_7ec.x = bottomRightX + edgeMargin; - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_7ec.x,local_7e4.x); - pVVar2 = Isaac::GetRenderPosition(&local_738,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_740,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_748)))->Vector::Vector(local_7dc.x,local_7e4.x); - pVVar3 = Isaac::GetRenderPosition(&local_780,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_770,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA + 1); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_750)))->Vector::Vector(bottomRightX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_758,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_710,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_718)))->Vector::Vector(bottomRightX,local_708.x); - pVVar1 = Isaac::GetRenderPosition(&local_720,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,&renderOffset); - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_7ec.x,local_7c4.x); - pVVar2 = Isaac::GetRenderPosition(&local_738,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_740,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_748)))->Vector::Vector(local_7ec.x,local_7e4.x); - pVVar3 = Isaac::GetRenderPosition(&local_780,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_770,&renderOffset); - set_quad_corner_colors(tileQuad,pVVar3,pVVar2,pVVar1,GHIDRA_CAST(local_814.x),whiteColorA + 1); - FUN_00a11060(); - (GHIDRA_CAST((whiteColorA + 1)))->KColor::SetFromARGB(0xffffffff); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_750)))->Vector::Vector(topLeftX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_758,pVVar1,bVar6); - local_814.x = (float)(GHIDRA_CAST((pVVar1)))->Vector::__add(&local_710,&renderOffset); - bVar6 = 1; - pVVar1 = (GHIDRA_CAST((&local_718)))->Vector::Vector(bottomRightX,bottomRightY); - pVVar1 = Isaac::GetRenderPosition(&local_720,pVVar1,bVar6); - pVVar1 = (GHIDRA_CAST((pVVar1)))->Vector::__add(&local_728,&renderOffset); - bVar6 = 1; - pVVar2 = (GHIDRA_CAST((&local_730)))->Vector::Vector(local_788.x,local_7c4.x); - pVVar2 = Isaac::GetRenderPosition(&local_738,pVVar2,bVar6); - pVVar2 = (GHIDRA_CAST((pVVar2)))->Vector::__add(&local_740,&renderOffset); - bVar6 = 1; - pVVar3 = (GHIDRA_CAST((&local_748)))->Vector::Vector(local_7ec.x,local_7c4.x); - pVVar3 = Isaac::GetRenderPosition(&local_780,pVVar3,bVar6); - pVVar3 = (GHIDRA_CAST((pVVar3)))->Vector::__add(&local_770,&renderOffset); - color = GHIDRA_CAST((whiteColorA + 1)); - goto LAB_0081d14b; - } - local_790.x = local_778.x * 0.5; - local_7c4.x = local_7a4.x + edgeMargin; - local_814.x = local_790.x + waveScroll.x; - FUN_00a10690(); - srcQuad0TopLeftX = tmpQuad._topLeft.x; - srcQuad0TopLeftY = tmpQuad._topLeft.y; - srcQuad0TopRightX = tmpQuad._topRight.x; - srcQuad0TopRightY = tmpQuad._topRight.y; - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad0Flag = tmpQuadFlag; - srcQuad0BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad0BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad0BottomRightX = tmpQuad._bottomRight.x; - srcQuad0BottomRightY = tmpQuad._bottomRight.y; - local_7ec.x = local_7b4.x * 0.5; - local_788.x = local_7ec.x + local_790.x; - FUN_00a10690(); - srcQuad1TopLeftX = tmpQuad._topLeft.x; - srcQuad1TopLeftY = tmpQuad._topLeft.y; - srcQuad1TopRightX = tmpQuad._topRight.x; - srcQuad1TopRightY = tmpQuad._topRight.y; - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad1BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad1BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad1BottomRightX = tmpQuad._bottomRight.x; - srcQuad1BottomRightY = tmpQuad._bottomRight.y; - srcQuad1Flag = tmpQuadFlag; - local_7e4.x = local_7ec.x + local_778.x; - local_7ec.x = local_7ec.x + waveScroll.x; - FUN_00a10690(); - local_7dc.x = local_7b4.x + local_778.x; - srcQuad2TopLeftX = tmpQuad._topLeft.x; - srcQuad2TopLeftY = tmpQuad._topLeft.y; - srcQuad2TopRightX = tmpQuad._topRight.x; - srcQuad2TopRightY = tmpQuad._topRight.y; - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad2BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad2BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad2BottomRightX = tmpQuad._bottomRight.x; - srcQuad2BottomRightY = tmpQuad._bottomRight.y; - srcQuad2Flag = tmpQuadFlag; - FUN_00a10690(); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad3TopLeftX = tmpQuad._topLeft.x; - srcQuad3TopLeftY = tmpQuad._topLeft.y; - srcQuad3TopRightX = tmpQuad._topRight.x; - srcQuad3TopRightY = tmpQuad._topRight.y; - srcQuad3Flag = tmpQuadFlag; - srcQuad3BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad3BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad3BottomRightX = tmpQuad._bottomRight.x; - srcQuad3BottomRightY = tmpQuad._bottomRight.y; - local_814.x = local_778.x + local_778.x; - local_778.x = local_814.x + local_7b4.x; - FUN_00a10690(); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad4Flag = tmpQuadFlag; - srcQuad4TopLeftX = tmpQuad._topLeft.x; - srcQuad4TopLeftY = tmpQuad._topLeft.y; - srcQuad4TopRightX = tmpQuad._topRight.x; - srcQuad4TopRightY = tmpQuad._topRight.y; - local_7f4.x = local_7b4.x + local_7b4.x + local_814.x; - srcQuad4BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad4BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad4BottomRightX = tmpQuad._bottomRight.x; - srcQuad4BottomRightY = tmpQuad._bottomRight.y; - FUN_00a10690(); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad5TopLeftX = tmpQuad._topLeft.x; - srcQuad5TopLeftY = tmpQuad._topLeft.y; - srcQuad5TopRightX = tmpQuad._topRight.x; - srcQuad5TopRightY = tmpQuad._topRight.y; - srcQuad5Flag = tmpQuadFlag; - srcQuad5BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad5BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad5BottomRightX = tmpQuad._bottomRight.x; - srcQuad5BottomRightY = tmpQuad._bottomRight.y; - local_814.x = local_790.x; - local_814.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7a4.y = pVVar1->y + 0.0; - local_7a4.x = waveScroll.x + pVVar1->x; - local_7ec.x = 0.0; - local_7ec.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7ec)))->Vector::Rotated(&local_768,waveRotation.x); - local_7bc.y = pVVar1->y + 0.0; - local_7bc.x = waveScroll.x + pVVar1->x; - local_7c4.y = 0.0; - local_7c4.x = local_790.x; - pVVar1 = (GHIDRA_CAST((&local_7c4)))->Vector::Rotated(&local_770,waveRotation.x); - local_7cc.y = pVVar1->y + 0.0; - local_7cc.x = waveScroll.x + pVVar1->x; - local_7b4.x = 0.0; - local_7b4.y = 0.0; - pVVar1 = (GHIDRA_CAST((&local_7b4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7d4.y = pVVar1->y + 0.0; - local_7d4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7d4,&local_7cc,&local_7bc,&local_7a4); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad6TopLeftX = tmpQuad._topLeft.x; - srcQuad6TopLeftY = tmpQuad._topLeft.y; - srcQuad6TopRightX = tmpQuad._topRight.x; - srcQuad6TopRightY = tmpQuad._topRight.y; - srcQuad6Flag = tmpQuadFlag; - srcQuad6BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad6BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad6BottomRightX = tmpQuad._bottomRight.x; - srcQuad6BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_788.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_790.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_788.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7b4.y = pVVar1->y + 0.0; - local_7b4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_790.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7a4.y = pVVar1->y + 0.0; - local_7a4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7a4,&local_7b4,&local_7c4,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad7TopLeftX = tmpQuad._topLeft.x; - srcQuad7TopLeftY = tmpQuad._topLeft.y; - srcQuad7TopRightX = tmpQuad._topRight.x; - srcQuad7TopRightY = tmpQuad._topRight.y; - srcQuad7Flag = tmpQuadFlag; - srcQuad7BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad7BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad7BottomRightX = tmpQuad._bottomRight.x; - srcQuad7BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_7e4.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_788.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_7e4.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_790.y = pVVar1->y + 0.0; - local_790.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_788.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7b4.y = pVVar1->y + 0.0; - local_7b4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7b4,&local_790,&local_7c4,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad8TopLeftX = tmpQuad._topLeft.x; - srcQuad8TopLeftY = tmpQuad._topLeft.y; - srcQuad8TopRightX = tmpQuad._topRight.x; - srcQuad8TopRightY = tmpQuad._topRight.y; - srcQuad8Flag = tmpQuadFlag; - srcQuad8BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad8BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad8BottomRightX = tmpQuad._bottomRight.x; - srcQuad8BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_7dc.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_7e4.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_788.y = pVVar1->y + 0.0; - local_788.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_7dc.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_7e4.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_790.y = pVVar1->y + 0.0; - local_790.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_790,&local_7c4,&local_788,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad9TopLeftX = tmpQuad._topLeft.x; - srcQuad9TopLeftY = tmpQuad._topLeft.y; - srcQuad9TopRightX = tmpQuad._topRight.x; - srcQuad9TopRightY = tmpQuad._topRight.y; - srcQuad9Flag = tmpQuadFlag; - srcQuad9BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad9BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad9BottomRightX = tmpQuad._bottomRight.x; - srcQuad9BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_778.x; - local_7d4.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_7dc.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7e4.y = pVVar1->y + 0.0; - local_7e4.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_778.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_788.y = pVVar1->y + 0.0; - local_788.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_7dc.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_7c4.y = pVVar1->y + 0.0; - local_7c4.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_7c4,&local_788,&local_7e4,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad10TopLeftX = tmpQuad._topLeft.x; - srcQuad10TopLeftY = tmpQuad._topLeft.y; - srcQuad10TopRightX = tmpQuad._topRight.x; - srcQuad10TopRightY = tmpQuad._topRight.y; - srcQuad10BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad10BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad10BottomRightX = tmpQuad._bottomRight.x; - srcQuad10BottomRightY = tmpQuad._bottomRight.y; - local_7d4.x = local_7f4.x; - local_7d4.y = edgeMargin; - srcQuad10Flag = tmpQuadFlag; - pVVar1 = (GHIDRA_CAST((&local_7d4)))->Vector::Rotated(&local_780,waveRotation.x); - local_7ec.y = pVVar1->y + 0.0; - local_7ec.x = waveScroll.x + pVVar1->x; - local_7cc.x = local_778.x; - local_7cc.y = edgeMargin; - pVVar1 = (GHIDRA_CAST((&local_7cc)))->Vector::Rotated(&local_770,waveRotation.x); - local_7dc.y = pVVar1->y + 0.0; - local_7dc.x = waveScroll.x + pVVar1->x; - local_7bc.y = 0.0; - local_7bc.x = local_7f4.x; - pVVar1 = (GHIDRA_CAST((&local_7bc)))->Vector::Rotated(&local_768,waveRotation.x); - local_7e4.y = pVVar1->y + 0.0; - local_7e4.x = waveScroll.x + pVVar1->x; - local_814.y = 0.0; - local_814.x = local_778.x; - pVVar1 = (GHIDRA_CAST((&local_814)))->Vector::Rotated(&local_760,waveRotation.x); - local_788.y = pVVar1->y + 0.0; - local_788.x = waveScroll.x + pVVar1->x; - DestinationQuad::DestinationQuad(&tmpQuad,&local_788,&local_7e4,&local_7dc,&local_7ec); - tmpQuadFlag = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(tmpQuadFlag)) + 0x1))),1); - srcQuad11TopLeftX = tmpQuad._topLeft.x; - srcQuad11TopLeftY = tmpQuad._topLeft.y; - srcQuad11TopRightX = tmpQuad._topRight.x; - srcQuad11TopRightY = tmpQuad._topRight.y; - srcQuad11Flag = tmpQuadFlag; - srcQuad11BottomLeftX = tmpQuad._bottomLeft.x; - srcQuad11BottomLeftY = tmpQuad._bottomLeft.y; - srcQuad11BottomRightX = tmpQuad._bottomRight.x; - srcQuad11BottomRightY = tmpQuad._bottomRight.y; - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = topLeftX; - local_7d4.y = local_708.x * 0.5 + topLeftY; - local_708.x = local_7d4.y; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_7f4.x = renderOffset.x + pVVar1->x; - local_7f4.y = renderOffset.y + pVVar1->y; - local_7cc.y = bottomRightY; - local_7cc.x = topLeftX; - pVVar1 = Isaac::GetRenderPosition(&local_770,&local_7cc,1); - local_7dc.x = renderOffset.x + pVVar1->x; - local_7dc.y = renderOffset.y + pVVar1->y; - local_7bc.x = topLeftX - edgeMargin; - local_7ec.x = local_708.x - edgeMargin; - local_7bc.y = local_7ec.x; - local_788.x = local_7bc.x; - pVVar1 = Isaac::GetRenderPosition(&local_768,&local_7bc,1); - local_7e4.x = renderOffset.x + pVVar1->x; - local_7e4.y = renderOffset.y + pVVar1->y; - local_814.x = local_788.x; - local_814.y = bottomRightY + edgeMargin; - local_7c4.x = local_814.y; - pVVar1 = Isaac::GetRenderPosition(&local_760,&local_814,1); - local_790.y = renderOffset.y + pVVar1->y; - local_790.x = renderOffset.x + pVVar1->x; - quadCursor = set_quad_corner_colors - (tileQuad2,&local_790,&local_7e4,&local_7dc,&local_7f4,whiteColorA); - quadDst = edgeQuad0; - for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { - *quadDst = *quadCursor; - quadCursor = quadCursor + 1; - quadDst = quadDst + 1; - } - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = local_79c * 0.5 + topLeftX; - local_7d4.y = local_708.x; - local_79c = local_7d4.x; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_7f4.x = renderOffset.x + pVVar1->x; - local_7f4.y = renderOffset.y + pVVar1->y; - local_7cc.x = topLeftX; - local_7cc.y = local_708.x; - pVVar1 = Isaac::GetRenderPosition(&local_770,&local_7cc,1); - local_7e4.x = renderOffset.x + pVVar1->x; - local_7e4.y = renderOffset.y + pVVar1->y; - local_7dc.x = local_79c - edgeMargin; - local_7bc.y = local_7ec.x; - local_7bc.x = local_7dc.x; - pVVar1 = Isaac::GetRenderPosition(&local_768,&local_7bc,1); - local_790.x = renderOffset.x + pVVar1->x; - local_790.y = renderOffset.y + pVVar1->y; - local_814.x = local_788.x; - local_814.y = local_7ec.x; - pVVar1 = Isaac::GetRenderPosition(&local_760,&local_814,1); - local_7b4.y = renderOffset.y + pVVar1->y; - local_7b4.x = renderOffset.x + pVVar1->x; - quadCursor = set_quad_corner_colors - (tileQuad2,&local_7b4,&local_790,&local_7e4,&local_7f4,whiteColorA); - quadDst = edgeQuad1; - for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { - *quadDst = *quadCursor; - quadCursor = quadCursor + 1; - quadDst = quadDst + 1; - } - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = local_79c; - local_7d4.y = topLeftY; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_7f4.x = renderOffset.x + pVVar1->x; - local_7f4.y = renderOffset.y + pVVar1->y; - local_7cc.x = local_79c; - local_7cc.y = local_708.x; - pVVar1 = Isaac::GetRenderPosition(&local_770,&local_7cc,1); - local_790.x = renderOffset.x + pVVar1->x; - local_790.y = renderOffset.y + pVVar1->y; - local_7bc.x = local_7dc.x; - local_7e4.x = topLeftY - edgeMargin; - local_7bc.y = local_7e4.x; - pVVar1 = Isaac::GetRenderPosition(&local_768,&local_7bc,1); - local_7b4.x = renderOffset.x + pVVar1->x; - local_7b4.y = renderOffset.y + pVVar1->y; - local_814.x = local_7dc.x; - local_814.y = local_7ec.x; - pVVar1 = Isaac::GetRenderPosition(&local_760,&local_814,1); - local_7a4.y = renderOffset.y + pVVar1->y; - local_7a4.x = renderOffset.x + pVVar1->x; - quadCursor = set_quad_corner_colors - (tileQuad2,&local_7a4,&local_7b4,&local_790,&local_7f4,whiteColorA); - quadDst = edgeQuad2; - for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { - *quadDst = *quadCursor; - quadCursor = quadCursor + 1; - quadDst = quadDst + 1; - } - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = bottomRightX; - local_7d4.y = topLeftY; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_7f4.x = renderOffset.x + pVVar1->x; - local_7f4.y = renderOffset.y + pVVar1->y; - local_7cc.x = local_79c; - local_7cc.y = topLeftY; - pVVar1 = Isaac::GetRenderPosition(&local_770,&local_7cc,1); - local_790.x = renderOffset.x + pVVar1->x; - local_790.y = renderOffset.y + pVVar1->y; - local_7ec.x = bottomRightX + edgeMargin; - local_7bc.y = local_7e4.x; - local_7bc.x = local_7ec.x; - pVVar1 = Isaac::GetRenderPosition(&local_768,&local_7bc,1); - local_7b4.x = renderOffset.x + pVVar1->x; - local_7b4.y = renderOffset.y + pVVar1->y; - local_814.x = local_7dc.x; - local_814.y = local_7e4.x; - pVVar1 = Isaac::GetRenderPosition(&local_760,&local_814,1); - local_708.y = renderOffset.y + pVVar1->y; - local_708.x = renderOffset.x + pVVar1->x; - quadCursor = set_quad_corner_colors - (tileQuad2,&local_708,&local_7b4,&local_790,&local_7f4,whiteColorA); - quadDst = edgeQuad3; - for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { - *quadDst = *quadCursor; - quadCursor = quadCursor + 1; - quadDst = quadDst + 1; - } - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = bottomRightX; - local_7d4.y = bottomRightY; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_7f4.x = renderOffset.x + pVVar1->x; - local_7f4.y = renderOffset.y + pVVar1->y; - local_7cc.x = bottomRightX; - local_7cc.y = topLeftY; - pVVar1 = Isaac::GetRenderPosition(&local_770,&local_7cc,1); - local_7dc.x = renderOffset.x + pVVar1->x; - local_7dc.y = renderOffset.y + pVVar1->y; - local_7bc.x = local_7ec.x; - local_7bc.y = local_7c4.x; - pVVar1 = Isaac::GetRenderPosition(&local_768,&local_7bc,1); - local_790.x = renderOffset.x + pVVar1->x; - local_790.y = renderOffset.y + pVVar1->y; - local_814.x = local_7ec.x; - local_814.y = local_7e4.x; - pVVar1 = Isaac::GetRenderPosition(&local_760,&local_814,1); - local_7b4.x = renderOffset.x + pVVar1->x; - local_7b4.y = renderOffset.y + pVVar1->y; - quadCursor = set_quad_corner_colors - (tileQuad2,&local_7b4,&local_790,&local_7dc,&local_7f4,whiteColorA); - quadDst = edgeQuad4; - for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { - *quadDst = *quadCursor; - quadCursor = quadCursor + 1; - quadDst = quadDst + 1; - } - (GHIDRA_CAST((whiteColorA)))->KColor::SetFromARGB(0xffffffff); - local_7d4.x = topLeftX; - local_7d4.y = bottomRightY; - pVVar1 = Isaac::GetRenderPosition(&local_780,&local_7d4,1); - local_7f4.x = renderOffset.x + pVVar1->x; - local_7f4.y = renderOffset.y + pVVar1->y; - local_7cc.x = bottomRightX; - local_7cc.y = bottomRightY; - pVVar1 = Isaac::GetRenderPosition(&local_770,&local_7cc,1); - local_7dc.x = renderOffset.x + pVVar1->x; - local_7dc.y = renderOffset.y + pVVar1->y; - local_7bc.x = local_788.x; - local_7bc.y = local_7c4.x; - pVVar1 = Isaac::GetRenderPosition(&local_768,&local_7bc,1); - local_7e4.x = renderOffset.x + pVVar1->x; - local_7e4.y = renderOffset.y + pVVar1->y; - local_814.x = local_7ec.x; - local_814.y = local_7c4.x; - pVVar1 = Isaac::GetRenderPosition(&local_760,&local_814,1); - local_790.y = renderOffset.y + pVVar1->y; - local_790.x = renderOffset.x + pVVar1->x; - pVVar1 = &local_7f4; - quadCursor = set_quad_corner_colors - (tileQuad2,&local_790,&local_7e4,&local_7dc,pVVar1,whiteColorA); - quadDst = edgeQuad5; - for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { - *quadDst = *quadCursor; - quadCursor = quadCursor + 1; - quadDst = quadDst + 1; - } - } -LAB_0081d167: - pvVar7 = (void *)0x81d16e; - FUN_00682260(); - (GHIDRA_CAST((auStackY_8b4 + 0x8c)))->KAGE::SmartPointer::operator_assign(&DAT_00c797c4); - apply_sprite_shader_params(GHIDRA_CAST(&waterColor),1,pVVar1,pvVar7); - local_7f4.x = (float)&srcQuad0TopLeftX; - local_7ec.x = 0.0; - do { - texture = GHIDRA_CAST(EntityPtr)::Ref(); - drawFn = *(code **)(*texture + 0x14); - FUN_00407220(); - (*drawFn)(local_7f4.x); - local_7f4.x = (float)(GHIDRA_INT(local_7f4.x) + 0x24); - local_7ec.x = (float)(GHIDRA_INT(local_7ec.x) + 1); - } while (GHIDRA_INT(local_7ec.x) < 0xc); -LAB_0081deea: - shader_cache_find(0xb1a5b0); - return; -} - -// 0081e240 -uint32_t Room::IsAmbushActive() -{ - return CONCAT31((int3)(GHIDRA_UINT(g_game) >> 8),(g_game->_ambush)._isActive); -} - -// 0081e250 -float Room::GetLightingAlpha() -{ - int iVar1; - uint32_t uVar2; - uint8_t isAbandonedMineshaft; - uint32_t forcedCurses; - uint32_t preventedCurses; - Entity_Player *player; - uint32_t uVar3; - float playerDistance; - float fVar4; - float alpha; - Vector local_10; - Game *game; - - if (this->_backdropType == 0x39) { - return g_game->_darknessStrength * g_game->_darknessModifier; - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 9 & 1) != 0) { - return 1.0; - } - iVar1 = g_game->_stage; - uVar2 = g_game->_debugCurses; - uVar3 = g_game->_curses; - local_10.x = (float)g_game->_stageType; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - if ((~preventedCurses & (forcedCurses | uVar2 | uVar3) & 1) == 0) { - alpha = (this->_fxLayers)._fxParams.shadowAlpha; - if ((((iVar1 == 1) && (local_10.x != 5.60519e-45)) && (local_10.x != 7.00649e-45)) && - (local_10.x != 2.8026e-45)) { - alpha = alpha * 0.6; - } - } - else { - alpha = 1.0; - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1a9,GHIDRA_CAST(&g_game->_playerManager),1); - if (player != GHIDRA_CAST(0x0)) { - alpha = alpha * 0.5; - } - player = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x1cc,GHIDRA_CAST(&g_game->_playerManager),1); - if ((player != GHIDRA_CAST(0x0)) && (alpha = alpha + 0.1, 1.0 <= alpha)) { - alpha = 1.0; - } - alpha = (g_game->_darknessStrength - alpha) * g_game->_darknessModifier + alpha; - if ((((this->_roomType == 8) || (this->_roomType == 0x1d)) || - ((isAbandonedMineshaft = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)), - isAbandonedMineshaft != 0 && (g_game->_currentDimensionIdx == 1)))) || - (g_game->_currentDimensionIdx == 2)) { - fVar4 = alpha + 0.33; - alpha = 1.0; - if (fVar4 <= 1.0) { - alpha = fVar4; - } - } - game = g_game; - if (iVar1 == 9) { - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 8)) == 5) { - uVar2 = (this->_entityList)._updateEL._size; - uVar3 = 0; - if (uVar2 != 0) { - while ((iVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))) + uVar3 * 4)), - *GHIDRA_CAST((iVar1 + 0x28)) != 0x197 || (*GHIDRA_CAST((iVar1 + 0x2c)) != 0))) { - uVar3 = uVar3 + 1; - if (uVar2 <= uVar3) { - return alpha; - } - } - fVar4 = 1.0 - *GHIDRA_CAST((iVar1 + 0x380)) / *GHIDRA_CAST((iVar1 + 900)); - if (fVar4 <= alpha) { - fVar4 = alpha; - } - return fVar4; - } - } - else if (g_game->_currentRoomIdx == -9) { - GetCenterPos(&local_10); - player = Game::GetNearestPlayer(game,&local_10); - local_10.y = local_10.y - (player->_pos).y; - fVar4 = local_10.x - (player->_pos).x; - playerDistance = sqrtf(local_10.y * local_10.y + fVar4 * fVar4); - fVar4 = 300.0; - if (playerDistance <= 300.0) { - fVar4 = playerDistance; - } - alpha = 1.0 - fVar4 / 300.0; - } - } - return alpha; -} - -// 0081e520 -Vector * Room::FindFreeTilePosition(Vector *outPos, Vector *pos, float distanceThreshold) -{ - int iVar1; - uint32_t gridCollision; - int iVar2; - int index; - float fVar3; - float fVar4; - float distSq; - float resultX; - float resultY; - float bestX; - float bestY; - float bestDistSq; - - iVar2 = GHIDRA_INT(((pos->x - 40.0) / 40.0 + 0.5)); - if ((((iVar2 < 0) || (this->_gridWidth <= iVar2)) || - (iVar1 = GHIDRA_INT(((pos->y - 120.0) / 40.0 + 0.5)), iVar1 < 0)) || (this->_gridHeight <= iVar1)) { - iVar2 = -1; - } - else { - iVar2 = this->_gridWidth * iVar1 + iVar2; - } - gridCollision = GetGridCollision(this,iVar2); - if (gridCollision == 0) { - resultY = pos->y; - outPos->x = pos->x; - outPos->y = resultY; - return outPos; - } - index = 0; - iVar1 = this->_gridHeight * this->_gridWidth; - bestX = (float)(iVar2 % this->_gridWidth) * 40.0 + 40.0; - bestDistSq = 1e+06; - bestY = (float)(iVar2 / this->_gridWidth) * 40.0 + 120.0; - resultY = bestY; - fVar3 = bestY; - resultX = bestX; - fVar4 = bestX; - if (0 < iVar1) { - do { - if ((index != iVar2) && - (gridCollision = GetGridCollision(this,index), fVar3 = bestY, fVar4 = bestX, - gridCollision == 0)) { - resultY = (float)(index / this->_gridWidth) * 40.0 + 120.0; - resultX = (float)(index % this->_gridWidth) * 40.0 + 40.0; - fVar4 = resultY - pos->y; - fVar3 = resultX - pos->x; - distSq = fVar4 * fVar4 + fVar3 * fVar3; - fVar3 = bestY; - fVar4 = bestX; - if ((distSq < bestDistSq) && - (bestX = resultX, bestY = resultY, bestDistSq = distSq, fVar3 = resultY, fVar4 = resultX, - distSq < distanceThreshold * distanceThreshold)) break; - } - resultX = fVar4; - resultY = fVar3; - index = index + 1; - fVar3 = resultY; - fVar4 = resultX; - } while (index < iVar1); - } - outPos->x = resultX; - outPos->y = resultY; - return outPos; -} - -// 0081e6e0 -uint8_t Room::TryMakeBridge(GridEntity *pit, GridEntity *rock) -{ - uint32_t gridIndex; - void *gridAbove; - GridEntity_Pit *pitEntity; - int iVar1; - uint32_t uVar2; - int iVar3; - void *gridBelow; - void *gridLeft; - int gridYAbove; - float pitY; - float pitX; - void *gridRight; - - if (pit == GHIDRA_CAST(0x0)) { - return 0; - } - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pit)) + 0x4)))) != 7) { - return 0; - } - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); - pitY = (float)(pit->_gridIndex / iVar3) * 40.0 + 120.0; - pitX = (float)(pit->_gridIndex % iVar3) * 40.0 + 40.0; - iVar3 = GHIDRA_INT((((pitX + 40.0) - 40.0) / 40.0 + 0.5)); - if ((((iVar3 < 0) || (this->_gridWidth <= iVar3)) || - (iVar1 = GHIDRA_INT((((pitY + 0.0) - 120.0) / 40.0 + 0.5)), iVar1 < 0)) || - ((this->_gridHeight <= iVar1 || - (gridIndex = this->_gridWidth * iVar1 + iVar3, 0x1bf < gridIndex)))) { - gridRight = (void *)0x0; - } - else { - gridRight = this->_gridEntities[gridIndex]; - } - iVar3 = GHIDRA_INT((((pitX - 40.0) - 40.0) / 40.0 + 0.5)); - if (((iVar3 < 0) || (this->_gridWidth <= iVar3)) || - ((iVar1 = GHIDRA_INT((((pitY + 0.0) - 120.0) / 40.0 + 0.5)), iVar1 < 0 || - ((this->_gridHeight <= iVar1 || - (gridIndex = this->_gridWidth * iVar1 + iVar3, 0x1bf < gridIndex)))))) { - gridLeft = (void *)0x0; - } - else { - gridLeft = this->_gridEntities[gridIndex]; - } - iVar3 = GHIDRA_INT((((pitX + 0.0) - 40.0) / 40.0 + 0.5)); - if ((((iVar3 < 0) || (this->_gridWidth <= iVar3)) || - (iVar1 = GHIDRA_INT((((pitY + 40.0) - 120.0) / 40.0 + 0.5)), iVar1 < 0)) || - ((this->_gridHeight <= iVar1 || - (gridIndex = this->_gridWidth * iVar1 + iVar3, 0x1bf < gridIndex)))) { - gridBelow = (void *)0x0; - if ((-1 < iVar3) && (iVar1 = this->_gridWidth, iVar3 < iVar1)) goto LAB_0081e871; - } - else { - gridBelow = this->_gridEntities[gridIndex]; - iVar1 = this->_gridWidth; -LAB_0081e871: - gridYAbove = GHIDRA_INT((((pitY - 40.0) - 120.0) / 40.0 + 0.5)); - if (((-1 < gridYAbove) && (gridYAbove < this->_gridHeight)) && - (gridIndex = iVar1 * gridYAbove + iVar3, gridIndex < 0x1c0)) { - gridAbove = this->_gridEntities[gridIndex]; - goto LAB_0081e89e; - } - } - gridAbove = (void *)0x0; -LAB_0081e89e: - if ((((gridRight != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(gridRight) + 4)) == 7)) || - ((gridLeft != (void *)0x0 && (*GHIDRA_CAST((GHIDRA_CAST(gridLeft) + 4)) == 7)))) && - (((gridAbove != (void *)0x0 && (*GHIDRA_CAST((GHIDRA_CAST(gridAbove) + 4)) == 7)) || - ((gridBelow != (void *)0x0 && (*GHIDRA_CAST((GHIDRA_CAST(gridBelow) + 4)) == 7)))))) { - return 0; - } - pitEntity = (GridEntity_Pit *) - __RTDynamicCast(pit,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor, - &IsaacRepentancePlus::GridEntity_Pit::RTTI_Type_Descriptor,0); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pitEntity)) + 0xc)))) == 0) { - if (((rock == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((rock)) + 0x4)))) != 0x19)) || - (uVar2 = 3, *GHIDRA_CAST(rock[1]._sprite._filename._buf) != 1)) { - uVar2 = 2; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pitEntity)) + 0xc)))) = uVar2; - (GHIDRA_CAST((pitEntity)))->GridEntity_Pit::UpdateCollision(); - } - return 1; -} - -// 0081e930 -void Room::RemoveGridEntity(int gridIndex, int pathTrail, uint8_t isKeepDecoration) -{ - uint8_t insertResult [12]; - - if (((GHIDRA_UINT(gridIndex) < 0x1c0) && (this->_gridEntities[gridIndex] != (void *)0x0)) && - ((*GHIDRA_CAST((GHIDRA_INT(this->_gridEntities[gridIndex]) + 4)) != 1 || (isKeepDecoration == 0)))) { - this->_gridPaths[gridIndex] = pathTrail; - msvc::set::insert(insertResult,&gridIndex); - } - return; -} - -// 0081e980 -void Room::RemoveGridEntityImmediate(int GridIndex, int PathTrail, uint8_t KeepDecoration) -{ - uint32_t *gridEntity; - - if (((GHIDRA_UINT(GridIndex) < 0x1c0) && - (gridEntity = this->_gridEntities[GridIndex], gridEntity != GHIDRA_CAST(0x0))) && - ((gridEntity[1] != 1 || (KeepDecoration == 0)))) { - this->_gridPaths[GridIndex] = PathTrail; - this->_gridEntities[GridIndex] = (void *)0x0; - (**(code **)*gridEntity)(1); - } - return; -} - -// 0081e9d0 -Vector * Room::GetRandomPosition(Vector *outPosition, float margin) -{ - double dVar1; - double dVar2; - uint32_t randomValue; - uint32_t randomY; - float areaASize; - float areaBWidth; - float areaAHeight; - float areaAWidth; - float areaBHeight; - float splitY; - Vector local_30; - float areaALeft; - float areaATop; - float areaARight; - float areaABottom; - float areaBLeft; - float areaBTop; - float areaBRight; - float areaBBottom; - - if (3 < *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)) - 9U) { - randomValue = Random(); - local_30.x = (float)((double)GHIDRA_INT(randomValue) + - __uint_to_double_fixup[-(GHIDRA_INT(randomValue) >> 0x1f)]) * 2.3283064e-10; - randomValue = Random(); - local_30.x = ((this->_bottomRightPos).x - (this->_topLeftPos).x) * local_30.x + - (this->_topLeftPos).x; - local_30.y = ((this->_bottomRightPos).y - (this->_topLeftPos).y) * - (float)((double)GHIDRA_INT(randomValue) + - __uint_to_double_fixup[-(GHIDRA_INT(randomValue) >> 0x1f)]) * 2.3283064e-10 + - (this->_topLeftPos).y; - GetClampedPositionImpl(this,outPosition,&local_30,margin,margin,margin,margin); - return outPosition; - } - GetLRoomAreaDesc(this,&areaALeft); - local_30.x = areaALeft - margin; - splitY = areaABottom + margin; - areaAWidth = (areaARight + margin) - local_30.x; - areaBWidth = (areaBRight + margin) - (areaBLeft - margin); - if (areaAWidth < areaBWidth) { - splitY = areaBTop - margin; - } - areaAHeight = splitY - (areaATop - margin); - areaBHeight = (areaBBottom + margin) - splitY; - areaASize = ABS(areaAHeight * areaAWidth); - randomValue = Random(); - if ((float)((double)GHIDRA_INT(randomValue) + __uint_to_double_fixup[-(GHIDRA_INT(randomValue) >> 0x1f)]) * - 2.3283064e-10 < areaASize / (ABS(areaBHeight * areaBWidth) + areaASize)) { - randomValue = Random(); - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(randomValue) >> 0x1f)]; - randomY = Random(); - dVar2 = __uint_to_double_fixup[-(GHIDRA_INT(randomY) >> 0x1f)]; - outPosition->x = - areaAWidth * (float)((double)GHIDRA_INT(randomValue) + dVar1) * 2.3283064e-10 + local_30.x; - outPosition->y = - (float)((double)GHIDRA_INT(randomY) + dVar2) * 2.3283064e-10 * areaAHeight + (areaATop - margin); - return outPosition; - } - randomValue = Random(); - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(randomValue) >> 0x1f)]; - randomY = Random(); - dVar2 = __uint_to_double_fixup[-(GHIDRA_INT(randomY) >> 0x1f)]; - outPosition->x = - areaBWidth * (float)((double)GHIDRA_INT(randomValue) + dVar1) * 2.3283064e-10 + (areaBLeft - margin) - ; - outPosition->y = (float)((double)GHIDRA_INT(randomY) + dVar2) * 2.3283064e-10 * areaBHeight + splitY; - return outPosition; -} - -// 0081ecc0 -int Room::GetRandomTileIndex(uint32_t seed) -{ - uint32_t rngResult; - int iVar1; - int maxY; - int tileDesc; - uint32_t local_2c; - uint32_t local_28; - uint32_t local_24; - RNG local_20; - int tileX; - Room *local_c; - int maxY; - int minX; - - minX = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)); - maxY = minX * 0x20; - local_c = this; - if (minX - 9U < 4) { - tileDesc = *GHIDRA_CAST((&DAT_00c35b80 + maxY)); - local_2c = *GHIDRA_CAST((&DAT_00c35b84 + maxY)); - local_28 = *GHIDRA_CAST((&DAT_00c35b88 + maxY)); - local_24 = *GHIDRA_CAST((&DAT_00c35b8c + maxY)); - local_20._seed = *GHIDRA_CAST((&DAT_00c35b90 + maxY)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) = *GHIDRA_CAST((&DAT_00c35b94 + maxY)); - local_20._shift3 = *GHIDRA_CAST((&DAT_00c35b9c + maxY)); - (GHIDRA_CAST((GHIDRA_CAST(&tileDesc))))->LRoomTileDesc::GetRandomTile(&tileX,seed); - if (((-1 < tileX) && (tileX < this->_gridWidth)) && - ((-1 < GHIDRA_INT(local_c) && (GHIDRA_INT(local_c) < this->_gridHeight)))) { - return this->_gridWidth * GHIDRA_INT(local_c) + tileX; - } - } - else { - minX = *GHIDRA_CAST((&DAT_00c35b80 + maxY)); - iVar1 = *GHIDRA_CAST((&DAT_00c35b84 + maxY)); - maxY = *GHIDRA_CAST((&DAT_00c35b8c + maxY)); - local_20._seed = seed; - local_20._shift3 = 0x1d; - local_20._shift1 = 1; - local_20._shift2 = 9; - rngResult = (GHIDRA_CAST((&local_20)))->RNG::RandomInt(*GHIDRA_CAST((&DAT_00c35b88 + maxY)) - minX); - minX = rngResult + minX; - rngResult = (GHIDRA_CAST((&local_20)))->RNG::RandomInt(maxY - iVar1); - iVar1 = rngResult + iVar1; - if (-1 < minX) { - if (((minX < local_c->_gridWidth) && (-1 < iVar1)) && (iVar1 < local_c->_gridHeight)) { - return iVar1 * local_c->_gridWidth + minX; - } - } - } - return -1; -} - -// 0081edd0 -uint32_t Room::GetBrokenWatchState() -{ - uint32_t watchState; - - watchState = 2; - if (g_game->_challenge != 0x16) { - watchState = this->_brokenWatchState; - } - return watchState; -} - -// 0081edf0 -void Room::SetBrokenWatchState(int state) -{ - float musicPitch; - Manager *manager; - - manager = g_manager; - this->_brokenWatchState = state; - musicPitch = time_scale_update(this); - (manager->_musicManager)._targetPitch = musicPitch; - return; -} - -// 0081ee20 -void Room::make_walls() -{ - int iVar1; - int y; - int iVar2; - int iVar3; - int tileDesc; - int tileMinY; - int tileMaxX; - int tileMaxY; - int *roomConfig; - - roomConfig = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if (((roomConfig == GHIDRA_CAST(0x0)) || (roomConfig[2] != 0x10)) || (*roomConfig != 0x23)) { - iVar2 = roomConfig[0x12]; - if (iVar2 == 0xb) { - iVar2 = 0; - if (0 < this->_gridWidth) { - do { - make_wall(this,iVar2,0); - if (iVar2 < 0xd) { - iVar1 = 8; - } - else { - iVar1 = this->_gridHeight + -1; - } - make_wall(this,iVar2,iVar1); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridWidth); - } - iVar2 = 0; - if (0 < this->_gridHeight + -1) { - do { - iVar1 = 0; - if (7 < iVar2) { - iVar1 = 0xd; - } - make_wall(this,iVar1,iVar2); - make_wall(this,this->_gridWidth + -1,iVar2); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridHeight + -1); - return; - } - } - else if (iVar2 == 0xc) { - iVar2 = 0; - if (0 < this->_gridWidth) { - do { - make_wall(this,iVar2,0); - if (iVar2 < 0xf) { - iVar1 = this->_gridHeight + -1; - } - else { - iVar1 = 8; - } - make_wall(this,iVar2,iVar1); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridWidth); - } - iVar2 = 0; - if (0 < this->_gridHeight + -1) { - do { - make_wall(this,0,iVar2); - if (iVar2 < 8) { - iVar1 = this->_gridWidth + -1; - } - else { - iVar1 = 0xe; - } - make_wall(this,iVar1,iVar2); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridHeight + -1); - return; - } - } - else if (iVar2 == 9) { - iVar2 = 0; - if (0 < this->_gridWidth) { - do { - iVar1 = 7; - if (0xd < iVar2) { - iVar1 = 0; - } - make_wall(this,iVar2,iVar1); - make_wall(this,iVar2,this->_gridHeight + -1); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridWidth); - } - iVar2 = 0; - if (0 < this->_gridHeight + -1) { - do { - iVar1 = 0xd; - if (7 < iVar2) { - iVar1 = 0; - } - make_wall(this,iVar1,iVar2); - make_wall(this,this->_gridWidth + -1,iVar2); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridHeight + -1); - return; - } - } - else if (iVar2 == 10) { - iVar2 = 0; - if (0 < this->_gridWidth) { - do { - iVar1 = 0; - if (0xe < iVar2) { - iVar1 = 7; - } - make_wall(this,iVar2,iVar1); - make_wall(this,iVar2,this->_gridHeight + -1); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridWidth); - } - iVar2 = 0; - if (0 < this->_gridHeight + -1) { - do { - make_wall(this,0,iVar2); - if (iVar2 < 8) { - iVar1 = 0xe; - } - else { - iVar1 = this->_gridWidth + -1; - } - make_wall(this,iVar1,iVar2); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridHeight + -1); - return; - } - } - else if (((iVar2 == 2) || (iVar2 == 3)) || ((iVar2 == 7 || (iVar2 == 5)))) { - GetLRoomTileDesc(this,GHIDRA_CAST(&tileDesc)); - iVar2 = tileDesc + -1; - iVar1 = tileMaxX + 1; - if (iVar2 <= iVar1) { - y = tileMinY + -1; - iVar3 = iVar2; - do { - make_wall(this,iVar3,y); - make_wall(this,iVar3,tileMaxY + 1); - iVar3 = iVar3 + 1; - } while (iVar3 <= iVar1); - } - iVar3 = tileMinY + -1; - if (iVar3 <= tileMaxY + 1) { - do { - make_wall(this,iVar2,iVar3); - make_wall(this,iVar1,iVar3); - iVar3 = iVar3 + 1; - } while (iVar3 <= tileMaxY + 1); - } - } - else { - iVar2 = 0; - if (0 < this->_gridWidth) { - do { - make_wall(this,iVar2,0); - make_wall(this,iVar2,this->_gridHeight + -1); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridWidth); - } - iVar2 = 0; - if (0 < this->_gridHeight + -1) { - do { - make_wall(this,0,iVar2); - make_wall(this,this->_gridWidth + -1,iVar2); - iVar2 = iVar2 + 1; - } while (iVar2 < this->_gridHeight + -1); - return; - } - } - } - return; -} - -// 0081f130 -void Room::render_debug_grid_indices(Vector *renderOffset) -{ - KColor color; - KColor color_00; - int columnGridIndex; - void *glyphQuads; - int gridWidth; - int iVar1; - int columnGridIndex; - double dVar3; - uint8_t glyphBuffer [16]; - KColor lineColor; - uint32_t fontSettings; - uint32_t local_90; - uint32_t local_8c; - uint32_t local_88; - uint32_t local_84; - uint32_t local_80; - uint32_t local_7c; - Vector lineEnd; - Vector local_70; - float local_68; - float local_64; - float local_60; - float local_5c; - uint8_t labelText [64]; - uint32_t local_18; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - Manager *manager; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b01781; - local_10 = ExceptionList; - local_18 = __security_cookie ^ GHIDRA_UINT((labelText + 0x54)); - ExceptionList = &local_10; - iVar1 = 0; - gridWidth = this->_gridWidth; - lineColor._unk = 0; - lineColor._red = 1.0; - lineColor._green = 1.0; - lineColor._blue = 0.0; - lineColor._alpha = 0.2; - if (0 < gridWidth) { - do { - if (((iVar1 < 0) || (gridWidth <= iVar1)) || (columnGridIndex = this->_gridHeight, columnGridIndex < 1)) { - columnGridIndex = this->_gridHeight; - columnGridIndex = -1; - } - else { - columnGridIndex = iVar1; - } - local_68 = g_displayPixelRatio * g_screenPointScale; - local_64 = ((((float)(columnGridIndex / gridWidth) * 40.0 + 120.0) - 20.0) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_5c = (((((float)(columnGridIndex % gridWidth) * 40.0 + 40.0) - 20.0) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_68 + 0.5; - dVar3 = floor((double)local_5c); - local_60 = (float)dVar3 / local_68; - local_5c = local_64 * local_68 + 0.5; - dVar3 = floor((double)local_5c); - local_5c = (float)dVar3; - lineEnd.x = local_60 + renderOffset->x; - local_70.y = local_5c / local_68 + renderOffset->y; - lineEnd.y = renderOffset->y + (float)columnGridIndex * 26.0 + local_5c / local_68; - local_70.x = lineEnd.x; - render_color_quad(&local_70,&lineEnd,&lineColor,&lineColor,1.0); - gridWidth = this->_gridWidth; - iVar1 = iVar1 + 1; - } while (iVar1 < gridWidth); - } - iVar1 = this->_gridHeight; - columnGridIndex = 0; - if (0 < iVar1) { - do { - gridWidth = this->_gridWidth; - if (((gridWidth < 1) || (columnGridIndex < 0)) || (iVar1 <= columnGridIndex)) { - iVar1 = -1; - } - else { - iVar1 = gridWidth * columnGridIndex; - } - local_68 = g_displayPixelRatio * g_screenPointScale; - local_5c = ((((float)(iVar1 / gridWidth) * 40.0 + 120.0) - 20.0) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_60 = (((((float)(iVar1 % gridWidth) * 40.0 + 40.0) - 20.0) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * local_68 + 0.5; - dVar3 = floor((double)local_60); - local_64 = (float)dVar3 / local_68; - local_60 = local_5c * local_68 + 0.5; - dVar3 = floor((double)local_60); - local_60 = (float)dVar3; - lineEnd.y = local_60 / local_68 + renderOffset->y; - local_70.x = local_64 + renderOffset->x; - lineEnd.x = renderOffset->x + (float)gridWidth * 26.0 + local_64; - local_70.y = lineEnd.y; - render_color_quad(&local_70,&lineEnd,&lineColor,&lineColor,1.0); - iVar1 = this->_gridHeight; - columnGridIndex = columnGridIndex + 1; - } while (columnGridIndex < iVar1); - gridWidth = this->_gridWidth; - } - local_68 = 0.0; - if (0 < gridWidth * iVar1) { - do { - local_5c = g_displayPixelRatio * g_screenPointScale; - local_70.y = (((float)(GHIDRA_INT(local_68) / gridWidth) * 40.0 + 120.0) - 140.0) * 0.65 + - (g_screenHeight - 182.0) * 0.5; - local_60 = local_5c * - ((((float)(GHIDRA_INT(local_68) % gridWidth) * 40.0 + 40.0) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) + 0.5; - dVar3 = floor((double)local_60); - local_60 = (float)dVar3; - local_64 = local_60 / local_5c; - local_70.y = local_5c * local_70.y + 0.5; - dVar3 = floor((double)local_70.y); - local_70.y = (float)dVar3; - local_5c = local_70.y / local_5c; - sprintf_s(labelText,0x3f,s__d); - manager = g_manager; - fontSettings = 0; - local_90 = 0xffff; - local_8c = 0; - local_88 = 0x3f800000; - local_84 = 0xffffffff; - local_80 = 0; - local_7c = 0; - local_8 = 0; - local_70.y = (local_5c - 13.0) + renderOffset->y; - local_64 = local_64 - 13.0; - local_60 = local_64 + renderOffset->x; - glyphQuads = Font::measure_string - (&g_manager->_font2_TeamMeatEx12,&lineColor._green,labelText, - &fontSettings,&g_vectorOne); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - color._alpha = 0.2; - color._red = 1.0; - color._green = 1.0; - color._blue = 0.0; - color._unk = 0; - Font::render_glyph_quads - (&manager->_font2_TeamMeatEx12,glyphQuads,local_60,local_70.y,1.0,1.0,color, - &fontSettings); - msvc::vector<12byte>::clear(); - msvc::vector<12byte>::_Tidy(); - sprintf_s(labelText,0x3f,GHIDRA_CAST("%d,%d")); - manager = g_manager; - fontSettings = 0; - local_90 = 0xffff; - local_8c = 0; - local_88 = 0x3f800000; - local_84 = 0xffffffff; - local_80 = 0; - local_7c = 0; - local_8 = 2; - local_5c = local_5c + renderOffset->y; - local_64 = local_64 + renderOffset->x; - glyphQuads = Font::measure_string - (&g_manager->_font2_TeamMeatEx12,glyphBuffer,labelText,&fontSettings, - &g_vectorOne); - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); - color_00._alpha = 0.2; - color_00._red = 1.0; - color_00._green = 1.0; - color_00._blue = 0.0; - color_00._unk = 0; - Font::render_glyph_quads - (&manager->_font2_TeamMeatEx12,glyphQuads,local_64,local_5c,1.0,1.0,color_00, - &fontSettings); - msvc::vector<12byte>::clear(); - msvc::vector<12byte>::_Tidy(); - local_8 = 0xffffffff; - local_68 = (float)(GHIDRA_INT(local_68) + 1); - gridWidth = this->_gridWidth; - } while (GHIDRA_INT(local_68) < this->_gridHeight * gridWidth); - } - ExceptionList = local_10; - return; -} - -// 0081f890 -uint8_t Room::IsLShapedRoom() -{ - return *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)) - 9U < 4; -} - -// 0081f8b0 -void * Room::GetLRoomAreaDesc(void *buffer) -{ - float fVar1; - float fVar2; - float fVar3; - int bottomRightB; - int bottomRightA; - int topLeftA; - int bottomRightARow; - int gridWidth; - int bottomRightARow; - int bottomRightBRow; - int topLeftARow; - int topLeftBRow; - - bottomRightARow = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)); - if (3 < bottomRightARow - 9U) { - fVar1 = (this->_topLeftPos).x; - fVar2 = (this->_topLeftPos).y; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 4)) = (this->_topLeftPos).y; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0xc)) = (this->_bottomRightPos).y; - fVar3 = (this->_topLeftPos).x; - *GHIDRA_CAST(buffer) = fVar1; - fVar1 = (this->_bottomRightPos).x; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x10)) = fVar3; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x14)) = fVar2; - fVar2 = (this->_bottomRightPos).y; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 8)) = fVar1; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x18)) = fVar1; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x1c)) = fVar2; - return buffer; - } - bottomRightARow = bottomRightARow * 0x20; - topLeftA = *GHIDRA_CAST((&DAT_00c35b80 + bottomRightARow)); - bottomRightB = *GHIDRA_CAST((&DAT_00c35b98 + bottomRightARow)); - topLeftBRow = *GHIDRA_CAST((&DAT_00c35b94 + bottomRightARow)); - bottomRightBRow = *GHIDRA_CAST((&DAT_00c35b9c + bottomRightARow)); - topLeftARow = *GHIDRA_CAST((&DAT_00c35b84 + bottomRightARow)); - bottomRightA = *GHIDRA_CAST((&DAT_00c35b88 + bottomRightARow)); - bottomRightARow = *GHIDRA_CAST((&DAT_00c35b8c + bottomRightARow)); - bottomRightARow = *GHIDRA_CAST((&DAT_00c35b90 + bottomRightARow)); - if ((((bottomRightB < 0) || (gridWidth = this->_gridWidth, gridWidth <= bottomRightB)) || - (bottomRightBRow < 0)) || (this->_gridHeight <= bottomRightBRow)) { - gridWidth = this->_gridWidth; - bottomRightB = -1; - } - else { - bottomRightB = gridWidth * bottomRightBRow + bottomRightB; - } - if (((bottomRightARow < 0) || (gridWidth <= bottomRightARow)) || - ((topLeftBRow < 0 || (this->_gridHeight <= topLeftBRow)))) { - bottomRightARow = -1; - } - else { - bottomRightARow = gridWidth * topLeftBRow + bottomRightARow; - } - if (((bottomRightA < 0) || (gridWidth <= bottomRightA)) || - ((bottomRightARow < 0 || (this->_gridHeight <= bottomRightARow)))) { - bottomRightA = -1; - } - else { - bottomRightA = gridWidth * bottomRightARow + bottomRightA; - } - if ((((topLeftA < 0) || (gridWidth <= topLeftA)) || (topLeftARow < 0)) || - (this->_gridHeight <= topLeftARow)) { - topLeftA = -1; - } - else { - topLeftA = gridWidth * topLeftARow + topLeftA; - } - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 8)) = (float)(bottomRightA % gridWidth) * 40.0 + 40.0 + 20.0; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0xc)) = (float)(bottomRightA / gridWidth) * 40.0 + 120.0 + 20.0; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x10)) = ((float)(bottomRightARow % gridWidth) * 40.0 + 40.0) - 20.0; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x14)) = ((float)(bottomRightARow / gridWidth) * 40.0 + 120.0) - 20.0; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 4)) = ((float)(topLeftA / gridWidth) * 40.0 + 120.0) - 20.0; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x18)) = (float)(bottomRightB % gridWidth) * 40.0 + 40.0 + 20.0; - *GHIDRA_CAST(buffer) = ((float)(topLeftA % gridWidth) * 40.0 + 40.0) - 20.0; - *GHIDRA_CAST((GHIDRA_CAST(buffer) + 0x1c)) = (float)(bottomRightB / gridWidth) * 40.0 + 120.0 + 20.0; - return buffer; -} - -// 0081fb20 -LRoomTileDesc * Room::GetLRoomTileDesc(LRoomTileDesc *buffer) -{ - int shapeOffset; - - shapeOffset = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)) * 0x20; - *GHIDRA_CAST(buffer) = *GHIDRA_CAST((&DAT_00c35b80 + shapeOffset)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(buffer[1])) + 0x1)))) = *GHIDRA_CAST((&DAT_00c35b84 + shapeOffset)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(buffer[2])) + 0x2)))) = *GHIDRA_CAST((&DAT_00c35b88 + shapeOffset)); - *GHIDRA_CAST((buffer + 4)) = *GHIDRA_CAST((&DAT_00c35b8c + shapeOffset)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(buffer[5])) + 0x1)))) = *GHIDRA_CAST((&DAT_00c35b90 + shapeOffset)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(buffer[6])) + 0x2)))) = *GHIDRA_CAST((&DAT_00c35b94 + shapeOffset)); - *GHIDRA_CAST((buffer + 8)) = *GHIDRA_CAST((&DAT_00c35b98 + shapeOffset)); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(buffer[9])) + 0x1)))) = *GHIDRA_CAST((&DAT_00c35b9c + shapeOffset)); - return buffer; -} - -// 0081fd60 -void Room::RespawnEnemies() -{ - Room *door = this; - uint32_t *puVar1; - int *piVar2; - code *pcVar3; - uint8_t isSpawned; - char cVar4; - uint32_t uVar5; - void *freeBlock; - short *spawnEntry; - void **ppvVar6; - uint32_t *puVar7; - int iVar8; - uint8_t auStack_6c [8]; - void *pvStack_64; - void *pvStack_60; - uint32_t *puStack_5c; - uint32_t *puStack_58; - uint8_t auStack_54 [4]; - uint8_t auStack_50 [4]; - void *pvStack_4c; - uint8_t auStack_48 [8]; - void *spawnedEntitySet; - uint32_t uStack_3c; - void *respawnGridIdxSet; - int respawnCount; - int *piStack_30; - uint32_t rngShift3; - uint32_t i; - uint32_t *puStack_24; - void *pvStack_20; - int *roomData; - uint32_t gridIdx; - Entity *pEStack_14; - void *local_10; - uint8_t *puStack_c; - uint32_t uStack_8; - int currentRoomType; - GridEntity_Door *door; - int targetRoomType; - - uStack_8 = 0xffffffff; - puStack_c = &LAB_00b017cd; - local_10 = ExceptionList; - ExceptionList = &local_10; - uVar5 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x5c)); - rngShift3 = 7; - KAGE_LogMessage(1,GHIDRA_CAST("SpawnRNG seed: %u\n")); - iVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))); - piVar2 = *GHIDRA_CAST((iVar8 + 0x14)); - roomData = *GHIDRA_CAST((iVar8 + 0x10)); - if (((piVar2 != GHIDRA_CAST(0x0)) && (*piVar2 == 0)) && (piVar2[2] == 6)) { - roomData = piVar2; - } - *GHIDRA_CAST((iVar8 + 0x40)) = *GHIDRA_CAST((iVar8 + 0x40)) + 1; - (*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x1))) = 0; - respawnGridIdxSet = (void *)0x0; - respawnCount = 0; - respawnGridIdxSet = operator_new(0x14); - *(void **)respawnGridIdxSet = respawnGridIdxSet; - *(void **)(GHIDRA_CAST(respawnGridIdxSet) + 4) = respawnGridIdxSet; - *(void **)(GHIDRA_CAST(respawnGridIdxSet) + 8) = respawnGridIdxSet; - *GHIDRA_CAST((GHIDRA_CAST(respawnGridIdxSet) + 0xc)) = 0x101; - uStack_8 = 0; - spawnedEntitySet = (void *)0x0; - uStack_3c = 0; - spawnedEntitySet = operator_new(0x14); - *(void **)spawnedEntitySet = spawnedEntitySet; - *(void **)(GHIDRA_CAST(spawnedEntitySet) + 4) = spawnedEntitySet; - *(void **)(GHIDRA_CAST(spawnedEntitySet) + 8) = spawnedEntitySet; - *GHIDRA_CAST((GHIDRA_CAST(spawnedEntitySet) + 0xc)) = 0x101; - puVar7 = GHIDRA_CAST(0x0); - pvStack_20 = (void *)0x0; - pvStack_60 = (void *)0x0; - puStack_5c = GHIDRA_CAST(0x0); - puStack_24 = GHIDRA_CAST(0x0); - puStack_58 = GHIDRA_CAST(0x0); - uStack_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_8)) + 0x1))),2); - i = 0; - if ((short)roomData[0x11] != 0) { - pvStack_20 = (void *)0x0; - do { - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar3 = (code *)swi(3); - (*pcVar3)(); - return; - } - uVar5 = uVar5 >> 2 ^ uVar5; - uVar5 = uVar5 << 7 ^ uVar5; - uVar5 = uVar5 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar5; - spawnEntry = GHIDRA_CAST((roomData[0x10] + GHIDRA_INT(pvStack_20))); - gridIdx = *spawnEntry + 1 + (spawnEntry[1] + 1) * door->_gridWidth; - if ((char)spawnEntry[4] != '\0') { - piStack_30 = (GHIDRA_CAST((spawnEntry)))->Spawn::PickEntry((float)((double)GHIDRA_INT(uVar5) + - __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * - 2.3283062e-10); - pEStack_14 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x80)); - msvc::set::find_node(auStack_6c,&gridIdx); - if (((*GHIDRA_CAST((GHIDRA_CAST(pvStack_64) + 0xd)) != '\0') || - (GHIDRA_INT(gridIdx) < *GHIDRA_CAST((GHIDRA_CAST(pvStack_64) + 0x10)))) || - (pvStack_64 == *(void **)pEStack_14)) { - pEStack_14 = GHIDRA_CAST(0x0); - isSpawned = SpawnEntry(door,gridIdx,piStack_30,uVar5,&pEStack_14,1); - if ((isSpawned != 0) && (pEStack_14 != GHIDRA_CAST(0x0))) { - msvc::set::insert(auStack_48,&gridIdx); - FUN_008284a0(auStack_50,&pEStack_14); - if (puVar7 == puStack_24) { - msvc::vector::_Emplace_reallocate(puVar7,&pEStack_14); - puStack_24 = puStack_58; - puVar7 = puStack_5c; - } - else { - *puVar7 = pEStack_14; - puStack_5c = puVar7 + 1; - puVar7 = puStack_5c; - } - } - } - } - pvStack_20 = (void *)(GHIDRA_INT(pvStack_20) + 0x10); - i = i + 1; - } while (i < *GHIDRA_CAST((roomData + 0x11))); - pvStack_20 = pvStack_60; - } - uVar5 = GHIDRA_INT(puVar7) - GHIDRA_INT(pvStack_20) >> 2; - i = 0; - pvStack_60 = pvStack_20; - if (uVar5 != 0) { - do { - piVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvStack_20) + i * 4)); - (**(code **)(*piVar2 + 0xc))(); - cVar4 = (**(code **)(*piVar2 + 0x48))(); - if (cVar4 != '\0') { - puVar1 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x44)); - *puVar1 = *puVar1 & 0xfffffffe; - puVar1 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x44)); - *puVar1 = *puVar1 & 0xffffff7f; - } - i = i + 1; - } while (i < uVar5); - } - if (respawnCount == 0) { - puVar1 = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0x4)))) + 0x44)); - *puVar1 = *puVar1 | 1; - } - else { - uVar5 = 0; - if ((door->_entityList)._updateEL._size != 0) { - do { - piVar2 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((door->_entityList)._updateEL)) + 0x4)))) + uVar5 * 4)); - piStack_30 = piVar2; - _Find_lower_bound<>(auStack_6c,&piStack_30); - if (((*GHIDRA_CAST((GHIDRA_CAST(pvStack_64) + 0xd)) != '\0') || - (piVar2 < *GHIDRA_CAST((GHIDRA_CAST(pvStack_64) + 0x10)))) || (pvStack_64 == spawnedEntitySet)) { - piStack_30 = GHIDRA_CAST(piVar2[0xcb]); - msvc::set::find_node(auStack_54,&piStack_30); - if (((*GHIDRA_CAST((GHIDRA_CAST(pvStack_4c) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(pvStack_4c) + 0x10)) <= piVar2[0xcb])) && - (pvStack_4c != respawnGridIdxSet)) { - (**(code **)(*piVar2 + 0x28))(); - } - } - uVar5 = uVar5 + 1; - } while (uVar5 < GHIDRA_UINT((door->_entityList)._updateEL._size)); - } - ppvVar6 = door->_doors; - iVar8 = 8; - do { - door = *ppvVar6; - if ((door != GHIDRA_CAST(0x0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0xc)))) != 1)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((door)) + 0xc)))) = 1; - (GHIDRA_CAST((door)))->GridEntity_Door::UpdateAnimation(); - currentRoomType = door->_currentRoomType; - if ((currentRoomType == 7) || - ((((targetRoomType = door->_targetRoomType, targetRoomType == 7 || (currentRoomType == 8) - ) || (targetRoomType == 8)) || ((currentRoomType == 0x1d || (targetRoomType == 0x1d))) - ))) { - (GHIDRA_CAST(((door->_openAnimation)._buf)))->msvc::string::assign(s_Open,4); - } - } - ppvVar6 = ppvVar6 + 1; - iVar8 = iVar8 + -1; - } while (iVar8 != 0); - } - if (pvStack_20 != (void *)0x0) { - uVar5 = GHIDRA_INT(puStack_24) - GHIDRA_INT(pvStack_20) & 0xfffffffc; - freeBlock = pvStack_20; - if (0xfff < uVar5) { - freeBlock = *(void **)(GHIDRA_CAST(pvStack_20) + -4); - uVar5 = uVar5 + 0x23; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(pvStack_20) + (-4 - GHIDRA_INT(freeBlock))))) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(freeBlock,uVar5); - } - FID_conflict__Erase_tree_>_> - (&spawnedEntitySet, - (fuzzer_allocator_> *)&spawnedEntitySet, - *(_Tree_node **)(GHIDRA_INT(spawnedEntitySet) + 4)); - operator_delete(spawnedEntitySet,0x14); - FID_conflict__Erase_tree_>_> - (&respawnGridIdxSet, - (fuzzer_allocator_> *)&respawnGridIdxSet, - *(_Tree_node **)(GHIDRA_INT(respawnGridIdxSet) + 4)); - operator_delete(respawnGridIdxSet,0x14); - ExceptionList = local_10; - return; -} - -// 00820170 -uint8_t Room::TrySpawnBlueWombDoor(uint8_t isFirstTime, uint8_t isIgnoreTime, uint8_t isForce) -{ - code *pcVar1; - uint64_t qVar2; - uint8_t isHasTrinket; - RoomDescriptor *currentRoom; - uint32_t forcedCurses; - uint32_t preventedCurses; - ChallengeParam *pCVar3; - int iVar4; - void *door; - void **doorSlot; - uint32_t uVar5; - int effectiveStage; - uint32_t uVar6; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *flagsHigh; - Game *game; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b01801; - local_10 = ExceptionList; - ExceptionList = &local_10; - if ((isForce != 0) || - ((g_game->_challenge != 0x2c && - (((g_manager->_persistentGameData)._achievements[0xea] != 0 || - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) == 2 && - (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))))) { - isHasTrinket = PlayerManager::AnyoneHasTrinket(&g_game->_playerManager,0xaf); - if (isHasTrinket != 0) { - isIgnoreTime = 1; - } - if ((isForce == 0) && - (currentRoom = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,-1), - currentRoom->ListIndex != g_game->_lastBossRoomListIdx)) { - ExceptionList = local_10; - return 0; - } - uVar6 = g_game->_debugCurses; - iVar4 = g_game->_stage; - uVar5 = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - game = g_game; - effectiveStage = iVar4 + 1; - if ((~preventedCurses & (forcedCurses | uVar6 | uVar5) & 2) == 0) { - effectiveStage = iVar4; - } - pCVar3 = Game::GetChallengeParams(g_game); - if ((isForce != 0) || - ((((pCVar3->_isPathTypeSet == 0 || (effectiveStage < pCVar3->_endStage)) && - (effectiveStage == 8)) && ((game->_stageType != 4 && (game->_stageType != 5)))))) { - iVar4 = 0; - doorSlot = this->_doors; - do { - if ((*doorSlot != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_INT(*doorSlot) + 0x394)) == -8)) { - ExceptionList = local_10; - return 0; - } - iVar4 = iVar4 + 1; - doorSlot = doorSlot + 1; - } while (iVar4 < 8); - if (((game->_timeCounter <= game->_blueWombParTime) || (isIgnoreTime != 0)) || (isForce != 0)) - { - uVar6 = game->_enterDoor; - if (((game->_lastRoomIdx != -8) || (GHIDRA_INT(uVar6) < 0)) || (this->_doors[uVar6] != (void *)0x0) - ) { - uVar5 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - isHasTrinket = (*pcVar1)(); - return isHasTrinket; - } - uVar5 = uVar5 >> 1 ^ uVar5; - iVar4 = 0; - uVar5 = uVar5 << 0xb ^ uVar5; - do { - uVar6 = iVar4 + ((uVar5 >> 0x10 ^ uVar5) & 7) & 0x80000007; - if (GHIDRA_INT(uVar6) < 0) { - uVar6 = (uVar6 - 1 | 0xfffffff8) + 1; - } - } while ((((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x38 + (uVar6 >> 5) * 4)) - & 1 << ((uint8_t)uVar6 & 0x1f)) == 0) || (this->_doors[uVar6] != (void *)0x0)) && - (iVar4 = iVar4 + 1, iVar4 < 8)); - if (GHIDRA_INT(uVar6) < 0) { - ExceptionList = local_10; - return 0; - } - } - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && - (_Init_thread_header(&g_invalidRoomDescriptorGuard), g_invalidRoomDescriptorGuard == -1)) - { - local_8 = 0; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); - _atexit(FUN_00b15b30); - local_8 = 0xffffffff; - _Init_thread_footer(&g_invalidRoomDescriptorGuard); - } - door = this->_doors[uVar6]; - if (door == (void *)0x0) { - MakeDoor(this,uVar6); - door = this->_doors[uVar6]; - } - *GHIDRA_CAST((GHIDRA_CAST(door) + 0x394)) = 0xfffffff8; - GridEntity_Door::SetRoomTypes - (this->_doors[uVar6],*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 8)),1); - (GHIDRA_CAST((this->_doors[uVar6])))->GridEntity_Door::Open(); - if (isFirstTime != 0) { - (GHIDRA_CAST((this->_doors[uVar6])))->GridEntity_Door::SpawnDust(); - } - game = g_game; - qVar2 = g_game->_gameStateFlags; - flagsHigh = GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)); - *flagsHigh = *flagsHigh | 0x80; - *GHIDRA_CAST(&game->_gameStateFlags) = GHIDRA_INT(qVar2); - ExceptionList = local_10; - return 1; - } - } - } - ExceptionList = local_10; - return 0; -} - -// 008204b0 -uint8_t Room::TrySpawnTheVoidDoor(uint8_t isForce) -{ - Room *game = this; - uint32_t debugCurses; - uint32_t forcedCurses; - uint32_t preventedCurses; - ChallengeParam *challengeParams; - void *voidDoor; - int iVar2; - int endStage; - int effectiveStage; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t curses; - uint32_t debugCurses; - Game *game; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b01831; - local_10 = ExceptionList; - debugCurses = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - if ((isForce == 0) && (g_game->_challenge == 0x2c)) { - return 0; - } - debugCurses = g_game->_debugCurses; - iVar2 = g_game->_stage; - curses = g_game->_curses; - ExceptionList = &local_10; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - game = g_game; - effectiveStage = iVar2 + 1; - if ((~preventedCurses & (forcedCurses | debugCurses | curses) & 2) == 0) { - effectiveStage = iVar2; - } - if (isForce == 0) { - if (effectiveStage != 9) { - ExceptionList = local_10; - return 0; - } - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x4)))) + 0x10)) + 8)) != 5) { - ExceptionList = local_10; - return 0; - } - if (g_game->_currentRoomIdx < 0) { - ExceptionList = local_10; - return 0; - } - if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) goto LAB_00820601; - challengeParams = Game::GetChallengeParams(g_game); - iVar2 = 0xc; - if ((challengeParams->_endStage != 0xc) && - (((game->_challenge != 0 || ((game->_dailyChallenge)._id != 0)) || - (((g_manager->_persistentGameData)._achievements[0x140] == 0 && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((g_manager)) + 0x8)))) != 2 || (game->_isDebug == 0)))))))) { - iVar2 = 0xb; - } - endStage = iVar2; - if (challengeParams->_isPathTypeSet != 0) { - endStage = challengeParams->_endStage; - if (challengeParams->_endStage == 0) { - endStage = iVar2; - } - if (challengeParams->_pathType == 3) goto LAB_00820601; - } - if ((endStage < 0xc) || ((game->_levelStateFlags & 0x200000U) != 0)) goto LAB_00820601; - } - challengeParams = Game::GetChallengeParams(game); - if ((isForce != 0) || - ((challengeParams->_isPathTypeSet == 0 || (effectiveStage < challengeParams->_endStage)))) { - if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && - (_Init_thread_header(&g_invalidRoomDescriptorGuard,debugCurses), g_invalidRoomDescriptorGuard == -1 - )) { - local_8 = 0; - (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); - _atexit(FUN_00b15b30); - local_8 = 0xffffffff; - _Init_thread_footer(&g_invalidRoomDescriptorGuard); - } - voidDoor = game->_doors[5]; - if (voidDoor == (void *)0x0) { - MakeDoor(game,5); - voidDoor = game->_doors[5]; - } - *GHIDRA_CAST((GHIDRA_CAST(voidDoor) + 0x394)) = 0xfffffff7; - GridEntity_Door::SetRoomTypes - (game->_doors[5],*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x4)))) + 0x10)) + 8)),1); - (GHIDRA_CAST((game->_doors[5])))->GridEntity_Door::Open(); - ExceptionList = local_10; - return 1; - } -LAB_00820601: - game->_levelStateFlags = game->_levelStateFlags | 0x200000; - ExceptionList = local_10; - return 0; -} - -// 00820720 -uint32_t Room::GetBossVictoryJingle() -{ - int secretExitKind; - uint32_t jingleId; - Game *game; - - game = g_game; - if ((g_game->_stage != 0xd) || (g_game->_stageType != 1)) { - secretExitKind = Level::get_secret_exit_kind(GHIDRA_CAST(g_game)); - if ((secretExitKind != 4) || (game->_currentRoomIdx != -10)) { - if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 6) || (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x7228)) != '\0')) { - return 0x5c; - } - if ((game->_stageType == 4) || (game->_stageType == 5)) { - return 0x2a; - } - jingleId = 0x53; - if ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 6 & 1) != 0) { - jingleId = 0x61; - } - return jingleId; - } - } - return 0; -} - -// 008208c0 -bool Room::HasWater() -{ - return 0.0 < this->_waterAmount; -} - -// 008208e0 -uint8_t Room::IsCurrentRoomLastBoss() -{ - RoomDescriptor *roomDesc; - - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_currentRoomIdx,-1); - return roomDesc->ListIndex == g_game->_lastBossRoomListIdx; -} - -// 00820910 -void Room::MamaMegaExplosion(Vector *position, Entity_Player *player) -{ - float fVar1; - uint32_t seed; - Entity *explosion; - Entity_Player *firstPlayer; - float distance; - float offsetY; - float offsetX; - uint32_t *roomFlags; - int vtable; - - roomFlags = GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)); - *roomFlags = *roomFlags | 0x4000; - seed = Random(); - if (player == GHIDRA_CAST(0x0)) { - player = Game::GetPlayer(g_game,0); - } - explosion = Game::SpawnEx(g_game,1000,0x7f,position,&g_vectorZero,GHIDRA_CAST(player),0,seed,0); - if ((position->x != g_vectorZero.x) || (position->y != g_vectorZero.y)) { - fVar1 = position->y; - vtable = *GHIDRA_CAST(explosion); - (explosion->_targetPosition).x = position->x; - (explosion->_targetPosition).y = fVar1; - (**(code **)(vtable + 0xc))(); - return; - } - firstPlayer = Game::GetPlayer(g_game,0); - fVar1 = (firstPlayer->_pos).x; - offsetX = fVar1 - (((this->_bottomRightPos).x - (this->_topLeftPos).x) * 0.5 + - (this->_topLeftPos).x); - offsetY = (firstPlayer->_pos).y - - (((this->_bottomRightPos).y - (this->_topLeftPos).y) * 0.5 + (this->_topLeftPos).y); - distance = sqrtf(offsetY * offsetY + offsetX * offsetX); - if (0.0 < distance) { - offsetX = offsetX * (200.0 / distance); - offsetY = offsetY * (200.0 / distance); - } - vtable = *GHIDRA_CAST(explosion); - (explosion->_targetPosition).y = offsetY + (firstPlayer->_pos).y; - (explosion->_targetPosition).x = fVar1 + offsetX; - (**(code **)(vtable + 0xc))(); - return; -} - -// 00820aa0 -int Room::GetDungeonRockIdx() -{ - if ((g_game->_levelStateFlags & 0x2000U) == 0) { - return this->_dungeonRockIdx; - } - return -1; -} - -// 00820ac0 -void Room::TurnGold() -{ - uint32_t GridIndex; - void **gridSlot; - GridEntityDesc goldDesc; - uint32_t local_b0; - uint32_t uStack_ac; - uint32_t local_a8; - uint32_t local_9c [8]; - uint32_t local_7c; - uint32_t uStack_78; - uint32_t local_74; - uint32_t local_70 [12]; - uint32_t local_40 [15]; - void *gridEntity; - - local_b0 = 0; - uStack_ac = 0; - local_a8 = 0; - local_7c = 0; - uStack_78 = 0; - local_74 = 0; - if (&this->_floorColor != GHIDRA_CAST(local_70)) { - (this->_floorColor)._offset[0] = 0.0; - (this->_floorColor)._offset[1] = 0.0; - (this->_floorColor)._tint[0] = 1.0; - (this->_floorColor)._tint[1] = 1.0; - (this->_floorColor)._tint[2] = 1.0; - (this->_floorColor)._tint[3] = 1.0; - (this->_floorColor)._offset[2] = 0.0; - (this->_floorColor)._colorize[0] = 5.0; - (this->_floorColor)._colorize[1] = 3.0; - (this->_floorColor)._colorize[2] = 0.0; - (this->_floorColor)._colorize[3] = 0.8; - } - if (&this->_wallColor != GHIDRA_CAST(local_40)) { - (this->_wallColor)._offset[0] = 0.0; - (this->_wallColor)._offset[1] = 0.0; - (this->_wallColor)._tint[0] = 1.0; - (this->_wallColor)._tint[1] = 1.0; - (this->_wallColor)._tint[2] = 1.0; - (this->_wallColor)._tint[3] = 1.0; - (this->_wallColor)._offset[2] = 0.0; - (this->_wallColor)._colorize[0] = 5.0; - (this->_wallColor)._colorize[1] = 3.0; - (this->_wallColor)._colorize[2] = 0.0; - (this->_wallColor)._colorize[3] = 0.8; - } - GridIndex = 0; - gridSlot = this->_gridEntities; - do { - if ((GridIndex < 0x1c0) && (gridEntity = *gridSlot, gridEntity != (void *)0x0)) { - if (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)) == 0xe) { - if (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 8)) != 3) { - goldDesc._type = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)); - goldDesc._state = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xc)); - goldDesc._spawnCount = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x10)); - goldDesc._variant = 3; - goldDesc._spawnSeed = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x14)); - goldDesc._varData = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x18)); - (*GHIDRA_CAST((GHIDRA_CAST(&(goldDesc)) + 0x18))) = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x1c)); - goldDesc._variableSeed = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x20)); - SpawnGridEntityDesc(this,GridIndex,&goldDesc); - } - } - else if (GHIDRA_CAST((GHIDRA_INT(gridEntity) + 0xe8)) != local_9c) { - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x108)) = local_7c; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x10c)) = uStack_78; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xe8)) = 0x3f800000; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xec)) = 0x3f800000; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xf0)) = 0x3f800000; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xf4)) = 0x3f800000; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x110)) = local_74; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xf8)) = 0x40400000; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xfc)) = 0x3fe66666; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x100)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x104)) = 0x3f4ccccd; - } - } - GridIndex = GridIndex + 1; - gridSlot = gridSlot + 1; - } while (GHIDRA_INT(GridIndex) < 0x1c0); - return; -} - -// 00820c00 -Vector * Room::WorldToScreenPosition(Vector *outPosition, float x, float y) -{ - float pixelScale; - double dVar1; - double dVar2; - float scrollY; - float shakeY; - - pixelScale = g_displayPixelRatio * g_screenPointScale; - dVar1 = floor((double)(((g_screenWidth - 338.0) * 0.5 + (x - 60.0) * 0.65) * pixelScale + 0.5)); - dVar2 = floor((double)(((g_screenHeight - 182.0) * 0.5 + (y - 140.0) * 0.65) * pixelScale + 0.5)); - scrollY = (this->_renderScrollOffset).y; - shakeY = (g_game->_screenShakeOffset).y; - outPosition->x = - (float)dVar1 / pixelScale + (this->_renderScrollOffset).x + (g_game->_screenShakeOffset).x; - outPosition->y = (float)dVar2 / pixelScale + scrollY + shakeY; - return outPosition; -} - -// 00820d30 -void Room::record_killed_npc(int param_1) -{ - float fVar1; - float fVar2; - uint16_t subtype16; - int iVar3; - Vector *freePos; - int *node; - Room *in_ECX; - int npcType; - uint32_t uStack_48; - Vector local_44; - uint32_t championColor; - uint32_t local_38; - uint32_t local_34; - Vector local_30; - float posX; - uint8_t isFriendly; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - uint32_t championColorCopy; - uint32_t listSize; - uint32_t *prevNode; - uint16_t variant16; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0185d; - local_1c = ExceptionList; - npcType = *GHIDRA_CAST((param_1 + 0x28)); - if (npcType < 0xd9) { - if (npcType == 0xd8) { - return; - } - switch(npcType) { - case 0x13: - case 0x1c: - case 0x23: - case 0x3e: - case 0x59: - goto switchD_00820d91_caseD_13; - } -switchD_00820d91_caseD_14: - if (npcType == 0x199) { - iVar3 = *GHIDRA_CAST((param_1 + 0x2c)); - goto joined_r0x00820dc1; - } - } - else { - if (0x38d < npcType) { - if (npcType == 0x390) { - return; - } - if (npcType == 0x396) { - return; - } - goto switchD_00820d91_caseD_14; - } - if (npcType == 0x38d) { - return; - } - if (npcType == 0xef) { - return; - } - if (npcType == 0xf4) { - if (*GHIDRA_CAST((param_1 + 0x2c)) == 2) { - return; - } - goto switchD_00820d91_caseD_14; - } - if (npcType != 0x194) goto switchD_00820d91_caseD_14; - iVar3 = *GHIDRA_CAST((param_1 + 0x2c)); -joined_r0x00820dc1: - if (iVar3 == 1) { - return; - } - } - local_34 = *GHIDRA_CAST((param_1 + 0x2c)); - local_44.x = *GHIDRA_CAST((param_1 + 0x33c)); - local_38 = *GHIDRA_CAST((param_1 + 0x30)); - championColor = *GHIDRA_CAST((param_1 + 0x3ec)); - isFriendly = (*GHIDRA_CAST((param_1 + 0x168)) & 0x20000000) != 0; - local_44.y = *GHIDRA_CAST((param_1 + 0x340)); - if (npcType == 0x23) { - npcType = 0xb; - } - ExceptionList = &local_1c; - local_30.y = local_44.y; - posX = local_44.x; - iVar3 = GetGridCollisionAtPos(in_ECX,*GHIDRA_CAST((param_1 + 0x33c))); - if (iVar3 != 0) { - freePos = FindFreeTilePosition(in_ECX,&local_30,&local_44,40.0); - posX = freePos->x; - local_30.y = freePos->y; - } - listSize = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7304)))); - championColorCopy = championColor; - fVar1 = local_30.y; - fVar2 = posX; - while (championColor = championColorCopy, local_30.y = fVar1, posX = fVar2, 0x1f < listSize) { - node = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7300)))) + 4)); - iVar3 = *node; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7304)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7304)))) + -1; - *GHIDRA_CAST(node[1]) = iVar3; - *GHIDRA_CAST((iVar3 + 4)) = node[1]; - operator_delete(node,0x20); - championColorCopy = championColor; - fVar1 = local_30.y; - fVar2 = posX; - listSize = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7304)))); - } - variant16 = (uint16_t)local_34; - subtype16 = (uint16_t)local_38; - uStack_48 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_48)) + 0x1))),isFriendly); - iVar3 = **GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7300)))); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7304)))) == 0x7ffffff) { - /* WARNING: Subroutine does not return */ - msvc::_Xlength_error("list too long"); - } - local_14 = 0; - local_44.y = 0.0; - local_44.x = (float)&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7300))); - node = operator_new(0x20); - node[2] = GHIDRA_INT(fVar2); - node[3] = GHIDRA_INT(fVar1); - node[4] = npcType; - node[5] = CONCAT22(subtype16,variant16); - *GHIDRA_CAST((node + 6)) = CONCAT44(uStack_48,championColorCopy); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7304)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((in_ECX)) + 0x7304)))) + 1; - prevNode = *GHIDRA_CAST((iVar3 + 4)); - *node = iVar3; - node[1] = GHIDRA_INT(prevNode); - *GHIDRA_CAST((iVar3 + 4)) = node; - *prevNode = node; -switchD_00820d91_caseD_13: - ExceptionList = local_1c; - return; -} - -// 00820fd0 -void Room::render_water() -{ - EntityList *this_00; - void *pvVar1; - ColorMod color; - uint32_t uVar2; - uint32_t uVar3; - uint32_t uVar4; - uint32_t uVar5; - uint32_t uVar6; - uint32_t uVar7; - uint32_t uVar8; - uint32_t uVar9; - uint32_t uVar10; - LayerState *layer; - int iVar11; - float fVar12; - Room *pRVar13; - int *piVar14; - uint32_t *renderTargetEntry; - uint32_t hashChar; - uint8_t lowerChar; - uint32_t uVar15; - Room *room; - float gridCount; - int iVar16; - void **gridEntityIt; - char *shaderNameChar; - float brightness; - double dVar17; - Color aCStackY_16d8 [128]; - Color tintedFloorColor; - int savedBlendMode0; - int savedBlendMode1; - int savedBlendMode2; - int savedBlendMode3; - Vector renderOffsetX; - float savedShakeY; - float savedShakeX; - int savedBlendMode4; - Room *local_20; - uint8_t local_1c; - uint32_t local_18; - float local_14; - Game *game; - uint8_t shaderChar; - - fVar12 = g_vectorZero.y; - game = g_game; - if ((0.0 < this->_waterAmount) && ((g_manager->_optionsConfig)._enableWaterSurface != 0)) { - gridCount = (float)(this->_gridWidth * this->_gridHeight); - savedShakeX = (g_game->_screenShakeOffset).x; - savedShakeY = (g_game->_screenShakeOffset).y; - (g_game->_screenShakeOffset).x = g_vectorZero.x; - (game->_screenShakeOffset).y = fVar12; - local_20 = this; - local_14 = gridCount; - FUN_00683680(); - savedBlendMode0 = g_graphicsManager_blendMode[0]; - savedBlendMode1 = g_graphicsManager_blendMode[1]; - savedBlendMode2 = g_graphicsManager_blendMode[2]; - savedBlendMode3 = g_graphicsManager_blendMode[3]; - savedBlendMode4 = g_graphicsManager_blendMode[4]; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c797f4,0); - g_graphicsManager_flags = g_graphicsManager_flags & 0xfffffffd; - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - if ((this->_backdropType == 0x2d) && (fVar12 = this->_waterAmount, 0.0 < fVar12)) { - (GHIDRA_CAST((&tintedFloorColor)))->Color::operator_assign(&this->_floorColor); - brightness = fVar12 * 0.6 + 1.0; - tintedFloorColor._tint[0] = tintedFloorColor._tint[0] * brightness; - tintedFloorColor._tint[1] = tintedFloorColor._tint[1] * brightness; - tintedFloorColor._tint[2] = tintedFloorColor._tint[2] * brightness; - tintedFloorColor._offset[0] = fVar12 * 0.08 + tintedFloorColor._offset[0]; - tintedFloorColor._offset[1] = fVar12 * 0.06 + tintedFloorColor._offset[1]; - tintedFloorColor._offset[2] = fVar12 * 0.03 + tintedFloorColor._offset[2]; - (GHIDRA_CAST((aCStackY_16d8 + 0x81)))->Color::operator_assign(GHIDRA_CAST(&tintedFloorColor)); - } - Backdrop::RenderFloor(&g_vectorZero); - if (0 < GHIDRA_INT(gridCount)) { - gridEntityIt = this->_gridEntities; - local_18 = GHIDRA_UINT(local_14); - do { - piVar14 = *gridEntityIt; - if ((piVar14 != GHIDRA_CAST(0x0)) && (piVar14[1] == 1)) { - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (**(code **)(*piVar14 + 0xc))(); - } - gridEntityIt = gridEntityIt + 1; - local_18 = local_18 - 1; - } while (local_18 != 0); - local_18 = 0; - gridCount = local_14; - } - (this->_entityList)._renderCursor = 0; - (this->_entityList)._renderMode = 4; - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((&this->_entityList)))->EntityList::render_up_to(5000,&renderOffsetX); - uVar2 = (this->_floorColor)._tint[0]; - uVar3 = (this->_floorColor)._tint[1]; - uVar4 = (this->_floorColor)._tint[2]; - uVar5 = (this->_floorColor)._tint[3]; - uVar6 = (this->_floorColor)._colorize[0]; - uVar7 = (this->_floorColor)._colorize[1]; - uVar8 = (this->_floorColor)._colorize[2]; - uVar9 = (this->_floorColor)._colorize[3]; - uVar10 = (this->_floorColor)._offset[0]; - color._offset[0] = (float)uVar10; - color._colorize[3] = (float)uVar9; - color._colorize[2] = (float)uVar8; - color._colorize[1] = (float)uVar7; - color._colorize[0] = (float)uVar6; - color._tint[3] = (float)uVar5; - color._tint[2] = (float)uVar4; - color._tint[1] = (float)uVar3; - color._tint[0] = (float)uVar2; - color._offset[1] = (float)GHIDRA_INT(((uint64_t)*GHIDRA_CAST((this->_floorColor)._offset) >> 0x20)); - color._offset[2] = (this->_floorColor)._offset[2]; - Backdrop::RenderWalls(GHIDRA_CAST(&this->_backdrop),&g_vectorZero,color); - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((&this->_railManager)))->RailManager::Render(&renderOffsetX); - if (0 < GHIDRA_INT(gridCount)) { - gridEntityIt = this->_gridEntities; - do { - if ((*gridEntityIt != GHIDRA_CAST(0x0)) && - ((**(code **)(*GHIDRA_CAST(*gridEntityIt) + 0x18))(), (local_1c & 8) == 0)) { - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (**(code **)(*GHIDRA_CAST(*gridEntityIt) + 0xc))(); - } - gridEntityIt = gridEntityIt + 1; - local_14 = (float)(GHIDRA_INT(local_14) - 1); - } while (local_14 != 0.0); - } - if ((this->_backdropType == 0x20) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 5 & 1) != 0)) { - render_water_overlay(this,&g_vectorZero); - iVar11 = this->_gridWidth; - iVar16 = this->_gridHeight; - local_18 = 0; - if (0 < iVar11 * iVar16) { - gridEntityIt = this->_gridEntities; - do { - pvVar1 = *gridEntityIt; - if ((pvVar1 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)) == 7)) { - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(pvVar1) + 0x40)),GHIDRA_CAST(0x0)); - layer->_visible = 0; - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (**(code **)(*GHIDRA_CAST(*gridEntityIt) + 0xc))(); - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(*gridEntityIt) + 0x40)),GHIDRA_CAST(0x0)); - layer->_visible = 1; - } - iVar11 = this->_gridWidth; - local_18 = local_18 + 1; - gridEntityIt = gridEntityIt + 1; - } while (GHIDRA_INT(local_18) < iVar11 * this->_gridHeight); - iVar16 = this->_gridHeight; - } - local_18 = 0; - if (0 < iVar11 * iVar16) { - gridEntityIt = this->_gridEntities; - do { - pvVar1 = *gridEntityIt; - if ((pvVar1 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)) == 7)) { - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(pvVar1) + 0x40)),GHIDRA_CAST(0x0)); - layer->_visible = 0; - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (**(code **)(*GHIDRA_CAST(*gridEntityIt) + 0xc))(); - layer = ANM2::GetLayer(GHIDRA_CAST((GHIDRA_INT(*gridEntityIt) + 0x40)),GHIDRA_CAST(0x0)); - layer->_visible = 1; - } - local_18 = local_18 + 1; - gridEntityIt = gridEntityIt + 1; - } while (GHIDRA_INT(local_18) < this->_gridWidth * this->_gridHeight); - } - } - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - render_pit_rails(GHIDRA_CAST(&this->_railManager)); - FXLayers::render_underwater_layers(&this->_fxLayers); - iVar11 = this->_gridHeight; - this_00 = &this->_entityList; - local_18 = 0; - fVar12 = (float)10000; - if (0 < iVar11) { - do { - iVar16 = this->_gridWidth; - if (((iVar16 < 1) || (GHIDRA_INT(local_18) < 0)) || (iVar11 <= GHIDRA_INT(local_18))) { - iVar11 = -1; - } - else { - iVar11 = iVar16 * local_18; - } - local_14 = (((float)(iVar11 / iVar16) * 40.0 + 120.0) - 20.0) * 100.0 + 10030.0 + 0.5; - dVar17 = floor((double)local_14); - local_14 = (float)dVar17; - local_14 = (float)__ftoui3(); - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((this_00)))->EntityList::render_up_to(GHIDRA_UINT(local_14),&renderOffsetX); - iVar11 = this->_gridHeight; - local_18 = local_18 + 1; - } while (GHIDRA_INT(local_18) < iVar11); - fVar12 = local_14; - } - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((this_00)))->EntityList::render_up_to(GHIDRA_INT(fVar12) + 5000,&renderOffsetX); - renderOffsetX.x = -(this->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(this->_renderSurfaceTopLeft).y; - room = this; - if ((this->_entityList)._renderCursor != 0) { - uVar15 = 0; - do { - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._renderEL)) + 0x4)))) + uVar15 * 4)) + - 0x1c))(); - uVar15 = uVar15 + 1; - } while (uVar15 < GHIDRA_UINT((this->_entityList)._renderCursor)); - room = local_20; - } - (this->_entityList)._renderMode = 0; - (room->_entityList)._renderCursor = 0; - (room->_entityList)._renderMode = 2; - renderOffsetX.x = -(room->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(room->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((this_00)))->EntityList::render_up_to(5000,&renderOffsetX); - (room->_entityList)._renderMode = 5; - iVar11 = room->_gridHeight; - local_18 = 0; - pRVar13 = GHIDRA_CAST(0x2710); - if (0 < iVar11) { - do { - iVar16 = room->_gridWidth; - if (((iVar16 < 1) || (GHIDRA_INT(local_18) < 0)) || (iVar11 <= GHIDRA_INT(local_18))) { - iVar11 = -1; - } - else { - iVar11 = iVar16 * local_18; - } - local_20 = GHIDRA_CAST(((((float)(iVar11 / iVar16) * 40.0 + 120.0) - 20.0) * 100.0 + 10030.0 + - 0.5)); - dVar17 = floor((double)(float)local_20); - local_20 = GHIDRA_CAST((float)dVar17); - local_20 = GHIDRA_CAST(__ftoui3()); - renderOffsetX.x = -(room->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(room->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((this_00)))->EntityList::render_up_to(GHIDRA_UINT(local_20),&renderOffsetX); - iVar11 = room->_gridHeight; - local_18 = local_18 + 1; - } while (GHIDRA_INT(local_18) < iVar11); - pRVar13 = local_20; - } - renderOffsetX.x = -(room->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(room->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((this_00)))->EntityList::render_up_to(GHIDRA_UINT(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar13)) + 0x1388)))),&renderOffsetX); - renderOffsetX.x = -(room->_renderSurfaceTopLeft).x; - renderOffsetX.y = -(room->_renderSurfaceTopLeft).y; - (GHIDRA_CAST((this_00)))->EntityList::render_up_to(0xffffffff,&renderOffsetX); - uVar15 = 0; - if ((this->_entityList)._renderCursor != 0) { - do { - (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._renderEL)) + 0x4)))) + uVar15 * 4)) + - 0x1c))(); - uVar15 = uVar15 + 1; - } while (uVar15 < GHIDRA_UINT((this->_entityList)._renderCursor)); - } - (this->_entityList)._renderMode = 0; - uVar15 = 0x1505; - shaderNameChar = "KAGE_ColorTextureShader"; - shaderChar = 0x4b; - do { - shaderNameChar = shaderNameChar + 1; - lowerChar = shaderChar + 0x20; - if (0x19 < (uint8_t)(shaderChar + 0xbf)) { - lowerChar = shaderChar; - } - hashChar = GHIDRA_UINT(lowerChar); - if (lowerChar == 0x5c) { - hashChar = 0x2f; - } - uVar15 = uVar15 * 0x21 + hashChar; - shaderChar = *shaderNameChar; - } while (shaderChar != 0); - local_18 = uVar15; - _Find_lower_bound<>(); - if (((*GHIDRA_CAST((GHIDRA_CAST(renderOffsetX.y) + 0xd)) == '\0') && - (*GHIDRA_CAST((GHIDRA_CAST(renderOffsetX.y) + 0x10)) <= uVar15)) && (renderOffsetX.y != DAT_00c379bc)) { - piVar14 = GHIDRA_CAST(std)::map::operator_index(); - pvVar1 = (void *)*piVar14; - if ((pvVar1 != (void *)0x0) && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)) & 1) != 0)) { - g_currentShader = pvVar1; - } - } - _glfw_context_reset(); - g_graphicsManager_blendMode[0] = savedBlendMode0; - g_graphicsManager_blendMode[1] = savedBlendMode1; - g_graphicsManager_blendMode[2] = savedBlendMode2; - g_graphicsManager_blendMode[3] = savedBlendMode3; - g_graphicsManager_blendMode[4] = savedBlendMode4; - g_graphicsManager_flags = g_graphicsManager_flags | 2; - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - renderTargetEntry = msvc::deque::back(); - KAGE_Graphics::SetRenderTarget - (&DAT_00c798e0,(void *)*renderTargetEntry,*GHIDRA_CAST((renderTargetEntry + 1))); - game = g_game; - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } - (g_game->_screenShakeOffset).x = savedShakeX; - (game->_screenShakeOffset).y = savedShakeY; - } - return; -} - -// 00821950 -void Room::render_water_shader(Vector *renderOffset) -{ - Room *shader = this; - float *offsetIter; - Vector *quadSizePtr; - uint32_t extraout_EAX; - int iVar1; - int unused; - int unused_00; - int unused_01; - int unused_02; - int unusedArg; - uint8_t *shader; - float colorBlue; - float fVar2; - float fVar3; - float colorRed; - float colorGreen; - float local_130 [2]; - int quadCount; - float quadOffsets [4]; - Vector quadSizes; - uint32_t local_10c; - uint32_t uStack_108; - int *local_104; - KColor quadColor; - Vector local_dc; - void *seedNode; - float shaderParams; - float fStack_cc; - float fStack_c8; - float fStack_c4; - uint32_t local_c0; - float uvQuad; - float local_a0; - float local_9c; - float local_98; - float local_94; - float local_90; - float local_8c; - float local_88; - uint8_t local_84; - uint8_t quad [124]; - code *drawFn; - - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - shader = &DAT_00c79708; - if ((DAT_00c7970c & 1) == 0) { - shader = g_currentShader; - } - if (((uint8_t)g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - iVar1 = 2; - offsetIter = quadOffsets; - do { - offsetIter[1] = 0.0; - *offsetIter = 0.0; - iVar1 = iVar1 + -1; - offsetIter = offsetIter + 2; - } while (iVar1 != 0); - iVar1 = 2; - quadSizePtr = &quadSizes; - do { - quadSizePtr->y = 0.0; - quadSizePtr->x = 0.0; - iVar1 = iVar1 + -1; - quadSizePtr = quadSizePtr + 1; - } while (iVar1 != 0); - quadCount = 1; - quadOffsets[0] = 52.0; - quadOffsets[1] = 52.0; - quadSizes.x = (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((shader)) + 0x6ae8)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((shader)) + 0x6ae0))))) + 0.0; - quadSizes.y = (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((shader)) + 0x6aec)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((shader)) + 0x6ae4))))) + 0.0; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((shader)) + 0x4)))) == 0) || - (iVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((shader)) + 0x4)))) + 0x10)), iVar1 == 0)) goto LAB_00821b14; - switch(*GHIDRA_CAST((iVar1 + 0x48))) { - case 2: - case 7: - quadSizes.y = quadSizes.y - 104.0; - quadOffsets[1] = 104.0; - goto LAB_00821b14; - case 3: - case 5: - quadSizes.x = quadSizes.x - 208.0; - quadOffsets[0] = 156.0; - default: - goto LAB_00821b14; - case 9: - quadOffsets[0] = 390.0; - quadOffsets[2] = 52.0; - quadOffsets[3] = 234.0; - break; - case 10: - quadOffsets[2] = 390.0; - quadOffsets[3] = 234.0; - break; - case 0xb: - quadOffsets[0] = 390.0; - quadOffsets[2] = 52.0; - goto LAB_00821ae6; - case 0xc: - quadOffsets[2] = 390.0; -LAB_00821ae6: - quadOffsets[3] = 52.0; - } - quadSizes.x = quadSizes.x - 338.0; - quadCount = 2; - uStack_108 = 0x43360000; - local_10c = 0x43a90000; -LAB_00821b14: - shaderParams = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x20)))); - local_c0 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x30)))); - fVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x2c)))); - colorRed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x34)))); - colorGreen = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x38)))); - colorBlue = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x3c)))); - fStack_cc = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x24)))); - quadColor._unk = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x44)))); - fStack_c8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x28)))); - quadColor._alpha = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((shader->_fxLayers)._fxParams)) + 0x40)))); - local_130[0] = 1.10703e-43; - g_currentShader = shader; - fStack_c4 = fVar3; - msvc::set::find_node(&local_dc,local_130); - if (((*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(seedNode) + 0x10)) < 0x50)) && - (seedNode != (g_game->_seedEffects)._seedEffects)) { - fVar3 = 0.5; - shaderParams = 0.5; - fStack_cc = 0.7; - fStack_c8 = 1.0; - quadColor._alpha = 1.0; - colorBlue = 1.0; - colorGreen = 0.7; - colorRed = 0.5; - local_c0 = 0; - quadColor._unk = 0; - } - iVar1 = shader->_waterLerpColorDuration; - if (-1 < iVar1) { - fVar2 = 1.0; - if (iVar1 != 0) { - fVar2 = 1.0 - (float)shader->_waterLerpColorCountdown / (float)iVar1; - if (fVar2 <= 0.0) { - fVar2 = 0.0; - } - if (1.0 <= fVar2) { - fVar2 = 1.0; - } - } - shaderParams = (shader->_waterColor)._red; - fVar3 = (shader->_waterColor)._alpha; - shaderParams = ((shader->_waterLerpTargetColor)._red - shaderParams) * fVar2 + shaderParams; - fStack_cc = (shader->_waterColor)._green; - fVar3 = ((shader->_waterLerpTargetColor)._alpha - fVar3) * fVar2 + fVar3; - fStack_cc = ((shader->_waterLerpTargetColor)._green - fStack_cc) * fVar2 + fStack_cc; - fStack_c8 = (shader->_waterColor)._blue; - fStack_c8 = ((shader->_waterLerpTargetColor)._blue - fStack_c8) * fVar2 + fStack_c8; - colorRed = (shader->_waterColorMultiplier)._red; - colorRed = ((shader->_waterLerpTargetColorMult)._red - colorRed) * fVar2 + colorRed; - colorGreen = (shader->_waterColorMultiplier)._green; - colorGreen = ((shader->_waterLerpTargetColorMult)._green - colorGreen) * fVar2 + colorGreen; - colorBlue = (shader->_waterColorMultiplier)._blue; - colorBlue = ((shader->_waterLerpTargetColorMult)._blue - colorBlue) * fVar2 + colorBlue; - quadColor._alpha = (shader->_waterColorMultiplier)._alpha; - quadColor._alpha = - ((shader->_waterLerpTargetColorMult)._alpha - quadColor._alpha) * fVar2 + quadColor._alpha; - } - fVar2 = shader->_waterAmount; - fStack_c4 = fVar2 * fVar3; - quadColor._red = (colorRed - 1.0) * fVar2 + 1.0; - local_130[0] = (float)g_game->_frameCount + (float)g_game->_frameCount; - quadColor._green = (colorGreen - 1.0) * fVar2 + 1.0; - quadColor._blue = (colorBlue - 1.0) * fVar2 + 1.0; - local_dc.x = (float)((double)DAT_00c797f4[6] + __uint_to_double_fixup[-(DAT_00c797f4[6] >> 0x1f)]) - ; - local_dc.y = (float)((double)DAT_00c797f4[7] + __uint_to_double_fixup[-(DAT_00c797f4[7] >> 0x1f)]) - ; - local_104 = DAT_00c79a4c; - (GHIDRA_CAST((shader)))->Shader::set_uniform(&DAT_00b6837c,8,local_130,GHIDRA_INT(DAT_00c797f4)); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("ColorMul"),10,&quadColor,unused); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("CurrentDir"),9,&shader->_waterCurrent,unused_00); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("TextureSize"),9,&local_dc,unused_01); - (GHIDRA_CAST((g_currentShader)))->Shader::set_uniform(GHIDRA_CAST("PixelationAmount"),8,&local_104,unused_02); - local_130[0] = 0.0; - do { - local_104 = DAT_00c797f4; - quadColor._red = 1.0; - quadColor._green = 1.0; - quadColor._blue = 1.0; - quadColor._alpha = 1.0; - quadColor._unk = 0; - drawFn = *(code **)(*DAT_00c797f4 + 0x14); - local_dc.x = *GHIDRA_CAST((GHIDRA_CAST(quadOffsets) + GHIDRA_INT(local_130[0]))) + renderOffset->x; - local_dc.y = *GHIDRA_CAST((GHIDRA_CAST(quadOffsets) + GHIDRA_INT(local_130[0]) + 4)) + renderOffset->y; - quadSizePtr = GHIDRA_CAST((GHIDRA_INT(quadOffsets) + GHIDRA_INT(local_130[0]) + 0x10)); - render_quad_set_rect(quad,&local_dc,quadSizePtr,&quadColor); - fVar3 = local_130[0]; - local_84 = 1; - local_94 = *GHIDRA_CAST((GHIDRA_CAST(quadOffsets) + GHIDRA_INT(local_130[0]))); - local_98 = *GHIDRA_CAST((GHIDRA_CAST(quadOffsets) + GHIDRA_INT(local_130[0]) + 4)); - uvQuad = local_94; - local_9c = local_94 + quadSizePtr->x; - local_a0 = local_98; - local_90 = local_98 + *GHIDRA_CAST((GHIDRA_CAST(quadOffsets) + GHIDRA_INT(local_130[0]) + 0x14)); - local_8c = local_9c; - local_88 = local_90; - (*drawFn)(&uvQuad,extraout_EAX,&shaderParams); - local_130[0] = (float)(GHIDRA_INT(fVar3) + 8); - quadCount = quadCount + -1; - } while (quadCount != 0); - shader_cache_find(unusedArg); - return; -} - -// 00821fc0 -uint8_t Room::is_obstacle_path_valid(uint32_t startIndex, uint32_t goalIndex, uint32_t flags) -{ - Room *pathGrid = this; - int rightCol; - void *neighborGrid; - int iVar3; - int iVar4; - uint16_t score; - Room *pRVar5; - int iVar6; - uint32_t scanIndex; - uint8_t isPathFound; - int *node; - uint32_t uVar7; - float fVar8; - float deltaCol; - uint8_t local_129c [8]; - uint8_t local_1294 [8]; - uint8_t openFind [8]; - int *openNode; - uint8_t closedFind [8]; - void *closedNode; - uint32_t destroySource; - uint32_t local_1270; - uint32_t local_126c; - uint32_t local_1268; - float local_1264; - float local_1260; - float local_125c; - float local_1258; - uint32_t local_1254; - uint32_t local_1250; - void *closedSetHead; - uint32_t closedSetSize; - uint32_t current; - int *openSetHead; - int openSetSize; - int goalRow; - int goalCol; - uint8_t local_1230 [4]; - int *local_122c; - void *local_1228; - Room *room; - uint32_t local_1220; - uint32_t local_121c; - uint32_t fScore [448]; - uint32_t gScore [448]; - uint32_t neighbors [32]; - uint16_t cameFrom [448]; - uint32_t local_18; - uint32_t uStack_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int goalColumn; - void *neighborGrid; - GridEntity_Pit *pathGrid; - int rightCol; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b0189b; - local_10 = ExceptionList; - uStack_14 = 0x821fdb; - local_18 = __security_cookie ^ GHIDRA_UINT((cameFrom + 0x1ca)); - ExceptionList = &local_10; - local_1220 = startIndex; - openSetHead = GHIDRA_CAST(0x0); - openSetSize = 0; - room = pathGrid; - openSetHead = operator_new(0x14); - *openSetHead = GHIDRA_INT(openSetHead); - openSetHead[1] = GHIDRA_INT(openSetHead); - openSetHead[2] = GHIDRA_INT(openSetHead); - *GHIDRA_CAST((openSetHead + 3)) = 0x101; - local_8 = 0; - closedSetHead = (void *)0x0; - closedSetSize = 0; - closedSetHead = operator_new(0x14); - *(void **)closedSetHead = closedSetHead; - *(void **)(GHIDRA_CAST(closedSetHead) + 4) = closedSetHead; - *(void **)(GHIDRA_CAST(closedSetHead) + 8) = closedSetHead; - *GHIDRA_CAST((GHIDRA_CAST(closedSetHead) + 0xc)) = 0x101; - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); - msvc::set::insert(local_1230,&local_1220); - memset(gScore,0xff,0x700); - memset(fScore,0xff,0x700); - memset(cameFrom,0xff,0x380); - uVar7 = local_1220; - iVar4 = pathGrid->_gridWidth; - goalRow = GHIDRA_INT(goalIndex) / iVar4; - goalCol = GHIDRA_INT(goalIndex) % iVar4; - gScore[local_1220] = 0; - deltaCol = (float)goalCol - (float)(GHIDRA_INT(local_1220) % iVar4); - fVar8 = (float)goalRow - (float)(GHIDRA_INT(local_1220) / iVar4); - fVar8 = sqrtf(fVar8 * fVar8 + deltaCol * deltaCol); - fScore[uVar7] = GHIDRA_INT((fVar8 * 10.0)) & 0xffff; - while (openSetSize != 0) { - local_1220 = 0xffff; - node = GHIDRA_CAST(*openSetHead); - local_122c = node; - if (node != openSetHead) { - do { - score = (uint16_t)fScore[local_122c[4]]; - if (score < (uint16_t)local_1220) { - node = local_122c; - } - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_122c); - if ((uint16_t)local_1220 <= score) { - score = (uint16_t)local_1220; - } - local_1220 = GHIDRA_UINT(score); - } while (local_122c != openSetHead); - } - current = node[4]; - local_121c = current; - if (current == goalIndex) { - if ((flags & 4) == 0) goto LAB_00822813; - pRVar5 = room; - goto LAB_008226e0; - } - neighborGrid = (GHIDRA_CAST((&openSetHead)))->msvc::_Tree::_Extract(node); - operator_delete(neighborGrid,0x14); - msvc::set::insert(local_1294,¤t); - goalColumn = goalCol; - rightCol = goalRow; - iVar4 = room->_gridWidth; - iVar3 = GHIDRA_INT(current) / iVar4; - iVar6 = GHIDRA_INT(current) % iVar4; - if ((((iVar6 + -1 < 0) || (iVar4 <= iVar6 + -1)) || (iVar3 < 0)) || (room->_gridHeight <= iVar3) - ) { - local_1220 = 0xffffffff; - } - else { - local_1220 = iVar4 * iVar3 + -1 + iVar6; - } - local_122c = GHIDRA_CAST((iVar4 * iVar3)); - neighbors[0] = local_1220; - rightCol = iVar6 + 1; - if (((rightCol < 0) || (iVar4 <= rightCol)) || ((iVar3 < 0 || (room->_gridHeight <= iVar3)))) { - neighbors[1] = 0xffffffff; - } - else { - neighbors[1] = rightCol + GHIDRA_INT(local_122c); - } - local_1228 = (void *)(iVar3 + -1); - if (((iVar6 < 0) || (iVar4 <= iVar6)) || - ((GHIDRA_INT(local_1228) < 0 || (room->_gridHeight <= GHIDRA_INT(local_1228))))) { - neighbors[2] = 0xffffffff; - if ((-1 < iVar6) && (iVar6 < iVar4)) goto LAB_008222fe; -LAB_00822339: - neighbors[3] = 0xffffffff; - } - else { - neighbors[2] = GHIDRA_INT(local_1228) * iVar4 + iVar6; -LAB_008222fe: - local_121c = iVar3 + 1; - if ((GHIDRA_INT(local_121c) < 0) || (room->_gridHeight <= GHIDRA_INT(local_121c))) goto LAB_00822339; - neighbors[3] = local_121c * iVar4 + iVar6; - } - uVar7 = 4; - local_121c = 4; - if ((flags & 2) != 0) { - if ((((iVar6 < 0) || (room->_gridWidth <= iVar6)) || (iVar3 < 0)) || - (room->_gridHeight <= iVar3)) { - iVar6 = -1; - } - else { - iVar6 = GHIDRA_INT(local_122c) + iVar6; - } - local_1228 = room->_gridEntities[iVar6]; - if (((local_1228 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(local_1228) + 4)) == 0x17)) && - (*GHIDRA_CAST((GHIDRA_CAST(local_1228) + 0xc)) != 2)) { - iVar3 = room->_gridHeight * room->_gridWidth; - scanIndex = *GHIDRA_CAST((GHIDRA_CAST(local_1228) + 0x24)); - iVar4 = iVar3 + -2; - if (0 < iVar4) { - do { - scanIndex = GHIDRA_INT((scanIndex + 1)) % iVar3; - if (((scanIndex < 0x1c0) && - (neighborGrid = room->_gridEntities[scanIndex], neighborGrid != (void *)0x0)) && - ((*GHIDRA_CAST((GHIDRA_CAST(neighborGrid) + 4)) == 0x17 && - ((*GHIDRA_CAST((GHIDRA_CAST(neighborGrid) + 8)) == *GHIDRA_CAST((GHIDRA_CAST(local_1228) + 8)) && (uVar7 < 0x20)))))) - { - neighbors[uVar7] = scanIndex; - uVar7 = uVar7 + 1; - } - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - local_121c = uVar7; - } - } - } - local_1220 = 0; - if (0 < GHIDRA_INT(local_121c)) { - uVar7 = local_121c; - pRVar5 = room; - do { - neighborGrid = (void *)neighbors[local_1220]; - local_1228 = neighborGrid; - if (-1 < GHIDRA_INT(neighborGrid)) { - neighborGrid = pRVar5->_gridEntities[GHIDRA_INT(neighborGrid)]; - if (neighborGrid == (void *)0x0) { - iVar4 = 0; - } - else { - iVar4 = *GHIDRA_CAST((GHIDRA_CAST(neighborGrid) + 0x3c)); - if (*GHIDRA_CAST((GHIDRA_CAST(neighborGrid) + 4)) == 8) { - iVar4 = 3; - } - } - if (999 < room->_gridPaths[GHIDRA_INT(neighborGrid)]) { - iVar4 = 3; - } - if ((flags & 1) != 0) { - if (iVar4 == 5) { - iVar4 = 0; - } - } - local_122c = GHIDRA_CAST(0x1); - if (((flags & 4) == 0) || (iVar4 != 3)) { - if (iVar4 == 0) goto LAB_0082250a; - } - else if ((neighborGrid != (void *)0x0) && - ((iVar4 = *GHIDRA_CAST((GHIDRA_CAST(neighborGrid) + 4)), iVar4 == 2 || - ((iVar4 != 3 && - ((((iVar4 == 4 || (iVar4 == 5)) || (iVar4 == 6)) || - ((iVar4 == 0x16 || - ((iVar4 != 0x18 && - (((iVar4 == 0x19 || (iVar4 == 0x1a)) || ((iVar4 == 0x1b || (iVar4 == 7))))))) - ))))))))) { - local_122c = GHIDRA_CAST(0x1c0); -LAB_0082250a: - msvc::set::find_node(closedFind,&local_1228); - if (((*GHIDRA_CAST((GHIDRA_CAST(closedNode) + 0xd)) != '\0') || - (GHIDRA_INT(neighborGrid) < *GHIDRA_CAST((GHIDRA_CAST(closedNode) + 0x10)))) || (closedNode == closedSetHead)) - { - local_122c = GHIDRA_CAST((GHIDRA_INT(local_122c) + gScore[current])); - msvc::set::find_node(openFind,&local_1228); - if (((*GHIDRA_CAST((GHIDRA_CAST(openNode) + 0xd)) == '\0') && (openNode[4] <= GHIDRA_INT(neighborGrid))) && - (openNode != openSetHead)) { - if (GHIDRA_CAST(gScore[GHIDRA_INT(neighborGrid)]) <= local_122c) goto LAB_0082262f; - } - else { - msvc::set::insert(local_129c,&local_1228); - neighborGrid = local_1228; - } - gScore[GHIDRA_INT(neighborGrid)] = GHIDRA_UINT(local_122c); - cameFrom[GHIDRA_INT(neighborGrid)] = (uint16_t)current; - deltaCol = (float)goalColumn - (float)(GHIDRA_INT(neighborGrid) % room->_gridWidth); - fVar8 = (float)rightCol - (float)(GHIDRA_INT(neighborGrid) / room->_gridWidth); - sqrtf(fVar8 * fVar8 + deltaCol * deltaCol); - iVar4 = __ftoui3(); - fScore[GHIDRA_INT(neighborGrid)] = iVar4 + GHIDRA_INT(local_122c); - } - } -LAB_0082262f: - uVar7 = local_121c; - pRVar5 = room; - } - local_1220 = local_1220 + 1; - } while (GHIDRA_INT(local_1220) < GHIDRA_INT(uVar7)); - } - } - isPathFound = 0; - goto LAB_0082265f; -LAB_008226e0: - do { - pathGrid = pRVar5->_gridEntities[local_121c]; - if (pathGrid != GHIDRA_CAST(0x0)) { - iVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pathGrid)) + 0x4)))); - if (iVar4 == 2) { -LAB_0082274f: - if (pRVar5->_enterFrame == g_game->_frameCount) { - PickupGridEntity(pRVar5,local_121c); - } - else { - destroySource = 0; - local_1270 = 0; - local_126c = 0; - local_1268 = 0; - local_1264 = g_vectorZero.x; - local_1260 = g_vectorZero.y; - local_125c = g_vectorZero.x; - local_1258 = g_vectorZero.y; - local_1254 = 0; - local_1250 = 0; - pathGrid->Destroy(1,&destroySource); - } - } - else { - if (iVar4 == 3) goto LAB_008227f9; - if ((((iVar4 == 4) || (iVar4 == 5)) || (iVar4 == 6)) || (iVar4 == 0x16)) goto LAB_0082274f; - if (iVar4 == 0x18) goto LAB_008227f9; - if (((iVar4 == 0x19) || (iVar4 == 0x1a)) || (iVar4 == 0x1b)) goto LAB_0082274f; - if ((iVar4 != 7) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pathGrid)) + 0xc)))) != 0)) goto LAB_008227f9; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pathGrid)) + 0xc)))) = 2; - (GHIDRA_CAST((pathGrid)))->GridEntity_Pit::UpdateCollision(); - } - pRVar5 = room; - } -LAB_008227f9: - local_121c = GHIDRA_UINT(cameFrom[local_121c]); - } while (local_121c != 0xffff); -LAB_00822813: - isPathFound = 1; -LAB_0082265f: - FID_conflict__Erase_tree_>_> - (&closedSetHead,(fuzzer_allocator_> *)&closedSetHead - ,*(_Tree_node **)(GHIDRA_INT(closedSetHead) + 4)); - operator_delete(closedSetHead,0x14); - FID_conflict__Erase_tree_>_> - (&openSetHead,(fuzzer_allocator_> *)&openSetHead, - (_Tree_node *)openSetHead[1]); - operator_delete(openSetHead,0x14); - ExceptionList = local_10; - return isPathFound; -} - -// 00822820 -uint8_t Room::CanSpawnObstacleAtPosition(int GridIndex, uint8_t Force) -{ - uint8_t isValid; - char cVar1; - Entity_Player *player; - int iVar2; - int extraout_ECX; - int iVar3; - int iVar4; - int iVar5; - uint32_t uVar6; - uint32_t uVar7; - int iVar8; - Game *game; - uint32_t uVar9; - uint32_t uVar10; - uint8_t auStack_64 [4]; - int targetColumn; - uint8_t isPathClear; - int *local_58; - int nextNeighbor; - Vector local_50; - int targetGridIndex; - int *local_44; - Room *local_40; - uint32_t neighborGridIndices [4]; - int neighborOffsets [10]; - void *neighborGridEntity; - - game = g_game; - neighborOffsets[8] = __security_cookie ^ GHIDRA_UINT(auStack_64); - targetGridIndex = GridIndex; - if (GHIDRA_UINT(GridIndex) < 0x1c0) { - iVar5 = g_game->_room->_gridWidth; - local_50.x = (float)(GridIndex % iVar5) * 40.0 + 40.0; - local_50.y = (float)(GridIndex / iVar5) * 40.0 + 120.0; - local_40 = this; - isValid = IsPositionInRoom(g_game->_room,&local_50,0.0); - if (((isValid != 0) && (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) != 0x10)) && - ((this->_gridEntities[targetGridIndex] == (void *)0x0 || - ((cVar1 = FUN_0070bf60(), cVar1 != '\0' && - (isValid = is_grid_type_floor_special(*GHIDRA_CAST((extraout_ECX + 4))), isValid == 0)))))) { - if (Force == 0) { - uVar9 = 0; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - player = Game::GetPlayer(game,uVar9); - iVar5 = GHIDRA_INT((((player->_pos).x - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT((((player->_pos).y - 120.0) / 40.0 + 0.5)); - if ((((iVar5 < 0) || (this->_gridWidth <= iVar5)) || (iVar3 < 0)) || - (this->_gridHeight <= iVar3)) { - iVar5 = -1; - } - else { - iVar5 = this->_gridWidth * iVar3 + iVar5; - } - if (((iVar5 == targetGridIndex) && - (iVar5 = player->_entityGridCollisionClass, iVar5 != 0)) && - ((iVar5 != 3 && ((iVar5 != 1 && (iVar5 != 2)))))) { - return 0; - } - uVar9 = uVar9 + 1; - game = g_game; - } while (uVar9 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - } - iVar3 = 0; - iVar5 = targetGridIndex / this->_gridWidth; - targetColumn = targetGridIndex % this->_gridWidth; - local_44 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - local_58 = this->_doorGridPositions; - local_50.x = 0.0; - do { - if (((local_44 != GHIDRA_CAST(0x0)) && - ((local_44[(GHIDRA_UINT(local_50.x) >> 5) + 0xe] & 1 << (SUB41(local_50.x,0) & 0x1f)) != 0)) && - (uVar9 = *local_58 / this->_gridWidth - iVar5, - uVar10 = *local_58 % this->_gridWidth - targetColumn, uVar6 = GHIDRA_INT(uVar9) >> 0x1f, - uVar7 = GHIDRA_INT(uVar10) >> 0x1f, - GHIDRA_INT((((uVar9 ^ uVar6) - uVar6) + ((uVar10 ^ uVar7) - uVar7))) < 2)) { - return 0; - } - local_50.x = (float)(GHIDRA_INT(local_50.x) + 1); - local_58 = local_58 + 1; - } while (GHIDRA_INT(local_50.x) < 8); - local_50.x = 0.0; - if ((this->_entityList)._updateEL._size != 0) { - local_44 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))); - do { - iVar4 = *local_44; - if (*GHIDRA_CAST((iVar4 + 0x28)) == 1000) { - if (*GHIDRA_CAST((iVar4 + 0x2c)) == 0x9c) goto LAB_00822ab9; - } - else if ((*GHIDRA_CAST((iVar4 + 0x28)) == 5) && (*GHIDRA_CAST((iVar4 + 0x534)) != 0)) { -LAB_00822ab9: - iVar8 = GHIDRA_INT(((*GHIDRA_CAST((iVar4 + 0x33c)) - 40.0) / 40.0 + 0.5)); - iVar4 = GHIDRA_INT(((*GHIDRA_CAST((iVar4 + 0x340)) - 120.0) / 40.0 + 0.5)); - if ((((-1 < iVar8) && ((iVar2 = this->_gridWidth, iVar8 < iVar2 && (-1 < iVar4)))) && - (iVar4 < this->_gridHeight)) && - ((iVar8 = iVar2 * iVar4 + iVar8, -1 < iVar8 && - (uVar6 = iVar8 % iVar2 - targetColumn, uVar9 = iVar8 / iVar2 - iVar5, - uVar7 = GHIDRA_INT(uVar6) >> 0x1f, uVar10 = GHIDRA_INT(uVar9) >> 0x1f, - GHIDRA_INT((((uVar6 ^ uVar7) - uVar7) + ((uVar9 ^ uVar10) - uVar10))) < 2)))) { - return 0; - } - } - local_50.x = (float)(GHIDRA_INT(local_50.x) + 1); - local_44 = local_44 + 1; - } while (GHIDRA_UINT(local_50.x) < GHIDRA_UINT((this->_entityList)._updateEL._size)); - } - iVar4 = 0; - neighborOffsets[0] = -1; - neighborOffsets[1] = 0; - neighborOffsets[2] = 1; - neighborOffsets[3] = 0; - neighborOffsets[4] = 0; - neighborOffsets[5] = 0xffffffff; - neighborOffsets[6] = 0; - neighborOffsets[7] = 1; - do { - iVar8 = neighborOffsets[iVar4 * 2] + targetColumn; - if (-1 < iVar8) { - if (iVar8 < this->_gridWidth) { - iVar2 = neighborOffsets[iVar4 * 2 + 1] + iVar5; - if ((-1 < iVar2) && (iVar2 < this->_gridHeight)) { - uVar9 = this->_gridWidth * iVar2 + iVar8; - if (-1 < GHIDRA_INT(uVar9)) { - neighborGridEntity = this->_gridEntities[uVar9]; - if (neighborGridEntity == (void *)0x0) { - if (this->_gridPaths[uVar9] < 1000) goto LAB_00822c10; - } - else { - iVar8 = *GHIDRA_CAST((GHIDRA_CAST(neighborGridEntity) + 4)); - if (iVar8 == 0x10) { - return 0; - } - if (((((0x1bf < *GHIDRA_CAST((GHIDRA_CAST(neighborGridEntity) + 0x24))) || - (this = local_40, - *GHIDRA_CAST((GHIDRA_INT(g_game->_room) + - *GHIDRA_CAST((GHIDRA_CAST(neighborGridEntity) + 0x24)) * 4 + 0x76c)) < 1000)) || - (iVar8 == 0xc)) || (iVar8 == 0xe)) && - (((iVar8 != 0x11 && (iVar8 != 0x12)) && ((iVar8 != 0x14 && (iVar8 != 0x17)))))) - { -LAB_00822c10: - neighborGridIndices[iVar3] = uVar9; - iVar3 = iVar3 + 1; - } - } - } - } - } - } - iVar4 = iVar4 + 1; - } while (iVar4 < 4); - isValid = 1; - isPathClear = 1; - local_50.x = (float)this->_gridPaths[targetGridIndex]; - this->_gridPaths[targetGridIndex] = 1000; - if (0 < iVar3 + -1) { - local_58 = GHIDRA_CAST(neighborGridIndices); - nextNeighbor = 1; - do { - if (isValid == 0) break; - iVar5 = nextNeighbor; - local_40 = GHIDRA_CAST(nextNeighbor); - if (nextNeighbor < iVar3) { - do { - isValid = is_obstacle_path_valid(this,*local_58,neighborGridIndices[iVar5],0); - if (isValid == 0) { - isPathClear = 0; - break; - } - iVar5 = iVar5 + 1; - } while (iVar5 < iVar3); - isValid = isPathClear; - } - nextNeighbor = nextNeighbor + 1; - local_58 = local_58 + 1; - } while (GHIDRA_INT(local_40) < iVar3 + -1); - } - this->_gridPaths[targetGridIndex] = GHIDRA_INT(local_50.x); - return isValid; - } - } - return 0; -} - -// 00822cf0 -void Room::add_trigger_output_index(uint32_t group, int gridIndex) -{ - uint8_t insertResult [12]; - - if (group < 10) { - msvc::set::insert(insertResult,&gridIndex); - } - return; -} - -// 00822d20 -void Room::add_trigger_output_cell(int group, int x, int y) -{ - int gridIndex; - - if ((((-1 < x) && (-1 < y)) && (x < this->_gridWidth)) && (y < this->_gridHeight)) { - gridIndex = GetGridIndexByTile(this,x,y); - add_trigger_output_index(this,group,gridIndex); - } - return; -} - -// 00822d60 -void Room::hold_trigger_output_entities() -{ - int *piVar1; - Entity *entity; - uint64_t *findResult; - Game *game; - uint32_t groupIdx; - uint32_t *puVar2; - uint8_t *groupSet; - uint8_t local_20c [12]; - uint64_t insertPos; - uint32_t *local_1f4; - uint32_t local_1f0; - int local_1ec; - int gridIdxKey; - uint32_t *heldIndexSet; - Room *local_1e0; - int *local_1dc; - char isAnyOutput; - char cellGroup [448]; - uint32_t securityCookie; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int descriptor; - int gridIdx; - uint32_t setHead; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b018e0; - local_10 = ExceptionList; - securityCookie = __security_cookie ^ GHIDRA_UINT((cellGroup + 0x1d0)); - ExceptionList = &local_10; - local_1e0 = this; - memset(cellGroup,0xff,0x1c0); - groupSet = this->_outputGroupGridIndices; - isAnyOutput = '\0'; - groupIdx = 0; - do { - piVar1 = *GHIDRA_CAST(groupSet); - local_1dc = GHIDRA_CAST(*piVar1); - if (local_1dc != piVar1) { - isAnyOutput = '\x01'; - do { - if (cellGroup[local_1dc[4]] < '\0') { - cellGroup[local_1dc[4]] = (char)groupIdx; - } - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)&local_1dc); - } while (local_1dc != piVar1); - } - game = g_game; - groupIdx = groupIdx + 1; - groupSet = groupSet + 8; - } while (groupIdx < 10); - if (isAnyOutput != '\0') { - local_1dc = GHIDRA_CAST(0x0); - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f5)) = 0; - if ((local_1e0->_entityList)._updateEL._size != 0) { - do { - entity = *(Entity **) - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((local_1e0->_entityList)._updateEL)) + 0x4)))) + GHIDRA_INT(local_1dc) * 4); - gridIdx = entity->_spawnGridIndex; - if ((-1 < gridIdx) && (local_1ec = GHIDRA_INT(cellGroup[gridIdx]), -1 < local_1ec)) { - descriptor = entity->_type; - gridIdxKey = gridIdx; - if ((descriptor != 5) || (entity[1]._sprite._championColor._tint[2] != 0.0)) { - if (((*GHIDRA_CAST(&game->_deathmatchManager) < 2) || (descriptor != 1)) && - (0x3dd < descriptor - 10U)) { - if (descriptor != 4) goto LAB_00822f83; - } - else { - descriptor = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_1e0)) + 0x4)))); - puVar2 = GHIDRA_CAST((descriptor + 0x80)); - heldIndexSet = puVar2; - findResult = GHIDRA_CAST(std)::set::find_node(local_20c,&gridIdxKey); - insertPos = *findResult; - if ((*GHIDRA_CAST((*GHIDRA_CAST((findResult + 1)) + 0xd)) != '\0') || - (gridIdx < *GHIDRA_CAST((*GHIDRA_CAST((findResult + 1)) + 0x10)))) { - if (*GHIDRA_CAST((descriptor + 0x84)) == 0xccccccc) { - /* WARNING: Subroutine does not return */ - FUN_004170d0(); - } - setHead = *puVar2; - local_1f4 = heldIndexSet; - local_8 = 0; - local_1f0 = 0; - puVar2 = operator_new(0x14); - local_8 = 0xffffffff; - local_1f0 = 0; - puVar2[4] = gridIdx; - *puVar2 = setHead; - puVar2[1] = setHead; - puVar2[2] = setHead; - *GHIDRA_CAST((puVar2 + 3)) = 0; - (GHIDRA_CAST((heldIndexSet)))->msvc::_Tree::_Insert_node((void *)insertPos,(*GHIDRA_CAST((GHIDRA_CAST(&(insertPos)) + 0x4))),puVar2); - } - } - } - piVar1 = local_1dc; - hold_entity_in_spawner(local_1e0,entity,local_1ec); - game = g_game; - local_1dc = piVar1; - } -LAB_00822f83: - local_1dc = GHIDRA_CAST((GHIDRA_INT(local_1dc) + 1)); - } while (local_1dc < GHIDRA_UINT((local_1e0->_entityList)._updateEL._size)); - } - } - ExceptionList = local_10; - return; -} - -// 00822fd0 -Entity * Room::hold_entity_in_spawner(Entity *entity, int group) -{ - char cVar1; - Entity_Effect *spawner; - Vector spawnPos; - - spawnPos.x = (entity->_pos).x; - spawnPos.y = (entity->_pos).y; - spawner = (Entity_Effect *) - Game::SpawnEx(g_game,1000,0x78,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),entity->_type, - entity->_initSeed,0); - *GHIDRA_CAST(&(spawner->_varData)._l) = entity->_variant; - *GHIDRA_CAST((GHIDRA_INT(&(spawner->_varData)._l) + 4)) = entity->_subtype; - spawner->_state = group; - cVar1 = entity->CanShutDoors(); - if ((cVar1 != '\0') && (entity->_type != 0x362)) { - this->_aliveEnemyCount = this->_aliveEnemyCount + -1; - cVar1 = entity->IsBoss(); - if (cVar1 != '\0') { - this->_aliveBossCount = this->_aliveBossCount + -1; - } - } - entity->Remove(); - return GHIDRA_CAST(spawner); -} - -// 00823080 -void Room::TriggerOutput(uint32_t outputGroupdIdx) -{ - uint32_t i; - uint32_t *callback; - int gridIter [2]; - int *entity; - - gridIter[0] = **GHIDRA_CAST((this->_outputGroupGridIndices + outputGroupdIdx * 8)); - if (GHIDRA_CAST(gridIter[0]) != *GHIDRA_CAST((this->_outputGroupGridIndices + outputGroupdIdx * 8))) { - do { - if (this->_gridEntities[*GHIDRA_CAST((gridIter[0] + 0x10))] != GHIDRA_CAST(0x0)) { - GridEntity::trigger_output(this->_gridEntities[*GHIDRA_CAST((gridIter[0] + 0x10))]); - } - msvc:: - _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> - *)gridIter); - } while (gridIter[0] != *GHIDRA_CAST((this->_outputGroupGridIndices + outputGroupdIdx * 8))); - } - i = 0; - if ((this->_entityList)._updateEL._size != 0) { - do { - entity = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))) + i * 4)); - if (((entity[10] == 1000) && (entity[0xb] == 0x78)) && (entity[0x114] == outputGroupdIdx)) { - *GHIDRA_CAST((GHIDRA_CAST(entity) + 0x173)) = 1; - (**(code **)(*entity + 0xc))(); - } - i = i + 1; - } while (i < GHIDRA_UINT((this->_entityList)._updateEL._size)); - } - callback = *GHIDRA_CAST((this->_outputGroupCallbacks + outputGroupdIdx * 0xc)); - if (callback != *GHIDRA_CAST((this->_outputGroupCallbacks + outputGroupdIdx * 0xc + 4))) { - do { - (*(code *)*callback)(); - callback = callback + 1; - } while (callback != *GHIDRA_CAST((this->_outputGroupCallbacks + outputGroupdIdx * 0xc + 4))); - } - return; -} - -// 00823370 -float * Room::get_color_modifier(float *outColor) -{ - uint8_t isHasMineshaft; - float darkenAmount; - uint32_t descriptorFlags; - int roomType; - - *outColor = *GHIDRA_CAST(&(this->_fxLayers)._fxParams); - outColor[1] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers)._fxParams)) + 0x4)))); - outColor[2] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers)._fxParams)) + 0x8)))); - outColor[3] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_fxLayers)._fxParams)) + 0xc)))); - outColor[4] = (this->_fxLayers)._fxParams.brightness; - outColor[5] = (this->_fxLayers)._fxParams.contrast; - roomType = this->_roomType; - if (((roomType != 7) && (roomType != 8)) && (roomType != 0x1d)) { - isHasMineshaft = Level::HasAbandonedMineshaft(GHIDRA_CAST(g_game)); - if ((isHasMineshaft == 0) || (g_game->_currentDimensionIdx != 1)) goto LAB_00823474; - } - *outColor = (1.0 - *outColor) * 0.75 + *outColor; - outColor[4] = (0.0 - outColor[4]) * 0.75 + outColor[4]; - outColor[1] = (1.0 - outColor[1]) * 0.75 + outColor[1]; - outColor[2] = (1.0 - outColor[2]) * 0.75 + outColor[2]; - outColor[5] = (1.0 - outColor[5]) * 0.75 + outColor[5]; - outColor[3] = (0.0 - outColor[3]) * 0.75 + outColor[3]; -LAB_00823474: - roomType = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - descriptorFlags = *GHIDRA_CAST((roomType + 0x44)); - if ((descriptorFlags >> 9 & 1) != 0) { - outColor[4] = outColor[4] + 0.03; - } - if ((this->_backdropType == 0x20) && ((descriptorFlags >> 5 & 1) != 0)) { - darkenAmount = ((float)*GHIDRA_CAST((roomType + 0x54)) / - (float)((this->_gridHeight + -2) * (this->_gridWidth + -2))) * - this->_lavaIntensity; - *outColor = *outColor - darkenAmount; - outColor[2] = darkenAmount * 0.4 + outColor[2]; - outColor[1] = darkenAmount * 0.4 + outColor[1]; - outColor[5] = darkenAmount * 0.2 + outColor[5]; - outColor[3] = outColor[3] - darkenAmount * 0.45; - } - return outColor; -} - -// 00823590 -KColor * Room::GetFloorColorAt(KColor *outColor, Vector *position, float radius) -{ - float fVar1; - float fVar2; - char cVar3; - uint32_t uVar4; - uint32_t uVar5; - int *medianNode; - float fVar6; - void *pvVar7; - float *sampledColor; - int medianSteps; - float fVar8; - float waterBlend; - float waterBlend; - float fVar10; - double dVar11; - float sampleLuminance; - KColor sampleEntryColor; - KColor sampleColor; - int *backdrop; - int *backdropRefCount; - uint32_t *sampleTreeHead; - uint32_t sampleTreeSize; - uint8_t sampleSet [4]; - Room *room; - void *local_3c; - float sampleX; - float sampleY; - float local_30; - float sampleRadius; - float local_28; - float screenX; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - int *parentNode; - code *samplePixelFn; - int *walkNode; - - puStack_20 = sampleSet + 0x40; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b0192d; - local_1c = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_UINT((sampleSet + 0x34)); - ExceptionList = &local_1c; - room = this; - sampleRadius = radius; - (GHIDRA_CAST((outColor)))->KColor::SetFromARGB(0xffffffff); - local_28 = g_displayPixelRatio * g_screenPointScale; - sampleY = (g_screenHeight - 182.0) * 0.5; - local_30 = ((position->x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_28 + 0.5; - dVar11 = floor((double)local_30); - local_30 = (float)dVar11; - screenX = local_30 / local_28; - sampleY = ((position->y - 140.0) * 0.65 + sampleY) * local_28 + 0.5; - dVar11 = floor((double)sampleY); - sampleY = (float)dVar11; - screenX = screenX - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11fc)); - local_28 = sampleY / local_28 - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1200)); - if (sampleRadius <= 0.0) { - (GHIDRA_CAST((&backdrop)))->shared_ptr::assign(&this->_backdrop); - local_14 = 3; - samplePixelFn = *(code **)(*backdrop + 0x2c); - local_30 = (float)__ftoui3(uVar4); - local_3c = (void *)__ftoui3(); - sampledColor = GHIDRA_CAST((*samplePixelFn)(&sampleEntryColor,local_3c,local_30)); - fVar6 = sampledColor[1]; - waterBlend = sampledColor[2]; - fVar10 = sampledColor[3]; - outColor->_red = *sampledColor; - outColor->_green = fVar6; - outColor->_blue = waterBlend; - outColor->_alpha = fVar10; - outColor->_unk = GHIDRA_INT(sampledColor[4]); - local_14 = 4; - if (((backdropRefCount != GHIDRA_CAST(0x0)) && - (cVar3 = (**(code **)(*backdropRefCount + 0xc))(), cVar3 != '\0')) && - (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(); - } - local_14 = 0xffffffff; - pvVar7 = local_3c; - fVar6 = local_30; - } - else { - sampleTreeHead = GHIDRA_CAST(0x0); - sampleTreeSize = 0; - sampleTreeHead = operator_new(0x28); - *sampleTreeHead = sampleTreeHead; - sampleTreeHead[1] = sampleTreeHead; - sampleTreeHead[2] = sampleTreeHead; - *GHIDRA_CAST((sampleTreeHead + 3)) = 0x101; - local_3c = &this->_backdrop; - local_14 = 0; - local_30 = 0.0; - do { - sampleY = sampleRadius * *GHIDRA_CAST((GHIDRA_INT(&DAT_00c5d14c) + GHIDRA_INT(local_30))) * 0.65 + local_28; - sampleX = sampleRadius * *GHIDRA_CAST((GHIDRA_INT(&DAT_00c5d148) + GHIDRA_INT(local_30))) * 0.65 + screenX; - (GHIDRA_CAST((&backdrop)))->shared_ptr::assign(local_3c); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - samplePixelFn = *(code **)(*backdrop + 0x2c); - __ftoui3(); - uVar5 = __ftoui3(); - (*samplePixelFn)(&sampleColor,uVar5); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - if (((backdropRefCount != GHIDRA_CAST(0x0)) && - (cVar3 = (**(code **)(*backdropRefCount + 0xc))(), cVar3 != '\0')) && - (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(); - } - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - sampleEntryColor._unk = sampleColor._unk; - sampleEntryColor._red = sampleColor._red; - sampleEntryColor._green = sampleColor._green; - sampleEntryColor._blue = sampleColor._blue; - sampleLuminance = - sampleColor._green * 0.71516 + sampleColor._red * 0.212671 + sampleColor._blue * 0.072169 - ; - sampleEntryColor._alpha = sampleColor._alpha; - FUN_00828860(sampleSet,&sampleLuminance); - local_30 = (float)(GHIDRA_INT(local_30) + 8); - } while (GHIDRA_UINT(local_30) < 0x28); - medianSteps = 2; - medianNode = GHIDRA_CAST(*sampleTreeHead); - do { - walkNode = GHIDRA_CAST(medianNode[2]); - if (*GHIDRA_CAST((GHIDRA_CAST(walkNode) + 0xd)) == '\0') { - cVar3 = *GHIDRA_CAST((*walkNode + 0xd)); - medianNode = walkNode; - walkNode = GHIDRA_CAST(*walkNode); - while (cVar3 == '\0') { - cVar3 = *GHIDRA_CAST((*walkNode + 0xd)); - medianNode = walkNode; - walkNode = GHIDRA_CAST(*walkNode); - } - } - else { - cVar3 = *GHIDRA_CAST((medianNode[1] + 0xd)); - parentNode = GHIDRA_CAST(medianNode[1]); - walkNode = medianNode; - while ((medianNode = parentNode, cVar3 == '\0' && (walkNode == GHIDRA_CAST(medianNode[2])))) { - cVar3 = *GHIDRA_CAST((medianNode[1] + 0xd)); - parentNode = GHIDRA_CAST(medianNode[1]); - walkNode = medianNode; - } - } - medianSteps = medianSteps + -1; - } while (medianSteps != 0); - fVar6 = (float)medianNode[6]; - waterBlend = (float)medianNode[7]; - fVar10 = (float)medianNode[8]; - outColor->_red = (float)medianNode[5]; - outColor->_green = fVar6; - outColor->_blue = waterBlend; - outColor->_alpha = fVar10; - outColor->_unk = medianNode[9]; - local_14 = 0xffffffff; - FID_conflict__Erase_tree_>_> - (&sampleTreeHead, - (fuzzer_allocator_> *)&sampleTreeHead, - (_Tree_node *)sampleTreeHead[1]); - operator_delete(sampleTreeHead,0x28); - fVar6 = (float)__ftoui3(); - pvVar7 = (void *)__ftoui3(); - } - if ((DAT_00c797bc != 0) && (DAT_00c797ec != GHIDRA_CAST(0x0))) { - (**(code **)(*DAT_00c797ec + 0x2c))(&sampleColor,pvVar7,fVar6); - outColor->_red = (sampleColor._red - outColor->_red) * sampleColor._alpha + outColor->_red; - outColor->_green = - (sampleColor._green - outColor->_green) * sampleColor._alpha + outColor->_green; - outColor->_blue = (sampleColor._blue - outColor->_blue) * sampleColor._alpha + outColor->_blue; - } - fVar6 = room->_waterAmount; - if (fVar6 <= 0.0) { - fVar6 = outColor->_blue; - waterBlend = outColor->_red; - fVar10 = outColor->_green; - } - else { - fVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((room->_fxLayers)._fxParams)) + 0x28)))); - waterBlend = fVar6 * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((room->_fxLayers)._fxParams)) + 0x2c)))); - fVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((room->_fxLayers)._fxParams)) + 0x38)))); - fVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((room->_fxLayers)._fxParams)) + 0x24)))); - fVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((room->_fxLayers)._fxParams)) + 0x3c)))); - waterBlend = ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((room->_fxLayers)._fxParams)) + 0x20)))) - outColor->_red) * - fVar6 * waterBlend + outColor->_red) * - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((room->_fxLayers)._fxParams)) + 0x34)))) - 1.0) * fVar6 + 1.0); - outColor->_red = waterBlend; - fVar10 = ((fVar2 - outColor->_green) * waterBlend * room->_waterAmount + outColor->_green) * - ((fVar10 - 1.0) * fVar6 + 1.0); - outColor->_green = fVar10; - fVar6 = ((fVar1 - outColor->_blue) * waterBlend * room->_waterAmount + outColor->_blue) * - ((fVar8 - 1.0) * fVar6 + 1.0); - outColor->_blue = fVar6; - } - fVar1 = (room->_floorColor)._colorize[3]; - fVar2 = (room->_floorColor)._tint[3]; - waterBlend = waterBlend * (room->_floorColor)._tint[0]; - fVar10 = fVar10 * (room->_floorColor)._tint[1]; - fVar6 = fVar6 * (room->_floorColor)._tint[2]; - if (fVar1 != 0.0) { - fVar8 = fVar10 * 0.71516 + waterBlend * 0.212671 + fVar6 * 0.072169; - waterBlend = waterBlend + (fVar8 * (room->_floorColor)._colorize[0] - waterBlend) * fVar1; - fVar10 = fVar10 + (fVar8 * (room->_floorColor)._colorize[1] - fVar10) * fVar1; - fVar6 = fVar6 + (fVar8 * (room->_floorColor)._colorize[2] - fVar6) * fVar1; - } - fVar1 = (room->_floorColor)._offset[1]; - fVar8 = (room->_floorColor)._offset[2]; - outColor->_red = waterBlend + (room->_floorColor)._offset[0]; - outColor->_green = fVar10 + fVar1; - outColor->_blue = fVar6 + fVar8; - outColor->_alpha = fVar2 * outColor->_alpha; - outColor->_unk = 0; - ExceptionList = local_1c; - return outColor; -} - -// 00823be0 -uint8_t Room::is_reachable_from_player(float *param_1, Entity_Player *param_2, char param_3) -{ - uint8_t bVar1; - Vector *extraout_EAX; - Vector *pVVar2; - int iVar3; - uint32_t uVar4; - Room *in_ECX; - Room *extraout_ECX; - Room *this; - int iVar5; - uint32_t goalIndex; - uint32_t startIndex; - Vector local_10; - - this = in_ECX; - if (param_2 == GHIDRA_CAST(0x0)) { - param_2 = Game::GetPlayer(g_game,0); - this = extraout_ECX; - } - if (param_3 == '\0') { - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_Player::GetEnterPosition(&local_10); - pVVar2 = extraout_EAX; - } - else { - local_10.y = (param_2->_pos).y; - pVVar2 = &local_10; - local_10.x = (param_2->_pos).x; - } - iVar5 = GHIDRA_INT(((pVVar2->x - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT(((pVVar2->y - 120.0) / 40.0 + 0.5)); - if ((((iVar5 < 0) || (in_ECX->_gridWidth <= iVar5)) || (iVar3 < 0)) || - (in_ECX->_gridHeight <= iVar3)) { - goalIndex = 0xffffffff; - } - else { - goalIndex = in_ECX->_gridWidth * iVar3 + iVar5; - } - iVar3 = GHIDRA_INT(((*param_1 - 40.0) / 40.0 + 0.5)); - if (((-1 < iVar3) && (iVar3 < in_ECX->_gridWidth)) && - ((iVar5 = GHIDRA_INT(((param_1[1] - 120.0) / 40.0 + 0.5)), -1 < iVar5 && (iVar5 < in_ECX->_gridHeight) - ))) { - startIndex = in_ECX->_gridWidth * iVar5 + iVar3; - uVar4 = GetGridCollision(in_ECX,startIndex); - if (((-1 < GHIDRA_INT(startIndex)) && (-1 < GHIDRA_INT(goalIndex))) && ((uVar4 == 0 || (uVar4 == 5)))) { - bVar1 = is_obstacle_path_valid(in_ECX,startIndex,goalIndex,3); - return bVar1; - } - } - return 0; -} - -// 00823d10 -Vector * Room::find_reachable_position(Vector *outPosition, Vector *position, int unused) -{ - char isReachable; - int gridIndex; - int iVar1; - int gridIndex; - int gridY; - int gridX; - float fVar3; - float tileY; - int ringLength; - int stepY; - int stepX; - Vector tilePos; - - isReachable = is_reachable_from_player(position,0,0); - if (isReachable == '\0') { - stepX = 0; - stepY = -1; - ringLength = 1; - gridX = GHIDRA_INT(((position->x - 40.0) / 40.0 + 0.5)); - gridY = GHIDRA_INT(((position->y - 120.0) / 40.0 + 0.5)); - do { - gridIndex = 0; - if (0 < ringLength) { - do { - gridX = gridX + stepX; - gridY = gridY + stepY; - if ((((0 < gridX) && (0 < gridY)) && (iVar1 = this->_gridWidth, gridX < iVar1 + -1)) && - (gridY < this->_gridHeight + -1)) { - if ((gridX < iVar1) && (gridY < this->_gridHeight)) { - gridIndex = iVar1 * gridY + gridX; - } - else { - gridIndex = -1; - } - fVar3 = (float)(gridIndex % iVar1) * 40.0 + 40.0; - tileY = (float)(gridIndex / iVar1) * 40.0 + 120.0; - tilePos.x = fVar3; - tilePos.y = tileY; - isReachable = is_reachable_from_player(&tilePos,0,0); - if (isReachable != '\0') { - outPosition->x = fVar3; - outPosition->y = tileY; - return outPosition; - } - } - gridIndex = gridIndex + 1; - } while (gridIndex < ringLength); - } - iVar1 = -stepY; - gridIndex = ringLength + 1; - if (iVar1 != 0) { - gridIndex = ringLength; - } - ringLength = gridIndex; - stepY = stepX; - stepX = iVar1; - } while (gridIndex < 0x10); - } - fVar3 = position->y; - outPosition->x = position->x; - outPosition->y = fVar3; - return outPosition; -} - -// 00823f50 -void Room::attach_minecarts() -{ - int *piVar1; - Entity_NPC *this; - void *pvVar2; - uint8_t railCell; - uint32_t uVar3; - int in_ECX; - int neighborRow; - int iVar4; - int iVar5; - uint8_t *puVar6; - uint8_t *puVar7; - float railX; - float railY; - uint8_t auStack_54 [3]; - char isMinecartNpc; - int local_50; - int gridRow; - int self; - Vector railDir; - Entity_NPC *local_3c; - uint32_t entityIndex; - Vector cartPos; - int neighborOffsets [10]; - Game *game; - int gridWidth; - - neighborOffsets[8] = __security_cookie ^ GHIDRA_UINT(auStack_54); - entityIndex = 0; - self = in_ECX; - if (*GHIDRA_CAST((in_ECX + 0x1264)) != 0) { - do { - game = g_game; - puVar6 = &DAT_bf800000; - puVar7 = GHIDRA_CAST(0x0); - this = *GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x125c)) + entityIndex * 4)); - iVar5 = this->_type; - if ((iVar5 != 0x3c5) || (isMinecartNpc = '\x01', this->_variant != 10)) { - isMinecartNpc = '\0'; - } - if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar5 == 1)) || (iVar5 - 10U < 0x3de)) { - local_50 = this->_spawnGridIndex; - if ((-1 < local_50) && - ((((iVar5 != 0x3c5 || (this->_variant != 0)) && (this->_minecart == 0)) || - (isMinecartNpc != '\0')))) { - gridRow = local_50 / *GHIDRA_CAST((in_ECX + 0xc)); - local_50 = local_50 % *GHIDRA_CAST((in_ECX + 0xc)); - iVar5 = 0; - neighborOffsets[0] = 0; - neighborOffsets[1] = 1; - neighborOffsets[2] = 0; - neighborOffsets[3] = 0xffffffff; - neighborOffsets[4] = 0xffffffff; - neighborOffsets[5] = 0; - neighborOffsets[6] = 1; - neighborOffsets[7] = 0; - do { - iVar4 = neighborOffsets[iVar5 * 2] + local_50; - if (0 < iVar4) { - neighborRow = neighborOffsets[iVar5 * 2 + 1] + gridRow; - if (0 < neighborRow) { - gridWidth = *GHIDRA_CAST((in_ECX + 0xc)); - if (iVar4 < gridWidth + -1) { - piVar1 = GHIDRA_CAST((in_ECX + 0x10)); - in_ECX = self; - if (((neighborRow < *piVar1 + -1) && (iVar4 < gridWidth)) && - ((neighborRow < *piVar1 && - (((iVar4 = gridWidth * neighborRow + iVar4, -1 < iVar4 && (iVar4 < 0x1c0)) && - (railCell = *GHIDRA_CAST((self + 0x746c + iVar4)), -1 < (char)railCell)))))) { - if (railCell == 0xff) { - uVar3 = 0; - } - else if ((railCell & 0x40) == 0) { - if ((railCell & 0x10) == 0) { - uVar3 = railCell >> 5 & 1; - } - else { - uVar3 = 0xffffffff; - } - } - else { - uVar3 = 0; - } - railCell = *GHIDRA_CAST((self + 0x746c + iVar4)); - if ((railCell != 0xff) && ((uVar3 != 0 || (isMinecartNpc != '\0')))) { - railDir.y = 0.0; - railDir.x = 0.0; - if (uVar3 != 0) { - if ((railCell & 0xf) == 0) { - railDir.y = (float)puVar7; - if (GHIDRA_INT(uVar3) < 0) { - puVar7 = puVar6; - } - else { - puVar7 = GHIDRA_CAST(0x3f800000); - } - } - else { - if (-1 < GHIDRA_INT(uVar3)) { - puVar6 = GHIDRA_CAST(0x3f800000); - } - railDir.y = (float)puVar6; - } - railDir.x = (float)puVar7; - } - railX = (float)(iVar4 % *GHIDRA_CAST((self + 0xc))) * 40.0 + 40.0; - railY = (float)(iVar4 / *GHIDRA_CAST((self + 0xc))) * 40.0 + 120.0; - in_ECX = self; - local_3c = this; - if (isMinecartNpc == '\0') { - cartPos.x = railX; - cartPos.y = railY; - (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GiveMinecart(&cartPos,&railDir); - } - else { - (this->_velocity).y = railDir.y; - (this->_pos).x = railX; - (this->_pos).y = railY; - (this->_velocity).x = railDir.x; - (this->_targetPosition).x = railX; - (this->_targetPosition).y = railY; - pvVar2 = game->_room; - iVar5 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5)); - if (((iVar5 < 0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)) <= iVar5)) || - (((iVar4 = GHIDRA_INT(((railY - 120.0) / 40.0 + 0.5)), iVar4 < 0 || - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)) <= iVar4 || - (uVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)) * iVar4 + iVar5, 0x1bf < uVar3)) - || (railCell = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + uVar3 + 0x746c)), - railCell == 0xff)))) || - (((railCell = railCell & 0xf, railCell != 1 && (railCell != 9)) && - (railCell != 10)))))) { - iVar5 = 0; - } - else { - iVar5 = 4; - } - this->_i1 = iVar5; - this->Entity_NPC::update_move_direction_anim(); - (this->_v2).x = 0.2; - } - break; - } - } - } - } - } - iVar5 = iVar5 + 1; - } while (iVar5 < 4); - } - } - entityIndex = entityIndex + 1; - } while (entityIndex < *GHIDRA_CAST((in_ECX + 0x1264))); - } - return; -} - -// 008242d0 -uint8_t Room::HasLava() -{ - if ((this->_backdropType == 0x20) && ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 5 & 1) != 0)) - { - return 1; - } - return 0; -} - -// 00824350 -void Room::init_rain() -{ - uint32_t uVar1; - uint8_t unused; - uint8_t rngShiftB; - uint32_t baseCount; - uint32_t roll; - uint32_t spawnersLeft; - int updatesLeft; - float fVar2; - float fVar3; - float fVar4; - float fVar5; - float fVar6; - float local_4c; - float local_48; - float local_44; - uint64_t rngShiftsAB; - Vector spawnPos; - uint32_t attempt; - code *breakTrap; - - this->_numRainSpawners = 0; - this->_rainIntensity = 1.0; - this->_isRainStopped = 0; - if ((0.0 < this->_waterAmount) && - (((uVar1 = Game::GetStageID(g_game,(uint8_t)this), uVar1 == 0x1b || - (uVar1 = Game::GetStageID(g_game,unused), uVar1 == 0x1c)) || (this->_backdropType == 0x2c)))) - { - rngShiftsAB = 0xb00000001; - uVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); - if (this->_bossId == 0x4d) { - spawnersLeft = ((uint8_t)~*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) & 1) << 2; - } - else { - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - breakTrap = (code *)swi(3); - (*breakTrap)(); - return; - } - uVar1 = uVar1 >> 1 ^ uVar1; - uVar1 = uVar1 << 0xb ^ uVar1; - uVar1 = uVar1 >> 6 ^ uVar1; - roll = uVar1 % 1000; - baseCount = (roll < 300) + 1; - if (99 < roll) { - baseCount = GHIDRA_UINT((roll < 300)); - } - spawnersLeft = baseCount + 1; - if (0x27 < roll) { - spawnersLeft = baseCount; - } - if (roll < 10) { - spawnersLeft = spawnersLeft + 1; - } - } - attempt = 0; - do { - if (spawnersLeft == 0) break; - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - breakTrap = (code *)swi(3); - (*breakTrap)(); - return; - } - uVar1 = uVar1 >> ((uint8_t)rngShiftsAB & 0x1f) ^ uVar1; - rngShiftB = (uint8_t)((uint64_t)rngShiftsAB >> 0x20); - uVar1 = uVar1 << (rngShiftB & 0x1f) ^ uVar1; - uVar1 = uVar1 >> 6 ^ uVar1; - fVar2 = (this->_topLeftPos).y + 20.0; - fVar2 = (((this->_bottomRightPos).y - 20.0) - fVar2) * - (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283062e-10 + fVar2; - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - breakTrap = (code *)swi(3); - (*breakTrap)(); - return; - } - uVar1 = uVar1 >> ((uint8_t)rngShiftsAB & 0x1f) ^ uVar1; - uVar1 = uVar1 << (rngShiftB & 0x1f) ^ uVar1; - uVar1 = uVar1 >> 6 ^ uVar1; - fVar3 = (this->_topLeftPos).x + 20.0; - fVar3 = (((this->_bottomRightPos).x - 20.0) - fVar3) * - (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283062e-10 + fVar3; - spawnPos.x = fVar3; - spawnPos.y = fVar2; - FUN_00995f40(&local_4c,&spawnPos); - if (0.6 <= (local_48 + local_4c + local_44) * 0.333) { - updatesLeft = this->_numRainSpawners; - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - breakTrap = (code *)swi(3); - (*breakTrap)(); - return; - } - uVar1 = uVar1 >> ((uint8_t)rngShiftsAB & 0x1f) ^ uVar1; - uVar1 = uVar1 << ((uint8_t)((uint64_t)rngShiftsAB >> 0x20) & 0x1f) ^ uVar1; - uVar1 = uVar1 >> 6 ^ uVar1; - fVar4 = (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283062e-10 * 360.0 * 0.017453292; - fVar5 = cos(fVar4); - fVar4 = sin(fVar4); - *GHIDRA_CAST((this->_outputGroupCallbacks + updatesLeft * 0x18 + 0x7c)) = fVar3; - *GHIDRA_CAST((this->_outputGroupCallbacks + updatesLeft * 0x18 + 0x80)) = fVar2; - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - breakTrap = (code *)swi(3); - (*breakTrap)(); - return; - } - uVar1 = uVar1 >> ((uint8_t)rngShiftsAB & 0x1f) ^ uVar1; - rngShiftB = (uint8_t)((uint64_t)rngShiftsAB >> 0x20); - uVar1 = uVar1 << (rngShiftB & 0x1f) ^ uVar1; - uVar1 = uVar1 >> 6 ^ uVar1; - fVar2 = (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283062e-10 * 60.0 + 20.0; - *GHIDRA_CAST((this->_outputGroupCallbacks + updatesLeft * 0x18 + 0x88)) = fVar2 * fVar4; - *GHIDRA_CAST((this->_outputGroupCallbacks + updatesLeft * 0x18 + 0x84)) = fVar2 * fVar5; - fVar2 = cos(1.5707964); - fVar3 = sin(1.5707964); - if (uVar1 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - breakTrap = (code *)swi(3); - (*breakTrap)(); - return; - } - uVar1 = uVar1 >> ((uint8_t)rngShiftsAB & 0x1f) ^ uVar1; - uVar1 = uVar1 << (rngShiftB & 0x1f) ^ uVar1; - uVar1 = uVar1 >> 6 ^ uVar1; - fVar6 = (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) * - 2.3283062e-10 * 60.0 + 20.0; - *GHIDRA_CAST((this->_outputGroupCallbacks + updatesLeft * 0x18 + 0x90)) = - fVar6 * (fVar3 * fVar5 + fVar2 * fVar4); - *GHIDRA_CAST((this->_outputGroupCallbacks + updatesLeft * 0x18 + 0x8c)) = - fVar6 * (fVar2 * fVar5 - fVar3 * fVar4); - this->_numRainSpawners = this->_numRainSpawners + 1; - spawnersLeft = spawnersLeft - 1; - } - attempt = attempt + 1; - } while (attempt < 10); - updatesLeft = 10; - do { - update_ambient_spawns(this); - updatesLeft = updatesLeft + -1; - } while (updatesLeft != 0); - } - return; -} - -// 00824800 -void Room::update_ambient_spawns() -{ - uint32_t rngResult; - Entity *rainDrop; - int iVar1; - float *rainSpawner; - float radiusRoll; - float cosOffset; - float fVar2; - Vector spawnPos; - Vector clampedPos; - - if ((0 < this->_numRainSpawners) && (fVar2 = this->_rainIntensity, 0.0 < fVar2)) { - if (this->_isRainStopped != 0) { - fVar2 = fVar2 - 0.02; - if (fVar2 <= 0.0) { - fVar2 = 0.0; - } - this->_rainIntensity = fVar2; - } - if (fVar2 < 0.01) { - this->_rainIntensity = 0.0; - return; - } - fVar2 = GetTimeScale(this,GHIDRA_CAST(this),GHIDRA_CAST(0x0)); - iVar1 = GHIDRA_INT((1.0 / (fVar2 * this->_rainIntensity))); - if (((iVar1 == 0) || (g_game->_frameCount % iVar1 < 1)) && - (iVar1 = 0, 0 < this->_numRainSpawners)) { - rainSpawner = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x7408)))); - do { - rngResult = Random(); - fVar2 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) - * 2.3283064e-10 * 3.14; - fVar2 = fVar2 + fVar2; - rngResult = Random(); - radiusRoll = (float)((double)GHIDRA_INT(rngResult) + - __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10; - cosOffset = cos(fVar2); - cosOffset = cosOffset * radiusRoll; - fVar2 = sin(fVar2); - fVar2 = fVar2 * radiusRoll; - spawnPos.x = cosOffset * rainSpawner[-3] + rainSpawner[-5] + fVar2 * rainSpawner[-1]; - spawnPos.y = cosOffset * rainSpawner[-2] + rainSpawner[-4] + fVar2 * *rainSpawner; - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)) - 9U < 4) { - GetClampedPositionImpl(this,&clampedPos,&spawnPos,0.0,0.0,0.0,0.0); - if ((clampedPos.x == spawnPos.x) && (clampedPos.y == spawnPos.y)) { -LAB_00824a1f: - rngResult = Random(); - rainDrop = Game::SpawnEx(g_game,1000,0x87,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0, - rngResult,0); - rainDrop->Update(); - } - } - else if ((((this->_topLeftPos).x + 0.0 <= spawnPos.x) && - (spawnPos.x <= (this->_bottomRightPos).x - 0.0)) && - (((this->_topLeftPos).y + 0.0 <= spawnPos.y && - (spawnPos.y <= (this->_bottomRightPos).y - 0.0)))) goto LAB_00824a1f; - iVar1 = iVar1 + 1; - rainSpawner = rainSpawner + 6; - } while (iVar1 < this->_numRainSpawners); - } - } - return; -} - -// 00824a70 -uint32_t Room::update_ambient_effects() -{ - double dVar1; - uint8_t bVar2; - uint32_t stageId; - uint32_t uVar3; - uint32_t uVar4; - Entity *particle; - void *idleAnimData; - LayerState *layer; - Game *pGVar5; - float spawnTop; - int framesSinceEnter; - int remainingSpawns; - Vector spawnPos; - Vector velocity; - ColorMod particleColor; - int backdropType; - Game *game; - ANM2 *particleSprite; - float roomBottom; - float roomLeft; - float roomRight; - - game = g_game; - if (g_game->_challenge == 0x2c) { - stageId = Level::GetRoomStageType(GHIDRA_CAST(g_game),g_game->_currentRoomIdx); -LAB_00824abd: - pGVar5 = g_game; - stageId = RoomConfig::GetStageID(game->_stage,stageId,-1); - if ((stageId != 0x21) && (stageId != 0x1c)) goto LAB_00824ad7; - } - else { - if (g_game->_currentDimensionIdx != 2) { - stageId = g_game->_stageType; - goto LAB_00824abd; - } - stageId = 0x23; - pGVar5 = g_game; -LAB_00824ad7: - if (((this->_roomType != 5) || (this->_bossId != 0x5b)) && (pGVar5->_currentRoomIdx != -0x10)) { - bVar2 = Level::HasAbandonedMineshaft(GHIDRA_CAST(pGVar5)); - pGVar5 = g_game; - if (((bVar2 == 0) || (g_game->_currentDimensionIdx != 1)) && - (g_game->_currentDimensionIdx == 0)) { - return GHIDRA_UINT(bVar2); - } - } - } - if (*GHIDRA_CAST(this) == '\0') { - framesSinceEnter = -1; - } - else { - framesSinceEnter = pGVar5->_frameCount - this->_enterFrame; - if (framesSinceEnter == 0) goto LAB_00824b4c; - } - if (pGVar5->_frameCount % 0xd2 != 0) { - return pGVar5->_frameCount / 0xd2; - } -LAB_00824b4c: - roomRight = (this->_bottomRightPos).x; - roomBottom = (this->_bottomRightPos).y; - spawnTop = (this->_topLeftPos).y - 40.0; - roomLeft = (this->_topLeftPos).x; - remainingSpawns = GHIDRA_UINT((framesSinceEnter == 0)) * 4 + 1; - do { - uVar3 = Random(); - dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]; - uVar4 = Random(); - spawnPos.x = ((roomRight + 500.0) - roomLeft) * - (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283064e-10 + roomLeft; - if (framesSinceEnter != 0) { - spawnPos.x = roomRight + 600.0; - } - spawnPos.y = ((roomBottom + 40.0) - spawnTop) * - (float)((double)GHIDRA_INT(uVar3) + dVar1) * 2.3283064e-10 + spawnTop; - uVar3 = Random(); - velocity.y = 0.0; - velocity.x = -0.25 - (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) - * 2.3283064e-10 * 0.5; - uVar3 = Random(); - particle = Game::SpawnEx(g_game,1000,0x8a,&spawnPos,&velocity,GHIDRA_CAST(0x0),0,uVar3,0); - particleSprite = &particle->_sprite; - idleAnimData = ANM2::GetAnimationData(particleSprite,s_Idle); - uVar3 = *GHIDRA_CAST((GHIDRA_CAST(idleAnimData) + 0x30)); - uVar4 = 0; - if (uVar3 != 0) { - uVar4 = Random(); - uVar4 = uVar4 % uVar3; - } - bVar2 = ANM2::SetAnimation(particleSprite,s_Idle,1); - if (((bVar2 != 0) && ((particle->_sprite)._animState._animData != (void *)0x0)) && - (AnimationState::SetFrameFloat(&(particle->_sprite)._animState,(float)GHIDRA_INT(uVar4)), - (particle->_sprite)._animState._animData != (void *)0x0)) { - (particle->_sprite)._animState._isPlaying = 0; - } - uVar3 = Random(); - (particle->_sprite)._flipX = (uint8_t)uVar3 & 1; - uVar3 = Random(); - particleColor._offset[0] = 0.0; - (particle->_sprite)._flipY = (uint8_t)uVar3 & 1; - particleColor._offset[1] = 0.0; - particleColor._offset[2] = 0.0; - if (stageId == 0x1b) { - particleColor._tint[0] = 0.87843144; - particleColor._tint[1] = 0.9607844; - particleColor._tint[2] = 0.97647065; - } - else { - backdropType = this->_backdropType; - if ((backdropType == 0x2c) || (backdropType == 0x2b)) { - particleColor._tint[0] = 0.54901963; - particleColor._tint[1] = 0.16470589; - particleColor._tint[2] = 0.16470589; - } - else if (backdropType == 0xd) { - particleColor._tint[0] = 0.83921576; - particleColor._tint[1] = 0.9176471; - particleColor._tint[2] = 0.97647065; - } - else if (stageId == 0x1c) { - particleColor._tint[0] = 0.21960786; - particleColor._tint[1] = 0.27450982; - particleColor._tint[2] = 0.08627451; - } - else if ((stageId == 0x1d) || (stageId == 0x1e)) { - particleColor._tint[0] = 0.3921569; - particleColor._tint[1] = 0.3137255; - particleColor._tint[2] = 0.50980395; - } - else if (g_game->_currentDimensionIdx == 2) { - particleColor._tint[0] = 0.47058827; - particleColor._tint[1] = 0.47058827; - particleColor._tint[2] = 0.47058827; - } - else { - particleColor._tint[0] = 0.43921572; - particleColor._tint[1] = 0.54901963; - particleColor._tint[2] = 0.1764706; - } - } - uVar3 = Random(); - particleColor._tint[3] = - (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 - * 0.3 + 0.7; - layer = ANM2::GetLayer(particleSprite,GHIDRA_CAST(0x0)); - if (&layer->_color != &particleColor) { - (layer->_color)._tint[0] = particleColor._tint[0]; - (layer->_color)._tint[1] = particleColor._tint[1]; - (layer->_color)._tint[2] = particleColor._tint[2]; - (layer->_color)._tint[3] = particleColor._tint[3]; - (layer->_color)._colorize[0] = 0.0; - (layer->_color)._colorize[1] = 0.0; - (layer->_color)._colorize[2] = 0.0; - (layer->_color)._colorize[3] = 0.0; - *GHIDRA_CAST((layer->_color)._offset) = - CONCAT44(particleColor._offset[1],particleColor._offset[0]); - (layer->_color)._offset[2] = particleColor._offset[2]; - } - uVar3 = particle->Update(); - remainingSpawns = remainingSpawns + -1; - } while (remainingSpawns != 0); - return uVar3; -} - -// 00824ee0 -void Room::update_water_current() -{ - uint8_t bVar1; - uint32_t uVar2; - uint32_t rngValue; - Entity *splash; - int iVar3; - Entity *pEVar4; - int framesInRoom; - int iVar5; - float fVar6; - float fVar7; - float fVar8; - float fVar9; - float fVar10; - float fVar11; - uint32_t entityIndex; - int gridIndex; - void **local_40; - Vector local_38; - Vector local_30; - Vector gridPos; - Vector clampedPos; - Vector splashVelocity; - Vector splashPos; - Game *game; - - if (((this->_waterCurrent).x != g_vectorZero.x) || ((this->_waterCurrent).y != g_vectorZero.y)) { - entityIndex = 0; - if ((this->_entityList)._updateEL._size != 0) { - do { - pEVar4 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_entityList)._updateEL)) + 0x4)))) + entityIndex * 4)); - framesInRoom = pEVar4->_type; - if (framesInRoom == 5) { - if (pEVar4->_entityCollisionClass != 0) { -LAB_00824f78: - if ((pEVar4->_entityGridCollisionClass == 5) || (pEVar4->_entityGridCollisionClass == 6) - ) { - fVar9 = (this->_waterCurrent).y; - (pEVar4->_velocity).x = (this->_waterCurrent).x * 0.4 + (pEVar4->_velocity).x; - (pEVar4->_velocity).y = fVar9 * 0.4 + (pEVar4->_velocity).y; - game = g_game; - if ((((pEVar4->_flags & 0x4000) == 0) && - ((bVar1 = Game::IsPaused(g_game), bVar1 == 0 && (game->_frameCount % 3 == 0)))) && - ((pEVar4->_type == 1 || (pEVar4->_type - 10U < 0x3de)))) { - uVar2 = Random(); - for (framesInRoom = uVar2 % 3 + 2; framesInRoom != 0; - framesInRoom = framesInRoom + -1) { - fVar9 = (pEVar4->_pos).x; - fVar11 = (pEVar4->_pos).y; - uVar2 = Random(); - fVar6 = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)] - ) * 2.3283064e-10 * 3.14; - fVar6 = fVar6 + fVar6; - fVar10 = pEVar4->_size; - uVar2 = Random(); - fVar7 = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)] - ) * 2.3283064e-10; - fVar8 = cos(fVar6); - local_38.x = fVar8 * fVar10 * fVar7 + fVar9; - fVar9 = sin(fVar6); - local_38.y = fVar9 * fVar10 * fVar7 + fVar11; - uVar2 = Random(); - rngValue = Random(); - fVar10 = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * 2.3283064e-10 - * 6.0 + 4.0; - fVar9 = (this->_waterCurrent).x; - fVar11 = (this->_waterCurrent).y; - rngValue = Random(); - fVar6 = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * 2.3283064e-10 * - 3.14; - fVar6 = fVar6 + fVar6; - local_30.x = cos(fVar6); - local_30.x = local_30.x + fVar9 * fVar10; - local_30.y = sin(fVar6); - local_30.y = local_30.y + fVar11 * fVar10; - splash = Game::SpawnEx(g_game,1000,99,&local_38,&local_30,pEVar4,1,uVar2,0); - splash->Update(); - } - } - } - } - } - else if (((framesInRoom == 1) || (framesInRoom - 10U < 0x3de)) || (framesInRoom == 4)) - goto LAB_00824f78; - entityIndex = entityIndex + 1; - } while (entityIndex < GHIDRA_UINT((this->_entityList)._updateEL._size)); - } - if ((*GHIDRA_CAST(this) != '\0') && - (framesInRoom = g_game->_frameCount - this->_enterFrame, - framesInRoom == (framesInRoom / 3) * 3)) { - framesInRoom = this->_gridWidth * this->_gridHeight; - fVar9 = (this->_waterCurrent).x * 40.0; - fVar11 = (this->_waterCurrent).y * 40.0; - gridIndex = 0; - if (0 < framesInRoom) { - local_40 = this->_gridEntities; - do { - if ((*local_40 != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_INT(*local_40) + 4)) == 0xf)) { - fVar6 = (float)(gridIndex % this->_gridWidth) * 40.0 + 40.0 + fVar9; - fVar10 = (float)(gridIndex / this->_gridWidth) * 40.0 + 120.0 + fVar11; - gridPos.x = fVar6; - gridPos.y = fVar10; - if (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x48)) - 9U < 4) { - GetClampedPositionImpl(this,&clampedPos,&gridPos,0.0,0.0,0.0,0.0); - if ((clampedPos.x == fVar6) && (clampedPos.y == fVar10)) { -LAB_0082540c: - iVar5 = GHIDRA_INT(((fVar6 - 40.0) / 40.0 + 0.5)); - iVar3 = GHIDRA_INT(((fVar10 - 120.0) / 40.0 + 0.5)); - if (((iVar5 < 0) || ((this->_gridWidth <= iVar5 || (iVar3 < 0)))) || - (this->_gridHeight <= iVar3)) { - iVar5 = -1; - } - else { - iVar5 = iVar3 * this->_gridWidth + iVar5; - } - uVar2 = GetGridCollision(this,iVar5); - if (GHIDRA_INT(uVar2) < 2) { - uVar2 = Random(); - for (iVar3 = uVar2 % 3 + 2; iVar3 != 0; iVar3 = iVar3 + -1) { - uVar2 = Random(); - rngValue = Random(); - fVar8 = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * 2.3283064e-10 - * 6.0 + 4.0; - fVar7 = (this->_waterCurrent).x; - local_30.x = (this->_waterCurrent).y; - rngValue = Random(); - local_38.x = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - local_38.x = local_38.x + local_38.x; - splashVelocity.x = cos(local_38.x); - splashVelocity.x = splashVelocity.x + fVar7 * fVar8; - splashVelocity.y = sin(local_38.x); - splashVelocity.y = splashVelocity.y + local_30.x * fVar8; - rngValue = Random(); - local_30.x = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * - 2.3283064e-10 - 0.5; - local_38.x = (this->_waterCurrent).x; - fVar7 = (this->_waterCurrent).y; - rngValue = Random(); - fVar8 = (float)((double)GHIDRA_INT(rngValue) + - __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * 2.3283064e-10 - ; - splashPos.x = local_30.x * fVar11 + (fVar6 - fVar9 * 0.54) + - local_38.x * 3.0 * fVar8; - splashPos.y = local_30.x * fVar9 + (fVar10 - fVar11 * 0.54) + - fVar7 * 3.0 * fVar8; - pEVar4 = Game::SpawnEx(g_game,1000,99,&splashPos,&splashVelocity,GHIDRA_CAST(0x0),1 - ,uVar2,0); - fVar7 = (pEVar4->_sprite)._scale.x; - fVar8 = (pEVar4->_sprite)._scale.y; - iVar5 = *GHIDRA_CAST(pEVar4); - (pEVar4->_sprite)._scale.x = fVar7 + fVar7; - (pEVar4->_sprite)._scale.y = fVar8 + fVar8; - (**(code **)(iVar5 + 0xc))(); - } - } - } - } - else if (((((this->_topLeftPos).x + 0.0 <= fVar6) && - (fVar6 <= (this->_bottomRightPos).x - 0.0)) && - ((this->_topLeftPos).y + 0.0 <= fVar10)) && - (fVar10 <= (this->_bottomRightPos).y - 0.0)) goto LAB_0082540c; - } - gridIndex = gridIndex + 1; - local_40 = local_40 + 1; - } while (gridIndex < framesInRoom); - } - } - } - return; -} - -// 00825730 -uint8_t Room::CanPickupGridEntity(int GridIndex) -{ - void *gridEntity; - int gridType; - - if (0x1bf < GHIDRA_UINT(GridIndex)) { - return 0; - } - gridEntity = this->_gridEntities[GridIndex]; - if (gridEntity == (void *)0x0) { - return 0; - } - if (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0x3c)) == 0) { - return 0; - } - gridType = *GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)); - if (((((gridType == 2) || (gridType == 4)) || (gridType == 5)) || - ((gridType == 6 || (gridType == 0x1a)))) || ((gridType == 0x16 || (gridType == 0x1b)))) { - return 1; - } - if (gridType == 0xc) { - if (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xc)) < 4) { - return 1; - } - } - else if ((gridType == 0xe) && (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 0xc)) != 1000)) { - return 1; - } - return 0; -} - -// 008257a0 -uint8_t Room::spawn_grid_from_desc(uint32_t gridIndex, GridEntityDesc *outDesc, ANM2 *outSprite) -{ - int iVar1; - int iVar2; - uint32_t uVar3; - ANM2 other; - Room *pRVar4; - void **ppvVar5; - uint8_t isLadderSpawned; - GridEntity_Poop *gigaPart; - GridEntity *decoration; - uint32_t flyGridIndex; - int listData; - Room *pRVar6; - GridEntity_Poop *pGVar7; - uint32_t uVar8; - ANM2 aAStackY_8c7c [128]; - uint8_t in_stack_fffffe98 [248]; - float in_stack_ffffff90; - float in_stack_ffffff94; - uint32_t in_stack_ffffff98; - float in_stack_ffffff9c; - uint32_t in_stack_ffffffa0; - int in_stack_ffffffa4; - int in_stack_ffffffa8; - EntityList_EL flies; - GridEntity *allocatedGrid; - uint32_t spawnSeed; - GridEntity_Poop *local_30; - int partVariant; - Room *room; - char isRock; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - GridEntity_Poop *gigaGridIndex; - int *eternalFly; - uint32_t *oldGrid; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00b01993; - local_1c = ExceptionList; - if (0x1bf < gridIndex) { - return 0; - } - pGVar7 = this->_gridEntities[gridIndex]; - if (pGVar7 == GHIDRA_CAST(0x0)) { - return 0; - } - if (pGVar7->_collisionClass == 0) { - return 0; - } - listData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x4)))); - isRock = '\0'; - local_30 = pGVar7; - room = this; - if (((((listData == 2) || (listData == 4)) || (listData == 5)) || - ((listData == 6 || (listData == 0x16)))) || - ((listData == 0x19 || ((listData == 0x1a || (listData == 0x1b)))))) { - ExceptionList = &local_1c; - (GHIDRA_CAST((GHIDRA_CAST(pGVar7))))->GridEntity_Rock::TrySpawnWorms(); - if ((999 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x8))))) && (-1 < GHIDRA_INT((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x8)))) - 1000)))) { - (GHIDRA_CAST((GHIDRA_CAST(pGVar7))))->GridEntity_Rock::UpdateNeighbors(); - in_stack_ffffffa4 = 0x82588a; - (GHIDRA_CAST((GHIDRA_CAST(pGVar7))))->GridEntity_Rock::SetBigRockFrame(); - } - in_stack_ffffffa8 = 0x825892; - grid_mark_neighbors_dirty(pGVar7->_gridIndex); - isRock = '\x01'; - ppvVar5 = ExceptionList; - } - else { - ppvVar5 = &local_1c; - if (listData == 0xc) { - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - if (3 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0xc))))) { - return 0; - } - } - else { - if (listData != 0xe) { - return 0; - } - puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0xc)))) == 1000) { - return 0; - } - } - } - ExceptionList = ppvVar5; - if (outSprite != GHIDRA_CAST(0x0)) { - ANM2::ANM2(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x168)),&pGVar7->_sprite); - other._championColor._offset[1] = in_stack_ffffff90; - other._filename._buf[0] = in_stack_fffffe98[0]; - other._filename._buf[1] = in_stack_fffffe98[1]; - other._filename._buf[2] = in_stack_fffffe98[2]; - other._filename._buf[3] = in_stack_fffffe98[3]; - other._filename._buf[4] = in_stack_fffffe98[4]; - other._filename._buf[5] = in_stack_fffffe98[5]; - other._filename._buf[6] = in_stack_fffffe98[6]; - other._filename._buf[7] = in_stack_fffffe98[7]; - other._filename._buf[8] = in_stack_fffffe98[8]; - other._filename._buf[9] = in_stack_fffffe98[9]; - other._filename._buf[10] = in_stack_fffffe98[10]; - other._filename._buf[0xb] = in_stack_fffffe98[0xb]; - other._filename._buf[0xc] = in_stack_fffffe98[0xc]; - other._filename._buf[0xd] = in_stack_fffffe98[0xd]; - other._filename._buf[0xe] = in_stack_fffffe98[0xe]; - other._filename._buf[0xf] = in_stack_fffffe98[0xf]; - other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x10))); - other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x14))); - other._animDefaultName._buf[0] = in_stack_fffffe98[0x18]; - other._animDefaultName._buf[1] = in_stack_fffffe98[0x19]; - other._animDefaultName._buf[2] = in_stack_fffffe98[0x1a]; - other._animDefaultName._buf[3] = in_stack_fffffe98[0x1b]; - other._animDefaultName._buf[4] = in_stack_fffffe98[0x1c]; - other._animDefaultName._buf[5] = in_stack_fffffe98[0x1d]; - other._animDefaultName._buf[6] = in_stack_fffffe98[0x1e]; - other._animDefaultName._buf[7] = in_stack_fffffe98[0x1f]; - other._animDefaultName._buf[8] = in_stack_fffffe98[0x20]; - other._animDefaultName._buf[9] = in_stack_fffffe98[0x21]; - other._animDefaultName._buf[10] = in_stack_fffffe98[0x22]; - other._animDefaultName._buf[0xb] = in_stack_fffffe98[0x23]; - other._animDefaultName._buf[0xc] = in_stack_fffffe98[0x24]; - other._animDefaultName._buf[0xd] = in_stack_fffffe98[0x25]; - other._animDefaultName._buf[0xe] = in_stack_fffffe98[0x26]; - other._animDefaultName._buf[0xf] = in_stack_fffffe98[0x27]; - other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x28))); - other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x2c))); - other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x30))); - other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x34))); - other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x38))); - other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x3c))); - other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0x40))); - other._animState._isPlaying = in_stack_fffffe98[0x44]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x45))); - other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x48))); - other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x4c))); - other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x50))); - other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x54))); - other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x58))); - other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x5c))); - other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0x60))); - other._overlayAnimState._isPlaying = in_stack_fffffe98[100]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x65))); - other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x68))); - other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x6c))); - other._overlayRenderFirst = in_stack_fffffe98[0x70]; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x71))); - other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x74))); - other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x78))); - other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x7c))); - other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x80))); - other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x84))); - other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x88))); - other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe98)) + 0x8c))); - other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe98)) + 0x90))); - other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0x94))); - other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0x98))); - other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0x9c))); - other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xa0))); - other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xa4))); - other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xa8))); - other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xac))); - other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xb0))); - other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xb4))); - other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xb8))); - other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xbc))); - other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xc0))); - other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xc4))); - other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xc8))); - other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xcc))); - other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xd0))); - other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xd4))); - other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xd8))); - other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xdc))); - other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xe0))); - other._championColor._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xe4))); - other._championColor._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xe8))); - other._championColor._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xec))); - other._championColor._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xf0))); - other._championColor._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe98)) + 0xf4))); - other._championColor._offset[2] = in_stack_ffffff94; - other._flipX = (uint8_t)in_stack_ffffff98; - other._flipY = SUB41(in_stack_ffffff98,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x102))) = SUB42(in_stack_ffffff98,2); - other._playbackSpeed = in_stack_ffffff9c; - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = (char)in_stack_ffffffa0; - other._loaded = SUB41(in_stack_ffffffa0,1); - (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x10a))) = SUB42(in_stack_ffffffa0,2); - other._shadowLayerIndex = in_stack_ffffffa4; - other._bitflags = in_stack_ffffffa8; - ANM2::operator_assign(outSprite,other); - } - if (outDesc != GHIDRA_CAST(0x0)) { - listData = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x8)))); - iVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0xc)))); - iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x10)))); - outDesc->_type = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x4)))); - outDesc->_variant = listData; - outDesc->_state = iVar1; - outDesc->_spawnCount = iVar2; - listData = pGVar7->_varData; - uVar3 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x1c)))); - iVar1 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x20)))); - outDesc->_spawnSeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x14)))); - outDesc->_varData = listData; - *GHIDRA_CAST(&outDesc->_initialized) = uVar3; - outDesc->_variableSeed = iVar1; - } - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x4)))) == 0xe) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x8)))) - 7U < 4)) { - if (outDesc != GHIDRA_CAST(0x0)) { - outDesc->_variant = 7; - } - partVariant = 7; - pRVar6 = room; - do { - listData = partVariant; - if (partVariant != *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x8))))) { - gigaPart = (GHIDRA_CAST((pGVar7)))->GridEntity_Poop::get_giga_part(partVariant,0); - if (gigaPart != GHIDRA_CAST(0x0)) { - uVar8 = gigaPart->_gridIndex; - spawnSeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((gigaPart)) + 0x14)))); - if ((uVar8 < 0x1c0) && - (oldGrid = room->_gridEntities[uVar8], oldGrid != GHIDRA_CAST(0x0))) { - room->_gridPaths[uVar8] = 0; - room->_gridEntities[uVar8] = (void *)0x0; - (**(code **)*oldGrid)(); - } - if ((GHIDRA_INT(uVar8) < 0) || (0x1bf < GHIDRA_INT(uVar8))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if ((0x1bf < uVar8) || (900 < room->_gridPaths[uVar8])) { - pRVar6 = room; - goto LAB_00825a05; - } - decoration = operator_new(0x154); - local_14 = 0; - allocatedGrid = decoration; - if (decoration == GHIDRA_CAST(0x0)) { - decoration = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((decoration)))->GridEntity::GridEntity(); - *GHIDRA_CAST(decoration) = IsaacRepentancePlus::GridEntity_Decoration::vftable; - } - pRVar6 = room; - local_14 = 0xffffffff; - if (decoration != GHIDRA_CAST(0x0)) { - decoration->_gridIndex = uVar8; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((decoration)) + 0x4)))) = 1; - if (room->_gridEntities[uVar8] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(room->_gridEntities[uVar8]))(); - } - pRVar6->_gridEntities[uVar8] = decoration; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((decoration)) + 0x8)))) = 1000; - decoration->_varData = 0; - (GHIDRA_CAST((decoration)))->GridEntity::Init(spawnSeed); - } - pGVar7 = local_30; - listData = partVariant; - } - pRVar6 = room; - partVariant = listData; - } -LAB_00825a05: - partVariant = partVariant + 1; - } while (partVariant < 0xb); - gigaGridIndex = GHIDRA_CAST(pGVar7->_gridIndex); - spawnSeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x14)))); - local_30 = gigaGridIndex; - if ((gigaGridIndex < GHIDRA_CAST(0x1c0)) && - (oldGrid = pRVar6->_gridEntities[GHIDRA_INT(gigaGridIndex)], oldGrid != GHIDRA_CAST(0x0))) { - pRVar6->_gridPaths[GHIDRA_INT(gigaGridIndex)] = 0; - pRVar6->_gridEntities[GHIDRA_INT(gigaGridIndex)] = (void *)0x0; - (**(code **)*oldGrid)(); - } - if ((GHIDRA_INT(gigaGridIndex) < 0) || (0x1bf < GHIDRA_INT(gigaGridIndex))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - pRVar6 = room; - if ((GHIDRA_CAST(0x1bf) < gigaGridIndex) || (900 < room->_gridPaths[GHIDRA_INT(local_30)])) - goto LAB_00825b02; - decoration = operator_new(0x154); - local_14 = 0x17; - allocatedGrid = decoration; - if (decoration == GHIDRA_CAST(0x0)) { - decoration = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((decoration)))->GridEntity::GridEntity(); - *GHIDRA_CAST(decoration) = IsaacRepentancePlus::GridEntity_Decoration::vftable; - } - pRVar4 = room; - pGVar7 = local_30; - local_14 = 0xffffffff; - if (decoration == GHIDRA_CAST(0x0)) goto LAB_00825b02; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((decoration)) + 0x4)))) = 1; - decoration->_gridIndex = GHIDRA_INT(local_30); - if (room->_gridEntities[GHIDRA_INT(local_30)] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(room->_gridEntities[GHIDRA_INT(local_30)]))(); - } - pRVar4->_gridEntities[GHIDRA_INT(pGVar7)] = decoration; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((decoration)) + 0x8)))) = 1000; - decoration->_varData = 0; - (GHIDRA_CAST((decoration)))->GridEntity::Init(spawnSeed); - } - else if ((isRock == '\0') || - (isLadderSpawned = (GHIDRA_CAST((GHIDRA_CAST(pGVar7))))->GridEntity_Rock::TrySpawnLadder(), - isLadderSpawned == 0)) { - spawnSeed = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pGVar7)) + 0x14)))); - room->_gridPaths[gridIndex] = 0; - room->_gridEntities[gridIndex] = (void *)0x0; - (*(code *)**GHIDRA_CAST(pGVar7))(); - pRVar6 = room; - if (room->_gridPaths[gridIndex] < 0x385) { - decoration = operator_new(0x154); - local_14 = 0x2e; - allocatedGrid = decoration; - if (decoration == GHIDRA_CAST(0x0)) { - decoration = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((decoration)))->GridEntity::GridEntity(); - *GHIDRA_CAST(decoration) = IsaacRepentancePlus::GridEntity_Decoration::vftable; - } - local_14 = 0xffffffff; - if (decoration != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((decoration)) + 0x4)))) = 1; - decoration->_gridIndex = gridIndex; - if (pRVar6->_gridEntities[gridIndex] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(pRVar6->_gridEntities[gridIndex]))(); - } - pRVar6->_gridEntities[gridIndex] = decoration; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((decoration)) + 0x8)))) = 1000; - decoration->_varData = 0; - (GHIDRA_CAST((decoration)))->GridEntity::Init(spawnSeed); - } - } - goto LAB_00825b02; - } - pRVar6 = room; -LAB_00825b02: - EntityList::QuerySublist(&pRVar6->_entityList,&flies,0x60,-1,-1,0,0); - uVar8 = 0; - local_14 = 0x45; - if (flies._size != 0) { - listData = (*GHIDRA_CAST((GHIDRA_CAST(&(flies)) + 0x4))); - do { - eternalFly = *GHIDRA_CAST((listData + uVar8 * 4)); - if (eternalFly[0xef] == 0) { - flyGridIndex = GetGridIndex(room,GHIDRA_CAST((eternalFly + 0xcd))); - if (flyGridIndex == gridIndex) { - eternalFly[0x2d9] = 0x10; - (**(code **)(*eternalFly + 0xc))(); - } - listData = (*GHIDRA_CAST((GHIDRA_CAST(&(flies)) + 0x4))); - } - uVar8 = uVar8 + 1; - } while (uVar8 < GHIDRA_UINT(flies._size)); - } - (GHIDRA_CAST((&flies)))->EntityList_Query::~EntityList_Query(); - ExceptionList = local_1c; - return 1; -} - -// 00825c50 -Entity_Effect * Room::PickupGridEntity(int GridIndex) -{ - uint8_t isSpawned; - uint32_t seed; - Entity_Effect *pickupEffect; - GridEntityDesc gridDesc; - ANM2 gridSprite; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - - puStack_20 = GHIDRA_CAST(&(&gridSprite)[1]._animDefaultName._size); - local_14 = 0xffffffff; - puStack_18 = &LAB_00b019c0; - local_1c = ExceptionList; - local_24 = __security_cookie ^ GHIDRA_UINT(((&gridSprite)[1]._animDefaultName._buf + 4)); - ExceptionList = &local_1c; - gridDesc._type = 0; - gridDesc._variant = 0; - gridDesc._state = 0; - gridDesc._spawnCount = 0; - gridDesc._spawnSeed = 0x16a9de81; - gridDesc._varData = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(gridDesc)) + 0x18))) = (*GHIDRA_CAST((GHIDRA_CAST(&(gridDesc)) + 0x18))) & 0xffffff00; - gridDesc._variableSeed = 0x16a9de81; - ANM2::constructor(&gridSprite); - local_14 = 0; - isSpawned = spawn_grid_from_desc(this,GridIndex,&gridDesc,&gridSprite); - if (isSpawned == 0) { - pickupEffect = GHIDRA_CAST(0x0); - } - else { - seed = Random(); - pickupEffect = (Entity_Effect *) - Game::Spawn(g_game,1000,0x88,&g_vectorZero,&g_vectorZero,GHIDRA_CAST(0x0),0,seed); - Isaac::SwapANM2(&gridSprite,&pickupEffect->_sprite); - *GHIDRA_CAST(&(pickupEffect->_varData)._l) = gridDesc._type; - *GHIDRA_CAST((GHIDRA_INT(&(pickupEffect->_varData)._l) + 4)) = gridDesc._variant; - *GHIDRA_CAST(&(pickupEffect->_varData)._h) = gridDesc._state; - *GHIDRA_CAST((GHIDRA_INT(&(pickupEffect->_varData)._h) + 4)) = gridDesc._spawnCount; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pickupEffect)) + 0x430)))) = gridDesc._spawnSeed; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pickupEffect)) + 0x434)))) = gridDesc._varData; - (*GHIDRA_CAST((GHIDRA_CAST((pickupEffect)) + 0x438))) = gridDesc._initialized; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pickupEffect)) + 0x439)))) = (*GHIDRA_CAST((GHIDRA_CAST(&(gridDesc)) + 0x19))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pickupEffect)) + 0x43c)))) = gridDesc._variableSeed; - pickupEffect->_state = this->_backdropType; - } - local_14 = 1; - ANM2::Reset(&gridSprite); - AnimationState::~AnimationState(&gridSprite._overlayAnimState); - AnimationState::~AnimationState(&gridSprite._animState); - (GHIDRA_CAST((gridSprite._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&gridSprite))))->msvc::string::_Tidy_deallocate(); - ExceptionList = local_1c; - return pickupEffect; -} - -// 00825de0 -void Room::render_darkness_overlay() -{ - code *pcVar1; - char isOverlayEnabled; - uint8_t bVar2; - uint32_t *renderTargetEntry; - int iVar3; - uint32_t uVar4; - uint8_t *shader; - void *pvVar5; - uint32_t preventedCurses; - uint8_t rngShift2; - uint8_t rngShift3; - KColor *color; - int unusedArg; - int unused; - int iVar6; - uint32_t uVar7; - bool isLightSkipped; - float fVar8; - float fVar9; - uint8_t auVar10 [12]; - float fVar11; - double dVar12; - uint8_t auStackY_230 [128]; - void *imageRefCount; - uint8_t lightQuad [112]; - uint8_t screenQuad [32]; - uint32_t local_108; - uint32_t uStack_104; - uint32_t uStack_100; - float fStack_fc; - uint32_t local_f8; - uint32_t local_f4; - uint32_t uStack_f0; - uint32_t uStack_ec; - float fStack_e8; - uint32_t local_e4; - uint32_t local_e0; - uint32_t uStack_dc; - uint32_t uStack_d8; - float fStack_d4; - uint32_t local_d0; - uint32_t local_cc; - uint32_t uStack_c8; - uint32_t uStack_c4; - float fStack_c0; - uint32_t local_bc; - KColor quadColor; - Vector local_a4; - Vector local_9c; - float local_94; - float fStack_90; - float fStack_8c; - float fStack_88; - float local_84; - float fStack_80; - float fStack_7c; - float fStack_78; - float local_74; - Vector local_70; - KColor local_68; - float local_54; - float local_50; - Room *local_4c; - float local_48; - uint32_t *local_44; - ColorMod local_40; - float local_14; - uint32_t curses; - Game *game; - Room *room; - - local_14 = (float)(__security_cookie ^ GHIDRA_UINT(((&local_40)[1]._tint + 1))); - local_4c = this; - isOverlayEnabled = FUN_008242f0(); - if (isOverlayEnabled != '\0') { - (GHIDRA_CAST((&quadColor)))->KColor::SetFromARGB(0xff000000); - render_quad_set_uniform_color(screenQuad,0.0,0.0,g_screenWidth,g_screenHeight,color); - local_70.x = 0.0; - local_70.y = 0.0; - msvc::vector::resize(&local_70); - renderTargetEntry = msvc::deque::back(); - if (GHIDRA_CAST((renderTargetEntry + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((renderTargetEntry + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *renderTargetEntry = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c7982c,1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - render_color_shader_pass(screenQuad); - game = g_game; - g_graphicsManager_blendMode[1] = 1; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - bVar2 = Game::IsPaused(g_game); - if (bVar2 == 0) { - uVar4 = g_manager->_framecount + 1U & 0x80000001; - if (GHIDRA_INT(uVar4) < 0) { - uVar4 = (uVar4 - 1 | 0xfffffffe) + 1; - } - local_54 = (float)GHIDRA_INT(uVar4) * 0.5; - } - else { - local_54 = 0.0; - } - if (*GHIDRA_CAST(local_4c) == '\0') { - iVar3 = -1; - } - else { - iVar3 = game->_frameCount - local_4c->_enterFrame; - } - uVar4 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_4c)) + 0x4)))) + 0x58)); - local_50 = 8.40779e-45; - local_54 = (float)iVar3 + local_54; - local_68._blue = 1.4013e-45; - local_68._alpha = 1.54143e-44; - local_9c.x = (float)((double)*GHIDRA_CAST((GHIDRA_CAST(DAT_00c79824) + 0x10)) + - __uint_to_double_fixup[-(*GHIDRA_CAST((GHIDRA_CAST(DAT_00c79824) + 0x10)) >> 0x1f)]); - local_9c.y = (float)((double)*GHIDRA_CAST((GHIDRA_CAST(DAT_00c79824) + 0x14)) + - __uint_to_double_fixup[-(*GHIDRA_CAST((GHIDRA_CAST(DAT_00c79824) + 0x14)) >> 0x1f)]); - local_a4.x = -((local_4c->_renderScrollOffset).x + (g_game->_screenShakeOffset).x); - local_a4.y = -((local_4c->_renderScrollOffset).y + (g_game->_screenShakeOffset).y); - quad_set_rect(local_40._tint + 2,&local_a4,&local_9c,GHIDRA_INT(DAT_00c79824)); - local_48 = 4.2039e-45; - fVar9 = 8.40779e-45; - do { - fVar11 = local_50; - local_74 = local_40._offset[2]; - local_44 = GHIDRA_CAST(DAT_00c7983c[5]); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - bVar2 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_68._blue)) + 0x0))); - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - rngShift2 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_68._alpha)) + 0x0))); - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (SUB41(fVar9,0) & 0x1f) ^ uVar4; - if (local_44 == GHIDRA_CAST(0x0)) { - uVar7 = 0; - } - else { - uVar7 = uVar4 % GHIDRA_UINT(local_44); - } - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - rngShift3 = SUB41(local_50,0); - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - fVar9 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10; - local_44 = (uint32_t *) - (((fVar9 + fVar9) - 1.0) * local_54 + - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)])); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - uVar7 = 0; - if (DAT_00c7983c[4] != 0) { - uVar7 = uVar4 % GHIDRA_UINT(DAT_00c7983c[4]); - } - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - fStack_7c = ((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10 * 3.0 + 1.0) * local_54 + - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]); - local_94 = fStack_7c + local_40._tint[2]; - fStack_90 = (float)local_44 + local_40._tint[3]; - fStack_8c = fStack_7c + local_40._colorize[0]; - fStack_88 = (float)local_44 + local_40._colorize[1]; - local_84 = fStack_7c + local_40._colorize[2]; - fStack_7c = fStack_7c + local_40._offset[0]; - fStack_80 = (float)local_44 + local_40._colorize[3]; - fStack_78 = (float)local_44 + local_40._offset[1]; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> (bVar2 & 0x1f) ^ uVar4; - quadColor._red = 1.0; - uVar4 = uVar4 << (rngShift2 & 0x1f) ^ uVar4; - quadColor._green = 1.0; - quadColor._blue = 1.0; - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - local_bc = 0; - local_d0 = 0; - local_e4 = 0; - local_f8 = 0; - fStack_fc = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10 * 4.0 + 2.0; - local_cc = 0x3f800000; - uStack_c8 = 0x3f800000; - uStack_c4 = 0x3f800000; - local_e0 = 0x3f800000; - uStack_dc = 0x3f800000; - uStack_d8 = 0x3f800000; - local_f4 = 0x3f800000; - uStack_f0 = 0x3f800000; - uStack_ec = 0x3f800000; - local_108 = 0x3f800000; - uStack_104 = 0x3f800000; - uStack_100 = 0x3f800000; - fStack_e8 = fStack_fc; - fStack_d4 = fStack_fc; - fStack_c0 = fStack_fc; - quadColor._alpha = fStack_fc; - (**(code **)(*DAT_00c7983c + 0x14))(&local_94); - local_48 = (float)(GHIDRA_INT(local_48) + -1); - fVar9 = fVar11; - } while (local_48 != 0.0); - _glfw_context_reset(); - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - renderTargetEntry = msvc::deque::back(); - KAGE_Graphics::SetRenderTarget - (&DAT_00c798e0,(void *)*renderTargetEntry,*GHIDRA_CAST((renderTargetEntry + 1))); - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } - local_70.x = 0.0; - local_70.y = 0.0; - msvc::vector::resize(&local_70); - local_44 = msvc::deque::back(); - if (GHIDRA_CAST((local_44 + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((local_44 + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *local_44 = g_graphicsManager_renderTarget; - pvVar5 = DAT_00c79824; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c79824,1); - imageRefCount = (void *)0x8263df; - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - uVar7 = g_graphicsManager_flags & 0xfffffffd; - if ((g_manager->_optionsConfig)._enableLighting != 0) { - shader = &g_shaders; - if ((DAT_00c7911c & 1) == 0) { - shader = g_currentShader; - } - g_graphicsManager_blendMode[1] = 1; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[0] = 0; - local_40._tint[0] = 1.0; - local_40._tint[1] = 1.0; - local_40._tint[2] = 1.0; - local_40._tint[3] = 1.0; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - local_40._colorize[0] = 0.5; - local_40._colorize[1] = 0.5; - local_40._colorize[2] = 0.5; - local_40._colorize[3] = (float)&DAT_bf800000; - local_40._offset[0] = -0.8; - local_40._offset[1] = -0.8; - local_40._offset[2] = -0.8; - g_currentShader = shader; - g_graphicsManager_flags = g_graphicsManager_flags & 0xfffffffd; - (GHIDRA_CAST((auStackY_230 + 0x88)))->KAGE::SmartPointer::operator_assign(&DAT_00c797cc); - apply_sprite_shader_params(&local_40,1,pvVar5,imageRefCount); - local_cc = 0x3f800000; - uStack_c8 = 0x3f800000; - uStack_c4 = 0x3f800000; - fStack_c0 = 1.0; - local_bc = 0; - local_e0 = 0x3f800000; - uStack_dc = 0x3f800000; - uStack_d8 = 0x3f800000; - fStack_d4 = 1.0; - local_d0 = 0; - local_f4 = 0x3f800000; - uStack_f0 = 0x3f800000; - uStack_ec = 0x3f800000; - fStack_e8 = 1.0; - local_e4 = 0; - local_108 = 0x3f800000; - uStack_104 = 0x3f800000; - uStack_100 = 0x3f800000; - fStack_fc = 1.0; - local_f8 = 0; - (**(code **)(*DAT_00c797cc + 0x1c))(); - shader_cache_find(unusedArg); - uVar7 = g_graphicsManager_flags; - } - g_graphicsManager_flags = uVar7; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[2] = 1; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 1; - local_cc = 0x3d4ccccd; - uStack_c8 = 0x3d4ccccd; - uStack_c4 = 0x3d4ccccd; - fStack_c0 = 1.0; - local_bc = 0; - local_e0 = 0x3d4ccccd; - uStack_dc = 0x3d4ccccd; - uStack_d8 = 0x3d4ccccd; - fStack_d4 = 1.0; - local_d0 = 0; - local_f4 = 0x3d4ccccd; - uStack_f0 = 0x3d4ccccd; - uStack_ec = 0x3d4ccccd; - fStack_e8 = 1.0; - local_e4 = 0; - local_108 = 0x3d4ccccd; - uStack_104 = 0x3d4ccccd; - uStack_100 = 0x3d4ccccd; - fStack_fc = 1.0; - local_f8 = 0; - shader_push(GHIDRA_CAST("KAGE_ColorShader")); - local_84 = 0.0; - local_94 = 0.0; - fStack_88 = 0.0; - fStack_90 = 0.0; - fStack_7c = 1.0; - fStack_8c = 1.0; - fStack_78 = 1.0; - fStack_80 = 1.0; - local_74 = (float)(GHIDRA_UINT(local_74) & 0xffffff00); - pvVar5 = kage_graphics_flush((void *)0x0); - render_quad_draw(pvVar5,&local_94,screenQuad,1,unused); - FUN_00a14200(); - if ((((g_manager->_optionsConfig)._enableLighting != 0) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_4c)) + 0x4)))) + 0x44)) >> 9 & 1) == 0)) && - (DAT_00c79834 != GHIDRA_CAST(0x0))) { - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[2] = 1; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 1; - local_a4.y = (float)((double)DAT_00c79834[4] + - __uint_to_double_fixup[-(DAT_00c79834[4] >> 0x1f)]); - local_9c.y = (float)((double)DAT_00c79834[5] + - __uint_to_double_fixup[-(DAT_00c79834[5] >> 0x1f)]); - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar1 = (code *)swi(3); - (*pcVar1)(); - return; - } - uVar4 = uVar4 >> ((*GHIDRA_CAST((GHIDRA_CAST(&(local_68._blue)) + 0x0))) & 0x1f) ^ uVar4; - uVar4 = uVar4 << ((*GHIDRA_CAST((GHIDRA_CAST(&(local_68._alpha)) + 0x0))) & 0x1f) ^ uVar4; - uVar4 = uVar4 >> (rngShift3 & 0x1f) ^ uVar4; - uVar7 = g_game->_debugCurses; - curses = g_game->_curses; - fVar9 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * - 2.3283062e-10 * 9.0 + 0.1; - uVar4 = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - room = local_4c; - if ((~preventedCurses & (uVar4 | uVar7 | curses) & 1) == 0) { - fVar11 = g_game->_darknessStrength * g_game->_darknessModifier; - } - else { - fVar11 = 1.0; - } - local_68._unk = 0; - local_68._red = 1.0; - local_68._green = 0.9 - fVar11 * 0.19999999; - auVar10 = ZEXT812(0x3d4ccccd); - fVar8 = fVar9 * (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x0))); - if (fVar8 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x0)))) { - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x4))); - (*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x0))) = fVar8; - } - local_68._alpha = ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar10)) + 0x0))) - fVar9) * fVar11 + fVar9; - local_68._blue = 0.8 - fVar11 * 0.15000004; - if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_4c)) + 0x4)))) == 0) || - (iVar3 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_4c)) + 0x4)))) + 0x10)), iVar3 == 0)) { - local_4c = GHIDRA_CAST(0x1); - } - else { - local_4c = *GHIDRA_CAST((iVar3 + 0x48)); - } - uVar4 = 0; - do { - iVar3 = (&DAT_00b6c9b0)[uVar4 * 2]; - if (((-1 < iVar3) && (iVar6 = (&DAT_00b6c9b4)[uVar4 * 2], -1 < iVar6)) && - ((local_48 = (float)room->_gridWidth, iVar3 < GHIDRA_INT(local_48) && - (iVar6 < room->_gridHeight)))) { - if (uVar4 == 0) { - isLightSkipped = local_4c == GHIDRA_CAST(&DAT_00000009); -LAB_0082681a: - if (isLightSkipped) goto LAB_008269ef; - } - else if (uVar4 == 1) { - isLightSkipped = local_4c == GHIDRA_CAST(0xa); - goto LAB_0082681a; - } - iVar3 = iVar6 * GHIDRA_INT(local_48) + iVar3; - iVar6 = iVar3 % GHIDRA_INT(local_48); - local_54 = (float)(iVar3 / GHIDRA_INT(local_48)) * 40.0 + 120.0; - local_48 = g_displayPixelRatio * g_screenPointScale; - local_44 = (uint32_t *) - (((g_screenWidth - 338.0) * 0.5 + (((float)iVar6 * 40.0 + 40.0) - 60.0) * 0.65) - * local_48 + 0.5); - dVar12 = floor((double)(float)local_44); - local_50 = (float)dVar12 / local_48; - local_44 = (uint32_t *) - (((g_screenHeight - 182.0) * 0.5 + (local_54 - 140.0) * 0.65) * local_48 + 0.5) - ; - dVar12 = floor((double)(float)local_44); - local_44 = GHIDRA_CAST((float)dVar12); - local_70.y = (float)local_44 / local_48 + (room->_renderScrollOffset).y + - (g_game->_screenShakeOffset).y; - local_70.x = local_50 + (room->_renderScrollOffset).x + (g_game->_screenShakeOffset).x; - render_quad_set_uniform_color - (lightQuad,local_70.x - local_a4.y * 0.5,local_70.y - local_9c.y * 0.6, - local_a4.y * 0.5 + local_70.x,local_9c.y * 0.4 + local_70.y,&local_68); - (GHIDRA_CAST((lightQuad)))->Quad::rotate(&local_70,-0.7853982); - (**(code **)(*DAT_00c79834 + 0x1c))(); - } -LAB_008269ef: - uVar4 = uVar4 + 1; - } while (uVar4 < 2); - } - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 4; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 4; - g_graphicsManager_blendMode[4] = 7; - local_cc = 0x3f800000; - uStack_c8 = 0x3f800000; - uStack_c4 = 0x3f800000; - fStack_c0 = 1.0; - local_bc = 0; - local_e0 = 0x3f800000; - uStack_dc = 0x3f800000; - uStack_d8 = 0x3f800000; - fStack_d4 = 1.0; - local_d0 = 0; - local_f4 = 0x3f800000; - uStack_f0 = 0x3f800000; - uStack_ec = 0x3f800000; - fStack_e8 = 1.0; - local_e4 = 0; - local_108 = 0x3f800000; - uStack_104 = 0x3f800000; - uStack_100 = 0x3f800000; - fStack_fc = 1.0; - local_f8 = 0; - (**(code **)(*DAT_00c7982c + 0x1c))(); - g_graphicsManager_flags = g_graphicsManager_flags | 2; - _glfw_context_reset(); - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - renderTargetEntry = msvc::deque::back(); - KAGE_Graphics::SetRenderTarget - (&DAT_00c798e0,(void *)*renderTargetEntry,*GHIDRA_CAST((renderTargetEntry + 1))); - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } - } - return; -} - -// 00826ae0 -void Room::render_lava_pit_mask() -{ - char cVar1; - uint32_t *targetStackEntry; - uint8_t *shader; - int iVar2; - uint32_t extraout_EAX; - int gridIndex; - int extraout_ECX; - int extraout_ECX_00; - int extraout_ECX_01; - int row; - int column; - uint8_t auStackY_19c [128]; - int *piVar3; - uint8_t quad [112]; - int savedBlendMode0; - int savedBlendMode1; - int savedBlendMode2; - int savedBlendMode3; - KColor white; - int savedBlendMode4; - void *gridEntity; - float local_58; - float local_54; - float local_50; - float local_4c; - float local_48; - float local_44; - float local_40; - float local_3c; - uint8_t local_38; - float local_34; - float local_30; - float local_2c; - float local_28; - uint32_t local_24; - Vector targetSize; - uint32_t local_18; - float targetHeight; - float targetWidth; - int local_c; - Room *room; - code *shaderDrawFn; - - if ((this->_backdropType == 0x20) && ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 5 & 1) != 0)) - { - targetSize.x = 0.0; - targetSize.y = 0.0; - room = this; - msvc::vector::resize(&targetSize); - targetStackEntry = msvc::deque::back(); - if (GHIDRA_CAST((targetStackEntry + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((targetStackEntry + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *targetStackEntry = g_graphicsManager_renderTarget; - savedBlendMode0 = g_graphicsManager_blendMode[0]; - savedBlendMode1 = g_graphicsManager_blendMode[1]; - savedBlendMode2 = g_graphicsManager_blendMode[2]; - savedBlendMode3 = g_graphicsManager_blendMode[3]; - savedBlendMode4 = g_graphicsManager_blendMode[4]; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(DAT_00c7981c,0); - g_graphicsManager_flags = g_graphicsManager_flags & 0xfffffffd; - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - DAT_00c33910 = 0; - targetWidth = (float)((double)*GHIDRA_CAST((GHIDRA_CAST(DAT_00c7981c) + 0x10)) + - __uint_to_double_fixup[-(*GHIDRA_CAST((GHIDRA_CAST(DAT_00c7981c) + 0x10)) >> 0x1f)]); - shader = &g_shaders; - if ((DAT_00c7911c & 1) == 0) { - shader = g_currentShader; - } - local_c = 0; - targetHeight = (float)((double)*GHIDRA_CAST((GHIDRA_CAST(DAT_00c7981c) + 0x14)) + - __uint_to_double_fixup[-(*GHIDRA_CAST((GHIDRA_CAST(DAT_00c7981c) + 0x14)) >> 0x1f)]); - targetSize.y = targetHeight; - targetSize.x = targetWidth; - g_currentShader = shader; - if (0 < this->_gridHeight) { - do { - iVar2 = this->_gridWidth; - column = 0; - row = local_c; - if (0 < iVar2) { - do { - if ((((-1 < column) && (column < iVar2)) && (-1 < row)) && - ((row < this->_gridHeight && (gridIndex = iVar2 * row + column, -1 < gridIndex)))) { - gridEntity = this->_gridEntities[gridIndex]; - if ((gridEntity == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(gridEntity) + 4)) != 7)) { - this = room; - } - else { - piVar3 = GHIDRA_CAST(0x0); - local_18 = DAT_00c79804; - if (DAT_00c79808 != GHIDRA_CAST(0x0)) { - cVar1 = (**(code **)(*DAT_00c79808 + 4))(); - iVar2 = extraout_ECX; - if ((cVar1 != '\0') && (iVar2 = 0, piVar3 != GHIDRA_CAST(0x0))) { - cVar1 = (**(code **)(*piVar3 + 0xc))(); - iVar2 = extraout_ECX_00; - if ((cVar1 != '\0') && (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(auStackY_19c + 0x90); - iVar2 = extraout_ECX_01; - } - } - } - FUN_007135d0(iVar2); - iVar2 = room->_gridWidth; - row = local_c; - this = room; - } - } - column = column + 1; - } while (column < iVar2); - } - local_c = row + 1; - } while (local_c < this->_gridHeight); - } - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[1] = 6; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 0; - g_graphicsManager_blendMode[4] = 1; - local_30 = this->_lavaIntensity; - DAT_00c33910 = 1; - shaderDrawFn = *(code **)(*DAT_00c7980c + 0x14); - local_24 = 0; - local_34 = local_30 * 0.5 + 0.5; - local_28 = 1.0; - white._unk = 0; - white._red = 1.0; - white._green = 1.0; - white._blue = 1.0; - white._alpha = 1.0; - local_2c = local_30; - render_quad_set_rect(quad,&g_vectorZero,&targetSize,&white); - local_50 = targetWidth + g_vectorZero.x; - local_48 = g_vectorZero.x; - local_58 = g_vectorZero.x; - local_44 = targetHeight + g_vectorZero.y; - local_4c = g_vectorZero.y; - local_54 = g_vectorZero.y; - local_38 = 1; - local_40 = local_50; - local_3c = local_44; - (*shaderDrawFn)(&local_58); - if (0.0 < this->_waterAmount) { - local_24 = 0; - local_34 = 1.0; - local_28 = 1.0 - this->_lavaIntensity * this->_lavaIntensity; - local_30 = 1.0; - shaderDrawFn = *(code **)(*DAT_00c79814 + 0x14); - local_2c = 1.0; - white._unk = 0; - white._red = 1.0; - white._green = 1.0; - white._blue = 1.0; - white._alpha = 1.0; - render_quad_set_rect(quad,&g_vectorZero,&targetSize,&white); - local_50 = targetWidth + g_vectorZero.x; - local_48 = g_vectorZero.x; - local_58 = g_vectorZero.x; - local_44 = targetHeight + g_vectorZero.y; - local_4c = g_vectorZero.y; - local_54 = g_vectorZero.y; - local_38 = 1; - local_40 = local_50; - local_3c = local_44; - (*shaderDrawFn)(&local_58,extraout_EAX,&local_34); - } - _glfw_context_reset(1); - g_graphicsManager_blendMode[0] = savedBlendMode0; - g_graphicsManager_blendMode[1] = savedBlendMode1; - g_graphicsManager_blendMode[2] = savedBlendMode2; - g_graphicsManager_blendMode[3] = savedBlendMode3; - g_graphicsManager_blendMode[4] = savedBlendMode4; - g_graphicsManager_flags = g_graphicsManager_flags | 2; - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - targetStackEntry = msvc::deque::back(); - KAGE_Graphics::SetRenderTarget - (&DAT_00c798e0,(void *)*targetStackEntry,*GHIDRA_CAST((targetStackEntry + 1))); - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } - shader_cache_find(0); - } - return; -} - -// 00826f80 -void Room::render_water_overlay(Vector *offset) -{ - uint8_t *puVar1; - KColor *color; - int unusedArg; - float overlayOffset; - uint8_t auStackY_178 [128]; - void *in_stack_ffffff10; - void *in_stack_ffffff14; - Vector roomSize; - Vector drawPos; - KColor local_d0; - KColor local_bc; - uint8_t local_a8 [112]; - ColorMod local_38; - uint32_t local_c; - code *renderFn; - - local_c = __security_cookie ^ GHIDRA_UINT(&roomSize); - roomSize.x = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6ae8)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6ae0)))); - roomSize.y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6aec)))) - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x6ae4)))); - puVar1 = &g_shaders; - if ((DAT_00c7911c & 1) == 0) { - puVar1 = g_currentShader; - } - g_graphicsManager_blendMode[1] = 1; - if (((uint8_t)g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - local_38._tint[0] = 1.0; - local_38._tint[1] = 1.0; - local_38._tint[2] = 1.0; - local_38._tint[3] = 1.0; - g_graphicsManager_blendMode[0] = 0; - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - local_38._colorize[0] = 0.0; - local_38._colorize[1] = 0.0; - local_38._colorize[2] = 0.0; - local_38._colorize[3] = 0.0; - local_38._offset[0] = 0.0; - local_38._offset[1] = 0.0; - local_38._offset[2] = 0.0; - g_currentShader = puVar1; - (GHIDRA_CAST((auStackY_178 + 0x88)))->KAGE::SmartPointer::operator_assign(&DAT_00c7981c); - apply_sprite_shader_params(&local_38,1,in_stack_ffffff10,in_stack_ffffff14); - renderFn = *(code **)(*DAT_00c7981c + 0x14); - (GHIDRA_CAST((&local_bc)))->KColor::SetFromARGB(0xffffffff); - (GHIDRA_CAST((&local_d0)))->KColor::SetFromARGB(0xffffffff); - overlayOffset = 52.0; - drawPos.x = offset->x + 52.0; - drawPos.y = offset->y + 52.0; - render_quad_set_rect(local_a8,&drawPos,&roomSize,color); - local_38._tint[2] = roomSize.x + overlayOffset; - local_38._colorize[1] = roomSize.y + overlayOffset; - local_38._colorize[0] = 52.0; - local_38._tint[3] = 52.0; - local_38._tint[0] = 52.0; - local_38._tint[1] = 52.0; - local_38._offset[0] = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_38._offset[0])) + 0x1))),1); - local_38._colorize[2] = local_38._tint[2]; - local_38._colorize[3] = local_38._colorize[1]; - (*renderFn)(&local_38); - shader_cache_find(unusedArg); - return; -} - -// 008271e0 -void Room::UpdateRedKey() -{ - uint8_t isCanSpawnOutline; - uint32_t uVar1; - Entity_Player *redKeyOwner; - uint32_t uVar2; - Room *pRVar3; - uint32_t pocketSlot; - Entity *outlineSlot; - int *doorOutlineSlot; - Game *game; - int iVar4; - float fVar5; - Entity *local_34; - Room *room; - int *local_2c; - float angleRad; - Vector spawnPos; - float doorAngles [4]; - uint32_t local_c; - bool isHasRedKey; - void *playerListEnd; - int pocketCardId; - - local_c = __security_cookie ^ GHIDRA_UINT(&local_34); - local_34 = GHIDRA_CAST(0x0); - isHasRedKey = false; - game = g_game; - room = this; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) { -LAB_0082731a: - pRVar3 = room; - redKeyOwner = PlayerManager::FirstCollectibleOwner - (&game->_playerManager,0x244,GHIDRA_CAST(&game->_playerManager),1); - if ((redKeyOwner == GHIDRA_CAST(0x0)) && (!isHasRedKey)) { - outlineSlot = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar3)) + 0x7744)))); - iVar4 = 8; - do { - if ((*GHIDRA_CAST(outlineSlot) != GHIDRA_CAST(0x0)) && - ((**(code **)(**GHIDRA_CAST(outlineSlot) + 0x28))(), *GHIDRA_CAST(outlineSlot) != 0)) { - local_34 = outlineSlot; - msvc::multiset::erase(&local_34); - *GHIDRA_CAST(outlineSlot) = 0; - } - outlineSlot = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((outlineSlot)) + 0x4)))); - iVar4 = iVar4 + -1; - } while (iVar4 != 0); - return; - } - doorAngles[0] = -90.0; - doorAngles[1] = 0.0; - doorAngles[2] = 90.0; - doorAngles[3] = 180.0; - doorOutlineSlot = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))); - if (((*GHIDRA_CAST((doorOutlineSlot[4] + 8)) != 5) || - (doorOutlineSlot[2] != g_game->_lastBossRoomListIdx)) && (-1 < *doorOutlineSlot)) { - uVar1 = 0; - doorOutlineSlot = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x7744)))); - uVar2 = 1; - pRVar3 = room; - do { - if (*doorOutlineSlot == 0) { - if ((((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar3)) + 0x4)))) + 0x10)) + 0x38 + (uVar1 >> 5) * 4)) & - uVar2) != 0) && (doorOutlineSlot[-0x1c08] == 0)) && - (isCanSpawnOutline = - Level::CanSpawnDoorOutline - (GHIDRA_CAST(g_game),*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pRVar3)) + 0x4)))) + 4)),uVar1), - isCanSpawnOutline != 0)) { - local_34 = GHIDRA_CAST(Random()); - spawnPos.x = (float)(doorOutlineSlot[-0x1c00] % room->_gridWidth) * 40.0 + 40.0; - spawnPos.y = (float)(doorOutlineSlot[-0x1c00] / room->_gridWidth) * 40.0 + 120.0; - local_34 = Game::SpawnEx(g_game,1000,0x9a,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0, - GHIDRA_UINT(local_34),0); - fVar5 = doorAngles[uVar1 & 3]; - (local_34->_sprite)._rotation = fVar5; - angleRad = (fVar5 + 90.0) * 0.017453292; - fVar5 = cos(angleRad); - local_2c = GHIDRA_CAST((fVar5 * 15.0)); - fVar5 = sin(angleRad); - (local_34->_sprite)._offset.x = (float)local_2c; - (local_34->_sprite)._offset.y = fVar5 * 15.0; - if (GHIDRA_CAST(*doorOutlineSlot) != local_34) { - if (GHIDRA_CAST(*doorOutlineSlot) != GHIDRA_CAST(0x0)) { - local_2c = doorOutlineSlot; - msvc::multiset::erase(&local_2c); - } - *doorOutlineSlot = GHIDRA_INT(local_34); - msvc::multiset::insert(doorOutlineSlot); - } - } - pRVar3 = room; - } - uVar1 = uVar1 + 1; - uVar2 = uVar2 << 1 | GHIDRA_UINT((GHIDRA_INT(uVar2) < 0)); - doorOutlineSlot = doorOutlineSlot + 1; - } while (uVar1 < 8); - } - return; - } -LAB_00827222: - playerListEnd = (game->_playerManager)._playerList._end; - doorOutlineSlot = (game->_playerManager)._playerList._begin; - if (GHIDRA_INT(playerListEnd) - GHIDRA_INT(doorOutlineSlot) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - playerListEnd = (game->_playerManager)._playerList._end; - doorOutlineSlot = (game->_playerManager)._playerList._begin; - game = g_game; - } - if (local_34 < GHIDRA_CAST((GHIDRA_INT(playerListEnd) - GHIDRA_INT(doorOutlineSlot) >> 2))) { - doorOutlineSlot = doorOutlineSlot + GHIDRA_INT(local_34); - } - iVar4 = *doorOutlineSlot; - uVar2 = 0; - do { - if (isHasRedKey) break; - uVar1 = uVar2; - if (GHIDRA_INT(uVar2) < 1) { - uVar1 = 0; - } - pocketSlot = 3; - if (GHIDRA_INT(uVar1) < 3) { - pocketSlot = uVar1; - } - if ((*GHIDRA_CAST((iVar4 + 0x17a4 + pocketSlot * 8)) == 1) && - ((pocketCardId = *GHIDRA_CAST((iVar4 + 0x17a0 + pocketSlot * 8)), pocketCardId == 0x4e || - (pocketCardId == 0x53)))) { - isHasRedKey = true; - break; - } - uVar2 = uVar2 + 1; - } while (uVar2 < 4); - uVar2 = 0; - doorOutlineSlot = GHIDRA_CAST((iVar4 + 0x1580)); - do { - if (*doorOutlineSlot == 0x1dd) { - if (-1 < GHIDRA_INT(uVar2)) { - uVar2 = 0; - doorOutlineSlot = *GHIDRA_CAST((iVar4 + 0x1754)); - uVar1 = *GHIDRA_CAST((iVar4 + 0x1758)) - GHIDRA_INT(doorOutlineSlot) >> 2; - if (uVar1 != 0) goto LAB_008272e2; - } - break; - } - uVar2 = uVar2 + 1; - doorOutlineSlot = doorOutlineSlot + 8; - } while (uVar2 < 4); - goto LAB_008272f6; - while( true ) { - uVar2 = uVar2 + 1; - doorOutlineSlot = doorOutlineSlot + 1; - if (uVar1 <= uVar2) break; -LAB_008272e2: - if (*doorOutlineSlot == 0x244) { - isHasRedKey = true; - break; - } - } -LAB_008272f6: - local_34 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_34)) + 0x1)))); - if ((uint8_t *) - (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((game->_playerManager)._playerList._begin) - >> 2) <= local_34) goto LAB_0082731a; - goto LAB_00827222; -} - -// 00827550 -void Room::open_red_room_doors(int doorSlot, RoomDescriptor *targetRoom) -{ - float *pfVar1; - GridEntity_Door *this_00; - char extraout_AL; - int iVar2; - void **refSlot; - uint32_t slot; - void **local_c [2]; - Manager *manager; - - local_c[0] = this->_doors; - slot = 0; - do { - refSlot = local_c[0]; - if (((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x18 + (slot >> 5) * 4)) & 1 << ((uint8_t)slot & 0x1f)) - != 0) && (*local_c[0] == (void *)0x0)) { - MakeDoor(this,slot); - if (extraout_AL != '\0') { - this_00 = *refSlot; - if (targetRoom == GHIDRA_CAST(0x0)) { - this_00->_targetRoomIdx = -2; - iVar2 = 1; - } - else { - this_00->_targetRoomIdx = targetRoom->SafeGridIndex; - iVar2 = *GHIDRA_CAST((GHIDRA_CAST(targetRoom->Data) + 8)); - } - GridEntity_Door::SetRoomTypes - (this_00,*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 8)),iVar2); - iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))); - this_00->_slot = slot; - if (((iVar2 == 1) || (iVar2 == 2)) || (iVar2 == 3)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))) = 8; - ANM2::Reset(&this_00->_extraSprite); - (GHIDRA_CAST((this_00)))->GridEntity_Door::LoadSprite(); - iVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))); - } - if (iVar2 == 7) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x8)))) = 8; - } - (GHIDRA_CAST((this_00)))->GridEntity_Door::UpdateAnimation(); - refSlot = local_c[0]; - } - } - slot = slot + 1; - local_c[0] = refSlot + 1; - } while (slot < 8); - pfVar1 = GHIDRA_CAST((GHIDRA_INT((&this->_railManager + 1)) + (doorSlot + 1) * 4)); - if ((GHIDRA_CAST(*pfVar1) != GHIDRA_CAST(0x0)) && ((**(code **)(*GHIDRA_CAST(*pfVar1) + 0x28))(), *pfVar1 != 0.0)) { - local_c[0] = (void **)pfVar1; - msvc::multiset::erase(local_c); - *pfVar1 = 0.0; - } - manager = g_manager; - local_c[0] = (void **)0x9c; - seed_fart_sound_override(GHIDRA_CAST(local_c)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c[0]),1.0,2,0,1.0,0.0); - return; -} - -// 008276e0 -Entity_Pickup * Room::spawn_options_alternative(Entity_Pickup *pickup) -{ - uint32_t *puVar1; - code *pcVar2; - uint64_t qVar3; - uint8_t isObstacleSpawnable; - Entity_Pickup *spawnedPickup; - int gridY; - uint32_t angleRoll; - int iVar4; - uint32_t variant; - uint32_t uVar5; - RNG rng; - uint8_t local_20 [8]; - float local_18; - float local_14; - float offsetX; - Room *room; - float originY; - float originX; - - variant = 0; - rng._seed = pickup->_initSeed; - uVar5 = 0; - rng._shift1 = 3; - rng._shift2 = 5; - rng._shift3 = 0x19; - room = this; - do { - if ((variant != 0) && (variant != pickup->_variant)) goto LAB_00827735; - variant = RoomClear_PickVariant(&rng,1); - uVar5 = uVar5 + 1; - } while (uVar5 < 10); - if (variant == 0) { - return GHIDRA_CAST(0x0); - } -LAB_00827735: - originX = (pickup->_pos).x; - originY = (pickup->_pos).y; - if (rng._seed == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - spawnedPickup = GHIDRA_CAST((*pcVar2)()); - return spawnedPickup; - } - uVar5 = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed; - local_20 = (uint8_t [8])0x100000003; - uVar5 = uVar5 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar5; - uVar5 = uVar5 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar5; - local_14 = 1.96182e-44; - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - spawnedPickup = GHIDRA_CAST((*pcVar2)()); - return spawnedPickup; - } - angleRoll = uVar5 >> 3 ^ uVar5; - angleRoll = angleRoll << 1 ^ angleRoll; - angleRoll = angleRoll >> 0xe ^ angleRoll; - local_14 = (float)((double)GHIDRA_INT(angleRoll) + __uint_to_double_fixup[-(GHIDRA_INT(angleRoll) >> 0x1f)]) * - 2.3283062e-10 * 3.14; - local_14 = local_14 + local_14; - offsetX = cos(local_14); - offsetX = offsetX * 15.0; - local_14 = sin(local_14); - local_14 = local_14 * 15.0; - if (uVar5 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - spawnedPickup = GHIDRA_CAST((*pcVar2)()); - return spawnedPickup; - } - uVar5 = uVar5 >> ((uint8_t)rng._shift1 & 0x1f) ^ uVar5; - uVar5 = uVar5 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar5; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_20)) + 0x4))) = originX + offsetX; - local_18 = originY + local_14; - spawnedPickup = - (Entity_Pickup *) - Game::Spawn(g_game,5,variant,GHIDRA_CAST((local_20 + 4)),&g_vectorZero,GHIDRA_CAST(0x0),0, - uVar5 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar5); - if ((spawnedPickup->_type == 5) && - (((iVar4 = spawnedPickup->_variant, iVar4 == 0x34 || (iVar4 == 0x36)) || (iVar4 == 0x39)))) { - iVar4 = GHIDRA_INT(((originX - 40.0) / 40.0 + 0.5)); - gridY = GHIDRA_INT(((originY - 120.0) / 40.0 + 0.5)); - if ((((iVar4 < 0) || (room->_gridWidth <= iVar4)) || (gridY < 0)) || - (room->_gridHeight <= gridY)) { - iVar4 = -1; - } - else { - iVar4 = room->_gridWidth * gridY + iVar4; - } - isObstacleSpawnable = CanSpawnObstacleAtPosition(room,iVar4,0); - if (isObstacleSpawnable == 0) { - Entity_Pickup::Morph(spawnedPickup,5,0x32,1,0,0,0); - } - } - if ((pickup->_flags & 0x10000000000) != 0) { - qVar3 = spawnedPickup->_flags; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&spawnedPickup->_flags) + 4)); - *puVar1 = *puVar1 | 0x100; - *GHIDRA_CAST(&spawnedPickup->_flags) = GHIDRA_INT(qVar3); - } - iVar4 = (GHIDRA_CAST((pickup)))->Entity_Pickup::AssignOptionsIndex(); - spawnedPickup->_optionsPickupIndex = iVar4; - (pickup->_pos).x = originX - offsetX; - (pickup->_pos).y = originY - local_14; - return pickup; -} - -// 008279a0 -uint8_t Room::IsBeastDungeon() -{ - int *roomConfig; - - roomConfig = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if (((roomConfig == GHIDRA_CAST(0x0)) || (roomConfig[2] != 0x10)) || (*roomConfig != 0x23)) { - return 0; - } - return 1; -} - -// 008279c0 -void Room::get_lava_line_y() -{ - return; -} - -// 008279d0 -uint8_t Room::TrySpawnSpecialQuestDoor() -{ - int iVar1; - uint32_t forcedCurses; - uint32_t preventedCurses; - uint32_t curses; - uint32_t curses; - bool isDownpourTwo; - bool isMinesTwo; - - iVar1 = g_game->_stage; - if ((g_game->_stageType != 4) && (g_game->_stageType != 5)) { - return 0; - } - if (iVar1 == 2) { -LAB_00827a28: - isDownpourTwo = true; - } - else { - if (iVar1 == 1) { - curses = g_game->_debugCurses; - curses = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - if ((~preventedCurses & (forcedCurses | curses | curses) & 2) != 0) goto LAB_00827a28; - } - isDownpourTwo = false; - } - if (iVar1 == 4) { -LAB_00827a59: - isMinesTwo = true; - } - else { - if (iVar1 == 3) { - curses = g_game->_debugCurses; - curses = g_game->_curses; - forcedCurses = Seeds::GetForcedCurses(); - preventedCurses = Seeds::GetPreventedCurses(); - if ((~preventedCurses & (forcedCurses | curses | curses) & 2) != 0) goto LAB_00827a59; - } - isMinesTwo = false; - } - if (isDownpourTwo) { - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)); - if ((*GHIDRA_CAST((iVar1 + 8)) == 1) && (*GHIDRA_CAST((iVar1 + 0x10)) == 0x22)) { - curses = 0; - do { - if ((*GHIDRA_CAST((iVar1 + 0x3c + (curses >> 5) * 4)) & 1 << ((uint8_t)curses & 0x1f)) != 0) { - if (curses == 0xffffffff) { - return 0; - } - if (this->_doors[curses] != (void *)0x0) { - return 0; - } - MakeDoor(this,curses); - *GHIDRA_CAST((GHIDRA_INT(this->_doors[curses]) + 0x394)) = 0xffffff9c; - goto LAB_00827ace; - } - curses = curses + 1; - } while (GHIDRA_INT(curses) < 8); - } - } - else if (((isMinesTwo) && - (iVar1 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)), *GHIDRA_CAST((iVar1 + 8)) == 1)) && - ((*GHIDRA_CAST((iVar1 + 0x10)) == 10 || (*GHIDRA_CAST((iVar1 + 0x10)) == 0xb)))) { - curses = 0; - while ((*GHIDRA_CAST((iVar1 + 0x3c + (curses >> 5) * 4)) & 1 << ((uint8_t)curses & 0x1f)) == 0) { - curses = curses + 1; - if (7 < GHIDRA_INT(curses)) { - return 0; - } - } - if ((curses != 0xffffffff) && (this->_doors[curses] == (void *)0x0)) { - MakeDoor(this,curses); - *GHIDRA_CAST((GHIDRA_INT(this->_doors[curses]) + 0x394)) = 0xffffff9b; -LAB_00827ace: - iVar1 = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 8)); - (GHIDRA_CAST((this->_doors[curses])))->GridEntity_Door::SetRoomTypes(iVar1,iVar1); - return 1; - } - } - return 0; -} - -// 00827b70 -uint8_t Room::IsMirrorWorld() -{ - uint32_t curses; - - if ((g_game->_currentDimensionIdx == 1) && - ((g_game->_stageType == 4 || (g_game->_stageType == 5)))) { - if (g_game->_stage == 2) { - return 1; - } - if ((g_game->_stage == 1) && (curses = Level::GetCurses(GHIDRA_CAST(g_game)), (curses & 2) != 0)) { - return 1; - } - } - return 0; -} - -// 00827bb0 -uint8_t Room::HasCurseMist() -{ - return (uint8_t)(*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) >> 0xd) & 1; -} - -// 00827bc0 -uint8_t Room::is_pre_ascent_mom_room() -{ - uint8_t local_AL_24; - - if ((this->_roomType == 5) && (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x10)) + 0x10)) == 0x59) - ) { - local_AL_24 = Level::IsPreAscent(GHIDRA_CAST(g_game)); - if (local_AL_24 != 0) { - return 1; - } - } - return 0; -} - -// 00827bf0 -uint8_t Room::spawn_sanguine_bond_spikes(uint8_t isRoomInit) -{ - int iVar1; - GridEntity_Spikes *this_00; - code *pcVar2; - uint8_t bVar3; - uint32_t uVar4; - Entity_Player *bondOwner; - int rowStart; - GridEntity *newSpikes; - Entity *poof; - int cellIdx; - int iVar5; - uint32_t *existingGrid; - void **gridSlot; - int gridY; - uint32_t spikeIdx; - Vector local_28; - int rowsLeft; - int dx; - uint32_t spikeGridIdx; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int *neighborGrid; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b01a07; - local_10 = ExceptionList; - uVar4 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; - ExceptionList = &local_10; - if ((this->_roomType != 0xe) || - (bondOwner = PlayerManager::FirstCollectibleOwner - (&g_game->_playerManager,0x2b4,GHIDRA_CAST(&g_game->_playerManager),1), - bondOwner == GHIDRA_CAST(0x0))) { - ExceptionList = local_10; - return 0; - } - iVar1 = this->_gridWidth; - if ((iVar1 < 8) || (this->_gridHeight < 5)) { - spikeIdx = 0xffffffff; - spikeGridIdx = 0xffffffff; - } - else { - spikeIdx = iVar1 * 4 + 7; - spikeGridIdx = spikeIdx; - if ((spikeIdx < 0x1c0) && - (existingGrid = this->_gridEntities[iVar1 * 4 + 7], existingGrid != GHIDRA_CAST(0x0))) { - local_28.y = (float)(existingGrid + 1); - if (*GHIDRA_CAST(local_28.y) == 8) { - if (existingGrid[2] == 100) { - ExceptionList = local_10; - return 0; - } - } - else if (*GHIDRA_CAST(local_28.y) == 7) { - dx = -1; - do { - gridY = 3; - iVar1 = dx + 7; - rowsLeft = 3; - iVar5 = dx; - do { - if ((((-1 < iVar1) && (iVar1 < this->_gridWidth)) && (-1 < gridY)) && - (gridY < this->_gridHeight)) { - rowStart = this->_gridWidth * gridY; - cellIdx = iVar5 + 7 + rowStart; - if (((-1 < cellIdx) && (cellIdx < 0x1c0)) && - ((neighborGrid = this->_gridEntities[rowStart + iVar5 + 7], - neighborGrid != GHIDRA_CAST(0x0) && (neighborGrid[1] == 7)))) { - (**(code **)(*neighborGrid + 4))(uVar4); - } - iVar5 = dx; - } - spikeIdx = spikeGridIdx; - gridY = gridY + 1; - rowsLeft = rowsLeft + -1; - } while (rowsLeft != 0); - dx = iVar5 + 1; - } while (dx < 2); - existingGrid = GHIDRA_CAST(0x0); - if (this->_gridEntities[spikeGridIdx] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[spikeGridIdx]))(1); - existingGrid = GHIDRA_CAST(0x0); - this->_gridEntities[spikeIdx] = (void *)0x0; - } - } - if (((*GHIDRA_CAST(local_28.y) == 8) || (*GHIDRA_CAST(local_28.y) == 9)) && - ((existingGrid != GHIDRA_CAST(0x0) && (existingGrid[1] != 1)))) { - this->_gridPaths[spikeIdx] = 900; - this->_gridEntities[spikeIdx] = (void *)0x0; - (**(code **)*existingGrid)(1); - } - } - } - if (isRoomInit == 0) { - uVar4 = 0; - if (0 < this->_gridWidth * this->_gridHeight) { - gridSlot = this->_gridEntities; - do { - if ((((uVar4 != spikeGridIdx) && (uVar4 < 0x1c0)) && - (this_00 = *gridSlot, this_00 != GHIDRA_CAST(0x0))) && - ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x4)))) == 8 || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this_00)) + 0x4)))) == 9)))) { - (GHIDRA_CAST((this_00)))->GridEntity_Spikes::unsummon(0); - } - uVar4 = uVar4 + 1; - gridSlot = gridSlot + 1; - } while (GHIDRA_INT(uVar4) < this->_gridWidth * this->_gridHeight); - } - spikeIdx = spikeGridIdx; - } - uVar4 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x58)); - local_28.y = 1.68156e-44; - if (uVar4 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); - pcVar2 = (code *)swi(3); - bVar3 = (*pcVar2)(); - return bVar3; - } - uVar4 = uVar4 >> 0xb ^ uVar4; - uVar4 = uVar4 << 7 ^ uVar4; - if ((GHIDRA_INT(spikeIdx) < 0) || (0x1bf < GHIDRA_INT(spikeIdx))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("SpawnGridEntity: Grid index invalid\n")); - } - if ((spikeIdx < 0x1c0) && (this->_gridPaths[spikeIdx] < 0x385)) { - newSpikes = operator_new(0x158); - local_8 = 0xd; - local_28.y = (float)newSpikes; - if (newSpikes == GHIDRA_CAST(0x0)) { - newSpikes = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((newSpikes)))->GridEntity::GridEntity(); - *GHIDRA_CAST(newSpikes) = IsaacRepentancePlus::GridEntity_Spikes::vftable; - } - local_8 = 0xffffffff; - if (newSpikes != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((newSpikes)) + 0x4)))) = 8; - newSpikes->_gridIndex = spikeGridIdx; - if (this->_gridEntities[spikeGridIdx] != GHIDRA_CAST(0x0)) { - (*(code *)**GHIDRA_CAST(this->_gridEntities[spikeGridIdx]))(1); - } - this->_gridEntities[spikeGridIdx] = newSpikes; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((newSpikes)) + 0x8)))) = 100; - newSpikes->_varData = 0; - (GHIDRA_CAST((newSpikes)))->GridEntity::Init(uVar4 >> 0xc ^ uVar4); - } - spikeIdx = spikeGridIdx; - } - if (isRoomInit == 0) { - uVar4 = Random(); - local_28.x = (float)(GHIDRA_INT(spikeIdx) % this->_gridWidth) * 40.0 + 40.0; - local_28.y = (float)(GHIDRA_INT(spikeIdx) / this->_gridWidth) * 40.0 + 120.0; - poof = Game::Spawn(g_game,1000,0xf,&local_28,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); - poof->Update(); - } - ExceptionList = local_10; - return 1; -} - -// 0082eb80 -int Room::GetSecondBossID() -{ - return this->_secondBossID; -} - -// 008332c0 -void Room::SetAmbushDone(uint8_t isDone) -{ - uint32_t newRoomFlags; - uint32_t roomFlags; - - roomFlags = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)); - newRoomFlags = roomFlags | 8; - if (isDone == 0) { - newRoomFlags = roomFlags & 0xfffffff7; - } - *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x44)) = newRoomFlags; - return; -} - -// 0085e0f0 -void Room::KeepDoorsClosed() -{ - this->_roomClearDelay = 10; - return; -} - -// 0085e100 -uint32_t Room::GetAwardSeed() -{ - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 0) { - return 0; - } - return *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x60)); -} - -// 0085e110 -int Room::GetShopLevel() -{ - return this->_shopLevel; -} - -// 0085e120 -int Room::GetRenderMode() -{ - return (this->_entityList)._renderMode; -} - -// 0085e130 -float Room::GetEnemyDamageInflicted() -{ - return *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x12d4)))); -} - -// 00872020 -void Room::Spawns(uint32_t *param_1, int param_2) -{ - *param_1 = GHIDRA_UINT(*GHIDRA_CAST((param_2 + 0x44))); - param_1[1] = *GHIDRA_CAST((param_2 + 0x40)); - return; -} - -// 00872040 -uint32_t Room::Doors(int param_1) -{ - return *GHIDRA_CAST((param_1 + 0x38)); -} - -// 009e31b0 -void Room::render_pit_rails(float *param_2) -{ - uint8_t bVar1; - int cellCount; - AnimationState *secondLayer; - uint32_t gridIndex; - int cellCount; - float pixelScale; - double dVar3; - double dVar4; - int gridSlotOffset; - Vector renderPos; - - bVar1 = ANM2::SetAnimation(GHIDRA_CAST((this->_gridEntities + 0x68)),GHIDRA_CAST("pitrail"),1); - if (((bVar1 != 0) && (this->_gridEntities[0x75] != (void *)0x0)) && - (AnimationState::SetFrameFloat(GHIDRA_CAST((this->_gridEntities + 0x74)),0.0), - this->_gridEntities[0x75] != (void *)0x0)) { - *GHIDRA_CAST((this->_gridEntities + 0x79)) = 0; - } - gridIndex = 0; - cellCount = *GHIDRA_CAST((*GHIDRA_CAST(this) + 0x10)) * *GHIDRA_CAST((*GHIDRA_CAST(this) + 0xc)); - if (0 < cellCount) { - gridSlotOffset = 0x24; - do { - bVar1 = *GHIDRA_CAST((GHIDRA_CAST(this->_gridEntities) + (gridIndex - 0x20))); - if ((-1 < (char)bVar1) && (gridIndex < 0x1c0)) { - cellCount = *GHIDRA_CAST(this); - if ((*GHIDRA_CAST((gridSlotOffset + cellCount)) != 0) && - (*GHIDRA_CAST((*GHIDRA_CAST((gridSlotOffset + cellCount)) + 4)) == 7)) { - if (this->_gridEntities[0x75] != (void *)0x0) { - AnimationState::SetFrameFloat - (GHIDRA_CAST((this->_gridEntities + 0x74)),(float)(bVar1 & 0xf)); - cellCount = *GHIDRA_CAST(this); - } - cellCount = *GHIDRA_CAST((cellCount + 0xc)); - pixelScale = g_displayPixelRatio * g_screenPointScale; - dVar3 = floor((double)(((((float)(GHIDRA_INT(gridIndex) % cellCount) * 40.0 + 40.0) - 60.0) * 0.65 + - (g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5)); - dVar4 = floor((double)(((((float)(GHIDRA_INT(gridIndex) / cellCount) * 40.0 + 120.0) - 140.0) * 0.65 - + (g_screenHeight - 182.0) * 0.5) * pixelScale + 0.5)); - renderPos.x = (float)dVar3 / pixelScale + *param_2; - renderPos.y = (float)dVar4 / pixelScale + param_2[1]; - if (*GHIDRA_CAST((GHIDRA_CAST(this->_gridEntities) + 0x2a9)) != '\0') { - if (*GHIDRA_CAST((this->_gridEntities + 0x84)) == '\0') { - AnimationState::Render - (GHIDRA_CAST((this->_gridEntities + 0x74)),&renderPos,&g_vectorZero, - &g_vectorZero); - secondLayer = GHIDRA_CAST((this->_gridEntities + 0x7c)); - } - else { - AnimationState::Render - (GHIDRA_CAST((this->_gridEntities + 0x7c)),&renderPos,&g_vectorZero, - &g_vectorZero); - secondLayer = GHIDRA_CAST((this->_gridEntities + 0x74)); - } - AnimationState::Render(secondLayer,&renderPos,&g_vectorZero,&g_vectorZero); - } - } - } - gridSlotOffset = gridSlotOffset + 4; - gridIndex = gridIndex + 1; - } while (GHIDRA_INT(gridIndex) < cellCount); - } - return; -} - -// 009e7dc0 -int Room::GetBossThematicItem(int param_2) -{ - char *putPos; - int iVar1; - int putResult; - size_t written; - char ch; - size_t _Count; - char *srcNext; - char *convEnd; - char srcChar; - char convBuf [32]; - uint32_t local_8; - void *bufferBegin; - void *bufferEnd; - uint32_t putPtr; - - local_8 = __security_cookie ^ GHIDRA_UINT((convBuf + 0x24)); - if (param_2 == -1) { - return 0; - } - putPtr = *GHIDRA_CAST((this->_bottomRightPos).y); - ch = (char)param_2; - if ((putPtr != 0) && (putPtr < *GHIDRA_CAST(this->_gridEntities[3]) + putPtr)) { - putPos = msvc::basic_streambuf_>::_Pninc - ((basic_streambuf_> *)this); - *putPos = ch; - return param_2; - } - if (this->_gridEntities[10] != (void *)0x0) { - if ((void **)*GHIDRA_CAST(this->_gridWidth) == this->_gridEntities + 6) { - bufferEnd = this->_gridEntities[0xc]; - bufferBegin = this->_gridEntities[0xb]; - *(void **)this->_gridWidth = bufferBegin; - *(void **)(this->_bottomRightPos).x = bufferBegin; - *GHIDRA_CAST(this->_gridEntities[2]) = GHIDRA_INT(bufferEnd) - GHIDRA_INT(bufferBegin); - } - if (this->_gridEntities[5] == (codecvt *)0x0) { -LAB_009e7e8d: - putResult = fputc(GHIDRA_INT(ch),this->_gridEntities[10]); - iVar1 = -1; - if (putResult != -1) { - iVar1 = param_2; - } - return iVar1; - } - srcChar = ch; - iVar1 = msvc::codecvt::out - (this->_gridEntities[5],GHIDRA_CAST<_Mbstatet *>((this->_gridEntities + 7)),&srcChar, - convBuf,&srcNext,convBuf,GHIDRA_CAST(&local_8),&convEnd); - if ((iVar1 == 0) || (iVar1 == 1)) { - _Count = GHIDRA_INT(convEnd) - GHIDRA_INT(convBuf); - if (((_Count == 0) || - (written = fwrite(convBuf,1,_Count,this->_gridEntities[10]), _Count == written)) && - (*GHIDRA_CAST((GHIDRA_CAST(this->_gridEntities) + 0x19)) = 1, srcNext != &srcChar)) { - return param_2; - } - } - else if (iVar1 == 3) { - ch = srcChar; - goto LAB_009e7e8d; - } - } - return -1; -} diff --git a/generated-src/room_descriptor.cpp b/generated-src/room_descriptor.cpp deleted file mode 100644 index d7550cc..0000000 --- a/generated-src/room_descriptor.cpp +++ /dev/null @@ -1,552 +0,0 @@ -#include "classes.h" - -// 00436010 -uint8_t RoomDescriptor::Clear() -{ - return (uint8_t)this->Flags & 1; -} - -// 00456560 -uint32_t RoomDescriptor::PressurePlatesTriggered() -{ - return CONCAT31((uint3)(GHIDRA_UINT(this->Flags) >> 9),(char)(GHIDRA_UINT(this->Flags) >> 1)) & 0xffffff01; -} - -// 00505c30 -uint32_t RoomDescriptor::HasWater() -{ - return CONCAT31((uint3)(GHIDRA_UINT(this->Flags) >> 0xd),(char)(GHIDRA_UINT(this->Flags) >> 5)) & 0xffffff01; -} - -// 005cd640 -uint32_t RoomDescriptor::SacrificeDone() -{ - return CONCAT31((uint3)(GHIDRA_UINT(this->Flags) >> 10),(char)(GHIDRA_UINT(this->Flags) >> 2)) & 0xffffff01; -} - -// 006ef590 -RoomConfig_Room * RoomDescriptor::constructor() -{ - void *pvVar1; - void *pvVar2; - uint32_t *gridSave; - int gridSavesLeft; - uint32_t gridSaveOffset; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - - local_8 = 0xffffffff; - puStack_c = &LAB_00afb307; - local_10 = ExceptionList; - ExceptionList = &local_10; - this->GridIndex = -1; - this->SafeGridIndex = -1; - this->ListIndex = -1; - this->Dimension = 0; - this->Data = (void *)0x0; - this->OverrideData = (void *)0x0; - this->AllowedDoors = 0; - this->DisplayFlags = 0; - this->VisitedCount = 0; - this->Flags = 0; - this->TotalMoneySpent = 0; - this->ClearCount = 0; - this->GreedSubType = 0; - this->PoopCount = 0; - this->TKeeperCoinSpawns = 0; - this->PitsCount = 0; - this->DecorationSeed = 0; - this->SpawnSeed = 0; - this->AwardSeed = 0; - this->BossDeathSeed = 0; - (this->SavedGridEntities)._begin = (void *)0x0; - (this->SavedGridEntities)._end = (void *)0x0; - (this->SavedGridEntities)._capacity = (void *)0x0; - pvVar1 = operator_new(0x3823); - if (pvVar1 == (void *)0x0) { - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - pvVar2 = (void *)(GHIDRA_INT(pvVar1) + 0x23U & 0xffffffe0); - *(void **)(GHIDRA_INT(pvVar2) - 4) = pvVar1; - gridSavesLeft = 0x1c0; - (this->SavedGridEntities)._begin = pvVar2; - (this->SavedGridEntities)._capacity = (void *)(GHIDRA_INT(pvVar2) + 0x3800); - gridSave = (this->SavedGridEntities)._begin; - do { - *gridSave = 0; - gridSave[1] = 0; - gridSave[2] = 0; - gridSave[3] = 0; - gridSave[4] = 0x16a9de81; - gridSave[5] = 0; - *GHIDRA_CAST((gridSave + 6)) = 0; - gridSave[7] = 0x16a9de81; - gridSave = gridSave + 8; - gridSavesLeft = gridSavesLeft + -1; - } while (gridSavesLeft != 0); - (this->SavedGridEntities)._end = gridSave; - (this->SavedEntities)._begin = (void *)0x0; - (this->SavedEntities)._end = (void *)0x0; - (this->SavedEntities)._capacity = (void *)0x0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))) = 0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - (this->RestrictedGridIndexes)._head = (void *)0x0; - (this->RestrictedGridIndexes)._size = 0; - pvVar1 = operator_new(0x14); - *(void **)pvVar1 = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 4) = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 8) = pvVar1; - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xc)) = 0x101; - (this->RestrictedGridIndexes)._head = pvVar1; - (this->SavedEffects)._begin = (void *)0x0; - (this->SavedEffects)._end = (void *)0x0; - (this->SavedEffects)._capacity = (void *)0x0; - local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),3); - this->ShopItemIdx = -1; - this->ShopItemDiscountIdx = -1; - this->DeliriumDistance = 0; - this->Group = -1; - pvVar1 = (this->SavedEntities)._end; - pvVar2 = (this->SavedEntities)._begin; - if (pvVar2 != pvVar1) { - do { - invoke_pending_callbacks(pvVar2); - pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 0x78); - } while (pvVar2 != pvVar1); - pvVar2 = (this->SavedEntities)._begin; - } - (this->SavedEntities)._end = pvVar2; - if (GHIDRA_UINT(((GHIDRA_INT((this->SavedEntities)._capacity) - GHIDRA_INT((this->SavedEntities)._begin)) / 0x78)) < - 0x10) { - msvc::vector::_Reallocate_exactly(0x10); - } - pvVar1 = (this->SavedEffects)._end; - pvVar2 = (this->SavedEffects)._begin; - if (pvVar2 != pvVar1) { - do { - invoke_pending_callbacks(pvVar2); - pvVar2 = (void *)(GHIDRA_INT(pvVar2) + 0x78); - } while (pvVar2 != pvVar1); - pvVar2 = (this->SavedEffects)._begin; - } - (this->SavedEffects)._end = pvVar2; - if (GHIDRA_UINT(((GHIDRA_INT((this->SavedEffects)._capacity) - GHIDRA_INT((this->SavedEffects)._begin)) / 0x78)) < 0x20 - ) { - msvc::vector::_Reallocate_exactly(0x20); - } - pvVar1 = (this->RestrictedGridIndexes)._head; - FID_conflict__Erase_tree_>_> - (&this->RestrictedGridIndexes, - (fuzzer_allocator_> *)&this->RestrictedGridIndexes, - *(_Tree_node **)(GHIDRA_INT(pvVar1) + 4)); - *(void **)(GHIDRA_CAST(pvVar1) + 4) = pvVar1; - gridSaveOffset = 0; - *(void **)pvVar1 = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 8) = pvVar1; - (this->RestrictedGridIndexes)._size = 0; - this->_doors[0] = -1; - this->_doors[1] = -1; - this->_doors[2] = -1; - this->_doors[3] = -1; - this->_doors[4] = -1; - this->_doors[5] = -1; - this->_doors[6] = -1; - this->_doors[7] = -1; - do { - *GHIDRA_CAST((gridSaveOffset + GHIDRA_INT((this->SavedGridEntities)._begin))) = 0; - gridSaveOffset = gridSaveOffset + 0x20; - } while (gridSaveOffset < 0x3800); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x94)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x98)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x9c)))) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa0)))) = 0; - ExceptionList = local_10; - return GHIDRA_CAST(this); -} - -// 006ef9c0 -void RoomDescriptor::destructor() -{ - std_set *restrictedGridIndexes; - - msvc::vector::_Tidy(); - restrictedGridIndexes = &this->RestrictedGridIndexes; - FID_conflict__Erase_tree_>_> - (restrictedGridIndexes,(fuzzer_allocator_> *)restrictedGridIndexes, - *(_Tree_node **)(GHIDRA_INT((this->RestrictedGridIndexes)._head) + 4)); - operator_delete(restrictedGridIndexes->_head,0x14); - msvc::vector::_Tidy(); - FUN_00708f90(); - return; -} - -// 0070c550 -uint32_t RoomDescriptor::ChallengeDone() -{ - return CONCAT31((uint3)(GHIDRA_UINT(this->Flags) >> 0xb),(char)(GHIDRA_UINT(this->Flags) >> 3)) & 0xffffff01; -} - -// 00738180 -uint32_t RoomDescriptor::SurpriseMiniboss() -{ - return CONCAT31((uint3)(GHIDRA_UINT(this->Flags) >> 0xc),(char)(GHIDRA_UINT(this->Flags) >> 4)) & 0xffffff01; -} - -// 007387d0 -RoomDescriptor * RoomDescriptor::operator_assign(RoomDescriptor *other) -{ - std_set *restrictedIndexes; - void *pvVar1; - std_vector *otherVector; - uint32_t setSize; - - otherVector = &other->SavedGridEntities; - this->GridIndex = other->GridIndex; - this->SafeGridIndex = other->SafeGridIndex; - this->ListIndex = other->ListIndex; - this->Dimension = other->Dimension; - this->Data = other->Data; - this->OverrideData = other->OverrideData; - this->AllowedDoors = other->AllowedDoors; - this->_doors[0] = other->_doors[0]; - this->_doors[1] = other->_doors[1]; - this->_doors[2] = other->_doors[2]; - this->_doors[3] = other->_doors[3]; - this->_doors[4] = other->_doors[4]; - this->_doors[5] = other->_doors[5]; - this->_doors[6] = other->_doors[6]; - this->_doors[7] = other->_doors[7]; - this->DisplayFlags = other->DisplayFlags; - this->VisitedCount = other->VisitedCount; - this->Flags = other->Flags; - this->TotalMoneySpent = other->TotalMoneySpent; - this->ClearCount = other->ClearCount; - this->GreedSubType = other->GreedSubType; - this->PoopCount = other->PoopCount; - this->TKeeperCoinSpawns = other->TKeeperCoinSpawns; - this->PitsCount = other->PitsCount; - this->DecorationSeed = other->DecorationSeed; - this->SpawnSeed = other->SpawnSeed; - this->AwardSeed = other->AwardSeed; - this->BossDeathSeed = other->BossDeathSeed; - if (&this->SavedGridEntities != otherVector) { - FUN_00708f90(); - (this->SavedGridEntities)._begin = otherVector->_begin; - (this->SavedGridEntities)._end = (other->SavedGridEntities)._end; - (this->SavedGridEntities)._capacity = (other->SavedGridEntities)._capacity; - otherVector->_begin = (void *)0x0; - (other->SavedGridEntities)._end = (void *)0x0; - (other->SavedGridEntities)._capacity = (void *)0x0; - } - otherVector = &other->SavedEntities; - if (&this->SavedEntities != otherVector) { - msvc::vector::_Tidy(); - (this->SavedEntities)._begin = otherVector->_begin; - (this->SavedEntities)._end = (other->SavedEntities)._end; - (this->SavedEntities)._capacity = (other->SavedEntities)._capacity; - otherVector->_begin = (void *)0x0; - (other->SavedEntities)._end = (void *)0x0; - (other->SavedEntities)._capacity = (void *)0x0; - } - restrictedIndexes = &this->RestrictedGridIndexes; - if (restrictedIndexes != &other->RestrictedGridIndexes) { - pvVar1 = restrictedIndexes->_head; - FID_conflict__Erase_tree_>_> - (restrictedIndexes,(fuzzer_allocator_> *)restrictedIndexes, - *(_Tree_node **)(GHIDRA_INT(pvVar1) + 4)); - *(void **)(GHIDRA_CAST(pvVar1) + 4) = pvVar1; - *(void **)pvVar1 = pvVar1; - *(void **)(GHIDRA_CAST(pvVar1) + 8) = pvVar1; - (this->RestrictedGridIndexes)._size = 0; - pvVar1 = (this->RestrictedGridIndexes)._head; - (this->RestrictedGridIndexes)._head = (other->RestrictedGridIndexes)._head; - (other->RestrictedGridIndexes)._head = pvVar1; - setSize = (this->RestrictedGridIndexes)._size; - (this->RestrictedGridIndexes)._size = (other->RestrictedGridIndexes)._size; - (other->RestrictedGridIndexes)._size = setSize; - } - otherVector = &other->SavedEffects; - if (&this->SavedEffects != otherVector) { - msvc::vector::_Tidy(); - (this->SavedEffects)._begin = otherVector->_begin; - (this->SavedEffects)._end = (other->SavedEffects)._end; - (this->SavedEffects)._capacity = (other->SavedEffects)._capacity; - otherVector->_begin = (void *)0x0; - (other->SavedEffects)._end = (void *)0x0; - (other->SavedEffects)._capacity = (void *)0x0; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x94)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x94)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x96)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x96)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x98)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x98)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x9a)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x9a)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x9c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x9c)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x9e)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x9e)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa0)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa0)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa2)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa2)))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa4))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa4))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa5))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa5))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa6))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa6))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa7))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa7))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa8))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa8))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa9))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa9))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xaa))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xaa))); - (*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xab))) = (*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xab))); - this->ShopItemIdx = other->ShopItemIdx; - this->ShopItemDiscountIdx = other->ShopItemDiscountIdx; - this->DeliriumDistance = other->DeliriumDistance; - this->Group = other->Group; - return this; -} - -// 00749040 -RoomDescriptor * RoomDescriptor::copy_constructor(RoomDescriptor *other) -{ - uint32_t *puVar1; - uint32_t uVar2; - int iVar3; - int iVar4; - int iVar5; - uint32_t uVar6; - uint32_t uVar7; - uint32_t uVar8; - uint32_t byteCount; - void *pvVar9; - uint32_t *dstGridEntity; - uint32_t *srcGridEntity; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - std_set *restrictedGridIndexes; - uint32_t *srcGridEnd; - - local_14 = 0xffffffff; - puStack_18 = &LAB_00afdfc1; - local_1c = ExceptionList; - uVar8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; - ExceptionList = &local_1c; - this->GridIndex = other->GridIndex; - this->SafeGridIndex = other->SafeGridIndex; - this->ListIndex = other->ListIndex; - this->Dimension = other->Dimension; - this->Data = other->Data; - this->OverrideData = other->OverrideData; - this->AllowedDoors = other->AllowedDoors; - iVar3 = other->_doors[1]; - iVar4 = other->_doors[2]; - iVar5 = other->_doors[3]; - this->_doors[0] = other->_doors[0]; - this->_doors[1] = iVar3; - this->_doors[2] = iVar4; - this->_doors[3] = iVar5; - iVar3 = other->_doors[5]; - iVar4 = other->_doors[6]; - iVar5 = other->_doors[7]; - this->_doors[4] = other->_doors[4]; - this->_doors[5] = iVar3; - this->_doors[6] = iVar4; - this->_doors[7] = iVar5; - this->DisplayFlags = other->DisplayFlags; - this->VisitedCount = other->VisitedCount; - this->Flags = other->Flags; - this->TotalMoneySpent = other->TotalMoneySpent; - this->ClearCount = other->ClearCount; - this->GreedSubType = other->GreedSubType; - this->PoopCount = other->PoopCount; - this->TKeeperCoinSpawns = other->TKeeperCoinSpawns; - this->PitsCount = other->PitsCount; - this->DecorationSeed = other->DecorationSeed; - this->SpawnSeed = other->SpawnSeed; - this->AwardSeed = other->AwardSeed; - this->BossDeathSeed = other->BossDeathSeed; - (this->SavedGridEntities)._begin = (void *)0x0; - (this->SavedGridEntities)._end = (void *)0x0; - (this->SavedGridEntities)._capacity = (void *)0x0; - srcGridEnd = (other->SavedGridEntities)._end; - srcGridEntity = (other->SavedGridEntities)._begin; - if (srcGridEntity != srcGridEnd) { - byteCount = GHIDRA_INT(srcGridEnd) - GHIDRA_INT(srcGridEntity) >> 5; - if (0x7ffffff < byteCount) { - /* WARNING: Subroutine does not return */ - FUN_0040cee0(uVar8); - } - byteCount = byteCount * 0x20; - pvVar9 = msvc::_Allocate(byteCount); - (this->SavedGridEntities)._begin = pvVar9; - (this->SavedGridEntities)._end = pvVar9; - (this->SavedGridEntities)._capacity = (void *)(GHIDRA_INT(pvVar9) + byteCount); - dstGridEntity = (this->SavedGridEntities)._begin; - do { - uVar2 = srcGridEntity[1]; - uVar6 = srcGridEntity[2]; - uVar7 = srcGridEntity[3]; - *dstGridEntity = *srcGridEntity; - dstGridEntity[1] = uVar2; - dstGridEntity[2] = uVar6; - dstGridEntity[3] = uVar7; - puVar1 = srcGridEntity + 4; - uVar2 = srcGridEntity[5]; - uVar6 = srcGridEntity[6]; - uVar7 = srcGridEntity[7]; - srcGridEntity = srcGridEntity + 8; - dstGridEntity[4] = *puVar1; - dstGridEntity[5] = uVar2; - dstGridEntity[6] = uVar6; - dstGridEntity[7] = uVar7; - dstGridEntity = dstGridEntity + 8; - } while (srcGridEntity != srcGridEnd); - (this->SavedGridEntities)._end = dstGridEntity; - } - local_14 = 0; - FUN_00752830(&other->SavedEntities); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - restrictedGridIndexes = &this->RestrictedGridIndexes; - restrictedGridIndexes->_head = (void *)0x0; - (this->RestrictedGridIndexes)._size = 0; - pvVar9 = operator_new(0x14); - *(void **)pvVar9 = pvVar9; - *(void **)(GHIDRA_CAST(pvVar9) + 4) = pvVar9; - *(void **)(GHIDRA_CAST(pvVar9) + 8) = pvVar9; - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xc)) = 0x101; - restrictedGridIndexes->_head = pvVar9; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - std_set_uint_copy(restrictedGridIndexes,&other->RestrictedGridIndexes,GHIDRA_INT(this)); - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),3); - FUN_00752830(&other->SavedEffects); - uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x98)))); - uVar6 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x9c)))); - uVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa0)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x94)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x94)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x98)))) = uVar2; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x9c)))) = uVar6; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa0)))) = uVar7; - uVar2 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa8)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa4)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa8)))) = uVar2; - this->ShopItemIdx = other->ShopItemIdx; - this->ShopItemDiscountIdx = other->ShopItemDiscountIdx; - this->DeliriumDistance = other->DeliriumDistance; - this->Group = other->Group; - ExceptionList = local_1c; - return this; -} - -// 00752e80 -RoomDescriptor * RoomDescriptor::move_constructor(RoomDescriptor *other) -{ - void *pvVar1; - void *pvVar2; - uint32_t swappedListSize; - int iVar4; - int iVar5; - int iVar6; - uint32_t uVar7; - uint32_t uVar8; - void *pvVar9; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t swappedListSize; - - puStack_c = &LAB_00afe73b; - local_10 = ExceptionList; - ExceptionList = &local_10; - this->GridIndex = other->GridIndex; - this->SafeGridIndex = other->SafeGridIndex; - this->ListIndex = other->ListIndex; - this->Dimension = other->Dimension; - this->Data = other->Data; - this->OverrideData = other->OverrideData; - this->AllowedDoors = other->AllowedDoors; - iVar4 = other->_doors[1]; - iVar5 = other->_doors[2]; - iVar6 = other->_doors[3]; - this->_doors[0] = other->_doors[0]; - this->_doors[1] = iVar4; - this->_doors[2] = iVar5; - this->_doors[3] = iVar6; - iVar4 = other->_doors[5]; - iVar5 = other->_doors[6]; - iVar6 = other->_doors[7]; - this->_doors[4] = other->_doors[4]; - this->_doors[5] = iVar4; - this->_doors[6] = iVar5; - this->_doors[7] = iVar6; - this->DisplayFlags = other->DisplayFlags; - this->VisitedCount = other->VisitedCount; - this->Flags = other->Flags; - this->TotalMoneySpent = other->TotalMoneySpent; - this->ClearCount = other->ClearCount; - this->GreedSubType = other->GreedSubType; - this->PoopCount = other->PoopCount; - this->TKeeperCoinSpawns = other->TKeeperCoinSpawns; - this->PitsCount = other->PitsCount; - this->DecorationSeed = other->DecorationSeed; - this->SpawnSeed = other->SpawnSeed; - this->AwardSeed = other->AwardSeed; - this->BossDeathSeed = other->BossDeathSeed; - pvVar9 = (other->SavedGridEntities)._capacity; - pvVar1 = (other->SavedGridEntities)._end; - pvVar2 = (other->SavedGridEntities)._begin; - (other->SavedGridEntities)._capacity = (void *)0x0; - (other->SavedGridEntities)._end = (void *)0x0; - (other->SavedGridEntities)._begin = (void *)0x0; - (this->SavedGridEntities)._begin = pvVar2; - (this->SavedGridEntities)._end = pvVar1; - (this->SavedGridEntities)._capacity = pvVar9; - pvVar9 = (other->SavedEntities)._capacity; - pvVar1 = (other->SavedEntities)._end; - pvVar2 = (other->SavedEntities)._begin; - (other->SavedEntities)._capacity = (void *)0x0; - (other->SavedEntities)._end = (void *)0x0; - (other->SavedEntities)._begin = (void *)0x0; - (this->SavedEntities)._begin = pvVar2; - (this->SavedEntities)._end = pvVar1; - (this->SavedEntities)._capacity = pvVar9; - local_8 = 1; - (this->RestrictedGridIndexes)._head = (void *)0x0; - (this->RestrictedGridIndexes)._size = 0; - pvVar9 = operator_new(0x14); - *(void **)pvVar9 = pvVar9; - *(void **)(GHIDRA_CAST(pvVar9) + 4) = pvVar9; - *(void **)(GHIDRA_CAST(pvVar9) + 8) = pvVar9; - *GHIDRA_CAST((GHIDRA_CAST(pvVar9) + 0xc)) = 0x101; - (this->RestrictedGridIndexes)._head = pvVar9; - (this->RestrictedGridIndexes)._head = (other->RestrictedGridIndexes)._head; - (other->RestrictedGridIndexes)._head = pvVar9; - swappedListSize = (this->RestrictedGridIndexes)._size; - (this->RestrictedGridIndexes)._size = (other->RestrictedGridIndexes)._size; - (other->RestrictedGridIndexes)._size = swappedListSize; - pvVar9 = (other->SavedEffects)._end; - pvVar1 = (other->SavedEffects)._begin; - pvVar2 = (other->SavedEffects)._capacity; - (other->SavedEffects)._capacity = (void *)0x0; - (other->SavedEffects)._end = (void *)0x0; - (other->SavedEffects)._begin = (void *)0x0; - (this->SavedEffects)._begin = pvVar1; - (this->SavedEffects)._end = pvVar9; - (this->SavedEffects)._capacity = pvVar2; - swappedListSize = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x98)))); - uVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x9c)))); - uVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa0)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x94)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0x94)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x98)))) = swappedListSize; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x9c)))) = uVar7; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa0)))) = uVar8; - swappedListSize = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa8)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((other)) + 0xa4)))); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xa8)))) = swappedListSize; - this->ShopItemIdx = other->ShopItemIdx; - this->ShopItemDiscountIdx = other->ShopItemDiscountIdx; - this->DeliriumDistance = other->DeliriumDistance; - this->Group = other->Group; - ExceptionList = local_10; - return this; -} - -// 007e9190 -uint32_t RoomDescriptor::NoReward() -{ - return CONCAT31((uint3)(GHIDRA_UINT(this->Flags) >> 0xf),(char)(GHIDRA_UINT(this->Flags) >> 7)) & 0xffffff01; -} diff --git a/generated-src/room_transition.cpp b/generated-src/room_transition.cpp deleted file mode 100644 index 0e9d754..0000000 --- a/generated-src/room_transition.cpp +++ /dev/null @@ -1,2361 +0,0 @@ -#include "classes.h" - -// 0082ebd0 -RoomTransition::~RoomTransition() -{ - char cVar1; - uint32_t extraout_ECX; - RoomTransition *local_14; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - uint32_t *refSlot; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b01fe0; - local_10 = ExceptionList; - ExceptionList = &local_10; - local_14 = this; - KAGE::SmartPointer::reset(this); - KAGE::SmartPointer::reset(extraout_ECX); - refSlot = &this->_minecart; - if (*refSlot != 0) { - local_14 = GHIDRA_CAST(refSlot); - msvc::multiset::erase(&local_14); - *refSlot = 0; - } - msvc::map::_Erase_tree - (&this->_sprites,*GHIDRA_CAST((GHIDRA_INT((this->_sprites)._head) + 4))); - operator_delete((this->_sprites)._head,0x128); - local_8 = 1; - ANM2::Reset(&this->_versusScreenSprite); - AnimationState::~AnimationState(&(this->_versusScreenSprite)._overlayAnimState); - AnimationState::~AnimationState(&(this->_versusScreenSprite)._animState); - (GHIDRA_CAST(((this->_versusScreenSprite)._animDefaultName._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((GHIDRA_CAST(&this->_versusScreenSprite))))->msvc::string::_Tidy_deallocate(); - local_8 = 2; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x34)))) != GHIDRA_CAST(0x0)) { - cVar1 = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x34)))) + 0xc))(); - if ((cVar1 != '\0') && (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x30)))); - } - } - local_8 = 3; - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) != GHIDRA_CAST(0x0)) { - cVar1 = (**(code **)(**GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) + 0xc))(); - if ((cVar1 != '\0') && (g_renderTargetReleaseFn != (void *)0x0)) { - (*g_renderTargetReleaseFn)(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x28)))); - } - } - ExceptionList = local_10; - return; -} - -// 0082f1c0 -void RoomTransition::StartBossIntro(uint32_t bossID1, uint32_t bossID2) -{ - uint8_t bVar1; - char cVar2; - uint32_t uVar3; - std_string *psVar4; - LayerState *layer; - int iVar5; - Entity_Player *coopPlayer; - uint32_t uVar6; - uint32_t *puVar7; - int *piVar8; - uint32_t *texture; - RoomDescriptor *roomDesc; - uint8_t extraout_CL; - uint8_t extraout_CL_00; - uint8_t *texture; - void *pvVar10; - Game *pGVar11; - uint32_t *strEnd; - char *nameEnd; - uint8_t *pbVar12; - float extraout_ECX; - float extraout_ECX_00; - float fVar13; - Game *extraout_EDX; - Game *pGVar14; - Sprite *stageType; - uint8_t *pbVar15; - void **ppvVar16; - Sprite *versusSprite; - Game *pGVar17; - uint32_t uVar18; - uint32_t uVar19; - char *pcVar20; - uint32_t uVar21; - Game *local_7c; - char isAnm2LoadNeeded; - int *portraitTexture; - std_string *local_70; - Game *local_6c; - uint32_t cleanupFlags; - Sprite *local_64; - uint8_t local_5d; - std_string anm2Path; - std_string tmpString; - uint8_t local_2c; - uint8_t pixelGreen; - uint8_t pixelBlue; - Game *local_28; - uint32_t local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - ANM2 *versusAnm2; - - puStack_20 = GHIDRA_CAST((GHIDRA_INT(&tmpString) + 0x40)); - local_14 = 0xffffffff; - puStack_18 = &LAB_00b02107; - local_1c = ExceptionList; - uVar3 = __security_cookie ^ GHIDRA_UINT((GHIDRA_INT(&tmpString) + 0x34U)); - ExceptionList = &local_1c; - local_6c = GHIDRA_CAST(0x0); - cleanupFlags = 0; - this->_bossIntroBossId = bossID1; - local_7c = GHIDRA_CAST(this); - local_24 = uVar3; - texture = GHIDRA_CAST((GHIDRA_INT(&tmpString) + 0x40)); - if (*GHIDRA_CAST(this) != 0) { - (GHIDRA_CAST((GHIDRA_CAST(&g_manager->_musicManager))))->Music::Play(0x51,(g_manager->_optionsConfig)._musicVolume); - texture = puStack_20; - } - puStack_20 = texture; - FUN_007ea5d0(uVar3); - (g_game->_hud)._isVisible = 0; - anm2Path._size = 0; - anm2Path._capacity = 0xf; - anm2Path._buf[0] = '\0'; - anm2Path._buf[1] = '\0'; - anm2Path._buf[2] = '\0'; - anm2Path._buf[3] = '\0'; - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20); - anm2Path._size = 0x1d; - anm2Path._capacity = GHIDRA_UINT(&DAT_0000001f); - *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))))->_buf) = 0x2f786667; - *GHIDRA_CAST((GHIDRA_INT(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))))->_buf) + 4)) = 0x622f6975; - builtin_strncpy(GHIDRA_CAST((GHIDRA_INT(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))))->_buf) + 8)),"oss/",4); - builtin_strncpy(GHIDRA_CAST((GHIDRA_INT(((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))))->_buf) + 0xc)),"vers",4); - ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))))->_size = 0x63737375; - ((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))))->_capacity = 0x6e656572; - builtin_strncpy((GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + 0x18)))->_buf,".anm2",6); - local_14 = 0; - local_5d = 0; - if (bossID1 == 99) { - local_70 = GHIDRA_CAST(0x1f); - local_6c = GHIDRA_CAST(&DAT_0000002f); - local_70 = msvc::_Allocate(0x30); - anm2Path._size = 0x23; - anm2Path._capacity = GHIDRA_UINT(local_6c); - *GHIDRA_CAST(local_70->_buf) = 0x2f786667; - *GHIDRA_CAST((GHIDRA_CAST(local_70->_buf) + 4)) = 0x622f6975; - builtin_strncpy(GHIDRA_CAST((GHIDRA_INT(local_70->_buf) + 8)),"oss/",4); - builtin_strncpy(GHIDRA_CAST((GHIDRA_INT(local_70->_buf) + 0xc)),"vers",4); - local_70->_size = 0x63737375; - local_70->_capacity = 0x6e656572; - builtin_strncpy(local_70[1]._buf,"_dogma.anm2",0xc); - operator_delete((*GHIDRA_CAST((GHIDRA_CAST(&((void *)anm2Path._buf)) + 0x0))),0x20); - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = local_70; - local_5d = 1; - } - else if (bossID1 == 0x58) { - local_70 = GHIDRA_CAST(0x1f); - local_6c = GHIDRA_CAST(&DAT_0000002f); - local_70 = msvc::_Allocate(0x30); - anm2Path._capacity = GHIDRA_UINT(local_6c); - anm2Path._size = 0x24; - *GHIDRA_CAST(local_70->_buf) = 0x2f786667; - *GHIDRA_CAST((GHIDRA_CAST(local_70->_buf) + 4)) = 0x622f6975; - builtin_strncpy(GHIDRA_CAST((GHIDRA_INT(local_70->_buf) + 8)),"oss/",4); - builtin_strncpy(GHIDRA_CAST((GHIDRA_INT(local_70->_buf) + 0xc)),"vers",4); - local_70->_size = 0x63737375; - local_70->_capacity = 0x6e656572; - builtin_strncpy(local_70[1]._buf,"_mother.anm2",0xd); - operator_delete((*GHIDRA_CAST((GHIDRA_CAST(&((void *)anm2Path._buf)) + 0x0))),0x20); - (*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) = local_70; - } - if ((this->_versusScreenSprite)._loaded == 0) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); -LAB_0082f4e7: - isAnm2LoadNeeded = '\x01'; - } - else { - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string(&this->_versusScreenSprite); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - cleanupFlags = 9; - psVar4 = &anm2Path; - if (GHIDRA_CAST(&DAT_0000000f) < anm2Path._capacity) { - psVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))); - } - pbVar12 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar12 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - bVar1 = str_eq(pbVar12,tmpString._size,GHIDRA_CAST(psVar4),anm2Path._size); - if (bVar1 == 0) goto LAB_0082f4e7; - isAnm2LoadNeeded = '\0'; - } - if (((cleanupFlags & 1) != 0) && - (cleanupFlags = cleanupFlags & 0xfffffffe, &DAT_0000000f < tmpString._capacity)) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar12 = pbVar15; - if (GHIDRA_CAST(0xfff) < texture) { - pbVar12 = *GHIDRA_CAST((GHIDRA_CAST(pbVar15) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < pbVar15 + (-4 - GHIDRA_INT(pbVar12))) goto LAB_00830911; - } - operator_delete(pbVar12,GHIDRA_UINT(texture)); - } - local_64 = GHIDRA_CAST(&this->_versusScreenSprite); - if (isAnm2LoadNeeded != '\0') { - ANM2::Load(GHIDRA_CAST(local_64),&anm2Path,1); - } - if (bossID1 == 99) { - local_64 = GHIDRA_CAST(&this->_versusScreenSprite); - layer = ANM2::GetLayer(GHIDRA_CAST(local_64),&DAT_0000000b); - layer->_bitflags = layer->_bitflags | 0x60; - } - layer = ANM2::GetLayer(&this->_versusScreenSprite,&DAT_0000000b); - layer->_blendMode[0] = 0; - layer->_blendMode[1] = 4; - layer->_blendMode[2] = 7; - layer->_blendMode[3] = 4; - layer->_blendMode[4] = 7; - pvVar10 = (this->_sprites)._head; - msvc::map::_Erase_tree(&this->_sprites,*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 4))); - pGVar17 = g_game; - *(void **)(GHIDRA_CAST(pvVar10) + 4) = pvVar10; - *(void **)pvVar10 = pvVar10; - *(void **)(GHIDRA_CAST(pvVar10) + 8) = pvVar10; - (this->_sprites)._size = 0; - local_6c = (pGVar17->_playerManager)._roomTransitionPlayer; - if (local_6c == GHIDRA_CAST(0x0)) { - local_6c = GHIDRA_CAST(Game)::GetPlayer(pGVar17,0); - } - versusSprite = local_64; - iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_6c) + 0x13c0)); - if (iVar5 < 0) { -LAB_0082f7d9: - KAGE_LogMessage(1,GHIDRA_CAST("[warn] could not load player config for type %d.\n")); - versusSprite = local_64; - pGVar17 = local_7c; - } - else { - local_70 = (g_manager->_entityConfig)._players._begin; - if ((GHIDRA_INT((g_manager->_entityConfig)._players._end) - GHIDRA_INT(local_70)) / 0x148 <= iVar5) - goto LAB_0082f7d9; - psVar4 = GHIDRA_CAST((GHIDRA_INT(local_70) + iVar5 * 0x148)); - local_70 = psVar4; - if (psVar4 == GHIDRA_CAST(0x0)) goto LAB_0082f7d9; - layer = ANM2::GetLayer(GHIDRA_CAST(local_64),&DAT_00000005); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0xc)); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_0000000f); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x12)); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x15)); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x10)); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_00000013); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x16)); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_00000011); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_00000014); - layer->_visible = 0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_00000017); - pGVar17 = local_7c; - layer->_visible = 0; - FUN_00831780(psVar4,5,0xc,3); - (GHIDRA_CAST((versusSprite)))->Sprite::ReplaceSpritesheet(6,GHIDRA_CAST((local_70[2]._buf + 4))); - local_7c = GHIDRA_CAST(&g_game->_playerManager); - local_64 = GHIDRA_CAST(0x1); - iVar5 = PlayerManager::count_main_players(GHIDRA_CAST(local_7c)); - if (iVar5 != 0) { - uVar3 = 0; - do { - coopPlayer = PlayerManager::get_main_player(GHIDRA_CAST(local_7c),uVar3); - if (((coopPlayer != GHIDRA_CAST(0x0)) && (GHIDRA_CAST(coopPlayer) != local_6c)) && - (coopPlayer != *GHIDRA_CAST((GHIDRA_CAST(local_6c) + 0x1e68)))) { - local_70 = GHIDRA_CAST(coopPlayer->_playerType); - if ((GHIDRA_INT(local_70) < 0) || - ((GHIDRA_INT((g_manager->_entityConfig)._players._end) - - GHIDRA_INT((g_manager->_entityConfig)._players._begin)) / 0x148 <= GHIDRA_INT(local_70))) { - pvVar10 = (void *)0x0; - } - else { - pvVar10 = (void *)(GHIDRA_INT(local_70) * 0x148 + - GHIDRA_INT((g_manager->_entityConfig)._players._begin)); - } - if (local_64 == GHIDRA_CAST(0x1)) { - uVar21 = 0xf; - uVar19 = 0x15; - uVar18 = 0x12; -LAB_0082f7ac: - FUN_00831780(pvVar10,uVar18,uVar19,uVar21); - } - else { - if (local_64 == GHIDRA_CAST(0x2)) { - uVar21 = 0x10; - uVar19 = 0x16; - uVar18 = 0x13; - goto LAB_0082f7ac; - } - if (local_64 == GHIDRA_CAST(0x3)) { - uVar21 = 0x11; - uVar19 = 0x17; - uVar18 = 0x14; - goto LAB_0082f7ac; - } - KAGE_LogMessage(0x10,GHIDRA_CAST("Ran out of slots for players")); - } - local_64 = GHIDRA_CAST(((local_64->_filename)._buf + 1)); - } - uVar3 = uVar3 + 1; - local_7c = GHIDRA_CAST(&g_game->_playerManager); - uVar6 = PlayerManager::count_main_players(GHIDRA_CAST(local_7c)); - } while (uVar3 < uVar6); - versusSprite = GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)); - } - } - local_7c = GHIDRA_CAST(g_game->_stage); - local_28 = local_7c; - local_70 = GHIDRA_CAST(Level)::GetRoomStageType(GHIDRA_CAST(g_game),g_game->_currentRoomIdx); - local_6c = g_game; - local_64 = GHIDRA_CAST(local_70); - if (g_game->_currentRoomIdx == -0x11) { - Level::boss_count_adjust(GHIDRA_CAST(&local_7c),GHIDRA_CAST(&local_70)); - local_64 = GHIDRA_CAST(local_70); - pGVar11 = local_7c; - pGVar14 = extraout_EDX; - } - else { - pGVar11 = local_28; - pGVar14 = g_game; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(pGVar14->_room) + 8)) == 5) && - (*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pGVar14->_room) + 4)) + 0x10)) + 0x10)) == 0x5a)) { - pGVar11 = GHIDRA_CAST(0x8); - stageType = GHIDRA_CAST(GHIDRA_CAST(0x0)); - } - else { - stageType = local_64; - } - local_70 = &local_64->_filename; - local_7c = GHIDRA_CAST(RoomConfig)::GetStageID(GHIDRA_UINT(pGVar11),GHIDRA_UINT(stageType),-1); - local_28 = GHIDRA_CAST(g_manager); - if ((GHIDRA_INT(bossID1) < 0) || - ((GHIDRA_INT((g_manager->_entityConfig)._bosses._end) - GHIDRA_INT((g_manager->_entityConfig)._bosses._begin) - ) / 100 <= GHIDRA_INT(bossID1))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("BossID out of bounds\n")); - local_6c = g_game; - } - local_64 = GHIDRA_CAST((bossID1 * 100 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_28->_glowingHourglassStates[0])) + 0x3ca4)))))); - uVar3 = 0xffffffff; - if (local_6c != GHIDRA_CAST(0x0)) { - if (local_6c->_challenge == 0x2c) { - uVar6 = Level::GetRoomStageType(GHIDRA_CAST(local_6c),local_6c->_currentRoomIdx); - uVar3 = local_6c->_stage; - } - else { - if (local_6c->_currentDimensionIdx == 2) { - uVar3 = 0x23; - goto LAB_0082f917; - } - uVar6 = local_6c->_stageType; - uVar3 = local_6c->_stage; - } - uVar3 = RoomConfig::GetStageID(uVar3,uVar6,-1); - } -LAB_0082f917: - puVar7 = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x58)); - if (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))) { - do { - if (*puVar7 == uVar3) { - puVar7 = puVar7 + 1; - goto LAB_0082f933; - } - puVar7 = puVar7 + 7; - } while (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))); - } - puVar7 = GHIDRA_CAST((GHIDRA_INT(local_64) + 0x34)); -LAB_0082f933: - if (0xf < puVar7[5]) { - puVar7 = GHIDRA_CAST(*puVar7); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((GHIDRA_INT(puVar7) + 1)); - strEnd = puVar7; - do { - uVar3 = *strEnd; - strEnd = GHIDRA_CAST((GHIDRA_INT(strEnd) + 1)); - } while ((char)uVar3 != '\0'); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST(puVar7),GHIDRA_INT(strEnd) - GHIDRA_INT(local_28)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; - if (4 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa4))))) { - local_28 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - piVar8 = &local_28->_roomList[3].GreedSubType; - if (0xf < GHIDRA_UINT(local_28->_roomList[3].AwardSeed)) { - piVar8 = GHIDRA_CAST(local_28->_roomList[3].GreedSubType); - } - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - bVar1 = str_eq(pbVar15,tmpString._size,GHIDRA_CAST(piVar8),local_28->_roomList[3].SpawnSeed); - if (bVar1 == 0) { - piVar8 = &local_28->_roomList[3].GreedSubType; - pGVar11 = local_28; - if (GHIDRA_CAST(piVar8) != &tmpString) { - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - (GHIDRA_CAST((GHIDRA_CAST(piVar8))))->msvc::string::assign(pbVar15,tmpString._size); - pGVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - } - *GHIDRA_CAST(&pGVar11->_roomList[3].SavedEntities._begin) = 0; - } - } - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - uVar3 = 0xffffffff; - local_28 = g_game; - if (g_game != GHIDRA_CAST(0x0)) { - if (g_game->_challenge == 0x2c) { - uVar6 = Level::GetRoomStageType(GHIDRA_CAST(g_game),g_game->_currentRoomIdx); - uVar3 = local_28->_stage; - } - else { - if (g_game->_currentDimensionIdx == 2) { - uVar3 = 0x23; - goto LAB_0082fa81; - } - uVar6 = g_game->_stageType; - uVar3 = g_game->_stage; - } - uVar3 = RoomConfig::GetStageID(uVar3,uVar6,-1); - } -LAB_0082fa81: - puVar7 = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x58)); - if (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))) { - do { - if (*puVar7 == uVar3) { - puVar7 = puVar7 + 1; - goto LAB_0082faa3; - } - puVar7 = puVar7 + 7; - } while (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))); - } - puVar7 = GHIDRA_CAST((GHIDRA_INT(local_64) + 0x34)); -LAB_0082faa3: - if (0xf < puVar7[5]) { - puVar7 = GHIDRA_CAST(*puVar7); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((GHIDRA_INT(puVar7) + 1)); - strEnd = puVar7; - do { - uVar3 = *strEnd; - strEnd = GHIDRA_CAST((GHIDRA_INT(strEnd) + 1)); - } while ((char)uVar3 != '\0'); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST(puVar7),GHIDRA_INT(strEnd) - GHIDRA_INT(local_28)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; - if (0xd < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa4))))) { - local_28 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - piVar8 = local_28->_roomList[0xb]._doors + 4; - if (0xf < GHIDRA_UINT(local_28->_roomList[0xb].VisitedCount)) { - piVar8 = GHIDRA_CAST(local_28->_roomList[0xb]._doors[4]); - } - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - bVar1 = str_eq(pbVar15,tmpString._size,GHIDRA_CAST(piVar8),local_28->_roomList[0xb].DisplayFlags); - if (bVar1 == 0) { - piVar8 = local_28->_roomList[0xb]._doors + 4; - pGVar11 = local_28; - if (GHIDRA_CAST(piVar8) != &tmpString) { - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - (GHIDRA_CAST((GHIDRA_CAST(piVar8))))->msvc::string::assign(pbVar15,tmpString._size); - pGVar11 = versusSprite->_layerState; - } - *GHIDRA_CAST(&pGVar11->_roomList[0xb].PitsCount) = 0; - } - } - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - if (bossID2 == 0) { - uVar3 = 0xffffffff; - if (g_game != GHIDRA_CAST(0x0)) { - uVar3 = Game::GetStageID(g_game,(uint8_t)g_game); - } - puVar7 = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x58)); - if (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))) { - do { - if (*puVar7 == uVar3) { - puVar7 = puVar7 + 1; - goto LAB_0082fdd5; - } - puVar7 = puVar7 + 7; - } while (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))); - } - puVar7 = GHIDRA_CAST((GHIDRA_INT(local_64) + 0x34)); -LAB_0082fdd5: - if (0xf < puVar7[5]) { - puVar7 = GHIDRA_CAST(*puVar7); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((GHIDRA_INT(puVar7) + 1)); - strEnd = puVar7; - do { - uVar3 = *strEnd; - strEnd = GHIDRA_CAST((GHIDRA_INT(strEnd) + 1)); - } while ((char)uVar3 != '\0'); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST(puVar7),GHIDRA_INT(strEnd) - GHIDRA_INT(local_28)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 5; - if (9 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa4))))) { - local_28 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - ppvVar16 = &local_28->_roomList[7].SavedEffects._end; - if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_28->_roomList[7])) + 0xa0))))) { - ppvVar16 = local_28->_roomList[7].SavedEffects._end; - } - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - bVar1 = str_eq(pbVar15,tmpString._size,GHIDRA_CAST(ppvVar16), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_28->_roomList[7])) + 0x9c))))); - if (bVar1 == 0) { - ppvVar16 = &local_28->_roomList[7].SavedEffects._end; - pGVar11 = local_28; - if (GHIDRA_CAST(ppvVar16) != &tmpString) { - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - (GHIDRA_CAST((GHIDRA_CAST(ppvVar16))))->msvc::string::assign(pbVar15,tmpString._size); - pGVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - } - *GHIDRA_CAST(&pGVar11->_roomList[7].Group) = 0; - } - } - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - uVar3 = 0xffffffff; - if (g_game != GHIDRA_CAST(0x0)) { - uVar3 = Game::GetStageID(g_game,(uint8_t)g_game); - } - puVar7 = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x58)); - if (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))) { - do { - if (*puVar7 == uVar3) { - puVar7 = puVar7 + 1; - goto LAB_0082ff03; - } - puVar7 = puVar7 + 7; - } while (puVar7 != *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x5c))); - } - puVar7 = GHIDRA_CAST((GHIDRA_INT(local_64) + 0x34)); -LAB_0082ff03: - if (0xf < puVar7[5]) { - puVar7 = GHIDRA_CAST(*puVar7); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((GHIDRA_INT(puVar7) + 1)); - strEnd = puVar7; - do { - uVar3 = *strEnd; - strEnd = GHIDRA_CAST((GHIDRA_INT(strEnd) + 1)); - } while ((char)uVar3 != '\0'); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST(puVar7),GHIDRA_INT(strEnd) - GHIDRA_INT(local_28)); - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),6); - } - else { - local_28 = GHIDRA_CAST(g_manager); - if ((GHIDRA_INT(bossID2) < 0) || - ((GHIDRA_INT((g_manager->_entityConfig)._bosses._end) - - GHIDRA_INT((g_manager->_entityConfig)._bosses._begin)) / 100 <= GHIDRA_INT(bossID2))) { - KAGE_LogMessage(0x10,GHIDRA_CAST("BossID out of bounds\n")); - } - uVar3 = 0xffffffff; - local_70 = (std_string *) - (bossID2 * 100 + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_28->_glowingHourglassStates[0])) + 0x3ca4))))); - if (g_game != GHIDRA_CAST(0x0)) { - uVar3 = Game::GetStageID(g_game,(uint8_t)g_game); - } - puVar7 = GHIDRA_CAST(local_70[3]._size); - if (puVar7 != GHIDRA_CAST(local_70[3]._capacity)) { - do { - if (*puVar7 == uVar3) { - pcVar20 = GHIDRA_CAST((puVar7 + 1)); - goto LAB_0082fc23; - } - puVar7 = puVar7 + 7; - } while (puVar7 != GHIDRA_CAST(local_70[3]._capacity)); - } - pcVar20 = local_70[2]._buf + 4; -LAB_0082fc23: - if (0xf < *GHIDRA_CAST((pcVar20 + 0x14))) { - pcVar20 = *GHIDRA_CAST(pcVar20); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((pcVar20 + 1)); - nameEnd = pcVar20; - do { - cVar2 = *nameEnd; - nameEnd = nameEnd + 1; - } while (cVar2 != '\0'); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST(pcVar20),GHIDRA_INT(nameEnd) - GHIDRA_INT(local_28)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 3; - if (9 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa4))))) { - local_28 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - ppvVar16 = &local_28->_roomList[7].SavedEffects._end; - if (0xf < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_28->_roomList[7])) + 0xa0))))) { - ppvVar16 = local_28->_roomList[7].SavedEffects._end; - } - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - bVar1 = str_eq(pbVar15,tmpString._size,GHIDRA_CAST(ppvVar16), - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_28->_roomList[7])) + 0x9c))))); - if (bVar1 == 0) { - ppvVar16 = &local_28->_roomList[7].SavedEffects._end; - pGVar11 = local_28; - if (GHIDRA_CAST(ppvVar16) != &tmpString) { - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - (GHIDRA_CAST((GHIDRA_CAST(ppvVar16))))->msvc::string::assign(pbVar15,tmpString._size); - pGVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - } - *GHIDRA_CAST(&pGVar11->_roomList[7].Group) = 0; - } - } - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - uVar3 = 0xffffffff; - if (g_game != GHIDRA_CAST(0x0)) { - uVar3 = Game::GetStageID(g_game,(uint8_t)g_game); - } - puVar7 = GHIDRA_CAST(local_70[3]._size); - if (puVar7 != GHIDRA_CAST(local_70[3]._capacity)) { - do { - if (*puVar7 == uVar3) { - pcVar20 = GHIDRA_CAST((puVar7 + 1)); - goto LAB_0082fd47; - } - puVar7 = puVar7 + 7; - } while (puVar7 != GHIDRA_CAST(local_70[3]._capacity)); - } - pcVar20 = local_70[2]._buf + 4; -LAB_0082fd47: - if (0xf < *GHIDRA_CAST((pcVar20 + 0x14))) { - pcVar20 = *GHIDRA_CAST(pcVar20); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((pcVar20 + 1)); - nameEnd = pcVar20; - do { - cVar2 = *nameEnd; - nameEnd = nameEnd + 1; - } while (cVar2 != '\0'); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST(pcVar20),GHIDRA_INT(nameEnd) - GHIDRA_INT(local_28)); - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),4); - } - if (0xe < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa4))))) { - local_28 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - ppvVar16 = &local_28->_roomList[0xc].OverrideData; - if (0xf < GHIDRA_UINT(local_28->_roomList[0xc]._doors[3])) { - ppvVar16 = local_28->_roomList[0xc].OverrideData; - } - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - bVar1 = str_eq(pbVar15,tmpString._size,GHIDRA_CAST(ppvVar16),local_28->_roomList[0xc]._doors[2]); - if (bVar1 == 0) { - ppvVar16 = &local_28->_roomList[0xc].OverrideData; - pGVar11 = local_28; - if (GHIDRA_CAST(ppvVar16) != &tmpString) { - pbVar15 = GHIDRA_CAST(&tmpString); - if (&DAT_0000000f < tmpString._capacity) { - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - } - (GHIDRA_CAST((GHIDRA_CAST(ppvVar16))))->msvc::string::assign(pbVar15,tmpString._size); - pGVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(pGVar17->_roomList[0])) + 0xa0)))); - } - *GHIDRA_CAST(&pGVar11->_roomList[0xc].DisplayFlags) = 0; - } - } - local_14 = local_14 & 0xffffff00; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - if (bossID1 == 0x28) { - local_70 = GHIDRA_CAST(&(g_game->_seedEffects)._seedEffects); - local_28 = GHIDRA_CAST(&DAT_0000004f); - msvc::set::find_node(GHIDRA_CAST((GHIDRA_INT(&tmpString) + 0xc)),&local_28); - if ((*GHIDRA_CAST((tmpString._capacity + 0xd)) != '\0') || - (0x4f < *GHIDRA_CAST((tmpString._capacity + 0x10)))) { - tmpString._capacity = *GHIDRA_CAST(local_70->_buf); - } - if (GHIDRA_CAST(tmpString._capacity) != *GHIDRA_CAST(local_70->_buf)) { - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST("gfx/promo/gfuel/ui/boss/g fuel bluebaby portrait.png"),0x34); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 7; - (GHIDRA_CAST((versusSprite)))->Sprite::ReplaceSpritesheet(4,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) - goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST("gfx/promo/gfuel/ui/boss/g fuel bluebaby portrait.png"),0x34); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 8; - (GHIDRA_CAST((versusSprite)))->Sprite::ReplaceSpritesheet(0xd,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) - goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - } - } - pbVar15 = GHIDRA_CAST((GHIDRA_INT(local_64) + 0x1c)); - if (0xf < *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x30))) { - pbVar15 = *GHIDRA_CAST(pbVar15); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((pbVar15 + 1)); - pbVar12 = pbVar15; - do { - bVar1 = *pbVar12; - pbVar12 = pbVar12 + 1; - } while (bVar1 != 0); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(pbVar15,GHIDRA_INT(pbVar12) - GHIDRA_INT(local_28)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 9; - (GHIDRA_CAST((versusSprite)))->Sprite::ReplaceSpritesheet(7,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - } - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_00000004); - (layer->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x4c)); - (layer->_pos).y = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x50)); - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_0000000d); - (layer->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x4c)); - (layer->_pos).y = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x50)); - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_00000009); - (layer->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x4c)); - (layer->_pos).y = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x50)); - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_0000000e); - (layer->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x4c)); - fVar13 = *GHIDRA_CAST((GHIDRA_CAST(local_64) + 0x50)); - (layer->_pos).y = fVar13; - if (local_5d == 0) { - iVar5 = GHIDRA_INT(local_7c) * 0xc4; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string(g_game->_ventricleRazorPortals + iVar5 + 0x5b4); - cleanupFlags = cleanupFlags | 0x10; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 10; - (GHIDRA_CAST((GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)))))->Sprite::ReplaceSpritesheet(3,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string(g_game->_ventricleRazorPortals + iVar5 + 0x5b4); - cleanupFlags = cleanupFlags | 0x20; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xb; - (GHIDRA_CAST((GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)))))->Sprite::ReplaceSpritesheet(0xf,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string(g_game->_ventricleRazorPortals + iVar5 + 0x5b4); - cleanupFlags = cleanupFlags | 0x40; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xc; - (GHIDRA_CAST((GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)))))->Sprite::ReplaceSpritesheet(0x10,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string(g_game->_ventricleRazorPortals + iVar5 + 0x5b4); - cleanupFlags = cleanupFlags | 0x80; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xd; - (GHIDRA_CAST((GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)))))->Sprite::ReplaceSpritesheet(0x11,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::_Tidy_deallocate(); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::string(g_game->_ventricleRazorPortals + iVar5 + 0x5cc); - cleanupFlags = cleanupFlags | 0x100; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xe; - versusSprite = GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)); - (GHIDRA_CAST((versusSprite)))->Sprite::ReplaceSpritesheet(2,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - (GHIDRA_CAST((tmpString._buf)))->msvc::string::_Tidy_deallocate(); - local_5d = bossID1 != 0x37; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x2)); - layer->_visible = local_5d; - fVar13 = extraout_ECX; - } - if (bossID1 == 0x58) { - pbVar15 = GHIDRA_CAST(FUN_0069d250(fVar13)); - if (0xf < *GHIDRA_CAST((pbVar15 + 0x14))) { - pbVar15 = *GHIDRA_CAST(pbVar15); - } - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - local_28 = GHIDRA_CAST((pbVar15 + 1)); - pbVar12 = pbVar15; - do { - bVar1 = *pbVar12; - pbVar12 = pbVar12 + 1; - } while (bVar1 != 0); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(pbVar15,GHIDRA_INT(pbVar12) - GHIDRA_INT(local_28)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0xf; - (GHIDRA_CAST((versusSprite)))->Sprite::ReplaceSpritesheet(0x18,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - fVar13 = extraout_ECX_00; - if (tmpString._capacity < GHIDRA_CAST(0x10)) goto LAB_0083066a; - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - ANM2::LoadGraphics(GHIDRA_CAST(versusSprite),(uint8_t)texture); -LAB_0083041c: - layer = ANM2::GetLayer(GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)),GHIDRA_CAST(0x2)); - piVar8 = LayerState::GetTexture(layer,&portraitTexture); - local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),0x10); - local_6c = GHIDRA_CAST((cleanupFlags | 2)); - cleanupFlags = GHIDRA_UINT(local_6c); - if (*piVar8 == 0) { -LAB_0083047c: - local_5d = 0; - } - else { - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x2)); - texture = LayerState::GetTexture(layer,&local_2c); - local_14 = 0x11; - local_6c = GHIDRA_CAST((cleanupFlags | 4)); - cleanupFlags = GHIDRA_UINT(local_6c); - cVar2 = (*(code *)**GHIDRA_CAST(*texture))(); - local_5d = 1; - if (cVar2 == '\0') goto LAB_0083047c; - } - if ((cleanupFlags & 4) != 0) { - local_6c = GHIDRA_CAST((cleanupFlags & 0xfffffffb)); - local_14 = 0x12; - cleanupFlags = GHIDRA_UINT(local_6c); - if (((local_28 != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(GHIDRA_CAST(local_28->_stage) + 0xc))(), cVar2 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(&local_2c); - } - } - local_14 = 0; - if ((cleanupFlags & 2) != 0) { - local_14 = 0x13; - if (((local_70 != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(GHIDRA_INT(*(void **))local_70->_buf + 0xc))(), cVar2 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(&portraitTexture); - } - local_14 = local_14 & 0xffffff00; - } - versusAnm2 = GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)); - if (local_5d == 0) { - layer = ANM2::GetLayer(versusAnm2,GHIDRA_CAST(0x0)); - (layer->_color)._tint[0] = 0.0; - (layer->_color)._tint[1] = 0.0; - (layer->_color)._tint[2] = 0.0; - (layer->_color)._tint[3] = 1.0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_0000000d); - (layer->_color)._tint[0] = 1.0; - (layer->_color)._tint[1] = 0.5568628; - (layer->_color)._tint[2] = 0.4666667; - (layer->_color)._tint[3] = 1.0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_0000000e); - (layer->_color)._tint[0] = 1.0; - (layer->_color)._tint[1] = 0.5568628; - (layer->_color)._tint[2] = 0.4666667; - (layer->_color)._tint[3] = 1.0; - } - else { - layer = ANM2::GetLayer(versusAnm2,GHIDRA_CAST(0x2)); - LayerState::GetTexture(layer,&portraitTexture); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x14; - (**(code **)(*portraitTexture + 0x30))(0,0,2,1,&local_2c); - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x0)); - (layer->_color)._tint[3] = 1.0; - (layer->_color)._tint[0] = (float)local_2c * 0.003921569; - (layer->_color)._tint[1] = (float)pixelGreen * 0.003921569; - (layer->_color)._tint[2] = (float)pixelBlue * 0.003921569; - layer = ANM2::GetLayer(GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)),&DAT_0000000d); - (layer->_color)._tint[3] = 1.0; - (layer->_color)._tint[0] = (float)((GHIDRA_UINT(local_28) & 0xff) * 2) * 0.003921569; - (layer->_color)._tint[1] = (float)((GHIDRA_UINT(local_28) >> 8 & 0xff) * 2) * 0.003921569; - (layer->_color)._tint[2] = (float)((GHIDRA_UINT(local_28) >> 0x10 & 0xff) * 2) * 0.003921569; - layer = ANM2::GetLayer(GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)),&DAT_0000000e); - (layer->_color)._tint[0] = (float)((GHIDRA_UINT(local_28) & 0xff) * 2) * 0.003921569; - (layer->_color)._tint[1] = (float)((GHIDRA_UINT(local_28) >> 8 & 0xff) * 2) * 0.003921569; - (layer->_color)._tint[2] = (float)((GHIDRA_UINT(local_28) >> 0x10 & 0xff) * 2) * 0.003921569; - (layer->_color)._tint[3] = 1.0; - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x15; - if (((local_70 != GHIDRA_CAST(0x0)) && - (cVar2 = (**(code **)(GHIDRA_INT(*(void **))local_70->_buf + 0xc))(), cVar2 != '\0')) && - (g_imageReleaseFn != (void *)0x0)) { - (*g_imageReleaseFn)(&portraitTexture); - } - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - versusSprite = GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)); - } - if (bossID1 == 0x37) { - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),GHIDRA_CAST(0x0)); - (layer->_color)._tint[0] = 0.0; - (layer->_color)._tint[1] = 0.0; - (layer->_color)._tint[2] = 0.0; - goto LAB_0083077d; - } - } - else { -LAB_0083066a: - ANM2::LoadGraphics(GHIDRA_CAST(versusSprite),SUB41(fVar13,0)); - if (bossID1 != 99) goto LAB_0083041c; - layer = ANM2::GetLayer(GHIDRA_CAST((pGVar17->_roomList[0]._doors + 2)),GHIDRA_CAST(0x0)); - (layer->_color)._tint[0] = 1.0; - (layer->_color)._tint[1] = 1.0; - (layer->_color)._tint[2] = 1.0; - (layer->_color)._tint[3] = 1.0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_0000000d); - (layer->_color)._tint[0] = 1.0; - (layer->_color)._tint[1] = 1.0; - (layer->_color)._tint[2] = 1.0; - (layer->_color)._tint[3] = 1.0; - layer = ANM2::GetLayer(GHIDRA_CAST(versusSprite),&DAT_0000000e); - (layer->_color)._tint[0] = 1.0; - (layer->_color)._tint[1] = 1.0; - (layer->_color)._tint[2] = 1.0; -LAB_0083077d: - (layer->_color)._tint[3] = 1.0; - } - roomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),pGVar17->_roomList[0].GridIndex,-1); - local_28 = GHIDRA_CAST(&roomDesc->Data); - pvVar10 = *(void **)local_28; - if (pvVar10 == (void *)0x0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("Room Data is NULL in RoomTransition::change_room.\n")); - pvVar10 = (void *)local_28->_stage; - } - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 8)) == 5) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar10) + 0xc)) - 0xe74U < 0x96)) { - tmpString._size = 0; - tmpString._capacity = GHIDRA_UINT(&DAT_0000000f); - (*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) = GHIDRA_CAST(0x0); - (GHIDRA_CAST((tmpString._buf)))->msvc::string::assign(GHIDRA_CAST("gfx/ui/boss/doubletrouble.png"),0x1d); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 0x16; - (GHIDRA_CAST((versusSprite)))->Sprite::ReplaceSpritesheet(10,&tmpString); - local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; - bVar1 = extraout_CL; - if (&DAT_0000000f < tmpString._capacity) { - texture = GHIDRA_CAST((tmpString._capacity + 1)); - pbVar15 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(tmpString._buf))) + 0x0))); - if (GHIDRA_CAST(0xfff) < texture) { - pbVar15 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + 0xfffffffc)); - texture = GHIDRA_CAST((tmpString._capacity + 0x24)); - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(tmpString._buf)) + 0x0))) + (-4 - GHIDRA_INT(pbVar15))))) goto LAB_00830911; - } - operator_delete(pbVar15,GHIDRA_UINT(texture)); - bVar1 = extraout_CL_00; - } - ANM2::LoadGraphics(GHIDRA_CAST(versusSprite),bVar1); - if ((g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) || - (uVar3 = PlayerManager::count_main_players(&g_game->_playerManager), uVar3 < 2)) { - pcVar20 = "DoubleTrouble"; - goto LAB_008308ce; - } - ANM2::Play(GHIDRA_CAST(versusSprite),GHIDRA_CAST("DoubleTroubleCoop"),1); - } - else if ((g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) || - (uVar3 = PlayerManager::count_main_players(&g_game->_playerManager), uVar3 < 2)) { - pcVar20 = "Scene"; -LAB_008308ce: - bVar1 = ANM2::SetAnimation(GHIDRA_CAST(versusSprite),GHIDRA_CAST(pcVar20),1); - if (bVar1 != 0) { - AnimationState::Rewind(&versusSprite->_animState); - (versusSprite->_animState)._isPlaying = 1; - } - } - else { - ANM2::Play(GHIDRA_CAST(versusSprite),GHIDRA_CAST("SceneCoop"),1); - } - pGVar17->_stage = 2; - if (GHIDRA_CAST(&DAT_0000000f) < anm2Path._capacity) { - ppvVar16 = (void **)(GHIDRA_INT(GHIDRA_CAST(anm2Path._capacity)) + 1); - psVar4 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(anm2Path._buf))) + 0x0))); - if ((void **)0xfff < ppvVar16) { - psVar4 = GHIDRA_CAST((GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + -0x18)))->_capacity); - ppvVar16 = &(GHIDRA_CAST((anm2Path._capacity + 0x14)))->Data; - if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar4))))) { -LAB_00830911: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(psVar4,GHIDRA_UINT(ppvVar16)); - } - ExceptionList = local_1c; - return; -} - -// 00830950 -void RoomTransition::ChangeRoom() -{ - uint64_t qVar1; - uint8_t isAnimSet; - RoomDescriptor *currentRoomDesc; - uint32_t uVar2; - int iVar3; - float *pfVar4; - uint32_t randomValue; - uint32_t *puVar5; - void *pvVar6; - int iVar7; - float fVar8; - uint64_t *allocCounter; - Game *game; - PlayerManager *playerManager; - float *playerIt; - float player; - Entity_Player *pEVar9; - int *piVar10; - uint8_t familiars [12]; - float fStack_60; - uint64_t local_5c; - float local_54; - Vector local_50; - Vector local_48; - ANM2 *local_40; - float local_3c; - RoomDescriptor *local_38; - RoomTransition *transition; - Entity_Player *local_30; - int *local_2c; - float local_28; - float local_24; - uint8_t *puStack_20; - void *local_1c; - uint8_t *puStack_18; - uint32_t local_14; - ANM2 *playerSprite; - Room *room; - int roomWidth; - GridEntity *teleporter; - - puStack_20 = familiars + 0x68; - local_14 = 0xffffffff; - puStack_18 = &LAB_00b02130; - local_1c = ExceptionList; - ExceptionList = &local_1c; - local_24 = g_vectorZero.x; - local_3c = (float)g_game->_currentRoomIdx; - local_28 = g_vectorZero.y; - transition = this; - currentRoomDesc = Level::GetRoomByIdx(GHIDRA_CAST(g_game),GHIDRA_INT(local_3c),g_game->_currentDimensionIdx); - local_38 = Level::GetRoomByIdx(GHIDRA_CAST(g_game),this->_targetRoomIdx,this->_targetDimension); - if (((this->_targetRoomIdx < 0) || (GHIDRA_INT(local_3c) < 0)) || - (currentRoomDesc->Dimension != local_38->Dimension)) { - switch(this->_direction) { - case 0: - local_24 = -(float)*GHIDRA_CAST((GHIDRA_CAST(local_38->Data) + 0x46)) * 26.0; - break; - case 1: - local_28 = -(float)*GHIDRA_CAST((GHIDRA_CAST(local_38->Data) + 0x47)) * 26.0; - break; - case 2: - local_24 = (float)*GHIDRA_CAST((GHIDRA_CAST(currentRoomDesc->Data) + 0x46)) * 26.0; - break; - case 3: - local_28 = (float)*GHIDRA_CAST((GHIDRA_CAST(currentRoomDesc->Data) + 0x47)) * 26.0; - } - } - else { - local_3c = (float)(currentRoomDesc->GridIndex % 0xd); - local_24 = (float)((local_38->GridIndex % 0xd - GHIDRA_INT(local_3c)) * 0xd) * 26.0; - local_28 = (float)((local_38->GridIndex / 0xd - currentRoomDesc->GridIndex / 0xd) * 7) * 26.0; - this = transition; - } - if (((g_game->_currentDimensionIdx == 1) && - ((g_game->_stageType == 4 || (g_game->_stageType == 5)))) && - ((g_game->_stage == 2 || - ((g_game->_stage == 1 && (uVar2 = Level::GetCurses(GHIDRA_CAST(g_game)), (uVar2 & 2) != 0)))))) { - local_24 = local_24 * -1.0; - } - game = g_game; - local_2c = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1204)); - local_30 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1208)); - if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) && - (piVar10 = (g_game->_playerManager)._playerList._begin, - piVar10 != (g_game->_playerManager)._playerList._end)) { - do { - iVar7 = *piVar10; - piVar10 = piVar10 + 1; - *GHIDRA_CAST((iVar7 + 0x410)) = 1; - } while (piVar10 != (game->_playerManager)._playerList._end); - } - if (this->_animation == 0xc) { - Game::rewind((game->_playerManager)._roomTransitionPlayer); - } - else { - if (this->_direction == -1) { - game->_leaveDoor = -1; - } - Game::ChangeRoom(game,this->_targetRoomIdx,this->_targetDimension); - } - game = g_game; - piVar10 = (g_game->_playerManager)._playerList._begin; - if (piVar10 != (g_game->_playerManager)._playerList._end) { - do { - iVar7 = *piVar10; - piVar10 = piVar10 + 1; - *GHIDRA_CAST((iVar7 + 0x410)) = 0; - } while (piVar10 != (game->_playerManager)._playerList._end); - } - local_38 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1204)); - local_3c = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x1208)); - if (this->_animation != 0) goto switchD_00830c6b_default; - if ((game->_currentDimensionIdx == 1) && ((game->_stageType == 4 || (game->_stageType == 5)))) { - if (game->_stage != 2) { - if (game->_stage == 1) { - uVar2 = Level::GetCurses(GHIDRA_CAST(game)); - game = g_game; - if ((uVar2 & 2) != 0) goto LAB_00830c5f; - } - goto LAB_00830cb4; - } -LAB_00830c5f: - switch(this->_direction) { - case 0: - (this->_slideOffset).x = (((float)local_2c - (float)local_38) - g_screenWidth) - local_24; - break; - case 1: - goto switchD_00830c6b_caseD_1; - case 2: - (this->_slideOffset).x = (((float)local_38 - (float)local_2c) - g_screenWidth) + local_24; - break; - case 3: - goto switchD_00830c6b_caseD_3; - } - } - else { -LAB_00830cb4: - switch(this->_direction) { - case 0: - (this->_slideOffset).x = (((float)local_38 - (float)local_2c) - g_screenWidth) - local_24; - break; - case 1: -switchD_00830c6b_caseD_1: - (this->_slideOffset).y = ((local_3c - (float)local_30) - g_screenHeight) - local_28; - break; - case 2: - (this->_slideOffset).x = (((float)local_2c - (float)local_38) - g_screenWidth) + local_24; - break; - case 3: -switchD_00830c6b_caseD_3: - (this->_slideOffset).y = (((float)local_30 - local_3c) - g_screenHeight) + local_28; - } - } -switchD_00830c6b_default: - local_30 = (game->_playerManager)._roomTransitionPlayer; - if (local_30 == GHIDRA_CAST(0x0)) { - local_30 = Game::GetPlayer(game,0); - game = g_game; - } - room = game->_room; - local_38 = GHIDRA_CAST(room->_bossId); - local_3c = (float)room->_secondBossID; - if (local_38 == GHIDRA_CAST(0x0)) { -LAB_00830d9d: - piVar10 = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x10)); - if ((((*piVar10 == 0x23) && (piVar10[2] == 1)) && (piVar10[3] == 1000)) && - ((*GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x4)))) + 0x44)) & 1) == 0)) { - StartBossIntro(this,99,0); - goto LAB_00830dda; - } - if (*GHIDRA_CAST(&game->_deathmatchManager) < 2) { - (GHIDRA_CAST((room)))->Room::PlayMusic(); - goto LAB_00830dda; - } - } - else { - iVar3 = room->_aliveBossCount + *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((room)) + 0x12cc)))); - iVar7 = 0; - if (0 < iVar3) { - iVar7 = iVar3; - } - if (iVar7 < 1) goto LAB_00830d9d; - StartBossIntro(this,GHIDRA_UINT(local_38),GHIDRA_UINT(local_3c)); -LAB_00830dda: - game = g_game; - } - iVar7 = this->_animation; - if (((iVar7 == 3) || (iVar7 == 0xc)) || (iVar7 == 0xd)) { -LAB_00830e96: - if (iVar7 != 0xb) { - if (iVar7 == 0x11) { - puVar5 = (game->_playerManager)._playerList._begin; - if (puVar5 != (game->_playerManager)._playerList._end) { - do { - pEVar9 = GHIDRA_CAST(*puVar5); - if ((pEVar9 != GHIDRA_CAST(0x0)) && - ((game->_playerManager)._roomTransitionPlayer == pEVar9)) { - Entity_Player::Teleport(pEVar9,&pEVar9->_forgottenBodyPos,0,0); - game = g_game; - } - puVar5 = puVar5 + 1; - } while (puVar5 != (game->_playerManager)._playerList._end); - } - } - else if (iVar7 == 0x14) { - if (game->_currentDimensionIdx == 2) { - iVar7 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - if ((iVar7 < 0xb) || (*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x10)) < 5)) { - iVar3 = -1; - } - else { - iVar3 = iVar7 * 4 + 10; - } - fVar8 = 0.0; - playerIt = (g_game->_playerManager)._playerList._begin; - pEVar9 = GHIDRA_CAST(((float)(iVar3 % iVar7) * 40.0 + 40.0)); - piVar10 = GHIDRA_CAST(((float)(iVar3 / iVar7) * 40.0 + 120.0)); - game = g_game; - local_30 = pEVar9; - local_2c = piVar10; - if (playerIt != (g_game->_playerManager)._playerList._end) { - do { - local_50.y = *playerIt; - if (GHIDRA_CAST(local_50.y) != GHIDRA_CAST(0x0)) { - local_48.y = (float)(GHIDRA_INT(fVar8) + 1); - if (fVar8 != 0.0) { - uVar2 = Random(); - fVar8 = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)] - ) * 2.3283064e-10 * 3.14; - fVar8 = fVar8 + fVar8; - local_5c = CONCAT44(fVar8,(uint32_t)local_5c); - local_54 = sin(fVar8); - fVar8 = cos((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_5c)) + 0x4)))); - pEVar9 = GHIDRA_CAST((fVar8 * 10.0 + (float)local_30)); - piVar10 = GHIDRA_CAST((local_54 * 10.0 + (float)local_2c)); - } - fVar8 = local_50.y; - (GHIDRA_CAST((GHIDRA_INT(local_50.y) + 0x33c)))->x = (float)pEVar9; - (GHIDRA_CAST((GHIDRA_INT(local_50.y) + 0x33c)))->y = (float)piVar10; - (GHIDRA_CAST((GHIDRA_CAST(local_50.y))))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Appear")); - if (((GHIDRA_CAST((GHIDRA_INT(fVar8) + 0x48)))->_animState)._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(GHIDRA_CAST((GHIDRA_INT(fVar8) + 0x48)))->_animState,2.0); - } - *GHIDRA_CAST((GHIDRA_CAST(fVar8) + 0x410)) = 0; - fVar8 = local_48.y; - game = g_game; - piVar10 = local_2c; - pEVar9 = local_30; - } - playerIt = playerIt + 1; - } while (playerIt != (game->_playerManager)._playerList._end); - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST(familiars),3,0xee,-1, - 0,0); - fVar8 = 0.0; - if (fStack_60 != 0.0) { - do { - iVar7 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + GHIDRA_INT(fVar8) * 4)); - fVar8 = (float)(GHIDRA_INT(fVar8) + 1); - *GHIDRA_CAST((iVar7 + 0x33c)) = local_30; - *GHIDRA_CAST((iVar7 + 0x340)) = local_2c; - } while (GHIDRA_UINT(fVar8) < GHIDRA_UINT(fStack_60)); - } - if (familiars[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&((void *)familiars)) + 0x4))) != (void *)0x0) { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - qVar1 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2)); - free((void *)((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - } -LAB_00831623: - local_14 = 0xffffffff; - } - } - else { - puVar5 = (game->_playerManager)._playerList._begin; - if (puVar5 != (game->_playerManager)._playerList._end) { - do { - pEVar9 = GHIDRA_CAST(*puVar5); - if (pEVar9 != GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((pEVar9)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Appear")); - if ((pEVar9->_sprite)._animState._animData != (void *)0x0) { - AnimationState::SetFrameFloat(&(pEVar9->_sprite)._animState,2.0); - } - game = g_game; - pEVar9->_isControlsEnabled = 0; - } - puVar5 = puVar5 + 1; - } while (puVar5 != (game->_playerManager)._playerList._end); - } - } - } - else if ((iVar7 == 3) && (0 < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20)))))) { - pvVar6 = game->_room; - if ((*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 8)) == 0x19) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 8)) == 0x1a)) { - iVar7 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x20)))) + -1; - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x10)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0xc)); - uVar2 = 0; - if (0 < iVar3) { - puVar5 = GHIDRA_CAST((GHIDRA_INT(pvVar6) + 0x24)); -LAB_00831497: - if ((((0x1bf < uVar2) || - (teleporter = GHIDRA_CAST(*puVar5), teleporter == GHIDRA_CAST(0x0))) || - (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((teleporter)) + 0x4)))) != 0x17)) || - ((-1 < iVar7 && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((teleporter)) + 0x8)))) != iVar7)))) goto LAB_008314b3; - (GHIDRA_CAST((teleporter)))->GridEntity::Position(&local_50); - Entity_Player::Teleport(local_30,&local_50,0,0); - if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((teleporter)) + 0xc)))) == 0) { - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((teleporter)) + 0xc)))) = 1; - } - uVar2 = 0; - if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { - do { - pEVar9 = Game::GetPlayer(g_game,uVar2); - if (pEVar9 != local_30) { - randomValue = Random(); - fVar8 = (float)((double)GHIDRA_INT(randomValue) + - __uint_to_double_fixup[-(GHIDRA_INT(randomValue) >> 0x1f)]) * - 2.3283064e-10 * 3.14; - fVar8 = fVar8 + fVar8; - local_5c = CONCAT44(fVar8,(uint32_t)local_5c); - local_54 = sin(fVar8); - fVar8 = cos((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_5c)) + 0x4)))); - local_48.x = fVar8 * 10.0 + local_50.x; - local_48.y = local_54 * 10.0 + local_50.y; - Entity_Player::Teleport(pEVar9,&local_48,0,0); - } - uVar2 = uVar2 + 1; - } while (uVar2 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(familiars),3,0xee - ,-1,0,0); - fVar8 = 0.0; - if (fStack_60 != 0.0) { - do { - iVar7 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + GHIDRA_INT(fVar8) * 4)); - fVar8 = (float)(GHIDRA_INT(fVar8) + 1); - *GHIDRA_CAST((iVar7 + 0x33c)) = local_50.x; - *GHIDRA_CAST((iVar7 + 0x340)) = local_50.y; - } while (GHIDRA_UINT(fVar8) < GHIDRA_UINT(fStack_60)); - } - if (familiars[0] != '\0') goto LAB_0083162a; - local_14 = 2; - tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)familiars)) + 0x4))),0); - goto LAB_00831623; - } - } - } - goto LAB_0083162a; - } - } - else if (iVar7 != 0xb) { - playerManager = &game->_playerManager; - uVar2 = 0; - if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 - == 0) { - this = transition; - } - else { - do { - pvVar6 = (playerManager->_playerList)._end; - if (GHIDRA_INT(pvVar6) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); - pvVar6 = (playerManager->_playerList)._end; - game = g_game; - } - piVar10 = (playerManager->_playerList)._begin; - if (uVar2 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(piVar10) >> 2))) { - piVar10 = piVar10 + uVar2; - } - iVar7 = *piVar10; - if ((*GHIDRA_CAST((iVar7 + 0x2c)) == 0) && ((*GHIDRA_CAST((iVar7 + 0x16c)) & 0x2000000) == 0)) { - *GHIDRA_CAST((iVar7 + 0x171)) = 1; - } - playerManager = &game->_playerManager; - uVar2 = uVar2 + 1; - } while (uVar2 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); - iVar7 = transition->_animation; - this = transition; - } - goto LAB_00830e96; - } - local_28 = 2.3283064e-10; - local_24 = 3.14; - local_38 = GHIDRA_CAST(0x18378); - local_5c = CONCAT44(free_exref,(uint32_t)local_5c); - local_50.y = 2.0; - do { - local_2c = GHIDRA_CAST((GHIDRA_INT(game->_roomList[0]._doors) + (GHIDRA_INT(local_38) - 0x30U))); - if (*local_2c == game->_currentRoomIdx) { - playerIt = (game->_playerManager)._playerList._begin; - fVar8 = 0.0; - if (playerIt != (game->_playerManager)._playerList._end) { - do { - player = *playerIt; - local_48.y = player; - if (player != 0.0) { - local_54 = (float)(GHIDRA_INT(fVar8) + 1); - iVar7 = local_2c[1]; - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - if (fVar8 == 0.0) { - fVar8 = (float)(iVar7 % iVar3) * 40.0 + 40.0; - pEVar9 = GHIDRA_CAST(((float)(iVar7 / iVar3) * 40.0 + 120.0)); - } - else { - local_40 = GHIDRA_CAST(((float)(iVar7 % iVar3) * 40.0 + 40.0)); - local_30 = GHIDRA_CAST(((float)(iVar7 / iVar3) * 40.0 + 120.0)); - uVar2 = Random(); - local_3c = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) - * local_28 * local_24; - local_3c = local_3c + local_3c; - fVar8 = sin(local_3c); - local_30 = GHIDRA_CAST(((float)local_30 + fVar8)); - fVar8 = cos(local_3c); - fVar8 = fVar8 + (float)local_40; - pEVar9 = local_30; - } - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x33c)) = fVar8; - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x340)) = pEVar9; - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x139a)) = 0; - ANM2::Reset(GHIDRA_CAST((GHIDRA_INT(player) + 0x41c))); - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x14c)) = 0x3f800000; - AnimationState::SetAnimationData(GHIDRA_CAST((GHIDRA_INT(player) + 0x98)),(void *)0x0); - local_40 = GHIDRA_CAST((GHIDRA_INT(player) + 0x48)); - isAnimSet = ANM2::SetAnimation(local_40,s_Jump,1); - playerSprite = local_40; - if (isAnimSet != 0) { - AnimationState::Rewind(&local_40->_animState); - (playerSprite->_animState)._isPlaying = 1; - player = local_48.y; - } - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1398)) = 1; - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x139a)) = 0; - if (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x7c)) != 0) { - AnimationState::SetFrameFloat(GHIDRA_CAST((GHIDRA_INT(player) + 0x78)),local_50.y); - } - game = g_game; - pfVar4 = &local_48.y; - if (0x22 < *GHIDRA_CAST((GHIDRA_CAST(player) + 0x13bc))) { - pfVar4 = GHIDRA_CAST((GHIDRA_INT(player) + 0x13bc)); - } - local_48.y = 4.90454e-44; - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x13bc)) = *pfVar4; - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x410)) = 0; - fVar8 = local_54; - } - playerIt = playerIt + 1; - } while (playerIt != (game->_playerManager)._playerList._end); - } - EntityList::QuerySublist - (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST(familiars),3,0xee,-1,0,0) - ; - game = g_game; - local_3c = 0.0; - if (fStack_60 != 0.0) { - do { - iVar7 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + GHIDRA_INT(local_3c) * 4)); - iVar3 = local_2c[1]; - roomWidth = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); - local_3c = (float)(GHIDRA_INT(local_3c) + 1); - *GHIDRA_CAST((iVar7 + 0x33c)) = (float)(iVar3 % roomWidth) * 40.0 + 40.0; - *GHIDRA_CAST((iVar7 + 0x340)) = (float)(iVar3 / roomWidth) * 40.0 + 120.0; - } while (GHIDRA_UINT(local_3c) < GHIDRA_UINT(fStack_60)); - } - if (familiars[0] == '\0') { - if (g_mainHeap == (void *)0x0) { - allocCounter = &g_allocatedBytesNoHeap; - } - else { - allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); - } - if ((*GHIDRA_CAST((GHIDRA_CAST(&((void *)familiars)) + 0x4))) != (void *)0x0) { - uVar2 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4)); - qVar1 = *allocCounter; - *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar2; - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = - *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2)); - (*(*GHIDRA_CAST((GHIDRA_CAST(&(local_5c)) + 0x4))))(GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x4))) + -4))); - } - local_14 = 0xffffffff; - } - game = g_game; - } - local_38 = GHIDRA_CAST((GHIDRA_INT(local_38) + 0xc)); - } while (GHIDRA_INT(local_38) < 0x18390); -LAB_0083162a: - (GHIDRA_CAST((g_game->_room)))->Room::render_lighting(); - local_5c = 0; - msvc::vector::resize(&local_5c); - puVar5 = msvc::deque::back(); - if (GHIDRA_CAST((puVar5 + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((puVar5 + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *puVar5 = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((transition)) + 0x30))),1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - (GHIDRA_CAST((g_game->_room)))->Room::Render(); - _glfw_context_reset(1); - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - puVar5 = msvc::deque::back(); - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget((void *)*puVar5,*GHIDRA_CAST((puVar5 + 1))); - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } - ExceptionList = local_1c; - return; -LAB_008314b3: - uVar2 = uVar2 + 1; - puVar5 = puVar5 + 1; - if (iVar3 <= GHIDRA_INT(uVar2)) goto LAB_0083162a; - goto LAB_00831497; -} - -// 008318a0 -void RoomTransition::Update() -{ - uint32_t *puVar1; - float fVar2; - uint64_t qVar3; - char cVar4; - uint8_t bVar5; - std_string *psVar6; - Vector *tmpVec; - uint32_t uVar7; - int *piVar8; - uint32_t *puVar9; - Entity_Player *pEVar10; - Entity_NPC *pEVar11; - int iVar12; - int *piVar13; - uint32_t uVar14; - uint32_t uVar15; - float fVar16; - float randomScale; - double dVar17; - Entity_Player *idlePlayer; - Vector local_68; - std_string *local_60; - uint8_t local_59; - Vector local_58; - Entity_Player *local_50; - Entity_NPC *local_4c; - char local_45; - std_string *animName [4]; - float fStack_34; - uint32_t uStack_30; - Entity_NPC *animSuffix [4]; - int animSuffixSize; - float animSuffixCapacity; - uint32_t local_14; - void *local_10; - uint8_t *puStack_c; - Entity_NPC *local_8; - void *animData; - Game *game; - Manager *manager; - int minecart; - int *parentNode; - - manager = g_manager; - local_8 = GHIDRA_CAST(0xffffffff); - puStack_c = &LAB_00b02165; - local_10 = ExceptionList; - local_14 = __security_cookie ^ GHIDRA_UINT((animSuffix + 10)); - ExceptionList = &local_10; - local_50 = GHIDRA_CAST(0x0); - local_4c = GHIDRA_CAST(0x0); - pEVar10 = (g_game->_playerManager)._roomTransitionPlayer; - pEVar11 = GHIDRA_CAST(this->_minecart); - if (((pEVar11 != GHIDRA_CAST(0x0)) && (pEVar11->_type == 0x3c5)) && - (local_4c = GHIDRA_CAST(0x0), pEVar11->_variant == 10)) { - local_4c = pEVar11; - } - local_58.y = (float)pEVar10; - switch(*GHIDRA_CAST(this)) { - case 1: - local_45 = '\x01'; - idlePlayer = GHIDRA_CAST(0x0); - local_50 = GHIDRA_CAST(0x0); - local_60 = GHIDRA_CAST(0x3e8); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::Update(1); - (GHIDRA_CAST((g_game->_room)))->Room::update_ambient_sounds(); - iVar12 = this->_animation; - if (iVar12 == 0x13) { - uVar14 = 0; - uVar15 = 0x724; - do { - uVar14 = uVar14 + 1; - if ((uVar14 < 9) && (piVar8 = *GHIDRA_CAST((uVar15 + GHIDRA_INT(g_game->_room))), piVar8 != GHIDRA_CAST(0x0))) - { - (**(code **)(*piVar8 + 8))(); - } - uVar15 = uVar15 + 4; - } while (uVar15 < 0x744); - iVar12 = this->_animation; - } - puVar9 = (g_game->_playerManager)._playerList._begin; - if (puVar9 != (g_game->_playerManager)._playerList._end) { - do { - pEVar10 = GHIDRA_CAST(*puVar9); - if (pEVar10 != GHIDRA_CAST(0x0)) { - if (pEVar10->_dead == 0) { - if (((pEVar10->_isPlayingExtraAnimation == 0) && (pEVar10->_isPlayingItemAnimation == 0) - ) || ((animData = (pEVar10->_sprite)._animState._animData, animData != (void *)0x0 - && (*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x34)) != '\0')))) { - if ((idlePlayer == GHIDRA_CAST(0x0)) && (pEVar10->_visible != 0)) { - idlePlayer = pEVar10; - } - if (this->_animation == 0x13) { - pEVar10->Update(); - } - } - else { - if (this->_animation == 0) { - pEVar10->_isPlayingExtraAnimation = 0; - pEVar10->_isPlayingItemAnimation = 0; - } - pEVar10->Update(); - if ((pEVar10->_itemState != 0) && (pEVar10->_itemState != 0x25c)) { - (GHIDRA_CAST((pEVar10)))->Entity_Player::ResetItemState(); - } - iVar12 = this->_animation; - if (iVar12 == 0) { - pEVar10->_isPlayingExtraAnimation = 0; - pEVar10->_isPlayingItemAnimation = 0; - iVar12 = this->_animation; - } - if ((((iVar12 == 0x13) && (local_4c != GHIDRA_CAST(0x0))) && - ((pEVar10->_sprite)._animState._animData != (void *)0x0)) && - (bVar5 = AnimationState::IsEventTriggered - (&(pEVar10->_sprite)._animState,&DAT_00b1d534), bVar5 != 0)) { - (GHIDRA_CAST((pEVar10)))->Entity_Player::AttachMinecart(local_4c); - pEVar10->_visible = 0; - } - if (((pEVar10->_isPlayingExtraAnimation == 0) && - (pEVar10->_isPlayingItemAnimation == 0)) || (pEVar10->_pitfallState == 4)) { - pEVar10->_visible = 0; - } - else { - if ((pEVar10->_sprite)._animState._animData == (void *)0x0) { - psVar6 = GHIDRA_CAST(0xffffffff); - } - else { - fVar16 = (pEVar10->_sprite)._animState._animFrame; - local_68.y = fVar16; - dVar17 = floor((double)fVar16); - local_68.y = (float)dVar17; - psVar6 = GHIDRA_CAST(GHIDRA_INT(dVar17)); - } - local_45 = '\0'; - if (GHIDRA_INT(local_60) <= GHIDRA_INT(psVar6)) { - psVar6 = local_60; - pEVar10 = local_50; - } - local_50 = pEVar10; - local_60 = psVar6; - } - } - } - else { - pEVar10->Update(); - } - } - puVar9 = puVar9 + 1; - } while (puVar9 != (g_game->_playerManager)._playerList._end); - iVar12 = this->_animation; - } - pEVar10 = local_50; - if ((((iVar12 == 0xb) || (iVar12 == 0x10)) || (iVar12 == 0x13)) && - (((local_50 != GHIDRA_CAST(0x0) && (idlePlayer != GHIDRA_CAST(0x0))) && - (5 < GHIDRA_INT(local_60))))) { - psVar6 = ANM2::GetAnimation(GHIDRA_CAST(&(local_50->_sprite)._animState),GHIDRA_CAST(animName)); - local_8 = GHIDRA_CAST(0x0); - if (0xf < psVar6->_capacity) { - psVar6 = *GHIDRA_CAST(psVar6->_buf); - } - (GHIDRA_CAST((idlePlayer)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST(psVar6)); - local_8 = GHIDRA_CAST(0xffffffff); - if (0xf < uStack_30) { - uVar15 = uStack_30 + 1; - psVar6 = animName[0]; - if (0xfff < uVar15) { - psVar6 = GHIDRA_CAST(animName[0][-1]._capacity); - uVar15 = uStack_30 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(animName[0]) + (-4 - GHIDRA_INT(psVar6))))) { -LAB_00831b99: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(psVar6,uVar15); - } - fVar16 = (pEVar10->_moveToTarget).y; - (idlePlayer->_moveToTarget).x = (pEVar10->_moveToTarget).x; - (idlePlayer->_moveToTarget).y = fVar16; - iVar12 = this->_animation; - fStack_34 = 0.0; - uStack_30 = 0xf; - animName[0] = GHIDRA_CAST((GHIDRA_UINT(animName[0]) & 0xffffff00)); - if ((iVar12 == 0x13) && (local_4c != GHIDRA_CAST(0x0))) { - tmpVec = MusicManager::RandomVector(&local_68); - uVar15 = Random(); - randomScale = (float)((double)GHIDRA_INT(uVar15) + __uint_to_double_fixup[-(GHIDRA_INT(uVar15) >> 0x1f)]) - * 2.3283064e-10; - fVar16 = tmpVec->x; - fVar2 = (local_4c->_targetPosition).x; - (idlePlayer->_moveToTarget).y = - randomScale * tmpVec->y * 8.0 + (local_4c->_targetPosition).y; - (idlePlayer->_moveToTarget).x = randomScale * fVar16 * 8.0 + fVar2; - iVar12 = this->_animation; - } -LAB_00831c6a: - if (iVar12 != 0x15) break; - } - else if (local_45 == '\0') goto LAB_00831c6a; - pEVar11 = local_4c; - game = g_game; - if (iVar12 == 0x13) { - minecart = this->_minecart; - if (((minecart == 0) || (*GHIDRA_CAST((minecart + 0x28)) != 0x3c5)) || - (*GHIDRA_CAST((minecart + 0x2c)) != 10)) goto LAB_00831dc6; - if (local_4c->_state != 4) { - qVar3 = local_4c->_flags; - iVar12 = 1; - puVar1 = GHIDRA_CAST((GHIDRA_INT(&local_4c->_flags) + 4)); - *puVar1 = *puVar1 | 0x1000; - *GHIDRA_CAST(&local_4c->_flags) = GHIDRA_INT(qVar3); - (GHIDRA_CAST((game->_room)))->Room::GetGridIndex(&local_4c->_targetPosition); - uVar7 = FUN_004ce0f0(); - switch(uVar7) { - case 7: - iVar12 = 2; - break; - case 8: - iVar12 = 0; - break; - case 9: - iVar12 = 3; - } - tmpVec = Isaac::GetAxisAlignedUnitVectorFromDir(&local_58,iVar12); - fVar16 = tmpVec->y; - fVar2 = tmpVec->x; - pEVar11->_state = 4; - (pEVar11->_velocity).y = fVar16 * 0.1; - (pEVar11->_velocity).x = fVar2 * 0.1; - fVar16 = g_vectorZero.y; - (pEVar11->_targetPosition).x = g_vectorZero.x; - (pEVar11->_targetPosition).y = fVar16; - } - } - else if (((iVar12 == 0xb) || (iVar12 == 0x10)) && - (this->_targetRoomIdx == g_game->_currentRoomIdx)) { - piVar8 = (g_game->_playerManager)._playerList._begin; - if (piVar8 != (g_game->_playerManager)._playerList._end) { - do { - iVar12 = *piVar8; - if (iVar12 != 0) { - *GHIDRA_CAST((iVar12 + 0x171)) = 0; - *GHIDRA_CAST((iVar12 + 0x410)) = 1; - } - piVar8 = piVar8 + 1; - } while (piVar8 != (game->_playerManager)._playerList._end); - } -LAB_00831db4: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - *GHIDRA_CAST(this) = 0; - } - else { -LAB_00831dc6: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - game = g_game; - if ((((this->_direction != -1) || (iVar12 == 3)) || - (((iVar12 == 0xc || ((iVar12 == 0xd || (iVar12 == 0xb)))) || (iVar12 == 0x10)))) && - (puVar9 = (g_game->_playerManager)._playerList._begin, - puVar9 != (g_game->_playerManager)._playerList._end)) { - do { - pEVar10 = GHIDRA_CAST(*puVar9); - if ((pEVar10 != GHIDRA_CAST(0x0)) && - ((((this->_animation != 0 && (this->_animation != 2)) || (this->_direction == -1)) || - (pEVar10 == GHIDRA_CAST(local_58.y))))) { - pEVar10->_visible = 0; - } - puVar9 = puVar9 + 1; - } while (puVar9 != (game->_playerManager)._playerList._end); - } - (GHIDRA_CAST((g_game->_room)))->Room::render_lighting(); - local_68.x = 0.0; - local_68.y = 0.0; - msvc::vector::resize(&local_68); - puVar9 = msvc::deque::back(); - if (GHIDRA_CAST((puVar9 + 1)) != GHIDRA_CAST(0x0)) { - *GHIDRA_CAST((puVar9 + 1)) = (uint8_t)(g_graphicsManager_flags >> 5) & 1; - } - *puVar9 = g_graphicsManager_renderTarget; - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(*(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x28))),1); - (GHIDRA_CAST((&DAT_00c798e0)))->RenderTarget::Clear(); - g_graphicsManager_blendMode[1] = 1; - g_graphicsManager_blendMode[0] = 0; - if ((g_graphicsManager_flags & 4) == 0) { - g_graphicsManager_blendMode[1] = 6; - } - g_graphicsManager_blendMode[2] = 7; - g_graphicsManager_blendMode[3] = 1; - g_graphicsManager_blendMode[4] = 7; - (GHIDRA_CAST((g_game->_room)))->Room::Render(); - _glfw_context_reset(); - if (g_renderTargetStackSize == 0) { - KAGE_LogMessage(0x10,GHIDRA_CAST("PopRenderTarget: stack is empty!\n")); - } - puVar9 = msvc::deque::back(); - (GHIDRA_CAST((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget((void *)*puVar9,*GHIDRA_CAST((puVar9 + 1))); - g_renderTargetStackSize = g_renderTargetStackSize - 1; - if (g_renderTargetStackSize == 0) { - DAT_00c7978c = 0; - } - iVar12 = this->_animation; - if ((((iVar12 == 1) || (iVar12 == 2)) || - ((this->_direction == -1 || ((iVar12 == 0xb || (iVar12 == 0xf)))))) || - ((iVar12 == 0x10 || - ((((iVar12 == 0x11 || (iVar12 == 0x14)) || (iVar12 == 0x12)) || - ((iVar12 == 0x13 || (iVar12 == 0x15)))))))) { - *GHIDRA_CAST(this) = 2; - if ((iVar12 == 0xf) || (iVar12 == 0x15)) { - ChangeRoom(this); - } - } - else { - *GHIDRA_CAST(this) = 3; - ChangeRoom(this); - } - } - break; - case 2: - if (this->_bossIntroBossId == 0) { - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - if (iVar12 < this->_duration) goto LAB_008320bd; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - *GHIDRA_CAST(this) = 3; - ChangeRoom(this); - } - else { - ANM2::Update(&this->_versusScreenSprite); - piVar8 = (this->_sprites)._head; - piVar13 = GHIDRA_CAST(*piVar8); - if (piVar13 != piVar8) { - do { - if (*GHIDRA_CAST((GHIDRA_CAST(piVar13) + 0x11d)) != '\0') { - AnimationState::Update(GHIDRA_CAST((piVar13 + 0x11))); - AnimationState::Update(GHIDRA_CAST((piVar13 + 0x19))); - } - piVar8 = GHIDRA_CAST(piVar13[2]); - if (*GHIDRA_CAST((GHIDRA_CAST(piVar8) + 0xd)) == '\0') { - cVar4 = *GHIDRA_CAST((*piVar8 + 0xd)); - piVar13 = piVar8; - piVar8 = GHIDRA_CAST(*piVar8); - while (cVar4 == '\0') { - cVar4 = *GHIDRA_CAST((*piVar8 + 0xd)); - piVar13 = piVar8; - piVar8 = GHIDRA_CAST(*piVar8); - } - } - else { - cVar4 = *GHIDRA_CAST((piVar13[1] + 0xd)); - parentNode = GHIDRA_CAST(piVar13[1]); - piVar8 = piVar13; - while ((piVar13 = parentNode, cVar4 == '\0' && (piVar8 == GHIDRA_CAST(piVar13[2])))) { - cVar4 = *GHIDRA_CAST((piVar13[1] + 0xd)); - parentNode = GHIDRA_CAST(piVar13[1]); - piVar8 = piVar13; - } - } - } while (piVar13 != (this->_sprites)._head); - } - if (((this->_versusScreenSprite)._animState._animData == (void *)0x0) || - ((this->_versusScreenSprite)._animState._isPlaying == 0)) { - (GHIDRA_CAST((g_game->_room)))->Room::PlayMusic(); - game = g_game; - (g_game->_hud)._isVisible = 1; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = this->_duration; - *GHIDRA_CAST(this) = 3; - piVar8 = (game->_playerManager)._playerList._begin; - if (piVar8 != (game->_playerManager)._playerList._end) { - do { - iVar12 = *piVar8; - if (iVar12 != 0) { - minecart = 10; - if (10 < *GHIDRA_CAST((iVar12 + 0x418))) { - minecart = *GHIDRA_CAST((iVar12 + 0x418)); - } - *GHIDRA_CAST((iVar12 + 0x418)) = minecart; - } - piVar8 = piVar8 + 1; - } while (piVar8 != (game->_playerManager)._playerList._end); - } - } - } - break; - case 3: - iVar12 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))); - if (iVar12 < this->_duration) { -LAB_008320bd: - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = iVar12 + 1; - } - else { - FUN_00421260(local_14); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - cVar4 = FUN_0082eb90(); - manager = g_manager; - if (cVar4 == '\0') { - iVar12 = this->_animation; - if (iVar12 == 5) { - if (pEVar10 != GHIDRA_CAST(0x0)) { - Entity_Player::AnimateCollectible - (pEVar10,0xa1,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - } -LAB_008321d0: - *GHIDRA_CAST(this) = 4; - break; - } - if (iVar12 == 6) { - if (pEVar10 != GHIDRA_CAST(0x0)) { - Entity_Player::AnimateCollectible - (pEVar10,0x51,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - *GHIDRA_CAST(this) = 4; - break; - } - goto LAB_008321d0; - } - if (iVar12 == 7) { - local_58.y = 1.4013e-45; - seed_fart_sound_override(GHIDRA_CAST(&local_58.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_58.y),1.0,2,0,1.0,0.0); - if (pEVar10 != GHIDRA_CAST(0x0)) { - Entity_Player::AnimateCollectible - (pEVar10,0xb,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - *GHIDRA_CAST(this) = 4; - break; - } - goto LAB_008321d0; - } - if (iVar12 == 8) { - if (pEVar10 != GHIDRA_CAST(0x0)) { - Entity_Player::AnimateCollectible - (pEVar10,0xd4,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - *GHIDRA_CAST(this) = 4; - break; - } - goto LAB_008321d0; - } - if (iVar12 == 9) { - if (pEVar10 != GHIDRA_CAST(0x0)) { - Entity_Player::AnimateCollectible - (pEVar10,0x137,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - *GHIDRA_CAST(this) = 4; - break; - } - goto LAB_008321d0; - } - if (iVar12 == 10) { - if (pEVar10 != GHIDRA_CAST(0x0)) { - Entity_Player::AnimateCollectible - (pEVar10,0x14c,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - *GHIDRA_CAST(this) = 4; - break; - } - goto LAB_008321d0; - } - if (iVar12 == 0xe) { - if (pEVar10 != GHIDRA_CAST(0x0)) { - Entity_Player::AnimateTrinket - (pEVar10,0x17,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); - *GHIDRA_CAST(this) = 4; - break; - } - goto LAB_008321d0; - } - if (((iVar12 == 1) || (iVar12 == 2)) || (iVar12 == 0x12)) goto LAB_008321d0; - if (((iVar12 != 0xb) && (iVar12 != 0x10)) && ((iVar12 != 0x11 && (iVar12 != 0x13)))) { - if (iVar12 == 0x14) goto LAB_008321d0; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::Update(1); - piVar8 = (g_game->_playerManager)._playerList._begin; - if (piVar8 == (g_game->_playerManager)._playerList._end) goto LAB_00831db4; - do { - piVar13 = GHIDRA_CAST(*piVar8); - if (piVar13 != GHIDRA_CAST(0x0)) { - if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { - *GHIDRA_CAST((piVar13 + 0x104)) = 1; - } - (**(code **)(*piVar13 + 0xc))(); - } - piVar8 = piVar8 + 1; - } while (piVar8 != (g_game->_playerManager)._playerList._end); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - *GHIDRA_CAST(this) = 0; - break; - } - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::Update(1); - piVar8 = (g_game->_playerManager)._playerList._begin; - if (piVar8 != (g_game->_playerManager)._playerList._end) { - do { - piVar13 = GHIDRA_CAST(*piVar8); - if (piVar13 != GHIDRA_CAST(0x0)) { - (**(code **)(*piVar13 + 0xc))(); - *GHIDRA_CAST((piVar13 + 0x104)) = 1; - } - piVar8 = piVar8 + 1; - } while (piVar8 != (g_game->_playerManager)._playerList._end); - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - *GHIDRA_CAST(this) = 0; - break; - } - goto LAB_00831db4; - } - puVar9 = (g_game->_playerManager)._playerList._begin; - if (puVar9 != (g_game->_playerManager)._playerList._end) { - do { - pEVar10 = GHIDRA_CAST(*puVar9); - if (pEVar10 != GHIDRA_CAST(0x0)) { - if (this->_animation == 3) { - (GHIDRA_CAST((pEVar10)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("TeleportDown")); - } - if ((pEVar10->_flags & 0x200000000000000) == 0) { - pEVar10->_visible = 1; - } - } - puVar9 = puVar9 + 1; - } while (puVar9 != (g_game->_playerManager)._playerList._end); - } - if (this->_animation == 0xc) { - if (GHIDRA_CAST(local_58.y) == GHIDRA_CAST(0x0)) goto LAB_008321d0; - Entity_Player::AnimateCollectible - (GHIDRA_CAST(local_58.y),0x1a6,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")) - ; - *GHIDRA_CAST(this) = 4; - } - else { - if ((this->_animation != 0xd) || (GHIDRA_CAST(local_58.y) == GHIDRA_CAST(0x0))) - goto LAB_008321d0; - Entity_Player::AnimateCollectible - (GHIDRA_CAST(local_58.y),0x1b5,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")) - ; - *GHIDRA_CAST(this) = 4; - } - } - break; - case 4: - if ((this->_animation == 3) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) == 8)) { - local_58.y = 2.99878e-43; - seed_fart_sound_override(GHIDRA_CAST(&local_58.y)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_58.y),1.0,2,0,1.0,0.0); - } - game = g_game; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 1; - local_58.y = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_58.y)) + 0x1))),1); - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)))))->EntityList::Update(1); - piVar8 = (g_game->_playerManager)._playerList._begin; - if (piVar8 != (g_game->_playerManager)._playerList._end) { - pEVar10 = GHIDRA_CAST(local_58.y); - do { - piVar13 = GHIDRA_CAST(*piVar8); - local_59 = (uint8_t)pEVar10; - if ((piVar13 != GHIDRA_CAST(0x0)) && - (((char)piVar13[0x4e6] != '\0' || (*GHIDRA_CAST((GHIDRA_CAST(piVar13) + 0x139a)) != '\0')))) { - if (piVar13[0x1f] == 0) { - cVar4 = '\0'; - } - else { - cVar4 = *GHIDRA_CAST((piVar13[0x1f] + 0x34)); - } - if (cVar4 == '\0') { - (**(code **)(*piVar13 + 0xc))(); - if ((void *)piVar13[0x1f] == (void *)0x0) { - uStack_30 = 0xf; - fStack_34 = 0.0; - animName[0] = GHIDRA_CAST(0x0); - } - else { - (GHIDRA_CAST((GHIDRA_CAST(animName))))->msvc::string::string((void *)piVar13[0x1f]); - } - local_8 = GHIDRA_CAST(0x1); - local_50 = GHIDRA_CAST((GHIDRA_UINT(local_50) | 0x20)); - local_60 = animName[0]; - if ((((char)piVar13[0x4e6] == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(piVar13) + 0x139a)) == '\0')) || - (GHIDRA_UINT(fStack_34) < 5)) { - local_4c = animSuffix[0]; - fVar16 = animSuffixCapacity; -LAB_00832568: - local_45 = '\0'; - } - else { - fVar16 = (float)(GHIDRA_INT(fStack_34) - 5); - animSuffix[0] = GHIDRA_CAST(0x0); - local_68.y = fVar16; - animSuffixCapacity = 2.10195e-44; - if (GHIDRA_UINT(fStack_34) < GHIDRA_UINT(fVar16)) { - /* WARNING: Subroutine does not return */ - FUN_00499950(); - } - pEVar10 = GHIDRA_CAST(0xffffffff); - if (GHIDRA_CAST((GHIDRA_INT(fStack_34) - GHIDRA_INT(fVar16))) != GHIDRA_CAST(0xffffffff)) { - pEVar10 = GHIDRA_CAST((GHIDRA_INT(fStack_34) - GHIDRA_INT(fVar16))); - } - psVar6 = GHIDRA_CAST(animName); - if (0xf < uStack_30) { - psVar6 = animName[0]; - } - local_68.y = (float)(psVar6->_buf + GHIDRA_INT(fVar16)); - local_58.y = (float)pEVar10; - if (GHIDRA_CAST(&DAT_0000000f) < pEVar10) { - if (GHIDRA_CAST(0x7fffffff) < pEVar10) { - /* WARNING: Subroutine does not return */ - msvc::string::_Xlen(); - } - fVar16 = (float)(GHIDRA_UINT(pEVar10) | 0xf); - if (GHIDRA_UINT(fVar16) < 0x80000000) { - if (GHIDRA_UINT(fVar16) < 0x16) { - fVar16 = 3.08286e-44; - } - } - else { - fVar16 = NAN; - } - local_4c = msvc::_Allocate(GHIDRA_INT(fVar16) + 1); - animSuffixSize = GHIDRA_INT(local_58.y); - animSuffixCapacity = fVar16; - memcpy(local_4c,(void *)local_68.y,(size_t)local_58.y); - animSuffix[0] = local_4c; - *(uint8_t *) - (GHIDRA_INT((&(GHIDRA_CAST((GHIDRA_INT(local_58.y) + 0x48)))->_filename + 5)) + - GHIDRA_INT((&local_4c->_sprite + -1)) + 0xc) = 0; - pEVar10 = GHIDRA_CAST(local_58.y); - } - else { - animSuffixSize = GHIDRA_INT(pEVar10); - memmove(animSuffix,psVar6->_buf + GHIDRA_INT(fVar16),(size_t)pEVar10); - *GHIDRA_CAST((GHIDRA_CAST(animSuffix) + GHIDRA_INT(pEVar10))) = 0; - pEVar10 = GHIDRA_CAST(animSuffixSize); - fVar16 = animSuffixCapacity; - } - local_50 = GHIDRA_CAST((GHIDRA_UINT(local_50) | 0x41)); - pEVar11 = GHIDRA_CAST(animSuffix); - if (0xf < GHIDRA_UINT(fVar16)) { - pEVar11 = animSuffix[0]; - } - local_4c = animSuffix[0]; - bVar5 = str_eq(GHIDRA_CAST(pEVar11),GHIDRA_UINT(pEVar10),GHIDRA_CAST("Death"),5); - if (bVar5 != 0) goto LAB_00832568; - local_45 = '\x01'; - } - if (((GHIDRA_UINT(local_50) & 1) != 0) && - (local_50 = GHIDRA_CAST((GHIDRA_UINT(local_50) & 0xfffffffe)), 0xf < GHIDRA_UINT(fVar16))) { - uVar15 = GHIDRA_INT(fVar16) + 1; - pEVar11 = local_4c; - if (0xfff < uVar15) { - pEVar11 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_4c[-1])) + 0xf5c)))); - uVar15 = GHIDRA_INT(fVar16) + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(local_4c) + (-4 - GHIDRA_INT(pEVar11))))) goto LAB_00831b99; - } - operator_delete(pEVar11,uVar15); - } - local_8 = GHIDRA_CAST(0xffffffff); - local_58.y = (float)GHIDRA_CAST(0x0); - if (local_45 == '\0') { - local_58.y = (float)GHIDRA_UINT(local_59); - } - pEVar10 = GHIDRA_CAST(local_58.y); - if (0xf < uStack_30) { - uVar15 = uStack_30 + 1; - psVar6 = local_60; - if (0xfff < uVar15) { - psVar6 = GHIDRA_CAST(local_60[-1]._capacity); - uVar15 = uStack_30 + 0x24; - if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_60) + (-4 - GHIDRA_INT(psVar6))))) goto LAB_00831b99; - } - operator_delete(psVar6,uVar15); - pEVar10 = GHIDRA_CAST(local_58.y); - } - } - } - piVar8 = piVar8 + 1; - } while (piVar8 != (g_game->_playerManager)._playerList._end); - if ((char)pEVar10 == '\0') break; - } - game = g_game; - *GHIDRA_CAST(this) = 0; - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) = 0; - piVar8 = (game->_playerManager)._playerList._begin; - if (piVar8 != (game->_playerManager)._playerList._end) { - do { - iVar12 = *piVar8; - if ((iVar12 != 0) && - (*GHIDRA_CAST((iVar12 + 0x410)) = 1, (*GHIDRA_CAST((iVar12 + 0x16c)) & 0x2000000) == 0)) { - *GHIDRA_CAST((iVar12 + 0x171)) = 1; - } - piVar8 = piVar8 + 1; - } while (piVar8 != (game->_playerManager)._playerList._end); - } - break; - default: - goto switchD_0083190e_default; - } - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))) = (float)*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) / (float)this->_duration; - game = g_game; - if ((*GHIDRA_CAST(this) == 2) || (*GHIDRA_CAST(this) == 3)) { - (g_game->_hud)._hudRefreshType = 2; - (game->_hud)._hudRefreshCountdown = 2; - } -switchD_0083190e_default: - ExceptionList = local_10; - return; -} - -// 008327e0 -float RoomTransition::get_hud_alpha() -{ - int iVar1; - int animation; - - iVar1 = *GHIDRA_CAST(this); - if (((iVar1 == 2) || (iVar1 == 3)) && - ((((animation = this->_animation, animation == 1 || - ((((animation == 2 || (this->_direction == -1)) || (animation == 0xb)) || - ((animation == 0x10 || (animation == 0x11)))))) || (animation == 0x12)) || - ((animation == 0x14 || (animation == 0x13)))))) { - if (iVar1 == 2) { - return 1.0 - *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); - } - if (iVar1 == 3) { - return *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xc)))); - } - } - return 1.0; -} diff --git a/generated-src/stage_transition.cpp b/generated-src/stage_transition.cpp index 733c5b2..0f3741c 100644 --- a/generated-src/stage_transition.cpp +++ b/generated-src/stage_transition.cpp @@ -67,7 +67,7 @@ void StageTransition::Update() exitingPlayer = GHIDRA_CAST(0x0); minExitFrame = 1000; local_2e = '\0'; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::Update(1); + EntityList::Update(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),1); if (((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(catchUpPlayer[1])) + 0x4)))) == 4) && (pvVar7 = (g_game->_playerManager)._stageTransitionPlayer, *GHIDRA_CAST((GHIDRA_CAST(pvVar7) + 0x1b1c)) == g_vectorZero.x)) && @@ -104,7 +104,7 @@ LAB_0092f31d: } isExitAnimDone = '\x01'; } - player->Update(); + (**(code **)(*GHIDRA_CAST(player) + 0xc))(); if ((player->_dead == 0) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(catchUpPlayer[1])) + 0x4)))) != 1)) { if (((player->_isPlayingExtraAnimation == 0) && (player->_isPlayingItemAnimation == 0)) || ((player->_isCoopGhost != 0 && @@ -269,7 +269,7 @@ LAB_0092f849: if (0xf < animName->_capacity) { animName = *GHIDRA_CAST(animName->_buf); } - (GHIDRA_CAST((catchUpPlayer)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST(animName)); + Entity_Player::PlayExtraAnimation(catchUpPlayer,GHIDRA_CAST(animName)); local_8 = (void *)0xffffffff; if (0xf < tmpStringCapacity) { uVar4 = tmpStringCapacity + 1; @@ -390,7 +390,7 @@ LAB_0092fe68: (player,0x7f,GHIDRA_CAST("Pickup"),GHIDRA_CAST("PlayerPickupSparkle")); } else { - (GHIDRA_CAST((player)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Appear")); + Entity_Player::PlayExtraAnimation(player,GHIDRA_CAST("Appear")); } game = g_game; } @@ -405,13 +405,13 @@ LAB_0092fe68: do { player = GHIDRA_CAST(*playerSlot); if ((player != GHIDRA_CAST(0x0)) && (player->_variant == 0)) { - (GHIDRA_CAST((player)))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST("Appear")); + Entity_Player::PlayExtraAnimation(player,GHIDRA_CAST("Appear")); game = g_game; } playerSlot = playerSlot + 1; } while (playerSlot != (game->_playerManager)._playerList._end); } - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)))))->EntityList::Update(1); + EntityList::Update(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),1); playerIt = (g_game->_playerManager)._playerList._begin; game = g_game; if (playerIt != (g_game->_playerManager)._playerList._end) { @@ -469,7 +469,7 @@ LAB_0092fbfd: ((game->_gameStateFlags & 0x1000000000000) != 0)) goto LAB_0092fc1b; } Level::Init(GHIDRA_CAST(game),0); - (GHIDRA_CAST((g_game->_room)))->Room::Update(); + Room::Update(g_game->_room); Manager::save_game_state(); PlayerManager::trigger_new_room_effects(&g_game->_playerManager); game = g_game; @@ -489,7 +489,7 @@ LAB_0092fbfd: (&g_game->_roomTransition, g_game->_roomList[g_game->_lastBossRoomListIdx].GridIndex,-1,0xf, GHIDRA_CAST(0x0),-1); - (GHIDRA_CAST((&g_game->_roomTransition)))->RoomTransition::Update(); + RoomTransition::Update(&g_game->_roomTransition); startingRoom = Level::GetRoomByIdx(GHIDRA_CAST(g_game),g_game->_startingRoomIdx,-1); game = g_game; startingRoom->Flags = startingRoom->Flags & 0xfffffffe; @@ -510,7 +510,7 @@ LAB_0092fbfd: case 3: uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((catchUpPlayer)) + 0x4)))); if ((uVar4 == 2) && ((char)catchUpPlayer[1]._duration != '\0')) { - (GHIDRA_CAST((g_game->_room)))->Room::PlayMusic(); + Room::PlayMusic(g_game->_room); uVar4 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((catchUpPlayer)) + 0x4)))); } game = g_game; @@ -522,7 +522,7 @@ LAB_0092fbfd: break; case 4: local_2e = '\x01'; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::Update(1); + EntityList::Update(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),1); playerIt = (g_game->_playerManager)._playerList._begin; game = g_game; if (playerIt == (g_game->_playerManager)._playerList._end) { diff --git a/generated-src/stats_panel.cpp b/generated-src/stats_panel.cpp index ba5e7cd..3e81197 100644 --- a/generated-src/stats_panel.cpp +++ b/generated-src/stats_panel.cpp @@ -299,14 +299,14 @@ void StatsPanel::preview_collectible(uint8_t param_1) *GHIDRA_CAST((iVar2 + 0x2ef0)) = param_1; puVar1 = GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)) + 0x1574)); *puVar1 = *puVar1 | 0x41f; - (GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)))))->Entity_Player::EvaluateItems(); + Entity_Player::EvaluateItems(*GHIDRA_CAST((in_ECX + 0x48))); snapshot_stats(1); iVar2 = *GHIDRA_CAST((in_ECX + 0x48)); *GHIDRA_CAST((iVar2 + 0x2ef4)) = 0; *GHIDRA_CAST((iVar2 + 0x2ef0)) = 1; puVar1 = GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)) + 0x1574)); *puVar1 = *puVar1 | 0x41f; - (GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)))))->Entity_Player::EvaluateItems(); + Entity_Player::EvaluateItems(*GHIDRA_CAST((in_ECX + 0x48))); } return; } @@ -330,14 +330,14 @@ void StatsPanel::preview_trinket(uint8_t param_1, int param_2) *GHIDRA_CAST((iVar2 + 0x2ef0)) = param_1; puVar1 = GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)) + 0x1574)); *puVar1 = *puVar1 | 0x41f; - (GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)))))->Entity_Player::EvaluateItems(); + Entity_Player::EvaluateItems(*GHIDRA_CAST((in_ECX + 0x48))); snapshot_stats(1); iVar2 = *GHIDRA_CAST((in_ECX + 0x48)); *GHIDRA_CAST((iVar2 + 0x2ef8)) = 0; *GHIDRA_CAST((iVar2 + 0x2ef0)) = 1; puVar1 = GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)) + 0x1574)); *puVar1 = *puVar1 | 0x41f; - (GHIDRA_CAST((*GHIDRA_CAST((in_ECX + 0x48)))))->Entity_Player::EvaluateItems(); + Entity_Player::EvaluateItems(*GHIDRA_CAST((in_ECX + 0x48))); } return; } diff --git a/generated-src/stubs.cpp b/generated-src/stubs.cpp index da628a2..ac4f286 100644 --- a/generated-src/stubs.cpp +++ b/generated-src/stubs.cpp @@ -8220,363 +8220,6 @@ uint32_t _DAT_e76476a4{}; uint32_t register0x00000010{}; uint32_t register0x0000001e{}; -uint32_t EntityPtr::Ref() { generated_stub("EntityPtr::Ref 0040c3a0"); } -void EntityPtr::Set(Entity *entity) { generated_stub("EntityPtr::Set 004cf1d0"); } -void EntityPtr::SetReference(EntityPtr *ptr, Entity *entity) { generated_stub("EntityPtr::SetReference 006b5b50"); } -void EntityPtr::SetReference(Entity *entity) { generated_stub("EntityPtr::SetReference 00872050"); } -EntityPtr * EntityPtr::clear() { generated_stub("EntityPtr::clear 00a0fe80"); } -Vector * Vector::operator_mul(Vector *outResult, float *scalar, Vector *vector) { generated_stub("Vector::operator_mul 004171d0"); } -Vector * Vector::ToCardinal(Vector *outResult, Vector *vec) { generated_stub("Vector::ToCardinal 0067f170"); } -Vector * Vector::mul_065(Vector *outResult, Vector *source) { generated_stub("Vector::mul_065 0067f2b0"); } -Vector * Vector::operator_assign(Vector *other) { generated_stub("Vector::operator_assign 007dd3b0"); } -uint8_t * Vector::__tostring() { generated_stub("Vector::__tostring 0085e630"); } -Vector::Vector(float x, float y) { generated_stub("Vector::Vector 00a0fe90"); } -float Vector::Length() { generated_stub("Vector::Length 00a0fea0"); } -float Vector::LengthSquared() { generated_stub("Vector::LengthSquared 00a0fed0"); } -float Vector::Distance(Vector *other) { generated_stub("Vector::Distance 00a0ff30"); } -float Vector::DistanceSquared(Vector *other) { generated_stub("Vector::DistanceSquared 00a0ff90"); } -void Vector::Normalize() { generated_stub("Vector::Normalize 00a0ffc0"); } -Vector * Vector::Normalized(Vector *outResult) { generated_stub("Vector::Normalized 00a10030"); } -void Vector::Resize(float length) { generated_stub("Vector::Resize 00a100b0"); } -Vector * Vector::Resized(Vector *outVec, float length) { generated_stub("Vector::Resized 00a10100"); } -float Vector::Dot(Vector *other) { generated_stub("Vector::Dot 00a10180"); } -float Vector::Cross(Vector *other) { generated_stub("Vector::Cross 00a101a0"); } -void Vector::Lerp(Vector *target, float t, uint8_t isClamped) { generated_stub("Vector::Lerp 00a10210"); } -void Vector::Rotate(float angleDegrees) { generated_stub("Vector::Rotate 00a10270"); } -Vector * Vector::Rotated(Vector *outVec, float angleDegrees) { generated_stub("Vector::Rotated 00a102e0"); } -Vector * Vector::FromAngle(Vector *outVec, float angleDegrees) { generated_stub("Vector::FromAngle 00a10350"); } -float Vector::GetAngleDegrees() { generated_stub("Vector::GetAngleDegrees 00a10390"); } -void Vector::Clamp(float minX, float minY, float maxX, float maxY) { generated_stub("Vector::Clamp 00a103c0"); } -Vector * Vector::Clamped(Vector *outResult, float minX, float minY, float maxX, float maxY) { generated_stub("Vector::Clamped 00a103f0"); } -Vector * Vector::__add(Vector *outVec, Vector *other) { generated_stub("Vector::__add 00a10420"); } -Vector * Vector::operator_add_assign(Vector *other) { generated_stub("Vector::operator_add_assign 00a10450"); } -Vector * Vector::__sub(Vector *outResult, Vector *other) { generated_stub("Vector::__sub 00a10480"); } -Vector * Vector::operator__(Vector *other) { generated_stub("Vector::operator__ 00a104b0"); } -Vector * Vector::__mul(Vector *outResult, float *scalar) { generated_stub("Vector::__mul 00a104e0"); } -Vector * Vector::Mul(Vector *outResult, Vector *other) { generated_stub("Vector::Mul 00a10510"); } -Vector * Vector::operator_mul_assign(float *scalar) { generated_stub("Vector::operator_mul_assign 00a10540"); } -Vector * Vector::__div(Vector *outResult, float *divisor) { generated_stub("Vector::__div 00a105a0"); } -Vector * Vector::__div_assign(float *divisor) { generated_stub("Vector::__div_assign 00a105d0"); } -uint8_t Vector::operator_eq(Vector *other) { generated_stub("Vector::operator_eq 00a10600"); } -uint8_t Vector::operator_ne(Vector *other) { generated_stub("Vector::operator_ne 00a10630"); } -Vector * Vector::__unm(Vector *outResult) { generated_stub("Vector::__unm 00a10660"); } -void EntityRef::constructor(Entity *entity) { generated_stub("EntityRef::constructor 00431310"); } -EntityRef::EntityRef() { generated_stub("EntityRef::EntityRef 00435c70"); } -EntityRef * EntityRef::operator_(EntityRef *other) { generated_stub("EntityRef::operator_ 00499960"); } -uint32_t EntityRef::IsFriendly() { generated_stub("EntityRef::IsFriendly 004a2910"); } -uint8_t EntityRef::IsCharmed() { generated_stub("EntityRef::IsCharmed 004bc670"); } -Entity::~Entity() { generated_stub("Entity::~Entity 006a8820"); } -void Entity::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity::Init 006a93a0"); } -void Entity::PreUpdate() { generated_stub("Entity::PreUpdate 006ae7d0"); } -void Entity::Update() { generated_stub("Entity::Update 006ae820"); } -void Entity::Interpolate() { generated_stub("Entity::Interpolate 006b0eb0"); } -void Entity::Render(Vector *offset) { generated_stub("Entity::Render 006b10f0"); } -uint8_t Entity::RenderShadowLayer(Vector *offset) { generated_stub("Entity::RenderShadowLayer 006b2000"); } -void Entity::PostRender() { generated_stub("Entity::PostRender 006b1260"); } -uint8_t Entity::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) { generated_stub("Entity::TakeDamage 006ace60"); } -void Entity::Kill(EntityRef *source) { generated_stub("Entity::Kill 006ac920"); } -void Entity::Remove() { generated_stub("Entity::Remove 006acb00"); } -void Entity::guard_check_icall() { generated_stub("Entity::guard_check_icall 0040c200"); } -void Entity::vfunc_12() { generated_stub("Entity::vfunc_12 0040c200"); } -int Entity::GetRenderZ() { generated_stub("Entity::GetRenderZ 006b1000"); } -uint8_t Entity::CanOverwrite() { generated_stub("Entity::CanOverwrite 006b10d0"); } -void Entity::SetColor(ColorMod *color, int duration, int priority, uint8_t isFadeout, uint8_t isShare) { generated_stub("Entity::SetColor 006b2fa0"); } -void Entity::SetCollisionDamage(float param_2) { generated_stub("Entity::SetCollisionDamage 005ccbe0"); } -void Entity::ClearReferences() { generated_stub("Entity::ClearReferences 006acb60"); } -uint8_t Entity::CanShutDoors() { generated_stub("Entity::CanShutDoors 005ccc00"); } -uint8_t Entity::IsBoss() { generated_stub("Entity::IsBoss 005ccc00"); } -uint8_t Entity::IsValidTarget(Entity *target) { generated_stub("Entity::IsValidTarget 006a8ee0"); } -uint8_t Entity::TryThrow() { generated_stub("Entity::TryThrow 005ccc10"); } -Vector * Entity::GetForwardVector(Vector *outForward) { generated_stub("Entity::GetForwardVector 006b63b0"); } -void Entity::HandleCollision() { generated_stub("Entity::HandleCollision 00af05d3"); } -void Entity::ResetColor() { generated_stub("Entity::ResetColor 006ac6e0"); } -void Entity::LoadEntityConfig() { generated_stub("Entity::LoadEntityConfig 006a98b0"); } -void Entity::vfunc_26() { generated_stub("Entity::vfunc_26 00b1d830"); } -uint8_t Entity::IsType(int type, int variant, int subType) { generated_stub("Entity::IsType 00417220"); } -int Entity::Type() { generated_stub("Entity::Type 00417260"); } -int Entity::Variant() { generated_stub("Entity::Variant 00417270"); } -int Entity::SubType() { generated_stub("Entity::SubType 00417280"); } -Vector * Entity::Position(Vector *outPos) { generated_stub("Entity::Position 00417290"); } -Vector * Entity::Velocity(Vector *outVelocity) { generated_stub("Entity::Velocity 004172d0"); } -void Entity::SetPositionOffset(Vector *offset) { generated_stub("Entity::SetPositionOffset 004172f0"); } -Vector * Entity::PositionOffset() { generated_stub("Entity::PositionOffset 00417310"); } -Vector * Entity::SpriteScale() { generated_stub("Entity::SpriteScale 00417320"); } -long double Entity::SpriteRotation() { generated_stub("Entity::SpriteRotation 00417330"); } -float Entity::MaxHitPoints() { generated_stub("Entity::MaxHitPoints 00417360"); } -long double Entity::HitPoints() { generated_stub("Entity::HitPoints 00417370"); } -int Entity::EntityCollisionClass() { generated_stub("Entity::EntityCollisionClass 00417380"); } -uint8_t Entity::is_player() { generated_stub("Entity::is_player 004173b0"); } -bool Entity::is_bomb() { generated_stub("Entity::is_bomb 004173c0"); } -void Entity::AddEntityFlags(uint64_t flags) { generated_stub("Entity::AddEntityFlags 004173e0"); } -void Entity::ClearEntityFlags(uint64_t flags) { generated_stub("Entity::ClearEntityFlags 00417400"); } -uint64_t Entity::GetEntityFlags() { generated_stub("Entity::GetEntityFlags 00417420"); } -uint8_t Entity::HasEntityFlags(uint64_t flags) { generated_stub("Entity::HasEntityFlags 00417430"); } -uint8_t Entity::Exists() { generated_stub("Entity::Exists 00417460"); } -uint8_t Entity::IsDead() { generated_stub("Entity::IsDead 00417470"); } -uint8_t Entity::Visible() { generated_stub("Entity::Visible 00417480"); } -uint32_t Entity::SpawnerEntity() { generated_stub("Entity::SpawnerEntity 004174a0"); } -RNG * Entity::GetDropRNG() { generated_stub("Entity::GetDropRNG 004174b0"); } -void Entity::SetPosition(Vector *pos) { generated_stub("Entity::SetPosition 004288f0"); } -void Entity::SetVelocity(Vector *velocity) { generated_stub("Entity::SetVelocity 00428910"); } -uint8_t Entity::IsFamiliar() { generated_stub("Entity::IsFamiliar 0042a250"); } -uint32_t Entity::Parent() { generated_stub("Entity::Parent 0042a260"); } -void Entity::SetSpriteScale(Vector *scale) { generated_stub("Entity::SetSpriteScale 0042d9b0"); } -int Entity::SpawnerType() { generated_stub("Entity::SpawnerType 00431430"); } -int Entity::SpawnerVariant() { generated_stub("Entity::SpawnerVariant 00431440"); } -void Entity::AddVelocity(Vector *velocity, uint8_t isIgnoreSpeedMultiplier) { generated_stub("Entity::AddVelocity 00431450"); } -void Entity::AddVelocity_divided(Vector *velocity, uint8_t isIgnoreSpeedMultiplier) { generated_stub("Entity::AddVelocity_divided 004314b0"); } -long double Entity::Mass() { generated_stub("Entity::Mass 00431520"); } -uint8_t Entity::IsTear() { generated_stub("Entity::IsTear 00431530"); } -uint8_t Entity::IsProjectile() { generated_stub("Entity::IsProjectile 00431540"); } -bool Entity::is_pickup() { generated_stub("Entity::is_pickup 00431550"); } -uint32_t Entity::Child() { generated_stub("Entity::Child 00431560"); } -void Entity::get_friction() { generated_stub("Entity::get_friction 00435ce0"); } -long double Entity::DepthOffset() { generated_stub("Entity::DepthOffset 00435d10"); } -void Entity::SetField380(float value) { generated_stub("Entity::SetField380 00435d20"); } -void Entity::SetTargetPosition(Vector position) { generated_stub("Entity::SetTargetPosition 00435d60"); } -bool Entity::is_slot() { generated_stub("Entity::is_slot 00435da0"); } -int Entity::GetHitPointsLost() { generated_stub("Entity::GetHitPointsLost 00435db0"); } -ANM2 * Entity::GetSprite() { generated_stub("Entity::GetSprite 00435dd0"); } -Entity * Entity::to_npc_or_coop_player() { generated_stub("Entity::to_npc_or_coop_player 00435e00"); } -Entity_Tear * Entity::ToTear() { generated_stub("Entity::ToTear 00435e40"); } -void Entity::SetVisibleFlag(uint8_t isVisible) { generated_stub("Entity::SetVisibleFlag 00436220"); } -int Entity::GridCollisionClass() { generated_stub("Entity::GridCollisionClass 00440eb0"); } -void Entity::Die() { generated_stub("Entity::Die 00444c60"); } -uint8_t Entity::IsFriendly() { generated_stub("Entity::IsFriendly 004567b0"); } -Entity_Player * Entity::ToPlayer() { generated_stub("Entity::ToPlayer 00499da0"); } -Vector * Entity::SpriteOffset() { generated_stub("Entity::SpriteOffset 0049cb50"); } -Vector * Entity::TargetPosition() { generated_stub("Entity::TargetPosition 004aad30"); } -uint32_t Entity::Target() { generated_stub("Entity::Target 004b7080"); } -ColorMod * Entity::SplatColor() { generated_stub("Entity::SplatColor 004e47a0"); } -ColorMod * Entity::GetColor() { generated_stub("Entity::GetColor 00505b60"); } -int Entity::InitSeed() { generated_stub("Entity::InitSeed 00505b70"); } -int Entity::SortingLayer() { generated_stub("Entity::SortingLayer 00592250"); } -void Entity::MultiplyFriction(float param_2) { generated_stub("Entity::MultiplyFriction 005a6ff0"); } -long double Entity::CollisionDamage() { generated_stub("Entity::CollisionDamage 005b1570"); } -uint8_t Entity::IsInvincible() { generated_stub("Entity::IsInvincible 005b1580"); } -int Entity::DropSeed() { generated_stub("Entity::DropSeed 005b1590"); } -void Entity::AddFlagsLow(uint32_t param_2) { generated_stub("Entity::AddFlagsLow 005cd460"); } -Entity * Entity::AddFear(int param_2, int param_3, int param_4) { generated_stub("Entity::AddFear 0060af70"); } -void Entity::convert_shot_for_enemy_owner(Entity *shot) { generated_stub("Entity::convert_shot_for_enemy_owner 0064bb70"); } -uint8_t Entity::CollidesWithGrid() { generated_stub("Entity::CollidesWithGrid 00665a80"); } -void Entity::GetRootParent() { generated_stub("Entity::GetRootParent 0067a720"); } -void Entity::constructor() { generated_stub("Entity::constructor 006a8290"); } -void Entity::destructor() { generated_stub("Entity::destructor 006a8850"); } -Entity * Entity::GetLastParent() { generated_stub("Entity::GetLastParent 006a8990"); } -Entity * Entity::GetLastChild() { generated_stub("Entity::GetLastChild 006a89b0"); } -Entity * Entity::GetLastSpawner() { generated_stub("Entity::GetLastSpawner 006a89d0"); } -Entity * Entity::GetStatusEffectTarget() { generated_stub("Entity::GetStatusEffectTarget 006a89f0"); } -void Entity::CopyStatusEffects() { generated_stub("Entity::CopyStatusEffects 006a8a20"); } -uint8_t Entity::HasCommonParentWithEntity(Entity *other) { generated_stub("Entity::HasCommonParentWithEntity 006a8c00"); } -uint8_t Entity::is_same_segmented_body(Entity *other) { generated_stub("Entity::is_same_segmented_body 006a8c60"); } -uint8_t Entity::DoesEntityShareStatus() { generated_stub("Entity::DoesEntityShareStatus 006a8db0"); } -uint8_t Entity::is_valid_boss_enemy(int unused) { generated_stub("Entity::is_valid_boss_enemy 006a8f20"); } -uint8_t Entity::CanDevolve() { generated_stub("Entity::CanDevolve 006a8f80"); } -uint8_t Entity::IsDescendantOf(Entity *ancestor) { generated_stub("Entity::IsDescendantOf 006a8fa0"); } -Entity * Entity::GetPlayerAncestor() { generated_stub("Entity::GetPlayerAncestor 006a9140"); } -void Entity::SetParent(Entity *parent) { generated_stub("Entity::SetParent 006a92a0"); } -void Entity::SetChild(Entity *child) { generated_stub("Entity::SetChild 006a92e0"); } -void Entity::SetTarget(Entity *target) { generated_stub("Entity::SetTarget 006a9320"); } -void Entity::SetSpawnerEntity(Entity *spawner) { generated_stub("Entity::SetSpawnerEntity 006a9360"); } -void * Entity::GetCollisionCapsule(void *outCapsule, Vector *offset) { generated_stub("Entity::GetCollisionCapsule 006a9ba0"); } -int Entity::FrameCount() { generated_stub("Entity::FrameCount 006a9c10"); } -bool Entity::HasFullHealth() { generated_stub("Entity::HasFullHealth 006a9c30"); } -void Entity::AddHealth(float amount) { generated_stub("Entity::AddHealth 006a9c50"); } -void Entity::CollideWithGrid(uint8_t isSimulated) { generated_stub("Entity::CollideWithGrid 006a9c90"); } -uint8_t Entity::is_grid_collision_at(Vector *position) { generated_stub("Entity::is_grid_collision_at 006ab240"); } -void Entity::PlayerCollideWithGrid(uint8_t isSimulated) { generated_stub("Entity::PlayerCollideWithGrid 006ab440"); } -void Entity::SetSize(float size, Vector sizeMulti, int numGridCollisionPoints) { generated_stub("Entity::SetSize 006ac2a0"); } -uint8_t Entity::IsEnemy() { generated_stub("Entity::IsEnemy 006ac530"); } -uint8_t Entity::IsVulnerableEnemy(Entity *source) { generated_stub("Entity::IsVulnerableEnemy 006ac560"); } -uint8_t Entity::IsFlying() { generated_stub("Entity::IsFlying 006ac6c0"); } -uint8_t Entity::IsFrame(int frequency, int offset) { generated_stub("Entity::IsFrame 006ac710"); } -int Entity::GetIntervalTicks(float interval, float offset) { generated_stub("Entity::GetIntervalTicks 006ac760"); } -int Entity::CountRelatedEntities(int type, int variant, int unused, void *outEntities) { generated_stub("Entity::CountRelatedEntities 006ac7e0"); } -int Entity::get_velocity_direction() { generated_stub("Entity::get_velocity_direction 006ac8d0"); } -uint8_t Entity::IsDamageSourceFriendly(EntityRef *source) { generated_stub("Entity::IsDamageSourceFriendly 006acd10"); } -bool Entity::HasMortalDamage() { generated_stub("Entity::HasMortalDamage 006ad340"); } -int Entity::apply_second_hand_duration(int duration, EntityRef *source) { generated_stub("Entity::apply_second_hand_duration 006ad350"); } -void Entity::AddFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) { generated_stub("Entity::AddFreeze 006ad3c0"); } -void Entity::AddPoison(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown) { generated_stub("Entity::AddPoison 006ad500"); } -void Entity::AddSlowing(EntityRef *ref, int duration, float amount, ColorMod color, uint8_t ignoreBossStatusCooldown) { generated_stub("Entity::AddSlowing 006ad750"); } -void Entity::AddCharmed(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t addEnemyKillScore) { generated_stub("Entity::AddCharmed 006ad870"); } -void Entity::AddConfusion(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) { generated_stub("Entity::AddConfusion 006add70"); } -void Entity::AddMidasFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) { generated_stub("Entity::AddMidasFreeze 006adf40"); } -void Entity::AddFear(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown) { generated_stub("Entity::AddFear 006ae0a0"); } -void Entity::AddBurn(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown) { generated_stub("Entity::AddBurn 006ae280"); } -void Entity::AddBleeding(EntityRef *ref, int duration, uint8_t unused) { generated_stub("Entity::AddBleeding 006ae420"); } -void Entity::RemoveStatusEffects() { generated_stub("Entity::RemoveStatusEffects 006ae630"); } -float Entity::IsCollisionIgnored(Entity *other) { generated_stub("Entity::IsCollisionIgnored 006b2210"); } -void Entity::push_apart_capsule(Entity *other) { generated_stub("Entity::push_apart_capsule 006b25b0"); } -uint8_t Entity::push_apart_circle(Entity *other) { generated_stub("Entity::push_apart_circle 006b2940"); } -void Entity::collide_with_entity() { generated_stub("Entity::collide_with_entity 006b2ee0"); } -uint8_t Entity::ForceCollide(Entity *boom, Entity *collider, uint8_t low) { generated_stub("Entity::ForceCollide 006b2f50"); } -void Entity::BloodExplode() { generated_stub("Entity::BloodExplode 006b45c0"); } -uint8_t Entity::IsActiveEnemy(uint8_t includeDead) { generated_stub("Entity::IsActiveEnemy 006b5b90"); } -void Entity::AddShrink(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t unk) { generated_stub("Entity::AddShrink 006b5c10"); } -void * Entity::GetData(void *outRef) { generated_stub("Entity::GetData 006b5e60"); } -void * Entity::GetDebugShape(uint8_t isUnknown) { generated_stub("Entity::GetDebugShape 006b5f10"); } -uint32_t Entity::GetHitListIndex() { generated_stub("Entity::GetHitListIndex 006b62b0"); } -Entity_Effect * Entity::MakeGroundPoof(Vector *position, ColorMod *color, float size) { generated_stub("Entity::MakeGroundPoof 006b6550"); } -Entity_Effect * Entity::MakeGroundPoofAtSelf(ColorMod *color, float size) { generated_stub("Entity::MakeGroundPoofAtSelf 006b66a0"); } -Entity_Effect * Entity::MakeBloodPoof(Vector *position, ColorMod *color, float scale) { generated_stub("Entity::MakeBloodPoof 006b66c0"); } -Entity_Effect * Entity::MakeBloodPoofAtPos(ColorMod *color, float scale) { generated_stub("Entity::MakeBloodPoofAtPos 006b6810"); } -Vector * Entity::GetNullOffset(Vector *outOffset, uint8_t *nullLayerName) { generated_stub("Entity::GetNullOffset 006b6af0"); } -Capsule * Entity::GetNullCapsule(Capsule *outCapsule, uint8_t *nullLayerName) { generated_stub("Entity::GetNullCapsule 006b6c20"); } -int * Entity::get_water_splash_variant(int *outSplash) { generated_stub("Entity::get_water_splash_variant 006b6ed0"); } -void Entity::AddMagnetized(EntityRef *ref, int duration, uint8_t unused) { generated_stub("Entity::AddMagnetized 006b7280"); } -void Entity::AddBaited(EntityRef *ref, int duration, uint8_t unused) { generated_stub("Entity::AddBaited 006b7560"); } -void Entity::AddWeakness(EntityRef *ref, int duration) { generated_stub("Entity::AddWeakness 006b77d0"); } -void Entity::AddBrimstoneMark(EntityRef *ref, int duration) { generated_stub("Entity::AddBrimstoneMark 006b78d0"); } -void Entity::AddIce(EntityRef *ref, int duration) { generated_stub("Entity::AddIce 006b79d0"); } -Entity_NPC * Entity::GiveMinecart(Vector *position, Vector *velocity) { generated_stub("Entity::GiveMinecart 006b7be0"); } -uint8_t Entity::IsPlayerInRadius(Vector *position, float radius, int unused1, int unused2) { generated_stub("Entity::IsPlayerInRadius 006b9740"); } -uint8_t Entity::IsHostileTo(Entity *other) { generated_stub("Entity::IsHostileTo 006d7d60"); } -uint8_t Entity::is_valid_target() { generated_stub("Entity::is_valid_target 006d8990"); } -int Entity::SpawnGridIndex() { generated_stub("Entity::SpawnGridIndex 006ef400"); } -void Entity::RemoveWithPoof(Entity *entity, int unusedArg) { generated_stub("Entity::RemoveWithPoof 007079c0"); } -void Entity::DestroyRockGridAt(Vector *position, GridEntityDesc *desc, Entity *source, int backdropType) { generated_stub("Entity::DestroyRockGridAt 0070c000"); } -int Entity::RenderZOffset() { generated_stub("Entity::RenderZOffset 007536f0"); } -int Entity::GetBossID() { generated_stub("Entity::GetBossID 007e9130"); } -uint8_t Entity::FlipX() { generated_stub("Entity::FlipX 0085dca0"); } -void Entity::SetSpriteFrame(std_string *animName, int frame) { generated_stub("Entity::SetSpriteFrame 0085dcb0"); } -void Entity::SetSpriteOverlayFrame(std_string *anim, int frame) { generated_stub("Entity::SetSpriteOverlayFrame 0085dd00"); } -Vector * Entity::SizeMulti(Vector *outResult) { generated_stub("Entity::SizeMulti 0085dd40"); } -uint32_t Entity::IsVulnerableEnemy_lua(void *param_1) { generated_stub("Entity::IsVulnerableEnemy_lua 0085e680"); } -void Entity::ReleaseLuaRef(Entity *entity) { generated_stub("Entity::ReleaseLuaRef 00866060"); } -long double Entity::Size(int param_1) { generated_stub("Entity::Size 00871f90"); } -void Entity::KillWithSource() { generated_stub("Entity::KillWithSource 008c5cf2"); } -void NPCAI_Pathfinder::ResetMovementTarget() { generated_stub("NPCAI_Pathfinder::ResetMovementTarget 007e6fa0"); } -uint8_t NPCAI_Pathfinder::HasPathToPos(Vector *position, uint8_t isIgnorePoop) { generated_stub("NPCAI_Pathfinder::HasPathToPos 007e7070"); } -void NPCAI_Pathfinder::SimulatePlayerMovement(float *param_2) { generated_stub("NPCAI_Pathfinder::SimulatePlayerMovement 007e8010"); } -Entity_Familiar::~Entity_Familiar() { generated_stub("Entity_Familiar::~Entity_Familiar 0060d3d0"); } -void Entity_Familiar::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Familiar::Init 0060de70"); } -void Entity_Familiar::Update() { generated_stub("Entity_Familiar::Update 0061da10"); } -void Entity_Familiar::Interpolate() { generated_stub("Entity_Familiar::Interpolate 00624a80"); } -void Entity_Familiar::Render(Vector *offset) { generated_stub("Entity_Familiar::Render 00624e10"); } -uint8_t Entity_Familiar::RenderShadowLayer(Vector *offset) { generated_stub("Entity_Familiar::RenderShadowLayer 00624dd0"); } -uint8_t Entity_Familiar::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) { generated_stub("Entity_Familiar::TakeDamage 0062cdc0"); } -void Entity_Familiar::Kill(EntityRef *source) { generated_stub("Entity_Familiar::Kill 00610540"); } -void Entity_Familiar::Remove() { generated_stub("Entity_Familiar::Remove 00610470"); } -void Entity_Familiar::guard_check_icall() { generated_stub("Entity_Familiar::guard_check_icall 00651890"); } -void Entity_Familiar::vfunc_12() { generated_stub("Entity_Familiar::vfunc_12 006518c0"); } -void Entity_Familiar::ClearReferences() { generated_stub("Entity_Familiar::ClearReferences 006121d0"); } -uint8_t Entity_Familiar::CanShutDoors() { generated_stub("Entity_Familiar::CanShutDoors 0060dab0"); } -uint8_t Entity_Familiar::TryThrow() { generated_stub("Entity_Familiar::TryThrow 0063c0a0"); } -void Entity_Familiar::HandleCollision() { generated_stub("Entity_Familiar::HandleCollision 006261f0"); } -void Entity_Familiar::ai_umbilical_baby(uint8_t isInterpolated) { generated_stub("Entity_Familiar::ai_umbilical_baby 00431be0"); } -void Entity_Familiar::set_extra_data(void *extraDataPtr, void *extraData) { generated_stub("Entity_Familiar::set_extra_data 004357e0"); } -void * Entity_Familiar::Player() { generated_stub("Entity_Familiar::Player 004361f0"); } -void Entity_Familiar::WispInit() { generated_stub("Entity_Familiar::WispInit 00436330"); } -uint32_t Entity_Familiar::wisp_kill() { generated_stub("Entity_Familiar::wisp_kill 00436fd0"); } -Entity_Tear * Entity_Familiar::fire_wisp_projectile(Vector velocity) { generated_stub("Entity_Familiar::fire_wisp_projectile 004386f0"); } -uint32_t Entity_Familiar::wisp_take_damage(float *param_2, uint32_t *param_3, int *param_4) { generated_stub("Entity_Familiar::wisp_take_damage 0043a5e0"); } -void Entity_Familiar::ai_wisp() { generated_stub("Entity_Familiar::ai_wisp 0043aa90"); } -void Entity_Familiar::ai_mr_me_wisp() { generated_stub("Entity_Familiar::ai_mr_me_wisp 0043db20"); } -void Entity_Familiar::ai_mega_blast_wisp() { generated_stub("Entity_Familiar::ai_mega_blast_wisp 0043e4a0"); } -int Entity_Familiar::GetRandomWisp(RNG *rng) { generated_stub("Entity_Familiar::GetRandomWisp 0043eb10"); } -int Entity_Familiar::Coins() { generated_stub("Entity_Familiar::Coins 00505cf0"); } -void Entity_Familiar::ai_buddy_inbox() { generated_stub("Entity_Familiar::ai_buddy_inbox 005ae490"); } -int Entity_Familiar::Hearts() { generated_stub("Entity_Familiar::Hearts 0060d0e0"); } -int Entity_Familiar::Keys() { generated_stub("Entity_Familiar::Keys 0060d100"); } -KColor * Entity_Familiar::GetPlayerSlot(KColor *outColor, Entity_Player *player) { generated_stub("Entity_Familiar::GetPlayerSlot 0060d180"); } -void Entity_Familiar::Constructor() { generated_stub("Entity_Familiar::Constructor 0060d200"); } -uint8_t Entity_Familiar::CanBeDamagedByEnemy() { generated_stub("Entity_Familiar::CanBeDamagedByEnemy 0060d8c0"); } -uint8_t Entity_Familiar::CanBlockProjectiles() { generated_stub("Entity_Familiar::CanBlockProjectiles 0060d8e0"); } -float Entity_Familiar::apply_tear_modifiers() { generated_stub("Entity_Familiar::apply_tear_modifiers 0060dc40"); } -void Entity_Familiar::set_locust_config_index(int param_2) { generated_stub("Entity_Familiar::set_locust_config_index 0060ddd0"); } -Entity * Entity_Familiar::get_orbit_parent() { generated_stub("Entity_Familiar::get_orbit_parent 00612330"); } -int Entity_Familiar::RecalculateOrbitOffset(int layer, uint8_t isAdd) { generated_stub("Entity_Familiar::RecalculateOrbitOffset 00612440"); } -void Entity_Familiar::AddToOrbit(int orbitLayer) { generated_stub("Entity_Familiar::AddToOrbit 006127b0"); } -void Entity_Familiar::RemoveFromOrbit() { generated_stub("Entity_Familiar::RemoveFromOrbit 00612820"); } -Vector * Entity_Familiar::GetOrbitDistance(Vector *outDistance, int layer) { generated_stub("Entity_Familiar::GetOrbitDistance 00612850"); } -uint8_t Entity_Familiar::is_detached_from_follow() { generated_stub("Entity_Familiar::is_detached_from_follow 00612890"); } -int Entity_Familiar::GetFollowerPriority() { generated_stub("Entity_Familiar::GetFollowerPriority 00612970"); } -uint8_t Entity_Familiar::IsLilithBirthrightIncubus() { generated_stub("Entity_Familiar::IsLilithBirthrightIncubus 00612af0"); } -Entity * Entity_Familiar::get_incubus_umbilical_whip() { generated_stub("Entity_Familiar::get_incubus_umbilical_whip 00612b50"); } -void Entity_Familiar::FollowParent() { generated_stub("Entity_Familiar::FollowParent 00612bb0"); } -void Entity_Familiar::FollowPosition(Vector *position) { generated_stub("Entity_Familiar::FollowPosition 00613910"); } -Vector * Entity_Familiar::GetOrbitPosition(Vector *outPosition, Vector *offset) { generated_stub("Entity_Familiar::GetOrbitPosition 006139b0"); } -Entity_Laser * Entity_Familiar::fire_robo_baby_laser(Vector *direction) { generated_stub("Entity_Familiar::fire_robo_baby_laser 00613c20"); } -void Entity_Familiar::PlayFloatAnim(int direction) { generated_stub("Entity_Familiar::PlayFloatAnim 00613df0"); } -void Entity_Familiar::AddToDelayed() { generated_stub("Entity_Familiar::AddToDelayed 00613fe0"); } -void Entity_Familiar::RemoveFromDelayed() { generated_stub("Entity_Familiar::RemoveFromDelayed 006141e0"); } -void Entity_Familiar::PlayChargeAnim(int direction) { generated_stub("Entity_Familiar::PlayChargeAnim 006142e0"); } -void Entity_Familiar::PlayShootAnim(int direction) { generated_stub("Entity_Familiar::PlayShootAnim 00614500"); } -void Entity_Familiar::Shoot() { generated_stub("Entity_Familiar::Shoot 00614b10"); } -void Entity_Familiar::ai_blue_fly() { generated_stub("Entity_Familiar::ai_blue_fly 00615d80"); } -void Entity_Familiar::ai_walker() { generated_stub("Entity_Familiar::ai_walker 00616db0"); } -void Entity_Familiar::ai_charger() { generated_stub("Entity_Familiar::ai_charger 006174c0"); } -void Entity_Familiar::ai_auto_shooter() { generated_stub("Entity_Familiar::ai_auto_shooter 00619270"); } -void Entity_Familiar::ai_blue_babys_only_friend() { generated_stub("Entity_Familiar::ai_blue_babys_only_friend 0061a240"); } -void Entity_Familiar::ai_pickup_sack() { generated_stub("Entity_Familiar::ai_pickup_sack 0061a4e0"); } -void Entity_Familiar::ai_flying_bird() { generated_stub("Entity_Familiar::ai_flying_bird 0061b8c0"); } -void Entity_Familiar::ai_daddy_longlegs() { generated_stub("Entity_Familiar::ai_daddy_longlegs 0061bd50"); } -void Entity_Familiar::ai_orbital_variant_50() { generated_stub("Entity_Familiar::ai_orbital_variant_50 0061c150"); } -void Entity_Familiar::ai_key_full() { generated_stub("Entity_Familiar::ai_key_full 0061d6b0"); } -uint8_t Entity_Familiar::CanPlayerFire() { generated_stub("Entity_Familiar::CanPlayerFire 0062a8f0"); } -void Entity_Familiar::AddCoins(int count) { generated_stub("Entity_Familiar::AddCoins 0062a930"); } -void Entity_Familiar::AddHearts(int param_2) { generated_stub("Entity_Familiar::AddHearts 0062aaa0"); } -void Entity_Familiar::TriggerRoomClear() { generated_stub("Entity_Familiar::TriggerRoomClear 0062aab0"); } -void Entity_Familiar::level_start() { generated_stub("Entity_Familiar::level_start 0062b360"); } -void Entity_Familiar::room_enter() { generated_stub("Entity_Familiar::room_enter 0062bb70"); } -void Entity_Familiar::farting_baby_fart() { generated_stub("Entity_Familiar::farting_baby_fart 0062c8d0"); } -void Entity_Familiar::mongo_baby_pick_next_mimic() { generated_stub("Entity_Familiar::mongo_baby_pick_next_mimic 0062d290"); } -void Entity_Familiar::RemoveFromFollowers() { generated_stub("Entity_Familiar::RemoveFromFollowers 0062d7e0"); } -void Entity_Familiar::AddToFollowers() { generated_stub("Entity_Familiar::AddToFollowers 0062db20"); } -void Entity_Familiar::set_player(Entity_Player *player) { generated_stub("Entity_Familiar::set_player 0062e020"); } -void Entity_Familiar::ai_samsons_chains() { generated_stub("Entity_Familiar::ai_samsons_chains 0062e120"); } -void Entity_Familiar::update_weapon(uint8_t isInterpolated) { generated_stub("Entity_Familiar::update_weapon 0062e620"); } -void Entity_Familiar::ai_lil_gurdy() { generated_stub("Entity_Familiar::ai_lil_gurdy 0062ee30"); } -void Entity_Familiar::AddKeys(int param_2) { generated_stub("Entity_Familiar::AddKeys 00630440"); } -void Entity_Familiar::store_backup(void *backup) { generated_stub("Entity_Familiar::store_backup 00630450"); } -void Entity_Familiar::MoveDelayed(int numFrames) { generated_stub("Entity_Familiar::MoveDelayed 00631050"); } -void Entity_Familiar::MoveDiagonally(float speed) { generated_stub("Entity_Familiar::MoveDiagonally 006312f0"); } -void Entity_Familiar::move_to_parent_offset() { generated_stub("Entity_Familiar::move_to_parent_offset 00631850"); } -void Entity_Familiar::delirium_morph() { generated_stub("Entity_Familiar::delirium_morph 00631b20"); } -void Entity_Familiar::init_lil_harbinger_sprite() { generated_stub("Entity_Familiar::init_lil_harbinger_sprite 006322f0"); } -void Entity_Familiar::render_charge_indicator(Vector *renderPos) { generated_stub("Entity_Familiar::render_charge_indicator 006324d0"); } -void Entity_Familiar::ai_lil_monstro() { generated_stub("Entity_Familiar::ai_lil_monstro 00632820"); } -void Entity_Familiar::ai_variant_111() { generated_stub("Entity_Familiar::ai_variant_111 00632d90"); } -void Entity_Familiar::update_angry_fly() { generated_stub("Entity_Familiar::update_angry_fly 00633500"); } -uint8_t Entity_Familiar::TryFireTear(Entity_Tear *tear) { generated_stub("Entity_Familiar::TryFireTear 00634000"); } -uint8_t Entity_Familiar::apply_baby_bender(Entity_Tear *tear) { generated_stub("Entity_Familiar::apply_baby_bender 006341a0"); } -Vector * Entity_Familiar::UpdateFollowPosition(Vector *outOffset) { generated_stub("Entity_Familiar::UpdateFollowPosition 00634260"); } -void Entity_Familiar::reset_follow_target() { generated_stub("Entity_Familiar::reset_follow_target 006348d0"); } -void Entity_Familiar::ResolveOrbitConflict() { generated_stub("Entity_Familiar::ResolveOrbitConflict 00634a40"); } -void Entity_Familiar::ai_lil_spewer() { generated_stub("Entity_Familiar::ai_lil_spewer 00634b10"); } -void Entity_Familiar::ai_lil_harbingers() { generated_stub("Entity_Familiar::ai_lil_harbingers 006378c0"); } -Entity_Laser * Entity_Familiar::FireBrimstone(Vector *AimDirection, uint8_t Unk) { generated_stub("Entity_Familiar::FireBrimstone 00638c10"); } -Entity * Entity_Familiar::ThrowDip(int subType, Vector *position, Entity *spawner) { generated_stub("Entity_Familiar::ThrowDip 00639000"); } -Entity_Tear * Entity_Familiar::FireProjectile(Vector *AimDirection, uint8_t Unk) { generated_stub("Entity_Familiar::FireProjectile 00639750"); } -Entity_Laser * Entity_Familiar::sprinkler_shoot_laser(float angle, float distance) { generated_stub("Entity_Familiar::sprinkler_shoot_laser 0063aef0"); } -void Entity_Familiar::update_idle_anim_by_size() { generated_stub("Entity_Familiar::update_idle_anim_by_size 0063b340"); } -void Entity_Familiar::RemoveFromPlayer(uint8_t UnusedRemoveFamiliar) { generated_stub("Entity_Familiar::RemoveFromPlayer 0063b8b0"); } -void Entity_Familiar::ai_minisaac() { generated_stub("Entity_Familiar::ai_minisaac 0063c1c0"); } -void Entity_Familiar::minisaac_fire() { generated_stub("Entity_Familiar::minisaac_fire 0063ce20"); } -void Entity_Familiar::minisaac_find_target() { generated_stub("Entity_Familiar::minisaac_find_target 0063dd60"); } -void Entity_Familiar::ai_blood_oath() { generated_stub("Entity_Familiar::ai_blood_oath 0063f9f0"); } -void Entity_Familiar::paschal_candle_sync_effects() { generated_stub("Entity_Familiar::paschal_candle_sync_effects 006402f0"); } -void Entity_Familiar::ai_boiled_baby() { generated_stub("Entity_Familiar::ai_boiled_baby 00640ca0"); } -void Entity_Familiar::zhl_misfit_006414c0() { generated_stub("Entity_Familiar::zhl_misfit_006414c0 006414c0"); } -void Entity_Familiar::ai_bird_cage() { generated_stub("Entity_Familiar::ai_bird_cage 006424d0"); } -void Entity_Familiar::ai_bot_fly() { generated_stub("Entity_Familiar::ai_bot_fly 006431d0"); } -void Entity_Familiar::ai_stitches() { generated_stub("Entity_Familiar::ai_stitches 006437a0"); } -Entity * Entity_Familiar::aim_reflected_projectile() { generated_stub("Entity_Familiar::aim_reflected_projectile 006444d0"); } -void Entity_Familiar::ai_shadow_intruder_damocles(uint8_t isInterpolating) { generated_stub("Entity_Familiar::ai_shadow_intruder_damocles 00644e80"); } -void * Entity_Familiar::get_item_config_entry() { generated_stub("Entity_Familiar::get_item_config_entry 006470c0"); } -uint8_t Entity_Familiar::abyss_locust_eat() { generated_stub("Entity_Familiar::abyss_locust_eat 00647170"); } -uint8_t Entity_Familiar::break_grid_ahead() { generated_stub("Entity_Familiar::break_grid_ahead 0064a2d0"); } -void Entity_Familiar::load_config_graphics() { generated_stub("Entity_Familiar::load_config_graphics 0064a830"); } -void Entity_Familiar::render_abyss_locust_sprite(ANM2 *param_2, float *param_3) { generated_stub("Entity_Familiar::render_abyss_locust_sprite 0064b6c0"); } -void Entity_Familiar::siren_charm(Entity *siren, Entity_Player *player) { generated_stub("Entity_Familiar::siren_charm 0064b920"); } -void Entity_Familiar::RemoveFromPlayer() { generated_stub("Entity_Familiar::RemoveFromPlayer 0064bab0"); } -void Entity_Familiar::UpdateDirtColor(uint8_t Immediate) { generated_stub("Entity_Familiar::UpdateDirtColor 0064ca30"); } -void Entity_Familiar::update_star_of_bethlehem_speed(uint8_t isForce) { generated_stub("Entity_Familiar::update_star_of_bethlehem_speed 0064d1d0"); } -void Entity_Familiar::ai_blood_clot(uint8_t isPostMove) { generated_stub("Entity_Familiar::ai_blood_clot 0064e0c0"); } -void Entity_Familiar::predict_player_movement() { generated_stub("Entity_Familiar::predict_player_movement 00650220"); } -uint8_t Entity_Familiar::multidimensional_baby_copy_knife(Entity_Knife *knife, Entity *unused) { generated_stub("Entity_Familiar::multidimensional_baby_copy_knife 009615e0"); } -Entity_Familiar::ExtraData::~ExtraData() { generated_stub("Entity_Familiar::ExtraData::~ExtraData 00431710"); } AbyssLocustData::~AbyssLocustData() { generated_stub("AbyssLocustData::~AbyssLocustData 0060d5e0"); } uint8_t AfterbirthPersistentGameData::check_header(void *stream) { generated_stub("AfterbirthPersistentGameData::check_header 0041d670"); } void Ambush::shuffle_waves() { generated_stub("Ambush::shuffle_waves 008332e0"); } @@ -8584,18 +8227,6 @@ void Ambush::StartChallenge() { generated_stub("Ambush::StartChallenge 00833420" void Ambush::SpawnWave() { generated_stub("Ambush::SpawnWave 00833600"); } void Ambush::SpawnBossrushWave() { generated_stub("Ambush::SpawnBossrushWave 00833c40"); } void Ambush::Update() { generated_stub("Ambush::Update 00834350"); } -uint8_t RoomDescriptor::Clear() { generated_stub("RoomDescriptor::Clear 00436010"); } -uint32_t RoomDescriptor::PressurePlatesTriggered() { generated_stub("RoomDescriptor::PressurePlatesTriggered 00456560"); } -uint32_t RoomDescriptor::HasWater() { generated_stub("RoomDescriptor::HasWater 00505c30"); } -uint32_t RoomDescriptor::SacrificeDone() { generated_stub("RoomDescriptor::SacrificeDone 005cd640"); } -RoomConfig_Room * RoomDescriptor::constructor() { generated_stub("RoomDescriptor::constructor 006ef590"); } -void RoomDescriptor::destructor() { generated_stub("RoomDescriptor::destructor 006ef9c0"); } -uint32_t RoomDescriptor::ChallengeDone() { generated_stub("RoomDescriptor::ChallengeDone 0070c550"); } -uint32_t RoomDescriptor::SurpriseMiniboss() { generated_stub("RoomDescriptor::SurpriseMiniboss 00738180"); } -RoomDescriptor * RoomDescriptor::operator_assign(RoomDescriptor *other) { generated_stub("RoomDescriptor::operator_assign 007387d0"); } -RoomDescriptor * RoomDescriptor::copy_constructor(RoomDescriptor *other) { generated_stub("RoomDescriptor::copy_constructor 00749040"); } -RoomDescriptor * RoomDescriptor::move_constructor(RoomDescriptor *other) { generated_stub("RoomDescriptor::move_constructor 00752e80"); } -uint32_t RoomDescriptor::NoReward() { generated_stub("RoomDescriptor::NoReward 007e9190"); } void BeamRenderer::Begin(ANM2 *anm2, uint32_t layer, uint8_t isUseOverlay, uint8_t isUnk) { generated_stub("BeamRenderer::Begin 0041e480"); } void BeamRenderer::Add(Vector *point, ColorMod *color, float spritesheetCoordinate, float width) { generated_stub("BeamRenderer::Add 0041e720"); } void BeamRenderer::End() { generated_stub("BeamRenderer::End 0041e960"); } @@ -8618,29 +8249,10 @@ uint8_t BitSet128::Get(uint32_t bit) { generated_stub("BitSet128::Get 0085e560") void BitSet128::Set(uint32_t bit, uint8_t value) { generated_stub("BitSet128::Set 0085e5c0"); } void BossOverlay::update() { generated_stub("BossOverlay::update 004212c0"); } void BossOverlay::play(int overlayType) { generated_stub("BossOverlay::play 004214b0"); } -void BossPool::init(uint32_t seed) { generated_stub("BossPool::init 004218e0"); } -void BossPool::load_xml(uint8_t *param_1, int param_2) { generated_stub("BossPool::load_xml 00421bf0"); } -int BossPool::GetBossId(int leveltype, int levelvariant, RNG *rng) { generated_stub("BossPool::GetBossId 00422830"); } -void Camera::UpdateUltrasmooth(uint32_t *param_2, int *param_3) { generated_stub("Camera::UpdateUltrasmooth 0091e980"); } -void Camera::constructor(Room *room) { generated_stub("Camera::constructor 009428d0"); } -Vector * Camera::get_enemy_focus_offset(Vector *outOffset) { generated_stub("Camera::get_enemy_focus_offset 00942f20"); } -void Camera::get_clamp_bounds(Vector *outMax, Vector *outMin) { generated_stub("Camera::get_clamp_bounds 009432f0"); } -Vector * Camera::ClampedToRoom(Vector *outPosition, Vector position) { generated_stub("Camera::ClampedToRoom 00943490"); } -Vector * Camera::soft_clamp_position(Vector *outPosition, float x, float y) { generated_stub("Camera::soft_clamp_position 00943610"); } -void Camera::DoUpdate(uint8_t unk) { generated_stub("Camera::DoUpdate 009437e0"); } -void Camera::update_focus_position(uint8_t isSkipFocusBuffer) { generated_stub("Camera::update_focus_position 009439d0"); } -void Camera::update_follow() { generated_stub("Camera::update_follow 009446e0"); } -uint8_t Camera::IsPosVisible(Vector *Pos) { generated_stub("Camera::IsPosVisible 00944a40"); } -void Camera::SetFocusPosition(Vector *pos) { generated_stub("Camera::SetFocusPosition 00944d10"); } -void Camera::SnapToPosition(Vector *pos) { generated_stub("Camera::SnapToPosition 00944d40"); } void Capsule::constructor(Vector *position, Vector *multiplier, float rotation, float size) { generated_stub("Capsule::constructor 00945190"); } void Capsule::constructor2(Vector *Position, Vector *TargetPosition, float size) { generated_stub("Capsule::constructor2 009452e0"); } void Capsule::get_bounding_box(Vector *outMin, Vector *outMax) { generated_stub("Capsule::get_bounding_box 00945400"); } uint8_t Capsule::Collide(Capsule *a, Capsule *b, Vector *outHit) { generated_stub("Capsule::Collide 00945470"); } -void CellSpace::insert(Entity *entity) { generated_stub("CellSpace::insert 0041bb50"); } -void CellSpace::collide_entity(Entity *entity) { generated_stub("CellSpace::collide_entity 0041bdf0"); } -void CellSpace::collide(void *entityB) { generated_stub("CellSpace::collide 0041c070"); } -void CellSpace::collide_self() { generated_stub("CellSpace::collide_self 0041c2a0"); } Color::Color() { generated_stub("Color::Color 00407170"); } ColorMod * Color::operator_assign(ColorMod *other) { generated_stub("Color::operator_assign 004071c0"); } float Color::R() { generated_stub("Color::R 00407240"); } @@ -8745,851 +8357,48 @@ void DeathmatchTypeVenom::FUN_0042bc40(Entity *param_1) { generated_stub("Deathm void DeathmatchTypeVenom::FUN_0042c070(Entity_Player *param_1, uint64_t *param_2) { generated_stub("DeathmatchTypeVenom::FUN_0042c070 0042db40"); } void DebugRenderer::Render() { generated_stub("DebugRenderer::Render 0042dbb0"); } void * DebugRenderer::Get(int Index, uint8_t Unk) { generated_stub("DebugRenderer::Get 0042eb10"); } +Vector * Vector::operator_mul(Vector *outResult, float *scalar, Vector *vector) { generated_stub("Vector::operator_mul 004171d0"); } +Vector * Vector::ToCardinal(Vector *outResult, Vector *vec) { generated_stub("Vector::ToCardinal 0067f170"); } +Vector * Vector::mul_065(Vector *outResult, Vector *source) { generated_stub("Vector::mul_065 0067f2b0"); } +Vector * Vector::operator_assign(Vector *other) { generated_stub("Vector::operator_assign 007dd3b0"); } +uint8_t * Vector::__tostring() { generated_stub("Vector::__tostring 0085e630"); } +Vector::Vector(float x, float y) { generated_stub("Vector::Vector 00a0fe90"); } +float Vector::Length() { generated_stub("Vector::Length 00a0fea0"); } +float Vector::LengthSquared() { generated_stub("Vector::LengthSquared 00a0fed0"); } +float Vector::Distance(Vector *other) { generated_stub("Vector::Distance 00a0ff30"); } +float Vector::DistanceSquared(Vector *other) { generated_stub("Vector::DistanceSquared 00a0ff90"); } +void Vector::Normalize() { generated_stub("Vector::Normalize 00a0ffc0"); } +Vector * Vector::Normalized(Vector *outResult) { generated_stub("Vector::Normalized 00a10030"); } +void Vector::Resize(float length) { generated_stub("Vector::Resize 00a100b0"); } +Vector * Vector::Resized(Vector *outVec, float length) { generated_stub("Vector::Resized 00a10100"); } +float Vector::Dot(Vector *other) { generated_stub("Vector::Dot 00a10180"); } +float Vector::Cross(Vector *other) { generated_stub("Vector::Cross 00a101a0"); } +void Vector::Lerp(Vector *target, float t, uint8_t isClamped) { generated_stub("Vector::Lerp 00a10210"); } +void Vector::Rotate(float angleDegrees) { generated_stub("Vector::Rotate 00a10270"); } +Vector * Vector::Rotated(Vector *outVec, float angleDegrees) { generated_stub("Vector::Rotated 00a102e0"); } +Vector * Vector::FromAngle(Vector *outVec, float angleDegrees) { generated_stub("Vector::FromAngle 00a10350"); } +float Vector::GetAngleDegrees() { generated_stub("Vector::GetAngleDegrees 00a10390"); } +void Vector::Clamp(float minX, float minY, float maxX, float maxY) { generated_stub("Vector::Clamp 00a103c0"); } +Vector * Vector::Clamped(Vector *outResult, float minX, float minY, float maxX, float maxY) { generated_stub("Vector::Clamped 00a103f0"); } +Vector * Vector::__add(Vector *outVec, Vector *other) { generated_stub("Vector::__add 00a10420"); } +Vector * Vector::operator_add_assign(Vector *other) { generated_stub("Vector::operator_add_assign 00a10450"); } +Vector * Vector::__sub(Vector *outResult, Vector *other) { generated_stub("Vector::__sub 00a10480"); } +Vector * Vector::operator__(Vector *other) { generated_stub("Vector::operator__ 00a104b0"); } +Vector * Vector::__mul(Vector *outResult, float *scalar) { generated_stub("Vector::__mul 00a104e0"); } +Vector * Vector::Mul(Vector *outResult, Vector *other) { generated_stub("Vector::Mul 00a10510"); } +Vector * Vector::operator_mul_assign(float *scalar) { generated_stub("Vector::operator_mul_assign 00a10540"); } +Vector * Vector::__div(Vector *outResult, float *divisor) { generated_stub("Vector::__div 00a105a0"); } +Vector * Vector::__div_assign(float *divisor) { generated_stub("Vector::__div_assign 00a105d0"); } +uint8_t Vector::operator_eq(Vector *other) { generated_stub("Vector::operator_eq 00a10600"); } +uint8_t Vector::operator_ne(Vector *other) { generated_stub("Vector::operator_ne 00a10630"); } +Vector * Vector::__unm(Vector *outResult) { generated_stub("Vector::__unm 00a10660"); } Entity * EntityFactory::Create(uint32_t type, uint8_t force) { generated_stub("EntityFactory::Create 006f0090"); } void EntityFactory::constructor() { generated_stub("EntityFactory::constructor 006f2a10"); } -void EntityList_EL::constructor(EntityList_EL *source) { generated_stub("EntityList_EL::constructor 00417510"); } -void EntityList_EL::push_back(Entity *entity) { generated_stub("EntityList_EL::push_back 00417630"); } -void EntityList_EL::remove(Entity *entity) { generated_stub("EntityList_EL::remove 00417670"); } -void EntityList::sublist_init(EntityList_EL *parent, int capacity) { generated_stub("EntityList::sublist_init 00417540"); } -int EntityList::Size() { generated_stub("EntityList::Size 004176f0"); } -void EntityList::Reset() { generated_stub("EntityList::Reset 00418230"); } -void EntityList::AddEntity(Entity *entity) { generated_stub("EntityList::AddEntity 00418500"); } -void EntityList::Update(uint8_t isTransition) { generated_stub("EntityList::Update 004186c0"); } -void EntityList::sort_by_render_z() { generated_stub("EntityList::sort_by_render_z 00419750"); } -void EntityList::render_up_to(uint32_t maxDepth, Vector *offset) { generated_stub("EntityList::render_up_to 004199d0"); } -void EntityList::rebuild_sublists() { generated_stub("EntityList::rebuild_sublists 00419e70"); } -void EntityList::AddPersistentEntity(Entity *entity) { generated_stub("EntityList::AddPersistentEntity 0041b4f0"); } -void EntityList::invalidate_type_cache(int type, int variant, int subType) { generated_stub("EntityList::invalidate_type_cache 0041b570"); } -int EntityList::CountEntities(Entity *spawner, int type, int variant, int subType) { generated_stub("EntityList::CountEntities 0041b7b0"); } -uint8_t EntityList::HitListContains(Entity *entity) { generated_stub("EntityList::HitListContains 00431640"); } -EntityList_EL * EntityList::assign(EntityList_EL *dest, EntityList_EL *source) { generated_stub("EntityList::assign 006b8320"); } -Entity * EntityList::Get(uint32_t index) { generated_stub("EntityList::Get 0085e0c0"); } EntityList_Query::~EntityList_Query() { generated_stub("EntityList_Query::~EntityList_Query 004175b0"); } -void EntityPartition::query_box(EntityList_EL *outList, Vector *position, Vector *extent) { generated_stub("EntityPartition::query_box 0041c490"); } void EntitySaveState::constructor() { generated_stub("EntitySaveState::constructor 004d3080"); } void EntitySaveState::copy(void *other) { generated_stub("EntitySaveState::copy 004d3130"); } void EntitySaveState::set_extra_data(uint32_t param_1) { generated_stub("EntitySaveState::set_extra_data 00827f70"); } void EntitySaveStateRef::Set(void *state) { generated_stub("EntitySaveStateRef::Set 006eee10"); } -Entity_Bomb::~Entity_Bomb() { generated_stub("Entity_Bomb::~Entity_Bomb 006a1f30"); } -void Entity_Bomb::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Bomb::Init 006a2050"); } -void Entity_Bomb::Update() { generated_stub("Entity_Bomb::Update 006a24d0"); } -void Entity_Bomb::Render(Vector *offset) { generated_stub("Entity_Bomb::Render 006a5a60"); } -void Entity_Bomb::HandleCollision() { generated_stub("Entity_Bomb::HandleCollision 006a5f00"); } -uint8_t Entity_Bomb::IsFetus() { generated_stub("Entity_Bomb::IsFetus 004316a0"); } -void Entity_Bomb::SetExplosionCountdown(int countdown) { generated_stub("Entity_Bomb::SetExplosionCountdown 00452c40"); } -BitSet128 * Entity_Bomb::Flags(BitSet128 *outResult) { generated_stub("Entity_Bomb::Flags 005cd560"); } -long double Entity_Bomb::RadiusMultiplier() { generated_stub("Entity_Bomb::RadiusMultiplier 0060cdc0"); } -uint8_t Entity_Bomb::IsRocket() { generated_stub("Entity_Bomb::IsRocket 006a2030"); } -void Entity_Bomb::update_sparks() { generated_stub("Entity_Bomb::update_sparks 006a6f10"); } -Entity_Dummy::~Entity_Dummy() { generated_stub("Entity_Dummy::~Entity_Dummy 006a7ee0"); } -void Entity_Dummy::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Dummy::Init 006a7f20"); } -void Entity_Dummy::Update() { generated_stub("Entity_Dummy::Update 006a7f30"); } -void Entity_Dummy::Render(Vector *offset) { generated_stub("Entity_Dummy::Render 006a7f80"); } -void Entity_Dummy::HandleCollision() { generated_stub("Entity_Dummy::HandleCollision 006a80c0"); } -Entity_Effect::~Entity_Effect() { generated_stub("Entity_Effect::~Entity_Effect 005cd9f0"); } -void Entity_Effect::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Effect::Init 005cdb20"); } -void Entity_Effect::Update() { generated_stub("Entity_Effect::Update 005d4380"); } -void Entity_Effect::Interpolate() { generated_stub("Entity_Effect::Interpolate 005d2520"); } -void Entity_Effect::Render(Vector *offset) { generated_stub("Entity_Effect::Render 00607620"); } -void Entity_Effect::Remove() { generated_stub("Entity_Effect::Remove 005d2420"); } -void Entity_Effect::guard_check_icall() { generated_stub("Entity_Effect::guard_check_icall 0060c370"); } -void Entity_Effect::ClearReferences() { generated_stub("Entity_Effect::ClearReferences 0060abb0"); } -uint8_t Entity_Effect::CanShutDoors() { generated_stub("Entity_Effect::CanShutDoors 0060c400"); } -void Entity_Effect::HandleCollision() { generated_stub("Entity_Effect::HandleCollision 005ccc20"); } -void Entity_Effect::render_player_target(Vector *offset, int segmentMode) { generated_stub("Entity_Effect::render_player_target 00435290"); } -void Entity_Effect::set_state(int state) { generated_stub("Entity_Effect::set_state 00435e60"); } -void Entity_Effect::SetTimeout(int timeout) { generated_stub("Entity_Effect::SetTimeout 00435e90"); } -void Entity_Effect::set_rotation(float rotation) { generated_stub("Entity_Effect::set_rotation 00435eb0"); } -void Entity_Effect::SetRadii(float minRadius, float maxRadius) { generated_stub("Entity_Effect::SetRadii 00435ef0"); } -void Entity_Effect::FollowParent(Entity *parent) { generated_stub("Entity_Effect::FollowParent 004564b0"); } -long double Entity_Effect::Scale() { generated_stub("Entity_Effect::Scale 004d7770"); } -long double Entity_Effect::Rotation() { generated_stub("Entity_Effect::Rotation 005784c0"); } -bool Entity_Effect::rift_attract_filter(int param_1, int param_2) { generated_stub("Entity_Effect::rift_attract_filter 005cd950"); } -void Entity_Effect::constructor() { generated_stub("Entity_Effect::constructor 005cd960"); } -void Entity_Effect::update_mr_me() { generated_stub("Entity_Effect::update_mr_me 005d2a70"); } -void Entity_Effect::update_wave_chain() { generated_stub("Entity_Effect::update_wave_chain 005d4010"); } -void Entity_Effect::moonlight_timer_callback(int param_1) { generated_stub("Entity_Effect::moonlight_timer_callback 006073f0"); } -uint8_t Entity_Effect::IsPlayerCreep(int variant) { generated_stub("Entity_Effect::IsPlayerCreep 0060ac20"); } -Entity_Effect * Entity_Effect::CreateTimer(void *fn, uint32_t delay, uint32_t times, uint8_t isPersistent) { generated_stub("Entity_Effect::CreateTimer 0060af00"); } -void Entity_Effect::update_variant178_shooter(uint8_t isPositionOnly) { generated_stub("Entity_Effect::update_variant178_shooter 0060b0d0"); } -Entity_Effect * Entity_Effect::CreateLootPreview(void *lootlist, Vector *pos, Entity *owner, Entity_Effect *effect) { generated_stub("Entity_Effect::CreateLootPreview 0060b7a0"); } -void Entity_Effect::setup_loot_preview(void *lootQueue) { generated_stub("Entity_Effect::setup_loot_preview 0060bae0"); } -void Entity_Effect::SetDamageSource(int param_2) { generated_stub("Entity_Effect::SetDamageSource 0060ce20"); } -Entity_Effect::ExtraData::~ExtraData() { generated_stub("Entity_Effect::ExtraData::~ExtraData 005cd530"); } -void Entity_Effect::ExtraDataRef::Set(void *extraData) { generated_stub("Entity_Effect::ExtraDataRef::Set 0060c620"); } -HomingLaser * HomingLaser::operator_assign(HomingLaser *other) { generated_stub("HomingLaser::operator_assign 0085e000"); } -HomingLaser::HomingLaser() { generated_stub("HomingLaser::HomingLaser 0099c290"); } -void HomingLaser::build_bezier_path(int homingType, Entity *source) { generated_stub("HomingLaser::build_bezier_path 0099c790"); } -void HomingLaser::compute_axis_bezier_handles() { generated_stub("HomingLaser::compute_axis_bezier_handles 0099dca0"); } -void HomingLaser::compute_bezier_handles(float tension) { generated_stub("HomingLaser::compute_bezier_handles 0099e160"); } -void HomingLaser::CalculateSamples(float param_2) { generated_stub("HomingLaser::CalculateSamples 0099e360"); } -void HomingLaser::apply_sine_offset(float amplitude, float phase) { generated_stub("HomingLaser::apply_sine_offset 0099ec00"); } -void HomingLaser::build_curl_path(float radius) { generated_stub("HomingLaser::build_curl_path 0099fa60"); } -void HomingLaser::build_wiggle_bezier() { generated_stub("HomingLaser::build_wiggle_bezier 0099fed0"); } -uint8_t HomingLaser::clip_samples_to_grid(Vector *pos, int gridCollisionClass) { generated_stub("HomingLaser::clip_samples_to_grid 009a0520"); } -void HomingLaser::truncate_samples_at_player() { generated_stub("HomingLaser::truncate_samples_at_player 009a0740"); } -void HomingLaser::truncate_samples_at_obstacle(Vector *positionOffset) { generated_stub("HomingLaser::truncate_samples_at_obstacle 009a0c50"); } -void HomingLaser::remove_collinear_samples(float tolerance) { generated_stub("HomingLaser::remove_collinear_samples 009a0de0"); } -void HomingLaser::apply_sample_wiggle(float amplitude, float phase) { generated_stub("HomingLaser::apply_sample_wiggle 009a0fa0"); } -uint32_t HomingLaser::find_targets(float *param_1, float *param_2, int param_3, uint32_t param_4, Entity *param_5) { generated_stub("HomingLaser::find_targets 009a12b0"); } -uint8_t HomingLaser::truncate_samples(float maxLength) { generated_stub("HomingLaser::truncate_samples 009a1520"); } -Entity_Knife::~Entity_Knife() { generated_stub("Entity_Knife::~Entity_Knife 00960b50"); } -void Entity_Knife::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Knife::Init 00960c10"); } -void Entity_Knife::Update() { generated_stub("Entity_Knife::Update 00961b00"); } -void Entity_Knife::Interpolate() { generated_stub("Entity_Knife::Interpolate 00967db0"); } -void Entity_Knife::Render(Vector *offset) { generated_stub("Entity_Knife::Render 00965d30"); } -int Entity_Knife::GetRenderZ() { generated_stub("Entity_Knife::GetRenderZ 009665e0"); } -void Entity_Knife::ClearReferences() { generated_stub("Entity_Knife::ClearReferences 009611d0"); } -void Entity_Knife::HandleCollision() { generated_stub("Entity_Knife::HandleCollision 009666f0"); } -long double Entity_Knife::Rotation() { generated_stub("Entity_Knife::Rotation 004d7790"); } -long double Entity_Knife::GetKnifeVelocity() { generated_stub("Entity_Knife::GetKnifeVelocity 004d77a0"); } -uint8_t Entity_Knife::IsFlying() { generated_stub("Entity_Knife::IsFlying 0060cf10"); } -void Entity_Knife::SetPathFollowSpeed(float param_2) { generated_stub("Entity_Knife::SetPathFollowSpeed 0060cfb0"); } -BitSet128 * Entity_Knife::TearFlags(BitSet128 *outFlags) { generated_stub("Entity_Knife::TearFlags 0085de90"); } -long double Entity_Knife::GetKnifeDistance() { generated_stub("Entity_Knife::GetKnifeDistance 0085deb0"); } -long double Entity_Knife::RotationOffset() { generated_stub("Entity_Knife::RotationOffset 0085dec0"); } -int Entity_Knife::GetBaseVariant() { generated_stub("Entity_Knife::GetBaseVariant 00960a20"); } -void Entity_Knife::Constructor() { generated_stub("Entity_Knife::Constructor 00960a70"); } -void * Entity_Knife::GetHitEntities() { generated_stub("Entity_Knife::GetHitEntities 009612e0"); } -void Entity_Knife::InitHomingPath(Vector direction, Entity *source, float pathOffset) { generated_stub("Entity_Knife::InitHomingPath 00961320"); } -void Entity_Knife::copy_parent_state(Entity_Knife *source) { generated_stub("Entity_Knife::copy_parent_state 009614d0"); } -uint32_t Entity_Knife::spawn_child_knife() { generated_stub("Entity_Knife::spawn_child_knife 00961870"); } -Entity_Player * Entity_Knife::GetPlayer() { generated_stub("Entity_Knife::GetPlayer 00966650"); } -Entity * Entity_Knife::GetRootParent() { generated_stub("Entity_Knife::GetRootParent 009666c0"); } -void Entity_Knife::Shoot(float charge, float range) { generated_stub("Entity_Knife::Shoot 00966ef0"); } -void Entity_Knife::UpdateHomingPath() { generated_stub("Entity_Knife::UpdateHomingPath 00967180"); } -void Entity_Knife::update_target(float *outAngle) { generated_stub("Entity_Knife::update_target 00967650"); } -void Entity_Knife::apply_wiggle(float *param_2) { generated_stub("Entity_Knife::apply_wiggle 00967a70"); } -void Entity_Knife::screen_wrap() { generated_stub("Entity_Knife::screen_wrap 00967d20"); } -void Entity_Knife::Reset() { generated_stub("Entity_Knife::Reset 00967fc0"); } -void Entity_Knife::SetAttackAnimation() { generated_stub("Entity_Knife::SetAttackAnimation 009680d0"); } -void Entity_Knife::SpinAttack(short remainingSpins, int startFrame) { generated_stub("Entity_Knife::SpinAttack 00968430"); } -uint8_t Entity_Knife::drain_notched_axe(int charge) { generated_stub("Entity_Knife::drain_notched_axe 00968660"); } -void Entity_Knife::UpdateSwingHits() { generated_stub("Entity_Knife::UpdateSwingHits 009688d0"); } -Entity_Laser::~Entity_Laser() { generated_stub("Entity_Laser::~Entity_Laser 0096ccf0"); } -void Entity_Laser::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Laser::Init 0096f590"); } -void Entity_Laser::Update() { generated_stub("Entity_Laser::Update 00977cc0"); } -void Entity_Laser::Interpolate() { generated_stub("Entity_Laser::Interpolate 0097e6f0"); } -void Entity_Laser::Render(Vector *offset) { generated_stub("Entity_Laser::Render 009785d0"); } -uint8_t Entity_Laser::RenderShadowLayer(Vector *offset) { generated_stub("Entity_Laser::RenderShadowLayer 0097ca90"); } -void Entity_Laser::PostRender() { generated_stub("Entity_Laser::PostRender 0097eb50"); } -void Entity_Laser::Remove() { generated_stub("Entity_Laser::Remove 0097ea30"); } -int Entity_Laser::GetRenderZ() { generated_stub("Entity_Laser::GetRenderZ 0096ced0"); } -uint8_t Entity_Laser::CanOverwrite() { generated_stub("Entity_Laser::CanOverwrite 0097e7a0"); } -void Entity_Laser::ClearReferences() { generated_stub("Entity_Laser::ClearReferences 0097e800"); } -void Entity_Laser::HandleCollision() { generated_stub("Entity_Laser::HandleCollision 005ccc20"); } -void Entity_Laser::SetTimeout(int param_2) { generated_stub("Entity_Laser::SetTimeout 00435f20"); } -void Entity_Laser::SetMaxDistance(float maxDistance) { generated_stub("Entity_Laser::SetMaxDistance 00435f30"); } -uint8_t Entity_Laser::IsCircleLaser() { generated_stub("Entity_Laser::IsCircleLaser 00435f50"); } -void Entity_Laser::SetHomingType(int param_2) { generated_stub("Entity_Laser::SetHomingType 00456850"); } -void Entity_Laser::set_disable_init_sound(uint8_t param_2) { generated_stub("Entity_Laser::set_disable_init_sound 004aaed0"); } -void Entity_Laser::SetOneHit(uint8_t param_2) { generated_stub("Entity_Laser::SetOneHit 005cd580"); } -void Entity_Laser::SetMultidimensionalTouched(uint8_t param_2) { generated_stub("Entity_Laser::SetMultidimensionalTouched 005cd590"); } -long double Entity_Laser::Radius() { generated_stub("Entity_Laser::Radius 0060cea0"); } -void Entity_Laser::SetBlackHpDropChance(float param_2) { generated_stub("Entity_Laser::SetBlackHpDropChance 0060ceb0"); } -Vector * Entity_Laser::GetEndPoint() { generated_stub("Entity_Laser::GetEndPoint 007e9230"); } -bool Entity_Laser::IsSampleLaser() { generated_stub("Entity_Laser::IsSampleLaser 007e9240"); } -void Entity_Laser::Constructor() { generated_stub("Entity_Laser::Constructor 0096cb60"); } -void Entity_Laser::destructor() { generated_stub("Entity_Laser::destructor 0096cd20"); } -uint8_t Entity_Laser::is_thick_variant() { generated_stub("Entity_Laser::is_thick_variant 0096ce30"); } -uint8_t Entity_Laser::CanDamageEntity(Entity *entity) { generated_stub("Entity_Laser::CanDamageEntity 0096cf80"); } -void Entity_Laser::impact_tear_flag_effects(Vector *position, Vector *direction) { generated_stub("Entity_Laser::impact_tear_flag_effects 0096d3f0"); } -ColorMod * Entity_Laser::get_tear_spawn_color(ColorMod *outColor) { generated_stub("Entity_Laser::get_tear_spawn_color 0096ee00"); } -void Entity_Laser::copy_from_parent(Entity_Laser *parent, uint8_t isCopySpawnData) { generated_stub("Entity_Laser::copy_from_parent 0096f070"); } -void Entity_Laser::RotateToAngle(float angle, float speed) { generated_stub("Entity_Laser::RotateToAngle 0096f470"); } -void Entity_Laser::ClearLaserSamples() { generated_stub("Entity_Laser::ClearLaserSamples 0096f4e0"); } -void Entity_Laser::PlayInitSound() { generated_stub("Entity_Laser::PlayInitSound 0096f880"); } -Vector * Entity_Laser::calc_end_point(Vector *outEndPoint, Vector *start, Vector *direction) { generated_stub("Entity_Laser::calc_end_point 0096fc70"); } -void Entity_Laser::update_first_frame() { generated_stub("Entity_Laser::update_first_frame 009704a0"); } -void Entity_Laser::find_nearest_grid_hit(int unusedFlag, Vector *offset) { generated_stub("Entity_Laser::find_nearest_grid_hit 00970cb0"); } -uint8_t Entity_Laser::damage_grid_entity(int gridIndex, int unused, Vector *direction) { generated_stub("Entity_Laser::damage_grid_entity 00971590"); } -void Entity_Laser::update_line_hits() { generated_stub("Entity_Laser::update_line_hits 00971810"); } -void Entity_Laser::update_endpoint_and_hits() { generated_stub("Entity_Laser::update_endpoint_and_hits 009737b0"); } -void Entity_Laser::refresh_tear_params() { generated_stub("Entity_Laser::refresh_tear_params 00973a50"); } -void Entity_Laser::update_laser() { generated_stub("Entity_Laser::update_laser 00973c60"); } -void Entity_Laser::UpdateHits() { generated_stub("Entity_Laser::UpdateHits 0097baa0"); } -void * Entity_Laser::GetSamples() { generated_stub("Entity_Laser::GetSamples 0097e3b0"); } -void Entity_Laser::damage_entity(Entity *param_2) { generated_stub("Entity_Laser::damage_entity 0097e3c0"); } -void * Entity_Laser::GetNonOptimizedSamples() { generated_stub("Entity_Laser::GetNonOptimizedSamples 0097e6e0"); } -void Entity_Laser::spawn_impact_effect(int unused) { generated_stub("Entity_Laser::spawn_impact_effect 0097f820"); } -void Entity_Laser::ResetSpriteScale() { generated_stub("Entity_Laser::ResetSpriteScale 0097fc10"); } -void Entity_Laser::set_scale(float scale) { generated_stub("Entity_Laser::set_scale 0097fe50"); } -void Entity_Laser::update_sample_points(char param_2) { generated_stub("Entity_Laser::update_sample_points 0097fe60"); } -void Entity_Laser::update_wiggle_path(void *samples, float amplitude, float phase) { generated_stub("Entity_Laser::update_wiggle_path 0099efc0"); } -Entity_NPC::~Entity_NPC() { generated_stub("Entity_NPC::~Entity_NPC 006b88e0"); } -void Entity_NPC::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_NPC::Init 006b8b20"); } -void Entity_NPC::PreUpdate() { generated_stub("Entity_NPC::PreUpdate 006c4ac0"); } -void Entity_NPC::Update() { generated_stub("Entity_NPC::Update 006c4b30"); } -void Entity_NPC::Interpolate() { generated_stub("Entity_NPC::Interpolate 006d2b50"); } -void Entity_NPC::Render(Vector *offset) { generated_stub("Entity_NPC::Render 006d2e50"); } -uint8_t Entity_NPC::RenderShadowLayer(Vector *offset) { generated_stub("Entity_NPC::RenderShadowLayer 006d4840"); } -uint8_t Entity_NPC::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) { generated_stub("Entity_NPC::TakeDamage 006d60a0"); } -void Entity_NPC::Kill(EntityRef *source) { generated_stub("Entity_NPC::Kill 006be6f0"); } -void Entity_NPC::Remove() { generated_stub("Entity_NPC::Remove 006b8f00"); } -void Entity_NPC::ClearReferences() { generated_stub("Entity_NPC::ClearReferences 006b8f30"); } -uint8_t Entity_NPC::CanShutDoors() { generated_stub("Entity_NPC::CanShutDoors 006b8450"); } -uint8_t Entity_NPC::IsBoss() { generated_stub("Entity_NPC::IsBoss 006b8470"); } -uint8_t Entity_NPC::TryThrow() { generated_stub("Entity_NPC::TryThrow 006d9440"); } -Vector * Entity_NPC::GetForwardVector(Vector *outForward) { generated_stub("Entity_NPC::GetForwardVector 006d48a0"); } -void Entity_NPC::HandleCollision() { generated_stub("Entity_NPC::HandleCollision 006cd410"); } -void Entity_NPC::ResetColor() { generated_stub("Entity_NPC::ResetColor 006c1100"); } -void Entity_NPC::LoadEntityConfig() { generated_stub("Entity_NPC::LoadEntityConfig 006bb790"); } -Entity_NPC * Entity_NPC::ParentNPC() { generated_stub("Entity_NPC::ParentNPC 00447770"); } -long double Entity_NPC::Scale() { generated_stub("Entity_NPC::Scale 004567a0"); } -Entity_NPC * Entity_NPC::ChildNPC() { generated_stub("Entity_NPC::ChildNPC 004567e0"); } -void Entity_NPC::Hornfel_UpdateAI() { generated_stub("Entity_NPC::Hornfel_UpdateAI 004b92e0"); } -void Entity_NPC::Hornfel_UpdateFrame() { generated_stub("Entity_NPC::Hornfel_UpdateFrame 004bb0e0"); } -void Entity_NPC::update_physics() { generated_stub("Entity_NPC::update_physics 004cde30"); } -void Entity_NPC::apply_velocity(char param_2) { generated_stub("Entity_NPC::apply_velocity 004ce120"); } -void Entity_NPC::update_move_direction_anim() { generated_stub("Entity_NPC::update_move_direction_anim 004ce6d0"); } -void Entity_NPC::SetMinecartPosVel(Vector *pos, Vector *vel) { generated_stub("Entity_NPC::SetMinecartPosVel 004cf030"); } -void Entity_NPC::MinecartUpdateChild(Entity *child) { generated_stub("Entity_NPC::MinecartUpdateChild 004cf120"); } -void Entity_NPC::UpdateCordChain(uint8_t isHalfScale) { generated_stub("Entity_NPC::UpdateCordChain 004e8fa0"); } -void Entity_NPC::render_overlay(Vector *offset, uint8_t isShadow) { generated_stub("Entity_NPC::render_overlay 004e9b10"); } -int Entity_NPC::FindTargetPit(Vector *pos1, Vector *pos2, uint32_t pitIndex) { generated_stub("Entity_NPC::FindTargetPit 00548f30"); } -Entity_NPC * Entity_NPC::ThrowStrider(Vector *pos, Entity *spanwer, Vector *targetPos) { generated_stub("Entity_NPC::ThrowStrider 0055cef0"); } -void Entity_NPC::render_v1_layer_frames() { generated_stub("Entity_NPC::render_v1_layer_frames 00565680"); } -void Entity_NPC::RenderSegmentLink(Vector *offset, uint8_t isShadow) { generated_stub("Entity_NPC::RenderSegmentLink 0059bed0"); } -void Entity_NPC::CreateBling() { generated_stub("Entity_NPC::CreateBling 0059e390"); } -void Entity_NPC::CreateGoldParticles(uint32_t count) { generated_stub("Entity_NPC::CreateGoldParticles 0059e4c0"); } -void Entity_NPC::set_entity_ptr_f54(Entity *entity) { generated_stub("Entity_NPC::set_entity_ptr_f54 0060d140"); } -int Entity_NPC::GetChampionColorIdx() { generated_stub("Entity_NPC::GetChampionColorIdx 006a8230"); } -void Entity_NPC::ResetPathFinderTarget() { generated_stub("Entity_NPC::ResetPathFinderTarget 006a8240"); } -void Entity_NPC::hold_set(int countdown, Vector *position) { generated_stub("Entity_NPC::hold_set 006b5e20"); } -Entity_Effect * Entity_NPC::MakeSplat(float size) { generated_stub("Entity_NPC::MakeSplat 006b64d0"); } -Entity_Effect * Entity_NPC::MakeBloodCloud(Vector *pos, ColorMod *color) { generated_stub("Entity_NPC::MakeBloodCloud 006b6830"); } -uint8_t Entity_NPC::IsChampion() { generated_stub("Entity_NPC::IsChampion 006b8480"); } -void Entity_NPC::Constructor() { generated_stub("Entity_NPC::Constructor 006b8590"); } -uint8_t Entity_NPC::TryForceTarget(Entity *Target, int Duration) { generated_stub("Entity_NPC::TryForceTarget 006b9910"); } -float Entity_NPC::compute_speed_multiplier() { generated_stub("Entity_NPC::compute_speed_multiplier 006b99e0"); } -void Entity_NPC::load_graphics(uint8_t param_2) { generated_stub("Entity_NPC::load_graphics 006baf40"); } -void Entity_NPC::KillUnique() { generated_stub("Entity_NPC::KillUnique 006be760"); } -Entity * Entity_NPC::GetPlayerTarget() { generated_stub("Entity_NPC::GetPlayerTarget 006be840"); } -Vector * Entity_NPC::CalcTargetPosition(Vector *outPos, float distanceLimit) { generated_stub("Entity_NPC::CalcTargetPosition 006bec40"); } -void Entity_NPC::UpdateDirtColor(uint8_t immediate) { generated_stub("Entity_NPC::UpdateDirtColor 006c04b0"); } -uint8_t Entity_NPC::Redirect(int *entityType, int *variant) { generated_stub("Entity_NPC::Redirect 006c07e0"); } -void Entity_NPC::Morph(int EntityType, int Variant, int SubType, int Championid) { generated_stub("Entity_NPC::Morph 006c0f30"); } -void * Entity_NPC::shopkeeper_get_loot(void *outLoot, uint8_t isShouldAdvance) { generated_stub("Entity_NPC::shopkeeper_get_loot 006c1ac0"); } -Entity_NPC * Entity_NPC::ThrowSpider(Vector *position, Entity *spawner, Vector targetPos, uint8_t isBig, float yOffset) { generated_stub("Entity_NPC::ThrowSpider 006c2750"); } -void Entity_NPC::update_frozen() { generated_stub("Entity_NPC::update_frozen 006ca930"); } -void Entity_NPC::fire_projectile_from_params(Entity_Projectile *projectile) { generated_stub("Entity_NPC::fire_projectile_from_params 006cb2a0"); } -void Entity_NPC::SetBossColorIdx(int bossColorIdx, int unused) { generated_stub("Entity_NPC::SetBossColorIdx 006d0300"); } -void Entity_NPC::MakeChampion(uint32_t seed, int championColor, uint8_t isInit) { generated_stub("Entity_NPC::MakeChampion 006d03e0"); } -void Entity_NPC::SetRef_bec(Entity *entity) { generated_stub("Entity_NPC::SetRef_bec 006d0c20"); } -void * Entity_NPC::QueryNPCsType(void *outList, int type, int variant) { generated_stub("Entity_NPC::QueryNPCsType 006d0c60"); } -EntityList * Entity_NPC::QueryNPCsGroup(EntityList *outList, int groupIdx) { generated_stub("Entity_NPC::QueryNPCsGroup 006d0dd0"); } -void * Entity_NPC::fireplace_get_loot(void *outLoot, uint8_t isShouldAdvance) { generated_stub("Entity_NPC::fireplace_get_loot 006d1580"); } -uint8_t Entity_NPC::CanBeDamagedFromVelocity(Vector velocity) { generated_stub("Entity_NPC::CanBeDamagedFromVelocity 006d4a00"); } -uint8_t Entity_NPC::CanReroll() { generated_stub("Entity_NPC::CanReroll 006d4db0"); } -void Entity_NPC::PlayDeathEffects() { generated_stub("Entity_NPC::PlayDeathEffects 006d4e00"); } -void Entity_NPC::trigger_kill_item_effects() { generated_stub("Entity_NPC::trigger_kill_item_effects 006d5400"); } -void Entity_NPC::SetScale(float scale) { generated_stub("Entity_NPC::SetScale 006d6610"); } -void Entity_NPC::PlaySound(int id, float volume, int framedelay, uint8_t loop, float pitch) { generated_stub("Entity_NPC::PlaySound 006d6ba0"); } -int Entity_NPC::GetAliveEnemyCount() { generated_stub("Entity_NPC::GetAliveEnemyCount 006d6c20"); } -uint32_t Entity_NPC::on_player_damaged() { generated_stub("Entity_NPC::on_player_damaged 006d6d20"); } -void Entity_NPC::room_enter() { generated_stub("Entity_NPC::room_enter 006d6d80"); } -void Entity_NPC::spawn_damage_numbers() { generated_stub("Entity_NPC::spawn_damage_numbers 006d7010"); } -void Entity_NPC::update_damage_history() { generated_stub("Entity_NPC::update_damage_history 006d7230"); } -void Entity_NPC::update_blood_guide_gibs(float *nullFrame) { generated_stub("Entity_NPC::update_blood_guide_gibs 006d7520"); } -void Entity_NPC::ClearDequeRefs() { generated_stub("Entity_NPC::ClearDequeRefs 006d81c0"); } -uint8_t Entity_NPC::IsControllerActionPressed(int action) { generated_stub("Entity_NPC::IsControllerActionPressed 006d8260"); } -uint8_t Entity_NPC::IsControllerActionTriggered(int buttonAction) { generated_stub("Entity_NPC::IsControllerActionTriggered 006d8290"); } -Vector * Entity_NPC::GetControllerInput(Vector *outInput, float deadzone) { generated_stub("Entity_NPC::GetControllerInput 006d82d0"); } -Vector * Entity_NPC::GetControllerMovementInput(Vector *outInput, float deadzone) { generated_stub("Entity_NPC::GetControllerMovementInput 006d85a0"); } -void Entity_NPC::TransferControl(Entity_NPC *target) { generated_stub("Entity_NPC::TransferControl 006d88b0"); } -void Entity_NPC::SpawnControlTarget(int inputMode, float rotation) { generated_stub("Entity_NPC::SpawnControlTarget 006d8b20"); } -void Entity_NPC::ClearChild() { generated_stub("Entity_NPC::ClearChild 006d8cf0"); } -Vector * Entity_NPC::GetAimTargetPosition(Vector *outPosition) { generated_stub("Entity_NPC::GetAimTargetPosition 006d8d30"); } -uint8_t Entity_NPC::is_controller_input_idle() { generated_stub("Entity_NPC::is_controller_input_idle 006d8d80"); } -void Entity_NPC::UpdateChargeBar(float start, float end, float value, uint8_t isHideWhenFull) { generated_stub("Entity_NPC::UpdateChargeBar 006d8e40"); } -void Entity_NPC::UpdateControllerMovement(uint8_t isForceUpdate) { generated_stub("Entity_NPC::UpdateControllerMovement 006d9050"); } -void Entity_NPC::UpdateChildEffectPosition(uint8_t isPredictMovement) { generated_stub("Entity_NPC::UpdateChildEffectPosition 006d90e0"); } -uint8_t Entity_NPC::split(float damage, EntityRef *source, uint8_t isPlaySound) { generated_stub("Entity_NPC::split 006d97e0"); } -void Entity_NPC::UpdatePickupGhosts() { generated_stub("Entity_NPC::UpdatePickupGhosts 006da530"); } -int Entity_NPC::GetBossColorIdx() { generated_stub("Entity_NPC::GetBossColorIdx 007e92b0"); } -void Entity_NPC::SetAimAngle(float angle) { generated_stub("Entity_NPC::SetAimAngle 0096ce90"); } -void Entity_NPC::render_debug(float *param_1, int param_2) { generated_stub("Entity_NPC::render_debug 009a8b90"); } -Entity_Pickup::~Entity_Pickup() { generated_stub("Entity_Pickup::~Entity_Pickup 006e0130"); } -void Entity_Pickup::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Pickup::Init 006e02f0"); } -void Entity_Pickup::Update() { generated_stub("Entity_Pickup::Update 006e3940"); } -void Entity_Pickup::Interpolate() { generated_stub("Entity_Pickup::Interpolate 006e38d0"); } -void Entity_Pickup::Render(Vector *offset) { generated_stub("Entity_Pickup::Render 006e69b0"); } -uint8_t Entity_Pickup::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) { generated_stub("Entity_Pickup::TakeDamage 006edda0"); } -void Entity_Pickup::Remove() { generated_stub("Entity_Pickup::Remove 006ee110"); } -void Entity_Pickup::ClearReferences() { generated_stub("Entity_Pickup::ClearReferences 006ee130"); } -uint8_t Entity_Pickup::TryThrow() { generated_stub("Entity_Pickup::TryThrow 006e3800"); } -void Entity_Pickup::HandleCollision() { generated_stub("Entity_Pickup::HandleCollision 006e8ae0"); } -int Entity_Pickup::Price() { generated_stub("Entity_Pickup::Price 00431740"); } -void Entity_Pickup::GetLootList(Vector *renderOffset) { generated_stub("Entity_Pickup::GetLootList 005832c0"); } -bool Entity_Pickup::IsShopItem() { generated_stub("Entity_Pickup::IsShopItem 005b1930"); } -int Entity_Pickup::Timeout() { generated_stub("Entity_Pickup::Timeout 005b1940"); } -int Entity_Pickup::OptionsPickupIndex() { generated_stub("Entity_Pickup::OptionsPickupIndex 005b1980"); } -Vector * Entity_Pickup::GetRandomPickupVelocity(Vector *buffer, Vector *position, RNG *rng, uint32_t ePickupVelType) { generated_stub("Entity_Pickup::GetRandomPickupVelocity 005b19b0"); } -void Entity_Pickup::Constructor() { generated_stub("Entity_Pickup::Constructor 006e0010"); } -uint8_t Entity_Pickup::TryFlip(Entity_Player *unusedPlayer, uint32_t unusedSeed) { generated_stub("Entity_Pickup::TryFlip 006e1640"); } -void Entity_Pickup::UpdateLootPreview() { generated_stub("Entity_Pickup::UpdateLootPreview 006e17c0"); } -void Entity_Pickup::SetAlternatePedestal(int pedestalType) { generated_stub("Entity_Pickup::SetAlternatePedestal 006e1a80"); } -int Entity_Pickup::GetAlternatePedestal() { generated_stub("Entity_Pickup::GetAlternatePedestal 006e1d70"); } -void Entity_Pickup::SetForceBlind(uint8_t setBlind) { generated_stub("Entity_Pickup::SetForceBlind 006e1e60"); } -void Entity_Pickup::UpdateSprite(uint8_t isIgnoreBlind) { generated_stub("Entity_Pickup::UpdateSprite 006e21f0"); } -void Entity_Pickup::update_price_sprite(int price) { generated_stub("Entity_Pickup::update_price_sprite 006e2570"); } -void Entity_Pickup::AppearFast() { generated_stub("Entity_Pickup::AppearFast 006e3020"); } -uint8_t Entity_Pickup::TryOpenChest(Entity_Player *player) { generated_stub("Entity_Pickup::TryOpenChest 006e6e40"); } -void Entity_Pickup::PlayDropSound() { generated_stub("Entity_Pickup::PlayDropSound 006e7be0"); } -void Entity_Pickup::PlayPickupSound() { generated_stub("Entity_Pickup::PlayPickupSound 006e7dc0"); } -int Entity_Pickup::GetCoinValue() { generated_stub("Entity_Pickup::GetCoinValue 006e8380"); } -uint32_t Entity_Pickup::can_player_buy(Entity_Player *param_2) { generated_stub("Entity_Pickup::can_player_buy 006e83a0"); } -void Entity_Pickup::CollectTrinket(Entity_Player *param_2, uint32_t param_3) { generated_stub("Entity_Pickup::CollectTrinket 006e84d0"); } -uint8_t Entity_Pickup::empty_pedestal() { generated_stub("Entity_Pickup::empty_pedestal 006ed580"); } -void Entity_Pickup::update_magnet_attraction() { generated_stub("Entity_Pickup::update_magnet_attraction 006ed690"); } -void Entity_Pickup::update_cycle_collectible(uint8_t isForce) { generated_stub("Entity_Pickup::update_cycle_collectible 006edfa0"); } -uint8_t Entity_Pickup::CanReroll() { generated_stub("Entity_Pickup::CanReroll 006ee200"); } -uint8_t Entity_Pickup::CanRerollVariant(int variant, int subType) { generated_stub("Entity_Pickup::CanRerollVariant 006ee240"); } -uint8_t Entity_Pickup::IsChest(int variant) { generated_stub("Entity_Pickup::IsChest 006ee340"); } -uint8_t Entity_Pickup::CanBePickedUp(uint8_t ignorePrice) { generated_stub("Entity_Pickup::CanBePickedUp 006ee390"); } -uint8_t Entity_Pickup::CanJeraDuplicate() { generated_stub("Entity_Pickup::CanJeraDuplicate 006ee3f0"); } -void Entity_Pickup::RemoveOtherOptions() { generated_stub("Entity_Pickup::RemoveOtherOptions 006ee750"); } -void Entity_Pickup::MakeShopItem(int shopId) { generated_stub("Entity_Pickup::MakeShopItem 006eea30"); } -int Entity_Pickup::AssignOptionsIndex() { generated_stub("Entity_Pickup::AssignOptionsIndex 006eed30"); } -int Entity_Pickup::Charge() { generated_stub("Entity_Pickup::Charge 007e9390"); } -uint8_t Entity_Pickup::AutoUpdatePrice() { generated_stub("Entity_Pickup::AutoUpdatePrice 007e93a0"); } -uint8_t Entity_Pickup::Touched() { generated_stub("Entity_Pickup::Touched 007e93b0"); } -int Entity_Pickup::ShopItemId() { generated_stub("Entity_Pickup::ShopItemId 007e93c0"); } -void Entity_Pickup::RestoreState(Room *room, Entity_Pickup *entity, void *saveState) { generated_stub("Entity_Pickup::RestoreState 007ef420"); } -int Entity_Pickup::Wait() { generated_stub("Entity_Pickup::Wait 0085e440"); } -void History::AddHistoryItem(void *historyItem) { generated_stub("History::AddHistoryItem 00721a70"); } -uint8_t History::RemoveHistoryItemByIndex(int index) { generated_stub("History::RemoveHistoryItemByIndex 00721c00"); } -void History::merge(void *other) { generated_stub("History::merge 00721c80"); } -void History::remove_index_refs(int index) { generated_stub("History::remove_index_refs 007220a0"); } -GameStatePlayer::~GameStatePlayer() { generated_stub("GameStatePlayer::~GameStatePlayer 00754d90"); } -void GameStatePlayer::read_player_key(void *stream) { generated_stub("GameStatePlayer::read_player_key 009c86e0"); } -void GameStatePlayer::Init() { generated_stub("GameStatePlayer::Init 009cf050"); } -uint8_t GameStatePlayer::read_coplayer(short *block, void *stream) { generated_stub("GameStatePlayer::read_coplayer 009cff40"); } -void GameStatePlayer::write_coplayer(void *stream) { generated_stub("GameStatePlayer::write_coplayer 009d0100"); } -void GameStatePlayer::read_block_538(uint32_t *block, void *stream) { generated_stub("GameStatePlayer::read_block_538 009d02c0"); } -void GameStatePlayer::write_block_538(short *block, void *stream) { generated_stub("GameStatePlayer::write_block_538 009d0440"); } -uint8_t GameStatePlayer::read(void *reader) { generated_stub("GameStatePlayer::read 009d05d0"); } -uint32_t GameStatePlayer::read_part3() { generated_stub("GameStatePlayer::read_part3 009d2656"); } -uint8_t QueueItemData::Touched() { generated_stub("QueueItemData::Touched 007538f0"); } -void * TemporaryEffects::GetEffectsList() { generated_stub("TemporaryEffects::GetEffectsList 007537a0"); } -void TemporaryEffects::AddEffect(void *Effect, uint8_t addcostume, int count) { generated_stub("TemporaryEffects::AddEffect 00930220"); } -void TemporaryEffects::AddCollectibleEffect(int coltype, uint8_t addcostume, int count) { generated_stub("TemporaryEffects::AddCollectibleEffect 009302e0"); } -void TemporaryEffects::AddTrinketEffect(int trinkettype, uint8_t addcostume, int count) { generated_stub("TemporaryEffects::AddTrinketEffect 00930330"); } -void TemporaryEffects::AddNullEffect(int nulleffectid, uint8_t addcostume, int count) { generated_stub("TemporaryEffects::AddNullEffect 00930390"); } -void TemporaryEffects::RemoveEffect(void *effect, int count) { generated_stub("TemporaryEffects::RemoveEffect 009303f0"); } -void TemporaryEffects::RemoveCollectibleEffect(int coltype, int count) { generated_stub("TemporaryEffects::RemoveCollectibleEffect 009304a0"); } -void TemporaryEffects::RemoveTrinketEffect(int trinkettype, int count) { generated_stub("TemporaryEffects::RemoveTrinketEffect 009304f0"); } -void TemporaryEffects::RemoveNullEffect(int nulleffectid, int count) { generated_stub("TemporaryEffects::RemoveNullEffect 00930550"); } -uint8_t TemporaryEffects::has_item_effect(TemporaryEffects *effects, ItemConfig_Item *item) { generated_stub("TemporaryEffects::has_item_effect 009305c0"); } -uint8_t TemporaryEffects::HasCollectibleEffect(int coltype) { generated_stub("TemporaryEffects::HasCollectibleEffect 009305f0"); } -uint8_t TemporaryEffects::HasTrinketEffect(int trinkettype) { generated_stub("TemporaryEffects::HasTrinketEffect 00930640"); } -uint8_t TemporaryEffects::HasNullEffect(int nulleffectid) { generated_stub("TemporaryEffects::HasNullEffect 00930680"); } -void TemporaryEffects::ClearEffects(uint8_t isClearPersistent) { generated_stub("TemporaryEffects::ClearEffects 009306c0"); } -void TemporaryEffects::Update() { generated_stub("TemporaryEffects::Update 00930820"); } -void * TemporaryEffects::GetCollectibleEffect(int coltype) { generated_stub("TemporaryEffects::GetCollectibleEffect 00930980"); } -void * TemporaryEffects::GetTrinketEffect(int trinkettype) { generated_stub("TemporaryEffects::GetTrinketEffect 009309c0"); } -void * TemporaryEffects::GetNullEffect(int nulleffectid) { generated_stub("TemporaryEffects::GetNullEffect 00930a30"); } -int TemporaryEffects::GetCollectibleEffectNum(int coltype) { generated_stub("TemporaryEffects::GetCollectibleEffectNum 00930a70"); } -int TemporaryEffects::GetTrinketEffectNum(int trinkettype) { generated_stub("TemporaryEffects::GetTrinketEffectNum 00930aa0"); } -int TemporaryEffects::GetNullEffectNum(int nulleffectid) { generated_stub("TemporaryEffects::GetNullEffectNum 00930ae0"); } -void UserProfile::find_or_create() { generated_stub("UserProfile::find_or_create 00a23ae0"); } -Entity_Player::~Entity_Player() { generated_stub("Entity_Player::~Entity_Player 00754d60"); } -void Entity_Player::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Player::Init 00755470"); } -void Entity_Player::Update() { generated_stub("Entity_Player::Update 00782af0"); } -void Entity_Player::Render(Vector *offset) { generated_stub("Entity_Player::Render 0078ca00"); } -uint8_t Entity_Player::RenderShadowLayer(Vector *offset) { generated_stub("Entity_Player::RenderShadowLayer 0078dc20"); } -uint8_t Entity_Player::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) { generated_stub("Entity_Player::TakeDamage 007729d0"); } -void Entity_Player::ClearReferences() { generated_stub("Entity_Player::ClearReferences 00757a40"); } -uint8_t Entity_Player::CanShutDoors() { generated_stub("Entity_Player::CanShutDoors 00757ab0"); } -uint8_t Entity_Player::IsValidTarget(Entity *target) { generated_stub("Entity_Player::IsValidTarget 00757a60"); } -uint8_t Entity_Player::TryThrow() { generated_stub("Entity_Player::TryThrow 007d2930"); } -void Entity_Player::HandleCollision() { generated_stub("Entity_Player::HandleCollision 0078e1f0"); } -void Entity_Player::ResetColor() { generated_stub("Entity_Player::ResetColor 007579c0"); } -Entity_Player * Entity_Player::GetMainTwin() { generated_stub("Entity_Player::GetMainTwin 00417800"); } -uint32_t Entity_Player::GetOtherTwin() { generated_stub("Entity_Player::GetOtherTwin 00417820"); } -int Entity_Player::ControllerIndex() { generated_stub("Entity_Player::ControllerIndex 00423950"); } -int Entity_Player::GetPlayerType() { generated_stub("Entity_Player::GetPlayerType 004253b0"); } -int Entity_Player::GetHearts() { generated_stub("Entity_Player::GetHearts 00428b10"); } -int Entity_Player::GetBatteryCharge(int slot) { generated_stub("Entity_Player::GetBatteryCharge 0042a2f0"); } -int Entity_Player::GetMaxHearts() { generated_stub("Entity_Player::GetMaxHearts 0042a310"); } -uint8_t Entity_Player::IsCoopGhost() { generated_stub("Entity_Player::IsCoopGhost 0042a320"); } -int Entity_Player::GetFireDirection() { generated_stub("Entity_Player::GetFireDirection 004316d0"); } -Vector * Entity_Player::GetAimDirection() { generated_stub("Entity_Player::GetAimDirection 004316e0"); } -int Entity_Player::GetNumBlueFlies() { generated_stub("Entity_Player::GetNumBlueFlies 004316f0"); } -void Entity_Player::AddCacheFlags(int flags) { generated_stub("Entity_Player::AddCacheFlags 00436160"); } -int Entity_Player::GetHeadDirection() { generated_stub("Entity_Player::GetHeadDirection 00436170"); } -uint8_t Entity_Player::AreOpposingShootDirectionsPressed() { generated_stub("Entity_Player::AreOpposingShootDirectionsPressed 00436180"); } -long double Entity_Player::GetTearPoisonDamage() { generated_stub("Entity_Player::GetTearPoisonDamage 004361a0"); } -int Entity_Player::GetItemState() { generated_stub("Entity_Player::GetItemState 004361b0"); } -TemporaryEffects * Entity_Player::GetEffects() { generated_stub("Entity_Player::GetEffects 004361c0"); } -void Entity_Player::SetMinDamageCooldown(int cooldown) { generated_stub("Entity_Player::SetMinDamageCooldown 004361d0"); } -int Entity_Player::GetNumCoins() { generated_stub("Entity_Player::GetNumCoins 00499dd0"); } -int Entity_Player::GetMovementDirection() { generated_stub("Entity_Player::GetMovementDirection 004e4860"); } -int Entity_Player::GetActiveItem(int slot) { generated_stub("Entity_Player::GetActiveItem 00505c80"); } -uint8_t Entity_Player::AreControlsEnabled() { generated_stub("Entity_Player::AreControlsEnabled 00505cc0"); } -bool Entity_Player::IsItemQueueEmpty() { generated_stub("Entity_Player::IsItemQueueEmpty 0056ff90"); } -void Entity_Player::StopExtraAnimation() { generated_stub("Entity_Player::StopExtraAnimation 0058e230"); } -int Entity_Player::GetBoneHearts() { generated_stub("Entity_Player::GetBoneHearts 005b1700"); } -int Entity_Player::GetRottenHearts() { generated_stub("Entity_Player::GetRottenHearts 005b1710"); } -int Entity_Player::GetSoulHearts() { generated_stub("Entity_Player::GetSoulHearts 005b1740"); } -int Entity_Player::GetBlackHearts() { generated_stub("Entity_Player::GetBlackHearts 005b1750"); } -int Entity_Player::GetNumKeys() { generated_stub("Entity_Player::GetNumKeys 005b1760"); } -int Entity_Player::GetGoldenHearts() { generated_stub("Entity_Player::GetGoldenHearts 005b1770"); } -uint8_t Entity_Player::HasWeaponType(int weaponType) { generated_stub("Entity_Player::HasWeaponType 005b1780"); } -RNG * Entity_Player::GetCollectibleRNG(int id) { generated_stub("Entity_Player::GetCollectibleRNG 005b17c0"); } -void Entity_Player::moms_bracelet_grab() { generated_stub("Entity_Player::moms_bracelet_grab 005b1a20"); } -void Entity_Player::UseRedKey() { generated_stub("Entity_Player::UseRedKey 005b2360"); } -void Entity_Player::use_card_hagalaz(RNG *rng) { generated_stub("Entity_Player::use_card_hagalaz 005b23f0"); } -int Entity_Player::reroll_collectibles_on_damage(RNG *rng, uint8_t isIncludeActives) { generated_stub("Entity_Player::reroll_collectibles_on_damage 005c88a0"); } -Entity_Familiar * Entity_Player::AddItemWisp(uint32_t param_1, Vector *param_2, char param_3) { generated_stub("Entity_Player::AddItemWisp 005c96f0"); } -void Entity_Player::trigger_book_of_belial_passive(int activeId, int charges) { generated_stub("Entity_Player::trigger_book_of_belial_passive 005c9930"); } -void Entity_Player::TriggerBookOfVirtues(int collectibleId, int charge) { generated_stub("Entity_Player::TriggerBookOfVirtues 005ca470"); } -void Entity_Player::console_spawn(int *spawnSpec, uint8_t isAddWisp) { generated_stub("Entity_Player::console_spawn 005caa70"); } -void Entity_Player::update_mini_mush_costume() { generated_stub("Entity_Player::update_mini_mush_costume 005cb480"); } -Vector * Entity_Player::GetLastDirection() { generated_stub("Entity_Player::GetLastDirection 005cd740"); } -EntityDesc * Entity_Player::FriendBallEnemy() { generated_stub("Entity_Player::FriendBallEnemy 005cd7d0"); } -int Entity_Player::GetNumBlueSpiders() { generated_stub("Entity_Player::GetNumBlueSpiders 0060d050"); } -int Entity_Player::GetDamageCooldown() { generated_stub("Entity_Player::GetDamageCooldown 0060d080"); } -void Entity_Player::ResetDamageCooldown() { generated_stub("Entity_Player::ResetDamageCooldown 0060d090"); } -Vector * Entity_Player::SpriteScale(Vector *outScale) { generated_stub("Entity_Player::SpriteScale 0060d0a0"); } -int Entity_Player::GetBrokenHearts() { generated_stub("Entity_Player::GetBrokenHearts 0065cf20"); } -int Entity_Player::GetNumBombs() { generated_stub("Entity_Player::GetNumBombs 0065cf30"); } -uint8_t Entity_Player::HasGoldenKey() { generated_stub("Entity_Player::HasGoldenKey 0065cf40"); } -uint8_t Entity_Player::HasGoldenBomb() { generated_stub("Entity_Player::HasGoldenBomb 0065cf50"); } -uint8_t Entity_Player::IsP2Appearing() { generated_stub("Entity_Player::IsP2Appearing 0065cf60"); } -RNG * Entity_Player::GetTrinketRNG(int id) { generated_stub("Entity_Player::GetTrinketRNG 0065cf80"); } -int Entity_Player::GetTractorBeam() { generated_stub("Entity_Player::GetTractorBeam 00665c10"); } -ColorMod * Entity_Player::get_laser_color_copy(ColorMod *outColor) { generated_stub("Entity_Player::get_laser_color_copy 00665c20"); } -uint32_t Entity_Player::get_grid_collision_at(Vector *position) { generated_stub("Entity_Player::get_grid_collision_at 006b5fd0"); } -uint8_t Entity_Player::ControlsEnabled() { generated_stub("Entity_Player::ControlsEnabled 006b84a0"); } -uint8_t Entity_Player::HasFullHearts() { generated_stub("Entity_Player::HasFullHearts 006dacd0"); } -int Entity_Player::GetJarHearts() { generated_stub("Entity_Player::GetJarHearts 006dad10"); } -int Entity_Player::GetSoulCharge() { generated_stub("Entity_Player::GetSoulCharge 006dad20"); } -int Entity_Player::GetBloodCharge() { generated_stub("Entity_Player::GetBloodCharge 006dad30"); } -Vector * Entity_Player::GetVelocityBeforeUpdate() { generated_stub("Entity_Player::GetVelocityBeforeUpdate 006dad60"); } -int Entity_Player::GetEternalHearts() { generated_stub("Entity_Player::GetEternalHearts 006dad70"); } -void Entity_Player::set_last_damage(uint64_t damageFlags, EntityRef *source) { generated_stub("Entity_Player::set_last_damage 006dad80"); } -int Entity_Player::GetBabySkin() { generated_stub("Entity_Player::GetBabySkin 006dae00"); } -int Entity_Player::GetSubPlayer() { generated_stub("Entity_Player::GetSubPlayer 006dae10"); } -void Entity_Player::SetSoulCharge(int param_2) { generated_stub("Entity_Player::SetSoulCharge 006f0020"); } -void Entity_Player::SetBloodCharge(int param_2) { generated_stub("Entity_Player::SetBloodCharge 006f0030"); } -void * Entity_Player::GetPocketItem(int SlotID) { generated_stub("Entity_Player::GetPocketItem 00753900"); } -Vector * Entity_Player::TearsOffset() { generated_stub("Entity_Player::TearsOffset 00753930"); } -void Entity_Player::EnableWeaponType(int param_2, uint8_t param_3) { generated_stub("Entity_Player::EnableWeaponType 00753980"); } -void Entity_Player::QueueExtraAnimation(uint8_t *animName) { generated_stub("Entity_Player::QueueExtraAnimation 007539c0"); } -uint8_t Entity_Player::CanShoot() { generated_stub("Entity_Player::CanShoot 007539f0"); } -RNG * Entity_Player::GetPillRNG(int pillEffect) { generated_stub("Entity_Player::GetPillRNG 00753a00"); } -RNG * Entity_Player::GetCardRNG(int cardId) { generated_stub("Entity_Player::GetCardRNG 00753a60"); } -uint32_t Entity_Player::IsSubPlayer() { generated_stub("Entity_Player::IsSubPlayer 00753ac0"); } -int Entity_Player::GetPoopMana() { generated_stub("Entity_Player::GetPoopMana 00753c20"); } -uint8_t Entity_Player::HasCurseMistEffect() { generated_stub("Entity_Player::HasCurseMistEffect 00753c30"); } -void Entity_Player::constructor() { generated_stub("Entity_Player::constructor 00753da0"); } -void Entity_Player::release_weapons_and_effects(uint8_t isRemoveEntities) { generated_stub("Entity_Player::release_weapons_and_effects 00757ac0"); } -uint32_t Entity_Player::InvalidateCoPlayerItems() { generated_stub("Entity_Player::InvalidateCoPlayerItems 007584b0"); } -void Entity_Player::cycle_spectate_target() { generated_stub("Entity_Player::cycle_spectate_target 007585b0"); } -void Entity_Player::trigger_max_hearts_removed(int removed) { generated_stub("Entity_Player::trigger_max_hearts_removed 00758850"); } -void Entity_Player::AddMaxHearts(int amount, uint8_t ignoreKeeper) { generated_stub("Entity_Player::AddMaxHearts 007588a0"); } -void Entity_Player::AddHearts(int hearts, uint8_t unk, uint8_t unk2) { generated_stub("Entity_Player::AddHearts 00758a70"); } -void Entity_Player::AddEternalHearts(int amount) { generated_stub("Entity_Player::AddEternalHearts 00758c20"); } -void Entity_Player::AddSoulHearts(int amount, uint8_t unk) { generated_stub("Entity_Player::AddSoulHearts 00758d00"); } -void Entity_Player::AddBlackHearts(int amount) { generated_stub("Entity_Player::AddBlackHearts 00758f90"); } -void Entity_Player::RemoveBlackHeart(int soulHeartIndex) { generated_stub("Entity_Player::RemoveBlackHeart 007591e0"); } -uint8_t Entity_Player::IsBlackHeart(int heart) { generated_stub("Entity_Player::IsBlackHeart 00759220"); } -void Entity_Player::UpdateBlackHeartMask() { generated_stub("Entity_Player::UpdateBlackHeartMask 007592a0"); } -void Entity_Player::AddJarHearts(int amount) { generated_stub("Entity_Player::AddJarHearts 00759390"); } -void Entity_Player::AddCoins(int amount) { generated_stub("Entity_Player::AddCoins 00759400"); } -void Entity_Player::AddBombs(int amount) { generated_stub("Entity_Player::AddBombs 00759500"); } -void Entity_Player::AddKeys(int amount) { generated_stub("Entity_Player::AddKeys 007595b0"); } -void Entity_Player::AddGoldenKey() { generated_stub("Entity_Player::AddGoldenKey 00759620"); } -void Entity_Player::RemoveGoldenKey() { generated_stub("Entity_Player::RemoveGoldenKey 00759660"); } -void Entity_Player::SyncConsumables(Entity_Player *target, uint32_t mask) { generated_stub("Entity_Player::SyncConsumables 007596a0"); } -void Entity_Player::ConsumableCountChanged(int bitflags) { generated_stub("Entity_Player::ConsumableCountChanged 007597e0"); } -void Entity_Player::restore_curse_mist_backup(int *backup) { generated_stub("Entity_Player::restore_curse_mist_backup 00759950"); } -Entity * Entity_Player::AddBlueFlies(int amount, Vector *pos, Entity *target) { generated_stub("Entity_Player::AddBlueFlies 007599d0"); } -void Entity_Player::RemoveBlueFly() { generated_stub("Entity_Player::RemoveBlueFly 00759b80"); } -void Entity_Player::AddLeprosy() { generated_stub("Entity_Player::AddLeprosy 00759b90"); } -Entity * Entity_Player::AddBoneOrbital(Vector *Position) { generated_stub("Entity_Player::AddBoneOrbital 00759bc0"); } -Entity * Entity_Player::AddSwarmFlyOrbital(Vector *position) { generated_stub("Entity_Player::AddSwarmFlyOrbital 00759bf0"); } -uint8_t Entity_Player::TryUseKey() { generated_stub("Entity_Player::TryUseKey 00759e20"); } -void Entity_Player::UpdateCostumes() { generated_stub("Entity_Player::UpdateCostumes 0075bf00"); } -void Entity_Player::AddCostume(ItemConfig_Item *collectibleID, uint8_t itemStateOnly) { generated_stub("Entity_Player::AddCostume 0075d1d0"); } -void Entity_Player::AddNullCostume(int costumeid) { generated_stub("Entity_Player::AddNullCostume 0075d800"); } -void Entity_Player::RemoveCostume(ItemConfig_Item *Item) { generated_stub("Entity_Player::RemoveCostume 0075d850"); } -uint8_t Entity_Player::IsNullItemCostumeVisible(int nullItemID, int playerSpriteLayerID) { generated_stub("Entity_Player::IsNullItemCostumeVisible 0075d980"); } -void Entity_Player::ClearCostumes() { generated_stub("Entity_Player::ClearCostumes 0075dfe0"); } -void Entity_Player::ClearQueueItem() { generated_stub("Entity_Player::ClearQueueItem 0075e190"); } -uint8_t Entity_Player::FlushQueueItem() { generated_stub("Entity_Player::FlushQueueItem 0075e1d0"); } -void Entity_Player::IncrementPlayerFormCounter(int ePlayerForm, int num) { generated_stub("Entity_Player::IncrementPlayerFormCounter 0075e320"); } -void Entity_Player::AddPlayerFormCostume(int playerForm) { generated_stub("Entity_Player::AddPlayerFormCostume 0075e9a0"); } -void Entity_Player::SetItemState(int collectibleId) { generated_stub("Entity_Player::SetItemState 0075ea20"); } -void Entity_Player::render_charge_bars(Vector *renderPos) { generated_stub("Entity_Player::render_charge_bars 0075ea40"); } -int Entity_Player::GetCollectibleCount() { generated_stub("Entity_Player::GetCollectibleCount 0075eff0"); } -void Entity_Player::EvaluateItems() { generated_stub("Entity_Player::EvaluateItems 00763570"); } -void Entity_Player::RespawnFamiliars() { generated_stub("Entity_Player::RespawnFamiliars 00770600"); } -void Entity_Player::GetNPCTarget() { generated_stub("Entity_Player::GetNPCTarget 00770610"); } -uint8_t Entity_Player::HasCollectible(int type, uint8_t ignoreModifiers) { generated_stub("Entity_Player::HasCollectible 007706e0"); } -int Entity_Player::GetCollectibleNum(int collectibleID, uint8_t OnlyCountTrueItems) { generated_stub("Entity_Player::GetCollectibleNum 00770ca0"); } -uint8_t Entity_Player::VoidHasCollectible(int id) { generated_stub("Entity_Player::VoidHasCollectible 007711a0"); } -uint8_t Entity_Player::IsInnateCollectible(int collectibleId, int unused) { generated_stub("Entity_Player::IsInnateCollectible 00771200"); } -void Entity_Player::apply_innate_collectibles() { generated_stub("Entity_Player::apply_innate_collectibles 00771410"); } -uint8_t Entity_Player::HasTrinket(uint32_t type, uint8_t ignoreModifiers) { generated_stub("Entity_Player::HasTrinket 00771550"); } -uint8_t Entity_Player::HasGoldenTrinket(uint32_t TrinketID) { generated_stub("Entity_Player::HasGoldenTrinket 00771620"); } -uint8_t Entity_Player::TryHoldTrinket(int trinketId) { generated_stub("Entity_Player::TryHoldTrinket 007716f0"); } -int Entity_Player::GetMaxTrinkets() { generated_stub("Entity_Player::GetMaxTrinkets 007717c0"); } -Entity_Pickup * Entity_Player::DropTrinket(Vector *DropPos, uint8_t ReplaceTick) { generated_stub("Entity_Player::DropTrinket 00771800"); } -void Entity_Player::AddTrinket(int type, uint8_t firsttime) { generated_stub("Entity_Player::AddTrinket 00771d30"); } -uint8_t Entity_Player::TryRemoveTrinket(uint32_t id) { generated_stub("Entity_Player::TryRemoveTrinket 00771f60"); } -uint8_t Entity_Player::TryRemoveSmeltedTrinket(uint32_t id) { generated_stub("Entity_Player::TryRemoveSmeltedTrinket 00772260"); } -uint8_t Entity_Player::replace_trinket(int unused0, int unused1, int unused2) { generated_stub("Entity_Player::replace_trinket 00772530"); } -void Entity_Player::SetFullHearts() { generated_stub("Entity_Player::SetFullHearts 007791f0"); } -Entity * Entity_Player::GetFocusEntity() { generated_stub("Entity_Player::GetFocusEntity 00779320"); } -Vector * Entity_Player::GetMovementJoystick(Vector *outJoystick) { generated_stub("Entity_Player::GetMovementJoystick 00779360"); } -Vector * Entity_Player::GetShootingJoystick(Vector *outJoystick) { generated_stub("Entity_Player::GetShootingJoystick 00779620"); } -void Entity_Player::GetBodyMoveDirection(Vector *buffer) { generated_stub("Entity_Player::GetBodyMoveDirection 00779900"); } -int Entity_Player::GetWeaponModifiers() { generated_stub("Entity_Player::GetWeaponModifiers 00779a20"); } -void Entity_Player::update_body_animations() { generated_stub("Entity_Player::update_body_animations 00779b40"); } -void Entity_Player::update_shooting() { generated_stub("Entity_Player::update_shooting 0077b020"); } -BitSet128 * Entity_Player::GetBombFlags(BitSet128 *outFlags, uint8_t isRollChances) { generated_stub("Entity_Player::GetBombFlags 00780560"); } -uint32_t Entity_Player::GetBombVariant() { generated_stub("Entity_Player::GetBombVariant 00780eb0"); } -float Entity_Player::check_bomb_tearflags(BitSet128 tearFlags) { generated_stub("Entity_Player::check_bomb_tearflags 00780ec0"); } -void Entity_Player::update_bomb_input() { generated_stub("Entity_Player::update_bomb_input 00780f40"); } -void Entity_Player::GetFlyingOffset(Vector *outOffset) { generated_stub("Entity_Player::GetFlyingOffset 00782630"); } -void Entity_Player::trigger_fire_item_effects(Vector *direction, uint8_t isShotFired) { generated_stub("Entity_Player::trigger_fire_item_effects 007826d0"); } -uint8_t * Entity_Player::GetDeathAnimName() { generated_stub("Entity_Player::GetDeathAnimName 007828f0"); } -Entity * Entity_Player::GetActiveWeaponEntity() { generated_stub("Entity_Player::GetActiveWeaponEntity 00782a40"); } -uint32_t Entity_Player::CanTurnHead() { generated_stub("Entity_Player::CanTurnHead 00782a60"); } -float Entity_Player::FireDelay() { generated_stub("Entity_Player::FireDelay 00782a70"); } -uint8_t Entity_Player::IsHeadless() { generated_stub("Entity_Player::IsHeadless 0078b350"); } -void Entity_Player::RenderGlow(Vector *position) { generated_stub("Entity_Player::RenderGlow 0078dc60"); } -void Entity_Player::RenderBody(Vector *position) { generated_stub("Entity_Player::RenderBody 0078dde0"); } -void Entity_Player::RenderHead(Vector *position) { generated_stub("Entity_Player::RenderHead 0078dff0"); } -void Entity_Player::RenderTop(Vector *param_2) { generated_stub("Entity_Player::RenderTop 0078e190"); } -void Entity_Player::RemoveCollectibleByHistoryIndex(int index, uint8_t RemovedBool) { generated_stub("Entity_Player::RemoveCollectibleByHistoryIndex 0078fec0"); } -void Entity_Player::TriggerCollectibleRemoved(int collectibleID) { generated_stub("Entity_Player::TriggerCollectibleRemoved 0078ff90"); } -void Entity_Player::ClearTemporaryEffects() { generated_stub("Entity_Player::ClearTemporaryEffects 007907a0"); } -int Entity_Player::GetTotalActiveCharge(int slot) { generated_stub("Entity_Player::GetTotalActiveCharge 007910f0"); } -int Entity_Player::GetActiveItemSlot(int id) { generated_stub("Entity_Player::GetActiveItemSlot 007911c0"); } -int Entity_Player::GetCollectibleMaxCharge(int collectibleId, int varData, int unused) { generated_stub("Entity_Player::GetCollectibleMaxCharge 007911f0"); } -int Entity_Player::GetActiveMaxCharge(int slot) { generated_stub("Entity_Player::GetActiveMaxCharge 00791320"); } -void Entity_Player::SetActiveCharge(int charge, int slot) { generated_stub("Entity_Player::SetActiveCharge 00791420"); } -void Entity_Player::SetActiveVarData(int vardata, int slot) { generated_stub("Entity_Player::SetActiveVarData 00791510"); } -void Entity_Player::ControlActiveItem(int slot) { generated_stub("Entity_Player::ControlActiveItem 00791a40"); } -uint8_t Entity_Player::HasTimedItem() { generated_stub("Entity_Player::HasTimedItem 00793940"); } -void Entity_Player::update_effects() { generated_stub("Entity_Player::update_effects 00794e50"); } -void Entity_Player::update_ladder() { generated_stub("Entity_Player::update_ladder 0079f3c0"); } -void Entity_Player::trigger_npc_death(Entity *npc) { generated_stub("Entity_Player::trigger_npc_death 007a0080"); } -Entity_Bomb * Entity_Player::FireBomb(Vector *pos, Vector *vel, Entity *source) { generated_stub("Entity_Player::FireBomb 007a0970"); } -uint8_t Entity_Player::TriggerDeath(uint8_t checkOnly) { generated_stub("Entity_Player::TriggerDeath 007a1090"); } -void Entity_Player::Revive() { generated_stub("Entity_Player::Revive 007a2220"); } -void Entity_Player::ReviveFromTrinket(uint32_t trinketId, int unused) { generated_stub("Entity_Player::ReviveFromTrinket 007a3430"); } -void Entity_Player::remove_twin() { generated_stub("Entity_Player::remove_twin 007a37c0"); } -void Entity_Player::AddPocketItem(int id, uint32_t pocketItemType) { generated_stub("Entity_Player::AddPocketItem 007a3af0"); } -void Entity_Player::AddCard(int card) { generated_stub("Entity_Player::AddCard 007a3c10"); } -void Entity_Player::AddPill(int pillColor) { generated_stub("Entity_Player::AddPill 007a3c30"); } -int Entity_Player::GetCard(int slot) { generated_stub("Entity_Player::GetCard 007a3c50"); } -int Entity_Player::GetPill(int slot) { generated_stub("Entity_Player::GetPill 007a3c80"); } -void Entity_Player::SetCard(int slot, int card) { generated_stub("Entity_Player::SetCard 007a3cb0"); } -void Entity_Player::SetPill(int slot, int pillColor) { generated_stub("Entity_Player::SetPill 007a3cf0"); } -void Entity_Player::pocket_use_input() { generated_stub("Entity_Player::pocket_use_input 007a3d30"); } -void Entity_Player::pockets_rotate() { generated_stub("Entity_Player::pockets_rotate 007a42b0"); } -void Entity_Player::SwapActiveItems() { generated_stub("Entity_Player::SwapActiveItems 007a4760"); } -void Entity_Player::RemovePocketItem(int slot) { generated_stub("Entity_Player::RemovePocketItem 007a4850"); } -void Entity_Player::DropPocketItem(int slot, Vector *pos) { generated_stub("Entity_Player::DropPocketItem 007a48f0"); } -void Entity_Player::spawn_low_health_blood_splat() { generated_stub("Entity_Player::spawn_low_health_blood_splat 007a49e0"); } -void Entity_Player::level_start(uint8_t isForced) { generated_stub("Entity_Player::level_start 007a4ba0"); } -void Entity_Player::ShootCandle(Vector *direction) { generated_stub("Entity_Player::ShootCandle 007a6300"); } -int Entity_Player::GetTrinket(uint32_t slot) { generated_stub("Entity_Player::GetTrinket 007a6430"); } -void Entity_Player::SetControllerIndex(int index, uint8_t isIncludePlayerOwned) { generated_stub("Entity_Player::SetControllerIndex 007a6450"); } -void Entity_Player::room_exit(uint8_t isKeepHolyMantle) { generated_stub("Entity_Player::room_exit 007a6680"); } -void Entity_Player::room_enter() { generated_stub("Entity_Player::room_enter 007a6c50"); } -void Entity_Player::TriggerNewRoom_TemporaryEffects() { generated_stub("Entity_Player::TriggerNewRoom_TemporaryEffects 007a8350"); } -void Entity_Player::TriggerRoomClear() { generated_stub("Entity_Player::TriggerRoomClear 007a8fd0"); } -uint8_t Entity_Player::HasPlayerForm(int playerForm) { generated_stub("Entity_Player::HasPlayerForm 007aa7c0"); } -uint8_t Entity_Player::CanAddCollectible(int collectibleId) { generated_stub("Entity_Player::CanAddCollectible 007aa800"); } -uint8_t Entity_Player::IsExtraAnimationFinished() { generated_stub("Entity_Player::IsExtraAnimationFinished 007ab110"); } -void Entity_Player::AnimatePickup(ANM2 *param_2, uint8_t param_3, uint8_t *param_4) { generated_stub("Entity_Player::AnimatePickup 007ab130"); } -void Entity_Player::AnimateTrinket(int trinketId, uint8_t *animName, uint8_t *spriteAnimName) { generated_stub("Entity_Player::AnimateTrinket 007ab550"); } -void Entity_Player::AnimateCard(int cardId, uint8_t *animName) { generated_stub("Entity_Player::AnimateCard 007ab6b0"); } -void Entity_Player::AnimatePill(int pillColor, uint8_t *animName) { generated_stub("Entity_Player::AnimatePill 007abb00"); } -void Entity_Player::AnimateTrapdoor() { generated_stub("Entity_Player::AnimateTrapdoor 007abc00"); } -void Entity_Player::AnimateLightTravel() { generated_stub("Entity_Player::AnimateLightTravel 007abc10"); } -void Entity_Player::AnimatePitfallIn(uint8_t isIgnoreEffect) { generated_stub("Entity_Player::AnimatePitfallIn 007abc20"); } -void Entity_Player::AnimatePitfallOut() { generated_stub("Entity_Player::AnimatePitfallOut 007abc90"); } -void Entity_Player::AnimateAppear() { generated_stub("Entity_Player::AnimateAppear 007abcb0"); } -void Entity_Player::AnimateTeleport(uint8_t isUp) { generated_stub("Entity_Player::AnimateTeleport 007abcc0"); } -void Entity_Player::AnimateHappy() { generated_stub("Entity_Player::AnimateHappy 007abd30"); } -void Entity_Player::AnimateSad() { generated_stub("Entity_Player::AnimateSad 007abd90"); } -void Entity_Player::AddPrettyFly() { generated_stub("Entity_Player::AddPrettyFly 007abdf0"); } -void Entity_Player::PlayExtraAnimation(uint8_t *animName) { generated_stub("Entity_Player::PlayExtraAnimation 007abe20"); } -void Entity_Player::active_used_post(int slot, uint8_t unk, int chargeBeforeUse) { generated_stub("Entity_Player::active_used_post 007abf80"); } -void Entity_Player::DischargeActiveItem(uint32_t slot, uint8_t unk) { generated_stub("Entity_Player::DischargeActiveItem 007ac7e0"); } -void Entity_Player::TryRemoveTrinketCostume(int trinketId) { generated_stub("Entity_Player::TryRemoveTrinketCostume 007ad3a0"); } -void Entity_Player::TryRemoveNullCostume(int param_1) { generated_stub("Entity_Player::TryRemoveNullCostume 007ad400"); } -uint32_t Entity_Player::GetMaxPocketItems() { generated_stub("Entity_Player::GetMaxPocketItems 007ad440"); } -void Entity_Player::stop_costume_item_anims() { generated_stub("Entity_Player::stop_costume_item_anims 007ad4e0"); } -void Entity_Player::ClearCollectibleAnim(int collectible) { generated_stub("Entity_Player::ClearCollectibleAnim 007ad5a0"); } -uint8_t Entity_Player::IsCollectibleAnimFinished(int collectible, std_string *animName) { generated_stub("Entity_Player::IsCollectibleAnimFinished 007ad680"); } -void Entity_Player::TriggerTrinketAdded(uint32_t trinketID, uint8_t firstTimePickingUp) { generated_stub("Entity_Player::TriggerTrinketAdded 007ad860"); } -void Entity_Player::TriggerTrinketRemoved(uint32_t trinketID) { generated_stub("Entity_Player::TriggerTrinketRemoved 007adb30"); } -void Entity_Player::RestoreGameState(GameStatePlayer *saveState) { generated_stub("Entity_Player::RestoreGameState 007ae4b0"); } -uint8_t Entity_Player::try_trigger_astral_projection() { generated_stub("Entity_Player::try_trigger_astral_projection 007afc20"); } -void Entity_Player::spawn_dark_esau(void *gameStatePlayer) { generated_stub("Entity_Player::spawn_dark_esau 007b0070"); } -void Entity_Player::DonateLuck(int luck) { generated_stub("Entity_Player::DonateLuck 007b2200"); } -void Entity_Player::UseCard(int cardType, uint32_t useFlag) { generated_stub("Entity_Player::UseCard 007b2230"); } -void Entity_Player::update_footprints() { generated_stub("Entity_Player::update_footprints 007b8cb0"); } -void Entity_Player::SetFootprintColor(KColor color, uint8_t unk) { generated_stub("Entity_Player::SetFootprintColor 007b98c0"); } -uint8_t Entity_Player::is_footstep_triggered(int foot) { generated_stub("Entity_Player::is_footstep_triggered 007b9940"); } -void Entity_Player::update_pitfall() { generated_stub("Entity_Player::update_pitfall 007b9b50"); } -void Entity_Player::TryDecreaseGlowingHourglassUses(int unk1, uint8_t unk2) { generated_stub("Entity_Player::TryDecreaseGlowingHourglassUses 007b9e10"); } -uint8_t Entity_Player::GetMouseAimTarget(Vector *outTarget, uint8_t isSkipNetCursor) { generated_stub("Entity_Player::GetMouseAimTarget 007b9f60"); } -void Entity_Player::update_baby_skin_effects() { generated_stub("Entity_Player::update_baby_skin_effects 007ba2b0"); } -void Entity_Player::coop_baby_death_effect() { generated_stub("Entity_Player::coop_baby_death_effect 007bb5e0"); } -void Entity_Player::InitPostLevelInitStats() { generated_stub("Entity_Player::InitPostLevelInitStats 007bc740"); } -void Entity_Player::update_player_skin() { generated_stub("Entity_Player::update_player_skin 007bebb0"); } -void Entity_Player::InitBabySkin() { generated_stub("Entity_Player::InitBabySkin 007bf040"); } -Entity_Laser * Entity_Player::FireDelayedBrimstone(float angle, Entity *parent) { generated_stub("Entity_Player::FireDelayedBrimstone 007bf1a0"); } -uint8_t Entity_Player::CanPickupItem() { generated_stub("Entity_Player::CanPickupItem 007bf3d0"); } -uint8_t Entity_Player::IsHoldingItem() { generated_stub("Entity_Player::IsHoldingItem 007bf490"); } -uint8_t Entity_Player::IsHeldItemVisible() { generated_stub("Entity_Player::IsHeldItemVisible 007bf5c0"); } -void Entity_Player::AddBlueSpider(Vector *position) { generated_stub("Entity_Player::AddBlueSpider 007bf5f0"); } -Entity_Familiar * Entity_Player::ThrowBlueSpider(Vector *position, Vector *target) { generated_stub("Entity_Player::ThrowBlueSpider 007bf640"); } -void Entity_Player::RemoveBlueSpider() { generated_stub("Entity_Player::RemoveBlueSpider 007bf660"); } -int Entity_Player::GetExtraLives() { generated_stub("Entity_Player::GetExtraLives 007bf670"); } -uint32_t Entity_Player::GetGlitchBabySubType() { generated_stub("Entity_Player::GetGlitchBabySubType 007c2e90"); } -uint8_t Entity_Player::HasInvincibility(uint64_t damageFlags, EntityRef *source) { generated_stub("Entity_Player::HasInvincibility 007c3100"); } -uint8_t Entity_Player::IsInvisible() { generated_stub("Entity_Player::IsInvisible 007c32c0"); } -uint8_t Entity_Player::HasPoisonImmunity() { generated_stub("Entity_Player::HasPoisonImmunity 007c3320"); } -uint8_t Entity_Player::CanCrushRocks() { generated_stub("Entity_Player::CanCrushRocks 007c3380"); } -uint8_t Entity_Player::CanPickRedHearts() { generated_stub("Entity_Player::CanPickRedHearts 007c3410"); } -uint8_t Entity_Player::CanPickSoulHearts() { generated_stub("Entity_Player::CanPickSoulHearts 007c3460"); } -uint8_t Entity_Player::CanPickBlackHearts() { generated_stub("Entity_Player::CanPickBlackHearts 007c3550"); } -void Entity_Player::RemoveSkinCostume() { generated_stub("Entity_Player::RemoveSkinCostume 007c3620"); } -void Entity_Player::ResetItemState() { generated_stub("Entity_Player::ResetItemState 007c36b0"); } -void Entity_Player::SetShootingCooldown(int cooldown) { generated_stub("Entity_Player::SetShootingCooldown 007c37f0"); } -uint8_t Entity_Player::NeedsCharge(int slot) { generated_stub("Entity_Player::NeedsCharge 007c3810"); } -uint8_t Entity_Player::FullCharge(int slot, uint8_t isForce, uint8_t isOvercharge) { generated_stub("Entity_Player::FullCharge 007c38c0"); } -void Entity_Player::add_random_stat_up(RNG *rng) { generated_stub("Entity_Player::add_random_stat_up 007c3980"); } -void Entity_Player::preload_item_sounds() { generated_stub("Entity_Player::preload_item_sounds 007c3a60"); } -uint8_t Entity_Player::CanUsePill(int pillEffect) { generated_stub("Entity_Player::CanUsePill 007c40e0"); } -void Entity_Player::UsePill(int pillEffect, int pillColor, uint32_t useFlags) { generated_stub("Entity_Player::UsePill 007c4180"); } -void Entity_Player::AddDeadEyeCharge() { generated_stub("Entity_Player::AddDeadEyeCharge 007c78b0"); } -void Entity_Player::ClearDeadEyeCharge() { generated_stub("Entity_Player::ClearDeadEyeCharge 007c78e0"); } -int Entity_Player::GetZodiacEffect() { generated_stub("Entity_Player::GetZodiacEffect 007c7960"); } -void Entity_Player::update_purity_glow(Entity_Player *player) { generated_stub("Entity_Player::update_purity_glow 007c7c60"); } -void Entity_Player::trigger_immaculate_conception(uint8_t isCambion) { generated_stub("Entity_Player::trigger_immaculate_conception 007c7d70"); } -void Entity_Player::AddImmaculateConceptionCounter(int param_1) { generated_stub("Entity_Player::AddImmaculateConceptionCounter 007c8050"); } -void Entity_Player::dash_impact() { generated_stub("Entity_Player::dash_impact 007c8240"); } -void Entity_Player::spawn_locusts() { generated_stub("Entity_Player::spawn_locusts 007c8830"); } -Entity_Laser * Entity_Player::SpawnMawOfVoid(int timeout) { generated_stub("Entity_Player::SpawnMawOfVoid 007c8dc0"); } -void Entity_Player::AddGoldenBomb() { generated_stub("Entity_Player::AddGoldenBomb 007c8f80"); } -void Entity_Player::RemoveGoldenBomb() { generated_stub("Entity_Player::RemoveGoldenBomb 007c8fc0"); } -void Entity_Player::AddDollarBillEffect() { generated_stub("Entity_Player::AddDollarBillEffect 007c9000"); } -int Entity_Player::GetCambionPregnancyLevel() { generated_stub("Entity_Player::GetCambionPregnancyLevel 007c90b0"); } -Entity * Entity_Player::ShootRedCandle(Vector *dir) { generated_stub("Entity_Player::ShootRedCandle 007c9130"); } -Entity * Entity_Player::ShootBlueCandle(Vector *dir) { generated_stub("Entity_Player::ShootBlueCandle 007c9350"); } -void Entity_Player::DoZitEffect(Vector *direction) { generated_stub("Entity_Player::DoZitEffect 007c9590"); } -void Entity_Player::apply_victory_lap_penalty(uint32_t param_1) { generated_stub("Entity_Player::apply_victory_lap_penalty 007c97f0"); } -float Entity_Player::get_voice_pitch() { generated_stub("Entity_Player::get_voice_pitch 007c9ad0"); } -void Entity_Player::AddJarFlies(int amount) { generated_stub("Entity_Player::AddJarFlies 007c9bb0"); } -uint8_t Entity_Player::IsPosInSpotLight(Vector *position) { generated_stub("Entity_Player::IsPosInSpotLight 007c9c00"); } -void Entity_Player::AddGoldenHearts(int amount, uint8_t retBool) { generated_stub("Entity_Player::AddGoldenHearts 007c9d10"); } -uint8_t Entity_Player::CanPickGoldenHearts() { generated_stub("Entity_Player::CanPickGoldenHearts 007c9e30"); } -void Entity_Player::UpdateHeartDependentEffects() { generated_stub("Entity_Player::UpdateHeartDependentEffects 007c9ea0"); } -void Entity_Player::BreakGoldenHearts(int count) { generated_stub("Entity_Player::BreakGoldenHearts 007ca2d0"); } -void Entity_Player::ClampGoldenHearts(uint8_t isSkipBreak) { generated_stub("Entity_Player::ClampGoldenHearts 007ca7c0"); } -void Entity_Player::AddBoneHearts(int amount) { generated_stub("Entity_Player::AddBoneHearts 007ca840"); } -uint8_t Entity_Player::CanPickBoneHearts() { generated_stub("Entity_Player::CanPickBoneHearts 007caa00"); } -uint8_t Entity_Player::IsBoneHeart(int heart) { generated_stub("Entity_Player::IsBoneHeart 007caaa0"); } -uint8_t Entity_Player::TryPreventDeath() { generated_stub("Entity_Player::TryPreventDeath 007caad0"); } -void Entity_Player::update_bone_hearts() { generated_stub("Entity_Player::update_bone_hearts 007cabc0"); } -void Entity_Player::ClampHeartsToLimit(int heartType, int amount) { generated_stub("Entity_Player::ClampHeartsToLimit 007cacb0"); } -int Entity_Player::GetHeartLimit(uint8_t isKeeperBypass) { generated_stub("Entity_Player::GetHeartLimit 007cae60"); } -int Entity_Player::GetHealthType() { generated_stub("Entity_Player::GetHealthType 007cafe0"); } -int Entity_Player::GetEffectiveMaxHearts() { generated_stub("Entity_Player::GetEffectiveMaxHearts 007cb060"); } -void Entity_Player::apply_coop_baby_spawn_bonus() { generated_stub("Entity_Player::apply_coop_baby_spawn_bonus 007cb090"); } -uint8_t Entity_Player::IsFullSpriteRendering() { generated_stub("Entity_Player::IsFullSpriteRendering 007cb580"); } -int Entity_Player::GetTrinketMultiplier(uint32_t type) { generated_stub("Entity_Player::GetTrinketMultiplier 007cb6e0"); } -void Entity_Player::UpdateCanShoot() { generated_stub("Entity_Player::UpdateCanShoot 007cba30"); } -uint8_t Entity_Player::WillPlayerRevive() { generated_stub("Entity_Player::WillPlayerRevive 007cbb60"); } -float Entity_Player::GetGreedDonationBreakChance() { generated_stub("Entity_Player::GetGreedDonationBreakChance 007cbb70"); } -float Entity_Player::GetGreedDonationJamChance(PersistentGameData *data) { generated_stub("Entity_Player::GetGreedDonationJamChance 007cbb90"); } -void Entity_Player::hallowed_ground_add(int count) { generated_stub("Entity_Player::hallowed_ground_add 007cbc60"); } -void Entity_Player::resolve_tainted_soul() { generated_stub("Entity_Player::resolve_tainted_soul 007cbcb0"); } -void Entity_Player::init_forgotten_twin() { generated_stub("Entity_Player::init_forgotten_twin 007cbcd0"); } -Entity * Entity_Player::spawn_forgotten_body() { generated_stub("Entity_Player::spawn_forgotten_body 007cbef0"); } -uint8_t Entity_Player::SwapForgottenForm(uint8_t isForce, uint8_t isNoEffects) { generated_stub("Entity_Player::SwapForgottenForm 007cc200"); } -Entity_Player * Entity_Player::GetMainPlayer() { generated_stub("Entity_Player::GetMainPlayer 007ce270"); } -uint8_t Entity_Player::CanRerollCollectible(int id, uint8_t unk) { generated_stub("Entity_Player::CanRerollCollectible 007ce2a0"); } -int Entity_Player::GetGreedsGulletHearts() { generated_stub("Entity_Player::GetGreedsGulletHearts 007ce390"); } -void Entity_Player::update_greeds_gullet() { generated_stub("Entity_Player::update_greeds_gullet 007ce420"); } -void Entity_Player::ChangePlayerType(int playerType, uint8_t unk) { generated_stub("Entity_Player::ChangePlayerType 007ce6e0"); } -void Entity_Player::RemoveCollectible(int param_2) { generated_stub("Entity_Player::RemoveCollectible 007cf610"); } -uint8_t Entity_Player::IsLocalPlayer() { generated_stub("Entity_Player::IsLocalPlayer 007cf8c0"); } -void Entity_Player::GetGlyphOfBalanceDrop(int *variant, int *subtype) { generated_stub("Entity_Player::GetGlyphOfBalanceDrop 007d12c0"); } -void Entity_Player::GetEnterPosition(Vector *buffer) { generated_stub("Entity_Player::GetEnterPosition 007d1620"); } -Entity_Familiar * Entity_Player::AddMinisaac(Vector *position, uint8_t isPlayAnim) { generated_stub("Entity_Player::AddMinisaac 007d1860"); } -uint32_t Entity_Player::play_hurt_effects() { generated_stub("Entity_Player::play_hurt_effects 007d1c10"); } -Entity_Player * Entity_Player::InitTwin(int playerType) { generated_stub("Entity_Player::InitTwin 007d2000"); } -uint8_t Entity_Player::TryHoldEntity(Entity *entity) { generated_stub("Entity_Player::TryHoldEntity 007d2170"); } -Entity * Entity_Player::ThrowHeldEntity(Vector *Velocity) { generated_stub("Entity_Player::ThrowHeldEntity 007d2470"); } -void Entity_Player::AddFriendlyDip(int subtype, Vector *position) { generated_stub("Entity_Player::AddFriendlyDip 007d2a00"); } -void Entity_Player::ThrowFriendlyDip(int subtype, Vector *position, Vector *target) { generated_stub("Entity_Player::ThrowFriendlyDip 007d2a20"); } -void Entity_Player::AddBrokenHearts(int amount) { generated_stub("Entity_Player::AddBrokenHearts 007d2a40"); } -void Entity_Player::AddSoulCharge(int count) { generated_stub("Entity_Player::AddSoulCharge 007d2ad0"); } -int Entity_Player::GetEffectiveSoulCharge() { generated_stub("Entity_Player::GetEffectiveSoulCharge 007d2b50"); } -void Entity_Player::apply_soul_charge_to_actives(int oldSoulCharge) { generated_stub("Entity_Player::apply_soul_charge_to_actives 007d2b70"); } -void Entity_Player::AddBloodCharge(int amount) { generated_stub("Entity_Player::AddBloodCharge 007d2d40"); } -int Entity_Player::GetEffectiveBloodCharge() { generated_stub("Entity_Player::GetEffectiveBloodCharge 007d2dd0"); } -void Entity_Player::blood_charge_changed(int oldBloodCharge) { generated_stub("Entity_Player::blood_charge_changed 007d2df0"); } -void Entity_Player::AddRottenHearts(int amount, uint8_t unk) { generated_stub("Entity_Player::AddRottenHearts 007d2fc0"); } -bool Entity_Player::CanPickRottenHearts() { generated_stub("Entity_Player::CanPickRottenHearts 007d3180"); } -void Entity_Player::UpdateBookOfVirtues(uint8_t addedBookOfVirtues) { generated_stub("Entity_Player::UpdateBookOfVirtues 007d3200"); } -void Entity_Player::trigger_vampire_charm_kill() { generated_stub("Entity_Player::trigger_vampire_charm_kill 007d3350"); } -void Entity_Player::AddUrnSouls(uint32_t amount) { generated_stub("Entity_Player::AddUrnSouls 007d3480"); } -void Entity_Player::AddGigaBombs(int amount) { generated_stub("Entity_Player::AddGigaBombs 007d34f0"); } -uint8_t Entity_Player::try_end_astral_projection() { generated_stub("Entity_Player::try_end_astral_projection 007d35b0"); } -void Entity_Player::fire_saturnus_tears() { generated_stub("Entity_Player::fire_saturnus_tears 007d3e40"); } -int Entity_Player::GetMaxInventorySize() { generated_stub("Entity_Player::GetMaxInventorySize 007d4150"); } -uint8_t Entity_Player::CanAddCollectibleToInventory(int id) { generated_stub("Entity_Player::CanAddCollectibleToInventory 007d4170"); } -void Entity_Player::SetPocketActiveItem(int collectible, int slot, uint8_t keepInPools) { generated_stub("Entity_Player::SetPocketActiveItem 007d41d0"); } -void Entity_Player::get_salvation_scale() { generated_stub("Entity_Player::get_salvation_scale 007d4340"); } -void Entity_Player::update_suplex() { generated_stub("Entity_Player::update_suplex 007d4390"); } -uint32_t Entity_Player::bag_of_crafting_collect(Entity_Pickup *param_1) { generated_stub("Entity_Player::bag_of_crafting_collect 007d5170"); } -int Entity_Player::GetMaxPoopMana() { generated_stub("Entity_Player::GetMaxPoopMana 007d65c0"); } -void Entity_Player::AddPoopMana(int amount) { generated_stub("Entity_Player::AddPoopMana 007d65e0"); } -void Entity_Player::poop_spell_roll() { generated_stub("Entity_Player::poop_spell_roll 007d6670"); } -void Entity_Player::UsePoopSpell(uint32_t param_2) { generated_stub("Entity_Player::UsePoopSpell 007d7290"); } -void Entity_Player::RecomputeWispCollectibles(Entity_Familiar *wisp) { generated_stub("Entity_Player::RecomputeWispCollectibles 007d7740"); } -void Entity_Player::trigger_cracked_orb(Vector *effectPos) { generated_stub("Entity_Player::trigger_cracked_orb 007d7c30"); } -uint32_t Entity_Player::AddItemCard(uint32_t itemID) { generated_stub("Entity_Player::AddItemCard 007d8240"); } -void Entity_Player::spawn_lil_clot_familiars() { generated_stub("Entity_Player::spawn_lil_clot_familiars 007d83f0"); } -void Entity_Player::creep_contact_add(int flags, int count) { generated_stub("Entity_Player::creep_contact_add 007d8740"); } -uint8_t Entity_Player::spawn_ghost_corpse() { generated_stub("Entity_Player::spawn_ghost_corpse 007d87a0"); } -void Entity_Player::AddCurseMistEffect() { generated_stub("Entity_Player::AddCurseMistEffect 007d8980"); } -void Entity_Player::RemoveCurseMistEffect() { generated_stub("Entity_Player::RemoveCurseMistEffect 007d8d20"); } -void Entity_Player::AttachMinecart(Entity_NPC *minecart) { generated_stub("Entity_Player::AttachMinecart 007d9180"); } -void Entity_Player::add_samson_berserk_charge(int amount) { generated_stub("Entity_Player::add_samson_berserk_charge 007d9200"); } -void Entity_Player::RevivePlayerGhost() { generated_stub("Entity_Player::RevivePlayerGhost 007d93b0"); } -void Entity_Player::MorphToCoopGhost() { generated_stub("Entity_Player::MorphToCoopGhost 007d96f0"); } -void Entity_Player::reset_body_sprite() { generated_stub("Entity_Player::reset_body_sprite 007d9b70"); } -uint32_t * Entity_Player::CalculateBagOfCraftingOutput(uint32_t *output, uint8_t *bagContent, uint8_t unused) { generated_stub("Entity_Player::CalculateBagOfCraftingOutput 007d9d00"); } -void Entity_Player::SpawnClot(Vector *pos, uint8_t unk) { generated_stub("Entity_Player::SpawnClot 007da810"); } -uint8_t Entity_Player::TryForgottenThrow(Vector *dir) { generated_stub("Entity_Player::TryForgottenThrow 007dac80"); } -void Entity_Player::ResetPlayer() { generated_stub("Entity_Player::ResetPlayer 007daed0"); } -void Entity_Player::remove_wooden_cross_mantles() { generated_stub("Entity_Player::remove_wooden_cross_mantles 007db160"); } -uint8_t Entity_Player::HasInstantDeathCurse() { generated_stub("Entity_Player::HasInstantDeathCurse 007db6b0"); } -uint8_t Entity_Player::IsHologram() { generated_stub("Entity_Player::IsHologram 007db700"); } -void Entity_Player::TriggerEchoChamber(uint32_t pocketItemType, int cardOrPillColor) { generated_stub("Entity_Player::TriggerEchoChamber 007db740"); } -int Entity_Player::get_seeded_variant() { generated_stub("Entity_Player::get_seeded_variant 007db8d0"); } -uint8_t Entity_Player::is_evil_charm_immune(EntityRef source) { generated_stub("Entity_Player::is_evil_charm_immune 007dba30"); } -void Entity_Player::add_random_drug_item_effect() { generated_stub("Entity_Player::add_random_drug_item_effect 007dbba0"); } -void Entity_Player::AddRandomMomItemEffect() { generated_stub("Entity_Player::AddRandomMomItemEffect 007dbc80"); } -void Entity_Player::ModelingClay_roll(RNG *rng) { generated_stub("Entity_Player::ModelingClay_roll 007dbd70"); } -void Entity_Player::twins_duplicate_familiars(int count) { generated_stub("Entity_Player::twins_duplicate_familiars 007dbeb0"); } -std_string * Entity_Player::GetName() { generated_stub("Entity_Player::GetName 007e9280"); } -long double Entity_Player::GetSmoothBodyRotation() { generated_stub("Entity_Player::GetSmoothBodyRotation 007e92a0"); } -void Entity_Player::TriggerRoomExit() { generated_stub("Entity_Player::TriggerRoomExit 00832850"); } -int Entity_Player::GetModelingClayEffect() { generated_stub("Entity_Player::GetModelingClayEffect 0083ab80"); } -int Entity_Player::GetJarFlies() { generated_stub("Entity_Player::GetJarFlies 00841ca0"); } -int Entity_Player::GetActiveSubCharge(int slot) { generated_stub("Entity_Player::GetActiveSubCharge 00841cb0"); } -int Entity_Player::GetPoopSpell(int position) { generated_stub("Entity_Player::GetPoopSpell 00841cd0"); } -uint8_t Entity_Player::HasFullHeartsAndSoulHearts() { generated_stub("Entity_Player::HasFullHeartsAndSoulHearts 0085e200"); } -Vector * Entity_Player::GetMovementVector() { generated_stub("Entity_Player::GetMovementVector 0085e220"); } -Vector * Entity_Player::GetRecentMovementVector() { generated_stub("Entity_Player::GetRecentMovementVector 0085e230"); } -int Entity_Player::GetTearRangeModifier() { generated_stub("Entity_Player::GetTearRangeModifier 0085e240"); } -int Entity_Player::ControlsCooldown() { generated_stub("Entity_Player::ControlsCooldown 0085e250"); } -void Entity_Player::AddControlsCooldown(int param_2) { generated_stub("Entity_Player::AddControlsCooldown 0085e260"); } -EntityRef * Entity_Player::GetLastDamageSource() { generated_stub("Entity_Player::GetLastDamageSource 0085e270"); } -uint64_t Entity_Player::GetLastDamageFlags() { generated_stub("Entity_Player::GetLastDamageFlags 0085e280"); } -int Entity_Player::GetTotalDamageTaken() { generated_stub("Entity_Player::GetTotalDamageTaken 0085e290"); } -int Entity_Player::GetLastActionTriggers() { generated_stub("Entity_Player::GetLastActionTriggers 0085e2c0"); } -int Entity_Player::GetBodyColor() { generated_stub("Entity_Player::GetBodyColor 0085e2d0"); } -int Entity_Player::GetHeadColor() { generated_stub("Entity_Player::GetHeadColor 0085e2e0"); } -int Entity_Player::GetNumGigaBombs() { generated_stub("Entity_Player::GetNumGigaBombs 0085e2f0"); } -uint32_t Entity_Player::restore_save_state_part2() { generated_stub("Entity_Player::restore_save_state_part2 009d16ee"); } -void Entity_Player::AddTrinket(int param_2, char param_3) { generated_stub("Entity_Player::AddTrinket 00a9f630"); } -Entity_Projectile::~Entity_Projectile() { generated_stub("Entity_Projectile::~Entity_Projectile 00652b50"); } -void Entity_Projectile::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Projectile::Init 00652b90"); } -void Entity_Projectile::Update() { generated_stub("Entity_Projectile::Update 00653070"); } -void Entity_Projectile::Interpolate() { generated_stub("Entity_Projectile::Interpolate 0065c510"); } -void Entity_Projectile::Render(Vector *offset) { generated_stub("Entity_Projectile::Render 0065cb60"); } -uint8_t Entity_Projectile::CanShutDoors() { generated_stub("Entity_Projectile::CanShutDoors 00652f60"); } -void Entity_Projectile::HandleCollision() { generated_stub("Entity_Projectile::HandleCollision 0065b670"); } -uint64_t Entity_Projectile::ProjectileFlags() { generated_stub("Entity_Projectile::ProjectileFlags 00417830"); } -void Entity_Projectile::set_falling_accel(float accel) { generated_stub("Entity_Projectile::set_falling_accel 00444c90"); } -void Entity_Projectile::set_projectile_flags(uint64_t flags) { generated_stub("Entity_Projectile::set_projectile_flags 00447740"); } -void Entity_Projectile::AddHeight(float param_2) { generated_stub("Entity_Projectile::AddHeight 00456420"); } -void Entity_Projectile::AddFallingSpeed(float param_2) { generated_stub("Entity_Projectile::AddFallingSpeed 00456450"); } -void Entity_Projectile::AddFallingAccel(float param_2) { generated_stub("Entity_Projectile::AddFallingAccel 00456470"); } -void Entity_Projectile::AddProjectileFlags(uint64_t flags) { generated_stub("Entity_Projectile::AddProjectileFlags 00456490"); } -int Entity_Projectile::ChangeTimeout() { generated_stub("Entity_Projectile::ChangeTimeout 004b70a0"); } -long double Entity_Projectile::CurvingStrength() { generated_stub("Entity_Projectile::CurvingStrength 004d3060"); } -int Entity_Projectile::WiggleFrameOffset() { generated_stub("Entity_Projectile::WiggleFrameOffset 004d3070"); } -void Entity_Projectile::Constructor() { generated_stub("Entity_Projectile::Constructor 00652b00"); } -void Entity_Projectile::Reflect(Entity *unused, Vector *newVelocity) { generated_stub("Entity_Projectile::Reflect 00652fa0"); } -void Entity_Projectile::update_height_collision() { generated_stub("Entity_Projectile::update_height_collision 0065b500"); } -void Entity_Projectile::SetHeight(float height) { generated_stub("Entity_Projectile::SetHeight 00675fc0"); } -void Entity_Projectile::Deflect(Entity *newSpawner, Vector *velocity) { generated_stub("Entity_Projectile::Deflect 0067a080"); } -void Entity_Projectile::AddChangeFlags(uint64_t flags) { generated_stub("Entity_Projectile::AddChangeFlags 006b82f0"); } -long double Entity_Projectile::Acceleration() { generated_stub("Entity_Projectile::Acceleration 0085e300"); } -uint64_t Entity_Projectile::ChangeFlags() { generated_stub("Entity_Projectile::ChangeFlags 0085e310"); } -void Entity_Projectile::AddScale(float param_2) { generated_stub("Entity_Projectile::AddScale 0085e320"); } -long double Entity_Projectile::Damage() { generated_stub("Entity_Projectile::Damage 0085e360"); } -Entity_Slot::~Entity_Slot() { generated_stub("Entity_Slot::~Entity_Slot 0065d130"); } -void Entity_Slot::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Slot::Init 0065d200"); } -void Entity_Slot::Update() { generated_stub("Entity_Slot::Update 0065d950"); } -void Entity_Slot::Render(Vector *offset) { generated_stub("Entity_Slot::Render 00665370"); } -uint8_t Entity_Slot::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown) { generated_stub("Entity_Slot::TakeDamage 00664560"); } -void Entity_Slot::HandleCollision() { generated_stub("Entity_Slot::HandleCollision 006627e0"); } -void Entity_Slot::spawn_break_drops() { generated_stub("Entity_Slot::spawn_break_drops 00663aa0"); } -void Entity_Slot::SetPrizeType(int prizeType) { generated_stub("Entity_Slot::SetPrizeType 00665500"); } -Entity_Tear::~Entity_Tear() { generated_stub("Entity_Tear::~Entity_Tear 00665ea0"); } -void Entity_Tear::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Tear::Init 006660a0"); } -void Entity_Tear::Update() { generated_stub("Entity_Tear::Update 006670f0"); } -void Entity_Tear::Interpolate() { generated_stub("Entity_Tear::Interpolate 00679400"); } -void Entity_Tear::Render(Vector *offset) { generated_stub("Entity_Tear::Render 006790c0"); } -void Entity_Tear::SetCollisionDamage(float param_2) { generated_stub("Entity_Tear::SetCollisionDamage 00675fa0"); } -void Entity_Tear::ClearReferences() { generated_stub("Entity_Tear::ClearReferences 006666c0"); } -void Entity_Tear::HandleCollision() { generated_stub("Entity_Tear::HandleCollision 00673660"); } -BitSet128 * Entity_Tear::TearFlags(BitSet128 *outFlags) { generated_stub("Entity_Tear::TearFlags 004177c0"); } -long double Entity_Tear::Height() { generated_stub("Entity_Tear::Height 00431750"); } -long double Entity_Tear::FallingAcceleration() { generated_stub("Entity_Tear::FallingAcceleration 00435e50"); } -long double Entity_Tear::FallingSpeed() { generated_stub("Entity_Tear::FallingSpeed 00456440"); } -int Entity_Tear::TearIndex() { generated_stub("Entity_Tear::TearIndex 004aade0"); } -long double Entity_Tear::Scale() { generated_stub("Entity_Tear::Scale 00557cd0"); } -long double Entity_Tear::BaseScale() { generated_stub("Entity_Tear::BaseScale 0060ccb0"); } -long double Entity_Tear::Rotation() { generated_stub("Entity_Tear::Rotation 0060ccc0"); } -void Entity_Tear::SetKnockbackMultiplier(float param_2) { generated_stub("Entity_Tear::SetKnockbackMultiplier 0060ccd0"); } -void Entity_Tear::SetWaitFrames(int param_2) { generated_stub("Entity_Tear::SetWaitFrames 0060cd00"); } -Entity_Player * Entity_Tear::GetRootPlayer() { generated_stub("Entity_Tear::GetRootPlayer 00665b00"); } -void Entity_Tear::Constructor() { generated_stub("Entity_Tear::Constructor 00665cf0"); } -void Entity_Tear::apply_wiggle(float strength) { generated_stub("Entity_Tear::apply_wiggle 006668c0"); } -void Entity_Tear::update_wiggle() { generated_stub("Entity_Tear::update_wiggle 00666ba0"); } -void Entity_Tear::play_fire_sound() { generated_stub("Entity_Tear::play_fire_sound 00666d40"); } -float Entity_Tear::get_height_offset_y(float height) { generated_stub("Entity_Tear::get_height_offset_y 00676020"); } -void Entity_Tear::SetScale(float scale) { generated_stub("Entity_Tear::SetScale 00676120"); } -void Entity_Tear::SetTearFlags(BitSet128 flags) { generated_stub("Entity_Tear::SetTearFlags 00676150"); } -void Entity_Tear::apply_death_flag_effects(Entity *target) { generated_stub("Entity_Tear::apply_death_flag_effects 00676be0"); } -void Entity_Tear::ResetSpriteScale() { generated_stub("Entity_Tear::ResetSpriteScale 00677780"); } -uint8_t Entity_Tear::is_not_familiar_spawned() { generated_stub("Entity_Tear::is_not_familiar_spawned 00678060"); } -void Entity_Tear::fire_split_projectiles(uint8_t isHalved) { generated_stub("Entity_Tear::fire_split_projectiles 00678080"); } -void Entity_Tear::SetDeadEyeIntensity(float intensity) { generated_stub("Entity_Tear::SetDeadEyeIntensity 00679e80"); } -Entity_Tear * Entity_Tear::MakeMultidimensionalCopy(Entity *spawner) { generated_stub("Entity_Tear::MakeMultidimensionalCopy 0067a190"); } -void Entity_Tear::ChangeVariant(int variant) { generated_stub("Entity_Tear::ChangeVariant 0067a400"); } -int Entity_Tear::find_nearest_linkable_tear() { generated_stub("Entity_Tear::find_nearest_linkable_tear 0067a770"); } -Entity_Tear * Entity_Tear::find_link_partner() { generated_stub("Entity_Tear::find_link_partner 0067a8f0"); } -void Entity_Tear::apply_link_spring_forces() { generated_stub("Entity_Tear::apply_link_spring_forces 0067aaf0"); } -uint8_t Entity_Tear::try_make_bridges(float *param_1) { generated_stub("Entity_Tear::try_make_bridges 0067d560"); } -void Entity_Tear::reroll_hit_entity(int unused) { generated_stub("Entity_Tear::reroll_hit_entity 006b5320"); } -long double Entity_Tear::BaseDamage() { generated_stub("Entity_Tear::BaseDamage 0085dd60"); } -void Entity_Tear::SetParentOffset(Vector *offset) { generated_stub("Entity_Tear::SetParentOffset 0085dd70"); } -Vector * Entity_Tear::PosDisplacement() { generated_stub("Entity_Tear::PosDisplacement 0085dd90"); } -Entity_Text::~Entity_Text() { generated_stub("Entity_Text::~Entity_Text 005ccc60"); } -void Entity_Text::Init(int type, int variant, int subType, uint32_t initSeed) { generated_stub("Entity_Text::Init 005ccca0"); } -void Entity_Text::Update() { generated_stub("Entity_Text::Update 005ccd80"); } -void Entity_Text::Interpolate() { generated_stub("Entity_Text::Interpolate 005cd2e0"); } -void Entity_Text::Render(Vector *offset) { generated_stub("Entity_Text::Render 005ccfc0"); } -void Entity_Text::HandleCollision() { generated_stub("Entity_Text::HandleCollision 005ccc20"); } void * FileSystem::GetMountPrefixes(void *outPrefixes) { generated_stub("FileSystem::GetMountPrefixes 00a16060"); } void FileSystem::load_mount_points() { generated_stub("FileSystem::load_mount_points 00a167d0"); } uint32_t FileSystem::find_mount(uint8_t *param_1, uint8_t *param_2) { generated_stub("FileSystem::find_mount 00a16c60"); } @@ -9602,6 +8411,15 @@ FriendEntry::~FriendEntry() { generated_stub("FriendEntry::~FriendEntry 008e1f30 void GameOver::RenderItemSprite(int memberIndex) { generated_stub("GameOver::RenderItemSprite 008ebfb0"); } void GameOver::Render() { generated_stub("GameOver::Render 00998880"); } void GameOver::Show() { generated_stub("GameOver::Show 009997c0"); } +GameStatePlayer::~GameStatePlayer() { generated_stub("GameStatePlayer::~GameStatePlayer 00754d90"); } +void GameStatePlayer::read_player_key(void *stream) { generated_stub("GameStatePlayer::read_player_key 009c86e0"); } +void GameStatePlayer::Init() { generated_stub("GameStatePlayer::Init 009cf050"); } +uint8_t GameStatePlayer::read_coplayer(short *block, void *stream) { generated_stub("GameStatePlayer::read_coplayer 009cff40"); } +void GameStatePlayer::write_coplayer(void *stream) { generated_stub("GameStatePlayer::write_coplayer 009d0100"); } +void GameStatePlayer::read_block_538(uint32_t *block, void *stream) { generated_stub("GameStatePlayer::read_block_538 009d02c0"); } +void GameStatePlayer::write_block_538(short *block, void *stream) { generated_stub("GameStatePlayer::write_block_538 009d0440"); } +uint8_t GameStatePlayer::read(void *reader) { generated_stub("GameStatePlayer::read 009d05d0"); } +uint32_t GameStatePlayer::read_part3() { generated_stub("GameStatePlayer::read_part3 009d2656"); } void * Game_StateSlot::operator_assign(void *other) { generated_stub("Game_StateSlot::operator_assign 006f8a40"); } void * GlitchedCollectibleGfx::constructor() { generated_stub("GlitchedCollectibleGfx::constructor 009dc6e0"); } void GlitchedItemSet::recalculate() { generated_stub("GlitchedItemSet::recalculate 009e0500"); } @@ -9772,6 +8590,22 @@ uint8_t GridEntity_Web::Destroy(uint8_t isImmediate) { generated_stub("GridEntit void * GridEntity_Web::GetWaterClipInfo(void *outInfo) { generated_stub("GridEntity_Web::GetWaterClipInfo 00714750"); } void GridEntity_Web::BeginBatches() { generated_stub("GridEntity_Web::BeginBatches 00721540"); } void HallucinationOverlay::Render(Vector *offset) { generated_stub("HallucinationOverlay::Render 00839550"); } +HomingLaser * HomingLaser::operator_assign(HomingLaser *other) { generated_stub("HomingLaser::operator_assign 0085e000"); } +HomingLaser::HomingLaser() { generated_stub("HomingLaser::HomingLaser 0099c290"); } +void HomingLaser::build_bezier_path(int homingType, Entity *source) { generated_stub("HomingLaser::build_bezier_path 0099c790"); } +void HomingLaser::compute_axis_bezier_handles() { generated_stub("HomingLaser::compute_axis_bezier_handles 0099dca0"); } +void HomingLaser::compute_bezier_handles(float tension) { generated_stub("HomingLaser::compute_bezier_handles 0099e160"); } +void HomingLaser::CalculateSamples(float param_2) { generated_stub("HomingLaser::CalculateSamples 0099e360"); } +void HomingLaser::apply_sine_offset(float amplitude, float phase) { generated_stub("HomingLaser::apply_sine_offset 0099ec00"); } +void HomingLaser::build_curl_path(float radius) { generated_stub("HomingLaser::build_curl_path 0099fa60"); } +void HomingLaser::build_wiggle_bezier() { generated_stub("HomingLaser::build_wiggle_bezier 0099fed0"); } +uint8_t HomingLaser::clip_samples_to_grid(Vector *pos, int gridCollisionClass) { generated_stub("HomingLaser::clip_samples_to_grid 009a0520"); } +void HomingLaser::truncate_samples_at_player() { generated_stub("HomingLaser::truncate_samples_at_player 009a0740"); } +void HomingLaser::truncate_samples_at_obstacle(Vector *positionOffset) { generated_stub("HomingLaser::truncate_samples_at_obstacle 009a0c50"); } +void HomingLaser::remove_collinear_samples(float tolerance) { generated_stub("HomingLaser::remove_collinear_samples 009a0de0"); } +void HomingLaser::apply_sample_wiggle(float amplitude, float phase) { generated_stub("HomingLaser::apply_sample_wiggle 009a0fa0"); } +uint32_t HomingLaser::find_targets(float *param_1, float *param_2, int param_3, uint32_t param_4, Entity *param_5) { generated_stub("HomingLaser::find_targets 009a12b0"); } +uint8_t HomingLaser::truncate_samples(float maxLength) { generated_stub("HomingLaser::truncate_samples 009a1520"); } void * InputManager::GetDeviceByPlayerEntity(Entity_Player *player) { generated_stub("InputManager::GetDeviceByPlayerEntity 0090ac70"); } int InputManager::FirstLocalDeviceID() { generated_stub("InputManager::FirstLocalDeviceID 0090aeb0"); } float InputManager::GetActionValue(int action, int controllerIndex, Entity *entity, int unused) { generated_stub("InputManager::GetActionValue 009562d0"); } @@ -10588,6 +9422,9 @@ void * Multiplayer::get_lobby(void *outLobby) { generated_stub("Multiplayer::get void Multiplayer::handle_member_status(void *lobby, uint64_t *userId, int status) { generated_stub("Multiplayer::handle_member_status 00a2a0b0"); } void Mutex::lock() { generated_stub("Mutex::lock 00aaaf50"); } Mutex::ScopeLock::~ScopeLock() { generated_stub("Mutex::ScopeLock::~ScopeLock 00aaae20"); } +void NPCAI_Pathfinder::ResetMovementTarget() { generated_stub("NPCAI_Pathfinder::ResetMovementTarget 007e6fa0"); } +uint8_t NPCAI_Pathfinder::HasPathToPos(Vector *position, uint8_t isIgnorePoop) { generated_stub("NPCAI_Pathfinder::HasPathToPos 007e7070"); } +void NPCAI_Pathfinder::SimulatePlayerMovement(float *param_2) { generated_stub("NPCAI_Pathfinder::SimulatePlayerMovement 007e8010"); } void NetDesyncHandler::Update() { generated_stub("NetDesyncHandler::Update 008fd900"); } void NetDesyncHandler::receive_messages() { generated_stub("NetDesyncHandler::receive_messages 008fed60"); } void NetDesyncHandler::write_desync_diff() { generated_stub("NetDesyncHandler::write_desync_diff 008ffc70"); } @@ -10707,7 +9544,6 @@ int NpcHelper::tuff_twins_spawn_count(Entity_NPC *npc) { generated_stub("NpcHelp void NpcHelper::tuff_twins_play_anim(Entity_NPC *npc, uint8_t *animName, int unused) { generated_stub("NpcHelper::tuff_twins_play_anim 005999b0"); } void NpcHelper::tuff_twins_body_attack_anim(Entity_NPC *npc) { generated_stub("NpcHelper::tuff_twins_body_attack_anim 00599f80"); } void NpcHelper::UltraGreed_Heal(Entity_NPC *npc, int amount) { generated_stub("NpcHelper::UltraGreed_Heal 0059e2a0"); } -Entity_NPC * NpcHelper::UltraDoor_Opposite(Entity_NPC *door, EntityList_EL doors) { generated_stub("NpcHelper::UltraDoor_Opposite 0059e630"); } void NpcHelper::UltraGreed_Smash(Entity_NPC *npc, Vector position) { generated_stub("NpcHelper::UltraGreed_Smash 0059e730"); } void NpcHelper::visage_spawn_particles(Vector *position, Vector *direction) { generated_stub("NpcHelper::visage_spawn_particles 005a7010"); } void NpcHelper::visage_spawn_chain(Entity_NPC *npc) { generated_stub("NpcHelper::visage_spawn_chain 005a7310"); } @@ -10771,214 +9607,7 @@ void ReferenceCountBase::vfunc_5() { generated_stub("ReferenceCountBase::vfunc_5 ReferenceCountBase::ReferenceCountBase() { generated_stub("ReferenceCountBase::ReferenceCountBase 0040cc10"); } uint8_t RichTextSpan::try_merge(void *other) { generated_stub("RichTextSpan::try_merge 009ef9a0"); } void RichTextSpan::move_construct(void *dest, void *source) { generated_stub("RichTextSpan::move_construct 009f1ef0"); } -int Room::GetGridHeight() { generated_stub("Room::GetGridHeight 0040c2e0"); } -Room * Room::init_render_buffers() { generated_stub("Room::init_render_buffers 00417930"); } -Vector * Room::GetTopLeftPos() { generated_stub("Room::GetTopLeftPos 00421800"); } -EntityList * Room::GetEntities() { generated_stub("Room::GetEntities 00428a50"); } -int Room::GetRoomShape() { generated_stub("Room::GetRoomShape 0042a270"); } -uint8_t Room::SetGridPath(int gridIndex, int value) { generated_stub("Room::SetGridPath 0042a290"); } -Vector * Room::GetBottomRightPos() { generated_stub("Room::GetBottomRightPos 0042cc70"); } -Vector * Room::GetRenderScrollOffset() { generated_stub("Room::GetRenderScrollOffset 0042d030"); } -GridEntity_Door * Room::GetDoor(int slot) { generated_stub("Room::GetDoor 00436020"); } -uint32_t Room::GetSpawnSeed() { generated_stub("Room::GetSpawnSeed 00436050"); } -GridEntity * Room::GetGridEntity(uint32_t idx) { generated_stub("Room::GetGridEntity 00436060"); } -uint8_t Room::IsClear() { generated_stub("Room::IsClear 00436080"); } -Vector * Room::GetClampedPosition(Vector *outPos, Vector *position, float margin) { generated_stub("Room::GetClampedPosition 00436090"); } -int Room::GetTintedRockIdx() { generated_stub("Room::GetTintedRockIdx 004360c0"); } -int Room::GetBossID() { generated_stub("Room::GetBossID 0043ef20"); } -int Room::GetGridPath(int gridIndex) { generated_stub("Room::GetGridPath 004565c0"); } -GridEntity * Room::GetGridEntityFromPos(Vector *pos) { generated_stub("Room::GetGridEntityFromPos 00456620"); } -int Room::GetGridSize() { generated_stub("Room::GetGridSize 004566a0"); } -int Room::GetAliveEnemiesCount() { generated_stub("Room::GetAliveEnemiesCount 004566b0"); } -int Room::GetAliveBossesCount() { generated_stub("Room::GetAliveBossesCount 004566d0"); } -void Room::EmitBloodFromWalls(int duration, int count) { generated_stub("Room::EmitBloodFromWalls 004566f0"); } -bool Room::HasSlowDown() { generated_stub("Room::HasSlowDown 00456710"); } -void Room::SetSlowDown(int duration) { generated_stub("Room::SetSlowDown 00456720"); } -uint32_t Room::GetDecorationSeed() { generated_stub("Room::GetDecorationSeed 004aae80"); } -void Room::SetClear(uint8_t isClear) { generated_stub("Room::SetClear 004aae90"); } -void Room::SetSacrificeDone(uint8_t isDone) { generated_stub("Room::SetSacrificeDone 004aaeb0"); } -int Room::GetBackdropType() { generated_stub("Room::GetBackdropType 004cdd20"); } -uint8_t Room::RaiseGridPathAtPos(Vector *pos, int pathValue) { generated_stub("Room::RaiseGridPathAtPos 004cdd80"); } -uint8_t Room::HasTriggerPressurePlates() { generated_stub("Room::HasTriggerPressurePlates 004d7780"); } -uint8_t Room::HasWaterPits() { generated_stub("Room::HasWaterPits 00505c40"); } -Vector * Room::GetWaterCurrent(Vector *outResult) { generated_stub("Room::GetWaterCurrent 00505c50"); } -void Room::StopRain() { generated_stub("Room::StopRain 005784d0"); } -uint8_t Room::CanSpawnObstacleAtPos(Vector *position, uint8_t isForce) { generated_stub("Room::CanSpawnObstacleAtPos 00589f90"); } -int Room::get_beast_arena() { generated_stub("Room::get_beast_arena 00592270"); } -uint8_t Room::IsDoorSlotAllowed(int slot) { generated_stub("Room::IsDoorSlotAllowed 0059e250"); } -void Room::InvalidatePickupVision() { generated_stub("Room::InvalidatePickupVision 005b16c0"); } -uint8_t Room::IsSacrificeDone() { generated_stub("Room::IsSacrificeDone 005cd650"); } -uint8_t Room::is_deaths_list_done() { generated_stub("Room::is_deaths_list_done 005cd660"); } -uint8_t Room::has_exorcist() { generated_stub("Room::has_exorcist 005cd670"); } -Vector * Room::ScreenWrapPosition(Vector *outPosition, Vector *position, float margin) { generated_stub("Room::ScreenWrapPosition 00652ab0"); } -uint8_t Room::IsFirstVisit() { generated_stub("Room::IsFirstVisit 0065cef0"); } -uint8_t Room::IsInitialized() { generated_stub("Room::IsInitialized 006b83d0"); } -Vector * Room::GetRenderSurfaceTopLeft() { generated_stub("Room::GetRenderSurfaceTopLeft 006b83e0"); } -uint8_t Room::IsFirstEnemyDead() { generated_stub("Room::IsFirstEnemyDead 006b83f0"); } -void Room::SetFirstEnemyDead(uint8_t param_2) { generated_stub("Room::SetFirstEnemyDead 006b8400"); } -uint8_t Room::has_room_config_flag(uint32_t mask) { generated_stub("Room::has_room_config_flag 006b8410"); } -uint8_t Room::IsAmbushDone() { generated_stub("Room::IsAmbushDone 0070c560"); } -long double Room::GetLavaIntensity() { generated_stub("Room::GetLavaIntensity 007120c0"); } -void Room::SetRedHeartDamage() { generated_stub("Room::SetRedHeartDamage 007537c0"); } -void Room::SetCardAgainstHumanity() { generated_stub("Room::SetCardAgainstHumanity 007537d0"); } -int Room::GetDeliriumDistance() { generated_stub("Room::GetDeliriumDistance 007537e0"); } -uint8_t Room::GetRedHeartDamage() { generated_stub("Room::GetRedHeartDamage 007e91a0"); } -void Room::SetFloorColor(float param_2, float param_3, float param_4, float param_5, float param_6, float param_7, float param_8, float param_9, uint64_t param_10, float param_11) { generated_stub("Room::SetFloorColor 007e91b0"); } -void Room::SetWallColor(ColorMod color) { generated_stub("Room::SetWallColor 007e91f0"); } -Room * Room::constructor() { generated_stub("Room::constructor 007e9400"); } -Room::~Room() { generated_stub("Room::~Room 007e9ba0"); } -uint8_t Room::is_type_16() { generated_stub("Room::is_type_16 007ea190"); } -void Room::TriggerEffectRemoved(ItemConfig_Item *item, int unused) { generated_stub("Room::TriggerEffectRemoved 007ea1a0"); } -void Room::SetPauseTimer(int Duration) { generated_stub("Room::SetPauseTimer 007ea260"); } -float Room::time_scale_update() { generated_stub("Room::time_scale_update 007ea2d0"); } -float Room::GetTimeScale(Vector *unusedPosition, Entity *entity) { generated_stub("Room::GetTimeScale 007ea3e0"); } -void Room::PlayMusic() { generated_stub("Room::PlayMusic 007eb1b0"); } -uint8_t Room::SpawnGridEntity(int GridIndex, uint32_t Type, uint32_t Variant, uint32_t Seed, int VarData) { generated_stub("Room::SpawnGridEntity 007ebca0"); } -uint8_t Room::SpawnGridEntityDesc(int GridIndex, GridEntityDesc *Desc) { generated_stub("Room::SpawnGridEntityDesc 007ebd50"); } -int Room::GetSeededCollectible(uint32_t Seed, uint8_t NoDecrease) { generated_stub("Room::GetSeededCollectible 007ec080"); } -void Room::TransformEntry(void *entry, uint32_t gridIndex, uint32_t seed) { generated_stub("Room::TransformEntry 007ec100"); } -uint8_t Room::IsPersistentRoomEntity(int type, int variant, int subType) { generated_stub("Room::IsPersistentRoomEntity 007ed2a0"); } -uint8_t Room::SpawnEntry(uint32_t gridIndex, void *entry, uint32_t seed, Entity **outEntity, uint8_t isRespawn) { generated_stub("Room::SpawnEntry 007ed310"); } -uint8_t Room::make_wall(int x, int y) { generated_stub("Room::make_wall 007ee7e0"); } -void Room::MakeDoor(int slot) { generated_stub("Room::MakeDoor 007eea90"); } -int Room::GetRoomConfigStage() { generated_stub("Room::GetRoomConfigStage 007eece0"); } -void Room::on_leave() { generated_stub("Room::on_leave 007efa50"); } -void Room::RestoreState() { generated_stub("Room::RestoreState 007eff50"); } -void Room::update_door_transitions() { generated_stub("Room::update_door_transitions 007f01c0"); } -int Room::GetGridCollisionAtPos(Vector pos) { generated_stub("Room::GetGridCollisionAtPos 007f0780"); } -uint32_t Room::GetGridCollision(int index) { generated_stub("Room::GetGridCollision 007f0800"); } -Vector * Room::GetLaserTarget(Vector *outTarget, Vector *position, Vector *direction) { generated_stub("Room::GetLaserTarget 007f0b40"); } -uint8_t Room::CheckLine(Vector *pos1, Vector *pos2, int mode, int gridPathThreshold, uint8_t isIgnoreWalls, uint8_t isIgnoreCrushable, Vector *outPos) { generated_stub("Room::CheckLine 007f0df0"); } -void Room::LoadBackdropGraphics() { generated_stub("Room::LoadBackdropGraphics 007f1380"); } -void Room::reload_backdrop() { generated_stub("Room::reload_backdrop 007f2070"); } -void Room::update_bounds(uint8_t isFromGridSize) { generated_stub("Room::update_bounds 007f2390"); } -void Room::Init(RoomConfig_Room *config, RoomDescriptor *descriptor) { generated_stub("Room::Init 007f2800"); } -Vector * Room::GetDoorSlotPosition(Vector *outPosition, int doorSlot) { generated_stub("Room::GetDoorSlotPosition 007f79d0"); } -uint8_t Room::TrySpawnSecretExit(uint8_t isAnimate, uint8_t isForce) { generated_stub("Room::TrySpawnSecretExit 007f7a40"); } -uint8_t Room::TrySpawnSecretShop(uint8_t isForce) { generated_stub("Room::TrySpawnSecretShop 007f8190"); } -uint8_t Room::TrySpawnDevilRoomDoor(uint8_t isAnimate, uint8_t isForce) { generated_stub("Room::TrySpawnDevilRoomDoor 007f83b0"); } -float Room::GetDevilRoomChance() { generated_stub("Room::GetDevilRoomChance 007f92b0"); } -uint8_t Room::TrySpawnBossRushDoor(uint8_t isIgnoreTime, uint8_t isForce) { generated_stub("Room::TrySpawnBossRushDoor 007f9960"); } -uint8_t Room::TrySpawnMegaSatanRoomDoor(uint8_t isForce) { generated_stub("Room::TrySpawnMegaSatanRoomDoor 007f9df0"); } -void Room::clear_reward_position(Vector *position) { generated_stub("Room::clear_reward_position 007f9ee0"); } -void Room::clear_grid_for_pickup(int *gridIndex) { generated_stub("Room::clear_grid_for_pickup 007fa0e0"); } -void Room::remove_grid_entity_for_spawn(int *gridIndex) { generated_stub("Room::remove_grid_entity_for_spawn 007fa360"); } -void Room::SpawnClearAward() { generated_stub("Room::SpawnClearAward 007fb250"); } -void Room::card_against_humanity_fill() { generated_stub("Room::card_against_humanity_fill 007fe220"); } -void Room::TriggerBossDeath(Entity *entity) { generated_stub("Room::TriggerBossDeath 007fec00"); } -void Room::update_ambient_sounds() { generated_stub("Room::update_ambient_sounds 00800500"); } -void Room::UpdateGreedWave() { generated_stub("Room::UpdateGreedWave 00801ee0"); } -void Room::update_deaths_list() { generated_stub("Room::update_deaths_list 008020d0"); } -void Room::update_pressure_plates() { generated_stub("Room::update_pressure_plates 008024f0"); } -void Room::update_door_targets() { generated_stub("Room::update_door_targets 00802670"); } -void Room::Update() { generated_stub("Room::Update 00802980"); } -void Room::TriggerClear(uint8_t playSound) { generated_stub("Room::TriggerClear 008068f0"); } -void Room::render_player_light(Entity_Player *player, Vector *offset) { generated_stub("Room::render_player_light 0080bd20"); } -void Room::render_grid_entity_light(GridEntity *param_2, float *param_3) { generated_stub("Room::render_grid_entity_light 0080c810"); } -uint8_t Room::pick_special_clear_award(int *outCollectible, uint32_t *outTrinket, RNG *rng) { generated_stub("Room::pick_special_clear_award 0080e320"); } -void Room::render_lighting() { generated_stub("Room::render_lighting 0080ea80"); } -void Room::Render() { generated_stub("Room::Render 0080f200"); } -void Room::render_debug_grid_values(Vector *offset) { generated_stub("Room::render_debug_grid_values 008128f0"); } -int Room::GetGridPathFromPos(Vector *position) { generated_stub("Room::GetGridPathFromPos 00812c10"); } -int Room::GetGridIndex(Vector *pos) { generated_stub("Room::GetGridIndex 00812c90"); } -Vector * Room::GetCenterPos(Vector *outPos) { generated_stub("Room::GetCenterPos 00812d00"); } -int Room::GetClampedGridIndex(Vector *position) { generated_stub("Room::GetClampedGridIndex 00812de0"); } -int Room::GetGridIndexByTile(int GridRow, int GridColumn) { generated_stub("Room::GetGridIndexByTile 00812e60"); } -Vector * Room::GetGridPosition(Vector *outPos, int gridIndex) { generated_stub("Room::GetGridPosition 00812f00"); } -uint8_t Room::IsPositionInRoom(Vector *position, float margin) { generated_stub("Room::IsPositionInRoom 00813360"); } -uint8_t Room::DamageGridWithSource(int gridIndex, int damage, EntityRef *source) { generated_stub("Room::DamageGridWithSource 00813b30"); } -uint8_t Room::DamageGrid(int gridIndex, int damage) { generated_stub("Room::DamageGrid 00813b60"); } -uint8_t Room::DestroyGrid(int gridIdx, uint8_t isImmediate, uint8_t isDefuseBombRock) { generated_stub("Room::DestroyGrid 00813c40"); } -int Room::GetFrameCount() { generated_stub("Room::GetFrameCount 00813ce0"); } -int Room::greed_shop_slot_type(uint32_t seed) { generated_stub("Room::greed_shop_slot_type 00813d00"); } -void Room::init_shop_item_slots() { generated_stub("Room::init_shop_item_slots 00813d90"); } -int Room::shop_ware_roll(uint32_t *param_1, uint32_t *param_2, int *param_3, uint32_t param_4) { generated_stub("Room::shop_ware_roll 00814980"); } -int Room::GetShopItemPrice(uint32_t variant, int subType, int shopItemId, Entity_Player *player) { generated_stub("Room::GetShopItemPrice 008151e0"); } -void Room::TriggerRestock(int grid_idx, int shop_idx) { generated_stub("Room::TriggerRestock 00815800"); } -void Room::ShopRestockPartial() { generated_stub("Room::ShopRestockPartial 008158a0"); } -void Room::ShopRestockFull() { generated_stub("Room::ShopRestockFull 00815ae0"); } -void Room::ShopReshuffle(uint8_t isKeepCollectibleIdx, uint8_t isReselectSaleItem) { generated_stub("Room::ShopReshuffle 00816000"); } -void Room::RemoveDoor(int doorSlot) { generated_stub("Room::RemoveDoor 008167e0"); } -void Room::SpawnGreedModeWave(uint8_t unusedBool) { generated_stub("Room::SpawnGreedModeWave 00816910"); } -void Room::render_water(int pass) { generated_stub("Room::render_water 00817830"); } -uint32_t Room::IsAmbushActive() { generated_stub("Room::IsAmbushActive 0081e240"); } -float Room::GetLightingAlpha() { generated_stub("Room::GetLightingAlpha 0081e250"); } -Vector * Room::FindFreeTilePosition(Vector *outPos, Vector *pos, float distanceThreshold) { generated_stub("Room::FindFreeTilePosition 0081e520"); } -uint8_t Room::TryMakeBridge(GridEntity *pit, GridEntity *rock) { generated_stub("Room::TryMakeBridge 0081e6e0"); } -void Room::RemoveGridEntity(int gridIndex, int pathTrail, uint8_t isKeepDecoration) { generated_stub("Room::RemoveGridEntity 0081e930"); } -void Room::RemoveGridEntityImmediate(int GridIndex, int PathTrail, uint8_t KeepDecoration) { generated_stub("Room::RemoveGridEntityImmediate 0081e980"); } -Vector * Room::GetRandomPosition(Vector *outPosition, float margin) { generated_stub("Room::GetRandomPosition 0081e9d0"); } -int Room::GetRandomTileIndex(uint32_t seed) { generated_stub("Room::GetRandomTileIndex 0081ecc0"); } -uint32_t Room::GetBrokenWatchState() { generated_stub("Room::GetBrokenWatchState 0081edd0"); } -void Room::SetBrokenWatchState(int state) { generated_stub("Room::SetBrokenWatchState 0081edf0"); } -void Room::make_walls() { generated_stub("Room::make_walls 0081ee20"); } -void Room::render_debug_grid_indices(Vector *renderOffset) { generated_stub("Room::render_debug_grid_indices 0081f130"); } -uint8_t Room::IsLShapedRoom() { generated_stub("Room::IsLShapedRoom 0081f890"); } -void * Room::GetLRoomAreaDesc(void *buffer) { generated_stub("Room::GetLRoomAreaDesc 0081f8b0"); } -LRoomTileDesc * Room::GetLRoomTileDesc(LRoomTileDesc *buffer) { generated_stub("Room::GetLRoomTileDesc 0081fb20"); } -void Room::RespawnEnemies() { generated_stub("Room::RespawnEnemies 0081fd60"); } -uint8_t Room::TrySpawnBlueWombDoor(uint8_t isFirstTime, uint8_t isIgnoreTime, uint8_t isForce) { generated_stub("Room::TrySpawnBlueWombDoor 00820170"); } -uint8_t Room::TrySpawnTheVoidDoor(uint8_t isForce) { generated_stub("Room::TrySpawnTheVoidDoor 008204b0"); } -uint32_t Room::GetBossVictoryJingle() { generated_stub("Room::GetBossVictoryJingle 00820720"); } -bool Room::HasWater() { generated_stub("Room::HasWater 008208c0"); } -uint8_t Room::IsCurrentRoomLastBoss() { generated_stub("Room::IsCurrentRoomLastBoss 008208e0"); } -void Room::MamaMegaExplosion(Vector *position, Entity_Player *player) { generated_stub("Room::MamaMegaExplosion 00820910"); } -int Room::GetDungeonRockIdx() { generated_stub("Room::GetDungeonRockIdx 00820aa0"); } -void Room::TurnGold() { generated_stub("Room::TurnGold 00820ac0"); } -Vector * Room::WorldToScreenPosition(Vector *outPosition, float x, float y) { generated_stub("Room::WorldToScreenPosition 00820c00"); } -void Room::record_killed_npc(int param_1) { generated_stub("Room::record_killed_npc 00820d30"); } -void Room::render_water() { generated_stub("Room::render_water 00820fd0"); } -void Room::render_water_shader(Vector *renderOffset) { generated_stub("Room::render_water_shader 00821950"); } -uint8_t Room::is_obstacle_path_valid(uint32_t startIndex, uint32_t goalIndex, uint32_t flags) { generated_stub("Room::is_obstacle_path_valid 00821fc0"); } -uint8_t Room::CanSpawnObstacleAtPosition(int GridIndex, uint8_t Force) { generated_stub("Room::CanSpawnObstacleAtPosition 00822820"); } -void Room::add_trigger_output_index(uint32_t group, int gridIndex) { generated_stub("Room::add_trigger_output_index 00822cf0"); } -void Room::add_trigger_output_cell(int group, int x, int y) { generated_stub("Room::add_trigger_output_cell 00822d20"); } -void Room::hold_trigger_output_entities() { generated_stub("Room::hold_trigger_output_entities 00822d60"); } -Entity * Room::hold_entity_in_spawner(Entity *entity, int group) { generated_stub("Room::hold_entity_in_spawner 00822fd0"); } -void Room::TriggerOutput(uint32_t outputGroupdIdx) { generated_stub("Room::TriggerOutput 00823080"); } -float * Room::get_color_modifier(float *outColor) { generated_stub("Room::get_color_modifier 00823370"); } -KColor * Room::GetFloorColorAt(KColor *outColor, Vector *position, float radius) { generated_stub("Room::GetFloorColorAt 00823590"); } -uint8_t Room::is_reachable_from_player(float *param_1, Entity_Player *param_2, char param_3) { generated_stub("Room::is_reachable_from_player 00823be0"); } -Vector * Room::find_reachable_position(Vector *outPosition, Vector *position, int unused) { generated_stub("Room::find_reachable_position 00823d10"); } -void Room::attach_minecarts() { generated_stub("Room::attach_minecarts 00823f50"); } -uint8_t Room::HasLava() { generated_stub("Room::HasLava 008242d0"); } -void Room::init_rain() { generated_stub("Room::init_rain 00824350"); } -void Room::update_ambient_spawns() { generated_stub("Room::update_ambient_spawns 00824800"); } -uint32_t Room::update_ambient_effects() { generated_stub("Room::update_ambient_effects 00824a70"); } -void Room::update_water_current() { generated_stub("Room::update_water_current 00824ee0"); } -uint8_t Room::CanPickupGridEntity(int GridIndex) { generated_stub("Room::CanPickupGridEntity 00825730"); } -uint8_t Room::spawn_grid_from_desc(uint32_t gridIndex, GridEntityDesc *outDesc, ANM2 *outSprite) { generated_stub("Room::spawn_grid_from_desc 008257a0"); } -Entity_Effect * Room::PickupGridEntity(int GridIndex) { generated_stub("Room::PickupGridEntity 00825c50"); } -void Room::render_darkness_overlay() { generated_stub("Room::render_darkness_overlay 00825de0"); } -void Room::render_lava_pit_mask() { generated_stub("Room::render_lava_pit_mask 00826ae0"); } -void Room::render_water_overlay(Vector *offset) { generated_stub("Room::render_water_overlay 00826f80"); } -void Room::UpdateRedKey() { generated_stub("Room::UpdateRedKey 008271e0"); } -void Room::open_red_room_doors(int doorSlot, RoomDescriptor *targetRoom) { generated_stub("Room::open_red_room_doors 00827550"); } -Entity_Pickup * Room::spawn_options_alternative(Entity_Pickup *pickup) { generated_stub("Room::spawn_options_alternative 008276e0"); } -uint8_t Room::IsBeastDungeon() { generated_stub("Room::IsBeastDungeon 008279a0"); } -void Room::get_lava_line_y() { generated_stub("Room::get_lava_line_y 008279c0"); } -uint8_t Room::TrySpawnSpecialQuestDoor() { generated_stub("Room::TrySpawnSpecialQuestDoor 008279d0"); } -uint8_t Room::IsMirrorWorld() { generated_stub("Room::IsMirrorWorld 00827b70"); } -uint8_t Room::HasCurseMist() { generated_stub("Room::HasCurseMist 00827bb0"); } -uint8_t Room::is_pre_ascent_mom_room() { generated_stub("Room::is_pre_ascent_mom_room 00827bc0"); } -uint8_t Room::spawn_sanguine_bond_spikes(uint8_t isRoomInit) { generated_stub("Room::spawn_sanguine_bond_spikes 00827bf0"); } -int Room::GetSecondBossID() { generated_stub("Room::GetSecondBossID 0082eb80"); } -void Room::SetAmbushDone(uint8_t isDone) { generated_stub("Room::SetAmbushDone 008332c0"); } -void Room::KeepDoorsClosed() { generated_stub("Room::KeepDoorsClosed 0085e0f0"); } -uint32_t Room::GetAwardSeed() { generated_stub("Room::GetAwardSeed 0085e100"); } -int Room::GetShopLevel() { generated_stub("Room::GetShopLevel 0085e110"); } -int Room::GetRenderMode() { generated_stub("Room::GetRenderMode 0085e120"); } -float Room::GetEnemyDamageInflicted() { generated_stub("Room::GetEnemyDamageInflicted 0085e130"); } -void Room::Spawns(uint32_t *param_1, int param_2) { generated_stub("Room::Spawns 00872020"); } -uint32_t Room::Doors(int param_1) { generated_stub("Room::Doors 00872040"); } -void Room::render_pit_rails(float *param_2) { generated_stub("Room::render_pit_rails 009e31b0"); } -int Room::GetBossThematicItem(int param_2) { generated_stub("Room::GetBossThematicItem 009e7dc0"); } uint8_t RoomGridPath::can_step(int fromIndex, int toIndex) { generated_stub("RoomGridPath::can_step 009e3450"); } -RoomTransition::~RoomTransition() { generated_stub("RoomTransition::~RoomTransition 0082ebd0"); } -void RoomTransition::StartBossIntro(uint32_t bossID1, uint32_t bossID2) { generated_stub("RoomTransition::StartBossIntro 0082f1c0"); } -void RoomTransition::ChangeRoom() { generated_stub("RoomTransition::ChangeRoom 00830950"); } -void RoomTransition::Update() { generated_stub("RoomTransition::Update 008318a0"); } -float RoomTransition::get_hud_alpha() { generated_stub("RoomTransition::get_hud_alpha 008327e0"); } void * SaveDataManager::open_file_read(uint8_t *fileName) { generated_stub("SaveDataManager::open_file_read 00a24fd0"); } void * SaveDataManager::open_file_write(uint8_t *path, int mode) { generated_stub("SaveDataManager::open_file_write 00a25090"); } Shape::Shape(void *other) { generated_stub("Shape::Shape 0042f850"); } @@ -11041,10 +9670,10 @@ void SteamCloudFile::FUN_00a25450() { generated_stub("SteamCloudFile::FUN_00a254 void TearParams::constructor() { generated_stub("TearParams::constructor 005cd690"); } TearParams * TearParams::operator_(TearParams *other) { generated_stub("TearParams::operator_ 006075a0"); } void TearParams::copy(void *other) { generated_stub("TearParams::copy 0065b490"); } -TemporaryEffect::TemporaryEffect(ItemConfig_Item *item) { generated_stub("TemporaryEffect::TemporaryEffect 00435f80"); } void TexturePtr::release() { generated_stub("TexturePtr::release 0040c440"); } UmbilicalBabyData::~UmbilicalBabyData() { generated_stub("UmbilicalBabyData::~UmbilicalBabyData 00431790"); } uint32_t UmbilicalBabyData::last_point() { generated_stub("UmbilicalBabyData::last_point 00435590"); } +void UserProfile::find_or_create() { generated_stub("UserProfile::find_or_create 00a23ae0"); } void VideoPlayer::play(uint8_t *fileName, float volume) { generated_stub("VideoPlayer::play 009f2ee0"); } void VideoPlayer::unload() { generated_stub("VideoPlayer::unload 00a62880"); } void VideoPlayer::render(uint8_t param_1) { generated_stub("VideoPlayer::render 00a62b10"); } @@ -11433,10 +10062,7 @@ void FUN_00417dd0() { generated_stub("FUN_00417dd0 00417dd0"); } void FUN_00417df0() { generated_stub("FUN_00417df0 00417df0"); } void FUN_00417e50() { generated_stub("FUN_00417e50 00417e50"); } void render_entity_light_masks(float *param_1) { generated_stub("render_entity_light_masks 00419b50"); } -int FUN_0041b690(int param_1, int param_2, int param_3) { generated_stub("FUN_0041b690 0041b690"); } int FUN_0041b770(int param_1) { generated_stub("FUN_0041b770 0041b770"); } -void FUN_0041b9f0(uint32_t param_1, float param_2) { generated_stub("FUN_0041b9f0 0041b9f0"); } -void FUN_0041baf0() { generated_stub("FUN_0041baf0 0041baf0"); } void FUN_0041c670() { generated_stub("FUN_0041c670 0041c670"); } int FUN_0041c6f0(uint32_t param_1) { generated_stub("FUN_0041c6f0 0041c6f0"); } void FUN_0041c710() { generated_stub("FUN_0041c710 0041c710"); } @@ -11483,15 +10109,10 @@ void FUN_00421400() { generated_stub("FUN_00421400 00421400"); } void FUN_004215a0(char *param_1) { generated_stub("FUN_004215a0 004215a0"); } void FUN_004215e0(uint32_t *param_1) { generated_stub("FUN_004215e0 004215e0"); } void FUN_00421620(uint8_t *param_1) { generated_stub("FUN_00421620 00421620"); } -uint32_t FUN_00421720(uint32_t param_1) { generated_stub("FUN_00421720 00421720"); } DailyChallenge * FUN_00421780() { generated_stub("FUN_00421780 00421780"); } RoomConfig * FUN_00421790() { generated_stub("FUN_00421790 00421790"); } void FUN_00421860() { generated_stub("FUN_00421860 00421860"); } void FUN_00421880() { generated_stub("FUN_00421880 00421880"); } -void FUN_00421b50() { generated_stub("FUN_00421b50 00421b50"); } -uint32_t * FUN_00422620(int param_1) { generated_stub("FUN_00422620 00422620"); } -void FUN_00422ea0(int param_1) { generated_stub("FUN_00422ea0 00422ea0"); } -void FUN_00422f80(int param_1) { generated_stub("FUN_00422f80 00422f80"); } void vector_bool_resize(void *self, uint32_t newSize, uint8_t isFillValue) { generated_stub("vector_bool_resize 00423090"); } int string_compare(uint8_t *a, uint32_t lengthA, uint8_t *b, uint32_t lengthB) { generated_stub("string_compare 00423480"); } void FUN_00423500(uint32_t *param_1, uint32_t param_2) { generated_stub("FUN_00423500 00423500"); } @@ -12410,7 +11031,6 @@ void FamiliarAI::cube_baby(Entity_Familiar *familiar) { generated_stub("Familiar void FamiliarAI::blood_puppy(Entity_Familiar *familiar) { generated_stub("FamiliarAI::blood_puppy 0064fd40"); } void FamiliarAI::vanishing_twin(Entity_Familiar *familiar) { generated_stub("FamiliarAI::vanishing_twin 00650610"); } int apply_forgotten_lullaby(void *self, int fireDelay) { generated_stub("apply_forgotten_lullaby 00651810"); } -void FUN_006518c0() { generated_stub("FUN_006518c0 006518c0"); } int FUN_006518d0(uint32_t param_1) { generated_stub("FUN_006518d0 006518d0"); } void * set_iterator_post_increment(void *self, void *outIterator, int unused) { generated_stub("set_iterator_post_increment 006518f0"); } void FUN_00651910() { generated_stub("FUN_00651910 00651910"); } @@ -12487,7 +11107,6 @@ Vector * RandomVector(Vector *out, uint32_t seed) { generated_stub("RandomVector Vector * Isaac::GetAxisAlignedUnitVectorFromDir(Vector *outVector, int direction) { generated_stub("Isaac::GetAxisAlignedUnitVectorFromDir 0067f1d0"); } int vector_to_direction(Vector *vec) { generated_stub("vector_to_direction 0067f260"); } void FUN_0067f2e0() { generated_stub("FUN_0067f2e0 0067f2e0"); } -Vector * Isaac::GetRenderPosition(Vector *outPosition, Vector *source, uint8_t isScale) { generated_stub("Isaac::GetRenderPosition 0067f310"); } void * string_split(void *outTokens, std_string *text, uint8_t delimiter) { generated_stub("string_split 0067f420"); } uint8_t string_to_bool(void *self) { generated_stub("string_to_bool 0067f600"); } void ResolveRelativePath(uint8_t *anmPath, uint8_t *relPath, uint8_t *outPath) { generated_stub("ResolveRelativePath 0067f670"); } @@ -12498,7 +11117,6 @@ void shader_stack_push(int shaderIndex) { generated_stub("shader_stack_push 0068 void FUN_00682350() { generated_stub("FUN_00682350 00682350"); } float normalize_angle_degrees(float angle) { generated_stub("normalize_angle_degrees 00682740"); } float angle_difference(float from, float to) { generated_stub("angle_difference 006827a0"); } -float LerpAngleDeg(float from, float to, float t) { generated_stub("LerpAngleDeg 006828b0"); } void FUN_00682a20() { generated_stub("FUN_00682a20 00682a20"); } float approach_angle(float current, float target, float maxStep) { generated_stub("approach_angle 00682a50"); } void FUN_00683010(int param_1, int param_2, int param_3) { generated_stub("FUN_00683010 00683010"); } @@ -12647,7 +11265,6 @@ void FUN_006a6940() { generated_stub("FUN_006a6940 006a6940"); } std_string * resolve_resource_path(std_string *outPath, std_string *path, void *suffixes) { generated_stub("resolve_resource_path 006a69e0"); } void FUN_006a7ec0() { generated_stub("FUN_006a7ec0 006a7ec0"); } void FUN_006a80d0() { generated_stub("FUN_006a80d0 006a80d0"); } -void FUN_006a8120() { generated_stub("FUN_006a8120 006a8120"); } void FUN_006a8180(uint32_t param_1) { generated_stub("FUN_006a8180 006a8180"); } void FUN_006a8210(int param_1) { generated_stub("FUN_006a8210 006a8210"); } uint32_t FUN_006ae7a0() { generated_stub("FUN_006ae7a0 006ae7a0"); } @@ -12841,7 +11458,6 @@ void FUN_00738150(uint32_t param_1) { generated_stub("FUN_00738150 00738150"); } void FUN_00738160(uint32_t param_1) { generated_stub("FUN_00738160 00738160"); } void FUN_00738190(char param_1) { generated_stub("FUN_00738190 00738190"); } void FUN_00738260() { generated_stub("FUN_00738260 00738260"); } -void FUN_007382c0() { generated_stub("FUN_007382c0 007382c0"); } uint32_t FUN_00738330() { generated_stub("FUN_00738330 00738330"); } Minimap * FUN_00738380() { generated_stub("FUN_00738380 00738380"); } void FUN_00738390(uint32_t param_1) { generated_stub("FUN_00738390 00738390"); } @@ -12943,7 +11559,6 @@ uint32_t FUN_007826c0() { generated_stub("FUN_007826c0 007826c0"); } void FUN_007829a0() { generated_stub("FUN_007829a0 007829a0"); } void FUN_00782ab0(uint32_t param_1) { generated_stub("FUN_00782ab0 00782ab0"); } void FUN_0078b330(uint32_t *param_1) { generated_stub("FUN_0078b330 0078b330"); } -void FUN_0078e130(Vector *param_1) { generated_stub("FUN_0078e130 0078e130"); } int FUN_007919c0() { generated_stub("FUN_007919c0 007919c0"); } Entity_Player * FUN_007a0fe0() { generated_stub("FUN_007a0fe0 007a0fe0"); } Entity_Player * FUN_007a1020() { generated_stub("FUN_007a1020 007a1020"); } @@ -12978,11 +11593,9 @@ uint32_t FUN_007da7a0(uint32_t param_1) { generated_stub("FUN_007da7a0 007da7a0" uint32_t FUN_007dac30() { generated_stub("FUN_007dac30 007dac30"); } void FUN_007dad80() { generated_stub("FUN_007dad80 007dad80"); } int FUN_007dafb0() { generated_stub("FUN_007dafb0 007dafb0"); } -void FUN_007daff0() { generated_stub("FUN_007daff0 007daff0"); } void FUN_007db0a0() { generated_stub("FUN_007db0a0 007db0a0"); } uint32_t FUN_007db2d0() { generated_stub("FUN_007db2d0 007db2d0"); } int FUN_007db360() { generated_stub("FUN_007db360 007db360"); } -int is_achievement_79_unlocked(Entity_Player *player) { generated_stub("is_achievement_79_unlocked 007db860"); } uint32_t FUN_007dbe70(uint32_t *param_1) { generated_stub("FUN_007dbe70 007dbe70"); } uint32_t _Entity_Player::SpawnTrinketRandomPickup() { generated_stub("_Entity_Player::SpawnTrinketRandomPickup 007dc2d0"); } void FUN_007dc610() { generated_stub("FUN_007dc610 007dc610"); } @@ -13009,7 +11622,6 @@ void FUN_007dd1b0(int param_1, int param_2, int param_3) { generated_stub("FUN_0 void FUN_007dd240(int param_1, int param_2) { generated_stub("FUN_007dd240 007dd240"); } void FUN_007dd2d0(void *param_1, int param_2) { generated_stub("FUN_007dd2d0 007dd2d0"); } void FUN_007dd310() { generated_stub("FUN_007dd310 007dd310"); } -int scale_for_hard_difficulty(int value) { generated_stub("scale_for_hard_difficulty 007dd380"); } uint8_t * FUN_007dd3a0() { generated_stub("FUN_007dd3a0 007dd3a0"); } void FUN_007dd3d0(uint32_t param_1) { generated_stub("FUN_007dd3d0 007dd3d0"); } bool FUN_007dd460() { generated_stub("FUN_007dd460 007dd460"); } @@ -13087,11 +11699,9 @@ void FUN_007e93d0(int param_1) { generated_stub("FUN_007e93d0 007e93d0"); } void FUN_007ea0c0() { generated_stub("FUN_007ea0c0 007ea0c0"); } void FUN_007ea5d0() { generated_stub("FUN_007ea5d0 007ea5d0"); } void init_room_render_surfaces() { generated_stub("init_room_render_surfaces 007ea630"); } -void FUN_007eb010() { generated_stub("FUN_007eb010 007eb010"); } void FUN_007ebc40() { generated_stub("FUN_007ebc40 007ebc40"); } uint32_t FUN_007ed240() { generated_stub("FUN_007ed240 007ed240"); } uint8_t entity_type_is_saved(int type, int variant, uint32_t subType, int spawnerType, uint8_t isRoomFlag) { generated_stub("entity_type_is_saved 007eed10"); } -int room_shape_get_door_grid_index(int doorSlot, int width, int height, int shape) { generated_stub("room_shape_get_door_grid_index 007f20e0"); } float get_angel_room_chance() { generated_stub("get_angel_room_chance 007f96f0"); } void FUN_007fa2a0(float *param_1) { generated_stub("FUN_007fa2a0 007fa2a0"); } void FUN_007fa7d0() { generated_stub("FUN_007fa7d0 007fa7d0"); } @@ -13102,12 +11712,10 @@ void pickup_roll_random_variant(void *papersOwner, int shopItemId, int *variant, int _Room::ResolveHeartSubType(uint32_t param_1, int param_2, Entity_Player *param_3) { generated_stub("_Room::ResolveHeartSubType 00816250"); } uint32_t FUN_0081e220() { generated_stub("FUN_0081e220 0081e220"); } void FUN_0081fae0(uint32_t *param_1) { generated_stub("FUN_0081fae0 0081fae0"); } -uint32_t FUN_008206e0() { generated_stub("FUN_008206e0 008206e0"); } uint32_t FUN_008207a0() { generated_stub("FUN_008207a0 008207a0"); } void FUN_00821940() { generated_stub("FUN_00821940 00821940"); } void FUN_00823540() { generated_stub("FUN_00823540 00823540"); } int FUN_00823ec0() { generated_stub("FUN_00823ec0 00823ec0"); } -bool FUN_008242f0() { generated_stub("FUN_008242f0 008242f0"); } uint32_t FUN_00827180(float *param_1) { generated_stub("FUN_00827180 00827180"); } void FUN_00827f30() { generated_stub("FUN_00827f30 00827f30"); } void FUN_00828010(uint32_t *param_1) { generated_stub("FUN_00828010 00828010"); } @@ -13133,14 +11741,7 @@ void FUN_0082e290(int param_1, int param_2, int param_3) { generated_stub("FUN_0 void Catch_All_0082e7ec() { generated_stub("Catch_All_0082e7ec 0082e7ec"); } void FUN_0082ea50(uint32_t param_1, uint32_t *param_2, code *param_3) { generated_stub("FUN_0082ea50 0082ea50"); } void FUN_0082eb20(uint32_t *param_1, code *param_2) { generated_stub("FUN_0082eb20 0082eb20"); } -int FUN_0082eb90() { generated_stub("FUN_0082eb90 0082eb90"); } -void FUN_0082ebb0() { generated_stub("FUN_0082ebb0 0082ebb0"); } -void FUN_0082ed00() { generated_stub("FUN_0082ed00 0082ed00"); } -bool FUN_0082ee30() { generated_stub("FUN_0082ee30 0082ee30"); } void FUN_00831780(int *param_1, uint8_t *param_2, uint8_t *param_3, uint8_t *param_4) { generated_stub("FUN_00831780 00831780"); } -void FUN_00832fd0() { generated_stub("FUN_00832fd0 00832fd0"); } -int FUN_00833010(uint32_t *param_1) { generated_stub("FUN_00833010 00833010"); } -void FUN_00833270() { generated_stub("FUN_00833270 00833270"); } void FUN_008332a0(char param_1) { generated_stub("FUN_008332a0 008332a0"); } uint64_t * FUN_00834c60(uint64_t *param_1, uint64_t *param_2) { generated_stub("FUN_00834c60 00834c60"); } void Catch_All_00834f6f() { generated_stub("Catch_All_00834f6f 00834f6f"); } @@ -13187,10 +11788,7 @@ void FUN_0083bf90(uint32_t *param_1) { generated_stub("FUN_0083bf90 0083bf90"); void Catch_All_0083c241() { generated_stub("Catch_All_0083c241 0083c241"); } uint32_t * FUN_0083c270(uint32_t *param_1, uint32_t *param_2, uint32_t *param_3) { generated_stub("FUN_0083c270 0083c270"); } void FUN_0083c320(int *param_1, int *param_2) { generated_stub("FUN_0083c320 0083c320"); } -void FUN_0083c400() { generated_stub("FUN_0083c400 0083c400"); } void FUN_0083c480() { generated_stub("FUN_0083c480 0083c480"); } -void FUN_0083c4c0() { generated_stub("FUN_0083c4c0 0083c4c0"); } -void ItemInfo::reset() { generated_stub("ItemInfo::reset 0083d6e0"); } uint8_t ItemInfo::is_collectible_seen(int param_1) { generated_stub("ItemInfo::is_collectible_seen 0083d760"); } uint8_t ItemInfo::is_pickup_known(int param_1) { generated_stub("ItemInfo::is_pickup_known 0083d7c0"); } void item_pool_icons_render(void *iconLayer, Vector *position, KColor *color) { generated_stub("item_pool_icons_render 0083d8c0"); } @@ -13212,7 +11810,6 @@ void Catch_All_0084be32() { generated_stub("Catch_All_0084be32 0084be32"); } uint32_t * FUN_0084be60(uint32_t *param_1, uint32_t *param_2, uint32_t *param_3) { generated_stub("FUN_0084be60 0084be60"); } void FUN_0084bef0(uint32_t *param_1, void *param_2) { generated_stub("FUN_0084bef0 0084bef0"); } void FUN_0084bf20() { generated_stub("FUN_0084bf20 0084bf20"); } -uint32_t FUN_0084bf30(Entity_Player *param_1) { generated_stub("FUN_0084bf30 0084bf30"); } uint8_t segment_intersect(float *outX, float *outY, float p1x, float p1y, float p2x, float p2y, float q1x, float q1y, float q2x, float q2y) { generated_stub("segment_intersect 0084d8b0"); } void FUN_0084db90() { generated_stub("FUN_0084db90 0084db90"); } void FUN_00856280(void *param_1) { generated_stub("FUN_00856280 00856280"); } @@ -15582,7 +14179,6 @@ void * FUN_0092ed30(void *param_1, void *param_2, void *param_3) { generated_stu void Catch_All_0092ef49() { generated_stub("Catch_All_0092ef49 0092ef49"); } void FUN_0092ef80() { generated_stub("FUN_0092ef80 0092ef80"); } void FUN_0092ef90(void *param_1) { generated_stub("FUN_0092ef90 0092ef90"); } -uint32_t FUN_009301d0() { generated_stub("FUN_009301d0 009301d0"); } int * FUN_00930a00(int param_1) { generated_stub("FUN_00930a00 00930a00"); } uint32_t FUN_00930b20() { generated_stub("FUN_00930b20 00930b20"); } void FUN_00930ec0() { generated_stub("FUN_00930ec0 00930ec0"); } @@ -15595,9 +14191,6 @@ Vector * backdrop_detail_to_world_pos(Vector *outPosition, Vector *position) { g uint32_t FUN_0093b530() { generated_stub("FUN_0093b530 0093b530"); } void backdrop_wall_normal(Vector *outNormal, int isVertical, uint8_t isNegX, uint8_t isNegY) { generated_stub("backdrop_wall_normal 0093b580"); } void FUN_009426b0(uint32_t param_1, uint32_t param_2) { generated_stub("FUN_009426b0 009426b0"); } -Vector * vector_ring_buffer_weighted_average(Vector *outAverage, void *ring, float peakFraction) { generated_stub("vector_ring_buffer_weighted_average 00943190"); } -void FUN_00943830() { generated_stub("FUN_00943830 00943830"); } -void ring_buffer_push(void *self, Vector *element) { generated_stub("ring_buffer_push 00945130"); } void FUN_00949b70() { generated_stub("FUN_00949b70 00949b70"); } void FUN_00949bc0(uint32_t param_1) { generated_stub("FUN_00949bc0 00949bc0"); } void FUN_0094e3b0() { generated_stub("FUN_0094e3b0 0094e3b0"); } @@ -15682,7 +14275,6 @@ void level_generator_rooms_shuffle(int param_1, int param_2) { generated_stub("l void Catch_All_009b1d88() { generated_stub("Catch_All_009b1d88 009b1d88"); } int FUN_009b1dc0(int param_1, int param_2, int param_3) { generated_stub("FUN_009b1dc0 009b1dc0"); } int FUN_009b5800() { generated_stub("FUN_009b5800 009b5800"); } -void FUN_009b5cb0() { generated_stub("FUN_009b5cb0 009b5cb0"); } void FUN_009b9150() { generated_stub("FUN_009b9150 009b9150"); } uint32_t FUN_009b9450(int param_1) { generated_stub("FUN_009b9450 009b9450"); } void FUN_009b9f60(Entity *param_1) { generated_stub("FUN_009b9f60 009b9f60"); } @@ -15930,7 +14522,6 @@ uint32_t FUN_00a15570() { generated_stub("FUN_00a15570 00a15570"); } int FUN_00a15590() { generated_stub("FUN_00a15590 00a15590"); } float Math::lerp(float a, float b, float t, uint8_t isClamped) { generated_stub("Math::lerp 00a155c0"); } void FUN_00a155f0() { generated_stub("FUN_00a155f0 00a155f0"); } -float assert_lerp_range(float value, float inMin, float inMax, float outMin, float outMax, uint8_t isClamped) { generated_stub("assert_lerp_range 00a15640"); } void FUN_00a156d0() { generated_stub("FUN_00a156d0 00a156d0"); } void FUN_00a156e0(uint8_t param_1) { generated_stub("FUN_00a156e0 00a156e0"); } void FUN_00a15730() { generated_stub("FUN_00a15730 00a15730"); } diff --git a/generated-src/temporary_effect.cpp b/generated-src/temporary_effect.cpp deleted file mode 100644 index 636df9f..0000000 --- a/generated-src/temporary_effect.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "classes.h" - -// 00435f80 -TemporaryEffect::TemporaryEffect(ItemConfig_Item *item) -{ - *GHIDRA_CAST(this) = item; - *GHIDRA_CAST((GHIDRA_CAST(this) + 4)) = 0; - *GHIDRA_CAST((GHIDRA_CAST(this) + 8)) = item->maxCooldown; - *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) = 0; - return this; -} diff --git a/generated-src/temporary_effects.cpp b/generated-src/temporary_effects.cpp deleted file mode 100644 index d7718ad..0000000 --- a/generated-src/temporary_effects.cpp +++ /dev/null @@ -1,509 +0,0 @@ -#include "classes.h" - -// 007537a0 -void * TemporaryEffects::GetEffectsList() -{ - return &this->_effects; -} - -// 00930220 -void TemporaryEffects::AddEffect(void *Effect, uint8_t addcostume, int count) -{ - int *effectIt; - int effectCooldown; - int effectCount; - int effectExtra; - void *effectsBegin; - int *effectsEnd; - void **effectsEndField; - - if ((this->_disabled == 0) && (count != 0)) { - effectsEnd = (this->_effects)._end; - effectIt = (this->_effects)._begin; - if (effectIt != effectsEnd) { - do { - if (*effectIt == *GHIDRA_CAST(Effect)) { - if (effectIt != effectsEnd) { - effectIt[1] = effectIt[1] + count; - effectIt[2] = effectIt[2] + *GHIDRA_CAST((GHIDRA_CAST(Effect) + 8)); - this->_cacheFlags = this->_cacheFlags | *GHIDRA_CAST((*GHIDRA_CAST(Effect) + 0x54)); - this->_shouldEvaluateCache = 1; - return; - } - break; - } - effectIt = effectIt + 4; - } while (effectIt != effectsEnd); - } - if (effectsEnd == (this->_effects)._capacity) { - msvc::vector::_Emplace_reallocate(effectsEnd,Effect); - } - else { - effectCount = *GHIDRA_CAST((GHIDRA_CAST(Effect) + 4)); - effectCooldown = *GHIDRA_CAST((GHIDRA_CAST(Effect) + 8)); - effectExtra = *GHIDRA_CAST((GHIDRA_CAST(Effect) + 0xc)); - *effectsEnd = *GHIDRA_CAST(Effect); - effectsEnd[1] = effectCount; - effectsEnd[2] = effectCooldown; - effectsEnd[3] = effectExtra; - effectsEndField = &(this->_effects)._end; - *effectsEndField = (void *)(GHIDRA_INT(*effectsEndField) + 0x10); - } - effectsBegin = (this->_effects)._begin; - *GHIDRA_CAST((((GHIDRA_INT((this->_effects)._end) - GHIDRA_INT(effectsBegin) & 0xfffffff0U) - 0xc) + - GHIDRA_INT(effectsBegin))) = count; - if ((this->_player != GHIDRA_CAST(0x0)) && (addcostume != 0)) { - (GHIDRA_CAST((this->_player)))->Entity_Player::AddCostume(*GHIDRA_CAST(Effect),0); - } - this->_cacheFlags = this->_cacheFlags | *GHIDRA_CAST((*GHIDRA_CAST(Effect) + 0x54)); - this->_shouldEvaluateCache = 1; - } - return; -} - -// 009302e0 -void TemporaryEffects::AddCollectibleEffect(int coltype, uint8_t addcostume, int count) -{ - ItemConfig_Item *effectItem; - uint32_t local_14; - int effectCooldown; - uint32_t local_c; - - effectItem = ItemConfig::GetCollectible(&g_manager->_itemConfig,coltype); - if (effectItem != GHIDRA_CAST(0x0)) { - effectCooldown = effectItem->maxCooldown; - local_14 = 0; - local_c = 0; - AddEffect(this,&effectItem,addcostume,count); - } - return; -} - -// 00930330 -void TemporaryEffects::AddTrinketEffect(int trinkettype, uint8_t addcostume, int count) -{ - int effect [3]; - uint32_t local_c; - void *trinkets; - - trinkets = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT((trinkettype & 0x7fffU)) < - GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinkets) >> 2) && - (effect[0] = *GHIDRA_CAST((GHIDRA_CAST(trinkets) + (trinkettype & 0x7fffU) * 4)), effect[0] != 0)) { - effect[2] = *GHIDRA_CAST((effect[0] + 0x78)); - effect[1] = 0; - local_c = 0; - AddEffect(this,effect,addcostume,count); - } - return; -} - -// 00930390 -void TemporaryEffects::AddNullEffect(int nulleffectid, uint8_t addcostume, int count) -{ - int effect [3]; - uint32_t local_c; - void *nullItems; - - if (((-1 < nulleffectid) && - (nullItems = (g_manager->_itemConfig)._nullItems._begin, - nulleffectid < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItems) >> 2)) && - (effect[0] = *GHIDRA_CAST((GHIDRA_CAST(nullItems) + nulleffectid * 4)), effect[0] != 0)) { - effect[2] = *GHIDRA_CAST((effect[0] + 0x78)); - effect[1] = 0; - local_c = 0; - AddEffect(this,effect,addcostume,count); - } - return; -} - -// 009303f0 -void TemporaryEffects::RemoveEffect(void *effect, int count) -{ - void **ppvVar1; - ItemConfig_Item *item; - int *entry; - uint32_t removedCount; - int *effectsEnd; - uint32_t entryCount; - - if (this->_disabled == 0) { - effectsEnd = (this->_effects)._end; - entry = (this->_effects)._begin; - if (entry != effectsEnd) { - while (*entry != *GHIDRA_CAST(effect)) { - entry = entry + 4; - if (entry == effectsEnd) { - return; - } - } - if (entry != effectsEnd) { - entryCount = entry[1]; - item = GHIDRA_CAST(*entry); - removedCount = entryCount; - if (GHIDRA_UINT(count) < entryCount) { - removedCount = count; - } - entry[1] = entryCount - removedCount; - if (GHIDRA_INT((entryCount - removedCount)) < 1) { - memmove(entry,entry + 4,GHIDRA_INT((this->_effects)._end) - GHIDRA_INT((entry + 4))); - ppvVar1 = &(this->_effects)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + -0x10); - } - if (this->_player == GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((g_game->_room)))->Room::TriggerEffectRemoved(item,0); - } - else { - Entity_Player::trigger_collectible_effect_removed(this->_player,item,removedCount); - } - this->_cacheFlags = this->_cacheFlags | *GHIDRA_CAST((*GHIDRA_CAST(effect) + 0x54)); - this->_shouldEvaluateCache = 1; - } - } - } - return; -} - -// 009304a0 -void TemporaryEffects::RemoveCollectibleEffect(int coltype, int count) -{ - ItemConfig_Item *effectItem; - uint32_t local_10; - int effectCooldown; - uint32_t local_8; - - effectItem = ItemConfig::GetCollectible(&g_manager->_itemConfig,coltype); - if (effectItem != GHIDRA_CAST(0x0)) { - effectCooldown = effectItem->maxCooldown; - local_10 = 0; - local_8 = 0; - RemoveEffect(this,&effectItem,count); - } - return; -} - -// 009304f0 -void TemporaryEffects::RemoveTrinketEffect(int trinkettype, int count) -{ - int effectKey [3]; - uint32_t local_8; - void *trinkets; - - trinkets = (g_manager->_itemConfig)._trinkets._begin; - if ((GHIDRA_INT((trinkettype & 0x7fffU)) < - GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinkets) >> 2) && - (effectKey[0] = *GHIDRA_CAST((GHIDRA_CAST(trinkets) + (trinkettype & 0x7fffU) * 4)), effectKey[0] != 0)) { - effectKey[2] = *GHIDRA_CAST((effectKey[0] + 0x78)); - effectKey[1] = 0; - local_8 = 0; - RemoveEffect(this,effectKey,count); - } - return; -} - -// 00930550 -void TemporaryEffects::RemoveNullEffect(int nulleffectid, int count) -{ - int effect [3]; - uint32_t local_c; - void *nullItems; - - if (((-1 < nulleffectid) && - (nullItems = (g_manager->_itemConfig)._nullItems._begin, - nulleffectid < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(nullItems) >> 2)) && - (effect[0] = *GHIDRA_CAST((GHIDRA_CAST(nullItems) + nulleffectid * 4)), effect[0] != 0)) { - effect[2] = *GHIDRA_CAST((effect[0] + 0x78)); - effect[1] = 0; - local_c = 0; - RemoveEffect(this,effect,count); - } - return; -} - -// 009305c0 -uint8_t TemporaryEffects::has_item_effect(TemporaryEffects *effects, ItemConfig_Item *item) -{ - int *effect; - - if (effects->_disabled == 0) { - for (effect = (effects->_effects)._begin; effect != (effects->_effects)._end; - effect = effect + 4) { - if (GHIDRA_CAST(*effect) == item) { - return 1; - } - } - } - return 0; -} - -// 009305f0 -uint8_t TemporaryEffects::HasCollectibleEffect(int coltype) -{ - int *effect; - int effectType; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - effectType = *GHIDRA_CAST(*effect); - if ((((effectType == 1) || (effectType == 3)) || (effectType == 4)) && - ((GHIDRA_CAST(*effect))[1] == coltype)) { - return 1; - } - } - } - return 0; -} - -// 00930640 -uint8_t TemporaryEffects::HasTrinketEffect(int trinkettype) -{ - int *effect; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 2) && ((GHIDRA_CAST(*effect))[1] == trinkettype)) { - return 1; - } - } - } - return 0; -} - -// 00930680 -uint8_t TemporaryEffects::HasNullEffect(int nulleffectid) -{ - int *effect; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 0) && ((GHIDRA_CAST(*effect))[1] == nulleffectid)) { - return 1; - } - } - } - return 0; -} - -// 009306c0 -void TemporaryEffects::ClearEffects(uint8_t isClearPersistent) -{ - void **ppvVar1; - ItemConfig_Item *item; - void *pvVar2; - uint32_t effectCount; - int iVar3; - int effectOffset; - uint32_t i; - void *effectsBegin; - bool isAnyRemoved; - - if (this->_disabled == 0) { - pvVar2 = (this->_effects)._end; - do { - effectsBegin = (this->_effects)._begin; - isAnyRemoved = false; - effectCount = GHIDRA_INT(pvVar2) - GHIDRA_INT(effectsBegin) >> 4; - i = effectCount - 1; - if (effectCount <= i) { - return; - } - effectOffset = i * 0x10; - do { - item = *GHIDRA_CAST((effectOffset + GHIDRA_INT(effectsBegin))); - if ((isClearPersistent != 0) || (item->persistentEffect == 0)) { - iVar3 = item->type; - if ((((iVar3 == 1) || ((iVar3 == 3 || (iVar3 == 4)))) && (item->id == 0x75)) && - (pvVar2 = this->_player, *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x20a9)) == '\0')) { - iVar3 = 0; - if (0 < *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1340))) { - iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1344)); - } - if (*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1d88)) + *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x134c)) + iVar3 <= - GHIDRA_INT(((*GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x13c0)) == 5) + 1))) goto LAB_009307de; - } - this->_cacheFlags = this->_cacheFlags | item->cacheFlags; - iVar3 = (GHIDRA_CAST((effectOffset + GHIDRA_INT(effectsBegin))))[1]; - pvVar2 = (void *)(GHIDRA_INT(effectsBegin) + effectOffset + 0x10); - memmove((void *)(GHIDRA_INT(effectsBegin) + effectOffset),pvVar2, - GHIDRA_INT((this->_effects)._end) - GHIDRA_INT(pvVar2)); - ppvVar1 = &(this->_effects)._end; - *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + -0x10); - if (this->_player == GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((g_game->_room)))->Room::TriggerEffectRemoved(item,0); - } - else { - Entity_Player::trigger_collectible_effect_removed(this->_player,item,iVar3); - } - this->_shouldEvaluateCache = 1; - isAnyRemoved = true; - } -LAB_009307de: - pvVar2 = (this->_effects)._end; - effectOffset = effectOffset + -0x10; - effectsBegin = (this->_effects)._begin; - i = i - 1; - } while (i < GHIDRA_UINT((GHIDRA_INT(pvVar2) - GHIDRA_INT(effectsBegin) >> 4))); - } while (isAnyRemoved); - } - return; -} - -// 00930820 -void TemporaryEffects::Update() -{ - uint32_t effectCount; - int iVar1; - int *piVar2; - void *_Dst; - void *pvVar3; - int effectOffset; - ItemConfig_Item *local_14; - uint32_t effectIndex; - TemporaryEffects *local_c; - void **effectsEnd; - Manager *manager; - - if (this->_disabled == 0) { - this->_cacheFlags = 0; - pvVar3 = (this->_effects)._begin; - effectCount = GHIDRA_INT((this->_effects)._end) - GHIDRA_INT(pvVar3) >> 4; - effectIndex = effectCount - 1; - if (effectIndex < effectCount) { - effectOffset = effectIndex * 0x10; - local_c = this; - do { - iVar1 = *GHIDRA_CAST((effectOffset + 8 + GHIDRA_INT(pvVar3))); - if ((0 < iVar1) && - (iVar1 = iVar1 + -1, *GHIDRA_CAST((effectOffset + 8 + GHIDRA_INT(pvVar3))) = iVar1, - manager = g_manager, iVar1 == 0)) { - piVar2 = *GHIDRA_CAST((effectOffset + GHIDRA_INT(pvVar3))); - if (piVar2 != GHIDRA_CAST(0x0)) { - iVar1 = *piVar2; - if (((iVar1 == 1) || (iVar1 == 3)) || (iVar1 == 4)) { - if ((piVar2[1] == 0x3a) && (*GHIDRA_CAST((effectOffset + 0xc + GHIDRA_INT(pvVar3))) == 0)) { - local_14 = GHIDRA_CAST(0x403); - seed_fart_sound_override(GHIDRA_CAST(&local_14)); - (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_14),1.0,2,0,1.0,0.0); - piVar2 = *GHIDRA_CAST((effectOffset + GHIDRA_INT(pvVar3))); - this = local_c; - } - } - else { - } - } - this->_cacheFlags = this->_cacheFlags | piVar2[0x15]; - local_14 = *GHIDRA_CAST((effectOffset + GHIDRA_INT(pvVar3))); - _Dst = (void *)(GHIDRA_INT((this->_effects)._begin) + effectOffset); - iVar1 = *GHIDRA_CAST((effectOffset + 4 + GHIDRA_INT(pvVar3))); - pvVar3 = (void *)(GHIDRA_INT(_Dst) + 0x10); - memmove(_Dst,pvVar3,GHIDRA_INT((this->_effects)._end) - GHIDRA_INT(pvVar3)); - effectsEnd = &(this->_effects)._end; - *effectsEnd = (void *)(GHIDRA_INT(*effectsEnd) + -0x10); - if (this->_player == GHIDRA_CAST(0x0)) { - (GHIDRA_CAST((g_game->_room)))->Room::TriggerEffectRemoved(local_14,0); - } - else { - Entity_Player::trigger_collectible_effect_removed(this->_player,local_14,iVar1); - } - this->_shouldEvaluateCache = 1; - } - effectIndex = effectIndex - 1; - pvVar3 = (this->_effects)._begin; - effectOffset = effectOffset + -0x10; - } while (effectIndex < GHIDRA_UINT((GHIDRA_INT((this->_effects)._end) - GHIDRA_INT(pvVar3) >> 4))); - } - } - return; -} - -// 00930980 -void * TemporaryEffects::GetCollectibleEffect(int coltype) -{ - int *effect; - int effectType; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - effectType = *GHIDRA_CAST(*effect); - if ((((effectType == 1) || (effectType == 3)) || (effectType == 4)) && - ((GHIDRA_CAST(*effect))[1] == coltype)) { - return effect; - } - } - } - return (void *)0x0; -} - -// 009309c0 -void * TemporaryEffects::GetTrinketEffect(int trinkettype) -{ - int *effect; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 2) && ((GHIDRA_CAST(*effect))[1] == trinkettype)) { - return effect; - } - } - } - return (void *)0x0; -} - -// 00930a30 -void * TemporaryEffects::GetNullEffect(int nulleffectid) -{ - int *effect; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 0) && ((GHIDRA_CAST(*effect))[1] == nulleffectid)) { - return effect; - } - } - } - return (void *)0x0; -} - -// 00930a70 -int TemporaryEffects::GetCollectibleEffectNum(int coltype) -{ - void *effect; - - if (this->_disabled == 0) { - effect = GetCollectibleEffect(this,coltype); - if (effect != (void *)0x0) { - return *GHIDRA_CAST((GHIDRA_CAST(effect) + 4)); - } - } - return 0; -} - -// 00930aa0 -int TemporaryEffects::GetTrinketEffectNum(int trinkettype) -{ - int *effect; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 2) && ((GHIDRA_CAST(*effect))[1] == trinkettype)) { - return effect[1]; - } - } - } - return 0; -} - -// 00930ae0 -int TemporaryEffects::GetNullEffectNum(int nulleffectid) -{ - int *effect; - - if (this->_disabled == 0) { - for (effect = (this->_effects)._begin; effect != (this->_effects)._end; effect = effect + 4) { - if ((*GHIDRA_CAST(*effect) == 0) && ((GHIDRA_CAST(*effect))[1] == nulleffectid)) { - return effect[1]; - } - } - } - return 0; -} diff --git a/generated-src/weapon.cpp b/generated-src/weapon.cpp index 2a103f8..5b29acd 100644 --- a/generated-src/weapon.cpp +++ b/generated-src/weapon.cpp @@ -93,9 +93,9 @@ uint8_t Weapon::IsAxisAligned() (player = *GHIDRA_CAST(&player->_isControlsEnabled), player != GHIDRA_CAST(0x0)))) ) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x28)))) == g_vectorZero.x)))) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) == g_vectorZero.y)) { - isHasItem = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x1d1,0); + isHasItem = Entity_Player::HasCollectible(player,0x1d1,0); if (isHasItem == 0) { - isHasItem = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18a,0); + isHasItem = Entity_Player::HasCollectible(player,0x18a,0); if (isHasItem == 0) { return 1; } @@ -118,7 +118,7 @@ Vector * Weapon::get_aim_direction(Vector *outDir, Vector *defaultDir) ((this_00->_type == 3 && (this_00 = *GHIDRA_CAST(&this_00->_isControlsEnabled), this_00 != GHIDRA_CAST(0x0)) ))))) && ((this->_modifiers & 0x40000000U) == 0)) { - isHasMarked = (GHIDRA_CAST((this_00)))->Entity_Player::HasCollectible(0x18a,0); + isHasMarked = Entity_Player::HasCollectible(this_00,0x18a,0); if ((((isHasMarked == 0) || (this_00->_markedTarget == (void *)0x0)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x28)))) == g_vectorZero.x)) && (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x2c)))) == g_vectorZero.y)) { @@ -257,8 +257,8 @@ LAB_009f3b99: } return; } - (GHIDRA_CAST((player2)))->Entity_Player::HasCollectible(0x18a,0); - bVar5 = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::HasCollectible(0x98,0); + Entity_Player::HasCollectible(player2,0x18a,0); + bVar5 = Entity_Player::HasCollectible(ownerPlayer,0x98,0); if ((bVar5 == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x30)))) == 0xf)) goto LAB_009f3b99; local_64 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_54)) + 0x0)))); aimDirY = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_54)) + 0x4)))); @@ -333,7 +333,7 @@ LAB_009f3b99: } local_64->_damageMultiplier = 0.13; (*GHIDRA_CAST((GHIDRA_CAST((local_64)) + 0x517))) = 1; - local_64->Update(); + (**(code **)(*GHIDRA_CAST(local_64) + 0xc))(); aimDirY = local_50.y; local_64 = GHIDRA_CAST(local_50.x); player = player2; @@ -343,7 +343,7 @@ LAB_009f39d5: } else if (isInterpolated == 0) { fVar12 = atan2f(aimDirY,(float)local_64); - (GHIDRA_CAST((local_5c)))->Entity_NPC::SetAimAngle(fVar12 * 57.295776); + Entity_NPC::SetAimAngle(local_5c,fVar12 * 57.295776); GetOwnerLaserOffset(this,&scratchVec,1,&local_50); player = player2; (local_5c->_posOffset).y = scratchVec.y; @@ -361,9 +361,9 @@ LAB_009f39d5: *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((local_5c->_pathfinder))) + 0x18)))) = notExplosiveLoHi & uVar9; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((local_5c->_pathfinder))) + 0x1c)))) = notExplosiveHiLo & GHIDRA_UINT(qVar3); (local_5c->_pathfinder)._gridIndex = notExplosiveHiHi & uVar2; - laserColorPtr = (GHIDRA_CAST((player2)))->Entity_Player::get_laser_color_copy(&laserColor); + laserColorPtr = Entity_Player::get_laser_color_copy(player2,&laserColor); pEVar10 = local_5c; - local_5c->SetColor(laserColorPtr,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(local_5c) + 0x3c))(laserColorPtr,0xffffffff,0xff,0,1); if ((aimDirY <= -0.5) || ((float)local_64 <= -0.5)) { pEVar10->_renderDepthOffset = -10.0; } @@ -375,10 +375,10 @@ LAB_009f39d5: cVar6 = FUN_0097e7c0(); iVar8 = extraout_ECX; if (cVar6 == '\0') goto LAB_009f3b6a; - bVar5 = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::HasCollectible(0x37,0); + bVar5 = Entity_Player::HasCollectible(ownerPlayer,0x37,0); if (bVar5 == 0) { LAB_009f3a27: - bVar5 = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::HasCollectible(0x57,0); + bVar5 = Entity_Player::HasCollectible(ownerPlayer,0x57,0); iVar8 = extraout_ECX_00; if (bVar5 == 0) goto LAB_009f3b6a; iVar8 = 0x50 - GHIDRA_INT(((float)local_3c * 5.0)); @@ -403,20 +403,20 @@ LAB_009f3a27: local_3c = GHIDRA_CAST(scratchVec.x); pVVar7 = get_owner_position(this,&local_50); laser = fire_laser(this,pVVar7,5,&scratchVec,0,1,0.13); - laser->Update(); - bVar5 = (GHIDRA_CAST((ownerPlayer)))->Entity_Player::HasCollectible(0x57,0); + (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); + bVar5 = Entity_Player::HasCollectible(ownerPlayer,0x57,0); iVar8 = extraout_ECX_02; if (bVar5 != 0) { scratchVec.x = aimDirY; scratchVec.y = (float)local_3c; pVVar7 = get_owner_position(this,&local_50); laser = fire_laser(this,pVVar7,5,&scratchVec,0,1,0.13); - laser->Update(); + (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); scratchVec.x = (float)local_40; scratchVec.y = (float)local_64; pVVar7 = get_owner_position(this,&local_50); laser = fire_laser(this,pVVar7,5,&scratchVec,0,1,0.13); - laser->Update(); + (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); iVar8 = extraout_ECX_03; } LAB_009f3b6a: @@ -462,7 +462,7 @@ float Weapon::get_damage() if (this_00->_playerType != 0xd) { damage = damage * 0.5; } - isHasBffs = (GHIDRA_CAST((this_00)))->Entity_Player::HasCollectible(0xf7,0); + isHasBffs = Entity_Player::HasCollectible(this_00,0xf7,0); if (isHasBffs == 0) { return damage; } @@ -514,7 +514,7 @@ LAB_009f3d36: *GHIDRA_CAST(&outFlags->_h) = GHIDRA_INT(highFlags); *GHIDRA_CAST((GHIDRA_INT(&outFlags->_h) + 4)) = highFlagsHigh; if (familiarOwner != GHIDRA_CAST(0x0)) { - isBabyBender = (GHIDRA_CAST((this_00)))->Entity_Player::HasTrinket(0x7f,0); + isBabyBender = Entity_Player::HasTrinket(this_00,0x7f,0); if (isBabyBender != 0) { *GHIDRA_CAST(&outFlags->_l) = GHIDRA_UINT(outFlags->_l) | GHIDRA_UINT(g_tearFlagHoming._l); flagsDword = GHIDRA_CAST((GHIDRA_INT(&outFlags->_l) + 4)); @@ -599,7 +599,7 @@ LAB_009f3de7: outColor->_colorize[3] = colorizeA; } if (pEVar2 != GHIDRA_CAST(0x0)) { - bVar1 = (GHIDRA_CAST((this_00)))->Entity_Player::HasTrinket(0x7f,0); + bVar1 = Entity_Player::HasTrinket(this_00,0x7f,0); if (bVar1 == 0) { if ((char)pEVar2->_chargeBarSprites[5]._shadowLayerIndex != '\0') { outColor->_colorize[0] = 2.4; @@ -716,7 +716,7 @@ LAB_009f3f9a: outColor->_colorize[3] = fVar8; } if (GHIDRA_CAST(ownerFamiliar) != GHIDRA_CAST(0x0)) { - bVar9 = (GHIDRA_CAST((this_00)))->Entity_Player::HasTrinket(0x7f,0); + bVar9 = Entity_Player::HasTrinket(this_00,0x7f,0); if (bVar9 == 0) { if ((char)(GHIDRA_CAST(ownerFamiliar))->_chargeBarSprites[5]._shadowLayerIndex != '\0') { @@ -1193,7 +1193,7 @@ Vector * Weapon::get_tear_movement_inheritance(Vector *outResult, Vector *direct } if (pEVar1->_type == 3) { pEVar1 = *GHIDRA_CAST(&pEVar1->_isControlsEnabled); - isHasMarked = (GHIDRA_CAST((pEVar1)))->Entity_Player::HasCollectible(0x18a,0); + isHasMarked = Entity_Player::HasCollectible(pEVar1,0x18a,0); if ((isHasMarked == 0) || (pEVar1->_markedTarget == (void *)0x0)) { familiarPlayer = *GHIDRA_CAST((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))) + 0x410)); inheritX = *GHIDRA_CAST((familiarPlayer + 0x360)) * 0.6; @@ -1291,7 +1291,7 @@ LAB_009f5b91: randomValue = Random(); shooter = (Entity_Tear *) Game::SpawnEx(g_game,2,0,position,velocity,*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x4)))),0,randomValue,0); - shooter->SetCollisionDamage(damageMultiplier * shooter->_collisionDamage); + (**(code **)(*GHIDRA_CAST(shooter) + 0x40))(damageMultiplier * shooter->_collisionDamage); local_14 = *GHIDRA_CAST((iStack_18 + 4)); if (shooter->_parent != 0) { local_10 = &shooter->_parent; @@ -1301,11 +1301,11 @@ LAB_009f5b91: if (local_14 != GHIDRA_CAST(0x0)) { msvc::multiset::insert(&shooter->_parent); } - shooter->Update(); + (**(code **)(*GHIDRA_CAST(shooter) + 0xc))(); LAB_009f5c1f: shooter = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_14)) + 0x4)))); if ((shooter != GHIDRA_CAST(0x0)) && (shooter->_type == 1)) { - seededVariant = (GHIDRA_CAST((shooter)))->Entity_Player::get_seeded_variant(); + seededVariant = Entity_Player::get_seeded_variant(shooter); if (seededVariant == 2) { local_c = (shooter->_velocity).x; local_10 = GHIDRA_CAST((shooter->_velocity).y); @@ -1363,7 +1363,7 @@ Entity_Bomb * Weapon::fire_bomb(Weapon *weapon, Vector *position, Vector *veloci if (source->_type != 3) goto LAB_009f5eb6; player = *GHIDRA_CAST(&source->_isControlsEnabled); } - pEVar3 = (GHIDRA_CAST((player)))->Entity_Player::FireBomb(position,velocity,GHIDRA_CAST(source)); + pEVar3 = Entity_Player::FireBomb(player,position,velocity,GHIDRA_CAST(source)); manager = g_manager; if (pEVar3 != GHIDRA_CAST(0x0)) { if ((pEVar3->_variant == 0x13) || (pEVar3->_variant == 0x14)) { @@ -1406,7 +1406,7 @@ LAB_009f5eb6: if (iVar2 != 0) { msvc::multiset::insert(parentSlot); } - pEVar3->Update(); + (**(code **)(*GHIDRA_CAST(pEVar3) + 0xc))(); return pEVar3; } @@ -1550,7 +1550,7 @@ Entity_Laser * Weapon::fire_laser(Vector *position, uint32_t offsetId, Vector *d uVar5 = Random(); Entity_Player::GetTearHitParams (local_e4,&TStack_a8,3,savedDamageScale,(uVar5 & 1) * 2 + -1,pEVar3); - pEVar4->SetCollisionDamage(TStack_a8._tearDamage); + (**(code **)(*GHIDRA_CAST(pEVar4) + 0x40))(TStack_a8._tearDamage); pEVar4->_mass = fStack_54 * pEVar4->_mass; } } @@ -1691,7 +1691,7 @@ Entity_Knife * Weapon::FireSword(Entity *param_2, uint32_t param_3, float param_ randomValue = Random(); Entity_Player::GetTearHitParams (parentRef,&hitParams,0xd,1.0,(randomValue & 1) * 2 + -1,GHIDRA_CAST(source)); - knife->SetColor(&hitParams._tearColor,0xffffffff,0xff,0,1); + (**(code **)(*GHIDRA_CAST(knife) + 0x3c))(&hitParams._tearColor,0xffffffff,0xff,0,1); owner = *GHIDRA_CAST(knife); *GHIDRA_CAST(&(knife->_tearFlags)._l) = hitParams._tearColor._colorize[3]; *GHIDRA_CAST((GHIDRA_INT(&(knife->_tearFlags)._l) + 4)) = hitParams._tearColor._offset[0]; @@ -1901,7 +1901,7 @@ LAB_009f8615: } trigger_set_dispatch ((void *)(GHIDRA_INT(player) + 0x1fc8),1,GHIDRA_CAST(0x0),&triggerPos,GHIDRA_CAST(local_238)); - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xd9,0); + isHasCollectible = Entity_Player::HasCollectible(player,0xd9,0); if (isHasCollectible != 0) { FUN_009f3c10(); fVar6 = fVar6 + fVar6; @@ -1912,7 +1912,7 @@ LAB_009f8615: if (((local_2ac == (EntityPtr)0x0) || (uVar3 = Random(), uVar3 % GHIDRA_UINT(local_2ac) == 0)) && ((local_2ac = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1370)), GHIDRA_UINT(local_2ac) <= GHIDRA_CAST(&DAT_00000004) || - (((isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xf8,0), + (((isHasCollectible = Entity_Player::HasCollectible(player,0xf8,0), isHasCollectible != 0 || (isHasCollectible = TemporaryEffects::HasCollectibleEffect @@ -1933,7 +1933,7 @@ LAB_009f8615: spawn_blue_spider(&spiderPos,GHIDRA_CAST(player),&g_vectorZero); } } - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x23d,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x23d,0); if (isHasCollectible != 0) { uVar3 = Random(); if ((uVar3 & 3) == 0) { @@ -2007,7 +2007,7 @@ LAB_009f7c88: (*GHIDRA_CAST((GHIDRA_CAST(&(flags_02._h)) + 0x0))) = uStack_208; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_02._h)) + 0x4))) = uStack_204; local_2a0 = tear; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_02); + Entity_Tear::SetTearFlags(tear,flags_02); (*GHIDRA_CAST((GHIDRA_CAST(&(local_1c0)) + 0x28))) = (tear->_sprite)._color._offset[2]; tearTint._colorize[0] = 0.0; tearTint._colorize[1] = 0.0; @@ -2042,12 +2042,12 @@ LAB_009f7c88: heartOffset0 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_1c0)) + 0x20))); heartOffset1 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_1c0)) + 0x24))); fVar6 = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_1c0)) + 0x20))); - tear->SetColor(); + (**(code **)(*GHIDRA_CAST(tear) + 0x3c))(); player = GHIDRA_CAST(VStack_290.y); } } if ((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x2ef8)) == 0) || (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x2ef8)) != 0x9d)) { - iVar9 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x9d); + iVar9 = Entity_Player::GetTrinketMultiplier(player,0x9d); bVar5 = false; bVar4 = iVar9 == 0; LAB_009f7fe7: @@ -2055,7 +2055,7 @@ LAB_009f7fe7: } else { if (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x2ef0)) == '\0') { - iVar1 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x9d); + iVar1 = Entity_Player::GetTrinketMultiplier(player,0x9d); bVar5 = SBORROW4(iVar1,1); iVar9 = iVar1 + -1; bVar4 = iVar1 == 1; @@ -2063,7 +2063,7 @@ LAB_009f7fe7: } LAB_009f7ff2: local_2a8.y = 2.10195e-44; - iVar9 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x9d); + iVar9 = Entity_Player::GetTrinketMultiplier(player,0x9d); if (iVar9 == 2) { local_2a8.y = 1.4013e-44; } @@ -2072,7 +2072,7 @@ LAB_009f7ff2: } if (*GHIDRA_CAST(((uint32_t)weapon + 1)) % GHIDRA_UINT(local_2a8.y) == 0) { Entity_Player::GetTearHitParams(); - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x95,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x95,0); if (isHasCollectible == 0) { fStack_10c = fStack_10c + 40.0; fStack_108 = fStack_108 + 0.3; @@ -2123,27 +2123,27 @@ LAB_009f7ff2: Game::SpawnEx(g_game,2,tornCardVariant,GHIDRA_CAST((auStack_248 + 4)),&local_2a8, GHIDRA_CAST(player),0,uVar3,0); tear->_height = tornCardHeight; - fVar6 = (GHIDRA_CAST((tear)))->Entity_Tear::get_height_offset_y(tornCardHeight); + fVar6 = Entity_Tear::get_height_offset_y(tear,tornCardHeight); game = g_game; (tear->_posOffset).y = fVar6; if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && (fVar6 = tear->_height, (tear->_posOffset).y = -18.0, -5.1 < fVar6)) { tear->_height = -5.1; } - tear->SetCollisionDamage(); + (**(code **)(*GHIDRA_CAST(tear) + 0x40))(); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = uStack_11c; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = uStack_120; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uStack_118; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_114; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); + Entity_Tear::SetTearFlags(tear,flags); fVar6 = fStack_10c; if (fStack_10c <= 0.01) { fVar6 = 0.01; } tear->_baseScale = fVar6; tear->_fScale = fVar6; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - tear->SetColor(tornCardColor,0xffffffff,0xff,0,1); + Entity_Tear::ResetSpriteScale(tear); + (**(code **)(*GHIDRA_CAST(tear) + 0x3c))(tornCardColor,0xffffffff,0xff,0,1); if (tear->_parent != (EntityPtr)0x0) { msvc::multiset::erase(auStackY_374 + 0x9c); } @@ -2159,7 +2159,7 @@ LAB_009f7ff2: fVar6 = 0.01; } tear->_fallingSpeed = ((-5.0 - tear->_height) - (50.0 - fVar6) * 9.0) / fVar6; - tear->Update(); + (**(code **)(*GHIDRA_CAST(tear) + 0xc))(); fVar6 = (tear->_pos).x - (tear->_velocity).x; fVar8 = (tear->_velocity).y; (tear->_pos).x = fVar6; @@ -2185,11 +2185,11 @@ LAB_009f7ff2: (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_248)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(owner) + 0x33c)); (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_248)) + 0x4))) = *GHIDRA_CAST((GHIDRA_CAST(owner) + 0x340)); } - (GHIDRA_CAST((player)))->Entity_Player::AddBlueFlies(1,GHIDRA_CAST(auStack_248),GHIDRA_CAST(0x0)); + Entity_Player::AddBlueFlies(player,1,GHIDRA_CAST(auStack_248),GHIDRA_CAST(0x0)); } } - isBirdsEye = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x268,0); - isGhostPepper = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x1ef,0); + isBirdsEye = Entity_Player::HasCollectible(player,0x268,0); + isGhostPepper = Entity_Player::HasCollectible(player,0x1ef,0); if ((isBirdsEye == 0) || (isGhostPepper == 0)) { local_2a8.x = 2.8026e-45; if (isBirdsEye == 0) { @@ -2222,7 +2222,7 @@ LAB_009f84ed: if (isBirdsEye == 0) { if (isGhostPepper != 0) { LAB_009f858f: - local_2ac = (EntityPtr)(GHIDRA_CAST((player)))->Entity_Player::ShootBlueCandle(GHIDRA_CAST(auStack_240)); + local_2ac = (EntityPtr)Entity_Player::ShootBlueCandle(player,GHIDRA_CAST(auStack_240)); if (1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) { Random(); Entity_Player::GetTearHitParams(); @@ -2239,10 +2239,10 @@ LAB_009f858f: uVar3 = Random(); if ((uVar3 & 1) != 0) goto LAB_009f858f; } - (GHIDRA_CAST((player)))->Entity_Player::ShootRedCandle(GHIDRA_CAST(auStack_240)); + Entity_Player::ShootRedCandle(player,GHIDRA_CAST(auStack_240)); *GHIDRA_CAST((weapon + 1)) = *GHIDRA_CAST((weapon + 1)) + 1; LAB_009f8620: - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x1c2,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x1c2,0); if (isHasCollectible != 0) { if (*GHIDRA_CAST((weapon + 1)) % 0x14 == 0) { Entity_Player::GetTearHitParams(); @@ -2291,7 +2291,7 @@ LAB_009f8620: Game::SpawnEx(g_game,2,0x14,GHIDRA_CAST((auStack_240 + 4)),&VStack_290, GHIDRA_CAST(player),0,uVar3,0); tear->_height = hitParamsHeight; - fVar6 = (GHIDRA_CAST((tear)))->Entity_Tear::get_height_offset_y(hitParamsHeight); + fVar6 = Entity_Tear::get_height_offset_y(tear,hitParamsHeight); game = g_game; (tear->_posOffset).y = fVar6; if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && @@ -2299,7 +2299,7 @@ LAB_009f8620: tear->_height = -5.1; } if (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x1368)) < 1) { - tear->SetCollisionDamage(); + (**(code **)(*GHIDRA_CAST(tear) + 0x40))(); greedFlags0 = hitParamsFlags0 | GHIDRA_UINT(g_tearFlagMidas._l); uVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMidas._l)) + 0x4))) | hitParamsFlags1; greedFlags2 = hitParamsFlags2 | GHIDRA_UINT(g_tearFlagMidas._h); @@ -2310,8 +2310,8 @@ LAB_009f8620: uStack_1fc = uVar2; } else { - (GHIDRA_CAST((player)))->Entity_Player::AddCoins(-1); - tear->SetCollisionDamage(); + Entity_Player::AddCoins(player,-1); + (**(code **)(*GHIDRA_CAST(tear) + 0x40))(); greedFlags0 = hitParamsFlags0 | GHIDRA_UINT(g_tearFlagMidas._l) | GHIDRA_UINT(g_tearFlagCoinDrop._l); uVar3 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMidas._l)) + 0x4))) | hitParamsFlags1 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCoinDrop._l)) + 0x4))); greedFlags2 = hitParamsFlags2 | GHIDRA_UINT(g_tearFlagMidas._h) | GHIDRA_UINT(g_tearFlagCoinDrop._h); @@ -2325,7 +2325,7 @@ LAB_009f8620: (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x0))) = greedFlags0; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x0))) = greedFlags2; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = uVar2; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_00); + Entity_Tear::SetTearFlags(tear,flags_00); if (tear->_parent != (EntityPtr)0x0) { msvc::multiset::erase(auStackY_374 + 0xb0); } @@ -2339,7 +2339,7 @@ LAB_009f8620: ((float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 0.2 - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1478))) - 7.0; tear->_fallingAccel = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x147c)) * 0.01; - tear->Update(); + (**(code **)(*GHIDRA_CAST(tear) + 0xc))(); manager = g_manager; fVar6 = (tear->_pos).x - (tear->_velocity).x; fVar8 = (tear->_velocity).y; @@ -2352,7 +2352,7 @@ LAB_009f8620: weapon = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_288))) + 0x0))); } } - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x1bc,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x1bc,0); if ((isHasCollectible != 0) && (*GHIDRA_CAST((weapon + 1)) % 0xf == 0)) { local_2ac = (EntityPtr)0xc; do { @@ -2400,19 +2400,19 @@ LAB_009f8620: Game::SpawnEx(g_game,2,hitParamsVariant,pencilSpawnPos,GHIDRA_CAST((local_238 + 4)), GHIDRA_CAST(player),0,uVar3,0); tear->_height = hitParamsHeight; - fVar6 = (GHIDRA_CAST((tear)))->Entity_Tear::get_height_offset_y(hitParamsHeight); + fVar6 = Entity_Tear::get_height_offset_y(tear,hitParamsHeight); game = g_game; (tear->_posOffset).y = fVar6; if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && (fVar6 = tear->_height, (tear->_posOffset).y = -18.0, -5.1 < fVar6)) { tear->_height = -5.1; } - tear->SetCollisionDamage(); + (**(code **)(*GHIDRA_CAST(tear) + 0x40))(); (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x4))) = hitParamsFlags1; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x0))) = hitParamsFlags0; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x0))) = hitParamsFlags2; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x4))) = hitParamsFlags3; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_01); + Entity_Tear::SetTearFlags(tear,flags_01); uVar3 = Random(); uVar2 = Random(); fVar6 = (((float)(uVar3 & 1) + 0.0) * 0.4 + 0.9 + @@ -2423,8 +2423,8 @@ LAB_009f8620: } tear->_baseScale = fVar6; tear->_fScale = fVar6; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); - tear->SetColor(hitParamsColor,0xffffffff,0xff,0,1); + Entity_Tear::ResetSpriteScale(tear); + (**(code **)(*GHIDRA_CAST(tear) + 0x3c))(hitParamsColor,0xffffffff,0xff,0,1); if (tear->_parent != (EntityPtr)0x0) { msvc::multiset::erase(auStackY_374 + 0xa8); } @@ -2439,7 +2439,7 @@ LAB_009f8620: (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 0.2 - *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1478)); tear->_fallingAccel = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x147c)); - tear->Update(); + (**(code **)(*GHIDRA_CAST(tear) + 0xc))(); game = g_game; fVar6 = (tear->_pos).x - (tear->_velocity).x; fVar8 = (tear->_velocity).y; @@ -2455,9 +2455,9 @@ LAB_009f8620: (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._h)) + 0x0))) = pvpFlags2; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_03._h)) + 0x4))) = pvpFlags3; pvpFlags0 = fVar6; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_03); + Entity_Tear::SetTearFlags(tear,flags_03); } - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x95,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x95,0); if (isHasCollectible == 0) { tear->_fallingAccel = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x147c)) + 0.5; uVar3 = Random(); diff --git a/generated-src/weapon_bombs.cpp b/generated-src/weapon_bombs.cpp index c609980..a2f062b 100644 --- a/generated-src/weapon_bombs.cpp +++ b/generated-src/weapon_bombs.cpp @@ -30,11 +30,11 @@ uint32_t Weapon_Bombs::GetMarkedTargetVariant() } player = GHIDRA_CAST(0x0); LAB_009fa1e0: - isHasItem = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18a,0); + isHasItem = Entity_Player::HasCollectible(player,0x18a,0); if (isHasItem == 0) { return 0; } - isHasItem = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x23c,0); + isHasItem = Entity_Player::HasCollectible(player,0x23c,0); targetVariant = 0x1e; if (isHasItem != 0) { targetVariant = 0x99; diff --git a/generated-src/weapon_bone.cpp b/generated-src/weapon_bone.cpp index 6287295..39263d2 100644 --- a/generated-src/weapon_bone.cpp +++ b/generated-src/weapon_bone.cpp @@ -315,15 +315,15 @@ LAB_009ff273: modifierBits = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x34)); modifiers = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x34)); if ((((iVar1 == 0xb) || (player == GHIDRA_CAST(0x0))) || - (isDrFetusOnly = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x34,0), isDrFetusOnly == 0)) || - (isDrFetusOnly = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xa8,0), isDrFetusOnly != 0)) { + (isDrFetusOnly = Entity_Player::HasCollectible(player,0x34,0), isDrFetusOnly == 0)) || + (isDrFetusOnly = Entity_Player::HasCollectible(player,0xa8,0), isDrFetusOnly != 0)) { isDrFetusOnly = false; if ((iVar1 != 0xb) && (player != GHIDRA_CAST(0x0))) goto LAB_009ff2f1; } else { isDrFetusOnly = true; LAB_009ff2f1: - isDrFetusOnly = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xa8,0); + isDrFetusOnly = Entity_Player::HasCollectible(player,0xa8,0); if (isDrFetusOnly != 0) { bVar2 = true; goto LAB_009ff309; diff --git a/generated-src/weapon_brimstone.cpp b/generated-src/weapon_brimstone.cpp index e2918d2..3833448 100644 --- a/generated-src/weapon_brimstone.cpp +++ b/generated-src/weapon_brimstone.cpp @@ -69,7 +69,7 @@ void Weapon_Brimstone::fire_c_section_fetuses() tearVelocity.x = (jitterX * 3.0 + dirX) * shotSpeed; tearVelocity.y = (jitterY * 3.0 + dirY) * shotSpeed; tear = fire_fetus_tear(weapon,&laserPos,&tearVelocity,0,source,1.0,unused); - tear->Update(); + (**(code **)(*GHIDRA_CAST(tear) + 0xc))(); } rngResult = rngResult + 1; } while (rngResult < GHIDRA_UINT(lasers._size)); @@ -200,11 +200,11 @@ uint32_t Weapon_Brimstone::GetMarkedTargetVariant() } owner = GHIDRA_CAST(0x0); LAB_00a02830: - isHasItem = (GHIDRA_CAST((owner)))->Entity_Player::HasCollectible(0x23c,0); + isHasItem = Entity_Player::HasCollectible(owner,0x23c,0); if (isHasItem != 0) { return 0x99; } - isHasItem = (GHIDRA_CAST((owner)))->Entity_Player::HasCollectible(0x18a,0); + isHasItem = Entity_Player::HasCollectible(owner,0x18a,0); if (isHasItem == 0) { return 0; } @@ -309,7 +309,7 @@ LAB_00a02934: multiShotParams[0],fStack_6c,fStack_68,fStack_64,local_60,iStack_5c,fStack_58, auStack_54[0],(*GHIDRA_CAST((GHIDRA_CAST(&(auStack_54)) + 0x4)))); pEVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Weapon::fire_brimstone_with_color(&local_78,damageMultiplier,0); - pEVar4->Update(); + (**(code **)(*GHIDRA_CAST(pEVar4) + 0xc))(); if (local_8c == GHIDRA_CAST(0x0)) { local_8c = pEVar4; if (GHIDRA_CAST(this->_mainLaser) != pEVar4) { @@ -563,7 +563,7 @@ LAB_00a02bed: local_78.x = *GHIDRA_CAST((GHIDRA_CAST(local_80.x) + 0x78)); local_80.y = 0.0; local_78.y = 0.0; - (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_8c) + 0x1508)))))->TemporaryEffects::RemoveEffect(&local_80,-1); + TemporaryEffects::RemoveEffect(GHIDRA_CAST((GHIDRA_INT(local_8c) + 0x1508)),&local_80,-1); return; } } diff --git a/generated-src/weapon_knife.cpp b/generated-src/weapon_knife.cpp index 1ae355c..45521ab 100644 --- a/generated-src/weapon_knife.cpp +++ b/generated-src/weapon_knife.cpp @@ -104,7 +104,7 @@ LAB_00a05166: } tearFlagsWord1 = this_00->_entityGridCollisionClass; if ((((tearFlagsWord1 == 0) || (tearFlagsWord1 == 3)) || (tearFlagsWord1 == 1)) || (tearFlagsWord1 == 2)) { - (GHIDRA_CAST((this_00)))->Entity_Player::GetFlyingOffset(flyingOffset); + Entity_Player::GetFlyingOffset(this_00,flyingOffset); knifeOffsetX = *extraout_EAX / 0.65 + knifeOffsetX; knifeOffsetY = extraout_EAX[1] / 0.65 + knifeOffsetY; } diff --git a/generated-src/weapon_monstros_lung.cpp b/generated-src/weapon_monstros_lung.cpp index a25fc5a..b8384d0 100644 --- a/generated-src/weapon_monstros_lung.cpp +++ b/generated-src/weapon_monstros_lung.cpp @@ -88,7 +88,7 @@ LAB_00a08a1b: (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = uStack_18; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_14; uStack_1c = in_stack_ffffff94; - (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); + Entity_Tear::SetTearFlags(tear,flags); } if (player != GHIDRA_CAST(0x0)) { if (0.0 < player->_tearfallaccel) { @@ -100,10 +100,10 @@ LAB_00a08a1b: else { tear->_fallingAccel = player->_tearfallaccel + 0.5; in_stack_ffffff94 = 0xa08af7; - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x95,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x95,0); if (isHasCollectible == 0) { in_stack_ffffff94 = 0xa08b09; - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x213,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x213,0); if (isHasCollectible != 0) goto LAB_00a08b44; rngResult = Random(); fVar2 = 5.0; @@ -133,11 +133,11 @@ LAB_00a08b44: } tear->_baseScale = in_XMM0_Da; tear->_fScale = in_XMM0_Da; - (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); + Entity_Tear::ResetSpriteScale(tear); } else { in_stack_ffffff94 = 0xa088a7; - isHasCollectible = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x34,0); + isHasCollectible = Entity_Player::HasCollectible(player,0x34,0); if (isHasCollectible == 0) goto LAB_00a08a1b; rngResult = Random(); local_30.y = (float)((double)GHIDRA_INT(rngResult) + @@ -208,11 +208,11 @@ uint32_t Weapon_MonstrosLung::GetMarkedTargetVariant() } player = GHIDRA_CAST(0x0); LAB_00a08cf6: - isHasItem = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18a,0); + isHasItem = Entity_Player::HasCollectible(player,0x18a,0); if (isHasItem == 0) { return 0; } - isHasItem = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x23c,0); + isHasItem = Entity_Player::HasCollectible(player,0x23c,0); targetVariant = 0x1e; if (isHasItem != 0) { targetVariant = 0x99; diff --git a/generated-src/weapon_rockets.cpp b/generated-src/weapon_rockets.cpp index 20fcec6..822cbb8 100644 --- a/generated-src/weapon_rockets.cpp +++ b/generated-src/weapon_rockets.cpp @@ -17,6 +17,6 @@ uint32_t Weapon_Rockets::GetMarkedTargetVariant() } player = GHIDRA_CAST(0x0); LAB_00a099be: - isHasMarked = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x18a,0); + isHasMarked = Entity_Player::HasCollectible(player,0x18a,0); return -GHIDRA_UINT((isHasMarked != 0)) & 0x1e; } diff --git a/scripts/source_tree.py b/scripts/source_tree.py index 2c272d1..4490230 100644 --- a/scripts/source_tree.py +++ b/scripts/source_tree.py @@ -368,7 +368,7 @@ stubs, dataStubs = [], [] # (owner, declaration, address): everything src/ has def class_emit(cls, stack=()): if cls in done or cls in stack or cls in PRELUDE_TYPES: return if cls in curatedClasses or cls.rpartition('::')[0] in curatedClasses: return # declared by src/ (a nested class with its outer one), only forward-declared here - parent = base.get(cls) if base.get(cls) in names and base.get(cls) not in curatedClasses else None # a src/ parent stays bytes + parent = base.get(cls) if base.get(cls) in names and base.get(cls) not in curatedClasses and (base.get(cls) or '').rpartition('::')[0] not in curatedClasses else None # a src/ parent (or one nested in a src/ class) stays bytes if parent: class_emit(parent, stack + (cls,)) namespace, _, shortName = cls.rpartition('::') isNested = namespace in names # Cutscene::ANM2Part: declared inside Cutscene, defined after it diff --git a/src/anm2.cpp b/src/anm2.cpp index bd8aa4a..94218af 100644 --- a/src/anm2.cpp +++ b/src/anm2.cpp @@ -5,6 +5,7 @@ #include "manager.h" #include "log.h" #include "render_passes.h" +#include "room.h" #include "texture_cache.h" #include #include @@ -108,7 +109,7 @@ static bool is_screen_shake_applied() } // A colour a fraction t of the way to another, every channel, as Color::Lerp does. -static ColorMod color_lerp(const ColorMod& from, const ColorMod& to, float t) +ColorMod color_lerp(const ColorMod& from, const ColorMod& to, float t) { float rest = 1 - t; ColorMod color; @@ -143,8 +144,8 @@ static float angle_wrap(float angle) return angle; } -// An angle a fraction t of the way to another, the short way round. -static float angle_lerp(float from, float to, float t) +// 006828b0 An angle in degrees a fraction t of the way to another, the short way round. +float angle_lerp(float from, float to, float t) { from = angle_wrap(from); to = angle_wrap(to); @@ -1175,7 +1176,7 @@ static ColorMod layer_color_get(const AnimationFrame& frame, const LayerState& l if (is_reflection_pass()) { color._tint[3] *= HALF; - if (g_game) color._tint[3] *= g_game->room->_waterAmount; + if (g_game) color._tint[3] *= g_game->room->waterAmount; } return color; } diff --git a/src/anm2.h b/src/anm2.h index d425bec..67ad657 100644 --- a/src/anm2.h +++ b/src/anm2.h @@ -367,3 +367,6 @@ struct AnmCache static void Clear(); static void LogMemoryUsage(); }; + +float angle_lerp(float from, float to, float t); +ColorMod color_lerp(const ColorMod& from, const ColorMod& to, float t); diff --git a/src/backdrop.cpp b/src/backdrop.cpp index 3674e11..207a133 100644 --- a/src/backdrop.cpp +++ b/src/backdrop.cpp @@ -3,6 +3,7 @@ #include "game.h" #include "log.h" #include "platform.h" +#include "room.h" #include "room_config.h" #include @@ -157,15 +158,15 @@ void Backdrop::Init(uint32_t id, bool isLoadGraphics) backdropId = (int)id < 0 || (int)id >= BACKDROP_COUNT ? 1 : id; roomTopLeft = vector_make(ROOM_OFFSET, ROOM_OFFSET); - roomBottomRight = vector_make((float)((int)room._gridWidth - WALL_CELLS) * GRID_SIZE + ROOM_OFFSET, - (float)((int)room._gridHeight - WALL_CELLS) * GRID_SIZE + ROOM_OFFSET); + roomBottomRight = vector_make((float)((int)room.gridWidth - WALL_CELLS) * GRID_SIZE + ROOM_OFFSET, + (float)((int)room.gridHeight - WALL_CELLS) * GRID_SIZE + ROOM_OFFSET); if (isLoadGraphics) load_details(); } // 00935270 A floor variant for the room: one of the backdrop's floors at random, with exceptions by backdrop and room. uint32_t Backdrop::get_random_floor_variant() { - RoomDescriptor* descriptor = g_game->room->_descriptor; + RoomDescriptor* descriptor = g_game->room->descriptor; uint32_t floors = (uint32_t)configs[backdropId].floors; RNG levelRng = {}; levelRng.SetSeed(seed, RNG_SHIFT_LEVEL_FLOOR); @@ -173,14 +174,14 @@ uint32_t Backdrop::get_random_floor_variant() switch (backdropId) { case BACKDROP_DROSS: - if (descriptor->Flags & ROOM_FLAG_ALT_FLOOR) return rng.RandomInt(floors - 1); + if (descriptor->flags & ROOM_FLAG_ALT_FLOOR) return rng.RandomInt(floors - 1); break; case BACKDROP_ASHPIT: case BACKDROP_ASHPIT_SHAFT: - return descriptor->Flags & ROOM_FLAG_ALT_FLOOR ? FLOOR_SECOND : levelRng.RandomInt(floors); + return descriptor->flags & ROOM_FLAG_ALT_FLOOR ? FLOOR_SECOND : levelRng.RandomInt(floors); case BACKDROP_MAUSOLEUM: case BACKDROP_MAUSOLEUM2: - if (descriptor && descriptor->Data && descriptor->Data->shape != ROOMSHAPE_1x1) + if (descriptor && descriptor->data && descriptor->data->shape != ROOMSHAPE_1x1) return rng.RandomInt(floors - 1); break; case BACKDROP_GEHENNA: diff --git a/src/boss_pool.cpp b/src/boss_pool.cpp new file mode 100644 index 0000000..8c3ac97 --- /dev/null +++ b/src/boss_pool.cpp @@ -0,0 +1,416 @@ +#include "boss_pool.h" +#include "data.h" +#include "game.h" +#include "log.h" +#include "manager.h" +#include "platform.h" +#include +#include + +constexpr const char* BOSS_POOLS_XML = "bosspools.xml"; + +// The xorshift triples by shift index: the one stepping init's seed into each pool, and the pools' own. +constexpr uint32_t POOL_SEEDER_SHIFT = 26; +constexpr uint32_t POOL_RNG_SHIFT = 17; + +constexpr int BOSS_PICK_ATTEMPTS = 10; +constexpr int BOSS_REPICKS = 9; +constexpr uint32_t HORSEMAN_ODDS = 10; +constexpr uint32_t HEADLESS_HORSEMAN_ODDS = 10; +constexpr uint32_t FALLEN_ODDS = 10; +constexpr uint32_t DOUBLE_TROUBLE_ODDS_ULTRA_HARD = 1; +constexpr uint32_t DOUBLE_TROUBLE_ODDS_CHAPTER_2 = 50; +constexpr uint32_t DOUBLE_TROUBLE_ODDS_CHAPTER_3 = 25; +constexpr uint32_t DOUBLE_TROUBLE_ODDS_CHAPTER_4 = 40; + +constexpr int BOSS_MONSTRO = 1; +constexpr int BOSS_MOM = 6; +constexpr int BOSS_MOMS_HEART = 8; +constexpr int BOSS_DEATH = 12; +constexpr int BOSS_HEADLESS_HORSEMAN = 22; +constexpr int BOSS_THE_FALLEN = 23; +constexpr int BOSS_SATAN = 24; +constexpr int BOSS_IT_LIVES = 25; +constexpr int BOSS_THE_BLOAT = 30; +constexpr int BOSS_CONQUEST = 38; +constexpr int BOSS_ISAAC = 39; +constexpr int BOSS_BLUE_BABY = 40; +constexpr int BOSS_THE_LAMB = 54; +constexpr int BOSS_DELIRIUM = 70; +constexpr int BOSS_REAP_CREEP = 74; +constexpr int BOSS_MOTHER = 88; +constexpr int BOSS_MOM_MAUSOLEUM = 89; + +// The Horsemen of the first floor of chapters 1 to 4, by chapter. +constexpr std::array HORSEMEN = {9, 10, 11, BOSS_DEATH}; + +// The bosses the dark bosses special daily fixes on stages 1 to 7 (none on stage 6). +constexpr int SPECIAL_DAILY_DARK_BOSSES = 13; +constexpr std::array SPECIAL_DAILY_BOSSES = {0, 60, 43, 50, 23, 51, 0, 15}; + +constexpr int ACHIEVEMENT_HARBINGERS = 5; +constexpr int ACHIEVEMENT_IT_LIVES = 34; +constexpr int ACHIEVEMENT_FORGOTTEN_HORSEMAN = 66; + +constexpr int STAGE_CHAPTER_1 = 1; +constexpr int STAGE_CHAPTER_2 = 3; +constexpr int STAGE_CHAPTER_2_END = 4; +constexpr int STAGE_CHAPTER_3 = 5; +constexpr int STAGE_MOM = 6; +constexpr int STAGE_CHAPTER_4 = 7; +constexpr int STAGE_MOMS_HEART = 8; +constexpr int STAGE_SHEOL = 10; +constexpr int STAGE_DARK_ROOM = 11; +constexpr int STAGE_VOID = 12; + +constexpr int CHALLENGE_APRILS_FOOL = 32; +constexpr int CHALLENGE_ULTRA_HARD = 34; +constexpr int CHALLENGE_SCAT_MAN = 36; + +// A pool element's name and the stage id (StbType) whose pool it fills. +struct BossPoolStage +{ + std::string_view name; + int stageId = 0; +}; + +constexpr std::array BOSS_POOL_STAGES = {{{"basement", 1}, + {"cellar", 2}, + {"burning basement", 3}, + {"caves", 4}, + {"catacombs", 5}, + {"flooded caves", 6}, + {"depths", 7}, + {"necropolis", 8}, + {"dank depths", 9}, + {"womb", 10}, + {"utero", 11}, + {"scarred womb", 12}, + {"blue womb", 13}, + {"sheol", 14}, + {"cathedral", 15}, + {"dark room", 16}, + {"chest", 17}, + {"void", 26}, + {"downpour", 27}, + {"dross", 28}, + {"mines", 29}, + {"ashpit", 30}, + {"mausoleum", 31}, + {"gehenna", 32}, + {"corpse", 33}, + {"mortis", 34}}}; + +// Calls visit with each attribute of an element, in document order. +template static void attrs_walk(DataNode node, Visit visit) +{ + simdjson::dom::object attrs; + if (node["attrs"].get(attrs) != simdjson::SUCCESS) return; + + for (auto [name, value] : attrs) visit(name, value.get_string().value_unsafe()); +} + +// Whether a boss id is one the pools track, as only those have a bit in the removed and blacklisted sets. +static bool is_boss_tracked(int bossId) +{ + return bossId >= 0 && bossId < BOSS_ID_COUNT; +} + +// Adds a boss to a set of bosses. The original sets the bit of an untracked id past the set, here it is dropped. +static void boss_mark(std::bitset& bosses, int bossId) +{ + if (is_boss_tracked(bossId)) bosses.set(bossId); +} + +// Whether a boss may show up in this run: Reap Creep sits out Scat Man, and a boss needs its achievement. +static bool is_boss_allowed(BossPool_Entry& entry) +{ + if (entry.id == BOSS_REAP_CREEP && g_game->challenge == CHALLENGE_SCAT_MAN) return false; + return entry.achievementID < 0 || g_manager->persistentGameData.Unlocked(entry.achievementID); +} + +// The boss a chapter's end always has, or 0. The alternate path has its own Mom and Mother. +static int chapter_end_boss(int levelStage, int stageType) +{ + bool isAltPath = stageType == STAGETYPE_REPENTANCE || stageType == STAGETYPE_REPENTANCE_B; + bool isWotl = stageType == STAGETYPE_WOTL; + + switch (levelStage) + { + case STAGE_MOM: + return isAltPath ? BOSS_MOM_MAUSOLEUM : BOSS_MOM; + case STAGE_MOMS_HEART: + if (isAltPath) return BOSS_MOTHER; + return g_manager->persistentGameData.Unlocked(ACHIEVEMENT_IT_LIVES) ? BOSS_IT_LIVES : BOSS_MOMS_HEART; + case STAGE_SHEOL: + if (isAltPath) return BOSS_BLUE_BABY; + return isWotl ? BOSS_ISAAC : BOSS_SATAN; + case STAGE_DARK_ROOM: + if (isAltPath) return BOSS_BLUE_BABY; + return isWotl ? BOSS_BLUE_BABY : BOSS_THE_LAMB; + case STAGE_VOID: + return BOSS_DELIRIUM; + default: + return 0; + } +} + +// How rarely a stage's floor has its Double Trouble room, or 0 when it never does. Ultra Hard always does. +static uint32_t double_trouble_odds(int levelStage) +{ + if (g_game->challenge == CHALLENGE_ULTRA_HARD) return DOUBLE_TROUBLE_ODDS_ULTRA_HARD; + if (levelStage == STAGE_CHAPTER_2 || levelStage == STAGE_CHAPTER_2_END) return DOUBLE_TROUBLE_ODDS_CHAPTER_2; + if (levelStage == STAGE_CHAPTER_3) return DOUBLE_TROUBLE_ODDS_CHAPTER_3; + if (levelStage == STAGE_CHAPTER_4) return DOUBLE_TROUBLE_ODDS_CHAPTER_4; + return 0; +} + +// 004218e0 Starts the run's pools: seeds each pool's generator from seed, forgets every boss met, reads +// bosspools.xml (and the mods', which are ignored) and shuffles each pool. +// The original stops in the debugger on a zero seed. Here it only logs and leaves the pools as they are. +void BossPool::init(uint32_t seed) +{ + RNG seeder{}; + + if (seed == 0) + { + log_printf(LOG_ASSERT, "RNG Seed is zero!\n"); + return; + } + seeder.SetSeed(seed, POOL_SEEDER_SHIFT); + for (BossPool_Pool& pool : pools) pool.rng.SetSeed(seeder.Next(), POOL_RNG_SHIFT); + removedBosses.reset(); + levelBlacklist.reset(); + + load_xml(BOSS_POOLS_XML, BOSS_POOL_GAME); + g_manager->modManager.LoadModBossPools(); + + for (BossPool_Pool& pool : pools) + { + std::mt19937 twister(pool.rng._seed); + for (size_t count = pool.entries.size(); count > 1; count--) + std::swap(pool.entries[count - 1], pool.entries[twister() % count]); + } +} + +// 00421bf0 Reads a bosspools.xml: each named after a stage is emptied and refilled with its children's bosses +// (id, weight, alternate room range), its Double Trouble range kept. A mod's file is ignored, as in the original. +// A boss without a weight takes the one before it, from 0. The original reads that from memory it never wrote, and an +// out of bounds id's achievement past the boss table. Here that id has none. +void BossPool::load_xml(std::string_view path, BossPoolSource source) +{ + Data data; + float weight = 0; + + if (source == BOSS_POOL_MOD) return; + data_load(data, path); + if (!data.isLoaded || node_tag(data.root) != "bosspools") return; + std::vector& bosses = g_manager->entityConfig.bosses; + + for (DataNode poolNode : node_children(data.root)) + { + std::string name; + int doubleTrouble = 0; + + attrs_walk(poolNode, [&](std::string_view attr, std::string_view value) { + if (attr == "name") name = value; + else if (attr == "doubletrouble") doubleTrouble = std::atoi(std::string(value).c_str()); + }); + auto stage = std::ranges::find(BOSS_POOL_STAGES, std::string_view(name), &BossPoolStage::name); + if (stage == BOSS_POOL_STAGES.end()) + { + log_printf(LOG_WARN, "Boss pool: Unknown stage '%s'\n", name.c_str()); + continue; + } + + BossPool_Pool& pool = pools[stage->stageId]; + pool.name = name; + pool.doubleTroubleRoomVariantStart = doubleTrouble; + pool.entries.clear(); + pool.totalWeight = 0; + + for (DataNode bossNode : node_children(poolNode)) + { + BossPool_Entry entry; + + attrs_walk(bossNode, [&](std::string_view attr, std::string_view value) { + std::string text(value); + if (attr == "id") entry.id = std::atoi(text.c_str()); + else if (attr == "weight") weight = (float)std::atof(text.c_str()); + else if (attr == "room") entry.roomVariantStart = std::atoi(text.c_str()); + }); + bool isKnownBoss = entry.id >= 0 && entry.id < (int)bosses.size(); + if (!isKnownBoss) log_printf(LOG_ASSERT, "BossID out of bounds\n"); + + entry.initialWeight = weight; + entry.weight = weight; + entry.achievementID = isKnownBoss ? bosses[entry.id].achievement : -1; + pool.entries.push_back(entry); + pool.totalWeight += weight; + } + } +} + +// 00422830 The boss of a stage's boss room: a challenge's, the special daily's or a chapter end's fixed boss, one of +// the Horsemen (on one in ten first floors of chapters 1 to 4 once unlocked), the pool's Double Trouble room (as minus +// its first room variant), The Fallen after a devil room, else a pick from the stage's pool, which ten failed picks +// leave on Monstro. Each roll comes from the pool's own generator. +// The original's RNG argument is never read, so it is left out. +int BossPool::GetBossId(int levelStage, int stageType) +{ + Game& game = *g_game; + PersistentGameData& data = g_manager->persistentGameData; + BossPool_Pool& pool = pools[RoomConfig::GetStageID(levelStage, stageType, ROOM_MODE_CURRENT)]; + bool isAltPath = stageType == STAGETYPE_REPENTANCE || stageType == STAGETYPE_REPENTANCE_B; + + if (game.challenge == CHALLENGE_APRILS_FOOL) return BOSS_THE_BLOAT; + bool isDailyStage = levelStage >= 0 && levelStage < (int)SPECIAL_DAILY_BOSSES.size(); + if (game.dailyChallenge._specialDailyId == SPECIAL_DAILY_DARK_BOSSES && isDailyStage && + SPECIAL_DAILY_BOSSES[levelStage] != 0) + return SPECIAL_DAILY_BOSSES[levelStage]; + if (int boss = chapter_end_boss(levelStage, stageType)) return boss; + + uint32_t conquestRoll = pool.rng.Next(); + uint32_t horsemanRoll = pool.rng.Next(); + uint32_t headlessRoll = pool.rng.Next(); + uint32_t doubleTroubleRoll = pool.rng.Next(); + uint32_t fallenRoll = pool.rng.Next(); + pool.rng.Next(); + pool.rng.Next(); + RNG pickRng = pool.rng; + bool isConquest = (conquestRoll & 1) == 0 && data.Unlocked(ACHIEVEMENT_FORGOTTEN_HORSEMAN); + + bool isHorsemanStage = levelStage == STAGE_CHAPTER_1 || levelStage == STAGE_CHAPTER_2 || + levelStage == STAGE_CHAPTER_3 || levelStage == STAGE_CHAPTER_4; + if (horsemanRoll % HORSEMAN_ODDS == 0 && data.Unlocked(ACHIEVEMENT_HARBINGERS) && isHorsemanStage && !isAltPath) + { + if (headlessRoll % HEADLESS_HORSEMAN_ODDS == 0 && !WasBossRemoved(BOSS_HEADLESS_HORSEMAN)) + { + boss_mark(levelBlacklist, BOSS_HEADLESS_HORSEMAN); + return BOSS_HEADLESS_HORSEMAN; + } + + int horseman = HORSEMEN[levelStage / 2]; + if (!WasBossRemoved(horseman)) + { + boss_mark(levelBlacklist, horseman); + if (horseman != BOSS_DEATH || !isConquest) return horseman; + boss_mark(levelBlacklist, BOSS_CONQUEST); + return BOSS_CONQUEST; + } + } + + uint32_t doubleTroubleOdds = double_trouble_odds(levelStage); + if (pool.doubleTroubleRoomVariantStart != 0 && doubleTroubleOdds != 0 && doubleTroubleRoll % doubleTroubleOdds == 0) + return -pool.doubleTroubleRoomVariantStart; + + if (fallenRoll % FALLEN_ODDS == 0 && !isAltPath && game.GetStateFlag(GAME_STATE_DEVILROOM_VISITED) && + !WasBossRemoved(BOSS_THE_FALLEN)) + { + boss_mark(levelBlacklist, BOSS_THE_FALLEN); + return BOSS_THE_FALLEN; + } + + for (int attempt = 0; attempt < BOSS_PICK_ATTEMPTS; attempt++) + { + BossPool_Entry* entry = PickBoss(pool, pickRng.RandomFloat() * pool.totalWeight); + if (!entry) + { + for (BossPool_Entry& met : pool.entries) + if (is_boss_tracked(met.id)) + { + removedBosses.reset(met.id); + levelBlacklist.reset(met.id); + } + continue; + } + + if (!is_boss_allowed(*entry)) continue; + return entry->roomVariantStart != 0 ? -entry->roomVariantStart : entry->id; + } + log_printf(LOG_WARN, "Failed to pick a boss room variant, defaulting to Monstro\n"); + return BOSS_MONSTRO; +} + +// The first boss after a pool's entry, around the pool, that can still be picked, or null. +static BossPool_Entry* boss_after_find(BossPool& bossPool, BossPool_Pool& pool, BossPool_Entry& entry) +{ + size_t index = &entry - pool.entries.data(); + + log_printf(LOG_WARN, "boss pool ran out of repicks\n"); + for (size_t i = (index + 1) % pool.entries.size(); i != index; i = (i + 1) % pool.entries.size()) + { + BossPool_Entry& other = pool.entries[i]; + if (other.weight > 0 && is_boss_allowed(other) && !bossPool.WasBossRemoved(other.id)) return &other; + } + return nullptr; +} + +// 00422620 A boss of the pool by weight, roll at most the pool's total: the entry roll lands in, when it can still +// win (weighted, allowed, not met this run or floor). Else roll moves through that entry's share, up to nine times, +// then the next boss around the pool that can be picked does. The pick joins the floor's blacklist. Null for an empty +// or weightless pool, or when nothing can be picked. +BossPool_Entry* BossPool::PickBoss(BossPool_Pool& pool, float roll) +{ + BossPool_Entry* picked = nullptr; + + if (pool.entries.empty() || !(pool.totalWeight > 0)) return nullptr; + for (int repicks = BOSS_REPICKS; repicks >= 0 && !picked; repicks--) + { + float end = 0; + for (BossPool_Entry& entry : pool.entries) + { + float start = end; + end += entry.initialWeight; + if (!(roll < end)) continue; + + bool isWinning = entry.weight > 0 && entry.weight + start > roll; + if (isWinning && is_boss_allowed(entry) && !WasBossRemoved(entry.id)) picked = &entry; + else if (repicks == 0) picked = boss_after_find(*this, pool, entry); + else roll = (end - roll) / entry.initialWeight * pool.totalWeight; + break; + } + } + + if (!picked) + { + log_printf(LOG_WARN, "failed to pick random boss from pool\n"); + return nullptr; + } + boss_mark(levelBlacklist, picked->id); + return picked; +} + +// 00421720 Whether a boss was met on an earlier floor or picked for this one. An untracked id never was. +bool BossPool::WasBossRemoved(int bossId) +{ + return is_boss_tracked(bossId) && (removedBosses[bossId] || levelBlacklist[bossId]); +} + +// 007382c0 Forgets the bosses picked for the floor, as a floor's generation starts over. +void BossPool::blacklist_clear() +{ + levelBlacklist.reset(); +} + +// 00421b50 Counts the floor's picked bosses as met for the rest of the run. +void BossPool::blacklist_commit() +{ + removedBosses |= levelBlacklist; + levelBlacklist.reset(); +} + +// 00422f80 Saves each pool's generator seed and the bosses met. +void BossPool::store_game_state(BossPoolState& state) +{ + for (int i = 0; i < BOSS_POOL_COUNT; i++) state.rngSeeds[i] = pools[i].rng._seed; + state.removedBosses = removedBosses; +} + +// 00422ea0 Restores each pool's generator and the bosses met, with nothing picked for the floor. +void BossPool::restore_game_state(const BossPoolState& state) +{ + for (int i = 0; i < BOSS_POOL_COUNT; i++) pools[i].rng.SetSeed(state.rngSeeds[i], POOL_RNG_SHIFT); + removedBosses = state.removedBosses; + levelBlacklist.reset(); +} diff --git a/src/boss_pool.h b/src/boss_pool.h new file mode 100644 index 0000000..b1b581a --- /dev/null +++ b/src/boss_pool.h @@ -0,0 +1,69 @@ +#pragma once + +#include "classes.h" +#include +#include +#include +#include +#include +#include + +constexpr int BOSS_POOL_COUNT = 37; +constexpr int BOSS_ID_COUNT = 104; + +// Whose bosspools.xml load_xml reads: the game's, or a mod's, which the original ignores. +enum BossPoolSource +{ + BOSS_POOL_GAME, + BOSS_POOL_MOD +}; + +// A boss a pool can pick: its id, its weight (the one picks walk) beside the weight that lets it win, the achievement +// that unlocks it, and the first of the 50 boss room variants it takes, or 0 for its own rooms. +struct BossPool_Entry +{ + float initialWeight = 0; + float weight = 0; + int achievementID = 0; + int id = 0; + int roomVariantStart = 0; +}; + +// A stage's bosses from bosspools.xml (BossPool_Pool), shuffled once a run: their weights together, the pool's +// generator, and the first boss room variant of its Double Trouble rooms (0 without any). +struct BossPool_Pool +{ + std::string name; + std::vector entries; + RNG rng{}; + float totalWeight = 0; + int doubleTroubleRoomVariantStart = 0; +}; + +// What a saved run keeps of the boss pools: each pool's generator seed and the bosses met on earlier floors. +struct BossPoolState +{ + std::array rngSeeds{}; + std::bitset removedBosses; +}; + +// The run's boss pools (Game::bossPool), one per stage id: the bosses met on earlier floors, and those this floor's +// generation picked (its blacklist), which a finished floor adds to them. +// Its construction and destruction were inlined into Game's. +class BossPool +{ +public: + std::array pools; + std::bitset levelBlacklist; + std::bitset removedBosses; + + void init(uint32_t seed); + void load_xml(std::string_view path, BossPoolSource source); + int GetBossId(int levelStage, int stageType); + BossPool_Entry* PickBoss(BossPool_Pool& pool, float roll); + bool WasBossRemoved(int bossId); + void blacklist_clear(); + void blacklist_commit(); + void store_game_state(BossPoolState& state); + void restore_game_state(const BossPoolState& state); +}; diff --git a/src/camera.cpp b/src/camera.cpp new file mode 100644 index 0000000..8d828a9 --- /dev/null +++ b/src/camera.cpp @@ -0,0 +1,516 @@ +#include "camera.h" +#include "entity_knife.h" +#include "entity_list.h" +#include "entity_player.h" +#include "game.h" +#include "log.h" +#include "manager.h" +#include "room.h" +#include "seeds.h" +#include +#include + +// The playfield a 1x1 room fills on screen, the world point its corner sits at, and the scale the world is drawn at. +constexpr float PLAYFIELD_WIDTH = 338; +constexpr float PLAYFIELD_HEIGHT = 182; +constexpr float WORLD_ORIGIN_X = 60; +constexpr float WORLD_ORIGIN_Y = 140; +constexpr float WORLD_SCALE = 0.65f; +constexpr float SCREEN_TO_WORLD = 1.5384616f; + +// How far past the walls the camera may show, and the wall's own thickness on each side of the floor. +constexpr float CLAMP_MARGIN = 80; +constexpr float WALL_SIDE = 20; +constexpr float WALL_TOP = 60; +constexpr float CELL_ON_SCREEN = 26; +constexpr float DOOR_CLAMP_MARGIN = 20; + +// How far aim and speed lead the camera with a single player, how far enemies pull it and how much. +constexpr float AIM_LEAD = 35; +constexpr float VELOCITY_LEAD = 4.5f; +constexpr float FOCUS_ENTITY_PULL = 0.2f; +constexpr float SPREAD_PULL = 0.25f; +constexpr float ENEMY_RANGE = 550; +constexpr float ENEMY_PULL = 0.4f; +constexpr float BOSS_WEIGHT = 0.6f; + +// The weighted averages' peaks, as fractions of each ring. +constexpr float AIM_PEAK = 0.75f; +constexpr float VELOCITY_PEAK = 0.85f; +constexpr float ENEMY_PEAK = 0.75f; +constexpr float SPREAD_PEAK = 0.5f; +constexpr float FOCUS_PEAK = 0.5f; +constexpr float SHAKE_PEAK = 0.9f; + +// The shake: a new kick every few frames, its size, and the timer it fades out over. +constexpr int SHAKE_KICK_FRAMES = 3; +constexpr float SHAKE_KICK = 10; +constexpr float SHAKE_FADE_FRAMES = 11; +constexpr float SHAKE_PI = 3.14f; + +// A door pulls the camera toward it from this close, fully from DOOR_PULL_FULL. +constexpr float DOOR_PULL_RANGE = 30; +constexpr float DOOR_PULL_FADE = 20; + +// The follow camera's lag: it speeds up far from its target and slows down close to it. +constexpr float FOLLOW_LERP_START = 0.1f; +constexpr float FOLLOW_LERP_MIN = 0.1f; +constexpr float FOLLOW_LERP_MAX = 0.5f; +constexpr float FOLLOW_LERP_STEP = 0.01f; +constexpr float FOLLOW_FAR = 676; +constexpr float FOLLOW_NEAR = 338; + +// The half view of a networked player, in world units. +constexpr float NET_VIEW_HALF_WIDTH = 369.23077f; +constexpr float NET_VIEW_HALF_HEIGHT = 207.6923f; + +constexpr int LASER_VARIANT_THICK_RED = 1; +constexpr int LASER_VARIANT_THICKER_RED = 3; +constexpr int ITEM_STATE_LUDOVICO_CHARGE = 49; +constexpr int WEAPON_TYPE_BRIMSTONE = 2; +constexpr int COLLECTIBLE_LUDOVICO_TECHNIQUE = 329; +constexpr int WEAPON_TYPE_KNIFE = 4; + +static float random_unit() +{ + return (float)Random() * 2.3283064e-10f; +} + +// 00945130 Adds a vector, dropping the oldest when full. +void VectorRing::push(Vector vector) +{ + int capacity = (int)data.size(); + + if (count == capacity) + { + if (count < 1) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"Cannot erase from empty buffer"); + head = (head + 1) % capacity; + count--; + } + data[(head + count) % capacity] = vector; + count++; +} + +// Pushes a vector once per slot, so the ring holds only it, as the constructor and SnapToPosition do. +void VectorRing::fill(Vector vector) +{ + for (size_t i = 0; i < data.size(); i++) push(vector); +} + +// The newest vector. +Vector& VectorRing::back() +{ + return at(count - 1); +} + +// The vector index places after the oldest. +Vector& VectorRing::at(int index) +{ + return data[(head + index) % (int)data.size()]; +} + +// 00943190 The average of the ring weighted by a triangle rising from the oldest to the vector at peakFraction of +// the ring, then falling to the newest. +// An empty ring divides by a zero weight, as in the original. +Vector VectorRing::average(float peakFraction) +{ + Vector sum = vector_make(0, 0); + float weightSum = 0; + float peak = (float)(int)((float)count * peakFraction); + + for (int i = 0; i < count; i++) + { + float start = i > (int)((float)count * peakFraction) ? (float)count + 1 : -1; + float weight = ((float)i - start) / (peak - start); + Vector& sample = at(i); + + if (start == peak) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"Start and End parameters cannot be the same!"); + weightSum += weight; + sum.x += sample.x * weight; + sum.y += sample.y * weight; + } + return vector_make(1 / weightSum * sum.x, 1 / weightSum * sum.y); +} + +// 009428d0 Starts centered on the room, or on the door the players come in by, or on where they enter. +Camera::Camera(Room& owner) +{ + room = &owner; + screenAnchor = vector_make(0.5f, 0.5f); + position = ClampedToRoom(vector_make(0, 0)); + rings_reset(); + followLerp = FOLLOW_LERP_START; + + uint32_t enterDoor = (uint32_t)g_game->enterDoor; + if (enterDoor != UINT32_MAX) + { + Vector door = enterDoor < DOOR_SLOT_COUNT ? room->GetGridPosition(room->doorGridPositions[enterDoor]) + : vector_make(0, 0); + position = ClampedToRoom(room->GetClampedPosition(door, DOOR_CLAMP_MARGIN)); + } + + Vector enter = g_game->GetEnterPosition(); + if (enter.x != 0 || enter.y != 0) position = soft_clamp_position(ClampedToRoom(enter)); + room->renderScrollOffset = position; +} + +// Fills the smoothing rings with nothing: no offsets, no shake, and no focus position. +void Camera::rings_reset() +{ + Vector zero = vector_make(0, 0); + + aimOffsets.fill(zero); + velocityOffsets.fill(zero); + enemyOffsets.fill(zero); + playerSpreads.fill(zero); + shakeOffsets.fill(zero); + focusPositions.fill(vector_make(-1, -1)); +} + +// 009432f0 The camera positions that keep the room's walls (and a margin past them) on screen, both centered on an +// axis the room is too small to scroll along. The Beast's arena has no margin. +CameraBounds Camera::get_clamp_bounds() +{ + Vector margin = vector_make(CLAMP_MARGIN, CLAMP_MARGIN); + Vector surface = room->renderSurfaceTopLeft; + Vector offset = surface; + + if (room->IsBeastDungeon()) + { + margin = vector_make(0, 0); + offset = vector_make(0, 0); + } + + float highX = -surface.x - ((room->topLeftPos.x + WALL_SIDE - margin.x) * WORLD_SCALE - offset.x); + float highY = -surface.y - ((room->topLeftPos.y - WALL_TOP - margin.y) * WORLD_SCALE - offset.y); + float lowX = g_screenWidth - surface.x - ((room->bottomRightPos.x + WALL_SIDE + margin.x) * WORLD_SCALE + offset.x); + float lowY = g_screenHeight - surface.y - ((room->bottomRightPos.y - WALL_TOP + margin.y) * WORLD_SCALE + offset.y); + + if (highX < lowX) highX = lowX = (highX + lowX) * 0.5f; + if (highY < lowY) highY = lowY = (highY + lowY) * 0.5f; + return {vector_make(lowX, lowY), vector_make(highX, highY)}; +} + +// The camera position that shows a world position at the screen anchor. +Vector Camera::to_camera(Vector worldPosition) +{ + float x = g_screenWidth * screenAnchor.x - + ((g_screenWidth - PLAYFIELD_WIDTH) * 0.5f + (worldPosition.x - WORLD_ORIGIN_X) * WORLD_SCALE); + float y = g_screenHeight * screenAnchor.y - + ((g_screenHeight - PLAYFIELD_HEIGHT) * 0.5f + (worldPosition.y - WORLD_ORIGIN_Y) * WORLD_SCALE); + return vector_make(x, y); +} + +// 00943490 The camera position for a world position, kept within the room's bounds unless the room scrolls freely. +// The Beast's arena scrolls freely sideways while a focus position is set. +Vector Camera::ClampedToRoom(Vector worldPosition) +{ + CameraBounds bounds = get_clamp_bounds(); + Vector target = to_camera(worldPosition); + + if (room->descriptor->flags & ROOM_DESCRIPTOR_FLAG_NO_WALLS) return target; + + Vector clamped = vector_make(std::max(std::min(target.x, bounds.high.x), bounds.low.x), + std::max(std::min(target.y, bounds.high.y), bounds.low.y)); + + if (room->IsBeastDungeon() && isShouldOverride && focusPositions.count > 0) clamped.x = target.x; + return clamped; +} + +// 00943610 A camera position eased into the room's bounds, each axis along a smooth curve instead of a hard clamp. +Vector Camera::soft_clamp_position(Vector cameraPosition) +{ + CameraBounds bounds = get_clamp_bounds(); + Vector result = bounds.high; + + if (cameraPosition.x <= bounds.low.x) result.x = bounds.low.x; + else if (cameraPosition.x < bounds.high.x) + { + if (bounds.low.x == bounds.high.x) + KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"Start and End parameters cannot be the same!"); + float t = (cameraPosition.x - bounds.low.x) / (bounds.high.x - bounds.low.x); + result.x = (bounds.high.x - bounds.low.x) * ((t * 6 * t * t - t * 15 * t) + t * 14 - 6) * -(t * t) + + bounds.low.x; + } + + if (cameraPosition.y <= bounds.low.y) result.y = bounds.low.y; + else if (cameraPosition.y < bounds.high.y) + { + if (bounds.low.y == bounds.high.y) + KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"Start and End parameters cannot be the same!"); + float t = (cameraPosition.y - bounds.low.y) / (bounds.high.y - bounds.low.y); + result.y = (bounds.high.y - bounds.low.y) * ((t * 4 * t * t - t * 10 * t) + t * 10 - 5) * -(t * t) + + bounds.low.y; + } + return result; +} + +// 00942f20 The average pull of the visible active enemies near the players toward them, closer ones pulling more. +// Bosses count for less in the average, but pull as hard. A versus match counts the other players as enemies. +Vector Camera::get_enemy_focus_offset() +{ + Vector offset = vector_make(0, 0); + float totalWeight = 0; + + for (Entity* enemy : room->entityList.updateEL) + { + bool isVersusPlayer = g_game->deathmatchManager.state >= DEATHMATCH_INTRO && enemy->type == ENTITY_PLAYER; + bool isEnemy = enemy->type >= ENTITY_FIRST_ENEMY && enemy->type < ENTITY_EFFECT; + + if (!isVersusPlayer && !isEnemy) continue; + if (!enemy->CanShutDoors() || !enemy->isVisible) continue; + + Vector center; + players_center_position(&g_game->playerManager, ¢er, true); + float dx = enemy->pos.x - center.x; + float dy = enemy->pos.y - center.y; + float distance = std::sqrt(dx * dx + dy * dy); + if (distance >= ENEMY_RANGE) continue; + + float falloff = (distance - ENEMY_RANGE) / -ENEMY_RANGE; + totalWeight += enemy->IsBoss() ? BOSS_WEIGHT : 1; + offset.x += dx * falloff * ENEMY_PULL; + offset.y += dy * falloff * ENEMY_PULL; + } + if (totalWeight == 0) return vector_make(0, 0); + return vector_make(1 / totalWeight * offset.x, 1 / totalWeight * offset.y); +} + +// 009437e0 Moves the camera for a frame: the active camera unless its option is off, which follows the players. +// The active camera always drops the focus position. The follow camera drops it when told to. +void Camera::DoUpdate(bool isSkipFocusBuffer) +{ + if (g_manager->optionsConfig.cameraStyle != CAMERA_STYLE_ACTIVE_CAM_OFF) + { + update_focus_position(isSkipFocusBuffer); + isShouldOverride = false; + } + else + { + update_follow(); + if (isSkipFocusBuffer) isShouldOverride = false; + } +} + +// 009439d0 The active camera: frames the players' center led by the main player's aim and speed, nearby enemies and +// the co-op babies' spread, each averaged over recent frames, and the focus position while one is set. It eases into the +// room's bounds, shakes, leans toward a door the players stand at, and scrolls the room there. +void Camera::update_focus_position(bool isSkipFocusBuffer) +{ + Entity_Player* player = g_game->playerManager.get_first_local_main_player(); + + if (!player) + { + KAGE_LogMessage(LOG_ERROR, (uint8_t*)"No main player detected when trying to update camera \n"); + return; + } + + Vector center; + players_center_position(&g_game->playerManager, ¢er, true); + + bool isSolo = g_game->playerManager.playerList.size() == 1; + float lead = isSolo ? AIM_LEAD : 0; + Vector aim = vector_make(lead * player->aimDirection.x, lead * player->aimDirection.y); + Entity* focus = player->GetFocusEntity(); + + if (focus) + { + Vector pull = vector_make((focus->pos.x - player->pos.x) * FOCUS_ENTITY_PULL, + (focus->pos.y - player->pos.y) * FOCUS_ENTITY_PULL); + float aimLength = std::sqrt(aim.x * aim.x + aim.y * aim.y); + + if (lead < std::sqrt(pull.y * pull.y + pull.x * pull.x) && aimLength > 0) + aim = vector_make(lead / aimLength * aim.x, lead / aimLength * aim.y); + if (!player->HasWeaponType(WEAPON_TYPE_KNIFE) || player->HasCollectible(COLLECTIBLE_LUDOVICO_TECHNIQUE)) aim = pull; + else if (Entity_Knife* knife = dynamic_cast(focus); knife && knife->isFlying) + aim = vector_make(pull.x + lead * player->lastDirection.x, pull.y + lead * player->lastDirection.y); + } + + bool isBrimstoneAim = player->HasWeaponType(WEAPON_TYPE_BRIMSTONE) && !player->HasCollectible(COLLECTIBLE_LUDOVICO_TECHNIQUE) && + !player->isPlayingExtraAnimation && !player->isPlayingItemAnimation; + if (player->itemState == ITEM_STATE_LUDOVICO_CHARGE || isBrimstoneAim) + { + for (Entity* laser : room->entityList.updateEL) + { + if (laser->type != ENTITY_LASER) continue; + bool isThick = laser->variant == LASER_VARIANT_THICK_RED || laser->variant == LASER_VARIANT_THICKER_RED; + if (isThick && laser->spawnerType == ENTITY_PLAYER && laser->spawnerVariant == 0) + aim = vector_make(lead * player->lastDirection.x, lead * player->lastDirection.y); + } + } + aimOffsets.push(aim); + + float velocityLead = isSolo ? VELOCITY_LEAD : 0; + velocityOffsets.push(vector_make(player->velocity.x * velocityLead, player->velocity.y * velocityLead)); + enemyOffsets.push(get_enemy_focus_offset()); + + Vector spreadCenter; + Vector spread = vector_make(0, 0); + int mainPlayers = 0; + players_center_position(&g_game->playerManager, &spreadCenter, true); + for (Entity_Player* other : g_game->playerManager.playerList) + { + if (other->variant != PLAYER_VARIANT_COOP_BABY) continue; + mainPlayers++; + spread.y += (other->pos.y - spreadCenter.y) * SPREAD_PULL; + spread.x += (other->pos.x - spreadCenter.x) * SPREAD_PULL; + } + if (mainPlayers > 0) spread = vector_make(1 / (float)mainPlayers * spread.x, 1 / (float)mainPlayers * spread.y); + playerSpreads.push(spread); + + if (!isShouldOverride) + { + if (isSkipFocusBuffer) focusPositions.push(focusPositions.back()); + else + { + focusPositions.push(vector_make(-1, -1)); + isShouldOverride = true; + } + } + + Vector aimAverage = aimOffsets.average(AIM_PEAK); + Vector velocityAverage = velocityOffsets.average(VELOCITY_PEAK); + Vector enemyAverage = enemyOffsets.average(ENEMY_PEAK); + Vector spreadAverage = playerSpreads.average(SPREAD_PEAK); + Vector target = vector_make(spreadAverage.x + enemyAverage.x + velocityAverage.x + center.x + aimAverage.x, + spreadAverage.y + enemyAverage.y + velocityAverage.y + (center.y + aimAverage.y)); + + VectorRing focusCopy = focusPositions; + for (int i = 0; i < focusCopy.count; i++) + if (focusCopy.at(i).x == -1 && focusCopy.at(i).y == -1) focusCopy.at(i) = target; + position = soft_clamp_position(to_camera(focusCopy.average(FOCUS_PEAK))); + shake_update(); + + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + if (!room->doors[slot]) continue; + + Vector door = room->GetGridPosition(room->doorGridPositions[slot]); + float distance = std::sqrt((door.y - center.y) * (door.y - center.y) + (door.x - center.x) * (door.x - center.x)); + if (distance >= DOOR_PULL_RANGE) continue; + + float t = std::min((distance - DOOR_PULL_RANGE) / -DOOR_PULL_FADE, 1.0f); + float ease = (3 - (t + t)) * t * t; + Vector doorCamera = ClampedToRoom(door); + position.x += (doorCamera.x - position.x) * ease; + position.y += (doorCamera.y - position.y) * ease; + break; + } + room->renderScrollOffset = position; + playersCenter = center; +} + +// The screen shake shared by both cameras: a kick every few frames while the game shakes, each nudged from the +// last, fading with the shake's timer, averaged into the game's shake offset. +void Camera::shake_update() +{ + if (g_game->screenShakeTimer < 1) shakeOffsets.push(vector_make(0, 0)); + else + { + float angle = random_unit() * SHAKE_PI; + angle += angle; + + if (g_game->frameCount % SHAKE_KICK_FRAMES == 0) + shakeOffsets.push(vector_make(std::cos(angle) * SHAKE_KICK, std::sin(angle) * SHAKE_KICK)); + else + { + Vector last = shakeOffsets.back(); + float cosine = std::cos(angle); + float sine = std::sin(angle); + shakeOffsets.push(vector_make(cosine + cosine - last.x, sine + sine - last.y)); + } + + float fade = std::clamp(((float)g_game->screenShakeTimer - 0) / SHAKE_FADE_FRAMES, 0.0f, 1.0f); + Vector& newest = shakeOffsets.back(); + newest.y *= fade; + newest.x *= fade; + } + g_game->screenShakeOffset = shakeOffsets.average(SHAKE_PEAK); +} + +// 009446e0 The follow camera: lags after the players' center (or the focus position), faster while far from it. +void Camera::update_follow() +{ + Vector center; + players_center_position(&g_game->playerManager, ¢er, true); + if (isShouldOverride && focusPositions.count > 0) center = focusPositions.back(); + shake_update(); + + Vector target = ClampedToRoom(center); + Vector delta = vector_make(target.x - position.x, target.y - position.y); + float distanceSquared = delta.y * delta.y + delta.x * delta.x; + + if (distanceSquared > FOLLOW_FAR) followLerp = std::min(followLerp + FOLLOW_LERP_STEP, FOLLOW_LERP_MAX); + else if (distanceSquared < FOLLOW_NEAR) followLerp = std::max(followLerp - FOLLOW_LERP_STEP, FOLLOW_LERP_MIN); + + position.x += followLerp * delta.x; + position.y += followLerp * delta.y; + room->renderScrollOffset = position; +} + +// 00943830 Moves the camera by where the players' center (or the focus position) sits on screen, kept within the +// room's edges, and scrolls the room there. Level::Init runs it once a floor's first room is loaded. +void Camera::position_center() +{ + Vector center; + players_center_position(&g_game->playerManager, ¢er, false); + if (isShouldOverride && focusPositions.count > 0) center = focusPositions.back(); + + Vector offset = to_camera(center); + float minX = g_screenWidth - (((float)room->gridWidth + 2) * CELL_ON_SCREEN + room->renderSurfaceTopLeft.x * 2); + float minY = g_screenHeight - (room->renderSurfaceTopLeft.y * 2 + ((float)room->gridHeight + 2) * CELL_ON_SCREEN); + + position.x += std::min(std::max(offset.x, minX), 0.0f); + position.y += std::min(std::max(offset.y, minY), 0.0f); + room->renderScrollOffset = position; +} + +// 00944a40 Whether a world position is on screen. Online, it counts as seen when within a screen of any player +// (or the focus position), kept within the room. +bool Camera::IsPosVisible(Vector worldPosition) +{ + if (!g_manager->netplayManager.is_online()) + { + float left = -position.x * SCREEN_TO_WORLD - + ((g_screenWidth - PLAYFIELD_WIDTH) * 0.5f + (0 - WORLD_ORIGIN_X) * WORLD_SCALE) / WORLD_SCALE; + float top = -position.y * SCREEN_TO_WORLD - + ((g_screenHeight - PLAYFIELD_HEIGHT) * 0.5f + (0 - WORLD_ORIGIN_Y) * WORLD_SCALE) / WORLD_SCALE; + return left < worldPosition.x && worldPosition.x < g_screenWidth * SCREEN_TO_WORLD + left && + top < worldPosition.y && worldPosition.y < g_screenHeight * SCREEN_TO_WORLD + top; + } + + Room& current = *g_game->room; + float minX = current.topLeftPos.x - CLAMP_MARGIN + NET_VIEW_HALF_WIDTH; + float minY = current.topLeftPos.y - CLAMP_MARGIN + NET_VIEW_HALF_HEIGHT; + float maxX = current.bottomRightPos.x + CLAMP_MARGIN - NET_VIEW_HALF_WIDTH; + float maxY = current.bottomRightPos.y + CLAMP_MARGIN - NET_VIEW_HALF_HEIGHT; + + for (Entity_Player* player : g_game->playerManager.playerList) + { + Vector focus = isShouldOverride && focusPositions.count > 0 ? focusPositions.back() : player->pos; + float x = std::min(std::max(focus.x, minX), maxX); + float y = std::min(std::max(focus.y, minY), maxY); + float seenX = std::min(std::max(worldPosition.x, x - NET_VIEW_HALF_WIDTH), x + NET_VIEW_HALF_WIDTH); + float seenY = std::min(std::max(worldPosition.y, y - NET_VIEW_HALF_HEIGHT), y + NET_VIEW_HALF_HEIGHT); + + if (seenX == worldPosition.x && seenY == worldPosition.y) return true; + } + return false; +} + +// 00944d10 Holds the camera on a world position until the next update drops it. +void Camera::SetFocusPosition(Vector worldPosition) +{ + if (isShouldOverride) return; + focusPositions.push(worldPosition); + isShouldOverride = true; +} + +// 00944d40 Forgets the smoothing and jumps to a world position, kept within the room. +void Camera::SnapToPosition(Vector worldPosition) +{ + rings_reset(); + isShouldOverride = false; + position = ClampedToRoom(worldPosition); + room->renderScrollOffset = position; +} diff --git a/src/camera.h b/src/camera.h new file mode 100644 index 0000000..4f2ebbc --- /dev/null +++ b/src/camera.h @@ -0,0 +1,75 @@ +#pragma once + +#include "classes.h" +#include + +// How many frames each of the camera's smoothing rings remembers. +constexpr int CAMERA_AIM_FRAMES = 60; +constexpr int CAMERA_VELOCITY_FRAMES = 90; +constexpr int CAMERA_ENEMY_FRAMES = 300; +constexpr int CAMERA_SPREAD_FRAMES = 15; +constexpr int CAMERA_SHAKE_FRAMES = 4; +constexpr int CAMERA_FOCUS_FRAMES = 120; + +// The original's CircularBuffer: the last capacity vectors pushed, oldest first, the oldest dropped when full. +struct VectorRing +{ + std::vector data; + int count = 0; + int head = 0; + + explicit VectorRing(int capacity) : data(capacity) {} + void push(Vector vector); + void fill(Vector vector); + Vector& back(); + Vector& at(int index); + Vector average(float peakFraction); +}; + +// The lowest and highest camera positions that keep the room's walls on screen. +struct CameraBounds +{ + Vector low{}; + Vector high{}; +}; + +// Destruction (007ea0c0, which Room::Init runs on the old camera) is the default. +// UpdateUltrasmooth 0091e980 is the chat profanity filter and Update 00993a70 is FXLayers::Update (fx_layers.cpp), +// both misattributed. +// The room's camera (Room::camera): where the room scrolls to keep the players, their aim, their speed and nearby +// enemies in view, smoothed over rings of recent frames, with the screen shake. Position is the room's scroll offset. +// It snaps to a focus position while one is set (isShouldOverride), and the "active camera off" style follows the +// players with a lag instead. +class Camera +{ +public: + VectorRing aimOffsets{CAMERA_AIM_FRAMES}; + VectorRing velocityOffsets{CAMERA_VELOCITY_FRAMES}; + VectorRing enemyOffsets{CAMERA_ENEMY_FRAMES}; + VectorRing playerSpreads{CAMERA_SPREAD_FRAMES}; + VectorRing shakeOffsets{CAMERA_SHAKE_FRAMES}; + VectorRing focusPositions{CAMERA_FOCUS_FRAMES}; + Vector playersCenter{}; + Vector position{}; + Vector screenAnchor{}; + Room* room = nullptr; + float followLerp = 0; + bool isShouldOverride = false; + + explicit Camera(Room& owner); + void rings_reset(); + CameraBounds get_clamp_bounds(); + Vector ClampedToRoom(Vector worldPosition); + Vector soft_clamp_position(Vector cameraPosition); + Vector get_enemy_focus_offset(); + Vector to_camera(Vector worldPosition); + + void DoUpdate(bool isSkipFocusBuffer); + void update_focus_position(bool isSkipFocusBuffer); + void update_follow(); + void shake_update(); + void position_center(); + bool IsPosVisible(Vector worldPosition); + void SetFocusPosition(Vector worldPosition); + void SnapToPosition(Vector worldPosition); +}; diff --git a/src/console.cpp b/src/console.cpp index 042775b..a4c0f41 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -1,4 +1,5 @@ #include "console.h" +#include "entity_pickup.h" #include "font.h" #include "game.h" #include "kage_graphics.h" @@ -7,6 +8,7 @@ #include "menu_manager.h" #include "platform.h" #include "render_passes.h" +#include "room.h" #include #include #include @@ -49,7 +51,6 @@ constexpr size_t HISTORY_LOAD_MAX = 64; constexpr int INPUT_HOOK_TRIGGERED = 1; constexpr int ACTION_CONSOLE = 33; constexpr int COLLECTIBLE_GLITCHED_CROWN = 689; -constexpr unsigned int ENTITY_PICKUP = 5; constexpr unsigned int PICKUP_COLLECTIBLE = 100; constexpr int SLIDE_FRAMES = 14; @@ -420,11 +421,9 @@ bool Console::update_state() if (g_game->playerManager.AnyoneHasCollectible(COLLECTIBLE_GLITCHED_CROWN)) { - EntityList_EL& entities = g_game->room->GetEntities()->_updateEL; - for (uint32_t i = 0; i < entities._size; i++) + for (Entity* entity : g_game->room->GetEntities()->updateEL) { - Entity* entity = entities._data[i]; - if (entity->_type == ENTITY_PICKUP && entity->_variant == PICKUP_COLLECTIBLE) + if (entity->type == ENTITY_PICKUP && entity->variant == PICKUP_COLLECTIBLE) static_cast(entity)->update_cycle_collectible(0); } } diff --git a/src/entity.cpp b/src/entity.cpp new file mode 100644 index 0000000..dab1f31 --- /dev/null +++ b/src/entity.cpp @@ -0,0 +1,1525 @@ +#include "entity.h" +#include "entity_effect.h" +#include "entity_list.h" +#include "entity_npc.h" +#include "entity_player.h" +#include "entity_tear.h" +#include "game.h" +#include "log.h" +#include "lua_engine.h" +#include "manager.h" +#include "room.h" +#include +#include +#include +#include + +// classes.h declares the original's Lua imports, and its luaL_newstate differs from Lua's only in its return type. +#define luaL_newstate lua_newstate_auxiliary +extern "C" +{ +#include "lauxlib.h" +#include "lua.h" +} +#undef luaL_newstate + +// The room's play area on screen: world units from its corner shrink by ROOM_SCREEN_SCALE into a centered view. +constexpr float ROOM_ORIGIN_X = 60; +constexpr float ROOM_ORIGIN_Y = 140; +constexpr float ROOM_SCREEN_SCALE = 0.65f; +constexpr float ROOM_VIEW_HEIGHT = 182; +constexpr float ROOM_VIEW_WIDTH = 338; +constexpr float HALF = 0.5f; +constexpr float DEGREES_TO_RADIANS = 0.017453292f; + +// GetRenderZ's bands: the background layer, the door layer and the normal layer sorted by depth. +constexpr int RENDER_INDEX_MASK = 0x3ff; +constexpr int RENDER_Z_BACKGROUND_BASE = 100; +constexpr int RENDER_Z_BACKGROUND_MAX = 4999; +constexpr int RENDER_Z_DOOR_BASE = 5100; +constexpr int RENDER_Z_DOOR_MIN = 5000; +constexpr int RENDER_Z_DOOR_MAX = 9999; +constexpr int RENDER_Z_DUNGEON_BASE = 10030; +constexpr float RENDER_Z_NORMAL_MIN = 10000; +constexpr float RENDER_Z_DEPTH_SCALE = 100; +constexpr float RENDER_Z_DEPTH_BASE = 10030; + +// The defaults Init and LoadEntityConfig give: status tick damage, slowing, the shadow without a config, and the +// update clock's start just before zero. +constexpr float STATUS_TICK_DAMAGE_DEFAULT = 2; +constexpr float SLOWING_AMOUNT_DEFAULT = 0.9f; +constexpr float SHADOW_SIZE_DEFAULT = 0.015625f; +constexpr float UPDATE_TIME_START = -1e-05f; +// The drop RNG's shift triple once an entity is initialized (4, 3, 17). +constexpr uint32_t DROP_RNG_SHIFT_INDEX = 30; +// The stage at which a config's per-stage health stops growing, and how much less it grows from the fifth stage on. +constexpr float STAGE_HP_CAP = 10; +constexpr uint32_t STAGE_HP_REDUCED_FROM = 5; +constexpr float STAGE_HP_REDUCED_SCALE = 0.8f; +constexpr float STAGE_HP_MIN = 0.001f; +constexpr float PI_FLOAT = 3.1415927f; + +// The knockback a heavy hit leaves: how it slows, and the speed under which it ends. +constexpr float KNOCKBACK_DECAY = 0.95f; +constexpr float KNOCKBACK_MIN_SPEED = 2; +// A co-op ghost floats over the room. +constexpr float GHOST_BOB_SPEED = 0.2f; +constexpr float GHOST_BOB_HEIGHT = 2; +// How long a seed's charm, confusion or fear lasts each frame, and how often the alternating fear alternates. +constexpr int SEED_STATUS_FRAMES = 2; +constexpr int ALTERNATING_FEAR_FRAMES = 60; +// Shrinking eases toward its target a sixth of the way each frame. +constexpr float SHRINK_EASE = 5 * 0.033333335f; +// Burn and bleed flicker through six colors, poison and burn hurt every twentieth frame. +constexpr int FLICKER_COLORS = 6; +constexpr int STATUS_DAMAGE_INTERVAL = 20; +constexpr int STATUS_DAMAGE_PHASE = 1; +constexpr float BLEED_FLICKER_SCALE = 0.02f; +constexpr int STATUS_COLOR_PRIORITY = 255; +constexpr int STATUS_COLOR_FRAMES = 2; +// A hit flashes the entity for a third of its damage in frames, from one to six. +constexpr int HIT_FLASH_DIVISOR = 3; +constexpr int HIT_FLASH_MIN = 1; +constexpr int HIT_FLASH_MAX = 6; +constexpr int SOUND_FIREDEATH_HISS = 43; +constexpr int COLLECTIBLE_BLACK_POWDER = 420; +constexpr float POSITION_LIMIT = 10000; +// The extra fire Black Powder makes a fireplace burst with. +constexpr int FIREPLACE_NORMAL = 0; +constexpr int FIREPLACE_RED = 1; +constexpr int FIREPLACE_MOVEABLE = 10; +// The Lua callback a removal runs (MC_POST_ENTITY_REMOVE). +constexpr int LUA_CALLBACK_POST_ENTITY_REMOVE = 67; +// The online stats a kill counts toward (kills, boss kills, and kills as a co-op ghost). +constexpr uint32_t STAT_KILLS = 17; +constexpr uint32_t STAT_BOSS_KILLS = 20; +constexpr uint32_t STAT_GHOST_BOSS_KILLS = 21; +// The debug flags PostRender draws for: entity positions, collision shapes and grid collision points. +constexpr uint32_t DEBUG_ENTITY_POSITIONS = 1 << 0; +constexpr uint32_t DEBUG_HITSPHERES = 1 << 5; +constexpr uint32_t DEBUG_DAMAGE_VALUES = 1 << 6; +constexpr uint32_t DEBUG_GRID_COLLISION = 1 << 12; + +// The flags an EntityRef's status flags come from, and those CopyStatusEffects hands a segment. +constexpr uint64_t SHARED_STATUS_FLAGS = FLAG_FREEZE | FLAG_POISON | FLAG_SLOW | FLAG_CHARM | FLAG_CONFUSION | + FLAG_MIDAS_FREEZE | FLAG_FEAR | FLAG_BURN | FLAG_SHRINK | FLAG_FRIENDLY | + FLAG_BLEED_OUT | FLAG_KNOCKED_BACK | FLAG_APPLY_IMPACT_DAMAGE | FLAG_ICE | + FLAG_MAGNETIZED | FLAG_BAITED | FLAG_WEAKNESS | FLAG_BRIMSTONE_MARKED; + +constexpr ColorMod HIT_COLOR = {{0.5f, 0.5f, 0.5f, 1}, {0, 0, 0, 0}, {0.78431374f, 0, 0}}; +constexpr ColorMod HUGE_BOSS_HIT_COLOR = {{0.5f, 0.5f, 0.33f, 1}, {0, 0, 0, 0}, {0.39215687f, 0, 0}}; +constexpr ColorMod POISON_COLOR = {{0.1f, 0.5f, 0.1f, 1}, {0, 0, 0, 0}, {0, 0.5f, 0}}; +constexpr ColorMod BURN_COLOR = {{0.5f, 0.3f, 0.1f, 1}, {0, 0, 0, 0}, {0.5f, 0.3f, 0}}; +constexpr ColorMod BURN_COLORS[FLICKER_COLORS] = { + {{1, 1, 1, 1}, {0, 0, 0, 0}, {0, 0, 0}}, + {{1, 1, 0.8039216f, 1}, {0, 0, 0, 0}, {0.17647059f, 0, 0}}, + {{1, 1, 0.60784316f, 1}, {0, 0, 0, 0}, {0.3529412f, 0, 0}}, + {{1, 1, 0.8039216f, 1}, {0, 0, 0, 0}, {0.27450982f, 0.09803922f, 0}}, + {{1, 1, 1, 1}, {0, 0, 0, 0}, {0.19607843f, 0.19607843f, 0}}, + {{1, 1, 1, 1}, {0, 0, 0, 0}, {0.09803922f, 0.09803922f, 0}}, +}; +constexpr ColorMod BLEED_COLORS[FLICKER_COLORS] = { + {{1, 1, 1, 1}, {0, 0, 0, 0}, {0, 0, 0}}, + {{1, 0.74509805f, 0.74509805f, 1}, {0, 0, 0, 0}, {0.17647059f, 0, 0}}, + {{1, 0.47058827f, 0.47058827f, 1}, {0, 0, 0, 0}, {0.3529412f, 0, 0}}, + {{0.8627451f, 0.23529413f, 0.23529413f, 1}, {0, 0, 0, 0}, {0.15686275f, 0, 0}}, + {{0.9411765f, 0.78431374f, 0.78431374f, 1}, {0, 0, 0, 0}, {0, 0, 0}}, + {{1, 0.8039216f, 0.8039216f, 1}, {0, 0, 0, 0}, {0.27450982f, 0, 0}}, +}; + +// The run state flags that keep a killed angel from scoring again (STATE_URIEL_SPAWNED, STATE_GABRIEL_SPAWNED). +constexpr int URIEL_SPAWNED_BIT = 25; +constexpr int GABRIEL_SPAWNED_BIT = 26; + +// Formats a message for KAGE_LogMessage, whose declaration takes nothing to format with. +[[gnu::format(printf, 2, 3)]] static void log_format(uint32_t level, const char* format, ...) +{ + char message[256]; + va_list args; + + va_start(args, format); + std::vsnprintf(message, sizeof(message), format, args); + va_end(args); + KAGE_LogMessage(level, (uint8_t*)message); +} + +static float vector_length(Vector v) +{ + return std::sqrt(v.x * v.x + v.y * v.y); +} + +static Vector vector_add(Vector a, Vector b) +{ + return vector_make(a.x + b.x, a.y + b.y); +} + +// 0067f310 Where a world position draws on screen, optionally snapped to the display's pixels. +Vector render_position_get(const Vector& world, RenderSnap snap) +{ + float viewX = (g_screenWidth - ROOM_VIEW_WIDTH) * HALF; + float viewY = (g_screenHeight - ROOM_VIEW_HEIGHT) * HALF; + Vector screen = vector_make(viewX + (world.x - ROOM_ORIGIN_X) * ROOM_SCREEN_SCALE, + viewY + (world.y - ROOM_ORIGIN_Y) * ROOM_SCREEN_SCALE); + if (snap == RENDER_UNSNAPPED) return screen; + + float pixelScale = g_displayPixelRatio * g_screenPointScale; + return vector_make(std::floor(screen.x * pixelScale + HALF) / pixelScale, + std::floor(screen.y * pixelScale + HALF) / pixelScale); +} + +// 004cf1d0, 006b5b50, 00872050 Points at another entity, moving its registration from the old one to the new one. +void EntityPtr::Set(Entity* target) +{ + if (entity == target) return; + + if (entity) std::erase(entity->referrers, this); + entity = target; + if (entity) entity->referrers.push_back(this); +} + +// 00431310 A snapshot of the entity, or an empty one for none. +EntityRef::EntityRef(Entity* source) +{ + entity = source; + if (!source) return; + + type = source->type; + variant = source->variant; + spawnerType = source->spawnerType; + spawnerVariant = source->spawnerVariant; + position = source->pos; + velocity = source->velocity; + if (source->HasEntityFlags(FLAG_CHARM)) flags |= ENTITY_REF_CHARMED; + if (source->HasEntityFlags(FLAG_FRIENDLY)) flags |= ENTITY_REF_FRIENDLY; + if (source->HasEntityFlags(FLAG_WEAKNESS)) flags |= ENTITY_REF_WEAKNESS; +} + +// 006a8850 (006a8820) Removes the entity if it still exists and drops its Lua data. +// The original left the pointers to a destroyed entity dangling: they are nulled here. +Entity::~Entity() +{ + if (isExists) Entity::Remove(); + data_release(); + for (EntityPtr* referrer : referrers) referrer->forget(); +} + +// Frees the table GetData made for Lua, if any. +void Entity::data_release() +{ + if (dataRef == LUA_REF_NONE) return; + + luaL_unref(static_cast(g_luaEngine)->state, LUA_REGISTRYINDEX, dataRef); + dataRef = LUA_REF_NONE; +} + +// 00499da0 +Entity_Player* Entity::ToPlayer() +{ + return type == ENTITY_PLAYER ? static_cast(this) : nullptr; +} + +// 00435e40 +Entity_Tear* Entity::ToTear() +{ + return type == ENTITY_TEAR ? static_cast(this) : nullptr; +} + +// Whether the type is an enemy's, or a player's in a versus match. +bool Entity::is_enemy_type(int entityType) +{ + if (g_game->deathmatchManager.is_active() && entityType == ENTITY_PLAYER) return true; + return entityType >= ENTITY_FIRST_ENEMY && entityType <= ENTITY_LAST_ENEMY; +} + +// 00435e00 Itself if it is an enemy, or a player in a versus match. +Entity* Entity::to_npc_or_coop_player() +{ + return is_enemy_type(type) ? this : nullptr; +} + +// 00431450 Pushes it, scaled by its speed unless told not to. +void Entity::AddVelocity(const Vector& added, bool isIgnoreSpeedMultiplier) +{ + float multiplier = isIgnoreSpeedMultiplier ? 1 : speedMultiplier; + + velocity.x = multiplier * added.x + velocity.x; + velocity.y = added.y * multiplier + velocity.y; +} + +// 004314b0 Pushes it against its friction, so the push survives the next slowdown. +void Entity::AddVelocity_divided(const Vector& added, bool isIgnoreSpeedMultiplier) +{ + if (friction == 0) return; + + float multiplier = isIgnoreSpeedMultiplier ? 1 : speedMultiplier; + velocity.x = (multiplier * added.x) / friction + velocity.x; + velocity.y = (added.y * multiplier) / friction + velocity.y; +} + +// 006a9c50 Heals it up to its maximum. +void Entity::AddHealth(float amount) +{ + health = std::min(amount + health, maxHitPoints); +} + +// 006a9c10 The frames since it spawned. +int Entity::FrameCount() +{ + return g_game->frameCount - spawnFrame; +} + +// 00435db0 How many whole ticks of its own time this update covers. +int Entity::update_ticks_get() +{ + return (int)updateTime - (int)prevUpdateTime; +} + +// 006ac710 Whether this is one of every frequency frames, never on an interpolation update or while paused. +bool Entity::IsFrame(int frequency, int offset) +{ + if (HasEntityFlags(FLAG_INTERPOLATION_UPDATE) || g_game->IsPaused()) return false; + return (g_game->frameCount + offset) % frequency == 0; +} + +// 006ac760 How many intervals of its own time this update crossed. +int Entity::GetIntervalTicks(float interval, float offset) +{ + if (HasEntityFlags(FLAG_INTERPOLATION_UPDATE) || g_game->IsPaused()) return 0; + return (int)((offset + updateTime) / interval) - (int)((offset + prevUpdateTime) / interval); +} + +// 006ac8d0 The direction it moves in most, as a Direction. +int Entity::get_velocity_direction() +{ + if (std::fabs(velocity.y) < std::fabs(velocity.x)) return velocity.x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + return velocity.y >= 0 ? DIRECTION_DOWN : DIRECTION_UP; +} + +// 006ac2a0 Resizes its collision ellipse and lays the grid collision points around it, the even ones first. +// A -1 multiplier or point count takes the config's. +void Entity::SetSize(float newSize, Vector newSizeMulti, int gridCollisionPoints) +{ + if (newSizeMulti.x == -1 && newSizeMulti.y == -1) newSizeMulti = config->collisionRadiusMulti; + if (gridCollisionPoints == -1) gridCollisionPoints = config->gridCollisionPoints; + if (size == newSize && sizeMulti.x == newSizeMulti.x && sizeMulti.y == newSizeMulti.y) return; + + size = newSize; + sizeMulti = newSizeMulti; + collisionPoints.clear(); + for (int first : {0, 1}) + { + for (int i = first; i < gridCollisionPoints; i += 2) + { + double angle = (((float)i + (float)i) * PI_FLOAT) / (float)gridCollisionPoints; + collisionPoints.push_back(vector_make((float)std::cos(angle) * size * sizeMulti.x, + (float)std::sin(angle) * size * sizeMulti.y)); + } + } +} + +// 006a9ba0 +void Entity::GetCollisionCapsule(Capsule&, const Vector&) +{ + reconstruction_missing("Entity::GetCollisionCapsule 006a9ba0"); +} + +// 006a8990 The top of its parent chain. +Entity* Entity::GetLastParent() +{ + Entity* last = this; + while (last->parent) last = last->parent; + return last; +} + +// 006a89b0 The end of its child chain. +Entity* Entity::GetLastChild() +{ + Entity* last = this; + while (last->child) last = last->child; + return last; +} + +// 006a89d0 Whatever spawned what spawned it, as far back as it goes. +Entity* Entity::GetLastSpawner() +{ + Entity* last = this; + while (last->spawnerEntity) last = last->spawnerEntity; + return last; +} + +// 006a89f0 The segment that holds the status effects of a body sharing them, or itself. +Entity* Entity::GetStatusEffectTarget() +{ + return DoesEntityShareStatus() ? GetLastParent() : this; +} + +// 0067a720 +float Entity::GetRootParent() +{ + reconstruction_missing("Entity::GetRootParent 0067a720"); +} + +// Follows a chain of links from start, stopping at the first entity found or where the chain loops. +template static Entity* chain_find(Entity* start, Next next, Found isFound) +{ + std::vector visited; + + for (Entity* current = start; current; current = next(current)) + { + if (isFound(current)) return current; + if (std::find(visited.begin(), visited.end(), current) != visited.end()) break; + visited.push_back(current); + } + return nullptr; +} + +static Entity* parent_next(Entity* entity) +{ + return entity->parent; +} + +static Entity* spawner_next(Entity* entity) +{ + return entity->spawnerEntity; +} + +// 006a8fa0 Whether the ancestor is itself, or up its parent or spawner chains. +bool Entity::IsDescendantOf(Entity* ancestor) +{ + if (!ancestor) return false; + if (ancestor == this) return true; + + auto isAncestor = [ancestor](Entity* entity) { return entity == ancestor; }; + return chain_find(parent, parent_next, isAncestor) || chain_find(spawnerEntity, spawner_next, isAncestor); +} + +// 006a9140 The player up its parent chain, or else up its spawner chain. +Entity* Entity::GetPlayerAncestor() +{ + auto isPlayer = [](Entity* entity) { return entity->type == ENTITY_PLAYER; }; + Entity* player = chain_find(this, parent_next, isPlayer); + return player ? player : chain_find(this, spawner_next, isPlayer); +} + +// 006a8c00 Whether both are segments of one body, never for a ring of flies. +bool Entity::HasCommonParentWithEntity(Entity* other) +{ + if (other && other->type == ENTITY_RING_OF_FLIES) return false; + return (other ? other->GetLastParent() : nullptr) == GetLastParent(); +} + +// Whether the entity is a boss or enemy made of segments that act as one body. +static bool is_segmented(const Entity& entity) +{ + switch (entity.type) + { + case ENTITY_LARRYJR: + case ENTITY_CHUB: + case ENTITY_MRMAW: + case ENTITY_PIN: + case ENTITY_BUTTLICKER: + case ENTITY_SWINGER: + case ENTITY_GRUB: + case ENTITY_SCOURGE: + case ENTITY_MOTHER: + case ENTITY_TURDLET: + return true; + case ENTITY_ROUND_WORM: + return entity.variant == 2; + default: + return false; + } +} + +// 006a8c60 Whether the other is a segment of its own body, for the bosses made of segments. +bool Entity::is_same_segmented_body(Entity* other) +{ + if (!is_segmented(*this)) return false; + if (!other) return true; + return other->type != ENTITY_RING_OF_FLIES && other->GetLastParent() == GetLastParent(); +} + +// 006a8db0 Whether its status effects belong to its whole body. +bool Entity::DoesEntityShareStatus() +{ + switch (type) + { + case ENTITY_LARRYJR: + case ENTITY_CHUB: + case ENTITY_MRMAW: + case ENTITY_PIN: + case ENTITY_GEMINI: + case ENTITY_BUTTLICKER: + case ENTITY_HEART: + case ENTITY_MASK: + case ENTITY_MASK_OF_INFAMY: + case ENTITY_HEART_OF_INFAMY: + case ENTITY_SWINGER: + case ENTITY_GRUB: + case ENTITY_SCOURGE: + case ENTITY_MOTHER: + case ENTITY_TURDLET: + return true; + case ENTITY_ROUND_WORM: + return variant == 2; + default: + return false; + } +} + +// 006a8a20 Hands its status effects down its child chain, the boss cooldown only between bosses. +void Entity::CopyStatusEffects() +{ + if (!DoesEntityShareStatus()) return; + + bool isVersusPlayer = g_game->deathmatchManager.is_active() && type == ENTITY_PLAYER; + for (Entity* segment = child; segment; segment = segment->child) + { + segment->freezeCountdown = freezeCountdown; + segment->flags = (segment->flags & ~SHARED_STATUS_FLAGS) | (flags & SHARED_STATUS_FLAGS); + segment->poisonCountdown = poisonCountdown; + segment->slowingCountdown = slowingCountdown; + segment->charmedCountdown = charmedCountdown; + segment->confusionCountdown = confusionCountdown; + segment->midasFreezeCountdown = midasFreezeCountdown; + segment->fearCountdown = fearCountdown; + segment->burnCountdown = burnCountdown; + segment->bleedingCountdown = bleedingCountdown; + segment->shrinkCountdown = shrinkCountdown; + segment->poisonTickDamage = poisonTickDamage; + segment->burnTickDamage = burnTickDamage; + segment->magnetizedCountdown = magnetizedCountdown; + segment->baitedCountdown = baitedCountdown; + segment->knockbackCountdown = knockbackCountdown; + segment->knockbackDirection = knockbackDirection; + segment->iceCountdown = iceCountdown; + segment->weaknessCountdown = weaknessCountdown; + segment->brimstoneMarkCountdown = brimstoneMarkCountdown; + segment->shrinkStatus1 = shrinkStatus1; + segment->shrinkStatus2 = shrinkStatus2; + + bool isBossLike = IsBoss() || isVersusPlayer; + bool isSegmentBossLike = segment->IsBoss() || (g_game->deathmatchManager.is_active() && + segment->type == ENTITY_PLAYER); + if (isBossLike && isSegmentBossLike) segment->bossStatusEffectCooldown = bossStatusEffectCooldown; + } +} + +// 006b62b0 The index hits on it are recorded under: its body's for segmented bosses that share them. +uint32_t Entity::GetHitListIndex() +{ + if (!is_enemy_type(type) || (g_game->deathmatchManager.is_active() && type == ENTITY_PLAYER)) return index; + if (!is_segmented(*this) || type == ENTITY_BUTTLICKER || type == ENTITY_LARRYJR) return index; + if ((type == ENTITY_CHUB && variant == 2) || (type == ENTITY_PIN && variant == 1)) + { + if (child) return index; + } + return GetStatusEffectTarget()->index; +} + +// 006ac7e0 +int Entity::CountRelatedEntities(int, int, std::vector*) +{ + reconstruction_missing("Entity::CountRelatedEntities 006ac7e0"); +} + +// 006ac530 Whether it is an enemy, or a player in a versus match. +bool Entity::IsEnemy() +{ + return is_enemy_type(type); +} + +// 006ac6c0 Whether its grid collision ignores everything but walls. +bool Entity::IsFlying() +{ + return entityGridCollisionClass == GRIDCOLL_NONE || entityGridCollisionClass == GRIDCOLL_WALLS || + entityGridCollisionClass == GRIDCOLL_WALLS_X || entityGridCollisionClass == GRIDCOLL_WALLS_Y; +} + +// 006ac560 Whether the source can hurt it as an enemy: collidable, mortal, targetable, and not on the source's side. +bool Entity::IsVulnerableEnemy(Entity* source) +{ + bool isVersus = g_game->deathmatchManager.is_active(); + if (isVersus && source && source->type == ENTITY_PLAYER && IsDescendantOf(source)) return false; + if (!is_enemy_type(type)) return false; + if (entityCollisionClass == ENTCOLL_PLAYERONLY || entityCollisionClass == ENTCOLL_NONE) return false; + if (isInvincible || isDead) return false; + if (HasEntityFlags(FLAG_NO_TARGET) && type != ENTITY_BLOOD_PUPPY && type != ENTITY_DARK_ESAU) return false; + if (!source || !IsFriendly()) return true; + + Entity* origin = source->GetLastSpawner(); + return !origin->IsFriendly() && origin->type != ENTITY_PLAYER && origin->type != ENTITY_FAMILIAR; +} + +// 006b5b90 Whether it is an enemy that counts as active, alive unless the dead are included. +bool Entity::IsActiveEnemy(DeadMode mode) +{ + if (!(g_game->deathmatchManager.is_active() && type == ENTITY_PLAYER)) + { + if (type < ENTITY_FIRST_ENEMY || type > ENTITY_LAST_ENEMY) return false; + if (type == ENTITY_FIREPLACE || type == ENTITY_SHOPKEEPER || type == ENTITY_MOVABLE_TNT) return false; + if (type == ENTITY_CULTIST && variant == 10) return false; + if (type == ENTITY_GENERIC_PROP || type == ENTITY_MINECART || type == ENTITY_POOP) return false; + } + return !isDead || mode == DEAD_INCLUDED; +} + +// 006d7d60 Whether the other is on the opposite side: charmed and friendly entities side with the players. +bool Entity::IsHostileTo(Entity* other) +{ + if (HasEntityFlags(FLAG_CHARM) && !IsFriendly()) return true; + + bool isEnemySide = !IsFriendly(); + bool isOtherPlayerSide = other->type == ENTITY_PLAYER || other->type == ENTITY_BOMB || + (other->type == ENTITY_FAMILIAR && !other->HasEntityFlags(FLAG_CHARM)) || + other->IsFriendly(); + return !isOtherPlayerSide != isEnemySide; +} + +// 006acd10 Whether damage from the source is the players' own, while it is friendly or charmed by a player. +bool Entity::IsDamageSourceFriendly(const EntityRef& source) +{ + bool isVersus = g_game->deathmatchManager.is_active(); + if (type == ENTITY_PLAYER && source.type == ENTITY_PLAYER && !isVersus) return true; + + Entity* charmer = charmSource.entity; + bool isPlayerCharmed = HasEntityFlags(FLAG_CHARM) && charmer && charmer->type == ENTITY_PLAYER && + charmedCountdown == 0; + bool isFriendly = IsFriendly() || (type == ENTITY_FAMILIAR && !HasEntityFlags(FLAG_CHARM | FLAG_FRIENDLY)) || + isPlayerCharmed; + if (!isFriendly) return false; + + bool isPlayerSource = source.spawnerType == ENTITY_PLAYER || source.type == ENTITY_PLAYER || + source.type == ENTITY_KNIFE || source.spawnerType == ENTITY_FAMILIAR || + source.type == ENTITY_FAMILIAR || (source.flags & ENTITY_REF_FRIENDLY) || + (source.type == ENTITY_EFFECT && Entity_Effect::IsPlayerCreep(source.variant)); + if (isVersus && !IsDescendantOf(source.entity)) + { + if (!source.entity || !source.entity->IsDescendantOf(charmSource.entity)) return false; + } + return is_enemy_type(type) && isPlayerSource; +} + +// 006a8f20 Whether it is an enemy that holds the room's doors shut as a living, hostile foe. +bool Entity::is_valid_boss_enemy() +{ + return is_enemy_type(type) && CanShutDoors() && type != ENTITY_DARK_ESAU && !IsFriendly(); +} + +// 006d8990 +bool Entity::is_valid_target() +{ + reconstruction_missing("Entity::is_valid_target 006d8990"); +} + +// 006a8f80 Whether its config lists anything it can devolve into. +bool Entity::CanDevolve() +{ + return config && !config->devolve.empty(); +} + +// 006b9740 +bool Entity::IsPlayerInRadius(const Vector&, float) +{ + reconstruction_missing("Entity::IsPlayerInRadius 006b9740"); +} + +// 007e9130 The boss id its config gives, 0 without one. +int Entity::GetBossID() +{ + return config ? config->bossID : 0; +} + +// 006a93a0 Sets it up as a fresh entity of the type: config stats, full health, default state and no status. +void Entity::Init(int entityType, int entityVariant, int entitySubType, uint32_t seed) +{ + type = entityType; + variant = entityVariant; + subtype = entitySubType; + initSeed = seed; + dropRNG.SetSeed(seed, DROP_RNG_SHIFT_INDEX); + splatColor = COLOR_DEFAULT; + LoadEntityConfig(); + + friction = baseFriction; + shadowOffset = {}; + pauseTimer = 0; + index = 0; + collisionIndex = 0; + spawnFrame = g_game->frameCount; + health = maxHitPoints; + spawnGridIndex = -1; + targetPosition = {}; + speedMultiplier = 1; + prevUpdateTime = UPDATE_TIME_START; + updateTime = 0; + posOffset = {}; + renderZOffset = 0; + renderDepthOffset = 0; + sortingLayer = SORTING_NORMAL; + isVisible = true; + isExists = true; + isDead = false; + isKillOnTouch = false; + isUnknown176 = false; + isRemovedByFactory = false; + entityCollisionClass = ENTCOLL_ALL; + isCollidesWithEntity = false; + isCollidesWithGrid = false; + gridCollisionNormal = {}; + gridCollisionVelocity = {}; + color = COLOR_DEFAULT; + + fireDamageCountdown = 0; + damageCountdown = 0; + freezeCountdown = 0; + poisonCountdown = 0; + poisonTickDamage = STATUS_TICK_DAMAGE_DEFAULT; + burnTickDamage = STATUS_TICK_DAMAGE_DEFAULT; + slowingCountdown = 0; + slowingAmount = SLOWING_AMOUNT_DEFAULT; + charmedCountdown = 0; + confusionCountdown = 0; + midasFreezeCountdown = 0; + fearCountdown = 0; + burnCountdown = 0; + shrinkCountdown = 0; + bleedingCountdown = 0; + bleedDamageAccumulator = 0; + poisonDamageTimer = 0; + burnDamageTimer = 0; + magnetizedCountdown = 0; + baitedCountdown = 0; + knockbackCountdown = 0; + iceCountdown = 0; + weaknessCountdown = 0; + brimstoneMarkCountdown = 0; + magnetizedEffect = nullptr; + bossStatusEffectCooldown = 0; + flags = 0; + + damageEvents.clear(); + pendingDamage = 0; + pendingDamageFlags = 0; + isInvincible = false; + isInterpolating = false; + holdCountdown = 0; + shrinkStatus1 = 1; + shrinkStatus2 = 1; + parent = nullptr; + child = nullptr; + target = nullptr; + minecart = nullptr; + hitEffect = nullptr; + prevPosition = pos; + prevVelocity = velocity; + pitfallState = 0; + pitfallTimer = 0; + pausePosition = {}; + ResetColor(); + + scoreMultiplier = 1; + bool isAngelKilled = (type == ENTITY_GABRIEL && (g_game->gameStateFlags >> GABRIEL_SPAWNED_BIT & 1)) || + (type == ENTITY_URIEL && (g_game->gameStateFlags >> URIEL_SPAWNED_BIT & 1)); + if (isAngelKilled) scoreMultiplier = 0; + data_release(); +} + +// 006a98b0 Takes its stats from its config (preloading its resources), or defaults with a log line without one. +void Entity::LoadEntityConfig() +{ + EntityConfig& entityConfig = g_manager->entityConfig; + EntityConfig_Entity* found = entityConfig.GetEntity(type, variant, subtype); + if (found) entityConfig.PreloadResources(found); + + config = entityConfig.GetEntity(type, variant, subtype); + if (!config) + { + size = 1; + sizeMulti = vector_make(1, 1); + shadowSize = SHADOW_SIZE_DEFAULT; + collisionDamage = 0; + maxHitPoints = 0; + mass = 0; + collisionPoints.clear(); + entityGridCollisionClass = GRIDCOLL_WALLS; + baseFriction = 1; + log_format(LOG_INFO, "config for entity %d.%d is missing\n", type, variant); + return; + } + + shadowSize = config->shadowSize; + collisionDamage = config->collisionDamage; + mass = config->mass; + maxHitPoints = config->baseHP; + if (STAGE_HP_MIN < config->stageHP) + { + float stage = std::min((float)g_game->stage, STAGE_HP_CAP); + float scale = g_game->stage < STAGE_HP_REDUCED_FROM ? 1 : STAGE_HP_REDUCED_SCALE; + maxHitPoints = stage * scale * config->stageHP + config->baseHP; + } + + size = 0; + sizeMulti = {}; + SetSize(config->collisionRadius, config->collisionRadiusMulti, config->gridCollisionPoints); + baseFriction = config->friction; + + const std::string& gridClass = config->gridCollisionClassString; + if (gridClass.empty()) entityGridCollisionClass = collisionPoints.empty() ? GRIDCOLL_WALLS : GRIDCOLL_GROUND; + else if (gridClass == "none") entityGridCollisionClass = GRIDCOLL_NONE; + else if (gridClass == "walls") entityGridCollisionClass = GRIDCOLL_WALLS; + else if (gridClass == "ground") entityGridCollisionClass = GRIDCOLL_GROUND; + else if (gridClass == "nopits") entityGridCollisionClass = GRIDCOLL_NOPITS; + else log_format(LOG_ASSERT, "Invalid grid collision class for entity config %d.%d.%d", type, variant, subtype); +} + +// 006ae7d0 Remembers where it was and how it moved before this update. +void Entity::PreUpdate() +{ + prevPosition = pos; + prevVelocity = velocity; +} + +// 006ae820 Advances its sprite and its own clock, moves it under friction and knockback, then ticks its timed colors +// and status effects, applies the damage queued since the last update, and hurts it with poison and burns. +void Entity::Update() +{ + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) + { + prevUpdateTime = updateTime; + updateTime = speedMultiplier + updateTime; + bool isHeld = HasEntityFlags(FLAG_FREEZE) || holdCountdown > 0; + if ((!isHeld || isDead) && !HasEntityFlags(FLAG_NO_SPRITE_UPDATE) && sprite.isLoaded) + { + float playbackSpeed = sprite.playbackSpeed * speedMultiplier; + sprite.animState.Update(playbackSpeed); + sprite.overlayAnimState.Update(playbackSpeed); + } + } + if (HasEntityFlags(FLAG_KNOCKED_BACK)) knockback_update(); + + float frameFriction = friction; + if (speedMultiplier != 1) + frameFriction = frameFriction / ((frameFriction + speedMultiplier) - frameFriction * speedMultiplier); + velocity = vector_make(frameFriction * velocity.x, frameFriction * velocity.y); + pos.y = speedMultiplier * velocity.y + pos.y; + pos.x = speedMultiplier * velocity.x + pos.x; + friction = baseFriction; + + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) + { + color_params_update(); + status_effects_update(); + } + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) damage_events_update(); + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) status_damage_update(); + + Room& room = *g_game->room; + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE) && room.waterAmount > 0 && + g_manager->optionsConfig.render.isWaterSurfaceEnabled) + reconstruction_missing("Entity::Update 006ae820: the water ripples it leaves (get_water_splash_variant)"); + + if (std::fabs(pos.x) + std::fabs(pos.y) >= POSITION_LIMIT) + log_format(LOG_ASSERT, "Invalid entity position detected: %.2f, %.2f (%d.%d.%d)\n", pos.x, pos.y, type, variant, + subtype); +} + +// A heavy knockback's push: it keeps the entity moving, slowing, until it is spent or something stops it. +void Entity::knockback_update() +{ + bool isPushing = isCollidesWithGrid || vector_length(velocity) < vector_length(knockbackDirection) || + knockbackDirection.x * velocity.x + knockbackDirection.y * velocity.y >= 0; + if (!isPushing || vector_length(knockbackDirection) < KNOCKBACK_MIN_SPEED) + { + ClearEntityFlags(FLAG_KNOCKED_BACK | FLAG_APPLY_IMPACT_DAMAGE); + knockbackCountdown = 0; + return; + } + + friction = baseFriction * KNOCKBACK_DECAY; + if (!HasEntityFlags(FLAG_ICE_FROZEN)) + { + knockbackDirection.x = knockbackDirection.x * KNOCKBACK_DECAY; + knockbackDirection.y = knockbackDirection.y * KNOCKBACK_DECAY; + } + if (isCollidesWithGrid) + { + if (HasEntityFlags(FLAG_APPLY_IMPACT_DAMAGE)) + reconstruction_missing("Entity::Update 006ae820: the damage a knocked back entity takes hitting a wall"); + knockbackCountdown = knockbackCountdown / 2; + } + velocity = knockbackDirection; +} + +// Counts down the timed colors and shows the top one, fading toward the next when it fades. +void Entity::color_params_update() +{ + bool isChanged = false; + + for (auto it = colorParams.begin(); it != colorParams.end();) + { + it->remaining--; + if (it->isFadeout) isChanged = true; + if (it->remaining == 0) + { + it = colorParams.erase(it); + isChanged = true; + } + else + ++it; + } + if (!isChanged) return; + if (colorParams.empty()) return ResetColor(); + + const ColorParams& top = colorParams.front(); + sprite.color = top.color; + if (!top.isFadeout) return; + + const ColorMod& next = colorParams.size() < 2 ? color : colorParams[1].color; + sprite.color = color_lerp(top.color, next, 1 - (float)top.remaining / (float)top.duration); +} + +// Applies the status effects the run's seeds force on enemies, then counts every status effect down. +void Entity::status_effects_update() +{ + Seeds& seeds = g_game->seedEffects; + if (!HasEntityFlags(FLAG_NO_STATUS_EFFECTS) && is_enemy_type(type)) + { + if (seeds.HasSeedEffect(SEED_ALWAYS_CHARMED) || seeds.HasSeedEffect(SEED_ALWAYS_CHARMED_AND_AFRAID)) + { + AddEntityFlags(FLAG_CHARM); + charmedCountdown = SEED_STATUS_FRAMES; + } + if (seeds.HasSeedEffect(SEED_ALWAYS_CONFUSED)) + { + AddEntityFlags(FLAG_CONFUSION); + confusionCountdown = SEED_STATUS_FRAMES; + } + bool isFearPhase = (FrameCount() / ALTERNATING_FEAR_FRAMES & 1) == 0; + if (seeds.HasSeedEffect(SEED_ALWAYS_AFRAID) || seeds.HasSeedEffect(SEED_ALWAYS_CHARMED_AND_AFRAID) || + (seeds.HasSeedEffect(SEED_ALWAYS_ALTERNATING_FEAR) && isFearPhase)) + { + AddEntityFlags(FLAG_FEAR); + fearCountdown = SEED_STATUS_FRAMES; + } + } + + // A countdown that reaches zero clears its flag. + auto countdown = [this](int& frames, uint64_t flag) + { + if (frames <= 0 || --frames >= 1) return false; + ClearEntityFlags(flag); + return true; + }; + + if (fireDamageCountdown > 0) fireDamageCountdown--; + if (damageCountdown > 0) damageCountdown--; + countdown(freezeCountdown, FLAG_FREEZE); + if (countdown(poisonCountdown, FLAG_POISON)) poisonTickDamage = STATUS_TICK_DAMAGE_DEFAULT; + countdown(slowingCountdown, FLAG_SLOW); + if (countdown(charmedCountdown, FLAG_CHARM)) target = nullptr; + countdown(confusionCountdown, FLAG_CONFUSION); + countdown(fearCountdown, FLAG_FEAR); + if (shrinkStatus2 != shrinkStatus1) shrinkStatus1 = (shrinkStatus2 - shrinkStatus1) * SHRINK_EASE + shrinkStatus1; + if (countdown(shrinkCountdown, FLAG_SHRINK)) + { + SetSize(config->collisionRadius, vector_make(-1, -1), -1); + shrinkStatus2 = 1; + } + + int flicker = FrameCount() % FLICKER_COLORS; + if (burnCountdown > 0) + { + if (countdown(burnCountdown, FLAG_BURN)) burnTickDamage = STATUS_TICK_DAMAGE_DEFAULT; + SetColor(BURN_COLORS[flicker], 1, STATUS_COLOR_PRIORITY, false, true); + } + countdown(midasFreezeCountdown, FLAG_MIDAS_FREEZE); + if (bleedingCountdown > 0) + { + if (countdown(bleedingCountdown, FLAG_BLEED_OUT)) bleedDamageAccumulator = 0; + float moved = vector_length(vector_make(pos.x - prevPosition.x, pos.y - prevPosition.y)); + float t = std::clamp((moved * BLEED_FLICKER_SCALE) / speedMultiplier, 0.0f, 1.0f); + uint32_t bleedFlicker = (uint32_t)FrameCount() % FLICKER_COLORS; + SetColor(color_lerp(COLOR_DEFAULT, BLEED_COLORS[bleedFlicker], t), 1, STATUS_COLOR_PRIORITY, false, true); + } + countdown(magnetizedCountdown, FLAG_MAGNETIZED); + if (countdown(baitedCountdown, FLAG_BAITED)) + { + for (Entity* enemy : g_game->room->entityList.updateEL) + { + bool isLured = enemy->target.get() == this && !enemy->HasEntityFlags(FLAG_CHARM | FLAG_FRIENDLY); + if (is_enemy_type(enemy->type) && isLured) enemy->target = nullptr; + } + } + countdown(weaknessCountdown, FLAG_WEAKNESS); + if (magnetizedEffect && !HasEntityFlags(FLAG_MAGNETIZED)) magnetizedEffect->Remove(); + countdown(knockbackCountdown, FLAG_KNOCKED_BACK | FLAG_APPLY_IMPACT_DAMAGE); + countdown(iceCountdown, FLAG_ICE); + countdown(brimstoneMarkCountdown, FLAG_BRIMSTONE_MARKED); + if (bossStatusEffectCooldown > 0) bossStatusEffectCooldown--; + if (holdCountdown > 0) holdCountdown--; +} + +// Takes the damage queued since the last update, flashing on each hit and dying on a fatal one. +void Entity::damage_events_update() +{ + if (!isInvincible) + { + bool isFatal = false; + EntityRef fatalSource; + + for (const DamageEvent& event : damageEvents) + { + if (event.damage <= 0) continue; + if (g_game->debugFlags & DEBUG_DAMAGE_VALUES) + reconstruction_missing("Entity::Update 006ae820: the debug damage numbers (spawn_debug_damage_text)"); + + bool isHiss = (event.damageFlags & (DAMAGE_FIRE | DAMAGE_POOP)) && !(event.damageFlags & DAMAGE_EXPLOSION); + if (isHiss) + { + int sound = SOUND_FIREDEATH_HISS; + seed_fart_sound_override(&sound); + g_manager->sfxManager.Play(sound); + } + + health -= event.damage; + if (health > 0 || (event.damageFlags & DAMAGE_NOKILL)) + { + if (HasEntityFlags(FLAG_NO_FLASH_ON_DAMAGE)) continue; + if (health < 0) health = 0; + int frames = ((int)(event.damage + HALF) + 2) / HIT_FLASH_DIVISOR; + frames = std::clamp(frames, HIT_FLASH_MIN, HIT_FLASH_MAX); + bool isHugeBoss = type == ENTITY_HUSH || type == ENTITY_BEAST; + SetColor(isHugeBoss ? HUGE_BOSS_HIT_COLOR : HIT_COLOR, frames, 0, false, false); + } + else + { + fatalSource = event.source; + isFatal = true; + } + } + if (isFatal) Kill(fatalSource); + } + damageEvents.clear(); + pendingDamage = 0; + pendingDamageFlags = 0; +} + +// Poisons and burns an enemy every twentieth frame of the effect, then bleeds it and pulls it in when magnetized. +void Entity::status_damage_update() +{ + if (is_enemy_type(type)) + { + if (HasEntityFlags(FLAG_POISON) && poisonDamageTimer++ % STATUS_DAMAGE_INTERVAL == STATUS_DAMAGE_PHASE) + { + SetColor(POISON_COLOR, STATUS_COLOR_FRAMES, STATUS_COLOR_PRIORITY, false, true); + TakeDamage(poisonTickDamage, DAMAGE_POISON_BURN, EntityRef(), 0); + } + if (HasEntityFlags(FLAG_BURN) && burnDamageTimer++ % STATUS_DAMAGE_INTERVAL == STATUS_DAMAGE_PHASE) + { + SetColor(BURN_COLOR, STATUS_COLOR_FRAMES, STATUS_COLOR_PRIORITY, false, true); + TakeDamage(burnTickDamage, DAMAGE_POISON_BURN, EntityRef(), 0); + } + if (HasEntityFlags(FLAG_BLEED_OUT) && !IsDescendantOf(bleedSource.entity)) + reconstruction_missing("Entity::Update 006ae820: the bleeding of Mom's Razor and the creep it leaves"); + } + if (!isDead && HasEntityFlags(FLAG_MAGNETIZED)) + reconstruction_missing("Entity::Update 006ae820: the pull of a magnetized entity"); +} + +// 006b0eb0 Moves it half a step for the in-between frame and resolves the grid, unless told to skip one. +void Entity::Interpolate() +{ + if (HasEntityFlags(FLAG_NO_INTERPOLATE)) + { + ClearEntityFlags(FLAG_NO_INTERPOLATE); + return; + } + + preInterpolatePos = pos; + isInterpolating = true; + pos.x = friction * velocity.x * speedMultiplier * HALF + pos.x; + pos.y = friction * velocity.y * speedMultiplier * HALF + pos.y; + if (type != ENTITY_PLAYER) return CollideWithGrid(GRID_COLLISION_SIMULATE); + + PlayerCollideWithGrid(GRID_COLLISION_SIMULATE); + if (variant != PLAYER_VARIANT_COOP_BABY) return; + + pos = g_game->room->GetClampedPositionImpl(pos, size, size, size, size); + posOffset.y = GHOST_BOB_HEIGHT * std::sin(((float)g_game->frameCount + HALF) * GHOST_BOB_SPEED); +} + +// 006b1000 Its place in the draw order: the background and door layers by spawn order, the normal layer by depth. +int Entity::GetRenderZ() +{ + int order = (int)(index & RENDER_INDEX_MASK) + renderZOffset; + + if (sortingLayer == SORTING_BACKGROUND) + return std::max(0, std::min(order + RENDER_Z_BACKGROUND_BASE, RENDER_Z_BACKGROUND_MAX)); + if (sortingLayer == SORTING_DOOR) + return std::max(RENDER_Z_DOOR_MIN, std::min(order + RENDER_Z_DOOR_BASE, RENDER_Z_DOOR_MAX)); + if (g_game->room->roomType == ROOM_DUNGEON) + return std::max((int)RENDER_Z_NORMAL_MIN, order + RENDER_Z_DUNGEON_BASE); + + return std::max((int)RENDER_Z_NORMAL_MIN, render_z_get(renderDepthOffset + pos.y) + renderZOffset); +} + +// 006a8120 The draw order of a depth on the normal layer: its y position in hundredths, after the layers below. +int render_z_get(float depth) +{ + float order = std::floor(depth * RENDER_Z_DEPTH_SCALE + RENDER_Z_DEPTH_BASE + HALF); + return (int)(uint32_t)std::max(order, RENDER_Z_NORMAL_MIN); +} + +// 006b10d0 Whether EntityFactory may reuse it for a new entity when its pool is full. +bool Entity::CanOverwrite() +{ + return !HasEntityFlags(FLAG_DONT_OVERWRITE); +} + +// 006b10f0 Draws its sprite where it stands on screen, shifted by offset. +void Entity::Render(const Vector& offset) +{ + if (!isExists || !isVisible) return; + + renderPosition = vector_add(render_position_get(vector_add(pos, posOffset), RENDER_SNAPPED), offset); + sprite.Render(SpriteDraw{renderPosition, {}, {}}); +} + +// 006b1260 Draws the debug overlays the console turns on. +void Entity::PostRender() +{ + uint32_t debugFlags = g_game->debugFlags; + bool isPositionShown = (debugFlags & DEBUG_ENTITY_POSITIONS) && type != ENTITY_LASER; + bool isGridShown = (debugFlags & DEBUG_GRID_COLLISION) && entityGridCollisionClass != GRIDCOLL_NONE; + bool isHitsphereShown = (debugFlags & DEBUG_HITSPHERES) && size > 0 && entityCollisionClass != ENTCOLL_NONE; + if (isPositionShown || isGridShown || isHitsphereShown) + reconstruction_missing("Entity::PostRender 006b1260: the debug overlays"); +} + +// 006b2000 Draws only its sprite's shadow layer, uncolored, under it. +bool Entity::RenderShadowLayer(const Vector& offset) +{ + Vector position = vector_add(render_position_get(vector_add(pos, shadowOffset), RENDER_SNAPPED), offset); + if (sprite.shadowLayerIndex == NO_SHADOW_LAYER) return false; + + LayerState* shadow = sprite.GetLayer(sprite.shadowLayerIndex); + ColorMod saved = sprite.color; + + shadow->isVisible = true; + sprite.color = COLOR_DEFAULT; + sprite.RenderLayer(sprite.shadowLayerIndex, SpriteDraw{position, {}, {}}); + sprite.color = saved; + shadow->isVisible = false; + return true; +} + +// 006b2fa0 Lays a color over it: for good without a duration, else timed by priority. A shared color spreads to +// the rest of its body. +void Entity::SetColor(const ColorMod& newColor, int duration, int priority, bool isFadeout, bool isShared) +{ + if (duration < 1) + { + color = newColor; + ResetColor(); + } + else + { + ColorParams params = {newColor, duration, priority, duration, isFadeout, isShared}; + auto at = std::find_if(colorParams.begin(), colorParams.end(), + [priority](const ColorParams& other) { return other.priority >= priority; }); + colorParams.insert(at, params); + sprite.color = colorParams.front().color; + } + if (DoesEntityShareStatus() && isShared && child) + child->SetColor(newColor, duration, priority, isFadeout, isShared); +} + +// 005ccbe0 +void Entity::SetCollisionDamage(float damage) +{ + collisionDamage = damage; +} + +// 006ac6e0 Shows its own color again. +void Entity::ResetColor() +{ + sprite.color = color; +} + +// 006b63b0 The way it faces: along its motion, or down while it is still. +Vector Entity::GetForwardVector() +{ + float speedSquared = velocity.x * velocity.x + velocity.y * velocity.y; + if (speedSquared <= 0.01f) return vector_make(0, 1); + + float length = vector_length(velocity); + return length > 0 ? vector_make(velocity.x * (1 / length), velocity.y * (1 / length)) : velocity; +} + +// 006a8ee0 Whether it may target the other: not itself, its own body, or another ring of flies. +bool Entity::IsValidTarget(Entity* other) +{ + if (other == this || is_same_segmented_body(other)) return false; + return type != ENTITY_RING_OF_FLIES || other->type != ENTITY_RING_OF_FLIES; +} + +// 006ac920 Kills it once: counts the kill for the player behind the source, bursts it, and runs the Lua callback. +void Entity::Kill(const EntityRef& source) +{ + if (isDead) return; + isDead = true; + + Entity* killer = source.entity ? source.entity->GetPlayerAncestor() : nullptr; + bool isScored = type > ENTITY_PROJECTILE && type != ENTITY_EFFECT; + if (killer && type == ENTITY_FIREPLACE) + { + bool isPowderable = variant == FIREPLACE_NORMAL || variant == FIREPLACE_RED || variant == FIREPLACE_MOVEABLE; + if (static_cast(killer)->HasCollectible(COLLECTIBLE_BLACK_POWDER) && + isPowderable) + reconstruction_missing("Entity::Kill 006ac920: Black Powder's fireplace blast (BombExplosionEffects)"); + } + else if (killer && isScored) + { + Entity_Player* player = static_cast(killer); + Player_stats_add(&g_game->onlinePlayerStats, STAT_KILLS, player, 1); + if (IsBoss()) + { + Player_stats_add(&g_game->onlinePlayerStats, STAT_BOSS_KILLS, player, 1); + if (player->isCoopGhost) Player_stats_add(&g_game->onlinePlayerStats, STAT_GHOST_BOSS_KILLS, player, 1); + } + } + if (!IsBoss() && type != ENTITY_FAMILIAR) BloodExplode(); + static_cast(g_luaEngine)->PostEntityKill(this); +} + +// 006acb00 Takes it out of the game: it stops existing and counts as dead, and Lua forgets it. +void Entity::Remove() +{ + isExists = false; + isDead = true; + ReleaseLuaRef(this); + data_release(); +} + +// 006acb60 Unlinks it from every entity it points to and nulls every pointer to it, removing its magnet effect. +// An entity in a list also drops its colors, damage, collision points and sprite. +void Entity::ClearReferences() +{ + parent = nullptr; + child = nullptr; + target = nullptr; + spawnerEntity = nullptr; + minecart = nullptr; + hitEffect = nullptr; + if (magnetizedEffect) magnetizedEffect->Remove(); + magnetizedEffect = nullptr; + + for (EntityPtr* referrer : referrers) referrer->forget(); + referrers.clear(); + if (!isValid) return; + + colorParams.clear(); + damageEvents.clear(); + collisionPoints.clear(); + sprite.Reset(); +} + +// 00866060 Runs MC_POST_ENTITY_REMOVE for it, which also lets Lua forget it. +void Entity::ReleaseLuaRef(Entity*) +{ + LuaEngine& lua = *static_cast(g_luaEngine); + if (lua.enabledCallbacks[LUA_CALLBACK_POST_ENTITY_REMOVE]) + reconstruction_missing("Entity::ReleaseLuaRef 00866060: MC_POST_ENTITY_REMOVE"); +} + +// 006b6af0 Where its sprite's null layer sits from its position, scaled, flipped and turned with the sprite, or zero +// while the null is hidden or missing. +Vector Entity::GetNullOffset(std::string_view nullLayerName) +{ + if (!sprite.animState.animData) return {}; + + const NullFrame* frame = sprite.animState.GetNullFrame(nullLayerName); + if (!frame || !frame->isVisible) return {}; + + Vector offset = vector_make((frame->pos.x / ROOM_SCREEN_SCALE) * sprite.scale.x, + (frame->pos.y / ROOM_SCREEN_SCALE) * sprite.scale.y); + if (sprite.isFlipX) offset.x = -offset.x; + if (sprite.isFlipY) offset.y = -offset.y; + if (sprite.rotation == 0) return offset; + + float angle = sprite.rotation * DEGREES_TO_RADIANS; + float cosine = std::cos(angle); + float sine = std::sin(angle); + return vector_make(cosine * offset.x - sine * offset.y, cosine * offset.y + sine * offset.x); +} + +// 0085dcb0 Shows a frame of an animation, stopped. +void Entity::SetSpriteFrame(std::string_view animation, int frame) +{ + if (!sprite.SetAnimation(animation, SWITCH_KEEP_FRAME) || !sprite.animState.animData) return; + + sprite.animState.SetFrameFloat((float)frame); + if (sprite.animState.animData) sprite.animState.isPlaying = false; +} + +// 0085dd00 Shows a frame of an overlay animation. +void Entity::SetSpriteOverlayFrame(std::string_view animation, int frame) +{ + if (!sprite.SetOverlayAnimation(animation, SWITCH_KEEP_FRAME) || !sprite.overlayAnimState.animData) return; + sprite.overlayAnimState.SetFrameFloat((float)frame); +} + +// The rest of Entity is not reconstructed yet. + +// 0060af70 +Entity* Entity::AddFear(int, int, int) +{ + reconstruction_missing("Entity::AddFear 0060af70"); +} + +// 0064bb70 +void Entity::convert_shot_for_enemy_owner(Entity*) +{ + reconstruction_missing("Entity::convert_shot_for_enemy_owner 0064bb70"); +} + +// 006a9c90 +void Entity::CollideWithGrid(GridCollisionMode) +{ + reconstruction_missing("Entity::CollideWithGrid 006a9c90"); +} + +// 006ab240 +bool Entity::is_grid_collision_at(const Vector&) +{ + reconstruction_missing("Entity::is_grid_collision_at 006ab240"); +} + +// 006ab440 +void Entity::PlayerCollideWithGrid(GridCollisionMode) +{ + reconstruction_missing("Entity::PlayerCollideWithGrid 006ab440"); +} + +// 006ace60 +bool Entity::TakeDamage(float, uint64_t, const EntityRef&, int) +{ + reconstruction_missing("Entity::TakeDamage 006ace60"); +} + +// 006ad350 +int Entity::apply_second_hand_duration(int, const EntityRef&) +{ + reconstruction_missing("Entity::apply_second_hand_duration 006ad350"); +} + +// 006ad3c0 +void Entity::AddFreeze(const EntityRef&, int, bool) +{ + reconstruction_missing("Entity::AddFreeze 006ad3c0"); +} + +// 006ad500 +void Entity::AddPoison(const EntityRef&, int, float, bool) +{ + reconstruction_missing("Entity::AddPoison 006ad500"); +} + +// 006ad750 +void Entity::AddSlowing(const EntityRef&, int, float, ColorMod, bool) +{ + reconstruction_missing("Entity::AddSlowing 006ad750"); +} + +// 006ad870 +void Entity::AddCharmed(const EntityRef&, int, bool, bool) +{ + reconstruction_missing("Entity::AddCharmed 006ad870"); +} + +// 006add70 +void Entity::AddConfusion(const EntityRef&, int, bool) +{ + reconstruction_missing("Entity::AddConfusion 006add70"); +} + +// 006adf40 +void Entity::AddMidasFreeze(const EntityRef&, int, bool) +{ + reconstruction_missing("Entity::AddMidasFreeze 006adf40"); +} + +// 006ae0a0 +void Entity::AddFear(const EntityRef&, int, bool) +{ + reconstruction_missing("Entity::AddFear 006ae0a0"); +} + +// 006ae280 +void Entity::AddBurn(const EntityRef&, int, float, bool) +{ + reconstruction_missing("Entity::AddBurn 006ae280"); +} + +// 006ae420 +void Entity::AddBleeding(const EntityRef&, int) +{ + reconstruction_missing("Entity::AddBleeding 006ae420"); +} + +// 006ae630 +void Entity::RemoveStatusEffects() +{ + reconstruction_missing("Entity::RemoveStatusEffects 006ae630"); +} + +// 006b2210 +float Entity::collision_mass_get(Entity*) +{ + reconstruction_missing("Entity::collision_mass_get 006b2210"); +} + +// 006b25b0 +void Entity::push_apart_capsule(Entity*) +{ + reconstruction_missing("Entity::push_apart_capsule 006b25b0"); +} + +// 006b2940 +bool Entity::push_apart_circle(Entity*) +{ + reconstruction_missing("Entity::push_apart_circle 006b2940"); +} + +// 006b2ee0 +void Entity::collide_with_entity(Entity*) +{ + reconstruction_missing("Entity::collide_with_entity 006b2ee0"); +} + +// 006b2f50 +bool Entity::ForceCollide(Entity*, Entity*, bool) +{ + reconstruction_missing("Entity::ForceCollide 006b2f50"); +} + +// 006b45c0 +void Entity::BloodExplode() +{ + reconstruction_missing("Entity::BloodExplode 006b45c0"); +} + +// 006b5c10 +void Entity::AddShrink(const EntityRef&, int, bool) +{ + reconstruction_missing("Entity::AddShrink 006b5c10"); +} + +// 006b5e60 +void* Entity::GetData(void*) +{ + reconstruction_missing("Entity::GetData 006b5e60"); +} + +// 006b5f10 +void* Entity::GetDebugShape(bool) +{ + reconstruction_missing("Entity::GetDebugShape 006b5f10"); +} + +// 006b6550 +Entity_Effect* Entity::MakeGroundPoof(const Vector&, const ColorMod&, float) +{ + reconstruction_missing("Entity::MakeGroundPoof 006b6550"); +} + +// 006b66a0 +Entity_Effect* Entity::MakeGroundPoofAtSelf(const ColorMod&, float) +{ + reconstruction_missing("Entity::MakeGroundPoofAtSelf 006b66a0"); +} + +// 006b66c0 +Entity_Effect* Entity::MakeBloodPoof(const Vector&, const ColorMod&, float) +{ + reconstruction_missing("Entity::MakeBloodPoof 006b66c0"); +} + +// 006b6810 +Entity_Effect* Entity::MakeBloodPoofAtPos(const ColorMod&, float) +{ + reconstruction_missing("Entity::MakeBloodPoofAtPos 006b6810"); +} + +// 006b6c20 +void Entity::GetNullCapsule(Capsule&, std::string_view) +{ + reconstruction_missing("Entity::GetNullCapsule 006b6c20"); +} + +// 006b6ed0 +int Entity::get_water_splash_variant() +{ + reconstruction_missing("Entity::get_water_splash_variant 006b6ed0"); +} + +// 006b7280 +void Entity::AddMagnetized(const EntityRef&, int) +{ + reconstruction_missing("Entity::AddMagnetized 006b7280"); +} + +// 006b7560 +void Entity::AddBaited(const EntityRef&, int) +{ + reconstruction_missing("Entity::AddBaited 006b7560"); +} + +// 006b77d0 +void Entity::AddWeakness(const EntityRef&, int) +{ + reconstruction_missing("Entity::AddWeakness 006b77d0"); +} + +// 006b78d0 +void Entity::AddBrimstoneMark(const EntityRef&, int) +{ + reconstruction_missing("Entity::AddBrimstoneMark 006b78d0"); +} + +// 006b79d0 +void Entity::AddIce(const EntityRef&, int) +{ + reconstruction_missing("Entity::AddIce 006b79d0"); +} + +// 006b7be0 +Entity_NPC* Entity::GiveMinecart(const Vector&, const Vector&) +{ + reconstruction_missing("Entity::GiveMinecart 006b7be0"); +} + +// 007079c0 +void Entity::RemoveWithPoof(Entity*) +{ + reconstruction_missing("Entity::RemoveWithPoof 007079c0"); +} + +// 0070c000 +void Entity::DestroyRockGridAt(const Vector&, GridEntityDesc*, Entity*, int) +{ + reconstruction_missing("Entity::DestroyRockGridAt 0070c000"); +} + +// 0085e680 +int Entity::IsVulnerableEnemy_lua(lua_State*) +{ + reconstruction_missing("Entity::IsVulnerableEnemy_lua 0085e680"); +} + +// 008c5cf2 +void Entity::KillWithSource() +{ + reconstruction_missing("Entity::KillWithSource 008c5cf2"); +} diff --git a/src/entity.h b/src/entity.h new file mode 100644 index 0000000..9ceb872 --- /dev/null +++ b/src/entity.h @@ -0,0 +1,568 @@ +#pragma once + +#include "anm2.h" +#include "classes.h" +#include "seeds.h" +#include +#include +#include +#include + +// The entity types the base classes tell apart, as Lua's EntityType names them. +enum EntityType : int +{ + ENTITY_NULL = 0, + ENTITY_PLAYER = 1, + ENTITY_TEAR = 2, + ENTITY_FAMILIAR = 3, + ENTITY_BOMB = 4, + ENTITY_PICKUP = 5, + ENTITY_SLOT = 6, + ENTITY_LASER = 7, + ENTITY_KNIFE = 8, + ENTITY_PROJECTILE = 9, + ENTITY_SHOPKEEPER = 17, + ENTITY_LARRYJR = 19, + ENTITY_CHUB = 28, + ENTITY_FIREPLACE = 33, + ENTITY_MRMAW = 35, + ENTITY_PIN = 62, + ENTITY_GEMINI = 79, + ENTITY_BUTTLICKER = 89, + ENTITY_HEART = 92, + ENTITY_MASK = 93, + ENTITY_MASK_OF_INFAMY = 97, + ENTITY_HEART_OF_INFAMY = 98, + ENTITY_SWINGER = 216, + ENTITY_RING_OF_FLIES = 222, + ENTITY_GRUB = 239, + ENTITY_ROUND_WORM = 244, + ENTITY_POOP = 245, + ENTITY_URIEL = 271, + ENTITY_GABRIEL = 272, + ENTITY_MOVABLE_TNT = 292, + ENTITY_HUSH = 407, + ENTITY_BLOOD_PUPPY = 802, + ENTITY_DARK_ESAU = 866, + ENTITY_CULTIST = 885, + ENTITY_SCOURGE = 909, + ENTITY_MOTHER = 912, + ENTITY_TURDLET = 918, + ENTITY_BEAST = 951, + ENTITY_GENERIC_PROP = 960, + ENTITY_FROZEN_ENEMY = 963, + ENTITY_MINECART = 965, + ENTITY_EFFECT = 1000, + ENTITY_TEXT = 9001 +}; + +// The types an enemy can have, both ends included. +constexpr int ENTITY_FIRST_ENEMY = 10; +constexpr int ENTITY_LAST_ENEMY = 997; + +// Lua's EntityFlag: the state and status effects an entity carries. +enum EntityFlag : uint64_t +{ + FLAG_NO_STATUS_EFFECTS = 1ull << 0, + FLAG_NO_INTERPOLATE = 1ull << 1, + FLAG_APPEAR = 1ull << 2, + FLAG_RENDER_FLOOR = 1ull << 3, + FLAG_NO_TARGET = 1ull << 4, + FLAG_FREEZE = 1ull << 5, + FLAG_POISON = 1ull << 6, + FLAG_SLOW = 1ull << 7, + FLAG_CHARM = 1ull << 8, + FLAG_CONFUSION = 1ull << 9, + FLAG_MIDAS_FREEZE = 1ull << 10, + FLAG_FEAR = 1ull << 11, + FLAG_BURN = 1ull << 12, + FLAG_RENDER_WALL = 1ull << 13, + FLAG_INTERPOLATION_UPDATE = 1ull << 14, + FLAG_APPLY_GRAVITY = 1ull << 15, + FLAG_NO_BLOOD_SPLASH = 1ull << 16, + FLAG_NO_REMOVE_ON_TEX_RENDER = 1ull << 17, + FLAG_NO_DEATH_TRIGGER = 1ull << 18, + FLAG_NO_SPIKE_DAMAGE = 1ull << 19, + FLAG_BOSSDEATH_TRIGGERED = 1ull << 20, + FLAG_DONT_OVERWRITE = 1ull << 21, + FLAG_SPAWN_STICKY_SPIDERS = 1ull << 22, + FLAG_SPAWN_BLACK_HP = 1ull << 23, + FLAG_SHRINK = 1ull << 24, + FLAG_NO_FLASH_ON_DAMAGE = 1ull << 25, + FLAG_NO_KNOCKBACK = 1ull << 26, + FLAG_SLIPPERY_PHYSICS = 1ull << 27, + FLAG_ADD_JAR_FLY = 1ull << 28, + FLAG_FRIENDLY = 1ull << 29, + FLAG_NO_PHYSICS_KNOCKBACK = 1ull << 30, + FLAG_DONT_COUNT_BOSS_HP = 1ull << 31, + FLAG_NO_SPRITE_UPDATE = 1ull << 32, + FLAG_CONTAGIOUS = 1ull << 33, + FLAG_BLEED_OUT = 1ull << 34, + FLAG_HIDE_HP_BAR = 1ull << 35, + FLAG_NO_DAMAGE_BLINK = 1ull << 36, + FLAG_PERSISTENT = 1ull << 37, + FLAG_BACKDROP_DETAIL = 1ull << 38, + FLAG_AMBUSH = 1ull << 39, + FLAG_GLITCH = 1ull << 40, + FLAG_SPIN = 1ull << 41, + FLAG_NO_REWARD = 1ull << 42, + FLAG_REDUCE_GIBS = 1ull << 43, + FLAG_TRANSITION_UPDATE = 1ull << 44, + FLAG_NO_PLAYER_CONTROL = 1ull << 45, + FLAG_NO_QUERY = 1ull << 46, + FLAG_KNOCKED_BACK = 1ull << 47, + FLAG_APPLY_IMPACT_DAMAGE = 1ull << 48, + FLAG_ICE_FROZEN = 1ull << 49, + FLAG_ICE = 1ull << 50, + FLAG_MAGNETIZED = 1ull << 51, + FLAG_BAITED = 1ull << 52, + FLAG_KILLSWITCH = 1ull << 53, + FLAG_WEAKNESS = 1ull << 54, + FLAG_EXTRA_GORE = 1ull << 55, + FLAG_BRIMSTONE_MARKED = 1ull << 56, + FLAG_HELD = 1ull << 57, + FLAG_THROWN = 1ull << 58, + FLAG_FRIENDLY_BALL = 1ull << 59 +}; + +// Lua's DamageFlag: what kind of damage a hit deals. +enum DamageFlag : uint64_t +{ + DAMAGE_NOKILL = 1ull << 0, + DAMAGE_FIRE = 1ull << 1, + DAMAGE_EXPLOSION = 1ull << 2, + DAMAGE_POOP = 1ull << 9, + DAMAGE_POISON_BURN = 1ull << 15 +}; + +// Lua's EntityGridCollisionClass: what of the room's grid an entity collides with. +enum GridCollisionClass : int +{ + GRIDCOLL_NONE, + GRIDCOLL_WALLS_X, + GRIDCOLL_WALLS_Y, + GRIDCOLL_WALLS, + GRIDCOLL_BULLET, + GRIDCOLL_GROUND, + GRIDCOLL_NOPITS, + GRIDCOLL_PITSONLY +}; + +// Lua's EntityCollisionClass: which other entities an entity collides with. +enum EntityCollisionClass : int +{ + ENTCOLL_NONE, + ENTCOLL_PLAYERONLY, + ENTCOLL_PLAYEROBJECTS, + ENTCOLL_ENEMIES, + ENTCOLL_ALL +}; + +// Lua's SortingLayer: where an entity draws among the others. +enum SortingLayer : int +{ + SORTING_BACKGROUND, + SORTING_DOOR, + SORTING_NORMAL +}; + +// What EntityRef::flags records of its entity's status. +enum EntityRefFlag : uint32_t +{ + ENTITY_REF_CHARMED = 1 << 0, + ENTITY_REF_FRIENDLY = 1 << 1, + ENTITY_REF_WEAKNESS = 1 << 2 +}; + +// Whether render_position_get snaps the position to whole screen pixels. +enum RenderSnap +{ + RENDER_UNSNAPPED, + RENDER_SNAPPED +}; + +// Whether IsActiveEnemy counts a dead entity. +enum DeadMode +{ + DEAD_EXCLUDED, + DEAD_INCLUDED +}; + +// Whether CollideWithGrid only predicts the collision (as Interpolate does) or applies it. +enum GridCollisionMode +{ + GRID_COLLISION_APPLY, + GRID_COLLISION_SIMULATE +}; + +// A tear, bomb, knife or laser's 128 TearFlags bits (BitSet128). +using TearFlags = std::bitset<128>; + +// The drop RNG an entity holds before Init seeds it. +constexpr RNG DROP_RNG_DEFAULT = {RNG_SEED_DEFAULT, 5, 9, 7}; + +struct Entity; +struct lua_State; + +// Reading and clearing (0040c3a0, 00a0fe80) are the pointer's own. +// A pointer to an entity that the entity clears when it goes away (REPENTOGON's EntityPtr). It registers itself with +// the entity it points to, which nulls every such pointer in ClearReferences. +struct EntityPtr +{ + EntityPtr() = default; + EntityPtr(const EntityPtr& other) { Set(other.entity); } + EntityPtr& operator=(const EntityPtr& other) + { + Set(other.entity); + return *this; + } + EntityPtr& operator=(Entity* target) + { + Set(target); + return *this; + } + ~EntityPtr() { Set(nullptr); } + + void Set(Entity* target); + void forget() { entity = nullptr; } + Entity* get() const { return entity; } + Entity* operator->() const { return entity; } + operator Entity*() const { return entity; } + +private: + Entity* entity = nullptr; +}; + +// Construction without an entity and copies (00435c70, 00499960) are the defaults. +// A snapshot of an entity as a damage or status source: what it was, where, and its charm and friendship. +struct EntityRef +{ + Vector position{}; + Vector velocity{}; + Entity* entity = nullptr; + int spawnerType = 0; + int type = 0; + int variant = 0; + uint32_t flags = 0; + uint32_t spawnerVariant = 0; + + EntityRef() = default; + explicit EntityRef(Entity* source); + // 004bc670 + bool IsCharmed() const { return flags & ENTITY_REF_CHARMED; } + // 004a2910 + bool IsFriendly() const { return flags & ENTITY_REF_FRIENDLY; } +}; + +// A hit TakeDamage queued for the next Update. +struct DamageEvent +{ + EntityRef source; + float damage = 0; + uint64_t damageFlags = 0; +}; + +// A timed color SetColor laid over an entity. The lowest priority shows, fading toward the next one when isFadeout. +struct ColorParams +{ + ColorMod color = COLOR_DEFAULT; + int duration = 0; + int priority = 0; + int remaining = 0; + bool isFadeout = false; + bool isShared = false; +}; + +// 006a8290 Construction is the default. +// The base of every entity (Lua's Entity): its type, place and motion, collision, sprite and color, health and +// damage, status effects, and the parent, child, target and spawner it links to. +// Field accessors (00417260, 00417270, 00417290, 004172d0, 004172f0, 00417310, 00417320, 00417330, 00417360, 00417370, +// 00417380, 00417420, 00417460, 00417470, 00417480, 004174a0, 004174b0, 004288f0, 00428910, 0042a260, 0042d9b0, +// 00431430, 00431440, 00431520, 00431560, 00435ce0, 00435d10, 00435d20, 00435d60, 00435dd0, 00440eb0, 00444c60, +// 0049cb50, 004aad30, 004b7080, 004e47a0, 00505b60, 00505b70, 00592250, 005a6ff0, 005b1570, 005b1580, 005b1590, +// 00665a80, 006ef400, 007536f0, 0085dca0, 0085dd40, 00871f90) are the public fields. +// The parent, child, target and spawner setters (006a92a0, 006a92e0, 006a9320, 006a9360) are EntityPtr assignments. +struct Entity +{ + ANM2 sprite; + std::vector colorParams; + std::vector damageEvents; + std::vector referrers; + std::vector collisionPoints; + ColorMod color = COLOR_DEFAULT; + ColorMod splatColor = COLOR_DEFAULT; + EntityRef baitedSource; + EntityRef bleedSource; + EntityRef charmSource; + EntityRef magnetizedSource; + EntityPtr child; + EntityPtr hitEffect; + EntityPtr magnetizedEffect; + EntityPtr minecart; + EntityPtr parent; + EntityPtr spawnerEntity; + EntityPtr target; + RNG dropRNG = DROP_RNG_DEFAULT; + EntityConfig_Entity* config = nullptr; + uint64_t flags = 0; + uint64_t pendingDamageFlags = 0; + + Vector gridCollisionNormal{}; + Vector gridCollisionVelocity{}; + Vector holdPosition{}; + Vector knockbackDirection{}; + Vector pausePosition{}; + Vector pos{}; + Vector posOffset{}; + Vector preInterpolatePos{}; + Vector prevPosition{}; + Vector prevVelocity{}; + Vector renderPosition{}; + Vector shadowOffset{}; + Vector sizeMulti{}; + Vector targetPosition{}; + Vector velocity{}; + + float baseFriction = 0; + float bleedDamageAccumulator = 0; + float burnTickDamage = 0; + float collisionDamage = 0; + float friction = 0; + float health = 0; + float mass = 0; + float maxHitPoints = 0; + float pendingDamage = 0; + float poisonTickDamage = 0; + float prevUpdateTime = 0; + float renderDepthOffset = 0; + float scoreMultiplier = 1; + float shadowSize = 0; + float shrinkStatus1 = 0; + float shrinkStatus2 = 0; + float size = 0; + float slowingAmount = 0; + float speedMultiplier = 0; + float updateTime = 0; + + int baitedCountdown = 0; + int bleedingCountdown = 0; + int bossStatusEffectCooldown = 0; + int brimstoneMarkCountdown = 0; + int burnCountdown = 0; + int burnDamageTimer = 0; + int charmedCountdown = 0; + int confusionCountdown = 0; + int damageCountdown = 0; + int entityCollisionClass = ENTCOLL_NONE; + int entityGridCollisionClass = GRIDCOLL_NONE; + int fearCountdown = 0; + int fireDamageCountdown = 0; + int freezeCountdown = 0; + int holdCountdown = 0; + int iceCountdown = 0; + int knockbackCountdown = 0; + int magnetizedCountdown = 0; + int midasFreezeCountdown = 0; + int pauseTimer = 0; + int pitfallState = 0; + int pitfallTimer = 0; + int poisonCountdown = 0; + int poisonDamageTimer = 0; + int renderZOffset = 0; + int shrinkCountdown = 0; + int slowingCountdown = 0; + int sortingLayer = SORTING_BACKGROUND; + int spawnFrame = 0; + int spawnGridIndex = 0; + int spawnerType = 0; + int subtype = 0; + int type = 0; + int variant = 0; + int weaknessCountdown = 0; + int dataRef = -2; + uint32_t collisionIndex = 0; + uint32_t index = 0; + uint32_t initSeed = 0; + uint32_t spawnerVariant = 0; + + bool isCollidesWithEntity = false; + bool isCollidesWithGrid = false; + bool isDead = false; + bool isExists = false; + bool isInterpolating = false; + bool isInvincible = false; + bool isKillOnTouch = false; + bool isRemovedByFactory = false; + bool isUnknown176 = false; + bool isValid = false; + bool isVisible = false; + + Entity() = default; + Entity(const Entity&) = delete; + Entity& operator=(const Entity&) = delete; + + virtual ~Entity(); + virtual void Init(int type, int variant, int subType, uint32_t initSeed); + virtual void PreUpdate(); + virtual void Update(); + virtual void Interpolate(); + virtual void Render(const Vector& offset); + virtual bool RenderShadowLayer(const Vector& offset); + virtual void PostRender(); + virtual bool TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown); + virtual void Kill(const EntityRef& source); + virtual void Remove(); + virtual void TriggerGlowingHourglass() {} + virtual void hourglass_rewind_clear() {} + virtual int GetRenderZ(); + virtual bool CanOverwrite(); + virtual void SetColor(const ColorMod& newColor, int duration, int priority, bool isFadeout, bool isShared); + virtual void SetCollisionDamage(float damage); + virtual void ClearReferences(); + virtual bool CanShutDoors() { return false; } + virtual bool IsBoss() { return false; } + virtual bool IsValidTarget(Entity* other); + // 005ccc10 Most entities cannot be thrown. + virtual bool TryThrow(const EntityRef&, const Vector&, float) { return false; } + virtual Vector GetForwardVector(); + virtual bool HandleCollision(Entity* collider, bool isLow) = 0; + virtual void ResetColor(); + virtual void LoadEntityConfig(); + + // 00417220 Whether it is of the type, and of the variant and subtype unless those are -1. + bool IsType(int entityType, int entityVariant, int entitySubType) const + { + return type == entityType && (entityVariant == -1 || variant == entityVariant) && + (entitySubType == -1 || subtype == entitySubType); + } + // 004173b0 + bool is_player() const { return type == ENTITY_PLAYER; } + // 004173c0 + bool is_bomb() const { return type == ENTITY_BOMB; } + // 0042a250 + bool IsFamiliar() const { return type == ENTITY_FAMILIAR; } + // 00431530 + bool IsTear() const { return type == ENTITY_TEAR; } + // 00431540 + bool IsProjectile() const { return type == ENTITY_PROJECTILE; } + // 00431550 + bool is_pickup() const { return type == ENTITY_PICKUP; } + // 00435da0 + bool is_slot() const { return type == ENTITY_SLOT; } + // 004567b0 + bool IsFriendly() const { return flags & FLAG_FRIENDLY; } + // 004173e0, 005cd460 Sets flags. + void AddEntityFlags(uint64_t added) { flags |= added; } + // 00417400 + void ClearEntityFlags(uint64_t cleared) { flags &= ~cleared; } + // 00417430 + bool HasEntityFlags(uint64_t tested) const { return flags & tested; } + // 006a9c30 + bool HasFullHealth() const { return maxHitPoints <= health; } + // 006ad340 Whether the damage queued this frame kills it. + bool HasMortalDamage() const { return health <= pendingDamage; } + // 00499da0 + Entity_Player* ToPlayer(); + // 00435e40 + Entity_Tear* ToTear(); + + static bool is_enemy_type(int entityType); + Entity* to_npc_or_coop_player(); + void AddVelocity(const Vector& added, bool isIgnoreSpeedMultiplier); + void AddVelocity_divided(const Vector& added, bool isIgnoreSpeedMultiplier); + void AddHealth(float amount); + int FrameCount(); + int update_ticks_get(); + bool IsFrame(int frequency, int offset); + int GetIntervalTicks(float interval, float offset); + int get_velocity_direction(); + void SetSize(float newSize, Vector newSizeMulti, int gridCollisionPoints); + void GetCollisionCapsule(Capsule& outCapsule, const Vector& offset); + + Entity* GetLastParent(); + Entity* GetLastChild(); + Entity* GetLastSpawner(); + Entity* GetPlayerAncestor(); + Entity* GetStatusEffectTarget(); + float GetRootParent(); + bool IsDescendantOf(Entity* ancestor); + bool HasCommonParentWithEntity(Entity* other); + bool is_same_segmented_body(Entity* other); + bool DoesEntityShareStatus(); + void CopyStatusEffects(); + uint32_t GetHitListIndex(); + int CountRelatedEntities(int relatedType, int relatedVariant, std::vector* related); + + bool IsEnemy(); + bool IsFlying(); + bool IsVulnerableEnemy(Entity* source); + bool IsActiveEnemy(DeadMode mode); + bool IsHostileTo(Entity* other); + bool IsDamageSourceFriendly(const EntityRef& source); + bool is_valid_boss_enemy(); + bool is_valid_target(); + bool CanDevolve(); + bool IsPlayerInRadius(const Vector& center, float radius); + int GetBossID(); + + void AddFreeze(const EntityRef& source, int duration, bool isIgnoreBossCooldown); + void AddPoison(const EntityRef& source, int duration, float damage, bool isIgnoreBossCooldown); + void AddSlowing(const EntityRef& source, int duration, float amount, ColorMod slowColor, bool isIgnoreBossCooldown); + void AddCharmed(const EntityRef& source, int duration, bool isIgnoreBossCooldown, bool isAddEnemyKillScore); + void AddConfusion(const EntityRef& source, int duration, bool isIgnoreBossCooldown); + void AddMidasFreeze(const EntityRef& source, int duration, bool isIgnoreBossCooldown); + void AddFear(const EntityRef& source, int duration, bool isIgnoreBossCooldown); + Entity* AddFear(int duration, int unknown1, int unknown2); + void AddBurn(const EntityRef& source, int duration, float damage, bool isIgnoreBossCooldown); + void AddBleeding(const EntityRef& source, int duration); + void AddShrink(const EntityRef& source, int duration, bool isIgnoreBossCooldown); + void AddMagnetized(const EntityRef& source, int duration); + void AddBaited(const EntityRef& source, int duration); + void AddWeakness(const EntityRef& source, int duration); + void AddBrimstoneMark(const EntityRef& source, int duration); + void AddIce(const EntityRef& source, int duration); + void RemoveStatusEffects(); + int apply_second_hand_duration(int duration, const EntityRef& source); + + void CollideWithGrid(GridCollisionMode mode); + void PlayerCollideWithGrid(GridCollisionMode mode); + bool is_grid_collision_at(const Vector& offset); + float collision_mass_get(Entity* other); + void push_apart_capsule(Entity* other); + bool push_apart_circle(Entity* other); + void collide_with_entity(Entity* other); + static bool ForceCollide(Entity* first, Entity* second, bool isLow); + + void BloodExplode(); + Entity_Effect* MakeGroundPoof(const Vector& position, const ColorMod& poofColor, float poofSize); + Entity_Effect* MakeGroundPoofAtSelf(const ColorMod& poofColor, float poofSize); + Entity_Effect* MakeBloodPoof(const Vector& position, const ColorMod& poofColor, float scale); + Entity_Effect* MakeBloodPoofAtPos(const ColorMod& poofColor, float scale); + Entity_NPC* GiveMinecart(const Vector& position, const Vector& cartVelocity); + void convert_shot_for_enemy_owner(Entity* shot); + int get_water_splash_variant(); + void* GetDebugShape(bool isUnknown); + void* GetData(void* outRef); + + Vector GetNullOffset(std::string_view nullLayerName); + void GetNullCapsule(Capsule& outCapsule, std::string_view nullLayerName); + void SetSpriteFrame(std::string_view animation, int frame); + void SetSpriteOverlayFrame(std::string_view animation, int frame); + + void KillWithSource(); + static void ReleaseLuaRef(Entity* entity); + static void RemoveWithPoof(Entity* entity); + static void DestroyRockGridAt(const Vector& position, GridEntityDesc* desc, Entity* source, int backdropType); + static int IsVulnerableEnemy_lua(lua_State* state); + +private: + void data_release(); + void knockback_update(); + void color_params_update(); + void status_effects_update(); + void damage_events_update(); + void status_damage_update(); +}; + +Vector render_position_get(const Vector& world, RenderSnap snap); +int render_z_get(float depth); diff --git a/src/entity_bomb.cpp b/src/entity_bomb.cpp new file mode 100644 index 0000000..6a6a89d --- /dev/null +++ b/src/entity_bomb.cpp @@ -0,0 +1,50 @@ +#include "entity_bomb.h" +#include "log.h" + +constexpr int BOMB_ROCKET = 19; +constexpr int BOMB_ROCKET_GIGA = 20; + +// 00452c40 Lights the fuse for the given frames. +void Entity_Bomb::SetExplosionCountdown(int countdown) +{ + explosionCountdown = countdown; + explosionCountdown2 = countdown; +} + +// 006a2030 Whether it is a rocket, small or giga. +bool Entity_Bomb::IsRocket() +{ + return variant == BOMB_ROCKET || variant == BOMB_ROCKET_GIGA; +} + +// The rest of Entity_Bomb is not reconstructed yet. + +// 006a2050 +void Entity_Bomb::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Bomb::Init 006a2050"); +} + +// 006a24d0 +void Entity_Bomb::Update() +{ + reconstruction_missing("Entity_Bomb::Update 006a24d0"); +} + +// 006a5a60 +void Entity_Bomb::Render(const Vector&) +{ + reconstruction_missing("Entity_Bomb::Render 006a5a60"); +} + +// 006a5f00 +bool Entity_Bomb::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Bomb::HandleCollision 006a5f00"); +} + +// 006a6f10 +void Entity_Bomb::update_sparks() +{ + reconstruction_missing("Entity_Bomb::update_sparks 006a6f10"); +} diff --git a/src/entity_bomb.h b/src/entity_bomb.h new file mode 100644 index 0000000..1e30214 --- /dev/null +++ b/src/entity_bomb.h @@ -0,0 +1,50 @@ +#pragma once + +#include "entity.h" +#include "anm2.h" +#include +#include + +// The costume layers a bomb draws its holder's item looks with. +constexpr int BOMB_COSTUME_LAYERS = 5; + +// Construction and destruction (006a1f30) are the defaults. +// Field accessors (004316a0, 005cd560, 0060cdc0) are the public fields. +// A bomb (Lua's EntityBomb): its fuse, the explosion it deals, the tear effects it carries, its fall and bounce, and +// the costume layers its holder's items add. +struct Entity_Bomb : Entity +{ + std::array bombCostumesSprites; + std::vector hitList; + TearFlags tearFlags; + EntityPtr stickyTarget; + float explosionDamage = 0; + float fallAcceleration = 0; + float fallSpeed = 0; + float radiusMultiplier = 0; + float rocketAngle = 0; + float rocketSpeed = 0; + float scale = 0; + int bombIndex = 0; + int bounceCount = 0; + int explosionCountdown = 0; + int explosionCountdown2 = 0; + int scatterTimer = 0; + int updateDelay = 0; + short collisionCooldown = 0; + short parentCollisionCooldown = 0; + bool isFetus = false; + bool isHasCostumes = false; + bool isLoadCostumes = false; + bool isPrismTouched = false; + bool isSkipNextUpdate = false; + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Render(const Vector& offset) override; + bool HandleCollision(Entity* collider, bool isLow) override; + + void SetExplosionCountdown(int countdown); + bool IsRocket(); + void update_sparks(); +}; diff --git a/src/entity_dummy.cpp b/src/entity_dummy.cpp new file mode 100644 index 0000000..023211e --- /dev/null +++ b/src/entity_dummy.cpp @@ -0,0 +1,32 @@ +#include "entity_dummy.h" +#include "log.h" + +constexpr float DUMMY_FRICTION = 0.965f; + +// Collides with nothing, refusing the collision: its slot shares the body of GridEntity::Hurt, which returns false. +bool Entity_Dummy::HandleCollision(Entity*, bool) +{ + return false; +} + +// 006a7f20 Starts as any entity. +void Entity_Dummy::Init(int entityType, int entityVariant, int entitySubType, uint32_t seed) +{ + Entity::Init(entityType, entityVariant, entitySubType, seed); +} + +// 006a7f30 Moves as any entity, slowing down, and goes away once dead. +void Entity_Dummy::Update() +{ + Entity::Update(); + velocity = vector_make(velocity.x * DUMMY_FRICTION, velocity.y * DUMMY_FRICTION); + if (isDead) Remove(); +} + +// The rest of Entity_Dummy is not reconstructed yet. + +// 006a7f80 +void Entity_Dummy::Render(const Vector&) +{ + reconstruction_missing("Entity_Dummy::Render 006a7f80"); +} diff --git a/src/entity_dummy.h b/src/entity_dummy.h new file mode 100644 index 0000000..046234c --- /dev/null +++ b/src/entity_dummy.h @@ -0,0 +1,13 @@ +#pragma once + +#include "entity.h" + +// Construction and destruction (006a7ee0) are the defaults. +// A dummy entity (Lua's EntityType ENTITY_DUMMY), which collides with nothing. +struct Entity_Dummy : Entity +{ + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Render(const Vector& offset) override; + bool HandleCollision(Entity* collider, bool isLow) override; +}; diff --git a/src/entity_effect.cpp b/src/entity_effect.cpp new file mode 100644 index 0000000..395c144 --- /dev/null +++ b/src/entity_effect.cpp @@ -0,0 +1,144 @@ +#include "entity_effect.h" +#include "log.h" +#include +#include + +// The creep variants the players leave (holy water trail, black, red, white, holy water, green, Lemon Mishap, Lemon +// Party, 204, Black Powder, milk, Black Powder's pentagram). +constexpr std::array PLAYER_CREEPS = {54, 45, 46, 44, 37, 53, 32, 78, 204, 92, 90, 93}; + +// 0060c400 Only a boss spawn pentagram holds the doors shut. +bool Entity_Effect::CanShutDoors() +{ + return variant == EFFECT_SPAWN_PENTAGRAM; +} + +// 005ccc20 Collides with nothing it reacts to, letting the collision through. +bool Entity_Effect::HandleCollision(Entity*, bool) +{ + return true; +} + +// 00435e90 Sets how long it lasts, from now. +void Entity_Effect::SetTimeout(int frames) +{ + timeout = frames; + lifespan = frames; +} + +// 00435ef0 Sets the radius it grows between. +void Entity_Effect::SetRadii(float newMinRadius, float newMaxRadius) +{ + minRadius = newMinRadius; + maxRadius = newMaxRadius; +} + +// 005cd950 Whether two indices differ, the filter of the rift's pull. +bool Entity_Effect::rift_attract_filter(int first, int second) +{ + return first != second; +} + +// 0060ac20 Whether the variant is creep or fire the players leave, which hurts only enemies. +bool Entity_Effect::IsPlayerCreep(int effectVariant) +{ + return std::find(PLAYER_CREEPS.begin(), PLAYER_CREEPS.end(), effectVariant) != PLAYER_CREEPS.end(); +} + +// The rest of Entity_Effect is not reconstructed yet. + +// 005cdb20 +void Entity_Effect::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Effect::Init 005cdb20"); +} + +// 005d4380 +void Entity_Effect::Update() +{ + reconstruction_missing("Entity_Effect::Update 005d4380"); +} + +// 005d2520 +void Entity_Effect::Interpolate() +{ + reconstruction_missing("Entity_Effect::Interpolate 005d2520"); +} + +// 00607620 +void Entity_Effect::Render(const Vector&) +{ + reconstruction_missing("Entity_Effect::Render 00607620"); +} + +// 005d2420 +void Entity_Effect::Remove() +{ + reconstruction_missing("Entity_Effect::Remove 005d2420"); +} + +// 0060c370 +void Entity_Effect::TriggerGlowingHourglass() +{ + reconstruction_missing("Entity_Effect::guard_check_icall 0060c370"); +} + +// 0060abb0 +void Entity_Effect::ClearReferences() +{ + reconstruction_missing("Entity_Effect::ClearReferences 0060abb0"); +} + +// 00435290 +void Entity_Effect::render_player_target(const Vector&, int) +{ + reconstruction_missing("Entity_Effect::render_player_target 00435290"); +} + +// 004564b0 +void Entity_Effect::FollowParent(Entity*) +{ + reconstruction_missing("Entity_Effect::FollowParent 004564b0"); +} + +// 005d2a70 +void Entity_Effect::update_mr_me() +{ + reconstruction_missing("Entity_Effect::update_mr_me 005d2a70"); +} + +// 005d4010 +void Entity_Effect::update_wave_chain() +{ + reconstruction_missing("Entity_Effect::update_wave_chain 005d4010"); +} + +// 006073f0 +void Entity_Effect::moonlight_timer_callback(int) +{ + reconstruction_missing("Entity_Effect::moonlight_timer_callback 006073f0"); +} + +// 0060af00 +Entity_Effect* Entity_Effect::CreateTimer(void*, uint32_t, uint32_t, bool) +{ + reconstruction_missing("Entity_Effect::CreateTimer 0060af00"); +} + +// 0060b0d0 +void Entity_Effect::update_variant178_shooter(bool) +{ + reconstruction_missing("Entity_Effect::update_variant178_shooter 0060b0d0"); +} + +// 0060b7a0 +Entity_Effect* Entity_Effect::CreateLootPreview(void*, const Vector&, Entity*, Entity_Effect*) +{ + reconstruction_missing("Entity_Effect::CreateLootPreview 0060b7a0"); +} + +// 0060bae0 +void Entity_Effect::setup_loot_preview(void*) +{ + reconstruction_missing("Entity_Effect::setup_loot_preview 0060bae0"); +} diff --git a/src/entity_effect.h b/src/entity_effect.h new file mode 100644 index 0000000..8f19274 --- /dev/null +++ b/src/entity_effect.h @@ -0,0 +1,66 @@ +#pragma once + +#include "entity.h" +#include +#include +#include + +// The effect variant that spawns a boss, which counts as the boss until it does. +constexpr int EFFECT_SPAWN_PENTAGRAM = 203; + +// Construction and destruction (005cd9f0, 005cd960) are the defaults, the extra data shared with its other holders. +// Field accessors (00435e60, 00435eb0, 004d7770, 005784c0, 0060ce20) are the public fields. +// An effect (Lua's EntityEffect): a visual or a hazard such as creep, a poof or a light beam, with its timeout, its +// fall, the per-variant data it keeps and the extra data some variants share. +struct Entity_Effect : Entity +{ + // The base of the extra data some variants keep (MrMeData, PickupGhostData, SpriteTrailData). + struct ExtraData + { + virtual ~ExtraData() = default; + }; + + std::shared_ptr extraData; + std::array varData{}; + std::vector hitList; + Vector parentOffset{}; + float fallingAcceleration = 0; + float fallingSpeed = 0; + float height = 0; + float maxRadius = 0; + float minRadius = 0; + float rotation = 0; + float scale = 0; + int damageSource = 0; + int lifespan = 0; + int spawnSubtype = 0; + int spawnType = 0; + int spawnVariant = 0; + int state = 0; + int timeout = 0; + bool isFollowing = false; + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + void Remove() override; + void TriggerGlowingHourglass() override; + void ClearReferences() override; + bool CanShutDoors() override; + bool HandleCollision(Entity* collider, bool isLow) override; + + void render_player_target(const Vector& offset, int segmentMode); + void SetTimeout(int frames); + void SetRadii(float newMinRadius, float newMaxRadius); + void FollowParent(Entity* parent); + static bool rift_attract_filter(int first, int second); + void update_mr_me(); + void update_wave_chain(); + static void moonlight_timer_callback(int); + static bool IsPlayerCreep(int effectVariant); + static Entity_Effect* CreateTimer(void* fn, uint32_t delay, uint32_t times, bool isPersistent); + void update_variant178_shooter(bool isPositionOnly); + static Entity_Effect* CreateLootPreview(void* lootlist, const Vector& pos, Entity* owner, Entity_Effect* effect); + void setup_loot_preview(void* lootQueue); +}; diff --git a/src/entity_familiar.cpp b/src/entity_familiar.cpp new file mode 100644 index 0000000..0d24874 --- /dev/null +++ b/src/entity_familiar.cpp @@ -0,0 +1,753 @@ +#include "entity_familiar.h" +#include "log.h" + +// The variants the familiar code tells apart by number, and the Lost Soul's state while it is dead. +constexpr int FAMILIAR_ISAACS_HEART = 62; +constexpr int FAMILIAR_PUNCHING_BAG = 67; +constexpr int FAMILIAR_MILK = 100; +constexpr int FAMILIAR_LOST_SOUL = 211; +constexpr int LOST_SOUL_DEAD = 2; +constexpr int FAMILIAR_VANISHING_TWIN = 242; +// A formation mode of none, which asks for a new place. +constexpr uint8_t FORMATION_NONE = 0xff; + +// 00651890 Rewinds with the Glowing Hourglass: a dead Lost Soul comes back, and it remembers the rewind for its next +// room. +void Entity_Familiar::TriggerGlowingHourglass() +{ + if (variant == FAMILIAR_LOST_SOUL && state == LOST_SOUL_DEAD) + { + state = 0; + Update(); + } + isHourglassRewound = true; +} + +// 006518c0 Forgets a Glowing Hourglass rewind. +void Entity_Familiar::hourglass_rewind_clear() +{ + isHourglassRewound = false; +} + +// 0060dab0 Only a visible Vanishing Twin that took a boss's form holds the doors shut. +bool Entity_Familiar::CanShutDoors() +{ + return variant == FAMILIAR_VANISHING_TWIN && coins != 0 && isVisible; +} + +// 0060d8c0 Whether enemies can hurt it: only the familiars that take hits. +bool Entity_Familiar::CanBeDamagedByEnemy() +{ + return variant == FAMILIAR_ISAACS_HEART || variant == FAMILIAR_PUNCHING_BAG || variant == FAMILIAR_LOST_SOUL || + variant == FAMILIAR_MILK; +} + +// 00612820 Leaves its orbit, the rest of the orbit closing the gap. +void Entity_Familiar::RemoveFromOrbit() +{ + if (orbitLayer < 0) return; + + RecalculateOrbitOffset(orbitLayer, false); + orbitLayer = -1; +} + +// 0062aaa0 Counts hearts it collected. +void Entity_Familiar::AddHearts(int amount) +{ + hearts = hearts + amount; +} + +// 00630440 Counts keys it collected. +void Entity_Familiar::AddKeys(int amount) +{ + keys = keys + amount; +} + +// 006348d0 Drops its place in the following line, to be given a new one. +void Entity_Familiar::reset_follow_target() +{ + formationTargetOffset = {}; + formationOffset = formationTargetOffset; + formationAngle = 0; + formationMode = FORMATION_NONE; +} + +// The rest of Entity_Familiar is not reconstructed yet. + +// 0060de70 +void Entity_Familiar::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Familiar::Init 0060de70"); +} + +// 0061da10 +void Entity_Familiar::Update() +{ + reconstruction_missing("Entity_Familiar::Update 0061da10"); +} + +// 00624a80 +void Entity_Familiar::Interpolate() +{ + reconstruction_missing("Entity_Familiar::Interpolate 00624a80"); +} + +// 00624e10 +void Entity_Familiar::Render(const Vector&) +{ + reconstruction_missing("Entity_Familiar::Render 00624e10"); +} + +// 00624dd0 +bool Entity_Familiar::RenderShadowLayer(const Vector&) +{ + reconstruction_missing("Entity_Familiar::RenderShadowLayer 00624dd0"); +} + +// 0062cdc0 +bool Entity_Familiar::TakeDamage(float, uint64_t, const EntityRef&, int) +{ + reconstruction_missing("Entity_Familiar::TakeDamage 0062cdc0"); +} + +// 00610540 +void Entity_Familiar::Kill(const EntityRef&) +{ + reconstruction_missing("Entity_Familiar::Kill 00610540"); +} + +// 00610470 +void Entity_Familiar::Remove() +{ + reconstruction_missing("Entity_Familiar::Remove 00610470"); +} + +// 006121d0 +void Entity_Familiar::ClearReferences() +{ + reconstruction_missing("Entity_Familiar::ClearReferences 006121d0"); +} + +// 0063c0a0 +bool Entity_Familiar::TryThrow(const EntityRef&, const Vector&, float) +{ + reconstruction_missing("Entity_Familiar::TryThrow 0063c0a0"); +} + +// 006261f0 +bool Entity_Familiar::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Familiar::HandleCollision 006261f0"); +} + +// 00431be0 +void Entity_Familiar::ai_umbilical_baby(bool) +{ + reconstruction_missing("Entity_Familiar::ai_umbilical_baby 00431be0"); +} + +// 004357e0 +void Entity_Familiar::set_extra_data(void*, void*) +{ + reconstruction_missing("Entity_Familiar::set_extra_data 004357e0"); +} + +// 00436330 +void Entity_Familiar::WispInit() +{ + reconstruction_missing("Entity_Familiar::WispInit 00436330"); +} + +// 00436fd0 +uint32_t Entity_Familiar::wisp_kill() +{ + reconstruction_missing("Entity_Familiar::wisp_kill 00436fd0"); +} + +// 004386f0 +Entity_Tear* Entity_Familiar::fire_wisp_projectile(Vector) +{ + reconstruction_missing("Entity_Familiar::fire_wisp_projectile 004386f0"); +} + +// 0043a5e0 +uint32_t Entity_Familiar::wisp_take_damage(float*, uint32_t*, int*) +{ + reconstruction_missing("Entity_Familiar::wisp_take_damage 0043a5e0"); +} + +// 0043aa90 +void Entity_Familiar::ai_wisp() +{ + reconstruction_missing("Entity_Familiar::ai_wisp 0043aa90"); +} + +// 0043db20 +void Entity_Familiar::ai_mr_me_wisp() +{ + reconstruction_missing("Entity_Familiar::ai_mr_me_wisp 0043db20"); +} + +// 0043e4a0 +void Entity_Familiar::ai_mega_blast_wisp() +{ + reconstruction_missing("Entity_Familiar::ai_mega_blast_wisp 0043e4a0"); +} + +// 0043eb10 +int Entity_Familiar::GetRandomWisp(RNG*) +{ + reconstruction_missing("Entity_Familiar::GetRandomWisp 0043eb10"); +} + +// 005ae490 +void Entity_Familiar::ai_buddy_inbox() +{ + reconstruction_missing("Entity_Familiar::ai_buddy_inbox 005ae490"); +} + +// 0060d180 +KColor* Entity_Familiar::GetPlayerSlot(KColor*, Entity_Player*) +{ + reconstruction_missing("Entity_Familiar::GetPlayerSlot 0060d180"); +} + +// 0060d8e0 +bool Entity_Familiar::CanBlockProjectiles() +{ + reconstruction_missing("Entity_Familiar::CanBlockProjectiles 0060d8e0"); +} + +// 0060dc40 +float Entity_Familiar::apply_tear_modifiers() +{ + reconstruction_missing("Entity_Familiar::apply_tear_modifiers 0060dc40"); +} + +// 0060ddd0 +void Entity_Familiar::set_locust_config_index(int) +{ + reconstruction_missing("Entity_Familiar::set_locust_config_index 0060ddd0"); +} + +// 00612330 +Entity* Entity_Familiar::get_orbit_parent() +{ + reconstruction_missing("Entity_Familiar::get_orbit_parent 00612330"); +} + +// 00612440 +int Entity_Familiar::RecalculateOrbitOffset(int, bool) +{ + reconstruction_missing("Entity_Familiar::RecalculateOrbitOffset 00612440"); +} + +// 006127b0 +void Entity_Familiar::AddToOrbit(int) +{ + reconstruction_missing("Entity_Familiar::AddToOrbit 006127b0"); +} + +// 00612850 +Vector Entity_Familiar::GetOrbitDistance(int) +{ + reconstruction_missing("Entity_Familiar::GetOrbitDistance 00612850"); +} + +// 00612890 +bool Entity_Familiar::is_detached_from_follow() +{ + reconstruction_missing("Entity_Familiar::is_detached_from_follow 00612890"); +} + +// 00612970 +int Entity_Familiar::GetFollowerPriority() +{ + reconstruction_missing("Entity_Familiar::GetFollowerPriority 00612970"); +} + +// 00612af0 +bool Entity_Familiar::IsLilithBirthrightIncubus() +{ + reconstruction_missing("Entity_Familiar::IsLilithBirthrightIncubus 00612af0"); +} + +// 00612b50 +Entity* Entity_Familiar::get_incubus_umbilical_whip() +{ + reconstruction_missing("Entity_Familiar::get_incubus_umbilical_whip 00612b50"); +} + +// 00612bb0 +void Entity_Familiar::FollowParent() +{ + reconstruction_missing("Entity_Familiar::FollowParent 00612bb0"); +} + +// 00613910 +void Entity_Familiar::FollowPosition(const Vector&) +{ + reconstruction_missing("Entity_Familiar::FollowPosition 00613910"); +} + +// 006139b0 +Vector Entity_Familiar::GetOrbitPosition(const Vector&) +{ + reconstruction_missing("Entity_Familiar::GetOrbitPosition 006139b0"); +} + +// 00613c20 +Entity_Laser* Entity_Familiar::fire_robo_baby_laser(const Vector&) +{ + reconstruction_missing("Entity_Familiar::fire_robo_baby_laser 00613c20"); +} + +// 00613df0 +void Entity_Familiar::PlayFloatAnim(int) +{ + reconstruction_missing("Entity_Familiar::PlayFloatAnim 00613df0"); +} + +// 00613fe0 +void Entity_Familiar::AddToDelayed() +{ + reconstruction_missing("Entity_Familiar::AddToDelayed 00613fe0"); +} + +// 006141e0 +void Entity_Familiar::RemoveFromDelayed() +{ + reconstruction_missing("Entity_Familiar::RemoveFromDelayed 006141e0"); +} + +// 006142e0 +void Entity_Familiar::PlayChargeAnim(int) +{ + reconstruction_missing("Entity_Familiar::PlayChargeAnim 006142e0"); +} + +// 00614500 +void Entity_Familiar::PlayShootAnim(int) +{ + reconstruction_missing("Entity_Familiar::PlayShootAnim 00614500"); +} + +// 00614b10 +void Entity_Familiar::Shoot() +{ + reconstruction_missing("Entity_Familiar::Shoot 00614b10"); +} + +// 00615d80 +void Entity_Familiar::ai_blue_fly() +{ + reconstruction_missing("Entity_Familiar::ai_blue_fly 00615d80"); +} + +// 00616db0 +void Entity_Familiar::ai_walker() +{ + reconstruction_missing("Entity_Familiar::ai_walker 00616db0"); +} + +// 006174c0 +void Entity_Familiar::ai_charger() +{ + reconstruction_missing("Entity_Familiar::ai_charger 006174c0"); +} + +// 00619270 +void Entity_Familiar::ai_auto_shooter() +{ + reconstruction_missing("Entity_Familiar::ai_auto_shooter 00619270"); +} + +// 0061a240 +void Entity_Familiar::ai_blue_babys_only_friend() +{ + reconstruction_missing("Entity_Familiar::ai_blue_babys_only_friend 0061a240"); +} + +// 0061a4e0 +void Entity_Familiar::ai_pickup_sack() +{ + reconstruction_missing("Entity_Familiar::ai_pickup_sack 0061a4e0"); +} + +// 0061b8c0 +void Entity_Familiar::ai_flying_bird() +{ + reconstruction_missing("Entity_Familiar::ai_flying_bird 0061b8c0"); +} + +// 0061bd50 +void Entity_Familiar::ai_daddy_longlegs() +{ + reconstruction_missing("Entity_Familiar::ai_daddy_longlegs 0061bd50"); +} + +// 0061c150 +void Entity_Familiar::ai_orbital_variant_50() +{ + reconstruction_missing("Entity_Familiar::ai_orbital_variant_50 0061c150"); +} + +// 0061d6b0 +void Entity_Familiar::ai_key_full() +{ + reconstruction_missing("Entity_Familiar::ai_key_full 0061d6b0"); +} + +// 0062a8f0 +bool Entity_Familiar::CanPlayerFire() +{ + reconstruction_missing("Entity_Familiar::CanPlayerFire 0062a8f0"); +} + +// 0062a930 +void Entity_Familiar::AddCoins(int) +{ + reconstruction_missing("Entity_Familiar::AddCoins 0062a930"); +} + +// 0062aab0 +void Entity_Familiar::TriggerRoomClear() +{ + reconstruction_missing("Entity_Familiar::TriggerRoomClear 0062aab0"); +} + +// 0062b360 +void Entity_Familiar::level_start() +{ + reconstruction_missing("Entity_Familiar::level_start 0062b360"); +} + +// 0062bb70 +void Entity_Familiar::room_enter() +{ + reconstruction_missing("Entity_Familiar::room_enter 0062bb70"); +} + +// 0062c8d0 +void Entity_Familiar::farting_baby_fart() +{ + reconstruction_missing("Entity_Familiar::farting_baby_fart 0062c8d0"); +} + +// 0062d290 +void Entity_Familiar::mongo_baby_pick_next_mimic() +{ + reconstruction_missing("Entity_Familiar::mongo_baby_pick_next_mimic 0062d290"); +} + +// 0062d7e0 +void Entity_Familiar::RemoveFromFollowers() +{ + reconstruction_missing("Entity_Familiar::RemoveFromFollowers 0062d7e0"); +} + +// 0062db20 +void Entity_Familiar::AddToFollowers() +{ + reconstruction_missing("Entity_Familiar::AddToFollowers 0062db20"); +} + +// 0062e020 +void Entity_Familiar::set_player(Entity_Player*) +{ + reconstruction_missing("Entity_Familiar::set_player 0062e020"); +} + +// 0062e120 +void Entity_Familiar::ai_samsons_chains() +{ + reconstruction_missing("Entity_Familiar::ai_samsons_chains 0062e120"); +} + +// 0062e620 +void Entity_Familiar::update_weapon(bool) +{ + reconstruction_missing("Entity_Familiar::update_weapon 0062e620"); +} + +// 0062ee30 +void Entity_Familiar::ai_lil_gurdy() +{ + reconstruction_missing("Entity_Familiar::ai_lil_gurdy 0062ee30"); +} + +// 00630450 +void Entity_Familiar::store_backup(void*) +{ + reconstruction_missing("Entity_Familiar::store_backup 00630450"); +} + +// 00631050 +void Entity_Familiar::MoveDelayed(int) +{ + reconstruction_missing("Entity_Familiar::MoveDelayed 00631050"); +} + +// 006312f0 +void Entity_Familiar::MoveDiagonally(float) +{ + reconstruction_missing("Entity_Familiar::MoveDiagonally 006312f0"); +} + +// 00631850 +void Entity_Familiar::move_to_parent_offset() +{ + reconstruction_missing("Entity_Familiar::move_to_parent_offset 00631850"); +} + +// 00631b20 +void Entity_Familiar::delirium_morph() +{ + reconstruction_missing("Entity_Familiar::delirium_morph 00631b20"); +} + +// 006322f0 +void Entity_Familiar::init_lil_harbinger_sprite() +{ + reconstruction_missing("Entity_Familiar::init_lil_harbinger_sprite 006322f0"); +} + +// 006324d0 +void Entity_Familiar::render_charge_indicator(const Vector&) +{ + reconstruction_missing("Entity_Familiar::render_charge_indicator 006324d0"); +} + +// 00632820 +void Entity_Familiar::ai_lil_monstro() +{ + reconstruction_missing("Entity_Familiar::ai_lil_monstro 00632820"); +} + +// 00632d90 +void Entity_Familiar::ai_variant_111() +{ + reconstruction_missing("Entity_Familiar::ai_variant_111 00632d90"); +} + +// 00633500 +void Entity_Familiar::update_angry_fly() +{ + reconstruction_missing("Entity_Familiar::update_angry_fly 00633500"); +} + +// 00634000 +bool Entity_Familiar::TryFireTear(Entity_Tear*) +{ + reconstruction_missing("Entity_Familiar::TryFireTear 00634000"); +} + +// 006341a0 +uint8_t Entity_Familiar::apply_baby_bender(Entity_Tear*) +{ + reconstruction_missing("Entity_Familiar::apply_baby_bender 006341a0"); +} + +// 00634260 +Vector Entity_Familiar::UpdateFollowPosition() +{ + reconstruction_missing("Entity_Familiar::UpdateFollowPosition 00634260"); +} + +// 00634a40 +void Entity_Familiar::ResolveOrbitConflict() +{ + reconstruction_missing("Entity_Familiar::ResolveOrbitConflict 00634a40"); +} + +// 00634b10 +void Entity_Familiar::ai_lil_spewer() +{ + reconstruction_missing("Entity_Familiar::ai_lil_spewer 00634b10"); +} + +// 006378c0 +void Entity_Familiar::ai_lil_harbingers() +{ + reconstruction_missing("Entity_Familiar::ai_lil_harbingers 006378c0"); +} + +// 00638c10 +Entity_Laser* Entity_Familiar::FireBrimstone(const Vector&, uint8_t) +{ + reconstruction_missing("Entity_Familiar::FireBrimstone 00638c10"); +} + +// 00639000 +Entity* Entity_Familiar::ThrowDip(int, const Vector&, Entity*) +{ + reconstruction_missing("Entity_Familiar::ThrowDip 00639000"); +} + +// 00639750 +Entity_Tear* Entity_Familiar::FireProjectile(const Vector&, uint8_t) +{ + reconstruction_missing("Entity_Familiar::FireProjectile 00639750"); +} + +// 0063aef0 +Entity_Laser* Entity_Familiar::sprinkler_shoot_laser(float, float) +{ + reconstruction_missing("Entity_Familiar::sprinkler_shoot_laser 0063aef0"); +} + +// 0063b340 +void Entity_Familiar::update_idle_anim_by_size() +{ + reconstruction_missing("Entity_Familiar::update_idle_anim_by_size 0063b340"); +} + +// 0063b8b0 +void Entity_Familiar::RemoveFromPlayer(uint8_t) +{ + reconstruction_missing("Entity_Familiar::RemoveFromPlayer 0063b8b0"); +} + +// 0063c1c0 +void Entity_Familiar::ai_minisaac() +{ + reconstruction_missing("Entity_Familiar::ai_minisaac 0063c1c0"); +} + +// 0063ce20 +void Entity_Familiar::minisaac_fire() +{ + reconstruction_missing("Entity_Familiar::minisaac_fire 0063ce20"); +} + +// 0063dd60 +void Entity_Familiar::minisaac_find_target() +{ + reconstruction_missing("Entity_Familiar::minisaac_find_target 0063dd60"); +} + +// 0063f9f0 +void Entity_Familiar::ai_blood_oath() +{ + reconstruction_missing("Entity_Familiar::ai_blood_oath 0063f9f0"); +} + +// 006402f0 +void Entity_Familiar::paschal_candle_sync_effects() +{ + reconstruction_missing("Entity_Familiar::paschal_candle_sync_effects 006402f0"); +} + +// 00640ca0 +void Entity_Familiar::ai_boiled_baby() +{ + reconstruction_missing("Entity_Familiar::ai_boiled_baby 00640ca0"); +} + +// 006414c0 +void Entity_Familiar::zhl_misfit_006414c0() +{ + reconstruction_missing("Entity_Familiar::zhl_misfit_006414c0 006414c0"); +} + +// 006424d0 +void Entity_Familiar::ai_bird_cage() +{ + reconstruction_missing("Entity_Familiar::ai_bird_cage 006424d0"); +} + +// 006431d0 +void Entity_Familiar::ai_bot_fly() +{ + reconstruction_missing("Entity_Familiar::ai_bot_fly 006431d0"); +} + +// 006437a0 +void Entity_Familiar::ai_stitches() +{ + reconstruction_missing("Entity_Familiar::ai_stitches 006437a0"); +} + +// 006444d0 +Entity* Entity_Familiar::aim_reflected_projectile() +{ + reconstruction_missing("Entity_Familiar::aim_reflected_projectile 006444d0"); +} + +// 00644e80 +void Entity_Familiar::ai_shadow_intruder_damocles(bool) +{ + reconstruction_missing("Entity_Familiar::ai_shadow_intruder_damocles 00644e80"); +} + +// 006470c0 +void* Entity_Familiar::get_item_config_entry() +{ + reconstruction_missing("Entity_Familiar::get_item_config_entry 006470c0"); +} + +// 00647170 +uint8_t Entity_Familiar::abyss_locust_eat() +{ + reconstruction_missing("Entity_Familiar::abyss_locust_eat 00647170"); +} + +// 0064a2d0 +uint8_t Entity_Familiar::break_grid_ahead() +{ + reconstruction_missing("Entity_Familiar::break_grid_ahead 0064a2d0"); +} + +// 0064a830 +void Entity_Familiar::load_config_graphics() +{ + reconstruction_missing("Entity_Familiar::load_config_graphics 0064a830"); +} + +// 0064b6c0 +void Entity_Familiar::render_abyss_locust_sprite(ANM2*, float*) +{ + reconstruction_missing("Entity_Familiar::render_abyss_locust_sprite 0064b6c0"); +} + +// 0064b920 +void Entity_Familiar::siren_charm(Entity*, Entity_Player*) +{ + reconstruction_missing("Entity_Familiar::siren_charm 0064b920"); +} + +// 0064bab0 +void Entity_Familiar::RemoveFromPlayer() +{ + reconstruction_missing("Entity_Familiar::RemoveFromPlayer 0064bab0"); +} + +// 0064ca30 +void Entity_Familiar::UpdateDirtColor(uint8_t) +{ + reconstruction_missing("Entity_Familiar::UpdateDirtColor 0064ca30"); +} + +// 0064d1d0 +void Entity_Familiar::update_star_of_bethlehem_speed(bool) +{ + reconstruction_missing("Entity_Familiar::update_star_of_bethlehem_speed 0064d1d0"); +} + +// 0064e0c0 +void Entity_Familiar::ai_blood_clot(bool) +{ + reconstruction_missing("Entity_Familiar::ai_blood_clot 0064e0c0"); +} + +// 00650220 +void Entity_Familiar::predict_player_movement() +{ + reconstruction_missing("Entity_Familiar::predict_player_movement 00650220"); +} + +// 009615e0 +uint8_t Entity_Familiar::multidimensional_baby_copy_knife(Entity_Knife*, Entity*) +{ + reconstruction_missing("Entity_Familiar::multidimensional_baby_copy_knife 009615e0"); +} diff --git a/src/entity_familiar.h b/src/entity_familiar.h new file mode 100644 index 0000000..bb7f83e --- /dev/null +++ b/src/entity_familiar.h @@ -0,0 +1,187 @@ +#pragma once + +#include "entity.h" +#include "anm2.h" +#include +#include + +// Construction and destruction (0060d3d0, 0060d200) are the defaults, but for the pathfinder's owner the constructor +// sets. PathFinder::Init's reset waits for PathFinder's takeover. +// Field accessors (004361f0, 00505cf0, 0060d0e0, 0060d100) are the public fields. +// A familiar (Lua's EntityFamiliar): its player, its place in the following line or an orbit, the consumables it +// collects, its weapon, and the extra data some variants keep. +struct Entity_Familiar : Entity +{ + // The base of the extra data some variants keep (AbyssLocustData, IsaacsBodyData, UmbilicalBabyData). + struct ExtraData + { + virtual ~ExtraData() = default; + }; + + ANM2 chargeBarSprite; + NPCAI_Pathfinder pathfinder{}; + std::unique_ptr extraData; + std::vector hitList; + ColorMod dirtColor = COLOR_DEFAULT; + EntityPtr linkedEntity; + EntityPtr sirenHelper; + Entity_Player* player = nullptr; + Entity_Player* sirenOriginalPlayer = nullptr; + ItemConfig_Item* item = nullptr; + Weapon* weapon = nullptr; + Vector formationOffset{}; + Vector formationTargetOffset{}; + Vector orbitDistance{}; + float formationAngle = 0; + float orbitAngleOffset = 0; + float orbitSpeed = 0; + int appearTimer = 0; + int chargeLevel = 0; + int coins = 0; + int counter = 0; + int fireCooldown = 0; + int headFrameDelay = 0; + int hearts = 0; + int keys = 0; + int lastDirection = 0; + int moveDelayNum = 0; + int moveDirection = 0; + int orbitLayer = 0; + int roomClearCount = 0; + int shootDirection = 0; + int sirenCharmFrames = 0; + int state = 0; + int wispCollectibleType = 0; + uint8_t formationMode = 0; + bool isDelayed = false; + bool isFollower = false; + bool isHourglassRewound = false; + bool isLilDelirium = false; + bool isNotCountedAsFollower = false; + bool isSubtype55555 = false; + + Entity_Familiar() { pathfinder._entity = this; } + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + bool RenderShadowLayer(const Vector& offset) override; + bool TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown) override; + void Kill(const EntityRef& source) override; + void Remove() override; + void TriggerGlowingHourglass() override; + void hourglass_rewind_clear() override; + void ClearReferences() override; + bool CanShutDoors() override; + bool TryThrow(const EntityRef& source, const Vector& direction, float force) override; + bool HandleCollision(Entity* collider, bool isLow) override; + + void ai_umbilical_baby(bool isInterpolated); + static void set_extra_data(void* extraDataPtr, void* extraData); + void WispInit(); + uint32_t wisp_kill(); + Entity_Tear* fire_wisp_projectile(Vector velocity); + uint32_t wisp_take_damage(float*, uint32_t*, int*); + void ai_wisp(); + void ai_mr_me_wisp(); + void ai_mega_blast_wisp(); + static int GetRandomWisp(RNG* rng); + void ai_buddy_inbox(); + KColor* GetPlayerSlot(KColor* outColor, Entity_Player* player); + bool CanBeDamagedByEnemy(); + bool CanBlockProjectiles(); + float apply_tear_modifiers(); + void set_locust_config_index(int); + Entity* get_orbit_parent(); + int RecalculateOrbitOffset(int layer, bool isAdd); + void AddToOrbit(int orbitLayer); + void RemoveFromOrbit(); + static Vector GetOrbitDistance(int layer); + bool is_detached_from_follow(); + int GetFollowerPriority(); + bool IsLilithBirthrightIncubus(); + Entity* get_incubus_umbilical_whip(); + void FollowParent(); + void FollowPosition(const Vector& position); + Vector GetOrbitPosition(const Vector& offset); + Entity_Laser* fire_robo_baby_laser(const Vector& direction); + void PlayFloatAnim(int direction); + void AddToDelayed(); + void RemoveFromDelayed(); + void PlayChargeAnim(int direction); + void PlayShootAnim(int direction); + void Shoot(); + void ai_blue_fly(); + void ai_walker(); + void ai_charger(); + void ai_auto_shooter(); + void ai_blue_babys_only_friend(); + void ai_pickup_sack(); + void ai_flying_bird(); + void ai_daddy_longlegs(); + void ai_orbital_variant_50(); + void ai_key_full(); + bool CanPlayerFire(); + void AddCoins(int count); + void AddHearts(int amount); + void TriggerRoomClear(); + void level_start(); + void room_enter(); + void farting_baby_fart(); + void mongo_baby_pick_next_mimic(); + void RemoveFromFollowers(); + void AddToFollowers(); + void set_player(Entity_Player* player); + void ai_samsons_chains(); + void update_weapon(bool isInterpolated); + void ai_lil_gurdy(); + void AddKeys(int amount); + void store_backup(void* backup); + void MoveDelayed(int numFrames); + void MoveDiagonally(float speed); + void move_to_parent_offset(); + void delirium_morph(); + void init_lil_harbinger_sprite(); + void render_charge_indicator(const Vector& renderPos); + void ai_lil_monstro(); + void ai_variant_111(); + void update_angry_fly(); + bool TryFireTear(Entity_Tear* tear); + uint8_t apply_baby_bender(Entity_Tear* tear); + Vector UpdateFollowPosition(); + void reset_follow_target(); + void ResolveOrbitConflict(); + void ai_lil_spewer(); + void ai_lil_harbingers(); + Entity_Laser* FireBrimstone(const Vector& aimDirection, uint8_t unk); + static Entity* ThrowDip(int subType, const Vector& position, Entity* spawner); + Entity_Tear* FireProjectile(const Vector& aimDirection, uint8_t unk); + Entity_Laser* sprinkler_shoot_laser(float angle, float distance); + void update_idle_anim_by_size(); + void RemoveFromPlayer(uint8_t unusedRemoveFamiliar); + void ai_minisaac(); + void minisaac_fire(); + static void minisaac_find_target(); + void ai_blood_oath(); + void paschal_candle_sync_effects(); + void ai_boiled_baby(); + void zhl_misfit_006414c0(); + void ai_bird_cage(); + void ai_bot_fly(); + void ai_stitches(); + Entity* aim_reflected_projectile(); + void ai_shadow_intruder_damocles(bool isInterpolating); + void* get_item_config_entry(); + uint8_t abyss_locust_eat(); + uint8_t break_grid_ahead(); + void load_config_graphics(); + void render_abyss_locust_sprite(ANM2*, float*); + void siren_charm(Entity* siren, Entity_Player* player); + void RemoveFromPlayer(); + void UpdateDirtColor(uint8_t immediate); + void update_star_of_bethlehem_speed(bool isForce); + void ai_blood_clot(bool isPostMove); + void predict_player_movement(); + static uint8_t multidimensional_baby_copy_knife(Entity_Knife* knife, Entity* unused); +}; diff --git a/src/entity_knife.cpp b/src/entity_knife.cpp new file mode 100644 index 0000000..9f4608b --- /dev/null +++ b/src/entity_knife.cpp @@ -0,0 +1,150 @@ +#include "entity_knife.h" +#include "log.h" + +// 009665e0 Sorts by its own depth, ignoring the sorting layer. +int Entity_Knife::GetRenderZ() +{ + return render_z_get(knifeDepthOffset + pos.y); +} + +// 009666c0 The first knife of its chain of knives. +Entity* Entity_Knife::GetRootParent() +{ + Entity* root = this; + while (root->parent && root->parent->type == ENTITY_KNIFE) root = root->parent; + return root; +} + +// The rest of Entity_Knife is not reconstructed yet. + +// 00960c10 +void Entity_Knife::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Knife::Init 00960c10"); +} + +// 00961b00 +void Entity_Knife::Update() +{ + reconstruction_missing("Entity_Knife::Update 00961b00"); +} + +// 00967db0 +void Entity_Knife::Interpolate() +{ + reconstruction_missing("Entity_Knife::Interpolate 00967db0"); +} + +// 00965d30 +void Entity_Knife::Render(const Vector&) +{ + reconstruction_missing("Entity_Knife::Render 00965d30"); +} + +// 009611d0 +void Entity_Knife::ClearReferences() +{ + reconstruction_missing("Entity_Knife::ClearReferences 009611d0"); +} + +// 009666f0 +bool Entity_Knife::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Knife::HandleCollision 009666f0"); +} + +// 00960a20 +int Entity_Knife::GetBaseVariant() +{ + reconstruction_missing("Entity_Knife::GetBaseVariant 00960a20"); +} + +// 009612e0 +void* Entity_Knife::GetHitEntities() +{ + reconstruction_missing("Entity_Knife::GetHitEntities 009612e0"); +} + +// 00961320 +void Entity_Knife::InitHomingPath(Vector, Entity*, float) +{ + reconstruction_missing("Entity_Knife::InitHomingPath 00961320"); +} + +// 009614d0 +void Entity_Knife::copy_parent_state(Entity_Knife*) +{ + reconstruction_missing("Entity_Knife::copy_parent_state 009614d0"); +} + +// 00961870 +uint32_t Entity_Knife::spawn_child_knife() +{ + reconstruction_missing("Entity_Knife::spawn_child_knife 00961870"); +} + +// 00966650 +Entity_Player* Entity_Knife::GetPlayer() +{ + reconstruction_missing("Entity_Knife::GetPlayer 00966650"); +} + +// 00966ef0 +void Entity_Knife::Shoot(float, float) +{ + reconstruction_missing("Entity_Knife::Shoot 00966ef0"); +} + +// 00967180 +void Entity_Knife::UpdateHomingPath() +{ + reconstruction_missing("Entity_Knife::UpdateHomingPath 00967180"); +} + +// 00967650 +void Entity_Knife::update_target(float*) +{ + reconstruction_missing("Entity_Knife::update_target 00967650"); +} + +// 00967a70 +void Entity_Knife::apply_wiggle(float*) +{ + reconstruction_missing("Entity_Knife::apply_wiggle 00967a70"); +} + +// 00967d20 +void Entity_Knife::screen_wrap() +{ + reconstruction_missing("Entity_Knife::screen_wrap 00967d20"); +} + +// 00967fc0 +void Entity_Knife::Reset() +{ + reconstruction_missing("Entity_Knife::Reset 00967fc0"); +} + +// 009680d0 +void Entity_Knife::SetAttackAnimation() +{ + reconstruction_missing("Entity_Knife::SetAttackAnimation 009680d0"); +} + +// 00968430 +void Entity_Knife::SpinAttack(short, int) +{ + reconstruction_missing("Entity_Knife::SpinAttack 00968430"); +} + +// 00968660 +uint8_t Entity_Knife::drain_notched_axe(int) +{ + reconstruction_missing("Entity_Knife::drain_notched_axe 00968660"); +} + +// 009688d0 +void Entity_Knife::UpdateSwingHits() +{ + reconstruction_missing("Entity_Knife::UpdateSwingHits 009688d0"); +} diff --git a/src/entity_knife.h b/src/entity_knife.h new file mode 100644 index 0000000..a35543d --- /dev/null +++ b/src/entity_knife.h @@ -0,0 +1,70 @@ +#pragma once + +#include "entity.h" +#include +#include + +// Construction and destruction (00960b50, 00960a70) are the defaults. The homing path waits for HomingLaser's +// takeover. +// Field accessors (004d7790, 004d77a0, 0060cf10, 0060cfb0, 0085de90, 0085deb0, 0085dec0) are the public fields. +// A knife (Lua's EntityKnife): Mom's Knife and the swung weapons (bones, clubs, swords), with the tear effects they +// carry, their charge and flight, and the path a homing knife follows. +struct Entity_Knife : Entity +{ + std::unique_ptr homingLaser; + std::vector hitList; + TearFlags tearFlags; + TearFlags usedTearFlags; + Vector anchorPosition{}; + Vector initPosition{}; + float basePosOffsetY = 0; + float charge = 0; + float displayRotation = 0; + float fallingSpeed = 0; + float height = 0; + float knifeDepthOffset = 0; + float knifeDistance = 0; + float knifeVelocity = 0; + float maxDistance = 0; + float pathFollowSpeed = 0; + float pathOffset = 0; + float pathProgress = 0; + float rotation = 0; + float rotationOffset = 0; + float scale = 0; + int pathSegment = 0; + bool isDeadEyeHit = false; + bool isFlying = false; + bool isMultidimensionalApplied = false; + bool isPrimaryClub = false; + bool isPrismApplied = false; + bool isSpinAttack = false; + bool isSwinging = false; + bool isUsingParentHitList = false; + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + int GetRenderZ() override; + void ClearReferences() override; + bool HandleCollision(Entity* collider, bool isLow) override; + + int GetBaseVariant(); + void* GetHitEntities(); + void InitHomingPath(Vector direction, Entity* source, float pathOffset); + void copy_parent_state(Entity_Knife* source); + uint32_t spawn_child_knife(); + Entity_Player* GetPlayer(); + Entity* GetRootParent(); + void Shoot(float charge, float range); + void UpdateHomingPath(); + void update_target(float* outAngle); + void apply_wiggle(float*); + void screen_wrap(); + void Reset(); + void SetAttackAnimation(); + void SpinAttack(short remainingSpins, int startFrame); + uint8_t drain_notched_axe(int charge); + void UpdateSwingHits(); +}; diff --git a/src/entity_laser.cpp b/src/entity_laser.cpp new file mode 100644 index 0000000..539c3e8 --- /dev/null +++ b/src/entity_laser.cpp @@ -0,0 +1,230 @@ +#include "entity_laser.h" +#include "log.h" + +// The laser subtypes that draw a ring. +constexpr int LASER_SUBTYPE_RING_FIRST = 1; +constexpr int LASER_SUBTYPE_RING_LAST = 3; + +// 0096ced0 Sorts by its depth, ignoring the sorting layer. +int Entity_Laser::GetRenderZ() +{ + return render_z_get(renderDepthOffset + pos.y); +} + +// 0097e7a0 Whether EntityFactory may reuse it: never before its first update. +bool Entity_Laser::CanOverwrite() +{ + return !HasEntityFlags(FLAG_DONT_OVERWRITE) && !isFirstUpdate; +} + +// 005ccc20 Collides with nothing it reacts to, letting the collision through. +bool Entity_Laser::HandleCollision(Entity*, bool) +{ + return true; +} + +// 00435f50 Whether it is a ring laser (Tech X and the like). +bool Entity_Laser::IsCircleLaser() +{ + return subtype >= LASER_SUBTYPE_RING_FIRST && subtype <= LASER_SUBTYPE_RING_LAST; +} + +// The rest of Entity_Laser is not reconstructed yet. + +// 0096f590 +void Entity_Laser::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Laser::Init 0096f590"); +} + +// 00977cc0 +void Entity_Laser::Update() +{ + reconstruction_missing("Entity_Laser::Update 00977cc0"); +} + +// 0097e6f0 +void Entity_Laser::Interpolate() +{ + reconstruction_missing("Entity_Laser::Interpolate 0097e6f0"); +} + +// 009785d0 +void Entity_Laser::Render(const Vector&) +{ + reconstruction_missing("Entity_Laser::Render 009785d0"); +} + +// 0097ca90 +bool Entity_Laser::RenderShadowLayer(const Vector&) +{ + reconstruction_missing("Entity_Laser::RenderShadowLayer 0097ca90"); +} + +// 0097eb50 +void Entity_Laser::PostRender() +{ + reconstruction_missing("Entity_Laser::PostRender 0097eb50"); +} + +// 0097ea30 +void Entity_Laser::Remove() +{ + reconstruction_missing("Entity_Laser::Remove 0097ea30"); +} + +// 0097e800 +void Entity_Laser::ClearReferences() +{ + reconstruction_missing("Entity_Laser::ClearReferences 0097e800"); +} + +// 0096ce30 +bool Entity_Laser::is_thick_variant() +{ + reconstruction_missing("Entity_Laser::is_thick_variant 0096ce30"); +} + +// 0096cf80 +bool Entity_Laser::CanDamageEntity(Entity*) +{ + reconstruction_missing("Entity_Laser::CanDamageEntity 0096cf80"); +} + +// 0096d3f0 +void Entity_Laser::impact_tear_flag_effects(const Vector&, const Vector&) +{ + reconstruction_missing("Entity_Laser::impact_tear_flag_effects 0096d3f0"); +} + +// 0096ee00 +ColorMod* Entity_Laser::get_tear_spawn_color(const ColorMod&) +{ + reconstruction_missing("Entity_Laser::get_tear_spawn_color 0096ee00"); +} + +// 0096f070 +void Entity_Laser::copy_from_parent(Entity_Laser*, bool) +{ + reconstruction_missing("Entity_Laser::copy_from_parent 0096f070"); +} + +// 0096f470 +void Entity_Laser::RotateToAngle(float, float) +{ + reconstruction_missing("Entity_Laser::RotateToAngle 0096f470"); +} + +// 0096f4e0 +void Entity_Laser::ClearLaserSamples() +{ + reconstruction_missing("Entity_Laser::ClearLaserSamples 0096f4e0"); +} + +// 0096f880 +void Entity_Laser::PlayInitSound() +{ + reconstruction_missing("Entity_Laser::PlayInitSound 0096f880"); +} + +// 0096fc70 +Vector Entity_Laser::calc_end_point(const Vector&, const Vector&) +{ + reconstruction_missing("Entity_Laser::calc_end_point 0096fc70"); +} + +// 009704a0 +void Entity_Laser::update_first_frame() +{ + reconstruction_missing("Entity_Laser::update_first_frame 009704a0"); +} + +// 00970cb0 +void Entity_Laser::find_nearest_grid_hit(int, const Vector&) +{ + reconstruction_missing("Entity_Laser::find_nearest_grid_hit 00970cb0"); +} + +// 00971590 +uint8_t Entity_Laser::damage_grid_entity(int, int, const Vector&) +{ + reconstruction_missing("Entity_Laser::damage_grid_entity 00971590"); +} + +// 00971810 +void Entity_Laser::update_line_hits() +{ + reconstruction_missing("Entity_Laser::update_line_hits 00971810"); +} + +// 009737b0 +void Entity_Laser::update_endpoint_and_hits() +{ + reconstruction_missing("Entity_Laser::update_endpoint_and_hits 009737b0"); +} + +// 00973a50 +void Entity_Laser::refresh_tear_params() +{ + reconstruction_missing("Entity_Laser::refresh_tear_params 00973a50"); +} + +// 00973c60 +void Entity_Laser::update_laser() +{ + reconstruction_missing("Entity_Laser::update_laser 00973c60"); +} + +// 0097baa0 +void Entity_Laser::UpdateHits() +{ + reconstruction_missing("Entity_Laser::UpdateHits 0097baa0"); +} + +// 0097e3b0 +void* Entity_Laser::GetSamples() +{ + reconstruction_missing("Entity_Laser::GetSamples 0097e3b0"); +} + +// 0097e3c0 +void Entity_Laser::damage_entity(Entity*) +{ + reconstruction_missing("Entity_Laser::damage_entity 0097e3c0"); +} + +// 0097e6e0 +void* Entity_Laser::GetNonOptimizedSamples() +{ + reconstruction_missing("Entity_Laser::GetNonOptimizedSamples 0097e6e0"); +} + +// 0097f820 +void Entity_Laser::spawn_impact_effect(int) +{ + reconstruction_missing("Entity_Laser::spawn_impact_effect 0097f820"); +} + +// 0097fc10 +void Entity_Laser::ResetSpriteScale() +{ + reconstruction_missing("Entity_Laser::ResetSpriteScale 0097fc10"); +} + +// 0097fe50 +void Entity_Laser::set_scale(float) +{ + reconstruction_missing("Entity_Laser::set_scale 0097fe50"); +} + +// 0097fe60 +void Entity_Laser::update_sample_points(char) +{ + reconstruction_missing("Entity_Laser::update_sample_points 0097fe60"); +} + +// 0099efc0 +void Entity_Laser::update_wiggle_path(void*, float, float) +{ + reconstruction_missing("Entity_Laser::update_wiggle_path 0099efc0"); +} diff --git a/src/entity_laser.h b/src/entity_laser.h new file mode 100644 index 0000000..5e3db18 --- /dev/null +++ b/src/entity_laser.h @@ -0,0 +1,102 @@ +#pragma once + +#include "entity.h" +#include +#include +#include + +// Construction and destruction (0096ccf0, 0096cb60, 0096cd20) are the defaults. The homing path waits for +// HomingLaser's takeover. +// Field accessors (00435f20, 00435f30, 00456850, 004aaed0, 005cd580, 005cd590, 0060cea0, 0060ceb0, 007e9230, +// 007e9240) are the public fields. +// A laser (Lua's EntityLaser): a beam from its parent at an angle, its length, timeout and tear effects, the curve a +// homing one follows, and the lasers it splits into. +struct Entity_Laser : Entity +{ + std::array prismLasers; + std::array multidimensionalLasers; + std::array subLasers; + std::unique_ptr homingLaser; + std::vector hitList; + TearFlags activeTearFlags; + TearFlags heldTearFlags; + TearFlags tearFlags; + EntityPtr childLaser; + EntityPtr continuumLaser; + EntityPtr parentLaser; + EntityPtr tearWaitEffect; + Entity* bounceLaser = nullptr; + Vector endPoint{}; + Vector impactDirection{}; + Vector impactPosition{}; + Vector parentOffset{}; + float angleDegrees = 0; + float blackHpDropChance = 0; + float curveStrength = 0; + float damageMultiplier = 0; + float impactDistance = 0; + float laserLength = 0; + float lastAngleDegrees = 0; + float maxDistance = 0; + float radius = 0; + float rotationDegrees = 0; + float rotationSpd = 0; + float scale = 0; + float startAngleDegrees = 0; + float subLaserAngle = 0; + float subLaserDistance = 0; + int chainedLasers = 0; + int timeout = 0; + int waitFrames = 0; + uint32_t homingType = 0; + uint32_t rotationDelay = 0; + bool isActiveRotating = false; + bool isDisableFollowParent = false; + bool isDisableInitSound = false; + bool isFirstUpdate = false; + bool isGridHit = false; + bool isMultidimensionalTouched = false; + bool isOneHit = false; + bool isPrismTouched = false; + bool isSampleLaser = false; + bool isShrink = false; + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + bool RenderShadowLayer(const Vector& offset) override; + void PostRender() override; + void Remove() override; + int GetRenderZ() override; + bool CanOverwrite() override; + void ClearReferences() override; + bool HandleCollision(Entity* collider, bool isLow) override; + + bool IsCircleLaser(); + bool is_thick_variant(); + bool CanDamageEntity(Entity* entity); + void impact_tear_flag_effects(const Vector& position, const Vector& direction); + ColorMod* get_tear_spawn_color(const ColorMod& outColor); + void copy_from_parent(Entity_Laser* parent, bool isCopySpawnData); + void RotateToAngle(float angle, float speed); + void ClearLaserSamples(); + void PlayInitSound(); + Vector calc_end_point(const Vector& start, const Vector& direction); + void update_first_frame(); + void find_nearest_grid_hit(int unusedFlag, const Vector& offset); + uint8_t damage_grid_entity(int gridIndex, int unused, const Vector& direction); + void update_line_hits(); + void update_endpoint_and_hits(); + void refresh_tear_params(); + void update_laser(); + void UpdateHits(); + void* GetSamples(); + void damage_entity(Entity*); + void* GetNonOptimizedSamples(); + void spawn_impact_effect(int unused); + void ResetSpriteScale(); + void set_scale(float scale); + void update_sample_points(char); + static void update_wiggle_path(void* samples, float amplitude, float phase); +}; diff --git a/src/entity_list.cpp b/src/entity_list.cpp new file mode 100644 index 0000000..046a61d --- /dev/null +++ b/src/entity_list.cpp @@ -0,0 +1,721 @@ +#include "entity_list.h" +#include "entity_effect.h" +#include "entity_npc.h" +#include "entity_player.h" +#include "entity_projectile.h" +#include "entity_tear.h" +#include "game.h" +#include "log.h" +#include "manager.h" +#include "room.h" +#include +#include +#include +#include + +constexpr const char* SHADOW_PNG = "gfx/shadow.png"; +constexpr int FAMILIAR_WISP = 206; +constexpr int FAMILIAR_CUBE_BABY = 239; +constexpr int BOMB_ROCKET = 19; +constexpr int BOMB_ROCKET_GIGA = 20; +constexpr int ENTITY_ULTRA_GREED = 406; +constexpr int ENTITY_BUMBINO = 916; +constexpr int KNIFE_MAIN = 0; +// The boss bar flashes for this many frames when the bosses' health changes. +constexpr int BOSS_BAR_FLASH_FRAMES = 8; +// The render bands sort_by_render_z first partitions the list into: background, doors, and the rest. +constexpr uint32_t RENDER_Z_DOOR_START = 5000; +constexpr uint32_t RENDER_Z_NORMAL_START = 10000; +// The swaps a frame's sort may make: a sixteenth of the original's fixed render list capacity, plus one. +constexpr int RENDER_LIST_CAPACITY = 0x4000; +constexpr int RENDER_SORT_SWAP_BUDGET = (RENDER_LIST_CAPACITY >> 4) + 1; + +// Formats a message for KAGE_LogMessage, whose declaration takes nothing to format with. +[[gnu::format(printf, 2, 3)]] static void log_format(uint32_t level, const char* format, ...) +{ + char message[256]; + va_list args; + + va_start(args, format); + std::vsnprintf(message, sizeof(message), format, args); + va_end(args); + KAGE_LogMessage(level, (uint8_t*)message); +} + +static bool is_unit_size(const Entity& entity) +{ + return entity.sizeMulti.x == 1 && entity.sizeMulti.y == 1; +} + +// Pushes one entity off another: as circles when neither is stretched, as capsules otherwise. +static void entity_push_apart(Entity& pusher, Entity& other) +{ + if (is_unit_size(pusher) && is_unit_size(other)) pusher.push_apart_circle(&other); + else pusher.push_apart_capsule(&other); +} + +// 00417670 Drops every occurrence of the entity. +void EntityList_EL::remove(Entity* entity) +{ + std::erase(*this, entity); +} + +// 0085e0c0 The entity at the index, the last one for an index past the end. +// The original read before the list when it was empty: nothing is returned then. +Entity* EntityList_EL::Get(uint32_t index) +{ + if (empty()) return nullptr; + return (*this)[std::min(index, size() - 1)]; +} + +// Sizes the grid to cover width by height in cells of size, owned by the list whose collision pairs it marks. +void CellSpace::layout(EntityList& list, float width, float height, float size) +{ + owner = &list; + cellSize = size; + rows = (int)(height / size + 0.5f); + columns = (int)(width / size + 0.5f); + cells.assign((size_t)(rows * columns), Cell{}); +} + +// 0041baf0 Empties every cell. +void CellSpace::clear() +{ + for (Cell& cell : cells) cell.count = 0; +} + +// The cell at the column and row, counted through the grid in rows, or null past either end. +CellSpace::Cell* CellSpace::cell_get(int column, int row) +{ + int index = columns * row + column; + return index >= 0 && index < (int)cells.size() ? &cells[index] : nullptr; +} + +// 0041bb50 Lists the entity in every cell its collision box covers, turned with its sprite when stretched. +void CellSpace::insert(Entity& entity) +{ + float halfWidth = entity.sizeMulti.x * entity.size; + float halfHeight = entity.sizeMulti.y * entity.size; + if (!is_unit_size(entity) && entity.sprite.rotation != 0) + { + float angle = entity.sprite.rotation * 0.017453292f; + float cosine = std::cos(angle); + float sine = std::sin(angle); + float turnedHeight = std::fabs(halfHeight * cosine) + std::fabs(halfWidth * sine); + halfWidth = std::fabs(halfHeight * sine) + std::fabs(halfWidth * cosine); + halfHeight = turnedHeight; + } + + float left = entity.pos.x - halfWidth; + float right = halfWidth + entity.pos.x; + float top = entity.pos.y - halfHeight; + float bottom = halfHeight + entity.pos.y; + if (right <= left || bottom <= top) + log_format(LOG_ASSERT, + "Entity Teleport Detected! Type: %d, Variant: %d, Subtype: %d; Pos: %f, %f; Size: %f, %f\n", + entity.type, entity.variant, entity.subtype, entity.pos.x, entity.pos.y, halfWidth, halfHeight); + + int firstRow = (int)(top / cellSize); + int lastRow = (int)(bottom / cellSize); + if (lastRow < firstRow) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"CellSpace::insert: y1 > y2\n"); + int firstColumn = (int)(left / cellSize); + int lastColumn = (int)(right / cellSize); + if (lastColumn < firstColumn) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"CellSpace::insert: x1 > x2\n"); + + for (int row = firstRow; row <= lastRow; row++) + { + for (int column = firstColumn; column <= lastColumn; column++) + { + Cell* cell = cell_get(column, row); + if (cell && cell->count < CELL_CAPACITY) cell->entities[cell->count++] = &entity; + } + } +} + +// 0041bdf0 Pushes the entities in the cells under the entity's box off it, each pair once a frame. +void CellSpace::collide_entity(Entity& entity) +{ + if (entity.entityCollisionClass == ENTCOLL_NONE) return; + + float halfWidth = entity.size * entity.sizeMulti.x; + float halfHeight = entity.size * entity.sizeMulti.y; + int lastRow = (int)((halfHeight + entity.pos.y) / cellSize); + int lastColumn = (int)((halfWidth + entity.pos.x) / cellSize); + for (int row = (int)((entity.pos.y - halfHeight) / cellSize); row <= lastRow; row++) + { + for (int column = (int)((entity.pos.x - halfWidth) / cellSize); column <= lastColumn; column++) + { + Cell* cell = cell_get(column, row); + for (int i = 0; cell && i < cell->count; i++) + { + Entity& other = *cell->entities[i]; + if (&other == &entity || !owner->is_pair_new(other, entity)) continue; + entity_push_apart(other, entity); + } + } + } +} + +// 0041c070 Pushes this partition's entities off the other's that share their cells, each pair once a frame. +void CellSpace::collide(CellSpace& other) +{ + if (cells.size() != other.cells.size()) + KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"CellSpace::collide - cell counts don't match!\n"); + + for (size_t c = 0; c < std::min(cells.size(), other.cells.size()); c++) + { + for (int i = 0; i < cells[c].count; i++) + { + for (int j = 0; j < other.cells[c].count; j++) + { + Entity& first = *cells[c].entities[i]; + Entity& second = *other.cells[c].entities[j]; + if (&first != &second && owner->is_pair_new(first, second)) entity_push_apart(first, second); + } + } + } +} + +// 0041c2a0 Pushes the entities sharing each cell off each other, each pair once a frame. +void CellSpace::collide_self() +{ + for (Cell& cell : cells) + { + for (int i = 0; i < cell.count; i++) + { + for (int j = i + 1; j < cell.count; j++) + { + Entity& first = *cell.entities[i]; + Entity& second = *cell.entities[j]; + if (&first != &second && owner->is_pair_new(first, second)) entity_push_apart(first, second); + } + } + } +} + +// 0041c490 Adds the entities listed in the cells under a box to the result, each once. +void CellSpace::query_box(EntityList_EL& result, const Vector& position, const Vector& extent) +{ + if (owner->collisionPairStride == 0) return; + + std::vector isSeen((size_t)owner->collisionPairStride); + int lastRow = (int)((extent.y + position.y) / cellSize); + int firstColumn = (int)((position.x - extent.x) / cellSize); + int lastColumn = (int)((extent.x + position.x) / cellSize); + for (int row = (int)((position.y - extent.y) / cellSize); row <= lastRow; row++) + { + for (int column = firstColumn; column <= lastColumn; column++) + { + Cell* cell = cell_get(column, row); + for (int i = 0; cell && i < cell->count; i++) + { + Entity* entity = cell->entities[i]; + if (isSeen[entity->collisionIndex]) continue; + result.push_back(entity); + isSeen[entity->collisionIndex] = true; + } + } + } +} + +// Whether the pair has not collided yet this frame, marking it as collided. +bool EntityList::is_pair_new(Entity& first, Entity& second) +{ + uint32_t high = std::max(first.collisionIndex, second.collisionIndex); + uint32_t low = std::min(first.collisionIndex, second.collisionIndex); + size_t pair = (size_t)high * (size_t)collisionPairStride + low; + if (pair >= collisionPairs.size() || collisionPairs[pair]) return false; + + collisionPairs[pair] = true; + return true; +} + +EntityList::EntityList() +{ + for (CellSpace& partition : partitions) + partition.layout(*this, PARTITION_WIDTH, PARTITION_HEIGHT, PARTITION_CELL_SIZE); + shadowImage = Manager::LoadImage(SHADOW_PNG); + Reset(); +} + +// 00418230 Removes every entity but the persistent ones, and starts the lists over with those. +void EntityList::Reset() +{ + updateEL.clear(); + renderEL.clear(); + effectEL.clear(); + for (Entity* entity : mainEL) + { + if (entity->HasEntityFlags(FLAG_PERSISTENT)) + { + updateEL.push_back(entity); + renderEL.push_back(entity); + continue; + } + entity->ClearReferences(); + entity->isValid = false; + entity->Remove(); + } + mainEL.assign(updateEL.begin(), updateEL.end()); + wispEL.clear(); + for (Entity* entity : persistentEL) + { + updateEL.push_back(entity); + renderEL.push_back(entity); + } + for (Entity* entity : updateEL) + if (entity->type == ENTITY_FAMILIAR && entity->variant == FAMILIAR_WISP) wispEL.push_back(entity); + + renderCursor = 0; + renderMode = RENDER_NULL; + pendingEnemyCount = 0; + enemyCount = 0; + pendingBossCount = 0; + bossCount = 0; + bossMaxHealth = 0; + enemyDamageInflicted = 0; + isAnyBaited = false; + typeCache.clear(); +} + +// 00418500 Adds a new entity to its lists, the render list in depth order, counting the enemies that shut the doors. +// One already listed moves to the end of the update list. +void EntityList::AddEntity(Entity* entity) +{ + if (!entity->isValid) + { + bool isPersistent = entity->type == ENTITY_PLAYER || entity->type == ENTITY_FAMILIAR || + (entity->type == ENTITY_KNIFE && entity->subtype == KNIFE_MAIN); + (isPersistent ? persistentEL : mainEL).push_back(entity); + if (entity->CanShutDoors() && entity->type != ENTITY_DARK_ESAU) + { + pendingEnemyCount++; + if (entity->IsBoss()) pendingBossCount++; + } + entity->isValid = true; + + size_t at = 0; + while (at < renderEL.size() && entity->GetRenderZ() > renderEL[at]->GetRenderZ()) at++; + renderEL.insert(renderEL.begin() + (long)at, entity); + if (entity->type == ENTITY_FAMILIAR && entity->variant == FAMILIAR_WISP) wispEL.push_back(entity); + } + else + updateEL.remove(entity); + + if (!entity->HasEntityFlags(FLAG_RENDER_FLOOR)) updateEL.push_back(entity); + invalidate_type_cache(entity->type, entity->variant, entity->subtype); +} + +// 0041b4f0 Moves an entity to the persistent list, unless that list is nearly full. +void EntityList::AddPersistentEntity(Entity* entity) +{ + if (persistentEL.size() + PERSISTENT_RESERVE >= PERSISTENT_CAPACITY) + { + KAGE_LogMessage(LOG_INFO, (uint8_t*)"[warn] Can't add more persistent entities, persistent list is full!\n"); + return; + } + + mainEL.remove(entity); + bool isListed = std::find(persistentEL.begin(), persistentEL.end(), entity) != persistentEL.end(); + if (!isListed) persistentEL.push_back(entity); +} + +// 004186c0 One frame of the room's entities: pre-updates and updates (only those that update in transitions during +// one), the players' in-between updates without interpolation, the enemy and boss counts and the boss bar, the +// removal of the entities that stopped existing, then the collisions and the draw order. +// Netplay's per-entity checksums are left out: netplay is offline. +void EntityList::Update(UpdateMode mode) +{ + typeCache.clear(); + UpdateTally tally; + if (updateEL.empty()) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"EntityList: e_update is empty!\n"); + else entities_update(mode, tally); + + for (Entity_Player* player : g_game->playerManager.extraPlayers) player->Update(); + if (!g_manager->optionsConfig.render.isInterpolationEnabled) players_update(mode); + + enemyCount = pendingEnemyCount + tally.activeEnemies; + pendingEnemyCount = 0; + bossCount = pendingBossCount + tally.bosses; + pendingBossCount = 0; + isAnyBaited = tally.isAnyBaited; + boss_bar_update(tally); + enemyDamageInflicted = tally.damageInflicted; + for (Entity* entity : renderEL) + { + if (entity->isExists && entity->HasEntityFlags(FLAG_RENDER_FLOOR | FLAG_RENDER_WALL)) + reconstruction_missing("EntityList::Update 004186c0: drawing entities into the floor and wall surfaces"); + } + + if (tally.isAnyRemoved) removed_drop(); + if (mode == UPDATE_NORMAL) rebuild_sublists(); + sort_by_render_z(); +} + +// Whether the entity sits this update out: drawn into the floor or walls and gone, or still during a transition. +static bool is_update_skipped(Entity& entity, UpdateMode mode) +{ + bool isDrawnAway = entity.HasEntityFlags(FLAG_RENDER_FLOOR) && !entity.HasEntityFlags(FLAG_NO_REMOVE_ON_TEX_RENDER); + return isDrawnAway || (mode == UPDATE_TRANSITION && !entity.HasEntityFlags(FLAG_TRANSITION_UPDATE)); +} + +// The damage an enemy has taken so far, which the frame's total compares before and after its update. +static float damage_taken_get(Entity& entity) +{ + if (!Entity::is_enemy_type(entity.type)) return 0; + if (entity.type == ENTITY_PLAYER) reconstruction_missing("EntityList::Update 004186c0: a versus player's damage"); + return static_cast(entity).totalDamageTaken; +} + +// Pre-updates then updates the entities listed at the start of the frame, tallying the door-holding enemies, the +// bosses and their health, the damage the enemies took, and whether any is baited or stopped existing. +void EntityList::entities_update(UpdateMode mode, UpdateTally& tally) +{ + Entity* last = updateEL.back(); + for (size_t i = 0;; i++) + { + Entity* entity = updateEL[i]; + if (entity->isExists && !is_update_skipped(*entity, mode)) entity->PreUpdate(); + if (entity == last || i + 1 >= updateEL.size()) break; + } + + for (size_t i = 0;; i++) + { + Entity* entity = updateEL[i]; + float damageBefore = damage_taken_get(*entity); + + if (entity->isExists && !is_update_skipped(*entity, mode)) entity->Update(); + if (entity->isExists && entity->type != ENTITY_DARK_ESAU) + { + if (entity->CanShutDoors()) + { + tally.activeEnemies++; + if (entity->IsBoss() && !entity->HasEntityFlags(FLAG_BOSSDEATH_TRIGGERED)) + { + bool isCounted = !entity->HasEntityFlags(FLAG_DONT_COUNT_BOSS_HP); + if (isCounted) tally.bosses++; + if (isCounted && entity->FrameCount() > 0) + { + tally.bossHealth += std::max(entity->health, 0.0f); + tally.bossMaxHealth = entity->maxHitPoints + tally.bossMaxHealth; + } + } + if (entity->type == ENTITY_EFFECT && entity->variant == EFFECT_SPAWN_PENTAGRAM) + { + Entity_Effect& pentagram = static_cast(*entity); + EntityConfig_Entity* spawned = g_manager->entityConfig.GetEntity( + pentagram.spawnType, pentagram.spawnVariant, pentagram.spawnSubtype); + if (spawned && spawned->isBoss) tally.bosses++; + } + } + + bool isDamageCounted = (entity->CanShutDoors() || entity->type == ENTITY_FROZEN_ENEMY) && + (Entity::is_enemy_type(entity->type) || entity->type == ENTITY_FROZEN_ENEMY) && + !entity->IsFriendly(); + bool isTrailingSegment = entity->type == ENTITY_PIN && entity->parent && entity->GetLastParent() != entity; + if (isDamageCounted && !isTrailingSegment) + { + float damageAfter = std::min(damage_taken_get(*entity), entity->maxHitPoints); + tally.damageInflicted += std::max(damageAfter - damageBefore, 0.0f); + } + } + if (!entity->isExists) tally.isAnyRemoved = true; + if (entity->HasEntityFlags(FLAG_BAITED)) tally.isAnyBaited = true; + if (entity == last || i + 1 >= updateEL.size()) break; + } +} + +// Updates the players and extra players a second time, flagged as the in-between frame, when the options turn +// interpolation off. +void EntityList::players_update(UpdateMode mode) +{ + std::vector& players = g_game->playerManager.playerList; + for (size_t i = 0; i < players.size(); i++) + { + Entity_Player* player = players[i]; + if (mode == UPDATE_TRANSITION && !player->HasEntityFlags(FLAG_TRANSITION_UPDATE)) continue; + + player->AddEntityFlags(FLAG_INTERPOLATION_UPDATE); + player->Update(); + player->PlayerCollideWithGrid(GRID_COLLISION_APPLY); + player->ClearEntityFlags(FLAG_INTERPOLATION_UPDATE); + } + for (Entity_Player* player : g_game->playerManager.extraPlayers) + { + player->AddEntityFlags(FLAG_INTERPOLATION_UPDATE); + player->Update(); + player->ClearEntityFlags(FLAG_INTERPOLATION_UPDATE); + } +} + +// Sets the boss bar to the bosses' share of health left, against the most health they have had, flashing it on a +// change. Without bosses the bar hides. +void EntityList::boss_bar_update(const UpdateTally& tally) +{ + HUD& hud = g_game->hud; + float fill = BOSS_BAR_HIDDEN; + + if (tally.bosses < 1) + { + bossMaxHealth = 0; + if (hud.bossHPBarFill > BOSS_BAR_HIDDEN) hud.bossHPBarDamageFlash = BOSS_BAR_FLASH_FRAMES; + } + else + { + bossMaxHealth = std::max(tally.bossMaxHealth, bossMaxHealth); + fill = tally.bossHealth / bossMaxHealth; + if (fill < hud.bossHPBarFill) hud.bossHPBarDamageFlash = BOSS_BAR_FLASH_FRAMES; + } + if (hud.bossHPBarFill < fill && hud.bossHPBarFill != BOSS_BAR_HIDDEN) + { + hud.bossHPBarDamageFlash = FLASH_OFF; + hud.bossHPBarHealFlash = BOSS_BAR_FLASH_FRAMES; + } + hud.bossHPBarFill = fill; +} + +// Drops the entities that stopped existing from every list, unlinking them, and frees a removed player. +void EntityList::removed_drop() +{ + auto isGone = [](Entity* entity) { return !entity->isExists; }; + + std::erase_if(updateEL, isGone); + std::erase_if(renderEL, isGone); + std::erase_if(wispEL, isGone); + std::erase_if(mainEL, + [](Entity* entity) + { + if (entity->isExists) return false; + entity->ClearReferences(); + entity->isValid = false; + return true; + }); + std::erase_if(persistentEL, + [](Entity* entity) + { + if (entity->isExists) return false; + bool wasValid = entity->isValid; + entity->ClearReferences(); + entity->isValid = false; + if (entity->type == ENTITY_PLAYER && wasValid) delete entity; + return true; + }); +} + +// 00419e70 Sorts the colliding entities into the partitions, collides the partitions that touch, pushes twins apart, +// then collides everything but lasers with the grid. +void EntityList::rebuild_sublists() +{ + effectEL.clear(); + for (CellSpace& partition : partitions) partition.clear(); + + bool isShieldPresent = false; + uint32_t indexCount = 0; + for (Entity* entity : updateEL) + { + entity->isCollidesWithEntity = false; + if (entity->entityCollisionClass == ENTCOLL_NONE) continue; + + int type = entity->type; + bool isIndexed = true; + if (type == ENTITY_FAMILIAR && entity->variant == FAMILIAR_CUBE_BABY) + { + partitions[PARTITION_ENEMIES].insert(*entity); + partitions[PARTITION_ENEMY_TARGETS].insert(*entity); + } + else if (type == ENTITY_FAMILIAR) + partitions[PARTITION_FAMILIARS].insert(*entity); + else if (type == ENTITY_PROJECTILE) + { + uint64_t projectileFlags = static_cast(entity)->projectileFlags; + partitions[PARTITION_PROJECTILES].insert(*entity); + if (projectileFlags & PROJECTILE_SHIELDED) isShieldPresent = true; + if (projectileFlags & PROJECTILE_HIT_ENEMIES) partitions[PARTITION_ENEMY_HITTERS].insert(*entity); + } + else if (type == ENTITY_TEAR || type == ENTITY_KNIFE) + { + bool isShieldTear = type == ENTITY_TEAR && static_cast(entity)->tearFlags[TEAR_SHIELDED]; + if (isShieldTear) isShieldPresent = true; + partitions[PARTITION_SHOTS].insert(*entity); + } + else if (Entity::is_enemy_type(type) || type == ENTITY_BOMB) + { + partitions[PARTITION_ENEMIES].insert(*entity); + bool isRocketVariant = entity->variant == BOMB_ROCKET || entity->variant == BOMB_ROCKET_GIGA; + bool isRocket = type == ENTITY_BOMB && isRocketVariant; + bool isPickupTaker = type == ENTITY_ULTRA_GREED || type == ENTITY_BUMBINO || isRocket; + if (isPickupTaker) partitions[PARTITION_PICKUP_TAKERS].insert(*entity); + bool isTargetable = entity->IsFriendly() || type == ENTITY_POOP || type == ENTITY_FROZEN_ENEMY || + entity->HasEntityFlags(FLAG_BAITED) || type == ENTITY_BLOOD_PUPPY || + type == ENTITY_DARK_ESAU; + if (isTargetable) partitions[PARTITION_ENEMY_TARGETS].insert(*entity); + } + else if (type == ENTITY_PICKUP || type == ENTITY_SLOT) + partitions[PARTITION_PICKUPS].insert(*entity); + else + isIndexed = type == ENTITY_PLAYER; + + if (isIndexed) entity->collisionIndex = indexCount++; + if (type == ENTITY_EFFECT) effectEL.push_back(entity); + } + + collisionPairs.assign((size_t)indexCount * indexCount, false); + collisionPairStride = (int)indexCount; + + std::vector& players = g_game->playerManager.playerList; + bool isVersus = g_game->deathmatchManager.is_active(); + auto playersCollide = [&players](CellSpace& partition) + { + for (Entity_Player* player : players) partition.collide_entity(*player); + }; + + CellSpace& familiars = partitions[PARTITION_FAMILIARS]; + CellSpace& shots = partitions[PARTITION_SHOTS]; + CellSpace& enemies = partitions[PARTITION_ENEMIES]; + CellSpace& projectiles = partitions[PARTITION_PROJECTILES]; + CellSpace& pickups = partitions[PARTITION_PICKUPS]; + if (isVersus) + { + familiars.collide(shots); + shots.collide(shots); + } + familiars.collide(projectiles); + familiars.collide(enemies); + playersCollide(familiars); + shots.collide(enemies); + enemies.collide_self(); + playersCollide(enemies); + playersCollide(projectiles); + playersCollide(pickups); + if (isVersus) playersCollide(shots); + pickups.collide_self(); + pickups.collide(partitions[PARTITION_PICKUP_TAKERS]); + partitions[PARTITION_ENEMY_HITTERS].collide(enemies); + if (isShieldPresent) projectiles.collide(shots); + partitions[PARTITION_ENEMY_TARGETS].collide(projectiles); + partitions[PARTITION_ENEMY_TARGETS].collide(enemies); + twins_push_apart(); + + for (Entity* entity : updateEL) + { + if (entity->type == ENTITY_LASER) continue; + if (entity->type == ENTITY_PLAYER) entity->PlayerCollideWithGrid(GRID_COLLISION_APPLY); + else entity->CollideWithGrid(GRID_COLLISION_APPLY); + } +} + +// Pushes each pair of twin players apart once, the order alternating every frame. +void EntityList::twins_push_apart() +{ + for (Entity_Player* player : g_game->playerManager.playerList) + { + Entity_Player* twin = static_cast(player->twinPlayer.get()); + if (!twin) continue; + if (twin->playerIndex != -1 && player->playerIndex > twin->playerIndex && twin != player) continue; + + bool isEvenFrame = (g_game->frameCount & 1) == 0; + entity_push_apart(isEvenFrame ? *player : *twin, isEvenFrame ? *twin : *player); + entity_push_apart(isEvenFrame ? *twin : *player, isEvenFrame ? *player : *twin); + } +} + +// 00419750 Puts the render list back in draw order: one pass moves the normal layer behind the rest, another the +// door layer behind the background, then an insertion sort runs with a swap budget, its direction alternating every +// frame. +void EntityList::sort_by_render_z() +{ + if (renderEL.empty()) return; + + std::vector depths(renderEL.size()); + auto swap = [&](int a, int b) + { + std::swap(renderEL[a], renderEL[b]); + std::swap(depths[a], depths[b]); + }; + + int low = 0; + int high = (int)renderEL.size() - 1; + for (; low < high; high--) + { + depths[high] = (uint32_t)renderEL[high]->GetRenderZ(); + if (depths[high] >= RENDER_Z_NORMAL_START) continue; + for (; low < high; low++) + { + depths[low] = (uint32_t)renderEL[low]->GetRenderZ(); + if (depths[low] < RENDER_Z_NORMAL_START) continue; + swap(low, high); + break; + } + } + depths[low] = (uint32_t)renderEL[low]->GetRenderZ(); + + int count = (int)renderEL.size(); + int doorHigh = count - 1 <= high ? high : high + 1; + for (low = 0; low < doorHigh; doorHigh--) + { + if (depths[doorHigh] >= RENDER_Z_DOOR_START) continue; + for (; low < doorHigh; low++) + { + if (depths[low] < RENDER_Z_DOOR_START) continue; + swap(low, doorHigh); + break; + } + } + + int budget = RENDER_SORT_SWAP_BUDGET; + if ((g_game->frameCount & 1) == 0) + { + for (int i = 1; i < count && budget > 0; i++) + { + for (int j = i; j > 0 && depths[j - 1] > depths[j]; j--, budget--) swap(j, j - 1); + } + return; + } + for (int i = count - 1; i > 0 && budget > 0; i--) + { + for (int j = i; j < count && depths[j - 1] > depths[j]; j++, budget--) swap(j, j - 1); + } +} + +// 004199d0 Draws the render list from the cursor up to a depth, as the room's render pass asks: normally, or only +// what shows above, through or mirrored in its water. +void EntityList::render_up_to(uint32_t maxDepth, const Vector& offset) +{ + for (; renderCursor < renderEL.size(); renderCursor++) + { + Entity* entity = renderEL[renderCursor]; + if ((uint32_t)entity->GetRenderZ() >= maxDepth) return; + if (renderMode == RENDER_SKIP) continue; + if (renderMode >= RENDER_WATER_ABOVE && renderMode <= RENDER_WATER_REFLECT) + reconstruction_missing("EntityList::render_up_to 004199d0: the water passes (get_water_splash_variant)"); + entity->Render(offset); + } +} + +// 0041b570 Forgets the cached queries an entity of the type, variant and subtype now belongs to. +void EntityList::invalidate_type_cache(int type, int variant, int subType) +{ + typeCache.erase({type, variant, subType}); + typeCache.erase({type, variant, -1}); + typeCache.erase({type, -1, -1}); +} + +// 0041b7b0 (0041b690) How many entities updating match the type, variant and subtype (negatives match any), spawned +// by the spawner when one is given. With a spawner a type of 0 matches any too. +int EntityList::CountEntities(Entity* spawner, int type, int variant, int subType) +{ + return (int)std::count_if(updateEL.begin(), updateEL.end(), + [&](Entity* entity) + { + bool isTypeMatch = entity->type == type || (spawner && type == 0); + return isTypeMatch && (variant < 0 || entity->variant == variant) && + (subType < 0 || entity->subtype == subType) && + (!spawner || entity->spawnerEntity.get() == spawner); + }); +} + +// 00431640 Whether a sorted hit list holds the entity's hit index. +bool EntityList::HitListContains(const std::vector& hitList, Entity& entity) +{ + return std::binary_search(hitList.begin(), hitList.end(), entity.GetHitListIndex()); +} diff --git a/src/entity_list.h b/src/entity_list.h new file mode 100644 index 0000000..517fc7f --- /dev/null +++ b/src/entity_list.h @@ -0,0 +1,151 @@ +#pragma once + +#include "entity.h" +#include "kage_graphics.h" +#include +#include +#include + +// A partition's grid: cells of CELL_SIZE over the room's widest area, each holding up to CELL_CAPACITY entities. +constexpr float PARTITION_WIDTH = 1200; +constexpr float PARTITION_HEIGHT = 720; +constexpr float PARTITION_CELL_SIZE = 80; +constexpr int CELL_CAPACITY = 40; +// The persistent list refuses new entities this close to its capacity. +constexpr size_t PERSISTENT_CAPACITY = 0x100; +constexpr size_t PERSISTENT_RESERVE = 50; + +// The partitions EntityList sorts colliding entities into, by what they collide with. +enum Partition : int +{ + PARTITION_FAMILIARS, + PARTITION_SHOTS, + PARTITION_ENEMIES, + PARTITION_PROJECTILES, + PARTITION_PICKUPS, + PARTITION_ENEMY_HITTERS, + PARTITION_PICKUP_TAKERS, + PARTITION_ENEMY_TARGETS, + PARTITION_COUNT +}; + +// How the room draws its entities (Lua's RenderMode): normally, or in one of its water's passes. +enum RenderMode : int +{ + RENDER_NULL, + RENDER_NORMAL, + RENDER_SKIP, + RENDER_WATER_ABOVE, + RENDER_WATER_REFRACT, + RENDER_WATER_REFLECT +}; + +// Whether EntityList::Update runs during a room transition, when only some entities update. +enum UpdateMode +{ + UPDATE_NORMAL, + UPDATE_TRANSITION +}; + +// Construction from another list, push_back, sizing and copying (00417510, 00417630, 00417540, 004176f0, 006b8320) +// are std::vector's. +// A list of entities (Lua's EntityList): one of EntityList's own, or a query's result. +struct EntityList_EL : std::vector +{ + void remove(Entity* entity); + Entity* Get(uint32_t index); +}; + +struct EntityList; + +// What one frame's updates counted, which EntityList::Update applies once every update ran. +struct UpdateTally +{ + float bossHealth = 0; + float bossMaxHealth = 0; + float damageInflicted = 0; + int activeEnemies = 0; + int bosses = 0; + bool isAnyBaited = false; + bool isAnyRemoved = false; +}; + +// 0041b9f0 Construction lays the grid out. +// One of EntityList's partitions: a grid of cells over the room, each listing the colliding entities whose box covers +// it, so that only entities sharing a cell are tested against each other. +struct CellSpace +{ + // A cell's entities, the ones past CELL_CAPACITY dropped. + struct Cell + { + std::array entities{}; + int count = 0; + }; + + std::vector cells; + EntityList* owner = nullptr; + float cellSize = PARTITION_CELL_SIZE; + int columns = 0; + int rows = 0; + + void layout(EntityList& list, float width, float height, float size); + void clear(); + void insert(Entity& entity); + void collide_entity(Entity& entity); + void collide(CellSpace& other); + void collide_self(); + void query_box(EntityList_EL& result, const Vector& position, const Vector& extent); + Cell* cell_get(int column, int row); +}; + +// Construction (00417930, which Room's constructor ran) lays out the partitions, loads the shadow image and resets. +// The entities of a room (Room::entityList): every one spawned there, which of them update and draw in what order, +// the partitions their collisions run through, and the counts of enemies and bosses the doors and the boss bar read. +// Persistent entities (players, familiars, the main knife) survive Reset. Its queries cache results by type until an +// entity of that type is added. +struct EntityList +{ + std::array partitions; + EntityList_EL effectEL; + EntityList_EL mainEL; + EntityList_EL persistentEL; + EntityList_EL renderEL; + EntityList_EL updateEL; + EntityList_EL wispEL; + std::map, EntityList_EL> typeCache; + std::vector collisionPairs; + KAGE::Graphics::ImagePtr shadowImage; + float bossMaxHealth = 0; + float enemyDamageInflicted = 0; + int bossCount = 0; + int collisionPairStride = 0; + int enemyCount = 0; + int pendingBossCount = 0; + int pendingEnemyCount = 0; + RenderMode renderMode = RENDER_NULL; + uint32_t renderCursor = 0; + bool isAnyBaited = false; + + EntityList(); + EntityList(const EntityList&) = delete; + EntityList& operator=(const EntityList&) = delete; + + void Reset(); + void AddEntity(Entity* entity); + void AddPersistentEntity(Entity* entity); + void Update(UpdateMode mode); + void rebuild_sublists(); + void sort_by_render_z(); + void render_up_to(uint32_t maxDepth, const Vector& offset); + void invalidate_type_cache(int type, int variant, int subType); + int CountEntities(Entity* spawner, int type, int variant, int subType); + static bool HitListContains(const std::vector& hitList, Entity& entity); + bool is_pair_new(Entity& first, Entity& second); + +private: + void entities_update(UpdateMode mode, UpdateTally& tally); + void players_update(UpdateMode mode); + void boss_bar_update(const UpdateTally& tally); + void removed_drop(); + void twins_push_apart(); +}; diff --git a/src/entity_npc.cpp b/src/entity_npc.cpp new file mode 100644 index 0000000..d57cb0d --- /dev/null +++ b/src/entity_npc.cpp @@ -0,0 +1,536 @@ +#include "entity_npc.h" +#include "game.h" +#include "room.h" +#include "log.h" + +constexpr int ENTITY_EXORCIST = 832; + +// 006c4ac0 Remembers where it was, and keeps the Exorcist's room in its state while it lives. +void Entity_NPC::PreUpdate() +{ + prevPosition = pos; + prevVelocity = velocity; + if (type == ENTITY_EXORCIST && variant == 0 && !isDead) g_game->room->isExorcistActive = true; +} + +// 006b8f00 Removes it, and the Dark Esau with it if it is the one that holds him. +void Entity_NPC::Remove() +{ + if (type == ENTITY_DARK_ESAU && variant == 0 && child) child->Remove(); + Entity::Remove(); +} + +// 006b8450 Whether it holds the doors shut: one that can, unless it became friendly. +bool Entity_NPC::CanShutDoors() +{ + return isCanShutDoors && !IsFriendly(); +} + +// 006b8470 +bool Entity_NPC::IsBoss() +{ + return isBoss; +} + +// 006a8240 Forgets where its pathfinder was taking it. +void Entity_NPC::ResetPathFinderTarget() +{ + pathfinder._movementTarget = {}; + pathfinder._moveDirection = {}; +} + +// 006d6610 Scales it, shrinking included. +void Entity_NPC::SetScale(float newScale) +{ + scale = newScale; + float spriteScale = newScale * shrinkStatus1; + sprite.scale = vector_make(spriteScale, spriteScale); +} + +// The rest of Entity_NPC is not reconstructed yet. + +// 006b8b20 +void Entity_NPC::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_NPC::Init 006b8b20"); +} + +// 006c4b30 +void Entity_NPC::Update() +{ + reconstruction_missing("Entity_NPC::Update 006c4b30"); +} + +// 006d2b50 +void Entity_NPC::Interpolate() +{ + reconstruction_missing("Entity_NPC::Interpolate 006d2b50"); +} + +// 006d2e50 +void Entity_NPC::Render(const Vector&) +{ + reconstruction_missing("Entity_NPC::Render 006d2e50"); +} + +// 006d4840 +bool Entity_NPC::RenderShadowLayer(const Vector&) +{ + reconstruction_missing("Entity_NPC::RenderShadowLayer 006d4840"); +} + +// 006d60a0 +bool Entity_NPC::TakeDamage(float, uint64_t, const EntityRef&, int) +{ + reconstruction_missing("Entity_NPC::TakeDamage 006d60a0"); +} + +// 006be6f0 +void Entity_NPC::Kill(const EntityRef&) +{ + reconstruction_missing("Entity_NPC::Kill 006be6f0"); +} + +// 006b8f30 +void Entity_NPC::ClearReferences() +{ + reconstruction_missing("Entity_NPC::ClearReferences 006b8f30"); +} + +// 006d9440 +bool Entity_NPC::TryThrow(const EntityRef&, const Vector&, float) +{ + reconstruction_missing("Entity_NPC::TryThrow 006d9440"); +} + +// 006d48a0 +Vector Entity_NPC::GetForwardVector() +{ + reconstruction_missing("Entity_NPC::GetForwardVector 006d48a0"); +} + +// 006cd410 +bool Entity_NPC::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_NPC::HandleCollision 006cd410"); +} + +// 006c1100 +void Entity_NPC::ResetColor() +{ + reconstruction_missing("Entity_NPC::ResetColor 006c1100"); +} + +// 006bb790 +void Entity_NPC::LoadEntityConfig() +{ + reconstruction_missing("Entity_NPC::LoadEntityConfig 006bb790"); +} + +// 00447770 +Entity_NPC* Entity_NPC::ParentNPC() +{ + reconstruction_missing("Entity_NPC::ParentNPC 00447770"); +} + +// 004567e0 +Entity_NPC* Entity_NPC::ChildNPC() +{ + reconstruction_missing("Entity_NPC::ChildNPC 004567e0"); +} + +// 004b92e0 +void Entity_NPC::Hornfel_UpdateAI() +{ + reconstruction_missing("Entity_NPC::Hornfel_UpdateAI 004b92e0"); +} + +// 004bb0e0 +void Entity_NPC::Hornfel_UpdateFrame() +{ + reconstruction_missing("Entity_NPC::Hornfel_UpdateFrame 004bb0e0"); +} + +// 004cde30 +void Entity_NPC::update_physics() +{ + reconstruction_missing("Entity_NPC::update_physics 004cde30"); +} + +// 004ce120 +void Entity_NPC::apply_velocity(char) +{ + reconstruction_missing("Entity_NPC::apply_velocity 004ce120"); +} + +// 004ce6d0 +void Entity_NPC::update_move_direction_anim() +{ + reconstruction_missing("Entity_NPC::update_move_direction_anim 004ce6d0"); +} + +// 004cf030 +void Entity_NPC::SetMinecartPosVel(const Vector&, const Vector&) +{ + reconstruction_missing("Entity_NPC::SetMinecartPosVel 004cf030"); +} + +// 004cf120 +void Entity_NPC::MinecartUpdateChild(Entity*) +{ + reconstruction_missing("Entity_NPC::MinecartUpdateChild 004cf120"); +} + +// 004e8fa0 +void Entity_NPC::UpdateCordChain(bool) +{ + reconstruction_missing("Entity_NPC::UpdateCordChain 004e8fa0"); +} + +// 004e9b10 +void Entity_NPC::render_overlay(const Vector&, bool) +{ + reconstruction_missing("Entity_NPC::render_overlay 004e9b10"); +} + +// 00548f30 +int Entity_NPC::FindTargetPit(const Vector&, const Vector&, uint32_t) +{ + reconstruction_missing("Entity_NPC::FindTargetPit 00548f30"); +} + +// 0055cef0 +Entity_NPC* Entity_NPC::ThrowStrider(const Vector&, Entity*, const Vector&) +{ + reconstruction_missing("Entity_NPC::ThrowStrider 0055cef0"); +} + +// 00565680 +void Entity_NPC::render_v1_layer_frames() +{ + reconstruction_missing("Entity_NPC::render_v1_layer_frames 00565680"); +} + +// 0059bed0 +void Entity_NPC::RenderSegmentLink(const Vector&, bool) +{ + reconstruction_missing("Entity_NPC::RenderSegmentLink 0059bed0"); +} + +// 0059e390 +void Entity_NPC::CreateBling() +{ + reconstruction_missing("Entity_NPC::CreateBling 0059e390"); +} + +// 0059e4c0 +void Entity_NPC::CreateGoldParticles(uint32_t) +{ + reconstruction_missing("Entity_NPC::CreateGoldParticles 0059e4c0"); +} + +// 0060d140 +void Entity_NPC::set_entity_ptr_f54(Entity*) +{ + reconstruction_missing("Entity_NPC::set_entity_ptr_f54 0060d140"); +} + +// 006b5e20 +void Entity_NPC::hold_set(int, const Vector&) +{ + reconstruction_missing("Entity_NPC::hold_set 006b5e20"); +} + +// 006b64d0 +Entity_Effect* Entity_NPC::MakeSplat(float) +{ + reconstruction_missing("Entity_NPC::MakeSplat 006b64d0"); +} + +// 006b6830 +Entity_Effect* Entity_NPC::MakeBloodCloud(const Vector&, const ColorMod&) +{ + reconstruction_missing("Entity_NPC::MakeBloodCloud 006b6830"); +} + +// 006b9910 +bool Entity_NPC::TryForceTarget(Entity*, int) +{ + reconstruction_missing("Entity_NPC::TryForceTarget 006b9910"); +} + +// 006b99e0 +float Entity_NPC::compute_speed_multiplier() +{ + reconstruction_missing("Entity_NPC::compute_speed_multiplier 006b99e0"); +} + +// 006baf40 +void Entity_NPC::load_graphics(uint8_t) +{ + reconstruction_missing("Entity_NPC::load_graphics 006baf40"); +} + +// 006be760 +void Entity_NPC::KillUnique() +{ + reconstruction_missing("Entity_NPC::KillUnique 006be760"); +} + +// 006be840 +Entity* Entity_NPC::GetPlayerTarget() +{ + reconstruction_missing("Entity_NPC::GetPlayerTarget 006be840"); +} + +// 006bec40 +Vector Entity_NPC::CalcTargetPosition(float) +{ + reconstruction_missing("Entity_NPC::CalcTargetPosition 006bec40"); +} + +// 006c04b0 +void Entity_NPC::UpdateDirtColor(uint8_t) +{ + reconstruction_missing("Entity_NPC::UpdateDirtColor 006c04b0"); +} + +// 006c07e0 +uint8_t Entity_NPC::Redirect(int*, int*) +{ + reconstruction_missing("Entity_NPC::Redirect 006c07e0"); +} + +// 006c0f30 +void Entity_NPC::Morph(int, int, int, int) +{ + reconstruction_missing("Entity_NPC::Morph 006c0f30"); +} + +// 006c1ac0 +void* Entity_NPC::shopkeeper_get_loot(void*, bool) +{ + reconstruction_missing("Entity_NPC::shopkeeper_get_loot 006c1ac0"); +} + +// 006c2750 +Entity_NPC* Entity_NPC::ThrowSpider(const Vector&, Entity*, Vector, bool, float) +{ + reconstruction_missing("Entity_NPC::ThrowSpider 006c2750"); +} + +// 006ca930 +void Entity_NPC::update_frozen() +{ + reconstruction_missing("Entity_NPC::update_frozen 006ca930"); +} + +// 006cb2a0 +void Entity_NPC::fire_projectile_from_params(Entity_Projectile*) +{ + reconstruction_missing("Entity_NPC::fire_projectile_from_params 006cb2a0"); +} + +// 006d0300 +void Entity_NPC::SetBossColorIdx(int, int) +{ + reconstruction_missing("Entity_NPC::SetBossColorIdx 006d0300"); +} + +// 006d03e0 +void Entity_NPC::MakeChampion(uint32_t, int, bool) +{ + reconstruction_missing("Entity_NPC::MakeChampion 006d03e0"); +} + +// 006d0c20 +void Entity_NPC::SetRef_bec(Entity*) +{ + reconstruction_missing("Entity_NPC::SetRef_bec 006d0c20"); +} + +// 006d0c60 +void* Entity_NPC::QueryNPCsType(void*, int, int) +{ + reconstruction_missing("Entity_NPC::QueryNPCsType 006d0c60"); +} + +// 006d0dd0 +EntityList* Entity_NPC::QueryNPCsGroup(EntityList*, int) +{ + reconstruction_missing("Entity_NPC::QueryNPCsGroup 006d0dd0"); +} + +// 006d1580 +void* Entity_NPC::fireplace_get_loot(void*, bool) +{ + reconstruction_missing("Entity_NPC::fireplace_get_loot 006d1580"); +} + +// 006d4a00 +bool Entity_NPC::CanBeDamagedFromVelocity(Vector) +{ + reconstruction_missing("Entity_NPC::CanBeDamagedFromVelocity 006d4a00"); +} + +// 006d4db0 +bool Entity_NPC::CanReroll() +{ + reconstruction_missing("Entity_NPC::CanReroll 006d4db0"); +} + +// 006d4e00 +void Entity_NPC::PlayDeathEffects() +{ + reconstruction_missing("Entity_NPC::PlayDeathEffects 006d4e00"); +} + +// 006d5400 +void Entity_NPC::trigger_kill_item_effects() +{ + reconstruction_missing("Entity_NPC::trigger_kill_item_effects 006d5400"); +} + +// 006d6ba0 +void Entity_NPC::PlaySound(int, float, int, uint8_t, float) +{ + reconstruction_missing("Entity_NPC::PlaySound 006d6ba0"); +} + +// 006d6c20 +int Entity_NPC::GetAliveEnemyCount() +{ + reconstruction_missing("Entity_NPC::GetAliveEnemyCount 006d6c20"); +} + +// 006d6d20 +uint32_t Entity_NPC::on_player_damaged() +{ + reconstruction_missing("Entity_NPC::on_player_damaged 006d6d20"); +} + +// 006d6d80 +void Entity_NPC::room_enter() +{ + reconstruction_missing("Entity_NPC::room_enter 006d6d80"); +} + +// 006d7010 +void Entity_NPC::spawn_damage_numbers() +{ + reconstruction_missing("Entity_NPC::spawn_damage_numbers 006d7010"); +} + +// 006d7230 +void Entity_NPC::update_damage_history() +{ + reconstruction_missing("Entity_NPC::update_damage_history 006d7230"); +} + +// 006d7520 +void Entity_NPC::update_blood_guide_gibs(float*) +{ + reconstruction_missing("Entity_NPC::update_blood_guide_gibs 006d7520"); +} + +// 006d81c0 +void Entity_NPC::ClearDequeRefs() +{ + reconstruction_missing("Entity_NPC::ClearDequeRefs 006d81c0"); +} + +// 006d8260 +bool Entity_NPC::IsControllerActionPressed(int) +{ + reconstruction_missing("Entity_NPC::IsControllerActionPressed 006d8260"); +} + +// 006d8290 +bool Entity_NPC::IsControllerActionTriggered(int) +{ + reconstruction_missing("Entity_NPC::IsControllerActionTriggered 006d8290"); +} + +// 006d82d0 +Vector Entity_NPC::GetControllerInput(float) +{ + reconstruction_missing("Entity_NPC::GetControllerInput 006d82d0"); +} + +// 006d85a0 +Vector Entity_NPC::GetControllerMovementInput(float) +{ + reconstruction_missing("Entity_NPC::GetControllerMovementInput 006d85a0"); +} + +// 006d88b0 +void Entity_NPC::TransferControl(Entity_NPC*) +{ + reconstruction_missing("Entity_NPC::TransferControl 006d88b0"); +} + +// 006d8b20 +void Entity_NPC::SpawnControlTarget(int, float) +{ + reconstruction_missing("Entity_NPC::SpawnControlTarget 006d8b20"); +} + +// 006d8cf0 +void Entity_NPC::ClearChild() +{ + reconstruction_missing("Entity_NPC::ClearChild 006d8cf0"); +} + +// 006d8d30 +Vector Entity_NPC::GetAimTargetPosition() +{ + reconstruction_missing("Entity_NPC::GetAimTargetPosition 006d8d30"); +} + +// 006d8d80 +bool Entity_NPC::is_controller_input_idle() +{ + reconstruction_missing("Entity_NPC::is_controller_input_idle 006d8d80"); +} + +// 006d8e40 +void Entity_NPC::UpdateChargeBar(float, float, float, bool) +{ + reconstruction_missing("Entity_NPC::UpdateChargeBar 006d8e40"); +} + +// 006d9050 +void Entity_NPC::UpdateControllerMovement(bool) +{ + reconstruction_missing("Entity_NPC::UpdateControllerMovement 006d9050"); +} + +// 006d90e0 +void Entity_NPC::UpdateChildEffectPosition(bool) +{ + reconstruction_missing("Entity_NPC::UpdateChildEffectPosition 006d90e0"); +} + +// 006d97e0 +uint8_t Entity_NPC::split(float, const EntityRef&, bool) +{ + reconstruction_missing("Entity_NPC::split 006d97e0"); +} + +// 006da530 +void Entity_NPC::UpdatePickupGhosts() +{ + reconstruction_missing("Entity_NPC::UpdatePickupGhosts 006da530"); +} + +// 0096ce90 +void Entity_NPC::SetAimAngle(float) +{ + reconstruction_missing("Entity_NPC::SetAimAngle 0096ce90"); +} + +// 009a8b90 +void Entity_NPC::render_debug(float*, int) +{ + reconstruction_missing("Entity_NPC::render_debug 009a8b90"); +} diff --git a/src/entity_npc.h b/src/entity_npc.h new file mode 100644 index 0000000..13ca14f --- /dev/null +++ b/src/entity_npc.h @@ -0,0 +1,180 @@ +#pragma once + +#include "entity.h" +#include "anm2.h" +#include +#include + +// Construction and destruction (006b88e0, 006b8590) are the defaults, but for the pathfinder's owner the constructor +// sets. PathFinder::Init's reset waits for PathFinder's takeover. +// Field accessors (004567a0, 006a8230, 006b8480, 007e92b0) are the public fields. +// An enemy or other non-player character (Lua's EntityNPC): its AI state and counters, pathfinder, champion and boss +// colors, shields, Delirium's forms, and the player controlling it with Siren or a friendly ball. +struct Entity_NPC : Entity +{ + ANM2 chargeBarSprite; + ANM2 statusEffectSprite; + NPCAI_Pathfinder pathfinder{}; + std::deque entityDeque; + std::deque vectorDeque1; + std::deque vectorDeque2; + std::vector killDamageEvents; + std::vector hitList; + std::vector secondaryHitList; + ColorMod dirtColor = COLOR_DEFAULT; + ColorMod floorColor = COLOR_DEFAULT; + EntityPtr entityRef; + EntityPtr forcedTarget; + Entity* collisionEntity = nullptr; + Entity* deliriumEntity = nullptr; + Entity_Effect* pickupGhostsEntity = nullptr; + Entity_Player* sirenPlayerEntity = nullptr; + void* aimTargetEffect = nullptr; + uint64_t killDamageFlags = 0; + Vector confusionTargetPos{}; + Vector controllerMovement{}; + Vector forwardVector{}; + Vector v1{}; + Vector v2{}; + float aiFloat = 0; + float championSpeed = 0; + float flickerAlpha = 0; + float hitPointsMulti = 0; + float killDamage = 0; + float scale = 0; + float scaleMulti = 0; + float shieldStrength = 0; + float totalDamageTaken = 0; + int aiCallPhase = 0; + int aiCounter = 0; + int appearFrames = 0; + int bosscoloridx = 0; + int championColorIdx = 0; + int championTimer = 0; + int collisionResult = 0; + int controllerID = 0; + int decoyTargetTimer = 0; + int flickerState = 0; + int flickerTimer = 0; + int forcedTargetTimer = 0; + int groupIdx = 0; + int i1 = 0; + int i2 = 0; + int lastGridIndex = 0; + int projectileCooldown = 0; + int projectileDelay = 0; + int savedState = 0; + int shieldFrames = 0; + int state = 0; + int stateFrame = 0; + uint32_t aiCallFlags = 0; + uint32_t deliriumAttackID = 0; + uint32_t deliriumBossType = 0; + uint32_t deliriumBossVariant = 0; + uint32_t deliriumCycleID = 0; + uint32_t deliriumCycleIDHigh = 0; + short championRegenCount = 0; + uint16_t championRegenTimer = 0; + uint16_t deliriumTransformationTimer = 0; + uint8_t deliriumAttackAngle = 0; + uint8_t deliriumRemainingAttacks = 0; + uint8_t deliriumState = 0; + bool isBestiaryEncountered = false; + bool isBoss = false; + bool isCanShutDoors = false; + bool isChampion = false; + bool isCollisionIsLow = false; + bool isUnreachableOnce = false; + + Entity_NPC() { pathfinder._entity = this; } + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void PreUpdate() override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + bool RenderShadowLayer(const Vector& offset) override; + bool TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown) override; + void Kill(const EntityRef& source) override; + void Remove() override; + void ClearReferences() override; + bool CanShutDoors() override; + bool IsBoss() override; + bool TryThrow(const EntityRef& source, const Vector& direction, float force) override; + Vector GetForwardVector() override; + bool HandleCollision(Entity* collider, bool isLow) override; + void ResetColor() override; + void LoadEntityConfig() override; + + Entity_NPC* ParentNPC(); + Entity_NPC* ChildNPC(); + void Hornfel_UpdateAI(); + void Hornfel_UpdateFrame(); + void update_physics(); + void apply_velocity(char); + void update_move_direction_anim(); + void SetMinecartPosVel(const Vector& pos, const Vector& vel); + void MinecartUpdateChild(Entity* child); + void UpdateCordChain(bool isHalfScale); + void render_overlay(const Vector& offset, bool isShadow); + static int FindTargetPit(const Vector& pos1, const Vector& pos2, uint32_t pitIndex); + static Entity_NPC* ThrowStrider(const Vector& pos, Entity* spawner, const Vector& targetPos); + void render_v1_layer_frames(); + void RenderSegmentLink(const Vector& offset, bool isShadow); + void CreateBling(); + void CreateGoldParticles(uint32_t count); + void set_entity_ptr_f54(Entity* entity); + void ResetPathFinderTarget(); + void hold_set(int countdown, const Vector& position); + Entity_Effect* MakeSplat(float size); + Entity_Effect* MakeBloodCloud(const Vector& pos, const ColorMod& color); + bool TryForceTarget(Entity* target, int duration); + float compute_speed_multiplier(); + void load_graphics(uint8_t); + void KillUnique(); + Entity* GetPlayerTarget(); + Vector CalcTargetPosition(float distanceLimit); + void UpdateDirtColor(uint8_t immediate); + static uint8_t Redirect(int* entityType, int* variant); + void Morph(int entityType, int variant, int subType, int championid); + void* shopkeeper_get_loot(void* outLoot, bool isShouldAdvance); + static Entity_NPC* ThrowSpider(const Vector& position, Entity* spawner, Vector targetPos, bool isBig, + float yOffset); + void update_frozen(); + void fire_projectile_from_params(Entity_Projectile* projectile); + void SetBossColorIdx(int bossColorIdx, int unused); + void MakeChampion(uint32_t seed, int championColor, bool isInit); + void SetRef_bec(Entity* entity); + static void* QueryNPCsType(void* outList, int type, int variant); + static EntityList* QueryNPCsGroup(EntityList* outList, int groupIdx); + void* fireplace_get_loot(void* outLoot, bool isShouldAdvance); + bool CanBeDamagedFromVelocity(Vector velocity); + bool CanReroll(); + void PlayDeathEffects(); + void trigger_kill_item_effects(); + void SetScale(float newScale); + void PlaySound(int id, float volume, int framedelay, uint8_t loop, float pitch); + int GetAliveEnemyCount(); + uint32_t on_player_damaged(); + void room_enter(); + void spawn_damage_numbers(); + void update_damage_history(); + void update_blood_guide_gibs(float* nullFrame); + void ClearDequeRefs(); + bool IsControllerActionPressed(int action); + bool IsControllerActionTriggered(int buttonAction); + Vector GetControllerInput(float deadzone); + Vector GetControllerMovementInput(float deadzone); + void TransferControl(Entity_NPC* target); + void SpawnControlTarget(int inputMode, float rotation); + void ClearChild(); + Vector GetAimTargetPosition(); + bool is_controller_input_idle(); + void UpdateChargeBar(float start, float end, float value, bool isHideWhenFull); + void UpdateControllerMovement(bool isForceUpdate); + void UpdateChildEffectPosition(bool isPredictMovement); + uint8_t split(float damage, const EntityRef& source, bool isPlaySound); + void UpdatePickupGhosts(); + void SetAimAngle(float angle); + static void render_debug(float*, int); +}; diff --git a/src/entity_pickup.cpp b/src/entity_pickup.cpp new file mode 100644 index 0000000..f6b248b --- /dev/null +++ b/src/entity_pickup.cpp @@ -0,0 +1,239 @@ +#include "entity_pickup.h" +#include "entity_effect.h" +#include "log.h" +#include +#include + +// The chest variants (chest, locked, red, bomb, eternal, spiked, mimic, mom's, old, wooden, mega, haunted). +constexpr std::array CHESTS = {50, 60, 360, 51, 53, 52, 54, 390, 55, 56, 57, 58}; + +// 006ee110 Removes it with the ghost that shows its contents. +void Entity_Pickup::Remove() +{ + if (pickupGhost) pickupGhost->Remove(); + Entity::Remove(); +} + +// 005b1930 Whether a shop sells it. +bool Entity_Pickup::IsShopItem() +{ + return price != 0; +} + +// 006ee340 Whether the pickup variant is a chest. +bool Entity_Pickup::IsChest(int pickupVariant) +{ + return std::find(CHESTS.begin(), CHESTS.end(), pickupVariant) != CHESTS.end(); +} + +// The rest of Entity_Pickup is not reconstructed yet. + +// 006e02f0 +void Entity_Pickup::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Pickup::Init 006e02f0"); +} + +// 006e3940 +void Entity_Pickup::Update() +{ + reconstruction_missing("Entity_Pickup::Update 006e3940"); +} + +// 006e38d0 +void Entity_Pickup::Interpolate() +{ + reconstruction_missing("Entity_Pickup::Interpolate 006e38d0"); +} + +// 006e69b0 +void Entity_Pickup::Render(const Vector&) +{ + reconstruction_missing("Entity_Pickup::Render 006e69b0"); +} + +// 006edda0 +bool Entity_Pickup::TakeDamage(float, uint64_t, const EntityRef&, int) +{ + reconstruction_missing("Entity_Pickup::TakeDamage 006edda0"); +} + +// 006ee130 +void Entity_Pickup::ClearReferences() +{ + reconstruction_missing("Entity_Pickup::ClearReferences 006ee130"); +} + +// 006e3800 +bool Entity_Pickup::TryThrow(const EntityRef&, const Vector&, float) +{ + reconstruction_missing("Entity_Pickup::TryThrow 006e3800"); +} + +// 006e8ae0 +bool Entity_Pickup::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0"); +} + +// 005832c0 +void Entity_Pickup::GetLootList(const Vector&) +{ + reconstruction_missing("Entity_Pickup::GetLootList 005832c0"); +} + +// 005b19b0 +Vector Entity_Pickup::GetRandomPickupVelocity(const Vector&, RNG*, uint32_t) +{ + reconstruction_missing("Entity_Pickup::GetRandomPickupVelocity 005b19b0"); +} + +// 006e1640 +bool Entity_Pickup::TryFlip(Entity_Player*, uint32_t) +{ + reconstruction_missing("Entity_Pickup::TryFlip 006e1640"); +} + +// 006e17c0 +void Entity_Pickup::UpdateLootPreview() +{ + reconstruction_missing("Entity_Pickup::UpdateLootPreview 006e17c0"); +} + +// 006e1a80 +void Entity_Pickup::SetAlternatePedestal(int) +{ + reconstruction_missing("Entity_Pickup::SetAlternatePedestal 006e1a80"); +} + +// 006e1d70 +int Entity_Pickup::GetAlternatePedestal() +{ + reconstruction_missing("Entity_Pickup::GetAlternatePedestal 006e1d70"); +} + +// 006e1e60 +void Entity_Pickup::SetForceBlind(uint8_t) +{ + reconstruction_missing("Entity_Pickup::SetForceBlind 006e1e60"); +} + +// 006e21f0 +void Entity_Pickup::UpdateSprite(bool) +{ + reconstruction_missing("Entity_Pickup::UpdateSprite 006e21f0"); +} + +// 006e2570 +void Entity_Pickup::update_price_sprite(int) +{ + reconstruction_missing("Entity_Pickup::update_price_sprite 006e2570"); +} + +// 006e3020 +void Entity_Pickup::AppearFast() +{ + reconstruction_missing("Entity_Pickup::AppearFast 006e3020"); +} + +// 006e6e40 +bool Entity_Pickup::TryOpenChest(Entity_Player*) +{ + reconstruction_missing("Entity_Pickup::TryOpenChest 006e6e40"); +} + +// 006e7be0 +void Entity_Pickup::PlayDropSound() +{ + reconstruction_missing("Entity_Pickup::PlayDropSound 006e7be0"); +} + +// 006e7dc0 +void Entity_Pickup::PlayPickupSound() +{ + reconstruction_missing("Entity_Pickup::PlayPickupSound 006e7dc0"); +} + +// 006e8380 +int Entity_Pickup::GetCoinValue() +{ + reconstruction_missing("Entity_Pickup::GetCoinValue 006e8380"); +} + +// 006e83a0 +uint32_t Entity_Pickup::can_player_buy(Entity_Player*) +{ + reconstruction_missing("Entity_Pickup::can_player_buy 006e83a0"); +} + +// 006e84d0 +void Entity_Pickup::CollectTrinket(Entity_Player*, uint32_t) +{ + reconstruction_missing("Entity_Pickup::CollectTrinket 006e84d0"); +} + +// 006ed580 +uint8_t Entity_Pickup::empty_pedestal() +{ + reconstruction_missing("Entity_Pickup::empty_pedestal 006ed580"); +} + +// 006ed690 +void Entity_Pickup::update_magnet_attraction() +{ + reconstruction_missing("Entity_Pickup::update_magnet_attraction 006ed690"); +} + +// 006edfa0 +void Entity_Pickup::update_cycle_collectible(bool) +{ + reconstruction_missing("Entity_Pickup::update_cycle_collectible 006edfa0"); +} + +// 006ee200 +bool Entity_Pickup::CanReroll() +{ + reconstruction_missing("Entity_Pickup::CanReroll 006ee200"); +} + +// 006ee240 +bool Entity_Pickup::CanRerollVariant(int, int) +{ + reconstruction_missing("Entity_Pickup::CanRerollVariant 006ee240"); +} + +// 006ee390 +bool Entity_Pickup::CanBePickedUp(bool) +{ + reconstruction_missing("Entity_Pickup::CanBePickedUp 006ee390"); +} + +// 006ee3f0 +bool Entity_Pickup::CanJeraDuplicate() +{ + reconstruction_missing("Entity_Pickup::CanJeraDuplicate 006ee3f0"); +} + +// 006ee750 +void Entity_Pickup::RemoveOtherOptions() +{ + reconstruction_missing("Entity_Pickup::RemoveOtherOptions 006ee750"); +} + +// 006eea30 +void Entity_Pickup::MakeShopItem(int) +{ + reconstruction_missing("Entity_Pickup::MakeShopItem 006eea30"); +} + +// 006eed30 +int Entity_Pickup::AssignOptionsIndex() +{ + reconstruction_missing("Entity_Pickup::AssignOptionsIndex 006eed30"); +} + +// 007ef420 +void Entity_Pickup::RestoreState(Room*, Entity_Pickup*, void*) +{ + reconstruction_missing("Entity_Pickup::RestoreState 007ef420"); +} diff --git a/src/entity_pickup.h b/src/entity_pickup.h new file mode 100644 index 0000000..03a085e --- /dev/null +++ b/src/entity_pickup.h @@ -0,0 +1,86 @@ +#pragma once + +#include "entity.h" +#include "anm2.h" +#include +#include + +// The most items a glitched pedestal cycles through. +constexpr int CYCLE_COLLECTIBLE_LIMIT = 8; + +// Construction and destruction (006e0130, 006e0010) are the defaults. +// Field accessors (00431740, 005b1940, 005b1980, 007e9390, 007e93a0, 007e93b0, 007e93c0, 0085e440) are the public +// fields. +// A pickup (Lua's EntityPickup): coins, hearts, keys, chests, cards, items on pedestals and the like, with the price +// a shop sets, its timeout, and the items a glitched pedestal cycles through. +struct Entity_Pickup : Entity +{ + ANM2 altPedestalANM2; + ANM2 priceANM2; + std::array megaChestCollectible{}; + std::array cycleCollectibleList{}; + std::shared_ptr flipSaveState; + ColorMod colorMod = COLOR_DEFAULT; + EntityPtr unkEntityRef; + Entity_Effect* pickupGhost = nullptr; + int charge = 0; + int chestReCloseTimer = 0; + int collisionCooldown = 0; + int coopDuplicateIndex = 0; + int dropDelay = 0; + int gridRepositionState = 0; + int invisibleFrames = 0; + int itemPoolType = 0; + int optionsPickupIndex = 0; + int price = 0; + int shopItemId = 0; + int timeout = 0; + int varData = 0; + int wait = 0; + uint32_t cycleCollectibleCount = 0; + uint32_t state = 0; + bool isAutoUpdatePrice = false; + bool isForceBlind = false; + bool isPayToPlay = false; + bool isTouched = false; + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + bool TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown) override; + void Remove() override; + void ClearReferences() override; + bool TryThrow(const EntityRef& source, const Vector& direction, float force) override; + bool HandleCollision(Entity* collider, bool isLow) override; + + void GetLootList(const Vector& renderOffset); + bool IsShopItem(); + static Vector GetRandomPickupVelocity(const Vector& position, RNG* rng, uint32_t ePickupVelType); + bool TryFlip(Entity_Player* unusedPlayer, uint32_t unusedSeed); + void UpdateLootPreview(); + void SetAlternatePedestal(int pedestalType); + int GetAlternatePedestal(); + void SetForceBlind(uint8_t setBlind); + void UpdateSprite(bool isIgnoreBlind); + void update_price_sprite(int price); + void AppearFast(); + bool TryOpenChest(Entity_Player* player); + void PlayDropSound(); + void PlayPickupSound(); + int GetCoinValue(); + uint32_t can_player_buy(Entity_Player*); + void CollectTrinket(Entity_Player*, uint32_t); + uint8_t empty_pedestal(); + void update_magnet_attraction(); + void update_cycle_collectible(bool isForce); + bool CanReroll(); + static bool CanRerollVariant(int variant, int subType); + static bool IsChest(int pickupVariant); + bool CanBePickedUp(bool ignorePrice); + bool CanJeraDuplicate(); + static void RemoveOtherOptions(); + void MakeShopItem(int shopId); + int AssignOptionsIndex(); + static void RestoreState(Room* room, Entity_Pickup* entity, void* saveState); +}; diff --git a/src/entity_player.cpp b/src/entity_player.cpp new file mode 100644 index 0000000..d7dcec2 --- /dev/null +++ b/src/entity_player.cpp @@ -0,0 +1,1463 @@ +#include "entity_player.h" +#include "data.h" +#include "entity_familiar.h" +#include "entity_npc.h" +#include "game.h" +#include "log.h" +#include "lua_engine.h" +#include "manager.h" +#include "platform.h" +#include "room.h" +#include +#include + +constexpr float PLAYER_START_TEAR_HEIGHT = -23.75f; +constexpr float PLAYER_START_TEAR_FALLING_SPEED = 0.2f; +constexpr float PLAYER_START_TEAR_RANGE = 260; +constexpr float ROCK_BOTTOM_LUCK_UNSET = -9999; +constexpr int COSTUME_RESERVE = 32; +constexpr int FORGOTTEN_BODY_ROOM_NONE = -99999; +constexpr int MAX_PEE_BURST_COOLDOWN = 30; +constexpr int MONKEY_PAW_USES = 3; +constexpr int PLAYER_RENDER_Z_OFFSET = 5; +constexpr int TONSIL_COUNTER_MIN = 6; +constexpr int TONSIL_COUNTER_RANGE = 7; +constexpr int EDEN_COIN_RANGE = 5; +constexpr int TAINTED_EDEN_PLAYER_ID = 30; +constexpr int ITEMS_COST_MONEY_COINS = 69; +constexpr float START_SPOT_X = 320; +constexpr float START_SPOT_Y = 380; +constexpr float GREED_START_SPOT_Y = 280; +constexpr float BACKASSWARDS_START_OFFSET_Y = 100; +constexpr int BETHANY_START_CHARGE = 4; +constexpr int MAGDALENE_B_START_RED_HEARTS = 4; +constexpr int PLAYERFORM_BOOK_WORM = 10; +constexpr int PLAYERFORM_NECROMANCER = 15; +constexpr float EDEN_SPEED_SPREAD = 0.3f; +constexpr float EDEN_FIRE_DELAY_SPREAD = 1.5f; +constexpr float EDEN_RANGE_SPREAD = 120; +constexpr float EDEN_SHOT_SPEED_SPREAD = 0.5f; +constexpr int DEATHMATCH_HEART_SCALE = 8; +constexpr uint32_t GRAPHICS_PREMULTIPLIED_ALPHA = 4; + +// The shift triples Init seeds the player's generators with: one stepping the init seed, one for each list of +// generators, and the one every item generator keeps. +constexpr uint32_t INIT_RNG_SHIFT = 5; +constexpr uint32_t COLLECTIBLE_RNG_SHIFT = 6; +constexpr uint32_t TRINKET_RNG_SHIFT = 7; +constexpr uint32_t PILL_RNG_SHIFT = 8; +constexpr uint32_t CARD_RNG_SHIFT = 9; +constexpr uint32_t ITEM_RNG_SHIFT = 35; +constexpr uint32_t PRE_LEVEL_RNG_SHIFT = 2; +constexpr uint32_t FLOOR_RNG_SHIFT = 12; +constexpr uint32_t JACOBS_CURSE_RNG_SHIFT = 66; +constexpr int JACOBS_CURSE_STEPS = 20; +constexpr int JACOBS_CURSE_STEP_FRAMES = 30; +constexpr int JACOBS_CURSE_MIN_FRAMES = 610; + +constexpr int ASCENT_HOME_STAGE = 6; +constexpr int CAINS_EYE_CHANCE = 25; +constexpr int CANTRIPPED_CARDS = 3; +constexpr int CARD_SPECIAL_CHANCE = 25; +constexpr int CARD_START_RUNE_CHANCE = 10; +constexpr int COLOR_PRIORITY_TOP = 255; +constexpr int DAILY_CHRISTMAS = 19; +constexpr int EFFECT_BLOOD_SPLAT = 7; +constexpr int EMPTY_HEART_RED_HEARTS = 3; +constexpr int EVENT_BONUS_ITEMS = 114; +constexpr int FAMILIAR_ABYSS_LOCUST = 231; +constexpr int FAMILIAR_LIL_PORTAL = 232; +constexpr int GIANTBOOK_EMPTY_HEART = 41; +constexpr int GIANTBOOK_ETERNAL = 6; +constexpr int GIANTBOOK_ETERNAL_BLACK = 46; +constexpr uint32_t LEVEL_STATE_SOL = 1 << 18; +constexpr int LOCUST_SUBTYPE_START = 25; +constexpr int PEE_ALPHA = 180; +constexpr int PEE_OFFSET = 244; +constexpr int PICKUP_GRAB_BAG = 69; +constexpr int PICKUP_HEART = 10; +constexpr float PICKUP_SPAWN_RADIUS = 40; +constexpr int POCKET_ACTIVE_SLOT = 2; +constexpr float RANDOM_FLOAT_SCALE = 2.3283064e-10f; +constexpr int RED_REDEMPTION_KEY_CHARGES = 20; +constexpr uint32_t STAGE_BLUE_WOMB = 11; +constexpr uint8_t WOODEN_CROSS_STACK = 0x10; +constexpr std::string_view COSTUMES_DIR = "costumes"; +constexpr std::array SKIN_COLOR_SUFFIXES = {"_white", "_black", "_blue", + "_red", "_green", "_grey"}; + +constexpr const char* CHARGE_BAR_PATHS[CHARGE_BAR_COUNT] = { + "gfx/chargebar.anm2", "gfx/chargebar.anm2", + "gfx/chargebar_maw.anm2", "gfx/chargebar_revelation.anm2", + "gfx/chargebar_poop.anm2", "gfx/chargebar_berserk.anm2", + "gfx/chargebar_sumptorium.anm2"}; + +// Whether a resource file exists, after the mods redirected it. +static bool is_file_found(const std::string& path) +{ + std::error_code error; + return std::filesystem::exists(resource_path(path), error); +} + +// A color from bytes as ColorParams::set_from_bytes builds it: a tint and an offset over 255, no colorize. +static ColorMod color_from_bytes(int tintRed, int tintGreen, int tintBlue, int tintAlpha, int offsetRed, + int offsetGreen, int offsetBlue) +{ + constexpr float BYTE = 1.0f / 255; + return {{tintRed * BYTE, tintGreen * BYTE, tintBlue * BYTE, tintAlpha * BYTE}, + {0, 0, 0, 0}, + {offsetRed * BYTE, offsetGreen * BYTE, offsetBlue * BYTE}}; +} + +// A random card as the run hands one out: drawn from a seed, then offered to the mods' card callback. +static int card_roll(uint32_t seed, int runeChance, bool isPlaying) +{ + int card = ItemPool::GetCardEx((int)seed, CARD_SPECIAL_CHANCE, runeChance, runeChance, true); + RNG rng = rng_make(seed, ITEM_RNG_SHIFT); + return lua_callback_run_get_card(&rng, card, isPlaying, isPlaying, false); +} + +// Room methods the room's takeover has not declared yet. +static Vector room_free_pickup_position(Vector, float) +{ + reconstruction_missing("Room::FindFreePickupSpawnPosition 00813520"); +} + +static Vector room_random_pickup_position() +{ + reconstruction_missing("Room::get_random_pickup_position 00813460"); +} + +// A generator with a seed and the shift triple at an index of RNG's table. +RNG rng_make(uint32_t seed, uint32_t shiftIndex) +{ + RNG rng{}; + + rng.SetSeed(seed, shiftIndex); + return rng; +} + +// Whether an unlock counts for this run: earned, or given to every daily and debug run. +bool is_run_unlocked(int achievement) +{ + Game* game = g_game; + + if (g_manager->persistentGameData.achievements[achievement]) return true; + return g_manager->state == MANAGER_STATE_GAME && game && (game->dailyChallenge._id != 0 || game->isDebug); +} + +// Fills a list of item generators, one per id, each seeded by the next step of a generator of its own. +static void item_rngs_fill(std::vector& rngs, size_t count, uint32_t seed, uint32_t shiftIndex) +{ + RNG stepper = rng_make(seed, shiftIndex); + + for (size_t i = 0; i < count; i++) rngs.push_back(rng_make(stepper.Next(), ITEM_RNG_SHIFT)); +} + +// 00753da0 Makes an empty player, its members at their defaults. +Entity_Player::Entity_Player() +{ + temporaryEffects.player = this; + history.player = this; + inventory.fill(-1); + pocketItems.fill({0, POCKET_CARD}); + curseMistPocketItems.fill({0, POCKET_CARD}); + ghostPocketItems.fill({0, POCKET_CARD}); +} + +// 00754ed0, 00754d60 Unlinks the twin and frees a sub player the room does not hold, then forgets being a transition's. +Entity_Player::~Entity_Player() +{ + if (Entity* twin = twinPlayer) + { + twin->ClearReferences(); + twinPlayer = nullptr; + } + if (subPlayer && !subPlayer->isValid) + { + subPlayer->ClearReferences(); + delete subPlayer; + } + if (!g_game) return; + + PlayerManager& players = g_game->playerManager; + if (players.stageTransitionPlayer == this) players.stageTransitionPlayer = nullptr; + if (players.roomTransitionPlayer == this) players.roomTransitionPlayer = nullptr; +} + +// 00755470 Starts a player of a variant: a character (subtype is the player type), a co-op baby (subtype is the skin) +// or an extra player. Seeds one generator per collectible, trinket, pill effect and card, resets every stat and +// counter, loads the sprites, picks the controller, puts on the skin, and gives a character its starting health and +// pickups. The original makes the tears weapon through Isaac::CreateWeapon, which is not taken over: the slot stays +// empty. +void Entity_Player::Init(int entityType, int entityVariant, int subType, uint32_t seed) +{ + Manager& manager = *g_manager; + ItemConfig& items = manager.itemConfig; + + if (seed == 0) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"RNG Seed is zero!\n"); + RNG initRng = rng_make(seed, INIT_RNG_SHIFT); + item_rngs_fill(collectibleRNGs, items.collectibles.size(), initRng.Next(), COLLECTIBLE_RNG_SHIFT); + item_rngs_fill(trinketRNGs, items.trinkets.size(), initRng.Next(), TRINKET_RNG_SHIFT); + item_rngs_fill(pillRNGs, items.pillEffects.size(), initRng.Next(), PILL_RNG_SHIFT); + item_rngs_fill(cardRNGs, items.cards.size(), initRng.Next(), CARD_RNG_SHIFT); + if (!history.isLocked) + { + history.historyItems.clear(); + inventory.fill(-1); + } + + int entitySubType = subType; + if (entityVariant == PLAYER_VARIANT_COOP_BABY) + { + playerType = PLAYER_ISAAC; + isGlitchBaby = subType == BABY_GLITCH; + if (isGlitchBaby) entitySubType = (int)GetGlitchBabySubType(); + babySkin = std::min(entitySubType, (int)BABY_BASIC); + } + else + { + babySkin = -1; + if ((size_t)subType >= manager.entityConfig.players.size()) + log_printf(LOG_ASSERT, "Got non existing player type %d in Player::Init!", subType); + playerType = subType; + } + name.clear(); + + uint32_t entitySeed = initRng.Next(); + Entity::Init(entityType, entityVariant, entitySubType, entitySeed); + renderZOffset = PLAYER_RENDER_Z_OFFSET; + log_printf(LOG_INFO, "[Frame: %d] Initialized player with Variant %d and Subtype %d\n", manager.framecount, + entityVariant, entitySubType); + temporaryEffects.ClearEffects(true); + stats_reset(); + + tonsilCounter = (short)(trinketRNGs[TRINKET_TONSIL].Next() % TONSIL_COUNTER_RANGE + TONSIL_COUNTER_MIN); + tonsilCount = 0; + numLeprosy = 0; + UpdateCanShoot(); + lastVelocity = velocity; + isPostLevelInitFinished = variant == PLAYER_VARIANT_COOP_BABY; + collectibleCounts.assign(items.collectibles.size(), 0); + playerForms.fill(0); + playerFormsRewarded = 0; + trinkets.fill(0); + smeltedTrinkets.assign(items.trinkets.size(), {}); + pillEffectUses.assign(items.pillEffects.size(), 0); + colorOverride = COLOR_DEFAULT; + pocketItems.fill({0, POCKET_CARD}); + queuedItem.charge = 0; + queuedItem.item = nullptr; + isHeldItemVisible = false; + tear_stats_reset(); + sprites_load(); + + delayedSfxId = 0; + delayedSfxDelay = 0; + bool isOwnController = variant == PLAYER_VARIANT_PLAYER && subType != PLAYER_ESAU && subType != PLAYER_THESOUL_B; + SetControllerIndex(isOwnController ? manager.activeControllerIndex : -1, false); + + if (!config) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"Player Config invalid!\n"); + else sprite.Load(config->anm2Path, GRAPHICS_DEFER); + if (variant == PLAYER_VARIANT_PLAYER) + { + sprite.SetFrame("WalkDown", 0); + sprite.SetOverlayFrame("HeadDown", 0); + } + isControlsEnabled = true; + controlsCooldown = 0; + fireBlockCooldown = 0; + costumeSpriteDescs.reserve(COSTUME_RESERVE); + ClearCostumes(); + playerSpriteScale = vector_make(1, 1); + bodyScale = vector_make(1, 1); + headScale = vector_make(1, 1); + if (variant == PLAYER_VARIANT_PLAYER) update_player_skin(); + else if (variant == PLAYER_VARIANT_COOP_BABY) + { + int skin = babySkin; + if (isGlitchBaby) babySkin = BABY_GLITCH; + InitBabySkin(); + babySkin = skin; + } + + cacheFlags = CACHE_ALL; + footprintColor1 = {}; + footprintColor2 = {}; + pitfallState = 0; + pitfallTimer = 0; + babyFamiliar = nullptr; + if (variant == PLAYER_VARIANT_COOP_BABY) + { + if (babySkin == BABY_BLOAT || babySkin == BABY_YBAB || babySkin == BABY_APOLLYON) + reconstruction_missing("Entity_Player::Init 00755470 (the co-op babies that come with a familiar)"); + hasBabyRoomShield = true; + } + links_reset(); + + if (variant == PLAYER_VARIANT_PLAYER) InitPreLevelInitStats(); + shadowImage = Manager::LoadImage("gfx/shadow.png"); + emotes.Load(); + if (Entity* tether = tetheredEffect) + { + tether->Remove(); + tetheredEffect = nullptr; + } + if (playerType == PLAYER_BETHANY && g_game->challenge != CHALLENGE_BLOODY_MARY && + g_game->challenge != CHALLENGE_BAPTISM_BY_FIRE) + { + EvaluateItems(); + AddActiveCharge(BETHANY_START_CHARGE, 0, false, false, false); + } + static_cast(g_luaEngine)->PostPlayerInit(this); +} + +// Resets the counters and stats Init starts every player with. +void Entity_Player::stats_reset() +{ + subPlayer = nullptr; + isCoopGhost = false; + hasGoldenKey = false; + hasGoldenBomb = false; + goldenHearts = 0; + health = 1; + maxHitPoints = 1; + boneHeartsMask = 0; + boneHearts = 0; + eternalHearts = 0; + blackHearts = 0; + numKeys = 0; + numCoins = 0; + numBombs = 0; + soulHearts = 0; + maxHearts = 0; + redHearts = 0; + edenLuck = 0; + edenShotSpeed = 0; + edenTearRange = 0; + edenFireDelay = 0; + edenSpeed = 0; + edenDamage = 0; + jarHearts = 0; + jarFlies = 0; + gnawedLeafTimer = 0; + lastActionTriggers = 0; + bloodLustCounter = 0; + deadCatLives = 0; + damageCooldown = 0; + weapons.fill(nullptr); + markedTarget = nullptr; + heldEntity = nullptr; + tractorBeam = 0; + megaBlastLaser = nullptr; + breathOfLifeEffect = nullptr; + itemState = 0; + numBlueFlies = 0; + numBlueSpiders = 0; + itemHoldCooldown = 0; + purityState = 0; + immaculateConceptionState = 0; + cambionConceptionState = 0; + conceptionFamiliarFlags = 0; + speedModifier = 0; + fireDelayModifier = 0; + damageModifier = 0; + tearRangeModifier = 0; + shotSpeedModifier = 0; + luckModifier = 0; + donateLuck = 0; + coopBabyBuffTimers.fill(0); + imExcitedSpeedupCountdown = 0; + potatoPeelerCounter = 0; + potatoPeelerBandageCounter = 0; + greedsGulletHearts = 0; + greedsGulletOverflow = 0; + greedsGulletRedHearts = 0; + isUpdatingGreedsGullet = false; + megaBlastDuration = 0; + recentMovementVector = {}; + slipperyTimer = 0; + deadEyeCharges = 0; + deadEyeMisses = 0; + epiphoraCharge = 0; + peeBurstCooldown = 0; + maxPeeBurstCooldown = MAX_PEE_BURST_COOLDOWN; + bladderCharge = 0; + maxBladderCharge = 0; + isUrethraBlocked = false; + nextUrethraBlockFrame = 0; + mawOfTheVoidChargeTimer = 0; + taurusSpeedBonus = 0; + monkeyPawCounter = MONKEY_PAW_USES; + rUaWizardTimer = 0; + holyMantleState = 0; + isBrokenRemotePending = false; + cursedPennyPending = 0; + vampireCharmKills = 0; + isPlayingExtraAnimation = false; + isHurtPending = false; + isPlayingItemAnimation = false; + strengthMaxHearts = 0; + friendBallEnemy.type = 0; + d8DamageModifier = 1; + d8FireDelayModifier = 1; + d8RangeModifier = 1; + d8SpeedModifier = 1; + ponyCharge = 0; + flashCountdown = 0; + planCKillCountdown = 0; + metronomeCollectibleId = 0; + brittleBonesUpgrades = 0; + bleedOutHealth = 0; + holyMantleStacks = 0; + ductTapeMode = 0; + threeDollarBillItem = 0; +} + +// Resets the tear stats, the active items and where the player moves, looks and shoots. +void Entity_Player::tear_stats_reset() +{ + maxFireDelay = 10; + shotSpeed = 1; + damage = 3.5f; + tearHeight = PLAYER_START_TEAR_HEIGHT; + tearFallingSpeed = PLAYER_START_TEAR_FALLING_SPEED; + tearFallingAcceleration = 0; + tearFlags.reset(); + luck = 0; + moveSpeed = 1; + cacheFlags = 0; + canFly = false; + firedTearCount = 0; + meleeDamage = 3.5f; + tearRange = PLAYER_START_TEAR_RANGE; + itemStateCooldown = 0; + activeItems.fill({}); + tearDisplacement = 1; + bombPlaceDelay = 0; + forgottenSwapFormCooldown = 0; + headAnim = "HeadDown"; + blinkTime = 0; + headDirectionTime = 0; + moveDirection = DIRECTION_NONE; + headDirection = DIRECTION_DOWN; + fireDirection = DIRECTION_NONE; + aimDirection = {}; + areOpposingShootDirectionsPressed = false; + lastDirection = {}; + movementVector = {}; + bodyAngle = 0; + tearsOffset = {}; + lastDamageFlags = 0; + roomDamageTaken = 0; + totalDamageTaken = 0; +} + +// Loads the blood gush, crown and charge bar sprites a player has not loaded yet, the crowns drawn additively. +void Entity_Player::sprites_load() +{ + if (!bloodGushSprite.isLoaded) + { + bloodGushSprite.Load("gfx/characters/blood gush.anm2", GRAPHICS_LOAD); + bloodGushSprite.Play("Idle"); + } + + int sourceFactor = + g_graphicsManager_flags & GRAPHICS_PREMULTIPLIED_ALPHA ? BLEND_FACTOR_ONE : BLEND_FACTOR_SRC_ALPHA; + for (auto [crown, path] : {std::pair{&crownOfLightSprite, "gfx/CrownOfLight.anm2"}, + std::pair{&darkPrincesCrownSprite, "gfx/DarkPrincesCrown.anm2"}}) + { + if (crown->isLoaded) continue; + + crown->Load(path, GRAPHICS_LOAD); + crown->GetLayer(1)->blendMode = {BLEND_EQUATION_ADD, sourceFactor, BLEND_FACTOR_ONE, BLEND_FACTOR_ONE, + BLEND_FACTOR_ONE}; + crown->scale = vector_make(1, 1); + } + + for (int i = 0; i < CHARGE_BAR_COUNT; i++) + { + if (chargeBarSprites[i].isLoaded) continue; + + chargeBarSprites[i].Load(CHARGE_BAR_PATHS[i], GRAPHICS_LOAD); + chargeBarSprites[i].scale = vector_make(1, 1); + } +} + +// Forgets the entities, item lists and character state a player linked to, as Init does before the starting stats. +void Entity_Player::links_reset() +{ + moveToTarget = {}; + voidedCollectibles.clear(); + voidedPassives.clear(); + movingBoxContents.clear(); + extensionCordIndex = -1; + hallowedGroundCountdown = 0; + damageMultiplierStacks = 0; + lastDamageMultiplierStacks = 0; + forgottenBody = nullptr; + playerHUD.reset(); + heightVelocity = 0; + redStewBonusDuration = 0; + salvationEffect = nullptr; + astralProjectionBody = nullptr; + brokenHearts = 0; + rottenHearts = 0; + effectiveSoulCharge = 0; + marsCooldown = 0; + isMarsDashReady = true; + marsDashDirection = -1; + marsLastTapDirection = 0; + marsTapFrames = 0; + poisonDamageFrames = 0; + urnSouls = 0; + numGigaBombs = 0; + rockBottomMoveSpeed = 0; + rockBottomMaxFireDelay = 0; + rockBottomDamage = 0; + rockBottomTearRange = 0; + rockBottomShotSpeed = 0; + rockBottomLuck = ROCK_BOTTOM_LUCK_UNSET; + reverseEmpressMaxHearts = 0; + reverseChariotMoveCooldown = 0; + reverseSunBoneHearts = 0; + revelationChargeTimer = 0; + montezumaChargeTimer = 0; + jupiterCharge = 0; + maggyHealthDrainCooldown = 0; + maggySwingCooldown = 0; + jellyBellyBounceTimer = 0; + montezumaLaser = nullptr; + forgottenBodyRoomIdx = FORGOTTEN_BODY_ROOM_NONE; + backupPlayer = nullptr; + echoChamberItems.clear(); + suplexState = 0; + suplexAimCountdown = 0; + suplexTargetPos = {}; + suplexLandPos = {}; + bagOfCraftingContent.fill(0); + bagOfCraftingHoldFrames = 0; + poopSpellQueue.fill(0); + poopMana = 0; + eveSumptoriumCharge = 0; + effectiveBloodCharge = 0; + forgottenBHeight = 0; + forgottenBHeightVelocity = 0; + darkArtsLastSnare = nullptr; + isDarkArtsBlastPending = false; + modelingClayEffect = 0; + keepersSackBonus = 0; + darkEsau = nullptr; + isLevelStartPending = false; + proceduralItems.clear(); + extraCollectibleCounts.assign(g_manager->itemConfig.collectibles.size(), 0); + extraTrinketCounts.assign(g_manager->itemConfig.trinkets.size(), 0); + grantedCollectibleCountdown = 0; + grantedCollectibleFlags = 0; + hasCurseMistEffect = false; + curseMistPocketItems.fill({0, POCKET_CARD}); + curseMistTrinkets.fill(0); + ghostPocketItems.fill({0, POCKET_CARD}); + ghostTrinkets.fill(0); + wildCardItemType = WILD_CARD_NONE; + wildCardItem = 0; + wildCardVarData = 0; + samsonBerserkCharge = 0; + ibsCharge = 0; +} + +// 007bbbd0 Gives a character the name, health and pickups its players.xml entry starts with, then what its type, Eden's +// rolls, the challenge and the seeds add. Eden rolls its health, a pickup and its stat offsets from the init seed. +void Entity_Player::InitPreLevelInitStats() +{ + Game& game = *g_game; + EntityConfig_Player* playerConfig = g_manager->entityConfig.GetPlayer(playerType); + RNG rng = rng_make(initSeed, PRE_LEVEL_RNG_SHIFT); + + if (!playerConfig) + { + log_printf(LOG_ASSERT, "Could not load config for player type %d\n", playerType); + return; + } + name = playerConfig->GetDisplayName(); + if (playerType == PLAYER_THELOST || playerType == PLAYER_THELOST_B) AddEntityFlags(FLAG_NO_SPIKE_DAMAGE); + maxHearts = game.deathmatchManager.is_active() ? playerConfig->heart * DEATHMATCH_HEART_SCALE : playerConfig->heart; + redHearts = maxHearts; + soulHearts = playerConfig->armor; + + switch (playerType) + { + case PLAYER_THEFORGOTTEN: + soulHearts = 0; + redHearts = 0; + maxHearts = 0; + AddBoneHearts(playerConfig->heart / 2); + AddHearts(playerConfig->heart, false, false); + AddEntityFlags(FLAG_NO_SPIKE_DAMAGE); + init_forgotten_twin(); + break; + case PLAYER_THESOUL: + init_forgotten_twin(); + break; + case PLAYER_KEEPER: + if (is_run_unlocked(ACHIEVEMENT_KEEPER_HOLDS_A_PENNY)) + { + maxHearts += 2; + redHearts += 2; + } + break; + case PLAYER_LAZARUS_B: + if (!backupPlayer && playerIndex >= 0 && !game.isStartingFromState && + !game.isRestoringGlowingHourglassState) + { + backupPlayer = new Entity_Player(); + backupPlayer->Init(type, variant, PLAYER_LAZARUS2_B, initSeed); + backupPlayer->backupPlayer = this; + backupPlayer->isExists = false; + } + break; + case PLAYER_BETHANY: + if (HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES)) IncrementPlayerFormCounter(PLAYERFORM_BOOK_WORM, 1); + break; + case PLAYER_BETHANY_B: + AddBloodCharge(redHearts); + maxHearts = 0; + redHearts = 0; + break; + case PLAYER_JACOB_B: + init_forgotten_twin(); + break; + default: + break; + } + + AddBlackHearts(playerConfig->blackHeart); + AddBrokenHearts(playerConfig->brokenHeart); + if (playerType == PLAYER_MAGDALENE_B) redHearts = std::min(maxHearts, MAGDALENE_B_START_RED_HEARTS); + if (!game.playerManager.playerList.empty()) game.GetPlayer(0)->ConsumableCountChanged(-1); + if (!isSpawningHelperPlayers) + { + if (playerType == PLAYER_BLUEBABY_B) + { + AddPoopMana(playerConfig->bombs); + poop_spell_roll(); + } + else AddBombs(playerConfig->bombs); + AddKeys(playerConfig->keys); + AddCoins(playerConfig->coins); + } + if (playerType == PLAYER_KEEPER && is_run_unlocked(ACHIEVEMENT_KEEPER_HOLDS_A_PENNY)) numCoins++; + else if (playerType == PLAYER_BETHANY && soulHearts > 0) + { + AddSoulCharge(soulHearts); + soulHearts = 0; + if (!game.deathmatchManager.is_active()) blackHearts = 0; + } + if (playerConfig->id == PLAYER_EDEN || playerConfig->id == TAINTED_EDEN_PLAYER_ID) eden_stats_roll(rng); + + if (game.challenge != 0) + { + ChallengeParam& challenge = g_manager->GetChallengeParams((int)game.challenge); + if (challenge.maxHearts != 0) AddMaxHearts(challenge.maxHearts, false); + if (challenge.hearts != 0) AddHearts(challenge.hearts, false, false); + if (challenge.soulHearts > 0) AddSoulHearts(challenge.soulHearts, false); + if (challenge.blackHearts > 0) AddBlackHearts(challenge.blackHearts); + if (challenge.coins != 0) AddCoins(challenge.coins); + UpdateBlackHeartMask(); + } + if (game.seedEffects.HasSeedEffect(SEED_ITEMS_COST_MONEY)) AddCoins(ITEMS_COST_MONEY_COINS); + if (game.seedEffects.HasSeedEffect(SEED_NO_FACE)) + AddCostume(g_manager->itemConfig.GetNullItem(NULLITEM_BLANKFACE), false); +} + +// Rolls Eden's health, a starting pickup and its stat offsets, in the original's order of draws. +void Entity_Player::eden_stats_roll(RNG& rng) +{ + uint32_t heartRoll = rng.Next() & 3; + maxHearts = (int)heartRoll * 2; + redHearts = maxHearts; + soulHearts = (int)rng.RandomInt(4 - heartRoll) * 2; + if (redHearts == 0 && soulHearts < 3) soulHearts = 4; + + uint32_t pickupRoll = rng.Next(); + if (pickupRoll % 3 != 0 && (rng.Next() & 1)) + { + uint32_t kind = rng.Next() % 3; + if (kind == 0) numCoins = (int)(rng.Next() % EDEN_COIN_RANGE) + 1; + else if (kind == 1) numKeys = 1; + else numBombs = (int)rng.RandomInt(2) + 1; + } + + edenDamage = rng.RandomFloat() * 2 - 1; + edenSpeed = rng.RandomFloat() * EDEN_SPEED_SPREAD - EDEN_SPEED_SPREAD / 2; + edenFireDelay = rng.RandomFloat() * EDEN_FIRE_DELAY_SPREAD - EDEN_FIRE_DELAY_SPREAD / 2; + edenTearRange = rng.RandomFloat() * EDEN_RANGE_SPREAD - EDEN_RANGE_SPREAD / 2; + edenShotSpeed = rng.RandomFloat() * EDEN_SHOT_SPEED_SPREAD - EDEN_SHOT_SPEED_SPREAD / 2; + edenLuck = rng.RandomFloat() * 2 - 1; +} + +// Gives the player a starting collectible, as the run's start does: added as picked up, out of the pools, and its +// temporary effect gone. +void Entity_Player::starting_collectible_add(int id) +{ + AddCollectible(id, -1, true, 0, 0); + g_game->itemPool.RemoveCollectible(id, REMOVE_ANY, REMOVE_APPLY); + if (ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(id)) temporaryEffects.RemoveEffect(item, 1); +} + +// Gives the player a starting trinket and takes it out of the trinket pool. +void Entity_Player::starting_trinket_add(int id) +{ + AddTrinket(id, true); + std::vector& pool = g_game->itemPool.trinketPoolItems; + if (id <= 0 || id >= (int)pool.size() || !pool[id].isAvailable || !pool[id].isInPool) return; + pool[id].isAvailable = false; + g_game->itemPool.numAvailableTrinkets--; +} + +// 007bc740 Gives a character the items the level start leaves it: its card or pill, its config's collectibles and the +// unlocked ones (D6, Wooden Nickel, Razor Blade), the daily's, its innate items and pocket active, its trinket, Eden's +// rolled items, the Mega Satan key pieces and the challenge's lists. Then it evaluates the stats, shares the pickups +// and starts the twins and companions. Straw Man's player only evaluates. Netplay's per-player save data is offline. +// The original's daily specials and its Backasswards and Cantripped extras stop here until reached. +void Entity_Player::InitPostLevelInitStats() +{ + Game& game = *g_game; + EntityConfig_Player* playerConfig = g_manager->entityConfig.GetPlayer(playerType); + RNG rng = rng_make(initSeed, PRE_LEVEL_RNG_SHIFT); + ChallengeParam& challenge = game.GetChallengeParams(); + int startFrame = game.frameCount; + + if (!playerConfig) log_printf(LOG_ASSERT, "Could not load config for player type %d\n", playerType); + if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_STRAW_MAN)) + { + EvaluateItems(); + game.GetPlayer(0)->ConsumableCountChanged(-1); + isPostLevelInitFinished = true; + return; + } + if (game.dailyChallenge._specialDailyId != 0) + reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (a daily's special start)"); + + if (playerConfig->card > 0) AddPocketItem(playerConfig->card, POCKET_CARD); + else if (playerConfig->card < 0) AddPocketItem(card_roll(initSeed, CARD_START_RUNE_CHANCE, true), POCKET_CARD); + else if (playerConfig->pill > 0) AddPocketItem(playerConfig->pill, POCKET_PILL); + else if (playerConfig->pill < 0) AddPocketItem(ItemPool::GetPill(initSeed), POCKET_PILL); + else if (playerType == PLAYER_MAGDALENE && is_run_unlocked(ACHIEVEMENT_MAGDALENE_HOLDS_A_PILL)) + reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (Magdalene's starting pill)"); + + std::vector items = playerConfig->collectibles; + if (game.challenge == 0) + { + if (playerType == PLAYER_ISAAC && is_run_unlocked(ACHIEVEMENT_ISAAC_HOLDS_THE_D6)) + items.push_back(COLLECTIBLE_D6); + if (playerType == PLAYER_KEEPER && is_run_unlocked(ACHIEVEMENT_KEEPER_HOLDS_WOODEN_NICKEL)) + items.push_back(COLLECTIBLE_WOODEN_NICKEL); + if (playerType == PLAYER_EVE && is_run_unlocked(ACHIEVEMENT_EVE_HOLDS_RAZOR_BLADE)) + items.push_back(COLLECTIBLE_RAZOR_BLADE); + } + if (!game.deathmatchManager.is_active()) + for (int id : items) starting_collectible_add(id); + apply_innate_collectibles(); + + if (game.challenge == CHALLENGE_RED_REDEMPTION) + { + SetPocketActiveItem(COLLECTIBLE_RED_KEY, POCKET_ACTIVE_SLOT, false); + activeItems[POCKET_ACTIVE_SLOT].varData = RED_REDEMPTION_KEY_CHARGES; + } + else if (playerConfig->pocketActiveID != 0) + SetPocketActiveItem(playerConfig->pocketActiveID, POCKET_ACTIVE_SLOT, false); + + int trinket = playerConfig->trinket; + if (trinket == 0 && game.challenge == 0) + { + if (playerType == PLAYER_KEEPER && is_run_unlocked(ACHIEVEMENT_KEEPER_HOLDS_STORE_KEY)) + trinket = TRINKET_STORE_KEY; + else if (playerType == PLAYER_CAIN && is_run_unlocked(ACHIEVEMENT_CAIN_HOLDS_PAPERCLIP)) + trinket = TRINKET_PAPER_CLIP; + else if (playerType == PLAYER_SAMSON && is_run_unlocked(ACHIEVEMENT_SAMSON_HOLDS_CHILDS_HEART)) + trinket = TRINKET_CHILDS_HEART; + } + if (trinket != 0 && !game.deathmatchManager.is_active()) starting_trinket_add(trinket); + + if ((playerConfig->id == PLAYER_EDEN || playerConfig->id == TAINTED_EDEN_PLAYER_ID) && + !game.deathmatchManager.is_active()) + reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (Eden's rolled items)"); + if (challenge.isMegaSatan) + { + starting_collectible_add(COLLECTIBLE_KEY_PIECE_1); + starting_collectible_add(COLLECTIBLE_KEY_PIECE_2); + } + if (game.challenge == 0 && game.dailyChallenge._id == 0) + { + if (startFrame == 0 && (g_manager->persistentGameData.eventCounters[EVENT_BONUS_ITEMS] & 0xffff) != 0) + reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (the bonus starting items)"); + } + else if (twin_get() && twin_get()->playerIndex != -1 && playerIndex > twin_get()->playerIndex && twin_get() != this) + { + for (int id : challenge.collectibleTwinList) + if (id < 0) RemoveCollectible(-id, false, 0, true); + else starting_collectible_add(id); + } + else + { + for (int id : challenge.collectibleList) + if (id < 0) RemoveCollectible(-id, false, 0, true); + else starting_collectible_add(id); + for (int id : challenge.trinketList) starting_trinket_add(id); + if (challenge.startingPill != PILLEFFECT_NULL) + reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (a challenge's starting pill)"); + if (challenge.startingCard > 0) AddPocketItem(challenge.startingCard, POCKET_CARD); + else if (challenge.startingCard < 0) AddPocketItem(card_roll(rng.Next(), 0, false), POCKET_CARD); + } + + EvaluateItems(); + game.GetPlayer(0)->ConsumableCountChanged(-1); + if (!replacedPlayer) companions_init(); + if (game.challenge == CHALLENGE_BACKASSWARDS) + reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (Backasswards' ten items)"); + if (game.challenge == CHALLENGE_CANTRIPPED) + for (int i = 0; i < CANTRIPPED_CARDS; i++) AddItemCard(0); + isPostLevelInitFinished = true; +} + +// Starts the companions some characters begin with: Jacob's Esau, Tainted Forgotten's soul, Tainted Apollyon's locust +// and Tainted Jacob's Dark Esau curse. +void Entity_Player::companions_init() +{ + Game& game = *g_game; + + switch (playerType) + { + case PLAYER_JACOB: + InitTwin(PLAYER_ESAU)->InitPostLevelInitStats(); + break; + case PLAYER_THEFORGOTTEN_B: + if (!isCoopGhost) InitTwin(PLAYER_THESOUL_B)->InitPostLevelInitStats(); + break; + case PLAYER_APOLLYON_B: + game.Spawn({.position = pos, + .spawner = this, + .subType = LOCUST_SUBTYPE_START, + .type = ENTITY_FAMILIAR, + .variant = FAMILIAR_ABYSS_LOCUST, + .seed = Random()}) + ->Update(); + break; + case PLAYER_JACOB_B: + if (game.challenge != CHALLENGE_RED_REDEMPTION) jacobs_curse_add(); + break; + default: + break; + } +} + +// Starts the countdown to Dark Esau's next charge on Tainted Jacob: 20 to 600 seconds after 610 frames, drawn from the +// devil room generator. +void Entity_Player::jacobs_curse_add() +{ + temporaryEffects.RemoveNullEffect(NULLITEM_JACOBS_CURSE, -1); + ItemConfig_Item* item = g_manager->itemConfig.GetNullItem(NULLITEM_JACOBS_CURSE); + if (!item) return; + + RNG rng = rng_make(g_game->devilAngelRoomRNG._seed, JACOBS_CURSE_RNG_SHIFT); + TemporaryEffect effect(item); + effect.cooldown = (int)(rng.Next() % JACOBS_CURSE_STEPS) * JACOBS_CURSE_STEP_FRAMES + JACOBS_CURSE_MIN_FRAMES; + temporaryEffects.AddEffect(effect, true, 1); +} + +// 007a4ba0 Readies the player for a new floor: places it at the start (unless forced), and once its run has started, +// spills blood at low health, ends the floor's effects, restores what the floor gives back and evaluates its stats. +void Entity_Player::level_start(bool isForced) +{ + delayedSfxId = 0; + delayedSfxDelay = 0; + moveToTarget = {}; + if (variant == PLAYER_VARIANT_PLAYER && !isForced) start_position_set(); + if (!isPostLevelInitFinished) return; + + spawn_low_health_blood_splat(); + if (variant == PLAYER_VARIANT_COOP_BABY) + { + if (isGlitchBaby) reconstruction_missing("Entity_Player::level_start 007a4ba0 (the glitched co-op baby)"); + if (parent) pos = parent->pos; + } + isLevelStartPending = false; + level_items_apply(isForced); +} + +// Places a character at the floor's start: the greed mode spot, the first floor's spot below the middle, or where the +// player manager puts the players, lower in Backasswards' Blue Womb. The Ascent starts at a door. +void Entity_Player::start_position_set() +{ + Game& game = *g_game; + float startY = START_SPOT_Y; + + if (game.difficulty == DIFFICULTY_GREED || game.difficulty == DIFFICULTY_GREEDIER) startY = GREED_START_SPOT_Y; + else + { + bool isAltStage = game.stageType == STAGETYPE_REPENTANCE || game.stageType == STAGETYPE_REPENTANCE_B; + if (game.stage + (isAltStage ? 1 : 0) != 1 || game.IsAscent()) + { + pos = PlayerManager::get_player_start_position(this, {}); + if (game.challenge == CHALLENGE_BACKASSWARDS && game.stage == STAGE_BLUE_WOMB) + pos.y += BACKASSWARDS_START_OFFSET_Y; + + uint32_t curses = + (Seeds::GetForcedCurses() | game.debugCurses | game.curses) & ~Seeds::GetPreventedCurses(); + int stage = (int)game.stage + (curses & CURSE_OF_LABYRINTH ? 1 : 0); + if (game.IsAscent() && !(stage == ASCENT_HOME_STAGE && game.IsAltPath())) + reconstruction_missing("Entity_Player::level_start 007a4ba0 (the Ascent's door start)"); + return; + } + } + pos = PlayerManager::get_player_start_position(this, vector_make(START_SPOT_X, startY)); +} + +// Ends the floor-long effects and restores what each floor gives back: Holy Mantle from Wooden Cross, the floor's +// health, map and compass effects, items that recharge, pickups some trinkets spawn, the Backasswards penalty and the +// per-floor generators, then evaluates. A forced start also restarts the player's familiars. +void Entity_Player::level_items_apply(bool isForced) +{ + Game& game = *g_game; + ItemConfig& items = g_manager->itemConfig; + + wooden_cross_mantles_add(); + temporaryEffects.RemoveNullEffect(NULLITEM_REVERSE_SUN, -1); + temporaryEffects.RemoveNullEffect(NULLITEM_LUNA, -1); + if (ItemConfig_Item* salvation = items.GetCollectible(COLLECTIBLE_SALVATION)) + temporaryEffects.RemoveEffect(salvation, -1); + if (ItemConfig_Item* foundSoul = items.GetTrinket(TRINKET_FOUND_SOUL)) temporaryEffects.RemoveEffect(foundSoul, -1); + temporaryEffects.RemoveNullEffect(NULLITEM_JACOBS_CURSE, -1); + for (Entity* entity : std::vector(game.room->entityList.mainEL)) + if (entity->type == ENTITY_DARK_ESAU && entity->target.get() == this) entity->Remove(); + temporaryEffects.RemoveNullEffect(NULLITEM_JUDAS_BIRTHRIGHT_STAGE, 1); + if (playerType == PLAYER_JACOB2_B) ChangePlayerType(PLAYER_JACOB_B, false); + else if (playerType == PLAYER_LAZARUS2) ChangePlayerType(PLAYER_LAZARUS, false); + if (playerType == PLAYER_JACOB_B && game.challenge != CHALLENGE_RED_REDEMPTION) jacobs_curse_add(); + + if (HasCollectible(COLLECTIBLE_EMPTY_HEART)) + for (Entity_Player* player : {this, subPlayer}) + if (player && player->GetHealthType() == HEALTH_DEFAULT && + player->GetHeartLimit(false) > player->maxHearts && player->redHearts < EMPTY_HEART_RED_HEARTS) + { + player->AddMaxHearts(2, false); + game.itemOverlay.Show(GIANTBOOK_EMPTY_HEART, 0, nullptr); + } + if (TemporaryEffect* redemption = temporaryEffects.GetCollectibleEffect(COLLECTIBLE_REDEMPTION)) + if (redemption->count > 0) + reconstruction_missing("Entity_Player::level_start 007a4ba0 (Redemption's blessing)"); + forgottenBodyRoomIdx = FORGOTTEN_BODY_ROOM_NONE; + for (int i = HasTrinket(TRINKET_LUCKY_SACK) ? GetTrinketMultiplier(TRINKET_LUCKY_SACK) : 0; i > 0; i--) + { + uint32_t seed = GetTrinketRNG(TRINKET_LUCKY_SACK).Next(); + Vector spot = room_free_pickup_position(pos, PICKUP_SPAWN_RADIUS); + game.Spawn( + {.position = spot, .spawner = this, .type = ENTITY_PICKUP, .variant = PICKUP_GRAB_BAG, .seed = seed}); + } + if (!isForced && backupPlayer) backupPlayer->isLevelStartPending = true; + for (Entity_Player* player : {this, subPlayer}) + if (player && player->eternalHearts > 0) + { + player->eternalHearts = 0; + bool isBlackSoul = player->GetHealthType() == HEALTH_SOUL && + (player->playerType == PLAYER_BLACKJUDAS || player->playerType == PLAYER_JUDAS_B); + game.itemOverlay.Show(isBlackSoul ? GIANTBOOK_ETERNAL_BLACK : GIANTBOOK_ETERNAL, 1, nullptr); + player->AddMaxHearts(2, false); + player->AddHearts(2, false, false); + } + if (!isCoopGhost) + for (Entity* entity : game.room->entityList.mainEL) + if (Entity_Familiar* familiar = dynamic_cast(entity); + familiar && familiar->IsType(ENTITY_FAMILIAR, FAMILIAR_LIL_PORTAL, 1) && familiar->player == this) + familiar->subtype = 0; + + floor_maps_apply(); + floor_items_recharge(); + if (HasTrinket(TRINKET_HOLLOW_HEART)) AddBoneHearts(GetTrinketMultiplier(TRINKET_HOLLOW_HEART)); + if (HasCollectible(COLLECTIBLE_MISSING_NO)) + reconstruction_missing("Entity_Player::level_start 007a4ba0 (Missing No.)"); + if (HasCollectible(COLLECTIBLE_ZODIAC)) + { + if (!HasCollectible(COLLECTIBLE_TAURUS) && !temporaryEffects.HasCollectibleEffect(COLLECTIBLE_TAURUS)) + RemoveCostume(items.GetCollectible(COLLECTIBLE_TAURUS)); + cacheFlags |= CACHE_ALL; + } + if (HasTrinket(TRINKET_STEM_CELL)) stem_cell_heal(); + if (game.challenge == CHALLENGE_BACKASSWARDS) backasswards_penalty(); + + floor_rngs_reseed(); + if (!isForced) + { + hasGoldenKey = false; + hasGoldenBomb = false; + } + levelEffectItems.clear(); + bloodLustCounter = 0; + for (int id : {COLLECTIBLE_BLOODY_LUST, COLLECTIBLE_BLOODY_GUST}) + cacheFlags |= items.GetCollectible(id) ? items.GetCollectible(id)->cacheFlags : 0; + EvaluateItems(); + if (!isForced) return; + + for (Entity* entity : std::vector(game.room->entityList.mainEL)) + if (Entity_Familiar* familiar = dynamic_cast(entity); familiar && familiar->player == this) + familiar->level_start(); +} + +// Applies the floor's map, Blue Map and compass items, Cain's Eye's chance at a compass, Maggy's Faith's eternal +// hearts, Sol's boss room icon, Luna's secret room and Missing Poster's chance at the super secret room, and Dream +// Catcher's soul heart. +void Entity_Player::floor_maps_apply() +{ + Game& game = *g_game; + bool isMind = HasCollectible(COLLECTIBLE_MIND); + + if (HasCollectible(COLLECTIBLE_TREASURE_MAP) || isMind) game.ApplyMapEffect(); + if (HasCollectible(COLLECTIBLE_BLUE_MAP) || isMind) game.ApplyBlueMapEffect(); + bool isCainsEye = HasTrinket(TRINKET_CAINS_EYE) && + Random() % 100 < (uint32_t)(GetTrinketMultiplier(TRINKET_CAINS_EYE) * CAINS_EYE_CHANCE); + if (HasCollectible(COLLECTIBLE_COMPASS) || isMind || isCainsEye) game.ApplyCompassEffect(true); + if (HasTrinket(TRINKET_MAGGYS_FAITH)) AddEternalHearts(GetTrinketMultiplier(TRINKET_MAGGYS_FAITH)); + if (HasCollectible(COLLECTIBLE_SOL)) + { + if (game.lastBossRoomListIdx >= 0) game.roomList[game.lastBossRoomListIdx].displayFlags |= ROOM_DISPLAY_ICON; + game.minimap.Refresh(); + game.levelStateFlags |= LEVEL_STATE_SOL; + } + if (HasCollectible(COLLECTIBLE_LUNA)) game.reveal_secret_room(); + if (HasTrinket(TRINKET_MISSING_POSTER)) + { + int multiplier = GetTrinketMultiplier(TRINKET_MISSING_POSTER); + uint32_t chance = multiplier == 2 ? 66 : multiplier > 2 ? 100 : 33; + if (GetTrinketRNG(TRINKET_MISSING_POSTER).Next() % 100 < chance) + { + for (int i = 0; i < game.nbRooms; i++) + { + if (!game.roomList[i].data) log_printf(LOG_ASSERT, "[error] Room %d is not initialized\n", i); + if (game.roomList[i].data->type != ROOM_SUPERSECRET) continue; + game.roomList[i].displayFlags |= ROOM_DISPLAY_ICON; + break; + } + game.minimap.Refresh(); + } + } + if (HasCollectible(COLLECTIBLE_DREAM_CATCHER)) AddSoulHearts(1, false); +} + +// Recharges Notched Axe and Eraser and empties the Glowing Hour Glass for the new floor, then lets the Necronomicon +// transformation recharge its book. Beth's Faith gives wisps. +void Entity_Player::floor_items_recharge() +{ + Game& game = *g_game; + + for (int slot = 0; slot < ACTIVE_SLOT_COUNT; slot++) + { + ActiveItemDesc& active = activeItems[slot]; + if (active.item == COLLECTIBLE_NOTCHED_AXE) + { + bool isEmpty = slot == POCKET_ACTIVE_SLOT + 1 || + (slot == POCKET_ACTIVE_SLOT && activeItems[POCKET_ACTIVE_SLOT].item == COLLECTIBLE_RED_KEY && + game.challenge == CHALLENGE_RED_REDEMPTION); + AddActiveCharge(isEmpty ? 0 : GetCollectibleMaxCharge(COLLECTIBLE_NOTCHED_AXE, active.varData), slot, false, + false, true); + } + else if (active.item == COLLECTIBLE_GLOWING_HOUR_GLASS) + { + active.varData = 0; + SetActiveCharge(0, slot); + } + else if (active.item == COLLECTIBLE_ERASER) AddActiveCharge(1, slot, false, false, true); + } + if (!hasCurseMistEffect && !isCoopGhost && playerForms[PLAYERFORM_NECROMANCER] > 2) + reconstruction_missing("Entity_Player::level_start 007a4ba0 (the Necronomicon transformation)"); + for (int i = HasTrinket(TRINKET_BETHS_FAITH) ? GetTrinketMultiplier(TRINKET_BETHS_FAITH) * 4 : 0; i > 0; i--) + AddWisp(COLLECTIBLE_BOOK_OF_VIRTUES, pos, false, false); +} + +// Stem Cell heals half the missing red hearts, all of them at two, and all of them with two heart drops at three. +void Entity_Player::stem_cell_heal() +{ + int multiplier = GetTrinketMultiplier(TRINKET_STEM_CELL); + HealthType health = GetHealthType(); + int containers = health == HEALTH_SOUL || health == HEALTH_NO_HEALTH ? maxHearts : maxHearts + boneHearts * 2; + int missing = containers - redHearts; + + if (multiplier == 1) AddHearts(std::max(1, missing / 2), false, false); + else if (multiplier == 2) AddHearts(std::max(1, missing), false, false); + else if (multiplier == 3) + { + AddHearts(std::max(1, missing), false, false); + for (int i = 0; i < 2; i++) + { + uint32_t seed = Random(); + g_game->Spawn({.position = room_random_pickup_position(), + .type = ENTITY_PICKUP, + .variant = PICKUP_HEART, + .seed = seed}); + } + } +} + +// Backasswards takes the first collectible picked up and a heart container each floor, leaving a soul heart if nothing +// else is left. +void Entity_Player::backasswards_penalty() +{ + for (HistoryItem& item : history.historyItems) + if (!item.isTrinket && HasCollectible(item.id)) + { + RemoveCollectible(item.id, false, 0, true); + break; + } + AddMaxHearts(-2, false); + if (redHearts < 1 && soulHearts < 1 && boneHearts < 1) AddSoulHearts(1, false); +} + +// Reseeds the generators of the items that pick a room for the floor (Teleport!, Undefined, Cursed Eye, Cursed Skull, +// Telepills) from the floor's dungeon placement seed, so every player draws the same rooms. +void Entity_Player::floor_rngs_reseed() +{ + RNG stepper = rng_make(g_game->dungeonPlacementSeed, PRE_LEVEL_RNG_SHIFT); + + collectibleRNGs[COLLECTIBLE_TELEPORT] = rng_make(stepper.Next(), FLOOR_RNG_SHIFT); + collectibleRNGs[COLLECTIBLE_UNDEFINED] = rng_make(stepper.Next(), FLOOR_RNG_SHIFT); + collectibleRNGs[COLLECTIBLE_CURSED_EYE] = rng_make(stepper.Next(), FLOOR_RNG_SHIFT); + trinketRNGs[TRINKET_CURSED_SKULL] = rng_make(stepper.Next(), FLOOR_RNG_SHIFT); + pillRNGs[PILLEFFECT_TELEPILLS] = rng_make(stepper.Next(), FLOOR_RNG_SHIFT); +} + +// 007daff0 Wooden Cross shields the player with Holy Mantle once per floor, twice when golden or doubled. +void Entity_Player::wooden_cross_mantles_add() +{ + int multiplier = GetTrinketMultiplier(TRINKET_WOODEN_CROSS); + if (multiplier == 0) + { + holyMantleStacks = 0; + return; + } + + int count = multiplier == 1 ? 1 : 2; + holyMantleStacks = multiplier == 1 ? WOODEN_CROSS_STACK : WOODEN_CROSS_STACK * 2; + for (int i = 0; i < count; i++) temporaryEffects.AddCollectibleEffect(COLLECTIBLE_HOLY_MANTLE, true, 1); +} + +// 007a49e0 Leaves a blood splat where a player with health is down to its last heart, red unless its blood is +// white (Kidney Stone, Eve and Tainted Eve keep the effect's own color). +void Entity_Player::spawn_low_health_blood_splat() +{ + if (variant != PLAYER_VARIANT_PLAYER || boneHearts + soulHearts + redHearts >= 2 || isCoopGhost) return; + for (int type : {PLAYER_THELOST, PLAYER_THEFORGOTTEN, PLAYER_THESOUL, PLAYER_THELOST_B, PLAYER_THEFORGOTTEN_B, + PLAYER_THESOUL_B, PLAYER_JACOB2_B}) + if (playerType == type) return; + + Entity* splat = + g_game->Spawn({.position = pos, .type = ENTITY_EFFECT, .variant = EFFECT_BLOOD_SPLAT, .seed = Random()}); + float scale = (float)Random() * RANDOM_FLOAT_SCALE * 0.5f + 0.3f; + splat->sprite.scale = vector_make(scale, scale); + splat->sprite.rotation = (float)(Random() & 3) * 90; + splat->sprite.isFlipX = !(Random() & 1); + if (!HasCollectible(COLLECTIBLE_KIDNEY_STONE) && playerType != PLAYER_EVE && playerType != PLAYER_EVE_B) + splat->SetColor(color_from_bytes(0, 0, 0, PEE_ALPHA, PEE_OFFSET, PEE_OFFSET, 0), -1, COLOR_PRIORITY_TOP, false, + true); + splat->Update(); +} + +// 007a6450 Gives the player a controller, moving its player color over, and the NPCs it controls with it. With +// isIncludePlayerOwned its sub player, Lazarus twin, twin and the players it owns follow. +void Entity_Player::SetControllerIndex(int index, bool isIncludePlayerOwned) +{ + PlayerManager& players = g_game->playerManager; + + log_printf(LOG_INFO, "Entity_Player::SetControllerId() Setting controller ID to %d, (Prev: %d) \n", index, + controllerIndex); + if (index != -1 && controllerIndex != index) + { + if (controllerIndex == -1) players.AssignPlayerColor(index); + else if (players.isColorAssignEnabled) player_color_reassign(index); + } + if (controllerIndex != -1) + for (Entity* entity : g_game->room->entityList.mainEL) + if (Entity_NPC* npc = dynamic_cast(entity); npc && npc->controllerID == controllerIndex) + npc->controllerID = index; + controllerIndex = index; + if (!isIncludePlayerOwned) return; + + for (Entity_Player* owned : {subPlayer, backupPlayer, twin_get()}) + if (owned) owned->SetControllerIndex(controllerIndex, false); + if (parent) return; + for (size_t i = 0; i < players.playerList.size(); i++) + { + Entity_Player* player = players.GetPlayer((int)i); + if (player->parent.get() == this) player->SetControllerIndex(controllerIndex, true); + } +} + +// Moves the player color of the current controller to a new one. +void Entity_Player::player_color_reassign(int index) +{ + std::array& colors = g_game->playerManager.colorControllers; + + for (size_t i = 0; i < colors.size(); i++) + if (colors[i] == controllerIndex) + { + log_printf(LOG_INFO, "Reassigning Player Color (%d) Prev(%d) New(%d) \n", (int)i, controllerIndex, index); + colors[i] = index; + return; + } + log_printf( + LOG_ERROR, + "PlayerManager::ReassignPlayerColor(%d, %d) cannot reassign the color, because there is no color assigned " + "to the original controller ID \n", + controllerIndex, index); +} + +// 007cba30 Whether the player can shoot: a character as its config and the challenge allow, a co-op baby unless it is +// the magnet baby, and in the deathmatch as its rules allow. +void Entity_Player::UpdateCanShoot() +{ + Game& game = *g_game; + + canShoot = true; + if (variant == PLAYER_VARIANT_COOP_BABY && babySkin == BABY_MAGNET) canShoot = false; + else if (variant == PLAYER_VARIANT_PLAYER) + { + bool isChallengeShooting = game.GetChallengeParams().isCanShoot; + EntityConfig_Player* playerConfig = g_manager->entityConfig.GetPlayer(playerType); + if (!playerConfig) log_printf(LOG_ASSERT, "Could not load config for player type %d\n", playerType); + canShoot = isChallengeShooting && playerConfig && playerConfig->isCanShoot; + } + if (game.deathmatchManager.is_active()) + reconstruction_missing("Entity_Player::UpdateCanShoot 007cba30 (deathmatch rules)"); +} + +// 0075dfe0 Takes off every costume, leaving each layer to the player's own sprite. +void Entity_Player::ClearCostumes() +{ + costumeSpriteDescs.clear(); + costume_map_reset(0); +} + +// Gives every layer back to the player's own sprite, the body layers marked as such. +void Entity_Player::costume_map_reset(int priority) +{ + for (int layer = 0; layer < COSTUME_LAYER_COUNT; layer++) + playerCostumeMap[layer] = {-1, -1, priority, is_body_layer(layer)}; +} + +// Whether a layer of the player's sprite is part of the body rather than the head. +bool Entity_Player::is_body_layer(int layer) +{ + return (layer >= PLAYER_LAYER_BODY && layer <= PLAYER_LAYER_BODY1) || layer == PLAYER_LAYER_TOP0; +} + +// 0075d850 Takes off an item's costume, from its Lazarus twin too when the item is shared, and redoes the costumes. +// Co-op babies wear none. +void Entity_Player::RemoveCostume(ItemConfig_Item* item) +{ + if (!item || variant == PLAYER_VARIANT_COOP_BABY || item->costume.anm2Path.empty()) return; + + if (isValid && item->HasTags(TAG_LAZ_SHARED) && backupPlayer) backupPlayer->RemoveCostume(item); + if (std::erase_if(costumeSpriteDescs, [item](CostumeSpriteDesc& costume) { return costume.item == item; }) > 0) + UpdateCostumes(); +} + +// 0075bf00 Lays the worn costumes over the player's layers by priority and recolors them for its skin. Only the case +// with no costumes and an unchanged skin color is reconstructed: the costume layout stops the game until reached. +void Entity_Player::UpdateCostumes() +{ + static bool isUpdating = false; + + if (variant == PLAYER_VARIANT_COOP_BABY || isUpdating) return; + if (!costumeSpriteDescs.empty()) + reconstruction_missing("Entity_Player::UpdateCostumes 0075bf00 (laying out costumes)"); + + isUpdating = true; + EntityConfig_Player* playerConfig = g_manager->entityConfig.GetPlayer(playerType); + if (!playerConfig) log_printf(LOG_ASSERT, "Could not load config for player type %d\n", playerType); + costume_map_reset(-1); + int skinColor = playerConfig ? playerConfig->skinColor : -1; + if (headColor != skinColor || bodyColor != skinColor) + reconstruction_missing("Entity_Player::UpdateCostumes 0075bf00 (recoloring the skin)"); + if (isCoopGhost) reset_body_sprite(); + isUpdating = false; +} + +// 007bebb0 Dresses the player in its character's skin: the challenge's or the config's spritesheet on every layer and +// the matching ghost layer, then the character's costume, the blindfold of characters that cannot shoot, the seeds' +// and dailies' costumes and the Hot Potato bomb. Co-op ghosts only get the ghost body. The name follows the character. +void Entity_Player::update_player_skin() +{ + Game& game = *g_game; + ItemConfig& items = g_manager->itemConfig; + + if (isCoopGhost) + { + reset_body_sprite(); + return; + } + EntityConfig_Player* playerConfig = g_manager->entityConfig.GetPlayer(playerType); + bodyColor = -1; + headColor = -1; + if (game.challenge == CHALLENGE_GUARDIAN) + { + for (int layer = 0; layer < COSTUME_LAYER_COUNT; layer++) + sprite.ReplaceSpritesheet(layer, "gfx/characters/costumes/NiceLilith.png"); + sprite.LoadGraphics(); + } + else if (!playerConfig->skinPath.empty()) + { + for (int layer = 0; layer < COSTUME_LAYER_COUNT; layer++) + sprite.ReplaceSpritesheet(layer, playerConfig->skinPath); + if (LayerState* ghost = sprite.GetLayer("ghost")) + sprite.ReplaceSpritesheet( + ghost->layerData ? ghost->layerData->id : -1, + costume_path_apply_skin_color(ghost->layerData ? ghost->layerData->spriteSheetPath : "", -1, playerType, + nullptr, nullptr)); + sprite.LoadGraphics(); + } + + if (playerConfig->costumeID == -1) UpdateCostumes(); + else AddCostume(items.GetNullItem(playerConfig->costumeID), false); + bool isBombForm = playerType == PLAYER_THEFORGOTTEN_B || playerType == PLAYER_THESOUL_B; + if (variant == PLAYER_VARIANT_PLAYER && !game.GetChallengeParams().isCanShoot && !isBombForm) + AddCostume(items.GetNullItem(NULLITEM_BLINDFOLD), false); + if (game.seedEffects.HasSeedEffect(SEED_CHRISTMAS) || game.dailyChallenge._specialDailyId == DAILY_CHRISTMAS) + AddCostume(items.GetNullItem(NULLITEM_CHRISTMAS), false); + if (game.challenge == CHALLENGE_HOT_POTATO && playerType == PLAYER_THEFORGOTTEN_B) + AddCostume(items.GetNullItem(NULLITEM_FORGOTTEN_BOMB), false); + name = playerConfig->GetDisplayName(); +} + +// 0075b540 A costume spritesheet's path for a character and skin color: the character's own costume folder +// (costumes_) when the file is there, then the skin color's _black, _blue, _red, _green, _grey or _white file +// when there. isSkinColorFound and isCharacterFound tell which were used. +std::string costume_path_apply_skin_color(const std::string& path, int skinColor, int playerType, + bool* isSkinColorFound, bool* isCharacterFound) +{ + std::string result = path; + bool isPlayerFound = false; + bool isSkinFound = false; + + EntityConfig_Player* playerConfig = playerType == -1 ? nullptr : g_manager->entityConfig.GetPlayer(playerType); + if (playerConfig && !playerConfig->costumeSuffixName.empty()) + { + size_t slash = path.find_last_of("/\\"); + while (slash != std::string::npos && slash >= COSTUMES_DIR.size() && + path.compare(slash - COSTUMES_DIR.size(), COSTUMES_DIR.size(), COSTUMES_DIR) != 0) + slash = slash == 0 ? std::string::npos : path.find_last_of("/\\", slash - 1); + if (slash != std::string::npos && slash >= COSTUMES_DIR.size()) + { + std::string candidate = path.substr(0, slash) + "_" + playerConfig->costumeSuffixName + path.substr(slash); + std::string redirected = g_manager->modManager.TryRedirectPath(candidate); + if (is_file_found(redirected)) + { + result = redirected; + isPlayerFound = true; + } + } + } + + if (skinColor >= 0) + { + size_t dot = result.find_last_of('.'); + if (dot != std::string::npos) + { + std::string_view suffix = SKIN_COLOR_SUFFIXES[skinColor < (int)SKIN_COLOR_SUFFIXES.size() ? skinColor : 0]; + std::string candidate = result.substr(0, dot) + std::string(suffix) + result.substr(dot); + std::string redirected = g_manager->modManager.TryRedirectPath(candidate); + if (is_file_found(redirected)) + { + result = redirected; + isSkinFound = true; + } + } + } + if (isSkinColorFound) *isSkinColorFound = isSkinFound; + if (isCharacterFound) *isCharacterFound = isPlayerFound; + return result; +} + +// Plays a sound effect at full volume, unless the seeds swap it for a fart. +void sound_play(int sound) +{ + int id = sound; + + seed_fart_sound_override(&id); + g_manager->sfxManager.Play(id); +} + +// 00417800 The twin that leads the pair (Jacob over Esau), or the player itself. +Entity_Player* Entity_Player::GetMainTwin() +{ + Entity_Player* twin = twin_get(); + return !twin || twin->playerIndex == -1 || playerIndex <= twin->playerIndex ? this : twin; +} + +// Whether Dead Bird's effect stays when the effects are cleared: while the player is down to its last heart, or two for +// Eve. +bool Entity_Player::is_dead_bird_kept() +{ + if (isCoopGhost) return false; + int red = maxHearts > 0 ? redHearts : 0; + return boneHearts + soulHearts + red <= (playerType == PLAYER_EVE ? 2 : 1); +} + +// 00763570 Recomputes the stats the cache flags ask for from the character, its items, effects, trinkets, seeds and +// challenge, then lets mods change them. Only the skeleton is reconstructed: a player whose stats nothing changes keeps +// the base stats Init gave it. Any item, effect or character bonus stops the game until reached, as does the weapon a +// changed weapon type needs (Isaac::CreateWeapon is not taken over). +void Entity_Player::EvaluateItems() +{ + if (!is_evaluation_plain()) + reconstruction_missing("Entity_Player::EvaluateItems 00763570 (items, effects or bonuses)"); + + for (uint32_t flag = CACHE_DAMAGE; flag <= CACHE_PICKUP_VISION; flag <<= 1) + if (cacheFlags & flag) static_cast(g_luaEngine)->EvaluateItems(this, (int)flag); + cacheFlags = 0; +} + +// Whether nothing would change a player's base stats: Isaac with no items, effects, pills, Eden rolls, modifiers or +// D8 rolls, outside challenges, dailies and seeds. +bool Entity_Player::is_evaluation_plain() +{ + Game& game = *g_game; + bool isOwningNothing = std::ranges::all_of(collectibleCounts, [](int count) { return count == 0; }) && + std::ranges::all_of(activeItems, [](ActiveItemDesc& active) { return active.item == 0; }) && + trinkets == std::array{} && temporaryEffects.effects.empty() && + std::ranges::all_of(pillEffectUses, [](int uses) { return uses == 0; }); + bool isUnmodified = speedModifier == 0 && fireDelayModifier == 0 && damageModifier == 0 && tearRangeModifier == 0 && + shotSpeedModifier == 0 && luckModifier == 0 && donateLuck == 0 && d8DamageModifier == 1 && + d8FireDelayModifier == 1 && d8RangeModifier == 1 && d8SpeedModifier == 1 && edenDamage == 0 && + edenSpeed == 0 && edenFireDelay == 0 && edenTearRange == 0 && edenShotSpeed == 0 && + edenLuck == 0; + return playerType == PLAYER_ISAAC && variant == PLAYER_VARIANT_PLAYER && isOwningNothing && isUnmodified && + !isCoopGhost && !hasCurseMistEffect && game.challenge == 0 && game.dailyChallenge._id == 0 && + game.seedEffects.CountSeedEffects() == 0 && !game.deathmatchManager.is_active(); +} + +// 00757a40 Drops the entity links, then lets go of the weapons and the effects the player spawned. +void Entity_Player::ClearReferences() +{ + Entity::ClearReferences(); + release_weapons_and_effects(false); +} + +// 00757ab0 Whether the player shuts the room's doors, as players do only in the deathmatch. +bool Entity_Player::CanShutDoors() +{ + return g_game->deathmatchManager.is_active(); +} + +// 00757a60 Whether the player may target an entity: not itself, its own segments, a Ring of Flies' other flies, Dark +// Esau or a Blood Puppy. +bool Entity_Player::IsValidTarget(Entity* other) +{ + if (other == this || is_same_segmented_body(other)) return false; + if (type == ENTITY_RING_OF_FLIES && other->type == ENTITY_RING_OF_FLIES) return false; + return other->type != ENTITY_DARK_ESAU && other->type != ENTITY_BLOOD_PUPPY; +} + +// 007579c0 Gives the sprite back the entity's own color. +void Entity_Player::ResetColor() +{ + sprite.color = color; +} diff --git a/src/entity_player.h b/src/entity_player.h new file mode 100644 index 0000000..24461eb --- /dev/null +++ b/src/entity_player.h @@ -0,0 +1,1219 @@ +#pragma once + +#include "entity.h" +#include "item_config.h" +#include "kage_graphics.h" +#include "online_emotes.h" +#include "temporary_effects.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +constexpr int ACTIVE_SLOT_COUNT = 4; +constexpr int BAG_OF_CRAFTING_SIZE = 8; +constexpr int CHARGE_BAR_COUNT = 7; +constexpr int COLLECTIBLE_VANILLA_COUNT = 733; +constexpr int COOP_BABY_BUFF_COUNT = 8; +constexpr int COSTUME_LAYER_COUNT = 15; +constexpr int HUD_HEART_FLASH_FRAMES = 4; +constexpr int INVENTORY_SIZE = 16; +constexpr int POCKET_SLOT_COUNT = 4; +constexpr int POOP_SPELL_QUEUE_SIZE = 6; +constexpr int TRINKET_SLOT_COUNT = 2; +constexpr int WEAPON_SLOT_COUNT = 5; +constexpr uint32_t QUEUED_GOLDEN = 0x2; +constexpr uint32_t TRINKET_GOLDEN_FLAG = 0x8000; +constexpr uint32_t TRINKET_ID_MASK = 0x7fff; +constexpr uint8_t WILD_CARD_NONE = 0xff; + +// The characters, by their ids in players.xml (Lua's PlayerType). +enum PlayerType : int +{ + PLAYER_ISAAC, + PLAYER_MAGDALENE, + PLAYER_CAIN, + PLAYER_JUDAS, + PLAYER_BLUEBABY, + PLAYER_EVE, + PLAYER_SAMSON, + PLAYER_AZAZEL, + PLAYER_LAZARUS, + PLAYER_EDEN, + PLAYER_THELOST, + PLAYER_LAZARUS2, + PLAYER_BLACKJUDAS, + PLAYER_LILITH, + PLAYER_KEEPER, + PLAYER_APOLLYON, + PLAYER_THEFORGOTTEN, + PLAYER_THESOUL, + PLAYER_BETHANY, + PLAYER_JACOB, + PLAYER_ESAU, + PLAYER_ISAAC_B, + PLAYER_MAGDALENE_B, + PLAYER_CAIN_B, + PLAYER_JUDAS_B, + PLAYER_BLUEBABY_B, + PLAYER_EVE_B, + PLAYER_SAMSON_B, + PLAYER_AZAZEL_B, + PLAYER_LAZARUS_B, + PLAYER_EDEN_B, + PLAYER_THELOST_B, + PLAYER_LILITH_B, + PLAYER_KEEPER_B, + PLAYER_APOLLYON_B, + PLAYER_THEFORGOTTEN_B, + PLAYER_BETHANY_B, + PLAYER_JACOB_B, + PLAYER_LAZARUS2_B, + PLAYER_JACOB2_B, + PLAYER_THESOUL_B +}; + +// What an Entity_Player is: a character, a co-op baby, or an extra player kept out of the room. +enum PlayerVariant : int +{ + PLAYER_VARIANT_PLAYER, + PLAYER_VARIANT_COOP_BABY, + PLAYER_VARIANT_EXTRA +}; + +// The co-op baby skins Init and the frame tell apart (Lua's BabySubType). +enum BabySubType : int +{ + BABY_BLOAT = 2, + BABY_YBAB = 7, + BABY_GLITCH = 25, + BABY_MAGNET = 26, + BABY_APOLLYON = 56, + BABY_BASIC = 71 +}; + +// How a character's health is counted (REPENTOGON's HealthType). +enum HealthType : int +{ + HEALTH_DEFAULT, + HEALTH_SOUL, + HEALTH_NO_HEALTH, + HEALTH_COIN, + HEALTH_BONE +}; + +// The kinds of heart ClampHeartsToLimit tops up, by their heart pickup subtype. +enum HeartKind : int +{ + HEART_RED = 1, + HEART_SOUL = 3, + HEART_BLACK = 6, + HEART_GOLDEN = 7, + HEART_BONE = 11, + HEART_ROTTEN = 12 +}; + +// Whether a pocket slot holds a pill, a card or an active item. +enum PocketItemType : int +{ + POCKET_PILL, + POCKET_CARD, + POCKET_ACTIVE +}; + +// The four directions a player moves, looks and shoots in, or none. +enum Direction : int +{ + DIRECTION_NONE = -1, + DIRECTION_LEFT, + DIRECTION_UP, + DIRECTION_RIGHT, + DIRECTION_DOWN +}; + +// The layers of the player's sprite, in the order its .anm2 lists them: the glow, the body, the head and the top +// layers costumes can cover. +enum PlayerSpriteLayer : int +{ + PLAYER_LAYER_GLOW, + PLAYER_LAYER_BODY, + PLAYER_LAYER_BODY0, + PLAYER_LAYER_BODY1, + PLAYER_LAYER_HEAD, + PLAYER_LAYER_HEAD0, + PLAYER_LAYER_HEAD1, + PLAYER_LAYER_HEAD2, + PLAYER_LAYER_HEAD3, + PLAYER_LAYER_HEAD4, + PLAYER_LAYER_HEAD5, + PLAYER_LAYER_TOP0, + PLAYER_LAYER_EXTRA, + PLAYER_LAYER_GHOST, + PLAYER_LAYER_BACK +}; + +// Whether an item check counts what lends the player an item (trinkets, wisps, characters) or only what it owns. +enum ItemCheck +{ + ITEM_CHECK_MODIFIED, + ITEM_CHECK_OWNED +}; + +// Whether a render pass draws the player itself or one of its after-images. +enum RenderPass +{ + RENDER_PASS_AFTER_IMAGE, + RENDER_PASS_MAIN +}; + +// The items, trinkets and null items the player's code names (Lua's CollectibleType, TrinketType, NullItemID). +enum PlayerItemId : int +{ + COLLECTIBLE_SAD_ONION = 1, + COLLECTIBLE_SPOON_BENDER = 3, + COLLECTIBLE_SKATOLE = 9, + COLLECTIBLE_COMPASS = 21, + COLLECTIBLE_TELEPORT = 44, + COLLECTIBLE_LUCKY_FOOT = 46, + COLLECTIBLE_TREASURE_MAP = 54, + COLLECTIBLE_BOOK_OF_SHADOWS = 58, + COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE = 59, + COLLECTIBLE_RELIC = 98, + COLLECTIBLE_D6 = 105, + COLLECTIBLE_WAFER = 108, + COLLECTIBLE_MONEY_EQUALS_POWER = 109, + COLLECTIBLE_GUARDIAN_ANGEL = 112, + COLLECTIBLE_DEMON_BABY = 113, + COLLECTIBLE_DEAD_BIRD = 117, + COLLECTIBLE_BRIMSTONE = 118, + COLLECTIBLE_WHORE_OF_BABYLON = 122, + COLLECTIBLE_RAZOR_BLADE = 126, + COLLECTIBLE_MOMS_PURSE = 139, + COLLECTIBLE_NOTCHED_AXE = 147, + COLLECTIBLE_MUTANT_SPIDER = 153, + COLLECTIBLE_BLOODY_LUST = 157, + COLLECTIBLE_HOLY_WATER = 178, + COLLECTIBLE_SACRED_HEART = 182, + COLLECTIBLE_3_DOLLAR_BILL = 191, + COLLECTIBLE_ANEMIC = 214, + COLLECTIBLE_CRICKETS_BODY = 224, + COLLECTIBLE_BALL_OF_TAR = 231, + COLLECTIBLE_KEY_PIECE_1 = 238, + COLLECTIBLE_KEY_PIECE_2 = 239, + COLLECTIBLE_BLUE_MAP = 246, + COLLECTIBLE_FIRE_MIND = 257, + COLLECTIBLE_MISSING_NO = 258, + COLLECTIBLE_LEECH = 270, + COLLECTIBLE_LIL_BRIMSTONE = 275, + COLLECTIBLE_DARK_BUM = 278, + COLLECTIBLE_BUTTER_BEAN = 294, + COLLECTIBLE_TAURUS = 299, + COLLECTIBLE_SCORPIO = 305, + COLLECTIBLE_HOLY_MANTLE = 313, + COLLECTIBLE_CURSED_EYE = 316, + COLLECTIBLE_UNDEFINED = 324, + COLLECTIBLE_POLAROID = 327, + COLLECTIBLE_NEGATIVE = 328, + COLLECTIBLE_SOY_MILK = 330, + COLLECTIBLE_MIND = 333, + COLLECTIBLE_WOODEN_NICKEL = 349, + COLLECTIBLE_INCUBUS = 360, + COLLECTIBLE_SWORN_PROTECTOR = 363, + COLLECTIBLE_SERAPHIM = 390, + COLLECTIBLE_ZODIAC = 392, + COLLECTIBLE_CAMBION_CONCEPTION = 412, + COLLECTIBLE_IMMACULATE_CONCEPTION = 413, + COLLECTIBLE_CROWN_OF_LIGHT = 415, + COLLECTIBLE_SUCCUBUS = 417, + COLLECTIBLE_GLOWING_HOUR_GLASS = 422, + COLLECTIBLE_MOMS_BOX = 439, + COLLECTIBLE_KIDNEY_STONE = 440, + COLLECTIBLE_DARK_PRINCES_CROWN = 442, + COLLECTIBLE_BELLY_BUTTON = 458, + COLLECTIBLE_WAIT_WHAT = 484, + COLLECTIBLE_METRONOME = 488, + COLLECTIBLE_DEEP_POCKETS = 416, + COLLECTIBLE_GREEDS_GULLET = 501, + COLLECTIBLE_SCHOOLBAG = 534, + COLLECTIBLE_DREAM_CATCHER = 566, + COLLECTIBLE_PLAYDOUGH_COOKIE = 570, + COLLECTIBLE_RED_KEY = 580, + COLLECTIBLE_BOOK_OF_VIRTUES = 584, + COLLECTIBLE_ALABASTER_BOX = 585, + COLLECTIBLE_SOL = 588, + COLLECTIBLE_LUNA = 589, + COLLECTIBLE_URANUS = 596, + COLLECTIBLE_BIRTHRIGHT = 619, + COLLECTIBLE_ERASER = 638, + COLLECTIBLE_VASCULITIS = 657, + COLLECTIBLE_STRAW_MAN = 667, + COLLECTIBLE_REDEMPTION = 673, + COLLECTIBLE_EMPTY_HEART = 676, + COLLECTIBLE_LIL_ABADDON = 679, + COLLECTIBLE_HEARTBREAK = 694, + COLLECTIBLE_BLOODY_GUST = 695, + COLLECTIBLE_SALVATION = 696, + COLLECTIBLE_TWISTED_PAIR = 698, + + COLLECTIBLE_MY_LITTLE_UNICORN = 77, + COLLECTIBLE_GAMEKID = 93, + COLLECTIBLE_GUILLOTINE = 206, + COLLECTIBLE_UNICORN_STUMP = 298, + COLLECTIBLE_SCISSORS = 325, + COLLECTIBLE_MY_SHADOW = 433, + COLLECTIBLE_CAMO_UNDIES = 497, + COLLECTIBLE_MARS = 593, + COLLECTIBLE_JUPITER = 594, + COLLECTIBLE_MEGA_MUSH = 625, + COLLECTIBLE_MONTEZUMAS_REVENGE = 680, + COLLECTIBLE_DECAP_ATTACK = 729, + TRINKET_PAPER_CLIP = 19, + TRINKET_MYSTERIOUS_PAPER = 21, + TRINKET_MISSING_POSTER = 23, + TRINKET_BUTT_PENNY = 24, + TRINKET_CHILDS_HEART = 34, + TRINKET_CURSED_SKULL = 43, + TRINKET_MISSING_PAGE = 48, + TRINKET_MAGGYS_FAITH = 55, + TRINKET_CAINS_EYE = 59, + TRINKET_RAINBOW_WORM = 64, + TRINKET_ERROR = 75, + TRINKET_FADED_POLAROID = 69, + TRINKET_LIL_LARVA = 86, + TRINKET_USED_DIAPER = 93, + TRINKET_STORE_KEY = 83, + TRINKET_TONSIL = 97, + TRINKET_DUCT_TAPE = 109, + TRINKET_STEM_CELL = 119, + TRINKET_WOODEN_CROSS = 121, + TRINKET_BUTTER = 122, + TRINKET_BETHS_FAITH = 142, + TRINKET_MOTHERS_KISS = 156, + TRINKET_LUCKY_SACK = 160, + TRINKET_HOLLOW_HEART = 168, + TRINKET_FOUND_SOUL = 180, + + NULLITEM_BLINDFOLD = 14, + NULLITEM_BLANKFACE = 15, + NULLITEM_CHRISTMAS = 16, + NULLITEM_SPIN_TO_WIN = 50, + NULLITEM_INTRUDER = 55, + NULLITEM_REVERSE_CHARIOT = 63, + NULLITEM_REVERSE_SUN = 66, + NULLITEM_LUNA = 74, + NULLITEM_SPIRIT_SHACKLES_DISABLED = 102, + NULLITEM_FORGOTTEN_BOMB = 106, + NULLITEM_JACOBS_CURSE = 109, + NULLITEM_LOST_CURSE = 112, + NULLITEM_SOUL_FORGOTTEN = 120, + NULLITEM_SOUL_JACOB = 121, + NULLITEM_JUDAS_BIRTHRIGHT_STAGE = 129, + + PILLEFFECT_TELEPILLS = 19 +}; + +// The unlocks the player's code checks or grants (Lua's Achievement). +enum PlayerAchievement : int +{ + ACHIEVEMENT_MAGDALENE = 1, + ACHIEVEMENT_CAIN = 2, + ACHIEVEMENT_ISAAC_HOLDS_THE_D6 = 29, + ACHIEVEMENT_LAZARUS = 80, + ACHIEVEMENT_KEEPER_HOLDS_A_PENNY = 191, + ACHIEVEMENT_KEEPER_HOLDS_WOODEN_NICKEL = 236, + ACHIEVEMENT_KEEPER_HOLDS_STORE_KEY = 237, + ACHIEVEMENT_CAIN_HOLDS_PAPERCLIP = 245, + ACHIEVEMENT_EVE_HOLDS_RAZOR_BLADE = 248, + ACHIEVEMENT_LOST_HOLDS_HOLY_MANTLE = 250, + ACHIEVEMENT_LAZARUS_HOLDS_ANEMIA = 331, + ACHIEVEMENT_MAGDALENE_HOLDS_A_PILL = 332, + ACHIEVEMENT_SAMSON_HOLDS_CHILDS_HEART = 334, + ACHIEVEMENT_GOLDEN_RAZOR = 583 +}; + +// The challenges the player's code tells apart (Lua's Challenge). +enum PlayerChallenge : int +{ + CHALLENGE_HAVE_A_HEART = 25, + CHALLENGE_GUARDIAN = 30, + CHALLENGE_BACKASSWARDS = 31, + CHALLENGE_BLOODY_MARY = 37, + CHALLENGE_BAPTISM_BY_FIRE = 38, + CHALLENGE_PICA_RUN = 41, + CHALLENGE_HOT_POTATO = 42, + CHALLENGE_CANTRIPPED = 43, + CHALLENGE_RED_REDEMPTION = 44 +}; + +// One active item slot: the item, its charges and the data it keeps between uses. +struct ActiveItemDesc +{ + int batteryCharge = 0; + int charge = 0; + int item = 0; + int partialCharge = 0; + int subCharge = 0; + int timeRechargeCooldown = 0; + int unknown = 0; + int varData = 0; +}; + +// A card, pill or pocket active in a pocket slot. +struct PocketItem +{ + int id = 0; + PocketItemType type = POCKET_CARD; +}; + +// The item a player holds over its head, picked up and not yet added. +struct QueueItemData +{ + ItemConfig_Item* item = nullptr; + int charge = 0; + uint32_t flags = 0; + int varData = 0; +}; + +// Which costume sprite draws a layer of the player's sprite, or -1 for the player's own. +struct PlayerCostumeMap +{ + int index = -1; + int layerId = -1; + int priority = 0; + bool isBodyLayer = false; +}; + +// A costume worn by the player: the item's sprite and how it draws over the player. +struct CostumeSpriteDesc +{ + ANM2 sprite; + ItemConfig_Item* item = nullptr; + int defaultSkinColor = -1; + int playerType = 0; + int priority = 0; + int skinColor = -1; + bool isFlying = false; + bool isHasOverlay = false; + bool isHasSkinAlt = false; + bool isItemAnimPlay = false; + bool isItemStateOnly = false; + bool isOverwriteColor = false; +}; + +// The copies of a trinket smelted into the player, plain and golden. +struct SmeltedTrinket +{ + short count = 0; + short goldenCount = 0; +}; + +// One item picked up, as the history keeps it for the HUD and Tainted Isaac's inventory. +struct HistoryItem +{ + int time = 0; + bool isTrinket = false; + int id = 0; + int levelStage = 0; + int stageType = 0; + int roomType = 0; + int itemPoolType = 0; +}; + +// The items a player picked up, in pickup order. +struct History +{ + std::vector historyItems; + Entity_Player* player = nullptr; + bool isLocked = false; + + void AddHistoryItem(const HistoryItem& item); + bool RemoveHistoryItemByIndex(int index); + void merge(History& other); + void remove_index_refs(int index); +}; + +// Coins, keys, bombs and charges, as Curse of the Mist keeps them aside. +struct ConsumableData +{ + int bloodCharges = 0; + int bombs = 0; + int coins = 0; + int gigaBombs = 0; + int keys = 0; + int poopMana = 0; + int soulCharges = 0; + bool isGoldenBomb = false; + bool isGoldenKey = false; +}; + +// The enemy Friendly Ball caught, to throw back out as a friend. +struct EntityDesc +{ + float health = 0; + float maxHealth = 0; + uint32_t subtype = 0; + uint32_t type = 0; + uint32_t variant = 0; + int championId = -1; + bool isPlayerControlled = false; +}; + +RNG rng_make(uint32_t seed, uint32_t shiftIndex); +bool is_run_unlocked(int achievement); +int scale_for_hard_difficulty(int value); +std::string costume_path_apply_skin_color(const std::string& path, int skinColor, int playerType, + bool* isSkinColorFound, bool* isCharacterFound); +void sound_play(int sound); + +// Destruction (00754ed0, 00754d60) unlinks the twin and frees a sub player the room does not hold. +// Field getters (00417820, 00423950, 004253b0, 00428b10, 0042a310, 0042a320, 004316d0, 004316e0, 004316f0, 00436170, +// 00436180, 004361a0, 004361b0, 004361c0, 00499dd0, 004e4860, 005b1700, 005b1710, 005b1740, 005b1750, 005b1760, +// 005b1770, 005cd740, 005cd7d0, 0060d050, 0060d080, 0065cf20, 0065cf30, 0065cf40, 0065cf50, 00665c10, 006b84a0, +// 006dad10, 006dad20, 006dad30, 006dad60, 006dad70, 006dae00, 006dae10, 00753930, 007539f0, 00753c20, 00753c30, +// 007e92a0, 0083ab80, 00841ca0, 0085e220, 0085e230, 0085e240, 0085e250, 0085e270, 0085e290, 0085e2c0, 0085e2d0, +// 0085e2e0, 0085e2f0) are the public fields. +// A player (Lua's EntityPlayer): a character, a co-op baby or an extra player, with its health, consumables, items, +// costumes, stats and the sprites it draws over its own. +struct Entity_Player : Entity +{ +public: + ANM2 bloodGushSprite; + ANM2 bodySprite; + ANM2 crownOfLightSprite; + ANM2 darkPrincesCrownSprite; + ANM2 heldSprite; + ANM2 statusEffectSprite; + std::array chargeBarSprites; + std::vector costumeSpriteDescs; + std::array playerCostumeMap{}; + KAGE::Graphics::ImagePtr shadowImage; + OnlineEmotes emotes; + std::string headAnim; + std::string name; + std::string queuedExtraAnimation; + ColorMod colorOverride = COLOR_DEFAULT; + ColorMod footprintColor1 = COLOR_DEFAULT; + ColorMod footprintColor2 = COLOR_DEFAULT; + Vector bodyScale{}; + Vector headScale{}; + Vector playerSpriteScale{}; + int blinkTime = 0; + int bodyColor = 0; + int headColor = 0; + int headDirectionTime = 0; + bool isPlayingExtraAnimation = false; + bool isPlayingItemAnimation = false; + + int blackHearts = 0; + int boneHearts = 0; + int boneHeartsMask = 0; + int brokenHearts = 0; + int effectiveBloodCharge = 0; + int effectiveSoulCharge = 0; + int eternalHearts = 0; + int goldenHearts = 0; + int jarHearts = 0; + int maxHearts = 0; + int redHearts = 0; + int rottenHearts = 0; + int soulHearts = 0; + short greedsGulletHearts = 0; + short greedsGulletOverflow = 0; + short greedsGulletRedHearts = 0; + bool isUpdatingGreedsGullet = false; + + ConsumableData consumablesBackup; + int jarFlies = 0; + int numBlueFlies = 0; + int numBlueSpiders = 0; + int numBombs = 0; + int numCoins = 0; + int numGigaBombs = 0; + int numKeys = 0; + int poopMana = 0; + uint32_t urnSouls = 0; + bool hasGoldenBomb = false; + bool hasGoldenKey = false; + + TearFlags tearFlags; + ColorMod laserColor = COLOR_DEFAULT; + ColorMod tearColor = COLOR_DEFAULT; + float d8DamageModifier = 1; + float d8FireDelayModifier = 1; + float d8RangeModifier = 1; + float d8SpeedModifier = 1; + float damage = 3.5f; + float edenDamage = 0; + float edenFireDelay = 0; + float edenLuck = 0; + float edenShotSpeed = 0; + float edenSpeed = 0; + float edenTearRange = 0; + float luck = 0; + float maxFireDelay = 10; + float meleeDamage = 3.5f; + float moveSpeed = 1; + float rockBottomDamage = 0; + float rockBottomLuck = 0; + float rockBottomMaxFireDelay = 0; + float rockBottomMoveSpeed = 0; + float rockBottomShotSpeed = 0; + float rockBottomTearRange = 0; + float shotSpeed = 1; + float taurusSpeedBonus = 0; + float tearFallingAcceleration = 0; + float tearFallingSpeed = 0; + float tearHeight = 0; + float tearRange = 0; + uint32_t cacheFlags = 0; + int damageModifier = 0; + int donateLuck = 0; + int fireDelayModifier = 0; + int firedTearCount = 0; + int luckModifier = 0; + int shotSpeedModifier = 0; + int speedModifier = 0; + int tearRangeModifier = 0; + int8_t tearDisplacement = 1; + bool canFly = false; + + TemporaryEffects temporaryEffects; + History history; + std::array inventory{}; + std::vector collectibleCounts; + std::vector extraCollectibleCounts; + std::vector extraTrinketCounts; + std::vector greedResetCollectibles; + std::vector itemCards; + std::vector levelEffectItems; + std::vector pillEffectUses; + std::vector voidedCollectibles; + std::vector voidedPassives; + std::vector smeltedTrinkets; + std::vector cardRNGs; + std::vector collectibleRNGs; + std::vector pillRNGs; + std::vector trinketRNGs; + std::vector movingBoxContents; + std::map itemWispsList; + std::map proceduralItems; + std::map roomTemporaryCollectibles; + std::array playerForms{}; + std::array trinkets{}; + uint32_t grantedCollectibleFlags = 0; + uint32_t playerFormsRewarded = 0; + int grantedCollectibleCountdown = 0; + int metronomeCollectibleId = 0; + int modelingClayEffect = 0; + int threeDollarBillItem = 0; + + std::array activeItems{}; + std::array curseMistPocketItems{}; + std::array ghostPocketItems{}; + std::array pocketItems{}; + std::array curseMistTrinkets{}; + std::array ghostTrinkets{}; + std::array bagOfCraftingContent{}; + std::array poopSpellQueue{}; + QueueItemData queuedItem; + int bagOfCraftingHoldFrames = 0; + int extensionCordIndex = -1; + int itemHoldCooldown = 0; + int itemState = 0; + int itemStateCooldown = 0; + int wildCardItem = 0; + int wildCardVarData = 0; + uint8_t wildCardItemType = WILD_CARD_NONE; + bool isHeldItemVisible = false; + + std::array weapons{}; + Vector aimDirection{}; + Vector lastDirection{}; + Vector lastVelocity{}; + Vector moveToTarget{}; + Vector movementVector{}; + Vector recentMovementVector{}; + Vector tearsOffset{}; + float bodyAngle = 0; + float heightVelocity = 0; + int actionHoldDrop = 0; + int bombPlaceDelay = 0; + int controllerIndex = -1; + int controlsCooldown = 0; + int fireBlockCooldown = 0; + int glowingHourglassIndex = -1; + int lastActionTriggers = 0; + int playerIndex = -1; + int slipperyTimer = 0; + int tractorBeam = 0; + Direction fireDirection = DIRECTION_NONE; + Direction headDirection = DIRECTION_DOWN; + Direction moveDirection = DIRECTION_NONE; + bool areOpposingShootDirectionsPressed = false; + bool canShoot = true; + bool isControlsEnabled = true; + + EntityRef lastDamageSource; + uint64_t lastDamageFlags = 0; + int damageCooldown = 0; + int flashCountdown = 0; + int lastDamageSourceVariant = 0; + int lastDamageSpawnerType = 0; + int lastDamageSpawnerVariant = 0; + int roomDamageTaken = 0; + int totalDamageTaken = 0; + uint8_t holyMantleStacks = 0; + uint8_t holyMantleState = 0; + bool isHurtPending = false; + + std::shared_ptr playerHUD; + std::vector contactHitList; + std::vector darkArtsHitList; + std::vector curseMistFamiliars; + std::vector pendingWisps; + std::deque echoChamberItems; + EntityDesc friendBallEnemy; + EntityPtr astralProjectionBody; + EntityPtr babyFamiliar; + EntityPtr breathOfLifeEffect; + EntityPtr darkEsau; + EntityPtr salvationEffect; + EntityPtr tetheredEffect; + EntityPtr twinPlayer; + Entity_Player* backupPlayer = nullptr; + Entity_Player* replacedPlayer = nullptr; + Entity_Player* subPlayer = nullptr; + Entity* darkArtsLastSnare = nullptr; + Entity* heldEntity = nullptr; + Entity* montezumaLaser = nullptr; + Entity_Effect* markedTarget = nullptr; + Entity_Familiar* forgottenBody = nullptr; + Entity_Laser* megaBlastLaser = nullptr; + Vector forgottenBodyPos{}; + Vector minecartOffset{}; + Vector suplexLandPos{}; + Vector suplexTargetPos{}; + int babySkin = -1; + int forgottenBodyRoomIdx = 0; + int heldEntityCollisionClass = 0; + int heldEntityGridCollisionClass = 0; + int playerType = PLAYER_ISAAC; + int suplexAimCountdown = 0; + int suplexState = 0; + bool hasBabyRoomShield = false; + bool hasCurseMistEffect = false; + bool isCoopGhost = false; + bool isGlitchBaby = false; + bool isHeldEntityVisible = false; + + std::array coopBabyBuffTimers{}; + float darkArtsDamage = 0; + float delayedSfxVolume = 0; + float forgottenBHeight = 0; + float forgottenBHeightVelocity = 0; + float ibsCharge = 0; + float jellyBellyBounceTimer = 0; + float jupiterCharge = 0; + uint32_t conceptionFamiliarFlags = 0; + uint32_t deadEyeCharges = 0; + uint32_t deadEyeMisses = 0; + uint32_t imExcitedSpeedupCountdown = 0; + uint32_t maggyHealthDrainCooldown = 0; + uint32_t mawOfTheVoidChargeTimer = 0; + uint32_t montezumaChargeTimer = 0; + uint32_t revelationChargeTimer = 0; + uint32_t vampireCharmKills = 0; + int bladderCharge = 0; + int bleedOutHealth = 0; + int cambionConceptionState = 0; + int cursedPennyPending = 0; + int curseMistRedHearts = 0; + int delayedSfxDelay = 0; + int delayedSfxFrameDelay = 0; + int delayedSfxId = 0; + int ductTapeMode = 0; + int epiphoraCharge = 0; + int eveSumptoriumCharge = 0; + int forgottenSwapFormCooldown = 0; + int gnawedLeafTimer = 0; + int hallowedGroundCountdown = 0; + int immaculateConceptionState = 0; + int keepersSackBonus = 0; + int maggySwingCooldown = 0; + int marsCooldown = 0; + int marsDashCooldown = 90; + int marsDashDirection = -1; + int marsLastTapDirection = 0; + int marsTapFrames = 0; + int maxBladderCharge = 0; + int maxPeeBurstCooldown = 0; + int megaBlastDuration = 0; + int monkeyPawCounter = 0; + int nextUrethraBlockFrame = 0; + int paperClipTimer = 0; + int peeBurstCooldown = 0; + int planCKillCountdown = 0; + int poisonDamageFrames = 0; + int ponyCharge = 0; + int potatoPeelerBandageCounter = 0; + int potatoPeelerCounter = 0; + int purityState = 0; + int rUaWizardTimer = 0; + int redStewBonusDuration = 0; + int reverseChariotMoveCooldown = 0; + int reverseEmpressMaxHearts = 0; + int reverseSunBoneHearts = 0; + int samsonBerserkCharge = 0; + int strengthMaxHearts = 0; + short bloodLustCounter = 0; + short brittleBonesUpgrades = 0; + short damageMultiplierStacks = 0; + short deadCatLives = 0; + short lastDamageMultiplierStacks = 0; + short numLeprosy = 0; + short tonsilCount = 0; + short tonsilCounter = 0; + bool isBrokenRemotePending = false; + bool isDarkArtsBlastPending = false; + bool isLevelStartPending = false; + bool isMarsDashReady = true; + bool isPostLevelInitFinished = false; + bool isUrethraBlocked = false; + // Set while EvaluateItems spawns the players Found Soul and Strawman give, who start without pickups. + static inline bool isSpawningHelperPlayers = false; + + Entity_Player(); + ~Entity_Player() override; + + // The start of a run and of a floor. + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void InitPreLevelInitStats(); + void InitPostLevelInitStats(); + void level_start(bool isForced); + void SetControllerIndex(int index, bool isIncludePlayerOwned); + void UpdateCanShoot(); + void update_player_skin(); + void UpdateCostumes(); + void RemoveCostume(ItemConfig_Item* item); + void ClearCostumes(); + Entity_Player* GetMainTwin(); + Entity_Player* GetMainPlayer(); + Entity_Player* twin_get() { return twinPlayer ? twinPlayer->ToPlayer() : nullptr; } + + // Items. + bool HasCollectible(int type, ItemCheck check = ITEM_CHECK_MODIFIED); + bool HasTrinket(uint32_t type, ItemCheck check = ITEM_CHECK_MODIFIED); + int GetCollectibleNum(int collectibleId, ItemCheck check = ITEM_CHECK_MODIFIED); + int GetTrinketMultiplier(uint32_t type); + bool IsInnateCollectible(int collectibleId); + void apply_innate_collectibles(); + int GetActiveItemSlot(int id); + int get_seeded_variant(); + int g_fuel_count(); + void EvaluateItems(); + void AddCacheFlags(uint32_t flags); + RNG& GetCollectibleRNG(int id); + RNG& GetTrinketRNG(int id); + static int GetBombVariant() { return 0; } + + // Health and consumables. + HealthType GetHealthType(); + int GetHeartLimit(bool isKeeperBypass); + int GetEffectiveMaxHearts(); + int GetGreedsGulletHearts(); + void AddMaxHearts(int amount, bool isIgnoreKeeper); + void AddHearts(int hearts, bool isUnknown, bool isUnknown2); + void AddSoulHearts(int amount, bool isUnknown); + void AddBlackHearts(int amount); + void AddBrokenHearts(int amount); + void AddCoins(int amount); + void AddBombs(int amount); + void AddKeys(int amount); + void ConsumableCountChanged(int bitflags); + void SyncConsumables(Entity_Player* target, uint32_t mask); + void UpdateBlackHeartMask(); + void UpdateHeartDependentEffects(); + void ClampGoldenHearts(bool isSkipBreak); + void ClampHeartsToLimit(HeartKind kind, int amount); + void update_bone_hearts(); + void update_greeds_gullet(); + bool is_dead_bird_kept(); + + // The frame. + void Update() override; + void Render(const Vector& offset) override; + bool RenderShadowLayer(const Vector& offset) override; + void render_pass(const Vector& offset, RenderPass pass); + void RenderGlow(const Vector& position); + void RenderBody(const Vector& position); + void RenderHead(const Vector& position); + void RenderTop(const Vector& position); + void update_body_animations(); + Vector GetMovementJoystick(); + Vector GetShootingJoystick(); + Vector GetFlyingOffset(); + bool IsFullSpriteRendering(); + bool IsExtraAnimationFinished(); + bool IsHeadless(); + bool IsHoldingItem(); + bool IsHologram(); + bool IsInvisible(); + Vector GetBodyMoveDirection(); + + void ClearReferences() override; + bool CanShutDoors() override; + bool IsValidTarget(Entity* other) override; + void ResetColor() override; + + // Not reconstructed yet: each stops the game with reconstruction_missing when reached. + bool TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown) override; + bool TryThrow(const EntityRef& source, const Vector& velocity, float height) override; + bool HandleCollision(Entity* collider, bool isLow) override; + void AddCollectible(int type, int charge, bool isFirstTime, int activeSlot, int varData); + void AddActiveCharge(int charge, int slot, bool isFlashHud, bool isOvercharge, bool isForce); + void RemoveCollectible(int type, bool isIgnoreModifiers, int activeSlot, bool isRemoveFromForm); + Entity_Familiar* AddWisp(int collectible, Vector position, bool isAdjustOrbitLayer, bool isDontUpdate); + void StoreGameState(GameStatePlayer* state, bool isSaveTemporaryFamiliars); + void PlayCollectibleAnim(int collectible, bool isCheckBodyLayers, std::string_view animation, int frame); + void PlayExtraAnimation(std::string_view animation, bool isUnknown); + void UseActiveItem(int item, uint32_t useFlags, int slot); + void trigger_collectible_effect_removed(ItemConfig_Item* item, int count); + +private: + void stats_reset(); + void tear_stats_reset(); + void sprites_load(); + void links_reset(); + void eden_stats_roll(RNG& rng); + std::optional collectible_lent(int collectibleType, ItemConfig_Item& item); + std::optional trinket_lent(uint32_t id, int multiplier); + int trinket_bonus(uint32_t id, int multiplier); + int extra_collectible_count(int collectibleId); + int conception_count(int collectibleId); + bool is_granted(int collectibleId); + Entity_Player* health_owner(); + void red_hearts_add(int hearts, bool isUnknown2); + int soul_hearts_absorb(int amount); + void soul_hearts_add(int amount, bool isUnknown); + void black_hearts_add(int amount); + void hud_heart_flash(); + void starting_collectible_add(int id); + void starting_trinket_add(int id); + void companions_init(); + void jacobs_curse_add(); + void start_position_set(); + void level_items_apply(bool isForced); + void floor_maps_apply(); + void floor_items_recharge(); + void stem_cell_heal(); + void backasswards_penalty(); + void floor_rngs_reseed(); + void wooden_cross_mantles_add(); + void player_color_reassign(int index); + void costume_map_reset(int priority); + Vector walk_direction_update(Vector input); + void walk_velocity_update(Vector walkInput); + bool walking_items_has(); + void walk_animation_update(); + void head_animation_update(); + void render_back(const Vector& position); + ANM2& layer_sprite(int layer); + int layer_id(int layer); + static bool is_body_layer(int layer); + bool is_evaluation_plain(); + +public: + int GetBatteryCharge(int slot); + void SetMinDamageCooldown(int cooldown); + int GetActiveItem(int slot); + bool AreControlsEnabled(); + bool IsItemQueueEmpty(); + void StopExtraAnimation(); + bool HasWeaponType(int weaponType); + void moms_bracelet_grab(); + void UseRedKey(); + void use_card_hagalaz(RNG* rng); + int reroll_collectibles_on_damage(RNG* rng, bool isIncludeActives); + Entity_Familiar* AddItemWisp(int collectibleId, Vector position, bool isAdjustOrbitLayer); + void trigger_book_of_belial_passive(int activeId, int charges); + void TriggerBookOfVirtues(int collectibleId, int charge); + void console_spawn(int* spawnSpec, bool isAddWisp); + void update_mini_mush_costume(); + void ResetDamageCooldown(); + Vector SpriteScale(); + bool IsP2Appearing(); + ColorMod get_laser_color_copy(); + uint32_t get_grid_collision_at(Vector position); + bool HasFullHearts(); + void set_last_damage(uint64_t damageFlags, const EntityRef& source); + void SetSoulCharge(int amount); + void SetBloodCharge(int amount); + PocketItem& GetPocketItem(int slot); + void EnableWeaponType(int weaponType, bool isSet); + void QueueExtraAnimation(std::string_view animName); + RNG& GetPillRNG(int pillEffect); + RNG& GetCardRNG(int cardId); + uint32_t IsSubPlayer(); + void release_weapons_and_effects(bool isRemoveEntities); + uint32_t InvalidateCoPlayerItems(); + void cycle_spectate_target(); + void trigger_max_hearts_removed(int removed); + void AddEternalHearts(int amount); + void RemoveBlackHeart(int soulHeartIndex); + bool IsBlackHeart(int heart); + void AddJarHearts(int amount); + void AddGoldenKey(); + void RemoveGoldenKey(); + void restore_curse_mist_backup(int* backup); + Entity* AddBlueFlies(int amount, Vector pos, Entity* target); + void RemoveBlueFly(); + void AddLeprosy(); + Entity* AddBoneOrbital(Vector position); + Entity* AddSwarmFlyOrbital(Vector position); + bool TryUseKey(); + void AddCostume(ItemConfig_Item* item, bool isItemStateOnly); + void AddNullCostume(int costumeid); + bool IsNullItemCostumeVisible(int nullItemID, int playerSpriteLayerID); + void ClearQueueItem(); + bool FlushQueueItem(); + void IncrementPlayerFormCounter(int ePlayerForm, int num); + void AddPlayerFormCostume(int playerForm); + void SetItemState(int collectibleId); + void render_charge_bars(Vector renderPos); + int GetCollectibleCount(); + void RespawnFamiliars(); + void GetNPCTarget(); + bool VoidHasCollectible(int id); + bool HasGoldenTrinket(uint32_t trinketId); + bool TryHoldTrinket(int trinketId); + int GetMaxTrinkets(); + Entity_Pickup* DropTrinket(Vector position, bool isReplaceTick); + void AddTrinket(int type, bool isFirstTime); + bool TryRemoveTrinket(uint32_t id); + bool TryRemoveSmeltedTrinket(uint32_t id); + bool replace_trinket(); + void SetFullHearts(); + Entity* GetFocusEntity(); + int GetWeaponModifiers(); + void update_shooting(); + TearFlags GetBombFlags(bool isRollChances); + TearFlags check_bomb_tearflags(const TearFlags& tearFlags); + void update_bomb_input(); + void trigger_fire_item_effects(Vector direction, bool isShotFired); + const char* GetDeathAnimName(); + Entity* GetActiveWeaponEntity(); + uint32_t CanTurnHead(); + float FireDelay(); + void RemoveCollectibleByHistoryIndex(int index, bool isRemoved); + void TriggerCollectibleRemoved(int collectibleId); + void ClearTemporaryEffects(); + int GetTotalActiveCharge(int slot); + int GetCollectibleMaxCharge(int collectibleId, int varData); + int GetActiveMaxCharge(int slot); + void SetActiveCharge(int charge, int slot); + void SetActiveVarData(int vardata, int slot); + void ControlActiveItem(int slot); + bool HasTimedItem(); + void update_effects(); + void update_ladder(); + void trigger_npc_death(Entity* npc); + Entity_Bomb* FireBomb(Vector pos, Vector vel, Entity* source); + bool TriggerDeath(bool isCheckOnly); + void Revive(); + void ReviveFromTrinket(uint32_t trinketId); + void remove_twin(); + void AddPocketItem(int id, uint32_t pocketItemType); + void AddCard(int card); + void AddPill(int pillColor); + int GetCard(int slot); + int GetPill(int slot); + void SetCard(int slot, int card); + void SetPill(int slot, int pillColor); + void pocket_use_input(); + void pockets_rotate(); + void SwapActiveItems(); + void RemovePocketItem(int slot); + void DropPocketItem(int slot, Vector pos); + void spawn_low_health_blood_splat(); + void ShootCandle(Vector direction); + int GetTrinket(uint32_t slot); + void room_exit(bool isKeepHolyMantle); + void room_enter(); + void TriggerNewRoom_TemporaryEffects(); + void TriggerRoomClear(); + bool HasPlayerForm(int playerForm); + bool CanAddCollectible(int collectibleId); + void AnimatePickup(ANM2* sprite, bool isHideShadow, std::string_view animName); + void AnimateCollectible(int collectibleId, std::string_view animName, std::string_view spriteAnimName); + void AnimateTrinket(int trinketId, std::string_view animName, std::string_view spriteAnimName); + void AnimateCard(int cardId, std::string_view animName); + void AnimatePill(int pillColor, std::string_view animName); + void AnimateTrapdoor(); + void AnimateLightTravel(); + void AnimatePitfallIn(bool isIgnoreEffect); + void AnimatePitfallOut(); + void AnimateAppear(); + void AnimateTeleport(bool isUp); + void AnimateHappy(); + void AnimateSad(); + void AddPrettyFly(); + void PlayExtraAnimation(std::string_view animName); + void active_used_post(int slot, bool unk, int chargeBeforeUse); + void DischargeActiveItem(uint32_t slot, bool isUnknown); + void TryRemoveTrinketCostume(int trinketId); + void TryRemoveNullCostume(int nullItemId); + uint32_t GetMaxPocketItems(); + void stop_costume_item_anims(); + void ClearCollectibleAnim(int collectible); + bool IsCollectibleAnimFinished(int collectible, std::string_view animName); + void TriggerTrinketAdded(uint32_t trinketId, bool isFirstTime); + void TriggerTrinketRemoved(uint32_t trinketId); + void RestoreGameState(GameStatePlayer* saveState); + bool try_trigger_astral_projection(); + void spawn_dark_esau(void* gameStatePlayer); + void DonateLuck(int luck); + void UseCard(int cardType, uint32_t useFlag); + void update_footprints(); + void SetFootprintColor(KColor color, bool isUnknown); + bool is_footstep_triggered(int foot); + void update_pitfall(); + void TryDecreaseGlowingHourglassUses(int unk1, bool isUnknown2); + bool GetMouseAimTarget(Vector& outTarget, bool isSkipNetCursor); + void update_baby_skin_effects(); + void coop_baby_death_effect(); + void InitBabySkin(); + Entity_Laser* FireDelayedBrimstone(float angle, Entity* parent); + bool CanPickupItem(); + bool IsHeldItemVisible(); + void AddBlueSpider(Vector position); + Entity_Familiar* ThrowBlueSpider(Vector position, Vector target); + void RemoveBlueSpider(); + int GetExtraLives(); + uint32_t GetGlitchBabySubType(); + bool HasInvincibility(uint64_t damageFlags, const EntityRef& source); + bool HasPoisonImmunity(); + bool CanCrushRocks(); + bool CanPickRedHearts(); + bool CanPickSoulHearts(); + bool CanPickBlackHearts(); + void RemoveSkinCostume(); + void ResetItemState(); + void SetShootingCooldown(int cooldown); + bool NeedsCharge(int slot); + bool FullCharge(int slot, bool isForce, bool isOvercharge); + void add_random_stat_up(RNG* rng); + void preload_item_sounds(); + bool CanUsePill(int pillEffect); + void UsePill(int pillEffect, int pillColor, uint32_t useFlags); + void AddDeadEyeCharge(); + void ClearDeadEyeCharge(); + int GetZodiacEffect(); + void update_purity_glow(); + void trigger_immaculate_conception(bool isCambion); + void AddImmaculateConceptionCounter(int amount); + void dash_impact(); + void spawn_locusts(); + Entity_Laser* SpawnMawOfVoid(int timeout); + void AddGoldenBomb(); + void RemoveGoldenBomb(); + void AddDollarBillEffect(); + int GetCambionPregnancyLevel(); + Entity* ShootRedCandle(Vector dir); + Entity* ShootBlueCandle(Vector dir); + void DoZitEffect(Vector direction); + void apply_victory_lap_penalty(uint32_t laps); + float get_voice_pitch(); + void AddJarFlies(int amount); + bool IsPosInSpotLight(Vector position); + void AddGoldenHearts(int amount, bool retBool); + bool CanPickGoldenHearts(); + void BreakGoldenHearts(int count); + void AddBoneHearts(int amount); + bool CanPickBoneHearts(); + bool IsBoneHeart(int heart); + bool TryPreventDeath(); + void apply_coop_baby_spawn_bonus(); + bool WillPlayerRevive(); + float GetGreedDonationBreakChance(); + float GetGreedDonationJamChance(PersistentGameData& data); + void hallowed_ground_add(int count); + void resolve_tainted_soul(); + void init_forgotten_twin(); + Entity* spawn_forgotten_body(); + bool SwapForgottenForm(bool isForce, bool isNoEffects); + bool CanRerollCollectible(int id, bool isUnknown); + void ChangePlayerType(int playerType, bool isUnknown); + void player_type_change_prepare(int newPlayerType); + bool IsLocalPlayer(); + void GetGlyphOfBalanceDrop(int* variant, int* subtype); + Vector GetEnterPosition(); + Entity_Familiar* AddMinisaac(Vector position, bool isPlayAnim); + uint32_t play_hurt_effects(); + Entity_Player* InitTwin(int playerType); + bool TryHoldEntity(Entity* entity); + Entity* ThrowHeldEntity(Vector Velocity); + void AddFriendlyDip(int subtype, Vector position); + void ThrowFriendlyDip(int subtype, Vector position, Vector target); + void AddSoulCharge(int count); + int GetEffectiveSoulCharge(); + void apply_soul_charge_to_actives(int oldSoulCharge); + void AddBloodCharge(int amount); + int GetEffectiveBloodCharge(); + void blood_charge_changed(int oldBloodCharge); + void AddRottenHearts(int amount, bool isUnknown); + bool CanPickRottenHearts(); + void UpdateBookOfVirtues(bool isAdded); + void trigger_vampire_charm_kill(); + void AddUrnSouls(uint32_t amount); + void AddGigaBombs(int amount); + bool try_end_astral_projection(); + void fire_saturnus_tears(); + int GetMaxInventorySize(); + bool CanAddCollectibleToInventory(int id); + void SetPocketActiveItem(int collectible, int slot, bool keepInPools); + void get_salvation_scale(); + void update_suplex(); + uint32_t bag_of_crafting_collect(Entity_Pickup* pickup); + static int GetMaxPoopMana(); + void AddPoopMana(int amount); + void poop_spell_roll(); + void UsePoopSpell(uint32_t spell); + void RecomputeWispCollectibles(Entity_Familiar* wisp); + void trigger_cracked_orb(Vector effectPos); + uint32_t AddItemCard(uint32_t itemID); + void spawn_lil_clot_familiars(); + void creep_contact_add(int flags, int count); + bool spawn_ghost_corpse(); + void AddCurseMistEffect(); + void RemoveCurseMistEffect(); + void AttachMinecart(Entity_NPC* minecart); + void add_samson_berserk_charge(int amount); + void RevivePlayerGhost(); + void MorphToCoopGhost(); + void reset_body_sprite(); + static uint32_t* CalculateBagOfCraftingOutput(uint32_t* output, const char* bagContent, bool isUnused); + void SpawnClot(Vector pos, bool isUnknown); + bool TryForgottenThrow(Vector dir); + void ResetPlayer(); + void remove_wooden_cross_mantles(); + bool HasInstantDeathCurse(); + void TriggerEchoChamber(uint32_t pocketItemType, int cardOrPillColor); + bool is_evil_charm_immune(EntityRef source); + void add_random_drug_item_effect(); + void AddRandomMomItemEffect(); + void ModelingClay_roll(RNG* rng); + void twins_duplicate_familiars(int count); + const std::string& GetName(); + void TriggerRoomExit(); + int GetActiveSubCharge(int slot); + int GetPoopSpell(int position); + bool HasFullHeartsAndSoulHearts(); + void AddControlsCooldown(int amount); + uint64_t GetLastDamageFlags(); + void CheckPoopSpellQueue(Vector position); +}; diff --git a/src/entity_player_frame.cpp b/src/entity_player_frame.cpp new file mode 100644 index 0000000..8bc858c --- /dev/null +++ b/src/entity_player_frame.cpp @@ -0,0 +1,565 @@ +#include "entity_player.h" +#include "game.h" +#include "key_configs.h" +#include "log.h" +#include "manager.h" +#include "menu_manager.h" +#include "room.h" +#include +#include + +constexpr float BODY_TURN_RATE = 0.3f; +constexpr float DEGREES_PER_RADIAN = 57.295776f; +constexpr float FLYING_OFFSET_Y = -4; +constexpr float HELD_OFFSET_SCALE = 0.65f; +constexpr float MOVE_SPEED_BASE = 0.75f; +constexpr float MOVE_SPEED_SCALE = 0.25f; +constexpr float SLIPPERY_FRAMES = 60; +constexpr float WALK_FAST_SPEED = 6; +constexpr float WALK_FASTEST_SPEED = 10; +constexpr float WALK_SLOW_SPEED = 2.3f; +constexpr int DAMAGE_BLINK_PERIOD = 6; +constexpr int DAMAGE_BLINK_HIDDEN = 3; +constexpr float EMOTE_HEIGHT = 52; +constexpr float EMOTE_MOVING_SPEED = 0.1f; +constexpr float GRAVITY_PULL = 0.225f; +constexpr int MARS_TAP_FRAMES_MAX = 10000; + +// The room render passes the player draws its overlays in: the room itself and the water's surface. +static bool is_overlay_pass() +{ + RenderMode mode = g_game->room->entityList.renderMode; + return mode == RENDER_NORMAL || mode == RENDER_WATER_ABOVE; +} + +// 00a15640's mapping, as the walk speed scales the animation: a value from one range to another, clamped. +static float range_map(float value, float inMin, float inMax, float outMin, float outMax) +{ + float t = std::clamp((value - inMin) / (inMax - inMin), 0.0f, 1.0f); + return (outMax - outMin) * t + outMin; +} + +// How far an action is pushed on a controller, or on any device for -1, as the input manager reads it offline. +static float action_value(ButtonAction action, int controllerIndex) +{ + KAGE::Input::Manager& input = KAGE::Input::manager; + float value = 0; + + for (int i = 0; i < input.get_device_count(); i++) + { + std::shared_ptr device = input.get_device(i); + if (!device || !device->isConnected || (controllerIndex != -1 && device->id != controllerIndex)) continue; + for (int button : g_manager->keyConfigs.binding_get(*device, action)) + if (button != KAGE::Input::BUTTON_NONE) value = std::max(value, device->button_value(button)); + } + return value; +} + +// The axis a vector mostly points along, as a unit vector (Vector::ToCardinal). +static Vector vector_cardinal(Vector v) +{ + if (std::fabs(v.x) <= std::fabs(v.y)) return vector_make(0, v.y < 0 ? -1 : 1); + return vector_make(v.x < 0 ? -1 : 1, 0); +} + +// Flips horizontal input in the mirrored Downpour and Dross rooms. +static bool is_mirror_world() +{ + Game& game = *g_game; + bool isAltStage = game.stageType == STAGETYPE_REPENTANCE || game.stageType == STAGETYPE_REPENTANCE_B; + if (game.currentDimensionIdx != 1 || !isAltStage) return false; + return game.stage == 2 || (game.stage == 1 && (game.GetCurses() & CURSE_OF_LABYRINTH)); +} + +// Snaps input to the axis it mostly points along, keeping its strength, under the axis aligned controls seed. +static Vector axis_snap(Vector input) +{ + Vector axis = vector_cardinal(input); + float length = std::sqrt(input.x * input.x + input.y * input.y); + return vector_make(axis.x * length, axis.y * length); +} + +// 00779360 The movement input: the move actions' values, reversed by the deathmatch's confusion and the reversed +// controls seed, snapped by the axis aligned seed and mirrored in the mirror world. Esau, owned players and Tainted +// Lazarus's hologram stand still while drop is held. +Vector Entity_Player::GetMovementJoystick() +{ + Game& game = *g_game; + Entity_Player* twin = twin_get(); + bool isFollower = playerType == PLAYER_ESAU || (parent && parent->is_player()) || + ((playerType == PLAYER_LAZARUS_B || playerType == PLAYER_LAZARUS2_B) && twin && + twin->playerIndex != -1 && twin->playerIndex < playerIndex && twin != this); + if (isFollower && isControlsEnabled && controlsCooldown < 1 && action_value(ACTION_DROP, controllerIndex) > 0) + return {}; + + Vector input = vector_make(action_value(ACTION_RIGHT, controllerIndex) - action_value(ACTION_LEFT, controllerIndex), + action_value(ACTION_DOWN, controllerIndex) - action_value(ACTION_UP, controllerIndex)); + if (game.deathmatchManager.is_active() && HasEntityFlags(FLAG_CONFUSION)) input = vector_make(-input.x, -input.y); + if (game.seedEffects.HasSeedEffect(SEED_CONTROLS_REVERSED)) input = vector_make(-input.x, -input.y); + if (game.seedEffects.HasSeedEffect(SEED_AXIS_ALIGNED_CONTROLS)) input = axis_snap(input); + if (is_mirror_world()) input.x = -input.x; + return input; +} + +// 00779620 The shooting input: the shoot actions' values, or the movement under the seeds that shoot with it, reversed +// by the reversed controls seed, snapped by the axis aligned seed and mirrored in the mirror world. +Vector Entity_Player::GetShootingJoystick() +{ + Game& game = *g_game; + Vector input{}; + + if (game.seedEffects.HasSeedEffect(SEED_SHOOT_IN_MOVEMENT_DIRECTION)) input = GetMovementJoystick(); + else if (game.seedEffects.HasSeedEffect(SEED_SHOOT_OPPOSITE_MOVEMENT_DIRECTION)) + { + Vector movement = GetMovementJoystick(); + input = vector_make(-movement.x, -movement.y); + } + else + { + input = vector_make( + action_value(ACTION_SHOOT_RIGHT, controllerIndex) - action_value(ACTION_SHOOT_LEFT, controllerIndex), + action_value(ACTION_SHOOT_DOWN, controllerIndex) - action_value(ACTION_SHOOT_UP, controllerIndex)); + if (game.seedEffects.HasSeedEffect(SEED_CONTROLS_REVERSED)) input = vector_make(-input.x, -input.y); + } + if (game.seedEffects.HasSeedEffect(SEED_AXIS_ALIGNED_CONTROLS)) input = axis_snap(input); + if (is_mirror_world()) input.x = -input.x; + return input; +} + +// 00779900 The direction the body walks: the weapon's aim while it fires, Montezuma's Revenge's blast, or the last +// movement. +Vector Entity_Player::GetBodyMoveDirection() +{ + if (weapons[0] || weapons[1]) + reconstruction_missing("Entity_Player::GetBodyMoveDirection 00779900 (the weapon's aim)"); + if (HasCollectible(COLLECTIBLE_MONTEZUMAS_REVENGE) && (montezumaLaser || montezumaChargeTimer > 0)) + reconstruction_missing("Entity_Player::GetBodyMoveDirection 00779900 (Montezuma's Revenge)"); + return recentMovementVector; +} + +// 00782630 How far a flying player floats above its shadow, except in the Beast's room. +Vector Entity_Player::GetFlyingOffset() +{ + if (g_game->room->roomType == ROOM_DUNGEON || !canFly) return {}; + return vector_make(0, FLYING_OFFSET_Y); +} + +// 007ab110 Whether no extra or item animation is playing. +bool Entity_Player::IsExtraAnimationFinished() +{ + return !isPlayingExtraAnimation && !isPlayingItemAnimation; +} + +// 007bf490 Whether the body holds something over its head: picking up, lifting, hiding or using an item. +bool Entity_Player::IsHoldingItem() +{ + const std::string& animation = bodySprite.animState.animData ? bodySprite.GetAnimation() : std::string(); + for (std::string_view held : {"Pickup", "Pickup_Online", "LiftItem", "HideItem", "UseItem"}) + if (animation == held) return true; + return false; +} + +// 0078b350 Whether the player has no head: Guillotine, Scissors and Decap Attack's effects, or the Intruder. +bool Entity_Player::IsHeadless() +{ + return HasCollectible(COLLECTIBLE_GUILLOTINE) || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_SCISSORS) || + temporaryEffects.HasCollectibleEffect(COLLECTIBLE_GUILLOTINE) || + temporaryEffects.HasNullEffect(NULLITEM_INTRUDER) || + temporaryEffects.HasCollectibleEffect(COLLECTIBLE_DECAP_ATTACK); +} + +// 007db700 Whether this is Tainted Lazarus's hologram: the inactive form, following its twin. +bool Entity_Player::IsHologram() +{ + Entity_Player* twin = twin_get(); + bool isLazarus = playerType == PLAYER_LAZARUS_B || playerType == PLAYER_LAZARUS2_B; + return isExists && isLazarus && twin && twin->playerIndex != -1 && playerIndex > twin->playerIndex && twin != this; +} + +// 007c32c0 Whether enemies cannot see the player: Faded Polaroid's trinket effect, Camo Undies, or Tainted Forgotten. +bool Entity_Player::IsInvisible() +{ + return temporaryEffects.HasTrinketEffect(TRINKET_FADED_POLAROID) || + temporaryEffects.HasCollectibleEffect(COLLECTIBLE_CAMO_UNDIES) || playerType == PLAYER_THEFORGOTTEN_B; +} + +// 007cb580 Whether the whole sprite draws as one, as during an extra or item animation, unless an item is held out of +// view or Mega Mush is on. +bool Entity_Player::IsFullSpriteRendering() +{ + if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH) || IsExtraAnimationFinished()) return false; + return !IsHoldingItem() || IsHeldItemVisible(); +} + +// 00779b40 Moves the player by its input: speed and friction from its speed stat, a slippery floor's drift and the +// facing it walks in. The items that change walking stop the game until reached. +void Entity_Player::update_body_animations() +{ + if (heightVelocity < 0 || posOffset.y < 0) return; + if (target) + { + velocity = vector_make(target->pos.x - pos.x, target->pos.y - pos.y); + return; + } + + lastVelocity = velocity; + Vector input{}; + if (isControlsEnabled && controlsCooldown < 1) + { + input = GetMovementJoystick(); + if (HasEntityFlags(FLAG_APPLY_GRAVITY) && !canFly) input.y = 0; + float length = std::sqrt(input.x * input.x + input.y * input.y); + if (length > 1) input = vector_make(input.x / length, input.y / length); + } + if ((playerType == PLAYER_THEFORGOTTEN_B && !isCoopGhost) || suplexState != 0 || isDarkArtsBlastPending) + reconstruction_missing( + "Entity_Player::update_body_animations 00779b40 (Tainted Forgotten, suplexes and Dark Arts)"); + if (playerType == PLAYER_JACOB || playerType == PLAYER_ESAU || playerType == PLAYER_LAZARUS_B || + playerType == PLAYER_LAZARUS2_B || playerType == PLAYER_EVE_B) + reconstruction_missing("Entity_Player::update_body_animations 00779b40 (twins and Tainted Eve)"); + if (temporaryEffects.HasNullEffect(NULLITEM_REVERSE_CHARIOT) || ponyCharge > 0) + reconstruction_missing("Entity_Player::update_body_animations 00779b40 (the Chariot and pony dashes)"); + reverseChariotMoveCooldown = 0; + + movementVector = input; + if (input.x != 0 || input.y != 0) recentMovementVector = input; + Vector walkInput = walk_direction_update(input); + walk_velocity_update(walkInput); + if (temporaryEffects.HasNullEffect(NULLITEM_SPIN_TO_WIN)) + reconstruction_missing("Entity_Player::update_body_animations 00779b40 (Spin to Win)"); + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE) && walking_items_has()) + reconstruction_missing("Entity_Player::update_body_animations 00779b40 (the items that change walking)"); + if (HasCollectible(COLLECTIBLE_JUPITER)) + reconstruction_missing("Entity_Player::update_body_animations 00779b40 (Jupiter)"); + jupiterCharge = 0; + if (HasCollectible(COLLECTIBLE_MARS) && isControlsEnabled) + reconstruction_missing("Entity_Player::update_body_animations 00779b40 (Mars)"); + marsTapFrames = std::min(marsTapFrames + 1, MARS_TAP_FRAMES_MAX); + if (HasTrinket(TRINKET_DUCT_TAPE) && GetTrinketMultiplier(TRINKET_DUCT_TAPE) >= 2) + reconstruction_missing("Entity_Player::update_body_animations 00779b40 (golden Duct Tape)"); + ductTapeMode = 0; +} + +// The direction the player walks in and the body angle turning towards it, and the input scaled by the speed stat. +Vector Entity_Player::walk_direction_update(Vector input) +{ + float scale = moveSpeed * MOVE_SPEED_SCALE + MOVE_SPEED_BASE; + Vector scaled = vector_make(input.x * scale, input.y * scale); + + moveDirection = DIRECTION_NONE; + if (std::fabs(scaled.x) <= std::fabs(scaled.y)) + { + if (scaled.y < 0) moveDirection = DIRECTION_UP; + else if (scaled.y > 0) moveDirection = DIRECTION_DOWN; + } + else moveDirection = scaled.x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + if (suplexState == 1) moveDirection = (Direction)get_velocity_direction(); + if (moveDirection != DIRECTION_NONE) + bodyAngle = angle_lerp(bodyAngle, std::atan2(scaled.y, scaled.x) * DEGREES_PER_RADIAN, BODY_TURN_RATE); + return scaled; +} + +// Turns the walk input into velocity: the part across the input fades, the input accelerates up to the speed stat, +// a slippery floor keeps the momentum, and gravity pulls in side-scrolling rooms. A thrown player keeps its speed. +void Entity_Player::walk_velocity_update(Vector walkInput) +{ + Vector before = velocity; + float slippery = (float)slipperyTimer / SLIPPERY_FRAMES; + float drag = 0; + + if (HasEntityFlags(FLAG_SLOW)) slippery = 0; + bool isGrounded = !HasEntityFlags(FLAG_APPLY_GRAVITY) || canFly; + if ((walkInput.x != 0 || walkInput.y != 0) && isGrounded) + { + float along = before.y * walkInput.y + before.x * walkInput.x; + Vector kept = vector_make(walkInput.x * along, walkInput.y * along); + float keep = std::sqrt(slippery * 0.19999999f + 0.8f); + velocity = vector_make((before.x - kept.x) * keep + kept.x, (before.y - kept.y) * keep + kept.y); + before = velocity; + } + + float push = std::max(0.0f, (slippery * 0.7f - 0.2f) * (before.x * walkInput.x + before.y * walkInput.y)); + float accel = (push / moveSpeed + 3) * 0.4f; + if (HasEntityFlags(FLAG_THROWN)) drag = 1; + else if (suplexState < 2) drag = slippery * 0.185f + 0.775f; + else drag = slippery * 0.51f + 0.45f; + + float maxSpeed = moveSpeed * 4.41f; + accel = (accel * 0.25f - accel) * slippery + accel; + Vector moved = vector_make(walkInput.x * 0.5f * accel + before.x, walkInput.y * 0.5f * accel + velocity.y); + velocity.y = moved.y; + if (slippery > 0 && moved.x * moved.x + moved.y * moved.y > maxSpeed * maxSpeed) + { + float speed = std::sqrt(before.x * before.x + before.y * before.y); + float length = std::sqrt(moved.x * moved.x + moved.y * moved.y); + if (length > 0) + { + moved.x *= speed / length; + velocity.y = speed / length * moved.y; + } + } + + float damping = std::sqrt(drag); + velocity.x = moved.x * damping; + if (isGrounded) velocity.y *= damping; + else velocity.y += GRAVITY_PULL; +} + +// Whether one of the effects whose costume animates with the walk is on: Gamekid, My Little Unicorn, Unicorn Stump, +// Taurus, Book of Shadows and Holy Mantle. +bool Entity_Player::walking_items_has() +{ + for (int collectible : {COLLECTIBLE_GAMEKID, COLLECTIBLE_MY_LITTLE_UNICORN, COLLECTIBLE_UNICORN_STUMP, + COLLECTIBLE_TAURUS, COLLECTIBLE_BOOK_OF_SHADOWS, COLLECTIBLE_HOLY_MANTLE}) + if (temporaryEffects.HasCollectibleEffect(collectible)) return true; + return false; +} + +// Plays the walk animation the body moves in, or stands still on the idle frame, at a speed following the velocity. +void Entity_Player::walk_animation_update() +{ + if (HasEntityFlags(FLAG_INTERPOLATION_UPDATE) || (!IsExtraAnimationFinished() && !IsHoldingItem())) return; + if (queuedItem.item) FlushQueueItem(); + + Vector direction = GetBodyMoveDirection(); + bool isPlayer = variant == PLAYER_VARIANT_PLAYER && !isCoopGhost; + if (direction.x != 0 || direction.y != 0) + { + bool isVertical = std::fabs(direction.x) <= std::fabs(direction.y); + float axis = isVertical ? direction.y : direction.x; + std::string_view animation = + isVertical ? (axis > 0 ? "WalkDown" : "WalkUp") : (axis > 0 ? "WalkRight" : "WalkLeft"); + if (isPlayer) sprite.Play(animation); + } + else if (isPlayer) + { + if (!canFly || playerType == PLAYER_THEFORGOTTEN_B) sprite.SetFrame("WalkDown", 0); + else sprite.Play("WalkDown"); + } + + float speed = 1; + if (sprite.IsPlaying()) + { + float length = std::sqrt(velocity.x * velocity.x + velocity.y * velocity.y); + if (length < WALK_SLOW_SPEED) speed = range_map(length, 1, WALK_SLOW_SPEED, 0.5f, 1); + if (length > WALK_FAST_SPEED) speed = range_map(length, WALK_FAST_SPEED, WALK_FASTEST_SPEED, 1, 2); + if (slipperyTimer > 0) reconstruction_missing("Entity_Player::Update 00782af0 (walking on a slippery floor)"); + } + sprite.playbackSpeed = speed; +} + +// Turns the head to where the player walks, as update_shooting does when nothing is shot, and shows it. +void Entity_Player::head_animation_update() +{ + if (headDirectionTime < 0 && (movementVector.x != 0 || movementVector.y != 0)) + { + if (std::fabs(movementVector.x) <= std::fabs(movementVector.y)) + { + headAnim = movementVector.y >= 0 ? "HeadDown" : "HeadUp"; + headDirection = movementVector.y >= 0 ? DIRECTION_DOWN : DIRECTION_UP; + } + else + { + headAnim = movementVector.x >= 0 ? "HeadRight" : "HeadLeft"; + headDirection = movementVector.x >= 0 ? DIRECTION_RIGHT : DIRECTION_LEFT; + } + } + if (fireBlockCooldown < 1) fireDirection = DIRECTION_NONE; + if (!HasEntityFlags(FLAG_INTERPOLATION_UPDATE)) + { + if (blinkTime > -1) blinkTime--; + if (headDirectionTime > -1) headDirectionTime--; + } + if (variant == PLAYER_VARIANT_PLAYER && IsExtraAnimationFinished()) sprite.SetOverlayFrame(headAnim, 0); +} + +// 00782af0 The player's frame. Only the frame of a plain character is reconstructed: the base entity moves it, it walks +// by its input, its head turns where it walks and its body animates. Items, effects, held and queued items, extra +// animations and the shooting, bomb, item, pocket and drop actions stop the game until reached. +void Entity_Player::Update() +{ + if (!is_evaluation_plain() || isPlayingExtraAnimation || isPlayingItemAnimation || heldEntity || queuedItem.item) + reconstruction_missing("Entity_Player::Update 00782af0 (items, effects and extra animations)"); + for (ButtonAction action : {ACTION_SHOOT_LEFT, ACTION_SHOOT_RIGHT, ACTION_SHOOT_UP, ACTION_SHOOT_DOWN, ACTION_BOMB, + ACTION_ITEM, ACTION_PILL_CARD, ACTION_DROP}) + if (isControlsEnabled && action_value(action, controllerIndex) > 0) + reconstruction_missing( + "Entity_Player::update_shooting 0077b020 (shooting, bombs, items, pockets and drop)"); + + Entity::Update(); + update_body_animations(); + head_animation_update(); + walk_animation_update(); +} + +// 0078ca00 Draws the player at its place, lifted by its flight and its offset: blinking while hurt, the held entity +// in front or behind, its after-images, then its overlays (the co-op indicator, charge bars and status effect) in the +// room's pass. Netplay's shadows and colors are offline. +void Entity_Player::Render(const Vector& offset) +{ + if (variant == PLAYER_VARIANT_EXTRA || target) + { + if (target && variant != PLAYER_VARIANT_EXTRA) + reconstruction_missing("Entity_Player::Render 0078ca00 (a player following a target)"); + return; + } + + Vector renderOffset = offset; + if (!HasEntityFlags(FLAG_HELD)) + renderOffset = + vector_make(offset.x + posOffset.x * HELD_OFFSET_SCALE, offset.y + posOffset.y * HELD_OFFSET_SCALE); + if (canFly) + { + Vector flying = GetFlyingOffset(); + renderOffset = vector_make(renderOffset.x + flying.x, renderOffset.y + flying.y); + } + if (!isVisible) return; + if (damageCooldown > 0 && damageCooldown % DAMAGE_BLINK_PERIOD < DAMAGE_BLINK_HIDDEN && + IsExtraAnimationFinished() && g_game->challenge != CHALLENGE_GUARDIAN && !HasEntityFlags(FLAG_NO_DAMAGE_BLINK)) + return; + if (heldEntity) reconstruction_missing("Entity_Player::Render 0078ca00 (the held entity)"); + + render_pass(renderOffset, RENDER_PASS_MAIN); + if (!is_overlay_pass()) return; + + if (playerHUD) reconstruction_missing("Entity_Player::Render 0078ca00 (the player's HUD bubble)"); + if (g_game->playerManager.playerList.size() > 1 && g_game->roomTransition.mode == TRANSITION_NONE) + reconstruction_missing("Entity_Player::Render 0078ca00 (the co-op player indicator)"); + if (!isDead) + { + render_charge_bars(renderPosition); + if (statusEffectSprite.isLoaded && statusEffectSprite.animState.animData && + statusEffectSprite.animState.isPlaying) + reconstruction_missing("Entity_Player::Render 0078ca00 (the status effect sprite)"); + } + if (g_game->hallucinationTimer > 0) + reconstruction_missing("Entity_Player::Render 0078ca00 (the hallucination overlay)"); + if (g_game->deathmatchManager.is_active()) + reconstruction_missing("Entity_Player::Render 0078ca00 (the deathmatch overlay)"); +} + +// 0078b640 Draws the player's body: the glow, body, head and top layers of its sprite and costumes at its snapped +// position, or the whole sprite during extra animations. Co-op babies and ghosts draw as plain entities, Tainted +// Lazarus's hologram in a shimmer, and the twin behind Tainted Lazarus as its backup. +void Entity_Player::render_pass(const Vector& offset, RenderPass pass) +{ + if (g_game->room->entityList.renderMode == RENDER_WATER_REFLECT && variant == PLAYER_VARIANT_PLAYER && + !isCoopGhost && (playerType == PLAYER_LAZARUS_B || playerType == PLAYER_LAZARUS2_B) && backupPlayer && isValid) + reconstruction_missing("Entity_Player::render_pass 0078b640 (Tainted Lazarus's reflection)"); + if (variant == PLAYER_VARIANT_COOP_BABY || isCoopGhost) + { + Entity::Render(offset); + return; + } + if (IsHologram()) reconstruction_missing("Entity_Player::render_pass 0078b640 (Tainted Lazarus's hologram)"); + if (IsHoldingItem() && bodySprite.animState.animData) + if (const NullFrame* held = bodySprite.animState.GetNullFrameById(0); + held && held->isVisible && playerType == PLAYER_LILITH_B) + reconstruction_missing("Entity_Player::render_pass 0078b640 (Tainted Lilith's held item)"); + if (IsFullSpriteRendering()) reconstruction_missing("Entity_Player::render_pass 0078b640 (the whole sprite)"); + + renderPosition = vector_add(render_position_get(pos, RENDER_SNAPPED), offset); + bool isHeaded = !IsHeadless(); + if (isHeaded) + { + RenderGlow(renderPosition); + render_back(renderPosition); + } + RenderBody(renderPosition); + if (isHeaded) RenderHead(renderPosition); + RenderTop(renderPosition); + (void)pass; + bool isMoving = velocity.x * velocity.x + velocity.y * velocity.y > EMOTE_MOVING_SPEED; + if (!emotes.isActive || emotes.emote != EMOTE_TYPING || !isMoving) + emotes.Render(vector_make(renderPosition.x, renderPosition.y - bodyScale.y * EMOTE_HEIGHT)); +} + +// The sprite a costume layer draws with: a worn costume's, or the player's own. +ANM2& Entity_Player::layer_sprite(int layer) +{ + int index = playerCostumeMap[layer].index; + return index < 0 ? sprite : costumeSpriteDescs[index].sprite; +} + +// The layer of that sprite a player layer draws. +int Entity_Player::layer_id(int layer) +{ + return playerCostumeMap[layer].index < 0 ? layer : playerCostumeMap[layer].layerId; +} + +// 0078dc60 Draws the glow layer under the player. +void Entity_Player::RenderGlow(const Vector& position) +{ + if (!isVisible || IsFullSpriteRendering()) return; + layer_sprite(PLAYER_LAYER_GLOW).RenderLayer(layer_id(PLAYER_LAYER_GLOW), SpriteDraw{position, {}, {}}); +} + +// 0078e130 Draws the back layer behind the body, a costume's where one covers it. +void Entity_Player::render_back(const Vector& position) +{ + if (!isVisible || IsFullSpriteRendering()) return; + layer_sprite(PLAYER_LAYER_BACK).RenderLayer(layer_id(PLAYER_LAYER_BACK), SpriteDraw{position, {}, {}}); +} + +// 0078dde0 Draws the body layers, the costumes' where they cover them, and the blood gush of a headless player. +// Flying costumes cover the body only while flying. +void Entity_Player::RenderBody(const Vector& position) +{ + if (!isVisible || IsFullSpriteRendering()) return; + + bool isBodyRendered = false; + for (int layer = PLAYER_LAYER_BODY; layer <= PLAYER_LAYER_BODY1; layer++) + { + int index = playerCostumeMap[layer].index; + if (index < 0) + { + sprite.RenderLayer(layer, SpriteDraw{position, {}, {}}); + isBodyRendered = true; + continue; + } + if (canFly && !costumeSpriteDescs[index].isFlying) continue; + reconstruction_missing("Entity_Player::RenderBody 0078dde0 (body costumes)"); + } + if (isBodyRendered && IsHeadless()) reconstruction_missing("Entity_Player::RenderBody 0078dde0 (the blood gush)"); +} + +// 0078dff0 Draws the head layers, the costumes' where they cover them, and the crowns of Dark Prince's Crown and Crown +// of Light. +void Entity_Player::RenderHead(const Vector& position) +{ + if (!isVisible || IsFullSpriteRendering()) return; + + for (int layer = PLAYER_LAYER_HEAD; layer <= PLAYER_LAYER_EXTRA - 1; layer++) + layer_sprite(layer).RenderLayer(layer_id(layer), SpriteDraw{position, {}, {}}); + for (auto [collectible, crown] : {std::pair{COLLECTIBLE_DARK_PRINCES_CROWN, &darkPrincesCrownSprite}, + std::pair{COLLECTIBLE_CROWN_OF_LIGHT, &crownOfLightSprite}}) + { + if (!HasCollectible(collectible) || !crown->isLoaded) continue; + AnimationState& first = crown->isOverlayRenderFirst ? crown->overlayAnimState : crown->animState; + AnimationState& second = crown->isOverlayRenderFirst ? crown->animState : crown->overlayAnimState; + first.Render(SpriteDraw{position, {}, {}}, *crown); + second.Render(SpriteDraw{position, {}, {}}, *crown); + } +} + +// 0078e190 Draws the top layer over the head. +void Entity_Player::RenderTop(const Vector& position) +{ + if (!isVisible || IsFullSpriteRendering()) return; + layer_sprite(PLAYER_LAYER_TOP0).RenderLayer(layer_id(PLAYER_LAYER_TOP0), SpriteDraw{position, {}, {}}); +} + +// 0078dc20 Draws the shadow, which My Shadow's player has none of. +bool Entity_Player::RenderShadowLayer(const Vector& offset) +{ + if (HasCollectible(COLLECTIBLE_MY_SHADOW)) return true; + return Entity::RenderShadowLayer(offset); +} + +// 0075ea40 Draws the charge bars over the player when the options show them: the weapons' charge, the crafting bag and +// the charging items. Only the hidden case is reconstructed: shown bars stop the game until reached. +void Entity_Player::render_charge_bars(Vector) +{ + if (!g_manager->optionsConfig.isChargeBarsEnabled) return; + reconstruction_missing("Entity_Player::render_charge_bars 0075ea40 (the charge bars)"); +} diff --git a/src/entity_player_health.cpp b/src/entity_player_health.cpp new file mode 100644 index 0000000..089d5ed --- /dev/null +++ b/src/entity_player_health.cpp @@ -0,0 +1,736 @@ +#include "entity_player.h" +#include "game.h" +#include "manager.h" + +constexpr int CONSUMABLE_MAX = 99; +constexpr int DEEP_POCKETS_COIN_MAX = 999; +constexpr int BLUEBABY_B_POOP_CAP = 24; +constexpr int COINS_UNLOCK_THRESHOLD = 55; +constexpr int GREED_GULLET_COINS_PER_HEART = 25; +constexpr int HEART_LIMIT_DEFAULT = 24; +constexpr int HEART_LIMIT_DEATHMATCH = 160; +constexpr int HEART_LIMIT_FORGOTTEN = 12; +constexpr int HEART_LIMIT_FORGOTTEN_SOUL = 6; +constexpr int HEART_LIMIT_ESAU_SOUL = 4; +constexpr int MAX_HEARTS_UNLOCK = 14; +constexpr int SOUL_HEARTS_UNLOCK = 8; +constexpr int BLACK_HEART_BITS = 32; +// The game state bit set once the coins reach 99, which the original keeps one below Lua's STATE_MAX_COINS_OBTAINED. +constexpr uint64_t GAME_STATE_MAX_COINS_BIT = 1ull << 43; + +// Which consumables ConsumableCountChanged and SyncConsumables copy between players. +enum ConsumableMask : uint32_t +{ + CONSUMABLE_COINS = 0x1, + CONSUMABLE_KEYS = 0x2, + CONSUMABLE_BOMBS = 0x4, + CONSUMABLE_GOLDEN_KEY = 0x8, + CONSUMABLE_GOLDEN_BOMB = 0x10, + CONSUMABLE_SOUL_CHARGE = 0x20, + CONSUMABLE_GIGA_BOMBS = 0x40, + CONSUMABLE_POOP_MANA = 0x80, + CONSUMABLE_BLOOD_CHARGE = 0x100 +}; + +// 007dd380 A heart amount as the deathmatch counts it, eight times the run's. +int scale_for_hard_difficulty(int value) +{ + return g_game->deathmatchManager.is_active() ? value * 8 : value; +} + +// Asks the HUD to redraw the players' corners on the next frame but one, unless a full redraw is pending. +static void hud_refresh_players() +{ + HUD& hud = g_game->hud; + + if (hud.hudRefreshType == HUD_REFRESH_FULL) return; + hud.hudRefreshType = HUD_REFRESH_PLAYER; + hud.hudRefreshCountdown = 2; +} + +// The player whose health a Jacob's Esau ghost (The Soul of Tainted Forgotten) stands for: its twin. +Entity_Player* Entity_Player::health_owner() +{ + Entity_Player* player = this; + while (player->playerType == PLAYER_THESOUL_B && player->twin_get()) player = player->twin_get(); + return player; +} + +// 007cafe0 How the character counts its health. +HealthType Entity_Player::GetHealthType() +{ + switch (playerType) + { + case PLAYER_BLUEBABY: + case PLAYER_BLACKJUDAS: + case PLAYER_THESOUL: + case PLAYER_JUDAS_B: + case PLAYER_BLUEBABY_B: + case PLAYER_THEFORGOTTEN_B: + case PLAYER_BETHANY_B: + return HEALTH_SOUL; + case PLAYER_THELOST: + case PLAYER_THELOST_B: + case PLAYER_THESOUL_B: + return HEALTH_NO_HEALTH; + case PLAYER_KEEPER: + case PLAYER_KEEPER_B: + return HEALTH_COIN; + case PLAYER_THEFORGOTTEN: + return HEALTH_BONE; + default: + return HEALTH_DEFAULT; + } +} + +// 007cae60 The most half hearts the player can hold: 24, 12 for The Forgotten and The Soul and co-op babies, more with +// Magdalene's Birthright, Keeper's coin hearts from Greed's Gullet, less two per broken heart. With isKeeperBypass the +// broken hearts and Keeper's own limits are ignored. Forgotten's and Esau's soul forms hold less. +int Entity_Player::GetHeartLimit(bool isKeeperBypass) +{ + if (g_game->deathmatchManager.is_active()) return HEART_LIMIT_DEATHMATCH; + if (variant == PLAYER_VARIANT_PLAYER) + { + if (playerType == PLAYER_THEFORGOTTEN && temporaryEffects.HasNullEffect(NULLITEM_SOUL_FORGOTTEN)) + return HEART_LIMIT_FORGOTTEN_SOUL; + if (playerType == PLAYER_ESAU && temporaryEffects.HasNullEffect(NULLITEM_SOUL_JACOB)) + return HEART_LIMIT_ESAU_SOUL; + } + + bool isSmall = + variant == PLAYER_VARIANT_COOP_BABY || playerType == PLAYER_THEFORGOTTEN || playerType == PLAYER_THESOUL; + int limit = isSmall ? HEART_LIMIT_FORGOTTEN : HEART_LIMIT_DEFAULT; + if (playerType == PLAYER_MAGDALENE && HasCollectible(COLLECTIBLE_BIRTHRIGHT)) limit += HEART_LIMIT_FORGOTTEN; + + if (playerType == PLAYER_KEEPER || playerType == PLAYER_KEEPER_B) + { + if (isKeeperBypass) return limit; + + limit = std::min((playerType == PLAYER_KEEPER ? 6 : 4) + GetGreedsGulletHearts() * 2, HEART_LIMIT_DEFAULT); + if (playerType == PLAYER_KEEPER && HasCollectible(COLLECTIBLE_BIRTHRIGHT)) limit += 2; + if (HasCollectible(COLLECTIBLE_GREEDS_GULLET)) + limit += (numCoins / GREED_GULLET_COINS_PER_HEART + (numCoins == CONSUMABLE_MAX ? 1 : 0)) * 2; + } + else if (isKeeperBypass) return limit; + return std::max(0, limit - brokenHearts * 2); +} + +// 007cb060 The red heart containers the player counts, bone hearts included for the characters that have them. +int Entity_Player::GetEffectiveMaxHearts() +{ + HealthType health = GetHealthType(); + if (health == HEALTH_SOUL || health == HEALTH_NO_HEALTH) return maxHearts; + return maxHearts + boneHearts * 2; +} + +// 007ce390 The heart containers Greed's Gullet gives Keeper for its coins, plus one per Mother's Kiss. +int Entity_Player::GetGreedsGulletHearts() +{ + int hearts = 0; + if (HasCollectible(COLLECTIBLE_GREEDS_GULLET)) + { + if (numCoins > CONSUMABLE_MAX) return GetTrinketMultiplier(TRINKET_MOTHERS_KISS) + numCoins / 100 + 3; + if (numCoins == CONSUMABLE_MAX) return GetTrinketMultiplier(TRINKET_MOTHERS_KISS) + 4; + hearts = std::max(0, numCoins) / GREED_GULLET_COINS_PER_HEART; + } + return GetTrinketMultiplier(TRINKET_MOTHERS_KISS) + hearts; +} + +// 007588a0 Adds heart containers, or takes them away. Soul characters get soul or black hearts instead, The Forgotten +// bone hearts. Past the limit the extra is lost, and soul and red hearts are clamped to what is left. +void Entity_Player::AddMaxHearts(int amount, bool isIgnoreKeeper) +{ + Entity_Player& owner = *health_owner(); + HealthType health = owner.GetHealthType(); + + if (health == HEALTH_NO_HEALTH) return; + if (health == HEALTH_SOUL) + { + if (owner.HasCollectible(COLLECTIBLE_BIRTHRIGHT) && owner.playerType == PLAYER_BLUEBABY && amount > 0) + owner.AddSoulHearts(amount * 2, false); + else if (owner.playerType == PLAYER_BLACKJUDAS || owner.playerType == PLAYER_JUDAS_B) + owner.AddBlackHearts(amount); + else owner.AddSoulHearts(amount, false); + return; + } + if (health == HEALTH_BONE) + { + owner.AddBoneHearts(amount / 2); + return; + } + + int limit = owner.GetHeartLimit(isIgnoreKeeper); + if (amount < 0) owner.trigger_max_hearts_removed(-amount); + if (!isIgnoreKeeper) amount = scale_for_hard_difficulty(amount); + if (owner.maxHearts + amount > limit) owner.trigger_max_hearts_removed(owner.maxHearts - limit + amount); + owner.maxHearts = std::min(owner.maxHearts + amount, limit); + if (owner.maxHearts < 0) + { + int missing = owner.maxHearts; + owner.maxHearts = 0; + owner.AddBoneHearts(missing / 2); + } + + int effectiveMax = owner.GetEffectiveMaxHearts(); + if (owner.soulHearts + effectiveMax > limit) owner.soulHearts = std::max(0, limit - effectiveMax); + owner.redHearts = std::min(owner.redHearts, effectiveMax); + if (owner.maxHearts >= MAX_HEARTS_UNLOCK) g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_MAGDALENE); + owner.UpdateBlackHeartMask(); + owner.update_greeds_gullet(); + owner.UpdateHeartDependentEffects(); + owner.ClampGoldenHearts(false); + owner.update_bone_hearts(); + owner.ClampHeartsToLimit(HEART_RED, 0); +} + +// 00758a70 Adds red hearts up to the containers, or takes them away. Esau's ghost, The Soul and Tainted Bethany pass +// them on, Tainted Magdalene doubles the healing and Keeper rounds it to whole coins. The Have a Heart challenge heals +// nothing unless isUnknown is set. +void Entity_Player::AddHearts(int hearts, bool isUnknown, bool isUnknown2) +{ + Entity_Player* owner = this; + while (true) + { + if (hearts > 0 && g_game->deathmatchManager.is_active()) hearts *= 8; + if (owner->playerType == PLAYER_THESOUL_B && owner->twin_get()) + { + isUnknown2 = false; + owner = owner->twin_get(); + continue; + } + if (hearts > 0 && !isUnknown && g_game->challenge == CHALLENGE_HAVE_A_HEART) return; + if (owner->playerType != PLAYER_THESOUL || !owner->subPlayer) break; + + isUnknown2 = false; + isUnknown = false; + owner = owner->subPlayer; + } + if (owner->playerType == PLAYER_BETHANY_B && owner->playerType != PLAYER_THESOUL) + { + owner->AddBloodCharge(hearts); + return; + } + if (owner->playerType == PLAYER_MAGDALENE_B && !isUnknown && hearts > 0) hearts *= 2; + owner->red_hearts_add(hearts, isUnknown2); +} + +// Adds red hearts to a player that keeps them, after AddHearts settled who and how many. +void Entity_Player::red_hearts_add(int hearts, bool isUnknown2) +{ + HealthType health = GetHealthType(); + if (health == HEALTH_SOUL || health == HEALTH_NO_HEALTH) return; + if (health == HEALTH_COIN) hearts = (hearts + (hearts < 1 ? -1 : 1)) / 2 * 2; + + int oldRedHearts = redHearts; + redHearts = std::max(0, std::min(oldRedHearts + hearts, maxHearts + boneHearts * 2)); + if (hearts > 0) + { + ClearEntityFlags(FLAG_BLEED_OUT); + bleedOutHealth = 0; + } + if (redHearts != oldRedHearts) UpdateHeartDependentEffects(); + ClampGoldenHearts(isUnknown2); + update_bone_hearts(); + if (hearts > 0 && oldRedHearts < redHearts) hud_heart_flash(); +} + +// 00758d00 Adds soul hearts up to the limit, or takes them away. Esau's ghost passes them to its twin and The Forgotten +// to The Soul. Alabaster Box's charge eats them first, a Blanket's shield takes two, Keeper gets flies, Bethany soul +// charge, and characters without health a single soul heart when given any. +void Entity_Player::AddSoulHearts(int amount, bool isUnknown) +{ + Entity_Player* owner = this; + Game& game = *g_game; + + while (true) + { + while (owner->playerType == PLAYER_THESOUL_B && owner->twin_get()) + { + isUnknown = false; + owner = owner->twin_get(); + } + if (!owner->isUpdatingGreedsGullet && !game.isStartingFromState && !game.isRestoringGlowingHourglassState && + amount > 0) + amount = owner->soul_hearts_absorb(amount); + + HealthType health = owner->GetHealthType(); + if (health == HEALTH_NO_HEALTH) + { + if (amount > 0) owner->soulHearts = 1; + return; + } + if (health == HEALTH_COIN) + { + if (amount > 0) owner->AddBlueFlies((amount * 3 + 1) / 2, owner->pos, nullptr); + return; + } + if (owner->playerType != PLAYER_THEFORGOTTEN) break; + + owner = owner->subPlayer; + if (!owner) return; + isUnknown = false; + } + owner->soul_hearts_add(amount, isUnknown); +} + +// Fills Alabaster Box charges and lets a Blanket shield take two from soul hearts about to be added, returning what is +// left. +int Entity_Player::soul_hearts_absorb(int amount) +{ + if (temporaryEffects.HasNullEffect(NULLITEM_SPIRIT_SHACKLES_DISABLED)) + { + temporaryEffects.RemoveNullEffect(NULLITEM_SPIRIT_SHACKLES_DISABLED, -1); + amount = std::max(0, amount - 2); + if (amount <= 0) return amount; + } + for (int slot = 0; slot < ACTIVE_SLOT_COUNT; slot++) + { + ActiveItemDesc& active = activeItems[slot]; + if (active.item != COLLECTIBLE_ALABASTER_BOX) continue; + + int charge = std::max(0, std::min(active.charge + amount, GetActiveMaxCharge(slot))); + if (charge == active.charge) continue; + int before = active.charge; + SetActiveCharge(charge, slot); + amount += before - charge; + } + return amount; +} + +// Adds soul hearts to a player that keeps them, after AddSoulHearts settled who and how many. +void Entity_Player::soul_hearts_add(int amount, bool isUnknown) +{ + if (playerType == PLAYER_BETHANY) + { + AddSoulCharge(amount); + return; + } + if (GetHealthType() == HEALTH_SOUL && amount < 0) trigger_max_hearts_removed(-amount); + if (g_game->deathmatchManager.is_active()) + { + ClampHeartsToLimit(HEART_SOUL, amount); + return; + } + + int oldSoulHearts = soulHearts; + soulHearts = std::max(0, soulHearts + amount); + int limit = GetHeartLimit(false); + int containers = maxHearts + boneHearts * 2; + if (containers + soulHearts > limit) soulHearts = limit - containers; + if (soulHearts >= SOUL_HEARTS_UNLOCK) g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_LAZARUS); + UpdateBlackHeartMask(); + ClampGoldenHearts(isUnknown); + update_bone_hearts(); + if (amount < 1 || soulHearts < oldSoulHearts) return; + + for (PlayerHUD& hud : g_game->hud.playerHUD) + if (hud.player == this) + { + hud.soulHeartFlashCountdown = HUD_HEART_FLASH_FRAMES; + return; + } +} + +// Flashes the player's red hearts on the HUD after healing. +void Entity_Player::hud_heart_flash() +{ + for (PlayerHUD& hud : g_game->hud.playerHUD) + if (hud.player == this) + { + hud.redHeartFlashCountdown = HUD_HEART_FLASH_FRAMES; + return; + } +} + +// 00758f90 Adds black hearts as soul hearts marked black, or flies for Keeper. Near the limit it turns the existing +// soul hearts black from the last one back instead. Golden hearts left without a heart to sit on break. +void Entity_Player::AddBlackHearts(int amount) +{ + Entity_Player* owner = health_owner(); + while (owner->GetHealthType() != HEALTH_NO_HEALTH && owner->playerType == PLAYER_THEFORGOTTEN) + { + owner = owner->subPlayer; + if (!owner) return; + while (owner->playerType == PLAYER_THESOUL_B && owner->twin_get()) owner = owner->twin_get(); + } + if (owner->GetHealthType() == HEALTH_NO_HEALTH) return; + owner->black_hearts_add(amount); +} + +// Marks the soul hearts about to be added black, or turns soul hearts black when the limit leaves no room. +void Entity_Player::black_hearts_add(int amount) +{ + if (GetHealthType() == HEALTH_COIN) + { + AddBlueFlies((amount * 4 + 1) / 2, pos, nullptr); + return; + } + if (g_game->deathmatchManager.is_active()) + { + ClampHeartsToLimit(HEART_BLACK, amount); + return; + } + + int roundedSoul = soulHearts + (soulHearts & 1); + int oddAdjust = 0; + int extra = amount & 1; + if ((soulHearts & 1) && extra) + { + oddAdjust = -1; + extra = 0; + } + if (roundedSoul + maxHearts + boneHearts * 2 < GetHeartLimit(false) - 1) + { + for (int heart = (oddAdjust + roundedSoul) / 2; heart < (extra + roundedSoul + amount) / 2; heart++) + blackHearts |= 1 << heart; + } + else + { + int marked = 0; + int slot = roundedSoul - 1; + int lower = roundedSoul; + while (slot > 0) + { + lower -= 2; + if (marked >= amount) break; + bool isRedundant = slot <= soulHearts && slot >= 1 && slot % 2 == 1 && (blackHearts & (1 << (lower / 2))); + if (!isRedundant) + { + marked += 2; + blackHearts |= 1 << (slot / 2); + } + slot -= 2; + } + } + + AddSoulHearts(amount, false); + if (!g_game->deathmatchManager.is_active() && !isDead && goldenHearts > 0) + { + int holders = (std::min(redHearts, maxHearts) + 1) / 2 + (soulHearts + 1) / 2 + boneHearts; + if (holders < goldenHearts) + { + BreakGoldenHearts(goldenHearts - holders); + goldenHearts = holders; + } + } + update_bone_hearts(); +} + +// 007d2a40 Adds broken hearts, at most half the heart limit, then lets AddMaxHearts drop what no longer fits. +// Heartbreak's damage follows the count. +void Entity_Player::AddBrokenHearts(int amount) +{ + Entity_Player& owner = *health_owner(); + + owner.brokenHearts = std::min(std::max(0, owner.brokenHearts + amount), owner.GetHeartLimit(true) / 2); + owner.AddMaxHearts(0, false); + if (owner.HasCollectible(COLLECTIBLE_HEARTBREAK)) + { + owner.cacheFlags |= CACHE_DAMAGE; + owner.EvaluateItems(); + } +} + +// 007592a0 Moves the black heart bits down with the soul hearts that were lost, keeping as many black hearts as fit. +void Entity_Player::UpdateBlackHeartMask() +{ + if (g_game->deathmatchManager.is_active()) return; + if (soulHearts == 0) + { + blackHearts = 0; + return; + } + + uint32_t lost = 0; + int moved = 0; + for (int heart = (soulHearts + 1) / 2; heart < BLACK_HEART_BITS; heart++) + if (blackHearts & (1u << heart)) + { + lost |= 1u << heart; + moved++; + } + blackHearts &= ~lost; + + int lower = soulHearts; + for (int slot = soulHearts; slot > 0 && moved > 0; slot--) + { + lower--; + if (!(slot & 1)) continue; + if (soulHearts < slot || !(blackHearts & (1u << (lower / 2)))) + { + moved--; + blackHearts |= 1u << (slot >> 1); + } + } +} + +// 007cacb0 In the deathmatch, trims soul, golden, rotten, bone and black hearts past the limit, then adds what fits of +// the hearts just given. Outside it does nothing. +void Entity_Player::ClampHeartsToLimit(HeartKind kind, int amount) +{ + if (!g_game->deathmatchManager.is_active()) return; + + int added = amount * 8; + int limit = GetHeartLimit(false); + int total = maxHearts + soulHearts + blackHearts + goldenHearts + boneHearts + rottenHearts * 2; + for (int* hearts : {&soulHearts, &goldenHearts, &rottenHearts, &boneHearts, &blackHearts}) + { + if (total <= limit) break; + int trimmed = std::min(*hearts, total - limit); + if (trimmed <= 0) continue; + *hearts -= trimmed; + total -= trimmed; + } + + int fits = std::max(0, std::min(added, added - total + limit)); + switch (kind) + { + case HEART_SOUL: + soulHearts += fits; + break; + case HEART_BLACK: + blackHearts += fits; + break; + case HEART_GOLDEN: + goldenHearts += fits; + break; + case HEART_BONE: + boneHearts += fits; + break; + case HEART_ROTTEN: + rottenHearts += fits; + break; + default: + break; + } +} + +// 007ca7c0 Breaks golden hearts that no longer have a heart to sit on, quietly with isSkipBreak. +void Entity_Player::ClampGoldenHearts(bool isSkipBreak) +{ + if (g_game->deathmatchManager.is_active() || isDead || goldenHearts <= 0) return; + + int holders = (std::min(redHearts, maxHearts) + 1) / 2 + (soulHearts + 1) / 2 + boneHearts; + if (holders >= goldenHearts) return; + if (!isSkipBreak) BreakGoldenHearts(goldenHearts - holders); + goldenHearts = holders; +} + +// 007cabc0 Drops bone hearts past the limit, then lays the mask of which heart slots hold bones over the slots there +// are, filling it from the top for any bone heart it misses. +void Entity_Player::update_bone_hearts() +{ + if (g_game->deathmatchManager.is_active()) return; + + boneHearts = std::min(boneHearts, GetHeartLimit(false) / 2 - ((maxHearts + 1 + soulHearts) >> 1)); + if (boneHearts < 1) + { + boneHearts = 0; + boneHeartsMask = 0; + return; + } + + int slots = (soulHearts + 1) / 2 + boneHearts; + uint32_t mask = (uint32_t)boneHeartsMask & (0xffffffffu >> ((32 - slots) & 31)); + int left = boneHearts; + for (int slot = 0; slot < slots; slot++) + if ((mask & (1u << slot)) && --left < 0) mask &= ~(1u << slot); + boneHeartsMask = (int)mask; + for (int slot = slots - 1; slot >= 0 && left > 0; slot--) + if (!(mask & (1u << slot))) + { + left--; + boneHeartsMask |= 1 << slot; + mask = (uint32_t)boneHeartsMask; + } +} + +// 007c9ea0 Settles what follows a change of hearts: rotten hearts fit in the red ones, Greed's Gullet, Tainted Eve's +// last heart, Whore of Babylon, Crown of Light, Dark Prince's Crown and Vasculitis. +void Entity_Player::UpdateHeartDependentEffects() +{ + Game& game = *g_game; + bool isDeathmatch = game.deathmatchManager.is_active(); + + if (!isDeathmatch) + { + rottenHearts = std::min(rottenHearts, (redHearts + 1) / 2); + redHearts = std::max(redHearts, rottenHearts * 2); + } + update_greeds_gullet(); + if (!isDead && playerType == PLAYER_EVE_B && + boneHearts + goldenHearts + soulHearts + eternalHearts + redHearts == 1) + reconstruction_missing("Entity_Player::UpdateHeartDependentEffects 007c9ea0 (Tainted Eve's last heart)"); + + int lowRed = isDeathmatch ? 16 : 1; + if (!isDead && redHearts <= lowRed) + if (HasCollectible(COLLECTIBLE_WHORE_OF_BABYLON) && + !temporaryEffects.HasCollectibleEffect(COLLECTIBLE_WHORE_OF_BABYLON)) + reconstruction_missing("Entity_Player::UpdateHeartDependentEffects 007c9ea0 (Whore of Babylon)"); + if (!isDead && playerType == PLAYER_EVE && redHearts > lowRed) + reconstruction_missing("Entity_Player::UpdateHeartDependentEffects 007c9ea0 (Eve's Whore of Babylon)"); + + if (HasCollectible(COLLECTIBLE_CROWN_OF_LIGHT) || HasCollectible(COLLECTIBLE_DARK_PRINCES_CROWN)) + reconstruction_missing("Entity_Player::UpdateHeartDependentEffects 007c9ea0 (the crowns)"); + if (HasCollectible(COLLECTIBLE_VASCULITIS) || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_VASCULITIS)) + { + cacheFlags |= CACHE_DAMAGE; + EvaluateItems(); + } +} + +// 007ce420 Keeps Greed's Gullet's heart containers in step with the coins: hearts lost pay back coins (and break a +// Mother's Kiss), hearts gained or lost change the containers, and what did not fit waits as overflow. +void Entity_Player::update_greeds_gullet() +{ + Game& game = *g_game; + if (game.isRestoringGlowingHourglassState || game.isStartingFromState) return; + + Entity_Player& owner = playerType == PLAYER_THESOUL && subPlayer ? *subPlayer : *this; + if (owner.isUpdatingGreedsGullet) return; + owner.isUpdatingGreedsGullet = true; + isUpdatingGreedsGullet = true; + + int before = greedsGulletHearts; + switch (owner.GetHealthType()) + { + case HEALTH_DEFAULT: + case HEALTH_COIN: + greedsGulletHearts = + (short)std::min(greedsGulletHearts, (owner.maxHearts >> 1) + greedsGulletOverflow); + break; + case HEALTH_SOUL: + greedsGulletHearts = + (short)std::min(greedsGulletHearts, ((owner.soulHearts + 1) >> 1) + greedsGulletOverflow); + break; + case HEALTH_BONE: + greedsGulletHearts = (short)std::min(greedsGulletHearts, owner.boneHearts + greedsGulletOverflow); + break; + default: + break; + } + if (greedsGulletHearts < before) + { + if (HasTrinket(TRINKET_MOTHERS_KISS)) + { + TryRemoveTrinket(TRINKET_MOTHERS_KISS); + before--; + } + while (greedsGulletHearts < before) + { + before--; + AddCoins(before < 3 ? -25 : before == 3 ? -24 : before == 4 ? -100 : -101); + } + } + + int target = GetGreedsGulletHearts(); + int current = greedsGulletHearts; + if (target != current || greedsGulletOverflow > 0) + reconstruction_missing("Entity_Player::update_greeds_gullet 007ce420 (Greed's Gullet hearts changing)"); + owner.isUpdatingGreedsGullet = false; + isUpdatingGreedsGullet = false; +} + +// 00759400 Adds coins, up to 99 (999 with Deep Pockets). Keeper heals with them first and keeps the rest. +void Entity_Player::AddCoins(int amount) +{ + int coins = amount; + if (amount > 0 && GetHealthType() == HEALTH_COIN) + { + int oldRedHearts = redHearts; + AddHearts(amount * 2, false, false); + coins = std::max(0, amount - (redHearts - oldRedHearts) / 2); + if (oldRedHearts < redHearts) AddImmaculateConceptionCounter(1); + } + + bool isDeepPockets = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_DEEP_POCKETS, LAZARUS_SHARE_CHECK); + numCoins = std::max(0, std::min(numCoins + coins, isDeepPockets ? DEEP_POCKETS_COIN_MAX : CONSUMABLE_MAX)); + ConsumableCountChanged(CONSUMABLE_COINS); + hud_refresh_players(); +} + +// 00759500 Adds bombs, up to 99. Tainted Blue Baby gets blue flies for bombs instead. +void Entity_Player::AddBombs(int amount) +{ + if (playerType == PLAYER_BLUEBABY_B && amount > 0) + { + AddBlueFlies(std::min(amount, BLUEBABY_B_POOP_CAP), pos, nullptr); + return; + } + numBombs = std::max(0, std::min(numBombs + amount, CONSUMABLE_MAX)); + ConsumableCountChanged(CONSUMABLE_BOMBS); + hud_refresh_players(); +} + +// 007595b0 Adds keys, up to 99. +void Entity_Player::AddKeys(int amount) +{ + numKeys = std::max(0, std::min(numKeys + amount, CONSUMABLE_MAX)); + ConsumableCountChanged(CONSUMABLE_KEYS); + hud_refresh_players(); +} + +// 007597e0 Shares the changed consumables with every player, as the run keeps one purse. Coins unlock their +// achievements. The deathmatch keeps each player's own. +void Entity_Player::ConsumableCountChanged(int bitflags) +{ + if (playerIndex < 0) return; + + Game& game = *g_game; + if (game.deathmatchManager.is_active()) + { + SyncConsumables(this, (uint32_t)bitflags); + return; + } + + PlayerManager& players = game.playerManager; + for (size_t i = 0; i < players.playerList.size(); i++) + SyncConsumables(players.GetPlayer((int)i), (uint32_t)bitflags); + if (!(bitflags & CONSUMABLE_COINS)) return; + + if (numCoins > COINS_UNLOCK_THRESHOLD - 1) g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_CAIN); + if (numCoins > CONSUMABLE_MAX - 1) game.gameStateFlags |= GAME_STATE_MAX_COINS_BIT; + if (numCoins < 1 && (game.gameStateFlags & GAME_STATE_MAX_COINS_BIT) && !game.isRestoringGlowingHourglassState && + !game.isStartingFromState && !hasCurseMistEffect) + g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_GOLDEN_RAZOR); +} + +// 007596a0 Copies the consumables a mask names to another player, and settles what depends on them there. +void Entity_Player::SyncConsumables(Entity_Player* target, uint32_t mask) +{ + if (mask & CONSUMABLE_COINS) + { + target->numCoins = numCoins; + if (target->isValid) + { + if (target->HasCollectible(COLLECTIBLE_MONEY_EQUALS_POWER)) + { + target->cacheFlags |= CACHE_DAMAGE; + target->EvaluateItems(); + } + target->update_greeds_gullet(); + } + } + if (mask & CONSUMABLE_KEYS) target->numKeys = numKeys; + if (mask & CONSUMABLE_BOMBS) + { + target->numBombs = numBombs; + target->numGigaBombs = std::min(numBombs, target->numGigaBombs); + } + if (mask & CONSUMABLE_GOLDEN_KEY) target->hasGoldenKey = hasGoldenKey; + if (mask & CONSUMABLE_GOLDEN_BOMB) target->hasGoldenBomb = hasGoldenBomb; + if (mask & CONSUMABLE_GIGA_BOMBS) target->numGigaBombs = std::min(numBombs, numGigaBombs); + if (mask & CONSUMABLE_SOUL_CHARGE) + { + int before = target->effectiveSoulCharge; + target->effectiveSoulCharge = effectiveSoulCharge; + if (target->isValid) target->apply_soul_charge_to_actives(before); + } + if (mask & CONSUMABLE_BLOOD_CHARGE) + { + int before = target->effectiveBloodCharge; + target->effectiveBloodCharge = effectiveBloodCharge; + if (target->isValid) target->blood_charge_changed(before); + } + if (mask & CONSUMABLE_POOP_MANA) target->poopMana = poopMana; +} diff --git a/src/entity_player_items.cpp b/src/entity_player_items.cpp new file mode 100644 index 0000000..ae45493 --- /dev/null +++ b/src/entity_player_items.cpp @@ -0,0 +1,469 @@ +#include "entity_player.h" +#include "game.h" +#include "room.h" +#include "log.h" +#include "manager.h" +#include "platform.h" + +constexpr int ROOM_TRINKET_ROLL_SHIFT = 13; +constexpr int RAINBOW_WORM_FRAMES = 90; +constexpr uint32_t DAILY_RAINBOW_TRINKETS = 28; +constexpr int ERROR_TRINKET_RANGE = 189; +constexpr uint32_t GRANTED_FIRE_MIND = 0x8; +constexpr uint32_t GRANTED_SCORPIO = 0x10; +constexpr uint32_t GRANTED_BALL_OF_TAR = 0x20; +constexpr uint32_t GRANTED_SACRED_HEART = 0x40; +constexpr int G_FUEL_SLOT = 143; +constexpr int G_FUEL_COLLECTIBLE_COUNT = 6; +constexpr int G_FUEL_STACKS = 8; +constexpr uint32_t G_FUEL_RNG_SHIFT = 8; +constexpr uint32_t USED_DIAPER_RNG_SHIFT = 4; +constexpr uint32_t USED_DIAPER_CHANCE = 33; +constexpr uint32_t SEEDED_VARIANT_RNG_SHIFT = 15; + +// The trinkets Rainbow Worm cycles through, and that daily 28 doubles. +constexpr std::array RAINBOW_WORM_TRINKETS = {9, 11, 65, 27, 10, 12, 26, 66, 96, 144}; +// The collectibles G FUEL! grants one of by the start seed. +constexpr std::array G_FUEL_COLLECTIBLES = { + COLLECTIBLE_SCORPIO, COLLECTIBLE_SPOON_BENDER, COLLECTIBLE_PLAYDOUGH_COOKIE, + COLLECTIBLE_FIRE_MIND, COLLECTIBLE_URANUS, COLLECTIBLE_CRICKETS_BODY}; + +// The familiars Cambion and Immaculate Conception grant, with the flag each sets once given. +struct ConceptionFamiliar +{ + int collectible = 0; + uint32_t flag = 0; +}; + +constexpr std::array CONCEPTION_FAMILIARS = {{{COLLECTIBLE_LEECH, 0x1}, + {COLLECTIBLE_DARK_BUM, 0x2}, + {COLLECTIBLE_DEMON_BABY, 0x4}, + {COLLECTIBLE_INCUBUS, 0x8}, + {COLLECTIBLE_LIL_BRIMSTONE, 0x10}, + {COLLECTIBLE_SUCCUBUS, 0x20}, + {COLLECTIBLE_GUARDIAN_ANGEL, 0x40}, + {COLLECTIBLE_HOLY_WATER, 0x80}, + {COLLECTIBLE_RELIC, 0x100}, + {COLLECTIBLE_SWORN_PROTECTOR, 0x200}, + {COLLECTIBLE_SERAPHIM, 0x400}, + {COLLECTIBLE_LIL_ABADDON, 0x800}, + {COLLECTIBLE_TWISTED_PAIR, 0x1000}}}; + +// The player whose items a co-op baby uses: its owner, or the first player. +static Entity_Player* item_owner_get(Entity_Player* player) +{ + while (player->variant == PLAYER_VARIANT_COOP_BABY) + { + Entity_Player* parentPlayer = player->parent ? player->parent->ToPlayer() : nullptr; + if (!parentPlayer) parentPlayer = g_game->GetPlayer(0); + if (!parentPlayer) break; + player = parentPlayer; + } + return player; +} + +// Whether a player's item counts while it is a co-op ghost or under Curse of the Mist: only quest items do. +static bool is_quest_item(ItemConfig_Item* item) +{ + return item && item->HasTags(TAG_QUEST); +} + +// 007706e0 Whether the player has a collectible: owned, or lent by a trinket, a seed, a character, a temporary effect, +// a wisp, Modeling Clay, a $3 Bill, Metronome or a conception. ITEM_CHECK_OWNED only looks at what it owns. +// Co-op babies ask their owner. Negative ids are procedural items. +bool Entity_Player::HasCollectible(int collectibleType, ItemCheck check) +{ + ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(collectibleType); + if (!item) return false; + + Entity_Player& owner = *item_owner_get(this); + Game& game = *g_game; + if (owner.isCoopGhost && !game.deathmatchManager.is_active() && !is_quest_item(item)) return false; + if (collectibleType < 0) + { + auto found = owner.proceduralItems.find(collectibleType); + return found != owner.proceduralItems.end() && found->second > 0; + } + if (check == ITEM_CHECK_MODIFIED) + if (std::optional lent = owner.collectible_lent(collectibleType, *item)) return *lent; + return owner.collectibleCounts[collectibleType] > 0; +} + +// Whether something other than owning it decides that the player has a collectible, as HasCollectible checks after +// the ownerless cases: Mysterious Paper's photos, trinkets, seeds, characters, Curse of the Mist (which takes it away), +// and the effects, wisps and items that lend one. Empty when only the owned count decides. +std::optional Entity_Player::collectible_lent(int collectibleType, ItemConfig_Item& item) +{ + Game& game = *g_game; + + if ((collectibleType == COLLECTIBLE_POLAROID || collectibleType == COLLECTIBLE_NEGATIVE) && + HasTrinket(TRINKET_MYSTERIOUS_PAPER)) + { + int phase = game.frameCount % 4; + bool isBoth = GetTrinketMultiplier(TRINKET_MYSTERIOUS_PAPER) >= 2 && phase <= 1; + int shown = phase == 0 ? COLLECTIBLE_POLAROID : COLLECTIBLE_NEGATIVE; + if (isBoth || ((phase == 0 || phase == 1) && collectibleType == shown)) return true; + } + + switch (collectibleType) + { + case COLLECTIBLE_HOLY_MANTLE: + if (playerType == PLAYER_THELOST || + (temporaryEffects.HasNullEffect(NULLITEM_LOST_CURSE) && playerType != PLAYER_THELOST_B)) + if (is_run_unlocked(ACHIEVEMENT_LOST_HOLDS_HOLY_MANTLE)) return true; + break; + case COLLECTIBLE_SKATOLE: + if (HasTrinket(TRINKET_USED_DIAPER)) + { + RoomDescriptor* room = game.room->descriptor; + RNG roomRng = rng_make(room ? room->decorationSeed : 0, USED_DIAPER_RNG_SHIFT); + if (roomRng.RandomInt(100) < USED_DIAPER_CHANCE || game.deathmatchManager.is_active()) return true; + } + break; + case COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE: + if ((playerType == PLAYER_JUDAS || playerType == PLAYER_BLACKJUDAS) && + HasCollectible(COLLECTIBLE_BIRTHRIGHT)) + return true; + break; + case COLLECTIBLE_SCORPIO: + if (grantedCollectibleFlags & GRANTED_SCORPIO) return true; + break; + case COLLECTIBLE_FIRE_MIND: + if (grantedCollectibleFlags & GRANTED_FIRE_MIND) return true; + break; + case COLLECTIBLE_BALL_OF_TAR: + if (grantedCollectibleFlags & GRANTED_BALL_OF_TAR) return true; + break; + case COLLECTIBLE_SACRED_HEART: + if (grantedCollectibleFlags & GRANTED_SACRED_HEART) return true; + break; + default: + break; + } + + int seededVariant = get_seeded_variant(); + if (collectibleType == COLLECTIBLE_SOY_MILK && seededVariant == 1) return true; + if (collectibleType == COLLECTIBLE_MUTANT_SPIDER && seededVariant == 2) return true; + if (g_fuel_count() > G_FUEL_STACKS) + { + RNG fuelRng = + rng_make(std::max(1u, (uint32_t)g_fuel_count() + game.seedEffects.GetStartSeed()), G_FUEL_RNG_SHIFT); + if (collectibleType == G_FUEL_COLLECTIBLES[fuelRng.RandomInt(G_FUEL_COLLECTIBLE_COUNT)]) return true; + } + if (IsInnateCollectible(collectibleType)) return true; + if (collectibleType == COLLECTIBLE_BRIMSTONE && temporaryEffects.HasCollectibleEffect(COLLECTIBLE_BRIMSTONE)) + return true; + if (isValid && item.HasTags(TAG_LAZ_SHARED) && backupPlayer && backupPlayer->HasCollectible(collectibleType)) + return true; + if (hasCurseMistEffect && !is_quest_item(&item) && collectibleType != COLLECTIBLE_SCHOOLBAG) return false; + + auto wisp = itemWispsList.find(collectibleType); + if (wisp != itemWispsList.end() && wisp->second > 0) return true; + if (modelingClayEffect != 0 && modelingClayEffect == collectibleType) return true; + if (extra_collectible_count(collectibleType) > 0) return true; + if (item.is_mom_item() && temporaryEffects.HasCollectibleEffect(collectibleType)) return true; + if (GetActiveItemSlot(collectibleType) >= 0) return true; + if (collectibleType != COLLECTIBLE_3_DOLLAR_BILL && HasCollectible(COLLECTIBLE_3_DOLLAR_BILL) && + collectibleType == threeDollarBillItem) + return true; + if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_METRONOME) && collectibleType == metronomeCollectibleId) + return true; + return std::nullopt; +} + +// The count a slot of extraCollectibleCounts holds for an id, or 0 past the end. +int Entity_Player::extra_collectible_count(int collectibleId) +{ + return collectibleId >= 0 && collectibleId < (int)extraCollectibleCounts.size() + ? extraCollectibleCounts[collectibleId] + : 0; +} + +// 00770ca0 How many copies of a collectible the player has: owned and active ones, then (unless only true items count) +// those Zodiac, the conceptions, its character, granted flags, seeds, Brimstone's effect, its Lazarus twin, wisps and +// lending items add. Co-op babies count their owner's. Actives are counted by slot, never as owned. +// The original reads a missing collectible's tags for co-op ghosts. Here a missing one counts as no quest item. +int Entity_Player::GetCollectibleNum(int collectibleId, ItemCheck check) +{ + if (collectibleId < 0 || collectibleId >= (int)collectibleCounts.size()) return 0; + if (variant == PLAYER_VARIANT_COOP_BABY) + if (Entity_Player* owner = GetMainPlayer()) return owner->GetCollectibleNum(collectibleId, check); + + ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(collectibleId); + int count = item && item->type == ITEM_ACTIVE ? 0 : collectibleCounts[collectibleId]; + if (isCoopGhost && !is_quest_item(item)) return 0; + for (ActiveItemDesc& active : activeItems) + if (active.item != 0 && active.item == collectibleId) count++; + if (check == ITEM_CHECK_OWNED) return count; + + if (hasCurseMistEffect && !is_quest_item(item) && collectibleId != COLLECTIBLE_SCHOOLBAG) count = 0; + count += conception_count(collectibleId); + if (IsInnateCollectible(collectibleId)) count++; + if (is_granted(collectibleId)) count++; + + int seededVariant = get_seeded_variant(); + if (collectibleId == COLLECTIBLE_SOY_MILK && seededVariant == 1) count++; + else if (collectibleId == COLLECTIBLE_MUTANT_SPIDER && seededVariant == 2) count += 3; + else if (collectibleId == COLLECTIBLE_BRIMSTONE) + { + TemporaryEffect* effect = + temporaryEffects.isDisabled ? nullptr : temporaryEffects.GetCollectibleEffect(COLLECTIBLE_BRIMSTONE); + count += effect ? effect->count : 0; + } + if (isValid && item && item->HasTags(TAG_LAZ_SHARED) && backupPlayer) + count += backupPlayer->GetCollectibleNum(collectibleId); + if (hasCurseMistEffect) return count; + + auto wisp = itemWispsList.find(collectibleId); + if (wisp != itemWispsList.end()) count += wisp->second; + if (modelingClayEffect != 0 && modelingClayEffect == collectibleId) count++; + count += extra_collectible_count(collectibleId); + if (item && item->is_mom_item()) count += temporaryEffects.GetCollectibleEffectNum(collectibleId); + if (collectibleId != COLLECTIBLE_3_DOLLAR_BILL && HasCollectible(COLLECTIBLE_3_DOLLAR_BILL) && + threeDollarBillItem != 0 && collectibleId == threeDollarBillItem) + count++; + if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_METRONOME) && metronomeCollectibleId != 0 && + collectibleId == metronomeCollectibleId) + count++; + return count; +} + +// The copies Zodiac and the conceptions add to a collectible, as GetCollectibleNum counts them. +int Entity_Player::conception_count(int collectibleId) +{ + if (collectibleId == COLLECTIBLE_ZODIAC || collectibleId == COLLECTIBLE_IMMACULATE_CONCEPTION || + collectibleId == COLLECTIBLE_CAMBION_CONCEPTION) + return 0; + + int count = HasCollectible(COLLECTIBLE_ZODIAC) && collectibleId == GetZodiacEffect() ? 1 : 0; + if (!HasCollectible(COLLECTIBLE_IMMACULATE_CONCEPTION) && !HasCollectible(COLLECTIBLE_CAMBION_CONCEPTION)) + return count; + for (const ConceptionFamiliar& familiar : CONCEPTION_FAMILIARS) + if (familiar.collectible == collectibleId && (conceptionFamiliarFlags & familiar.flag)) count++; + return count; +} + +// Whether the player's character or granted flags give it a copy of a collectible, as GetCollectibleNum counts them. +// The original counts Sacred Heart's grant flag towards The Wafer here, and towards Sacred Heart in HasCollectible. +bool Entity_Player::is_granted(int collectibleId) +{ + switch (collectibleId) + { + case COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE: + return (playerType == PLAYER_JUDAS || playerType == PLAYER_BLACKJUDAS) && + HasCollectible(COLLECTIBLE_BIRTHRIGHT); + case COLLECTIBLE_SCORPIO: + return grantedCollectibleFlags & GRANTED_SCORPIO; + case COLLECTIBLE_FIRE_MIND: + return grantedCollectibleFlags & GRANTED_FIRE_MIND; + case COLLECTIBLE_BALL_OF_TAR: + return grantedCollectibleFlags & GRANTED_BALL_OF_TAR; + case COLLECTIBLE_WAFER: + return grantedCollectibleFlags & GRANTED_SACRED_HEART; + default: + return false; + } +} + +// 00771200 Whether the player's character starts with a collectible for good: Cain's Lucky Foot, Eve's two, Samson's +// Bloody Lust, Lazarus's Anemic once unlocked, The Lost's Holy Mantle once unlocked, Lilith's two, Bethany's book. +// Netplay's per-player save data is offline: the local one decides. +bool Entity_Player::IsInnateCollectible(int collectibleId) +{ + switch (playerType) + { + case PLAYER_LILITH: + return collectibleId == COLLECTIBLE_INCUBUS || collectibleId == COLLECTIBLE_CAMBION_CONCEPTION; + case PLAYER_THELOST: + return collectibleId == COLLECTIBLE_HOLY_MANTLE && is_run_unlocked(ACHIEVEMENT_LOST_HOLDS_HOLY_MANTLE); + case PLAYER_CAIN: + return collectibleId == COLLECTIBLE_LUCKY_FOOT; + case PLAYER_EVE: + return collectibleId == COLLECTIBLE_WHORE_OF_BABYLON || collectibleId == COLLECTIBLE_DEAD_BIRD; + case PLAYER_SAMSON: + return collectibleId == COLLECTIBLE_BLOODY_LUST; + case PLAYER_LAZARUS: + case PLAYER_LAZARUS2: + if (collectibleId != COLLECTIBLE_ANEMIC || !is_run_unlocked(ACHIEVEMENT_LAZARUS_HOLDS_ANEMIA)) return false; + return playerType == PLAYER_LAZARUS2 || g_game->challenge == 0; + case PLAYER_BETHANY: + return g_game->challenge != CHALLENGE_BLOODY_MARY && g_game->challenge != CHALLENGE_BAPTISM_BY_FIRE && + collectibleId == COLLECTIBLE_BOOK_OF_VIRTUES; + default: + return false; + } +} + +// 00771410 Puts on the costumes of the character's innate collectibles, taking them out of the pools outside +// Cantripped, and takes off the costume of every other collectible the player neither has nor has as an effect. Eve +// never shows Whore of Babylon's costume until it triggers. +void Entity_Player::apply_innate_collectibles() +{ + ItemConfig& items = g_manager->itemConfig; + Game& game = *g_game; + + for (int id = 0; id < COLLECTIBLE_VANILLA_COUNT; id++) + { + if (!IsInnateCollectible(id)) + { + if (!HasCollectible(id) && !temporaryEffects.HasCollectibleEffect(id)) + if (ItemConfig_Item* item = items.GetCollectible(id)) RemoveCostume(item); + continue; + } + + if (game.challenge != CHALLENGE_CANTRIPPED) + { + if (id == COLLECTIBLE_WAIT_WHAT) + game.itemPool.RemoveCollectible(COLLECTIBLE_BUTTER_BEAN, REMOVE_ANY, REMOVE_APPLY); + if (id < (int)game.itemPool.removedCollectibles.size()) game.itemPool.removedCollectibles[id] = true; + } + if (id < (int)items.collectibles.size() && items.collectibles[id]) + AddCostume(items.collectibles[id].get(), false); + } + if (playerType == PLAYER_EVE) RemoveCostume(items.GetCollectible(COLLECTIBLE_WHORE_OF_BABYLON)); +} + +// 00771550 Whether the player has a trinket: held or smelted, or lent by the items that copy trinkets. ITEM_CHECK_OWNED +// only looks at the held slots, the second one only with Mom's Purse or Belly Button. +bool Entity_Player::HasTrinket(uint32_t trinketType, ItemCheck check) +{ + if (check == ITEM_CHECK_MODIFIED) return GetTrinketMultiplier(trinketType) > 0; + + int slots = HasCollectible(COLLECTIBLE_MOMS_PURSE) || HasCollectible(COLLECTIBLE_BELLY_BUTTON) ? 2 : 1; + for (int i = 0; i < slots; i++) + if ((trinkets[i] & TRINKET_ID_MASK) == trinketType) return true; + return false; +} + +// 007cb6e0 How strongly the player has a trinket: one per held copy (two when golden), one per smelted copy (two when +// golden), the queued one, a daily's bonus, Lil Larva for Blue Baby, and what Mysterious Paper, Rainbow Worm, Error, +// Missing Poster, Butt Penny's timer and Paper Clip's state lend, plus one for Mom's Box. Co-op babies ask their owner. +// Curse of the Mist and co-op ghosts keep only Lil Larva's. +int Entity_Player::GetTrinketMultiplier(uint32_t trinketType) +{ + Entity_Player& owner = *item_owner_get(this); + Game& game = *g_game; + uint32_t id = trinketType & TRINKET_ID_MASK; + + int multiplier = trinketType == TRINKET_LIL_LARVA && owner.playerType == PLAYER_BLUEBABY ? 1 : 0; + if (owner.hasCurseMistEffect || owner.isCoopGhost) return multiplier; + if (game.dailyChallenge._specialDailyId == DAILY_RAINBOW_TRINKETS && + std::ranges::find(RAINBOW_WORM_TRINKETS, (int)id) != RAINBOW_WORM_TRINKETS.end()) + multiplier++; + + if (std::optional lent = owner.trinket_lent(id, multiplier)) return *lent; + if (id != TRINKET_MYSTERIOUS_PAPER && id != TRINKET_RAINBOW_WORM && id != TRINKET_ERROR) + multiplier = owner.trinket_bonus(id, multiplier); + + int slots = owner.HasCollectible(COLLECTIBLE_MOMS_PURSE) || owner.HasCollectible(COLLECTIBLE_BELLY_BUTTON) ? 2 : 1; + for (int i = 0; i < slots; i++) + if ((owner.trinkets[i] & TRINKET_ID_MASK) == id) multiplier += owner.trinkets[i] & TRINKET_GOLDEN_FLAG ? 2 : 1; + ItemConfig_Item* queued = owner.queuedItem.item; + if (queued && queued->type == ITEM_TRINKET && (uint32_t)queued->id == id) + multiplier += owner.queuedItem.flags & QUEUED_GOLDEN ? 2 : 1; + if (id < owner.smeltedTrinkets.size()) + multiplier += owner.smeltedTrinkets[id].count + owner.smeltedTrinkets[id].goldenCount * 2; + if (id < owner.extraTrinketCounts.size() && owner.extraTrinketCounts[id] != 0) multiplier++; + if (multiplier > 0 && owner.HasCollectible(COLLECTIBLE_MOMS_BOX)) multiplier++; + return multiplier; +} + +// The whole multiplier when Mysterious Paper shows a trinket as its Missing Page, which GetTrinketMultiplier returns +// at once, or empty. +std::optional Entity_Player::trinket_lent(uint32_t id, int multiplier) +{ + if (id == TRINKET_MYSTERIOUS_PAPER || id == TRINKET_RAINBOW_WORM || id == TRINKET_ERROR || + id != TRINKET_MISSING_PAGE) + return std::nullopt; + + int paper = GetTrinketMultiplier(TRINKET_MYSTERIOUS_PAPER); + int phase = g_game->frameCount % 4; + if (paper > 0 && (phase == 2 || (paper > 1 && phase == 3))) return paper + multiplier; + return std::nullopt; +} + +// A trinket's multiplier with what Rainbow Worm, Error, Missing Poster, Butt Penny's timer and Paper Clip's state add. +// Error never lends Butter in the Pica Run, which also skips the rest. +int Entity_Player::trinket_bonus(uint32_t id, int multiplier) +{ + Game& game = *g_game; + + int worm = GetTrinketMultiplier(TRINKET_RAINBOW_WORM); + if (worm > 0 && (int)id == RAINBOW_WORM_TRINKETS[(uint32_t)(game.frameCount / RAINBOW_WORM_FRAMES) % 10]) + multiplier += worm; + + int error = GetTrinketMultiplier(TRINKET_ERROR); + if (error > 0) + { + if (id == TRINKET_BUTTER && game.challenge == CHALLENGE_PICA_RUN) return multiplier; + + RoomDescriptor* room = game.GetRoomByIdx(game.currentRoomIdx); + if (room->spawnSeed != 0) + { + RNG roomRng = rng_make(room->spawnSeed, ROOM_TRINKET_ROLL_SHIFT); + if (id == roomRng.RandomInt(ERROR_TRINKET_RANGE) + 1) multiplier += error; + } + } + + if (id == TRINKET_MISSING_POSTER) return multiplier + temporaryEffects.GetTrinketEffectNum(TRINKET_MISSING_POSTER); + if (id == TRINKET_BUTT_PENNY) return multiplier + (coopBabyBuffTimers[COOP_BABY_BUFF_COUNT - 1] > 0 ? 1 : 0); + if (id == TRINKET_PAPER_CLIP) return multiplier + (paperClipTimer > 0 ? 1 : 0); + return multiplier; +} + +// 007911c0 The active slot holding an item, or -1. +int Entity_Player::GetActiveItemSlot(int id) +{ + for (int slot = 0; slot < ACTIVE_SLOT_COUNT; slot++) + if (activeItems[slot].item == id) return slot; + return -1; +} + +// 007db860 How many G FUEL! stacks the player has under the G FUEL! seed, kept in an unused slot of the extra counts. +int Entity_Player::g_fuel_count() +{ + if (!g_game->seedEffects.HasSeedEffect(SEED_G_FUEL)) return 0; + return G_FUEL_SLOT < (int)extraCollectibleCounts.size() ? extraCollectibleCounts[G_FUEL_SLOT] : 0; +} + +// 007db8d0 Which seeded variant of Soy Milk and Mutant Spider the G FUEL! stacks give: -1 below two, then one per +// stack up to seven, then one rolled from the start seed. +int Entity_Player::get_seeded_variant() +{ + int stacks = g_fuel_count(); + if (stacks <= 1) return -1; + if (stacks <= G_FUEL_STACKS - 1) return stacks - 2; + + uint32_t startSeed = g_game->seedEffects.GetStartSeed(); + RNG rng = rng_make(std::max(1u, startSeed + (uint32_t)stacks), SEEDED_VARIANT_RNG_SHIFT); + return (int)(rng.Next() & 3) + 2; +} + +// 007ce270 The player a co-op baby belongs to: its parent player, or the first player. +Entity_Player* Entity_Player::GetMainPlayer() +{ + Entity_Player* owner = parent ? parent->ToPlayer() : nullptr; + if (owner) return owner; + return variant == PLAYER_VARIANT_COOP_BABY ? g_game->GetPlayer(0) : nullptr; +} + +// 00436160 Asks for stats to be evaluated again. +void Entity_Player::AddCacheFlags(uint32_t flags) +{ + cacheFlags |= flags; +} + +// 005b17c0 The player's generator for a collectible: the first for a negative id, the last past the end. +RNG& Entity_Player::GetCollectibleRNG(int id) +{ + if (id < 0) return collectibleRNGs.front(); + if (id >= (int)collectibleRNGs.size()) log_printf(LOG_ASSERT, "Collectible ID out of bounds!\n"); + return collectibleRNGs[std::min((size_t)id, collectibleRNGs.size() - 1)]; +} + +// 0065cf80 The player's generator for a trinket, the last for an id out of range. +RNG& Entity_Player::GetTrinketRNG(int id) +{ + if (id < 0 || id >= (int)trinketRNGs.size()) log_printf(LOG_ASSERT, "Trinket ID out of bounds!\n"); + return trinketRNGs[std::min((size_t)(uint32_t)id, trinketRNGs.size() - 1)]; +} diff --git a/src/entity_player_missing.cpp b/src/entity_player_missing.cpp new file mode 100644 index 0000000..e3b09d2 --- /dev/null +++ b/src/entity_player_missing.cpp @@ -0,0 +1,617 @@ +#include "entity_player.h" +#include "log.h" + +bool Entity_Player::TakeDamage(float, uint64_t, const EntityRef&, int) +{ + reconstruction_missing("Entity_Player::TakeDamage 007729d0"); +} +bool Entity_Player::TryThrow(const EntityRef&, const Vector&, float) +{ + reconstruction_missing("Entity_Player::TryThrow 007d2930"); +} +bool Entity_Player::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Player::HandleCollision 0078e1f0"); +} +void Entity_Player::AddCollectible(int, int, bool, int, int) +{ + reconstruction_missing("Entity_Player::AddCollectible 0075f0e0"); +} +void Entity_Player::AddActiveCharge(int, int, bool, bool, bool) +{ + reconstruction_missing("Entity_Player::AddActiveCharge 007915a0"); +} +void Entity_Player::RemoveCollectible(int, bool, int, bool) +{ + reconstruction_missing("Entity_Player::RemoveCollectible 0078f840"); +} +Entity_Familiar* Entity_Player::AddWisp(int, Vector, bool, bool) +{ + reconstruction_missing("Entity_Player::AddWisp 005c93b0"); +} +void Entity_Player::UseActiveItem(int, uint32_t, int) +{ + reconstruction_missing("Entity_Player::UseActiveItem 005b39d0"); +} +void Entity_Player::trigger_collectible_effect_removed(ItemConfig_Item*, int) +{ + reconstruction_missing("Entity_Player::trigger_collectible_effect_removed 00793970"); +} +int Entity_Player::GetBatteryCharge(int) { reconstruction_missing("Entity_Player::GetBatteryCharge 0042a2f0"); } +void Entity_Player::SetMinDamageCooldown(int) +{ + reconstruction_missing("Entity_Player::SetMinDamageCooldown 004361d0"); +} +int Entity_Player::GetActiveItem(int) { reconstruction_missing("Entity_Player::GetActiveItem 00505c80"); } +bool Entity_Player::AreControlsEnabled() { reconstruction_missing("Entity_Player::AreControlsEnabled 00505cc0"); } +bool Entity_Player::IsItemQueueEmpty() { reconstruction_missing("Entity_Player::IsItemQueueEmpty 0056ff90"); } +void Entity_Player::StopExtraAnimation() { reconstruction_missing("Entity_Player::StopExtraAnimation 0058e230"); } +bool Entity_Player::HasWeaponType(int) { reconstruction_missing("Entity_Player::HasWeaponType 005b1780"); } +void Entity_Player::moms_bracelet_grab() { reconstruction_missing("Entity_Player::moms_bracelet_grab 005b1a20"); } +void Entity_Player::UseRedKey() { reconstruction_missing("Entity_Player::UseRedKey 005b2360"); } +void Entity_Player::use_card_hagalaz(RNG*) { reconstruction_missing("Entity_Player::use_card_hagalaz 005b23f0"); } +int Entity_Player::reroll_collectibles_on_damage(RNG*, bool) +{ + reconstruction_missing("Entity_Player::reroll_collectibles_on_damage 005c88a0"); +} +Entity_Familiar* Entity_Player::AddItemWisp(int, Vector, bool) +{ + reconstruction_missing("Entity_Player::AddItemWisp 005c96f0"); +} +void Entity_Player::trigger_book_of_belial_passive(int, int) +{ + reconstruction_missing("Entity_Player::trigger_book_of_belial_passive 005c9930"); +} +void Entity_Player::TriggerBookOfVirtues(int, int) +{ + reconstruction_missing("Entity_Player::TriggerBookOfVirtues 005ca470"); +} +void Entity_Player::console_spawn(int*, bool) { reconstruction_missing("Entity_Player::console_spawn 005caa70"); } +void Entity_Player::update_mini_mush_costume() +{ + reconstruction_missing("Entity_Player::update_mini_mush_costume 005cb480"); +} +void Entity_Player::ResetDamageCooldown() { reconstruction_missing("Entity_Player::ResetDamageCooldown 0060d090"); } +Vector Entity_Player::SpriteScale() { reconstruction_missing("Entity_Player::SpriteScale 0060d0a0"); } +bool Entity_Player::IsP2Appearing() { reconstruction_missing("Entity_Player::IsP2Appearing 0065cf60"); } +ColorMod Entity_Player::get_laser_color_copy() +{ + reconstruction_missing("Entity_Player::get_laser_color_copy 00665c20"); +} +uint32_t Entity_Player::get_grid_collision_at(Vector) +{ + reconstruction_missing("Entity_Player::get_grid_collision_at 006b5fd0"); +} +bool Entity_Player::HasFullHearts() { reconstruction_missing("Entity_Player::HasFullHearts 006dacd0"); } +void Entity_Player::set_last_damage(uint64_t, const EntityRef&) +{ + reconstruction_missing("Entity_Player::set_last_damage 006dad80"); +} +void Entity_Player::SetSoulCharge(int) { reconstruction_missing("Entity_Player::SetSoulCharge 006f0020"); } +void Entity_Player::SetBloodCharge(int) { reconstruction_missing("Entity_Player::SetBloodCharge 006f0030"); } +PocketItem& Entity_Player::GetPocketItem(int) { reconstruction_missing("Entity_Player::GetPocketItem 00753900"); } +void Entity_Player::EnableWeaponType(int, bool) { reconstruction_missing("Entity_Player::EnableWeaponType 00753980"); } +void Entity_Player::QueueExtraAnimation(std::string_view) +{ + reconstruction_missing("Entity_Player::QueueExtraAnimation 007539c0"); +} +RNG& Entity_Player::GetPillRNG(int) { reconstruction_missing("Entity_Player::GetPillRNG 00753a00"); } +RNG& Entity_Player::GetCardRNG(int) { reconstruction_missing("Entity_Player::GetCardRNG 00753a60"); } +uint32_t Entity_Player::IsSubPlayer() { reconstruction_missing("Entity_Player::IsSubPlayer 00753ac0"); } +void Entity_Player::release_weapons_and_effects(bool) +{ + reconstruction_missing("Entity_Player::release_weapons_and_effects 00757ac0"); +} +uint32_t Entity_Player::InvalidateCoPlayerItems() +{ + reconstruction_missing("Entity_Player::InvalidateCoPlayerItems 007584b0"); +} +void Entity_Player::cycle_spectate_target() { reconstruction_missing("Entity_Player::cycle_spectate_target 007585b0"); } +void Entity_Player::trigger_max_hearts_removed(int) +{ + reconstruction_missing("Entity_Player::trigger_max_hearts_removed 00758850"); +} +void Entity_Player::AddEternalHearts(int) { reconstruction_missing("Entity_Player::AddEternalHearts 00758c20"); } +void Entity_Player::RemoveBlackHeart(int) { reconstruction_missing("Entity_Player::RemoveBlackHeart 007591e0"); } +bool Entity_Player::IsBlackHeart(int) { reconstruction_missing("Entity_Player::IsBlackHeart 00759220"); } +void Entity_Player::AddJarHearts(int) { reconstruction_missing("Entity_Player::AddJarHearts 00759390"); } +void Entity_Player::AddGoldenKey() { reconstruction_missing("Entity_Player::AddGoldenKey 00759620"); } +void Entity_Player::RemoveGoldenKey() { reconstruction_missing("Entity_Player::RemoveGoldenKey 00759660"); } +void Entity_Player::restore_curse_mist_backup(int*) +{ + reconstruction_missing("Entity_Player::restore_curse_mist_backup 00759950"); +} +Entity* Entity_Player::AddBlueFlies(int, Vector, Entity*) +{ + reconstruction_missing("Entity_Player::AddBlueFlies 007599d0"); +} +void Entity_Player::RemoveBlueFly() { reconstruction_missing("Entity_Player::RemoveBlueFly 00759b80"); } +void Entity_Player::AddLeprosy() { reconstruction_missing("Entity_Player::AddLeprosy 00759b90"); } +Entity* Entity_Player::AddBoneOrbital(Vector) { reconstruction_missing("Entity_Player::AddBoneOrbital 00759bc0"); } +Entity* Entity_Player::AddSwarmFlyOrbital(Vector) +{ + reconstruction_missing("Entity_Player::AddSwarmFlyOrbital 00759bf0"); +} +bool Entity_Player::TryUseKey() { reconstruction_missing("Entity_Player::TryUseKey 00759e20"); } +void Entity_Player::AddCostume(ItemConfig_Item*, bool) { reconstruction_missing("Entity_Player::AddCostume 0075d1d0"); } +void Entity_Player::AddNullCostume(int) { reconstruction_missing("Entity_Player::AddNullCostume 0075d800"); } +bool Entity_Player::IsNullItemCostumeVisible(int, int) +{ + reconstruction_missing("Entity_Player::IsNullItemCostumeVisible 0075d980"); +} +void Entity_Player::ClearQueueItem() { reconstruction_missing("Entity_Player::ClearQueueItem 0075e190"); } +bool Entity_Player::FlushQueueItem() { reconstruction_missing("Entity_Player::FlushQueueItem 0075e1d0"); } +void Entity_Player::IncrementPlayerFormCounter(int, int) +{ + reconstruction_missing("Entity_Player::IncrementPlayerFormCounter 0075e320"); +} +void Entity_Player::AddPlayerFormCostume(int) +{ + reconstruction_missing("Entity_Player::AddPlayerFormCostume 0075e9a0"); +} +void Entity_Player::SetItemState(int) { reconstruction_missing("Entity_Player::SetItemState 0075ea20"); } +int Entity_Player::GetCollectibleCount() { reconstruction_missing("Entity_Player::GetCollectibleCount 0075eff0"); } +void Entity_Player::RespawnFamiliars() { reconstruction_missing("Entity_Player::RespawnFamiliars 00770600"); } +void Entity_Player::GetNPCTarget() { reconstruction_missing("Entity_Player::GetNPCTarget 00770610"); } +bool Entity_Player::VoidHasCollectible(int) { reconstruction_missing("Entity_Player::VoidHasCollectible 007711a0"); } +bool Entity_Player::HasGoldenTrinket(uint32_t) { reconstruction_missing("Entity_Player::HasGoldenTrinket 00771620"); } +bool Entity_Player::TryHoldTrinket(int) { reconstruction_missing("Entity_Player::TryHoldTrinket 007716f0"); } +int Entity_Player::GetMaxTrinkets() { reconstruction_missing("Entity_Player::GetMaxTrinkets 007717c0"); } +Entity_Pickup* Entity_Player::DropTrinket(Vector, bool) +{ + reconstruction_missing("Entity_Player::DropTrinket 00771800"); +} +void Entity_Player::AddTrinket(int, bool) { reconstruction_missing("Entity_Player::AddTrinket 00771d30"); } +bool Entity_Player::TryRemoveTrinket(uint32_t) { reconstruction_missing("Entity_Player::TryRemoveTrinket 00771f60"); } +bool Entity_Player::TryRemoveSmeltedTrinket(uint32_t) +{ + reconstruction_missing("Entity_Player::TryRemoveSmeltedTrinket 00772260"); +} +bool Entity_Player::replace_trinket() { reconstruction_missing("Entity_Player::replace_trinket 00772530"); } +void Entity_Player::SetFullHearts() { reconstruction_missing("Entity_Player::SetFullHearts 007791f0"); } +Entity* Entity_Player::GetFocusEntity() { reconstruction_missing("Entity_Player::GetFocusEntity 00779320"); } +int Entity_Player::GetWeaponModifiers() { reconstruction_missing("Entity_Player::GetWeaponModifiers 00779a20"); } +void Entity_Player::update_shooting() { reconstruction_missing("Entity_Player::update_shooting 0077b020"); } +TearFlags Entity_Player::GetBombFlags(bool) { reconstruction_missing("Entity_Player::GetBombFlags 00780560"); } +TearFlags Entity_Player::check_bomb_tearflags(const TearFlags&) +{ + reconstruction_missing("Entity_Player::check_bomb_tearflags 00780ec0"); +} +void Entity_Player::update_bomb_input() { reconstruction_missing("Entity_Player::update_bomb_input 00780f40"); } +void Entity_Player::trigger_fire_item_effects(Vector, bool) +{ + reconstruction_missing("Entity_Player::trigger_fire_item_effects 007826d0"); +} +const char* Entity_Player::GetDeathAnimName() { reconstruction_missing("Entity_Player::GetDeathAnimName 007828f0"); } +Entity* Entity_Player::GetActiveWeaponEntity() +{ + reconstruction_missing("Entity_Player::GetActiveWeaponEntity 00782a40"); +} +uint32_t Entity_Player::CanTurnHead() { reconstruction_missing("Entity_Player::CanTurnHead 00782a60"); } +float Entity_Player::FireDelay() { reconstruction_missing("Entity_Player::FireDelay 00782a70"); } +void Entity_Player::RemoveCollectibleByHistoryIndex(int, bool) +{ + reconstruction_missing("Entity_Player::RemoveCollectibleByHistoryIndex 0078fec0"); +} +void Entity_Player::TriggerCollectibleRemoved(int) +{ + reconstruction_missing("Entity_Player::TriggerCollectibleRemoved 0078ff90"); +} +void Entity_Player::ClearTemporaryEffects() { reconstruction_missing("Entity_Player::ClearTemporaryEffects 007907a0"); } +int Entity_Player::GetTotalActiveCharge(int) { reconstruction_missing("Entity_Player::GetTotalActiveCharge 007910f0"); } +int Entity_Player::GetCollectibleMaxCharge(int, int) +{ + reconstruction_missing("Entity_Player::GetCollectibleMaxCharge 007911f0"); +} +int Entity_Player::GetActiveMaxCharge(int) { reconstruction_missing("Entity_Player::GetActiveMaxCharge 00791320"); } +void Entity_Player::SetActiveCharge(int, int) { reconstruction_missing("Entity_Player::SetActiveCharge 00791420"); } +void Entity_Player::SetActiveVarData(int, int) { reconstruction_missing("Entity_Player::SetActiveVarData 00791510"); } +void Entity_Player::ControlActiveItem(int) { reconstruction_missing("Entity_Player::ControlActiveItem 00791a40"); } +bool Entity_Player::HasTimedItem() { reconstruction_missing("Entity_Player::HasTimedItem 00793940"); } +void Entity_Player::update_effects() { reconstruction_missing("Entity_Player::update_effects 00794e50"); } +void Entity_Player::update_ladder() { reconstruction_missing("Entity_Player::update_ladder 0079f3c0"); } +void Entity_Player::trigger_npc_death(Entity*) { reconstruction_missing("Entity_Player::trigger_npc_death 007a0080"); } +Entity_Bomb* Entity_Player::FireBomb(Vector, Vector, Entity*) +{ + reconstruction_missing("Entity_Player::FireBomb 007a0970"); +} +bool Entity_Player::TriggerDeath(bool) { reconstruction_missing("Entity_Player::TriggerDeath 007a1090"); } +void Entity_Player::Revive() { reconstruction_missing("Entity_Player::Revive 007a2220"); } +void Entity_Player::ReviveFromTrinket(uint32_t) { reconstruction_missing("Entity_Player::ReviveFromTrinket 007a3430"); } +void Entity_Player::remove_twin() { reconstruction_missing("Entity_Player::remove_twin 007a37c0"); } +void Entity_Player::AddPocketItem(int, uint32_t) { reconstruction_missing("Entity_Player::AddPocketItem 007a3af0"); } +void Entity_Player::AddCard(int) { reconstruction_missing("Entity_Player::AddCard 007a3c10"); } +void Entity_Player::AddPill(int) { reconstruction_missing("Entity_Player::AddPill 007a3c30"); } +int Entity_Player::GetCard(int) { reconstruction_missing("Entity_Player::GetCard 007a3c50"); } +int Entity_Player::GetPill(int) { reconstruction_missing("Entity_Player::GetPill 007a3c80"); } +void Entity_Player::SetCard(int, int) { reconstruction_missing("Entity_Player::SetCard 007a3cb0"); } +void Entity_Player::SetPill(int, int) { reconstruction_missing("Entity_Player::SetPill 007a3cf0"); } +void Entity_Player::pocket_use_input() { reconstruction_missing("Entity_Player::pocket_use_input 007a3d30"); } +void Entity_Player::pockets_rotate() { reconstruction_missing("Entity_Player::pockets_rotate 007a42b0"); } +void Entity_Player::SwapActiveItems() { reconstruction_missing("Entity_Player::SwapActiveItems 007a4760"); } +void Entity_Player::RemovePocketItem(int) { reconstruction_missing("Entity_Player::RemovePocketItem 007a4850"); } +void Entity_Player::DropPocketItem(int, Vector) { reconstruction_missing("Entity_Player::DropPocketItem 007a48f0"); } +void Entity_Player::ShootCandle(Vector) { reconstruction_missing("Entity_Player::ShootCandle 007a6300"); } +int Entity_Player::GetTrinket(uint32_t) { reconstruction_missing("Entity_Player::GetTrinket 007a6430"); } +void Entity_Player::room_exit(bool) { reconstruction_missing("Entity_Player::room_exit 007a6680"); } +void Entity_Player::room_enter() { reconstruction_missing("Entity_Player::room_enter 007a6c50"); } +void Entity_Player::TriggerNewRoom_TemporaryEffects() +{ + reconstruction_missing("Entity_Player::TriggerNewRoom_TemporaryEffects 007a8350"); +} +void Entity_Player::TriggerRoomClear() { reconstruction_missing("Entity_Player::TriggerRoomClear 007a8fd0"); } +bool Entity_Player::HasPlayerForm(int) { reconstruction_missing("Entity_Player::HasPlayerForm 007aa7c0"); } +bool Entity_Player::CanAddCollectible(int) { reconstruction_missing("Entity_Player::CanAddCollectible 007aa800"); } +void Entity_Player::AnimatePickup(ANM2*, bool, std::string_view) +{ + reconstruction_missing("Entity_Player::AnimatePickup 007ab130"); +} +void Entity_Player::AnimateCollectible(int, std::string_view, std::string_view) +{ + reconstruction_missing("Entity_Player::AnimateCollectible 007ab380"); +} +void Entity_Player::AnimateTrinket(int, std::string_view, std::string_view) +{ + reconstruction_missing("Entity_Player::AnimateTrinket 007ab550"); +} +void Entity_Player::AnimateCard(int, std::string_view) +{ + reconstruction_missing("Entity_Player::AnimateCard 007ab6b0"); +} +void Entity_Player::AnimatePill(int, std::string_view) +{ + reconstruction_missing("Entity_Player::AnimatePill 007abb00"); +} +void Entity_Player::AnimateTrapdoor() { reconstruction_missing("Entity_Player::AnimateTrapdoor 007abc00"); } +void Entity_Player::AnimateLightTravel() { reconstruction_missing("Entity_Player::AnimateLightTravel 007abc10"); } +void Entity_Player::AnimatePitfallIn(bool) { reconstruction_missing("Entity_Player::AnimatePitfallIn 007abc20"); } +void Entity_Player::AnimatePitfallOut() { reconstruction_missing("Entity_Player::AnimatePitfallOut 007abc90"); } +void Entity_Player::AnimateAppear() { reconstruction_missing("Entity_Player::AnimateAppear 007abcb0"); } +void Entity_Player::AnimateTeleport(bool) { reconstruction_missing("Entity_Player::AnimateTeleport 007abcc0"); } +void Entity_Player::AnimateHappy() { reconstruction_missing("Entity_Player::AnimateHappy 007abd30"); } +void Entity_Player::AnimateSad() { reconstruction_missing("Entity_Player::AnimateSad 007abd90"); } +void Entity_Player::AddPrettyFly() { reconstruction_missing("Entity_Player::AddPrettyFly 007abdf0"); } +void Entity_Player::PlayExtraAnimation(std::string_view) +{ + reconstruction_missing("Entity_Player::PlayExtraAnimation 007abe20"); +} +void Entity_Player::active_used_post(int, bool, int) +{ + reconstruction_missing("Entity_Player::active_used_post 007abf80"); +} +void Entity_Player::DischargeActiveItem(uint32_t, bool) +{ + reconstruction_missing("Entity_Player::DischargeActiveItem 007ac7e0"); +} +void Entity_Player::TryRemoveTrinketCostume(int) +{ + reconstruction_missing("Entity_Player::TryRemoveTrinketCostume 007ad3a0"); +} +void Entity_Player::TryRemoveNullCostume(int) +{ + reconstruction_missing("Entity_Player::TryRemoveNullCostume 007ad400"); +} +uint32_t Entity_Player::GetMaxPocketItems() { reconstruction_missing("Entity_Player::GetMaxPocketItems 007ad440"); } +void Entity_Player::stop_costume_item_anims() +{ + reconstruction_missing("Entity_Player::stop_costume_item_anims 007ad4e0"); +} +void Entity_Player::ClearCollectibleAnim(int) +{ + reconstruction_missing("Entity_Player::ClearCollectibleAnim 007ad5a0"); +} +bool Entity_Player::IsCollectibleAnimFinished(int, std::string_view) +{ + reconstruction_missing("Entity_Player::IsCollectibleAnimFinished 007ad680"); +} +void Entity_Player::TriggerTrinketAdded(uint32_t, bool) +{ + reconstruction_missing("Entity_Player::TriggerTrinketAdded 007ad860"); +} +void Entity_Player::TriggerTrinketRemoved(uint32_t) +{ + reconstruction_missing("Entity_Player::TriggerTrinketRemoved 007adb30"); +} +void Entity_Player::RestoreGameState(GameStatePlayer*) +{ + reconstruction_missing("Entity_Player::RestoreGameState 007ae4b0"); +} +bool Entity_Player::try_trigger_astral_projection() +{ + reconstruction_missing("Entity_Player::try_trigger_astral_projection 007afc20"); +} +void Entity_Player::spawn_dark_esau(void*) { reconstruction_missing("Entity_Player::spawn_dark_esau 007b0070"); } +void Entity_Player::DonateLuck(int) { reconstruction_missing("Entity_Player::DonateLuck 007b2200"); } +void Entity_Player::UseCard(int, uint32_t) { reconstruction_missing("Entity_Player::UseCard 007b2230"); } +void Entity_Player::update_footprints() { reconstruction_missing("Entity_Player::update_footprints 007b8cb0"); } +void Entity_Player::SetFootprintColor(KColor, bool) +{ + reconstruction_missing("Entity_Player::SetFootprintColor 007b98c0"); +} +bool Entity_Player::is_footstep_triggered(int) +{ + reconstruction_missing("Entity_Player::is_footstep_triggered 007b9940"); +} +void Entity_Player::update_pitfall() { reconstruction_missing("Entity_Player::update_pitfall 007b9b50"); } +void Entity_Player::TryDecreaseGlowingHourglassUses(int, bool) +{ + reconstruction_missing("Entity_Player::TryDecreaseGlowingHourglassUses 007b9e10"); +} +bool Entity_Player::GetMouseAimTarget(Vector&, bool) +{ + reconstruction_missing("Entity_Player::GetMouseAimTarget 007b9f60"); +} +void Entity_Player::update_baby_skin_effects() +{ + reconstruction_missing("Entity_Player::update_baby_skin_effects 007ba2b0"); +} +void Entity_Player::coop_baby_death_effect() +{ + reconstruction_missing("Entity_Player::coop_baby_death_effect 007bb5e0"); +} +void Entity_Player::InitBabySkin() { reconstruction_missing("Entity_Player::InitBabySkin 007bf040"); } +Entity_Laser* Entity_Player::FireDelayedBrimstone(float, Entity*) +{ + reconstruction_missing("Entity_Player::FireDelayedBrimstone 007bf1a0"); +} +bool Entity_Player::CanPickupItem() { reconstruction_missing("Entity_Player::CanPickupItem 007bf3d0"); } +bool Entity_Player::IsHeldItemVisible() { reconstruction_missing("Entity_Player::IsHeldItemVisible 007bf5c0"); } +void Entity_Player::AddBlueSpider(Vector) { reconstruction_missing("Entity_Player::AddBlueSpider 007bf5f0"); } +Entity_Familiar* Entity_Player::ThrowBlueSpider(Vector, Vector) +{ + reconstruction_missing("Entity_Player::ThrowBlueSpider 007bf640"); +} +void Entity_Player::RemoveBlueSpider() { reconstruction_missing("Entity_Player::RemoveBlueSpider 007bf660"); } +int Entity_Player::GetExtraLives() { reconstruction_missing("Entity_Player::GetExtraLives 007bf670"); } +uint32_t Entity_Player::GetGlitchBabySubType() +{ + reconstruction_missing("Entity_Player::GetGlitchBabySubType 007c2e90"); +} +bool Entity_Player::HasInvincibility(uint64_t, const EntityRef&) +{ + reconstruction_missing("Entity_Player::HasInvincibility 007c3100"); +} +bool Entity_Player::HasPoisonImmunity() { reconstruction_missing("Entity_Player::HasPoisonImmunity 007c3320"); } +bool Entity_Player::CanCrushRocks() { reconstruction_missing("Entity_Player::CanCrushRocks 007c3380"); } +bool Entity_Player::CanPickRedHearts() { reconstruction_missing("Entity_Player::CanPickRedHearts 007c3410"); } +bool Entity_Player::CanPickSoulHearts() { reconstruction_missing("Entity_Player::CanPickSoulHearts 007c3460"); } +bool Entity_Player::CanPickBlackHearts() { reconstruction_missing("Entity_Player::CanPickBlackHearts 007c3550"); } +void Entity_Player::RemoveSkinCostume() { reconstruction_missing("Entity_Player::RemoveSkinCostume 007c3620"); } +void Entity_Player::ResetItemState() { reconstruction_missing("Entity_Player::ResetItemState 007c36b0"); } +void Entity_Player::SetShootingCooldown(int) { reconstruction_missing("Entity_Player::SetShootingCooldown 007c37f0"); } +bool Entity_Player::NeedsCharge(int) { reconstruction_missing("Entity_Player::NeedsCharge 007c3810"); } +bool Entity_Player::FullCharge(int, bool, bool) { reconstruction_missing("Entity_Player::FullCharge 007c38c0"); } +void Entity_Player::add_random_stat_up(RNG*) { reconstruction_missing("Entity_Player::add_random_stat_up 007c3980"); } +void Entity_Player::preload_item_sounds() { reconstruction_missing("Entity_Player::preload_item_sounds 007c3a60"); } +bool Entity_Player::CanUsePill(int) { reconstruction_missing("Entity_Player::CanUsePill 007c40e0"); } +void Entity_Player::UsePill(int, int, uint32_t) { reconstruction_missing("Entity_Player::UsePill 007c4180"); } +void Entity_Player::AddDeadEyeCharge() { reconstruction_missing("Entity_Player::AddDeadEyeCharge 007c78b0"); } +void Entity_Player::ClearDeadEyeCharge() { reconstruction_missing("Entity_Player::ClearDeadEyeCharge 007c78e0"); } +int Entity_Player::GetZodiacEffect() { reconstruction_missing("Entity_Player::GetZodiacEffect 007c7960"); } +void Entity_Player::update_purity_glow() { reconstruction_missing("Entity_Player::update_purity_glow 007c7c60"); } +void Entity_Player::trigger_immaculate_conception(bool) +{ + reconstruction_missing("Entity_Player::trigger_immaculate_conception 007c7d70"); +} +void Entity_Player::AddImmaculateConceptionCounter(int) +{ + reconstruction_missing("Entity_Player::AddImmaculateConceptionCounter 007c8050"); +} +void Entity_Player::dash_impact() { reconstruction_missing("Entity_Player::dash_impact 007c8240"); } +void Entity_Player::spawn_locusts() { reconstruction_missing("Entity_Player::spawn_locusts 007c8830"); } +Entity_Laser* Entity_Player::SpawnMawOfVoid(int) { reconstruction_missing("Entity_Player::SpawnMawOfVoid 007c8dc0"); } +void Entity_Player::AddGoldenBomb() { reconstruction_missing("Entity_Player::AddGoldenBomb 007c8f80"); } +void Entity_Player::RemoveGoldenBomb() { reconstruction_missing("Entity_Player::RemoveGoldenBomb 007c8fc0"); } +void Entity_Player::AddDollarBillEffect() { reconstruction_missing("Entity_Player::AddDollarBillEffect 007c9000"); } +int Entity_Player::GetCambionPregnancyLevel() +{ + reconstruction_missing("Entity_Player::GetCambionPregnancyLevel 007c90b0"); +} +Entity* Entity_Player::ShootRedCandle(Vector) { reconstruction_missing("Entity_Player::ShootRedCandle 007c9130"); } +Entity* Entity_Player::ShootBlueCandle(Vector) { reconstruction_missing("Entity_Player::ShootBlueCandle 007c9350"); } +void Entity_Player::DoZitEffect(Vector) { reconstruction_missing("Entity_Player::DoZitEffect 007c9590"); } +void Entity_Player::apply_victory_lap_penalty(uint32_t) +{ + reconstruction_missing("Entity_Player::apply_victory_lap_penalty 007c97f0"); +} +float Entity_Player::get_voice_pitch() { reconstruction_missing("Entity_Player::get_voice_pitch 007c9ad0"); } +void Entity_Player::AddJarFlies(int) { reconstruction_missing("Entity_Player::AddJarFlies 007c9bb0"); } +bool Entity_Player::IsPosInSpotLight(Vector) { reconstruction_missing("Entity_Player::IsPosInSpotLight 007c9c00"); } +void Entity_Player::AddGoldenHearts(int, bool) { reconstruction_missing("Entity_Player::AddGoldenHearts 007c9d10"); } +bool Entity_Player::CanPickGoldenHearts() { reconstruction_missing("Entity_Player::CanPickGoldenHearts 007c9e30"); } +void Entity_Player::BreakGoldenHearts(int) { reconstruction_missing("Entity_Player::BreakGoldenHearts 007ca2d0"); } +void Entity_Player::AddBoneHearts(int) { reconstruction_missing("Entity_Player::AddBoneHearts 007ca840"); } +bool Entity_Player::CanPickBoneHearts() { reconstruction_missing("Entity_Player::CanPickBoneHearts 007caa00"); } +bool Entity_Player::IsBoneHeart(int) { reconstruction_missing("Entity_Player::IsBoneHeart 007caaa0"); } +bool Entity_Player::TryPreventDeath() { reconstruction_missing("Entity_Player::TryPreventDeath 007caad0"); } +void Entity_Player::apply_coop_baby_spawn_bonus() +{ + reconstruction_missing("Entity_Player::apply_coop_baby_spawn_bonus 007cb090"); +} +bool Entity_Player::WillPlayerRevive() { reconstruction_missing("Entity_Player::WillPlayerRevive 007cbb60"); } +float Entity_Player::GetGreedDonationBreakChance() +{ + reconstruction_missing("Entity_Player::GetGreedDonationBreakChance 007cbb70"); +} +float Entity_Player::GetGreedDonationJamChance(PersistentGameData&) +{ + reconstruction_missing("Entity_Player::GetGreedDonationJamChance 007cbb90"); +} +void Entity_Player::hallowed_ground_add(int) { reconstruction_missing("Entity_Player::hallowed_ground_add 007cbc60"); } +void Entity_Player::resolve_tainted_soul() { reconstruction_missing("Entity_Player::resolve_tainted_soul 007cbcb0"); } +void Entity_Player::init_forgotten_twin() { reconstruction_missing("Entity_Player::init_forgotten_twin 007cbcd0"); } +Entity* Entity_Player::spawn_forgotten_body() +{ + reconstruction_missing("Entity_Player::spawn_forgotten_body 007cbef0"); +} +bool Entity_Player::SwapForgottenForm(bool, bool) +{ + reconstruction_missing("Entity_Player::SwapForgottenForm 007cc200"); +} +bool Entity_Player::CanRerollCollectible(int, bool) +{ + reconstruction_missing("Entity_Player::CanRerollCollectible 007ce2a0"); +} +void Entity_Player::ChangePlayerType(int, bool) { reconstruction_missing("Entity_Player::ChangePlayerType 007ce6e0"); } +void Entity_Player::player_type_change_prepare(int) +{ + reconstruction_missing("Entity_Player::player_type_change_prepare 007cf610"); +} +bool Entity_Player::IsLocalPlayer() { reconstruction_missing("Entity_Player::IsLocalPlayer 007cf8c0"); } +void Entity_Player::GetGlyphOfBalanceDrop(int*, int*) +{ + reconstruction_missing("Entity_Player::GetGlyphOfBalanceDrop 007d12c0"); +} +Vector Entity_Player::GetEnterPosition() { reconstruction_missing("Entity_Player::GetEnterPosition 007d1620"); } +Entity_Familiar* Entity_Player::AddMinisaac(Vector, bool) +{ + reconstruction_missing("Entity_Player::AddMinisaac 007d1860"); +} +uint32_t Entity_Player::play_hurt_effects() { reconstruction_missing("Entity_Player::play_hurt_effects 007d1c10"); } +Entity_Player* Entity_Player::InitTwin(int) { reconstruction_missing("Entity_Player::InitTwin 007d2000"); } +bool Entity_Player::TryHoldEntity(Entity*) { reconstruction_missing("Entity_Player::TryHoldEntity 007d2170"); } +Entity* Entity_Player::ThrowHeldEntity(Vector) { reconstruction_missing("Entity_Player::ThrowHeldEntity 007d2470"); } +void Entity_Player::AddFriendlyDip(int, Vector) { reconstruction_missing("Entity_Player::AddFriendlyDip 007d2a00"); } +void Entity_Player::ThrowFriendlyDip(int, Vector, Vector) +{ + reconstruction_missing("Entity_Player::ThrowFriendlyDip 007d2a20"); +} +void Entity_Player::AddSoulCharge(int) { reconstruction_missing("Entity_Player::AddSoulCharge 007d2ad0"); } +int Entity_Player::GetEffectiveSoulCharge() +{ + reconstruction_missing("Entity_Player::GetEffectiveSoulCharge 007d2b50"); +} +void Entity_Player::apply_soul_charge_to_actives(int) +{ + reconstruction_missing("Entity_Player::apply_soul_charge_to_actives 007d2b70"); +} +void Entity_Player::AddBloodCharge(int) { reconstruction_missing("Entity_Player::AddBloodCharge 007d2d40"); } +int Entity_Player::GetEffectiveBloodCharge() +{ + reconstruction_missing("Entity_Player::GetEffectiveBloodCharge 007d2dd0"); +} +void Entity_Player::blood_charge_changed(int) +{ + reconstruction_missing("Entity_Player::blood_charge_changed 007d2df0"); +} +void Entity_Player::AddRottenHearts(int, bool) { reconstruction_missing("Entity_Player::AddRottenHearts 007d2fc0"); } +bool Entity_Player::CanPickRottenHearts() { reconstruction_missing("Entity_Player::CanPickRottenHearts 007d3180"); } +void Entity_Player::UpdateBookOfVirtues(bool) { reconstruction_missing("Entity_Player::UpdateBookOfVirtues 007d3200"); } +void Entity_Player::trigger_vampire_charm_kill() +{ + reconstruction_missing("Entity_Player::trigger_vampire_charm_kill 007d3350"); +} +void Entity_Player::AddUrnSouls(uint32_t) { reconstruction_missing("Entity_Player::AddUrnSouls 007d3480"); } +void Entity_Player::AddGigaBombs(int) { reconstruction_missing("Entity_Player::AddGigaBombs 007d34f0"); } +bool Entity_Player::try_end_astral_projection() +{ + reconstruction_missing("Entity_Player::try_end_astral_projection 007d35b0"); +} +void Entity_Player::fire_saturnus_tears() { reconstruction_missing("Entity_Player::fire_saturnus_tears 007d3e40"); } +int Entity_Player::GetMaxInventorySize() { reconstruction_missing("Entity_Player::GetMaxInventorySize 007d4150"); } +bool Entity_Player::CanAddCollectibleToInventory(int) +{ + reconstruction_missing("Entity_Player::CanAddCollectibleToInventory 007d4170"); +} +void Entity_Player::SetPocketActiveItem(int, int, bool) +{ + reconstruction_missing("Entity_Player::SetPocketActiveItem 007d41d0"); +} +void Entity_Player::get_salvation_scale() { reconstruction_missing("Entity_Player::get_salvation_scale 007d4340"); } +void Entity_Player::update_suplex() { reconstruction_missing("Entity_Player::update_suplex 007d4390"); } +uint32_t Entity_Player::bag_of_crafting_collect(Entity_Pickup*) +{ + reconstruction_missing("Entity_Player::bag_of_crafting_collect 007d5170"); +} +int Entity_Player::GetMaxPoopMana() { reconstruction_missing("Entity_Player::GetMaxPoopMana 007d65c0"); } +void Entity_Player::AddPoopMana(int) { reconstruction_missing("Entity_Player::AddPoopMana 007d65e0"); } +void Entity_Player::poop_spell_roll() { reconstruction_missing("Entity_Player::poop_spell_roll 007d6670"); } +void Entity_Player::UsePoopSpell(uint32_t) { reconstruction_missing("Entity_Player::UsePoopSpell 007d7290"); } +void Entity_Player::RecomputeWispCollectibles(Entity_Familiar*) +{ + reconstruction_missing("Entity_Player::RecomputeWispCollectibles 007d7740"); +} +void Entity_Player::trigger_cracked_orb(Vector) +{ + reconstruction_missing("Entity_Player::trigger_cracked_orb 007d7c30"); +} +uint32_t Entity_Player::AddItemCard(uint32_t) { reconstruction_missing("Entity_Player::AddItemCard 007d8240"); } +void Entity_Player::spawn_lil_clot_familiars() +{ + reconstruction_missing("Entity_Player::spawn_lil_clot_familiars 007d83f0"); +} +void Entity_Player::creep_contact_add(int, int) { reconstruction_missing("Entity_Player::creep_contact_add 007d8740"); } +bool Entity_Player::spawn_ghost_corpse() { reconstruction_missing("Entity_Player::spawn_ghost_corpse 007d87a0"); } +void Entity_Player::AddCurseMistEffect() { reconstruction_missing("Entity_Player::AddCurseMistEffect 007d8980"); } +void Entity_Player::RemoveCurseMistEffect() { reconstruction_missing("Entity_Player::RemoveCurseMistEffect 007d8d20"); } +void Entity_Player::AttachMinecart(Entity_NPC*) { reconstruction_missing("Entity_Player::AttachMinecart 007d9180"); } +void Entity_Player::add_samson_berserk_charge(int) +{ + reconstruction_missing("Entity_Player::add_samson_berserk_charge 007d9200"); +} +void Entity_Player::RevivePlayerGhost() { reconstruction_missing("Entity_Player::RevivePlayerGhost 007d93b0"); } +void Entity_Player::MorphToCoopGhost() { reconstruction_missing("Entity_Player::MorphToCoopGhost 007d96f0"); } +void Entity_Player::reset_body_sprite() { reconstruction_missing("Entity_Player::reset_body_sprite 007d9b70"); } +uint32_t* Entity_Player::CalculateBagOfCraftingOutput(uint32_t*, const char*, bool) +{ + reconstruction_missing("Entity_Player::CalculateBagOfCraftingOutput 007d9d00"); +} +void Entity_Player::SpawnClot(Vector, bool) { reconstruction_missing("Entity_Player::SpawnClot 007da810"); } +bool Entity_Player::TryForgottenThrow(Vector) { reconstruction_missing("Entity_Player::TryForgottenThrow 007dac80"); } +void Entity_Player::ResetPlayer() { reconstruction_missing("Entity_Player::ResetPlayer 007daed0"); } +void Entity_Player::remove_wooden_cross_mantles() +{ + reconstruction_missing("Entity_Player::remove_wooden_cross_mantles 007db160"); +} +bool Entity_Player::HasInstantDeathCurse() { reconstruction_missing("Entity_Player::HasInstantDeathCurse 007db6b0"); } +void Entity_Player::TriggerEchoChamber(uint32_t, int) +{ + reconstruction_missing("Entity_Player::TriggerEchoChamber 007db740"); +} +bool Entity_Player::is_evil_charm_immune(EntityRef) +{ + reconstruction_missing("Entity_Player::is_evil_charm_immune 007dba30"); +} +void Entity_Player::add_random_drug_item_effect() +{ + reconstruction_missing("Entity_Player::add_random_drug_item_effect 007dbba0"); +} +void Entity_Player::AddRandomMomItemEffect() +{ + reconstruction_missing("Entity_Player::AddRandomMomItemEffect 007dbc80"); +} +void Entity_Player::ModelingClay_roll(RNG*) { reconstruction_missing("Entity_Player::ModelingClay_roll 007dbd70"); } +void Entity_Player::twins_duplicate_familiars(int) +{ + reconstruction_missing("Entity_Player::twins_duplicate_familiars 007dbeb0"); +} +const std::string& Entity_Player::GetName() { reconstruction_missing("Entity_Player::GetName 007e9280"); } +void Entity_Player::TriggerRoomExit() { reconstruction_missing("Entity_Player::TriggerRoomExit 00832850"); } +int Entity_Player::GetActiveSubCharge(int) { reconstruction_missing("Entity_Player::GetActiveSubCharge 00841cb0"); } +int Entity_Player::GetPoopSpell(int) { reconstruction_missing("Entity_Player::GetPoopSpell 00841cd0"); } +bool Entity_Player::HasFullHeartsAndSoulHearts() +{ + reconstruction_missing("Entity_Player::HasFullHeartsAndSoulHearts 0085e200"); +} +void Entity_Player::AddControlsCooldown(int) { reconstruction_missing("Entity_Player::AddControlsCooldown 0085e260"); } +uint64_t Entity_Player::GetLastDamageFlags() { reconstruction_missing("Entity_Player::GetLastDamageFlags 0085e280"); } +void Entity_Player::CheckPoopSpellQueue(Vector) +{ + reconstruction_missing("Entity_Player::CheckPoopSpellQueue 0095ffb0"); +} +void Entity_Player::StoreGameState(GameStatePlayer*, bool) +{ + reconstruction_missing("Entity_Player::StoreGameState 007b0be0"); +} +void Entity_Player::PlayCollectibleAnim(int, bool, std::string_view, int) +{ + reconstruction_missing("Entity_Player::PlayCollectibleAnim 00759f50"); +} +void Entity_Player::PlayExtraAnimation(std::string_view, bool) +{ + reconstruction_missing("Entity_Player::PlayExtraAnimation 007abe90"); +} +void History::AddHistoryItem(const HistoryItem&) { reconstruction_missing("History::AddHistoryItem 00721a70"); } +bool History::RemoveHistoryItemByIndex(int) { reconstruction_missing("History::RemoveHistoryItemByIndex 00721c00"); } +void History::merge(History&) { reconstruction_missing("History::merge 00721c80"); } +void History::remove_index_refs(int) { reconstruction_missing("History::remove_index_refs 007220a0"); } diff --git a/src/entity_projectile.cpp b/src/entity_projectile.cpp new file mode 100644 index 0000000..fd2b118 --- /dev/null +++ b/src/entity_projectile.cpp @@ -0,0 +1,102 @@ +#include "entity_projectile.h" +#include "log.h" + +constexpr int PROJECTILE_MEAT = 11; + +// 00652f60 Only a Globin's meat shot holds the doors shut, unless nothing can stop it. +bool Entity_Projectile::CanShutDoors() +{ + return variant == PROJECTILE_MEAT && !(projectileFlags & PROJECTILE_CANT_BE_STOPPED); +} + +// 00456420 Raises it. +void Entity_Projectile::AddHeight(float amount) +{ + height = amount + height; +} + +// 00456450 Speeds its fall. +void Entity_Projectile::AddFallingSpeed(float amount) +{ + fallingSpeed = amount + fallingSpeed; +} + +// 00456470 Strengthens its gravity. +void Entity_Projectile::AddFallingAccel(float amount) +{ + fallingAccel = amount + fallingAccel; +} + +// 00456490 Sets projectile flags. +void Entity_Projectile::AddProjectileFlags(uint64_t added) +{ + projectileFlags |= added; +} + +// 006b82f0 Sets the flags it takes when its change timeout ends. +void Entity_Projectile::AddChangeFlags(uint64_t added) +{ + changeFlags |= added; +} + +// 0085e320 Grows it. +void Entity_Projectile::AddScale(float amount) +{ + scale = amount + scale; +} + +// The rest of Entity_Projectile is not reconstructed yet. + +// 00652b90 +void Entity_Projectile::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Projectile::Init 00652b90"); +} + +// 00653070 +void Entity_Projectile::Update() +{ + reconstruction_missing("Entity_Projectile::Update 00653070"); +} + +// 0065c510 +void Entity_Projectile::Interpolate() +{ + reconstruction_missing("Entity_Projectile::Interpolate 0065c510"); +} + +// 0065cb60 +void Entity_Projectile::Render(const Vector&) +{ + reconstruction_missing("Entity_Projectile::Render 0065cb60"); +} + +// 0065b670 +bool Entity_Projectile::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Projectile::HandleCollision 0065b670"); +} + +// 00652fa0 +void Entity_Projectile::Reflect(Entity*, const Vector&) +{ + reconstruction_missing("Entity_Projectile::Reflect 00652fa0"); +} + +// 0065b500 +void Entity_Projectile::update_height_collision() +{ + reconstruction_missing("Entity_Projectile::update_height_collision 0065b500"); +} + +// 00675fc0 +void Entity_Projectile::SetHeight(float) +{ + reconstruction_missing("Entity_Projectile::SetHeight 00675fc0"); +} + +// 0067a080 +void Entity_Projectile::Deflect(Entity*, const Vector&) +{ + reconstruction_missing("Entity_Projectile::Deflect 0067a080"); +} diff --git a/src/entity_projectile.h b/src/entity_projectile.h new file mode 100644 index 0000000..08cc525 --- /dev/null +++ b/src/entity_projectile.h @@ -0,0 +1,54 @@ +#pragma once + +#include "entity.h" + +// Lua's ProjectileFlags that the entity list reads. +enum ProjectileFlag : uint64_t +{ + PROJECTILE_HIT_ENEMIES = 1ull << 7, + PROJECTILE_CANT_BE_STOPPED = 1ull << 31, + PROJECTILE_SHIELDED = 1ull << 44 +}; + +// Construction and destruction (00652b50, 00652b00) are the defaults. +// Field accessors (00417830, 00444c90, 00447740, 004b70a0, 004d3060, 004d3070, 0085e300, 0085e310, 0085e360) are the +// public fields. +// An enemy shot (Lua's EntityProjectile): its height and fall, damage, homing and curving, and the projectile flags +// that change how it flies and what it does when it lands. +struct Entity_Projectile : Entity +{ + uint64_t changeFlags = 0; + uint64_t projectileFlags = 0; + float acceleration = 0; + float changeVelocity = 0; + float curvingStrength = 0; + float damage = 0; + float fallingAccel = 0; + float fallingSpeed = 0; + float height = 0; + float homingStrength = 0; + float orbitDistance = 0; + float scale = 0; + int animKey = 0; + int changeTimeout = 0; + int wiggleFrameOffset = 0; + bool isRenderedAtGround = false; + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + bool CanShutDoors() override; + bool HandleCollision(Entity* collider, bool isLow) override; + + void AddHeight(float amount); + void AddFallingSpeed(float amount); + void AddFallingAccel(float amount); + void AddProjectileFlags(uint64_t added); + void Reflect(Entity* unused, const Vector& newVelocity); + void update_height_collision(); + void SetHeight(float height); + void Deflect(Entity* newSpawner, const Vector& velocity); + void AddChangeFlags(uint64_t added); + void AddScale(float amount); +}; diff --git a/src/entity_slot.cpp b/src/entity_slot.cpp new file mode 100644 index 0000000..0ae7ee5 --- /dev/null +++ b/src/entity_slot.cpp @@ -0,0 +1,46 @@ +#include "entity_slot.h" +#include "log.h" + +// The rest of Entity_Slot is not reconstructed yet. + +// 0065d200 +void Entity_Slot::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Slot::Init 0065d200"); +} + +// 0065d950 +void Entity_Slot::Update() +{ + reconstruction_missing("Entity_Slot::Update 0065d950"); +} + +// 00665370 +void Entity_Slot::Render(const Vector&) +{ + reconstruction_missing("Entity_Slot::Render 00665370"); +} + +// 00664560 +bool Entity_Slot::TakeDamage(float, uint64_t, const EntityRef&, int) +{ + reconstruction_missing("Entity_Slot::TakeDamage 00664560"); +} + +// 006627e0 +bool Entity_Slot::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Slot::HandleCollision 006627e0"); +} + +// 00663aa0 +void Entity_Slot::spawn_break_drops() +{ + reconstruction_missing("Entity_Slot::spawn_break_drops 00663aa0"); +} + +// 00665500 +void Entity_Slot::SetPrizeType(int) +{ + reconstruction_missing("Entity_Slot::SetPrizeType 00665500"); +} diff --git a/src/entity_slot.h b/src/entity_slot.h new file mode 100644 index 0000000..35103ec --- /dev/null +++ b/src/entity_slot.h @@ -0,0 +1,17 @@ +#pragma once + +#include "entity.h" + +// Construction and destruction (0065d130) are the defaults. +// A slot machine, beggar or other paying machine (Lua's EntitySlot), which pays out a prize. +struct Entity_Slot : Entity +{ + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Render(const Vector& offset) override; + bool TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown) override; + bool HandleCollision(Entity* collider, bool isLow) override; + + void spawn_break_drops(); + void SetPrizeType(int prizeType); +}; diff --git a/src/entity_tear.cpp b/src/entity_tear.cpp new file mode 100644 index 0000000..d85e337 --- /dev/null +++ b/src/entity_tear.cpp @@ -0,0 +1,160 @@ +#include "entity_tear.h" +#include "log.h" + +// 00678060 Whether it was not split off another tear. +bool Entity_Tear::is_not_familiar_spawned() +{ + return !parent || parent->type != ENTITY_TEAR; +} + +// The rest of Entity_Tear is not reconstructed yet. + +// 006660a0 +void Entity_Tear::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Tear::Init 006660a0"); +} + +// 006670f0 +void Entity_Tear::Update() +{ + reconstruction_missing("Entity_Tear::Update 006670f0"); +} + +// 00679400 +void Entity_Tear::Interpolate() +{ + reconstruction_missing("Entity_Tear::Interpolate 00679400"); +} + +// 006790c0 +void Entity_Tear::Render(const Vector&) +{ + reconstruction_missing("Entity_Tear::Render 006790c0"); +} + +// 00675fa0 +void Entity_Tear::SetCollisionDamage(float) +{ + reconstruction_missing("Entity_Tear::SetCollisionDamage 00675fa0"); +} + +// 006666c0 +void Entity_Tear::ClearReferences() +{ + reconstruction_missing("Entity_Tear::ClearReferences 006666c0"); +} + +// 00673660 +bool Entity_Tear::HandleCollision(Entity*, bool) +{ + reconstruction_missing("Entity_Tear::HandleCollision 00673660"); +} + +// 00665b00 +Entity_Player* Entity_Tear::GetRootPlayer() +{ + reconstruction_missing("Entity_Tear::GetRootPlayer 00665b00"); +} + +// 006668c0 +void Entity_Tear::apply_wiggle(float) +{ + reconstruction_missing("Entity_Tear::apply_wiggle 006668c0"); +} + +// 00666ba0 +void Entity_Tear::update_wiggle() +{ + reconstruction_missing("Entity_Tear::update_wiggle 00666ba0"); +} + +// 00666d40 +void Entity_Tear::play_fire_sound() +{ + reconstruction_missing("Entity_Tear::play_fire_sound 00666d40"); +} + +// 00676020 +float Entity_Tear::get_height_offset_y(float) +{ + reconstruction_missing("Entity_Tear::get_height_offset_y 00676020"); +} + +// 00676120 +void Entity_Tear::SetScale(float) +{ + reconstruction_missing("Entity_Tear::SetScale 00676120"); +} + +// 00676150 +void Entity_Tear::SetTearFlags(TearFlags) +{ + reconstruction_missing("Entity_Tear::SetTearFlags 00676150"); +} + +// 00676be0 +void Entity_Tear::apply_death_flag_effects(Entity*) +{ + reconstruction_missing("Entity_Tear::apply_death_flag_effects 00676be0"); +} + +// 00677780 +void Entity_Tear::ResetSpriteScale() +{ + reconstruction_missing("Entity_Tear::ResetSpriteScale 00677780"); +} + +// 00678080 +void Entity_Tear::fire_split_projectiles(bool) +{ + reconstruction_missing("Entity_Tear::fire_split_projectiles 00678080"); +} + +// 00679e80 +void Entity_Tear::SetDeadEyeIntensity(float) +{ + reconstruction_missing("Entity_Tear::SetDeadEyeIntensity 00679e80"); +} + +// 0067a190 +Entity_Tear* Entity_Tear::MakeMultidimensionalCopy(Entity*) +{ + reconstruction_missing("Entity_Tear::MakeMultidimensionalCopy 0067a190"); +} + +// 0067a400 +void Entity_Tear::ChangeVariant(int) +{ + reconstruction_missing("Entity_Tear::ChangeVariant 0067a400"); +} + +// 0067a770 +int Entity_Tear::find_nearest_linkable_tear() +{ + reconstruction_missing("Entity_Tear::find_nearest_linkable_tear 0067a770"); +} + +// 0067a8f0 +Entity_Tear* Entity_Tear::find_link_partner() +{ + reconstruction_missing("Entity_Tear::find_link_partner 0067a8f0"); +} + +// 0067aaf0 +void Entity_Tear::apply_link_spring_forces() +{ + reconstruction_missing("Entity_Tear::apply_link_spring_forces 0067aaf0"); +} + +// 0067d560 +bool Entity_Tear::try_make_bridges(float*) +{ + reconstruction_missing("Entity_Tear::try_make_bridges 0067d560"); +} + +// 006b5320 +void Entity_Tear::reroll_hit_entity(int) +{ + reconstruction_missing("Entity_Tear::reroll_hit_entity 006b5320"); +} diff --git a/src/entity_tear.h b/src/entity_tear.h new file mode 100644 index 0000000..3bfcd2c --- /dev/null +++ b/src/entity_tear.h @@ -0,0 +1,94 @@ +#pragma once + +#include "entity.h" +#include "anm2.h" +#include + +// Lua's TearFlags bits that the entity code reads. +enum TearFlagBit : int +{ + TEAR_SHIELDED = 34 +}; + +// Construction and destruction (00665ea0, 00665cf0) are the defaults. +// Field accessors (004177c0, 00431750, 00435e50, 00456440, 004aade0, 00557cd0, 0060ccb0, 0060ccc0, 0060ccd0, +// 0060cd00, 0085dd60, 0085dd70, 0085dd90) are the public fields. +// A player's tear (Lua's EntityTear): its height and fall, scale and damage, the tear flags that change how it flies +// and hits, the entity it sticks to, and the tears and lasers it links to. +struct Entity_Tear : Entity +{ + ANM2 deadEyeANM2; + ANM2 tearEffectANM2; + ANM2 tearHaloANM2; + std::vector hitList; + TearFlags tearFlags; + EntityPtr attachedEffect; + EntityPtr laserShotLaser; + EntityPtr linkNext; + EntityPtr linkPrev; + EntityPtr techZeroLaser; + EntityPtr techZeroTarget; + Entity* stickTarget = nullptr; + Vector continueVelocity{}; + Vector holdOffset{}; + Vector holdVelocity{}; + Vector orbitVelocity{}; + Vector parentOffset{}; + Vector posDisplacement{}; + Vector stickDiff{}; + float baseDamage = 0; + float baseScale = 0; + float deadEyeIntensity = 0; + float fScale = 0; + float fallingAccel = 0; + float fallingSpeed = 0; + float height = 0; + float homingFriction = 0; + float knockbackMultiplier = 0; + float orbitAngle = 0; + float orbitRadius = 0; + float rotation = 0; + float tearRange = 0; + int hitCount = 0; + int holdTimer = 0; + int scaleAnimNum = 0; + int stickTimer = 0; + int tearIdx = 0; + int waitFrames = 0; + uint32_t deathFlags = 0; + short popBounceCount = 0; + bool isCanTriggerStreakEnd = false; + bool isFireSoundMuted = false; + bool isFireSoundPending = false; + bool isHovering = false; + bool isMultidimensionalTouched = false; + bool isPrismTouched = false; + + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + void SetCollisionDamage(float damage) override; + void ClearReferences() override; + bool HandleCollision(Entity* collider, bool isLow) override; + + Entity_Player* GetRootPlayer(); + void apply_wiggle(float strength); + void update_wiggle(); + void play_fire_sound(); + float get_height_offset_y(float height); + void SetScale(float scale); + void SetTearFlags(TearFlags flags); + void apply_death_flag_effects(Entity* target); + void ResetSpriteScale(); + bool is_not_familiar_spawned(); + void fire_split_projectiles(bool isHalved); + void SetDeadEyeIntensity(float intensity); + Entity_Tear* MakeMultidimensionalCopy(Entity* spawner); + void ChangeVariant(int variant); + int find_nearest_linkable_tear(); + Entity_Tear* find_link_partner(); + void apply_link_spring_forces(); + static bool try_make_bridges(float*); + void reroll_hit_entity(int unused); +}; diff --git a/src/entity_text.cpp b/src/entity_text.cpp new file mode 100644 index 0000000..a4d0e0b --- /dev/null +++ b/src/entity_text.cpp @@ -0,0 +1,34 @@ +#include "entity_text.h" +#include "log.h" + +// 005ccc20 Collides with nothing it reacts to, letting the collision through. +bool Entity_Text::HandleCollision(Entity*, bool) +{ + return true; +} + +// The rest of Entity_Text is not reconstructed yet. + +// 005ccca0 +void Entity_Text::Init(int, int, int, uint32_t) +{ + reconstruction_missing("Entity_Text::Init 005ccca0"); +} + +// 005ccd80 +void Entity_Text::Update() +{ + reconstruction_missing("Entity_Text::Update 005ccd80"); +} + +// 005cd2e0 +void Entity_Text::Interpolate() +{ + reconstruction_missing("Entity_Text::Interpolate 005cd2e0"); +} + +// 005ccfc0 +void Entity_Text::Render(const Vector&) +{ + reconstruction_missing("Entity_Text::Render 005ccfc0"); +} diff --git a/src/entity_text.h b/src/entity_text.h new file mode 100644 index 0000000..fb41c42 --- /dev/null +++ b/src/entity_text.h @@ -0,0 +1,14 @@ +#pragma once + +#include "entity.h" + +// Construction and destruction (005ccc60) are the defaults. +// A floating text the debug console and some effects show. +struct Entity_Text : Entity +{ + void Init(int type, int variant, int subType, uint32_t initSeed) override; + void Update() override; + void Interpolate() override; + void Render(const Vector& offset) override; + bool HandleCollision(Entity* collider, bool isLow) override; +}; diff --git a/src/fx_layers.cpp b/src/fx_layers.cpp index 4b80635..56de643 100644 --- a/src/fx_layers.cpp +++ b/src/fx_layers.cpp @@ -4,6 +4,7 @@ #include "log.h" #include "manager.h" #include "render_passes.h" +#include "room.h" #include "seeds.h" #include #include @@ -62,14 +63,9 @@ constexpr int STAGE_TYPE_COUNT = 5; constexpr uint32_t CURSE_DARKNESS = 1; constexpr uint32_t CHALLENGE_DELETE_THIS = 45; constexpr int SECRET_EXIT_CORPSE = 4; -constexpr uint32_t ROOM_DEFAULT = 1; -constexpr uint32_t ROOM_BOSS = 5; constexpr int BACKDROP_PLANETARIUM = 35; constexpr int BACKDROP_MAUSOLEUM_HEART = 39; constexpr int BACKDROP_DUNGEON_BEAST = 57; -constexpr uint32_t ENTITY_HUSH = 407; -constexpr uint32_t ENTITY_BEAST = 951; -constexpr uint32_t ENTITY_EFFECT = 1000; constexpr uint32_t EFFECT_SPRITE_TRAIL = 166; // A normal room shows its floor's light rays one time in RAY_ODDS (in RAY_ODDS_CHAPTER_ONE on the first chapter). @@ -221,9 +217,9 @@ static void channel_set(KColor& color, int channel, float value) // ones (L shapes with the big), none for an unknown shape and 1x1 without a layout. static RoomShape room_shape_group_get(const Room& room) { - if (!room._descriptor || !room._descriptor->Data) return ROOMSHAPE_1x1; + if (!room.descriptor || !room.descriptor->data) return ROOMSHAPE_1x1; - switch (room._descriptor->Data->shape) + switch (room.descriptor->data->shape) { case ROOMSHAPE_1x1: case ROOMSHAPE_IH: @@ -243,20 +239,14 @@ static RoomShape room_shape_group_get(const Room& room) static uint32_t decoration_seed_get(const Room& room) { - return room._descriptor ? (uint32_t)room._descriptor->DecorationSeed : 0; -} - -// The entities a room updates. Room holds its EntityList as bytes until EntityList is taken over. -static EntityList_EL& room_entities_get(Room& room) -{ - return reinterpret_cast(room._entityList)->_updateEL; + return room.descriptor ? (uint32_t)room.descriptor->decorationSeed : 0; } // How far the room's renders are shifted: its scroll and the screen shake. static Vector render_offset_get(const Room& room) { - return vector_make(room._renderScrollOffset.x + g_game->screenShakeOffset.x, - room._renderScrollOffset.y + g_game->screenShakeOffset.y); + return vector_make(room.renderScrollOffset.x + g_game->screenShakeOffset.x, + room.renderScrollOffset.y + g_game->screenShakeOffset.y); } static Vector screen_size_get() @@ -622,7 +612,7 @@ static void veins_place(FXLayers& fx) vein.spriteIndex = fxRng.Next() & 1; for (std::unique_ptr& branch : vein.branches) branch.reset(); - if (fx.stage == STAGE_BLUE_WOMB && fx.stageType == 0 && g_game->room->_roomType == ROOM_BOSS) + if (fx.stage == STAGE_BLUE_WOMB && fx.stageType == 0 && g_game->room->roomType == ROOM_BOSS) fx.vein_branches_grow(vein); } } @@ -630,13 +620,10 @@ static void veins_place(FXLayers& fx) // How wounded the first Hush the room updates is, 0 at full health to 1, or 0 without one. static float hush_wound_get(Room& room) { - EntityList_EL& entities = room_entities_get(room); - - for (uint32_t i = 0; i < entities._size; i++) + for (Entity* entity : room.entityList.updateEL) { - Entity* entity = entities._data[i]; - if (entity->_type == ENTITY_HUSH && entity->_variant == 0) - return std::min(1.0f, std::max(0.0f, 1 - entity->_health / entity->_maxHitPoints)); + if (entity->type == ENTITY_HUSH && entity->variant == 0) + return std::min(1.0f, std::max(0.0f, 1 - entity->health / entity->maxHitPoints)); } return 0; } @@ -644,13 +631,10 @@ static float hush_wound_get(Room& room) // Draws the sprite trails the Beast leaves, which its arena shows under the room's layers. static void beast_trails_render(Room& room) { - EntityList_EL& entities = room_entities_get(room); - - for (uint32_t i = 0; i < entities._size; i++) + for (Entity* entity : room.entityList.updateEL) { - Entity* entity = entities._data[i]; - bool isBeastTrail = entity->_variant == EFFECT_SPRITE_TRAIL && entity->_spawnerType == ENTITY_BEAST; - if (entity->_type == ENTITY_EFFECT && isBeastTrail) entity->Render(&g_game->room->_renderScrollOffset); + bool isBeastTrail = entity->variant == EFFECT_SPRITE_TRAIL && entity->spawnerType == ENTITY_BEAST; + if (entity->type == ENTITY_EFFECT && isBeastTrail) entity->Render(g_game->room->renderScrollOffset); } } @@ -709,12 +693,12 @@ static void rays_render(FXLayers& fx) FXRayGroup& group = fx.rayGroups[fx.rayGroupIndex]; Vector center = screen_position_get(room_center_get(fx)); Vector players = screen_position_get(fx.playersCenter); - float top = g_game->screenShakeOffset.y + room._renderScrollOffset.y; + float top = g_game->screenShakeOffset.y + room.renderScrollOffset.y; - center.x += room._renderScrollOffset.x; - center.y += room._renderScrollOffset.y; - float leanX = players.x - center.x + room._renderScrollOffset.x; - float leanY = players.y - center.y + room._renderScrollOffset.y; + center.x += room.renderScrollOffset.x; + center.y += room.renderScrollOffset.y; + float leanX = players.x - center.x + room.renderScrollOffset.x; + float leanY = players.y - center.y + room.renderScrollOffset.y; float count = (float)group.rays.size(); float width = (group.xMax - group.xMin - (float)(group.rays.size() - 1) * group.raySpacing) / count; float halfWidth = width * HALF; @@ -754,13 +738,13 @@ void FXLayers::LoadConfig(std::string_view path, int levelStage, int levelStageT stage = levelStage; stageType = levelStageType; fxRng.SetSeed(Random(), FX_RNG_SHIFT); - roomTopLeft = room._topLeftPos; - roomBottomRight = room._bottomRightPos; + roomTopLeft = room.topLeftPos; + roomBottomRight = room.bottomRightPos; int stageId = RoomConfig::GetStageID(stage, stageType, ROOM_MODE_CURRENT); if (g_game->difficulty == DIFFICULTY_GREED || g_game->difficulty == DIFFICULTY_GREEDIER) stage = levelStage <= CHAPTER_LAST ? levelStage * 2 - 1 : (levelStage == GREED_STAGE_SHEOL ? STAGE_SHEOL : 0); - backdropType = room._backdropType; + backdropType = room.backdropType; if (level.get_secret_exit_kind() == SECRET_EXIT_CORPSE && g_game->currentRoomIdx == ROOM_SECRET_EXIT_IDX) { stage = STAGE_WOMB; @@ -790,7 +774,7 @@ void FXLayers::LoadConfig(std::string_view path, int levelStage, int levelStageT rng.SetSeed(decoration_seed_get(room), ROOM_RNG_SHIFT); rayGroupIndex = rayGroups.empty() ? -1 : (int)rng.RandomInt((uint32_t)rayGroups.size()); uint32_t rayOdds = stage < STAGE_CHAPTER_TWO ? RAY_ODDS_CHAPTER_ONE : RAY_ODDS; - bool isRayless = room._roomType == ROOM_DEFAULT && rng.RandomInt(rayOdds); + bool isRayless = room.roomType == ROOM_DEFAULT && rng.RandomInt(rayOdds); if (isRayless && (stage != STAGE_SHEOL || g_game->stageType == 0)) rayGroupIndex = -1; fxParams = FXParams(); @@ -922,7 +906,7 @@ void FXLayers::Update(PlayerFollow follow) float angle = angle_wrap(std::atan2(dy, dx) * RADIANS_TO_DEGREES + QUARTER_TURN); vein.scale = std::min(VEIN_SCALE_MAX, std::max(VEIN_SCALE_MIN, distance * VEIN_SCALE_PER_DISTANCE)); - vein.rotation = LerpAngleDeg(vein.baseRotation, angle, VEIN_TURN_RATE); + vein.rotation = angle_lerp(vein.baseRotation, angle, VEIN_TURN_RATE); vein.growth = VEIN_GROWTH_MAX; vein.length = std::min(VEIN_LENGTH_MAX, std::max(VEIN_LENGTH_MIN, reach)) * woundSquared; vein_update(vein); @@ -1033,7 +1017,7 @@ void FXLayers::Render() KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; Room& room = *g_game->room; - if (room._backdropType == BACKDROP_DUNGEON_BEAST) beast_trails_render(room); + if (room.backdropType == BACKDROP_DUNGEON_BEAST) beast_trails_render(room); if (!isLoaded) return; KAGE::Graphics::BlendMode blendMode = graphics.blendMode; @@ -1155,8 +1139,8 @@ void FXLayers::underwater_layers_render() if (!isLoaded) return; Room& room = *g_game->room; - Vector topLeft = room._floorScreenTopLeft; - Vector bottomRight = room._floorScreenBottomRight; + Vector topLeft = room.floorScreenTopLeft; + Vector bottomRight = room.floorScreenBottomRight; Vector size = vector_make(bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); Vector center = vector_make((topLeft.x + bottomRight.x) * HALF, (topLeft.y + bottomRight.y) * HALF); Vector quadAt = vector_make(topLeft.x - UNDERWATER_MARGIN, topLeft.y - UNDERWATER_MARGIN); @@ -1200,8 +1184,8 @@ void FXLayers::vein_render(const FXVein* vein) sprite.rotation = vein->rotation; sprite.color = COLOR_DEFAULT; sprite.color._tint[3] = alpha; - draw.position = vector_make(screen.x + room._renderScrollOffset.x + g_game->screenShakeOffset.x, - screen.y + room._renderScrollOffset.y + g_game->screenShakeOffset.y); + draw.position = vector_make(screen.x + room.renderScrollOffset.x + g_game->screenShakeOffset.x, + screen.y + room.renderScrollOffset.y + g_game->screenShakeOffset.y); sprite.Render(draw); for (const std::unique_ptr& branch : vein->branches) vein_render(branch.get()); } diff --git a/src/game.cpp b/src/game.cpp index 97ce60b..f5ea4b4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,9 +1,17 @@ #include "game.h" #include "data.h" +#include "entity_player.h" #include "log.h" #include "manager.h" +#include "lua_engine.h" #include "menu_manager.h" +#include "render_passes.h" +#include "room.h" +#include "room_transition.h" #include "victory_run_prompt.h" +#include +#include +#include #include constexpr const char* STAGES_XML = "stages.xml"; @@ -12,6 +20,7 @@ constexpr const char* MINIBOSSES_XML = "minibosses.xml"; constexpr const char* GIANTBOOK_XML = "giantbook.xml"; constexpr const char* BOSS_OVERLAYS_XML = "bossoverlays.xml"; constexpr const char* AMBUSH_XML = "ambush.xml"; +constexpr const char* ITEM_POOLS_XML = "itempools.xml"; constexpr const char* PRELOAD_XML = "preload.xml"; constexpr std::array PRELOAD_GROUPS = {"common", "enemy", "pickups", "icons"}; constexpr const char* COMPLETION_WIDGET_ANM2 = "gfx/ui/completion_widget.anm2"; @@ -37,8 +46,12 @@ constexpr float COLOR_CHANNEL_MAX = 255; // The attributes of a giant book layer's tint channels. constexpr std::array TINT_ATTRIBUTES = {"r", "g", "b", "a"}; -constexpr uint32_t CHALLENGE_BACKASSWARDS = 44; constexpr int DIMENSION_DEATH_CERTIFICATE = 2; +constexpr int STAGE_DARK_ROOM = 11; +// The fortune generator's xorshift (shift index 35), the start's fade in speed, and the cover an instant fade starts on. +constexpr uint32_t FORTUNE_RNG_SHIFT = 35; +constexpr float START_FADE_SPEED = 0.04f; +constexpr float FADE_IN_ALPHA_INSTANT = 1e-05f; constexpr int STAGE_ID_DEATH_CERTIFICATE = 35; // How a co-op award is decided, beside its name. @@ -456,6 +469,145 @@ void Game::create_render_surfaces() surface_create(colormodSurface, COLORMOD_SURFACE); } +// 006f5320 Starts a new run on a character, challenge, seeds and difficulty: the run's seeds (a challenge's own +// effects), whether progress is frozen, the item and boss pools, the player, the first floor (Backasswards' Dark Room), +// then saves it, fades in from black and runs the first room's update and the mods' game start. +void Game::Start(int playerType, uint32_t startChallenge, const Seeds& seeds, Difficulty startDifficulty) +{ + Manager& manager = *g_manager; + + isStarted = true; + onlinePlayerStats._end = onlinePlayerStats._begin; + for (CoopAward& award : coopAwards) award.userIds.clear(); + isOnlineStatsFinalized = false; + difficulty = startDifficulty; + challenge = startChallenge; + trapdoorLoopVolume = 0; + victoryLap = 0; + isConsoleUsedThisRun = manager.isConsoleEnabled; + hud.LoadGraphics(); + + if (seeds.gameStartSeed == 0) log_printf(LOG_ASSERT, "Start seed is not initialized"); + seedEffects = seeds; + if (challenge != 0) + { + seedEffects.ClearSeedEffects(); + for (int effect : GetChallengeParams().seedEffects) seedEffects.AddSeedEffect(effect); + } + fortuneRNG.SetSeed(seedEffects.GetNextSeed(), FORTUNE_RNG_SHIFT); + + bool isReadOnly = seedEffects.isCustomRun || seedEffects.AchievementUnlocksDisallowed() || + Manager::AchievementUnlocksDisallowed() || isRerun || challenge != 0; + manager.persistentGameData.SetReadOnly(isReadOnly); + uint32_t startSeed = seedEffects.GetStartSeed(); + std::string seedText = Seeds::Seed2String(seedEffects.GetStartSeed()); + log_printf(LOG_INFO, "RNG Start Seed: %s (%u) [New, %d]\n", seedText.c_str(), startSeed, manager.currentSaveSlot); + + proceduralItemManager.Init(); + std::string itemPoolsPath = manager.modManager.TryRedirectPath(ITEM_POOLS_XML); + itemPool.Init(seedEffects.GetNextSeed(), itemPoolsPath); + bossPool.init(seedEffects.GetStartSeed()); + playerManager.init_main_player(playerType, seedEffects.GetPlayerInitSeed()); + SetNextStage(); + if (challenge == CHALLENGE_BACKASSWARDS) SetStage(STAGE_DARK_ROOM, STAGETYPE_ORIGINAL); + Init(true); + + std::vector players = playerManager.playerList; + for (Entity_Player* player : players) + if (player->variant == PLAYER_VARIANT_PLAYER) player->InitPostLevelInitStats(); + + Manager::save_game_state(); + playerManager.trigger_new_room_effects(); + Fadein(START_FADE_SPEED, FADE_ICON_SHOW, kcolor_rgba(0, 0, 0, 1)); + pause_screen_reset(pauseScreen); + encounteredBosses.clear(); + room->Update(); + framesSinceRoomTransition = 0; + static_cast(g_luaEngine)->PostGameStart(false); +} + +// 006f5210 Fades the screen in from a color at a speed, from full (or nearly no) cover as the instant fade asks, with +// or without the loading icon. The players cannot move until it ends. +void Game::Fadein(float speed, FadeIcon icon, KColor color) +{ + fadeInColor = color; + fadeInColor._alpha = isInstantFadeIn ? FADE_IN_ALPHA_INSTANT : 1; + fadeSpeed = speed; + isFadeInIconShown = icon == FADE_ICON_SHOW; + for (Entity_Player* player : playerManager.playerList) player->isControlsEnabled = false; +} + +// 006f9000 Copies the run into a game state to save: its rules and seeds, the counters and histories of the run, the +// Ascent's saved stages, the nightmare stage bar, the ambush wave, the score, the boss and item pools, then the floor +// (after leaving the room), the players and the versus rules. +// The saved flags are the first 53 of the run's state flags. +void Game::store_game_state(GameState& state) +{ + state.Clear(); + state.seeds = seedEffects; + state.playerManagerSeed = playerManager.rng._seed; + state.fortuneSeed = fortuneRNG._seed; + state.challenge = (int)challenge; + state.isRerun = isRerun; + state.isConsoleUsedThisRun = isConsoleUsedThisRun; + state.difficulty = difficulty; + state.gameStateFlags = std::bitset(gameStateFlags); + + state.lastDevilRoomStage = lastDevilRoomStage; + state.treasureRoomsVisited = treasureRoomsVisited; + state.planetariumsVisited = planetariumsVisited; + state.stagesWithoutHeartsPicked = stagesWithoutHeartsPicked; + state.stagesWithoutDamage = stagesWithoutDamage; + state.devilRoomDeals = devilRoomDeals; + state.shopVisits = shopVisits; + state.donationModGreed = donationModGreed; + state.donationModAngel = donationModAngel; + state.reviveMachineCoinsLeft = reviveMachineCoinsLeft; + state.reviveMachineUses = reviveMachineUses; + state.bossRushParTime = bossRushParTime; + state.blueWombParTime = blueWombParTime; + state.frameCount = frameCount; + state.timeCounter = timeCounter; + state.stageNameNumeral = stageNameNumeral; + state.victoryLap = victoryLap; + state.lastLevelWithoutHalfHp = lastLevelWithoutHalfHp; + state.lastLevelWithDamage = lastLevelWithDamage; + state.encounteredBosses = encounteredBosses; + state.pixelationTimer = pixelationTimer; + state.pixelationDuration = pixelationDuration; + state.magicSkinUses = magicSkinUses; + state.erasedEntities = erasedEntities; + + state.isAscent = ascentTimer > 0; + state.backwardsStages = backwardsStages; + state.deathCertificateExitTimer = deathCertificateExitTimer; + state.nightmareStageIcons = g_manager->nightmareScene.stageIcons; + state.isAmbushActive = ambush._isActive; + state.ambushWave = ambush._currentWave > 0 ? ambush._currentWave - 1 : ambush._currentWave; + scoreSheet.store_state(state.scoreSheet); + + bossPool.store_game_state(state.bossPool); + if (!proceduralItemManager.proceduralItems.empty()) + reconstruction_missing("Game::store_game_state 006f9000: the TMTRAINER items' seeds (ProceduralItem +0x8)"); + itemPool.StoreGameState(state.itemPool); + reconstruction_missing("Game::store_game_state 006f9000: Room::on_leave 007efa50, Level::store_game_state " + "00747e10, PlayerManager::store_game_state 009bd150 and the versus rules " + "(DeathmatchTypeBase slot 1 and StoreGameState 0042bd70)"); +} + +// 009b5cb0 Closes the pause screen for a new run on Resume, with its paper's animation stopped, the options listed +// again, My Stuff closed and the quit prompt reset. +// The original also stops the full-size paper and resets fields of it, which pause_screen.h leaves out. +void pause_screen_reset(PauseScreen& pauseScreen) +{ + pauseScreen.state = PAUSE_HIDDEN; + pauseScreen.selectedElement = PAUSE_ITEM_RESUME; + pauseScreen.menuSprite.animState.SetAnimationData(nullptr); + pauseScreen.menuOptions.load_graphics(); + pauseScreen.myStuff.reset(); + pauseScreen.genericPrompt.Initialize(PROMPT_SMALL); +} + void Game::Exit(bool) { reconstruction_missing("Game::Exit 006fa0c0"); @@ -466,9 +618,317 @@ void Game::Update() reconstruction_missing("Game::Update 006fadc0"); } +constexpr const char* BLOOM_SHADER = "Bloom"; +constexpr const char* COLOR_MOD_SHADER = "ColorMod"; +constexpr const char* COLOR_OFFSET_SHADER = "ColorOffset"; +constexpr const char* HALLUCINATION_SHADER = "Hallucination"; +constexpr const char* OLD_TV_SHADER = "OldTV"; +constexpr const char* PIXELATION_SHADER = "Pixelation"; +constexpr const char* SCREEN_SIZE_UNIFORM = "ScreenSize"; +constexpr KColor SCREEN_WHITE = kcolor_rgba(1, 1, 1, 1); +constexpr RNG ROOM_SNAPSHOT_RNG = {0, 9, 5, 25}; +constexpr int ROOM_SNAPSHOT_FRAME = 30; +constexpr uint32_t ROOM_SNAPSHOT_CHANCE = 3; +constexpr int HALLUCINATION_FLASH_FRAMES = 20; +constexpr float HALLUCINATION_FLASH_ALPHA = 0.5f; +constexpr int HALLUCINATION_FADE_FRAMES = 10; +constexpr float HALLUCINATION_CLEAR = 0.999f; +constexpr uint32_t CLICKER_FLIPS = 4; +constexpr float PIXELATION_SCALE = 0.3f; +constexpr float PIXELATION_MIN = 0.0001f; +constexpr float BLOOM_RATIO = 2; +constexpr float OLD_TV_TIME_SCALE = 0.05f; +constexpr float ASCENT_FADE_FRAMES = 90; +constexpr uint32_t DEBUG_FLAG_PLAYER_INFO = 1 << 11; +constexpr uint32_t DEBUG_FLAG_LUA_MEMORY = 1 << 13; +constexpr int STAGE_TRANSITION_OUT = 2; +constexpr int STAGE_TRANSITION_IN = 3; +constexpr int ITEM_OVERLAY_SHOWING = 1; +constexpr float PI = std::numbers::pi_v; + +// Draws a whole surface over the screen in a color. +static void screen_surface_draw(KAGE::Graphics::ImageBase& surface, KColor color) +{ + SourceQuad whole = KAGE::Graphics::source_quad_rect({}, vector_make(1, 1)); + whole._coordinateSpace = KAGE::Graphics::COORDINATES_NORMALIZED; + surface.Render(whole, KAGE::Graphics::color_quad_rect({}, vector_make(g_screenWidth, g_screenHeight), SCREEN_WHITE), + color); +} + +// Draws into an effect surface until effect_pass_end. +static void effect_pass_begin(KAGE::Graphics::ImagePtr& surface) +{ + KAGE::Graphics::manager.render_target_push(surface.get(), KAGE::Graphics::TARGET_SCREEN_SIZE, + KAGE::Graphics::PRESENT_FLUSH); +} + +// Finishes an effect surface and goes back to the target before it, cleared. +static void effect_pass_end() +{ + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + graphics.Present(KAGE::Graphics::PRESENT_FINISH); + graphics.render_target_pop(KAGE::Graphics::PRESENT_FLUSH); + graphics.Clear(); +} + +// Makes an effect's shader current when it loaded, and sets one of its floats. +static void effect_shader_set(std::string_view shaderName, std::string_view uniformName, float value) +{ + shader_select(shaderName); + KAGE::Graphics::Shader* shader = KAGE::Graphics::manager.currentShader; + if (shader) shader->set_uniform(uniformName, KAGE::Graphics::UNIFORM_FLOAT, &value); +} + +// Gives the current shader a surface's size and its texture's as ScreenSize. +static void screen_size_set(const KAGE::Graphics::ImageBase& surface) +{ + std::array size = {(float)surface.width, (float)surface.height, (float)surface.textureWidth, + (float)surface.textureHeight}; + KAGE::Graphics::Shader* shader = KAGE::Graphics::manager.currentShader; + if (shader) shader->set_uniform(SCREEN_SIZE_UNIFORM, KAGE::Graphics::UNIFORM_VEC4, size.data()); +} + +// Whether the screen pixelates: a pixelation room transition going out or coming in. +// A stage transition decides with StageTransition's own check (009301d0), which waits for its takeover. +static bool is_pixelating(Game& game) +{ + int stageState = game.stageTransition._state; + if (stageState == STAGE_TRANSITION_OUT || stageState == STAGE_TRANSITION_IN) + reconstruction_missing("Game::Render 006fbc10: StageTransition's pixelation check 009301d0"); + return game.roomTransition.get_fade_progress() >= 0 && game.roomTransition.animation == TRANSITION_PIXELATION; +} + +// Whether this frame captures the room for a hallucination to flash back to: 30 frames into a room, the first room +// of a run always, then one room in three by its spawn seed. +// The original also captured while the flag held 0xff, which Game's bool no longer holds. +static bool is_room_snapshot(Game& game) +{ + if (game.room->GetFrameCount() != ROOM_SNAPSHOT_FRAME) return false; + + RNG rng = ROOM_SNAPSHOT_RNG; + rng._seed = game.room->descriptor->spawnSeed; + return rng.Next() % ROOM_SNAPSHOT_CHANCE == 0 || !game.isRoomSnapshotTaken; +} + +// Draws the color modifier's surface back through its shader, in the modifier's color. +static void color_modifier_resolve(Game& game) +{ + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + ColorModState& modifier = game.currentColorModifier; + + effect_pass_end(); + shader_select(COLOR_MOD_SHADER); + graphics.blendMode = KAGE::Graphics::BLEND_MODE_OPAQUE; + if (KAGE::Graphics::Shader* shader = graphics.currentShader) + { + shader->set_uniform("Amount", KAGE::Graphics::UNIFORM_FLOAT, &modifier._amount); + shader->set_uniform("Brightness", KAGE::Graphics::UNIFORM_FLOAT, &modifier._brightness); + shader->set_uniform("Contrast", KAGE::Graphics::UNIFORM_FLOAT, &modifier._contrast); + } + screen_surface_draw(*game.colormodSurface, kcolor_rgba(modifier._red, modifier._green, modifier._blue, 1)); + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + graphics.shader_default_set(); +} + +// Draws the bloom surface back, glowing most halfway through the bloom. +static void bloom_resolve(Game& game) +{ + KAGE::Graphics::ImageBase& surface = *game.bloomSurface; + float half = (float)game.bloomDuration * 0.5f; + float amount = std::sin((1 - std::abs((float)game.bloomTimer - half) / half) * PI * 0.5f) * game.bloomStrength; + std::array ratio = {BLOOM_RATIO / (float)surface.textureWidth, + BLOOM_RATIO / (float)surface.textureHeight}; + + effect_pass_end(); + KAGE::Graphics::manager.blendMode = KAGE::Graphics::BLEND_MODE_OPAQUE; + effect_shader_set(BLOOM_SHADER, "BloomAmount", amount); + if (KAGE::Graphics::Shader* shader = KAGE::Graphics::manager.currentShader) + shader->set_uniform("Ratio", KAGE::Graphics::UNIFORM_VEC2, ratio.data()); + screen_surface_draw(surface, SCREEN_WHITE); +} + +// Flashes the giant book clicker over a hallucination fading in or out, flipped another way each frame. +static void clicker_render(Game& game, float amount) +{ + KAGE::Graphics::ImageBase& clicker = *game.giantBookClickerImage; + uint32_t flip = g_manager->framecount % CLICKER_FLIPS; + bool isFlipX = flip == 1 || flip == 3; + bool isFlipY = flip == 2 || flip == 3; + float width = (float)clicker.width; + float height = (float)clicker.height; + Vector corner = vector_make(isFlipX ? width : 0, isFlipY ? height : 0); + Vector size = vector_make(isFlipX ? -width : width, isFlipY ? -height : height); + + shader_select(COLOR_OFFSET_SHADER); + apply_sprite_shader_params(COLOR_DEFAULT, SPRITE_SHADER_COLOR_APPLY, clicker); + clicker.Render(KAGE::Graphics::source_quad_rect(corner, size), + KAGE::Graphics::color_quad_rect({}, vector_make(g_screenWidth, g_screenHeight), SCREEN_WHITE), + kcolor_rgba(1, 1, 1, 1 - amount)); +} + +// Draws the hallucination surface back through its shader, fading over its first and last 10 frames with the clicker. +static void hallucination_resolve(Game& game) +{ + int fadeOutStart = game.hallucinationDuration - HALLUCINATION_FADE_FRAMES; + float amount = 1; + if (game.hallucinationTimer > fadeOutStart) + amount = 1 - (float)(game.hallucinationTimer - fadeOutStart) / HALLUCINATION_FADE_FRAMES; + else if (game.hallucinationTimer < HALLUCINATION_FADE_FRAMES) + amount = (float)game.hallucinationTimer / HALLUCINATION_FADE_FRAMES; + + effect_pass_end(); + KAGE::Graphics::manager.blendMode = KAGE::Graphics::BLEND_MODE_OPAQUE; + effect_shader_set(HALLUCINATION_SHADER, "Amount", amount); + screen_size_set(*game.hallucinationSurface); + screen_surface_draw(*game.hallucinationSurface, SCREEN_WHITE); + if (amount < HALLUCINATION_CLEAR) clicker_render(game, amount); +} + +// Draws what a run shows over its room: the debug shapes, the HUD, the transitions and overlays, then the prompts and +// menus of a run between the popup layers, and the mods' shaders. +// The debug shapes stay empty until DebugRenderer's takeover, and the online stats screen never shows offline. +static void overlays_render(Game& game) +{ + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + PopupQueue& popups = g_manager->popupQueue; + bool isFighting = game.deathmatchManager.state == DEATHMATCH_FIGHT; + int stageState = game.stageTransition._state; + + popups.render_layer(0); + game.hud.Render(); + if (isFighting) game.deathmatchManager.type->FUN_0042aca0(); + if (stageState == STAGE_TRANSITION_OUT || stageState == STAGE_TRANSITION_IN) game.stageTransition.Render(); + else graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + if (game.itemOverlay._state != 0 && game.itemOverlay._state != ITEM_OVERLAY_SHOWING) game.itemOverlay.Render(); + if (game.bossOverlay._state != 0) reconstruction_missing("Game::Render 006fbc10: BossOverlay's render 00421400"); + popups.render_layer(1); + + const AnimationState& prompt = game.genericPrompt.sprite.animState; + if (prompt.animData && prompt.isPlaying) + { + game.genericPrompt.Render(); + if (game.genericPrompt.isOnlineVote) + reconstruction_missing("Game::Render 006fbc10: the online vote count under the prompt"); + } + if (game.pauseScreen.state != PAUSE_HIDDEN) game.pauseScreen.Render(); + game.emoteWheel.Render(); + game.revivePlayerMenu.Render(); + if (game.gameOver._state != 0) game.gameOver.Render(); + game.leaderboard.Render(); + popups.render_layer(2); + + for (auto& mod : g_manager->modManager.mods) + if (mod->isLoaded && !mod->shaders.empty()) + reconstruction_missing("Game::Render 006fbc10: the mods' shaders 008f74c0"); +} + +// Resolves the effect surfaces in turn (the room snapshot, bloom, pixelation, hallucination, old TV), then draws the +// Ascent's white, the fade in (with the loading icon) or out, and the debug displays. +static void effects_resolve(Game& game, bool isRoomSnapshot, bool isOldTv) +{ + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + OptionsConfig& options = g_manager->optionsConfig; + Vector screen = vector_make(g_screenWidth, g_screenHeight); + + if (isRoomSnapshot) + { + effect_pass_end(); + graphics.blendMode = KAGE::Graphics::BLEND_MODE_OPAQUE; + screen_surface_draw(*game.hallucinationSnapshot, SCREEN_WHITE); + } + if (game.bloomTimer > 0 && options.render.isBloomEnabled) bloom_resolve(game); + if (options.render.isPixelationEnabled && is_pixelating(game)) + { + effect_pass_end(); + float amount = std::max(game.roomTransition.get_fade_progress() * PIXELATION_SCALE, PIXELATION_MIN); + effect_shader_set(PIXELATION_SHADER, "PixelationAmount", amount); + screen_size_set(*game.pixelationSurface); + screen_surface_draw(*game.pixelationSurface, SCREEN_WHITE); + } + if (game.hallucinationTimer > 0) hallucination_resolve(game); + if (isOldTv) + { + effect_pass_end(); + graphics.blendMode = KAGE::Graphics::BLEND_MODE_OPAQUE; + effect_shader_set(OLD_TV_SHADER, "Time", (float)game.frameCount * OLD_TV_TIME_SCALE); + screen_size_set(*game.oldTvSurface); + screen_surface_draw(*game.oldTvSurface, SCREEN_WHITE); + } + graphics.shader_default_set(); + + if (game.ascentTimer > 0) + { + float alpha = std::clamp((float)game.ascentTimer / ASCENT_FADE_FRAMES, 0.0f, 1.0f); + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_ADDITIVE); + render_color_shader_pass(KAGE::Graphics::color_quad_rect({}, screen, kcolor_rgba(1, 1, 1, alpha))); + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + } + if (game.fadeInColor._alpha > 0) + { + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + render_color_shader_pass(KAGE::Graphics::color_quad_rect({}, screen, game.fadeInColor)); + if (game.isFadeInIconShown) Manager::render_loading_icon(game.fadeInColor._alpha); + } + else if (game.fadeOutColor._alpha > 0) + render_color_shader_pass(KAGE::Graphics::color_quad_rect({}, screen, game.fadeOutColor)); + + if (game.debugFlags & DEBUG_FLAG_PLAYER_INFO && !game.playerManager.playerList.empty()) + reconstruction_missing("Game::Render 006fbc10: the player debug info"); + if (game.debugFlags & DEBUG_FLAG_LUA_MEMORY) reconstruction_missing("render_debug_lua_memory 00872090"); +} + +// 006fbc10 Draws the run's frame. The room, or the room transition, draws through the effect surfaces that are on (old +// TV, hallucination, pixelation, bloom, the room snapshot and the color modifier) with Lua's post render and a +// hallucination's flash back to the snapshot. The overlays of a run come over it, then the effects resolve, and the +// console comes last. A versus screen shows without the color modifier. +// The online parts (the vote count, the stats screen, the desync warning) never show offline. void Game::Render() { - reconstruction_missing("Game::Render 006fbc10"); + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + OptionsConfig& options = g_manager->optionsConfig; + bool isFighting = deathmatchManager.state == DEATHMATCH_FIGHT; + bool isOldTv = seedEffects.HasSeedEffect(SEED_OLD_TV); + bool isTransitionShown = roomTransition.mode == TRANSITION_OUT || roomTransition.mode == TRANSITION_IN; + + if (isWindowResizePending) reconstruction_missing("Game::recreate_render_targets 007084c0"); + room->render_lighting(); + if (isFighting) deathmatchManager.type->vfunc_5(); + if (isOldTv) effect_pass_begin(oldTvSurface); + if (hallucinationTimer > 0) effect_pass_begin(hallucinationSurface); + if (options.render.isPixelationEnabled && is_pixelating(*this)) effect_pass_begin(pixelationSurface); + if (bloomTimer > 0 && options.render.isBloomEnabled) + { + graphics.Clear(); + effect_pass_begin(bloomSurface); + } + bool isRoomSnapshot = is_room_snapshot(*this); + if (isRoomSnapshot) + { + effect_pass_begin(hallucinationSnapshot); + isRoomSnapshotTaken = true; + } + g_manager->modManager.shader_render_targets_push(); + bool isVersusScreen = roomTransition.mode == TRANSITION_OUT && roomTransition.bossIntroBossId != 0; + bool isColorModified = !isVersusScreen && options.render.isColorModifierEnabled; + if (isColorModified) effect_pass_begin(colormodSurface); + + graphics.Clear(); + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + if (isTransitionShown) roomTransition.Render(); + else room->Render(); + static_cast(g_luaEngine)->PostRender(); + bool isFlashing = hallucinationTimer > std::max(hallucinationDuration - HALLUCINATION_FLASH_FRAMES, 0); + if (isFlashing && !isRoomSnapshot && hallucinationSnapshot) + { + int flashFrame = hallucinationTimer - hallucinationDuration + HALLUCINATION_FLASH_FRAMES; + float alpha = std::sin((float)flashFrame * PI / HALLUCINATION_FLASH_FRAMES) * HALLUCINATION_FLASH_ALPHA; + screen_surface_draw(*hallucinationSnapshot, kcolor_rgba(1, 1, 1, alpha)); + } + if (isColorModified) color_modifier_resolve(*this); + + overlays_render(*this); + effects_resolve(*this, isRoomSnapshot, isOldTv); + console.Render(); } // 006fd350 Whether the run's frame stands still: an open console or pause menu while offline, a freeze, the death or @@ -480,7 +940,7 @@ bool Game::IsPaused() if (console.state != CONSOLE_CLOSED && isOffline) return true; return freezeFrames > 0 || gameOver._state != 0 || leaderboard.displayState != LEADERBOARD_HIDDEN || - stageTransition._state != 0 || roomTransition._mode != 0 || itemOverlay._state == ITEM_OVERLAY_ACTIVE || + stageTransition._state != 0 || roomTransition.mode != 0 || itemOverlay._state == ITEM_OVERLAY_ACTIVE || (pauseScreen.is_pausing() && isOffline) || g_manager->state != MANAGER_STATE_GAME || genericPrompt.IsActive() || onlineStatsScreen.isActive; } @@ -495,7 +955,7 @@ bool Game::IsGreedMode() // Certificate floor in its dimension, else the floor's stage and type. It never used its argument. int Game::GetStageID() { - if (g_game->challenge == CHALLENGE_BACKASSWARDS) + if (g_game->challenge == CHALLENGE_RED_REDEMPTION) reconstruction_missing("Game::GetStageID 00738470: Level::GetRoomStageType 0074f690 on Game's room list"); if (currentDimensionIdx == DIMENSION_DEATH_CERTIFICATE) return STAGE_ID_DEATH_CERTIFICATE; return RoomConfig::GetStageID(stage, stageType, ROOM_MODE_CURRENT); diff --git a/src/game.h b/src/game.h index dc700a6..dfd7458 100644 --- a/src/game.h +++ b/src/game.h @@ -1,9 +1,11 @@ #pragma once #include "anm2.h" +#include "boss_pool.h" #include "challenge_params.h" #include "console.h" #include "deathmatch_manager.h" +#include "game_state.h" #include "generic_prompt.h" #include "hud.h" #include "item_pool.h" @@ -19,6 +21,7 @@ #include "procedural_item_manager.h" #include "revive_player_menu.h" #include "room_config.h" +#include "room_transition.h" #include "score_sheet.h" #include "seeds.h" #include @@ -28,7 +31,6 @@ #include #include -constexpr int BACKWARDS_STAGE_COUNT = 7; constexpr int GLOWING_HOURGLASS_SLOTS = 2; constexpr int GIANTBOOK_ENTRY_COUNT = 48; constexpr int BOSS_OVERLAY_COUNT = 5; @@ -53,10 +55,13 @@ enum Difficulty : uint32_t // The run's state flags (Lua's GameStateFlag) the curated code reads, by bit. enum GameStateFlag : int { + GAME_STATE_DEVILROOM_VISITED = 6, + GAME_STATE_HEAVEN_PATH = 19, GAME_STATE_BOSSRUSH_DONE = 33, GAME_STATE_BOSSRUSH_DOOR_SPAWNED = 38, GAME_STATE_BLUEWOMB_DOOR_SPAWNED = 39, GAME_STATE_BLUEWOMB_DONE = 40, + GAME_STATE_SECRET_PATH = 44, GAME_STATE_BACKWARDS_PATH = 48 }; @@ -122,19 +127,11 @@ struct EntitySpawn uint32_t seed = 0; }; -// A boss by type and variant, as the run's encountered list holds it. -struct BossId +// Whether a fade in shows the loading icon. +enum FadeIcon { - int type = 0; - int variant = 0; -}; - -// An enemy the Eraser removed for the rest of the run. -struct ErasedEnemy -{ - int type = 0; - int subtype = 0; - int variant = 0; + FADE_ICON_HIDE, + FADE_ICON_SHOW }; // The run (g_game): the floor and its rooms (Level, the front of the class), the configs and pools a run @@ -155,7 +152,7 @@ public: Console console; std::unique_ptr entityFactory = std::make_unique(); PreloadManager preloadManager; - BossPool bossPool{}; + BossPool bossPool; PlayerManager playerManager{}; Ambush ambush{}; DeathmatchManager deathmatchManager{}; @@ -281,6 +278,9 @@ public: void level_reset(); void create_render_surfaces(); + void Start(int playerType, uint32_t startChallenge, const Seeds& seeds, Difficulty startDifficulty); + void Fadein(float speed, FadeIcon icon, KColor color); + void store_game_state(GameState& state); static void Exit(bool isSaving); void Update(); void Render(); @@ -294,3 +294,4 @@ public: }; void coop_awards_load(std::array& awards); +void pause_screen_reset(PauseScreen& pauseScreen); diff --git a/src/game_state.cpp b/src/game_state.cpp index 9ddee15..a3487f8 100644 --- a/src/game_state.cpp +++ b/src/game_state.cpp @@ -29,3 +29,4 @@ void GameState::DeleteRerun() // Netplay is offline, so read always reads a run as this machine's own (the original's isLocalRun). bool GameState::read(std::span) { reconstruction_missing("GameState::read 009cc1a0"); } bool GameState::read_rerun(std::span) { reconstruction_missing("GameState::read_rerun 009d7d50"); } +std::vector GameState::write() { reconstruction_missing("GameState::write 009c9340"); } diff --git a/src/game_state.h b/src/game_state.h index e2e635a..89b8c24 100644 --- a/src/game_state.h +++ b/src/game_state.h @@ -1,25 +1,93 @@ #pragma once +#include "boss_pool.h" +#include "nightmare_scene.h" +#include "score_sheet.h" #include "seeds.h" +#include +#include #include #include #include +#include + +constexpr int BACKWARDS_STAGE_COUNT = 7; +// How many of the run's state flags a saved run keeps. +constexpr int SAVED_GAME_STATE_FLAG_COUNT = 53; + +// A boss by type and variant, as the run's encountered list holds it. +struct BossId +{ + int type = 0; + int variant = 0; +}; + +// An enemy the Eraser removed for the rest of the run. +struct ErasedEnemy +{ + int type = 0; + int subtype = 0; + int variant = 0; +}; // A save slot's saved run (gamestate.dat), to continue from the menus, and its rerun (rep+rerunstate.dat), // the last run's character and seed to play again. -// Only what the menus and the run start read is modelled so far: the rooms, players, item pools and the rest of the -// original's 0x1fe28 bytes come with read and write. +// Modelled so far: what the menus read and what Game::store_game_state copies itself (the run's rules, seeds, +// counters and histories, the boss pools, the Ascent's saved stages). The floor's rooms and the players come with +// Level's and PlayerManager's stores, and the file format with read and write. // Construction and destruction (009c73c0, 009c7800) are the defaults. // Steam Cloud is offline, so the cloud file names are dropped. struct GameState { Seeds seeds{}; + BossPoolState bossPool{}; + GameStateItemPool itemPool{}; + ScoreRecord scoreSheet{}; + std::array backwardsStages{}; + std::array nightmareStageIcons{}; + std::bitset gameStateFlags{}; + std::vector encounteredBosses{}; + std::vector erasedEntities{}; + std::vector proceduralItemSeeds{}; std::string rerunPath; std::string savePath; + + int ambushWave = 0; + int blueWombParTime = 0; + int bossRushParTime = 0; int challenge = 0; + int deathCertificateExitTimer = 0; + int devilRoomDeals = 0; int difficulty = 0; + int donationModAngel = 0; + int donationModGreed = 0; + int frameCount = 0; + int lastDevilRoomStage = 0; + int lastLevelWithDamage = 0; + int lastLevelWithoutHalfHp = 0; + int magicSkinUses = 0; + int pixelationDuration = 0; + int pixelationTimer = 0; + int planetariumsVisited = 0; int playerType = 0; + int reviveMachineCoinsLeft = 0; + int reviveMachineUses = 0; + int shopVisits = 0; + int stageNameNumeral = 0; + int stagesWithoutDamage = 0; + int stagesWithoutHeartsPicked = 0; + int timeCounter = 0; + int treasureRoomsVisited = 0; + int victoryLap = 0; + uint32_t checksum = 0; + uint32_t fortuneSeed = 0; + uint32_t playerManagerSeed = 0; + + bool isAmbushActive = false; + bool isAscent = false; + bool isConsoleUsedThisRun = false; bool isModded = false; + bool isRerun = false; bool isRerunAvailable = false; bool isSaveAvailable = false; @@ -28,4 +96,5 @@ struct GameState void DeleteRerun(); bool read(std::span file); bool read_rerun(std::span file); + std::vector write(); }; diff --git a/src/hud.cpp b/src/hud.cpp index 84d88c8..f797a68 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -1,4 +1,5 @@ #include "hud.h" +#include "entity_player.h" #include "game.h" #include "level.h" #include "log.h" @@ -6,14 +7,13 @@ #include "minimap.h" #include "platform.h" #include "render_passes.h" +#include "room.h" #include #include #include -#include constexpr const char* MPLUS_FONT = "font/MPlus_12b.fnt"; constexpr const char* KOREAN_FONT = "font/KR_Font14.fnt"; -constexpr const char* ITEM_INFO_FONT = "font/TeamMeatEx/TeamMeatEx12.fnt"; constexpr const char* STREAK_ANM2 = "gfx/ui/ui_streak.anm2"; constexpr const char* HEARTS_ANM2 = "gfx/ui/ui_hearts.anm2"; constexpr const char* PICKUPS_ANM2 = "gfx/ui/hudpickups.anm2"; @@ -27,8 +27,6 @@ constexpr const char* COOP_MENU_ANM2 = "gfx/ui/coop menu.anm2"; constexpr const char* INVENTORY_ANM2 = "gfx/ui/ui_inventory.anm2"; constexpr const char* CRAFTING_ANM2 = "gfx/ui/ui_crafting.anm2"; constexpr const char* POOPS_ANM2 = "gfx/ui/ui_poops.anm2"; -constexpr const char* CHARGE_ICONS_ANM2 = "gfx/ui/ui_charge_icons.anm2"; -constexpr const char* MINIMAP_ICONS_ANM2 = "gfx/ui/minimap_icons.anm2"; constexpr const char* BOSS_BAR_PNG = "gfx/ui/ui_bosshealthbar.png"; constexpr const char* BOSS_BAR_MINI_PNG = "gfx/ui/ui_bosshealthbar_mini.png"; constexpr const char* BOSS_BAR_STATIC_PNG = "gfx/ui/ui_bosshealthbar_static.png"; @@ -48,7 +46,6 @@ constexpr const char* ANIMATION_TEXT = "Text"; constexpr const char* ANIMATION_TEXT_IN = "TextIn"; constexpr const char* ANIMATION_TEXT_STAY = "TextStay"; constexpr const char* ANIMATION_TEXT_OUT = "TextOut"; -constexpr const char* ANIMATION_CHARGE_ICON = "ChargeIcon"; constexpr const char* ANIMATION_DESTINATION = "Destination"; constexpr const char* EVENT_SLIDE_IN = "SlideIn"; constexpr const char* EVENT_SLIDE_OUT = "SlideOut"; @@ -72,26 +69,9 @@ constexpr int CHARGE_BAR_FLASH_FRAMES = 8; constexpr int SOUND_FORTUNE_PAPER = 252; constexpr float FORTUNE_SOUND_VOLUME = 0.5f; constexpr float FORTUNE_SLIDE_IN_PITCH = 1.5f; -constexpr float ITEM_INFO_LINE_SPACING = 0.9f; -constexpr float ITEM_INFO_ICON_SCALE = 4; constexpr float STATS_ALPHA = 0.5f; -constexpr int PLAYER_ISAAC_B = 21; -constexpr int PLAYER_CAIN_B = 23; -constexpr int PLAYER_BLUEBABY_B = 25; -constexpr int PLAYER_LAZARUS_B = 29; -constexpr int PLAYER_LAZARUS2_B = 38; -constexpr int PLAYER_JACOB2_B = 40; -constexpr int PLAYER_BETHANY = 18; -constexpr int PLAYER_JACOB = 19; -constexpr int PLAYER_ESAU = 20; -constexpr int PLAYER_BETHANY_B = 36; -constexpr int COLLECTIBLE_DEEP_POCKETS = 416; constexpr int COLOR_INDEX_NONE = 5; -constexpr int ROOM_BOSS = 5; -constexpr int ROOM_CHALLENGE = 11; -constexpr int ROOM_DUNGEON = 16; -constexpr int ROOM_BOSSRUSH = 17; constexpr int STB_HOME = 35; constexpr int BOSS_MEGA_SATAN = 55; constexpr int BOSS_GREAT_GIDEON = 83; @@ -156,26 +136,17 @@ static Vector at_make(float x, float y) return vector_make(x, y); } -// The entity an EntityPtr member of a generated entity points to, read as PlayerManager reads it. -static Entity_Player* entity_ptr_get(const uint8_t* slot) -{ - EntityPtr pointer; - - std::memcpy(&pointer, slot, sizeof(pointer)); - return pointer; -} - // Whether a player leads its pair of twins (Jacob over Esau), as one with no twin does. static bool is_main_twin(Entity_Player& player) { - Entity_Player* twin = entity_ptr_get(player._twinPlayer); - return !twin || twin->_playerIndex == -1 || player._playerIndex <= twin->_playerIndex; + Entity_Player* twin = player.twin_get(); + return !twin || twin->playerIndex == -1 || player.playerIndex <= twin->playerIndex; } // Whether a player is Jacob or Esau. static bool is_jacob_or_esau(Entity_Player* player) { - return player && (player->_playerType == PLAYER_JACOB || player->_playerType == PLAYER_ESAU); + return player && (player->playerType == PLAYER_JACOB || player->playerType == PLAYER_ESAU); } // The online HUD style (009a84c0): the options' while online and out of a versus match, else compact or offline. @@ -487,55 +458,6 @@ std::shared_ptr PlayerHUD::make_ref(HUD* owner, Entity_Player* shown) return corner; } -// 0084d6b0 Sets a stat, showing its change when animated. -void StatTracker::set(float, bool) -{ - reconstruction_missing("StatTracker::set 0084d6b0"); -} - -// 0084bfd0 Forgets both players' stats. The room chances (the last four) only show changes of a tenth. -void StatHUD::reset() -{ - for (StatHUDPlayer& slot : players) - { - slot.player = nullptr; - for (int i = 0; i < STAT_TRACKER_COUNT; i++) - { - StatTracker& stat = slot.stats[i]; - stat.value = 0; - stat.change = 0; - stat.previous = 0; - stat.changeTimer = 0; - if (i >= STAT_TRACKER_FINE_COUNT) stat.threshold = STAT_THRESHOLD_COARSE; - } - } - isDualityOwned = false; -} - -// 0084c170 Recomputes the shown stats when the found HUD is on and counts their changes down. -void StatHUD::Update() -{ - reconstruction_missing("StatHUD::Update 0084c170"); -} - -// 0084c2c0 Draws the stats at a position. -void StatHUD::Render(Vector) -{ - reconstruction_missing("StatHUD::Render 0084c2c0"); -} - -// 0084ca00 Recomputes the stats a set of flags names. -void StatHUD::RecomputeStats(int, uint32_t, bool) -{ - reconstruction_missing("StatHUD::RecomputeStats 0084ca00"); -} - -// 0084cc40 Moves a player's stats to the player replacing it. -void StatHUD::update_player(Entity_Player*, Entity_Player*) -{ - reconstruction_missing("StatHUD::update_player 0084cc40"); -} - // 0083abb0 Forgets both players' recent items. void HistoryHUD::clear() { @@ -561,24 +483,6 @@ void HistoryHUD::RecomputeAll(bool) reconstruction_missing("HistoryHUD::RecomputeAll 0083b850"); } -// 0083c5f0 Loads the panel's font (without redirection), charge icon and map icons. -void ItemInfoHUD::load_graphics() -{ - text.load_font(ITEM_INFO_FONT); - text.lineSpacing = ITEM_INFO_LINE_SPACING; - iconSprite.Reset(); - chargeIconSprite.Load(CHARGE_ICONS_ANM2, GRAPHICS_LOAD); - chargeIconSprite.Play(ANIMATION_CHARGE_ICON); - iconScale = ITEM_INFO_ICON_SCALE; - mapIconsSprite.Load(MINIMAP_ICONS_ANM2, GRAPHICS_LOAD); -} - -// 0083c8d0 Describes the pickup the player stands next to. -void ItemInfoHUD::Update() -{ - reconstruction_missing("ItemInfoHUD::Update 0083c8d0"); -} - // 009a1970 Loads the graphics again, empties the HUD and loads the item info panel. void HUD::graphics_reload() { @@ -888,7 +792,7 @@ void HUD::Render() Game& game = *g_game; if (game.seedEffects.HasSeedEffect(SEED_NO_HUD)) return; - const RoomConfig_Room* roomData = game.room->_descriptor->Data; + const RoomConfig_Room* roomData = game.room->descriptor->data; bool isHomeDungeon = roomData && roomData->type == ROOM_DUNGEON && roomData->stageId == STB_HOME; Vector shake = game.screenShakeOffset; update_hud_offset(); @@ -910,7 +814,7 @@ void HUD::Render() if (!game.deathmatchManager.is_active()) { game.minimap.Render(); - if (game.ambush._isActive && game.room->_roomType == ROOM_BOSSRUSH) + if (game.ambush._isActive && game.room->roomType == ROOM_BOSSRUSH) { constexpr float WAVE_BOX_WIDTH = 64; constexpr float WAVE_BOX_HEIGHT = 32; @@ -975,7 +879,7 @@ void HUD::render_counters(Vector& cursor, Vector shake) Entity_Player* player = players.playerList.empty() ? nullptr : players.playerList[0]; if (!player) return; - if (player->_playerType == PLAYER_JACOB) cursor.y += JACOB_SHIFT; + if (player->playerType == PLAYER_JACOB) cursor.y += JACOB_SHIFT; Entity_Player* bethany = players.FirstPlayerByType(PLAYER_BETHANY); Entity_Player* bethanyB = players.FirstPlayerByType(PLAYER_BETHANY_B); bool isAllBlueBabyB = players.are_all_players_tainted_blue_baby(); @@ -999,30 +903,30 @@ void HUD::render_counters(Vector& cursor, Vector shake) pickupHUDSprite.SetFrame(ANIMATION_IDLE, FRAME_COIN); bool isDeepPockets = players.FirstCollectibleOwner(COLLECTIBLE_DEEP_POCKETS, LAZARUS_SHARE_CHECK); - row(isDeepPockets ? "%03d" : "%02d", player->_numCoins); + row(isDeepPockets ? "%03d" : "%02d", player->numCoins); if (!isAllBlueBabyB) { - pickupHUDSprite.SetFrame((float)(player->_numGigaBombs ? FRAME_GIGA_BOMB - : player->_hasGoldenBomb ? FRAME_GOLDEN_BOMB + pickupHUDSprite.SetFrame((float)(player->numGigaBombs ? FRAME_GIGA_BOMB + : player->hasGoldenBomb ? FRAME_GOLDEN_BOMB : FRAME_BOMB)); - row("%02d", player->_numBombs); + row("%02d", player->numBombs); } if (blueBabyB) { pickupHUDSprite.SetFrame((float)FRAME_POOP); - row(players.FirstBirthrightOwner(PLAYER_BLUEBABY_B) ? "%02d" : "%d", player->_poopMana); + row(players.FirstBirthrightOwner(PLAYER_BLUEBABY_B) ? "%02d" : "%d", player->poopMana); } - pickupHUDSprite.SetFrame((float)(player->_hasGoldenKey ? FRAME_GOLDEN_KEY : FRAME_KEY)); - row("%02d", player->_numKeys); + pickupHUDSprite.SetFrame((float)(player->hasGoldenKey ? FRAME_GOLDEN_KEY : FRAME_KEY)); + row("%02d", player->numKeys); if (bethanyB) { pickupHUDSprite.SetFrame((float)FRAME_BLOOD_CHARGE); - row("%02d", player->_effectiveBloodCharge); + row("%02d", player->effectiveBloodCharge); } if (bethany) { pickupHUDSprite.SetFrame((float)FRAME_SOUL_CHARGE); - row("%02d", player->_effectiveSoulCharge); + row("%02d", player->effectiveSoulCharge); } } @@ -1052,8 +956,8 @@ void HUD::render_run_icons(Vector& cursor, Vector shake, float& statsX) { // Rebirth's Level is the front of Game, and Game declares none of its methods yet. RoomDescriptor* room = game.GetRoomByIdx(game.currentRoomIdx, -1); - isGreedBossCleared = room->ListIndex == game.lastBossRoomListIdx && - (game.room->_descriptor->Flags & ROOM_FLAG_CLEAR) && game.stage == STAGE_ULTRA_GREED; + isGreedBossCleared = room->listIndex == game.lastBossRoomListIdx && + (game.room->descriptor->flags & ROOM_FLAG_CLEAR) && game.stage == STAGE_ULTRA_GREED; } std::vector icons; @@ -1095,7 +999,7 @@ void HUD::render_run_icons(Vector& cursor, Vector shake, float& statsX) { // Online the original reads the donations of the lobby host's profile. Netplay is offline. PersistentGameData& data = g_manager->persistentGameData; - float jamChance = game.GetPlayer(0)->GetGreedDonationJamChance(&data); + float jamChance = game.GetPlayer(0)->GetGreedDonationJamChance(data); std::snprintf(text, sizeof(text), "%d%%", (int)(jamChance + ROUNDING)); } else isShown = false; @@ -1249,7 +1153,7 @@ void HUD::render_streak_texts() PlayerManager& players = g_game->playerManager; int colorIndex = COLOR_INDEX_NONE; for (int j = 0; j < COOP_SLOT_COUNT; j++) - if (players.colorControllers[j] == player->_controllerIndex) + if (players.colorControllers[j] == player->controllerIndex) { colorIndex = j; break; @@ -1302,14 +1206,14 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout) if (isOnline && !g_game->deathmatchManager.is_active() && g_manager->optionsConfig.onlineHud == ONLINE_HUD_HIDDEN && !isMainCorner) return; - if (player->_variant != 0) return; + if (player->variant != 0) return; float activeAlpha = 1; float pocketAlpha = 1; if (is_jacob_or_esau(player)) { float fade = hud.dropHoldFade * TWIN_FADE; - Entity_Player* twin = entity_ptr_get(player->_twinPlayer); + Entity_Player* twin = player->twin_get(); if (g_manager->optionsConfig.jacobEsauControls == 0) { if (twin) @@ -1324,7 +1228,7 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout) pocketAlpha = activeAlpha; } } - if (player->_hasCurseMistEffect) activeAlpha = MIST_ALPHA; + if (player->hasCurseMistEffect) activeAlpha = MIST_ALPHA; bool isNetCompact = isOnline && online_hud_mode() == ONLINE_HUD_COMPACT && !isMainCorner; if (layout == HUD_LAYOUT_NORMAL) @@ -1334,9 +1238,9 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout) Vector corner = cornerOffsets[2]; hud.RenderTrinket(1, at_make(corner.x + 20, g_screenHeight - 52 - 16 + corner.y), 1, false); hud.RenderTrinket(0, at_make(corner.x + 44, g_screenHeight - 28 - 16 + corner.y), 1, false); - if (player->_playerType == PLAYER_ISAAC_B) + if (player->playerType == PLAYER_ISAAC_B) hud.render_inventory(at_make(cornerOffsets[0].x + 58, cornerOffsets[0].y + 45), 1); - else if (player->_playerType == PLAYER_BLUEBABY_B) + else if (player->playerType == PLAYER_BLUEBABY_B) hud.RenderSpellQueue(at_make(cornerOffsets[0].x + 58, cornerOffsets[0].y + 49), 1); Vector pockets = at_make(g_screenWidth - 28 + cornerOffsets[3].x, g_screenHeight - 18 + cornerOffsets[3].y); hud.RenderPocketItems(pockets, layout, pocketAlpha, 1); @@ -1356,9 +1260,8 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout) cursor.x -= TRINKET_STEP; } cursor.x += 0; - int pocketId = player->_pocketSlots[0]; - int pocketKind = player->_pocketSlots[1]; - if ((pocketKind == 0 || pocketKind == 1) && pocketId == 0) return; + PocketItem& pocket = player->pocketItems[0]; + if (pocket.type != POCKET_ACTIVE && pocket.id == 0) return; } else if (layout == HUD_LAYOUT_JACOB_ESAU_COMPACT) { @@ -1394,9 +1297,9 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout) cursor.x += TRINKET_STEP; isAnyTrinket = true; } - if (player->_playerType == PLAYER_ISAAC_B) + if (player->playerType == PLAYER_ISAAC_B) hud.render_inventory(at_make(left + cornerOffsets[0].x, hudPos.y + 33 + cornerOffsets[0].y), 1); - else if (player->_playerType == PLAYER_BLUEBABY_B) + else if (player->playerType == PLAYER_BLUEBABY_B) hud.RenderSpellQueue(at_make(left + cornerOffsets[0].x, hudPos.y + 39 + cornerOffsets[0].y), 1); cursor.x -= POCKET_GAP; if (isAnyTrinket) cursor.x -= POCKET_GAP; @@ -1428,9 +1331,9 @@ void HUD::render_boss_health_bar(Vector barPos) constexpr int STATIC_STEPS = 256; Room& room = *g_game->room; - const RoomConfig_Room* roomData = room._descriptor->Data; + const RoomConfig_Room* roomData = room.descriptor->data; bool isHomeDungeon = roomData && roomData->type == ROOM_DUNGEON && roomData->stageId == STB_HOME; - if (bossHPBarFill < 0 || room._bossId == BOSS_MEGA_SATAN || room._bossId == BOSS_MOTHER || isHomeDungeon) + if (bossHPBarFill < 0 || room.bossId == BOSS_MEGA_SATAN || room.bossId == BOSS_MOTHER || isHomeDungeon) { isBossBarBottom = false; return; @@ -1438,7 +1341,7 @@ void HUD::render_boss_health_bar(Vector barPos) bool isBottom = isBossBarBottom || g_manager->optionsConfig.isBossHpOnBottom; barPos.y = isBottom ? g_screenHeight - BAR_HEIGHT - BAR_MARGIN + bossBarOffset : BAR_MARGIN - bossBarOffset; - if (room._bossId == BOSS_GREAT_GIDEON) + if (room.bossId == BOSS_GREAT_GIDEON) { barPos.x = (g_screenWidth - STONE_WIDTH) * 0.5f; Vector stoneSize = at_make(STONE_WIDTH, BAR_HEIGHT); @@ -1463,12 +1366,12 @@ void HUD::render_boss_health_bar(Vector barPos) ColorMod barColor = COLOR_DEFAULT; KAGE::Graphics::ImagePtr barImage = bossHealthBarImage; - int roomType = (int)room._roomType; + int roomType = (int)room.roomType; if (roomType != ROOM_BOSS && roomType != ROOM_BOSSRUSH && roomType != ROOM_CHALLENGE && g_game->GetStageID() != STB_HOME) barImage = bossHealthBarMiniImage; - bool isDogma = room._backdropType == BACKDROP_DOGMA; + bool isDogma = room.backdropType == BACKDROP_DOGMA; KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; bool isShaderPushed = graphics.shader_push(isDogma ? COLOR_OFFSET_DOGMA_SHADER : COLOR_OFFSET_SHADER); if (isDogma) @@ -1543,7 +1446,7 @@ Vector HUD::get_player_hud_position(int hudIndex, PlayerHudLayout layout) PlayerHUD& hud = playerHUD[hudIndex]; Entity_Player* player = hud.player; - bool isGhost = player && player->_isCoopGhost; + bool isGhost = player && player->isCoopGhost; Vector at = playerHudPositions[hudIndex]; bool isPlaced = false; if (hud.playerHudIndex >= MAIN_PLAYER_HUD_COUNT && !isGhost) @@ -1568,8 +1471,8 @@ Vector HUD::get_player_hud_position(int hudIndex, PlayerHudLayout layout) if (isVersus) at.x += hudIndex & 1 ? -VERSUS_SPREAD : VERSUS_SPREAD; if (!player || hudIndex < 2 || isGhost) return at; - if (player->_playerType == PLAYER_ISAAC_B || player->_playerType == PLAYER_BLUEBABY_B) at.y -= INVENTORY_RISE; - else if (player->_playerType == PLAYER_CAIN_B) at.y -= CRAFTING_RISE; + if (player->playerType == PLAYER_ISAAC_B || player->playerType == PLAYER_BLUEBABY_B) at.y -= INVENTORY_RISE; + else if (player->playerType == PLAYER_CAIN_B) at.y -= CRAFTING_RISE; return at; } @@ -1582,7 +1485,7 @@ int HUD::GetPlayerHudIndex(Entity_Player* player) return -1; } - Entity_Player* shown = is_main_twin(*player) ? player : entity_ptr_get(player->_twinPlayer); + Entity_Player* shown = is_main_twin(*player) ? player : player->twin_get(); for (int i = 0; i < MAIN_PLAYER_HUD_COUNT; i++) if (playerHUD[i].player == shown) return i; @@ -1632,7 +1535,7 @@ void HUD::AssignPlayerHUDs() PlayerManager& players = g_game->playerManager; auto is_assigned = [](Entity_Player& player) - { return is_main_twin(player) && !entity_ptr_get(player._parent) && player._exists; }; + { return is_main_twin(player) && !player.parent && player.isExists; }; if (!players.playerList.empty()) { for (CoopJoinSlot& slot : players.coopSlots) @@ -1643,7 +1546,7 @@ void HUD::AssignPlayerHUDs() slot.playerType = 0; } for (Entity_Player* player : players.playerList) - if (is_assigned(*player)) players.GetPlayerSlotFromController(player->_controllerIndex); + if (is_assigned(*player)) players.GetPlayerSlotFromController(player->controllerIndex); } for (size_t i = 0; i < players.playerList.size(); i++) @@ -1651,27 +1554,27 @@ void HUD::AssignPlayerHUDs() Entity_Player* player = players.playerList[i]; if (!is_assigned(*player)) continue; - int seat = players.GetPlayerSlotFromController(player->_controllerIndex); + int seat = players.GetPlayerSlotFromController(player->controllerIndex); if (seat < 0) { log_printf(LOG_ERROR, "((()))->HUD::AssignPlayerHUDs() could not determine player HUD slot for player entity %d " "(ControlerIndex = %d) \n", - (int)i, player->_controllerIndex); + (int)i, player->controllerIndex); continue; } log_printf(LOG_INFO, "Assinging player entity %d (ControlerIndex = %d) to HUD slot %d \n", (int)i, - player->_controllerIndex, seat); + player->controllerIndex, seat); corner_assign(playerHUD[seat], player); - Entity_Player* twin = entity_ptr_get(player->_twinPlayer); - if (!twin || !twin->_exists || twin->_playerType == PLAYER_JACOB2_B) continue; - bool isLazarusB = twin->_playerType == PLAYER_LAZARUS_B || twin->_playerType == PLAYER_LAZARUS2_B; + Entity_Player* twin = player->twin_get(); + if (!twin || !twin->isExists || twin->playerType == PLAYER_THESOUL_B) continue; + bool isLazarusB = twin->playerType == PLAYER_LAZARUS_B || twin->playerType == PLAYER_LAZARUS2_B; if (isLazarusB && !is_main_twin(*twin)) continue; log_printf(LOG_INFO, "Assinging player entity %d's twin (ControlerIndex = %d) to HUD slot %d \n", (int)i, - twin->_controllerIndex, seat); + twin->controllerIndex, seat); corner_assign(playerHUD[seat + MAIN_PLAYER_HUD_COUNT], twin); } } diff --git a/src/hud.h b/src/hud.h index 2971197..a179a1f 100644 --- a/src/hud.h +++ b/src/hud.h @@ -3,8 +3,10 @@ #include "anm2.h" #include "font.h" #include "fx_layers.h" +#include "item_info_hud.h" #include "kage_graphics.h" #include "rich_text.h" +#include "stat_hud.h" #include #include #include @@ -20,11 +22,6 @@ constexpr int PLAYER_HUD_TRINKET_COUNT = 2; constexpr int PLAYER_HUD_POCKET_COUNT = 4; constexpr int MESSAGE_STACK_COUNT = 6; constexpr int HISTORY_PLAYER_COUNT = 2; -constexpr int STAT_PLAYER_COUNT = 2; -constexpr int STAT_TRACKER_COUNT = 10; -constexpr int STAT_TRACKER_FINE_COUNT = 6; -constexpr float STAT_THRESHOLD_FINE = 0.01f; -constexpr float STAT_THRESHOLD_COARSE = 0.1f; constexpr float BOSS_BAR_HIDDEN = -1; constexpr int FLASH_OFF = -1; constexpr int ONLINE_HUD_OFFLINE = 3; @@ -179,40 +176,8 @@ struct PlayerHUD static std::shared_ptr make_ref(HUD* owner, Entity_Player* shown); }; -// A stat the stats HUD shows: its value, the value before its last change, the change shown and for how long, and the -// smallest change worth showing. -struct StatTracker -{ - float change = 0; - float previous = 0; - float threshold = STAT_THRESHOLD_FINE; - float value = 0; - int changeTimer = 0; - void set(float newValue, bool isAnimated); -}; -// The stats one player shows. -struct StatHUDPlayer -{ - std::array stats{}; - Entity_Player* player = nullptr; -}; - -// The stats HUD (REPENTOGON's StatHUD) under the pickups: speed, tears, damage, range, shot speed, luck and the room -// chances, for up to two players. -struct StatHUD -{ - ANM2 sprite; - std::array players{}; - bool isDualityOwned = false; - - void reset(); - void Update(); - void Render(Vector at); - void RecomputeStats(int playerId, uint32_t flags, bool isAnimated); - void update_player(Entity_Player* oldPlayer, Entity_Player* newPlayer); -}; // An item of the recent items list, with its icon. struct HistoryHUDItem @@ -241,20 +206,6 @@ struct HistoryHUD void RecomputeAll(bool isImmediate); }; -// The panel describing the item the player stands next to: its charge icon, map icons and rich text. -struct ItemInfoHUD -{ - ANM2 iconSprite; - ANM2 chargeIconSprite; - ANM2 mapIconsSprite; - RichText text; - KAGE::Graphics::ImagePtr itemImage; - float iconScale = 0; - int pickupIndex = -1; - - void load_graphics(); - void Update(); -}; // The online HUD style option in effect, ONLINE_HUD_OFFLINE offline. int online_hud_mode(); diff --git a/src/info_display.cpp b/src/info_display.cpp index d52364d..ec7bbb2 100644 --- a/src/info_display.cpp +++ b/src/info_display.cpp @@ -1,4 +1,5 @@ #include "info_display.h" +#include "entity_player.h" #include "game.h" #include "persistent_game_data.h" #include "manager.h" @@ -8,7 +9,6 @@ #include constexpr std::string_view DOCUMENT_TAG = "#document"; -constexpr uint32_t TRINKET_GOLDEN_FLAG = 0x8000; constexpr uint32_t PILL_HORSE_FLAG = 0x800; constexpr int RED_HEARTS_ALL = 24; @@ -22,7 +22,6 @@ constexpr int DEFAULT_PILL_COUNT = 50; constexpr int PLAYER_FORM_NECROMANCER = 15; constexpr int COLLECTIBLE_NECRONOMICON = 35; constexpr int COLLECTIBLE_MISSING_PAGE_2 = 262; -constexpr int TRINKET_MISSING_PAGE = 48; // A group of info_display.xml: its element names and the kind of entry it fills. struct InfoDisplayGroup @@ -309,10 +308,10 @@ bool InfoDisplayEntry::is_line_visible(size_t lineIndex, Entity_Player& player, if (id == 0) return true; InfoDisplayText& line = lines[lineIndex]; - auto isOwned = [&](int collectible) { return player.HasCollectible(collectible, 0) != 0; }; - auto isHeld = [&](int trinket) { return player.HasTrinket((uint32_t)trinket, 0) != 0; }; - if (!line.players.empty() && !is_listed(line.players, player._playerType)) return false; - if (is_listed(line.notPlayers, player._playerType)) return false; + auto isOwned = [&](int collectible) { return player.HasCollectible(collectible); }; + auto isHeld = [&](int trinket) { return player.HasTrinket((uint32_t)trinket); }; + if (!line.players.empty() && !is_listed(line.players, player.playerType)) return false; + if (is_listed(line.notPlayers, player.playerType)) return false; if (!std::ranges::all_of(line.collectibles, isOwned) || std::ranges::any_of(line.notCollectibles, isOwned)) return false; if (!std::ranges::all_of(line.trinkets, isHeld) || std::ranges::any_of(line.notTrinkets, isHeld)) return false; diff --git a/src/item_info_hud.cpp b/src/item_info_hud.cpp new file mode 100644 index 0000000..cec358c --- /dev/null +++ b/src/item_info_hud.cpp @@ -0,0 +1,56 @@ +#include "item_info_hud.h" +#include "game.h" +#include "log.h" +#include "manager.h" +#include "room.h" + +constexpr const char* ITEM_INFO_FONT = "font/TeamMeatEx/TeamMeatEx12.fnt"; +constexpr const char* CHARGE_ICONS_ANM2 = "gfx/ui/ui_charge_icons.anm2"; +constexpr const char* MINIMAP_ICONS_ANM2 = "gfx/ui/minimap_icons.anm2"; +constexpr const char* ANIMATION_CHARGE_ICON = "ChargeIcon"; +constexpr float ITEM_INFO_LINE_SPACING = 0.9f; +constexpr float ITEM_INFO_ICON_SCALE = 4; +constexpr int ACHIEVEMENT_ITEM_INFO = 641; +constexpr uint32_t CHALLENGE_APRILS_FOOL = 32; + +// 0083c5f0 Loads the panel's font (without redirection), charge icon and map icons. +void ItemInfoHUD::load_graphics() +{ + text.load_font(ITEM_INFO_FONT); + text.lineSpacing = ITEM_INFO_LINE_SPACING; + iconSprite.Reset(); + chargeIconSprite.Load(CHARGE_ICONS_ANM2, GRAPHICS_LOAD); + chargeIconSprite.Play(ANIMATION_CHARGE_ICON); + iconScale = ITEM_INFO_ICON_SCALE; + mapIconsSprite.Load(MINIMAP_ICONS_ANM2, GRAPHICS_LOAD); +} + +// 0083d6e0 Forgets the pickup described: its image, entry and popup, and the collectible images of the text's icons. +void ItemInfoHUD::reset() +{ + itemImage.reset(); + entry = nullptr; + pickup = nullptr; + g_manager->popupQueue.close(popupId, POPUP_NONE); + popupId = POPUP_NONE; + if (text.icons) text.icons->images.clear(); +} + +// 0083c8d0 Describes the pickup the first local player stands nearest to, while the display is on (unlocked, or in a +// daily or debug run), outside April's Fool and in a cleared room. Otherwise it forgets it. +// Finding and describing the pickup waits for the pickups' and the popups' takeovers, and with it the panel's +// is_pickup_known, is_collectible_seen and the popup's measure and render callback. +void ItemInfoHUD::Update() +{ + Game& game = *g_game; + bool isUnlocked = g_manager->persistentGameData.Unlocked(ACHIEVEMENT_ITEM_INFO); + bool isCleared = game.room->descriptor->flags & ROOM_DESCRIPTOR_FLAG_CLEAR; + bool isShown = isUnlocked && game.challenge != CHALLENGE_APRILS_FOOL && + g_manager->optionsConfig.isItemInfoDisplayEnabled && isCleared; + + if (!isShown) reset(); + else if (game.playerManager.get_first_local_main_player()) + reconstruction_missing("ItemInfoHUD::Update 0083c8d0: the nearest pickup's description"); + if (pickup && popupId == POPUP_NONE) + reconstruction_missing("ItemInfoHUD::Update 0083c8d0: the description's popup"); +} diff --git a/src/item_info_hud.h b/src/item_info_hud.h new file mode 100644 index 0000000..7d23c78 --- /dev/null +++ b/src/item_info_hud.h @@ -0,0 +1,29 @@ +#pragma once + +#include "anm2.h" +#include "kage_graphics.h" +#include "rich_text.h" + +constexpr int POPUP_NONE = -1; + +struct InfoDisplayEntry; + +// Construction and destruction (0083c400, 0083c4c0) are the defaults. +// The item info display (an option unlocked by an achievement): a popup describing the item, trinket, pill or card +// the player stands nearest to, with its image or sprite, its charge and map icons and its rich text. +struct ItemInfoHUD +{ + ANM2 chargeIconSprite; + ANM2 iconSprite; + ANM2 mapIconsSprite; + RichText text; + KAGE::Graphics::ImagePtr itemImage; + Entity_Pickup* pickup = nullptr; + const InfoDisplayEntry* entry = nullptr; + float iconScale = 0; + int popupId = POPUP_NONE; + + void load_graphics(); + void reset(); + void Update(); +}; diff --git a/src/item_pool.cpp b/src/item_pool.cpp index 12e9ec3..3fad1a3 100644 --- a/src/item_pool.cpp +++ b/src/item_pool.cpp @@ -1,10 +1,12 @@ #include "item_pool.h" #include "data.h" #include "entity_config.h" +#include "entity_player.h" #include "game.h" #include "lua_engine.h" #include "manager.h" #include "platform.h" +#include "room.h" #include "room_config.h" #include #include @@ -25,12 +27,6 @@ constexpr std::string_view POOL_NAMES[POOL_COUNT] = { "babyShop", "woodenChest", "rottenBeggar"}; constexpr int ROOM_TYPE_SLOTS = 31; -constexpr int ROOM_ERROR = 3; -constexpr int ROOM_TREASURE = 4; -constexpr int ROOM_BOSS = 5; -constexpr int ROOM_CHALLENGE = 11; -constexpr int ROOM_DEVIL = 14; -constexpr int ROOM_DEFAULT = 1; constexpr int ROOM_ERROR_POOLS = 30; // The pool each room type draws from, normally and in Greed mode (set up by Game's constructor). constexpr std::array ROOM_POOLS = { @@ -77,7 +73,6 @@ constexpr int ROSARY_CHANCE_PER_MULTIPLIER = 2; constexpr int GOLDEN_TRINKET_ODDS = 50; constexpr uint32_t DEBUG_GOLDEN_TRINKETS = 0x8; constexpr uint32_t TRINKET_GOLDEN = 0x8000; -constexpr uint32_t TRINKET_ID_MASK = 0x7fff; constexpr uint32_t STATE_SATANIC_BIBLE_USED = 0x20000; constexpr uint32_t DESCRIPTOR_DEVIL_TREASURE = 0x800; constexpr int BOSS_THE_FALLEN = 23; @@ -89,24 +84,18 @@ constexpr int COLLECTIBLE_ROTTEN_MEAT = 26; constexpr int COLLECTIBLE_BIBLE = 33; constexpr int COLLECTIBLE_ROSARY = 72; constexpr int COLLECTIBLE_PHD = 75; -constexpr int COLLECTIBLE_LUCKY_FOOT = 46; constexpr int COLLECTIBLE_PYROMANIAC = 223; -constexpr int COLLECTIBLE_BUTTER_BEAN = 294; constexpr int COLLECTIBLE_VIRGO = 303; constexpr int COLLECTIBLE_HOST_HAT = 375; constexpr int COLLECTIBLE_CHAOS = 402; constexpr int COLLECTIBLE_APPLE = 443; -constexpr int COLLECTIBLE_WAIT_WHAT = 484; constexpr int COLLECTIBLE_MAGIC_SKIN = 642; constexpr int COLLECTIBLE_FALSE_PHD = 654; constexpr int COLLECTIBLE_TMTRAINER = 721; constexpr int TRINKET_ROSARY_BEAD = 7; constexpr int TRINKET_NO = 88; -constexpr int TRINKET_BUTTER = 122; constexpr int TRINKET_PERFECTION = 145; constexpr uint32_t CHALLENGE_ONANS_STREAK = 29; -constexpr uint32_t CHALLENGE_PICA_RUN = 41; -constexpr uint32_t CHALLENGE_CANTRIPPED = 43; constexpr int ACHIEVEMENT_GOLDEN_TRINKETS = 617; constexpr int ACHIEVEMENT_GOLD_PILLS = 603; constexpr int ACHIEVEMENT_HORSE_PILLS = 606; @@ -155,13 +144,6 @@ constexpr std::pair FALSE_PHD_EFFECTS[] = { {32, 11}, {10, 17}, {18, 17}, {35, 17}, {14, 13}, {20, 13}, {33, 13}, {19, 31}, {23, 25}, {26, 25}, {24, 22}, {28, 29}, {36, 27}, {40, 39}, {41, 42}, {43, 44}, {46, 44}, {45, 37}, {48, 47}}; -static RNG rng_make(uint32_t seed, uint32_t shift) -{ - RNG rng; - rng.SetSeed(seed, shift); - return rng; -} - static bool is_unlocked(int achievementId) { return achievementId < 0 || g_manager->persistentGameData.Unlocked(achievementId); @@ -428,7 +410,7 @@ int ItemPool::GetPoolForRoom(int roomType, uint32_t roomSeed) // The original reads before a spawn whose entries all weigh nothing. Here such a spawn is passed over. int ItemPool::get_pool_from_room_entities(uint32_t roomSeed, RoomDescriptor& room, int bossId) { - RoomConfig_Room& data = *room.Data; + RoomConfig_Room& data = *room.data; int roomType = data.type; if (roomType == ROOM_BOSS && bossId == 0) @@ -444,12 +426,12 @@ int ItemPool::get_pool_from_room_entities(uint32_t roomSeed, RoomDescriptor& roo } bool isFallen = bossId == BOSS_THE_FALLEN; - bool isGreedSide = g_game->IsGreedMode() && room.GridIndex != (int)g_game->greedModeTreasureRoomIdx; + bool isGreedSide = g_game->IsGreedMode() && room.gridIndex != (int)g_game->greedModeTreasureRoomIdx; if (isFallen || (roomType == ROOM_BOSS && (g_game->levelStateFlags & STATE_SATANIC_BIBLE_USED))) roomType = ROOM_DEVIL; else if (roomType == ROOM_TREASURE && isGreedSide) roomType = ROOM_BOSS; - else if (roomType == ROOM_TREASURE && (room.Flags & DESCRIPTOR_DEVIL_TREASURE)) + else if (roomType == ROOM_TREASURE && (room.flags & DESCRIPTOR_DEVIL_TREASURE)) roomType = ROOM_DEVIL; else if (roomType == ROOM_CHALLENGE && data.subtype == 1) roomType = ROOM_BOSS; @@ -533,7 +515,7 @@ int ItemPool::GetCollectible(ItemPoolType poolType, uint32_t drawSeed, uint32_t RNG poolRng = rng_make(drawSeed, CHAOS_SHIFT); bool isChaos = players.AnyoneHasCollectible(COLLECTIBLE_CHAOS) || - g_game->room->_temporaryEffects.HasCollectibleEffect(COLLECTIBLE_CHAOS); + g_game->room->temporaryEffects.HasCollectibleEffect(COLLECTIBLE_CHAOS); int pool = isChaos ? get_chaos_pool(poolRng) : poolType; lastPool = pool; if (int item = (int)FUN_00865dc0(poolType, isDecrease, drawSeed)) return item; @@ -918,10 +900,10 @@ int ItemPool::GetPillEffect(uint32_t pillColor, Entity_Player* player) if (g_game->dailyChallenge._specialDailyId == DAILY_EXPLOSIVE_PILLS) return PILLEFFECT_EXPLOSIVE_DIARRHEA; if (player) { - bool isPhd = player->HasCollectible(COLLECTIBLE_PHD, 0) || player->HasCollectible(COLLECTIBLE_VIRGO, 0) || - player->HasCollectible(COLLECTIBLE_LUCKY_FOOT, 0) || + bool isPhd = player->HasCollectible(COLLECTIBLE_PHD) || player->HasCollectible(COLLECTIBLE_VIRGO) || + player->HasCollectible(COLLECTIBLE_LUCKY_FOOT) || player->GetZodiacEffect() == COLLECTIBLE_VIRGO; - bool hasFalsePhd = player->HasCollectible(COLLECTIBLE_FALSE_PHD, 0); + bool hasFalsePhd = player->HasCollectible(COLLECTIBLE_FALSE_PHD); isFalsePhd = !isPhd && hasFalsePhd; if (isPhd && !hasFalsePhd) effect = effect_swap(PHD_EFFECTS, effect); diff --git a/src/level.cpp b/src/level.cpp index 3e242c3..bb8921a 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -1,25 +1,41 @@ #include "level.h" +#include "boss_pool.h" +#include "entity_player.h" #include "game.h" #include "hud.h" #include "manager.h" #include "platform.h" +#include "room.h" +#include "room_transition.h" #include "texture_cache.h" #include +#include +#include #include constexpr uint32_t LEVEL_STAGE_BASEMENT_I = 1; constexpr uint32_t LEVEL_STAGE_CAVES_I = 3; +constexpr uint32_t LEVEL_STAGE_CAVES_II = 4; constexpr uint32_t LEVEL_STAGE_DEPTHS_I = 5; constexpr uint32_t LEVEL_STAGE_DEPTHS_II = 6; constexpr uint32_t LEVEL_STAGE_WOMB_I = 7; constexpr uint32_t LEVEL_STAGE_WOMB_II = 8; constexpr uint32_t LEVEL_STAGE_BLUE_WOMB = 9; +constexpr uint32_t LEVEL_STAGE_SHEOL = 10; constexpr uint32_t LEVEL_STAGE_DARK_ROOM = 11; constexpr uint32_t LEVEL_STAGE_VOID = 12; constexpr uint32_t LEVEL_STAGE_HOME = 13; constexpr uint32_t ASCENT_LAST_STAGE = 6; constexpr int VOID_STAGE_ID_LAST = 17; constexpr int STAGE_ID_SPECIAL_ROOMS = 0; +constexpr int STAGE_ID_DEPTHS = 7; +constexpr int STAGE_ID_NECROPOLIS = 8; +constexpr int STAGE_ID_DANK_DEPTHS = 9; +constexpr int STAGE_ID_DARK_ROOM = 16; +constexpr int STAGE_ID_CHEST = 17; +constexpr int STAGE_ID_ASHPIT = 30; +constexpr int STAGE_ID_MAUSOLEUM = 31; +constexpr int STAGE_ID_BACKWARDS = 36; constexpr int STAGE_ID_BLUE_WOMB = 13; constexpr int STAGE_ID_MINES = 29; constexpr int STAGE_ID_CORPSE = 33; @@ -28,8 +44,6 @@ constexpr int STAGE_ID_DROSS = 28; constexpr int STAGE_ID_VOID = 26; constexpr uint32_t CHALLENGE_XXXXXXXXL = 21; -constexpr uint32_t CHALLENGE_BACKASSWARDS = 31; -constexpr uint32_t CHALLENGE_RED_REDEMPTION = 44; constexpr uint32_t SPECIAL_DAILY_NO_CURSES = 18; constexpr uint32_t SPECIAL_DAILY_CURSED = 37; constexpr uint32_t SPECIAL_DAILY_CURSES = CURSE_OF_THE_LOST | CURSE_OF_THE_UNKNOWN | CURSE_OF_BLIND; @@ -37,28 +51,55 @@ constexpr uint32_t SPECIAL_DAILY_CURSES = CURSE_OF_THE_LOST | CURSE_OF_THE_UNKNO constexpr int ACHIEVEMENT_THE_WOMB = 4; constexpr int ACHIEVEMENT_EVERYTHING_IS_TERRIBLE = 33; constexpr int ACHIEVEMENT_STRANGE_DOOR = 635; +constexpr int ACHIEVEMENT_SOMETHING_FROM_THE_FUTURE = 16; +constexpr int ACHIEVEMENT_SOMETHING_CUTE = 17; +constexpr int ACHIEVEMENT_SOMETHING_STICKY = 18; +constexpr int ACHIEVEMENT_SOMETHING_ICKY = 68; +constexpr int ACHIEVEMENT_STORE_UPGRADE_1 = 151; +constexpr int ACHIEVEMENT_STORE_UPGRADE_2 = 152; +constexpr int ACHIEVEMENT_STORE_UPGRADE_3 = 153; +constexpr int ACHIEVEMENT_STORE_UPGRADE_4 = 154; +constexpr int ACHIEVEMENT_THE_VOID = 320; +constexpr int ACHIEVEMENT_SOMETHING_WICKED = 346; +constexpr int ACHIEVEMENT_SOMETHING_WICKED_PLUS = 347; +constexpr int ACHIEVEMENT_THE_FORGOTTEN = 390; +constexpr int ACHIEVEMENT_PLANETARIUMS = 406; +constexpr int EVENT_COUNTER_SUPER_SINS_A = 24; +constexpr int EVENT_COUNTER_SUPER_SINS_B = 25; constexpr int EVENT_COUNTER_CURSE_ODDS = 11; constexpr int COLLECTIBLE_BLACK_CANDLE = 260; +constexpr int COLLECTIBLE_XRAY_VISION = 76; +constexpr int COLLECTIBLE_SPELUNKER_HAT = 91; +constexpr int COLLECTIBLE_CRYSTAL_BALL = 158; +constexpr int COLLECTIBLE_MAGIC_8_BALL = 194; +constexpr int COLLECTIBLE_MORE_OPTIONS = 414; +constexpr int COLLECTIBLE_BROKEN_SHOVEL_1 = 550; +constexpr int COLLECTIBLE_MOMS_SHOVEL = 552; +constexpr int COLLECTIBLE_KNIFE_PIECE_1 = 626; +constexpr int COLLECTIBLE_SAUSAGE = 669; +constexpr int TRINKET_GOLDEN_HORSE_SHOE = 82; +constexpr int TRINKET_RIB_OF_GREED = 84; +constexpr int TRINKET_FRAGMENTED_CARD = 102; +constexpr int TRINKET_SILVER_DOLLAR = 110; +constexpr int TRINKET_BLOODY_CROWN = 111; +constexpr int TRINKET_PAY_TO_WIN = 112; +constexpr int TRINKET_TELESCOPE_LENS = 152; +constexpr int TRINKET_HOLY_CROWN = 155; +constexpr int TRINKET_WICKED_CROWN = 161; +constexpr int TRINKET_BROKEN_GLASSES = 187; constexpr int COLLECTIBLE_VOODOO_HEAD = 599; -constexpr int COLLECTIBLE_KEY_PIECE_1 = 238; -constexpr int COLLECTIBLE_KEY_PIECE_2 = 239; constexpr int TRINKET_MYOSOTIS = 137; constexpr int TRINKET_DEVILS_CROWN = 146; -constexpr int ROOM_TYPE_DEFAULT = 1; -constexpr int ROOM_TYPE_TREASURE = 4; constexpr int TREASURE_SUBTYPE_KNIFE_PIECE = 34; constexpr int LIL_PORTAL_ROOM_VARIANT = 2; constexpr int GRID_STAIRS = 18; constexpr int GRID_TRAPDOOR = 17; -constexpr int ROOM_GRID_CELLS = 448; constexpr int GRID_SPAWN_PIT_FIRST = 3000; constexpr int GRID_SPAWN_PIT_END = 3010; constexpr int ROOM_INDEX_OTHER_DIMENSION = -100; constexpr int ROOM_INDEX_MIRRORED_START = -101; constexpr int MIRROR_START_GRID_INDEX = 162; constexpr int MIRROR_START_SUBTYPE = 10; -constexpr uint32_t ROOM_DESCRIPTOR_DEVIL_TREASURE = 0x800; -constexpr uint32_t ROOM_DESCRIPTOR_ALTERNATE_BACKDROP = 0x1000; constexpr int BACKDROP_DOWNPOUR_ENTRANCE = 31; constexpr int BACKDROP_DOWNPOUR_EXIT = 36; constexpr int BACKDROP_DROSS = 45; @@ -66,6 +107,144 @@ constexpr int BOSS_RUSH_PAR_TIME = 36000; constexpr int BOSS_RUSH_PAR_TIME_ALT = 45000; constexpr uint32_t BACKWARDS_STAGE_END = 8; +constexpr int STATE_GREED_SPAWNED = 15; +constexpr int STATE_SUPER_GREED_SPAWNED = 16; +constexpr int STATE_DONATION_SLOT_BLOWN = 30; +constexpr int STATE_SHOPKEEPER_KILLED = 31; +constexpr int STATE_ULTRA_PRIDE_SPAWNED = 32; +constexpr int DEATH_CERTIFICATE_DIMENSION = 2; +constexpr int ROOM_SCREEN_WIDTH = 13; +constexpr int ROOM_SCREEN_HEIGHT = 7; +constexpr int START_ROOM_VARIANT = 2; +constexpr int ULTRA_SECRET_GROUP = 99; +constexpr int BOSS_MEGA_SATAN = 55; +constexpr int BOSS_MOTHER = 88; +constexpr int BOSS_MOTHER_HEART = 89; +constexpr int BOSS_ROOM_RETRIES = 50; +constexpr int BOSS_ROOM_VARIANTS = 50; +constexpr int BOSS_ROOM_REROLL_FIRST = 3700; +constexpr int BOSS_ROOM_REROLL_END = 3850; +constexpr int VOID_EXTRA_BOSS_ROLL = 4; +constexpr int VOID_EXTRA_BOSSES_MIN = 5; +constexpr int SHOP_LEVEL_MAX = 4; +constexpr int SHOP_SUBTYPE_RARE = 10; +constexpr int SHOP_SUBTYPE_STORE_KEY = 11; +constexpr int SHOP_SUBTYPE_TAINTED_KEEPER = 100; +constexpr int TREASURE_SUBTYPE_OPTIONS = 1; +constexpr int TREASURE_SUBTYPE_PAY_TO_WIN = 2; +constexpr int TREASURE_SUBTYPE_OPTIONS_PAY_TO_WIN = 3; +constexpr uint32_t TREASURE_OPTIONS_ODDS = 100; +constexpr uint32_t HORSE_SHOE_PERIOD = 100; +constexpr uint32_t HORSE_SHOE_HITS = 15; +constexpr uint32_t SPECIAL_DAILY_TREASURE_OPTIONS = 19; +constexpr uint32_t DICE_ROOM_ODDS = 50; +constexpr uint32_t DICE_ROOM_KEY_ODDS = 5; +constexpr uint32_t SACRIFICE_ROOM_ODDS = 7; +constexpr uint32_t LIBRARY_ODDS = 20; +constexpr int SUPER_SIN_ODDS = 80; +constexpr int SUPER_SIN_ODDS_WOMB = 30; +constexpr int SUPER_SIN_ODDS_TERRIBLE = 10; +constexpr int SUPER_SIN_ODDS_EVENT = 5; +constexpr uint32_t ULTRA_PRIDE_ODDS = 10; +constexpr int SIN_ULTRA_PRIDE = 14; +constexpr uint32_t CHEST_ROOM_ODDS = 10; +constexpr uint32_t CHEST_ROOM_KEY_ODDS = 3; +constexpr uint32_t BEDROOM_ODDS = 50; +constexpr uint32_t BEDROOM_DYING_ODDS = 5; +constexpr int MIRROR_ROOM_SUBTYPE = 34; +constexpr int MINESHAFT_ENTRANCE_SUBTYPE = 10; +constexpr int SPECIAL_DOOR_PUZZLE_SUBTYPE = 1; +constexpr uint32_t DARK_ROOM_EXTRA_VARIANT_FIRST = 3; +constexpr uint32_t DARK_ROOM_EXTRA_VARIANT_LAST = 9; +constexpr int TAKEOVER_COINS = 20; +constexpr float TAKEOVER_CHANCE_RICH = 1.05f; +constexpr int TAKEOVER_DONATIONS_MAX = 5; +constexpr float TAKEOVER_DONATION_PENALTY = 0.05f; +constexpr float TAKEOVER_SHARE = 0.33333334f; +constexpr uint32_t TAKEOVER_BOTH_ODDS = 1000; +constexpr float PLANETARIUM_CHANCE_MIN = 0.01f; +constexpr float PLANETARIUM_SKIPPED_BONUS = 0.2f; +constexpr float PLANETARIUM_ITEM_BONUS = 0.15f; +constexpr float PLANETARIUM_SAUSAGE_BONUS = 0.069f; +constexpr float PLANETARIUM_LENS = 0.09f; +constexpr float PLANETARIUM_LENS_ONE = 0.18f; +constexpr float PLANETARIUM_LENS_BOTH = 0.33f; + +// The bosses the Void may add boss rooms for, in the order they are shuffled from. +constexpr std::array VOID_BOSS_IDS = {0, 5, 7, 8, 11, 12, 15, 16, 19, 22, 24, 25, 30, 31, 33, 35, + 38, 39, 40, 41, 42, 46, 48, 49, 51, 53, 54, 58, 59, 66, 68}; + +// The run state flags that raise Greed's takeover chance once, each cleared as it counts. +constexpr std::array, 2> TAKEOVER_BONUSES = { + {{STATE_DONATION_SLOT_BLOWN, 0.1f}, {STATE_SHOPKEEPER_KILLED, 0.02f}}}; + +// A sin a miniboss room fights: the run state flag of meeting it, and its normal and super subtypes. +struct MinibossSin +{ + int flag = 0; + int subtype = 0; + int superSubtype = 0; +}; + +// The sins, in the order a miniboss room draws them: Wrath, Gluttony, Lust, Sloth, Envy, Pride. +constexpr std::array MINIBOSS_SINS = { + {{9, 2, 9}, {10, 3, 10}, {11, 1, 8}, {12, 0, 7}, {13, 5, 12}, {14, 6, 13}}}; + +// A Double Trouble pairing (boss room subtypes firstSubtype to lastSubtype) an achievement unlocks. +struct DoubleTroubleLock +{ + int achievement = 0; + int firstSubtype = 0; + int lastSubtype = 0; + + bool is_locked(int subtype) const + { + return subtype >= firstSubtype && subtype <= lastSubtype && + !g_manager->persistentGameData.Unlocked(achievement); + } +}; + +constexpr std::array DOUBLE_TROUBLE_LOCKS = {{{ACHIEVEMENT_SOMETHING_FROM_THE_FUTURE, 20, 20}, + {ACHIEVEMENT_SOMETHING_CUTE, 21, 21}, + {ACHIEVEMENT_SOMETHING_STICKY, 19, 19}, + {ACHIEVEMENT_SOMETHING_ICKY, 42, 42}, + {ACHIEVEMENT_SOMETHING_WICKED, 57, 66}, + {ACHIEVEMENT_SOMETHING_WICKED_PLUS, 67, 72}}}; + +constexpr int DEVILS_CROWN_TRIES = 10; +constexpr uint32_t DEVILS_CROWN_VARIANT_LAST = 99; +constexpr int GREED_SUBTYPE = 4; +constexpr int GREED_SUBTYPE_SUPER = 11; +constexpr int GREED_SUBTYPE_DEVIL = 15; +constexpr int RED_ROOM_DOOR_TARGET = -2; +constexpr int GRID_DOOR = 16; +constexpr int DOOR_VARIANT_HIDDEN = 7; +constexpr int HUD_REFRESH_FRAMES = 2; +constexpr int BACKDROP_CORPSE3 = 44; +constexpr int EFFECT_VARIANT_BLOOD_SPLAT = 7; +constexpr uint32_t TRANSITION_FLAG_TREASURE_REROLL = 1 << 0; +constexpr uint32_t TRANSITION_FLAG_NO_TAKEOVER = 1 << 1; +constexpr int SPLAT_COUNT = 9; +constexpr float SPLAT_STEP = 0.125f; +constexpr float SPLAT_DOOR_OFFSET = 20; +constexpr float SPLAT_LENGTH = 128; +constexpr float SPLAT_SPREAD = 40; +constexpr float SPLAT_SCALE_RANGE = 5; +constexpr float SPLAT_SCALE_MIN = 0.5f; +constexpr float QUARTER_TURN = 1.5707964f; +constexpr ColorMod SPLAT_COLOR = {{0.8f, 0.8f, 0.8f, 1}, {0, 0, 0, 0}, {0, 0, 0}}; + +// The cell offsets of the four sides: left, up, right, down. +constexpr std::array CARDINAL_OFFSETS = {{{-1, 0}, {0, -1}, {1, 0}, {0, 1}}}; + +// The rooms off the map whose entry door leads back to the room the players came from. +constexpr std::array OFF_MAP_ENTRY_ROOMS = {ROOM_DEVIL_IDX, ROOM_BLACK_MARKET_IDX, ROOM_DEBUG_IDX, + ROOM_BOSSRUSH_IDX, ROOM_BLUE_WOMB_IDX, ROOM_THE_VOID_IDX, + ROOM_SECRET_EXIT_IDX, ROOM_EXTRA_BOSS_IDX, ROOM_ANGEL_SHOP_IDX}; + +// The rooms whose doors out of a Corpse room get blood splats when they use the alternate backdrop. +constexpr std::array CORPSE_SPLAT_ROOM_TYPES = {ROOM_DEFAULT, ROOM_TREASURE, ROOM_MINIBOSS, ROOM_BOSS}; + constexpr XY START_POSITION = {6, 6}; constexpr XY PHOTO_DOOR_CELL = {6, 5}; constexpr int START_GRID_INDEX = 84; @@ -102,7 +281,6 @@ constexpr int CORPSE_BACKDROP_ODDS = 5; constexpr uint32_t GENERATION_SHIFT_INDEX = 35; constexpr uint32_t DEVIL_ANGEL_SHIFT_INDEX = 2; constexpr uint32_t ROOM_SEEDS_SHIFT_INDEX = 12; -constexpr uint32_t BOSS_DEATH_SHIFT_INDEX = 66; constexpr uint32_t LIL_PORTAL_SHIFT_INDEX = 25; constexpr uint32_t CORPSE_BACKDROP_SHIFT_INDEX = 7; @@ -118,6 +296,12 @@ static bool game_flag_get(int flag) return g_game->gameStateFlags >> flag & 1; } +// Sets or clears a run state flag. +static void game_flag_set(int flag, bool isSet) +{ + g_game->gameStateFlags = isSet ? g_game->gameStateFlags | 1ull << flag : g_game->gameStateFlags & ~(1ull << flag); +} + static bool is_greed() { return g_game->difficulty == DIFFICULTY_GREED || g_game->difficulty == DIFFICULTY_GREEDIER; @@ -128,35 +312,12 @@ static bool is_unlocked(int achievement) return g_manager->persistentGameData.Unlocked(achievement); } -// 00428940 Draws a room's decoration, spawn and award seeds from rng, and its boss death seed from the award seed. -void room_descriptor_seeds_init(RoomDescriptor& room, RNG& rng) -{ - room.DecorationSeed = (int32_t)rng.Next(); - room.SpawnSeed = (int32_t)rng.Next(); - room.AwardSeed = (int32_t)rng.Next(); - - RNG deathRng{}; - - deathRng.SetSeed((uint32_t)room.AwardSeed, BOSS_DEATH_SHIFT_INDEX); - room.BossDeathSeed = deathRng.Next(); -} - // 0074d8d0 Whether a room is a treasure room Devil's Crown turns: not a knife piece room, not visited yet, and in // Greed only the floor's treasure room. static bool is_devils_crown_room(Level& level, RoomDescriptor& room) { - return room.Data->type == ROOM_TYPE_TREASURE && room.Data->subtype != TREASURE_SUBTYPE_KNIFE_PIECE && - (!is_greed() || (uint32_t)room.GridIndex == level.greedModeTreasureRoomIdx) && room.VisitedCount == 0; -} - -// A room descriptor as RoomDescriptor's constructor leaves it, its saved state released. -static void room_descriptor_reset(RoomDescriptor& room) -{ - RoomDescriptor fresh{}; - - fresh.constructor(); - room.operator_assign(&fresh); - fresh.destructor(); + return room.data->type == ROOM_TREASURE && room.data->subtype != TREASURE_SUBTYPE_KNIFE_PIECE && + (!is_greed() || (uint32_t)room.gridIndex == level.greedModeTreasureRoomIdx) && room.visitedCount == 0; } // 00744940 Lays out the floor: seeds its RNGs from the stage seed, rolls its curse, loads the stage's rooms, generates @@ -170,8 +331,7 @@ void Level::Init(bool isResetLilPortalRoom) game.gameStateFlags &= ~(1ull << LEVEL_GAME_STATE_MAX_COINS_OBTAINED); myosotisPickups.clear(); - if (isMyosotis) - reconstruction_missing("Level::Init 00744940: Myosotis's pickups need EntitySaveState's fields"); + if (isMyosotis) reconstruction_missing("Level::Init 00744940: Myosotis's pickups need EntitySaveState's fields"); currentRoomMap = roomMap.data(); isLevelGenerating = true; @@ -294,8 +454,9 @@ void Level::Init(bool isResetLilPortalRoom) for (int stageId = 1; stageId <= VOID_STAGE_ID_LAST; stageId++) if (stageId != STAGE_ID_BLUE_WOMB) game.roomConfig.ResetRoomWeights(stageId, ROOM_MODE_CURRENT); } - else game.roomConfig.ResetRoomWeights(RoomConfig::GetStageID((int)stage, (int)stageType, ROOM_MODE_CURRENT), - ROOM_MODE_CURRENT); + else + game.roomConfig.ResetRoomWeights(RoomConfig::GetStageID((int)stage, (int)stageType, ROOM_MODE_CURRENT), + ROOM_MODE_CURRENT); if (HasAbandonedMineshaft()) game.roomConfig.ResetRoomWeights(STAGE_ID_MINES, ROOM_MODE_CURRENT); if (is_greed()) @@ -322,11 +483,11 @@ void Level::Init(bool isResetLilPortalRoom) lastRoomIdx = startingRoomIdx; if (IsAscent()) { - currentRoomIdx = roomList[lastBossRoomListIdx].SafeGridIndex; + currentRoomIdx = roomList[lastBossRoomListIdx].safeGridIndex; lastRoomIdx = currentRoomIdx; dungeonReturnRoomIndex = currentRoomIdx; } - log_printf(LOG_INFO, "CURRENT ROOM INDEX %d %08x\n", currentRoomIdx, GetRoomByIdx(currentRoomIdx)->ListIndex); + log_printf(LOG_INFO, "CURRENT ROOM INDEX %d %08x\n", currentRoomIdx, GetRoomByIdx(currentRoomIdx)->listIndex); bool isBackasswardsEnd = game.challenge == CHALLENGE_BACKASSWARDS && stage == LEVEL_STAGE_DARK_ROOM; @@ -353,8 +514,8 @@ void Level::Init(bool isResetLilPortalRoom) game.playerManager.trigger_level_start(); game.itemPool.unkFloat674 = game.itemPool.unkFloat678; - FUN_00943830(); - room->_Camera->DoUpdate(0); + room->camera->position_center(); + room->camera->DoUpdate(false); TextureCache::Purge(); FUN_00865260(); isLevelGenerating = false; @@ -369,20 +530,17 @@ void Level::reset_room_list(bool isResetLilPortalRoom) RoomDescriptor& desc = roomList[i]; if (!isResetLilPortalRoom && i == ROOM_DESCRIPTOR_COUNT - 1) continue; - room_descriptor_reset(desc); - desc.ListIndex = i; + desc = RoomDescriptor{}; + desc.listIndex = i; if (i >= ROOM_MAP_CELLS) { - desc.GridIndex = ROOM_MAP_CELLS - 1 - i; - desc.SafeGridIndex = desc.GridIndex; + desc.gridIndex = ROOM_MAP_CELLS - 1 - i; + desc.safeGridIndex = desc.gridIndex; } } - RoomDescriptor* lilPortal = GetRoomByIdx(ROOM_LIL_PORTAL_IDX); - auto* grid = static_cast(lilPortal->SavedGridEntities._begin); - - for (int i = 0; i < ROOM_GRID_CELLS; i++) - if (grid[i]._type == GRID_STAIRS || grid[i]._type == GRID_TRAPDOOR) grid[i]._type = 0; + for (GridEntityDesc& grid : GetRoomByIdx(ROOM_LIL_PORTAL_IDX)->savedGridEntities) + if (grid._type == GRID_STAIRS || grid._type == GRID_TRAPDOOR) grid._type = 0; } // 00745b70 Gives the Lil Portal room its layout from the special rooms the first time, seeded from the start seed. @@ -390,13 +548,13 @@ void Level::lil_portal_room_init() { RoomDescriptor& desc = *GetRoomByIdx(ROOM_LIL_PORTAL_IDX); - if (desc.Data) return; + if (desc.data) return; RNG rng{}; rng.SetSeed(g_game->seedEffects.GetStartSeed(), LIL_PORTAL_SHIFT_INDEX); - room_descriptor_seeds_init(desc, rng); - desc.Data = g_game->roomConfig.GetRoomByStageTypeAndVariant(STAGE_ID_SPECIAL_ROOMS, ROOM_TYPE_DEFAULT, + desc.InitSeeds(rng); + desc.data = g_game->roomConfig.GetRoomByStageTypeAndVariant(STAGE_ID_SPECIAL_ROOMS, ROOM_DEFAULT, LIL_PORTAL_ROOM_VARIANT, ROOM_MODE_NORMAL); } @@ -449,8 +607,7 @@ void Level::generate_dungeon(RNG& curseRng) bool isVoid = stage == LEVEL_STAGE_VOID; int stageId = RoomConfig::GetStageID((int)stage, (int)stageType, ROOM_MODE_CURRENT); - auto rooms_collect = [&]() - { + auto rooms_collect = [&]() { std::vector rooms; for (int id = isVoid ? 1 : stageId; id <= (isVoid ? VOID_STAGE_ID_LAST : stageId); id++) @@ -488,15 +645,15 @@ void Level::generate_dungeon(RNG& curseRng) settings.isVoid = isVoid; settings.isXL = isLabyrinth || game.challenge == CHALLENGE_XXXXXXXXL; - bool isStandardPath = (game.challenge == 0 && game.dailyChallenge._id == 0) || - game.GetChallengeParams().pathType == PATH_TYPE_HOME; + bool isStandardPath = + (game.challenge == 0 && game.dailyChallenge._id == 0) || game.GetChallengeParams().pathType == PATH_TYPE_HOME; LevelGenerator_Room startRoom; startRoom.position = START_POSITION; for (int retries = 0;; retries++) { - FUN_007382c0(); + game.bossPool.blacklist_clear(); if (retries > RETRIES_LOGGED) log_printf(LOG_ASSERT, "failed to generate level too often, giving up\n"); log_printf(LOG_INFO, "generate...\n"); generator.blockedPositions = {}; @@ -528,7 +685,7 @@ void Level::generate_dungeon(RNG& curseRng) break; } lil_portal_room_init(); - FUN_00421b50(); + game.bossPool.blacklist_commit(); } // 00738ab0 Configures the next room descriptor from a layout room and its config on the current dimension's map: @@ -545,28 +702,30 @@ bool Level::place_room(const LevelGenerator_Room& slot, RoomConfig_Room* data, u rng.SetSeed(seed, ROOM_SEEDS_SHIFT_INDEX); - room_descriptor_seeds_init(desc, rng); - desc.Data = data; - desc.GridIndex = slot.position.ToGridIdx(); - desc.SafeGridIndex = desc.GridIndex + (data->shape == ROOMSHAPE_LTL ? 1 : 0); - desc.OverrideData = nullptr; - desc.Dimension = currentDimensionIdx; - desc.AllowedDoors = (int32_t)slot.doors; + desc.InitSeeds(rng); + desc.data = data; + desc.gridIndex = slot.position.ToGridIdx(); + desc.safeGridIndex = desc.gridIndex + (data->shape == ROOMSHAPE_LTL ? 1 : 0); + desc.overrideData = nullptr; + desc.dimension = currentDimensionIdx; + desc.allowedDoors = slot.doors; if (g_game->playerManager.AnyoneHasTrinket(TRINKET_DEVILS_CROWN) && is_devils_crown_room(*this, desc)) - desc.Flags |= ROOM_DESCRIPTOR_DEVIL_TREASURE; + desc.flags |= ROOM_DESCRIPTOR_FLAG_DEVIL_TREASURE; - if (data->type == ROOM_TYPE_DEFAULT && - RoomConfig::GetStageID((int)stage, GetRoomStageType(desc.GridIndex), ROOM_MODE_CURRENT) == STAGE_ID_CORPSE) + if (data->type == ROOM_DEFAULT && + RoomConfig::GetStageID((int)stage, GetRoomStageType(desc.gridIndex), ROOM_MODE_CURRENT) == STAGE_ID_CORPSE) { RNG backdropRng{}; - backdropRng.SetSeed((uint32_t)desc.DecorationSeed, CORPSE_BACKDROP_SHIFT_INDEX); - auto is_pit = [](const RoomEntry& entry) - { return entry.type >= GRID_SPAWN_PIT_FIRST && entry.type < GRID_SPAWN_PIT_END; }; - bool isPit = std::ranges::any_of(data->spawns, [&](const RoomSpawn& spawn) - { return std::ranges::any_of(spawn.entries, is_pit); }); + backdropRng.SetSeed(desc.decorationSeed, CORPSE_BACKDROP_SHIFT_INDEX); + auto is_pit = [](const RoomEntry& entry) { + return entry.type >= GRID_SPAWN_PIT_FIRST && entry.type < GRID_SPAWN_PIT_END; + }; + bool isPit = std::ranges::any_of( + data->spawns, [&](const RoomSpawn& spawn) { return std::ranges::any_of(spawn.entries, is_pit); }); - if (backdropRng.Next() % CORPSE_BACKDROP_ODDS == 0 && !isPit) desc.Flags |= ROOM_DESCRIPTOR_ALTERNATE_BACKDROP; + if (backdropRng.Next() % CORPSE_BACKDROP_ODDS == 0 && !isPit) + desc.flags |= ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP; } for (XY offset : LevelGenerator::get_room_placement_offsets(data->shape)) @@ -574,7 +733,7 @@ bool Level::place_room(const LevelGenerator_Room& slot, RoomConfig_Room* data, u int cell = (slot.position + offset).ToGridIdx(); if (cell < 0) log_printf(LOG_ASSERT, "[Level] place_room: invalid room pos/size\n"); - else roomMap[desc.Dimension * LEVEL_GRID_CELLS + cell] = desc.ListIndex; + else roomMap[desc.dimension * LEVEL_GRID_CELLS + cell] = desc.listIndex; } nbRooms++; if (outDesc) *outDesc = &desc; @@ -586,13 +745,7 @@ bool Level::place_room(const LevelGenerator_Room& slot, RoomConfig_Room* data, u // shared blank descriptor. RoomDescriptor* Level::GetRoomByIdx(int idx, int dimension) { - static RoomDescriptor invalid = [] - { - RoomDescriptor blank{}; - - blank.constructor(); - return blank; - }(); + static RoomDescriptor invalid{}; if (dimension < 0) dimension = currentDimensionIdx; if ((uint32_t)dimension >= DIMENSION_COUNT) return &invalid; @@ -606,8 +759,8 @@ RoomDescriptor* Level::GetRoomByIdx(int idx, int dimension) { RoomDescriptor& desc = roomList[i]; - if (desc.Dimension == 0 && desc.Data && desc.Data->type == ROOM_TYPE_DEFAULT && - desc.Data->subtype == MIRROR_START_SUBTYPE) + if (desc.dimension == 0 && desc.data && desc.data->type == ROOM_DEFAULT && + desc.data->subtype == MIRROR_START_SUBTYPE) return &desc; } return &invalid; @@ -703,12 +856,12 @@ uint32_t Level::GetStageID() { Room& current = *g_game->room; - if (current._backdropType == BACKDROP_DOWNPOUR_ENTRANCE || current._backdropType == BACKDROP_DOWNPOUR_EXIT) + if (current.backdropType == BACKDROP_DOWNPOUR_ENTRANCE || current.backdropType == BACKDROP_DOWNPOUR_EXIT) return STAGE_ID_DOWNPOUR; - if (current._backdropType == BACKDROP_DROSS) return STAGE_ID_DROSS; + if (current.backdropType == BACKDROP_DROSS) return STAGE_ID_DROSS; int stageId = g_game->GetStageID(); - RoomConfig_Room* data = current._descriptor ? current._descriptor->Data : nullptr; + RoomConfig_Room* data = current.descriptor ? current.descriptor->data : nullptr; return stageId == STAGE_ID_VOID && data && data->stageId != 0 ? (uint32_t)data->stageId : (uint32_t)stageId; } @@ -795,22 +948,1589 @@ bool Level::HasPhotoDoor() return is_path_stage(*this, false) && is_chapter_second_floor(*this, LEVEL_STAGE_DEPTHS_I); } -// 00739370 Places the floor's special rooms on the layout's dead ends and best cells, then its normal rooms. -bool Level::place_special_rooms(LevelGenerator&, int, int) +// What placing a floor's special rooms shares between its steps: the layout, the room types the run's challenge leaves +// out, the floor's stage id and the stage counted one deeper on the alternate path, the seed the secret rooms start +// from, the shop and secret room Greed may take over, and how many normal rooms the floor's special doors take. +// The curse room step leaves its last config and end room behind. The miniboss step reuses them when every sin was met. +struct SpecialRoomPlacement { - reconstruction_missing("Level::place_special_rooms 00739370"); + Level& level; + LevelGenerator& generator; + std::set& excludedTypes; + RoomConfig_Room* config = nullptr; + LevelGenerator_Room* endRoom = nullptr; + uint32_t secretSeed = 0; + int effectiveStage = 0; + int secretIdx = -1; + int shopIdx = -1; + int specialDoorRooms = 0; + int stageId = 0; + bool isTakeoverAllowed = true; + + bool is_excluded(int type) { return excludedTypes.contains(type); } +}; + +// A normal room placed on the layout, with the layout room it took. +struct PlacedRoom +{ + RoomDescriptor* descriptor = nullptr; + LevelGenerator_Room* room = nullptr; +}; + +// A query for a room type of a stage, of any shape and difficulty 1 to 10. +static RoomQuery room_query(int stageId, int type, int subtype) +{ + return {.maxDifficulty = DIFFICULTY_HARD_MAX, + .minDifficulty = DIFFICULTY_EASY, + .stageId = stageId, + .subtype = subtype, + .type = type}; } -// 00739080 A boss room config for a boss, drawn from the seed. -RoomConfig_Room* Level::pick_boss_room_config(int, uint32_t) +// A room drawn for a query, its weight lowered unless asked not to. +static RoomConfig_Room* random_room_get(uint32_t seed, RoomQuery query, WeightReduction reduction = WEIGHT_REDUCE) { - reconstruction_missing("Level::pick_boss_room_config 00739080"); + return g_game->roomConfig.GetRandomRoom(seed, reduction, query); } -// 00738d70 The cells no secret room may take. +// A room drawn for a query, from a fallback stage when the query's has none. +static RoomConfig_Room* fallback_room_get(uint32_t seed, RoomQuery query, int fallbackStageId) +{ + return g_game->roomConfig.GetRandomRoomWithFallbackStage(seed, WEIGHT_REDUCE, query, fallbackStageId); +} + +// The farthest dead end grown into a config's shape and doors, taken off the dead end list. None for no config, where +// the original crashed. +static LevelGenerator_Room* end_room_take(LevelGenerator& generator, RoomConfig_Room* config) +{ + return config ? generator.GetNewEndRoom(config->shape, config->doors) : nullptr; +} + +// Gives a dead end a step took but did not use back to the dead end list, at its end. +static void end_room_return(LevelGenerator& generator, LevelGenerator_Room* room) +{ + if (room) generator.deadEnds.push_back(room->generationIndex); +} + +// Places a layout room with its config when there is one. +static void room_place(Level& level, LevelGenerator_Room* room, RoomConfig_Room* config, uint32_t seed) +{ + if (room && config) level.place_room(*room, config, seed, nullptr); +} + +// The trinket of the floor's crown: Wicked Crown on Sheol, Holy Crown on the Cathedral, none elsewhere. +static int crown_trinket_get(Level& level) +{ + if (level.stage != LEVEL_STAGE_SHEOL) return 0; + if (level.stageType == STAGETYPE_ORIGINAL) return TRINKET_WICKED_CROWN; + return level.stageType == STAGETYPE_WOTL ? TRINKET_HOLY_CROWN : 0; +} + +// How strong the floor's crown trinket is on its first owner, 0 without one. +static int crown_multiplier_get(Level& level) +{ + int trinket = crown_trinket_get(level); + Entity_Player* owner = trinket ? g_game->playerManager.FirstTrinketOwner(trinket) : nullptr; + + return owner ? owner->GetTrinketMultiplier(trinket) : 0; +} + +// Whether a trinket's first owner holds it at least minMultiplier strong. +static bool is_trinket_strong(int trinket, int minMultiplier) +{ + Entity_Player* owner = g_game->playerManager.FirstTrinketOwner(trinket); + + return owner && owner->GetTrinketMultiplier(trinket) >= minMultiplier; +} + +// Whether the floor keeps its shop or treasure room past the Depths: on the Womb with the Womb trinket (Silver Dollar, +// Bloody Crown), on Sheol and the Cathedral with their crown. +static bool is_deal_floor(Level& level, int wombTrinket) +{ + PlayerManager& players = g_game->playerManager; + int crown = crown_trinket_get(level); + + if (level.stage < LEVEL_STAGE_WOMB_I) return true; + if (level.stage < LEVEL_STAGE_BLUE_WOMB && players.AnyoneHasTrinket(wombTrinket)) return true; + return crown && players.AnyoneHasTrinket(crown); +} + +// A boss room config for bossId drawn from the generation RNG, logged when the stage has none. +static RoomConfig_Room* boss_config_get(Level& level, int bossId) +{ + RoomConfig_Room* config = Level::pick_boss_room_config(bossId, level.generationRNG.Next()); + + if (!config) + log_printf(LOG_INFO, "[warn] could not find matching boss room (boss id: %d) for the current stage\n", bossId); + return config; +} + +// Places a layout room as the floor's last boss room. +static void boss_room_commit(Level& level, LevelGenerator_Room& room, RoomConfig_Room* config) +{ + level.lastBossRoomListIdx = level.nbRooms; + level.place_room(room, config, level.generationRNG._seed, nullptr); +} + +// The boss room of the pool's boss on the farthest fitting dead end. The Void adds five to eight more of the bosses it +// allows (failing below five), an XL floor its second from the next stage's pool with the generation RNG put back +// after. The cells around the last one are blocked. A Mega Satan challenge's Dark Room ends in the Mega Satan room. +static bool boss_rooms_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + Game& game = *g_game; + LevelGenerator& generator = placement.generator; + + if (game.GetChallengeParams().isMegaSatan && level.stage == LEVEL_STAGE_DARK_ROOM) + { + level.lastBossRoomListIdx = level.GetRoomByIdx(ROOM_MEGA_SATAN_IDX)->listIndex; + return true; + } + + RoomConfig_Room* config = boss_config_get(level, game.bossPool.GetBossId((int)level.stage, (int)level.stageType)); + LevelGenerator_Room* bossRoom = + config ? generator.place_boss_room(config->shape, config->doors, BOSS_ROOM_NEXT) : nullptr; + + if (!bossRoom) return false; + level.firstBossRoomListIdx = level.nbRooms; + boss_room_commit(level, *bossRoom, config); + + if (level.stage == LEVEL_STAGE_VOID) + { + int extraCount = (int)level.generationRNG.RandomInt(VOID_EXTRA_BOSS_ROLL) + VOID_EXTRA_BOSSES_MIN; + std::vector bossIds(VOID_BOSS_IDS.begin(), VOID_BOSS_IDS.end()); + + RNG::Shuffle(&level.generationRNG, bossIds.data(), bossIds.data() + bossIds.size()); + for (int i = 0; i < extraCount; i++) + { + if (!(config = boss_config_get(level, bossIds[i]))) return false; + bossRoom = generator.place_boss_room(config->shape, config->doors, BOSS_ROOM_DETERMINE); + if (!bossRoom && i < VOID_EXTRA_BOSSES_MIN) return false; + if (!bossRoom) break; + boss_room_commit(level, *bossRoom, config); + } + } + + if (level.GetCurses() & CURSE_OF_LABYRINTH) + { + uint32_t savedSeed = level.generationRNG._seed; + + if (!(config = boss_config_get(level, game.bossPool.GetBossId((int)level.stage + 1, (int)level.stageType)))) + return false; + if (!(bossRoom = generator.place_boss_room(config->shape, config->doors, BOSS_ROOM_NEXT))) return false; + boss_room_commit(level, *bossRoom, config); + level.generationRNG.SetSeed(savedSeed, GENERATION_SHIFT_INDEX); + } + if (bossRoom) generator.block_room_area(*bossRoom); + return true; +} + +// The super secret room (a second with Luna) on dead ends, drawn from a copy of the generation RNG. The first is +// required. +static bool super_secret_rooms_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + + if (placement.is_excluded(ROOM_SUPERSECRET)) return true; + + RNG rng = {level.generationRNG.Next(), 2, 5, 15}; + int count = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_LUNA, LAZARUS_SHARE_CHECK) ? 2 : 1; + + for (int i = 0; i < count; i++) + { + uint32_t seed = rng.Next(); + RoomConfig_Room* config = random_room_get(seed, room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_SUPERSECRET, -1)); + LevelGenerator_Room* room = end_room_take(placement.generator, config); + + if (!room) return i > 0; + level.place_room(*room, config, seed, nullptr); + } + return true; +} + +// A shop's subtype: its level from the Store Upgrade unlocks (random below the top on hard and Greedier runs), then +// from a copy of the generation RNG maybe the rare shop or one level up for Store Key, a strong crown or Silver +// Dollar, and Tainted Keeper's own kind. crownMultiplier is how strong the floor's crown is when it was asked. +static int shop_subtype_get(Level& level, int& crownMultiplier) +{ + Game& game = *g_game; + RNG rng = {level.generationRNG.Next(), 3, 3, 26}; + uint32_t lowLevels = 1 + is_unlocked(ACHIEVEMENT_STORE_UPGRADE_1) + is_unlocked(ACHIEVEMENT_STORE_UPGRADE_3); + uint32_t highLevels = 1 + is_unlocked(ACHIEVEMENT_STORE_UPGRADE_2) + is_unlocked(ACHIEVEMENT_STORE_UPGRADE_4); + uint32_t lowLevel = rng.Next() % lowLevels; + int subtype = (int)(lowLevel + rng.Next() % highLevels); + bool isRandomLevel = + (rng.Next() & 1) && (game.difficulty == DIFFICULTY_HARD || game.difficulty == DIFFICULTY_GREEDIER); + Entity_Player* storeKeyOwner = game.playerManager.FirstTrinketOwner(TRINKET_STORE_KEY); + int storeKey = storeKeyOwner ? storeKeyOwner->GetTrinketMultiplier(TRINKET_STORE_KEY) : 0; + uint32_t roll = rng.Next(); + auto is_lucky = [&]() { + crownMultiplier = crown_multiplier_get(level); + return crownMultiplier >= 2 || ((level.stage == LEVEL_STAGE_WOMB_I || level.stage == LEVEL_STAGE_WOMB_II) && + is_trinket_strong(TRINKET_SILVER_DOLLAR, 2)); + }; + bool isLucky = false; + + if (!isRandomLevel) subtype = (int)(lowLevels + highLevels) - 2; + if ((roll & 0xff) == 1 && subtype >= 2) subtype = SHOP_SUBTYPE_RARE; + else if ((roll & 0xff) == 0 && storeKey < 2) + { + subtype = SHOP_SUBTYPE_STORE_KEY; + isLucky = is_lucky(); + } + else isLucky = storeKey >= 3 || is_lucky(); + + if (isLucky && subtype != SHOP_LEVEL_MAX && (rng.Next() & 3)) + subtype = subtype == SHOP_SUBTYPE_STORE_KEY ? 0 : std::min(subtype + 1, SHOP_LEVEL_MAX); + else if (isLucky) subtype = SHOP_SUBTYPE_RARE; + + for (Entity_Player* player : game.playerManager.playerList) + if (player->variant == PLAYER_VARIANT_PLAYER && !player->isCoopGhost && player->playerType == PLAYER_KEEPER_B) + return subtype + SHOP_SUBTYPE_TAINTED_KEEPER; + return subtype; +} + +// The shop on a dead end, required where the floor has one (is_deal_floor) unless the challenge leaves it out or after +// a third victory lap. A golden crown reveals it. +static bool shop_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + int crownMultiplier = 0; + + if (!is_deal_floor(level, TRINKET_SILVER_DOLLAR) || placement.is_excluded(ROOM_SHOP) || g_game->victoryLap >= 3) + return true; + + int subtype = shop_subtype_get(level, crownMultiplier); + RoomConfig_Room* config = + random_room_get(level.generationRNG.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_SHOP, subtype)); + LevelGenerator_Room* room = end_room_take(placement.generator, config); + RoomDescriptor* desc = nullptr; + + if (!room) return false; + placement.shopIdx = level.nbRooms; + level.place_room(*room, config, level.generationRNG._seed, &desc); + if (crownMultiplier >= 3) desc->displayFlags |= ROOM_DISPLAY_ICON; + return true; +} + +// A treasure room's subtype: 1 in 100 (or at Golden Horse Shoe's odds while someone holds it, or in the special +// daily) the more options kind, else the plain one, each the Pay to Win kind while someone holds it. +static int treasure_subtype_get(RNG& rng) +{ + PlayerManager& players = g_game->playerManager; + bool isOptions = rng.Next() % TREASURE_OPTIONS_ODDS == 0; + + if (!isOptions) + { + uint32_t period = + HORSE_SHOE_PERIOD / (uint32_t)std::max(1, players.GetTrinketMultiplier(TRINKET_GOLDEN_HORSE_SHOE)); + bool isHorseShoe = rng.Next() % std::max(period, 1u) < HORSE_SHOE_HITS || period == 0; + + isOptions = + (isHorseShoe && players.FirstTrinketOwner(TRINKET_GOLDEN_HORSE_SHOE, nullptr, LAZARUS_SHARE_CHECK)) || + g_game->dailyChallenge._specialDailyId == SPECIAL_DAILY_TREASURE_OPTIONS; + } + + bool isPayToWin = players.FirstTrinketOwner(TRINKET_PAY_TO_WIN, nullptr, LAZARUS_SHARE_CHECK); + + return isOptions ? (isPayToWin ? TREASURE_SUBTYPE_OPTIONS_PAY_TO_WIN : TREASURE_SUBTYPE_OPTIONS) + : (isPayToWin ? TREASURE_SUBTYPE_PAY_TO_WIN : 0); +} + +// The treasure room (two on XL floors, the second's draws undone) on dead ends where the floor has one, required. A +// golden crown reveals it. A floor without one gets the Repentance path's mirror world treasure room instead. +static bool treasure_rooms_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + LevelGenerator_Room* room = nullptr; + RoomConfig_Room* config = nullptr; + uint32_t firstSeed = 0; + + if (!is_deal_floor(level, TRINKET_BLOODY_CROWN) || placement.is_excluded(ROOM_TREASURE)) + { + if (g_game->GetChallengeParams().pathType != PATH_TYPE_REPENTANCE || !level.HasMirrorDimension()) return true; + config = fallback_room_get(level.generationRNG.Next(), room_query(placement.stageId, ROOM_TREASURE, 0), + STAGE_ID_SPECIAL_ROOMS); + if (!(room = end_room_take(placement.generator, config))) return false; + level.place_room(*room, config, level.generationRNG._seed, nullptr); + return true; + } + + for (int i = 0; i == 0 || (i < 2 && (level.GetCurses() & CURSE_OF_LABYRINTH)); i++) + { + int subtype = treasure_subtype_get(level.generationRNG); + RoomDescriptor* desc = nullptr; + + config = fallback_room_get(level.generationRNG.Next(), room_query(placement.stageId, ROOM_TREASURE, subtype), + STAGE_ID_SPECIAL_ROOMS); + if (!(room = end_room_take(placement.generator, config))) return false; + level.place_room(*room, config, level.generationRNG._seed, &desc); + if (crown_multiplier_get(level) >= 3) desc->displayFlags |= ROOM_DISPLAY_ICON; + if (i == 0) firstSeed = level.generationRNG._seed; + } + level.generationRNG.SetSeed(firstSeed, GENERATION_SHIFT_INDEX); + return true; +} + +// The planetarium at its chance once unlocked, unless the challenge leaves out planetariums or treasure rooms. Its +// dead end is taken (and given back) either way. +static void planetarium_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + float chance = level.GetPlanetariumChance(); + RoomConfig_Room* config = + random_room_get(level.generationRNG.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_PLANETARIUM, -1)); + LevelGenerator_Room* room = end_room_take(placement.generator, config); + bool isExcluded = placement.is_excluded(ROOM_PLANETARIUM) || placement.is_excluded(ROOM_TREASURE); + + if (!isExcluded && room && level.generationRNG.RandomFloat() < chance && is_unlocked(ACHIEVEMENT_PLANETARIUMS)) + level.place_room(*room, config, level.generationRNG._seed, nullptr); + else end_room_return(placement.generator, room); +} + +// The dice room 1 in 50 (or 1 in 5 with two keys) unless left out, else the sacrifice room, placed 1 in 7, or 1 in 4 +// at full health or as Lazarus. +static void sacrifice_room_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + PlayerManager& players = g_game->playerManager; + bool isDice = rng.Next() % DICE_ROOM_ODDS == 0 || + (rng.Next() % DICE_ROOM_KEY_ODDS == 0 && g_game->GetPlayer(0)->numKeys >= 2); + int type = isDice && !placement.is_excluded(ROOM_DICE) ? ROOM_DICE : ROOM_SACRIFICE; + RoomConfig_Room* config = random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, type, -1)); + LevelGenerator_Room* room = end_room_take(placement.generator, config); + auto is_placed = [&]() { + if (rng.Next() % SACRIFICE_ROOM_ODDS == 0) return true; + rng.Next(); + if (rng._seed & 3) return false; + return players.check_full_health(HEALTH_CHECK_ANY) || players.FirstPlayerByType(PLAYER_LAZARUS) || + players.FirstPlayerByType(PLAYER_LAZARUS2); + }; + + if (!placement.is_excluded(ROOM_SACRIFICE) && is_placed()) room_place(level, room, config, rng._seed); + else end_room_return(placement.generator, room); +} + +// The library, its level from the Store Upgrade unlocks and its config's weight kept, placed 1 in 20, or 1 in 4 once a +// book was picked up. +static void library_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + int maxLevel = is_unlocked(ACHIEVEMENT_STORE_UPGRADE_4) ? 4 + : is_unlocked(ACHIEVEMENT_STORE_UPGRADE_3) ? 3 + : is_unlocked(ACHIEVEMENT_STORE_UPGRADE_2) ? 2 + : is_unlocked(ACHIEVEMENT_STORE_UPGRADE_1); + int subtype = (int)rng.RandomInt((uint32_t)maxLevel + 1); + RoomConfig_Room* config = + random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_LIBRARY, subtype), WEIGHT_KEEP); + LevelGenerator_Room* room = end_room_take(placement.generator, config); + auto is_placed = [&]() { + if (rng.Next() % LIBRARY_ODDS == 0) return true; + rng.Next(); + return (rng._seed & 3) == 0 && game_flag_get(LEVEL_GAME_STATE_BOOK_PICKED_UP); + }; + + if (!placement.is_excluded(ROOM_LIBRARY) && is_placed()) room_place(level, room, config, rng._seed); + else end_room_return(placement.generator, room); +} + +// The curse room (two with Voodoo Head, which prefers its own kind) on every floor that has a dead end for it, drawn +// from a copy of the generation RNG. +static void curse_rooms_place(SpecialRoomPlacement& placement) +{ + RNG rng = {placement.level.generationRNG.Next(), 11, 7, 12}; + bool isVoodoo = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_VOODOO_HEAD, LAZARUS_SHARE_CHECK); + + for (int i = 0; i < (isVoodoo ? 2 : 1); i++) + { + RoomConfig_Room*& config = placement.config; + + config = isVoodoo ? random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_CURSE, 1)) : nullptr; + if (!config) config = random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_CURSE, 0)); + placement.endRoom = end_room_take(placement.generator, config); + if (placement.is_excluded(ROOM_CURSE)) end_room_return(placement.generator, placement.endRoom); + else + { + if (rng.Next() & 1) rng.Next(); + room_place(placement.level, placement.endRoom, config, rng._seed); + } + } +} + +// The sin a miniboss room fights: Ultra Pride 1 in 10 from the third floor once a run, else one of the sins not met +// this run, its super version at odds that shorten with the unlocks from the third floor. -1 when every sin was met. +static int miniboss_sin_get(SpecialRoomPlacement& placement) +{ + RNG& rng = placement.level.generationRNG; + PersistentGameData& data = g_manager->persistentGameData; + int superOdds = 0; + bool isSuper = false; + std::vector sins; + + if (placement.effectiveStage > 2) + { + superOdds = is_unlocked(ACHIEVEMENT_THE_WOMB) ? SUPER_SIN_ODDS_WOMB : SUPER_SIN_ODDS; + if (is_unlocked(ACHIEVEMENT_EVERYTHING_IS_TERRIBLE)) superOdds = SUPER_SIN_ODDS_TERRIBLE; + if (data.eventCounters[EVENT_COUNTER_SUPER_SINS_A] + data.eventCounters[EVENT_COUNTER_SUPER_SINS_B] != 0) + superOdds = SUPER_SIN_ODDS_EVENT; + if (rng.Next() % ULTRA_PRIDE_ODDS == 0 && !game_flag_get(STATE_ULTRA_PRIDE_SPAWNED)) + { + rng.Next(); + return SIN_ULTRA_PRIDE; + } + } + + isSuper = superOdds != 0 && rng.RandomInt((uint32_t)superOdds) == 0; + for (MinibossSin sin : MINIBOSS_SINS) + if (!game_flag_get(sin.flag)) sins.push_back(isSuper ? sin.superSubtype : sin.subtype); + return sins.empty() ? -1 : sins[rng.RandomInt((uint32_t)sins.size())]; +} + +// The sin miniboss room, placed 1 in 4, or 1 in 3 of the rest on the first floor. It marks its sin met and keeps Greed +// from taking over the floor. With every sin met the original goes on with the curse room's last config and end room. +static void miniboss_room_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + int difficulty = level.stage < LEVEL_STAGE_WOMB_I ? DIFFICULTY_EASY : DIFFICULTY_HARD_MAX; + int sin = miniboss_sin_get(placement); + + if (sin >= 0) + { + RoomQuery query = room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_MINIBOSS, sin); + + query.minDifficulty = query.maxDifficulty = difficulty; + if (!(placement.config = random_room_get(rng.Next(), query))) + placement.config = random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_MINIBOSS, sin)); + placement.endRoom = end_room_take(placement.generator, placement.config); + } + + bool isPlaced = !placement.is_excluded(ROOM_MINIBOSS) && + ((rng.Next() & 3) == 0 || (rng.Next() % 3 == 0 && placement.effectiveStage == 1)); + + if (!isPlaced) return end_room_return(placement.generator, placement.endRoom); + if (!placement.endRoom) return; + level.place_room(*placement.endRoom, placement.config, rng._seed, nullptr); + placement.isTakeoverAllowed = false; + for (MinibossSin entry : MINIBOSS_SINS) + if (sin == entry.subtype || sin == entry.superSubtype) game_flag_set(entry.flag, true); + if (sin == SIN_ULTRA_PRIDE) game_flag_set(STATE_ULTRA_PRIDE_SPAWNED, true); +} + +// The challenge room (the boss challenge on even floors) at full health from the second floor, on the second only 1 +// in 2. +static void challenge_room_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + RoomConfig_Room* config = + random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_CHALLENGE, level.isBossChallenge ? 1 : 0)); + LevelGenerator_Room* room = end_room_take(placement.generator, config); + bool isPlaced = !placement.is_excluded(ROOM_CHALLENGE) && (!(rng.Next() & 1) || placement.effectiveStage >= 3) && + g_game->playerManager.check_full_health(HEALTH_CHECK_ANY) && placement.effectiveStage >= 2; + + if (isPlaced) room_place(level, room, config, rng._seed); + else end_room_return(placement.generator, room); +} + +// The chest room 1 in 10 (or 1 in 3 with two keys) unless left out, else the arcade (Cain's Birthright's kind for +// Cain). The arcade needs five coins and the chest two keys, both on even floors (any floor before the Dark Room with +// Cain's Birthright). +static void arcade_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + Entity_Player& player = *g_game->GetPlayer(0); + bool isCainBirthright = g_game->playerManager.FirstBirthrightOwner(PLAYER_CAIN); + bool isChest = rng.Next() % CHEST_ROOM_ODDS == 0 || (rng.Next() % CHEST_ROOM_KEY_ODDS == 0 && player.numKeys >= 2); + RoomConfig_Room* config = nullptr; + + if (isChest && !placement.is_excluded(ROOM_CHEST) && !isCainBirthright) + config = random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_CHEST, -1)); + if (!config && isCainBirthright) + config = random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_ARCADE, 1)); + if (!config) config = random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_ARCADE, 0)); + + LevelGenerator_Room* room = end_room_take(placement.generator, config); + int stage = placement.effectiveStage; + bool isEvenFloor = stage == 2 || stage == 4 || stage == 6 || stage == 8; + bool isAffordable = config && ((config->type == ROOM_ARCADE && (player.numCoins >= 5 || isCainBirthright)) || + (config->type == ROOM_CHEST && player.numKeys >= 2)); + + if (config && !placement.is_excluded(config->type) && isAffordable && + (isEvenFloor || (isCainBirthright && stage < (int)LEVEL_STAGE_DARK_ROOM))) + room_place(level, room, config, rng._seed); + else end_room_return(placement.generator, room); +} + +// Isaac's bedroom, or the barren one 1 in 2 where a trapdoor may spawn (always when Isaac's is left out), placed 1 in +// 50, or 1 in 5 while a player is close to dying. +static void bedroom_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + bool isIsaacsExcluded = placement.is_excluded(ROOM_ISAACS); + bool isBarrenAllowed = !placement.is_excluded(ROOM_BARREN) && level.CanSpawnTrapDoor(); + bool isBarren = ((rng.Next() & 1) && isBarrenAllowed) || isIsaacsExcluded; + RoomConfig_Room* config = + random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, isBarren ? ROOM_BARREN : ROOM_ISAACS, -1)); + LevelGenerator_Room* room = end_room_take(placement.generator, config); + bool isDying = false; + + for (Entity_Player* player : g_game->playerManager.playerList) + { + if (player->variant != PLAYER_VARIANT_PLAYER) continue; + + HealthType healthType = player->GetHealthType(); + int containers = player->maxHearts; + + if (healthType != HEALTH_SOUL && healthType != HEALTH_NO_HEALTH) containers += player->boneHearts * 2; + isDying = (player->redHearts < 2 && player->soulHearts < 1) || (containers < 1 && player->soulHearts < 3); + if (isDying) break; + } + + if (rng.Next() % BEDROOM_ODDS == 0 || (rng.Next() % BEDROOM_DYING_ODDS == 0 && isDying)) + room_place(level, room, config, rng._seed); + else end_room_return(placement.generator, room); +} + +// The rooms behind the alternate path's special doors: the mirror on Downpour II and Dross II, and the mineshaft +// entrance on Mines II and Ashpit II with the first knife piece, required. It counts the normal rooms the floor's +// special door puzzle needs (the strange door's once unlocked). +static bool special_door_rooms_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + RoomConfig_Room* config = nullptr; + LevelGenerator_Room* room = nullptr; + + if (level.HasMirrorDimension()) + { + RoomQuery query = room_query(placement.stageId, ROOM_DEFAULT, MIRROR_ROOM_SUBTYPE); + + query.minDifficulty = query.maxDifficulty = 0; + config = random_room_get(rng.Next(), query); + if (!(room = end_room_take(placement.generator, config))) return false; + level.place_room(*room, config, rng._seed, nullptr); + placement.specialDoorRooms = 1; + } + else if (level.HasAbandonedMineshaft()) + { + if (!g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_KNIFE_PIECE_1, LAZARUS_SHARE_CHECK)) return true; + + RNG entranceRng = {rng._seed, 5, 7, 22}; + uint32_t seed = entranceRng.Next(); + RoomQuery query = room_query(placement.stageId, ROOM_DEFAULT, MINESHAFT_ENTRANCE_SUBTYPE); + + query.minDifficulty = query.maxDifficulty = 0; + config = fallback_room_get(seed, query, STAGE_ID_MINES); + if (!(room = end_room_take(placement.generator, config))) return false; + level.place_room(*room, config, seed, nullptr); + placement.specialDoorRooms = 2; + } + else if (level.HasPhotoDoor() && is_unlocked(ACHIEVEMENT_STRANGE_DOOR)) placement.specialDoorRooms = 1; + return true; +} + +// The secret room (a second with Fragmented Card, one more with Luna) on the best scoring cells, from the seed drawn +// after the super secret rooms. A golden Fragmented Card reveals the first, a stronger one the first two. +static void secret_rooms_place(SpecialRoomPlacement& placement) +{ + if (placement.is_excluded(ROOM_SECRET)) return; + + Level& level = placement.level; + PlayerManager& players = g_game->playerManager; + Entity_Player* cardOwner = players.FirstTrinketOwner(TRINKET_FRAGMENTED_CARD); + int cardMultiplier = cardOwner ? cardOwner->GetTrinketMultiplier(TRINKET_FRAGMENTED_CARD) : 0; + int count = (cardOwner ? 2 : 1) + (players.FirstCollectibleOwner(COLLECTIBLE_LUNA, LAZARUS_SHARE_CHECK) ? 1 : 0); + RNG rng = {placement.secretSeed, 1, 5, 16}; + + for (int i = 0; i < count; i++, rng.Next()) + { + RoomConfig_Room* config = + fallback_room_get(rng._seed, room_query(placement.stageId, ROOM_SECRET, -1), STAGE_ID_SPECIAL_ROOMS); + LevelGenerator_Room* room = placement.generator.place_secret_room(level.get_secret_room_excluded_cells()); + RoomDescriptor* desc = nullptr; + bool isRevealed = cardMultiplier == 2 ? i == 0 : cardMultiplier > 2 && i < 2; + + if (!room || !config) continue; + placement.secretIdx = level.nbRooms; + level.place_room(*room, config, rng._seed, &desc); + if (isRevealed) desc->displayFlags |= ROOM_DISPLAY_ICON; + } +} + +// The Dark Room's extra special room (any of variants 3 to 9 once unlocked, else variant 3), required. +static bool dark_room_extra_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + + if (level.stage != LEVEL_STAGE_DARK_ROOM || level.stageType != STAGETYPE_ORIGINAL) return true; + + uint32_t seed = level.generationRNG.Next(); + RoomQuery query = room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_DEFAULT, -1); + RoomConfig_Room* config = nullptr; + LevelGenerator_Room* room = nullptr; + + query.minVariant = DARK_ROOM_EXTRA_VARIANT_FIRST; + query.maxVariant = DARK_ROOM_EXTRA_VARIANT_LAST; + config = is_unlocked(ACHIEVEMENT_THE_FORGOTTEN) + ? random_room_get(seed, query) + : g_game->roomConfig.GetRoomByStageTypeAndVariant(STAGE_ID_SPECIAL_ROOMS, ROOM_DEFAULT, + DARK_ROOM_EXTRA_VARIANT_FIRST, ROOM_MODE_CURRENT); + if (!(room = end_room_take(placement.generator, config))) return false; + level.place_room(*room, config, seed, nullptr); + return true; +} + +// The cells the door slots of the placed rooms lead into (an L shape's inner slots into its missing corner), for the +// slots isWanted picks. Cells off the grid are left out. +template static std::set door_targets_collect(Level& level, Wanted isWanted) +{ + std::set cells; + + for (int i = 0; i < level.nbRooms; i++) + { + RoomDescriptor& room = level.roomList[i]; + + if (!room.data || room.gridIndex < 0) continue; + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + XY target = LevelGenerator::get_door_target_position(XY::NewFromGridIdx(room.gridIndex), room.data->shape, + slot, THIN_SHAPES_IGNORED); + + if (target.ToGridIdx() >= 0 && isWanted(*room.data, slot)) cells.insert(target.ToGridIdx()); + } + } + return cells; +} + +// The ultra secret room, beside the rooms only through their closed sides or their boss, secret, super secret and +// curse rooms' doors. It joins no group's random teleports. +static void ultra_secret_room_place(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG rng = {placement.secretSeed, 13, 3, 17}; + uint32_t seed = rng.Next(); + RoomConfig_Room* config = nullptr; + + if (placement.is_excluded(ROOM_ULTRASECRET)) return; + config = fallback_room_get(seed, room_query(placement.stageId, ROOM_ULTRASECRET, -1), STAGE_ID_SPECIAL_ROOMS); + if (!config) return; + + std::set doorCells = door_targets_collect(level, [](RoomConfig_Room& data, int slot) { + return !(data.doors >> slot & 1) || data.type == ROOM_BOSS || data.type == ROOM_SUPERSECRET || + data.type == ROOM_SECRET || data.type == ROOM_CURSE; + }); + + if (LevelGenerator_Room* room = placement.generator.try_place_room(&doorCells)) + { + level.place_room(*room, config, seed, nullptr); + level.roomList[level.nbRooms - 1].group = ULTRA_SECRET_GROUP; + } +} + +// The normal rooms on every layout room left: the start room the stage's own (the Dark Room and Chest's, else the +// special set's variant 2), the others drawn in their shape and doors, 1 in 8 as easy as the easiest. Each one placed +// is listed with its layout room. Fails on a layout room no config fits. +static bool normal_rooms_place(SpecialRoomPlacement& placement, int minDifficulty, int maxDifficulty, + std::vector& placed) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + std::vector rooms = placement.generator.get_all_rooms(); + bool isDarkRoomFloor = level.stage == LEVEL_STAGE_DARK_ROOM; + + placed.reserve(rooms.size()); + for (LevelGenerator_Room* room : rooms) + { + RoomQuery query = room_query(placement.stageId, ROOM_DEFAULT, 0); + RoomConfig_Room* config = nullptr; + + query.minDifficulty = minDifficulty > 1 && (rng._seed & 7) == 0 ? DIFFICULTY_EASY : minDifficulty; + query.maxDifficulty = maxDifficulty; + if (room->position.ToGridIdx() == level.startingRoomIdx && room->distanceFromStart == 0) + { + bool isChapter6Start = isDarkRoomFloor && level.stageType <= STAGETYPE_WOTL; + int stageId = !isChapter6Start ? STAGE_ID_SPECIAL_ROOMS + : level.stageType == STAGETYPE_ORIGINAL ? STAGE_ID_DARK_ROOM + : STAGE_ID_CHEST; + + config = g_game->roomConfig.GetRoomByStageTypeAndVariant( + stageId, ROOM_DEFAULT, isChapter6Start ? 0 : START_ROOM_VARIANT, ROOM_MODE_CURRENT); + } + else + { + query.requiredDoors = room->doors; + query.shape = room->shape; + query.minVariant = isDarkRoomFloor ? 1 : 0; + config = random_room_get(rng.Next(), query); + } + + if (!config) + { + log_printf(LOG_INFO, + "[warn] LevelGenerator could not find a required room (type=ROOM_DEFAULT, shape=%d, " + "difficulty=%d-%d, doors=%s.\n", + room->shape, query.minDifficulty, query.maxDifficulty, + std::bitset(room->doors).to_string().c_str()); + return false; + } + level.place_room(*room, config, rng._seed, nullptr); + placed.push_back({&level.roomList[level.nbRooms - 1], room}); + } + return true; +} + +// The normal rooms of the floor's special door puzzle: placed rooms in a shuffled order (not the start room), then new +// dead ends away from every door, each turned into a puzzle room (subtype 1) of its shape and doors from the floor's +// stage or its chapter's original. A copy of the generation RNG draws them. Fails when the dead ends run out. +static bool special_door_puzzle_place(SpecialRoomPlacement& placement, std::vector& placed, + int minDifficulty, int maxDifficulty) +{ + Level& level = placement.level; + RNG rng = {level.generationRNG._seed, 5, 21, 12}; + int fallbackStageId = placement.stageId == STAGE_ID_DROSS ? STAGE_ID_DOWNPOUR + : placement.stageId == STAGE_ID_ASHPIT ? STAGE_ID_MINES + : placement.stageId == STAGE_ID_NECROPOLIS || placement.stageId == STAGE_ID_DANK_DEPTHS + ? STAGE_ID_DEPTHS + : placement.stageId; + int needed = placement.specialDoorRooms; + int tries = (int)placed.size() + needed; + + for (size_t i = placed.size() - 1; i > 0 && i < placed.size(); i--) + std::swap(placed[i], placed[rng.RandomInt((uint32_t)i + 1)]); + + std::set doorCells = level.get_door_neighbor_indices(); + + for (int i = 0; i < tries && needed > 0; i++) + { + PlacedRoom entry = i < (int)placed.size() ? placed[i] : PlacedRoom{}; + + if (entry.descriptor && entry.descriptor->gridIndex == level.startingRoomIdx) continue; + if (!entry.descriptor && !(entry.room = placement.generator.try_add_dead_end(&doorCells))) return false; + + RoomQuery query = room_query(placement.stageId, ROOM_DEFAULT, SPECIAL_DOOR_PUZZLE_SUBTYPE); + + query.minDifficulty = minDifficulty > 1 && (rng._seed & 7) == 0 ? DIFFICULTY_EASY : minDifficulty; + query.maxDifficulty = maxDifficulty; + query.requiredDoors = entry.room->doors; + query.shape = entry.room->shape; + + RoomConfig_Room* config = fallback_room_get(rng.Next(), query, fallbackStageId); + + query.minDifficulty = DIFFICULTY_EASY; + query.maxDifficulty = DIFFICULTY_HARD_MAX; + if (!config && !(config = fallback_room_get(rng.Next(), query, fallbackStageId))) continue; + needed--; + if (!entry.descriptor) level.place_room(*entry.room, config, rng.Next(), nullptr); + else + { + entry.descriptor->data = config; + entry.descriptor->allowedDoors = config->doors; + } + } + return needed <= 0; +} + +// Greed's takeover: with the Greed minibosses not both met and no miniboss room on the floor, the secret room (past the +// Caves) and then the shop (past the Basement) are taken over at a third of 1 (1.05 with 20 coins, more after a +// donation machine blew up or a shopkeeper died, less per Greed donation). The secret room's leaves the shop alone +// 999 in 1000 times. +static void greed_takeover_roll(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + Game& game = *g_game; + bool isAllowed = placement.isTakeoverAllowed && + !(game_flag_get(STATE_GREED_SPAWNED) && game_flag_get(STATE_SUPER_GREED_SPAWNED)); + float chance = game.GetPlayer(0)->numCoins >= TAKEOVER_COINS ? TAKEOVER_CHANCE_RICH : 1; + + for (auto [flag, bonus] : TAKEOVER_BONUSES) + if (game_flag_get(flag)) + { + game_flag_set(flag, false); + chance += bonus; + } + chance = (chance - (float)std::min(game.donationModGreed, TAKEOVER_DONATIONS_MAX) * TAKEOVER_DONATION_PENALTY) * + TAKEOVER_SHARE; + game.donationModGreed = 0; + + if (level.generationRNG.RandomFloat() < chance && isAllowed && placement.secretIdx >= 0 && + level.stage > LEVEL_STAGE_CAVES_II) + { + RNG takeoverRng = {level.generationRNG._seed, 2, 7, 9}; + + if (takeoverRng.RandomInt(TAKEOVER_BOTH_ODDS) != 0) isAllowed = false; + level.roomList[placement.secretIdx].flags |= ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS; + } + if (level.generationRNG.RandomFloat() < chance && isAllowed && placement.shopIdx >= 0 && + level.stage > LEVEL_STAGE_CAVES_I) + level.roomList[placement.shopIdx].flags |= ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS; +} + +// Seeds a room off the map from rng and draws its config. +static void off_map_room_init(Level& level, int idx, RNG& rng, RoomQuery query) +{ + RoomDescriptor& desc = *level.GetRoomByIdx(idx); + + desc.InitSeeds(rng); + desc.data = random_room_get(rng.Next(), query); +} + +// The rooms off the map: the error room, black market, crawl space, Boss Rush (Mom's shovel's own with the Broken +// Shovel), Mega Satan's, the Blue Womb's entrance (the Void's on the Blue Womb), the Member Card's shop and the angel +// shop, and on the alternate path's last Womb floor the secret exit's boss room. +static void off_map_rooms_init(SpecialRoomPlacement& placement) +{ + Level& level = placement.level; + RNG& rng = level.generationRNG; + RoomConfig& roomConfig = g_game->roomConfig; + RoomQuery query = room_query(STAGE_ID_BLUE_WOMB, ROOM_DEFAULT, 1); + + off_map_room_init(level, ROOM_ERROR_IDX, rng, room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_ERROR, -1)); + off_map_room_init(level, ROOM_BLACK_MARKET_IDX, rng, room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_BLACK_MARKET, -1)); + off_map_room_init(level, ROOM_DUNGEON_IDX, rng, room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_DUNGEON, -1)); + if (g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_BROKEN_SHOVEL_1, LAZARUS_SHARE_CHECK)) + { + RoomDescriptor& bossRush = *level.GetRoomByIdx(ROOM_BOSSRUSH_IDX); + + bossRush.InitSeeds(rng); + rng.Next(); + bossRush.data = + roomConfig.GetRoomByStageTypeAndVariant(STAGE_ID_SPECIAL_ROOMS, ROOM_BOSSRUSH, 0, ROOM_MODE_CURRENT); + } + else off_map_room_init(level, ROOM_BOSSRUSH_IDX, rng, room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_BOSSRUSH, -1)); + off_map_room_init(level, ROOM_MEGA_SATAN_IDX, rng, room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_BOSS, BOSS_MEGA_SATAN)); + query.minDifficulty = query.maxDifficulty = 0; + off_map_room_init(level, placement.stageId == STAGE_ID_BLUE_WOMB ? ROOM_THE_VOID_IDX : ROOM_BLUE_WOMB_IDX, rng, + query); + + RNG shopRng = {rng.Next(), 3, 3, 26}; + uint32_t highLevel = shopRng.RandomInt(1 + is_unlocked(ACHIEVEMENT_STORE_UPGRADE_3)); + uint32_t lowLevel = + shopRng.RandomInt(1 + is_unlocked(ACHIEVEMENT_STORE_UPGRADE_2) + is_unlocked(ACHIEVEMENT_STORE_UPGRADE_4)); + + off_map_room_init(level, ROOM_SECRET_SHOP_IDX, shopRng, + room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_SHOP, (int)(highLevel + lowLevel))); + + RNG angelRng = {rng.Next(), 3, 3, 28}; + + off_map_room_init(level, ROOM_ANGEL_SHOP_IDX, angelRng, room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_ANGEL, 1)); + if (level.IsAltPath() && (level.stage == LEVEL_STAGE_WOMB_II || + (level.stage == LEVEL_STAGE_WOMB_I && (level.GetCurses() & CURSE_OF_LABYRINTH)))) + { + rng.Next(); + off_map_room_init(level, ROOM_SECRET_EXIT_IDX, rng, room_query(placement.stageId, ROOM_BOSS, BOSS_MOTHER)); + } +} + +// 00739370 Places the floor's rooms on its layout: the boss room, super secret, shop, treasure and planetarium rooms, +// below the Dark Room the sacrifice or dice room, library, curse, miniboss, challenge and arcade or chest rooms, below +// the Womb the bedroom, the alternate path's special door rooms, the secret, Dark Room and ultra secret rooms, then the +// normal rooms and the special door puzzle's, Greed's takeover and the rooms off the map. A room that loses its roll +// gives its dead end back. False when a required room has no dead end, for the layout to be generated again. +bool Level::place_special_rooms(LevelGenerator& generator, int minDifficulty, int maxDifficulty) +{ + SpecialRoomPlacement placement = { + .level = *this, .generator = generator, .excludedTypes = g_game->GetChallengeParams().roomset}; + std::vector placed; + + placement.stageId = RoomConfig::GetStageID((int)stage, (int)stageType, ROOM_MODE_CURRENT); + placement.effectiveStage = (int)stage + (IsAltPath() ? 1 : 0); + if (!boss_rooms_place(placement) || !super_secret_rooms_place(placement)) return false; + placement.secretSeed = generationRNG.Next(); + if (!shop_place(placement) || !treasure_rooms_place(placement)) return false; + planetarium_place(placement); + if (stage < LEVEL_STAGE_DARK_ROOM) + { + sacrifice_room_place(placement); + library_place(placement); + curse_rooms_place(placement); + miniboss_room_place(placement); + challenge_room_place(placement); + arcade_place(placement); + } + if (stage < LEVEL_STAGE_WOMB_I) bedroom_place(placement); + if (!special_door_rooms_place(placement)) return false; + secret_rooms_place(placement); + if (!dark_room_extra_place(placement)) return false; + ultra_secret_room_place(placement); + if (!normal_rooms_place(placement, minDifficulty, maxDifficulty, placed)) return false; + for (size_t i = placed.size(); i < generator.rooms.size(); i++) generationRNG.Next(); + if (placement.specialDoorRooms && !special_door_puzzle_place(placement, placed, minDifficulty, maxDifficulty)) + return false; + greed_takeover_roll(placement); + off_map_rooms_init(placement); + return true; +} + +// 00739080 A boss room config for bossId, drawn from seed: a negative id is the Double Trouble rooms from its variant, +// redrawn up to 50 times while one is a pairing not unlocked yet. Mother's heart room after her kill is the stage's +// own. Any other boss's rooms are redrawn up to 50 times while they are the 3700 to 3849 variants. +RoomConfig_Room* Level::pick_boss_room_config(int bossId, uint32_t seed) +{ + RNG rng = {seed, 5, 15, 17}; + RoomConfig_Room* room = nullptr; + int retries = BOSS_ROOM_RETRIES; + + if (bossId < 0) + { + RoomQuery query = room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_BOSS, -1); + + query.minVariant = (uint32_t)-bossId; + query.maxVariant = query.minVariant + BOSS_ROOM_VARIANTS - 1; + while (!room || std::ranges::any_of(DOUBLE_TROUBLE_LOCKS, [&](const DoubleTroubleLock& lock) { + return lock.is_locked(room->subtype); + })) + { + room = random_room_get(rng.Next(), query); + if (retries-- < 1 || !room) return room; + } + return room; + } + if (bossId == BOSS_MOTHER_HEART && game_flag_get(LEVEL_GAME_STATE_MAUSOLEUM_HEART_KILLED)) + return fallback_room_get(rng.Next(), room_query(g_game->GetStageID(), ROOM_BOSS, BOSS_MOTHER_HEART), + STAGE_ID_MAUSOLEUM); + do room = random_room_get(rng.Next(), room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_BOSS, bossId)); + while (retries > 0 && room && room->type == ROOM_BOSS && + (retries--, room->variant >= BOSS_ROOM_REROLL_FIRST && room->variant < BOSS_ROOM_REROLL_END)); + return room; +} + +// Whether a door slot leads somewhere a secret room may not border for the secret room exclusions: only the near +// halves of a one cell 1x1, 1x2 or 2x1 side. +static bool is_secret_exclusion_slot(RoomShape shape, int slot) +{ + switch (shape) + { + case ROOMSHAPE_1x1: + return slot < DOOR_LEFT1; + case ROOMSHAPE_1x2: + return slot != DOOR_UP1 && slot != DOOR_DOWN1; + case ROOMSHAPE_2x1: + return slot != DOOR_LEFT1 && slot != DOOR_RIGHT1; + default: + return true; + } +} + +// The cells beside a placed room by its size alone, by door slot, -1 off the grid. +static std::array door_cells_get(RoomDescriptor& room) +{ + XY position = XY::NewFromGridIdx(room.gridIndex); + XY size = {room.data->width / ROOM_SCREEN_WIDTH, room.data->height / ROOM_SCREEN_HEIGHT}; + std::array offsets = { + {{-1, 0}, {0, -1}, {size.x, 0}, {0, size.y}, {-1, 1}, {1, -1}, {size.x, 1}, {1, size.y}}}; + std::array cells{}; + + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) cells[slot] = (position + offsets[slot]).ToGridIdx(); + return cells; +} + +// 00738d70 The cells no secret room may take: beside a boss, secret or super secret room, beside a side of a placed +// room without a door there, and on the Dark Room and Chest's chapter the cells around the start room. std::set Level::get_secret_room_excluded_cells() { - reconstruction_missing("Level::get_secret_room_excluded_cells 00738d70"); + std::set cells; + + if (stage == LEVEL_STAGE_DARK_ROOM) + for (int offset : {1, -1, LEVEL_GRID_WIDTH, -LEVEL_GRID_WIDTH}) + if (startingRoomIdx + offset >= 0 && startingRoomIdx + offset < LEVEL_GRID_CELLS) + cells.insert(startingRoomIdx + offset); + for (int i = 0; i < nbRooms; i++) + { + RoomDescriptor& room = roomList[i]; + + if (!room.data || room.gridIndex < 0) continue; + + RoomConfig_Room& data = *room.data; + std::array doorCells = door_cells_get(room); + bool isGuarded = data.type == ROOM_BOSS || data.type == ROOM_SUPERSECRET || data.type == ROOM_SECRET; + + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + if (is_secret_exclusion_slot(data.shape, slot) && (!(data.doors >> slot & 1) || isGuarded) && + doorCells[slot] >= 0) + cells.insert(doorCells[slot]); + } + return cells; +} + +// 00752460 The cells every door slot of the placed rooms leads to, but for the open doors of plain normal rooms. +std::set Level::get_door_neighbor_indices() +{ + return door_targets_collect(*this, [](RoomConfig_Room& data, int slot) { + return !(data.doors >> slot & 1) || data.type != ROOM_DEFAULT || data.subtype != 0; + }); +} + +// 0073dae0 Points a room's door slots at the cells beside it (an L shape's inner slots at its missing corner), drops +// the slots its shape lacks unless its config has the door, then opens each door on both sides where the room behind +// has a door back and closes it on both sides otherwise. A room off the map takes its config's doors. +void Level::update_room_doors(RoomDescriptor& room) +{ + if (room.gridIndex < 0) + { + if (room.data) room.allowedDoors = room.data->doors; + return; + } + + RoomConfig_Room& data = *room.data; + std::array cells = door_cells_get(room); + int* map = room.dimension < 0 ? currentRoomMap : &roomMap[room.dimension * LEVEL_GRID_CELLS]; + bool isLShape = data.shape >= ROOMSHAPE_LTL && data.shape <= ROOMSHAPE_LBR; + + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + if (isLShape) + cells[slot] = LevelGenerator::get_door_target_position(XY::NewFromGridIdx(room.gridIndex), data.shape, slot, + THIN_SHAPES_IGNORED) + .ToGridIdx(); + if (!LevelGenerator::has_shape_slot(data.shape, slot, THIN_SHAPES_RESTRICTED) && !(data.doors >> slot & 1)) + cells[slot] = -1; + } + + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + int cell = room.doors[slot] = cells[slot]; + RoomDescriptor* neighbor = cell >= 0 && map[cell] >= 0 ? &roomList[map[cell]] : nullptr; + int backSlot = (slot + 2) % DIRECTION_COUNT; + + if (cell < 0) continue; + if (neighbor) + { + int offset = cell - GetRoomByIdx(cell, room.dimension)->gridIndex; + + if (backSlot % 2 ? offset % LEVEL_GRID_WIDTH > 0 : offset / LEVEL_GRID_WIDTH > 0) + backSlot += DIRECTION_COUNT; + if ((data.doors >> slot & 1) && (neighbor->data->doors >> backSlot & 1)) + { + room.allowedDoors |= 1u << slot; + neighbor->allowedDoors |= 1u << backSlot; + continue; + } + } + room.allowedDoors &= ~(1u << slot); + if (neighbor) neighbor->allowedDoors &= ~(1u << backSlot); + } +} + +// 0074b5d0 Whether a trapdoor may lead on from the floor: not in the mirror world, not out of Mother's heart room +// before the Ascent, not on the Ascent, on the Repentance path only from its first floors (or the secret exit's room, +// or Red Redemption), and only where a next stage exists (Womb II only when the run goes past it). +bool Level::CanSpawnTrapDoor() +{ + Game& game = *g_game; + int effectiveStage = (int)stage + ((GetCurses() & CURSE_OF_LABYRINTH) ? 1 : 0); + bool isRepentanceStart = IsAltPath() && (effectiveStage == 1 || effectiveStage == 3 || effectiveStage == 5 || + effectiveStage == LEVEL_STAGE_WOMB_I); + + if (HasMirrorDimension() && currentDimensionIdx == 1) return false; + if (!isLevelGenerating && room && room->roomType == ROOM_BOSS && + room->descriptor->data->subtype == BOSS_MOTHER_HEART && IsPreAscent()) + return false; + if (stage >= 1 && stage <= ASCENT_LAST_STAGE && game_flag_get(LEVEL_GAME_STATE_BACKWARDS_PATH)) return false; + if (game.GetChallengeParams().pathType == PATH_TYPE_REPENTANCE && !isRepentanceStart && + currentRoomIdx != ROOM_SECRET_EXIT_IDX && game.challenge != CHALLENGE_RED_REDEMPTION) + return false; + if (is_greed()) return IsNextStageAvailable(); + if (!IsNextStageAvailable()) return false; + return game.stage < LEVEL_STAGE_WOMB_II || + (game.stage == LEVEL_STAGE_WOMB_II && IsStageWithinEnd(LEVEL_STAGE_SHEOL, false)); +} + +// 0074b710 Whether the run goes on past the floor: not from Home's stage, the pre-Ascent floor, the Dark Room, the Void +// or Home, Greed's Womb, the Repentance path's Corpse II, Home's challenge path before the Ascent, or a challenge's +// last stage. An XL floor counts as the one after it. +bool Level::IsNextStageAvailable() +{ + Game& game = *g_game; + int nextStage = (int)stage; + bool isRedRedemption = game.challenge == CHALLENGE_RED_REDEMPTION; + int type = isRedRedemption ? GetRoomStageType(currentRoomIdx) : (int)stageType; + ChallengeParam& params = game.GetChallengeParams(); + + if ((isRedRedemption || currentDimensionIdx != DEATH_CERTIFICATE_DIMENSION) && + RoomConfig::GetStageID(nextStage, type, ROOM_MODE_CURRENT) == STAGE_ID_BACKWARDS) + return false; + if (IsPreAscent() || nextStage >= (int)LEVEL_STAGE_DARK_ROOM || + (is_greed() && nextStage == (int)LEVEL_STAGE_WOMB_I)) + return false; + if ((curses & CURSE_OF_LABYRINTH) && nextStage % 2 == 1 && nextStage <= (int)LEVEL_STAGE_WOMB_I) nextStage++; + if (nextStage == LEVEL_STAGE_WOMB_II && IsAltPath()) return false; + if ((nextStage == LEVEL_STAGE_DEPTHS_II || + (nextStage == LEVEL_STAGE_DEPTHS_I && filter_curses(CURSE_OF_LABYRINTH))) && + params.pathType == PATH_TYPE_HOME && !game_flag_get(LEVEL_GAME_STATE_BACKWARDS_PATH)) + return false; + return (game.challenge == 0 && game.dailyChallenge._id == 0) || nextStage < params.endStage; +} + +// 0074b830 Whether a stage is within the run's end: Greed's Womb, else the challenge's end stage (the Void once +// unlocked outside challenges, else the Dark Room and Chest's chapter). The Sheol or Cathedral chapter with a +// shovel only on the path the challenge sets. A Home path challenge never is. +bool Level::IsStageWithinEnd(int levelStage, bool isAltPath) +{ + Game& game = *g_game; + ChallengeParam& params = game.GetChallengeParams(); + bool isChallenge = game.challenge != 0 || game.dailyChallenge._id != 0; + int endStage = params.endStage == LEVEL_STAGE_VOID || (!isChallenge && is_unlocked(ACHIEVEMENT_THE_VOID)) + ? LEVEL_STAGE_VOID + : LEVEL_STAGE_DARK_ROOM; + bool isChapter5 = levelStage == LEVEL_STAGE_SHEOL || levelStage == LEVEL_STAGE_DARK_ROOM; + auto is_shovel = [&]() { + return game.playerManager.FirstCollectibleOwner(COLLECTIBLE_BROKEN_SHOVEL_1, LAZARUS_SHARE_CHECK) || + game.playerManager.FirstCollectibleOwner(COLLECTIBLE_MOMS_SHOVEL, LAZARUS_SHARE_CHECK); + }; + + if (is_greed()) return levelStage <= (int)LEVEL_STAGE_WOMB_I; + if (isChapter5 && isAltPath && is_shovel() && (!params.isPathTypeSet || params.pathType != PATH_TYPE_CATHEDRAL)) + return false; + if (!params.isPathTypeSet) return levelStage <= endStage; + if (isChapter5 && isAltPath != (params.pathType == PATH_TYPE_CATHEDRAL)) return false; + if (params.endStage != 0) endStage = params.endStage; + return params.pathType != PATH_TYPE_HOME && levelStage <= endStage; +} + +// 0074dbd0 The chance the floor has a planetarium: none past Sheol, past the Depths without Telescope Lens or past the +// Womb without a golden one or Mom's Box. Before the first planetarium it grows by a fifth per treasure room skipped +// (sure with Crystal Ball), with Magic 8 Ball, Crystal Ball, Sausage and the Lens adding to it. After, only the Lens +// does. Kept between 0.01 and 1. Lua's Game:GetPlanetariumChance. +float Level::GetPlanetariumChance() +{ + Game& game = *g_game; + PlayerManager& players = game.playerManager; + int effectiveStage = (int)stage + (IsAltPath() ? 1 : 0); + Entity_Player* lensOwner = players.FirstTrinketOwner(TRINKET_TELESCOPE_LENS); + bool isLens = lensOwner && lensOwner->HasTrinket(TRINKET_TELESCOPE_LENS); + bool isGoldenLens = lensOwner && lensOwner->HasGoldenTrinket(TRINKET_TELESCOPE_LENS); + bool isMomsBox = lensOwner && lensOwner->HasCollectible(COLLECTIBLE_MOMS_BOX); + auto is_owned = [&](int collectible) { + return players.FirstCollectibleOwner(collectible, LAZARUS_SHARE_CHECK); + }; + float chance = PLANETARIUM_CHANCE_MIN; + + if (stage > LEVEL_STAGE_SHEOL || (stage > LEVEL_STAGE_DEPTHS_II && !isLens) || + (stage > LEVEL_STAGE_WOMB_II && !isGoldenLens && !isMomsBox)) + return 0; + if (game.planetariumsVisited == 0) + { + if (!game.GetChallengeParams().roomset.contains(ROOM_TREASURE) && + game.treasureRoomsVisited < effectiveStage - 1) + { + chance = (float)(effectiveStage - game.treasureRoomsVisited - 1) * PLANETARIUM_SKIPPED_BONUS + + PLANETARIUM_CHANCE_MIN; + if (is_owned(COLLECTIBLE_CRYSTAL_BALL)) chance += 1; + } + if (is_owned(COLLECTIBLE_MAGIC_8_BALL)) chance += PLANETARIUM_ITEM_BONUS; + if (is_owned(COLLECTIBLE_CRYSTAL_BALL)) chance += PLANETARIUM_ITEM_BONUS; + if (is_owned(COLLECTIBLE_SAUSAGE)) chance += PLANETARIUM_SAUSAGE_BONUS; + if (isLens) chance += PLANETARIUM_ITEM_BONUS; + } + if (isLens) + chance += isGoldenLens == isMomsBox ? (isGoldenLens ? PLANETARIUM_LENS_BOTH : PLANETARIUM_LENS) + : PLANETARIUM_LENS_ONE; + return std::clamp(chance, PLANETARIUM_CHANCE_MIN, 1.0f); +} + +// A grid entity's description (type, variant, state), which classes.h still holds as bytes. +static GridEntityDesc& grid_desc_get(GridEntity& entity) +{ + return *reinterpret_cast(entity._desc); +} + +// Devil's Crown's turn of an unvisited treasure room into a devil treasure room: 1 in 4 golden, 1 in 3 stronger, from +// up to ten draws of a devil room with the treasure room's doors. +static void devils_crown_room_roll(Level& level, RoomDescriptor& desc) +{ + Entity_Player* owner = g_game->playerManager.FirstTrinketOwner(TRINKET_DEVILS_CROWN); + int multiplier = owner ? owner->GetTrinketMultiplier(TRINKET_DEVILS_CROWN) : 0; + RoomQuery query = room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_DEVIL, 1); + + if (multiplier < 2 || owner->GetTrinketRNG(TRINKET_DEVILS_CROWN).RandomInt(multiplier == 2 ? 4 : 3) != 0) return; + query.maxVariant = DEVILS_CROWN_VARIANT_LAST; + query.requiredDoors = desc.allowedDoors; + for (int tries = DEVILS_CROWN_TRIES; tries > 0; tries--) + if (RoomConfig_Room* config = random_room_get(level.devilAngelRoomRNG.Next(), query)) + { + desc.flags |= ROOM_DESCRIPTOR_FLAG_DEVIL_TREASURE; + desc.data = config; + return; + } +} + +// Whether an unvisited treasure room is redrawn as its more options kind: always with More Options or a strong crown +// (Wicked or Holy on their floor, Bloody on the Womb), 1 in 2 per Broken Glasses off the alternate path, or when a +// transition asks for it. +static bool is_treasure_reroll(Level& level, RoomDescriptor& desc) +{ + Game& game = *g_game; + PlayerManager& players = game.playerManager; + bool isWomb = level.stage == LEVEL_STAGE_WOMB_I || level.stage == LEVEL_STAGE_WOMB_II; + bool isStrongCrown = desc.data->type == ROOM_TREASURE && desc.visitedCount == 0 && + (crown_multiplier_get(level) >= 2 || (isWomb && is_trinket_strong(TRINKET_BLOODY_CROWN, 2))); + + if (players.FirstCollectibleOwner(COLLECTIBLE_MORE_OPTIONS, LAZARUS_SHARE_CHECK) || isStrongCrown) return true; + if (players.AnyoneHasTrinket(TRINKET_BROKEN_GLASSES) && !level.IsAltPath()) + { + RNG rng = {desc.spawnSeed, 9, 5, 25}; + + if ((int)rng.RandomInt(2) < players.GetTrinketMultiplier(TRINKET_BROKEN_GLASSES)) return true; + } + return game.roomTransition.mode != TRANSITION_NONE && (game.roomTransition.flags & TRANSITION_FLAG_TREASURE_REROLL); +} + +// Redraws an unvisited plain or Pay to Win treasure room as its more options kind of the same shape and doors. +static void treasure_room_reroll(RoomDescriptor& desc) +{ + RoomConfig_Room& data = *desc.data; + RNG rng = {desc.spawnSeed, 1, 5, 16}; + RoomQuery query = room_query(g_game->GetStageID(), ROOM_TREASURE, -1); + + if (data.type != ROOM_TREASURE || desc.visitedCount != 0) return; + if (data.subtype != 0 && data.subtype != TREASURE_SUBTYPE_PAY_TO_WIN) return; + query.subtype = data.subtype == 0 ? TREASURE_SUBTYPE_OPTIONS : TREASURE_SUBTYPE_OPTIONS_PAY_TO_WIN; + query.shape = data.shape; + query.requiredDoors = data.doors; + if (RoomConfig_Room* config = fallback_room_get(rng.Next(), query, STAGE_ID_SPECIAL_ROOMS)) desc.data = config; +} + +// The config a room taken over by Greed plays: its saved one, else a Greed miniboss room of its shape and doors (Super +// Greed once Greed was met, and in a devil room Ultra Greed's), which marks that Greed met. Without one the takeover is +// dropped. +static RoomConfig_Room* greed_takeover_config_get(RoomDescriptor& desc) +{ + RoomConfig_Room* config = desc.overrideData; + RNG rng = {desc.spawnSeed, 1, 5, 16}; + int subtype = GREED_SUBTYPE_DEVIL; + + if (config && config->stageId == STAGE_ID_SPECIAL_ROOMS && config->type == ROOM_MINIBOSS) return config; + if (desc.data->type != ROOM_DEVIL) + { + if (!desc.greedSubType) + desc.greedSubType = game_flag_get(STATE_GREED_SPAWNED) ? GREED_SUBTYPE_SUPER : GREED_SUBTYPE; + subtype = desc.greedSubType; + if (subtype == GREED_SUBTYPE) game_flag_set(STATE_GREED_SPAWNED, true); + else if (subtype == GREED_SUBTYPE_SUPER) game_flag_set(STATE_SUPER_GREED_SPAWNED, true); + } + + RoomQuery query = room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_MINIBOSS, subtype); + + query.maxDifficulty = DIFFICULTY_EASY; + query.mode = ROOM_MODE_NORMAL; + query.shape = desc.data->shape; + query.requiredDoors = desc.data->doors; + config = random_room_get(rng.Next(), query); + if (!config) + { + config = desc.data; + desc.flags &= ~ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS; + } + return desc.overrideData = config; +} + +// Opens a door of a room off the map toward where the players came from: the door they entered through when the room +// has it, else the first door it has from a random slot. The error room, crawl space, Mega Satan's, Genesis's and the +// Member Card's shop keep their doors, and the black market opens only from the crawl space. +static void off_map_room_door_open(Level& level, RoomDescriptor& desc) +{ + int type = desc.data->type; + int lastType = level.GetLastRoomDesc()->data->type; + int idx = level.currentRoomIdx; + + desc.allowedDoors = 0; + if (type == ROOM_ERROR || type == ROOM_DUNGEON || idx == ROOM_MEGA_SATAN_IDX || idx == ROOM_GENESIS_IDX || + idx == ROOM_SECRET_SHOP_IDX || (type == ROOM_BLACK_MARKET && lastType != ROOM_DUNGEON)) + return; + if (level.enterDoor < 0 || !(desc.data->doors >> level.enterDoor & 1)) + { + uint32_t start = Random() % DOOR_SLOT_COUNT; + + level.enterDoor = DOOR_NONE; + for (int i = 0; i < DOOR_SLOT_COUNT && level.enterDoor < 0; i++) + if (desc.data->doors >> ((start + i) % DOOR_SLOT_COUNT) & 1) + level.enterDoor = (int)((start + i) % DOOR_SLOT_COUNT); + } + // The original threw out_of_range here without a door. The room is entered without one instead. + if (level.enterDoor < 0) + log_printf(LOG_ASSERT, "Level::load_room: could not choose a door from where to enter off grid room\n"); + else desc.allowedDoors |= 1u << level.enterDoor; +} + +// Opens a red room door from an ultra secret room without doors, through the first slot whose neighbour has a room +// beside it that is not a curse room and joins no group. +static void ultra_secret_door_open(Level& level) +{ + Room& room = *level.room; + int safeIdx = room.descriptor->safeGridIndex; + + if (std::ranges::any_of(room.doors, [](GridEntity_Door* door) { return door; }) || safeIdx < 0) return; + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + int neighbor = level.GetNeighborRoomIdx(safeIdx, slot); + + if (neighbor < 0) continue; + for (XY direction : CARDINAL_OFFSETS) + { + int cell = (XY::NewFromGridIdx(neighbor) + direction).ToGridIdx(); + RoomDescriptor* other = cell >= 0 && cell != safeIdx ? level.GetRoomByIdx(cell) : nullptr; + + if (!other || !other->data || other->group != -1 || other->data->type == ROOM_CURSE) continue; + if (!level.MakeRedRoomDoor(safeIdx, slot)) break; + if (room.doors[slot]) + reconstruction_missing("Level::load_room 0073e0a0: opening the ultra secret room's red door " + "(GridEntity_Door::TryBlowOpen 0070fb60, its open animation)"); + return; + } + } +} + +// Points the room's doors at the rooms behind them: a room off the map's entry door back at the room left, the others' +// at their descriptor's neighbours (-2 for a red room door not opened yet). +static void doors_target(Level& level, RoomDescriptor& desc) +{ + std::array& doors = level.room->doors; + int type = desc.data->type; + + if (std::ranges::find(OFF_MAP_ENTRY_ROOMS, level.currentRoomIdx) != OFF_MAP_ENTRY_ROOMS.end()) + { + if (level.enterDoor < 0 || !doors[level.enterDoor]) return; + + GridEntity_Door& door = *doors[level.enterDoor]; + + door._slot = level.enterDoor; + door.SetRoomTypes(type, ROOM_DEFAULT); + door._targetRoomIdx = level.lastRoomIdx; + return; + } + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + GridEntity_Door* door = doors[slot]; + int target = desc.doors[slot]; + bool isRedDoor = target == RED_ROOM_DOOR_TARGET; + + if (!door || (!isRedDoor && (target < 0 || level.currentRoomMap[target] < 0))) continue; + door->_slot = slot; + door->_targetRoomIdx = target; + door->SetRoomTypes(type, isRedDoor ? ROOM_DEFAULT : level.GetRoomByIdx(target)->data->type); + } +} + +// The blood splats at a Corpse room's doors into normal, treasure, miniboss and boss rooms that use the alternate +// backdrop: nine along the way out of each, scattered and scaled from the room behind's decoration seed, grayed. +static void corpse_door_splats_spawn(Level& level) +{ + Room& room = *level.room; + float rotationCos = std::cos(QUARTER_TURN); + float rotationSin = std::sin(QUARTER_TURN); + + for (GridEntity_Door* door : room.doors) + { + if (!door || std::ranges::find(CORPSE_SPLAT_ROOM_TYPES, door->_targetRoomType) == CORPSE_SPLAT_ROOM_TYPES.end()) + continue; + + RoomDescriptor& target = *level.GetRoomByIdx(door->_targetRoomIdx); + + if (!(target.flags & ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP)) continue; + + RNG rng = {target.decorationSeed, 2, 15, 17}; + Vector direction{}; + int gridIndex = (int)door->_gridIndex; + + Isaac::GetAxisAlignedUnitVectorFromDir(&direction, door->_direction); + + Vector out = {-direction.x, -direction.y}; + Vector across = {out.x * rotationCos - out.y * rotationSin, out.x * rotationSin + out.y * rotationCos}; + float baseX = out.x * SPLAT_DOOR_OFFSET + (float)(gridIndex % room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_X; + float baseY = out.y * SPLAT_DOOR_OFFSET + (float)(gridIndex / room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_Y; + + for (int i = 0; i < SPLAT_COUNT; i++) + { + float along = (float)i * SPLAT_STEP; + uint32_t seed = Random(); + float rowY = baseY + out.y * along * SPLAT_LENGTH; + float rowX = baseX + along * SPLAT_LENGTH * out.x; + float spread = (rng.RandomFloat() - 0.5f) * along * SPLAT_SPREAD; + EntitySpawn spawn = {.position = {across.x * spread + rowX, rowY + spread * across.y}, + .type = ENTITY_EFFECT, + .variant = EFFECT_VARIANT_BLOOD_SPLAT, + .seed = seed}; + Entity& splat = *g_game->Spawn(spawn); + float scale = rng.RandomFloat() * (1 - along) * SPLAT_SCALE_RANGE + SPLAT_SCALE_MIN; + + splat.sprite.scale = vector_make(scale, scale); + splat.sprite.color = SPLAT_COLOR; + splat.Update(); + } + } +} + +// 0073e0a0 Builds the room the players are in from its descriptor: Devil's Crown's devil treasure rooms, the treasure +// room rerolls, Greed's takeover config and a door into rooms off the map first, then the room itself, its doors and +// the special doors a cleared room spawns, the mineshaft entrance's bridged pits, Genesis's reset, and the players' +// entry, with the entities spawned this frame updated once. +void Level::load_room() +{ + Game& game = *g_game; + RoomDescriptor& desc = *GetRoomByIdx(currentRoomIdx); + bool isGreed = is_greed(); + + if (game.playerManager.AnyoneHasTrinket(TRINKET_RIB_OF_GREED) && desc.data->type != ROOM_DEVIL) + desc.flags &= ~ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS; + if (game.roomTransition.mode != TRANSITION_NONE && (game.roomTransition.flags & TRANSITION_FLAG_NO_TAKEOVER) && + desc.data->type == ROOM_SHOP) + desc.flags &= ~ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS; + if (desc.visitedCount == 0 && (desc.flags & ROOM_DESCRIPTOR_FLAG_DEVIL_TREASURE)) + devils_crown_room_roll(*this, desc); + if (is_treasure_reroll(*this, desc)) treasure_room_reroll(desc); + + RoomConfig_Room* config = + desc.flags & ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS ? greed_takeover_config_get(desc) : desc.data; + + if (desc.listIndex >= ROOM_MAP_CELLS && desc.gridIndex != ROOM_BLUE_ROOM_IDX) off_map_room_door_open(*this, desc); + room->Init(*config, desc); + if (room->roomType == ROOM_ULTRASECRET) ultra_secret_door_open(*this); + + bool isMineshaftFloor = + stage == LEVEL_STAGE_CAVES_II || (stage == LEVEL_STAGE_CAVES_I && (GetCurses() & CURSE_OF_LABYRINTH)); + bool isMineshaftEntrance = desc.data->type == ROOM_DEFAULT && desc.data->subtype == MINESHAFT_ENTRANCE_SUBTYPE && + (desc.flags & ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE) && !desc.data->spawns.empty(); + + if (!isGreed && !IsAscent() && IsAltPath() && isMineshaftFloor && isMineshaftEntrance) + reconstruction_missing("Level::load_room 0073e0a0: the mineshaft entrance's bridged pits (Room+0x746d)"); + doors_target(*this, desc); + if (GetRoomByIdx(currentRoomIdx)->flags & ROOM_DESCRIPTOR_FLAG_CLEAR) + reconstruction_missing("Level::load_room 0073e0a0: a cleared room's special doors (Room::TrySpawnSecretExit " + "007f7a40, TrySpawnDevilRoomDoor 007f83b0, TrySpawnBossRushDoor 007f9960, " + "TrySpawnTheVoidDoor 008204b0, TrySpawnBlueWombDoor 00820170)"); + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + RoomShape shape = room->descriptor && room->descriptor->data ? room->descriptor->data->shape : ROOMSHAPE_1x1; + int gridIndex = room_shape_get_door_grid_index(slot, room->gridWidth, room->gridHeight, shape); + GridEntity* entity = gridIndex >= 0 && gridIndex < ROOM_GRID_CELLS ? room->gridEntities[gridIndex] : nullptr; + + if (room->doors[slot] || !entity || grid_desc_get(*entity)._type != GRID_DOOR) continue; + if (static_cast(entity)->_direction != DOOR_NONE) continue; + room->doors[slot] = static_cast(entity); + room->RemoveDoor(slot); + } + reconstruction_missing( + "Level::load_room 0073e0a0: the Member Card's shop door (Room::TrySpawnSecretShop 007f8190)"); + + int roomStageType = game.challenge == CHALLENGE_RED_REDEMPTION ? GetRoomStageType(currentRoomIdx) : (int)stageType; + bool isCorpse = RoomConfig::GetStageID((int)stage, roomStageType, ROOM_MODE_CURRENT) == STAGE_ID_CORPSE; + + if ((game.challenge == CHALLENGE_RED_REDEMPTION || currentDimensionIdx != DEATH_CERTIFICATE_DIMENSION) && + isCorpse && room->backdropType != BACKDROP_CORPSE3) + corpse_door_splats_spawn(*this); + if (currentRoomIdx == ROOM_GENESIS_IDX && room->descriptor->visitedCount == 1) + reconstruction_missing("Level::load_room 0073e0a0: Genesis's reset of the players (FUN_007dad80, " + "Game::reset_players_for_greed)"); + if (!game.deathmatchManager.is_active()) game.playerManager.enter_level(); + room->fxLayers.Update(PLAYER_FOLLOW_SNAP); + reconstruction_missing("Level::load_room 0073e0a0: the Red Key's door outlines (Room::UpdateRedKey 008271e0)"); + + bool isHomePathBoss = + game.GetChallengeParams().pathType == PATH_TYPE_HOME && + (stage == LEVEL_STAGE_DEPTHS_II || (stage == LEVEL_STAGE_DEPTHS_I && (GetCurses() & CURSE_OF_LABYRINTH))); + + if (isHomePathBoss && GetRoomByIdx(currentRoomIdx)->listIndex == lastBossRoomListIdx && + (room->descriptor->flags & ROOM_DESCRIPTOR_FLAG_CLEAR)) + reconstruction_missing("Level::load_room 0073e0a0: the Home path's Boss Rush door (Room::update_door_targets " + "00802670, TrySpawnBossRushDoor 007f9960)"); + + EntityList_EL& updated = room->entityList.updateEL; + + for (size_t i = 0; i < updated.size(); i++) + { + Entity& entity = *updated[i]; + bool isUpdated = (game.deathmatchManager.is_active() && entity.type == ENTITY_PLAYER) || + (entity.type >= ENTITY_FIRST_ENEMY && entity.type < ENTITY_EFFECT); + + if (isUpdated && game.frameCount == entity.spawnFrame) entity.Update(); + } + FUN_00865180(); + if (!game.deathmatchManager.is_active()) return; + game.deathmatchManager.type->Init(); + game.dizzyTargetIntensity = 0; + game.dizzyIntensity = 0; +} + +// 0073f940 Shows the room the players are in on the minimap (with its mirror world twin) and the rooms behind its +// doors, then redraws both maps and has the HUD refresh the players' part. +void Level::UpdateVisibility() +{ + RoomDescriptor& current = *GetRoomByIdx(currentRoomIdx); + HUD& hud = g_game->hud; + + current.displayFlags |= ROOM_DISPLAY_BOX | ROOM_DISPLAY_ICON; + if (currentRoomIdx >= 0 && HasMirrorDimension()) + GetRoomByIdx(currentRoomIdx, 1 - currentDimensionIdx)->displayFlags |= ROOM_DISPLAY_BOX | ROOM_DISPLAY_ICON; + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + if (GridEntity_Door* door = room->doors[slot]; door && door->_targetRoomIdx >= 0) + reveal_room_visibility(*GetRoomByIdx(door->_targetRoomIdx), ¤t, slot); + for (MinimapConfig& config : g_game->minimap.configs) config.refresh(); + if (hud.hudRefreshType == HUD_REFRESH_FULL) return; + hud.hudRefreshType = HUD_REFRESH_PLAYER; + hud.hudRefreshCountdown = HUD_REFRESH_FRAMES; +} + +// Adds display flags to a room and its mirror world twin. +static void room_display_add(Level& level, RoomDescriptor& room, uint32_t displayFlags) +{ + room.displayFlags |= displayFlags; + if (room.safeGridIndex >= 0 && level.HasMirrorDimension()) + level.GetRoomByIdx(room.safeGridIndex, 1 - level.currentDimensionIdx)->displayFlags |= displayFlags; +} + +// 0073f620 Shows a room beside fromRoom on the minimap. A secret room, or any room seen from one, only shows through a +// busted door, X-Ray Vision, Spelunker Hat or the floor seen whole (X-Ray Vision opening a hidden door from the room +// the players are in). Without Spelunker Hat a miniboss room, bedroom or secret room shows as a locked box, any other +// room with its icon. Spelunker Hat goes on to the rooms beside it, and a red room always shows its icon. +void Level::reveal_room_visibility(RoomDescriptor& target, RoomDescriptor* fromRoom, int doorSlot) +{ + PlayerManager& players = g_game->playerManager; + RoomDescriptor* current = room->descriptor; + auto is_secret = [](RoomDescriptor& desc) { + return desc.data->type == ROOM_SECRET || desc.data->type == ROOM_SUPERSECRET; + }; + bool isSecret = is_secret(target) || (fromRoom && is_secret(*fromRoom)); + auto is_xray = [&]() { + return players.FirstCollectibleOwner(COLLECTIBLE_XRAY_VISION, LAZARUS_SHARE_CHECK) || isCanSeeEverything; + }; + auto is_spelunker = [&]() { + return players.FirstCollectibleOwner(COLLECTIBLE_SPELUNKER_HAT, LAZARUS_SHARE_CHECK); + }; + bool isShown = !isSecret; + + if (isSecret && fromRoom == current && doorSlot != -1) + { + GridEntity_Door& door = *room->doors[doorSlot]; + + if (is_xray() && grid_desc_get(door)._variant == DOOR_VARIANT_HIDDEN) + reconstruction_missing("Level::reveal_room_visibility 0073f620: X-Ray Vision's hidden door opening " + "(Game::SpawnEx 006fe410)"); + isShown = door._isBusted; + } + if (!isShown) isShown = is_xray() || is_spelunker(); + if (isShown) + { + int type = target.data->type; + bool isLocked = type == ROOM_MINIBOSS || type == ROOM_ISAACS || type == ROOM_BARREN || isSecret; + + room_display_add(*this, target, + !is_spelunker() && isLocked ? ROOM_DISPLAY_BOX | ROOM_DISPLAY_LOCK + : ROOM_DISPLAY_BOX | ROOM_DISPLAY_ICON); + if (is_spelunker() && fromRoom == current && fromRoom != &target) + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + { + int neighbor = GetNeighborRoomIdx(target.safeGridIndex, slot); + + if (neighbor >= 0 && GetRoomByIdx(neighbor)->data) + reveal_room_visibility(*GetRoomByIdx(neighbor), &target, slot); + } + } + if (target.flags & ROOM_DESCRIPTOR_FLAG_RED_ROOM) target.displayFlags |= ROOM_DISPLAY_BOX | ROOM_DISPLAY_ICON; } // 00742ef0 Lays out an Ascent floor. @@ -885,12 +2605,6 @@ bool Level::boss_count_adjust(int&, int&) reconstruction_missing("Level::boss_count_adjust 007523e0"); } -// 0073e0a0 Loads the current room. -void Level::load_room() -{ - reconstruction_missing("Level::load_room 0073e0a0"); -} - // 0073fc80 Moves to another room. void Level::ChangeRoom(int, int) { @@ -903,18 +2617,6 @@ void Level::DEBUG_goto_room(RoomConfig_Room*) reconstruction_missing("Level::DEBUG_goto_room 0073fa20"); } -// 0073dae0 Refreshes a room's doors from its neighbours. -void Level::update_room_doors(RoomDescriptor&) -{ - reconstruction_missing("Level::update_room_doors 0073dae0"); -} - -// 0073f940 Refreshes which rooms the map shows. -void Level::UpdateVisibility() -{ - reconstruction_missing("Level::UpdateVisibility 0073f940"); -} - // 00748860 Reveals the map. void Level::ApplyMapEffect() { @@ -987,12 +2689,6 @@ std::set Level::get_rooms_within_two_doors(int) reconstruction_missing("Level::get_rooms_within_two_doors 007496a0"); } -// 00752460 The cells beside every door. -std::vector Level::get_door_neighbor_indices() -{ - reconstruction_missing("Level::get_door_neighbor_indices 00752460"); -} - // 0074a090 Where the players enter the current room. Vector Level::GetEnterPosition() { @@ -1137,24 +2833,6 @@ void Level::RemoveCurses(uint32_t) reconstruction_missing("Level::RemoveCurses 00748bc0"); } -// 007467c0 Moves to the next stage. -void Level::SetNextStage() -{ - reconstruction_missing("Level::SetNextStage 007467c0"); -} - -// 0074b710 Whether a next stage exists. -bool Level::IsNextStageAvailable() -{ - reconstruction_missing("Level::IsNextStageAvailable 0074b710"); -} - -// 0074b830 Whether a stage is within the run's end. -bool Level::IsStageWithinEnd(int, bool) -{ - reconstruction_missing("Level::IsStageWithinEnd 0074b830"); -} - // 007eb870 Updates the Ascent's stages. bool Level::UpdateBackwardsPathStages() { @@ -1167,12 +2845,6 @@ int Level::GetAbsoluteStage() reconstruction_missing("Level::GetAbsoluteStage 0074b960"); } -// 0074b5d0 Whether a trapdoor may spawn. -bool Level::CanSpawnTrapDoor() -{ - reconstruction_missing("Level::CanSpawnTrapDoor 0074b5d0"); -} - // 0074bae0 The kind of secret exit the floor has. int Level::get_secret_exit_kind() { diff --git a/src/level.h b/src/level.h index 93d0cc6..9d59120 100644 --- a/src/level.h +++ b/src/level.h @@ -2,6 +2,7 @@ #include "classes.h" #include "level_generator.h" +#include "room_descriptor.h" #include "seeds.h" #include #include @@ -26,8 +27,20 @@ enum OffMapRoom : int { ROOM_DEVIL_IDX = -1, ROOM_ERROR_IDX = -2, + ROOM_DEBUG_IDX = -3, + ROOM_DUNGEON_IDX = -4, + ROOM_BOSSRUSH_IDX = -5, + ROOM_BLACK_MARKET_IDX = -6, ROOM_MEGA_SATAN_IDX = -7, + ROOM_BLUE_WOMB_IDX = -8, + ROOM_THE_VOID_IDX = -9, ROOM_SECRET_EXIT_IDX = -10, + ROOM_GIDEON_DUNGEON_IDX = -11, + ROOM_GENESIS_IDX = -12, + ROOM_SECRET_SHOP_IDX = -13, + ROOM_BLUE_ROOM_IDX = -16, + ROOM_EXTRA_BOSS_IDX = -17, + ROOM_ANGEL_SHOP_IDX = -18, ROOM_LIL_PORTAL_IDX = -20 }; @@ -144,6 +157,7 @@ public: void update_all_room_doors(); void update_room_doors(RoomDescriptor& room); void UpdateVisibility(); + void reveal_room_visibility(RoomDescriptor& room, RoomDescriptor* fromRoom, int doorSlot); void ApplyMapEffect(); void ApplyBlueMapEffect(); void ApplyCompassEffect(bool isPersistent); @@ -160,7 +174,7 @@ public: int find_matching_room_idx(int roomIdx); bool maze_swap_rooms(int roomIdx, int otherRoomIdx); std::set get_rooms_within_two_doors(int gridIndex); - std::vector get_door_neighbor_indices(); + std::set get_door_neighbor_indices(); int GetRoomStageType(int roomIdx); Vector GetEnterPosition(); @@ -211,6 +225,7 @@ public: bool HasAbandonedMineshaft(); bool HasPhotoDoor(); bool CanSpawnTrapDoor(); + float GetPlanetariumChance(); int get_secret_exit_kind(); RoomDescriptor* get_secret_exit_room(int kind); @@ -222,5 +237,3 @@ public: static void write_room_config(RoomConfig_Room* roomConfig, void* gameStateRoom, void* deque); static RoomConfig_Room* get_room_config_from_saved_id(uint32_t* savedId, void* mergeTable); }; - -void room_descriptor_seeds_init(RoomDescriptor& room, RNG& rng); diff --git a/src/level_generator.cpp b/src/level_generator.cpp index 050fe42..17f92fb 100644 --- a/src/level_generator.cpp +++ b/src/level_generator.cpp @@ -422,8 +422,8 @@ bool LevelGenerator::add_dead_end() } // 009addf0 Places a 1x1 dead end beside a single room, trying the rooms in a shuffled order, on a cell not in -// excludedCells, then refreshes the dead ends. -bool LevelGenerator::try_add_dead_end(const std::set* excludedCells) +// excludedCells, then refreshes the dead ends. The new room, or none. +LevelGenerator_Room* LevelGenerator::try_add_dead_end(const std::set* excludedCells) { std::vector order(rooms.size()); @@ -438,11 +438,12 @@ bool LevelGenerator::try_add_dead_end(const std::set* excludedCells) count_neighbor_rooms(candidate.linkPos) >= 2) continue; if (excludedCells && excludedCells->contains(candidate.position.ToGridIdx())) continue; - place_room(candidate); + int index = place_room(candidate).generationIndex; + update_dead_end_lists(); - return true; + return &rooms[index]; } - return false; + return nullptr; } // 009b1220 Grows a dead end into shape on a spot around its entry cell: the first spot of that shape whose door diff --git a/src/level_generator.h b/src/level_generator.h index bd4d126..ebe3421 100644 --- a/src/level_generator.h +++ b/src/level_generator.h @@ -119,7 +119,7 @@ public: void Generate(const GenerationSettings& settings, const LevelGenerator_Room& startRoom); LevelGenerator_Room* CreateRoom(const LevelGenerator_Room& room); - bool try_add_dead_end(const std::set* excludedCells); + LevelGenerator_Room* try_add_dead_end(const std::set* excludedCells); bool add_dead_end(); LevelGenerator_Room* GetNewEndRoom(RoomShape shape, uint32_t possibleDoors); void DetermineBossRoom(RoomShape shape, uint32_t possibleDoors); diff --git a/src/level_stage.cpp b/src/level_stage.cpp new file mode 100644 index 0000000..9868092 --- /dev/null +++ b/src/level_stage.cpp @@ -0,0 +1,249 @@ +#include "game.h" +#include "log.h" +#include "manager.h" +#include "room.h" +#include +#include + +constexpr int STAGE_BASEMENT_I = 1; +constexpr int STAGE_BASEMENT_II = 2; +constexpr int STAGE_CAVES_I = 3; +constexpr int STAGE_CAVES_II = 4; +constexpr int STAGE_DEPTHS_I = 5; +constexpr int STAGE_DEPTHS_II = 6; +constexpr int STAGE_WOMB_I = 7; +constexpr int STAGE_WOMB_II = 8; +constexpr int STAGE_BLUE_WOMB = 9; +constexpr int STAGE_SHEOL = 10; +constexpr int STAGE_DARK_ROOM = 11; +constexpr int STAGE_VOID = 12; +constexpr int STAGE_HOME = 13; +constexpr int STAGE_GREED_SHOP = 7; +constexpr int STAGE_ROLLED_LAST = 9; +constexpr int ASCENT_STAGE_LAST = 6; + +constexpr int GRID_ROOM_BLUE_WOMB = -8; +constexpr int GRID_ROOM_THE_VOID = -9; +constexpr int GRID_ROOM_GENESIS = -12; + +constexpr uint32_t CHALLENGE_BACKASSWARDS = 31; +constexpr uint32_t CHALLENGE_RED_REDEMPTION = 44; +constexpr int COLLECTIBLE_KNIFE_PIECE_1 = 626; +constexpr int COLLECTIBLE_KNIFE_PIECE_2 = 627; +constexpr uint32_t AFTERBIRTH_STAGE_ODDS = 3; +constexpr uint32_t WOTL_SEED_BIT = 1; +constexpr uint32_t REPENTANCE_B_SEED_BIT = 2; + +// The stage Backasswards goes to after each stage up to the Dark Room, -1 where the original logs a wrong stage. +constexpr std::array BACKASSWARDS_NEXT_STAGES = {STAGE_DARK_ROOM, 1, 1, 2, 3, 4, 5, 6, 7, -1, 8, 10}; + +// The achievements unlocking each chapter's alternate stage types (Cellar to Necropolis, with the Utero always open, +// Burning Basement to Scarred Womb, Dross to Gehenna). 0 is always unlocked. +constexpr std::array WOTL_UNLOCKS = {86, 87, 88, 0}; +constexpr std::array AFTERBIRTH_UNLOCKS = {342, 343, 344, 345}; +constexpr std::array REPENTANCE_B_UNLOCKS = {412, 413, 414}; + +// Which way the next floor of the main game leads: on the main path with a rolled stage type, out the alternate +// path's exit, or one chapter down onto the alternate path (both with the alternate path's own roll). +enum StagePath +{ + STAGE_PATH_MAIN, + STAGE_PATH_ALT_EXIT, + STAGE_PATH_DOWN +}; + +// Whether a stage type is one of the alternate path's (Downpour to Corpse and their B sides). +static bool is_repentance_type(int stageType) +{ + return stageType == STAGETYPE_REPENTANCE || stageType == STAGETYPE_REPENTANCE_B; +} + +// Whether a chapter's unlock in a table has been earned. A chapter past the table has none. +static bool is_chapter_unlocked(std::span unlocks, int chapter) +{ + if (chapter < 0 || chapter >= (int)unlocks.size()) return false; + return g_manager->persistentGameData.Unlocked(unlocks[chapter]); +} + +// Whether a player holds a Knife Piece, or the backup of a dead Lazarus does. +static bool is_knife_piece_held(int collectibleId) +{ + return g_game->playerManager.FirstCollectibleOwner(collectibleId, LAZARUS_SHARE_CHECK) != nullptr; +} + +// The Ascent's next floor, down the saved backwards stages from the Mausoleum or Gehenna: Home after the Basement, +// one stage back (two past an XL floor) on its saved stage type. Past the saved stages it goes to stage 0. +static void ascent_stage_set(Level& level) +{ + int floor = level.stage + (is_repentance_type(level.stageType) ? 1 : 0); + + if (floor == STAGE_BASEMENT_I) return level.SetStage(STAGE_HOME, level.stageType); + if (floor > BACKWARDS_STAGE_COUNT) return level.SetStage(0, level.stageType); + + auto& stages = g_game->backwardsStages; + int next = floor - 1; + if (next > 1 && stages[next - 2]._isXL) next--; + if (is_repentance_type(stages[next - 1]._stageType)) return level.SetStage(next - 1, STAGETYPE_REPENTANCE); + level.SetStage(next, STAGETYPE_ORIGINAL); +} + +// The stage after a stage on the main game's paths, which may reset the next stage type (??? to Home). +static int path_next_stage(Level& level, int& nextStageType) +{ + switch (level.stage) + { + case STAGE_WOMB_II: + return level.IsAltPath() ? STAGE_WOMB_II : STAGE_SHEOL; + case STAGE_BLUE_WOMB: + if (level.stageType != STAGETYPE_REPENTANCE) return STAGE_SHEOL; + nextStageType = STAGETYPE_ORIGINAL; + return STAGE_HOME; + case STAGE_SHEOL: + case STAGE_DARK_ROOM: + return STAGE_DARK_ROOM; + case STAGE_VOID: + case STAGE_HOME: + return level.stage; + default: + if (level.stage < STAGE_WOMB_II) return level.stage + 1; + log_printf(LOG_ASSERT, "Wrong Stage"); + return 0; + } +} + +// The stage type of a main path stage rolled from its seed: the first alternates (each chapter once unlocked) on an +// even seed, the second ones on a third of seeds below the Sheol, and Flooded Caves with the G FUEL seed. +static int main_stage_type(int nextStage, uint32_t seed) +{ + int chapter = (nextStage - 1) / 2; + int type = STAGETYPE_ORIGINAL; + + if (nextStage > 0 && !(seed & WOTL_SEED_BIT) && is_chapter_unlocked(WOTL_UNLOCKS, chapter)) type = STAGETYPE_WOTL; + if (nextStage > 0 && seed % AFTERBIRTH_STAGE_ODDS == 0 && nextStage <= STAGE_ROLLED_LAST && + is_chapter_unlocked(AFTERBIRTH_UNLOCKS, chapter)) + type = STAGETYPE_AFTERBIRTH; + if (g_game->seedEffects.HasSeedEffect(SEED_G_FUEL) && (nextStage == STAGE_CAVES_I || nextStage == STAGE_CAVES_II)) + type = STAGETYPE_AFTERBIRTH; + return type; +} + +// The alternate path's stage type for a stage, rolled from the seed of the stage after it: the B side once unlocked. +static int repentance_stage_type(int nextStage) +{ + uint32_t seed = g_game->seedEffects.GetStageSeed(nextStage + 1); + bool isB = !(seed & REPENTANCE_B_SEED_BIT) && nextStage > 0 && + is_chapter_unlocked(REPENTANCE_B_UNLOCKS, (nextStage - 1) / 2); + return isB ? STAGETYPE_REPENTANCE_B : STAGETYPE_REPENTANCE; +} + +// Greed's next floor with its rolled stage type: each floor one chapter, the shop floor last. +static void greed_stage_set(Level& level, int nextStage) +{ + uint32_t seed = g_game->seedEffects.GetStageSeed(nextStage); + int chapter = nextStage - 1; + int type = STAGETYPE_ORIGINAL; + + if (!(seed & WOTL_SEED_BIT) && is_chapter_unlocked(WOTL_UNLOCKS, chapter)) type = STAGETYPE_WOTL; + if (seed % AFTERBIRTH_STAGE_ODDS == 0 && nextStage <= STAGE_ROLLED_LAST && + is_chapter_unlocked(AFTERBIRTH_UNLOCKS, chapter)) + type = STAGETYPE_AFTERBIRTH; + level.SetStage(nextStage, type); +} + +// 007467c0 Moves to the next floor: back down the Ascent, Greed's next floor, or the main game's next stage. A floor +// with the Curse of the Labyrinth (or in Red Redemption) counts as both floors of its chapter. On the main game the +// alternate path's exits, Knife Pieces and challenges pick its path and the next stage's seed its stage type. Past the +// Womb, the room the floor was left from picks ???, the Void, or the Cathedral when heading to Heaven. +void Level::SetNextStage() +{ + Game& game = *g_game; + int nextStage = 0; + int nextStageType = stageType; + + if (stage >= 1 && (int)stage <= ASCENT_STAGE_LAST && game.GetStateFlag(GAME_STATE_BACKWARDS_PATH)) + return ascent_stage_set(*this); + + if (game.IsGreedMode()) + { + nextStageType = STAGETYPE_ORIGINAL; + if (stage < STAGE_DEPTHS_II) nextStage = stage + 1; + else if (stage <= STAGE_GREED_SHOP) nextStage = STAGE_GREED_SHOP; + else log_printf(LOG_ASSERT, "Wrong Stage (Greed Mode)"); + } + else + { + nextStage = path_next_stage(*this, nextStageType); + if (game.challenge == CHALLENGE_BACKASSWARDS) + { + int backwards = stage < BACKASSWARDS_NEXT_STAGES.size() ? BACKASSWARDS_NEXT_STAGES[stage] : -1; + if (backwards < 0) log_printf(LOG_ASSERT, "Wrong Stage"); + else nextStage = backwards; + } + } + + uint32_t activeCurses = (Seeds::GetForcedCurses() | game.debugCurses | curses) & ~Seeds::GetPreventedCurses(); + bool isDoubleFloor = activeCurses & CURSE_OF_LABYRINTH || game.challenge == CHALLENGE_RED_REDEMPTION; + bool isChapterStart = stage == STAGE_BASEMENT_I || stage == STAGE_CAVES_I || stage == STAGE_DEPTHS_I || + stage == STAGE_WOMB_I; + if (isDoubleFloor && isChapterStart) nextStage += stage == STAGE_WOMB_I ? 2 : 1; + + if (game.IsGreedMode()) return greed_stage_set(*this, nextStage); + if (nextStage == STAGE_HOME) return SetStage(nextStage, nextStageType); + + bool isRepentanceChallenge = (game.challenge != 0 || game.dailyChallenge._id != 0) && + game.GetChallengeParams().pathType == PATH_TYPE_REPENTANCE && + game.challenge != CHALLENGE_RED_REDEMPTION; + bool isAltStage = is_repentance_type(game.stageType); + bool isLabyrinth = filter_curses(CURSE_OF_LABYRINTH) != 0; + bool isChapter1End = stage == STAGE_BASEMENT_II || (stage == STAGE_BASEMENT_I && isLabyrinth); + bool isChapter2End = stage == STAGE_CAVES_II || (stage == STAGE_CAVES_I && isLabyrinth); + bool isChapter3End = stage == STAGE_DEPTHS_II || (stage == STAGE_DEPTHS_I && isLabyrinth); + bool isChapterEnd = isChapter1End || isChapter2End || isChapter3End; + bool isAltExitOpen = !isChapterEnd || IsMausoleumHeartStage() || + (isChapter1End && is_knife_piece_held(COLLECTIBLE_KNIFE_PIECE_1)) || + (isChapter2End && is_knife_piece_held(COLLECTIBLE_KNIFE_PIECE_1) && + is_knife_piece_held(COLLECTIBLE_KNIFE_PIECE_2)); + + bool isRoomLoaded = room && room->isInitialized; + RoomDescriptor* roomDesc = isRoomLoaded ? room->descriptor : nullptr; + RoomType roomType = isRoomLoaded ? room->roomType : ROOM_NULL; + bool isExitRoom = roomType == ROOM_BLACK_MARKET || roomType == ROOM_SECRET_EXIT || roomType == ROOM_ERROR || + (roomDesc && roomDesc->listIndex == GRID_ROOM_GENESIS); + StagePath path = STAGE_PATH_MAIN; + + if (game.GetStateFlag(GAME_STATE_SECRET_PATH)) path = isAltStage ? STAGE_PATH_ALT_EXIT : STAGE_PATH_DOWN; + else if (isRoomLoaded && isAltStage && ((isAltExitOpen && isExitRoom) || IsMausoleumHeartStage())) + path = STAGE_PATH_ALT_EXIT; + else if (isRepentanceChallenge && nextStage > 1) path = isAltStage ? STAGE_PATH_ALT_EXIT : STAGE_PATH_DOWN; + else if (isAltStage && !isChapterEnd) path = STAGE_PATH_ALT_EXIT; + + bool isKnifeMissing = (isChapter1End && !is_knife_piece_held(COLLECTIBLE_KNIFE_PIECE_1)) || + (isChapter2End && !is_knife_piece_held(COLLECTIBLE_KNIFE_PIECE_2)); + if (path == STAGE_PATH_ALT_EXIT && isRepentanceChallenge && isKnifeMissing) path = STAGE_PATH_DOWN; + + if (path == STAGE_PATH_MAIN) + { + if (isAltStage && !game.IsAscent()) nextStage++; + nextStageType = main_stage_type(nextStage, game.seedEffects.GetStageSeed(nextStage)); + } + else + { + if (path == STAGE_PATH_DOWN) nextStage = std::max(nextStage - 1, 1); + nextStageType = repentance_stage_type(nextStage); + } + + if (nextStage < STAGE_SHEOL) + { + game.gameStateFlags &= ~(1ull << GAME_STATE_HEAVEN_PATH); + return SetStage(nextStage, nextStageType); + } + if (nextStage == STAGE_SHEOL) + { + if (currentRoomIdx == GRID_ROOM_BLUE_WOMB) return SetStage(STAGE_BLUE_WOMB, STAGETYPE_ORIGINAL); + if (currentRoomIdx == GRID_ROOM_THE_VOID) return SetStage(STAGE_VOID, STAGETYPE_ORIGINAL); + bool isCathedral = game.GetStateFlag(GAME_STATE_HEAVEN_PATH) && game.challenge != CHALLENGE_BACKASSWARDS; + return SetStage(STAGE_SHEOL, isCathedral ? STAGETYPE_WOTL : STAGETYPE_ORIGINAL); + } + if (nextStage == STAGE_DARK_ROOM) return SetStage(STAGE_DARK_ROOM, stageType); + SetStage(nextStage, nextStageType); +} diff --git a/src/lua_engine.cpp b/src/lua_engine.cpp index a08b2b8..ee0918d 100644 --- a/src/lua_engine.cpp +++ b/src/lua_engine.cpp @@ -1,6 +1,14 @@ #include "lua_engine.h" #include "classes.h" #include "data.h" +#include "entity_bomb.h" +#include "entity_familiar.h" +#include "entity_knife.h" +#include "entity_npc.h" +#include "entity_pickup.h" +#include "entity_player.h" +#include "entity_projectile.h" +#include "entity_tear.h" #include "game.h" #include "manager.h" #include "platform.h" @@ -406,56 +414,56 @@ int LuaEngine::Isaac_GetItemIdByName(std::string_view name) // 00862250 Runs MC_PRE_BOMB_COLLISION, filtered by the bomb's variant. LuaResult LuaEngine::PreBombCollision(Entity_Bomb* bomb, Entity* collider, bool isLow) { - CallbackRun run = {"PreBombCollision", MC_PRE_BOMB_COLLISION, (int)bomb->_variant}; + CallbackRun run = {"PreBombCollision", MC_PRE_BOMB_COLLISION, (int)bomb->variant}; return collision_run(*this, run, {bomb, LUA_CLASS_BOMB}, collider, isLow); } // 008610d0 Runs MC_PRE_FAMILIAR_COLLISION, filtered by the familiar's variant. LuaResult LuaEngine::PreFamiliarCollision(Entity_Familiar* familiar, Entity* collider, bool isLow) { - CallbackRun run = {"PreFamiliarCollision", MC_PRE_FAMILIAR_COLLISION, (int)familiar->_variant}; + CallbackRun run = {"PreFamiliarCollision", MC_PRE_FAMILIAR_COLLISION, (int)familiar->variant}; return collision_run(*this, run, {familiar, LUA_CLASS_FAMILIAR}, collider, isLow); } // 00861c40 Runs MC_PRE_KNIFE_COLLISION, filtered by the knife's subtype. LuaResult LuaEngine::PreKnifeCollision(Entity_Knife* knife, Entity* collider, bool isLow) { - CallbackRun run = {"PreKnifeCollision", MC_PRE_KNIFE_COLLISION, (int)knife->_subtype}; + CallbackRun run = {"PreKnifeCollision", MC_PRE_KNIFE_COLLISION, (int)knife->subtype}; return collision_run(*this, run, {knife, LUA_CLASS_KNIFE}, collider, isLow); } // 00860d70 Runs MC_PRE_NPC_COLLISION, filtered by the NPC's type. LuaResult LuaEngine::PreNPCCollision(Entity_NPC* npc, Entity* collider, bool isLow) { - CallbackRun run = {"PreNPCCollision", MC_PRE_NPC_COLLISION, (int)npc->_type}; + CallbackRun run = {"PreNPCCollision", MC_PRE_NPC_COLLISION, (int)npc->type}; return collision_run(*this, run, {npc, LUA_CLASS_NPC}, collider, isLow); } // 008631b0 Runs MC_PRE_PICKUP_COLLISION, filtered by the pickup's variant. LuaResult LuaEngine::PrePickupCollision(Entity_Pickup* pickup, Entity* collider, bool isLow) { - CallbackRun run = {"PrePickupCollision", MC_PRE_PICKUP_COLLISION, (int)pickup->_variant}; + CallbackRun run = {"PrePickupCollision", MC_PRE_PICKUP_COLLISION, (int)pickup->variant}; return collision_run(*this, run, {pickup, LUA_CLASS_PICKUP}, collider, isLow); } // 00864300 Runs MC_PRE_PLAYER_COLLISION, filtered by the player's variant. LuaResult LuaEngine::PrePlayerCollide(Entity_Player* player, Entity* collider, bool isLow) { - CallbackRun run = {"PrePlayerCollision", MC_PRE_PLAYER_COLLISION, (int)player->_variant}; + CallbackRun run = {"PrePlayerCollision", MC_PRE_PLAYER_COLLISION, (int)player->variant}; return collision_run(*this, run, {player, LUA_CLASS_PLAYER}, collider, isLow); } // 00862760 Runs MC_PRE_PROJECTILE_COLLISION, filtered by the projectile's variant. LuaResult LuaEngine::PreProjectileCollision(Entity_Projectile* projectile, Entity* collider, bool isLow) { - CallbackRun run = {"PreProjectileCollision", MC_PRE_PROJECTILE_COLLISION, (int)projectile->_variant}; + CallbackRun run = {"PreProjectileCollision", MC_PRE_PROJECTILE_COLLISION, (int)projectile->variant}; return collision_run(*this, run, {projectile, LUA_CLASS_PROJECTILE}, collider, isLow); } // 00862d70 Runs MC_PRE_TEAR_COLLISION, filtered by the tear's variant. LuaResult LuaEngine::PreTearCollision(Entity_Tear* tear, Entity* collider, bool isLow) { - CallbackRun run = {"PreTearCollision", MC_PRE_TEAR_COLLISION, (int)tear->_variant}; + CallbackRun run = {"PreTearCollision", MC_PRE_TEAR_COLLISION, (int)tear->variant}; return collision_run(*this, run, {tear, LUA_CLASS_TEAR}, collider, isLow); } @@ -482,7 +490,7 @@ int LuaEngine::GetPillEffect(int pillEffect, int pillColor) // 00866140 Runs MC_POST_ENTITY_KILL, filtered by the entity's type. void LuaEngine::PostEntityKill(Entity* entity) { - callback_notify(*this, {"PostEntityKill", MC_POST_ENTITY_KILL, (int)entity->_type}, + callback_notify(*this, {"PostEntityKill", MC_POST_ENTITY_KILL, (int)entity->type}, LuaObject{entity, LUA_CLASS_ENTITY}); } @@ -495,14 +503,14 @@ void LuaEngine::PostGameStart(bool isContinued) // 00861890 Runs MC_POST_KNIFE_INIT, filtered by the knife's subtype. void LuaEngine::PostKnifeInit(Entity_Knife* knife) { - callback_notify(*this, {"PostKnifeInit", MC_POST_KNIFE_INIT, (int)knife->_subtype}, + callback_notify(*this, {"PostKnifeInit", MC_POST_KNIFE_INIT, (int)knife->subtype}, LuaObject{knife, LUA_CLASS_KNIFE}); } // 00864050 Runs MC_POST_PLAYER_INIT, filtered by the player's variant. void LuaEngine::PostPlayerInit(Entity_Player* player) { - callback_notify(*this, {"PostPlayerInit", MC_POST_PLAYER_INIT, (int)player->_variant}, + callback_notify(*this, {"PostPlayerInit", MC_POST_PLAYER_INIT, (int)player->variant}, LuaObject{player, LUA_CLASS_PLAYER}); } diff --git a/src/manager.cpp b/src/manager.cpp index a26934d..485fba7 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -1,8 +1,11 @@ #include "manager.h" #include "data.h" +#include "entity_player.h" #include "game.h" #include "lua_engine.h" #include "menu_manager.h" +#include "room.h" +#include "room_transition.h" #include "kage_input.h" #include "texture_cache.h" #include @@ -10,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1057,7 +1061,7 @@ static bool is_player_controller(int controllerId) { std::vector& players = g_game->playerManager.playerList; return std::ranges::any_of(players, [controllerId](Entity_Player* player) - { return player->_controllerIndex == controllerId; }); + { return player->controllerIndex == controllerId; }); } // The id of the last device used while the popup is open (anything held, or anything pressed when asking to choose @@ -1095,7 +1099,7 @@ void Manager::update_controller_popups() if (g_menuManager && g_menuControllerIndex != -1) controllers.push_back(g_menuControllerIndex); else if (!g_menuManager && g_game && g_game->fadeOutTarget == 0) - for (Entity_Player* player : g_game->playerManager.playerList) controllers.push_back(player->_controllerIndex); + for (Entity_Player* player : g_game->playerManager.playerList) controllers.push_back(player->controllerIndex); if (controllerDisconnectedPopupId != -1 && controllers.empty()) { @@ -1268,7 +1272,7 @@ void Manager::start_pending_game() else if (dailyChallenge._id != 0) reconstruction_missing("Game::StartDailyChallenge 006f6dd0, on the daily's character DailyChallenge holds as bytes"); else if (isDebugStart) reconstruction_missing("Game::StartDebug 006f7750"); - else reconstruction_missing("Game::Start 006f5320"); + else g_game->Start(startPlayerType, startChallenge, startSeeds, (Difficulty)startDifficulty); if ((int)framecount % 2 == 1) framecount++; isStarting = false; @@ -1276,6 +1280,53 @@ void Manager::start_pending_game() isPersistentDataWritable = false; } +// 00958ed0 Saves the run to the save slot's game state file, unless it is not in a run, is a daily or online, or its +// first player is dead for good: the run's state, character and modding, then the progress with its backup, which +// remembers the saved run's checksum. The rerun's file is deleted. +// Steam Cloud is offline, so the files are always the local ones. The file lock is left out: one game writes it. +void Manager::save_game_state() +{ + Manager& manager = *g_manager; + Game& game = *g_game; + + if (manager.state != MANAGER_STATE_GAME) + { + log_printf(LOG_INFO, "[warn] Cannot save game state while not in game.\n"); + return; + } + if (game.dailyChallenge._id != 0 || manager.netplayManager.is_online()) return; + Entity_Player& player = *game.GetPlayer(0); + if (player.isDead && player.GetExtraLives() < 1) return; + + manager.isSavingGameState = true; + game.store_game_state(manager.gamestate); + manager.gamestate.playerType = manager.startPlayerType; + manager.gamestate.isModded = manager.modManager.is_any_mod_loaded(); + + if (manager.gamestate.savePath.empty()) log_printf(LOG_INFO, "[warn] GameState::Save: no filename specified.\n"); + else + { + manager.gamestate.DeleteRerun(); + if (std::FILE* file = std::fopen(manager.gamestate.savePath.c_str(), "wb")) + { + std::vector bytes = manager.gamestate.write(); + std::fwrite(bytes.data(), 1, bytes.size(), file); + std::fclose(file); + } + } + + PersistentGameData& data = manager.persistentGameData; + data.gameStateChecksum = manager.gamestate.checksum; + data.isChangesMade = true; + if (data.isFileLoaded) + { + data.isChangesMade = false; + data.BackupSaveFile(); + data.Save(); + } + manager.isSavingGameState = false; +} + // Whether the cutscene or the nightmare the manager shows has ended. static bool is_scene_finished(Manager& manager) { @@ -1319,6 +1370,63 @@ static void cursor_update(Manager& manager) manager.lastMousePosition = position; } +constexpr float COOP_CAROUSEL_STEP = 0.25f; + +// Spins each co-op seat's join carousel a quarter step a frame toward its character, the short way round. +// The original looped forever without co-op characters to wrap by. Here those leave the turn unwrapped. +static void coop_carousels_update(PlayerManager& players) +{ + float count = (float)players.coopPlayerTypes.size(); + + for (CoopJoinSlot& slot : players.coopSlots) + { + if (slot.controllerIndex < 0) continue; + + float turn = (float)slot.state - slot.menuPosition; + while (count > 0 && turn >= count * 0.5f) turn -= count; + while (count > 0 && turn < -count * 0.5f) turn += count; + if (std::abs(turn) < COOP_CAROUSEL_STEP) slot.menuPosition = (float)slot.state; + else slot.menuPosition += turn <= 0 ? -COOP_CAROUSEL_STEP : COOP_CAROUSEL_STEP; + } +} + +// The run's part of a frame: its input unless a popup holds it, then, once the run has started, the game update on +// even frames (entities caught mid interpolation snapping back first) or the in-between update with interpolation on, +// the camera unless the run is paused (a minecart ride moves it anyway) and the co-op join carousels. +// The active camera follows its focus every frame, the other one only clears its override on odd frames. +static void run_update(Manager& manager) +{ + Game& game = *g_game; + bool isOddFrame = manager.framecount & 1; + + if (!manager.popupQueue.is_blocking()) Manager::update_ingame_input(); + if (manager.isStarting) return; + + if (!isOddFrame) + { + for (Entity* entity : game.room->entityList.updateEL) + if (entity->isInterpolating) + { + entity->pos = entity->preInterpolatePos; + entity->isInterpolating = false; + } + game.Update(); + } + else if (manager.optionsConfig.render.isInterpolationEnabled) + reconstruction_missing("Game::interpolate_update 006fd3f0"); + + Camera& camera = *game.room->camera; + bool isRiding = game.roomTransition.mode != TRANSITION_NONE && game.roomTransition.animation == TRANSITION_MINECART; + if (!game.IsPaused() || isRiding) + { + bool isFollowing = manager.optionsConfig.cameraStyle == CAMERA_STYLE_ACTIVE_CAM_OFF; + if (isFollowing) camera.update_follow(); + else camera.update_focus_position(isOddFrame); + if (!isFollowing || isOddFrame) camera.isShouldOverride = false; + } + coop_carousels_update(game.playerManager); +} + // 00954cd0 Runs one frame. The game updates every other frame: an odd frame only counts (unless the update is paused // without a frame step), or runs the in-between update when interpolation is on. Otherwise this starts the queued run, // menu, cutscene or nightmare, leaves a finished cutscene or nightmare, polls the input when asked, and updates the @@ -1389,7 +1497,8 @@ void Manager::Update(InputPoll poll) g_menuManager->Update(); break; case MANAGER_STATE_GAME: - reconstruction_missing("Manager::Update 00954cd0: the run's frame (input, Game::Update, camera, co-op)"); + run_update(manager); + break; case MANAGER_STATE_CUTSCENE: manager.cutsceneManager.Update(); break; @@ -1561,5 +1670,4 @@ Manager::~Manager() { reconstruction_missing("Manager::destructor 00951160"); } void Manager::update_ingame_input() { reconstruction_missing("Manager::update_ingame_input 006fa540"); } void Manager::render_button_sprite(int, Vector) { reconstruction_missing("Manager::render_button_sprite 0095ad30"); } void Manager::RestartGame() { reconstruction_missing("Manager::RestartGame 00958cb0"); } -void Manager::save_game_state() { reconstruction_missing("Manager::save_game_state 00958ed0"); } void Manager::apply_device_key_config(int) { reconstruction_missing("Manager::apply_device_key_config 0095b180"); } diff --git a/src/menu_bestiary.cpp b/src/menu_bestiary.cpp index 8333367..83d16ea 100644 --- a/src/menu_bestiary.cpp +++ b/src/menu_bestiary.cpp @@ -30,8 +30,6 @@ constexpr int NEXT_PAGE_LAYER = 8; constexpr int DIARY_BOSS_LAYER = 3; constexpr int DIARY_ENEMY_LAYER = 5; constexpr int UNKNOWN_FRAME = 152; -constexpr int ENTITY_URIEL = 271; -constexpr int ENTITY_GABRIEL = 272; constexpr int ANGEL_VARIANT_FALLEN = 1; constexpr int ENTITY_DOGMA = 950; constexpr unsigned int DOGMA_RENDER_FLAGS = ANIM_RENDER_STATIC | ANIM_RENDER_IGNORE_GAME_TIME; diff --git a/src/menu_options.cpp b/src/menu_options.cpp index bbc8858..0b00878 100644 --- a/src/menu_options.cpp +++ b/src/menu_options.cpp @@ -1,4 +1,5 @@ #include "menu_options.h" +#include "entity_player.h" #include "game.h" #include "kage_input.h" #include "log.h" @@ -154,7 +155,7 @@ static Entity_Player* pause_player_get() static void controller_release() { Entity_Player* player = pause_player_get(); - std::shared_ptr device = KAGE::Input::manager.device_find(player->_controllerIndex); + std::shared_ptr device = KAGE::Input::manager.device_find(player->controllerIndex); const ActionBinding* binding = device ? action_binding_get(*device, ACTION_MENU_CONFIRM) : nullptr; if (binding) @@ -338,7 +339,7 @@ void Menu_Options::Update() if ((g_manager->framecount & 1) == 0) optionsSprite.Update(); if (is_paused() && isScrolling) scroll_update(); - int device = is_paused() ? pause_player_get()->_controllerIndex : DEVICE_NONE; + int device = is_paused() ? pause_player_get()->controllerIndex : DEVICE_NONE; auto isPressed = [device](ButtonAction action) { return is_device_action(device, action, ACTION_PRESSED); }; diff --git a/src/minimap.cpp b/src/minimap.cpp index c18a2d2..db60fec 100644 --- a/src/minimap.cpp +++ b/src/minimap.cpp @@ -1,4 +1,5 @@ #include "minimap.h" +#include "entity_player.h" #include "game.h" #include "hud.h" #include "level.h" @@ -6,6 +7,7 @@ #include "manager.h" #include "menu_manager.h" #include "menu_options.h" +#include "room.h" #include #include #include @@ -77,14 +79,9 @@ constexpr int ICON_BLUE_MAP = 1; constexpr int ICON_TREASURE_MAP = 2; constexpr int ICON_RESTOCK = 4; constexpr int ICON_MIND = 5; -constexpr int COLLECTIBLE_COMPASS = 21; -constexpr int COLLECTIBLE_TREASURE_MAP = 54; -constexpr int COLLECTIBLE_BLUE_MAP = 246; -constexpr int COLLECTIBLE_MIND = 333; constexpr int COLLECTIBLE_RESTOCK = 376; constexpr int STAGE_HOME = 35; -constexpr int ROOM_DUNGEON = 16; constexpr int CHALLENGE_SPEED = 22; constexpr int SPEED_TIME_LIMIT = 28800; constexpr int FRAMES_PER_SECOND = 30; @@ -208,7 +205,7 @@ void Minimap::Update() if (players.empty()) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)NO_PLAYERS); bool isHeld = std::ranges::any_of(players, [](Entity_Player* player) { - return is_controller_action(player->_controllerIndex, ACTION_MAP, ACTION_PRESSED); + return is_controller_action(player->controllerIndex, ACTION_MAP, ACTION_PRESSED); }); if (isHeld && ++holdTime == SHOW_NAME_FRAMES) g_game->ShowName(true); @@ -290,7 +287,7 @@ void Minimap::Render() bool isLost = curses_get() & CURSE_OF_THE_LOST; float hudAlpha = game.roomTransition.get_hud_alpha(); - const RoomConfig_Room* room = game.room->_descriptor->Data; + const RoomConfig_Room* room = game.room->descriptor->data; if (room && room->type == ROOM_DUNGEON && room->stageId == STAGE_HOME) { if (game.dailyChallenge._id != 0) render_score_time(1); @@ -456,7 +453,7 @@ void Minimap::render_score_time(float alpha) left += shift; Entity_Player* player = game.GetPlayer(0); float lives = player->GetExtraLives() > 0 ? EXTRA_LIVES_WIDTH : 0; - float hearts = (float)(player->GetEffectiveMaxHearts() + player->_soulHearts) * HEART_WIDTH; + float hearts = (float)(player->GetEffectiveMaxHearts() + player->soulHearts) * HEART_WIDTH; float heartsRight = std::min(hearts, HEARTS_WIDTH_MAX) + HEARTS_MARGIN - inset * HEARTS_INSET + lives; bool isUnknown = g_game->GetCurses() & CURSE_OF_THE_UNKNOWN; if (heartsRight >= left && !isUnknown) textY += TEXT_DROP - (1 - inset) * TEXT_DROP_INSET; diff --git a/src/mod_manager.cpp b/src/mod_manager.cpp index 828b409..55e4f77 100644 --- a/src/mod_manager.cpp +++ b/src/mod_manager.cpp @@ -27,6 +27,8 @@ constexpr const char* BOSS_POOLS_FILE = "bosspools.xml"; constexpr const char* CURSES_FILE = "curses.xml"; constexpr const char* ITEM_POOLS_FILE = "itempools.xml"; constexpr const char* SHADERS_FILE = "shaders.xml"; +constexpr const char* STB_EXTENSION = "stb"; +constexpr size_t XML_EXTENSION_LENGTH = 3; constexpr const char* DEFAULT_VERSION = "1.0"; constexpr const char* DOCUMENT_TAG = "#document"; @@ -84,12 +86,6 @@ constexpr MetadataField METADATA_FIELDS[] = { // What reads a file of a mod's content folder, given its path and the mod. using ContentLoad = void (*)(std::string& path, ModEntry& mod); -// The game's declarations take paths as bytes. -static uint8_t* text_get(std::string& text) -{ - return (uint8_t*)text.data(); -} - // A file of a mod's content folder LoadModContent reads, and its loader. struct ModContentFile { @@ -499,7 +495,7 @@ void ModManager::LoadModBossPools() { if (!g_game) return; loaded_mods_load(*this, BOSS_POOLS_FILE, - [](std::string& path, ModEntry&) { BossPool::load_xml(text_get(path), true); }); + [](std::string& path, ModEntry&) { g_game->bossPool.load_xml(path, BOSS_POOL_MOD); }); } // 008f86c0 Adds each loaded mod's curses.xml to the game's room config, once a game exists. @@ -510,10 +506,30 @@ void ModManager::LoadModCurses() [](std::string& path, ModEntry&) { g_game->roomConfig.LoadCurses(path, CURSES_APPEND); }); } -// Merging a mod's .stb rooms into a stage is RoomConfig_Stage::mod_rooms_merge, which this is not written on yet. -void ModManager::LoadModRooms(int, int) +// 008f8040 Adds each loaded mod's .stb for a stage's room set (the set's file, its extension made "stb", in the mod's +// content folder) after the set's rooms, once a game exists. A mod's file with a bad header stops the mods after it. +void ModManager::LoadModRooms(int stageId, int mode) { - reconstruction_missing("ModManager::LoadModRooms 008f8040"); + if (!g_game) return; + for (auto& mod : mods) + { + if (!mod->isLoaded) continue; + + RoomConfig_Stage& stage = g_game->roomConfig.stages[stageId]; + RoomSet& set = stage.rooms[mode]; + std::string_view base = set.filePath; + + base.remove_suffix(std::min(base.size(), XML_EXTENSION_LENGTH)); + + std::string path = mod->GetContentPath(std::string(base) + STB_EXTENSION); + + log_printf(LOG_INFO, "[ModManager] load stage %d: %s (mode %d)\n", stageId, + stage.GetDisplayName(LANGUAGE_CURRENT).c_str(), mode); + if (!is_resource_found(path)) continue; + if (set.mod_rooms_merge(path, stageId, (RoomMode)mode)) continue; + log_printf(LOG_INFO, "[ModManager] bad room config header in %s!\n", path.c_str()); + return; + } } // 008f4a30 Reads and loads the shaders of each loaded mod's shaders.xml. diff --git a/src/music_manager.cpp b/src/music_manager.cpp index ef26517..d0763cf 100644 --- a/src/music_manager.cpp +++ b/src/music_manager.cpp @@ -2,6 +2,7 @@ #include "data.h" #include "game.h" #include "manager.h" +#include "room.h" #include #include #include @@ -360,7 +361,7 @@ bool MusicManager::pitch_effects_apply() pitch = pitch_wobble(pitch, frame * DIZZY_WOBBLE_SPEED, g_game->dizzyIntensity * DIZZY_WOBBLE_DEPTH); isChanged = true; } - if (g_game->room->_descriptor->Flags & ROOM_FLAG_RED_ROOM) + if (g_game->room->descriptor->flags & ROOM_FLAG_RED_ROOM) { pitch = pitch_wobble(pitch, frame * RED_ROOM_WOBBLE_SPEED, RED_ROOM_WOBBLE_DEPTH); isChanged = true; diff --git a/src/pause_screen.cpp b/src/pause_screen.cpp index 72bea8e..4261450 100644 --- a/src/pause_screen.cpp +++ b/src/pause_screen.cpp @@ -1,4 +1,6 @@ #include "pause_screen.h" +#include "entity_pickup.h" +#include "entity_player.h" #include "game.h" #include "hud.h" #include "kage_input.h" @@ -6,6 +8,7 @@ #include "manager.h" #include "menu_manager.h" #include "platform.h" +#include "room.h" #include constexpr const char* PAUSE_ANM2 = "gfx/ui/PauseScreen_small.anm2"; @@ -52,7 +55,6 @@ constexpr float FADE_SPEED = 0.08f; constexpr int FADE_TARGET_MENU = 2; constexpr int KEYBOARD = 0; constexpr int COLLECTIBLE_GLITCHED_CROWN = 689; -constexpr unsigned int ENTITY_PICKUP = 5; constexpr unsigned int PICKUP_COLLECTIBLE = 100; // Whether an action holds on one device, as KAGE's input manager asks. @@ -78,7 +80,7 @@ static void layer_show(ANM2& sprite, std::string_view name, bool isVisible) } // Plays a pause screen sound at its volume, unless the seeds swap it for a fart. -static void sound_play(int sound) +static void menu_sound_play(int sound) { SoundPlay play; play.volume = SOUND_VOLUME; @@ -203,8 +205,8 @@ void PauseScreen::Show() state = PAUSE_MENU; selectedElement = PAUSE_ITEM_RESUME; menuSprite.Play(ANIMATION_APPEAR, PLAY_FORCED); - completionWidget.characterId = g_game->GetPlayer(playerIdx)->_playerType; - sound_play(SOUND_PAPER_IN); + completionWidget.characterId = g_game->GetPlayer(playerIdx)->playerType; + menu_sound_play(SOUND_PAPER_IN); layer_show(menuSprite, LAYER_INVITE, false); layer_show(menuSprite, LAYER_KICK, false); @@ -216,7 +218,7 @@ void PauseScreen::hide() { if (state == PAUSE_HIDDEN || menuSprite.GetAnimation() == ANIMATION_DISAPPEAR) return; - sound_play(SOUND_PAPER_OUT); + menu_sound_play(SOUND_PAPER_OUT); menuSprite.Play(ANIMATION_DISAPPEAR); menuSprite.overlayAnimState.SetAnimationData(nullptr); } @@ -230,7 +232,7 @@ bool PauseScreen::is_pausing() // The paused player's controller. Netplay is offline, so it is always a local player's. int PauseScreen::controller_get() { - return g_game->GetPlayer(playerIdx)->_controllerIndex; + return g_game->GetPlayer(playerIdx)->controllerIndex; } // 009b5d20 Steps the open page, opens the menu on pause (or back on the keyboard, while no emote menu is up), runs the @@ -334,7 +336,7 @@ void PauseScreen::selection_confirm(int controller) menuSprite.overlayAnimState.SetAnimationData(nullptr); Entity_Player* player = g_game->GetPlayer(0); - if (player->_dead && player->GetExtraLives() < 1) + if (player->isDead && player->GetExtraLives() < 1) reconstruction_missing("Game::DeleteSaveState 00959130: GameState::Delete on Manager's game state"); game_fade_out(); break; @@ -349,15 +351,13 @@ void PauseScreen::selection_confirm(int controller) void PauseScreen::animation_update() { Game& game = *g_game; - if (state == PAUSE_HIDDEN || (game.roomTransition._mode != 0 && game.roomTransition._bossIntroBossId != 0)) return; + if (state == PAUSE_HIDDEN || (game.roomTransition.mode != 0 && game.roomTransition.bossIntroBossId != 0)) return; if (game.playerManager.FirstCollectibleOwner(COLLECTIBLE_GLITCHED_CROWN, LAZARUS_SHARE_CHECK)) { - EntityList_EL& entities = reinterpret_cast(game.room->_entityList)->_updateEL; - for (uint32_t i = 0; i < entities._size; i++) + for (Entity* entity : game.room->entityList.updateEL) { - Entity* entity = entities._data[i]; - if (entity->_type == ENTITY_PICKUP && entity->_variant == PICKUP_COLLECTIBLE) + if (entity->type == ENTITY_PICKUP && entity->variant == PICKUP_COLLECTIBLE) static_cast(entity)->update_cycle_collectible(0); } } @@ -384,7 +384,7 @@ void PauseScreen::animation_update() void PauseScreen::Render() { Game& game = *g_game; - if (game.roomTransition._mode != 0 && game.roomTransition._bossIntroBossId != 0) return; + if (game.roomTransition.mode != 0 && game.roomTransition.bossIntroBossId != 0) return; layer_show(menuSprite, LAYER_MENU_TITLE, false); layer_show(menuSprite, LAYER_SEED_PAPER, game.dailyChallenge._id == 0); diff --git a/src/player_manager.cpp b/src/player_manager.cpp index ff2940f..99ff4ce 100644 --- a/src/player_manager.cpp +++ b/src/player_manager.cpp @@ -1,28 +1,23 @@ #include "player_manager.h" +#include "entity_familiar.h" +#include "entity_player.h" #include "game.h" #include "item_config.h" #include "log.h" #include "manager.h" #include "platform.h" #include "popups.h" +#include "room.h" #include "seeds.h" #include -#include -#include -constexpr int ENTITY_PLAYER = 1; -constexpr int ENTITY_FAMILIAR = 3; -constexpr unsigned int PLAYER_VARIANT_PLAYER = 0; -constexpr unsigned int PLAYER_VARIANT_COOP_BABY = 1; -constexpr unsigned int PLAYER_VARIANT_EXTRA = 2; +constexpr int FAMILIAR_BLOOD_OATH = 203; +constexpr int FAMILIAR_PASCHAL_CANDLE = 221; // The player types init_main_player and SpawnCoPlayer2 take for no player and for an extra player outside the room. constexpr int PLAYER_TYPE_NONE = -2; constexpr int PLAYER_TYPE_EXTRA = -1; constexpr int COOP_CHARACTER_RANDOM = -1; -constexpr int PLAYER_BLUEBABY_B = 25; -constexpr int PLAYER_EDEN = 9; -constexpr int PLAYER_EDEN_B = 30; constexpr int PLAYER_MODDED_FIRST = 41; constexpr size_t MAX_PLAYERS = 64; constexpr float PLAYER_START_X = 320; @@ -31,10 +26,8 @@ constexpr int HOURGLASS_INDEX_LAST = 3; // The babies of babies.xml the game ships (those past them are a random pick's extras) and the glitched one. constexpr int BABY_COUNT = 71; -constexpr int BABY_GLITCH = 25; constexpr uint32_t BABY_RANDOM_PICK_MASK = 3; -constexpr int COLLECTIBLE_BIRTHRIGHT = 619; constexpr int EVENT_EDEN_TOKENS = 21; constexpr int PLAYERFORM_LORD_OF_THE_FLIES = 1; constexpr int TRANSFORMATION_ITEMS = 3; @@ -60,27 +53,17 @@ constexpr uint32_t PLAYER_COLORS[][COOP_SLOT_COUNT] = { }; constexpr uint32_t PLAYER_COLOR_INVALID = 0xffff00ff; -// The entity an EntityPtr member of a generated entity points to. -// The generated layouts keep the original 4-byte slot until Entity_Player is taken over. -static Entity_Player* entity_ptr_get(const uint8_t* slot) -{ - EntityPtr pointer; - - std::memcpy(&pointer, slot, sizeof(pointer)); - return pointer; -} - // Whether a player leads its pair of twins (Jacob over Esau), as one with no twin does. static bool is_main_twin(Entity_Player& player) { - Entity_Player* twin = entity_ptr_get(player._twinPlayer); - return !twin || twin->_playerIndex == -1 || player._playerIndex <= twin->_playerIndex; + Entity_Player* twin = player.twin_get(); + return !twin || twin->playerIndex == -1 || player.playerIndex <= twin->playerIndex; } // Whether a player counts as one of the run's players: a real one, not owned by another, leading its twins. static bool is_counted_player(Entity_Player& player) { - return player._variant == PLAYER_VARIANT_PLAYER && !entity_ptr_get(player._parent) && is_main_twin(player); + return player.variant == PLAYER_VARIANT_PLAYER && !player.parent && is_main_twin(player); } // Whether a run holds the most players it can, which it logs. @@ -99,8 +82,7 @@ static Entity_Player* player_create(size_t index) { Entity_Player* player = new Entity_Player(); - player->constructor(); - player->_playerIndex = (int)index; + player->playerIndex = (int)index; return player; } @@ -109,29 +91,10 @@ static void room_player_add(Entity_Player* player) { Room& room = *g_game->room; - player->_index = room._entityIndexCounter++; + player->index = room.entityIndexCounter++; room.GetEntities()->AddEntity(player); } -// The player's generator for a collectible: the first for a negative id, the last past the end. -static RNG* collectible_rng_get(Entity_Player& player, int collectibleId) -{ - std::span rngs((RNG*)player._collectibleRNGs._begin, (RNG*)player._collectibleRNGs._end); - - if (collectibleId < 0) return rngs.data(); - if (collectibleId >= (int)rngs.size()) log_printf(LOG_ASSERT, "Collectible ID out of bounds!\n"); - return rngs.data() + std::min((size_t)collectibleId, rngs.size() - 1); -} - -// The player's generator for a trinket, the last for an id out of range. -static RNG* trinket_rng_get(Entity_Player& player, int trinketId) -{ - std::span rngs((RNG*)player._trinketRNGs._begin, (RNG*)player._trinketRNGs._end); - - if (trinketId < 0 || trinketId >= (int)rngs.size()) log_printf(LOG_ASSERT, "Trinket ID out of bounds!\n"); - return rngs.data() + std::min((size_t)(uint32_t)trinketId, rngs.size() - 1); -} - // The player with the highest roll, one roll drawn from seed for each player picked, or null. template static Entity_Player* player_roll(std::vector& players, uint32_t seed, Picked isPicked) @@ -173,13 +136,13 @@ void PlayerManager::init_main_player(int playerType, uint32_t seed) if (playerList.empty()) { playerList.push_back(player_create(playerList.size())); - playerList.back()->_glowingHourglassIndex = 0; + playerList.back()->glowingHourglassIndex = 0; } Entity_Player* player = playerList.front(); player->Init(ENTITY_PLAYER, PLAYER_VARIANT_PLAYER, playerType, seed); - player->_pos = vector_make(PLAYER_START_X, PLAYER_START_Y); - if (!player->_valid) room_player_add(player); + player->pos = vector_make(PLAYER_START_X, PLAYER_START_Y); + if (!player->isValid) room_player_add(player); } coop_slots_reset(); @@ -242,8 +205,8 @@ Entity_Player* PlayerManager::SpawnCoPlayer2(int playerType) if (!playerList.empty()) { int highest = -1; - for (Entity_Player* other : playerList) highest = std::max(highest, other->_glowingHourglassIndex); - if ((uint32_t)highest < HOURGLASS_INDEX_LAST) player->_glowingHourglassIndex = highest + 1; + for (Entity_Player* other : playerList) highest = std::max(highest, other->glowingHourglassIndex); + if ((uint32_t)highest < HOURGLASS_INDEX_LAST) player->glowingHourglassIndex = highest + 1; } playerList.push_back(player); player->Init(ENTITY_PLAYER, PLAYER_VARIANT_PLAYER, playerType, rng.Next()); @@ -299,21 +262,21 @@ void PlayerManager::ReviveCoopPlayer(uint32_t index) } Entity_Player* player = playerList[index]; - if (!player->_isCoopGhost) return; + if (!player->isCoopGhost) return; player->RevivePlayerGhost(); player = playerList[index]; - Entity_Player* twin = entity_ptr_get(player->_twinPlayer); + Entity_Player* twin = player->twin_get(); Entity_Player* mainTwin = is_main_twin(*player) ? player : twin; - if (mainTwin->_isCoopGhost) player->GetMainTwin()->RevivePlayerGhost(); - if (twin && twin->_isCoopGhost) twin->RevivePlayerGhost(); + if (mainTwin->isCoopGhost) player->GetMainTwin()->RevivePlayerGhost(); + if (twin && twin->isCoopGhost) twin->RevivePlayerGhost(); } // 009bfae0 Revives every co-op ghost. void PlayerManager::revive_player_ghosts() { for (size_t i = 0; i < playerList.size(); i++) - if (playerList[i]->_isCoopGhost) playerList[i]->RevivePlayerGhost(); + if (playerList[i]->isCoopGhost) playerList[i]->RevivePlayerGhost(); } // 009b92c0 A player by its place in the list, the first past the end. @@ -359,14 +322,14 @@ bool PlayerManager::IsCoopPlay() int PlayerManager::GetNumAlivePlayers() { return (int)std::ranges::count_if(playerList, [](Entity_Player* player) - { return is_counted_player(*player) && !player->_isCoopGhost; }); + { return is_counted_player(*player) && !player->isCoopGhost; }); } // 009bfa70 How many of the run's players are co-op ghosts. int PlayerManager::GetNumCoopPlayers() { return (int)std::ranges::count_if(playerList, [](Entity_Player* player) - { return is_counted_player(*player) && player->_isCoopGhost; }); + { return is_counted_player(*player) && player->isCoopGhost; }); } // 009ba980 Whether co-op joins as babies only, as a challenge or a mode sets. @@ -380,8 +343,8 @@ bool PlayerManager::are_all_players_tainted_blue_baby() { return std::ranges::none_of(playerList, [](Entity_Player* player) { - return player->_variant == PLAYER_VARIANT_PLAYER && !player->_isCoopGhost && - player->_playerType != PLAYER_BLUEBABY_B; + return player->variant == PLAYER_VARIANT_PLAYER && !player->isCoopGhost && + player->playerType != PLAYER_BLUEBABY_B; }); } @@ -389,7 +352,7 @@ bool PlayerManager::are_all_players_tainted_blue_baby() Entity_Player* PlayerManager::FirstPlayerByType(int playerType) { for (Entity_Player* player : playerList) - if (player->_variant == PLAYER_VARIANT_PLAYER && !player->_isCoopGhost && player->_playerType == playerType) + if (player->variant == PLAYER_VARIANT_PLAYER && !player->isCoopGhost && player->playerType == playerType) return player; return nullptr; } @@ -398,8 +361,8 @@ Entity_Player* PlayerManager::FirstPlayerByType(int playerType) Entity_Player* PlayerManager::FirstBirthrightOwner(int playerType) { for (Entity_Player* player : playerList) - if (player->_variant == PLAYER_VARIANT_PLAYER && player->_playerType == playerType && - player->HasCollectible(COLLECTIBLE_BIRTHRIGHT, 0)) + if (player->variant == PLAYER_VARIANT_PLAYER && player->playerType == playerType && + player->HasCollectible(COLLECTIBLE_BIRTHRIGHT)) return player; return nullptr; } @@ -413,15 +376,30 @@ Entity_Player* PlayerManager::FirstCollectibleOwner(int collectibleId, LazarusSh for (Entity_Player* player : playerList) { - if (player->_variant != PLAYER_VARIANT_PLAYER) continue; - if (player->HasCollectible(collectibleId, 0)) return player; + if (player->variant != PLAYER_VARIANT_PLAYER) continue; + if (player->HasCollectible(collectibleId)) return player; - Entity_Player* backup = player->_backupPlayer; - if (isShared && backup && backup->HasCollectible(collectibleId, 0)) return backup; + Entity_Player* backup = player->backupPlayer; + if (isShared && backup && backup->HasCollectible(collectibleId)) return backup; } return nullptr; } +// 009be6b0 The first player whose trinket multiplier for a trinket is positive, or one of them holding Mom's Box. +// The original's override at player+0x2ef8 is only ever written by the constructor, so it is gone. +Entity_Player* PlayerManager::FirstTrinketOwner(int trinketId) +{ + Entity_Player* firstOwner = nullptr; + + for (Entity_Player* player : playerList) + { + if (player->GetTrinketMultiplier(trinketId) <= 0) continue; + if (player->HasCollectible(COLLECTIBLE_MOMS_BOX)) return player; + if (!firstOwner) firstOwner = player; + } + return firstOwner; +} + // 009be2a0 The first real player holding a trinket, or the dead Lazarus kept as its backup for a trinket shared // globally when asked, with the owner's generator for it. Entity_Player* PlayerManager::FirstTrinketOwner(int trinketId, RNG** outRng, LazarusShare share) @@ -430,16 +408,16 @@ Entity_Player* PlayerManager::FirstTrinketOwner(int trinketId, RNG** outRng, Laz for (Entity_Player* player : playerList) { - if (player->_variant != PLAYER_VARIANT_PLAYER) continue; - if (player->HasTrinket(trinketId, 0)) + if (player->variant != PLAYER_VARIANT_PLAYER) continue; + if (player->HasTrinket(trinketId)) { - if (outRng) *outRng = trinket_rng_get(*player, trinketId); + if (outRng) *outRng = &player->GetTrinketRNG(trinketId); return player; } - Entity_Player* backup = player->_backupPlayer; - if (!isShared || !backup || !backup->HasTrinket(trinketId, 0)) continue; - if (outRng) *outRng = backup->GetTrinketRNG(trinketId); + Entity_Player* backup = player->backupPlayer; + if (!isShared || !backup || !backup->HasTrinket(trinketId)) continue; + if (outRng) *outRng = &backup->GetTrinketRNG(trinketId); return backup; } if (outRng) *outRng = nullptr; @@ -450,10 +428,10 @@ Entity_Player* PlayerManager::FirstTrinketOwner(int trinketId, RNG** outRng, Laz Entity_Player* PlayerManager::RandomCollectibleOwner(int collectibleId, uint32_t seed, RNG** outRng) { Entity_Player* owner = player_roll(playerList, seed, [collectibleId](Entity_Player& player) - { return player._variant == PLAYER_VARIANT_PLAYER && - player.HasCollectible(collectibleId, 0); }); + { return player.variant == PLAYER_VARIANT_PLAYER && + player.HasCollectible(collectibleId); }); - if (outRng) *outRng = owner ? collectible_rng_get(*owner, collectibleId) : nullptr; + if (outRng) *outRng = owner ? &owner->GetCollectibleRNG(collectibleId) : nullptr; return owner; } @@ -461,10 +439,10 @@ Entity_Player* PlayerManager::RandomCollectibleOwner(int collectibleId, uint32_t Entity_Player* PlayerManager::RandomTrinketOwner(int trinketId, uint32_t seed, RNG** outRng) { Entity_Player* owner = player_roll(playerList, seed, [trinketId](Entity_Player& player) - { return player._variant == PLAYER_VARIANT_PLAYER && - player.HasTrinket(trinketId, 0); }); + { return player.variant == PLAYER_VARIANT_PLAYER && + player.HasTrinket(trinketId); }); - if (outRng) *outRng = owner ? trinket_rng_get(*owner, trinketId) : nullptr; + if (outRng) *outRng = owner ? &owner->GetTrinketRNG(trinketId) : nullptr; return owner; } @@ -473,9 +451,9 @@ Entity_Player* PlayerManager::GetRandomPlayer(uint32_t seed) { return player_roll(playerList, seed, [](Entity_Player& player) { - return player._variant == PLAYER_VARIANT_PLAYER && !player._hasCurseMistEffect && - !player._isCoopGhost && - player._playerForms[PLAYERFORM_LORD_OF_THE_FLIES] >= TRANSFORMATION_ITEMS; + return player.variant == PLAYER_VARIANT_PLAYER && !player.hasCurseMistEffect && + !player.isCoopGhost && + player.playerForms[PLAYERFORM_LORD_OF_THE_FLIES] >= TRANSFORMATION_ITEMS; }); } @@ -499,9 +477,9 @@ int PlayerManager::GetNumCollectibles(int collectibleId) for (Entity_Player* player : playerList) { - if (player->_variant != PLAYER_VARIANT_PLAYER) continue; - total += player->GetCollectibleNum(collectibleId, 0); - if (isShared && player->_backupPlayer) total += player->_backupPlayer->GetCollectibleNum(collectibleId, 0); + if (player->variant != PLAYER_VARIANT_PLAYER) continue; + total += player->GetCollectibleNum(collectibleId); + if (isShared && player->backupPlayer) total += player->backupPlayer->GetCollectibleNum(collectibleId); } return total; } @@ -514,9 +492,9 @@ int PlayerManager::GetTrinketMultiplier(int trinketId) for (Entity_Player* player : playerList) { - if (player->_variant != PLAYER_VARIANT_PLAYER) continue; + if (player->variant != PLAYER_VARIANT_PLAYER) continue; total += player->GetTrinketMultiplier(trinketId); - if (isShared && player->_backupPlayer) total += player->_backupPlayer->GetTrinketMultiplier(trinketId); + if (isShared && player->backupPlayer) total += player->backupPlayer->GetTrinketMultiplier(trinketId); } return total; } @@ -528,8 +506,8 @@ int PlayerManager::GetGFuelCount() if (!g_game->seedEffects.HasSeedEffect(SEED_G_FUEL)) return 0; for (Entity_Player* player : playerList) - if (player->_variant == PLAYER_VARIANT_PLAYER && !entity_ptr_get(player->_parent)) - total += is_achievement_79_unlocked(player); + if (player->variant == PLAYER_VARIANT_PLAYER && !player->parent) + total += player->g_fuel_count(); return total; } @@ -538,11 +516,10 @@ bool PlayerManager::HasTemporaryEffect(ItemConfig_Item* item) { for (Entity_Player* player : playerList) { - TemporaryEffects& effects = player->_temporaryeffects; - if (player->_variant != PLAYER_VARIANT_PLAYER || effects._disabled) continue; - - std::span list((TemporaryEffect*)effects._effects._begin, (TemporaryEffect*)effects._effects._end); - if (std::ranges::any_of(list, [item](TemporaryEffect& effect) { return effect._item == item; })) return true; + TemporaryEffects& effects = player->temporaryEffects; + if (player->variant != PLAYER_VARIANT_PLAYER || effects.isDisabled) continue; + if (std::ranges::any_of(effects.effects, [item](TemporaryEffect& effect) { return effect.item == item; })) + return true; } return false; } @@ -553,7 +530,7 @@ float PlayerManager::get_total_luck() float total = 0; for (Entity_Player* player : playerList) - if (player->_variant == PLAYER_VARIANT_PLAYER && !player->_isCoopGhost) total += player->_luck; + if (player->variant == PLAYER_VARIANT_PLAYER && !player->isCoopGhost) total += player->luck; return total; } @@ -566,9 +543,9 @@ bool PlayerManager::check_full_health(HealthCheck check) for (Entity_Player* player : playerList) { - if (player->_variant != PLAYER_VARIANT_PLAYER || player->_isCoopGhost) continue; + if (player->variant != PLAYER_VARIANT_PLAYER || player->isCoopGhost) continue; - bool isFull = player->_soulHearts + player->_redHearts >= player->_maxHearts || player->HasInstantDeathCurse(); + bool isFull = player->soulHearts + player->redHearts >= player->maxHearts || player->HasInstantDeathCurse(); result = isAll ? result && isFull : result || isFull; } return result; @@ -651,12 +628,26 @@ void PlayerManager::trigger_level_start() { for (size_t i = 0; i < playerList.size(); i++) playerList[i]->level_start(0); - EntityList_EL& entities = g_game->room->GetEntities()->_updateEL; - for (Entity* entity : std::span(entities._data, entities._size)) - if (entity && entity->_type == ENTITY_FAMILIAR) static_cast(entity)->level_start(); + for (Entity* entity : g_game->room->GetEntities()->updateEL) + if (entity && entity->type == ENTITY_FAMILIAR) static_cast(entity)->level_start(); g_game->rewindsThisFloor = 0; } +// 009bc000 Starts every player's temporary effects over for a new room, then the new room effects of the room's +// familiars, which only Blood Oath and Paschal Candle have. +// The original asks the room's entity list for its familiars (QuerySublist 0041af60). They are its update list's. +void PlayerManager::trigger_new_room_effects() +{ + for (size_t i = 0; i < playerList.size(); i++) playerList[i]->TriggerNewRoom_TemporaryEffects(); + + for (Entity* entity : g_game->room->GetEntities()->updateEL) + { + bool isFamiliar = entity && entity->type == ENTITY_FAMILIAR; + if (isFamiliar && (entity->variant == FAMILIAR_BLOOD_OATH || entity->variant == FAMILIAR_PASCHAL_CANDLE)) + reconstruction_missing("FUN_0062c8a0, the new room effects of Blood Oath and Paschal Candle"); + } +} + void PlayerManager::RemoveCoPlayer(Entity_Player*) { reconstruction_missing("PlayerManager::RemoveCoPlayer 009ba000"); } bool PlayerManager::replace_player(Entity_Player*, Entity_Player*) { @@ -666,10 +657,6 @@ Entity_Player* PlayerManager::get_player_by_user_id(uint64_t) { reconstruction_missing("PlayerManager::get_player_by_user_id 0090abf0"); } -Entity_Player* PlayerManager::FirstTrinketOwner(int) -{ - reconstruction_missing("PlayerManager::FirstTrinketOwner 009be6b0"); -} void PlayerManager::add_lost_curse(int) { reconstruction_missing("PlayerManager::add_lost_curse 009be850"); } void PlayerManager::restore_controller_assignment() { @@ -683,10 +670,6 @@ void PlayerManager::spawn_coop_baby_for_join(int) void PlayerManager::Update() { reconstruction_missing("PlayerManager::Update 009bb5d0"); } void PlayerManager::trigger_room_clear() { reconstruction_missing("PlayerManager::trigger_room_clear 009bb840"); } void PlayerManager::enter_level() { reconstruction_missing("PlayerManager::enter_level 009bba30"); } -void PlayerManager::trigger_new_room_effects() -{ - reconstruction_missing("PlayerManager::trigger_new_room_effects 009bc000"); -} void PlayerManager::trigger_coop_baby_death(Entity_Player*) { reconstruction_missing("PlayerManager::trigger_coop_baby_death 009bc120"); diff --git a/src/popups.cpp b/src/popups.cpp index 7b5f920..b6a013f 100644 --- a/src/popups.cpp +++ b/src/popups.cpp @@ -1,5 +1,6 @@ #include "popups.h" #include "data.h" +#include "entity_player.h" #include "game.h" #include "kage_input.h" #include "manager.h" @@ -703,7 +704,7 @@ int active_controller_get() case MANAGER_STATE_CUTSCENE: case MANAGER_STATE_NIGHTMARE: if (g_game && !g_game->playerManager.playerList.empty()) - return g_game->playerManager.GetPlayer(0)->_controllerIndex; + return g_game->playerManager.GetPlayer(0)->controllerIndex; return -1; default: return -1; } diff --git a/src/revive_player_menu.cpp b/src/revive_player_menu.cpp index 5f60047..f366ba7 100644 --- a/src/revive_player_menu.cpp +++ b/src/revive_player_menu.cpp @@ -1,4 +1,5 @@ #include "revive_player_menu.h" +#include "entity_player.h" #include "game.h" #include "kage_input.h" #include "log.h" @@ -43,7 +44,7 @@ static bool is_device_triggered(int deviceId, ButtonAction action) static Entity_Player* player_by_controller(int controller) { for (Entity_Player* player : g_game->playerManager.playerList) - if (player->_controllerIndex == controller) return player; + if (player->controllerIndex == controller) return player; return nullptr; } @@ -88,7 +89,7 @@ void RevivePlayerMenu::selection_move(int jump, int skipStep) }; if (jump != 0) selectedPlayer = wrap(selectedPlayer + jump); - for (Entity_Player* player = players.get_main_player(selectedPlayer); player && !player->_isCoopGhost; + for (Entity_Player* player = players.get_main_player(selectedPlayer); player && !player->isCoopGhost; player = players.get_main_player(selectedPlayer)) selectedPlayer = wrap(selectedPlayer + skipStep); } diff --git a/src/room.cpp b/src/room.cpp new file mode 100644 index 0000000..b69f5d3 --- /dev/null +++ b/src/room.cpp @@ -0,0 +1,2094 @@ +#include "room.h" +#include "entity_pickup.h" +#include "entity_player.h" +#include "game.h" +#include "log.h" +#include "lua_engine.h" +#include "manager.h" +#include "seeds.h" +#include "texture_cache.h" +#include +#include + +extern "C" +{ +#include "lua.h" +} + +// The grid a room's shape lays out (REPENTOGON's LRoomTileDesc table at 00c35b80): each shape's first and second +// rectangle of floor cells, top left included and bottom right excluded. Only the L shapes' rectangles differ. +struct ShapeTiles +{ + int topLeftAX; + int topLeftAY; + int bottomRightAX; + int bottomRightAY; + int topLeftBX; + int topLeftBY; + int bottomRightBX; + int bottomRightBY; +}; + +constexpr ShapeTiles SHAPE_TILES[ROOMSHAPE_ANY] = { + {1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 13, 7, 1, 1, 13, 7}, {1, 3, 13, 5, 1, 3, 13, 5}, + {5, 1, 9, 7, 5, 1, 9, 7}, {1, 1, 13, 14, 1, 1, 13, 14}, {5, 1, 9, 14, 5, 1, 9, 14}, + {1, 1, 26, 7, 1, 1, 26, 7}, {1, 3, 26, 5, 1, 3, 26, 5}, {1, 1, 26, 14, 1, 1, 26, 14}, + {14, 1, 26, 7, 1, 8, 26, 14}, {1, 1, 13, 7, 1, 8, 26, 14}, {1, 1, 26, 7, 14, 8, 26, 14}, + {1, 1, 26, 7, 1, 8, 13, 14}}; + +// The cells doors sit on: the rows of the side walls' doors and the columns of the top and bottom walls' doors, for a +// room's first and second half. Narrow rooms move their walls in, and L rooms put two doors on the inner corner's walls. +constexpr int DOOR_ROWS[2] = {4, 11}; +constexpr int DOOR_COLUMNS[2] = {7, 20}; +constexpr int NARROW_ROW_INSET = 3; +constexpr int NARROW_COLUMN_INSET = 4; + +struct DoorCell +{ + int slot; + int row; + int column; +}; + +constexpr DoorCell L_CORNER_DOORS[ROOMSHAPE_ANY - ROOMSHAPE_LTL][2] = { + {{DOOR_LEFT0, 4, 13}, {DOOR_UP0, 7, 7}}, + {{DOOR_RIGHT0, 4, 14}, {DOOR_UP1, 7, 20}}, + {{DOOR_DOWN0, 8, 7}, {DOOR_LEFT1, 11, 13}}, + {{DOOR_RIGHT1, 11, 14}, {DOOR_DOWN1, 8, 20}}}; + +// The direction a 970.1 water current spawn sets, by its subtype. +constexpr int WATER_CURRENT_COUNT = 4; +constexpr float WATER_CURRENTS[WATER_CURRENT_COUNT][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}}; + +// The light sprites' layer blending: premultiplied alpha. +constexpr std::array LIGHT_BLEND = {BLEND_EQUATION_ADD, BLEND_FACTOR_ONE, + BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, BLEND_FACTOR_ONE, + BLEND_FACTOR_ONE_MINUS_SRC_ALPHA}; +constexpr unsigned int FILTER_LINEAR = 1; + +// The color the poop cloud effect gives the screen. +constexpr ColorMod POOP_FX_COLOR = {{1, 1, 1, 3}, {0.7f, 0.1f, 0.9f, 1}, {0, 0, 0}}; + +// The Ascent's golden floors and walls, and the pre-items seed's grey Flooded Caves. +constexpr ColorMod ASCENT_COLOR = {{1, 1, 1, 1}, {1.2f, 1.2f, 1.2f, 0.6f}, {0.0764f, -0.0216f, -0.0884f}}; +constexpr ColorMod GREY_COLOR = {{1, 1, 1, 1}, {1, 1, 1, -1}, {0, 0, 0}}; + +// The entity types, variants and subtypes Room checks. +constexpr int PICKUP_COLLECTIBLE = 100; +constexpr int PICKUP_OLD_CHEST = 55; +constexpr int PICKUP_TROPHY = 370; +constexpr int EFFECT_TINY_BUG = 21; +constexpr int EFFECT_TINY_FLY = 33; +constexpr int EFFECT_HEAVEN_LIGHT_DOOR = 39; +constexpr int EFFECT_WORM = 63; +constexpr int EFFECT_BEETLE = 64; +constexpr int EFFECT_WISP = 65; +constexpr int EFFECT_WALL_BUG = 68; +constexpr int EFFECT_ISAACS_CARPET = 74; +constexpr int EFFECT_DICE_FLOOR = 76; +constexpr int EFFECT_WOMB_TELEPORT = 82; +constexpr int EFFECT_FALLING_EMBER = 87; +constexpr int EFFECT_BROKEN_SHOVEL_SHADOW = 115; +constexpr int EFFECT_TADPOLE = 158; +constexpr int EFFECT_LIL_GHOST = 159; + +// The room layout spawns Init reads before spawning anything (entities2.xml types 825 to 970). +constexpr int SPAWN_WATER = 825; +constexpr int SPAWN_DRY = 829; +constexpr int SPAWN_DUMP = 876; +constexpr int SPAWN_ALT_BACKDROP = 882; +constexpr int SPAWN_HERETIC = 905; +constexpr int SPAWN_WATER_ALT = 907; +constexpr int SPAWN_DUMP_ALT = 918; +constexpr int SPAWN_RAGLICH = 919; +constexpr int SPAWN_ROOM_CONFIG = 970; +constexpr int ROOM_CONFIG_PITCH_BLACK = 0; +constexpr int ROOM_CONFIG_WATER = 1; +constexpr int ROOM_CONFIG_CURSED_MIST = 3; +constexpr int ROOM_CONFIG_VERSUS_SPAWN = 4; +constexpr int WATER_SUBTYPE_DRY = 20; +constexpr int WATER_SUBTYPE_FLOODED = 11; +constexpr int WATER_SUBTYPE_DUMP = 10; + +// The grid entity types Init counts or avoids. +constexpr int GRID_DECORATION = 1; +constexpr int GRID_ROCK_BLOCK = 3; +constexpr int GRID_ROCK_BOMB = 5; +constexpr int GRID_PIT = 7; +constexpr int GRID_POOP = 14; +constexpr int GRID_WALL = 15; +constexpr int GRID_ROCK_SUPERSECRET = 22; + +// The grid path values: what an entity walking has left, and what blocks spawning. +constexpr int GRID_PATH_DECAY_FRAMES = 3; +constexpr int GRID_PATH_PERMANENT = 3999; +constexpr int GRID_PATH_RESET = 900; +constexpr int GRID_PATH_BLOCKED = 900; +constexpr int GRID_PATH_DECAY_MAX = 100; +constexpr int GRID_PATH_UNIT = 1000; +constexpr int GRID_PATH_PIT = 3000; +constexpr int GRID_PATH_PIT_LAST = 3999; + +// Lua's GridCollisionClass values GetGridCollision returns. +constexpr uint32_t GRID_COLLISION_NONE = 0; +constexpr uint32_t GRID_COLLISION_PIT = 1; +constexpr uint32_t GRID_COLLISION_SOLID = 3; +constexpr uint32_t GRID_COLLISION_WALL = 4; + +// The stages, stage ids, backdrops and bosses Init and PlayMusic tell apart. +constexpr int STAGE_HOME = 13; + +// A crawlspace's subtypes: Rotgut's two phases and the Beast's arena. +constexpr int DUNGEON_ROTGUT = 2; +constexpr int DUNGEON_ROTGUT_HEART = 3; +constexpr int DUNGEON_BEAST = 4; +constexpr int STAGE_ID_BLUE_WOMB = 13; +constexpr int STAGE_BLUE_WOMB = 9; +constexpr int STAGE_ID_DOWNPOUR = 27; +constexpr int STAGE_ID_DROSS = 28; +constexpr int STAGE_ID_ASHPIT = 30; +constexpr int STAGE_ID_HOME = 35; +constexpr int BACKDROP_FLOODED_CAVES = 6; +constexpr int BACKDROP_SCARRED_WOMB = 12; +constexpr int BACKDROP_DARK_ROOM = 16; +constexpr int BACKDROP_MEGA_SATAN = 18; +constexpr int BACKDROP_MINES = 32; +constexpr int BACKDROP_CORPSE = 34; +constexpr int BACKDROP_PLANETARIUM = 35; +constexpr int BACKDROP_CORPSE3 = 44; +constexpr int BACKDROP_ASHPIT = 46; +constexpr int BACKDROP_CLOSET_B = 53; +constexpr int BACKDROP_MINES_SHAFT = 58; +constexpr int BACKDROP_ASHPIT_SHAFT = 59; +constexpr int BOSS_MOM = 6; +constexpr int BOSS_ISAAC = 39; +constexpr int BOSS_SATAN = 24; +constexpr int BOSS_MEGA_SATAN = 55; +constexpr int BOSS_ULTRA_GREED = 62; +constexpr int BOSS_ROTGUT = 87; +constexpr int BOSS_MOM_MAUSOLEUM = 89; + +// The collectibles, trinkets, seeds and challenges Room checks. +constexpr int COLLECTIBLE_STOP_WATCH = 232; +constexpr int COLLECTIBLE_HOURGLASS = 66; +constexpr int COLLECTIBLE_INFESTATION = 148; +constexpr int COLLECTIBLE_INFESTATION_2 = 234; +constexpr int COLLECTIBLE_THE_STAIRWAY = 586; +constexpr int COLLECTIBLE_ISAACS_TOMB = 701; +constexpr int COLLECTIBLE_SANGUINE_BOND = 692; +constexpr int COLLECTIBLE_CARD_READING = 660; +constexpr int COLLECTIBLE_BROKEN_SHOVEL = 550; +constexpr int COLLECTIBLE_VADE_RETRO = 653; +constexpr int COLLECTIBLE_ASTRAL_PROJECTION = 677; +constexpr int NULL_EFFECT_POOP_CLOUD = 64; +constexpr int TRINKET_BROKEN_GLASSES = 187; +constexpr int TRINKET_WICKED_CROWN = 161; +constexpr int TRINKET_HOLY_CROWN = 155; +constexpr int TRINKET_BLOODY_CROWN = 111; +constexpr int COLLECTIBLE_MORE_OPTIONS = 414; +constexpr int SEED_EFFECT_PRE_ITEMS = 79; +constexpr int SEED_EFFECT_NO_LAST_BOSS_DOORS = 71; +constexpr int SPECIAL_DAILY_SURPRISE_MINIBOSS = 17; +constexpr int CHALLENGE_SPEED = 22; +constexpr int CHALLENGE_DELETE_THIS = 45; +constexpr int CHALLENGE_SEEING_DOUBLE = 40; +constexpr int ACHIEVEMENT_SHOP_LEVEL_2 = 151; +constexpr int ACHIEVEMENT_SHOP_LEVEL_3 = 152; +constexpr int ACHIEVEMENT_SHOP_LEVEL_4 = 153; +constexpr int ACHIEVEMENT_SHOP_LEVEL_5 = 154; +constexpr int ACHIEVEMENT_STORE_KEY = 379; +constexpr int EVENT_ARCADES_VISITED = 9; +constexpr int SHOP_VISITS_FOR_ACHIEVEMENT = 5; +constexpr int SHOP_LEVEL_MAX = 5; + +// The run state and floor state bits Init and Update read. +constexpr uint64_t GAME_STATE_SURPRISE_MINIBOSS_SEEN = 1ull << 29; +constexpr uint32_t LEVEL_STATE_MINESHAFT_ESCAPE = 1u << 22; +constexpr uint32_t LEVEL_STATE_SHOVEL_QUEST_TRIGGERED = 1u << 16; +constexpr uint32_t LEVEL_STATE_BROKEN_WATCH_SLOW = 1u << 24; +constexpr uint32_t LEVEL_STATE_BROKEN_WATCH_FAST = 1u << 25; +constexpr uint32_t LEVEL_STATE_GREED_MONSTRO_SPAWNED = 1u << 12; +constexpr uint32_t LEVEL_STATE_LEVEL_START_TRIGGERED = 1u << 19; + +// Init's ambient decoration: how many spawn at most, and how the second door chance raises them. +constexpr int AMBIENT_FLIES = 15; +constexpr int AMBIENT_DUST = 10; +constexpr int AMBIENT_DROPLETS = 10; +constexpr int AMBIENT_RAIN = 50; +constexpr int AMBIENT_RETRIES = 10; +constexpr int EMBER_COUNT = 10; +constexpr float EMBER_HEIGHT = 100; +constexpr float TREASURE_ITEM_SPACING = 40; + +// The brief jingle a boss room roars on its first frame, and the time scales the watches and effects set. +constexpr int SOUND_BOSS_ROAR = 190; +constexpr float TIME_SCALE_SLOW = 0.7f; +constexpr float TIME_SCALE_FAST = 1.43f; +constexpr float TIME_SCALE_STOP_WATCH = 0.9f; +constexpr float TIME_SCALE_EASE_FRAMES = 90; +constexpr float TIME_SCALE_EASE_DEPTH = 0.8f; +constexpr float TIME_SCALE_EASE_MIN = 0.5f; +constexpr float TIME_SCALE_PER_GFUEL = 0.1f; + +// PlayMusic's crossfade rates: the usual one, the slow one between the Downpour and its reversed track, and the instant one. +constexpr float MUSIC_CROSSFADE = 0.08f; +constexpr float MUSIC_CROSSFADE_ASCENT = 0.008f; +constexpr float MUSIC_CROSSFADE_REVERSE = 0.01f; +constexpr float MUSIC_CROSSFADE_INSTANT = 1; + +// The music.xml tracks PlayMusic picks from. +enum MusicId : int +{ + MUSIC_NULL = 0, + MUSIC_BOSS = 9, + MUSIC_MOM_BOSS = 20, + MUSIC_MOMS_HEART_BOSS = 21, + MUSIC_ISAAC_BOSS = 22, + MUSIC_DARK_ROOM_BOSS = 24, + MUSIC_CHEST_BOSS = 25, + MUSIC_BOSS2 = 26, + MUSIC_ULTRA_GREED_BOSS = 28, + MUSIC_LIBRARY_ROOM = 30, + MUSIC_SECRET_ROOM = 31, + MUSIC_SECRET_ROOM_ALT = 32, + MUSIC_DEVIL_ROOM = 33, + MUSIC_ANGEL_ROOM = 34, + MUSIC_SHOP_ROOM = 35, + MUSIC_ARCADE_ROOM = 36, + MUSIC_BOSS_OVER = 37, + MUSIC_CHALLENGE_FIGHT = 38, + MUSIC_BOSS3 = 41, + MUSIC_MOTHER_BOSS = 43, + MUSIC_DOGMA_BOSS = 44, + MUSIC_BEAST_BOSS = 45, + MUSIC_PLANETARIUM = 50, + MUSIC_SECRET_ROOM_ALT_ALT = 51, + MUSIC_BOSS_OVER_TWISTED = 52, + MUSIC_REVERSE_GENESIS_START = 64, + MUSIC_HUSH_TRANSITION = 65, + MUSIC_ECHOES_REVERSE = 69, + MUSIC_TREASURE_JINGLE_FIRST = 87, + MUSIC_GAME_START_JINGLE = 95, + MUSIC_VOID_BOSS = 103, + MUSIC_DOWNPOUR = 104, + MUSIC_DOWNPOUR_REVERSED = 114, + MUSIC_ABANDONED_MINESHAFT = 116, + MUSIC_REVERSE_GENESIS = 118 +}; +constexpr int TREASURE_JINGLE_COUNT = 4; + +static float random_unit() +{ + return (float)Random() * 2.3283064e-10f; +} + +static bool is_greed() +{ + return g_game->difficulty == DIFFICULTY_GREED || g_game->difficulty == DIFFICULTY_GREEDIER; +} + +static bool is_backwards_path() +{ + return g_game->stage >= 1 && g_game->stage <= 6 && g_game->GetStateFlag(GAME_STATE_BACKWARDS_PATH); +} + +static bool is_curse_active(uint32_t curse) +{ + uint32_t curses = Seeds::GetForcedCurses() | g_game->debugCurses | g_game->curses; + return (~Seeds::GetPreventedCurses() & curses & curse) != 0; +} + +// Whether the room has an entity of a type and variant, as the original's type query finds. +static bool entities_any(EntityList& list, int type, int variant) +{ + return std::any_of(list.updateEL.begin(), list.updateEL.end(), + [&](Entity* entity) { return entity->IsType(type, variant, -1); }); +} + +static void lua_garbage_collect(); + +// Spawns an entity of the room with no velocity or spawner. +static Entity* entity_spawn(int type, int variant, Vector position, int subType, uint32_t seed) +{ + return g_game->Spawn({.position = position, .subType = subType, .type = type, .variant = variant, .seed = seed}); +} + +// A grid entity's type. Grid entities stay generated this round, so none exists to ask. +static int grid_type_get(GridEntity* entity) +{ + return reinterpret_cast(entity->_desc)->_type; +} + +// 007e9400 An empty room, its backdrops read (as a mod redirects backdrops.xml) and its render surface placed for the +// screen. The original also creates the render surfaces rooms draw through (init_room_render_surfaces 007ea630, +// file globals), which waits for Render's takeover. +Room::Room() +{ + backdrop.LoadConfig(g_manager->modManager.TryRedirectPath("backdrops.xml")); + renderSurfaceTopLeft = vector_make((g_screenWidth - 338) * 0.5f - 52, (g_screenHeight - 182) * 0.5f - 52); +} + +// 007e9ba0 Deletes the grid entities the room owns. +Room::~Room() +{ + for (GridEntity* entity : gridEntities) delete entity; +} + +// 007eb010 Empties the room: no entities left in the list but the persistent ones, renumbered, no grid entities or +// doors, no ambush, the colors back to normal, and not initialized. +// The original also zeroes Game+0x265f0 after the ambush, which no curated member holds yet. +static void room_reset(Room& room) +{ + room.entityList.Reset(); + room.entityIndexCounter = 0; + for (Entity* entity : room.entityList.updateEL) entity->index = room.entityIndexCounter++; + room.lastAliveBossCount = 0; + for (int i = 0; i < ROOM_ITEM_COUNTER_COUNT; i++) + if (!(ROOM_ITEM_COUNTERS_KEPT >> i & 1)) room.itemCounters[i] = 0; + + for (GridEntity*& entity : room.gridEntities) + { + delete entity; + entity = nullptr; + } + room.doors.fill(nullptr); + g_game->ambush._isActive = false; + g_game->ambush._currentWave = 0; + room.isCardAgainstHumanity = false; + room.isInitialized = false; + room.isFirstVisit = false; + room.renderScrollOffset = vector_make(0, 0); + room.roomType = ROOM_NULL; + room.greedWaveTimer = -1; + room.unknown72fc = -1; + room.wallColor = COLOR_DEFAULT; + room.floorColor = COLOR_DEFAULT; +} + +// 007f2800 Enters a room: resets what a visit keeps, lays out the config's grid, doors, walls and entities from the +// descriptor's seeds (what a past visit saved restored on top), floods, darkens or tints it as its backdrop and +// flags say, decorates a first visit, and sets the camera on it. +void Room::Init(RoomConfig_Room& config, RoomDescriptor& roomDescriptor) +{ + temporaryEffects.ClearEffects(false); + for (int group = 0; group < OUTPUT_GROUP_COUNT; group++) + { + outputGroupGridIndices[group].clear(); + outputGroupCallbacks[group].clear(); + } + // The original empties these lists in every room. DeathmatchManager::Reset gives every run a type, but only a + // versus arena's spawn points fill them, so outside a match they are already empty. + if (g_game->deathmatchManager.is_active()) + reconstruction_missing("Room::Init 007f2800: the versus spawn lists of DeathmatchTypeBase (+0x10, +0x18)"); + + waterCurrent = vector_make(0, 0); + unknown73f0 = 0; + genesisTimer = 0; + lavaIntensity = 1; + isUnknown7769 = false; + isPickupVisionInvalid = false; + isUnknown11f6 = true; + isFirstEnemyDead = false; + isPacifist = false; + deathsListTarget = nullptr; + isDeathsListDone = false; + deathsListOffset = vector_make(0, 0); + bloodFromWallsDuration = 0; + bloodFromWallsCount = 0; + unknown70fc = 0; + slowdownDuration = 0; + unknown7230 = 0; + unknown721c = 0; + enterFrame = g_game->frameCount; + pendingGridRemovals.clear(); + for (auto& [id, entity] : g_manager->entityConfig.entities) entity.isPreloaded = false; + isUnknown11f5 = true; + + std::string log = "Room " + std::to_string(config.type) + "." + std::to_string(config.variant) + "(" + config.name + + ")\n"; + KAGE_LogMessage(LOG_INFO, (uint8_t*)log.c_str()); + g_game->itemPool.ResetRoomBlacklist(); + room_reset(*this); + gridWidth = config.width + 2; + gridHeight = config.height + 2; + lighting_load(); + + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + doorGridPositions[slot] = room_shape_get_door_grid_index(slot, gridWidth, gridHeight, roomDescriptor.data->shape); + descriptor = &roomDescriptor; + roomType = (RoomType)roomDescriptor.data->type; + bossId = 0; + secondBossId = 0; + reconstruction_missing("Room::Init 007f2800: RailManager's init 009e2830 (RailManager has no layout yet)"); + beastArena.init(); + if (roomType == ROOM_BOSS) boss_ids_init(); + + isSurpriseMiniboss = descriptor->flags & ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS; + if (g_game->dailyChallenge._specialDailyId == SPECIAL_DAILY_SURPRISE_MINIBOSS && isSurpriseMiniboss) + g_game->gameStateFlags |= GAME_STATE_SURPRISE_MINIBOSS_SEEN; + isTriggerPressurePlates = false; + update_bounds(true); + init_shop_level(); + shopRestockTimer = -1; + + if (g_manager->netplayManager.is_online()) + { + std::string frame = "[Frame " + std::to_string(g_game->frameCount) + "] "; + KAGE_LogMessage(LOG_INFO, (uint8_t*)frame.c_str()); + } + std::string seedLog = "SpawnRNG seed: " + std::to_string(descriptor->spawnSeed) + "\n"; + KAGE_LogMessage(LOG_INFO, (uint8_t*)seedLog.c_str()); + + SpawnFlags spawnFlags = init_spawn_flags(config); + LoadBackdropGraphics(); + init_water(spawnFlags); + if (descriptor->visitedCount == 0) init_first_visit(spawnFlags); + init_saved_grid(); + if (descriptor->pitsCount > 0 && backdropType == BACKDROP_CORPSE) waterAmount = 0; + + RNG tintedRng = {descriptor->spawnSeed, 2, 21, 9}; + bool isHardTinted = g_game->difficulty == DIFFICULTY_HARD || g_game->difficulty == DIFFICULTY_GREEDIER; + tintedRockIdx = tintedRng.RandomInt(isHardTinted ? 2 : 1) == 0 ? GetRandomTileIndex(tintedRng.Next()) : -1; + + init_spawns(config); + if (config.type == ROOM_TREASURE) init_treasure_blind(config); + hold_trigger_output_entities(); + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) + if (descriptor->allowedDoors & 1u << slot) MakeDoor(slot); + TrySpawnMegaSatanRoomDoor(false); + TrySpawnSpecialQuestDoor(); + if (g_game->challenge == CHALLENGE_BACKASSWARDS && g_game->currentRoomIdx == ROOM_MEGA_SATAN_IDX) + reconstruction_missing("Room::Init 007f2800: Backasswards' door from Mega Satan back to the start (GridEntity_Door)"); + make_walls(); + init_dungeon_rock(); + init_decorations(config); + for (GridEntity* entity : gridEntities) + if (entity) reconstruction_missing("Room::Init 007f2800: grid entities' post-init (GridEntity stays generated)"); + attach_minecarts(); + if (spawnFlags.isHeretic || spawnFlags.isRaglich) + reconstruction_missing("Room::Init 007f2800: the Heretic and Raglich fireplaces"); + RestoreState(); + if (!descriptor->savedEffects.empty()) + reconstruction_missing("Room::Init 007f2800: respawning the saved effects (EntitySaveState)"); + + for (int i = 0; i < VENTRICLE_RAZOR_PORTAL_COUNT; i++) + { + VentricleRazorPortal& portal = g_game->ventricleRazorPortals[i]; + if (g_game->GetRoomByIdx(portal.roomIndex) != descriptor) continue; + + uint32_t seed = Random(); + entity_spawn(ENTITY_EFFECT, EFFECT_WOMB_TELEPORT, GetGridPosition(portal.gridIndex), i, seed); + } + if (isFirstVisit) init_first_visit_items(); + + Entity_Player* sanguineOwner = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_SANGUINE_BOND, LAZARUS_SHARE_CHECK); + if (roomType == ROOM_DEVIL && sanguineOwner && isFirstVisit) spawn_sanguine_bond_spikes(true); + bool isShovelRemoved = g_game->itemPool.removedCollectibles[COLLECTIBLE_BROKEN_SHOVEL]; + if (g_game->stage == 1 && (g_game->levelStateFlags & LEVEL_STATE_SHOVEL_QUEST_TRIGGERED) && + g_game->currentRoomIdx == g_game->startingRoomIdx && !isShovelRemoved) + { + uint32_t seed = Random(); + entity_spawn(ENTITY_EFFECT, EFFECT_BROKEN_SHOVEL_SHADOW, GetCenterPos(), 0, seed); + } + if (descriptor->data->type == ROOM_DEVIL) reconstruction_missing("Room::Init 007f2800: a devil room's FUN_004d72b0(6, 1)"); + if (descriptor->data->type == ROOM_TREASURE && descriptor->visitedCount == 0 && descriptor->dimension == 0) + g_game->treasureRoomsVisited++; + if (descriptor->data->type == ROOM_PLANETARIUM && descriptor->visitedCount == 0 && descriptor->dimension == 0) + g_game->planetariumsVisited++; + if (descriptor->visitedCount == 0 && roomType == ROOM_DUNGEON && gridHeight > 1) + reconstruction_missing("Room::Init 007f2800: a crawlspace's ladders (GridEntity stays generated)"); + if (!is_backwards_path() && is_boss_doors_removed()) + for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++) g_game->room->RemoveDoor(slot); + + uint32_t stageType = g_game->stageType; + int effectiveStage = (int)g_game->stage; + if (is_greed()) effectiveStage = effectiveStage < 5 ? effectiveStage * 2 - 1 : effectiveStage == 5 ? 10 : 0; + int stageId = g_game->GetStageID(); + brokenWatchState = BROKEN_WATCH_NONE; + isInitialized = true; + if (descriptor->visitedCount == 0) + { + init_first_visit_effects(config); + init_ambient_effects(effectiveStage, stageId, stageType); + } + + if (g_game->challenge == CHALLENGE_BACKASSWARDS && + (g_game->currentRoomIdx == g_game->startingRoomIdx || g_game->currentRoomIdx == ROOM_ERROR_IDX)) + { + Vector center = GetCenterPos(); + if (g_game->stage == 1) entity_spawn(ENTITY_PICKUP, PICKUP_TROPHY, center, 0, Random()); + else if (isFirstVisit) entity_spawn(ENTITY_EFFECT, EFFECT_HEAVEN_LIGHT_DOOR, center, 0, Random()); + } + if (!g_game->isRestoringGlowingHourglassState) visit_record(); + if ((effectiveStage == 1 || effectiveStage == 2) && stageType == STAGETYPE_AFTERBIRTH) + { + for (int i = 0; i < EMBER_COUNT; i++) + { + uint32_t seed = Random(); + Vector position = GetRandomPosition(0); + Vector start = vector_make(position.x - 0, position.y - EMBER_HEIGHT); + entity_spawn(ENTITY_EFFECT, EFFECT_FALLING_EMBER, start, 0, seed)->Update(); + } + } + + if (GetAliveEnemiesCount() < 1 && roomClearDelay == 0 && !IsClear() && + g_game->deathmatchManager.state < DEATHMATCH_INTRO) + descriptor->flags |= ROOM_DESCRIPTOR_FLAG_CLEAR; + if (!IsClear() && config.type == ROOM_MINIBOSS) + reconstruction_missing("Room::Init 007f2800: a miniboss's versus title (HUD::ShowStackedItemTextCustomUTF16)"); + if (IsClear()) isDeathsListDone = true; + isRedHeartDamaged = false; + init_rain(); + init_colors(); + + if (descriptor->flags & ROOM_DESCRIPTOR_FLAG_ROTGUT_CLEARED && bossId == BOSS_ROTGUT) bossId = 0; + reconstruction_missing("Room::Init 007f2800: the room's screen color (Room::get_color_modifier, Game::SetColorModifier)"); + init_mineshaft_colors(); + update_bounds(false); + camera = std::make_unique(*this); + backdrop.load_details(); + TextureCache::Purge(); + lua_garbage_collect(); + + if (bossId == BOSS_ULTRA_GREED && g_game->difficulty == DIFFICULTY_GREEDIER && IsClear()) TurnGold(); + + Room& current = *g_game->room; + if (g_game->levelStateFlags & LEVEL_STATE_BROKEN_WATCH_SLOW) + { + current.brokenWatchState = BROKEN_WATCH_SLOW; + g_manager->musicManager.targetPitch = current.time_scale_update(); + current.slowdownDuration = INT_MAX; + } + if (g_game->levelStateFlags & LEVEL_STATE_BROKEN_WATCH_FAST) + { + current.brokenWatchState = BROKEN_WATCH_FAST; + g_manager->musicManager.targetPitch = current.time_scale_update(); + reconstruction_missing("Room::Init 007f2800: the Broken Watch's fast rooms (players' pill RNG and effect 28)"); + } +} + +// The light gradient and spotlight sprites, loaded once and played from their default animation. The gradient blends +// with premultiplied alpha. +void Room::lighting_load() +{ + if (!lightSprite.isLoaded) + { + lightSprite.Load("gfx/LightGradient.anm2", GRAPHICS_LOAD); + lightSprite.GetLayer(0)->minFilterMode = FILTER_LINEAR; + lightSprite.GetLayer(0)->magFilterMode = FILTER_LINEAR; + lightSprite.Play(lightSprite.GetDefaultAnimationName()); + lightSprite.GetLayer(0)->blendMode = LIGHT_BLEND; + } + if (!spotLightSprite.isLoaded) + { + spotLightSprite.Load("gfx/SpotLight.anm2", GRAPHICS_LOAD); + spotLightSprite.GetLayer(0)->minFilterMode = FILTER_LINEAR; + spotLightSprite.GetLayer(0)->magFilterMode = FILTER_LINEAR; + spotLightSprite.Play(spotLightSprite.GetDefaultAnimationName()); + } +} + +// A boss room's bosses: each spawn's likeliest entry (the first of the highest weight), from the last spawn to the +// first, whose config names a boss. The first found is the boss, a different later one the second boss. +// The original reads before the entries of a spawn with none or with only zero weights. Those are skipped. +void Room::boss_ids_init() +{ + std::vector& spawns = descriptor->data->spawns; + + for (auto spawn = spawns.rbegin(); spawn != spawns.rend(); ++spawn) + { + float bestWeight = 0; + RoomEntry* best = nullptr; + + for (RoomEntry& entry : spawn->entries) + { + if (bestWeight >= entry.weight) continue; + best = &entry; + bestWeight = entry.weight; + } + if (!best) continue; + + EntityConfig_Entity* entity = g_manager->entityConfig.GetEntity(best->type, best->variant, best->subtype); + if (!entity || entity->bossID == 0) continue; + if (bossId == 0) bossId = entity->bossID; + else if (entity->bossID != bossId) secondBossId = entity->bossID; + } +} + +// The shop's level: by stage in Greed mode, otherwise by the shop upgrades unlocked (all of them in a debug or daily +// run being played). +void Room::init_shop_level() +{ + if (is_greed()) + { + switch (g_game->stage) + { + case 1: + case 2: + case 3: + case 4: + case 5: + shopLevel = (int)g_game->stage; + break; + case 6: + shopLevel = roomType == ROOM_DEFAULT ? SHOP_LEVEL_MAX : 1; + break; + } + return; + } + + std::array& achievements = g_manager->persistentGameData.achievements; + bool isAllUnlocked = g_manager->state == MANAGER_STATE_GAME && (g_game->dailyChallenge._id != 0 || g_game->isDebug); + + shopLevel = 1; + if (achievements[ACHIEVEMENT_SHOP_LEVEL_5] || isAllUnlocked) shopLevel = 5; + else if (achievements[ACHIEVEMENT_SHOP_LEVEL_4]) shopLevel = 4; + else if (achievements[ACHIEVEMENT_SHOP_LEVEL_3]) shopLevel = 3; + else if (achievements[ACHIEVEMENT_SHOP_LEVEL_2]) shopLevel = 2; +} + +// What the layout's spawns say about the room before anything spawns: water, a dump, the Heretic or Raglich, the +// pitch black, cursed mist and alternate backdrop flags, and a water current. Each spawn draws its entry from the +// spawn seed, as init_spawns draws them again. +SpawnFlags Room::init_spawn_flags(RoomConfig_Room& config) +{ + SpawnFlags flags; + RNG rng = {descriptor->spawnSeed, 2, 7, 7}; + + for (RoomSpawn& spawn : config.spawns) + { + uint32_t seed = rng.Next(); + if (spawn.entries.empty()) continue; + + RoomEntry& entry = *spawn.PickEntry((float)seed * 2.3283062e-10f); + bool isDump = false; + + switch (entry.type) + { + case SPAWN_WATER: + case SPAWN_WATER_ALT: + flags.isWater = true; + break; + case SPAWN_DRY: + flags.isDry = true; + break; + case SPAWN_DUMP: + case SPAWN_DUMP_ALT: + isDump = true; + break; + case SPAWN_ALT_BACKDROP: + descriptor->flags |= ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP; + break; + case SPAWN_HERETIC: + flags.isHeretic = true; + break; + case SPAWN_RAGLICH: + flags.isRaglich = true; + break; + case SPAWN_ROOM_CONFIG: + if (entry.variant == ROOM_CONFIG_PITCH_BLACK) descriptor->flags |= ROOM_DESCRIPTOR_FLAG_PITCH_BLACK; + else if (entry.variant == ROOM_CONFIG_CURSED_MIST) descriptor->flags |= ROOM_DESCRIPTOR_FLAG_CURSED_MIST; + else if (entry.variant == ROOM_CONFIG_VERSUS_SPAWN && g_game->deathmatchManager.type) + reconstruction_missing("Room::Init 007f2800: a 970.4 versus spawn point (DeathmatchTypeBase lists)"); + else if (entry.variant == ROOM_CONFIG_WATER) + { + if (entry.subtype == WATER_SUBTYPE_DRY) flags.isDry = true; + else if (entry.subtype == WATER_SUBTYPE_FLOODED) flags.isFlooded = true; + else if (entry.subtype == WATER_SUBTYPE_DUMP) isDump = true; + else if (entry.subtype < WATER_CURRENT_COUNT) + waterCurrent = vector_make(WATER_CURRENTS[entry.subtype][0], WATER_CURRENTS[entry.subtype][1]); + } + break; + } + if (!isDump) continue; + flags.isDump = true; + descriptor->flags |= ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP; + } + return flags; +} + +// How much water the room shows: full in the Flooded Caves and the last Corpse backdrop, a fifth of the Scarred Womb's +// normal rooms, the Downpour and Dross stages but for their secret exits, and flooded rooms. The Dark Room, the +// Planetarium, crawlspaces and dumps stay dry. Water puts out the lava. +void Room::init_water(SpawnFlags& flags) +{ + int roomBackdrop = g_game->room->backdropType; + waterAmount = 0; + + if (roomBackdrop == BACKDROP_FLOODED_CAVES || roomBackdrop == BACKDROP_CORPSE3) waterAmount = 1; + else if (roomBackdrop == BACKDROP_SCARRED_WOMB && descriptor->data->type == ROOM_DEFAULT) + { + RNG rng = {descriptor->decorationSeed, 1, 19, 3}; + if (rng.Next() % 5 == 0) waterAmount = 1; + } + waterLerpColorDuration = -1; + waterLerpColorCountdown = -1; + + int stageId = g_game->GetStageID(); + if ((stageId == STAGE_ID_DOWNPOUR || stageId == STAGE_ID_DROSS) && roomType != ROOM_SECRET_EXIT) waterAmount = 1; + if (descriptor->flags & ROOM_DESCRIPTOR_FLAG_FLOODED || flags.isFlooded) waterAmount = 1; + + bool isDryDump = flags.isDump && !(descriptor->flags & ROOM_DESCRIPTOR_FLAG_FLOODED); + if (backdropType == BACKDROP_DARK_ROOM || backdropType == BACKDROP_PLANETARIUM || roomType == ROOM_DUNGEON || isDryDump) + waterAmount = 0; + if (waterAmount > 0) lavaIntensity = 0; +} + +// A first visit's flags from the decoration seed: water pits by the backdrop's chance (or always in the Flooded +// Caves with the water surface off), the alternate boss music, a shop visit counted, and the backdrops' special cases. +void Room::init_first_visit(SpawnFlags& flags) +{ + RNG rng = {descriptor->decorationSeed, 5, 9, 7}; + uint32_t& roomFlags = descriptor->flags; + + isFirstVisit = true; + if (backdropType == BACKDROP_FLOODED_CAVES && !g_manager->optionsConfig.render.isWaterSurfaceEnabled) + roomFlags |= ROOM_DESCRIPTOR_FLAG_HAS_WATER; + else + { + uint8_t mode = backdrop.configs[backdropType].waterPitsMode; + bool isWater = mode == 2 || (mode == 1 && (rng.Next() & 1) == 0); + roomFlags = isWater ? roomFlags | ROOM_DESCRIPTOR_FLAG_HAS_WATER : roomFlags & ~ROOM_DESCRIPTOR_FLAG_HAS_WATER; + } + bool isAltMusic = (rng.Next() & 1) == 0; + roomFlags = isAltMusic ? roomFlags | ROOM_DESCRIPTOR_FLAG_ALT_BOSS_MUSIC : roomFlags & ~ROOM_DESCRIPTOR_FLAG_ALT_BOSS_MUSIC; + + if (roomType == ROOM_SHOP && ++g_game->shopVisits > SHOP_VISITS_FOR_ACHIEVEMENT && !is_greed()) + g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_STORE_KEY); + + bool isDry = flags.isDry; + bool isWater = flags.isWater; + if (backdropType == BACKDROP_MINES) + { + if (roomFlags & ROOM_DESCRIPTOR_FLAG_HAS_WATER && roomFlags & ROOM_DESCRIPTOR_FLAG_PITCH_BLACK) + roomFlags &= ~ROOM_DESCRIPTOR_FLAG_HAS_WATER; + } + else if (backdropType == BACKDROP_MINES_SHAFT || backdropType == BACKDROP_ASHPIT_SHAFT) + { + if (g_game->levelStateFlags & LEVEL_STATE_MINESHAFT_ESCAPE) + { + isDry = false; + isWater = true; + } + roomFlags |= ROOM_DESCRIPTOR_FLAG_CURSED_MIST; + } + if (isWater) roomFlags |= ROOM_DESCRIPTOR_FLAG_HAS_WATER; + if (isDry) roomFlags &= ~ROOM_DESCRIPTOR_FLAG_HAS_WATER; + if (backdropType == BACKDROP_ASHPIT && roomFlags & ROOM_DESCRIPTOR_FLAG_HAS_WATER) + roomFlags |= ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP; +} + +// Clears the grid paths and the descriptor's pit and poop counts, then rebuilds the grid entities a past visit saved. +void Room::init_saved_grid() +{ + gridPaths.fill(0); + gridTimers.fill(0); + roomClearDelay = 0; + descriptor->pitsCount = 0; + descriptor->poopCount = 0; + + for (int i = 0; i < gridHeight * gridWidth; i++) + { + GridEntityDesc& saved = descriptor->savedGridEntities[i]; + if (saved._type == 0) continue; + + reconstruction_missing("Room::Init 007f2800: restoring a saved grid entity (GridEntity stays generated)"); + if (saved._type == GRID_PIT) descriptor->pitsCount++; + else if (saved._type == GRID_POOP) descriptor->poopCount++; + } +} + +// Spawns the layout's entities, each spawn's entry drawn from the spawn seed, except where the descriptor restricts. +void Room::init_spawns(RoomConfig_Room& config) +{ + RNG rng = {descriptor->spawnSeed, 2, 7, 7}; + + for (RoomSpawn& spawn : config.spawns) + { + uint32_t seed = rng.Next(); + int gridIndex = spawn.x + 1 + (spawn.y + 1) * gridWidth; + if (spawn.entries.empty()) continue; + + RoomEntry& entry = *spawn.PickEntry((float)seed * 2.3283062e-10f); + if (!descriptor->restrictedGridIndexes.contains(gridIndex)) SpawnEntry(gridIndex, entry, seed); + } +} + +// A treasure room's blind items: the second of two or more on the alternate path, or with Broken Glasses (whose +// multiplier may spare it on the alternate path, and which leaves a More Options room alone elsewhere). An alternate +// path's room frees its third item from the option group. Greed's rooms other than its treasure room drop their +// co-op duplicates. A backwards run and a daily skip the blind items. +void Room::init_treasure_blind(RoomConfig_Room& config) +{ + std::vector items; + for (Entity* entity : entityList.updateEL) + if (entity->type == ENTITY_PICKUP && entity->variant == PICKUP_COLLECTIBLE) + items.push_back(static_cast(entity)); + + PlayerManager& players = g_game->playerManager; + bool isAltStage = g_game->stageType == STAGETYPE_REPENTANCE || g_game->stageType == STAGETYPE_REPENTANCE_B; + bool isMoreOptions = false; + auto is_multiplied = [&](int trinket) + { + Entity_Player* owner = players.FirstTrinketOwner(trinket); + return owner && owner->GetTrinketMultiplier(trinket) > 1; + }; + + if (g_game->stage == 10 && g_game->stageType == STAGETYPE_ORIGINAL) isMoreOptions = is_multiplied(TRINKET_WICKED_CROWN); + if (!isMoreOptions && g_game->stage == 10 && g_game->stageType == STAGETYPE_WOTL) + isMoreOptions = is_multiplied(TRINKET_HOLY_CROWN); + if (!isMoreOptions && (g_game->stage == 7 || g_game->stage == 8)) isMoreOptions = is_multiplied(TRINKET_BLOODY_CROWN); + isMoreOptions = players.FirstCollectibleOwner(COLLECTIBLE_MORE_OPTIONS, LAZARUS_SHARE_CHECK) || isMoreOptions || + (g_game->roomTransition.is_active() && g_game->roomTransition.flags & 1); + + bool isOptionsRoom = (config.subtype == 1 || config.subtype == 3) && isMoreOptions; + bool isGlasses = players.AnyoneHasTrinket(TRINKET_BROKEN_GLASSES) && g_game->stage != STAGE_BLUE_WOMB && !isOptionsRoom; + if ((isAltStage || isGlasses) && !is_backwards_path() && items.size() > 1 && g_game->dailyChallenge._id == 0) + { + bool isSpared = false; + if (isAltStage && players.AnyoneHasTrinket(TRINKET_BROKEN_GLASSES)) + { + RNG rng = {descriptor->spawnSeed, 9, 5, 25}; + isSpared = (int)(rng.Next() & 1) < players.GetTrinketMultiplier(TRINKET_BROKEN_GLASSES); + } + Entity_Pickup* item = items[1]; + bool isWasBlind = item->isForceBlind; + + if (!isSpared) item->isForceBlind = true; + if (!isSpared && item->variant == PICKUP_COLLECTIBLE && item->subtype != 0 && !isWasBlind) item->UpdateSprite(false); + } + if (isAltStage && items.size() > 2 && (config.subtype == 0 || config.subtype == 2)) items[2]->optionsPickupIndex = 0; + if (is_greed() && descriptor->gridIndex != (int)g_game->greedModeTreasureRoomIdx) + for (Entity_Pickup* item : items) item->coopDuplicateIndex = 0; +} + +// The dungeon rock (the crawlspace's rock): on a room the placement seed picks, avoiding boss, challenge and miniboss +// rooms, a random cell holding a breakable grid entity. +void Room::init_dungeon_rock() +{ + RNG rng = {g_game->dungeonPlacementSeed, 5, 9, 7}; + int roomIndex = -1; + + dungeonRockIdx = -1; + for (int i = 0; i < 3 && roomIndex < 0; i++) + { + roomIndex = (int)rng.RandomInt(g_game->nbRooms); + RoomConfig_Room* data = g_game->roomList[roomIndex].data; + if (data && (data->type == ROOM_BOSS || data->type == ROOM_CHALLENGE || data->type == ROOM_MINIBOSS)) roomIndex = -1; + } + if (roomIndex != descriptor->listIndex) return; + + for (int i = 0; i < AMBIENT_RETRIES && dungeonRockIdx < 0; i++) + { + dungeonRockIdx = (int)rng.RandomInt(gridHeight * gridWidth); + GridEntity* entity = dungeonRockIdx < ROOM_GRID_CELLS ? gridEntities[dungeonRockIdx] : nullptr; + int type = entity ? grid_type_get(entity) : 0; + + bool isUnbreakable = type == GRID_WALL || type == GRID_ROCK_BLOCK || type == GRID_ROCK_SUPERSECRET || type == GRID_ROCK_BOMB; + if (!entity || isUnbreakable) dungeonRockIdx = -1; + } +} + +// Spawns a grid entity of a type on a free cell from a seed. Grid entities stay generated this round. +static void grid_spawn(int type, int gridIndex) +{ + if (gridIndex < 0 || gridIndex >= ROOM_GRID_CELLS) + KAGE_LogMessage(LOG_ASSERT, (uint8_t*)"SpawnGridEntity: Grid index invalid\n"); + reconstruction_missing(type == GRID_DECORATION ? "Room::Init 007f2800: decorations (GridEntity stays generated)" + : "Room::Init 007f2800: grid entities (GridEntity stays generated)"); +} + +// A first visit's decorations: random props on free cells, more in big rooms, but not in Basement I's first room; +// crawlspaces' walls instead; and Greed's rocks around the center of a normal room. +void Room::init_decorations(RoomConfig_Room& config) +{ + if (roomType == ROOM_DUNGEON) + reconstruction_missing("Room::Init 007f2800: a crawlspace's walls and items (GridEntity stays generated)"); + else if (backdropType != BACKDROP_MEGA_SATAN && backdropType != BACKDROP_DARK_ROOM && backdropType != BACKDROP_PLANETARIUM) + { + bool isAltStage = g_game->stageType == STAGETYPE_REPENTANCE || g_game->stageType == STAGETYPE_REPENTANCE_B; + uint32_t effectiveStage = isAltStage ? g_game->stage + 1 : g_game->stage; + bool isFirstRoom = effectiveStage == 1 && g_game->startingRoomIdx == g_game->currentRoomIdx; + + if (!isFirstRoom && !backdrop.configs[backdropType].props.empty()) + { + RNG rng = {(descriptor->decorationSeed & INT_MAX) + (uint32_t)descriptor->gridIndex, 5, 9, 7}; + int count = (int)(rng.Next() & 3); + uint32_t seed = rng.Next(); + count += (int)(seed % 5); + + bool isWide = config.width > 13; + bool isTall = config.height > 7; + if (isWide != isTall) count += (int)(rng.Next() % 9); + if (isWide && isTall) + { + count += (int)(rng.Next() % 9); + count += (int)(rng.Next() % 18); + } + for (int attempt = 0; attempt < count * 2; attempt++) + { + int gridIndex = GetRandomTileIndex(rng.Next()); + if (gridEntities[gridIndex]) continue; + + Random(); + if (gridIndex >= 0 && gridIndex < ROOM_GRID_CELLS && gridPaths[gridIndex] < GRID_PATH_BLOCKED) + grid_spawn(GRID_DECORATION, gridIndex); + attempt++; + } + } + } + if (is_greed() && config.type == ROOM_DEFAULT) + reconstruction_missing("Room::Init 007f2800: Greed's rocks around the center (GridEntity stays generated)"); +} + +// The first visit's items in the starting room: Isaac's Tomb's old chest, the pre-items seed's collectibles (two +// under the Curse of the Labyrinth), and Luna's light in secret rooms. +void Room::init_first_visit_items() +{ + PlayerManager& players = g_game->playerManager; + + if (g_game->currentRoomIdx == g_game->startingRoomIdx && g_game->stage != STAGE_HOME) + { + if (players.FirstCollectibleOwner(COLLECTIBLE_CARD_READING, LAZARUS_SHARE_CHECK) && !is_greed()) + reconstruction_missing("Room::Init 007f2800: the starting room's portals (FUN_00737c10)"); + if (players.FirstCollectibleOwner(COLLECTIBLE_THE_STAIRWAY, LAZARUS_SHARE_CHECK)) + reconstruction_missing("Room::Init 007f2800: effect 156's path to the entrance (is_obstacle_path_valid)"); + if (players.FirstCollectibleOwner(COLLECTIBLE_ISAACS_TOMB, LAZARUS_SHARE_CHECK)) + { + RNG rng = {descriptor->decorationSeed, 9, 21, 16}; + Vector center = GetCenterPos(); + entity_spawn(ENTITY_PICKUP, PICKUP_OLD_CHEST, vector_make(center.x + 0, center.y - 40), 0, rng.Next()); + } + if (g_game->seedEffects.HasSeedEffect(SEED_EFFECT_PRE_ITEMS)) + { + RNG rng = {descriptor->decorationSeed, 9, 21, 16}; + Vector center = GetCenterPos(); + Vector position = vector_make(center.x + 0, center.y - 40); + + if (is_curse_active(CURSE_OF_LABYRINTH)) + { + uint32_t seed = rng.Next(); + entity_spawn(ENTITY_PICKUP, PICKUP_COLLECTIBLE, vector_make(position.x + TREASURE_ITEM_SPACING, position.y - 0), + -1, seed); + position = vector_make(position.x - TREASURE_ITEM_SPACING, position.y + 0); + } + entity_spawn(ENTITY_PICKUP, PICKUP_COLLECTIBLE, position, -1, rng.Next()); + } + } + if ((roomType == ROOM_SECRET || roomType == ROOM_SUPERSECRET) && + players.FirstCollectibleOwner(COLLECTIBLE_LUNA, LAZARUS_SHARE_CHECK)) + { + RNG rng = {descriptor->decorationSeed, 9, 11, 19}; + uint32_t seed = rng.Next(); + entity_spawn(ENTITY_EFFECT, EFFECT_HEAVEN_LIGHT_DOOR, GetCenterPos(), 1, seed); + } +} + +// Whether a boss room loses its doors: Mom's (unless cleared in Backasswards), Mega Satan's (but in Backasswards), +// Ultra Greed's, the pre-Ascent Mom's Mausoleum boss, and the last boss room under the no-doors seed. +bool Room::is_boss_doors_removed() +{ + bool isBackasswardsClear = g_game->challenge == CHALLENGE_BACKASSWARDS && IsClear(); + + if ((bossId == BOSS_MOM || bossId == BOSS_MOM_MAUSOLEUM) && !isBackasswardsClear) return true; + if (bossId == BOSS_MEGA_SATAN && g_game->challenge != CHALLENGE_BACKASSWARDS) return true; + if (bossId == BOSS_ULTRA_GREED) return true; + if (roomType == ROOM_BOSS && descriptor->data->subtype == BOSS_MOM_MAUSOLEUM && g_game->IsPreAscent()) return true; + return g_game->seedEffects.HasSeedEffect(SEED_EFFECT_NO_LAST_BOSS_DOORS) && + g_game->GetRoomByIdx(g_game->currentRoomIdx)->listIndex == g_game->lastBossRoomListIdx; +} + +// A first visit's room type extras: an arcade counted, Isaac's and Barren rooms' carpet, and the dice room's floor. +void Room::init_first_visit_effects(RoomConfig_Room& config) +{ + if (config.type == ROOM_ARCADE) g_manager->persistentGameData.IncreaseEventCounter(EVENT_ARCADES_VISITED, 1); + else if ((config.type == ROOM_ISAACS || config.type == ROOM_BARREN) && g_game->currentRoomIdx != ROOM_GENESIS_IDX) + { + uint32_t seed = Random(); + entity_spawn(ENTITY_EFFECT, EFFECT_ISAACS_CARPET, GetCenterPos(), 0, seed)->Update(); + } + else if (config.type == ROOM_DICE) + { + RNG rng = {descriptor->spawnSeed, 5, 9, 7}; + uint32_t seed = Random(); + int face = (int)(rng.Next() % 6); + entity_spawn(ENTITY_EFFECT, EFFECT_DICE_FLOOR, GetCenterPos(), face, seed)->Update(); + } +} + +// A random point of the room's rectangle, its y drawn first. +static Vector room_random_point(Room& room) +{ + float y = (room.bottomRightPos.y - room.topLeftPos.y) * random_unit() + room.topLeftPos.y; + float x = (room.bottomRightPos.x - room.topLeftPos.x) * random_unit() + room.topLeftPos.x; + return vector_make(x, y); +} + +// Spawns an ambient effect at a random point and updates it once. +static void ambient_spawn(Room& room, int variant, int subType) +{ + Vector position = room_random_point(room); + entity_spawn(ENTITY_EFFECT, variant, position, subType, Random())->Update(); +} + +// A random count below max, then below that plus one, halved in the starting room. +static int ambient_count(RNG& rng, uint32_t max, int shift) +{ + return (int)(rng.RandomInt(rng.RandomInt(max) + 1) >> shift); +} + +// A first visit's ambient effects from the spawn seed: tiny flies, dust and droplets, wall bugs, embers and falling +// drops by stage, and the Downpour's tadpoles and ghosts. About half the rooms have none, but the Blue Womb, the super +// secret room, dark boss rooms, the Dross and the mineshaft always do. A planetarium only has its wisps. +void Room::init_ambient_effects(int effectiveStage, int stageId, uint32_t stageType) +{ + RNG rng = {descriptor->spawnSeed, 5, 9, 7}; + + if (backdropType == BACKDROP_PLANETARIUM) + { + uint32_t seed = rng.Next(); + int count = (int)rng.RandomInt(seed % 50 + 1); + for (int i = 0; i < count; i++) ambient_spawn(*this, EFFECT_WISP, 0); + return; + } + + bool isOdd = rng.Next() & 1; + bool isDarkBoss = is_curse_active(CURSE_OF_DARKNESS) && (roomType == ROOM_BOSS || roomType == ROOM_MINIBOSS); + bool isMineshaft = g_game->HasAbandonedMineshaft() && g_game->currentDimensionIdx == 1; + if (isOdd && stageId != STAGE_ID_BLUE_WOMB && roomType != ROOM_SUPERSECRET && !isDarkBoss && stageId != STAGE_ID_DROSS && + !isMineshaft) + return; + if (bossId == BOSS_MEGA_SATAN || roomType == ROOM_DUNGEON) return; + + PlayerManager& players = g_game->playerManager; + bool isMore = players.FirstCollectibleOwner(COLLECTIBLE_INFESTATION, LAZARUS_SHARE_CHECK) || + players.FirstCollectibleOwner(COLLECTIBLE_INFESTATION_2, LAZARUS_SHARE_CHECK) || + roomType == ROOM_SUPERSECRET || isMineshaft; + int extra = isMore ? 1 : 0; + uint32_t flyMax = (extra + 1) * AMBIENT_FLIES; + int shift = descriptor->gridIndex == g_game->startingRoomIdx ? 1 : 0; + + int flies = ambient_count(rng, flyMax, shift); + int dust = ambient_count(rng, (extra + 1) * AMBIENT_DUST, shift); + int droplets = ambient_count(rng, (extra + 1) * AMBIENT_DROPLETS, 0); + rng.RandomInt(rng.RandomInt((extra + 2) * AMBIENT_DROPLETS) + 1); + droplets >>= shift; + if (backdrop.configs[backdropType].walls == 0) droplets = 0; + if (effectiveStage == STAGE_BLUE_WOMB) dust = std::max(dust, 5); + if (stageId == STAGE_ID_DROSS) + { + dust *= 2; + droplets *= 3; + flies *= 2; + } + for (int i = 0; i < flies; i++) ambient_spawn(*this, EFFECT_TINY_BUG, 0); + for (int i = 0; i < dust; i++) ambient_spawn(*this, EFFECT_TINY_FLY, 0); + for (int i = 0; i < droplets; i++) entity_spawn(ENTITY_EFFECT, EFFECT_WALL_BUG, g_vectorOne, 0, Random())->Update(); + + bool isBugStage = effectiveStage == 3 || effectiveStage == 4 || effectiveStage == 7 || effectiveStage == 8 || + effectiveStage == STAGE_BLUE_WOMB; + if (isBugStage) + { + int bugs = ambient_count(rng, flyMax, shift); + if (effectiveStage == STAGE_BLUE_WOMB) bugs = std::max(bugs, 5); + for (int i = 0; i < bugs; i++) + for (int attempt = 0; attempt < AMBIENT_RETRIES; attempt++) + { + Vector position = room_random_point(*this); + if (GetGridCollision(GetGridIndex(position)) != GRID_COLLISION_NONE) continue; + entity_spawn(ENTITY_EFFECT, EFFECT_WORM, position, 1, Random())->Update(); + break; + } + } + + bool isRain = false; + if (effectiveStage == 10) + { + if (stageType == STAGETYPE_ORIGINAL) + { + int swarms = ambient_count(rng, flyMax, shift); + for (int i = 0; i < swarms * AMBIENT_RETRIES; i++) ambient_spawn(*this, EFFECT_WORM, 2); + } + } + else + { + if (effectiveStage == 3 || effectiveStage == 5 || effectiveStage == 6) + { + int embers = ambient_count(rng, flyMax, shift); + for (int i = 0; i < embers; i++) ambient_spawn(*this, EFFECT_BEETLE, 0); + } + isRain = effectiveStage == 11 && stageType == STAGETYPE_ORIGINAL; + } + if (!isRain) isRain = descriptor->data->type == ROOM_SECRET || is_curse_active(CURSE_OF_DARKNESS); + if (isRain && !(descriptor->flags & ROOM_DESCRIPTOR_FLAG_PITCH_BLACK)) + { + int drops = ambient_count(rng, extra * 20 + AMBIENT_RAIN, shift); + for (int i = 0; i < drops; i++) ambient_spawn(*this, EFFECT_WISP, 0); + } + + if (stageId != STAGE_ID_DOWNPOUR || waterAmount <= 0) return; + uint32_t seed = rng.Next(); + int ripples = (int)(rng.RandomInt(seed % 15 + 1) >> shift); + for (int i = 0; i < ripples; i++) + { + Vector position = room_random_point(*this); + if (!IsPositionInRoom(position, 0) || GetGridCollision(GetGridIndex(position)) >= 2) continue; + entity_spawn(ENTITY_EFFECT, EFFECT_TADPOLE, position, 0, Random())->Update(); + } + seed = rng.Next(); + int spawners = (int)(rng.RandomInt((seed & 3) + 1) >> shift); + for (int i = 0; i < spawners; i++) entity_spawn(ENTITY_EFFECT, EFFECT_LIL_GHOST, g_vectorZero, 0, Random())->Update(); +} + +// Counts the visit, and scores a first visit for the score sheet: the room type, once per cell of a big shape, at the +// floor's multiplier. +void Room::visit_record() +{ + descriptor->visitedCount++; + if (descriptor->visitedCount != 1) return; + + StageVisit visit = {(int)g_game->stage, (int)g_game->stageType, g_game->GetStateFlag(GAME_STATE_BACKWARDS_PATH)}; + float multiplier = g_game->scoreSheet.stage_multiplier_get(visit); + if (multiplier <= 0) return; + + RoomScore score = {multiplier, roomType, (descriptor->flags & ROOM_DESCRIPTOR_FLAG_RED_ROOM) != 0}; + int weight = room_shape_weight_get(descriptor->data->shape); + for (int i = 0; i < weight; i++) g_game->scoreSheet.visitedRooms.push_back(score); +} + +// Sets a color's colorize channels. +static void colorize_set(ColorMod& color, std::array colorize) +{ + std::copy(colorize.begin(), colorize.end(), color._colorize); +} + +// The floor and wall tints: red for a red room (but Ultra Greed's shop) and the ultra secret room, gold on the +// Ascent, and grey for the pre-items seed's Flooded Caves. +void Room::init_colors() +{ + bool isRedRoom = descriptor->flags & ROOM_DESCRIPTOR_FLAG_RED_ROOM && backdropType != BACKDROP_CLOSET_B; + + if (isRedRoom) + { + colorize_set(floorColor, {1, 0, 0, 0.3f}); + colorize_set(wallColor, {1, 0.2f, 0.2f, 0.8f}); + } + else if (roomType == ROOM_ULTRASECRET) + { + colorize_set(floorColor, {1, 0.7f, 0.7f, 0.6f}); + colorize_set(wallColor, {1, 0.4f, 0.4f, 0.6f}); + } + else if (is_backwards_path()) + { + floorColor = ASCENT_COLOR; + wallColor = ASCENT_COLOR; + } + else if (backdropType == BACKDROP_FLOODED_CAVES && g_game->seedEffects.HasSeedEffect(SEED_EFFECT_PRE_ITEMS)) + { + floorColor = GREY_COLOR; + wallColor = GREY_COLOR; + } + if (is_ashpit_rays()) reconstruction_missing("Room::Init 007f2800: Ashpit's light ray textures"); +} + +// 008242f0 Whether the floor is the Ashpit, whose rooms load light ray textures. The mirror world never is. +bool Room::is_ashpit_rays() +{ + if (g_game->challenge == CHALLENGE_RED_REDEMPTION) + return RoomConfig::GetStageID((int)g_game->stage, g_game->GetRoomStageType(g_game->currentRoomIdx), + ROOM_MODE_CURRENT) == STAGE_ID_ASHPIT; + if (g_game->currentDimensionIdx == 2) return false; + return RoomConfig::GetStageID((int)g_game->stage, (int)g_game->stageType, ROOM_MODE_CURRENT) == STAGE_ID_ASHPIT; +} + +// The mineshaft's blue tint, or the super secret room's warm one. +void Room::init_mineshaft_colors() +{ + if (g_game->HasAbandonedMineshaft() && g_game->currentDimensionIdx == 1) + { + colorize_set(floorColor, {0.9f, 0.8f, 1, floorColor._colorize[3]}); + colorize_set(wallColor, {0.9f, 0.8f, 1, wallColor._colorize[3]}); + } + else if (roomType == ROOM_SUPERSECRET) + { + colorize_set(floorColor, {1, 0.9f, 0.8f, floorColor._colorize[3]}); + colorize_set(wallColor, {1, 0.9f, 0.8f, wallColor._colorize[3]}); + } + else return; + wallColor._colorize[3] = 0.5f; + floorColor._colorize[3] = 0.4f; +} + +// 007f20e0 The grid index of a door slot's cell in a room of a shape and size. A slot out of range is the first. +int room_shape_get_door_grid_index(int doorSlot, int width, int height, int shape) +{ + int top = 0; + int bottom = height - 1; + int left = 0; + int right = width - 1; + + if (doorSlot < 0 || doorSlot >= DOOR_SLOT_COUNT) doorSlot = DOOR_LEFT0; + if (shape >= ROOMSHAPE_LTL && shape <= ROOMSHAPE_LBR) + for (const DoorCell& door : L_CORNER_DOORS[shape - ROOMSHAPE_LTL]) + if (door.slot == doorSlot) return door.row * width + door.column; + if (shape == ROOMSHAPE_IH || shape == ROOMSHAPE_IIH) + { + top = NARROW_ROW_INSET; + bottom -= NARROW_ROW_INSET; + } + else if (shape == ROOMSHAPE_IV || shape == ROOMSHAPE_IIV) + { + left = NARROW_COLUMN_INSET; + right -= NARROW_COLUMN_INSET; + } + + int half = doorSlot >= DOOR_LEFT1 ? 1 : 0; + switch (doorSlot - half * DOOR_LEFT1) + { + case DOOR_UP0: return top * width + DOOR_COLUMNS[half]; + case DOOR_RIGHT0: return DOOR_ROWS[half] * width + right; + case DOOR_DOWN0: return bottom * width + DOOR_COLUMNS[half]; + default: return DOOR_ROWS[half] * width + left; + } +} + +// Collects Lua's garbage after a room loads and logs what it still uses. +static void lua_garbage_collect() +{ + lua_State* state = static_cast(g_luaEngine)->state; + + lua_gc(state, LUA_GCCOLLECT, 0); + int bytes = lua_gc(state, LUA_GCCOUNTB, 0); + int kilobytes = lua_gc(state, LUA_GCCOUNT, 0); + std::string log = "Lua mem usage: " + std::to_string(kilobytes) + " KB and " + std::to_string(bytes) + " bytes\n"; + KAGE_LogMessage(LOG_INFO, (uint8_t*)log.c_str()); +} + +// 00428a50 The room's entity list. +EntityList* Room::GetEntities() +{ + return &entityList; +} + +// 0042a270 The layout's shape, or 1x1 without one. +int Room::GetRoomShape() +{ + return descriptor && descriptor->data ? descriptor->data->shape : ROOMSHAPE_1x1; +} + +// 004566a0 How many cells the grid has. +int Room::GetGridSize() +{ + return gridHeight * gridWidth; +} + +// 00436060 The grid entity on a cell, or none past the grid. +GridEntity* Room::GetGridEntity(uint32_t gridIndex) +{ + return gridIndex < ROOM_GRID_CELLS ? gridEntities[gridIndex] : nullptr; +} + +// 00436020 The door in a slot, or none past the slots. The original's check lets slot 8 read past them. It is none. +GridEntity_Door* Room::GetDoor(int slot) +{ + return slot >= 0 && slot < DOOR_SLOT_COUNT ? doors[slot] : nullptr; +} + +// 004565c0 A cell's grid path, or 0 past the grid. +int Room::GetGridPath(int gridIndex) +{ + return (uint32_t)gridIndex < ROOM_GRID_CELLS ? gridPaths[gridIndex] : 0; +} + +// 0042a290 Sets a cell's grid path, unless past the grid. +bool Room::SetGridPath(int gridIndex, int value) +{ + if ((uint32_t)gridIndex >= ROOM_GRID_CELLS) return false; + gridPaths[gridIndex] = value; + return true; +} + +// 00812c90 The cell a world position falls on, or -1 off the grid. +int Room::GetGridIndex(Vector position) +{ + int column = (int)((position.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + 0.5f); + int row = (int)((position.y - GRID_ORIGIN_Y) / GRID_CELL_SIZE + 0.5f); + return GetGridIndexByTile(column, row); +} + +// 00812e60 The cell at a column and row, or -1 off the grid. +int Room::GetGridIndexByTile(int column, int row) +{ + if (column < 0 || column >= gridWidth || row < 0 || row >= gridHeight) return -1; + return gridWidth * row + column; +} + +// 00812f00 A cell's center in the world. +Vector Room::GetGridPosition(int gridIndex) +{ + return vector_make((float)(gridIndex % gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_X, + (float)(gridIndex / gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_Y); +} + +// 00436090 A position kept a margin inside the room's floor. +Vector Room::GetClampedPosition(Vector position, float margin) +{ + return GetClampedPositionImpl(position, margin, margin, margin, margin); +} + +// 0081f8b0 An L-shaped room's two floor rectangles in the world, or the room's rectangle twice. +LRoomAreaDesc Room::GetLRoomAreaDesc() +{ + if (!IsLShapedRoom()) return {topLeftPos, bottomRightPos, topLeftPos, bottomRightPos}; + + const ShapeTiles& tiles = SHAPE_TILES[descriptor->data->shape]; + float half = GRID_CELL_SIZE / 2; + Vector topLeftA = GetGridPosition(GetGridIndexByTile(tiles.topLeftAX, tiles.topLeftAY)); + Vector bottomRightA = GetGridPosition(GetGridIndexByTile(tiles.bottomRightAX, tiles.bottomRightAY)); + Vector topLeftB = GetGridPosition(GetGridIndexByTile(tiles.topLeftBX, tiles.topLeftBY)); + Vector bottomRightB = GetGridPosition(GetGridIndexByTile(tiles.bottomRightBX, tiles.bottomRightBY)); + + return {vector_make(topLeftA.x - half, topLeftA.y - half), vector_make(bottomRightA.x + half, bottomRightA.y + half), + vector_make(topLeftB.x - half, topLeftB.y - half), vector_make(bottomRightB.x + half, bottomRightB.y + half)}; +} + +// 00812f50 A position kept inside the room's floor by a margin on each side. An L-shaped room pushes a position in +// its missing corner out along the nearer edge. +Vector Room::GetClampedPositionImpl(Vector position, float marginTop, float marginRight, float marginBottom, + float marginLeft) +{ + if (!descriptor || !descriptor->data) return position; + + float x = std::min(std::max(position.x, marginLeft + topLeftPos.x), bottomRightPos.x - marginRight); + float y = std::min(std::max(position.y, marginTop + topLeftPos.y), bottomRightPos.y - marginBottom); + if (!IsLShapedRoom()) return vector_make(x, y); + + LRoomAreaDesc area = GetLRoomAreaDesc(); + float leftA = area.topLeftA.x + marginLeft; + float rightA = area.bottomRightA.x - marginRight; + float leftB = area.topLeftB.x + marginLeft; + float rightB = area.bottomRightB.x - marginRight; + float notchY = rightB - leftB <= rightA - leftA ? area.bottomRightA.y - marginBottom : area.topLeftB.y + marginTop; + + switch (descriptor->data->shape) + { + case ROOMSHAPE_LTL: + if (leftA <= x || notchY <= y) return vector_make(x, y); + return leftA - x < notchY - y ? vector_make(leftA, y) : vector_make(x, notchY); + case ROOMSHAPE_LTR: + if (x <= rightA || notchY <= y) return vector_make(x, y); + return x - rightA < notchY - y ? vector_make(rightA, y) : vector_make(x, notchY); + case ROOMSHAPE_LBL: + if (leftB <= x || y <= notchY) return vector_make(x, y); + return leftB - x < y - notchY ? vector_make(leftB, y) : vector_make(x, notchY); + default: + if (x <= rightB || y <= notchY) return vector_make(x, y); + return x - rightB < y - notchY ? vector_make(rightB, y) : vector_make(x, notchY); + } +} + +// 00812d00 The room's center: its rectangle's, or for an L shape the middle of its bigger arm. +Vector Room::GetCenterPos() +{ + Room& room = *g_game->room; + int centerIndex = -1; + + switch (room.descriptor->data->shape) + { + case ROOMSHAPE_LTL: + centerIndex = 0x148; + break; + case ROOMSHAPE_LTR: + centerIndex = 0x13b; + break; + case ROOMSHAPE_LBL: + centerIndex = 0x84; + break; + case ROOMSHAPE_LBR: + centerIndex = 0x77; + break; + default: + return vector_make((room.bottomRightPos.x - room.topLeftPos.x) * 0.5f + room.topLeftPos.x, + (room.bottomRightPos.y - room.topLeftPos.y) * 0.5f + room.topLeftPos.y); + } + return room.GetGridPosition(centerIndex); +} + +// 0081e9d0 A random position on the floor a margin inside it. +Vector Room::GetRandomPosition(float margin) +{ + if (!IsLShapedRoom()) + { + float x = random_unit(); + float y = random_unit(); + Vector position = vector_make((bottomRightPos.x - topLeftPos.x) * x + topLeftPos.x, + (bottomRightPos.y - topLeftPos.y) * y + topLeftPos.y); + return GetClampedPositionImpl(position, margin, margin, margin, margin); + } + reconstruction_missing("Room::GetRandomPosition 0081e9d0: L-shaped rooms"); +} + +// 0081ecc0 A random floor cell from a seed. L-shaped rooms are not reconstructed yet. +int Room::GetRandomTileIndex(uint32_t seed) +{ + if (IsLShapedRoom()) reconstruction_missing("Room::GetRandomTileIndex 0081ecc0: L-shaped rooms (LRoomTileDesc)"); + + const ShapeTiles& tiles = SHAPE_TILES[descriptor->data->shape]; + RNG rng = {seed, 1, 9, 29}; + int column = (int)rng.RandomInt(tiles.bottomRightAX - tiles.topLeftAX) + tiles.topLeftAX; + int row = (int)rng.RandomInt(tiles.bottomRightAY - tiles.topLeftAY) + tiles.topLeftAY; + return GetGridIndexByTile(column, row); +} + +// 00813360 Whether a position lies on the floor a margin inside it. +bool Room::IsPositionInRoom(Vector position, float margin) +{ + if (IsLShapedRoom()) + { + Vector clamped = GetClampedPositionImpl(position, margin, margin, margin, margin); + return clamped.x == position.x && clamped.y == position.y; + } + return margin + topLeftPos.x <= position.x && position.x <= bottomRightPos.x - margin && + margin + topLeftPos.y <= position.y && position.y <= bottomRightPos.y - margin; +} + +// 007f0800 What a cell blocks (Lua's GridCollisionClass): its grid entity's class, or a pit or nothing by the path +// left on it. Off the grid is wall, and the Beast's arena blocks nothing. +uint32_t Room::GetGridCollision(int gridIndex) +{ + if (IsBeastDungeon()) return GRID_COLLISION_NONE; + if (gridIndex < 0) return GRID_COLLISION_WALL; + if (gridEntities[gridIndex]) return (uint32_t)gridEntities[gridIndex]->_collisionClass; + + int path = gridPaths[gridIndex]; + if (path < GRID_PATH_UNIT) return GRID_COLLISION_NONE; + if (path >= GRID_PATH_PIT && path <= GRID_PATH_PIT_LAST) return GRID_COLLISION_PIT; + return GRID_COLLISION_SOLID; +} + +// 00436050 The descriptor's spawn seed, or 0 without one. +uint32_t Room::GetSpawnSeed() +{ + return descriptor ? descriptor->spawnSeed : 0; +} + +// 004aae80 The descriptor's decoration seed, or 0 without one. +uint32_t Room::GetDecorationSeed() +{ + return descriptor ? descriptor->decorationSeed : 0; +} + +// 0085e100 The descriptor's award seed, or 0 without one. +uint32_t Room::GetAwardSeed() +{ + return descriptor ? descriptor->awardSeed : 0; +} + +// 007537e0 The descriptor's distance from Delirium, or 0 without one. +int Room::GetDeliriumDistance() +{ + return descriptor ? descriptor->deliriumDistance : 0; +} + +// 007eece0 The stage id of the layout, or the special rooms' (0) without one. +int Room::GetRoomConfigStage() +{ + if (descriptor && descriptor->data) return descriptor->data->stageId; + KAGE_LogMessage(LOG_WARN, (uint8_t*)"Room stage config is missing, returning a default one (SPECIAL)!\n"); + return 0; +} + +// 006b8410 Whether the layout has any of a mask's flags. +bool Room::has_room_config_flag(uint32_t mask) +{ + return descriptor && descriptor->data && (descriptor->data->flags & mask) != 0; +} + +// 00436080 Whether the room is cleared. +bool Room::IsClear() +{ + return descriptor->flags & ROOM_DESCRIPTOR_FLAG_CLEAR; +} + +// 004aae90 Marks the room cleared or not. +void Room::SetClear(bool isClear) +{ + uint32_t& flags = descriptor->flags; + flags = isClear ? flags | ROOM_DESCRIPTOR_FLAG_CLEAR : flags & ~ROOM_DESCRIPTOR_FLAG_CLEAR; +} + +// 005cd650 Whether the sacrifice room paid out. +bool Room::IsSacrificeDone() +{ + return descriptor->flags & ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE; +} + +// 004aaeb0 Marks the sacrifice room paid out or not. +void Room::SetSacrificeDone(bool isDone) +{ + uint32_t& flags = descriptor->flags; + flags = isDone ? flags | ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE : flags & ~ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE; +} + +// 0070c560 Whether the challenge room's ambush is done. +bool Room::IsAmbushDone() +{ + return descriptor->flags & ROOM_DESCRIPTOR_FLAG_CHALLENGE_DONE; +} + +// 008332c0 Marks the challenge room's ambush done or not. +void Room::SetAmbushDone(bool isDone) +{ + uint32_t& flags = descriptor->flags; + flags = isDone ? flags | ROOM_DESCRIPTOR_FLAG_CHALLENGE_DONE : flags & ~ROOM_DESCRIPTOR_FLAG_CHALLENGE_DONE; +} + +// 00505c40 Whether the room's pits are water. +bool Room::HasWaterPits() +{ + return descriptor->flags & ROOM_DESCRIPTOR_FLAG_HAS_WATER; +} + +// 0059e250 Whether the layout allows a door in a slot. +bool Room::IsDoorSlotAllowed(int slot) +{ + return (uint32_t)slot < DOOR_SLOT_COUNT && (descriptor->data->doors & 1u << slot) != 0; +} + +// 004566b0 The enemies alive, never below 0. +int Room::GetAliveEnemiesCount() +{ + return std::max(entityList.enemyCount + entityList.pendingEnemyCount, 0); +} + +// 004566d0 The bosses alive, never below 0. +int Room::GetAliveBossesCount() +{ + return std::max(entityList.bossCount + entityList.pendingBossCount, 0); +} + +// 00456710 Whether the room is slowed down. +bool Room::HasSlowDown() +{ + return slowdownDuration > 0; +} + +// 00456720 Slows the room down for at least a duration. +void Room::SetSlowDown(int duration) +{ + slowdownDuration = std::max(duration, slowdownDuration); +} + +// 00813ce0 How many frames since the room was entered, or -1 before it is initialized. +int Room::GetFrameCount() +{ + return isInitialized ? g_game->frameCount - enterFrame : -1; +} + +// 0081f890 Whether the layout is one of the four L shapes. +bool Room::IsLShapedRoom() +{ + return (uint32_t)(descriptor->data->shape - ROOMSHAPE_LTL) < 4; +} + +// 008279a0 Whether the room is the Beast's arena, the Home floor's dungeon. +bool Room::IsBeastDungeon() +{ + RoomConfig_Room* data = descriptor->data; + return data && data->type == ROOM_DUNGEON && data->stageId == STAGE_ID_HOME; +} + +// 00827b70 Whether the players are in the mirror world: the second floor of the alternate path's second dimension, +// or the first floor's under the Curse of the Labyrinth. +bool Room::IsMirrorWorld() +{ + bool isAltStage = g_game->stageType == STAGETYPE_REPENTANCE || g_game->stageType == STAGETYPE_REPENTANCE_B; + if (g_game->currentDimensionIdx != 1 || !isAltStage) return false; + return g_game->stage == 2 || (g_game->stage == 1 && g_game->GetCurses() & CURSE_OF_LABYRINTH); +} + +// 00827bb0 Whether the room has the cursed mist. +bool Room::HasCurseMist() +{ + return descriptor->flags & ROOM_DESCRIPTOR_FLAG_CURSED_MIST; +} + +// 008208c0 Whether the room shows water. +bool Room::HasWater() +{ + return waterAmount > 0; +} + +// 008242d0 Whether the room's pits are lava: the Mines backdrop's water pits. +bool Room::HasLava() +{ + return backdropType == BACKDROP_MINES && descriptor->flags & ROOM_DESCRIPTOR_FLAG_HAS_WATER; +} + +// 008208e0 Whether the players are in the floor's last boss room. +bool Room::IsCurrentRoomLastBoss() +{ + return g_game->GetRoomByIdx(g_game->currentRoomIdx)->listIndex == g_game->lastBossRoomListIdx; +} + +// 007ea260 Pauses the enemies (and versus players, slots and effects) for a duration. +void Room::SetPauseTimer(int duration) +{ + for (Entity* entity : entityList.updateEL) + { + bool isVersusPlayer = g_game->deathmatchManager.state >= DEATHMATCH_INTRO && entity->type == ENTITY_PLAYER; + bool isEnemy = entity->type - 10u < 0x3de; + if (isVersusPlayer || isEnemy || entity->type == ENTITY_PROJECTILE || entity->type == ENTITY_EFFECT) entity->pauseTimer = duration; + } +} + +// 0081edd0 The Broken Watch's state, always fast in SPEED!. +BrokenWatchState Room::GetBrokenWatchState() +{ + return g_game->challenge == CHALLENGE_SPEED ? BROKEN_WATCH_FAST : brokenWatchState; +} + +// 0081edf0 Sets the Broken Watch's state and the music's pitch to the time scale. +void Room::SetBrokenWatchState(BrokenWatchState state) +{ + brokenWatchState = state; + g_manager->musicManager.targetPitch = time_scale_update(); +} + +// 007ea2d0 How fast time runs in the room: eased down by the time slowing effect, slowed by the watches and their +// effects, sped up by the Broken Watch and SPEED!, plus a tenth per G-Fuel past the first. +float Room::time_scale_update() +{ + float timeScale = 1; + + if (TemporaryEffect* astral = temporaryEffects.GetCollectibleEffect(COLLECTIBLE_ASTRAL_PROJECTION)) + { + float ease = std::clamp(((float)astral->cooldown - 0) / TIME_SCALE_EASE_FRAMES, 0.0f, 1.0f); + timeScale = std::max(1 - ease * TIME_SCALE_EASE_DEPTH, TIME_SCALE_EASE_MIN); + } + else if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_STOP_WATCH) || + temporaryEffects.HasCollectibleEffect(COLLECTIBLE_HOURGLASS)) + timeScale = TIME_SCALE_SLOW; + else if (g_game->challenge == CHALLENGE_SPEED || brokenWatchState == BROKEN_WATCH_FAST) timeScale = TIME_SCALE_FAST; + else if (brokenWatchState == BROKEN_WATCH_SLOW) timeScale = TIME_SCALE_SLOW; + else if (g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_STOP_WATCH, LAZARUS_SHARE_CHECK)) + timeScale = TIME_SCALE_STOP_WATCH; + + int extraGFuel = std::max(g_game->playerManager.GetGFuelCount() - 1, 0); + return (float)extraGFuel * TIME_SCALE_PER_GFUEL + timeScale; +} + +// 008206e0 A boss's track when it has none of its own: the alternate path's, or one of two by the room's flag. +int Room::boss_music_get() +{ + if (g_game->stageType == STAGETYPE_REPENTANCE || g_game->stageType == STAGETYPE_REPENTANCE_B) return MUSIC_BOSS3; + return descriptor->flags & ROOM_DESCRIPTOR_FLAG_ALT_BOSS_MUSIC ? MUSIC_BOSS2 : MUSIC_BOSS; +} + +// Crossfades to a track, or plays it at the music volume at once. +static void music_switch(int music, float crossfade) +{ + MusicManager& musicManager = g_manager->musicManager; + + if (crossfade < MUSIC_CROSSFADE_INSTANT) musicManager.Crossfade(music, crossfade); + else musicManager.Play(music, g_manager->optionsConfig.musicVolume); +} + +// The track a room plays by its type, boss and state, or the stage's own, and the jingle a first treasure room +// plays. The dark closet's Dogma track starts at once. +static int room_music_get(Room& room, uint32_t stage, uint32_t stageType, int stageId, int& jingle, float& crossfade) +{ + uint32_t flags = room.descriptor->flags; + RoomConfig_Room* data = room.descriptor->data; + int stageMusic = g_game->roomConfig.stages[stageId].musicId; + + if (room.roomType == ROOM_BOSS) + { + if (flags & ROOM_DESCRIPTOR_FLAG_CLEAR) return MUSIC_BOSS_OVER; + switch (room.bossId) + { + case BOSS_MOM: + return MUSIC_MOM_BOSS; + case 8: + case 25: + return MUSIC_MOMS_HEART_BOSS; + case BOSS_SATAN: + case BOSS_MEGA_SATAN: + return MUSIC_DEVIL_ROOM; + case BOSS_ISAAC: + return MUSIC_ISAAC_BOSS; + case 40: + case 63: + return MUSIC_CHEST_BOSS; + case 54: + return MUSIC_DARK_ROOM_BOSS; + case BOSS_ULTRA_GREED: + return MUSIC_ULTRA_GREED_BOSS; + case 70: + return MUSIC_VOID_BOSS; + case 88: + return MUSIC_MOTHER_BOSS; + default: + return room.boss_music_get(); + } + } + if (room.roomType == ROOM_MINIBOSS || g_game->room->isSurpriseMiniboss) + return flags & ROOM_DESCRIPTOR_FLAG_CLEAR ? MUSIC_BOSS_OVER : MUSIC_CHALLENGE_FIGHT; + + switch (room.roomType) + { + case ROOM_SHOP: + return MUSIC_SHOP_ROOM; + case ROOM_LIBRARY: + return MUSIC_LIBRARY_ROOM; + case ROOM_ANGEL: + return MUSIC_ANGEL_ROOM; + case ROOM_ARCADE: + return MUSIC_ARCADE_ROOM; + case ROOM_DEVIL: + return MUSIC_DEVIL_ROOM; + case ROOM_SECRET: + return MUSIC_SECRET_ROOM; + case ROOM_SUPERSECRET: + return MUSIC_SECRET_ROOM_ALT; + case ROOM_ULTRASECRET: + return MUSIC_SECRET_ROOM_ALT_ALT; + case ROOM_SECRET_EXIT: + return MUSIC_BOSS_OVER; + case ROOM_CHALLENGE: + if (flags & ROOM_DESCRIPTOR_FLAG_CHALLENGE_DONE) return MUSIC_BOSS_OVER; + break; + default: + break; + } + + if (g_game->currentRoomIdx == ROOM_GIDEON_DUNGEON_IDX) return MUSIC_BOSS_OVER; + if (room.roomType == ROOM_PLANETARIUM) return MUSIC_PLANETARIUM; + if (room.roomType == ROOM_DUNGEON && data && data->subtype == DUNGEON_BEAST) return MUSIC_BEAST_BOSS; + if (stage == STAGE_HOME && stageType == STAGETYPE_WOTL) + { + if ((flags & (ROOM_DESCRIPTOR_FLAG_CLEAR | ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE)) != ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE) + return stageMusic; + crossfade = MUSIC_CROSSFADE_INSTANT; + return MUSIC_DOGMA_BOSS; + } + if (room.roomType == ROOM_DUNGEON && data && (data->subtype == DUNGEON_ROTGUT || data->subtype == DUNGEON_ROTGUT_HEART)) + return room.boss_music_get(); + if (room.roomType == ROOM_TREASURE && room.isFirstVisit) + jingle = (int)(Random() & (TREASURE_JINGLE_COUNT - 1)) + MUSIC_TREASURE_JINGLE_FIRST; + return stageMusic; +} + +// 007eb1b0 Plays the room's track, crossfading from the last one (slowly between Downpour and its reversed track, +// at once out of the Beast's), and a treasure room's jingle. Floors and dimensions override +// it: the Blue Womb's own music, the Mausoleum heart's, the death certificate's, the mirror world, the mineshaft and +// the Ascent. While the game's start jingle plays, the track only queues. +void Room::PlayMusic() +{ + uint32_t stage = g_game->stage; + uint32_t stageType = g_game->stageType; + + if (g_game->challenge == CHALLENGE_RED_REDEMPTION) stageType = (uint32_t)g_game->GetRoomStageType(g_game->currentRoomIdx); + if (g_game->challenge == CHALLENGE_DELETE_THIS) + reconstruction_missing("Room::PlayMusic 007eb1b0: DELETE THIS's random stage music"); + + int jingle = 0; + float crossfade = MUSIC_CROSSFADE; + int stageId = RoomConfig::GetStageID((int)stage, (int)stageType, ROOM_MODE_CURRENT); + int music = room_music_get(*this, stage, stageType, stageId, jingle, crossfade); + + if (!is_greed() && stage == STAGE_BLUE_WOMB && roomType != ROOM_BOSS) + { + music = g_game->roomConfig.stages[stageId].musicId; + jingle = 0; + } + if (g_game->IsMausoleumHeartStage()) + { + bool isHeartRoom = g_game->currentRoomIdx == ROOM_SECRET_EXIT_IDX; + if (!isHeartRoom) crossfade = MUSIC_CROSSFADE_INSTANT; + music = isHeartRoom ? MUSIC_NULL : MUSIC_BOSS_OVER_TWISTED; + jingle = 0; + } + + bool isBossArena = roomType == ROOM_BOSS || roomType == ROOM_MINIBOSS || g_game->room->isSurpriseMiniboss; + if (g_game->currentDimensionIdx == 2) + { + music = MUSIC_ECHOES_REVERSE; + jingle = 0; + } + else if (g_game->HasMirrorDimension() && g_game->currentDimensionIdx == 1 && !isBossArena) + { + music = MUSIC_DOWNPOUR_REVERSED + (stageId == STAGE_ID_DROSS ? 1 : 0); + jingle = 0; + } + else if (g_game->HasAbandonedMineshaft() && g_game->currentDimensionIdx == 1) + { + jingle = 0; + music = MUSIC_ABANDONED_MINESHAFT + (g_game->levelStateFlags & LEVEL_STATE_MINESHAFT_ESCAPE ? 1 : 0); + } + else if (g_game->stage >= 1 && g_game->stage <= 6 && g_game->GetStateFlag(GAME_STATE_BACKWARDS_PATH)) + { + music = MUSIC_REVERSE_GENESIS; + jingle = 0; + } + + MusicManager& musicManager = g_manager->musicManager; + int current = musicManager.currentMusicId; + int queued = musicManager.queuedMusicId != 0 ? musicManager.queuedMusicId : current; + bool isDownpourSwap = (current == MUSIC_DOWNPOUR && music == MUSIC_DOWNPOUR_REVERSED) || + (current == MUSIC_DOWNPOUR_REVERSED && music == MUSIC_DOWNPOUR); + + if (isDownpourSwap) crossfade = MUSIC_CROSSFADE_ASCENT; + else if (current == MUSIC_HUSH_TRANSITION) crossfade = MUSIC_CROSSFADE_REVERSE; + else if (current == MUSIC_BEAST_BOSS) crossfade = MUSIC_CROSSFADE_INSTANT; + else if (current == MUSIC_GAME_START_JINGLE || current == MUSIC_REVERSE_GENESIS_START) + { + if (musicManager.is_music_id_valid(music)) musicManager.queuedMusicId = music; + musicManager.targetPitch = time_scale_update(); + return; + } + + bool isChange = (queued == 0 && current != music) || queued != music; + if (jingle != 0) + { + musicManager.PlayJingle(jingle); + if (music != 0 && isChange) music_switch(music, crossfade); + } + else if (isChange) + { + if (music == 0) + { + musicManager.channels[musicManager.currentChannel].targetVolume = 0; + musicManager.channels[musicManager.currentChannel].fadeRate = MUSIC_CROSSFADE; + musicManager.queuedMusicId = 0; + } + else music_switch(music, crossfade); + musicManager.jingle.volume = 0; + musicManager.jingleTimer = JINGLE_TIMER_RESTORE; + } + musicManager.targetPitch = time_scale_update(); +} + + +// The first frame's work: a boss room's roar on the first visit (but Greed's first boss before it spawns), and the +// Myosotis pickups carried from the last floor into the floor's first room. +void Room::first_frame_update() +{ + bool isGreedBossPending = is_greed() && g_game->stage == 7 && descriptor->data->subtype == 0 && + !(g_game->levelStateFlags & LEVEL_STATE_GREED_MONSTRO_SPAWNED); + if (roomType == ROOM_BOSS && descriptor->visitedCount == 1 && !isGreedBossPending && bossId != 0) + { + int sound = SOUND_BOSS_ROAR; + seed_fart_sound_override(&sound); + g_manager->sfxManager.Play(sound); + } + if (g_game->levelStateFlags & LEVEL_STATE_LEVEL_START_TRIGGERED) return; + g_game->levelStateFlags |= LEVEL_STATE_LEVEL_START_TRIGGERED; + if (!g_game->myosotisPickups.empty()) reconstruction_missing("Room::Update 00802980: the Myosotis pickups"); +} + +// 00802980 Runs the room for a frame: its first frame's extras, timers, the grid paths fading, removed grid entities, +// the entity list and effect layers, the floor sprite and the Beast's arena, temporary effects, the clear check with +// its doors, pressure plates and door transitions, and the ambient spawns, sounds and water. +// Only the start is reconstructed. Grid entities stay generated, so any in the room stops it. +void Room::Update() +{ + isUnknown7220 = false; + if (isInitialized && g_game->frameCount - enterFrame == 1) first_frame_update(); + if (genesisTimer >= 0) + { + if (genesisTimer == 0 && g_game->currentRoomIdx == ROOM_GENESIS_IDX) + reconstruction_missing("Room::Update 00802980: Genesis's items"); + genesisTimer--; + } + isExorcistActive = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_VADE_RETRO, LAZARUS_SHARE_CHECK) != nullptr; + if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_ASTRAL_PROJECTION)) + g_manager->musicManager.targetPitch = time_scale_update(); + if (!temporaryEffects.isDisabled && temporaryEffects.HasNullEffect(NULL_EFFECT_POOP_CLOUD)) fxLayers.AddPoopFx(POOP_FX_COLOR); + if (descriptor->gridIndex == ROOM_LIL_PORTAL_IDX) reconstruction_missing("Room::Update 00802980: the Lil Portal room"); + + bool isEnterFrame = isInitialized && g_game->frameCount == enterFrame; + bool isHasEntities = !entityList.updateEL.empty(); + if (isEnterFrame && isHasEntities && g_game->challenge == CHALLENGE_SEEING_DOUBLE) + reconstruction_missing("Room::Update 00802980: Seeing Double's doubled enemies"); + if (isEnterFrame && g_game->playerManager.GetGFuelCount() > 3 && isHasEntities) + reconstruction_missing("Room::Update 00802980: G-Fuel's champions"); + + if (waterLerpColorCountdown > 0) waterLerpColorCountdown--; + if (!pendingGridRemovals.empty()) + { + for (int gridIndex : pendingGridRemovals) + { + if (gridIndex < 0 || gridIndex >= gridWidth * gridHeight || !gridEntities[gridIndex]) continue; + delete gridEntities[gridIndex]; + gridEntities[gridIndex] = nullptr; + } + pendingGridRemovals.clear(); + } + for (int i = 0; i < gridWidth * gridHeight; i++) + if (gridEntities[i]) reconstruction_missing("Room::Update 00802980: grid entities' updates (GridEntity stays generated)"); + if (g_game->frameCount % GRID_PATH_DECAY_FRAMES == 0) grid_paths_decay(); + + bool isKeyPieceWatch = g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_BROKEN_SHOVEL, LAZARUS_SHARE_CHECK); + Room& current = *g_game->room; + if (isKeyPieceWatch && isInitialized && g_game->frameCount - enterFrame == 4 && current.roomType == ROOM_BOSSRUSH && + !(current.descriptor->flags & ROOM_DESCRIPTOR_FLAG_CHALLENGE_DONE)) + { + if (!entities_any(entityList, ENTITY_PICKUP, PICKUP_COLLECTIBLE)) g_game->ambush.StartChallenge(); + } + if ((roomType == ROOM_CHALLENGE || roomType == ROOM_BOSSRUSH) && g_game->ambush._isActive) g_game->ambush.Update(); + if (isCardAgainstHumanity) card_against_humanity_fill(); + + int bosses = GetAliveBossesCount(); + if (bosses < 1 && lastAliveBossCount > 0) + { + if (g_manager->netplayManager.is_online()) + { + std::string frame = "[Frame " + std::to_string(g_game->frameCount) + "] "; + KAGE_LogMessage(LOG_INFO, (uint8_t*)frame.c_str()); + } + KAGE_LogMessage(LOG_INFO, (uint8_t*)"[warn] last boss died without triggering the deathspawn.\n"); + } + lastAliveBossCount = bosses; + entityList.Update(UPDATE_NORMAL); + fxLayers.Update(PLAYER_FOLLOW_EASE); + reconstruction_missing("Room::Update 00802980: from the floor sprite's animation on (the clear check, doors, " + "pressure plates and ambient spawns)"); +} + +// The grid paths an entity left fade a step every few frames, back to 900 from a permanent mark, and the cells' +// timers count down. +void Room::grid_paths_decay() +{ + for (int i = 0; i < gridWidth * gridHeight; i++) + { + int path = gridPaths[i]; + int fade = path % GRID_PATH_UNIT; + + if (path == GRID_PATH_PERMANENT) gridPaths[i] = GRID_PATH_RESET; + else if (fade < GRID_PATH_BLOCKED) gridPaths[i] = path - std::min(fade, GRID_PATH_DECAY_MAX); + if (gridTimers[i] >= 1 && gridTimers[i] <= 99) gridTimers[i] = (int16_t)std::max(gridTimers[i] - 1, 0); + } +} + +// 0081e250 How dark the room's lighting is. Not reconstructed yet. +float Room::GetLightingAlpha() +{ + reconstruction_missing("Room::GetLightingAlpha 0081e250"); +} + +// 0080f200 Draws the room: its backdrop, water, lighting and shaders, grid entities and entities by depth, and the +// overlays. Not reconstructed yet. +void Room::Render() +{ + reconstruction_missing("Room::Render 0080f200"); +} + +// 007f92b0 The chance a devil or angel room door opens after the boss. Not reconstructed yet. +float Room::GetDevilRoomChance() +{ + reconstruction_missing("Room::GetDevilRoomChance 007f92b0"); +} + +// 00800500 Plays the room's ambient loops (water, wind, fire) at the volume its contents call for. Not reconstructed +// yet. +void Room::update_ambient_sounds() +{ + reconstruction_missing("Room::update_ambient_sounds 00800500"); +} + +// 0080ea80 Draws the room's light and shadow layer. Not reconstructed yet. +void Room::render_lighting() +{ + reconstruction_missing("Room::render_lighting 0080ea80"); +} + +// 007f2390 Fits the room's bounds and floor on screen to its grid. +void Room::update_bounds(bool) +{ + reconstruction_missing("Room::update_bounds 007f2390"); +} + +// 007f1380 Loads the backdrop and its graphics for the room's stage, type and flags. +void Room::LoadBackdropGraphics() +{ + reconstruction_missing("Room::LoadBackdropGraphics 007f1380"); +} + +// 007eea90 Makes the door in a slot. Doors stay generated grid entities this round. +void Room::MakeDoor(int) +{ + reconstruction_missing("Room::MakeDoor 007eea90"); +} + +// 0081ee20 Builds the walls around the grid. Walls stay generated grid entities this round. +void Room::make_walls() +{ + reconstruction_missing("Room::make_walls 0081ee20"); +} + +// 007ed310 Spawns a layout entry on a cell. +bool Room::SpawnEntry(int, RoomEntry&, uint32_t) +{ + reconstruction_missing("Room::SpawnEntry 007ed310"); +} + +// 007eff50 Restores the entities a past visit saved. +void Room::RestoreState() +{ + reconstruction_missing("Room::RestoreState 007eff50"); +} + +// 00822d60 Holds the entities a pressure plate's output releases. +void Room::hold_trigger_output_entities() +{ + reconstruction_missing("Room::hold_trigger_output_entities 00822d60"); +} + +// 007f9df0 Opens Mega Satan's door when the room should have it. +bool Room::TrySpawnMegaSatanRoomDoor(bool) +{ + reconstruction_missing("Room::TrySpawnMegaSatanRoomDoor 007f9df0"); +} + +// 008279d0 Opens the door of a quest room (the Mausoleum's, the photo door) when the room should have it. +bool Room::TrySpawnSpecialQuestDoor() +{ + reconstruction_missing("Room::TrySpawnSpecialQuestDoor 008279d0"); +} + +// 00823f50 Attaches the minecarts to their rails. +void Room::attach_minecarts() +{ + reconstruction_missing("Room::attach_minecarts 00823f50"); +} + +// 00824350 Starts the rain of the room's backdrop. +void Room::init_rain() +{ + reconstruction_missing("Room::init_rain 00824350"); +} + +// 00820ac0 Turns the room's grid and pickups gold (Ultra Greedier's room). +void Room::TurnGold() +{ + reconstruction_missing("Room::TurnGold 00820ac0"); +} + +// 00827bf0 Spawns Sanguine Bond's spikes. +bool Room::spawn_sanguine_bond_spikes(bool) +{ + reconstruction_missing("Room::spawn_sanguine_bond_spikes 00827bf0"); +} + +// 008167e0 Removes the door in a slot. +void Room::RemoveDoor(int) +{ + reconstruction_missing("Room::RemoveDoor 008167e0"); +} + +// 007fe220 Fills the room with the Card Against Humanity's poop. +void Room::card_against_humanity_fill() +{ + reconstruction_missing("Room::card_against_humanity_fill 007fe220"); +} diff --git a/src/room.h b/src/room.h new file mode 100644 index 0000000..1a6aa1a --- /dev/null +++ b/src/room.h @@ -0,0 +1,302 @@ +#pragma once + +#include "backdrop.h" +#include "camera.h" +#include "entity_list.h" +#include "fx_layers.h" +#include "room_descriptor.h" +#include "temporary_effects.h" +#include +#include +#include +#include + +// A grid cell's size in the world, and where the cell at the top left of the grid sits. +constexpr float GRID_CELL_SIZE = 40; +constexpr float GRID_ORIGIN_X = 40; +constexpr float GRID_ORIGIN_Y = 120; + +// The trigger output groups a room's pressure plates fire (Room::TriggerOutput). +constexpr int OUTPUT_GROUP_COUNT = 10; + +// The room descriptor flags room_descriptor.h does not name yet (Lua's RoomDescriptor.FLAG_*). +constexpr uint32_t ROOM_DESCRIPTOR_FLAG_ALT_BOSS_MUSIC = 1 << 6; +constexpr uint32_t ROOM_DESCRIPTOR_FLAG_FLOODED = 1 << 8; +constexpr uint32_t ROOM_DESCRIPTOR_FLAG_PITCH_BLACK = 1 << 9; +constexpr uint32_t ROOM_DESCRIPTOR_FLAG_CURSED_MIST = 1 << 13; +constexpr uint32_t ROOM_DESCRIPTOR_FLAG_NO_WALLS = 1 << 15; +constexpr uint32_t ROOM_DESCRIPTOR_FLAG_ROTGUT_CLEARED = 1 << 16; + +// A room's type (Lua's RoomType), as its config gives it. +enum RoomType : int +{ + ROOM_NULL, + ROOM_DEFAULT, + ROOM_SHOP, + ROOM_ERROR, + ROOM_TREASURE, + ROOM_BOSS, + ROOM_MINIBOSS, + ROOM_SECRET, + ROOM_SUPERSECRET, + ROOM_ARCADE, + ROOM_CURSE, + ROOM_CHALLENGE, + ROOM_LIBRARY, + ROOM_SACRIFICE, + ROOM_DEVIL, + ROOM_ANGEL, + ROOM_DUNGEON, + ROOM_BOSSRUSH, + ROOM_ISAACS, + ROOM_BARREN, + ROOM_CHEST, + ROOM_DICE, + ROOM_BLACK_MARKET, + ROOM_GREED_EXIT, + ROOM_PLANETARIUM, + ROOM_TELEPORTER, + ROOM_TELEPORTER_EXIT, + ROOM_SECRET_EXIT, + ROOM_BLUE, + ROOM_ULTRASECRET +}; + +// What the Broken Watch does to the room: nothing, slows it, or speeds it up. +enum BrokenWatchState : int +{ + BROKEN_WATCH_NONE, + BROKEN_WATCH_SLOW, + BROKEN_WATCH_FAST +}; + +// The world rectangle of an L-shaped room's two arms (REPENTOGON's LRoomAreaDesc). +struct LRoomAreaDesc +{ + Vector topLeftA{}; + Vector bottomRightA{}; + Vector topLeftB{}; + Vector bottomRightB{}; +}; + +// The room counters for items in effect, and which of them a new room keeps (the original's table at 00b1f930). +constexpr int ROOM_ITEM_COUNTER_COUNT = 16; +constexpr uint32_t ROOM_ITEM_COUNTERS_KEPT = 1 << 3 | 1 << 5 | 1 << 6 | 1 << 7; + +// What the layout's spawns say about a room before Init spawns them. +struct SpawnFlags +{ + bool isDry = false; + bool isDump = false; + bool isFlooded = false; + bool isHeretic = false; + bool isRaglich = false; + bool isWater = false; +}; + +// The getters and setters of plain fields are the members themselves (0040c2e0, 00421800, 0042cc70, 0042d030, +// 004360c0, 0043ef20, 004566f0, 004cdd20, 004d7780, 00505c50, 005784d0, 00592270, 005b16c0, 005cd660, 005cd670, +// 0065cef0, 006b83d0, 006b83e0, 006b83f0, 006b8400, 007120c0, 007537c0, 007537d0, 007e91a0, 007e91f0, 007ea190, +// 0085e0f0, 0085e110), and the entity list's (0085e120, 0085e130). +// The camera and everything but the grid entities are members. +// 00417930 is EntityList's construction, which Room's ran on its member. +// The room the players are in (Level::room, Lua's Room): its layout's grid of cells, grid entities, doors and paths, +// its entity list, camera, effect layers and backdrop, the water, lava, rain and lighting it shows, its shop, and the +// counters and flags a visit keeps. Init fills it from a room descriptor each time the players enter one. +// Grid entities stay the generated classes this round: the room owns them by pointer. +// The enemy and boss counts, the damage dealt to enemies and the render mode belong to the entity list. +// Members whose meaning is not known yet are named after their original offset. +class Room +{ +public: + std::array gridEntities{}; + std::array doors{}; + std::array doorGridPositions{}; + std::array gridPaths{}; + std::array gridTimers{}; + std::array itemCounters{}; + std::array, OUTPUT_GROUP_COUNT> outputGroupGridIndices; + std::array, OUTPUT_GROUP_COUNT> outputGroupCallbacks; + std::set litGridIndices; + std::set pendingGridRemovals; + EntityList entityList; + FXLayers fxLayers; + Backdrop backdrop; + std::unique_ptr camera; + TemporaryEffects temporaryEffects{}; + BeastArena beastArena{}; + ANM2 lightSprite; + ANM2 spotLightSprite; + RoomDescriptor* descriptor = nullptr; + Entity* deathsListTarget = nullptr; + + ColorMod floorColor = COLOR_DEFAULT; + ColorMod wallColor = COLOR_DEFAULT; + KColor waterColor = kcolor_rgba(1, 1, 1, 1); + KColor waterColorMultiplier = kcolor_rgba(1, 1, 1, 1); + KColor waterLerpTargetColor = kcolor_rgba(1, 1, 1, 1); + KColor waterLerpTargetColorMult = kcolor_rgba(1, 1, 1, 1); + Vector bottomRightPos{}; + Vector deathsListOffset{}; + Vector floorScreenBottomRight{}; + Vector floorScreenTopLeft{}; + Vector renderScrollOffset{}; + Vector renderSurfaceTopLeft{}; + Vector topLeftPos{}; + Vector waterCurrent{}; + + float beastBlastForce = 0; + float lavaIntensity = 0; + float rainIntensity = 0; + float waterAmount = 0; + int backdropType = 0; + int bloodFromWallsCount = 0; + int bloodFromWallsDuration = 0; + int bossId = 0; + int dungeonRockIdx = -1; + int enterFrame = 0; + int entityIndexCounter = 0; + int genesisTimer = 0; + int greedWaveTimer = 0; + int gridHeight = 0; + int gridWidth = 0; + int lastAliveBossCount = 0; + int numRainSpawners = 0; + int roomClearDelay = 0; + int secondBossId = 0; + int shopLevel = 0; + int shopRestockTimer = -1; + int slowdownDuration = 0; + int tintedRockIdx = -1; + int unknown70fc = 0; + int unknown721c = 0; + int unknown7230 = 0; + int unknown72fc = 0; + int unknown73f0 = 0; + int waterLerpColorCountdown = -1; + int waterLerpColorDuration = -1; + BrokenWatchState brokenWatchState = BROKEN_WATCH_NONE; + RoomType roomType = ROOM_NULL; + + bool isCardAgainstHumanity = false; + bool isDeathsListDone = false; + bool isExorcistActive = false; + bool isFirstEnemyDead = false; + bool isFirstVisit = false; + bool isInitialized = false; + bool isPacifist = false; + bool isPickupVisionInvalid = false; + bool isRainStopped = false; + bool isRedHeartDamaged = false; + bool isSurpriseMiniboss = false; + bool isTriggerPressurePlates = false; + bool isUnknown11f5 = false; + bool isUnknown11f6 = true; + bool isUnknown7220 = false; + bool isUnknown7769 = false; + + Room(); + Room(const Room&) = delete; + Room& operator=(const Room&) = delete; + ~Room(); + + void Init(RoomConfig_Room& config, RoomDescriptor& roomDescriptor); + void lighting_load(); + void boss_ids_init(); + void init_shop_level(); + SpawnFlags init_spawn_flags(RoomConfig_Room& config); + void init_water(SpawnFlags& flags); + void init_first_visit(SpawnFlags& flags); + void init_saved_grid(); + void init_spawns(RoomConfig_Room& config); + void init_treasure_blind(RoomConfig_Room& config); + void init_dungeon_rock(); + void init_decorations(RoomConfig_Room& config); + void init_first_visit_items(); + bool is_boss_doors_removed(); + void init_first_visit_effects(RoomConfig_Room& config); + void init_ambient_effects(int effectiveStage, int stageId, uint32_t stageType); + void visit_record(); + void init_colors(); + bool is_ashpit_rays(); + void init_mineshaft_colors(); + + EntityList* GetEntities(); + int GetRoomShape(); + int GetGridSize(); + GridEntity* GetGridEntity(uint32_t gridIndex); + GridEntity_Door* GetDoor(int slot); + int GetGridPath(int gridIndex); + bool SetGridPath(int gridIndex, int value); + int GetGridIndex(Vector position); + int GetGridIndexByTile(int column, int row); + Vector GetGridPosition(int gridIndex); + Vector GetClampedPosition(Vector position, float margin); + Vector GetClampedPositionImpl(Vector position, float marginTop, float marginRight, float marginBottom, + float marginLeft); + LRoomAreaDesc GetLRoomAreaDesc(); + static Vector GetCenterPos(); + Vector GetRandomPosition(float margin); + int GetRandomTileIndex(uint32_t seed); + bool IsPositionInRoom(Vector position, float margin); + uint32_t GetGridCollision(int gridIndex); + uint32_t GetSpawnSeed(); + uint32_t GetDecorationSeed(); + uint32_t GetAwardSeed(); + int GetDeliriumDistance(); + int GetRoomConfigStage(); + bool has_room_config_flag(uint32_t mask); + bool IsClear(); + void SetClear(bool isClear); + bool IsSacrificeDone(); + void SetSacrificeDone(bool isDone); + bool IsAmbushDone(); + void SetAmbushDone(bool isDone); + bool HasWaterPits(); + bool IsDoorSlotAllowed(int slot); + int GetAliveEnemiesCount(); + int GetAliveBossesCount(); + bool HasSlowDown(); + void SetSlowDown(int duration); + int GetFrameCount(); + bool IsLShapedRoom(); + bool IsBeastDungeon(); + static bool IsMirrorWorld(); + bool HasCurseMist(); + bool HasWater(); + bool HasLava(); + static bool IsCurrentRoomLastBoss(); + float GetLightingAlpha(); + float GetDevilRoomChance(); + void SetPauseTimer(int duration); + BrokenWatchState GetBrokenWatchState(); + void SetBrokenWatchState(BrokenWatchState state); + float time_scale_update(); + int boss_music_get(); + void PlayMusic(); + + void Update(); + void update_ambient_sounds(); + void first_frame_update(); + void grid_paths_decay(); + void Render(); + void render_lighting(); + + void update_bounds(bool isFromGridSize); + void LoadBackdropGraphics(); + void MakeDoor(int slot); + void make_walls(); + bool SpawnEntry(int gridIndex, RoomEntry& entry, uint32_t seed); + void RestoreState(); + void hold_trigger_output_entities(); + bool TrySpawnMegaSatanRoomDoor(bool isForce); + bool TrySpawnSpecialQuestDoor(); + void attach_minecarts(); + void init_rain(); + void TurnGold(); + bool spawn_sanguine_bond_spikes(bool isRoomInit); + void RemoveDoor(int slot); + void card_against_humanity_fill(); +}; + +int room_shape_get_door_grid_index(int doorSlot, int width, int height, int shape); diff --git a/src/room_descriptor.cpp b/src/room_descriptor.cpp new file mode 100644 index 0000000..afd2dfe --- /dev/null +++ b/src/room_descriptor.cpp @@ -0,0 +1,15 @@ +#include "room_descriptor.h" + +constexpr uint32_t BOSS_DEATH_SHIFT_INDEX = 66; + +// 00428940 Draws the room's decoration, spawn and award seeds from rng, and its boss death seed from the award seed. +void RoomDescriptor::InitSeeds(RNG& rng) +{ + RNG deathRng{}; + + decorationSeed = rng.Next(); + spawnSeed = rng.Next(); + awardSeed = rng.Next(); + deathRng.SetSeed(awardSeed, BOSS_DEATH_SHIFT_INDEX); + bossDeathSeed = deathRng.Next(); +} diff --git a/src/room_descriptor.h b/src/room_descriptor.h new file mode 100644 index 0000000..8cb4a81 --- /dev/null +++ b/src/room_descriptor.h @@ -0,0 +1,79 @@ +#pragma once + +#include "classes.h" +#include "level_generator.h" +#include +#include +#include +#include + +constexpr int ROOM_GRID_CELLS = 448; +constexpr uint32_t GRID_SAVE_SEED_DEFAULT = 0x16a9de81; + +// What a room descriptor records about its room (Lua's RoomDescriptor.FLAG_*), by bit. +enum RoomDescriptorFlag : uint32_t +{ + ROOM_DESCRIPTOR_FLAG_CLEAR = 1 << 0, + ROOM_DESCRIPTOR_FLAG_PRESSURE_PLATES_TRIGGERED = 1 << 1, + ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE = 1 << 2, + ROOM_DESCRIPTOR_FLAG_CHALLENGE_DONE = 1 << 3, + ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS = 1 << 4, + ROOM_DESCRIPTOR_FLAG_HAS_WATER = 1 << 5, + ROOM_DESCRIPTOR_FLAG_NO_REWARD = 1 << 7, + ROOM_DESCRIPTOR_FLAG_RED_ROOM = 1 << 10, + ROOM_DESCRIPTOR_FLAG_DEVIL_TREASURE = 1 << 11, + ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP = 1 << 12 +}; + +// How the minimap shows a room (Lua's RoomDescriptor.DISPLAY_*), by bit. +enum RoomDisplayFlag : uint32_t +{ + ROOM_DISPLAY_BOX = 1 << 0, + ROOM_DISPLAY_LOCK = 1 << 1, + ROOM_DISPLAY_ICON = 1 << 2 +}; + +// A blank saved grid cell, as a new room descriptor holds 448 of them. +constexpr GridEntityDesc GRID_SAVE_EMPTY = {0, 0, 0, 0, GRID_SAVE_SEED_DEFAULT, 0, false, {}, GRID_SAVE_SEED_DEFAULT}; + +// A room of the floor: where it sits on the map and its config (or the one Greed's takeover swaps in), its doors +// (the neighbouring cells by slot, the ones open as a mask), the minimap's view of it, what happened in it, its seeds, +// and the grid cells, entities and effects saved when the players leave it. +// The flag getters (00436010, 00456560, 00505c30, 005cd640, 0070c550, 00738180, 007e9190) are flags tested against +// RoomDescriptorFlag. +// Construction (006ef590), destruction (006ef9c0), copies (00749040) and moves (007387d0, 00752e80) are the defaults. +// The original's reserve of 16 entities and 32 effects is left out. Its words at 0x94..0xab are only ever copied. +struct RoomDescriptor +{ + std::array doors = {-1, -1, -1, -1, -1, -1, -1, -1}; + std::set restrictedGridIndexes; + std::vector savedGridEntities = std::vector(ROOM_GRID_CELLS, GRID_SAVE_EMPTY); + std::vector savedEffects; + std::vector savedEntities; + RoomConfig_Room* data = nullptr; + RoomConfig_Room* overrideData = nullptr; + int deliriumDistance = 0; + int dimension = 0; + int greedSubType = 0; + int gridIndex = -1; + int group = -1; + int listIndex = -1; + int pitsCount = 0; + int safeGridIndex = -1; + int visitedCount = 0; + int16_t clearCount = 0; + int16_t poopCount = 0; + int16_t shopItemDiscountIdx = -1; + int16_t shopItemIdx = -1; + int16_t tKeeperCoinSpawns = 0; + int16_t totalMoneySpent = 0; + uint32_t allowedDoors = 0; + uint32_t awardSeed = 0; + uint32_t bossDeathSeed = 0; + uint32_t decorationSeed = 0; + uint32_t displayFlags = 0; + uint32_t flags = 0; + uint32_t spawnSeed = 0; + + void InitSeeds(RNG& rng); +}; diff --git a/src/room_transition.cpp b/src/room_transition.cpp new file mode 100644 index 0000000..25853e6 --- /dev/null +++ b/src/room_transition.cpp @@ -0,0 +1,590 @@ +#include "room_transition.h" +#include "entity_npc.h" +#include "entity_player.h" +#include "fx_layers.h" +#include "game.h" +#include "log.h" +#include "manager.h" +#include "platform.h" +#include "render_passes.h" +#include "room.h" +#include +#include +#include +#include + +constexpr const char* VERSUS_SCREEN_ANM2 = "gfx/ui/boss/versusscreen.anm2"; +constexpr const char* OLD_ROOM_SURFACE = "Old Room Surface"; +constexpr const char* NEW_ROOM_SURFACE = "New Room Surface"; +constexpr const char* ANIMATION_DEATH_TELEPORT = "DeathTeleport"; +constexpr KColor WHITE = kcolor_rgba(1, 1, 1, 1); +constexpr float DEGREES_TO_RADIANS = std::numbers::pi_v / 180; +constexpr int PIXELATION_DURATION = 30; +constexpr int WALK_DURATION = 7; +constexpr int UNDIRECTED_DURATION = 3; +constexpr int SOUND_MIRROR_ENTER = 608; +constexpr int SOUND_MIRROR_EXIT = 609; +constexpr int MIRROR_DIMENSION = 1; +constexpr std::string_view ANIMATION_DEATH_SUFFIX = "Death"; +constexpr const char* ANIMATION_TELEPORT_DOWN = "TeleportDown"; +constexpr const char* ANIMATION_PICKUP = "Pickup"; +constexpr const char* ANIMATION_PICKUP_SPARKLE = "PlayerPickupSparkle"; +constexpr const char* EVENT_POOF = "Poof"; +constexpr int SLOWEST_FRAME_UNSET = 1000; +constexpr int FOLLOW_MIN_FRAME = 6; +constexpr float RANDOM_UNIT = 2.3283064e-10f; +constexpr float RANDOM_PI = 3.14f; +constexpr float MINECART_JITTER = 8; +constexpr int VERSUS_FIRE_BLOCK_FRAMES = 10; +constexpr int TELEPORT_SOUND_FRAME = 8; +constexpr int SOUND_ONE_UP = 1; +constexpr int SOUND_TELEPORT_LAND = 214; +constexpr int ITEM_STATE_HELD = 604; +constexpr int PITFALL_GONE = 4; +constexpr int MINECART_RIDDEN = 10; +constexpr int NPC_STATE_MINECART_MOVING = 4; +constexpr int COLLECTIBLE_GLOWING_HOURGLASS = 422; +constexpr int COLLECTIBLE_D7 = 437; + +// The items whose pickup animation an extra life plays once the player is back, from the Ankh to Lazarus' Rags: Ankh, +// Dead Cat, 1up!, Guppy's Collar, Judas' Shadow and Lazarus' Rags. +constexpr std::array EXTRA_LIFE_ITEMS = {161, 81, 11, 212, 311, 332}; + +// Stops the boss overlay as BossOverlay's own stop does: it hides and the sound effects come back to full volume at +// the normal fade. Its sprite waits for BossOverlay's takeover, so a shown overlay stops the game here. +static void boss_overlay_stop(Game& game) +{ + SFXManager& sounds = g_manager->sfxManager; + if (game.bossOverlay._state != 0) reconstruction_missing("BossOverlay stop 00421260 on a shown overlay"); + + if (sounds.volumeModifier != 1) + { + sounds.volumeModifier = 1; + sounds.ClearVolumeModifier(); + } + sounds.volumeModifierStep = VOLUME_MODIFIER_STEP; +} + +// 0082ed00 Creates the surfaces the old and new rooms are captured into, of the framebuffer's size. +void RoomTransition::surfaces_create() +{ + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + + oldRoomSurface.reset(); + newRoomSurface.reset(); + oldRoomSurface = graphics.render_target_create( + {kcolor_rgba(0, 0, 0, 0), OLD_ROOM_SURFACE, (int)DAT_00c79114, g_framebufferWidth}); + newRoomSurface = graphics.render_target_create( + {kcolor_rgba(0, 0, 0, 0), NEW_ROOM_SURFACE, (int)DAT_00c79114, g_framebufferWidth}); +} + +// 0082ee40 Starts moving to a room, unless a stage transition runs (a forced boss transition starts anyway). The +// versus screen loads the first time. The room the players are in is entered without a direction. The players (not +// their babies) stop and lose control, teleporting ones animating it (all but the dead) or playing the Death +// Certificate's teleport. A pixelation lasts 30 frames, a walk 7 and the rest 3, a mirror fade with its sound. +void RoomTransition::start(const RoomTransitionRequest& request) +{ + Game& game = *g_game; + + log_printf(LOG_INFO, "[Frame %d] Starting room transition (type %d) \n", game.frameCount, request.animation); + if (!versusScreenANM2.isLoaded) versusScreenANM2.Load(VERSUS_SCREEN_ANM2, GRAPHICS_LOAD); + if (game.stageTransition._state != 0 && request.animation != TRANSITION_BOSS_FORCED) return; + + bool isCurrentRoom = request.roomIndex == game.currentRoomIdx && request.dimension == game.currentDimensionIdx; + roomIndex = request.roomIndex; + frame = 0; + animation = request.animation; + direction = isCurrentRoom ? DIRECTION_NONE : request.direction; + bossIntroBossId = 0; + game.playerManager.roomTransitionPlayer = request.player; + teleporterTarget = 0; + flags = 0; + roomDimension = request.dimension < 0 ? game.currentDimensionIdx : request.dimension; + + for (size_t i = 0; i < game.playerManager.playerList.size(); i++) + { + Entity_Player* player = game.GetPlayer((int)i); + if (player->variant != PLAYER_VARIANT_PLAYER) continue; + + if (is_teleport() && !player->isDead) player->AnimateTeleport(request.animation != TRANSITION_WOMB_TELEPORT); + else if (animation == TRANSITION_DEATH_CERTIFICATE) player->PlayExtraAnimation(ANIMATION_DEATH_TELEPORT); + player->velocity = vector_make(0, 0); + player->isControlsEnabled = false; + } + + mode = TRANSITION_START; + progress = 0; + slideOffset = vector_make(0, 0); + if (animation == TRANSITION_PIXELATION) return void(duration = PIXELATION_DURATION); + + duration = direction != DIRECTION_NONE ? WALK_DURATION : UNDIRECTED_DURATION; + if (animation != TRANSITION_FADE_MIRROR) return; + int sound = request.dimension != MIRROR_DIMENSION ? SOUND_MIRROR_EXIT : SOUND_MIRROR_ENTER; + seed_fart_sound_override(&sound); + g_manager->sfxManager.Play(sound); +} + +void RoomTransition::StartBossIntro(uint32_t, uint32_t) +{ + reconstruction_missing("RoomTransition::StartBossIntro 0082f1c0"); +} + +void RoomTransition::ChangeRoom() +{ + reconstruction_missing("RoomTransition::ChangeRoom 00830950"); +} + +// Whether a player plays an extra or item animation that holds the transition: one not looping. +static bool is_animating(Entity_Player& player) +{ + const AnimationData* data = player.sprite.animState.animData; + return (player.isPlayingExtraAnimation || player.isPlayingItemAnimation) && !(data && data->isLooping); +} + +// Sets the minecart off along its rail, the players riding it. +// The rail it stands on and the minecart's own fields wait for Room's and Entity_NPC's rails. +static void minecart_launch(Entity_NPC&) +{ + reconstruction_missing("RoomTransition::Update 008318a0: the minecart setting off on its rail"); +} + +// The frame the players are captured on. They finish the animations that hold the transition, the room and the doors +// (in a minecart) still updating. A player done animating a teleport or a minecart ride copies the slowest one's +// animation and target, the minecart rider jittering about the cart. Then the old room renders into its surface, the +// players hidden as they leave, and the old room fades out first or the new one comes in at once. +void RoomTransition::start_update(Entity_NPC* minecartNpc) +{ + Game& game = *g_game; + Room& room = *game.room; + Entity_Player* idlePlayer = nullptr; + Entity_Player* slowestPlayer = nullptr; + int slowestFrame = SLOWEST_FRAME_UNSET; + bool isAllIdle = true; + + room.entityList.Update(UPDATE_TRANSITION); + room.update_ambient_sounds(); + if (animation == TRANSITION_MINECART) + for (GridEntity_Door* door : room.doors) + if (door) door->Update(); + + for (Entity_Player* player : game.playerManager.playerList) + { + if (!player) continue; + if (player->isDead) + { + player->Update(); + continue; + } + if (!is_animating(*player)) + { + if (!idlePlayer && player->isVisible) idlePlayer = player; + if (animation == TRANSITION_MINECART) player->Update(); + continue; + } + + if (animation == TRANSITION_WALK) player->isPlayingExtraAnimation = player->isPlayingItemAnimation = false; + player->Update(); + if (player->itemState != 0 && player->itemState != ITEM_STATE_HELD) player->ResetItemState(); + if (animation == TRANSITION_WALK) player->isPlayingExtraAnimation = player->isPlayingItemAnimation = false; + bool isRidden = animation == TRANSITION_MINECART && minecartNpc && player->sprite.animState.animData && + player->sprite.animState.IsEventTriggered(EVENT_POOF); + if (isRidden) + { + player->AttachMinecart(minecartNpc); + player->isVisible = false; + } + if ((!player->isPlayingExtraAnimation && !player->isPlayingItemAnimation) || + player->pitfallState == PITFALL_GONE) + { + player->isVisible = false; + continue; + } + + int playerFrame = player->sprite.animState.animData ? (int)std::floor(player->sprite.animState.animFrame) : -1; + isAllIdle = false; + if (playerFrame < slowestFrame) + { + slowestFrame = playerFrame; + slowestPlayer = player; + } + } + + bool isFollowing = animation == TRANSITION_WOMB_TELEPORT || animation == TRANSITION_PORTAL_TELEPORT || + animation == TRANSITION_MINECART; + if (isFollowing && slowestPlayer && idlePlayer && slowestFrame >= FOLLOW_MIN_FRAME) + { + idlePlayer->PlayExtraAnimation(slowestPlayer->sprite.animState.GetAnimation()); + idlePlayer->moveToTarget = slowestPlayer->moveToTarget; + if (animation == TRANSITION_MINECART && minecartNpc) + { + float angle = (float)Random() * RANDOM_UNIT * RANDOM_PI * 2; + float reach = (float)Random() * RANDOM_UNIT * MINECART_JITTER; + idlePlayer->moveToTarget = vector_make(reach * std::cos(angle) + minecartNpc->targetPosition.x, + reach * std::sin(angle) + minecartNpc->targetPosition.y); + } + if (animation != TRANSITION_ARENA) return; + } + else if (!isAllIdle && animation != TRANSITION_ARENA) return; + + if (animation == TRANSITION_MINECART && minecartNpc) + { + if (minecartNpc->state != NPC_STATE_MINECART_MOVING) minecart_launch(*minecartNpc); + return; + } + bool isWombTeleport = animation == TRANSITION_WOMB_TELEPORT || animation == TRANSITION_PORTAL_TELEPORT; + if (isWombTeleport && roomIndex == game.currentRoomIdx) + { + for (Entity_Player* player : game.playerManager.playerList) + if (player) + { + player->isVisible = false; + player->isControlsEnabled = true; + } + frame = 0; + mode = TRANSITION_NONE; + return; + } + old_room_capture(); +} + +// Hides the players leaving (all of them, but only the one who walked out through a door or pixelated) and renders +// the room into the old room surface. A fade shows it going out, a forced boss or arena transition changing room at +// once, and anything else changes room and comes in. +void RoomTransition::old_room_capture() +{ + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + Game& game = *g_game; + bool isWalking = animation == TRANSITION_WALK || animation == TRANSITION_PIXELATION; + + frame = 0; + if (direction != DIRECTION_NONE || is_teleport() || animation == TRANSITION_PORTAL_TELEPORT) + for (Entity_Player* player : game.playerManager.playerList) + if (player && + (!isWalking || direction == DIRECTION_NONE || player == game.playerManager.roomTransitionPlayer)) + player->isVisible = false; + + game.room->render_lighting(); + graphics.render_target_push(oldRoomSurface.get(), KAGE::Graphics::TARGET_SCREEN_SIZE, + KAGE::Graphics::PRESENT_FLUSH); + graphics.Clear(); + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + game.room->Render(); + graphics.Present(KAGE::Graphics::PRESENT_FINISH); + graphics.render_target_pop(KAGE::Graphics::PRESENT_FLUSH); + + bool isChangedAtOnce = animation == TRANSITION_BOSS_FORCED || animation == TRANSITION_ARENA; + if (is_fade() || isChangedAtOnce) + { + mode = TRANSITION_OUT; + if (isChangedAtOnce) ChangeRoom(); + return; + } + mode = TRANSITION_IN; + ChangeRoom(); +} + +// Plays the versus screen and its extra layers until the screen ends, then the room's music, and shows the HUD +// again for the new room to come in at once, the players unable to shoot for 10 more frames. +void RoomTransition::versus_screen_update() +{ + Game& game = *g_game; + + versusScreenANM2.Update(); + for (auto& [layerId, sprite] : extraLayerANM2s) sprite.Update(); + if (versusScreenANM2.animState.animData && versusScreenANM2.animState.isPlaying) return; + + game.room->PlayMusic(); + game.hud.isVisible = true; + frame = duration; + mode = TRANSITION_IN; + for (Entity_Player* player : game.playerManager.playerList) + if (player) player->fireBlockCooldown = std::max(player->fireBlockCooldown, VERSUS_FIRE_BLOCK_FRAMES); +} + +// Ends the coming in: the boss overlay stops. Teleported players reappear (falling in from a teleport) and the +// Glowing Hourglass or the D7 plays its pickup animation, the extra lives theirs (1up with its sound), all landing +// next. The fades land too, the teleports through the womb, a portal, the Forgotten's body or a minecart end with the +// room's entities and players updated and the players in control, and the rest end the same, the players' control +// back unless a versus match runs. +void RoomTransition::arrival_update() +{ + Game& game = *g_game; + Entity_Player* player = game.playerManager.roomTransitionPlayer; + PlayerManager& players = game.playerManager; + + boss_overlay_stop(game); + frame = 0; + mode = TRANSITION_LANDING; + if (is_teleport()) + { + for (Entity_Player* teleported : players.playerList) + { + if (!teleported) continue; + if (animation == TRANSITION_TELEPORT) teleported->PlayExtraAnimation(ANIMATION_TELEPORT_DOWN); + if (!(teleported->flags & FLAG_HELD)) teleported->isVisible = true; + } + if (animation == TRANSITION_GLOWING_HOURGLASS && player) + player->AnimateCollectible(COLLECTIBLE_GLOWING_HOURGLASS, ANIMATION_PICKUP, ANIMATION_PICKUP_SPARKLE); + else if (animation == TRANSITION_D7 && player) + player->AnimateCollectible(COLLECTIBLE_D7, ANIMATION_PICKUP, ANIMATION_PICKUP_SPARKLE); + return; + } + + switch (animation) + { + case TRANSITION_ONE_UP: + { + int sound = SOUND_ONE_UP; + seed_fart_sound_override(&sound); + g_manager->sfxManager.Play(sound); + [[fallthrough]]; + } + case TRANSITION_ANKH: + case TRANSITION_DEAD_CAT: + case TRANSITION_COLLAR: + case TRANSITION_JUDAS_SHADOW: + case TRANSITION_LAZARUS: + if (player) + player->AnimateCollectible(EXTRA_LIFE_ITEMS[animation - TRANSITION_ANKH], ANIMATION_PICKUP, + ANIMATION_PICKUP_SPARKLE); + return; + case TRANSITION_MISSING_POSTER: + if (player) player->AnimateTrinket(TRINKET_MISSING_POSTER, ANIMATION_PICKUP, ANIMATION_PICKUP_SPARKLE); + return; + case TRANSITION_FADE: + case TRANSITION_PIXELATION: + case TRANSITION_FADE_MIRROR: + case TRANSITION_DEATH_CERTIFICATE: + return; + default: + break; + } + + bool isTeleported = animation == TRANSITION_WOMB_TELEPORT || animation == TRANSITION_PORTAL_TELEPORT || + animation == TRANSITION_FORGOTTEN_TELEPORT || animation == TRANSITION_MINECART; + game.room->entityList.Update(UPDATE_TRANSITION); + for (Entity_Player* arrived : players.playerList) + { + if (!arrived) continue; + if (!isTeleported && game.deathmatchManager.state < DEATHMATCH_INTRO) arrived->isControlsEnabled = true; + arrived->Update(); + if (isTeleported) arrived->isControlsEnabled = true; + } + mode = TRANSITION_NONE; +} + +// Waits on the players' landing (a teleport's sound on its 8th frame): the room updates, and players playing an +// animation that does not loop update until none plays one (of 5 letters or more) other than a death. Then they show +// and take control again. +void RoomTransition::landing_update() +{ + Game& game = *g_game; + bool isLanded = true; + + if (animation == TRANSITION_TELEPORT && frame == TELEPORT_SOUND_FRAME) + { + int sound = SOUND_TELEPORT_LAND; + seed_fart_sound_override(&sound); + g_manager->sfxManager.Play(sound); + } + frame++; + game.room->entityList.Update(UPDATE_TRANSITION); + for (Entity_Player* player : game.playerManager.playerList) + { + if (!player || !is_animating(*player)) continue; + + player->Update(); + std::string_view name; + if (player->sprite.animState.animData) name = player->sprite.animState.animData->name; + bool isPlaying = player->isPlayingExtraAnimation || player->isPlayingItemAnimation; + bool isHolding = + isPlaying && name.size() >= ANIMATION_DEATH_SUFFIX.size() && !name.ends_with(ANIMATION_DEATH_SUFFIX); + isLanded = isLanded && !isHolding; + } + if (!isLanded) return; + + mode = TRANSITION_NONE; + frame = 0; + for (Entity_Player* player : game.playerManager.playerList) + if (player) + { + player->isControlsEnabled = true; + if (!(player->flags & FLAG_HELD)) player->isVisible = true; + } +} + +// 008318a0 Steps the transition: capturing the old room, the old room going (or the versus screen) and the new one +// coming in frame by frame, then the landing. While a room goes or comes the HUD redraws in full, and progress follows +// the frame. +void RoomTransition::Update() +{ + Game& game = *g_game; + Entity* cart = minecart.get(); + Entity_NPC* minecartNpc = cart && cart->type == ENTITY_MINECART && cart->variant == MINECART_RIDDEN + ? static_cast(cart) + : nullptr; + + switch (mode) + { + case TRANSITION_START: + start_update(minecartNpc); + break; + case TRANSITION_OUT: + if (bossIntroBossId != 0) versus_screen_update(); + else if (frame < duration) frame++; + else + { + frame = 0; + mode = TRANSITION_IN; + ChangeRoom(); + } + break; + case TRANSITION_IN: + if (frame < duration) frame++; + else arrival_update(); + break; + case TRANSITION_LANDING: + landing_update(); + break; + default: + return; + } + progress = (float)frame / (float)duration; + if (mode == TRANSITION_OUT || mode == TRANSITION_IN) game.hud.refresh_request(HUD_REFRESH_FULL); +} + +// Draws the versus screen's layers about the middle of the screen, each extra layer sprite (a player's portrait) +// following its layer's keyframe: its position, pivot, scale, rotation and color. +static void versus_screen_render(RoomTransition& transition) +{ + const ANM2& versus = transition.versusScreenANM2; + const AnimationState& state = versus.animState; + SpriteDraw draw; + draw.position = vector_make(g_screenWidth * 0.5f, g_screenHeight * 0.5f); + if (!state.animData) return; + + for (const AnimationLayer& layer : state.animData->animLayers) + { + const AnimationFrame* keyframe = state.GetLayerFrame(layer.layerId); + if (!transition.versusScreenANM2.GetLayer(layer.layerId)->isVisible || !keyframe || !keyframe->isVisible) + continue; + layer.RenderFrame(draw, state.GetLayerFrameIdx(layer.layerId), versus); + + auto extra = transition.extraLayerANM2s.find(layer.layerId); + if (extra == transition.extraLayerANM2s.end() || !extra->second.isLoaded) continue; + ANM2& sprite = extra->second; + float angle = keyframe->rotation * DEGREES_TO_RADIANS; + float pivotX = -keyframe->pivot.x * keyframe->scale.x; + float pivotY = -keyframe->pivot.y * keyframe->scale.y; + sprite.color = keyframe->color; + sprite.rotation = keyframe->rotation; + sprite.scale = keyframe->scale; + sprite.offset.x = std::cos(angle) * pivotX - std::sin(angle) * pivotY + versus.offset.x + keyframe->pos.x; + sprite.offset.y = std::cos(angle) * pivotY + std::sin(angle) * pivotX + versus.offset.y + keyframe->pos.y; + sprite.Render(draw); + } +} + +// 00832850 Draws the transition over the room: the versus screen while a boss intro goes out, the old and new rooms +// sliding past each other (eased) through a door, or else the captured room fading to black (white for a teleport or +// a mirror). +void RoomTransition::Render() +{ + KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager; + Vector screen = vector_make(g_screenWidth, g_screenHeight); + if (mode != TRANSITION_OUT && mode != TRANSITION_IN) return; + if (bossIntroBossId != 0 && mode == TRANSITION_OUT) return versus_screen_render(*this); + + if (is_fade()) + { + graphics.blendMode = KAGE::Graphics::BLEND_MODE_OPAQUE; + KAGE::Graphics::ColorQuad room = KAGE::Graphics::color_quad_rect({}, screen, WHITE); + (mode == TRANSITION_OUT ? oldRoomSurface : newRoomSurface)->Render(room, WHITE); + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + bool isWhite = animation == TRANSITION_TELEPORT || animation == TRANSITION_FADE_MIRROR; + float shade = isWhite ? 1 : 0; + render_color_shader_pass( + KAGE::Graphics::color_quad_rect({}, screen, kcolor_rgba(shade, shade, shade, 1 - get_hud_alpha()))); + return; + } + + float eased = (3 - 2 * progress) * progress * progress; + Vector oldPosition{}; + Vector newPosition{}; + float width = slideOffset.x + g_screenWidth; + float height = slideOffset.y + g_screenHeight; + switch (direction) + { + case DIRECTION_LEFT: + oldPosition.x = width * eased; + newPosition.x = (eased - 1) * width; + break; + case DIRECTION_UP: + oldPosition.y = height * eased; + newPosition.y = (eased - 1) * height; + break; + case DIRECTION_RIGHT: + oldPosition.x = -eased * width; + newPosition.x = (1 - eased) * width; + break; + case DIRECTION_DOWN: + oldPosition.y = -eased * height; + newPosition.y = (1 - eased) * height; + break; + default: + break; + } + graphics.blendMode.SetMode(KAGE::Graphics::BLEND_NORMAL); + oldRoomSurface->Render(KAGE::Graphics::color_quad_rect(oldPosition, screen, WHITE), + kcolor_rgba(1, 1, 1, 1 - eased)); + newRoomSurface->Render(KAGE::Graphics::color_quad_rect(newPosition, screen, WHITE), kcolor_rgba(1, 1, 1, eased)); +} + +// 0082ee30 Whether a transition runs. +bool RoomTransition::is_active() +{ + return mode != TRANSITION_NONE; +} + +// 0082eb90 Whether the players teleport out: a teleport, a womb teleport, the Glowing Hourglass or the D7. +bool RoomTransition::is_teleport() +{ + return animation == TRANSITION_TELEPORT || animation == TRANSITION_GLOWING_HOURGLASS || + animation == TRANSITION_D7 || animation == TRANSITION_WOMB_TELEPORT; +} + +// Whether the rooms fade rather than slide: every animation but a walk, the maze, the extra lives and the forced boss +// one, and any without a direction. +bool RoomTransition::is_fade() +{ + switch (animation) + { + case TRANSITION_FADE: + case TRANSITION_PIXELATION: + case TRANSITION_WOMB_TELEPORT: + case TRANSITION_PORTAL_TELEPORT: + case TRANSITION_FORGOTTEN_TELEPORT: + case TRANSITION_FADE_MIRROR: + case TRANSITION_MINECART: + case TRANSITION_DEATH_CERTIFICATE: + return true; + default: + return direction == DIRECTION_NONE; + } +} + +// 008327e0 How much of the HUD and minimap shows: a fade dims them with the room, anything else leaves them. +float RoomTransition::get_hud_alpha() +{ + if (mode == TRANSITION_OUT && is_fade()) return 1 - progress; + if (mode == TRANSITION_IN && is_fade()) return progress; + return 1; +} + +// 00832fd0 How far the screen has faded out, by frames: rising going out, falling coming in, -1 otherwise. +float RoomTransition::get_fade_progress() +{ + if (mode != TRANSITION_OUT && mode != TRANSITION_IN) return -1; + float phase = (float)frame / (float)duration; + return mode == TRANSITION_IN ? 1 - phase : phase; +} diff --git a/src/room_transition.h b/src/room_transition.h new file mode 100644 index 0000000..9f99aa6 --- /dev/null +++ b/src/room_transition.h @@ -0,0 +1,105 @@ +#pragma once + +#include "anm2.h" +#include "entity.h" +#include "kage_graphics.h" +#include + +// Lua's Direction, which entity_player.h defines. +enum Direction : int; + +// The phases of a room transition (REPENTOGON's mode): the frame the old room is captured on, the old room going, the +// new one coming, and the wait on an extra life's pickup animation or a teleport's landing. +enum RoomTransitionMode : int +{ + TRANSITION_NONE, + TRANSITION_START, + TRANSITION_OUT, + TRANSITION_IN, + TRANSITION_LANDING +}; + +// How the players leave the room (Lua's RoomTransitionAnim). The extra lives play their item's pickup animation once +// in the new room, and ARENA enters the versus mode's arena. +enum RoomTransitionAnim : int +{ + TRANSITION_WALK, + TRANSITION_FADE, + TRANSITION_PIXELATION, + TRANSITION_TELEPORT, + TRANSITION_MAZE, + TRANSITION_ANKH, + TRANSITION_DEAD_CAT, + TRANSITION_ONE_UP, + TRANSITION_COLLAR, + TRANSITION_JUDAS_SHADOW, + TRANSITION_LAZARUS, + TRANSITION_WOMB_TELEPORT, + TRANSITION_GLOWING_HOURGLASS, + TRANSITION_D7, + TRANSITION_MISSING_POSTER, + TRANSITION_BOSS_FORCED, + TRANSITION_PORTAL_TELEPORT, + TRANSITION_FORGOTTEN_TELEPORT, + TRANSITION_FADE_MIRROR, + TRANSITION_MINECART, + TRANSITION_DEATH_CERTIFICATE, + TRANSITION_ARENA +}; + +// What Game::StartRoomTransition asks for: the room and dimension (negative for the current one), the door side left +// through (DIRECTION_NONE for none), the animation and the player who started it. +struct RoomTransitionRequest +{ + Entity_Player* player = nullptr; + RoomTransitionAnim animation = TRANSITION_WALK; + Direction direction{}; + int dimension = -1; + int roomIndex = 0; +}; + +// Destruction (0082ebd0, 0082ebb0, 00833270) is the default, and the extra layer lookup (00833010) is std::map's. +// Moving between rooms (g_game->roomTransition): the old room captured into a surface, then slid away through a door +// or faded out and the new room in, and the boss versus screen with its extra layer sprites (REPENTOGON's +// extraLayerANM2s, by versus screen layer id). progress runs from 0 to 1 over a phase. +class RoomTransition +{ +public: + ANM2 versusScreenANM2; + std::map extraLayerANM2s; + KAGE::Graphics::ImagePtr newRoomSurface; + KAGE::Graphics::ImagePtr oldRoomSurface; + Vector slideOffset{}; + EntityPtr minecart; + RoomTransitionAnim animation = TRANSITION_WALK; + RoomTransitionMode mode = TRANSITION_NONE; + float progress = 0; + uint32_t bossIntroBossId = 0; + uint32_t flags = 0; + Direction direction{}; + int duration = 0; + int frame = 0; + int roomDimension = 0; + int roomIndex = 0; + int teleporterTarget = 0; + + void surfaces_create(); + void start(const RoomTransitionRequest& request); + void StartBossIntro(uint32_t bossId1, uint32_t bossId2); + void ChangeRoom(); + void Update(); + void Render(); + + bool is_active(); + bool is_teleport(); + bool is_fade(); + float get_hud_alpha(); + float get_fade_progress(); + +private: + void start_update(Entity_NPC* minecartNpc); + void old_room_capture(); + void versus_screen_update(); + void arrival_update(); + void landing_update(); +}; diff --git a/src/score_sheet.cpp b/src/score_sheet.cpp index 4f40972..4f45d51 100644 --- a/src/score_sheet.cpp +++ b/src/score_sheet.cpp @@ -1,6 +1,8 @@ #include "score_sheet.h" +#include "entity_player.h" #include "game.h" #include "log.h" +#include "room.h" #include #include #include @@ -43,7 +45,6 @@ constexpr int ANGEL_KILL_WEIGHT = 3; constexpr int DOOR_SPAWNED_BONUS = 1000; constexpr float STAGE_REPLAYED_ONCE = 0.5f; -constexpr int ROOM_CHALLENGE = 11; constexpr uint32_t ROOM_DESCRIPTOR_RED_ROOM = 0x400; constexpr int PICKUP_COLLECTIBLE = 100; constexpr int SUBTYPE_ANY = -1; @@ -53,7 +54,6 @@ constexpr float G_FUEL_KILL_FACTOR = 10; constexpr float KILL_HEALTH_EXPONENT = 0.2f; constexpr float KILL_POINTS_FACTOR = 5; -constexpr int ENTITY_TEXT = 9001; constexpr int TEXT_SCORE = 2; constexpr float POPUP_RISE = 8; constexpr float POPUP_SPEED = -2; @@ -114,7 +114,7 @@ static void score_popup_spawn(Vector position, float points) spawn.variant = TEXT_SCORE; Entity* text = g_game->Spawn(spawn); - text->_targetPosition = vector_make(points, 0); + text->targetPosition = vector_make(points, 0); text->Update(); } @@ -172,16 +172,16 @@ void ScoreSheet::add_pickup_points(int variant, int subType, Vector position) void ScoreSheet::AddKilledEnemy(Entity& npc) { Game& game = *g_game; - bool isRedRoom = game.room->_descriptor->Flags & ROOM_DESCRIPTOR_RED_ROOM; + bool isRedRoom = game.room->descriptor->flags & ROOM_DESCRIPTOR_RED_ROOM; if ((isRedRoom && isRedRoomBonusCapped) || game.isRoomRespawned) return; - float health = std::ceil(std::pow(npc._maxHitPoints, KILL_HEALTH_EXPONENT) * KILL_POINTS_FACTOR); - float points = stage_multiplier_get(stage_visit_current()) * (health * npc._scoreMultiplier); + float health = std::ceil(std::pow(npc.maxHitPoints, KILL_HEALTH_EXPONENT) * KILL_POINTS_FACTOR); + float points = stage_multiplier_get(stage_visit_current()) * (health * npc.scoreMultiplier); if (game.playerManager.GetGFuelCount() > 0 && points > 0) { points *= G_FUEL_KILL_FACTOR; - score_popup_spawn(npc._pos, points); + score_popup_spawn(npc.pos, points); } enemyPoints += (int)points; } @@ -250,9 +250,9 @@ void ScoreSheet::Calculate() int goldenHearts = 0; for (Entity_Player* player : players) { - hearts += std::popcount((uint32_t)player->_blackHearts) + player->_maxHearts + player->_redHearts + - player->_soulHearts + player->_eternalHearts + player->_boneHearts; - goldenHearts += player->_goldenHearts; + hearts += std::popcount((uint32_t)player->blackHearts) + player->maxHearts + player->redHearts + + player->soulHearts + player->eternalHearts + player->boneHearts; + goldenHearts += player->goldenHearts; } float pickupScore = 0; @@ -265,7 +265,7 @@ void ScoreSheet::Calculate() } Entity_Player& first = *players.front(); - int consumables = first._numCoins + (first._numBombs + first._numKeys) * 2; + int consumables = first.numCoins + (first.numBombs + first.numKeys) * 2; schwagBonus = (int)pickupScore + (goldenHearts * GOLDEN_HEART_WEIGHT + consumables + hearts) * SCHWAG_WEIGHT; calculate_room_score(); @@ -293,10 +293,8 @@ void ScoreSheet::Calculate() int items = 0; for (Entity_Player* player : players) { - int* counts = (int*)player->_collectibleCounts._begin; - int* countsEnd = (int*)player->_collectibleCounts._end; - damage += player->_totalDamageTaken; - for (int* count = counts; count != countsEnd; count++) items += *count; + damage += player->totalDamageTaken; + for (int count : player->collectibleCounts) items += count; } damagePenalty = penalty_get((float)(uint32_t)damage, DAMAGE_DECAY_HITS, explorationBonus); diff --git a/src/stat_hud.cpp b/src/stat_hud.cpp new file mode 100644 index 0000000..f0f842c --- /dev/null +++ b/src/stat_hud.cpp @@ -0,0 +1,262 @@ +#include "stat_hud.h" +#include "entity_player.h" +#include "game.h" +#include "manager.h" +#include "room.h" +#include +#include +#include + +constexpr int STAT_CHANGE_FRAMES = 150; +constexpr int STAT_CHANGE_HOLD = 135; +constexpr int STAT_CHANGE_FADE = 30; +constexpr int STAT_TEXT_SIZE = 12; +constexpr int STAT_COARSE_FIRST = STAT_DEVIL_CHANCE; +constexpr float TEARS_PER_SECOND = 30; +constexpr float RANGE_UNIT = 40; +constexpr float PERCENT = 100; +constexpr float ICON_ALPHA = 0.5f; +constexpr float TEXT_ALPHA = 0.5f; +constexpr float CHANGE_ALPHA = 0.5f; +constexpr float ROW_SPACING = 12; +constexpr float ROW_SPACING_TWO_PLAYERS = 14; +constexpr float TEXT_RAISE = -1; +constexpr float TEXT_RAISE_TWO_PLAYERS = -5; +constexpr float PLAYER_COLUMN_SHIFT = 4; +constexpr float PLAYER_ROW_SHIFT = 7; +constexpr float TEXT_OFFSET_X = 16; +constexpr float TEXT_OFFSET_Y = 1; +constexpr float CHANGE_OFFSET_X = 30; +constexpr float CHANGE_SLIDE = -20; +constexpr float SECOND_PLAYER_SHADE = 0.8f; +constexpr float CHANGE_BRIGHT = 0.9f; +constexpr float CHANGE_DIM = 0.03f; +constexpr int COLLECTIBLE_DUALITY = 498; +constexpr int TRINKET_ROSARY_BEAD = 7; +constexpr const char* FORMAT_STAT = "%.2f"; +constexpr const char* FORMAT_STAT_CHANGE = "+%.2f"; +constexpr const char* FORMAT_PERCENT = "%.1f%%"; +constexpr const char* FORMAT_PERCENT_CHANGE = "+%.1f%%"; + +// 0084d6b0 Takes a stat's new value. Unanimated it shows no change. Otherwise a change of at least the threshold shows +// for 150 frames, and one while the last still shows adds to it and holds it for at least 135 more. +void StatTracker::set(float newValue, bool isAnimated) +{ + if (!isAnimated) + { + previous = value; + change = 0; + changeTimer = 0; + } + else if (newValue != value && changeTimer <= STAT_CHANGE_FADE) + { + previous = value; + change = newValue - value; + if (std::abs(change) >= threshold) changeTimer = STAT_CHANGE_FRAMES; + } + else if (newValue != value) + { + change = newValue - previous; + changeTimer = std::max(changeTimer, STAT_CHANGE_HOLD); + } + value = newValue; +} + +// 0084bfd0 Forgets both players' stats. The deal and planetarium chances only show changes of a tenth. +void StatHUD::reset() +{ + for (StatHUDPlayer& slot : players) + { + slot.player = nullptr; + for (int i = 0; i < STAT_TRACKER_COUNT; i++) + { + StatTracker& stat = slot.stats[i]; + stat.value = 0; + stat.change = 0; + stat.previous = 0; + stat.changeTimer = 0; + if (i >= STAT_COARSE_FIRST) stat.threshold = STAT_THRESHOLD_COARSE; + } + } + isDualityOwned = false; +} + +// 0084bf30 The slot showing a player, given the first free one when it has none. A baby, a player with a parent, the +// Forgotten's soul (Tainted) and holograms have none, nor does an online player of another machine. +int StatHUD::player_slot_get(Entity_Player* player) +{ + bool isShown = player->variant == PLAYER_VARIANT_PLAYER && !player->parent && + player->playerType != PLAYER_THESOUL_B && !player->IsHologram(); + int freeSlot = -1; + if (!isShown) return -1; + + for (int i = 0; i < STAT_PLAYER_COUNT; i++) + { + if (players[i].player == player) return i; + if (!players[i].player && freeSlot < 0) freeSlot = i; + } + if (freeSlot >= 0) players[freeSlot].player = player; + return freeSlot; +} + +// 0084c170 With the found HUD on, notes whether Duality is owned, recomputes every player's stats (all but the unused +// one) and counts the shown changes down. +void StatHUD::Update() +{ + Game& game = *g_game; + if (!g_manager->optionsConfig.isFoundHudEnabled) return; + + isDualityOwned = game.playerManager.FirstCollectibleOwner(COLLECTIBLE_DUALITY, LAZARUS_SHARE_CHECK); + for (size_t i = 0; i < game.playerManager.playerList.size(); i++) + RecomputeStats(player_slot_get(game.GetPlayer((int)i)), STAT_FLAGS_ALL & ~STAT_FLAG_UNUSED); + for (StatHUDPlayer& slot : players) + for (StatTracker& stat : slot.stats) + if (stat.changeTimer > 0) stat.changeTimer--; +} + +// 0084ca00 Recomputes the stats the flags name for a shown player, a change animating unless the player was just +// spawned. Range counts in tiles and tears per second. The deal chance (none when no deal can spawn) splits between the +// devil and the angel by the angel chance, or shows whole for both with Duality. +void StatHUD::RecomputeStats(int playerId, uint32_t flags) +{ + if (playerId < 0 || !players[playerId].player) return; + + Game& game = *g_game; + Entity_Player& player = *players[playerId].player; + std::array& stats = players[playerId].stats; + bool isAnimated = game.frameCount - player.spawnFrame > 1; + + if (flags & STAT_FLAG_SPEED) stats[STAT_SPEED].set(player.moveSpeed, isAnimated); + if (flags & STAT_FLAG_TEARS) stats[STAT_TEARS].set(TEARS_PER_SECOND / (player.maxFireDelay + 1), isAnimated); + if (flags & STAT_FLAG_DAMAGE) stats[STAT_DAMAGE].set(player.damage, isAnimated); + if (flags & STAT_FLAG_RANGE) stats[STAT_RANGE].set(player.tearRange / RANGE_UNIT, isAnimated); + if (flags & STAT_FLAG_SHOT_SPEED) stats[STAT_SHOT_SPEED].set(player.shotSpeed, isAnimated); + if (flags & STAT_FLAG_LUCK) stats[STAT_LUCK].set(player.luck, isAnimated); + if (flags & (STAT_FLAG_DEVIL_CHANCE | STAT_FLAG_ANGEL_CHANCE)) + { + float dealChance = std::clamp(game.room->GetDevilRoomChance(), 0.0f, 1.0f); + if (!game.CanSpawnDevilRoom()) dealChance = 0; + float angelChance = get_angel_room_chance(); + float devilShare = isDualityOwned ? 1 : 1 - angelChance; + float angelShare = isDualityOwned ? 1 : angelChance; + stats[STAT_DEVIL_CHANCE].set(devilShare * dealChance * PERCENT, isAnimated); + stats[STAT_ANGEL_CHANCE].set(angelShare * dealChance * PERCENT, isAnimated); + } + if (flags & STAT_FLAG_UNUSED) stats[STAT_UNUSED].set(0, isAnimated); + if (flags & STAT_FLAG_PLANETARIUM_CHANCE) + stats[STAT_PLANETARIUM_CHANCE].set(game.itemPool.unkFloat674 * PERCENT, isAnimated); +} + +// 0084cc40 Moves the stats of a replaced player to the player replacing it (or back, for the slot showing the new +// one), recomputing all of them. +void StatHUD::update_player(Entity_Player* oldPlayer, Entity_Player* newPlayer) +{ + for (int i = 0; i < STAT_PLAYER_COUNT; i++) + { + Entity_Player*& shown = players[i].player; + if (shown == oldPlayer) shown = newPlayer; + else if (shown == newPlayer) shown = oldPlayer; + else continue; + RecomputeStats(i, STAT_FLAGS_ALL); + } +} + +// The texts of a stat: its value, and its change (empty for none). With a Rosary Bead the devil chance reads 0% and +// the angel chance the whole deal chance, its change shown as long as the devil's. +static void stat_text_get(StatHUDPlayer& slot, int statIndex, char* valueText, char* changeText) +{ + StatTracker& stat = slot.stats[statIndex]; + bool isPercent = statIndex == STAT_DEVIL_CHANCE || statIndex == STAT_ANGEL_CHANCE; + bool isRosary = isPercent && slot.player->HasTrinket(TRINKET_ROSARY_BEAD, ITEM_CHECK_MODIFIED); + float value = stat.value; + float change = stat.change; + + if (isRosary && statIndex == STAT_DEVIL_CHANCE) + return void(std::snprintf(valueText, STAT_TEXT_SIZE, FORMAT_PERCENT, 0.0)); + if (isRosary) + { + StatTracker& devil = slot.stats[STAT_DEVIL_CHANCE]; + value = std::min(devil.value + value, PERCENT); + change += devil.change; + stat.changeTimer = std::max(stat.changeTimer, devil.changeTimer); + } + std::snprintf(valueText, STAT_TEXT_SIZE, isPercent ? FORMAT_PERCENT : FORMAT_STAT, value); + const char* changeFormat = isPercent ? FORMAT_PERCENT : FORMAT_STAT; + if (change > 0) changeFormat = isPercent ? FORMAT_PERCENT_CHANGE : FORMAT_STAT_CHANGE; + std::snprintf(changeText, STAT_TEXT_SIZE, changeFormat, change); +} + +// Draws a stat's texts for a player: the value (the second player's tinted red), then a fresh change sliding in green +// (red when negative) and fading out over its last 30 frames. +static void stat_text_render(StatHUDPlayer& slot, int statIndex, Vector at, float shade) +{ + Font& font = g_manager->font8_LuaMiniOutlined; + FontSettings settings; + char valueText[STAT_TEXT_SIZE] = {}; + char changeText[STAT_TEXT_SIZE] = {}; + stat_text_get(slot, statIndex, valueText, changeText); + font.DrawString(valueText, at, vector_make(1, 1), kcolor_rgba(1, shade, shade, TEXT_ALPHA), settings); + + StatTracker& stat = slot.stats[statIndex]; + if (!changeText[0] || stat.changeTimer <= 0) return; + + float alpha = 1; + float slide = 0; + if (stat.changeTimer > STAT_CHANGE_HOLD) + { + alpha = (float)(stat.changeTimer - STAT_CHANGE_FRAMES) / (float)(STAT_CHANGE_HOLD - STAT_CHANGE_FRAMES); + slide = (1 - alpha) * (1 - alpha) * CHANGE_SLIDE; + } + else if (stat.changeTimer < STAT_CHANGE_FADE) alpha = (float)stat.changeTimer / STAT_CHANGE_FADE; + bool isLoss = stat.change < 0; + KColor color = kcolor_rgba(isLoss ? CHANGE_BRIGHT : CHANGE_DIM, isLoss ? CHANGE_DIM : CHANGE_BRIGHT, CHANGE_DIM, + alpha * CHANGE_ALPHA); + font.DrawString(changeText, vector_make(at.x + CHANGE_OFFSET_X + slide, at.y), vector_make(1, 1), color, settings); +} + +// 0084c2c0 With the found HUD on and a player shown, draws the stat icons down from a position (the deal chances as +// one with Duality), then each player's texts beside them: the second player's a little lower and to the right, and +// none for the stats players share (the deal chances, and speed for Jacob and Esau). +void StatHUD::Render(Vector at) +{ + if (!g_manager->optionsConfig.isFoundHudEnabled || (!players[0].player && !players[1].player)) return; + + bool isTwoPlayers = players[0].player && players[1].player; + float rowSpacing = isTwoPlayers ? ROW_SPACING_TWO_PLAYERS : ROW_SPACING; + float textRaise = isTwoPlayers ? TEXT_RAISE_TWO_PLAYERS : TEXT_RAISE; + SpriteDraw icon; + icon.position = at; + for (int i = 0; i < STAT_UNUSED; i++) + { + bool isDealShared = i == STAT_DEVIL_CHANCE && isDualityOwned; + if (sprite.animState.animData && isDealShared) + sprite.animState.AdvancePosition(sprite.animState.animData->length - 1); + else if (sprite.animState.animData) sprite.animState.SetFrameFloat((float)i); + sprite.color._tint[3] = ICON_ALPHA; + sprite.Render(icon); + if (isDealShared) i = STAT_ANGEL_CHANCE; + icon.position.y += rowSpacing; + } + + Vector shake = g_game->screenShakeOffset; + for (int playerIndex = 0; playerIndex < STAT_PLAYER_COUNT; playerIndex++) + { + StatHUDPlayer& slot = players[playerIndex]; + if (!slot.player) return; + + int playerType = slot.player->playerType; + bool isJacobOrEsau = playerType == PLAYER_JACOB || playerType == PLAYER_ESAU; + float column = (float)playerIndex * PLAYER_COLUMN_SHIFT + at.x; + float rowY = at.y; + for (int i = 0; i < STAT_UNUSED; i++, rowY += rowSpacing) + { + if (i == STAT_ANGEL_CHANCE && isDualityOwned) continue; + + bool isShared = i == STAT_DEVIL_CHANCE || i == STAT_ANGEL_CHANCE || (i == STAT_SPEED && isJacobOrEsau); + if (isShared && playerIndex != 0) continue; + float y = isShared ? rowY : (float)playerIndex * PLAYER_ROW_SHIFT + textRaise + rowY; + Vector textAt = vector_make(column + shake.x + TEXT_OFFSET_X, y + shake.y + TEXT_OFFSET_Y); + stat_text_render(slot, i, textAt, playerIndex == 0 ? 1 : SECOND_PLAYER_SHADE); + } + } +} diff --git a/src/stat_hud.h b/src/stat_hud.h new file mode 100644 index 0000000..87a694c --- /dev/null +++ b/src/stat_hud.h @@ -0,0 +1,77 @@ +#pragma once + +#include "anm2.h" +#include +#include + +constexpr int STAT_PLAYER_COUNT = 2; +constexpr int STAT_TRACKER_COUNT = 10; +constexpr float STAT_THRESHOLD_FINE = 0.01f; +constexpr float STAT_THRESHOLD_COARSE = 0.1f; + +// The stats the stats HUD tracks, in the order of hudstats2.anm2's frames. The last two are tracked but never shown. +enum StatHudStat : int +{ + STAT_SPEED, + STAT_TEARS, + STAT_DAMAGE, + STAT_RANGE, + STAT_SHOT_SPEED, + STAT_LUCK, + STAT_DEVIL_CHANCE, + STAT_ANGEL_CHANCE, + STAT_UNUSED, + STAT_PLANETARIUM_CHANCE +}; + +// Which stats RecomputeStats recomputes, a bit per stat. Either deal chance bit recomputes both. +enum StatHudFlag : uint32_t +{ + STAT_FLAG_SPEED = 1 << STAT_SPEED, + STAT_FLAG_TEARS = 1 << STAT_TEARS, + STAT_FLAG_DAMAGE = 1 << STAT_DAMAGE, + STAT_FLAG_RANGE = 1 << STAT_RANGE, + STAT_FLAG_SHOT_SPEED = 1 << STAT_SHOT_SPEED, + STAT_FLAG_LUCK = 1 << STAT_LUCK, + STAT_FLAG_DEVIL_CHANCE = 1 << STAT_DEVIL_CHANCE, + STAT_FLAG_ANGEL_CHANCE = 1 << STAT_ANGEL_CHANCE, + STAT_FLAG_UNUSED = 1 << STAT_UNUSED, + STAT_FLAG_PLANETARIUM_CHANCE = 1 << STAT_PLANETARIUM_CHANCE, + STAT_FLAGS_ALL = 0xffffffff +}; + +// A stat the stats HUD shows: its value, the value before its change, the change shown and for how long, and the +// smallest change worth showing. +struct StatTracker +{ + float change = 0; + float previous = 0; + float threshold = STAT_THRESHOLD_FINE; + float value = 0; + int changeTimer = 0; + + void set(float newValue, bool isAnimated); +}; + +// The stats one player shows. +struct StatHUDPlayer +{ + std::array stats{}; + Entity_Player* player = nullptr; +}; + +// The stats HUD (REPENTOGON's StatHUD) under the pickups, with the found HUD option: speed, tears, damage, range, shot +// speed, luck and the deal chances, for up to two players, each change shown beside its stat for a while. +struct StatHUD +{ + ANM2 sprite; + std::array players{}; + bool isDualityOwned = false; + + void reset(); + int player_slot_get(Entity_Player* player); + void Update(); + void Render(Vector at); + void RecomputeStats(int playerId, uint32_t flags); + void update_player(Entity_Player* oldPlayer, Entity_Player* newPlayer); +}; diff --git a/src/temporary_effects.cpp b/src/temporary_effects.cpp new file mode 100644 index 0000000..c41e1b1 --- /dev/null +++ b/src/temporary_effects.cpp @@ -0,0 +1,229 @@ +#include "temporary_effects.h" +#include "entity_player.h" +#include "game.h" +#include "log.h" +#include "room.h" +#include "manager.h" +#include + +constexpr int BOOK_OF_SHADOWS_SOUND_END = 1027; +constexpr uint32_t TRINKET_ID_BITS = 0x7fff; + +// 00435f80 An effect of an item, counted from nothing, lasting the item's cooldown. +TemporaryEffect::TemporaryEffect(ItemConfig_Item* effectItem) : item(effectItem), cooldown(effectItem->maxCooldown) +{} + +// Whether an item is one of the collectibles, as the effect lookups by collectible id ask. +static bool is_collectible(ItemConfig_Item* item) +{ + return item->type == ITEM_PASSIVE || item->type == ITEM_ACTIVE || item->type == ITEM_FAMILIAR; +} + +// The effect whose item matches a test, or null while the effects are disabled. +template static TemporaryEffect* effect_find(TemporaryEffects& effects, Test isMatch) +{ + if (effects.isDisabled) return nullptr; + + auto found = std::ranges::find_if(effects.effects, [&](TemporaryEffect& effect) { return isMatch(*effect.item); }); + return found == effects.effects.end() ? nullptr : &*found; +} + +// Lets the owner react to an effect that ran out or was removed, and asks for the stats again. +void TemporaryEffects::effect_removed(ItemConfig_Item* item, int count) +{ + if (player) player->trigger_collectible_effect_removed(item, count); + else reconstruction_missing("Room::TriggerEffectRemoved 007ea1a0, which the room's takeover has not declared yet"); + isEvaluateCachePending = true; +} + +// 00930220 Adds copies of an effect: to the existing entry, extending its time, or as a new entry that may put on its +// costume. +void TemporaryEffects::AddEffect(const TemporaryEffect& effect, bool isAddCostume, int count) +{ + if (isDisabled || count == 0) return; + + if (TemporaryEffect* existing = effect_find(*this, [&](ItemConfig_Item& item) { return &item == effect.item; })) + { + existing->count += count; + existing->cooldown += effect.cooldown; + } + else + { + effects.push_back(effect); + effects.back().count = count; + if (player && isAddCostume) player->AddCostume(effect.item, false); + } + cacheFlags |= effect.item->cacheFlags; + isEvaluateCachePending = true; +} + +// 009302e0 Adds copies of a collectible's effect. +void TemporaryEffects::AddCollectibleEffect(int collectibleId, bool isAddCostume, int count) +{ + if (ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(collectibleId)) + AddEffect(TemporaryEffect(item), isAddCostume, count); +} + +// 00930330 Adds copies of a trinket's effect, golden or not. +void TemporaryEffects::AddTrinketEffect(int trinketId, bool isAddCostume, int count) +{ + auto& trinkets = g_manager->itemConfig.trinkets; + uint32_t id = (uint32_t)trinketId & TRINKET_ID_BITS; + if (id < trinkets.size() && trinkets[id]) AddEffect(TemporaryEffect(trinkets[id].get()), isAddCostume, count); +} + +// 00930390 Adds copies of a null item's effect. +void TemporaryEffects::AddNullEffect(int nullItemId, bool isAddCostume, int count) +{ + auto& nullItems = g_manager->itemConfig.nullItems; + if (nullItemId >= 0 && nullItemId < (int)nullItems.size() && nullItems[nullItemId]) + AddEffect(TemporaryEffect(nullItems[nullItemId].get()), isAddCostume, count); +} + +// 009303f0 Removes copies of an item's effect, all of them for a count of -1, dropping the entry when none are left. +void TemporaryEffects::RemoveEffect(ItemConfig_Item* item, int count) +{ + if (isDisabled) return; + + auto found = std::ranges::find(effects, item, &TemporaryEffect::item); + if (found == effects.end()) return; + + int removed = (uint32_t)count < (uint32_t)found->count ? count : found->count; + found->count -= removed; + if (found->count < 1) effects.erase(found); + effect_removed(item, removed); + cacheFlags |= item->cacheFlags; +} + +// 009304a0 Removes copies of a collectible's effect. +void TemporaryEffects::RemoveCollectibleEffect(int collectibleId, int count) +{ + if (ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(collectibleId)) RemoveEffect(item, count); +} + +// 009304f0 Removes copies of a trinket's effect. +void TemporaryEffects::RemoveTrinketEffect(int trinketId, int count) +{ + auto& trinkets = g_manager->itemConfig.trinkets; + uint32_t id = (uint32_t)trinketId & TRINKET_ID_BITS; + if (id < trinkets.size() && trinkets[id]) RemoveEffect(trinkets[id].get(), count); +} + +// 00930550 Removes copies of a null item's effect. +void TemporaryEffects::RemoveNullEffect(int nullItemId, int count) +{ + auto& nullItems = g_manager->itemConfig.nullItems; + if (nullItemId >= 0 && nullItemId < (int)nullItems.size() && nullItems[nullItemId]) + RemoveEffect(nullItems[nullItemId].get(), count); +} + +// 009305c0 Whether an item's effect is on. +bool TemporaryEffects::has_item_effect(ItemConfig_Item* item) +{ + return effect_find(*this, [&](ItemConfig_Item& effectItem) { return &effectItem == item; }); +} + +// 009305f0 Whether a collectible's effect is on. +bool TemporaryEffects::HasCollectibleEffect(int collectibleId) +{ + return GetCollectibleEffect(collectibleId); +} + +// 00930640 Whether a trinket's effect is on. +bool TemporaryEffects::HasTrinketEffect(int trinketId) +{ + return GetTrinketEffect(trinketId); +} + +// 00930680 Whether a null item's effect is on. +bool TemporaryEffects::HasNullEffect(int nullItemId) +{ + return GetNullEffect(nullItemId); +} + +// 00930980 A collectible's effect, or null. +TemporaryEffect* TemporaryEffects::GetCollectibleEffect(int collectibleId) +{ + return effect_find(*this, [&](ItemConfig_Item& item) { return is_collectible(&item) && item.id == collectibleId; }); +} + +// 009309c0 A trinket's effect, or null. +TemporaryEffect* TemporaryEffects::GetTrinketEffect(int trinketId) +{ + return effect_find(*this, [&](ItemConfig_Item& item) { return item.type == ITEM_TRINKET && item.id == trinketId; }); +} + +// 00930a30 A null item's effect, or null. +TemporaryEffect* TemporaryEffects::GetNullEffect(int nullItemId) +{ + return effect_find(*this, [&](ItemConfig_Item& item) { return item.type == ITEM_NULL && item.id == nullItemId; }); +} + +// 00930a70 How many copies of a collectible's effect are on. +int TemporaryEffects::GetCollectibleEffectNum(int collectibleId) +{ + TemporaryEffect* effect = GetCollectibleEffect(collectibleId); + return effect ? effect->count : 0; +} + +// 00930aa0 How many copies of a trinket's effect are on. +int TemporaryEffects::GetTrinketEffectNum(int trinketId) +{ + TemporaryEffect* effect = GetTrinketEffect(trinketId); + return effect ? effect->count : 0; +} + +// 00930ae0 How many copies of a null item's effect are on. +int TemporaryEffects::GetNullEffectNum(int nullItemId) +{ + TemporaryEffect* effect = GetNullEffect(nullItemId); + return effect ? effect->count : 0; +} + +// 009306c0 Removes every effect, or every one that does not persist, from the last back, until a pass removes none. +// Dead Bird stays while its player is down to its last heart (two for Eve). +void TemporaryEffects::ClearEffects(bool isClearPersistent) +{ + if (isDisabled) return; + + bool isAnyRemoved = true; + while (isAnyRemoved) + { + isAnyRemoved = false; + for (size_t i = effects.size(); i-- > 0 && i < effects.size();) + { + ItemConfig_Item* item = effects[i].item; + if (!isClearPersistent && item->isPersistentEffect) continue; + if (is_collectible(item) && item->id == COLLECTIBLE_DEAD_BIRD && player && player->is_dead_bird_kept()) + continue; + + cacheFlags |= item->cacheFlags; + int count = effects[i].count; + effects.erase(effects.begin() + (long)i); + effect_removed(item, count); + isAnyRemoved = true; + } + } +} + +// 00930820 Counts every timed effect down, removing the ones that run out. Book of Shadows sounds as its shield runs +// out. The stats asked for are those of the effects removed this frame. +void TemporaryEffects::Update() +{ + if (isDisabled) return; + + cacheFlags = 0; + for (size_t i = effects.size(); i-- > 0 && i < effects.size();) + { + TemporaryEffect& effect = effects[i]; + if (effect.cooldown <= 0 || --effect.cooldown != 0) continue; + + ItemConfig_Item* item = effect.item; + if (is_collectible(item) && item->id == COLLECTIBLE_BOOK_OF_SHADOWS && effect.unknown == 0) + sound_play(BOOK_OF_SHADOWS_SOUND_END); + cacheFlags |= item->cacheFlags; + int count = effect.count; + effects.erase(effects.begin() + (long)i); + effect_removed(item, count); + } +} diff --git a/src/temporary_effects.h b/src/temporary_effects.h new file mode 100644 index 0000000..8b02d35 --- /dev/null +++ b/src/temporary_effects.h @@ -0,0 +1,54 @@ +#pragma once + +#include "classes.h" +#include + +struct ItemConfig_Item; + +// An item's effect lasting for the room or the floor: the item, how many copies, and the frames left. +struct TemporaryEffect +{ + ItemConfig_Item* item = nullptr; + int count = 0; + int cooldown = 0; + int unknown = 0; + + TemporaryEffect() = default; + explicit TemporaryEffect(ItemConfig_Item* effectItem); +}; + +// 007537a0 The effects list getter is the public field. +// The item effects a player or the room has for now (Lua's TemporaryEffects), the cache flags their changes set, and +// whether they changed since the stats were evaluated. The room's has no player. +struct TemporaryEffects +{ + std::vector effects; + Entity_Player* player = nullptr; + uint32_t cacheFlags = 0; + bool isDisabled = false; + bool isEvaluateCachePending = false; + + void AddEffect(const TemporaryEffect& effect, bool isAddCostume, int count); + void AddCollectibleEffect(int collectibleId, bool isAddCostume, int count); + void AddTrinketEffect(int trinketId, bool isAddCostume, int count); + void AddNullEffect(int nullItemId, bool isAddCostume, int count); + void RemoveEffect(ItemConfig_Item* item, int count); + void RemoveCollectibleEffect(int collectibleId, int count); + void RemoveTrinketEffect(int trinketId, int count); + void RemoveNullEffect(int nullItemId, int count); + bool has_item_effect(ItemConfig_Item* item); + bool HasCollectibleEffect(int collectibleId); + bool HasTrinketEffect(int trinketId); + bool HasNullEffect(int nullItemId); + void ClearEffects(bool isClearPersistent); + void Update(); + TemporaryEffect* GetCollectibleEffect(int collectibleId); + TemporaryEffect* GetTrinketEffect(int trinketId); + TemporaryEffect* GetNullEffect(int nullItemId); + int GetCollectibleEffectNum(int collectibleId); + int GetTrinketEffectNum(int trinketId); + int GetNullEffectNum(int nullItemId); + +private: + void effect_removed(ItemConfig_Item* item, int count); +};